public void Compare(string source, string destination) { this.source = new DiffList_StringData(source + "\n"); this.destination = new DiffList_StringData(destination + "\n"); engine.ProcessDiff(this.source, this.destination); ArrayList list = engine.DiffReport(); diffLines.Clear(); foreach (DiffResultSpan span in list) { switch (span.Status) { case DiffResultSpanStatus.NoChange: diffLines.Add(new DiffLine(0, GetSpanText(span, false))); break; case DiffResultSpanStatus.AddDestination: diffLines.Add(new DiffLine(+1, GetSpanText(span, true))); break; case DiffResultSpanStatus.DeleteSource: diffLines.Add(new DiffLine(-1, GetSpanText(span, false))); break; case DiffResultSpanStatus.Replace: diffLines.Add(new DiffLine(-1, GetSpanText(span, false))); diffLines.Add(new DiffLine(+1, GetSpanText(span, true))); break; } } }
public DiffEngine() { this._source = null; this._dest = null; this._matchList = null; this._stateList = null; this._level = DiffEngineLevel.FastImperfect; }
public DiffEngine() { _source = null; _dest = null; _matchList = null; _stateList = null; _level = DiffEngineLevel.FastImperfect; }
public DiffEngine() { source = null; dest = null; matchList = null; stateList = null; level = DiffEngineLevel.FastImperfect; }
public Engine() { _source = null; _destination = null; _matchList = null; _diffStateList = null; _level = DiffEngineLevel.Fast; }
public DiffEngine() { this._source = (IDiffList)null; this._dest = (IDiffList)null; this._matchList = (ArrayList)null; this._stateList = (DiffStateList)null; this._level = DiffEngineLevel.FastImperfect; }
public double ProcessDiff(IDiffList source, IDiffList destination) { DateTime now = DateTime.Now; this._source = source; this._dest = destination; this._matchList = new ArrayList(); int destCount = this._dest.Count(); int num = this._source.Count(); if (destCount > 0 && num > 0) { this._stateList = new DiffStateList(destCount); this.ProcessRange(0, destCount - 1, 0, num - 1); } return((DateTime.Now - now).TotalSeconds); }
public double ProcessDiff(IDiffList source, IDiffList destination) { DateTime dt = DateTime.Now; _source = source; _dest = destination; _matchList = new ArrayList(); int dcount = _dest.Count(); int scount = _source.Count(); if ((dcount > 0) && (scount > 0)) { _stateList = new DiffStateList(dcount); ProcessRange(0, dcount - 1, 0, scount - 1); } TimeSpan ts = DateTime.Now - dt; return(ts.TotalSeconds); }
public double ProcessDiff(IDiffList source, IDiffList destination) { var dt = DateTime.Now; this.source = source; dest = destination; matchList = new ArrayList(); var dcount = dest.Count(); var scount = this.source.Count(); if ((dcount > 0) && (scount > 0)) { stateList = new DiffStateList(dcount); ProcessRange(0, dcount - 1, 0, scount - 1); } var ts = DateTime.Now - dt; return(ts.TotalSeconds); }
public double ProcessDiff(IDiffList source, IDiffList destination) { var dt = DateTime.Now; _source = source; _dest = destination; _matchList = new List <DiffResultSpan>(); var dcount = _dest.Count(); var scount = _source.Count(); if ((dcount > 0) && (scount > 0)) { _stateList = new DiffStateList(dcount); ProcessRange(0, dcount - 1, 0, scount - 1); } var ts = DateTime.Now - dt; return(ts.TotalSeconds); }
public double ProcessDiff(IDiffList source, IDiffList destination,DiffEngineLevel level) { _level = level; return ProcessDiff(source,destination); }
public double ProcessDiff(IDiffList sourceList, IDiffList destination, DiffEngineLevel engineLevel) { level = engineLevel; return ProcessDiff(sourceList, destination); }
public DiffEngine(string text1, string text2, bool byChars, bool trimEnd) { _source = new DiffList_TextFile(text1, byChars, trimEnd); _dest = new DiffList_TextFile(text2, byChars, trimEnd); }
/// <summary> /// The process diff. /// </summary> /// <param name="sourceIn"> /// The source in. /// </param> /// <param name="destination"> /// The destination. /// </param> /// <param name="levelIn"> /// The level in. /// </param> /// <returns> /// The <see cref="double"/>. /// </returns> public double ProcessDiff(IDiffList sourceIn, IDiffList destination, DiffEngineLevel levelIn) { this.level = levelIn; return(this.ProcessDiff(sourceIn, destination)); }
/// <summary> /// The process diff. /// </summary> /// <param name="sourceIn"> /// The source in. /// </param> /// <param name="destination"> /// The destination. /// </param> /// <param name="levelIn"> /// The level in. /// </param> /// <returns> /// The <see cref="double"/>. /// </returns> public double ProcessDiff(IDiffList sourceIn, IDiffList destination, DiffEngineLevel levelIn) { this.level = levelIn; return this.ProcessDiff(sourceIn, destination); }
public double ProcessDiff(IDiffList source, IDiffList destination) { DateTime dt = DateTime.Now; _source = source; _dest = destination; _matchList = new ArrayList(); int dcount = _dest.Count(); int scount = _source.Count(); if ((dcount > 0)&&(scount > 0)) { _stateList = new DiffStateList(dcount); ProcessRange(0,dcount - 1,0, scount - 1); } TimeSpan ts = DateTime.Now - dt; return ts.TotalSeconds; }
public double ProcessDiff(IDiffList source, IDiffList destination, DiffEngineLevel level) { this.level = level; return(ProcessDiff(source, destination)); }
public double ProcessDiff(IDiffList source, IDiffList destination) { var dt = DateTime.Now; _source = source; _dest = destination; _matchList = new List<DiffResultSpan>(); var dcount = _dest.Count(); var scount = _source.Count(); if ((dcount > 0)&&(scount > 0)) { _stateList = new DiffStateList(dcount); ProcessRange(0,dcount - 1,0, scount - 1); } var ts = DateTime.Now - dt; return ts.TotalSeconds; }
private void ShowResult(IDiffList source, IDiffList destination, ArrayList result) { int cnt = 1; int i; foreach (DiffResultSpan drs in result) { ListViewItem lviS; ListViewItem lviD; switch (drs.Status) { case DiffResultSpanStatus.DeleteSource: for (i = 0; i < drs.Length; i++) { lviS = new ListViewItem(cnt.ToString("00000")); lviD = new ListViewItem(cnt.ToString("00000")); lviS.BackColor = Color.Red; lviS.SubItems.Add(((TextLine)source.GetByIndex(drs.SourceIndex + i)).Line); lviD.BackColor = Color.LightGray; lviD.SubItems.Add(""); lvSource.Items.Add(lviS); lvDest.Items.Add(lviD); cnt++; } break; case DiffResultSpanStatus.NoChange: for (i = 0; i < drs.Length; i++) { lviS = new ListViewItem(cnt.ToString("00000")); lviD = new ListViewItem(cnt.ToString("00000")); lviS.BackColor = Color.White; lviS.SubItems.Add(((TextLine)source.GetByIndex(drs.SourceIndex + i)).Line); lviD.BackColor = Color.White; lviD.SubItems.Add(((TextLine)destination.GetByIndex(drs.DestIndex + i)).Line); lvSource.Items.Add(lviS); lvDest.Items.Add(lviD); cnt++; } break; case DiffResultSpanStatus.AddDestination: for (i = 0; i < drs.Length; i++) { lviS = new ListViewItem(cnt.ToString("00000")); lviD = new ListViewItem(cnt.ToString("00000")); lviS.BackColor = Color.LightGray; lviS.SubItems.Add(""); lviD.BackColor = Color.LightGreen; lviD.SubItems.Add(((TextLine)destination.GetByIndex(drs.DestIndex + i)).Line); lvSource.Items.Add(lviS); lvDest.Items.Add(lviD); cnt++; } break; case DiffResultSpanStatus.Replace: for (i = 0; i < drs.Length; i++) { lviS = new ListViewItem(cnt.ToString("00000")); lviD = new ListViewItem(cnt.ToString("00000")); lviS.BackColor = Color.Red; lviS.SubItems.Add(((TextLine)source.GetByIndex(drs.SourceIndex + i)).Line); lviD.BackColor = Color.LightGreen; lviD.SubItems.Add(((TextLine)destination.GetByIndex(drs.DestIndex + i)).Line); lvSource.Items.Add(lviS); lvDest.Items.Add(lviD); cnt++; } break; } } }
public Results(IDiffList source, IDiffList destination, ArrayList DiffLines, double seconds) { InitializeComponent(); this.Text = string.Format("Results: {0} secs.", seconds.ToString("#0.00")); ListViewItem lviS; ListViewItem lviD; int cnt = 1; int i; foreach (DiffResultSpan drs in DiffLines) { switch (drs.Status) { case DiffResultSpanStatus.DeleteSource: for (i = 0; i < drs.Length; i++) { lviS = new ListViewItem(cnt.ToString("00000")); lviD = new ListViewItem(cnt.ToString("00000")); lviS.BackColor = Color.Red; lviS.SubItems.Add((source.GetByIndex(drs.SourceIndex + i)).ToString()); lviD.BackColor = Color.LightGray; lviD.SubItems.Add(""); lvSource.Items.Add(lviS); lvDestination.Items.Add(lviD); cnt++; } break; case DiffResultSpanStatus.NoChange: for (i = 0; i < drs.Length; i++) { lviS = new ListViewItem(cnt.ToString("00000")); lviD = new ListViewItem(cnt.ToString("00000")); lviS.BackColor = Color.White; lviS.SubItems.Add((source.GetByIndex(drs.SourceIndex + i)).ToString()); lviD.BackColor = Color.White; lviD.SubItems.Add((destination.GetByIndex(drs.DestIndex + i)).ToString()); lvSource.Items.Add(lviS); lvDestination.Items.Add(lviD); cnt++; } break; case DiffResultSpanStatus.AddDestination: for (i = 0; i < drs.Length; i++) { lviS = new ListViewItem(cnt.ToString("00000")); lviD = new ListViewItem(cnt.ToString("00000")); lviS.BackColor = Color.LightGray; lviS.SubItems.Add(""); lviD.BackColor = Color.LightGreen; lviD.SubItems.Add((destination.GetByIndex(drs.DestIndex + i)).ToString()); lvSource.Items.Add(lviS); lvDestination.Items.Add(lviD); cnt++; } break; case DiffResultSpanStatus.Replace: for (i = 0; i < drs.Length; i++) { lviS = new ListViewItem(cnt.ToString("00000")); lviD = new ListViewItem(cnt.ToString("00000")); lviS.BackColor = Color.Red; lviS.SubItems.Add((source.GetByIndex(drs.SourceIndex + i)).ToString()); lviD.BackColor = Color.LightGreen; lviD.SubItems.Add((destination.GetByIndex(drs.DestIndex + i)).ToString()); lvSource.Items.Add(lviS); lvDestination.Items.Add(lviD); cnt++; } break; } } }