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/IModPage.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/IModPage.cs')
-rw-r--r-- | src/SMAPI.Web/Framework/IModPage.cs | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/SMAPI.Web/Framework/IModPage.cs b/src/SMAPI.Web/Framework/IModPage.cs index 68220b49..4d0a8d61 100644 --- a/src/SMAPI.Web/Framework/IModPage.cs +++ b/src/SMAPI.Web/Framework/IModPage.cs @@ -1,6 +1,5 @@ -#nullable disable - using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using StardewModdingAPI.Toolkit.Framework.UpdateData; namespace StardewModdingAPI.Web.Framework @@ -18,13 +17,13 @@ namespace StardewModdingAPI.Web.Framework string Id { get; } /// <summary>The mod name.</summary> - string Name { get; } + string? Name { get; } /// <summary>The mod's semantic version number.</summary> - string Version { get; } + string? Version { get; } /// <summary>The mod's web URL.</summary> - string Url { get; } + string? Url { get; } /// <summary>The mod downloads.</summary> IModDownload[] Downloads { get; } @@ -33,7 +32,12 @@ namespace StardewModdingAPI.Web.Framework RemoteModStatus Status { get; } /// <summary>A user-friendly error which indicates why fetching the mod info failed (if applicable).</summary> - string Error { get; } + string? Error { get; } + + /// <summary>Whether the mod data is valid.</summary> + [MemberNotNullWhen(true, nameof(IModPage.Name), nameof(IModPage.Url))] + [MemberNotNullWhen(false, nameof(IModPage.Error))] + bool IsValid { get; } /********* @@ -44,7 +48,7 @@ namespace StardewModdingAPI.Web.Framework /// <param name="version">The mod's semantic version number.</param> /// <param name="url">The mod's web URL.</param> /// <param name="downloads">The mod downloads.</param> - IModPage SetInfo(string name, string version, string url, IEnumerable<IModDownload> downloads); + IModPage SetInfo(string name, string? version, string url, IEnumerable<IModDownload> downloads); /// <summary>Set a mod fetch error.</summary> /// <param name="status">The mod availability status on the remote site.</param> |