DotNetZip on CodePlex: http://dotnetzip.codeplex.com/
詳細的可以看源代碼……總之感覺比SharpZipLib好用。而且DotNetZip支持VB,C#以及任何.NET語言。
加壓:(從CodePlex上偷過來的)
using (ZipFile zip = new ZipFile())
{
// add this map file into the "images" directory in the zip archive 把這個PNG文件添加到zip檔案的"images"目錄下
zip.AddFile("c:\\images\\personal\\7440-N49th.png", "images");
// add the report into a different directory in the archive 然後把PDF文件添加到zip檔案的"files"目錄下,把ReadMe.txt放到根目錄
zip.AddFile("c:\\Reports\\2008-Regional-Sales-Report.pdf", "files");
zip.AddFile("ReadMe.txt");
// 把zip檔案保存為MyZipFile.zip
zip.Save("MyZipFile.zip");
}
解壓更簡單:
using (ZipFile zip = new ZipFile("MyZipFile.zip"))
{
zip.ExtractAll("c:\\myfolder", ExtractExistingFileAction.OverwriteSilently);
}
這就可以了!什麼問題都木有,是不是比SharpZipLib方便多了!