public void SaveAs(string path, bool overwrite = true)
{
if (File.Exists(path))
{
if (overwrite) File.Delete(path); else throw new IOException("Target file exists and cannot be overwritten.");
}
using (StreamWriter sw = new StreamWriter(path))
{
foreach (string section in _content.Keys)
{
sw.WriteLine(FORMAT_SECTION, section);
foreach (string key in _content[section].Keys)
{
sw.WriteLine(FORMAT_KEY_VALUE, key, _content[section][key]);
}
sw.WriteLine();
}
sw.Flush();
}
}