diffplex-master

所属分类:其他
开发工具:C#
文件大小:489KB
下载次数:0
上传日期:2018-07-13 03:13:01
上 传 者Nakata11
说明:  The DiffPlex library currently exposes two interfaces for generating diffs: IDiffer (implemented by the Differ class) - This is the core diffing class. It exposes the low level functions to generate differences between texts. ISidebySideDiffer (implemented by the SideBySideDiffer class) - This is a higher level interface. It consumes the IDiffer interface and generates a SideBySideDiffModel. This is a model which is suited for displaying the differences of two pieces of text in a side by side view.

文件列表:
.vs\DiffPlex\DesignTimeBuild\.dtbcache (135282, 2018-07-12)
.vs\DiffPlex\v15\.suo (51200, 2018-07-12)
.vs\DiffPlex\v15\Server\sqlite3\db.lock (0, 2018-07-12)
.vs\DiffPlex\v15\Server\sqlite3\storage.ide (4096, 2018-07-12)
.vs\DiffPlex\v15\Server\sqlite3\storage.ide-shm (32768, 2018-07-12)
.vs\DiffPlex\v15\Server\sqlite3\storage.ide-wal (3407272, 2018-07-12)
appveyor.yml (337, 2017-10-27)
ConsoleApp1\App.config (189, 2018-07-12)
ConsoleApp1\bin\Debug\ConsoleApp1.exe (7680, 2018-07-12)
ConsoleApp1\bin\Debug\ConsoleApp1.exe.config (189, 2018-07-12)
ConsoleApp1\bin\Debug\ConsoleApp1.pdb (11776, 2018-07-12)
ConsoleApp1\bin\Debug\DiffPlex.dll (18432, 2018-07-12)
ConsoleApp1\bin\Debug\DiffPlex.pdb (7456, 2018-07-12)
ConsoleApp1\bin\Debug\DiffPlex.xml (3518, 2018-07-12)
ConsoleApp1\ConsoleApp1.csproj (2543, 2018-07-12)
ConsoleApp1\obj\Debug\ConsoleApp1.csproj.CopyComplete (0, 2018-07-12)
ConsoleApp1\obj\Debug\ConsoleApp1.csproj.CoreCompileInputs.cache (42, 2018-07-12)
ConsoleApp1\obj\Debug\ConsoleApp1.csproj.FileListAbsolute.txt (1189, 2018-07-12)
ConsoleApp1\obj\Debug\ConsoleApp1.csprojAssemblyReference.cache (31006, 2018-07-12)
ConsoleApp1\obj\Debug\ConsoleApp1.exe (7680, 2018-07-12)
ConsoleApp1\obj\Debug\ConsoleApp1.pdb (11776, 2018-07-12)
ConsoleApp1\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache (6957, 2018-07-12)
ConsoleApp1\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs (0, 2018-07-12)
ConsoleApp1\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs (0, 2018-07-12)
ConsoleApp1\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs (0, 2018-07-12)
ConsoleApp1\Program.cs (1719, 2018-07-12)
ConsoleApp1\Properties\AssemblyInfo.cs (1429, 2018-07-12)
DiffPlex\bin\Debug\DiffPlex.1.4.1.nupkg (20921, 2018-07-12)
DiffPlex\bin\Debug\DiffPlex.1.4.1.symbols.nupkg (38998, 2018-07-12)
DiffPlex\bin\Debug\net35\DiffPlex.dll (18432, 2018-07-12)
DiffPlex\bin\Debug\net35\DiffPlex.pdb (7456, 2018-07-12)
DiffPlex\bin\Debug\net35\DiffPlex.xml (3518, 2018-07-12)
DiffPlex\bin\Debug\netstandard1.0\DiffPlex.deps.json (14872, 2018-07-12)
DiffPlex\bin\Debug\netstandard1.0\DiffPlex.dll (18432, 2018-07-12)
DiffPlex\bin\Debug\netstandard1.0\DiffPlex.pdb (7456, 2018-07-12)
DiffPlex\bin\Debug\netstandard1.0\DiffPlex.xml (3518, 2018-07-12)
DiffPlex\DiffBuilder\IInlineDiffBuilder.cs (195, 2017-10-27)
DiffPlex\DiffBuilder\InlineDiffBuilder.cs (2608, 2017-10-27)
... ...

DiffPlex [![Build status](https://ci.appveyor.com/api/projects/status/kixqv7xppdtatey7/branch/master?svg=true)](https://ci.appveyor.com/project/mmanela/diffplex/branch/master) [![DiffPlex NuGet version](https://img.shields.io/nuget/v/DiffPlex.svg)](https://www.nuget.org/packages/DiffPlex/) ======== DiffPlex is C# library to generate textual diffs. It targets `netstandard1.0`. ## About the API The DiffPlex library currently exposes two interfaces for generating diffs: * `IDiffer` (implemented by the `Differ` class) - This is the core diffing class. It exposes the low level functions to generate differences between texts. * `ISidebySideDiffer` (implemented by the `SideBySideDiffer` class) - This is a higher level interface. It consumes the `IDiffer` interface and generates a `SideBySideDiffModel`. This is a model which is suited for displaying the differences of two pieces of text in a side by side view. ## Examples For examples of how to use the API please see the the following projects contained in the DiffPlex solution. For use of the `IDiffer` interface see: * `SidebySideDiffer.cs` contained in the `DiffPlex` Project. * `UnidiffFormater.cs` contained in the `DiffPlex.ConsoleRunner` project. For use of the `ISidebySideDiffer` interface see: * `DiffController.cs` and associated MVC views in the `WebDiffer` project * `TextBoxDiffRenderer.cs` in the `SilverlightDiffer` project ## Sample code ```csharp var diffBuilder = new InlineDiffBuilder(new Differ()); var diff = diffBuilder.BuildDiffModel(before, after); foreach (var line in diff.Lines) { switch (line.Type) { case ChangeType.Inserted: Console.ForegroundColor = ConsoleColor.Red; Console.Write("+ "); break; case ChangeType.Deleted: Console.ForegroundColor = ConsoleColor.Green; Console.Write("- "); break; default: Console.ForegroundColor = ConsoleColor.White; Console.Write(" "); break; } Console.WriteLine(line.Text); } ``` ## IDiffer Interface ```csharp /// /// Provides methods for generate differences between texts /// public interface IDiffer { /// /// Create a diff by comparing text line by line /// /// The old text. /// The new text. /// if set to true will ignore white space when determining if lines are the same. /// A DiffResult object which details the differences DiffResult CreateLineDiffs(string oldText, string newText, bool ignoreWhiteSpace); /// /// Create a diff by comparing text character by character /// /// The old text. /// The new text. /// if set to true will treat all whitespace characters are empty strings. /// A DiffResult object which details the differences DiffResult CreateCharacterDiffs(string oldText, string newText, bool ignoreWhitespace); /// /// Create a diff by comparing text word by word /// /// The old text. /// The new text. /// if set to true will ignore white space when determining if words are the same. /// The list of characters which define word separators. /// A DiffResult object which details the differences DiffResult CreateWordDiffs(string oldText, string newText, bool ignoreWhitespace, char[] separators); /// /// Create a diff by comparing text in chunks determined by the supplied chunker function. /// /// The old text. /// The new text. /// if set to true will ignore white space when determining if chunks are the same. /// A function that will break the text into chunks. /// A DiffResult object which details the differences DiffResult CreateCustomDiffs(string oldText, string newText, bool ignoreWhiteSpace, Func chunker); } ``` ## ISidebySideDiffer Interface ```csharp /// /// Provides methods that generate differences between texts for displaying in a side by side view. /// public interface ISideBySideDiffBuilder { /// /// Builds a diff model for displaying diffs in a side by side view /// /// The old text. /// The new text. /// The side by side diff model SideBySideDiffModel BuildDiffModel(string oldText, string newText); } ``` ## Sample Website DiffPlex also contains a sample website that shows how to create a basic side by side diff in an ASP MVC website. ![](https://raw.githubusercontent.com/mmanela/diffplex/master/images/website.png)

近期下载者

相关文件


收藏者