private void ReadComment()
        {
            base.BufferReader.SkipByte();
            if (base.BufferReader.GetByte() != 0x2d)
            {
                XmlExceptionHelper.ThrowTokenExpected(this, "--", (char)base.BufferReader.GetByte());
            }
            base.BufferReader.SkipByte();
            int offset = base.BufferReader.Offset;

            while (true)
            {
                byte @byte = base.BufferReader.GetByte();
                if (@byte == 0x2d)
                {
                    int    num3;
                    byte[] buffer = base.BufferReader.GetBuffer(3, out num3);
                    if ((buffer[num3] == 0x2d) && (buffer[num3 + 1] == 0x2d))
                    {
                        if (buffer[num3 + 2] == 0x3e)
                        {
                            break;
                        }
                        XmlExceptionHelper.ThrowXmlException(this, new XmlException(System.Runtime.Serialization.SR.GetString("XmlInvalidCommentChars")));
                    }
                    base.BufferReader.SkipByte();
                }
                else if ((charType[@byte] & 0x40) == 0)
                {
                    if (@byte == 0xef)
                    {
                        this.ReadNonFFFE();
                    }
                    else
                    {
                        XmlExceptionHelper.ThrowInvalidXml(this, @byte);
                    }
                }
                else
                {
                    base.BufferReader.SkipByte();
                }
            }
            int length = base.BufferReader.Offset - offset;

            base.MoveToComment().Value.SetValue(ValueHandleType.UTF8, offset, length);
            base.BufferReader.Advance(3);
        }
        public override bool Read()
        {
            if (base.Node.ReadState == System.Xml.ReadState.Closed)
            {
                return(false);
            }
            if (base.Node.CanMoveToElement)
            {
                this.MoveToElement();
            }
            base.SignNode();
            if (base.Node.ExitScope)
            {
                base.ExitScope();
            }
            if (!this.buffered)
            {
                base.BufferReader.SetWindow(base.ElementNode.BufferOffset, this.maxBytesPerRead);
            }
            if (base.BufferReader.EndOfFile)
            {
                base.MoveToEndOfFile();
                return(false);
            }
            byte @byte = base.BufferReader.GetByte();

            if (@byte == 60)
            {
                base.BufferReader.SkipByte();
                @byte = base.BufferReader.GetByte();
                switch (@byte)
                {
                case 0x2f:
                    this.ReadEndElement();
                    goto Label_025B;

                case 0x21:
                    base.BufferReader.SkipByte();
                    if (base.BufferReader.GetByte() == 0x2d)
                    {
                        this.ReadComment();
                    }
                    else
                    {
                        if (base.OutsideRootElement)
                        {
                            XmlExceptionHelper.ThrowXmlException(this, new XmlException(System.Runtime.Serialization.SR.GetString("XmlCDATAInvalidAtTopLevel")));
                        }
                        this.ReadCData();
                    }
                    goto Label_025B;

                case 0x3f:
                    this.ReadDeclaration();
                    break;
                }
                if (@byte == 0x3f)
                {
                    this.ReadDeclaration();
                }
                else
                {
                    this.ReadStartElement();
                }
            }
            else if ((charType[@byte] & 0x20) != 0)
            {
                this.ReadWhitespace();
            }
            else if (base.OutsideRootElement && (@byte != 13))
            {
                XmlExceptionHelper.ThrowInvalidRootData(this);
            }
            else if ((charType[@byte] & 8) != 0)
            {
                this.ReadText();
            }
            else if (@byte == 0x26)
            {
                this.ReadEscapedText();
            }
            else if (@byte == 13)
            {
                base.BufferReader.SkipByte();
                if (!base.BufferReader.EndOfFile && (base.BufferReader.GetByte() == 10))
                {
                    this.ReadWhitespace();
                }
                else
                {
                    base.MoveToComplexText().Value.SetCharValue(10);
                }
            }
            else if (@byte == 0x5d)
            {
                int    num2;
                byte[] buffer = base.BufferReader.GetBuffer(3, out num2);
                if (((buffer[num2] == 0x5d) && (buffer[num2 + 1] == 0x5d)) && (buffer[num2 + 2] == 0x3e))
                {
                    XmlExceptionHelper.ThrowXmlException(this, new XmlException(System.Runtime.Serialization.SR.GetString("XmlCloseCData")));
                }
                base.BufferReader.SkipByte();
                base.MoveToComplexText().Value.SetCharValue(0x5d);
            }
            else if (@byte == 0xef)
            {
                int offset = base.BufferReader.Offset;
                this.ReadNonFFFE();
                base.MoveToComplexText().Value.SetValue(ValueHandleType.UTF8, offset, 3);
            }
            else
            {
                XmlExceptionHelper.ThrowInvalidXml(this, @byte);
            }
Label_025B:
            return(true);
        }