///-------------------------------------------------------------------------------------------------------- /// static public string GetCommandHelpString() { string result = strings.GetString("명령을 입력하세요.\n\n"); var commands = System.Enum.GetValues(typeof(eCommand)); foreach (eCommand command in commands) { if (command == eCommand.None) { continue; } ICommand inst = CreateCommand(command); if (inst == null) { Logger.Log("Command is null! {0}", command.ToString()); continue; } result += strings.Format("{0}. {1}\n", (int)command, inst.GetCommandName()); result += strings.Format(" - {0}\n\n", inst.GetCommandDesc()); } return(result); }
///-------------------------------------------------------------------------------------------------------- /// static public eCommand ParseCommand(string str) { if (str == null) { return(eCommand.None); } var commands = System.Enum.GetValues(typeof(eCommand)); for (int i = commands.Length - 1; i >= 0; --i) { eCommand command = (eCommand)commands.GetValue(i); if (command == eCommand.None) { continue; } ICommand cmdInst = CreateCommand(command); if (cmdInst == null) { continue; } if (str.StartsWith(((int)command).ToString()) || str.StartsWith(cmdInst.GetCommandName())) { return(command); } } return(eCommand.None); }