Ask the server for known upgrades as a last resource (for all downloads)

This commit is contained in:
Timothy Baldridge 2020-09-10 07:07:25 -06:00
parent d79531fb8e
commit d953fa9179
2 changed files with 8 additions and 5 deletions

View File

@ -101,7 +101,7 @@ namespace Wabbajack.Lib.Downloaders
return string.Join("\n", GetMetaIni());
}
public async Task<(Archive? Archive, TempFile NewFile)> ServerFindUpgrade(Archive a)
public static async Task<(Archive? Archive, TempFile NewFile)> ServerFindUpgrade(Archive a)
{
var alternatives = await ClientAPI.GetModUpgrades(a.Hash);
if (alternatives == default)

View File

@ -126,10 +126,13 @@ namespace Wabbajack.Lib.Downloaders
var result = await FindUpgrade(archive);
if (result == default)
{
Utils.Log(
$"No solution for broken download {archive.Name} {archive.State.PrimaryKeyString} could be found");
return DownloadResult.Failure;
result = await AbstractDownloadState.ServerFindUpgrade(archive);
if (result == default)
{
Utils.Log(
$"No solution for broken download {archive.Name} {archive.State.PrimaryKeyString} could be found");
return DownloadResult.Failure;
}
}
Utils.Log($"Looking for patch for {archive.Name} ({(long)archive.Hash} {archive.Hash.ToHex()} -> {(long)result.Archive!.Hash} {result.Archive!.Hash.ToHex()})");