public static List <Volume> GetVolumes()
        {
            List <PhysicalDisk> disks  = PhysicalDiskHelper.GetPhysicalDisks();
            List <Volume>       result = new List <Volume>();

            // Get partitions:
            foreach (Disk disk in disks)
            {
                if (!DynamicDisk.IsDynamicDisk(disk))
                {
                    List <Partition> partitions = BasicDiskHelper.GetPartitions(disk);
                    foreach (Partition partition in partitions)
                    {
                        result.Add(partition);
                    }
                }
            }

            // Get dynamic volumes
            List <DynamicVolume> dynamicVolumes = WindowsDynamicVolumeHelper.GetDynamicVolumes();

            foreach (DynamicVolume volume in dynamicVolumes)
            {
                result.Add(volume);
            }

            return(result);
        }
Example #2
0
        public static List <DynamicDisk> GetPhysicalDynamicDisks()
        {
            List <PhysicalDisk> disks  = PhysicalDiskHelper.GetPhysicalDisks();
            List <DynamicDisk>  result = new List <DynamicDisk>();

            foreach (PhysicalDisk disk in disks)
            {
                DynamicDisk dynamicDisk = DynamicDisk.ReadFromDisk(disk);
                if (dynamicDisk != null)
                {
                    result.Add(dynamicDisk);
                }
            }
            return(result);
        }