示例#1
0
        private static void ExtractGoaliesFromSection(Team team, TeamSection teamSection)
        {
            foreach (string line in teamSection.GoalieInformationLines)
            {
                IEnumerable <string> acronyms = line.GetAcronymns();
                Goalie goalie = new Goalie()
                {
                    Name        = line.Substring(0, 30).RemoveAcronyms().Replace("_", "").Trim(),
                    IsRookie    = acronyms.Contains("R"),
                    IsCaptain   = acronyms.Contains("C"),
                    IsAlternate = acronyms.Contains("A"),
                };

                // Convert string of values into stats
                string   rawStatsLine = line.Substring(30, line.Length - 30).Replace("%", "").Trim();
                string[] rawStats     = rawStatsLine.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                ConvertRawStats(rawStats, goalie);

                // Optional acronym found in traded players
                goalie.SeasonTotals.TeamAcronym = Helper.GetTeamAcronym(acronyms);

                team.Goalies.Add(goalie);
            }

            CombineTradedGoalieSubtotals(team);
        }
示例#2
0
        private static void ExtractTeamFromSection(Season season, TeamSection teamSection)
        {
            int  parenthesisIndex = teamSection.TeamInformationLine.IndexOf('(');
            Team team             = new Team()
            {
                Name    = teamSection.TeamInformationLine.Substring(0, parenthesisIndex).Replace(".", "").Trim().SplitCamelCase(),
                Acronym = teamSection.TeamInformationLine.GetAcronymns().First(),
                Skaters = new List <Skater>(),
                Goalies = new List <Goalie>(),
            };

            ExtractSkatersFromSection(team, teamSection);
            ExtractGoaliesFromSection(team, teamSection);
            RemoveFakePlayers(team);

            season.Teams.Add(team);
        }