private void DoAutoComplete() { String token = CommandBufferText(); if (token.Length > 0) { suggestedCommands.Clear(); commands.GetSuggested(token, suggestedCommands); if (suggestedCommands.Count == 1) { CCommand command = suggestedCommands.First.Value; SetCommandText('\\' + command.name, true); } else if (suggestedCommands.Count > 1) { String suggestedText = GetSuggestedText(token, suggestedCommands); SetCommandText('\\' + suggestedText, false); Print(PROMPT_CMD_STRING + suggestedText); foreach (CCommand cmd in suggestedCommands) { PrintIndent(cmd.name); } } } }
public bool UnregisterCommand(CCommand command) { LinkedList <CCommand> list = FindList(command); for (LinkedListNode <CCommand> node = list.First; node != null; node = node.Next) { if (command == node.Value) { list.Remove(node); return(true); } } return(false); }
private void TryExecuteCommand(String commandString, bool manual) { List <String> args = extractArgs(commandString); if (args.Count > 0) { String name = args[0]; CCommand command = commands.FindCommand(name); if (command != null) { command.console = this; command.args = args; command.manual = manual; if (manual) { Print(PROMPT_CMD_STRING + commandString); } if (args.Count > 1) { command.Execute(); } else { command.Execute(); } } else { Append("Unknown command: '" + name + "'"); } if (manual) { PushHistory(commandString); } } }
private bool AddCommand(LinkedList <CCommand> commandList, CCommand command) { String name = command.name; for (LinkedListNode <CCommand> node = commandList.First; node != null; node = node.Next) { CCommand other = node.Value; if (command == other) { return(false); // no duplicates } String otherName = other.name; if (name.CompareTo(otherName) < 0) { commandList.AddBefore(node, command); return(true); } } commandList.AddLast(command); return(true); }
public bool UnregisterCommands(CCommand[] commands) { for (int i = 0; i < commands.Length; ++i) { UnregisterCommand(commands[i]); } return true; }
public bool UnregisterCommand(CCommand command) { return commands.UnregisterCommand(command); }
public bool RegisterCommand(CCommand command) { return commands.RegisterCommand(command); }
private int CompareCommands(CCommand a, CCommand b) { return a.name.CompareTo(b.name); }
private LinkedList <CCommand> FindList(CCommand command) { return(FindList(command.name)); }
public bool RegisterCommand(CCommand command) { LinkedList <CCommand> commandList = FindList(command); return(AddCommand(commandList, command)); }
private LinkedList<CCommand> FindList(CCommand command) { return FindList(command.name); }
private bool AddCommand(LinkedList<CCommand> commandList, CCommand command) { String name = command.name; for (LinkedListNode<CCommand> node = commandList.First; node != null; node = node.Next) { CCommand other = node.Value; if (command == other) { return false; // no duplicates } String otherName = other.name; if (name.CompareTo(otherName) < 0) { commandList.AddBefore(node, command); return true; } } commandList.AddLast(command); return true; }
public bool UnregisterCommand(CCommand command) { LinkedList<CCommand> list = FindList(command); for (LinkedListNode<CCommand> node = list.First; node != null; node = node.Next) { if (command == node.Value) { list.Remove(node); return true; } } return false; }
public bool RegisterCommand(CCommand command) { LinkedList<CCommand> commandList = FindList(command); return AddCommand(commandList, command); }
public bool RegisterCommand(CCommand command) { return(commands.RegisterCommand(command)); }
public bool UnregisterCommand(CCommand command) { return(commands.UnregisterCommand(command)); }
private int CompareCommands(CCommand a, CCommand b) { return(a.name.CompareTo(b.name)); }