Example #1
0
        public static VKPrivacy Deserialize(object Privacy)
        {
            VKPrivacy _privacy = new VKPrivacy();
            var       data = (Dictionary <string, object>)Privacy;
            object    type, users, lists, except_lists, except_users;

            if (data.TryGetValue("type", out type))
            {
                _privacy.type = (string)type;
            }
            if (data.TryGetValue("users", out users))
            {
                _privacy.users = new List <long>();
                ((List <object>)users).ForEach(i => _privacy.users.Add((long)i));
            }
            if (data.TryGetValue("lists", out lists))
            {
                _privacy.lists = new List <long>();
                ((List <object>)lists).ForEach(i => _privacy.lists.Add((long)i));
            }
            if (data.TryGetValue("except_lists", out except_lists))
            {
                _privacy.except_lists = new List <long>();
                ((List <object>)except_lists).ForEach(i => _privacy.except_lists.Add((long)i));
            }
            if (data.TryGetValue("except_users", out except_users))
            {
                _privacy.except_users = new List <long>();
                ((List <object>)except_users).ForEach(i => _privacy.except_users.Add((long)i));
            }
            return(_privacy);
        }
Example #2
0
        public static VKPrivacy Deserialize(object Privacy)
        {
            VKPrivacy _privacy=new VKPrivacy();
            var data=(Dictionary<string,object>)Privacy;
            object type,users,lists,except_lists,except_users;

            if(data.TryGetValue("type",out type))
                _privacy.type=(string)type;
            if (data.TryGetValue ("users", out users)) {
                _privacy.users = new List<long>();
                ((List<object>)users).ForEach(i=>_privacy.users.Add((long)i));
            }
            if (data.TryGetValue ("lists", out lists)) {
                _privacy.lists = new List<long>();
                ((List<object>)lists).ForEach(i=>_privacy.lists.Add((long)i));
            }
            if (data.TryGetValue ("except_lists", out except_lists)) {
                _privacy.except_lists = new List<long>();
                ((List<object>)except_lists).ForEach(i=>_privacy.except_lists.Add((long)i));
            }
            if (data.TryGetValue ("except_users", out except_users)) {
                _privacy.except_users = new List<long>();
                ((List<object>)except_users).ForEach(i=>_privacy.except_users.Add((long)i));
            }
            return _privacy;
        }
Example #3
0
        public static VKAlbum Deserialize(object Album)
        {
            var    data = (Dictionary <string, object>)Album;
            var    _album = new VKAlbum();
            object id, thumb_id, owner_id, title, description, created, updated, size, thumb_src, privacy_view, privacy_comment;

            if (data.TryGetValue("id", out id))
            {
                _album.id = (string)id;
            }
            if (data.TryGetValue("thumb_id", out thumb_id))
            {
                _album.thumb_id = (string)thumb_id;
            }
            if (data.TryGetValue("owner_id", out owner_id))
            {
                _album.owner_id = (string)owner_id;
            }
            if (data.TryGetValue("title", out title))
            {
                _album.title = (string)title;
            }
            if (data.TryGetValue("description", out description))
            {
                _album.description = (string)description;
            }
            if (data.TryGetValue("created", out created))
            {
                _album.created = (string)created;
            }

            if (data.TryGetValue("updated", out updated))
            {
                _album.updated = (string)updated;
            }

            if (data.TryGetValue("size", out size))
            {
                _album.size = (int)(long)size;
            }

            if (data.TryGetValue("thumb_src", out thumb_src))
            {
                _album.thumb_src = (string)thumb_src;
            }

            if (data.TryGetValue("privacy_view", out privacy_view))
            {
                _album.privacy_view = VKPrivacy.Deserialize(privacy_view);
            }

            if (data.TryGetValue("privacy_comment", out privacy_comment))
            {
                _album.privacy_comment = VKPrivacy.Deserialize(privacy_comment);
            }
            return(_album);
        }