public void Admin_Test() { var serverGuid = Guid.NewGuid(); var ev = new FakeEventAggregator(); var logic = new BELogic(ev); BECommand command = null; logic.ServerUpdateHandler += (s, e) => { command = e.Command; }; ev.GetEvent <BEMessageEvent <BEAdminLogMessage> >() .Publish(new BEAdminLogMessage(new LogMessage(), serverGuid)); Assert.IsNotNull(command); Assert.AreEqual(CommandType.Admins, command.CommandType); GC.KeepAlive(logic); }
private void ProcessCommand(BECommand command) { if (command.CommandType == CommandType.RemoveBan || command.CommandType == CommandType.AddBan || command.CommandType == CommandType.Ban) { Task.Delay(2000).ContinueWith(t => _bansUpdater.Update(command.ServerId)); } }
private void Command(BECommand command) { var server = BEServer; if (Info.Id == command.ServerId && server != null && server.Connected) { server.SendCommand(command.CommandType, command.Parameters); } }
private void ProcessCommand(BECommand command) { if (command.CommandType == CommandType.RemoveBan || command.CommandType == CommandType.AddBan || command.CommandType == CommandType.Ban) { Task.Delay(2000).ContinueWith(t => { OnServerUpdateHandler(new BECommand(command.ServerId, CommandType.Bans)); }); } }
private void OnServerImmediateUpdateHandler(BECommand command) { ServerImmediateUpdateHandler?.Invoke(this, new ServerCommandEventArgs(command)); }
public ServerCommandEventArgs(BECommand command) { Command = command; }