Fingerprint_Card
Loading...
Searching...
No Matches
ICSharpCode.SharpZipLib.Zip.ZipFile Class Reference

This class represents a Zip archive. You can ask for the contained entries, or get an input stream for a file entry. The entry is automatically decompressed. More...

Inheritance diagram for ICSharpCode.SharpZipLib.Zip.ZipFile:
Collaboration diagram for ICSharpCode.SharpZipLib.Zip.ZipFile:

Classes

class  PartialInputStream
 A PartialInputStream is an InflaterInputStream whose data is only a part or subsection of a file. More...
class  UncompressedStream
 An UncompressedStream is a stream that you can write uncompressed data to and flush, but cannot read, seek or do anything else to. More...
class  UpdateComparer
 Class used to sort updates. More...
class  ZipEntryEnumerator
 An enumerator for Zip entries More...
class  ZipString
 Represents a string from a ZipFile which is stored as an array of bytes. More...
class  ZipUpdate
 Represents a pending update to a Zip file. More...

Public Member Functions

delegate void KeysRequiredEventHandler (object sender, KeysRequiredEventArgs e)
 Delegate for handling keys/password setting during compresion/decompression.
 ZipFile (string name)
 Opens a Zip file with the given name for reading.
 ZipFile (FileStream file)
 Opens a Zip file reading the given FileStream.
 ZipFile (Stream stream)
 Opens a Zip file reading the given Stream.
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.
IEnumerator GetEnumerator ()
 Gets an enumerator for the Zip entries in this Zip file.
int FindEntry (string name, bool ignoreCase)
 Return the index of the entry with a matching name.
ZipEntry GetEntry (string name)
 Searches for a zip entry in this archive with the given name. String comparisons are case insensitive.
Stream GetInputStream (ZipEntry entry)
 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().
Stream GetInputStream (long entryIndex)
 Creates an input stream reading a zip entry.
bool TestArchive (bool testData)
 Test an archive for integrity/validity.
bool TestArchive (bool testData, TestStrategy strategy, ZipTestResultHandler resultHandler)
 Test an archive for integrity/validity.
void BeginUpdate (IArchiveStorage archiveStorage, IDynamicDataSource dataSource)
 Begin updating this ZipFile archive.
void BeginUpdate (IArchiveStorage archiveStorage)
 Begin updating to this ZipFile archive.
void BeginUpdate ()
 Begin updating this ZipFile archive.
void CommitUpdate ()
 Commit current updates, updating this archive.
void AbortUpdate ()
 Abort updating leaving the archive unchanged.
void SetComment (string comment)
 Set the file comment to be recorded when the current update is commited.
void Add (string fileName, CompressionMethod compressionMethod, bool useUnicodeText)
 Add a new entry to the archive.
void Add (string fileName, CompressionMethod compressionMethod)
 Add a new entry to the archive.
void Add (string fileName)
 Add a file to the archive.
void Add (string fileName, string entryName)
 Add a file to the archive.
void Add (IStaticDataSource dataSource, string entryName)
 Add a file entry with data.
void Add (IStaticDataSource dataSource, string entryName, CompressionMethod compressionMethod)
 Add a file entry with data.
void Add (IStaticDataSource dataSource, string entryName, CompressionMethod compressionMethod, bool useUnicodeText)
 Add a file entry with data.
void Add (ZipEntry entry)
 Add a ZipEntry that contains no data.
void AddDirectory (string directoryName)
 Add a directory entry to the archive.
bool Delete (string fileName)
 Delete an entry by name.
void Delete (ZipEntry entry)
 Delete a ZipEntry from the archive.

Static Public Member Functions

static ZipFile Create (string fileName)
 Create a new ZipFile whose data will be stored in a file.
static ZipFile Create (Stream outStream)
 Create a new ZipFile whose data will be stored on a stream.

Public Attributes

KeysRequiredEventHandler KeysRequired
 Event handler for handling encryption keys.

Protected Member Functions

virtual void Dispose (bool disposing)
 Releases the unmanaged resources used by the this instance and optionally releases the managed resources.

Package Functions

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

Properties

byte[] Key [get, set]
 Get/set the encryption key value.
string Password [set]
 Password to be used for encrypting/decrypting files.
bool HaveKeys [get]
 Get a value indicating wether encryption keys are currently available.
bool IsStreamOwner [get, set]
 Get/set a flag indicating if the underlying stream is owned by the ZipFile instance. If the flag is true then the stream will be closed when Close is called.
bool IsEmbeddedArchive [get]
 Get a value indicating wether this archive is embedded in another file or not.
bool IsNewArchive [get]
 Get a value indicating that this archive is a new one.
string ZipFileComment [get]
 Gets the comment for the zip file.
string Name [get]
 Gets the name of this zip file.
int Size [get]
 Gets the number of entries in this zip file.
long Count [get]
 Get the number of entries contained in this ZipFile.
ZipEntry this[int index] [get]
 Indexer property for ZipEntries.
INameTransform NameTransform [get, set]
 Get / set the INameTransform to apply to names when updating.
IEntryFactory EntryFactory [get, set]
 Get/set the IEntryFactory used to generate ZipEntry values during updates.
int BufferSize [get, set]
 Get /set the buffer size to be used when updating this zip file.
bool IsUpdating [get]
 Get a value indicating an update has been started.
UseZip64 UseZip64 [get, set]
 Get / set a value indicating how Zip64 Extension usage is determined when adding entries.

Private Types

enum  HeaderTest { Extract = 0x01 , Header = 0x02 }
enum  UpdateCommand { Copy , Modify , Add }
 The kind of update to apply. More...

Private Member Functions

void OnKeysRequired (string fileName)
 Handles getting of encryption keys when required.
 ~ZipFile ()
 Finalize this instance.
long TestLocalHeader (ZipEntry entry, HeaderTest tests)
 Test a local header against that provided from the central directory.
void AddUpdate (ZipUpdate update)
void WriteLEShort (int value)
void WriteLEUshort (ushort value)
 Write an unsigned short in little endian byte order.
void WriteLEInt (int value)
 Write an int in little endian byte order.
void WriteLEUint (uint value)
 Write an unsigned int in little endian byte order.
void WriteLeLong (long value)
 Write a long in little endian byte order.
void WriteLEUlong (ulong value)
void WriteLocalEntryHeader (ZipUpdate update)
int WriteCentralDirectoryHeader (ZipEntry entry)
void PostUpdateCleanup ()
string GetTransformedFileName (string name)
string GetTransformedDirectoryName (string name)
byte[] GetBuffer ()
 Get a raw memory buffer.
void CopyDescriptorBytes (ZipUpdate update, Stream dest, Stream source)
void CopyBytes (ZipUpdate update, Stream destination, Stream source, long bytesToCopy, bool updateCrc)
int GetDescriptorSize (ZipUpdate update)
 Get the size of the source descriptor for a ZipUpdate.
void CopyDescriptorBytesDirect (ZipUpdate update, Stream stream, ref long destinationPosition, long sourcePosition)
void CopyEntryDataDirect (ZipUpdate update, Stream stream, bool updateCrc, ref long destinationPosition, ref long sourcePosition)
int FindExistingUpdate (ZipEntry entry)
int FindExistingUpdate (string fileName)
Stream GetOutputStream (ZipEntry entry)
 Get an output stream for the specified ZipEntry
void AddEntry (ZipFile workFile, ZipUpdate update)
void ModifyEntry (ZipFile workFile, ZipUpdate update)
void CopyEntryDirect (ZipFile workFile, ZipUpdate update, ref long destinationPosition)
void CopyEntry (ZipFile workFile, ZipUpdate update)
void Reopen (Stream source)
void Reopen ()
void UpdateCommentOnly ()
void RunUpdates ()
void CheckUpdating ()
void IDisposable. Dispose ()
void DisposeInternal (bool disposing)
ushort ReadLEUshort ()
 Read an unsigned short in little endian byte order.
uint ReadLEUint ()
 Read a uint in little endian byte order.
ulong ReadLEUlong ()
long LocateBlockWithSignature (int signature, long endLocation, int minimumBlockSize, int maximumVariableData)
void ReadEntries ()
 Search for and read the central directory of a zip file filling the entries array.
long LocateEntry (ZipEntry entry)
 Locate the data for a given entry.
Stream CreateAndInitDecryptionStream (Stream baseStream, ZipEntry entry)
Stream CreateAndInitEncryptionStream (Stream baseStream, ZipEntry entry)

Static Private Member Functions

static void CheckClassicPassword (CryptoStream classicCryptoStream, ZipEntry entry)
static void WriteEncryptionHeader (Stream stream, long crcValue)

Private Attributes

bool isDisposed_
string name_
string comment_
string rawPassword_
Stream baseStream_
bool isStreamOwner
long offsetOfFirstEntry
ZipEntry[] entries_
byte[] key
bool isNewArchive_
UseZip64 useZip64_ = UseZip64.Dynamic
ArrayList updates_
long updateCount_
Hashtable updateIndex_
IArchiveStorage archiveStorage_
IDynamicDataSource updateDataSource_
bool contentsEdited_
int bufferSize_ = DefaultBufferSize
byte[] copyBuffer_
ZipString newComment_
bool commentEdited_
IEntryFactory updateEntryFactory_ = new ZipEntryFactory()

Static Private Attributes

const int DefaultBufferSize = 4096

Detailed Description

This class represents a Zip archive. You can ask for the contained entries, or get an input stream for a file entry. The entry is automatically decompressed.

You can also update the archive adding or deleting entries.

This class is thread safe for input: You can open input streams for arbitrary entries in different threads.

Author of the original java version : Jochen Hoenicke

using System;
using System.Text;
using System.Collections;
using System.IO;
class MainClass
{
static public void Main(string[] args)
{
using (ZipFile zFile = new ZipFile(args[0])) {
Console.WriteLine("Listing of : " + zFile.Name);
Console.WriteLine("");
Console.WriteLine("Raw Size Size Date Time Name");
Console.WriteLine("-------- -------- -------- ------ ---------");
foreach (ZipEntry e in zFile) {
if ( e.IsFile ) {
DateTime d = e.DateTime;
Console.WriteLine("{0, -10}{1, -10}{2} {3} {4}", e.Size, e.CompressedSize,
d.ToString("dd-MM-yy"), d.ToString("HH:mm"),
e.Name);
}
}
}
}
}
This class represents an entry in a zip archive. This can be a file or a directory ZipFile and ZipInp...
Definition ZipEntry.cs:151
bool IsFile
Get a value of true if the entry appears to be a file; false otherwise.
Definition ZipEntry.cs:1132
DateTime DateTime
Gets/Sets the time of last modification of the entry.
Definition ZipEntry.cs:694
string Name
Returns the entry name.
Definition ZipEntry.cs:749
long CompressedSize
Gets/Sets the size of the compressed data.
Definition ZipEntry.cs:781
long Size
Gets/Sets the size of the uncompressed data.
Definition ZipEntry.cs:764
string Name
Gets the name of this zip file.
Definition ZipFile.cs:648
ZipFile(string name)
Opens a Zip file with the given name for reading.
Definition ZipFile.cs:422
Definition Deflater.cs:43

Member Enumeration Documentation

◆ HeaderTest

Enumerator
Extract 
Header 

◆ UpdateCommand

The kind of update to apply.

Enumerator
Copy 
Modify 
Add 

Constructor & Destructor Documentation

◆ ZipFile() [1/4]

ICSharpCode.SharpZipLib.Zip.ZipFile.ZipFile ( string name)

Opens a Zip file with the given name for reading.

Parameters
nameThe name of the file to open.
Exceptions
ArgumentNullExceptionThe argument supplied is null.
IOExceptionAn i/o error occurs
ZipExceptionThe file doesn't contain a valid zip archive.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ZipFile() [2/4]

ICSharpCode.SharpZipLib.Zip.ZipFile.ZipFile ( FileStream file)

Opens a Zip file reading the given FileStream.

Parameters
fileThe FileStream to read archive data from.
Exceptions
ArgumentNullExceptionThe supplied argument is null.
IOExceptionAn i/o error occurs.
ZipExceptionThe file doesn't contain a valid zip archive.
Here is the call graph for this function:

◆ ZipFile() [3/4]

ICSharpCode.SharpZipLib.Zip.ZipFile.ZipFile ( Stream stream)

Opens a Zip file reading the given Stream.

Parameters
streamThe Stream to read archive data from.
Exceptions
IOExceptionAn i/o error occurs
ZipExceptionThe stream doesn't contain a valid zip archive.
ArgumentExceptionThe stream doesnt support seeking.
ArgumentNullExceptionThe stream argument is null.
Here is the call graph for this function:

◆ ZipFile() [4/4]

ICSharpCode.SharpZipLib.Zip.ZipFile.ZipFile ( )
package

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

Here is the caller graph for this function:

◆ ~ZipFile()

ICSharpCode.SharpZipLib.Zip.ZipFile.~ZipFile ( )
private

Finalize this instance.

Here is the call graph for this function:

Member Function Documentation

◆ AbortUpdate()

void ICSharpCode.SharpZipLib.Zip.ZipFile.AbortUpdate ( )

Abort updating leaving the archive unchanged.

See also
BeginUpdate()
See also
CommitUpdate
Here is the call graph for this function:

◆ Add() [1/8]

void ICSharpCode.SharpZipLib.Zip.ZipFile.Add ( IStaticDataSource dataSource,
string entryName )

Add a file entry with data.

Parameters
dataSourceThe source of the data for this entry.
entryNameThe name to give to the entry.
Here is the call graph for this function:

◆ Add() [2/8]

void ICSharpCode.SharpZipLib.Zip.ZipFile.Add ( IStaticDataSource dataSource,
string entryName,
CompressionMethod compressionMethod )

Add a file entry with data.

Parameters
dataSourceThe source of the data for this entry.
entryNameThe name to give to the entry.
compressionMethodThe compression method to use.
Here is the call graph for this function:

◆ Add() [3/8]

void ICSharpCode.SharpZipLib.Zip.ZipFile.Add ( IStaticDataSource dataSource,
string entryName,
CompressionMethod compressionMethod,
bool useUnicodeText )

Add a file entry with data.

Parameters
dataSourceThe source of the data for this entry.
entryNameThe name to give to the entry.
compressionMethodThe compression method to use.
useUnicodeTextEnsure Unicode text is used for name and comments for this entry.
Here is the call graph for this function:

◆ Add() [4/8]

void ICSharpCode.SharpZipLib.Zip.ZipFile.Add ( string fileName)

Add a file to the archive.

Parameters
fileNameThe name of the file to add.
Exceptions
ArgumentNullExceptionArgument supplied is null.
Here is the call graph for this function:

◆ Add() [5/8]

void ICSharpCode.SharpZipLib.Zip.ZipFile.Add ( string fileName,
CompressionMethod compressionMethod )

Add a new entry to the archive.

Parameters
fileNameThe name of the file to add.
compressionMethodThe compression method to use.
Exceptions
ArgumentNullExceptionZipFile has been closed.
ArgumentOutOfRangeExceptionThe compression method is not supported.
Here is the call graph for this function:

◆ Add() [6/8]

void ICSharpCode.SharpZipLib.Zip.ZipFile.Add ( string fileName,
CompressionMethod compressionMethod,
bool useUnicodeText )

Add a new entry to the archive.

Parameters
fileNameThe name of the file to add.
compressionMethodThe compression method to use.
useUnicodeTextEnsure Unicode text is used for name and comment for this entry.
Exceptions
ArgumentNullExceptionArgument supplied is null.
ObjectDisposedExceptionZipFile has been closed.
ArgumentOutOfRangeExceptionCompression method is not supported.
Here is the call graph for this function:

◆ Add() [7/8]

void ICSharpCode.SharpZipLib.Zip.ZipFile.Add ( string fileName,
string entryName )

Add a file to the archive.

Parameters
fileNameThe name of the file to add.
entryNameThe name to use for the ZipEntry on the Zip file created.
Exceptions
ArgumentNullExceptionArgument supplied is null.
Here is the call graph for this function:

◆ Add() [8/8]

void ICSharpCode.SharpZipLib.Zip.ZipFile.Add ( ZipEntry entry)

Add a ZipEntry that contains no data.

Parameters
entryThe entry to add.

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

Here is the call graph for this function:

◆ AddDirectory()

void ICSharpCode.SharpZipLib.Zip.ZipFile.AddDirectory ( string directoryName)

Add a directory entry to the archive.

Parameters
directoryNameThe directory to add.
Here is the call graph for this function:

◆ AddEntry()

void ICSharpCode.SharpZipLib.Zip.ZipFile.AddEntry ( ZipFile workFile,
ZipUpdate update )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddUpdate()

void ICSharpCode.SharpZipLib.Zip.ZipFile.AddUpdate ( ZipUpdate update)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ BeginUpdate() [1/3]

void ICSharpCode.SharpZipLib.Zip.ZipFile.BeginUpdate ( )

Begin updating this ZipFile archive.

See also
BeginUpdate(IArchiveStorage), CommitUpdate
See also
AbortUpdate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ BeginUpdate() [2/3]

void ICSharpCode.SharpZipLib.Zip.ZipFile.BeginUpdate ( IArchiveStorage archiveStorage)

Begin updating to this ZipFile archive.

Parameters
archiveStorageThe storage to use during the update.
Here is the call graph for this function:

◆ BeginUpdate() [3/3]

void ICSharpCode.SharpZipLib.Zip.ZipFile.BeginUpdate ( IArchiveStorage archiveStorage,
IDynamicDataSource dataSource )

Begin updating this ZipFile archive.

Parameters
archiveStorageThe archive storage for use during the update.
dataSourceThe data source to utilise during updating.
Exceptions
ObjectDisposedExceptionZipFile has been closed.
ArgumentNullExceptionOne of the arguments provided is null
ObjectDisposedExceptionZipFile has been closed.

◆ CheckClassicPassword()

void ICSharpCode.SharpZipLib.Zip.ZipFile.CheckClassicPassword ( CryptoStream classicCryptoStream,
ZipEntry entry )
staticprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CheckUpdating()

void ICSharpCode.SharpZipLib.Zip.ZipFile.CheckUpdating ( )
private
Here is the caller graph for this function:

◆ Close()

void ICSharpCode.SharpZipLib.Zip.ZipFile.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.

Exceptions
System.IO.IOExceptionAn i/o error occurs.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CommitUpdate()

void ICSharpCode.SharpZipLib.Zip.ZipFile.CommitUpdate ( )

Commit current updates, updating this archive.

See also
BeginUpdate()
See also
AbortUpdate
Exceptions
ObjectDisposedExceptionZipFile has been closed.
Here is the call graph for this function:

◆ CopyBytes()

void ICSharpCode.SharpZipLib.Zip.ZipFile.CopyBytes ( ZipUpdate update,
Stream destination,
Stream source,
long bytesToCopy,
bool updateCrc )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CopyDescriptorBytes()

void ICSharpCode.SharpZipLib.Zip.ZipFile.CopyDescriptorBytes ( ZipUpdate update,
Stream dest,
Stream source )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CopyDescriptorBytesDirect()

void ICSharpCode.SharpZipLib.Zip.ZipFile.CopyDescriptorBytesDirect ( ZipUpdate update,
Stream stream,
ref long destinationPosition,
long sourcePosition )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CopyEntry()

void ICSharpCode.SharpZipLib.Zip.ZipFile.CopyEntry ( ZipFile workFile,
ZipUpdate update )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CopyEntryDataDirect()

void ICSharpCode.SharpZipLib.Zip.ZipFile.CopyEntryDataDirect ( ZipUpdate update,
Stream stream,
bool updateCrc,
ref long destinationPosition,
ref long sourcePosition )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CopyEntryDirect()

void ICSharpCode.SharpZipLib.Zip.ZipFile.CopyEntryDirect ( ZipFile workFile,
ZipUpdate update,
ref long destinationPosition )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Create() [1/2]

ZipFile ICSharpCode.SharpZipLib.Zip.ZipFile.Create ( Stream outStream)
static

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

Parameters
outStreamThe stream providing data storage.
Returns
Returns the newly created ZipFile
Exceptions
ArgumentNullExceptionoutStream is null
ArgumentExceptionoutStream doesnt support writing.
Here is the call graph for this function:

◆ Create() [2/2]

ZipFile ICSharpCode.SharpZipLib.Zip.ZipFile.Create ( string fileName)
static

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

Parameters
fileNameThe name of the archive to create.
Returns
Returns the newly created ZipFile
Exceptions
ArgumentNullExceptionfileName is null
Here is the call graph for this function:

◆ CreateAndInitDecryptionStream()

Stream ICSharpCode.SharpZipLib.Zip.ZipFile.CreateAndInitDecryptionStream ( Stream baseStream,
ZipEntry entry )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateAndInitEncryptionStream()

Stream ICSharpCode.SharpZipLib.Zip.ZipFile.CreateAndInitEncryptionStream ( Stream baseStream,
ZipEntry entry )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Delete() [1/2]

bool ICSharpCode.SharpZipLib.Zip.ZipFile.Delete ( string fileName)

Delete an entry by name.

Parameters
fileNameThe filename to delete
Returns
True if the entry was found and deleted; false otherwise.
Here is the call graph for this function:

◆ Delete() [2/2]

void ICSharpCode.SharpZipLib.Zip.ZipFile.Delete ( ZipEntry entry)

Delete a ZipEntry from the archive.

Parameters
entryThe entry to delete.
Here is the call graph for this function:

◆ Dispose() [1/2]

void IDisposable. ICSharpCode.SharpZipLib.Zip.ZipFile.Dispose ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Dispose() [2/2]

virtual void ICSharpCode.SharpZipLib.Zip.ZipFile.Dispose ( bool disposing)
protectedvirtual

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

Parameters
disposingtrue to release both managed and unmanaged resources; false to release only unmanaged resources.
Here is the call graph for this function:

◆ DisposeInternal()

void ICSharpCode.SharpZipLib.Zip.ZipFile.DisposeInternal ( bool disposing)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindEntry()

int ICSharpCode.SharpZipLib.Zip.ZipFile.FindEntry ( string name,
bool ignoreCase )

Return the index of the entry with a matching name.

Parameters
nameEntry name to find
ignoreCaseIf true the comparison is case insensitive
Returns
The index position of the matching entry or -1 if not found
Exceptions
ObjectDisposedExceptionThe Zip file has been closed.
Here is the caller graph for this function:

◆ FindExistingUpdate() [1/2]

int ICSharpCode.SharpZipLib.Zip.ZipFile.FindExistingUpdate ( string fileName)
private
Here is the call graph for this function:

◆ FindExistingUpdate() [2/2]

int ICSharpCode.SharpZipLib.Zip.ZipFile.FindExistingUpdate ( ZipEntry entry)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetBuffer()

byte[] ICSharpCode.SharpZipLib.Zip.ZipFile.GetBuffer ( )
private

Get a raw memory buffer.

Returns
Returns a raw memory buffer.
Here is the caller graph for this function:

◆ GetDescriptorSize()

int ICSharpCode.SharpZipLib.Zip.ZipFile.GetDescriptorSize ( ZipUpdate update)
private

Get the size of the source descriptor for a ZipUpdate.

Parameters
updateThe update to get the size for.
Returns
The descriptor size, zero if there isnt one.
Here is the caller graph for this function:

◆ GetEntry()

ZipEntry ICSharpCode.SharpZipLib.Zip.ZipFile.GetEntry ( string name)

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

Parameters
nameThe name to find. May contain directory components separated by slashes ('/').
Returns
A clone of the zip entry, or null if no entry with that name exists.
Exceptions
ObjectDisposedExceptionThe Zip file has been closed.
Here is the call graph for this function:

◆ GetEnumerator()

IEnumerator ICSharpCode.SharpZipLib.Zip.ZipFile.GetEnumerator ( )

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

Returns
Returns an IEnumerator for this archive.
Exceptions
ObjectDisposedExceptionThe Zip file has been closed.

◆ GetInputStream() [1/2]

Stream ICSharpCode.SharpZipLib.Zip.ZipFile.GetInputStream ( long entryIndex)

Creates an input stream reading a zip entry.

Parameters
entryIndexThe index of the entry to obtain an input stream for.
Returns
An input Stream containing data for this entryIndex
Exceptions
ObjectDisposedExceptionThe ZipFile has already been closed
ICSharpCode.SharpZipLib.Zip.ZipExceptionThe compression method for the entry is unknown
IndexOutOfRangeExceptionThe entry is not found in the ZipFile
Here is the call graph for this function:

◆ GetInputStream() [2/2]

Stream ICSharpCode.SharpZipLib.Zip.ZipFile.GetInputStream ( ZipEntry entry)

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().

Parameters
entryThe ZipEntry to obtain a data Stream for
Returns
An input Stream containing data for this ZipEntry
Exceptions
ObjectDisposedExceptionThe ZipFile has already been closed
ICSharpCode.SharpZipLib.Zip.ZipExceptionThe compression method for the entry is unknown
IndexOutOfRangeExceptionThe entry is not found in the ZipFile
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetOutputStream()

Stream ICSharpCode.SharpZipLib.Zip.ZipFile.GetOutputStream ( ZipEntry entry)
private

Get an output stream for the specified ZipEntry

Parameters
entryThe entry to get an output stream for.
Returns
The output stream obtained for the entry.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetTransformedDirectoryName()

string ICSharpCode.SharpZipLib.Zip.ZipFile.GetTransformedDirectoryName ( string name)
private
Here is the call graph for this function:

◆ GetTransformedFileName()

string ICSharpCode.SharpZipLib.Zip.ZipFile.GetTransformedFileName ( string name)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ KeysRequiredEventHandler()

delegate void ICSharpCode.SharpZipLib.Zip.ZipFile.KeysRequiredEventHandler ( object sender,
KeysRequiredEventArgs e )

Delegate for handling keys/password setting during compresion/decompression.

◆ LocateBlockWithSignature()

long ICSharpCode.SharpZipLib.Zip.ZipFile.LocateBlockWithSignature ( int signature,
long endLocation,
int minimumBlockSize,
int maximumVariableData )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ LocateEntry()

long ICSharpCode.SharpZipLib.Zip.ZipFile.LocateEntry ( ZipEntry entry)
private

Locate the data for a given entry.

Returns
The start offset of the data.
Exceptions
System.IO.EndOfStreamExceptionThe stream ends prematurely
ICSharpCode.SharpZipLib.Zip.ZipExceptionThe local header signature is invalid, the entry and central header file name lengths are different or the local and entry compression methods dont match
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ModifyEntry()

void ICSharpCode.SharpZipLib.Zip.ZipFile.ModifyEntry ( ZipFile workFile,
ZipUpdate update )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnKeysRequired()

void ICSharpCode.SharpZipLib.Zip.ZipFile.OnKeysRequired ( string fileName)
private

Handles getting of encryption keys when required.

Parameters
fileNameThe file for which encryption keys are required.
Here is the caller graph for this function:

◆ PostUpdateCleanup()

void ICSharpCode.SharpZipLib.Zip.ZipFile.PostUpdateCleanup ( )
private
Here is the caller graph for this function:

◆ ReadEntries()

void ICSharpCode.SharpZipLib.Zip.ZipFile.ReadEntries ( )
private

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

Exceptions
System.IO.IOExceptionAn i/o error occurs.
ICSharpCode.SharpZipLib.Zip.ZipExceptionThe central directory is malformed or cannot be found
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReadLEUint()

uint ICSharpCode.SharpZipLib.Zip.ZipFile.ReadLEUint ( )
private

Read a uint in little endian byte order.

Returns
Returns the value read.
Exceptions
IOExceptionAn i/o error occurs.
System.IO.EndOfStreamExceptionThe file ends prematurely
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReadLEUlong()

ulong ICSharpCode.SharpZipLib.Zip.ZipFile.ReadLEUlong ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReadLEUshort()

ushort ICSharpCode.SharpZipLib.Zip.ZipFile.ReadLEUshort ( )
private

Read an unsigned short in little endian byte order.

Returns
Returns the value read.
Exceptions
EndOfStreamExceptionThe stream ends prematurely
Here is the caller graph for this function:

◆ Reopen() [1/2]

void ICSharpCode.SharpZipLib.Zip.ZipFile.Reopen ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Reopen() [2/2]

void ICSharpCode.SharpZipLib.Zip.ZipFile.Reopen ( Stream source)
private
Here is the call graph for this function:

◆ RunUpdates()

void ICSharpCode.SharpZipLib.Zip.ZipFile.RunUpdates ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetComment()

void ICSharpCode.SharpZipLib.Zip.ZipFile.SetComment ( string comment)

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

Parameters
commentThe comment to record.
Exceptions
ObjectDisposedExceptionZipFile has been closed.
Here is the call graph for this function:

◆ TestArchive() [1/2]

bool ICSharpCode.SharpZipLib.Zip.ZipFile.TestArchive ( bool testData)

Test an archive for integrity/validity.

Parameters
testDataPerform low level data Crc check
Returns
true if all tests pass, false otherwise

Testing will terminate on the first error found.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TestArchive() [2/2]

bool ICSharpCode.SharpZipLib.Zip.ZipFile.TestArchive ( bool testData,
TestStrategy strategy,
ZipTestResultHandler resultHandler )

Test an archive for integrity/validity.

Parameters
testDataPerform low level data Crc check
strategyThe TestStrategy to apply.
resultHandlerThe ZipTestResultHandler handler to call during testing.
Returns
true if all tests pass, false otherwise
Exceptions
ObjectDisposedExceptionThe object has already been closed.
Here is the call graph for this function:

◆ TestLocalHeader()

long ICSharpCode.SharpZipLib.Zip.ZipFile.TestLocalHeader ( ZipEntry entry,
HeaderTest tests )
private

Test a local header against that provided from the central directory.

Parameters
entryThe entry to test against
testsThe type of tests to carry out.
Returns
The offset of the entries data in the file
Here is the call graph for this function:
Here is the caller graph for this function:

◆ UpdateCommentOnly()

void ICSharpCode.SharpZipLib.Zip.ZipFile.UpdateCommentOnly ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ WriteCentralDirectoryHeader()

int ICSharpCode.SharpZipLib.Zip.ZipFile.WriteCentralDirectoryHeader ( ZipEntry entry)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ WriteEncryptionHeader()

void ICSharpCode.SharpZipLib.Zip.ZipFile.WriteEncryptionHeader ( Stream stream,
long crcValue )
staticprivate
Here is the caller graph for this function:

◆ WriteLEInt()

void ICSharpCode.SharpZipLib.Zip.ZipFile.WriteLEInt ( int value)
private

Write an int in little endian byte order.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ WriteLeLong()

void ICSharpCode.SharpZipLib.Zip.ZipFile.WriteLeLong ( long value)
private

Write a long in little endian byte order.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ WriteLEShort()

void ICSharpCode.SharpZipLib.Zip.ZipFile.WriteLEShort ( int value)
private
Here is the caller graph for this function:

◆ WriteLEUint()

void ICSharpCode.SharpZipLib.Zip.ZipFile.WriteLEUint ( uint value)
private

Write an unsigned int in little endian byte order.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ WriteLEUlong()

void ICSharpCode.SharpZipLib.Zip.ZipFile.WriteLEUlong ( ulong value)
private
Here is the call graph for this function:

◆ WriteLEUshort()

void ICSharpCode.SharpZipLib.Zip.ZipFile.WriteLEUshort ( ushort value)
private

Write an unsigned short in little endian byte order.

Here is the caller graph for this function:

◆ WriteLocalEntryHeader()

void ICSharpCode.SharpZipLib.Zip.ZipFile.WriteLocalEntryHeader ( ZipUpdate update)
private
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ archiveStorage_

IArchiveStorage ICSharpCode.SharpZipLib.Zip.ZipFile.archiveStorage_
private

◆ baseStream_

Stream ICSharpCode.SharpZipLib.Zip.ZipFile.baseStream_
private

◆ bufferSize_

int ICSharpCode.SharpZipLib.Zip.ZipFile.bufferSize_ = DefaultBufferSize
private

◆ comment_

string ICSharpCode.SharpZipLib.Zip.ZipFile.comment_
private

◆ commentEdited_

bool ICSharpCode.SharpZipLib.Zip.ZipFile.commentEdited_
private

◆ contentsEdited_

bool ICSharpCode.SharpZipLib.Zip.ZipFile.contentsEdited_
private

◆ copyBuffer_

byte [] ICSharpCode.SharpZipLib.Zip.ZipFile.copyBuffer_
private

◆ DefaultBufferSize

const int ICSharpCode.SharpZipLib.Zip.ZipFile.DefaultBufferSize = 4096
staticprivate

◆ entries_

ZipEntry [] ICSharpCode.SharpZipLib.Zip.ZipFile.entries_
private

◆ isDisposed_

bool ICSharpCode.SharpZipLib.Zip.ZipFile.isDisposed_
private

◆ isNewArchive_

bool ICSharpCode.SharpZipLib.Zip.ZipFile.isNewArchive_
private

◆ isStreamOwner

bool ICSharpCode.SharpZipLib.Zip.ZipFile.isStreamOwner
private

◆ key

byte [] ICSharpCode.SharpZipLib.Zip.ZipFile.key
private

◆ KeysRequired

KeysRequiredEventHandler ICSharpCode.SharpZipLib.Zip.ZipFile.KeysRequired

Event handler for handling encryption keys.

◆ name_

string ICSharpCode.SharpZipLib.Zip.ZipFile.name_
private

◆ newComment_

ZipString ICSharpCode.SharpZipLib.Zip.ZipFile.newComment_
private

◆ offsetOfFirstEntry

long ICSharpCode.SharpZipLib.Zip.ZipFile.offsetOfFirstEntry
private

◆ rawPassword_

string ICSharpCode.SharpZipLib.Zip.ZipFile.rawPassword_
private

◆ updateCount_

long ICSharpCode.SharpZipLib.Zip.ZipFile.updateCount_
private

◆ updateDataSource_

IDynamicDataSource ICSharpCode.SharpZipLib.Zip.ZipFile.updateDataSource_
private

◆ updateEntryFactory_

IEntryFactory ICSharpCode.SharpZipLib.Zip.ZipFile.updateEntryFactory_ = new ZipEntryFactory()
private

◆ updateIndex_

Hashtable ICSharpCode.SharpZipLib.Zip.ZipFile.updateIndex_
private

◆ updates_

ArrayList ICSharpCode.SharpZipLib.Zip.ZipFile.updates_
private

◆ useZip64_

UseZip64 ICSharpCode.SharpZipLib.Zip.ZipFile.useZip64_ = UseZip64.Dynamic
private

Property Documentation

◆ BufferSize

int ICSharpCode.SharpZipLib.Zip.ZipFile.BufferSize
getset

Get /set the buffer size to be used when updating this zip file.

◆ Count

long ICSharpCode.SharpZipLib.Zip.ZipFile.Count
get

Get the number of entries contained in this ZipFile.

◆ EntryFactory

IEntryFactory ICSharpCode.SharpZipLib.Zip.ZipFile.EntryFactory
getset

Get/set the IEntryFactory used to generate ZipEntry values during updates.

◆ HaveKeys

bool ICSharpCode.SharpZipLib.Zip.ZipFile.HaveKeys
getprivate

Get a value indicating wether encryption keys are currently available.

◆ IsEmbeddedArchive

bool ICSharpCode.SharpZipLib.Zip.ZipFile.IsEmbeddedArchive
get

Get a value indicating wether this archive is embedded in another file or not.

◆ IsNewArchive

bool ICSharpCode.SharpZipLib.Zip.ZipFile.IsNewArchive
get

Get a value indicating that this archive is a new one.

◆ IsStreamOwner

bool ICSharpCode.SharpZipLib.Zip.ZipFile.IsStreamOwner
getset

Get/set a flag indicating if the underlying stream is owned by the ZipFile instance. If the flag is true then the stream will be closed when Close is called.

The default value is true in all cases.

◆ IsUpdating

bool ICSharpCode.SharpZipLib.Zip.ZipFile.IsUpdating
get

Get a value indicating an update has been started.

◆ Key

byte [] ICSharpCode.SharpZipLib.Zip.ZipFile.Key
getsetprivate

Get/set the encryption key value.

◆ Name

string ICSharpCode.SharpZipLib.Zip.ZipFile.Name
get

Gets the name of this zip file.

◆ NameTransform

INameTransform ICSharpCode.SharpZipLib.Zip.ZipFile.NameTransform
getset

Get / set the INameTransform to apply to names when updating.

◆ Password

string ICSharpCode.SharpZipLib.Zip.ZipFile.Password
set

Password to be used for encrypting/decrypting files.

Set to null if no password is required.

◆ Size

int ICSharpCode.SharpZipLib.Zip.ZipFile.Size
get

Gets the number of entries in this zip file.

Exceptions
InvalidOperationExceptionThe Zip file has been closed.

◆ this[int index]

ZipEntry ICSharpCode.SharpZipLib.Zip.ZipFile.this[int index]
get

Indexer property for ZipEntries.

◆ UseZip64

UseZip64 ICSharpCode.SharpZipLib.Zip.ZipFile.UseZip64
getset

Get / set a value indicating how Zip64 Extension usage is determined when adding entries.

◆ ZipFileComment

string ICSharpCode.SharpZipLib.Zip.ZipFile.ZipFileComment
get

Gets the comment for the zip file.


The documentation for this class was generated from the following file: