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

📄 pageinfo.cs

📁 YetAnotherForum.Net+ScrewTurnWiki中文完美汉化增强版
💻 CS
字号:

using System;
using System.Collections.Generic;
using System.Text;

namespace ScrewTurn.Wiki.PluginFramework {

	/// <summary>
	/// Contains basic information about a Page.
	/// </summary>
	[Serializable]
	public class PageInfo {

		/// <summary>
		/// The Name of the Page.
		/// </summary>
		protected string name;
		/// <summary>
		/// The Provider of the Page.
		/// </summary>
		protected IPagesStorageProvider provider;
		/// <summary>
		/// The Status of the Page.
		/// </summary>
		protected PageStatus status;
		/// <summary>
		/// A value specifying whether the Page should NOT be cached by the engine.
		/// </summary>
		protected bool nonCached;
		/// <summary>
		/// The Page creation Date/Time.
		/// </summary>
		protected DateTime creationDateTime;

		/// <summary>
		/// Initializes a new instance of the <b>PageInfo</b> class.
		/// </summary>
		/// <param name="name">The Name of the Page.</param>
		/// <param name="provider">The Pages Storage Provider that manages this Page.</param>
		/// <param name="status">The Status of the Page.</param>
		/// <param name="creationDateTime">The Page creation Date/Time.</param>
		public PageInfo(string name, IPagesStorageProvider provider, PageStatus status, DateTime creationDateTime) {
			this.name = name;
			this.provider = provider;
			this.status = status;
			this.creationDateTime = creationDateTime;
		}

		/// <summary>
		/// Gets or sets the Name.
		/// </summary>
		public string Name {
			get { return name; }
			set { name = value; }
		}

		/// <summary>
		/// Gets or sets the Pages Storage Provider.
		/// </summary>
		public IPagesStorageProvider Provider {
			get { return provider; }
			set { provider = value; }
		}

		/// <summary>
		/// Gets or sets the Page Status.
		/// </summary>
		public PageStatus Status {
			get { return status; }
			set { status = value; }
		}

		/// <summary>
		/// Gets or sets a value specifying whether the Page should NOT be cached by the engine.
		/// </summary>
		public bool NonCached {
			get { return nonCached; }
			set { nonCached = value; }
		}

		/// <summary>
		/// Gets or sets the creation Date/Time.
		/// </summary>
		public DateTime CreationDateTime {
			get { return creationDateTime; }
			set { creationDateTime = value; }
		}

		/// <summary>
		/// Converts the current PageInfo to a string.
		/// </summary>
		/// <returns>The string.</returns>
		public override string ToString() {
			string result = name;
			switch(status) {
				case PageStatus.Locked:
					result += " (Locked)";
					break;
				case PageStatus.Public:
					result += " (Public)";
					break;
			}
			result += " [" + provider.Information.Name + "]";
			return result;
		}

	}

	/// <summary>
	/// Enumerates legal Page status.
	/// </summary>
	public enum PageStatus {
		/// <summary>
		/// The Page status is Normal.
		/// </summary>
		Normal,
		/// <summary>
		/// The Page status is Public.
		/// </summary>
		Public,
		/// <summary>
		/// The Page status is Locked.
		/// </summary>
		Locked
	}

	/// <summary>
	/// Compares two <b>PageInfo</b> objects, using the Name as parameter.
	/// </summary>
	/// <remarks>The comparison is <b>case insensitive</b>.</remarks>
	public class PageNameComparer : IComparer<PageInfo> {

		/// <summary>
		/// Compares two PageInfo objects, using the Name as parameter.
		/// </summary>
		/// <param name="x">The first object.</param>
		/// <param name="y">The second object.</param>
		/// <returns>The comparison result (-1, 0 or 1).</returns>
		public int Compare(PageInfo x, PageInfo y) {
			return x.Name.ToLower().CompareTo(y.Name.ToLower());
		}

	}

}

⌨️ 快捷键说明

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