API Reference
ConsoleHelper
Helper methods for console interaction and logging.
Inheritance
- Object
- ConsoleHelper
Methods
CalculateDisplayWidth(System.String arg1) #Approximates the rendered column width of a string, skipping zero-width joiners and treating emoji/CJK code points as double width.
Parameters
- arg1 System.String
DisplayMessage(System.String action, System.String message, Spectre.Console.Color colorAction, Spectre.Console.Color colorMessage, TestimoX.Definitions.TestimoEmoji emoji, System.String divideChar) #Logs a formatted message including an emoji and colors.
Parameters
- action System.String
- Action being executed.
- message System.String
- Message to display.
- colorAction Spectre.Console.Color
- Color for the action.
- colorMessage Spectre.Console.Color
- Color for the message.
- emoji TestimoX.Definitions.TestimoEmoji
- Emoji to show.
- divideChar System.String
- Optional divider character.
DisplayMessage(System.String message, TestimoX.Definitions.TestimoStatus status, System.Boolean debugMessage) #Logs a simple message with status coloring.
Parameters
- message System.String
- Message to display.
- status TestimoX.Definitions.TestimoStatus
- Status of the message.
- debugMessage System.Boolean
- Whether the message is debug only.
EnumerateCodePoints(System.String arg1) #Enumerates Unicode code points from a UTF-16 string without System.Text.Rune (net472 safe).
Parameters
- arg1 System.String
GetEmojiPrefix(TestimoX.Definitions.TestimoEmoji emoji, System.Int32 targetWidth) #Returns a padded emoji (or ASCII fallback) so that subsequent text starts at a fixed column. Uses display-width calculations instead of raw string length to cope with composite emoji.
Parameters
- emoji TestimoX.Definitions.TestimoEmoji
- Emoji to render.
- targetWidth System.Int32
- Desired column width (default 3) for the glyph + padding.
InitializeDisplayLoggingToScreen(System.Threading.CancellationToken cancellationToken) #Continuously writes log messages to the screen until cancelled.
Parameters
- cancellationToken System.Threading.CancellationToken
- Token to cancel logging.
WaitForLogQueueToFinish(System.Threading.CancellationToken cancellationToken) #Waits until the log queue is fully processed.
Parameters
- cancellationToken System.Threading.CancellationToken
- Token to cancel waiting.
WriteMarkupLine(System.String markup) #Writes a markup line directly to the console, honouring the ForceAscii flag. When ForceAscii is on, all markup tags are stripped prior to writing.
Parameters
- markup System.String
- Text containing Spectre.Console markup.
WriteRule(System.String titleMarkup, System.String ruleStyle) #Renders a horizontal rule/heading in a way that degrades gracefully to plain ASCII.
Parameters
- titleMarkup System.String
- Title to display. Can contain Spectre.Console markup.
- ruleStyle System.String
- Spectre rule style when ANSI capable.