From f95292953f95ec71071fce7a6438a5403dc85816 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 30 Dec 2020 19:38:48 -0500 Subject: fix repeated mods in 'skipped mods' section of console --- src/SMAPI/Framework/Logging/LogManager.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/SMAPI/Framework') diff --git a/src/SMAPI/Framework/Logging/LogManager.cs b/src/SMAPI/Framework/Logging/LogManager.cs index ee013a85..4a8019af 100644 --- a/src/SMAPI/Framework/Logging/LogManager.cs +++ b/src/SMAPI/Framework/Logging/LogManager.cs @@ -425,9 +425,11 @@ namespace StardewModdingAPI.Framework.Logging this.Monitor.Log($" ({mod.ErrorDetails})"); } - // find skipped dependencies - IModMetadata[] skippedDependencies; + // group mods + List skippedDependencies = new List(); + List otherSkippedMods = new List(); { + // track broken dependencies HashSet skippedDependencyIds = new HashSet(StringComparer.OrdinalIgnoreCase); HashSet skippedModIds = new HashSet(from mod in skippedMods where mod.HasID() select mod.Manifest.UniqueID, StringComparer.OrdinalIgnoreCase); foreach (IModMetadata mod in skippedMods) @@ -435,7 +437,15 @@ namespace StardewModdingAPI.Framework.Logging foreach (string requiredId in skippedModIds.Intersect(mod.GetRequiredModIds())) skippedDependencyIds.Add(requiredId); } - skippedDependencies = skippedMods.Where(p => p.HasID() && skippedDependencyIds.Contains(p.Manifest.UniqueID)).ToArray(); + + // collect mod groups + foreach (IModMetadata mod in skippedMods) + { + if (mod.HasID() && skippedDependencyIds.Contains(mod.Manifest.UniqueID)) + skippedDependencies.Add(mod); + else + otherSkippedMods.Add(mod); + } } // log skipped mods @@ -451,7 +461,7 @@ namespace StardewModdingAPI.Framework.Logging this.Monitor.Newline(); } - foreach (IModMetadata mod in skippedMods.OrderBy(p => p.DisplayName)) + foreach (IModMetadata mod in otherSkippedMods.OrderBy(p => p.DisplayName)) LogSkippedMod(mod); this.Monitor.Newline(); } -- cgit