using MediaBrowser.Model.Configuration;
using System;
using System.Collections.Generic;
namespace MediaBrowser.Common.Configuration
{
public interface IConfigurationManager
{
///
/// Occurs when [configuration updated].
///
event EventHandler ConfigurationUpdated;
///
/// Occurs when [named configuration updated].
///
event EventHandler NamedConfigurationUpdated;
///
/// Gets or sets the application paths.
///
/// The application paths.
IApplicationPaths CommonApplicationPaths { get; }
///
/// Gets the configuration.
///
/// The configuration.
BaseApplicationConfiguration CommonConfiguration { get; }
///
/// Saves the configuration.
///
void SaveConfiguration();
///
/// Replaces the configuration.
///
/// The new configuration.
void ReplaceConfiguration(BaseApplicationConfiguration newConfiguration);
///
/// Gets the configuration.
///
/// The key.
/// System.Object.
object GetConfiguration(string key);
///
/// Gets the type of the configuration.
///
/// The key.
/// Type.
Type GetConfigurationType(string key);
///
/// Saves the configuration.
///
/// The key.
/// The configuration.
void SaveConfiguration(string key, object configuration);
///
/// Adds the parts.
///
/// The factories.
void AddParts(IEnumerable factories);
}
public static class ConfigurationManagerExtensions
{
public static T GetConfiguration(this IConfigurationManager manager, string key)
{
return (T)manager.GetConfiguration(key);
}
}
}