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);
                }
            } 
        }
    }

函数调用:

diffmatchfunc(File.ReadAllText("Path"), File.ReadAllText("Path...."));
4

0 回答 0