/// <summary> /// Copies from configuration values from another configuration with /// the same settings (key names). /// </summary> /// <param name="config"> /// The configuration to copy from. /// </param> /// <exception cref="ObjectDisposedException"> /// This instance has been disposed. /// </exception> public void CopyFromConfig(PluginConfiguration config) { if (this._isDisposed) { throw new ObjectDisposedException("PluginConfiguration"); } if (config != null) { if ((!config.IsDisposed) && (!config.IsEmpty)) { foreach (String key in config.AllKeys) { if (this._backingStore.ContainsKey(key)) { this.SetValue(key, config.GetValue(key)); } } } } }
/// <summary> /// Saves the specified plugin's configuration. /// </summary> /// <param name="plugin"> /// The plugin containing the configuration to save. /// </param> /// <param name="config"> /// The configuration to save. /// </param> /// <exception cref="ArgumentNullException"> /// <paramref name="plugin"/> cannot be null. /// </exception> public void SavePluginConfiguration(IPlugin plugin, PluginConfiguration config) { if (plugin == null) { throw new ArgumentNullException("plugin"); } if (config != null) { if ((!config.IsEmpty) && (config.IsDirty)) { plugin.SetConfiguration(config); config.ClearDirty(); } } }