public virtual void Connect() { if (VendorId > 0 && ProductId > 0) { ViGEmClient.vigem_target_set_vid(NativeHandle, VendorId); ViGEmClient.vigem_target_set_pid(NativeHandle, ProductId); } var error = ViGEmClient.vigem_target_add(Client.NativeHandle, NativeHandle); switch (error) { case ViGEmClient.VIGEM_ERROR.VIGEM_ERROR_BUS_NOT_FOUND: throw new VigemBusNotFoundException(); case ViGEmClient.VIGEM_ERROR.VIGEM_ERROR_TARGET_UNINITIALIZED: throw new VigemTargetUninitializedException(); case ViGEmClient.VIGEM_ERROR.VIGEM_ERROR_ALREADY_CONNECTED: throw new VigemAlreadyConnectedException(); case ViGEmClient.VIGEM_ERROR.VIGEM_ERROR_NO_FREE_SLOT: throw new VigemNoFreeSlotException(); } }
/// <summary> /// Brings this device online by attaching it to the bus. /// </summary> public virtual void Connect() { if (VendorId > 0 && ProductId > 0) { ViGEmClient.vigem_target_set_vid(NativeHandle, VendorId); ViGEmClient.vigem_target_set_pid(NativeHandle, ProductId); } var error = ViGEmClient.vigem_target_add(Client.NativeHandle, NativeHandle); switch (error) { case VIGEM_ERROR.VIGEM_ERROR_BUS_NOT_FOUND: case VIGEM_ERROR.VIGEM_ERROR_TARGET_UNINITIALIZED: case VIGEM_ERROR.VIGEM_ERROR_ALREADY_CONNECTED: case VIGEM_ERROR.VIGEM_ERROR_NO_FREE_SLOT: throw new ViGEmException(error); } }