snippet.cs

来自「YetAnotherForum.Net+ScrewTurnWiki中文完美汉化增」· CS 代码 · 共 70 行

CS
70
字号

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

namespace ScrewTurn.Wiki.PluginFramework {

	/// <summary>
	/// Contains a Snippet.
	/// </summary>
	[Serializable]
	public class Snippet {

		private string name, content;
		private IPagesStorageProvider provider;

		/// <summary>
		/// Initializes a new instance of the <b>Snippet</b> class.
		/// </summary>
		/// <param name="name">The Name of the Snippet.</param>
		/// <param name="content">The Content of the Snippet.</param>
		/// <param name="provider">The Provider of the Snippet.</param>
		public Snippet(string name, string content, IPagesStorageProvider provider) {
			this.name = name;
			this.content = content;
			this.provider = provider;
		}

		/// <summary>
		/// Gets the Name of the Snippet.
		/// </summary>
		public string Name {
			get { return name; }
		}

		/// <summary>
		/// Gets or sets the Content of the Snippet.
		/// </summary>
		public string Content {
			get { return content; }
		}

		/// <summary>
		/// Gets the Provider of the Snippet.
		/// </summary>
		public IPagesStorageProvider Provider {
			get { return provider; }
		}

	}

	/// <summary>
	/// Compares two Snippet objects.
	/// </summary>
	public class SnippetNameComparer : IComparer<Snippet> {

		/// <summary>
		/// Compares two Snippets' Names.
		/// </summary>
		/// <param name="x">The first Snippet.</param>
		/// <param name="y">The second Snippet.</param>
		/// <returns>The result of the comparison (1, 0 or -1).</returns>
		public int Compare(Snippet x, Snippet y) {
			return x.Name.ToLower().CompareTo(y.Name.ToLower());
		}

	}

}

⌨️ 快捷键说明

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