当前位置: 首页>>代码示例>>C#>>正文


C# VkResponse类代码示例

本文整理汇总了C#中VkResponse的典型用法代码示例。如果您正苦于以下问题:C# VkResponse类的具体用法?C# VkResponse怎么用?C# VkResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


VkResponse类属于命名空间,在下文中一共展示了VkResponse类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FromJson

        internal static Chat FromJson(VkResponse response)
        {
            var chat = new Chat();

            chat.Id = response["id"];
            chat.Type = response["type"];
            chat.Title = response["title"];
            chat.AdminId = Utilities.GetNullableLongId(response["admin_id"]);
            chat.Users = response["users"];

            #region Поля найденые експерементально

            chat.Left = response.ContainsKey("left") ? response["left"] : false;
            if (response.ContainsKey("push_settings"))
            {
                chat.Sound = response["push_settings"]["sound"];
                chat.DisabledUntil = response["push_settings"]["disabled_until"];
            }
            else
            {
                chat.Sound = null;
                chat.DisabledUntil = null;
            }
            #endregion

            return chat;
        }
开发者ID:Bobruk,项目名称:vk,代码行数:27,代码来源:Chat.cs

示例2: FromJson

        /// <summary>
        /// Разобрать из json.
        /// </summary>
        /// <param name="response">Ответ сервера.</param>
        /// <returns></returns>
        public static VkObject FromJson(VkResponse response)
        {
            var obj = new VkObject
            {
                Id = Utilities.GetNullableLongId(response["object_id"])
            };

            string type = response["type"];
            switch (type)
            {
                case "group":
                    {
                        obj.Type = VkObjectType.Group;
                        break;
                    }
                case "user":
                    {
                        obj.Type = VkObjectType.User;
                        break;
                    }
                case "application":
                    {
                        obj.Type = VkObjectType.Application;
                        break;
                    }
                default:
                {
                    return obj;
                }
            }
            return obj;
        }
开发者ID:vknet,项目名称:vk,代码行数:37,代码来源:VkObject.cs

示例3: FromJson

        /// <summary>
        /// Разобрать из json.
        /// </summary>
        /// <param name="response">Ответ сервера.</param>
        /// <returns></returns>
        public 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;
        }
开发者ID:vknet,项目名称:vk,代码行数:31,代码来源:Previews.cs

示例4: FromJson

		/// <summary>
		/// Разобрать из json.
		/// </summary>
		/// <param name="response">Ответ сервера.</param>
		/// <returns></returns>
		internal static Education FromJson(VkResponse response)
		{
			if (response["university"] == null || response["university"].ToString() == "0")
				return null;

			var education = new Education
			{
				UniversityId = Utilities.GetNullableLongId(response["university"]),
				UniversityName = response["university_name"],
				FacultyId = Utilities.GetNullableLongId(response["faculty"]),
				FacultyName = response["faculty_name"],
				Graduation = (int?)Utilities.GetNullableLongId(response["graduation"])
			};

			if (education.UniversityId.HasValue && education.UniversityId == 0)
				education.UniversityId = null;

			if (education.FacultyId.HasValue && education.FacultyId == 0)
				education.FacultyId = null;

			if (education.Graduation.HasValue && education.Graduation == 0)
				education.Graduation = null;

			education.EducationForm = response["education_form"]; // установлено экcпериментальным путем
			education.EducationStatus = response["education_status"]; // установлено экcпериментальным путем

			return education;
		}
开发者ID:kadkin,项目名称:vk,代码行数:33,代码来源:Education.cs

示例5: FromJson

        internal static Tags FromJson(VkResponse response)
        {
            var tags = new Tags();

            tags.Count = response["count"];

            return tags;
        }
开发者ID:G-IT-ED,项目名称:vk,代码行数:8,代码来源:Tags.cs

示例6: FromJson

 /// <summary>
 /// Разобрать из json.
 /// </summary>
 /// <param name="response">Ответ сервера.</param>
 /// <returns></returns>
 public static Lyrics FromJson(VkResponse response)
 {
     return new Lyrics
     {
         Id = response["lyrics_id"],
         Text = response["text"]
     };
 }
开发者ID:vknet,项目名称:vk,代码行数:13,代码来源:Lyrics.cs

示例7: FromJson

		/// <summary>
		/// Разобрать из JSON.
		/// </summary>
		/// <param name="response">Ответ от vk.</param>
		/// <returns></returns>
		internal static Comments FromJson(VkResponse response)
		{
			return new Comments
            {
                Count = response["count"],
                CanPost = response["can_post"]
            };
        }
开发者ID:kadkin,项目名称:vk,代码行数:13,代码来源:Comments.cs

示例8: FromJson

        internal static LastActivity FromJson(VkResponse re)
        {
            var lastActivity = new LastActivity();

            lastActivity.IsOnline = re["online"];
            lastActivity.Time = re["time"];

            return lastActivity;
        }
开发者ID:G-IT-ED,项目名称:vk,代码行数:9,代码来源:LastActivity.cs

示例9: FromJson

		/// <summary>
		/// Разобрать из json.
		/// </summary>
		/// <param name="response">Ответ сервера.</param>
		/// <returns></returns>
		internal static PushSettings FromJson(VkResponse response)
		{
			var settings = new PushSettings
			{
				Sound = response.ContainsKey("sound") && response["sound"],
				DisabledUntil = response.ContainsKey("disabled_until") ? response["disabled_until"] : null
			};
			return settings;
		}
开发者ID:ProESM,项目名称:vk,代码行数:14,代码来源:PushSettings.cs

示例10: FromJson

        /// <summary>
        /// Разобрать из json.
        /// </summary>
        /// <param name="response">Ответ сервера.</param>
        /// <returns></returns>
        public static Tags FromJson(VkResponse response)
        {
            var tags = new Tags
            {
                Count = response["count"]
            };

            return tags;
        }
开发者ID:vknet,项目名称:vk,代码行数:14,代码来源:Tags.cs

示例11: FromJson

        internal static PostSource FromJson(VkResponse response)
        {
            var postSource = new PostSource();

            postSource.Type = response["type"];
            postSource.Data = response["data"];

            return postSource;
        }
开发者ID:andrew-veresov,项目名称:vk,代码行数:9,代码来源:PostSource.cs

示例12: FromJson

        internal static UploadServerInfo FromJson(VkResponse response)
        {
            var info = new UploadServerInfo();

            info.UploadUrl = response["upload_url"];
            info.AlbumId = Utilities.GetNullableLongId(response["album_id"] ?? response["aid"]);
            info.UserId = Utilities.GetNullableLongId(response["user_id"] ?? response["mid"]);

            return info;
        }
开发者ID:G-IT-ED,项目名称:vk,代码行数:10,代码来源:UploadServerInfo.cs

示例13: FromJson

        /// <summary>
        /// Разобрать из json.
        /// </summary>
        /// <param name="response">Ответ сервера.</param>
        /// <returns></returns>
        public static Reposts FromJson(VkResponse response)
        {
            var reposts = new Reposts
            {
                Count = response["count"],
                UserReposted = response["user_reposted"]
            };

            return reposts;
        }
开发者ID:vknet,项目名称:vk,代码行数:15,代码来源:Reposts.cs

示例14: FromJson

        internal static PollAnswer FromJson(VkResponse response)
        {
            var answer = new PollAnswer();

            answer.Id = response["id"];
            answer.Text = response["text"];
            answer.Votes = response["votes"];
            answer.Rate = response["rate"];

            return answer;
        }
开发者ID:G-IT-ED,项目名称:vk,代码行数:11,代码来源:PollAnswer.cs

示例15: FromJson

        /// <summary>
        /// Разобрать из json.
        /// </summary>
        /// <param name="response">Ответ сервера.</param>
        /// <returns></returns>
        public static UploadServerInfo FromJson(VkResponse response)
        {
            var info = new UploadServerInfo
            {
                UploadUrl = response["upload_url"],
                AlbumId = Utilities.GetNullableLongId(response["album_id"] ?? response["aid"]),
                UserId = Utilities.GetNullableLongId(response["user_id"] ?? response["message_id"] ?? response["mid"])
            };

            return info;
        }
开发者ID:vknet,项目名称:vk,代码行数:16,代码来源:UploadServerInfo.cs


注:本文中的VkResponse类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。