C#中使用7Z进行压缩解压
SevenZipSharp相关文档下载地址:
http://sevenzipsharp.codeplex.com/releases/view/51254
1. 解决方案中添加引用:SevenZipSharp.dll
2. 复制粘贴两个dll文件:7z.dll 7z64.dll,并将属性“复制到输出目录”修改为“如果较
新则复制”
//测试压缩 var zip = new SevenZipCompressor(); zip.CompressionLevel=CompressionLevel.High; zip.CompressDirectory(@"c:doc", @"c:arch.7z"); //测试解压 using (var tmp = new SevenZipExtractor(@"c:arch.7z")) { for (var i = 0; i < tmp.ArchiveFileData.Count; i++) { tmp.ExtractFiles(@"C:cygwin", tmp.ArchiveFileData[i].Index); } }