jellyfin/MediaBrowser.Common/Configuration/IConfigurationManager.cs

83 lines
2.6 KiB
C#
Raw Normal View History

2013-03-03 22:43:06 -07:00
using MediaBrowser.Model.Configuration;
using System;
2014-06-29 10:35:05 -07:00
using System.Collections.Generic;
2013-03-03 22:43:06 -07:00
namespace MediaBrowser.Common.Configuration
{
public interface IConfigurationManager
{
2014-08-10 15:13:17 -07:00
/// <summary>
/// Occurs when [configuration updating].
/// </summary>
event EventHandler<ConfigurationUpdateEventArgs> NamedConfigurationUpdating;
2013-03-03 22:43:06 -07:00
/// <summary>
/// Occurs when [configuration updated].
/// </summary>
event EventHandler<EventArgs> ConfigurationUpdated;
2014-06-29 10:35:05 -07:00
/// <summary>
/// Occurs when [named configuration updated].
/// </summary>
event EventHandler<ConfigurationUpdateEventArgs> NamedConfigurationUpdated;
2013-03-03 22:43:06 -07:00
/// <summary>
/// Gets or sets the application paths.
/// </summary>
/// <value>The application paths.</value>
IApplicationPaths CommonApplicationPaths { get; }
/// <summary>
/// Gets the configuration.
/// </summary>
/// <value>The configuration.</value>
BaseApplicationConfiguration CommonConfiguration { get; }
/// <summary>
/// Saves the configuration.
/// </summary>
void SaveConfiguration();
/// <summary>
/// Replaces the configuration.
/// </summary>
/// <param name="newConfiguration">The new configuration.</param>
void ReplaceConfiguration(BaseApplicationConfiguration newConfiguration);
2014-06-29 10:35:05 -07:00
/// <summary>
/// Gets the configuration.
/// </summary>
/// <param name="key">The key.</param>
/// <returns>System.Object.</returns>
object GetConfiguration(string key);
/// <summary>
/// Gets the type of the configuration.
/// </summary>
/// <param name="key">The key.</param>
/// <returns>Type.</returns>
Type GetConfigurationType(string key);
/// <summary>
/// Saves the configuration.
/// </summary>
/// <param name="key">The key.</param>
/// <param name="configuration">The configuration.</param>
void SaveConfiguration(string key, object configuration);
/// <summary>
/// Adds the parts.
/// </summary>
/// <param name="factories">The factories.</param>
void AddParts(IEnumerable<IConfigurationFactory> factories);
}
public static class ConfigurationManagerExtensions
{
public static T GetConfiguration<T>(this IConfigurationManager manager, string key)
{
return (T)manager.GetConfiguration(key);
}
2013-03-03 22:43:06 -07:00
}
}