Exemplo n.º 1
0
 public void SaveToXML()
 {
     try
     {
         if (!Directory.Exists(Path.GetDirectoryName(Settings.settingsFile)))
         {
             Directory.CreateDirectory(Path.GetDirectoryName(Settings.settingsFile));
         }
         XmlSerializer serial       = new XmlSerializer(typeof(SettingsData));
         FileStream    fs           = new FileStream(Settings.settingsFile, FileMode.Create);
         TextWriter    writer       = new StreamWriter(fs, new UTF8Encoding());
         SettingsData  settingsData = Settings.GetCurrentConfiguration();
         serial.Serialize(writer, settingsData);
         writer.Close();
     }
     catch (Exception ex)
     {
         // log
     }
 }