public void BuildIssue() { var data = Proxy.Repository<Issue>() .GetAll(p=>!p.IsDeleted) .OrderByDescending(p => p.CreateDate) .Take(50); var channel = new RssChannel { Title = string.Format("{0} - Issues", Config.Literal.SITE_NAME), Link = new Uri(Config.URL.Domain), Description = string.Format("{0} - Issues", Config.Literal.SITE_NAME), PubDate = DateTime.Now, LastBuildDate = DateTime.Now, Language = "zh-cn", Copyright = Config.Literal.COPYRIGHT }; var template = File.ReadAllText(Config.Path.PHYSICAL_ROOT_PATH + "bin/RSS/issue.cshtml"); foreach (var item in data) { channel.Items.Add(BuildIssueItem(item, template)); } var feed = new RssFeed(Encoding.UTF8); feed.Channels.Add(channel); feed.Write(Config.Path.PHYSICAL_ROOT_PATH + Config.Path.ISSUES_RSS_PATH); }
protected override void Render(HtmlTextWriter writer) { RssChannel channel = new RssChannel(); TopicCollection topics = RepositoryRegistry.TopicRepository.FindByForumId(forumID); foreach (Topic topic in topics) { RssItem item = new RssItem(); item.Title = topic.Name; item.Description = topic.Name; item.PubDate = DateTime.Now.ToUniversalTime(); item.Author = topic.Author.Name; item.Link = new Uri(ForumApplication.Instance.GetLink(SharePointForumControls.ViewMessages, "topic={0}", topic.Id)); channel.Items.Add(item); } channel.Title = ForumApplication.Instance.Title; channel.Description = ForumApplication.Instance.Title; channel.LastBuildDate = channel.Items.LatestPubDate(); channel.Link = new Uri(ForumApplication.Instance.BasePath); RssFeed feed = new RssFeed(); feed.Channels.Add(channel); Page.Response.Clear(); Page.Response.ContentType = "text/xml"; feed.Write(Page.Response.OutputStream); Page.Response.End(); }
static void Main(string[] args) { #region Write Update RSS Feed #region 101 RssItem item = new RssItem(); item.Title = "105"; item.Comments = "1.0.0.105"; item.Description = "Freies Funknetz Switcher Version 1.0.0.105\n\n" + "* \"Bake wiederholen\" Text in \"Bake aktiviert\" geändert\n" + "* Fehler gefixt der dazu geführt hat dass eine Bake ununterbrochen wiederholt wurde\n"+ "* Voice Schaltung nocheinmal überarbeitet jetzt erfolgt nurnoch eine Deaktiviert/Aktiviert\n"+ " Meldung und sonst keine Änderung im Verhalten des Switchers\n"; item.PubDate = DateTime.Now.ToUniversalTime(); item.Link = new System.Uri("http://dropbox.schrankmonster.de/dropped/FFN-Switcher-105.zip"); #endregion RssChannel channel = new RssChannel(); channel.Items.Add(item); channel.Title = "Freies Funknetz Switcher Tool Update Channel"; channel.Description = "Updates for FFN Switcher"; channel.Link = new System.Uri("http://dropbox.schrankmonster.de/FFNSwitcher.xml"); channel.Generator = "FFN Switcher Update Tool"; channel.LastBuildDate = DateTime.Now; RssFeed feed = new RssFeed(); feed.Channels.Add(channel); feed.Write("FFNSwitcher.xml"); #endregion }
public void RenderRssChannel(RssChannel rssChannel) { RssFeed rssFeed = new RssFeed(); rssFeed.Channels.Add(rssChannel); this.Response.ContentType = "text/xml"; rssFeed.Write(this.Response.OutputStream); this.Response.End(); }
private void BuildComment() { var data = _commentRepository.GetAll(p => !p.IsDeleted).OrderByDescending(p => p.CreateDate).Take(50); var feed = new RssFeed(Encoding.UTF8); var channel = BuildCommentRssChannel(); foreach (var item in data) { channel.Items.Add(BuildCommentRssItem(item)); } feed.Channels.Add(channel); feed.Write(AppDomain.CurrentDomain.BaseDirectory+Config.Path.COMMENTS_RSS_PATH); }
static void RunOnce() { if (bloggers == null || File.GetLastWriteTime (bloggersFile) > lastReadOfBloggersFile) { lastReadOfBloggersFile = File.GetLastWriteTime (bloggersFile); bloggers = BloggerCollection.LoadFromFile (bloggersFile); } disable_load = false; all = (Blogger []) bloggers.Bloggers.ToArray (typeof (Blogger)); lock (all) { next = 10; for (int i = 0; i < 10 && i < all.Length; i++) { Blogger b = all [i]; ReadDelegate d = new ReadDelegate (FeedCache.Read); d.BeginInvoke (b.Name, b.RssUrl, feed_done, b); } } wait_handle.WaitOne (300000, false); disable_load = true; for (int i = 0; i < (int) UpdateStatus.MAX; i++) { Console.WriteLine ("{0}: {1}", (UpdateStatus) i, counters [i]); } int error = counters [(int) UpdateStatus.Error]; int downloaded = counters [(int) UpdateStatus.Downloaded]; int updated = counters [(int) UpdateStatus.Updated]; if (error == 0 && downloaded == 0 && updated == 0) return; outFeed = new RssFeed (); RssChannel ch = new RssChannel (); ch.Title = "Monologue"; ch.Generator = "Monologue worker: b-diddy powered"; ch.Description = "The voices of Mono"; ch.Link = new Uri ("http://www.go-mono.com/monologue/"); ArrayList stories = new ArrayList (); DateTime minPubDate = DateTime.Now.AddDays (-14); foreach (Blogger b in bloggers.BloggersByUrl) { if (b.Channel == null) continue; foreach (RssItem i in b.Channel.Items) { if (i.PubDate == DateTime.MinValue) { b.DateError = true; } else if (i.PubDate >= minPubDate) { i.Title = b.Name + ": " + i.Title; i.PubDate = i.PubDate.ToUniversalTime (); stories.Add (i); } } } stories.Sort (new ReverseRssItemComparer ()); foreach (RssItem itm in stories) ch.Items.Add (itm); if (ch.Items.Count == 0) { Settings.Log ("No feeds to store."); return; } outFeed.Channels.Add (ch); outFeed.Write (rssOutFile); Render (); }
private void BuildPost() { var data = _postRepository.GetAll(p => p.PostStatus == (int)PostStatusEnum.Publish).OrderByDescending(p => p.CreateDate).Take(50); var feed = new RssFeed(Encoding.UTF8); var channel = BuildPostRssChannel(); foreach (var item in data) { channel.Items.Add(BuildPostRssItem(item)); } feed.Channels.Add(channel); feed.Write(AppDomain.CurrentDomain.BaseDirectory + Config.Path.ARTICLES_RSS_PATH); }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void Page_Load(object sender, EventArgs e) { //get project id if (Request.QueryString["pid"] != null) projectId = Convert.ToInt32(Request.Params["pid"]); //get feed id if (Request.QueryString["channel"] != null) channelId = Convert.ToInt32(Request.Params["channel"]); if (projectId != 0) { //Security Checks if (!User.Identity.IsAuthenticated && Project.GetProjectById(projectId).AccessType == Globals.ProjectAccessType.Private) Response.Redirect("~/Errors/AccessDenied.aspx", true); else if (User.Identity.IsAuthenticated && Project.GetProjectById(projectId).AccessType == Globals.ProjectAccessType.Private && !Project.IsUserProjectMember(User.Identity.Name, projectId)) Response.Redirect("~/Errors/AccessDenied.aspx", true); projectName = Project.GetProjectById(projectId).Name; } else { if(!User.Identity.IsAuthenticated) Response.Redirect("~/Errors/AccessDenied.aspx", true); } channel = new RssChannel(); feed = new RssFeed(); switch (channelId) { case 1: MilestoneFeed(); break; case 2: CategoryFeed(); break; case 3: StatusFeed(); break; case 4: PriorityFeed(); break; case 5: TypeFeed(); break; case 6: AssigneeFeed(); break; case 7: FilteredIssuesFeed(); break; case 8: RelevantFeed(); break; case 9: AssignedFeed(); break; case 10: OwnedFeed(); break; case 11: CreatedFeed(); break; case 12: AllFeed(); break; case 13: QueryFeed(); break; case 14: OpenIssuesFeed(); break; case 15: MonitoredIssuesFeed(); break; case 16: MyIssuesAssignedFeed(); break; case 17: MyIssuesClosedFeed(); break; case 18: MyIssuesOwnedFeed(); break; case 19: MyIssuesCreatedFeed(); break; } channel.PubDate = DateTime.Now; channel.LastBuildDate = channel.Items.LatestPubDate(); channel.Link = new System.Uri(HostSetting.GetHostSetting("DefaultUrl") + "Rss.aspx?" + Request.QueryString.ToString()); try { feed.Channels.Add(channel); //feed.Encoding = System.Text.Encoding.UTF8; Response.ContentType = "text/xml"; feed.Write(Response.OutputStream); Response.End(); } catch { //exception } }
public void BuildPost() { var data = Proxy.Repository<Post>() .GetAll(p => p.PostStatus == (int) PostStatusEnum.Publish) .OrderByDescending(p => p.CreateDate) .Take(10); var channel = new RssChannel { Title = string.Format("{0} - 文章", Config.Literal.SITE_NAME), Link = new Uri(Config.URL.Domain), Description = string.Format("{0} - 文章", Config.Literal.SITE_NAME), PubDate = DateTime.Now, LastBuildDate = DateTime.Now, Language = "zh-cn", Copyright = Config.Literal.COPYRIGHT }; foreach (var item in data) { channel.Items.Add(CreatePostItem(item)); } var feed = new RssFeed(Encoding.UTF8); feed.Channels.Add(channel); feed.Write(Config.Path.PHYSICAL_ROOT_PATH + Config.Path.ARTICLES_RSS_PATH); }
private void RenderRss(int moduleId) { Response.ContentType = "text/xml"; Response.ContentEncoding = System.Text.Encoding.UTF8; //Cynthia.Business.RssFeed feed = new Cynthia.Business.RssFeed(moduleId); Module module = GetModule(); Hashtable moduleSettings = ModuleSettings.GetModuleSettings(moduleId); feedListCacheTimeout = WebUtils.ParseInt32FromHashtable( moduleSettings, "RSSFeedFeedListCacheTimeoutSetting", 3660); entryCacheTimeout = WebUtils.ParseInt32FromHashtable( moduleSettings, "RSSFeedEntryCacheTimeoutSetting", 3620); maxDaysOld = WebUtils.ParseInt32FromHashtable( moduleSettings, "RSSFeedMaxDayCountSetting", 90); maxEntriesPerFeed = WebUtils.ParseInt32FromHashtable( moduleSettings, "RSSFeedMaxPostsPerFeedSetting", 90); EnableSelectivePublishing = WebUtils.ParseBoolFromHashtable( moduleSettings, "EnableSelectivePublishing", EnableSelectivePublishing); DataView dv = FeedCache.GetRssFeedEntries( module.ModuleId, module.ModuleGuid, entryCacheTimeout, maxDaysOld, maxEntriesPerFeed, EnableSelectivePublishing).DefaultView; dv.Sort = "PubDate DESC"; //if (EnableSelectivePublishing) //{ // dv.RowFilter = "Confirmed = true"; //} RssChannel channel = new RssChannel(); object value = GetModule(); Module m; if (value != null) { m = (Module)value; channel.Title = m.ModuleTitle; channel.Description = m.ModuleTitle; channel.LastBuildDate = channel.Items.LatestPubDate(); channel.Link = new System.Uri(SiteUtils.GetCurrentPageUrl()); } else { // this prevents an error: Can't close RssWriter without first writing a channel. channel.Title = "Not Found"; channel.Description = "Not Found"; channel.LastBuildDate = DateTime.UtcNow; //channel.Link = new System.Uri(SiteUtils.GetCurrentPageUrl()); } foreach (DataRowView row in dv) { bool confirmed = Convert.ToBoolean(row["Confirmed"]); if (!EnableSelectivePublishing) { confirmed = true; } if (confirmed) { RssItem item = new RssItem(); item.Title = row["Title"].ToString(); item.Description = row["Description"].ToString(); item.PubDate = Convert.ToDateTime(row["PubDate"]); item.Link = new System.Uri(row["Link"].ToString()); Trace.Write(item.Link.ToString()); item.Author = row["Author"].ToString(); channel.Items.Add(item); } } Rss.RssFeed rss = new Rss.RssFeed(); rss.Encoding = System.Text.Encoding.UTF8; rss.Channels.Add(channel); rss.Write(Response.OutputStream); //Response.End(); }
static void Main(string[] args) { RssFeed r = new RssFeed(); r.Version = RssVersion.RSS20; RssItem ri1a = new RssItem(); ri1a.Author = "Test Author 1a"; ri1a.Title = "Test Title 1a"; ri1a.Description = "Test Description 1a"; ri1a.Link = new Uri("http://www.yourserver.com/"); ri1a.PubDate = DateTime.Now; RssItem ri1b = new RssItem(); ri1b.Author = "Test Author 1b"; ri1b.Title = "Test Title 1b"; ri1b.Description = "Test Description 1b"; ri1b.Link = new Uri("http://www.yourserver.com/"); ri1b.PubDate = DateTime.Now; RssChannel rc1 = new RssChannel(); rc1.Items.Add(ri1a); rc1.Items.Add(ri1b); rc1.Title = "Test Channel Title 1"; rc1.Description = "Test Channel Description 1"; rc1.Link = new Uri("http://www.yourserver.com/channel.html"); rc1.PubDate = DateTime.Now; r.Channels.Add(rc1); RssPhotoAlbumCategoryPhotoPeople pacpp = new RssPhotoAlbumCategoryPhotoPeople("John Doe"); RssPhotoAlbumCategoryPhoto pacp1 = new RssPhotoAlbumCategoryPhoto(DateTime.Now.Subtract(new TimeSpan(2, 12, 0, 0)), "Test Photo Description 1", new Uri("http://www.yourserver.com/PhotoAlbumWeb/GetPhoto.aspx?PhotoID=123"), pacpp); RssPhotoAlbumCategoryPhoto pacp2 = new RssPhotoAlbumCategoryPhoto(DateTime.Now.Subtract(new TimeSpan(2, 10, 0, 0)), "Test Photo Description 2", new Uri("http://www.yourserver.com/PhotoAlbumWeb/GetPhoto.aspx?PhotoID=124")); RssPhotoAlbumCategoryPhoto pacp3 = new RssPhotoAlbumCategoryPhoto(DateTime.Now.Subtract(new TimeSpan(2, 10, 0, 0)), "Test Photo Description 2", new Uri("http://www.yourserver.com/PhotoAlbumWeb/GetPhoto.aspx?PhotoID=125")); RssPhotoAlbumCategoryPhotos pacps = new RssPhotoAlbumCategoryPhotos(); pacps.Add(pacp1); pacps.Add(pacp2); RssPhotoAlbumCategory pac1 = new RssPhotoAlbumCategory("Test Photo Album Category 1", "Test Photo Album Category Description 1", DateTime.Now.Subtract(new TimeSpan(5, 10, 0, 0)), DateTime.Now, pacps); RssPhotoAlbumCategory pac2 = new RssPhotoAlbumCategory("Test Photo Album Category 2", "Test Photo Album Category Description 2", DateTime.Now.Subtract(new TimeSpan(9, 10, 0, 0)), DateTime.Now, pacp3); RssPhotoAlbumCategories pacs = new RssPhotoAlbumCategories(); pac1.BindTo(ri1a.GetHashCode()); pac2.BindTo(ri1b.GetHashCode()); pacs.Add(pac1); pacs.Add(pac2); RssPhotoAlbum pa = new RssPhotoAlbum(new Uri("http://your.web.server/PhotoAlbumWeb"), pacs); pa.BindTo(rc1.GetHashCode()); r.Modules.Add(pa); RssItem ri2 = new RssItem(); ri2.Author = "Test Author 2"; ri2.Title = "Test Title 2"; ri2.Description = "Test Description 2"; ri2.Link = new Uri("http://www.yourotherserver.com/"); ri2.PubDate = DateTime.Now; RssChannel rc2 = new RssChannel(); rc2.Items.Add(ri2); rc2.Title = "Test Channel Title 2"; rc2.Description = "Test Channel Description 2"; rc2.Link = new Uri("http://www.yourotherserver.com/channel.html"); rc2.PubDate = DateTime.Now; r.Channels.Add(rc2); r.Write("out.xml"); RssBlogChannel rbc = new RssBlogChannel(new Uri("http://www.google.com"), new Uri("http://www.google.com"), new Uri("http://www.google.com"), new Uri("http://www.google.com")); }
static void Main(string[] args) { RssFeed r = new RssFeed(); r.Version = RssVersion.RSS20; RssItem ri1a = new RssItem(); ri1a.Author = "Test Author 1a"; ri1a.Title = "Test Title 1a"; ri1a.Description = "Test Description 1a"; ri1a.Link = new Uri("http://www.yourserver.com/"); ri1a.PubDate = DateTime.Now; RssItem ri1b = new RssItem(); ri1b.Author = "Test Author 1b"; ri1b.Title = "Test Title 1b"; ri1b.Description = "Test Description 1b"; ri1b.Link = new Uri("http://www.yourserver.com/"); ri1b.PubDate = DateTime.Now; RssChannel rc1 = new RssChannel(); rc1.Items.Add(ri1a); rc1.Items.Add(ri1b); rc1.Title = "Test Channel Title 1"; rc1.Description = "Test Channel Description 1"; rc1.Link = new Uri("http://www.yourserver.com/channel.html"); rc1.PubDate = DateTime.Now; r.Channels.Add(rc1); RssPhotoAlbumCategoryPhotoPeople pacpp = new RssPhotoAlbumCategoryPhotoPeople("John Doe"); RssPhotoAlbumCategoryPhoto pacp1 = new RssPhotoAlbumCategoryPhoto(DateTime.Now.Subtract(new TimeSpan(2, 12, 0, 0)), "Test Photo Description 1", new Uri("http://www.yourserver.com/PhotoAlbumWeb/GetPhoto.aspx?PhotoID=123"), pacpp); RssPhotoAlbumCategoryPhoto pacp2 = new RssPhotoAlbumCategoryPhoto(DateTime.Now.Subtract(new TimeSpan(2, 10, 0, 0)), "Test Photo Description 2", new Uri("http://www.yourserver.com/PhotoAlbumWeb/GetPhoto.aspx?PhotoID=124")); RssPhotoAlbumCategoryPhoto pacp3 = new RssPhotoAlbumCategoryPhoto(DateTime.Now.Subtract(new TimeSpan(2, 10, 0, 0)), "Test Photo Description 2", new Uri("http://www.yourserver.com/PhotoAlbumWeb/GetPhoto.aspx?PhotoID=125")); RssPhotoAlbumCategoryPhotos pacps = new RssPhotoAlbumCategoryPhotos(); pacps.Add(pacp1); pacps.Add(pacp2); RssPhotoAlbumCategory pac1 = new RssPhotoAlbumCategory("Test Photo Album Category 1", "Test Photo Album Category Description 1", DateTime.Now.Subtract(new TimeSpan(5, 10, 0, 0)), DateTime.Now, pacps); RssPhotoAlbumCategory pac2 = new RssPhotoAlbumCategory("Test Photo Album Category 2", "Test Photo Album Category Description 2", DateTime.Now.Subtract(new TimeSpan(9, 10, 0, 0)), DateTime.Now, pacp3); RssPhotoAlbumCategories pacs = new RssPhotoAlbumCategories(); pac1.BindTo(ri1a.GetHashCode()); pac2.BindTo(ri1b.GetHashCode()); pacs.Add(pac1); pacs.Add(pac2); RssPhotoAlbum pa = new RssPhotoAlbum(new Uri("http://your.web.server/PhotoAlbumWeb"), pacs); pa.BindTo(rc1.GetHashCode()); r.Modules.Add(pa); RssItem ri2 = new RssItem(); ri2.Author = "Test Author 2"; ri2.Title = "Test Title 2"; ri2.Description = "Test Description 2"; ri2.Link = new Uri("http://www.yourotherserver.com/"); ri2.PubDate = DateTime.Now; RssChannel rc2 = new RssChannel(); rc2.Items.Add(ri2); rc2.Title = "Test Channel Title 2"; rc2.Description = "Test Channel Description 2"; rc2.Link = new Uri("http://www.yourotherserver.com/channel.html"); rc2.PubDate = DateTime.Now; r.Channels.Add(rc2); r.Write("out.xml"); RssBlogChannel rbc = new RssBlogChannel(new Uri("http://www.google.com"), new Uri("http://www.google.com"), new Uri("http://www.google.com"), new Uri("http://www.google.com")); }