public void Save(GameImpl g) { IFormatter formatter = new BinaryFormatter(); Stream stream = new FileStream(filePath, FileMode.Create, FileAccess.Write); formatter.Serialize(stream, g); stream.Close(); }
public GameImpl Load() { IFormatter formatter = new BinaryFormatter(); Stream stream = new FileStream(filePath, FileMode.Open, FileAccess.Read); GameImpl g = (GameImpl)formatter.Deserialize(stream); stream.Close(); return(g); }