diff options
| author | stefan <stefan@hegedues.at> | 2018-09-12 19:26:21 +0200 |
|---|---|---|
| committer | stefan <stefan@hegedues.at> | 2018-09-12 19:26:21 +0200 |
| commit | 48facb797ed912e4ea6b04b17d1ff190ac2daac4 (patch) | |
| tree | 8dae77a31670a888d733484cb17dd4077d5444e8 /MediaBrowser.Model/Entities/ProviderIdsExtensions.cs | |
| parent | c32d8656382a0eacb301692e0084377fc433ae9b (diff) | |
Update to 3.5.2 and .net core 2.1
Diffstat (limited to 'MediaBrowser.Model/Entities/ProviderIdsExtensions.cs')
| -rw-r--r-- | MediaBrowser.Model/Entities/ProviderIdsExtensions.cs | 103 |
1 files changed, 0 insertions, 103 deletions
diff --git a/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs b/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs deleted file mode 100644 index e10232baa..000000000 --- a/MediaBrowser.Model/Entities/ProviderIdsExtensions.cs +++ /dev/null @@ -1,103 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace MediaBrowser.Model.Entities -{ - /// <summary> - /// Class ProviderIdsExtensions - /// </summary> - public static class ProviderIdsExtensions - { - /// <summary> - /// Determines whether [has provider identifier] [the specified instance]. - /// </summary> - /// <param name="instance">The instance.</param> - /// <param name="provider">The provider.</param> - /// <returns><c>true</c> if [has provider identifier] [the specified instance]; otherwise, <c>false</c>.</returns> - public static bool HasProviderId(this IHasProviderIds instance, MetadataProviders provider) - { - return !string.IsNullOrEmpty(instance.GetProviderId(provider.ToString())); - } - - /// <summary> - /// Gets a provider id - /// </summary> - /// <param name="instance">The instance.</param> - /// <param name="provider">The provider.</param> - /// <returns>System.String.</returns> - public static string GetProviderId(this IHasProviderIds instance, MetadataProviders provider) - { - return instance.GetProviderId(provider.ToString()); - } - - /// <summary> - /// Gets a provider id - /// </summary> - /// <param name="instance">The instance.</param> - /// <param name="name">The name.</param> - /// <returns>System.String.</returns> - public static string GetProviderId(this IHasProviderIds instance, string name) - { - if (instance == null) - { - throw new ArgumentNullException("instance"); - } - - if (instance.ProviderIds == null) - { - return null; - } - - string id; - instance.ProviderIds.TryGetValue(name, out id); - return id; - } - - /// <summary> - /// Sets a provider id - /// </summary> - /// <param name="instance">The instance.</param> - /// <param name="name">The name.</param> - /// <param name="value">The value.</param> - public static void SetProviderId(this IHasProviderIds instance, string name, string value) - { - if (instance == null) - { - throw new ArgumentNullException("instance"); - } - - // If it's null remove the key from the dictionary - if (string.IsNullOrEmpty(value)) - { - if (instance.ProviderIds != null) - { - if (instance.ProviderIds.ContainsKey(name)) - { - instance.ProviderIds.Remove(name); - } - } - } - else - { - // Ensure it exists - if (instance.ProviderIds == null) - { - instance.ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); - } - - instance.ProviderIds[name] = value; - } - } - - /// <summary> - /// Sets a provider id - /// </summary> - /// <param name="instance">The instance.</param> - /// <param name="provider">The provider.</param> - /// <param name="value">The value.</param> - public static void SetProviderId(this IHasProviderIds instance, MetadataProviders provider, string value) - { - instance.SetProviderId(provider.ToString(), value); - } - } -}
\ No newline at end of file |
