Skip to content

Commit

Permalink
Fixed Issue with Console not properly Coloring Melon Names. (Credits …
Browse files Browse the repository at this point in the history
…to [benaclejames](https://github.com/benaclejames) :D)
  • Loading branch information
HerpDerpinstine committed Dec 9, 2021
1 parent f7f38d6 commit fa321f6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
### v0.5.2 Open-Beta:

1. Fixed Issue with --melonloader.basedir Launch Option not finding Bootstrap.dll.
2. Fixed Issue with Console not properly Coloring Melon Names. (Credits to [benaclejames](https://github.com/benaclejames) :D)

---

Expand Down
10 changes: 9 additions & 1 deletion MelonLoader/Utils/MelonLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,15 @@ public class MelonLogger

private static void NativeMsg(ConsoleColor namesection_color, ConsoleColor txt_color, string namesection, string txt)
{
namesection ??= MelonUtils.GetMelonFromStackTrace()?.Info?.Name?.Replace(" ", "_");
if (string.IsNullOrEmpty(namesection))
{
MelonBase melon = MelonUtils.GetMelonFromStackTrace();
if (melon != null)
{
namesection = melon.Info?.Name?.Replace(" ", "_");
namesection_color = melon.ConsoleColor;
}
}

Internal_Msg(namesection_color, txt_color, namesection, txt ?? "null");
RunMsgCallbacks(namesection_color, txt_color, namesection, txt ?? "null");
Expand Down

0 comments on commit fa321f6

Please sign in to comment.