Exemple #1
0
 public static SiteConfigInfo Serialize(SiteConfigInfo configinfo, string path)
 {
     lock (m_lockHelper)
     {
         SerializationHelper.Save(configinfo, path);
     }
     return(configinfo);
 }
Exemple #2
0
 /// <summary>
 /// 序列化配置信息为XML
 /// </summary>
 /// <param name="configinfo">配置信息</param>
 /// <param name="configFilePath">配置文件完整路径</param>
 public static SiteConfigInfo Serialiaze(SiteConfigInfo configinfo, string configFilePath)
 {
     lock (lockHelper)
     {
         SerializationHelper.Save(configinfo, configFilePath);
     }
     return(configinfo);
 }
Exemple #3
0
        public static SiteConfigInfo GetConfig()
        {
            SiteConfigInfo config = null;

            if (config == null)
            {
                config = SiteConfigFileManager.LoadConfig();
            }
            return(config);
        }
Exemple #4
0
        /// <summary>
        /// 保存配置到config文件
        /// </summary>
        /// <param name="configinfo"></param>
        /// <returns></returns>
        public static bool SaveConfig(SiteConfigInfo configinfo)
        {
            bool ret = false;

            lock (lockHelper)
            {
                ret = SerializationHelper.Save(configinfo, SiteConfigFileManager.ConfigFilePath);
                ResetConfig();
            }
            return(ret);
        }
        public static SiteConfigInfo LoadConfig()
        {
            try
            {
                if (ConfigInfo != null)
                {
                    m_fileoldchange = File.GetLastWriteTime(ConfigFilePath);
                    ConfigInfo      = DefaultConfigFileManager.LoadConfig(ref m_fileoldchange, ConfigFilePath, ConfigInfo, true);
                }
                else
                {
                    filename   = HttpContext.Current.Server.MapPath("~/Config/site.config");
                    ConfigInfo = new SiteConfigInfo();
                    ConfigInfo = DefaultConfigFileManager.LoadConfig(ref m_fileoldchange, ConfigFilePath, ConfigInfo, false);
                }
            }
            catch
            {
            }

            return(ConfigInfo as SiteConfigInfo);
        }
Exemple #6
0
        /// <summary>
        /// 获取当前站点配置
        /// </summary>
        /// <returns></returns>
        public static SiteConfigInfo GetConfig()
        {
            //if (m_configinfo == null)
            //{
            //    lock (lockHelper)
            //    {
            //        if (m_configinfo == null)
            //        {
            //            m_configinfo = SiteConfigFileManager.LoadConfig();
            //        }
            //    }
            //}
            //return m_configinfo;

            string         configid = "siteconfig";
            SiteConfigInfo config   = AppCtx.Cache.RetrieveObject <SiteConfigInfo>(configid);

            if (config == null)
            {
                config = SiteConfigFileManager.LoadConfig();
                AppCtx.Cache.AddObjectWithFileChange(configid, config, ConfigFile);
            }
            return(config);
        }
Exemple #7
0
 /// <summary>
 /// 重设配置类实例
 /// </summary>
 public static void ResetConfig()
 {
     m_configinfo = SiteConfigFileManager.LoadRealConfig();
 }