diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-04-12 19:15:39 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-04-12 19:15:39 -0400 |
commit | 0b48c1748b354458059c7607415288de072b01e9 (patch) | |
tree | f63fd950f565d363414eb692be9024895cdea174 /src/SMAPI.Web/ViewModels/ModListModel.cs | |
parent | 9fbed0fa1f28a9b0fe0b952a78b10e2d475adb03 (diff) | |
download | SMAPI-0b48c1748b354458059c7607415288de072b01e9.tar.gz SMAPI-0b48c1748b354458059c7607415288de072b01e9.tar.bz2 SMAPI-0b48c1748b354458059c7607415288de072b01e9.zip |
enable nullable annotations in the web project & related code (#837)
Diffstat (limited to 'src/SMAPI.Web/ViewModels/ModListModel.cs')
-rw-r--r-- | src/SMAPI.Web/ViewModels/ModListModel.cs | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/SMAPI.Web/ViewModels/ModListModel.cs b/src/SMAPI.Web/ViewModels/ModListModel.cs index f0cf0c3a..be9f973a 100644 --- a/src/SMAPI.Web/ViewModels/ModListModel.cs +++ b/src/SMAPI.Web/ViewModels/ModListModel.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Collections.Generic; using System.Linq; @@ -13,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; |