Beispiel #1
0
        public static String[] GetDeviceNames()
        {
            var devices = VolumeManagement.QueryDosDevice(null);

            var deviceNames = new List <String>();

            foreach (var device in devices)
            {
                if ((2 == device.Length) && (':' == device[1]))
                {
                    deviceNames.Add(device.ToUpper());
                }
            }

            deviceNames.Sort();

            return(deviceNames.ToArray());
        }
Beispiel #2
0
        public static String[] GetDeviceNames()
        {
            var devices = VolumeManagement.QueryDosDevice(null);

            var deviceNames = new List <String>();

            foreach (var device in devices)
            {
                const String prefix = "PhysicalDrive";

                if (device.StartsWith(prefix, StringComparison.InvariantCultureIgnoreCase))
                {
                    deviceNames.Add(device);
                }
            }

            deviceNames.Sort();

            return(deviceNames.ToArray());
        }