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/Framework/Caching/Wiki/WikiCacheMemoryRepository.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/Framework/Caching/Wiki/WikiCacheMemoryRepository.cs')
-rw-r--r-- | src/SMAPI.Web/Framework/Caching/Wiki/WikiCacheMemoryRepository.cs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/SMAPI.Web/Framework/Caching/Wiki/WikiCacheMemoryRepository.cs b/src/SMAPI.Web/Framework/Caching/Wiki/WikiCacheMemoryRepository.cs index d1ccb9c7..8b4338e2 100644 --- a/src/SMAPI.Web/Framework/Caching/Wiki/WikiCacheMemoryRepository.cs +++ b/src/SMAPI.Web/Framework/Caching/Wiki/WikiCacheMemoryRepository.cs @@ -1,7 +1,6 @@ -#nullable disable - using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq; using StardewModdingAPI.Toolkit.Framework.Clients.Wiki; @@ -14,7 +13,7 @@ namespace StardewModdingAPI.Web.Framework.Caching.Wiki ** Fields *********/ /// <summary>The saved wiki metadata.</summary> - private Cached<WikiMetadata> Metadata; + private Cached<WikiMetadata>? Metadata; /// <summary>The cached wiki data.</summary> private Cached<WikiModEntry>[] Mods = Array.Empty<Cached<WikiModEntry>>(); @@ -25,7 +24,7 @@ namespace StardewModdingAPI.Web.Framework.Caching.Wiki *********/ /// <summary>Get the cached wiki metadata.</summary> /// <param name="metadata">The fetched metadata.</param> - public bool TryGetWikiMetadata(out Cached<WikiMetadata> metadata) + public bool TryGetWikiMetadata([NotNullWhen(true)] out Cached<WikiMetadata>? metadata) { metadata = this.Metadata; return metadata != null; @@ -33,7 +32,7 @@ namespace StardewModdingAPI.Web.Framework.Caching.Wiki /// <summary>Get the cached wiki mods.</summary> /// <param name="filter">A filter to apply, if any.</param> - public IEnumerable<Cached<WikiModEntry>> GetWikiMods(Func<WikiModEntry, bool> filter = null) + public IEnumerable<Cached<WikiModEntry>> GetWikiMods(Func<WikiModEntry, bool>? filter = null) { foreach (var mod in this.Mods) { @@ -46,7 +45,7 @@ namespace StardewModdingAPI.Web.Framework.Caching.Wiki /// <param name="stableVersion">The current stable Stardew Valley version.</param> /// <param name="betaVersion">The current beta Stardew Valley version.</param> /// <param name="mods">The mod data.</param> - public void SaveWikiData(string stableVersion, string betaVersion, IEnumerable<WikiModEntry> mods) + public void SaveWikiData(string? stableVersion, string? betaVersion, IEnumerable<WikiModEntry> mods) { this.Metadata = new Cached<WikiMetadata>(new WikiMetadata(stableVersion, betaVersion)); this.Mods = mods.Select(mod => new Cached<WikiModEntry>(mod)).ToArray(); |