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


C# Utils.VkResponse类代码示例

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


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

示例1: FromJson

		/// <summary>
		/// Разобрать из json.
		/// </summary>
		/// <param name="response">Ответ сервера.</param>
		/// <returns></returns>
		internal static NewsSuggestions FromJson(VkResponse response)
		{
			var newsSuggestions = new NewsSuggestions
			{
				Users = new List<User>(),
				Groups = new List<Group>()
			};
			VkResponseArray result = response;
			foreach (var item in result)
			{

				switch (item["type"].ToString())
				{
					case "page":
					case "group":
						{
							Group @group = item;
							newsSuggestions.Groups.Add(@group);
						}
						break;
					case "profile":
						{
							User user = item;
							newsSuggestions.Users.Add(user);
						}
						break;
					default:
						{
							throw new System.Exception(string.Format("Типа '{0}' не существует. Пожалуйста заведите задачу на сайте проекта: https://github.com/vknet/vk/issues", item["type"]));
						}
				}
			}
			return newsSuggestions;
		}
开发者ID:kadkin,项目名称:vk,代码行数:39,代码来源:NewsSuggestions.cs

示例2: FromJson

        internal static Education FromJson(VkResponse response)
        {
            if (response["university"] == null || response["university"].ToString() == "0")
                return null;

            var education = new Education();

            education.UniversityId = Utilities.GetNullableLongId(response["university"]);
            education.UniversityName = response["university_name"];
            education.FacultyId = Utilities.GetNullableLongId(response["faculty"]);
            education.FacultyName = response["faculty_name"];
            education.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:SaintCat,项目名称:VkBot,代码行数:27,代码来源:Education.cs

示例3: FromJson

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

示例4: FromJson

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

示例5: FromJson

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

示例6: FromJson

        internal static Reposts FromJson(VkResponse response)
        {
            var reposts = new Reposts();

            reposts.Count = response["count"];
            reposts.UserReposted = response["user_reposted"];

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

示例7: FromJson

        internal static Comments FromJson(VkResponse response)
        {
            var comments = new Comments();

            comments.Count = response["count"];
            comments.CanPost = response["can_post"];

            return comments;
        }
开发者ID:SaintCat,项目名称:VkBot,代码行数:9,代码来源:Comments.cs

示例8: FromJson

        internal static Street FromJson(VkResponse response)
        {
            var street = new Street();

            street.Id = response["sid"];
            street.Title = response["name"];

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

示例9: FromJson

        /// <summary>
        /// Разобрать из json.
        /// </summary>
        /// <param name="response">Ответ сервера.</param>
        /// <returns></returns>
        internal static Product FromJson(VkResponse response)
        {
            var product = new Product
            {
                Price = response["price"]
            };

            return product;
        }
开发者ID:Olegasdf,项目名称:vk,代码行数:14,代码来源:Product.cs

示例10: FromJson

        internal static Lyrics FromJson(VkResponse re)
        {
            var lyrics = new Lyrics();

            lyrics.Id = re["lyrics_id"];
            lyrics.Text = re["text"];

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

示例11: FromJson

        internal static Country FromJson(VkResponse response)
        {
            var country = new Country();

            country.Id = response["cid"] ?? response["id"];
            country.Title = response["title"] ?? response["name"];

            return country;
        }
开发者ID:SaintCat,项目名称:VkBot,代码行数:9,代码来源:Country.cs

示例12: FromJson

        internal static Status FromJson(VkResponse response)
        {
            var status = new Status();

            status.Text = response["text"];
            status.Audio = response["audio"];

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

示例13: FromJson

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

            lastActivity.IsOnline = re["online"];
            lastActivity.Time = Utilities.FromUnixTime(re["time"]);

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

示例14: FromJson

        internal static FriendList FromJson(VkResponse response)
        {
            var list = new FriendList();

            list.Id = response["lid"];
            list.Name = response["name"];

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

示例15: FromJson

        internal static Faculty FromJson(VkResponse response)
        {
            var faculty = new Faculty();

            faculty.Id = response["id"];
            faculty.Title = response["title"];

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


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