From 4a7fb8bad2eabb215240e6a6d3febd1e91b3c2d5 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 16 Mar 2019 23:42:00 -0400 Subject: remove reflected access to Game1.version (which is no longer const) --- src/SMAPI/Constants.cs | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'src') diff --git a/src/SMAPI/Constants.cs b/src/SMAPI/Constants.cs index 820579b8..07557cd3 100644 --- a/src/SMAPI/Constants.cs +++ b/src/SMAPI/Constants.cs @@ -111,7 +111,7 @@ namespace StardewModdingAPI internal static string ModsPath { get; set; } /// The game's current semantic version. - internal static ISemanticVersion GameVersion { get; } = new GameVersion(Constants.GetGameVersion()); + internal static ISemanticVersion GameVersion { get; } = new GameVersion(Game1.version); /// The target game platform. internal static Platform Platform { get; } = EnvironmentUtility.DetectPlatform(); @@ -197,16 +197,6 @@ namespace StardewModdingAPI /********* ** Private methods *********/ - /// Get the game's current version string. - private static string GetGameVersion() - { - // we need reflection because it's a constant, so SMAPI's references to it are inlined at compile-time - FieldInfo field = typeof(Game1).GetField(nameof(Game1.version), BindingFlags.Public | BindingFlags.Static); - if (field == null) - throw new InvalidOperationException($"The {nameof(Game1)}.{nameof(Game1.version)} field could not be found."); - return (string)field.GetValue(null); - } - /// Get the name of the save folder, if any. internal static string GetSaveFolderName() { -- cgit