public bool RunDiff(AnkhDiffArgs args) { if (args == null) { throw new ArgumentNullException("args"); } else if (!args.Validate()) { throw new ArgumentException("Arguments not filled correctly", "args"); } SetFloat(args); string diffApp = this.GetDiffPath(args.Mode, args.MineFile); if (string.IsNullOrEmpty(diffApp)) { IAnkhInternalDiff internalDiff = GetService <IAnkhInternalDiff>(); if (internalDiff == null || !internalDiff.HasDiff) { throw new InvalidOperationException("Internal diff not available"); } return(internalDiff.RunDiff(args)); } string program; string arguments; if (!Substitute(diffApp, args, DiffToolMode.Diff, out program, out arguments) || !File.Exists(program)) { new AnkhMessageBox(Context).Show(string.Format("Can't find diff program '{0}'", program ?? diffApp)); return(false); } Process p = new Process(); p.StartInfo = new ProcessStartInfo(program, arguments); string mergedFile = args.MineFile; DiffToolMonitor monitor = null; if (!string.IsNullOrEmpty(mergedFile)) { monitor = new DiffToolMonitor(Context, mergedFile, false, null); p.EnableRaisingEvents = true; monitor.Register(p); } bool started = false; try { return(started = p.Start()); } finally { if (!started) { if (monitor != null) { monitor.Dispose(); } } } }
public bool RunMerge(AnkhMergeArgs args) { if (args == null) { throw new ArgumentNullException("args"); } else if (!args.Validate()) { throw new ArgumentException("Arguments not filled correctly", "args"); } SetFloat(args); string mergeApp = this.GetMergePath(args.Mode, args.MineFile); if (string.IsNullOrEmpty(mergeApp)) { IAnkhInternalDiff internalDiff = GetService <IAnkhInternalDiff>(); if (internalDiff != null && internalDiff.HasMerge) { return(internalDiff.RunMerge(args)); } } if (string.IsNullOrEmpty(mergeApp)) { new AnkhMessageBox(Context).Show("Please specify a merge tool in Tools->Options->SourceControl->Subversion", "AnkhSVN - No visual merge tool is available"); return(false); } string program; string arguments; if (!Substitute(mergeApp, args, DiffToolMode.Merge, out program, out arguments) || !File.Exists(program)) { new AnkhMessageBox(Context).Show(string.Format("Can't find merge program '{0}'", program ?? mergeApp)); return(false); } Process p = new Process(); p.StartInfo = new ProcessStartInfo(program, arguments); string mergedFile = args.MergedFile; DiffToolMonitor monitor = null; if (!string.IsNullOrEmpty(mergedFile)) { monitor = new DiffToolMonitor(Context, mergedFile, false, args.GetMergedExitCodes()); p.EnableRaisingEvents = true; monitor.Register(p); } bool started = false; try { return(started = p.Start()); } finally { if (!started) { if (monitor != null) { monitor.Dispose(); } } } }