//----------------------------------------------------------------------------------------------------------------------------------------------// private void LoadUser() { if (File.Exists(Application.persistentDataPath + "/userInfo.dat")) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + "/userInfo.dat", FileMode.Open); UserStoredInfo info = (UserStoredInfo)bf.Deserialize(file); file.Close(); if (info.storedEmail != "") { SignInUser(info.storedEmail, info.storedPassword); loading = true; currentPassword = info.storedPassword; } else { loading = false; } } else { loading = false; } }
//----------------------------------------------------------------------------------------------------------------------------------------------// private void SaveUser(string e, string p) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Create(Application.persistentDataPath + "/userInfo.dat"); UserStoredInfo info = new UserStoredInfo(); info.storedEmail = e; info.storedPassword = p; currentPassword = p; bf.Serialize(file, info); file.Close(); }