public static bool SendString(TcpClient client, string command)
        {
            /*
             * byte[] b = Encoding.Unicode.GetBytes(command);
             * client.GetStream().Write(b, 0, b.Length);
             * client.GetStream().Flush();
             */

            if (client != null && client.Connected)
            {
                try
                {
                    StreamWriter wr = new StreamWriter(client.GetStream(), Encoding.Unicode);
                    wr.WriteLine(AESEncrypt.EncryptToString(command));
                    wr.Flush();
                    return(true);
                }
                catch (Exception e)
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
        public static NetCommand ReadNetCommand(TcpClient client)
        {
            /*
             * byte[] bytesFrom = new byte[(int) client.ReceiveBufferSize];
             * client.GetStream().Read(bytesFrom, 0, (int)client.ReceiveBufferSize);
             * string response = Encoding.Unicode.GetString(bytesFrom);
             * NetCommand net = NetCommand.Parse(response);
             * return net;
             */

            string     str;
            NetCommand net;

            str = ReadString(client);

            if (str != "")
            {
                try
                {
                    str = AESEncrypt.DecryptString(str);
                }
                catch (Exception e)
                {
                    str = "";
                    net = new NetCommand(NetCommand.CommandType.ERROR, 0);
                }
                try {
                    net = NetCommand.Parse(str);
                }
                catch (Exception e)
                {
                    net = new NetCommand(NetCommand.CommandType.ERROR, 0);
                }
            }
            else
            {
                net = new NetCommand(NetCommand.CommandType.ERROR, 0);
            }
            return(net);
        }