123123
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
|
||||
public T? Value<T>(string name)
|
||||
{
|
||||
var value = Collection.Where(o => o.Name == name).FirstOrDefault();
|
||||
var value = Collection.FirstOrDefault(o => o.Name == name);
|
||||
if (value == null)
|
||||
{
|
||||
return default;
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
public T Value<T>(string name, T defaultValue)
|
||||
{
|
||||
var value = Collection.Where(o => o.Name == name).FirstOrDefault();
|
||||
var value = Collection.FirstOrDefault(o => o.Name == name);
|
||||
if (value == null)
|
||||
{
|
||||
return defaultValue;
|
||||
|
||||
@@ -19,12 +19,7 @@ namespace ZelWiki.Models.DataModels
|
||||
|
||||
public T? As<T>(T defaultValue)
|
||||
{
|
||||
if (Value == null)
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
return Converters.ConvertTo<T>(Value);
|
||||
return Value == null ? defaultValue : Converters.ConvertTo<T>(Value);
|
||||
}
|
||||
|
||||
public string DataType { get; set; } = string.Empty;
|
||||
|
||||
@@ -7,23 +7,23 @@ namespace ZelWiki.Models.DataModels
|
||||
public int Id { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// The revision of this page that is being viewed. May not be the latest revision.
|
||||
/// 正在查看的此页面的修订版。可能不是最新版本
|
||||
/// </summary>
|
||||
public int Revision { get; set; }
|
||||
/// <summary>
|
||||
/// The most current revision of this page.
|
||||
/// 此页面的最新修订版
|
||||
/// </summary>
|
||||
public int MostCurrentRevision { get; set; }
|
||||
|
||||
public bool IsHistoricalVersion => Revision != MostCurrentRevision;
|
||||
|
||||
/// <summary>
|
||||
/// Lets us know whether this page exists and is loaded.
|
||||
/// 此页面是否存在并已加载
|
||||
/// </summary>
|
||||
public bool Exists => Id > 0;
|
||||
|
||||
/// <summary>
|
||||
/// Count of revisions higher than Revision.
|
||||
/// 修订次数高于修订次数
|
||||
/// </summary>
|
||||
public int HigherRevisionCount { get; set; }
|
||||
public int DeletedRevisionCount { get; set; }
|
||||
@@ -36,8 +36,8 @@ namespace ZelWiki.Models.DataModels
|
||||
{
|
||||
get
|
||||
{
|
||||
int idealLength = 64;
|
||||
int maxLength = 100;
|
||||
var idealLength = 64;
|
||||
var maxLength = 100;
|
||||
|
||||
if (Description.Length > idealLength)
|
||||
{
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
namespace ZelWiki.Models.DataModels
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to cache pre-processed wiki results.
|
||||
/// 用于缓存预处理的结果
|
||||
/// </summary>
|
||||
public class PageCache
|
||||
{
|
||||
public PageCache(string body)
|
||||
{
|
||||
Body = body;
|
||||
}
|
||||
/// <summary>
|
||||
/// Custom page title set by a call to @@Title("...")
|
||||
/// 通过调用@@Title("...")设置自定义页面title
|
||||
/// </summary>
|
||||
public string? PageTitle { get; set; }
|
||||
public string Body { get; set; }
|
||||
|
||||
public PageCache(string body)
|
||||
{
|
||||
Body = body;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace ZelWiki.Models.DataModels
|
||||
{
|
||||
public int PageId { get; set; }
|
||||
/// <summary>
|
||||
/// TightWiki.Library.Constants.WikiInstruction
|
||||
///
|
||||
/// </summary>
|
||||
public string Instruction { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
public List<ProcessingInstruction> Collection { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the collection contains the given processing instruction.
|
||||
/// 如果集合包含给定的处理指令,则返回true
|
||||
/// </summary>
|
||||
/// <param name="wikiInstruction">WikiInstruction.Protect</param>
|
||||
/// <returns></returns>
|
||||
|
||||
Reference in New Issue
Block a user