Skip to content
Merged

sync #680

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Avalonia_Apps/Libraries/BaseLib/Interfaces/IConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
/// </returns>
string ReadLine();
void ResetColor();

/// <summary>
/// Sets the position of the cursor within the console buffer.
Expand Down
4 changes: 4 additions & 0 deletions Avalonia_Apps/Libraries/BaseLib/Models/ConsoleProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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))!;
Expand Down Expand Up @@ -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]);
Expand Down