public void InvalidAllConfigs() { RemoteConfigSectionCollection lstParams = new RemoteConfigSectionCollection(this.config.ApplicationName); lock (this.configLocker) { foreach (ConfigEntry entry in this.configEntries.Values) { if (entry.IsSet) { lstParams.AddSection(entry.Name, entry.MajorVersion, entry.MinorVersion); } } } this.InvalidConfigs(lstParams); }
public void InvalidConfig(string name, int majorVersion) { RemoteConfigSectionCollection lstParams = new RemoteConfigSectionCollection(this.config.ApplicationName); lock (this.configLocker) { foreach (ConfigEntry entry in this.configEntries.Values) { if (entry.Name == name) { if (entry.IsSet && entry.MajorVersion == majorVersion) { int arg_63_0 = entry.MinorVersion; lstParams.AddSection(entry.Name, entry.MajorVersion, entry.MinorVersion); break; } break; } } } this.InvalidConfigs(lstParams); }
private void TimerCallback(object stat = null) { try { RemoteConfigSectionCollection lstParams = new RemoteConfigSectionCollection(this.config.ApplicationName); lock (this.configLocker) { foreach (ConfigEntry entry in this.configEntries.Values) { if (entry.IsSet) { lstParams.AddSection(entry.Name, entry.MajorVersion, entry.MinorVersion); } } } if (lstParams.Count != 0) { lstParams = this.GetServerVersions(lstParams); if (lstParams.Count != 0) { BaseConfigurationManager.Log(string.Format("获得新的配置文件:SectionName:{0} MajorVersion:{1} MinorVersion:{2}", lstParams[0].SectionName, lstParams[0].MajorVersion, lstParams[0].MinorVersion)); foreach (RemoteConfigSectionParam param in lstParams.Sections) { System.Threading.ThreadPool.QueueUserWorkItem(delegate (object obj) { RemoteConfigurationManager.DownloadParam dp = (RemoteConfigurationManager.DownloadParam)obj; RemoteConfigurationManager.Download(dp.Name, dp.Url, dp.LocalPath, dp.Checker); }, new RemoteConfigurationManager.DownloadParam(param.SectionName, param.DownloadUrl, this.GetPath(param.SectionName), new RemoteConfigurationManager.DownloadChecker(this.CheckDownloadStream))); } } } } catch (System.Exception ex) { BaseConfigurationManager.Log(ex.ToString()); } finally { this.timer.Change(this.config.TimerInterval, -1); } }
private void TimerCallback(object sender, ElapsedEventArgs args) { RemoteConfigSectionCollection lstParams = new RemoteConfigSectionCollection(this.config.ApplicationName); lock (this.configLocker) { foreach (ConfigEntry entry in this.configEntries.Values) { if (entry.IsSet) { lstParams.AddSection(entry.Name, entry.MajorVersion, entry.MinorVersion); } } } if (lstParams.Count == 0) { return; } lstParams = this.GetServerVersions(lstParams); if (lstParams.Count == 0) { return; } foreach (RemoteConfigSectionParam param in lstParams.Sections) { System.Threading.ThreadPool.QueueUserWorkItem(delegate (object obj) { RemoteConfigurationManager.DownloadParam dp = (RemoteConfigurationManager.DownloadParam)obj; RemoteConfigurationManager.Download(dp.Name, dp.Url, dp.LocalPath, dp.Checker); }, new RemoteConfigurationManager.DownloadParam(param.SectionName, param.DownloadUrl, this.GetPath(param.SectionName), new RemoteConfigurationManager.DownloadChecker(this.CheckDownloadStream))); } }
private RemoteConfigSectionParam GetServerVersion(string name, int majorVersion) { RemoteConfigSectionCollection lstParams = new RemoteConfigSectionCollection(this.config.ApplicationName); lstParams.AddSection(name, majorVersion, 0); lstParams = this.GetServerVersions(lstParams); if (lstParams.Count == 0) { return null; } return lstParams[0]; }