Merge pull request #946 from wabbajack-tools/dont-hash-while-downloading

Don't hash modlists while attempting to download them
This commit is contained in:
Timothy Baldridge 2020-07-04 08:42:32 -07:00 committed by GitHub
commit b58ef4f3e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,6 +52,9 @@ namespace Wabbajack
[Reactive]
public bool IsBroken { get; private set; }
[Reactive]
public bool IsDownloading { get; private set; }
[Reactive]
public string DownloadSizeText { get; private set; }
@ -148,7 +151,7 @@ namespace Wabbajack
{
try
{
return !(await metadata.NeedsDownload(Location));
return !IsDownloading && !(await metadata.NeedsDownload(Location));
}
catch (Exception)
{
@ -182,9 +185,14 @@ namespace Wabbajack
{
try
{
IsDownloading = true;
Utils.Log($"Starting Download of {Metadata.Links.MachineURL}");
var downloader = DownloadDispatcher.ResolveArchive(Metadata.Links.Download);
var result = await downloader.Download(new Archive(state: null!) { Name = Metadata.Title, Size = Metadata.DownloadMetadata?.Size ?? 0 }, Location);
var result = await downloader.Download(
new Archive(state: null!)
{
Name = Metadata.Title, Size = Metadata.DownloadMetadata?.Size ?? 0
}, Location);
Utils.Log($"Done downloading {Metadata.Links.MachineURL}");
// Want to rehash to current file, even if failed?
@ -194,9 +202,13 @@ namespace Wabbajack
}
catch (Exception ex)
{
Utils.Error(ex,$"Error Downloading of {Metadata.Links.MachineURL}");
Utils.Error(ex, $"Error Downloading of {Metadata.Links.MachineURL}");
tcs.SetException(ex);
}
finally
{
IsDownloading = false;
}
});