i am using DiffMatchPatch-Library and I want to know on which line in my file the change was found

128 views Asked by At
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...."));
0

There are 0 answers