aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Localization/LocalizationManager.cs
diff options
context:
space:
mode:
authorShadowghost <Ghost_of_Stone@web.de>2022-12-07 17:40:24 +0100
committerShadowghost <Ghost_of_Stone@web.de>2022-12-07 17:40:24 +0100
commit2c86bd1875e6e85d5867618e992d850453dae663 (patch)
tree671070fb246fd3821bf6f1e58a01c402a2f969d1 /Emby.Server.Implementations/Localization/LocalizationManager.cs
parentdd5f90802e71083347b6095eb79a9de0b9d34615 (diff)
parent3cb7fe50127b1a8158186b390836ee25ae5a50fd (diff)
Merge branch 'master' into network-rewrite
Diffstat (limited to 'Emby.Server.Implementations/Localization/LocalizationManager.cs')
-rw-r--r--Emby.Server.Implementations/Localization/LocalizationManager.cs19
1 files changed, 5 insertions, 14 deletions
diff --git a/Emby.Server.Implementations/Localization/LocalizationManager.cs b/Emby.Server.Implementations/Localization/LocalizationManager.cs
index b77168126..b418c7877 100644
--- a/Emby.Server.Implementations/Localization/LocalizationManager.cs
+++ b/Emby.Server.Implementations/Localization/LocalizationManager.cs
@@ -219,10 +219,7 @@ namespace Emby.Server.Implementations.Localization
/// <inheritdoc />
public int? GetRatingLevel(string rating)
{
- if (string.IsNullOrEmpty(rating))
- {
- throw new ArgumentNullException(nameof(rating));
- }
+ ArgumentException.ThrowIfNullOrEmpty(rating);
if (_unratedValues.Contains(rating.AsSpan(), StringComparison.OrdinalIgnoreCase))
{
@@ -295,10 +292,7 @@ namespace Emby.Server.Implementations.Localization
private Dictionary<string, string> GetLocalizationDictionary(string culture)
{
- if (string.IsNullOrEmpty(culture))
- {
- throw new ArgumentNullException(nameof(culture));
- }
+ ArgumentException.ThrowIfNullOrEmpty(culture);
const string Prefix = "Core";
@@ -310,10 +304,7 @@ namespace Emby.Server.Implementations.Localization
private async Task<Dictionary<string, string>> GetDictionary(string prefix, string culture, string baseFilename)
{
- if (string.IsNullOrEmpty(culture))
- {
- throw new ArgumentNullException(nameof(culture));
- }
+ ArgumentException.ThrowIfNullOrEmpty(culture);
var dictionary = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
@@ -329,14 +320,14 @@ namespace Emby.Server.Implementations.Localization
{
await using var stream = _assembly.GetManifestResourceStream(resourcePath);
// If a Culture doesn't have a translation the stream will be null and it defaults to en-us further up the chain
- if (stream == null)
+ if (stream is null)
{
_logger.LogError("Missing translation/culture resource: {ResourcePath}", resourcePath);
return;
}
var dict = await JsonSerializer.DeserializeAsync<Dictionary<string, string>>(stream, _jsonOptions).ConfigureAwait(false);
- if (dict == null)
+ if (dict is null)
{
throw new InvalidOperationException($"Resource contains invalid data: '{stream}'");
}