These are the highest level classes in the C1Zip library. They allow you to create and manage zip files. Using zip files to store application data provides the following benefits:
• You can consolidate many files into one, making application deployment easier.
• You can compress the data, saving disk space and network bandwidth.
• The zip format is an open standard, supported by many popular applications.
C1ZipFile Class
The C1ZipFile class encapsulates a zip file. After you create a C1ZipFile object, you can attach it to an existing zip file or tell it to create a new empty zip file for you. For example:
' Create a C1ZipFile object.
Dim myZip As New C1ZipFile()
' Create a new (empty) zip file.
myZip.Create(writeStream)
' Open an existing zip file.
myZip.Open(readStream)
•C#
// Create a C1ZipFile object.
C1ZipFile myZip = new C1ZipFile();
// Create a new (empty) zip file.
myZip.Create(writeStream);
// Open an existing zip file.
myZip.Open(readStream);
C1ZipEntryCollection Class
After you have created or opened a zip file, use the Entries collection to inspect the contents of the zip file, or to add, expand, and delete entries. For example:
myZip.Entries.Add(stream1, "MyData.txt")
myZip.Entries.Add(stream2, "MyData.xml")
Dim zipEntry As C1ZipEntry
For Each zipEntry In myZip.Entries
Console.WriteLine(zipEntry.FileName)
Next zipEntry
•C#
myZip.Entries.Add(stream1, "MyData.txt");
myZip.Entries.Add(stream2, "MyData.doc");
foreach (C1ZipEntry zipEntry in myZip.Entries)
Debug.WriteLine(zipEntry.FileName);
C1ZipEntry Class
The C1ZipEntry class exposes properties and methods that describe each entry, including its original file name, size, compressed size, and so on. It also has a OpenReader method that returns a stream object, so you can read the entry contents without expanding it first.