From 3a1c722947908c5cef2c124a1688a21c89cf6d6e Mon Sep 17 00:00:00 2001 From: yell0wsuit <5692900+yell0wsuit@users.noreply.github.com> Date: Wed, 17 Apr 2024 16:50:57 +0700 Subject: [PATCH] Fixed IDE1006 --- src/Ryujinx/Modules/Updater/Updater.cs | 2 +- .../Modules/Updater/Utils/DoUpdateWithMultipleThreads.cs | 2 +- src/Ryujinx/Modules/Updater/Utils/DoUpdateWithSingleThread.cs | 4 ++-- src/Ryujinx/Modules/Updater/Utils/SendAsyncWithHeaders.cs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Ryujinx/Modules/Updater/Updater.cs b/src/Ryujinx/Modules/Updater/Updater.cs index bb4402fcd..1ecde83c5 100644 --- a/src/Ryujinx/Modules/Updater/Updater.cs +++ b/src/Ryujinx/Modules/Updater/Updater.cs @@ -12,7 +12,7 @@ namespace Ryujinx.Modules { private const string GitHubApiUrl = "https://api.github.com"; - private static readonly HttpClient httpClient = new HttpClient + private static readonly HttpClient _httpClient = new HttpClient { DefaultRequestHeaders = { diff --git a/src/Ryujinx/Modules/Updater/Utils/DoUpdateWithMultipleThreads.cs b/src/Ryujinx/Modules/Updater/Utils/DoUpdateWithMultipleThreads.cs index 58d0a0923..054d775cd 100644 --- a/src/Ryujinx/Modules/Updater/Utils/DoUpdateWithMultipleThreads.cs +++ b/src/Ryujinx/Modules/Updater/Utils/DoUpdateWithMultipleThreads.cs @@ -99,7 +99,7 @@ namespace Ryujinx.Modules using var request = new HttpRequestMessage(HttpMethod.Get, url); request.Headers.Range = new RangeHeaderValue(start, end); - HttpResponseMessage response = await httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead).ConfigureAwait(false); + HttpResponseMessage response = await _httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead).ConfigureAwait(false); using var stream = await response.Content.ReadAsStreamAsync(); using var memoryStream = new MemoryStream(); diff --git a/src/Ryujinx/Modules/Updater/Utils/DoUpdateWithSingleThread.cs b/src/Ryujinx/Modules/Updater/Utils/DoUpdateWithSingleThread.cs index 24121c5dc..5c54e16d7 100644 --- a/src/Ryujinx/Modules/Updater/Utils/DoUpdateWithSingleThread.cs +++ b/src/Ryujinx/Modules/Updater/Utils/DoUpdateWithSingleThread.cs @@ -21,9 +21,9 @@ namespace Ryujinx.Modules private static async Task DoUpdateWithSingleThreadWorker(TaskDialog taskDialog, string downloadUrl, string updateFile) { // We do not want to timeout while downloading - httpClient.Timeout = TimeSpan.FromDays(1); + _httpClient.Timeout = TimeSpan.FromDays(1); - HttpResponseMessage response = await httpClient.GetAsync(downloadUrl, HttpCompletionOption.ResponseHeadersRead); + HttpResponseMessage response = await _httpClient.GetAsync(downloadUrl, HttpCompletionOption.ResponseHeadersRead); if (!response.IsSuccessStatusCode) { Logger.Error?.Print(LogClass.Application, $"Failed to download file: {response.ReasonPhrase}"); diff --git a/src/Ryujinx/Modules/Updater/Utils/SendAsyncWithHeaders.cs b/src/Ryujinx/Modules/Updater/Utils/SendAsyncWithHeaders.cs index ba2554a8b..7228be23a 100644 --- a/src/Ryujinx/Modules/Updater/Utils/SendAsyncWithHeaders.cs +++ b/src/Ryujinx/Modules/Updater/Utils/SendAsyncWithHeaders.cs @@ -14,7 +14,7 @@ namespace Ryujinx.Modules { request.Headers.Range = range; } - return await httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead); + return await _httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead); } } }