/// <summary>
        /// Parses the given <see cref="FeedType"/> and returns a <see cref="IList&lt;Item&gt;"/>.
        /// </summary>
        /// <returns></returns>
        public IList<Item> Parse(Feed feed)
        {
            try
            {
                _cleaner = FeedCleaner.ResolveCleaner(feed);

                // Make sure we fill the original state object, not the 'info' variable which is a copy.
                switch (feed.FeedType)
                {
                    case FeedType.RSS:
                        return ParseRss(feed);
                    case FeedType.RDF:
                        return ParseRdf(feed);
                    case FeedType.Atom:
                        return ParseAtom(feed);
                    default:
                        throw new NotSupportedException(string.Format("{0} is not supported", feed.FeedType.ToString()));
                }
            }
            catch (Exception e)
            {
                Logger.Info("An Exception occured with FeedFetcher.Parse:\n\n{0}", e);
                return new List<Item>();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Parses the given <see cref="FeedType"/> and returns a <see cref="IList&lt;Item&gt;"/>.
        /// </summary>
        /// <returns></returns>
        public IList <Item> Parse(Feed feed)
        {
            try
            {
                _cleaner = FeedCleaner.ResolveCleaner(feed);


                // Make sure we fill the original state object, not the 'info' variable which is a copy.
                switch (feed.FeedType)
                {
                case FeedType.RSS:
                    return(ParseRss(feed));

                case FeedType.RDF:
                    return(ParseRdf(feed));

                case FeedType.Atom:
                    return(ParseAtom(feed));

                default:
                    throw new NotSupportedException(string.Format("{0} is not supported", feed.FeedType.ToString()));
                }
            }
            catch (Exception e)
            {
                Logger.Info("An Exception occured with FeedFetcher.Parse:\n\n{0}", e);
                return(new List <Item>());
            }
        }