0
internal void diffmatchfunc(string newtext, string oldtext)
    {
        diff_match_patch dmp = new diff_match_patch();
        
        var listDiff = dmp.diff_main(newtext,oldtext,true);
        dmp.diff_cleanupEfficiency(listDiff);
        
        foreach (var diffitem in listDiff)
        {
            if (diffitem.operation != Operation.EQUAL)
            {
                if(diffitem.text == "\n" || diffitem.text == " ")
                {
                    log.Debug("not Important");   
                }
                else
                {
                    log.Debug(diffitem.operation + " Änderung : " + diffitem.text);
                }
            } 
        }
    }

the function-call:

diffmatchfunc(File.ReadAllText("Path"), File.ReadAllText("Path...."));
jeroenh
  • 26,362
  • 10
  • 73
  • 104
  • I think my question was unclear, so I want to get the number of the line in my file, with foreach or for loop I just get the index of the DiffList directly, which the diff.main method returns – Zakarya Boudouar Oct 02 '20 at 08:50
  • Please edit the question in order to improve it (instead of adding a comment). – jeroenh Oct 02 '20 at 09:22
  • To my knowledge, the google-diff-match-patch library does not record line numbers. – jeroenh Oct 02 '20 at 18:22

0 Answers0