Beispiel #1
0
        public RSSEvents(string channelDescription, string channelTittle, string webmaster)
        {
            rss = new Rss.RssFeed();
            if (rss.Channels.Count == 0)
            {
                Rss.RssFeed    rs  = new Rss.RssFeed();
                Rss.RssChannel ch  = new Rss.RssChannel();
                string         cat = "";
                //if (rssfile.Contains(@"\Components\")) { cat = "Componente forte"; }
                //if (rssfile.Contains(@"\Environments\")) { cat = "Entorno forte"; }
                ch.Description = channelDescription;
                ch.Title       = channelTittle;
                ch.WebMaster   = webmaster;
                Rss.RssItem rt = new Rss.RssItem();
                rt.Author      = webmaster;
                rt.Description = channelDescription;
                rt.PubDate     = DateTime.Now;
                rt.Title       = channelTittle;

                ch.Items.Add(rt);
                ch.LastBuildDate = DateTime.Now;
                ch.PubDate       = DateTime.Now;
                //ch.Link = new Uri(httplink);
                rss.Channels.Add(ch);
            }
        }
Beispiel #2
0
        private bool FillPosts(FeedItem feedItem)
        {
            Rss.RssChannel rssChannel = Utils.GetFeed(feedItem).Channels[0];
            bool           boolRead   = false;

            PostsListView.Items.Clear();

            PostsListView.BeginUpdate();

            rssChannel.Items.Sort();
            for (int q = 0; q < rssChannel.Items.Count; q++)
            {
                if (feedItem.ReadPosts != null)
                {
                    foreach (string hashRead in feedItem.ReadPosts)
                    {
                        boolRead = false;
                        string strHash = rssChannel.Items[q].GetHashCode().ToString();
                        if (hashRead == strHash)
                        {
                            boolRead = true;
                            break;
                        }
                    }
                }
                else
                {
                    boolRead = false;
                }
                Rss.RssItem rssItem = rssChannel.Items[q];

                if (rssItem.Enclosure != null)
                {
                    // RssItem rssItem = rssFeed.Items[q];
                    rssItem.Read = boolRead;
                    if (Settings.Default.History[rssItem.GetHashCode().ToString()] == null)
                    {
                        rssItem.EnclosureDownloaded = false;
                        ListViewItem lvi = new ListViewItem();

                        lvi.SubItems.Add(rssItem.Title);
                        lvi.SubItems.Add(rssItem.PubDate.ToString("yyyy-MM-dd"));
                        lvi.Tag = rssItem;
                        PostsListView.Items.Add(lvi);
                    }
                }
            }

            foreach (ColumnHeader c in PostsListView.Columns)
            {
                c.Width = -2;
            }
            PostsListView.EndUpdate();
            return(boolRead);
        }
Beispiel #3
0
 private void QueueButton_Click(object sender, EventArgs e)
 {
     Rss.RssChannel channel = new Rss.RssChannel();
     channel.Description = languages.FormStrings.TemporaryDownloadChannel;
     feed.Channels.Add(channel);
     foreach (ListViewItem lvi in PostsListView.Items)
     {
         if (lvi.Checked == true)
         {
             Rss.RssItem item = (Rss.RssItem)lvi.Tag;
             channel.Items.Add(item);
         }
     }
 }
Beispiel #4
0
        private RssTorrent[] RetriveFeed()
        {
            Rss.RssFeed feed = Rss.RssFeed.Read(this.Url);

            // Note:
            // I don't know if more than 1 channel is allowed for torrents feeds
            // But I will stick to the first one only.
            // Idea: Probably multiple channels are for multiple languages.
            // In this case, we select the prefered one.

            Rss.RssChannel channel = feed.Channels[0];

            List <RssTorrent> torrents = new List <RssTorrent>(channel.Items.Count);

            foreach (Rss.RssItem item in channel.Items)
            {
                torrents.Add(item.ToTorrent());
            }

            this.feed_title = channel.Title;

            return(torrents.ToArray());
        }
Beispiel #5
0
        public RSSEvents(string filepath, string channeldescription, string webmaster, string channeltitle, string httplink)
        {
            //rssfile = filerelpath;
            string tmprssfile = rssfile;

            rssfile = filepath;
            rss     = new Rss.RssFeed();
            if (!System.IO.File.Exists(rssfile))
            {
                //System.IO.StreamWriter str = new System.IO.StreamWriter(rssfile, false);
                //str.Close();
                if (rss.Channels.Count == 0)
                {
                    Rss.RssFeed    rs  = new Rss.RssFeed();
                    Rss.RssChannel ch  = new Rss.RssChannel();
                    string         cat = "";
                    //if (rssfile.Contains(@"\Components\")) { cat = "Componente forte"; }
                    //if (rssfile.Contains(@"\Environments\")) { cat = "Entorno forte"; }
                    ch.Description = channeldescription;
                    ch.Title       = channeltitle;
                    ch.WebMaster   = webmaster;
                    Rss.RssItem rt = new Rss.RssItem();
                    rt.Author      = webmaster;
                    rt.Description = "Seccion de eventos, canal " + channeltitle + "." + cat;
                    rt.PubDate     = DateTime.Now;
                    rt.Title       = "Eventos para el canal " + channeltitle;

                    ch.Items.Add(rt);
                    ch.LastBuildDate = DateTime.Now;
                    ch.PubDate       = DateTime.Now;
                    ch.Link          = new Uri(httplink);
                    rss.Channels.Add(ch);
                    rss.Write(rssfile);
                }
            }
            rss = Rss.RssFeed.Read(rssfile);
        }
Beispiel #6
0
        public RSSEvents(string filepath, string channeldescription, string webmaster, string channeltitle, string httplink)
        {
            //rssfile = filerelpath;
            string tmprssfile = rssfile;
            rssfile = filepath;
            rss = new Rss.RssFeed();
            if (!System.IO.File.Exists(rssfile))
            {
                //System.IO.StreamWriter str = new System.IO.StreamWriter(rssfile, false);
                //str.Close();
                if (rss.Channels.Count == 0)
                {
                    Rss.RssFeed rs = new Rss.RssFeed();
                    Rss.RssChannel ch = new Rss.RssChannel();
                    string cat = "";
                    //if (rssfile.Contains(@"\Components\")) { cat = "Componente forte"; }
                    //if (rssfile.Contains(@"\Environments\")) { cat = "Entorno forte"; }
                    ch.Description = channeldescription;
                    ch.Title = channeltitle;
                    ch.WebMaster = webmaster;
                    Rss.RssItem rt = new Rss.RssItem();
                    rt.Author = webmaster;
                    rt.Description = "Seccion de eventos, canal " + channeltitle + "." + cat;
                    rt.PubDate = DateTime.Now;
                    rt.Title = "Eventos para el canal " + channeltitle;

                    ch.Items.Add(rt);
                    ch.LastBuildDate = DateTime.Now;
                    ch.PubDate = DateTime.Now;
                    ch.Link = new Uri(httplink);
                    rss.Channels.Add(ch);
                    rss.Write(rssfile);
                }
            }
            rss = Rss.RssFeed.Read(rssfile);
        }
Beispiel #7
0
        private void RenderRss(RssGroup rssGroup)
        {
            Response.ContentType     = "application/xml";
            Response.ContentEncoding = System.Text.Encoding.UTF8;

            Hashtable moduleSettings = ModuleSettings.GetModuleSettings(rssGroup.ModuleId);

            rssGroup.MaximumDays = WebUtils.ParseInt32FromHashtable(
                moduleSettings, "RSSFeedMaxDaysOldSetting", 90);

            int entriesLimit = WebUtils.ParseInt32FromHashtable(
                moduleSettings, "RSSFeedMaxPostsSetting", 90);

            int entryCount = 0;

            Rss.RssChannel channel = new Rss.RssChannel();
            string         baseUrl = Request.Url.ToString().Replace("RSS.aspx", "Topic.aspx");

            using (IDataReader posts = rssGroup.GetPostsForRss())
            {
                while ((posts.Read()) && (entryCount <= entriesLimit))
                {
                    Rss.RssItem item = new Rss.RssItem();

                    item.Title       = posts["Subject"].ToString();
                    item.Description = SiteUtils.ChangeRelativeUrlsToFullyQuailifiedUrls(navigationSiteRoot, imageSiteRoot, posts["Post"].ToString());
                    item.PubDate     = Convert.ToDateTime(posts["PostDate"]);

                    string target = baseUrl;

                    if (target.IndexOf("&topic=") < 0 && target.IndexOf("?topic=") < 0)
                    {
                        if (target.IndexOf("?") < 0)
                        {
                            target += "?topic=" + posts["TopicID"].ToString() + "#post" + posts["PostID"].ToString();
                        }
                        else
                        {
                            target += "&topic=" + posts["TopicID"].ToString() + "#post" + posts["PostID"].ToString();
                        }
                    }
                    item.Link = new System.Uri(target);

                    item.Author = posts["StartedBy"].ToString();

                    channel.Items.Add(item);
                    entryCount += 1;
                }
            }

            object value = GetModule();
            Module m;

            channel.LastBuildDate = channel.Items.LatestPubDate();
            channel.Link          = new System.Uri(groupUrl);

            if (value != null)
            {
                m = (Module)value;

                channel.Title       = m.ModuleTitle;
                channel.Description = m.ModuleTitle;
            }
            else
            {
                channel.Title       = siteSettings.SiteName;
                channel.Description = siteSettings.SiteName;
            }

            if (channel.Items.Count == 0)
            {
                Rss.RssItem item = new Rss.RssItem();

                item.Title       = "No Items Found";
                item.Description = "No items found";
                item.PubDate     = DateTime.UtcNow;

                item.Link = new System.Uri(navigationSiteRoot);

                item.Author = "system";

                channel.Items.Add(item);
            }


            Rss.RssFeed rss = new Rss.RssFeed();
            rss.BaseUrl = cssBaseUrl;

            rss.Encoding = System.Text.Encoding.UTF8;
            rss.Channels.Add(channel);
            rss.Write(Response.OutputStream);
            //Response.End();
        }
Beispiel #8
0
        public RSSEvents(string channelDescription, string channelTittle, string webmaster)
        {
            rss = new Rss.RssFeed();
            if (rss.Channels.Count == 0)
            {
                Rss.RssFeed rs = new Rss.RssFeed();
                Rss.RssChannel ch = new Rss.RssChannel();
                string cat = "";
                //if (rssfile.Contains(@"\Components\")) { cat = "Componente forte"; }
                //if (rssfile.Contains(@"\Environments\")) { cat = "Entorno forte"; }
                ch.Description = channelDescription;
                ch.Title = channelTittle;
                ch.WebMaster = webmaster;
                Rss.RssItem rt = new Rss.RssItem();
                rt.Author = webmaster;
                rt.Description = channelDescription;
                rt.PubDate = DateTime.Now;
                rt.Title = channelTittle;

                ch.Items.Add(rt);
                ch.LastBuildDate = DateTime.Now;
                ch.PubDate = DateTime.Now;
                //ch.Link = new Uri(httplink);
                rss.Channels.Add(ch);

            }
        }