aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Channels/ChannelManager.cs
diff options
context:
space:
mode:
authorDavid <daullmer@gmail.com>2020-12-24 10:31:51 +0100
committerDavid <daullmer@gmail.com>2020-12-24 10:31:51 +0100
commite835dfb27d4a25e2057047692fd58af439b15acc (patch)
tree68a346bbdfde7e4537b93f05895d63755813f3aa /Emby.Server.Implementations/Channels/ChannelManager.cs
parenta714008b596b108a44020f61ca384b30263df984 (diff)
Use sync string instead of file
Diffstat (limited to 'Emby.Server.Implementations/Channels/ChannelManager.cs')
-rw-r--r--Emby.Server.Implementations/Channels/ChannelManager.cs5
1 files changed, 3 insertions, 2 deletions
diff --git a/Emby.Server.Implementations/Channels/ChannelManager.cs b/Emby.Server.Implementations/Channels/ChannelManager.cs
index 3663e5094..f06ad4436 100644
--- a/Emby.Server.Implementations/Channels/ChannelManager.cs
+++ b/Emby.Server.Implementations/Channels/ChannelManager.cs
@@ -340,8 +340,8 @@ namespace Emby.Server.Implementations.Channels
try
{
- using FileStream jsonStream = File.OpenRead(path);
- return JsonSerializer.DeserializeAsync<List<MediaSourceInfo>>(jsonStream, JsonDefaults.GetOptions()).GetAwaiter().GetResult()
+ var jsonString = File.ReadAllText(path);
+ return JsonSerializer.Deserialize<List<MediaSourceInfo>>(jsonString, JsonDefaults.GetOptions())
?? new List<MediaSourceInfo>();
}
catch
@@ -368,6 +368,7 @@ namespace Emby.Server.Implementations.Channels
}
Directory.CreateDirectory(Path.GetDirectoryName(path));
+
await using FileStream createStream = File.Create(path);
await JsonSerializer.SerializeAsync(createStream, mediaSources, JsonDefaults.GetOptions()).ConfigureAwait(false);
}