public bool LoadString (string data)
{
if (data == null)
return false;
#if (XML_DEP)
XmlTextReader reader = null;
try {
TextReader tr = new StringReader (data);
reader = new XmlTextReader (tr);
if (InitRead (reader))
ReadConfigFile (reader);
} catch (ConfigurationException) {
throw;
} catch (Exception e) {
throw new ConfigurationException ("Error reading " + fileName, e);
} finally {
if (reader != null)
reader.Close();
}
#endif
return true;
}
public void Init() { lock (this) { if (config != null) { return; } ConfigurationData data = new ConfigurationData(); if (data.LoadString(GetBundledMachineConfig())) { // do nothing } else { if (!data.Load(GetMachineConfigPath())) { throw new ConfigurationException("Cannot find " + GetMachineConfigPath()); } } string appfile = GetAppConfigPath(); if (appfile == null) { config = data; return; } ConfigurationData appData = new ConfigurationData(data); if (appData.Load(appfile)) { config = appData; } else { config = data; } } }