views:

4766

answers:

6

I have a programm (written in C#) which reads/writes it's data direct (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 programm to (un)compress them.

I know #ziplib which supports Zip, GZip, Tar and 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?

+13  A: 

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

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

Sebastian Dietz
It might be worth pointing out that it's free source code, public domain, and in C# :)
Jon Skeet
@Jon Skeet: You ar right. Added this information.
Sebastian Dietz
+8  A: 

There is a good article written by Peter Bromberg:

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

Shows a simple C# SevenZip.Compression.Lzma.SevenZipHelper class 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.

splattne
+2  A: 

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

aku
A: 

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.

Marc Gravell
+6  A: 

You may try SevenZipSharp

markhor
It's under LGPL v3.0 if anyone need the license.
VirtualBlackFox
A: 

Beware: GZipStream has a size limitation of 4Gb

Alex Fihman