Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
            var url = args.Length > 0 ? args[0] : "ws://127.0.0.1:61000";

            ws = new WebSocket(url);

            AudioProvider.Initialize();
            AudioProvider.OnStart += OnStart;
            AudioProvider.OnStop  += OnStop;

            SwapMouseClicks.OnStart += OnStart;
            SwapMouseClicks.OnStop  += OnStop;

            ws.OnClose += async(o, e) =>
            {
                await Task.Delay(1000).ConfigureAwait(false);

                ws.Connect();
            };

            ws.OnMessage += OnMessage;
            ws.OnOpen    += OnOpen;

            ws.Connect();

            do
            {
                Console.Write("> ");
            } while (Console.ReadLine() != "exit");
        }
Ejemplo n.º 2
0
        private static void HandleExecutionRequest(ExecutionStartRequest msg)
        {
            var length = TimeSpan.FromSeconds(Convert.ToDouble(msg.Length));

            if (msg.ModificationId == SwapMouseClicks.MODIFICATION_ID)
            {
                SwapMouseClicks.ExecuteAsync(length).ConfigureAwait(false);
            }
            else
            {
                AudioProvider.Play(msg.ModificationId, length);
            }
        }