public static Color FromString(string color) { Color NewColor; if (StringToColor.TryGetValue(color, out NewColor)) { return(NewColor); } else { return(Color.Auto); } }
private void DisplayRightPanel() { string color = StringToColor.ConvertToString(currentColor).PadRight(12); MainMenuHelper.MakeFrame(Console.WindowWidth - 31, 0); int textStart = Console.WindowWidth - 29; MainMenuHelper.WriteInCenter("Settings", 3, textStart, 2); MainMenuHelper.WriteText("Current X position: " + cursorLeftPosition.ToString().PadRight(4), textStart, 5); MainMenuHelper.WriteText("Current Y position: " + (EditorInstance.MapHeight - cursorTopPosition - 1).ToString().PadRight(4), textStart, 6); if (currentTabIndex == 0) { MainMenuHelper.WriteText("Current color: " + color, textStart, 8); MainMenuHelper.WriteText("Map height: " + EditorInstance.MapHeight.ToString().PadRight(4), textStart, 10); MainMenuHelper.WriteText("Map width: " + EditorInstance.MapWidth.ToString().PadRight(4), textStart, 11); } else if (currentTabIndex == 1) { //Current color if (currentCursorIndex == 0) { if (!enterPressed) { MainMenuHelper.WriteText("Current color: " + color, textStart, 8, ConsoleColor.Gray, ConsoleColor.Blue); } else if (enterPressed) { MainMenuHelper.WriteText("Current color: " + color, textStart, 8, ConsoleColor.Black, ConsoleColor.Cyan); } } else { MainMenuHelper.WriteText("Current color: " + color, textStart, 8); } //Map height string mapHeight = EditorInstance.MapHeight.ToString().PadRight(4); MainMenuHelper.WriteText("Map height: ", textStart, 10); if (currentCursorIndex == 1) { if (!enterPressed) { MainMenuHelper.WriteText(mapHeight, textStart + 12, 10, ConsoleColor.Gray, ConsoleColor.Blue); } else if (enterPressed) { MainMenuHelper.WriteText(mapHeight, textStart + 12, 10, ConsoleColor.Black, ConsoleColor.Cyan); } } else { MainMenuHelper.WriteText(mapHeight, textStart + 12, 10); } //Map width string mapWidth = EditorInstance.MapWidth.ToString().PadRight(4); MainMenuHelper.WriteText("Map width: ", textStart, 11); if (currentCursorIndex == 2) { if (!enterPressed) { MainMenuHelper.WriteText(mapWidth, textStart + 12, 11, ConsoleColor.Gray, ConsoleColor.Blue); } else if (enterPressed) { MainMenuHelper.WriteText(mapWidth, textStart + 12, 11, ConsoleColor.Black, ConsoleColor.Cyan); } } else { MainMenuHelper.WriteText(mapWidth, textStart + 12, 11); } } }