Class ArchiveLoadOptions
Tên không gian: Aspose.Zip Tổng hợp: Aspose.Zip.dll (25.5.0)
Các tùy chọn mà lưu trữ được tải từ một tệp bị nén.
public class ArchiveLoadOptions
Inheritance
Thành viên thừa kế
object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Constructors
ArchiveLoadOptions()
public ArchiveLoadOptions()
Properties
DecryptionPassword
Nhận hoặc đặt mật khẩu để giải mã các entries.
public string DecryptionPassword { get; set; }
Giá trị bất động sản
Examples
Bạn có thể cung cấp mật khẩu giải mã một lần trên lưu trữ.
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);
}
}
}
}
Xem thêm
ArchiveEntry . Open ( string )
Encoding
Nhận hoặc đặt mã hóa cho tên đăng nhập.
public Encoding Encoding { get; set; }
Giá trị bất động sản
Examples
Tên nhập được tạo thành bằng mã hóa cụ thể bất kể thuộc tính tệp 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
Nhận hoặc đặt đại diện được gọi khi một số byte đã được rút ra.
public EventHandler<progresseventargs> EntryExtractionProgressed { get; set; }
Giá trị bất động sản
EventHandler < ProgressEventArgs >
Examples
Archive archive = new Archive("archive.zip",
new ArchiveLoadOptions() { EntryExtractionProgressed = (s, e) => { int percent = (int)((100 * e.ProceededBytes) / ((ArchiveEntry)s).UncompressedSize); } })
Remarks
Người gửi sự kiện là trường hợp Aspose.Zip.ArchiveEntry mà khai thác đang tiến bộ.
EntryListed
Nhận hoặc đặt đại diện được gọi khi một bài đăng được liệt kê trong bảng nội dung.
public EventHandler<entryeventargs> EntryListed { get; set; }
Giá trị bất động sản
EventHandler < EntryEventArgs >
Examples
Archive archive = new Archive("archive.zip", new ArchiveLoadOptions() { EntryListed = (s, e) => { Console.WriteLine(e.Entry.Name); } });
SkipChecksumVerification
Nhận hoặc đặt một giá trị cho thấy liệu xác minh thanh toán của các bản ghi ZIP sẽ bị bỏ qua và không phù hợp được bỏ qua.
public bool SkipChecksumVerification { get; set; }