public OTBClient(string serverAddress) { ClientState.ClientName = Environment.MachineName; _connection = new ServerConnectionManager(serverAddress); _dispatcher = new ServerEventDispatcher(_connection); _screen = new VirtualScreenManager(); _hook = new HookManager(_dispatcher, _screen); _receiver = new ServerEventReceiver(_connection, _hook, _screen); ClientState.Logger = LoggerFactory.Create(builder => builder.AddConsole()).CreateLogger("OTB"); }
public HookManager(ServerEventDispatcher dispatcher, VirtualScreenManager screen) { _dispatcher = dispatcher; _screen = screen; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { Hook = new WindowsGlobalHook(); } if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { Hook = new OsxGlobalHook(); } }
public ServerEventReceiver(ServerConnectionManager manager, HookManager hookManager, VirtualScreenManager screen) { _manager = manager; _hook = hookManager; _screen = screen; _manager.HubConnection.On <double, double>("MouseMove", OnMouseMoveFromServer); _manager.HubConnection.On <int, int>("MouseWheel", OnMouseWheelFromServer); _manager.HubConnection.On <MouseButton>("MouseDown", OnMouseDownFromServer); _manager.HubConnection.On <MouseButton>("MouseUp", OnMouseUpFromServer); _manager.HubConnection.On <Key>("KeyUp", OnKeyUpFromServer); _manager.HubConnection.On <Key>("KeyDown", OnKeyDownFromServer); _manager.HubConnection.On <string>("Clipboard", OnClipboardFromServer); _manager.HubConnection.On <List <VirtualScreen> >("ScreenConfigUpdate", OnScreenConfig); }