Exemple #1
0
        public override void Copy(ODataObject source, JsonSerializer serializer)
        {
            if (source == null || serializer == null)
            {
                return;
            }
            base.Copy(source, serializer);

            var typedSource = source as PreviewPlatformInfo;

            if (typedSource != null)
            {
                PreviewPlatform  = typedSource.PreviewPlatform;
                ItemProtocolLink = typedSource.ItemProtocolLink;
            }
            else
            {
                JToken token;
                if (source.TryGetProperty("PreviewPlatform", out token) && token.Type != JTokenType.Null)
                {
                    PreviewPlatform = (SafeEnum <PreviewPlatform>)serializer.Deserialize(token.CreateReader(), typeof(SafeEnum <PreviewPlatform>));
                }
                if (source.TryGetProperty("ItemProtocolLink", out token) && token.Type != JTokenType.Null)
                {
                    ItemProtocolLink = (ItemProtocolLink)serializer.Deserialize(token.CreateReader(), typeof(ItemProtocolLink));
                }
            }
        }
		public override void Copy(ODataObject source, JsonSerializer serializer)
		{
			if(source == null || serializer == null) return;
			base.Copy(source, serializer);

			var typedSource = source as EditingPlatformInfo;
			if(typedSource != null)
			{
				EditingPlatform = typedSource.EditingPlatform;
				ItemProtocolLink = typedSource.ItemProtocolLink;
			}
			else
			{
				JToken token;
				if(source.TryGetProperty("EditingPlatform", out token) && token.Type != JTokenType.Null)
				{
					EditingPlatform = (SafeEnum<EditingPlatform>)serializer.Deserialize(token.CreateReader(), typeof(SafeEnum<EditingPlatform>));
				}
				if(source.TryGetProperty("ItemProtocolLink", out token) && token.Type != JTokenType.Null)
				{
					ItemProtocolLink = (ItemProtocolLink)serializer.Deserialize(token.CreateReader(), typeof(ItemProtocolLink));
				}
			}
		}