Example #1
0
        public void Prepare()
        {
            var client = new NexusApiClient();
            var status = client.GetUserStatus();

            if (!client.IsAuthenticated)
            {
                Utils.Error($"Authenticating for the Nexus failed. A nexus account is required to automatically download mods.");
                return;
            }

            if (!status.is_premium)
            {
                Utils.Error($"Automated installs with Wabbajack requires a premium nexus account. {client.Username} is not a premium account.");
                return;
            }
        }
Example #2
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."));
        }
Example #3
0
        public async Task Prepare()
        {
            if (!_prepared)
            {
                using var _ = await _lock.Wait();

                // 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;
                    }


                    if (!await _client.IsPremium())
                    {
                        var result = await Utils.Log(new YesNoIntervention(
                                                         "Wabbajack can operate without a premium account, but downloads will be slower and the install process will require more user interactions (you will have to start each download by hand). Are you sure you wish to continue?",
                                                         "Continue without Premium?")).Task;

                        if (result == ConfirmationIntervention.Choice.Abort)
                        {
                            Utils.ErrorThrow(new UnconvertedError($"Aborting at the request of the user"));
                        }
                        _prepared = true;
                    }
                }
            }
        }