Solved

zip file open and reading in C#

Posted on 2014-09-05
4
329 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

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…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now