Пример #1
0
        public bool SaveTo(IErasureTarget target)
        {
            DriveErasureTarget partition = target as DriveErasureTarget;

            if (partition == null)
            {
                throw new ArgumentException("The provided erasure target type is not " +
                                            "supported by this configurer.");
            }

            PartitionItem item = (PartitionItem)partitionCmb.SelectedItem;

            //Make sure we don't set both Volume and PhysicalDrive
            partition.PhysicalDrive = null;

            //Then set the proper values.
            partition.Volume        = item.Volume;
            partition.PhysicalDrive = item.PhysicalDrive;
            return(true);
        }
Пример #2
0
        public void LoadFrom(IErasureTarget target)
        {
            DriveErasureTarget partition = target as DriveErasureTarget;

            if (partition == null)
            {
                throw new ArgumentException("The provided erasure target type is not " +
                                            "supported by this configurer.");
            }

            foreach (PartitionItem item in partitionCmb.Items)
            {
                if ((item.PhysicalDrive != null &&
                     item.PhysicalDrive.Equals(partition.PhysicalDrive)) ||
                    (item.Volume != null && item.Volume.Equals(partition.Volume)))
                {
                    partitionCmb.SelectedItem = item;
                    break;
                }
            }
        }