public static void Main(string[] args) { Opts options = new Opts(); options.ProcessArgs(args); if (options.RemainingArguments.Length < 2) { options.DoHelp(); return; } Application.Init (); Window win = new Window("NDiff"); win.DeleteEvent += new DeleteEventHandler(Window_Delete); win.SetDefaultSize(800, 600); DiffWidget.Options dopts = new DiffWidget.Options(); dopts.SideBySide = options.sidebyside; if (options.RemainingArguments.Length == 2) { dopts.LeftName = options.RemainingArguments[0]; dopts.RightName = options.RemainingArguments[1]; Diff diff = new Diff(options.RemainingArguments[0], options.RemainingArguments[1], options.caseinsensitive, true); win.Add(new DiffWidget(diff, dopts)); } else { Diff[] diffs = new Diff[options.RemainingArguments.Length-1]; for (int i = 0; i < options.RemainingArguments.Length-1; i++) diffs[i] = new Diff(options.RemainingArguments[0], options.RemainingArguments[i+1], options.caseinsensitive, true); Merge merge = new Merge(diffs); win.Add(new DiffWidget(merge, dopts)); } win.ShowAll(); Application.Run(); }
private void Refresh() { box.Show(); try { if (left is string) { diff = new Diff((string)left, (string)right, true, true); } else if (left is string[]) { diff = new Diff((string[])left, (string[])right, null, null); } } catch (Exception e) { Console.Error.WriteLine(e.ToString()); return; } if (widget != null) { pos = widget.Position; box.Remove(widget); widget.Dispose(); } DiffWidget.Options opts = new DiffWidget.Options(); opts.Font = DesktopService.DefaultMonospaceFont; opts.LeftName = "Repository"; opts.RightName = "Working Copy"; widget = new DiffWidget(diff, opts); box.Add(widget); box.ShowAll(); widget.ExposeEvent += new ExposeEventHandler(OnExposed); }