Refactored the stupid thing to be a little less stupid, I hope you're happy tobey

This commit is contained in:
pan.codes 2024-04-03 22:08:14 +02:00
parent 28b044d2d7
commit 2b1b787c7f

View file

@ -66,7 +66,7 @@ namespace SMSModLogOutputAnalyzer
embedBuilder.WithAuthor(Context.User);
embedBuilder.WithFooter(Program.Footer);
Dictionary<string, List<Tuple<bool?, string, string>>> values = new();
Dictionary<string, List<string>> 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<Tuple<bool?, string, string>> { new(null, "", lines["[Message:MelonLoader] Game Version: "][0].Item1) };
values[":diamond_shape_with_a_dot_inside: Unity Version"] = new List<Tuple<bool?, string, string>> { new(null, "", lines["[Message:MelonLoader] Unity Version: "][0].Item1) };
values[":tools: BepInEx Version"] = new List<Tuple<bool?, string, string>> { new(null, "", lines["[Message: BepInEx] BepInEx "][0].Item1.Split(" - ")[0]) };
values[":page_facing_up: Game Version"] = new List<string> { lines["[Message:MelonLoader] Game Version: "][0].Item1 };
values[":diamond_shape_with_a_dot_inside: Unity Version"] = new List<string> { lines["[Message:MelonLoader] Unity Version: "][0].Item1 };
values[":tools: BepInEx Version"] = new List<string> { lines["[Message: BepInEx] BepInEx "][0].Item1.Split(" - ")[0] };
List<Tuple<bool?, string, string>> part = new();
List<string> 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<string> filetree = new();
Dictionary<int, string> depths = new();
values[":file_folder: Install Directory"] = new List<Tuple<bool?, string, string>> { new(null, "", lines["[Message: File Tree] "][0].Item1) };
values[":file_folder: Install Directory"] = new List<string> { 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);