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); }
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); }
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); }
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; }
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); }
public int SendCommand(BattlEyeCommand command, string parameters = "") { return(SendCommandPacket(command, parameters)); }
public CommandPacket(BattlEyeCommand battlEyeCommand, string parameters) { BattlEyeCommand = battlEyeCommand; Parameters = parameters; }
public int SendCommand(BattlEyeCommand command, string parameters = "") { return(_server?.SendCommand(command, parameters) ?? 0); }
public int SendCommand(BattlEyeCommand command, string parameters = "") { return SendCommandPacket(command, parameters); }
public int SendCommand(BattlEyeCommand command, string parameters = "") { return(_battlEyeClient.SendCommand(command, parameters)); }
public CommandArgs(BattlEyeCommand command, string parameters = "") { Command = command; Parameters = parameters; }
public int SendCommand(BattlEyeCommand command, string parameters = "") { OnCommandRecieved(new CommandArgs(command, parameters)); return(1); }
public int Execute(BattlEyeCommand command) { return(_client.SendCommand(command)); }
public int Execute(BattlEyeCommand command, string param) { return(_client.SendCommand(command, param)); }
public int SendCommand(BattlEyeCommand command, string parameters = "") { _battlEyeServer?.SendCommand(command, parameters); return(0); }
public int SendCommand(BattlEyeCommand command, string parameters = "") { _log.Info($"{_serverName}: Send {command} with {parameters}"); return(_battlEyeClient.SendCommand(command, parameters)); }
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; }
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; }