Class ArchiveLoadOptions
Nazwa przestrzeń: Aspose.Zip Zestawienie: Aspose.Zip.dll (25.5.0)
Opcje, z którymi archiwum jest pobierane z kompresyjnego pliku.
public class ArchiveLoadOptions
Inheritance
Dziedziczeni członkowie
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
Otrzymuje lub ustawia hasło do dekryptowania wpisów.
public string DecryptionPassword { get; set; }
Wartość nieruchomości
Examples
Możesz podać hasło dekrypcji raz na ekstrakcji archiwum.
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);
}
}
}
}
Zobacz również
ArchiveEntry . Open ( string )
Encoding
Otrzymuje lub ustawia kodowanie nazw wpisów.
public Encoding Encoding { get; set; }
Wartość nieruchomości
Examples
Nazwa wejścia składa się za pomocą określonego kodowania niezależnie od właściwości pliku 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
Otrzymuje lub ustawia delegat wezwany, gdy niektóre bajty zostały wyciągnięte.
public EventHandler<progresseventargs> EntryExtractionProgressed { get; set; }
Wartość nieruchomości
EventHandler • < ProgressEventArgs >
Examples
Archive archive = new Archive("archive.zip",
new ArchiveLoadOptions() { EntryExtractionProgressed = (s, e) => { int percent = (int)((100 * e.ProceededBytes) / ((ArchiveEntry)s).UncompressedSize); } })
Remarks
Przesyłanie wydarzeń jest instancją Aspose.Zip.ArchiveEntry, której ekstrakcja jest zaawansowana.
EntryListed
Otrzymuje lub umieszcza wezwanego delegata, gdy wpis jest wymieniony w tabeli treści.
public EventHandler<entryeventargs> EntryListed { get; set; }
Wartość nieruchomości
EventHandler • < EntryEventArgs >
Examples
Archive archive = new Archive("archive.zip", new ArchiveLoadOptions() { EntryListed = (s, e) => { Console.WriteLine(e.Entry.Name); } });
SkipChecksumVerification
Uzyskaj lub ustaw wartość wskazującą, czy weryfikacja kwoty kontrolnej wpisów ZIP zostanie pominięta, a nieprawidłowo zignorowana.
public bool SkipChecksumVerification { get; set; }