using System;
using System.Collections.Generic;
using System.Globalization;
namespace ScrewTurn.Wiki.PluginFramework {
///
/// Represents a Navigation Path.
///
public class NavigationPath {
///
/// The namespace of the Navigation Path (null for the root).
///
protected string nspace;
///
/// The Name of the Navigation Path.
///
protected string name;
///
/// The names of the Pages in the Navigation Path.
///
protected string[] pages;
///
/// The Provider that handles the Navigation Path.
///
protected IPagesStorageProviderV30 provider;
///
/// Initializes a new instance of the NavigationPath class.
///
/// The Full Name of the Navigation Path.
/// The Provider
public NavigationPath(string fullName, IPagesStorageProviderV30 provider) {
NameTools.ExpandFullName(fullName, out nspace, out name);
this.provider = provider;
pages = new string[0];
}
///
/// Gets or sets the full name of the Navigation Path, such as 'Namespace.Path' or 'Path'.
///
public string FullName {
get { return NameTools.GetFullName(nspace, name); }
set { NameTools.ExpandFullName(value, out nspace, out name); }
}
///
/// Gets or sets the Pages of the Path.
///
public string[] Pages {
get { return pages; }
set { pages = value; }
}
///
/// Gets the Provider.
///
public IPagesStorageProviderV30 Provider {
get { return provider; }
}
}
///
/// Compares two objects, using FullName as the comparison parameter.
///
public class NavigationPathComparer : IComparer {
///
/// Compares two Navigation Paths's FullName.
///
/// The first object.
/// The second object.
/// The result of the comparison (1, 0 or -1).
public int Compare(NavigationPath x, NavigationPath y) {
return StringComparer.OrdinalIgnoreCase.Compare(x.FullName, y.FullName);
}
}
}