Exemplo n.º 1
0
        private short AddProperty(BamlPropertyInfo property)
        {
            short propertyId = (short)_propertyToID.Count;

            _propertyToID.Add(property, propertyId);

            return(propertyId);
        }
Exemplo n.º 2
0
        private void WritePropertyInfo(BamlPropertyInfo node)
        {
            BeginVarSize();

            short propertyId = AddProperty(node);

            _blob.Write(ref _pos, (short)propertyId);
            _blob.Write(ref _pos, (short)GetTypeId(node.Type));
            _blob.Write(ref _pos, (byte)node.Usage);
            _blob.WriteLengthPrefixedString(ref _pos, (string)node.Name);

            WriteVarSize(RecordType.AttributeInfo);
        }
Exemplo n.º 3
0
        private void AddProperty(short propertyId, BamlPropertyInfo property)
        {
            int propertyCount = _properties.Count;

            if (propertyId > propertyCount)
            {
                throw new BamlException(SR.BamlLoadError);
            }

            if (propertyId == propertyCount)
            {
                _properties.Add(property);
            }
        }
Exemplo n.º 4
0
        private void ReadAttributeInfo()
        {
            ReadRecordSize();

            var node = new BamlPropertyInfo();

            short attributeId = _accessor.ReadInt16();

            node.Type  = GetType(_accessor.ReadInt16());
            node.Usage = (BamlPropertyUsage)_accessor.ReadByte();
            node.Name  = _accessor.ReadLengthPrefixedString(Encoding.UTF8);

            AddProperty(attributeId, node);
            AddNode(node);
        }