public static void WriteToDisk(Disk disk, PrivateHeader privateHeader, TOCBlock tocBlock, VolumeManagerDatabaseHeader header) { ulong sectorIndex = privateHeader.PrivateRegionStartLBA + tocBlock.ConfigStart; byte[] bytes = header.GetBytes(); disk.WriteSectors((long)sectorIndex, bytes); }
public static void WriteToDisk(Disk disk, PrivateHeader privateHeader, TOCBlock tocBlock, VolumeManagerDatabaseHeader header) { ulong sectorIndex = privateHeader.PrivateRegionStartLBA + tocBlock.ConfigStart; byte[] headerBytes = header.GetBytes(); if (disk.BytesPerSector > Length) { byte[] sectorBytes = disk.ReadSector((long)sectorIndex); ByteWriter.WriteBytes(sectorBytes, 0, headerBytes); disk.WriteSectors((long)sectorIndex, sectorBytes); } else { disk.WriteSectors((long)sectorIndex, headerBytes); } }