DeflateStream doesn't handle ZIP files, but DotNetZip does. You can use DotNetZip (http://dotnetzip.codeplex.com ), a free 3rd-party library, to create and read zip files from within any .NET application. . .
This code in C#, zips all the files in a specified directory.
using (ZipFile zip = new ZipFile())
{
zip.AddDirectory(@"MyDocuments\ProjectX", "ProjectX");
zip.Comment = "This zip was created at " + System.DateTime.Now.ToString("G") ;
zip.Save(zipFileToCreate);
}
This code in C#, unzips a zipfile:
string unpackDirectory = "ExtractedFiles";
using (ZipFile zip1 = ZipFile.Read(zipToUnpack))
{
// here, we extract every entry, but we could extract conditionally
// based on entry name, size, date, checkbox status, etc.
foreach (ZipEntry e in zip1)
{
e.Extract(unpackDirectory, ExtractExistingFileAction.OverwriteSilently);
}
}
DotNetZip is free.