diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2020-12-23 21:38:19 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2020-12-23 21:38:19 -0500 |
commit | 9215f89825734f447b8637851569de9ffa08b661 (patch) | |
tree | 8c7447d5180904c6a4156a0bc430021288c17788 /src/SMAPI.Web/Framework/LogParsing | |
parent | 63111621c9375ac2e9a68eefa73ffe1d817000dd (diff) | |
download | SMAPI-9215f89825734f447b8637851569de9ffa08b661.tar.gz SMAPI-9215f89825734f447b8637851569de9ffa08b661.tar.bz2 SMAPI-9215f89825734f447b8637851569de9ffa08b661.zip |
fix edge cases in SMAPI log parsing (#743)
Diffstat (limited to 'src/SMAPI.Web/Framework/LogParsing')
-rw-r--r-- | src/SMAPI.Web/Framework/LogParsing/LogParser.cs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/SMAPI.Web/Framework/LogParsing/LogParser.cs b/src/SMAPI.Web/Framework/LogParsing/LogParser.cs index f69d4b6f..84013ccc 100644 --- a/src/SMAPI.Web/Framework/LogParsing/LogParser.cs +++ b/src/SMAPI.Web/Framework/LogParsing/LogParser.cs @@ -42,7 +42,7 @@ namespace StardewModdingAPI.Web.Framework.LogParsing private readonly Regex ModUpdateListStartPattern = new Regex(@"^You can update \d+ mods?:$", RegexOptions.Compiled | RegexOptions.IgnoreCase); /// <summary>A regex pattern matching an entry in SMAPI's mod update list.</summary> - private readonly Regex ModUpdateListEntryPattern = new Regex(@"^ (?<name>.+?) (?<version>[^\s]+): (?<link>.+)$", RegexOptions.Compiled | RegexOptions.IgnoreCase); + private readonly Regex ModUpdateListEntryPattern = new Regex(@"^ (?<name>.+) (?<version>[^\s]+): (?<link>.+)$", RegexOptions.Compiled | RegexOptions.IgnoreCase); /// <summary>A regex pattern matching SMAPI's update line.</summary> private readonly Regex SmapiUpdatePattern = new Regex(@"^You can update SMAPI to (?<version>[^\s]+): (?<link>.+)$", RegexOptions.Compiled | RegexOptions.IgnoreCase); @@ -109,12 +109,9 @@ namespace StardewModdingAPI.Web.Framework.LogParsing if (message.Mod == "SMAPI") { // update flags - if (inModList && !this.ModListEntryPattern.IsMatch(message.Text)) - inModList = false; - if (inContentPackList && !this.ContentPackListEntryPattern.IsMatch(message.Text)) - inContentPackList = false; - if (inModUpdateList && !this.ModUpdateListEntryPattern.IsMatch(message.Text)) - inModUpdateList = false; + inModList = inModList && message.Level == LogLevel.Info && this.ModListEntryPattern.IsMatch(message.Text); + inContentPackList = inContentPackList && message.Level == LogLevel.Info && this.ContentPackListEntryPattern.IsMatch(message.Text); + inModUpdateList = inModUpdateList && message.Level == LogLevel.Alert && this.ModUpdateListEntryPattern.IsMatch(message.Text); // mod list if (!inModList && message.Level == LogLevel.Info && this.ModListStartPattern.IsMatch(message.Text)) |