Fix console coloring

This commit is contained in:
Matt Nadareski
2020-12-14 16:24:04 -08:00
parent 97cada0206
commit e01bacc89f

View File

@@ -31,16 +31,13 @@ namespace SabreTools.Core
if (!Console.IsOutputRedirected) if (!Console.IsOutputRedirected)
{ {
// Set the console to ready state // Set the console to ready state
ConsoleColor formertext = ConsoleColor.White; if (Environment.OSVersion.Platform == PlatformID.Win32NT)
ConsoleColor formerback = ConsoleColor.Black;
if (!CoreEnvironment)
{
Console.SetBufferSize(Console.BufferWidth, 999); Console.SetBufferSize(Console.BufferWidth, 999);
formertext = Console.ForegroundColor;
formerback = Console.BackgroundColor; ConsoleColor formertext = Console.ForegroundColor;
Console.ForegroundColor = ConsoleColor.Yellow; ConsoleColor formerback = Console.BackgroundColor;
Console.BackgroundColor = ConsoleColor.Blue; Console.ForegroundColor = ConsoleColor.Yellow;
} Console.BackgroundColor = ConsoleColor.Blue;
Console.Title = $"{program} {Version}"; Console.Title = $"{program} {Version}";
@@ -51,23 +48,8 @@ namespace SabreTools.Core
Console.WriteLine(); Console.WriteLine();
// Return the console to the original text and background colors // Return the console to the original text and background colors
if (!CoreEnvironment) Console.ForegroundColor = formertext;
{
Console.ForegroundColor = formertext;
Console.BackgroundColor = formerback; Console.BackgroundColor = formerback;
}
}
}
/// <summary>
/// Returns true if running in a .NET Core environment
/// </summary>
/// TODO: Investigate if this is needed when removing .NET Framework 4.8 support
private static bool CoreEnvironment
{
get
{
return true;
} }
} }
} }