diff --git a/SOURCE/AudioDeviceCmdlets.cs b/SOURCE/AudioDeviceCmdlets.cs index 7e878d2..34a7888 100644 --- a/SOURCE/AudioDeviceCmdlets.cs +++ b/SOURCE/AudioDeviceCmdlets.cs @@ -68,7 +68,7 @@ public AudioDevice(int Index, MMDevice BaseDevice, bool Default = false) public class GetAudioDevice : Cmdlet { // Parameter called to list all devices - [Parameter(Mandatory = true, Position = 0, ParameterSetName = "List")] + [Parameter(Mandatory = true, Position = 0, ParameterSetName = "ShowDisabled")] public SwitchParameter List { get { return list; } @@ -185,6 +185,25 @@ protected override void ProcessRecord() } } + // If the ShowDisabled parameter was called + if (showdisabled) + { + // The ShowDisabled parameter was called + + // Get enabled DeviceCollection count + int enabledCount = DeviceCollection.Count; + + // Get MMDeviceCollection of every disabled devices + DeviceCollection = DevEnum.EnumerateAudioEndPoints(EDataFlow.eAll, EDeviceState.DEVICE_STATE_UNPLUGGED); + + // For every MMDevice in DeviceCollection + for (int i = 0; i < DeviceCollection.Count; i++) + { + // Output the result of the creation of a new AudioDevice while assining it an index, and the MMDevice itself + WriteObject(new AudioDevice(i + 1 + enabledCount, DeviceCollection[i])); + } + } + // Stop checking for other parameters return; }