Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ItunesChannel"/> class.
        /// </summary>
        /// <param name="channelElement"></param>
        public ItunesChannel(XElement channelElement)
        {
            Author     = channelElement.GetValue(NAMESPACEPREFIX, "author");
            Block      = channelElement.GetValue(NAMESPACEPREFIX, "block").EqualsIgnoreCase("yes");
            Categories = GetItunesCategories(channelElement);

            var imageElement = channelElement.GetElement(NAMESPACEPREFIX, "image");

            if (imageElement != null)
            {
                Image = new ItunesImage(imageElement);
            }

            var explicitValue = channelElement.GetValue(NAMESPACEPREFIX, "explicit");

            Explicit = explicitValue.EqualsIgnoreCase("yes", "explicit", "true");

            Complete = channelElement.GetValue(NAMESPACEPREFIX, "complete").EqualsIgnoreCase("yes");

            if (Uri.TryCreate(channelElement.GetValue(NAMESPACEPREFIX, "new-feed-url"), UriKind.Absolute, out var newFeedUrl))
            {
                NewFeedUrl = newFeedUrl;
            }

            var ownerElement = channelElement.GetElement(NAMESPACEPREFIX, "owner");

            if (ownerElement != null)
            {
                Owner = new ItunesOwner(ownerElement);
            }

            Subtitle = channelElement.GetValue(NAMESPACEPREFIX, "subtitle");
            Summary  = channelElement.GetValue(NAMESPACEPREFIX, "summary");
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ItunesItem"/> class.
        /// </summary>
        /// <param name="itemElement"></param>
        public ItunesItem(XElement itemElement)
        {
            Author = itemElement.GetValue(ItunesChannel.NAMESPACEPREFIX, "author");
            Block  = itemElement.GetValue(ItunesChannel.NAMESPACEPREFIX, "block").EqualsIgnoreCase("yes");
            var imageElement = itemElement.GetElement(ItunesChannel.NAMESPACEPREFIX, "image");

            if (imageElement != null)
            {
                Image = new ItunesImage(imageElement);
            }

            var duration = itemElement.GetValue(ItunesChannel.NAMESPACEPREFIX, "duration");

            Duration = ParseDuration(duration);

            var explicitValue = itemElement.GetValue(ItunesChannel.NAMESPACEPREFIX, "explicit");

            Explicit = explicitValue.EqualsIgnoreCase("yes", "explicit", "true");

            IsClosedCaptioned = itemElement.GetValue(ItunesChannel.NAMESPACEPREFIX, "isClosedCaptioned").EqualsIgnoreCase("yes");

            if (int.TryParse(itemElement.GetValue(ItunesChannel.NAMESPACEPREFIX, "order"), out var order))
            {
                Order = order;
            }

            Subtitle = itemElement.GetValue(ItunesChannel.NAMESPACEPREFIX, "subtitle");
            Summary  = itemElement.GetValue(ItunesChannel.NAMESPACEPREFIX, "summary");
        }