diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-04-23 18:15:58 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-04-23 18:15:58 -0400 |
commit | 9cebd83cb968a61e809bd721056fd9fc17f3b5fe (patch) | |
tree | 89cc3b5e984b1fa187add02a23ff60861c0c3005 /src/SMAPI/Program.cs | |
parent | fd6c7c73cc4fb192df98cb21fb42f47a5c40a379 (diff) | |
download | SMAPI-9cebd83cb968a61e809bd721056fd9fc17f3b5fe.tar.gz SMAPI-9cebd83cb968a61e809bd721056fd9fc17f3b5fe.tar.bz2 SMAPI-9cebd83cb968a61e809bd721056fd9fc17f3b5fe.zip |
show update-key warnings before checking mod status, enable in non-dev mode
Diffstat (limited to 'src/SMAPI/Program.cs')
-rw-r--r-- | src/SMAPI/Program.cs | 38 |
1 files changed, 10 insertions, 28 deletions
diff --git a/src/SMAPI/Program.cs b/src/SMAPI/Program.cs index 3c6b1cf6..9789cf85 100644 --- a/src/SMAPI/Program.cs +++ b/src/SMAPI/Program.cs @@ -582,25 +582,8 @@ namespace StardewModdingAPI StringComparer.InvariantCultureIgnoreCase ); - // report update keys - { - IModMetadata[] modsWithoutKeys = ( - from mod in mods - where - mod.Manifest != null - && (mod.Manifest.UpdateKeys == null || !mod.Manifest.UpdateKeys.Any()) - && (mod.Manifest?.UniqueID != "SMAPI.ConsoleCommands" && mod.Manifest?.UniqueID != "SMAPI.TrainerMod") - orderby mod.DisplayName - select mod - ).ToArray(); - - string message = $"Checking {modsByKey.Count} mod update keys."; - if (modsWithoutKeys.Any()) - message += $" {modsWithoutKeys.Length} mods have no update keys: {string.Join(", ", modsWithoutKeys.Select(p => p.DisplayName))}."; - this.Monitor.Log($" {message}", LogLevel.Trace); - } - // fetch results + this.Monitor.Log($" Checking {modsByKey.Count} mod update keys.", LogLevel.Trace); var results = ( from entry in client.GetModInfo(modsByKey.Keys.ToArray()) @@ -714,10 +697,12 @@ namespace StardewModdingAPI // load content packs foreach (IModMetadata metadata in mods.Where(p => p.IsContentPack)) { - // get basic info - IManifest manifest = metadata.Manifest; this.Monitor.Log($" {metadata.DisplayName} (content pack, {PathUtilities.GetRelativePath(Constants.ModPath, metadata.DirectoryPath)})...", LogLevel.Trace); + // show warning for missing update key + if (metadata.HasManifest() && !metadata.HasUpdateKeys()) + this.Monitor.Log($" {metadata.DisplayName} has no {nameof(IManifest.UpdateKeys)} in its manifest. You may not see update alerts for this mod.", LogLevel.Warn); + // validate status if (metadata.Status == ModMetadataStatus.Failed) { @@ -726,11 +711,8 @@ namespace StardewModdingAPI continue; } - // show warnings - if (this.Settings.DeveloperMode && !metadata.HasUpdateKeys()) - this.Monitor.Log($" {metadata.DisplayName} has no {nameof(IManifest.UpdateKeys)} in its manifest. You may not see update alerts for this mod.", LogLevel.Warn); - // load mod as content pack + IManifest manifest = metadata.Manifest; IMonitor monitor = this.GetSecondaryMonitor(metadata.DisplayName); ContentManagerShim contentManager = this.ContentCore.CreateContentManager($"Mods.{metadata.Manifest.UniqueID}", metadata.DirectoryPath); IContentHelper contentHelper = new ContentHelper(this.ContentCore, contentManager, metadata.DirectoryPath, manifest.UniqueID, metadata.DisplayName, monitor); @@ -766,6 +748,10 @@ namespace StardewModdingAPI ? $" {metadata.DisplayName} ({PathUtilities.GetRelativePath(Constants.ModPath, metadata.DirectoryPath)}{Path.DirectorySeparatorChar}{metadata.Manifest.EntryDll})..." // don't use Path.Combine here, since EntryDLL might not be valid : $" {metadata.DisplayName}...", LogLevel.Trace); + // show warnings + if (metadata.HasManifest() && !metadata.HasUpdateKeys() && metadata.Manifest.UniqueID != "SMAPI.ConsoleCommands") + this.Monitor.Log($" {metadata.DisplayName} has no {nameof(IManifest.UpdateKeys)} in its manifest. You may not see update alerts for this mod.", LogLevel.Warn); + // validate status if (metadata.Status == ModMetadataStatus.Failed) { @@ -774,10 +760,6 @@ namespace StardewModdingAPI continue; } - // show warnings - if (this.Settings.DeveloperMode && !metadata.HasUpdateKeys() && metadata.Manifest.UniqueID != "SMAPI.ConsoleCommands") - this.Monitor.Log($" {metadata.DisplayName} has no {nameof(IManifest.UpdateKeys)} in its manifest. You may not see update alerts for this mod.", LogLevel.Warn); - // load mod string assemblyPath = metadata.Manifest?.EntryDll != null ? Path.Combine(metadata.DirectoryPath, metadata.Manifest.EntryDll) |