/// <summary> /// Starts loading the feed and initializing the reader for the feed type. /// </summary> /// <returns></returns> public async Task<IEnumerable<RssSchema>> Load() { string xmlContent = await DownloadAsync(_uri); var doc = XDocument.Parse(xmlContent); if (doc.Declaration.Encoding != null) { if (!doc.Declaration.Encoding.EqualNoCase("UTF-8")) { try { base.Encoding = Encoding.GetEncoding(doc.Declaration.Encoding); xmlContent = await DownloadAsync(_uri); doc = XDocument.Parse(xmlContent); } catch { } } } var type = BaseRssReader.GetFeedType(doc); BaseRssReader rssReader; if (type == RssType.Rss) rssReader = new RssReader(); else rssReader = new AtomReader(); return rssReader.LoadFeed(doc).Take(20); }
/// <summary> /// Starts loading the feed and initializing the reader for the feed type. /// </summary> /// <returns></returns> public async Task<ObservableCollection<RssSchema>> Load() { string xmlContent = await DownloadAsync(); var doc = XDocument.Parse(xmlContent); var type = BaseRssReader.GetFeedType(doc); BaseRssReader rssReader; if (type == RssType.Rss) rssReader = new RssReader(); else rssReader = new AtomReader(); return rssReader.LoadFeed(doc); }