From 5ccd5b5df7d7fcbbf176bf2d99a274ee39681ea9 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Thu, 19 Jan 2017 11:43:32 -0500 Subject: log deprecation warnings after list of loaded mods (#220) --- src/StardewModdingAPI/Program.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/StardewModdingAPI/Program.cs') diff --git a/src/StardewModdingAPI/Program.cs b/src/StardewModdingAPI/Program.cs index bf0805be..ec3ccce7 100644 --- a/src/StardewModdingAPI/Program.cs +++ b/src/StardewModdingAPI/Program.cs @@ -337,6 +337,7 @@ namespace StardewModdingAPI } // load mod assemblies + List deprecationWarnings = new List(); // queue up deprecation warnings to show after mod list foreach (string directory in Directory.GetDirectories(Program.ModPath)) { string directoryName = new DirectoryInfo(directory).Name; @@ -391,7 +392,7 @@ namespace StardewModdingAPI // log deprecated fields if (manifest.UsedAuthourField) - Program.DeprecationManager.Warn(manifest.Name, $"{nameof(Manifest)}.{nameof(Manifest.Authour)}", "1.0", DeprecationLevel.Notice); + deprecationWarnings.Add(() => Program.DeprecationManager.Warn(manifest.Name, $"{nameof(Manifest)}.{nameof(Manifest.Authour)}", "1.0", DeprecationLevel.Notice)); } catch (Exception ex) { @@ -439,7 +440,7 @@ namespace StardewModdingAPI // create per-save directory if (manifest.PerSaveConfigs) { - Program.DeprecationManager.Warn(manifest.Name, $"{nameof(Manifest)}.{nameof(Manifest.PerSaveConfigs)}", "1.0", DeprecationLevel.Info); + deprecationWarnings.Add(() => Program.DeprecationManager.Warn(manifest.Name, $"{nameof(Manifest)}.{nameof(Manifest.PerSaveConfigs)}", "1.0", DeprecationLevel.Info)); try { string psDir = Path.Combine(directory, "psconfigs"); @@ -541,6 +542,11 @@ namespace StardewModdingAPI } } + // log deprecation warnings + foreach (Action warning in deprecationWarnings) + warning(); + deprecationWarnings = null; + // initialise mods foreach (Mod mod in Program.ModRegistry.GetMods()) { -- cgit