Fix more analyzer warnings

This commit is contained in:
Bond_009
2019-01-27 12:03:43 +01:00
parent ee89236fe8
commit a709cbdc64
49 changed files with 285 additions and 256 deletions

View File

@@ -45,7 +45,7 @@ namespace Emby.Server.Implementations.Services
{
return contentType == null
? null
: contentType.Split(';')[0].ToLower().Trim();
: contentType.Split(';')[0].ToLowerInvariant().Trim();
}
}

View File

@@ -98,7 +98,7 @@ namespace Emby.Server.Implementations.Services
return Task.FromResult(response);
}
var expectedMethodName = actionName.Substring(0, 1) + actionName.Substring(1).ToLower();
var expectedMethodName = actionName.Substring(0, 1) + actionName.Substring(1).ToLowerInvariant();
throw new NotImplementedException(string.Format("Could not find method named {1}({0}) or Any({0}) on Service {2}", requestDto.GetType().GetMethodName(), expectedMethodName, serviceType.GetMethodName()));
}

View File

@@ -11,7 +11,7 @@ namespace Emby.Server.Implementations.Services
public static string Key(Type serviceType, string method, string requestDtoName)
{
return serviceType.FullName + " " + method.ToUpper() + " " + requestDtoName;
return serviceType.FullName + " " + method.ToUpperInvariant() + " " + requestDtoName;
}
}
}

View File

@@ -60,7 +60,7 @@ namespace Emby.Server.Implementations.Services
public static string[] GetPathPartsForMatching(string pathInfo)
{
return pathInfo.ToLower().Split(new[] { PathSeperatorChar }, StringSplitOptions.RemoveEmptyEntries);
return pathInfo.ToLowerInvariant().Split(new[] { PathSeperatorChar }, StringSplitOptions.RemoveEmptyEntries);
}
public static List<string> GetFirstMatchHashKeys(string[] pathPartsForMatching)
@@ -104,7 +104,7 @@ namespace Emby.Server.Implementations.Services
this.Description = description;
this.restPath = path;
this.Verbs = string.IsNullOrWhiteSpace(verbs) ? ServiceExecExtensions.AllVerbs : verbs.ToUpper().Split(new[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries);
this.Verbs = string.IsNullOrWhiteSpace(verbs) ? ServiceExecExtensions.AllVerbs : verbs.ToUpperInvariant().Split(new[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries);
var componentsList = new List<string>();
@@ -154,7 +154,7 @@ namespace Emby.Server.Implementations.Services
}
else
{
this.literalsToMatch[i] = component.ToLower();
this.literalsToMatch[i] = component.ToLowerInvariant();
if (firstLiteralMatch == null)
{
@@ -189,7 +189,7 @@ namespace Emby.Server.Implementations.Services
foreach (var propertyInfo in GetSerializableProperties(RequestType))
{
var propertyName = propertyInfo.Name;
propertyNamesMap.Add(propertyName.ToLower(), propertyName);
propertyNamesMap.Add(propertyName.ToLowerInvariant(), propertyName);
}
}
@@ -483,7 +483,7 @@ namespace Emby.Server.Implementations.Services
continue;
}
if (!this.propertyNamesMap.TryGetValue(variableName.ToLower(), out var propertyNameOnRequest))
if (!this.propertyNamesMap.TryGetValue(variableName.ToLowerInvariant(), out var propertyNameOnRequest))
{
if (string.Equals("ignore", variableName, StringComparison.OrdinalIgnoreCase))
{

View File

@@ -216,40 +216,28 @@ namespace Emby.Server.Implementations.Services
{
var responses = new Dictionary<string, SwaggerResponse>
{
{ "200", new SwaggerResponse { description = "OK" } }
};
responses["200"] = new SwaggerResponse
var apiKeySecurity = new Dictionary<string, string[]>
{
description = "OK"
{ "api_key", Array.Empty<string>() }
};
var security = new List<Dictionary<string, string[]>>();
var apiKeySecurity = new Dictionary<string, string[]>();
apiKeySecurity["api_key"] = Array.Empty<string>();
security.Add(apiKeySecurity);
result[verb.ToLower()] = new SwaggerMethod
result[verb.ToLowerInvariant()] = new SwaggerMethod
{
summary = info.Summary,
description = info.Description,
produces = new[]
{
"application/json"
},
consumes = new[]
{
"application/json"
},
produces = new[] { "application/json" },
consumes = new[] { "application/json" },
operationId = info.RequestType.Name,
tags = Array.Empty<string>(),
parameters = new SwaggerParam[] { },
parameters = Array.Empty<SwaggerParam>(),
responses = responses,
security = security.ToArray()
security = new [] { apiKeySecurity }
};
}