コード例 #1
0
ファイル: WeaponConverter.cs プロジェクト: tigerbytes/GW2.NET
        partial void Merge(Weapon entity, ItemDTO dto, object state)
        {
            int defaultSkinId;
            if (int.TryParse(dto.DefaultSkin, out defaultSkinId))
            {
                entity.DefaultSkinId = defaultSkinId;
            }

            var weapon = dto.Weapon;
            if (weapon == null)
            {
                return;
            }

            entity.DamageType = this.damageTypeConverter.Convert(weapon.DamageType, state);

            int minimumPower;
            if (int.TryParse(weapon.MinimumPower, out minimumPower))
            {
                entity.MinimumPower = minimumPower;
            }

            int maximumPower;
            if (int.TryParse(weapon.MaximumPower, out maximumPower))
            {
                entity.MaximumPower = maximumPower;
            }

            int defense;
            if (int.TryParse(weapon.Defense, out defense))
            {
                entity.Defense = defense;
            }

            var infusionSlots = weapon.InfusionSlots;
            if (infusionSlots != null)
            {
                entity.InfusionSlots = this.infusionSlotCollectionConverter.Convert(infusionSlots, weapon);
            }

            var infixUpgrade = weapon.InfixUpgrade;
            if (infixUpgrade != null)
            {
                entity.InfixUpgrade = this.infixUpgradeConverter.Convert(infixUpgrade, weapon);
            }

            int suffixItemId;
            if (int.TryParse(weapon.SuffixItemId, out suffixItemId))
            {
                entity.SuffixItemId = suffixItemId;
            }

            int secondarySuffixItemId;
            if (int.TryParse(weapon.SecondarySuffixItemId, out secondarySuffixItemId))
            {
                entity.SecondarySuffixItemId = secondarySuffixItemId;
            }
        }
コード例 #2
0
ファイル: WeaponConverter.cs プロジェクト: tigerbytes/GW2.NET
        partial void Merge(Weapon entity, ItemDTO dto, object state)
        {
            int defaultSkinId;
            if (int.TryParse(dto.DefaultSkin, out defaultSkinId))
            {
                entity.DefaultSkinId = defaultSkinId;
            }

            var details = dto.Details;
            if (details == null)
            {
                return;
            }

            entity.DamageType = this.damageTypeConverter.Convert(details.DamageType, details);

            if (details.MinimumPower.HasValue)
            {
                entity.MinimumPower = details.MinimumPower.Value;
            }

            if (details.MaximumPower.HasValue)
            {
                entity.MaximumPower = details.MaximumPower.Value;
            }

            if (details.Defense.HasValue)
            {
                entity.Defense = details.Defense.Value;
            }

            var infusionSlots = details.InfusionSlots;
            if (infusionSlots != null)
            {
                entity.InfusionSlots = this.infusionSlotCollectionConverter.Convert(infusionSlots, details);
            }

            var infixUpgrade = details.InfixUpgrade;
            if (infixUpgrade != null)
            {
                entity.InfixUpgrade = this.infixUpgradeConverter.Convert(infixUpgrade, details);
            }

            entity.SuffixItemId = details.SuffixItemId;

            int secondarySuffixItemId;
            if (int.TryParse(details.SecondarySuffixItemId, out secondarySuffixItemId))
            {
                entity.SecondarySuffixItemId = secondarySuffixItemId;
            }
        }