< Summary - Jellyfin

Information
Class: MediaBrowser.Common.Configuration.ConfigurationManagerExtensions
Assembly: MediaBrowser.Common
File(s): /srv/git/jellyfin/MediaBrowser.Common/Configuration/IConfigurationManager.cs
Line coverage
100%
Covered lines: 1
Uncovered lines: 0
Coverable lines: 1
Total lines: 97
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
GetConfiguration(...)100%11100%

File(s)

/srv/git/jellyfin/MediaBrowser.Common/Configuration/IConfigurationManager.cs

#LineLine coverage
 1#pragma warning disable CS1591
 2
 3using System;
 4using System.Collections.Generic;
 5using MediaBrowser.Model.Configuration;
 6
 7namespace MediaBrowser.Common.Configuration
 8{
 9    public interface IConfigurationManager
 10    {
 11        /// <summary>
 12        /// Occurs when [configuration updating].
 13        /// </summary>
 14        event EventHandler<ConfigurationUpdateEventArgs> NamedConfigurationUpdating;
 15
 16        /// <summary>
 17        /// Occurs when [configuration updated].
 18        /// </summary>
 19        event EventHandler<EventArgs> ConfigurationUpdated;
 20
 21        /// <summary>
 22        /// Occurs when [named configuration updated].
 23        /// </summary>
 24        event EventHandler<ConfigurationUpdateEventArgs> NamedConfigurationUpdated;
 25
 26        /// <summary>
 27        /// Gets the application paths.
 28        /// </summary>
 29        /// <value>The application paths.</value>
 30        IApplicationPaths CommonApplicationPaths { get; }
 31
 32        /// <summary>
 33        /// Gets the configuration.
 34        /// </summary>
 35        /// <value>The configuration.</value>
 36        BaseApplicationConfiguration CommonConfiguration { get; }
 37
 38        /// <summary>
 39        /// Saves the configuration.
 40        /// </summary>
 41        void SaveConfiguration();
 42
 43        /// <summary>
 44        /// Replaces the configuration.
 45        /// </summary>
 46        /// <param name="newConfiguration">The new configuration.</param>
 47        void ReplaceConfiguration(BaseApplicationConfiguration newConfiguration);
 48
 49        /// <summary>
 50        /// Manually pre-loads a factory so that it is available pre system initialisation.
 51        /// </summary>
 52        /// <typeparam name="T">Class to register.</typeparam>
 53        void RegisterConfiguration<T>()
 54            where T : IConfigurationFactory;
 55
 56        /// <summary>
 57        /// Gets the configuration.
 58        /// </summary>
 59        /// <param name="key">The key.</param>
 60        /// <returns>System.Object.</returns>
 61        object GetConfiguration(string key);
 62
 63        /// <summary>
 64        /// Gets the array of coniguration stores.
 65        /// </summary>
 66        /// <returns>Array of ConfigurationStore.</returns>
 67        ConfigurationStore[] GetConfigurationStores();
 68
 69        /// <summary>
 70        /// Gets the type of the configuration.
 71        /// </summary>
 72        /// <param name="key">The key.</param>
 73        /// <returns>Type.</returns>
 74        Type GetConfigurationType(string key);
 75
 76        /// <summary>
 77        /// Saves the configuration.
 78        /// </summary>
 79        /// <param name="key">The key.</param>
 80        /// <param name="configuration">The configuration.</param>
 81        void SaveConfiguration(string key, object configuration);
 82
 83        /// <summary>
 84        /// Adds the parts.
 85        /// </summary>
 86        /// <param name="factories">The factories.</param>
 87        void AddParts(IEnumerable<IConfigurationFactory> factories);
 88    }
 89
 90    public static class ConfigurationManagerExtensions
 91    {
 92        public static T GetConfiguration<T>(this IConfigurationManager manager, string key)
 93        {
 190194            return (T)manager.GetConfiguration(key);
 95        }
 96    }
 97}