// CopyULobbyAccounts
    public static IEnumerator CopyULobbyAccounts()
    {
        var emailToIdBucket = new Bucket("uLobby AccountNameToID");

        var request = emailToIdBucket.GetKeys();

        yield return(request.WaitUntilDone());

        if (request.hasFailed)
        {
            yield break;
        }

        foreach (var email in request.GetKeyEnumerable())
        {
            emailToIdBucket.Get(email, Constants.Replication.Default, (req) => {
                var accountId = req.GetValue <string>();
                LogManager.General.Log("Copying account '" + req.key + "' with ID '" + accountId + "'");
                GameDB.instance.StartCoroutine(
                    CreateAccount(
                        accountId,
                        req.key,
                        GameDB.GetRandomString(10)
                        )
                    );
            }, null);
        }
    }
Exemple #2
0
    // GetNewAccountIDCoroutine
    IEnumerator IAccountOperations.GetNewAccountIDCoroutine(Request <AccountID> request)
    {
        for (int i = 0; i < _MaxAccountIDGenerationAttempts; ++i)
        {
            AccountID randomID = new AccountID(GameDB.GetRandomString(_AccountIDLengthInBytes));

            Request <bool> accountExistsRequest = uLobby.AccountManager.Master.AccountExists(randomID);
            yield return(accountExistsRequest.WaitUntilDone()); if (StorageLayerUtility.RequestUtility.PropagateException(accountExistsRequest, request))
            {
                yield break;
            }

            if (!accountExistsRequest.result)
            {
                Log.Debug(LogFlags.Account, "Generated new account ID ", randomID.value, " after ", Quantify(i + 1, "attempt"));

                StorageLayerUtility.RequestUtility.SetResult(request, randomID);

                yield break;
            }
        }

        StorageLayerUtility.RequestUtility.ThrowException(request, StorageLayerUtility.Exceptions.CreateAccountException("Failed to generate account ID after " + _MaxAccountIDGenerationAttempts + " attempts"));
    }