コード例 #1
0
        private static T LoadFromRssXml <T>(string rssXml) where T : RssDocumentBase
        {
            if (string.IsNullOrEmpty(rssXml))
            {
                throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "The argument '{0}' is Null or Empty", "xml"));
            }

            T rss = RssXmlHelper.DeserializeFromXmlUsingStringReader <T>(rssXml);

            return(rss);
        }
コード例 #2
0
        private static T LoadFromRssXml <T>(string rssXml) where T : RssDocumentBase
        {
            if (string.IsNullOrEmpty(rssXml))
            {
                throw new ArgumentException("xml");
            }

            T rss = RssXmlHelper.DeserializeFromXmlUsingStringReader <T>(rssXml);

            return(rss);
        }
コード例 #3
0
        private static T LoadFromRssXml <T>(string rssXml) where T : RssDocumentBase
        {
            if (string.IsNullOrEmpty(rssXml))
            {
                throw new ArgumentException(string.Format(Resources.RssToolkit.Culture, Resources.RssToolkit.ArgmentException, "xml"));
            }

            T rss = RssXmlHelper.DeserializeFromXmlUsingStringReader <T>(rssXml);

            return(rss);
        }
コード例 #4
0
        public static T LoadRssFromOpmlUrl <T>(string url) where T : RssDocumentBase
        {
            if (string.IsNullOrEmpty(url))
            {
                throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "The argument '{0}' is Null or Empty", "url"));
            }

            // resolve app-relative URLs
            url = RssXmlHelper.ResolveAppRelativeLinkToUrl(url);

            RssAggregator aggregator = new RssAggregator();

            aggregator.Load(new System.Uri(url));
            string rssXml = aggregator.RssXml;

            return(RssXmlHelper.DeserializeFromXmlUsingStringReader <T>(rssXml));
        }