mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-16 05:05:05 +00:00
fix: Fixed a bug where color formatted console output on Net Standard was not raising the OnConsolePrint event
This commit is contained in:
@@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Fixed exception trying to get DHCP status of network interfaces on Linux
|
- 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
|
## [10.3.0] - 2020-01-20
|
||||||
### Changed
|
### Changed
|
||||||
|
|||||||
@@ -83,13 +83,17 @@ namespace ICD.Common.Utils
|
|||||||
|
|
||||||
public static void PrintLine(eConsoleColor color, string message)
|
public static void PrintLine(eConsoleColor color, string message)
|
||||||
{
|
{
|
||||||
|
string ansi = color.FormatAnsi(message);
|
||||||
|
|
||||||
#if SIMPLSHARP
|
#if SIMPLSHARP
|
||||||
PrintLine(color.FormatAnsi(message));
|
PrintLine(ansi);
|
||||||
#else
|
#else
|
||||||
System.Console.ForegroundColor = color.ToForegroundConsoleColor();
|
System.Console.ForegroundColor = color.ToForegroundConsoleColor();
|
||||||
System.Console.BackgroundColor = color.ToBackgroundConsoleColor();
|
System.Console.BackgroundColor = color.ToBackgroundConsoleColor();
|
||||||
System.Console.WriteLine(message);
|
System.Console.WriteLine(message);
|
||||||
System.Console.ResetColor();
|
System.Console.ResetColor();
|
||||||
|
|
||||||
|
OnConsolePrint.Raise(null, new StringEventArgs(ansi + IcdEnvironment.NewLine));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,6 +122,8 @@ namespace ICD.Common.Utils
|
|||||||
|
|
||||||
public static void Print(eConsoleColor color, string message)
|
public static void Print(eConsoleColor color, string message)
|
||||||
{
|
{
|
||||||
|
string ansi = color.FormatAnsi(message);
|
||||||
|
|
||||||
#if SIMPLSHARP
|
#if SIMPLSHARP
|
||||||
Print(color.FormatAnsi(message));
|
Print(color.FormatAnsi(message));
|
||||||
#else
|
#else
|
||||||
@@ -125,6 +131,8 @@ namespace ICD.Common.Utils
|
|||||||
System.Console.BackgroundColor = color.ToBackgroundConsoleColor();
|
System.Console.BackgroundColor = color.ToBackgroundConsoleColor();
|
||||||
System.Console.Write(message);
|
System.Console.Write(message);
|
||||||
System.Console.ResetColor();
|
System.Console.ResetColor();
|
||||||
|
|
||||||
|
OnConsolePrint.Raise(null, new StringEventArgs(ansi));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user