fix: Fixed a bug where color formatted console output on Net Standard was not raising the OnConsolePrint event

This commit is contained in:
Chris Cameron
2020-02-12 16:59:40 -05:00
parent e2646194b8
commit 3b5c9ed51b
2 changed files with 10 additions and 1 deletions

View File

@@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Changed
- Fixed exception trying to get DHCP status of network interfaces on Linux
- Fixed a bug where color formatted console output on Net Standard was not raising the OnConsolePrint event
## [10.3.0] - 2020-01-20
### Changed

View File

@@ -83,13 +83,17 @@ namespace ICD.Common.Utils
public static void PrintLine(eConsoleColor color, string message)
{
string ansi = color.FormatAnsi(message);
#if SIMPLSHARP
PrintLine(color.FormatAnsi(message));
PrintLine(ansi);
#else
System.Console.ForegroundColor = color.ToForegroundConsoleColor();
System.Console.BackgroundColor = color.ToBackgroundConsoleColor();
System.Console.WriteLine(message);
System.Console.ResetColor();
OnConsolePrint.Raise(null, new StringEventArgs(ansi + IcdEnvironment.NewLine));
#endif
}
@@ -118,6 +122,8 @@ namespace ICD.Common.Utils
public static void Print(eConsoleColor color, string message)
{
string ansi = color.FormatAnsi(message);
#if SIMPLSHARP
Print(color.FormatAnsi(message));
#else
@@ -125,6 +131,8 @@ namespace ICD.Common.Utils
System.Console.BackgroundColor = color.ToBackgroundConsoleColor();
System.Console.Write(message);
System.Console.ResetColor();
OnConsolePrint.Raise(null, new StringEventArgs(ansi));
#endif
}