mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Merge remote-tracking branch 'origin/fix-downloader-issues' into pre-release
This commit is contained in:
commit
40ccbe761c
@ -45,6 +45,7 @@ namespace Wabbajack
|
||||
|
||||
Closed += (s, e) =>
|
||||
{
|
||||
_logger.LogInformation("Beginning shutdown...");
|
||||
_mwvm.CancelRunningTasks(TimeSpan.FromSeconds(10));
|
||||
Application.Current.Shutdown();
|
||||
};
|
||||
|
@ -18,7 +18,11 @@ public static class HttpExtensions
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36";
|
||||
public static HttpRequestMessage AddCookies(this HttpRequestMessage msg, Cookie[] cookies)
|
||||
{
|
||||
msg.Headers.Add("Cookie", string.Join(";", cookies.Select(c => $"{c.Name}={c.Value}")));
|
||||
if (cookies.Length > 0)
|
||||
{
|
||||
msg.Headers.Add("Cookie", string.Join(";", cookies.Select(c => $"{c.Name}={c.Value}")));
|
||||
}
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
@ -166,8 +166,17 @@ internal class ResumableDownloader
|
||||
return null;
|
||||
}
|
||||
|
||||
var packageJson = _packagePath.ReadAllText();
|
||||
return JsonSerializer.Deserialize<DownloadPackage>(packageJson);
|
||||
try
|
||||
{
|
||||
var packageJson = _packagePath.ReadAllText();
|
||||
return JsonSerializer.Deserialize<DownloadPackage>(packageJson);
|
||||
}
|
||||
catch (JsonException ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "Package for '{name}' couldn't be parsed. Deleting package and starting from scratch...", _outputPath.FileName.ToString());
|
||||
DeletePackage();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void SavePackage(DownloadPackage package)
|
||||
|
Loading…
Reference in New Issue
Block a user