Skip to main content

ZipArchive Members

The central object of the library - a package of entries containing compressed data.

Constructors

Name Description
ZipArchive() Initializes a new instance of the ZipArchive class with default settings.
ZipArchive(Boolean) Initializes a new instance of the ZipArchive class and specifies whether to catch exceptions in archive operations.

Properties

Name Description
CatchExceptions static Allows you to set an application-wide flag that specifies whether exceptions which occur in ZipArchive operations are caught.
Count Obtains the number of zip items in the archive.
EncryptionType Gets or sets the default encryption type.
FileName Reserved for future use.
Item[Int32] Provides indexed access to an individual zip item in the archive.
Item[String] Provides access to individual zip items in the archive by their names.
OptionsBehavior Provides access to archive options.
Password Gets or sets the password for an encrypted archive.

Methods

Name Description
AddByteArray(String, Byte[]) Creates a zip item from a byte array and adds it to archive.
AddDirectory(String, String) Recursively add files and directories to the archive.
AddDirectory(String) Recursively add files and directories to the archive directory named by the last component of the specified path.
AddFile(String, String) Creates a zip file item for the specified file and adds it to the specified path in the archive.
AddFile(String) Creates a zip file item for the specified file and adds it to the archive.
AddFiles(IEnumerable<String>, String) Adds files to the archive at the specified path.
AddFiles(IEnumerable<String>) Adds files to archive.
AddStream(String, Stream) Creates a zip stream item and adds it to the archive.
AddText(String, String, Encoding) Creates a text zip item and adds it to archive.
AddText(String, String) Creates a text zip item and adds it to the archive.
AddText(String) Creates an empty text zip item and adds it to archive.
Dispose() Clears all zip items, disposes all associated streams and releases all resources used by the ZipArchive object.
Equals(Object, Object) static Determines whether the specified object instances are considered equal. Inherited from Object.
Equals(Object) Determines whether the specified object is equal to the current object. Inherited from Object.
Extract() Extract all archive items as files into the current directory.
Extract(String, AllowFileOverwriteMode) Extracts all archive items as files into the specified directory and enables you to define the behavior in case of file name conflicts.
Extract(String) Extracts all archive items as files into the specified directory.
GetHashCode() Serves as the default hash function. Inherited from Object.
GetType() Gets the Type of the current instance. Inherited from Object.
IsValid() Reserved for future use.
MemberwiseClone() protected Creates a shallow copy of the current Object. Inherited from Object.
Read(Stream, Encoding, Boolean) static Static method that creates a ZipArchive instance from the specified stream containing zipped data, use the specified encoding for the zip item names and allows you not to catch exceptions when extracting a particular zip entry.
Read(Stream, Encoding) static Static method that creates a ZipArchive instance from the specified stream containing zipped data.
Read(Stream) static Static method that creates a ZipArchive instance from the specified stream containing zipped data.
Read(String, Encoding, Boolean) static Static method that creates a ZipArchive instance from the archive file, uses the specified encoding for the zip item names and allows you not to catch exceptions when extracting a particular zip entry.
Read(String, Encoding) static Static method that creates a ZipArchive instance from the specified archive file.
Read(String) static Static method that creates a ZipArchive instance from the specified archive file.
ReferenceEquals(Object, Object) static Determines whether the specified Object instances are the same instance. Inherited from Object.
RemoveItem(ZipItem) Deletes a specified zip item from the archive.
RemoveItem(String) Deletes a specified zip item from the archive.
Save(Stream) Compresses data and saves it to a specified stream.
Save(String) Compresses data and saves it to a file.
ToString() Returns a string that represents the current object. Inherited from Object.
UpdateDirectory(String, String) Recursively updates files and nested directories starting from the specified directory.
UpdateDirectory(String) Recursively updates files and nested directories starting from the specified directory.
UpdateFile(String, String) Updates content of the zip file item.
UpdateFile(String) Updates content of the zip file item.
UpdateStream(String, Stream) Updates the content of the zip stream item.
UpdateText(String, String, Encoding) Updates the content of the zip text item and specifies a new character encoding.
UpdateText(String, String) Updates the content of the zip text item.
Validate() Verifies archive entries by extracting them into memory and catching exceptions.

Events

Name Description
AllowFileOverwrite Occurs when the item extracted from the archive tries to overwrite a file that already exists.
Error Fires when an error occurs while adding files to the archive, processing archive items or saving the archive.
ItemAdding Occurs before a zip item is added to the archive.
Progress Occurs evenly while the items are being compressed to indicate progress.
See Also