/// <summary> /// 序列化配置信息为XML /// </summary> /// <param name="configinfo">配置信息</param> /// <param name="configFilePath">配置文件完整路径</param> public static DbConfigInfo Serialiaze(DbConfigInfo configinfo, string configFilePath) { lock (lockHelper) { SerializationHelper.Save(configinfo, configFilePath); } return(configinfo); }
/// <summary> /// 静态构造函数初始化相应实例和定时器 /// </summary> static DbConfigs() { m_configinfo = DbConfigFileManager.LoadConfig(); generalConfigTimer.AutoReset = true; generalConfigTimer.Enabled = true; generalConfigTimer.Elapsed += new System.Timers.ElapsedEventHandler(Timer_Elapsed); generalConfigTimer.Start(); }
/// <summary> /// 初始化文件修改时间和对象实例 /// </summary> static DbConfigFileManager() { m_fileoldchange = System.IO.File.GetLastWriteTime(ConfigFilePath); try { m_configinfo = (DbConfigInfo)DefaultConfigFileManager.DeserializeInfo(ConfigFilePath, typeof(DbConfigInfo)); } catch { if (File.Exists(ConfigFilePath)) { m_configinfo = (DbConfigInfo)DefaultConfigFileManager.DeserializeInfo(ConfigFilePath, typeof(DbConfigInfo)); } } }
/// <summary> /// 获得设置项信息 /// </summary> /// <returns>设置项</returns> public static bool SetIpDenyAccess(string denyipaccess) { bool result; lock (lockHelper) { try { DbConfigInfo configInfo = DbConfigs.GetConfig(); DbConfigs.Serialiaze(configInfo, UrlHelper.GetMapPath("~/Puream.config")); result = true; } catch { return(false); } } return(result); }
/// <summary> /// 重设配置类实例 /// </summary> public static void ResetConfig() { m_configinfo = DbConfigFileManager.LoadConfig(); }
/// <summary> /// 序列化配置信息为XML /// </summary> /// <param name="configinfo">配置信息</param> /// <param name="configFilePath">配置文件完整路径</param> public static DbConfigInfo Serialiaze(DbConfigInfo configinfo, string configFilePath) { lock (lockHelper) { SerializationHelper.Save(configinfo, configFilePath); } return configinfo; }