Class ArchiveLoadOptions
Namespace: Aspose.Zip
Assembly: Aspose.Zip.dll (25.1.0)
ตัวเลือกที่ใช้ในการโหลดคลังจากไฟล์ที่ถูกบีบอัด
public class ArchiveLoadOptions
การสืบทอด
สมาชิกที่สืบทอด
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
ตัวสร้าง
ArchiveLoadOptions()
public ArchiveLoadOptions()
คุณสมบัติ
DecryptionPassword
รับหรือกำหนดรหัสผ่านในการถอดรหัสรายการ
public string DecryptionPassword { get; set; }
ค่า Property
ตัวอย่าง
คุณสามารถกำหนดรหัสผ่านในการถอดรหัสได้ครั้งเดียวเมื่อทำการสกัดคลัง
using (FileStream fs = File.OpenRead("encrypted_archive.zip"))
{
using (var extracted = File.Create("extracted.bin"))
{
using (Archive archive = new Archive(fs, new ArchiveLoadOptions() { 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);
}
}
}
}
ดูเพิ่มเติม
Encoding
รับหรือกำหนดการเข้ารหัสสำหรับชื่อรายการ
public Encoding Encoding { get; set; }
ค่า Property
ตัวอย่าง
ชื่อรายการที่ประกอบขึ้นโดยใช้การเข้ารหัสที่กำหนดโดยไม่คำนึงถึงคุณสมบัติของไฟล์ zip
using (FileStream fs = File.OpenRead("archive.zip"))
{
using (Archive archive = new Archive(fs, new ArchiveLoadOptions() { Encoding = System.Text.Encoding.GetEncoding(932) }))
{
string name = archive.Entries[0].Name;
}
}
EntryExtractionProgressed
รับหรือกำหนดตัวแทนที่ถูกเรียกเมื่อมีการสกัดบางไบต์
public EventHandler<progresseventargs> EntryExtractionProgressed { get; set; }
ค่า Property
EventHandler<ProgressEventArgs>
ตัวอย่าง
Archive archive = new Archive("archive.zip",
new ArchiveLoadOptions() { EntryExtractionProgressed = (s, e) => { int percent = (int)((100 * e.ProceededBytes) / ((ArchiveEntry)s).UncompressedSize); } })
หมายเหตุ
ผู้ส่งเหตุการณ์คืออินสแตนซ์ของ Aspose.Zip.ArchiveEntry ที่การสกัดกำลังดำเนินอยู่
EntryListed
รับหรือกำหนดตัวแทนที่ถูกเรียกเมื่อรายการถูกแสดงในตารางเนื้อหา
public EventHandler<entryeventargs> EntryListed { get; set; }
ค่า Property
EventHandler<EntryEventArgs>
ตัวอย่าง
Archive archive = new Archive("archive.zip", new ArchiveLoadOptions() { EntryListed = (s, e) => { Console.WriteLine(e.Entry.Name); } });