///------------------------------------------------------------------------------------------------- /// <summary> Plug in target device. </summary> /// /// <remarks> Benjamin "Nefarius" Höglinger, 12.06.2017. </remarks> /// /// <exception cref="VigemBusNotFoundException"> Thrown when a Vigem Bus Not Found /// error condition occurs. /// </exception> /// <exception cref="VigemTargetUninitializedException"> Thrown when a Vigem Target /// Uninitialized error condition occurs. /// </exception> /// <exception cref="VigemAlreadyConnectedException"> Thrown when a Vigem Already Connected /// error condition occurs. /// </exception> /// <exception cref="VigemNoFreeSlotException"> Thrown when a Vigem No Free Slot /// error condition occurs. /// </exception> /// /// <param name="type"> The type. </param> ///------------------------------------------------------------------------------------------------- protected void PlugIn(VigemTargetType type) { var error = ViGemUm.vigem_target_plugin(type, ref Target); // ReSharper disable once SwitchStatementMissingSomeCases switch (error) { case ViGemUm.VigemError.VigemErrorNone: break; case ViGemUm.VigemError.VigemErrorBusNotFound: throw new VigemBusNotFoundException( StringResource.VigemBusNotFoundException); case ViGemUm.VigemError.VigemErrorTargetUninitialized: throw new VigemTargetUninitializedException( StringResource.VigemTargetUninitializedException); case ViGemUm.VigemError.VigemErrorAlreadyConnected: throw new VigemAlreadyConnectedException( StringResource.VigemAlreadyConnectedException); case ViGemUm.VigemError.VigemErrorNoFreeSlot: throw new VigemNoFreeSlotException( StringResource.VigemNoFreeSlotException); } }
protected void PlugIn(VigemTargetType type) { var error = ViGemUm.vigem_target_plugin(type, ref _target); switch (type) { case VigemTargetType.Xbox360Wired: ViGemUm.vigem_register_xusb_notification(XusbNotification, _target); break; case VigemTargetType.DualShock4Wired: ViGemUm.vigem_register_ds4_notification(Ds4Notification, _target); break; case VigemTargetType.XboxOneWired: throw new NotImplementedException(); default: throw new NotImplementedException(); } }
public static extern VigemError vigem_target_plugin( [In] VigemTargetType type, [In, Out] ref VigemTarget target);