Zip a Local StorageFolder in windows phone 8 using SharpCompress or Sytem.IO.Compression or -


i'm working on windows phone 8 store app , need zip local storagefolder (with images). environment vs 2013. learned can add references sharpcompress & system.io.compression (but not .filesystem) only.

sharpziplib & dotnetzip don't seem support wp8.

the examples given sharpcompress don't work.

any suggestion code lot. thanks.

system.io.compression:

string guidpath = path.combine(localstorage, guid.newguid().tostring()) + ".zip";                         using (filestream ziptoopen = new filestream(guidpath, filemode.create))                         {                             using (ziparchive archive = new ziparchive(ziptoopen, ziparchivemode.create))                             {                                 string[] files = directory.getfiles(szfldrpath);                                 foreach( string echfile in files )                                 {                                     ziparchiveentry readmeentry = archive.createentry(path.getfilename(echfile));                                     using (binarywriter writer = new binarywriter(readmeentry.open()))                                     {                                         using (stream source = file.openread(echfile))                                         {                                             byte[] buffer = new byte[4096];                                             int bytesread;                                             while ((bytesread = source.read(buffer, 0, buffer.length)) > 0)                                             {                                                 writer.write(buffer, 0, bytesread);                                             }                                         }                                     }                                 }                             }                         } 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -