Beispiel #1
0
        public void SaveData(ScoreHistory score = null)
        {
            // TraceOut.Enter();

            _score = score ?? _score;
            var serializer = new XmlSerializer(typeof(ScoreHistory));

            using (var writer = new StreamWriter(TEMP_SCORE_FILE))
            {
                serializer.Serialize(writer, _score);
            }

            // TraceOut.Leave();
        }
Beispiel #2
0
        public ScoreHistory LoadData()
        {
            // TraceOut.Enter();

            var score = new ScoreHistory();

            if (File.Exists(TEMP_SCORE_FILE))
            {
                var serializer = new XmlSerializer(typeof(ScoreHistory));

                using (var reader = new StreamReader(TEMP_SCORE_FILE))
                {
                    score = serializer.Deserialize(reader) as ScoreHistory;
                }
            }

            // TraceOut.Leave();
            return(score);
        }