コード例 #1
0
 public Footer(Geometry geometry, long capacity, FileType type)
 {
     Cookie = FileCookie;
     Features = FeatureReservedMustBeSet;
     FileFormatVersion = Version1;
     DataOffset = -1;
     Timestamp = DateTime.UtcNow;
     CreatorApp = "dutl";
     CreatorVersion = Version6Point1;
     CreatorHostOS = WindowsHostOS;
     OriginalSize = capacity;
     CurrentSize = capacity;
     Geometry = geometry;
     DiskType = type;
     UniqueId = Guid.NewGuid();
     ////SavedState = 0;
 }
コード例 #2
0
 /// <summary>
 /// Converts a geometry into one that is BIOS-safe, if not already.
 /// </summary>
 /// <param name="geometry">The geometry to make BIOS-safe.</param>
 /// <param name="capacity">The capacity of the disk.</param>
 /// <returns>The new geometry</returns>
 /// <remarks>This method returns the LBA-Assisted geometry if the given geometry isn't BIOS-safe.</remarks>
 public static Geometry MakeBiosSafe(Geometry geometry, long capacity)
 {
     if (geometry == null)
     {
         return LbaAssistedBiosGeometry(capacity);
     }
     else if (geometry.IsBiosSafe)
     {
         return geometry;
     }
     else
     {
         return LbaAssistedBiosGeometry(capacity);
     }
 }
コード例 #3
0
        /// <summary>
        /// Gets the 'Large' BIOS geometry for a disk, given it's physical geometry.
        /// </summary>
        /// <param name="ideGeometry">The physical (aka IDE) geometry of the disk</param>
        /// <returns>The geometry a BIOS using the 'Large' method for calculating disk geometry will indicate for the disk</returns>
        public static Geometry LargeBiosGeometry(Geometry ideGeometry)
        {
            int cylinders = ideGeometry.Cylinders;
            int heads = ideGeometry.HeadsPerCylinder;
            int sectors = ideGeometry.SectorsPerTrack;

            while (cylinders > 1024 && heads <= 127)
            {
                cylinders >>= 1;
                heads <<= 1;
            }

            return new Geometry(cylinders, heads, sectors);
        }
コード例 #4
0
 public Footer(Footer toCopy)
 {
     Cookie = toCopy.Cookie;
     Features = toCopy.Features;
     FileFormatVersion = toCopy.FileFormatVersion;
     DataOffset = toCopy.DataOffset;
     Timestamp = toCopy.Timestamp;
     CreatorApp = toCopy.CreatorApp;
     CreatorVersion = toCopy.CreatorVersion;
     CreatorHostOS = toCopy.CreatorHostOS;
     OriginalSize = toCopy.OriginalSize;
     CurrentSize = toCopy.CurrentSize;
     Geometry = toCopy.Geometry;
     DiskType = toCopy.DiskType;
     Checksum = toCopy.Checksum;
     UniqueId = toCopy.UniqueId;
     SavedState = toCopy.SavedState;
 }