public List<Byte> capsulize(List<byte> data, BnetPacketModel bnetCommand)
 {
     List<Byte> capsule = new List<Byte>();
     capsule.Add(0xFF);
     capsule.Add((byte)bnetCommand);
     capsule.Add((byte)((data.Count + 4) & 0x00FF));
     capsule.Add((byte)(((data.Count + 4) & 0xFF00) >> 8));
     capsule.AddRange(data);
     return capsule;
 }
        public void send(Socket bnetSock, BnetPacketModel bnetCommand = 0x00)
        {
            if(bnetData.Count <= 0 || (bnetData.Count > 0 && bnetData[0] != 0xFF))
            {
                bnetData = this.capsulize(bnetData, bnetCommand);
            }

            try {
                bnetSock.Send(bnetData.ToArray());
            }
            catch (SocketException e)
            {
                BnetClient.OnConnectError();
            }
            catch(ObjectDisposedException e)
            {
                BnetClient.OnConnectError();
            }
            bnetData.Clear();
        }