コード例 #1
0
        public void TextDiff(string source, bool sourceIsFile, string destination, bool destinationIsFile)
        {
            using (new DisposableState(this, null))
            {
                DiffListText sLf = null;
                DiffListText dLf = null;
                try
                {
                    sLf = new DiffListText(source, sourceIsFile);
                    dLf = new DiffListText(destination, destinationIsFile);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "File Error");
                    return;
                }

                try
                {
                    double time = 0;
                    var    de   = new DiffEngine();
                    time = de.ProcessDiff(sLf, dLf, DiffEngineLevel.SlowPerfect);

                    var rep = de.DiffReport();
                    ShowDiff(sLf, dLf, rep, time);
                }
                catch (Exception ex)
                {
                    var tmp = string.Format("{0}{1}{1}***STACK***{1}{2}",
                                            ex.Message,
                                            Environment.NewLine,
                                            ex.StackTrace);
                    MessageBox.Show(tmp, "Compare Error");
                }
            }
        }
コード例 #2
0
ファイル: DiffResults.cs プロジェクト: chouzicz/SQLMonitor
        public void TextDiff(string source, bool sourceIsFile, string destination, bool destinationIsFile)
        {
            using (new DisposableState(this, null))
            {
                DiffListText sLf = null;
                DiffListText dLf = null;
                try
                {
                    sLf = new DiffListText(source, sourceIsFile);
                    dLf = new DiffListText(destination, destinationIsFile);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "File Error");
                    return;
                }

                try
                {
                    double time = 0;
                    var de = new DiffEngine();
                    time = de.ProcessDiff(sLf, dLf, DiffEngineLevel.SlowPerfect);

                    var rep = de.DiffReport();
                    ShowDiff(sLf, dLf, rep, time);
                }
                catch (Exception ex)
                {
                    var tmp = string.Format("{0}{1}{1}***STACK***{1}{2}",
                        ex.Message,
                        Environment.NewLine,
                        ex.StackTrace);
                    MessageBox.Show(tmp, "Compare Error");
                }
            }
        }