C# Класс ICSharpCode.SharpZipLib.Zip.ZipFile

Наследование: IEnumerable, IDisposable
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
KeysRequired KeysRequiredEventHandler

Private Properties

Свойство Тип Описание
AddEntry void
AddUpdate void
CheckClassicPassword void
CheckUpdating void
CopyBytes void
CopyDescriptorBytes void
CopyDescriptorBytesDirect void
CopyEntry void
CopyEntryDataDirect void
CopyEntryDirect void
CreateAndInitDecryptionStream Stream
CreateAndInitEncryptionStream Stream
DisposeInternal void
FindExistingUpdate int
FindExistingUpdate int
GetBuffer byte[]
GetDescriptorSize int
GetOutputStream Stream
GetTransformedDirectoryName string
GetTransformedFileName string
LocateBlockWithSignature long
LocateEntry long
ModifyEntry void
OnKeysRequired void
PostUpdateCleanup void
ReadEntries void
ReadLEUint uint
ReadLEUlong ulong
ReadLEUshort ushort
Reopen void
Reopen void
RunUpdates void
TestLocalHeader long
UpdateCommentOnly void
UpdateComparer int
WriteCentralDirectoryHeader int
WriteEncryptionHeader void
WriteLEInt void
WriteLEShort void
WriteLEUint void
WriteLEUlong void
WriteLEUshort void
WriteLeLong void
WriteLocalEntryHeader void
ZipFile System
this ZipEntry

Открытые методы

Метод Описание
AbortUpdate ( ) : void

Abort updating leaving the archive unchanged.

Add ( IStaticDataSource dataSource, string entryName ) : void

Add a file entry with data.

Add ( IStaticDataSource dataSource, string entryName, CompressionMethod compressionMethod ) : void

Add a file entry with data.

Add ( IStaticDataSource dataSource, string entryName, CompressionMethod compressionMethod, bool useUnicodeText ) : void

Add a file entry with data.

Add ( ZipEntry entry ) : void

Add a ZipEntry that contains no data.

This can be used to add directories, volume labels, or empty file entries.

Add ( string fileName ) : void

Add a file to the archive.

Add ( string fileName, CompressionMethod compressionMethod ) : void

Add a new entry to the archive.

Add ( string fileName, CompressionMethod compressionMethod, bool useUnicodeText ) : void

Add a new entry to the archive.

Add ( string fileName, string entryName ) : void

Add a file to the archive.

AddDirectory ( string directoryName ) : void

Add a directory entry to the archive.

BeginUpdate ( ) : void

Begin updating this ZipFile archive.

BeginUpdate ( IArchiveStorage archiveStorage ) : void

Begin updating to this ZipFile archive.

BeginUpdate ( IArchiveStorage archiveStorage, IDynamicDataSource dataSource ) : void

Begin updating this ZipFile archive.

Close ( ) : void

Closes the ZipFile. If the stream is owned then this also closes the underlying input stream. Once closed, no further instance methods should be called.

CommitUpdate ( ) : void

Commit current updates, updating this archive.

Create ( Stream outStream ) : ZipFile

Create a new ZipFile whose data will be stored on a stream.

Create ( string fileName ) : ZipFile

Create a new ZipFile whose data will be stored in a file.

Delete ( string fileName ) : bool

Delete an entry by name

Delete ( ZipEntry entry ) : void

Delete a ZipEntry from the archive.

Dispose ( ) : void
FindEntry ( string name, bool ignoreCase ) : int

Return the index of the entry with a matching name

GetEntry ( string name ) : ZipEntry

Searches for a zip entry in this archive with the given name. String comparisons are case insensitive

GetEnumerator ( ) : IEnumerator

Gets an enumerator for the Zip entries in this Zip file.

GetInputStream ( ZipEntry entry ) : Stream

Gets an input stream for reading the given zip entry data in an uncompressed form. Normally the ZipEntry should be an entry returned by GetEntry().

GetInputStream ( long entryIndex ) : Stream

Creates an input stream reading a zip entry

SetComment ( string comment ) : void

Set the file comment to be recorded when the current update is commited.

TestArchive ( bool testData ) : bool

Test an archive for integrity/validity

Testing will terminate on the first error found.

TestArchive ( bool testData, TestStrategy strategy, ZipTestResultHandler resultHandler ) : bool

Test an archive for integrity/validity

ZipFile ( FileStream file ) : System

Opens a Zip file reading the given FileStream.

ZipFile ( Stream stream ) : System

Opens a Zip file reading the given Stream.

ZipFile ( string name ) : System

Opens a Zip file with the given name for reading.

Защищенные методы

Метод Описание
Dispose ( bool disposing ) : void

Releases the unmanaged resources used by the this instance and optionally releases the managed resources.

Приватные методы

Метод Описание
AddEntry ( ZipFile workFile, ZipUpdate update ) : void
AddUpdate ( ZipUpdate update ) : void
CheckClassicPassword ( CryptoStream classicCryptoStream, ZipEntry entry ) : void
CheckUpdating ( ) : void
CopyBytes ( ZipUpdate update, Stream destination, Stream source, long bytesToCopy, bool updateCrc ) : void
CopyDescriptorBytes ( ZipUpdate update, Stream dest, Stream source ) : void
CopyDescriptorBytesDirect ( ZipUpdate update, Stream stream, long &destinationPosition, long sourcePosition ) : void
CopyEntry ( ZipFile workFile, ZipUpdate update ) : void
CopyEntryDataDirect ( ZipUpdate update, Stream stream, bool updateCrc, long &destinationPosition, long &sourcePosition ) : void
CopyEntryDirect ( ZipFile workFile, ZipUpdate update, long &destinationPosition ) : void
CreateAndInitDecryptionStream ( Stream baseStream, ZipEntry entry ) : Stream
CreateAndInitEncryptionStream ( Stream baseStream, ZipEntry entry ) : Stream
DisposeInternal ( bool disposing ) : void
FindExistingUpdate ( ZipEntry entry ) : int
FindExistingUpdate ( string fileName ) : int
GetBuffer ( ) : byte[]

Get a raw memory buffer.

GetDescriptorSize ( ZipUpdate update ) : int

Get the size of the source descriptor for a ZipUpdate.

GetOutputStream ( ZipEntry entry ) : Stream

Get an output stream for the specified ZipEntry

GetTransformedDirectoryName ( string name ) : string
GetTransformedFileName ( string name ) : string
LocateBlockWithSignature ( int signature, long endLocation, int minimumBlockSize, int maximumVariableData ) : long
LocateEntry ( ZipEntry entry ) : long

Locate the data for a given entry.

ModifyEntry ( ZipFile workFile, ZipUpdate update ) : void
OnKeysRequired ( string fileName ) : void

Handles getting of encryption keys when required.

PostUpdateCleanup ( ) : void
ReadEntries ( ) : void

Search for and read the central directory of a zip file filling the entries array.

ReadLEUint ( ) : uint

Read a uint in little endian byte order.

ReadLEUlong ( ) : ulong
ReadLEUshort ( ) : ushort

Read an unsigned short in little endian byte order.

Reopen ( ) : void
Reopen ( Stream source ) : void
RunUpdates ( ) : void
TestLocalHeader ( ZipEntry entry, HeaderTest tests ) : long

Test a local header against that provided from the central directory

UpdateCommentOnly ( ) : void
UpdateComparer ( ZipUpdate zx, ZipUpdate zy ) : int

Compares two objects and returns a value indicating whether one is less than, equal to or greater than the other.

WriteCentralDirectoryHeader ( ZipEntry entry ) : int
WriteEncryptionHeader ( Stream stream, long crcValue ) : void
WriteLEInt ( int value ) : void

Write an int in little endian byte order.

WriteLEShort ( int value ) : void
WriteLEUint ( uint value ) : void

Write an unsigned int in little endian byte order.

WriteLEUlong ( ulong value ) : void
WriteLEUshort ( ushort value ) : void

Write an unsigned short in little endian byte order.

WriteLeLong ( long value ) : void

Write a long in little endian byte order.

WriteLocalEntryHeader ( ZipUpdate update ) : void
ZipFile ( ) : System

Initialises a default ZipFile instance with no entries and no file storage.

this ( int index ) : ZipEntry

Описание методов

AbortUpdate() публичный Метод

Abort updating leaving the archive unchanged.
public AbortUpdate ( ) : void
Результат void

Add() публичный Метод

Add a file entry with data.
public Add ( IStaticDataSource dataSource, string entryName ) : void
dataSource IStaticDataSource The source of the data for this entry.
entryName string The name to give to the entry.
Результат void

Add() публичный Метод

Add a file entry with data.
public Add ( IStaticDataSource dataSource, string entryName, CompressionMethod compressionMethod ) : void
dataSource IStaticDataSource The source of the data for this entry.
entryName string The name to give to the entry.
compressionMethod CompressionMethod The compression method to use.
Результат void

Add() публичный Метод

Add a file entry with data.
public Add ( IStaticDataSource dataSource, string entryName, CompressionMethod compressionMethod, bool useUnicodeText ) : void
dataSource IStaticDataSource The source of the data for this entry.
entryName string The name to give to the entry.
compressionMethod CompressionMethod The compression method to use.
useUnicodeText bool Ensure Unicode text is used for name and comments for this entry.
Результат void

Add() публичный Метод

Add a ZipEntry that contains no data.
This can be used to add directories, volume labels, or empty file entries.
public Add ( ZipEntry entry ) : void
entry ZipEntry The entry to add.
Результат void

Add() публичный Метод

Add a file to the archive.
Argument supplied is null.
public Add ( string fileName ) : void
fileName string The name of the file to add.
Результат void

Add() публичный Метод

Add a new entry to the archive.
ZipFile has been closed. The compression method is not supported.
public Add ( string fileName, CompressionMethod compressionMethod ) : void
fileName string The name of the file to add.
compressionMethod CompressionMethod The compression method to use.
Результат void

Add() публичный Метод

Add a new entry to the archive.
Argument supplied is null. ZipFile has been closed. Compression method is not supported.
public Add ( string fileName, CompressionMethod compressionMethod, bool useUnicodeText ) : void
fileName string The name of the file to add.
compressionMethod CompressionMethod The compression method to use.
useUnicodeText bool Ensure Unicode text is used for name and comment for this entry.
Результат void

Add() публичный Метод

Add a file to the archive.
Argument supplied is null.
public Add ( string fileName, string entryName ) : void
fileName string The name of the file to add.
entryName string The name to use for the on the Zip file created.
Результат void

AddDirectory() публичный Метод

Add a directory entry to the archive.
public AddDirectory ( string directoryName ) : void
directoryName string The directory to add.
Результат void

BeginUpdate() публичный Метод

Begin updating this ZipFile archive.
public BeginUpdate ( ) : void
Результат void

BeginUpdate() публичный Метод

Begin updating to this ZipFile archive.
public BeginUpdate ( IArchiveStorage archiveStorage ) : void
archiveStorage IArchiveStorage The storage to use during the update.
Результат void

BeginUpdate() публичный Метод

Begin updating this ZipFile archive.
ZipFile has been closed. One of the arguments provided is null ZipFile has been closed.
public BeginUpdate ( IArchiveStorage archiveStorage, IDynamicDataSource dataSource ) : void
archiveStorage IArchiveStorage The archive storage for use during the update.
dataSource IDynamicDataSource The data source to utilise during updating.
Результат void

Close() публичный Метод

Closes the ZipFile. If the stream is owned then this also closes the underlying input stream. Once closed, no further instance methods should be called.
/// An i/o error occurs. ///
public Close ( ) : void
Результат void

CommitUpdate() публичный Метод

Commit current updates, updating this archive.
ZipFile has been closed.
public CommitUpdate ( ) : void
Результат void

Create() публичный статический Метод

Create a new ZipFile whose data will be stored on a stream.
is null doesnt support writing.
public static Create ( Stream outStream ) : ZipFile
outStream Stream The stream providing data storage.
Результат ZipFile

Create() публичный статический Метод

Create a new ZipFile whose data will be stored in a file.
is null
public static Create ( string fileName ) : ZipFile
fileName string The name of the archive to create.
Результат ZipFile

Delete() публичный Метод

Delete an entry by name
public Delete ( string fileName ) : bool
fileName string The filename to delete
Результат bool

Delete() публичный Метод

Delete a ZipEntry from the archive.
public Delete ( ZipEntry entry ) : void
entry ZipEntry The entry to delete.
Результат void

Dispose() публичный Метод

public Dispose ( ) : void
Результат void

Dispose() защищенный Метод

Releases the unmanaged resources used by the this instance and optionally releases the managed resources.
protected Dispose ( bool disposing ) : void
disposing bool true to release both managed and unmanaged resources; /// false to release only unmanaged resources.
Результат void

FindEntry() публичный Метод

Return the index of the entry with a matching name
/// The Zip file has been closed. ///
public FindEntry ( string name, bool ignoreCase ) : int
name string Entry name to find
ignoreCase bool If true the comparison is case insensitive
Результат int

GetEntry() публичный Метод

Searches for a zip entry in this archive with the given name. String comparisons are case insensitive
/// The Zip file has been closed. ///
public GetEntry ( string name ) : ZipEntry
name string /// The name to find. May contain directory components separated by slashes ('/'). ///
Результат ZipEntry

GetEnumerator() публичный Метод

Gets an enumerator for the Zip entries in this Zip file.
/// The Zip file has been closed. ///
public GetEnumerator ( ) : IEnumerator
Результат IEnumerator

GetInputStream() публичный Метод

Gets an input stream for reading the given zip entry data in an uncompressed form. Normally the ZipEntry should be an entry returned by GetEntry().
/// The ZipFile has already been closed /// /// The compression method for the entry is unknown /// /// The entry is not found in the ZipFile ///
public GetInputStream ( ZipEntry entry ) : Stream
entry ZipEntry The to obtain a data for
Результат Stream

GetInputStream() публичный Метод

Creates an input stream reading a zip entry
/// The ZipFile has already been closed /// /// The compression method for the entry is unknown /// /// The entry is not found in the ZipFile ///
public GetInputStream ( long entryIndex ) : Stream
entryIndex long The index of the entry to obtain an input stream for.
Результат Stream

SetComment() публичный Метод

Set the file comment to be recorded when the current update is commited.
ZipFile has been closed.
public SetComment ( string comment ) : void
comment string The comment to record.
Результат void

TestArchive() публичный Метод

Test an archive for integrity/validity
Testing will terminate on the first error found.
public TestArchive ( bool testData ) : bool
testData bool Perform low level data Crc check
Результат bool

TestArchive() публичный Метод

Test an archive for integrity/validity
The object has already been closed.
public TestArchive ( bool testData, TestStrategy strategy, ZipTestResultHandler resultHandler ) : bool
testData bool Perform low level data Crc check
strategy TestStrategy The to apply.
resultHandler ZipTestResultHandler The handler to call during testing.
Результат bool

ZipFile() публичный Метод

Opens a Zip file reading the given FileStream.
The supplied argument is null. /// An i/o error occurs. /// /// The file doesn't contain a valid zip archive. ///
public ZipFile ( FileStream file ) : System
file System.IO.FileStream The to read archive data from.
Результат System

ZipFile() публичный Метод

Opens a Zip file reading the given Stream.
/// An i/o error occurs /// /// The stream doesn't contain a valid zip archive.
/// /// The stream doesnt support seeking. /// /// The stream argument is null. ///
public ZipFile ( Stream stream ) : System
stream Stream The to read archive data from.
Результат System

ZipFile() публичный Метод

Opens a Zip file with the given name for reading.
The argument supplied is null. /// An i/o error occurs /// /// The file doesn't contain a valid zip archive. ///
public ZipFile ( string name ) : System
name string The name of the file to open.
Результат System

Описание свойств

KeysRequired публичное свойство

Event handler for handling encryption keys.
public KeysRequiredEventHandler KeysRequired
Результат KeysRequiredEventHandler