示例#1
0
        public MediaEntity(Dictionary <String, object> media_entity)
        {
            id              = media_entity.GetProp("id") as long?;
            id_str          = media_entity.GetProp("id_str") as string;
            media_url       = media_entity.GetProp("media_url") as string;
            media_url_https = media_entity.GetProp("media_url_https") as string;

            ObservableCollection <int> indices = new ObservableCollection <int>();

            foreach (int indice in media_entity.GetProp("indices") as object[])
            {
                indices.Add(indice);
            }


            url = new UrlEntity()
            {
                url          = media_entity.GetProp("url") as string,
                display_url  = media_entity.GetProp("display_url") as string,
                expanded_url = media_entity.GetProp("expanded_url") as string,
                indices      = indices
            };

            type = media_entity.GetProp("type") as string;

            sizes = new Dictionary <string, MediaEntitySize>();
            Dictionary <String, object> tmp_sizes = media_entity.GetProp("sizes") as Dictionary <String, object>;

            foreach (object size in tmp_sizes)
            {
                KeyValuePair <String, object> pair = (KeyValuePair <String, object>)size;
                sizes.Add(pair.Key, new MediaEntitySize(pair.Value as Dictionary <String, object>));
            }
        }
示例#2
0
        public MediaEntity(Dictionary<String, object> media_entity)
        {
            id = media_entity.GetProp("id") as long?;
            id_str = media_entity.GetProp("id_str") as string;
            media_url = media_entity.GetProp("media_url") as string;
            media_url_https = media_entity.GetProp("media_url_https") as string;

            ObservableCollection<int> indices = new ObservableCollection<int>();

            foreach (int indice in media_entity.GetProp("indices") as object[])
            {
                indices.Add(indice);
            }

            url = new UrlEntity()
            {
                url = media_entity.GetProp("url") as string,
                display_url = media_entity.GetProp("display_url") as string,
                expanded_url = media_entity.GetProp("expanded_url") as string,
                indices = indices
            };

            type = media_entity.GetProp("type") as string;

            sizes = new Dictionary<string, MediaEntitySize>();
            Dictionary<String, object> tmp_sizes = media_entity.GetProp("sizes") as Dictionary<String, object>;

            foreach (object size in tmp_sizes)
            {
                KeyValuePair<String, object> pair = (KeyValuePair<String, object>)size;
                sizes.Add(pair.Key, new MediaEntitySize(pair.Value as Dictionary<String, object>));
            }
        }