Class RarArchiveLoadOptions
Class RarArchiveLoadOptions
Namespace: Aspose.Zip.Rar
Assembly: Aspose.Zip.dll (25.1.0)
Các tùy chọn mà Aspose.Zip.Rar.RarArchive được tải từ tệp nén.
public class RarArchiveLoadOptions
Kế thừa
object ← RarArchiveLoadOptions
Các thành viên kế thừa
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Các hàm khởi tạo
RarArchiveLoadOptions()
public RarArchiveLoadOptions()
Các thuộc tính
DecryptionPassword
Lấy hoặc thiết lập mật khẩu để giải mã các mục và tên mục.
public string DecryptionPassword { get; set; }
Giá trị thuộc tính
Ví dụ
Bạn có thể cung cấp mật khẩu giải mã một lần khi giải nén tệp lưu trữ.
using (FileStream fs = File.OpenRead("encrypted_archive.rar"))
{
using (var extracted = File.Create("extracted.bin"))
{
using (RarArchive archive = new RarArchive(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);
}
}
}
}