Example #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;
            }
        }
Example #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));
        }
Example #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);
        }
Example #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());
 }
Example #5
0
 private void ProcessReplaceOperation(DiffOperation operation)
 {
     this.ProcessDeleteOperation(operation, "diffmod");
     this.ProcessInsertOperation(operation, "diffmod");
 }