/// <summary> /// The EnumerateDevices function enumerates all found devices and fills the input DeviceInfo array with obtained devices’ information. /// </summary> /// <param name="DeviceInfoArray">Reference to a EMADeviceInfo array supplied by the user.</param> /// <param name="foundDevices">Returns the total number of devices found.</param> /// <returns>If the total number of devices found is greater than maxDevices, this function only fills up to maxDevices devices’ information to the EMADeviceInfo array. When this function succeeds, it returns S_OK. Otherwise it returns one of the following custom HRESULT error codes: <br></br><br></br> OutOfMemory <br></br> HidError <br></br> InvalidParameter</returns> /// <remarks> /// The EnumerateDevice function enumerates eMagin devices based on their USB Vendor ID only. <br></br><br></br> The maximum number of devices that can be connected is 16. <br></br><br></br> The C++ equivalent of this function is static. /// </remarks> public static Error EnumerateDevices ( DeviceInfo [ ] DeviceInfoArray , ref int foundDevices ) { DeviceInfos deviceInfos = new DeviceInfos ( ) ; int arrayLength = DeviceInfoArray.GetLength ( 0 ) ; if ( arrayLength > 4 ) arrayLength = 4 ; Error error = ( Error ) S_EnumerateDevices ( deviceInfos , arrayLength , ref foundDevices ) ; if ( Error.Ok == error ) { if ( ( foundDevices > 0 ) && ( arrayLength > 0 ) ) DeviceInfoArray [ 0 ] = deviceInfos.DeviceInfo_00 ; if ( ( foundDevices > 1 ) && ( arrayLength > 1 ) ) DeviceInfoArray [ 1 ] = deviceInfos.DeviceInfo_01 ; if ( ( foundDevices > 2 ) && ( arrayLength > 2 ) ) DeviceInfoArray [ 2 ] = deviceInfos.DeviceInfo_02 ; if ( ( foundDevices > 3 ) && ( arrayLength > 3 ) ) DeviceInfoArray [ 3 ] = deviceInfos.DeviceInfo_03 ; } return error ; }