// Token: 0x06001F82 RID: 8066 RVA: 0x00094CFC File Offset: 0x00092EFC
        internal override void Copy(BamlRecord record)
        {
            base.Copy(record);
            BamlPropertyRecord bamlPropertyRecord = (BamlPropertyRecord)record;

            bamlPropertyRecord._attributeId = this._attributeId;
        }
Пример #2
0
        // Token: 0x0600237C RID: 9084 RVA: 0x000AD4B8 File Offset: 0x000AB6B8
        internal override object GetDictionaryKey(BamlRecord startRecord, ParserContext parserContext)
        {
            object     obj        = null;
            int        num        = 0;
            BamlRecord bamlRecord = startRecord;
            short      num2       = 0;

            while (bamlRecord != null)
            {
                if (bamlRecord.RecordType == BamlRecordType.ElementStart)
                {
                    BamlElementStartRecord bamlElementStartRecord = bamlRecord as BamlElementStartRecord;
                    if (++num != 1)
                    {
                        break;
                    }
                    num2 = bamlElementStartRecord.TypeId;
                }
                else if (bamlRecord.RecordType == BamlRecordType.Property && num == 1)
                {
                    BamlPropertyRecord bamlPropertyRecord = bamlRecord as BamlPropertyRecord;
                    short              num3;
                    string             a;
                    BamlAttributeUsage bamlAttributeUsage;
                    parserContext.MapTable.GetAttributeInfoFromId(bamlPropertyRecord.AttributeId, out num3, out a, out bamlAttributeUsage);
                    if (num3 == num2)
                    {
                        if (a == "TargetType")
                        {
                            obj = parserContext.XamlTypeMapper.GetDictionaryKey(bamlPropertyRecord.Value, parserContext);
                        }
                        else if (a == "DataType")
                        {
                            object    dictionaryKey = parserContext.XamlTypeMapper.GetDictionaryKey(bamlPropertyRecord.Value, parserContext);
                            Exception ex            = TemplateKey.ValidateDataType(dictionaryKey, null);
                            if (ex != null)
                            {
                                this.ThrowException("TemplateBadDictionaryKey", parserContext.LineNumber, parserContext.LinePosition, ex);
                            }
                            obj = new DataTemplateKey(dictionaryKey);
                        }
                    }
                }
                else if (bamlRecord.RecordType == BamlRecordType.PropertyComplexStart || bamlRecord.RecordType == BamlRecordType.PropertyIListStart || bamlRecord.RecordType == BamlRecordType.ElementEnd)
                {
                    break;
                }
                bamlRecord = bamlRecord.Next;
            }
            if (obj == null)
            {
                this.ThrowException("StyleNoDictionaryKey", parserContext.LineNumber, parserContext.LinePosition, null);
            }
            return(obj);
        }
Пример #3
0
        // Token: 0x06002379 RID: 9081 RVA: 0x000AD358 File Offset: 0x000AB558
        internal override object GetDictionaryKey(BamlRecord startRecord, ParserContext parserContext)
        {
            Type       result      = Style.DefaultTargetType;
            bool       flag        = false;
            object     obj         = null;
            int        num         = 0;
            BamlRecord bamlRecord  = startRecord;
            short      ownerTypeId = 0;

            while (bamlRecord != null)
            {
                if (bamlRecord.RecordType == BamlRecordType.ElementStart)
                {
                    BamlElementStartRecord bamlElementStartRecord = bamlRecord as BamlElementStartRecord;
                    if (++num == 1)
                    {
                        ownerTypeId = bamlElementStartRecord.TypeId;
                    }
                    else if (num == 2)
                    {
                        result = parserContext.MapTable.GetTypeFromId(bamlElementStartRecord.TypeId);
                        flag   = true;
                        break;
                    }
                }
                else if (bamlRecord.RecordType == BamlRecordType.Property && num == 1)
                {
                    BamlPropertyRecord bamlPropertyRecord = bamlRecord as BamlPropertyRecord;
                    if (parserContext.MapTable.DoesAttributeMatch(bamlPropertyRecord.AttributeId, ownerTypeId, "TargetType"))
                    {
                        obj = parserContext.XamlTypeMapper.GetDictionaryKey(bamlPropertyRecord.Value, parserContext);
                    }
                }
                else if (bamlRecord.RecordType == BamlRecordType.PropertyComplexStart || bamlRecord.RecordType == BamlRecordType.PropertyIListStart)
                {
                    break;
                }
                bamlRecord = bamlRecord.Next;
            }
            if (obj == null)
            {
                if (!flag)
                {
                    this.ThrowException("StyleNoDictionaryKey", parserContext.LineNumber, parserContext.LinePosition);
                }
                return(result);
            }
            return(obj);
        }
Пример #4
0
        // Read a Property record, get the current element off the context stack and convert 
        // the string value of the property into a real object.  Then use the element's SetValue 
        // method to set the value for this DependencyProperty, or the PropertyInfo's SetValue
        // method if there is no DependencyProperty. 
        protected virtual void ReadPropertyRecord(BamlPropertyRecord bamlPropertyRecord)
        {
            if (null == CurrentContext ||
                (ReaderFlags.DependencyObject != CurrentContext.ContextType && 
                 ReaderFlags.ClrObject != CurrentContext.ContextType))
            { 
                ThrowException(SRID.ParserUnexpInBAML, "Property"); 
            }
 
            ReadPropertyRecordBase(bamlPropertyRecord.Value, bamlPropertyRecord.AttributeId, 0);
        }