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; } }
private void ProcessReplaceOperation(DiffOperation operation) { ProcessDeleteOperation(operation, "diffmod"); ProcessInsertOperation(operation, "diffmod"); }
private void ProcessInsertOperation(DiffOperation operation, string cssClass) { InsertTag("ins", cssClass, newWords.Where((s, pos) => ((pos >= operation.StartInNew) && (pos < operation.EndInNew))).ToList()); }
private void ProcessEqualOperation(DiffOperation operation) { string[] strArray = newWords.Where((s, pos) => ((pos >= operation.StartInNew) && (pos < operation.EndInNew))).ToArray(); content.Append(string.Join("", strArray)); }
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); }