Exemplo n.º 1
0
        public void AddUserScoreToLeaderBoard(UserScore userScore)
        {
            var currentLeaderBoard = GetLeaderBoard();

            currentLeaderBoard.Add(userScore);

            var leaderBoardText = JsonConvert.SerializeObject(currentLeaderBoard.OrderBy(x => x.Seconds).Take(3).ToList());

            using (var streamWriter = new StreamWriter(LeaderBoardFileName))
            {
                streamWriter.WriteLine(leaderBoardText);
                streamWriter.Flush();
            }
        }
Exemplo n.º 2
0
 public void SetUsername(string userName)
 {
     UserScore = new UserScore {
         Username = userName, StartTime = DateTime.Now
     };
 }