public class AppConfigHelper
{
private XmlDocument Doc = new XmlDocument();
private AppDomain Ad = AppDomain.CurrentDomain;
public static string AppConfigHelperPath = "";//Ad.SetupInformation.ConfigurationFile
public AppConfigHelper()
{
Doc.Load(AppConfigHelperPath);
}
public void LoadAppConfig()
{
Doc.Load(AppConfigHelperPath);
}
public void SetAppValue(string key, string newValue)
{
Doc.SelectSingleNode("/configuration/appSettings/add[@key='" + key + "']").Attributes["value"].Value = newValue;
}
public void SaveAppConfig()
{
Doc.Save(AppConfigHelperPath);
Doc.Load(AppConfigHelperPath);
}
public string GetAppValue(string key)
{
return Doc.SelectSingleNode("/configuration/appSettings/add[@key='" + key + "']").Attributes["value"].Value;
}
//public void ReLoadConfig()
//{
// DataStoreSrvManager.MaxSvrCount = int.Parse(AppConfig.GetConfigString"DSSvrMaxCount"]);
//}
}