示例#1
0
        // Token: 0x0600006D RID: 109 RVA: 0x00002EE0 File Offset: 0x000010E0
        private static int MouseHookProc(int nCode, int wParam, IntPtr lParam)
        {
            if (nCode >= 0)
            {
                HookManager.MouseLLHookStruct mouseLLHookStruct = (HookManager.MouseLLHookStruct)Marshal.PtrToStructure(lParam, typeof(HookManager.MouseLLHookStruct));
                MouseButtons buttons = MouseButtons.None;
                short        num     = 0;
                int          num2    = 0;
                bool         flag    = false;
                bool         flag2   = false;
                switch (wParam)
                {
                case 513:
                    flag    = true;
                    buttons = MouseButtons.Left;
                    num2    = 1;
                    break;

                case 514:
                    flag2   = true;
                    buttons = MouseButtons.Left;
                    num2    = 1;
                    break;

                case 515:
                    buttons = MouseButtons.Left;
                    num2    = 2;
                    break;

                case 516:
                    flag    = true;
                    buttons = MouseButtons.Right;
                    num2    = 1;
                    break;

                case 517:
                    flag2   = true;
                    buttons = MouseButtons.Right;
                    num2    = 1;
                    break;

                case 518:
                    buttons = MouseButtons.Right;
                    num2    = 2;
                    break;

                case 522:
                    num = (short)(mouseLLHookStruct.MouseData >> 16 & 65535);
                    break;
                }
                MouseEventExtArgs mouseEventExtArgs = new MouseEventExtArgs(buttons, num2, mouseLLHookStruct.Point.X, mouseLLHookStruct.Point.Y, (int)num);
                if (HookManager.s_MouseUp != null && flag2)
                {
                    HookManager.s_MouseUp(null, mouseEventExtArgs);
                }
                if (HookManager.s_MouseDown != null && flag)
                {
                    HookManager.s_MouseDown(null, mouseEventExtArgs);
                }
                if (HookManager.s_MouseClick != null && num2 > 0)
                {
                    HookManager.s_MouseClick(null, mouseEventExtArgs);
                }
                if (HookManager.s_MouseClickExt != null && num2 > 0)
                {
                    HookManager.s_MouseClickExt(null, mouseEventExtArgs);
                }
                if (HookManager.s_MouseDoubleClick != null && num2 == 2)
                {
                    HookManager.s_MouseDoubleClick(null, mouseEventExtArgs);
                }
                if (HookManager.s_MouseWheel != null && num != 0)
                {
                    HookManager.s_MouseWheel(null, mouseEventExtArgs);
                }
                if ((HookManager.s_MouseMove != null || HookManager.s_MouseMoveExt != null) && (HookManager.m_OldX != mouseLLHookStruct.Point.X || HookManager.m_OldY != mouseLLHookStruct.Point.Y))
                {
                    HookManager.m_OldX = mouseLLHookStruct.Point.X;
                    HookManager.m_OldY = mouseLLHookStruct.Point.Y;
                    if (HookManager.s_MouseMove != null)
                    {
                        HookManager.s_MouseMove(null, mouseEventExtArgs);
                    }
                    if (HookManager.s_MouseMoveExt != null)
                    {
                        HookManager.s_MouseMoveExt(null, mouseEventExtArgs);
                    }
                }
                if (mouseEventExtArgs.Handled)
                {
                    return(-1);
                }
            }
            return(HookManager.CallNextHookEx(HookManager.s_MouseHookHandle, nCode, wParam, lParam));
        }
        private static int MouseHookProc(int nCode, int wParam, IntPtr lParam)
        {
            if (nCode >= 0)
            {
                HookManager.MouseLLHookStruct structure = (HookManager.MouseLLHookStruct)Marshal.PtrToStructure(lParam, typeof(HookManager.MouseLLHookStruct));
                MouseButtons buttons = MouseButtons.None;
                short        num     = 0;
                int          clicks  = 0;
                bool         flag1   = false;
                bool         flag2   = false;
                switch (wParam)
                {
                case 513:
                    flag1   = true;
                    buttons = MouseButtons.Left;
                    clicks  = 1;
                    break;

                case 514:
                    flag2   = true;
                    buttons = MouseButtons.Left;
                    clicks  = 1;
                    break;

                case 515:
                    buttons = MouseButtons.Left;
                    clicks  = 2;
                    break;

                case 516:
                    flag1   = true;
                    buttons = MouseButtons.Right;
                    clicks  = 1;
                    break;

                case 517:
                    flag2   = true;
                    buttons = MouseButtons.Right;
                    clicks  = 1;
                    break;

                case 518:
                    buttons = MouseButtons.Right;
                    clicks  = 2;
                    break;

                case 522:
                    num = (short)(structure.MouseData >> 16 & (int)ushort.MaxValue);
                    break;
                }
                MouseEventExtArgs e = new MouseEventExtArgs(buttons, clicks, structure.Point.X, structure.Point.Y, (int)num);
                if (HookManager.s_MouseUp != null && flag2)
                {
                    HookManager.s_MouseUp((object)null, (MouseEventArgs)e);
                }
                if (HookManager.s_MouseDown != null && flag1)
                {
                    HookManager.s_MouseDown((object)null, (MouseEventArgs)e);
                }
                if (HookManager.s_MouseClick != null && clicks > 0)
                {
                    HookManager.s_MouseClick((object)null, (MouseEventArgs)e);
                }
                if (HookManager.s_MouseClickExt != null && clicks > 0)
                {
                    HookManager.s_MouseClickExt((object)null, e);
                }
                if (HookManager.s_MouseDoubleClick != null && clicks == 2)
                {
                    HookManager.s_MouseDoubleClick((object)null, (MouseEventArgs)e);
                }
                if (HookManager.s_MouseWheel != null && (int)num != 0)
                {
                    HookManager.s_MouseWheel((object)null, (MouseEventArgs)e);
                }
                if ((HookManager.s_MouseMove != null || HookManager.s_MouseMoveExt != null) && (HookManager.m_OldX != structure.Point.X || HookManager.m_OldY != structure.Point.Y))
                {
                    HookManager.m_OldX = structure.Point.X;
                    HookManager.m_OldY = structure.Point.Y;
                    if (HookManager.s_MouseMove != null)
                    {
                        HookManager.s_MouseMove((object)null, (MouseEventArgs)e);
                    }
                    if (HookManager.s_MouseMoveExt != null)
                    {
                        HookManager.s_MouseMoveExt((object)null, e);
                    }
                }
                if (e.Handled)
                {
                    return(-1);
                }
            }
            return(HookManager.CallNextHookEx(HookManager.s_MouseHookHandle, nCode, wParam, lParam));
        }