Ich möchte Unterschiede zwischen zwei Dateien in asp.net hervorheben. Nach der Websuche habe ich Diffplex APi gewählt. Ich bin ein Anfänger. Ich brauche eine Anleitung, wie man es umsetzen kann? Ich habe die Referenzbibliotheken hinzugefügt und das ist alles, was ich verstehen konnte. Es gibt keine Dokumentation der Api. Ich habe Apis vorher noch nicht benutzt.Erste Schritte mit Diffplex
5
A
Antwort
6
Hier ist ein einfaches Beispiel aus der "Dokumentation" (d. H. Der Quellcode), mit dem Sie beginnen sollten.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using DiffPlex;
using DiffPlex.DiffBuilder;
using DiffPlex.DiffBuilder.Model;
using System.Text;
namespace DiffPlexTest.Controllers
{
public class HomeController : Controller
{
public ActionResult Index()
{
StringBuilder sb = new StringBuilder();
string oldText = @"We the people
of the united states of america
establish justice
ensure domestic tranquility
provide for the common defence
secure the blessing of liberty
to ourselves and our posterity";
string newText = @"We the peaple
in order to form a more perfect union
establish justice
ensure domestic tranquility
promote the general welfare and
secure the blessing of liberty
to ourselves and our posterity
do ordain and establish this constitution
for the United States of America";
var d = new Differ();
var builder = new InlineDiffBuilder(d);
var result = builder.BuildDiffModel(oldText, newText);
foreach (var line in result.Lines)
{
if (line.Type == ChangeType.Inserted)
{
sb.Append("+ ");
}
else if (line.Type == ChangeType.Deleted)
{
sb.Append("- ");
}
else if (line.Type == ChangeType.Modified)
{
sb.Append("* ");
}
else if (line.Type == ChangeType.Imaginary)
{
sb.Append("? ");
}
else if (line.Type == ChangeType.Unchanged)
{
sb.Append(" ");
}
sb.Append(line.Text + "<br/>");
}
ViewData["old"] = oldText;
ViewData["new"] = newText;
ViewData["result"] = sb.ToString();
return View();
}
}
}
Verwandte Themen
- 1. Erste Schritte mit OpenID
- 2. Erste Schritte mit JavaCC
- 3. Erste Schritte mit Hessian
- 4. Erste Schritte mit SSE
- 5. Erste Schritte mit extJS
- 6. Erste Schritte mit CacheMoney
- 7. Erste Schritte mit CouchDB
- 8. Erste Schritte mit Pylons
- 9. Erste Schritte mit Autotools
- 10. Erste Schritte mit Elmah?
- 11. Erste Schritte mit Metal
- 12. Erste Schritte mit xampp
- 13. Erste Schritte mit Ember.js
- 14. Erste Schritte mit Newspeak
- 15. Erste Schritte mit Syntaxnet
- 16. Erste Schritte mit libpurple
- 17. Erste Schritte mit Android
- 18. Erste Schritte mit Crypto ++
- 19. Erste Schritte mit vBulletin Entwicklung
- 20. Erste Schritte mit Logstash-Filtern
- 21. Erste Schritte mit Unity Framework
- 22. Erste Schritte mit Frühling Rahmen
- 23. Erste Schritte mit WPF & Orchestra
- 24. Erste Schritte mit SPARQL, Sandboxing
- 25. Erste Schritte mit osgi + felix
- 26. Erste Schritte mit SideShow-Geräten
- 27. Erste Schritte mit Zimbra API
- 28. Erste Schritte mit der Datenvisualisierung?
- 29. Erste Schritte mit JAX-WS
- 30. erste schritte mit ruby-vips
Danke, genau das, was ich für – JanR
Great suchen - baute ich ein Diff-Tool auf der DiffPlex, die ziemlich gut funktioniert, so denke ich, Sie mit ihm viel Glück haben werden. –
Hat Diffplex eine native Zusammenführungsoption? – JanR