示例#1
0
        private int SendCommandPacket(BattlEyeCommand command, string parameters = "")
        {
            int packetID = _sequenceNumber;

            _sequenceNumber = (_sequenceNumber == 255) ? 0 : _sequenceNumber + 1;

            try
            {
                if (!_socket.Connected)
                {
                    return(256);
                }

                ConstructPacket(BattlEyePacketType.Command, packetID, Helpers.StringValueOf(command) + parameters);

                _packetSent = DateTime.Now;

                _packetQueue.Add(packetID, new[] { Helpers.StringValueOf(command) + parameters, _packetSent.ToString(CultureInfo.InvariantCulture) });
            }
            catch
            {
                return(256);
            }

            return(packetID);
        }
示例#2
0
        public int SendCommand(BattlEyeCommand command, string parameters = "")
        {
            Task.Factory.StartNew(() =>
            {
                MockMessage($"(Global) bot: Sended command {command} with params {parameters}");

                switch (command)
                {
                case BattlEyeCommand.Players:
                    var pl = GetPlayers();
                    MockMessage(pl);
                    break;

                case BattlEyeCommand.Bans:
                    MockMessage(bans);
                    break;

                case BattlEyeCommand.Missions:
                    MockMessage(missions);
                    break;

                case BattlEyeCommand.admins:
                    MockMessage(admins);
                    break;
                }
            });

            return(0);
        }
示例#3
0
        private int SendCommandPacket(BattlEyeCommand command, string parameters = "")
        {
            int packetID = sequenceNumber;

            sequenceNumber = (sequenceNumber == 255) ? 0 : sequenceNumber + 1;

            try
            {
                if (!socket.Connected)
                {
                    return(256);
                }

                byte[] packet = ConstructPacket(BattlEyePacketType.Command, packetID, Helpers.StringValueOf(command) + parameters);

                packetSent = DateTime.Now;

                packetQueue.Add(packetID, new string[] { Helpers.StringValueOf(command) + parameters, packetSent.ToString() });
            }
            catch
            {
                return(256);
            }

            return(packetID);
        }
 public int SendCommand(BattlEyeCommand command, string parameters = "")
 {
     if (_battlEyeServer != null && _battlEyeServer.Connected && _commandPackets.Count < 1000)
     {
         _commandPackets.Enqueue(new CommandPacket(command, parameters));
         _log.Info($"ThreadSafeBattleEyeClient Saving {command} WITH {parameters}");
     }
     return(0);
 }
示例#5
0
文件: RCon.cs 项目: DomiStyle/DaRT
        private int Send(BattlEyeCommand command)
        {
            // Prevent sending packets too fast if necessary
            while ((DateTime.Now - lastsent).TotalMilliseconds <= 10) { Thread.Sleep(10); }

            // Sending command and saving timestamp
            int id = _client.SendCommand(command);
            lastsent = DateTime.Now;

            // Logging sent packet
            if (!_sent.Contains(id))
                _sent.Add(id);
            return id;
        }
示例#6
0
        private int Send(BattlEyeCommand command)
        {
            // Prevent sending packets too fast if necessary
            while ((DateTime.Now - lastsent).TotalMilliseconds <= 10)
            {
                Thread.Sleep(10);
            }

            // Sending command and saving timestamp
            int id = _client.SendCommand(command);

            lastsent = DateTime.Now;

            // Logging sent packet
            if (!_sent.Contains(id))
            {
                _sent.Add(id);
            }
            return(id);
        }
示例#7
0
 public int SendCommand(BattlEyeCommand command, string parameters = "")
 {
     return(SendCommandPacket(command, parameters));
 }
 public CommandPacket(BattlEyeCommand battlEyeCommand, string parameters)
 {
     BattlEyeCommand = battlEyeCommand;
     Parameters      = parameters;
 }
示例#9
0
 public int SendCommand(BattlEyeCommand command, string parameters = "")
 {
     return(_server?.SendCommand(command, parameters) ?? 0);
 }
示例#10
0
 public int SendCommand(BattlEyeCommand command, string parameters = "")
 {
     return SendCommandPacket(command, parameters);
 }
示例#11
0
 public int SendCommand(BattlEyeCommand command, string parameters = "")
 {
     return(_battlEyeClient.SendCommand(command, parameters));
 }
示例#12
0
 public CommandArgs(BattlEyeCommand command, string parameters = "")
 {
     Command    = command;
     Parameters = parameters;
 }
示例#13
0
 public int SendCommand(BattlEyeCommand command, string parameters = "")
 {
     OnCommandRecieved(new CommandArgs(command, parameters));
     return(1);
 }
示例#14
0
文件: RCon.cs 项目: VanderDT/DaRT
 public int Execute(BattlEyeCommand command)
 {
     return(_client.SendCommand(command));
 }
示例#15
0
文件: RCon.cs 项目: VanderDT/DaRT
 public int Execute(BattlEyeCommand command, string param)
 {
     return(_client.SendCommand(command, param));
 }
示例#16
0
 public int SendCommand(BattlEyeCommand command, string parameters = "")
 {
     _battlEyeServer?.SendCommand(command, parameters);
     return(0);
 }
示例#17
0
 public int SendCommand(BattlEyeCommand command, string parameters = "")
 {
     _log.Info($"{_serverName}: Send {command} with {parameters}");
     return(_battlEyeClient.SendCommand(command, parameters));
 }
示例#18
0
        private int SendCommandPacket(BattlEyeCommand command, string parameters = "")
        {
            int packetID = sequenceNumber;

            try
            {
                if (!socket.Connected)
                    return 256;

                byte[] packet = ConstructPacket(BattlEyePacketType.Command, sequenceNumber, Helpers.StringValueOf(command) + parameters);

                packetSent = DateTime.Now;

                packetQueue.Add(sequenceNumber, new string[] {Helpers.StringValueOf(command) + parameters, packetSent.ToString()});

                socket.Send(packet);

                sequenceNumber = (sequenceNumber == 255) ? 0 : sequenceNumber + 1;
            }
            catch
            {
                return 256;
            }

            return packetID;
        }
示例#19
0
        public BattlEyeCommandResult SendCommandPacket(BattlEyeCommand command, string parameters = "")
        {
            try
            {
                if (!socket.Connected)
                    return BattlEyeCommandResult.NotConnected;

                byte[] packet = ConstructPacket(1, packetNumber, Helpers.StringValueOf(command) + parameters);

                socket.Send(packet);

                commandSend = DateTime.Now;

                packetLog.Add(packetNumber, Helpers.StringValueOf(command) + parameters);
                packetNumber++;
            }
            catch
            {
                return BattlEyeCommandResult.Error;
            }

            return BattlEyeCommandResult.Success;
        }