Class ArchiveLoadOptions

Class ArchiveLoadOptions

名称: Aspose.Zip 收藏: Aspose.Zip.dll (25.5.0)

使用哪些选项从压缩文件上传档案。

public class ArchiveLoadOptions

Inheritance

object ArchiveLoadOptions

继承人

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

收到或设置密码来解密输入。

public string DecryptionPassword { get; set; }

财产价值

string

Examples

您可以在存档提取时提供解密密码。

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

            }
        }
    }
}

看也

ArchiveEntry . Open ( string )

Encoding

收到或设置输入名称的编码。

public Encoding Encoding { get; set; }

财产价值

Encoding

Examples

使用指定的编码组成的输入名称,无论 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; }

财产价值

EventHandler < ProgressEventArgs >

Examples

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

Remarks

事件发送器是 Aspose.Zip.ArchiveEntry 案例,该案例的提取进展。

EntryListed

接收或设置被召唤的代表,当内容表中列出的输入。

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

财产价值

EventHandler < EntryEventArgs >

Examples

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

SkipChecksumVerification

获取或设置一个值,表明 ZIP 输入的支票验证是否被忽略,错误是否被忽略。

public bool SkipChecksumVerification { get; set; }

财产价值

bool

 中文