添加项目文件。

This commit is contained in:
Zel
2025-01-22 23:31:03 +08:00
parent 1b8ba6771f
commit 2ae76476fb
894 changed files with 774558 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
namespace TightWiki.Engine.Library
{
public class PageReference
{
/// <summary>
/// The name of the page. Such as "Sand Box" or "Some Namespace : SandBox".
/// </summary>
public string Name { get; set; } = string.Empty;
/// <summary>
/// The namespace part of the Name.
/// </summary>
public string Namespace { get; set; } = string.Empty;
/// The cleaned up version of the name, safe for passing in URLs.
public string Navigation { get; set; } = string.Empty;
public PageReference()
{
}
public override bool Equals(object? obj)
{
return obj is PageReference other
&& string.Equals(Navigation, other.Navigation, StringComparison.OrdinalIgnoreCase);
}
public override int GetHashCode()
{
return Navigation.GetHashCode();
}
public PageReference(string name, string navigation)
{
var parts = name.Split("::");
if (parts.Length == 1)
{
Name = parts[0].Trim();
}
else if (parts.Length == 2)
{
Namespace = parts[0].Trim();
Name = parts[1].Trim();
}
else
{
throw new Exception($"Invalid page name {name}");
}
Navigation = navigation;
}
}
}