Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a zip file as an embedded resource and extracting the contents at runtime?

Status
Not open for further replies.

GEAK

Instructor
Feb 1, 2001
90
US
I'm looking at doing the following:
[ol 1]
[li]Embedding a zip file as a resource in my executable[/li]
[li]Extracting its contents to the same folder as the executable at runtime[/li]
[li]NOT writing out the zip file first[/li]
[li]Targeting .Net 2.0 (I plan on using this on older, air-gapped systems that probably only have 2.0)[/li]
[li]I'd prefer avoiding the use of any 3rd party libraries (for the same reason as #4)[/li]
[/ol]

I believe I can embed the zip as a resource just like embedding an image or text file by selecting the zip file instead. I've found examples of how to write a file from a resource using a FileStream object (this gives me access to the resource but violates the third goal). I've found examples for using a MemoryStream object (which I think would comply with #3) but no idea whether or how it would work with any of the zip related classes. I've looked at the ZipFile, ZipArchive, DeflateStream, and GZipStream classes but all of the examples I've found appear to use a physical file (I've either missed or misunderstood all the examples).

I have a sneaking suspicion that I'm really close to a solution, but have no idea how to put the individual pieces together.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top