summaryrefslogtreecommitdiff
path: root/src/SMAPI.Common/SemanticVersionImpl.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-10-29 23:15:18 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-10-29 23:15:18 -0400
commit1bea3a9e3273b8222cc2cc5c153bfb70fdba521a (patch)
treed49b5984451c66d6965d494255ead626a1ba52e1 /src/SMAPI.Common/SemanticVersionImpl.cs
parent359e1df431fa160993f0640b3458a95a8ee831d7 (diff)
downloadSMAPI-1bea3a9e3273b8222cc2cc5c153bfb70fdba521a.tar.gz
SMAPI-1bea3a9e3273b8222cc2cc5c153bfb70fdba521a.tar.bz2
SMAPI-1bea3a9e3273b8222cc2cc5c153bfb70fdba521a.zip
let SemanticVersion be constructed from a System.Version (#375)
Diffstat (limited to 'src/SMAPI.Common/SemanticVersionImpl.cs')
-rw-r--r--src/SMAPI.Common/SemanticVersionImpl.cs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/SMAPI.Common/SemanticVersionImpl.cs b/src/SMAPI.Common/SemanticVersionImpl.cs
index 193d23f9..53cf5a21 100644
--- a/src/SMAPI.Common/SemanticVersionImpl.cs
+++ b/src/SMAPI.Common/SemanticVersionImpl.cs
@@ -49,6 +49,19 @@ namespace StardewModdingAPI.Common
}
/// <summary>Construct an instance.</summary>
+ /// <param name="version">The assembly version.</param>
+ /// <exception cref="ArgumentNullException">The <paramref name="version"/> is null.</exception>
+ public SemanticVersionImpl(Version version)
+ {
+ if (version == null)
+ throw new ArgumentNullException(nameof(version), "The input version can't be null.");
+
+ this.Major = version.Major;
+ this.Minor = version.Minor;
+ this.Patch = version.Build;
+ }
+
+ /// <summary>Construct an instance.</summary>
/// <param name="version">The semantic version string.</param>
/// <exception cref="ArgumentNullException">The <paramref name="version"/> is null.</exception>
/// <exception cref="FormatException">The <paramref name="version"/> is not a valid semantic version.</exception>