Exemplo n.º 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());
        }
Exemplo n.º 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);
        }
Exemplo n.º 3
0
 /// <summary>
 /// 序列化配置信息为XML
 /// </summary>
 /// <param name="configinfo">配置信息</param>
 /// <param name="configFilePath">配置文件完整路径</param>
 public static GeneralConfigInfo Serialiaze(GeneralConfigInfo configinfo, string configFilePath)
 {
     lock (lockHelper)
     {
         XmlUtil.Serializer(configinfo, configFilePath);
     }
     return(configinfo);
 }
Exemplo n.º 4
0
 /// <summary>
 /// 序列化配置信息为XML
 /// </summary>
 /// <param name="configinfo">配置信息</param>
 /// <param name="configFilePath">配置文件完整路径</param>
 public static GeneralConfigInfo Serialiaze(GeneralConfigInfo configinfo, string configFilePath)
 {
     lock (lockHelper)
     {
         XmlUtil.Serializer(configinfo, configFilePath);
     }
     return configinfo;
 }
 public void InitFrom(GeneralConfigInfo config)
 {
     //SetSelectListItem("_SchoolResponseTimeout", "SchoolResponseTimeout", config.SchoolResponseTimeout);
     //SetSelectListItem("_SchoolMaintainTimeout", "SchoolMaintainTimeout", config.SchoolMaintainTimeout);
     //SetSelectListItem("_DefaultAuditTimeout", "DefaultAuditTimeout", config.DefaultAuditTimeout);
     //SetSelectListItem("_CompanyResponseTimeout", "CompanyResponseTimeout", config.CompanyResponseTimeout);
     //SetSelectListItem("_CompanyMaintainTimeout", "CompanyMaintainTimeout", config.CompanyMaintainTimeout);
 }
 public virtual ActionResult Save(GeneralConfigInfo config, FormCollection collection)
 {
     if (config != null)
     {
         GeneralConfigs.SaveConfig(config);
         InitFrom(config);
     }
     return View("Index", config);
 }
Exemplo n.º 7
0
        /// <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));
                }
            }
        }
Exemplo n.º 8
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();
 }
Exemplo n.º 9
0
 /// <summary>
 /// 重设配置类实例
 /// </summary>
 public static void ResetConfig()
 {
     m_configinfo = GeneralConfigFileManager.LoadConfig();
 }
Exemplo n.º 10
0
 /// <summary>
 /// 静态构造函数初始化相应实例和定时器
 /// </summary>
 static GeneralConfigs()
 {
     m_configinfo = GeneralConfigFileManager.LoadConfig();
 }
Exemplo n.º 11
0
        /// <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));
                }
            }
        }
Exemplo n.º 12
0
 /// <summary>
 /// 重设配置类实例
 /// </summary>
 public static void ResetConfig()
 {
     m_configinfo = GeneralConfigFileManager.LoadConfig();
 }
Exemplo n.º 13
0
 /// <summary>
 /// 静态构造函数初始化相应实例和定时器
 /// </summary>
 static GeneralConfigs()
 {
     m_configinfo = GeneralConfigFileManager.LoadConfig();
 }
Exemplo n.º 14
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;
        }