From ae86e1e74e55dd6d3b1ac2e3af364887c520e174 Mon Sep 17 00:00:00 2001 From: Joe Care Date: Tue, 20 Jan 2026 21:16:32 +0100 Subject: [PATCH] BaseLib --- Avalonia_Apps/Libraries/BaseLib/Interfaces/IConsole.cs | 1 + Avalonia_Apps/Libraries/BaseLib/Models/ConsoleProxy.cs | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/Avalonia_Apps/Libraries/BaseLib/Interfaces/IConsole.cs b/Avalonia_Apps/Libraries/BaseLib/Interfaces/IConsole.cs index 709b8e83c..51a405c64 100644 --- a/Avalonia_Apps/Libraries/BaseLib/Interfaces/IConsole.cs +++ b/Avalonia_Apps/Libraries/BaseLib/Interfaces/IConsole.cs @@ -149,6 +149,7 @@ public interface IConsole /// The next line of characters from the input stream, or an empty string if no input is available. /// string ReadLine(); + void ResetColor(); /// /// Sets the position of the cursor within the console buffer. diff --git a/Avalonia_Apps/Libraries/BaseLib/Models/ConsoleProxy.cs b/Avalonia_Apps/Libraries/BaseLib/Models/ConsoleProxy.cs index 62bba77c8..b62fc3237 100644 --- a/Avalonia_Apps/Libraries/BaseLib/Models/ConsoleProxy.cs +++ b/Avalonia_Apps/Libraries/BaseLib/Models/ConsoleProxy.cs @@ -20,6 +20,7 @@ public class ConsoleProxy : IConsole MethodInfo _writeCh = typeof(Console).GetMethod(nameof(Console.Write), [typeof(char)])!; MethodInfo _writeS = typeof(Console).GetMethod(nameof(Console.Write), [typeof(string)])!; MethodInfo _clear = typeof(Console).GetMethod(nameof(Console.Clear), [])!; + MethodInfo _resetColor = typeof(Console).GetMethod(nameof(Console.ResetColor), [])!; PropertyInfo _ForegroundColor = typeof(Console).GetProperty(nameof(Console.ForegroundColor))!; PropertyInfo _BackgroundColor = typeof(Console).GetProperty(nameof(Console.BackgroundColor))!; @@ -55,6 +56,9 @@ public class ConsoleProxy : IConsole #endif public ConsoleKeyInfo? ReadKey() => _ReadKey?.Invoke(null, []) as ConsoleKeyInfo?; public string ReadLine() => _Readline?.Invoke(null, [])?.ToString() ?? string.Empty; + + public void ResetColor() => _resetColor?.Invoke(null, []); + public void SetCursorPosition(int left, int top) => _setCursorPosition?.Invoke(null, [left, top]); public void Write(char ch) => _writeCh?.Invoke(null, [ch]); public void Write(string? st) => _writeS?.Invoke(null, [st]);