void Save (Stream stream, ConfigurationSaveMode mode, bool forceUpdateAll)
{
XmlTextWriter tw = new XmlTextWriter (new StreamWriter (stream));
tw.Formatting = Formatting.Indented;
try {
tw.WriteStartDocument ();
if (rootNamespace != null)
tw.WriteStartElement ("configuration", rootNamespace);
else
tw.WriteStartElement ("configuration");
if (rootGroup.HasConfigContent (this)) {
rootGroup.WriteConfig (this, tw, mode);
}
foreach (ConfigurationLocation loc in Locations) {
if (loc.OpenedConfiguration == null) {
tw.WriteRaw ("\n");
tw.WriteRaw (loc.XmlContent);
}
else {
tw.WriteStartElement ("location");
tw.WriteAttributeString ("path", loc.Path);
if (!loc.AllowOverride)
tw.WriteAttributeString ("allowOverride", "false");
loc.OpenedConfiguration.SaveData (tw, mode, forceUpdateAll);
tw.WriteEndElement ();
}
}
SaveData (tw, mode, forceUpdateAll);
tw.WriteEndElement ();
}
finally {
tw.Flush ();
tw.Close ();
}
}