//Load in log in data public void Load() { if (File.Exists(path)) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(path, FileMode.Open); serializedUser user = (serializedUser)bf.Deserialize(file); file.Close(); User.Instance.username = user.username; User.Instance.email = user.email; User.Instance.objectId = user.objectID; User.Instance.accountType = user.accountType; } }
//Save log in info public void Save() { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Create(path); serializedUser user = new serializedUser(); user.username = User.Instance.username; user.email = User.Instance.email; user.objectID = User.Instance.objectId; user.accountType = User.Instance.accountType; bf.Serialize(file, user); file.Close(); }