BattleNET.BattlEyeClient.SendCommandPacket C# (CSharp) Method

SendCommandPacket() private method

private SendCommandPacket ( BattlEyeCommand command, string parameters = "" ) : int
command BattlEyeCommand
parameters string
return int
        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;
        }

Same methods

BattlEyeClient::SendCommandPacket ( string command, bool log = true ) : int

Usage Example

コード例 #1
0
ファイル: rcon_reloadbans.cs プロジェクト: st4l/pyBEscanner
        private static void Main(string[] args)
        {
            BattlEyeLoginCredentials loginCredentials = new BattlEyeLoginCredentials();
            #region
            loginCredentials.Host = args[0];
            loginCredentials.Port = Convert.ToInt32(args[1]);
            loginCredentials.Password = args[2];
            #endregion

            IBattleNET b = new BattlEyeClient(loginCredentials);
            b.MessageReceivedEvent += DumpMessage;
            b.DisconnectEvent += Disconnected;
            b.ReconnectOnPacketLoss(true);
            b.Connect();

            if (b.IsConnected() == false)
            {
                Console.WriteLine("Couldnt connect to server");
                Console.WriteLine("Failed to reload bans");
                return;
            }

            b.SendCommandPacket(EBattlEyeCommand.loadBans);
            Thread.Sleep(1000); // wait 1 second  for no reason...
            b.Disconnect();
        }
All Usage Examples Of BattleNET.BattlEyeClient::SendCommandPacket