fix: use WebClient instead of HttpClient

This commit is contained in:
goat 2020-08-08 12:39:02 +02:00
parent 73aea2d67c
commit 3f2be06abb

View file

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Net;
using System.Net.Http; using System.Net.Http;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -27,7 +28,7 @@ namespace Dalamud.Interface
}; };
public static async Task EnsureAssets(string baseDir) { public static async Task EnsureAssets(string baseDir) {
using var client = new HttpClient(); using var client = new WebClient();
Log.Verbose("Starting asset download"); Log.Verbose("Starting asset download");
@ -39,7 +40,7 @@ namespace Dalamud.Interface
if (!File.Exists(filePath)) { if (!File.Exists(filePath)) {
Log.Verbose("Downloading {0} to {1}...", entry.Key, entry.Value); Log.Verbose("Downloading {0} to {1}...", entry.Key, entry.Value);
try { try {
File.WriteAllBytes(filePath, await client.GetByteArrayAsync(entry.Key)); File.WriteAllBytes(filePath, client.DownloadData(entry.Key));
} catch (Exception ex) { } catch (Exception ex) {
// If another game is running, we don't want to just fail in here // If another game is running, we don't want to just fail in here
Log.Error(ex, "Could not download asset."); Log.Error(ex, "Could not download asset.");