Terminal

Description

static class Tinman.Core.System.Terminal

Helper class for writing to the standard output stream resp. the console window.

Public / Methods

Cancel​Requested


public static method CancelRequested → (1)

reset opt : bool = true

Reset the cancel state to false?

returns → bool

true if the user has pressed Ctrl-C in the console, false if not.

Shall the program terminate (i.e. the user has pressed Ctrl-C in the console)?

Flush


public static method Flush → ()

Flushes the standard output stream.

Peek


public static method Peek → ()

returns → int32

The next character or -1 if there are no characters available on the stream.

Peeks at the next character from the standard input stream without changing the stream position.

This method will block until at least one input character is available.

Read


public static method Read → ()

returns → int32

The read character or -1 if there are no characters available on the stream.

Reads the next character from the standard input stream.

This method will block until at least one input character is available.

Read​Line


public static method ReadLine → ()

returns → string

The read text line or null if there are no characters available on the stream.

Reads the next text line from the standard input stream.

Separator


public static method Separator → (1)

opt : char = '-'

The separator line character.

Writes a separator line.

Window


public static method Window → (1)

title opt : string = null

Optional console window title to set.

The calling process wants to have separate console window.

If the calling process already has a console window, the method tries to set the console window title. Otherwise a new console window is created and the standard streams are redirected to it. If for some reason a console window cannot be created, the method will return silently.

Write


public static method Write → (1)

text in : string

[not-null]
The text to write.

Writes the given text to the standard output stream.

Write​Line

2 overloads


public static method WriteLine1 → ()

Writes a line break to the standard output stream.


public static method WriteLine2 → (1)

text in : string

[not-null]
The text to write.

Writes the given text to the standard output stream, followed by a line break.

Public / Attributes

Columns


public static attribute Columns → (get,set)

value : int32

[>=0]
The column count. Set to 0 in order to clear the explicit column count (see remarks).

Returns the column count of the system console window.

If the column count has been specified explicitly, that value is returned. Otherwise the system console window width is returned. In case the width cannot be determined, the default value 117 is returned (which nicely fits into one half of a 1920x1080 screen when using a raster font having a pixel width of 8).

Is​Interactive


public static attribute IsInteractive → (get)

value : bool

true if the console is interactive, false if not.

Is the console interactive (e.g. the user can feed data to standard input by typing on the keyboard)?