예제 #1
0
 public override void OnLoad()
 {
     _setupMenu = new Keybind("menu", "Open Menu", KeyCode.A, KeyCode.LeftAlt);
     if (File.Exists(Path.Combine(ModLoader.GetModConfigFolder(this), "autoconfig.xml")))
     {
         XmlSerializer serializer = new XmlSerializer(typeof(AutoSaveClass));
         FileStream    stream     = new FileStream(Path.Combine(ModLoader.GetModConfigFolder(this), "autoconfig.xml"),
                                                   FileMode.Open);
         AutoSaveClass saveClass = serializer.Deserialize(stream) as AutoSaveClass;
         _coolDownSetting = saveClass.interval;
         stream.Close();
         _intervalSettings.Value = _coolDownSetting;
     }
 }
예제 #2
0
        public override void OnSave()
        {
            XmlSerializer serializer = new XmlSerializer(typeof(AutoSaveClass));

            if (File.Exists(Path.Combine(Application.persistentDataPath, "autoconfig.xml")))
            {
                File.Delete(Path.Combine(Application.persistentDataPath, "autoconfig.xml"));
            }
            FileStream stream = new FileStream(Path.Combine(Application.persistentDataPath, "autoconfig.xml"),
                                               FileMode.Create);
            AutoSaveClass saveClass = new AutoSaveClass {
                interval = _coolDownSetting
            };

            serializer.Serialize(stream, saveClass);
            stream.Close();
        }