Class ArchiveLoadOptions
Namespace: Aspose.Zip
Assembly: Aspose.Zip.dll (25.1.0)
Opzioni con cui l’archivio viene caricato dal file compresso.
public class ArchiveLoadOptions
Ereditarietà
Membri Ereditati
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Costruttori
ArchiveLoadOptions()
public ArchiveLoadOptions()
Proprietà
DecryptionPassword
Ottiene o imposta la password per decrittografare le voci.
public string DecryptionPassword { get; set; }
Valore della Proprietà
Esempi
Puoi fornire la password di decrittografia una sola volta durante l'estrazione dell'archivio.
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);
}
}
}
}
Vedi Anche
Encoding
Ottiene o imposta la codifica per i nomi delle voci.
public Encoding Encoding { get; set; }
Valore della Proprietà
Esempi
Nome della voce composto utilizzando la codifica specificata indipendentemente dalle proprietà del file 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
Ottiene o imposta il delegato invocato quando alcuni byte sono stati estratti.
public EventHandler<progresseventargs> EntryExtractionProgressed { get; set; }
Valore della Proprietà
EventHandler<ProgressEventArgs>
Esempi
Archive archive = new Archive("archive.zip",
new ArchiveLoadOptions() { EntryExtractionProgressed = (s, e) => { int percent = (int)((100 * e.ProceededBytes) / ((ArchiveEntry)s).UncompressedSize); } })
Osservazioni
Il mittente dell’evento è l’istanza Aspose.Zip.ArchiveEntry di cui l’estrazione è in corso.
EntryListed
Ottiene o imposta il delegato invocato quando un’entry è elencata all’interno della tabella dei contenuti.
public EventHandler<entryeventargs> EntryListed { get; set; }
Valore della Proprietà
EventHandler<EntryEventArgs>
Esempi
Archive archive = new Archive("archive.zip", new ArchiveLoadOptions() { EntryListed = (s, e) => { Console.WriteLine(e.Entry.Name); } });