/// <summary> /// Makes the grid lines that identify each module displayed on the terminal. /// </summary> private static void WriteGridLines() { var storedColors = ColorStore.StoreCurrentColors(); Console.BackgroundColor = Configuration.Global.GetValue <ConsoleColor>("term_color_grid"); char[] c; for (int i = 0; i <= modRows; i++) { Console.SetCursorPosition(0, i == modRows ? height - 3 : (height / modRows) * i - i); c = new char[width]; for (int j = 0; j < c.Length; j++) { c[j] = ' '; } Console.Write(c); } for (int i = 0; i <= modCols; i++) { int left = i == modCols ? width - 1 : i * (width / modCols); for (int j = 0; j < height - 3; j++) { Console.SetCursorPosition(left, j); Console.Write(' '); } } //Writing the selected border Console.BackgroundColor = Configuration.Global.GetValue <ConsoleColor>("term_color_selected"); c = new char[width / modCols]; for (int i = 0; i < c.Length; i++) { c[i] = ' '; } int modLeft = runningMods[selectedMod].WriteX - 1; int modTop = runningMods[selectedMod].WriteY - 1; int modHeight = runningMods[selectedMod].Height + 1; int modWidth = runningMods[selectedMod].Width + 1; for (int i = 0; i < 2; i++) { Console.SetCursorPosition(modLeft, modTop + (modHeight * i)); Console.Write(c); } for (int i = 0; i < 2; i++) { int x = modLeft + modWidth * i; x = x >= width ? width - 1 : x; for (int j = 0; j < modHeight; j++) { Console.SetCursorPosition(x, modTop + j); Console.Write(' '); } } storedColors.Restore(); }
public Element() { var globalConf = Configuration.Global; subElements = new List<Element>(); NormalColors = new ColorStore(globalConf.GetValue<ConsoleColor>("mbc_console_text_foreground"), globalConf.GetValue<ConsoleColor>("mbc_console_text_background")); SelectedColors = new ColorStore(globalConf.GetValue<ConsoleColor>("mbc_console_text_selected_foreground"), globalConf.GetValue<ConsoleColor>("mbc_console_text_selected_background")); FlashColors = new ColorStore(globalConf.GetValue<ConsoleColor>("mbc_console_text_flashing_foreground"), globalConf.GetValue<ConsoleColor>("mbc_console_text_flashing_background")); ThreadRequired = false; }
/// <summary> /// Updates the display of the input line on the terminal window. Optionally updates /// just the input string that the user has entered instead of the entire line. /// </summary> private static void UpdateInputLineDisplay(bool complete) { var storedColors = ColorStore.StoreCurrentColors(); if (complete) { Console.ForegroundColor = Configuration.Global.GetValue <ConsoleColor>("term_color_input_display"); Console.SetCursorPosition(0, height - 2); Console.Write("[Input]:> "); } else { Console.SetCursorPosition(10, height - 2); } Console.ForegroundColor = Configuration.Global.GetValue <ConsoleColor>("term_color_input_text"); Console.Write(new String(' ', width - 10)); Console.SetCursorPosition(10, height - 2); Console.Write(inputLine); storedColors.Restore(); }