From 929dccb75a1405737975d76648e015a3e7c00177 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 7 Oct 2017 23:07:10 -0400 Subject: reorganise repo structure --- src/StardewModdingAPI/Framework/GameVersion.cs | 68 -------------------------- 1 file changed, 68 deletions(-) delete mode 100644 src/StardewModdingAPI/Framework/GameVersion.cs (limited to 'src/StardewModdingAPI/Framework/GameVersion.cs') diff --git a/src/StardewModdingAPI/Framework/GameVersion.cs b/src/StardewModdingAPI/Framework/GameVersion.cs deleted file mode 100644 index 48159f61..00000000 --- a/src/StardewModdingAPI/Framework/GameVersion.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace StardewModdingAPI.Framework -{ - /// An implementation of that correctly handles the non-semantic versions used by older Stardew Valley releases. - internal class GameVersion : SemanticVersion - { - /********* - ** Private methods - *********/ - /// A mapping of game to semantic versions. - private static readonly IDictionary VersionMap = new Dictionary(StringComparer.InvariantCultureIgnoreCase) - { - ["1.01"] = "1.0.1", - ["1.02"] = "1.0.2", - ["1.03"] = "1.0.3", - ["1.04"] = "1.0.4", - ["1.05"] = "1.0.5", - ["1.051"] = "1.0.6-prerelease1", // not a very good mapping, but good enough for SMAPI's purposes. - ["1.051b"] = "1.0.6-prelease2", - ["1.06"] = "1.0.6", - ["1.07"] = "1.0.7", - ["1.07a"] = "1.0.8-prerelease1", - ["1.11"] = "1.1.1" - }; - - - /********* - ** Public methods - *********/ - /// Construct an instance. - /// The game version string. - public GameVersion(string version) - : base(GameVersion.GetSemanticVersionString(version)) { } - - /// Get a string representation of the version. - public override string ToString() - { - return GameVersion.GetGameVersionString(base.ToString()); - } - - - /********* - ** Private methods - *********/ - /// Convert a game version string to a semantic version string. - /// The game version string. - private static string GetSemanticVersionString(string gameVersion) - { - return GameVersion.VersionMap.TryGetValue(gameVersion, out string semanticVersion) - ? semanticVersion - : gameVersion; - } - - /// Convert a game version string to a semantic version string. - /// The game version string. - private static string GetGameVersionString(string gameVersion) - { - foreach (var mapping in GameVersion.VersionMap) - { - if (mapping.Value.Equals(gameVersion, StringComparison.InvariantCultureIgnoreCase)) - return mapping.Key; - } - return gameVersion; - } - } -} -- cgit