Hi There, Im downloading zip files and placing them in isoilated storage on windows phone 7. Is there an API or library that allows me to un zip the files? Really appreciate advice on this. Tony
+1
A:
Hi Tony,
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
indyfromoz
2010-10-24 10:18:13