Deserialize asynchronously in LocalizationService

This commit is contained in:
Bogdan 2023-05-12 17:59:02 +03:00 committed by Mark McDowall
parent f90bef6934
commit 86a7f7bd54
1 changed files with 3 additions and 4 deletions

View File

@ -1,12 +1,12 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text.Json;
using System.Threading.Tasks; using System.Threading.Tasks;
using NLog; using NLog;
using NzbDrone.Common.Cache; using NzbDrone.Common.Cache;
using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
using NzbDrone.Common.Serializer;
using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration;
using NzbDrone.Core.Configuration.Events; using NzbDrone.Core.Configuration.Events;
using NzbDrone.Core.Languages; using NzbDrone.Core.Languages;
@ -152,9 +152,8 @@ namespace NzbDrone.Core.Localization
return; return;
} }
using var fs = File.OpenText(resourcePath); await using var fs = File.OpenRead(resourcePath);
var json = await fs.ReadToEndAsync(); var dict = await JsonSerializer.DeserializeAsync<Dictionary<string, string>>(fs);
var dict = Json.Deserialize<Dictionary<string, string>>(json);
foreach (var key in dict.Keys) foreach (var key in dict.Keys)
{ {