Class RarArchive
ชื่อพื้นที่: Aspose.Zip.Rar การประกอบ: Aspose.Zip.dll (25.5.0)
ประเภทนี้เป็นไฟล์เอกสาร RAR ใช้เพื่อสกัดเอกสาร RAR
public class RarArchive : IArchive, IDisposable
Inheritance
Implements
อนุญาโตตุลาการ
object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Constructors
RarArchive(ลวด, RarArchiveLoadOptions)
เปิดตัวตัวอย่างใหม่ของคลาส Aspose.Zip.Rar.RarArchive และประกอบรายการเข้าที่สามารถสกัดจากเอกสาร
public RarArchive(string path, RarArchiveLoadOptions loadOptions = null)
Parameters
path
string
การรับรองเต็มรูปแบบหรือเส้นทางที่เกี่ยวข้องกับไฟล์สํารองข้อมูล
loadOptions
RarArchiveLoadOptions
ตัวเลือกในการโหลดไฟล์ที่มีอยู่ด้วย
Examples
ตัวอย่างต่อไปนี้จะ extract a archive จากนั้น decompress the first entry to a .
var extracted = new MemoryStream();
using (RarArchive archive = new RarArchive("data.rar"))
{
using (var decompressed = archive.Entries[0].Open())
{
byte[] b = new byte[8192];
int bytesRead;
while (0 < (bytesRead = decompressed.Read(b, 0, b.Length)))
extracted.Write(b, 0, bytesRead);
}
}
Remarks
ผู้ก่อสร้างนี้ไม่บีบอัดส่วนใด ๆ ดู Aspose.Zip.Rar.RarArchiveEntry.Open(System.String) วิธีการบีบอัด
Exceptions
path’ is null.
ผู้โทรไม่ได้รับอนุญาตให้เข้าถึง
path" เป็นที่ว่างเปล่ามีพื้นที่สีขาวเท่านั้นหรือมีตัวอักษรที่ไม่ถูกต้อง
การเข้าถึงไฟล์ path" ถูกปฏิเสธ
ระบุ path’, ชื่อไฟล์, หรือทั้งสองเกินความยาวสูงสุดที่กําหนดโดยระบบ ตัวอย่างเช่นบนแพลตฟอร์มที่ใช้ Windows, เส้นทางจะต้องน้อยกว่า 248 หมายเลขและชื่อไฟล์จะต้องน้อยกว่า 260 หมายเลข
ไฟล์ใน path" มีคอลัมน์ (:) ในส่วนกลางของเส้น
ไฟล์ไม่ได้พบ
เส้นทางที่ระบุไม่ถูกต้องเช่นอยู่บนไดรฟ์ที่ไม่มีแผนที่
ไฟล์นี้เปิดแล้ว
RarArchive(Stream, RarArchiveLoadOptions)
เปิดตัวตัวอย่างใหม่ของคลาส Aspose.Zip.Rar.RarArchive และประกอบรายการเข้าที่สามารถสกัดจากเอกสาร
public RarArchive(Stream sourceStream, RarArchiveLoadOptions loadOptions = null)
Parameters
sourceStream
Stream
แหล่งกําเนิดของไฟล์
loadOptions
RarArchiveLoadOptions
ตัวเลือกในการโหลดไฟล์ที่มีอยู่ด้วย
Examples
ตัวอย่างต่อไปนี้ decrypter และ decompress entry เป็นครั้งแรกที่ a .
var fs = File.OpenRead("encrypted.rar");
var extracted = new MemoryStream();
using (RarArchive archive = new RarArchive(fs, new RarArchiveLoadOptions() { DecryptionPassword = "p@s$" }))
{
using (var decompressed = archive.Entries[0].Open())
{
byte[] b = new byte[8192];
int bytesRead;
while (0 < (bytesRead = decompressed.Read(b, 0, b.Length)))
extracted.Write(b, 0, bytesRead);
}
}
Remarks
ผู้ก่อสร้างนี้ไม่บีบอัดส่วนใด ๆ ดู Aspose.Zip.Rar.RarArchiveEntry.Open(System.String) วิธีการบีบอัด
Exceptions
sourceStream’ is not seekable.
การลงนามที่ผิดพลาดสําหรับไฟล์ - หรือ - ไฟล์ไม่ได้เป็นไฟล์ RAR
Properties
Entries
ได้รับป้อนของ Aspose.Zip.Rar.RarArchiveEntry ประเภทซึ่งเป็นเอกสารที่หายาก
public ReadOnlyCollection<rararchiveentry> Entries { get; }
คุณสมบัติมูลค่า
ReadOnlyCollection < RarArchiveEntry >
Methods
Dispose(บอล)
ทําหน้าที่ที่กําหนดโดยการใช้งานที่เกี่ยวข้องกับการปล่อยทรัพยากรที่ไม่ได้รับการจัดการหรือรีไซเคิล
protected virtual void Dispose(bool disposing)
Parameters
disposing
bool
ไม่ว่าทรัพยากรที่จัดการควรจะถูกกําจัด
Dispose()
ทําหน้าที่ที่กําหนดโดยการใช้งานที่เกี่ยวข้องกับการปล่อยทรัพยากรที่ไม่ได้รับการจัดการหรือรีไซเคิล
public void Dispose()
ExtractToDirectory(รั้ว, รั้ว)
extract all the files in the archive to the directory provided
[Obsolete("For extraction encrypted RAR archive please provide password in constructor with Aspose.Zip.Rar.RarArchiveLoadOptions.DecryptionPassword")]
public void ExtractToDirectory(string destinationDirectory, string password = null)
Parameters
destinationDirectory
string
เส้นทางไปยังไดเรกทอรีเพื่อวางไฟล์ที่สกัด
password
string
ตัวเลือกรหัสผ่านสําหรับการ decryption
Examples
using (var archive = new RarArchive("archive.rar"))
{
archive.ExtractToDirectory("C:\extracted", "$ecRet");
}
Remarks
หากไดเรกทอรีไม่ได้มีมันจะถูกสร้างขึ้น
Exceptions
destinationDirectory’ is null.
เส้นทางที่ระบุชื่อไฟล์หรือทั้งสองเกินความยาวสูงสุดที่กําหนดโดยระบบ ตัวอย่างเช่นบนแพลตฟอร์มที่ใช้ Windows เส้นทางจะต้องน้อยกว่า 248 หมายเลขและชื่อไฟล์จะต้องน้อยกว่า 260 หมายเลข
ผู้โทรไม่ได้รับอนุญาตที่จําเป็นในการเข้าถึงไดเรกทอรีที่มีอยู่
หากไดเรกทอรีไม่ได้มีเส้นทางมีตัวอักษรของ colon (:) ซึ่งไม่ได้เป็นส่วนหนึ่งของแท็กไดรฟ์ (“C:”).
destinationDirectory’ is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters by using the System.IO.Path.GetInvalidPathChars method. -or- path is prefixed with, or contains, only a colon character (:).
แผนที่ที่ระบุโดยเส้นทางเป็นไฟล์ -หรือ- ชื่อเครือข่ายไม่ทราบ
ExtractToDirectory(รั้ว)
extract all the files in the archive to the directory provided
public void ExtractToDirectory(string destinationDirectory)
Parameters
destinationDirectory
string
เส้นทางไปยังไดเรกทอรีเพื่อวางไฟล์ที่สกัด
Examples
using (var archive = new RarArchive("archive.rar"))
{
archive.ExtractToDirectory("C:\extracted");
}
Remarks
หากไดเรกทอรีไม่ได้มีมันจะถูกสร้างขึ้น
Exceptions
destinationDirectory’ is null.
เส้นทางที่ระบุชื่อไฟล์หรือทั้งสองเกินความยาวสูงสุดที่กําหนดโดยระบบ ตัวอย่างเช่นบนแพลตฟอร์มที่ใช้ Windows เส้นทางจะต้องน้อยกว่า 248 หมายเลขและชื่อไฟล์จะต้องน้อยกว่า 260 หมายเลข
ผู้โทรไม่ได้รับอนุญาตที่จําเป็นในการเข้าถึงไดเรกทอรีที่มีอยู่
หากไดเรกทอรีไม่ได้มีเส้นทางมีตัวอักษรของ colon (:) ซึ่งไม่ได้เป็นส่วนหนึ่งของแท็กไดรฟ์ (“C:”).
destinationDirectory’ is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters by using the System.IO.Path.GetInvalidPathChars method. -or- path is prefixed with, or contains, only a colon character (:).
แผนที่ที่ระบุโดยเส้นทางเป็นไฟล์ -หรือ- ชื่อเครือข่ายไม่ทราบ