aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Services/UrlExtensions.cs
diff options
context:
space:
mode:
authorVasily <JustAMan@users.noreply.github.com>2020-04-29 12:17:01 +0300
committerGitHub <noreply@github.com>2020-04-29 12:17:01 +0300
commit5922c35d692b50817ccbc2acd4e521aab11dd230 (patch)
tree92f0a7a72bd96d4b4e153f11219379b70afed5aa /Emby.Server.Implementations/Services/UrlExtensions.cs
parent8607b6a9975b2738886ecc4c799f0663b2c1bb24 (diff)
parentc430a7ed8faa40788c32b89852310981b7c1cf83 (diff)
Merge pull request #2920 from Bond-009/tests2
Add some simple tests
Diffstat (limited to 'Emby.Server.Implementations/Services/UrlExtensions.cs')
-rw-r--r--Emby.Server.Implementations/Services/UrlExtensions.cs20
1 files changed, 4 insertions, 16 deletions
diff --git a/Emby.Server.Implementations/Services/UrlExtensions.cs b/Emby.Server.Implementations/Services/UrlExtensions.cs
index 5d4407f3b..483c63ade 100644
--- a/Emby.Server.Implementations/Services/UrlExtensions.cs
+++ b/Emby.Server.Implementations/Services/UrlExtensions.cs
@@ -1,4 +1,5 @@
using System;
+using MediaBrowser.Common.Extensions;
namespace Emby.Server.Implementations.Services
{
@@ -13,25 +14,12 @@ namespace Emby.Server.Implementations.Services
public static string GetMethodName(this Type type)
{
var typeName = type.FullName != null // can be null, e.g. generic types
- ? LeftPart(type.FullName, "[[") // Generic Fullname
- .Replace(type.Namespace + ".", string.Empty) // Trim Namespaces
- .Replace("+", ".") // Convert nested into normal type
+ ? StringExtensions.LeftPart(type.FullName, "[[", StringComparison.Ordinal).ToString() // Generic Fullname
+ .Replace(type.Namespace + ".", string.Empty, StringComparison.Ordinal) // Trim Namespaces
+ .Replace("+", ".", StringComparison.Ordinal) // Convert nested into normal type
: type.Name;
return type.IsGenericParameter ? "'" + typeName : typeName;
}
-
- private static string LeftPart(string strVal, string needle)
- {
- if (strVal == null)
- {
- return null;
- }
-
- var pos = strVal.IndexOf(needle, StringComparison.OrdinalIgnoreCase);
- return pos == -1
- ? strVal
- : strVal.Substring(0, pos);
- }
}
}