Esempio n. 1
0
        protected override void Run()
        {
            isActive = true;

            while (isActive)
            {
                string input = IO.Console.ReadLine();
                handler.Handle(input);
            }
        }
Esempio n. 2
0
        protected override void WndProc(ref Message m)
        {
            const int WM_INPUT = 0x00FF;

            if (m.Msg == WM_INPUT)
            {
                var data = RawInputData.FromHandle(m.LParam);
                if (data is RawInputMouseData mouseData)
                {
                    var mouse = mouseData.Mouse;
                    inputHandler.Handle(new MouseInput(mouse.LastX, mouse.LastY, mouse.ButtonData, (MouseFlags)mouse.Flags, (MouseButton)mouse.Buttons));
                }
                else if (data is RawInputKeyboardData keyboardData)
                {
                    var keyboard = keyboardData.Keyboard;
                    inputHandler.Handle(new KeyboardInput(keyboard.VirutalKey, keyboard.ScanCode, (KeyboardFlags)keyboard.Flags));
                }
            }

            base.WndProc(ref m);
        }
Esempio n. 3
0
        protected override void Run()
        {
            while (peer.IsAlive())
            {
                string receivedData = "";

                try
                {
                    receivedData += peer.Receive();
                    iHandler.Handle(receivedData);
                }
                catch (IOException)
                {
                    peer.Close();
                    Common.IO.Console.Warning(String.Format(CONNECTION_CLOSED, peer.ToString()));
                }
            }
        }