CmisSync.Lib.Config.Save C# (CSharp) Method

Save() public method

Save the currently loaded (in memory) configuration back to the XML file.
public Save ( ) : void
return void
        public void Save()
        {
            XmlSerializer serializer = new XmlSerializer(typeof(SyncConfig));
            using (TextWriter textWriter = new StreamWriter(FullPath))
            {
                serializer.Serialize(textWriter, this.configXml);
            }
        }

Usage Example

Ejemplo n.º 1
0
 public void TestConfig()
 {
     string configpath = Path.GetFullPath("testconfig.conf");
     try
     {
         //Create new config file with default values
         Config config = new Config(configpath);
         //Notifications should be switched on by default
         Assert.IsTrue(config.Notifications);
         Assert.AreEqual(config.Folders.Count, 0);
         config.Save();
         config = new Config(configpath);
     }
     catch (Exception)
     {
         if (File.Exists(configpath))
             File.Delete(configpath);
         throw;
     }
     File.Delete(configpath);
 }