Skip to main content

ServerConsole

An abstract class in Root.Township, the global namespace.

Base for the dedicated server's text console (Windows, Linux or a null console). Queues typed lines and hands them to listeners on the main thread.

Constructors​

MemberWhat it is
ServerConsole()Creates a ServerConsole with default values.

Fields​

2 private and internal fields
MemberWhat it is
private ConcurrentQueue<string> inputQueueThread-safe queue of commands typed into the console, drained by ProcessInputQueue.
private static Logger loggerNLog logger for this class.

Events​

MemberWhat it is
event Action<string> TextEnteredRaised from ProcessInputQueue with each line typed into the console.

Methods​

MemberWhat it is
abstract void HandleLog(string message, LogLevel level)Writes a log message to the console at the given level.
void ProcessInputQueue()Raises TextEntered for each queued line. Call from the main thread; errors are logged.
abstract void Shutdown()Closes the console.
protected void OnTextEntered(string command)Called by subclasses with a typed line. Queues it unless empty.

Used in​

Members of other types that take, return or hold a ServerConsole: