Merge pull request #4339 from BaronGreenback/PluginConfigSave
Making default Plugin configurations accessible when developing.
This commit is contained in:
commit
d2cef78db3
|
@ -247,7 +247,23 @@ namespace MediaBrowser.Common.Plugins
|
|||
}
|
||||
catch
|
||||
{
|
||||
return (TConfigurationType)Activator.CreateInstance(typeof(TConfigurationType));
|
||||
var config = (TConfigurationType)Activator.CreateInstance(typeof(TConfigurationType));
|
||||
SaveConfiguration(config);
|
||||
return config;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the current configuration to the file system.
|
||||
/// </summary>
|
||||
/// <param name="config">Configuration to save.</param>
|
||||
public virtual void SaveConfiguration(TConfigurationType config)
|
||||
{
|
||||
lock (_configurationSaveLock)
|
||||
{
|
||||
_directoryCreateFn(Path.GetDirectoryName(ConfigurationFilePath));
|
||||
|
||||
XmlSerializer.SerializeToFile(config, ConfigurationFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -256,12 +272,7 @@ namespace MediaBrowser.Common.Plugins
|
|||
/// </summary>
|
||||
public virtual void SaveConfiguration()
|
||||
{
|
||||
lock (_configurationSaveLock)
|
||||
{
|
||||
_directoryCreateFn(Path.GetDirectoryName(ConfigurationFilePath));
|
||||
|
||||
XmlSerializer.SerializeToFile(Configuration, ConfigurationFilePath);
|
||||
}
|
||||
SaveConfiguration(Configuration);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
@ -274,7 +285,7 @@ namespace MediaBrowser.Common.Plugins
|
|||
|
||||
Configuration = (TConfigurationType)configuration;
|
||||
|
||||
SaveConfiguration();
|
||||
SaveConfiguration(Configuration);
|
||||
|
||||
ConfigurationChanged?.Invoke(this, configuration);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user