diff options
-rw-r--r-- | release-notes.md | 1 | ||||
-rw-r--r-- | src/StardewModdingAPI/ISemanticVersion.cs | 3 | ||||
-rw-r--r-- | src/StardewModdingAPI/SemanticVersion.cs | 12 |
3 files changed, 15 insertions, 1 deletions
diff --git a/release-notes.md b/release-notes.md index 610426d7..9d9131ca 100644 --- a/release-notes.md +++ b/release-notes.md @@ -11,6 +11,7 @@ For mod developers: * Added `InputEvents` which combine keyboard + mouse + controller input for simpler input handling; add metadata like the cursor position and grab tile for simpler click handling; and add an option to suppress input from the game. * Added support for optional dependencies. * Added support for string versions (like `"1.0-alpha"`) in `manifest.json`. +* Added `IEquatable<ISemanticVersion>` to `ISemanticVersion`. * Removed all deprecated code. * Removed support for mods with no `Name`, `Version`, or `UniqueID` in their manifest. * Removed support for mods with a non-unique `UniqueID` value in their manifest. diff --git a/src/StardewModdingAPI/ISemanticVersion.cs b/src/StardewModdingAPI/ISemanticVersion.cs index 27a2f67d..c1a4ca3a 100644 --- a/src/StardewModdingAPI/ISemanticVersion.cs +++ b/src/StardewModdingAPI/ISemanticVersion.cs @@ -4,6 +4,9 @@ namespace StardewModdingAPI { /// <summary>A semantic version with an optional release tag.</summary> public interface ISemanticVersion : IComparable<ISemanticVersion> +#if !SMAPI_1_x + , IEquatable<ISemanticVersion> +#endif { /********* ** Accessors diff --git a/src/StardewModdingAPI/SemanticVersion.cs b/src/StardewModdingAPI/SemanticVersion.cs index 4b27c819..f30c43cd 100644 --- a/src/StardewModdingAPI/SemanticVersion.cs +++ b/src/StardewModdingAPI/SemanticVersion.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Text.RegularExpressions; namespace StardewModdingAPI @@ -178,6 +178,16 @@ namespace StardewModdingAPI return this.IsBetween(new SemanticVersion(min), new SemanticVersion(max)); } +#if !SMAPI_1_x + /// <summary>Indicates whether the current object is equal to another object of the same type.</summary> + /// <returns>true if the current object is equal to the <paramref name="other" /> parameter; otherwise, false.</returns> + /// <param name="other">An object to compare with this object.</param> + public bool Equals(ISemanticVersion other) + { + return other != null && this.CompareTo(other) == 0; + } +#endif + /// <summary>Get a string representation of the version.</summary> public override string ToString() { |