예제 #1
0
 /// <summary>
 ///   Convert from Baml read by a baml reader into an object tree.
 ///   The context gives mapping information.  Return the number of
 ///   baml records processed.
 /// </summary>
 //CASRemoval:[StrongNameIdentityPermission(SecurityAction.InheritanceDemand, PublicKey = Microsoft.Internal.BuildInfo.WCP_PUBLIC_KEY_STRING)]
 internal virtual void ConvertBamlToObject(
     BamlRecordReader reader,          // Current reader that is processing records
     BamlRecord bamlRecord,            // Record read in that triggered serializer
     ParserContext context)            // Context
 {
     throw new InvalidOperationException(SR.Get(SRID.InvalidDeSerialize));
 }
예제 #2
0
 /// <summary>
 ///   Convert from Xaml read by a token reader into a live
 ///   object tree.  The context gives mapping information.
 /// </summary>
 //CASRemoval:[StrongNameIdentityPermission(SecurityAction.InheritanceDemand, PublicKey = Microsoft.Internal.BuildInfo.WCP_PUBLIC_KEY_STRING)]
 internal virtual void ConvertXamlToObject(
     XamlReaderHelper tokenReader,
     ReadWriteStreamManager streamManager,
     ParserContext context,
     XamlNode xamlNode,
     BamlRecordReader reader)
 {
     throw new InvalidOperationException(SR.Get(SRID.InvalidDeSerialize));
 }
예제 #3
0
 /// <summary>
 ///   Convert from Xaml read by a token reader into a live
 ///   object tree.  The context gives mapping information.
 /// </summary>
 //CASRemoval:[StrongNameIdentityPermission(SecurityAction.InheritanceDemand, PublicKey = Microsoft.Internal.BuildInfo.WCP_PUBLIC_KEY_STRING)]
 internal virtual void ConvertXamlToObject (
     XamlReaderHelper             tokenReader,
     ReadWriteStreamManager streamManager,
     ParserContext          context,
     XamlNode               xamlNode,
     BamlRecordReader       reader)
 {
     throw new InvalidOperationException(SR.Get(SRID.InvalidDeSerialize));
 }
예제 #4
0
 // Token: 0x06001E81 RID: 7809 RVA: 0x00091920 File Offset: 0x0008FB20
 public WpfPropertyDefinition(BamlRecordReader reader, short attributeId, bool targetIsDependencyObject)
 {
     this._reader             = reader;
     this._attributeId        = attributeId;
     this._dependencyProperty = null;
     this._attributeInfo      = null;
     if (this._reader.MapTable != null && targetIsDependencyObject)
     {
         this._dependencyProperty = this._reader.MapTable.GetDependencyProperty((int)this._attributeId);
     }
 }
 // Token: 0x06001D12 RID: 7442 RVA: 0x000879F8 File Offset: 0x00085BF8
 internal BamlCollectionHolder(BamlRecordReader reader, object parent, short attributeId, bool needDefault)
 {
     this._reader      = reader;
     this._parent      = parent;
     this._propDef     = new WpfPropertyDefinition(reader, attributeId, parent is DependencyObject);
     this._attributeId = attributeId;
     if (needDefault)
     {
         this.InitDefaultValue();
     }
     this.CheckReadOnly();
 }
예제 #6
0
        // Token: 0x06001FAC RID: 8108 RVA: 0x000953F8 File Offset: 0x000935F8
        internal object GetCustomValue(BinaryReader reader, Type propertyType, short serializerId, BamlRecordReader bamlRecordReader)
        {
            if (serializerId != 46)
            {
                if (serializerId != 195)
                {
                    switch (serializerId)
                    {
                    case 744:
                        this._valueObject = SolidColorBrush.DeserializeFrom(reader, bamlRecordReader.TypeConvertContext);
                        goto IL_11D;

                    case 745:
                        this._valueObject = XamlInt32CollectionSerializer.StaticConvertCustomBinaryToObject(reader);
                        goto IL_11D;

                    case 746:
                        this._valueObject = XamlPathDataSerializer.StaticConvertCustomBinaryToObject(reader);
                        goto IL_11D;

                    case 747:
                        this._valueObject = XamlPoint3DCollectionSerializer.StaticConvertCustomBinaryToObject(reader);
                        goto IL_11D;

                    case 748:
                        this._valueObject = XamlPointCollectionSerializer.StaticConvertCustomBinaryToObject(reader);
                        goto IL_11D;

                    case 752:
                        this._valueObject = XamlVector3DCollectionSerializer.StaticConvertCustomBinaryToObject(reader);
                        goto IL_11D;
                    }
                    return(null);
                }
                uint num;
                if (this._valueObject == null)
                {
                    num = reader.ReadUInt32();
                }
                else
                {
                    num = (uint)this._valueObject;
                }
                if (propertyType.IsEnum)
                {
                    this._valueObject      = Enum.ToObject(propertyType, num);
                    this.ValueObjectSet    = true;
                    this.IsRawEnumValueSet = false;
                }
                else
                {
                    this._valueObject      = num;
                    this.ValueObjectSet    = false;
                    this.IsRawEnumValueSet = true;
                }
                return(this._valueObject);
            }
            else
            {
                byte b = reader.ReadByte();
                this._valueObject = (b == 1);
            }
IL_11D:
            this.ValueObjectSet = true;
            return(this._valueObject);
        }
 // Token: 0x06001D11 RID: 7441 RVA: 0x000879EB File Offset: 0x00085BEB
 internal BamlCollectionHolder(BamlRecordReader reader, object parent, short attributeId) : this(reader, parent, attributeId, true)
 {
 }
예제 #8
0
 /// <summary>
 ///   Convert from Baml read by a baml reader into an object tree.
 ///   The context gives mapping information.  Return the number of
 ///   baml records processed.
 /// </summary>
 //CASRemoval:[StrongNameIdentityPermission(SecurityAction.InheritanceDemand, PublicKey = Microsoft.Internal.BuildInfo.WCP_PUBLIC_KEY_STRING)]
 internal virtual void ConvertBamlToObject (
     BamlRecordReader    reader,       // Current reader that is processing records
     BamlRecord          bamlRecord,   // Record read in that triggered serializer
     ParserContext       context)      // Context
 {
     throw new InvalidOperationException(SR.Get(SRID.InvalidDeSerialize));
 }
 // Token: 0x06002336 RID: 9014 RVA: 0x000ACD32 File Offset: 0x000AAF32
 internal virtual void ConvertBamlToObject(BamlRecordReader reader, BamlRecord bamlRecord, ParserContext context)
 {
     throw new InvalidOperationException(SR.Get("InvalidDeSerialize"));
 }
예제 #10
0
        // Read the binary data using the passed reader and use that to set the ValueObject.
        internal object GetCustomValue(BinaryReader reader, Type propertyType, short serializerId, BamlRecordReader bamlRecordReader)
        {
            Debug.Assert(!ValueObjectSet);

            // Handle enums and bools here directly.
            // Otherwise call the known custom serializers directly.
            switch (serializerId)
            {
                case (short)KnownElements.EnumConverter:

                    uint enumBits;
                    if (_valueObject == null)
                    {
                        // if no raw value has been read in yet, read it now
                        // from the baml stream.
                        enumBits = reader.ReadUInt32();
                    }
                    else
                    {
                        // raw value has been read in earlier, so try to resolve into
                        // an actual enum value now.
                        enumBits = (uint)_valueObject;
                    }

                    if (propertyType.IsEnum)
                    {
                        // property Type is an enum, so raw value can be resolved now.
                        _valueObject = Enum.ToObject(propertyType, enumBits);
                        ValueObjectSet = true;
                        IsRawEnumValueSet = false;
                    }
                    else
                    {
                        // property Type is not available yet, so raw value cannot
                        // be resolved now. Store it and try later.
                        _valueObject = enumBits;
                        ValueObjectSet = false;
                        IsRawEnumValueSet = true;
                    }

                    return _valueObject;

                case (short)KnownElements.BooleanConverter:
                    
                    byte boolByte = reader.ReadByte();
                    _valueObject = boolByte == 1;
                    break;

                case (short)KnownElements.XamlBrushSerializer:

                    // Don't bother creating a XamlBrushSerializer instance & calling ConvertCustomBinaryToObject
                    // on it since that just calls SCB directly liek below. This saves big on perf.
                    _valueObject = SolidColorBrush.DeserializeFrom(reader, bamlRecordReader.TypeConvertContext);
                    break;

                case (short)KnownElements.XamlPathDataSerializer:

                    _valueObject = XamlPathDataSerializer.StaticConvertCustomBinaryToObject(reader);
                    break;

                case (short)KnownElements.XamlPoint3DCollectionSerializer:

                    _valueObject = XamlPoint3DCollectionSerializer.StaticConvertCustomBinaryToObject(reader);
                    break;

                case (short)KnownElements.XamlVector3DCollectionSerializer:

                    _valueObject = XamlVector3DCollectionSerializer.StaticConvertCustomBinaryToObject(reader);
                    break;

                case (short)KnownElements.XamlPointCollectionSerializer:

                    _valueObject = XamlPointCollectionSerializer.StaticConvertCustomBinaryToObject(reader);
                    break;

                case (short)KnownElements.XamlInt32CollectionSerializer:

                    _valueObject = XamlInt32CollectionSerializer.StaticConvertCustomBinaryToObject(reader); 
                    break;

                default:
                    Debug.Assert (false, "Unknown custom serializer");
                    return null;
            }

            ValueObjectSet = true;
            return _valueObject;
        }