summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-07-20 00:01:40 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-07-23 11:50:09 -0400
commit24b824644d708a514614b4e30b41567ea87902cc (patch)
treed50c36a57461be2c336b5e0a12ba55c3f9c0a9e9 /src/StardewModdingAPI
parent5726ebe20ee65e1d9f73678bc72210fa73d50fc0 (diff)
downloadSMAPI-24b824644d708a514614b4e30b41567ea87902cc.tar.gz
SMAPI-24b824644d708a514614b4e30b41567ea87902cc.tar.bz2
SMAPI-24b824644d708a514614b4e30b41567ea87902cc.zip
make semantic versions equatable in 2.0
Diffstat (limited to 'src/StardewModdingAPI')
-rw-r--r--src/StardewModdingAPI/ISemanticVersion.cs3
-rw-r--r--src/StardewModdingAPI/SemanticVersion.cs12
2 files changed, 14 insertions, 1 deletions
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()
{