Example #1
0
        private void tableNoLongerRequiresAction(IPokerTable table)
        {
            // Remove the border
            table.HideBorder();

            // If it was the active table, remove if not KeepActiveTable
            if (ActiveTable == table)
            {
                // Reset activeTable
                activeTable = null;

                // Move to free spot if we don't want to keep the active table
                if (!Settings.KeepActiveTable && Settings.MoveActiveTable)
                {
                    if (Settings.AutoArrangeTables)
                    {
                        moveTableToFreeQuadrant(table, 0);
                    }
                    else
                    {
                        table.MoveToLastLocation();
                    }
                }

                // Remove from the queue
                actionQueue.RemoveAll(tbl => tbl == table);
            }

            // Update list of tables
            updateTableList();
        }
Example #2
0
        /// <summary>
        /// Make sure to poll tables when the form loads
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Form1_Load(object sender, System.EventArgs e)
        {
            // Load poker site plugins
            foreach (string file in Directory.GetFiles(Application.StartupPath + "\\Plugins\\Sites", "*.dll"))
            {
                IPokerTable sitePlugin = PluginHandler.LoadPlugin <IPokerTable>(file);

                if (sitePlugin != null)
                {
                    sitePlugin.Core = this;
                    SitePlugins.Add(sitePlugin);
                }
            }

            // Start thread that polls for new table windows
            Thread tablePoller = new Thread(new ThreadStart(delegate()
            {
                // Poll tables right away
                pollTables();

                // Sleep preset time between table polls
                Thread.Sleep(timeBetweenTablePolls);
            }));

            tablePoller.Start();

            //TODO: Load form size & position

            //TODO: Set global key hook listener
            // Set the global key hook
            //actHook = new UserActivityHook();
            //actHook.KeyDown += new KeyEventHandler(myKeyDown);
        }
Example #3
0
        void tableSittingIn(IPokerTable table)
        {
            //TODO: Move table to free quadrant

            // Update list of tables
            updateTableList();
        }
Example #4
0
        private void tableRequiresAction(IPokerTable table)
        {
            // Add the table to the action queue
            actionQueue.RemoveAll(tbl => tbl == table);

            // Update the list of tables
            updateTableList();
        }
Example #5
0
        public XmlDocument BuildXml(HandModel2 handModel, IPokerTable tableModel, ISiteConfiguration configuration, out Game game)
        {
            Check.ArgumentNotNull(() => handModel);
            Check.ArgumentNotNull(() => tableModel);
            Check.Require(configuration != null, "Configuration must be set.");

            actionNo = 1;

            this.handModel     = handModel;
            this.tableModel    = tableModel;
            this.configuration = configuration;

            var rounds = new List <Round>
            {
                BuildZeroRound(),
                BuildPreflopRound(),
                BuildPostflopRound(),
                BuildTurnRound(),
                BuildRiverRound()
            };

            rounds = rounds.Where(x => x != null).ToList();

            var gameGeneral = BuildGameGeneral(rounds);

            game = new Game
            {
                GameCode = handModel.HandNumber,
                General  = gameGeneral,
                Rounds   = rounds
            };

            AdjustRaises(rounds);

            var handHistory            = CreateHandHistory(game);
            var handHistoryXmlDocument = GetHandHistoryXmlDocument(handHistory);

            // set place in tournament if hero finished tournament
            if (handModel.CashOrTournament == CashOrTournament.Tournament)
            {
                SetTournamentPlace(handHistoryXmlDocument);
            }

            // do not append existing hand
            if (!HandExists(handHistoryXmlDocument))
            {
                var gameXmlNode = GetGameXmlNode(game);

                var gameXmlNodeImported = handHistoryXmlDocument.ImportNode(gameXmlNode, true);

                handHistoryXmlDocument.DocumentElement.AppendChild(gameXmlNodeImported);
            }

            return(handHistoryXmlDocument);
        }
Example #6
0
        private void tableClosed(IPokerTable table)
        {
            // Remove table from queue in case it's there
            actionQueue.RemoveAll(tbl => tbl == table);

            // Remove table from tables collection in case it's there
            pokerTables.RemoveAll(tbl => tbl == table);

            // Update the list of tables
            updateTableList();
        }
Example #7
0
        private void tableSittingOut(IPokerTable table)
        {
            // If we should move sitting out tables to a special location, do so
            if (Settings.PlaceUnseatedTablesAtSpecialLocation)
            {
                table.MoveToQuadrant(Settings.GetQuad(Settings.NonSeatedTableQuadrant), false);
            }

            // Update list of tables
            updateTableList();
        }
Example #8
0
        private bool enumCallback(int hwnd, int lParam)
        {
            // Ignore already tested handles
            if (bannedHwnds.ContainsKey(hwnd))
            {
                return(true);
            }

            // Ignore current tables
            if (pokerTables.Where(table => table.WindowHandle == hwnd).Count() > 0)
            {
                return(true);
            }

            // Ignore hidden windows
            if (!Win32.IsWindowVisible(hwnd))
            {
                return(true);
            }

            // For each site plugin, test if the plugin deems the handle a poker table
            foreach (IPokerTable tableType in SitePlugins)
            {
                if (tableType.IsPokerTable(hwnd))
                {
                    // It's a poker table, create an instance and set event handlers
                    IPokerTable table = tableType.Create(hwnd);
                    table.Closed                 += tableClosed;
                    table.RequiresAction         += tableRequiresAction;
                    table.NoLongerRequiresAction += tableNoLongerRequiresAction;
                    table.SittingOut             += tableSittingOut;
                    table.SittingIn              += tableSittingIn;
                    table.Seated                 += new Delegates.SeatedEventHandler(table_Seated);
                    table.UnSeated               += new Delegates.UnSeatedEventHandler(table_UnSeated);

                    // Add the table to the pokerTables table
                    pokerTables.Add(table);

                    // Update table list
                    updateTableList();

                    return(true);
                }
            }

            // Ban this handle so we don't retest it
            bannedHwnds.Add(hwnd, 0);

            return(true);
        }
Example #9
0
 private void tableSeated(IPokerTable table)
 {
     // Update list of tables
     updateTableList();
 }
Example #10
0
        private void tableSittingOut(IPokerTable table)
        {
            // If we should move sitting out tables to a special location, do so
            if (Settings.PlaceUnseatedTablesAtSpecialLocation)
                table.MoveToQuadrant(Settings.GetQuad(Settings.NonSeatedTableQuadrant), false);

            // Update list of tables
            updateTableList();
        }
Example #11
0
        void tableSittingIn(IPokerTable table)
        {
            //TODO: Move table to free quadrant

            // Update list of tables
            updateTableList();
        }
Example #12
0
 private void tableSeated(IPokerTable table)
 {
     // Update list of tables
     updateTableList();
 }
Example #13
0
        private void tableRequiresAction(IPokerTable table)
        {
            // Add the table to the action queue
            actionQueue.RemoveAll(tbl => tbl == table);

            // Update the list of tables
            updateTableList();
        }
Example #14
0
        private void tableNoLongerRequiresAction(IPokerTable table)
        {
            // Remove the border
            table.HideBorder();

            // If it was the active table, remove if not KeepActiveTable
            if (ActiveTable == table)
            {
                // Reset activeTable
                activeTable = null;

                // Move to free spot if we don't want to keep the active table
                if (!Settings.KeepActiveTable && Settings.MoveActiveTable)
                    if (Settings.AutoArrangeTables)
                        moveTableToFreeQuadrant(table, 0);
                    else
                        table.MoveToLastLocation();

                // Remove from the queue
                actionQueue.RemoveAll(tbl => tbl == table);
            }

            // Update list of tables
            updateTableList();
        }
Example #15
0
        private void tableClosed(IPokerTable table)
        {
            // Remove table from queue in case it's there
            actionQueue.RemoveAll(tbl => tbl == table);

            // Remove table from tables collection in case it's there
            pokerTables.RemoveAll(tbl => tbl == table);

            // Update the list of tables
            updateTableList();
        }