示例#1
0
        public static VKLink Deserialize(object link)
        {
            var _link=new VKLink();
            var data=(Dictionary<string,object>)link;
            object url,title,description,image_src;

            if(data.TryGetValue("url",out url))
                _link.url=(string)url;
            if(data.TryGetValue("title",out title))
                _link.title=(string)title;
            if(data.TryGetValue("description",out description))
                _link.description=(string)description;
            if(data.TryGetValue("image_src",out image_src))
                _link.image_src=(string)image_src;
            return _link;
        }
        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);
        }
示例#3
0
        public static VKLink Deserialize(object link)
        {
            var    _link = new VKLink();
            var    data = (Dictionary <string, object>)link;
            object url, title, description, image_src;

            if (data.TryGetValue("url", out url))
            {
                _link.url = (string)url;
            }
            if (data.TryGetValue("title", out title))
            {
                _link.title = (string)title;
            }
            if (data.TryGetValue("description", out description))
            {
                _link.description = (string)description;
            }
            if (data.TryGetValue("image_src", out image_src))
            {
                _link.image_src = (string)image_src;
            }
            return(_link);
        }