Catch save download errors
This commit is contained in:
parent
4c54381a2e
commit
e7afbe369b
2 changed files with 14 additions and 1 deletions
|
|
@ -82,7 +82,17 @@ namespace LANCommander.SDK
|
|||
client.DownloadProgressChanged += (s, e) => progressHandler(e);
|
||||
client.DownloadFileCompleted += (s, e) => completeHandler(e);
|
||||
|
||||
client.DownloadFileAsync(new Uri($"{ApiClient.BaseUrl}{route}"), tempFile);
|
||||
try
|
||||
{
|
||||
client.DownloadFileTaskAsync(new Uri($"{ApiClient.BaseUrl}{route}"), tempFile).Wait();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (File.Exists(tempFile))
|
||||
File.Delete(tempFile);
|
||||
|
||||
tempFile = String.Empty;
|
||||
}
|
||||
|
||||
return tempFile;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,6 +70,9 @@ namespace LANCommander.SDK
|
|||
OnDownloadComplete?.Invoke(complete);
|
||||
});
|
||||
|
||||
if (String.IsNullOrWhiteSpace(destination))
|
||||
return;
|
||||
|
||||
Logger?.LogTrace("Game save archive downloaded to {SaveTempLocation}", destination);
|
||||
|
||||
tempFile = destination;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue