示例#1
0
        private void DeserializeFile()
        {
            IFormatter     formatter      = new BinaryFormatter();
            Stream         fs             = new FileStream(FILE_NAME, FileMode.Open, FileAccess.Read);
            GameStatistics gameStatistics = (GameStatistics)formatter.Deserialize(fs);

            fs.Close();

            this.attacksWon       = gameStatistics.attacksWon;
            this.cardsDrawn       = gameStatistics.cardsDrawn;
            this.defensesRepelled = gameStatistics.defensesRepelled;
            this.gamesLost        = gameStatistics.gamesLost;
            this.gamesWon         = gameStatistics.gamesWon;
        }