Use the Open or Create methods to associate the C1Zip file object with a zip file on disk. Then use the Entries property to add, remove, retrieve, or inspect individual entries in the zip file.
C1ZipFile can only be used with standard zip files. The component does not support other similar formats such as gzip, zip2, tar, or rar.
The standard zip file imposes some limitations on the size of each entry. You cannot use it to compress files larger than 4 gigabytes (uint.MaxValue).
// get path for zip file and files to compress string path = Application.ExecutablePath; int pos = path.IndexOf(@"\bin"); path = path.Substring(0, pos + 1); // create a zip file C1ZipFile zip = new C1ZipFile(); zip.Create(path + "source.zip"); // add all files with extension cs to the zip file foreach (string fileName in Directory.GetFiles(path, "*.cs")) zip.Entries.Add(fileName); // show result foreach (C1ZipEntry ze in zip.Entries) { Console.WriteLine("{0} {1:#,##0} {2:#,##0}", ze.FileName, ze.SizeUncompressed, ze.SizeCompressed); }
System.Object
C1.C1Zip.C1ZipFile