/// <summary> /// 加载参数 /// 可以重写 /// </summary> /// <returns></returns> public virtual bool LoadParams() { switch (ParamSourceType) { case AqiConstant.ParamSourceType.JSON: this.listParamCache = AqiParam.CreateListFormJson(this, this.Tag, AqiParam.PARAMS); this.dtParamCacheTime = AqiParam.ReadWriteTimeFormJson(this); break; case AqiConstant.ParamSourceType.ISrcUrl: if (this is IParseSrcUrlParam) { IParseSrcUrlParam ipp = this as IParseSrcUrlParam; this.listParamCache = AqiParam.CreateListFormSrcUrl(ipp, ipp.ParamSrcUrl); this.dtParamCacheTime = DateTime.Now; } else { throw new ParamException("参数来源类型(ISRCUrl)与接口(IParseParam)不匹配"); } break; default: throw new ParamException("参数来源类型(ParamSourceType)未知"); } //TODO //验证参数是否匹配ParamName return(true); }
/// <summary> /// 加载参数 /// 读取JSON中的depthsParams字段 /// </summary> /// <returns></returns> public override bool LoadParams() { this.listParamCache = this.loadDepthsParams(); this.dtParamCacheTime = AqiParam.ReadWriteTimeFormJson(this); return(true); }
/// <summary> /// 检查过期 /// 可以重写 /// </summary> /// <returns>true过期;false未过期</returns> public virtual bool IsParamsExpired() { switch (ParamSourceType) { case AqiConstant.ParamSourceType.JSON: DateTime dtNewWriteTime = AqiParam.ReadWriteTimeFormJson(this); if (dtNewWriteTime > this.dtParamCacheTime) { return(true); } break; case AqiConstant.ParamSourceType.ISrcUrl: return(true); default: return(true); } return(false); }