private void ParseImportFiles(string[] files, bool isZip = true) { if (files.Length > 1) { MessageBox.Show("Only drag one zip file or folder!"); return; } string fileExt = Path.GetExtension(files[0]); if (fileExt.Equals(".zip") || fileExt.Equals(".7z")) { if (!isZip) { return; } CleanUnzipFolder(); UnZipper unZipper = new UnZipper(); unZipper.ZipFile = files[0]; unZipper.ItemList.Add("*.*"); unZipper.Destination = PathHelper.FolderTemp + "unzip" + Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension(files[0]) + Path.DirectorySeparatorChar; unZipper.Recurse = true; unZipper.UnZip(); LogHelper.Debug("Unzipping file..."); ParseImportFiles(new string[1] { PathHelper.FolderTemp + "unzip" + Path.DirectorySeparatorChar }); return; } else { string baseDirectory = files[0] + (!files[0].EndsWith(Path.DirectorySeparatorChar.ToString()) ? Path.DirectorySeparatorChar.ToString() : string.Empty); files = ValidateFiles(files); if (files != null) { if (files.Length > 0) { switch (_ModListType) { case (ModListType.CharacterSlots): ProcessCharacterSlotModFiles(files, baseDirectory); break; case (ModListType.CharacterGeneral): ProcessCharacterGeneralModFiles(files, baseDirectory); break; case (ModListType.Stage): ProcessStageModFiles(files, baseDirectory); break; case (ModListType.General): ProcessGeneralModFiles(files, baseDirectory); break; } } } } }
//public static Level GetDownloadedLevel(string levelDirectoryName) //{ // string rootPckPath = PACKAGES_FOLDER_PATH + Path.DirectorySeparatorChar + CultureInfo.CurrentUICulture.TwoLetterISOLanguageName + Path.DirectorySeparatorChar; // using (var isoStore = IsolatedStorageFile.GetUserStoreForApplication()) // { // if (levelDirectoryName.StartsWith(LEVEL_PREFIX) && isoStore.FileExists(rootPckPath + levelDirectoryName + Path.DirectorySeparatorChar + levelDirectoryName + GameDBHelper.DB_FILE_NAME_EXTENSION)) // { // string dbPath = rootPckPath + levelDirectoryName + Path.DirectorySeparatorChar + levelDirectoryName + GameDBHelper.DB_FILE_NAME_EXTENSION; // return GetDownloadedLevelFromDbPath(dbPath); // //using (PackageDal dal = new PackageDal(rootPckPath + packDirectoryName + Path.DirectorySeparatorChar + packDirectoryName + PackageDal.DB_FILE_NAME_EXTENSION)) // //{ // // if (dal.OpenDatabase()) // // { // // return dal.GetPackage(); // // } // //} // } // } // return null; //} //public static Level GetDownloadedLevelFromDbPath(string fullDataBasePath) //{ // using (LevelDBHelper dal = new LevelDBHelper(fullDataBasePath)) // { // if (dal.OpenDatabase()) // { // var levels = dal.GetLevels(); // if (levels == null || levels.Count == 0) // return null; // return levels.First().Value; // } // } // return null; //} private static void ExtractZipFile(string archiveFilenameIn, string password, string outFolderPath) { using (var isoStore = IsolatedStorageFile.GetUserStoreForApplication()) { Stream stream = null; try { using (UnZipper unzip = new UnZipper(isoStore.OpenFile(archiveFilenameIn, FileMode.Open))) { foreach (string filename in unzip.FileNamesInZip) { stream = unzip.GetFileStream(filename); string correctedFilename = filename.Replace("/", "" + Path.DirectorySeparatorChar); IsolatedStorageHelpers.SaveFileAndCreateParentFolders(outFolderPath + Path.DirectorySeparatorChar + correctedFilename, stream); } } } finally { if (stream != null) { stream.Close(); // Ensure we release resources } } } }
private void Unzip(Stream stream) { using (IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication()) { using (var zipStream = new UnZipper(stream)) { foreach (string file in zipStream.FileNamesInZip) { string fileName = System.IO.Path.GetFileName(file); if (!string.IsNullOrEmpty(fileName)) { Debug.WriteLine("Extracting " + fileName + " ..."); //save file entry to storage using (var streamWriter = new BinaryWriter(new IsolatedStorageFileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.Write, isoStore))) { Stream fileStream = zipStream.GetFileStream(file); var buffer = new byte[2048]; int size; while ((size = fileStream.Read(buffer, 0, buffer.Length)) > 0) { streamWriter.Write(buffer, 0, size); } } } } } } }
protected async Task CreateZipFromFileContentListCore() { string methodName = GetTempDirectory(); string dummyFileZip = "dummyZip.zip"; string dummyFolderPath = Utils.CreateDummyDirectory(_mockData.ResourceFolder, methodName, cleanFolder: true); string dummyFileZipPath = Path.Combine(dummyFolderPath, dummyFileZip); List <string> files = new List <string> { Path.Combine(dummyFolderPath, "dummy1.txt"), Path.Combine(dummyFolderPath, "dummy2.txt"), Path.Combine(dummyFolderPath, "dummy3.txt") }; files.ForEach(file => Utils.CreateDummyFile(dummyFolderPath, Path.GetFileName(file), cleanFolder: false)); Zipper.CreateZipFileFromFileListWithFileNameOnly(dummyFileZipPath, files); byte[] bytesOfZip = await KFile.ReadAllBytesAsync(dummyFileZipPath); IList <Core.Support.Pair <string, byte[]> > actualUnzippedFiles = UnZipper.GetFileContentsFromZipFile(bytesOfZip); byte[] bytesOfZipFile = Zipper.CreateZipFromFileContentList(actualUnzippedFiles); IList <Core.Support.Pair <string, byte[]> > expectedUnzippedFiles = UnZipper.GetFileContentsFromZipFile(dummyFileZipPath); Assert.True(expectedUnzippedFiles.Count == actualUnzippedFiles.Count); Utils.RemoveDir(dummyFolderPath); }
public static async Task <string> unzipToIsolatedStoreLocSharpGISLib() { try { // delDirIsoStorBeforeUnzip("www"); IsolatedStorageFile userStoreForApplication = IsolatedStorageFile.GetUserStoreForApplication(); using (userStoreForApplication) { using (IsolatedStorageFileStream isolatedStorageFileStream = new IsolatedStorageFileStream("tempUpdate.zip", FileMode.Open, userStoreForApplication)) { using (UnZipper unZipper = new UnZipper(isolatedStorageFileStream)) { using (IEnumerator <string> enumerator = unZipper.FileNamesInZip.GetEnumerator()) { while (enumerator.MoveNext()) { string current = enumerator.Current; string fileName = Path.GetFileName(current); StorageFolder localFolder = ApplicationData.Current.LocalFolder; string directoryName = Path.GetDirectoryName(current); if (!string.IsNullOrEmpty(fileName)) { if (!Directory.Exists(localFolder.Path + "\\" + directoryName)) { // WLUtils.LOG("Directory Created .... \\www\\" + directoryName); await localFolder.CreateFolderAsync(directoryName, CreationCollisionOption.OpenIfExists); } using (BinaryWriter binaryWriter = new BinaryWriter(await localFolder.OpenStreamForWriteAsync(directoryName + "\\" + fileName, CreationCollisionOption.ReplaceExisting))) { //WLUtils.LOG("Path.GetDirectoryName " + directoryName); //WLUtils.LOG("filename is www\\" + directoryName + "\\" + fileName); Stream fileStream = unZipper.GetFileStream(current); byte[] array = new byte[1028]; if (fileStream != null) { int num; while ((num = fileStream.Read(array, 0, array.Length)) > 0) { binaryWriter.Write(array, 0, num); } } } } } } } } } } catch (Exception ex) { // Debugger.Log(0, null, messages.getMessage("WLDirectUpdate.UNZIP_FAILED" + ex.StackTrace)); // WLUtils.LOG("unzipAndSaveFilesInInstalledLoc (IsolatedStorageException) failed .... ", ex); return("Error:" + ex.Message); } return("OK"); }
public static XElement GetXLSXPart(this UnZipper unzip, string xmlName) { XElement partElement = null; using (Stream partStream = unzip.GetFileStream(xmlName)) { partElement = XElement.Load(XmlReader.Create(partStream)); } return(partElement); }
/// <summary> /// Create a new PebbleBundle from a .pwb file and parse its metadata. /// </summary> /// <param name="path">The relative or full path to the file.</param> public P3bbleBundle(String path) { Stream jsonstream; Stream binstream; _privateName = path; IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication(); if (!file.FileExists(path)) { throw new FileNotFoundException("the file could not be found in the isolated storage"); } FullPath = Path.GetFullPath(path); Bundle = new UnZipper(file.OpenFile(path, FileMode.Open)); if (Bundle.FileNamesInZip.Contains("manifest.json")) { jsonstream = Bundle.GetFileStream("manifest.json"); } else { throw new ArgumentException("manifest.json not found in archive - not a Pebble bundle."); } var serializer = new DataContractJsonSerializer(typeof(P3bbleBundleManifest)); Manifest = serializer.ReadObject(jsonstream) as P3bbleBundleManifest; jsonstream.Close(); HasResources = (Manifest.Resources.Size != 0); if (Manifest.Type == "firmware") { BundleType = BundleTypes.Firmware; } else { BundleType = BundleTypes.Application; if (Bundle.FileNamesInZip.Contains(Manifest.Application.Filename)) { binstream = Bundle.GetFileStream(Manifest.Application.Filename); } else { String format = "App file {0} not found in archive"; throw new ArgumentException(String.Format(format, Manifest.Application.Filename)); } Application = Util.ReadStruct <P3bbleApplicationMetadata>(binstream); binstream.Close(); } }
public string SendZipAndUnZipIt(IFormFile InputZip) { string fileName = InputZip.FileName; string targetFolderName = "/app/InputFolder"; Directory.CreateDirectory(targetFolderName); FileStream fileStream = new FileStream(targetFolderName + "/" + fileName, FileMode.Create); InputZip.CopyTo(fileStream); fileStream.Close(); fileStream.Dispose(); UnZipper.UnZipFolder("/app/InputFolder/test.zip"); return("Send and Unzip file OK : " + fileName); }
protected void CreateZipFileFromFileListWithFileNameOnlyCore() { string tempDir = GetTempDirectory(); string dummyFileZip = "dummy.zip"; string dummyFolderPath = Utils.CreateDummyDirectory(_mockData.ResourceFolder, tempDir, cleanFolder: true); string dummyFileZipPath = Path.Combine(dummyFolderPath, dummyFileZip); List <string> files = new List <string> { Path.Combine(dummyFolderPath, "dummy1.txt"), Path.Combine(dummyFolderPath, "dummy2.txt"), Path.Combine(dummyFolderPath, "dummy3.txt") }; files.ForEach(file => Utils.CreateDummyFile(dummyFolderPath, Path.GetFileName(file), cleanFolder: false)); Zipper.CreateZipFileFromFileListWithFileNameOnly(dummyFileZipPath, files); IList <Pair <string, byte[]> > fileContents = UnZipper.GetFileContentsFromZipFile(dummyFileZipPath); Assert.Equal(fileContents.Count, files.Count); Utils.RemoveDir(dummyFolderPath); }
/// <summary> /// Unzips file at provided in path to provided out path /// </summary> /// <param name="inPath">Path of the .zip to be unpacked</param> /// <param name="outDirectory">Directory to unpack .zip to</param> /// <returns></returns> public static bool Unpack(string inPath, string outDirectory) { try { string filePath = string.Format(@"{0}/{1}", outDirectory, Path.GetFileNameWithoutExtension(inPath)); if (File.Exists(filePath)) { File.Delete(filePath); } UnZipper uz = new UnZipper(); uz.Destination = outDirectory; uz.ItemList.Add("**"); uz.ZipFile = inPath; uz.UnZip(); return(true); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message, "Zlib Exception Occured", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } return(false); }
//protected void WriteAllBytesAsyncCore() //{ // string methodName = GetTempDirectory(); // string dummyFileZip = "dummyZip.zip"; // string dummyFolderPath = Utils.CreateDummyDirectory(_mockData.ResourceFolder, methodName, cleanFolder: true); // string dummyFileZipPath = Path.Combine(dummyFolderPath, dummyFileZip); // List<string> files = new List<string> // { // Path.Combine(dummyFolderPath, "dummy1.txt"), // Path.Combine(dummyFolderPath, "dummy2.txt"), // Path.Combine(dummyFolderPath, "dummy3.txt") // }; // files.ForEach(file => Utils.CreateDummyFile(dummyFolderPath, Path.GetFileName(file), cleanFolder: false)); // Zipper.CreateZipFileFromFileListWithFileNameOnly(dummyFileZipPath, files); // Directory.CreateDirectory(Path.Combine(dummyFolderPath , "dummy")); // byte[] bytesOfZippedFolder = Zipper.CreateZipContentFromFolder(dummyFolderPath, Path.Combine(dummyFolderPath , "dummy"), "*.txt", false); // IList<Pair<string, byte[]>> fileContents = UnZipper.GetFileContentsFromZipFile(bytesOfZippedFolder); // Assert.False(true); // Utils.RemoveDir(dummyFolderPath); //} //protected async Task UnZipSingleFileContentToStreamCore() //{ // string methodName = GetTempDirectory(); // string dummyFileZip = "dummyZip.zip"; // string dummyFolderPath = Utils.CreateDummyDirectory(_mockData.ResourceFolder, methodName, cleanFolder: true); // string dummyFileZipPath = Path.Combine(dummyFolderPath, dummyFileZip); // List<string> files = new List<string> // { // Path.Combine(dummyFolderPath, "dummy1.txt"), // }; // files.ForEach(file => Utils.CreateDummyFile(dummyFolderPath, Path.GetFileName(file), cleanFolder: false)); // Zipper.CreateZipFileFromFileListWithFileNameOnly(dummyFileZipPath, files); // byte[] fileContent = await KFile.ReadAllBytesAsync(dummyFileZipPath); // using (MemoryStream ms = new MemoryStream()) // { // Zipper.UnZipSingleFileContentToStream(fileContent, ms); // byte[] bytesOfStream = ms.ToArray(); // await KFile.WriteAllBytesAsync(Path.Combine(dummyFolderPath, "dummy.zip"), bytesOfStream).ConfigureAwait(false); // } // IList<Pair<string, byte[]>> fileContents = UnZipper.GetFileContentsFromZipFile(Path.Combine(dummyFolderPath, "dummy.zip")); // Assert.False(true); // Utils.RemoveDir(dummyFolderPath); //} protected async Task UnzipDllsFromNupkgFileCore() { string methodName = GetTempDirectory(); string dummyFileZip = "dummyZip.zip"; string dummyFolderPath = Utils.CreateDummyDirectory(_mockData.ResourceFolder, methodName, cleanFolder: true); string dummyFileZipPath = Path.Combine(dummyFolderPath, dummyFileZip); List <string> files = new List <string> { Path.Combine(dummyFolderPath, "dummy1.txt"), Path.Combine(dummyFolderPath, "dummy2.txt"), Path.Combine(dummyFolderPath, "dummy3.txt") }; files.ForEach(file => Utils.CreateDummyFile(dummyFolderPath, Path.GetFileName(file), cleanFolder: false)); Zipper.CreateZipFileFromFileListWithFileNameOnly(dummyFileZipPath, files); string unzipDirectory = Utils.CreateDummyDirectory(dummyFolderPath, "dummy", cleanFolder: true); await UnZipper.ExtractFlatFilesFromZipFile(dummyFileZipPath, unzipDirectory, "*.txt"); Assert.Equal(Directory.GetFiles(unzipDirectory).Length, files.Count); Utils.RemoveDir(dummyFolderPath); }
/// <summary> /// Unzips file at provided in path to provided out path /// </summary> /// <param name="inPath">Path of the .zip to be unpacked</param> /// <param name="outDirectory">Directory to unpack .zip to</param> /// <returns></returns> public static bool Unpack(string inPath, string outDirectory) { try { string filePath = string.Format(@"{0}/{1}", outDirectory, Path.GetFileNameWithoutExtension(inPath)); if (File.Exists(filePath)) { File.Delete(filePath); } UnZipper uz = new UnZipper(); uz.Destination = outDirectory; uz.ItemList.Add("**"); uz.ZipFile = inPath; uz.UnZip(); return(true); } catch (Exception ex) { Console.WriteLine("Zlib Exception Occured\n{0}", ex.Message); } return(false); }
public void TestTheUnzipper_ShouldNotThrowException() { var unzipper = new UnZipper(MockFileSystem); unzipper.UnZip(@"D:\features\Pickles.Examples\BaseDhtmlFiles.zip", @"d:\output", "BaseDhtmlFiles"); }
public static async Task <HttpResponseMessage> GetTiles(string buid, string floor_number) { var r = new RequestPoisByFloor { access_token = "api_tester", buid = buid, floor_number = floor_number, username = "", password = "" }; try { var response = await AnyPlaceClient.PostAsJsonAsync(new Uri(ServerBaseUri, "/anyplace/floortiles/zip/" + buid + "/" + floor_number), r); if (!response.IsSuccessStatusCode) { return(null); } var x = await response.Content.ReadAsStreamAsync(); using (var isoStore = IsolatedStorageFile.GetUserStoreForApplication()) { using (var zipStream = new UnZipper(x)) { isoStore.CreateDirectory(buid); isoStore.CreateDirectory(buid + "/" + floor_number); foreach (var file in zipStream.FileNamesInZip) { string fileName = Path.GetFileName(file); if (!string.IsNullOrEmpty(fileName)) { Debug.WriteLine(fileName); //save file entry to storage using (var streamWriter = new BinaryWriter(new IsolatedStorageFileStream(buid + "/" + floor_number + "/" + fileName, FileMode.Create, FileAccess.Write, FileShare.Write, isoStore))) { Stream fileStream = zipStream.GetFileStream(file); var buffer = new byte[2048]; int size; while ((size = fileStream.Read(buffer, 0, buffer.Length)) > 0) { streamWriter.Write(buffer, 0, size); } } } } } } } catch (Exception e) { var x = e.Message; } return(null); }
/// <summary> /// Unzips a given zip file into the path specified.Path can be directory /// or file. /// throws Exception /// </summary> /// <param name="ZipFilePath"></param> /// <param name="PathToExtract"></param> internal static void unzip(string ZipFilePath, string PathToExtract) { IsolatedStorageFile storage = null; IsolatedStorageFileStream stream = null; string oldfilePath = null; string newfilePath = null; try { using (storage = IsolatedStorageFile.GetUserStoreForApplication()) { if (storage.FileExists(ZipFilePath)) { // Create target directory, if not exists CreateDirectory(PathToExtract); using (stream = new IsolatedStorageFileStream(ZipFilePath, FileMode.Open, FileAccess.Read, storage)) { if (stream != null) { UnZipper unzip = new UnZipper(stream); foreach (string filename in unzip.FileNamesInZip) { newfilePath = PathToExtract + "\\" + filename; oldfilePath = ZipFilePath + "\\" + filename; // Logger.Info("Unzipping " + newfilePath); if (filename.EndsWith("/")) { newfilePath = newfilePath.Substring(0, newfilePath.LastIndexOf("/")); storage.CreateDirectory(newfilePath); } else { //it is a file if (filename.IndexOf("/") > -1) { string dirPath = newfilePath.Substring(0, newfilePath.LastIndexOf("/")); if (!storage.DirectoryExists(dirPath)) { storage.CreateDirectory(dirPath); } } byte[] data = null; Stream fileStream = unzip.GetFileStream(filename); if (fileStream != null) { using (BinaryReader br = new BinaryReader(fileStream)) { data = br.ReadBytes((int)fileStream.Length); } //Remove if already exists if (storage.FileExists(newfilePath)) { storage.DeleteFile(newfilePath); } using (BinaryWriter bw = new BinaryWriter(storage.CreateFile(newfilePath))) { bw.Write(data); bw.Close(); bw.Dispose(); }; try { fileStream.Close(); fileStream.Dispose(); } catch { } } else { Logger.Warn("File is empty: " + filename); storage.CreateFile(newfilePath); } } // Logger.Info("Done"); } try { stream.Close(); stream.Dispose(); unzip.Dispose(); } catch { } } else { string msg = "Empty zip file stream. Reason - Stream is empty"; throw new Exception(msg); } } } else { string msg = String.Format("Cannot unzip file. Invalid path : {0}", ZipFilePath); throw new Exception(msg); } } } catch (Exception e) { Logger.Error("Unzip failed. Reason - " + e.Message); throw e; } finally { try { storage.Dispose(); } catch { } } }
/// <summary>解凍処理</summary> private void btnDecomp_Click(object sender, EventArgs e) { try { // チェック処理 this.CheckComp_DeComp(); // 解凍部品 UnZipper uz = new UnZipper(); // 選択基準 string[] exts = null; Zipper.SelectionDelegate scd = null; if (this.txtExt.Enabled) { exts = this.txtExt.Text.Split(','); scd = Program.SelectionCriteriaDlgt2; } // 解凍時、上書き制御 uz.ExtractProgress = Program.MyExtractProgressEventHandler; // 解凍(1)デリゲートでフィルタ uz.ExtractFileFromZip( this.txtFile.Text, this.txtFolder.Text, scd, exts, (ExtractExistingFileAction)this.cmbEEFA.SelectedItem, Encoding.GetEncoding((string)this.cmbEnc.SelectedItem), this.txtPass.Text); //// 解凍(2):selectionCriteriaStringでフィルタ //string selectionCriteriaString = ""; //if (exts != null) //{ // foreach (string ext in exts) // { // if (selectionCriteriaString == "") // { // selectionCriteriaString = "name != *." + ext; // } // else // { // selectionCriteriaString += " and name != *." + ext; // } // } //} //uz.ExtractFileFromZip( // this.txtFile.Text, // this.txtFolder.Text, // selectionCriteriaString, // (ExtractExistingFileAction)this.cmbEEFA.SelectedItem, // Encoding.GetEncoding((string)this.cmbEnc.SelectedItem), // this.txtPass.Text); //MessageBox.Show(uz.StatusMSG, "サマリ", // MessageBoxButtons.OK, MessageBoxIcon.Information); //CustMsgBox custMsgBox = new CustMsgBox("サマリ(解凍)", uz.StatusMSG, SystemIcons.Information); //For internationalization, Replaced all the Japanese language to ResourceMgr.GetString() method call CustMsgBox custMsgBox = new CustMsgBox(ResourceMgr.GetString("Error0003"), uz.StatusMSG, SystemIcons.Information); custMsgBox.ShowDialog(); } catch (Exception ex) { //MessageBox.Show(ex.Message, "エラーが発生しました。", MessageBoxButtons.OK, MessageBoxIcon.Error); //For internationalization, Replaced all the Japanese language to ResourceMgr.GetString() method call MessageBox.Show(ex.Message, ResourceMgr.GetString("E0001"), MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public static async Task <HttpResponseMessage> GetTiles(string buid, string floor_number) { var r = new RequestPoisByFloor { access_token = "api_tester", buid = buid, floor_number = floor_number, username = "", password = "" }; try { var response = await AnyPlaceClient.PostAsJsonAsync(new Uri(ServerBaseUri, "/anyplace/floortiles/zip/" + buid + "/" + floor_number), r); if (!response.IsSuccessStatusCode) { return(null); } var x = await response.Content.ReadAsStreamAsync(); var install = Windows.ApplicationModel.Package.Current; var local = ApplicationData.Current.LocalFolder; using (var zipStream = new UnZipper(x)) { var dataFolder = await local.CreateFolderAsync("Datafolder", CreationCollisionOption.OpenIfExists); foreach (var file in zipStream.FileNamesInZip) { // var par = await storageFolder.CreateFolderAsync("/data"); var splited = file.Split('/'); var zoom = splited[0]; string fileName = buid + "." + floor_number + "." + splited[1]; var fi = await dataFolder.CreateFileAsync(fileName, CreationCollisionOption.ReplaceExisting); if (!string.IsNullOrEmpty(fileName)) { Debug.WriteLine(fileName); var str = await fi.OpenStreamForWriteAsync(); Stream fileStream = zipStream.GetFileStream(file); var buffer = new byte[2048]; int size; while ((size = fileStream.Read(buffer, 0, buffer.Length)) > 0) { str.Write(buffer, 0, size); } fileStream.Close(); await str.FlushAsync(); str.Close(); } } } using (var isoStore = IsolatedStorageFile.GetUserStoreForApplication()) { using (var zipStream = new UnZipper(x)) { isoStore.CreateDirectory(buid); isoStore.CreateDirectory(buid + "/" + floor_number); foreach (var file in zipStream.FileNamesInZip) { string fileName = Path.GetFileName(file); if (!string.IsNullOrEmpty(fileName)) { Debug.WriteLine(fileName); //save file entry to storage using (var streamWriter = new BinaryWriter(new IsolatedStorageFileStream(buid + "/" + floor_number + "/" + fileName, FileMode.Create, FileAccess.Write, FileShare.Write, isoStore))) { Stream fileStream = zipStream.GetFileStream(file); var buffer = new byte[2048]; int size; while ((size = fileStream.Read(buffer, 0, buffer.Length)) > 0) { streamWriter.Write(buffer, 0, size); } } } } } } } catch (Exception e) { var x = e.Message; } return(null); }
public string Get(string zipPath) { UnZipper.UnZipFolder(zipPath); return("UnZip OK"); }