支持 7zip (LZMA) 的 C# 免费压缩库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/449998/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-04 03:49:13  来源:igfitidea点击:

Free compression library for C# which supports 7zip (LZMA)

c#compression7ziplzma

提问by Xn0vv3r

I have a program (written in C#) that reads/writes its data directly (direct file access without server) to firebird database files. For a better exchange I want to (un)compress them on import/export for a better exchange over the internet without the need of an external program to (un)compress them.

我有一个程序(用 C# 编写)直接读取/写入它的数据(没有服务器的直接文件访问)到 firebird 数据库文件。为了更好的交换,我想在导入/导出时对它们进行(解)压缩,以便在互联网上进行更好的交换,而无需外部程序来(解)压缩它们。

I know #ziplibwhich supports Zip, GZip, Tar and BZip2.

我知道#ziplib支持 Zip、GZip、Tar 和 BZip2。

What else free compression libraries for C# do you know? Is there a .NET library which supports LZMA so i can read/write ".7z" files?

你还知道哪些 C# 的免费压缩库?是否有支持 LZMA 的 .NET 库,以便我可以读/写“.7z”文件?

采纳答案by splattne

There is a good article written by Peter Bromberg:

Peter Bromberg 写了一篇很好的文章:

7Zip (LZMA) In-Memory Compression with C#

7Zip (LZMA) 内存压缩与 C#

Shows a simple C# SevenZip.Compression.Lzma.SevenZipHelperclass to enable high-compression of in-memory objects with C#. Adds a new 7Zip format LZMA Cookie Compression class to the previously published CookieCompression utility.

显示一个简单的 C#SevenZip.Compression.Lzma.SevenZipHelper类,以使用C# 启用内存中对象的高压缩。将新的 7Zip 格式 LZMA Cookie 压缩类添加到先前发布的 CookieCompression 实用程序。

回答by Sebastian Dietz

7-zip has a free source code, public domain C# SDK for the LZMA algorithm:

7-zip 有一个免费的源代码,用于 LZMA 算法的公共域 C# SDK:

http://www.7-zip.org/sdk.html

http://www.7-zip.org/sdk.html

回答by aku

It seems to be quite a little known fact but .NET library includes packaging/compression API

这似乎是一个鲜为人知的事实,但 .NET 库包括打包/压缩 API

回答by Marc Gravell

If you are writing individual files, then you could just treat it as a stream and use the inbuilt GZipStream/ DeflateStream(although in some tests I did, #ZipLib out-performed the MS offering for both ratio and speed). Or there is inbuilt zip support somewhere in the framework. I don't know about LZMA, though.

如果您正在编写单个文件,那么您可以将其视为一个流并使用内置的GZipStream/ DeflateStream(尽管在我做过的一些测试中,#ZipLib 在比率和速度方面都优于 MS 产品)。或者在框架中的某处有内置的 zip 支持。不过我不知道LZMA。

回答by markhor

You may try SevenZipSharp

你可以试试SevenZipSharp