Comment Property

DotNetZip

Ionic Zip Library v1.9.1.6 Comment Property
ReferenceIonic.ZipZipFileComment
A comment attached to the zip archive.
Declaration Syntax
C# Visual Basic Visual C++
public string Comment { get; set; }
Public Property Comment As String
	Get
	Set
public:
property String^ Comment {
	String^ get ();
	void set (String^ value);
}
Remarks

This property is read/write. It allows the application to specify a comment for the ZipFile, or read the comment for the ZipFile. After setting this property, changes are only made permanent when you call a Save() method.

According to PKWARE's zip specification, the comment is not encrypted, even if there is a password set on the zip file.

The specification does not describe how to indicate the encoding used on a comment string. Many "compliant" zip tools and libraries use IBM437 as the code page for comments; DotNetZip, too, follows that practice. On the other hand, there are situations where you want a Comment to be encoded with something else, for example using code page 950 "Big-5 Chinese". To fill that need, DotNetZip will encode the comment following the same procedure it follows for encoding filenames: (a) if AlternateEncodingUsage is Never, it uses the default encoding (IBM437). (b) if AlternateEncodingUsage is Always, it always uses the alternate encoding (AlternateEncoding). (c) if AlternateEncodingUsage is AsNecessary, it uses the alternate encoding only if the default encoding is not sufficient for encoding the comment - in other words if decoding the result does not produce the original string. This decision is taken at the time of the call to ZipFile.Save().

When creating a zip archive using this library, it is possible to change the value of AlternateEncoding between each entry you add, and between adding entries and the call to Save(). Don't do this. It will likely result in a zip file that is not readable by any tool or application. For best interoperability, leave AlternateEncoding alone, or specify it only once, before adding any entries to the ZipFile instance.

Assembly: Ionic.Zip (Module: Ionic.Zip) Version: 1.9.1.8 (1.9.1.8)