- Get all devices displayname
var alldevices = Guid.Empty.Devices()
.Select(x => new
{
displayname = x.GetDisplayName(),
description = x.GetDescription()
});
- Get all serial port info
var ports = "Ports".Devices()
.Where(x => x.GetService() == "Serial")
.Select(x => new
{
portname = x.GetComPortName(),
instanceid = x.GetInstanceId(),
locationpaths = x.GetLocationPaths()
});
- Enable/Disable camera, need administrator privileges
"Camera".Devices().Enable();
"Camera".Devices().Disable();
- Get all device class name and class guid
var class_guid = Guid.Empty.Devices()
.GroupBy(x => x.GetClass(), x => x.GetClassGuid());
- change friend name
//change camera friend name
foreach (var oo in "Camera".Devices())
{
var friendname = oo.GetFriendName();
oo.SetFriendName($"test {friendname}");
}
PS: version 1.x.x.x change to 2.x.x.x
Old(1.x.x.x) | New(2.x.x.x) |
---|---|
GetChildren() | GetChildrens().FirstOrDefault() |
GetInstanceId() | GetDeviceInstanceId() |
GetDevClass() | GetClassGuids() |
GetDisplayName() | GetFriendName() |
PS: Thanks for Simple Device Manager.