public static void KillEsrgan(bool cleanup = true) { if (currentEsrganProcess == null || currentEsrganProcess.HasExited) { return; } cancelled = true; OSUtils.KillProcessTree(currentEsrganProcess.Id); if (cleanup) { IOUtils.ClearDir(Paths.imgInPath); IOUtils.ClearDir(Paths.imgOutPath); IOUtils.ClearDir(Paths.imgOutNcnnPath); } }
public static Dictionary <string, string> filenameMap = new Dictionary <string, string>(); // TODO: Store on disk instead for crashes? public static void Kill() { if (lastAiProcess == null) { return; } try { OSUtils.KillProcessTree(lastAiProcess.Id); } catch (Exception e) { Logger.Log($"Failed to kill currentAiProcess process tree: {e.Message}", true); } }
public static void Cancel(string reason = "", bool noMsgBox = false) { try { OSUtils.KillProcessTree(AiProcess.currentAiProcess.Id); OSUtils.KillProcessTree(AvProcess.lastProcess.Id); } catch { } canceled = true; Program.mainForm.SetStatus("Canceled."); Program.mainForm.SetProgress(0); 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}"); } }