예제 #1
0
    static public EditorAutoSavePreferences Load()
    {
        System.IO.FileInfo fileInfo = new System.IO.FileInfo(prefsPath);
        if (!fileInfo.Exists)
        {
            return(new EditorAutoSavePreferences());
        }

        System.IO.Stream fileStream = new System.IO.FileStream(prefsPath, System.IO.FileMode.Open);

        XmlSerializer             xmlSerializer = new XmlSerializer(typeof(EditorAutoSavePreferences));
        EditorAutoSavePreferences prefs         = (EditorAutoSavePreferences)xmlSerializer.Deserialize(fileStream);

        fileStream.Close();

        prefs.autoSaveIntervals = Mathf.Max(prefs.autoSaveIntervals, EditorAutoSave.minIntervalTime);

        return(prefs);
    }
 void OnEnable()
 {
     title       = "Editor AutoSave Preferences";
     preferences = EditorAutoSave.prefs;
     saveOnExit  = true;
 }
 static void LoadPrefs()
 {
     prefs = EditorAutoSavePreferences.Load();
 }