/// <summary>
        /// Try to create new device with given Guid.
        /// </summary>
        /// <param name="deviceGuid">The device guid or one of <see cref="DeviceGuid"/> predefined types.</param>
        /// <param name="device">The instance of <see cref="IDirectInputDevice8"/> or null if failed.</param>
        /// <returns></returns>
        public Result CreateDevice(Guid deviceGuid, out IDirectInputDevice8?device)
        {
            Result result = CreateDevice(deviceGuid, out IntPtr nativePtr, null);

            if (result.Failure)
            {
                device = default;
                return(result);
            }

            device = new IDirectInputDevice8(nativePtr);
            return(result);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="PropertyAccessor"/> class by offset inside a structure.
 /// </summary>
 /// <param name="device">The device.</param>
 /// <param name="name">The name of the property inside dataFormat type.</param>
 /// <param name="dataFormat">The data format.</param>
 internal PropertyAccessor(IDirectInputDevice8 device, string name, Type dataFormat)
 {
     Device       = device;
     ObjectCode   = Marshal.OffsetOf(dataFormat, name).ToInt32();
     PropertyType = PropertyHowType.Byoffset;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PropertyAccessor"/> class.
 /// </summary>
 /// <param name="device">The device.</param>
 /// <param name="code">The code.</param>
 /// <param name="propertyType">The property type.</param>
 internal PropertyAccessor(IDirectInputDevice8 device, int code, PropertyHowType propertyType)
 {
     Device       = device;
     ObjectCode   = code;
     PropertyType = propertyType;
 }
Пример #4
0
 internal ObjectProperties(IDirectInputDevice8 device, int code, PropertyHowType howType) : base(device, code, howType)
 {
 }