Reputation: 6607
I'm downloading zip files and place them in isolated storage on Windows Phone 7. Is there an API or library that allows me to unzip the files?
Upvotes: 1
Views: 3012
Reputation: 11
SharpZipLib is under GNU license and is therefore not allowed by the Microsoft app store.
Upvotes: 1
Reputation: 11
I found the following small library useful for unzipping files on WP7:
REALLY small unzip utility for Silverlight – Part 2
Upvotes: 0
Reputation: 3763
You can use SharpZipLib to decompress downloaded zip files. I have used this version (binaries downloaded from Codeplex) in my applications without any issues, however, I would recommend download the source and compiling it yourself. The decompressed file can be read into a string -
// check for magic numbers
if (data.Length > 2 && (data[0] == 31 && data[1] == 139))
{
using (var ms = new MemoryStream(data))
using (var gzip = new GZipInputStream(ms))
using (var reader = new StreamReader(gzip))
{
fileContents = reader.ReadToEnd();
}
}
data is an array of bytes which holds the zip file read from IsolatedStorage. fileContents is a string that holds the contents of the decompressed file.
HTH, indyfromoz
Upvotes: 1