c# vs2008 and zip files

P

Peted

Hello,

Using VS2008 c#, 3.5

can anyone advise me regarding interacting c# and zip files.

Im being given a zip file, with im told a definte no changing
directory structre of which i need to extract or navigate to a specfic
file that may be of different name in each zip file but should be in
the same directory structure each time.

To emilniate the need to manually unzip the contents, i want to use a
directory picker (or something) to be able to select the zip file and
directly/programatically navigate the directory structure of the zip
file, select the file in question and import it into my application.
The file is a text file.

Can i do this in c# dot net, without a 3rd party zip library. From
what i have found c# could extract a zip file contents, but not if the
zip file has directories ??

Could anyone apply thier amazing intellect to this conundrum, and
illuminate a poor wandering soul lost in the world of dotnet.


any advice appreciated

thanks

Peter
 
G

Göran Andersson

Peted said:
Hello,

Using VS2008 c#, 3.5

can anyone advise me regarding interacting c# and zip files.

Im being given a zip file, with im told a definte no changing
directory structre of which i need to extract or navigate to a specfic
file that may be of different name in each zip file but should be in
the same directory structure each time.

To emilniate the need to manually unzip the contents, i want to use a
directory picker (or something) to be able to select the zip file and
directly/programatically navigate the directory structure of the zip
file, select the file in question and import it into my application.
The file is a text file.

Can i do this in c# dot net, without a 3rd party zip library. From
what i have found c# could extract a zip file contents, but not if the
zip file has directories ??

Could anyone apply thier amazing intellect to this conundrum, and
illuminate a poor wandering soul lost in the world of dotnet.


any advice appreciated

thanks

Peter

The current version of the framework has no support for the zip file
format. It can compress and decompress the data streams, but not read
the file structure that contains the data streams.

You either have to write the code yourself to read the file structure,
or use third party code.
 
J

Jeff Johnson

can anyone advise me regarding interacting c# and zip files.

Just another vote for SharpZipLib. Other than the actual compression
routines, the code's pretty easy to follow. I've modified it to add
functionality that didn't come "out of the box" and it wasn't hard at all.
 
A

Arne Vajhøj

Peted said:
Using VS2008 c#, 3.5

can anyone advise me regarding interacting c# and zip files.

Im being given a zip file, with im told a definte no changing
directory structre of which i need to extract or navigate to a specfic
file that may be of different name in each zip file but should be in
the same directory structure each time.

To emilniate the need to manually unzip the contents, i want to use a
directory picker (or something) to be able to select the zip file and
directly/programatically navigate the directory structure of the zip
file, select the file in question and import it into my application.
The file is a text file.

Can i do this in c# dot net, without a 3rd party zip library. From
what i have found c# could extract a zip file contents, but not if the
zip file has directories ??

Could anyone apply thier amazing intellect to this conundrum, and
illuminate a poor wandering soul lost in the world of dotnet.

I like SharpZipLib pointe to by several other.

If you for some reason have a problem using non-MS code you
can check if you can install the J# redistributable and use
vjslib.dll from that due to the fact that it is from MS.

Then you can use the ZIP code in java.util.zip !

Arne
 
C

Cheeso

I like SharpZipLib pointe to by several other.

Also try www.codeplex.com/DotNetZip - simple and easy.
Example:

using (ZipFile zip = ZipFile.Read(ExistingZipFile))
{
foreach (ZipEntry e in zip)
{
e.Extract(TargetDirectory);
}
}

If you for some reason have a problem using non-MS code you
can check if you can install the J# redistributable and use
vjslib.dll from that due to the fact that it is from MS.

Then you can use theZIPcode in java.util.zip!

Don't do that. Too hard.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top