Code cleanup.

This commit is contained in:
2014-08-28 19:02:45 +01:00
parent 3ae937ef60
commit 94316131d2
4 changed files with 14 additions and 21 deletions

View File

@@ -328,8 +328,7 @@ namespace DiscImageChef.Checksums
return null; return null;
} }
} }
else return null;
return null;
} }
static bool? CheckCDSectorSubChannel(byte[] subchannel) static bool? CheckCDSectorSubChannel(byte[] subchannel)

View File

@@ -397,7 +397,7 @@ namespace DiscImageChef.ImagePlugins
#region Private methods #region Private methods
private DiskType CalculateDiskType() DiskType CalculateDiskType()
{ {
if (_imageInfo.sectorSize == 2048) if (_imageInfo.sectorSize == 2048)
{ {

View File

@@ -62,8 +62,6 @@ namespace DiscImageChef.PartPlugins
public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List<Partition> partitions) public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List<Partition> partitions)
{ {
byte[] cString;
ulong apm_entries; ulong apm_entries;
uint sector_size; uint sector_size;
@@ -75,7 +73,7 @@ namespace DiscImageChef.PartPlugins
partitions = new List<Partition>(); partitions = new List<Partition>();
AppleMapBootEntry APMB = new AppleMapBootEntry(); AppleMapBootEntry APMB = new AppleMapBootEntry();
AppleMapPartitionEntry APMEntry = new AppleMapPartitionEntry(); AppleMapPartitionEntry APMEntry;
byte[] APMB_sector = imagePlugin.ReadSector(0); byte[] APMB_sector = imagePlugin.ReadSector(0);
@@ -136,7 +134,6 @@ namespace DiscImageChef.PartPlugins
for (ulong i = 0; i < apm_entries; i++) // For each partition for (ulong i = 0; i < apm_entries; i++) // For each partition
{ {
APMEntry = new AppleMapPartitionEntry();
if(APMFromHDDOnCD) if(APMFromHDDOnCD)
APMEntry_sector = Read2048SectorAs512(imagePlugin, first_sector + i); APMEntry_sector = Read2048SectorAs512(imagePlugin, first_sector + i);
else else
@@ -194,7 +191,7 @@ namespace DiscImageChef.PartPlugins
return true; return true;
} }
byte[] Read2048SectorAs512(ImagePlugins.ImagePlugin imagePlugin, UInt64 LBA) static byte[] Read2048SectorAs512(ImagePlugins.ImagePlugin imagePlugin, UInt64 LBA)
{ {
UInt64 LBA2k = LBA / 4; UInt64 LBA2k = LBA / 4;
int Remainder = (int)(LBA % 4); int Remainder = (int)(LBA % 4);
@@ -207,7 +204,7 @@ namespace DiscImageChef.PartPlugins
return sector; return sector;
} }
AppleMapPartitionEntry DecodeAPMEntry(byte[] APMEntry_sector) static AppleMapPartitionEntry DecodeAPMEntry(byte[] APMEntry_sector)
{ {
AppleMapPartitionEntry APMEntry = new AppleMapPartitionEntry(); AppleMapPartitionEntry APMEntry = new AppleMapPartitionEntry();
byte[] cString; byte[] cString;

View File

@@ -77,20 +77,17 @@ namespace DiscImageChef.Plugins
return drSigWord != HFSP_MAGIC; return drSigWord != HFSP_MAGIC;
} }
else mdb_sector = Read2048SectorAs512(imagePlugin, 2 + partitionOffset);
drSigWord = BigEndianBitConverter.ToUInt16(mdb_sector, 0);
if (drSigWord == HFS_MAGIC)
{ {
mdb_sector = Read2048SectorAs512(imagePlugin, 2 + partitionOffset); if (MainClass.isDebug)
drSigWord = BigEndianBitConverter.ToUInt16(mdb_sector, 0); Console.WriteLine("DEBUG (HFS Plugin): HFS sector size is 512 bytes, but device's 2048");
if (drSigWord == HFS_MAGIC) drSigWord = BigEndianBitConverter.ToUInt16(mdb_sector, 0x7C); // Seek to embedded HFS+ signature
{
if(MainClass.isDebug)
Console.WriteLine("DEBUG (HFS Plugin): HFS sector size is 512 bytes, but device's 2048");
drSigWord = BigEndianBitConverter.ToUInt16(mdb_sector, 0x7C); // Seek to embedded HFS+ signature return drSigWord != HFSP_MAGIC;
return drSigWord != HFSP_MAGIC;
}
} }
} }
else else
@@ -364,7 +361,7 @@ namespace DiscImageChef.Plugins
return; return;
} }
byte[] Read2048SectorAs512(ImagePlugins.ImagePlugin imagePlugin, UInt64 LBA) static byte[] Read2048SectorAs512(ImagePlugins.ImagePlugin imagePlugin, UInt64 LBA)
{ {
UInt64 LBA2k = LBA / 4; UInt64 LBA2k = LBA / 4;
int Remainder = (int)(LBA % 4); int Remainder = (int)(LBA % 4);