Use TryAdd

This commit is contained in:
Stepan Goremykin 2023-04-06 19:16:12 +02:00
parent 9d738bb601
commit 6ae1903453
4 changed files with 4 additions and 16 deletions

View File

@ -73,10 +73,7 @@ namespace MediaBrowser.LocalMetadata.Parsers
foreach (var info in idInfos)
{
var id = info.Key + "Id";
if (!_validProviderIds.ContainsKey(id))
{
_validProviderIds.Add(id, info.Key);
}
_validProviderIds.TryAdd(id, info.Key);
}
// Additional Mappings

View File

@ -882,10 +882,7 @@ namespace MediaBrowser.Providers.Manager
var key = providerId.Key;
// Don't replace existing Id's.
if (!lookupInfo.ProviderIds.ContainsKey(key))
{
lookupInfo.ProviderIds[key] = providerId.Value;
}
lookupInfo.ProviderIds.TryAdd(key, providerId.Value);
}
}

View File

@ -780,10 +780,7 @@ namespace MediaBrowser.Providers.Manager
{
foreach (var providerId in result.ProviderIds)
{
if (!existingMatch.ProviderIds.ContainsKey(providerId.Key))
{
existingMatch.ProviderIds.Add(providerId.Key, providerId.Value);
}
existingMatch.ProviderIds.TryAdd(providerId.Key, providerId.Value);
}
if (string.IsNullOrWhiteSpace(existingMatch.ImageUrl))

View File

@ -100,10 +100,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers
foreach (var info in idInfos)
{
var id = info.Key + "Id";
if (!_validProviderIds.ContainsKey(id))
{
_validProviderIds.Add(id, info.Key);
}
_validProviderIds.TryAdd(id, info.Key);
}
// Additional Mappings