Changeset 2231 for trunk/eraser
- Timestamp:
- 8/4/2010 8:48:26 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/eraser/Eraser.DefaultPlugins/ErasureTargets/DriveErasureTargetConfigurer.cs
r2192 r2231 29 29 using System.Windows.Forms; 30 30 using System.IO; 31 using System.Text.RegularExpressions; 31 32 32 33 using Eraser.Manager; … … 171 172 public bool ProcessArgument(string argument) 172 173 { 173 throw new NotImplementedException(); 174 //The hard disk index 175 Regex hardDiskRegex = new Regex("^(drive=)?\\\\Device\\\\Harddisk(?<disk>[\\d]+)", 176 RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.RightToLeft); 177 178 //PhysicalDrive index 179 Regex physicalDriveIndex = new Regex("^(drive=)?\\\\\\\\\\.\\\\PhysicalDrive(?<disk>[\\d]+)", 180 RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.RightToLeft); 181 182 //The volume GUID 183 Regex volumeRegex = new Regex("^(drive=)?\\\\\\\\\\?\\\\Volume\\{(?<guid>([0-9a-f-]+))\\}", 184 RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.RightToLeft); 185 186 //Try to get the hard disk index. 187 Match match = hardDiskRegex.Match(argument); 188 if (!match.Groups["disk"].Success) 189 match = physicalDriveIndex.Match(argument); 190 if (match.Groups["disk"].Success) 191 { 192 //Get the index of the disk. 193 int index = Convert.ToInt32(match.Groups["disk"].Value); 194 195 //Create a physical drive info object for the target disk 196 PhysicalDriveInfo target = new PhysicalDriveInfo(index); 197 198 //Select it in the GUI. 199 foreach (PartitionItem item in partitionCmb.Items) 200 if (item.PhysicalDrive != null && item.PhysicalDrive.Equals(target)) 201 partitionCmb.SelectedItem = item; 202 203 return true; 204 } 205 206 //Try to get the volume GUID 207 match = volumeRegex.Match(argument); 208 if (match.Groups["guid"].Success) 209 { 210 //Find the volume GUID 211 Guid guid = new Guid(match.Groups["guid"].Value); 212 213 //Create a volume info object for the target volume 214 VolumeInfo target = new VolumeInfo(string.Format(CultureInfo.InvariantCulture, 215 "\\\\?\\Volume{{{0}}}\\", guid)); 216 217 //Select it in the GUI. 218 foreach (PartitionItem item in partitionCmb.Items) 219 if (item.Volume != null && item.Volume.Equals(target)) 220 partitionCmb.SelectedItem = item; 221 222 return true; 223 } 224 225 return false; 174 226 } 175 227
Note: See TracChangeset
for help on using the changeset viewer.
