/// <summary> /// Fires up TC/ConEmu by means of a setting indicating which tool to use and appropriate arguments for each /// </summary> private void FireTool(string setting, string arguments, bool ignoreActiveItem = false) { (bool cancelled, string toolPath) = GetExePath(setting); if (cancelled == true) { // Quit quietly return; } if (toolPath.IsNullOrWhitespace() == true || File.Exists(toolPath) == false) { Box.Error("The path to {0} is invalid.".FormatWith(setting)); } else { // Update settings if needed if (WritableSettingsStore.PropertyExists(SS_Collection, setting) == false || WritableSettingsStore.GetString(SS_Collection, setting) != toolPath) { WritableSettingsStore.SetString(SS_Collection, setting, toolPath); } // Make arguments try { var filePath = GetFilePath(ignoreActiveItem); var process = Process.Start(new ProcessStartInfo { FileName = toolPath, Arguments = "{0}\"{1}\"".FormatWith(arguments, filePath), }); Thread.Sleep(250); if (process != null && process.HasExited == false) { WindowExtensions.SetForegroundWindow(process.MainWindowHandle); } } catch (Exception ex) { Box.Error("Unable to fire {0}, exception:".FormatWith(setting), ex.Message); } Close(); } }