コード例 #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));
        }
コード例 #2
0
ファイル: Coordinatizer.cs プロジェクト: modulexcite/pash-1
            public bool MoveNext()
            {
                bool flag = this.m_wrappedEnumerator.MoveNext();

                if (!flag)
                {
                    this.m_current = new CharacterAndCoordinate();
                }
                else
                {
                    this.m_current.DocumentPath = this.m_documentPath;
                    char current   = this.m_wrappedEnumerator.Current;
                    char character = this.m_current.Character;
                    char chr       = character;
                    if (chr == '\0' || chr == '\n')
                    {
                        DocumentCoordinate coordinate = this.m_current.Coordinate;
                        this.m_current.Coordinate = coordinate.NextLine();
                    }
                    else
                    {
                        if (chr == '\r')
                        {
                            if (current != '\n')
                            {
                                DocumentCoordinate documentCoordinate = this.m_current.Coordinate;
                                this.m_current.Coordinate = documentCoordinate.NextLine();
                            }
                        }
                        else
                        {
                            DocumentCoordinate coordinate1 = this.m_current.Coordinate;
                            this.m_current.Coordinate = coordinate1.NextColumn();
                        }
                    }
                    this.m_current.Character = this.m_wrappedEnumerator.Current;
                }
                return(flag);
            }