Ejemplo n.º 1
0
        public override string GetText(Span span)
        {
            if (span.End > this.Length)
            {
                throw new ArgumentOutOfRangeException("span");
            }

            if (span.End <= _left.Length)
            {
                return(_left.GetText(span));
            }
            else if (span.Start >= _left.Length)
            {
                return(_right.GetText(new Span(span.Start - _left.Length, span.Length)));
            }
            else
            {
                char[] result = new char[span.Length];

                int leftLength = _left.Length - span.Start;
                _left.CopyTo(span.Start, result, 0, leftLength);
                _right.CopyTo(0, result, leftLength, span.Length - leftLength);

                return(new string(result));
            }
        }
Ejemplo n.º 2
0
 internal static ChangeString CreateChangeString(StringRebuilder content)
 {
     if (content.Length == 0)
     {
         return(ChangeString.EmptyChangeString);
     }
     else if (content.Length <= ChangeString.LiteralStringThreshold)
     {
         return(new LiteralChangeString(content.GetText(new Span(0, content.Length))));
     }
     else
     {
         return(new ReferenceChangeString(content));
     }
 }
Ejemplo n.º 3
0
 public string GetOldText(Span span)
 {
     return(_oldText.GetText(span));
 }