c# - save unzipped files to a folder -


i wanted save unzipped file folder in isolatedstorage. have read file zip file isolatedstorage , want unzip them folder. have tried way :-

private async task unzipfile(string filename)     {         isolatedstoragefile myisolatedstorage = isolatedstoragefile.getuserstoreforapplication();         using (isolatedstoragefilestream filestream = myisolatedstorage.openfile(filename, filemode.open, fileaccess.readwrite))         {              unzipper unzip = new unzipper(filestream);             var filename = unzip.filenamesinzip.firstordefault();             if (filename != null)             {                                                  // can have stream too. this.               // var zipstream = unzip.getfilestream(filename)               // here not getting how save unzip file folder.             }      } 

here got :) hope somebody.

private async task unzipfile() {     // can use isolated storage     var myisolatedstorage = isolatedstoragefile.getuserstoreforapplication();     using (var filestream = application.getresourcestream(new uri("sample.zip", urikind.relative)).stream)     {         var unzip = new unzipper(filestream);         foreach (string filename in unzip.filenamesinzip)         {             if (!string.isnullorempty(filename))             {                 if (filename.any(m => m.equals('/')))                 {                     myisolatedstorage.createdirectory(filename.substring(0, filename.lastindexofany(new char[] { '/' })));                 }                  //save file entry storage                 using (var streamwriter =                     new streamwriter(new isolatedstoragefilestream(filename,                         filemode.create,                         fileaccess.readwrite,                         myisolatedstorage)))                 {                     streamwriter.write(unzip.getfilestream(filename));                 }             }         }     } } 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -