From be4e5eff9ce6a5d93088625575dcc888d955ba69 Mon Sep 17 00:00:00 2001 From: BaronGreenback Date: Fri, 16 Oct 2020 14:58:37 +0100 Subject: [PATCH] Update BasePlugin.cs --- MediaBrowser.Common/Plugins/BasePlugin.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/MediaBrowser.Common/Plugins/BasePlugin.cs b/MediaBrowser.Common/Plugins/BasePlugin.cs index 8545fd5dc..a6130a8e7 100644 --- a/MediaBrowser.Common/Plugins/BasePlugin.cs +++ b/MediaBrowser.Common/Plugins/BasePlugin.cs @@ -252,20 +252,23 @@ namespace MediaBrowser.Common.Plugins } catch { - return (TConfigurationType)Activator.CreateInstance(typeof(TConfigurationType)); + var config = (TConfigurationType)Activator.CreateInstance(typeof(TConfigurationType)); + SaveConfiguration(config); + return config; } } /// /// Saves the current configuration to the file system. /// - public virtual void SaveConfiguration() + /// Configuration to save. + public virtual void SaveConfiguration(TConfigurationType config) { lock (_configurationSaveLock) { _directoryCreateFn(Path.GetDirectoryName(ConfigurationFilePath)); - XmlSerializer.SerializeToFile(Configuration, ConfigurationFilePath); + XmlSerializer.SerializeToFile(config, ConfigurationFilePath); } } @@ -279,7 +282,7 @@ namespace MediaBrowser.Common.Plugins Configuration = (TConfigurationType)configuration; - SaveConfiguration(); + SaveConfiguration(Configuration); } ///