Esempio n. 1
0
        partial void Merge(ArmorSkin entity, SkinDTO dto, object state)
        {
            var armor = dto.Armor;
            if (armor == null)
            {
                return;
            }

            entity.WeightClass = this.weightClassConverter.Convert(armor.WeightClass, armor);
        }
Esempio n. 2
0
        partial void Merge(WeaponSkin entity, SkinDTO dto, object state)
        {
            var weapon = dto.Weapon;
            if (weapon == null)
            {
                return;
            }

            entity.DamageType = this.damageTypeConverter.Convert(weapon.DamageType, weapon);
        }
Esempio n. 3
0
        partial void Merge(Skin entity, SkinDTO dto, object state)
        {
            int skinId;
            if (int.TryParse(dto.SkinId, out skinId))
            {
                entity.SkinId = skinId;
            }

            entity.Name = dto.Name;

            var flags = dto.Flags;
            if (flags != null)
            {
                entity.Flags = this.skinFlagsConverter.Convert(flags, dto);
            }

            var restrictions = dto.Restrictions;
            if (restrictions != null)
            {
                entity.Restrictions = this.itemRestrictionsConverter.Convert(restrictions, dto);
            }

            int iconFileId;
            if (int.TryParse(dto.IconFileId, out iconFileId))
            {
                entity.IconFileId = iconFileId;
            }

            // Set the icon file signature
            entity.IconFileSignature = dto.IconFileSignature;

            // Set the icon file URL
            const string IconUrlTemplate = @"https://render.guildwars2.com/file/{0}/{1}.{2}";
            var iconUrl = string.Format(IconUrlTemplate, dto.IconFileSignature, dto.IconFileId, "png");
            entity.IconFileUrl = new Uri(iconUrl, UriKind.Absolute);
        }