C# .NET 使用第三方类库DotNetZip解压/压缩Zip文件
生活随笔
收集整理的這篇文章主要介紹了
C# .NET 使用第三方类库DotNetZip解压/压缩Zip文件
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
dotNetZip on CodePlex:?http://dotnetzip.codeplex.com/
詳細(xì)的可以看源代碼……總之感覺比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.zipzip.Save("MyZipFile.zip");}解壓更簡單:
using (ZipFile zip = new ZipFile("MyZipFile.zip")) {zip.ExtractAll("c:\\myfolder", ExtractExistingFileAction.OverwriteSilently); }?
這就可以了!什么問題都木有,是不是比SharpZipLib方便多了!
?
轉(zhuǎn)載于:https://www.cnblogs.com/damsoft/p/6100320.html
總結(jié)
以上是生活随笔為你收集整理的C# .NET 使用第三方类库DotNetZip解压/压缩Zip文件的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: iOS集成sharesdk遇到的坑
- 下一篇: VueJs路由跳转——vue-route