DiffPlex

来自软件开发
跳转至: 导航搜索

diffplex是一个开源的C#文本差异比较软件。支持.NET 4.0, Silverlight 5.0, Windows 8.0, Windows Phone 8.0, Windows Phone Appx 8.1等环境。如下图所示:

官方网站:https://github.com/mmanela/diffplex

Install-Package DiffPlex

WPF平台的使用

Install-Package DiffPlex.Wpf

前台代码:

xmlns:diffplex="clr-namespace:DiffPlex.Wpf.Controls;assembly=DiffPlex.Wpf"

<diffplex:DiffViewer x:Name="DiffView" />

后台代码:

DiffView.OldText = oldText;
DiffView.NewText = newText;

有三种控件方式:

  • DiffViewer:Textual diffs viewer control with view mode switching by setting an old text and a new text to diff.
  • SideBySideDiffViewer:Side-by-side (splitted) textual diffs viewer control by setting a diff model SideBySideDiffModel.
  • InlineDiffViewer:Inline textual diffs viewer control by setting a diff model DiffPaneModel.