Skip to content

Commit

Permalink
[F] Fix windows bell sounds
Browse files Browse the repository at this point in the history
  • Loading branch information
hykilpikonna committed Jan 17, 2025
1 parent fecb440 commit 5b47098
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions AquaMai.Mods/WorldsLink/FutariTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,19 +127,24 @@ public static class Log
// Reset
public const string RESET = "\u001b[0m";

// Remove all non-printable characters
private static string Norm(this string msg) =>
string.IsNullOrEmpty(msg) ? msg :
new string(msg.Where(ch => !char.IsControl(ch)).ToArray());

public static void Error(string msg)
{
lock (_lock)
{
MelonLogger.Error($"[FUTARI] {RED}ERROR {RESET}{msg}{RESET}");
MelonLogger.Error($"[FUTARI] {RED}ERROR {RESET}{msg.Norm()}{RESET}");
}
}

public static void Warn(string msg)
{
lock (_lock)
{
MelonLogger.Warning($"[FUTARI] {YELLOW}WARN {RESET}{msg}{RESET}");
MelonLogger.Warning($"[FUTARI] {YELLOW}WARN {RESET}{msg.Norm()}{RESET}");
}
}

Expand All @@ -148,7 +153,7 @@ public static void Debug(string msg)
if (!Futari.Debug) return;
lock (_lock)
{
MelonLogger.Msg($"[FUTARI] {CYAN}DEBUG {RESET}{msg}{RESET}");
MelonLogger.Msg($"[FUTARI] {CYAN}DEBUG {RESET}{msg.Norm()}{RESET}");
}
}

Expand All @@ -158,7 +163,7 @@ public static void Info(string msg)
{
if (msg.StartsWith("A001")) msg = MAGENTA + msg;
if (msg.StartsWith("A002")) msg = CYAN + msg;
MelonLogger.Msg($"[FUTARI] {GREEN}INFO {RESET}{msg}{RESET}");
MelonLogger.Msg($"[FUTARI] {GREEN}INFO {RESET}{msg.Norm()}{RESET}");
}
}
}

0 comments on commit 5b47098

Please sign in to comment.