예제 #1
0
        public static MediaItemMetadata ParseInMembers(IEnumerable <XElement> members)
        {
            MediaItemMetadata meta = new MediaItemMetadata();

            meta.width  = members.ParseInMember("width", MemberValueTypes.@int).ToInt32();
            meta.height = members.ParseInMember("height", MemberValueTypes.@int).ToInt32();
            meta.file   = members.ParseInMember("file", MemberValueTypes.@string);

            //sizes
            List <XElement> sizes = members
                                    .Where(x => x.Element("name").Value.Equals("sizes"))
                                    .FirstOrDefault()
                                    .Element("value").Element("struct").Elements("member").ToList();

            List <MediaItemSize> sizeList = new List <MediaItemSize>();

            foreach (XElement elem in sizes)
            {
                sizeList.Add(MediaItemSize.ParseInMembers(elem.Element("value").Element("struct").Elements("member")));
            }

            meta.sizes = sizeList.ToArray();

            //Image Meta Data
            XElement imageMetaElement = members
                                        .Where(x => x.Element("name").Value.Equals("image_meta"))
                                        .FirstOrDefault();

            meta.imageMeta = PostThumbnailImageMeta.ParseInMembers(imageMetaElement.Element("value").Element("struct").Elements("member"));

            return(meta);
        }
예제 #2
0
        public static MediaItemSize ParseInMembers(IEnumerable <XElement> members)
        {
            MediaItemSize size = new MediaItemSize();

            size.file      = members.ParseInMember("file", MemberValueTypes.@string);
            size.width     = members.ParseInMember("width", MemberValueTypes.@int).ToInt32();
            size.height    = members.ParseInMember("height", MemberValueTypes.@int).ToInt32();
            size.mime_type = members.ParseInMember("mime-type", MemberValueTypes.@string);


            return(size);
        }