.NET 的任何体面的文本差异/合并引擎?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/138331/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 10:05:39  来源:igfitidea点击:

Any decent text diff/merge engine for .NET?

.netmergediff

提问by aku

Requirements:

要求:

  • free, preferably open-source
  • implemented in one of the .NET managed langs
  • 免费,最好是开源的
  • 在 .NET 托管语言之一中实现

Google found these:

谷歌找到了这些:

EDIT:

编辑:

No apps please, only libraries.

请不要应用程序,只有图书馆。

采纳答案by Cheeso

You can grab the COM component that uses Google's Diff/Patch/Match. It works from .NET.

您可以获取使用 Google 的 Diff/Patch/Match 的 COM 组件。它从 .NET 工作。

Update, 2010 Oct 17: The Google Diff/Patch/Merge codehas been ported to C#. The COM component still works, but if you're coming from .NET, you'll wanna use the .NET port directly.

2010 年 10 月 17 日更新Google Diff/Patch/Merge 代码已移植到 C#。COM 组件仍然有效,但如果您来自 .NET,您将需要直接使用 .NET 端口。

回答by Anheledir

I think the "Generic - Reusable Diff Algorithm in C#" on Codeproject is the best you can find as a .NET-Engine for diff/patch/merge. I made a project on my own with it and it fits my needs with most scenarios. There are one or two worst-case scencario when the algorithm made the patch-file larger than it have to be. But in most of the cases it works just fine for me (textfiles with a size of >30 MB).

我认为 Codeproject 上的“通用 - C# 中的可重用 Diff 算法”是您可以找到的最好的 .NET 引擎,用于 diff/patch/merge。我用它自己做了一个项目,它适合我在大多数情况下的需求。当算法使补丁文件比它必须的大时,有一两个最坏的情况。但在大多数情况下,它对我来说效果很好(大小大于 30 MB 的文本文件)。

I'm currently testing another Codeproject-Project you can find here: http://www.codeproject.com/KB/applications/patch.aspxIt's using some DLLs from Microsoft for patching, so it looks interesting. But those DLLs are unmanaged and this project is only some sort of wrapper for it. But maybe it can help you

我目前正在测试另一个 Codeproject-Project,您可以在这里找到:http: //www.codeproject.com/KB/applications/patch.aspx它使用 Microsoft 的一些 DLL 进行修补,因此看起来很有趣。但是这些 DLL 是不受管理的,这个项目只是它的某种包装。但也许它可以帮助你

Edit:Just found another project, DiffPlex: http://diffplex.codeplex.com/It's a combination of a .NET Diffing Library with both a Silverlight and HTML diff viewer. As stated there, DiffPlex is the library that CodePlex leverages to generate the diffs of files.

编辑:刚刚发现了另一个项目DiffPlexhttp: //diffplex.codeplex.com/是 .NET Diffing Library 与 Silverlight 和 HTML diff viewer 的组合。如前所述存在,DiffPlex是CodePlex上利用生成文件的diff文件库。

回答by henon

GitSharp includes a diff engine based on meyers diff. Take a look at the demo which implements a simple wpf diff viewer based on the Diff.Sections collection: http://www.eqqon.com/index.php/GitSharp#GitSharp.Demo

GitSharp 包含一个基于 meyers diff 的 diff 引擎。看一下基于 Diff.Sections 集合实现简单 wpf 差异查看器的演示:http: //www.eqqon.com/index.php/GitSharp#GitSharp.Demo

回答by Tao

None of the answers so far (except possibly the GitSharp reference) deal with 3-way merge, so in case it helps anyone I recently ported Tony Garnock-Jones' javascript diff3 implementation (from the synchrotronproject, based on Hunt and McIlroy 1976) to C#.

到目前为止,没有一个答案(可能除了 GitSharp 参考)涉及 3 向合并,所以以防万一我最近移植了 Tony Garnock-Jones 的 javascript diff3 实现(来自 同步加速器项目,基于 Hunt 和 McIlroy 1976)到 C#。

It's a simplistic single-file port of diff and three-way merge methods, but it's the standard algorithm and so far works very well for me: https://gist.github.com/2633407

这是一个简单的 diff 和三路合并方法的单文件端口,但它是标准算法,到目前为止对我来说效果很好:https: //gist.github.com/2633407