Пример #1
0
        public string GetSubstringFrom(SubstringLocation location)
        {
            var startIndex = location.StartIndex;
            var length     = location.EndIndex - location.StartIndex + 1;

            return(this.SourceText.Substring(startIndex, length));
        }
Пример #2
0
        public EffectManager Apply(Effect effect, int startIndex, int endIndex)
        {
            var location = new SubstringLocation(startIndex, endIndex);
            var change   = new TextChange(effect, location);

            this.Changes.Add(change);
            return(this);
        }
Пример #3
0
        public EffectManager Apply(Effect effect)
        {
            var location = new SubstringLocation(0, this.SourceText.Length - 1);
            var change   = new TextChange(effect, location);

            this.Changes.Add(change);
            return(this);
        }
Пример #4
0
        public string GetSubstringAfter(SubstringLocation location)
        {
            var startIndex = location.EndIndex + 1;

            if (startIndex >= this.SourceText.Length)
            {
                return(string.Empty);
            }

            return(this.SourceText.Substring(startIndex));
        }
Пример #5
0
        public string GetSubstringBefore(SubstringLocation location)
        {
            const int startIndex = 0;

            if (startIndex >= location.StartIndex)
            {
                return(string.Empty);
            }

            var endIndex = location.StartIndex - 1;
            var length   = endIndex - startIndex + 1;

            return(this.SourceText.Substring(startIndex, length));
        }