2021-12-26 21:56:44 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Threading.Tasks;
|
2021-12-26 22:05:28 +00:00
|
|
|
|
using Wabbajack.DTOs.DownloadStates;
|
2021-12-26 21:56:44 +00:00
|
|
|
|
|
2021-12-30 00:15:37 +00:00
|
|
|
|
namespace Wabbajack
|
2021-12-26 21:56:44 +00:00
|
|
|
|
{
|
|
|
|
|
public class ManuallyDownloadNexusFile : AUserIntervention
|
|
|
|
|
{
|
2021-12-26 22:05:28 +00:00
|
|
|
|
public Nexus State { get; }
|
2021-12-26 21:56:44 +00:00
|
|
|
|
public override string ShortDescription { get; } = string.Empty;
|
|
|
|
|
public override string ExtendedDescription { get; } = string.Empty;
|
|
|
|
|
|
|
|
|
|
private TaskCompletionSource<Uri> _tcs = new TaskCompletionSource<Uri>();
|
|
|
|
|
public Task<Uri> Task => _tcs.Task;
|
|
|
|
|
|
2021-12-26 22:05:28 +00:00
|
|
|
|
private ManuallyDownloadNexusFile(Nexus state)
|
2021-12-26 21:56:44 +00:00
|
|
|
|
{
|
|
|
|
|
State = state;
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-26 22:05:28 +00:00
|
|
|
|
public static async Task<ManuallyDownloadNexusFile> Create(Nexus state)
|
2021-12-26 21:56:44 +00:00
|
|
|
|
{
|
|
|
|
|
var result = new ManuallyDownloadNexusFile(state);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
public override void Cancel()
|
|
|
|
|
{
|
|
|
|
|
_tcs.SetCanceled();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Resume(Uri s)
|
|
|
|
|
{
|
|
|
|
|
_tcs.SetResult(s);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|