Rebex
Products Downloads Buy Support Contact
Show / Hide Table of Contents

ZipArchive Class

Namespace: Rebex.IO.Compression
Assembly: Rebex.Zip.dll (version 7.0.9119)

Represents a ZIP archive and provides methods to work with it.

Syntax
public class ZipArchive : IDisposable, IEnumerable<ZipItem>, IEnumerable
Inheritance
Object
ZipArchive
Implements
IDisposable
IEnumerable<ZipItem>
IEnumerable
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()

Constructors

Name Description
ZipArchive(Stream)

Initializes a ZipArchive object with the specified ZIP archive stream.

ZipArchive(Stream, ArchiveStreamCloseMode)

Initializes a ZipArchive object with the specified ZIP archive stream.

ZipArchive(Stream, ZipArchiveOpenOptions)

Initializes a ZipArchive object with the specified ZIP archive stream.

ZipArchive(String)

Initializes a ZipArchive object with the specified ZIP archive.

ZipArchive(String, ArchiveOpenMode)

Initializes a ZipArchive object with the specified ZIP archive.

ZipArchive(String, ArchiveOpenMode, ArchiveAccessMode)

Initializes a ZipArchive object with the specified ZIP file.

Properties

Name Description
Comment

Gets or sets the comment for the whole ZIP archive.

CompressionLevel

Gets or sets the compression level to be used by Add(String) and AddFile(String) methods. Possible values are 0-9, where 0 means no compression (fastest) and 9 means best compression (slowest). 6 (medium compression and speed) is a default value.

CompressionMethod

Gets or sets the compression method to be used by Add(String) and AddFile(String) methods.

DefaultLogWriter

Gets or sets a default log writer used by all new instances of ZipArchive object.

EncryptionAlgorithm

Gets or sets the encryption algorithm to be used by Add(String) and AddFile(String) methods.

FilePath

Gets an absolute path to the ZIP archive file or a null reference (Nothing in Visual Basic) if the path is not available.

IsBusy

Gets a value indicating whether there is any asynchronous operation on the current object in progress.

IsDisposed

Gets a value indicating whether the ZipArchive object is disposed.

IsReadOnly

Gets a value indicating whether the ZIP archive is only open for reading.

Item[String]

Gets the ZipItem object that represents the specified path.

LogWriter

Gets or sets the logger used by this object.

Options

Gets the archive options object.

Password

Gets or sets a password. Null reference (Nothing in Visual Basic) means don't encrypt newly added files.

SaveMode

Gets or sets a save mode, which determines when changes are saved to the underlying stream.

Methods

Name Description
Add(FileSet)

Adds specified local files or directories to the ZIP archive.

Add(FileSet, String)

Adds specified local files or directories to a directory within the ZIP archive.

Add(FileSet, String, TransferMethod, ActionOnExistingFiles)

Adds specified local files or directories to a directory within the ZIP archive.

Add(String)

Adds specified local files or directories to the ZIP archive.

Add(String, String)

Adds specified local files or directories to a directory within the ZIP archive.

Add(String, String, TraversalMode)

Adds specified local files or directories to a directory within the ZIP archive.

Add(String, String, TraversalMode, TransferMethod, ActionOnExistingFiles)

Adds specified local files or directories to a directory within the ZIP archive.

Add(String, String, String)

Adds specified local files or directories to a directory within the specified ZIP archive.

Add(String, String, String, TraversalMode, TransferMethod, ActionOnExistingFiles)

Adds specified local files or directories to a directory within the specified ZIP archive.

AddAsync(FileSet, String, TransferMethod, ActionOnExistingFiles, Object)

Begins asynchronous Add operation. Adds specified local files or directories to a directory within the ZIP archive.

AddAsync(String, String, TraversalMode, TransferMethod, ActionOnExistingFiles, Object)

Begins asynchronous Add operation. Adds specified local files or directories to a directory within the ZIP archive.

AddFile(Stream, String)

Adds data from the specified stream to the ZIP archive.

AddFile(Stream, String, ActionOnExistingFiles)

Adds data from the specified stream to the ZIP archive.

AddFile(String)

Adds the specified file to the root directory of the ZIP archive.

AddFile(String, String)

Adds the specified local file to the specified directory within the ZIP archive.

AddFile(String, String, ActionOnExistingFiles)

Adds the specified local file to the specified directory within the ZIP archive.

AddFileAsync(Stream, String, ActionOnExistingFiles, Object)

Begins asynchronous AddFile operation. Adds data from the specified stream to the ZIP archive.

AddFileAsync(Stream, String, Object)

Begins asynchronous AddFile operation. Adds data from the specified stream to the ZIP archive.

AddFileAsync(String, String, ActionOnExistingFiles, Object)

Begins asynchronous AddFile operation. Adds the specified local file to the specified directory within the ZIP archive.

AddFileAsync(String, String, Object)

Begins asynchronous AddFile operation. Adds the specified local file to the specified directory within the ZIP archive.

Cancel()

Requests the currently processing operation to be canceled as soon as possible.

CheckIntegrity()

Checks integrity of the ZIP archive structure.

CheckIntegrity(Stream)

Checks integrity of the ZIP archive structure.

CheckIntegrity(String)

Checks integrity of the ZIP archive structure.

Close()

Closes the current ZipArchive object and releases any resources associated with it (file or stream). This is the same as calling Close(ArchiveSaveAction) with Auto argument.

Close(ArchiveSaveAction)

Closes the current ZipArchive object and releases any resources associated with it (file or stream).

CreateDirectory(String)

Creates a directory within the ZIP archive.

CreateDirectory(String, String)

Creates new empty directory within the specified ZIP archive.

Decrypt(String, String, String)

Decrypts an existing ZIP archive to the specified zip archive.

Delete(FileSet)

Deletes files and/or directories within the ZIP archive.

Delete(FileSet, ArchiveSaveAction)

Deletes files and/or directories within the ZIP archive.

Delete(String)

Deletes files and/or empty directories within the ZIP archive.

Delete(String, TraversalMode)

Deletes files and/or directories within the ZIP archive.

Delete(String, TraversalMode, ArchiveSaveAction)

Deletes files and/or directories within the ZIP archive.

Delete(String, String)

Deletes files and/or empty directories from the specified ZIP archive.

Delete(String, String, ArchiveSaveAction)

Deletes files and/or empty directories from the specified ZIP archive.

Delete(String, String, TraversalMode)

Deletes files and/or directories from the specified ZIP archive.

Delete(String, String, TraversalMode, ArchiveSaveAction)

Deletes files and/or directories from the specified ZIP archive.

DeleteAsync(FileSet, ArchiveSaveAction, Object)

Begins asynchronous Delete operation. Deletes files and/or directories within the ZIP archive.

DeleteAsync(String, TraversalMode, ArchiveSaveAction, Object)

Begins asynchronous Delete operation. Deletes files and/or directories within the ZIP archive.

DeleteFile(String)

Deletes a file within the ZIP archive.

DeleteFile(String, ArchiveSaveAction)

Deletes a file within the ZIP archive.

DeleteFileAsync(String, ArchiveSaveAction, Object)

Begins asynchronous DeleteFile operation. Deletes a file within the ZIP archive.

DirectoryExists(String)

Gets a value indicating whether the specified directory is present in the ZIP archive.

Dispose(Boolean)

Releases the unmanaged resources used by the ZipArchive and optionally releases the managed resources.

Encrypt(String, String, String, EncryptionAlgorithm)

Encrypts an existing ZIP archive to the specified file.

Extract(FileSet, String)

Extracts specified archive item(s) into the specified local directory.

Extract(FileSet, String, TransferMethod, ActionOnExistingFiles)

Extracts specified archive item(s) into the specified local directory.

Extract(String, String)

Extracts specified archive item(s) into the specified local directory.

Extract(String, String, TraversalMode)

Extracts specified archive item(s) into the specified local directory.

Extract(String, String, TraversalMode, TransferMethod, ActionOnExistingFiles)

Extracts specified archive item(s) into the specified local directory.

Extract(String, String, String)

Extracts specified archive item(s) from the specified ZIP archive into the specified local directory.

Extract(String, String, String, TraversalMode, TransferMethod, ActionOnExistingFiles)

Extracts specified archive item(s) from the specified ZIP archive into the specified local directory.

ExtractAll(String)

Extracts the whole content of the ZIP archive into the specified local directory.

ExtractAll(String, ActionOnExistingFiles)

Extracts the whole content of the ZIP archive into the specified local directory.

ExtractAll(String, TransferMethod, ActionOnExistingFiles)

Extracts the whole content of the ZIP archive into the specified local directory.

ExtractAll(String, String)

Extracts the whole content of the specified ZIP archive into the specified local directory.

ExtractAll(String, String, TransferMethod, ActionOnExistingFiles)

Extracts the whole content of the specified ZIP archive into the specified local directory.

ExtractAsync(FileSet, String, TransferMethod, ActionOnExistingFiles, Object)

Begins asynchronous Extract operation. Extracts specified archive item(s) into the specified local directory.

ExtractAsync(String, String, TraversalMode, TransferMethod, ActionOnExistingFiles, Object)

Begins asynchronous Extract operation. Extracts specified archive item(s) into the specified local directory.

ExtractFile(String, Stream)

Extracts the specified archive file item into a stream.

ExtractFile(String, String)

Extracts the specified archive file item into a local file.

ExtractFile(String, String, ActionOnExistingFiles)

Extracts the specified archive file item into a local file.

ExtractFileAsync(String, Stream, Object)

Begins asynchronous ExtractFile operation. Extracts the specified archive file item into a stream.

ExtractFileAsync(String, String, ActionOnExistingFiles, Object)

Begins asynchronous ExtractFile operation. Extracts the specified archive file item into a local file.

ExtractFileAsync(String, String, Object)

Begins asynchronous ExtractFile operation. Extracts the specified archive file item into a local file.

FileExists(String)

Gets a value indicating whether the specified file is present in the ZIP archive.

GetEnumerator()

Returns an enumerator that iterates through the collection.

GetItem(String)

Gets the ZipItem object that represents the specified path.

GetItems()

Gets the collection of all archive items stored within the ZIP archive.

GetItems(FileSet)

Gets the collection of archive items stored within the ZIP archive matching the specified set.

GetItems(FileSet, ArchiveItemTypes)

Gets the collection of archive items stored within the ZIP archive matching the specified set.

GetItems(String, TraversalMode)

Gets the collection of archive items stored within the ZIP archive matching the specified path or mask using the specified traversal mode.

GetItems(String, TraversalMode, ArchiveItemTypes)

Gets the collection of archive items stored within the ZIP archive matching the specified path or mask and type using the specified traversal mode.

GetItemsAsync(FileSet, ArchiveItemTypes, Object)

Begins asynchronous GetItems operation. Gets the collection of archive items stored within the ZIP archive matching the specified set.

GetItemsAsync(Object)

Begins asynchronous GetItems operation. Gets the collection of all archive items stored within the ZIP archive.

GetItemsAsync(String, TraversalMode, ArchiveItemTypes, Object)

Begins asynchronous GetItems operation. Gets the collection of archive items stored within the ZIP archive matching the specified path or mask and type using the specified traversal mode.

Move(String, String)

Moves or renames an archive item (file or directory).

Move(String, String, String)

Moves (renames) an archive item (file or directory) within the specified ZIP archive.

MoveAsync(String, String, Object)

Begins asynchronous Move operation. Moves or renames an archive item (file or directory).

Save()

Saves pending changes into the ZIP archive and flushes the underlying stream.

Save(ArchiveSaveAction)

Saves pending changes into the ZIP archive and flushes the underlying stream.

SaveAsync(ArchiveSaveAction, Object)

Begins asynchronous Save operation. Saves pending changes into the ZIP archive and flushes the underlying stream.

Events

Name Description
PasswordRequired

Occurs when a password is needed for decompressing an item.

ProblemDetected

Occurs when a problem is detected in Add, Extract, Delete or GetItems methods, making it possible for the handler to choose a desired action.

ProgressChanged

Occurs when a significant action occurs in Add, Extract, Delete, GetItems methods.

ShrinkProgress

Occurs when a data block is processed while shrinking the archive.

Explicit Interface Implementations

Name Description
IEnumerable.GetEnumerator()

Returns an enumerator that iterates through the collection.

IDisposable.Dispose()

Releases all resources used by the current ZipArchive.

In This Article
© REBEX ČR s.r.o. Back to top
Privacy policy
Manage cookies