コード例 #1
0
        private void ParseDocument()
        {
            XmlNode rssNode;

            XmlElement root = document.DocumentElement;

            if (!(root.Name == "rss"))
            {
                return;
            }

            rssNode     = root;
            channelNode = null;

            foreach (XmlNode childNode in rssNode.ChildNodes)
            {
                if (childNode.Name == "channel")
                {
                    channelNode = childNode;
                }
            }

            foreach (XmlNode childNode in channelNode.ChildNodes)
            {
                RssItem rssItem = new RssItem();

                rssItem.Feed = uri;

                foreach (XmlNode childNodeNode in childNode.ChildNodes)
                {
                    if (childNodeNode.Name == "title")
                    {
                        rssItem.Title = childNodeNode.InnerText;
                    }
                    if (childNodeNode.Name == "link")
                    {
                        rssItem.Link = childNodeNode.InnerText;
                    }
                    if (childNodeNode.Name == "pubDate")
                    {
                        rssItem.Pubdate = childNodeNode.InnerText;
                    }
                    if (childNodeNode.Name == "description")
                    {
                        rssItem.Pubdate = childNodeNode.InnerText;
                    }
                }

                if (rssItem.Link != string.Empty)
                {
                    items.Add(rssItem);
                }
            }
        }
コード例 #2
0
ファイル: RssReader.cs プロジェクト: AssassinUKG/monotorrent
		private void ParseDocument()
		{
			XmlNode rssNode;
			
			XmlElement root = document.DocumentElement;
			
			if(!(root.Name == "rss"))
				return;
				
			rssNode = root;
			channelNode = null;
			
			foreach (XmlNode childNode in rssNode.ChildNodes){
				if(childNode.Name == "channel")
					channelNode = childNode;
			}
						
			foreach(XmlNode childNode in channelNode.ChildNodes){
				RssItem rssItem = new RssItem();
				
				rssItem.Feed = uri;
				
				foreach(XmlNode childNodeNode in childNode.ChildNodes){
					if(childNodeNode.Name == "title")
						rssItem.Title = childNodeNode.InnerText;
					if(childNodeNode.Name == "link")
						rssItem.Link = childNodeNode.InnerText;
					if(childNodeNode.Name == "pubDate")
						rssItem.Pubdate = childNodeNode.InnerText;
					if(childNodeNode.Name == "description")
						rssItem.Pubdate = childNodeNode.InnerText;
				}
				
				if(rssItem.Link != string.Empty)
					items.Add(rssItem);
			}
			
		}
コード例 #3
0
		public TorrentRssWatcherEventArgs(RssFilter matchedFilter, RssItem item) : base(item.Link)
		{
			this.matchedFilter = matchedFilter;
			this.item = item;
		}
コード例 #4
0
 public TorrentRssWatcherEventArgs(RssFilter matchedFilter, RssItem item) : base(item.Link)
 {
     this.matchedFilter = matchedFilter;
     this.item          = item;
 }
コード例 #5
0
		// FIXME: Adding torrents not on the main loop, will throw up!
		// Solutions: Pop every add onto main loop resulting in blocking
		// or add async Load(uri, location) to library, or let the GUI
		// program handle downloading the torrent file 
		public void AddTorrent(RssItem item, RssFilter filter)
		{
			history.Add(item);
			
			if(filter == null){
				Console.Out.WriteLine("About to add with default savepath, URL: " + item.Link);
				try {
					controller.Add(item.Link);
				} catch {
					//logger.Error("RSS Manager: Unable to add - " + item.Title);
				}
			}
			else {
				Console.Out.WriteLine("About to add with custom savepath, Path: " + filter.SavePath);
				try{
					controller.Add(item.Link, new TorrentSettings(), filter.SavePath);
				} catch {
					//logger.Error("RSS Manager: Unabled to add - " + item.Title);
				}
			}
		}
コード例 #6
0
		private void RaiseTorrentLost(RssFilter filter, RssItem item)
		{
			if(TorrentLost != null)
				TorrentLost(this, new TorrentRssWatcherEventArgs(filter, item));
		}