private void ProcessSet(string[] command) { var isNum = false; var num = 0; if (command.Count() > 1) { if (command.Count() > 2) { switch (command[1]) { case "console": switch (command[2]) { case "theme": if (command.Count() >= 4) { isNum = Int32.TryParse(command[3], out num); if (isNum) { _commandPrompt.SetStyleTheme(num); } else { WriteToConsole( new ConsoleWriteLineEventArgs("Command argument [" + command[3] + "] not a number")); } } else { WriteToConsole( new ConsoleWriteLineEventArgs("Missing command arguments for [" + command[2] + "]:\r" + GetCommandEntry(command[0]))); } break; case "font": if (command.Length >= 4) { var fontFamily = new FontFamily(command[3]); if (fontFamily != null) { _commandPrompt.MessageAreaFont = fontFamily; _commandPrompt.CommandPromptFont = fontFamily; } else { WriteToConsole( new ConsoleWriteLineEventArgs("Invalid font name [" + command[3] + "]")); } } else { WriteToConsole( new ConsoleWriteLineEventArgs("Missing command arguments for [" + command[2] + "]:\r" + GetCommandEntry(command[0]))); } break; case "fontsize": if (command.Length >= 4) { isNum = Int32.TryParse(command[3], out num); if (isNum) { _commandPrompt.MessageAreaFontSize = num; _commandPrompt.CommandPromptFontSize = num; } else { WriteToConsole( new ConsoleWriteLineEventArgs("Command argument [" + command[3] + "] not a number")); } } else { WriteToConsole( new ConsoleWriteLineEventArgs("Missing command arguments for [" + command[2] + "]:\r" + GetCommandEntry(command[0]))); } break; case "height": if (command.Count() >= 4) { isNum = Int32.TryParse(command[3], out num); if (isNum) { _commandPrompt.ConsoleHeight = num; } else { WriteToConsole( new ConsoleWriteLineEventArgs("Command argument [" + command[3] + "] not a number")); } } else { WriteToConsole( new ConsoleWriteLineEventArgs("Missing command arguments for [" + command[2] + "]:\r" + GetCommandEntry(command[0]))); } break; case "width": if (command.Count() >= 4) { isNum = Int32.TryParse(command[3], out num); if (isNum) { _commandPrompt.ConsoleWidth = num; } else { WriteToConsole( new ConsoleWriteLineEventArgs("Command argument [" + command[3] + "] not a number")); } } else { WriteToConsole( new ConsoleWriteLineEventArgs("Missing command arguments for [" + command[2] + "]:\r" + GetCommandEntry(command[0]))); } break; default: WriteToConsole( new ConsoleWriteLineEventArgs("Command argument [" + command[2] + "] not recognized: \r" + GetCommandEntry(command[0]))); break; } break; case "messagearea": case "commandarea": if (command.Length > 3) { switch (command[2]) { case "font": if (command.Length >= 4) { var fontFamily = new FontFamily(command[3]); if (fontFamily != null) { if (command[1] == "messagearea") { _commandPrompt.MessageAreaFont = fontFamily; } else { _commandPrompt.CommandPromptFont = fontFamily; } } else { WriteToConsole( new ConsoleWriteLineEventArgs("Invalid font name [" + command[2] + "]")); } } else { WriteToConsole( new ConsoleWriteLineEventArgs("Missing command arguments for [" + command[2] + "]:\r" + GetCommandEntry(command[0]))); } break; case "fontsize": if (command.Length >= 4) { isNum = Int32.TryParse(command[3], out num); if (isNum) { if (command[1] == "messagearea") { _commandPrompt.MessageAreaFontSize = num; } else { _commandPrompt.CommandPromptFontSize = num; } } else { WriteToConsole( new ConsoleWriteLineEventArgs("Command argument [" + command[3] + "] not a number:")); } } else { WriteToConsole( new ConsoleWriteLineEventArgs("Missing command arguments for [" + command[2] + "]:\r" + GetCommandEntry(command[0]))); } break; case "color": if (command.Length >= 4) { Brush b; b = Utility.StringToBrush(command[3]); if (b != null) { if (command[1] == "messagearea") { _commandPrompt.MessageBackgroundColor = b; } else { _commandPrompt.CommandPromptBackgroundColor = b; } } else { WriteToConsole( new ConsoleWriteLineEventArgs("Command argument [" + command[3] + "] not a valid color")); } } break; default: WriteToConsole( new ConsoleWriteLineEventArgs("Command argument [" + command[2] + "] not recognized: \r" + GetCommandEntry(command[0]))); break; } } else { WriteToConsole( new ConsoleWriteLineEventArgs("Missing command arguments for [" + command[1] + "]:\r" + GetCommandEntry(command[0]))); } break; default: WriteToConsole(new ConsoleWriteLineEventArgs("Command argument [" + command[1] + "] not recognized :\r" + GetCommandEntry(command[0]))); break; } } else { WriteToConsole(new ConsoleWriteLineEventArgs("Missing command arguments for [" + command[1] + "]:\r" + GetCommandEntry(command[0]))); } } else { WriteToConsole(new ConsoleWriteLineEventArgs("Missing command arguments for [" + command[0] + "]:\r" + GetCommandEntry(command[0]))); } }