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);
        }
Exemple #2
0
        public static VKNote Deserialize(object note)
        {
            var    data = (Dictionary <string, object>)note;
            var    _note = new VKNote();
            object id, user_id, owner_id, title, text, comments, read_comments, view_url;

            if (data.TryGetValue("id", out id))
            {
                _note.id = (long)id;
            }
            if (data.TryGetValue("user_id", out user_id))
            {
                _note.user_id = (long)user_id;
            }
            if (data.TryGetValue("owner_id", out owner_id))
            {
                _note.owner_id = (long)owner_id;
            }
            if (data.TryGetValue("text", out text))
            {
                _note.text = (string)text;
            }
            if (data.TryGetValue("title", out title))
            {
                _note.title = (string)title;
            }
            if (data.TryGetValue("comments", out comments))
            {
                _note.comments = (int)(long)comments;
            }
            if (data.TryGetValue("read_comments", out read_comments))
            {
                _note.read_comments = (int)(long)read_comments;
            }
            if (data.TryGetValue("view_url", out view_url))
            {
                _note.view_url = (string)view_url;
            }
            return(_note);
        }
Exemple #3
0
 public static VKNote Deserialize(object note)
 {
     var data = (Dictionary<string,object>)note;
     var _note = new VKNote ();
     object id, user_id, owner_id, title, text, comments, read_comments, view_url;
     if(data.TryGetValue("id",out id ))
         _note.id=(long)id;
     if(data.TryGetValue("user_id",out user_id ))
         _note.user_id=(long)user_id;
     if(data.TryGetValue("owner_id",out owner_id ))
         _note.owner_id=(long)owner_id;
     if(data.TryGetValue("text",out text ))
         _note.text=(string)text;
     if(data.TryGetValue("title",out title ))
         _note.title=(string)title;
     if(data.TryGetValue("comments",out comments ))
         _note.comments=(int)(long)comments;
     if(data.TryGetValue("read_comments",out read_comments ))
         _note.read_comments=(int)(long)read_comments;
     if(data.TryGetValue("view_url",out view_url ))
         _note.view_url=(string)view_url;
     return _note;
 }