Represents a PluginElement configuration element within the configuration.
Inheritance: System.Configuration.ConfigurationElement
        /// <summary>
        /// Returns the <see cref="T:ImageProcessor.Web.Config.ImageProcessingSection.SettingElementCollection"/> for the given plugin.
        /// </summary>
        /// <param name="name">
        /// The name of the plugin to get the settings for. Override settings by adding appsettings in web.config using the format
        /// ImageProcessor.&lt;.plugin-name.&gt;.&lt;settingKey&gt; e.g. 'ImageProcessor.GaussianBlur.MaxSize'.
        /// The key must exist in the config section for the appsetting to apply"
        /// </param>
        /// <returns>
        /// The <see cref="T:ImageProcessor.Web.Config.ImageProcessingSection.SettingElementCollection"/> for the given plugin.
        /// </returns>
        private Dictionary <string, string> GetPluginSettings(string name)
        {
            ImageProcessingSection.PluginElement pluginElement = GetImageProcessingSection()
                                                                 .Plugins
                                                                 .Cast <ImageProcessingSection.PluginElement>()
                                                                 .FirstOrDefault(x => x.Name == name);

            Dictionary <string, string> settings;

            if (pluginElement != null)
            {
                settings = pluginElement.Settings
                           .Cast <SettingElement>()
                           .ToDictionary(setting => setting.Key, setting => setting.Value);

                // Override the settings found in config section with values in the app.config / deployment slot settings
                this.OverrideDefaultSettingsWithAppSettingsValue(settings, name);
            }
            else
            {
                settings = new Dictionary <string, string>();
            }

            return(settings);
        }
Beispiel #2
0
        /// <summary>
        /// Returns the <see cref="T:ImageProcessor.Web.Config.ImageProcessingSection.SettingElementCollection"/> for the given plugin.
        /// </summary>
        /// <param name="name">
        /// The name of the plugin to get the settings for.
        /// </param>
        /// <returns>
        /// The <see cref="T:ImageProcessor.Web.Config.ImageProcessingSection.SettingElementCollection"/> for the given plugin.
        /// </returns>
        private Dictionary <string, string> GetPluginSettings(string name)
        {
            ImageProcessingSection.PluginElement pluginElement = GetImageProcessingSection()
                                                                 .Plugins
                                                                 .Cast <ImageProcessingSection.PluginElement>()
                                                                 .FirstOrDefault(x => x.Name == name);

            Dictionary <string, string> settings;

            if (pluginElement != null)
            {
                settings = pluginElement.Settings
                           .Cast <SettingElement>()
                           .ToDictionary(setting => setting.Key, setting => setting.Value);
            }
            else
            {
                settings = new Dictionary <string, string>();
            }

            return(settings);
        }