Пример #1
0
        RemoteConfigSectionParam GetServerVersion(string name, int majorVersion)
        {
            RemoteConfigSectionCollection lstParams = new RemoteConfigSectionCollection(config.ApplicationName);

            lstParams.AddSection(name, majorVersion, XmlSerializerSectionHandler.DefaultUninitMinorVersion);
            lstParams = GetServerVersions(lstParams);
            if (lstParams.Count == 0)
            {
                return(null);
            }
            else
            {
                return(lstParams[0]);
            }
        }
Пример #2
0
        public void InvalidAllConfigs()
        {
            RemoteConfigSectionCollection lstParams = new RemoteConfigSectionCollection(config.ApplicationName);

            lock (configLocker)
            {
                foreach (ConfigEntry entry in configEntries.Values)
                {
                    if (entry.IsSet)
                    {
                        lstParams.AddSection(entry.Name, entry.MajorVersion, entry.MinorVersion);
                    }
                }
            }
            InvalidConfigs(lstParams);
        }
Пример #3
0
        void TimerCallback(object sender, System.Timers.ElapsedEventArgs args)
        {
            RemoteConfigSectionCollection lstParams = new RemoteConfigSectionCollection(config.ApplicationName);

            //configLocker.AcquireReaderLock(-1);
            //using (configLocker.AcquireReaderLock())
            lock (configLocker)
            {
                foreach (ConfigEntry entry in configEntries.Values)
                {
                    if (entry.IsSet)
                    {
                        lstParams.AddSection(entry.Name, entry.MajorVersion, entry.MinorVersion);
                    }
                }
                //configLocker.ReleaseReaderLock();
            }
            if (lstParams.Count == 0)
            {
                return;
            }

            lstParams = GetServerVersions(lstParams);
            if (lstParams.Count == 0)
            {
                return;
            }
            foreach (RemoteConfigSectionParam param in lstParams.Sections)
            {
                ThreadPool.QueueUserWorkItem(
                    delegate(object obj)
                {
                    DownloadParam dp = (DownloadParam)obj;
                    Download(dp.Name, dp.Url, dp.LocalPath, dp.Checker);
                },
                    new DownloadParam(param.SectionName,
                                      param.DownloadUrl,
                                      GetPath(param.SectionName),
                                      CheckDownloadStream)
                    );
            }
        }
Пример #4
0
        public void InvalidConfig(string name, int majorVersion)
        {
            RemoteConfigSectionCollection lstParams = new RemoteConfigSectionCollection(config.ApplicationName);
            int orgMinorVersion = 0;

            lock (configLocker)
            {
                foreach (ConfigEntry entry in configEntries.Values)
                {
                    if (entry.Name == name)
                    {
                        if (entry.IsSet && entry.MajorVersion == majorVersion)
                        {
                            orgMinorVersion = entry.MinorVersion;
                            lstParams.AddSection(entry.Name, entry.MajorVersion, entry.MinorVersion);
                        }
                        break;
                    }
                }
            }
            InvalidConfigs(lstParams);
        }