Пример #1
0
        /// <summary>
        /// 保存配置类实例
        /// </summary>
        /// <param name="generalconfiginfo"></param>
        /// <returns></returns>
        public static bool SaveConfig(GeneralConfigInfo generalconfiginfo)
        {
            GeneralConfigFileManager gcf = new GeneralConfigFileManager();

            GeneralConfigFileManager.ConfigInfo = generalconfiginfo;
            return(gcf.SaveConfig());
        }
Пример #2
0
        /// <summary>
        /// 返回配置类实例
        /// </summary>
        /// <returns></returns>
        public static GeneralConfigInfo LoadConfig()
        {
            try
            {
                if (!File.Exists(ConfigFilePath))
                {
                    GeneralConfigFileManager secf = new GeneralConfigFileManager();

                    ConfigInfo = new GeneralConfigInfo();
                    secf.SaveConfig(ConfigFilePath, ConfigInfo);
                }
                else
                {
                    ConfigInfo = DefaultConfigFileManager.LoadConfig(ref m_fileoldchange, ConfigFilePath, ConfigInfo, true);
                }
            }
            catch
            {
                if (!File.Exists(ConfigFilePath))
                {
                    GeneralConfigFileManager secf = new GeneralConfigFileManager();
                    secf.SaveConfig(ConfigFilePath, ConfigInfo);
                }
            }
            return(ConfigInfo as GeneralConfigInfo);
        }
Пример #3
0
 /// <summary>
 /// 保存配置类实例
 /// </summary>
 /// <param name="generalconfiginfo"></param>
 /// <returns></returns>
 public static bool SaveConfig(GeneralConfigInfo generalconfiginfo)
 {
     GeneralConfigFileManager gcf = new GeneralConfigFileManager();
     GeneralConfigFileManager.ConfigInfo = generalconfiginfo;
     return gcf.SaveConfig();
 }
Пример #4
0
        /// <summary>
        /// 返回配置类实例
        /// </summary>
        /// <returns></returns>
        public static GeneralConfigInfo LoadConfig()
        {
            try
            {
                if (!File.Exists(ConfigFilePath))
                {
                    GeneralConfigFileManager secf = new GeneralConfigFileManager();

                    ConfigInfo = new GeneralConfigInfo();
                    secf.SaveConfig(ConfigFilePath, ConfigInfo);
                }
                else
                {
                    ConfigInfo = DefaultConfigFileManager.LoadConfig(ref m_fileoldchange, ConfigFilePath, ConfigInfo, true);
                }
            }
            catch
            {
                if (!File.Exists(ConfigFilePath))
                {
                    GeneralConfigFileManager secf = new GeneralConfigFileManager();
                    secf.SaveConfig(ConfigFilePath, ConfigInfo);
                }
            }
            return ConfigInfo as GeneralConfigInfo;
        }
Пример #5
0
 /// <summary>
 /// 重设配置类实例
 /// </summary>
 public static void ResetConfig()
 {
     m_configinfo = GeneralConfigFileManager.LoadConfig();
 }
Пример #6
0
 /// <summary>
 /// 静态构造函数初始化相应实例和定时器
 /// </summary>
 static GeneralConfigs()
 {
     m_configinfo = GeneralConfigFileManager.LoadConfig();
 }