static MenuState ShowKey() { Refresh("Section {0} > Key {1}", currentSection, currentKey); Type valueType = currentKey.GetValueType(); if (UseColor) { Console.ForegroundColor = ConsoleColor.White; } Console.Write(" Value Type: "); if (UseColor) { Console.ResetColor(); } if (valueType.IsEnum) { Console.WriteLine("{0} (enumeration)", valueType.Name); } else if (valueType == typeof(int)) { Console.WriteLine("Integer"); } else if (valueType == typeof(bool)) { Console.WriteLine("{0} (true/false)", valueType.Name); } else { Console.WriteLine(valueType.Name); } if (UseColor) { Console.ForegroundColor = ConsoleColor.White; } Console.WriteLine(" Description:"); if (UseColor) { Console.ResetColor(); } string[] newlineSeparator = new[] { "\r\n" }; string[] descriptionLines = currentKey.GetDescription().Split(newlineSeparator, StringSplitOptions.RemoveEmptyEntries); foreach (string line in descriptionLines) { Console.WriteLine(" " + line); } if (UseColor) { Console.ForegroundColor = ConsoleColor.White; } Console.Write(" Default value: "); PrintKeyValue(currentKey.GetDefault().ToString()); if (UseColor) { Console.ForegroundColor = ConsoleColor.White; } Console.Write(" Current value: "); PrintKeyValue(currentKey.GetRawString()); if (valueType.IsEnum) { if (UseColor) { Console.ForegroundColor = ConsoleColor.White; } Console.Write(" Choices: "); if (UseColor) { Console.ResetColor(); } Console.WriteLine(Enum.GetNames(valueType).JoinToString()); } else if (currentKey.IsColor()) { PrintColorList(); } Console.WriteLine(); TextMenu menu = new TextMenu(); TextOption optionBack = menu.AddOption("B", "Back to " + currentSection); TextOption optionChange = menu.AddOption("C", "Change value"); TextOption optionDefaults = menu.AddOption("D", "Use default"); TextOption choice = menu.Show(); if (choice == optionBack) { return(MenuState.KeyList); } else if (choice == optionChange) { while (true) { try { Console.Write("Enter new value for {0}: ", currentKey); currentKey.SetValue(Console.ReadLine()); break; } catch (FormatException ex) { WriteWarning(ex.Message); } } } else if (choice == optionDefaults) { currentKey.SetValue(currentKey.GetDefault()); } return(MenuState.Key); }