/// <summary> /// Gets a string representing the volume boundaries for an embedded backup volume header. /// </summary> /// <param name="drive">The information about the drive containing the volume.</param> /// <returns>A string representing the volume boundaries for an embedded backup volume header.</returns> public string ToBackupHeaderString(PhysicalDrive.DriveInfo drive) { if (IsPossibleBackupHeader(drive.Size)) { long startSector = backupStart / drive.Geometry.BytesPerSector; long endSector = (backupEnd - 1) / drive.Geometry.BytesPerSector; PhysicalDrive.CylinderHeadSector chsStartOffset = PhysicalDrive.LbaToChs(startSector, drive.Geometry); PhysicalDrive.CylinderHeadSector chsEndOffset = PhysicalDrive.LbaToChs(endSector, drive.Geometry); return(string.Format("{0} - {1}", chsStartOffset, chsEndOffset)); } else { return("n/a"); } }
/// <summary> /// Gets a string representing the volume boundaries for a normal volume header. /// </summary> /// <param name="drive">The information about the drive containing the volume.</param> /// <returns>A string representing the volume boundaries for a normal volume header.</returns> public string ToNormalHeaderString(PhysicalDrive.DriveInfo drive) { if ((normalStart >= 0) && (normalEnd <= drive.Size)) { long startSector = normalStart / drive.Geometry.BytesPerSector; long endSector = (normalEnd - 1) / drive.Geometry.BytesPerSector; PhysicalDrive.CylinderHeadSector chsStartOffset = PhysicalDrive.LbaToChs(startSector, drive.Geometry); PhysicalDrive.CylinderHeadSector chsEndOffset = PhysicalDrive.LbaToChs(endSector, drive.Geometry); if ((header.CryptoInfo.HeaderVersion == 3) && (header.CryptoInfo.hiddenVolume)) { return(string.Format("?/?/? - {0}", chsEndOffset)); } else { return(string.Format("{0} - {1}", chsStartOffset, chsEndOffset)); } } else { return("n/a"); } }