public ICollection <PlayerStatistic> Cast() { string path = @"..\..\DataSource\playerstats20120510040.txt"; var x = new TxtParse(); string[,] array = x.Parse(path); int min = 4; int SpossF = 5; int SpointsF = 7; int SorebF = 12; for (int index = 2; index < array.GetLength(0); index++) { if (string.IsNullOrEmpty(array[index, 0])) { break; } var playerStats = new PlayerStatistic() { Minutes = float.Parse(array[index, min], CultureInfo.InvariantCulture), SimplePossFor = int.Parse(array[index, SpossF], CultureInfo.InvariantCulture), SimplePointsFor = int.Parse(array[index, SpointsF], CultureInfo.InvariantCulture), SimpleORebFor = int.Parse(array[index, SorebF], CultureInfo.InvariantCulture) }; playersStatsCollection.Add(playerStats); } return(playersStatsCollection); }
public ICollection <Team> Cast() { string path = @"..\..\DataSource\teamstats20120510040.txt"; var x = new TxtParse(); string[,] array = x.Parse(path); int name = 0; int min = 1; int offrtg = 6; int deffrtg = 7; int overalRtg = 8; for (int index = 1; index < array.GetLength(0); index++) { if (string.IsNullOrEmpty(array[index, 0])) { break; } var team = new Team(); team.Name = array[index, name]; team.Minutes = float.Parse(array[index, min], CultureInfo.InvariantCulture); team.OffRtg = float.Parse(array[index, offrtg], CultureInfo.InvariantCulture); team.DeffRtg = float.Parse(array[index, deffrtg], CultureInfo.InvariantCulture); team.OverallRtg = float.Parse(array[index, overalRtg], CultureInfo.InvariantCulture); TeamsCollection.Add(team); } return(TeamsCollection); }
public ICollection <Player> Cast() { var x = new TxtParse(); string[,] array = x.Parse(@"..\..\DataSource\players20120510040.txt"); int name = 1; int lastName = 2; int position = 6; for (int index = 2; index < array.GetLength(0); index++) { if (string.IsNullOrEmpty(array[index, 0])) { break; } var player = new Player(); player.FirstName = array[index, name]; player.LastName = array[index, lastName]; player.Position = float.Parse(array[index, position], CultureInfo.InvariantCulture); playersColection.Add(player); } return(playersColection); }