/// <summary> /// 初始化文件修改时间和对象实例 /// </summary> static LoadBalanceConfigFileManager() { if (Utils.FileExists(ConfigFilePath)) { m_fileoldchange = System.IO.File.GetLastWriteTime(ConfigFilePath); m_configinfo = (LoadBalanceConfigInfo)DefaultConfigFileManager.DeserializeInfo(ConfigFilePath, typeof(LoadBalanceConfigInfo)); } }
static LoadBalanceConfigs() { m_configinfo = LoadBalanceConfigFileManager.LoadConfig(); loadBalanceConfigTimer.AutoReset = true; loadBalanceConfigTimer.Enabled = true; loadBalanceConfigTimer.Elapsed += new System.Timers.ElapsedEventHandler(Timer_Elapsed); loadBalanceConfigTimer.Start(); }
/// <summary> /// 保存配置类实例 /// </summary> /// <param name="configinfo"></param> /// <returns></returns> public static bool SaveConfig(LoadBalanceConfigInfo configinfo) { LoadBalanceConfigFileManager lbcfm = new LoadBalanceConfigFileManager(); LoadBalanceConfigFileManager.ConfigInfo = configinfo; return lbcfm.SaveConfig(); }
/// <summary> /// 重设配置类实例 /// </summary> public static void ResetConfig() { m_configinfo = LoadBalanceConfigFileManager.LoadConfig(); }