Beispiel #1
0
        public void GetInput()
        {
            byte[] SwB = new byte[4];
            int    sw;

            try
            {
                while (InputClient.Connected)
                {
                    InputClient.Receive(SwB, 4, SocketFlags.None);
                    sw = BitConverter.ToInt32(SwB, 0);
                    if (sw == 0)
                    {
                        byte[] KeyValue = new byte[4];
                        InputClient.Receive(KeyValue, 4, SocketFlags.None);
                        int KeyCode = BitConverter.ToInt32(KeyValue, 0);
                        InterceptKeyBoard.InputKeyDown(KeyCode);
                    }
                    else if (sw == 1)
                    {
                        byte[] KeyValue = new byte[4];
                        InputClient.Receive(KeyValue, 4, SocketFlags.None);
                        int KeyCode = BitConverter.ToInt32(KeyValue, 0);
                        InterceptKeyBoard.InputKeyUp(KeyCode);
                    }
                    else if (sw == 2)
                    {
                        byte[] Xp = new byte[4];
                        byte[] Yp = new byte[4];
                        InputClient.Receive(Xp, 4, SocketFlags.None);
                        InputClient.Receive(Yp, 4, SocketFlags.None);
                        int X, Y;
                        X = BitConverter.ToInt32(Xp, 0);
                        Y = BitConverter.ToInt32(Yp, 0);
                        InterceptMouse.MouseDown_Left(X, Y);
                        ChatBox.Items.Add("MouseDown " + X + " " + Y);
                    }
                    else if (sw == 3)
                    {
                        byte[] Xp = new byte[4];
                        byte[] Yp = new byte[4];
                        InputClient.Receive(Xp, 4, SocketFlags.None);
                        InputClient.Receive(Yp, 4, SocketFlags.None);
                        int X, Y;
                        X = BitConverter.ToInt32(Xp, 0);
                        Y = BitConverter.ToInt32(Yp, 0);
                        InterceptMouse.MouseUp_Left(X, Y);
                        ChatBox.Items.Add("Mouseup " + X + " " + Y);
                    }
                    else if (sw == 6)
                    {
                        byte[] Xp = new byte[4];
                        byte[] Yp = new byte[4];
                        InputClient.Receive(Xp, 4, SocketFlags.None);
                        InputClient.Receive(Yp, 4, SocketFlags.None);
                        int X, Y;
                        X = BitConverter.ToInt32(Xp, 0);
                        Y = BitConverter.ToInt32(Yp, 0);
                        InterceptMouse.MouseDown_Right(X, Y);
                        ChatBox.Items.Add("MouseRightDown " + X + " " + Y);
                    }
                    else if (sw == 7)
                    {
                        byte[] Xp = new byte[4];
                        byte[] Yp = new byte[4];
                        InputClient.Receive(Xp, 4, SocketFlags.None);
                        InputClient.Receive(Yp, 4, SocketFlags.None);
                        int X, Y;
                        X = BitConverter.ToInt32(Xp, 0);
                        Y = BitConverter.ToInt32(Yp, 0);
                        InterceptMouse.MouseUp_Right(X, Y);
                        ChatBox.Items.Add("MouseRightUp " + X + " " + Y);
                    }
                    else if (sw == 8)
                    {
                        byte[] Xp = new byte[4];
                        InputClient.Receive(Xp, 4, SocketFlags.None);
                        int X;
                        X = BitConverter.ToInt32(Xp, 0);
                        InterceptMouse.MouseWheel(X);
                        ChatBox.Items.Add("MouseWheel " + X);
                    }
                }
            }
            catch (Exception Ex)
            {
            }
        }