/// <summary>
        /// 返回配置类实例
        /// </summary>
        /// <returns></returns>
        public static GeneralConfigInfo LoadConfig()
        {
            try
            {
                IConfigInfo configInfo = DefaultConfigFileManager.LoadConfig(ref m_fileoldchange, ConfigFilePath, ConfigInfo, true);
                //如为空则表示出现异常,则再次尝试
                if (configInfo == null)
                {
                    configInfo = DefaultConfigFileManager.LoadConfig(ref m_fileoldchange, ConfigFilePath, ConfigInfo, true);
                    if (configInfo == null)
                    {   //还为空,且ConfigInfo同时也为空,为确保程序继续运行,这里重新生成序列化类实例
                        ConfigInfo = (ConfigInfo == null) ? new GeneralConfigInfo() : ConfigInfo;
                        try
                        {
                            SerializationHelper.Save(ConfigInfo, ConfigFilePath);
                        }
                        catch (Exception ex)
                        {
                            //如果序列化也失败则直接抛出异常
                            throw ex;
                        }
                    }
                }
            }
            catch
            {
                ;
            }

            return(ConfigInfo as GeneralConfigInfo);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 返回配置类实例
        /// </summary>
        /// <returns></returns>
        public static DbSnapAppConfig LoadConfig()
        {
            if (Utils.FileExists(ConfigFilePath))
            {
                ConfigInfo = DefaultConfigFileManager.LoadConfig(ref m_fileoldchange, ConfigFilePath, ConfigInfo);
            }

            return(ConfigInfo as DbSnapAppConfig);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 返回配置类实例
 /// </summary>
 /// <returns></returns>
 public static MemCachedConfigInfo LoadConfig()
 {
     if (Utils.FileExists(ConfigFilePath))
     {
         ConfigInfo = DefaultConfigFileManager.LoadConfig(ref m_fileoldchange, ConfigFilePath, ConfigInfo);
         return(ConfigInfo as MemCachedConfigInfo);
     }
     else
     {
         return(null);
     }
 }
 /// <summary>
 /// 返回配置类实例
 /// </summary>
 /// <returns></returns>
 public static MyAttachmentsTypeConfigInfo LoadConfig()
 {
     try
     {
         ConfigInfo = DefaultConfigFileManager.LoadConfig(ref m_fileoldchange, ConfigFilePath, ConfigInfo, true);
     }
     catch
     {
         ReviseConfig();
         ConfigInfo = DefaultConfigFileManager.LoadConfig(ref m_fileoldchange, ConfigFilePath, ConfigInfo, true);
     }
     return(ConfigInfo as MyAttachmentsTypeConfigInfo);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 返回配置类实例
 /// </summary>
 /// <returns></returns>
 public static GeneralConfigInfo LoadConfig()
 {
     try
     {
         ConfigInfo = DefaultConfigFileManager.LoadConfig(ref m_fileoldchange, ConfigFilePath, ConfigInfo, true);
     }
     catch
     {
         ReviseConfig();
         ConfigInfo = DefaultConfigFileManager.LoadConfig(ref m_fileoldchange, ConfigFilePath, ConfigInfo, true);
     }
     return(ConfigInfo as GeneralConfigInfo);
 }
Ejemplo n.º 6
0
        /// <summary>
        /// 返回配置类实例
        /// </summary>
        /// <returns></returns>
        public static ScriptEventConfigInfo LoadConfig()
        {
            try
            {
                ConfigInfo = DefaultConfigFileManager.LoadConfig(ref m_fileoldchange, ConfigFilePath, ConfigInfo, false);
            }
            catch {
                if (!File.Exists(ConfigFilePath))
                {
                    ScriptEventConfigFileManager secf = new ScriptEventConfigFileManager();
                    secf.SaveConfig(ConfigFilePath, ConfigInfo);
                }
            }

            return(ConfigInfo as ScriptEventConfigInfo);
        }
 /// <summary>
 /// 加载配置类
 /// </summary>
 /// <returns></returns>
 public static BaseConfigInfo LoadConfig()
 {
     ConfigInfo = DefaultConfigFileManager.LoadConfig(ref m_fileoldchange, ConfigFilePath, ConfigInfo);
     return(ConfigInfo as BaseConfigInfo);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// 返回配置类实例
 /// </summary>
 /// <returns></returns>
 public static DiscuzCloudConfigInfo LoadConfig()
 {
     ConfigInfo = DefaultConfigFileManager.LoadConfig(ref m_fileOldChange, ConfigFilePath, ConfigInfo);
     return(ConfigInfo as DiscuzCloudConfigInfo);
 }
Ejemplo n.º 9
0
 /// <summary>
 /// 返回配置类实例
 /// </summary>
 /// <returns></returns>
 public static ScheduleConfigInfo LoadConfig()
 {
     ConfigInfo = DefaultConfigFileManager.LoadConfig(ref m_fileoldchange, ConfigFilePath, ConfigInfo, true);
     return(ConfigInfo as ScheduleConfigInfo);
 }