示例#1
0
        private void WriteTypeSerializerInfo(BamlTypeSerializerInfo node)
        {
            BeginVarSize();

            short typeId = AddType(node);

            _blob.Write(ref _pos, (short)typeId);
            _blob.Write(ref _pos, (short)((ushort)GetAssemblyId(node.Assembly) | ((byte)node.Flags) << 12));
            _blob.WriteLengthPrefixedString(ref _pos, (string)node.Name);
            _blob.Write(ref _pos, (short)GetTypeId(node.SerializerType));

            WriteVarSize(RecordType.TypeSerializerInfo);
        }
示例#2
0
        private void ReadTypeSerializerInfo()
        {
            ReadRecordSize();

            var   node               = new BamlTypeSerializerInfo();
            short typeId             = _accessor.ReadInt16();
            short flagsAndAssemblyId = _accessor.ReadInt16();

            node.Flags          = (BamlTypeFlags)(flagsAndAssemblyId >> 12);
            node.Assembly       = GetAssembly((short)(flagsAndAssemblyId & 0xfff));
            node.Name           = _accessor.ReadLengthPrefixedString(Encoding.UTF8);
            node.SerializerType = GetType(_accessor.ReadInt16());

            AddType(typeId, node);
            AddNode(node);
        }