返回

C# 使用第三方类库DotNetZip解压/压缩Zip文件

发布时间:2022-11-29 02:43:49 271

下载地址 ​​http://dotnetzip.codeplex.com/​​

//压缩
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);
}

 

 

特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报
评论区(0)
按点赞数排序
用户头像
精选文章
thumb 中国研究员首次曝光美国国安局顶级后门—“方程式组织”
thumb 俄乌线上战争,网络攻击弥漫着数字硝烟
thumb 从网络安全角度了解俄罗斯入侵乌克兰的相关事件时间线
下一篇
JQuery获取iframe中window对象的方法 2022-11-29 02:12:22