public void Execute(Query query) { if (PrintExecutedCommand) { OnMessage.Invoke(new Message(EMessageType.Execution, query.RawQuery)); } AConsoleCommand command = FindCommand(query.Name.Value); if (command == null) { OnMessage.Invoke(new Message(EMessageType.Error, Localization.Get(ELocKey.LogicCommandNotFound, query.Name.Value))); return; } CommandMethod method = command.Method; if (MapQuery(method, query) && ParseQueryValues(query)) { if (Locked && command.ObeyLock) { OnMessage.Invoke(new Message(EMessageType.Warning, Localization.Get(ELocKey.LogicConsoleLocked))); return; } object[] parsed = query.GetParsedValues(); Message result = command.Execute(parsed); if (result != null) { OnMessage.Invoke(result); } } }
private IEnumerator ProcessNextQuery() { Query query = m_CurrentQueries.Pop(); if (PrintExecutedCommand && !query.IsOption) { OnMessage.Invoke(new Message(EMessageType.Execution, query.RawQuery)); } AConsoleCommand command = FindCommand(query.Name.Value); if (command == null) { OnMessage.Invoke(new Message(EMessageType.Error, Localization.Get(ELocKey.LogicCommandNotFound, query.Name.Value))); return(null); } CommandMethod method = command.Method; if (MapQuery(method, query) && ParseQueryValues(query)) { if (Locked && command.ObeyLock) { OnMessage.Invoke(new Message(EMessageType.Warning, Localization.Get(ELocKey.LogicConsoleLocked))); return(null); } object[] parsed = query.GetParsedValues(); object result = command.Execute(parsed); m_CurrentEnumerator = result as IEnumerator; if (m_CurrentEnumerator != null) { return(m_CurrentEnumerator); } Message message = result as Message; if (message != null) { OnMessage.Invoke(message); } } return(null); }