mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-18 14:23:51 +02:00
Proxy settings
This commit is contained in:
@@ -8,11 +8,10 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace VRCX
|
||||
{
|
||||
class ImageCache
|
||||
internal static class ImageCache
|
||||
{
|
||||
private static readonly string cacheLocation = Path.Combine(Program.AppDataDirectory, "ImageCache");
|
||||
private static readonly HttpClientHandler httpClientHandler = new HttpClientHandler(){ Proxy = WebApi.Proxy };
|
||||
private static readonly HttpClient httpClient = new HttpClient(httpClientHandler);
|
||||
private static readonly string cacheLocation;
|
||||
private static readonly HttpClient httpClient;
|
||||
private static readonly List<string> _imageHosts =
|
||||
[
|
||||
"api.vrchat.cloud",
|
||||
@@ -21,6 +20,16 @@ namespace VRCX
|
||||
"assets.vrchat.com"
|
||||
];
|
||||
|
||||
static ImageCache()
|
||||
{
|
||||
cacheLocation = Path.Combine(Program.AppDataDirectory, "ImageCache");
|
||||
var httpClientHandler = new HttpClientHandler();
|
||||
if (WebApi.ProxySet)
|
||||
httpClientHandler.Proxy = WebApi.Proxy;
|
||||
|
||||
httpClient = new HttpClient(httpClientHandler);
|
||||
}
|
||||
|
||||
public static async Task<string> GetImage(string url, string fileId, string version)
|
||||
{
|
||||
var directoryLocation = Path.Combine(cacheLocation, fileId);
|
||||
@@ -74,9 +83,9 @@ namespace VRCX
|
||||
|
||||
private static void CleanImageCache()
|
||||
{
|
||||
DirectoryInfo dirInfo = new DirectoryInfo(cacheLocation);
|
||||
var dirInfo = new DirectoryInfo(cacheLocation);
|
||||
var folders = dirInfo.GetDirectories().OrderByDescending(p => p.LastWriteTime).Skip(1000);
|
||||
foreach (DirectoryInfo folder in folders)
|
||||
foreach (var folder in folders)
|
||||
{
|
||||
folder.Delete(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user