public static void Save(DataSave newSave) { BinaryFormatter bf = new BinaryFormatter(); FileStream fileStream = File.Create(content.RootDirectory + "/savefile.dat"); currentDataSave = newSave; bf.Serialize(fileStream, newSave); fileStream.Close(); }
public static void LoadContent(ContentManager Content) { content = Content; if (File.Exists(content.RootDirectory + "/savefile.dat")) { BinaryFormatter bf = new BinaryFormatter(); FileStream fileStream = File.Open(content.RootDirectory + "/savefile.dat", FileMode.Open); currentDataSave = new DataSave((DataSave)bf.Deserialize(fileStream)); fileStream.Close(); } else { currentDataSave = new DataSave(); } }
public DataSave(DataSave dataSave) { this.highScores = dataSave.highScores; }