Hi All,
How can i download a zipped folder from a remote server and unzip the entire files in the folder and store them in isolated storage space from a silver light 3 or 4 out of browser application. Any suggestion please
Hi All,
How can i download a zipped folder from a remote server and unzip the entire files in the folder and store them in isolated storage space from a silver light 3 or 4 out of browser application. Any suggestion please
Hi, you could get the file using http or frp stream and then use GZipStream (.NET Class) for unziping the stream/file.
GzipStream: http://msdn.microsoft.com/en-us/library/system.io.compression.gzipstream.aspx
Cheers --Jocke
You can download a zip file like any files with the Webclient class, look at the details and examples in the msdn documentation for downloading content on demand it even talks about how to download and get a specific file from a zip archive.
However if you want to list the files, check out this blogpost, I've not actually tried it but it shows how to get all the files in a zip archive.
Edit: I also found this discussion which offers some ideas, it among other things mentions this Small unzip utility for Silverlight, which seems a bit more robust.
Then use the IsolatedStorageFile class to save the files.
Good Luck! Ola
For the (un)zipping I'd highly recommend that you use the open source DotNetZip library. DotNetZip is licensed under the Ms-PL and really easy to use.
Zipping for example is easy too:
using (ZipFile zip = new ZipFile())
{
zip.AddEntry("MyFileName.png", null, pngStream);
// Save to stream from SaveFileDialog
zip.Save(stream);
}
Silverlight SharpZipLib is a full Silverlight 3/4 and Phone7 port, less AES encryption, of SharpZipLib.
The salient limitation is one that you will find in all Silverlight compression: Only UTF8 encoding of entry meta is supported.