I'm using a DataSet to represent the settings I have in my project. More or less the code is as follows:
if (!ValidateSettings(SettingsPath)) //returns false if the settingsfile doesn't consist with the DataSet
{
dsSettings defaultSettings = new dsSettings();
defaultSettings.ReadXml("settingsTemplate.xml", IgnoreSchema);
dsSettings.WriteXml(SettingsFilePath);
}
If I run this code it will copy all values in the template file and write those to the SettingsFilePath file (overwriting the content in that file).
However, in the future, let's say that I add a setting to the DataSet. Then I want the old settings (maybe edited by the user) to remain and only add the missing setting in the xml file from the template file.
Can this be done with some option or something to the WriteXml function or anything as simple as that. Or will I have to read the existing settings file and save each value, write the xml and the overwrite with those saved values?