public async Task <IActionResult> ReplayAllEvents(CancellationToken token) { var command = new ReplayCommand(); await mediator.Send(command, token); return(Ok()); }
public void RecordCommand(ReplayCommand cmd) { if (!Replay.Commands.Contains(cmd) && Replay.Commands.Count < 500) { Replay.Commands.Add(cmd); } }
private void ExecuteCommand(ReplayCommand command) { if (conn.State != System.Data.ConnectionState.Open) { conn.Open(); } try { if (!String.IsNullOrEmpty(command.Database)) { logger.Trace(String.Format("Changing database to {0}", command.Database)); conn.ChangeDatabase(command.Database); } SqlCommand cmd = new SqlCommand(command.CommandText); cmd.Connection = conn; cmd.ExecuteNonQuery(); logger.Trace(String.Format("SUCCES - {0}", command.CommandText)); } catch (SqlException e) { if (StopOnError) { logger.Error(String.Format("Error: {0}", command.CommandText)); throw; } else { logger.Warn(String.Format("Error: {0}", command.CommandText)); logger.Warn(String.Format("Error: {0}", e.Message)); logger.Trace(e); } } }
public void replayGame() { // On a finit de jouer toutes les actions sauvegardées if (replay.CommandList.Count == iteReplay) { MessageBox.Show("Toutes les actions ont été jouées !", "Replay terminé"); return; } ReplayCommand rc = replay.CommandList[iteReplay]; // if(rc) rc.replay(); updateUnit(); updateSelectedUnit(); RaisePropertyChanged("ToursRestants"); RaisePropertyChanged("PvP1"); RaisePropertyChanged("PvP2"); RaisePropertyChanged("CurrentPlayerName"); RaisePropertyChanged("NbUnitsCurrentPlayer"); iteReplay++; if (engine.IsGameCompleted) { p.NavigationService.Navigate(new EndGame()); } }
// // Write a object instance to data output stream // public override void LooseMarshal(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut) { ReplayCommand info = (ReplayCommand)o; base.LooseMarshal(wireFormat, o, dataOut); dataOut.Write(info.FirstNakNumber); dataOut.Write(info.LastNakNumber); }
// // Write the booleans that this object uses to a BooleanStream // public override int TightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) { ReplayCommand info = (ReplayCommand)o; int rc = base.TightMarshal1(wireFormat, info, bs); return(rc + 8); }
// // Un-marshal an object instance from the data input stream // public override void LooseUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn) { base.LooseUnmarshal(wireFormat, o, dataIn); ReplayCommand info = (ReplayCommand)o; info.FirstNakNumber = dataIn.ReadInt32(); info.LastNakNumber = dataIn.ReadInt32(); }
// // Un-marshal an object instance from the data input stream // public override void TightUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn, BooleanStream bs) { base.TightUnmarshal(wireFormat, o, dataIn, bs); ReplayCommand info = (ReplayCommand)o; info.FirstNakNumber = dataIn.ReadInt32(); info.LastNakNumber = dataIn.ReadInt32(); }
// // Write a object instance to data output stream // public override void TightMarshal2(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut, BooleanStream bs) { base.TightMarshal2(wireFormat, o, dataOut, bs); ReplayCommand info = (ReplayCommand)o; dataOut.Write(info.FirstNakNumber); dataOut.Write(info.LastNakNumber); }
public LoginVM(LoginModel _loginModel, GameModel _GameM) { GameM = _GameM; LoginM = _loginModel; CPayment(); PayClient(); LoginCommand = new ReplayCommand(Login); ReturnCommand = new ReplayCommand(Return); PaymentCommand = new ReplayCommand(Payment); }
void Start() { //Bind keys with commands buttonB = new DoNothing(); buttonW = new MoveForward(); buttonS = new MoveReverse(); buttonA = new MoveLeft(); buttonD = new MoveRight(); buttonZ = new UndoCommand(); buttonR = new ReplayCommand(); boxStartPos = boxTrans.position; }
private async Task <string> PerformReplay(ReplayCommand replayCommand) { var range = replayCommand.PartitionRange; var allCommands = await _fileHandler.GetFile(); var toReplay = allCommands .Where(CommandFacts.CanReplay) .OfType <KeyCommand>() .Where(c => range.Contains(c.Key.GetDeterministicHashCode())); _storage.Clear(); foreach (var command in toReplay) { await RequestAsync(command); } Console.WriteLine("================================"); Console.WriteLine(PerformGetAll(new GetAllCommand())); Console.WriteLine("================================"); return("Replay ok"); }
public GameVM(GameModel _gameM, LoginModel _loginM, InfoView _InfoV) { GameM = _gameM; LoginM = _loginM; InfoV = _InfoV; InfoVi = _InfoV; //GetWinActive(); AddCordCommand = new ReplayCommand(StartAddCord); AutoBuffCommand = new ReplayCommand(StartBuffSkill); RemoveAllCommand = new ReplayCommand(ItemRemoveAll); LeftRightCommand = new ReplayCommand(ButtonMouse); FastClickCommand = new ReplayCommand(StartFastClick); SaveCommand = new ReplayCommand(StartSave); OpenCommand = new ReplayCommand(StartOpen); GetIDCommand = new ReplayCommand(StartGetIdSKill); StartAttack2Command = new ReplayCommand(StartSkill2); AutoCommand = new ReplayCommand(StartAuto); AutoTrainCommand = new ReplayCommand(StartAutoTrain); BlockCordCommand = new ReplayCommand(StartGetRange); }
public void Run() { if (conn == null) { InitializeConnection(); } while (!stopped) { if (Commands.Count == 0) { Thread.Sleep(10); continue; } ReplayCommand cmd = null; if (Commands.TryDequeue(out cmd)) { ExecuteCommand(cmd); } Thread.Sleep(ReplayIntervalSeconds * 1000); } }
private void Replay() { lock (eventsTable) { foreach (DataRow dr in eventsTable.Rows) { string commandText = null; if (dr["name"].ToString() == "rpc_completed") { commandText = dr["statement"].ToString(); } else if (dr["name"].ToString() == "sql_batch_completed") { commandText = dr["batch_text"].ToString(); } else { //ignore events not suitable for replay logger.Debug(String.Format("Skipping event {0}", dr["name"].ToString())); continue; } ReplayCommand command = new ReplayCommand() { CommandText = commandText }; if (dr.Table.Columns.Contains("database_name") && !String.IsNullOrEmpty((string)dr["database_name"])) { string dbname = dr["database_name"].ToString(); command.Database = dbname; } int session_id = -1; if (dr.Table.Columns.Contains("session_id")) { session_id = Convert.ToInt32(dr["session_id"]); } else { throw new Exception("Unable to replay if session_id is not collected. Please add this action to your session."); } ReplayWorker rw = null; if (ReplayWorkers.TryGetValue(session_id, out rw)) { rw.AppendCommand(command); } else { rw = new ReplayWorker() { ServerName = ServerName, UserName = UserName, Password = Password, DatabaseName = DatabaseName, ReplayIntervalSeconds = ReplayIntervalSeconds, StopOnError = StopOnError, Name = session_id.ToString() }; ReplayWorkers.TryAdd(session_id, rw); rw.Start(); rw.AppendCommand(command); logger.Info(String.Format("Started new Replay Worker for session_id {0}", session_id)); } } eventsTable.Rows.Clear(); } }
public virtual Response processReplayCommand(ReplayCommand replayCommand) { return(null); }
public void AppendCommand(ReplayCommand cmd) { Commands.Enqueue(cmd); }