コード例 #1
0
        public void Save(GameImpl g)
        {
            IFormatter formatter = new BinaryFormatter();
            Stream     stream    = new FileStream(filePath, FileMode.Create, FileAccess.Write);

            formatter.Serialize(stream, g);
            stream.Close();
        }
コード例 #2
0
        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);
        }