SHARE
TWEET

Untitled

a guest Jun 14th, 2017 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  // login packet maker
  2.         const byte ProtocolVersion = 11;
  3.         private void login() {
  4.             ClientSends.Login userLogin = new ClientSends.Login();
  5.             userLogin.ID = 1;
  6.             userLogin.protocolVersion = 11;
  7.             userLogin.username = userInfo.caseSensitiveName;
  8.             userLogin.password = "Password";
  9.            
  10.             byte[] usernameBytes = Encoding.UTF8.GetBytes(userLogin.username);
  11.             byte[] passwordBytes = Encoding.UTF8.GetBytes(userLogin.username);
  12.  
  13.             byte[] buffer = new byte[9 + usernameBytes.Length + passwordBytes.Length];
  14.  
  15.             buffer[0] = 1;
  16.             buffer[4] = ProtocolVersion;
  17.  
  18.             ClientSends.ToNetOrder( (short)userLogin.username.Length, buffer, 5 );
  19.             Array.Copy( usernameBytes, 0, buffer, 7, usernameBytes.Length );
  20.             ClientSends.ToNetOrder( (short)userLogin.password.Length, buffer, 7 + usernameBytes.Length );
  21.             Array.Copy( passwordBytes, 0, buffer, 9 + usernameBytes.Length, passwordBytes.Length );
  22.         }
  23.  
  24.  
  25.  // add this to ClientSends
  26.             public static void ToNetOrder( short number, byte[] arr, int offset ) {
  27.                 arr[offset] = (byte)((number & 0xff00) >> 8);
  28.                 arr[offset + 1] = (byte)(number & 0x00ff);
  29.             }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top