Class ThreadSafeConsoleManager
Thread-safe singleton for managing console operations. Prevents race conditions between main UI thread and background threads (like resize listener).
public sealed class ThreadSafeConsoleManager : IDisposable
- Inheritance
-
ThreadSafeConsoleManager
- Implements
- Inherited Members
Properties
CurrentMode
public ThreadSafeConsoleManager.ConsoleMode CurrentMode { get; }
Property Value
Instance
public static ThreadSafeConsoleManager Instance { get; }
Property Value
IsInputRedirected
public bool IsInputRedirected { get; }
Property Value
Methods
Clear()
public void Clear()
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
GetCursorPosition()
public (int Left, int Top) GetCursorPosition()
Returns
GetDimensions()
public (int Width, int Height) GetDimensions()
Returns
GetDimensionsForceRefresh()
public (int Width, int Height) GetDimensionsForceRefresh()
Returns
ReadKey(bool)
public ConsoleKeyInfo ReadKey(bool intercept = false)
Parameters
interceptbool
Returns
ReadLine()
public string? ReadLine()
Returns
ResetColor()
public void ResetColor()
SetBackgroundColor(ConsoleColor)
public void SetBackgroundColor(ConsoleColor color)
Parameters
colorConsoleColor
SetCursorPosition(int, int)
public void SetCursorPosition(int left, int top)
Parameters
SetForegroundColor(ConsoleColor)
public void SetForegroundColor(ConsoleColor color)
Parameters
colorConsoleColor
SetMode(ConsoleMode)
public void SetMode(ThreadSafeConsoleManager.ConsoleMode mode)
Parameters
Write(string)
public void Write(string text)
Parameters
textstring
WriteLine(string)
public void WriteLine(string text = "")
Parameters
textstring