using System; using System.Collections.Generic; using System.Text; namespace ScrewTurn.Wiki.PluginFramework { /// /// Represents a namespace. /// public class NamespaceInfo { /// /// The name of the namespace. /// protected string name; /// /// The provider of the namespace. /// protected IPagesStorageProviderV30 provider; /// /// The default page of the namespace (can be null). /// protected PageInfo defaultPage; /// /// Initializes a new instance of the class. /// /// The namespace name. /// The provider. /// The default page, or null. public NamespaceInfo(string name, IPagesStorageProviderV30 provider, PageInfo defaultPage) { this.name = name; this.provider = provider; this.defaultPage = defaultPage; } /// /// Gets or sets the name of the namespace. /// public string Name { get { return name; } set { name = value; } } /// /// Gets or sets the provider. /// public IPagesStorageProviderV30 Provider { get { return provider; } set { provider = value; } } /// /// Gets or sets the default page, or null. /// public PageInfo DefaultPage { get { return defaultPage; } set { defaultPage = value; } } /// /// Gets a string representation of the current object. /// /// The string representation. public override string ToString() { return name; } } /// /// Compares two objects, using the Name as parameter. /// public class NamespaceComparer : IComparer { /// /// Compares two objects, using the Name as parameter. /// /// The first object. /// The second object. /// The comparison result (-1, 0 or 1). public int Compare(NamespaceInfo x, NamespaceInfo y) { if(x == null && y == null) return 0; else if(x == null && y != null) return -1; else if(x != null && y == null) return 1; else return StringComparer.OrdinalIgnoreCase.Compare(x.Name, y.Name); } } }