Solved

zip file open and reading in C#

Posted on 2014-09-05
4
335 Views
Last Modified: 2014-09-11
hi - I'm using VS2010 and .net 4.0 and for program reasons can't upgrade to 4.5. I'm trying to open and read the contents of a zip file so that I can create a data set internal to my program (ie I have no need to create the rest of the zip operation of placing unzipped files somewhere.) I've looked at the Microsoft example code in their Package class that deals with zips and there is reference to an attribute that's not explained. specifically, in the foreach statement to get relationships, the line reads"\
"foreach ( PackageRelationship relationship in documentPart.GetRelationshipByType(ResourceRelationshipType))
the ResourceRelationshipType is undefined if I compile as is. the method is calling for a string, but I don't know where to find the ResourceRelationshipTypes list.
any suggestions?
thanks,
0
Comment
Question by:jdcoburn
4 Comments
 
LVL 35

Expert Comment

by:Miguel Oz
ID: 40307118
Please consider using dotnetzip library, for you case:
using (ZipFile zip = ZipFile.Read(ExistingZipFile))
{
  foreach (ZipEntry e in zip)
     System.Console.WriteLine(e.FileName); //You could add it to a list, etc.
}

Open in new window

Note: The code sample is a simplified version of Nicholas Carey's answer.
0
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 500 total points
ID: 40307523
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 40310089
Can you provide a link to the page that has the code example?
0
 

Author Closing Comment

by:jdcoburn
ID: 40317796
it worked fine, but I had to modify several methods to get it to work.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question