示例#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));
 }
示例#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");
         }
     }
 }
示例#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");
         }
     }
 }
示例#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));
 }