using System; using System.Collections.Generic; using System.Text; using System.Globalization; namespace ScrewTurn.Wiki.PluginFramework { /// /// Contains basic information about a Page. /// public class PageInfo { /// /// The namespace of the Page. /// protected string nspace; /// /// The Name of the Page. /// protected string name; /// /// The Provider that handles the Page. /// protected IPagesStorageProviderV30 provider; /// /// A value specifying whether the Page should NOT be cached by the engine. /// protected bool nonCached; /// /// The Page creation Date/Time. /// protected DateTime creationDateTime; /// /// Initializes a new instance of the class. /// /// The Full Name of the Page. /// The Pages Storage Provider that manages this Page. /// The Page creation Date/Time. public PageInfo(string fullName, IPagesStorageProviderV30 provider, DateTime creationDateTime) { NameTools.ExpandFullName(fullName, out nspace, out name); this.provider = provider; this.creationDateTime = creationDateTime; } /// /// Gets or sets the full name of the Page, such as 'Namespace.Page' or 'Page'. /// public string FullName { get { return NameTools.GetFullName(nspace, name); } set { NameTools.ExpandFullName(value, out nspace, out name); } } /// /// Gets or sets the Pages Storage Provider. /// public IPagesStorageProviderV30 Provider { get { return provider; } set { provider = value; } } /// /// Gets or sets a value specifying whether the Page should NOT be cached by the engine. /// public bool NonCached { get { return nonCached; } set { nonCached = value; } } /// /// Gets or sets the creation Date/Time. /// public DateTime CreationDateTime { get { return creationDateTime; } set { creationDateTime = value; } } /// /// Converts the current PageInfo to a string. /// /// The string. public override string ToString() { string result = NameTools.GetFullName(nspace, name); result += " [" + provider.Information.Name + "]"; return result; } } /// /// Compares two objects, using the FullName as parameter. /// /// The comparison is case insensitive. public class PageNameComparer : IComparer { /// /// Compares two objects, using the FullName as parameter. /// /// The first object. /// The second object. /// The comparison result (-1, 0 or 1). public int Compare(PageInfo x, PageInfo y) { return StringComparer.OrdinalIgnoreCase.Compare(x.FullName, y.FullName); } } }