private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { if (e.Argument is WorkerData wdata) { e.Result = WAD3Loader.ExtractWadFromBsp(wdata.InputFilename, wdata.OutputFilename); } }
private void btnSaveWad_Click(object sender, EventArgs e) { if (saveWadFileDialog.ShowDialog() == DialogResult.OK) { progBar.Show(); progLbl.Show(); btnSaveWad.Enabled = false; tabControl1.Enabled = false; try { string savePath = saveWadFileDialog.FileName; Color transparentColorReplacement = panelPickTransparentColor.BackColor; bool reserveLastColor = checkBox1.Checked; GetInputFilenames(out string[] names, out string[] fNames); Thread thCreator = new Thread((o) => { WAD3Loader.CreateWad(savePath, fNames, names, transparentColorReplacement, reserveLastColor); }); thCreator.Start(); while (thCreator.IsAlive) { Thread.Sleep(10); Application.DoEvents(); } progBar.Hide(); progLbl.Hide(); if (MessageBox.Show("Wad file created! Open it now in viewer?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == System.Windows.Forms.DialogResult.Yes) { openFileNow(saveWadFileDialog.FileName); } } finally { Close(); } } }
private void button5_Click(object sender, EventArgs e) { if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { progBar.Show(); progLbl.Show(); button5.Enabled = false; tabControl1.Enabled = false; try { string[] names; string[] fNames; GetInputFilenames(out names, out fNames); Thread thCreator = new Thread((o) => { WAD3Loader.CreateWad(saveFileDialog1.FileName, fNames, names, checkBox1.Checked); }); thCreator.Start(); while (thCreator.IsAlive) { System.Threading.Thread.Sleep(10); Application.DoEvents(); } if (MessageBox.Show("Wad file created! Open it now in viewer?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == System.Windows.Forms.DialogResult.Yes) { if (openFileNow != null) { openFileNow(saveFileDialog1.FileName); } } } finally { progBar.Hide(); progLbl.Hide(); this.Close(); } } }