Esempio n. 1
0
        public void Save(SaveTheme theClass)
        {
            ///Open or Create Save File
            //Debug.Log("Saving File to: " + Application.persistentDataPath + " ...");

            BinaryFormatter bf   = new BinaryFormatter();
            FileStream      file = File.Open(Application.persistentDataPath + "/SaveData" + Name + ".dat", FileMode.OpenOrCreate);

            //Create new SaveData. This will be everything that is saved.
            SaveTheme saveData = theClass;

            bf.Serialize(file, saveData);
            file.Close();
        }
Esempio n. 2
0
        //Load the file into SaveData.
        public SaveTheme Load()
        {
            if (!File.Exists(Application.persistentDataPath + "/SaveData" + Name + ".dat"))
            {
                //Debug.Log("File Not Found! Load Failed.");
                return(null);
            }
            BinaryFormatter bf        = new BinaryFormatter();                                                                  //Serializer
            FileStream      file      = File.Open(Application.persistentDataPath + "/SaveData" + Name + ".dat", FileMode.Open); //Open File
            SaveTheme       savedData = (SaveTheme)bf.Deserialize(file);                                                        //Load Data.

            file.Close();                                                                                                       //Close File.
            return(savedData);                                                                                                  //Return Saved Data.
        }
Esempio n. 3
0
    public static void LoadColorTheme()
    {
        SavedData data = new SavedData();

        try
        {
            SaveTheme savedData = (SaveTheme)data.Load();
            theme.SetDarkMode(savedData.darkMode);
            WillChangeColor = savedData.darkMode;
        }
        catch (NullReferenceException)
        {
            theme.SetDarkMode(false);
            WillChangeColor = false;
            data.Save(theme);
        }
    }
Esempio n. 4
0
 public void Post(SaveTheme request)
 {
     _themeManager.SaveTheme(request);
 }