mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-24 01:34:45 +03:00
add standalone EncodingOptions
This commit is contained in:
@@ -233,13 +233,22 @@ namespace MediaBrowser.Common.Implementations.Configuration
|
||||
|
||||
public void SaveConfiguration(string key, object configuration)
|
||||
{
|
||||
var configurationType = GetConfigurationType(key);
|
||||
var configurationStore = GetConfigurationStore(key);
|
||||
var configurationType = configurationStore.ConfigurationType;
|
||||
|
||||
if (configuration.GetType() != configurationType)
|
||||
{
|
||||
throw new ArgumentException("Expected configuration type is " + configurationType.Name);
|
||||
}
|
||||
|
||||
var validatingStore = configurationStore as IValidatingConfiguration;
|
||||
if (validatingStore != null)
|
||||
{
|
||||
var currentConfiguration = GetConfiguration(key);
|
||||
|
||||
validatingStore.Validate(currentConfiguration, configuration);
|
||||
}
|
||||
|
||||
EventHelper.FireEventIfNotNull(NamedConfigurationUpdating, this, new ConfigurationUpdateEventArgs
|
||||
{
|
||||
Key = key,
|
||||
@@ -267,9 +276,14 @@ namespace MediaBrowser.Common.Implementations.Configuration
|
||||
|
||||
public Type GetConfigurationType(string key)
|
||||
{
|
||||
return _configurationStores
|
||||
.First(i => string.Equals(i.Key, key, StringComparison.OrdinalIgnoreCase))
|
||||
return GetConfigurationStore(key)
|
||||
.ConfigurationType;
|
||||
}
|
||||
|
||||
private ConfigurationStore GetConfigurationStore(string key)
|
||||
{
|
||||
return _configurationStores
|
||||
.First(i => string.Equals(i.Key, key, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user