Search Results for

    Show / Hide Table of Contents

    Class ConsoleMisc

    Miscellaneous extensions for the console

    Inheritance
    object
    ConsoleMisc
    Namespace: Terminaux.Base.Extensions
    Assembly: Terminaux.dll
    Syntax
    public static class ConsoleMisc

    Properties

    | Edit this page View Source

    IsOnAltBuffer

    Checks to see whether we're in the alternative buffer or not

    Declaration
    public static bool IsOnAltBuffer { get; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    TerminalReversesRtlText

    Specifies whether your terminal emulator reverses the RTL text automatically or not

    Declaration
    public static bool TerminalReversesRtlText { get; set; }
    Property Value
    Type Description
    bool

    Methods

    | Edit this page View Source

    Bell(ConsoleBell, int, int)

    Emits the console bell using either audible or visible bell types

    Declaration
    public static void Bell(ConsoleBell bell = ConsoleBell.Audible, int delay = -1, int freq = -1)
    Parameters
    Type Name Description
    ConsoleBell bell

    Type of console bell

    int delay

    Delay of the bell (audible and visual)

    int freq

    Frequency of the bell (audible)

    | Edit this page View Source

    FilterVTSequences(string)

    Filters the VT sequences that matches the regex

    Declaration
    public static string FilterVTSequences(string Text)
    Parameters
    Type Name Description
    string Text

    The text that contains the VT sequences

    Returns
    Type Description
    string

    The text that doesn't contain the VT sequences

    | Edit this page View Source

    Flash()

    Flashes the screen

    Declaration
    public static void Flash()
    | Edit this page View Source

    Flash(int)

    Flashes the screen

    Declaration
    public static void Flash(int delay)
    Parameters
    Type Name Description
    int delay

    Delay as specified

    | Edit this page View Source

    GetWrappedSentences(string, int)

    Gets the wrapped sentences for text wrapping for console (with character wrapping)

    Declaration
    public static string[] GetWrappedSentences(string text, int maximumLength)
    Parameters
    Type Name Description
    string text

    Text to be wrapped

    int maximumLength

    Maximum length of text before wrapping

    Returns
    Type Description
    string[]
    | Edit this page View Source

    GetWrappedSentences(string, int, int)

    Gets the wrapped sentences for text wrapping for console (with character wrapping)

    Declaration
    public static string[] GetWrappedSentences(string text, int maximumLength, int indentLength)
    Parameters
    Type Name Description
    string text

    Text to be wrapped

    int maximumLength

    Maximum length of text before wrapping

    int indentLength

    Indentation length

    Returns
    Type Description
    string[]
    | Edit this page View Source

    GetWrappedSentencesByWords(string, int)

    Gets the wrapped sentences for text wrapping for console (with word wrapping)

    Declaration
    public static string[] GetWrappedSentencesByWords(string text, int maximumLength)
    Parameters
    Type Name Description
    string text

    Text to be wrapped

    int maximumLength

    Maximum length of text before wrapping

    Returns
    Type Description
    string[]
    Remarks

    This function returns the same output as GetWrappedSentences(string, int, int) if there are any full-width characters.

    | Edit this page View Source

    GetWrappedSentencesByWords(string, int, int)

    Gets the wrapped sentences for text wrapping for console (with word wrapping)

    Declaration
    public static string[] GetWrappedSentencesByWords(string text, int maximumLength, int indentLength)
    Parameters
    Type Name Description
    string text

    Text to be wrapped

    int maximumLength

    Maximum length of text before wrapping

    int indentLength

    Indentation length

    Returns
    Type Description
    string[]
    Remarks

    This function returns the same output as GetWrappedSentences(string, int, int) if there are any full-width characters.

    | Edit this page View Source

    InitializeSequences()

    Initializes the VT sequence handling for Windows systems.

    Declaration
    public static bool InitializeSequences()
    Returns
    Type Description
    bool

    True if successful; false if not. Alays true on non-Windows systems.

    | Edit this page View Source

    PercentRepeat(int, int, int)

    Gets how many times to repeat the character to represent the appropriate percentage level for the specified number.

    Declaration
    public static int PercentRepeat(int CurrentNumber, int MaximumNumber, int WidthOffset)
    Parameters
    Type Name Description
    int CurrentNumber

    The current number that is less than or equal to the maximum number.

    int MaximumNumber

    The maximum number.

    int WidthOffset

    The console window width offset. It's usually a multiple of 2.

    Returns
    Type Description
    int

    How many times to repeat the character

    | Edit this page View Source

    PercentRepeatTargeted(int, int, int)

    Gets how many times to repeat the character to represent the appropriate percentage level for the specified number.

    Declaration
    public static int PercentRepeatTargeted(int CurrentNumber, int MaximumNumber, int TargetWidth)
    Parameters
    Type Name Description
    int CurrentNumber

    The current number that is less than or equal to the maximum number.

    int MaximumNumber

    The maximum number.

    int TargetWidth

    The target width

    Returns
    Type Description
    int

    How many times to repeat the character

    | Edit this page View Source

    ReverseRtl(string)

    Reverses the right-to-left characters in a string (for terminal printing)

    Declaration
    public static string ReverseRtl(string target)
    Parameters
    Type Name Description
    string target

    Target string to reverse

    Returns
    Type Description
    string

    A string containing reversed RTL characters for usage with terminal writing. Returns the original string if either the terminal emulator is reversing the order of RTL characters or if there are no RTL characters

    | Edit this page View Source

    SetTitle(string)

    Sets the console title

    Declaration
    public static void SetTitle(string Text)
    Parameters
    Type Name Description
    string Text

    The text to be set

    | Edit this page View Source

    ShowAltBuffer()

    Shows the alternate buffer

    Declaration
    public static void ShowAltBuffer()
    | Edit this page View Source

    ShowMainBuffer()

    Shows the main buffer

    Declaration
    public static void ShowMainBuffer()
    | Edit this page View Source

    Truncate(string, int, bool)

    Truncates the string if the string is larger than the threshold, otherwise, returns an unchanged string

    Declaration
    public static string Truncate(this string target, int threshold, bool ellipsis = true)
    Parameters
    Type Name Description
    string target

    Source string to truncate

    int threshold

    Max number of string characters

    bool ellipsis

    Whether to insert ellipsis or not

    Returns
    Type Description
    string

    Truncated string

    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX