mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-21 01:24:44 +01:00
Fix more analyzer warnings
This commit is contained in:
@@ -218,7 +218,7 @@ namespace Emby.Server.Implementations.AppBase
|
||||
|
||||
private string GetConfigurationFile(string key)
|
||||
{
|
||||
return Path.Combine(CommonApplicationPaths.ConfigurationDirectoryPath, key.ToLower() + ".xml");
|
||||
return Path.Combine(CommonApplicationPaths.ConfigurationDirectoryPath, key.ToLowerInvariant() + ".xml");
|
||||
}
|
||||
|
||||
public object GetConfiguration(string key)
|
||||
|
||||
@@ -3905,7 +3905,7 @@ namespace Emby.Server.Implementations.Data
|
||||
// lowercase this because SortName is stored as lowercase
|
||||
if (statement != null)
|
||||
{
|
||||
statement.TryBind("@NameStartsWithOrGreater", query.NameStartsWithOrGreater.ToLower());
|
||||
statement.TryBind("@NameStartsWithOrGreater", query.NameStartsWithOrGreater.ToLowerInvariant());
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(query.NameLessThan))
|
||||
@@ -3914,7 +3914,7 @@ namespace Emby.Server.Implementations.Data
|
||||
// lowercase this because SortName is stored as lowercase
|
||||
if (statement != null)
|
||||
{
|
||||
statement.TryBind("@NameLessThan", query.NameLessThan.ToLower());
|
||||
statement.TryBind("@NameLessThan", query.NameLessThan.ToLowerInvariant());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4822,7 +4822,7 @@ namespace Emby.Server.Implementations.Data
|
||||
return value;
|
||||
}
|
||||
|
||||
return value.RemoveDiacritics().ToLower();
|
||||
return value.RemoveDiacritics().ToLowerInvariant();
|
||||
}
|
||||
|
||||
private bool EnableGroupByPresentationUniqueKey(InternalItemsQuery query)
|
||||
|
||||
@@ -264,7 +264,7 @@ namespace Emby.Server.Implementations.HttpClientManager
|
||||
}
|
||||
|
||||
var url = options.Url;
|
||||
var urlHash = url.ToLower().GetMD5().ToString("N");
|
||||
var urlHash = url.ToLowerInvariant().GetMD5().ToString("N");
|
||||
|
||||
var responseCachePath = Path.Combine(_appPaths.CachePath, "httpclient", urlHash);
|
||||
|
||||
@@ -384,11 +384,11 @@ namespace Emby.Server.Implementations.HttpClientManager
|
||||
{
|
||||
if (options.LogRequestAsDebug)
|
||||
{
|
||||
_logger.LogDebug("HttpClientManager {0}: {1}", httpMethod.ToUpper(), options.Url);
|
||||
_logger.LogDebug("HttpClientManager {0}: {1}", httpMethod.ToUpper(CultureInfo.CurrentCulture), options.Url);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogInformation("HttpClientManager {0}: {1}", httpMethod.ToUpper(), options.Url);
|
||||
_logger.LogInformation("HttpClientManager {0}: {1}", httpMethod.ToUpper(CultureInfo.CurrentCulture), options.Url);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -394,7 +394,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||
{
|
||||
return contentType == null
|
||||
? null
|
||||
: contentType.Split(';')[0].ToLower().Trim();
|
||||
: contentType.Split(';')[0].ToLowerInvariant().Trim();
|
||||
}
|
||||
|
||||
private static string SerializeToXmlString(object from)
|
||||
|
||||
@@ -517,7 +517,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
if (forceCaseInsensitive || !ConfigurationManager.Configuration.EnableCaseSensitiveItemIds)
|
||||
{
|
||||
key = key.ToLower();
|
||||
key = key.ToLowerInvariant();
|
||||
}
|
||||
|
||||
key = type.FullName + key;
|
||||
|
||||
@@ -2193,7 +2193,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
|
||||
if (lockData)
|
||||
{
|
||||
writer.WriteElementString("lockdata", true.ToString().ToLower());
|
||||
writer.WriteElementString("lockdata", true.ToString(CultureInfo.InvariantCulture).ToLowerInvariant());
|
||||
}
|
||||
|
||||
if (item.CriticRating.HasValue)
|
||||
|
||||
@@ -399,7 +399,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
{
|
||||
var name = serviceName + externalId + InternalVersionNumber;
|
||||
|
||||
return _libraryManager.GetNewItemId(name.ToLower(), typeof(LiveTvChannel));
|
||||
return _libraryManager.GetNewItemId(name.ToLowerInvariant(), typeof(LiveTvChannel));
|
||||
}
|
||||
|
||||
private const string ServiceName = "Emby";
|
||||
@@ -407,21 +407,21 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
{
|
||||
var name = ServiceName + externalId + InternalVersionNumber;
|
||||
|
||||
return name.ToLower().GetMD5().ToString("N");
|
||||
return name.ToLowerInvariant().GetMD5().ToString("N");
|
||||
}
|
||||
|
||||
public Guid GetInternalSeriesTimerId(string externalId)
|
||||
{
|
||||
var name = ServiceName + externalId + InternalVersionNumber;
|
||||
|
||||
return name.ToLower().GetMD5();
|
||||
return name.ToLowerInvariant().GetMD5();
|
||||
}
|
||||
|
||||
public Guid GetInternalProgramId(string externalId)
|
||||
{
|
||||
var name = ServiceName + externalId + InternalVersionNumber;
|
||||
|
||||
return _libraryManager.GetNewItemId(name.ToLower(), typeof(LiveTvProgram));
|
||||
return _libraryManager.GetNewItemId(name.ToLowerInvariant(), typeof(LiveTvProgram));
|
||||
}
|
||||
|
||||
public async Task<TimerInfo> GetTimerInfo(TimerInfoDto dto, bool isNew, LiveTvManager liveTv, CancellationToken cancellationToken)
|
||||
|
||||
@@ -492,11 +492,11 @@ namespace Emby.Server.Implementations.Localization
|
||||
|
||||
if (parts.Length == 2)
|
||||
{
|
||||
culture = parts[0].ToLower() + "-" + parts[1].ToUpper();
|
||||
culture = parts[0].ToLowerInvariant() + "-" + parts[1].ToUpperInvariant();
|
||||
}
|
||||
else
|
||||
{
|
||||
culture = culture.ToLower();
|
||||
culture = culture.ToLowerInvariant();
|
||||
}
|
||||
|
||||
return culture + ".json";
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace Emby.Server.Implementations.Services
|
||||
{
|
||||
return contentType == null
|
||||
? null
|
||||
: contentType.Split(';')[0].ToLower().Trim();
|
||||
: contentType.Split(';')[0].ToLowerInvariant().Trim();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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()));
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
@@ -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 }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user