Esempio n. 1
0
        public DocumentRange GetRange(int length)
        {
            CharacterAndCoordinate at                     = this.GetAt(0);
            DocumentCoordinate     coordinate             = at.Coordinate;
            CharacterAndCoordinate characterAndCoordinate = this.GetAt(length);
            DocumentCoordinate     documentCoordinate     = characterAndCoordinate.Coordinate;

            for (int i = length - 1; documentCoordinate.Column == 0 && i >= 0; i--)
            {
                CharacterAndCoordinate at1 = this.GetAt(i);
                char character             = at1.Character;
                if (character != 0)
                {
                    if (character == '\r' || character == '\n')
                    {
                        documentCoordinate = at1.Coordinate;
                        break;
                    }
                    else
                    {
                        DocumentCoordinate coordinate1 = at1.Coordinate;
                        documentCoordinate = coordinate1.NextColumn();
                    }
                }
            }
            return(new DocumentRange(this.m_documentPath, coordinate, documentCoordinate));
        }
Esempio n. 2
0
 public char this[int offset]
 {
     get
     {
         CharacterAndCoordinate at = this.GetAt(offset);
         return(at.Character);
     }
 }
Esempio n. 3
0
		private CharacterAndCoordinate GetAt(int offset)
		{
			while (offset > this.m_buffer.Count - 1)
			{
				if (!this.m_enumerator.MoveNext())
				{
					CharacterAndCoordinate mLastReadPosition = new CharacterAndCoordinate();
					mLastReadPosition.Coordinate = this.m_lastReadPosition;
					return mLastReadPosition;
				}
				else
				{
					CharacterAndCoordinate current = this.m_enumerator.Current;
					this.m_buffer.Add(current);
					this.m_lastReadPosition = current.Coordinate;
				}
			}
			return this.m_buffer[offset];
		}
Esempio n. 4
0
 private CharacterAndCoordinate GetAt(int offset)
 {
     while (offset > this.m_buffer.Count - 1)
     {
         if (!this.m_enumerator.MoveNext())
         {
             CharacterAndCoordinate mLastReadPosition = new CharacterAndCoordinate();
             mLastReadPosition.Coordinate = this.m_lastReadPosition;
             return(mLastReadPosition);
         }
         else
         {
             CharacterAndCoordinate current = this.m_enumerator.Current;
             this.m_buffer.Add(current);
             this.m_lastReadPosition = current.Coordinate;
         }
     }
     return(this.m_buffer[offset]);
 }