Saturday, June 21, 2008

.Net (C#) Interface for the 7-Zip DLL (7z.DLL)

CodeProject - C# (.NET) Interface for 7-Zip Archive DLLs

“About 7-Zip

7-Zip is an open-source archive program with plug-in interface. New archive formats and/or archive codecs can be added by DLLs. 7-Zip ships with several archive formats preinstalled:

  • 7z — its own format features good compression (LZMA, PPMd) but can be slow in terms of packing/unpacking
  • Packing / unpacking: ZIP, GZIP, BZIP2 and TAR
  • Unpacking only: RAR, CAB, ISO, ARJ, LZH, CHM, Z, CPIO, RPM, DEB and NSIS

The project is written in C++ language.

You can find more on the official 7-Zip site — here.

About this Contribution

This contribution allows you to use 7-zip archive format DLLs in your programs written in .NET languages.

I created this module for my own project to have the ability to work with archives. Currently my project only has extract capabilities, so only this part of 7-Zip interface translated to C#. Later I plan to translate compress capability as well. For now if you need such functionality you can implement it by yourself, with this code, and the 7-Zip source code.

This translation is tested and already working in my own project.

…”

I really like that this project uses the 7-zip DLL (7z.dll) interface directly and is not just a console/command line wrapper.

So yes, you read that right. You can now have the goodness that is 7Zip within your .Net applications without dealing with the issues console redirection/command line wrapping can cause.

The next step for the reader is to take the current simple demo and turn it into a full fledged demo and/or component (so that simple brains like mine can drop this right into our app's ;)

 

BTW, If you have an older version of the 7z.DLL you'll want to get the latest stable version (I had v4.45 and project was... unhappy... with v4.57 it's working like a charm :)

 

Related Past Post XRef:
7zSharp to your .Net Archive/Unarchiving Rescue - LGPL .Net Wrapper for 7z

No comments: