ZipArchive
Represents a package of compressed files in the zip archive format.
Definition
Namespace:Telerik.Windows.Zip
Assembly:Telerik.Windows.Zip.dll
Syntax:
public class ZipArchive : IDisposable, INotifyPropertyChanged
Inheritance: objectZipArchive
Implements:
Events
Occurs when a property value changes.
public event PropertyChangedEventHandler PropertyChanged
Implements:
Methods
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
protected ~ZipArchive()
Creates a new instance of the ZipArchive class.
public static ZipArchive Create(Stream stream, Encoding entryNameEncoding, CompressionSettings compressionSettings, EncryptionSettings encryptionSettings, bool useStrictNaming = true)
The stream that contains the archive.
entryNameEncodingEncodingThe encoding to use when reading or writing entry names in this archive. Specify a value for this parameter only when an encoding is required for interoperability with zip archive tools and libraries that do not support UTF-8 encoding for entry names.
compressionSettingsCompressionSettingsCompression settings.
encryptionSettingsEncryptionSettingsEncryption settings.
useStrictNamingboolA value indicating whether the paths of the entries will be verified to be limited to relative paths that cannot traverse upwards in the file system. True by default.
Returns:Creates a new instance of the ZipArchive class.
public static ZipArchive Create(Stream stream, Encoding entryNameEncoding)
The stream that contains the archive.
entryNameEncodingEncodingThe encoding to use when reading or writing entry names in this archive. Specify a value for this parameter only when an encoding is required for interoperability with zip archive tools and libraries that do not support UTF-8 encoding for entry names.
Returns:Creates a new instance of the ZipArchive class.
public static ZipArchive Create(Stream stream)
The stream that contains the archive.
Returns:Creates an empty entry that has the specified path and entry name in the zip archive.
public ZipArchiveEntry CreateEntry(string entryName, CompressionSettings settings)
A path, relative to the root of the archive, that specifies the name of the entry to be created.
settingsCompressionSettingsCompression settings.
Returns:An empty entry in the zip archive.
Exceptions:The entry name is empty.
The entry name is null.
The zip archive does not support writing.
The zip archive has been disposed.
Creates an empty entry that has the specified path and entry name in the zip archive.
public ZipArchiveEntry CreateEntry(string entryName)
A path, relative to the root of the archive, that specifies the name of the entry to be created.
Returns:An empty entry in the zip archive.
Exceptions:The entry name is empty.
The entry name is null.
The zip archive does not support writing.
The zip archive has been disposed.
Releases the resources used by the current instance of the ZipArchive class.
public void Dispose()
Implements:
Called by the Dispose() and Finalize() methods to release the unmanaged resources used by the current instance of the ZipArchive class, and optionally finishes writing the archive and releases the managed resources.
protected virtual void Dispose(bool disposing)
True to finish writing the archive and release unmanaged and managed resources; false to release only unmanaged resources.
Retrieves a wrapper for the specified entry in the zip archive.
public ZipArchiveEntry GetEntry(string entryName)
A path, relative to the root of the archive, that identifies the entry to retrieve.
Returns:A wrapper for the specified entry in the archive; null if the entry does not exist in the archive.
Exceptions:The entry name is empty.
The entry name is null.
The zip archive does not support reading.
The zip archive has been disposed.
The zip archive is corrupt, and its entries cannot be retrieved.
Opens an existing archive and returns a new instance of the ZipArchive class.
public static ZipArchive Read(Stream stream, Encoding entryNameEncoding, CompressionSettings compressionSettings, DecryptionSettings decryptionSettings, bool useStrictNaming = true)
The stream that contains the archive to be read.
entryNameEncodingEncodingThe encoding to use when reading or writing entry names in this archive. Specify a value for this parameter only when an encoding is required for interoperability with zip archive tools and libraries that do not support UTF-8 encoding for entry names.
compressionSettingsCompressionSettingsCompression settings.
decryptionSettingsDecryptionSettingsDecryption settings.
useStrictNamingboolA value indicating whether the paths of the entries will be verified to be limited to relative paths that cannot traverse upwards in the file system. True by default.
Returns:Opens an existing archive and returns a new instance of the ZipArchive class.
public static ZipArchive Read(Stream stream, Encoding entryNameEncoding)
The stream that contains the archive to be read.
entryNameEncodingEncodingThe encoding to use when reading or writing entry names in this archive. Specify a value for this parameter only when an encoding is required for interoperability with zip archive tools and libraries that do not support UTF-8 encoding for entry names.
Returns:Opens an existing archive and returns a new instance of the ZipArchive class.
public static ZipArchive Read(Stream stream)
The stream that contains the archive to be read.
Returns:Opens an existing archive for update and returns a new instance of the ZipArchive class.
public static ZipArchive Update(Stream stream, Encoding entryNameEncoding, CompressionSettings compressionSettings, DecryptionSettings decryptionSettings, bool useStrictNaming = true)
The stream that contains the archive to be read.
entryNameEncodingEncodingThe encoding to use when reading or writing entry names in this archive. Specify a value for this parameter only when an encoding is required for interoperability with zip archive tools and libraries that do not support UTF-8 encoding for entry names.
compressionSettingsCompressionSettingsCompression settings.
decryptionSettingsDecryptionSettingsDecryption settings.
useStrictNamingboolA value indicating whether the paths of the entries will be verified to be limited to relative paths that cannot traverse upwards in the file system. True by default.
Returns:Opens an existing archive for update and returns a new instance of the ZipArchive class.
public static ZipArchive Update(Stream stream, Encoding entryNameEncoding)
The stream that contains the archive to be read.
entryNameEncodingEncodingThe encoding to use when reading or writing entry names in this archive. Specify a value for this parameter only when an encoding is required for interoperability with zip archive tools and libraries that do not support UTF-8 encoding for entry names.
Returns:Opens an existing archive for update and returns a new instance of the ZipArchive class.
public static ZipArchive Update(Stream stream)
The stream that contains the archive to be read.
Returns:Properties
Gets the collection of entries that are currently in the zip archive.
public IEnumerable<ZipArchiveEntry> Entries { get; }
The zip archive does not support reading.
The zip archive has been disposed.
The zip archive is corrupt, and its entries cannot be retrieved.
Gets entry name encoding.
public Encoding EntryNameEncoding { get; }
Gets a value that describes the type of action the zip archive can perform on entries.
public ZipArchiveMode Mode { get; }