public static void Cancel(string reason = "", bool noMsgBox = false) { canceled = true; Program.mainForm.SetStatus("Canceled."); Program.mainForm.SetProgress(0); AiProcess.Kill(); AvProcess.Kill(); if (!current.stepByStep && !Config.GetBool("keepTempFolder")) { if (false /* IOUtils.GetAmountOfFiles(Path.Combine(current.tempFolder, Paths.resumeDir), true) > 0 */) // TODO: Uncomment for 1.23 { DialogResult dialogResult = MessageBox.Show($"Delete the temp folder (Yes) or keep it for resuming later (No)?", "Delete temporary files?", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { IOUtils.TryDeleteIfExists(current.tempFolder); } } else { IOUtils.TryDeleteIfExists(current.tempFolder); } } AutoEncode.busy = false; Program.mainForm.SetWorking(false); Program.mainForm.SetTab("interpolation"); Logger.LogIfLastLineDoesNotContainMsg("Canceled interpolation."); if (!string.IsNullOrWhiteSpace(reason) && !noMsgBox) { Utils.ShowMessage($"Canceled:\n\n{reason}"); } }
public static void Cancel(string reason = "", bool noMsgBox = false) { if (current == null) { return; } canceled = true; Program.mainForm.SetStatus("Canceled."); Program.mainForm.SetProgress(0); AiProcess.Kill(); AvProcess.Kill(); if (!current.stepByStep && !Config.GetBool(Config.Key.keepTempFolder)) { if (!BatchProcessing.busy && IoUtils.GetAmountOfFiles(Path.Combine(current.tempFolder, Paths.resumeDir), true) > 0) { DialogResult dialogResult = MessageBox.Show($"Delete the temp folder (Yes) or keep it for resuming later (No)?", "Delete temporary files?", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { Task.Run(async() => { await IoUtils.TryDeleteIfExistsAsync(current.tempFolder); }); } } else { Task.Run(async() => { await IoUtils.TryDeleteIfExistsAsync(current.tempFolder); }); } } AutoEncode.busy = false; Program.mainForm.SetWorking(false); Program.mainForm.SetTab("interpolation"); Logger.LogIfLastLineDoesNotContainMsg("Canceled interpolation."); if (!string.IsNullOrWhiteSpace(reason) && !noMsgBox) { UiUtils.ShowMessageBox($"Canceled:\n\n{reason}"); } }