本文整理汇总了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;
}
示例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;
}
示例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"]
};
}
示例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"]
};
}
示例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)
};
}
示例6: FromJson
internal static Reposts FromJson(VkResponse response)
{
var reposts = new Reposts();
reposts.Count = response["count"];
reposts.UserReposted = response["user_reposted"];
return reposts;
}
示例7: FromJson
internal static Comments FromJson(VkResponse response)
{
var comments = new Comments();
comments.Count = response["count"];
comments.CanPost = response["can_post"];
return comments;
}
示例8: FromJson
internal static Street FromJson(VkResponse response)
{
var street = new Street();
street.Id = response["sid"];
street.Title = response["name"];
return street;
}
示例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;
}
示例10: FromJson
internal static Lyrics FromJson(VkResponse re)
{
var lyrics = new Lyrics();
lyrics.Id = re["lyrics_id"];
lyrics.Text = re["text"];
return lyrics;
}
示例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;
}
示例12: FromJson
internal static Status FromJson(VkResponse response)
{
var status = new Status();
status.Text = response["text"];
status.Audio = response["audio"];
return status;
}
示例13: FromJson
internal static LastActivity FromJson(VkResponse re)
{
var lastActivity = new LastActivity();
lastActivity.IsOnline = re["online"];
lastActivity.Time = Utilities.FromUnixTime(re["time"]);
return lastActivity;
}
示例14: FromJson
internal static FriendList FromJson(VkResponse response)
{
var list = new FriendList();
list.Id = response["lid"];
list.Name = response["name"];
return list;
}
示例15: FromJson
internal static Faculty FromJson(VkResponse response)
{
var faculty = new Faculty();
faculty.Id = response["id"];
faculty.Title = response["title"];
return faculty;
}