Advertisement
Guest User

Untitled

a guest
Apr 10th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. public unsafe class Authentication : Interfaces.IPacket
  2. {
  3. public string Password, Username, Server, MacAddress;
  4. public Authentication()
  5. {
  6. }
  7. public byte[] ToArray()
  8. {
  9. throw new NotImplementedException();
  10. }
  11. public void Deserialize(byte[] buffer)
  12. {
  13. if (buffer.Length == 312)
  14. {
  15. ushort length = BitConverter.ToUInt16(buffer, 0);
  16. if (length == 312)
  17. {
  18. ushort type = BitConverter.ToUInt16(buffer, 2);
  19. byte[] temp = new byte[16];
  20. if (type == 1542)
  21. {
  22. MemoryStream MS = new MemoryStream(buffer);
  23. BinaryReader BR = new BinaryReader(MS);
  24. BR.ReadUInt16();
  25. BR.ReadUInt16();
  26. BR.ReadUInt32();
  27. Username = Encoding.Default.GetString(BR.ReadBytes(64)).Replace("\0", "");
  28. byte[] PasswordArray = BR.ReadBytes(64);
  29. Password = Encoding.Default.GetString(PasswordArray).Replace("\0", "");
  30. Server = Encoding.Default.GetString(BR.ReadBytes(16)).Replace("\0", "");
  31. MacAddress = Encoding.Default.GetString(BR.ReadBytes(12)).Replace("\0", "");
  32. BR.Close();
  33. MS.Close();
  34. }
  35. }
  36. }
  37. }
  38. public void Send(Client.GameClient client)
  39. {
  40. throw new NotImplementedException();
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement