diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-05-16 22:57:52 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-05-16 22:57:52 -0400 |
commit | bf02c54f8bc4499052af8870e080100a4a7f05a3 (patch) | |
tree | 0b1242fa4a2c1f6465f1867b05e09c0161eb3336 /src/StardewModdingAPI/SemanticVersion.cs | |
parent | a0e9fa9f3e2aa47c3fa98891f757509947d871d6 (diff) | |
parent | 2d9aefebb0991b2e942241bf509eaa98f63b4963 (diff) | |
download | SMAPI-bf02c54f8bc4499052af8870e080100a4a7f05a3.tar.gz SMAPI-bf02c54f8bc4499052af8870e080100a4a7f05a3.tar.bz2 SMAPI-bf02c54f8bc4499052af8870e080100a4a7f05a3.zip |
Merge branch 'feature/285-mod-dependencies' into develop
# Conflicts:
# src/StardewModdingAPI/Framework/ModRegistry.cs
# src/StardewModdingAPI/Program.cs
Diffstat (limited to 'src/StardewModdingAPI/SemanticVersion.cs')
-rw-r--r-- | src/StardewModdingAPI/SemanticVersion.cs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/StardewModdingAPI/SemanticVersion.cs b/src/StardewModdingAPI/SemanticVersion.cs index db25dc11..a2adb657 100644 --- a/src/StardewModdingAPI/SemanticVersion.cs +++ b/src/StardewModdingAPI/SemanticVersion.cs @@ -182,6 +182,23 @@ namespace StardewModdingAPI return result; } + /// <summary>Parse a version string without throwing an exception if it fails.</summary> + /// <param name="version">The version string.</param> + /// <param name="parsed">The parsed representation.</param> + /// <returns>Returns whether parsing the version succeeded.</returns> + internal static bool TryParse(string version, out ISemanticVersion parsed) + { + try + { + parsed = new SemanticVersion(version); + return true; + } + catch + { + parsed = null; + return false; + } + } /********* ** Private methods |