public static VKAttachment Deserialize(object attachment) { var data = (Dictionary <string, object>)attachment; var _atachment = new VKAttachment(); object type, audio, photo, poll, doc, link, wall, note, Page; if (data.TryGetValue("type", out type)) { _atachment.type = (string)type; } if (data.TryGetValue("audio", out audio)) { _atachment.audio = VKAudio.Deserialize(audio); } if (data.TryGetValue("photo", out photo)) { _atachment.photo = VKPhoto.Deserialize(photo); } if (data.TryGetValue("poll", out poll)) { _atachment.poll = VKPoll.Deserialize(poll); } if (data.TryGetValue("doc", out doc)) { _atachment.doc = VKDocument.Deserialize(doc); } if (data.TryGetValue("link", out link)) { _atachment.link = VKLink.Deserialize(link); } if (data.TryGetValue("wall", out wall)) { _atachment.wall = VKWallPost.Deserialize(wall); } if (data.TryGetValue("note", out note)) { _atachment.note = VKNote.Deserialize(note); } if (data.TryGetValue("Page", out Page)) { _atachment.Page = VKPage.Deserialize(Page); } return(_atachment); }
public static VKDocument Deserialize(object doc) { var data = (Dictionary <string, object>)doc; var _document = new VKDocument(); object id, owner_id, title, size, ext, url, photo_100, photo_130; if (data.TryGetValue("id", out id)) { _document.id = (long)id; } if (data.TryGetValue("owner_id", out owner_id)) { _document.owner_id = (long)owner_id; } if (data.TryGetValue("title", out title)) { _document.title = (string)title; } if (data.TryGetValue("size", out size)) { _document.size = (long)id; } if (data.TryGetValue("ext", out ext)) { _document.ext = (string)ext; } if (data.TryGetValue("url", out url)) { _document.url = (string)url; } if (data.TryGetValue("photo_100", out photo_100)) { _document.photo_100 = (string)photo_100; } if (data.TryGetValue("photo_130", out photo_130)) { _document.photo_130 = (string)photo_130; } return(_document); }
public static VKDocument Deserialize(object doc) { var data = (Dictionary<string,object>)doc; var _document = new VKDocument (); object id,owner_id,title,size,ext,url,photo_100,photo_130; if(data.TryGetValue("id",out id )) _document.id=(long)id; if(data.TryGetValue("owner_id",out owner_id )) _document.owner_id=(long)owner_id; if(data.TryGetValue("title",out title )) _document.title=(string)title; if(data.TryGetValue("size",out size )) _document.size=(long)id; if(data.TryGetValue("ext",out ext )) _document.ext=(string)ext; if(data.TryGetValue("url",out url )) _document.url=(string)url; if(data.TryGetValue("photo_100",out photo_100 )) _document.photo_100=(string)photo_100; if(data.TryGetValue("photo_130",out photo_130 )) _document.photo_130=(string)photo_130; return _document; }