internal static object DeserializeFrom(BinaryReader reader, ITypeDescriptorContext context) { SerializationBrushType brushType = (SerializationBrushType)reader.ReadByte(); if (brushType == SerializationBrushType.KnownSolidColor) { uint knownColorUint = reader.ReadUInt32(); SolidColorBrush scp = KnownColors.SolidColorBrushFromUint(knownColorUint); #if !PBTCOMPILER lock (s_knownSolidColorBrushStringCache) { if (!s_knownSolidColorBrushStringCache.ContainsKey(scp)) { string strColor = scp.Color.ConvertToString(null, System.Windows.Markup.TypeConverterHelper.InvariantEnglishUS); s_knownSolidColorBrushStringCache[scp] = strColor; } } #endif return(scp); } else if (brushType == SerializationBrushType.OtherColor) { string colorValue = reader.ReadString(); BrushConverter converter = new BrushConverter(); return(converter.ConvertFromInvariantString(context, colorValue)); } else { throw new Exception(SR.Get(SRID.BrushUnknownBamlType)); } }
internal static object DeserializeFrom(BinaryReader reader, ITypeDescriptorContext context) { SerializationBrushType brushType = (SerializationBrushType)reader.ReadByte(); if (brushType == SerializationBrushType.KnownSolidColor) { uint knownColorUint = reader.ReadUInt32(); return(KnownColors.SolidColorBrushFromUint(knownColorUint)); } else if (brushType == SerializationBrushType.OtherColor) { string colorValue = reader.ReadString(); BrushConverter converter = new BrushConverter(); return(converter.ConvertFromInvariantString(context, colorValue)); } else { throw new Exception(SR.Get(SRID.BrushUnknownBamlType)); } }