Beispiel #1
0
        public void TallyTeam(
            ICollection <NflTeam> teamList,
            string season,
            DateTime focusDate,
            string teamCode)
        {
            var team = new NflTeam(teamCode);                //  simple code constructor

            if (TimeKeeper.IsItRegularSeason())
            {
                team.LoadGames(team.TeamCode, season);
                GameScope = GameScopeFromGameList(
                    team.GameList);
            }
            else
            {
                GameScope = $@"Regular season Games {
					Int32.Parse(season)-1
					}"                    ;
                team.LoadPreviousRegularSeasonGames(
                    team.TeamCode,
                    season,
                    focusDate);
            }
            team.TallyStats(Breakdowns);
            teamList.Add(team);
            var breakdownKey  = $"{team.TeamCode}-Q";
            var breakdownFile = $@"{Utility.OutputDirectory()}\\{
							TimeKeeper.CurrentSeason()
							}\\Metrics\\breakdowns\\{breakdownKey}.htm"                            ;

            Breakdowns.Dump(
                breakdownKey,
                breakdownFile);
        }
        public void Dump(
            string breakdownKey,
            string outputFileName)
        {
            if (!Breakdowns.ContainsKey(breakdownKey))
            {
                return;
            }

            var theLines = (List <String>)Breakdowns[breakdownKey];

            Utility.EnsureDirectory(outputFileName);

            var sw = new StreamWriter(outputFileName, false);

            sw.WriteLine("<pre>");

            var i            = 1;
            var myEnumerator = theLines.GetEnumerator();

            while (myEnumerator.MoveNext())
            {
                var numPart = "  ";
                if (NumberLines)
                {
                    numPart = $"{i++:0#}";
                }
                sw.WriteLine($"{numPart}  {myEnumerator.Current}");
            }

            sw.WriteLine("</pre>");
            sw.Close();

            //Utility.Announce( $"   {outputFileName} has been rendered" );
        }
Beispiel #3
0
 private void DumpBreakdowns(string teamCode)
 {
     Breakdowns.Dump(teamCode + "-Tdr", string.Format("{0}{2}/breakdowns/{1}-TDR.htm",
                                                      Utility.OutputDirectory(), teamCode, Season));
     Breakdowns.Dump(teamCode + "-Tdp", string.Format("{0}{2}/breakdowns/{1}-TDP.htm",
                                                      Utility.OutputDirectory(), teamCode, Season));
 }
 private void DumpBreakdowns(string teamCode)
 {
     Breakdowns.Dump(
         teamCode + "-Tdr",
         $"{Utility.OutputDirectory()}{Season}/breakdowns/{teamCode}-TDR.htm");
     Breakdowns.Dump(
         teamCode + "-Tdp",
         $"{Utility.OutputDirectory()}{Season}/breakdowns/{teamCode}-TDP.htm");
 }
        public void LogBreakDown(IParticipant participant, TimeSpan time)
        {
            var breakdownData = new BreakdownData();

            breakdownData.ParticipantName = participant.Name;
            breakdownData.Time            = time;
            breakdownData.Vehicle         = participant.Equipment;
            Breakdowns.Add(breakdownData);
        }
        public void AddLine(string breakdownKey, string line)
        {
            if (!Breakdowns.ContainsKey(breakdownKey))
            {
                Breakdowns.Add(breakdownKey, new List <String>());
            }

            var theLines = (List <String>)Breakdowns[breakdownKey];

            theLines.Add(line);
            Breakdowns[breakdownKey] = theLines;
        }
Beispiel #7
0
        private void AddBreakdown(string teamCode, EpMetric ep, NFLGame g)
        {
            var scorers = string.Empty;

            if (ep.OffTDr > 0)
            {
                scorers = g.ScorersOff(Constants.K_SCORE_TD_RUN, teamCode);
            }

            Breakdowns.AddLine(string.Format("{0}-Tdr", teamCode),
                               string.Format("{0}  {1:#0} {2}",
                                             g.GameName(), ep.OffTDr, scorers));

            if (ep.OffTDp > 0)
            {
                scorers = g.ScorersOff(Constants.K_SCORE_TD_PASS, teamCode);
            }

            Breakdowns.AddLine(string.Format("{0}-Tdp", teamCode),
                               string.Format("{0}  {1:#0} {2}",
                                             g.GameName(), ep.OffTDp, scorers));
        }