Beispiel #1
0
        /// <summary>
        /// Attempt to press the play button until the client connects.
        /// </summary>
        private async void PressPlay()
        {
            await Task.Delay(TimeSpan.FromSeconds(5));

            if (!config.AutoConnect)
            {
                return;
            }
            if (!enabled)
            {
                return;
            }

            if ((connectedClient?.Connected ?? false))
            {
                Log("Client is connected. No need to press play.");
                return;
            }
            else
            {
                Log("Client still not connected. Pressing play button...");
            }

            // Get the window details before pressing the button in case
            // it has changed size or position on the desktop.
            RECT windowRect = new RECT();

            GetWindowRect(flashPtr, ref windowRect);
            var size = windowRect.GetSize();

            // The play button is located half way across the
            // window and roughly 92% of the way to the bottom.
            int playButtonX = size.Width / 2 + windowRect.Left;
            int playButtonY = (int)((double)size.Height * 0.92) + windowRect.Top;

            // Convert the screen point to a window point.
            POINT relativePoint = new POINT(playButtonX, playButtonY);

            ScreenToClient(flashPtr, ref relativePoint);

            // Press the buttons.
            SendMessage(flashPtr, (uint)MouseButton.LeftButtonDown, new IntPtr(0x1), new IntPtr((relativePoint.Y << 16) | (relativePoint.X & 0xFFFF)));
            SendMessage(flashPtr, (uint)MouseButton.LeftButtonUp, new IntPtr(0x1), new IntPtr((relativePoint.Y << 16) | (relativePoint.X & 0xFFFF)));

            PressPlay();
        }
Beispiel #2
0
        /// <summary>
        /// KILLER BE KILLED MADE THISSSSS
        /// </summary>
        /// <param name="handle"></param>
        public static void PressPlay(IntPtr handle)
        {
            RECT windowRect = new RECT();

            GetWindowRect(handle, ref windowRect);
            var size = windowRect.GetSize();

            int playButtonX = size.Width / 2 + windowRect.Left;
            int playButtonY = (int)((double)size.Height * 0.92) + windowRect.Top;

            POINT relativePoint = new POINT(playButtonX, playButtonY);

            ScreenToClient(handle, ref relativePoint);

            SendMessage(handle, (uint)MouseButton.LeftButtonDown, new IntPtr(0x1), new IntPtr((relativePoint.Y << 16) | (relativePoint.X & 0xFFFF)));
            SendMessage(handle, (uint)MouseButton.LeftButtonUp, new IntPtr(0x1), new IntPtr((relativePoint.Y << 16) | (relativePoint.X & 0xFFFF)));
        }
Beispiel #3
0
        private async void PressPlay()
        {
            await Task.Delay(TimeSpan.FromSeconds(5));

            if (!config.AutoConnect)
            {
                return;
            }
            if (!enabled)
            {
                return;
            }

            if ((connectedClient?.Connected ?? false))
            {
                Log("Client is connected. No need to press play.");
                return;
            }
            else
            {
                Log("Client still not connected. Pressing play button...");
            }

            RECT windowRect = new RECT();

            WinApi.GetWindowRect(flashPtr, ref windowRect);
            var size = windowRect.GetSize();

            int playButtonX = size.Width / 2 + windowRect.Left;
            int playButtonY = (int)((double)size.Height * 0.92) + windowRect.Top;

            POINT relativePoint = new POINT(playButtonX, playButtonY);

            WinApi.ScreenToClient(flashPtr, ref relativePoint);

            WinApi.SendMessage(flashPtr, (uint)MouseButton.LeftButtonDown, new IntPtr(0x1), new IntPtr((relativePoint.Y << 16) | (relativePoint.X & 0xFFFF)));
            WinApi.SendMessage(flashPtr, (uint)MouseButton.LeftButtonUp, new IntPtr(0x1), new IntPtr((relativePoint.Y << 16) | (relativePoint.X & 0xFFFF)));

            PressPlay();
        }