private IProtoSerializer BuildSerializer() { int opaqueToken = 0; try { model.TakeLock(ref opaqueToken);// check nobody is still adding this type var member = backingMember ?? originalMember; IProtoSerializer ser; if (IsMap) { Type dictionaryType, keyType, valueType; ResolveMapTypes(out dictionaryType, out keyType, out valueType); if (dictionaryType == null) { throw new InvalidOperationException("Unable to resolve map type for type: " + memberType.FullName); } var concreteType = defaultType; if (concreteType == null && Helpers.IsClass(memberType)) { concreteType = memberType; } WireType keyWireType; var keySer = TryGetCoreSerializer(model, MapKeyFormat, keyType, out keyWireType, false, false, false, false); if (!AsReference) { AsReference = MetaType.GetAsReferenceDefault(model, valueType); } WireType valueWireType; var valueSer = TryGetCoreSerializer(model, MapValueFormat, valueType, out valueWireType, AsReference, DynamicType, false, true); var ctors = typeof(MapDecorator <, ,>).MakeGenericType(new Type[] { dictionaryType, keyType, valueType }).GetConstructors( BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); if (ctors.Length != 1) { throw new InvalidOperationException("Unable to resolve MapDecorator constructor"); } ser = (IProtoSerializer)ctors[0].Invoke(new object[] { model, concreteType, keySer, valueSer, fieldNumber, DataFormat == DataFormat.Group ? WireType.StartGroup : WireType.String, keyWireType, valueWireType, OverwriteList }); } else { WireType wireType; Type finalType = itemType == null ? memberType : itemType; ser = TryGetCoreSerializer(model, dataFormat, finalType, out wireType, AsReference, DynamicType, OverwriteList, true); if (ser == null) { throw new InvalidOperationException("No serializer defined for type: " + finalType.FullName); } // apply tags if (itemType != null && SupportNull) { if (IsPacked) { throw new NotSupportedException("Packed encodings cannot support null values"); } ser = new TagDecorator(NullDecorator.Tag, wireType, IsStrict, ser); ser = new NullDecorator(model, ser); ser = new TagDecorator(fieldNumber, WireType.StartGroup, false, ser); } else { ser = new TagDecorator(fieldNumber, wireType, IsStrict, ser); } // apply lists if appropriate if (itemType != null) { #if NO_GENERICS Type underlyingItemType = itemType; #else Type underlyingItemType = SupportNull ? itemType : Helpers.GetUnderlyingType(itemType) ?? itemType; #endif Helpers.DebugAssert(underlyingItemType == ser.ExpectedType || (ser.ExpectedType == model.MapType(typeof(object)) && !Helpers.IsValueType(underlyingItemType)) , "Wrong type in the tail; expected {0}, received {1}", ser.ExpectedType, underlyingItemType); if (memberType.IsArray) { ser = new ArrayDecorator(model, ser, fieldNumber, IsPacked, wireType, memberType, OverwriteList, SupportNull); } else { ser = ListDecorator.Create(model, memberType, defaultType, ser, fieldNumber, IsPacked, wireType, member != null && PropertyDecorator.CanWrite(model, member), OverwriteList, SupportNull); } } else if (defaultValue != null && !IsRequired && getSpecified == null) { // note: "ShouldSerialize*" / "*Specified" / etc ^^^^ take precedence over defaultValue, // as does "IsRequired" ser = new DefaultValueDecorator(model, defaultValue, ser); } if (memberType == model.MapType(typeof(Uri))) { ser = new UriDecorator(model, ser); } #if PORTABLE else if (memberType.FullName == typeof(Uri).FullName) { // In PCLs, the Uri type may not match (WinRT uses Internal/Uri, .Net uses System/Uri) ser = new ReflectedUriDecorator(memberType, model, ser); } #endif } if (member != null) { PropertyInfo prop = member as PropertyInfo; if (prop != null) { ser = new PropertyDecorator(model, parentType, (PropertyInfo)member, ser); } else { FieldInfo fld = member as FieldInfo; if (fld != null) { ser = new FieldDecorator(parentType, (FieldInfo)member, ser); } else { throw new InvalidOperationException(); } } if (getSpecified != null || setSpecified != null) { ser = new MemberSpecifiedDecorator(getSpecified, setSpecified, ser); } } return(ser); } finally { model.ReleaseLock(opaqueToken); } }
private IProtoSerializer BuildSerializer() { IProtoSerializer serializer2; int opaqueToken = 0; try { WireType type; this.model.TakeLock(ref opaqueToken); Type type2 = (this.itemType == null) ? this.memberType : this.itemType; IProtoSerializer tail = TryGetCoreSerializer(this.model, this.dataFormat, type2, out type, this.asReference, this.dynamicType, this.OverwriteList, true); if (tail == null) { throw new InvalidOperationException("No serializer defined for type: " + type2.FullName); } if ((this.itemType != null) && this.SupportNull) { if (this.IsPacked) { throw new NotSupportedException("Packed encodings cannot support null values"); } tail = new TagDecorator(1, type, this.IsStrict, tail); tail = new NullDecorator(this.model, tail); tail = new TagDecorator(this.fieldNumber, WireType.StartGroup, false, tail); } else { tail = new TagDecorator(this.fieldNumber, type, this.IsStrict, tail); } if (this.itemType != null) { if (!this.SupportNull) { Helpers.GetUnderlyingType(this.itemType); } if (this.memberType.IsArray) { tail = new ArrayDecorator(this.model, tail, this.fieldNumber, this.IsPacked, type, this.memberType, this.OverwriteList, this.SupportNull); } else { tail = new ListDecorator(this.model, this.memberType, this.defaultType, tail, this.fieldNumber, this.IsPacked, type, (this.member != null) && PropertyDecorator.CanWrite(this.model, this.member), this.OverwriteList, this.SupportNull); } } else if (((this.defaultValue != null) && !this.IsRequired) && (this.getSpecified == null)) { tail = new DefaultValueDecorator(this.model, this.defaultValue, tail); } if (this.memberType == this.model.MapType(typeof(Uri))) { tail = new UriDecorator(this.model, tail); } if (this.member != null) { PropertyInfo member = this.member as PropertyInfo; if (member != null) { tail = new PropertyDecorator(this.model, this.parentType, (PropertyInfo)this.member, tail); } else { FieldInfo info2 = this.member as FieldInfo; if (info2 == null) { throw new InvalidOperationException(); } tail = new FieldDecorator(this.parentType, (FieldInfo)this.member, tail); } if ((this.getSpecified != null) || (this.setSpecified != null)) { tail = new MemberSpecifiedDecorator(this.getSpecified, this.setSpecified, tail); } } serializer2 = tail; } finally { this.model.ReleaseLock(opaqueToken); } return(serializer2); }
private IProtoSerializer BuildSerializer() { int opaqueToken = 0; try { model.TakeLock(ref opaqueToken);// check nobody is still adding this type WireType wireType; Type finalType = itemType == null ? memberType : itemType; IProtoSerializer ser = TryGetCoreSerializer(model, dataFormat, finalType, out wireType, asReference, dynamicType, OverwriteList, true); if (ser == null) { throw new InvalidOperationException("No serializer defined for type: " + finalType.FullName); } // apply tags if (itemType != null && SupportNull) { if (IsPacked) { throw new NotSupportedException("Packed encodings cannot support null values"); } ser = new TagDecorator(NullDecorator.Tag, wireType, IsStrict, ser); ser = new NullDecorator(model, ser); ser = new TagDecorator(fieldNumber, WireType.StartGroup, false, ser); } else { ser = new TagDecorator(fieldNumber, wireType, IsStrict, ser); } // apply lists if appropriate if (itemType != null) { #if NO_GENERICS Type underlyingItemType = itemType; #else Type underlyingItemType = SupportNull ? itemType : Helpers.GetUnderlyingType(itemType) ?? itemType; #endif Helpers.DebugAssert(underlyingItemType == ser.ExpectedType, "Wrong type in the tail; expected {0}, received {1}", ser.ExpectedType, underlyingItemType); if (memberType.IsArray) { ser = new ArrayDecorator(model, ser, fieldNumber, IsPacked, wireType, memberType, OverwriteList, SupportNull); } else { ser = new ListDecorator(model, memberType, defaultType, ser, fieldNumber, IsPacked, wireType, member != null && PropertyDecorator.CanWrite(model, member), OverwriteList, SupportNull); } } else if (defaultValue != null && !IsRequired && getSpecified == null) { // note: "ShouldSerialize*" / "*Specified" / etc ^^^^ take precedence over defaultValue, // as does "IsRequired" ser = new DefaultValueDecorator(model, defaultValue, ser); } if (memberType == model.MapType(typeof(Uri))) { ser = new UriDecorator(model, ser); } if (member != null) { PropertyInfo prop = member as PropertyInfo; if (prop != null) { ser = new PropertyDecorator(model, parentType, (PropertyInfo)member, ser); } else { FieldInfo fld = member as FieldInfo; if (fld != null) { ser = new FieldDecorator(parentType, (FieldInfo)member, ser); } else { throw new InvalidOperationException(); } } if (getSpecified != null || setSpecified != null) { ser = new MemberSpecifiedDecorator(getSpecified, setSpecified, ser); } } return(ser); } finally { model.ReleaseLock(opaqueToken); } }
// Token: 0x0600040A RID: 1034 RVA: 0x00015168 File Offset: 0x00013368 private IProtoSerializer BuildSerializer() { int opaqueToken = 0; IProtoSerializer result; try { this.model.TakeLock(ref opaqueToken); Type type = (this.itemType == null) ? this.memberType : this.itemType; WireType wireType; IProtoSerializer protoSerializer = ValueMember.TryGetCoreSerializer(this.model, this.dataFormat, type, out wireType, this.asReference, this.dynamicType, this.OverwriteList, true); if (protoSerializer == null) { throw new InvalidOperationException("No serializer defined for type: " + type.FullName); } if (this.itemType != null && this.SupportNull) { if (this.IsPacked) { throw new NotSupportedException("Packed encodings cannot support null values"); } protoSerializer = new TagDecorator(1, wireType, this.IsStrict, protoSerializer); protoSerializer = new NullDecorator(this.model, protoSerializer); protoSerializer = new TagDecorator(this.fieldNumber, WireType.StartGroup, false, protoSerializer); } else { protoSerializer = new TagDecorator(this.fieldNumber, wireType, this.IsStrict, protoSerializer); } if (this.itemType != null) { if (!this.SupportNull) { if (Helpers.GetUnderlyingType(this.itemType) == null) { Type type2 = this.itemType; } } else { Type type3 = this.itemType; } if (this.memberType.IsArray) { protoSerializer = new ArrayDecorator(this.model, protoSerializer, this.fieldNumber, this.IsPacked, wireType, this.memberType, this.OverwriteList, this.SupportNull); } else { protoSerializer = ListDecorator.Create(this.model, this.memberType, this.defaultType, protoSerializer, this.fieldNumber, this.IsPacked, wireType, this.member != null && PropertyDecorator.CanWrite(this.model, this.member), this.OverwriteList, this.SupportNull); } } else if (this.defaultValue != null && !this.IsRequired && this.getSpecified == null) { protoSerializer = new DefaultValueDecorator(this.model, this.defaultValue, protoSerializer); } if (this.memberType == this.model.MapType(typeof(Uri))) { protoSerializer = new UriDecorator(this.model, protoSerializer); } if (this.member != null) { if (this.member is PropertyInfo) { protoSerializer = new PropertyDecorator(this.model, this.parentType, (PropertyInfo)this.member, protoSerializer); } else { if (!(this.member is FieldInfo)) { throw new InvalidOperationException(); } protoSerializer = new FieldDecorator(this.parentType, (FieldInfo)this.member, protoSerializer); } if (this.getSpecified != null || this.setSpecified != null) { protoSerializer = new MemberSpecifiedDecorator(this.getSpecified, this.setSpecified, protoSerializer); } } result = protoSerializer; } finally { this.model.ReleaseLock(opaqueToken); } return(result); }
public void PaintWorld(WorldLayer layer) { var players = Hud.Game.Players.Where(player => !player.IsMe && player.CoordinateKnown && (player.HeadStone == null)); foreach (var player in players) { if (player == null) { continue; } var ScreenWidth = Hud.Window.Size.Width; var ScreenHeight = Hud.Window.Size.Height; var HeroTexture = Hud.Texture.GetTexture(890155253); var HPbarWidth = (float)(ScreenWidth / 13); var HPbarHeight = (float)(ScreenHeight / 130); var ResbarWidth = (float)(ScreenWidth / 13); var ResbarHeight = (float)(ScreenHeight / 200); var CurRes = 0f; var CurRes2 = 0f; var ScreenCoordinate = player.FloorCoordinate.ToScreenCoordinate(); var PlayerX = ScreenCoordinate.X; var PlayerY = ScreenCoordinate.Y; if (HPbar == true) { var CurHealth = player.Defense.HealthCur / player.Defense.HealthMax; BorderBrush.DrawRectangle(PlayerX - (float)HPbarWidth / 2, PlayerY - (float)(ScreenHeight / 16) / 2, HPbarWidth, HPbarHeight); BackgroundBrush.DrawRectangle(PlayerX - (float)HPbarWidth / 2, PlayerY - (float)(ScreenHeight / 16) / 2, HPbarWidth, HPbarHeight); HPbarBrush.DrawRectangle(PlayerX - (float)HPbarWidth / 2, PlayerY - (float)(ScreenHeight / 16) / 2, HPbarWidth * CurHealth, HPbarHeight); } if (player.HeroClassDefinition.HeroClass.ToString() == "Barbarian") { if (Resbar == true) { CurRes = player.Stats.ResourceCurFury / player.Stats.ResourceMaxFury; BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth, ResbarHeight); FuryBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth * CurRes, ResbarHeight); } if (player.HeroIsMale) { HeroTexture = Hud.Texture.GetTexture(3921484788); // male/female can't be determined, let's keep it for later... } else { HeroTexture = Hud.Texture.GetTexture(1030273087); } } else if (player.HeroClassDefinition.HeroClass.ToString() == "Crusader") { if (Resbar == true) { CurRes = player.Stats.ResourceCurWrath / player.Stats.ResourceMaxWrath; BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth, ResbarHeight); WrathBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth * CurRes, ResbarHeight); } if (player.HeroIsMale) { HeroTexture = Hud.Texture.GetTexture(3742271755); } else { HeroTexture = Hud.Texture.GetTexture(3435775766); } } else if (player.HeroClassDefinition.HeroClass.ToString() == "DemonHunter") { if (Resbar == true) { CurRes = player.Stats.ResourceCurHatred / player.Stats.ResourceMaxHatred; CurRes2 = player.Stats.ResourceCurDiscipline / player.Stats.ResourceMaxDiscipline; BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth, ResbarHeight); HatreBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth * CurRes, ResbarHeight); BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 40) / 1.45f, ResbarWidth, ResbarHeight); DisciplineBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 40) / 1.45f, ResbarWidth * CurRes2, ResbarHeight); } if (player.HeroIsMale) { HeroTexture = Hud.Texture.GetTexture(3785199803); } else { HeroTexture = Hud.Texture.GetTexture(2939779782); } } else if (player.HeroClassDefinition.HeroClass.ToString() == "Monk") { if (Resbar == true) { CurRes = player.Stats.ResourceCurSpirit / player.Stats.ResourceMaxSpirit; BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth, ResbarHeight); SpiritBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth * CurRes, ResbarHeight); } if (player.HeroIsMale) { HeroTexture = Hud.Texture.GetTexture(2227317895); } else { HeroTexture = Hud.Texture.GetTexture(2918463890); } } else if (player.HeroClassDefinition.HeroClass.ToString() == "Necromancer") { if (Resbar == true) { CurRes = player.Stats.ResourceCurEssence / player.Stats.ResourceMaxEssence; BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth, ResbarHeight); EssenceBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth * CurRes, ResbarHeight); } if (player.HeroIsMale) { HeroTexture = Hud.Texture.GetTexture(3285997023); } else { HeroTexture = Hud.Texture.GetTexture(473831658); } } else if (player.HeroClassDefinition.HeroClass.ToString() == "WitchDoctor") { if (Resbar == true) { CurRes = player.Stats.ResourceCurMana / player.Stats.ResourceMaxMana; BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth, ResbarHeight); ManaBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth * CurRes, ResbarHeight); } if (player.HeroIsMale) { HeroTexture = Hud.Texture.GetTexture(3925954876); } else { HeroTexture = Hud.Texture.GetTexture(1603231623); } } else if (player.HeroClassDefinition.HeroClass.ToString() == "Wizard") { if (Resbar == true) { CurRes = player.Stats.ResourceCurArcane / player.Stats.ResourceMaxArcane; BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth, ResbarHeight); ArcaneBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth * CurRes, ResbarHeight); } if (player.HeroIsMale) { HeroTexture = Hud.Texture.GetTexture(44435619); } else { HeroTexture = Hud.Texture.GetTexture(876580014); } } if (Tag == true) { string battleTag = player.BattleTagAbovePortrait; if (battleTag == null) { continue; } TagDecorator.TextFunc = () => battleTag.ToString(); var BattleTagTexture = Hud.Texture.GetTexture(3098562643); BattleTagTexture.Draw(PlayerX - (float)(ScreenWidth / 10) / 2, PlayerY - (float)(ScreenHeight / 7.8f) / 2, (float)(ScreenWidth / 10), (float)(ScreenHeight / 28), 0.7843f); HeroTexture.Draw(PlayerX - (float)(Hud.Window.Size.Height / 31) / 2, PlayerY - (float)(ScreenHeight / 6.1f) / 2, (float)(ScreenHeight / 31), (float)(Hud.Window.Size.Height / 31), 1f); TagDecorator.Paint(PlayerX - (float)(ScreenWidth / 11.5) / 2, PlayerY - (float)(ScreenHeight / 9.23f) / 2, (float)(ScreenWidth / 11.5), (float)(ScreenHeight / 45), HorizontalAlign.Center); } } }
private IProtoSerializer BuildSerializer() { int opaqueToken = 0; try { model.TakeLock(ref opaqueToken);// check nobody is still adding this type var member = backingMember ?? Member; IProtoSerializer ser; if (IsMap) { ResolveMapTypes(out var dictionaryType, out var keyType, out var valueType); if (dictionaryType == null) { throw new InvalidOperationException("Unable to resolve map type for type: " + MemberType.FullName); } var concreteType = DefaultType; if (concreteType == null && MemberType.IsClass) { concreteType = MemberType; } var keySer = TryGetCoreSerializer(model, MapKeyFormat, keyType, out var keyWireType, false, false, false, false); if (!AsReference) { AsReference = MetaType.GetAsReferenceDefault(model, valueType); } var valueSer = TryGetCoreSerializer(model, MapValueFormat, valueType, out var valueWireType, AsReference, DynamicType, false, true); var ctors = typeof(MapDecorator <, ,>).MakeGenericType(new Type[] { dictionaryType, keyType, valueType }).GetConstructors( BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); if (ctors.Length != 1) { throw new InvalidOperationException("Unable to resolve MapDecorator constructor"); } ser = (IProtoSerializer)ctors[0].Invoke(new object[] { concreteType, keySer, valueSer, FieldNumber, DataFormat == DataFormat.Group ? WireType.StartGroup : WireType.String, keyWireType, valueWireType, OverwriteList }); } else { Type finalType = ItemType ?? MemberType; ser = TryGetCoreSerializer(model, dataFormat, finalType, out WireType wireType, AsReference, DynamicType, OverwriteList, true); if (ser == null) { throw new InvalidOperationException("No serializer defined for type: " + finalType.FullName); } // apply tags if (ItemType != null && SupportNull) { if (IsPacked) { throw new NotSupportedException("Packed encodings cannot support null values"); } ser = new TagDecorator(NullDecorator.Tag, wireType, IsStrict, ser); ser = new NullDecorator(ser); ser = new TagDecorator(FieldNumber, WireType.StartGroup, false, ser); } else { ser = new TagDecorator(FieldNumber, wireType, IsStrict, ser); } // apply lists if appropriate if (ItemType != null) { Type underlyingItemType = SupportNull ? ItemType : Helpers.GetUnderlyingType(ItemType) ?? ItemType; Helpers.DebugAssert(underlyingItemType == ser.ExpectedType || (ser.ExpectedType == typeof(object) && !Helpers.IsValueType(underlyingItemType)) , "Wrong type in the tail; expected {0}, received {1}", ser.ExpectedType, underlyingItemType); if (MemberType.IsArray) { ser = new ArrayDecorator(ser, FieldNumber, IsPacked, wireType, MemberType, OverwriteList, SupportNull); } else { ser = ListDecorator.Create(MemberType, DefaultType, ser, FieldNumber, IsPacked, wireType, member != null && PropertyDecorator.CanWrite(member), OverwriteList, SupportNull); } } else if (_defaultValue != null && !IsRequired && getSpecified == null) { // note: "ShouldSerialize*" / "*Specified" / etc ^^^^ take precedence over defaultValue, // as does "IsRequired" ser = new DefaultValueDecorator(_defaultValue, ser); } if (MemberType == typeof(Uri)) { ser = new UriDecorator(ser); } } if (member != null) { if (member is PropertyInfo prop) { ser = new PropertyDecorator(ParentType, prop, ser); } else if (member is FieldInfo fld) { ser = new FieldDecorator(ParentType, fld, ser); } else { throw new InvalidOperationException(); } if (getSpecified != null || setSpecified != null) { ser = new MemberSpecifiedDecorator(getSpecified, setSpecified, ser); } } return(ser); } finally { model.ReleaseLock(opaqueToken); } }
private IProtoSerializer BuildSerializer() { bool lockTaken = false; try { model.TakeLock(ref lockTaken);// check nobody is still adding this type WireType wireType; Type finalType = itemType == null ? memberType : itemType; IProtoSerializer ser = TryGetCoreSerializer(model, dataFormat, finalType, out wireType, asReference, dynamicType); if (ser == null) { throw new InvalidOperationException("No serializer defined for type: " + finalType.FullName); } // apply tags ser = new TagDecorator(fieldNumber, wireType, IsStrict, ser); // apply lists if appropriate if (itemType != null) { Helpers.DebugAssert(itemType == ser.ExpectedType, "Wrong type in the tail"); if (memberType.IsArray) { ser = new ArrayDecorator(ser, fieldNumber, IsPacked, wireType, memberType, OverwriteList); } else { ser = new ListDecorator(memberType, defaultType, ser, fieldNumber, IsPacked, wireType, member == null || PropertyDecorator.CanWrite(member), OverwriteList); } } else if (defaultValue != null && !IsRequired) { ser = new DefaultValueDecorator(defaultValue, ser); } if (memberType == typeof(Uri)) { ser = new UriDecorator(ser); } if (member != null) { switch (member.MemberType) { case MemberTypes.Property: ser = new PropertyDecorator(parentType, (PropertyInfo)member, ser); break; case MemberTypes.Field: ser = new FieldDecorator(parentType, (FieldInfo)member, ser); break; default: throw new InvalidOperationException(); } if (getSpecified != null || setSpecified != null) { ser = new MemberSpecifiedDecorator(getSpecified, setSpecified, ser); } } return(ser); } finally { model.ReleaseLock(lockTaken); } }