示例#1
0
        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);
        }
示例#2
0
 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));
     }
 }
示例#3
0
            private void Command(BECommand command)
            {
                var server = BEServer;

                if (Info.Id == command.ServerId && server != null && server.Connected)
                {
                    server.SendCommand(command.CommandType, command.Parameters);
                }
            }
示例#4
0
 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));
         });
     }
 }
示例#5
0
 private void OnServerImmediateUpdateHandler(BECommand command)
 {
     ServerImmediateUpdateHandler?.Invoke(this, new ServerCommandEventArgs(command));
 }
示例#6
0
 public ServerCommandEventArgs(BECommand command)
 {
     Command = command;
 }