/// <summary>
        /// 初始化文件修改时间和对象实例
        /// </summary>
        static GeneralConfigFileManager()
        {
            m_fileoldchange = System.IO.File.GetLastWriteTime(ConfigFilePath);

            try
            {
                m_configinfo = (GeneralConfigInfo)DefaultConfigFileManager.DeserializeInfo(ConfigFilePath, typeof(GeneralConfigInfo));
            }
            catch
            {
                if (File.Exists(ConfigFilePath))
                {
                    m_configinfo = (GeneralConfigInfo)DefaultConfigFileManager.DeserializeInfo(ConfigFilePath, typeof(GeneralConfigInfo));
                }
            }
        }
Exemple #2
0
 public ActionResult AdminBaseConfig(GeneralConfigInfo model)
 {
     try
     {
         GeneralConfigInfo config = configinfo;
         config.Weburl = model.Weburl;
         config.Webtitle = model.Webtitle;
         config.WebPath = string.IsNullOrEmpty(model.WebPath) ? "/" : model.WebPath;
         config.Icp = model.Icp;
         config.IndexPagerCount = model.IndexPagerCount;
         config.CatePagerCount = model.CatePagerCount;
         config.CommentPagerCount = model.CommentPagerCount;
         config.NotePagerCount = model.NotePagerCount;
         config.WebDescription = model.WebDescription;
         GeneralConfigs.Serialiaze(config, Server.MapPath(ConfigurationManager.AppSettings["WebConfig"].ToString()));
     }
     catch (Exception)
     {
         return Content("修改失败!<a href=\"" + configinfo.WebPath + "admin/AdminBaseConfig\">继续修改</a>", "text/html;charset=UTF-8");
     }
     return Content("修改成功!<a href=\"" + configinfo.WebPath + "admin/AdminBaseConfig\">继续修改</a>", "text/html;charset=UTF-8");
 }