Пример #1
0
        /// <summary>
        /// Registers the configuration option value handler, it is used for reading configuration value and reload it after the configuration is changed;
        /// </summary>
        /// <param name="config">The server configuration.</param>
        /// <param name="name">The changed config option name.</param>
        /// <param name="handler">The handler.</param>
        protected bool RegisterConfigHandler(IServerConfig config, string name, Func <string, bool> handler)
        {
            var notifier = new ConfigValueChangeNotifier(handler);

            m_ConfigUpdatedNotifiers.Add(name, notifier);
            return(notifier.Notify(config.OptionElements.GetValue(name)));
        }
Пример #2
0
        /// <summary>
        /// Registers the configuration option value handler, it is used for reading configuration value and reload it after the configuration is changed;
        /// </summary>
        /// <typeparam name="TConfigOption">The type of the configuration option.</typeparam>
        /// <param name="config">The server configuration.</param>
        /// <param name="name">The changed config option's name.</param>
        /// <param name="handler">The handler.</param>
        protected bool RegisterConfigHandler <TConfigOption>(IServerConfig config, string name, Func <TConfigOption, bool> handler)
            where TConfigOption : ConfigurationElement, new()
        {
            var notifier = new ConfigValueChangeNotifier <TConfigOption>(handler);

            m_ConfigUpdatedNotifiers.Add(name, notifier);
            return(notifier.Notify(config.Options.GetValue(name)));
        }