public override ChainedCommand And(Command command) { command.ThrowIfNull("command"); AddCommand(command); return this; }
public RetryCommand(Command command, TimeSpan retryDelay, int maximumAttempts = MaximumAttempts.Infinite) { command.ThrowIfNull("command"); _command = command; Delay(retryDelay); Times(maximumAttempts); }
public RepeatCommand(Command command, TimeSpan repeatDelay, int totalRepeats = TotalRepeats.Infinite) { command.ThrowIfNull("command"); _command = command; Delay(repeatDelay); Times(totalRepeats); }
protected override CommandResult OnExecute(CommandContext context) { _command = _commandDelegate(context); return _command.Execute(context); }
public RepeatCommand(Command command, int totalRepeats = TotalRepeats.Infinite) : this(command, TimeSpan.Zero, totalRepeats) { }
public RetryCommand(Command command, double retryDelayInSeconds, int maximumAttempts = MaximumAttempts.Infinite) : this(command, TimeSpan.FromSeconds(retryDelayInSeconds), maximumAttempts) { }
public void ExecuteCommand(Command command) { command.ThrowIfNull("command"); _worldObserver.CommandExecuting(command); CommandResult result = command.Execute(_context); bool wasDeferred = result == CommandResult.Deferred; if (wasDeferred) { _commandList.Add(command, _worldInstance.WorldTime.Total); } else { _worldObserver.CommandExecuted(command, result); } }
public void EnqueueCommandToExecuteAtTime(Command command, TimeSpan totalWorldTime, Action<CommandResult> commandExecutedDelegate = null) { command.ThrowIfNull("command"); _commandList.Add(command, totalWorldTime, commandExecutedDelegate); }
public void CancelCommand(Command command) { command.ThrowIfNull("command"); _commandList.Remove(command); }
private static void SetPaused(Command command, bool paused) { command._paused = paused; foreach (Command nestedCommand in command.NestedCommands) { SetPaused(nestedCommand, paused); } }
public static RetryCommand Retry(Command command, double retryDelayInSeconds, int maximumAttempts = MaximumAttempts.Infinite) { return new RetryCommand(command, retryDelayInSeconds, maximumAttempts); }
public static RetryCommand Retry(Command command, int maximumAttempts = MaximumAttempts.Infinite) { return new RetryCommand(command, maximumAttempts); }
public static RepeatCommand Repeat(Command command, TimeSpan repeatDelay, int totalRepeats = TotalRepeats.Infinite) { return new RepeatCommand(command, repeatDelay, totalRepeats); }
public static RepeatCommand Repeat(Command command, double repeatDelayInSeconds, int totalRepeats = TotalRepeats.Infinite) { return new RepeatCommand(command, repeatDelayInSeconds, totalRepeats); }
public static RepeatCommand Repeat(Command command, int totalRepeats = TotalRepeats.Infinite) { return new RepeatCommand(command, totalRepeats); }
public RepeatCommand(Command command, double repeatDelayInSeconds, int totalRepeats = TotalRepeats.Infinite) : this(command, TimeSpan.FromSeconds(repeatDelayInSeconds), totalRepeats) { }
public void CommandExecuted(Command command, CommandResult result) { command.ThrowIfNull("command"); _logRendererState.EnqueueCommandExecutedLogEntry(_worldTime.Total, command, result); }
public static RetryCommand Retry(Command command, TimeSpan retryDelay, int maximumAttempts = MaximumAttempts.Infinite) { return new RetryCommand(command, retryDelay, maximumAttempts); }
public void CommandExecuting(Command command) { command.ThrowIfNull("command"); }
public static Command Tagged(Command command, Guid tag) { command.ThrowIfNull("command"); return command.WithTag(tag); }
public virtual ChainedCommand And(Command command) { var chainedCommand = new ChainedCommand(this); chainedCommand.And(this); return chainedCommand; }
public static ChainedCommand Chain(Command command) { return new ChainedCommand(command); }
public bool CommandQueued(Command command) { command.ThrowIfNull("command"); return _commandList.Contains(command); }
public ChainedCommand(Command command) { command.ThrowIfNull("command"); AddCommand(command); }
public void EnqueueCommandWithExecutionDelay(Command command, TimeSpan executionDelay, Action<CommandResult> commandExecutedDelegate = null) { command.ThrowIfNull("command"); _commandList.Add(command, _worldInstance.WorldTime.Total + executionDelay, commandExecutedDelegate); }
public bool Contains(Command command) { command.ThrowIfNull("command"); return _commands.Any(arg => arg.Command == command); }
public RetryCommand(Command command, int maximumAttempts = MaximumAttempts.Infinite) : this(command, TimeSpan.Zero, maximumAttempts) { }
private void AddCommand(Command command) { _originalCommands.Add(command); }
public void Add(Command command, TimeSpan executeAtTime, Action<CommandResult> commandExecutedDelegate = null) { command.ThrowIfNull("command"); _commands.Add(new CommandListEntry(command, executeAtTime, commandExecutedDelegate)); }
public void Remove(Command command) { command.ThrowIfNull("command"); _commands.RemoveAll(arg => arg.Command == command); foreach (Command nestedCommand in command.NestedCommands) { Remove(nestedCommand); } }