예제 #1
0
        private void PerformOperation(DiffOperation operation)
        {
            switch (operation.Action)
            {
            case DiffAction.equal:
                ProcessEqualOperation(operation);
                return;

            case DiffAction.delete:
                ProcessDeleteOperation(operation, "diffdel");
                return;

            case DiffAction.insert:
                ProcessInsertOperation(operation, "diffins");
                return;

            case DiffAction.none:
                break;

            case DiffAction.replace:
                ProcessReplaceOperation(operation);
                break;

            default:
                return;
            }
        }
예제 #2
0
 private void ProcessReplaceOperation(DiffOperation operation)
 {
     ProcessDeleteOperation(operation, "diffmod");
     ProcessInsertOperation(operation, "diffmod");
 }
예제 #3
0
 private void ProcessInsertOperation(DiffOperation operation, string cssClass)
 {
     InsertTag("ins", cssClass, newWords.Where((s, pos) => ((pos >= operation.StartInNew) && (pos < operation.EndInNew))).ToList());
 }
예제 #4
0
 private void ProcessEqualOperation(DiffOperation operation)
 {
     string[] strArray = newWords.Where((s, pos) => ((pos >= operation.StartInNew) && (pos < operation.EndInNew))).ToArray();
     content.Append(string.Join("", strArray));
 }
예제 #5
0
        private void ProcessDeleteOperation(DiffOperation operation, string cssClass)
        {
            List <string> words = oldWords.Where((s, pos) => ((pos >= operation.StartInOld) && (pos < operation.EndInOld))).ToList();

            InsertTag("del", cssClass, words);
        }