Esempio n. 1
0
        private void PerformOperation(DiffOperation operation)
        {
            switch (operation.Action)
            {
            case DiffAction.equal:
                this.ProcessEqualOperation(operation);
                break;

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

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

            case DiffAction.none:
                break;

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

            default:
                break;
            }
        }
Esempio n. 2
0
        private void ProcessEqualOperation(DiffOperation operation)
        {
            var result = this.newWords.Where((s, pos) => pos >= operation.StartInNew && pos < operation.EndInNew).ToArray();

            this.content.Append(String.Join("", result));
        }
Esempio n. 3
0
        private void ProcessDeleteOperation(DiffOperation operation, string cssClass)
        {
            var text = this.oldWords.Where((s, pos) => pos >= operation.StartInOld && pos < operation.EndInOld).ToList();

            this.InsertTag("del", cssClass, text);
        }
Esempio n. 4
0
 private void ProcessInsertOperation(DiffOperation operation, string cssClass)
 {
     this.InsertTag("ins", cssClass, this.newWords.Where((s, pos) => pos >= operation.StartInNew && pos < operation.EndInNew).ToList());
 }
Esempio n. 5
0
 private void ProcessReplaceOperation(DiffOperation operation)
 {
     this.ProcessDeleteOperation(operation, "diffmod");
     this.ProcessInsertOperation(operation, "diffmod");
 }