Esempio n. 1
0
 public static void CheckResultInTop10Only(string param_Date, int param_Score)
 {
     if (Top10Only.CheckingIfScoreIsAcceptable(param_Score))
     {
         Top10OnlyEntry entry = new Top10OnlyEntry();
         entry.Date  = param_Date;
         entry.Score = param_Score;
         Top10Only.EnterTop10Only(entry);
     }
 }
Esempio n. 2
0
 public static void EnterTop10Only(Top10OnlyEntry entry)
 {
     entries.Add(entry);
     if (entries.Count > 10)
     {
         int min = int.MaxValue;
         int pos = 0;
         for (int i = 0; i < entries.Count; i++)
         {
             if (entries[i].Score < min)
             {
                 min = entries[i].Score;
                 pos = i;
             }
         }
         entries.RemoveAt(pos);
     }
     SaveTop10OnlyEntry();
 }
Esempio n. 3
0
 private static void GetTop10Only()
 {
     entries.Clear();
     if (File.Exists(file))
     {
         StreamReader read = new StreamReader(file);
         using (read)
         {
             string line = read.ReadLine();
             while (line != null)
             {
                 string[]       res   = line.Split();
                 Top10OnlyEntry entry = new Top10OnlyEntry
                 {
                     Date  = res[0],
                     Score = int.Parse(res[1])
                 };
                 entries.Add(entry);
                 line = read.ReadLine();
             }
         }
     }
 }