Beispiel #1
0
 public MetricsBase()
 {
     _tflWs       = Utility.TflWs;
     Season       = Utility.CurrentSeason();
     TeamList     = new ArrayList();
     DoBreakdowns = false;
 }
Beispiel #2
0
 public MetricsBase(IBreakdown breakdowns)
 {
     _tflWs     = Utility.TflWs;
     Season     = Utility.CurrentSeason();
     TeamList   = new ArrayList();
     Breakdowns = breakdowns;
 }
Beispiel #3
0
 public MetricsBase(IBreakdown breakdowns, string season)
 {
     _tflWs     = Utility.TflWs;
     Season     = season;
     TeamList   = new ArrayList();
     Breakdowns = breakdowns;
 }
Beispiel #4
0
 public EventReport(string teamCode, string statCode, DataLibrarian tflWS)
 {
     Team = new NflTeam(teamCode);
     Team.LoadGames(teamCode, Utility.LastSeason());
     this.tflWS = tflWS;
     StatCode   = statCode;
 }
        public NflPerformance(int seasonIn, int weekIn, string teamIn, NFLPlayer myPlayer)
        {
            // constructor
            TeamCode   = teamIn;
            Season     = seasonIn;
            Week       = weekIn;
            _thePlayer = myPlayer;
            _tflWs     = Utility.TflWs;

            PerfStats = new PlayerStats();

            if (teamIn == "??")
            {
                return;
            }

            // What was the result
            var ds = _tflWs.ResultFor(TeamCode, seasonIn, weekIn);

            if (ds.Tables[0].Rows.Count > 0)
            {
                var dr       = ds.Tables[0].Rows[0];
                var gameCode = string.Format("{0}:{1}-{2}", seasonIn, dr["WEEK"], dr["GAMENO"]);

                Game = Masters.Gm.GetGame(gameCode) ?? new NFLGame(dr);
                LoadScores();
                LoadStats();
            }
            else
            {
                TeamCode = "bye";
            }
        }
Beispiel #6
0
 public DataLoader()
 {
     OldLibrarian = new DataLibrarian(
         Utility.NflConnectionString(),
         Utility.TflConnectionString(),
         Utility.CtlConnectionString(),
         new NLogAdaptor());
 }
        public List <NFLPlayer> GetPlayers()
        {
            var ds    = DataLibrarian.GetReturners();
            var dt    = ds.Tables[0];
            var pList = (from DataRow dr in dt.Rows select new NFLPlayer(dr)).ToList();

            return(pList);
        }
 public UndefeatedHomeDogScheme(DataLibrarian tflWSIn)
 {
     //
     //  An Undefeated home dog is bound to lose
     //
     tflWS = tflWSIn;
     Name  = "Undefeated Home Dog";
 }
 public HomeDogScheme(DataLibrarian tflWSIn)
 {
     //
     //  Root for the home team when they are under dogs
     //
     tflWS = tflWSIn;
     Name  = "Home Dog";
 }
 public GridStatsLeague(string nameIn, string compCode, string season, int weekNo)
 {
     Name     = nameIn;
     CompCode = compCode;
     Season   = Utility.CurrentSeason();
     WeekNo   = weekNo;
     _tflWs   = Utility.TflWs;
 }
 public NibbleLockScheme(DataLibrarian tflWsIn)
 {
     Pushes = 0;
     Losses = 0;
     //  we have a bet if teams have played in the last year and have a revenge motive
     TflWs = tflWsIn;
     Name  = "Nibble LOCK";
     _pred = new NibblePredictor();
 }
 public void Initialise()
 {
     //  Integrate with a real database
     Sut = new DataLibrarian(
         NflConnectionString(),
         TflConnectionString(),
         CtlConnectionString(),
         new TestLogger());
 }
Beispiel #13
0
        public NFLWeek(int seasonIn, int weekIn)
        {
            TflWs  = Utility.TflWs;
            Season = seasonIn.ToString();
            _sched = LoadSchedule(seasonIn, weekIn);
#if DEBUG
            //Utility.Announce($"NFLWeek:Constructor Week {weekIn}:{Season} has {_sched.Tables[ 0 ].Rows.Count} games");
#endif
            Week = weekIn.ToString();
        }
 public BadNumberScheme(DataLibrarian tflWsIn)
 {
     //
     //  Bad numbers are numbers that show a statistical trend of 60% or more
     //
     //   eg Home favourites by 9.5 point fail to cover > 60% of the time
     //
     _tflWs = tflWsIn;
     Name   = "Bad Number";
 }
Beispiel #15
0
 public SandwichScheme(DataLibrarian tflWSIn)
 {
     //
     //  Non Divisional Games sandwiched between
     //  4 Divisional games has the contestant
     //  in a lull
     //
     tflWS = tflWSIn;
     Name  = "Sandwich";
 }
Beispiel #16
0
        public EspnLeague(string nameIn, string compCode, string season, int weekNo)
        {
            RosterLib.Utility.Announce(string.Format("EspnReport {0}...", nameIn));

            Name     = nameIn;
            CompCode = compCode;
            Season   = season;
            WeekNo   = weekNo;

            _tflWs = Utility.TflWs;
        }
Beispiel #17
0
 public OverUnderScheme(DataLibrarian tflWsIn)
 {
     Pushes = 0;
     Losses = 0;
     M_wins = 0;
     //
     //   If the variance is greater than 3 we have a bet
     //
     TflWs = tflWsIn;
     Name  = "Over Under";
 }
Beispiel #18
0
        public NFLWeek(int seasonIn, int weekIn)
        {
            TflWs  = Utility.TflWs;
            Season = seasonIn.ToString();
            _sched = LoadSchedule(seasonIn, weekIn);

            Utility.Announce(string.Format("NFLWeek:Constructor Week {0}:{2} has {1} games", weekIn,
                                           _sched.Tables[0].Rows.Count, Season));

            Week = weekIn.ToString();
        }
Beispiel #19
0
        public NFLWeek(int seasonIn, int weekIn, bool loadGames)
        {
            Season = seasonIn.ToString();
            Week   = weekIn.ToString();
            if (loadGames)
            {
                TflWs  = Utility.TflWs;
                _sched = LoadSchedule(seasonIn, weekIn);

                //RosterLib.Utility.Announce( string.Format( "NFLWeek:Constructor Week {0}:{2} has {1} games", weekIn,
                //                                    sched.Tables[ 0 ].Rows.Count, season ) );
            }
        }
Beispiel #20
0
        public DataFixHandler()
        {
            if (Logger == null)
            {
                Logger = LogManager.GetCurrentClassLogger();
            }

            var lib = new DataLibrarian(
                nflConnection: Utility.NflConnectionString(),
                tflConnection: Utility.TflConnectionString(),
                ctlConnection: Utility.CtlConnectionString(),
                logger: new NLogAdaptor());
            var tfl = new TflService(lib, Logger);

            Fixer = new DataFixer(tfl, new NLogAdaptor());
        }
Beispiel #21
0
 public MatchupReport(NFLGame gameIn)
 {
     Utility.Announce("Match Report for :" + gameIn.AwayTeamName + " @ " + gameIn.HomeTeamName);
     if (gameIn.HomeNflTeam == null)
     {
         Utility.Announce("Teams have not been instantiated");
     }
     else
     {
         TflWs = Utility.TflWs;
         if (_showTeamCards)
         {
             gameIn.AwayNflTeam.LoadTeamCard();                   //  lazy load
             gameIn.AwayNflTeam.SetDefence();                     //  lazy load
             gameIn.HomeNflTeam.LoadTeamCard();                   //  lazy load
             gameIn.HomeNflTeam.SetDefence();                     //  lazy load
         }
         _game = gameIn;
     }
 }
        public NewsItemHandler()
        {
            Logger = LogManager.GetCurrentClassLogger();
            var assemblyVersion = "2.190307.1";

            WriteInfoLog($@"NewsItemHandler v {
				assemblyVersion
				} ================================================="                );
            //var lib = Utility.TflWs;
            var lib = new DataLibrarian(
                nflConnection: Utility.NflConnectionString(),
                tflConnection: Utility.TflConnectionString(),
                ctlConnection: Utility.CtlConnectionString(),
                logger: new NLogAdaptor());
            var tfl = new TflService(lib, Logger);

            WriteTraceLog("TFL service created");
            Examiner = new ArticleExaminer(tfl, new NLogAdaptor());
            Manager  = new TransactionManager(tfl);
            var msg = "NewsItemHandler instantiated ok";

            WriteTraceLog(msg);
            Console.WriteLine(msg);
        }
 public HumiliationScheme(DataLibrarian tflWSIn)
 {
     //  we have a bet if teams have played in the last year and have a revenge motive
     tflWS = tflWSIn;
     Name  = "Humiliation";
 }
Beispiel #24
0
        public static Action <object> ParseMessageToAction(Message message)
        {
            if (message.Type == MsgType.Reply)
            {
                throw new InvalidOperationException("Server received MsgType.Reply... those are meant to only flow the other way.");
            }
            if (message.Type == MsgType.Notify)
            {
                return(null);                                // Notify messages ONLY raise the OnReceiveMessage event and nothing else.
            }
            if (message.Type == MsgType.LaunchActivity)
            {
                var substrings           = message.Content.Split(onNEXT);
                var type                 = Type.GetType(substrings[0]);
                var tdata                = Type.GetType(substrings[1]);
                var serializedPassedInfo = substrings[2]; // Currently nothing is done with this, since it'll be a right pain in the arse to do.

                return((o) =>
                {
                    // Todo - embed the PassedInfo into somewhere (Res? try again for Bundle syntax?) before this.
                    Application.Context.StartActivity(type);
                });
            }
            if (message.Type == MsgType.PushSFX)
            {
                IEffect FX;
                if (!Res.SFX.Effects.TryGetValue($"RequestedFX{NEXT}{message.Content}", out FX))
                {
                    if (!int.TryParse(message.Content, out int ResourceID))
                    {
                        ResourceID = typeof(Resource.Id).GetStaticProperty <int>(message.Content);
                    }
                    FX = Res.SFX.Register($"RequestedFX{NEXT}{message.Content}", ResourceID);
                }
                if (FX == null)
                {
                    return(null);
                }

                return((o) =>
                {
                    FX.Activate();
                    FX.Play();
                });
            }
            if (message.Type == MsgType.PushSpeech)
            {
                return((o) =>
                {
                    Speech.Say(message.Content);
                });
            }
            if (message.Type == MsgType.PushEffect)
            {
                var substrings   = message.Content.Split(onNEXT, 2);
                var effectName   = substrings[0];
                var effectParams = substrings[1];
                //if (!MasterSpellLibrary.CastingResults.ContainsKey(effectName))
                //{
                //    Log.Warn(_tag, $"Unable to locate game effect '{effectName}'.");
                //    return null;
                //}
                if (!GameEffect.Definition.ContainsKey(effectName))
                {
                    Log.Warn(_tag, $"Unable to locate effect '{effectName}'.");
                    return(null);
                }

                //var doFunc = MasterSpellLibrary.CastingResults[effectName];
                return((o) =>
                {
                    GameEffect
                    .Definition[effectName]?
                    .OnReceiving(TemporaryAddressBook_SingleEntry ?? new CommsContact(), effectParams);
                });
            }
            if (message.Type == MsgType.PushEffect2)
            {
                var effectInstance = GameEffectInstance.FromStringForm(message.Content);

                //var doFunc = MasterSpellLibrary.CastingResults[effectName];
                return((o) =>
                {
                    effectInstance?
                    .SourceEffect?
                    .OnReceiving2(effectInstance);
                });
            }
            if (message.Type == MsgType.Query)
            {
                return((o) =>
                {
                    var target = AddressBook.Resolve(message.From);
                    target.SendMessage(DataLibrarian.FetchRequestedData(message, o));
                });
            }
            if (message.Type == MsgType.SetScenarioVariable)
            {
                var substrings = message.Content.Split(onNEXT);
                Encounters.Scenario.Current.SetVariable(substrings[0],
                                                        (Encounters.Scenario.State)Enum.Parse(typeof(Encounters.Scenario.State), substrings[1]), false); // False meaning don't rebroadcast it.
            }
            throw new NotImplementedException();
        }
Beispiel #25
0
 public SuperbowlLetdownScheme(DataLibrarian tflWSIn)
 {
     //  we have a bet if either of the teams are the superbowl winner and the week is one or 2
     tflWS = tflWSIn;
     Name  = "SuperbowlLetdown";
 }
Beispiel #26
0
 public RevengeScheme(DataLibrarian tflWSIn)
 {
     //  we have a bet if teams have played in the last year and have a revenge motive
     tflWS = tflWSIn;
     Name  = "Revenge";
 }