Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / July 2007

Tip: Looking for answers? Try searching our database.

Use GZipStream to decompress winzip file

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
VancouverMike - 30 Jul 2007 17:22 GMT
Hi there,

I am trying to use GZipStream class to decompress winzip files in .NET 2.0
C# and getting the following error message:

The magic number in GZip header is not correct. Make sure you are passing in
a GZip stream.

The zip file I am using for testing was compressed by winzip and nothing
special there. I guess if you use GZipStream to compress and decompress data
there will be no problom. But is it possible to use to decompress the file
that is compressed by winzip?

Thanks,
Mike
Peter Duniho - 30 Jul 2007 17:51 GMT
[...]
> The zip file I am using for testing was compressed by winzip and nothing
> special there. I guess if you use GZipStream to compress and decompress data
> there will be no problom. But is it possible to use to decompress the file
> that is compressed by winzip?

Not unless the WinZip file is specifically the Gzip format.  While
related, they aren't actually the same.  One particular difference is
that Gzip compresses a single stream of data, while WinZip .zip files
can contain multiple files and folders.  Of course, there are other
differences as well; the main thing is that they aren't the same.

Pete
VancouverMike - 30 Jul 2007 18:02 GMT
Thanks Pete!

If this is the case, is there any class/way in .NET Framework 2.0 I can use
to decompress the winzip files without using the third party utilities?

Mike

> [...]
> > The zip file I am using for testing was compressed by winzip and nothing
[quoted text clipped - 9 lines]
>
> Pete
Peter Duniho - 30 Jul 2007 18:11 GMT
> Thanks Pete!
>
> If this is the case, is there any class/way in .NET Framework 2.0 I can use
> to decompress the winzip files without using the third party utilities?

There is a sort of hack that involves using the Windows shell to
decompress zip files.  There's no direct API in .NET, but Windows
Explorer does support creating and decompression .zip files, and you can
get at that functionality through some form of automation of the shell.

I don't recall the specifics, but Google can probably help you find
them.  I'm pretty sure I saw one implementation on codeproject.com.

Pete
John Mott - 30 Jul 2007 18:25 GMT
The J# library can actually read and write zip files, although you have to
pull in a lot of Java types to use it.

I've been very happy with the C# SharpZipLib, which is free and seems to
work well. There are samples in the download but I'm thinking of putting
some up so they will be on the web.

http://www.icsharpcode.net/OpenSource/SharpZipLib/

john

> Thanks Pete!
>
[quoted text clipped - 20 lines]
>>
>> Pete
Jesse Houwing - 30 Jul 2007 19:55 GMT
* VancouverMike wrote, On 30-7-2007 18:22:
> Hi there,
>
[quoted text clipped - 11 lines]
> Thanks,
> Mike

have a look at this free component:

http://www.icsharpcode.net/OpenSource/SharpZipLib/

it does all you need :)

Jesse

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.