WikiFunctions.WikiDiff.WordDiff C# (CSharp) 메소드

WordDiff() 개인적인 정적인 메소드

private static WordDiff ( StringBuilder res, Range range, Range otherRange, IList words, IList otherWords ) : void
res StringBuilder
range Range
otherRange Range
words IList
otherWords IList
리턴 void
        private static void WordDiff(StringBuilder res, Range range, Range otherRange, IList<Word> words,
                                     IList<Word> otherWords)
        {
            bool open = false;

            for (int i = 0; i < range.Count; i++)
            {
                if (i >= otherRange.Count ||
                    words[range.Start + i].ToString() != otherWords[otherRange.Start + i].ToString())
                {
                    if (!open) res.Append("<span class='diffchange'>");
                    open = true;
                }
                else
                {
                    if (open) res.Append("</span>");
                    open = false;
                }
                res.Append(HttpUtility.HtmlEncode(words[range.Start + i].ToString()));
            }

            if (open)
            {
                res.Append("</span>");
            }
        }