예제 #1
0
        /// <summary>
        /// Creates an RSS item from an XML node with the
        /// corresponding child nodes (title,description etc.)
        /// </summary>
        /// <param name="xmlNode">The node to extract the details from</param>
        /// <returns>An RssItem object with details taken from the item node.</returns>
        private RssItem getRssItem(XmlNode xmlNode)
        {
            RssItem rssItem = new RssItem();

            for (int i = 0; i < xmlNode.ChildNodes.Count; i++)
            {
                switch (xmlNode.ChildNodes[i].Name)
                {
                case "title":
                {
                    rssItem.Title = xmlNode.ChildNodes[i].InnerText;
                    break;
                }

                case "description":
                {
                    rssItem.Description = xmlNode.ChildNodes[i].InnerText;
                    break;
                }

                case "link":
                {
                    rssItem.Link = xmlNode.ChildNodes[i].InnerText;
                    break;
                }

                case "author":
                {
                    rssItem.Author = xmlNode.ChildNodes[i].InnerText;
                    break;
                }

                case "comments":
                {
                    rssItem.Comments = xmlNode.ChildNodes[i].InnerText;
                    break;
                }

                case "pubdate":
                {
                    rssItem.Pubdate = xmlNode.ChildNodes[i].InnerText;
                    break;
                }

                case "guid":
                {
                    rssItem.Guid = xmlNode.ChildNodes[i].InnerText;
                    break;
                }
                }
            }

            return(rssItem);
        }
예제 #2
0
 public void Add(RssItem rssItem)
 {
     List.Add(rssItem);
 }
예제 #3
0
		public void Add(RssItem rssItem)
		{
			List.Add(rssItem);
		}
예제 #4
0
		/// <summary>
		/// Creates an RSS item from an XML node with the 
		/// corresponding child nodes (title,description etc.)
		/// </summary>
		/// <param name="xmlNode">The node to extract the details from</param>
		/// <returns>An RssItem object with details taken from the item node.</returns>
		private RssItem getRssItem(XmlNode xmlNode)
		{
			RssItem rssItem = new RssItem();

			for (int i=0;i < xmlNode.ChildNodes.Count;i++)
			{					
				switch ( xmlNode.ChildNodes[i].Name )
				{
					case "title":
					{
						rssItem.Title = xmlNode.ChildNodes[i].InnerText;
						break;
					}
					case "description":
					{
						rssItem.Description = xmlNode.ChildNodes[i].InnerText;
						break;
					}
					case "link":
					{
						rssItem.Link = xmlNode.ChildNodes[i].InnerText;
						break;
					}
					case "author":
					{
						rssItem.Author = xmlNode.ChildNodes[i].InnerText;
						break;
					}
					case "comments":
					{
						rssItem.Comments = xmlNode.ChildNodes[i].InnerText;
						break;
					}
					case "pubdate":
					{
						rssItem.Pubdate = xmlNode.ChildNodes[i].InnerText;
						break;
					}
					case "guid":
					{
						rssItem.Guid = xmlNode.ChildNodes[i].InnerText;
						break;
					}
				}
			}

			return rssItem;
		}
 private static IMLItem CreateFeedEntry
     (IMLSection newsSection, RssItem rssItem)
 {
     Debugger.LogMessageToFile("[RSS news downloader] Creating RSS feed entry...");
     IMLItem item = newsSection.AddNewItem(rssItem.Title, rssItem.Link);
     item.ExternalID = rssItem.Link;
     return item;
 }
        private static string PopulateFeedEntryDescription
            (RssItem rssItem, IMLItem item, RssFeed feed)
        {
            Debugger.LogMessageToFile("[RSS news downloader] Populating RSS feed entry...");
            MainImportingEngine.ThisProgress.Progress(MainImportingEngine.CurrentProgress, "Populating feed entry " + feed.Title + "...");

            string description = rssItem.Description;
            string cleanDescription = Helpers.CleanHtml(description);
            item.Tags["description"] = cleanDescription;
            return description;
        }
        private static void PopulateAdditionalFeedEntryDetails
            (RssItem rssItem, IMLItem item, RssFeed feed)
        {
            item.Tags["FeedDescription"] = feed.Description;

            item.Tags["FeedTitle"] = feed.Title;
            item.Tags["Author"] = rssItem.Author;
            item.Tags["Channel"] = feed.Category;
            item.Tags["pubDate"] = rssItem.Pubdate;
            item.Tags["guid"] = rssItem.Guid;

            item.SaveTags();
        }
        private static void PopulateFeedEntry(WebClient webClient, 
            RssItem rssItem, IMLItem item, RssFeed feed)
        {

            var description = PopulateFeedEntryDescription(rssItem, item, feed);

            DownloadFeedImage(webClient, item, description);

            PopulateAdditionalFeedEntryDetails(rssItem, item, feed);

        }