Remove custom Json serializer from Dlna

This commit is contained in:
David 2020-12-23 13:12:06 +01:00
parent e09d3ba9ef
commit bc0976ceac

View File

@ -7,12 +7,14 @@ using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.Json;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Emby.Dlna.Profiles;
using Emby.Dlna.Server;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Json;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Dlna;
using MediaBrowser.Controller.Drawing;
@ -32,7 +34,6 @@ namespace Emby.Dlna
private readonly IXmlSerializer _xmlSerializer;
private readonly IFileSystem _fileSystem;
private readonly ILogger<DlnaManager> _logger;
private readonly IJsonSerializer _jsonSerializer;
private readonly IServerApplicationHost _appHost;
private static readonly Assembly _assembly = typeof(DlnaManager).Assembly;
@ -43,14 +44,12 @@ namespace Emby.Dlna
IFileSystem fileSystem,
IApplicationPaths appPaths,
ILoggerFactory loggerFactory,
IJsonSerializer jsonSerializer,
IServerApplicationHost appHost)
{
_xmlSerializer = xmlSerializer;
_fileSystem = fileSystem;
_appPaths = appPaths;
_logger = loggerFactory.CreateLogger<DlnaManager>();
_jsonSerializer = jsonSerializer;
_appHost = appHost;
}
@ -495,9 +494,9 @@ namespace Emby.Dlna
return profile;
}
var json = _jsonSerializer.SerializeToString(profile);
var json = JsonSerializer.Serialize(profile, JsonDefaults.GetOptions());
return _jsonSerializer.DeserializeFromString<DeviceProfile>(json);
return JsonSerializer.Deserialize<DeviceProfile>(json, options: JsonDefaults.GetOptions());
}
public string GetServerDescriptionXml(IHeaderDictionary headers, string serverUuId, string serverAddress)