Beispiel #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;
            }
        }
Beispiel #2
0
 private void ProcessReplaceOperation(DiffOperation operation)
 {
     ProcessDeleteOperation(operation, "diffmod");
     ProcessInsertOperation(operation, "diffmod");
 }
Beispiel #3
0
 private void ProcessInsertOperation(DiffOperation operation, string cssClass)
 {
     InsertTag("ins", cssClass, newWords.Where((s, pos) => ((pos >= operation.StartInNew) && (pos < operation.EndInNew))).ToList());
 }
Beispiel #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));
 }
Beispiel #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);
        }