diff options
| author | David <daullmer@gmail.com> | 2020-12-29 00:35:59 +0100 |
|---|---|---|
| committer | David <daullmer@gmail.com> | 2020-12-29 00:35:59 +0100 |
| commit | 3dec1fd6b23fa4f7f9bc3f66edca8ec0f285ae0f (patch) | |
| tree | 3908e243168eff9334be335dddaf440c47bff1c2 /Emby.Server.Implementations/LiveTv | |
| parent | 8ac1ed16ca6d539cf9061b3c9de139dcf148f401 (diff) | |
Use UTF8 encoding and async correctly
Diffstat (limited to 'Emby.Server.Implementations/LiveTv')
| -rw-r--r-- | Emby.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs index f16d96a59..c80ecd6b3 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs @@ -4,7 +4,9 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; +using System.Text; using System.Text.Json; +using System.Threading.Tasks; using MediaBrowser.Common.Json; using Microsoft.Extensions.Logging; @@ -45,7 +47,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV try { - var jsonString = File.ReadAllText(_dataPath); + var jsonString = File.ReadAllText(_dataPath, Encoding.UTF8); _items = JsonSerializer.Deserialize<T[]>(jsonString, _jsonOptions); return; } @@ -61,8 +63,8 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV private void SaveList() { Directory.CreateDirectory(Path.GetDirectoryName(_dataPath)); - using FileStream stream = File.OpenWrite(_dataPath); - JsonSerializer.SerializeAsync(stream, _items, _jsonOptions); + var jsonString = JsonSerializer.Serialize(_items, _jsonOptions); + File.WriteAllText(_dataPath, jsonString); } public IReadOnlyList<T> GetAll() |
