Exemple #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);
        }
        public static PostThumbnailImageMeta ParseInMembers(IEnumerable <XElement> members)
        {
            PostThumbnailImageMeta meta = new PostThumbnailImageMeta();

            meta.aperture      = members.ParseInMember("aperture", MemberValueTypes.@int).ToInt32();
            meta.credit        = members.ParseInMember("credit", MemberValueTypes.@string);
            meta.camera        = members.ParseInMember("camera", MemberValueTypes.@string);
            meta.caption       = members.ParseInMember("caption", MemberValueTypes.@string);
            meta.copyright     = members.ParseInMember("copyright", MemberValueTypes.@string);
            meta.focal_length  = members.ParseInMember("focal_length", MemberValueTypes.@int).ToInt32();
            meta.iso           = members.ParseInMember("iso", MemberValueTypes.@int).ToInt32();
            meta.shutter_speed = members.ParseInMember("shutter_speed", MemberValueTypes.@int).ToInt32();
            meta.title         = members.ParseInMember("title", MemberValueTypes.@string);

            return(meta);
        }