static ViGEmTarget() { var error = ViGemUm.vigem_init(); if (error == ViGemUm.VigemError.VigemErrorNone) { return; } throw new Exception($"Init error: {error}"); }
///------------------------------------------------------------------------------------------------- /// <summary> Static constructor. </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="VigemBusAccessFailedException"> Thrown when a Vigem Bus Access Failed /// error condition occurs. /// </exception> /// <exception cref="VigemBusVersionMismatchException"> Thrown when a Vigem Bus Version Mismatch /// error condition occurs. /// </exception> ///------------------------------------------------------------------------------------------------- static ViGEmTarget() { var error = ViGemUm.vigem_init(); // ReSharper disable once SwitchStatementMissingSomeCases switch (error) { case ViGemUm.VigemError.VigemErrorNone: return; case ViGemUm.VigemError.VigemErrorBusNotFound: throw new VigemBusNotFoundException( StringResource.VigemBusNotFoundException); case ViGemUm.VigemError.VigemErrorBusAccessFailed: throw new VigemBusAccessFailedException( StringResource.VigemBusAccessFailedException); case ViGemUm.VigemError.VigemErrorBusVersionMismatch: throw new VigemBusVersionMismatchException( StringResource.VigemBusVersionMismatchException); } }