static void Proc(string command, string fileName, MethodInvoker callback, string argument) { string path = GetPathFromRegistry("ProcPath"); if (path == null) { using (TortoiseSvnNotFoundForm form = new TortoiseSvnNotFoundForm()) { form.ShowDialog(); } } else { try { StringBuilder arguments = new StringBuilder(); arguments.Append("/command:"); arguments.Append(command); if (fileName != null) { arguments.Append(" /notempfile "); arguments.Append(" /path:\""); arguments.Append(fileName); arguments.Append('"'); } if (argument != null) { arguments.Append(' '); arguments.Append(argument); } Process p = new Process(); p.StartInfo.FileName = path; p.StartInfo.Arguments = arguments.ToString(); //p.StartInfo.RedirectStandardError = true; //p.StartInfo.RedirectStandardOutput = true; p.StartInfo.UseShellExecute = false; p.EnableRaisingEvents = true; p.Exited += delegate { p.Dispose(); if (callback != null) { callback(); } }; // p.OutputDataReceived += delegate(object sender, DataReceivedEventArgs e) { // SvnClient.Instance.SvnCategory.AppendText(e.Data); // }; // p.ErrorDataReceived += delegate(object sender, DataReceivedEventArgs e) { // SvnClient.Instance.SvnCategory.AppendText(e.Data); // }; p.Start(); } catch (Exception ex) { MessageService.ShowError(ex.Message); } } }
static void Proc(string command, string fileName, MethodInvoker callback, string argument) { string path = GetPathFromRegistry("ProcPath"); if (path == null) { using (TortoiseSvnNotFoundForm form = new TortoiseSvnNotFoundForm()) { form.ShowDialog(SD.WinForms.MainWin32Window); } } else { try { StringBuilder arguments = new StringBuilder(); arguments.Append("/command:"); arguments.Append(command); if (fileName != null) { arguments.Append(" /notempfile "); arguments.Append(" /path:\""); arguments.Append(fileName); arguments.Append('"'); } if (argument != null) { arguments.Append(' '); arguments.Append(argument); } Process p = new Process(); p.StartInfo.FileName = path; p.StartInfo.Arguments = arguments.ToString(); //p.StartInfo.RedirectStandardError = true; //p.StartInfo.RedirectStandardOutput = true; p.StartInfo.UseShellExecute = false; p.EnableRaisingEvents = true; p.Exited += delegate { p.Dispose(); if (callback != null) { callback(); } }; // p.OutputDataReceived += delegate(object sender, DataReceivedEventArgs e) { // SvnClient.Instance.SvnCategory.AppendText(e.Data); // }; // p.ErrorDataReceived += delegate(object sender, DataReceivedEventArgs e) { // SvnClient.Instance.SvnCategory.AppendText(e.Data); // }; p.Start(); } catch (Exception ex) { MessageService.ShowError(ex.Message); } } }