mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-13 20:24:16 +01:00
fix: use WebClient instead of HttpClient
This commit is contained in:
parent
73aea2d67c
commit
3f2be06abb
1 changed files with 3 additions and 2 deletions
|
|
@ -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.");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue