4using System.Threading.Tasks;
27 private static ConsoleColor foregroundColor = System.Console.
ForegroundColor;
28 private static ConsoleColor backgroundColor = System.Console.BackgroundColor;
38 public static IFormatProvider
FormatProvider => System.Console.Out.FormatProvider;
43 public static string NewLine => System.Console.Out.NewLine;
53 public static int WindowLeft => System.Console.WindowLeft;
58 public static int WindowTop => System.Console.WindowTop;
68 public static int CursorLeft => System.Console.CursorLeft;
73 public static int CursorTop => System.Console.CursorTop;
78 public static int CursorSize => System.Console.CursorSize;
85 get => foregroundColor;
88 foregroundColor = value;
98 get => backgroundColor;
101 backgroundColor = value;
110 public static void Write(
string value)
112 if (!
string.IsNullOrEmpty(value))
140 public static void Write(ulong value)
142 Write(value.ToString());
149 public static void Write(uint value)
151 Write(value.ToString());
159 public static void Write(
string format, params
object[] arg)
161 Write(
string.Format(format, arg));
171 public static void Write(
string format,
object arg0,
object arg1,
object arg2)
173 Write(
string.Format(format, arg0, arg1, arg2));
182 public static void Write(
string format,
object arg0,
object arg1)
184 Write(
string.Format(format, arg0, arg1));
192 public static void Write(
string format,
object arg0)
194 Write(
string.Format(format, arg0));
201 public static void Write(
float value)
203 Write(value.ToString());
210 public static void Write(
long value)
212 Write(value.ToString());
221 Write(value.ToString());
228 public static void Write(
double value)
230 Write(value.ToString());
237 public static void Write(decimal value)
239 Write(value.ToString());
248 public static void Write(
char[] buffer,
int index,
int count)
250 Write(
new string(buffer, index, count));
257 public static void Write(
char[] buffer)
259 Write(
new string(buffer));
266 public static void Write(
char value)
268 Write(
new string(value, 1));
275 public static void Write(
bool value)
277 Write(value.ToString());
284 public static void Write(
object value)
286 if (!(value is
null))
287 Write(value.ToString());
296 if (!
string.IsNullOrEmpty(value))
313 public static Task
WriteAsync(
char[] buffer,
int index,
int count)
315 return WriteAsync(
new string(buffer, index, count));
401 public static void WriteLine(
string format, params
object[] arg)
413 public static void WriteLine(
string format,
object arg0,
object arg1,
object arg2)
415 WriteLine(
string.Format(format, arg0, arg1, arg2));
424 public static void WriteLine(
string format,
object arg0,
object arg1)
426 WriteLine(
string.Format(format, arg0, arg1));
443 public static void WriteLine(
string format,
object arg0)
490 public static void WriteLine(
char[] buffer,
int index,
int count)
492 WriteLine(
new string(buffer, index, count));
519 if (!(value is
null))
605 public static void Flush(
bool Terminate)
629 TaskCompletionSource<bool> Result =
new TaskCompletionSource<bool>();
640 get =>
new ConsoleOutTextWriter();
646 private class ConsoleOutTextWriter : TextWriter
648 public ConsoleOutTextWriter()
658 public override void Write(
string format, params
object[] arg) =>
ConsoleOut.
Write(format, arg);
659 public override void Write(
string format,
object arg0,
object arg1,
object arg2) =>
ConsoleOut.
Write(format, arg0, arg1, arg2);
660 public override void Write(
string format,
object arg0,
object arg1) =>
ConsoleOut.
Write(format, arg0, arg1);
661 public override void Write(
string format,
object arg0) =>
ConsoleOut.
Write(format, arg0);
668 public override void Write(
char[] buffer,
int index,
int count) =>
ConsoleOut.
Write(buffer, index, count);
673 public override Task WriteAsync(
char[] buffer,
int index,
int count) =>
ConsoleOut.
WriteAsync(buffer, index, count);
678 public override void WriteLine(
string format, params
object[] arg) =>
ConsoleOut.
WriteLine(format, arg);
679 public override void WriteLine(
string format,
object arg0,
object arg1,
object arg2) =>
ConsoleOut.
WriteLine(format, arg0, arg1, arg2);
680 public override void WriteLine(
string format,
object arg0,
object arg1) =>
ConsoleOut.
WriteLine(format, arg0, arg1);
683 public override void WriteLine(
string format,
object arg0) =>
ConsoleOut.
WriteLine(format, arg0);
688 public override void WriteLine(
char[] buffer,
int index,
int count) =>
ConsoleOut.
WriteLine(buffer, index, count);
695 public override Task WriteLineAsync(
char[] buffer,
int index,
int count) =>
ConsoleOut.
WriteLineAsync(buffer, index, count);
Serializes output to System.Console.Out, and assures modules are not dead-locked in case the Console ...
static void Write(long value)
Queues a value to be written to the console output.
static void WriteLine(string format, object arg0, object arg1)
Queues a value to be written to the console output.
static void Write(string format, params object[] arg)
Queues a value to be written to the console output.
static async Task FlushAsync(bool Terminate)
Asynchronously clears all buffers for the current writer and causes any buffered data to be written t...
static Encoding Encoding
The character encoding in which the output is written.
static void Write(CustomWriter Writer, ConsoleColor? ForegroundColor, ConsoleColor? BackgroundColor)
Queues a custom writer to the console output.
static int CursorTop
Top position of cursor.
static void WriteLine(bool value)
Queues a value to be written to the console output.
static void WriteLine(decimal value)
Queues a value to be written to the console output.
static void Write(uint value)
Queues a value to be written to the console output.
static void Write(bool value)
Queues a value to be written to the console output.
static int WindowHeight
Height of window.
static void Write(string format, object arg0)
Queues a value to be written to the console output.
static void WriteLine(char[] buffer, int index, int count)
Queues a value to be written to the console output.
static int CursorSize
Size of cursor.
static Task WriteLineAsync()
Queues a value to be written to the console output.
static ConsoleColor BackgroundColor
Console background color.
static void Write(string value)
Queues a value to be written to the console output.
static void WriteLine(double value)
Queues a value to be written to the console output.
static Task FlushAsync()
Asynchronously clears all buffers for the current writer and causes any buffered data to be written t...
static void Flush(bool Terminate)
Clears all buffers for the current writer and causes any buffered data to be written to the underlyin...
static void Write(object value)
Queues a value to be written to the console output.
static TextWriter Writer
Provides a TextWriter instance, that writes to ConsoleOut.
static void WriteLine(string value)
Queues a value to be written to the console output.
static int WindowLeft
Left edge of window.
static void WriteLine(int value)
Queues a value to be written to the console output.
static async Task WriteAsync(string value)
Queues a value to be written to the console output.
static async Task WriteAsync(CustomAsyncWriter Writer, ConsoleColor? ForegroundColor, ConsoleColor? BackgroundColor)
Queues a custom writer to the console output.
static void Write(double value)
Queues a value to be written to the console output.
static void WriteLine(char value)
Queues a value to be written to the console output.
static void Write(char value)
Queues a value to be written to the console output.
static int CursorLeft
Left position of cursor.
static void Write(ulong value)
Queues a value to be written to the console output.
static void Write(int value)
Queues a value to be written to the console output.
static void WriteLine(ulong value)
Queues a value to be written to the console output.
static void Write(string format, object arg0, object arg1, object arg2)
Queues a value to be written to the console output.
static ConsoleColor ForegroundColor
Console foreground color.
static Task WriteLineAsync(char[] buffer)
Queues a value to be written to the console output.
static void WriteLine()
Queues a value to be written to the console output.
static Task WriteAsync(char value)
Queues a value to be written to the console output.
static void WriteLine(object value)
Queues a value to be written to the console output.
static void WriteLine(string format, params object[] arg)
Queues a value to be written to the console output.
static void WriteLine(string format, object arg0, object arg1, object arg2)
Queues a value to be written to the console output.
static string NewLine
The line terminator string for the current TextWriter.
static Task WriteAsync(CustomAsyncWriter Writer)
Queues a custom writer to the console output.
static Task WriteAsync(char[] buffer)
Queues a value to be written to the console output.
static int WindowTop
Top edge of window.
static void Write(decimal value)
Queues a value to be written to the console output.
static void Write(float value)
Queues a value to be written to the console output.
static void Write(CustomWriter Writer)
Queues a custom writer to the console output.
static void Flush()
Clears all buffers for the current writer and causes any buffered data to be written to the underlyin...
static void Beep()
Emits a Beep sounds.
static void WriteLine(long value)
Queues a value to be written to the console output.
static int WindowWidth
Width of window.
static void WriteLine(char[] buffer)
Queues a value to be written to the console output.
static void WriteLine(float value)
Queues a value to be written to the console output.
static void WriteLine(string format, object arg0)
Queues a value to be written to the console output.
static Task WriteLineAsync(char value)
Queues a value to be written to the console output.
static async Task WriteLineAsync(string value)
Queues a value to be written to the console output.
static void Write(char[] buffer, int index, int count)
Queues a value to be written to the console output.
static void Write(char[] buffer)
Queues a value to be written to the console output.
static Task WriteLineAsync(char[] buffer, int index, int count)
Queues a value to be written to the console output.
static void WriteLine(uint value)
Queues a value to be written to the console output.
static IFormatProvider FormatProvider
Gets an object that controls formatting.
static Task WriteAsync(char[] buffer, int index, int count)
Queues a value to be written to the console output.
static void Write(string format, object arg0, object arg1)
Queues a value to be written to the console output.
Changes the console background color.
Used to signal end of queue has been reached.
Changes the console foreground color.
Writes a string to the console, appending a newline at the end.
Writes a string to the console
Processes console tasks, such as input and output, in a serialized asynchronous manner.
static Task< bool > Queue(WorkItem Work)
Queues a work item.
static bool Terminating
If the console worker is being terminated.
Manages a Console operation.
Task< bool > Wait()
Waits for the item to be processed.
delegate void CustomWriter(TextWriter Output)
Delegate for custom writers.
delegate Task CustomAsyncWriter(TextWriter Output)
Delegate for asynchronous custom writers.