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()); 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); var alternatives = await ClientAPI.GetModUpgrades(a.Hash);
if (alternatives == default) if (alternatives == default)

View File

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