/// <summary> /// Remove command by using specific condition. /// </summary> /// <param name="condition"></param> public void RemoveCommand(Func <TerminalMessage, bool> condition) { var command = CommandsQueue.FirstOrDefault(condition); if (command != null) { CommandsQueue.Remove(command); } }
/// <summary> /// Remove command from cache. /// </summary> /// <param name="commandSequence"></param> /// <param name="commandIndex"></param> public void RemoveCommand(string commandSequence, string commandIndex) { var command = CommandsQueue.FirstOrDefault( x => x.CommandSequence.Equals(commandSequence, StringComparison.InvariantCultureIgnoreCase) && x.CommandIndex.Equals(commandIndex, StringComparison.InvariantCultureIgnoreCase)); if (command != null) { CommandsQueue.Remove(command); } }
/// <summary> /// Find command in queue. /// </summary> /// <param name="commandSeq"></param> /// <param name="commandIndex"></param> /// <returns></returns> public TerminalMessage FindCommandInQueue(string commandSeq, string commandIndex) { return(CommandsQueue.FirstOrDefault(x => x.CommandSequence == commandSeq && x.CommandIndex == commandIndex)); }