private void bExtractAll_Click(object sender, EventArgs e) { if (SaveAllDialog.ShowDialog() == DialogResult.OK) { var pf = new ProgressForm(false); pf.Text = "Unpacking archive"; pf.EnableCancel(); pf.SetProgressRange(Files.Length); pf.Show(); var count = 0; try { foreach (var fe in Files) { fe.Extract(SaveAllDialog.SelectedPath, true, br, ContainsFileNameBlobs); pf.UpdateProgress(count++); Application.DoEvents(); } } catch (fommCancelException) { MessageBox.Show("Operation cancelled", "Message"); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error"); } pf.Unblock(); pf.Close(); } }
private void bExtract_Click(object sender, EventArgs e) { if (lvFiles.SelectedItems.Count == 0) { return; } if (lvFiles.SelectedItems.Count == 1) { var fe = (BSAFileEntry)lvFiles.SelectedItems[0].Tag; SaveSingleDialog.FileName = fe.FileName; if (SaveSingleDialog.ShowDialog() == DialogResult.OK) { fe.Extract(SaveSingleDialog.FileName, false, br, ContainsFileNameBlobs); SaveSingleDialog.InitialDirectory = Path.GetDirectoryName(SaveSingleDialog.FileName); } } else { if (SaveAllDialog.ShowDialog() == DialogResult.OK) { var pf = new ProgressForm(false); pf.Text = "Unpacking archive"; pf.EnableCancel(); pf.SetProgressRange(lvFiles.SelectedItems.Count); pf.Show(); var count = 0; try { foreach (ListViewItem lvi in lvFiles.SelectedItems) { var fe = (BSAFileEntry)lvi.Tag; fe.Extract(SaveAllDialog.SelectedPath, true, br, ContainsFileNameBlobs); pf.UpdateProgress(count++); Application.DoEvents(); } } catch (fommException) { MessageBox.Show("Operation cancelled", "Message"); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error"); } pf.Unblock(); pf.Close(); } } }