c#作對比軟件

一些 HTML內容比較/文本差別比較 開源代碼php

1. DiffPlex - a .NET Diff Generator    http://diffplex.codeplex.com/SourceControl/changeset/view/052fd342999b  原網站dll下載
http://diffplex.codeplex.com/html

簡介:git

具體使用能夠參考http://diffplex.codeplex.com/wikipage?title=library&referringTitle=Homegithub

IDiffer是差別比較的核心類,提供了兩個文本的低精度的大體比較算法

ISidebySideDiff:提供了高精度的比較以及能夠用兩欄對比顯示差別ide

接口post

 

Silverlight網站

Website
 

2.diffenginespa

簡介:code

功能強大,

缺點:文本每行不能超過1024個字符

DifferenceEngine.DiffList_TextFile sourceFile  null;
DifferenceEngine.DiffList_TextFile destinationFile = null;

sourceFile = new DifferenceEngine.DiffList_TextFile("1.txt");
destinationFile = new DifferenceEngine.DiffList_TextFile("2.txt");

DifferenceEngine.DiffEngine engine = new DifferenceEngine.DiffEngine();
engine.ProcessDiff(sourceFile,destinationFile, DifferenceEngine.DiffEngineLevel.FastImperfect);
ArrayList diffLines = engine.DiffReport();
foreach (DifferenceEngine.DiffResultSpan span in diffLines)
 {  
   switch (span.Status)
    {
 case ifferenceEngine.DiffResultSpanStatus.NoChange:
    //沒改變
      break;
 case DifferenceEngine.DiffResultSpanStatus.AddDestination:
//新增的
     break;
 case DifferenceEngine.DiffResultSpanStatus.DeleteSource:
//已刪除的
     break;
case DifferenceEngine.DiffResultSpanStatus.Replace:
//修改的      
                break;
default:
 //  默認
                      break;

                }

            }
 

獲取新增內容示例:

 

string str = ((DifferenceEngine.TextLine)(destinationFile.GetByIndex(span.DestIndex))).Line;


http://www.codeproject.com/KB/recipes/diffengine.aspx

 

3. htmldiff

簡介:

HtmlDiff本來是Ruby版的HTML差別比較算法,後來有朋友作了個C#版本,特色是很是好用,過於簡單
C#版:  http://htmldiff.codeplex.com/

Ruby版: http://github.com/myobie/htmldiff
http://www.rohland.co.za/index.php/2009/10/31/csharp-html-diff-algorithm/

 


4.NDiffDiff: A Diff Implementation for Lines and Chars in Text File

簡介:

提供Winform Demo

http://www.codeproject.com/KB/recipes/NBDiffDiff.aspx

 

相關文章
相關標籤/搜索