Пример #1
0
        public Task ParseMessageReceived(WebSocketReceiveResult result)
        {
            string messageReceived = Encoding.Default.GetString(new ArraySegment <byte>(buffer, 0, result.Count));

            VirtualMouse.MouseCommand mc = VirtualMouse.JsonToMouseCommand(messageReceived);

            //Console.WriteLine("Parsing Command: " + mc);

            if (mc.command == "move")
            {
                mouse.Move(mc.x, mc.y);
            }

            else if (mc.command == "right_click")
            {
                mouse.RightClick();
            }
            else if (mc.command == "left_click")
            {
                mouse.LeftClick();
            }
            else if (mc.command == "left_down")
            {
                mouse.LeftDown();
            }
            else if (mc.command == "left_up")
            {
                mouse.LeftUp();
            }
            else if (mc.command == "right_down")
            {
                mouse.RightDown();
            }
            else if (mc.command == "right_up")
            {
                mouse.RightUp();
            }
            else if (mc.command == "touchpad_start")
            {
                mouse.TouchpadStart(mc.x, mc.y);
            }
            else if (mc.command == "touchpad_move")
            {
                mouse.TouchpadMove(mc.x, mc.y, (int)mc.extra);
            }
            else if (mc.command == "set_volume")
            {
                audio.SetVolume(mc.x);
            }
            else
            {
                return(Error());
            }

            return(Success());
        }