public DeviceClassFolder(DeviceManagerFolder parent, Guid classGuid) : base(parent, new GuidKeyShellItemId(classGuid)) { ClassGuid = classGuid; // come up with the display name for class var sb = new StringBuilder(1024); var size = sb.Capacity; SetupDiGetClassDescription(classGuid, sb, sb.Capacity, ref size); DisplayName = sb.ToString(); var iconIndex = GetIconPath(out var iconPath); if (iconIndex.HasValue && iconPath != null) { Thumbnail = new ShellThumbnail(NormalizeIconPath(iconPath), iconIndex.Value); } // remove default columns we don't need here RemoveColumn(Props.System.ItemType); RemoveColumn(Props.System.Size); RemoveColumn(Props.System.DateModified); RemoveColumn(Props.System.PerceivedType); RemoveColumn(Props.System.Kind); // add these ones, already defined by Windows AddColumn(Props.System.Devices.DeviceInstanceId, SHCOLSTATE.SHCOLSTATE_ONBYDEFAULT); AddColumn(Props.System.Devices.ClassGuid, SHCOLSTATE.SHCOLSTATE_ONBYDEFAULT); AddColumn(Props.System.Devices.ContainerId, SHCOLSTATE.SHCOLSTATE_ONBYDEFAULT); }
protected override ShellFolder GetFolderAsRoot(ShellItemIdList idList) { if (_root == null) { lock (_lock) { // now, we're creating the root folder, so we add all previous actions to it _root = new DeviceManagerFolder(idList); var deviceInterfaces = _added.ToArray(); _added.Clear(); var updates = _updated.ToArray(); _updated.Clear(); var removed = _removed.ToArray(); _removed.Clear(); Task.Run(() => { foreach (var deviceInterface in deviceInterfaces) { _ = _root.AddDeviceInterface(deviceInterface); } foreach (var update in updates) { _root.UpdateDeviceInterface(update); } foreach (var remove in removed) { _root.RemoveDeviceInterface(remove); } }); } } return(_root); }