From 6cd7e11c1020c40f223dee70a7dd7b2c66296918 Mon Sep 17 00:00:00 2001 From: danvolchek Date: Sat, 9 Mar 2019 18:20:02 -0600 Subject: add log sections implementation --- src/SMAPI.Web/Framework/LogParsing/LogParser.cs | 18 ++++++++++++++++++ .../Framework/LogParsing/Models/LogMessage.cs | 6 ++++++ .../Framework/LogParsing/Models/LogSection.cs | 15 +++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 src/SMAPI.Web/Framework/LogParsing/Models/LogSection.cs (limited to 'src/SMAPI.Web/Framework') diff --git a/src/SMAPI.Web/Framework/LogParsing/LogParser.cs b/src/SMAPI.Web/Framework/LogParsing/LogParser.cs index fdc19404..3f33c0c1 100644 --- a/src/SMAPI.Web/Framework/LogParsing/LogParser.cs +++ b/src/SMAPI.Web/Framework/LogParsing/LogParser.cs @@ -119,7 +119,11 @@ namespace StardewModdingAPI.Web.Framework.LogParsing // mod list if (!inModList && message.Level == LogLevel.Info && this.ModListStartPattern.IsMatch(message.Text)) + { inModList = true; + message.IsStartOfSection = true; + message.Section = LogSection.ModsList; + } else if (inModList) { Match match = this.ModListEntryPattern.Match(message.Text); @@ -128,11 +132,17 @@ namespace StardewModdingAPI.Web.Framework.LogParsing 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 }; + + message.Section = LogSection.ModsList; } // content pack list else if (!inContentPackList && message.Level == LogLevel.Info && this.ContentPackListStartPattern.IsMatch(message.Text)) + { inContentPackList = true; + message.IsStartOfSection = true; + message.Section = LogSection.ContentPackList; + } else if (inContentPackList) { Match match = this.ContentPackListEntryPattern.Match(message.Text); @@ -142,11 +152,17 @@ namespace StardewModdingAPI.Web.Framework.LogParsing 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 }; + + message.Section = LogSection.ContentPackList; } // mod update list else if (!inModUpdateList && message.Level == LogLevel.Alert && this.ModUpdateListStartPattern.IsMatch(message.Text)) + { inModUpdateList = true; + message.IsStartOfSection = true; + message.Section = LogSection.ModUpdateList; + } else if (inModUpdateList) { Match match = this.ModUpdateListEntryPattern.Match(message.Text); @@ -162,6 +178,8 @@ namespace StardewModdingAPI.Web.Framework.LogParsing { mods[name] = new LogModInfo { Name = name, UpdateVersion = version, UpdateLink = link, Loaded = false }; } + + message.Section = LogSection.ModUpdateList; } else if (message.Level == LogLevel.Alert && this.SMAPIUpdatePattern.IsMatch(message.Text)) diff --git a/src/SMAPI.Web/Framework/LogParsing/Models/LogMessage.cs b/src/SMAPI.Web/Framework/LogParsing/Models/LogMessage.cs index baeac83c..ecca0b5b 100644 --- a/src/SMAPI.Web/Framework/LogParsing/Models/LogMessage.cs +++ b/src/SMAPI.Web/Framework/LogParsing/Models/LogMessage.cs @@ -20,5 +20,11 @@ namespace StardewModdingAPI.Web.Framework.LogParsing.Models /// The number of times this message was repeated consecutively. public int Repeated { get; set; } + + /// The section that this log message belongs too. + public LogSection? Section { get; set; } + + /// Whether this message is the first one of it's section. + public bool IsStartOfSection { get; set; } } } diff --git a/src/SMAPI.Web/Framework/LogParsing/Models/LogSection.cs b/src/SMAPI.Web/Framework/LogParsing/Models/LogSection.cs new file mode 100644 index 00000000..218d546c --- /dev/null +++ b/src/SMAPI.Web/Framework/LogParsing/Models/LogSection.cs @@ -0,0 +1,15 @@ +namespace StardewModdingAPI.Web.Framework.LogParsing.Models +{ + /// The different sections of a log. + public enum LogSection + { + /// The list of mods the user has. + ModsList, + + /// The list of content packs the user has. + ContentPackList, + + /// The list of mod updates SMAPI has found. + ModUpdateList + } +} -- cgit From f836caec3391d1f2e583ee1df6fcaafd284c796d Mon Sep 17 00:00:00 2001 From: danvolchek Date: Sat, 9 Mar 2019 18:38:06 -0600 Subject: fix typos and update release notes --- docs/release-notes.md | 6 ++++++ src/SMAPI.Web/Framework/LogParsing/Models/LogMessage.cs | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'src/SMAPI.Web/Framework') diff --git a/docs/release-notes.md b/docs/release-notes.md index fec8f9ac..b0081806 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -1,4 +1,10 @@ # Release notes +## Upcoming release +These changes have not been released yet. + +* For the web UI: + * The log parser now hides some messages by default, like the mod list. + ## 2.11 Released 01 March 2019 for Stardew Valley 1.3.36. diff --git a/src/SMAPI.Web/Framework/LogParsing/Models/LogMessage.cs b/src/SMAPI.Web/Framework/LogParsing/Models/LogMessage.cs index ecca0b5b..f7c99d02 100644 --- a/src/SMAPI.Web/Framework/LogParsing/Models/LogMessage.cs +++ b/src/SMAPI.Web/Framework/LogParsing/Models/LogMessage.cs @@ -21,10 +21,10 @@ namespace StardewModdingAPI.Web.Framework.LogParsing.Models /// The number of times this message was repeated consecutively. public int Repeated { get; set; } - /// The section that this log message belongs too. + /// The section that this log message belongs to. public LogSection? Section { get; set; } - /// Whether this message is the first one of it's section. + /// Whether this message is the first one of its section. public bool IsStartOfSection { get; set; } } } -- cgit