添加项目文件。

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,29 @@
using TightWiki.Library.Interfaces;
namespace TightWiki.Models.DataModels
{
/// <summary>
/// This model combines the elements of an account and a profile into one class.
/// </summary>
public partial class AccountProfile : IAccountProfile
{
public string? Theme { get; set; }
public Guid UserId { get; set; }
public string EmailAddress { get; set; } = string.Empty;
public string AccountName { get; set; } = string.Empty;
public string Navigation { get; set; } = string.Empty;
public string? FirstName { get; set; }
public string? LastName { get; set; } = string.Empty;
public string TimeZone { get; set; } = string.Empty;
public string Country { get; set; } = string.Empty;
public string Language { get; set; } = string.Empty;
public string? Biography { get; set; } = string.Empty;
public bool EmailConfirmed { get; set; }
public byte[]? Avatar { get; set; }
public DateTime CreatedDate { get; set; }
public DateTime ModifiedDate { get; set; }
public int PaginationPageSize { get; set; }
public int PaginationPageCount { get; set; }
public string Role { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,37 @@
namespace TightWiki.Models.DataModels
{
public class ConfigurationEntries
{
public List<ConfigurationEntry> Collection { get; set; }
public ConfigurationEntries()
{
Collection = new();
}
public ConfigurationEntries(List<ConfigurationEntry> entries)
{
Collection = new List<ConfigurationEntry>(entries);
}
public T? Value<T>(string name)
{
var value = Collection.Where(o => o.Name == name).FirstOrDefault();
if (value == null)
{
return default;
}
return value.As<T>();
}
public T Value<T>(string name, T defaultValue)
{
var value = Collection.Where(o => o.Name == name).FirstOrDefault();
if (value == null)
{
return defaultValue;
}
return value.As<T>() ?? defaultValue;
}
}
}

View File

@@ -0,0 +1,32 @@
using NTDLS.Helpers;
namespace TightWiki.Models.DataModels
{
public partial class ConfigurationEntry
{
public int Id { get; set; }
public int ConfigurationGroupId { get; set; }
public string Name { get; set; } = string.Empty;
public string Value { get; set; } = string.Empty;
public int DataTypeId { get; set; }
public string Description { get; set; } = string.Empty;
public bool IsEncrypted { get; set; }
public T? As<T>()
{
return Converters.ConvertTo<T>(Value);
}
public T? As<T>(T defaultValue)
{
if (Value == null)
{
return defaultValue;
}
return Converters.ConvertTo<T>(Value);
}
public string DataType { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,16 @@
namespace TightWiki.Models.DataModels
{
public class ConfigurationFlat
{
public int GroupId { get; set; }
public string GroupName { get; set; } = string.Empty;
public string GroupDescription { get; set; } = string.Empty;
public int EntryId { get; set; }
public string EntryName { get; set; } = string.Empty;
public string EntryValue { get; set; } = string.Empty;
public string EntryDescription { get; set; } = string.Empty;
public bool IsEncrypted { get; set; }
public bool IsRequired { get; set; }
public string DataType { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,9 @@
namespace TightWiki.Models.DataModels
{
public partial class ConfigurationGroup
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,11 @@
namespace TightWiki.Models.DataModels
{
public class ConfigurationNest
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public List<ConfigurationEntry> Entries = new();
}
}

View File

@@ -0,0 +1,11 @@
namespace TightWiki.Models.DataModels
{
public class DatabaseInfo
{
public string Name { get; set; } = string.Empty;
public string Version { get; set; } = string.Empty;
public int PageCount { get; set; }
public int PageSize { get; set; }
public int DatabaseSize { get; set; }
}
}

View File

@@ -0,0 +1,7 @@
namespace TightWiki.Models.DataModels
{
public class DeletedPageRevision : Page
{
public int PaginationPageSize { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
namespace TightWiki.Models.DataModels
{
public class Emoji
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Shortcut { get; set; } = string.Empty;
public int PaginationPageCount { get; set; }
public string Categories { get; set; } = string.Empty;
public byte[]? ImageData { get; set; }
public string MimeType { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,9 @@
namespace TightWiki.Models.DataModels
{
public class EmojiCategory
{
public int EmojiId { get; set; }
public string Category { get; set; } = string.Empty;
public string EmojiCount { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,14 @@
namespace TightWiki.Models.DataModels
{
public partial class ImageCacheItem
{
public string ContentType { get; set; } = string.Empty;
public byte[] Bytes { get; set; }
public ImageCacheItem(byte[] bytes, string contentType)
{
Bytes = bytes;
ContentType = contentType;
}
}
}

View File

@@ -0,0 +1,23 @@
using TightWiki.Models.ViewModels.Admin;
namespace TightWiki.Models.DataModels
{
public partial class MenuItem
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Link { get; set; } = string.Empty;
public int Ordinal { get; set; }
public MenuItemViewModel ToViewModel()
{
return new MenuItemViewModel
{
Name = Name,
Id = Id,
Link = Link,
Ordinal = Ordinal
};
}
}
}

View File

@@ -0,0 +1,9 @@
namespace TightWiki.Models.DataModels
{
public class NamespaceStat
{
public string Namespace { get; set; } = string.Empty;
public int CountOfPages { get; set; }
public int PaginationPageCount { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
namespace TightWiki.Models.DataModels
{
public class NonexistentPage
{
public int SourcePageId { get; set; }
public string SourcePageName { get; set; } = string.Empty;
public string SourcePageNavigation { get; set; } = string.Empty;
public string TargetPageName { get; set; } = string.Empty;
public string TargetPageNavigation { get; set; } = string.Empty;
public int PaginationPageCount { get; set; }
}
}

View File

@@ -0,0 +1,27 @@
namespace TightWiki.Models.DataModels
{
public partial class OrphanedPageAttachment
{
public int PaginationPageCount { get; set; }
public int PageFileId { get; set; }
public string PageName { get; set; } = string.Empty;
public string Namespace { get; set; } = string.Empty;
public string PageNavigation { get; set; } = string.Empty;
public string FileName { get; set; } = string.Empty;
public string FileNavigation { get; set; } = string.Empty; //https://localhost:7053/File/Binary/Home/test_file_b_txt/1
public long Size { get; set; }
public int FileRevision { get; set; }
public string PageTitle
{
get
{
if (PageName.Contains("::"))
{
return PageName.Substring(PageName.IndexOf("::") + 2).Trim();
}
return PageName;
}
}
}
}

View File

@@ -0,0 +1,105 @@
using TightWiki.Library.Interfaces;
namespace TightWiki.Models.DataModels
{
public class Page : IPage
{
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; }
public string Name { get; set; } = string.Empty;
public string Navigation { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public int DataHash { get; set; }
public string EllipseDescription
{
get
{
int idealLength = 64;
int maxLength = 100;
if (Description.Length > idealLength)
{
int spacePos = Description.IndexOf(' ', idealLength);
int tabPos = Description.IndexOf('\t', idealLength);
idealLength = spacePos > tabPos && tabPos > 0 ? tabPos : spacePos;
if (idealLength > 0 && idealLength < maxLength)
{
return Description.Substring(0, idealLength) + "...";
}
}
if (Description.Length > maxLength)
{
return Description.Substring(0, maxLength) + "...";
}
return Description;
}
}
public Guid CreatedByUserId { get; set; }
public DateTime CreatedDate { get; set; }
public Guid ModifiedByUserId { get; set; }
public DateTime ModifiedDate { get; set; }
public DateTime DeletedDate { get; set; }
public Guid DeletedByUserId { get; set; }
public string DeletedByUserName { get; set; } = string.Empty;
public int TokenWeight { get; set; }
public string Body { get; set; } = string.Empty;
public string CreatedByUserName { get; set; } = string.Empty;
public string ModifiedByUserName { get; set; } = string.Empty;
public int PaginationPageCount { get; set; }
public decimal Match { get; set; }
public decimal Weight { get; set; }
public decimal Score { get; set; }
public string Title
{
get
{
if (Name.Contains("::"))
{
return Name.Substring(Name.IndexOf("::") + 2).Trim();
}
return Name;
}
}
public string Namespace
{
get
{
if (Name.Contains("::"))
{
return Name.Substring(0, Name.IndexOf("::")).Trim();
}
return string.Empty;
}
}
}
}

View File

@@ -0,0 +1,20 @@
namespace TightWiki.Models.DataModels
{
/// <summary>
/// Used to cache pre-processed wiki results.
/// </summary>
public class PageCache
{
/// <summary>
/// Custom page title set by a call to @@Title("...")
/// </summary>
public string? PageTitle { get; set; }
public string Body { get; set; }
public PageCache(string body)
{
Body = body;
}
}
}

View File

@@ -0,0 +1,15 @@
namespace TightWiki.Models.DataModels
{
public partial class PageComment
{
public int Id { get; set; }
public int PageId { get; set; }
public Guid UserId { get; set; }
public string Body { get; set; } = string.Empty;
public string UserName { get; set; } = string.Empty;
public string UserNavigation { get; set; } = string.Empty;
public string PageName { get; set; } = string.Empty;
public DateTime CreatedDate { get; set; }
public int PaginationPageCount { get; set; }
}
}

View File

@@ -0,0 +1,34 @@
namespace TightWiki.Models.DataModels
{
public class PageCompilationStatistics
{
public string Name { get; set; } = string.Empty;
public string Title
{
get
{
if (Name.Contains("::"))
{
return Name.Substring(Name.IndexOf("::") + 2).Trim();
}
return Name;
}
}
public string Namespace { get; set; } = string.Empty;
public string Navigation { get; set; } = string.Empty;
public DateTime LatestBuild { get; set; }
public decimal Compilations { get; set; }
public decimal AvgBuildTimeMs { get; set; }
public decimal AvgWikiMatches { get; set; }
public decimal TotalErrorCount { get; set; }
public decimal AvgOutgoingLinkCount { get; set; }
public decimal AvgTagCount { get; set; }
public decimal AvgRawBodySize { get; set; }
public decimal AvgWikifiedBodySize { get; set; }
public int PaginationPageSize { get; set; }
public int PaginationPageCount { get; set; }
}
}

View File

@@ -0,0 +1,20 @@
using NTDLS.Helpers;
namespace TightWiki.Models.DataModels
{
public partial class PageFileAttachment
{
public int PaginationPageSize { get; set; }
public int PaginationPageCount { get; set; }
public int Id { get; set; }
public int PageId { get; set; }
public string Name { get; set; } = string.Empty;
public string ContentType { get; set; } = string.Empty;
public long Size { get; set; }
public DateTime CreatedDate { get; set; }
public byte[] Data { get; set; } = Array.Empty<byte>();
public string FileNavigation { get; set; } = string.Empty;
public string PageNavigation { get; set; } = string.Empty;
public string FriendlySize => Formatters.FileSize(Size);
}
}

View File

@@ -0,0 +1,21 @@
namespace TightWiki.Models.DataModels
{
public partial class PageFileAttachmentInfo
{
public int PaginationPageSize { get; set; }
public int PaginationPageCount { get; set; }
public int Id { get; set; }
public int PageId { get; set; }
public string Name { get; set; } = string.Empty;
public string ContentType { get; set; } = string.Empty;
public long Size { get; set; }
public DateTime CreatedDate { get; set; }
public string FileNavigation { get; set; } = string.Empty;
public string PageNavigation { get; set; } = string.Empty;
public int FileRevision { get; set; }
public Guid CreatedByUserId { get; set; }
public string CreatedByUserName { get; set; } = string.Empty;
public string CreatedByNavigation { get; set; } = string.Empty;
public string FriendlySize => NTDLS.Helpers.Formatters.FileSize(Size);
}
}

View File

@@ -0,0 +1,12 @@
namespace TightWiki.Models.DataModels
{
public class PageFileRevisionAttachmentInfo
{
public int Revision { get; set; }
public string ContentType { get; set; } = string.Empty;
public int Size { get; set; }
public int DataHash { get; set; }
public int PageId { get; set; }
public int PageFileId { get; set; }
}
}

View File

@@ -0,0 +1,22 @@
namespace TightWiki.Models.DataModels
{
public class PageRevision
{
public int PaginationPageSize { get; set; }
public int PaginationPageCount { get; set; }
public int PageId { get; set; }
public string ModifiedByUserName { get; set; } = string.Empty;
public Guid ModifiedByUserId { get; set; }
public DateTime ModifiedDate { get; set; }
public string Name { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public int Revision { get; set; }
public int HigherRevisionCount { get; set; }
public int HighestRevision { get; set; }
public string Navigation { get; set; } = string.Empty;
public Guid CreatedByUserId { get; set; }
public string CreatedByUserName { get; set; } = string.Empty;
public DateTime CreatedDate { get; set; }
public string ChangeSummary { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,10 @@
namespace TightWiki.Models.DataModels
{
public class PageSearchToken
{
public int PageId { get; set; }
public double Match { get; set; }
public double Weight { get; set; }
public double Score { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
namespace TightWiki.Models.DataModels
{
public partial class PageTag
{
public int Id { get; set; }
public int PageId { get; set; }
public string Tag { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,22 @@
namespace TightWiki.Models.DataModels
{
public class PageToken
{
public int PageId { get; set; }
public string Token { get; set; } = string.Empty;
public string DoubleMetaphone { get; set; } = string.Empty;
public double Weight { get; set; }
public override bool Equals(object? obj)
{
return obj is PageToken other
&& PageId == other.PageId
&& string.Equals(Token, other.Token, StringComparison.OrdinalIgnoreCase);
}
public override int GetHashCode()
{
return HashCode.Combine(PageId, Token.ToLower());
}
}
}

View File

@@ -0,0 +1,11 @@
namespace TightWiki.Models.DataModels
{
public partial class ProcessingInstruction
{
public int PageId { get; set; }
/// <summary>
/// TightWiki.Library.Constants.WikiInstruction
/// </summary>
public string Instruction { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,15 @@
namespace TightWiki.Models.DataModels
{
public class ProcessingInstructionCollection
{
public List<ProcessingInstruction> Collection { get; set; } = new();
/// <summary>
/// Returns true if the collection contains the given processing instruction.
/// </summary>
/// <param name="wikiInstruction">WikiInstruction.Protect</param>
/// <returns></returns>
public bool Contains(string wikiInstruction)
=> Collection.Any(o => string.Equals(o.Instruction, wikiInstruction, StringComparison.InvariantCultureIgnoreCase));
}
}

View File

@@ -0,0 +1,8 @@
namespace TightWiki.Models.DataModels
{
public class ProfileAvatar
{
public byte[]? Bytes { get; set; }
public string ContentType { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,26 @@
namespace TightWiki.Models.DataModels
{
public partial class RelatedPage
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Navigation { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public int Matches { get; set; }
public int PaginationPageSize { get; set; }
public int PaginationPageCount { get; set; }
public string Title
{
get
{
if (Name.Contains("::"))
{
return Name.Substring(Name.IndexOf("::") + 2).Trim();
}
return Name;
}
}
}
}

View File

@@ -0,0 +1,9 @@
namespace TightWiki.Models.DataModels
{
public partial class Role
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,8 @@
namespace TightWiki.Models.DataModels
{
public class TagAssociation
{
public string Tag { get; set; } = string.Empty;
public int PageCount { get; set; }
}
}

View File

@@ -0,0 +1,21 @@
namespace TightWiki.Models.DataModels
{
public class TagCloudItem
{
public string Name = "";
public string HTML = "";
public int Rank = 0;
public TagCloudItem(string name, int rank, string html)
{
Name = name;
HTML = html;
Rank = rank;
}
public static int CompareItem(TagCloudItem x, TagCloudItem y)
{
return string.Compare(x.Name, y.Name);
}
}
}

View File

@@ -0,0 +1,11 @@
namespace TightWiki.Models.DataModels
{
public class UpsertEmoji
{
public int? Id { get; set; }
public string Name { get; set; } = string.Empty;
public List<string> Categories { get; set; } = new();
public byte[]? ImageData { get; set; }
public string MimeType { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,9 @@
namespace TightWiki.Models.DataModels
{
public partial class UserRole
{
public int Id { get; set; }
public Guid UserId { get; set; }
public int RoleId { get; set; }
}
}

View File

@@ -0,0 +1,17 @@
namespace TightWiki.Models.DataModels
{
public class WikiDatabaseStatistics
{
public int Pages { get; set; }
public int IntraLinks { get; set; }
public int PageRevisions { get; set; }
public int PageAttachments { get; set; }
public int PageAttachmentRevisions { get; set; }
public int PageTags { get; set; }
public int PageSearchTokens { get; set; }
public int Users { get; set; }
public int Profiles { get; set; }
public int Exceptions { get; set; }
public int Namespaces { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
namespace TightWiki.Models.DataModels
{
public class WikiException
{
public int Id { get; set; }
public string Text { get; set; } = string.Empty;
public string ExceptionText { get; set; } = string.Empty;
public string StackTrace { get; set; } = string.Empty;
public DateTime CreatedDate { get; set; }
public int PaginationPageCount { get; set; }
}
}