using System;
using System.Collections.Generic;
using Utils;
namespace SiteCore
{
///
/// 网站的配置信息
///
public class config
{
private Dictionary _dics;
///
/// 网站的配置信息
///
public Dictionary dics
{
get { return _dics; }
}
//------------------------------------------------------------
private config() { loadAll(); }
private static volatile config _instance;
private static readonly Object _syncRoot = new object();
public static config Instance
{
get
{
if (_instance == null)
{
lock (_syncRoot)
{
if (_instance == null) _instance = new config();
}
}
return _instance;
}
}
public void Reload()
{
loadAll();
}
private void loadAll()
{
initSiteSettings();
}
// ------------------------- site settings -------------------------
private void initSiteSettings()
{
_dics = cfgHelper.Read(siteconfigAbsPath);
//if (dic.Count <= 0) return;
}
private String getVal(Dictionary dic, String key)
{
String val;
dic.TryGetValue(key, out val);
return val;
}
internal static readonly String siteconfigAbsPath = getSiteConfigAbsPath();
private static String getSiteConfigAbsPath()
{
return PathHelper.Map(strUtil.Join(cfgHelper.ConfigRoot, "site.config"));
}
}
}