Class ArchiveLoadOptions

Class ArchiveLoadOptions

Namespace: Aspose.Zip
Assembly: Aspose.Zip.dll (25.5.0)

Options with which archive is loaded from a compressed file.

public class ArchiveLoadOptions

Inheritance

object ArchiveLoadOptions

Inherited Members

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

Gets or sets the password to decrypt entries.

public string DecryptionPassword { get; set; }

Property Value

string

Examples

You can provide decryption password once on archive extraction.

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);

            }
        }
    }
}

See Also

ArchiveEntry . Open ( string )

Encoding

Gets or sets the encoding for entries’ names.

public Encoding Encoding { get; set; }

Property Value

Encoding

Examples

Entry name composed using specified encoding regardless of zip file properties.

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

Gets or sets the delegate invoked when some bytes have been extracted.

public EventHandler<progresseventargs> EntryExtractionProgressed { get; set; }

Property Value

EventHandler < ProgressEventArgs &gt;

Examples

Archive archive = new Archive("archive.zip", 
new ArchiveLoadOptions() { EntryExtractionProgressed = (s, e) =&gt; { int percent = (int)((100 * e.ProceededBytes) / ((ArchiveEntry)s).UncompressedSize); } })

Remarks

Event sender is the Aspose.Zip.ArchiveEntry instance which extraction is progressed.

EntryListed

Gets or sets the delegate invoked when an entry listed within table of content.

public EventHandler<entryeventargs> EntryListed { get; set; }

Property Value

EventHandler < EntryEventArgs &gt;

Examples

Archive archive = new Archive("archive.zip", new ArchiveLoadOptions() { EntryListed = (s, e) =&gt; { Console.WriteLine(e.Entry.Name); } });

SkipChecksumVerification

Get or set a value indicating whether checksum verification of ZIP entries be skipped and mismatch ignored. Default is false.

public bool SkipChecksumVerification { get; set; }

Property Value

bool

 English