Update BasePlugin.cs
This commit is contained in:
parent
dff2674b27
commit
be4e5eff9c
|
@ -252,20 +252,23 @@ namespace MediaBrowser.Common.Plugins
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
return (TConfigurationType)Activator.CreateInstance(typeof(TConfigurationType));
|
var config = (TConfigurationType)Activator.CreateInstance(typeof(TConfigurationType));
|
||||||
|
SaveConfiguration(config);
|
||||||
|
return config;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Saves the current configuration to the file system.
|
/// Saves the current configuration to the file system.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual void SaveConfiguration()
|
/// <param name="config">Configuration to save.</param>
|
||||||
|
public virtual void SaveConfiguration(TConfigurationType config)
|
||||||
{
|
{
|
||||||
lock (_configurationSaveLock)
|
lock (_configurationSaveLock)
|
||||||
{
|
{
|
||||||
_directoryCreateFn(Path.GetDirectoryName(ConfigurationFilePath));
|
_directoryCreateFn(Path.GetDirectoryName(ConfigurationFilePath));
|
||||||
|
|
||||||
XmlSerializer.SerializeToFile(Configuration, ConfigurationFilePath);
|
XmlSerializer.SerializeToFile(config, ConfigurationFilePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,7 +282,7 @@ namespace MediaBrowser.Common.Plugins
|
||||||
|
|
||||||
Configuration = (TConfigurationType)configuration;
|
Configuration = (TConfigurationType)configuration;
|
||||||
|
|
||||||
SaveConfiguration();
|
SaveConfiguration(Configuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|
Loading…
Reference in New Issue
Block a user