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);
        }
示例#2
0
        void OnPhotoSaved(VKRequest arg1)
        {
            if (arg1.error != null)
            {
                _callbackFunction(arg1);
                return;
            }

            var dict  = Json.Deserialize(arg1.response) as Dictionary <string, object>;
            var resp  = (List <object>)dict["response"];
            var photo = VKPhoto.Deserialize(resp [0]);

            _photoIds.Add(photo.id);
            _imagesToUpload--;
            if (_imagesToUpload == 0)
            {
                PostToWall(RepeatRequest);
            }
        }
示例#3
0
        public static VKPhoto Deserialize(object photo)
        {
            var    data = (Dictionary <string, object>)photo;
            var    _photo = new VKPhoto();
            object id, album_id, owner_id, user_id, photo_75, photo_130, photo_604, photo_807, photo_1280, photo_2560;

            if (data.TryGetValue("id", out id))
            {
                _photo.id = (long)id;
            }
            if (data.TryGetValue("album_id", out album_id))
            {
                _photo.album_id = (long)album_id;
            }
            if (data.TryGetValue("owner_id", out owner_id))
            {
                _photo.owner_id = (long)owner_id;
            }
            if (data.TryGetValue("user_id", out user_id))
            {
                _photo.user_id = (long)user_id;
            }
            if (data.TryGetValue("photo_75", out photo_75))
            {
                _photo.photo_75 = (string)photo_75;
            }
            if (data.TryGetValue("photo_130", out photo_130))
            {
                _photo.photo_130 = (string)photo_130;
            }
            if (data.TryGetValue("photo_604", out photo_604))
            {
                _photo.photo_604 = (string)photo_604;
            }
            if (data.TryGetValue("photo_807", out photo_807))
            {
                _photo.photo_807 = (string)photo_807;
            }
            if (data.TryGetValue("photo_1280", out photo_1280))
            {
                _photo.photo_1280 = (string)photo_1280;
            }
            if (data.TryGetValue("photo_2560", out photo_2560))
            {
                _photo.photo_2560 = (string)photo_2560;
            }

            object width, height, text, date;

            if (data.TryGetValue("width", out width))
            {
                _photo.width = (int)(long)width;
            }
            if (data.TryGetValue("height", out height))
            {
                _photo.height = (int)(long)height;
            }
            if (data.TryGetValue("text", out text))
            {
                _photo.text = (string)text;
            }
            if (data.TryGetValue("date", out date))
            {
                _photo.date = (int)(long)date;
            }

            return(_photo);
        }
示例#4
0
        public static VKPhoto Deserialize(object photo)
        {
            var data=(Dictionary<string,object>)photo;
            var _photo=new VKPhoto();
            object id, album_id, owner_id, user_id, photo_75, photo_130, photo_604, photo_807, photo_1280, photo_2560;

            if (data.TryGetValue ("id", out id))
                _photo.id = (long)id;
            if (data.TryGetValue ("album_id", out album_id))
                _photo.album_id = (long)album_id;
            if (data.TryGetValue ("owner_id", out owner_id))
                _photo.owner_id = (long)owner_id;
            if (data.TryGetValue ("user_id", out user_id))
                _photo.user_id = (long)user_id;
            if (data.TryGetValue ("photo_75", out photo_75))
                _photo.photo_75 = (string)photo_75;
            if (data.TryGetValue ("photo_130", out photo_130))
                _photo.photo_130 = (string)photo_130;
            if (data.TryGetValue ("photo_604", out photo_604))
                _photo.photo_604 = (string)photo_604;
            if (data.TryGetValue ("photo_807", out photo_807))
                _photo.photo_807 = (string)photo_807;
            if (data.TryGetValue ("photo_1280", out photo_1280))
                _photo.photo_1280 = (string)photo_1280;
            if (data.TryGetValue ("photo_2560", out photo_2560))
                _photo.photo_2560 = (string)photo_2560;

            object width, height, text, date;

            if (data.TryGetValue ("width", out width))
                _photo.width = (int)(long)width;
            if (data.TryGetValue ("height", out height))
                _photo.height = (int)(long)height;
            if (data.TryGetValue ("text", out text))
                _photo.text = (string)text;
            if (data.TryGetValue ("date", out date))
                _photo.date = (int)(long)date;

            return _photo;
        }