/// <summary> /// Sets the print appearance of the cursor based on the ANSI.SYS code provided. /// </summary> /// <param name="isBackground">When true, changes the background color instead of the foreground.</param> /// <param name="code">The 0-7 color code.</param> public static void AnsiConfigurePrintColor(bool isBackground, int code, State ansiState) { Color color; if (code == 0) color = ansiState.Bold ? ColorAnsi.BlackBright : ColorAnsi.Black; else if (code == 1) color = ansiState.Bold ? ColorAnsi.RedBright : ColorAnsi.Red; else if (code == 2) color = ansiState.Bold ? ColorAnsi.GreenBright : ColorAnsi.Green; else if (code == 3) color = ansiState.Bold ? ColorAnsi.YellowBright : ColorAnsi.Yellow; else if (code == 4) color = ansiState.Bold ? ColorAnsi.BlueBright : ColorAnsi.Blue; else if (code == 5) color = ansiState.Bold ? ColorAnsi.MagentaBright : ColorAnsi.Magenta; else if (code == 6) color = ansiState.Bold ? ColorAnsi.CyanBright : ColorAnsi.Cyan; else if (code == 7) color = ansiState.Bold ? ColorAnsi.WhiteBright : ColorAnsi.White; else color = ColorAnsi.Black; if (isBackground) ansiState.Background = AnsiJustNormalColor(color); else ansiState.Foreground = color; }
public AnsiWriter(Document ansiDocument, Console console) { _ansiDoc = ansiDocument; _console = console; _cursor = new Console.Cursor(console); CharactersPerSecond = 800; _bytes = ansiDocument.AnsiBytes; _ansiState = new State(); _ansiCodeBuilder = new StringBuilder(5); _ansiStringBuilder = new StringBuilder(40); BlinkEffect = new Blink() { BlinkSpeed = 0.35f }; }
public AnsiWriter(Document ansiDocument, SurfaceEditor editor) { _ansiDoc = ansiDocument; _editor = editor; _cursor = new Cursor(editor); _cursor.UseStringParser = false; _cursor.DisableWordBreak = true; CharactersPerSecond = 800; _bytes = ansiDocument.AnsiBytes; _ansiState = new State(); _ansiCodeBuilder = new StringBuilder(5); _ansiStringBuilder = new StringBuilder(40); BlinkEffect = new Blink() { BlinkSpeed = 0.35f }; }