public byte[] Return() { try { BeginSend.WriteH(opcode); BeginSend.WriteH((short)Calculator.INST().GetNextSessionSeed()); BeginSend.WriteB(send.stream.ToArray()); byte[] data = Dados.Encrypt(BeginSend.stream.ToArray(), player.Encrypt); // Encrypt receive.WriteH((ushort)(data.Length - 2 | 32768)); //0x8000 receive.WriteB(data); new Action(() => Program.Form1.WriteSender($"{GetType().Name}", Color.White)).Invoke(); return(receive.stream.ToArray()); } catch (Exception ex) { new _Message().Error(ex.ToString()); return(null); } finally { receive.Close(); BeginSend.Close(); send.Close(); } }
public byte[] ArrayBytes() { send.WriteC((byte)new Random().Next(0, 255)); BeginSend.WriteH((short)new Random().Next(0, 50000)); BeginSend.WriteH(0); BeginSend.WriteB(send.stream.ToArray()); byte[] data = Dados.Encrypt(BeginSend.stream.ToArray(), 2); // Encrypt receive.WriteH((ushort)(data.Length - 2 | 32768)); //0x8000 receive.WriteB(data); return(receive.stream.ToArray()); }