Chilkat C# ZipEntry Class Reference

ZipEntry

Represents a single file or directory entry within a Chilkat Zip object.

Properties

public string Comment {get; set; }

The comment stored within the Zip for this entry.

public int CompressedLength {get; }

The size of this file when Zip compression is applied

public int CompressionLevel {get; set; }

The compression level. 0 = no compression, while 9 = maximum compression. The default is 6.

public int CompressionMethod {get; set; }

Set to 0 for no compression, or 8 for the Deflate algorithm. The Deflate algorithm is the default algorithm of the most popular Zip utility programs, such as WinZip

public int Crc {get; }

The CRC for the zip entry.

public int EntryID {get; }

The unique ID assigned by Zip.NET while the object is instantiated in memory.

public int EntryType {get; }

Indicates the origin of the entry. There are three possible values: (0) a file on disk referenced by Zip.NET and to be added to the Zip, (1) an entry in an existing Zip file, and (2) an entry created directly from data in memory.

public DateTime FileDateTime {get; set; }

The last-modified time of the Zip entry.

public string FileName {get; set; }

The file name of the Zip entry.

public bool IsDirectory {get; }

True if the Zip entry is a directory, false if it is a file.

public string LastErrorHtml {get; }

Error information in HTML format for the last method called.

public string LastErrorText {get; }

Error information in plain-text format for the last method called.

public string LastErrorXml {get; }

Error information in XML format for the last method called.

public bool TextFlag {get; set; }

To be documented soon...

public int UncompressedLength {get; }

The size in bytes of the Zip entry when uncompressed.

Methods

public bool AppendData(byte[] inData);

Append text or binary data to a file within a Zip archive

public byte[] Copy();

Returns the compressed data as a byte array.

Returns null on failure

public string CopyToBase64();

Returns the compressed data as a Base64-encoded string. This data can be re-added to a Zip by calling Zip.AppendBase64.

Returns a null on failure

public string CopyToHex();

Returns the compressed data as a hexidecimal encoded string. This data can be re-added to a Zip by calling Zip.AppendHex.

Returns a null on failure

public bool Extract(string dirPath);

Unzips this entry into the specified base directory. The file is unzipped to the subdirectory according to the relative path stored with the entry in the Zip. Use ExtractInto to unzip into a specific directory regardless of the path information stored in the Zip.

public bool ExtractInto(string dirPath);

Unzip a file into a specific directory

public byte[] Inflate();

Inflate a file within a Zip directly into memory.

Returns null on failure

public string InflateToString(bool addCR);

Inflate and return the uncompressed data as a string. Line-endings are modified to include or not include carriage-returns based on KeepCR. If KeepCR = False, then bare linefeeds are returned, otherwise CRLFs are returned.

Returns a null on failure

public string InflateToString2();

Unzip a file directly into memory as a string, and leave line-endings unmodified.

Returns a null on failure

public string InflateToString3(string srcCharset);

Inflates a character data from a specified character encoding (such as iso-8859-1, or Shift_JIS) and returns the inflated data as a Unicode string.

Returns a null on failure

public ZipEntry NextEntry();

Return the next entry (file or directory) within the Zip

public bool ReplaceData(byte[] inData);

Replace the contents of a file within a Zip archive

public bool SaveLastError(string filename);

Saves the last error information to an XML formatted file.