Esempio n. 1
0
        private void HandleRegister(int index, byte[] data)
        {
            PacketBuffer buffer = new PacketBuffer();

            buffer.WriteBytes(data);
            buffer.ReadInteger();
            string username = buffer.ReadString();
            string password = buffer.ReadString();

            if (!Database.instance.AccountExist(username))
            {
                Database.instance.AddAccount(index, username, password);
                Console.WriteLine("Account created.");
                ServerSendData.instance.SendAlertMsg(index, "Account created.");
            }
            else
            {
                Console.WriteLine("Username already exist.");
                ServerSendData.instance.SendAlertMsg(index, "Username already exist.");
            }
        }