From 1bea3a9e3273b8222cc2cc5c153bfb70fdba521a Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 29 Oct 2017 23:15:18 -0400 Subject: let SemanticVersion be constructed from a System.Version (#375) --- src/SMAPI.Common/SemanticVersionImpl.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/SMAPI.Common/SemanticVersionImpl.cs') 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 @@ -48,6 +48,19 @@ namespace StardewModdingAPI.Common this.Tag = this.GetNormalisedTag(tag); } + /// Construct an instance. + /// The assembly version. + /// The is null. + 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; + } + /// Construct an instance. /// The semantic version string. /// The is null. -- cgit