예제 #1
0
 public void Login()
 {
     TS2Packet packet = new TS2Packet();
     packet.Create(TS2.CONNECTION, TS2.LOGIN, 0x00000000, 0x00000000, SequenceNumber++);
     packet.Login(txtNickname.Text, txtUsername.Text, (string.IsNullOrEmpty(txtPassword.Text) ? txtServerPassword.Text : txtPassword.Text), txtPlatform.Text, txtOS.Text);
     net.Send(packet.toByteArray(), Target);
 }
예제 #2
0
 public void Register()
 {
     TS2Packet packet = new TS2Packet();
     packet.Create(TS2.STANDARD, TS2.REGISTER, this.SessionKey, this.ClientID, this.SequenceNumber);
     packet.Register(txtUsername.Text, txtPassword.Text);
     net.Send(packet.toByteArray(), Target);
 }
예제 #3
0
 public void AckHandler( uint SequenceNumber )
 {
     TS2Packet packet = new TS2Packet();
     packet.Create(TS2.ACK, 0x0000, SessionKey, RealClientID, SequenceNumber);
     packet.Raw(new byte[] { 0x00 });
     net.Send(packet.toByteArray(), Target);
 }
예제 #4
0
 public void Ban(uint cid, string message)
 {
     /* f0be4501577a75005b0000000200000000000000f8bd354f54000000000011596572206120747572642c20647564652e060000000d000000b870b602 */
     /*  */
     TS2Packet packet = new TS2Packet();
     packet.Create(TS2.STANDARD, TS2.BANPLAYER, this.SessionKey, this.ClientID, this.SequenceNumber);
     packet.Raw(packet.combine(BitConverter.GetBytes(cid), new byte[] { 0x00, 0x00, (byte)message.Length }, packet.Pad(message, 29)));
     net.Send(packet.toByteArray(), Target);
 }
예제 #5
0
        public void Disconnect()
        {
            TS2Packet packet = new TS2Packet();
            packet.Create(TS2.STANDARD, TS2.DISCONNECT, this.SessionKey, this.ClientID, this.SequenceNumber);
            packet.Raw(new byte[] { });
            net.Send(packet.toByteArray(), Target);

            disconnectPending = true;
            dcSequenceNumber = this.SequenceNumber;
        }
예제 #6
0
 public void ServerAdmin(uint cid, bool give)
 {
     /* f0be3301a54c3d003f00000002000000000000005f718a7e0e0000000000 */
     /* f0be3301ce8f36003f000000020000000000000006ef023b0e0000000000 */
     /* f0be3301ffe32500450000000200000000000000630e5b4c0e0000000200 */
     TS2Packet packet = new TS2Packet();
     ushort action = give ? (ushort)0x0000 : (ushort)0x0002;
     packet.Create(TS2.STANDARD, TS2.GIVESA, this.SessionKey, this.ClientID, this.SequenceNumber);
     packet.Raw(packet.combine(BitConverter.GetBytes(cid), BitConverter.GetBytes(action)));
     net.Send(packet.toByteArray(), Target);
 }
예제 #7
0
 public void Ping(uint SequenceNumber)
 {
     TS2Packet packet = new TS2Packet();
     packet.Create(TS2.CONNECTION, TS2.PING, RealSessionKey, RealClientID, PingSequenceNumber++);
     packet.Raw(new byte[] {});
     try
     {
         net.Send(packet.toByteArray(), Target);
     }
     catch (ObjectDisposedException ex)
     {
         net.Dispose();
         Console.WriteLine(ex.Message + "\r\n" + ex.StackTrace);
         init();
     }
 }
예제 #8
0
 public void JoinServer()
 {
     TS2Packet packet = new TS2Packet();
     packet.Create(TS2.STANDARD, TS2.LOGIN2, SessionKey, ClientID, SequenceNumber);
     packet.Raw(
         new byte[] {
             0x01, 0x00, 0x00, 0x00, 0xf4, 0x3b, 0x46, 0x75, 0x3b, 0x6d, 0x92, 0x8a, 0x7c, 0xf8, 
             0x18, 0x00, 0xb4, 0xc4, 0x48, 0x00, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 
             0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
             0x00, 0x00, 0x00, 0x00, 0xe0, 0x5e, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7c, 0xf8, 
             0x18, 0x00, 0xb4, 0xc4, 0x48, 0x00, 0x7c, 0xf8, 0x18, 0x00, 0xb4, 0xc4, 0x48, 0x00, 
             0xfc, 0x9a, 0xb6, 0x02, 0xa6, 0x9f, 0x92, 0xd6, 0x00, 0x00, 0x00, 0x00
         }
     );
     net.Send(packet.toByteArray(), Target);
     Console.WriteLine("Sent LOGIN2");
 }
예제 #9
0
        public void SendMessage(uint target, string message, int opt)
        {
            TS2Packet packet = new TS2Packet();
            packet.Create(TS2.STANDARD, TS2.MSGPLAYER, this.SessionKey, this.ClientID, this.SequenceNumber);

            switch (opt)
            {
                case 2: /* player */
                    packet.Raw(packet.combine(new byte[] { 0x00, 0x00, 0x00, 0x00, 0x02 }, BitConverter.GetBytes(target), packet.Pad(message, message.Length + 1)));
                    break;
                case 1: /* channel */
                    packet.Raw(packet.combine(new byte[] { 0x00, 0x00, 0x00, 0x00, 0x01 }, BitConverter.GetBytes(target), packet.Pad(message, message.Length + 1)));
                    break;
                case 0: /* server */
                    packet.Raw(packet.combine(new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, packet.Pad(message, message.Length + 1)));
                    break;
            }

            net.Send(packet.toByteArray(), Target);
        }