Skip to content
ConsoleMonster
Class

WriterTarget

ConsoleMonster.Output

Namespace
ConsoleMonster.Output
Assembly
ConsoleMonster
Implements
ITerminalTarget
Modifiers
sealed

Output to a TextWriter (a log, a StringWriter, a host's output stream) laid out for a chosen width, glyph tier and colour depth: append-only lines, with SGR colour codes only when the depth asks for them. No input.

Inheritance

  • object
  • WriterTarget

Constructors

WriterTarget 2 overloads
public WriterTarget(TextWriter writer, int width = 0, GlyphTier glyphs = Ascii, ColorDepth colors = None, CultureInfo? culture = null) #

Creates a writer target.

Parameters

writer System.IO.TextWriter required
The writer; the caller keeps ownership.
width int = 0 optional
Width in cells; zero resolves the current target, falling back to 100.
glyphs ConsoleMonster.Capabilities.GlyphTier = Ascii optional
The glyph tier (default ASCII, safe in any log).
colors ConsoleMonster.Capabilities.ColorDepth = None optional
The colour depth (default none: plain text).
culture System.Globalization.CultureInfo? = null optional
The culture for numbers, dates and built-in labels; null for the current culture.
public WriterTarget(TextWriter writer, TerminalProfile profile) #

Creates a writer target with an explicit profile (its mode decides between line output and VT output).

Parameters

writer System.IO.TextWriter required
The writer; the caller keeps ownership.
profile ConsoleMonster.Capabilities.TerminalProfile required
The profile.

Properties

public string Name { get; } #

A short description for diagnostics, for example console or recording 80x24.

public TerminalProfile Profile { get; } #

The capability profile for a write happening now (the console's refreshes its size on every call).

public ITheme? Theme { get; set; } #

The theme (default the dark theme, so output does not depend on the machine).

public ITerminalWriter? Writer { get; } #

The writer that receives the output, or null for the process console. The target owns it: callers write and flush but never dispose it.

public IInputSource? Input { get; } #

The input for prompts, menus and forms, or null. On the console null means the keyboard; on any other target it means nobody can answer, so prompts use their defaults or explain what is missing.