summaryrefslogtreecommitdiff
path: root/src/SMAPI.Toolkit.CoreInterfaces
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-05-01 18:16:09 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-05-01 18:16:09 -0400
commitc8ad50dad1d706a1901798f9396f6becfea36c0e (patch)
tree28bd818a5db39ec5ece1bd141a28de955950463b /src/SMAPI.Toolkit.CoreInterfaces
parent451b70953ff4c0b1b27ae0de203ad99379b45b2a (diff)
parentf78093bdb58d477b400cde3f19b70ffd6ddf833d (diff)
downloadSMAPI-c8ad50dad1d706a1901798f9396f6becfea36c0e.tar.gz
SMAPI-c8ad50dad1d706a1901798f9396f6becfea36c0e.tar.bz2
SMAPI-c8ad50dad1d706a1901798f9396f6becfea36c0e.zip
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI.Toolkit.CoreInterfaces')
-rw-r--r--src/SMAPI.Toolkit.CoreInterfaces/IManifest.cs6
-rw-r--r--src/SMAPI.Toolkit.CoreInterfaces/IManifestContentPackFor.cs2
-rw-r--r--src/SMAPI.Toolkit.CoreInterfaces/IManifestDependency.cs2
-rw-r--r--src/SMAPI.Toolkit.CoreInterfaces/ISemanticVersion.cs40
4 files changed, 30 insertions, 20 deletions
diff --git a/src/SMAPI.Toolkit.CoreInterfaces/IManifest.cs b/src/SMAPI.Toolkit.CoreInterfaces/IManifest.cs
index 7375f005..ee6cc0b6 100644
--- a/src/SMAPI.Toolkit.CoreInterfaces/IManifest.cs
+++ b/src/SMAPI.Toolkit.CoreInterfaces/IManifest.cs
@@ -21,16 +21,16 @@ namespace StardewModdingAPI
ISemanticVersion Version { get; }
/// <summary>The minimum SMAPI version required by this mod, if any.</summary>
- ISemanticVersion MinimumApiVersion { get; }
+ ISemanticVersion? MinimumApiVersion { get; }
/// <summary>The unique mod ID.</summary>
string UniqueID { get; }
/// <summary>The name of the DLL in the directory that has the <c>Entry</c> method. Mutually exclusive with <see cref="ContentPackFor"/>.</summary>
- string EntryDll { get; }
+ string? EntryDll { get; }
/// <summary>The mod which will read this as a content pack. Mutually exclusive with <see cref="EntryDll"/>.</summary>
- IManifestContentPackFor ContentPackFor { get; }
+ IManifestContentPackFor? ContentPackFor { get; }
/// <summary>The other mods that must be loaded before this mod.</summary>
IManifestDependency[] Dependencies { get; }
diff --git a/src/SMAPI.Toolkit.CoreInterfaces/IManifestContentPackFor.cs b/src/SMAPI.Toolkit.CoreInterfaces/IManifestContentPackFor.cs
index f05a3873..52ac8f1c 100644
--- a/src/SMAPI.Toolkit.CoreInterfaces/IManifestContentPackFor.cs
+++ b/src/SMAPI.Toolkit.CoreInterfaces/IManifestContentPackFor.cs
@@ -7,6 +7,6 @@ namespace StardewModdingAPI
string UniqueID { get; }
/// <summary>The minimum required version (if any).</summary>
- ISemanticVersion MinimumVersion { get; }
+ ISemanticVersion? MinimumVersion { get; }
}
}
diff --git a/src/SMAPI.Toolkit.CoreInterfaces/IManifestDependency.cs b/src/SMAPI.Toolkit.CoreInterfaces/IManifestDependency.cs
index e86cd1f4..58425eb2 100644
--- a/src/SMAPI.Toolkit.CoreInterfaces/IManifestDependency.cs
+++ b/src/SMAPI.Toolkit.CoreInterfaces/IManifestDependency.cs
@@ -10,7 +10,7 @@ namespace StardewModdingAPI
string UniqueID { get; }
/// <summary>The minimum required version (if any).</summary>
- ISemanticVersion MinimumVersion { get; }
+ ISemanticVersion? MinimumVersion { get; }
/// <summary>Whether the dependency must be installed to use the mod.</summary>
bool IsRequired { get; }
diff --git a/src/SMAPI.Toolkit.CoreInterfaces/ISemanticVersion.cs b/src/SMAPI.Toolkit.CoreInterfaces/ISemanticVersion.cs
index b228b2d1..dc226b7c 100644
--- a/src/SMAPI.Toolkit.CoreInterfaces/ISemanticVersion.cs
+++ b/src/SMAPI.Toolkit.CoreInterfaces/ISemanticVersion.cs
@@ -1,4 +1,5 @@
using System;
+using System.Diagnostics.CodeAnalysis;
namespace StardewModdingAPI
{
@@ -18,46 +19,55 @@ namespace StardewModdingAPI
int PatchVersion { get; }
/// <summary>An optional prerelease tag.</summary>
- string PrereleaseTag { get; }
+ string? PrereleaseTag { get; }
/// <summary>Optional build metadata. This is ignored when determining version precedence.</summary>
- string BuildMetadata { get; }
+ string? BuildMetadata { get; }
/*********
** Accessors
*********/
/// <summary>Whether this is a prerelease version.</summary>
+#if NET5_0_OR_GREATER
+ [MemberNotNullWhen(true, nameof(ISemanticVersion.PrereleaseTag))]
+#endif
bool IsPrerelease();
/// <summary>Get whether this version is older than the specified version.</summary>
/// <param name="other">The version to compare with this instance.</param>
- bool IsOlderThan(ISemanticVersion other);
+ /// <remarks>Although the <paramref name="other"/> parameter is nullable, it isn't optional. A <c>null</c> version is considered earlier than every possible valid version, so passing <c>null</c> to <paramref name="other"/> will always return false.</remarks>
+ bool IsOlderThan(ISemanticVersion? other);
/// <summary>Get whether this version is older than the specified version.</summary>
- /// <param name="other">The version to compare with this instance.</param>
+ /// <param name="other">The version to compare with this instance. A null value is never older.</param>
/// <exception cref="FormatException">The specified version is not a valid semantic version.</exception>
- bool IsOlderThan(string other);
+ /// <remarks>Although the <paramref name="other"/> parameter is nullable, it isn't optional. A <c>null</c> version is considered earlier than every possible valid version, so passing <c>null</c> to <paramref name="other"/> will always return false.</remarks>
+ bool IsOlderThan(string? other);
/// <summary>Get whether this version is newer than the specified version.</summary>
- /// <param name="other">The version to compare with this instance.</param>
- bool IsNewerThan(ISemanticVersion other);
+ /// <param name="other">The version to compare with this instance. A null value is always older.</param>
+ /// <remarks>Although the <paramref name="other"/> parameter is nullable, it isn't optional. A <c>null</c> version is considered earlier than every possible valid version, so passing <c>null</c> to <paramref name="other"/> will always return true.</remarks>
+ bool IsNewerThan(ISemanticVersion? other);
/// <summary>Get whether this version is newer than the specified version.</summary>
- /// <param name="other">The version to compare with this instance.</param>
+ /// <param name="other">The version to compare with this instance. A null value is always older.</param>
/// <exception cref="FormatException">The specified version is not a valid semantic version.</exception>
- bool IsNewerThan(string other);
+ /// <remarks>Although the <paramref name="other"/> parameter is nullable, it isn't optional. A <c>null</c> version is considered earlier than every possible valid version, so passing <c>null</c> to <paramref name="other"/> will always return true.</remarks>
+ bool IsNewerThan(string? other);
/// <summary>Get whether this version is between two specified versions (inclusively).</summary>
- /// <param name="min">The minimum version.</param>
- /// <param name="max">The maximum version.</param>
- bool IsBetween(ISemanticVersion min, ISemanticVersion max);
+ /// <param name="min">The minimum version. A null value is always older.</param>
+ /// <param name="max">The maximum version. A null value is never newer.</param>
+ /// <remarks>Although the <paramref name="min"/> and <paramref name="max"/> parameters are nullable, they are not optional. A <c>null</c> version is considered earlier than every possible valid version. For example, passing <c>null</c> to <paramref name="max"/> will always return false, since no valid version can be earlier than <c>null</c>.</remarks>
+ bool IsBetween(ISemanticVersion? min, ISemanticVersion? max);
/// <summary>Get whether this version is between two specified versions (inclusively).</summary>
- /// <param name="min">The minimum version.</param>
- /// <param name="max">The maximum version.</param>
+ /// <param name="min">The minimum version. A null value is always older.</param>
+ /// <param name="max">The maximum version. A null value is never newer.</param>
/// <exception cref="FormatException">One of the specified versions is not a valid semantic version.</exception>
- bool IsBetween(string min, string max);
+ /// <remarks>Although the <paramref name="min"/> and <paramref name="max"/> parameters are nullable, they are not optional. A <c>null</c> version is considered earlier than every possible valid version. For example, passing <c>null</c> to <paramref name="max"/> will always return false, since no valid version can be earlier than <c>null</c>.</remarks>
+ bool IsBetween(string? min, string? max);
/// <summary>Get a string representation of the version.</summary>
string ToString();