Exemplo n.º 1
0
        private static void GoPacketGo(byte[] packet)
        {
            BitArray b = new BitArray(packet);
            b[14] = b[0];
            b[15] = b[1];
            b[22] = b[2];
            b[23] = b[3];

            b[0] = b[1] = b[2] = b[3] = false;

            b.CopyTo(packet, 0);

            MousePacket p = new MousePacket();

            p.DeltaX = 0x80 - (packet[1] ^ 0x80);
            p.DeltaY = 0x80 - (packet[2] ^ 0x80);

            //foreach (bool item in b)
            //{
            //    Console.Write(item ? '1' : '0');
            //}
            //Console.WriteLine();

            if (b[4])
                p.PressedButtons |= ButtonState.RightButton;
            if (b[5])
                p.PressedButtons |= ButtonState.LeftButton;
            if (b[29])
                p.PressedButtons |= ButtonState.MiddleButton;

            Console.WriteLine(p);
        }
Exemplo n.º 2
0
        private static void GoPacketGo(byte[] packet)
        {
            BitArray b = new BitArray(packet);

            b[14] = b[0];
            b[15] = b[1];
            b[22] = b[2];
            b[23] = b[3];

            b[0] = b[1] = b[2] = b[3] = false;

            b.CopyTo(packet, 0);

            MousePacket p = new MousePacket();

            p.DeltaX = 0x80 - (packet[1] ^ 0x80);
            p.DeltaY = 0x80 - (packet[2] ^ 0x80);

            //foreach (bool item in b)
            //{
            //    Console.Write(item ? '1' : '0');
            //}
            //Console.WriteLine();

            if (b[4])
            {
                p.PressedButtons |= ButtonState.RightButton;
            }
            if (b[5])
            {
                p.PressedButtons |= ButtonState.LeftButton;
            }
            if (b[29])
            {
                p.PressedButtons |= ButtonState.MiddleButton;
            }

            Console.WriteLine(p);
        }