{"id":17008730,"url":"https://github.com/i-e-b/difftools","last_synced_at":"2025-03-22T12:29:09.058Z","repository":{"id":1778336,"uuid":"2701075","full_name":"i-e-b/DiffTools","owner":"i-e-b","description":"[Working] My own diff engine, plus Neil Fraser's diff-match-patch","archived":false,"fork":false,"pushed_at":"2024-06-19T12:50:28.000Z","size":298,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-27T12:11:14.162Z","etag":null,"topics":["c-sharp","capture-groups","diff","patching","regex-splitters"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/i-e-b.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2011-11-03T09:33:29.000Z","updated_at":"2024-06-19T12:50:32.000Z","dependencies_parsed_at":"2024-06-19T19:30:51.593Z","dependency_job_id":"84884064-336d-4af0-896a-4e475433641c","html_url":"https://github.com/i-e-b/DiffTools","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i-e-b%2FDiffTools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i-e-b%2FDiffTools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i-e-b%2FDiffTools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i-e-b%2FDiffTools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/i-e-b","download_url":"https://codeload.github.com/i-e-b/DiffTools/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244958793,"owners_count":20538621,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c-sharp","capture-groups","diff","patching","regex-splitters"],"created_at":"2024-10-14T05:29:08.412Z","updated_at":"2025-03-22T12:29:09.035Z","avatar_url":"https://github.com/i-e-b.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"Doc Diff\r\n========\r\n\r\nAvailable on NuGet: https://www.nuget.org/packages/DocDiff\r\n\r\nWhat is it?\r\n-----------\r\n\r\nA file difference/comparison class. Performs much the same function as the Diff programs used in version control.\r\nCompares two strings in chunks as determined by a Regex splitter.\r\n\r\n### Differences\r\n\r\n`Differences` takes two documents and emits a set of difference fragments.\r\n\r\nEach fragment is either `deleted`, `inserted`, or `unchanged` between the two versions.\r\nThese fragments are more suited to visual display than change analysis.\r\n\r\nThere are a few splitters provided: `Differences.PerSentence`, `Differences.PerLine`, `Differences.PerWord`, `Differences.PerCharacter`.\r\nSmaller splits result in more complex diffs, and use more memory and compute resource. `PerWord` or `PerLine` is probably best for most cases.\r\n\r\n```csharp\r\nChanges = new Differences(oldVersion, newVersion, Differences.PerWord);\r\n\r\nforeach (var change in fragments)\r\n{\r\n    Console.WriteLine($\"{change.Type}: '{change.Content}'\");\r\n}\r\n```\r\n\r\n```html\r\n\u003cstyle\u003e\r\n    .i {color:black; background-color:#80FF80; padding:0; margin:0;}\r\n    .d {color:#FFa0a0; background-color:inherit; padding:0; margin:0;}\r\n    .u {color:#707070; background-color:inherit; padding:0; margin:0;}\r\n\u003c/style\u003e\r\n\r\n\u003cdiv class=\"text-center\"\u003e\r\n    @foreach (var change in Model.Changes)\r\n    {\r\n        \u003cspan class=\"@change.TypeString\"\u003e@change.Content\u003c/span\u003e\r\n    }\r\n\u003c/div\u003e\r\n```\r\n\r\n### DiffCode\r\n\r\nThis is a basic patch/match tool.\r\n\r\nThe tools in `DiffCode` can be used to analyse differences, and store/retrieve various revisions of files.\r\nThe Decode/Encode methods have variants which are suitable for data transmission and database storage.\r\n\r\n```csharp\r\nvar changes = new Differences(left, right, Differences.PerWord);\r\n\r\nvar encodedChanges = DiffCode.StorageDiffCode(changes);\r\n\r\n// Store 'encoded' and 'left'.\r\n// We can then regenerate 'right':\r\n\r\nvar right = DiffCode.BuildRevision(left, encodedChanges);\r\n```\r\n\r\nPlease note\r\n-----------\r\n\r\nRegex splitters omit the matched parts unless they are in capturing groups. See that the examples in Default.aspx.cs (from the static 'Diff') are all in capturing groups.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fi-e-b%2Fdifftools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fi-e-b%2Fdifftools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fi-e-b%2Fdifftools/lists"}