Example #1
0
 public bool Release(int key)
 {
     Action = "release";
     ClearParams();
     ParamInt.Add(key);
     return(SendRequest() == null ? false : true);
 }
Example #2
0
 public bool Press(int key)
 {
     Action = "press";
     ClearParams();
     ParamInt.Add(key);
     return(SendRequest() == null ? false : true);
 }
Example #3
0
        public bool MoveBy(int x, int y)
        {
            Action = "move_by";
            ClearParams();
            ParamInt.Add(x);
            ParamInt.Add(y);

            return(SendRequest() == null ? false : true);
        }
Example #4
0
        public bool RightClick(int x, int y)
        {
            Action = "right_click";
            ParamInt.Clear();
            ParamStrings.Clear();
            ParamInt.Add(x);
            ParamInt.Add(y);

            return(SendRequest() == null ? false : true);
        }
Example #5
0
        /// <summary>
        /// Drag mouse from a point to another point.
        /// This will move mouse to the start point, hold left click, then move mouse from the start point to the end point,
        /// then release the left click.
        /// </summary>
        /// <param name="x1"> x coordinate of the start point </param>
        /// <param name="y1"> y coordinate of the start point </param>
        /// <param name="x2"> x coordinate of the end point</param>
        /// <param name="y2"> y coordinate of the end point </param>
        /// <returns> true if success else false </returns>
        public bool Drag(int x1, int y1, int x2, int y2)
        {
            Action = "drag";
            ClearParams();
            ParamInt.Add(x1);
            ParamInt.Add(y1);
            ParamInt.Add(x2);
            ParamInt.Add(y2);

            return(SendRequest() == null ? false : true);
        }
Example #6
0
        /// <summary>
        /// Get color of the pixel at a specific pixel location on screen.
        /// </summary>
        /// <param name="x"> x coordinate of the pixel </param>
        /// <param name="y"> y coordinate of the pixel </param>
        /// <returns>A tuple of three integers (RGB) </returns>
        public Tuple <int, int, int> GetColor(int x, int y)
        {
            Action = "get_color";
            ClearParams();
            ParamInt.Add(x);
            ParamInt.Add(y);
            JToken result = SendRequest();

            if (result == null)
            {
                return(null);
            }
            JArray output = result.Value <JArray>();

            if (output.Count != 3)
            {
                return(null);
            }

            return(new Tuple <int, int, int>(output[0].Value <int>(), output[1].Value <int>(), output[2].Value <int>()));
        }