public static VKSchool Deserialize(object School) { object id, country, city, name, year_from, year_to, year_graduated, @class, speciality, type, type_str; var school_des = new VKSchool(); var data = (Dictionary <string, object>)School; if (data.TryGetValue("id", out id)) { school_des.id = (long)id; } if (data.TryGetValue("country", out country)) { school_des.country = (long)country; } if (data.TryGetValue("city", out city)) { school_des.city = (long)city; } if (data.TryGetValue("name", out name)) { school_des.name = (string)name; } if (data.TryGetValue("year_from", out year_from)) { school_des.year_from = (int)(long)year_from; } if (data.TryGetValue("year_to", out year_to)) { school_des.year_to = (int)(long)year_to; } if (data.TryGetValue("year_graduated", out year_graduated)) { school_des.year_graduated = (int)(long)year_graduated; } if (data.TryGetValue("class", out @class)) { school_des.@class = (string)@class; } if (data.TryGetValue("speciality", out speciality)) { school_des.speciality = (string)speciality; } if (data.TryGetValue("type", out type)) { school_des.type = (long)type; } if (data.TryGetValue("type_str", out type_str)) { school_des.type_str = (string)type_str; } return(school_des); }
public static VKSchool Deserialize(object School) { object id, country, city,name,year_from,year_to,year_graduated,@class,speciality,type,type_str; var school_des=new VKSchool(); var data=(Dictionary<string,object>)School; if(data.TryGetValue("id",out id)) school_des.id=(long)id; if(data.TryGetValue("country",out country)) school_des.country=(long)country; if(data.TryGetValue("city",out city)) school_des.city=(long)city; if(data.TryGetValue("name",out name)) school_des.name=(string)name; if(data.TryGetValue("year_from",out year_from)) school_des.year_from=(int)(long)year_from; if(data.TryGetValue("year_to",out year_to)) school_des.year_to=(int)(long)year_to; if(data.TryGetValue("year_graduated",out year_graduated)) school_des.year_graduated=(int)(long)year_graduated; if(data.TryGetValue("class",out @class)) school_des.@class=(string)@class; if(data.TryGetValue("speciality",out speciality)) school_des.speciality=(string)speciality; if(data.TryGetValue("type",out type)) school_des.type=(long)type; if(data.TryGetValue("type_str",out type_str)) school_des.type_str=(string)type_str; return school_des; }
public static VKUser Deserialize(object User) { var userDeserialized = new VKUser(); var usr = (Dictionary <string, object>)User; object id, firstName, last_name, hidden, deactivated, verified, blacklisted, sex, bdate, city, country, home_town; object photo_50, photo_100, photo_200_orig, photo_200, photo_400_orig, photo_max, photo_max_orig; object online, lists, domain, has_mobile, mobile_phone, home_phone, site; if (usr.TryGetValue("id", out id)) { userDeserialized.id = (long)id; } if (usr.TryGetValue("first_name", out firstName)) { userDeserialized.first_name = (string)firstName; } if (usr.TryGetValue("last_name", out last_name)) { userDeserialized.last_name = (string)last_name; } if (usr.TryGetValue("deactivated", out deactivated)) { userDeserialized.deactivated = (string)deactivated; } if (usr.TryGetValue("hidden", out hidden)) { userDeserialized.hidden = (int)(long)hidden; } if (usr.TryGetValue("verified", out verified)) { userDeserialized.verified = (int)(long)verified; } if (usr.TryGetValue("blacklisted", out blacklisted)) { userDeserialized.blacklisted = (int)(long)blacklisted; } if (usr.TryGetValue("sex", out sex)) { userDeserialized.sex = (int)(long)sex; } if (usr.TryGetValue("bdate", out bdate)) { userDeserialized.bdate = (string)bdate; } if (usr.TryGetValue("city", out city)) { userDeserialized.city = (string)city; } if (usr.TryGetValue("country", out country)) { userDeserialized.country = (string)country; } if (usr.TryGetValue("home_town", out home_town)) { userDeserialized.home_town = (string)home_town; } if (usr.TryGetValue("home_phone", out home_phone)) { userDeserialized.home_phone = (string)home_phone; } if (usr.TryGetValue("photo_50", out photo_50)) { userDeserialized.photo_50 = (string)photo_50; } if (usr.TryGetValue("photo_100", out photo_100)) { userDeserialized.photo_100 = (string)photo_100; } if (usr.TryGetValue("photo_200", out photo_200)) { userDeserialized.photo_200 = (string)photo_200; } if (usr.TryGetValue("photo_200_orig", out photo_200_orig)) { userDeserialized.photo_200_orig = (string)photo_200_orig; } if (usr.TryGetValue("photo_400_orig", out photo_400_orig)) { userDeserialized.photo_400_orig = (string)photo_400_orig; } if (usr.TryGetValue("photo_max", out photo_max)) { userDeserialized.photo_max = (string)photo_max; } if (usr.TryGetValue("photo_max_orig", out photo_max_orig)) { userDeserialized.photo_max_orig = (string)photo_max_orig; } if (usr.TryGetValue("online", out online)) { userDeserialized.online = int.Parse(online.ToString()); } if (usr.TryGetValue("lists", out lists)) { userDeserialized.lists = new List <long>(); foreach (var i in (List <object>)lists) { userDeserialized.lists.Add((long)i); } } if (usr.TryGetValue("domain", out domain)) { userDeserialized.domain = (string)domain; } if (usr.TryGetValue("has_mobile", out has_mobile)) { userDeserialized.has_mobile = (int)(long)has_mobile; } if (usr.TryGetValue("mobile_phone", out mobile_phone)) { userDeserialized.mobile_phone = (string)mobile_phone; } if (usr.TryGetValue("home_phone", out home_phone)) { userDeserialized.home_phone = (string)home_phone; } if (usr.TryGetValue("site", out site)) { userDeserialized.site = (string)site; } object university, university_name, faculty, faculty_name, graduation; if (usr.TryGetValue("university", out university)) { userDeserialized.university = (long)university; } if (usr.TryGetValue("university_name", out university_name)) { userDeserialized.university_name = (string)university_name; } if (usr.TryGetValue("faculty", out faculty)) { userDeserialized.faculty = (long)faculty; } if (usr.TryGetValue("faculty_name", out faculty_name)) { userDeserialized.faculty_name = (string)faculty_name; } if (usr.TryGetValue("graduation", out graduation)) { userDeserialized.graduation = (int)(long)graduation; } object universities, schools, status, status_audio, followers_count, common_count, counters, occupation; if (usr.TryGetValue("universities", out universities)) { var _universities = new List <VKUniversity>(); var unidata = (List <object>)universities; foreach (var u in unidata) { _universities.Add(VKUniversity.Deserialize(u)); } userDeserialized.universities = _universities; } if (usr.TryGetValue("schools", out schools)) { var _schools = new List <VKSchool>(); var unidata = (List <object>)schools; foreach (var s in unidata) { _schools.Add(VKSchool.Deserialize(s)); } userDeserialized.schools = _schools; } if (usr.TryGetValue("status", out status)) { userDeserialized.status = (string)status; } if (usr.TryGetValue("status_audio", out status_audio)) { userDeserialized.status_audio = VKAudio.Deserialize(status_audio); } if (usr.TryGetValue("followers_count", out followers_count)) { userDeserialized.followers_count = (int)(long)followers_count; } if (usr.TryGetValue("common_count", out common_count)) { userDeserialized.common_count = (int)(long)common_count; } if (usr.TryGetValue("counters", out counters)) { userDeserialized.counters = VKCounters.Deserialize(counters); } if (usr.TryGetValue("occupation", out occupation)) { userDeserialized.occupation = VKUserOccupation.Deserialize(occupation); } object nickname, relatives, relation, personal, facebook, twitter, livejournal, instagram, exports, wall_comments; if (usr.TryGetValue("nickname", out nickname)) { userDeserialized.nickname = (string)nickname; } if (usr.TryGetValue("relatives", out relatives)) { var rel = (List <object>)relatives; var _relatives = new List <VKUserRelative>(); foreach (var r in rel) { _relatives.Add(VKUserRelative.Deserialize(r)); } userDeserialized.relatives = _relatives; } if (usr.TryGetValue("relation", out relation)) { userDeserialized.relation = (int)(long)relation; } if (usr.TryGetValue("personal", out personal)) { userDeserialized.personal = VKUserPersonal.Deserialize(personal); } if (usr.TryGetValue("facebook", out facebook)) { userDeserialized.facebook = (string)facebook; } if (usr.TryGetValue("twitter", out twitter)) { userDeserialized.twitter = (string)twitter; } if (usr.TryGetValue("livejournal", out livejournal)) { userDeserialized.livejournal = (string)livejournal; } if (usr.TryGetValue("instagram", out instagram)) { userDeserialized.instagram = (string)instagram; } if (usr.TryGetValue("exports", out exports)) { userDeserialized.exports = VKUserExports.Deserialize(exports); } if (usr.TryGetValue("wall_comments", out wall_comments)) { userDeserialized.wall_comments = (int)(long)wall_comments; } object activities, interests, movies, tv, books, games, about, quotes, can_post, can_see_all_posts, can_see_audio, can_write_private_message, timezone, screen_name, maiden_name; if (usr.TryGetValue("activities", out activities)) { userDeserialized.activities = (string)activities; } if (usr.TryGetValue("interests", out interests)) { userDeserialized.interests = (string)interests; } if (usr.TryGetValue("movies", out movies)) { userDeserialized.movies = (string)movies; } if (usr.TryGetValue("tv", out tv)) { userDeserialized.tv = (string)tv; } if (usr.TryGetValue("books", out books)) { userDeserialized.books = (string)books; } if (usr.TryGetValue("games", out games)) { userDeserialized.games = (string)games; } if (usr.TryGetValue("about", out about)) { userDeserialized.about = (string)about; } if (usr.TryGetValue("quotes", out quotes)) { userDeserialized.quotes = (string)quotes; } if (usr.TryGetValue("can_post", out can_post)) { userDeserialized.can_post = (int)(long)can_post; } if (usr.TryGetValue("can_see_all_posts", out can_see_all_posts)) { userDeserialized.can_see_all_posts = (int)(long)can_see_all_posts; } if (usr.TryGetValue("can_see_audio", out can_see_audio)) { userDeserialized.can_see_audio = (int)(long)can_see_audio; } if (usr.TryGetValue("can_write_private_message", out can_write_private_message)) { userDeserialized.can_write_private_message = (int)(long)can_write_private_message; } if (usr.TryGetValue("timezone", out timezone)) { userDeserialized.timezone = (int)(long)timezone; } if (usr.TryGetValue("screen_name", out screen_name)) { userDeserialized.screen_name = (string)screen_name; } if (usr.TryGetValue("maiden_name", out maiden_name)) { userDeserialized.maiden_name = (string)maiden_name; } return(userDeserialized); }