Exemple #1
0
        /// <summary>
        /// Разобрать из json.
        /// </summary>
        /// <param name="response">Ответ сервера.</param>
        /// <returns></returns>
        internal static Previews FromJson(VkResponse response)
        {
            var previews = new Previews
            {
                Photo50  = response["photo_50"],
                Photo100 = response["photo_100"] ?? response["photo_medium"],
                Photo130 = response["photo_130"],
                Photo200 = response["photo_200"] ?? response["photo_200_orig"],
                Photo400 = response["photo_400_orig"]
            };

            if (response.ContainsKey("photo"))
            {
                if (Uri.IsWellFormedUriString(response["photo"].ToString(), UriKind.Absolute))
                {
                    previews.Photo50 = response["photo"];
                }
                else
                {
                    previews.Photo = response["photo"];
                }
            }

            previews.PhotoMax = response["photo_max"] ?? response["photo_max_orig"] ?? response["photo_big"] ?? previews.Photo400 ?? previews.Photo200 ?? previews.Photo100 ?? previews.Photo50;

            return(previews);
        }
Exemple #2
0
        /// <summary>
        /// Разобрать из json.
        /// </summary>
        /// <param name="response">Ответ сервера.</param>
        /// <returns></returns>
        internal static Previews FromJson(VkResponse response)
        {

            var previews = new Previews
            {
                Photo50 = response["photo_50"],
                Photo100 = response["photo_100"] ?? response["photo_medium"],
                Photo130 = response["photo_130"],
                Photo200 = response["photo_200"] ?? response["photo_200_orig"],
                Photo400 = response["photo_400_orig"]
            };
            if (response.ContainsKey("photo"))
            {
                if (Uri.IsWellFormedUriString(response["photo"].ToString(), UriKind.Absolute))
                {
                    previews.Photo50 = response["photo"];
                }
                else
                {
                    previews.Photo = response["photo"];
                }
            }
            
            previews.PhotoMax = response["photo_max"] ?? response["photo_max_orig"] ?? response["photo_big"] ?? previews.Photo400 ?? previews.Photo200 ?? previews.Photo100 ?? previews.Photo50;

            return previews;
        }
Exemple #3
0
        internal static Previews FromJson(VkResponse response)
        {
            var previews = new Previews();

            previews.Photo50 = response["photo_50"] ?? response["photo"];
            previews.Photo100 = response["photo_100"] ?? response["photo_medium"];
            previews.Photo200 = response["photo_200"] ?? response["photo_200_orig"];
            previews.Photo400 = response["photo_400_orig"];
            previews.PhotoMax = response["photo_max"] ?? response["photo_max_orig"] ?? response["photo_big"] ?? previews.Photo400 ?? previews.Photo200 ?? previews.Photo100 ?? previews.Photo50;

            return previews;
        }
        internal static Previews FromJson(VkResponse response)
        {
            var previews = new Previews();

            previews.Photo50  = response["photo_50"] ?? response["photo"];
            previews.Photo100 = response["photo_100"] ?? response["photo_medium"];
            previews.Photo200 = response["photo_200"] ?? response["photo_200_orig"];
            previews.Photo400 = response["photo_400_orig"];
            previews.PhotoMax = response["photo_max"] ?? response["photo_max_orig"] ?? response["photo_big"] ?? previews.Photo400 ?? previews.Photo200 ?? previews.Photo100 ?? previews.Photo50;

            return(previews);
        }