diff options
Diffstat (limited to 'src/SMAPI.Web/ViewModels')
-rw-r--r-- | src/SMAPI.Web/ViewModels/IndexModel.cs | 11 | ||||
-rw-r--r-- | src/SMAPI.Web/ViewModels/IndexVersionModel.cs | 13 | ||||
-rw-r--r-- | src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorErrorModel.cs | 13 | ||||
-rw-r--r-- | src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorModel.cs | 29 | ||||
-rw-r--r-- | src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorRequestModel.cs | 4 | ||||
-rw-r--r-- | src/SMAPI.Web/ViewModels/LogParserModel.cs | 55 | ||||
-rw-r--r-- | src/SMAPI.Web/ViewModels/ModCompatibilityModel.cs | 25 | ||||
-rw-r--r-- | src/SMAPI.Web/ViewModels/ModLinkModel.cs | 4 | ||||
-rw-r--r-- | src/SMAPI.Web/ViewModels/ModListModel.cs | 17 | ||||
-rw-r--r-- | src/SMAPI.Web/ViewModels/ModModel.cs | 63 |
10 files changed, 145 insertions, 89 deletions
diff --git a/src/SMAPI.Web/ViewModels/IndexModel.cs b/src/SMAPI.Web/ViewModels/IndexModel.cs index d8d2d27f..098f18cc 100644 --- a/src/SMAPI.Web/ViewModels/IndexModel.cs +++ b/src/SMAPI.Web/ViewModels/IndexModel.cs @@ -7,26 +7,23 @@ namespace StardewModdingAPI.Web.ViewModels ** Accessors *********/ /// <summary>The latest stable SMAPI version.</summary> - public IndexVersionModel StableVersion { get; set; } + public IndexVersionModel StableVersion { get; } /// <summary>A message to show below the download button (e.g. for details on downloading a beta version), in Markdown format.</summary> - public string OtherBlurb { get; set; } + public string? OtherBlurb { get; } /// <summary>A list of supports to credit on the main page, in Markdown format.</summary> - public string SupporterList { get; set; } + public string? SupporterList { get; } /********* ** Public methods *********/ /// <summary>Construct an instance.</summary> - public IndexModel() { } - - /// <summary>Construct an instance.</summary> /// <param name="stableVersion">The latest stable SMAPI version.</param> /// <param name="otherBlurb">A message to show below the download button (e.g. for details on downloading a beta version), in Markdown format.</param> /// <param name="supporterList">A list of supports to credit on the main page, in Markdown format.</param> - internal IndexModel(IndexVersionModel stableVersion, string otherBlurb, string supporterList) + internal IndexModel(IndexVersionModel stableVersion, string? otherBlurb, string? supporterList) { this.StableVersion = stableVersion; this.OtherBlurb = otherBlurb; diff --git a/src/SMAPI.Web/ViewModels/IndexVersionModel.cs b/src/SMAPI.Web/ViewModels/IndexVersionModel.cs index 4f63b979..a76a5924 100644 --- a/src/SMAPI.Web/ViewModels/IndexVersionModel.cs +++ b/src/SMAPI.Web/ViewModels/IndexVersionModel.cs @@ -7,30 +7,27 @@ namespace StardewModdingAPI.Web.ViewModels ** Accessors *********/ /// <summary>The release version.</summary> - public string Version { get; set; } + public string Version { get; } /// <summary>The Markdown description for the release.</summary> - public string Description { get; set; } + public string Description { get; } /// <summary>The main download URL.</summary> - public string DownloadUrl { get; set; } + public string DownloadUrl { get; } /// <summary>The for-developers download URL (not applicable for prerelease versions).</summary> - public string DevDownloadUrl { get; set; } + public string? DevDownloadUrl { get; } /********* ** Public methods *********/ /// <summary>Construct an instance.</summary> - public IndexVersionModel() { } - - /// <summary>Construct an instance.</summary> /// <param name="version">The release number.</param> /// <param name="description">The Markdown description for the release.</param> /// <param name="downloadUrl">The main download URL.</param> /// <param name="devDownloadUrl">The for-developers download URL (not applicable for prerelease versions).</param> - internal IndexVersionModel(string version, string description, string downloadUrl, string devDownloadUrl) + internal IndexVersionModel(string version, string description, string downloadUrl, string? devDownloadUrl) { this.Version = version; this.Description = description; diff --git a/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorErrorModel.cs b/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorErrorModel.cs index 62b95501..4d37d449 100644 --- a/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorErrorModel.cs +++ b/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorErrorModel.cs @@ -9,30 +9,27 @@ namespace StardewModdingAPI.Web.ViewModels.JsonValidator ** Accessors *********/ /// <summary>The line number on which the error occurred.</summary> - public int Line { get; set; } + public int Line { get; } /// <summary>The field path in the JSON file where the error occurred.</summary> - public string Path { get; set; } + public string? Path { get; } /// <summary>A human-readable description of the error.</summary> - public string Message { get; set; } + public string Message { get; } /// <summary>The schema error type.</summary> - public ErrorType SchemaErrorType { get; set; } + public ErrorType SchemaErrorType { get; } /********* ** Public methods *********/ /// <summary>Construct an instance.</summary> - public JsonValidatorErrorModel() { } - - /// <summary>Construct an instance.</summary> /// <param name="line">The line number on which the error occurred.</param> /// <param name="path">The field path in the JSON file where the error occurred.</param> /// <param name="message">A human-readable description of the error.</param> /// <param name="schemaErrorType">The schema error type.</param> - public JsonValidatorErrorModel(int line, string path, string message, ErrorType schemaErrorType) + public JsonValidatorErrorModel(int line, string? path, string message, ErrorType schemaErrorType) { this.Line = line; this.Path = path; diff --git a/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorModel.cs b/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorModel.cs index 0ea69911..85c2f44d 100644 --- a/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorModel.cs +++ b/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorModel.cs @@ -11,51 +11,48 @@ namespace StardewModdingAPI.Web.ViewModels.JsonValidator ** Accessors *********/ /// <summary>Whether to show the edit view.</summary> - public bool IsEditView { get; set; } + public bool IsEditView { get; } /// <summary>The paste ID.</summary> - public string PasteID { get; set; } + public string? PasteID { get; } /// <summary>The schema name with which the JSON was validated.</summary> - public string SchemaName { get; set; } + public string? SchemaName { get; } /// <summary>The supported JSON schemas (names indexed by ID).</summary> - public readonly IDictionary<string, string> SchemaFormats; + public IDictionary<string, string> SchemaFormats { get; } /// <summary>The validated content.</summary> - public string Content { get; set; } + public string? Content { get; set; } /// <summary>The schema validation errors, if any.</summary> - public JsonValidatorErrorModel[] Errors { get; set; } = new JsonValidatorErrorModel[0]; + public JsonValidatorErrorModel[] Errors { get; set; } = Array.Empty<JsonValidatorErrorModel>(); /// <summary>A non-blocking warning while uploading the file.</summary> - public string UploadWarning { get; set; } + public string? UploadWarning { get; set; } /// <summary>When the uploaded file will no longer be available.</summary> - public DateTime? Expiry { get; set; } + public DateTimeOffset? Expiry { get; set; } /// <summary>An error which occurred while uploading the JSON.</summary> - public string UploadError { get; set; } + public string? UploadError { get; set; } /// <summary>An error which occurred while parsing the JSON.</summary> - public string ParseError { get; set; } + public string? ParseError { get; set; } /// <summary>A web URL to the user-facing format documentation.</summary> - public string FormatUrl { get; set; } + public string? FormatUrl { get; set; } /********* ** Public methods *********/ /// <summary>Construct an instance.</summary> - public JsonValidatorModel() { } - - /// <summary>Construct an instance.</summary> /// <param name="pasteID">The stored file ID.</param> /// <param name="schemaName">The schema name with which the JSON was validated.</param> /// <param name="schemaFormats">The supported JSON schemas (names indexed by ID).</param> /// <param name="isEditView">Whether to show the edit view.</param> - public JsonValidatorModel(string pasteID, string schemaName, IDictionary<string, string> schemaFormats, bool isEditView) + public JsonValidatorModel(string? pasteID, string? schemaName, IDictionary<string, string> schemaFormats, bool isEditView) { this.PasteID = pasteID; this.SchemaName = schemaName; @@ -67,7 +64,7 @@ namespace StardewModdingAPI.Web.ViewModels.JsonValidator /// <param name="content">The validated content.</param> /// <param name="expiry">When the uploaded file will no longer be available.</param> /// <param name="uploadWarning">A non-blocking warning while uploading the log.</param> - public JsonValidatorModel SetContent(string content, DateTime? expiry, string uploadWarning = null) + public JsonValidatorModel SetContent(string content, DateTimeOffset? expiry, string? uploadWarning = null) { this.Content = content; this.Expiry = expiry; diff --git a/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorRequestModel.cs b/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorRequestModel.cs index c8e851bf..1313264f 100644 --- a/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorRequestModel.cs +++ b/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorRequestModel.cs @@ -7,9 +7,9 @@ namespace StardewModdingAPI.Web.ViewModels.JsonValidator ** Accessors *********/ /// <summary>The schema name with which to validate the JSON.</summary> - public string SchemaName { get; set; } + public string? SchemaName { get; set; } /// <summary>The raw content to validate.</summary> - public string Content { get; set; } + public string? Content { get; set; } } } diff --git a/src/SMAPI.Web/ViewModels/LogParserModel.cs b/src/SMAPI.Web/ViewModels/LogParserModel.cs index bea79eae..c39a9b0a 100644 --- a/src/SMAPI.Web/ViewModels/LogParserModel.cs +++ b/src/SMAPI.Web/ViewModels/LogParserModel.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Text.RegularExpressions; +using Newtonsoft.Json; using StardewModdingAPI.Toolkit.Utilities; using StardewModdingAPI.Web.Framework.LogParsing.Models; @@ -14,47 +16,48 @@ namespace StardewModdingAPI.Web.ViewModels ** Fields *********/ /// <summary>A regex pattern matching characters to remove from a mod name to create the slug ID.</summary> - private readonly Regex SlugInvalidCharPattern = new Regex("[^a-z0-9]", RegexOptions.Compiled | RegexOptions.IgnoreCase); + private readonly Regex SlugInvalidCharPattern = new("[^a-z0-9]", RegexOptions.Compiled | RegexOptions.IgnoreCase); /********* ** Accessors *********/ /// <summary>The paste ID.</summary> - public string PasteID { get; set; } + public string? PasteID { get; } /// <summary>The viewer's detected OS, if known.</summary> - public Platform? DetectedPlatform { get; set; } + public Platform? DetectedPlatform { get; } /// <summary>The parsed log info.</summary> - public ParsedLog ParsedLog { get; set; } + public ParsedLog? ParsedLog { get; private set; } /// <summary>Whether to show the raw unparsed log.</summary> - public bool ShowRaw { get; set; } + public bool ShowRaw { get; private set; } /// <summary>A non-blocking warning while uploading the log.</summary> - public string UploadWarning { get; set; } + public string? UploadWarning { get; set; } /// <summary>An error which occurred while uploading the log.</summary> - public string UploadError { get; set; } + public string? UploadError { get; set; } /// <summary>An error which occurred while parsing the log file.</summary> - public string ParseError => this.ParsedLog?.Error; + public string? ParseError => this.ParsedLog?.Error; /// <summary>When the uploaded file will no longer be available.</summary> - public DateTime? Expiry { get; set; } + public DateTimeOffset? Expiry { get; set; } + + /// <summary>Whether parsed log data is available.</summary> + [MemberNotNullWhen(true, nameof(LogParserModel.PasteID), nameof(LogParserModel.ParsedLog))] + public bool HasLog => this.ParsedLog != null; /********* ** Public methods *********/ /// <summary>Construct an instance.</summary> - public LogParserModel() { } - - /// <summary>Construct an instance.</summary> /// <param name="pasteID">The paste ID.</param> /// <param name="platform">The viewer's detected OS, if known.</param> - public LogParserModel(string pasteID, Platform? platform) + public LogParserModel(string? pasteID, Platform? platform) { this.PasteID = pasteID; this.DetectedPlatform = platform; @@ -62,6 +65,26 @@ namespace StardewModdingAPI.Web.ViewModels this.ShowRaw = false; } + /// <summary>Construct an instance.</summary> + /// <param name="pasteId">The paste ID.</param> + /// <param name="detectedPlatform">The viewer's detected OS, if known.</param> + /// <param name="parsedLog">The parsed log info.</param> + /// <param name="showRaw">Whether to show the raw unparsed log.</param> + /// <param name="uploadWarning">A non-blocking warning while uploading the log.</param> + /// <param name="uploadError">An error which occurred while uploading the log.</param> + /// <param name="expiry">When the uploaded file will no longer be available.</param> + [JsonConstructor] + public LogParserModel(string pasteId, Platform? detectedPlatform, ParsedLog? parsedLog, bool showRaw, string? uploadWarning, string? uploadError, DateTime? expiry) + { + this.PasteID = pasteId; + this.DetectedPlatform = detectedPlatform; + this.ParsedLog = parsedLog; + this.ShowRaw = showRaw; + this.UploadWarning = uploadWarning; + this.UploadError = uploadError; + this.Expiry = expiry; + } + /// <summary>Set the log parser result.</summary> /// <param name="parsedLog">The parsed log info.</param> /// <param name="showRaw">Whether to show the raw unparsed log.</param> @@ -77,14 +100,14 @@ namespace StardewModdingAPI.Web.ViewModels public IDictionary<string, LogModInfo[]> GetContentPacksByMod() { // get all mods & content packs - LogModInfo[] mods = this.ParsedLog?.Mods; + LogModInfo[]? mods = this.ParsedLog?.Mods; if (mods == null || !mods.Any()) return new Dictionary<string, LogModInfo[]>(); // group by mod return mods - .Where(mod => mod.ContentPackFor != null) - .GroupBy(mod => mod.ContentPackFor) + .Where(mod => mod.IsContentPack) + .GroupBy(mod => mod.ContentPackFor!) .ToDictionary(group => group.Key, group => group.ToArray()); } diff --git a/src/SMAPI.Web/ViewModels/ModCompatibilityModel.cs b/src/SMAPI.Web/ViewModels/ModCompatibilityModel.cs index 85bf1e46..36ea891d 100644 --- a/src/SMAPI.Web/ViewModels/ModCompatibilityModel.cs +++ b/src/SMAPI.Web/ViewModels/ModCompatibilityModel.cs @@ -1,3 +1,4 @@ +using Newtonsoft.Json; using StardewModdingAPI.Toolkit.Framework.Clients.Wiki; namespace StardewModdingAPI.Web.ViewModels @@ -9,22 +10,36 @@ namespace StardewModdingAPI.Web.ViewModels ** Accessors *********/ /// <summary>The compatibility status, as a string like <c>"Broken"</c>.</summary> - public string Status { get; set; } + public string Status { get; } /// <summary>The human-readable summary, as an HTML block.</summary> - public string Summary { get; set; } + public string? Summary { get; } /// <summary>The game or SMAPI version which broke this mod (if applicable).</summary> - public string BrokeIn { get; set; } + public string? BrokeIn { get; } /// <summary>A link to the unofficial version which fixes compatibility, if any.</summary> - public ModLinkModel UnofficialVersion { get; set; } + public ModLinkModel? UnofficialVersion { get; } /********* ** Public methods *********/ /// <summary>Construct an instance.</summary> + /// <param name="status">The compatibility status, as a string like <c>"Broken"</c>.</param> + /// <param name="summary">The human-readable summary, as an HTML block.</param> + /// <param name="brokeIn">The game or SMAPI version which broke this mod (if applicable).</param> + /// <param name="unofficialVersion">A link to the unofficial version which fixes compatibility, if any.</param> + [JsonConstructor] + public ModCompatibilityModel(string status, string? summary, string? brokeIn, ModLinkModel? unofficialVersion) + { + this.Status = status; + this.Summary = summary; + this.BrokeIn = brokeIn; + this.UnofficialVersion = unofficialVersion; + } + + /// <summary>Construct an instance.</summary> /// <param name="info">The mod metadata.</param> public ModCompatibilityModel(WikiCompatibilityInfo info) { @@ -34,7 +49,7 @@ namespace StardewModdingAPI.Web.ViewModels this.Summary = info.Summary; this.BrokeIn = info.BrokeIn; if (info.UnofficialVersion != null) - this.UnofficialVersion = new ModLinkModel(info.UnofficialUrl, info.UnofficialVersion.ToString()); + this.UnofficialVersion = new ModLinkModel(info.UnofficialUrl!, info.UnofficialVersion.ToString()); } } } diff --git a/src/SMAPI.Web/ViewModels/ModLinkModel.cs b/src/SMAPI.Web/ViewModels/ModLinkModel.cs index 97dd215c..96f14d48 100644 --- a/src/SMAPI.Web/ViewModels/ModLinkModel.cs +++ b/src/SMAPI.Web/ViewModels/ModLinkModel.cs @@ -7,10 +7,10 @@ namespace StardewModdingAPI.Web.ViewModels ** Accessors *********/ /// <summary>The URL of the linked page.</summary> - public string Url { get; set; } + public string Url { get; } /// <summary>The suggested link text.</summary> - public string Text { get; set; } + public string Text { get; } /********* diff --git a/src/SMAPI.Web/ViewModels/ModListModel.cs b/src/SMAPI.Web/ViewModels/ModListModel.cs index 6b8279c1..be9f973a 100644 --- a/src/SMAPI.Web/ViewModels/ModListModel.cs +++ b/src/SMAPI.Web/ViewModels/ModListModel.cs @@ -11,37 +11,34 @@ namespace StardewModdingAPI.Web.ViewModels ** Accessors *********/ /// <summary>The current stable version of the game.</summary> - public string StableVersion { get; set; } + public string? StableVersion { get; } /// <summary>The current beta version of the game (if any).</summary> - public string BetaVersion { get; set; } + public string? BetaVersion { get; } /// <summary>The mods to display.</summary> - public ModModel[] Mods { get; set; } + public ModModel[] Mods { get; } /// <summary>When the data was last updated.</summary> - public DateTimeOffset LastUpdated { get; set; } + public DateTimeOffset LastUpdated { get; } /// <summary>Whether the data hasn't been updated in a while.</summary> - public bool IsStale { get; set; } + public bool IsStale { get; } /// <summary>Whether the mod metadata is available.</summary> - public bool HasData => this.Mods?.Any() == true; + public bool HasData => this.Mods.Any(); /********* ** Public methods *********/ - /// <summary>Construct an empty instance.</summary> - public ModListModel() { } - /// <summary>Construct an instance.</summary> /// <param name="stableVersion">The current stable version of the game.</param> /// <param name="betaVersion">The current beta version of the game (if any).</param> /// <param name="mods">The mods to display.</param> /// <param name="lastUpdated">When the data was last updated.</param> /// <param name="isStale">Whether the data hasn't been updated in a while.</param> - public ModListModel(string stableVersion, string betaVersion, IEnumerable<ModModel> mods, DateTimeOffset lastUpdated, bool isStale) + public ModListModel(string? stableVersion, string? betaVersion, IEnumerable<ModModel> mods, DateTimeOffset lastUpdated, bool isStale) { this.StableVersion = stableVersion; this.BetaVersion = betaVersion; diff --git a/src/SMAPI.Web/ViewModels/ModModel.cs b/src/SMAPI.Web/ViewModels/ModModel.cs index 575d596a..929bf682 100644 --- a/src/SMAPI.Web/ViewModels/ModModel.cs +++ b/src/SMAPI.Web/ViewModels/ModModel.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using Newtonsoft.Json; using StardewModdingAPI.Toolkit.Framework.Clients.Wiki; namespace StardewModdingAPI.Web.ViewModels @@ -11,43 +12,43 @@ namespace StardewModdingAPI.Web.ViewModels ** Accessors *********/ /// <summary>The mod name.</summary> - public string Name { get; set; } + public string? Name { get; } /// <summary>The mod's alternative names, if any.</summary> - public string AlternateNames { get; set; } + public string AlternateNames { get; } /// <summary>The mod author's name.</summary> - public string Author { get; set; } + public string? Author { get; } /// <summary>The mod author's alternative names, if any.</summary> - public string AlternateAuthors { get; set; } + public string AlternateAuthors { get; } /// <summary>The GitHub repo, if any.</summary> - public string GitHubRepo { get; set; } + public string? GitHubRepo { get; } /// <summary>The URL to the mod's source code, if any.</summary> - public string SourceUrl { get; set; } + public string? SourceUrl { get; } /// <summary>The compatibility status for the stable version of the game.</summary> - public ModCompatibilityModel Compatibility { get; set; } + public ModCompatibilityModel Compatibility { get; } /// <summary>The compatibility status for the beta version of the game.</summary> - public ModCompatibilityModel BetaCompatibility { get; set; } + public ModCompatibilityModel? BetaCompatibility { get; } /// <summary>Links to the available mod pages.</summary> - public ModLinkModel[] ModPages { get; set; } + public ModLinkModel[] ModPages { get; } /// <summary>The human-readable warnings for players about this mod.</summary> - public string[] Warnings { get; set; } + public string[] Warnings { get; } /// <summary>The URL of the pull request which submits changes for an unofficial update to the author, if any.</summary> - public string PullRequestUrl { get; set; } + public string? PullRequestUrl { get; } - /// <summary>Special notes intended for developers who maintain unofficial updates or submit pull requests. </summary> - public string DevNote { get; set; } + /// <summary>Special notes intended for developers who maintain unofficial updates or submit pull requests.</summary> + public string? DevNote { get; } /// <summary>A unique identifier for the mod that can be used in an anchor URL.</summary> - public string Slug { get; set; } + public string? Slug { get; } /// <summary>The sites where the mod can be downloaded.</summary> public string[] ModPageSites => this.ModPages.Select(p => p.Text).ToArray(); @@ -57,6 +58,38 @@ namespace StardewModdingAPI.Web.ViewModels ** Public methods *********/ /// <summary>Construct an instance.</summary> + /// <param name="name">The mod name.</param> + /// <param name="alternateNames">The mod's alternative names, if any.</param> + /// <param name="author">The mod author's name.</param> + /// <param name="alternateAuthors">The mod author's alternative names, if any.</param> + /// <param name="gitHubRepo">The GitHub repo, if any.</param> + /// <param name="sourceUrl">The URL to the mod's source code, if any.</param> + /// <param name="compatibility">The compatibility status for the stable version of the game.</param> + /// <param name="betaCompatibility">The compatibility status for the beta version of the game.</param> + /// <param name="modPages">Links to the available mod pages.</param> + /// <param name="warnings">The human-readable warnings for players about this mod.</param> + /// <param name="pullRequestUrl">The URL of the pull request which submits changes for an unofficial update to the author, if any.</param> + /// <param name="devNote">Special notes intended for developers who maintain unofficial updates or submit pull requests.</param> + /// <param name="slug">A unique identifier for the mod that can be used in an anchor URL.</param> + [JsonConstructor] + public ModModel(string? name, string alternateNames, string author, string alternateAuthors, string gitHubRepo, string sourceUrl, ModCompatibilityModel compatibility, ModCompatibilityModel betaCompatibility, ModLinkModel[] modPages, string[] warnings, string pullRequestUrl, string devNote, string slug) + { + this.Name = name; + this.AlternateNames = alternateNames; + this.Author = author; + this.AlternateAuthors = alternateAuthors; + this.GitHubRepo = gitHubRepo; + this.SourceUrl = sourceUrl; + this.Compatibility = compatibility; + this.BetaCompatibility = betaCompatibility; + this.ModPages = modPages; + this.Warnings = warnings; + this.PullRequestUrl = pullRequestUrl; + this.DevNote = devNote; + this.Slug = slug; + } + + /// <summary>Construct an instance.</summary> /// <param name="entry">The mod metadata.</param> public ModModel(WikiModEntry entry) { @@ -82,7 +115,7 @@ namespace StardewModdingAPI.Web.ViewModels *********/ /// <summary>Get the web URL for the mod's source code repository, if any.</summary> /// <param name="entry">The mod metadata.</param> - private string GetSourceUrl(WikiModEntry entry) + private string? GetSourceUrl(WikiModEntry entry) { if (!string.IsNullOrWhiteSpace(entry.GitHubRepo)) return $"https://github.com/{entry.GitHubRepo}"; |