Example #1
0
 public void LoadSettings()
 {
     if (!File.Exists(@"scripts\SnipeMod\settings.xml"))
     {
         SaveSettings();
         return;
     }
     Settings = new Settings();
     using (var stream = new FileStream(@"scripts\SnipeMod\settings.xml", FileMode.Open))
         Settings = (Settings)(new XmlSerializer(Settings.GetType()).Deserialize(stream));
 }
Example #2
0
 public void SaveSettings()
 {
     Settings = new Settings();
     Directory.CreateDirectory(@"scripts\SnipeMod");
     using (var stream = new MemoryStream())
     {
         using (var writer = XmlWriter.Create(stream))
         {
             new XmlSerializer(Settings.GetType()).Serialize(writer, Settings);
             var xml = Encoding.UTF8.GetString(stream.ToArray());
             File.WriteAllText(@"scripts\SnipeMod\settings.xml", xml);
             Log.Info(@"Saved settings to scripts\SnipeMod\settings.xml");
         }
     }
 }
Example #3
0
 public void SaveSettings()
 {
     Settings = new Settings();
     Directory.CreateDirectory(@"scripts\SnipeMod");
     using (var stream = new MemoryStream())
     {
         using (var writer = XmlWriter.Create(stream))
         {
             new XmlSerializer(Settings.GetType()).Serialize(writer, Settings);
             var xml = Encoding.UTF8.GetString(stream.ToArray());
             File.WriteAllText(@"scripts\SnipeMod\settings.xml", xml);
             Log.Info(@"Saved settings to scripts\SnipeMod\settings.xml");
         }
     }
 }
Example #4
0
 public void LoadSettings()
 {
     if (!File.Exists(@"scripts\SnipeMod\settings.xml"))
     {
         SaveSettings();
         return;
     }
     Settings = new Settings();
     using (var stream = new FileStream(@"scripts\SnipeMod\settings.xml", FileMode.Open))
         Settings = (Settings) (new XmlSerializer(Settings.GetType()).Deserialize(stream));
 }