Exemplo n.º 1
0
        private void MoveExtentForm_Load(object sender, EventArgs e)
        {
            listSuffixes.SelectedIndex = 0;
            BindDiskList(m_diskGroup);
            int diskIndex = DiskHelper.IndexOfDisk(m_diskGroup, m_extent.Disk);

            if (diskIndex >= 0)
            {
                listDisks.SelectedIndex = diskIndex;
            }
        }
Exemplo n.º 2
0
        private void CreateVolumeForm_Load(object sender, EventArgs e)
        {
            BindDiskList(m_diskGroup);
            int diskIndex = DiskHelper.IndexOfDisk(m_diskGroup, m_extent.Disk);

            if (diskIndex >= 0)
            {
                listDisks.SetItemChecked(diskIndex, true);
            }

            UpdateExtentSize();
        }
        private void BindDiskList()
        {
            List <DynamicDisk> disks = new List <DynamicDisk>(m_diskGroup);

            foreach (DynamicDiskExtent extent in m_volume.DynamicExtents)
            {
                // Remove disks that already have extents of this volume on them.
                int diskIndex = DiskHelper.IndexOfDisk(disks, extent.Disk);
                if (diskIndex >= 0)
                {
                    disks.RemoveAt(diskIndex);
                }
            }
            BindDiskList(disks);
        }
Exemplo n.º 4
0
        public static List <VisualDiskExtent> GetVisualExtents(List <Disk> disks)
        {
            List <Volume>           volumes = VolumeHelper.GetVolumes(disks);
            List <VisualDiskExtent> extents = new List <VisualDiskExtent>();

            foreach (Volume volume in volumes)
            {
                if (volume is MirroredVolume)
                {
                    List <DynamicVolume> components = ((MirroredVolume)volume).Components;
                    foreach (Volume component in components)
                    {
                        foreach (DiskExtent extent in component.Extents)
                        {
                            int diskIndex = disks.IndexOf(extent.Disk);
                            extents.Add(new VisualDiskExtent(diskIndex, extent, volume));
                        }
                    }
                }
                else
                {
                    foreach (DiskExtent extent in volume.Extents)
                    {
                        int diskIndex = disks.IndexOf(extent.Disk);
                        extents.Add(new VisualDiskExtent(diskIndex, extent, volume));
                    }
                }
            }

            List <DiskExtent> unallocatedExtents = DiskHelper.GetUnallocatedExtents(disks);

            foreach (DiskExtent extent in unallocatedExtents)
            {
                int diskIndex = disks.IndexOf(extent.Disk);
                extents.Add(new VisualDiskExtent(diskIndex, extent, null));
            }

            return(extents);
        }