further group deprecation warnings during mod loading

This commit is contained in:
Jesse Plamondon-Willard 2017-02-23 23:54:50 -05:00
parent 12cb2d272d
commit 2ed3b25b6b
1 changed files with 3 additions and 6 deletions

View File

@ -515,11 +515,6 @@ namespace StardewModdingAPI
} }
} }
// log deprecation warnings
foreach (Action warning in deprecationWarnings)
warning();
deprecationWarnings = null;
// initialise mods // initialise mods
foreach (Mod mod in this.ModRegistry.GetMods()) foreach (Mod mod in this.ModRegistry.GetMods())
{ {
@ -531,7 +526,7 @@ namespace StardewModdingAPI
// raise deprecation warning for old Entry() methods // raise deprecation warning for old Entry() methods
if (this.DeprecationManager.IsVirtualMethodImplemented(mod.GetType(), typeof(Mod), nameof(Mod.Entry), new[] { typeof(object[]) })) if (this.DeprecationManager.IsVirtualMethodImplemented(mod.GetType(), typeof(Mod), nameof(Mod.Entry), new[] { typeof(object[]) }))
this.DeprecationManager.Warn(mod.ModManifest.Name, $"{nameof(Mod)}.{nameof(Mod.Entry)}(object[]) instead of {nameof(Mod)}.{nameof(Mod.Entry)}({nameof(IModHelper)})", "1.0", DeprecationLevel.Info); deprecationWarnings.Add(() => this.DeprecationManager.Warn(mod.ModManifest.Name, $"{nameof(Mod)}.{nameof(Mod.Entry)}(object[]) instead of {nameof(Mod)}.{nameof(Mod.Entry)}({nameof(IModHelper)})", "1.0", DeprecationLevel.Info));
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -541,6 +536,8 @@ namespace StardewModdingAPI
// print result // print result
this.Monitor.Log($"Loaded {modsLoaded} mods."); this.Monitor.Log($"Loaded {modsLoaded} mods.");
foreach (Action warning in deprecationWarnings)
warning();
Console.Title = $"SMAPI {Constants.ApiVersion} - running Stardew Valley {Game1.version} with {modsLoaded} mods"; Console.Title = $"SMAPI {Constants.ApiVersion} - running Stardew Valley {Game1.version} with {modsLoaded} mods";
} }