SevenZipSharp相关文档下载地址: http://sevenzipsharp.codeplex.com/releases/view/51254 1. 解决方案中添加引用:SevenZipSharp.dll2. 复制粘贴两个dll文件:7z.dll 7z64.dll,并将属性“复制到输出目录”修改为“如果较新则复制” //测试压缩 var zip = new SevenZipCompressor(); zip.CompressionLevel=CompressionLevel.High;
7z格式采用的LZMA算法,号称具有现今最高压缩率.笔者在nuget上搜索7z,在搜索结果中最终选择了SevenZipSharp来进行压缩/解压.不得不说,SevenZipSharp的API设计得非常方便. 压缩调用: using (FileStream ostream = new FileStream(outputpath, FileMode.Create, FileAccess.Write)) { using (FileStream istream = new FileStream(inpu