/// <summary>
        /// It formats the players score, capitalizing only the first letter of Player's name.
        /// </summary>
        /// <param name="record">
        /// Player's score.
        /// </param>
        /// <returns>
        /// Player's score as a string, with only the first letter of Player's name capitalized.
        /// </returns>
        public string Format(IPersonalScore record)
        {
            string playerName = this.CapitalizeFirstLetter(record.Name);
            string result = string.Format("{0} ---> {1} mistake(s)!", playerName, record.Score);

            return result;
        }
Esempio n. 2
0
        /// <summary>
        /// It formats the players score with all letters in Uppercase.
        /// </summary>
        /// <param name="record">
        /// Player's score.
        /// </param>
        /// <returns>
        /// Player's score as string, formatted with all letters in Uppercase.
        /// </returns>
        public string Format(IPersonalScore record)
        {
            if (record == null)
            {
                throw new ArgumentNullException("record", "Incorrect IPersonalScore");
            }

            string playerName = this.CapitalizeAllLetters(record.Name);
            string result = string.Format("{0} ---> {1} MISTAKE(S)!", playerName, record.Score);

            return result;
        }
Esempio n. 3
0
 public override void SaveResult(IPersonalScore newRecord)
 {
     base.SaveResult(newRecord);
     DataFileManager.SingletonInstance.SaveResult(newRecord, Constants.DatabaseFile);
 }
Esempio n. 4
0
 /// <summary>
 /// Saves results. Can be overridden by inheritors.
 /// </summary>
 /// <param name="newRecord">
 /// Player's personal score.
 /// </param>
 public virtual void SaveResult(IPersonalScore newRecord)
 {
     this.ScoreBoardService.AddNewScore(newRecord);
 }
Esempio n. 5
0
 /// <summary>
 /// Saves the received IPersonalScore in the database.
 /// </summary>
 /// <param name="score">
 /// The score of the current player.
 /// </param>
 /// <param name="filePath">
 /// The path to the file, which acts as a database.
 /// </param>
 public override void SaveResult(IPersonalScore score, string filePath)
 {
     using (StreamWriter writer = new StreamWriter(filePath, true))
     {
         writer.WriteLine(score);
     }
 }
Esempio n. 6
0
 /// <summary>
 /// Saves the received IPersonalScore in the database.
 /// </summary>
 /// <param name="score">
 /// The score of the current player.
 /// </param>
 /// <param name="filePath">
 /// The path to the file, which acts as a database.
 /// </param>
 public abstract void SaveResult(IPersonalScore score, string filePath);
Esempio n. 7
0
 /// <summary>
 /// Adds new IPersonalScore to the collection contained in the 
 /// IScoreBoard that it currently works with.
 /// </summary>
 /// <param name="record">Instance of IPersonalScore</param>
 public void AddNewScore(IPersonalScore record)
 {
     this.currentScoreBoard.Records.Add(record);
 }