private void ExecuteCommand(object Settings) { // Cast object parameter as RunCommandSettings object RunCommandSettings rcSettings = Settings as RunCommandSettings; if (rcSettings == null) { return; } // Catch any errors (i.e. bad command, bad filename, bad anything) try { Process Process = new Process(); // Expand environment variable to support %SYSTEMROOT%, etc. Process.StartInfo.FileName = "cmd.exe"; Process.StartInfo.Arguments = (rcSettings.ShowCmd ? "/K " : "/C ") + string.Join(" & ", rcSettings.Command.Split(new[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries)); Process.StartInfo.WindowStyle = rcSettings.ShowCmd ? ProcessWindowStyle.Normal : ProcessWindowStyle.Hidden; Process.Start(); } catch { // Errors are stupid } }
public string Serialize() { if (_GUI != null) { _Settings = _GUI.Settings; } if (_Settings == null) { _Settings = new RunCommandSettings(); } return(PluginHelper.SerializeSettings(_Settings)); }
public string Serialize() { if (_GUI != null) _Settings = _GUI.Settings; if (_Settings == null) _Settings = new RunCommandSettings(); return PluginHelper.SerializeSettings(_Settings); }