⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 galleryrsswriter.cs

📁 本系统是在asp版《在线文件管理器》的基础上设计制作
💻 CS
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System.Collections;
using CommunityServer.Components;

namespace CommunityServer.Galleries.Components
{
	/// <summary>
	/// Summary description for WeblogRssWriter.
	/// </summary>
	public class GalleryRssWriter : BaseRssWriter
	{

		#region Protected Members

		private string baseGuid = null;
		protected ArrayList categories;

		protected Gallery CurrentGallery
		{
			get { return CurrentSection as Gallery; }
		}

		protected override bool AllowComments
		{
			get { return base.AllowComments; }
		}

		#endregion

		public GalleryRssWriter(ArrayList categories, Gallery gallery, string baseUrl) : base(new ArrayList(), gallery, baseUrl)
		{
			this.categories = categories;
			baseGuid = CSContext.Current.SiteSettings.SiteKey.ToString();
		}

		/// <summary>
		/// Build the feed.
		/// </summary>
		protected override void Build()
		{
			if(this.StyleSheet != null && this.StyleSheet.Trim().Length > 0)
			{
				this.WriteStyleSheet(StyleSheet);
			}

			StartDocument();
			SetNamespaces();
			StartChannel();
			WriteChannel();
			foreach(PostCategory category in this.categories)
			{
				StartItem();
				WriteItem(category);
				EndItem();
			}
			EndChannel();
			EndDocument();
		}

		/// <summary>
		/// Actually write the contents of an item element.
		/// </summary>
		protected void WriteItem(PostCategory category)
		{
			// core
			this.WriteElementString("title", category.Name);
			// core
			this.WriteElementString("link", FormatUrl( GalleryUrls.Instance().ViewCategory( CurrentSection.ApplicationKey, category.CategoryID ) ));
			this.WriteElementString("pubDate", category.MostRecentPostDate.ToUniversalTime().ToString("r"));
			// core

			this.WriteStartElement("guid");
			this.WriteAttributeString("isPermaLink","false");
			this.WriteString(string.Format("{0}:{1}", baseGuid, category.CategoryID));
			this.WriteEndElement();

			this.WriteElementString("description", category.Description + "<br><br>Pictures: " + category.TotalThreads.ToString() + "<br>Last Updated: " + category.MostRecentPostDate.ToString());
		}

		protected override string BuildLink(Post p) { return string.Empty; }

		protected override void WriteChannel()
		{
			BuildChannel(GalleryUrls.Instance().ViewGallery(CurrentSection.ApplicationKey), CurrentSection.Description);
		}

	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -