mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Add prompt to ManualDownloader state
This commit is contained in:
parent
9d251cda83
commit
c79decf0b2
@ -28,7 +28,8 @@ namespace Wabbajack.Lib.Downloaders
|
||||
public async Task<AbstractDownloadState?> GetDownloaderState(dynamic archiveINI, bool quickMode)
|
||||
{
|
||||
var url = archiveINI?.General?.manualURL;
|
||||
return url != null ? new State(url) : null;
|
||||
var prompt = archiveINI?.General?.prompt;
|
||||
return url != null ? new State(url, prompt ?? "") : null;
|
||||
}
|
||||
|
||||
public async Task Prepare()
|
||||
@ -39,13 +40,15 @@ namespace Wabbajack.Lib.Downloaders
|
||||
public class State : AbstractDownloadState
|
||||
{
|
||||
public string Url { get; }
|
||||
public string Prompt { get; }
|
||||
|
||||
[JsonIgnore]
|
||||
public override object[] PrimaryKey => new object[] { Url };
|
||||
|
||||
public State(string url)
|
||||
public State(string url, string prompt)
|
||||
{
|
||||
Url = url;
|
||||
Prompt = prompt;
|
||||
}
|
||||
|
||||
public override bool IsWhitelisted(ServerWhitelist whitelist)
|
||||
@ -89,6 +92,7 @@ namespace Wabbajack.Lib.Downloaders
|
||||
{
|
||||
"[General]",
|
||||
$"manualURL={Url}",
|
||||
$"prompt={Prompt}"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -158,7 +158,13 @@ namespace Wabbajack
|
||||
private async Task HandleManualDownload(WebBrowserVM vm, CancellationTokenSource cancel, ManuallyDownloadFile manuallyDownloadFile)
|
||||
{
|
||||
var browser = new CefSharpWrapper(vm.Browser);
|
||||
vm.Instructions = $"Please locate and download {manuallyDownloadFile.State.Url}";
|
||||
var prompt = manuallyDownloadFile.State.Prompt;
|
||||
if (string.IsNullOrWhiteSpace(prompt))
|
||||
{
|
||||
prompt = $"Please locate and download {manuallyDownloadFile.State.Url}";
|
||||
}
|
||||
|
||||
vm.Instructions = prompt;
|
||||
|
||||
var result = new TaskCompletionSource<Uri>();
|
||||
|
||||
@ -209,7 +215,13 @@ namespace Wabbajack
|
||||
private async Task HandleManualMegaDownload(WebBrowserVM vm, CancellationTokenSource cancel, ManuallyDownloadMegaFile manuallyDownloadFile)
|
||||
{
|
||||
var browser = new CefSharpWrapper(vm.Browser);
|
||||
vm.Instructions = $"Please locate and download {manuallyDownloadFile.State.Url}";
|
||||
var prompt = manuallyDownloadFile.State.Prompt;
|
||||
if (string.IsNullOrWhiteSpace(prompt))
|
||||
{
|
||||
prompt = $"Please locate and download {manuallyDownloadFile.State.Url}";
|
||||
}
|
||||
|
||||
vm.Instructions = prompt;
|
||||
|
||||
await vm.Driver.WaitForInitialized();
|
||||
var tcs = new TaskCompletionSource();
|
||||
|
Loading…
Reference in New Issue
Block a user