From 960507879eacc0a760862c269b39f9d7448a7bd5 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Thu, 16 Feb 2017 01:03:50 -0500 Subject: remove unneeded property for game exe path --- src/StardewModdingAPI/Log.cs | 14 +++++++------- src/StardewModdingAPI/Program.cs | 28 ++++++++++++---------------- 2 files changed, 19 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/StardewModdingAPI/Log.cs b/src/StardewModdingAPI/Log.cs index da98baba..a8d78e55 100644 --- a/src/StardewModdingAPI/Log.cs +++ b/src/StardewModdingAPI/Log.cs @@ -15,15 +15,11 @@ namespace StardewModdingAPI /// Manages deprecation warnings. private static DeprecationManager DeprecationManager; - - /********* - ** Accessors - *********/ /// The underlying logger. - internal static Monitor Monitor; + private static Monitor Monitor; /// Tracks the installed mods. - internal static ModRegistry ModRegistry; + private static ModRegistry ModRegistry; /********* @@ -31,9 +27,13 @@ namespace StardewModdingAPI *********/ /// Injects types required for backwards compatibility. /// Manages deprecation warnings. - internal static void Shim(DeprecationManager deprecationManager) + /// The underlying logger. + /// Tracks the installed mods. + internal static void Shim(DeprecationManager deprecationManager, Monitor monitor, ModRegistry modRegistry) { Log.DeprecationManager = deprecationManager; + Log.Monitor = monitor; + Log.ModRegistry = modRegistry; } /**** diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs index 0857d41b..41e12394 100644 --- a/src/StardewModdingAPI/Program.cs +++ b/src/StardewModdingAPI/Program.cs @@ -105,18 +105,7 @@ namespace StardewModdingAPI Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-GB"); // for consistent log formatting this.Monitor.Log($"SMAPI {Constants.ApiVersion} with Stardew Valley {Game1.version} on {Environment.OSVersion}", LogLevel.Info); - // inject compatibility shims -#pragma warning disable 618 - Command.Shim(this.CommandManager, this.DeprecationManager, this.ModRegistry); - Config.Shim(this.DeprecationManager); - InternalExtensions.Shim(this.ModRegistry); - Log.Shim(this.DeprecationManager); - Mod.Shim(this.DeprecationManager); - PlayerEvents.Shim(this.DeprecationManager); - TimeEvents.Shim(this.DeprecationManager); -#pragma warning restore 618 - - // read config + // read settings { string settingsPath = Constants.ApiConfigPath; if (File.Exists(settingsPath)) @@ -130,6 +119,17 @@ namespace StardewModdingAPI File.WriteAllText(settingsPath, JsonConvert.SerializeObject(this.Settings, Formatting.Indented)); } + // inject compatibility shims +#pragma warning disable 618 + Command.Shim(this.CommandManager, this.DeprecationManager, this.ModRegistry); + Config.Shim(this.DeprecationManager); + InternalExtensions.Shim(this.ModRegistry); + Log.Shim(this.DeprecationManager, this.GetSecondaryMonitor("legacy mod"), this.ModRegistry); + Mod.Shim(this.DeprecationManager); + PlayerEvents.Shim(this.DeprecationManager); + TimeEvents.Shim(this.DeprecationManager); +#pragma warning restore 618 + // redirect direct console output { Monitor monitor = this.GetSecondaryMonitor("Console.Out"); @@ -152,10 +152,6 @@ namespace StardewModdingAPI // print file paths this.Monitor.Log($"Mods go here: {this.ModPath}"); - // initialise legacy log - Log.Monitor = this.GetSecondaryMonitor("legacy mod"); - Log.ModRegistry = this.ModRegistry; - // hook into & launch the game try { -- cgit