コード例 #1
0
        private void ReadDeclaration()
        {
            int num;

            if (!this.buffered)
            {
                this.BufferElement();
            }
            byte[] bytes = base.BufferReader.GetBuffer(5, out num);
            if (((bytes[num] != 0x3f) || (bytes[num + 1] != 120)) || (((bytes[num + 2] != 0x6d) || (bytes[num + 3] != 0x6c)) || ((charType[bytes[num + 4]] & 4) == 0)))
            {
                XmlExceptionHelper.ThrowProcessingInstructionNotSupported(this);
            }
            if (base.Node.ReadState != System.Xml.ReadState.Initial)
            {
                XmlExceptionHelper.ThrowDeclarationNotFirst(this);
            }
            base.BufferReader.Advance(5);
            int offset = num + 1;
            int length = 3;
            int num4   = base.BufferReader.Offset;

            this.SkipWhitespace();
            this.ReadAttributes();
            int num5 = base.BufferReader.Offset - num4;

            while (num5 > 0)
            {
                byte @byte = base.BufferReader.GetByte((num4 + num5) - 1);
                if ((charType[@byte] & 4) == 0)
                {
                    break;
                }
                num5--;
            }
            bytes = base.BufferReader.GetBuffer(2, out num);
            if ((bytes[num] != 0x3f) || (bytes[num + 1] != 0x3e))
            {
                XmlExceptionHelper.ThrowTokenExpected(this, "?>", Encoding.UTF8.GetString(bytes, num, 2));
            }
            base.BufferReader.Advance(2);
            XmlBaseReader.XmlDeclarationNode node = base.MoveToDeclaration();
            node.LocalName.SetValue(offset, length);
            node.Value.SetValue(ValueHandleType.UTF8, num4, num5);
        }