summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/Logging
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-12-30 19:38:48 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-12-30 19:38:48 -0500
commitf95292953f95ec71071fce7a6438a5403dc85816 (patch)
treef0f1924cea947761e84a6265619e7e6b4374df3a /src/SMAPI/Framework/Logging
parentfd37253dc3aa12be5b11b8d377eae3ced88bc30c (diff)
downloadSMAPI-f95292953f95ec71071fce7a6438a5403dc85816.tar.gz
SMAPI-f95292953f95ec71071fce7a6438a5403dc85816.tar.bz2
SMAPI-f95292953f95ec71071fce7a6438a5403dc85816.zip
fix repeated mods in 'skipped mods' section of console
Diffstat (limited to 'src/SMAPI/Framework/Logging')
-rw-r--r--src/SMAPI/Framework/Logging/LogManager.cs18
1 files changed, 14 insertions, 4 deletions
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<IModMetadata> skippedDependencies = new List<IModMetadata>();
+ List<IModMetadata> otherSkippedMods = new List<IModMetadata>();
{
+ // track broken dependencies
HashSet<string> skippedDependencyIds = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
HashSet<string> skippedModIds = new HashSet<string>(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();
}