Esempio n. 1
0
File: VHD.cs Progetto: AyrA/vhd
 /// <summary>
 /// Gets the minimum possible disk size for the given disk
 /// </summary>
 /// <param name="MBRData">MBR data Size: <see cref="MBR.MasterBootRecord.MBR_SIZE"/></param>
 /// <returns>Minimum disk size in bytes</returns>
 public static ulong GetMinDiskSize(byte[] MBRData)
 {
     var M = new MBR.MasterBootRecord(MBRData);
     M.Validate();
     return GetMinDiskSize(M);
 }
Esempio n. 2
0
File: VHD.cs Progetto: AyrA/vhd
 /// <summary>
 /// Gets the minimum possible disk size for the given disk
 /// </summary>
 /// <param name="DiskMBR">An MBR</param>
 /// <returns>Minimum disk size in bytes</returns>
 /// <remarks>This will not validate the partition table</remarks>
 public static ulong GetMinDiskSize(MBR.MasterBootRecord DiskMBR)
 {
     return DiskMBR.Partitions
         .Where(m => m.LBAFirstSector > 0 && m.LBASectorCount > 0)
         .Max(m => m.LBAFirstSector + (ulong)m.LBASectorCount - 1UL) * Footer.SECTOR_SIZE;
 }
Esempio n. 3
0
File: VHD.cs Progetto: AyrA/vhd
 /// <summary>
 /// Gets the minimum possible disk size for the given disk
 /// </summary>
 /// <param name="VhdStream">Stream placed at the start of the MBR</param>
 /// <returns>Minimum disk size in bytes</returns>
 public static ulong GetMinDiskSize(Stream VhdStream)
 {
     var M = new MBR.MasterBootRecord(VhdStream);
     M.Validate();
     return GetMinDiskSize(M);
 }