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


C# VkResponse.ContainsKey方法代码示例

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


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

示例1: FromJson

		/// <summary>
		/// Разобрать из json.
		/// </summary>
		/// <param name="response">Ответ сервера.</param>
		/// <returns></returns>
		internal static Chat FromJson(VkResponse response)
		{
			var chat = new Chat
			{
				Id = response["id"],
				Type = response["type"],
				Title = response["title"],
				AdminId = Utilities.GetNullableLongId(response["admin_id"]),
				Users = response["users"],

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

				Left = response.ContainsKey("left") && response["left"]
			};
			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:kadkin,项目名称:vk,代码行数:32,代码来源:Chat.cs

示例2: 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

示例3: FromJson

        /// <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;
        }
开发者ID:kadkin,项目名称:vk,代码行数:32,代码来源:Previews.cs

示例4: FromJson

        internal static Message FromJson(VkResponse response)
        {
            var message = new Message();

            message.Unread = response.ContainsKey("unread") ? response["unread"] : 0;

            if (response.ContainsKey("message"))
                response = response["message"];

            message.Id = response["id"];
            message.UserId = response["user_id"];
            message.Date = response["date"];
            message.ReadState = response["read_state"];
            message.Type = response["out"];
            message.Title = response["title"];
            message.Body = response["body"];
            message.Attachments = response["attachments"];
            message.Geo = response["geo"];
            message.ForwardedMessages = response["fwd_messages"];
            message.ContainsEmojiSmiles = response["emoji"];
            message.IsImportant = response["important"];
            message.IsDeleted = response["deleted"];

            // дополнительные поля бесед

            message.ChatId = response["chat_id"];
            message.ChatActiveIds = response["chat_active"];
            message.UsersCount = response["users_count"];
            message.AdminId = response["admin_id"];
            message.PhotoPreviews = response;

            return message;
        }
开发者ID:SaintCat,项目名称:VkBot,代码行数:33,代码来源:Message.cs

示例5: FromJson

		internal static Message FromJson(VkResponse response)
		{
			if (response.ContainsKey("message"))
			{
				response = response["message"];
			}
			var message = new Message
			{
				Unread = response.ContainsKey("unread") ? response["unread"] : 0,
				Id = response["id"],
				UserId = response["user_id"],
				Date = response["date"],
				ReadState = response["read_state"],
				Type = response["out"],
				Title = response["title"],
				Body = response["body"],
				Attachments = response["attachments"],
				Geo = response["geo"],
				ForwardedMessages = response["fwd_messages"],
				ContainsEmojiSmiles = response["emoji"],
				IsImportant = response["important"],
				IsDeleted = response["deleted"],
				FromId = response["from_id"],
				// дополнительные поля бесед
				ChatId = response["chat_id"],
				ChatActiveIds = response["chat_active"],
				UsersCount = response["users_count"],
				AdminId = response["admin_id"],
				PhotoPreviews = response,
				PushSettings = response["push_settings"],
				Action = response["action"],
				ActionMid = response["action_mid"],
				ActionEmail = response["action_email"],
				ActionText = response["action_text"],
				Photo50 = response["photo_50"],
				Photo100 = response["photo_100"],
				Photo200 = response["photo_200"],

				InRead = response["in_read"],
				OutRead = response["out_read"]
			};


			return message;
		}
开发者ID:ProESM,项目名称:vk,代码行数:45,代码来源:Message.cs


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