views:

56

answers:

3

I'm looking for a package to use in my project to compress some xml files. I use WinRAR usually to compress files, and I think you can do this using the 7zip project and this can be included in a .Net project.

This is a similar question here:
http://stackoverflow.com/questions/153678/7-zip-7za-dll-net-wrapper
and the CodeProject example is here:
http://www.codeproject.com/KB/DLL/cs_interface_7zip.aspx

I particularly want something simple to use with a good compression ratio. The example provided only extracts files and I don't particularly have the time to implement and test the compression.

(GZipStream isn't good enough, it compresses my 10Mb file to 9Mb, WinRAR compresses it to 0.5Mb)

So, I'm after a library/package (don't care if it costs) which I can include in my project which allows me to easily Compress/Decompress files that has a good compression ratio and is easy to include and use.

A: 

SharpZipLib is usually my default fallback for .NET compression.

You could also try the 7zip SDK (which includes C# bindings). It might provide a better ratio than SharpZipLib.

Justin Niessner
Note that the 7Zip SDK requires the 7zip DLL to function, IIRC.
Billy ONeal
@Billy - You can include it as an item in your project to make sure the DLL gets copied to your project's bin directory.
Justin Niessner
@Justin: Yes -- just pointing that out. Not all of us are in scenarios where it is possible to use a DLL.
Billy ONeal
A: 

I think GZipStream only allows you to compress/decompress one single file. If you want to compress a set of files/directory, you could use DotNetZip.

http://dotnetzip.codeplex.com/

I am not sure the compression rate. But DotNetZip products a standard ZIP file.

Alex Yeung
A: 

I have to put in a note for ZipStorer -- it can also unzip standard zip files [I do not know about zip64 or other extensions] :-)

I used it because it is small (~6kb compiled with just the extraction making it far smaller than DotNetZip which is 150kb+) and is more permissive than SharpZipLib. It is also a really small, simple and clean code-base. However, if you do want the features of the others (gzip, bzip2, encryption, "better" compression, self-extracting, etc.) then you already know where to look.

pst