Creates a new zip file in a stream.
The code below creates a new
C1ZipFile on a memory stream, then adds several files to it. Finally, the code gets the zipped data out as an array of bytes, which could be stored in a database for example.
// create zip on a stream
MemoryStream msZip = new MemoryStream();
C1ZipFile zip = new C1ZipFile(msZip, true);
// add some entries to it
foreach (string f in Directory.GetFiles(@"c:\WINDOWS\Web\Wallpaper"))
{
zip.Entries.Add(f);
}
// get zipped data out as a byte array
byte[] zipData = msZip.ToArray();