From 3b5c9ed51beeda26247709ee7fb591d4cf797c49 Mon Sep 17 00:00:00 2001 From: Chris Cameron Date: Wed, 12 Feb 2020 16:59:40 -0500 Subject: [PATCH] fix: Fixed a bug where color formatted console output on Net Standard was not raising the OnConsolePrint event --- CHANGELOG.md | 1 + ICD.Common.Utils/IcdConsole.cs | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a617e6a..9db2098 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/ICD.Common.Utils/IcdConsole.cs b/ICD.Common.Utils/IcdConsole.cs index 15c0136..29fed95 100644 --- a/ICD.Common.Utils/IcdConsole.cs +++ b/ICD.Common.Utils/IcdConsole.cs @@ -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 }