コード例 #1
0
ファイル: ArmorConverter.cs プロジェクト: tigerbytes/GW2.NET
        partial void Merge(Armor 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.WeightClass = this.weightClassConverter.Convert(details.WeightClass, details);
            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;
            }
        }
コード例 #2
0
ファイル: ArmorConverter.cs プロジェクト: tigerbytes/GW2.NET
        partial void Merge(Armor entity, ItemDTO dto, object state)
        {
            int defaultSkinId;
            if (int.TryParse(dto.DefaultSkin, out defaultSkinId))
            {
                entity.DefaultSkinId = defaultSkinId;
            }

            var armor = dto.Armor;
            entity.WeightClass = this.weightClassConverter.Convert(armor.WeightClass, armor);
            int defense;
            if (int.TryParse(armor.Defense, out defense))
            {
                entity.Defense = defense;
            }

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

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

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

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