示例#1
0
        public void HotList(
            string catCode,
            string position,
            bool freeAgentsOnly,
            bool startersOnly)
        {
            var gs = new GS4Scorer(Utility.CurrentNFLWeek());

            PlayerLister = new PlayerLister
            {
                CatCode        = catCode,
                Position       = position,
                FantasyLeague  = League,
                Season         = Utility.CurrentSeason(),
                FreeAgentsOnly = freeAgentsOnly,
                StartersOnly   = startersOnly,
                Week           = Utility.PreviousWeek(),
                WeekMaster     = WeekMaster,
                WeeksToGoBack  = 4
            };
            PlayerLister.SetScorer(gs);
            PlayerLister.Load();
            PlayerLister.SubHeader = $"{PlayerLister.Position} HotList for {PlayerLister.FantasyLeague}";
            PlayerLister.FileOut   = $"HotLists//HotList-{PlayerLister.FantasyLeague}-{PlayerLister.Position}";
            PlayerLister.Render(PlayerLister.FileOut);
        }
        public void Render(string catCode, string sPos, string leagueId, bool startersOnly)
        {
            var currentWeek = new NFLWeek(seasonIn: Int32.Parse(Season), weekIn: 17, loadGames: false);

            if (currentWeek.WeekNo > 0)
            {
                var gs = leagueId.Equals(Constants.K_LEAGUE_Yahoo)
                                                        ? (IRatePlayers) new YahooScorer(currentWeek)
                                                        : new GS4Scorer(currentWeek)
                {
                    ScoresOnly = true
                };

                if (Scorer.Master == null)
                {
                    Scorer.Master = new YahooMaster("Yahoo", "YahooOutput.xml");
                }

                PlayerLister.SetScorer(Scorer);
                PlayerLister.SetFormat("weekly");
                PlayerLister.AllWeeks     = false;             //  dont go back into last year anymore
                PlayerLister.StartersOnly = startersOnly;
                PlayerLister.Clear();
                PlayerLister.Collect(catCode, sPos, leagueId);

                var targetFile = string.Format(leagueId.Equals(Constants.K_LEAGUE_Yahoo)
                                        ? "ESPN {1} Performance {0}" : "GS {1} Performance {0}", currentWeek.Season, sPos);

                var destinationFile = string.Format("{3}{2}//Performance//{0}-{1:0#}.htm",
                                                    targetFile, WeekNo, Season, Utility.OutputDirectory());

                FileOut = PlayerLister.Render(destinationFile);
            }
            else
            {
                Utility.Announce("Season has not started yet");
            }
        }
 public void HotList(string catCode, string position, bool freeAgentsOnly, bool startersOnly)
 {
     var gs = new GS4Scorer(Utility.CurrentNFLWeek());
      PlayerLister = new PlayerLister
      {
     CatCode = catCode,
     Position = position,
     FantasyLeague = League,
     Season = Utility.CurrentSeason(),
     FreeAgentsOnly = freeAgentsOnly,
     StartersOnly = startersOnly,
     Week = Utility.PreviousWeek(),
     WeekMaster = WeekMaster,
     WeeksToGoBack = 4
      };
      PlayerLister.SetScorer(gs);
      PlayerLister.Load();
      PlayerLister.SubHeader = string.Format("{1} HotList for {0}",
     PlayerLister.FantasyLeague, PlayerLister.Position);
      PlayerLister.FileOut = string.Format("HotLists//HotList-{0}-{1}",
     PlayerLister.FantasyLeague, PlayerLister.Position);
      PlayerLister.Render(PlayerLister.FileOut);
 }
        private static string WeeklyEspnPerformance(
         string catCode, int week, string leagueId, [System.Runtime.InteropServices.Optional] string sPos )
        {
            var pl = new PlayerLister { WeeksToGoBack = 1 };
             var master = new YahooMaster( "Yahoo", "YahooOutput.xml" );
             var currentWeek =
            new NFLWeek( Int32.Parse( Utility.CurrentSeason() ), weekIn: week, loadGames: false );
             var gs = new YahooScorer( currentWeek ) { Master = master };

             pl.SetScorer( gs );
             pl.SetFormat( "weekly" );
             pl.AllWeeks = false; //  just the regular saeason
             pl.Season = currentWeek.Season;
             pl.RenderToCsv = false;
             pl.Week = week;
             pl.Collect( catCode, sPos: sPos, fantasyLeague: leagueId );

             var targetFile = string.Format( "{4}{3}//Performance//{2}-Yahoo {1} Performance upto Week {0}.htm",
            currentWeek.WeekNo, sPos, leagueId, pl.Season, Utility.OutputDirectory() );
             pl.Render( targetFile );
             return pl.FileOut;
        }