Example #1
0
        private void ConfigurationWatcher_OnFileChanged(object sender, ConfigurationWatcherEventArgs e)
        {
            foreach (var i in e.Builders)
            {
                var all = this.sessions.Where(ta => i.Match(configurationWatcher.UseFileAllNameAsAppUniqueId, ta.Value.Key));
                if (all.IsNotNullOrEmpty())
                {
                    foreach (var a in all)
                    {
                        var response = new ResponseResult()
                        {
                            Query = new System.Collections.Specialized.NameValueCollection()
                            {
                                { "file", a.Value.Key }
                            },
                        };

                        var request = new Request(a.Value.Value, ConfigFileCommand.Pull)
                        {
                        };

                        var currentRequest = new CurrentRequest()
                        {
                            Id      = 0,//Id=0表示服务端主动发送,不用客户端来请求,客户端来请求的话会在协议接口种被编码了
                            Request = request,
                        };

                        this.requestHandler.Send(response, currentRequest, a.Key);
                    }
                }
            }
        }
        protected virtual async void OnConfigurationChanged(object sender, ConfigurationWatcherEventArgs args)
        {
            try
            {
                ApplicationConfiguration configuration = await ApplicationConfiguration.Load(
                    new FileInfo(args.FilePath),
                    m_applicationType,
                    m_configType).ConfigureAwait(false);

                OnUpdateConfiguration(configuration);
            }
            catch (Exception e)
            {
                Utils.Trace(e, "Could not load updated configuration file from: {0}", args);
            }
        }
Example #3
0
        /// <summary>
        /// 配置变更事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        protected override async void OnConfigurationChanged(object sender, ConfigurationWatcherEventArgs args)
        {
            try
            {
                ApplicationConfiguration configuration = await ApplicationConfiguration.Load(
                    new FileInfo(args.FilePath),
                    Configuration.ApplicationType,
                    Configuration.GetType());

                OnUpdateConfiguration(configuration);
            }
            catch (Exception e)
            {
                Utils.Trace(e, "Could not load updated configuration file from: {0}", args);
            }
        }
        protected virtual async void OnConfigurationChanged(object sender, ConfigurationWatcherEventArgs args)
        {
            try
            {
                ApplicationConfiguration configuration = await ApplicationConfiguration.Load(
                    new FileInfo(args.FilePath),
                    Configuration.ApplicationType,
                    Configuration.GetType());

                OnUpdateConfiguration(configuration);
            }
            catch (Exception e)
            {
                Utils.Trace(e, "Could not load updated configuration file from: {0}", args);
            }
        }
Example #5
0
 private void ConfigurationWatcher_OnAppFileChanged(object sender, ConfigurationWatcherEventArgs e)
 {
     this.ConfigurationWatcher_OnFileChanged(sender, e);
 }