📄 categoryinfo.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
namespace ScrewTurn.Wiki.PluginFramework {
/// <summary>
/// Represents a Page Category. A page can be binded with one or more categories (within the same Provider); this class manages this binding.
/// </summary>
[Serializable]
public class CategoryInfo {
/// <summary>
/// The Name of the Category.
/// </summary>
protected string name;
/// <summary>
/// The Provider of the Category.
/// </summary>
protected IPagesStorageProvider provider;
/// <summary>
/// The Pages of the Category.
/// </summary>
protected string[] pages = null;
/// <summary>
/// Initializes a new instance of the <b>CategoryInfo</b> class.
/// </summary>
/// <param name="name">The Category Name.</param>
/// <param name="provider">The Storage that manages the category.</param>
public CategoryInfo(string name, IPagesStorageProvider provider) {
this.name = name;
this.provider = provider;
}
/// <summary>
/// Gets or sets the Name of the Category.
/// </summary>
public string Name {
get { return name; }
set { name = value; }
}
/// <summary>
/// Gets or sets the Provider that manages the Category.
/// </summary>
public IPagesStorageProvider Provider {
get { return provider; }
set { provider = value; }
}
/// <summary>
/// Gets or sets the Page array, containing their names.
/// </summary>
public string[] Pages {
get { return pages; }
set { pages = value; }
}
}
/// <summary>
/// Compares two <b>CategoryInfo</b> objects, using the Name as parameter.
/// </summary>
/// <remarks>The comparison is <b>case insensitive</b>.</remarks>
public class CategoryNameComparer : IComparer<CategoryInfo> {
/// <summary>
/// Compares two <see cref="CategoryInfo"/> 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(CategoryInfo x, CategoryInfo y) {
return x.Name.ToLower().CompareTo(y.Name.ToLower());
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -