From 86a7f7bd54aa733b0e3abd3ec9463a85dd348118 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Fri, 12 May 2023 17:59:02 +0300 Subject: [PATCH] Deserialize asynchronously in LocalizationService --- src/NzbDrone.Core/Localization/LocalizationService.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/NzbDrone.Core/Localization/LocalizationService.cs b/src/NzbDrone.Core/Localization/LocalizationService.cs index aa184e6dd..8633ea45c 100644 --- a/src/NzbDrone.Core/Localization/LocalizationService.cs +++ b/src/NzbDrone.Core/Localization/LocalizationService.cs @@ -1,12 +1,12 @@ using System; using System.Collections.Generic; using System.IO; +using System.Text.Json; using System.Threading.Tasks; using NLog; using NzbDrone.Common.Cache; using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.Extensions; -using NzbDrone.Common.Serializer; using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration.Events; using NzbDrone.Core.Languages; @@ -152,9 +152,8 @@ namespace NzbDrone.Core.Localization return; } - using var fs = File.OpenText(resourcePath); - var json = await fs.ReadToEndAsync(); - var dict = Json.Deserialize>(json); + await using var fs = File.OpenRead(resourcePath); + var dict = await JsonSerializer.DeserializeAsync>(fs); foreach (var key in dict.Keys) {