private void AskSaveChanges() { if (!Modified) { return; } var choice = MsgBoxUtils.ShowInfoDialog("Would you like to save the changes?"); switch (choice) { case DialogResult.Yes: { var sfd = new SaveFileDialog { Title = @"Save bundle file", Filter = @"All types (*.*)|*.*|Bundle file (*.unity3d)|*.unity3d" }; if (sfd.ShowDialog() != DialogResult.OK) { return; } SaveBundle(sfd.FileName); break; } case DialogResult.No: CloseAllFiles(); break; } }
private void btnOK_Click(object sender, EventArgs e) { if (BundleInst == null) { return; } AssetBundleCompressionType compType; if (rbtnLZ4.Checked) { compType = AssetBundleCompressionType.LZ4; } else if (rbtnLZMA.Checked) { compType = AssetBundleCompressionType.LZMA; } else { MsgBoxUtils.ShowErrorDialog("You didn't choose any compression method!\n" + "Please go back and select it.\n"); DialogResult = DialogResult.None; return; } try { var bw = new BackgroundWorker(); bw.DoWork += delegate { var sfd = new SaveFileDialog { FileName = BundleInst.name + ".packed", Filter = @"All types (*.*)|*.*" }; if (sfd.ShowDialog() != DialogResult.OK) { return; } CompressBundle(BundleInst, sfd.FileName, compType); }; bw.RunWorkerCompleted += delegate { MsgBoxUtils.ShowInfoDialog("The bundle file has been successfully packed!", MessageBoxButtons.OK); Compressed = true; }; bw.RunWorkerAsync(); } catch (Exception ex) { MsgBoxUtils.ShowErrorDialog("Something went wrong when packing the bundle:\n" + ex); } }
private void AskSaveChanges() { if (!Workspace.Modified) { return; } var choice = MsgBoxUtils.ShowInfoDialog("Would you like to save the changes?"); switch (choice) { case DialogResult.Yes: SaveFiles(); break; case DialogResult.No: CloseFiles(); break; } }
private void btnOK_Click(object sender, EventArgs e) { if (BundleInst == null) { return; } AssetBundleDecompressionType decompType; if (rbtnFile.Checked) { decompType = AssetBundleDecompressionType.File; } else if (rbtnMemory.Checked) { decompType = AssetBundleDecompressionType.Memory; } else { MsgBoxUtils.ShowErrorDialog("You didn't choose any decompression type!\n" + "Please go back and select it.\n"); DialogResult = DialogResult.None; return; } try { Bw = new BackgroundWorker(); if (BundleInst.file.IsBundleDataCompressed()) { switch ((int)decompType) { // Decompress to File case 0: { var sfd = new SaveFileDialog { FileName = BundleInst.name + ".unpacked", Filter = @"All types (*.*)|*.*" }; if (sfd.ShowDialog() != DialogResult.OK) { return; } Bw.DoWork += delegate { DecompressToFile(sfd.FileName); }; break; } // Decompress to Memory case 1: Bw.DoWork += delegate { DecompressToMemory(); }; break; } } else { Bw.DoWork += delegate { DecompressToMemory(); }; } Bw.RunWorkerCompleted += delegate { MsgBoxUtils.ShowInfoDialog("The bundle file has been successfully unpacked!", MessageBoxButtons.OK); //Decompressed = true; }; Bw.RunWorkerAsync(); } catch (Exception ex) { MsgBoxUtils.ShowErrorDialog("Something went wrong when unpacking the bundle:\n" + ex); } }