Esempio n. 1
0
    public static byte[] Ass_Mouse(AndroidMotioneventAction amAction, AndroidMotioneventButtons amButtons, short mousePosX, short mousePosY, short width, short height)
    {
        byte[] cmdBytes = new byte[14];
        //type
        cmdBytes[0] = (byte)control_msg_type.CMT_INJECT_MOUSE;
        cmdBytes[1] = (byte)amAction;

        byte[] motionevent = BitConverter.GetBytes((int)amButtons);
        cmdBytes[2] = motionevent[3];
        cmdBytes[3] = motionevent[2];
        cmdBytes[4] = motionevent[1];
        cmdBytes[5] = motionevent[0];

        byte[] fixedX = BitConverter.GetBytes(mousePosX);
        cmdBytes[6] = fixedX[1];
        cmdBytes[7] = fixedX[0];

        byte[] fixedY = BitConverter.GetBytes(mousePosY);
        cmdBytes[8] = fixedY[1];
        cmdBytes[9] = fixedY[0];


        byte[] deviceCrtW = BitConverter.GetBytes(width);
        cmdBytes[10] = deviceCrtW[1];
        cmdBytes[11] = deviceCrtW[0];

        byte[] deviceCrtH = BitConverter.GetBytes(height);
        cmdBytes[12] = deviceCrtH[1];
        cmdBytes[13] = deviceCrtH[0];

        return(cmdBytes);
    }
Esempio n. 2
0
    public static byte[] Ass_Touch(byte touchId, AndroidMotioneventAction amAction, short mousePosX, short mousePosY, short width, short height)
    {
        byte[] cmdBytes = new byte[11];
        cmdBytes[0] = (byte)control_msg_type.CMT_INJECT_TOUCH;
        cmdBytes[1] = touchId;
        cmdBytes[2] = (byte)amAction;

        byte[] fixedX = BitConverter.GetBytes(mousePosX);
        cmdBytes[3] = fixedX[1];
        cmdBytes[4] = fixedX[0];

        byte[] fixedY = BitConverter.GetBytes(mousePosY);
        cmdBytes[5] = fixedY[1];
        cmdBytes[6] = fixedY[0];


        byte[] deviceCrtW = BitConverter.GetBytes(width);
        cmdBytes[7] = deviceCrtW[1];
        cmdBytes[8] = deviceCrtW[0];

        byte[] deviceCrtH = BitConverter.GetBytes(height);
        cmdBytes[9]  = deviceCrtH[1];
        cmdBytes[10] = deviceCrtH[0];

        return(cmdBytes);
    }