Exemple #1
0
        // Token: 0x06001EC5 RID: 7877 RVA: 0x00093A70 File Offset: 0x00091C70
        internal BamlRecord ReadNextRecord(BinaryReader bamlBinaryReader, long bytesAvailable, BamlRecordType recordType)
        {
            BamlRecord bamlRecord;

            switch (recordType)
            {
            case BamlRecordType.AssemblyInfo:
                bamlRecord = new BamlAssemblyInfoRecord();
                goto IL_A6;

            case BamlRecordType.TypeInfo:
                bamlRecord = new BamlTypeInfoRecord();
                goto IL_A6;

            case BamlRecordType.TypeSerializerInfo:
                bamlRecord = new BamlTypeInfoWithSerializerRecord();
                goto IL_A6;

            case BamlRecordType.AttributeInfo:
                bamlRecord = new BamlAttributeInfoRecord();
                goto IL_A6;

            case BamlRecordType.StringInfo:
                bamlRecord = new BamlStringInfoRecord();
                goto IL_A6;

            case BamlRecordType.DefAttributeKeyString:
                bamlRecord = new BamlDefAttributeKeyStringRecord();
                goto IL_A6;

            case BamlRecordType.DefAttributeKeyType:
                bamlRecord = new BamlDefAttributeKeyTypeRecord();
                goto IL_A6;

            case BamlRecordType.KeyElementStart:
                bamlRecord = new BamlKeyElementStartRecord();
                goto IL_A6;
            }
            bamlRecord = this._readCache[(int)recordType];
            if (bamlRecord == null || bamlRecord.IsPinned)
            {
                bamlRecord = (this._readCache[(int)recordType] = this.AllocateRecord(recordType));
            }
IL_A6:
            bamlRecord.Next = null;
            if (bamlRecord != null)
            {
                if (bamlRecord.LoadRecordSize(bamlBinaryReader, bytesAvailable) && bytesAvailable >= (long)bamlRecord.RecordSize)
                {
                    bamlRecord.LoadRecordData(bamlBinaryReader);
                }
                else
                {
                    bamlRecord = null;
                }
            }
            return(bamlRecord);
        }
Exemple #2
0
        // Token: 0x06001F21 RID: 7969 RVA: 0x000945C4 File Offset: 0x000927C4
        internal override void Copy(BamlRecord record)
        {
            base.Copy(record);
            BamlDefAttributeKeyTypeRecord bamlDefAttributeKeyTypeRecord = (BamlDefAttributeKeyTypeRecord)record;

            bamlDefAttributeKeyTypeRecord._valuePosition         = this._valuePosition;
            bamlDefAttributeKeyTypeRecord._valuePositionPosition = this._valuePositionPosition;
            bamlDefAttributeKeyTypeRecord._keyObject             = this._keyObject;
            bamlDefAttributeKeyTypeRecord._staticResourceValues  = this._staticResourceValues;
        }
        // Read a x:Key="{x:Type Foo}" record.  If foo has been resolved at compile or parse
        // time into a type represented by a TypeId in the baml record.  This is done for
        // more efficient key assignments in a dictionary. 
        //
        protected virtual void ReadDefAttributeKeyTypeRecord( 
            BamlDefAttributeKeyTypeRecord bamlDefAttributeRecord) 
        {
            // Get the actual type from the TypeId 
            Type keyType = MapTable.GetTypeFromId(bamlDefAttributeRecord.TypeId);

            if (keyType == null)
            { 
                ThrowException(SRID.ParserNoResource, XamlReaderHelper.DefinitionName);
            } 
 
            SetKeyOnContext(keyType, XamlReaderHelper.DefinitionName, CurrentContext, ParentContext);
        }