/// <summary> /// Function to create a <see cref="GorgonGamingDevice"/> object. /// </summary> /// <param name="gamingDeviceInfo">The <see cref="IGorgonGamingDeviceInfo"/> used to determine which device to associate with the resulting object.</param> /// <returns>A <see cref="GorgonGamingDevice"/> representing the data from the physical device.</returns> /// <remarks> /// <para> /// This will create a new instance of a <see cref="IGorgonGamingDevice"/> which will relay data from the physical device using the native provider. /// </para> /// <para> /// Some devices may allocate native resources in order to communicate with the underlying native providers, and because of this, it is important to call the <see cref="IDisposable.Dispose"/> method /// on the object when you are done with the object so that those resources may be freed. /// </para> /// </remarks> public override IGorgonGamingDevice CreateGamingDevice(IGorgonGamingDeviceInfo gamingDeviceInfo) { if (!(gamingDeviceInfo is XInputDeviceInfo xInputInfo)) { throw new ArgumentException(Resources.GORINP_ERR_XINP_NOT_AN_XINPUT_DEVICE_INFO, nameof(gamingDeviceInfo)); } return(new XInputDevice(xInputInfo)); }
/// <summary> /// Function to create a <see cref="GorgonGamingDevice"/> object. /// </summary> /// <param name="gamingDeviceInfo">The <see cref="IGorgonGamingDeviceInfo"/> used to determine which device to associate with the resulting object.</param> /// <returns>A <see cref="GorgonGamingDevice"/> representing the data from the physical device.</returns> /// <remarks> /// <para> /// This will create a new instance of a <see cref="IGorgonGamingDevice"/> which will relay data from the physical device using the native provider. /// </para> /// <para> /// Some devices may allocate native resources in order to communicate with the underlying native providers, and because of this, it is important to call the <see cref="IDisposable.Dispose"/> method /// on the object when you are done with the object so that those resources may be freed. /// </para> /// </remarks> public override IGorgonGamingDevice CreateGamingDevice(IGorgonGamingDeviceInfo gamingDeviceInfo) { if (!(gamingDeviceInfo is DirectInputDeviceInfo deviceInfo)) { throw new ArgumentException(Resources.GORINP_ERR_DI_NOT_A_DI_DEVICE_INFO, nameof(gamingDeviceInfo)); } return(new DirectInputDevice(deviceInfo, _directInput.Value) { // Attempt to acquire the device immediately. IsAcquired = true }); }
/// <summary> /// Function to create a <see cref="GorgonGamingDevice"/> object. /// </summary> /// <param name="gamingDeviceInfo">The <see cref="IGorgonGamingDeviceInfo"/> used to determine which device to associate with the resulting object.</param> /// <returns>A <see cref="GorgonGamingDevice"/> representing the data from the physical device.</returns> /// <remarks> /// <para> /// This will create a new instance of a <see cref="IGorgonGamingDevice"/> which will relay data from the physical device using the native provider. /// </para> /// <para> /// Some devices may allocate native resources in order to communicate with the underlying native providers, and because of this, it is important to call the <see cref="IDisposable.Dispose"/> method /// on the object when you are done with the object so that those resources may be freed. /// </para> /// </remarks> public abstract IGorgonGamingDevice CreateGamingDevice(IGorgonGamingDeviceInfo gamingDeviceInfo);