Search Results for

    Show / Hide Table of Contents

    Class IronZipArchive

    An IronZipArchive for ZIP-type ".zip" Archives

    Inheritance
    System.Object
    IronBaseArchive
    IronZipArchive
    Implements
    System.IDisposable
    Inherited Members
    IronBaseArchive._storedArchivePath
    IronBaseArchive._internalStream
    IronBaseArchive.isDisposed
    Namespace: IronZip
    Assembly: IronZip.dll
    Syntax
    public class IronZipArchive : IronBaseArchive, IDisposable

    Constructors

    IronZipArchive(Byte[], String)

    Open an existing protected Archive. Please use in a using block. Use the SaveAs method to export the archive.

    Declaration
    public IronZipArchive(byte[] Bytes, string Password = null)
    Parameters
    Type Name Description
    System.Byte[] Bytes

    Byte[] containing the existing archive.

    System.String Password

    Password for opening the protected archive.

    IronZipArchive(Int32)

    Creating an empty archive. Please use in a using block. Use the SaveAs method to export the archive.

    Declaration
    public IronZipArchive(int Compression = 9)
    Parameters
    Type Name Description
    System.Int32 Compression

    Optionally sets the compression level. 0 is the weakest, 9 is the highest compression, with 9 as the default value.

    IronZipArchive(Stream, String)

    Open an existing protected Archive. Please use in a using block. Use the SaveAs method to export the archive.

    Declaration
    public IronZipArchive(Stream StreamPath, string Password = null)
    Parameters
    Type Name Description
    System.IO.Stream StreamPath

    Stream containing the existing archive.

    System.String Password

    Password for opening the protected archive.

    IronZipArchive(String, String)

    Open an existing Archive. Please use in a using block. Use the SaveAs method to export the archive.

    Declaration
    public IronZipArchive(string ArchivePath, string Password = null)
    Parameters
    Type Name Description
    System.String ArchivePath

    File path to open the existing Archive. Example:

    a.zip
    You may use an absolute path.

    System.String Password

    Password for opening the protected archive.

    Properties

    Comment

    Sets/Gets the comment for the entire archive.

    Declaration
    public string Comment { get; set; }
    Property Value
    Type Description
    System.String

    Count

    Retrieves the total number of entries in the archive.

    Declaration
    public int Count { get; }
    Property Value
    Type Description
    System.Int32

    The count of entries within the archive.

    ZipSaveOptions

    Set the security settings for Zip Archive

    Declaration
    public ZipSaveOptions ZipSaveOptions { get; set; }
    Property Value
    Type Description
    ZipSaveOptions

    Methods

    Add(String)

    Adds an archive entry (file) to the Archive. These entries will appear as files when the Archive is extracted.

    Declaration
    public void Add(string EntryFilePath)
    Parameters
    Type Name Description
    System.String EntryFilePath

    Filepath to the archive entry to add

    AddArchiveEntry(String)

    Adds an archive entry (file) to the Archive. These entries will appear as files when the Archive is extracted.

    Declaration
    public void AddArchiveEntry(string EntryFilePath)
    Parameters
    Type Name Description
    System.String EntryFilePath

    Filepath to the archive entry to add

    Compression(Int32)

    Sets the compression level (default is 9).

    Declaration
    public void Compression(int Compression)
    Parameters
    Type Name Description
    System.Int32 Compression

    0 is weakest, 9 is highest compression. 9 is default.

    Contains(String)

    Checks if an entry with the specified name exists in the archive.

    Declaration
    public bool Contains(string EntryName)
    Parameters
    Type Name Description
    System.String EntryName

    The name of the entry to check for existence.

    Returns
    Type Description
    System.Boolean

    true if an entry with the specified name exists in the archive; otherwise, false.

    Delete(String)

    Deletes an entry from the archive.

    Declaration
    public void Delete(string EntryName)
    Parameters
    Type Name Description
    System.String EntryName

    The name of the entry to be deleted.

    Dispose()

    Check the license before using IronZIP

    Declaration
    public override void Dispose()
    Overrides
    IronBaseArchive.Dispose()
    Exceptions
    Type Condition
    IronSoftware.Exceptions.LicensingException

    Encrypt(String, EncryptionMethods)

    Sets the password for a specific encryption method.

    Declaration
    public void Encrypt(string Password, EncryptionMethods EncryptionMethods)
    Parameters
    Type Name Description
    System.String Password

    The password to set.

    EncryptionMethods EncryptionMethods

    The encryption method to use. Supported types are traditional, AES128, and AES256.

    Entries()

    Load the entries of an existing Archive

    Declaration
    public List<Entry> Entries()
    Returns
    Type Description
    System.Collections.Generic.List<Entry>

    ExtractArchiveToDirectory(String, String, String)

    Will load an Archive and extract it to a Directory (System Folder)

    Declaration
    public static void ExtractArchiveToDirectory(string ArchiveSourcePath, string SaveDirectoryPath, string Password = null)
    Parameters
    Type Name Description
    System.String ArchiveSourcePath

    Path to the Archive to extract

    System.String SaveDirectoryPath

    Directory to extract files to

    System.String Password

    Optional password to open the archive

    FromArchive(String, String)

    Creates an instance of IronZipArchive from an existing archive.

    Declaration
    public static IronZipArchive FromArchive(string ArchivePath, string Password = null)
    Parameters
    Type Name Description
    System.String ArchivePath

    The path to the existing archive.

    System.String Password

    The password for decryption (null if not encrypted).

    Returns
    Type Description
    IronZipArchive

    An instance of IronZipArchive representing the specified archive.

    FromDirectory(String, Int32)

    Declaration
    public static IronZipArchive FromDirectory(string DirectoryPath, int Compression = 9)
    Parameters
    Type Name Description
    System.String DirectoryPath
    System.Int32 Compression
    Returns
    Type Description
    IronZipArchive

    FromFile(String, Int32)

    Creates an Archive with a specific file to add to it. Please use in a using block. Use the SaveAs method to export the archive.

    Declaration
    public static IronZipArchive FromFile(string FilePath, int Compression = 9)
    Parameters
    Type Name Description
    System.String FilePath

    File Entry to add to the Archive

    System.Int32 Compression

    Optionally set the compression level. 0 is weakest, 9 is highest compression. 9 is default.

    Returns
    Type Description
    IronZipArchive

    Returns the constructed IronZipArchive with the file entry added.

    FromFiles(String[], Int32)

    Creates an Archive with some files to add to it. Please use in a using block. Use the SaveAs method to export the archive.

    Declaration
    public static IronZipArchive FromFiles(string[] Paths, int Compression = 9)
    Parameters
    Type Name Description
    System.String[] Paths

    File Entries to add to the Archive

    System.Int32 Compression

    Optionally set the compression level. 0 is weakest, 9 is highest compression. 9 is default.

    Returns
    Type Description
    IronZipArchive

    Returns the constructed IronZipArchive with the file entries added.

    RemoveEncryption()

    Remove the encryption password from the zip archive.

    Declaration
    public void RemoveEncryption()

    ReplaceEntry(String, String)

    Replaces an entry within the archive with a new one.

    Declaration
    public void ReplaceEntry(string OldEntry, string NewEntry)
    Parameters
    Type Name Description
    System.String OldEntry

    The name of the entry to be replaced.

    System.String NewEntry

    The name of the new entry to replace the existing one.

    Save()

    Save the archive

    Declaration
    public override void Save()
    Overrides
    IronBaseArchive.Save()
    Remarks

    Users cannot add additional entries after saving

    Save(ZipSaveOptions)

    Save the archive

    Declaration
    public void Save(ZipSaveOptions ZipSaveOptions = null)
    Parameters
    Type Name Description
    ZipSaveOptions ZipSaveOptions

    Options for IronZipArchive

    Remarks

    Users cannot add additional entries after saving

    SaveAs(String)

    Save the archive to the specified path

    Declaration
    public override void SaveAs(string Path)
    Parameters
    Type Name Description
    System.String Path

    Save path

    Overrides
    IronBaseArchive.SaveAs(String)
    Remarks

    Users cannot add additional entries after saving

    SaveAs(String, ZipSaveOptions)

    Save the archive to the specified path

    Declaration
    public void SaveAs(string Path, ZipSaveOptions ZipSaveOptions = null)
    Parameters
    Type Name Description
    System.String Path

    Save path

    ZipSaveOptions ZipSaveOptions

    Options for IronZipArchive

    Remarks

    Users cannot add additional entries after saving

    SetPassword(String, EncryptionMethods)

    Sets the password for a specific encryption method.

    Declaration
    public void SetPassword(string Password, EncryptionMethods EncryptionMethods)
    Parameters
    Type Name Description
    System.String Password

    The password to set.

    EncryptionMethods EncryptionMethods

    The encryption method to use. Supported types are traditional, AES128, and AES256.

    Implements

    System.IDisposable

    Inherited members

    _storedArchivePath
    _internalStream
    isDisposed
    ☀
    ☾
    Downloads
    • Download with NuGet
    • Start for Free
    In This Article
    Back to top
    Install with NuGet
    Want to deploy IronZIP to a live project for FREE?
    What’s included?
    30 days of fully-functional product
    Test and share in a live environment
    No watermarks in production
    Get your free 30-day Trial Key instantly.
    No credit card or account creation required
    Your Trial License Key has been emailed to you.
    Download IronZIP free to apply
    your Trial Licenses Key
    Install with NuGet View Licenses
    Licenses from $499. Have a question? Get in touch.