예제 #1
0
        public async Task Prepare()
        {
            if (!_prepared)
            {
                await _lock.WaitAsync();

                try
                {
                    // Could have become prepared while we waited for the lock
                    if (!_prepared)
                    {
                        _client = await NexusApiClient.Get();

                        _status = await _client.GetUserStatus();

                        if (!_client.IsAuthenticated)
                        {
                            Utils.ErrorThrow(new UnconvertedError(
                                                 $"Authenticating for the Nexus failed. A nexus account is required to automatically download mods."));
                            return;
                        }
                    }
                }
                finally
                {
                    _lock.Release();
                }
            }

            _prepared = true;

            if (_status.is_premium)
            {
                return;
            }
            Utils.ErrorThrow(new UnconvertedError($"Automated installs with Wabbajack requires a premium nexus account. {await _client.Username()} is not a premium account."));
        }