Hello,
I am trying to figure out a way of opening standard .zip files in C#. I know of possiblilities of using third party libraries such as SharpZipLib and cross language solutions like using J# libaries but neither of those solutions work for me. I do not want to use third party solutions at all and using the J# librairies makes it difficult to write the zip files to a memorystream.
I also have heard of using the windows API to get the job done but does anyone know of a solution staying solely in C#? Or at lease a simple way of using the API, I am not good with API calls at all. All I need to do is unzip contents into a memory stream. There is no manipulation of the zip file or rezipping anything at all.
Please help!!
Loading
GlennPosted Sep 11, 2007, 3:48 PM
You can find it here http://www.icsharpcode.net/OpenSource/SharpZipLib/Default.aspx
Dustin DixonPosted Sep 7, 2007, 11:28 AM
Not sure what the problem is yet. We are even using hex editors to compare the different headers of our zip files and it seems that there are slight differences causing it to break even though all files are being zipped with the same software.
AlanPosted Sep 7, 2007, 10:26 AM
I had a quick look at the source code for that article and I couldn't see any obvious way to extract the zip file to a memory stream either.
However, I've found something else here, namely a small library called 'zipdotnetlib' written in C# by MS programmers to compress/decompress standard zip files:
http://blogs.msdn.com/dotnetinterop/archive/2006/04/05/567402.aspx
As they admit themselves, this isn't exactly industrial strength but it should be able to cope with basic stuff. The source code is available and I noticed that the main overload of the Extract() method in the ZipEntry class does allow extraction to either a file or a memory stream so it might be the lightweight solution you're looking for.
Dustin DixonPosted Sep 7, 2007, 8:07 AM
Does anyone know of any other methods or how to use that method to unzip into a memorystream?
AlanPosted Sep 7, 2007, 7:00 AM
I'd check out the following article which contains code to enable you to use the functionality built into Windows itself to unzip a standard zip file:
http://www.codeproject.com/csharp/DecompressWinShellAPICS.asp