Exemple #1
0
 /// <summary>
 /// Processes a valid GUID partition table to initialize its partitions.
 /// </summary>
 /// <param name="aGPT">The GPT to process.</param>
 /// <param name="aDiskDevice">The disk device from which the GPT was read.</param>
 private static void ProcessGPT(GPT aGPT, DiskDevice aDiskDevice)
 {
     for (int i = 0; i < aGPT.Partitions.Count; i++)
     {
         GPT.PartitionInfo aPartInfo = (GPT.PartitionInfo)aGPT.Partitions[i];
         Partitions.Add(new Partition(aDiskDevice, aPartInfo.FirstLBA, aPartInfo.LastLBA - aPartInfo.FirstLBA));
     }
 }
Exemple #2
0
 /// <summary>
 /// Attempts to initialise a disk treating it as GPT formatted.
 /// </summary>
 /// <param name="aDiskDevice">The disk to initialise.</param>
 /// <returns>True if a valid GPT was detected and the disk was successfully initialised. Otherwise, false.</returns>
 private static bool InitAsGPT(DiskDevice aDiskDevice)
 {
     GPT TheGPT = new GPT(aDiskDevice);
     if (!TheGPT.IsValid)
     {
         return false;
     }
     else
     {
         ProcessGPT(TheGPT, aDiskDevice);
         return true;
     }
 }