Esempio n. 1
0
        public MTHCrypto(int hwnd, ICore core) : base(hwnd, core)
        {
            TableName = WindowTitle.Substring(0, WindowTitle.IndexOf('-'));
            //TODO: Get GameForm, GameType, GameLimit

            // Get the action button pixel color
            Bitmap bmp = (Bitmap)Bitmap.FromFile(Path.Combine(Win32.GetModuleDirectory(hwnd), "img\\p_btn_betting.jpg"));

            actionButtonPixelColor = bmp.GetPixel(116, 51);
            bmp.Dispose();

            // Get the "more chips" active button color
            bmp = (Bitmap)Bitmap.FromFile(Path.Combine(Win32.GetModuleDirectory(hwnd), "img\\p_btn_morechips.jpg"));
            activeMoreChipsButtonPixelColor = bmp.GetPixel(0, 0);
            bmp.Dispose();

            // Get the "sit out" button color
            bmp = (Bitmap)Bitmap.FromFile(Path.Combine(Win32.GetModuleDirectory(hwnd), "img\\p_btn_sitout.jpg"));
            sitOutButtonPixelColor = bmp.GetPixel(0, 0);
            bmp.Dispose();
        }
        public MTHPartyPoker(int hwnd, ICore core) : base(hwnd, core)
        {
            TableName = WindowTitle.Substring(0, WindowTitle.IndexOf('-'));

            // Set WinHook to listen for show/hide window
            wh = new WinHook();

            wh.HwndParam = (IntPtr)WindowHandle;
            wh.Monitor   = HookMonitor.HwndAndChildren;
            wh.HookType  = HookTypes.CallWndProc;
            wh.Messages  = new WindowsMessageList();
            wh.Messages.AddMessage(StandardMessages.WM_SHOWWINDOW);
            wh.OnMessageHook += new MessageHookEventHandler(wh_OnMessageHook);
            wh.Enabled        = true;

            // Update children
            UpdateChildren();

            // Check if we're seated
            bool foundChild = false;

            foreach (ChildWindow cw in children.Values)
            {
                if (cw.ControlID == 443 && cw.IsVisible)
                {
                    foundChild = true;
                    break;
                }
            }

            if (foundChild)
            {
                isSeated = true;
                OnSeated();
            }
            else
            {
                isSeated = false;
                OnUnSeated();
            }

            // Check if we're sitting out
            if (isSeated)
            {
                foundChild = false;
                foreach (ChildWindow cw in children.Values)
                {
                    if (cw.ControlID == 4000 && cw.IsVisible && cw.Text.ToLower().Replace(" ", "") == "iamback")
                    {
                        foundChild = true;
                        break;
                    }
                }

                if (foundChild)
                {
                    isSittingOut = true;
                    OnSittingOut();
                }
                else
                {
                    isSittingOut = false;
                    OnSittingIn();
                }
            }

            // TODO: Check for requiring action
        }