Esempio n. 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);
        }
Esempio n. 2
0
        // Read the start of an element that is the first
        // object in a key in a resource dictionary. 
        internal virtual void ReadKeyElementStartRecord( 
            BamlKeyElementStartRecord bamlElementRecord)
        { 
            Type elementType = MapTable.GetTypeFromId(bamlElementRecord.TypeId);

            ReaderFlags flags  = (elementType.IsAssignableFrom(typeof(DependencyObject)) ?
                                               ReaderFlags.DependencyObject : 
                                               ReaderFlags.ClrObject) |
                                               ReaderFlags.NeedToAddToTree; 
 
            // Remember the object that was just created.  It will be used when
            // the end tag is reached and the key is complete 
            PushContext(flags, null, elementType, bamlElementRecord.TypeId);
        }