Пример #1
0
        private void HandleSuccessfulRedirect(ServerInfo info)
        {
            SendPacket(new HandoffToQueuePacket
            {
                OneTimeKey = OneTimeKey,
                ServerId   = info.ServerId,
                AccountId  = AccountEntry.Id
            });

            using var unitOfWork = _authUnitOfWorkFactory.Create();
            unitOfWork.AuthAccountRepository.UpdateLastServer(AccountEntry.Id, info.ServerId);
            unitOfWork.Complete();

            Logger.WriteLog(LogType.Network, $"Account ({AccountEntry.Username}, {AccountEntry.Id}) was redirected to the queue of the server: {info.ServerId}!");
        }
Пример #2
0
        private void ProcessCreateCommand(string[] parts)
        {
            if (parts.Length < 4)
            {
                Logger.WriteLog(LogType.Command, "Invalid create account command! Usage: create <email> <username> <password>");
                return;
            }

            var email    = parts[1];
            var userName = parts[2];
            var password = parts[3];

            try
            {
                using var unitOfWork = _authUnitOfWorkFactory.Create();
                unitOfWork.AuthAccountRepository.Create(email, userName, password);
                unitOfWork.Complete();

                Logger.WriteLog(LogType.Command, $"Created account: {parts[2]}! (Password: {parts[3]})");
            }
            catch
            {
                Logger.WriteLog(LogType.Error, "Username or email is already taken!");
            }
        }