API Reference
CellPresenters
The built-in presenters by name, and the shared presentation step (presenter, then tone rules) used by tables, record cards, record views, key/value lists and trees.
Inheritance
- Object
- CellPresenters
Methods
public static ICellPresenter? ForLabel(String? label, Object? value) #ICellPresenter?The identifier presenter for an integer whose label reads as an identifier (Id, ProcessId, Port, Handle...), so record fields, trees and key/value lists show 8080 and 127096 as tables do, never 8 080.
Parameters
- label System.String?
- The field label or member name.
- value System.Object?
- The value.
Returns
The identifier presenter, or null.
public static ICellPresenter? ForMember(String? name, Type? type) #ICellPresenter?The presenter a column gets from its member name and value type, or null for the default: plain digits for integer identifiers (Id, PID, Port, Index, Year, names ending in Id or Port), byte counts for integer members named Size, Length, Bytes, WorkingSet or Memory (and names ending in them), dates for DateTime and DateTimeOffset, durations for TimeSpan, Yes/No for booleans, and status markers for enums whose names read as a status (Running, Stopped, Failed...).
Parameters
- name System.String?
- The member or column name.
- type System.Type?
- The value type, or null when unknown.
Returns
The presenter, or null.
public static ICellPresenter? ForStatus(String? name, Object? sample) #ICellPresenter?The status presenter for a column whose values read as statuses, whatever presenters are otherwise chosen: an enum with status names (ServiceControllerStatus), or text in a column named like a status (Status, State, Result, Outcome, Health, Level, Severity) whose value is a status word (Success, Warning, Error, Running...). The value's own word is kept, with a marker and tone: ✓ Success, ▴ Warning.
Parameters
- name System.String?
- The column or member name.
- sample System.Object?
- A sample value.
Returns
The status presenter, or null.
public static ICellPresenter FromName(String name, String? unit = null) #ICellPresenterReturns a built-in presenter by name (case-insensitive): Text, Auto, Status, Number, Bytes, Duration, Date, DateRelative, DateBoth, Boolean, Bar (DataBar), Sparkline, Progress, Link.
Parameters
- name System.String
- The name.
- unit System.String? = null
- The unit for Number, or null.
Returns
The presenter.
Exceptions
ArgumentException– The name is unknown.
public static PresentedValue Present(Object? value, ICellPresenter? presenter, IReadOnlyList<ToneRule>? rules, PresenterContext context) #PresentedValuePresents a value with a presenter (or CellPresenters.Auto) and applies the first matching tone rule: the text takes the rule's colour, and without colour a status tone adds its symbol in front.
Parameters
- value System.Object?
- The raw value.
- presenter ConsoleMonster.Presenters.ICellPresenter?
- The presenter, or null for automatic.
- rules System.Collections.Generic.IReadOnlyList<ConsoleMonster.Presenters.ToneRule>?
- Tone rules, or null.
- context ConsoleMonster.Presenters.PresenterContext
- The presenter context.
Returns
The presented value.
Inherited Methods
public virtual Boolean Equals(Object? obj) #BooleanParameters
- obj Object?
Properties
public static ICellPresenter Emoji { get; } #Text with :shortcode: emoji, degraded per glyph tier (see EmojiPresenter).
public static ICellPresenter Identifier { get; } #Identifier numbers (ids, ports, indexes, years) without thousands separators (see IdentifierPresenter).
public static ICellPresenter StatusWord { get; } #Enum or text values that read as a status, shown with a marker (see StatusEnumPresenter).
public static ICellPresenter Number { get; } #Numbers with culture separators, right-aligned.
public static ICellPresenter Duration { get; } #Durations (TimeSpan, or numbers in seconds).
public static ICellPresenter Progress { get; } #Fractions and done/total as progress.
public static ICellPresenter Markup { get; } #Text values interpreted as markup ([pass]OK[/]); invalid markup is shown literally. Data stays literal unless a column opts in with this presenter.