Ejemplo n.º 1
0
        /// <summary>
        /// 过期检查
        /// </summary>
        /// <returns></returns>
        public virtual bool IsConfigsExpired()
        {
            DateTime dtNewWriteTime = AqiConfig.ReadWriteTimeFormJson(this);

            if (dtNewWriteTime > this.dtConfigCacheTime)
            {
                return(true);
            }
            return(false);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 加载配置
        /// </summary>
        /// <returns></returns>
        public virtual bool LoadConfigs()
        {
            try
            {
                thisLock.EnterWriteLock();

                List <AqiConfig> list = AqiConfig.CreateListFormJson(this);

                this.allConfig         = list.ToDictionary <AqiConfig, string>(ac => ac.Name);
                this.dtConfigCacheTime = AqiConfig.ReadWriteTimeFormJson(this);
            }
            catch (System.Exception e)
            {
                throw e;
            }
            finally
            {
                thisLock.ExitWriteLock();
            }

            return(true);
        }