示例#1
0
 public Scorekeeper(IEnumerable <Bet> fakeBets, IEnumerable <Prediction> fakePredictions, Scoreboard scoreboard)
 {
     Scoreboard  = scoreboard;
     Schedule    = Schedule.GetOnlineSchedule();
     Bets        = fakeBets.ToList();
     Predictions = fakePredictions.ToList();
     MatchRecord = new MatchRecord();
 }
示例#2
0
 public Scorekeeper()
 {
     Scoreboard  = new Scoreboard();
     MatchRecord = MatchRecord.GetOnlineMatchRecord();
     Schedule    = Schedule.GetOnlineSchedule();
     Bets        = new List <Bet>();
     Predictions = new List <Prediction>();
 }
示例#3
0
 public Scorekeeper(string path)
 {
     SavePath = path;
     if (File.Exists(SavePath))
     {
         Scoreboard = Scoreboard.FromFile(SavePath);
     }
     else
     {
         Scoreboard = new Scoreboard();
         Scoreboard.SaveToFile(SavePath);
     }
     MatchRecord = MatchRecord.GetOnlineMatchRecord();
     Schedule    = Schedule.GetOnlineSchedule();
     Bets        = new List <Bet>();
     Predictions = new List <Prediction>();
 }
示例#4
0
 public static Scoreboard FromFile(string path) // CSV
 {
     if (File.Exists(path))
     {
         Scoreboard scoreboard = new Scoreboard();
         string[]   lines      = File.ReadAllLines(path);
         foreach (string line in lines)
         {
             string[]    columns  = line.Split(',');
             ulong       playerId = ulong.Parse(columns[0]);
             PlayerScore player   = new PlayerScore(playerId, columns[1], money: decimal.Parse(columns[2]),
                                                    pRight: int.Parse(columns[3]), pWrong: int.Parse(columns[4]), betCount: int.Parse(columns[5]));
             scoreboard.Add(playerId, player);
         }
         return(scoreboard);
     }
     else
     {
         throw new FileNotFoundException("Cannot load Scoreboard from file because the file does not exist.");
     }
 }
示例#5
0
 public Scorekeeper(Scoreboard scores) : this()
 {
     Scoreboard = scores;
 }