2019-12-07 00:13:16 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
2019-12-09 00:19:36 +00:00
|
|
|
|
using Wabbajack.Common;
|
2019-12-07 00:13:16 +00:00
|
|
|
|
|
|
|
|
|
namespace Wabbajack.Lib.NexusApi
|
|
|
|
|
{
|
2019-12-09 00:19:36 +00:00
|
|
|
|
public class RequestNexusAuthorization : AUserIntervention
|
2019-12-07 00:13:16 +00:00
|
|
|
|
{
|
|
|
|
|
public override string ShortDescription => "Getting User's Nexus API Key";
|
2020-04-10 01:29:53 +00:00
|
|
|
|
public override string ExtendedDescription { get; } = string.Empty;
|
2019-12-07 00:13:16 +00:00
|
|
|
|
|
|
|
|
|
private readonly TaskCompletionSource<string> _source = new TaskCompletionSource<string>();
|
|
|
|
|
public Task<string> Task => _source.Task;
|
|
|
|
|
|
|
|
|
|
public void Resume(string apikey)
|
|
|
|
|
{
|
2019-12-09 00:19:36 +00:00
|
|
|
|
Handled = true;
|
2019-12-07 00:13:16 +00:00
|
|
|
|
_source.SetResult(apikey);
|
|
|
|
|
}
|
2019-12-09 00:19:36 +00:00
|
|
|
|
|
|
|
|
|
public override void Cancel()
|
2019-12-07 00:13:16 +00:00
|
|
|
|
{
|
2019-12-09 00:19:36 +00:00
|
|
|
|
Handled = true;
|
2020-01-05 01:33:00 +00:00
|
|
|
|
_source.TrySetCanceled();
|
2019-12-07 00:13:16 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|