Merge pull request #7093 from ilaborde/fix-5355

This commit is contained in:
Cody Robibero 2022-01-03 17:16:04 -07:00 committed by GitHub
commit e51777fe4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -83,8 +83,7 @@ namespace Emby.Dlna
{ {
lock (_profiles) lock (_profiles)
{ {
var list = _profiles.Values.ToList(); return _profiles.Values
return list
.OrderBy(i => i.Item1.Info.Type == DeviceProfileType.User ? 0 : 1) .OrderBy(i => i.Item1.Info.Type == DeviceProfileType.User ? 0 : 1)
.ThenBy(i => i.Item1.Info.Name) .ThenBy(i => i.Item1.Info.Name)
.Select(i => i.Item2) .Select(i => i.Item2)
@ -226,11 +225,8 @@ namespace Emby.Dlna
{ {
try try
{ {
var xmlFies = _fileSystem.GetFilePaths(path) return _fileSystem.GetFilePaths(path)
.Where(i => string.Equals(Path.GetExtension(i), ".xml", StringComparison.OrdinalIgnoreCase)) .Where(i => string.Equals(Path.GetExtension(i), ".xml", StringComparison.OrdinalIgnoreCase))
.ToList();
return xmlFies
.Select(i => ParseProfileFile(i, type)) .Select(i => ParseProfileFile(i, type))
.Where(i => i != null) .Where(i => i != null)
.ToList()!; // We just filtered out all the nulls .ToList()!; // We just filtered out all the nulls
@ -252,11 +248,8 @@ namespace Emby.Dlna
try try
{ {
DeviceProfile profile;
var tempProfile = (DeviceProfile)_xmlSerializer.DeserializeFromFile(typeof(DeviceProfile), path); var tempProfile = (DeviceProfile)_xmlSerializer.DeserializeFromFile(typeof(DeviceProfile), path);
var profile = ReserializeProfile(tempProfile);
profile = ReserializeProfile(tempProfile);
profile.Id = path.ToLowerInvariant().GetMD5().ToString("N", CultureInfo.InvariantCulture); profile.Id = path.ToLowerInvariant().GetMD5().ToString("N", CultureInfo.InvariantCulture);
@ -295,8 +288,7 @@ namespace Emby.Dlna
{ {
lock (_profiles) lock (_profiles)
{ {
var list = _profiles.Values.ToList(); return _profiles.Values
return list
.Select(i => i.Item1) .Select(i => i.Item1)
.OrderBy(i => i.Info.Type == DeviceProfileType.User ? 0 : 1) .OrderBy(i => i.Info.Type == DeviceProfileType.User ? 0 : 1)
.ThenBy(i => i.Info.Name); .ThenBy(i => i.Info.Name);