Example #1
0
        /// <summary>
        /// 1.检测并且初始化目录文件
        /// 2.初始化各个缓存对象
        /// </summary>
        /// <param name="p_AppFolder">应用程序目录</param>
        public void Init(DirectoryInfo p_AppFolder)
        {
            this.AppFolder = p_AppFolder;
            //1.检测目录是否存在
            string        dirName = p_AppFolder.FullName + "Cache";
            DirectoryInfo info    = ToolKit.GetDirectoryInfo(dirName);

            this.m_HistoryCache = _HistoryCache.CreateInstance(info);
            this.m_BaseReport   = ExtractReport();
        }
Example #2
0
 /// <summary>
 /// 若读取配置文件失败返回新的配置文件
 /// </summary>
 /// <returns></returns>
 public static _HistoryCache CreateInstance(DirectoryInfo p_CacheFolder)
 {
     //若读取文件成功则直接返回否则返回空对象
     try
     {
         string        filename = p_CacheFolder.FullName + "\\" + _HistoryCache.FileName;
         _HistoryCache info     = CFiles.Deserialize(filename) as _HistoryCache;
         if (info == null)
         {
             info = new _HistoryCache();
         }
         info.SaveName = filename;
         return(info);
     }
     catch
     {
         _HistoryCache info = new _HistoryCache();
         info.SaveName = p_CacheFolder.FullName + "\\" + _HistoryCache.FileName;
         return(info);
     }
 }