Class RarArchiveLoadOptions

Class RarArchiveLoadOptions

Namespace: Aspose.Zip.Rar
Assembly: Aspose.Zip.dll (25.2.0)

Options with which Aspose.Zip.Rar.RarArchive is loaded from compressed file.

public class RarArchiveLoadOptions

Inheritance

objectRarArchiveLoadOptions

Inherited Members

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Constructors

RarArchiveLoadOptions()

public RarArchiveLoadOptions()

Properties

DecryptionPassword

Gets or sets the password to decrypt entries and entry names.

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

            }
        }
    }
}

See Also

RarArchiveEntry.Open(string)

 English