Advertisement
Guest User

Authentication.cs

a guest
Sep 10th, 2017
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.85 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.Text;
  4. using MrSnyZer.Network.Cryptography;
  5.  
  6. namespace MrSnyZer.Network.AuthPackets
  7. {
  8.     public class Authentication : Interfaces.IPacket
  9.     {
  10.         public string Username;
  11.         public string Password;
  12.         public string Server;
  13.  
  14.  
  15.         public Authentication()
  16.         {
  17.         }
  18.         public void Deserialize(byte[] buffer)
  19.         {
  20.             if (buffer.Length == 312)
  21.             {
  22.                 ushort length = BitConverter.ToUInt16(buffer, 0);
  23.  
  24.                 if (length == 312)
  25.                 {
  26.  
  27.                     ushort type = BitConverter.ToUInt16(buffer, 2);
  28.                     byte[] temp = new byte[16];
  29.                     if (type == 1542)
  30.                     {
  31.                         MemoryStream MS = new MemoryStream(buffer);
  32.                         BinaryReader BR = new BinaryReader(MS);
  33.                         BR.ReadUInt16();
  34.                         BR.ReadUInt16();
  35.                         Username = Encoding.Default.GetString(BR.ReadBytes(32));
  36.                         Username = Username.Replace("\0", "");
  37.                         BR.ReadBytes(36);
  38.                         Password = Encoding.Default.GetString(BR.ReadBytes(32));
  39.                         Password = Password.Replace("\0", "");
  40.                         BR.ReadBytes(32);
  41.                         Server = Encoding.Default.GetString(BR.ReadBytes(32));
  42.                         Server = Server.Replace("\0", "");
  43.                         BR.Close();
  44.                         MS.Close();
  45.                     }
  46.                 }
  47.             }
  48.         }
  49.  
  50.         public byte[] ToArray()
  51.         {
  52.             throw new NotImplementedException();
  53.         }
  54.         public void Send(Client.GameClient client)
  55.         {
  56.             throw new NotImplementedException();
  57.         }
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement