Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Knossos.NET/Classes/KnUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ public static string GetCachePath()
string? newEtag = null;
Log.Add(Log.LogSeverity.Information, "KnUtils.GetUrlFileEtag()", "Getting " + url + " etag.");

var result = await KnUtils.GetHttpClient().GetAsync(url, HttpCompletionOption.ResponseHeadersRead);
using var result = await KnUtils.GetHttpClient().GetAsync(url, HttpCompletionOption.ResponseHeadersRead);
newEtag = result.Headers?.ETag?.ToString().Replace("\"", "");
try
{
Expand Down
2 changes: 1 addition & 1 deletion Knossos.NET/Models/GitHubApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static class GitHubApi
{
var client = KnUtils.GetHttpClient();
client.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("product", "1"));
HttpResponseMessage response = await client.GetAsync(Knossos.GitHubUpdateRepoURL + "/releases/latest");
using var response = await client.GetAsync(Knossos.GitHubUpdateRepoURL + "/releases/latest");
var json = await response.Content.ReadAsStringAsync();
return JsonSerializer.Deserialize<GitHubRelease>(json)!;
}
Expand Down
2 changes: 1 addition & 1 deletion Knossos.NET/Models/Nebula.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public static async Task Trinity()
{
try
{
HttpResponseMessage response = await KnUtils.GetHttpClient().GetAsync(ModTagsURL).ConfigureAwait(false);
using var response = await KnUtils.GetHttpClient().GetAsync(ModTagsURL).ConfigureAwait(false);
var json = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
var tagsRepo = JsonSerializer.Deserialize<NebulaModTagJson[]>(json)!;
if (tagsRepo != null)
Expand Down
2 changes: 1 addition & 1 deletion Knossos.NET/ViewModels/CommunityViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public async Task LoadFAQRepo()

try
{
HttpResponseMessage response = await KnUtils.GetHttpClient().GetAsync(Knossos.FAQURL).ConfigureAwait(false);
using var response = await KnUtils.GetHttpClient().GetAsync(Knossos.FAQURL).ConfigureAwait(false);
var json = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
var faqRepo = JsonSerializer.Deserialize<QuestionCategory[]>(json)!;
if(faqRepo != null)
Expand Down
2 changes: 1 addition & 1 deletion Knossos.NET/ViewModels/PxoViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public async void RefreshData()
{
try
{
HttpResponseMessage response = await KnUtils.GetHttpClient().GetAsync("https://pxo.nottheeye.com/api/v1/games/active").ConfigureAwait(false);
using var response = await KnUtils.GetHttpClient().GetAsync("https://pxo.nottheeye.com/api/v1/games/active").ConfigureAwait(false);
var json = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
Dispatcher.UIThread.Invoke(() =>
{
Expand Down
2 changes: 1 addition & 1 deletion Knossos.NET/ViewModels/Templates/DebugFiltersViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public async Task LoadDebugRepo()

try
{
HttpResponseMessage response = await KnUtils.GetHttpClient().GetAsync(Knossos.debugFilterURL).ConfigureAwait(false);
using var response = await KnUtils.GetHttpClient().GetAsync(Knossos.debugFilterURL).ConfigureAwait(false);
var json = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
var debugRepo = JsonSerializer.Deserialize<DebugFilterCategory[]>(json)!;
if(debugRepo != null)
Expand Down
6 changes: 3 additions & 3 deletions Knossos.NET/ViewModels/Templates/DevModDetailsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public DevModScreenshot(string modPath, string path, DevModDetailsViewModel deta
else
{
Task.Run(async () => {
HttpResponseMessage response = await KnUtils.GetHttpClient().GetAsync(path).ConfigureAwait(false);
using var response = await KnUtils.GetHttpClient().GetAsync(path).ConfigureAwait(false);
byte[] content = await response.Content.ReadAsByteArrayAsync().ConfigureAwait(false);
using (Stream stream = new MemoryStream(content))
{
Expand Down Expand Up @@ -322,7 +322,7 @@ private void LoadBannerImage()
{
Task.Run(async () => {

HttpResponseMessage response = await KnUtils.GetHttpClient().GetAsync(TileImagePath).ConfigureAwait(false);
using var response = await KnUtils.GetHttpClient().GetAsync(TileImagePath).ConfigureAwait(false);
byte[] content = await response.Content.ReadAsByteArrayAsync().ConfigureAwait(false);
using (Stream stream = new MemoryStream(content))
{
Expand Down Expand Up @@ -354,7 +354,7 @@ private void LoadTileImage()
else
{
Task.Run( async () => {
HttpResponseMessage response = await KnUtils.GetHttpClient().GetAsync(TileImagePath).ConfigureAwait(false);
using var response = await KnUtils.GetHttpClient().GetAsync(TileImagePath).ConfigureAwait(false);
byte[] content = await response.Content.ReadAsByteArrayAsync().ConfigureAwait(false);
using (Stream stream = new MemoryStream(content))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ private async Task LoadToolRepo()
{
try
{
HttpResponseMessage response = await KnUtils.GetHttpClient().GetAsync(Knossos.ToolRepoURL).ConfigureAwait(false);
using var response = await KnUtils.GetHttpClient().GetAsync(Knossos.ToolRepoURL).ConfigureAwait(false);
var json = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
var toolsRepo = JsonSerializer.Deserialize<Tool[]>(json)!;
if(toolsRepo != null && toolsRepo.Any())
Expand Down