protected void Page_Load(object sender, EventArgs e)
        {
            using (RssReader rss = new RssReader())
            {
                rss.FeedUrl = "https://channel9.msdn.com/feeds/rss";
                foreach (RssItem item in rss.Execute())
                {
                    //Response.Write(item.Title + "<br />");
                    //listBox1.Items.Add(item.Title);
                    //row = new DataGridViewRow;
                    //row.Cells[1].Value = item.Title;
                    //row.Cells[2].Value = item.Description;
                    //grid.Rows.Add(item.Date, item.Title, item.Description, item.LinkFeed);
                    TableRow  tRow       = new TableRow();
                    TableCell tCelltitle = new TableCell();
                    tCelltitle.Text = item.Title;
                    tRow.Cells.Add(tCelltitle);
                    TableCell tCelllink = new TableCell();
                    tCelllink.Text = "<a href='" + item.LinkFeed + "'>View</a>";
                    tRow.Cells.Add(tCelllink);
                    FeedTable.Rows.Add(tRow);
                }

                //grid.Sort(this.grid.Columns["date"], ListSortDirection.Descending);
            }
        }
Beispiel #2
0
    // private TimeSpan _UpdateFrequenzy;
    /// <summary>
    /// Gets the time before the feed get's silently updated.
    /// Is TimeSpan.Zero unless the CreateAndCache method has been used.
    /// </summary>
    // public TimeSpan UpdateFrequenzy
    //{
    // get { return _UpdateFrequenzy; }
    //}

    #endregion

    #region Methods



    public static RssReader Create(string feedUrl)
    {
        RssReader reader = new RssReader(feedUrl);

        reader.Execute();
        return(reader);
    }
        private void SendDownloadQuery()
        {
            while (ThreadStopCheck)
            {
                RssReader rss = new RssReader();
                rss.FeedUrl = "https://www.tokyotosho.info/rss.php?filter=1,10,7";

                foreach (RssItem item in rss.Execute())
                {
                    int i = 0;

                    for (int j = 0; j < Ani.Count; j++)
                    {
                        item.Title.Replace('_', ' ');

                        if (item.Title.Contains("1280x720") || item.Title.Contains("1920x1080") ||
                            item.Title.Contains("1080p") || item.Title.Contains("720p"))
                        {
                            item.Title.Replace("1280x720", "");
                            item.Title.Replace("1920x1080", "");
                            item.Title.Replace("1080p", "");
                            item.Title.Replace("720p", "");

                            if (item.Title.Contains(Ani[j].name) && item.Title.Contains(Ani[j].Ep))
                            {
                                WebClient webClient = new WebClient();
                                webClient.DownloadFileCompleted   += new AsyncCompletedEventHandler(fake2);
                                webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(fake);
                                webClient.DownloadFileAsync(new Uri(item.Link), item.Title + ".torrent");

                                int Ep = Convert.ToInt32(Ani[j].Ep);
                                ++Ep;
                                AniName Variable = Ani[j];
                                Variable.Ep = Convert.ToString(Ep);
                                Ani[i]      = Variable;
                                TweetToPerson(Ani[j], list_TweetUser);
                            }

                            i++;
                        }
                    }
                }
                int timerCheck = 0;
                while (ThreadStopCheck && timerCheck < 10000)
                {
                    Thread.Sleep(1);
                    timerCheck++;
                }
            }

            this.Invoke(new MethodInvoker(delegate()
            {
                bt_Refresh.Enabled = true;
            }));
            Thread.CurrentThread.Abort();
        }
Beispiel #4
0
 /// <summary>
 /// Retrieves the remote RSS feed and inserts it into the cache
 /// when it has expired.
 /// </summary>
 private static void RefreshCache(string key, object item, CacheItemRemovedReason reason)
 {
     if (reason != CacheItemRemovedReason.Removed)
     {
         string    feedUrl = key.Replace("RssReader_", String.Empty);
         RssReader reader  = new RssReader(feedUrl);
         reader.Execute();
         reader._UpdateFrequenzy = ((RssReader)item).UpdateFrequenzy;
         HttpRuntime.Cache.Add("RssReader_" + feedUrl, reader, null, DateTime.Now.Add(reader.UpdateFrequenzy), Cache.NoSlidingExpiration, CacheItemPriority.Normal, RefreshCache);
     }
 }
Beispiel #5
0
    /// <summary>
    /// Creates an RssReader instance from the specified URL
    /// and inserts it into the cache. When it expires from the cache,
    /// it automatically retrieves the remote RSS feed and inserts it
    /// to the cache again.
    /// </summary>
    /// <param name="feedUrl">The URI of the RSS feed.</param>
    /// <param name="updateFrequenzy">The time before it should update it self.</param>
    /// <returns>An instance of the RssReader class.</returns>
    public static RssReader CreateAndCache(string feedUrl, TimeSpan updateFrequenzy)
    {
        if (HttpRuntime.Cache["RssReader_" + feedUrl] == null)
        {
            RssReader reader = new RssReader(feedUrl);
            reader.Execute();
            reader._UpdateFrequenzy = updateFrequenzy;
            HttpRuntime.Cache.Add("RssReader_" + feedUrl, reader, null, DateTime.Now.Add(updateFrequenzy), Cache.NoSlidingExpiration, CacheItemPriority.Normal, RefreshCache);
        }

        return((RssReader)HttpContext.Current.Cache["RssReader_" + feedUrl]);
    }
        public void ProcessFeed()
        {
            try
            {
                _logger.Log("ProcessFeed() called...", LogCategory.Information);

                using (var rss = new RssReader(ConfigurationManager.AppSettings["FeedUrl"]))
                {
                    var items         = rss.Execute().ToList();
                    var newNofication = new List <RssItem>();

                    if (items.Count <= 0)
                    {
                        return;
                    }

                    try
                    {
                        using (IDataContext dataContext = _dataContextFactory.Create(ConnectionType.Ip))
                        {
                            var notifications = dataContext.Query <NotificationMessage>().ToList();

                            newNofication.AddRange(notifications.Any()
                                ? items.Where(rssItem => notifications.All(n => n.StartDate != rssItem.Date))
                                : items);

                            foreach (var rssNotification in newNofication)
                            {
                                var notification = new NotificationMessage
                                {
                                    Text           = rssNotification.Title,
                                    Link           = rssNotification.Link,
                                    StartDate      = rssNotification.Date,
                                    EndDate        = rssNotification.ExpireOn,
                                    NotificationId = Guid.NewGuid()
                                };

                                dataContext.Add(notification);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        LogException(ex);
                    }
                }
            }
            catch (Exception ex)
            {
                LogException(ex);
            }
        }
Beispiel #7
0
        public static ICollection <string> GetFeeds()
        {
            var titles = new List <string>();

            using (var reader = new RssReader("http://idnes.cz.feedsportal.com/c/34387/f/625936/index.rss"))
            {
                titles.AddRange(reader.Execute().Select(i => i.Title));
            }
            using (var reader = new RssReader("http://idnes.cz.feedsportal.com/c/34387/f/625937/index.rss"))
            {
                titles.AddRange(reader.Execute().Select(i => i.Title));
            }
            return(titles);
        }
 public static RssReader Create(string feedUrl)
 {
     RssReader reader = new RssReader(feedUrl);
     reader.Execute();
     return reader;
 }
Beispiel #9
0
 /// <summary>
 /// Retrieves the remote RSS feed and inserts it into the cache
 /// when it has expired.
 /// </summary>
 private static void RefreshCache(string key, object item, CacheItemRemovedReason reason)
 {
     if (reason != CacheItemRemovedReason.Removed)
     {
         string feedUrl = key.Replace("RssReader_", String.Empty);
         RssReader reader = new RssReader(feedUrl);
         reader.Execute();
         reader._UpdateFrequency = ((RssReader)item).UpdateFrequency;
         HttpRuntime.Cache.Add("RssReader_" + feedUrl, reader, null, DateTime.Now.Add(reader.UpdateFrequency), Cache.NoSlidingExpiration, CacheItemPriority.Normal, RefreshCache);
     }
 }
Beispiel #10
0
    /// <summary>
    /// Get News Feeds from the assigned RSS Aggregator.
    /// </summary>
    /// <param name="feedURL">URL to fetch the news feed.</param>
    /// <param name="alreadySelectedStocks">The Symbols of User selected Stocks, in CSV format.</param>
    /// <returns>A string containing (News Title, News Link)</returns>
    public string LoadPerStockNews(string feedURL, string alreadySelectedStocks)
    {
        string newsFeeds = "";

        if (isShowNews)
        {
            GUIVariables gui = new GUIVariables();
            using (RssReader rss = new RssReader())
            {
                rss.FeedUrl = feedURL + alreadySelectedStocks;

                foreach (RssItem item in rss.Execute())
                {
                    //  string makeLink = item.Title + "    " + "[" + "<a href='" + item.Link + "' target='_blank'>" + "link" + "</a>" + "]";
                    //  newsFeeds = newsFeeds + makeLink + "    " + gui.LineBreak;

                    string makeLink = gui.RedFontStart + ">>" + gui.RedFontEnd
                        + "<a href='" + item.Link + "' style=\"text-decoration:none; font-family:Verdana;\" target='_blank'>" + item.Title + "</a>";
                    newsFeeds = newsFeeds + makeLink + "    " + gui.LineBreak;
                }
            }
        }
        return newsFeeds;
    }
Beispiel #11
0
    /// <summary>
    /// Get News Feeds from the assigned RSS Aggregator.
    /// </summary>
    /// <param name="alreadySelectedStocks">The Symbols of User selected Stocks, in CSV format.</param>
    /// <returns>A string containing (News Title, News Link)</returns>
    public string LoadPerStockNews(string alreadySelectedStocks)
    {
        string newsFeeds = "";

        if (isShowNews)
        {
            GUIVariables gui = new GUIVariables();

            //    //    You can use the class with Caching.
            //    RssReader reader = RssReader.CreateAndCache("http://feeds.feedburner.com/netslave", new TimeSpan(2, 0, 0));
            //    foreach (RssItem item in reader.Items)
            //    {
            //        Response.Write(item.Title +"<br />");
            //    }

            //  You can also use the class directly without caching.
            using (RssReader rss = new RssReader())
            {
                //  Show personalized News for all Users, Don't Cache.
                rss.FeedUrl = yahooNewsFeedRSSFinanceURL + alreadySelectedStocks;

                foreach (RssItem item in rss.Execute())
                {
                    //  string makeLink = item.Title + "    " + "[" + "<a href='" + item.Link + "' target='_blank'>" + "link" + "</a>" + "]";
                    //  newsFeeds = newsFeeds + makeLink + "    " + gui.LineBreak;

                    string makeLink = gui.RedFontStart + ">>" + gui.RedFontEnd
                        + "<a href='" + item.Link + "' style=\"text-decoration:none; font-family:Verdana;\" target='_blank'>" + item.Title + "</a>";
                    newsFeeds = newsFeeds + makeLink + "    " + gui.LineBreak;
                }
            }
        }
        return newsFeeds;
    }
Beispiel #12
0
    public string LoadGenericNews(string url, bool isByPassCache)
    {
        string newsFeeds = "";

        if (isShowNews)
        {
            GUIVariables gui = new GUIVariables();
            if (!isByPassCache && HttpRuntime.Cache["genericNews"] != null)
            {
                newsFeeds = Convert.ToString(HttpRuntime.Cache["genericNews"]);
            }
            else
            {
                using (RssReader rss = new RssReader())
                {
                    if (string.IsNullOrEmpty(url))
                    {
                        rss.FeedUrl = yahooGenericNewsFeedRSSFinanceURL;
                    }
                    else
                    {
                        rss.FeedUrl = url;
                    }

                    foreach (RssItem item in rss.Execute())
                    {
                        //  string makeLink = item.Title + "    " + "[" + "<a href='" + item.Link + "' target='_blank'>" + "link" + "</a>" + "]";
                        //  newsFeeds = newsFeeds + makeLink + "    " + gui.LineBreak;

                        string makeLink = gui.RedFontStart + ">>" + gui.RedFontEnd
                            + "<a href='" + item.Link + "' style=\"text-decoration:none; font-family:Verdana;\" target='_blank'>" + item.Title + "</a>";
                        newsFeeds = newsFeeds + makeLink + "    " + gui.LineBreak;

                    }
                    //  HttpRuntime.Cache.Insert("genericNews", newsFeeds, null, System.Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(newsRefreshRate));
                    HttpRuntime.Cache.Insert("genericNews", newsFeeds, null, DateTime.Now.AddMinutes(newsRefreshRate), System.Web.Caching.Cache.NoSlidingExpiration);
                }
            }
        }
        return newsFeeds;
    }
Beispiel #13
0
    /// <summary>
    /// Creates an RssReader instance from the specified URL and inserts it into the cache. 
    /// When it expires from the cache, it automatically retrieves the remote RSS feed and inserts it to the cache again.
    /// </summary>
    /// <param name="feedUrl">The URI of the RSS feed.</param>
    /// <param name="updateFrequency">The time before it should update it self.</param>
    /// <returns>An instance of the RssReader class.</returns>
    public static RssReader CreateAndCache(string feedUrl, TimeSpan updateFrequency)
    {
        if (HttpRuntime.Cache["RssReader_" + feedUrl] == null)
        {
          RssReader reader = new RssReader(feedUrl);
          reader.Execute();
          reader._UpdateFrequency = updateFrequency;
          HttpRuntime.Cache.Add("RssReader_" + feedUrl, reader, null, DateTime.Now.Add(updateFrequency), Cache.NoSlidingExpiration, CacheItemPriority.Normal, RefreshCache);
        }

        return (RssReader)HttpContext.Current.Cache["RssReader_" + feedUrl];
    }
        private void INPUT_OPTION_Click(object sender, EventArgs e)
        { // Ahh... F*****g
            int nTemp = 0;

            PRINT_OPTION.Clear();
            bool   CheckSelect = false;
            string TempURL     = "http://tokyotosho.info/rss.php?filter=";

            CheckboxSelect Chbox = new CheckboxSelect(TempURL, 14);

            Chbox.InputCheckbox(nTemp++, CH_ANIME, "Anime");
            Chbox.InputCheckbox(nTemp++, CH_MUSIC, "Music");
            Chbox.InputCheckbox(nTemp++, CH_MANGA, "Manga");
            Chbox.InputCheckbox(nTemp++, CH_HENTAI, "Hentai");
            Chbox.InputCheckbox(nTemp++, CH_OTHER, "Other");
            Chbox.InputCheckbox(nTemp++, CH_RAWS, "Raws");
            Chbox.InputCheckbox(nTemp++, CH_DRAMA, "Drama");
            Chbox.InputCheckbox(nTemp++, CH_MVIDEO, "Music Video");
            Chbox.InputCheckbox(nTemp++, CH_NONENG, "Non-English");
            Chbox.InputCheckbox(nTemp++, CH_BATCH, "Batch");
            Chbox.InputCheckbox(nTemp++, CH_HANIME, "Hentai Anime");
            Chbox.InputCheckbox(nTemp++, CH_HMANGA, "Hentai Manga");
            Chbox.InputCheckbox(nTemp++, CH_HGAMES, "Hentai Games");
            Chbox.InputCheckbox(nTemp++, CH_JAV, "JAV");

            nTemp = 0;
            for (int i = 0; i < 14; i++)
            {
                if (++nTemp == 6)
                {
                    nTemp = 7;
                }

                if (Chbox.returnChbox(i).Checked == true)
                {
                    CheckSelect = true;
                    if (Chbox.returnURL() != TempURL)
                    {
                        Chbox.AddURL("," + nTemp);
                    }
                    else
                    {
                        Chbox.AddURL(nTemp.ToString());
                    }
                    PRINT_OPTION.AppendText("Select " + (i + 1) + ". " + Chbox.returnName(i) + "\n");
                }
            }

            if (!CheckSelect)
            {
                PRINT_OPTION.AppendText("Please select at least one.\n");
                return;
            }

            try
            {
                rss         = new RssReader();
                rss.FeedUrl = Chbox.returnURL();
                PRINT_OPTION.AppendText("Successfuly opening tokyotosho.info\n");
                PRINT_SEED.Items.Clear();
                foreach (RssItem item in rss.Execute())
                {
                    PRINT_SEED.Items.Add(item.Title);
                }
            }
            catch (Exception exc)
            {
                exc.ToString();
                PRINT_OPTION.AppendText("Error opening tokyotosho.info\n");
            }
        }