From 0ba4fd1785fc6a6aa931f18552261f33c2a2c0ef Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Tue, 5 Jul 2022 22:09:46 -0400 Subject: detect missing/outdated Error Handler for 'suggested fixes' section --- src/SMAPI.Web/Views/LogParser/Index.cshtml | 120 ++++++++++++++++------------- 1 file changed, 68 insertions(+), 52 deletions(-) (limited to 'src/SMAPI.Web/Views') diff --git a/src/SMAPI.Web/Views/LogParser/Index.cshtml b/src/SMAPI.Web/Views/LogParser/Index.cshtml index 33239a2b..8bf5d86d 100644 --- a/src/SMAPI.Web/Views/LogParser/Index.cshtml +++ b/src/SMAPI.Web/Views/LogParser/Index.cshtml @@ -8,24 +8,29 @@ @{ ViewData["Title"] = "SMAPI log parser"; + // get log info ParsedLog? log = Model!.ParsedLog; - IDictionary contentPacks = Model.GetContentPacksByMod(); + ISet screenIds = new HashSet(log?.Messages.Select(p => p.ScreenId) ?? Array.Empty()); + + // detect suggested fixes + LogModInfo[] outdatedMods = log?.Mods.Where(mod => mod.HasUpdate).ToArray() ?? Array.Empty(); + LogModInfo? errorHandler = log?.Mods.FirstOrDefault(p => p.IsCodeMod && p.Name == "Error Handler"); + bool hasOlderErrorHandler = errorHandler?.GetParsedVersion() is not null && log?.ApiVersionParsed is not null && log.ApiVersionParsed.IsNewerThan(errorHandler.GetParsedVersion()); + + // get filters IDictionary defaultFilters = Enum .GetValues() .ToDictionary(level => level.ToString().ToLower(), level => level != LogLevel.Trace); - IDictionary logLevels = Enum .GetValues() .ToDictionary(level => (int)level, level => level.ToString().ToLower()); - IDictionary logSections = Enum .GetValues() .ToDictionary(section => (int)section, section => section.ToString()); + // get form string curPageUrl = this.Url.PlainAction("Index", "LogParser", new { id = Model.PasteID }, absoluteUrl: true)!; - - ISet screenIds = new HashSet(log?.Messages.Select(p => p.ScreenId) ?? Array.Empty()); } @section Head { @@ -69,7 +74,7 @@ } - +