コード例 #1
0
        private void ReadList(ValueHandle value)
        {
            XmlBinaryNodeType type;

            if (this.listValue == null)
            {
                this.listValue = new ValueHandle(this);
            }
            int length = 0;
            int offset = this.Offset;

Label_001D:
            type = this.GetNodeType();
            this.SkipNodeType();
            if (type == XmlBinaryNodeType.StartListText)
            {
                XmlExceptionHelper.ThrowInvalidBinaryFormat(this.reader);
            }
            if (type != XmlBinaryNodeType.EndListText)
            {
                this.ReadValue(type, this.listValue);
                length++;
                goto Label_001D;
            }
            value.SetValue(ValueHandleType.List, offset, length);
        }
コード例 #2
0
        private void ReadList(ValueHandle value)
        {
            if (_listValue == null)
            {
                _listValue = new ValueHandle(this);
            }
            int count  = 0;
            int offset = this.Offset;

            while (true)
            {
                XmlBinaryNodeType nodeType = GetNodeType();
                SkipNodeType();
                if (nodeType == XmlBinaryNodeType.StartListText)
                {
                    XmlExceptionHelper.ThrowInvalidBinaryFormat(_reader);
                }
                if (nodeType == XmlBinaryNodeType.EndListText)
                {
                    break;
                }
                ReadValue(nodeType, _listValue);
                count++;
            }
            value.SetValue(ValueHandleType.List, offset, count);
        }
コード例 #3
0
ファイル: XmlBinaryReader.cs プロジェクト: dotnet/corefx
 private void ReadName(ValueHandle value)
 {
     int length = ReadMultiByteUInt31();
     int offset = BufferReader.ReadBytes(length);
     value.SetValue(ValueHandleType.UTF8, offset, length);
 }
コード例 #4
0
        private void ReadValue(ValueHandle value, ValueHandleType type, int length)
        {
            int offset = ReadBytes(length);

            value.SetValue(type, offset, length);
        }
コード例 #5
0
        public void ReadValue(XmlBinaryNodeType nodeType, ValueHandle value)
        {
            switch (nodeType)
            {
            case XmlBinaryNodeType.EmptyText:
                value.SetValue(ValueHandleType.Empty);
                break;

            case XmlBinaryNodeType.ZeroText:
                value.SetValue(ValueHandleType.Zero);
                break;

            case XmlBinaryNodeType.OneText:
                value.SetValue(ValueHandleType.One);
                break;

            case XmlBinaryNodeType.TrueText:
                value.SetValue(ValueHandleType.True);
                break;

            case XmlBinaryNodeType.FalseText:
                value.SetValue(ValueHandleType.False);
                break;

            case XmlBinaryNodeType.BoolText:
                value.SetValue(ReadUInt8() != 0 ? ValueHandleType.True : ValueHandleType.False);
                break;

            case XmlBinaryNodeType.Chars8Text:
                ReadValue(value, ValueHandleType.UTF8, ReadUInt8());
                break;

            case XmlBinaryNodeType.Chars16Text:
                ReadValue(value, ValueHandleType.UTF8, ReadUInt16());
                break;

            case XmlBinaryNodeType.Chars32Text:
                ReadValue(value, ValueHandleType.UTF8, ReadUInt31());
                break;

            case XmlBinaryNodeType.UnicodeChars8Text:
                ReadUnicodeValue(value, ReadUInt8());
                break;

            case XmlBinaryNodeType.UnicodeChars16Text:
                ReadUnicodeValue(value, ReadUInt16());
                break;

            case XmlBinaryNodeType.UnicodeChars32Text:
                ReadUnicodeValue(value, ReadUInt31());
                break;

            case XmlBinaryNodeType.Bytes8Text:
                ReadValue(value, ValueHandleType.Base64, ReadUInt8());
                break;

            case XmlBinaryNodeType.Bytes16Text:
                ReadValue(value, ValueHandleType.Base64, ReadUInt16());
                break;

            case XmlBinaryNodeType.Bytes32Text:
                ReadValue(value, ValueHandleType.Base64, ReadUInt31());
                break;

            case XmlBinaryNodeType.DictionaryText:
                value.SetDictionaryValue(ReadDictionaryKey());
                break;

            case XmlBinaryNodeType.UniqueIdText:
                ReadValue(value, ValueHandleType.UniqueId, ValueHandleLength.UniqueId);
                break;

            case XmlBinaryNodeType.GuidText:
                ReadValue(value, ValueHandleType.Guid, ValueHandleLength.Guid);
                break;

            case XmlBinaryNodeType.DecimalText:
                ReadValue(value, ValueHandleType.Decimal, ValueHandleLength.Decimal);
                break;

            case XmlBinaryNodeType.Int8Text:
                ReadValue(value, ValueHandleType.Int8, ValueHandleLength.Int8);
                break;

            case XmlBinaryNodeType.Int16Text:
                ReadValue(value, ValueHandleType.Int16, ValueHandleLength.Int16);
                break;

            case XmlBinaryNodeType.Int32Text:
                ReadValue(value, ValueHandleType.Int32, ValueHandleLength.Int32);
                break;

            case XmlBinaryNodeType.Int64Text:
                ReadValue(value, ValueHandleType.Int64, ValueHandleLength.Int64);
                break;

            case XmlBinaryNodeType.UInt64Text:
                ReadValue(value, ValueHandleType.UInt64, ValueHandleLength.UInt64);
                break;

            case XmlBinaryNodeType.FloatText:
                ReadValue(value, ValueHandleType.Single, ValueHandleLength.Single);
                break;

            case XmlBinaryNodeType.DoubleText:
                ReadValue(value, ValueHandleType.Double, ValueHandleLength.Double);
                break;

            case XmlBinaryNodeType.TimeSpanText:
                ReadValue(value, ValueHandleType.TimeSpan, ValueHandleLength.TimeSpan);
                break;

            case XmlBinaryNodeType.DateTimeText:
                ReadValue(value, ValueHandleType.DateTime, ValueHandleLength.DateTime);
                break;

            case XmlBinaryNodeType.StartListText:
                ReadList(value);
                break;

            case XmlBinaryNodeType.QNameDictionaryText:
                ReadQName(value);
                break;

            default:
                XmlExceptionHelper.ThrowInvalidBinaryFormat(_reader);
                break;
            }
        }
 private void ReadName(ValueHandle value)
 {
     int count = this.ReadMultiByteUInt31();
     int offset = base.BufferReader.ReadBytes(count);
     value.SetValue(ValueHandleType.UTF8, offset, count);
 }
コード例 #7
0
 void ReadList(ValueHandle value)
 {
     if (listValue == null)
     {
         listValue = new ValueHandle(this);
     }
     int count = 0;
     int offset = this.Offset;
     while (true)
     {
         XmlBinaryNodeType nodeType = GetNodeType();
         SkipNodeType();
         if (nodeType == XmlBinaryNodeType.StartListText)
             XmlExceptionHelper.ThrowInvalidBinaryFormat(reader);
         if (nodeType == XmlBinaryNodeType.EndListText)
             break;
         ReadValue(nodeType, listValue);
         count++;
     }
     value.SetValue(ValueHandleType.List, offset, count);
 }
コード例 #8
0
 void ReadValue(ValueHandle value, ValueHandleType type, int length)
 {
     int offset = ReadBytes(length);
     value.SetValue(type, offset, length);
 }
コード例 #9
0
 public void ReadValue(XmlBinaryNodeType nodeType, ValueHandle value)
 {
     switch (nodeType)
     {
         case XmlBinaryNodeType.EmptyText:
             value.SetValue(ValueHandleType.Empty);
             break;
         case XmlBinaryNodeType.ZeroText:
             value.SetValue(ValueHandleType.Zero);
             break;
         case XmlBinaryNodeType.OneText:
             value.SetValue(ValueHandleType.One);
             break;
         case XmlBinaryNodeType.TrueText:
             value.SetValue(ValueHandleType.True);
             break;
         case XmlBinaryNodeType.FalseText:
             value.SetValue(ValueHandleType.False);
             break;
         case XmlBinaryNodeType.BoolText:
             value.SetValue(ReadUInt8() != 0 ? ValueHandleType.True : ValueHandleType.False);
             break;
         case XmlBinaryNodeType.Chars8Text:
             ReadValue(value, ValueHandleType.UTF8, ReadUInt8());
             break;
         case XmlBinaryNodeType.Chars16Text:
             ReadValue(value, ValueHandleType.UTF8, ReadUInt16());
             break;
         case XmlBinaryNodeType.Chars32Text:
             ReadValue(value, ValueHandleType.UTF8, ReadUInt31());
             break;
         case XmlBinaryNodeType.UnicodeChars8Text:
             ReadUnicodeValue(value, ReadUInt8());
             break;
         case XmlBinaryNodeType.UnicodeChars16Text:
             ReadUnicodeValue(value, ReadUInt16());
             break;
         case XmlBinaryNodeType.UnicodeChars32Text:
             ReadUnicodeValue(value, ReadUInt31());
             break;
         case XmlBinaryNodeType.Bytes8Text:
             ReadValue(value, ValueHandleType.Base64, ReadUInt8());
             break;
         case XmlBinaryNodeType.Bytes16Text:
             ReadValue(value, ValueHandleType.Base64, ReadUInt16());
             break;
         case XmlBinaryNodeType.Bytes32Text:
             ReadValue(value, ValueHandleType.Base64, ReadUInt31());
             break;
         case XmlBinaryNodeType.DictionaryText:
             value.SetDictionaryValue(ReadDictionaryKey());
             break;
         case XmlBinaryNodeType.UniqueIdText:
             ReadValue(value, ValueHandleType.UniqueId, ValueHandleLength.UniqueId);
             break;
         case XmlBinaryNodeType.GuidText:
             ReadValue(value, ValueHandleType.Guid, ValueHandleLength.Guid);
             break;
         case XmlBinaryNodeType.DecimalText:
             ReadValue(value, ValueHandleType.Decimal, ValueHandleLength.Decimal);
             break;
         case XmlBinaryNodeType.Int8Text:
             ReadValue(value, ValueHandleType.Int8, ValueHandleLength.Int8);
             break;
         case XmlBinaryNodeType.Int16Text:
             ReadValue(value, ValueHandleType.Int16, ValueHandleLength.Int16);
             break;
         case XmlBinaryNodeType.Int32Text:
             ReadValue(value, ValueHandleType.Int32, ValueHandleLength.Int32);
             break;
         case XmlBinaryNodeType.Int64Text:
             ReadValue(value, ValueHandleType.Int64, ValueHandleLength.Int64);
             break;
         case XmlBinaryNodeType.UInt64Text:
             ReadValue(value, ValueHandleType.UInt64, ValueHandleLength.UInt64);
             break;
         case XmlBinaryNodeType.FloatText:
             ReadValue(value, ValueHandleType.Single, ValueHandleLength.Single);
             break;
         case XmlBinaryNodeType.DoubleText:
             ReadValue(value, ValueHandleType.Double, ValueHandleLength.Double);
             break;
         case XmlBinaryNodeType.TimeSpanText:
             ReadValue(value, ValueHandleType.TimeSpan, ValueHandleLength.TimeSpan);
             break;
         case XmlBinaryNodeType.DateTimeText:
             ReadValue(value, ValueHandleType.DateTime, ValueHandleLength.DateTime);
             break;
         case XmlBinaryNodeType.StartListText:
             ReadList(value);
             break;
         case XmlBinaryNodeType.QNameDictionaryText:
             ReadQName(value);
             break;
         default:
             XmlExceptionHelper.ThrowInvalidBinaryFormat(reader);
             break;
     }
 }
コード例 #10
0
 private void ReadList(ValueHandle value)
 {
     XmlBinaryNodeType type;
     if (this.listValue == null)
     {
         this.listValue = new ValueHandle(this);
     }
     int length = 0;
     int offset = this.Offset;
 Label_001D:
     type = this.GetNodeType();
     this.SkipNodeType();
     if (type == XmlBinaryNodeType.StartListText)
     {
         XmlExceptionHelper.ThrowInvalidBinaryFormat(this.reader);
     }
     if (type != XmlBinaryNodeType.EndListText)
     {
         this.ReadValue(type, this.listValue);
         length++;
         goto Label_001D;
     }
     value.SetValue(ValueHandleType.List, offset, length);
 }
コード例 #11
0
        public void ReadValue(XmlBinaryNodeType nodeType, ValueHandle value)
        {
            switch (nodeType)
            {
                case XmlBinaryNodeType.MinText:
                    value.SetValue(ValueHandleType.Zero);
                    return;

                case XmlBinaryNodeType.OneText:
                    value.SetValue(ValueHandleType.One);
                    return;

                case XmlBinaryNodeType.FalseText:
                    value.SetValue(ValueHandleType.False);
                    return;

                case XmlBinaryNodeType.TrueText:
                    value.SetValue(ValueHandleType.True);
                    return;

                case XmlBinaryNodeType.Int8Text:
                    this.ReadValue(value, ValueHandleType.Int8, 1);
                    return;

                case XmlBinaryNodeType.Int16Text:
                    this.ReadValue(value, ValueHandleType.Int16, 2);
                    return;

                case XmlBinaryNodeType.Int32Text:
                    this.ReadValue(value, ValueHandleType.Int32, 4);
                    return;

                case XmlBinaryNodeType.Int64Text:
                    this.ReadValue(value, ValueHandleType.Int64, 8);
                    return;

                case XmlBinaryNodeType.FloatText:
                    this.ReadValue(value, ValueHandleType.Single, 4);
                    return;

                case XmlBinaryNodeType.DoubleText:
                    this.ReadValue(value, ValueHandleType.Double, 8);
                    return;

                case XmlBinaryNodeType.DecimalText:
                    this.ReadValue(value, ValueHandleType.Decimal, 0x10);
                    return;

                case XmlBinaryNodeType.DateTimeText:
                    this.ReadValue(value, ValueHandleType.DateTime, 8);
                    return;

                case XmlBinaryNodeType.Chars8Text:
                    this.ReadValue(value, ValueHandleType.UTF8, this.ReadUInt8());
                    return;

                case XmlBinaryNodeType.Chars16Text:
                    this.ReadValue(value, ValueHandleType.UTF8, this.ReadUInt16());
                    return;

                case XmlBinaryNodeType.Chars32Text:
                    this.ReadValue(value, ValueHandleType.UTF8, this.ReadUInt31());
                    return;

                case XmlBinaryNodeType.Bytes8Text:
                    this.ReadValue(value, ValueHandleType.Base64, this.ReadUInt8());
                    return;

                case XmlBinaryNodeType.Bytes16Text:
                    this.ReadValue(value, ValueHandleType.Base64, this.ReadUInt16());
                    return;

                case XmlBinaryNodeType.Bytes32Text:
                    this.ReadValue(value, ValueHandleType.Base64, this.ReadUInt31());
                    return;

                case XmlBinaryNodeType.StartListText:
                    this.ReadList(value);
                    return;

                case XmlBinaryNodeType.EmptyText:
                    value.SetValue(ValueHandleType.Empty);
                    return;

                case XmlBinaryNodeType.DictionaryText:
                    value.SetDictionaryValue(this.ReadDictionaryKey());
                    return;

                case XmlBinaryNodeType.UniqueIdText:
                    this.ReadValue(value, ValueHandleType.UniqueId, 0x10);
                    return;

                case XmlBinaryNodeType.TimeSpanText:
                    this.ReadValue(value, ValueHandleType.TimeSpan, 8);
                    return;

                case XmlBinaryNodeType.GuidText:
                    this.ReadValue(value, ValueHandleType.Guid, 0x10);
                    return;

                case XmlBinaryNodeType.UInt64Text:
                    this.ReadValue(value, ValueHandleType.UInt64, 8);
                    return;

                case XmlBinaryNodeType.BoolText:
                    value.SetValue((this.ReadUInt8() != 0) ? ValueHandleType.True : ValueHandleType.False);
                    return;

                case XmlBinaryNodeType.UnicodeChars8Text:
                    this.ReadUnicodeValue(value, this.ReadUInt8());
                    return;

                case XmlBinaryNodeType.UnicodeChars16Text:
                    this.ReadUnicodeValue(value, this.ReadUInt16());
                    return;

                case XmlBinaryNodeType.UnicodeChars32Text:
                    this.ReadUnicodeValue(value, this.ReadUInt31());
                    return;

                case XmlBinaryNodeType.QNameDictionaryText:
                    this.ReadQName(value);
                    return;
            }
            XmlExceptionHelper.ThrowInvalidBinaryFormat(this.reader);
        }
コード例 #12
0
        public void ReadValue(XmlBinaryNodeType nodeType, ValueHandle value)
        {
            switch (nodeType)
            {
            case XmlBinaryNodeType.MinText:
                value.SetValue(ValueHandleType.Zero);
                return;

            case XmlBinaryNodeType.OneText:
                value.SetValue(ValueHandleType.One);
                return;

            case XmlBinaryNodeType.FalseText:
                value.SetValue(ValueHandleType.False);
                return;

            case XmlBinaryNodeType.TrueText:
                value.SetValue(ValueHandleType.True);
                return;

            case XmlBinaryNodeType.Int8Text:
                this.ReadValue(value, ValueHandleType.Int8, 1);
                return;

            case XmlBinaryNodeType.Int16Text:
                this.ReadValue(value, ValueHandleType.Int16, 2);
                return;

            case XmlBinaryNodeType.Int32Text:
                this.ReadValue(value, ValueHandleType.Int32, 4);
                return;

            case XmlBinaryNodeType.Int64Text:
                this.ReadValue(value, ValueHandleType.Int64, 8);
                return;

            case XmlBinaryNodeType.FloatText:
                this.ReadValue(value, ValueHandleType.Single, 4);
                return;

            case XmlBinaryNodeType.DoubleText:
                this.ReadValue(value, ValueHandleType.Double, 8);
                return;

            case XmlBinaryNodeType.DecimalText:
                this.ReadValue(value, ValueHandleType.Decimal, 0x10);
                return;

            case XmlBinaryNodeType.DateTimeText:
                this.ReadValue(value, ValueHandleType.DateTime, 8);
                return;

            case XmlBinaryNodeType.Chars8Text:
                this.ReadValue(value, ValueHandleType.UTF8, this.ReadUInt8());
                return;

            case XmlBinaryNodeType.Chars16Text:
                this.ReadValue(value, ValueHandleType.UTF8, this.ReadUInt16());
                return;

            case XmlBinaryNodeType.Chars32Text:
                this.ReadValue(value, ValueHandleType.UTF8, this.ReadUInt31());
                return;

            case XmlBinaryNodeType.Bytes8Text:
                this.ReadValue(value, ValueHandleType.Base64, this.ReadUInt8());
                return;

            case XmlBinaryNodeType.Bytes16Text:
                this.ReadValue(value, ValueHandleType.Base64, this.ReadUInt16());
                return;

            case XmlBinaryNodeType.Bytes32Text:
                this.ReadValue(value, ValueHandleType.Base64, this.ReadUInt31());
                return;

            case XmlBinaryNodeType.StartListText:
                this.ReadList(value);
                return;

            case XmlBinaryNodeType.EmptyText:
                value.SetValue(ValueHandleType.Empty);
                return;

            case XmlBinaryNodeType.DictionaryText:
                value.SetDictionaryValue(this.ReadDictionaryKey());
                return;

            case XmlBinaryNodeType.UniqueIdText:
                this.ReadValue(value, ValueHandleType.UniqueId, 0x10);
                return;

            case XmlBinaryNodeType.TimeSpanText:
                this.ReadValue(value, ValueHandleType.TimeSpan, 8);
                return;

            case XmlBinaryNodeType.GuidText:
                this.ReadValue(value, ValueHandleType.Guid, 0x10);
                return;

            case XmlBinaryNodeType.UInt64Text:
                this.ReadValue(value, ValueHandleType.UInt64, 8);
                return;

            case XmlBinaryNodeType.BoolText:
                value.SetValue((this.ReadUInt8() != 0) ? ValueHandleType.True : ValueHandleType.False);
                return;

            case XmlBinaryNodeType.UnicodeChars8Text:
                this.ReadUnicodeValue(value, this.ReadUInt8());
                return;

            case XmlBinaryNodeType.UnicodeChars16Text:
                this.ReadUnicodeValue(value, this.ReadUInt16());
                return;

            case XmlBinaryNodeType.UnicodeChars32Text:
                this.ReadUnicodeValue(value, this.ReadUInt31());
                return;

            case XmlBinaryNodeType.QNameDictionaryText:
                this.ReadQName(value);
                return;
            }
            XmlExceptionHelper.ThrowInvalidBinaryFormat(this.reader);
        }