From 2b1b787c7f5c2ea3fc797d3a9664af14a5e1c5e4 Mon Sep 17 00:00:00 2001 From: Jonathan Riedel Date: Wed, 3 Apr 2024 22:08:14 +0200 Subject: [PATCH] Refactored the stupid thing to be a little less stupid, I hope you're happy tobey --- SMSModLogOutputAnalyzer/CommandModule.cs | 36 +++++++++--------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/SMSModLogOutputAnalyzer/CommandModule.cs b/SMSModLogOutputAnalyzer/CommandModule.cs index 3a88176..9629cde 100644 --- a/SMSModLogOutputAnalyzer/CommandModule.cs +++ b/SMSModLogOutputAnalyzer/CommandModule.cs @@ -66,7 +66,7 @@ namespace SMSModLogOutputAnalyzer embedBuilder.WithAuthor(Context.User); embedBuilder.WithFooter(Program.Footer); - Dictionary>> values = new(); + Dictionary> values = new(); var lines = FindLines(textLines, "[Message:MelonLoader] Game Version: ", "[Message:MelonLoader] Unity Version: ", @@ -78,15 +78,15 @@ namespace SMSModLogOutputAnalyzer Log("Initial analysis complete."); - values[":page_facing_up: Game Version"] = new List> { new(null, "", lines["[Message:MelonLoader] Game Version: "][0].Item1) }; - values[":diamond_shape_with_a_dot_inside: Unity Version"] = new List> { new(null, "", lines["[Message:MelonLoader] Unity Version: "][0].Item1) }; - values[":tools: BepInEx Version"] = new List> { new(null, "", lines["[Message: BepInEx] BepInEx "][0].Item1.Split(" - ")[0]) }; + values[":page_facing_up: Game Version"] = new List { lines["[Message:MelonLoader] Game Version: "][0].Item1 }; + values[":diamond_shape_with_a_dot_inside: Unity Version"] = new List { lines["[Message:MelonLoader] Unity Version: "][0].Item1 }; + values[":tools: BepInEx Version"] = new List { lines["[Message: BepInEx] BepInEx "][0].Item1.Split(" - ")[0] }; - List> part = new(); + List part = new(); foreach (var mod in lines["[Info : BepInEx] Loading ["]) { var match = Regex.Match(mod.Item1, "(.+) ((\\d+\\.)+\\d+)\\]"); - part.Add(new(null, "", "**" + match.Groups[1] + "** " + match.Groups[2])); + part.Add("**" + match.Groups[1] + "** " + match.Groups[2]); } values[":tools: Loaded BepInEx Mods"] = part; part = new(); @@ -95,12 +95,12 @@ namespace SMSModLogOutputAnalyzer { string line = textLines[mod.Item2 - 1]; var match = Regex.Match(line, "\\[.+\\] (.+) v((\\d+\\.)+\\d+).+"); - part.Add(new(null, "", "**" + match.Groups[1] + "** " + match.Groups[2])); + part.Add("**" + match.Groups[1] + "** " + match.Groups[2]); } values[":melon: Loaded MelonLoader Mods"] = part; part = new(); - if (lines["[Info : Unity Log] System.EntryPointNotFoundException: SteamAPI_SteamInput_v001"].Count > 0) part.Add(new(false, "", "Steam Entry Point not found")); + if (lines["[Info : Unity Log] System.EntryPointNotFoundException: SteamAPI_SteamInput_v001"].Count > 0) part.Add(":x: Steam Entry Point not found"); values[":loudspeaker: Common Errors"] = part; part = new(); @@ -108,7 +108,7 @@ namespace SMSModLogOutputAnalyzer List filetree = new(); Dictionary depths = new(); - values[":file_folder: Install Directory"] = new List> { new(null, "", lines["[Message: File Tree] "][0].Item1) }; + values[":file_folder: Install Directory"] = new List { lines["[Message: File Tree] "][0].Item1 }; foreach (var lineTuple in lines["[Message: File Tree] "]) { @@ -137,11 +137,11 @@ namespace SMSModLogOutputAnalyzer var mod = bepinexmod.Substring(16); if (KnownMelonLoaderMods.Contains(mod.Split('\\').Last().Trim())) { - part.Add(new(false, "Known MelonLoader Mod", mod)); + part.Add(":x: " + mod + " (Known MelonLoader Mod)"); } else { - part.Add(new(null, "", mod)); + part.Add(mod); } } values[":file_folder: DLL Files in BepInEx/plugins"] = part; @@ -152,11 +152,11 @@ namespace SMSModLogOutputAnalyzer var mod = melonmod.Substring(14); if (KnownBepInExMods.Contains(mod.Split('\\').Last().Trim())) { - part.Add(new(false, "Known BepInEx Mod", mod)); + part.Add(":x: " + mod + " (Known BepInEx Mod)"); } else { - part.Add(new(null, "", mod)); + part.Add(mod); } } values[":file_folder: DLL Files in MLLoader\\Mods"] = part; @@ -170,15 +170,7 @@ namespace SMSModLogOutputAnalyzer { IsInline = false, Name = x.Key, - Value = string.Join("\n", x.Value.Select(y => - { - string value = ""; - if (y.Item1.HasValue) value = "❌"; - if (y.Item1.HasValue && y.Item1.Value) value = "✅"; - value += " " + y.Item3; - if (!string.IsNullOrEmpty(y.Item2)) value += " (" + y.Item2 + ")"; - return value; - })) + Value = string.Join("\n", x.Value) }); foreach (var field in fields) Log(field.Name + ", " + field.Value);