Esempio n. 1
0
 void ReadPlayersData(string fileName, PlayersContainer players)
 {
     using (StreamReader reader = new StreamReader(@fileName))
     {
         string line = null;
         if (fileName == "Krepšininkai.csv")
         {
             while (null != (line = reader.ReadLine()))
             {
                 string[]      values  = line.Split(',');
                 string        team    = values[0];
                 string        name    = values[1];
                 string        surname = values[2];
                 DateTime      birth   = DateTime.Parse(values[3]);
                 int           amountOfPlayedMatches = int.Parse(values[4]);
                 int           score              = int.Parse(values[5]);
                 int           rebounds           = int.Parse(values[6]);
                 int           effectiveTransfers = int.Parse(values[7]);
                 Basketballist basketballist      = new Basketballist(team, name, surname, birth, amountOfPlayedMatches, score, rebounds, effectiveTransfers);
                 players.AddPlayer(basketballist);
             }
         }
         else if (fileName == "Futbolininkai.csv")
         {
             while (null != (line = reader.ReadLine()))
             {
                 string[]    values  = line.Split(',');
                 string      team    = values[0];
                 string      name    = values[1];
                 string      surname = values[2];
                 DateTime    birth   = DateTime.Parse(values[3]);
                 int         amountOfPlayedMatches = int.Parse(values[4]);
                 int         score       = int.Parse(values[5]);
                 int         yellowCards = int.Parse(values[6]);
                 Footballist footballist = new Footballist(team, name, surname, birth, amountOfPlayedMatches, score, yellowCards);
                 players.AddPlayer(footballist);
             }
         }
     }
 }
Esempio n. 2
0
 public void AddBasketballist(Basketballist basketballist)
 {
     Basketballists.AddPlayer(basketballist);
 }