本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例5: FromJson
internal static Tags FromJson(VkResponse response)
{
var tags = new Tags();
tags.Count = response["count"];
return tags;
}
示例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"]
};
}
示例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"]
};
}
示例8: FromJson
internal static LastActivity FromJson(VkResponse re)
{
var lastActivity = new LastActivity();
lastActivity.IsOnline = re["online"];
lastActivity.Time = re["time"];
return lastActivity;
}
示例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;
}
示例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;
}
示例11: FromJson
internal static PostSource FromJson(VkResponse response)
{
var postSource = new PostSource();
postSource.Type = response["type"];
postSource.Data = response["data"];
return postSource;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}