summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-12-09 19:56:46 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2021-12-09 19:56:46 -0500
commit4e17716fa26161016e5e59f12b52feef3fd0f8f9 (patch)
treed6fe68bfee1dbd0184d66d5cb6b400fb7bef7730 /src
parent8a2618d812e4e2f36161907af5af5c484eb37abf (diff)
downloadSMAPI-4e17716fa26161016e5e59f12b52feef3fd0f8f9.tar.gz
SMAPI-4e17716fa26161016e5e59f12b52feef3fd0f8f9.tar.bz2
SMAPI-4e17716fa26161016e5e59f12b52feef3fd0f8f9.zip
fix log parser handling when multiple mods have the exact same name
Diffstat (limited to 'src')
-rw-r--r--src/SMAPI.Web/Framework/LogParsing/LogParser.cs35
1 files changed, 22 insertions, 13 deletions
diff --git a/src/SMAPI.Web/Framework/LogParsing/LogParser.cs b/src/SMAPI.Web/Framework/LogParsing/LogParser.cs
index 84013ccc..887d0105 100644
--- a/src/SMAPI.Web/Framework/LogParsing/LogParser.cs
+++ b/src/SMAPI.Web/Framework/LogParsing/LogParser.cs
@@ -79,7 +79,7 @@ namespace StardewModdingAPI.Web.Framework.LogParsing
// parse log messages
LogModInfo smapiMod = new LogModInfo { Name = "SMAPI", Author = "Pathoschild", Description = "", Loaded = true };
LogModInfo gameMod = new LogModInfo { Name = "game", Author = "", Description = "", Loaded = true };
- IDictionary<string, LogModInfo> mods = new Dictionary<string, LogModInfo>();
+ IDictionary<string, List<LogModInfo>> mods = new Dictionary<string, List<LogModInfo>>();
bool inModList = false;
bool inContentPackList = false;
bool inModUpdateList = false;
@@ -99,8 +99,11 @@ namespace StardewModdingAPI.Web.Framework.LogParsing
break;
default:
- if (mods.ContainsKey(message.Mod))
- mods[message.Mod].Errors++;
+ if (mods.TryGetValue(message.Mod, out var entries))
+ {
+ foreach (var entry in entries)
+ entry.Errors++;
+ }
break;
}
}
@@ -127,7 +130,10 @@ namespace StardewModdingAPI.Web.Framework.LogParsing
string version = match.Groups["version"].Value;
string author = match.Groups["author"].Value;
string description = match.Groups["description"].Value;
- mods[name] = new LogModInfo { Name = name, Author = author, Version = version, Description = description, Loaded = true };
+
+ if (!mods.TryGetValue(name, out List<LogModInfo> entries))
+ mods[name] = entries = new List<LogModInfo>();
+ entries.Add(new LogModInfo { Name = name, Author = author, Version = version, Description = description, Loaded = true });
message.Section = LogSection.ModsList;
}
@@ -147,7 +153,10 @@ namespace StardewModdingAPI.Web.Framework.LogParsing
string author = match.Groups["author"].Value;
string description = match.Groups["description"].Value;
string forMod = match.Groups["for"].Value;
- mods[name] = new LogModInfo { Name = name, Author = author, Version = version, Description = description, ContentPackFor = forMod, Loaded = true };
+
+ if (!mods.TryGetValue(name, out List<LogModInfo> entries))
+ mods[name] = entries = new List<LogModInfo>();
+ entries.Add(new LogModInfo { Name = name, Author = author, Version = version, Description = description, ContentPackFor = forMod, Loaded = true });
message.Section = LogSection.ContentPackList;
}
@@ -165,14 +174,14 @@ namespace StardewModdingAPI.Web.Framework.LogParsing
string name = match.Groups["name"].Value;
string version = match.Groups["version"].Value;
string link = match.Groups["link"].Value;
- if (mods.ContainsKey(name))
- {
- mods[name].UpdateLink = link;
- mods[name].UpdateVersion = version;
- }
- else
+
+ if (mods.TryGetValue(name, out var entries))
{
- mods[name] = new LogModInfo { Name = name, UpdateVersion = version, UpdateLink = link, Loaded = false };
+ foreach (var entry in entries)
+ {
+ entry.UpdateLink = link;
+ entry.UpdateVersion = version;
+ }
}
message.Section = LogSection.ModUpdateList;
@@ -219,7 +228,7 @@ namespace StardewModdingAPI.Web.Framework.LogParsing
// finalize log
gameMod.Version = log.GameVersion;
- log.Mods = new[] { gameMod, smapiMod }.Concat(mods.Values.OrderBy(p => p.Name)).ToArray();
+ log.Mods = new[] { gameMod, smapiMod }.Concat(mods.Values.SelectMany(p => p).OrderBy(p => p.Name)).ToArray();
return log;
}
catch (LogParseException ex)