Added a/sync options to caching

This commit is contained in:
erri120 2019-10-08 18:21:16 +02:00
parent 125cb3c2a9
commit 735f8d6889
No known key found for this signature in database
GPG Key ID: A8C0A18D8D4D3135

View File

@ -398,10 +398,23 @@ namespace Wabbajack
/// <param name="dest">The destination</param>
private void CacheSlide(string url, string dest)
{
bool sync = false;
dispatcher.Invoke(() => {
var file = new FileStream(dest, FileMode.Create, FileAccess.Write);
using (var stream = new HttpClient().GetStreamSync(url))
stream.CopyTo(file);
if (sync)
{
using (var stream = new HttpClient().GetStreamSync(url))
stream.CopyTo(file);
}
else
{
using (var stream = new HttpClient().GetStreamAsync(url))
{
stream.Wait();
stream.Result.CopyTo(file);
}
}
});
}
/// <summary>