I have grabbed a sample code that they publish with the documentation, but I am confused at why I am getting errors in Visual Studio. I highlighted the lines i'm getting errors at. Please note I have not changed anything in the sample.
Code:
Here are the errors,
Code:
Sample Code:
private static async Task checkHID()
{
var loggerFactory = LoggerFactory.Create((builder) =>
{
_ = builder.AddDebug().SetMinimumLevel(LogLevel.Trace);
});
//----------------------
// This is Windows specific code. You can replace this with your platform of choice or put this part in the composition root of your app
//Register the factory for creating Hid devices.
var hidFactory =
new FilterDeviceDefinition(vendorId: 0x534C, productId: 0x0001, label: "Trezor One Firmware 1.6.x", usagePage: 65280)
.CreateWindowsHidDeviceFactory(loggerFactory);
//Register the factory for creating Usb devices.
var usbFactory =
new FilterDeviceDefinition(vendorId: 0x1209, productId: 0x53C1, label: "Trezor One Firmware 1.7.x")
.CreateWindowsUsbDeviceFactory(loggerFactory);
//----------------------
//Join the factories together so that it picks up either the Hid or USB device
var factories = hidFactory.Aggregate(usbFactory);
//Get connected device definitions
var deviceDefinitions = (await factories.GetConnectedDeviceDefinitionsAsync().ConfigureAwait(false)).ToList();
if (deviceDefinitions.Count == 0)
{
//No devices were found
return;
}
//Get the device from its definition
var trezorDevice = await hidFactory.GetDeviceAsync(deviceDefinitions.First()).ConfigureAwait(false);
//Initialize the device
await trezorDevice.InitializeAsync().ConfigureAwait(false);
//Create the request buffer
var buffer = new byte[65];
buffer[0] = 0x00;
buffer[1] = 0x3f;
buffer[2] = 0x23;
buffer[3] = 0x23;
//Write and read the data to the device
var readBuffer = await trezorDevice.WriteAndReadAsync(buffer).ConfigureAwait(false);
}
Here are the errors,