示例#1
0
        public List <Dictionary <String, String> > UnpackMedia(ArticleProperties property)
        {
            if (property != ArticleProperties.ChildImages && property != ArticleProperties.ChildVideos)
            {
                throw new ArgumentException("Property type invalid.");
            }

            List <Dictionary <String, String> > returnPack = new List <Dictionary <string, string> >();

            var array = this.GetProperty(property);

            if (array != null && array is Newtonsoft.Json.Linq.JArray)
            {
                foreach (var child in (array as Newtonsoft.Json.Linq.JArray).Children())
                {
                    String id    = child[Article.MEDIA_ID].ToString();
                    String orig  = child[Article.MEDIA_ORIG_URI].ToString();
                    String inter = child[Article.MEDIA_INTERNAL_URI].ToString();

                    Dictionary <String, String> filePack = new Dictionary <string, string>();
                    filePack.Add(Article.MEDIA_ID, id);
                    filePack.Add(Article.MEDIA_ORIG_URI, orig);
                    filePack.Add(Article.MEDIA_INTERNAL_URI, inter);
                    returnPack.Add(filePack);
                }
            }

            return(returnPack);
        }
示例#2
0
        public object GetProperty(ArticleProperties prop)
        {
            String name = prop.JsonName();

            object returnValue = null;

            if (this.Properties.ContainsKey(name))
            {
                returnValue = this.Properties[name];
            }

            return(returnValue);
        }
示例#3
0
        public void SetProperty(ArticleProperties prop, object value)
        {
            String name = prop.JsonName();

            this.Properties[name] = value;
        }