/// <summary> /// Проверяет, находится ли объект в списке "Мне нравится" заданного пользователя, и возвращает объект с полями liked и copied. /// </summary> /// <exception cref="ResponseException" /> /// <param name="type"></param> /// <param name="owner_id"></param> /// <param name="item_id"></param> /// <returns>Возвращает объект с полями liked и copied.</returns> public static Likes IsLiked(string type, int user_id, int owner_id, string item_id) { WebRequest request = WebRequest.Create("https://api.vk.com/method/likes.isLiked.xml?type=" + type + "&user_id=" + user_id + "&type=photo&item_id=" + item_id + "&owner_id=" + owner_id + "&v=5.42&access_token=" + VkApi.Token); using (WebResponse response = request.GetResponse()) { using (Stream stream = response.GetResponseStream()) { using (StreamReader reader = new StreamReader(stream)) { string html = reader.ReadToEnd(); if (html.IndexOf("error") > -1) { Error error = new Error(html); throw new ResponseException(String.Format("Ошибка: ({0}): {1}", error.error_code, error.error_msg)); } XmlSerializer Serializer = new XmlSerializer(typeof(Likes)); using (StringReader stringreader = new StringReader(html)) { Likes resp = (Likes)Serializer.Deserialize(stringreader); return(resp); } } } } }
private void Initialization() { Account = new Account(); Ads = new Ads(); Apps = new Apps(); AppWidgets = new AppWidgets(); Audio = new Audio(); Auth = new Auth(); Board = new Board(); Database = new Database(); Docs = new Docs(); Fave = new Fave(); Friends = new Friends(); Gifts = new Gifts(); Groups = new Groups(); Likes = new Likes(); Market = new Market(); Messages = new Messages(); Newsfeed = new Newsfeed(); Notes = new Notes(); Notifications = new Notifications(); Other = new Other(); Pages = new Pages(); Photos = new Photos(); Places = new Places(); Polls = new Polls(); Search = new Search(); Stats = new Stats(); Status = new Status(); Storage = new Storage(); Stories = new Stories(); Streaming = new Streaming(); Users = new Users(); Utils = new Utils(); Video = new Video(); Wall = new Wall(); Widgets = new Widgets(); }