From ed9021f40b19dddc3029bf263c337a9d3fb0ab2c Mon Sep 17 00:00:00 2001 From: BaronGreenback Date: Mon, 7 Sep 2020 21:43:48 +0100 Subject: [PATCH 1/4] Update PlayToManager.cs --- Emby.Dlna/PlayTo/PlayToManager.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Emby.Dlna/PlayTo/PlayToManager.cs b/Emby.Dlna/PlayTo/PlayToManager.cs index 3d1dd3e73f..9b242c2c4e 100644 --- a/Emby.Dlna/PlayTo/PlayToManager.cs +++ b/Emby.Dlna/PlayTo/PlayToManager.cs @@ -130,20 +130,20 @@ namespace Emby.Dlna.PlayTo } } - private string GetUuid(string usn) + private static string GetUuid(string usn) { var found = false; var index = usn.IndexOf("uuid:", StringComparison.OrdinalIgnoreCase); if (index != -1) { - usn = usn.Substring(index); + usn = usn.Substring(index + 5); found = true; } index = usn.IndexOf("::", StringComparison.OrdinalIgnoreCase); if (index != -1) { - usn = usn.Substring(0, index); + usn = usn.Substring(0, index + 2); } if (found) From 544db8cc064f445ff58cd6f43610940164cb84fa Mon Sep 17 00:00:00 2001 From: BaronGreenback Date: Tue, 8 Sep 2020 07:53:53 +0100 Subject: [PATCH 2/4] Update PlayToManager.cs made code more readable. --- Emby.Dlna/PlayTo/PlayToManager.cs | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/Emby.Dlna/PlayTo/PlayToManager.cs b/Emby.Dlna/PlayTo/PlayToManager.cs index 9b242c2c4e..182836c2bb 100644 --- a/Emby.Dlna/PlayTo/PlayToManager.cs +++ b/Emby.Dlna/PlayTo/PlayToManager.cs @@ -132,23 +132,19 @@ namespace Emby.Dlna.PlayTo private static string GetUuid(string usn) { - var found = false; - var index = usn.IndexOf("uuid:", StringComparison.OrdinalIgnoreCase); + const string uuidStr ="uuid:"; + const string uuidColonStr = "::"; + + var index = usn.IndexOf(uuidStr, StringComparison.OrdinalIgnoreCase); if (index != -1) { - usn = usn.Substring(index + 5); - found = true; + return usn.Substring(index + uuidStr.Length); } - index = usn.IndexOf("::", StringComparison.OrdinalIgnoreCase); + index = usn.IndexOf(uuidColonStr, StringComparison.OrdinalIgnoreCase); if (index != -1) { - usn = usn.Substring(0, index + 2); - } - - if (found) - { - return usn; + usn = usn.Substring(0, index + uuidColonStr.Length); } return usn.GetMD5().ToString("N", CultureInfo.InvariantCulture); From fde5afc36b29211811dd59cd4fa6ebdb594a4792 Mon Sep 17 00:00:00 2001 From: BaronGreenback Date: Tue, 8 Sep 2020 09:26:52 +0100 Subject: [PATCH 3/4] Update PlayToManager.cs removed tab --- Emby.Dlna/PlayTo/PlayToManager.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Emby.Dlna/PlayTo/PlayToManager.cs b/Emby.Dlna/PlayTo/PlayToManager.cs index 182836c2bb..46e0ce38a2 100644 --- a/Emby.Dlna/PlayTo/PlayToManager.cs +++ b/Emby.Dlna/PlayTo/PlayToManager.cs @@ -132,9 +132,9 @@ namespace Emby.Dlna.PlayTo private static string GetUuid(string usn) { - const string uuidStr ="uuid:"; + const string uuidStr = "uuid:"; const string uuidColonStr = "::"; - + var index = usn.IndexOf(uuidStr, StringComparison.OrdinalIgnoreCase); if (index != -1) { From c84aabe9544546faf0466a88fdd297c9768ad483 Mon Sep 17 00:00:00 2001 From: BaronGreenback Date: Tue, 8 Sep 2020 09:27:44 +0100 Subject: [PATCH 4/4] Update PlayToManager.cs Fixed name violation --- Emby.Dlna/PlayTo/PlayToManager.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Emby.Dlna/PlayTo/PlayToManager.cs b/Emby.Dlna/PlayTo/PlayToManager.cs index 46e0ce38a2..21877f121f 100644 --- a/Emby.Dlna/PlayTo/PlayToManager.cs +++ b/Emby.Dlna/PlayTo/PlayToManager.cs @@ -132,19 +132,19 @@ namespace Emby.Dlna.PlayTo private static string GetUuid(string usn) { - const string uuidStr = "uuid:"; - const string uuidColonStr = "::"; + const string UuidStr = "uuid:"; + const string UuidColonStr = "::"; - var index = usn.IndexOf(uuidStr, StringComparison.OrdinalIgnoreCase); + var index = usn.IndexOf(UuidStr, StringComparison.OrdinalIgnoreCase); if (index != -1) { - return usn.Substring(index + uuidStr.Length); + return usn.Substring(index + UuidStr.Length); } - index = usn.IndexOf(uuidColonStr, StringComparison.OrdinalIgnoreCase); + index = usn.IndexOf(UuidColonStr, StringComparison.OrdinalIgnoreCase); if (index != -1) { - usn = usn.Substring(0, index + uuidColonStr.Length); + usn = usn.Substring(0, index + UuidColonStr.Length); } return usn.GetMD5().ToString("N", CultureInfo.InvariantCulture);