|
I know this topic has been touched on a couple of times, but I'm still unclear of the exact answer (there's a topic fairly close but doesn't quite address it). I have a constantly changing remote zip file that I want to download, then take the contents and unzip it using SharpZipLib (which I have working with a local file), and use the contents of the zip file. Is there a way to do this (or a library already available) either using the WWW lib, the WebClient lib, or even through some sort of php mechanism (but then would the unity web player have access to that file)? Or am I stuck with having to stream the content in and working with it that way? Thanks in advance!
(comments are locked)
|
|
If you look at the source code of ExportVisualStudio, there's a section that deals with downloading a zip file off the web using WWW. Basically I think you should be able to do this: Interesting, and thanks for the quick response. I'm very familiar with downloading via www and obtaining www.bytes, but I'm attempting to work with the resultant .zip file locally as a saved file (through SharpZipLib), so I'm hoping to save the www.bytes to disk. I don't have anything written to deal with the stream of the .zip code unless it's been opened by File.OpenRead first. I have pro, btw. Thanks!
Mar 14 '11 at 11:48 PM
Dave 10
Well if you need to save it to disk and you're not using a web player, then you can just call System.IO.File.WriteAllBytes to write the bytes array to a file in one call.
Mar 15 '11 at 12:15 AM
Statement ♦♦
If your SharpZipLib support a stream to do the extracting you can just create a new MemoryStream.
Mar 15 '11 at 12:17 AM
Statement ♦♦
Create a new MemoryStream and set the contents to the bytes buffer, and follow this sample? http://wiki.sharpdevelop.net/SharpZipLib-Zip-Samples.ashx#Unpack_a_zip_using_ZipInputStream_eg_for_Unseekable_input_streams_5
Mar 15 '11 at 12:21 AM
Statement ♦♦
^ Instead of loading with WebClient, just do as in the answer and let data be a MemoryStream. Create the stream as such var data = new MemoryStream(bytes);
Mar 15 '11 at 12:22 AM
Statement ♦♦
(comments are locked)
|
