diff options
Diffstat (limited to 'Emby.Server.Implementations/Services/ServicePath.cs')
| -rw-r--r-- | Emby.Server.Implementations/Services/ServicePath.cs | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/Emby.Server.Implementations/Services/ServicePath.cs b/Emby.Server.Implementations/Services/ServicePath.cs index ac2af3eaf..0222b3782 100644 --- a/Emby.Server.Implementations/Services/ServicePath.cs +++ b/Emby.Server.Implementations/Services/ServicePath.cs @@ -39,7 +39,7 @@ namespace Emby.Server.Implementations.Services public int PathComponentsCount { get; set; } /// <summary> - /// The total number of segments after subparts have been exploded ('.') + /// The total number of segments after subparts have been exploded ('.') /// e.g. /path/to/here.ext == 4 /// </summary> public int TotalComponentsCount { get; set; } @@ -50,7 +50,7 @@ namespace Emby.Server.Implementations.Services public Type ServiceType { get; private set; } - public string Path { get { return this.restPath; } } + public string Path => this.restPath; public string Summary { get; private set; } public string Description { get; private set; } @@ -58,10 +58,7 @@ namespace Emby.Server.Implementations.Services public int Priority { get; set; } //passed back to RouteAttribute - public IEnumerable<string> PathVariables - { - get { return this.variablesNames.Where(e => !string.IsNullOrWhiteSpace(e)); } - } + public IEnumerable<string> PathVariables => this.variablesNames.Where(e => !string.IsNullOrWhiteSpace(e)); public static string[] GetPathPartsForMatching(string pathInfo) { @@ -117,7 +114,7 @@ namespace Emby.Server.Implementations.Services var hasSeparators = new List<bool>(); foreach (var component in this.restPath.Split(PathSeperatorChar)) { - if (String.IsNullOrEmpty(component)) continue; + if (string.IsNullOrEmpty(component)) continue; if (StringContains(component, VariablePrefix) && component.IndexOf(ComponentSeperator) != -1) @@ -354,7 +351,7 @@ namespace Emby.Server.Implementations.Services if (withPathInfoParts.Length != this.PathComponentsCount && !this.IsWildCardPath) { - return false; + return false; } if (!Verbs.Contains(httpMethod, StringComparer.OrdinalIgnoreCase)) @@ -420,10 +417,10 @@ namespace Emby.Server.Implementations.Services return pathIx == withPathInfoParts.Length; } - private bool LiteralsEqual(string str1, string str2) + private static bool LiteralsEqual(string str1, string str2) { // Most cases - if (String.Equals(str1, str2, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(str1, str2, StringComparison.OrdinalIgnoreCase)) { return true; } @@ -433,7 +430,7 @@ namespace Emby.Server.Implementations.Services str2 = str2.ToUpperInvariant(); // Invariant IgnoreCase would probably be better but it's not available in PCL - return String.Equals(str1, str2, StringComparison.CurrentCultureIgnoreCase); + return string.Equals(str1, str2, StringComparison.CurrentCultureIgnoreCase); } private bool ExplodeComponents(ref string[] withPathInfoParts) @@ -442,7 +439,7 @@ namespace Emby.Server.Implementations.Services for (var i = 0; i < withPathInfoParts.Length; i++) { var component = withPathInfoParts[i]; - if (String.IsNullOrEmpty(component)) continue; + if (string.IsNullOrEmpty(component)) continue; if (this.PathComponentsCount != this.TotalComponentsCount && this.componentsWithSeparators[i]) @@ -473,7 +470,7 @@ namespace Emby.Server.Implementations.Services && requestComponents.Length >= this.TotalComponentsCount - this.wildcardCount; if (!isValidWildCardPath) - throw new ArgumentException(String.Format( + throw new ArgumentException(string.Format( "Path Mismatch: Request Path '{0}' has invalid number of components compared to: '{1}'", pathInfo, this.restPath)); } @@ -492,7 +489,7 @@ namespace Emby.Server.Implementations.Services string propertyNameOnRequest; if (!this.propertyNamesMap.TryGetValue(variableName.ToLower(), out propertyNameOnRequest)) { - if (String.Equals("ignore", variableName, StringComparison.OrdinalIgnoreCase)) + if (string.Equals("ignore", variableName, StringComparison.OrdinalIgnoreCase)) { pathIx++; continue; @@ -522,12 +519,12 @@ namespace Emby.Server.Implementations.Services // hits a match for the next element in the definition (which must be a literal) // It may consume 0 or more path parts var stopLiteral = i == this.TotalComponentsCount - 1 ? null : this.literalsToMatch[i + 1]; - if (!String.Equals(requestComponents[pathIx], stopLiteral, StringComparison.OrdinalIgnoreCase)) + if (!string.Equals(requestComponents[pathIx], stopLiteral, StringComparison.OrdinalIgnoreCase)) { var sb = new StringBuilder(); sb.Append(value); pathIx++; - while (!String.Equals(requestComponents[pathIx], stopLiteral, StringComparison.OrdinalIgnoreCase)) + while (!string.Equals(requestComponents[pathIx], stopLiteral, StringComparison.OrdinalIgnoreCase)) { sb.Append(PathSeperatorChar + requestComponents[pathIx++]); } |
