/// <inheritdoc />
        public GatheringTool Convert(ItemDataContract value, object state)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value", "Precondition: value != null");
            }

            GatheringTool gatheringTool;
            var           gatheringToolDataContract = value.GatheringTool;

            IConverter <GatheringToolDataContract, GatheringTool> converter;

            if (this.typeConverters.TryGetValue(gatheringToolDataContract.Type, out converter))
            {
                gatheringTool = converter.Convert(gatheringToolDataContract, state);
            }
            else
            {
                gatheringTool = new UnknownGatheringTool();
            }

            int defaultSkinId;

            if (int.TryParse(value.DefaultSkin, out defaultSkinId))
            {
                gatheringTool.DefaultSkinId = defaultSkinId;
            }

            return(gatheringTool);
        }
Example #2
0
        /// <inheritdoc />
        public GatheringTool Convert(ItemDTO value, object state)
        {
            var entity = new UnknownGatheringTool();

            this.Merge(entity, value, state);
            return(entity);
        }
Example #3
0
 // Implement this method in a buddy class to set properties that are specific to 'UnknownGatheringTool' (if any)
 partial void Merge(UnknownGatheringTool entity, ItemDTO dto, object state);