diff --git a/DiscImageChef.Checksums/Adler32Context.cs b/DiscImageChef.Checksums/Adler32Context.cs index b12323457..ce8475ca5 100644 --- a/DiscImageChef.Checksums/Adler32Context.cs +++ b/DiscImageChef.Checksums/Adler32Context.cs @@ -62,7 +62,7 @@ namespace DiscImageChef.Checksums /// Length of buffer to hash. public void Update(byte[] data, uint len) { - for (int i = 0; i < len; i++) + for(int i = 0; i < len; i++) { sum1 = (ushort)((sum1 + data[i]) % AdlerModule); sum2 = (ushort)((sum2 + sum1) % AdlerModule); @@ -95,7 +95,7 @@ namespace DiscImageChef.Checksums UInt32 finalSum = (uint)((sum2 << 16) | sum1); StringBuilder adlerOutput = new StringBuilder(); - for (int i = 0; i < BigEndianBitConverter.GetBytes(finalSum).Length; i++) + for(int i = 0; i < BigEndianBitConverter.GetBytes(finalSum).Length; i++) { adlerOutput.Append(BigEndianBitConverter.GetBytes(finalSum)[i].ToString("x2")); } @@ -137,7 +137,7 @@ namespace DiscImageChef.Checksums StringBuilder adlerOutput = new StringBuilder(); - for (int i = 0; i < hash.Length; i++) + for(int i = 0; i < hash.Length; i++) { adlerOutput.Append(hash[i].ToString("x2")); } @@ -159,7 +159,7 @@ namespace DiscImageChef.Checksums localSum1 = 1; localSum2 = 0; - for (int i = 0; i < len; i++) + for(int i = 0; i < len; i++) { localSum1 = (ushort)((localSum1 + data[i]) % AdlerModule); localSum2 = (ushort)((localSum2 + localSum1) % AdlerModule); @@ -171,7 +171,7 @@ namespace DiscImageChef.Checksums StringBuilder adlerOutput = new StringBuilder(); - for (int i = 0; i < hash.Length; i++) + for(int i = 0; i < hash.Length; i++) { adlerOutput.Append(hash[i].ToString("x2")); } diff --git a/DiscImageChef.Checksums/CDChecksums.cs b/DiscImageChef.Checksums/CDChecksums.cs index ee3ff20f3..5fb158f80 100644 --- a/DiscImageChef.Checksums/CDChecksums.cs +++ b/DiscImageChef.Checksums/CDChecksums.cs @@ -50,7 +50,7 @@ namespace DiscImageChef.Checksums public static bool? CheckCDSector(byte[] buffer) { - switch (buffer.Length) + switch(buffer.Length) { case 2448: { @@ -64,15 +64,15 @@ namespace DiscImageChef.Checksums bool? subchannelStatus = CheckCDSectorSubChannel(subchannel); bool? status = null; - if (channelStatus == null && subchannelStatus == null) + if(channelStatus == null && subchannelStatus == null) status = null; - if (channelStatus == false || subchannelStatus == false) + if(channelStatus == false || subchannelStatus == false) status = false; - if (channelStatus == null && subchannelStatus == true) + if(channelStatus == null && subchannelStatus == true) status = true; - if (channelStatus == true && subchannelStatus == null) + if(channelStatus == true && subchannelStatus == null) status = true; - if (channelStatus == true && subchannelStatus == true) + if(channelStatus == true && subchannelStatus == true) status = true; return status; @@ -89,7 +89,7 @@ namespace DiscImageChef.Checksums ECC_F_Table = new byte[256]; ECC_B_Table = new byte[256]; - for (UInt32 i = 0; i < 256; i++) + for(UInt32 i = 0; i < 256; i++) { UInt32 j = (uint)((i << 1) ^ ((i & 0x80) == 0x80 ? 0x11D : 0)); ECC_F_Table[i] = (byte)j; @@ -109,16 +109,16 @@ namespace DiscImageChef.Checksums { UInt32 size = major_count * minor_count; UInt32 major; - for (major = 0; major < major_count; major++) + for(major = 0; major < major_count; major++) { UInt32 index = (major >> 1) * major_mult + (major & 1); byte ecc_a = 0; byte ecc_b = 0; UInt32 minor; - for (minor = 0; minor < minor_count; minor++) + for(minor = 0; minor < minor_count; minor++) { byte temp; - if (index < 4) + if(index < 4) { temp = address[index]; } @@ -127,7 +127,7 @@ namespace DiscImageChef.Checksums temp = data[index - 4]; } index += minor_inc; - if (index >= size) + if(index >= size) { index -= size; } @@ -136,7 +136,7 @@ namespace DiscImageChef.Checksums ecc_a = ECC_F_Table[ecc_a]; } ecc_a = ECC_B_Table[ECC_F_Table[ecc_a] ^ ecc_b]; - if ( + if( ecc[major] != (ecc_a) || ecc[major + major_count] != (ecc_a ^ ecc_b)) { @@ -150,7 +150,7 @@ namespace DiscImageChef.Checksums { ECCInit(); - if ( + if( channel[0x000] == 0x00 && // sync (12 bytes) channel[0x001] == 0xFF && channel[0x002] == 0xFF && @@ -166,12 +166,12 @@ namespace DiscImageChef.Checksums { DicConsole.DebugWriteLine("CD checksums", "Data sector, address {0:X2}:{1:X2}:{2:X2}", channel[0x00C], channel[0x00D], channel[0x00E]); - if (channel[0x00F] == 0x00) // mode (1 byte) + if(channel[0x00F] == 0x00) // mode (1 byte) { DicConsole.DebugWriteLine("CD checksums", "Mode 0 sector at address {0:X2}:{1:X2}:{2:X2}", channel[0x00C], channel[0x00D], channel[0x00E]); - for (int i = 0x010; i < 0x930; i++) + for(int i = 0x010; i < 0x930; i++) { - if (channel[i] != 0x00) + if(channel[i] != 0x00) { DicConsole.DebugWriteLine("CD checksums", "Mode 0 sector with error at address: {0:X2}:{1:X2}:{2:X2}", channel[0x00C], channel[0x00D], channel[0x00E]); return false; @@ -179,11 +179,11 @@ namespace DiscImageChef.Checksums } return true; } - else if (channel[0x00F] == 0x01) // mode (1 byte) + else if(channel[0x00F] == 0x01) // mode (1 byte) { DicConsole.DebugWriteLine("CD checksums", "Mode 1 sector at address {0:X2}:{1:X2}:{2:X2}", channel[0x00C], channel[0x00D], channel[0x00E]); - if (channel[0x814] != 0x00 || // reserved (8 bytes) + if(channel[0x814] != 0x00 || // reserved (8 bytes) channel[0x815] != 0x00 || channel[0x816] != 0x00 || channel[0x817] != 0x00 || @@ -211,12 +211,12 @@ namespace DiscImageChef.Checksums bool FailedECC_P = CheckECC(address, data, 86, 24, 2, 86, ecc_p); bool FailedECC_Q = CheckECC(address, data2, 52, 43, 86, 88, ecc_q); - if (FailedECC_P) + if(FailedECC_P) DicConsole.DebugWriteLine("CD checksums", "Mode 1 sector at address: {0:X2}:{1:X2}:{2:X2}, fails ECC P check", channel[0x00C], channel[0x00D], channel[0x00E]); - if (FailedECC_Q) + if(FailedECC_Q) DicConsole.DebugWriteLine("CD checksums", "Mode 1 sector at address: {0:X2}:{1:X2}:{2:X2}, fails ECC Q check", channel[0x00C], channel[0x00D], channel[0x00E]); - if (FailedECC_P || FailedECC_Q) + if(FailedECC_P || FailedECC_Q) return false; byte[] SectorForCheck = new byte[0x810]; @@ -226,7 +226,7 @@ namespace DiscImageChef.Checksums CRC32Context.Data(SectorForCheck, 0x810, out CalculatedEDCBytes, CDCRC32Poly, CDCRC32Seed); UInt32 CalculatedEDC = BitConverter.ToUInt32(CalculatedEDCBytes, 0); - if (CalculatedEDC != StoredEDC) + if(CalculatedEDC != StoredEDC) { DicConsole.DebugWriteLine("CD checksums", "Mode 1 sector at address: {0:X2}:{1:X2}:{2:X2}, got CRC 0x{3:X8} expected 0x{4:X8}", channel[0x00C], channel[0x00D], channel[0x00E], CalculatedEDC, StoredEDC); return false; @@ -234,13 +234,13 @@ namespace DiscImageChef.Checksums return true; } - else if (channel[0x00F] == 0x02) // mode (1 byte) + else if(channel[0x00F] == 0x02) // mode (1 byte) { DicConsole.DebugWriteLine("CD checksums", "Mode 2 sector at address {0:X2}:{1:X2}:{2:X2}", channel[0x00C], channel[0x00D], channel[0x00E]); - if ((channel[0x012] & 0x20) == 0x20) // mode 2 form 2 + if((channel[0x012] & 0x20) == 0x20) // mode 2 form 2 { - if (channel[0x010] != channel[0x014] || channel[0x011] != channel[0x015] || channel[0x012] != channel[0x016] || channel[0x013] != channel[0x017]) + if(channel[0x010] != channel[0x014] || channel[0x011] != channel[0x015] || channel[0x012] != channel[0x016] || channel[0x013] != channel[0x017]) { DicConsole.DebugWriteLine("CD checksums", "Subheader copies differ in mode 2 form 2 sector at address: {0:X2}:{1:X2}:{2:X2}", channel[0x00C], channel[0x00D], channel[0x00E]); } @@ -252,7 +252,7 @@ namespace DiscImageChef.Checksums CRC32Context.Data(SectorForCheck, 0x91C, out CalculatedEDCBytes, CDCRC32Poly, CDCRC32Seed); UInt32 CalculatedEDC = BitConverter.ToUInt32(CalculatedEDCBytes, 0); - if (CalculatedEDC != StoredEDC && StoredEDC != 0x00000000) + if(CalculatedEDC != StoredEDC && StoredEDC != 0x00000000) { DicConsole.DebugWriteLine("CD checksums", "Mode 2 form 2 sector at address: {0:X2}:{1:X2}:{2:X2}, got CRC 0x{3:X8} expected 0x{4:X8}", channel[0x00C], channel[0x00D], channel[0x00E], CalculatedEDC, StoredEDC); return false; @@ -260,7 +260,7 @@ namespace DiscImageChef.Checksums } else { - if (channel[0x010] != channel[0x014] || channel[0x011] != channel[0x015] || channel[0x012] != channel[0x016] || channel[0x013] != channel[0x017]) + if(channel[0x010] != channel[0x014] || channel[0x011] != channel[0x015] || channel[0x012] != channel[0x016] || channel[0x013] != channel[0x017]) { DicConsole.DebugWriteLine("CD checksums", "Subheader copies differ in mode 2 form 1 sector at address: {0:X2}:{1:X2}:{2:X2}", channel[0x00C], channel[0x00D], channel[0x00E]); } @@ -283,12 +283,12 @@ namespace DiscImageChef.Checksums bool FailedECC_P = CheckECC(address, data, 86, 24, 2, 86, ecc_p); bool FailedECC_Q = CheckECC(address, data2, 52, 43, 86, 88, ecc_q); - if (FailedECC_P) + if(FailedECC_P) DicConsole.DebugWriteLine("CD checksums", "Mode 2 form 1 sector at address: {0:X2}:{1:X2}:{2:X2}, fails ECC P check", channel[0x00C], channel[0x00D], channel[0x00E]); - if (FailedECC_Q) + if(FailedECC_Q) DicConsole.DebugWriteLine("CD checksums", "Mode 2 form 1 sector at address: {0:X2}:{1:X2}:{2:X2}, fails ECC Q check", channel[0x00F], channel[0x00C], channel[0x00D], channel[0x00E]); - if (FailedECC_P || FailedECC_Q) + if(FailedECC_P || FailedECC_Q) return false; byte[] SectorForCheck = new byte[0x808]; @@ -298,7 +298,7 @@ namespace DiscImageChef.Checksums CRC32Context.Data(SectorForCheck, 0x808, out CalculatedEDCBytes, CDCRC32Poly, CDCRC32Seed); UInt32 CalculatedEDC = BitConverter.ToUInt32(CalculatedEDCBytes, 0); - if (CalculatedEDC != StoredEDC) + if(CalculatedEDC != StoredEDC) { DicConsole.DebugWriteLine("CD checksums", "Mode 2 form 1 sector at address: {0:X2}:{1:X2}:{2:X2}, got CRC 0x{3:X8} expected 0x{4:X8}", channel[0x00C], channel[0x00D], channel[0x00E], CalculatedEDC, StoredEDC); return false; @@ -330,16 +330,16 @@ namespace DiscImageChef.Checksums byte[] CDSubRWPack4 = new byte[24]; int i = 0; - for (int j = 0; j < 12; j++) + for(int j = 0; j < 12; j++) QSubChannel[j] = 0; - for (int j = 0; j < 18; j++) + for(int j = 0; j < 18; j++) { CDTextPack1[j] = 0; CDTextPack2[j] = 0; CDTextPack3[j] = 0; CDTextPack4[j] = 0; } - for (int j = 0; j < 24; j++) + for(int j = 0; j < 24; j++) { CDSubRWPack1[j] = 0; CDSubRWPack2[j] = 0; @@ -347,7 +347,7 @@ namespace DiscImageChef.Checksums CDSubRWPack4[j] = 0; } - for (int j = 0; j < 12; j++) + for(int j = 0; j < 12; j++) { QSubChannel[j] = (byte)(QSubChannel[j] | ((subchannel[i++] & 0x40) << 1)); QSubChannel[j] = (byte)(QSubChannel[j] | (subchannel[i++] & 0x40)); @@ -360,86 +360,86 @@ namespace DiscImageChef.Checksums } i = 0; - for (int j = 0; j < 18; j++) + for(int j = 0; j < 18; j++) { - if (j < 18) + if(j < 18) CDTextPack1[j] = (byte)(CDTextPack1[j] | ((subchannel[i++] & 0x3F) << 2)); - if (j < 18) + if(j < 18) CDTextPack1[j] = (byte)(CDTextPack1[j++] | ((subchannel[i] & 0xC0) >> 4)); - if (j < 18) + if(j < 18) CDTextPack1[j] = (byte)(CDTextPack1[j] | ((subchannel[i++] & 0x0F) << 4)); - if (j < 18) + if(j < 18) CDTextPack1[j] = (byte)(CDTextPack1[j++] | ((subchannel[i] & 0x3C) >> 2)); - if (j < 18) + if(j < 18) CDTextPack1[j] = (byte)(CDTextPack1[j] | ((subchannel[i++] & 0x03) << 6)); - if (j < 18) + if(j < 18) CDTextPack1[j] = (byte)(CDTextPack1[j] | (subchannel[i++] & 0x3F)); } - for (int j = 0; j < 18; j++) + for(int j = 0; j < 18; j++) { - if (j < 18) + if(j < 18) CDTextPack2[j] = (byte)(CDTextPack2[j] | ((subchannel[i++] & 0x3F) << 2)); - if (j < 18) + if(j < 18) CDTextPack2[j] = (byte)(CDTextPack2[j++] | ((subchannel[i] & 0xC0) >> 4)); - if (j < 18) + if(j < 18) CDTextPack2[j] = (byte)(CDTextPack2[j] | ((subchannel[i++] & 0x0F) << 4)); - if (j < 18) + if(j < 18) CDTextPack2[j] = (byte)(CDTextPack2[j++] | ((subchannel[i] & 0x3C) >> 2)); - if (j < 18) + if(j < 18) CDTextPack2[j] = (byte)(CDTextPack2[j] | ((subchannel[i++] & 0x03) << 6)); - if (j < 18) + if(j < 18) CDTextPack2[j] = (byte)(CDTextPack2[j] | (subchannel[i++] & 0x3F)); } - for (int j = 0; j < 18; j++) + for(int j = 0; j < 18; j++) { - if (j < 18) + if(j < 18) CDTextPack3[j] = (byte)(CDTextPack3[j] | ((subchannel[i++] & 0x3F) << 2)); - if (j < 18) + if(j < 18) CDTextPack3[j] = (byte)(CDTextPack3[j++] | ((subchannel[i] & 0xC0) >> 4)); - if (j < 18) + if(j < 18) CDTextPack3[j] = (byte)(CDTextPack3[j] | ((subchannel[i++] & 0x0F) << 4)); - if (j < 18) + if(j < 18) CDTextPack3[j] = (byte)(CDTextPack3[j++] | ((subchannel[i] & 0x3C) >> 2)); - if (j < 18) + if(j < 18) CDTextPack3[j] = (byte)(CDTextPack3[j] | ((subchannel[i++] & 0x03) << 6)); - if (j < 18) + if(j < 18) CDTextPack3[j] = (byte)(CDTextPack3[j] | (subchannel[i++] & 0x3F)); } - for (int j = 0; j < 18; j++) + for(int j = 0; j < 18; j++) { - if (j < 18) + if(j < 18) CDTextPack4[j] = (byte)(CDTextPack4[j] | ((subchannel[i++] & 0x3F) << 2)); - if (j < 18) + if(j < 18) CDTextPack4[j] = (byte)(CDTextPack4[j++] | ((subchannel[i] & 0xC0) >> 4)); - if (j < 18) + if(j < 18) CDTextPack4[j] = (byte)(CDTextPack4[j] | ((subchannel[i++] & 0x0F) << 4)); - if (j < 18) + if(j < 18) CDTextPack4[j] = (byte)(CDTextPack4[j++] | ((subchannel[i] & 0x3C) >> 2)); - if (j < 18) + if(j < 18) CDTextPack4[j] = (byte)(CDTextPack4[j] | ((subchannel[i++] & 0x03) << 6)); - if (j < 18) + if(j < 18) CDTextPack4[j] = (byte)(CDTextPack4[j] | (subchannel[i++] & 0x3F)); } i = 0; - for (int j = 0; j < 24; j++) + for(int j = 0; j < 24; j++) { CDSubRWPack1[j] = (byte)(subchannel[i++] & 0x3F); } - for (int j = 0; j < 24; j++) + for(int j = 0; j < 24; j++) { CDSubRWPack2[j] = (byte)(subchannel[i++] & 0x3F); } - for (int j = 0; j < 24; j++) + for(int j = 0; j < 24; j++) { CDSubRWPack3[j] = (byte)(subchannel[i++] & 0x3F); } - for (int j = 0; j < 24; j++) + for(int j = 0; j < 24; j++) { CDSubRWPack4[j] = (byte)(subchannel[i++] & 0x3F); } - switch (CDSubRWPack1[0]) + switch(CDSubRWPack1[0]) { case 0x00: DicConsole.DebugWriteLine("CD checksums", "Detected Zero Pack in subchannel"); @@ -474,27 +474,27 @@ namespace DiscImageChef.Checksums Array.Copy(QSubChannel, 0, QSubChannelForCRC, 0, 10); UInt16 CalculatedQCRC = CalculateCCITT_CRC16(QSubChannelForCRC); - if (QSubChannelCRC != CalculatedQCRC) + if(QSubChannelCRC != CalculatedQCRC) { DicConsole.DebugWriteLine("CD checksums", "Q subchannel CRC 0x{0:X4}, expected 0x{1:X4}", CalculatedQCRC, QSubChannelCRC); status = false; } - if ((CDTextPack1[0] & 0x80) == 0x80) + if((CDTextPack1[0] & 0x80) == 0x80) { UInt16 CDTextPack1CRC = BigEndianBitConverter.ToUInt16(CDTextPack1, 16); byte[] CDTextPack1ForCRC = new byte[16]; Array.Copy(CDTextPack1, 0, CDTextPack1ForCRC, 0, 16); UInt16 CalculatedCDTP1CRC = CalculateCCITT_CRC16(CDTextPack1ForCRC); - if (CDTextPack1CRC != CalculatedCDTP1CRC && CDTextPack1CRC != 0) + if(CDTextPack1CRC != CalculatedCDTP1CRC && CDTextPack1CRC != 0) { DicConsole.DebugWriteLine("CD checksums", "CD-Text Pack 1 CRC 0x{0:X4}, expected 0x{1:X4}", CDTextPack1CRC, CalculatedCDTP1CRC); status = false; } } - if ((CDTextPack2[0] & 0x80) == 0x80) + if((CDTextPack2[0] & 0x80) == 0x80) { UInt16 CDTextPack2CRC = BigEndianBitConverter.ToUInt16(CDTextPack2, 16); byte[] CDTextPack2ForCRC = new byte[16]; @@ -502,14 +502,14 @@ namespace DiscImageChef.Checksums UInt16 CalculatedCDTP2CRC = CalculateCCITT_CRC16(CDTextPack2ForCRC); DicConsole.DebugWriteLine("CD checksums", "Cyclic CDTP2 0x{0:X4}, Calc CDTP2 0x{1:X4}", CDTextPack2CRC, CalculatedCDTP2CRC); - if (CDTextPack2CRC != CalculatedCDTP2CRC && CDTextPack2CRC != 0) + if(CDTextPack2CRC != CalculatedCDTP2CRC && CDTextPack2CRC != 0) { DicConsole.DebugWriteLine("CD checksums", "CD-Text Pack 2 CRC 0x{0:X4}, expected 0x{1:X4}", CDTextPack2CRC, CalculatedCDTP2CRC); status = false; } } - if ((CDTextPack3[0] & 0x80) == 0x80) + if((CDTextPack3[0] & 0x80) == 0x80) { UInt16 CDTextPack3CRC = BigEndianBitConverter.ToUInt16(CDTextPack3, 16); byte[] CDTextPack3ForCRC = new byte[16]; @@ -517,14 +517,14 @@ namespace DiscImageChef.Checksums UInt16 CalculatedCDTP3CRC = CalculateCCITT_CRC16(CDTextPack3ForCRC); DicConsole.DebugWriteLine("CD checksums", "Cyclic CDTP3 0x{0:X4}, Calc CDTP3 0x{1:X4}", CDTextPack3CRC, CalculatedCDTP3CRC); - if (CDTextPack3CRC != CalculatedCDTP3CRC && CDTextPack3CRC != 0) + if(CDTextPack3CRC != CalculatedCDTP3CRC && CDTextPack3CRC != 0) { DicConsole.DebugWriteLine("CD checksums", "CD-Text Pack 3 CRC 0x{0:X4}, expected 0x{1:X4}", CDTextPack3CRC, CalculatedCDTP3CRC); status = false; } } - if ((CDTextPack4[0] & 0x80) == 0x80) + if((CDTextPack4[0] & 0x80) == 0x80) { UInt16 CDTextPack4CRC = BigEndianBitConverter.ToUInt16(CDTextPack4, 16); byte[] CDTextPack4ForCRC = new byte[16]; @@ -532,7 +532,7 @@ namespace DiscImageChef.Checksums UInt16 CalculatedCDTP4CRC = CalculateCCITT_CRC16(CDTextPack4ForCRC); DicConsole.DebugWriteLine("CD checksums", "Cyclic CDTP4 0x{0:X4}, Calc CDTP4 0x{1:X4}", CDTextPack4CRC, CalculatedCDTP4CRC); - if (CDTextPack4CRC != CalculatedCDTP4CRC && CDTextPack4CRC != 0) + if(CDTextPack4CRC != CalculatedCDTP4CRC && CDTextPack4CRC != 0) { DicConsole.DebugWriteLine("CD checksums", "CD-Text Pack 4 CRC 0x{0:X4}, expected 0x{1:X4}", CDTextPack4CRC, CalculatedCDTP4CRC); status = false; @@ -581,7 +581,7 @@ namespace DiscImageChef.Checksums static ushort CalculateCCITT_CRC16(byte[] buffer) { UInt16 CRC16 = 0; - for (int i = 0; i < buffer.Length; i++) + for(int i = 0; i < buffer.Length; i++) { CRC16 = (ushort)(CCITT_CRC16Table[(CRC16 >> 8) ^ buffer[i]] ^ (CRC16 << 8)); } diff --git a/DiscImageChef.Checksums/CRC16Context.cs b/DiscImageChef.Checksums/CRC16Context.cs index d59eb18b4..e2cca87ec 100644 --- a/DiscImageChef.Checksums/CRC16Context.cs +++ b/DiscImageChef.Checksums/CRC16Context.cs @@ -60,11 +60,11 @@ namespace DiscImageChef.Checksums hashInt = crc16Seed; table = new UInt16[256]; - for (int i = 0; i < 256; i++) + for(int i = 0; i < 256; i++) { UInt16 entry = (UInt16)i; - for (int j = 0; j < 8; j++) - if ((entry & 1) == 1) + for(int j = 0; j < 8; j++) + if((entry & 1) == 1) entry = (ushort)((entry >> 1) ^ crc16Poly); else entry = (ushort)(entry >> 1); @@ -79,7 +79,7 @@ namespace DiscImageChef.Checksums /// Length of buffer to hash. public void Update(byte[] data, uint len) { - for (int i = 0; i < len; i++) + for(int i = 0; i < len; i++) hashInt = (ushort)((hashInt >> 8) ^ table[data[i] ^ (hashInt & 0xFF)]); } @@ -111,7 +111,7 @@ namespace DiscImageChef.Checksums StringBuilder crc16Output = new StringBuilder(); BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; - for (int i = 0; i < BigEndianBitConverter.GetBytes(hashInt).Length; i++) + for(int i = 0; i < BigEndianBitConverter.GetBytes(hashInt).Length; i++) { crc16Output.Append(BigEndianBitConverter.GetBytes(hashInt)[i].ToString("x2")); } @@ -144,18 +144,18 @@ namespace DiscImageChef.Checksums localhashInt = crc16Seed; localTable = new UInt16[256]; - for (int i = 0; i < 256; i++) + for(int i = 0; i < 256; i++) { UInt16 entry = (UInt16)i; - for (int j = 0; j < 8; j++) - if ((entry & 1) == 1) + for(int j = 0; j < 8; j++) + if((entry & 1) == 1) entry = (ushort)((entry >> 1) ^ crc16Poly); else entry = (ushort)(entry >> 1); localTable[i] = entry; } - for (int i = 0; i < fileStream.Length; i++) + for(int i = 0; i < fileStream.Length; i++) localhashInt = (ushort)((localhashInt >> 8) ^ localTable[fileStream.ReadByte() ^ localhashInt & 0xff]); BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; @@ -163,7 +163,7 @@ namespace DiscImageChef.Checksums StringBuilder crc16Output = new StringBuilder(); - for (int i = 0; i < hash.Length; i++) + for(int i = 0; i < hash.Length; i++) { crc16Output.Append(hash[i].ToString("x2")); } @@ -198,18 +198,18 @@ namespace DiscImageChef.Checksums localhashInt = seed; localTable = new UInt16[256]; - for (int i = 0; i < 256; i++) + for(int i = 0; i < 256; i++) { UInt16 entry = (UInt16)i; - for (int j = 0; j < 8; j++) - if ((entry & 1) == 1) + for(int j = 0; j < 8; j++) + if((entry & 1) == 1) entry = (ushort)((entry >> 1) ^ polynomial); else entry = (ushort)(entry >> 1); localTable[i] = entry; } - for (int i = 0; i < len; i++) + for(int i = 0; i < len; i++) localhashInt = (ushort)((localhashInt >> 8) ^ localTable[data[i] ^ localhashInt & 0xff]); BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; @@ -217,7 +217,7 @@ namespace DiscImageChef.Checksums StringBuilder crc16Output = new StringBuilder(); - for (int i = 0; i < hash.Length; i++) + for(int i = 0; i < hash.Length; i++) { crc16Output.Append(hash[i].ToString("x2")); } diff --git a/DiscImageChef.Checksums/CRC32Context.cs b/DiscImageChef.Checksums/CRC32Context.cs index 355b4588d..664a66208 100644 --- a/DiscImageChef.Checksums/CRC32Context.cs +++ b/DiscImageChef.Checksums/CRC32Context.cs @@ -60,11 +60,11 @@ namespace DiscImageChef.Checksums hashInt = crc32Seed; table = new UInt32[256]; - for (int i = 0; i < 256; i++) + for(int i = 0; i < 256; i++) { UInt32 entry = (UInt32)i; - for (int j = 0; j < 8; j++) - if ((entry & 1) == 1) + for(int j = 0; j < 8; j++) + if((entry & 1) == 1) entry = (entry >> 1) ^ crc32Poly; else entry = entry >> 1; @@ -79,7 +79,7 @@ namespace DiscImageChef.Checksums /// Length of buffer to hash. public void Update(byte[] data, uint len) { - for (int i = 0; i < len; i++) + for(int i = 0; i < len; i++) hashInt = (hashInt >> 8) ^ table[data[i] ^ hashInt & 0xff]; } @@ -111,7 +111,7 @@ namespace DiscImageChef.Checksums StringBuilder crc32Output = new StringBuilder(); BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; - for (int i = 0; i < BigEndianBitConverter.GetBytes(hashInt).Length; i++) + for(int i = 0; i < BigEndianBitConverter.GetBytes(hashInt).Length; i++) { crc32Output.Append(BigEndianBitConverter.GetBytes(hashInt)[i].ToString("x2")); } @@ -144,18 +144,18 @@ namespace DiscImageChef.Checksums localhashInt = crc32Seed; localTable = new UInt32[256]; - for (int i = 0; i < 256; i++) + for(int i = 0; i < 256; i++) { UInt32 entry = (UInt32)i; - for (int j = 0; j < 8; j++) - if ((entry & 1) == 1) + for(int j = 0; j < 8; j++) + if((entry & 1) == 1) entry = (entry >> 1) ^ crc32Poly; else entry = entry >> 1; localTable[i] = entry; } - for (int i = 0; i < fileStream.Length; i++) + for(int i = 0; i < fileStream.Length; i++) localhashInt = (localhashInt >> 8) ^ localTable[fileStream.ReadByte() ^ localhashInt & 0xff]; BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; @@ -163,7 +163,7 @@ namespace DiscImageChef.Checksums StringBuilder crc32Output = new StringBuilder(); - for (int i = 0; i < hash.Length; i++) + for(int i = 0; i < hash.Length; i++) { crc32Output.Append(hash[i].ToString("x2")); } @@ -198,18 +198,18 @@ namespace DiscImageChef.Checksums localhashInt = seed; localTable = new UInt32[256]; - for (int i = 0; i < 256; i++) + for(int i = 0; i < 256; i++) { UInt32 entry = (UInt32)i; - for (int j = 0; j < 8; j++) - if ((entry & 1) == 1) + for(int j = 0; j < 8; j++) + if((entry & 1) == 1) entry = (entry >> 1) ^ polynomial; else entry = entry >> 1; localTable[i] = entry; } - for (int i = 0; i < len; i++) + for(int i = 0; i < len; i++) localhashInt = (localhashInt >> 8) ^ localTable[data[i] ^ localhashInt & 0xff]; BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; @@ -217,7 +217,7 @@ namespace DiscImageChef.Checksums StringBuilder crc32Output = new StringBuilder(); - for (int i = 0; i < hash.Length; i++) + for(int i = 0; i < hash.Length; i++) { crc32Output.Append(hash[i].ToString("x2")); } diff --git a/DiscImageChef.Checksums/CRC64Context.cs b/DiscImageChef.Checksums/CRC64Context.cs index ca965d50d..acb551657 100644 --- a/DiscImageChef.Checksums/CRC64Context.cs +++ b/DiscImageChef.Checksums/CRC64Context.cs @@ -59,11 +59,11 @@ namespace DiscImageChef.Checksums hashInt = crc64Seed; table = new UInt64[256]; - for (int i = 0; i < 256; i++) + for(int i = 0; i < 256; i++) { UInt64 entry = (UInt64)i; - for (int j = 0; j < 8; j++) - if ((entry & 1) == 1) + for(int j = 0; j < 8; j++) + if((entry & 1) == 1) entry = (entry >> 1) ^ crc64Poly; else entry = entry >> 1; @@ -78,7 +78,7 @@ namespace DiscImageChef.Checksums /// Length of buffer to hash. public void Update(byte[] data, uint len) { - for (int i = 0; i < len; i++) + for(int i = 0; i < len; i++) hashInt = (hashInt >> 8) ^ table[data[i] ^ hashInt & 0xff]; } @@ -110,7 +110,7 @@ namespace DiscImageChef.Checksums StringBuilder crc64Output = new StringBuilder(); BigEndianBitConverter.IsLittleEndian = BigEndianBitConverter.IsLittleEndian; - for (int i = 0; i < BigEndianBitConverter.GetBytes(hashInt).Length; i++) + for(int i = 0; i < BigEndianBitConverter.GetBytes(hashInt).Length; i++) { crc64Output.Append(BigEndianBitConverter.GetBytes(hashInt)[i].ToString("x2")); } @@ -143,18 +143,18 @@ namespace DiscImageChef.Checksums localhashInt = crc64Seed; localTable = new UInt64[256]; - for (int i = 0; i < 256; i++) + for(int i = 0; i < 256; i++) { UInt64 entry = (UInt64)i; - for (int j = 0; j < 8; j++) - if ((entry & 1) == 1) + for(int j = 0; j < 8; j++) + if((entry & 1) == 1) entry = (entry >> 1) ^ crc64Poly; else entry = entry >> 1; localTable[i] = entry; } - for (int i = 0; i < fileStream.Length; i++) + for(int i = 0; i < fileStream.Length; i++) localhashInt = (localhashInt >> 8) ^ localTable[(ulong)fileStream.ReadByte() ^ localhashInt & (ulong)0xff]; BigEndianBitConverter.IsLittleEndian = BigEndianBitConverter.IsLittleEndian; @@ -162,7 +162,7 @@ namespace DiscImageChef.Checksums StringBuilder crc64Output = new StringBuilder(); - for (int i = 0; i < hash.Length; i++) + for(int i = 0; i < hash.Length; i++) { crc64Output.Append(hash[i].ToString("x2")); } @@ -197,18 +197,18 @@ namespace DiscImageChef.Checksums localhashInt = seed; localTable = new UInt64[256]; - for (int i = 0; i < 256; i++) + for(int i = 0; i < 256; i++) { UInt64 entry = (UInt64)i; - for (int j = 0; j < 8; j++) - if ((entry & 1) == 1) + for(int j = 0; j < 8; j++) + if((entry & 1) == 1) entry = (entry >> 1) ^ polynomial; else entry = entry >> 1; localTable[i] = entry; } - for (int i = 0; i < len; i++) + for(int i = 0; i < len; i++) localhashInt = (localhashInt >> 8) ^ localTable[data[i] ^ localhashInt & 0xff]; BigEndianBitConverter.IsLittleEndian = BigEndianBitConverter.IsLittleEndian; @@ -216,7 +216,7 @@ namespace DiscImageChef.Checksums StringBuilder crc64Output = new StringBuilder(); - for (int i = 0; i < hash.Length; i++) + for(int i = 0; i < hash.Length; i++) { crc64Output.Append(hash[i].ToString("x2")); } diff --git a/DiscImageChef.Checksums/FletcherContext.cs b/DiscImageChef.Checksums/FletcherContext.cs index f433a5639..ef9048a79 100644 --- a/DiscImageChef.Checksums/FletcherContext.cs +++ b/DiscImageChef.Checksums/FletcherContext.cs @@ -69,15 +69,15 @@ namespace DiscImageChef.Checksums public void Update(byte[] data, uint len) { UInt16 block; - if (!inodd) + if(!inodd) { // Odd size - if (len % 2 != 0) + if(len % 2 != 0) { oddValue = data[len - 1]; inodd = true; - for (int i = 0; i < len - 1; i += 2) + for(int i = 0; i < len - 1; i += 2) { block = BigEndianBitConverter.ToUInt16(data, i); sum1 = (UInt16)((sum1 + block) % 0xFFFF); @@ -87,7 +87,7 @@ namespace DiscImageChef.Checksums else { inodd = false; - for (int i = 0; i < len; i += 2) + for(int i = 0; i < len; i += 2) { block = BigEndianBitConverter.ToUInt16(data, i); sum1 = (UInt16)((sum1 + block) % 0xFFFF); @@ -107,12 +107,12 @@ namespace DiscImageChef.Checksums sum2 = (UInt16)((sum2 + sum1) % 0xFFFF); // Even size, carrying odd - if (len % 2 == 0) + if(len % 2 == 0) { oddValue = data[len - 1]; inodd = true; - for (int i = 1; i < len - 1; i += 2) + for(int i = 1; i < len - 1; i += 2) { block = BigEndianBitConverter.ToUInt16(data, i); sum1 = (UInt16)((sum1 + block) % 0xFFFF); @@ -122,7 +122,7 @@ namespace DiscImageChef.Checksums else { inodd = false; - for (int i = 1; i < len; i += 2) + for(int i = 1; i < len; i += 2) { block = BigEndianBitConverter.ToUInt16(data, i); sum1 = (UInt16)((sum1 + block) % 0xFFFF); @@ -158,7 +158,7 @@ namespace DiscImageChef.Checksums UInt32 finalSum = (UInt32)(sum1 + (sum2 << 16)); StringBuilder fletcherOutput = new StringBuilder(); - for (int i = 0; i < BigEndianBitConverter.GetBytes(finalSum).Length; i++) + for(int i = 0; i < BigEndianBitConverter.GetBytes(finalSum).Length; i++) { fletcherOutput.Append(BigEndianBitConverter.GetBytes(finalSum)[i].ToString("x2")); } @@ -193,9 +193,9 @@ namespace DiscImageChef.Checksums localSum2 = 0xFFFF; block = 0; - if (fileStream.Length % 2 == 0) + if(fileStream.Length % 2 == 0) { - for (int i = 0; i < fileStream.Length; i += 2) + for(int i = 0; i < fileStream.Length; i += 2) { blockBytes = new byte[2]; fileStream.Read(blockBytes, 0, 2); @@ -206,7 +206,7 @@ namespace DiscImageChef.Checksums } else { - for (int i = 0; i < fileStream.Length - 1; i += 2) + for(int i = 0; i < fileStream.Length - 1; i += 2) { blockBytes = new byte[2]; fileStream.Read(blockBytes, 0, 2); @@ -230,7 +230,7 @@ namespace DiscImageChef.Checksums StringBuilder fletcherOutput = new StringBuilder(); - for (int i = 0; i < hash.Length; i++) + for(int i = 0; i < hash.Length; i++) { fletcherOutput.Append(hash[i].ToString("x2")); } @@ -253,9 +253,9 @@ namespace DiscImageChef.Checksums localSum2 = 0xFFFF; block = 0; - if (len % 2 == 0) + if(len % 2 == 0) { - for (int i = 0; i < len; i += 2) + for(int i = 0; i < len; i += 2) { block = BigEndianBitConverter.ToUInt16(data, i); localSum1 = (UInt16)((localSum1 + block) % 0xFFFF); @@ -264,7 +264,7 @@ namespace DiscImageChef.Checksums } else { - for (int i = 0; i < len - 1; i += 2) + for(int i = 0; i < len - 1; i += 2) { block = BigEndianBitConverter.ToUInt16(data, i); localSum1 = (UInt16)((localSum1 + block) % 0xFFFF); @@ -286,7 +286,7 @@ namespace DiscImageChef.Checksums StringBuilder fletcherOutput = new StringBuilder(); - for (int i = 0; i < hash.Length; i++) + for(int i = 0; i < hash.Length; i++) { fletcherOutput.Append(hash[i].ToString("x2")); } @@ -325,7 +325,7 @@ namespace DiscImageChef.Checksums /// Length of buffer to hash. public void Update(byte[] data, uint len) { - for (int i = 0; i < len; i++) + for(int i = 0; i < len; i++) { sum1 = (byte)((sum1 + data[i]) % 0xFF); sum2 = (byte)((sum2 + sum1) % 0xFF); @@ -358,7 +358,7 @@ namespace DiscImageChef.Checksums UInt16 finalSum = (UInt16)(sum1 + (sum2 << 8)); StringBuilder fletcherOutput = new StringBuilder(); - for (int i = 0; i < BigEndianBitConverter.GetBytes(finalSum).Length; i++) + for(int i = 0; i < BigEndianBitConverter.GetBytes(finalSum).Length; i++) { fletcherOutput.Append(BigEndianBitConverter.GetBytes(finalSum)[i].ToString("x2")); } @@ -392,7 +392,7 @@ namespace DiscImageChef.Checksums localSum2 = 0xFF; block = 0; - for (int i = 0; i < fileStream.Length; i += 2) + for(int i = 0; i < fileStream.Length; i += 2) { block = (byte)fileStream.ReadByte(); localSum1 = (byte)((localSum1 + block) % 0xFF); @@ -405,7 +405,7 @@ namespace DiscImageChef.Checksums StringBuilder fletcherOutput = new StringBuilder(); - for (int i = 0; i < hash.Length; i++) + for(int i = 0; i < hash.Length; i++) { fletcherOutput.Append(hash[i].ToString("x2")); } @@ -427,7 +427,7 @@ namespace DiscImageChef.Checksums localSum1 = 0xFF; localSum2 = 0xFF; - for (int i = 0; i < len; i++) + for(int i = 0; i < len; i++) { localSum1 = (byte)((localSum1 + data[i]) % 0xFF); localSum2 = (byte)((localSum2 + localSum1) % 0xFF); @@ -439,7 +439,7 @@ namespace DiscImageChef.Checksums StringBuilder fletcherOutput = new StringBuilder(); - for (int i = 0; i < hash.Length; i++) + for(int i = 0; i < hash.Length; i++) { fletcherOutput.Append(hash[i].ToString("x2")); } diff --git a/DiscImageChef.Checksums/MD5Context.cs b/DiscImageChef.Checksums/MD5Context.cs index d7cad56cb..6e61ad2e9 100644 --- a/DiscImageChef.Checksums/MD5Context.cs +++ b/DiscImageChef.Checksums/MD5Context.cs @@ -89,10 +89,10 @@ namespace DiscImageChef.Checksums /// public string End() { - _md5Provider.TransformFinalBlock(new byte[0], 0, 0); + _md5Provider.TransformFinalBlock(new byte[0], 0, 0); StringBuilder md5Output = new StringBuilder(); - for (int i = 0; i < _md5Provider.Hash.Length; i++) + for(int i = 0; i < _md5Provider.Hash.Length; i++) { md5Output.Append(_md5Provider.Hash[i].ToString("x2")); } @@ -121,7 +121,7 @@ namespace DiscImageChef.Checksums hash = _md5Provider.ComputeHash(fileStream); StringBuilder md5Output = new StringBuilder(); - for (int i = 0; i < hash.Length; i++) + for(int i = 0; i < hash.Length; i++) { md5Output.Append(hash[i].ToString("x2")); } @@ -140,7 +140,7 @@ namespace DiscImageChef.Checksums hash = _md5Provider.ComputeHash(data, 0, (int)len); StringBuilder md5Output = new StringBuilder(); - for (int i = 0; i < hash.Length; i++) + for(int i = 0; i < hash.Length; i++) { md5Output.Append(hash[i].ToString("x2")); } diff --git a/DiscImageChef.Checksums/RIPEMD160Context.cs b/DiscImageChef.Checksums/RIPEMD160Context.cs index 47b4a6a86..52c4e21ba 100644 --- a/DiscImageChef.Checksums/RIPEMD160Context.cs +++ b/DiscImageChef.Checksums/RIPEMD160Context.cs @@ -92,7 +92,7 @@ namespace DiscImageChef.Checksums _ripemd160Provider.TransformFinalBlock(new byte[0], 0, 0); StringBuilder ripemd160Output = new StringBuilder(); - for (int i = 0; i < _ripemd160Provider.Hash.Length; i++) + for(int i = 0; i < _ripemd160Provider.Hash.Length; i++) { ripemd160Output.Append(_ripemd160Provider.Hash[i].ToString("x2")); } @@ -121,7 +121,7 @@ namespace DiscImageChef.Checksums hash = _ripemd160Provider.ComputeHash(fileStream); StringBuilder ripemd160Output = new StringBuilder(); - for (int i = 0; i < hash.Length; i++) + for(int i = 0; i < hash.Length; i++) { ripemd160Output.Append(hash[i].ToString("x2")); } @@ -140,7 +140,7 @@ namespace DiscImageChef.Checksums hash = _ripemd160Provider.ComputeHash(data, 0, (int)len); StringBuilder ripemd160Output = new StringBuilder(); - for (int i = 0; i < hash.Length; i++) + for(int i = 0; i < hash.Length; i++) { ripemd160Output.Append(hash[i].ToString("x2")); } diff --git a/DiscImageChef.Checksums/ReedSolomon.cs b/DiscImageChef.Checksums/ReedSolomon.cs index 009b6ebe3..28725104a 100644 --- a/DiscImageChef.Checksums/ReedSolomon.cs +++ b/DiscImageChef.Checksums/ReedSolomon.cs @@ -97,52 +97,52 @@ namespace DiscImageChef.Checksums /// public void InitRS(int n, int k, int m) { - switch (m) + switch(m) { case 2: - Pp = new []{ 1, 1, 1 }; + Pp = new[] { 1, 1, 1 }; break; case 3: - Pp = new []{ 1, 1, 0, 1 }; + Pp = new[] { 1, 1, 0, 1 }; break; case 4: - Pp = new []{ 1, 1, 0, 0, 1 }; + Pp = new[] { 1, 1, 0, 0, 1 }; break; case 5: - Pp = new []{ 1, 0, 1, 0, 0, 1 }; + Pp = new[] { 1, 0, 1, 0, 0, 1 }; break; case 6: - Pp = new []{ 1, 1, 0, 0, 0, 0, 1 }; + Pp = new[] { 1, 1, 0, 0, 0, 0, 1 }; break; case 7: - Pp = new []{ 1, 0, 0, 1, 0, 0, 0, 1 }; + Pp = new[] { 1, 0, 0, 1, 0, 0, 0, 1 }; break; case 8: - Pp = new []{ 1, 0, 1, 1, 1, 0, 0, 0, 1 }; + Pp = new[] { 1, 0, 1, 1, 1, 0, 0, 0, 1 }; break; case 9: - Pp = new []{ 1, 0, 0, 0, 1, 0, 0, 0, 0, 1 }; + Pp = new[] { 1, 0, 0, 0, 1, 0, 0, 0, 0, 1 }; break; case 10: - Pp = new []{ 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1 }; + Pp = new[] { 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1 }; break; case 11: - Pp = new []{ 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + Pp = new[] { 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; break; case 12: - Pp = new []{ 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1 }; + Pp = new[] { 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1 }; break; case 13: - Pp = new []{ 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + Pp = new[] { 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; break; case 14: - Pp = new []{ 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1 }; + Pp = new[] { 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1 }; break; case 15: - Pp = new []{ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + Pp = new[] { 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; break; case 16: - Pp = new []{ 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1 }; + Pp = new[] { 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1 }; break; default: throw new ArgumentOutOfRangeException("m", "m must be between 2 and 16 inclusive"); @@ -166,7 +166,7 @@ namespace DiscImageChef.Checksums int modnn(int x) { - while (x >= NN) + while(x >= NN) { x -= NN; x = (x >> MM) + (x & NN); @@ -182,21 +182,21 @@ namespace DiscImageChef.Checksums static void CLEAR(ref int[] a, int n) { int ci; - for (ci = (n) - 1; ci >= 0; ci--) + for(ci = (n) - 1; ci >= 0; ci--) (a)[ci] = 0; } static void COPY(ref int[] a, ref int[] b, int n) { int ci; - for (ci = (n) - 1; ci >= 0; ci--) + for(ci = (n) - 1; ci >= 0; ci--) (a)[ci] = (b)[ci]; } static void COPYDOWN(ref int[] a, ref int[] b, int n) { int ci; - for (ci = (n) - 1; ci >= 0; ci--) + for(ci = (n) - 1; ci >= 0; ci--) (a)[ci] = (b)[ci]; } @@ -236,12 +236,12 @@ namespace DiscImageChef.Checksums mask = 1; Alpha_to[MM] = 0; - for (i = 0; i < MM; i++) + for(i = 0; i < MM; i++) { Alpha_to[i] = mask; Index_of[Alpha_to[i]] = i; /* If Pp[i] == 1 then, term @^i occurs in poly-repr of @^MM */ - if (Pp[i] != 0) + if(Pp[i] != 0) Alpha_to[MM] ^= mask; /* Bit-wise EXOR operation */ mask <<= 1; /* single left-shift */ } @@ -252,9 +252,9 @@ namespace DiscImageChef.Checksums * term that may occur when poly-repr of @^i is shifted. */ mask >>= 1; - for (i = MM + 1; i < NN; i++) + for(i = MM + 1; i < NN; i++) { - if (Alpha_to[i - 1] >= mask) + if(Alpha_to[i - 1] >= mask) Alpha_to[i] = Alpha_to[MM] ^ ((Alpha_to[i - 1] ^ mask) << 1); else Alpha_to[i] = Alpha_to[i - 1] << 1; @@ -283,15 +283,15 @@ namespace DiscImageChef.Checksums Gg[0] = Alpha_to[B0]; Gg[1] = 1; /* g(x) = (X+@**B0) initially */ - for (i = 2; i <= NN - KK; i++) + for(i = 2; i <= NN - KK; i++) { Gg[i] = 1; /* * Below multiply (Gg[0]+Gg[1]*x + ... +Gg[i]x^i) by * (@**(B0+i-1) + x) */ - for (j = i - 1; j > 0; j--) - if (Gg[j] != 0) + for(j = i - 1; j > 0; j--) + if(Gg[j] != 0) Gg[j] = Gg[j - 1] ^ Alpha_to[modnn((Index_of[Gg[j]]) + B0 + i - 1)]; else Gg[j] = Gg[j - 1]; @@ -299,7 +299,7 @@ namespace DiscImageChef.Checksums Gg[0] = Alpha_to[modnn((Index_of[Gg[0]]) + B0 + i - 1)]; } /* convert Gg[] to index form for quicker encoding */ - for (i = 0; i <= NN - KK; i++) + for(i = 0; i <= NN - KK; i++) Gg[i] = Index_of[Gg[i]]; } @@ -319,25 +319,25 @@ namespace DiscImageChef.Checksums /// Outs parity symbols. public int encode_rs(int[] data, out int[] bb) { - if (initialized) + if(initialized) { int i, j; int feedback; bb = new int[NN - KK]; CLEAR(ref bb, NN - KK); - for (i = KK - 1; i >= 0; i--) + for(i = KK - 1; i >= 0; i--) { - if (MM != 8) + if(MM != 8) { - if (data[i] > NN) + if(data[i] > NN) return -1; /* Illegal symbol */ } feedback = Index_of[data[i] ^ bb[NN - KK - 1]]; - if (feedback != A0) + if(feedback != A0) { /* feedback term is non-zero */ - for (j = NN - KK - 1; j > 0; j--) - if (Gg[j] != A0) + for(j = NN - KK - 1; j > 0; j--) + if(Gg[j] != A0) bb[j] = bb[j - 1] ^ Alpha_to[modnn(Gg[j] + feedback)]; else bb[j] = bb[j - 1]; @@ -346,7 +346,7 @@ namespace DiscImageChef.Checksums else { /* feedback term is zero. encoder becomes a * single-byte shifter */ - for (j = NN - KK - 1; j > 0; j--) + for(j = NN - KK - 1; j > 0; j--) bb[j] = bb[j - 1]; bb[0] = 0; } @@ -378,7 +378,7 @@ namespace DiscImageChef.Checksums /// Number of erasures. public int eras_dec_rs(ref int[] data, out int[] eras_pos, int no_eras) { - if (initialized) + if(initialized) { eras_pos = new int[NN - KK]; int deg_lambda, el, deg_omega; @@ -396,11 +396,11 @@ namespace DiscImageChef.Checksums int syn_error, count; /* data[] is in polynomial form, copy and convert to index form */ - for (i = NN - 1; i >= 0; i--) + for(i = NN - 1; i >= 0; i--) { - if (MM != 8) + if(MM != 8) { - if (data[i] > NN) + if(data[i] > NN) return -1; /* Illegal symbol */ } recd[i] = Index_of[data[i]]; @@ -409,18 +409,18 @@ namespace DiscImageChef.Checksums * namely @**(B0+i), i = 0, ... ,(NN-KK-1) */ syn_error = 0; - for (i = 1; i <= NN - KK; i++) + for(i = 1; i <= NN - KK; i++) { tmp = 0; - for (j = 0; j < NN; j++) - if (recd[j] != A0) /* recd[j] in index form */ + for(j = 0; j < NN; j++) + if(recd[j] != A0) /* recd[j] in index form */ tmp ^= Alpha_to[modnn(recd[j] + (B0 + i - 1) * j)]; syn_error |= tmp; /* set flag if non-zero syndrome => * error */ /* store syndrome in index form */ s[i] = Index_of[tmp]; } - if (syn_error == 0) + if(syn_error == 0) { /* * if syndrome is zero, data[] is a codeword and there are no @@ -430,36 +430,36 @@ namespace DiscImageChef.Checksums } CLEAR(ref lambda, NN - KK); lambda[0] = 1; - if (no_eras > 0) + if(no_eras > 0) { /* Init lambda to be the erasure locator polynomial */ lambda[1] = Alpha_to[eras_pos[0]]; - for (i = 1; i < no_eras; i++) + for(i = 1; i < no_eras; i++) { u = eras_pos[i]; - for (j = i + 1; j > 0; j--) + for(j = i + 1; j > 0; j--) { tmp = Index_of[lambda[j - 1]]; - if (tmp != A0) + if(tmp != A0) lambda[j] ^= Alpha_to[modnn(u + tmp)]; } } - #if DEBUG +#if DEBUG /* find roots of the erasure location polynomial */ - for (i = 1; i <= no_eras; i++) + for(i = 1; i <= no_eras; i++) reg[i] = Index_of[lambda[i]]; count = 0; - for (i = 1; i <= NN; i++) + for(i = 1; i <= NN; i++) { q = 1; - for (j = 1; j <= no_eras; j++) - if (reg[j] != A0) + for(j = 1; j <= no_eras; j++) + if(reg[j] != A0) { reg[j] = modnn(reg[j] + j); q ^= Alpha_to[reg[j]]; } - if (q == 0) + if(q == 0) { /* store root and error location * number indices @@ -469,19 +469,19 @@ namespace DiscImageChef.Checksums count++; } } - if (count != no_eras) + if(count != no_eras) { DicConsole.DebugWriteLine("Reed Solomon", "\n lambda(x) is WRONG\n"); return -1; } DicConsole.DebugWriteLine("Reed Solomon", "\n Erasure positions as determined by roots of Eras Loc Poly:\n"); - for (i = 0; i < count; i++) + for(i = 0; i < count; i++) DicConsole.DebugWriteLine("Reed Solomon", "{0} ", loc[i]); DicConsole.DebugWriteLine("Reed Solomon", "\n"); - #endif +#endif } - for (i = 0; i < NN - KK + 1; i++) + for(i = 0; i < NN - KK + 1; i++) b[i] = Index_of[lambda[i]]; /* @@ -490,19 +490,19 @@ namespace DiscImageChef.Checksums */ r = no_eras; el = no_eras; - while (++r <= NN - KK) + while(++r <= NN - KK) { /* r is the step number */ /* Compute discrepancy at the r-th step in poly-form */ discr_r = 0; - for (i = 0; i < r; i++) + for(i = 0; i < r; i++) { - if ((lambda[i] != 0) && (s[r - i] != A0)) + if((lambda[i] != 0) && (s[r - i] != A0)) { discr_r ^= Alpha_to[modnn(Index_of[lambda[i]] + s[r - i])]; } } discr_r = Index_of[discr_r]; /* Index form */ - if (discr_r == A0) + if(discr_r == A0) { /* 2 lines below: B(x) <-- x*B(x) */ COPYDOWN(ref b, ref b, NN - KK); @@ -512,21 +512,21 @@ namespace DiscImageChef.Checksums { /* 7 lines below: T(x) <-- lambda(x) - discr_r*x*b(x) */ t[0] = lambda[0]; - for (i = 0; i < NN - KK; i++) + for(i = 0; i < NN - KK; i++) { - if (b[i] != A0) + if(b[i] != A0) t[i + 1] = lambda[i + 1] ^ Alpha_to[modnn(discr_r + b[i])]; else t[i + 1] = lambda[i + 1]; } - if (2 * el <= r + no_eras - 1) + if(2 * el <= r + no_eras - 1) { el = r + no_eras - el; /* * 2 lines below: B(x) <-- inv(discr_r) * * lambda(x) */ - for (i = 0; i <= NN - KK; i++) + for(i = 0; i <= NN - KK; i++) b[i] = (lambda[i] == 0) ? A0 : modnn(Index_of[lambda[i]] - discr_r + NN); } else @@ -541,10 +541,10 @@ namespace DiscImageChef.Checksums /* Convert lambda to index form and compute deg(lambda(x)) */ deg_lambda = 0; - for (i = 0; i < NN - KK + 1; i++) + for(i = 0; i < NN - KK + 1; i++) { lambda[i] = Index_of[lambda[i]]; - if (lambda[i] != A0) + if(lambda[i] != A0) deg_lambda = i; } /* @@ -555,16 +555,16 @@ namespace DiscImageChef.Checksums COPY(ref reg, ref lambda, NN - KK); reg[0] = temp; count = 0; /* Number of roots of lambda(x) */ - for (i = 1; i <= NN; i++) + for(i = 1; i <= NN; i++) { q = 1; - for (j = deg_lambda; j > 0; j--) - if (reg[j] != A0) + for(j = deg_lambda; j > 0; j--) + if(reg[j] != A0) { reg[j] = modnn(reg[j] + j); q ^= Alpha_to[reg[j]]; } - if (q == 0) + if(q == 0) { /* store root (index-form) and error location number */ root[count] = i; @@ -573,14 +573,14 @@ namespace DiscImageChef.Checksums } } - #if DEBUG +#if DEBUG DicConsole.DebugWriteLine("Reed Solomon", "\n Final error positions:\t"); - for (i = 0; i < count; i++) + for(i = 0; i < count; i++) DicConsole.DebugWriteLine("Reed Solomon", "{0} ", loc[i]); DicConsole.DebugWriteLine("Reed Solomon", "\n"); - #endif +#endif - if (deg_lambda != count) + if(deg_lambda != count) { /* * deg(lambda) unequal to number of roots => uncorrectable @@ -593,16 +593,16 @@ namespace DiscImageChef.Checksums * x**(NN-KK)). in index form. Also find deg(omega). */ deg_omega = 0; - for (i = 0; i < NN - KK; i++) + for(i = 0; i < NN - KK; i++) { tmp = 0; j = (deg_lambda < i) ? deg_lambda : i; - for (; j >= 0; j--) + for(; j >= 0; j--) { - if ((s[i + 1 - j] != A0) && (lambda[j] != A0)) + if((s[i + 1 - j] != A0) && (lambda[j] != A0)) tmp ^= Alpha_to[modnn(s[i + 1 - j] + lambda[j])]; } - if (tmp != 0) + if(tmp != 0) deg_omega = i; omega[i] = Index_of[tmp]; } @@ -612,30 +612,30 @@ namespace DiscImageChef.Checksums * Compute error values in poly-form. num1 = omega(inv(X(l))), num2 = * inv(X(l))**(B0-1) and den = lambda_pr(inv(X(l))) all in poly-form */ - for (j = count - 1; j >= 0; j--) + for(j = count - 1; j >= 0; j--) { num1 = 0; - for (i = deg_omega; i >= 0; i--) + for(i = deg_omega; i >= 0; i--) { - if (omega[i] != A0) + if(omega[i] != A0) num1 ^= Alpha_to[modnn(omega[i] + i * root[j])]; } num2 = Alpha_to[modnn(root[j] * (B0 - 1) + NN)]; den = 0; /* lambda[i+1] for i even is the formal derivative lambda_pr of lambda[i] */ - for (i = min(deg_lambda, NN - KK - 1) & ~1; i >= 0; i -= 2) + for(i = min(deg_lambda, NN - KK - 1) & ~1; i >= 0; i -= 2) { - if (lambda[i + 1] != A0) + if(lambda[i + 1] != A0) den ^= Alpha_to[modnn(lambda[i + 1] + i * root[j])]; } - if (den == 0) + if(den == 0) { DicConsole.DebugWriteLine("Reed Solomon", "\n ERROR: denominator = 0\n"); return -1; } /* Apply error to data */ - if (num1 != 0) + if(num1 != 0) { data[loc[j]] ^= Alpha_to[modnn(Index_of[num1] + Index_of[num2] + NN - Index_of[den])]; } diff --git a/DiscImageChef.Checksums/SHA1Context.cs b/DiscImageChef.Checksums/SHA1Context.cs index 22873d5c6..df05e15dc 100644 --- a/DiscImageChef.Checksums/SHA1Context.cs +++ b/DiscImageChef.Checksums/SHA1Context.cs @@ -92,7 +92,7 @@ namespace DiscImageChef.Checksums _sha1Provider.TransformFinalBlock(new byte[0], 0, 0); StringBuilder sha1Output = new StringBuilder(); - for (int i = 0; i < _sha1Provider.Hash.Length; i++) + for(int i = 0; i < _sha1Provider.Hash.Length; i++) { sha1Output.Append(_sha1Provider.Hash[i].ToString("x2")); } @@ -121,7 +121,7 @@ namespace DiscImageChef.Checksums hash = _sha1Provider.ComputeHash(fileStream); StringBuilder sha1Output = new StringBuilder(); - for (int i = 0; i < hash.Length; i++) + for(int i = 0; i < hash.Length; i++) { sha1Output.Append(hash[i].ToString("x2")); } @@ -140,7 +140,7 @@ namespace DiscImageChef.Checksums hash = _sha1Provider.ComputeHash(data, 0, (int)len); StringBuilder sha1Output = new StringBuilder(); - for (int i = 0; i < hash.Length; i++) + for(int i = 0; i < hash.Length; i++) { sha1Output.Append(hash[i].ToString("x2")); } diff --git a/DiscImageChef.Checksums/SHA256Context.cs b/DiscImageChef.Checksums/SHA256Context.cs index 6da3dbbeb..da2f37976 100644 --- a/DiscImageChef.Checksums/SHA256Context.cs +++ b/DiscImageChef.Checksums/SHA256Context.cs @@ -92,7 +92,7 @@ namespace DiscImageChef.Checksums _sha256Provider.TransformFinalBlock(new byte[0], 0, 0); StringBuilder sha256Output = new StringBuilder(); - for (int i = 0; i < _sha256Provider.Hash.Length; i++) + for(int i = 0; i < _sha256Provider.Hash.Length; i++) { sha256Output.Append(_sha256Provider.Hash[i].ToString("x2")); } @@ -121,7 +121,7 @@ namespace DiscImageChef.Checksums hash = _sha256Provider.ComputeHash(fileStream); StringBuilder sha256Output = new StringBuilder(); - for (int i = 0; i < hash.Length; i++) + for(int i = 0; i < hash.Length; i++) { sha256Output.Append(hash[i].ToString("x2")); } @@ -140,7 +140,7 @@ namespace DiscImageChef.Checksums hash = _sha256Provider.ComputeHash(data, 0, (int)len); StringBuilder sha256Output = new StringBuilder(); - for (int i = 0; i < hash.Length; i++) + for(int i = 0; i < hash.Length; i++) { sha256Output.Append(hash[i].ToString("x2")); } diff --git a/DiscImageChef.Checksums/SHA384Context.cs b/DiscImageChef.Checksums/SHA384Context.cs index c8f31c925..bc7cb8fc4 100644 --- a/DiscImageChef.Checksums/SHA384Context.cs +++ b/DiscImageChef.Checksums/SHA384Context.cs @@ -92,7 +92,7 @@ namespace DiscImageChef.Checksums _sha384Provider.TransformFinalBlock(new byte[0], 0, 0); StringBuilder sha384Output = new StringBuilder(); - for (int i = 0; i < _sha384Provider.Hash.Length; i++) + for(int i = 0; i < _sha384Provider.Hash.Length; i++) { sha384Output.Append(_sha384Provider.Hash[i].ToString("x2")); } @@ -121,7 +121,7 @@ namespace DiscImageChef.Checksums hash = _sha384Provider.ComputeHash(fileStream); StringBuilder sha384Output = new StringBuilder(); - for (int i = 0; i < hash.Length; i++) + for(int i = 0; i < hash.Length; i++) { sha384Output.Append(hash[i].ToString("x2")); } @@ -140,7 +140,7 @@ namespace DiscImageChef.Checksums hash = _sha384Provider.ComputeHash(data, 0, (int)len); StringBuilder sha384Output = new StringBuilder(); - for (int i = 0; i < hash.Length; i++) + for(int i = 0; i < hash.Length; i++) { sha384Output.Append(hash[i].ToString("x2")); } diff --git a/DiscImageChef.Checksums/SHA512Context.cs b/DiscImageChef.Checksums/SHA512Context.cs index 741a8f943..d9820cb1a 100644 --- a/DiscImageChef.Checksums/SHA512Context.cs +++ b/DiscImageChef.Checksums/SHA512Context.cs @@ -92,7 +92,7 @@ namespace DiscImageChef.Checksums _sha512Provider.TransformFinalBlock(new byte[0], 0, 0); StringBuilder sha512Output = new StringBuilder(); - for (int i = 0; i < _sha512Provider.Hash.Length; i++) + for(int i = 0; i < _sha512Provider.Hash.Length; i++) { sha512Output.Append(_sha512Provider.Hash[i].ToString("x2")); } @@ -121,7 +121,7 @@ namespace DiscImageChef.Checksums hash = _sha512Provider.ComputeHash(fileStream); StringBuilder sha512Output = new StringBuilder(); - for (int i = 0; i < hash.Length; i++) + for(int i = 0; i < hash.Length; i++) { sha512Output.Append(hash[i].ToString("x2")); } @@ -140,7 +140,7 @@ namespace DiscImageChef.Checksums hash = _sha512Provider.ComputeHash(data, 0, (int)len); StringBuilder sha512Output = new StringBuilder(); - for (int i = 0; i < hash.Length; i++) + for(int i = 0; i < hash.Length; i++) { sha512Output.Append(hash[i].ToString("x2")); } diff --git a/DiscImageChef.Checksums/SpamSumContext.cs b/DiscImageChef.Checksums/SpamSumContext.cs index 4a6ff6eaf..55ce3a460 100644 --- a/DiscImageChef.Checksums/SpamSumContext.cs +++ b/DiscImageChef.Checksums/SpamSumContext.cs @@ -122,7 +122,7 @@ namespace DiscImageChef.Checksums { self = new fuzzy_state(); self.bh = new blockhash_context[NUM_BLOCKHASHES]; - for (int i = 0; i < NUM_BLOCKHASHES; i++) + for(int i = 0; i < NUM_BLOCKHASHES; i++) self.bh[i].digest = new byte[SPAMSUM_LENGTH]; self.bhstart = 0; @@ -184,10 +184,10 @@ namespace DiscImageChef.Checksums { uint obh, nbh; - if (self.bhend >= NUM_BLOCKHASHES) + if(self.bhend >= NUM_BLOCKHASHES) return; - if (self.bhend == 0) // assert + if(self.bhend == 0) // assert throw new Exception("Assertion failed"); obh = self.bhend - 1; @@ -202,18 +202,18 @@ namespace DiscImageChef.Checksums void fuzzy_try_reduce_blockhash() { - if (self.bhstart >= self.bhend) + if(self.bhstart >= self.bhend) throw new Exception("Assertion failed"); - if (self.bhend - self.bhstart < 2) + if(self.bhend - self.bhstart < 2) /* Need at least two working hashes. */ return; - if ((UInt64)SSDEEP_BS(self.bhstart) * SPAMSUM_LENGTH >= + if((UInt64)SSDEEP_BS(self.bhstart) * SPAMSUM_LENGTH >= self.total_size) /* Initial blocksize estimate would select this or a smaller * blocksize. */ return; - if (self.bh[self.bhstart + 1].dlen < SPAMSUM_LENGTH / 2) + if(self.bh[self.bhstart + 1].dlen < SPAMSUM_LENGTH / 2) /* Estimate adjustment would select this blocksize. */ return; /* At this point we are clearly no longer interested in the @@ -231,16 +231,16 @@ namespace DiscImageChef.Checksums roll_hash(c); h = roll_sum(); - for (i = self.bhstart; i < self.bhend; ++i) + for(i = self.bhstart; i < self.bhend; ++i) { self.bh[i].h = sum_hash(c, self.bh[i].h); self.bh[i].halfh = sum_hash(c, self.bh[i].halfh); } - for (i = self.bhstart; i < self.bhend; ++i) + for(i = self.bhstart; i < self.bhend; ++i) { /* With growing blocksize almost no runs fail the next test. */ - if (h % SSDEEP_BS(i) != SSDEEP_BS(i) - 1) + if(h % SSDEEP_BS(i) != SSDEEP_BS(i) - 1) /* Once this condition is false for one bs, it is * automatically false for all further bs. I.e. if * h === -1 (mod 2*bs) then h === -1 (mod bs). */ @@ -248,7 +248,7 @@ namespace DiscImageChef.Checksums /* We have hit a reset point. We now emit hashes which are * based on all characters in the piece of the message between * the last reset point and this one */ - if (0 == self.bh[i].dlen) + if(0 == self.bh[i].dlen) { /* Can only happen 30 times. */ /* First step for this blocksize. Clone next. */ @@ -256,7 +256,7 @@ namespace DiscImageChef.Checksums } self.bh[i].digest[self.bh[i].dlen] = b64[self.bh[i].h % 64]; self.bh[i].halfdigest = b64[self.bh[i].halfh % 64]; - if (self.bh[i].dlen < SPAMSUM_LENGTH - 1) + if(self.bh[i].dlen < SPAMSUM_LENGTH - 1) { /* We can have a problem with the tail overflowing. The * easiest way to cope with this is to only reset the @@ -266,7 +266,7 @@ namespace DiscImageChef.Checksums * */ self.bh[i].digest[++(self.bh[i].dlen)] = 0; self.bh[i].h = HASH_INIT; - if (self.bh[i].dlen < SPAMSUM_LENGTH / 2) + if(self.bh[i].dlen < SPAMSUM_LENGTH / 2) { self.bh[i].halfh = HASH_INIT; self.bh[i].halfdigest = 0; @@ -285,7 +285,7 @@ namespace DiscImageChef.Checksums public void Update(byte[] data, uint len) { self.total_size += len; - for (int i = 0; i < len; i++) + for(int i = 0; i < len; i++) fuzzy_engine_step(data[i]); } @@ -308,34 +308,34 @@ namespace DiscImageChef.Checksums int remain = (int)(FUZZY_MAX_RESULT - 1); /* Exclude terminating '\0'. */ result = new byte[FUZZY_MAX_RESULT]; /* Verify that our elimination was not overeager. */ - if (!(bi == 0 || (UInt64)SSDEEP_BS(bi) / 2 * SPAMSUM_LENGTH < self.total_size)) + if(!(bi == 0 || (UInt64)SSDEEP_BS(bi) / 2 * SPAMSUM_LENGTH < self.total_size)) throw new Exception("Assertion failed"); result_off = 0; /* Initial blocksize guess. */ - while ((UInt64)SSDEEP_BS(bi) * SPAMSUM_LENGTH < self.total_size) + while((UInt64)SSDEEP_BS(bi) * SPAMSUM_LENGTH < self.total_size) { ++bi; - if (bi >= NUM_BLOCKHASHES) + if(bi >= NUM_BLOCKHASHES) { throw new OverflowException("The input exceeds data types."); } } /* Adapt blocksize guess to actual digest length. */ - while (bi >= self.bhend) + while(bi >= self.bhend) --bi; - while (bi > self.bhstart && self.bh[bi].dlen < SPAMSUM_LENGTH / 2) + while(bi > self.bhstart && self.bh[bi].dlen < SPAMSUM_LENGTH / 2) --bi; - if ((bi > 0 && self.bh[bi].dlen < SPAMSUM_LENGTH / 2)) + if((bi > 0 && self.bh[bi].dlen < SPAMSUM_LENGTH / 2)) throw new Exception("Assertion failed"); sb.AppendFormat("{0}:", SSDEEP_BS(bi)); i = Encoding.ASCII.GetBytes(sb.ToString()).Length; - if (i <= 0) + if(i <= 0) /* Maybe snprintf has set errno here? */ throw new OverflowException("The input exceeds data types."); - if (i >= remain) + if(i >= remain) throw new Exception("Assertion failed"); remain -= i; @@ -344,18 +344,18 @@ namespace DiscImageChef.Checksums result_off += i; i = (int)self.bh[bi].dlen; - if (i > remain) + if(i > remain) throw new Exception("Assertion failed"); Array.Copy(self.bh[bi].digest, 0, result, result_off, i); result_off += i; remain -= i; - if (h != 0) + if(h != 0) { - if (remain <= 0) + if(remain <= 0) throw new Exception("Assertion failed"); result[result_off] = b64[self.bh[bi].h % 64]; - if (i < 3 || + if(i < 3 || result[result_off] != result[result_off - 1] || result[result_off] != result[result_off - 2] || result[result_off] != result[result_off - 3]) @@ -364,12 +364,12 @@ namespace DiscImageChef.Checksums --remain; } } - else if (self.bh[bi].digest[i] != 0) + else if(self.bh[bi].digest[i] != 0) { - if (remain <= 0) + if(remain <= 0) throw new Exception("Assertion failed"); result[result_off] = self.bh[bi].digest[i]; - if (i < 3 || + if(i < 3 || result[result_off] != result[result_off - 1] || result[result_off] != result[result_off - 2] || result[result_off] != result[result_off - 3]) @@ -378,27 +378,27 @@ namespace DiscImageChef.Checksums --remain; } } - if (remain <= 0) + if(remain <= 0) throw new Exception("Assertion failed"); result[result_off++] = 0x3A; // ':' --remain; - if (bi < self.bhend - 1) + if(bi < self.bhend - 1) { ++bi; i = (int)self.bh[bi].dlen; - if (i > remain) + if(i > remain) throw new Exception("Assertion failed"); Array.Copy(self.bh[bi].digest, 0, result, result_off, i); result_off += i; remain -= i; - if (h != 0) + if(h != 0) { - if (remain <= 0) + if(remain <= 0) throw new Exception("Assertion failed"); h = self.bh[bi].halfh; result[result_off] = b64[h % 64]; - if (i < 3 || + if(i < 3 || result[result_off] != result[result_off - 1] || result[result_off] != result[result_off - 2] || result[result_off] != result[result_off - 3]) @@ -410,12 +410,12 @@ namespace DiscImageChef.Checksums else { i = self.bh[bi].halfdigest; - if (i != 0) + if(i != 0) { - if (remain <= 0) + if(remain <= 0) throw new Exception("Assertion failed"); result[result_off] = (byte)i; - if (i < 3 || + if(i < 3 || result[result_off] != result[result_off - 1] || result[result_off] != result[result_off - 2] || result[result_off] != result[result_off - 3]) @@ -426,11 +426,11 @@ namespace DiscImageChef.Checksums } } } - else if (h != 0) + else if(h != 0) { - if (self.bh[bi].dlen != 0) + if(self.bh[bi].dlen != 0) throw new Exception("Assertion failed"); - if (remain <= 0) + if(remain <= 0) throw new Exception("Assertion failed"); result[result_off++] = b64[self.bh[bi].h % 64]; /* No need to bother with FUZZY_FLAG_ELIMSEQ, because this @@ -519,9 +519,9 @@ namespace DiscImageChef.Checksums { StringBuilder sb = new StringBuilder(); - for (int i = 0; i < CString.Length; i++) + for(int i = 0; i < CString.Length; i++) { - if (CString[i] == 0) + if(CString[i] == 0) break; sb.Append(Encoding.ASCII.GetString(CString, i, 1)); diff --git a/DiscImageChef.CommonTypes/MediaType.cs b/DiscImageChef.CommonTypes/MediaType.cs index 7cd9e060d..e601af308 100644 --- a/DiscImageChef.CommonTypes/MediaType.cs +++ b/DiscImageChef.CommonTypes/MediaType.cs @@ -790,4 +790,3 @@ namespace DiscImageChef.CommonTypes #endregion Generic hard disks }; } - \ No newline at end of file diff --git a/DiscImageChef.CommonTypes/MediaTypeFromSCSI.cs b/DiscImageChef.CommonTypes/MediaTypeFromSCSI.cs index 5687a49a8..9004b3292 100644 --- a/DiscImageChef.CommonTypes/MediaTypeFromSCSI.cs +++ b/DiscImageChef.CommonTypes/MediaTypeFromSCSI.cs @@ -42,28 +42,28 @@ namespace DiscImageChef.CommonTypes { public static MediaType Get(byte scsiPeripheralType, string vendor, string model, byte mediumType, byte densityCode, ulong blocks, uint blockSize) { - switch (scsiPeripheralType) + switch(scsiPeripheralType) { // Direct access device case 0x00: // Simpilified access device case 0x0E: { - if (mediumType == 0x03 || mediumType == 0x05 || mediumType == 0x07) + if(mediumType == 0x03 || mediumType == 0x05 || mediumType == 0x07) { goto case 0x07; } - if (vendor.ToLowerInvariant() == "syquest") + if(vendor.ToLowerInvariant() == "syquest") { - if (blocks == 173400 && blockSize == 256) + if(blocks == 173400 && blockSize == 256) return MediaType.SQ400; - if (blockSize == 512) + if(blockSize == 512) { - if (model.ToLowerInvariant().StartsWith("syjet")) + if(model.ToLowerInvariant().StartsWith("syjet")) return MediaType.SyJet; - - switch (blocks) + + switch(blocks) { case 262144: return MediaType.EZ135; @@ -75,13 +75,13 @@ namespace DiscImageChef.CommonTypes return MediaType.Unknown; } - if (model.ToLowerInvariant().StartsWith("zip")) + if(model.ToLowerInvariant().StartsWith("zip")) { - if (blockSize == 512) + if(blockSize == 512) { - if (blocks == 196608) + if(blocks == 196608) return MediaType.ZIP100; - if (blocks == 489532) + if(blocks == 489532) return MediaType.ZIP250; return MediaType.ZIP750; } @@ -89,39 +89,39 @@ namespace DiscImageChef.CommonTypes return MediaType.Unknown; } - if (model.ToLowerInvariant().StartsWith("jaz")) + if(model.ToLowerInvariant().StartsWith("jaz")) { - if (blockSize == 512) + if(blockSize == 512) { - if (blocks == 2091050) + if(blocks == 2091050) return MediaType.Jaz; - if (blocks == 3915600) + if(blocks == 3915600) return MediaType.Jaz2; } return MediaType.Unknown; } - if (model.ToLowerInvariant().StartsWith("ls-")) + if(model.ToLowerInvariant().StartsWith("ls-")) { - if (blockSize == 512) + if(blockSize == 512) { - if (blocks == 246528) + if(blocks == 246528) return MediaType.LS120; - if (blocks == 2880) + if(blocks == 2880) return MediaType.DOS_35_HD; - if (blocks == 1440) + if(blocks == 1440) return MediaType.DOS_35_DS_DD_9; } return MediaType.Unknown; } - if (model.ToLowerInvariant().StartsWith("rdx")) + if(model.ToLowerInvariant().StartsWith("rdx")) { - if (blockSize == 512) + if(blockSize == 512) { - if (blocks == 625134256) + if(blocks == 625134256) return MediaType.RDX320; return MediaType.RDX; } @@ -129,13 +129,13 @@ namespace DiscImageChef.CommonTypes return MediaType.Unknown; } - switch (mediumType) + switch(mediumType) { case 0x01: - switch (blockSize) + switch(blockSize) { case 128: - switch (blocks) + switch(blocks) { case 720: return MediaType.ATARI_525_SD; @@ -148,7 +148,7 @@ namespace DiscImageChef.CommonTypes } break; case 256: - switch (blocks) + switch(blocks) { case 322: return MediaType.ECMA_66; @@ -173,14 +173,14 @@ namespace DiscImageChef.CommonTypes } break; case 319: - switch (blocks) + switch(blocks) { case 256: return MediaType.IBM23FD; } break; case 512: - switch (blocks) + switch(blocks) { case 320: return MediaType.DOS_525_DS_DD_8; @@ -218,7 +218,7 @@ namespace DiscImageChef.CommonTypes break; case 1024: { - switch (blocks) + switch(blocks) { case 371371: return MediaType.ECMA_223; @@ -241,7 +241,7 @@ namespace DiscImageChef.CommonTypes break; case 2048: { - switch (blocks) + switch(blocks) { case 318988: case 320332: @@ -262,7 +262,7 @@ namespace DiscImageChef.CommonTypes break; case 4096: { - switch (blocks) + switch(blocks) { case 1095840: return MediaType.ECMA_322; @@ -271,7 +271,7 @@ namespace DiscImageChef.CommonTypes break; case 8192: { - switch (blocks) + switch(blocks) { case 1834348: return MediaType.UDO; @@ -285,10 +285,10 @@ namespace DiscImageChef.CommonTypes } return MediaType.Unknown; case 0x02: - switch (blockSize) + switch(blockSize) { case 128: - switch (blocks) + switch(blocks) { case 3848: return MediaType.IBM43FD_128; @@ -297,7 +297,7 @@ namespace DiscImageChef.CommonTypes } break; case 256: - switch (blocks) + switch(blocks) { case 910: return MediaType.Apple32DS; @@ -314,7 +314,7 @@ namespace DiscImageChef.CommonTypes } break; case 512: - switch (blocks) + switch(blocks) { case 640: return MediaType.DOS_525_DS_DD_8; @@ -371,7 +371,7 @@ namespace DiscImageChef.CommonTypes } break; case 1024: - switch (blocks) + switch(blocks) { case 1220: return MediaType.IBM53FD_1024; @@ -403,7 +403,7 @@ namespace DiscImageChef.CommonTypes break; case 2048: { - switch (blocks) + switch(blocks) { case 318988: case 320332: @@ -424,7 +424,7 @@ namespace DiscImageChef.CommonTypes break; case 4096: { - switch (blocks) + switch(blocks) { case 1095840: return MediaType.ECMA_322; @@ -433,7 +433,7 @@ namespace DiscImageChef.CommonTypes break; case 8192: { - switch (blocks) + switch(blocks) { case 1834348: return MediaType.UDO; @@ -451,7 +451,7 @@ namespace DiscImageChef.CommonTypes case 0x0A: return MediaType.ECMA_59; case 0x0B: - switch (blockSize) + switch(blockSize) { case 256: return MediaType.ECMA_69_26; @@ -466,7 +466,7 @@ namespace DiscImageChef.CommonTypes case 0x12: return MediaType.ECMA_70; case 0x16: - switch (blockSize) + switch(blockSize) { case 256: return MediaType.ECMA_78; @@ -475,7 +475,7 @@ namespace DiscImageChef.CommonTypes } return MediaType.Unknown; case 0x1A: - switch (blockSize) + switch(blockSize) { case 256: return MediaType.ECMA_99_26; @@ -493,11 +493,11 @@ namespace DiscImageChef.CommonTypes return MediaType.ECMA_125; } - switch (blockSize) + switch(blockSize) { case 128: { - switch (blocks) + switch(blocks) { case 720: return MediaType.ATARI_525_SD; @@ -516,7 +516,7 @@ namespace DiscImageChef.CommonTypes break; case 256: { - switch (blocks) + switch(blocks) { case 322: return MediaType.ECMA_66; @@ -552,7 +552,7 @@ namespace DiscImageChef.CommonTypes } break; case 319: - switch (blocks) + switch(blocks) { case 256: return MediaType.IBM23FD; @@ -560,7 +560,7 @@ namespace DiscImageChef.CommonTypes break; case 512: { - switch (blocks) + switch(blocks) { case 320: return MediaType.DOS_525_SS_DD_8; @@ -607,7 +607,7 @@ namespace DiscImageChef.CommonTypes break; case 1024: { - switch (blocks) + switch(blocks) { case 1220: return MediaType.IBM53FD_1024; @@ -626,13 +626,13 @@ namespace DiscImageChef.CommonTypes return MediaType.Unknown; } - // Sequential access device + // Sequential access device case 0x01: { - switch (mediumType) + switch(mediumType) { case 0x00: - switch (densityCode) + switch(densityCode) { case 0x04: return MediaType.QIC11; @@ -648,81 +648,81 @@ namespace DiscImageChef.CommonTypes return MediaType.IBM3490E; case 0x40: { - if (model.ToLowerInvariant().StartsWith("ult")) + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO; - if (model.ToLowerInvariant().StartsWith("sdz")) + if(model.ToLowerInvariant().StartsWith("sdz")) return MediaType.SAIT1; break; } case 0x41: { - if (model.ToLowerInvariant().StartsWith("ult")) + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO2; break; } case 0x42: { - if (model.ToLowerInvariant().StartsWith("ult")) + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO2; - if (vendor.ToLowerInvariant() == "stk") + if(vendor.ToLowerInvariant() == "stk") return MediaType.T9840A; break; } case 0x43: { - if (vendor.ToLowerInvariant() == "stk") + if(vendor.ToLowerInvariant() == "stk") return MediaType.T9940A; break; } case 0x44: { - if (model.ToLowerInvariant().StartsWith("ult")) + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO3; - if (vendor.ToLowerInvariant() == "stk") + if(vendor.ToLowerInvariant() == "stk") return MediaType.T9940B; break; } case 0x45: { - if (vendor.ToLowerInvariant() == "stk") + if(vendor.ToLowerInvariant() == "stk") return MediaType.T9840C; break; } case 0x46: { - if (model.ToLowerInvariant().StartsWith("ult")) + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO4; - if (vendor.ToLowerInvariant() == "stk") + if(vendor.ToLowerInvariant() == "stk") return MediaType.T9840D; break; } case 0x4A: { - if (vendor.ToLowerInvariant() == "stk") + if(vendor.ToLowerInvariant() == "stk") return MediaType.T10000A; break; } case 0x4B: { - if (vendor.ToLowerInvariant() == "stk") + if(vendor.ToLowerInvariant() == "stk") return MediaType.T10000B; break; } case 0x4C: { - if (vendor.ToLowerInvariant() == "stk") + if(vendor.ToLowerInvariant() == "stk") return MediaType.T10000C; break; } case 0x4D: { - if (vendor.ToLowerInvariant() == "stk") + if(vendor.ToLowerInvariant() == "stk") return MediaType.T10000D; break; } case 0x58: { - if (model.ToLowerInvariant().StartsWith("ult")) + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO5; break; } @@ -730,23 +730,23 @@ namespace DiscImageChef.CommonTypes break; case 0x01: { - switch (densityCode) + switch(densityCode) { case 0x44: { - if (model.ToLowerInvariant().StartsWith("ult")) + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO3WORM; break; } case 0x46: { - if (model.ToLowerInvariant().StartsWith("ult")) + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO4WORM; break; } case 0x58: { - if (model.ToLowerInvariant().StartsWith("ult")) + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO5WORM; break; } @@ -755,13 +755,13 @@ namespace DiscImageChef.CommonTypes break; case 0x18: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x40: { { - if (model.ToLowerInvariant().StartsWith("ult")) + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO; break; } @@ -771,12 +771,12 @@ namespace DiscImageChef.CommonTypes break; case 0x28: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x42: { - if (model.ToLowerInvariant().StartsWith("ult")) + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO2; break; } @@ -785,12 +785,12 @@ namespace DiscImageChef.CommonTypes break; case 0x33: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x25: { - if (model.ToLowerInvariant().StartsWith("dat")) + if(model.ToLowerInvariant().StartsWith("dat")) return MediaType.DDS3; break; } @@ -799,12 +799,12 @@ namespace DiscImageChef.CommonTypes break; case 0x34: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x26: { - if (model.ToLowerInvariant().StartsWith("dat")) + if(model.ToLowerInvariant().StartsWith("dat")) return MediaType.DDS4; break; } @@ -813,12 +813,12 @@ namespace DiscImageChef.CommonTypes break; case 0x35: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x47: { - if (model.ToLowerInvariant().StartsWith("dat")) + if(model.ToLowerInvariant().StartsWith("dat")) return MediaType.DAT72; break; } @@ -827,12 +827,12 @@ namespace DiscImageChef.CommonTypes break; case 0x38: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x44: { - if (model.ToLowerInvariant().StartsWith("ult")) + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO3; break; } @@ -841,12 +841,12 @@ namespace DiscImageChef.CommonTypes break; case 0x3C: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x44: { - if (model.ToLowerInvariant().StartsWith("ult")) + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO3WORM; break; } @@ -855,12 +855,12 @@ namespace DiscImageChef.CommonTypes break; case 0x48: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x46: { - if (model.ToLowerInvariant().StartsWith("ult")) + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO4; break; } @@ -869,12 +869,12 @@ namespace DiscImageChef.CommonTypes break; case 0x4C: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x46: { - if (model.ToLowerInvariant().StartsWith("ult")) + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO4WORM; break; } @@ -883,12 +883,12 @@ namespace DiscImageChef.CommonTypes break; case 0x58: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x58: { - if (model.ToLowerInvariant().StartsWith("ult")) + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO5; break; } @@ -897,12 +897,12 @@ namespace DiscImageChef.CommonTypes break; case 0x5C: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x58: { - if (model.ToLowerInvariant().StartsWith("ult")) + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO5WORM; break; } @@ -911,12 +911,12 @@ namespace DiscImageChef.CommonTypes break; case 0x68: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x5A: { - if (model.ToLowerInvariant().StartsWith("ult")) + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO6; break; } @@ -925,12 +925,12 @@ namespace DiscImageChef.CommonTypes break; case 0x6C: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x5A: { - if (model.ToLowerInvariant().StartsWith("ult")) + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO6WORM; break; } @@ -939,12 +939,12 @@ namespace DiscImageChef.CommonTypes break; case 0x78: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x5C: { - if (model.ToLowerInvariant().StartsWith("ult")) + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO7; break; } @@ -953,12 +953,12 @@ namespace DiscImageChef.CommonTypes break; case 0x7C: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x5C: { - if (model.ToLowerInvariant().StartsWith("ult")) + if(model.ToLowerInvariant().StartsWith("ult")) return MediaType.LTO7WORM; break; } @@ -967,15 +967,15 @@ namespace DiscImageChef.CommonTypes break; case 0x81: { - switch (densityCode) + switch(densityCode) { case 0x00: { - if (model.ToLowerInvariant().StartsWith("exb")) + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape15m; - if (vendor.ToLowerInvariant() == "ibm") + if(vendor.ToLowerInvariant() == "ibm") return MediaType.IBM3592; - if (model.ToLowerInvariant().StartsWith("vxa")) + if(model.ToLowerInvariant().StartsWith("vxa")) return MediaType.VXA1; break; } @@ -985,20 +985,20 @@ namespace DiscImageChef.CommonTypes case 0x8C: case 0x90: { - if (model.ToLowerInvariant().StartsWith("exb")) + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape15m; break; } case 0x29: case 0x2A: { - if (vendor.ToLowerInvariant() == "ibm") + if(vendor.ToLowerInvariant() == "ibm") return MediaType.IBM3592; break; } case 0x80: { - if (model.ToLowerInvariant().StartsWith("vxa")) + if(model.ToLowerInvariant().StartsWith("vxa")) return MediaType.VXA1; break; } @@ -1007,19 +1007,19 @@ namespace DiscImageChef.CommonTypes break; case 0x82: { - switch (densityCode) + switch(densityCode) { case 0x00: { - if (model.ToLowerInvariant().StartsWith("exb")) + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape28m; - if (vendor.ToLowerInvariant() == "ibm") + if(vendor.ToLowerInvariant() == "ibm") return MediaType.IBM3592; break; } case 0x0A: { - if (model.ToLowerInvariant().StartsWith("dlt")) + if(model.ToLowerInvariant().StartsWith("dlt")) return MediaType.CompactTapeI; break; } @@ -1029,32 +1029,32 @@ namespace DiscImageChef.CommonTypes case 0x8C: case 0x90: { - if (model.ToLowerInvariant().StartsWith("exb")) + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape28m; break; } case 0x16: { - if (model.ToLowerInvariant().StartsWith("dlt")) + if(model.ToLowerInvariant().StartsWith("dlt")) return MediaType.CompactTapeII; break; } case 0x29: case 0x2A: { - if (vendor.ToLowerInvariant() == "ibm") + if(vendor.ToLowerInvariant() == "ibm") return MediaType.IBM3592; break; } case 0x81: { - if (model.ToLowerInvariant().StartsWith("vxa")) + if(model.ToLowerInvariant().StartsWith("vxa")) return MediaType.VXA2; break; } case 0x82: { - if (model.ToLowerInvariant().StartsWith("vxa")) + if(model.ToLowerInvariant().StartsWith("vxa")) return MediaType.VXA3; break; } @@ -1063,13 +1063,13 @@ namespace DiscImageChef.CommonTypes break; case 0x83: { - switch (densityCode) + switch(densityCode) { case 0x00: { - if (model.ToLowerInvariant().StartsWith("exb")) + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape54m; - if (model.ToLowerInvariant().StartsWith("dlt")) + if(model.ToLowerInvariant().StartsWith("dlt")) return MediaType.DLTtapeIII; break; } @@ -1079,7 +1079,7 @@ namespace DiscImageChef.CommonTypes case 0x8C: case 0x90: { - if (model.ToLowerInvariant().StartsWith("exb")) + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape54m; break; } @@ -1089,7 +1089,7 @@ namespace DiscImageChef.CommonTypes case 0x80: case 0x81: { - if (model.ToLowerInvariant().StartsWith("dlt")) + if(model.ToLowerInvariant().StartsWith("dlt")) return MediaType.DLTtapeIII; break; } @@ -1098,13 +1098,13 @@ namespace DiscImageChef.CommonTypes break; case 0x84: { - switch (densityCode) + switch(densityCode) { case 0x00: { - if (model.ToLowerInvariant().StartsWith("exb")) + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape80m; - if (model.ToLowerInvariant().StartsWith("dlt")) + if(model.ToLowerInvariant().StartsWith("dlt")) return MediaType.DLTtapeIIIxt; break; } @@ -1114,7 +1114,7 @@ namespace DiscImageChef.CommonTypes case 0x8C: case 0x90: { - if (model.ToLowerInvariant().StartsWith("exb")) + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape80m; break; } @@ -1122,7 +1122,7 @@ namespace DiscImageChef.CommonTypes case 0x80: case 0x81: { - if (model.ToLowerInvariant().StartsWith("dlt")) + if(model.ToLowerInvariant().StartsWith("dlt")) return MediaType.DLTtapeIIIxt; break; } @@ -1131,17 +1131,17 @@ namespace DiscImageChef.CommonTypes break; case 0x85: { - switch (densityCode) + switch(densityCode) { case 0x00: { - if (model.ToLowerInvariant().StartsWith("exb")) + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape106m; - if (model.ToLowerInvariant().StartsWith("dlt") || + if(model.ToLowerInvariant().StartsWith("dlt") || model.ToLowerInvariant().StartsWith("sdlt") || model.ToLowerInvariant().StartsWith("superdlt")) return MediaType.DLTtapeIV; - if (model.ToLowerInvariant().StartsWith("stt")) + if(model.ToLowerInvariant().StartsWith("stt")) return MediaType.Travan5; break; } @@ -1151,7 +1151,7 @@ namespace DiscImageChef.CommonTypes case 0x8C: case 0x90: { - if (model.ToLowerInvariant().StartsWith("exb")) + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape106m; break; } @@ -1168,7 +1168,7 @@ namespace DiscImageChef.CommonTypes case 0x88: case 0x89: { - if (model.ToLowerInvariant().StartsWith("dlt") || + if(model.ToLowerInvariant().StartsWith("dlt") || model.ToLowerInvariant().StartsWith("sdlt") || model.ToLowerInvariant().StartsWith("superdlt")) return MediaType.DLTtapeIV; @@ -1176,7 +1176,7 @@ namespace DiscImageChef.CommonTypes } case 0x46: { - if (model.ToLowerInvariant().StartsWith("stt")) + if(model.ToLowerInvariant().StartsWith("stt")) return MediaType.Travan5; break; } @@ -1185,14 +1185,14 @@ namespace DiscImageChef.CommonTypes break; case 0x86: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x90: { - if (model.ToLowerInvariant().StartsWith("exb")) + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape160mXL; - if (model.ToLowerInvariant().StartsWith("dlt") || + if(model.ToLowerInvariant().StartsWith("dlt") || model.ToLowerInvariant().StartsWith("sdlt") || model.ToLowerInvariant().StartsWith("superdlt")) return MediaType.SDLT1; @@ -1200,7 +1200,7 @@ namespace DiscImageChef.CommonTypes } case 0x8C: { - if (model.ToLowerInvariant().StartsWith("exb")) + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape160mXL; break; } @@ -1208,7 +1208,7 @@ namespace DiscImageChef.CommonTypes case 0x92: case 0x93: { - if (model.ToLowerInvariant().StartsWith("dlt") || + if(model.ToLowerInvariant().StartsWith("dlt") || model.ToLowerInvariant().StartsWith("sdlt") || model.ToLowerInvariant().StartsWith("superdlt")) return MediaType.SDLT1; @@ -1219,12 +1219,12 @@ namespace DiscImageChef.CommonTypes break; case 0x87: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x4A: { - if (model.ToLowerInvariant().StartsWith("dlt") || + if(model.ToLowerInvariant().StartsWith("dlt") || model.ToLowerInvariant().StartsWith("sdlt") || model.ToLowerInvariant().StartsWith("superdlt")) return MediaType.SDLT2; @@ -1235,14 +1235,14 @@ namespace DiscImageChef.CommonTypes break; case 0x90: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x50: case 0x98: case 0x99: { - if (model.ToLowerInvariant().StartsWith("dlt") || + if(model.ToLowerInvariant().StartsWith("dlt") || model.ToLowerInvariant().StartsWith("sdlt") || model.ToLowerInvariant().StartsWith("superdlt")) return MediaType.VStapeI; @@ -1253,13 +1253,13 @@ namespace DiscImageChef.CommonTypes break; case 0x95: { - if (model.ToLowerInvariant().StartsWith("stt")) + if(model.ToLowerInvariant().StartsWith("stt")) return MediaType.Travan7; } break; case 0xC1: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x14: @@ -1267,7 +1267,7 @@ namespace DiscImageChef.CommonTypes case 0x8C: case 0x90: { - if (model.ToLowerInvariant().StartsWith("exb")) + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape22m; break; } @@ -1276,7 +1276,7 @@ namespace DiscImageChef.CommonTypes break; case 0xC2: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x14: @@ -1285,7 +1285,7 @@ namespace DiscImageChef.CommonTypes case 0x8C: case 0x90: { - if (model.ToLowerInvariant().StartsWith("exb")) + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape40m; break; } @@ -1294,7 +1294,7 @@ namespace DiscImageChef.CommonTypes break; case 0xC3: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x14: @@ -1303,7 +1303,7 @@ namespace DiscImageChef.CommonTypes case 0x8C: case 0x90: { - if (model.ToLowerInvariant().StartsWith("exb")) + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape76m; break; } @@ -1312,7 +1312,7 @@ namespace DiscImageChef.CommonTypes break; case 0xC4: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x14: @@ -1321,7 +1321,7 @@ namespace DiscImageChef.CommonTypes case 0x8C: case 0x90: { - if (model.ToLowerInvariant().StartsWith("exb")) + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape112m; break; } @@ -1330,13 +1330,13 @@ namespace DiscImageChef.CommonTypes break; case 0xD1: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x27: case 0x28: { - if (model.ToLowerInvariant().StartsWith("exb")) + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape22mAME; break; } @@ -1345,13 +1345,13 @@ namespace DiscImageChef.CommonTypes break; case 0xD2: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x27: case 0x28: { - if (model.ToLowerInvariant().StartsWith("exb")) + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape170m; break; } @@ -1360,13 +1360,13 @@ namespace DiscImageChef.CommonTypes break; case 0xD3: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x27: case 0x28: { - if (model.ToLowerInvariant().StartsWith("exb")) + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape125m; break; } @@ -1375,13 +1375,13 @@ namespace DiscImageChef.CommonTypes break; case 0xD4: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x27: case 0x28: { - if (model.ToLowerInvariant().StartsWith("exb")) + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape45m; break; } @@ -1390,13 +1390,13 @@ namespace DiscImageChef.CommonTypes break; case 0xD5: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x27: case 0x28: { - if (model.ToLowerInvariant().StartsWith("exb")) + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape225m; break; } @@ -1405,13 +1405,13 @@ namespace DiscImageChef.CommonTypes break; case 0xD6: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x27: case 0x28: { - if (model.ToLowerInvariant().StartsWith("exb")) + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape150m; break; } @@ -1420,13 +1420,13 @@ namespace DiscImageChef.CommonTypes break; case 0xD7: { - switch (densityCode) + switch(densityCode) { case 0x00: case 0x27: case 0x28: { - if (model.ToLowerInvariant().StartsWith("exb")) + if(model.ToLowerInvariant().StartsWith("exb")) return MediaType.Exatape75m; break; } @@ -1437,18 +1437,18 @@ namespace DiscImageChef.CommonTypes return MediaType.Unknown; } - // Write-once device + // Write-once device case 0x04: // Optical device case 0x07: { - if (mediumType == 0x01 || mediumType == 0x02 || mediumType == 0x03 || mediumType == 0x05 || mediumType == 0x07) + if(mediumType == 0x01 || mediumType == 0x02 || mediumType == 0x03 || mediumType == 0x05 || mediumType == 0x07) { - switch (blockSize) + switch(blockSize) { case 512: { - switch (blocks) + switch(blocks) { case 249850: return MediaType.ECMA_154; @@ -1476,7 +1476,7 @@ namespace DiscImageChef.CommonTypes } case 1024: { - switch (blocks) + switch(blocks) { case 371371: return MediaType.ECMA_223; @@ -1500,7 +1500,7 @@ namespace DiscImageChef.CommonTypes } case 2048: { - switch (blocks) + switch(blocks) { case 318988: case 320332: @@ -1522,7 +1522,7 @@ namespace DiscImageChef.CommonTypes } case 4096: { - switch (blocks) + switch(blocks) { case 1095840: return MediaType.ECMA_322; @@ -1532,7 +1532,7 @@ namespace DiscImageChef.CommonTypes } case 8192: { - switch (blocks) + switch(blocks) { case 1834348: return MediaType.UDO; @@ -1551,10 +1551,10 @@ namespace DiscImageChef.CommonTypes return MediaType.UnknownMO; } - // MultiMedia Device + // MultiMedia Device case 0x05: { - switch (mediumType) + switch(mediumType) { case 0x00: return MediaType.CD; @@ -1590,9 +1590,9 @@ namespace DiscImageChef.CommonTypes case 0x28: return MediaType.CDRW; case 0x80: - if (model.ToLowerInvariant().StartsWith("ult")) + if(model.ToLowerInvariant().StartsWith("ult")) { - switch (densityCode) + switch(densityCode) { case 0x42: return MediaType.LTO2; @@ -1608,7 +1608,7 @@ namespace DiscImageChef.CommonTypes } } break; - // Host managed zoned block device + // Host managed zoned block device case 0x14: { return MediaType.Zone_HDD; diff --git a/DiscImageChef.Console/DicConsole.cs b/DiscImageChef.Console/DicConsole.cs index 68e0eff1d..343ced02a 100644 --- a/DiscImageChef.Console/DicConsole.cs +++ b/DiscImageChef.Console/DicConsole.cs @@ -63,121 +63,121 @@ namespace DiscImageChef.Console public static void WriteLine(string format, params object[] arg) { - if (WriteLineEvent != null) + if(WriteLineEvent != null) WriteLineEvent(format, arg); } public static void ErrorWriteLine(string format, params object[] arg) { - if (ErrorWriteLineEvent != null) + if(ErrorWriteLineEvent != null) ErrorWriteLineEvent(format, arg); } public static void VerboseWriteLine(string format, params object[] arg) { - if (VerboseWriteLineEvent != null) + if(VerboseWriteLineEvent != null) VerboseWriteLineEvent(format, arg); } public static void DebugWriteLine(string module, string format, params object[] arg) { - if (DebugWriteLineEvent != null) + if(DebugWriteLineEvent != null) DebugWriteLineEvent("DEBUG (" + module + "): " + format, arg); } public static void WriteLine() { - if (WriteLineEvent != null) + if(WriteLineEvent != null) WriteLineEvent("", null); } public static void ErrorWriteLine() { - if (ErrorWriteLineEvent != null) + if(ErrorWriteLineEvent != null) ErrorWriteLineEvent("", null); } public static void VerboseWriteLine() { - if (VerboseWriteLineEvent != null) + if(VerboseWriteLineEvent != null) VerboseWriteLineEvent("", null); } public static void DebugWriteLine() { - if (DebugWriteLineEvent != null) + if(DebugWriteLineEvent != null) DebugWriteLineEvent("", null); } public static void Write(string format, params object[] arg) { - if (WriteEvent != null) + if(WriteEvent != null) WriteEvent(format, arg); } public static void ErrorWrite(string format, params object[] arg) { - if (ErrorWriteEvent != null) + if(ErrorWriteEvent != null) ErrorWriteEvent(format, arg); } public static void VerboseWrite(string format, params object[] arg) { - if (VerboseWriteEvent != null) + if(VerboseWriteEvent != null) VerboseWriteEvent(format, arg); } public static void DebugWrite(string module, string format, params object[] arg) { - if (DebugWriteEvent != null) + if(DebugWriteEvent != null) DebugWriteEvent("DEBUG (" + module + "): " + format, arg); } public static void Write() { - if (WriteEvent != null) + if(WriteEvent != null) WriteEvent("", null); } public static void ErrorWrite() { - if (ErrorWriteEvent != null) + if(ErrorWriteEvent != null) ErrorWriteEvent("", null); } public static void VerboseWrite() { - if (VerboseWriteEvent != null) + if(VerboseWriteEvent != null) VerboseWriteEvent("", null); } public static void DebugWrite() { - if (DebugWriteEvent != null) + if(DebugWriteEvent != null) DebugWriteEvent("", null); } public static void WriteLine(string format) { - if (WriteLineEvent != null) + if(WriteLineEvent != null) WriteLineEvent("{0}", format); } public static void ErrorWriteLine(string format) { - if (ErrorWriteLineEvent != null) + if(ErrorWriteLineEvent != null) ErrorWriteLineEvent("{0}", format); } public static void VerboseWriteLine(string format) { - if (VerboseWriteLineEvent != null) + if(VerboseWriteLineEvent != null) VerboseWriteLineEvent("{0}", format); } public static void DebugWriteLine(string module, string format) { - if (DebugWriteLineEvent != null) + if(DebugWriteLineEvent != null) DebugWriteLineEvent("{0}", "DEBUG (" + module + "): " + format); } diff --git a/DiscImageChef.Decoders/ATA/Identify.cs b/DiscImageChef.Decoders/ATA/Identify.cs index c86f16a95..69f80394b 100644 --- a/DiscImageChef.Decoders/ATA/Identify.cs +++ b/DiscImageChef.Decoders/ATA/Identify.cs @@ -58,7 +58,7 @@ namespace DiscImageChef.Decoders.ATA /// public static class Identify { - [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi, Pack=2)] + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 2)] public struct IdentifyDevice { /// @@ -126,7 +126,7 @@ namespace DiscImageChef.Decoders.ATA /// Words 10 to 19 /// Device serial number, right justified, padded with spaces /// - [MarshalAs(UnmanagedType.ByValTStr, SizeConst=20)] + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)] public string SerialNumber; /// /// Word 20 @@ -153,13 +153,13 @@ namespace DiscImageChef.Decoders.ATA /// Words 23 to 26 /// Firmware revision, left justified, padded with spaces /// - [MarshalAs(UnmanagedType.ByValTStr, SizeConst=8)] + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)] public string FirmwareRevision; /// /// Words 27 to 46 /// Model number, left justified, padded with spaces /// - [MarshalAs(UnmanagedType.ByValTStr, SizeConst=40)] + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)] public string Model; /// /// Word 47 bits 7 to 0 @@ -567,7 +567,7 @@ namespace DiscImageChef.Decoders.ATA /// Words 121 to 125 /// Reserved /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst=5)] + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public ushort[] ReservedWords121; /// @@ -594,7 +594,7 @@ namespace DiscImageChef.Decoders.ATA /// /// Words 129 to 159 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst=31)] + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 31)] public ushort[] ReservedWords129; /// @@ -611,7 +611,7 @@ namespace DiscImageChef.Decoders.ATA /// Words 161 to 167 /// Reserved for CFA /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst=7)] + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)] public ushort[] ReservedCFA; /// @@ -629,7 +629,7 @@ namespace DiscImageChef.Decoders.ATA /// Words 170 to 173 /// Additional product identifier /// - [MarshalAs(UnmanagedType.ByValTStr, SizeConst=8)] + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)] public string AdditionalPID; /// @@ -647,13 +647,13 @@ namespace DiscImageChef.Decoders.ATA /// Words 176 to 195 /// Current media serial number /// - [MarshalAs(UnmanagedType.ByValTStr, SizeConst=40)] + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)] public string MediaSerial; /// /// Words 196 to 205 /// Current media manufacturer /// - [MarshalAs(UnmanagedType.ByValTStr, SizeConst=20)] + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)] public string MediaManufacturer; /// @@ -767,7 +767,7 @@ namespace DiscImageChef.Decoders.ATA /// Words 224 to 229 /// Reserved for CE-ATA /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst=6)] + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public ushort[] ReservedCEATA224; /// @@ -790,7 +790,7 @@ namespace DiscImageChef.Decoders.ATA /// /// Words 236 to 254 /// - [MarshalAs(UnmanagedType.ByValArray, SizeConst=19)] + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 19)] public ushort[] ReservedWords; /// @@ -1853,10 +1853,10 @@ namespace DiscImageChef.Decoders.ATA public static IdentifyDevice? Decode(byte[] IdentifyDeviceResponse) { - if (IdentifyDeviceResponse == null) + if(IdentifyDeviceResponse == null) return null; - - if (IdentifyDeviceResponse.Length != 512) + + if(IdentifyDeviceResponse.Length != 512) { DicConsole.DebugWriteLine("ATA/ATAPI IDENTIFY decoder", "IDENTIFY response is different than 512 bytes, not decoding."); return null; @@ -1870,28 +1870,28 @@ namespace DiscImageChef.Decoders.ATA ATAID.WWN = DescrambleWWN(ATAID.WWN); ATAID.WWNExtension = DescrambleWWN(ATAID.WWNExtension); - ATAID.SerialNumber = DescrambleATAString(IdentifyDeviceResponse, 10*2, 20); - ATAID.FirmwareRevision = DescrambleATAString(IdentifyDeviceResponse, 23*2, 8); - ATAID.Model = DescrambleATAString(IdentifyDeviceResponse, 27*2, 40); - ATAID.AdditionalPID = DescrambleATAString(IdentifyDeviceResponse, 170*2, 8); - ATAID.MediaSerial = DescrambleATAString(IdentifyDeviceResponse, 176*2, 40); - ATAID.MediaManufacturer = DescrambleATAString(IdentifyDeviceResponse, 196*2, 20); + ATAID.SerialNumber = DescrambleATAString(IdentifyDeviceResponse, 10 * 2, 20); + ATAID.FirmwareRevision = DescrambleATAString(IdentifyDeviceResponse, 23 * 2, 8); + ATAID.Model = DescrambleATAString(IdentifyDeviceResponse, 27 * 2, 40); + ATAID.AdditionalPID = DescrambleATAString(IdentifyDeviceResponse, 170 * 2, 8); + ATAID.MediaSerial = DescrambleATAString(IdentifyDeviceResponse, 176 * 2, 40); + ATAID.MediaManufacturer = DescrambleATAString(IdentifyDeviceResponse, 196 * 2, 20); return ATAID; } public static string Prettify(byte[] IdentifyDeviceResponse) { - if (IdentifyDeviceResponse.Length != 512) + if(IdentifyDeviceResponse.Length != 512) return null; - + IdentifyDevice? decoded = Decode(IdentifyDeviceResponse); return Prettify(decoded); } public static string Prettify(IdentifyDevice? IdentifyDeviceResponse) { - if (IdentifyDeviceResponse == null) + if(IdentifyDeviceResponse == null) return null; StringBuilder sb = new StringBuilder(); @@ -1900,14 +1900,14 @@ namespace DiscImageChef.Decoders.ATA bool cfa = false; IdentifyDevice ATAID = IdentifyDeviceResponse.Value; - if (ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.NonMagnetic)) + if(ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.NonMagnetic)) { - if ((ushort)ATAID.GeneralConfiguration != 0x848A) + if((ushort)ATAID.GeneralConfiguration != 0x848A) { //if (ATAID.CommandSet.HasFlag(CommandSetBit.Packet)) //{ - atapi = true; - cfa = false; + atapi = true; + cfa = false; //} } else @@ -1917,34 +1917,34 @@ namespace DiscImageChef.Decoders.ATA } } - if (atapi && !cfa) + if(atapi && !cfa) sb.AppendLine("ATAPI device"); - else if (!atapi && cfa) + else if(!atapi && cfa) sb.AppendLine("CompactFlash device"); else sb.AppendLine("ATA device"); - if (ATAID.Model != "") + if(ATAID.Model != "") sb.AppendFormat("Model: {0}", ATAID.Model).AppendLine(); - if (ATAID.FirmwareRevision != "") + if(ATAID.FirmwareRevision != "") sb.AppendFormat("Firmware revision: {0}", ATAID.FirmwareRevision).AppendLine(); - if (ATAID.SerialNumber != "") + if(ATAID.SerialNumber != "") sb.AppendFormat("Serial #: {0}", ATAID.SerialNumber).AppendLine(); - if (ATAID.AdditionalPID != "") + if(ATAID.AdditionalPID != "") sb.AppendFormat("Additional product ID: {0}", ATAID.AdditionalPID).AppendLine(); - if (ATAID.CommandSet3.HasFlag(CommandSetBit3.MustBeSet) && + if(ATAID.CommandSet3.HasFlag(CommandSetBit3.MustBeSet) && !ATAID.CommandSet3.HasFlag(CommandSetBit3.MustBeClear)) { - if (ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.MediaSerial)) + if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.MediaSerial)) { - if (ATAID.MediaManufacturer != "") + if(ATAID.MediaManufacturer != "") sb.AppendFormat("Media manufacturer: {0}", ATAID.MediaManufacturer).AppendLine(); - if (ATAID.MediaSerial != "") + if(ATAID.MediaSerial != "") sb.AppendFormat("Media serial #: {0}", ATAID.MediaSerial).AppendLine(); } - if (ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.WWN)) + if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.WWN)) { sb.AppendFormat("World Wide Name: {0:X16}", ATAID.WWN).AppendLine(); } @@ -1952,7 +1952,7 @@ namespace DiscImageChef.Decoders.ATA bool ata1 = false, ata2 = false, ata3 = false, ata4 = false, ata5 = false, ata6 = false, ata7 = false, acs = false, acs2 = false, acs3 = false, acs4 = false; - if ((ushort)ATAID.MajorVersion == 0x0000 || (ushort)ATAID.MajorVersion == 0xFFFF) + if((ushort)ATAID.MajorVersion == 0x0000 || (ushort)ATAID.MajorVersion == 0xFFFF) { // Obsolete in ATA-2, if present, device supports ATA-1 ata1 |= ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.FastIDE) || @@ -1961,15 +1961,15 @@ namespace DiscImageChef.Decoders.ATA ata2 |= ATAID.ExtendedIdentify.HasFlag(ExtendedIdentifyBit.Words64to70Valid); - if (!ata1 && !ata2 && !atapi && !cfa) + if(!ata1 && !ata2 && !atapi && !cfa) ata2 = true; - + ata4 |= atapi; ata3 |= cfa; - if (cfa && ata1) + if(cfa && ata1) ata1 = false; - if (cfa && ata2) + if(cfa && ata2) ata2 = false; ata5 |= ATAID.Signature == 0xA5; @@ -1992,89 +1992,89 @@ namespace DiscImageChef.Decoders.ATA int maxatalevel = 0; int minatalevel = 255; sb.Append("Supported ATA versions: "); - if (ata1) + if(ata1) { sb.Append("ATA-1 "); maxatalevel = 1; - if (minatalevel > 1) + if(minatalevel > 1) minatalevel = 1; } - if (ata2) + if(ata2) { sb.Append("ATA-2 "); maxatalevel = 2; - if (minatalevel > 2) + if(minatalevel > 2) minatalevel = 2; } - if (ata3) + if(ata3) { sb.Append("ATA-3 "); maxatalevel = 3; - if (minatalevel > 3) + if(minatalevel > 3) minatalevel = 3; } - if (ata4) + if(ata4) { sb.Append("ATA/ATAPI-4 "); maxatalevel = 4; - if (minatalevel > 4) + if(minatalevel > 4) minatalevel = 4; } - if (ata5) + if(ata5) { sb.Append("ATA/ATAPI-5 "); maxatalevel = 5; - if (minatalevel > 5) + if(minatalevel > 5) minatalevel = 5; } - if (ata6) + if(ata6) { sb.Append("ATA/ATAPI-6 "); maxatalevel = 6; - if (minatalevel > 6) + if(minatalevel > 6) minatalevel = 6; } - if (ata7) + if(ata7) { sb.Append("ATA/ATAPI-7 "); maxatalevel = 7; - if (minatalevel > 7) + if(minatalevel > 7) minatalevel = 7; } - if (acs) + if(acs) { sb.Append("ATA8-ACS "); maxatalevel = 8; - if (minatalevel > 8) + if(minatalevel > 8) minatalevel = 8; } - if (acs2) + if(acs2) { sb.Append("ATA8-ACS2 "); maxatalevel = 9; - if (minatalevel > 9) + if(minatalevel > 9) minatalevel = 9; } - if (acs3) + if(acs3) { sb.Append("ATA8-ACS3 "); maxatalevel = 10; - if (minatalevel > 10) + if(minatalevel > 10) minatalevel = 10; } - if (acs4) + if(acs4) { sb.Append("ATA8-ACS4 "); maxatalevel = 11; - if (minatalevel > 11) + if(minatalevel > 11) minatalevel = 11; } sb.AppendLine(); sb.Append("Maximum ATA revision supported: "); - if (maxatalevel >= 3) + if(maxatalevel >= 3) { - switch (ATAID.MinorVersion) + switch(ATAID.MinorVersion) { case 0x0000: case 0xFFFF: @@ -2224,31 +2224,31 @@ namespace DiscImageChef.Decoders.ATA } } - switch ((ATAID.TransportMajorVersion & 0xF000) >> 12) + switch((ATAID.TransportMajorVersion & 0xF000) >> 12) { case 0x0: sb.Append("Parallel ATA device: "); - if ((ATAID.TransportMajorVersion & 0x0002) == 0x0002) + if((ATAID.TransportMajorVersion & 0x0002) == 0x0002) sb.Append("ATA/ATAPI-7 "); - if ((ATAID.TransportMajorVersion & 0x0001) == 0x0001) + if((ATAID.TransportMajorVersion & 0x0001) == 0x0001) sb.Append("ATA8-APT "); sb.AppendLine(); break; case 0x1: sb.Append("Serial ATA device: "); - if ((ATAID.TransportMajorVersion & 0x0001) == 0x0001) + if((ATAID.TransportMajorVersion & 0x0001) == 0x0001) sb.Append("ATA8-AST "); - if ((ATAID.TransportMajorVersion & 0x0002) == 0x0002) + if((ATAID.TransportMajorVersion & 0x0002) == 0x0002) sb.Append("SATA 1.0a "); - if ((ATAID.TransportMajorVersion & 0x0004) == 0x0004) + if((ATAID.TransportMajorVersion & 0x0004) == 0x0004) sb.Append("SATA II Extensions "); - if ((ATAID.TransportMajorVersion & 0x0008) == 0x0008) + if((ATAID.TransportMajorVersion & 0x0008) == 0x0008) sb.Append("SATA 2.5 "); - if ((ATAID.TransportMajorVersion & 0x0010) == 0x0010) + if((ATAID.TransportMajorVersion & 0x0010) == 0x0010) sb.Append("SATA 2.6 "); - if ((ATAID.TransportMajorVersion & 0x0020) == 0x0020) + if((ATAID.TransportMajorVersion & 0x0020) == 0x0020) sb.Append("SATA 3.0 "); - if ((ATAID.TransportMajorVersion & 0x0040) == 0x0040) + if((ATAID.TransportMajorVersion & 0x0040) == 0x0040) sb.Append("SATA 3.1 "); sb.AppendLine(); break; @@ -2260,10 +2260,10 @@ namespace DiscImageChef.Decoders.ATA break; } - if (atapi) + if(atapi) { // Bits 12 to 8, SCSI Peripheral Device Type - switch ((SCSI.PeripheralDeviceTypes)(((ushort)ATAID.GeneralConfiguration & 0x1F00) >> 8)) + switch((SCSI.PeripheralDeviceTypes)(((ushort)ATAID.GeneralConfiguration & 0x1F00) >> 8)) { case SCSI.PeripheralDeviceTypes.DirectAccess: //0x00, sb.AppendLine("ATAPI Direct-access device"); @@ -2334,7 +2334,7 @@ namespace DiscImageChef.Decoders.ATA } // ATAPI DRQ behaviour - switch (((ushort)ATAID.GeneralConfiguration & 0x60) >> 5) + switch(((ushort)ATAID.GeneralConfiguration & 0x60) >> 5) { case 0: sb.AppendLine("Device shall set DRQ within 3 ms of receiving PACKET"); @@ -2351,7 +2351,7 @@ namespace DiscImageChef.Decoders.ATA } // ATAPI PACKET size - switch ((ushort)ATAID.GeneralConfiguration & 0x03) + switch((ushort)ATAID.GeneralConfiguration & 0x03) { case 0: sb.AppendLine("ATAPI device uses 12 byte command packet"); @@ -2364,74 +2364,74 @@ namespace DiscImageChef.Decoders.ATA break; } } - else if (!cfa) + else if(!cfa) { - if (minatalevel >= 5) + if(minatalevel >= 5) { - if (ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.IncompleteResponse)) + if(ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.IncompleteResponse)) sb.AppendLine("Incomplete identify response"); } - if (ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.NonMagnetic)) + if(ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.NonMagnetic)) sb.AppendLine("Device uses non-magnetic media"); - if (ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.Removable)) + if(ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.Removable)) sb.AppendLine("Device is removable"); - - if (minatalevel <= 5) + + if(minatalevel <= 5) { - if (ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.Fixed)) + if(ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.Fixed)) sb.AppendLine("Device is fixed"); } - if (ata1) + if(ata1) { - if (ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.SlowIDE)) + if(ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.SlowIDE)) sb.AppendLine("Device transfer rate is <= 5 Mb/s"); - if (ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.FastIDE)) + if(ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.FastIDE)) sb.AppendLine("Device transfer rate is > 5 Mb/s but <= 10 Mb/s"); - if (ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.UltraFastIDE)) + if(ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.UltraFastIDE)) sb.AppendLine("Device transfer rate is > 10 Mb/s"); - if (ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.SoftSector)) + if(ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.SoftSector)) sb.AppendLine("Device is soft sectored"); - if (ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.HardSector)) + if(ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.HardSector)) sb.AppendLine("Device is hard sectored"); - if (ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.NotMFM)) + if(ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.NotMFM)) sb.AppendLine("Device is not MFM encoded"); - if (ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.FormatGapReq)) + if(ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.FormatGapReq)) sb.AppendLine("Format speed tolerance gap is required"); - if (ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.TrackOffset)) + if(ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.TrackOffset)) sb.AppendLine("Track offset option is available"); - if (ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.DataStrobeOffset)) + if(ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.DataStrobeOffset)) sb.AppendLine("Data strobe offset option is available"); - if (ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.RotationalSpeedTolerance)) + if(ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.RotationalSpeedTolerance)) sb.AppendLine("Rotational speed tolerance is higher than 0,5%"); - if (ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.SpindleControl)) + if(ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.SpindleControl)) sb.AppendLine("Spindle motor control is implemented"); - if (ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.HighHeadSwitch)) + if(ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.HighHeadSwitch)) sb.AppendLine("Head switch time is bigger than 15 µs."); } } - if (ATAID.NominalRotationRate != 0x0000 && + if(ATAID.NominalRotationRate != 0x0000 && ATAID.NominalRotationRate != 0xFFFF) { - if (ATAID.NominalRotationRate == 0x0001) + if(ATAID.NominalRotationRate == 0x0001) sb.AppendLine("Device does not rotate."); else sb.AppendFormat("Device rotate at {0} rpm", ATAID.NominalRotationRate).AppendLine(); } uint logicalsectorsize = 0; - if (!atapi) + if(!atapi) { uint physicalsectorsize; - if ((ATAID.PhysLogSectorSize & 0x8000) == 0x0000 && + if((ATAID.PhysLogSectorSize & 0x8000) == 0x0000 && (ATAID.PhysLogSectorSize & 0x4000) == 0x4000) { - if ((ATAID.PhysLogSectorSize & 0x1000) == 0x1000) + if((ATAID.PhysLogSectorSize & 0x1000) == 0x1000) { - if (ATAID.LogicalSectorWords <= 255 || ATAID.LogicalAlignment == 0xFFFF) + if(ATAID.LogicalSectorWords <= 255 || ATAID.LogicalAlignment == 0xFFFF) logicalsectorsize = 512; else logicalsectorsize = ATAID.LogicalSectorWords * 2; @@ -2439,7 +2439,7 @@ namespace DiscImageChef.Decoders.ATA else logicalsectorsize = 512; - if ((ATAID.PhysLogSectorSize & 0x2000) == 0x2000) + if((ATAID.PhysLogSectorSize & 0x2000) == 0x2000) { physicalsectorsize = logicalsectorsize * (uint)Math.Pow(2, (double)(ATAID.PhysLogSectorSize & 0xF)); } @@ -2455,14 +2455,14 @@ namespace DiscImageChef.Decoders.ATA sb.AppendFormat("Physical sector size: {0} bytes", physicalsectorsize).AppendLine(); sb.AppendFormat("Logical sector size: {0} bytes", logicalsectorsize).AppendLine(); - if ((logicalsectorsize != physicalsectorsize) && + if((logicalsectorsize != physicalsectorsize) && (ATAID.LogicalAlignment & 0x8000) == 0x0000 && (ATAID.LogicalAlignment & 0x4000) == 0x4000) { sb.AppendFormat("Logical sector starts at offset {0} from physical sector", ATAID.LogicalAlignment & 0x3FFF).AppendLine(); } - if (minatalevel <= 5) + if(minatalevel <= 5) { sb.AppendFormat("Cylinders: {0} max., {1} current", ATAID.Cylinders, ATAID.CurrentCylinders).AppendLine(); sb.AppendFormat("Heads: {0} max., {1} current", ATAID.Heads, ATAID.CurrentHeads).AppendLine(); @@ -2471,30 +2471,30 @@ namespace DiscImageChef.Decoders.ATA ATAID.CurrentSectors).AppendLine(); } - if (ATAID.Capabilities.HasFlag(CapabilitiesBit.LBASupport)) + if(ATAID.Capabilities.HasFlag(CapabilitiesBit.LBASupport)) { sb.AppendFormat("{0} sectors in 28-bit LBA mode", ATAID.LBASectors).AppendLine(); } - if (ATAID.CommandSet2.HasFlag(CommandSetBit2.LBA48)) + if(ATAID.CommandSet2.HasFlag(CommandSetBit2.LBA48)) { sb.AppendFormat("{0} sectors in 48-bit LBA mode", ATAID.LBA48Sectors).AppendLine(); } - if (minatalevel <= 5) + if(minatalevel <= 5) { sb.AppendFormat("Device size in CHS mode: {0} bytes, {1} Mb, {2} MiB", (ulong)ATAID.CurrentSectors * logicalsectorsize, ((ulong)ATAID.CurrentSectors * logicalsectorsize) / 1000 / 1000, ((ulong)ATAID.CurrentSectors * 512) / 1024 / 1024).AppendLine(); } - if (ATAID.Capabilities.HasFlag(CapabilitiesBit.LBASupport)) + if(ATAID.Capabilities.HasFlag(CapabilitiesBit.LBASupport)) { - if ((((ulong)ATAID.LBASectors * logicalsectorsize) / 1024 / 1024) > 1000000) + if((((ulong)ATAID.LBASectors * logicalsectorsize) / 1024 / 1024) > 1000000) { sb.AppendFormat("Device size in 28-bit LBA mode: {0} bytes, {1} Tb, {2} TiB", (ulong)ATAID.LBASectors * logicalsectorsize, ((ulong)ATAID.LBASectors * logicalsectorsize) / 1000 / 1000 / 1000 / 1000, ((ulong)ATAID.LBASectors * 512) / 1024 / 1024 / 1024 / 1024).AppendLine(); } - else if ((((ulong)ATAID.LBASectors * logicalsectorsize) / 1024 / 1024) > 1000) + else if((((ulong)ATAID.LBASectors * logicalsectorsize) / 1024 / 1024) > 1000) { sb.AppendFormat("Device size in 28-bit LBA mode: {0} bytes, {1} Gb, {2} GiB", (ulong)ATAID.LBASectors * logicalsectorsize, ((ulong)ATAID.LBASectors * logicalsectorsize) / 1000 / 1000 / 1000, ((ulong)ATAID.LBASectors * 512) / 1024 / 1024 / 1024).AppendLine(); @@ -2505,17 +2505,17 @@ namespace DiscImageChef.Decoders.ATA ((ulong)ATAID.LBASectors * logicalsectorsize) / 1000 / 1000, ((ulong)ATAID.LBASectors * 512) / 1024 / 1024).AppendLine(); } } - - if (ATAID.CommandSet2.HasFlag(CommandSetBit2.LBA48)) + + if(ATAID.CommandSet2.HasFlag(CommandSetBit2.LBA48)) { - if (ATAID.CommandSet5.HasFlag(CommandSetBit5.ExtSectors)) + if(ATAID.CommandSet5.HasFlag(CommandSetBit5.ExtSectors)) { - if ((((ulong)ATAID.ExtendedUserSectors * logicalsectorsize) / 1024 / 1024) > 1000000) + if((((ulong)ATAID.ExtendedUserSectors * logicalsectorsize) / 1024 / 1024) > 1000000) { sb.AppendFormat("Device size in 48-bit LBA mode: {0} bytes, {1} Tb, {2} TiB", (ulong)ATAID.ExtendedUserSectors * logicalsectorsize, ((ulong)ATAID.ExtendedUserSectors * logicalsectorsize) / 1000 / 1000 / 1000 / 1000, ((ulong)ATAID.ExtendedUserSectors * logicalsectorsize) / 1024 / 1024 / 1024 / 1024).AppendLine(); } - else if ((((ulong)ATAID.ExtendedUserSectors * logicalsectorsize) / 1024 / 1024) > 1000) + else if((((ulong)ATAID.ExtendedUserSectors * logicalsectorsize) / 1024 / 1024) > 1000) { sb.AppendFormat("Device size in 48-bit LBA mode: {0} bytes, {1} Gb, {2} GiB", (ulong)ATAID.ExtendedUserSectors * logicalsectorsize, ((ulong)ATAID.ExtendedUserSectors * logicalsectorsize) / 1000 / 1000 / 1000, ((ulong)ATAID.ExtendedUserSectors * logicalsectorsize) / 1024 / 1024 / 1024).AppendLine(); @@ -2528,12 +2528,12 @@ namespace DiscImageChef.Decoders.ATA } else { - if ((((ulong)ATAID.LBA48Sectors * logicalsectorsize) / 1024 / 1024) > 1000000) + if((((ulong)ATAID.LBA48Sectors * logicalsectorsize) / 1024 / 1024) > 1000000) { sb.AppendFormat("Device size in 48-bit LBA mode: {0} bytes, {1} Tb, {2} TiB", (ulong)ATAID.LBA48Sectors * logicalsectorsize, ((ulong)ATAID.LBA48Sectors * logicalsectorsize) / 1000 / 1000 / 1000 / 1000, ((ulong)ATAID.LBA48Sectors * logicalsectorsize) / 1024 / 1024 / 1024 / 1024).AppendLine(); } - else if ((((ulong)ATAID.LBA48Sectors * logicalsectorsize) / 1024 / 1024) > 1000) + else if((((ulong)ATAID.LBA48Sectors * logicalsectorsize) / 1024 / 1024) > 1000) { sb.AppendFormat("Device size in 48-bit LBA mode: {0} bytes, {1} Gb, {2} GiB", (ulong)ATAID.LBA48Sectors * logicalsectorsize, ((ulong)ATAID.LBA48Sectors * logicalsectorsize) / 1000 / 1000 / 1000, ((ulong)ATAID.LBA48Sectors * logicalsectorsize) / 1024 / 1024 / 1024).AppendLine(); @@ -2546,9 +2546,9 @@ namespace DiscImageChef.Decoders.ATA } } - if (ata1 || cfa) + if(ata1 || cfa) { - if (cfa) + if(cfa) { sb.AppendFormat("{0} sectors in card", ATAID.SectorsPerCard).AppendLine(); } @@ -2558,10 +2558,10 @@ namespace DiscImageChef.Decoders.ATA sb.AppendFormat("{0} bytes per unformatted sector", ATAID.UnformattedBPS).AppendLine(); } } - if ((ushort)ATAID.SpecificConfiguration != 0x0000 && + if((ushort)ATAID.SpecificConfiguration != 0x0000 && (ushort)ATAID.SpecificConfiguration != 0xFFFF) { - switch (ATAID.SpecificConfiguration) + switch(ATAID.SpecificConfiguration) { case SpecificConfigurationEnum.RequiresSetIncompleteResponse: sb.AppendLine("Device requires SET FEATURES to spin up and IDENTIFY DEVICE response is incomplete."); @@ -2585,7 +2585,7 @@ namespace DiscImageChef.Decoders.ATA if(ATAID.BufferSize != 0x0000 && ATAID.BufferSize != 0xFFFF && ATAID.BufferType != 0x0000 && ATAID.BufferType != 0xFFFF) { - switch (ATAID.BufferType) + switch(ATAID.BufferType) { case 1: sb.AppendFormat("{0} KiB of single ported single sector buffer", (ATAID.BufferSize * 512) / 1024).AppendLine(); @@ -2602,61 +2602,61 @@ namespace DiscImageChef.Decoders.ATA } } - if (ATAID.EccBytes != 0x0000 && ATAID.EccBytes != 0xFFFF) + if(ATAID.EccBytes != 0x0000 && ATAID.EccBytes != 0xFFFF) sb.AppendFormat("READ/WRITE LONG has {0} extra bytes", ATAID.EccBytes).AppendLine(); sb.AppendLine(); sb.Append("Device capabilities:"); - if (ATAID.Capabilities.HasFlag(CapabilitiesBit.StandardStanbyTimer)) + if(ATAID.Capabilities.HasFlag(CapabilitiesBit.StandardStanbyTimer)) sb.AppendLine().Append("Standby time values are standard"); - if (ATAID.Capabilities.HasFlag(CapabilitiesBit.IORDY)) + if(ATAID.Capabilities.HasFlag(CapabilitiesBit.IORDY)) { sb.AppendLine().Append("IORDY is supported"); - if (ATAID.Capabilities.HasFlag(CapabilitiesBit.CanDisableIORDY)) + if(ATAID.Capabilities.HasFlag(CapabilitiesBit.CanDisableIORDY)) sb.Append(" and can be disabled"); } - if (ATAID.Capabilities.HasFlag(CapabilitiesBit.DMASupport)) + if(ATAID.Capabilities.HasFlag(CapabilitiesBit.DMASupport)) sb.AppendLine().Append("DMA is supported"); - if (ATAID.Capabilities2.HasFlag(CapabilitiesBit2.MustBeSet) && + if(ATAID.Capabilities2.HasFlag(CapabilitiesBit2.MustBeSet) && !ATAID.Capabilities2.HasFlag(CapabilitiesBit2.MustBeClear)) { - if (ATAID.Capabilities2.HasFlag(CapabilitiesBit2.SpecificStandbyTimer)) + if(ATAID.Capabilities2.HasFlag(CapabilitiesBit2.SpecificStandbyTimer)) sb.AppendLine().Append("Device indicates a specific minimum standby timer value"); } - if (ATAID.Capabilities3.HasFlag(CapabilitiesBit3.MultipleValid)) + if(ATAID.Capabilities3.HasFlag(CapabilitiesBit3.MultipleValid)) { sb.AppendLine().AppendFormat("A maximum of {0} sectors can be transferred per interrupt on READ/WRITE MULTIPLE", ATAID.MultipleSectorNumber); sb.AppendLine().AppendFormat("Device supports setting a maximum of {0} sectors", ATAID.MultipleMaxSectors); } - if (ATAID.Capabilities.HasFlag(CapabilitiesBit.PhysicalAlignment1) || + if(ATAID.Capabilities.HasFlag(CapabilitiesBit.PhysicalAlignment1) || ATAID.Capabilities.HasFlag(CapabilitiesBit.PhysicalAlignment0)) { sb.AppendLine().AppendFormat("Long Physical Alignment setting is {0}", (ushort)ATAID.Capabilities & 0x03); } - if (ata1) + if(ata1) { - if (ATAID.TrustedComputing.HasFlag(TrustedComputingBit.TrustedComputing)) + if(ATAID.TrustedComputing.HasFlag(TrustedComputingBit.TrustedComputing)) sb.AppendLine().Append("Device supports doubleword I/O"); } if(atapi) { - if (ATAID.Capabilities.HasFlag(CapabilitiesBit.InterleavedDMA)) + if(ATAID.Capabilities.HasFlag(CapabilitiesBit.InterleavedDMA)) sb.AppendLine().Append("ATAPI device supports interleaved DMA"); - if (ATAID.Capabilities.HasFlag(CapabilitiesBit.CommandQueue)) + if(ATAID.Capabilities.HasFlag(CapabilitiesBit.CommandQueue)) sb.AppendLine().Append("ATAPI device supports command queueing"); - if (ATAID.Capabilities.HasFlag(CapabilitiesBit.OverlapOperation)) + if(ATAID.Capabilities.HasFlag(CapabilitiesBit.OverlapOperation)) sb.AppendLine().Append("ATAPI device supports overlapped operations"); - if (ATAID.Capabilities.HasFlag(CapabilitiesBit.RequiresATASoftReset)) + if(ATAID.Capabilities.HasFlag(CapabilitiesBit.RequiresATASoftReset)) sb.AppendLine().Append("ATAPI device requires ATA software reset"); } - if (minatalevel <= 3) + if(minatalevel <= 3) { sb.AppendLine().AppendFormat("PIO timing mode: {0}", ATAID.PIOTransferTimingMode); sb.AppendLine().AppendFormat("DMA timing mode: {0}", ATAID.DMATransferTimingMode); @@ -2696,7 +2696,7 @@ namespace DiscImageChef.Decoders.ATA sb.Append("PIO7 "); } - if (minatalevel <= 3 && !atapi) + if(minatalevel <= 3 && !atapi) { sb.AppendLine().Append("Single-word DMA: "); if(ATAID.DMASupported.HasFlag(TransferMode.Mode0)) @@ -2849,122 +2849,122 @@ namespace DiscImageChef.Decoders.ATA sb.Append("(active) "); } - if (ATAID.MinMDMACycleTime != 0 && ATAID.RecMDMACycleTime != 0) + if(ATAID.MinMDMACycleTime != 0 && ATAID.RecMDMACycleTime != 0) { sb.AppendLine().AppendFormat("At minimum {0} ns. transfer cycle time per word in MDMA, " + "{1} ns. recommended", ATAID.MinMDMACycleTime, ATAID.RecMDMACycleTime); } - if (ATAID.MinPIOCycleTimeNoFlow != 0) + if(ATAID.MinPIOCycleTimeNoFlow != 0) { sb.AppendLine().AppendFormat("At minimum {0} ns. transfer cycle time per word in PIO, " + "without flow control", ATAID.MinPIOCycleTimeNoFlow); } - if (ATAID.MinPIOCycleTimeFlow != 0) + if(ATAID.MinPIOCycleTimeFlow != 0) { sb.AppendLine().AppendFormat("At minimum {0} ns. transfer cycle time per word in PIO, " + "with IORDY flow control", ATAID.MinPIOCycleTimeFlow); } - if (ATAID.MaxQueueDepth != 0) + if(ATAID.MaxQueueDepth != 0) { - sb.AppendLine().AppendFormat("{0} depth of queue maximum", ATAID.MaxQueueDepth+1); + sb.AppendLine().AppendFormat("{0} depth of queue maximum", ATAID.MaxQueueDepth + 1); } - if (atapi) + if(atapi) { - if (ATAID.PacketBusRelease != 0) + if(ATAID.PacketBusRelease != 0) sb.AppendLine().AppendFormat("{0} ns. typical to release bus from receipt of PACKET", ATAID.PacketBusRelease); - if (ATAID.ServiceBusyClear != 0) + if(ATAID.ServiceBusyClear != 0) sb.AppendLine().AppendFormat("{0} ns. typical to clear BSY bit from receipt of SERVICE", ATAID.ServiceBusyClear); } - if (((ATAID.TransportMajorVersion & 0xF000) >> 12) == 0x1 || + if(((ATAID.TransportMajorVersion & 0xF000) >> 12) == 0x1 || ((ATAID.TransportMajorVersion & 0xF000) >> 12) == 0xE) { - if (!ATAID.SATACapabilities.HasFlag(SATACapabilitiesBit.Clear)) + if(!ATAID.SATACapabilities.HasFlag(SATACapabilitiesBit.Clear)) { - if (ATAID.SATACapabilities.HasFlag(SATACapabilitiesBit.Gen1Speed)) + if(ATAID.SATACapabilities.HasFlag(SATACapabilitiesBit.Gen1Speed)) { sb.AppendLine().Append("SATA 1.5Gb/s is supported"); } - if (ATAID.SATACapabilities.HasFlag(SATACapabilitiesBit.Gen2Speed)) + if(ATAID.SATACapabilities.HasFlag(SATACapabilitiesBit.Gen2Speed)) { sb.AppendLine().Append("SATA 3.0Gb/s is supported"); } - if (ATAID.SATACapabilities.HasFlag(SATACapabilitiesBit.Gen3Speed)) + if(ATAID.SATACapabilities.HasFlag(SATACapabilitiesBit.Gen3Speed)) { sb.AppendLine().Append("SATA 6.0Gb/s is supported"); } - if (ATAID.SATACapabilities.HasFlag(SATACapabilitiesBit.PowerReceipt)) + if(ATAID.SATACapabilities.HasFlag(SATACapabilitiesBit.PowerReceipt)) { sb.AppendLine().Append("Receipt of host initiated power management requests is supported"); } - if (ATAID.SATACapabilities.HasFlag(SATACapabilitiesBit.PHYEventCounter)) + if(ATAID.SATACapabilities.HasFlag(SATACapabilitiesBit.PHYEventCounter)) { sb.AppendLine().Append("PHY Event counters are supported"); } - if (ATAID.SATACapabilities.HasFlag(SATACapabilitiesBit.HostSlumbTrans)) + if(ATAID.SATACapabilities.HasFlag(SATACapabilitiesBit.HostSlumbTrans)) { sb.AppendLine().Append("Supports host automatic partial to slumber transitions is supported"); } - if (ATAID.SATACapabilities.HasFlag(SATACapabilitiesBit.DevSlumbTrans)) + if(ATAID.SATACapabilities.HasFlag(SATACapabilitiesBit.DevSlumbTrans)) { sb.AppendLine().Append("Supports device automatic partial to slumber transitions is supported"); } - if (ATAID.SATACapabilities.HasFlag(SATACapabilitiesBit.NCQ)) + if(ATAID.SATACapabilities.HasFlag(SATACapabilitiesBit.NCQ)) { sb.AppendLine().Append("NCQ is supported"); - if (ATAID.SATACapabilities.HasFlag(SATACapabilitiesBit.NCQPriority)) + if(ATAID.SATACapabilities.HasFlag(SATACapabilitiesBit.NCQPriority)) { sb.AppendLine().Append("NCQ priority is supported"); } - if (ATAID.SATACapabilities.HasFlag(SATACapabilitiesBit.UnloadNCQ)) + if(ATAID.SATACapabilities.HasFlag(SATACapabilitiesBit.UnloadNCQ)) { sb.AppendLine().Append("Unload is supported with outstanding NCQ commands"); } } } - if (!ATAID.SATACapabilities2.HasFlag(SATACapabilitiesBit2.Clear)) + if(!ATAID.SATACapabilities2.HasFlag(SATACapabilitiesBit2.Clear)) { - if (!ATAID.SATACapabilities.HasFlag(SATACapabilitiesBit.Clear) && + if(!ATAID.SATACapabilities.HasFlag(SATACapabilitiesBit.Clear) && ATAID.SATACapabilities.HasFlag(SATACapabilitiesBit.NCQ)) { - if (ATAID.SATACapabilities2.HasFlag(SATACapabilitiesBit2.NCQMgmt)) + if(ATAID.SATACapabilities2.HasFlag(SATACapabilitiesBit2.NCQMgmt)) { sb.AppendLine().Append("NCQ queue management is supported"); } - if (ATAID.SATACapabilities2.HasFlag(SATACapabilitiesBit2.NCQStream)) + if(ATAID.SATACapabilities2.HasFlag(SATACapabilitiesBit2.NCQStream)) { sb.AppendLine().Append("NCQ streaming is supported"); } } - if (atapi) + if(atapi) { - if (ATAID.SATACapabilities2.HasFlag(SATACapabilitiesBit2.HostEnvDetect)) + if(ATAID.SATACapabilities2.HasFlag(SATACapabilitiesBit2.HostEnvDetect)) { sb.AppendLine().Append("ATAPI device supports host environment detection"); } - if (ATAID.SATACapabilities2.HasFlag(SATACapabilitiesBit2.DevAttSlimline)) + if(ATAID.SATACapabilities2.HasFlag(SATACapabilitiesBit2.DevAttSlimline)) { sb.AppendLine().Append("ATAPI device supports attention on slimline connected devices"); } } //sb.AppendFormat("Negotiated speed = {0}", ((ushort)ATAID.SATACapabilities2 & 0x000E) >> 1); - } + } } - if (ATAID.InterseekDelay != 0x0000 && ATAID.InterseekDelay != 0xFFFF) + if(ATAID.InterseekDelay != 0x0000 && ATAID.InterseekDelay != 0xFFFF) { sb.AppendLine().AppendFormat("{0} microseconds of interseek delay for ISO-7779 accoustic testing", ATAID.InterseekDelay); } - if ((ushort)ATAID.DeviceFormFactor != 0x0000 && (ushort)ATAID.DeviceFormFactor != 0xFFFF) + if((ushort)ATAID.DeviceFormFactor != 0x0000 && (ushort)ATAID.DeviceFormFactor != 0xFFFF) { - switch (ATAID.DeviceFormFactor) + switch(ATAID.DeviceFormFactor) { case DeviceFormFactorEnum.FiveAndQuarter: sb.AppendLine().Append("Device nominal size is 5.25\""); @@ -2987,20 +2987,20 @@ namespace DiscImageChef.Decoders.ATA } } - if (atapi) + if(atapi) { - if (ATAID.ATAPIByteCount > 0) + if(ATAID.ATAPIByteCount > 0) sb.AppendLine().AppendFormat("{0} bytes count limit for ATAPI", ATAID.ATAPIByteCount); } - if (cfa) + if(cfa) { - if ((ATAID.CFAPowerMode & 0x8000) == 0x8000) + if((ATAID.CFAPowerMode & 0x8000) == 0x8000) { sb.AppendLine().Append("CompactFlash device supports power mode 1"); - if ((ATAID.CFAPowerMode & 0x2000) == 0x2000) + if((ATAID.CFAPowerMode & 0x2000) == 0x2000) sb.AppendLine().Append("CompactFlash power mode 1 required for one or more commands"); - if ((ATAID.CFAPowerMode & 0x1000) == 0x1000) + if((ATAID.CFAPowerMode & 0x1000) == 0x1000) sb.AppendLine().Append("CompactFlash power mode 1 is disabled"); sb.AppendLine().AppendFormat("CompactFlash device uses a maximum of {0} mA", (ATAID.CFAPowerMode & 0x0FFF)); @@ -3010,325 +3010,325 @@ namespace DiscImageChef.Decoders.ATA sb.AppendLine(); sb.AppendLine().Append("Command set and features:"); - if (ATAID.CommandSet.HasFlag(CommandSetBit.Nop)) + if(ATAID.CommandSet.HasFlag(CommandSetBit.Nop)) { sb.AppendLine().Append("NOP is supported"); - if (ATAID.EnabledCommandSet.HasFlag(CommandSetBit.Nop)) + if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.Nop)) sb.Append(" and enabled"); } - if (ATAID.CommandSet.HasFlag(CommandSetBit.ReadBuffer)) + if(ATAID.CommandSet.HasFlag(CommandSetBit.ReadBuffer)) { sb.AppendLine().Append("READ BUFFER is supported"); - if (ATAID.EnabledCommandSet.HasFlag(CommandSetBit.ReadBuffer)) + if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.ReadBuffer)) sb.Append(" and enabled"); } - if (ATAID.CommandSet.HasFlag(CommandSetBit.WriteBuffer)) + if(ATAID.CommandSet.HasFlag(CommandSetBit.WriteBuffer)) { sb.AppendLine().Append("WRITE BUFFER is supported"); - if (ATAID.EnabledCommandSet.HasFlag(CommandSetBit.WriteBuffer)) + if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.WriteBuffer)) sb.Append(" and enabled"); } - if (ATAID.CommandSet.HasFlag(CommandSetBit.HPA)) + if(ATAID.CommandSet.HasFlag(CommandSetBit.HPA)) { sb.AppendLine().Append("Host Protected Area is supported"); - if (ATAID.EnabledCommandSet.HasFlag(CommandSetBit.HPA)) + if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.HPA)) sb.Append(" and enabled"); } - if (ATAID.CommandSet.HasFlag(CommandSetBit.DeviceReset)) + if(ATAID.CommandSet.HasFlag(CommandSetBit.DeviceReset)) { sb.AppendLine().Append("DEVICE RESET is supported"); - if (ATAID.EnabledCommandSet.HasFlag(CommandSetBit.DeviceReset)) + if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.DeviceReset)) sb.Append(" and enabled"); } - if (ATAID.CommandSet.HasFlag(CommandSetBit.Service)) + if(ATAID.CommandSet.HasFlag(CommandSetBit.Service)) { sb.AppendLine().Append("SERVICE interrupt is supported"); - if (ATAID.EnabledCommandSet.HasFlag(CommandSetBit.Service)) + if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.Service)) sb.Append(" and enabled"); } - if (ATAID.CommandSet.HasFlag(CommandSetBit.Release)) + if(ATAID.CommandSet.HasFlag(CommandSetBit.Release)) { sb.AppendLine().Append("Release is supported"); - if (ATAID.EnabledCommandSet.HasFlag(CommandSetBit.Release)) + if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.Release)) sb.Append(" and enabled"); } - if (ATAID.CommandSet.HasFlag(CommandSetBit.LookAhead)) + if(ATAID.CommandSet.HasFlag(CommandSetBit.LookAhead)) { sb.AppendLine().Append("Look-ahead read is supported"); - if (ATAID.EnabledCommandSet.HasFlag(CommandSetBit.LookAhead)) + if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.LookAhead)) sb.Append(" and enabled"); } - if (ATAID.CommandSet.HasFlag(CommandSetBit.WriteCache)) + if(ATAID.CommandSet.HasFlag(CommandSetBit.WriteCache)) { sb.AppendLine().Append("Write cache is supported"); - if (ATAID.EnabledCommandSet.HasFlag(CommandSetBit.WriteCache)) + if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.WriteCache)) sb.Append(" and enabled"); } - if (ATAID.CommandSet.HasFlag(CommandSetBit.Packet)) + if(ATAID.CommandSet.HasFlag(CommandSetBit.Packet)) { sb.AppendLine().Append("PACKET is supported"); - if (ATAID.EnabledCommandSet.HasFlag(CommandSetBit.Packet)) + if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.Packet)) sb.Append(" and enabled"); } - if (ATAID.CommandSet.HasFlag(CommandSetBit.PowerManagement)) + if(ATAID.CommandSet.HasFlag(CommandSetBit.PowerManagement)) { sb.AppendLine().Append("Power management is supported"); - if (ATAID.EnabledCommandSet.HasFlag(CommandSetBit.PowerManagement)) + if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.PowerManagement)) sb.Append(" and enabled"); } - if (ATAID.CommandSet.HasFlag(CommandSetBit.RemovableMedia)) + if(ATAID.CommandSet.HasFlag(CommandSetBit.RemovableMedia)) { sb.AppendLine().Append("Removable media feature set is supported"); - if (ATAID.EnabledCommandSet.HasFlag(CommandSetBit.RemovableMedia)) + if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.RemovableMedia)) sb.Append(" and enabled"); } - if (ATAID.CommandSet.HasFlag(CommandSetBit.SecurityMode)) + if(ATAID.CommandSet.HasFlag(CommandSetBit.SecurityMode)) { sb.AppendLine().Append("Security mode is supported"); - if (ATAID.EnabledCommandSet.HasFlag(CommandSetBit.SecurityMode)) + if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.SecurityMode)) sb.Append(" and enabled"); } - if (ATAID.Capabilities.HasFlag(CapabilitiesBit.LBASupport)) + if(ATAID.Capabilities.HasFlag(CapabilitiesBit.LBASupport)) sb.AppendLine().Append("28-bit LBA is supported"); - + if(ATAID.CommandSet2.HasFlag(CommandSetBit2.MustBeSet) && !ATAID.CommandSet2.HasFlag(CommandSetBit2.MustBeClear)) { - if (ATAID.CommandSet2.HasFlag(CommandSetBit2.LBA48)) + if(ATAID.CommandSet2.HasFlag(CommandSetBit2.LBA48)) { sb.AppendLine().Append("48-bit LBA is supported"); - if (ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.LBA48)) + if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.LBA48)) sb.Append(" and enabled"); } - if (ATAID.CommandSet2.HasFlag(CommandSetBit2.FlushCache)) + if(ATAID.CommandSet2.HasFlag(CommandSetBit2.FlushCache)) { sb.AppendLine().Append("FLUSH CACHE is supported"); - if (ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.FlushCache)) + if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.FlushCache)) sb.Append(" and enabled"); } - if (ATAID.CommandSet2.HasFlag(CommandSetBit2.FlushCacheExt)) + if(ATAID.CommandSet2.HasFlag(CommandSetBit2.FlushCacheExt)) { sb.AppendLine().Append("FLUSH CACHE EXT is supported"); - if (ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.FlushCacheExt)) + if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.FlushCacheExt)) sb.Append(" and enabled"); } - if (ATAID.CommandSet2.HasFlag(CommandSetBit2.DCO)) + if(ATAID.CommandSet2.HasFlag(CommandSetBit2.DCO)) { sb.AppendLine().Append("Device Configuration Overlay feature set is supported"); - if (ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.DCO)) + if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.DCO)) sb.Append(" and enabled"); } - if (ATAID.CommandSet2.HasFlag(CommandSetBit2.AAM)) + if(ATAID.CommandSet2.HasFlag(CommandSetBit2.AAM)) { sb.AppendLine().Append("Automatic Acoustic Management is supported"); - if (ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.AAM)) + if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.AAM)) { sb.AppendFormat(" and enabled with value {0} (vendor recommends {1}", ATAID.CurrentAAM, ATAID.RecommendedAAM); } } - if (ATAID.CommandSet2.HasFlag(CommandSetBit2.SetMax)) + if(ATAID.CommandSet2.HasFlag(CommandSetBit2.SetMax)) { sb.AppendLine().Append("SET MAX security extension is supported"); - if (ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.SetMax)) + if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.SetMax)) sb.Append(" and enabled"); } - if (ATAID.CommandSet2.HasFlag(CommandSetBit2.AddressOffsetReservedAreaBoot)) + if(ATAID.CommandSet2.HasFlag(CommandSetBit2.AddressOffsetReservedAreaBoot)) { sb.AppendLine().Append("Address Offset Reserved Area Boot is supported"); - if (ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.AddressOffsetReservedAreaBoot)) + if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.AddressOffsetReservedAreaBoot)) sb.Append(" and enabled"); } - if (ATAID.CommandSet2.HasFlag(CommandSetBit2.SetFeaturesRequired)) + if(ATAID.CommandSet2.HasFlag(CommandSetBit2.SetFeaturesRequired)) { sb.AppendLine().Append("SET FEATURES is required before spin-up"); } - if (ATAID.CommandSet2.HasFlag(CommandSetBit2.PowerUpInStandby)) + if(ATAID.CommandSet2.HasFlag(CommandSetBit2.PowerUpInStandby)) { sb.AppendLine().Append("Power-up in standby is supported"); - if (ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.PowerUpInStandby)) + if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.PowerUpInStandby)) sb.Append(" and enabled"); } - if (ATAID.CommandSet2.HasFlag(CommandSetBit2.RemovableNotification)) + if(ATAID.CommandSet2.HasFlag(CommandSetBit2.RemovableNotification)) { sb.AppendLine().Append("Removable Media Status Notification is supported"); - if (ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.RemovableNotification)) + if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.RemovableNotification)) sb.Append(" and enabled"); } - if (ATAID.CommandSet2.HasFlag(CommandSetBit2.APM)) + if(ATAID.CommandSet2.HasFlag(CommandSetBit2.APM)) { sb.AppendLine().Append("Advanced Power Management is supported"); - if (ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.APM)) + if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.APM)) { sb.AppendFormat(" and enabled with value {0}", ATAID.CurrentAPM); } } - if (ATAID.CommandSet2.HasFlag(CommandSetBit2.CompactFlash)) + if(ATAID.CommandSet2.HasFlag(CommandSetBit2.CompactFlash)) { sb.AppendLine().Append("CompactFlash feature set is supported"); - if (ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.CompactFlash)) + if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.CompactFlash)) sb.Append(" and enabled"); } - if (ATAID.CommandSet2.HasFlag(CommandSetBit2.RWQueuedDMA)) + if(ATAID.CommandSet2.HasFlag(CommandSetBit2.RWQueuedDMA)) { sb.AppendLine().Append("READ DMA QUEUED and WRITE DMA QUEUED are supported"); - if (ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.RWQueuedDMA)) + if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.RWQueuedDMA)) sb.Append(" and enabled"); } - if (ATAID.CommandSet2.HasFlag(CommandSetBit2.DownloadMicrocode)) + if(ATAID.CommandSet2.HasFlag(CommandSetBit2.DownloadMicrocode)) { sb.AppendLine().Append("DOWNLOAD MICROCODE is supported"); - if (ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.DownloadMicrocode)) + if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.DownloadMicrocode)) sb.Append(" and enabled"); } } - if (ATAID.CommandSet.HasFlag(CommandSetBit.SMART)) + if(ATAID.CommandSet.HasFlag(CommandSetBit.SMART)) { sb.AppendLine().Append("S.M.A.R.T. is supported"); - if (ATAID.EnabledCommandSet.HasFlag(CommandSetBit.SMART)) + if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.SMART)) sb.Append(" and enabled"); } if(ATAID.SCTCommandTransport.HasFlag(SCTCommandTransportBit.Supported)) sb.AppendLine().Append("S.M.A.R.T. Command Transport is supported"); - if (ATAID.CommandSet3.HasFlag(CommandSetBit3.MustBeSet) && + if(ATAID.CommandSet3.HasFlag(CommandSetBit3.MustBeSet) && !ATAID.CommandSet3.HasFlag(CommandSetBit3.MustBeClear)) { - if (ATAID.CommandSet3.HasFlag(CommandSetBit3.SMARTSelfTest)) + if(ATAID.CommandSet3.HasFlag(CommandSetBit3.SMARTSelfTest)) { sb.AppendLine().Append("S.M.A.R.T. self-testing is supported"); - if (ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.SMARTSelfTest)) + if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.SMARTSelfTest)) sb.Append(" and enabled"); } - if (ATAID.CommandSet3.HasFlag(CommandSetBit3.SMARTLog)) + if(ATAID.CommandSet3.HasFlag(CommandSetBit3.SMARTLog)) { sb.AppendLine().Append("S.M.A.R.T. error logging is supported"); - if (ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.SMARTLog)) + if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.SMARTLog)) sb.Append(" and enabled"); } - if (ATAID.CommandSet3.HasFlag(CommandSetBit3.IdleImmediate)) + if(ATAID.CommandSet3.HasFlag(CommandSetBit3.IdleImmediate)) { sb.AppendLine().Append("IDLE IMMEDIATE with UNLOAD FEATURE is supported"); - if (ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.IdleImmediate)) + if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.IdleImmediate)) sb.Append(" and enabled"); } - if (ATAID.CommandSet3.HasFlag(CommandSetBit3.WriteURG)) + if(ATAID.CommandSet3.HasFlag(CommandSetBit3.WriteURG)) { sb.AppendLine().Append("URG bit is supported in WRITE STREAM DMA EXT and WRITE STREAM EXT"); } - if (ATAID.CommandSet3.HasFlag(CommandSetBit3.ReadURG)) + if(ATAID.CommandSet3.HasFlag(CommandSetBit3.ReadURG)) { sb.AppendLine().Append("URG bit is supported in READ STREAM DMA EXT and READ STREAM EXT"); } - if (ATAID.CommandSet3.HasFlag(CommandSetBit3.WWN)) + if(ATAID.CommandSet3.HasFlag(CommandSetBit3.WWN)) { sb.AppendLine().Append("Device has a World Wide Name"); } - if (ATAID.CommandSet3.HasFlag(CommandSetBit3.FUAWriteQ)) + if(ATAID.CommandSet3.HasFlag(CommandSetBit3.FUAWriteQ)) { sb.AppendLine().Append("WRITE DMA QUEUED FUA EXT is supported"); - if (ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.FUAWriteQ)) + if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.FUAWriteQ)) sb.Append(" and enabled"); } - if (ATAID.CommandSet3.HasFlag(CommandSetBit3.FUAWrite)) + if(ATAID.CommandSet3.HasFlag(CommandSetBit3.FUAWrite)) { sb.AppendLine().Append("WRITE DMA FUA EXT and WRITE MULTIPLE FUA EXT are supported"); - if (ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.FUAWrite)) + if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.FUAWrite)) sb.Append(" and enabled"); } - if (ATAID.CommandSet3.HasFlag(CommandSetBit3.GPL)) + if(ATAID.CommandSet3.HasFlag(CommandSetBit3.GPL)) { sb.AppendLine().Append("General Purpose Logging is supported"); - if (ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.GPL)) + if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.GPL)) sb.Append(" and enabled"); } - if (ATAID.CommandSet3.HasFlag(CommandSetBit3.Streaming)) + if(ATAID.CommandSet3.HasFlag(CommandSetBit3.Streaming)) { sb.AppendLine().Append("Streaming feature set is supported"); - if (ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.Streaming)) + if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.Streaming)) sb.Append(" and enabled"); } - if (ATAID.CommandSet3.HasFlag(CommandSetBit3.MCPT)) + if(ATAID.CommandSet3.HasFlag(CommandSetBit3.MCPT)) { sb.AppendLine().Append("Media Card Pass Through command set is supported"); - if (ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.MCPT)) + if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.MCPT)) sb.Append(" and enabled"); } - if (ATAID.CommandSet3.HasFlag(CommandSetBit3.MediaSerial)) + if(ATAID.CommandSet3.HasFlag(CommandSetBit3.MediaSerial)) { sb.AppendLine().Append("Media Serial is supported"); - if (ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.MediaSerial)) + if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.MediaSerial)) sb.Append(" and valid"); } } - if (ATAID.CommandSet4.HasFlag(CommandSetBit4.MustBeSet) && + if(ATAID.CommandSet4.HasFlag(CommandSetBit4.MustBeSet) && !ATAID.CommandSet4.HasFlag(CommandSetBit4.MustBeClear)) { - if (ATAID.CommandSet4.HasFlag(CommandSetBit4.DSN)) + if(ATAID.CommandSet4.HasFlag(CommandSetBit4.DSN)) { sb.AppendLine().Append("DSN feature set is supported"); - if (ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.DSN)) + if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.DSN)) sb.Append(" and enabled"); } - if (ATAID.CommandSet4.HasFlag(CommandSetBit4.AMAC)) + if(ATAID.CommandSet4.HasFlag(CommandSetBit4.AMAC)) { sb.AppendLine().Append("Accessible Max Address Configuration is supported"); - if (ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.AMAC)) + if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.AMAC)) sb.Append(" and enabled"); } - if (ATAID.CommandSet4.HasFlag(CommandSetBit4.ExtPowerCond)) + if(ATAID.CommandSet4.HasFlag(CommandSetBit4.ExtPowerCond)) { sb.AppendLine().Append("Extended Power Conditions are supported"); - if (ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.ExtPowerCond)) + if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.ExtPowerCond)) sb.Append(" and enabled"); } - if (ATAID.CommandSet4.HasFlag(CommandSetBit4.ExtStatusReport)) + if(ATAID.CommandSet4.HasFlag(CommandSetBit4.ExtStatusReport)) { sb.AppendLine().Append("Extended Status Reporting is supported"); - if (ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.ExtStatusReport)) + if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.ExtStatusReport)) sb.Append(" and enabled"); } - if (ATAID.CommandSet4.HasFlag(CommandSetBit4.FreeFallControl)) + if(ATAID.CommandSet4.HasFlag(CommandSetBit4.FreeFallControl)) { sb.AppendLine().Append("Free-fall control feature set is supported"); - if (ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.FreeFallControl)) + if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.FreeFallControl)) sb.Append(" and enabled"); } - if (ATAID.CommandSet4.HasFlag(CommandSetBit4.SegmentedDownloadMicrocode)) + if(ATAID.CommandSet4.HasFlag(CommandSetBit4.SegmentedDownloadMicrocode)) { sb.AppendLine().Append("Segmented feature in DOWNLOAD MICROCODE is supported"); - if (ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.SegmentedDownloadMicrocode)) + if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.SegmentedDownloadMicrocode)) sb.Append(" and enabled"); } - if (ATAID.CommandSet4.HasFlag(CommandSetBit4.RWDMAExtGpl)) + if(ATAID.CommandSet4.HasFlag(CommandSetBit4.RWDMAExtGpl)) { sb.AppendLine().Append("READ/WRITE DMA EXT GPL are supported"); - if (ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.RWDMAExtGpl)) + if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.RWDMAExtGpl)) sb.Append(" and enabled"); } - if (ATAID.CommandSet4.HasFlag(CommandSetBit4.WriteUnc)) + if(ATAID.CommandSet4.HasFlag(CommandSetBit4.WriteUnc)) { sb.AppendLine().Append("WRITE UNCORRECTABLE is supported"); - if (ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.WriteUnc)) + if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.WriteUnc)) sb.Append(" and enabled"); } - if (ATAID.CommandSet4.HasFlag(CommandSetBit4.WRV)) + if(ATAID.CommandSet4.HasFlag(CommandSetBit4.WRV)) { sb.AppendLine().Append("Write/Read/Verify is supported"); - if (ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.WRV)) + if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.WRV)) sb.Append(" and enabled"); sb.AppendLine().AppendFormat("{0} sectors for Write/Read/Verify mode 2", ATAID.WRVSectorCountMode2); sb.AppendLine().AppendFormat("{0} sectors for Write/Read/Verify mode 3", ATAID.WRVSectorCountMode3); - if (ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.WRV)) + if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.WRV)) sb.AppendLine().AppendFormat("Current Write/Read/Verify mode: {0}", ATAID.WRVMode); } - if (ATAID.CommandSet4.HasFlag(CommandSetBit4.DT1825)) + if(ATAID.CommandSet4.HasFlag(CommandSetBit4.DT1825)) { sb.AppendLine().Append("DT1825 is supported"); - if (ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.DT1825)) + if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.DT1825)) sb.Append(" and enabled"); } } @@ -3338,80 +3338,80 @@ namespace DiscImageChef.Decoders.ATA sb.AppendLine().Append("OVERWRITE EXT is supported"); if(ATAID.Capabilities3.HasFlag(CapabilitiesBit3.CyrptoScramble)) sb.AppendLine().Append("CRYPTO SCRAMBLE EXT is supported"); - - if (ATAID.CommandSet5.HasFlag(CommandSetBit5.DeviceConfDMA)) + + if(ATAID.CommandSet5.HasFlag(CommandSetBit5.DeviceConfDMA)) { sb.AppendLine().Append("DEVICE CONFIGURATION IDENTIFY DMA and DEVICE CONFIGURATION SET DMA are supported"); } - if (ATAID.CommandSet5.HasFlag(CommandSetBit5.ReadBufferDMA)) + if(ATAID.CommandSet5.HasFlag(CommandSetBit5.ReadBufferDMA)) { sb.AppendLine().Append("READ BUFFER DMA is supported"); } - if (ATAID.CommandSet5.HasFlag(CommandSetBit5.WriteBufferDMA)) + if(ATAID.CommandSet5.HasFlag(CommandSetBit5.WriteBufferDMA)) { sb.AppendLine().Append("WRITE BUFFER DMA is supported"); } - if (ATAID.CommandSet5.HasFlag(CommandSetBit5.DownloadMicroCodeDMA)) + if(ATAID.CommandSet5.HasFlag(CommandSetBit5.DownloadMicroCodeDMA)) { sb.AppendLine().Append("DOWNLOAD MICROCODE DMA is supported"); } - if (ATAID.CommandSet5.HasFlag(CommandSetBit5.SetMaxDMA)) + if(ATAID.CommandSet5.HasFlag(CommandSetBit5.SetMaxDMA)) { sb.AppendLine().Append("SET PASSWORD DMA and SET UNLOCK DMA are supported"); } - if (ATAID.CommandSet5.HasFlag(CommandSetBit5.Ata28)) + if(ATAID.CommandSet5.HasFlag(CommandSetBit5.Ata28)) { sb.AppendLine().Append("Not all 28-bit commands are supported"); } - if (ATAID.CommandSet5.HasFlag(CommandSetBit5.CFast)) + if(ATAID.CommandSet5.HasFlag(CommandSetBit5.CFast)) { sb.AppendLine().Append("Device follows CFast specification"); } - if (ATAID.CommandSet5.HasFlag(CommandSetBit5.IEEE1667)) + if(ATAID.CommandSet5.HasFlag(CommandSetBit5.IEEE1667)) { sb.AppendLine().Append("Device follows IEEE-1667"); } - if (ATAID.CommandSet5.HasFlag(CommandSetBit5.DeterministicTrim)) + if(ATAID.CommandSet5.HasFlag(CommandSetBit5.DeterministicTrim)) { sb.AppendLine().Append("Read after TRIM is deterministic"); - if (ATAID.CommandSet5.HasFlag(CommandSetBit5.ReadZeroTrim)) + if(ATAID.CommandSet5.HasFlag(CommandSetBit5.ReadZeroTrim)) { sb.AppendLine().Append("Read after TRIM returns empty data"); } } - if (ATAID.CommandSet5.HasFlag(CommandSetBit5.LongPhysSectorAligError)) + if(ATAID.CommandSet5.HasFlag(CommandSetBit5.LongPhysSectorAligError)) { sb.AppendLine().Append("Device supports Long Physical Sector Alignment Error Reporting Control"); } - if (ATAID.CommandSet5.HasFlag(CommandSetBit5.Encrypted)) + if(ATAID.CommandSet5.HasFlag(CommandSetBit5.Encrypted)) { sb.AppendLine().Append("Device encrypts all user data"); } - if (ATAID.CommandSet5.HasFlag(CommandSetBit5.AllCacheNV)) + if(ATAID.CommandSet5.HasFlag(CommandSetBit5.AllCacheNV)) { sb.AppendLine().Append("Device's write cache is non-volatile"); } - if (ATAID.CommandSet5.HasFlag(CommandSetBit5.ZonedBit0) || + if(ATAID.CommandSet5.HasFlag(CommandSetBit5.ZonedBit0) || ATAID.CommandSet5.HasFlag(CommandSetBit5.ZonedBit1)) { sb.AppendLine().Append("Device is zoned"); } - if (ATAID.Capabilities3.HasFlag(CapabilitiesBit3.Sanitize)) + if(ATAID.Capabilities3.HasFlag(CapabilitiesBit3.Sanitize)) { sb.AppendLine().Append("Sanitize feature set is supported"); - if (ATAID.Capabilities3.HasFlag(CapabilitiesBit3.SanitizeCommands)) + if(ATAID.Capabilities3.HasFlag(CapabilitiesBit3.SanitizeCommands)) sb.AppendLine().Append("Sanitize commands are specified by ACS-3 or higher"); else sb.AppendLine().Append("Sanitize commands are specified by ACS-2"); - if (ATAID.Capabilities3.HasFlag(CapabilitiesBit3.SanitizeAntifreeze)) + if(ATAID.Capabilities3.HasFlag(CapabilitiesBit3.SanitizeAntifreeze)) sb.AppendLine().Append("SANITIZE ANTIFREEZE LOCK EXT is supported"); } - if (!ata1 && maxatalevel >= 8) + if(!ata1 && maxatalevel >= 8) { if(ATAID.TrustedComputing.HasFlag(TrustedComputingBit.Set) && !ATAID.TrustedComputing.HasFlag(TrustedComputingBit.Clear) && @@ -3419,83 +3419,83 @@ namespace DiscImageChef.Decoders.ATA sb.AppendLine().Append("Trusted Computing feature set is supported"); } - if (((ATAID.TransportMajorVersion & 0xF000) >> 12) == 0x1 || + if(((ATAID.TransportMajorVersion & 0xF000) >> 12) == 0x1 || ((ATAID.TransportMajorVersion & 0xF000) >> 12) == 0xE) { - if (!ATAID.SATACapabilities.HasFlag(SATACapabilitiesBit.Clear)) + if(!ATAID.SATACapabilities.HasFlag(SATACapabilitiesBit.Clear)) { - if (ATAID.SATACapabilities.HasFlag(SATACapabilitiesBit.ReadLogDMAExt)) + if(ATAID.SATACapabilities.HasFlag(SATACapabilitiesBit.ReadLogDMAExt)) sb.AppendLine().Append("READ LOG DMA EXT is supported"); } - if (!ATAID.SATACapabilities2.HasFlag(SATACapabilitiesBit2.Clear)) + if(!ATAID.SATACapabilities2.HasFlag(SATACapabilitiesBit2.Clear)) { - if (ATAID.SATACapabilities2.HasFlag(SATACapabilitiesBit2.FPDMAQ)) + if(ATAID.SATACapabilities2.HasFlag(SATACapabilitiesBit2.FPDMAQ)) sb.AppendLine().Append("RECEIVE FPDMA QUEUED and SEND FPDMA QUEUED are supported"); } - if (!ATAID.SATAFeatures.HasFlag(SATAFeaturesBit.Clear)) + if(!ATAID.SATAFeatures.HasFlag(SATAFeaturesBit.Clear)) { - if (ATAID.SATAFeatures.HasFlag(SATAFeaturesBit.NonZeroBufferOffset)) + if(ATAID.SATAFeatures.HasFlag(SATAFeaturesBit.NonZeroBufferOffset)) { sb.AppendLine().Append("Non-zero buffer offsets are supported"); - if (ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.NonZeroBufferOffset)) + if(ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.NonZeroBufferOffset)) sb.Append(" and enabled"); } - if (ATAID.SATAFeatures.HasFlag(SATAFeaturesBit.DMASetup)) + if(ATAID.SATAFeatures.HasFlag(SATAFeaturesBit.DMASetup)) { sb.AppendLine().Append("DMA Setup auto-activation is supported"); - if (ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.DMASetup)) + if(ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.DMASetup)) sb.Append(" and enabled"); } - if (ATAID.SATAFeatures.HasFlag(SATAFeaturesBit.InitPowerMgmt)) + if(ATAID.SATAFeatures.HasFlag(SATAFeaturesBit.InitPowerMgmt)) { sb.AppendLine().Append("Device-initiated power management is supported"); - if (ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.InitPowerMgmt)) + if(ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.InitPowerMgmt)) sb.Append(" and enabled"); } - if (ATAID.SATAFeatures.HasFlag(SATAFeaturesBit.InOrderData)) + if(ATAID.SATAFeatures.HasFlag(SATAFeaturesBit.InOrderData)) { sb.AppendLine().Append("In-order data delivery is supported"); - if (ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.InOrderData)) + if(ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.InOrderData)) sb.Append(" and enabled"); } - if (!atapi) + if(!atapi) { - if (ATAID.SATAFeatures.HasFlag(SATAFeaturesBit.HardwareFeatureControl)) + if(ATAID.SATAFeatures.HasFlag(SATAFeaturesBit.HardwareFeatureControl)) { sb.AppendLine().Append("Hardware Feature Control is supported"); - if (ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.HardwareFeatureControl)) + if(ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.HardwareFeatureControl)) sb.Append(" and enabled"); } } - if (atapi) + if(atapi) { - if (ATAID.SATAFeatures.HasFlag(SATAFeaturesBit.AsyncNotification)) + if(ATAID.SATAFeatures.HasFlag(SATAFeaturesBit.AsyncNotification)) { sb.AppendLine().Append("Asynchronous notification is supported"); - if (ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.AsyncNotification)) + if(ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.AsyncNotification)) sb.Append(" and enabled"); } } - if (ATAID.SATAFeatures.HasFlag(SATAFeaturesBit.SettingsPreserve)) + if(ATAID.SATAFeatures.HasFlag(SATAFeaturesBit.SettingsPreserve)) { sb.AppendLine().Append("Software Settings Preservation is supported"); - if (ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.SettingsPreserve)) + if(ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.SettingsPreserve)) sb.Append(" and enabled"); } - if (ATAID.SATAFeatures.HasFlag(SATAFeaturesBit.NCQAutoSense)) + if(ATAID.SATAFeatures.HasFlag(SATAFeaturesBit.NCQAutoSense)) { sb.AppendLine().Append("NCQ Autosense is supported"); } - if (ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.EnabledSlumber)) + if(ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.EnabledSlumber)) { sb.AppendLine().Append("Automatic Partial to Slumber transitions are enabled"); } } } - if ((ATAID.RemovableStatusSet & 0x03) > 0) + if((ATAID.RemovableStatusSet & 0x03) > 0) { sb.AppendLine().Append("Removable Media Status Notification feature set is supported"); } @@ -3507,34 +3507,34 @@ namespace DiscImageChef.Decoders.ATA if(ATAID.DataSetMgmt.HasFlag(DataSetMgmtBit.Trim)) sb.AppendLine().Append("TRIM is supported"); - if (ATAID.DataSetMgmtSize > 0) + if(ATAID.DataSetMgmtSize > 0) { sb.AppendLine().AppendFormat("DATA SET MANAGEMENT can receive a maximum of {0} blocks of 512 bytes", ATAID.DataSetMgmtSize); } sb.AppendLine().AppendLine(); - if (ATAID.SecurityStatus.HasFlag(SecurityStatusBit.Supported)) + if(ATAID.SecurityStatus.HasFlag(SecurityStatusBit.Supported)) { sb.AppendLine("Security:"); - if (ATAID.SecurityStatus.HasFlag(SecurityStatusBit.Enabled)) + if(ATAID.SecurityStatus.HasFlag(SecurityStatusBit.Enabled)) { sb.AppendLine("Security is enabled"); - if (ATAID.SecurityStatus.HasFlag(SecurityStatusBit.Locked)) + if(ATAID.SecurityStatus.HasFlag(SecurityStatusBit.Locked)) sb.AppendLine("Security is locked"); else sb.AppendLine("Security is not locked"); - - if (ATAID.SecurityStatus.HasFlag(SecurityStatusBit.Frozen)) + + if(ATAID.SecurityStatus.HasFlag(SecurityStatusBit.Frozen)) sb.AppendLine("Security is frozen"); else sb.AppendLine("Security is not frozen"); - - if (ATAID.SecurityStatus.HasFlag(SecurityStatusBit.Expired)) + + if(ATAID.SecurityStatus.HasFlag(SecurityStatusBit.Expired)) sb.AppendLine("Security count has expired"); else sb.AppendLine("Security count has notexpired"); - - if (ATAID.SecurityStatus.HasFlag(SecurityStatusBit.Maximum)) + + if(ATAID.SecurityStatus.HasFlag(SecurityStatusBit.Maximum)) sb.AppendLine("Security level is maximum"); else sb.AppendLine("Security level is high"); @@ -3542,17 +3542,17 @@ namespace DiscImageChef.Decoders.ATA else sb.AppendLine("Security is not enabled"); - if (ATAID.SecurityStatus.HasFlag(SecurityStatusBit.Enhanced)) + if(ATAID.SecurityStatus.HasFlag(SecurityStatusBit.Enhanced)) sb.AppendLine("Supports enhanced security erase"); sb.AppendFormat("{0} minutes to complete secure erase", ATAID.SecurityEraseTime * 2).AppendLine(); - if (ATAID.SecurityStatus.HasFlag(SecurityStatusBit.Enhanced)) + if(ATAID.SecurityStatus.HasFlag(SecurityStatusBit.Enhanced)) sb.AppendFormat("{0} minutes to complete enhanced secure erase", ATAID.EnhancedSecurityEraseTime * 2).AppendLine(); sb.AppendFormat("Master password revision code: {0}", ATAID.MasterPasswordRevisionCode).AppendLine(); } - if (ATAID.CommandSet3.HasFlag(CommandSetBit3.MustBeSet) && + if(ATAID.CommandSet3.HasFlag(CommandSetBit3.MustBeSet) && !ATAID.CommandSet3.HasFlag(CommandSetBit3.MustBeClear) && ATAID.CommandSet3.HasFlag(CommandSetBit3.Streaming)) { @@ -3567,26 +3567,26 @@ namespace DiscImageChef.Decoders.ATA if(ATAID.SCTCommandTransport.HasFlag(SCTCommandTransportBit.Supported)) { sb.AppendLine().AppendLine("S.M.A.R.T. Command Transport (SCT):"); - if (ATAID.SCTCommandTransport.HasFlag(SCTCommandTransportBit.LongSectorAccess)) + if(ATAID.SCTCommandTransport.HasFlag(SCTCommandTransportBit.LongSectorAccess)) sb.AppendLine("SCT Long Sector Address is supported"); - if (ATAID.SCTCommandTransport.HasFlag(SCTCommandTransportBit.WriteSame)) + if(ATAID.SCTCommandTransport.HasFlag(SCTCommandTransportBit.WriteSame)) sb.AppendLine("SCT Write Same is supported"); - if (ATAID.SCTCommandTransport.HasFlag(SCTCommandTransportBit.ErrorRecoveryControl)) + if(ATAID.SCTCommandTransport.HasFlag(SCTCommandTransportBit.ErrorRecoveryControl)) sb.AppendLine("SCT Error Recovery Control is supported"); - if (ATAID.SCTCommandTransport.HasFlag(SCTCommandTransportBit.FeaturesControl)) + if(ATAID.SCTCommandTransport.HasFlag(SCTCommandTransportBit.FeaturesControl)) sb.AppendLine("SCT Features Control is supported"); - if (ATAID.SCTCommandTransport.HasFlag(SCTCommandTransportBit.DataTables)) + if(ATAID.SCTCommandTransport.HasFlag(SCTCommandTransportBit.DataTables)) sb.AppendLine("SCT Data Tables are supported"); } - if ((ATAID.NVCacheCaps & 0x0010) == 0x0010) + if((ATAID.NVCacheCaps & 0x0010) == 0x0010) { sb.AppendLine().AppendLine("Non-Volatile Cache:"); sb.AppendLine().AppendFormat("Version {0}", (ATAID.NVCacheCaps & 0xF000) >> 12).AppendLine(); - if ((ATAID.NVCacheCaps & 0x0001) == 0x0001) + if((ATAID.NVCacheCaps & 0x0001) == 0x0001) { sb.Append("Power mode feature set is supported"); - if ((ATAID.NVCacheCaps & 0x0002) == 0x0002) + if((ATAID.NVCacheCaps & 0x0002) == 0x0002) sb.Append(" and enabled"); sb.AppendLine(); @@ -3595,8 +3595,8 @@ namespace DiscImageChef.Decoders.ATA sb.AppendLine().AppendFormat("Non-Volatile Cache is {0} bytes", ATAID.NVCacheSize * logicalsectorsize).AppendLine(); } - #if DEBUG - sb.AppendLine(); +#if DEBUG + sb.AppendLine(); if(ATAID.VendorWord9 != 0x0000 && ATAID.VendorWord9 != 0xFFFF) sb.AppendFormat("Word 9: 0x{0:X4}", ATAID.VendorWord9).AppendLine(); if((ATAID.VendorWord47 & 0x7F) != 0x7F && (ATAID.VendorWord47 & 0x7F) != 0x00) @@ -3618,17 +3618,17 @@ namespace DiscImageChef.Decoders.ATA for(int i = 0; i < ATAID.ReservedWords121.Length; i++) { if(ATAID.ReservedWords121[i] != 0x0000 && ATAID.ReservedWords121[i] != 0xFFFF) - sb.AppendFormat("Word {1}: 0x{0:X4}", ATAID.ReservedWords121[i], 121+i).AppendLine(); + sb.AppendFormat("Word {1}: 0x{0:X4}", ATAID.ReservedWords121[i], 121 + i).AppendLine(); } for(int i = 0; i < ATAID.ReservedWords129.Length; i++) { if(ATAID.ReservedWords129[i] != 0x0000 && ATAID.ReservedWords129[i] != 0xFFFF) - sb.AppendFormat("Word {1}: 0x{0:X4}", ATAID.ReservedWords129[i], 129+i).AppendLine(); + sb.AppendFormat("Word {1}: 0x{0:X4}", ATAID.ReservedWords129[i], 129 + i).AppendLine(); } for(int i = 0; i < ATAID.ReservedCFA.Length; i++) { if(ATAID.ReservedCFA[i] != 0x0000 && ATAID.ReservedCFA[i] != 0xFFFF) - sb.AppendFormat("Word {1} (CFA): 0x{0:X4}", ATAID.ReservedCFA[i], 161+i).AppendLine(); + sb.AppendFormat("Word {1} (CFA): 0x{0:X4}", ATAID.ReservedCFA[i], 161 + i).AppendLine(); } if(ATAID.ReservedWord174 != 0x0000 && ATAID.ReservedWord174 != 0xFFFF) sb.AppendFormat("Word 174: 0x{0:X4}", ATAID.ReservedWord174).AppendLine(); @@ -3647,14 +3647,14 @@ namespace DiscImageChef.Decoders.ATA for(int i = 0; i < ATAID.ReservedCEATA224.Length; i++) { if(ATAID.ReservedCEATA224[i] != 0x0000 && ATAID.ReservedCEATA224[i] != 0xFFFF) - sb.AppendFormat("Word {1} (CE-ATA): 0x{0:X4}", ATAID.ReservedCEATA224[i], 224+i).AppendLine(); + sb.AppendFormat("Word {1} (CE-ATA): 0x{0:X4}", ATAID.ReservedCEATA224[i], 224 + i).AppendLine(); } for(int i = 0; i < ATAID.ReservedWords.Length; i++) { if(ATAID.ReservedWords[i] != 0x0000 && ATAID.ReservedWords[i] != 0xFFFF) - sb.AppendFormat("Word {1}: 0x{0:X4}", ATAID.ReservedWords[i], 236+i).AppendLine(); + sb.AppendFormat("Word {1}: 0x{0:X4}", ATAID.ReservedWords[i], 236 + i).AppendLine(); } - #endif +#endif return sb.ToString(); } @@ -3680,7 +3680,7 @@ namespace DiscImageChef.Decoders.ATA byte[] outbuf; outbuf = buffer[offset + length - 1] != 0x00 ? new byte[length + 1] : new byte[length]; - for(int i = 0; i < length; i+=2) + for(int i = 0; i < length; i += 2) { outbuf[i] = buffer[offset + i + 1]; outbuf[i + 1] = buffer[offset + i]; diff --git a/DiscImageChef.Decoders/Blu-ray/BCA.cs b/DiscImageChef.Decoders/Blu-ray/BCA.cs index 90a332f3f..bb7f84f06 100644 --- a/DiscImageChef.Decoders/Blu-ray/BCA.cs +++ b/DiscImageChef.Decoders/Blu-ray/BCA.cs @@ -61,10 +61,10 @@ namespace DiscImageChef.Decoders.Bluray #region Public methods public static BurstCuttingArea? Decode(byte[] BCAResponse) { - if (BCAResponse == null) + if(BCAResponse == null) return null; - if (BCAResponse.Length != 68) + if(BCAResponse.Length != 68) { DicConsole.DebugWriteLine("BD BCA decoder", "Found incorrect Blu-ray BCA size ({0} bytes)", BCAResponse.Length); return null; @@ -85,19 +85,19 @@ namespace DiscImageChef.Decoders.Bluray public static string Prettify(BurstCuttingArea? BCAResponse) { - if (BCAResponse == null) + if(BCAResponse == null) return null; BurstCuttingArea response = BCAResponse.Value; StringBuilder sb = new StringBuilder(); - #if DEBUG +#if DEBUG if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine(); if(response.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine(); - #endif +#endif sb.AppendFormat("Blu-ray Burst Cutting Area in hex follows:"); sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.BCA, 80)); diff --git a/DiscImageChef.Decoders/Blu-ray/Cartridge.cs b/DiscImageChef.Decoders/Blu-ray/Cartridge.cs index d3843e6aa..afa683838 100644 --- a/DiscImageChef.Decoders/Blu-ray/Cartridge.cs +++ b/DiscImageChef.Decoders/Blu-ray/Cartridge.cs @@ -61,10 +61,10 @@ namespace DiscImageChef.Decoders.Bluray #region Public methods public static CartridgeStatus? Decode(byte[] CSResponse) { - if (CSResponse == null) + if(CSResponse == null) return null; - if (CSResponse.Length != 8) + if(CSResponse.Length != 8) { DicConsole.DebugWriteLine("BD Cartridge Status decoder", "Found incorrect Blu-ray Cartridge Status size ({0} bytes)", CSResponse.Length); return null; @@ -78,9 +78,9 @@ namespace DiscImageChef.Decoders.Bluray decoded.Reserved1 = CSResponse[2]; decoded.Reserved2 = CSResponse[3]; decoded.Cartridge = Convert.ToBoolean(CSResponse[4] & 0x80); - decoded.OUT = Convert.ToBoolean(CSResponse[4]&0x40); + decoded.OUT = Convert.ToBoolean(CSResponse[4] & 0x40); decoded.Reserved3 = (byte)((CSResponse[4] & 0x38) >> 3); - decoded.OUT = Convert.ToBoolean(CSResponse[4]&0x04); + decoded.OUT = Convert.ToBoolean(CSResponse[4] & 0x04); decoded.Reserved4 = (byte)(CSResponse[4] & 0x03); decoded.Reserved5 = CSResponse[5]; decoded.Reserved6 = CSResponse[6]; @@ -91,14 +91,14 @@ namespace DiscImageChef.Decoders.Bluray public static string Prettify(CartridgeStatus? CSResponse) { - if (CSResponse == null) + if(CSResponse == null) return null; CartridgeStatus response = CSResponse.Value; StringBuilder sb = new StringBuilder(); - #if DEBUG +#if DEBUG if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine(); if(response.Reserved2 != 0) @@ -113,26 +113,26 @@ namespace DiscImageChef.Decoders.Bluray sb.AppendFormat("Reserved6 = 0x{0:X8}", response.Reserved6).AppendLine(); if(response.Reserved7 != 0) sb.AppendFormat("Reserved7 = 0x{0:X8}", response.Reserved7).AppendLine(); - #endif +#endif - if (response.Cartridge) + if(response.Cartridge) { sb.AppendLine("Media is inserted in a cartridge"); - if (response.OUT) + if(response.OUT) sb.AppendLine("Media has been taken out, or inserted in, the cartridge"); - if (response.CWP) + if(response.CWP) sb.AppendLine("Media is write protected"); } else { sb.AppendLine("Media is not in a cartridge"); - #if DEBUG - if (response.OUT) +#if DEBUG + if(response.OUT) sb.AppendLine("Media has out bit marked, shouldn't"); - if (response.CWP) + if(response.CWP) sb.AppendLine("Media has write protection bit marked, shouldn't"); - #endif +#endif } return sb.ToString(); } diff --git a/DiscImageChef.Decoders/Blu-ray/DDS.cs b/DiscImageChef.Decoders/Blu-ray/DDS.cs index b320b9688..91496e780 100644 --- a/DiscImageChef.Decoders/Blu-ray/DDS.cs +++ b/DiscImageChef.Decoders/Blu-ray/DDS.cs @@ -68,7 +68,7 @@ namespace DiscImageChef.Decoders.Bluray #region Public methods public static DiscDefinitionStructure? Decode(byte[] DDSResponse) { - if (DDSResponse == null) + if(DDSResponse == null) return null; DiscDefinitionStructure decoded = new DiscDefinitionStructure(); @@ -79,7 +79,7 @@ namespace DiscImageChef.Decoders.Bluray decoded.Reserved1 = DDSResponse[2]; decoded.Reserved2 = DDSResponse[3]; decoded.Signature = BigEndianBitConverter.ToUInt16(DDSResponse, 4); - if (decoded.Signature != DDSIdentifier) + if(decoded.Signature != DDSIdentifier) { DicConsole.DebugWriteLine("BD DDS decoder", "Found incorrect DDS signature (0x{0:X4})", decoded.Signature); return null; @@ -114,7 +114,7 @@ namespace DiscImageChef.Decoders.Bluray public static string Prettify(DiscDefinitionStructure? DDSResponse) { - if (DDSResponse == null) + if(DDSResponse == null) return null; DiscDefinitionStructure response = DDSResponse.Value; @@ -138,7 +138,7 @@ namespace DiscImageChef.Decoders.Bluray sb.AppendFormat("Blu-ray DDS Disc Type Specific Data in hex follows:"); sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.DiscTypeSpecificData, 80)); - #if DEBUG +#if DEBUG if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine(); if(response.Reserved2 != 0) @@ -157,7 +157,7 @@ namespace DiscImageChef.Decoders.Bluray sb.AppendFormat("Reserved8 = 0x{0:X2}", response.Reserved8).AppendLine(); if(response.Reserved9 != 0) sb.AppendFormat("Reserved9 = 0x{0:X8}", response.Reserved9).AppendLine(); - #endif +#endif return sb.ToString(); } diff --git a/DiscImageChef.Decoders/Blu-ray/DI.cs b/DiscImageChef.Decoders/Blu-ray/DI.cs index 680901fe3..571b560cc 100644 --- a/DiscImageChef.Decoders/Blu-ray/DI.cs +++ b/DiscImageChef.Decoders/Blu-ray/DI.cs @@ -73,10 +73,10 @@ namespace DiscImageChef.Decoders.Bluray #region Public methods public static DiscInformation? Decode(byte[] DIResponse) { - if (DIResponse == null) + if(DIResponse == null) return null; - if (DIResponse.Length != 4100) + if(DIResponse.Length != 4100) { DicConsole.DebugWriteLine("BD Disc Information decoder", "Found incorrect Blu-ray Disc Information size ({0} bytes)", DIResponse.Length); return null; @@ -93,15 +93,15 @@ namespace DiscImageChef.Decoders.Bluray int offset = 4; List units = new List(); - while (true) + while(true) { - if (offset >= 100) + if(offset >= 100) break; DiscInformationUnits unit = new DiscInformationUnits(); unit.Signature = BigEndianBitConverter.ToUInt16(DIResponse, 0 + offset); - if (unit.Signature != DIUIdentifier) + if(unit.Signature != DIUIdentifier) break; unit.Format = DIResponse[2 + offset]; @@ -113,7 +113,7 @@ namespace DiscImageChef.Decoders.Bluray unit.DiscTypeIdentifier = new byte[3]; Array.Copy(DIResponse, 8 + offset, unit.DiscTypeIdentifier, 0, 3); unit.DiscSizeClassVersion = DIResponse[11 + offset]; - switch (Encoding.ASCII.GetString(unit.DiscTypeIdentifier)) + switch(Encoding.ASCII.GetString(unit.DiscTypeIdentifier)) { case DiscTypeBDROM: { @@ -146,10 +146,10 @@ namespace DiscImageChef.Decoders.Bluray offset += unit.Length; } - if (units.Count > 0) + if(units.Count > 0) { decoded.Units = new DiscInformationUnits[units.Count]; - for (int i = 0; i < units.Count; i++) + for(int i = 0; i < units.Count; i++) decoded.Units[i] = units[i]; } @@ -158,24 +158,24 @@ namespace DiscImageChef.Decoders.Bluray public static string Prettify(DiscInformation? DIResponse) { - if (DIResponse == null) + if(DIResponse == null) return null; DiscInformation response = DIResponse.Value; StringBuilder sb = new StringBuilder(); - foreach (DiscInformationUnits unit in response.Units) + foreach(DiscInformationUnits unit in response.Units) { sb.AppendFormat("DI Unit Sequence: {0}", unit.Sequence).AppendLine(); sb.AppendFormat("DI Unit Format: 0x{0:X2}", unit.Format).AppendLine(); sb.AppendFormat("There are {0} per block", unit.UnitsPerBlock).AppendLine(); - if (Encoding.ASCII.GetString(unit.DiscTypeIdentifier) != DiscTypeBDROM) + if(Encoding.ASCII.GetString(unit.DiscTypeIdentifier) != DiscTypeBDROM) sb.AppendFormat("Legacy value: 0x{0:X2}", unit.Legacy).AppendLine(); sb.AppendFormat("DI Unit is {0} bytes", unit.Length).AppendLine(); sb.AppendFormat("Disc type identifier: \"{0}\"", Encoding.ASCII.GetString(unit.DiscTypeIdentifier)).AppendLine(); sb.AppendFormat("Disc size/class/version: {0}", unit.DiscSizeClassVersion).AppendLine(); - if (Encoding.ASCII.GetString(unit.DiscTypeIdentifier) == DiscTypeBDR || + if(Encoding.ASCII.GetString(unit.DiscTypeIdentifier) == DiscTypeBDR || Encoding.ASCII.GetString(unit.DiscTypeIdentifier) == DiscTypeBDRE) { sb.AppendFormat("Disc manufacturer ID: \"{0}\"", Encoding.ASCII.GetString(unit.ManufacturerID)).AppendLine(); diff --git a/DiscImageChef.Decoders/Blu-ray/Spare.cs b/DiscImageChef.Decoders/Blu-ray/Spare.cs index e1e1092f0..0984ea60f 100644 --- a/DiscImageChef.Decoders/Blu-ray/Spare.cs +++ b/DiscImageChef.Decoders/Blu-ray/Spare.cs @@ -61,10 +61,10 @@ namespace DiscImageChef.Decoders.Bluray #region Public methods public static SpareAreaInformation? Decode(byte[] SAIResponse) { - if (SAIResponse == null) + if(SAIResponse == null) return null; - if (SAIResponse.Length != 16) + if(SAIResponse.Length != 16) { DicConsole.DebugWriteLine("BD Spare Area Information decoder", "Found incorrect Blu-ray Spare Area Information size ({0} bytes)", SAIResponse.Length); return null; @@ -86,21 +86,21 @@ namespace DiscImageChef.Decoders.Bluray public static string Prettify(SpareAreaInformation? SAIResponse) { - if (SAIResponse == null) + if(SAIResponse == null) return null; SpareAreaInformation response = SAIResponse.Value; StringBuilder sb = new StringBuilder(); - #if DEBUG +#if DEBUG if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine(); if(response.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine(); if(response.Reserved3 != 0) sb.AppendFormat("Reserved3 = 0x{0:X8}", response.Reserved3).AppendLine(); - #endif +#endif sb.AppendFormat("{0} free spare blocks", response.FreeSpareBlocks).AppendLine(); sb.AppendFormat("{0} allocated spare blocks", response.AllocatedSpareBlocks).AppendLine(); diff --git a/DiscImageChef.Decoders/CD/ATIP.cs b/DiscImageChef.Decoders/CD/ATIP.cs index 9066a6cd3..8f8a36c3d 100644 --- a/DiscImageChef.Decoders/CD/ATIP.cs +++ b/DiscImageChef.Decoders/CD/ATIP.cs @@ -224,14 +224,14 @@ namespace DiscImageChef.Decoders.CD public static CDATIP? Decode(byte[] CDATIPResponse) { - if (CDATIPResponse == null) + if(CDATIPResponse == null) return null; CDATIP decoded = new CDATIP(); BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; - if (CDATIPResponse.Length != 32 && CDATIPResponse.Length != 28) + if(CDATIPResponse.Length != 32 && CDATIPResponse.Length != 28) { DicConsole.DebugWriteLine("CD ATIP decoder", "Expected CD ATIP size (32 bytes) is not received size ({0} bytes), not decoding", CDATIPResponse.Length); return null; @@ -276,7 +276,7 @@ namespace DiscImageChef.Decoders.CD decoded.Reserved8 = CDATIPResponse[23]; decoded.Reserved9 = CDATIPResponse[27]; - if (CDATIPResponse.Length >= 32) + if(CDATIPResponse.Length >= 32) { decoded.S4Values = new byte[3]; Array.Copy(CDATIPResponse, 28, decoded.S4Values, 0, 3); @@ -288,21 +288,21 @@ namespace DiscImageChef.Decoders.CD public static string Prettify(CDATIP? CDATIPResponse) { - if (CDATIPResponse == null) + if(CDATIPResponse == null) return null; CDATIP response = CDATIPResponse.Value; StringBuilder sb = new StringBuilder(); - if (response.DDCD) + if(response.DDCD) { sb.AppendFormat("Indicative Target Writing Power: 0x{0:X2}", response.ITWP).AppendLine(); - if (response.DiscType) + if(response.DiscType) sb.AppendLine("Disc is DDCD-RW"); else sb.AppendLine("Disc is DDCD-R"); - switch (response.ReferenceSpeed) + switch(response.ReferenceSpeed) { case 2: sb.AppendLine("Reference speed is 4x"); @@ -321,9 +321,9 @@ namespace DiscImageChef.Decoders.CD else { sb.AppendFormat("Indicative Target Writing Power: 0x{0:X2}", response.ITWP & 0x07).AppendLine(); - if (response.DiscType) + if(response.DiscType) { - switch (response.DiscSubType) + switch(response.DiscSubType) { case 0: sb.AppendLine("Disc is CD-RW"); @@ -353,7 +353,7 @@ namespace DiscImageChef.Decoders.CD sb.AppendFormat("Unknown CD-RW disc subtype: {0}", response.DiscSubType).AppendLine(); break; } - switch (response.ReferenceSpeed) + switch(response.ReferenceSpeed) { case 1: sb.AppendLine("Reference speed is 2x"); @@ -366,7 +366,7 @@ namespace DiscImageChef.Decoders.CD else { sb.AppendLine("Disc is CD-R"); - switch (response.DiscSubType) + switch(response.DiscSubType) { case 0: sb.AppendLine("Disc is normal speed (CLV) CD-R"); @@ -398,7 +398,7 @@ namespace DiscImageChef.Decoders.CD } } - if (response.URU) + if(response.URU) sb.AppendLine("Disc use is unrestricted"); else sb.AppendLine("Disc use is restricted"); @@ -415,13 +415,13 @@ namespace DiscImageChef.Decoders.CD sb.AppendFormat("S4 value: 0x{0:X6}", (response.S4Values[0] << 16) + (response.S4Values[1] << 8) + response.S4Values[2]).AppendLine(); } - if (response.LeadInStartMin == 97) + if(response.LeadInStartMin == 97) { int type = response.LeadInStartFrame % 10; int frm = response.LeadInStartFrame - type; string manufacturer = ""; - if (response.DiscType) + if(response.DiscType) sb.AppendLine("Disc uses phase change"); else { @@ -431,287 +431,287 @@ namespace DiscImageChef.Decoders.CD sb.AppendLine("Disc uses short strategy type dye (Phthalocyanine, etc...)"); } - switch (response.LeadInStartSec) + switch(response.LeadInStartSec) { case 15: - if (frm == 00) + if(frm == 00) manufacturer = "TDK Corporation"; - if (frm == 10) + if(frm == 10) manufacturer = "Ritek Co."; - if (frm == 20) + if(frm == 20) manufacturer = "Mitsubishi Chemical Corporation"; - if (frm == 30) + if(frm == 30) manufacturer = "NAN-YA Plastics Corporation"; break; case 16: - if (frm == 20) + if(frm == 20) manufacturer = "Shenzen SG&Gast Digital Optical Discs"; - if (frm == 30) + if(frm == 30) manufacturer = "Grand Advance Technology Ltd."; break; case 17: - if (frm == 00) + if(frm == 00) manufacturer = "Moser Baer India Limited"; break; case 18: - if (frm == 10) + if(frm == 10) manufacturer = "Wealth Fair Investment Ltd."; - if (frm == 60) + if(frm == 60) manufacturer = "Taroko International Co. Ltd."; break; case 20: - if (frm == 10) + if(frm == 10) manufacturer = "CDA Datenträger Albrechts GmbH"; break; case 21: - if (frm == 10) + if(frm == 10) manufacturer = "Grupo Condor S.L."; - if (frm == 30) + if(frm == 30) manufacturer = "Bestdisc Technology Corporation"; - if (frm == 40) + if(frm == 40) manufacturer = "Optical Disc Manufacturing Equipment"; - if (frm == 50) + if(frm == 50) manufacturer = "Sound Sound Multi-Media Development Ltd."; break; case 22: - if (frm == 00) + if(frm == 00) manufacturer = "Woongjin Media Corp."; - if (frm == 10) + if(frm == 10) manufacturer = "Seantram Technology Inc."; - if (frm == 20) + if(frm == 20) manufacturer = "Advanced Digital Media"; - if (frm == 30) + if(frm == 30) manufacturer = "EXIMPO"; - if (frm == 40) + if(frm == 40) manufacturer = "CIS Technology Inc."; - if (frm == 50) + if(frm == 50) manufacturer = "Hong Kong Digital Technology Co., Ltd."; - if (frm == 60) + if(frm == 60) manufacturer = "Acer Media Technology, Inc."; break; case 23: - if (frm == 00) + if(frm == 00) manufacturer = "Matsushita Electric Industrial Co., Ltd."; - if (frm == 10) + if(frm == 10) manufacturer = "Doremi Media Co., Ltd."; - if (frm == 20) + if(frm == 20) manufacturer = "Nacar Media s.r.l."; - if (frm == 30) + if(frm == 30) manufacturer = "Audio Distributors Co., Ltd."; - if (frm == 40) + if(frm == 40) manufacturer = "Victor Company of Japan, Ltd."; - if (frm == 50) + if(frm == 50) manufacturer = "Optrom Inc."; - if (frm == 60) + if(frm == 60) manufacturer = "Customer Pressing Oosterhout"; break; case 24: - if (frm == 00) + if(frm == 00) manufacturer = "Taiyo Yuden Company Ltd."; - if (frm == 10) + if(frm == 10) manufacturer = "SONY Corporation"; - if (frm == 20) + if(frm == 20) manufacturer = "Computer Support Italy s.r.l."; - if (frm == 30) + if(frm == 30) manufacturer = "Unitech Japan Inc."; - if (frm == 40) + if(frm == 40) manufacturer = "kdg mediatech AG"; - if (frm == 50) + if(frm == 50) manufacturer = "Guann Yinn Co., Ltd."; - if (frm == 60) + if(frm == 60) manufacturer = "Harmonic Hall Optical Disc Ltd."; break; case 25: - if (frm == 00) + if(frm == 00) manufacturer = "MPO"; - if (frm == 20) + if(frm == 20) manufacturer = "Hitachi Maxell, Ltd."; - if (frm == 30) + if(frm == 30) manufacturer = "Infodisc Technology Co. Ltd."; - if (frm == 40) + if(frm == 40) manufacturer = "Vivastar AG"; - if (frm == 50) + if(frm == 50) manufacturer = "AMS Technology Inc."; - if (frm == 60) + if(frm == 60) manufacturer = "Xcitec Inc."; break; case 26: - if (frm == 00) + if(frm == 00) manufacturer = "Fornet International Pte Ltd."; - if (frm == 10) + if(frm == 10) manufacturer = "POSTECH Corporation"; - if (frm == 20) + if(frm == 20) manufacturer = "SKC Co., Ltd."; - if (frm == 30) + if(frm == 30) manufacturer = "Optical Disc Corporation"; - if (frm == 40) + if(frm == 40) manufacturer = "FUJI Photo Film Co., Ltd."; - if (frm == 50) + if(frm == 50) manufacturer = "Lead Data Inc."; - if (frm == 60) + if(frm == 60) manufacturer = "CMC Magnetics Corporation"; break; case 27: - if (frm == 00) + if(frm == 00) manufacturer = "Digital Storage Technology Co., Ltd."; - if (frm == 10) + if(frm == 10) manufacturer = "Plasmon Data systems Ltd."; - if (frm == 20) + if(frm == 20) manufacturer = "Princo Corporation"; - if (frm == 30) + if(frm == 30) manufacturer = "Pioneer Video Corporation"; - if (frm == 40) + if(frm == 40) manufacturer = "Kodak Japan Ltd."; - if (frm == 50) + if(frm == 50) manufacturer = "Mitsui Chemicals, Inc."; - if (frm == 60) + if(frm == 60) manufacturer = "Ricoh Company Ltd."; break; case 28: - if (frm == 00) + if(frm == 00) manufacturer = "Opti.Me.S. S.p.A."; - if (frm == 10) + if(frm == 10) manufacturer = "Gigastore Corporation"; - if (frm == 20) + if(frm == 20) manufacturer = "Multi Media Masters & Machinary SA"; - if (frm == 30) + if(frm == 30) manufacturer = "Auvistar Industry Co., Ltd."; - if (frm == 40) + if(frm == 40) manufacturer = "King Pro Mediatek Inc."; - if (frm == 50) + if(frm == 50) manufacturer = "Delphi Technology Inc."; - if (frm == 60) + if(frm == 60) manufacturer = "Friendly CD-Tek Co."; break; case 29: - if (frm == 00) + if(frm == 00) manufacturer = "Taeil Media Co., Ltd."; - if (frm == 10) + if(frm == 10) manufacturer = "Vanguard Disc Inc."; - if (frm == 20) + if(frm == 20) manufacturer = "Unidisc Technology Co., Ltd."; - if (frm == 30) + if(frm == 30) manufacturer = "Hile Optical Disc Technology Corp."; - if (frm == 40) + if(frm == 40) manufacturer = "Viva Magnetics Ltd."; - if (frm == 50) + if(frm == 50) manufacturer = "General Magnetics Ltd."; break; case 30: - if (frm == 10) + if(frm == 10) manufacturer = "CDA Datenträger Albrechts GmbH"; break; case 31: - if (frm == 00) + if(frm == 00) manufacturer = "Ritek Co."; - if (frm == 30) + if(frm == 30) manufacturer = "Grand Advance Technology Ltd."; break; case 32: - if (frm == 00) + if(frm == 00) manufacturer = "TDK Corporation"; - if (frm == 10) + if(frm == 10) manufacturer = "Prodisc Technology Inc."; break; case 34: - if (frm == 20) + if(frm == 20) manufacturer = "Mitsubishi Chemical Corporation"; break; case 42: - if (frm == 20) + if(frm == 20) manufacturer = "Advanced Digital Media"; break; case 45: - if (frm == 00) + if(frm == 00) manufacturer = "Fornet International Pte Ltd."; - if (frm == 10) + if(frm == 10) manufacturer = "Unitech Japan Inc."; - if (frm == 20) + if(frm == 20) manufacturer = "Acer Media Technology, Inc."; - if (frm == 40) + if(frm == 40) manufacturer = "CIS Technology Inc."; - if (frm == 50) + if(frm == 50) manufacturer = "Guann Yinn Co., Ltd."; - if (frm == 60) + if(frm == 60) manufacturer = "Xcitec Inc."; break; case 46: - if (frm == 00) + if(frm == 00) manufacturer = "Taiyo Yuden Company Ltd."; - if (frm == 10) + if(frm == 10) manufacturer = "Hong Kong Digital Technology Co., Ltd."; - if (frm == 20) + if(frm == 20) manufacturer = "Multi Media Masters & Machinary SA"; - if (frm == 30) + if(frm == 30) manufacturer = "Computer Support Italy s.r.l."; - if (frm == 40) + if(frm == 40) manufacturer = "FUJI Photo Film Co., Ltd."; - if (frm == 50) + if(frm == 50) manufacturer = "Auvistar Industry Co., Ltd."; - if (frm == 60) + if(frm == 60) manufacturer = "CMC Magnetics Corporation"; break; case 47: - if (frm == 10) + if(frm == 10) manufacturer = "Hitachi Maxell, Ltd."; - if (frm == 20) + if(frm == 20) manufacturer = "Princo Corporation"; - if (frm == 40) + if(frm == 40) manufacturer = "POSTECH Corporation"; - if (frm == 50) + if(frm == 50) manufacturer = "Ritek Co."; - if (frm == 60) + if(frm == 60) manufacturer = "Prodisc Technology Inc."; break; case 48: - if (frm == 00) + if(frm == 00) manufacturer = "Ricoh Company Ltd."; - if (frm == 10) + if(frm == 10) manufacturer = "Kodak Japan Ltd."; - if (frm == 20) + if(frm == 20) manufacturer = "Plasmon Data systems Ltd."; - if (frm == 30) + if(frm == 30) manufacturer = "Pioneer Video Corporation"; - if (frm == 40) + if(frm == 40) manufacturer = "Digital Storage Technology Co., Ltd."; - if (frm == 50) + if(frm == 50) manufacturer = "Mitsui Chemicals, Inc."; - if (frm == 60) + if(frm == 60) manufacturer = "Lead Data Inc."; break; case 49: - if (frm == 00) + if(frm == 00) manufacturer = "TDK Corporation"; - if (frm == 10) + if(frm == 10) manufacturer = "Gigastore Corporation"; - if (frm == 20) + if(frm == 20) manufacturer = "King Pro Mediatek Inc."; - if (frm == 30) + if(frm == 30) manufacturer = "Opti.Me.S. S.p.A."; - if (frm == 40) + if(frm == 40) manufacturer = "Victor Company of Japan, Ltd."; - if (frm == 60) + if(frm == 60) manufacturer = "Matsushita Electric Industrial Co., Ltd."; break; case 50: - if (frm == 10) + if(frm == 10) manufacturer = "Vanguard Disc Inc."; - if (frm == 20) + if(frm == 20) manufacturer = "Mitsubishi Chemical Corporation"; - if (frm == 30) + if(frm == 30) manufacturer = "CDA Datenträger Albrechts GmbH"; break; case 51: - if (frm == 10) + if(frm == 10) manufacturer = "Grand Advance Technology Ltd."; - if (frm == 20) + if(frm == 20) manufacturer = "Infodisc Technology Co. Ltd."; - if (frm == 50) + if(frm == 50) manufacturer = "Hile Optical Disc Technology Corp."; break; } - if (manufacturer != "") + if(manufacturer != "") sb.AppendFormat("Disc manufactured by: {0}", manufacturer).AppendLine(); } diff --git a/DiscImageChef.Decoders/CD/CDTextOnLeadIn.cs b/DiscImageChef.Decoders/CD/CDTextOnLeadIn.cs index ab0f695c4..ca976fcfa 100644 --- a/DiscImageChef.Decoders/CD/CDTextOnLeadIn.cs +++ b/DiscImageChef.Decoders/CD/CDTextOnLeadIn.cs @@ -193,7 +193,7 @@ namespace DiscImageChef.Decoders.CD public static CDText? Decode(byte[] CDTextResponse) { - if (CDTextResponse == null) + if(CDTextResponse == null) return null; CDText decoded = new CDText(); @@ -205,16 +205,16 @@ namespace DiscImageChef.Decoders.CD decoded.Reserved2 = CDTextResponse[3]; decoded.DataPacks = new CDTextPack[(decoded.DataLength - 2) / 18]; - if (decoded.DataLength == 2) + if(decoded.DataLength == 2) return null; - if (decoded.DataLength + 2 != CDTextResponse.Length) + if(decoded.DataLength + 2 != CDTextResponse.Length) { DicConsole.DebugWriteLine("CD-TEXT decoder", "Expected CD-TEXT size ({0} bytes) is not received size ({1} bytes), not decoding", decoded.DataLength + 2, CDTextResponse.Length); return null; } - for (int i = 0; i < ((decoded.DataLength - 2) / 18); i++) + for(int i = 0; i < ((decoded.DataLength - 2) / 18); i++) { decoded.DataPacks[i].HeaderID1 = CDTextResponse[0 + i * 18 + 4]; decoded.DataPacks[i].HeaderID2 = CDTextResponse[1 + i * 18 + 4]; @@ -232,22 +232,22 @@ namespace DiscImageChef.Decoders.CD public static string Prettify(CDText? CDTextResponse) { - if (CDTextResponse == null) + if(CDTextResponse == null) return null; CDText response = CDTextResponse.Value; StringBuilder sb = new StringBuilder(); - #if DEBUG +#if DEBUG if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine(); if(response.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine(); - #endif +#endif - foreach (CDTextPack descriptor in response.DataPacks) + foreach(CDTextPack descriptor in response.DataPacks) { - if ((descriptor.HeaderID1 & 0x80) != 0x80) + if((descriptor.HeaderID1 & 0x80) != 0x80) { // Ignore NOPs if((descriptor.HeaderID1 & 0x80) != 0) @@ -255,12 +255,12 @@ namespace DiscImageChef.Decoders.CD } else { - switch (descriptor.HeaderID1) + switch(descriptor.HeaderID1) { case 0x80: { sb.Append("CD-Text pack contains title for "); - if (descriptor.HeaderID2 == 0x00) + if(descriptor.HeaderID2 == 0x00) sb.AppendLine("album"); else sb.AppendFormat("track {0}", descriptor.HeaderID2).AppendLine(); @@ -269,7 +269,7 @@ namespace DiscImageChef.Decoders.CD case 0x81: { sb.Append("CD-Text pack contains performer for "); - if (descriptor.HeaderID2 == 0x00) + if(descriptor.HeaderID2 == 0x00) sb.AppendLine("album"); else sb.AppendFormat("track {0}", descriptor.HeaderID2).AppendLine(); @@ -278,7 +278,7 @@ namespace DiscImageChef.Decoders.CD case 0x82: { sb.Append("CD-Text pack contains songwriter for "); - if (descriptor.HeaderID2 == 0x00) + if(descriptor.HeaderID2 == 0x00) sb.AppendLine("album"); else sb.AppendFormat("track {0}", descriptor.HeaderID2).AppendLine(); @@ -286,7 +286,7 @@ namespace DiscImageChef.Decoders.CD } case 0x83: { - if (descriptor.HeaderID2 == 0x00) + if(descriptor.HeaderID2 == 0x00) sb.AppendLine("album"); else sb.AppendFormat("track {0}", descriptor.HeaderID2).AppendLine(); @@ -295,7 +295,7 @@ namespace DiscImageChef.Decoders.CD case 0x84: { sb.Append("CD-Text pack contains arranger for "); - if (descriptor.HeaderID2 == 0x00) + if(descriptor.HeaderID2 == 0x00) sb.AppendLine("album"); else sb.AppendFormat("track {0}", descriptor.HeaderID2).AppendLine(); @@ -304,7 +304,7 @@ namespace DiscImageChef.Decoders.CD case 0x85: { sb.Append("CD-Text pack contains content provider's message for "); - if (descriptor.HeaderID2 == 0x00) + if(descriptor.HeaderID2 == 0x00) sb.AppendLine("album"); else sb.AppendFormat("track {0}", descriptor.HeaderID2).AppendLine(); @@ -344,7 +344,7 @@ namespace DiscImageChef.Decoders.CD } case 0x8E: { - if (descriptor.HeaderID2 == 0x00) + if(descriptor.HeaderID2 == 0x00) sb.AppendLine("CD-Text pack contains UPC"); else sb.AppendFormat("track {0}", descriptor.HeaderID2).AppendLine(); @@ -357,7 +357,7 @@ namespace DiscImageChef.Decoders.CD } } - switch (descriptor.HeaderID1) + switch(descriptor.HeaderID1) { case 0x80: case 0x81: @@ -369,7 +369,7 @@ namespace DiscImageChef.Decoders.CD case 0x87: case 0x8E: { - if (descriptor.DBCC) + if(descriptor.DBCC) sb.AppendLine("Double Byte Character Code is used"); sb.AppendFormat("Block number {0}", descriptor.BlockNumber).AppendLine(); sb.AppendFormat("Character position {0}", descriptor.CharacterPosition).AppendLine(); diff --git a/DiscImageChef.Decoders/CD/FullTOC.cs b/DiscImageChef.Decoders/CD/FullTOC.cs index 286f52b57..f320358f9 100644 --- a/DiscImageChef.Decoders/CD/FullTOC.cs +++ b/DiscImageChef.Decoders/CD/FullTOC.cs @@ -152,7 +152,7 @@ namespace DiscImageChef.Decoders.CD public static CDFullTOC? Decode(byte[] CDFullTOCResponse) { - if (CDFullTOCResponse == null) + if(CDFullTOCResponse == null) return null; CDFullTOC decoded = new CDFullTOC(); @@ -164,13 +164,13 @@ namespace DiscImageChef.Decoders.CD decoded.LastCompleteSession = CDFullTOCResponse[3]; decoded.TrackDescriptors = new TrackDataDescriptor[(decoded.DataLength - 2) / 11]; - if (decoded.DataLength + 2 != CDFullTOCResponse.Length) + if(decoded.DataLength + 2 != CDFullTOCResponse.Length) { DicConsole.DebugWriteLine("CD full TOC decoder", "Expected CDFullTOC size ({0} bytes) is not received size ({1} bytes), not decoding", decoded.DataLength + 2, CDFullTOCResponse.Length); return null; } - for (int i = 0; i < ((decoded.DataLength - 2) / 11); i++) + for(int i = 0; i < ((decoded.DataLength - 2) / 11); i++) { decoded.TrackDescriptors[i].SessionNumber = CDFullTOCResponse[0 + i * 11 + 4]; decoded.TrackDescriptors[i].ADR = (byte)((CDFullTOCResponse[1 + i * 11 + 4] & 0xF0) >> 4); @@ -193,7 +193,7 @@ namespace DiscImageChef.Decoders.CD public static string Prettify(CDFullTOC? CDFullTOCResponse) { - if (CDFullTOCResponse == null) + if(CDFullTOCResponse == null) return null; CDFullTOC response = CDFullTOCResponse.Value; @@ -204,9 +204,9 @@ namespace DiscImageChef.Decoders.CD sb.AppendFormat("First complete session number: {0}", response.FirstCompleteSession).AppendLine(); sb.AppendFormat("Last complete session number: {0}", response.LastCompleteSession).AppendLine(); - foreach (TrackDataDescriptor descriptor in response.TrackDescriptors) + foreach(TrackDataDescriptor descriptor in response.TrackDescriptors) { - if ((descriptor.CONTROL & 0x08) == 0x08 || + if((descriptor.CONTROL & 0x08) == 0x08 || (descriptor.ADR != 1 && descriptor.ADR != 5 && descriptor.ADR != 4 && descriptor.ADR != 6) || descriptor.TNO != 0) { @@ -233,19 +233,19 @@ namespace DiscImageChef.Decoders.CD lastSession = descriptor.SessionNumber; } - switch (descriptor.ADR) + switch(descriptor.ADR) { case 1: case 4: { - switch (descriptor.POINT) + switch(descriptor.POINT) { case 0xA0: { - if (descriptor.ADR == 4) + if(descriptor.ADR == 4) { sb.AppendFormat("First video track number: {0}", descriptor.PMIN).AppendLine(); - switch (descriptor.PSEC) + switch(descriptor.PSEC) { case 0x10: sb.AppendLine("CD-V single in NTSC format with digital stereo sound"); @@ -276,7 +276,7 @@ namespace DiscImageChef.Decoders.CD else { sb.AppendFormat("First track number: {0} (", descriptor.PMIN); - switch ((TOC_CONTROL)(descriptor.CONTROL & 0x0D)) + switch((TOC_CONTROL)(descriptor.CONTROL & 0x0D)) { case TOC_CONTROL.TwoChanNoPreEmph: sb.Append(StereoNoPre); @@ -305,12 +305,12 @@ namespace DiscImageChef.Decoders.CD } case 0xA1: { - if (descriptor.ADR == 4) + if(descriptor.ADR == 4) sb.AppendFormat("Last video track number: {0}", descriptor.PMIN).AppendLine(); else { sb.AppendFormat("Last track number: {0} (", descriptor.PMIN); - switch ((TOC_CONTROL)(descriptor.CONTROL & 0x0D)) + switch((TOC_CONTROL)(descriptor.CONTROL & 0x0D)) { case TOC_CONTROL.TwoChanNoPreEmph: sb.Append(StereoNoPre); @@ -344,7 +344,7 @@ namespace DiscImageChef.Decoders.CD sb.AppendFormat("Lead-out start position: {0:D2}:{1:D2}:{2:D2}", descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME).AppendLine(); //sb.AppendFormat("Absolute time: {3:D2}:{0:D2}:{1:D2}:{2:D2}", descriptor.Min, descriptor.Sec, descriptor.Frame, descriptor.HOUR).AppendLine(); - switch ((TOC_CONTROL)(descriptor.CONTROL & 0x0D)) + switch((TOC_CONTROL)(descriptor.CONTROL & 0x0D)) { case TOC_CONTROL.TwoChanNoPreEmph: case TOC_CONTROL.TwoChanPreEmph: @@ -372,15 +372,15 @@ namespace DiscImageChef.Decoders.CD } default: { - if (descriptor.POINT >= 0x01 && descriptor.POINT <= 0x63) + if(descriptor.POINT >= 0x01 && descriptor.POINT <= 0x63) { - if (descriptor.ADR == 4) + if(descriptor.ADR == 4) sb.AppendFormat("Video track {3} starts at: {0:D2}:{1:D2}:{2:D2}", descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME, descriptor.POINT).AppendLine(); else { string type = "Audio"; - if ((TOC_CONTROL)(descriptor.CONTROL & 0x0D) == TOC_CONTROL.DataTrack || + if((TOC_CONTROL)(descriptor.CONTROL & 0x0D) == TOC_CONTROL.DataTrack || (TOC_CONTROL)(descriptor.CONTROL & 0x0D) == TOC_CONTROL.DataTrackIncremental) type = "Data"; @@ -389,7 +389,7 @@ namespace DiscImageChef.Decoders.CD else sb.AppendFormat("{4} track {3} starts at: {0:D2}:{1:D2}:{2:D2} (", descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME, descriptor.POINT, type); - switch ((TOC_CONTROL)(descriptor.CONTROL & 0x0D)) + switch((TOC_CONTROL)(descriptor.CONTROL & 0x0D)) { case TOC_CONTROL.TwoChanNoPreEmph: sb.Append(StereoNoPre); @@ -436,11 +436,11 @@ namespace DiscImageChef.Decoders.CD } case 5: { - switch (descriptor.POINT) + switch(descriptor.POINT) { case 0xB0: { - if (descriptor.PHOUR > 0) + if(descriptor.PHOUR > 0) { sb.AppendFormat("Start of next possible program in the recordable area of the disc: {3:D2}:{0:D2}:{1:D2}:{2:D2}", descriptor.Min, descriptor.Sec, descriptor.Frame, descriptor.HOUR).AppendLine(); sb.AppendFormat("Maximum start of outermost Lead-out in the recordable area of the disc: {3:D2}:{0:D2}:{1:D2}:{2:D2}", descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME, descriptor.PHOUR).AppendLine(); @@ -474,7 +474,7 @@ namespace DiscImageChef.Decoders.CD case 0xC0: { sb.AppendFormat("Optimum recording power: 0x{0:X2}", descriptor.Min).AppendLine(); - if (descriptor.PHOUR > 0) + if(descriptor.PHOUR > 0) sb.AppendFormat("Start time of the first Lead-in area in the disc: {3:D2}:{0:D2}:{1:D2}:{2:D2}", descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME, descriptor.PHOUR).AppendLine(); else sb.AppendFormat("Start time of the first Lead-in area in the disc: {0:D2}:{1:D2}:{2:D2}", descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME).AppendLine(); @@ -494,7 +494,7 @@ namespace DiscImageChef.Decoders.CD } case 0xCF: { - if (descriptor.PHOUR > 0) + if(descriptor.PHOUR > 0) { sb.AppendFormat("Start position of outer part lead-in area: {3:D2}:{0:D2}:{1:D2}:{2:D2}", descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME, descriptor.PHOUR).AppendLine(); sb.AppendFormat("Stop position of inner part lead-out area: {3:D2}:{0:D2}:{1:D2}:{2:D2}", descriptor.Min, descriptor.Sec, descriptor.Frame, descriptor.HOUR).AppendLine(); @@ -508,7 +508,7 @@ namespace DiscImageChef.Decoders.CD } default: { - if (descriptor.POINT >= 0x01 && descriptor.POINT <= 0x40) + if(descriptor.POINT >= 0x01 && descriptor.POINT <= 0x40) { sb.AppendFormat("Start time for interval that should be skipped: {0:D2}:{1:D2}:{2:D2}", descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME).AppendLine(); sb.AppendFormat("Ending time for interval that should be skipped: {0:D2}:{1:D2}:{2:D2}", descriptor.Min, descriptor.Sec, descriptor.Frame).AppendLine(); diff --git a/DiscImageChef.Decoders/CD/PMA.cs b/DiscImageChef.Decoders/CD/PMA.cs index cb6dd03a9..af1176645 100644 --- a/DiscImageChef.Decoders/CD/PMA.cs +++ b/DiscImageChef.Decoders/CD/PMA.cs @@ -139,7 +139,7 @@ namespace DiscImageChef.Decoders.CD public static CDPMA? Decode(byte[] CDPMAResponse) { - if (CDPMAResponse == null) + if(CDPMAResponse == null) return null; CDPMA decoded = new CDPMA(); @@ -151,13 +151,13 @@ namespace DiscImageChef.Decoders.CD decoded.Reserved2 = CDPMAResponse[3]; decoded.PMADescriptors = new CDPMADescriptors[(decoded.DataLength - 2) / 11]; - if (decoded.DataLength + 2 != CDPMAResponse.Length) + if(decoded.DataLength + 2 != CDPMAResponse.Length) { DicConsole.DebugWriteLine("CD PMA decoder", "Expected CDPMA size ({0} bytes) is not received size ({1} bytes), not decoding", decoded.DataLength + 2, CDPMAResponse.Length); return null; } - for (int i = 0; i < ((decoded.DataLength - 2) / 11); i++) + for(int i = 0; i < ((decoded.DataLength - 2) / 11); i++) { decoded.PMADescriptors[i].Reserved = CDPMAResponse[0 + i * 11 + 4]; decoded.PMADescriptors[i].ADR = (byte)((CDPMAResponse[1 + i * 11 + 4] & 0xF0) >> 4); @@ -179,34 +179,34 @@ namespace DiscImageChef.Decoders.CD public static string Prettify(CDPMA? CDPMAResponse) { - if (CDPMAResponse == null) + if(CDPMAResponse == null) return null; CDPMA response = CDPMAResponse.Value; StringBuilder sb = new StringBuilder(); - #if DEBUG +#if DEBUG if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine(); if(response.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine(); - #endif +#endif - foreach (CDPMADescriptors descriptor in response.PMADescriptors) + foreach(CDPMADescriptors descriptor in response.PMADescriptors) { - #if DEBUG +#if DEBUG if(descriptor.Reserved != 0) sb.AppendFormat("Reserved = 0x{0:X2}", descriptor.Reserved).AppendLine(); - #endif +#endif - switch (descriptor.ADR) + switch(descriptor.ADR) { case 1: - if (descriptor.POINT > 0) + if(descriptor.POINT > 0) { sb.AppendFormat("Track {0}", descriptor.POINT); - switch ((TOC_CONTROL)(descriptor.CONTROL & 0x0D)) + switch((TOC_CONTROL)(descriptor.CONTROL & 0x0D)) { case TOC_CONTROL.TwoChanNoPreEmph: sb.Append(" (Stereo audio track with no pre-emphasis)"); @@ -227,11 +227,11 @@ namespace DiscImageChef.Decoders.CD sb.Append(" (Data track, recorded incrementally)"); break; } - if (descriptor.PHOUR > 0) + if(descriptor.PHOUR > 0) sb.AppendFormat(" starts at {3}:{0:D2}:{1:D2}:{2:D2}", descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME, descriptor.PHOUR); else sb.AppendFormat(" starts at {0:D2}:{1:D2}:{2:D2}", descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME); - if (descriptor.PHOUR > 0) + if(descriptor.PHOUR > 0) sb.AppendFormat(" and ends at {3}:{0:D2}:{1:D2}:{2:D2}", descriptor.Min, descriptor.Sec, descriptor.Frame, descriptor.HOUR); else sb.AppendFormat(" and ends at {0:D2}:{1:D2}:{2:D2}", descriptor.Min, descriptor.Sec, descriptor.Frame); diff --git a/DiscImageChef.Decoders/CD/Session.cs b/DiscImageChef.Decoders/CD/Session.cs index cf6f9c417..24c247df5 100644 --- a/DiscImageChef.Decoders/CD/Session.cs +++ b/DiscImageChef.Decoders/CD/Session.cs @@ -114,7 +114,7 @@ namespace DiscImageChef.Decoders.CD public static CDSessionInfo? Decode(byte[] CDSessionInfoResponse) { - if (CDSessionInfoResponse == null) + if(CDSessionInfoResponse == null) return null; CDSessionInfo decoded = new CDSessionInfo(); @@ -126,13 +126,13 @@ namespace DiscImageChef.Decoders.CD decoded.LastCompleteSession = CDSessionInfoResponse[3]; decoded.TrackDescriptors = new TrackDataDescriptor[(decoded.DataLength - 2) / 8]; - if (decoded.DataLength + 2 != CDSessionInfoResponse.Length) + if(decoded.DataLength + 2 != CDSessionInfoResponse.Length) { DicConsole.DebugWriteLine("CD Session Info decoder", "Expected CDSessionInfo size ({0} bytes) is not received size ({1} bytes), not decoding", decoded.DataLength + 2, CDSessionInfoResponse.Length); return null; } - for (int i = 0; i < ((decoded.DataLength - 2) / 8); i++) + for(int i = 0; i < ((decoded.DataLength - 2) / 8); i++) { decoded.TrackDescriptors[i].Reserved1 = CDSessionInfoResponse[0 + i * 8 + 4]; decoded.TrackDescriptors[i].ADR = (byte)((CDSessionInfoResponse[1 + i * 8 + 4] & 0xF0) >> 4); @@ -147,7 +147,7 @@ namespace DiscImageChef.Decoders.CD public static string Prettify(CDSessionInfo? CDSessionInfoResponse) { - if (CDSessionInfoResponse == null) + if(CDSessionInfoResponse == null) return null; CDSessionInfo response = CDSessionInfoResponse.Value; @@ -156,7 +156,7 @@ namespace DiscImageChef.Decoders.CD sb.AppendFormat("First complete session number: {0}", response.FirstCompleteSession).AppendLine(); sb.AppendFormat("Last complete session number: {0}", response.LastCompleteSession).AppendLine(); - foreach (TrackDataDescriptor descriptor in response.TrackDescriptors) + foreach(TrackDataDescriptor descriptor in response.TrackDescriptors) { sb.AppendFormat("First track number in last complete session: {0}", descriptor.TrackNumber).AppendLine(); sb.AppendFormat("Track starts at LBA {0}, or MSF {1:X2}:{2:X2}:{3:X2}", descriptor.TrackStartAddress, @@ -164,7 +164,7 @@ namespace DiscImageChef.Decoders.CD (descriptor.TrackStartAddress & 0x00FF0000) >> 16, (descriptor.TrackStartAddress & 0xFF000000) >> 24).AppendLine(); - switch ((TOC_ADR)descriptor.ADR) + switch((TOC_ADR)descriptor.ADR) { case TOC_ADR.NoInformation: sb.AppendLine("Q subchannel mode not given"); @@ -184,7 +184,7 @@ namespace DiscImageChef.Decoders.CD sb.AppendFormat("Reserved flags 0x{0:X2} set", descriptor.CONTROL).AppendLine(); else { - switch ((TOC_CONTROL)(descriptor.CONTROL & 0x0D)) + switch((TOC_CONTROL)(descriptor.CONTROL & 0x0D)) { case TOC_CONTROL.TwoChanNoPreEmph: sb.AppendLine("Stereo audio track with no pre-emphasis"); @@ -206,17 +206,17 @@ namespace DiscImageChef.Decoders.CD break; } - if ((descriptor.CONTROL & (byte)TOC_CONTROL.CopyPermissionMask) == (byte)TOC_CONTROL.CopyPermissionMask) + if((descriptor.CONTROL & (byte)TOC_CONTROL.CopyPermissionMask) == (byte)TOC_CONTROL.CopyPermissionMask) sb.AppendLine("Digital copy of track is permitted"); else sb.AppendLine("Digital copy of track is prohibited"); - #if DEBUG +#if DEBUG if(descriptor.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", descriptor.Reserved1).AppendLine(); if(descriptor.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", descriptor.Reserved2).AppendLine(); - #endif +#endif sb.AppendLine(); } diff --git a/DiscImageChef.Decoders/CD/TOC.cs b/DiscImageChef.Decoders/CD/TOC.cs index 150283dab..29cd8f711 100644 --- a/DiscImageChef.Decoders/CD/TOC.cs +++ b/DiscImageChef.Decoders/CD/TOC.cs @@ -116,7 +116,7 @@ namespace DiscImageChef.Decoders.CD public static CDTOC? Decode(byte[] CDTOCResponse) { - if (CDTOCResponse == null) + if(CDTOCResponse == null) return null; CDTOC decoded = new CDTOC(); @@ -128,13 +128,13 @@ namespace DiscImageChef.Decoders.CD decoded.LastTrack = CDTOCResponse[3]; decoded.TrackDescriptors = new CDTOCTrackDataDescriptor[(decoded.DataLength - 2) / 8]; - if (decoded.DataLength + 2 != CDTOCResponse.Length) + if(decoded.DataLength + 2 != CDTOCResponse.Length) { DicConsole.DebugWriteLine("CD TOC decoder", "Expected CDTOC size ({0} bytes) is not received size ({1} bytes), not decoding", decoded.DataLength + 2, CDTOCResponse.Length); return null; } - for (int i = 0; i < ((decoded.DataLength - 2) / 8); i++) + for(int i = 0; i < ((decoded.DataLength - 2) / 8); i++) { decoded.TrackDescriptors[i].Reserved1 = CDTOCResponse[0 + i * 8 + 4]; decoded.TrackDescriptors[i].ADR = (byte)((CDTOCResponse[1 + i * 8 + 4] & 0xF0) >> 4); @@ -149,7 +149,7 @@ namespace DiscImageChef.Decoders.CD public static string Prettify(CDTOC? CDTOCResponse) { - if (CDTOCResponse == null) + if(CDTOCResponse == null) return null; CDTOC response = CDTOCResponse.Value; @@ -158,10 +158,10 @@ namespace DiscImageChef.Decoders.CD sb.AppendFormat("First track number in first complete session: {0}", response.FirstTrack).AppendLine(); sb.AppendFormat("Last track number in last complete session: {0}", response.LastTrack).AppendLine(); - foreach (CDTOCTrackDataDescriptor descriptor in response.TrackDescriptors) + foreach(CDTOCTrackDataDescriptor descriptor in response.TrackDescriptors) { - if (descriptor.TrackNumber == 0xAA) - sb.AppendLine("Track number: Lead-Out"); + if(descriptor.TrackNumber == 0xAA) + sb.AppendLine("Track number: Lead-Out"); else sb.AppendFormat("Track number: {0}", descriptor.TrackNumber).AppendLine(); sb.AppendFormat("Track starts at LBA {0}, or MSF {1:X2}:{2:X2}:{3:X2}", descriptor.TrackStartAddress, @@ -169,7 +169,7 @@ namespace DiscImageChef.Decoders.CD (descriptor.TrackStartAddress & 0x00FF0000) >> 16, (descriptor.TrackStartAddress & 0xFF000000) >> 24).AppendLine(); - switch ((TOC_ADR)descriptor.ADR) + switch((TOC_ADR)descriptor.ADR) { case TOC_ADR.NoInformation: sb.AppendLine("Q subchannel mode not given"); @@ -195,7 +195,7 @@ namespace DiscImageChef.Decoders.CD sb.AppendFormat("Reserved flags 0x{0:X2} set", descriptor.CONTROL).AppendLine(); else { - switch ((TOC_CONTROL)(descriptor.CONTROL & 0x0D)) + switch((TOC_CONTROL)(descriptor.CONTROL & 0x0D)) { case TOC_CONTROL.TwoChanNoPreEmph: sb.AppendLine("Stereo audio track with no pre-emphasis"); @@ -217,17 +217,17 @@ namespace DiscImageChef.Decoders.CD break; } - if ((descriptor.CONTROL & (byte)TOC_CONTROL.CopyPermissionMask) == (byte)TOC_CONTROL.CopyPermissionMask) + if((descriptor.CONTROL & (byte)TOC_CONTROL.CopyPermissionMask) == (byte)TOC_CONTROL.CopyPermissionMask) sb.AppendLine("Digital copy of track is permitted"); else sb.AppendLine("Digital copy of track is prohibited"); - #if DEBUG +#if DEBUG if(descriptor.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", descriptor.Reserved1).AppendLine(); if(descriptor.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", descriptor.Reserved2).AppendLine(); - #endif +#endif sb.AppendLine(); } diff --git a/DiscImageChef.Decoders/DVD/CSS&CPRM.cs b/DiscImageChef.Decoders/DVD/CSS&CPRM.cs index e409296c1..9d94afa3e 100644 --- a/DiscImageChef.Decoders/DVD/CSS&CPRM.cs +++ b/DiscImageChef.Decoders/DVD/CSS&CPRM.cs @@ -126,7 +126,7 @@ namespace DiscImageChef.Decoders.DVD if(response == null) return null; - if (response.Length != 8) + if(response.Length != 8) return null; LeadInCopyright cmi = new LeadInCopyright(); @@ -144,13 +144,13 @@ namespace DiscImageChef.Decoders.DVD public static string PrettifyLeadInCopyright(LeadInCopyright? cmi) { - if (cmi == null) + if(cmi == null) return null; LeadInCopyright decoded = cmi.Value; StringBuilder sb = new StringBuilder(); - switch (decoded.CopyrightType) + switch(decoded.CopyrightType) { case CopyrightType.NoProtection: sb.AppendLine("Disc has no encryption."); @@ -169,31 +169,31 @@ namespace DiscImageChef.Decoders.DVD break; } - if (decoded.CopyrightType == 0) + if(decoded.CopyrightType == 0) return sb.ToString(); - if (decoded.RegionInformation == 0xFF) + if(decoded.RegionInformation == 0xFF) sb.AppendLine("Disc cannot be played in any region at all."); - else if (decoded.RegionInformation == 0x00) + else if(decoded.RegionInformation == 0x00) sb.AppendLine("Disc can be played in any region."); else { sb.Append("Disc can be played in the following regions:"); - if ((decoded.RegionInformation & 0x01) != 0x01) + if((decoded.RegionInformation & 0x01) != 0x01) sb.Append(" 0"); - if ((decoded.RegionInformation & 0x02) != 0x02) + if((decoded.RegionInformation & 0x02) != 0x02) sb.Append(" 1"); - if ((decoded.RegionInformation & 0x04) != 0x04) + if((decoded.RegionInformation & 0x04) != 0x04) sb.Append(" 2"); - if ((decoded.RegionInformation & 0x08) != 0x08) + if((decoded.RegionInformation & 0x08) != 0x08) sb.Append(" 3"); - if ((decoded.RegionInformation & 0x10) != 0x10) + if((decoded.RegionInformation & 0x10) != 0x10) sb.Append(" 4"); - if ((decoded.RegionInformation & 0x20) != 0x20) + if((decoded.RegionInformation & 0x20) != 0x20) sb.Append(" 5"); - if ((decoded.RegionInformation & 0x40) != 0x40) + if((decoded.RegionInformation & 0x40) != 0x40) sb.Append(" 6"); - if ((decoded.RegionInformation & 0x80) != 0x80) + if((decoded.RegionInformation & 0x80) != 0x80) sb.Append(" 7"); } diff --git a/DiscImageChef.Decoders/DVD/Cartridge.cs b/DiscImageChef.Decoders/DVD/Cartridge.cs index 479d4ef7f..a8c5f6ae3 100644 --- a/DiscImageChef.Decoders/DVD/Cartridge.cs +++ b/DiscImageChef.Decoders/DVD/Cartridge.cs @@ -128,10 +128,10 @@ namespace DiscImageChef.Decoders.DVD public static MediumStatus? Decode(byte[] response) { - if (response == null) + if(response == null) return null; - if (response.Length != 8) + if(response.Length != 8) return null; MediumStatus status = new MediumStatus(); @@ -155,25 +155,25 @@ namespace DiscImageChef.Decoders.DVD public static string Prettify(MediumStatus? status) { - if (status == null) + if(status == null) return null; MediumStatus decoded = status.Value; StringBuilder sb = new StringBuilder(); - if (decoded.PWP) + if(decoded.PWP) sb.AppendLine("Disc surface is set to write protected status"); - if (decoded.Cartridge) + if(decoded.Cartridge) { sb.AppendLine("Disc comes in a cartridge"); - if (decoded.OUT) + if(decoded.OUT) sb.AppendLine("Disc has been extracted from the cartridge"); - if (decoded.CWP) + if(decoded.CWP) sb.AppendLine("Cartridge is set to write protected"); } - switch (decoded.DiscType) + switch(decoded.DiscType) { case 0: sb.AppendLine("Disc shall not be written without a cartridge"); @@ -186,9 +186,9 @@ namespace DiscImageChef.Decoders.DVD break; } - if (decoded.MSWI) + if(decoded.MSWI) { - switch (decoded.RAMSWI) + switch(decoded.RAMSWI) { case 0: break; diff --git a/DiscImageChef.Decoders/DVD/DDS.cs b/DiscImageChef.Decoders/DVD/DDS.cs index 35b59fa7f..cae612b56 100644 --- a/DiscImageChef.Decoders/DVD/DDS.cs +++ b/DiscImageChef.Decoders/DVD/DDS.cs @@ -201,17 +201,17 @@ namespace DiscImageChef.Decoders.DVD public static DiscDefinitionStructure? Decode(byte[] response) { - if (response == null) + if(response == null) return null; - if (response.Length != 2052) + if(response.Length != 2052) return null; DiscDefinitionStructure dds = new DiscDefinitionStructure(); dds.Identifier = (ushort)((response[4] << 8) + response[5]); - if (dds.Identifier != 0x0A0A) + if(dds.Identifier != 0x0A0A) return null; // Common to both DVD-RAM versions @@ -226,7 +226,7 @@ namespace DiscImageChef.Decoders.DVD dds.Groups = (ushort)((response[12] << 8) + response[13]); // ECMA-272 - if (dds.Groups == 24) + if(dds.Groups == 24) { dds.PartialCertification |= (response[7] & 0x40) == 0x40; dds.FormattingOnlyAGroup |= (response[7] & 0x20) == 0x20; @@ -234,7 +234,7 @@ namespace DiscImageChef.Decoders.DVD dds.Reserved = new byte[6]; Array.Copy(response, 14, dds.Reserved, 0, 6); dds.GroupCertificationFlags = new GroupCertificationFlag[24]; - for (int i = 0; i < 24; i++) + for(int i = 0; i < 24; i++) { dds.GroupCertificationFlags[i].InProcess |= (response[20 + i] & 0x80) == 0x80; dds.GroupCertificationFlags[i].PartialCertification |= (response[20 + i] & 0x40) == 0x40; @@ -245,7 +245,7 @@ namespace DiscImageChef.Decoders.DVD } // ECMA-330 - if (dds.Groups == 1) + if(dds.Groups == 1) { dds.Reserved4 = (byte)((response[7] & 0x7C) >> 2); dds.Reserved = new byte[68]; @@ -256,7 +256,7 @@ namespace DiscImageChef.Decoders.DVD dds.LSN0Location = (uint)((response[93] << 16) + (response[94] << 8) + response[95]); dds.StartLSNForZone = new uint[dds.Zones]; - for (int i = 0; i < dds.Zones; i++) + for(int i = 0; i < dds.Zones; i++) dds.StartLSNForZone[i] = (uint)((response[260 + i * 4 + 1] << 16) + (response[260 + i * 4 + 2] << 8) + response[260 + i * 4 + 3]); } @@ -265,53 +265,53 @@ namespace DiscImageChef.Decoders.DVD public static string Prettify(DiscDefinitionStructure? dds) { - if (dds == null) + if(dds == null) return null; DiscDefinitionStructure decoded = dds.Value; StringBuilder sb = new StringBuilder(); - if (decoded.InProcess) + if(decoded.InProcess) { sb.AppendLine("Formatting in progress."); - if (decoded.Groups == 24) + if(decoded.Groups == 24) { - if (decoded.PartialCertification) + if(decoded.PartialCertification) sb.AppendLine("Formatting is only using partial certification"); - if (decoded.FormattingOnlyAGroup) + if(decoded.FormattingOnlyAGroup) sb.AppendLine("Only a group is being formatted"); } } - if (decoded.UserCertification) + if(decoded.UserCertification) sb.AppendLine("Disc has been certified by an user"); - if (decoded.ManufacturerCertification) + if(decoded.ManufacturerCertification) sb.AppendLine("Disc has been certified by a manufacturer"); sb.AppendFormat("DDS has been updated {0} times", decoded.UpdateCount).AppendLine(); - if (decoded.Groups == 24) + if(decoded.Groups == 24) { - for (int i = 0; i < decoded.GroupCertificationFlags.Length; i++) + for(int i = 0; i < decoded.GroupCertificationFlags.Length; i++) { if(decoded.GroupCertificationFlags[i].InProcess) { sb.AppendFormat("Group {0} is being formatted", i).AppendLine(); - if (decoded.GroupCertificationFlags[i].PartialCertification) + if(decoded.GroupCertificationFlags[i].PartialCertification) sb.AppendFormat("Group {0} is being certified partially", i).AppendLine(); } - if (decoded.GroupCertificationFlags[i].UserCertification) + if(decoded.GroupCertificationFlags[i].UserCertification) sb.AppendFormat("Group {0} has been certified by an user", i).AppendLine(); } } - if (decoded.Groups == 1) + if(decoded.Groups == 1) { sb.AppendFormat("Disc has {0} zones", decoded.Zones).AppendLine(); sb.AppendFormat("Primary Spare Area stats at PSN {0:X}h and ends at PSN {1:X}h, inclusively", decoded.SpareAreaFirstPSN, decoded.SpareAreaLastPSN).AppendLine(); sb.AppendFormat("LSN 0 is at PSN {0:X}h", decoded.LSN0Location).AppendLine(); - for (int i = 0; i < decoded.StartLSNForZone.Length; i++) + for(int i = 0; i < decoded.StartLSNForZone.Length; i++) sb.AppendFormat("Zone {0} starts at LSN {1}", i, decoded.StartLSNForZone[i]).AppendLine(); } diff --git a/DiscImageChef.Decoders/DVD/PFI.cs b/DiscImageChef.Decoders/DVD/PFI.cs index d9c1021b0..4e0510535 100644 --- a/DiscImageChef.Decoders/DVD/PFI.cs +++ b/DiscImageChef.Decoders/DVD/PFI.cs @@ -1054,10 +1054,10 @@ namespace DiscImageChef.Decoders.DVD public static PhysicalFormatInformation? Decode(byte[] response) { - if (response == null) + if(response == null) return null; - if (response.Length < 2052) + if(response.Length < 2052) return null; PhysicalFormatInformation pfi = new PhysicalFormatInformation(); @@ -1084,17 +1084,17 @@ namespace DiscImageChef.Decoders.DVD pfi.BCA |= (response[20] & 0x80) == 0x80; // UMD - if (pfi.DiskCategory == DiskCategory.UMD) + if(pfi.DiskCategory == DiskCategory.UMD) { pfi.MediaAttribute = (ushort)((response[21] << 8) + response[22]); } // DVD-RAM - if (pfi.DiskCategory == DiskCategory.DVDRAM) + if(pfi.DiskCategory == DiskCategory.DVDRAM) { pfi.DiscType = (DVDRAMDiscType)response[36]; - if (pfi.PartVersion == 1) + if(pfi.PartVersion == 1) { pfi.Velocity = response[52]; pfi.ReadPower = response[53]; @@ -1115,7 +1115,7 @@ namespace DiscImageChef.Decoders.DVD pfi.LastPulseEndGroove = response[68]; pfi.BiasPowerDurationGroove = response[69]; } - else if (pfi.PartVersion == 6) + else if(pfi.PartVersion == 6) { pfi.Velocity = response[504]; pfi.ReadPower = response[505]; @@ -1187,8 +1187,8 @@ namespace DiscImageChef.Decoders.DVD } // DVD-R and DVD-RW - if ((pfi.DiskCategory == DiskCategory.DVDR && - pfi.PartVersion < 6) || + if((pfi.DiskCategory == DiskCategory.DVDR && + pfi.PartVersion < 6) || (pfi.DiskCategory == DiskCategory.DVDRW && pfi.PartVersion < 3)) { @@ -1197,7 +1197,7 @@ namespace DiscImageChef.Decoders.DVD } // DVD+RW - if (pfi.DiskCategory == DiskCategory.DVDPRW) + if(pfi.DiskCategory == DiskCategory.DVDPRW) { pfi.RecordingVelocity = response[36]; pfi.ReadPowerMaxVelocity = response[37]; @@ -1221,7 +1221,7 @@ namespace DiscImageChef.Decoders.DVD } // DVD+R, DVD+RW, DVD+R DL and DVD+RW DL - if (pfi.DiskCategory == DiskCategory.DVDPR || + if(pfi.DiskCategory == DiskCategory.DVDPR || pfi.DiskCategory == DiskCategory.DVDPRW || pfi.DiskCategory == DiskCategory.DVDPRDL || pfi.DiskCategory == DiskCategory.DVDPRWDL) @@ -1240,7 +1240,7 @@ namespace DiscImageChef.Decoders.DVD } // DVD+RW - if (pfi.DiskCategory == DiskCategory.DVDPRW && + if(pfi.DiskCategory == DiskCategory.DVDPRW && pfi.PartVersion == 2) { pfi.TopFirstPulseDuration = response[55]; @@ -1251,7 +1251,7 @@ namespace DiscImageChef.Decoders.DVD } // DVD+R and DVD+R DL - if (pfi.DiskCategory == DiskCategory.DVDPR || + if(pfi.DiskCategory == DiskCategory.DVDPR || pfi.DiskCategory == DiskCategory.DVDPRDL) { pfi.PrimaryVelocity = response[36]; @@ -1281,13 +1281,13 @@ namespace DiscImageChef.Decoders.DVD } // DVD+R DL - if (pfi.DiskCategory == DiskCategory.DVDPRDL) + if(pfi.DiskCategory == DiskCategory.DVDPRDL) { pfi.LayerStructure = (DVDLayerStructure)((response[34] & 0xC0) >> 6); } // DVD+RW DL - if (pfi.DiskCategory == DiskCategory.DVDPRWDL) + if(pfi.DiskCategory == DiskCategory.DVDPRWDL) { pfi.BasicPrimaryVelocity = response[36]; pfi.MaxReadPowerPrimaryVelocity = response[37]; @@ -1310,8 +1310,8 @@ namespace DiscImageChef.Decoders.DVD } // DVD-R DL and DVD-RW DL - if ((pfi.DiskCategory == DiskCategory.DVDR && - pfi.PartVersion == 6) || + if((pfi.DiskCategory == DiskCategory.DVDR && + pfi.PartVersion == 6) || (pfi.DiskCategory == DiskCategory.DVDRW && pfi.PartVersion == 3)) { @@ -1340,14 +1340,14 @@ namespace DiscImageChef.Decoders.DVD public static string Prettify(PhysicalFormatInformation? pfi) { - if (pfi == null) + if(pfi == null) return null; PhysicalFormatInformation decoded = pfi.Value; StringBuilder sb = new StringBuilder(); string sizeString; - switch (decoded.DiscSize) + switch(decoded.DiscSize) { case DVDSize.Eighty: sizeString = "80mm"; @@ -1362,18 +1362,18 @@ namespace DiscImageChef.Decoders.DVD string categorySentence = "Disc is a {0} {1} version {2}"; - switch (decoded.DiskCategory) + switch(decoded.DiskCategory) { case DiskCategory.DVDROM: sb.AppendFormat(categorySentence, sizeString, "DVD-ROM", decoded.PartVersion).AppendLine(); - if (decoded.DiscSize == DVDSize.OneTwenty && decoded.PartVersion == 1) + if(decoded.DiscSize == DVDSize.OneTwenty && decoded.PartVersion == 1) sb.AppendLine("Disc claims conformation to ECMA-267"); - if (decoded.DiscSize == DVDSize.Eighty && decoded.PartVersion == 1) + if(decoded.DiscSize == DVDSize.Eighty && decoded.PartVersion == 1) sb.AppendLine("Disc claims conformation to ECMA-268"); break; case DiskCategory.DVDRAM: sb.AppendFormat(categorySentence, sizeString, "DVD-RAM", decoded.PartVersion).AppendLine(); - switch (decoded.PartVersion) + switch(decoded.PartVersion) { case 1: sb.AppendLine("Disc claims conformation to ECMA-272"); @@ -1388,7 +1388,7 @@ namespace DiscImageChef.Decoders.DVD sb.AppendFormat(categorySentence, sizeString, "DVD-R DL", decoded.PartVersion).AppendLine(); else sb.AppendFormat(categorySentence, sizeString, "DVD-R", decoded.PartVersion).AppendLine(); - switch (decoded.PartVersion) + switch(decoded.PartVersion) { case 1: sb.AppendLine("Disc claims conformation to ECMA-279"); @@ -1406,7 +1406,7 @@ namespace DiscImageChef.Decoders.DVD sb.AppendFormat(categorySentence, sizeString, "DVD-RW DL", decoded.PartVersion).AppendLine(); else sb.AppendFormat(categorySentence, sizeString, "DVD-RW", decoded.PartVersion).AppendLine(); - switch (decoded.PartVersion) + switch(decoded.PartVersion) { case 2: sb.AppendLine("Disc claims conformation to ECMA-338"); @@ -1421,7 +1421,7 @@ namespace DiscImageChef.Decoders.DVD sb.AppendFormat(categorySentence, "60mm", "UMD", decoded.PartVersion).AppendLine(); else sb.AppendFormat(categorySentence, "invalid size", "UMD", decoded.PartVersion).AppendLine(); - switch (decoded.PartVersion) + switch(decoded.PartVersion) { case 0: sb.AppendLine("Disc claims conformation to ECMA-365"); @@ -1430,7 +1430,7 @@ namespace DiscImageChef.Decoders.DVD break; case DiskCategory.DVDPRW: sb.AppendFormat(categorySentence, sizeString, "DVD+RW", decoded.PartVersion).AppendLine(); - switch (decoded.PartVersion) + switch(decoded.PartVersion) { case 1: sb.AppendLine("Disc claims conformation to ECMA-274"); @@ -1445,7 +1445,7 @@ namespace DiscImageChef.Decoders.DVD break; case DiskCategory.DVDPR: sb.AppendFormat(categorySentence, sizeString, "DVD+R", decoded.PartVersion).AppendLine(); - switch (decoded.PartVersion) + switch(decoded.PartVersion) { case 1: sb.AppendLine("Disc claims conformation to ECMA-349"); @@ -1454,7 +1454,7 @@ namespace DiscImageChef.Decoders.DVD break; case DiskCategory.DVDPRWDL: sb.AppendFormat(categorySentence, sizeString, "DVD+RW DL", decoded.PartVersion).AppendLine(); - switch (decoded.PartVersion) + switch(decoded.PartVersion) { case 1: sb.AppendLine("Disc claims conformation to ECMA-374"); @@ -1463,7 +1463,7 @@ namespace DiscImageChef.Decoders.DVD break; case DiskCategory.DVDPRDL: sb.AppendFormat(categorySentence, sizeString, "DVD+R DL", decoded.PartVersion).AppendLine(); - switch (decoded.PartVersion) + switch(decoded.PartVersion) { case 1: sb.AppendLine("Disc claims conformation to ECMA-364"); @@ -1471,11 +1471,11 @@ namespace DiscImageChef.Decoders.DVD } break; case DiskCategory.Nintendo: - if (decoded.PartVersion == 15) + if(decoded.PartVersion == 15) { - if (decoded.DiscSize == DVDSize.Eighty) + if(decoded.DiscSize == DVDSize.Eighty) sb.AppendLine("Disc is a Nintendo Gamecube Optical Disc (GOD)"); - else if (decoded.DiscSize == DVDSize.OneTwenty) + else if(decoded.DiscSize == DVDSize.OneTwenty) sb.AppendLine("Disc is a Nintendo Wii Optical Disc (WOD)"); else goto default; @@ -1500,7 +1500,7 @@ namespace DiscImageChef.Decoders.DVD break; } - switch (decoded.MaximumRate) + switch(decoded.MaximumRate) { case MaximumRateField.TwoMbps: sb.AppendLine("Disc maximum transfer rate is 2,52 Mbit/sec."); @@ -1526,12 +1526,12 @@ namespace DiscImageChef.Decoders.DVD } sb.AppendFormat("Disc has {0} layers", decoded.Layers + 1).AppendLine(); - if (decoded.TrackPath && decoded.Layers == 1) + if(decoded.TrackPath && decoded.Layers == 1) sb.AppendLine("Layers are in parallel track path"); - else if (!decoded.TrackPath && decoded.Layers == 1) + else if(!decoded.TrackPath && decoded.Layers == 1) sb.AppendLine("Layers are in opposite track path"); - switch (decoded.LinearDensity) + switch(decoded.LinearDensity) { case LinearDensityField.TwoSix: sb.AppendLine("Pitch size is 0,267 μm/bit"); @@ -1559,7 +1559,7 @@ namespace DiscImageChef.Decoders.DVD break; } - switch (decoded.TrackDensity) + switch(decoded.TrackDensity) { case TrackDensityField.Seven: sb.AppendLine("Track size is 0,74 μm"); @@ -1581,13 +1581,13 @@ namespace DiscImageChef.Decoders.DVD break; } - if (decoded.DataAreaStartPSN > 0) + if(decoded.DataAreaStartPSN > 0) { - if (decoded.DataAreaEndPSN > 0) + if(decoded.DataAreaEndPSN > 0) { sb.AppendFormat("Data area starts at PSN {0:X}h", decoded.DataAreaStartPSN).AppendLine(); sb.AppendFormat("Data area ends at PSN {0:X}h", decoded.DataAreaEndPSN).AppendLine(); - if (decoded.Layers == 1 && !decoded.TrackPath) + if(decoded.Layers == 1 && !decoded.TrackPath) sb.AppendFormat("Layer 0 ends at PSN {0:X}h", decoded.Layer0EndPSN).AppendLine(); } else @@ -1596,15 +1596,15 @@ namespace DiscImageChef.Decoders.DVD else sb.AppendLine("Disc is empty"); - if (decoded.BCA) + if(decoded.BCA) sb.AppendLine("Disc has a burst cutting area"); - if (decoded.DiskCategory == DiskCategory.UMD) + if(decoded.DiskCategory == DiskCategory.UMD) sb.AppendFormat("Media attribute is {0}", decoded.MediaAttribute).AppendLine(); - if (decoded.DiskCategory == DiskCategory.DVDRAM) + if(decoded.DiskCategory == DiskCategory.DVDRAM) { - switch (decoded.DiscType) + switch(decoded.DiscType) { case DVDRAMDiscType.Cased: sb.AppendLine("Disc shall be recorded with a case"); @@ -1617,15 +1617,15 @@ namespace DiscImageChef.Decoders.DVD break; } - if (decoded.PartVersion == 6) + if(decoded.PartVersion == 6) { sb.AppendFormat("Disc manufacturer is {0}", decoded.DiskManufacturer).AppendLine(); sb.AppendFormat("Disc manufacturer supplementary information is {0}", decoded.DiskManufacturerSupplementary).AppendLine(); } } - if ((decoded.DiskCategory == DiskCategory.DVDR && - decoded.PartVersion < 6) || + if((decoded.DiskCategory == DiskCategory.DVDR && + decoded.PartVersion < 6) || (decoded.DiskCategory == DiskCategory.DVDRW && decoded.PartVersion < 3)) { @@ -1633,12 +1633,12 @@ namespace DiscImageChef.Decoders.DVD sb.AppendFormat("Next Border-In first sector is PSN {0:X}h", decoded.NextBorderInSector).AppendLine(); } - if (decoded.DiskCategory == DiskCategory.DVDPR || + if(decoded.DiskCategory == DiskCategory.DVDPR || decoded.DiskCategory == DiskCategory.DVDPRW || decoded.DiskCategory == DiskCategory.DVDPRDL || decoded.DiskCategory == DiskCategory.DVDPRWDL) { - if (decoded.VCPS) + if(decoded.VCPS) sb.AppendLine("Disc contains extended information for VCPS"); sb.AppendFormat("Disc application code is {0}", decoded.ApplicationCode).AppendLine(); sb.AppendFormat("Disc manufacturer is {0}", decoded.DiskManufacturerID).AppendLine(); @@ -1646,18 +1646,18 @@ namespace DiscImageChef.Decoders.DVD sb.AppendFormat("Disc product revision is {0}", decoded.ProductRevision).AppendLine(); } - if ((decoded.DiskCategory == DiskCategory.DVDR && - decoded.PartVersion >= 6) || + if((decoded.DiskCategory == DiskCategory.DVDR && + decoded.PartVersion >= 6) || (decoded.DiskCategory == DiskCategory.DVDRW && decoded.PartVersion >= 3)) { sb.AppendFormat("Current RMD in extra Border zone starts at PSN {0:X}h", decoded.CurrentRMDExtraBorderPSN).AppendLine(); sb.AppendFormat("PFI in extra Border zone starts at PSN {0:X}h", decoded.PFIExtraBorderPSN).AppendLine(); - if (!decoded.PreRecordedControlDataInv) + if(!decoded.PreRecordedControlDataInv) sb.AppendLine("Control Data Zone is pre-recorded"); - if (decoded.PreRecordedLeadIn) + if(decoded.PreRecordedLeadIn) sb.AppendLine("Lead-In is pre-recorded"); - if (decoded.PreRecordedLeadOut) + if(decoded.PreRecordedLeadOut) sb.AppendLine("Lead-Out is pre-recorded"); } diff --git a/DiscImageChef.Decoders/DVD/Spare.cs b/DiscImageChef.Decoders/DVD/Spare.cs index a0fe3b860..101fe09ea 100644 --- a/DiscImageChef.Decoders/DVD/Spare.cs +++ b/DiscImageChef.Decoders/DVD/Spare.cs @@ -93,10 +93,10 @@ namespace DiscImageChef.Decoders.DVD public static SpareAreaInformation? Decode(byte[] response) { - if (response == null) + if(response == null) return null; - if (response.Length != 16) + if(response.Length != 16) return null; SpareAreaInformation sai = new SpareAreaInformation(); @@ -113,7 +113,7 @@ namespace DiscImageChef.Decoders.DVD public static string Prettify(SpareAreaInformation? sai) { - if (sai == null) + if(sai == null) return null; SpareAreaInformation decoded = sai.Value; diff --git a/DiscImageChef.Decoders/SCSI/DiscStructureCapabilities.cs b/DiscImageChef.Decoders/SCSI/DiscStructureCapabilities.cs index e7824b412..013c214b0 100644 --- a/DiscImageChef.Decoders/SCSI/DiscStructureCapabilities.cs +++ b/DiscImageChef.Decoders/SCSI/DiscStructureCapabilities.cs @@ -62,14 +62,14 @@ namespace DiscImageChef.Decoders.SCSI { ushort len = (ushort)((response[0] << 8) + response[1]); - if (len + 2 != response.Length) + if(len + 2 != response.Length) return null; List caps = new List(); uint offset = 4; - while (offset < response.Length) + while(offset < response.Length) { Capability cap = new Capability(); cap.FormatCode = response[offset]; diff --git a/DiscImageChef.Decoders/SCSI/EVPD.cs b/DiscImageChef.Decoders/SCSI/EVPD.cs index aec85cb24..28bd0120d 100644 --- a/DiscImageChef.Decoders/SCSI/EVPD.cs +++ b/DiscImageChef.Decoders/SCSI/EVPD.cs @@ -49,13 +49,13 @@ namespace DiscImageChef.Decoders.SCSI /// Page 0x00. public static byte[] DecodePage00(byte[] page) { - if (page == null) - return null; - - if (page[1] != 0) + if(page == null) return null; - if (page.Length != page[3] + 4) + if(page[1] != 0) + return null; + + if(page.Length != page[3] + 4) return null; byte[] decoded = new byte[page.Length - 4]; @@ -72,13 +72,13 @@ namespace DiscImageChef.Decoders.SCSI /// Page 0x01-0x7F. public static string DecodeASCIIPage(byte[] page) { - if (page == null) + if(page == null) return null; - if (page[1] == 0 || page[1] > 0x7F) + if(page[1] == 0 || page[1] > 0x7F) return null; - if (page.Length != page[3] + 4) + if(page.Length != page[3] + 4) return null; byte[] ascii = new byte[page[4]]; @@ -95,13 +95,13 @@ namespace DiscImageChef.Decoders.SCSI /// Page 0x80. public static string DecodePage80(byte[] page) { - if (page == null) + if(page == null) return null; - if (page[1] != 0x80) + if(page[1] != 0x80) return null; - if (page.Length != page[3] + 4) + if(page.Length != page[3] + 4) return null; byte[] ascii = new byte[page.Length - 4]; diff --git a/DiscImageChef.Decoders/SCSI/Inquiry.cs b/DiscImageChef.Decoders/SCSI/Inquiry.cs index 096c77720..d4af6b058 100644 --- a/DiscImageChef.Decoders/SCSI/Inquiry.cs +++ b/DiscImageChef.Decoders/SCSI/Inquiry.cs @@ -58,16 +58,16 @@ namespace DiscImageChef.Decoders.SCSI public static SCSIInquiry? Decode(byte[] SCSIInquiryResponse) { - if (SCSIInquiryResponse == null) + if(SCSIInquiryResponse == null) return null; - if (SCSIInquiryResponse.Length < 36 && SCSIInquiryResponse.Length != 5) + if(SCSIInquiryResponse.Length < 36 && SCSIInquiryResponse.Length != 5) { DicConsole.DebugWriteLine("SCSI INQUIRY decoder", "INQUIRY response is {0} bytes, less than minimum of 36 bytes, decoded data can be incorrect, not decoding.", SCSIInquiryResponse.Length); return null; } - if (SCSIInquiryResponse.Length != SCSIInquiryResponse[4] + 5) + if(SCSIInquiryResponse.Length != SCSIInquiryResponse[4] + 5) { DicConsole.DebugWriteLine("SCSI INQUIRY decoder", "INQUIRY response length ({0} bytes) is different than specified in length field ({1} bytes), decoded data can be incorrect, not decoding.", SCSIInquiryResponse.Length, SCSIInquiryResponse[4] + 4); return null; @@ -75,23 +75,23 @@ namespace DiscImageChef.Decoders.SCSI SCSIInquiry decoded = new SCSIInquiry(); - if (SCSIInquiryResponse.Length >= 1) + if(SCSIInquiryResponse.Length >= 1) { decoded.PeripheralQualifier = (byte)((SCSIInquiryResponse[0] & 0xE0) >> 5); decoded.PeripheralDeviceType = (byte)(SCSIInquiryResponse[0] & 0x1F); } - if (SCSIInquiryResponse.Length >= 2) + if(SCSIInquiryResponse.Length >= 2) { decoded.RMB = Convert.ToBoolean((SCSIInquiryResponse[1] & 0x80)); decoded.DeviceTypeModifier = (byte)(SCSIInquiryResponse[1] & 0x7F); } - if (SCSIInquiryResponse.Length >= 3) + if(SCSIInquiryResponse.Length >= 3) { decoded.ISOVersion = (byte)((SCSIInquiryResponse[2] & 0xC0) >> 6); decoded.ECMAVersion = (byte)((SCSIInquiryResponse[2] & 0x38) >> 3); decoded.ANSIVersion = (byte)(SCSIInquiryResponse[2] & 0x07); } - if (SCSIInquiryResponse.Length >= 4) + if(SCSIInquiryResponse.Length >= 4) { decoded.AERC = Convert.ToBoolean((SCSIInquiryResponse[3] & 0x80)); decoded.TrmTsk = Convert.ToBoolean((SCSIInquiryResponse[3] & 0x40)); @@ -99,9 +99,9 @@ namespace DiscImageChef.Decoders.SCSI decoded.HiSup = Convert.ToBoolean((SCSIInquiryResponse[3] & 0x10)); decoded.ResponseDataFormat = (byte)(SCSIInquiryResponse[3] & 0x07); } - if (SCSIInquiryResponse.Length >= 5) + if(SCSIInquiryResponse.Length >= 5) decoded.AdditionalLength = SCSIInquiryResponse[4]; - if (SCSIInquiryResponse.Length >= 6) + if(SCSIInquiryResponse.Length >= 6) { decoded.SCCS = Convert.ToBoolean((SCSIInquiryResponse[5] & 0x80)); decoded.ACC = Convert.ToBoolean((SCSIInquiryResponse[5] & 0x40)); @@ -110,7 +110,7 @@ namespace DiscImageChef.Decoders.SCSI decoded.Reserved2 = (byte)((SCSIInquiryResponse[5] & 0x06) >> 1); decoded.Protect = Convert.ToBoolean((SCSIInquiryResponse[5] & 0x01)); } - if (SCSIInquiryResponse.Length >= 7) + if(SCSIInquiryResponse.Length >= 7) { decoded.BQue = Convert.ToBoolean((SCSIInquiryResponse[6] & 0x80)); decoded.EncServ = Convert.ToBoolean((SCSIInquiryResponse[6] & 0x40)); @@ -121,7 +121,7 @@ namespace DiscImageChef.Decoders.SCSI decoded.Addr32 = Convert.ToBoolean((SCSIInquiryResponse[6] & 0x02)); decoded.Addr16 = Convert.ToBoolean((SCSIInquiryResponse[6] & 0x01)); } - if (SCSIInquiryResponse.Length >= 8) + if(SCSIInquiryResponse.Length >= 8) { decoded.RelAddr = Convert.ToBoolean((SCSIInquiryResponse[7] & 0x80)); decoded.WBus32 = Convert.ToBoolean((SCSIInquiryResponse[7] & 0x40)); @@ -132,61 +132,61 @@ namespace DiscImageChef.Decoders.SCSI decoded.CmdQue = Convert.ToBoolean((SCSIInquiryResponse[7] & 0x02)); decoded.SftRe = Convert.ToBoolean((SCSIInquiryResponse[7] & 0x01)); } - if (SCSIInquiryResponse.Length >= 16) + if(SCSIInquiryResponse.Length >= 16) { decoded.VendorIdentification = new byte[8]; Array.Copy(SCSIInquiryResponse, 8, decoded.VendorIdentification, 0, 8); } - if (SCSIInquiryResponse.Length >= 32) + if(SCSIInquiryResponse.Length >= 32) { decoded.ProductIdentification = new byte[16]; Array.Copy(SCSIInquiryResponse, 16, decoded.ProductIdentification, 0, 16); } - if (SCSIInquiryResponse.Length >= 36) + if(SCSIInquiryResponse.Length >= 36) { decoded.ProductRevisionLevel = new byte[4]; Array.Copy(SCSIInquiryResponse, 32, decoded.ProductRevisionLevel, 0, 4); } - if (SCSIInquiryResponse.Length >= 56) + if(SCSIInquiryResponse.Length >= 56) { decoded.VendorSpecific = new byte[20]; Array.Copy(SCSIInquiryResponse, 36, decoded.VendorSpecific, 0, 20); } - if (SCSIInquiryResponse.Length >= 57) + if(SCSIInquiryResponse.Length >= 57) { decoded.Reserved3 = (byte)((SCSIInquiryResponse[56] & 0xF0) >> 4); decoded.Clocking = (byte)((SCSIInquiryResponse[56] & 0x0C) >> 2); decoded.QAS = Convert.ToBoolean((SCSIInquiryResponse[56] & 0x02)); decoded.IUS = Convert.ToBoolean((SCSIInquiryResponse[56] & 0x01)); } - if (SCSIInquiryResponse.Length >= 58) + if(SCSIInquiryResponse.Length >= 58) decoded.Reserved4 = SCSIInquiryResponse[57]; - if (SCSIInquiryResponse.Length >= 60) + if(SCSIInquiryResponse.Length >= 60) { int descriptorsNo; - if (SCSIInquiryResponse.Length >= 74) + if(SCSIInquiryResponse.Length >= 74) descriptorsNo = 8; else descriptorsNo = (SCSIInquiryResponse.Length - 58) / 2; - + decoded.VersionDescriptors = new ushort[descriptorsNo]; - for (int i = 0; i < descriptorsNo; i++) + for(int i = 0; i < descriptorsNo; i++) { decoded.VersionDescriptors[i] = BitConverter.ToUInt16(SCSIInquiryResponse, 58 + (i * 2)); } } - if (SCSIInquiryResponse.Length >= 75 && SCSIInquiryResponse.Length < 96) + if(SCSIInquiryResponse.Length >= 75 && SCSIInquiryResponse.Length < 96) { decoded.Reserved5 = new byte[SCSIInquiryResponse.Length - 74]; Array.Copy(SCSIInquiryResponse, 74, decoded.Reserved5, 0, SCSIInquiryResponse.Length - 74); } - if (SCSIInquiryResponse.Length >= 96) + if(SCSIInquiryResponse.Length >= 96) { decoded.Reserved5 = new byte[22]; Array.Copy(SCSIInquiryResponse, 74, decoded.Reserved5, 0, 22); } - if (SCSIInquiryResponse.Length > 96) + if(SCSIInquiryResponse.Length > 96) { decoded.VendorSpecific2 = new byte[SCSIInquiryResponse.Length - 96]; Array.Copy(SCSIInquiryResponse, 96, decoded.VendorSpecific2, 0, SCSIInquiryResponse.Length - 96); @@ -197,7 +197,7 @@ namespace DiscImageChef.Decoders.SCSI public static string Prettify(SCSIInquiry? SCSIInquiryResponse) { - if (SCSIInquiryResponse == null) + if(SCSIInquiryResponse == null) return null; SCSIInquiry response = SCSIInquiryResponse.Value; @@ -207,7 +207,7 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendFormat("Device vendor: {0}", VendorString.Prettify(StringHandlers.CToString(response.VendorIdentification).Trim())).AppendLine(); sb.AppendFormat("Device name: {0}", StringHandlers.CToString(response.ProductIdentification).Trim()).AppendLine(); sb.AppendFormat("Device release level: {0}", StringHandlers.CToString(response.ProductRevisionLevel).Trim()).AppendLine(); - switch ((PeripheralQualifiers)response.PeripheralQualifier) + switch((PeripheralQualifiers)response.PeripheralQualifier) { case PeripheralQualifiers.Supported: sb.AppendLine("Device is connected and supported."); @@ -226,7 +226,7 @@ namespace DiscImageChef.Decoders.SCSI break; } - switch ((PeripheralDeviceTypes)response.PeripheralDeviceType) + switch((PeripheralDeviceTypes)response.PeripheralDeviceType) { case PeripheralDeviceTypes.DirectAccess: //0x00, sb.AppendLine("Direct-access device"); @@ -302,7 +302,7 @@ namespace DiscImageChef.Decoders.SCSI break; } - switch ((ANSIVersions)response.ANSIVersion) + switch((ANSIVersions)response.ANSIVersion) { case ANSIVersions.ANSINoVersion: sb.AppendLine("Device does not claim to comply with any SCSI ANSI standard"); @@ -330,7 +330,7 @@ namespace DiscImageChef.Decoders.SCSI break; } - switch ((ECMAVersions)response.ECMAVersion) + switch((ECMAVersions)response.ECMAVersion) { case ECMAVersions.ECMANoVersion: sb.AppendLine("Device does not claim to comply with any SCSI ECMA standard"); @@ -343,7 +343,7 @@ namespace DiscImageChef.Decoders.SCSI break; } - switch ((ISOVersions)response.ISOVersion) + switch((ISOVersions)response.ISOVersion) { case ISOVersions.ISONoVersion: sb.AppendLine("Device does not claim to comply with any SCSI ISO/IEC standard"); @@ -356,64 +356,64 @@ namespace DiscImageChef.Decoders.SCSI break; } - if (response.RMB) + if(response.RMB) sb.AppendLine("Device is removable"); - if (response.AERC) + if(response.AERC) sb.AppendLine("Device supports Asynchronous Event Reporting Capability"); - if (response.TrmTsk) + if(response.TrmTsk) sb.AppendLine("Device supports TERMINATE TASK command"); - if (response.NormACA) + if(response.NormACA) sb.AppendLine("Device supports setting Normal ACA"); - if (response.HiSup) + if(response.HiSup) sb.AppendLine("Device supports LUN hierarchical addressing"); - if (response.SCCS) + if(response.SCCS) sb.AppendLine("Device contains an embedded storage array controller"); - if (response.ACC) + if(response.ACC) sb.AppendLine("Device contains an Access Control Coordinator"); - if (response.ThreePC) + if(response.ThreePC) sb.AppendLine("Device supports third-party copy commands"); - if (response.Protect) + if(response.Protect) sb.AppendLine("Device supports protection information"); - if (response.BQue) + if(response.BQue) sb.AppendLine("Device supports basic queueing"); - if (response.EncServ) + if(response.EncServ) sb.AppendLine("Device contains an embedded enclosure services component"); - if (response.MultiP) + if(response.MultiP) sb.AppendLine("Multi-port device"); - if (response.MChngr) + if(response.MChngr) sb.AppendLine("Device contains or is attached to a medium changer"); - if (response.ACKREQQ) + if(response.ACKREQQ) sb.AppendLine("Device supports request and acknowledge handshakes"); - if (response.Addr32) + if(response.Addr32) sb.AppendLine("Device supports 32-bit wide SCSI addresses"); - if (response.Addr16) + if(response.Addr16) sb.AppendLine("Device supports 16-bit wide SCSI addresses"); - if (response.RelAddr) + if(response.RelAddr) sb.AppendLine("Device supports relative addressing"); - if (response.WBus32) + if(response.WBus32) sb.AppendLine("Device supports 32-bit wide data transfers"); - if (response.WBus16) + if(response.WBus16) sb.AppendLine("Device supports 16-bit wide data transfers"); - if (response.Sync) + if(response.Sync) sb.AppendLine("Device supports synchronous data transfer"); - if (response.Linked) + if(response.Linked) sb.AppendLine("Device supports linked commands"); - if (response.TranDis) + if(response.TranDis) sb.AppendLine("Device supports CONTINUE TASK and TARGET TRANSFER DISABLE commands"); - if (response.QAS) + if(response.QAS) sb.AppendLine("Device supports Quick Arbitration and Selection"); - if (response.CmdQue) + if(response.CmdQue) sb.AppendLine("Device supports TCQ queue"); - if (response.IUS) + if(response.IUS) sb.AppendLine("Device supports information unit transfers"); - if (response.SftRe) + if(response.SftRe) sb.AppendLine("Device implements RESET as a soft reset"); - #if DEBUG - if (response.VS1) +#if DEBUG + if(response.VS1) sb.AppendLine("Vendor specific bit 5 on byte 6 of INQUIRY response is set"); - #endif +#endif - switch ((TGPSValues)response.TPGS) + switch((TGPSValues)response.TPGS) { case TGPSValues.NotSupported: sb.AppendLine("Device does not support assymetrical access"); @@ -432,7 +432,7 @@ namespace DiscImageChef.Decoders.SCSI break; } - switch ((SPIClocking)response.Clocking) + switch((SPIClocking)response.Clocking) { case SPIClocking.ST: sb.AppendLine("Device supports only ST clocking"); @@ -451,11 +451,11 @@ namespace DiscImageChef.Decoders.SCSI break; } - if (response.VersionDescriptors != null) + if(response.VersionDescriptors != null) { - foreach (UInt16 VersionDescriptor in response.VersionDescriptors) + foreach(UInt16 VersionDescriptor in response.VersionDescriptors) { - switch (VersionDescriptor) + switch(VersionDescriptor) { case 0xFFFF: case 0x0000: @@ -1871,7 +1871,7 @@ namespace DiscImageChef.Decoders.SCSI } } - #if DEBUG +#if DEBUG if(response.DeviceTypeModifier != 0) sb.AppendFormat("Vendor's device type modifier = 0x{0:X2}", response.DeviceTypeModifier).AppendLine(); if(response.Reserved2 != 0) @@ -1881,7 +1881,7 @@ namespace DiscImageChef.Decoders.SCSI if(response.Reserved4 != 0) sb.AppendFormat("Reserved byte 57 = 0x{0:X2}", response.Reserved4).AppendLine(); - if (response.Reserved5 != null) + if(response.Reserved5 != null) { sb.AppendLine("Reserved bytes 74 to 95"); sb.AppendLine("============================================================"); @@ -1889,7 +1889,7 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("============================================================"); } - if (response.VendorSpecific != null) + if(response.VendorSpecific != null) { sb.AppendLine("Vendor-specific bytes 36 to 55"); sb.AppendLine("============================================================"); @@ -1897,14 +1897,14 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("============================================================"); } - if (response.VendorSpecific2 != null) + if(response.VendorSpecific2 != null) { - sb.AppendFormat("Vendor-specific bytes 96 to {0}", response.AdditionalLength+4).AppendLine(); + sb.AppendFormat("Vendor-specific bytes 96 to {0}", response.AdditionalLength + 4).AppendLine(); sb.AppendLine("============================================================"); sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.VendorSpecific2, 60)); sb.AppendLine("============================================================"); } - #endif +#endif return sb.ToString(); } diff --git a/DiscImageChef.Decoders/SCSI/MMC/AACS.cs b/DiscImageChef.Decoders/SCSI/MMC/AACS.cs index cfe8d38c2..a6d5aa407 100644 --- a/DiscImageChef.Decoders/SCSI/MMC/AACS.cs +++ b/DiscImageChef.Decoders/SCSI/MMC/AACS.cs @@ -223,7 +223,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static AACSVolumeIdentifier? DecodeAACSVolumeIdentifier(byte[] AACSVIResponse) { - if (AACSVIResponse == null) + if(AACSVIResponse == null) return null; AACSVolumeIdentifier decoded = new AACSVolumeIdentifier(); @@ -242,19 +242,19 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string PrettifyAACSVolumeIdentifier(AACSVolumeIdentifier? AACSVIResponse) { - if (AACSVIResponse == null) + if(AACSVIResponse == null) return null; AACSVolumeIdentifier response = AACSVIResponse.Value; StringBuilder sb = new StringBuilder(); - #if DEBUG +#if DEBUG if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine(); if(response.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine(); - #endif +#endif sb.AppendFormat("AACS Volume Identifier in hex follows:"); sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.VolumeIdentifier, 80)); @@ -269,7 +269,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static AACSMediaSerialNumber? DecodeAACSMediaSerialNumber(byte[] AACSMSNResponse) { - if (AACSMSNResponse == null) + if(AACSMSNResponse == null) return null; AACSMediaSerialNumber decoded = new AACSMediaSerialNumber(); @@ -288,19 +288,19 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string PrettifyAACSMediaSerialNumber(AACSMediaSerialNumber? AACSMSNResponse) { - if (AACSMSNResponse == null) + if(AACSMSNResponse == null) return null; AACSMediaSerialNumber response = AACSMSNResponse.Value; StringBuilder sb = new StringBuilder(); - #if DEBUG +#if DEBUG if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine(); if(response.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine(); - #endif +#endif sb.AppendFormat("AACS Media Serial Number in hex follows:"); sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.MediaSerialNumber, 80)); @@ -315,7 +315,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static AACSMediaIdentifier? DecodeAACSMediaIdentifier(byte[] AACSMIResponse) { - if (AACSMIResponse == null) + if(AACSMIResponse == null) return null; AACSMediaIdentifier decoded = new AACSMediaIdentifier(); @@ -334,19 +334,19 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string PrettifyAACSMediaIdentifier(AACSMediaIdentifier? AACSMIResponse) { - if (AACSMIResponse == null) + if(AACSMIResponse == null) return null; AACSMediaIdentifier response = AACSMIResponse.Value; StringBuilder sb = new StringBuilder(); - #if DEBUG +#if DEBUG if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine(); if(response.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine(); - #endif +#endif sb.AppendFormat("AACS Media Identifier in hex follows:"); sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.MediaIdentifier, 80)); @@ -361,7 +361,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static AACSMediaKeyBlock? DecodeAACSMediaKeyBlock(byte[] AACSMKBResponse) { - if (AACSMKBResponse == null) + if(AACSMKBResponse == null) return null; AACSMediaKeyBlock decoded = new AACSMediaKeyBlock(); @@ -380,17 +380,17 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string PrettifyAACSMediaKeyBlock(AACSMediaKeyBlock? AACSMKBResponse) { - if (AACSMKBResponse == null) + if(AACSMKBResponse == null) return null; AACSMediaKeyBlock response = AACSMKBResponse.Value; StringBuilder sb = new StringBuilder(); - #if DEBUG +#if DEBUG if(response.Reserved != 0) sb.AppendFormat("Reserved = 0x{0:X2}", response.Reserved).AppendLine(); - #endif +#endif sb.AppendFormat("Total number of media key blocks available to transfer {0}", response.TotalPacks).AppendLine(); sb.AppendFormat("AACS Media Key Blocks in hex follows:"); sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.MediaKeyBlockPacks, 80)); @@ -406,7 +406,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static AACSDataKeys? DecodeAACSDataKeys(byte[] AACSDKResponse) { - if (AACSDKResponse == null) + if(AACSDKResponse == null) return null; AACSDataKeys decoded = new AACSDataKeys(); @@ -425,19 +425,19 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string PrettifyAACSDataKeys(AACSDataKeys? AACSDKResponse) { - if (AACSDKResponse == null) + if(AACSDKResponse == null) return null; AACSDataKeys response = AACSDKResponse.Value; StringBuilder sb = new StringBuilder(); - #if DEBUG +#if DEBUG if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine(); if(response.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine(); - #endif +#endif sb.AppendFormat("AACS Data Keys in hex follows:"); sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.DataKeys, 80)); @@ -452,7 +452,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static AACSLBAExtentsResponse? DecodeAACSLBAExtents(byte[] AACSLBAExtsResponse) { - if (AACSLBAExtsResponse == null) + if(AACSLBAExtsResponse == null) return null; AACSLBAExtentsResponse decoded = new AACSLBAExtentsResponse(); @@ -463,12 +463,12 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Reserved = AACSLBAExtsResponse[2]; decoded.MaxLBAExtents = AACSLBAExtsResponse[3]; - if ((AACSLBAExtsResponse.Length - 4) % 16 != 0) + if((AACSLBAExtsResponse.Length - 4) % 16 != 0) return decoded; decoded.Extents = new AACSLBAExtent[(AACSLBAExtsResponse.Length - 4) / 16]; - for (int i = 0; i < (AACSLBAExtsResponse.Length - 4) / 16; i++) + for(int i = 0; i < (AACSLBAExtsResponse.Length - 4) / 16; i++) { decoded.Extents[i].Reserved = new byte[8]; Array.Copy(AACSLBAExtsResponse, 0 + i * 16 + 4, decoded.Extents[i].Reserved, 0, 8); @@ -481,16 +481,16 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string PrettifyAACSLBAExtents(AACSLBAExtentsResponse? AACSLBAExtsResponse) { - if (AACSLBAExtsResponse == null) + if(AACSLBAExtsResponse == null) return null; AACSLBAExtentsResponse response = AACSLBAExtsResponse.Value; StringBuilder sb = new StringBuilder(); - if (response.MaxLBAExtents == 0) + if(response.MaxLBAExtents == 0) { - if (response.DataLength > 2) + if(response.DataLength > 2) sb.AppendLine("Drive can store 256 LBA Extents"); else sb.AppendLine("Drive cannot store LBA Extents"); @@ -498,7 +498,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC else sb.AppendFormat("Drive can store {0} LBA Extents", response.MaxLBAExtents).AppendLine(); - for (int i = 0; i < response.Extents.Length; i++) + for(int i = 0; i < response.Extents.Length; i++) sb.AppendFormat("LBA Extent {0} starts at LBA {1} and goes for {2} sectors", i, response.Extents[i].StartLBA, response.Extents[i].LBACount); return sb.ToString(); diff --git a/DiscImageChef.Decoders/SCSI/MMC/CPRM.cs b/DiscImageChef.Decoders/SCSI/MMC/CPRM.cs index 03c561202..95d6be6f3 100644 --- a/DiscImageChef.Decoders/SCSI/MMC/CPRM.cs +++ b/DiscImageChef.Decoders/SCSI/MMC/CPRM.cs @@ -83,7 +83,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static CPRMMediaKeyBlock? DecodeCPRMMediaKeyBlock(byte[] CPRMMKBResponse) { - if (CPRMMKBResponse == null) + if(CPRMMKBResponse == null) return null; CPRMMediaKeyBlock decoded = new CPRMMediaKeyBlock(); @@ -102,17 +102,17 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string PrettifyCPRMMediaKeyBlock(CPRMMediaKeyBlock? CPRMMKBResponse) { - if (CPRMMKBResponse == null) + if(CPRMMKBResponse == null) return null; CPRMMediaKeyBlock response = CPRMMKBResponse.Value; StringBuilder sb = new StringBuilder(); - #if DEBUG +#if DEBUG if(response.Reserved != 0) sb.AppendFormat("Reserved = 0x{0:X2}", response.Reserved).AppendLine(); - #endif +#endif sb.AppendFormat("Total number of CPRM Media Key Blocks available to transfer: {0}", response.TotalPacks).AppendLine(); sb.AppendFormat("CPRM Media Key Blocks in hex follows:"); sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.MKBPackData, 80)); diff --git a/DiscImageChef.Decoders/SCSI/MMC/DiscInformation.cs b/DiscImageChef.Decoders/SCSI/MMC/DiscInformation.cs index 345ef3c41..e0b57bacf 100644 --- a/DiscImageChef.Decoders/SCSI/MMC/DiscInformation.cs +++ b/DiscImageChef.Decoders/SCSI/MMC/DiscInformation.cs @@ -280,16 +280,16 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static StandardDiscInformation? Decode000b(byte[] response) { - if (response.Length < 34) + if(response.Length < 34) return null; - if ((response[2] & 0xE0) != 0) + if((response[2] & 0xE0) != 0) return null; StandardDiscInformation decoded = new StandardDiscInformation(); decoded.DataLength = (ushort)((response[0] << 8) + response[1]); - if ((decoded.DataLength + 2) != response.Length) + if((decoded.DataLength + 2) != response.Length) return null; decoded.DataType = (byte)((response[2] & 0xE0) >> 5); @@ -324,33 +324,33 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.DiscApplicationCode = response[32]; decoded.OPCTablesNumber = response[33]; - if (decoded.OPCTablesNumber > 0 && response.Length == (decoded.OPCTablesNumber * 8) + 34) + if(decoded.OPCTablesNumber > 0 && response.Length == (decoded.OPCTablesNumber * 8) + 34) { decoded.OPCTables = new OPCTable[decoded.OPCTablesNumber]; - for (int i = 0; i < decoded.OPCTablesNumber; i++) + for(int i = 0; i < decoded.OPCTablesNumber; i++) { decoded.OPCTables[i].Speed = (ushort)((response[34 + i * 8 + 0] << 16) + response[34 + i * 8 + 1]); decoded.OPCTables[i].OPCValues = new byte[6]; Array.Copy(response, 34 + i * 8 + 2, decoded.OPCTables[i].OPCValues, 0, 6); } } - + return decoded; } public static string Prettify000b(StandardDiscInformation? information) { - if (!information.HasValue) + if(!information.HasValue) return null; StandardDiscInformation decoded = information.Value; - if (decoded.DataType != 0) + if(decoded.DataType != 0) return null; StringBuilder sb = new StringBuilder(); - switch (decoded.DiscType) + switch(decoded.DiscType) { case 0x00: sb.AppendLine("Disc type declared as CD-DA or CD-ROM"); @@ -369,7 +369,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC break; } - switch (decoded.DiscStatus) + switch(decoded.DiscStatus) { case 0: sb.AppendLine("Disc is empty"); @@ -382,10 +382,10 @@ namespace DiscImageChef.Decoders.SCSI.MMC break; } - if (decoded.Erasable) + if(decoded.Erasable) sb.AppendLine("Disc is erasable"); - switch (decoded.LastSessionStatus) + switch(decoded.LastSessionStatus) { case 0: sb.AppendLine("Last session is empty"); @@ -401,7 +401,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC break; } - switch (decoded.BGFormatStatus) + switch(decoded.BGFormatStatus) { case 1: sb.AppendLine("Media was being formatted in the background but it is stopped and incomplete"); @@ -414,37 +414,37 @@ namespace DiscImageChef.Decoders.SCSI.MMC break; } - if (decoded.Dbit) + if(decoded.Dbit) sb.AppendLine("MRW is dirty"); sb.AppendFormat("First track on disc is track {0}", decoded.FirstTrackNumber).AppendLine(); sb.AppendFormat("Disc has {0} sessions", decoded.Sessions).AppendLine(); sb.AppendFormat("First track in last session is track {0}", decoded.FirstTrackLastSession).AppendLine(); sb.AppendFormat("Last track in last session is track {0}", decoded.LastTrackLastSession).AppendLine(); - sb.AppendFormat("Last session Lead-In address is {0} (as LBA) or {1:X2}:{2:X2}:{3:X2}", decoded.LastSessionLeadInStartLBA, + sb.AppendFormat("Last session Lead-In address is {0} (as LBA) or {1:X2}:{2:X2}:{3:X2}", decoded.LastSessionLeadInStartLBA, (decoded.LastSessionLeadInStartLBA & 0xFF0000) >> 16, (decoded.LastSessionLeadInStartLBA & 0xFF00) >> 8, (decoded.LastSessionLeadInStartLBA & 0xFF)).AppendLine(); - sb.AppendFormat("Last possible Lead-Out address is {0} (as LBA) or {1:X2}:{2:X2}:{3:X2}", decoded.LastPossibleLeadOutStartLBA, + sb.AppendFormat("Last possible Lead-Out address is {0} (as LBA) or {1:X2}:{2:X2}:{3:X2}", decoded.LastPossibleLeadOutStartLBA, (decoded.LastPossibleLeadOutStartLBA & 0xFF0000) >> 16, (decoded.LastPossibleLeadOutStartLBA & 0xFF00) >> 8, (decoded.LastPossibleLeadOutStartLBA & 0xFF)).AppendLine(); - if (decoded.URU) + if(decoded.URU) sb.AppendLine("Disc is defined for unrestricted use"); else sb.AppendLine("Disc is defined for restricted use"); - if (decoded.DID_V) + if(decoded.DID_V) sb.AppendFormat("Disc ID: {0:X6}", decoded.DiscIdentification & 0x00FFFFFF).AppendLine(); - if (decoded.DBC_V) + if(decoded.DBC_V) sb.AppendFormat("Disc barcode: {0:X16}", decoded.DiscBarcode).AppendLine(); - if (decoded.DAC_V) + if(decoded.DAC_V) sb.AppendFormat("Disc application code: {0}", decoded.DiscApplicationCode).AppendLine(); - if (decoded.OPCTables != null) + if(decoded.OPCTables != null) { - foreach (OPCTable table in decoded.OPCTables) + foreach(OPCTable table in decoded.OPCTables) { sb.AppendFormat("OPC values for {0}Kbit/sec.: {1}, {2}, {3}, {4}, {5}, {6}", table.Speed, table.OPCValues[0], table.OPCValues[1], table.OPCValues[2], @@ -457,16 +457,16 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static TrackResourcesInformation? Decode001b(byte[] response) { - if (response.Length != 12) + if(response.Length != 12) return null; - if ((response[2] & 0xE0) != 0x20) + if((response[2] & 0xE0) != 0x20) return null; TrackResourcesInformation decoded = new TrackResourcesInformation(); decoded.DataLength = (ushort)((response[0] << 8) + response[1]); - if ((decoded.DataLength + 2) != response.Length) + if((decoded.DataLength + 2) != response.Length) return null; decoded.DataType = (byte)((response[2] & 0xE0) >> 5); @@ -480,12 +480,12 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify001b(TrackResourcesInformation? information) { - if (!information.HasValue) + if(!information.HasValue) return null; TrackResourcesInformation decoded = information.Value; - if (decoded.DataType != 1) + if(decoded.DataType != 1) return null; StringBuilder sb = new StringBuilder(); @@ -500,16 +500,16 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static POWResourcesInformation? Decode010b(byte[] response) { - if (response.Length != 16) + if(response.Length != 16) return null; - if ((response[2] & 0xE0) != 0x40) + if((response[2] & 0xE0) != 0x40) return null; POWResourcesInformation decoded = new POWResourcesInformation(); decoded.DataLength = (ushort)((response[0] << 8) + response[1]); - if ((decoded.DataLength + 2) != response.Length) + if((decoded.DataLength + 2) != response.Length) return null; decoded.DataType = (byte)((response[2] & 0xE0) >> 5); @@ -522,12 +522,12 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify010b(POWResourcesInformation? information) { - if (!information.HasValue) + if(!information.HasValue) return null; POWResourcesInformation decoded = information.Value; - if (decoded.DataType != 1) + if(decoded.DataType != 1) return null; StringBuilder sb = new StringBuilder(); @@ -541,13 +541,13 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify(byte[] response) { - if (response == null) + if(response == null) return null; - if (response.Length < 12) + if(response.Length < 12) return null; - switch (response[2] & 0xE0) + switch(response[2] & 0xE0) { case 0x00: return Prettify000b(Decode000b(response)); diff --git a/DiscImageChef.Decoders/SCSI/MMC/Features.cs b/DiscImageChef.Decoders/SCSI/MMC/Features.cs index 27a4fc2cb..281acbe7b 100644 --- a/DiscImageChef.Decoders/SCSI/MMC/Features.cs +++ b/DiscImageChef.Decoders/SCSI/MMC/Features.cs @@ -2158,18 +2158,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC { public static Feature_0000? Decode_0000(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 4) + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0000) + if(number != 0x0000) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0000 decoded = new Feature_0000(); @@ -2180,7 +2180,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC int offset = 4; List listProfiles = new List(); - while (offset < feature.Length) + while(offset < feature.Length) { Profile prof = new Profile(); prof.Number = (ProfileNumber)((feature[offset] << 8) + feature[offset + 1]); @@ -2195,18 +2195,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0001? Decode_0001(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 8) + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0001) + if(number != 0x0001) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0001 decoded = new Feature_0001(); @@ -2215,13 +2215,13 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 0) + if(decoded.Version >= 0) decoded.PhysicalInterfaceStandard = (PhysicalInterfaces)((feature[4] << 24) + (feature[5] << 16) + (feature[6] << 8) + feature[7]); - if (decoded.Version >= 1 && feature.Length >= 12) + if(decoded.Version >= 1 && feature.Length >= 12) decoded.DBE |= (feature[8] & 0x01) == 0x01; - if (decoded.Version >= 2 && feature.Length >= 12) + if(decoded.Version >= 2 && feature.Length >= 12) decoded.INQ2 |= (feature[8] & 0x02) == 0x02; return decoded; @@ -2229,18 +2229,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0002? Decode_0002(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 8) + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0002) + if(number != 0x0002) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0002 decoded = new Feature_0002(); @@ -2249,10 +2249,10 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 0) + if(decoded.Version >= 0) decoded.Async |= (feature[4] & 0x01) == 0x01; - if (decoded.Version >= 1) + if(decoded.Version >= 1) decoded.OCEvent |= (feature[4] & 0x02) == 0x02; return decoded; @@ -2260,18 +2260,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0003? Decode_0003(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 8) + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0003) + if(number != 0x0003) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0003 decoded = new Feature_0003(); @@ -2280,7 +2280,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 0) + if(decoded.Version >= 0) { decoded.LoadingMechanismType = (byte)((feature[4] & 0xE0) >> 5); decoded.Eject |= (feature[4] & 0x08) == 0x08; @@ -2288,7 +2288,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Lock |= (feature[4] & 0x01) == 0x01; } - if (decoded.Version >= 2) + if(decoded.Version >= 2) { decoded.Load |= (feature[4] & 0x10) == 0x10; decoded.DBML |= (feature[4] & 0x02) == 0x02; @@ -2299,18 +2299,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0004? Decode_0004(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 8) + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0004) + if(number != 0x0004) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0004 decoded = new Feature_0004(); @@ -2319,16 +2319,16 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 0) + if(decoded.Version >= 0) { decoded.SPWP |= (feature[4] & 0x02) == 0x02; decoded.SSWPP |= (feature[4] & 0x01) == 0x01; } - if (decoded.Version >= 1) + if(decoded.Version >= 1) decoded.WDCB |= (feature[4] & 0x04) == 0x04; - if (decoded.Version >= 2) + if(decoded.Version >= 2) decoded.DWP |= (feature[4] & 0x08) == 0x08; return decoded; @@ -2336,18 +2336,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0010? Decode_0010(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 12) + if(feature.Length < 12) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0010) + if(number != 0x0010) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0010 decoded = new Feature_0010(); @@ -2356,7 +2356,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 0) + if(decoded.Version >= 0) { decoded.LogicalBlockSize = (uint)((feature[4] << 24) + (feature[5] << 16) + (feature[6] << 8) + feature[7]); decoded.Blocking = (ushort)((feature[8] << 8) + feature[9]); @@ -2368,18 +2368,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_001D? Decode_001D(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 4) + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x001D) + if(number != 0x001D) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_001D decoded = new Feature_001D(); @@ -2393,18 +2393,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_001E? Decode_001E(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 8) + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x001E) + if(number != 0x001E) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_001E decoded = new Feature_001E(); @@ -2413,13 +2413,13 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 1) + if(decoded.Version >= 1) { decoded.C2 |= (feature[4] & 0x02) == 0x02; decoded.CDText |= (feature[4] & 0x01) == 0x01; } - if (decoded.Version >= 2) + if(decoded.Version >= 2) decoded.DAP |= (feature[4] & 0x80) == 0x80; return decoded; @@ -2427,18 +2427,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_001F? Decode_001F(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 4) + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x001F) + if(number != 0x001F) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_001F decoded = new Feature_001F(); @@ -2447,13 +2447,13 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 2 && feature.Length >= 8) + if(decoded.Version >= 2 && feature.Length >= 8) { decoded.MULTI110 |= (feature[4] & 0x01) == 0x01; decoded.DualR |= (feature[6] & 0x01) == 0x01; } - if (decoded.Version >= 2 && feature.Length >= 8) + if(decoded.Version >= 2 && feature.Length >= 8) decoded.DualRW |= (feature[6] & 0x02) == 0x02; return decoded; @@ -2461,18 +2461,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0020? Decode_0020(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 16) + if(feature.Length < 16) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0020) + if(number != 0x0020) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0020 decoded = new Feature_0020(); @@ -2481,7 +2481,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 1) + if(decoded.Version >= 1) { decoded.LastLBA = (uint)((feature[4] << 24) + (feature[5] << 16) + (feature[6] << 8) + feature[7]); decoded.LogicalBlockSize = (uint)((feature[8] << 24) + (feature[9] << 16) + (feature[10] << 8) + feature[11]); @@ -2494,18 +2494,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0021? Decode_0021(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 8) + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0021) + if(number != 0x0021) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0021 decoded = new Feature_0021(); @@ -2514,16 +2514,16 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 1) + if(decoded.Version >= 1) { decoded.DataTypeSupported = (ushort)((feature[4] << 8) + feature[5]); decoded.BUF |= (feature[6] & 0x01) == 0x01; decoded.LinkSizes = new byte[feature[7]]; - if (feature.Length > (feature[7] + 8)) + if(feature.Length > (feature[7] + 8)) Array.Copy(feature, 8, decoded.LinkSizes, 0, feature[7]); } - if (decoded.Version >= 3) + if(decoded.Version >= 3) { decoded.TRIO |= (feature[6] & 0x04) == 0x04; decoded.ARSV |= (feature[6] & 0x02) == 0x02; @@ -2534,18 +2534,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0022? Decode_0022(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 4) + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0022) + if(number != 0x0022) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0022 decoded = new Feature_0022(); @@ -2559,18 +2559,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0023? Decode_0023(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 4) + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0023) + if(number != 0x0023) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0023 decoded = new Feature_0023(); @@ -2579,7 +2579,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 1 && feature.Length >= 12) + if(decoded.Version >= 1 && feature.Length >= 12) { decoded.RENoSA |= (feature[4] & 0x08) == 0x08; decoded.Expand |= (feature[4] & 0x04) == 0x04; @@ -2588,7 +2588,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.RRM |= (feature[8] & 0x01) == 0x01; } - if (decoded.Version >= 2 && feature.Length >= 12) + if(decoded.Version >= 2 && feature.Length >= 12) decoded.FRF |= (feature[4] & 0x80) == 0x80; return decoded; @@ -2596,18 +2596,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0024? Decode_0024(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 4) + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0024) + if(number != 0x0024) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0024 decoded = new Feature_0024(); @@ -2616,7 +2616,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 1 && feature.Length >= 8) + if(decoded.Version >= 1 && feature.Length >= 8) decoded.SSA |= (feature[4] & 0x80) == 0x80; return decoded; @@ -2624,18 +2624,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0025? Decode_0025(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 12) + if(feature.Length < 12) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0025) + if(number != 0x0025) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0025 decoded = new Feature_0025(); @@ -2644,7 +2644,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 0) + if(decoded.Version >= 0) { decoded.LogicalBlockSize = (uint)((feature[4] << 24) + (feature[5] << 16) + (feature[6] << 8) + feature[7]); decoded.Blocking = (ushort)((feature[8] << 8) + feature[9]); @@ -2656,18 +2656,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0026? Decode_0026(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 4) + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0026) + if(number != 0x0026) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0026 decoded = new Feature_0026(); @@ -2681,18 +2681,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0027? Decode_0027(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 8) + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0027) + if(number != 0x0027) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0027 decoded = new Feature_0027(); @@ -2706,18 +2706,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0028? Decode_0028(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 8) + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0028) + if(number != 0x0028) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0028 decoded = new Feature_0028(); @@ -2726,10 +2726,10 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 0) + if(decoded.Version >= 0) decoded.Write |= (feature[4] & 0x01) == 0x01; - if (decoded.Version >= 1) + if(decoded.Version >= 1) { decoded.DVDPWrite |= (feature[4] & 0x04) == 0x04; decoded.DVDPRead |= (feature[4] & 0x02) == 0x02; @@ -2740,18 +2740,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0029? Decode_0029(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 8) + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0029) + if(number != 0x0029) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0029 decoded = new Feature_0029(); @@ -2760,7 +2760,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 0) + if(decoded.Version >= 0) { decoded.DRTDM |= (feature[4] & 0x01) == 0x01; decoded.DBICacheZones = feature[5]; @@ -2772,18 +2772,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_002A? Decode_002A(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 8) + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x002A) + if(number != 0x002A) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_002A decoded = new Feature_002A(); @@ -2792,13 +2792,13 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 0) + if(decoded.Version >= 0) { decoded.Write |= (feature[4] & 0x01) == 0x01; decoded.CloseOnly |= (feature[5] & 0x01) == 0x01; } - if (decoded.Version >= 1) + if(decoded.Version >= 1) decoded.QuickStart |= (feature[5] & 0x02) == 0x02; return decoded; @@ -2806,18 +2806,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_002B? Decode_002B(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 8) + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x002B) + if(number != 0x002B) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_002B decoded = new Feature_002B(); @@ -2826,7 +2826,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 0) + if(decoded.Version >= 0) decoded.Write |= (feature[4] & 0x01) == 0x01; return decoded; @@ -2834,18 +2834,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_002C? Decode_002C(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 8) + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x002C) + if(number != 0x002C) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_002C decoded = new Feature_002C(); @@ -2854,7 +2854,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 0) + if(decoded.Version >= 0) { decoded.DSDG |= (feature[4] & 0x08) == 0x08; decoded.DSDR |= (feature[4] & 0x04) == 0x04; @@ -2867,18 +2867,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_002D? Decode_002D(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 8) + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x002D) + if(number != 0x002D) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_002D decoded = new Feature_002D(); @@ -2887,7 +2887,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 0) + if(decoded.Version >= 0) { decoded.TestWrite |= (feature[4] & 0x04) == 0x04; decoded.CDRW |= (feature[4] & 0x02) == 0x02; @@ -2895,7 +2895,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.DataTypeSupported = (ushort)((feature[6] << 8) + feature[7]); } - if (decoded.Version >= 2) + if(decoded.Version >= 2) { decoded.BUF |= (feature[4] & 0x40) == 0x40; decoded.RWRaw |= (feature[4] & 0x10) == 0x10; @@ -2907,18 +2907,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_002E? Decode_002E(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 8) + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x002E) + if(number != 0x002E) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_002E decoded = new Feature_002E(); @@ -2927,7 +2927,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 0) + if(decoded.Version >= 0) { decoded.SAO |= (feature[4] & 0x20) == 0x20; decoded.RAWMS |= (feature[4] & 0x10) == 0x10; @@ -2938,7 +2938,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.MaxCueSheet = (uint)((feature[5] << 16) + (feature[6] << 8) + feature[7]); } - if (decoded.Version >= 1) + if(decoded.Version >= 1) decoded.BUF |= (feature[4] & 0x40) == 0x40; return decoded; @@ -2946,18 +2946,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_002F? Decode_002F(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 8) + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x002F) + if(number != 0x002F) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_002F decoded = new Feature_002F(); @@ -2966,16 +2966,16 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 0) + if(decoded.Version >= 0) { decoded.BUF |= (feature[4] & 0x40) == 0x40; decoded.TestWrite |= (feature[4] & 0x04) == 0x04; } - if (decoded.Version >= 1) + if(decoded.Version >= 1) decoded.DVDRW |= (feature[4] & 0x02) == 0x02; - if (decoded.Version >= 2) + if(decoded.Version >= 2) decoded.RDL |= (feature[4] & 0x08) == 0x08; return decoded; @@ -2983,18 +2983,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0030? Decode_0030(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 4) + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0030) + if(number != 0x0030) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0030 decoded = new Feature_0030(); @@ -3008,18 +3008,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0031? Decode_0031(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 8) + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0031) + if(number != 0x0031) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0031 decoded = new Feature_0031(); @@ -3028,7 +3028,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 0) + if(decoded.Version >= 0) decoded.TestWrite |= (feature[4] & 0x04) == 0x04; return decoded; @@ -3036,18 +3036,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0032? Decode_0032(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 8) + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0032) + if(number != 0x0032) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0032 decoded = new Feature_0032(); @@ -3056,7 +3056,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 0) + if(decoded.Version >= 0) { decoded.Intermediate |= (feature[4] & 0x02) == 0x02; decoded.Blank |= (feature[4] & 0x01) == 0x01; @@ -3067,18 +3067,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0033? Decode_0033(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 8) + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0033) + if(number != 0x0033) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0033 decoded = new Feature_0033(); @@ -3087,7 +3087,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (feature[7] > 0 && feature.Length > (feature[7] + 8)) + if(feature[7] > 0 && feature.Length > (feature[7] + 8)) { decoded.LinkSizes = new byte[feature[7]]; Array.Copy(feature, 8, decoded.LinkSizes, 0, feature[7]); @@ -3098,18 +3098,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0035? Decode_0035(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 4) + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0035) + if(number != 0x0035) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0035 decoded = new Feature_0035(); @@ -3123,18 +3123,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0037? Decode_0037(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 8) + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0037) + if(number != 0x0037) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0037 decoded = new Feature_0037(); @@ -3143,7 +3143,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 0) + if(decoded.Version >= 0) decoded.SubtypeSupport = feature[5]; return decoded; @@ -3151,18 +3151,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0038? Decode_0038(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 8) + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0038) + if(number != 0x0038) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0038 decoded = new Feature_0038(); @@ -3176,18 +3176,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_003A? Decode_003A(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 8) + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x003A) + if(number != 0x003A) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_003A decoded = new Feature_003A(); @@ -3196,7 +3196,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 0) + if(decoded.Version >= 0) { decoded.Write |= (feature[4] & 0x01) == 0x01; decoded.QuickStart |= (feature[5] & 0x02) == 0x02; @@ -3208,18 +3208,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_003B? Decode_003B(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 8) + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x003B) + if(number != 0x003B) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_003B decoded = new Feature_003B(); @@ -3228,7 +3228,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 0) + if(decoded.Version >= 0) decoded.Write |= (feature[4] & 0x01) == 0x01; return decoded; @@ -3236,18 +3236,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0040? Decode_0040(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 32) + if(feature.Length < 32) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0040) + if(number != 0x0040) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0040 decoded = new Feature_0040(); @@ -3256,14 +3256,14 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 0) + if(decoded.Version >= 0) { decoded.OldRE |= (feature[9] & 0x01) == 0x01; decoded.OldR |= (feature[17] & 0x01) == 0x01; decoded.OldROM |= (feature[25] & 0x01) == 0x01; } - if (decoded.Version >= 1) + if(decoded.Version >= 1) { decoded.BCA |= (feature[4] & 0x01) == 0x01; decoded.RE2 |= (feature[9] & 0x04) == 0x04; @@ -3277,18 +3277,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0041? Decode_0041(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 24) + if(feature.Length < 24) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0041) + if(number != 0x0041) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0041 decoded = new Feature_0041(); @@ -3297,14 +3297,14 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 0) + if(decoded.Version >= 0) { decoded.SVNR |= (feature[4] & 0x01) == 0x01; decoded.OldRE |= (feature[9] & 0x01) == 0x01; decoded.OldR |= (feature[17] & 0x01) == 0x01; } - if (decoded.Version >= 1) + if(decoded.Version >= 1) { decoded.RE2 |= (feature[9] & 0x04) == 0x04; decoded.RE1 |= (feature[9] & 0x02) == 0x02; @@ -3316,18 +3316,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0042? Decode_0042(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 4) + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0042) + if(number != 0x0042) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0042 decoded = new Feature_0042(); @@ -3341,18 +3341,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0050? Decode_0050(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 8) + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0050) + if(number != 0x0050) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0050 decoded = new Feature_0050(); @@ -3361,7 +3361,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 0) + if(decoded.Version >= 0) { decoded.HDDVDR |= (feature[4] & 0x01) == 0x01; decoded.HDDVDRAM |= (feature[6] & 0x01) == 0x01; @@ -3372,18 +3372,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0051? Decode_0051(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 8) + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0051) + if(number != 0x0051) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0051 decoded = new Feature_0051(); @@ -3392,7 +3392,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 0) + if(decoded.Version >= 0) { decoded.HDDVDR |= (feature[4] & 0x01) == 0x01; decoded.HDDVDRAM |= (feature[6] & 0x01) == 0x01; @@ -3403,18 +3403,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0080? Decode_0080(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 8) + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0080) + if(number != 0x0080) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0080 decoded = new Feature_0080(); @@ -3423,7 +3423,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 0) + if(decoded.Version >= 0) decoded.RI |= (feature[4] & 0x01) == 0x01; return decoded; @@ -3431,18 +3431,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0100? Decode_0100(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 4) + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0100) + if(number != 0x0100) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0100 decoded = new Feature_0100(); @@ -3456,18 +3456,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0101? Decode_0101(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 8) + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0101) + if(number != 0x0101) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0101 decoded = new Feature_0101(); @@ -3476,7 +3476,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 0) + if(decoded.Version >= 0) decoded.PP |= (feature[4] & 0x01) == 0x01; return decoded; @@ -3484,18 +3484,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0102? Decode_0102(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 4) + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0102) + if(number != 0x0102) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0102 decoded = new Feature_0102(); @@ -3504,7 +3504,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 0) + if(decoded.Version >= 0) { decoded.SCC |= (feature[4] & 0x10) == 0x10; decoded.SDP |= (feature[4] & 0x04) == 0x04; @@ -3516,18 +3516,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0103? Decode_0103(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 8) + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0103) + if(number != 0x0103) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0103 decoded = new Feature_0103(); @@ -3536,7 +3536,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 0) + if(decoded.Version >= 0) { decoded.Scan |= (feature[4] & 0x04) == 0x04; decoded.SCM |= (feature[4] & 0x02) == 0x02; @@ -3549,18 +3549,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0104? Decode_0104(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 4) + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0104) + if(number != 0x0104) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0104 decoded = new Feature_0104(); @@ -3569,7 +3569,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 1 && feature.Length >= 8) + if(decoded.Version >= 1 && feature.Length >= 8) decoded.M5 |= (feature[4] & 0x01) == 0x01; return decoded; @@ -3577,18 +3577,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0105? Decode_0105(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 4) + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0105) + if(number != 0x0105) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0105 decoded = new Feature_0105(); @@ -3597,7 +3597,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 1 && feature.Length >= 8) + if(decoded.Version >= 1 && feature.Length >= 8) { decoded.Group3 |= (feature[4] & 0x01) == 0x01; decoded.UnitLength = (ushort)((feature[6] << 8) + feature[7]); @@ -3608,18 +3608,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0106? Decode_0106(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 8) + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0106) + if(number != 0x0106) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0106 decoded = new Feature_0106(); @@ -3628,7 +3628,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 0) + if(decoded.Version >= 0) decoded.CSSVersion = feature[7]; return decoded; @@ -3636,18 +3636,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0107? Decode_0107(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 4) + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0107) + if(number != 0x0107) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0107 decoded = new Feature_0107(); @@ -3656,7 +3656,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 3 && feature.Length >= 8) + if(decoded.Version >= 3 && feature.Length >= 8) { decoded.RBCB |= (feature[4] & 0x10) == 0x10; decoded.SCS |= (feature[4] & 0x08) == 0x08; @@ -3665,7 +3665,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.SW |= (feature[4] & 0x01) == 0x01; } - if (decoded.Version >= 5 && feature.Length >= 8) + if(decoded.Version >= 5 && feature.Length >= 8) { decoded.SMP |= (feature[4] & 0x20) == 0x20; decoded.RBCB |= (feature[4] & 0x10) == 0x10; @@ -3676,18 +3676,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0108? Decode_0108(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 4) + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0108) + if(number != 0x0108) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0108 decoded = new Feature_0108(); @@ -3696,7 +3696,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 0) + if(decoded.Version >= 0) { byte[] serial = new byte[feature.Length]; Array.Copy(feature, 4, serial, 0, feature.Length - 4); @@ -3708,18 +3708,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0109? Decode_0109(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 4) + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0109) + if(number != 0x0109) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0109 decoded = new Feature_0109(); @@ -3733,18 +3733,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_010A? Decode_010A(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 8) + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x010A) + if(number != 0x010A) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_010A decoded = new Feature_010A(); @@ -3753,10 +3753,10 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 0) + if(decoded.Version >= 0) { decoded.DCBs = new uint[feature[3] / 4]; - for (int i = 0; i < decoded.DCBs.Length; i++) + for(int i = 0; i < decoded.DCBs.Length; i++) decoded.DCBs[i] = (uint)((feature[0 + 4 + i * 4] << 24) + (feature[1 + 4 + i * 4] << 16) + (feature[2 + 4 + i * 4] << 8) + feature[3 + 4 + i * 4]); } @@ -3765,18 +3765,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_010B? Decode_010B(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 4) + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x010B) + if(number != 0x010B) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_010B decoded = new Feature_010B(); @@ -3785,7 +3785,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 0) + if(decoded.Version >= 0) decoded.CPRMVersion = feature[7]; return decoded; @@ -3793,18 +3793,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_010C? Decode_010C(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 20) + if(feature.Length < 20) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x010C) + if(number != 0x010C) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_010C decoded = new Feature_010C(); @@ -3813,7 +3813,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 0) + if(decoded.Version >= 0) { decoded.Century = (ushort)((feature[4] << 8) + feature[5]); decoded.Year = (ushort)((feature[6] << 8) + feature[7]); @@ -3829,18 +3829,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_010D? Decode_010D(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 8) + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x010D) + if(number != 0x010D) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_010D decoded = new Feature_010D(); @@ -3849,7 +3849,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 0) + if(decoded.Version >= 0) { decoded.BNG |= (feature[4] & 0x01) == 0x01; decoded.BindNonceBlocks = feature[5]; @@ -3857,7 +3857,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.AACSVersion = feature[7]; } - if (decoded.Version >= 2) + if(decoded.Version >= 2) { decoded.RDC |= (feature[4] & 0x10) == 0x10; decoded.RMC |= (feature[4] & 0x08) == 0x08; @@ -3870,18 +3870,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_010E? Decode_010E(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 8) + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x010E) + if(number != 0x010E) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_010E decoded = new Feature_010E(); @@ -3890,7 +3890,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 0) + if(decoded.Version >= 0) decoded.MaxScrambleExtent = feature[4]; return decoded; @@ -3898,18 +3898,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0110? Decode_0110(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 8) + if(feature.Length < 8) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0110) + if(number != 0x0110) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0110 decoded = new Feature_0110(); @@ -3923,18 +3923,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0113? Decode_0113(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 4) + if(feature.Length < 4) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0113) + if(number != 0x0113) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0113 decoded = new Feature_0113(); @@ -3948,18 +3948,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static Feature_0142? Decode_0142(byte[] feature) { - if (feature == null) + if(feature == null) return null; - if (feature.Length < 6) + if(feature.Length < 6) return null; ushort number = (ushort)((feature[0] << 8) + feature[1]); - if (number != 0x0142) + if(number != 0x0142) return null; - if ((feature[3] + 4) != feature.Length) + if((feature[3] + 4) != feature.Length) return null; Feature_0142 decoded = new Feature_0142(); @@ -3968,15 +3968,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.Persistent |= (feature[2] & 0x02) == 0x02; decoded.Version = (byte)((feature[2] & 0x3C) >> 2); - if (decoded.Version >= 0) + if(decoded.Version >= 0) { decoded.PSAU |= (feature[4] & 0x80) == 0x80; decoded.LOSPB |= (feature[4] & 0x40) == 0x40; decoded.ME |= (feature[4] & 0x01) == 0x01; decoded.Profiles = new ushort[feature[5]]; - if (feature[5] * 2 + 6 == feature.Length) + if(feature[5] * 2 + 6 == feature.Length) { - for (int i = 0; i < feature[5]; i++) + for(int i = 0; i < feature[5]; i++) decoded.Profiles[i] = (ushort)((feature[0 + 6 + 2 * i] << 8) + feature[1 + 6 + 2 * i]); } } @@ -3986,18 +3986,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0000(Feature_0000? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_0000 ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("MMC Supported Profiles:"); - if (ftr.Profiles != null) + if(ftr.Profiles != null) { - foreach (Profile prof in ftr.Profiles) + foreach(Profile prof in ftr.Profiles) { - switch (prof.Number) + switch(prof.Number) { case ProfileNumber.Reserved: sb.Append("\tDrive reported a reserved profile number"); @@ -4112,7 +4112,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC break; } - if (prof.Current) + if(prof.Current) sb.AppendLine(" (current)"); else sb.AppendLine(); @@ -4124,7 +4124,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0001(Feature_0001? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_0001 ftr = feature.Value; @@ -4132,7 +4132,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC sb.AppendLine("MMC Core Feature:"); sb.Append("\tDrive uses "); - switch (ftr.PhysicalInterfaceStandard) + switch(ftr.PhysicalInterfaceStandard) { case PhysicalInterfaces.Unspecified: sb.AppendLine("an unspecified physical interface"); @@ -4179,7 +4179,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0002(Feature_0002? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_0002 ftr = feature.Value; @@ -4187,12 +4187,12 @@ namespace DiscImageChef.Decoders.SCSI.MMC sb.AppendLine("MMC Morphing:"); - if (ftr.Async) + if(ftr.Async) sb.AppendLine("\tDrive supports polling and asynchronous GET EVENT STATUS NOTIFICATION"); else sb.AppendLine("\tDrive supports only polling GET EVENT STATUS NOTIFICATION"); - if (ftr.OCEvent) + if(ftr.OCEvent) sb.AppendLine("\tDrive supports operational change request / notification class events"); return sb.ToString(); @@ -4200,7 +4200,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0003(Feature_0003? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_0003 ftr = feature.Value; @@ -4208,7 +4208,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC sb.AppendLine("MMC Removable Medium:"); - switch (ftr.LoadingMechanismType) + switch(ftr.LoadingMechanismType) { case 0: sb.AppendLine("\tDrive uses media caddy"); @@ -4230,15 +4230,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC break; } - if (ftr.Lock) + if(ftr.Lock) sb.AppendLine("\tDrive can lock media"); - if (ftr.PreventJumper) + if(ftr.PreventJumper) sb.AppendLine("\tDrive power ups locked"); - if (ftr.Eject) + if(ftr.Eject) sb.AppendLine("\tDrive can eject media"); - if (ftr.Load) + if(ftr.Load) sb.AppendLine("\tDrive can load media"); - if (ftr.DBML) + if(ftr.DBML) sb.AppendLine("\tDrive reports Device Busy Class events during medium loading/unloading"); return sb.ToString(); @@ -4246,7 +4246,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0004(Feature_0004? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_0004 ftr = feature.Value; @@ -4254,13 +4254,13 @@ namespace DiscImageChef.Decoders.SCSI.MMC sb.AppendLine("MMC Write Protect:"); - if (ftr.DWP) + if(ftr.DWP) sb.AppendLine("\tDrive supports reading/writing the Disc Write Protect PAC on BD-R/-RE media"); - if (ftr.WDCB) + if(ftr.WDCB) sb.AppendLine("\tDrive supports writing the Write Inhibit DCB on DVD+RW media"); - if (ftr.SPWP) + if(ftr.SPWP) sb.AppendLine("\tDrive supports set/release of PWP status"); - if (ftr.SSWPP) + if(ftr.SSWPP) sb.AppendLine("\tDrive supports the SWPP bit of the Timeout and Protect mode page"); return sb.ToString(); @@ -4268,22 +4268,22 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0010(Feature_0010? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_0010 ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.Append("MMC Random Readable"); - if (ftr.Current) + if(ftr.Current) sb.Append(" (current)"); sb.AppendLine(":"); - if (ftr.PP) + if(ftr.PP) sb.AppendLine("\tDrive shall report Read/Write Error Recovery mode page"); - if (ftr.LogicalBlockSize > 0) + if(ftr.LogicalBlockSize > 0) sb.AppendFormat("\t{0} bytes per logical block", ftr.LogicalBlockSize).AppendLine(); - if (ftr.Blocking > 1) + if(ftr.Blocking > 1) sb.AppendFormat("\t{0} logical blocks per media readable unit", ftr.Blocking).AppendLine(); return sb.ToString(); @@ -4296,22 +4296,22 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_001E(Feature_001E? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_001E ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.Append("MMC CD Read"); - if (ftr.Current) + if(ftr.Current) sb.Append(" (current)"); sb.AppendLine(":"); - if (ftr.DAP) + if(ftr.DAP) sb.AppendLine("\tDrive supports the DAP bit in the READ CD and READ CD MSF commands"); - if (ftr.C2) + if(ftr.C2) sb.AppendLine("\tDrive supports C2 Error Pointers"); - if (ftr.CDText) + if(ftr.CDText) sb.AppendLine("\tDrive can return CD-Text from Lead-In"); return sb.ToString(); @@ -4319,23 +4319,23 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_001F(Feature_001F? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_001F ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.Append("MMC DVD Read"); - if (ftr.Current) + if(ftr.Current) sb.Append(" (current)"); sb.AppendLine(":"); sb.AppendLine("\tDrive can read DVD media"); - if (ftr.DualR) + if(ftr.DualR) sb.AppendLine("\tDrive can read DVD-R DL from all recording modes"); - if (ftr.DualRW) + if(ftr.DualRW) sb.AppendLine("\tDrive can read DVD-RW DL from all recording modes"); - if (ftr.MULTI110) + if(ftr.MULTI110) sb.AppendLine("\tDrive conforms to DVD Multi Drive Read-only Specifications"); return sb.ToString(); @@ -4343,24 +4343,24 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0020(Feature_0020? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_0020 ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.Append("MMC Random Writable:"); - if (ftr.Current) + if(ftr.Current) sb.Append(" (current)"); sb.AppendLine(":"); - if (ftr.PP) + if(ftr.PP) sb.AppendLine("\tDrive shall report Read/Write Error Recovery mode page"); - if (ftr.LogicalBlockSize > 0) + if(ftr.LogicalBlockSize > 0) sb.AppendFormat("\t{0} bytes per logical block", ftr.LogicalBlockSize).AppendLine(); - if (ftr.Blocking > 1) + if(ftr.Blocking > 1) sb.AppendFormat("\t{0} logical blocks per media writable unit", ftr.Blocking).AppendLine(); - if (ftr.LastLBA > 0) + if(ftr.LastLBA > 0) sb.AppendFormat("\tLast adressable logical block is {0}", ftr.LastLBA).AppendLine(); return sb.ToString(); @@ -4368,7 +4368,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0021(Feature_0021? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_0021 ftr = feature.Value; @@ -4376,7 +4376,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC sb.AppendLine("MMC Incremental Streaming Writable:"); - if (ftr.DataTypeSupported > 0) + if(ftr.DataTypeSupported > 0) { sb.Append("\tDrive supports data block types:"); if((ftr.DataTypeSupported & 0x0001) == 0x0001) @@ -4431,7 +4431,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0023(Feature_0023? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_0023 ftr = feature.Value; @@ -4440,17 +4440,17 @@ namespace DiscImageChef.Decoders.SCSI.MMC sb.AppendLine("MMC Formattable:"); sb.AppendLine("\tDrive can format media into logical blocks"); - if (ftr.RENoSA) + if(ftr.RENoSA) sb.AppendLine("\tDrive can format BD-RE with no spares allocated"); - if (ftr.Expand) + if(ftr.Expand) sb.AppendLine("\tDrive can expand the spare area on a formatted BD-RE disc"); - if (ftr.QCert) + if(ftr.QCert) sb.AppendLine("\tDrive can format BD-RE discs with quick certification"); - if (ftr.Cert) + if(ftr.Cert) sb.AppendLine("\tDrive can format BD-RE discs with full certification"); - if (ftr.FRF) + if(ftr.FRF) sb.AppendLine("\tDrive can fast re-format BD-RE discs"); - if (ftr.RRM) + if(ftr.RRM) sb.AppendLine("\tDrive can format BD-R discs with RRM format"); return sb.ToString(); @@ -4458,7 +4458,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0024(Feature_0024? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_0024 ftr = feature.Value; @@ -4466,7 +4466,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC sb.AppendLine("MMC Hardware Defect Management:"); sb.AppendLine("\tDrive shall be able to provide a defect-free contiguous address space"); - if (ftr.SSA) + if(ftr.SSA) sb.AppendLine("\tDrive can return Spare Area Information"); return sb.ToString(); @@ -4474,22 +4474,22 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0025(Feature_0025? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_0025 ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.Append("MMC Write Once"); - if (ftr.Current) + if(ftr.Current) sb.Append(" (current)"); sb.AppendLine(":"); - if (ftr.PP) + if(ftr.PP) sb.AppendLine("\tDrive shall report Read/Write Error Recovery mode page"); - if (ftr.LogicalBlockSize > 0) + if(ftr.LogicalBlockSize > 0) sb.AppendFormat("\t{0} bytes per logical block", ftr.LogicalBlockSize).AppendLine(); - if (ftr.Blocking > 1) + if(ftr.Blocking > 1) sb.AppendFormat("\t{0} logical blocks per media writable unit", ftr.Blocking).AppendLine(); return sb.ToString(); @@ -4502,7 +4502,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0027(Feature_0027? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_0027 ftr = feature.Value; @@ -4519,21 +4519,21 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0028(Feature_0028? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_0028 ftr = feature.Value; StringBuilder sb = new StringBuilder(); - if (ftr.Write && ftr.DVDPRead && ftr.DVDPWrite) + if(ftr.Write && ftr.DVDPRead && ftr.DVDPWrite) sb.Append("Drive can read and write CD-MRW and DVD+MRW"); - else if (ftr.DVDPRead && ftr.DVDPWrite) + else if(ftr.DVDPRead && ftr.DVDPWrite) sb.Append("Drive can read and write DVD+MRW"); - else if (ftr.Write && ftr.DVDPRead) + else if(ftr.Write && ftr.DVDPRead) sb.Append("Drive and read DVD+MRW and read and write CD-MRW"); - else if (ftr.Write) + else if(ftr.Write) sb.Append("Drive can read and write CD-MRW"); - else if (ftr.DVDPRead) + else if(ftr.DVDPRead) sb.Append("Drive can read CD-MRW and DVD+MRW"); else sb.Append("Drive can read CD-MRW"); @@ -4548,7 +4548,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0029(Feature_0029? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_0029 ftr = feature.Value; @@ -4556,14 +4556,14 @@ namespace DiscImageChef.Decoders.SCSI.MMC sb.AppendLine("MMC Enhanced Defect Reporting Feature:"); - if (ftr.DRTDM) + if(ftr.DRTDM) sb.AppendLine("\tDrive supports DRT-DM mode"); else sb.AppendLine("\tDrive supports Persistent-DM mode"); - if (ftr.DBICacheZones > 0) + if(ftr.DBICacheZones > 0) sb.AppendFormat("\tDrive has {0} DBI cache zones", ftr.DBICacheZones).AppendLine(); - if (ftr.Entries > 0) + if(ftr.Entries > 0) sb.AppendFormat("\tDrive has {0} DBI entries", ftr.Entries).AppendLine(); return sb.ToString(); @@ -4571,30 +4571,30 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_002A(Feature_002A? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_002A ftr = feature.Value; StringBuilder sb = new StringBuilder(); - if (ftr.Write) + if(ftr.Write) { sb.Append("Drive can read and write DVD+RW"); - if (ftr.Current) + if(ftr.Current) sb.AppendLine(" (current)"); else sb.AppendLine(); - if (ftr.CloseOnly) + if(ftr.CloseOnly) sb.AppendLine("\tDrive supports only the read compatibility stop"); else sb.AppendLine("\tDrive supports both forms of background format stopping"); - if (ftr.QuickStart) + if(ftr.QuickStart) sb.AppendLine("\tDrive can do a quick start formatting"); } else { sb.Append("Drive can read DVD+RW"); - if (ftr.Current) + if(ftr.Current) sb.AppendLine(" (current)"); else sb.AppendLine(); @@ -4605,16 +4605,16 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_002B(Feature_002B? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_002B ftr = feature.Value; StringBuilder sb = new StringBuilder(); - if (ftr.Write) + if(ftr.Write) { sb.Append("Drive can read and write DVD+R"); - if (ftr.Current) + if(ftr.Current) sb.AppendLine(" (current)"); else sb.AppendLine(); @@ -4622,7 +4622,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC else { sb.Append("Drive can read DVD+R"); - if (ftr.Current) + if(ftr.Current) sb.AppendLine(" (current)"); else sb.AppendLine(); @@ -4633,25 +4633,25 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_002C(Feature_002C? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_002C ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.Append("MMC Rigid Restricted Overwrite"); - if (ftr.Current) + if(ftr.Current) sb.AppendLine(" (current):"); else sb.AppendLine(":"); - if (ftr.Blank) + if(ftr.Blank) sb.AppendLine("\tDrive supports the BLANK command"); - if (ftr.Intermediate) + if(ftr.Intermediate) sb.AppendLine("\tDrive supports writing on an intermediate state session and quick formatting"); - if (ftr.DSDR) + if(ftr.DSDR) sb.AppendLine("\tDrive can read Defect Status data recorded on the medium"); - if (ftr.DSDG) + if(ftr.DSDG) sb.AppendLine("\tDrive can generate Defect Status data during formatting"); return sb.ToString(); @@ -4659,7 +4659,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_002D(Feature_002D? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_002D ftr = feature.Value; @@ -4667,7 +4667,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC sb.AppendLine("Drive can write CDs in Track at Once Mode:"); - if (ftr.RWSubchannel) + if(ftr.RWSubchannel) { sb.AppendLine("\tDrive can write user provided data in the R-W subchannels"); if(ftr.RWRaw) @@ -4677,14 +4677,14 @@ namespace DiscImageChef.Decoders.SCSI.MMC } - if (ftr.CDRW) + if(ftr.CDRW) sb.AppendLine("\tDrive can overwrite a TAO track with another in CD-RWs"); - if (ftr.TestWrite) + if(ftr.TestWrite) sb.AppendLine("\tDrive can do a test writing"); - if (ftr.BUF) + if(ftr.BUF) sb.AppendLine("\tDrive supports zero loss linking"); - if (ftr.DataTypeSupported > 0) + if(ftr.DataTypeSupported > 0) { sb.Append("\tDrive supports data block types:"); if((ftr.DataTypeSupported & 0x0001) == 0x0001) @@ -4727,33 +4727,33 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_002E(Feature_002E? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_002E ftr = feature.Value; StringBuilder sb = new StringBuilder(); - if (ftr.SAO && !ftr.RAW) + if(ftr.SAO && !ftr.RAW) sb.AppendLine("Drive can write CDs in Session at Once Mode:"); - else if (!ftr.SAO && ftr.RAW) + else if(!ftr.SAO && ftr.RAW) sb.AppendLine("Drive can write CDs in raw Mode:"); else sb.AppendLine("Drive can write CDs in Session at Once and in Raw Modes:"); - if (ftr.RAW && ftr.RAWMS) + if(ftr.RAW && ftr.RAWMS) sb.AppendLine("\tDrive can write multi-session CDs in raw mode"); - if (ftr.RW) + if(ftr.RW) sb.AppendLine("\tDrive can write user provided data in the R-W subchannels"); - if (ftr.CDRW) + if(ftr.CDRW) sb.AppendLine("\tDrive can write CD-RWs"); - if (ftr.TestWrite) + if(ftr.TestWrite) sb.AppendLine("\tDrive can do a test writing"); - if (ftr.BUF) + if(ftr.BUF) sb.AppendLine("\tDrive supports zero loss linking"); - if (ftr.MaxCueSheet > 0) + if(ftr.MaxCueSheet > 0) sb.AppendFormat("\tDrive supports a maximum of {0} bytes in a single cue sheet", ftr.MaxCueSheet).AppendLine(); return sb.ToString(); @@ -4761,24 +4761,24 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_002F(Feature_002F? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_002F ftr = feature.Value; StringBuilder sb = new StringBuilder(); - if (ftr.DVDRW && ftr.RDL) + if(ftr.DVDRW && ftr.RDL) sb.AppendLine("Drive supports writing DVD-R, DVD-RW and DVD-R DL"); - else if (ftr.RDL) + else if(ftr.RDL) sb.AppendLine("Drive supports writing DVD-R and DVD-R DL"); - else if (ftr.DVDRW) + else if(ftr.DVDRW) sb.AppendLine("Drive supports writing DVD-R and DVD-RW"); else sb.AppendLine("Drive supports writing DVD-R"); - if (ftr.TestWrite) + if(ftr.TestWrite) sb.AppendLine("\tDrive can do a test writing"); - if (ftr.BUF) + if(ftr.BUF) sb.AppendLine("\tDrive supports zero loss linking"); return sb.ToString(); @@ -4791,7 +4791,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0031(Feature_0031? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_0031 ftr = feature.Value; @@ -4799,7 +4799,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC sb.AppendLine("Drive supports writing DDCD-R"); - if (ftr.TestWrite) + if(ftr.TestWrite) sb.AppendLine("\tDrive can do a test writing"); return sb.ToString(); @@ -4807,7 +4807,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0032(Feature_0032? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_0032 ftr = feature.Value; @@ -4815,9 +4815,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC sb.AppendLine("Drive supports writing DDCD-RW"); - if (ftr.Blank) + if(ftr.Blank) sb.AppendLine("\tDrive supports the BLANK command"); - if (ftr.Intermediate) + if(ftr.Intermediate) sb.AppendLine("\tDrive supports quick formatting"); return sb.ToString(); @@ -4825,7 +4825,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0033(Feature_0033? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_0033 ftr = feature.Value; @@ -4833,9 +4833,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC sb.AppendLine("MMC Layer Jump Recording:"); - if (ftr.LinkSizes != null) + if(ftr.LinkSizes != null) { - foreach (byte link in ftr.LinkSizes) + foreach(byte link in ftr.LinkSizes) sb.AppendFormat("\tCurrent media has a {0} bytes link available", link).AppendLine(); } @@ -4849,31 +4849,31 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0037(Feature_0037? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_0037 ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("Drive can write CD-RW"); - if (ftr.SubtypeSupport > 0) + if(ftr.SubtypeSupport > 0) { sb.Append("\tDrive supports CD-RW subtypes"); - if ((ftr.SubtypeSupport & 0x01) == 0x01) + if((ftr.SubtypeSupport & 0x01) == 0x01) sb.Append(" 0"); - if ((ftr.SubtypeSupport & 0x02) == 0x02) + if((ftr.SubtypeSupport & 0x02) == 0x02) sb.Append(" 1"); - if ((ftr.SubtypeSupport & 0x04) == 0x04) + if((ftr.SubtypeSupport & 0x04) == 0x04) sb.Append(" 2"); - if ((ftr.SubtypeSupport & 0x08) == 0x08) + if((ftr.SubtypeSupport & 0x08) == 0x08) sb.Append(" 3"); - if ((ftr.SubtypeSupport & 0x10) == 0x10) + if((ftr.SubtypeSupport & 0x10) == 0x10) sb.Append(" 4"); - if ((ftr.SubtypeSupport & 0x20) == 0x20) + if((ftr.SubtypeSupport & 0x20) == 0x20) sb.Append(" 5"); - if ((ftr.SubtypeSupport & 0x40) == 0x40) + if((ftr.SubtypeSupport & 0x40) == 0x40) sb.Append(" 6"); - if ((ftr.SubtypeSupport & 0x80) == 0x80) + if((ftr.SubtypeSupport & 0x80) == 0x80) sb.Append(" 7"); sb.AppendLine(); } @@ -4888,30 +4888,30 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_003A(Feature_003A? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_003A ftr = feature.Value; StringBuilder sb = new StringBuilder(); - if (ftr.Write) + if(ftr.Write) { sb.Append("Drive can read and write DVD+RW DL"); - if (ftr.Current) + if(ftr.Current) sb.AppendLine(" (current)"); else sb.AppendLine(); - if (ftr.CloseOnly) + if(ftr.CloseOnly) sb.AppendLine("\tDrive supports only the read compatibility stop"); else sb.AppendLine("\tDrive supports both forms of background format stopping"); - if (ftr.QuickStart) + if(ftr.QuickStart) sb.AppendLine("\tDrive can do a quick start formatting"); } else { sb.Append("Drive can read DVD+RW DL"); - if (ftr.Current) + if(ftr.Current) sb.AppendLine(" (current)"); else sb.AppendLine(); @@ -4922,16 +4922,16 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_003B(Feature_003B? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_003B ftr = feature.Value; StringBuilder sb = new StringBuilder(); - if (ftr.Write) + if(ftr.Write) { sb.Append("Drive can read and write DVD+R DL"); - if (ftr.Current) + if(ftr.Current) sb.AppendLine(" (current)"); else sb.AppendLine(); @@ -4939,7 +4939,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC else { sb.Append("Drive can read DVD+R DL"); - if (ftr.Current) + if(ftr.Current) sb.AppendLine(" (current)"); else sb.AppendLine(); @@ -4950,34 +4950,34 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0040(Feature_0040? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_0040 ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.Append("MMC BD Read"); - if (ftr.Current) + if(ftr.Current) sb.AppendLine(" (current):"); else sb.AppendLine(":"); - if (ftr.OldROM) + if(ftr.OldROM) sb.AppendLine("\tDrive can read BD-ROM pre-1.0"); - if (ftr.ROM) + if(ftr.ROM) sb.AppendLine("\tDrive can read BD-ROM Ver.1"); - if (ftr.OldR) + if(ftr.OldR) sb.AppendLine("\tDrive can read BD-R pre-1.0"); - if (ftr.R) + if(ftr.R) sb.AppendLine("\tDrive can read BD-R Ver.1"); - if (ftr.OldRE) + if(ftr.OldRE) sb.AppendLine("\tDrive can read BD-RE pre-1.0"); - if (ftr.RE1) + if(ftr.RE1) sb.AppendLine("\tDrive can read BD-RE Ver.1"); - if (ftr.RE2) + if(ftr.RE2) sb.AppendLine("\tDrive can read BD-RE Ver.2"); - if (ftr.BCA) + if(ftr.BCA) sb.AppendLine("\tDrive can read BD's Burst Cutting Area"); return sb.ToString(); @@ -4985,30 +4985,30 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0041(Feature_0041? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_0041 ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.Append("MMC BD Write"); - if (ftr.Current) + if(ftr.Current) sb.AppendLine(" (current):"); else sb.AppendLine(":"); - if (ftr.OldR) + if(ftr.OldR) sb.AppendLine("\tDrive can write BD-R pre-1.0"); - if (ftr.R) + if(ftr.R) sb.AppendLine("\tDrive can write BD-R Ver.1"); - if (ftr.OldRE) + if(ftr.OldRE) sb.AppendLine("\tDrive can write BD-RE pre-1.0"); - if (ftr.RE1) + if(ftr.RE1) sb.AppendLine("\tDrive can write BD-RE Ver.1"); - if (ftr.RE2) + if(ftr.RE2) sb.AppendLine("\tDrive can write BD-RE Ver.2"); - if (ftr.SVNR) + if(ftr.SVNR) sb.AppendLine("\tDrive supports write without verify requirement"); return sb.ToString(); @@ -5021,22 +5021,22 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0050(Feature_0050? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_0050 ftr = feature.Value; StringBuilder sb = new StringBuilder(); - if (ftr.HDDVDR && ftr.HDDVDRAM) + if(ftr.HDDVDR && ftr.HDDVDRAM) sb.Append("Drive can read HD DVD-ROM, HD DVD-RW, HD DVD-R and HD DVD-RAM"); - else if (ftr.HDDVDR) + else if(ftr.HDDVDR) sb.Append("Drive can read HD DVD-ROM, HD DVD-RW and HD DVD-R"); - else if (ftr.HDDVDRAM) + else if(ftr.HDDVDRAM) sb.Append("Drive can read HD DVD-ROM, HD DVD-RW and HD DVD-RAM"); else sb.Append("Drive can read HD DVD-ROM and HD DVD-RW"); - if (ftr.Current) + if(ftr.Current) sb.AppendLine(" (current)"); else sb.AppendLine(); @@ -5046,22 +5046,22 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0051(Feature_0051? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_0051 ftr = feature.Value; StringBuilder sb = new StringBuilder(); - if (ftr.HDDVDR && ftr.HDDVDRAM) + if(ftr.HDDVDR && ftr.HDDVDRAM) sb.Append("Drive can write HD DVD-RW, HD DVD-R and HD DVD-RAM"); - else if (ftr.HDDVDR) + else if(ftr.HDDVDR) sb.Append("Drive can write HD DVD-RW and HD DVD-R"); - else if (ftr.HDDVDRAM) + else if(ftr.HDDVDRAM) sb.Append("Drive can write HD DVD-RW and HD DVD-RAM"); else sb.Append("Drive can write HD DVD-RW"); - if (ftr.Current) + if(ftr.Current) sb.AppendLine(" (current)"); else sb.AppendLine(); @@ -5071,19 +5071,19 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0080(Feature_0080? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_0080 ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.Append("Drive is able to access Hybrid discs"); - if (ftr.Current) + if(ftr.Current) sb.AppendLine(" (current)"); else sb.AppendLine(); - if (ftr.RI) + if(ftr.RI) sb.AppendLine("\tDrive is able to maintain the online format layer through reset and power cycling"); return sb.ToString(); @@ -5096,14 +5096,14 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0101(Feature_0101? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_0101 ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("Drive supports S.M.A.R.T."); - if (ftr.PP) + if(ftr.PP) sb.AppendLine("\tDrive supports the Informational Exceptions Control mode page 1Ch"); return sb.ToString(); @@ -5111,7 +5111,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0102(Feature_0102? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_0102 ftr = feature.Value; @@ -5119,9 +5119,9 @@ namespace DiscImageChef.Decoders.SCSI.MMC sb.AppendLine("MMC Embedded Changer:"); - if (ftr.SCC) + if(ftr.SCC) sb.AppendLine("\tDrive can change disc side"); - if (ftr.SDP) + if(ftr.SDP) sb.AppendLine("\tDrive is able to report slots contents after a reset or change"); sb.AppendFormat("\tDrive has {0} slots", ftr.HighestSlotNumber + 1).AppendLine(); @@ -5131,7 +5131,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0103(Feature_0103? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_0103 ftr = feature.Value; @@ -5139,11 +5139,11 @@ namespace DiscImageChef.Decoders.SCSI.MMC sb.AppendLine("Drive has an analogue audio output"); - if (ftr.Scan) + if(ftr.Scan) sb.AppendLine("\tDrive supports the SCAN command"); - if (ftr.SCM) + if(ftr.SCM) sb.AppendLine("\tDrive is able to mute channels separately"); - if (ftr.SV) + if(ftr.SV) sb.AppendLine("\tDrive supports separate volume per channel"); sb.AppendFormat("\tDrive has {0} volume levels", ftr.VolumeLevels + 1).AppendLine(); @@ -5153,14 +5153,14 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0104(Feature_0104? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_0104 ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.AppendLine("Drive supports Microcode Upgrade"); - if (ftr.M5) + if(ftr.M5) sb.AppendLine("Drive supports validating the 5-bit Mode of the READ BUFFER and WRITE BUFFER commands"); return sb.ToString(); @@ -5168,7 +5168,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0105(Feature_0105? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_0105 ftr = feature.Value; @@ -5176,10 +5176,10 @@ namespace DiscImageChef.Decoders.SCSI.MMC sb.AppendLine("Drive supports Timeout & Protect mode page 1Dh"); - if (ftr.Group3) + if(ftr.Group3) { sb.AppendLine("\tDrive supports the Group3 in Timeout & Protect mode page 1Dh"); - if (ftr.UnitLength > 0) + if(ftr.UnitLength > 0) sb.AppendFormat("\tDrive has {0} increase of Group 3 time unit", ftr.UnitLength).AppendLine(); } @@ -5188,14 +5188,14 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0106(Feature_0106? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_0106 ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.AppendFormat("Drive supports DVD CSS/CPPM version {0}", ftr.CSSVersion); - if (ftr.Current) + if(ftr.Current) sb.AppendLine(" and current disc is encrypted"); else sb.AppendLine(); @@ -5205,7 +5205,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0107(Feature_0107? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_0107 ftr = feature.Value; @@ -5213,17 +5213,17 @@ namespace DiscImageChef.Decoders.SCSI.MMC sb.AppendLine("MMC Real Time Streaming:"); - if (ftr.SMP) + if(ftr.SMP) sb.AppendLine("\tDrive supports Set Minimum Performance with the SET STREAMING command"); - if (ftr.RBCB) + if(ftr.RBCB) sb.AppendLine("\tDrive supports the block bit in the READ BUFFER CAPACITY command"); - if (ftr.SCS) + if(ftr.SCS) sb.AppendLine("\tDrive supports the SET CD SPEED command"); - if (ftr.MP2A) + if(ftr.MP2A) sb.AppendLine("\tDrive supports the Write Speed Performance Descriptor Blocks in the MMC mode page 2Ah"); - if (ftr.WSPD) + if(ftr.WSPD) sb.AppendLine("\tDrive supports the Write Speed data of GET PERFORMANCE and the WRC field of SET STREAMING"); - if (ftr.SW) + if(ftr.SW) sb.AppendLine("\tDrive supports stream recording"); return sb.ToString(); @@ -5231,7 +5231,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0108(Feature_0108? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_0108 ftr = feature.Value; @@ -5249,15 +5249,15 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_010A(Feature_010A? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_010A ftr = feature.Value; StringBuilder sb = new StringBuilder(); - if (ftr.DCBs != null) + if(ftr.DCBs != null) { - foreach (uint DCB in ftr.DCBs) + foreach(uint DCB in ftr.DCBs) sb.AppendFormat("Drive supports DCB {0:X8}h", DCB).AppendLine(); } @@ -5266,14 +5266,14 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_010B(Feature_010B? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_010B ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.AppendFormat("Drive supports DVD CPRM version {0}", ftr.CPRMVersion); - if (ftr.Current) + if(ftr.Current) sb.AppendLine(" and current disc is or can be encrypted"); else sb.AppendLine(); @@ -5283,7 +5283,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_010C(Feature_010C? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_010C ftr = feature.Value; @@ -5336,33 +5336,33 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_010D(Feature_010D? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_010D ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.AppendFormat("Drive supports AACS version {0}", ftr.AACSVersion); - if (ftr.Current) + if(ftr.Current) sb.AppendLine(" and current disc is encrypted"); else sb.AppendLine(); - if (ftr.RDC) + if(ftr.RDC) sb.AppendLine("\tDrive supports reading the Drive Certificate"); - if (ftr.RMC) + if(ftr.RMC) sb.AppendLine("\tDrive supports reading Media Key Block of CPRM"); - if (ftr.WBE) + if(ftr.WBE) sb.AppendLine("\tDrive supports writing with bus encryption"); - if (ftr.BEC) + if(ftr.BEC) sb.AppendLine("\tDrive supports bus encryption"); - if (ftr.BNG) + if(ftr.BNG) { sb.AppendLine("\tDrive supports generating the binding nonce"); - if (ftr.BindNonceBlocks > 0) + if(ftr.BindNonceBlocks > 0) sb.AppendFormat("\t{0} media blocks are required for the binding nonce", ftr.BindNonceBlocks).AppendLine(); } - if (ftr.AGIDs > 0) + if(ftr.AGIDs > 0) sb.AppendFormat("\tDrive supports {0} AGIDs concurrently", ftr.AGIDs).AppendLine(); return sb.ToString(); @@ -5370,19 +5370,19 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_010E(Feature_010E? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_010E ftr = feature.Value; StringBuilder sb = new StringBuilder(); sb.Append("Drive supports DVD-Download"); - if (ftr.Current) + if(ftr.Current) sb.AppendLine(" (current)"); else sb.AppendLine(); - if (ftr.MaxScrambleExtent > 0) + if(ftr.MaxScrambleExtent > 0) sb.AppendFormat("\tMaximum {0} scranble extent information entries", ftr.MaxScrambleExtent).AppendLine(); return sb.ToString(); @@ -5390,13 +5390,13 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0110(Feature_0110? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_0110 ftr = feature.Value; StringBuilder sb = new StringBuilder(); - if (ftr.Current) + if(ftr.Current) sb.AppendLine("Drive and currently inserted media support VCPS"); else sb.AppendLine("Drive supports VCPS"); @@ -5406,13 +5406,13 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0113(Feature_0113? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_0113 ftr = feature.Value; StringBuilder sb = new StringBuilder(); - if (ftr.Current) + if(ftr.Current) sb.AppendLine("Drive and currently inserted media support SecurDisc"); else sb.AppendLine("Drive supports SecurDisc"); @@ -5422,7 +5422,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string Prettify_0142(Feature_0142? feature) { - if (!feature.HasValue) + if(!feature.HasValue) return null; Feature_0142 ftr = feature.Value; @@ -5430,18 +5430,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC sb.AppendLine("Drive supports the Trusted Computing Group Optical Security Subsystem Class"); - if (ftr.Current) + if(ftr.Current) sb.AppendLine("\tCurrent media is initialized with TCG OSSC"); - if (ftr.PSAU) + if(ftr.PSAU) sb.AppendLine("\tDrive supports PSA updates on write-once media"); - if (ftr.LOSPB) + if(ftr.LOSPB) sb.AppendLine("\tDrive supports linked OSPBs"); - if (ftr.ME) + if(ftr.ME) sb.AppendLine("\tDrive will only record on the OSSC Disc Format"); - if (ftr.Profiles != null) + if(ftr.Profiles != null) { - for (int i = 0; i < ftr.Profiles.Length; i++) + for(int i = 0; i < ftr.Profiles.Length; i++) sb.AppendFormat("\tProfile {0}: {1}", i, ftr.Profiles[i]).AppendLine(); } @@ -5759,7 +5759,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC uint offset = 8; List descLst = new List(); - while (offset < response.Length) + while(offset < response.Length) { FeatureDescriptor desc = new FeatureDescriptor(); desc.Code = (ushort)((response[offset + 0] << 8) + response[offset + 1]); diff --git a/DiscImageChef.Decoders/SCSI/MMC/Hybrid.cs b/DiscImageChef.Decoders/SCSI/MMC/Hybrid.cs index 47ddd0989..e3df480cf 100644 --- a/DiscImageChef.Decoders/SCSI/MMC/Hybrid.cs +++ b/DiscImageChef.Decoders/SCSI/MMC/Hybrid.cs @@ -108,10 +108,10 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static RecognizedFormatLayers? DecodeFormatLayers(byte[] FormatLayersResponse) { - if (FormatLayersResponse == null) + if(FormatLayersResponse == null) return null; - if (FormatLayersResponse.Length < 8) + if(FormatLayersResponse.Length < 8) return null; RecognizedFormatLayers decoded = new RecognizedFormatLayers(); @@ -129,7 +129,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC decoded.FormatLayers = new UInt16[(FormatLayersResponse.Length - 6) / 2]; - for (int i = 0; i < (FormatLayersResponse.Length - 6) / 2; i++) + for(int i = 0; i < (FormatLayersResponse.Length - 6) / 2; i++) { decoded.FormatLayers[i] = BigEndianBitConverter.ToUInt16(FormatLayersResponse, i * 2 + 6); } @@ -139,7 +139,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string PrettifyFormatLayers(RecognizedFormatLayers? FormatLayersResponse) { - if (FormatLayersResponse == null) + if(FormatLayersResponse == null) return null; RecognizedFormatLayers response = FormatLayersResponse.Value; @@ -148,52 +148,52 @@ namespace DiscImageChef.Decoders.SCSI.MMC sb.AppendFormat("{0} format layers recognized", response.NumberOfLayers); - for (int i = 0; i < response.FormatLayers.Length; i++) + for(int i = 0; i < response.FormatLayers.Length; i++) { - switch (response.FormatLayers[i]) + switch(response.FormatLayers[i]) { case (UInt16)FormatLayerTypeCodes.BDLayer: { sb.AppendFormat("Layer {0} is of type Blu-ray", i).AppendLine(); - if (response.DefaultFormatLayer == i) + if(response.DefaultFormatLayer == i) sb.AppendLine("This is the default layer."); - if (response.OnlineFormatLayer == i) + if(response.OnlineFormatLayer == i) sb.AppendLine("This is the layer actually in use."); break; } case (UInt16)FormatLayerTypeCodes.CDLayer: { sb.AppendFormat("Layer {0} is of type CD", i).AppendLine(); - if (response.DefaultFormatLayer == i) + if(response.DefaultFormatLayer == i) sb.AppendLine("This is the default layer."); - if (response.OnlineFormatLayer == i) + if(response.OnlineFormatLayer == i) sb.AppendLine("This is the layer actually in use."); break; } case (UInt16)FormatLayerTypeCodes.DVDLayer: { sb.AppendFormat("Layer {0} is of type DVD", i).AppendLine(); - if (response.DefaultFormatLayer == i) + if(response.DefaultFormatLayer == i) sb.AppendLine("This is the default layer."); - if (response.OnlineFormatLayer == i) + if(response.OnlineFormatLayer == i) sb.AppendLine("This is the layer actually in use."); break; } case (UInt16)FormatLayerTypeCodes.HDDVDLayer: { sb.AppendFormat("Layer {0} is of type HD DVD", i).AppendLine(); - if (response.DefaultFormatLayer == i) + if(response.DefaultFormatLayer == i) sb.AppendLine("This is the default layer."); - if (response.OnlineFormatLayer == i) + if(response.OnlineFormatLayer == i) sb.AppendLine("This is the layer actually in use."); break; } default: { sb.AppendFormat("Layer {0} is of unknown type 0x{1:X4}", i, response.FormatLayers[i]).AppendLine(); - if (response.DefaultFormatLayer == i) + if(response.DefaultFormatLayer == i) sb.AppendLine("This is the default layer."); - if (response.OnlineFormatLayer == i) + if(response.OnlineFormatLayer == i) sb.AppendLine("This is the layer actually in use."); break; } diff --git a/DiscImageChef.Decoders/SCSI/MMC/WriteProtect.cs b/DiscImageChef.Decoders/SCSI/MMC/WriteProtect.cs index 0878cc572..859f26f3a 100644 --- a/DiscImageChef.Decoders/SCSI/MMC/WriteProtect.cs +++ b/DiscImageChef.Decoders/SCSI/MMC/WriteProtect.cs @@ -118,7 +118,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static WriteProtectionStatus? DecodeWriteProtectionStatus(byte[] WPSResponse) { - if (WPSResponse == null) + if(WPSResponse == null) return null; WriteProtectionStatus decoded = new WriteProtectionStatus(); @@ -142,23 +142,23 @@ namespace DiscImageChef.Decoders.SCSI.MMC public static string PrettifyWriteProtectionStatus(WriteProtectionStatus? WPSResponse) { - if (WPSResponse == null) + if(WPSResponse == null) return null; WriteProtectionStatus response = WPSResponse.Value; StringBuilder sb = new StringBuilder(); - if (response.MSWI) + if(response.MSWI) sb.AppendLine("Writing inhibited by media specific reason"); - if (response.CWP) + if(response.CWP) sb.AppendLine("Cartridge sets write protection"); - if (response.PWP) + if(response.PWP) sb.AppendLine("Media surface sets write protection"); - if (response.SWPP) + if(response.SWPP) sb.AppendLine("Software write protection is set until power down"); - #if DEBUG +#if DEBUG if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine(); if(response.Reserved2 != 0) @@ -171,7 +171,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC sb.AppendFormat("Reserved5 = 0x{0:X2}", response.Reserved5).AppendLine(); if(response.Reserved6 != 0) sb.AppendFormat("Reserved6 = 0x{0:X2}", response.Reserved6).AppendLine(); - #endif +#endif return sb.ToString(); } diff --git a/DiscImageChef.Decoders/SCSI/Modes.cs b/DiscImageChef.Decoders/SCSI/Modes.cs index 09bf1d7da..0ed07d964 100644 --- a/DiscImageChef.Decoders/SCSI/Modes.cs +++ b/DiscImageChef.Decoders/SCSI/Modes.cs @@ -63,16 +63,16 @@ namespace DiscImageChef.Decoders.SCSI public static ModeHeader? DecodeModeHeader6(byte[] modeResponse, PeripheralDeviceTypes deviceType) { - if (modeResponse == null || modeResponse.Length < 4 || modeResponse.Length < modeResponse[0] + 1) + if(modeResponse == null || modeResponse.Length < 4 || modeResponse.Length < modeResponse[0] + 1) return null; ModeHeader header = new ModeHeader(); header.MediumType = (MediumTypes)modeResponse[1]; - if (modeResponse[3] > 0) + if(modeResponse[3] > 0) { header.BlockDescriptors = new BlockDescriptor[modeResponse[3] / 8]; - for (int i = 0; i < header.BlockDescriptors.Length; i++) + for(int i = 0; i < header.BlockDescriptors.Length; i++) { header.BlockDescriptors[i].Density = (DensityType)modeResponse[0 + i * 8 + 4]; header.BlockDescriptors[i].Blocks += (ulong)(modeResponse[1 + i * 8 + 4] << 16); @@ -84,23 +84,23 @@ namespace DiscImageChef.Decoders.SCSI } } - if (deviceType == PeripheralDeviceTypes.DirectAccess || deviceType == PeripheralDeviceTypes.MultiMediaDevice) + if(deviceType == PeripheralDeviceTypes.DirectAccess || deviceType == PeripheralDeviceTypes.MultiMediaDevice) { header.WriteProtected = ((modeResponse[2] & 0x80) == 0x80); header.DPOFUA = ((modeResponse[2] & 0x10) == 0x10); } - if (deviceType == PeripheralDeviceTypes.SequentialAccess) + if(deviceType == PeripheralDeviceTypes.SequentialAccess) { header.WriteProtected = ((modeResponse[2] & 0x80) == 0x80); header.Speed = (byte)(modeResponse[2] & 0x0F); header.BufferedMode = (byte)((modeResponse[2] & 0x70) >> 4); } - if (deviceType == PeripheralDeviceTypes.PrinterDevice) + if(deviceType == PeripheralDeviceTypes.PrinterDevice) header.BufferedMode = (byte)((modeResponse[2] & 0x70) >> 4); - if (deviceType == PeripheralDeviceTypes.OpticalDevice) + if(deviceType == PeripheralDeviceTypes.OpticalDevice) { header.WriteProtected = ((modeResponse[2] & 0x80) == 0x80); header.EBC = ((modeResponse[2] & 0x01) == 0x01); @@ -117,23 +117,23 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModeHeader(ModeHeader? header, PeripheralDeviceTypes deviceType) { - if (!header.HasValue) + if(!header.HasValue) return null; StringBuilder sb = new StringBuilder(); sb.AppendLine("SCSI Mode Sense Header:"); - switch (deviceType) + switch(deviceType) { #region Direct access device mode header case PeripheralDeviceTypes.DirectAccess: { - if (header.Value.MediumType != MediumTypes.Default) + if(header.Value.MediumType != MediumTypes.Default) { sb.Append("\tMedium is "); - switch (header.Value.MediumType) + switch(header.Value.MediumType) { case MediumTypes.ECMA54: sb.AppendLine("ECMA-54: 200 mm Flexible Disk Cartridge using Two-Frequency Recording at 13262 ftprad on One Side"); @@ -213,18 +213,18 @@ namespace DiscImageChef.Decoders.SCSI } } - if (header.Value.WriteProtected) + if(header.Value.WriteProtected) sb.AppendLine("\tMedium is write protected"); - if (header.Value.DPOFUA) + if(header.Value.DPOFUA) sb.AppendLine("\tDrive supports DPO and FUA bits"); - if (header.Value.BlockDescriptors != null) + if(header.Value.BlockDescriptors != null) { - foreach (BlockDescriptor descriptor in header.Value.BlockDescriptors) + foreach(BlockDescriptor descriptor in header.Value.BlockDescriptors) { string density = ""; - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Default: break; @@ -242,16 +242,16 @@ namespace DiscImageChef.Decoders.SCSI break; } - if (density != "") + if(density != "") { - if (descriptor.Blocks == 0) + if(descriptor.Blocks == 0) sb.AppendFormat("\tAll remaining blocks have {0} and are {1} bytes each", density, descriptor.BlockLength).AppendLine(); else sb.AppendFormat("\t{0} blocks have {1} and are {2} bytes each", descriptor.Blocks, density, descriptor.BlockLength).AppendLine(); } else { - if (descriptor.Blocks == 0) + if(descriptor.Blocks == 0) sb.AppendFormat("\tAll remaining blocks are {0} bytes each", descriptor.BlockLength).AppendLine(); else sb.AppendFormat("\t{0} blocks are {1} bytes each", descriptor.Blocks, descriptor.BlockLength).AppendLine(); @@ -261,11 +261,11 @@ namespace DiscImageChef.Decoders.SCSI break; } - #endregion Direct access device mode header - #region Sequential access device mode header + #endregion Direct access device mode header + #region Sequential access device mode header case PeripheralDeviceTypes.SequentialAccess: { - switch (header.Value.BufferedMode) + switch(header.Value.BufferedMode) { case 0: sb.AppendLine("\tDevice writes directly to media"); @@ -281,17 +281,17 @@ namespace DiscImageChef.Decoders.SCSI break; } - if (header.Value.Speed == 0) + if(header.Value.Speed == 0) sb.AppendLine("\tDevice uses default speed"); else sb.AppendFormat("\tDevice uses speed {0}", header.Value.Speed).AppendLine(); - if (header.Value.WriteProtected) + if(header.Value.WriteProtected) sb.AppendLine("\tMedium is write protected"); string medium = ""; - switch (header.Value.MediumType) + switch(header.Value.MediumType) { case MediumTypes.Default: medium = "undefined"; @@ -474,16 +474,16 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendFormat("\tMedium is {0}", medium).AppendLine(); - if (header.Value.BlockDescriptors != null) + if(header.Value.BlockDescriptors != null) { - foreach (BlockDescriptor descriptor in header.Value.BlockDescriptors) + foreach(BlockDescriptor descriptor in header.Value.BlockDescriptors) { string density = ""; - switch (header.Value.MediumType) + switch(header.Value.MediumType) { case MediumTypes.Default: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Default: break; @@ -560,28 +560,28 @@ namespace DiscImageChef.Decoders.SCSI density = "IBM 3490E"; break; case DensityType.LTO1: - //case DensityType.SAIT1: + //case DensityType.SAIT1: density = "LTO Ultrium or Super AIT-1"; break; case DensityType.LTO2Old: density = "LTO Ultrium-2"; break; case DensityType.LTO2: - //case DensityType.T9840: + //case DensityType.T9840: density = "LTO Ultrium-2 or T9840"; break; case DensityType.T9940: density = "T9940"; break; case DensityType.LTO3: - //case DensityType.T9940: + //case DensityType.T9940: density = "LTO Ultrium-3 or T9940"; break; case DensityType.T9840C: density = "T9840C"; break; case DensityType.LTO4: - //case DensityType.T9840D: + //case DensityType.T9840D: density = "LTO Ultrium-4 or T9840D"; break; case DensityType.T10000A: @@ -613,7 +613,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.LTOWORM: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Default: density = "LTO Ultrium cleaning cartridge"; @@ -631,11 +631,11 @@ namespace DiscImageChef.Decoders.SCSI density = String.Format("unknown density code 0x{0:X2}", descriptor.Density); break; } - } - break; + } + break; case MediumTypes.LTO: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.LTO1: density = "LTO Ultrium"; @@ -648,7 +648,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.LTO2: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.LTO2: density = "LTO Ultrium-2"; @@ -661,7 +661,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.DDS3: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Default: density = "MLR1-26GB"; @@ -677,7 +677,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.DDS4: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Default: density = "DC-9200"; @@ -693,7 +693,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.DAT72: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.DAT72: density = "DAT-72"; @@ -707,7 +707,7 @@ namespace DiscImageChef.Decoders.SCSI case MediumTypes.LTO3: case MediumTypes.LTO3WORM: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.LTO3: density = "LTO Ultrium-3"; @@ -720,7 +720,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.DDSCleaning: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Default: density = "DDS cleaning cartridge"; @@ -734,7 +734,7 @@ namespace DiscImageChef.Decoders.SCSI case MediumTypes.LTO4: case MediumTypes.LTO4WORM: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.LTO4: density = "LTO Ultrium-4"; @@ -748,7 +748,7 @@ namespace DiscImageChef.Decoders.SCSI case MediumTypes.LTO5: case MediumTypes.LTO5WORM: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.LTO5: density = "LTO Ultrium-5"; @@ -762,7 +762,7 @@ namespace DiscImageChef.Decoders.SCSI case MediumTypes.LTO6: case MediumTypes.LTO6WORM: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.LTO6: density = "LTO Ultrium-6"; @@ -776,7 +776,7 @@ namespace DiscImageChef.Decoders.SCSI case MediumTypes.LTO7: case MediumTypes.LTO7WORM: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.LTO7: density = "LTO Ultrium-7"; @@ -789,7 +789,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.LTOCD: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.LTO2: density = "LTO Ultrium-2 in CD emulation mode"; @@ -811,7 +811,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.Exatape15m: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Ex8200: density = "EXB-8200"; @@ -845,7 +845,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.Exatape28m: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Ex8200: density = "EXB-8200"; @@ -888,7 +888,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.Exatape54m: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Ex8200: density = "EXB-8200"; @@ -926,7 +926,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.Exatape80m: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Ex8200: density = "EXB-8200"; @@ -958,7 +958,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.Exatape106m: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Ex8200: density = "EXB-8200"; @@ -1012,7 +1012,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.Exatape106mXL: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Ex8200: density = "EXB-8200"; @@ -1034,7 +1034,7 @@ namespace DiscImageChef.Decoders.SCSI density = "Super DLTtape I at 133000 bpi"; break; case DensityType.SDLT1: - //case DensityType.SDLT1Alt: + //case DensityType.SDLT1Alt: density = "Super DLTtape I"; break; case DensityType.SDLT1c: @@ -1051,7 +1051,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.SDLT2: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.SDLT2: density = "Super DLTtape II"; @@ -1064,7 +1064,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.VStapeI: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.VStape1: case DensityType.VStape1Alt: @@ -1081,7 +1081,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.DLTtapeS4: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.DLTS4: density = "DLTtape S4"; @@ -1094,7 +1094,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.Exatape22m: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Ex8200: density = "EXB-8200"; @@ -1116,7 +1116,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.Exatape40m: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Ex8200: density = "EXB-8200"; @@ -1141,7 +1141,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.Exatape76m: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Ex8200: density = "EXB-8200"; @@ -1166,7 +1166,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.Exatape112m: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Ex8200: density = "EXB-8200"; @@ -1197,7 +1197,7 @@ namespace DiscImageChef.Decoders.SCSI case MediumTypes.Exatape150m: case MediumTypes.Exatape75m: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Mammoth: density = "Mammoth"; @@ -1213,7 +1213,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.DC2900SL: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Default: density = "DC-2900SL"; @@ -1226,7 +1226,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.DC9250: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Default: density = "DC-9250"; @@ -1239,7 +1239,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.SLR32: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Default: density = "SLR-32"; @@ -1252,7 +1252,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.MLR1SL: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Default: density = "MRL1-26GBSL"; @@ -1265,7 +1265,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.SLRtape50: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Default: density = "SLRtape-50"; @@ -1278,7 +1278,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.SLRtape50SL: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Default: density = "SLRtape-50 SL"; @@ -1291,7 +1291,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.SLR32SL: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Default: density = "SLR-32 SL"; @@ -1304,7 +1304,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.SLR5: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Default: density = "SLR-5"; @@ -1317,7 +1317,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.SLR5SL: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Default: density = "SLR-5 SL"; @@ -1330,7 +1330,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.SLRtape7: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Default: density = "SLRtape-7"; @@ -1343,7 +1343,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.SLRtape7SL: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Default: density = "SLRtape-7 SL"; @@ -1356,7 +1356,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.SLRtape24: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Default: density = "SLRtape-24"; @@ -1369,7 +1369,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.SLRtape24SL: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Default: density = "SLRtape-24 SL"; @@ -1382,7 +1382,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.SLRtape140: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Default: density = "SLRtape-140"; @@ -1395,7 +1395,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.SLRtape40: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Default: density = "SLRtape-40"; @@ -1408,7 +1408,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.SLRtape60: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Default: density = "SLRtape-60 or SLRtape-75"; @@ -1421,7 +1421,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.SLRtape100: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Default: density = "SLRtape-100"; @@ -1434,7 +1434,7 @@ namespace DiscImageChef.Decoders.SCSI break; case MediumTypes.SLR40_60_100: { - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Default: density = "SLR40, SLR60 or SLR100"; @@ -1445,23 +1445,23 @@ namespace DiscImageChef.Decoders.SCSI } } break; - default: - density = String.Format("unknown density code 0x{0:X2}", descriptor.Density); - break; + default: + density = String.Format("unknown density code 0x{0:X2}", descriptor.Density); + break; } - if (density != "") + if(density != "") { - if (descriptor.Blocks == 0) + if(descriptor.Blocks == 0) { - if (descriptor.BlockLength == 0) + if(descriptor.BlockLength == 0) sb.AppendFormat("\tAll remaining blocks conform to {0} and have a variable length", density).AppendLine(); else sb.AppendFormat("\tAll remaining blocks conform to {0} and are {1} bytes each", density, descriptor.BlockLength).AppendLine(); } else { - if (descriptor.BlockLength == 0) + if(descriptor.BlockLength == 0) sb.AppendFormat("\t{0} blocks conform to {1} and have a variable length", descriptor.Blocks, density).AppendLine(); else sb.AppendFormat("\t{0} blocks conform to {1} and are {2} bytes each", descriptor.Blocks, density, descriptor.BlockLength).AppendLine(); @@ -1469,16 +1469,16 @@ namespace DiscImageChef.Decoders.SCSI } else { - if (descriptor.Blocks == 0) + if(descriptor.Blocks == 0) { - if (descriptor.BlockLength == 0) + if(descriptor.BlockLength == 0) sb.AppendFormat("\tAll remaining blocks have a variable length").AppendLine(); else sb.AppendFormat("\tAll remaining blocks are {0} bytes each", descriptor.BlockLength).AppendLine(); } else { - if (descriptor.BlockLength == 0) + if(descriptor.BlockLength == 0) sb.AppendFormat("\t{0} blocks have a variable length", descriptor.Blocks).AppendLine(); else sb.AppendFormat("\t{0} blocks are {1} bytes each", descriptor.Blocks, descriptor.BlockLength).AppendLine(); @@ -1493,7 +1493,7 @@ namespace DiscImageChef.Decoders.SCSI #region Printer device mode header case PeripheralDeviceTypes.PrinterDevice: { - switch (header.Value.BufferedMode) + switch(header.Value.BufferedMode) { case 0: sb.AppendLine("\tDevice prints directly"); @@ -1511,11 +1511,11 @@ namespace DiscImageChef.Decoders.SCSI #region Optical device mode header case PeripheralDeviceTypes.OpticalDevice: { - if (header.Value.MediumType != MediumTypes.Default) + if(header.Value.MediumType != MediumTypes.Default) { sb.Append("\tMedium is "); - switch (header.Value.MediumType) + switch(header.Value.MediumType) { case MediumTypes.ReadOnly: sb.AppendLine("a Read-only optical"); @@ -1544,19 +1544,19 @@ namespace DiscImageChef.Decoders.SCSI } } - if (header.Value.WriteProtected) + if(header.Value.WriteProtected) sb.AppendLine("\tMedium is write protected"); - if (header.Value.EBC) + if(header.Value.EBC) sb.AppendLine("\tBlank checking during write is enabled"); - if (header.Value.DPOFUA) + if(header.Value.DPOFUA) sb.AppendLine("\tDrive supports DPO and FUA bits"); - if (header.Value.BlockDescriptors != null) + if(header.Value.BlockDescriptors != null) { - foreach (BlockDescriptor descriptor in header.Value.BlockDescriptors) + foreach(BlockDescriptor descriptor in header.Value.BlockDescriptors) { string density = ""; - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Default: break; @@ -1592,18 +1592,18 @@ namespace DiscImageChef.Decoders.SCSI break; } - if (density != "") + if(density != "") { - if (descriptor.Blocks == 0) + if(descriptor.Blocks == 0) { - if (descriptor.BlockLength == 0) + if(descriptor.BlockLength == 0) sb.AppendFormat("\tAll remaining blocks are {0} and have a variable length", density).AppendLine(); else sb.AppendFormat("\tAll remaining blocks are {0} and are {1} bytes each", density, descriptor.BlockLength).AppendLine(); } else { - if (descriptor.BlockLength == 0) + if(descriptor.BlockLength == 0) sb.AppendFormat("\t{0} blocks are {1} and have a variable length", descriptor.Blocks, density).AppendLine(); else sb.AppendFormat("\t{0} blocks are {1} and are {2} bytes each", descriptor.Blocks, density, descriptor.BlockLength).AppendLine(); @@ -1611,16 +1611,16 @@ namespace DiscImageChef.Decoders.SCSI } else { - if (descriptor.Blocks == 0) + if(descriptor.Blocks == 0) { - if (descriptor.BlockLength == 0) + if(descriptor.BlockLength == 0) sb.AppendFormat("\tAll remaining blocks have a variable length").AppendLine(); else sb.AppendFormat("\tAll remaining blocks are {0} bytes each", descriptor.BlockLength).AppendLine(); } else { - if (descriptor.BlockLength == 0) + if(descriptor.BlockLength == 0) sb.AppendFormat("\t{0} blocks have a variable length", descriptor.Blocks).AppendLine(); else sb.AppendFormat("\t{0} blocks are {1} bytes each", descriptor.Blocks, descriptor.BlockLength).AppendLine(); @@ -1631,13 +1631,13 @@ namespace DiscImageChef.Decoders.SCSI break; } - #endregion Optical device mode header - #region Multimedia device mode header + #endregion Optical device mode header + #region Multimedia device mode header case PeripheralDeviceTypes.MultiMediaDevice: { sb.Append("\tMedium is "); - switch (header.Value.MediumType) + switch(header.Value.MediumType) { case MediumTypes.CDROM: sb.AppendLine("120 mm CD-ROM"); @@ -1752,18 +1752,18 @@ namespace DiscImageChef.Decoders.SCSI break; } - if (header.Value.WriteProtected) + if(header.Value.WriteProtected) sb.AppendLine("\tMedium is write protected"); - if (header.Value.DPOFUA) + if(header.Value.DPOFUA) sb.AppendLine("\tDrive supports DPO and FUA bits"); - if (header.Value.BlockDescriptors != null) + if(header.Value.BlockDescriptors != null) { - foreach (BlockDescriptor descriptor in header.Value.BlockDescriptors) + foreach(BlockDescriptor descriptor in header.Value.BlockDescriptors) { string density = ""; - switch (descriptor.Density) + switch(descriptor.Density) { case DensityType.Default: break; @@ -1796,16 +1796,16 @@ namespace DiscImageChef.Decoders.SCSI break; } - if (density != "") + if(density != "") { - if (descriptor.Blocks == 0) + if(descriptor.Blocks == 0) sb.AppendFormat("\tAll remaining blocks have {0} and are {1} bytes each", density, descriptor.BlockLength).AppendLine(); else sb.AppendFormat("\t{0} blocks have {1} and are {2} bytes each", descriptor.Blocks, density, descriptor.BlockLength).AppendLine(); } else { - if (descriptor.Blocks == 0) + if(descriptor.Blocks == 0) sb.AppendFormat("\tAll remaining blocks are {0} bytes each", descriptor.BlockLength).AppendLine(); else sb.AppendFormat("\t{0} blocks are {1} bytes each", descriptor.Blocks, descriptor.BlockLength).AppendLine(); @@ -1815,7 +1815,7 @@ namespace DiscImageChef.Decoders.SCSI break; } - #endregion Multimedia device mode header + #endregion Multimedia device mode header default: break; } @@ -1825,7 +1825,7 @@ namespace DiscImageChef.Decoders.SCSI public static ModeHeader? DecodeModeHeader10(byte[] modeResponse, PeripheralDeviceTypes deviceType) { - if (modeResponse == null || modeResponse.Length < 8) + if(modeResponse == null || modeResponse.Length < 8) return null; ushort modeLength; @@ -1834,7 +1834,7 @@ namespace DiscImageChef.Decoders.SCSI modeLength = (ushort)((modeResponse[0] << 8) + modeResponse[1]); blockDescLength = (ushort)((modeResponse[6] << 8) + modeResponse[7]); - if (modeResponse.Length < modeLength) + if(modeResponse.Length < modeLength) return null; ModeHeader header = new ModeHeader(); @@ -1842,12 +1842,12 @@ namespace DiscImageChef.Decoders.SCSI bool longLBA = (modeResponse[4] & 0x01) == 0x01; - if (blockDescLength > 0) + if(blockDescLength > 0) { - if (longLBA) + if(longLBA) { header.BlockDescriptors = new BlockDescriptor[blockDescLength / 16]; - for (int i = 0; i < header.BlockDescriptors.Length; i++) + for(int i = 0; i < header.BlockDescriptors.Length; i++) { header.BlockDescriptors[i] = new BlockDescriptor(); header.BlockDescriptors[i].Density = DensityType.Default; @@ -1870,10 +1870,10 @@ namespace DiscImageChef.Decoders.SCSI else { header.BlockDescriptors = new BlockDescriptor[blockDescLength / 8]; - for (int i = 0; i < header.BlockDescriptors.Length; i++) + for(int i = 0; i < header.BlockDescriptors.Length; i++) { header.BlockDescriptors[i] = new BlockDescriptor(); - if (deviceType != PeripheralDeviceTypes.DirectAccess) + if(deviceType != PeripheralDeviceTypes.DirectAccess) { header.BlockDescriptors[i].Density = (DensityType)modeResponse[0 + i * 8 + 8]; } @@ -1892,23 +1892,23 @@ namespace DiscImageChef.Decoders.SCSI } } - if (deviceType == PeripheralDeviceTypes.DirectAccess || deviceType == PeripheralDeviceTypes.MultiMediaDevice) + if(deviceType == PeripheralDeviceTypes.DirectAccess || deviceType == PeripheralDeviceTypes.MultiMediaDevice) { header.WriteProtected = ((modeResponse[3] & 0x80) == 0x80); header.DPOFUA = ((modeResponse[3] & 0x10) == 0x10); } - if (deviceType == PeripheralDeviceTypes.SequentialAccess) + if(deviceType == PeripheralDeviceTypes.SequentialAccess) { header.WriteProtected = ((modeResponse[3] & 0x80) == 0x80); header.Speed = (byte)(modeResponse[3] & 0x0F); header.BufferedMode = (byte)((modeResponse[3] & 0x70) >> 4); } - if (deviceType == PeripheralDeviceTypes.PrinterDevice) + if(deviceType == PeripheralDeviceTypes.PrinterDevice) header.BufferedMode = (byte)((modeResponse[3] & 0x70) >> 4); - if (deviceType == PeripheralDeviceTypes.OpticalDevice) + if(deviceType == PeripheralDeviceTypes.OpticalDevice) { header.WriteProtected = ((modeResponse[3] & 0x80) == 0x80); header.EBC = ((modeResponse[3] & 0x01) == 0x01); @@ -2049,19 +2049,19 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_0A? DecodeModePage_0A(byte[] pageResponse) { - if (pageResponse == null) + if(pageResponse == null) return null; - if ((pageResponse[0] & 0x40) == 0x40) + if((pageResponse[0] & 0x40) == 0x40) return null; - if ((pageResponse[0] & 0x3F) != 0x0A) + if((pageResponse[0] & 0x3F) != 0x0A) return null; - if (pageResponse[1] + 2 != pageResponse.Length) + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if (pageResponse.Length < 8) + if(pageResponse.Length < 8) return null; ModePage_0A decoded = new ModePage_0A(); @@ -2080,7 +2080,7 @@ namespace DiscImageChef.Decoders.SCSI decoded.ReadyAENHoldOffPeriod = (ushort)((pageResponse[6] << 8) + pageResponse[7]); - if (pageResponse.Length < 10) + if(pageResponse.Length < 10) return decoded; // SPC-1 @@ -2120,7 +2120,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_0A(ModePage_0A? modePage) { - if (!modePage.HasValue) + if(!modePage.HasValue) return null; ModePage_0A page = modePage.Value; @@ -2128,46 +2128,46 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("SCSI Control mode page:"); - if (page.PS) + if(page.PS) sb.AppendLine("\tParameters can be saved"); - if (page.RLEC) + if(page.RLEC) sb.AppendLine("\tIf set, target shall report log exception conditions"); - if (page.DQue) + if(page.DQue) sb.AppendLine("\tTagged queuing is disabled"); - if (page.EECA) + if(page.EECA) sb.AppendLine("\tExtended Contingent Allegiance is enabled"); - if (page.RAENP) + if(page.RAENP) sb.AppendLine("\tTarget may issue an asynchronous event notification upon completing its initialization"); - if (page.UAAENP) + if(page.UAAENP) sb.AppendLine("\tTarget may issue an asynchronous event notification instead of a unit attention condition"); - if (page.EAENP) + if(page.EAENP) sb.AppendLine("\tTarget may issue an asynchronous event notification instead of a deferred error"); - if (page.GLTSD) + if(page.GLTSD) sb.AppendLine("\tGlobal logging target save disabled"); - if (page.RAC) + if(page.RAC) sb.AppendLine("\tCHECK CONDITION should be reported rather than a long busy condition"); - if (page.SWP) + if(page.SWP) sb.AppendLine("\tSoftware write protect is active"); - if (page.TAS) + if(page.TAS) sb.AppendLine("\tTasks aborted by other initiator's actions should be terminated with TASK ABORTED"); - if (page.TMF_ONLY) + if(page.TMF_ONLY) sb.AppendLine("\tAll tasks received in nexus with ACA ACTIVE is set and an ACA condition is established shall terminate"); - if (page.D_SENSE) + if(page.D_SENSE) sb.AppendLine("\tDevice shall return descriptor format sense data when returning sense data in the same transactions as a CHECK CONDITION"); - if (page.ATO) + if(page.ATO) sb.AppendLine("\tLOGICAL BLOCK APPLICATION TAG should not be modified"); - if (page.DPICZ) + if(page.DPICZ) sb.AppendLine("\tProtector information checking is disabled"); - if (page.NUAR) + if(page.NUAR) sb.AppendLine("\tNo unit attention on release"); - if (page.ATMPE) + if(page.ATMPE) sb.AppendLine("\tApplication Tag mode page is enabled"); - if (page.RWWP) + if(page.RWWP) sb.AppendLine("\tAbort any write command without protection information"); - if (page.SBLP) + if(page.SBLP) sb.AppendLine("\tSupportes block lengths and protection information"); - switch (page.TST) + switch(page.TST) { case 0: sb.AppendLine("\tThe logical unit maintains one task set for all nexuses"); @@ -2180,7 +2180,7 @@ namespace DiscImageChef.Decoders.SCSI break; } - switch (page.QueueAlgorithm) + switch(page.QueueAlgorithm) { case 0: sb.AppendLine("\tCommands should be sent strictly ordered"); @@ -2193,7 +2193,7 @@ namespace DiscImageChef.Decoders.SCSI break; } - switch (page.QErr) + switch(page.QErr) { case 0: sb.AppendLine("\tIf ACA is established, the task set commands shall resume after it is cleared, otherwise they shall terminate with CHECK CONDITION"); @@ -2209,7 +2209,7 @@ namespace DiscImageChef.Decoders.SCSI break; } - switch (page.UA_INTLCK_CTRL) + switch(page.UA_INTLCK_CTRL) { case 0: sb.AppendLine("\tLUN shall clear unit attention condition reported in the same nexus"); @@ -2225,7 +2225,7 @@ namespace DiscImageChef.Decoders.SCSI break; } - switch (page.AutoloadMode) + switch(page.AutoloadMode) { case 0: sb.AppendLine("\tOn medium insertion, it shall be loaded for full access"); @@ -2241,18 +2241,18 @@ namespace DiscImageChef.Decoders.SCSI break; } - if (page.ReadyAENHoldOffPeriod > 0) + if(page.ReadyAENHoldOffPeriod > 0) sb.AppendFormat("\t{0} ms before attempting asynchronous event notifications after initialization", page.ReadyAENHoldOffPeriod).AppendLine(); - if (page.BusyTimeoutPeriod > 0) + if(page.BusyTimeoutPeriod > 0) { - if (page.BusyTimeoutPeriod == 0xFFFF) + if(page.BusyTimeoutPeriod == 0xFFFF) sb.AppendLine("\tThere is no limit on the maximum time that is allowed to remain busy"); else sb.AppendFormat("\tA maximum of {0} ms are allowed to remain busy", (int)page.BusyTimeoutPeriod * 100).AppendLine(); } - if (page.ExtendedSelfTestCompletionTime > 0) + if(page.ExtendedSelfTestCompletionTime > 0) sb.AppendFormat("\t{0} seconds to complete extended self-test", page.ExtendedSelfTestCompletionTime); return sb.ToString(); @@ -2322,19 +2322,19 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_02? DecodeModePage_02(byte[] pageResponse) { - if (pageResponse == null) + if(pageResponse == null) return null; - if ((pageResponse[0] & 0x40) == 0x40) + if((pageResponse[0] & 0x40) == 0x40) return null; - if ((pageResponse[0] & 0x3F) != 0x02) + if((pageResponse[0] & 0x3F) != 0x02) return null; - if (pageResponse[1] + 2 != pageResponse.Length) + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if (pageResponse.Length < 16) + if(pageResponse.Length < 16) return null; ModePage_02 decoded = new ModePage_02(); @@ -2362,7 +2362,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_02(ModePage_02? modePage) { - if (!modePage.HasValue) + if(!modePage.HasValue) return null; ModePage_02 page = modePage.Value; @@ -2370,29 +2370,29 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("SCSI Disconnect-Reconnect mode page:"); - if (page.PS) + if(page.PS) sb.AppendLine("\tParameters can be saved"); - if (page.BufferFullRatio > 0) + if(page.BufferFullRatio > 0) sb.AppendFormat("\t{0} ratio of buffer that shall be full prior to attempting a reselection", page.BufferFullRatio).AppendLine(); - if (page.BufferEmptyRatio > 0) + if(page.BufferEmptyRatio > 0) sb.AppendFormat("\t{0} ratio of buffer that shall be empty prior to attempting a reselection", page.BufferEmptyRatio).AppendLine(); - if (page.BusInactivityLimit > 0) + if(page.BusInactivityLimit > 0) sb.AppendFormat("\t{0} µs maximum permitted to assert BSY without a REQ/ACK handshake", (int)page.BusInactivityLimit * 100).AppendLine(); - if (page.DisconnectTimeLimit > 0) + if(page.DisconnectTimeLimit > 0) sb.AppendFormat("\t{0} µs maximum permitted wait after releasing the bus before attempting reselection", (int)page.DisconnectTimeLimit * 100).AppendLine(); - if (page.ConnectTimeLimit > 0) + if(page.ConnectTimeLimit > 0) sb.AppendFormat("\t{0} µs allowed to use the bus before disconnecting, if granted the privilege and not restricted", (int)page.ConnectTimeLimit * 100).AppendLine(); - if (page.MaxBurstSize > 0) + if(page.MaxBurstSize > 0) sb.AppendFormat("\t{0} bytes maximum can be transferred before disconnecting", (int)page.MaxBurstSize * 512).AppendLine(); - if (page.FirstBurstSize > 0) + if(page.FirstBurstSize > 0) sb.AppendFormat("\t{0} bytes maximum can be transferred for a command along with the disconnect command", (int)page.FirstBurstSize * 512).AppendLine(); - if (page.DIMM) + if(page.DIMM) sb.AppendLine("\tTarget shall not transfer data for a command during the same interconnect tenancy"); - if (page.EMDP) + if(page.EMDP) sb.AppendLine("\tTarget is allowed to re-order the data transfer"); - switch (page.DTDC) + switch(page.DTDC) { case 0: sb.AppendLine("\tData transfer disconnect control is not used"); @@ -2514,19 +2514,19 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_08? DecodeModePage_08(byte[] pageResponse) { - if (pageResponse == null) + if(pageResponse == null) return null; - if ((pageResponse[0] & 0x40) == 0x40) + if((pageResponse[0] & 0x40) == 0x40) return null; - if ((pageResponse[0] & 0x3F) != 0x08) + if((pageResponse[0] & 0x3F) != 0x08) return null; - if (pageResponse[1] + 2 != pageResponse.Length) + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if (pageResponse.Length < 12) + if(pageResponse.Length < 12) return null; ModePage_08 decoded = new ModePage_08(); @@ -2543,7 +2543,7 @@ namespace DiscImageChef.Decoders.SCSI decoded.MaximumPreFetch = (ushort)((pageResponse[8] << 8) + pageResponse[9]); decoded.MaximumPreFetchCeiling = (ushort)((pageResponse[10] << 8) + pageResponse[11]); - if (pageResponse.Length < 20) + if(pageResponse.Length < 20) return decoded; decoded.IC |= (pageResponse[2] & 0x80) == 0x80; @@ -2572,7 +2572,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_08(ModePage_08? modePage) { - if (!modePage.HasValue) + if(!modePage.HasValue) return null; ModePage_08 page = modePage.Value; @@ -2580,14 +2580,14 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("SCSI Caching mode page:"); - if (page.PS) + if(page.PS) sb.AppendLine("\tParameters can be saved"); - if (page.RCD) + if(page.RCD) sb.AppendLine("\tRead-cache is enabled"); - if (page.WCE) + if(page.WCE) sb.AppendLine("\tWrite-cache is enabled"); - - switch (page.DemandReadRetentionPrio) + + switch(page.DemandReadRetentionPrio) { case 0: sb.AppendLine("\tDrive does not distinguish between cached read data"); @@ -2603,7 +2603,7 @@ namespace DiscImageChef.Decoders.SCSI break; } - switch (page.WriteRetentionPriority) + switch(page.WriteRetentionPriority) { case 0: sb.AppendLine("\tDrive does not distinguish between cached write data"); @@ -2619,45 +2619,45 @@ namespace DiscImageChef.Decoders.SCSI break; } - if (page.DRA) + if(page.DRA) sb.AppendLine("\tRead-ahead is disabled"); else { - if (page.MF) + if(page.MF) sb.AppendLine("\tPre-fetch values indicate a block multiplier"); - if (page.DisablePreFetch == 0) + if(page.DisablePreFetch == 0) sb.AppendLine("\tNo pre-fetch will be done"); else { sb.AppendFormat("\tPre-fetch will be done for READ commands of {0} blocks or less", page.DisablePreFetch).AppendLine(); - if (page.MinimumPreFetch > 0) + if(page.MinimumPreFetch > 0) sb.AppendFormat("At least {0} blocks will be always pre-fetched", page.MinimumPreFetch).AppendLine(); - if (page.MaximumPreFetch > 0) + if(page.MaximumPreFetch > 0) sb.AppendFormat("\tA maximum of {0} blocks will be pre-fetched", page.MaximumPreFetch).AppendLine(); - if (page.MaximumPreFetchCeiling > 0) + if(page.MaximumPreFetchCeiling > 0) sb.AppendFormat("\tA maximum of {0} blocks will be pre-fetched even if it is commanded to pre-fetch more", page.MaximumPreFetchCeiling).AppendLine(); - if (page.IC) + if(page.IC) sb.AppendLine("\tDevice should use number of cache segments or cache segment size for caching"); - if (page.ABPF) + if(page.ABPF) sb.AppendLine("\tPre-fetch should be aborted upong receiving a new command"); - if (page.CAP) + if(page.CAP) sb.AppendLine("\tCaching analysis is permitted"); - if (page.Disc) + if(page.Disc) sb.AppendLine("\tPre-fetch can continue across discontinuities (such as cylinders or tracks)"); } } - if (page.FSW) + if(page.FSW) sb.AppendLine("\tDrive should not reorder the sequence of write commands to be faster"); - if (page.Size) + if(page.Size) { - if (page.CacheSegmentSize > 0) + if(page.CacheSegmentSize > 0) { - if (page.LBCSS) + if(page.LBCSS) sb.AppendFormat("\tDrive cache segments should be {0} blocks long", page.CacheSegmentSize).AppendLine(); else sb.AppendFormat("\tDrive cache segments should be {0} bytes long", page.CacheSegmentSize).AppendLine(); @@ -2665,14 +2665,14 @@ namespace DiscImageChef.Decoders.SCSI } else { - if (page.CacheSegments > 0) + if(page.CacheSegments > 0) sb.AppendFormat("\tDrive should have {0} cache segments", page.CacheSegments).AppendLine(); } - if (page.NonCacheSegmentSize > 0) + if(page.NonCacheSegmentSize > 0) sb.AppendFormat("\tDrive shall allocate {0} bytes to buffer even when all cached data cannot be evicted", page.NonCacheSegmentSize).AppendLine(); - if (page.NV_DIS) + if(page.NV_DIS) sb.AppendLine("\tNon-Volatile cache is disabled"); return sb.ToString(); @@ -2798,19 +2798,19 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_05? DecodeModePage_05(byte[] pageResponse) { - if (pageResponse == null) + if(pageResponse == null) return null; - if ((pageResponse[0] & 0x40) == 0x40) + if((pageResponse[0] & 0x40) == 0x40) return null; - if ((pageResponse[0] & 0x3F) != 0x05) + if((pageResponse[0] & 0x3F) != 0x05) return null; - if (pageResponse[1] + 2 != pageResponse.Length) + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if (pageResponse.Length < 32) + if(pageResponse.Length < 32) return null; ModePage_05 decoded = new ModePage_05(); @@ -2851,7 +2851,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_05(ModePage_05? modePage) { - if (!modePage.HasValue) + if(!modePage.HasValue) return null; ModePage_05 page = modePage.Value; @@ -2859,7 +2859,7 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("SCSI Flexible disk page:"); - if (page.PS) + if(page.PS) sb.AppendLine("\tParameters can be saved"); sb.AppendFormat("\tTransfer rate: {0} kbit/s", page.TransferRate).AppendLine(); @@ -2867,141 +2867,141 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendFormat("\t{0} cylinders", page.Cylinders).AppendLine(); sb.AppendFormat("\t{0} sectors per track", page.SectorsPerTrack).AppendLine(); sb.AppendFormat("\t{0} bytes per sector", page.BytesPerSector).AppendLine(); - if (page.WritePrecompCylinder < page.Cylinders) + if(page.WritePrecompCylinder < page.Cylinders) sb.AppendFormat("\tWrite pre-compensation starts at cylinder {0}", page.WritePrecompCylinder).AppendLine(); - if (page.WriteReduceCylinder < page.Cylinders) + if(page.WriteReduceCylinder < page.Cylinders) sb.AppendFormat("\tWrite current reduction starts at cylinder {0}", page.WriteReduceCylinder).AppendLine(); - if (page.DriveStepRate > 0) + if(page.DriveStepRate > 0) sb.AppendFormat("\tDrive steps in {0} μs", (uint)page.DriveStepRate * 100).AppendLine(); - if (page.DriveStepPulse > 0) + if(page.DriveStepPulse > 0) sb.AppendFormat("\tEach step pulse is {0} ms", page.DriveStepPulse).AppendLine(); - if (page.HeadSettleDelay > 0) + if(page.HeadSettleDelay > 0) sb.AppendFormat("\tHeads settles in {0} μs", (uint)page.HeadSettleDelay * 100).AppendLine(); - if (!page.TRDY) + if(!page.TRDY) sb.AppendFormat("\tTarget shall wait {0} seconds before attempting to access the medium after motor on is asserted", (double)page.MotorOnDelay * 10).AppendLine(); else sb.AppendFormat("\tTarget shall wait {0} seconds after drive is ready before aborting medium access attemps", (double)page.MotorOnDelay * 10).AppendLine(); - if (page.MotorOffDelay != 0xFF) + if(page.MotorOffDelay != 0xFF) sb.AppendFormat("\tTarget shall wait {0} seconds before releasing the motor on signal after becoming idle", (double)page.MotorOffDelay * 10).AppendLine(); else sb.AppendLine("\tTarget shall never release the motor on signal"); - if (page.TRDY) + if(page.TRDY) sb.AppendLine("\tThere is a drive ready signal"); - if (page.SSN) + if(page.SSN) sb.AppendLine("\tSectors start at 1"); - if (page.MO) + if(page.MO) sb.AppendLine("\tThe motor on signal shall remain released"); sb.AppendFormat("\tDrive needs to do {0} step pulses per cylinder", page.SPC + 1).AppendLine(); - if (page.WriteCompensation > 0) + if(page.WriteCompensation > 0) sb.AppendFormat("\tWrite pre-compensation is {0}", page.WriteCompensation).AppendLine(); - if (page.HeadLoadDelay > 0) + if(page.HeadLoadDelay > 0) sb.AppendFormat("\tHead takes {0} ms to load", page.HeadLoadDelay).AppendLine(); - if (page.HeadUnloadDelay > 0) + if(page.HeadUnloadDelay > 0) sb.AppendFormat("\tHead takes {0} ms to unload", page.HeadUnloadDelay).AppendLine(); - if (page.MediumRotationRate > 0) + if(page.MediumRotationRate > 0) sb.AppendFormat("\tMedium rotates at {0} rpm", page.MediumRotationRate).AppendLine(); - switch (page.Pin34 & 0x07) + switch(page.Pin34 & 0x07) { case 0: sb.AppendLine("\tPin 34 is unconnected"); break; case 1: sb.Append("\tPin 34 indicates drive is ready when active "); - if ((page.Pin34 & 0x08) == 0x08) + if((page.Pin34 & 0x08) == 0x08) sb.Append("high"); else sb.Append("low"); break; case 2: sb.Append("\tPin 34 indicates disk has changed when active "); - if ((page.Pin34 & 0x08) == 0x08) + if((page.Pin34 & 0x08) == 0x08) sb.Append("high"); else sb.Append("low"); break; default: sb.AppendFormat("\tPin 34 indicates unknown function {0} when active ", page.Pin34 & 0x07); - if ((page.Pin34 & 0x08) == 0x08) + if((page.Pin34 & 0x08) == 0x08) sb.Append("high"); else sb.Append("low"); break; } - switch (page.Pin4 & 0x07) + switch(page.Pin4 & 0x07) { case 0: sb.AppendLine("\tPin 4 is unconnected"); break; case 1: sb.Append("\tPin 4 indicates drive is in use when active "); - if ((page.Pin4 & 0x08) == 0x08) + if((page.Pin4 & 0x08) == 0x08) sb.Append("high"); else sb.Append("low"); break; case 2: sb.Append("\tPin 4 indicates eject when active "); - if ((page.Pin4 & 0x08) == 0x08) + if((page.Pin4 & 0x08) == 0x08) sb.Append("high"); else sb.Append("low"); break; case 3: sb.Append("\tPin 4 indicates head load when active "); - if ((page.Pin4 & 0x08) == 0x08) + if((page.Pin4 & 0x08) == 0x08) sb.Append("high"); else sb.Append("low"); break; default: sb.AppendFormat("\tPin 4 indicates unknown function {0} when active ", page.Pin4 & 0x07); - if ((page.Pin4 & 0x08) == 0x08) + if((page.Pin4 & 0x08) == 0x08) sb.Append("high"); else sb.Append("low"); break; } - switch (page.Pin2 & 0x07) + switch(page.Pin2 & 0x07) { case 0: sb.AppendLine("\tPin 2 is unconnected"); break; default: sb.AppendFormat("\tPin 2 indicates unknown function {0} when active ", page.Pin2 & 0x07); - if ((page.Pin2 & 0x08) == 0x08) + if((page.Pin2 & 0x08) == 0x08) sb.Append("high"); else sb.Append("low"); break; } - switch (page.Pin1 & 0x07) + switch(page.Pin1 & 0x07) { case 0: sb.AppendLine("\tPin 1 is unconnected"); break; case 1: sb.Append("\tPin 1 indicates disk change reset when active "); - if ((page.Pin1 & 0x08) == 0x08) + if((page.Pin1 & 0x08) == 0x08) sb.Append("high"); else sb.Append("low"); break; default: sb.AppendFormat("\tPin 1 indicates unknown function {0} when active ", page.Pin1 & 0x07); - if ((page.Pin1 & 0x08) == 0x08) + if((page.Pin1 & 0x08) == 0x08) sb.Append("high"); else sb.Append("low"); @@ -3083,19 +3083,19 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_03? DecodeModePage_03(byte[] pageResponse) { - if (pageResponse == null) + if(pageResponse == null) return null; - if ((pageResponse[0] & 0x40) == 0x40) + if((pageResponse[0] & 0x40) == 0x40) return null; - if ((pageResponse[0] & 0x3F) != 0x03) + if((pageResponse[0] & 0x3F) != 0x03) return null; - if (pageResponse[1] + 2 != pageResponse.Length) + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if (pageResponse.Length < 24) + if(pageResponse.Length < 24) return null; ModePage_03 decoded = new ModePage_03(); @@ -3125,7 +3125,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_03(ModePage_03? modePage) { - if (!modePage.HasValue) + if(!modePage.HasValue) return null; ModePage_03 page = modePage.Value; @@ -3133,7 +3133,7 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("SCSI Format device page:"); - if (page.PS) + if(page.PS) sb.AppendLine("\tParameters can be saved"); sb.AppendFormat("\t{0} tracks per zone to use in dividing the capacity for the purpose of allocating alternate sectors", page.TracksPerZone).AppendLine(); @@ -3145,13 +3145,13 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendFormat("\tTarget-dependent interleave value is {0}", page.Interleave).AppendLine(); sb.AppendFormat("\t{0} sectors between last block of one track and first block of the next", page.TrackSkew).AppendLine(); sb.AppendFormat("\t{0} sectors between last block of a cylinder and first block of the next one", page.CylinderSkew).AppendLine(); - if (page.SSEC) + if(page.SSEC) sb.AppendLine("\tDrive supports soft-sectoring format"); - if (page.HSEC) + if(page.HSEC) sb.AppendLine("\tDrive supports hard-sectoring format"); - if (page.RMB) + if(page.RMB) sb.AppendLine("\tDrive media is removable"); - if (page.SURF) + if(page.SURF) sb.AppendLine("\tSector addressing is progressively incremented in one surface before going to the next"); else sb.AppendLine("\tSector addressing is progressively incremented in one cylinder before going to the next"); @@ -3182,19 +3182,19 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_0B? DecodeModePage_0B(byte[] pageResponse) { - if (pageResponse == null) + if(pageResponse == null) return null; - if ((pageResponse[0] & 0x40) == 0x40) + if((pageResponse[0] & 0x40) == 0x40) return null; - if ((pageResponse[0] & 0x3F) != 0x0B) + if((pageResponse[0] & 0x3F) != 0x0B) return null; - if (pageResponse[1] + 2 != pageResponse.Length) + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if (pageResponse.Length < 8) + if(pageResponse.Length < 8) return null; ModePage_0B decoded = new ModePage_0B(); @@ -3215,7 +3215,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_0B(ModePage_0B? modePage) { - if (!modePage.HasValue) + if(!modePage.HasValue) return null; ModePage_0B page = modePage.Value; @@ -3223,7 +3223,7 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("SCSI Medium types supported page:"); - if (page.PS) + if(page.PS) sb.AppendLine("\tParameters can be saved"); // TODO: Implement it when all known medium types are supported @@ -3318,19 +3318,19 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_01? DecodeModePage_01(byte[] pageResponse) { - if (pageResponse == null) + if(pageResponse == null) return null; - if ((pageResponse[0] & 0x40) == 0x40) + if((pageResponse[0] & 0x40) == 0x40) return null; - if ((pageResponse[0] & 0x3F) != 0x01) + if((pageResponse[0] & 0x3F) != 0x01) return null; - if (pageResponse[1] + 2 != pageResponse.Length) + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if (pageResponse.Length < 8) + if(pageResponse.Length < 8) return null; ModePage_01 decoded = new ModePage_01(); @@ -3350,7 +3350,7 @@ namespace DiscImageChef.Decoders.SCSI decoded.HeadOffsetCount = (sbyte)pageResponse[5]; decoded.DataStrobeOffsetCount = (sbyte)pageResponse[6]; - if (pageResponse.Length < 12) + if(pageResponse.Length < 12) return decoded; decoded.WriteRetryCount = pageResponse[8]; @@ -3367,7 +3367,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_01(ModePage_01? modePage) { - if (!modePage.HasValue) + if(!modePage.HasValue) return null; ModePage_01 page = modePage.Value; @@ -3375,32 +3375,32 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("SCSI Read-write error recovery page:"); - if (page.PS) + if(page.PS) sb.AppendLine("\tParameters can be saved"); - if (page.AWRE) + if(page.AWRE) sb.AppendLine("\tAutomatic write reallocation is enabled"); - if (page.ARRE) + if(page.ARRE) sb.AppendLine("\tAutomatic read reallocation is enabled"); - if (page.TB) + if(page.TB) sb.AppendLine("\tData not recovered within limits shall be transferred back before a CHECK CONDITION"); - if (page.RC) + if(page.RC) sb.AppendLine("\tDrive will transfer the entire requested length without delaying to perform error recovery"); - if (page.EER) + if(page.EER) sb.AppendLine("\tDrive will use the most expedient form of error recovery first"); - if (page.PER) + if(page.PER) sb.AppendLine("\tDrive shall report recovered errors"); - if (page.DTE) + if(page.DTE) sb.AppendLine("\tTransfer will be terminated upon error detection"); - if (page.DCR) + if(page.DCR) sb.AppendLine("\tError correction is disabled"); - if (page.ReadRetryCount > 0) + if(page.ReadRetryCount > 0) sb.AppendFormat("\tDrive will repeat read operations {0} times", page.ReadRetryCount).AppendLine(); - if (page.WriteRetryCount > 0) + if(page.WriteRetryCount > 0) sb.AppendFormat("\tDrive will repeat write operations {0} times", page.WriteRetryCount).AppendLine(); - if (page.RecoveryTimeLimit > 0) + if(page.RecoveryTimeLimit > 0) sb.AppendFormat("\tDrive will employ a maximum of {0} ms to recover data", page.RecoveryTimeLimit).AppendLine(); - if (page.LBPERE) + if(page.LBPERE) sb.AppendLine("Logical block provisioning error reporting is enabled"); return sb.ToString(); @@ -3461,19 +3461,19 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_04? DecodeModePage_04(byte[] pageResponse) { - if (pageResponse == null) + if(pageResponse == null) return null; - if ((pageResponse[0] & 0x40) == 0x40) + if((pageResponse[0] & 0x40) == 0x40) return null; - if ((pageResponse[0] & 0x3F) != 0x04) + if((pageResponse[0] & 0x3F) != 0x04) return null; - if (pageResponse[1] + 2 != pageResponse.Length) + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if (pageResponse.Length < 24) + if(pageResponse.Length < 24) return null; ModePage_04 decoded = new ModePage_04(); @@ -3499,7 +3499,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_04(ModePage_04? modePage) { - if (!modePage.HasValue) + if(!modePage.HasValue) return null; ModePage_04 page = modePage.Value; @@ -3507,24 +3507,24 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("SCSI Rigid disk drive geometry page:"); - if (page.PS) + if(page.PS) sb.AppendLine("\tParameters can be saved"); sb.AppendFormat("\t{0} heads", page.Heads).AppendLine(); sb.AppendFormat("\t{0} cylinders", page.Cylinders).AppendLine(); - if (page.WritePrecompCylinder < page.Cylinders) + if(page.WritePrecompCylinder < page.Cylinders) sb.AppendFormat("\tWrite pre-compensation starts at cylinder {0}", page.WritePrecompCylinder).AppendLine(); - if (page.WriteReduceCylinder < page.Cylinders) + if(page.WriteReduceCylinder < page.Cylinders) sb.AppendFormat("\tWrite current reduction starts at cylinder {0}", page.WriteReduceCylinder).AppendLine(); - if (page.DriveStepRate > 0) + if(page.DriveStepRate > 0) sb.AppendFormat("\tDrive steps in {0} ns", (uint)page.DriveStepRate * 100).AppendLine(); sb.AppendFormat("\tHeads park in cylinder {0}", page.LandingCylinder).AppendLine(); - if (page.MediumRotationRate > 0) + if(page.MediumRotationRate > 0) sb.AppendFormat("\tMedium rotates at {0} rpm", page.MediumRotationRate).AppendLine(); - switch (page.RPL) + switch(page.RPL) { case 0: sb.AppendLine("\tSpindle synchronization is disable or unsupported"); @@ -3590,19 +3590,19 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_07? DecodeModePage_07(byte[] pageResponse) { - if (pageResponse == null) + if(pageResponse == null) return null; - if ((pageResponse[0] & 0x40) == 0x40) + if((pageResponse[0] & 0x40) == 0x40) return null; - if ((pageResponse[0] & 0x3F) != 0x07) + if((pageResponse[0] & 0x3F) != 0x07) return null; - if (pageResponse[1] + 2 != pageResponse.Length) + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if (pageResponse.Length < 12) + if(pageResponse.Length < 12) return null; ModePage_07 decoded = new ModePage_07(); @@ -3627,7 +3627,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_07(ModePage_07? modePage) { - if (!modePage.HasValue) + if(!modePage.HasValue) return null; ModePage_07 page = modePage.Value; @@ -3635,20 +3635,20 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("SCSI Verify error recovery page:"); - if (page.PS) + if(page.PS) sb.AppendLine("\tParameters can be saved"); - if (page.EER) + if(page.EER) sb.AppendLine("\tDrive will use the most expedient form of error recovery first"); - if (page.PER) + if(page.PER) sb.AppendLine("\tDrive shall report recovered errors"); - if (page.DTE) + if(page.DTE) sb.AppendLine("\tTransfer will be terminated upon error detection"); - if (page.DCR) + if(page.DCR) sb.AppendLine("\tError correction is disabled"); - if (page.VerifyRetryCount > 0) + if(page.VerifyRetryCount > 0) sb.AppendFormat("\tDrive will repeat verify operations {0} times", page.VerifyRetryCount).AppendLine(); - if (page.RecoveryTimeLimit > 0) + if(page.RecoveryTimeLimit > 0) sb.AppendFormat("\tDrive will employ a maximum of {0} ms to recover data", page.RecoveryTimeLimit).AppendLine(); return sb.ToString(); @@ -3783,19 +3783,19 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_10_SSC? DecodeModePage_10_SSC(byte[] pageResponse) { - if (pageResponse == null) + if(pageResponse == null) return null; - if ((pageResponse[0] & 0x40) == 0x40) + if((pageResponse[0] & 0x40) == 0x40) return null; - if ((pageResponse[0] & 0x3F) != 0x10) + if((pageResponse[0] & 0x3F) != 0x10) return null; - if (pageResponse[1] + 2 != pageResponse.Length) + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if (pageResponse.Length < 16) + if(pageResponse.Length < 16) return null; ModePage_10_SSC decoded = new ModePage_10_SSC(); @@ -3843,7 +3843,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_10_SSC(ModePage_10_SSC? modePage) { - if (!modePage.HasValue) + if(!modePage.HasValue) return null; ModePage_10_SSC page = modePage.Value; @@ -3851,27 +3851,27 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("SCSI Device configuration page:"); - if (page.PS) + if(page.PS) sb.AppendLine("\tParameters can be saved"); - + sb.AppendFormat("\tActive format: {0}", page.ActiveFormat).AppendLine(); sb.AppendFormat("\tActive partition: {0}", page.ActivePartition).AppendLine(); sb.AppendFormat("\tWrite buffer shall have a full ratio of {0} before being flushed to medium", page.WriteBufferFullRatio).AppendLine(); sb.AppendFormat("\tRead buffer shall have an empty ratio of {0} before more data is read from medium", page.ReadBufferEmptyRatio).AppendLine(); sb.AppendFormat("\tDrive will delay {0} ms before buffered data is forcefully written to the medium even before buffer is full", (int)page.WriteDelayTime * 100).AppendLine(); - if (page.DBR) + if(page.DBR) { sb.AppendLine("\tDrive supports recovering data from buffer"); - if (page.RBO) + if(page.RBO) sb.AppendLine("\tRecovered buffer data comes in LIFO order"); else sb.AppendLine("\tRecovered buffer data comes in FIFO order"); } - if (page.BIS) + if(page.BIS) sb.AppendLine("\tMedium supports block IDs"); - if (page.RSmk) + if(page.RSmk) sb.AppendLine("\tDrive reports setmarks"); - switch (page.SOCF) + switch(page.SOCF) { case 0: sb.AppendLine("\tDrive will pre-read until buffer is full"); @@ -3887,14 +3887,14 @@ namespace DiscImageChef.Decoders.SCSI break; } - if (page.REW) + if(page.REW) { sb.AppendLine("\tDrive reports early warnings"); - if (page.SEW) + if(page.SEW) sb.AppendLine("\tDrive will synchronize buffer to medium on early warnings"); } - switch (page.GapSize) + switch(page.GapSize) { case 0: break; @@ -3922,10 +3922,10 @@ namespace DiscImageChef.Decoders.SCSI break; } - if (page.EEG) + if(page.EEG) sb.AppendLine("\tDrive generates end-of-data"); - switch (page.SelectedCompression) + switch(page.SelectedCompression) { case 0: sb.AppendLine("\tDrive does not use compression"); @@ -3938,24 +3938,24 @@ namespace DiscImageChef.Decoders.SCSI break; } - if (page.SWP) + if(page.SWP) sb.AppendLine("\tSoftware write protect is enabled"); - if (page.ASOCWP) + if(page.ASOCWP) sb.AppendLine("\tAssociated write protect is enabled"); - if (page.PERSWP) + if(page.PERSWP) sb.AppendLine("\tPersistent write protect is enabled"); - if (page.PRMWP) + if(page.PRMWP) sb.AppendLine("\tPermanent write protect is enabled"); - if (page.BAML) + if(page.BAML) { - if (page.BAM) + if(page.BAM) sb.AppendLine("\tDrive operates using explicit address mode"); else sb.AppendLine("\tDrive operates using implicit address mode"); } - switch (page.RewindOnReset) + switch(page.RewindOnReset) { case 1: sb.AppendLine("\tDrive shall position to beginning of default data partition on reset"); @@ -3965,7 +3965,7 @@ namespace DiscImageChef.Decoders.SCSI break; } - switch (page.WTRE) + switch(page.WTRE) { case 1: sb.AppendLine("\tDrive will do nothing on WORM tampered medium"); @@ -3975,7 +3975,7 @@ namespace DiscImageChef.Decoders.SCSI break; } - if (page.OIR) + if(page.OIR) sb.AppendLine("\tDrive will only respond to commands if it has received a reservation"); return sb.ToString(); @@ -4052,19 +4052,19 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_0E? DecodeModePage_0E(byte[] pageResponse) { - if (pageResponse == null) + if(pageResponse == null) return null; - if ((pageResponse[0] & 0x40) == 0x40) + if((pageResponse[0] & 0x40) == 0x40) return null; - if ((pageResponse[0] & 0x3F) != 0x0E) + if((pageResponse[0] & 0x3F) != 0x0E) return null; - if (pageResponse[1] + 2 != pageResponse.Length) + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if (pageResponse.Length < 16) + if(pageResponse.Length < 16) return null; ModePage_0E decoded = new ModePage_0E(); @@ -4094,7 +4094,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_0E(ModePage_0E? modePage) { - if (!modePage.HasValue) + if(!modePage.HasValue) return null; ModePage_0E page = modePage.Value; @@ -4102,19 +4102,19 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("SCSI CD-ROM audio control parameters page:"); - if (page.PS) + if(page.PS) sb.AppendLine("\tParameters can be saved"); - if (page.Immed) + if(page.Immed) sb.AppendLine("\tDrive will return from playback command immediately"); else sb.AppendLine("\tDrive will return from playback command when playback ends"); - if (page.SOTC) + if(page.SOTC) sb.AppendLine("\tDrive will stop playback on track end"); - if (page.APRVal) + if(page.APRVal) { double blocks; - if (page.LBAFormat == 8) + if(page.LBAFormat == 8) blocks = page.BlocksPerSecondOfAudio * (1 / 256); else blocks = page.BlocksPerSecondOfAudio; @@ -4122,19 +4122,19 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendFormat("\tThere are {0} blocks per each second of audio", blocks).AppendLine(); } - if (page.OutputPort0ChannelSelection > 0) + if(page.OutputPort0ChannelSelection > 0) { sb.Append("\tOutput port 0 has channels "); - if ((page.OutputPort0ChannelSelection & 0x01) == 0x01) + if((page.OutputPort0ChannelSelection & 0x01) == 0x01) sb.Append("0 "); - if ((page.OutputPort0ChannelSelection & 0x02) == 0x02) + if((page.OutputPort0ChannelSelection & 0x02) == 0x02) sb.Append("1 "); - if ((page.OutputPort0ChannelSelection & 0x04) == 0x04) + if((page.OutputPort0ChannelSelection & 0x04) == 0x04) sb.Append("2 "); - if ((page.OutputPort0ChannelSelection & 0x08) == 0x08) + if((page.OutputPort0ChannelSelection & 0x08) == 0x08) sb.Append("3 "); - switch (page.OutputPort0Volume) + switch(page.OutputPort0Volume) { case 0: sb.AppendLine("muted"); @@ -4148,19 +4148,19 @@ namespace DiscImageChef.Decoders.SCSI } } - if (page.OutputPort1ChannelSelection > 0) + if(page.OutputPort1ChannelSelection > 0) { sb.Append("\tOutput port 1 has channels "); - if ((page.OutputPort1ChannelSelection & 0x01) == 0x01) + if((page.OutputPort1ChannelSelection & 0x01) == 0x01) sb.Append("0 "); - if ((page.OutputPort1ChannelSelection & 0x02) == 0x02) + if((page.OutputPort1ChannelSelection & 0x02) == 0x02) sb.Append("1 "); - if ((page.OutputPort1ChannelSelection & 0x04) == 0x04) + if((page.OutputPort1ChannelSelection & 0x04) == 0x04) sb.Append("2 "); - if ((page.OutputPort1ChannelSelection & 0x08) == 0x08) + if((page.OutputPort1ChannelSelection & 0x08) == 0x08) sb.Append("3 "); - switch (page.OutputPort1Volume) + switch(page.OutputPort1Volume) { case 0: sb.AppendLine("muted"); @@ -4174,19 +4174,19 @@ namespace DiscImageChef.Decoders.SCSI } } - if (page.OutputPort2ChannelSelection > 0) + if(page.OutputPort2ChannelSelection > 0) { sb.Append("\tOutput port 2 has channels "); - if ((page.OutputPort2ChannelSelection & 0x01) == 0x01) + if((page.OutputPort2ChannelSelection & 0x01) == 0x01) sb.Append("0 "); - if ((page.OutputPort2ChannelSelection & 0x02) == 0x02) + if((page.OutputPort2ChannelSelection & 0x02) == 0x02) sb.Append("1 "); - if ((page.OutputPort2ChannelSelection & 0x04) == 0x04) + if((page.OutputPort2ChannelSelection & 0x04) == 0x04) sb.Append("2 "); - if ((page.OutputPort2ChannelSelection & 0x08) == 0x08) + if((page.OutputPort2ChannelSelection & 0x08) == 0x08) sb.Append("3 "); - switch (page.OutputPort2Volume) + switch(page.OutputPort2Volume) { case 0: sb.AppendLine("muted"); @@ -4200,19 +4200,19 @@ namespace DiscImageChef.Decoders.SCSI } } - if (page.OutputPort3ChannelSelection > 0) + if(page.OutputPort3ChannelSelection > 0) { sb.Append("\tOutput port 3 has channels "); - if ((page.OutputPort3ChannelSelection & 0x01) == 0x01) + if((page.OutputPort3ChannelSelection & 0x01) == 0x01) sb.Append("0 "); - if ((page.OutputPort3ChannelSelection & 0x02) == 0x02) + if((page.OutputPort3ChannelSelection & 0x02) == 0x02) sb.Append("1 "); - if ((page.OutputPort3ChannelSelection & 0x04) == 0x04) + if((page.OutputPort3ChannelSelection & 0x04) == 0x04) sb.Append("2 "); - if ((page.OutputPort3ChannelSelection & 0x08) == 0x08) + if((page.OutputPort3ChannelSelection & 0x08) == 0x08) sb.Append("3 "); - switch (page.OutputPort3Volume) + switch(page.OutputPort3Volume) { case 0: sb.AppendLine("muted"); @@ -4260,19 +4260,19 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_0D? DecodeModePage_0D(byte[] pageResponse) { - if (pageResponse == null) + if(pageResponse == null) return null; - if ((pageResponse[0] & 0x40) == 0x40) + if((pageResponse[0] & 0x40) == 0x40) return null; - if ((pageResponse[0] & 0x3F) != 0x0D) + if((pageResponse[0] & 0x3F) != 0x0D) return null; - if (pageResponse[1] + 2 != pageResponse.Length) + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if (pageResponse.Length < 8) + if(pageResponse.Length < 8) return null; ModePage_0D decoded = new ModePage_0D(); @@ -4292,7 +4292,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_0D(ModePage_0D? modePage) { - if (!modePage.HasValue) + if(!modePage.HasValue) return null; ModePage_0D page = modePage.Value; @@ -4300,9 +4300,9 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("SCSI CD-ROM parameters page:"); - if (page.PS) + if(page.PS) sb.AppendLine("\tParameters can be saved"); - switch (page.InactivityTimerMultiplier) + switch(page.InactivityTimerMultiplier) { case 0: sb.AppendLine("\tDrive will remain in track hold state a vendor-specified time after a seek or read"); @@ -4354,9 +4354,9 @@ namespace DiscImageChef.Decoders.SCSI break; } - if (page.SecondsPerMinute > 0) + if(page.SecondsPerMinute > 0) sb.AppendFormat("\tEach minute has {0} seconds", page.SecondsPerMinute).AppendLine(); - if (page.FramesPerSecond > 0) + if(page.FramesPerSecond > 0) sb.AppendFormat("\tEach second has {0} frames", page.FramesPerSecond).AppendLine(); return sb.ToString(); @@ -4398,19 +4398,19 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_01_MMC? DecodeModePage_01_MMC(byte[] pageResponse) { - if (pageResponse == null) + if(pageResponse == null) return null; - if ((pageResponse[0] & 0x40) == 0x40) + if((pageResponse[0] & 0x40) == 0x40) return null; - if ((pageResponse[0] & 0x3F) != 0x01) + if((pageResponse[0] & 0x3F) != 0x01) return null; - if (pageResponse[1] + 2 != pageResponse.Length) + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if (pageResponse.Length < 8) + if(pageResponse.Length < 8) return null; ModePage_01_MMC decoded = new ModePage_01_MMC(); @@ -4419,7 +4419,7 @@ namespace DiscImageChef.Decoders.SCSI decoded.Parameter = pageResponse[2]; decoded.ReadRetryCount = pageResponse[3]; - if (pageResponse.Length < 12) + if(pageResponse.Length < 12) return decoded; decoded.WriteRetryCount = pageResponse[8]; @@ -4435,7 +4435,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_01_MMC(ModePage_01_MMC? modePage) { - if (!modePage.HasValue) + if(!modePage.HasValue) return null; ModePage_01_MMC page = modePage.Value; @@ -4443,11 +4443,11 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("SCSI Read error recovery page for MultiMedia Devices:"); - if (page.PS) + if(page.PS) sb.AppendLine("\tParameters can be saved"); - if (page.ReadRetryCount > 0) + if(page.ReadRetryCount > 0) sb.AppendFormat("\tDrive will repeat read operations {0} times", page.ReadRetryCount).AppendLine(); - + string AllUsed = "\tAll available recovery procedures will be used.\n"; string CIRCRetriesUsed = "\tOnly retries and CIRC are used.\n"; string RetriesUsed = "\tOnly retries are used.\n"; @@ -4461,7 +4461,7 @@ namespace DiscImageChef.Decoders.SCSI string UnrecECCAbortData = "\tUnrecovered ECC errors will return CHECK CONDITION and the uncorrected data."; string UnrecCIRCAbortData = "\tUnrecovered CIRC errors will return CHECK CONDITION and the uncorrected data."; - switch (page.Parameter) + switch(page.Parameter) { case 0x00: sb.AppendLine(AllUsed + RecoveredNotReported + UnrecECCAbort); @@ -4524,11 +4524,11 @@ namespace DiscImageChef.Decoders.SCSI break; } - if (page.WriteRetryCount > 0) + if(page.WriteRetryCount > 0) sb.AppendFormat("\tDrive will repeat write operations {0} times", page.WriteRetryCount).AppendLine(); - if (page.RecoveryTimeLimit > 0) + if(page.RecoveryTimeLimit > 0) sb.AppendFormat("\tDrive will employ a maximum of {0} ms to recover data", page.RecoveryTimeLimit).AppendLine(); - + return sb.ToString(); } @@ -4559,19 +4559,19 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_07_MMC? DecodeModePage_07_MMC(byte[] pageResponse) { - if (pageResponse == null) + if(pageResponse == null) return null; - if ((pageResponse[0] & 0x40) == 0x40) + if((pageResponse[0] & 0x40) == 0x40) return null; - if ((pageResponse[0] & 0x3F) != 0x07) + if((pageResponse[0] & 0x3F) != 0x07) return null; - if (pageResponse[1] + 2 != pageResponse.Length) + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if (pageResponse.Length < 8) + if(pageResponse.Length < 8) return null; ModePage_07_MMC decoded = new ModePage_07_MMC(); @@ -4590,7 +4590,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_07_MMC(ModePage_07_MMC? modePage) { - if (!modePage.HasValue) + if(!modePage.HasValue) return null; ModePage_07_MMC page = modePage.Value; @@ -4598,9 +4598,9 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("SCSI Verify error recovery page for MultiMedia Devices:"); - if (page.PS) + if(page.PS) sb.AppendLine("\tParameters can be saved"); - if (page.VerifyRetryCount > 0) + if(page.VerifyRetryCount > 0) sb.AppendFormat("\tDrive will repeat verify operations {0} times", page.VerifyRetryCount).AppendLine(); string AllUsed = "\tAll available recovery procedures will be used.\n"; @@ -4616,7 +4616,7 @@ namespace DiscImageChef.Decoders.SCSI string UnrecECCAbortData = "\tUnrecovered ECC errors will return CHECK CONDITION and the uncorrected data."; string UnrecCIRCAbortData = "\tUnrecovered CIRC errors will return CHECK CONDITION and the uncorrected data."; - switch (page.Parameter) + switch(page.Parameter) { case 0x00: sb.AppendLine(AllUsed + RecoveredNotReported + UnrecECCAbort); @@ -4705,19 +4705,19 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_06? DecodeModePage_06(byte[] pageResponse) { - if (pageResponse == null) + if(pageResponse == null) return null; - if ((pageResponse[0] & 0x40) == 0x40) + if((pageResponse[0] & 0x40) == 0x40) return null; - if ((pageResponse[0] & 0x3F) != 0x06) + if((pageResponse[0] & 0x3F) != 0x06) return null; - if (pageResponse[1] + 2 != pageResponse.Length) + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if (pageResponse.Length < 4) + if(pageResponse.Length < 4) return null; ModePage_06 decoded = new ModePage_06(); @@ -4735,7 +4735,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_06(ModePage_06? modePage) { - if (!modePage.HasValue) + if(!modePage.HasValue) return null; ModePage_06 page = modePage.Value; @@ -4743,9 +4743,9 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("SCSI optical memory:"); - if (page.PS) + if(page.PS) sb.AppendLine("\tParameters can be saved"); - if (page.RUBR) + if(page.RUBR) sb.AppendLine("\tOn reading an updated block drive will return RECOVERED ERROR"); return sb.ToString(); @@ -4903,19 +4903,19 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_2A? DecodeModePage_2A(byte[] pageResponse) { - if (pageResponse == null) + if(pageResponse == null) return null; - if ((pageResponse[0] & 0x40) == 0x40) + if((pageResponse[0] & 0x40) == 0x40) return null; - if ((pageResponse[0] & 0x3F) != 0x2A) + if((pageResponse[0] & 0x3F) != 0x2A) return null; - if (pageResponse[1] + 2 != pageResponse.Length) + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if (pageResponse.Length < 16) + if(pageResponse.Length < 16) return null; ModePage_2A decoded = new ModePage_2A(); @@ -4949,7 +4949,7 @@ namespace DiscImageChef.Decoders.SCSI decoded.BufferSize = (ushort)((pageResponse[12] << 8) + pageResponse[13]); decoded.CurrentSpeed = (ushort)((pageResponse[14] << 8) + pageResponse[15]); - if (pageResponse.Length < 20) + if(pageResponse.Length < 20) return decoded; decoded.Method2 |= (pageResponse[2] & 0x04) == 0x04; @@ -4971,7 +4971,7 @@ namespace DiscImageChef.Decoders.SCSI decoded.RCK |= (pageResponse[17] & 0x04) == 0x04; decoded.BCK |= (pageResponse[17] & 0x02) == 0x02; - if (pageResponse.Length < 22) + if(pageResponse.Length < 22) return decoded; decoded.TestWrite |= (pageResponse[3] & 0x04) == 0x04; @@ -4980,7 +4980,7 @@ namespace DiscImageChef.Decoders.SCSI decoded.ReadBarcode |= (pageResponse[5] & 0x80) == 0x80; - if (pageResponse.Length < 26) + if(pageResponse.Length < 26) return decoded; decoded.ReadDVDRAM |= (pageResponse[2] & 0x20) == 0x20; @@ -4995,7 +4995,7 @@ namespace DiscImageChef.Decoders.SCSI decoded.CMRSupported = (ushort)((pageResponse[22] << 8) + pageResponse[23]); - if (pageResponse.Length < 32) + if(pageResponse.Length < 32) return decoded; decoded.BUF |= (pageResponse[4] & 0x80) == 0x80; @@ -5005,7 +5005,7 @@ namespace DiscImageChef.Decoders.SCSI ushort descriptors = (ushort)((pageResponse[30] << 8) + pageResponse[31]); decoded.WriteSpeedPerformanceDescriptors = new ModePage_2A_WriteDescriptor[descriptors]; - for (int i = 0; i < descriptors; i++) + for(int i = 0; i < descriptors; i++) { decoded.WriteSpeedPerformanceDescriptors[i] = new ModePage_2A_WriteDescriptor(); decoded.WriteSpeedPerformanceDescriptors[i].RotationControl = (byte)(pageResponse[1 + 32 + i * 4] & 0x07); @@ -5022,7 +5022,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_2A(ModePage_2A? modePage) { - if (!modePage.HasValue) + if(!modePage.HasValue) return null; ModePage_2A page = modePage.Value; @@ -5030,34 +5030,34 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("SCSI CD-ROM capabilities page:"); - if (page.PS) + if(page.PS) sb.AppendLine("\tParameters can be saved"); - if (page.AudioPlay) + if(page.AudioPlay) sb.AppendLine("\tDrive can play audio"); - if (page.Mode2Form1) + if(page.Mode2Form1) sb.AppendLine("\tDrive can read sectors in Mode 2 Form 1 format"); - if (page.Mode2Form2) + if(page.Mode2Form2) sb.AppendLine("\tDrive can read sectors in Mode 2 Form 2 format"); - if (page.MultiSession) + if(page.MultiSession) sb.AppendLine("\tDrive supports multi-session discs and/or Photo-CD"); - if (page.CDDACommand) + if(page.CDDACommand) sb.AppendLine("\tDrive can read digital audio"); - if (page.AccurateCDDA) + if(page.AccurateCDDA) sb.AppendLine("\tDrive can continue from streaming loss"); - if (page.Subchannel) + if(page.Subchannel) sb.AppendLine("\tDrive can read uncorrected and interleaved R-W subchannels"); - if (page.DeinterlaveSubchannel) + if(page.DeinterlaveSubchannel) sb.AppendLine("\tDrive can read, deinterleave and correct R-W subchannels"); - if (page.C2Pointer) + if(page.C2Pointer) sb.AppendLine("\tDrive supports C2 pointers"); - if (page.UPC) + if(page.UPC) sb.AppendLine("\tDrive can read Media Catalogue Number"); - if (page.ISRC) + if(page.ISRC) sb.AppendLine("\tDrive can read ISRC"); - switch (page.LoadingMechanism) + switch(page.LoadingMechanism) { case 0: sb.AppendLine("\tDrive uses media caddy"); @@ -5079,129 +5079,129 @@ namespace DiscImageChef.Decoders.SCSI break; } - if (page.Lock) + if(page.Lock) sb.AppendLine("\tDrive can lock media"); - if (page.PreventJumper) + if(page.PreventJumper) { sb.AppendLine("\tDrive power ups locked"); - if (page.LockState) + if(page.LockState) sb.AppendLine("\tDrive is locked, media cannot be ejected or inserted"); else sb.AppendLine("\tDrive is not locked, media can be ejected and inserted"); } else { - if (page.LockState) + if(page.LockState) sb.AppendLine("\tDrive is locked, media cannot be ejected, but if empty, can be inserted"); else sb.AppendLine("\tDrive is not locked, media can be ejected and inserted"); } - if (page.Eject) + if(page.Eject) sb.AppendLine("\tDrive can eject media"); - if (page.SeparateChannelMute) + if(page.SeparateChannelMute) sb.AppendLine("\tEach channel can be muted independently"); - if (page.SeparateChannelVolume) + if(page.SeparateChannelVolume) sb.AppendLine("\tEach channel's volume can be controlled independently"); - if (page.SupportedVolumeLevels > 0) + if(page.SupportedVolumeLevels > 0) sb.AppendFormat("\tDrive supports {0} volume levels", page.SupportedVolumeLevels).AppendLine(); - if (page.BufferSize > 0) + if(page.BufferSize > 0) sb.AppendFormat("\tDrive has {0} Kbyte of buffer", page.BufferSize).AppendLine(); - if (page.MaximumSpeed > 0) + if(page.MaximumSpeed > 0) sb.AppendFormat("\tDrive's maximum reading speed is {0} Kbyte/sec.", page.MaximumSpeed).AppendLine(); - if (page.CurrentSpeed > 0) + if(page.CurrentSpeed > 0) sb.AppendFormat("\tDrive's current reading speed is {0} Kbyte/sec.", page.CurrentSpeed).AppendLine(); - if (page.ReadCDR) + if(page.ReadCDR) { - if (page.WriteCDR) + if(page.WriteCDR) sb.AppendLine("\tDrive can read and write CD-R"); else sb.AppendLine("\tDrive can read CD-R"); - if (page.Method2) + if(page.Method2) sb.AppendLine("\tDrive supports reading CD-R packet media"); } - if (page.ReadCDRW) + if(page.ReadCDRW) { - if (page.WriteCDRW) + if(page.WriteCDRW) sb.AppendLine("\tDrive can read and write CD-RW"); else sb.AppendLine("\tDrive can read CD-RW"); } - if (page.ReadDVDROM) + if(page.ReadDVDROM) sb.AppendLine("\tDrive can read DVD-ROM"); - if (page.ReadDVDR) + if(page.ReadDVDR) { - if (page.WriteDVDR) + if(page.WriteDVDR) sb.AppendLine("\tDrive can read and write DVD-R"); else sb.AppendLine("\tDrive can read DVD-R"); } - if (page.ReadDVDRAM) + if(page.ReadDVDRAM) { - if (page.WriteDVDRAM) + if(page.WriteDVDRAM) sb.AppendLine("\tDrive can read and write DVD-RAM"); else sb.AppendLine("\tDrive can read DVD-RAM"); } - if (page.Composite) + if(page.Composite) sb.AppendLine("\tDrive can deliver a compositve audio and video data stream"); - if (page.DigitalPort1) + if(page.DigitalPort1) sb.AppendLine("\tDrive supports IEC-958 digital output on port 1"); - if (page.DigitalPort2) + if(page.DigitalPort2) sb.AppendLine("\tDrive supports IEC-958 digital output on port 2"); - if (page.SDP) + if(page.SDP) sb.AppendLine("\tDrive contains a changer that can report the exact contents of the slots"); - if (page.CurrentWriteSpeedSelected > 0) + if(page.CurrentWriteSpeedSelected > 0) { - if (page.RotationControlSelected == 0) + if(page.RotationControlSelected == 0) sb.AppendFormat("\tDrive's current writing speed is {0} Kbyte/sec. in CLV mode", page.CurrentWriteSpeedSelected).AppendLine(); - else if (page.RotationControlSelected == 1) + else if(page.RotationControlSelected == 1) sb.AppendFormat("\tDrive's current writing speed is {0} Kbyte/sec. in pure CAV mode", page.CurrentWriteSpeedSelected).AppendLine(); } else { - if (page.MaxWriteSpeed > 0) + if(page.MaxWriteSpeed > 0) sb.AppendFormat("\tDrive's maximum writing speed is {0} Kbyte/sec.", page.MaxWriteSpeed).AppendLine(); - if (page.CurrentWriteSpeed > 0) + if(page.CurrentWriteSpeed > 0) sb.AppendFormat("\tDrive's current writing speed is {0} Kbyte/sec.", page.CurrentWriteSpeed).AppendLine(); } if(page.WriteSpeedPerformanceDescriptors != null) { - foreach (ModePage_2A_WriteDescriptor descriptor in page.WriteSpeedPerformanceDescriptors) + foreach(ModePage_2A_WriteDescriptor descriptor in page.WriteSpeedPerformanceDescriptors) { - if (descriptor.WriteSpeed > 0) + if(descriptor.WriteSpeed > 0) { - if (descriptor.RotationControl == 0) + if(descriptor.RotationControl == 0) sb.AppendFormat("\tDrive supports writing at {0} Kbyte/sec. in CLV mode", descriptor.WriteSpeed).AppendLine(); - else if (descriptor.RotationControl == 1) + else if(descriptor.RotationControl == 1) sb.AppendFormat("\tDrive supports writing at is {0} Kbyte/sec. in pure CAV mode", descriptor.WriteSpeed).AppendLine(); } } } - if (page.TestWrite) + if(page.TestWrite) sb.AppendLine("\tDrive supports test writing"); - if (page.ReadBarcode) + if(page.ReadBarcode) sb.AppendLine("\tDrive can read barcode"); - if (page.SCC) + if(page.SCC) sb.AppendLine("\tDrive can read both sides of a disc"); - if (page.LeadInPW) + if(page.LeadInPW) sb.AppendLine("\tDrive an read raw R-W subchannel from the Lead-In"); - if (page.CMRSupported == 1) + if(page.CMRSupported == 1) sb.AppendLine("\tDrive supports DVD CSS and/or DVD CPPM"); - if (page.BUF) + if(page.BUF) sb.AppendLine("\tDrive supports buffer under-run free recording"); return sb.ToString(); @@ -5268,19 +5268,19 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_1C? DecodeModePage_1C(byte[] pageResponse) { - if (pageResponse == null) + if(pageResponse == null) return null; - if ((pageResponse[0] & 0x40) == 0x40) + if((pageResponse[0] & 0x40) == 0x40) return null; - if ((pageResponse[0] & 0x3F) != 0x1C) + if((pageResponse[0] & 0x3F) != 0x1C) return null; - if (pageResponse[1] + 2 != pageResponse.Length) + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if (pageResponse.Length < 12) + if(pageResponse.Length < 12) return null; ModePage_1C decoded = new ModePage_1C(); @@ -5312,7 +5312,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_1C(ModePage_1C? modePage) { - if (!modePage.HasValue) + if(!modePage.HasValue) return null; ModePage_1C page = modePage.Value; @@ -5320,16 +5320,16 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("SCSI Informational exceptions control page:"); - if (page.PS) + if(page.PS) sb.AppendLine("\tParameters can be saved"); - if (page.DExcpt) + if(page.DExcpt) sb.AppendLine("\tInformational exceptions are disabled"); else { sb.AppendLine("\tInformational exceptions are enabled"); - switch (page.MRIE) + switch(page.MRIE) { case 0: sb.AppendLine("\tNo reporting of informational exception condition"); @@ -5357,30 +5357,30 @@ namespace DiscImageChef.Decoders.SCSI break; } - if (page.Perf) + if(page.Perf) sb.AppendLine("\tInformational exceptions reporting should not affect drive performance"); - if (page.Test) + if(page.Test) sb.AppendLine("\tA test informational exception will raise on next timer"); - if (page.LogErr) + if(page.LogErr) sb.AppendLine("\tDrive shall log informational exception conditions"); - if (page.IntervalTimer > 0) + if(page.IntervalTimer > 0) { - if (page.IntervalTimer == 0xFFFFFFFF) + if(page.IntervalTimer == 0xFFFFFFFF) sb.AppendLine("\tTimer interval is vendor-specific"); else sb.AppendFormat("\tTimer interval is {0} ms", page.IntervalTimer * 100).AppendLine(); } - if (page.ReportCount > 0) + if(page.ReportCount > 0) sb.AppendFormat("\tInformational exception conditions will be reported a maximum of {0} times", page.ReportCount); } - if (page.EWasc) + if(page.EWasc) sb.AppendLine("\tWarning reporting is enabled"); - if (page.EBF) + if(page.EBF) sb.AppendLine("\tBackground functions are enabled"); - if (page.EBACKERR) + if(page.EBACKERR) sb.AppendLine("\tDrive will report background self-test errors"); return sb.ToString(); @@ -5454,19 +5454,19 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_1A? DecodeModePage_1A(byte[] pageResponse) { - if (pageResponse == null) + if(pageResponse == null) return null; - if ((pageResponse[0] & 0x40) == 0x40) + if((pageResponse[0] & 0x40) == 0x40) return null; - if ((pageResponse[0] & 0x3F) != 0x1A) + if((pageResponse[0] & 0x3F) != 0x1A) return null; - if (pageResponse[1] + 2 != pageResponse.Length) + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if (pageResponse.Length < 12) + if(pageResponse.Length < 12) return null; ModePage_1A decoded = new ModePage_1A(); @@ -5479,7 +5479,7 @@ namespace DiscImageChef.Decoders.SCSI decoded.IdleTimer = (uint)((pageResponse[4] << 24) + (pageResponse[5] << 16) + (pageResponse[6] << 8) + pageResponse[7]); decoded.StandbyTimer = (uint)((pageResponse[8] << 24) + (pageResponse[9] << 16) + (pageResponse[10] << 8) + pageResponse[11]); - if (pageResponse.Length < 40) + if(pageResponse.Length < 40) return decoded; decoded.PM_BG_Precedence = (byte)((pageResponse[2] & 0xC0) >> 6); @@ -5505,7 +5505,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_1A(ModePage_1A? modePage) { - if (!modePage.HasValue) + if(!modePage.HasValue) return null; ModePage_1A page = modePage.Value; @@ -5513,35 +5513,35 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("SCSI Power condition page:"); - if (page.PS) + if(page.PS) sb.AppendLine("\tParameters can be saved"); - if ((page.Standby && page.StandbyTimer > 0) || + if((page.Standby && page.StandbyTimer > 0) || (page.Standby_Y && page.StandbyTimer_Y > 0)) { - if (page.Standby && page.StandbyTimer > 0) + if(page.Standby && page.StandbyTimer > 0) sb.AppendFormat("\tStandby timer Z is set to {0} ms", page.StandbyTimer * 100).AppendLine(); - if (page.Standby_Y && page.StandbyTimer_Y > 0) + if(page.Standby_Y && page.StandbyTimer_Y > 0) sb.AppendFormat("\tStandby timer Y is set to {0} ms", page.StandbyTimer_Y * 100).AppendLine(); } else sb.AppendLine("\tDrive will not enter standy mode"); - if ((page.Idle && page.IdleTimer > 0) || + if((page.Idle && page.IdleTimer > 0) || (page.Idle_B && page.IdleTimer_B > 0) || (page.Idle_C && page.IdleTimer_C > 0)) { - if (page.Idle && page.IdleTimer > 0) + if(page.Idle && page.IdleTimer > 0) sb.AppendFormat("\tIdle timer A is set to {0} ms", page.IdleTimer * 100).AppendLine(); - if (page.Idle_B && page.IdleTimer_B > 0) + if(page.Idle_B && page.IdleTimer_B > 0) sb.AppendFormat("\tIdle timer B is set to {0} ms", page.IdleTimer_B * 100).AppendLine(); - if (page.Idle_C && page.IdleTimer_C > 0) + if(page.Idle_C && page.IdleTimer_C > 0) sb.AppendFormat("\tIdle timer C is set to {0} ms", page.IdleTimer_C * 100).AppendLine(); } else sb.AppendLine("\tDrive will not enter idle mode"); - switch (page.PM_BG_Precedence) + switch(page.PM_BG_Precedence) { case 0: break; @@ -5601,22 +5601,22 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_0A_S01? DecodeModePage_0A_S01(byte[] pageResponse) { - if (pageResponse == null) + if(pageResponse == null) return null; - if ((pageResponse[0] & 0x40) != 0x40) + if((pageResponse[0] & 0x40) != 0x40) return null; - if ((pageResponse[0] & 0x3F) != 0x0A) + if((pageResponse[0] & 0x3F) != 0x0A) return null; - if (pageResponse[1] != 0x01) + if(pageResponse[1] != 0x01) return null; - if (((pageResponse[2] << 8) + pageResponse[3] + 4) != pageResponse.Length) + if(((pageResponse[2] << 8) + pageResponse[3] + 4) != pageResponse.Length) return null; - if (pageResponse.Length < 32) + if(pageResponse.Length < 32) return null; ModePage_0A_S01 decoded = new ModePage_0A_S01(); @@ -5639,7 +5639,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_0A_S01(ModePage_0A_S01? modePage) { - if (!modePage.HasValue) + if(!modePage.HasValue) return null; ModePage_0A_S01 page = modePage.Value; @@ -5647,28 +5647,28 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("SCSI Control extension page:"); - if (page.PS) + if(page.PS) sb.AppendLine("\tParameters can be saved"); - - if (page.TCMOS) + + if(page.TCMOS) { sb.Append("\tTimestamp can be initialized by methods outside of the SCSI standards"); - if (page.SCSIP) + if(page.SCSIP) sb.Append(", but SCSI's SET TIMESTAMP shall take precedence over them"); sb.AppendLine(); } - if (page.IALUAE) + if(page.IALUAE) sb.AppendLine("\tImplicit Asymmetric Logical Unit Access is enabled"); sb.AppendFormat("\tInitial priority is {0}", page.InitialPriority).AppendLine(); - if (page.DLC) + if(page.DLC) sb.AppendLine("\tDevice will not degrade performance to extend its life"); - if (page.MaximumSenseLength > 0) + if(page.MaximumSenseLength > 0) sb.AppendFormat("\tMaximum sense data would be {0} bytes", page.MaximumSenseLength).AppendLine(); return sb.ToString(); @@ -5702,22 +5702,22 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_1A_S01? DecodeModePage_1A_S01(byte[] pageResponse) { - if (pageResponse == null) + if(pageResponse == null) return null; - if ((pageResponse[0] & 0x40) != 0x40) + if((pageResponse[0] & 0x40) != 0x40) return null; - if ((pageResponse[0] & 0x3F) != 0x1A) + if((pageResponse[0] & 0x3F) != 0x1A) return null; - if (pageResponse[1] != 0x01) + if(pageResponse[1] != 0x01) return null; - if (((pageResponse[2] << 8) + pageResponse[3] + 4) != pageResponse.Length) + if(((pageResponse[2] << 8) + pageResponse[3] + 4) != pageResponse.Length) return null; - if (pageResponse.Length < 16) + if(pageResponse.Length < 16) return null; ModePage_1A_S01 decoded = new ModePage_1A_S01(); @@ -5736,7 +5736,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_1A_S01(ModePage_1A_S01? modePage) { - if (!modePage.HasValue) + if(!modePage.HasValue) return null; ModePage_1A_S01 page = modePage.Value; @@ -5744,10 +5744,10 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("SCSI Power Consumption page:"); - if (page.PS) + if(page.PS) sb.AppendLine("\tParameters can be saved"); - switch (page.ActiveLevel) + switch(page.ActiveLevel) { case 0: sb.AppendFormat("\tDevice power consumption is dictated by identifier {0} of Power Consumption VPD", page.PowerConsumptionIdentifier).AppendLine(); @@ -5805,19 +5805,19 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_10? DecodeModePage_10(byte[] pageResponse) { - if (pageResponse == null) + if(pageResponse == null) return null; - if ((pageResponse[0] & 0x40) == 0x40) + if((pageResponse[0] & 0x40) == 0x40) return null; - if ((pageResponse[0] & 0x3F) != 0x10) + if((pageResponse[0] & 0x3F) != 0x10) return null; - if (pageResponse[1] + 2 != pageResponse.Length) + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if (pageResponse.Length < 24) + if(pageResponse.Length < 24) return null; ModePage_10 decoded = new ModePage_10(); @@ -5840,7 +5840,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_10(ModePage_10? modePage) { - if (!modePage.HasValue) + if(!modePage.HasValue) return null; ModePage_10 page = modePage.Value; @@ -5848,20 +5848,20 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("SCSI XOR control mode page:"); - if (page.PS) + if(page.PS) sb.AppendLine("\tParameters can be saved"); - if (page.XORDIS) + if(page.XORDIS) sb.AppendLine("\tXOR operations are disabled"); else { - if (page.MaxXorWrite > 0) + if(page.MaxXorWrite > 0) sb.AppendFormat("\tDrive accepts a maximum of {0} blocks in a single XOR WRITE command", page.MaxXorWrite).AppendLine(); - if (page.MaxRegenSize > 0) + if(page.MaxRegenSize > 0) sb.AppendFormat("\tDrive accepts a maximum of {0} blocks in a REGENERATE command", page.MaxRegenSize).AppendLine(); - if (page.MaxRebuildRead > 0) + if(page.MaxRebuildRead > 0) sb.AppendFormat("\tDrive accepts a maximum of {0} blocks in a READ command during rebuild", page.MaxRebuildRead).AppendLine(); - if (page.RebuildDelay > 0) + if(page.RebuildDelay > 0) sb.AppendFormat("\tDrive needs a minimum of {0} ms between READ commands during rebuild", page.RebuildDelay).AppendLine(); } @@ -5920,22 +5920,22 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_1C_S01? DecodeModePage_1C_S01(byte[] pageResponse) { - if (pageResponse == null) + if(pageResponse == null) return null; - if ((pageResponse[0] & 0x40) != 0x40) + if((pageResponse[0] & 0x40) != 0x40) return null; - if ((pageResponse[0] & 0x3F) != 0x1C) + if((pageResponse[0] & 0x3F) != 0x1C) return null; - if (pageResponse[1] != 0x01) + if(pageResponse[1] != 0x01) return null; - if (((pageResponse[2] << 8) + pageResponse[3] + 4) != pageResponse.Length) + if(((pageResponse[2] << 8) + pageResponse[3] + 4) != pageResponse.Length) return null; - if (pageResponse.Length < 16) + if(pageResponse.Length < 16) return null; ModePage_1C_S01 decoded = new ModePage_1C_S01(); @@ -5962,7 +5962,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_1C_S01(ModePage_1C_S01? modePage) { - if (!modePage.HasValue) + if(!modePage.HasValue) return null; ModePage_1C_S01 page = modePage.Value; @@ -5970,28 +5970,28 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("SCSI Background Control page:"); - if (page.PS) + if(page.PS) sb.AppendLine("\tParameters can be saved"); - if (page.S_L_Full) + if(page.S_L_Full) sb.AppendLine("\tBackground scans will be halted if log is full"); - if (page.LOWIR) + if(page.LOWIR) sb.AppendLine("\tBackground scans will only be logged if they require intervention"); - if (page.En_Bms) + if(page.En_Bms) sb.AppendLine("\tBackground medium scans are enabled"); - if (page.En_Ps) + if(page.En_Ps) sb.AppendLine("\tBackground pre-scans are enabled"); - if (page.BackgroundScanInterval > 0) + if(page.BackgroundScanInterval > 0) sb.AppendFormat("\t{0} hours shall be between the start of a background scan operation and the next", page.BackgroundScanInterval).AppendLine(); - if (page.BackgroundPrescanTimeLimit > 0) + if(page.BackgroundPrescanTimeLimit > 0) sb.AppendFormat("\tBackgroun pre-scan operations can take a maximum of {0} hours", page.BackgroundPrescanTimeLimit).AppendLine(); - if (page.MinIdleBeforeBgScan > 0) + if(page.MinIdleBeforeBgScan > 0) sb.AppendFormat("\tAt least {0} ms must be idle before resuming a suspended background scan operation", page.MinIdleBeforeBgScan).AppendLine(); - if (page.MaxTimeSuspendBgScan > 0) + if(page.MaxTimeSuspendBgScan > 0) sb.AppendFormat("\tAt most {0} ms must be before suspending a background scan operation and processing received commands", page.MaxTimeSuspendBgScan).AppendLine(); return sb.ToString(); @@ -6040,19 +6040,19 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_0F? DecodeModePage_0F(byte[] pageResponse) { - if (pageResponse == null) + if(pageResponse == null) return null; - if ((pageResponse[0] & 0x40) == 0x40) + if((pageResponse[0] & 0x40) == 0x40) return null; - if ((pageResponse[0] & 0x3F) != 0x0F) + if((pageResponse[0] & 0x3F) != 0x0F) return null; - if (pageResponse[1] + 2 != pageResponse.Length) + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if (pageResponse.Length < 16) + if(pageResponse.Length < 16) return null; ModePage_0F decoded = new ModePage_0F(); @@ -6077,7 +6077,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_0F(ModePage_0F? modePage) { - if (!modePage.HasValue) + if(!modePage.HasValue) return null; ModePage_0F page = modePage.Value; @@ -6085,16 +6085,16 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("SCSI Data compression page:"); - if (page.PS) + if(page.PS) sb.AppendLine("\tParameters can be saved"); - if (page.DCC) + if(page.DCC) { sb.AppendLine("\tDrive supports data compression"); - if (page.DCE) + if(page.DCE) { sb.Append("\tData compression is enabled with "); - switch (page.CompressionAlgo) + switch(page.CompressionAlgo) { case 3: sb.AppendLine("IBM ALDC with 512 byte buffer"); @@ -6119,15 +6119,15 @@ namespace DiscImageChef.Decoders.SCSI break; } } - if (page.DDE) + if(page.DDE) { sb.AppendLine("\tData decompression is enabled"); - if (page.DecompressionAlgo == 0) + if(page.DecompressionAlgo == 0) sb.AppendLine("\tLast data read was uncompressed"); else { sb.Append("\tLast data read was compressed with "); - switch (page.CompressionAlgo) + switch(page.CompressionAlgo) { case 3: sb.AppendLine("IBM ALDC with 512 byte buffer"); @@ -6201,19 +6201,19 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_1B? DecodeModePage_1B(byte[] pageResponse) { - if (pageResponse == null) + if(pageResponse == null) return null; - if ((pageResponse[0] & 0x40) == 0x40) + if((pageResponse[0] & 0x40) == 0x40) return null; - if ((pageResponse[0] & 0x3F) != 0x1B) + if((pageResponse[0] & 0x3F) != 0x1B) return null; - if (pageResponse[1] + 2 != pageResponse.Length) + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if (pageResponse.Length < 12) + if(pageResponse.Length < 12) return null; ModePage_1B decoded = new ModePage_1B(); @@ -6236,7 +6236,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_1B(ModePage_1B? modePage) { - if (!modePage.HasValue) + if(!modePage.HasValue) return null; ModePage_1B page = modePage.Value; @@ -6244,18 +6244,18 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("SCSI Removable Block Access Capabilities page:"); - if (page.PS) + if(page.PS) sb.AppendLine("\tParameters can be saved"); - if (page.SFLP) + if(page.SFLP) sb.AppendLine("\tDrive can be used as a system floppy device"); - if (page.SRFP) + if(page.SRFP) sb.AppendLine("\tDrive supports reporting progress of format"); - if (page.NCD) + if(page.NCD) sb.AppendLine("\tDrive is a Non-CD Optical Device"); - if (page.SML) + if(page.SML) sb.AppendLine("\tDevice is a dual device supporting CD and Non-CD Optical"); - if (page.TLUN > 0) + if(page.TLUN > 0) sb.AppendFormat("\tDrive supports {0} LUNs", page.TLUN).AppendLine(); return sb.ToString(); @@ -6292,19 +6292,19 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_1C_SFF? DecodeModePage_1C_SFF(byte[] pageResponse) { - if (pageResponse == null) + if(pageResponse == null) return null; - if ((pageResponse[0] & 0x40) == 0x40) + if((pageResponse[0] & 0x40) == 0x40) return null; - if ((pageResponse[0] & 0x3F) != 0x1C) + if((pageResponse[0] & 0x3F) != 0x1C) return null; - if (pageResponse[1] + 2 != pageResponse.Length) + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if (pageResponse.Length < 8) + if(pageResponse.Length < 8) return null; ModePage_1C_SFF decoded = new ModePage_1C_SFF(); @@ -6325,7 +6325,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_1C_SFF(ModePage_1C_SFF? modePage) { - if (!modePage.HasValue) + if(!modePage.HasValue) return null; ModePage_1C_SFF page = modePage.Value; @@ -6333,15 +6333,15 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("SCSI Timer & Protect page:"); - if (page.PS) + if(page.PS) sb.AppendLine("\tParameters can be saved"); - if (page.DISP) + if(page.DISP) sb.AppendLine("\tDrive is disabled until power is cycled"); - if (page.SWPP) + if(page.SWPP) sb.AppendLine("\tDrive is software write-protected until powered down"); - switch (page.InactivityTimeMultiplier) + switch(page.InactivityTimeMultiplier) { case 0: sb.AppendLine("\tDrive will remain in same status a vendor-specified time after a seek, read or write operation"); @@ -6431,19 +6431,19 @@ namespace DiscImageChef.Decoders.SCSI public static ModePage_00_SFF? DecodeModePage_00_SFF(byte[] pageResponse) { - if (pageResponse == null) + if(pageResponse == null) return null; - if ((pageResponse[0] & 0x40) == 0x40) + if((pageResponse[0] & 0x40) == 0x40) return null; - if ((pageResponse[0] & 0x3F) != 0x00) + if((pageResponse[0] & 0x3F) != 0x00) return null; - if (pageResponse[1] + 2 != pageResponse.Length) + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if (pageResponse.Length < 4) + if(pageResponse.Length < 4) return null; ModePage_00_SFF decoded = new ModePage_00_SFF(); @@ -6466,7 +6466,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyModePage_00_SFF(ModePage_00_SFF? modePage) { - if (!modePage.HasValue) + if(!modePage.HasValue) return null; ModePage_00_SFF page = modePage.Value; @@ -6474,18 +6474,18 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("SCSI Drive Operation Mode page:"); - if (page.PS) + if(page.PS) sb.AppendLine("\tParameters can be saved"); - if (page.DVW) + if(page.DVW) sb.AppendLine("\tVerifying after writing is disabled"); - if (page.DDE) + if(page.DDE) sb.AppendLine("\tDrive will abort when a writing error is detected"); - if (page.SLM) + if(page.SLM) { sb.Append("\tDrive has two LUNs with rewritable being "); - if (page.SLM) + if(page.SLM) sb.AppendLine("LUN 1"); else sb.AppendLine("LUN 0"); @@ -6512,31 +6512,31 @@ namespace DiscImageChef.Decoders.SCSI public static DecodedMode? DecodeMode6(byte[] modeResponse, PeripheralDeviceTypes deviceType) { ModeHeader? hdr = DecodeModeHeader6(modeResponse, deviceType); - if (!hdr.HasValue) + if(!hdr.HasValue) return null; DecodedMode decoded = new DecodedMode(); decoded.Header = hdr.Value; int blkDrLength = 0; - if (decoded.Header.BlockDescriptors != null) + if(decoded.Header.BlockDescriptors != null) blkDrLength = decoded.Header.BlockDescriptors.Length; int offset = 4 + blkDrLength * 8; int length = modeResponse[0] + 1; - if (length != modeResponse.Length) + if(length != modeResponse.Length) return decoded; List listpages = new List(); - while (offset < modeResponse.Length) + while(offset < modeResponse.Length) { bool isSubpage = (modeResponse[offset] & 0x40) == 0x40; ModePage pg = new ModePage(); byte pageNo = (byte)(modeResponse[offset] & 0x3F); - if (pageNo == 0) - { + if(pageNo == 0) + { pg.PageResponse = new byte[modeResponse.Length - offset]; Array.Copy(modeResponse, offset, pg.PageResponse, 0, pg.PageResponse.Length); pg.Page = 0; @@ -6545,10 +6545,10 @@ namespace DiscImageChef.Decoders.SCSI } else { - if (isSubpage) + if(isSubpage) { pg.PageResponse = new byte[(modeResponse[offset + 2] << 8) + modeResponse[offset + 3] + 4]; - if ((pg.PageResponse.Length + offset) > modeResponse.Length) + if((pg.PageResponse.Length + offset) > modeResponse.Length) return decoded; Array.Copy(modeResponse, offset, pg.PageResponse, 0, pg.PageResponse.Length); pg.Page = (byte)(modeResponse[offset] & 0x3F); @@ -6558,7 +6558,7 @@ namespace DiscImageChef.Decoders.SCSI else { pg.PageResponse = new byte[modeResponse[offset + 1] + 2]; - if ((pg.PageResponse.Length + offset) > modeResponse.Length) + if((pg.PageResponse.Length + offset) > modeResponse.Length) return decoded; Array.Copy(modeResponse, offset, pg.PageResponse, 0, pg.PageResponse.Length); pg.Page = (byte)(modeResponse[offset] & 0x3F); @@ -6578,7 +6578,7 @@ namespace DiscImageChef.Decoders.SCSI public static DecodedMode? DecodeMode10(byte[] modeResponse, PeripheralDeviceTypes deviceType) { ModeHeader? hdr = DecodeModeHeader10(modeResponse, deviceType); - if (!hdr.HasValue) + if(!hdr.HasValue) return null; DecodedMode decoded = new DecodedMode(); @@ -6586,10 +6586,10 @@ namespace DiscImageChef.Decoders.SCSI bool longlba = (modeResponse[4] & 0x01) == 0x01; int offset; int blkDrLength = 0; - if (decoded.Header.BlockDescriptors != null) + if(decoded.Header.BlockDescriptors != null) blkDrLength = decoded.Header.BlockDescriptors.Length; - if (longlba) + if(longlba) offset = 8 + blkDrLength * 16; else offset = 8 + blkDrLength * 8; @@ -6597,18 +6597,18 @@ namespace DiscImageChef.Decoders.SCSI length += modeResponse[1]; length += 2; - if (length != modeResponse.Length) + if(length != modeResponse.Length) return decoded; List listpages = new List(); - while (offset < modeResponse.Length) + while(offset < modeResponse.Length) { bool isSubpage = (modeResponse[offset] & 0x40) == 0x40; ModePage pg = new ModePage(); byte pageNo = (byte)(modeResponse[offset] & 0x3F); - if (pageNo == 0) + if(pageNo == 0) { pg.PageResponse = new byte[modeResponse.Length - offset]; Array.Copy(modeResponse, offset, pg.PageResponse, 0, pg.PageResponse.Length); @@ -6618,11 +6618,11 @@ namespace DiscImageChef.Decoders.SCSI } else { - if (isSubpage) + if(isSubpage) { pg.PageResponse = new byte[(modeResponse[offset + 2] << 8) + modeResponse[offset + 3] + 4]; - if ((pg.PageResponse.Length + offset) > modeResponse.Length) + if((pg.PageResponse.Length + offset) > modeResponse.Length) return decoded; Array.Copy(modeResponse, offset, pg.PageResponse, 0, pg.PageResponse.Length); @@ -6634,7 +6634,7 @@ namespace DiscImageChef.Decoders.SCSI { pg.PageResponse = new byte[modeResponse[offset + 1] + 2]; - if ((pg.PageResponse.Length + offset) > modeResponse.Length) + if((pg.PageResponse.Length + offset) > modeResponse.Length) return decoded; Array.Copy(modeResponse, offset, pg.PageResponse, 0, pg.PageResponse.Length); @@ -6699,19 +6699,19 @@ namespace DiscImageChef.Decoders.SCSI public static Fujitsu_ModePage_3E? DecodeFujitsuModePage_3E(byte[] pageResponse) { - if (pageResponse == null) + if(pageResponse == null) return null; - if ((pageResponse[0] & 0x40) == 0x40) + if((pageResponse[0] & 0x40) == 0x40) return null; - if ((pageResponse[0] & 0x3F) != 0x3E) + if((pageResponse[0] & 0x3F) != 0x3E) return null; - if (pageResponse[1] + 2 != pageResponse.Length) + if(pageResponse[1] + 2 != pageResponse.Length) return null; - if (pageResponse.Length != 8) + if(pageResponse.Length != 8) return null; Fujitsu_ModePage_3E decoded = new Fujitsu_ModePage_3E(); @@ -6739,7 +6739,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifyFujitsuModePage_3E(Fujitsu_ModePage_3E? modePage) { - if (!modePage.HasValue) + if(!modePage.HasValue) return null; Fujitsu_ModePage_3E page = modePage.Value; @@ -6747,15 +6747,15 @@ namespace DiscImageChef.Decoders.SCSI sb.AppendLine("Fujitsu Verify Control Page:"); - if (page.PS) + if(page.PS) sb.AppendLine("\tParameters can be saved"); - if (page.audioVisualMode) + if(page.audioVisualMode) sb.AppendLine("\tAudio/Visual data support mode is applied"); - if (page.streamingMode) + if(page.streamingMode) sb.AppendLine("\tTest write operation is restricted during read or write operations."); - switch (page.verifyMode) + switch(page.verifyMode) { case Fujitsu_VerifyModes.Always: sb.AppendLine("\tAlways apply the verify operation"); diff --git a/DiscImageChef.Decoders/SCSI/ModesEncoders.cs b/DiscImageChef.Decoders/SCSI/ModesEncoders.cs index be7f6c56a..bfe786c9b 100644 --- a/DiscImageChef.Decoders/SCSI/ModesEncoders.cs +++ b/DiscImageChef.Decoders/SCSI/ModesEncoders.cs @@ -45,47 +45,47 @@ namespace DiscImageChef.Decoders.SCSI { byte[] hdr; - if (header.BlockDescriptors != null) + if(header.BlockDescriptors != null) hdr = new byte[4 + header.BlockDescriptors.Length * 8]; else hdr = new byte[4]; hdr[1] = (byte)header.MediumType; - if (deviceType == PeripheralDeviceTypes.DirectAccess || deviceType == PeripheralDeviceTypes.MultiMediaDevice) + if(deviceType == PeripheralDeviceTypes.DirectAccess || deviceType == PeripheralDeviceTypes.MultiMediaDevice) { - if (header.WriteProtected) + if(header.WriteProtected) hdr[2] += 0x80; - if (header.DPOFUA) + if(header.DPOFUA) hdr[2] += 0x10; } - if (deviceType == PeripheralDeviceTypes.SequentialAccess) + if(deviceType == PeripheralDeviceTypes.SequentialAccess) { - if (header.WriteProtected) + if(header.WriteProtected) hdr[2] += 0x80; hdr[2] += (byte)(header.Speed & 0x0F); hdr[2] += (byte)((header.BufferedMode << 4) & 0x70); } - if (deviceType == PeripheralDeviceTypes.PrinterDevice) + if(deviceType == PeripheralDeviceTypes.PrinterDevice) hdr[2] += (byte)((header.BufferedMode << 4) & 0x70); - if (deviceType == PeripheralDeviceTypes.OpticalDevice) + if(deviceType == PeripheralDeviceTypes.OpticalDevice) { - if (header.WriteProtected) + if(header.WriteProtected) hdr[2] += 0x80; - if (header.EBC) + if(header.EBC) hdr[2] += 0x01; - if (header.DPOFUA) + if(header.DPOFUA) hdr[2] += 0x10; } - if (header.BlockDescriptors != null) + if(header.BlockDescriptors != null) { hdr[3] = (byte)(header.BlockDescriptors.Length * 8); - for (int i = 0; i < header.BlockDescriptors.Length; i++) + for(int i = 0; i < header.BlockDescriptors.Length; i++) { hdr[0 + i * 8 + 4] = (byte)header.BlockDescriptors[i].Density; hdr[1 + i * 8 + 4] = (byte)((header.BlockDescriptors[i].Blocks & 0xFF0000) >> 16); @@ -103,9 +103,9 @@ namespace DiscImageChef.Decoders.SCSI public static byte[] EncodeMode6(DecodedMode mode, PeripheralDeviceTypes deviceType) { int modeSize = 0; - if (mode.Pages != null) + if(mode.Pages != null) { - foreach (ModePage page in mode.Pages) + foreach(ModePage page in mode.Pages) modeSize += page.PageResponse.Length; } @@ -115,10 +115,10 @@ namespace DiscImageChef.Decoders.SCSI Array.Copy(hdr, 0, md, 0, hdr.Length); - if (mode.Pages != null) + if(mode.Pages != null) { int offset = hdr.Length; - foreach (ModePage page in mode.Pages) + foreach(ModePage page in mode.Pages) { Array.Copy(page.PageResponse, 0, md, offset, page.PageResponse.Length); offset += page.PageResponse.Length; @@ -132,9 +132,9 @@ namespace DiscImageChef.Decoders.SCSI public static byte[] EncodeMode10(DecodedMode mode, PeripheralDeviceTypes deviceType) { int modeSize = 0; - if (mode.Pages != null) + if(mode.Pages != null) { - foreach (ModePage page in mode.Pages) + foreach(ModePage page in mode.Pages) modeSize += page.PageResponse.Length; } @@ -144,10 +144,10 @@ namespace DiscImageChef.Decoders.SCSI Array.Copy(hdr, 0, md, 0, hdr.Length); - if (mode.Pages != null) + if(mode.Pages != null) { int offset = hdr.Length; - foreach (ModePage page in mode.Pages) + foreach(ModePage page in mode.Pages) { Array.Copy(page.PageResponse, 0, md, offset, page.PageResponse.Length); offset += page.PageResponse.Length; @@ -166,9 +166,9 @@ namespace DiscImageChef.Decoders.SCSI { byte[] hdr; - if (header.BlockDescriptors != null) + if(header.BlockDescriptors != null) { - if (longLBA) + if(longLBA) hdr = new byte[8 + header.BlockDescriptors.Length * 16]; else hdr = new byte[8 + header.BlockDescriptors.Length * 8]; @@ -178,43 +178,43 @@ namespace DiscImageChef.Decoders.SCSI hdr[2] = (byte)header.MediumType; - if (deviceType == PeripheralDeviceTypes.DirectAccess || deviceType == PeripheralDeviceTypes.MultiMediaDevice) + if(deviceType == PeripheralDeviceTypes.DirectAccess || deviceType == PeripheralDeviceTypes.MultiMediaDevice) { - if (header.WriteProtected) + if(header.WriteProtected) hdr[3] += 0x80; - if (header.DPOFUA) + if(header.DPOFUA) hdr[3] += 0x10; } - if (deviceType == PeripheralDeviceTypes.SequentialAccess) + if(deviceType == PeripheralDeviceTypes.SequentialAccess) { - if (header.WriteProtected) + if(header.WriteProtected) hdr[3] += 0x80; hdr[3] += (byte)(header.Speed & 0x0F); hdr[3] += (byte)((header.BufferedMode << 4) & 0x70); } - if (deviceType == PeripheralDeviceTypes.PrinterDevice) + if(deviceType == PeripheralDeviceTypes.PrinterDevice) hdr[3] += (byte)((header.BufferedMode << 4) & 0x70); - if (deviceType == PeripheralDeviceTypes.OpticalDevice) + if(deviceType == PeripheralDeviceTypes.OpticalDevice) { - if (header.WriteProtected) + if(header.WriteProtected) hdr[3] += 0x80; - if (header.EBC) + if(header.EBC) hdr[3] += 0x01; - if (header.DPOFUA) + if(header.DPOFUA) hdr[3] += 0x10; } - if (longLBA) + if(longLBA) hdr[4] += 0x01; - if (header.BlockDescriptors != null) + if(header.BlockDescriptors != null) { - if (longLBA) + if(longLBA) { - for (int i = 0; i < header.BlockDescriptors.Length; i++) + for(int i = 0; i < header.BlockDescriptors.Length; i++) { byte[] temp = BitConverter.GetBytes(header.BlockDescriptors[i].Blocks); hdr[7 + i * 16 + 8] = temp[0]; @@ -233,9 +233,9 @@ namespace DiscImageChef.Decoders.SCSI } else { - for (int i = 0; i < header.BlockDescriptors.Length; i++) + for(int i = 0; i < header.BlockDescriptors.Length; i++) { - if (deviceType != PeripheralDeviceTypes.DirectAccess) + if(deviceType != PeripheralDeviceTypes.DirectAccess) hdr[0 + i * 8 + 8] = (byte)header.BlockDescriptors[i].Density; else hdr[0 + i * 8 + 8] = (byte)((header.BlockDescriptors[i].Blocks & 0xFF000000) >> 24); @@ -259,23 +259,23 @@ namespace DiscImageChef.Decoders.SCSI pg[0] = 0x01; pg[1] = 6; - if (page.PS) + if(page.PS) pg[0] += 0x80; - if (page.AWRE) + if(page.AWRE) pg[2] += 0x80; - if (page.ARRE) + if(page.ARRE) pg[2] += 0x40; - if (page.TB) + if(page.TB) pg[2] += 0x20; - if (page.RC) + if(page.RC) pg[2] += 0x10; - if (page.EER) + if(page.EER) pg[2] += 0x08; - if (page.PER) + if(page.PER) pg[2] += 0x04; - if (page.DTE) + if(page.DTE) pg[2] += 0x02; - if (page.DCR) + if(page.DCR) pg[2] += 0x01; pg[3] = page.ReadRetryCount; @@ -301,7 +301,7 @@ namespace DiscImageChef.Decoders.SCSI pg[0] = 0x01; pg[1] = 10; - if (page.PS) + if(page.PS) pg[0] += 0x80; pg[2] = page.Parameter; pg[3] = page.ReadRetryCount; diff --git a/DiscImageChef.Decoders/SCSI/SSC/BlockLimits.cs b/DiscImageChef.Decoders/SCSI/SSC/BlockLimits.cs index d9c45a7fd..aca3fbf5c 100644 --- a/DiscImageChef.Decoders/SCSI/SSC/BlockLimits.cs +++ b/DiscImageChef.Decoders/SCSI/SSC/BlockLimits.cs @@ -60,10 +60,10 @@ namespace DiscImageChef.Decoders.SCSI.SSC public static BlockLimitsData? Decode(byte[] response) { - if (response == null) + if(response == null) return null; - if (response.Length != 6) + if(response.Length != 6) return null; BlockLimitsData dec = new BlockLimitsData(); @@ -77,22 +77,22 @@ namespace DiscImageChef.Decoders.SCSI.SSC public static string Prettify(BlockLimitsData? decoded) { - if (decoded == null) + if(decoded == null) return null; StringBuilder sb = new StringBuilder(); - if (decoded.Value.maxBlockLen == decoded.Value.minBlockLen) + if(decoded.Value.maxBlockLen == decoded.Value.minBlockLen) sb.AppendFormat("Device's block size is fixed at {0} bytes", decoded.Value.minBlockLen).AppendLine(); else { - if (decoded.Value.maxBlockLen > 0) + if(decoded.Value.maxBlockLen > 0) sb.AppendFormat("Device's maximum block size is {0} bytes", decoded.Value.maxBlockLen).AppendLine(); else sb.AppendLine("Device does not specify a maximum block size"); sb.AppendFormat("Device's minimum block size is {0} bytes", decoded.Value.minBlockLen).AppendLine(); - if (decoded.Value.granularity > 0) + if(decoded.Value.granularity > 0) sb.AppendFormat("Device's needs a block size granularity of 2^{0} ({1}) bytes", decoded.Value.granularity, Math.Pow(2, (double)decoded.Value.granularity)).AppendLine(); } diff --git a/DiscImageChef.Decoders/SCSI/SSC/DensitySupport.cs b/DiscImageChef.Decoders/SCSI/SSC/DensitySupport.cs index a8e821b9b..a7d69c9d7 100644 --- a/DiscImageChef.Decoders/SCSI/SSC/DensitySupport.cs +++ b/DiscImageChef.Decoders/SCSI/SSC/DensitySupport.cs @@ -94,22 +94,22 @@ namespace DiscImageChef.Decoders.SCSI.SSC public static DensitySupportHeader? DecodeDensity(byte[] response) { - if (response == null) + if(response == null) return null; - if (response.Length <= 56) + if(response.Length <= 56) return null; ushort responseLen = (ushort)((response[0] << 8) + response[1] + 2); - if (response.Length != responseLen) + if(response.Length != responseLen) return null; List descriptors = new List(); int offset = 4; byte[] tmp; - while (offset < response.Length) + while(offset < response.Length) { DensitySupportDescriptor descriptor = new DensitySupportDescriptor(); descriptor.primaryCode = response[offset + 0]; @@ -134,7 +134,7 @@ namespace DiscImageChef.Decoders.SCSI.SSC Array.Copy(response, offset + 32, tmp, 0, 20); descriptor.description = StringHandlers.CToString(tmp).Trim(); - if (descriptor.lenvalid) + if(descriptor.lenvalid) offset += descriptor.len + 5; else offset += 52; @@ -152,23 +152,23 @@ namespace DiscImageChef.Decoders.SCSI.SSC public static string PrettifyDensity(DensitySupportHeader? density) { - if (density == null) + if(density == null) return null; DensitySupportHeader decoded = density.Value; StringBuilder sb = new StringBuilder(); - foreach (DensitySupportDescriptor descriptor in decoded.descriptors) + foreach(DensitySupportDescriptor descriptor in decoded.descriptors) { sb.AppendFormat("Density \"{0}\" defined by \"{1}\".", descriptor.name, descriptor.organization).AppendLine(); sb.AppendFormat("\tPrimary code: {0:X2}h", descriptor.primaryCode).AppendLine(); if(descriptor.primaryCode != descriptor.secondaryCode) sb.AppendFormat("\tSecondary code: {0:X2}h", descriptor.secondaryCode).AppendLine(); - if (descriptor.writable) + if(descriptor.writable) sb.AppendLine("\tDrive can write this density"); - if (descriptor.duplicate) + if(descriptor.duplicate) sb.AppendLine("\tThis descriptor is duplicated"); - if (descriptor.defaultDensity) + if(descriptor.defaultDensity) sb.AppendLine("\tThis is the default density on the drive"); sb.AppendFormat("\tDensity has {0} bits per mm, with {1} tracks in a {2} mm width tape", descriptor.bpmm, descriptor.tracks, (double)((double)descriptor.width / (double)10)).AppendLine(); @@ -187,28 +187,28 @@ namespace DiscImageChef.Decoders.SCSI.SSC public static MediaTypeSupportHeader? DecodeMediumType(byte[] response) { - if (response == null) + if(response == null) return null; - if (response.Length <= 60) + if(response.Length <= 60) return null; ushort responseLen = (ushort)((response[0] << 8) + response[1] + 2); - if (response.Length != responseLen) + if(response.Length != responseLen) return null; List descriptors = new List(); int offset = 4; byte[] tmp; - while (offset < response.Length) + while(offset < response.Length) { MediaTypeSupportDescriptor descriptor = new MediaTypeSupportDescriptor(); descriptor.mediumType = response[offset + 0]; descriptor.reserved1 = response[offset + 1]; descriptor.len = (ushort)((response[offset + 2] << 8) + response[offset + 3]); - if (descriptor.len != 52) + if(descriptor.len != 52) return null; descriptor.numberOfCodes = response[offset + 4]; descriptor.densityCodes = new byte[9]; @@ -242,24 +242,24 @@ namespace DiscImageChef.Decoders.SCSI.SSC public static string PrettifyMediumType(MediaTypeSupportHeader? mediumType) { - if (mediumType == null) + if(mediumType == null) return null; MediaTypeSupportHeader decoded = mediumType.Value; StringBuilder sb = new StringBuilder(); - foreach (MediaTypeSupportDescriptor descriptor in decoded.descriptors) + foreach(MediaTypeSupportDescriptor descriptor in decoded.descriptors) { sb.AppendFormat("Medium type \"{0}\" defined by \"{1}\".", descriptor.name, descriptor.organization).AppendLine(); sb.AppendFormat("\tMedium type code: {0:X2}h", descriptor.mediumType).AppendLine(); - if (descriptor.numberOfCodes > 0) + if(descriptor.numberOfCodes > 0) { sb.AppendFormat("\tMedium supports following density codes:"); - for (int i = 0; i < descriptor.numberOfCodes; i++) + for(int i = 0; i < descriptor.numberOfCodes; i++) sb.AppendFormat(" {0:X2}h", descriptor.densityCodes[i]); sb.AppendLine(); } - + sb.AppendFormat("\tMedium has a nominal length of {0} m in a {1} mm width tape", descriptor.length, (double)((double)descriptor.width / (double)10)).AppendLine(); sb.AppendFormat("\tMedium description: {0}", descriptor.description).AppendLine(); diff --git a/DiscImageChef.Decoders/SCSI/Sense.cs b/DiscImageChef.Decoders/SCSI/Sense.cs index d824070c4..9e42aafbe 100644 --- a/DiscImageChef.Decoders/SCSI/Sense.cs +++ b/DiscImageChef.Decoders/SCSI/Sense.cs @@ -238,16 +238,16 @@ namespace DiscImageChef.Decoders.SCSI /// Sense bytes. public static SenseType GetType(byte[] sense) { - if (sense == null) + if(sense == null) return SenseType.Invalid; - if (sense.Length < 4) + if(sense.Length < 4) return SenseType.Invalid; - if ((sense[0] & 0x70) != 0x70) + if((sense[0] & 0x70) != 0x70) return sense.Length != 4 ? SenseType.Invalid : SenseType.StandardSense; - switch (sense[0] & 0x0F) + switch(sense[0] & 0x0F) { case 0: return SenseType.ExtendedSenseFixedCurrent; @@ -264,7 +264,7 @@ namespace DiscImageChef.Decoders.SCSI public static StandardSense? DecodeStandard(byte[] sense) { - if (GetType(sense) != SenseType.StandardSense) + if(GetType(sense) != SenseType.StandardSense) return null; StandardSense decoded = new StandardSense(); @@ -286,11 +286,11 @@ namespace DiscImageChef.Decoders.SCSI public static FixedSense? DecodeFixed(byte[] sense, out string senseDescription) { senseDescription = null; - if((sense[0] & 0x7F) != 0x70 && + if((sense[0] & 0x7F) != 0x70 && (sense[0] & 0x7F) != 0x71) return null; - if (sense.Length < 8) + if(sense.Length < 8) return null; FixedSense decoded = new FixedSense(); @@ -307,20 +307,20 @@ namespace DiscImageChef.Decoders.SCSI if(sense.Length >= 12) decoded.CommandSpecific = (uint)((sense[8] << 24) + (sense[9] << 16) + (sense[10] << 8) + sense[11]); - if (sense.Length >= 14) + if(sense.Length >= 14) { decoded.ASC = sense[12]; decoded.ASCQ = sense[13]; senseDescription = GetSenseDescription(decoded.ASC, decoded.ASCQ); } - if (sense.Length >= 15) + if(sense.Length >= 15) decoded.FieldReplaceable = sense[14]; if(sense.Length >= 18) decoded.SenseKeySpecific = (uint)((sense[15] << 16) + (sense[16] << 8) + sense[17]); - if (sense.Length > 18) + if(sense.Length > 18) { decoded.AdditionalSense = new byte[sense.Length - 18]; Array.Copy(sense, 18, decoded.AdditionalSense, 0, decoded.AdditionalSense.Length); @@ -339,10 +339,10 @@ namespace DiscImageChef.Decoders.SCSI { senseDescription = null; - if (sense == null) + if(sense == null) return null; - if (sense.Length < 8) + if(sense.Length < 8) return null; DescriptorSense decoded = new DescriptorSense(); @@ -355,9 +355,9 @@ namespace DiscImageChef.Decoders.SCSI senseDescription = GetSenseDescription(decoded.ASC, decoded.ASCQ); int offset = 8; - while (offset < sense.Length) + while(offset < sense.Length) { - if (offset + 2 < sense.Length) + if(offset + 2 < sense.Length) { byte descType = sense[offset]; int descLen = sense[offset + 1] + 1; @@ -380,8 +380,8 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifySense(byte[] sense) { SenseType type = GetType(sense); - - switch (type) + + switch(type) { case SenseType.StandardSense: return PrettifySense(DecodeStandard(sense)); @@ -398,7 +398,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifySense(StandardSense? sense) { - if (!sense.HasValue) + if(!sense.HasValue) return null; return sense.Value.AddressValid ? String.Format("Error class {0} type {1} happened on block {2}\n", @@ -409,7 +409,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifySense(FixedSense? sense) { - if (!sense.HasValue) + if(!sense.HasValue) return null; FixedSense decoded = sense.Value; @@ -417,37 +417,37 @@ namespace DiscImageChef.Decoders.SCSI StringBuilder sb = new StringBuilder(); sb.AppendFormat("SCSI SENSE: {0}", GetSenseKey(decoded.SenseKey)).AppendLine(); - if (decoded.SegmentNumber > 0) + if(decoded.SegmentNumber > 0) sb.AppendFormat("On segment {0}", decoded.SegmentNumber).AppendLine(); - if (decoded.Filemark) + if(decoded.Filemark) sb.AppendLine("Filemark or setmark found"); - if (decoded.EOM) + if(decoded.EOM) sb.AppendLine("End-of-medium/partition found"); - if (decoded.ILI) + if(decoded.ILI) sb.AppendLine("Incorrect length indicator"); - if (decoded.InformationValid) + if(decoded.InformationValid) sb.AppendFormat("On logical block {0}", decoded.Information).AppendLine(); - if (decoded.AdditionalLength < 6) + if(decoded.AdditionalLength < 6) return sb.ToString(); sb.AppendLine(GetSenseDescription(decoded.ASC, decoded.ASCQ)); - if (decoded.AdditionalLength < 10) + if(decoded.AdditionalLength < 10) return sb.ToString(); - if (decoded.SKSV) + if(decoded.SKSV) { - switch (decoded.SenseKey) + switch(decoded.SenseKey) { case SenseKeys.IllegalRequest: { - if ((decoded.SenseKeySpecific & 0x400000) == 0x400000) + if((decoded.SenseKeySpecific & 0x400000) == 0x400000) sb.AppendLine("Illegal field in CDB"); else sb.AppendLine("Illegal field in data parameters"); - if ((decoded.SenseKeySpecific & 0x200000) == 0x200000) + if((decoded.SenseKeySpecific & 0x200000) == 0x200000) sb.AppendFormat("Invalid value in bit {0} in field {1} of CDB", (decoded.SenseKeySpecific & 0x70000) >> 16, decoded.SenseKeySpecific & 0xFFFF).AppendLine(); @@ -473,7 +473,7 @@ namespace DiscImageChef.Decoders.SCSI public static string PrettifySense(DescriptorSense? sense) { - if (!sense.HasValue) + if(!sense.HasValue) return null; DescriptorSense decoded = sense.Value; @@ -486,9 +486,9 @@ namespace DiscImageChef.Decoders.SCSI if(decoded.Descriptors == null || decoded.Descriptors.Count == 0) return sb.ToString(); - foreach (KeyValuePair kvp in decoded.Descriptors) + foreach(KeyValuePair kvp in decoded.Descriptors) { - switch (kvp.Key) + switch(kvp.Key) { case 0x00: sb.AppendLine(PrettifyDescriptor00(kvp.Value)); @@ -506,7 +506,7 @@ namespace DiscImageChef.Decoders.SCSI /// Descriptor. public static UInt64 DecodeDescriptor00(byte[] descriptor) { - if (descriptor.Length != 12 || descriptor[0] != 0x00) + if(descriptor.Length != 12 || descriptor[0] != 0x00) return 0; byte[] temp = new byte[8]; @@ -530,7 +530,7 @@ namespace DiscImageChef.Decoders.SCSI /// Descriptor. public static UInt64 DecodeDescriptor01(byte[] descriptor) { - if (descriptor.Length != 12 || descriptor[0] != 0x01) + if(descriptor.Length != 12 || descriptor[0] != 0x01) return 0; byte[] temp = new byte[8]; @@ -554,7 +554,7 @@ namespace DiscImageChef.Decoders.SCSI /// Descriptor. public static byte[] DecodeDescriptor02(byte[] descriptor) { - if (descriptor.Length != 8 || descriptor[0] != 0x02) + if(descriptor.Length != 8 || descriptor[0] != 0x02) return null; byte[] temp = new byte[3]; @@ -569,7 +569,7 @@ namespace DiscImageChef.Decoders.SCSI /// Descriptor. public static byte DecodeDescriptor03(byte[] descriptor) { - if (descriptor.Length != 4 || descriptor[0] != 0x03) + if(descriptor.Length != 4 || descriptor[0] != 0x03) return 0; return descriptor[3]; @@ -582,7 +582,7 @@ namespace DiscImageChef.Decoders.SCSI /// Descriptor. public static AnotherProgressIndicationSenseDescriptor? DecodeDescriptor0A(byte[] descriptor) { - if (descriptor.Length != 8 || descriptor[0] != 0x0A) + if(descriptor.Length != 8 || descriptor[0] != 0x0A) return null; AnotherProgressIndicationSenseDescriptor decoded = new AnotherProgressIndicationSenseDescriptor(); @@ -657,7 +657,7 @@ namespace DiscImageChef.Decoders.SCSI public static string GetSenseKey(SenseKeys key) { - switch (key) + switch(key) { case SenseKeys.AbortedCommand: return "ABORTED COMMAND"; @@ -696,10 +696,10 @@ namespace DiscImageChef.Decoders.SCSI public static string GetSenseDescription(byte ASC, byte ASCQ) { - switch (ASC) + switch(ASC) { case 0x00: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "NO ADDITIONAL SENSE INFORMATION"; @@ -754,21 +754,21 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x01: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "NO INDEX/SECTOR SIGNAL"; } break; case 0x02: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "NO SEEK COMPLETE"; } break; case 0x03: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "PERIPHERAL DEVICE WRITE FAULT"; @@ -779,7 +779,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x04: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "LOGICAL UNIT NOT READY, CAUSE NOT REPORTABLE"; @@ -852,28 +852,28 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x05: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "LOGICAL UNIT DOES NOT RESPOND TO SELECTION"; } break; case 0x06: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "NO REFERENCE POSITION FOUND"; } break; case 0x07: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "MULTIPLE PERIPHERAL DEVICES SELECTED"; } break; case 0x08: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "LOGICAL UNIT COMMUNICATION FAILURE"; @@ -888,7 +888,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x09: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "TRACK FLOLLOWING ERROR"; @@ -905,14 +905,14 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x0A: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "ERROR LOG OVERFLOW"; } break; case 0x0B: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "WARNING"; @@ -954,7 +954,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x0C: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "WRITE ERROR"; @@ -997,7 +997,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x0D: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "ERROR DETECTED BY THIRD PARTY TEMPORARY INITIATOR"; @@ -1014,7 +1014,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x0E: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "INVALID INFORMATION UNIT"; @@ -1027,7 +1027,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x10: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "ID CRC OR ECC ERROR"; @@ -1044,7 +1044,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x11: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "UNRECOVERED READ ERROR"; @@ -1093,21 +1093,21 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x12: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "ADDRESS MARK NOT FOUND FOR ID FIELD"; } break; case 0x13: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "ADDRESS MARK NOT FOUND FOR DATA FIELD"; } break; case 0x14: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "RECORDED ENTITY NOT FOUND"; @@ -1128,7 +1128,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x15: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "RANDOM POSITIONING ERROR"; @@ -1139,7 +1139,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x16: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "DATA SYNCHRONIZATION MARK ERROR"; @@ -1154,7 +1154,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x17: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "RECOVERED DATA WITH NO ERROR CORRECTION APPLIED"; @@ -1179,7 +1179,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x18: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "RECOVERED DATA WITH ERROR CORRECTION APPLIED"; @@ -1202,7 +1202,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x19: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "DEFECT LIST ERROR"; @@ -1215,21 +1215,21 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x1A: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "PARAMETER LIST LENGTH ERROR"; } break; case 0x1B: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "SYNCHRONOUS DATA TRANSFER ERROR"; } break; case 0x1C: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "DEFECT LIST NOT FOUND"; @@ -1240,7 +1240,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x1D: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "MISCOMPARE DURING VERIFY OPERATION"; @@ -1249,21 +1249,21 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x1E: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "RECOVERED ID WITH ECC CORRECTION"; } break; case 0x1F: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "PARTIAL DEFECT LIST TRANSFER"; } break; case 0x20: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "INVALID COMMAND OPERATION CODE"; @@ -1294,7 +1294,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x21: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "LOGICAL BLOCK ADDRESS OUT OF RANGE"; @@ -1315,14 +1315,14 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x22: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "ILLEGAL FUNCTION"; } break; case 0x23: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "INVALID TOKEN OPERATION, CAUSE NOT REPORTABLE"; @@ -1349,7 +1349,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x24: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "ILLEGAL FIELD IN CDB"; @@ -1372,14 +1372,14 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x25: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "LOGICAL UNIT NOT SUPPORTED"; } break; case 0x26: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "INVALID FIELD IN PARAMETER LIST"; @@ -1424,7 +1424,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x27: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "WRITE PROTECTED"; @@ -1447,7 +1447,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x28: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "NOT READY TO READY CHANGE (MEDIUM MAY HAVE CHANGED)"; @@ -1460,7 +1460,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x29: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "POWER ON, RESET, OR BUS DEVICE RESET OCCURRED"; @@ -1481,7 +1481,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x2A: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "PARAMETERS CHANGED"; @@ -1526,14 +1526,14 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x2B: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "COPY CANNOT EXECUTE SINCE HOST CANNOT DISCONNECT"; } break; case 0x2C: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "COMMAND SEQUENCE ERROR"; @@ -1572,14 +1572,14 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x2D: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "OVERWRITE ERROR ON UPDATE IN PLACE"; } break; case 0x2E: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "INSUFFICIENT TIME FOR OPERATION"; @@ -1592,7 +1592,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x2F: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "COMMANDS CLEARED BY ANOTHER INITIATOR"; @@ -1605,7 +1605,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x30: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "INCOMPATIBLE MEDIUM INSTALLED"; @@ -1644,7 +1644,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x31: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "MEDIUM FORMAT CORRUPTED"; @@ -1657,7 +1657,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x32: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "NO DEFECT SPARE LOCATION AVAILABLE"; @@ -1666,21 +1666,21 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x33: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "TAPE LENGTH ERROR"; } break; case 0x34: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "ENCLOSURE FAILURE"; } break; case 0x35: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "ENCLOSURE SERVICES FAILURE"; @@ -1697,21 +1697,21 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x36: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "RIBBON, INK, OR TONER FAILURE"; } break; case 0x37: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "ROUNDED PARAMETER"; } break; case 0x38: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "EVENT STATUS NOTIFICATION"; @@ -1726,14 +1726,14 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x39: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "SAVING PARAMETERS NOT SUPPORTED"; } break; case 0x3A: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "MEDIUM NOT PRESENT"; @@ -1748,7 +1748,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x3B: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "SEQUENTIAL POSITIONING ERROR"; @@ -1809,14 +1809,14 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x3D: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "INVALID BITS IN IDENTIFY MESSAGE"; } break; case 0x3E: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "LOGICAL UNIT HAS NOT SELF-CONFIGURED YET"; @@ -1831,7 +1831,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x3F: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "TARGET OPERATING CONDITIONS HAVE CHANGED"; @@ -1884,7 +1884,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x40: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "RAM FAILURE"; @@ -1892,28 +1892,28 @@ namespace DiscImageChef.Decoders.SCSI return String.Format("DIAGNOSTIC FAILURE ON COMPONENT {0:X2}h", ASCQ); } case 0x41: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "DATA PATH FAILURE"; } break; case 0x42: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "POWER-ON OR SELF-TEST FAILURE"; } break; case 0x43: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "MESSAGE ERROR"; } break; case 0x44: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "INTERNAL TARGET FAILURE"; @@ -1924,21 +1924,21 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x45: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "SELECT OR RESELECT FAILURE"; } break; case 0x46: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "UNSUCCESSFUL SOFT RESET"; } break; case 0x47: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "SCSI PARITY ERROR"; @@ -1959,28 +1959,28 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x48: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "INITIATOR DETECTED ERROR MESSAGE RECEIVED"; } break; case 0x49: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "INVALID MESSAGE ERROR"; } break; case 0x4A: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "COMMAND PHASE ERROR"; } break; case 0x4B: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "DATA PHASE ERROR"; @@ -2029,7 +2029,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x4C: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "LOGICAL UNIT FAILED SELF-CONFIGURATION"; @@ -2038,7 +2038,7 @@ namespace DiscImageChef.Decoders.SCSI case 0x4E: return String.Format("OVERLAPPED COMMANDS ATTEMPTED FOR TASK TAG {0:X2}h", ASCQ); case 0x50: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "WRITE APPEND ERROR"; @@ -2049,7 +2049,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x51: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "ERASE FAILURE"; @@ -2058,14 +2058,14 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x52: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "CARTRIDGE FAULT"; } break; case 0x53: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "MEDIA LOAD OR EJECT FAILED"; @@ -2098,14 +2098,14 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x54: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "SCSI TO HOST SYSTEM INTERFACE FAILURE"; } break; case 0x55: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "SYSTEM RESOURCE FAILURE"; @@ -2144,28 +2144,28 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x57: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "UNABLE TO RECOVER TABLE-OF-CONTENTS"; } break; case 0x58: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "GENERATION DOES NOT EXIST"; } break; case 0x59: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "UPDATED BLOCK READ"; } break; case 0x5A: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "OPERATOR REQUEST OR STATE CHANGE INPUT"; @@ -2178,7 +2178,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x5B: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "LOG EXCEPTION"; @@ -2191,7 +2191,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x5C: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "RPL STATUS CHANGE"; @@ -2362,7 +2362,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x5E: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "LOW POWER CONDITION ON"; @@ -2399,14 +2399,14 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x60: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "LAMP FAILURE"; } break; case 0x61: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "VIDEO ACQUISTION ERROR"; @@ -2417,14 +2417,14 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x62: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "SCAN HEAD POSITIONING ERROR"; } break; case 0x63: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "END OF USER AREA ENCOUNTERED ON THIS TRACK"; @@ -2433,7 +2433,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x64: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "ILLEGAL MODE FOR THIS TRACK"; @@ -2442,14 +2442,14 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x65: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "VOLTAGE FAULT"; } break; case 0x66: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "AUTOMATIC DOCUMENT FEEDER COVER UP"; @@ -2462,7 +2462,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x67: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "CONFIGURATION FAILURE"; @@ -2491,7 +2491,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x68: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "LOGICAL UNIT NOT CONFIGURED"; @@ -2500,7 +2500,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x69: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "DATA LOSS ON LOGICAL UNIT"; @@ -2511,14 +2511,14 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x6A: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "INFORMATIONAL, REFER TO LOG"; } break; case 0x6B: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "STATE CHANGE HAS OCCURRED"; @@ -2529,28 +2529,28 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x6C: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "REBUILD FAILURE OCCURRED"; } break; case 0x6D: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "RECALCULATE FAILURE OCCURRED"; } break; case 0x6E: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "COMMAND TO LOGICAL UNIT FAILED"; } break; case 0x6F: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "COPY PROTECTION KEY EXCHANGE FAILURE - AUTHENTICATION FAILURE"; @@ -2573,14 +2573,14 @@ namespace DiscImageChef.Decoders.SCSI case 0x70: return String.Format("DECOMPRESSION EXCEPTION SHORT ALGORITHM ID OF {0:X2}h", ASCQ); case 0x71: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "DECOMPRESSIONG EXCEPTION LONG ALGORITHM ID"; } break; case 0x72: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "SESSION FIXATION ERROR"; @@ -2601,7 +2601,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x73: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "CD CONTROL ERROR"; @@ -2626,7 +2626,7 @@ namespace DiscImageChef.Decoders.SCSI } break; case 0x74: - switch (ASCQ) + switch(ASCQ) { case 0x00: return "SECURITY ERROR"; diff --git a/DiscImageChef.Decoders/SCSI/Types.cs b/DiscImageChef.Decoders/SCSI/Types.cs index 16642d1a4..e9a7c06a3 100644 --- a/DiscImageChef.Decoders/SCSI/Types.cs +++ b/DiscImageChef.Decoders/SCSI/Types.cs @@ -598,7 +598,7 @@ namespace DiscImageChef.Decoders.SCSI /// Exatape75m = 0xD7, - + #endregion Medium Types found in vendor documents } diff --git a/DiscImageChef.Decoders/SCSI/VendorString.cs b/DiscImageChef.Decoders/SCSI/VendorString.cs index d5908cd5a..cc02a45f7 100644 --- a/DiscImageChef.Decoders/SCSI/VendorString.cs +++ b/DiscImageChef.Decoders/SCSI/VendorString.cs @@ -43,7 +43,7 @@ namespace DiscImageChef.Decoders.SCSI { public static string Prettify(string SCSIVendorString) { - switch (SCSIVendorString) + switch(SCSIVendorString) { case "0B4C": return "MOOSIK Ltd."; diff --git a/DiscImageChef.Decoders/Xbox/DMI.cs b/DiscImageChef.Decoders/Xbox/DMI.cs index d61d8a81e..eb2dde99c 100644 --- a/DiscImageChef.Decoders/Xbox/DMI.cs +++ b/DiscImageChef.Decoders/Xbox/DMI.cs @@ -44,9 +44,9 @@ namespace DiscImageChef.Decoders.Xbox { public static bool IsXbox(byte[] dmi) { - if (dmi == null) + if(dmi == null) return false; - if (dmi.Length != 2052) + if(dmi.Length != 2052) return false; // TODO: Need to implement it @@ -55,9 +55,9 @@ namespace DiscImageChef.Decoders.Xbox public static bool IsXbox360(byte[] dmi) { - if (dmi == null) + if(dmi == null) return false; - if (dmi.Length != 2052) + if(dmi.Length != 2052) return false; uint signature = BitConverter.ToUInt32(dmi, 0x7EC); @@ -112,7 +112,7 @@ namespace DiscImageChef.Decoders.Xbox public static Xbox360DMI? DecodeXbox360(byte[] response) { bool isX360 = IsXbox360(response); - if (!isX360) + if(!isX360) return null; Xbox360DMI dmi = new Xbox360DMI(); @@ -129,7 +129,7 @@ namespace DiscImageChef.Decoders.Xbox Array.Copy(response, 68, tmp, 0, 16); dmi.CatalogNumber = StringHandlers.CToString(tmp); - if (dmi.CatalogNumber == null || dmi.CatalogNumber.Length < 13) + if(dmi.CatalogNumber == null || dmi.CatalogNumber.Length < 13) return null; return dmi; @@ -137,45 +137,45 @@ namespace DiscImageChef.Decoders.Xbox public static string PrettifyXbox360(Xbox360DMI? dmi) { - if (dmi == null) + if(dmi == null) return null; Xbox360DMI decoded = dmi.Value; StringBuilder sb = new StringBuilder(); sb.Append("Catalogue number: "); - for (int i = 0; i < 2; i++) + for(int i = 0; i < 2; i++) sb.AppendFormat("{0}", decoded.CatalogNumber[i]); sb.Append("-"); - for (int i = 2; i < 6; i++) + for(int i = 2; i < 6; i++) sb.AppendFormat("{0}", decoded.CatalogNumber[i]); sb.Append("-"); - for (int i = 6; i < 8; i++) + for(int i = 6; i < 8; i++) sb.AppendFormat("{0}", decoded.CatalogNumber[i]); sb.Append("-"); if(decoded.CatalogNumber.Length == 13) { - for (int i = 8; i < 10; i++) + for(int i = 8; i < 10; i++) sb.AppendFormat("{0}", decoded.CatalogNumber[i]); sb.Append("-"); - for (int i = 10; i < 13; i++) + for(int i = 10; i < 13; i++) sb.AppendFormat("{0}", decoded.CatalogNumber[i]); } else if(decoded.CatalogNumber.Length == 14) { - for (int i = 8; i < 11; i++) + for(int i = 8; i < 11; i++) sb.AppendFormat("{0}", decoded.CatalogNumber[i]); sb.Append("-"); - for (int i = 11; i < 14; i++) + for(int i = 11; i < 14; i++) sb.AppendFormat("{0}", decoded.CatalogNumber[i]); } else { - for (int i = 8; i < decoded.CatalogNumber.Length - 3; i++) + for(int i = 8; i < decoded.CatalogNumber.Length - 3; i++) sb.AppendFormat("{0}", decoded.CatalogNumber[i]); sb.Append("-"); - for (int i = decoded.CatalogNumber.Length - 3; i < decoded.CatalogNumber.Length; i++) + for(int i = decoded.CatalogNumber.Length - 3; i < decoded.CatalogNumber.Length; i++) sb.AppendFormat("{0}", decoded.CatalogNumber[i]); } sb.AppendLine(); diff --git a/DiscImageChef.Devices/Command.cs b/DiscImageChef.Devices/Command.cs index e71dd61f0..5ccdb58a4 100644 --- a/DiscImageChef.Devices/Command.cs +++ b/DiscImageChef.Devices/Command.cs @@ -79,13 +79,13 @@ namespace DiscImageChef.Devices /// True if SCSI error returned non-OK status and contains SCSI sense public static int SendScsiCommand(Interop.PlatformID ptID, object fd, byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout, ScsiDirection direction, out double duration, out bool sense) { - switch (ptID) + switch(ptID) { case Interop.PlatformID.Win32NT: { Windows.ScsiIoctlDirection dir; - switch (direction) + switch(direction) { case ScsiDirection.In: dir = Windows.ScsiIoctlDirection.In; @@ -104,7 +104,7 @@ namespace DiscImageChef.Devices { Linux.ScsiIoctlDirection dir; - switch (direction) + switch(direction) { case ScsiDirection.In: dir = Linux.ScsiIoctlDirection.In; @@ -146,7 +146,7 @@ namespace DiscImageChef.Devices AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, bool transferBlocks, out double duration, out bool sense) { - switch (ptID) + switch(ptID) { case Interop.PlatformID.Win32NT: { @@ -178,7 +178,7 @@ namespace DiscImageChef.Devices AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, bool transferBlocks, out double duration, out bool sense) { - switch (ptID) + switch(ptID) { case Interop.PlatformID.Win32NT: { @@ -210,7 +210,7 @@ namespace DiscImageChef.Devices AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout, bool transferBlocks, out double duration, out bool sense) { - switch (ptID) + switch(ptID) { case Interop.PlatformID.Win32NT: { diff --git a/DiscImageChef.Devices/Device/AtaCommands/Ata28.cs b/DiscImageChef.Devices/Device/AtaCommands/Ata28.cs index 1b8e2aa4d..8b693980e 100644 --- a/DiscImageChef.Devices/Device/AtaCommands/Ata28.cs +++ b/DiscImageChef.Devices/Device/AtaCommands/Ata28.cs @@ -84,7 +84,7 @@ namespace DiscImageChef.Devices public bool ReadDma(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, bool retry, uint lba, byte count, uint timeout, out double duration) { - if (count == 0) + if(count == 0) buffer = new byte[512 * 256]; else buffer = new byte[512 * count]; @@ -113,7 +113,7 @@ namespace DiscImageChef.Devices public bool ReadMultiple(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, uint lba, byte count, uint timeout, out double duration) { - if (count == 0) + if(count == 0) buffer = new byte[512 * 256]; else buffer = new byte[512 * count]; @@ -151,7 +151,7 @@ namespace DiscImageChef.Devices ref buffer, timeout, false, out duration, out sense); error = lastError != 0; - if ((statusRegisters.status & 0x23) == 0) + if((statusRegisters.status & 0x23) == 0) { lba += (uint)(statusRegisters.deviceHead & 0xF); lba *= 0x1000000; @@ -172,7 +172,7 @@ namespace DiscImageChef.Devices public bool Read(out byte[] buffer, out AtaErrorRegistersLBA28 statusRegisters, bool retry, uint lba, byte count, uint timeout, out double duration) { - if (count == 0) + if(count == 0) buffer = new byte[512 * 256]; else buffer = new byte[512 * count]; diff --git a/DiscImageChef.Devices/Device/AtaCommands/Ata48.cs b/DiscImageChef.Devices/Device/AtaCommands/Ata48.cs index d32fed57e..1a04b8850 100644 --- a/DiscImageChef.Devices/Device/AtaCommands/Ata48.cs +++ b/DiscImageChef.Devices/Device/AtaCommands/Ata48.cs @@ -57,7 +57,7 @@ namespace DiscImageChef.Devices ref buffer, timeout, false, out duration, out sense); error = lastError != 0; - if ((statusRegisters.status & 0x23) == 0) + if((statusRegisters.status & 0x23) == 0) { lba = statusRegisters.lbaHigh; lba *= 0x100000000; @@ -72,7 +72,7 @@ namespace DiscImageChef.Devices public bool ReadDma(out byte[] buffer, out AtaErrorRegistersLBA48 statusRegisters, ulong lba, ushort count, uint timeout, out double duration) { - if (count == 0) + if(count == 0) buffer = new byte[512 * 65536]; else buffer = new byte[512 * count]; @@ -139,7 +139,7 @@ namespace DiscImageChef.Devices public bool ReadMultiple(out byte[] buffer, out AtaErrorRegistersLBA48 statusRegisters, ulong lba, ushort count, uint timeout, out double duration) { - if (count == 0) + if(count == 0) buffer = new byte[512 * 65536]; else buffer = new byte[512 * count]; @@ -176,7 +176,7 @@ namespace DiscImageChef.Devices ref buffer, timeout, false, out duration, out sense); error = lastError != 0; - if ((statusRegisters.status & 0x23) == 0) + if((statusRegisters.status & 0x23) == 0) { lba = statusRegisters.lbaHigh; lba *= 0x100000000; @@ -191,7 +191,7 @@ namespace DiscImageChef.Devices public bool Read(out byte[] buffer, out AtaErrorRegistersLBA48 statusRegisters, ulong lba, ushort count, uint timeout, out double duration) { - if (count == 0) + if(count == 0) buffer = new byte[512 * 65536]; else buffer = new byte[512 * count]; diff --git a/DiscImageChef.Devices/Device/AtaCommands/AtaCHS.cs b/DiscImageChef.Devices/Device/AtaCommands/AtaCHS.cs index b614f7301..3d678829e 100644 --- a/DiscImageChef.Devices/Device/AtaCommands/AtaCHS.cs +++ b/DiscImageChef.Devices/Device/AtaCommands/AtaCHS.cs @@ -111,7 +111,7 @@ namespace DiscImageChef.Devices public bool ReadDma(out byte[] buffer, out AtaErrorRegistersCHS statusRegisters, bool retry, ushort cylinder, byte head, byte sector, byte count, uint timeout, out double duration) { - if (count == 0) + if(count == 0) buffer = new byte[512 * 256]; else buffer = new byte[512 * count]; @@ -139,7 +139,7 @@ namespace DiscImageChef.Devices public bool ReadMultiple(out byte[] buffer, out AtaErrorRegistersCHS statusRegisters, ushort cylinder, byte head, byte sector, byte count, uint timeout, out double duration) { - if (count == 0) + if(count == 0) buffer = new byte[512 * 256]; else buffer = new byte[512 * count]; @@ -170,7 +170,7 @@ namespace DiscImageChef.Devices public bool Read(out byte[] buffer, out AtaErrorRegistersCHS statusRegisters, bool retry, ushort cylinder, byte head, byte sector, byte count, uint timeout, out double duration) { - if (count == 0) + if(count == 0) buffer = new byte[512 * 256]; else buffer = new byte[512 * count]; diff --git a/DiscImageChef.Devices/Device/Constructor.cs b/DiscImageChef.Devices/Device/Constructor.cs index 3d6064c11..c112823fa 100644 --- a/DiscImageChef.Devices/Device/Constructor.cs +++ b/DiscImageChef.Devices/Device/Constructor.cs @@ -55,7 +55,7 @@ namespace DiscImageChef.Devices error = false; removable = false; - switch (platformID) + switch(platformID) { case Interop.PlatformID.Win32NT: { @@ -65,7 +65,7 @@ namespace DiscImageChef.Devices IntPtr.Zero, Windows.FileMode.OpenExisting, Windows.FileAttributes.Normal, IntPtr.Zero); - if (((SafeFileHandle)fd).IsInvalid) + if(((SafeFileHandle)fd).IsInvalid) { error = true; lastError = Marshal.GetLastWin32Error(); @@ -78,7 +78,7 @@ namespace DiscImageChef.Devices { fd = Linux.Extern.open(devicePath, Linux.FileFlags.Readonly | Linux.FileFlags.NonBlocking); - if ((int)fd < 0) + if((int)fd < 0) { error = true; lastError = Marshal.GetLastWin32Error(); @@ -91,7 +91,7 @@ namespace DiscImageChef.Devices throw new InvalidOperationException(String.Format("Platform {0} not yet supported.", platformID)); } - if (error) + if(error) throw new SystemException(String.Format("Error {0} opening device.", lastError)); type = DeviceType.Unknown; @@ -105,7 +105,7 @@ namespace DiscImageChef.Devices bool scsiSense = ScsiInquiry(out inqBuf, out senseBuf); - if (error) + if(error) throw new SystemException(String.Format("Error {0} trying device.", lastError)); #region USB @@ -157,16 +157,16 @@ namespace DiscImageChef.Devices if(System.IO.File.Exists(resolvedLink + "/product")) { - usbSr = new System.IO.StreamReader(resolvedLink + "/product"); - usbProductString = usbSr.ReadToEnd().Trim(); - usbSr.Close(); + usbSr = new System.IO.StreamReader(resolvedLink + "/product"); + usbProductString = usbSr.ReadToEnd().Trim(); + usbSr.Close(); } if(System.IO.File.Exists(resolvedLink + "/serial")) { - usbSr = new System.IO.StreamReader(resolvedLink + "/serial"); - usbSerialString = usbSr.ReadToEnd().Trim(); - usbSr.Close(); + usbSr = new System.IO.StreamReader(resolvedLink + "/serial"); + usbSerialString = usbSr.ReadToEnd().Trim(); + usbSr.Close(); } usb = true; @@ -246,16 +246,16 @@ namespace DiscImageChef.Devices firewire = false; #endregion FireWire - if (!scsiSense) + if(!scsiSense) { Decoders.SCSI.Inquiry.SCSIInquiry? Inquiry = Decoders.SCSI.Inquiry.Decode(inqBuf); type = DeviceType.SCSI; bool serialSense = ScsiInquiry(out inqBuf, out senseBuf, 0x80); - if (!serialSense) + if(!serialSense) serial = Decoders.SCSI.EVPD.DecodePage80(inqBuf); - - if (Inquiry.HasValue) + + if(Inquiry.HasValue) { string tmp = StringHandlers.CToString(Inquiry.Value.ProductRevisionLevel); if(tmp != null) @@ -273,29 +273,29 @@ namespace DiscImageChef.Devices bool atapiSense = AtapiIdentify(out ataBuf, out errorRegisters); - if (!atapiSense) + if(!atapiSense) { type = DeviceType.ATAPI; Identify.IdentifyDevice? ATAID = Identify.Decode(ataBuf); - if (ATAID.HasValue) + if(ATAID.HasValue) serial = ATAID.Value.SerialNumber; } } - if ((scsiSense && (usb || firewire)) || manufacturer == "ATA") + if((scsiSense && (usb || firewire)) || manufacturer == "ATA") { bool ataSense = AtaIdentify(out ataBuf, out errorRegisters); - if (!ataSense) + if(!ataSense) { type = DeviceType.ATA; Identify.IdentifyDevice? ATAID = Identify.Decode(ataBuf); - if (ATAID.HasValue) + if(ATAID.HasValue) { string[] separated = ATAID.Value.Model.Split(' '); - if (separated.Length == 1) + if(separated.Length == 1) model = separated[0]; else { @@ -308,7 +308,7 @@ namespace DiscImageChef.Devices scsiType = Decoders.SCSI.PeripheralDeviceTypes.DirectAccess; - if ((ushort)ATAID.Value.GeneralConfiguration != 0x848A) + if((ushort)ATAID.Value.GeneralConfiguration != 0x848A) { removable |= (ATAID.Value.GeneralConfiguration & Identify.GeneralConfigurationBit.Removable) == Identify.GeneralConfigurationBit.Removable; } @@ -316,7 +316,7 @@ namespace DiscImageChef.Devices } } - if (type == DeviceType.Unknown) + if(type == DeviceType.Unknown) { manufacturer = null; model = null; @@ -324,17 +324,17 @@ namespace DiscImageChef.Devices serial = null; } - if (usb) + if(usb) { - if (string.IsNullOrEmpty(manufacturer)) + if(string.IsNullOrEmpty(manufacturer)) manufacturer = usbManufacturerString; - if (string.IsNullOrEmpty(model)) + if(string.IsNullOrEmpty(model)) model = usbProductString; - if (string.IsNullOrEmpty(serial)) + if(string.IsNullOrEmpty(serial)) serial = usbSerialString; else { - foreach (char c in serial) + foreach(char c in serial) { if(Char.IsControl(c)) serial = usbSerialString; @@ -342,17 +342,17 @@ namespace DiscImageChef.Devices } } - if (firewire) + if(firewire) { - if (string.IsNullOrEmpty(manufacturer)) + if(string.IsNullOrEmpty(manufacturer)) manufacturer = firewireVendorName; - if (string.IsNullOrEmpty(model)) + if(string.IsNullOrEmpty(model)) model = firewireModelName; - if (string.IsNullOrEmpty(serial)) + if(string.IsNullOrEmpty(serial)) serial = String.Format("{0:X16}", firewireGuid); else { - foreach (char c in serial) + foreach(char c in serial) { if(Char.IsControl(c)) serial = String.Format("{0:X16}", firewireGuid); diff --git a/DiscImageChef.Devices/Device/Destructor.cs b/DiscImageChef.Devices/Device/Destructor.cs index 1072196fb..df3bfd8d6 100644 --- a/DiscImageChef.Devices/Device/Destructor.cs +++ b/DiscImageChef.Devices/Device/Destructor.cs @@ -48,9 +48,9 @@ namespace DiscImageChef.Devices /// ~Device() { - if (fd != null) + if(fd != null) { - switch (platformID) + switch(platformID) { case Interop.PlatformID.Win32NT: Windows.Extern.CloseHandle((SafeFileHandle)fd); diff --git a/DiscImageChef.Devices/Device/ScsiCommands/Adaptec.cs b/DiscImageChef.Devices/Device/ScsiCommands/Adaptec.cs index 95a8c4049..daeeb1e8f 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/Adaptec.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/Adaptec.cs @@ -75,7 +75,7 @@ namespace DiscImageChef.Devices cdb[1] = (byte)((lba & 0x1F0000) >> 16); cdb[2] = (byte)((lba & 0xFF00) >> 8); cdb[3] = (byte)(lba & 0xFF); - if (drive1) + if(drive1) cdb[1] += 0x20; lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); @@ -117,7 +117,7 @@ namespace DiscImageChef.Devices bool sense; cdb[0] = (byte)ScsiCommands.Adaptec_SetErrorThreshold; - if (drive1) + if(drive1) cdb[1] += 0x20; cdb[4] = 1; @@ -157,7 +157,7 @@ namespace DiscImageChef.Devices bool sense; cdb[0] = (byte)ScsiCommands.Adaptec_Translate; - if (drive1) + if(drive1) cdb[1] += 0x20; cdb[4] = (byte)buffer.Length; @@ -179,7 +179,7 @@ namespace DiscImageChef.Devices public bool AdaptecWriteBuffer(byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration) { byte[] oneKBuffer = new byte[1024]; - if (buffer.Length < 1024) + if(buffer.Length < 1024) Array.Copy(buffer, 0, oneKBuffer, 0, buffer.Length); else Array.Copy(buffer, 0, oneKBuffer, 0, 1024); diff --git a/DiscImageChef.Devices/Device/ScsiCommands/ArchiveCorp.cs b/DiscImageChef.Devices/Device/ScsiCommands/ArchiveCorp.cs index 0f98506bb..0f4f403c3 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/ArchiveCorp.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/ArchiveCorp.cs @@ -98,7 +98,7 @@ namespace DiscImageChef.Devices cdb[1] = (byte)((lba & 0x1F0000) >> 16); cdb[2] = (byte)((lba & 0xFF00) >> 8); cdb[3] = (byte)(lba & 0xFF); - if (immediate) + if(immediate) cdb[1] += 0x01; lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense); diff --git a/DiscImageChef.Devices/Device/ScsiCommands/Fujitsu.cs b/DiscImageChef.Devices/Device/ScsiCommands/Fujitsu.cs index 45ca92531..51fe8bf89 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/Fujitsu.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/Fujitsu.cs @@ -64,21 +64,21 @@ namespace DiscImageChef.Devices Array.Copy(tmp, 0, secondHalfBytes, 0, 8); } - if (mode != FujitsuDisplayModes.Half) + if(mode != FujitsuDisplayModes.Half) { - if (!ArrayHelpers.ArrayIsNullOrWhiteSpace(firstHalfBytes) && + if(!ArrayHelpers.ArrayIsNullOrWhiteSpace(firstHalfBytes) && !ArrayHelpers.ArrayIsNullOrWhiteSpace(secondHalfBytes)) { displayLen = true; halfMsg = false; } - else if (ArrayHelpers.ArrayIsNullOrWhiteSpace(firstHalfBytes) && + else if(ArrayHelpers.ArrayIsNullOrWhiteSpace(firstHalfBytes) && !ArrayHelpers.ArrayIsNullOrWhiteSpace(secondHalfBytes)) { displayLen = false; halfMsg = false; } - else if (!ArrayHelpers.ArrayIsNullOrWhiteSpace(firstHalfBytes) && + else if(!ArrayHelpers.ArrayIsNullOrWhiteSpace(firstHalfBytes) && ArrayHelpers.ArrayIsNullOrWhiteSpace(secondHalfBytes)) { displayLen = false; @@ -92,11 +92,11 @@ namespace DiscImageChef.Devices } buffer[0] = (byte)((byte)mode << 5); - if (displayLen) + if(displayLen) buffer[0] += 0x10; - if (flash) + if(flash) buffer[0] += 0x08; - if (halfMsg) + if(halfMsg) buffer[0] += 0x04; buffer[0] += 0x01; // Always ASCII diff --git a/DiscImageChef.Devices/Device/ScsiCommands/HP.cs b/DiscImageChef.Devices/Device/ScsiCommands/HP.cs index b8a5378b7..71206df31 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/HP.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/HP.cs @@ -87,9 +87,9 @@ namespace DiscImageChef.Devices cdb[5] = (byte)(address & 0xFF); cdb[7] = (byte)((transferLen & 0xFF00) >> 8); cdb[8] = (byte)(transferLen & 0xFF); - if (pba) + if(pba) cdb[9] += 0x80; - if (sectorCount) + if(sectorCount) cdb[9] += 0x40; if(sectorCount) diff --git a/DiscImageChef.Devices/Device/ScsiCommands/MMC.cs b/DiscImageChef.Devices/Device/ScsiCommands/MMC.cs index 2df39d659..ee67931fd 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/MMC.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/MMC.cs @@ -97,7 +97,7 @@ namespace DiscImageChef.Devices lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); error = lastError != 0; - if (sense) + if(sense) return true; ushort confLength = (ushort)(((int)buffer[2] << 8) + buffer[3] + 4); @@ -149,7 +149,7 @@ namespace DiscImageChef.Devices lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); error = lastError != 0; - if (sense) + if(sense) return true; ushort strctLength = (ushort)(((int)buffer[0] << 8) + buffer[1] + 2); @@ -299,7 +299,7 @@ namespace DiscImageChef.Devices tmpBuffer = new byte[1024]; cdb[0] = (byte)ScsiCommands.ReadTocPmaAtip; - if (MSF) + if(MSF) cdb[1] = 0x02; cdb[2] = (byte)(format & 0x0F); cdb[6] = trackSessionNumber; @@ -312,7 +312,7 @@ namespace DiscImageChef.Devices uint strctLength = (uint)(((int)tmpBuffer[0] << 8) + tmpBuffer[1] + 2); buffer = new byte[strctLength]; - if (buffer.Length <= tmpBuffer.Length) + if(buffer.Length <= tmpBuffer.Length) { Array.Copy(tmpBuffer, 0, buffer, 0, buffer.Length); DicConsole.DebugWriteLine("SCSI Device", "READ TOC/PMA/ATIP took {0} ms.", duration); @@ -511,9 +511,9 @@ namespace DiscImageChef.Devices bool sense; cdb[0] = (byte)ScsiCommands.PreventAllowMediumRemoval; - if (prevent) + if(prevent) cdb[4] += 0x01; - if (persistent) + if(persistent) cdb[4] += 0x02; lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense); @@ -552,9 +552,9 @@ namespace DiscImageChef.Devices bool sense; cdb[0] = (byte)ScsiCommands.StartStopUnit; - if (immediate) + if(immediate) cdb[1] += 0x01; - if (changeFormatLayer) + if(changeFormatLayer) { cdb[3] = (byte)(formatLayer & 0x03); cdb[4] += 0x04; diff --git a/DiscImageChef.Devices/Device/ScsiCommands/Pioneer.cs b/DiscImageChef.Devices/Device/ScsiCommands/Pioneer.cs index 2133ff724..44073469b 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/Pioneer.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/Pioneer.cs @@ -145,12 +145,12 @@ namespace DiscImageChef.Devices cdb[8] = (byte)((transferLength & 0xFF00) >> 8); cdb[9] = (byte)(transferLength & 0xFF); - if (errorFlags) + if(errorFlags) { buffer = new byte[2646 * transferLength]; cdb[6] = 0x1F; } - else if (wholeSector) + else if(wholeSector) { buffer = new byte[2352 * transferLength]; cdb[6] = 0x0F; diff --git a/DiscImageChef.Devices/Device/ScsiCommands/Plasmon.cs b/DiscImageChef.Devices/Device/ScsiCommands/Plasmon.cs index f2cbe73a0..1625dc904 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/Plasmon.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/Plasmon.cs @@ -98,7 +98,7 @@ namespace DiscImageChef.Devices cdb[3] = (byte)((address & 0xFF0000) >> 16); cdb[4] = (byte)((address & 0xFF00) >> 8); cdb[5] = (byte)(address & 0xFF); - if (pba) + if(pba) cdb[9] += 0x80; buffer = new byte[8]; diff --git a/DiscImageChef.Devices/Device/ScsiCommands/Plextor.cs b/DiscImageChef.Devices/Device/ScsiCommands/Plextor.cs index acf2cd3fc..869eb9d8a 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/Plextor.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/Plextor.cs @@ -227,7 +227,7 @@ namespace DiscImageChef.Devices DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR POWEREC GET SPEEDS took {0} ms.", duration); - if (!sense && !error) + if(!sense && !error) { BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; selected = BigEndianBitConverter.ToUInt16(buf, 4); @@ -266,7 +266,7 @@ namespace DiscImageChef.Devices DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR POWEREC GET SPEEDS took {0} ms.", duration); - if (!sense && !error) + if(!sense && !error) { BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; enabled = buf[2] != 0; diff --git a/DiscImageChef.Devices/Device/ScsiCommands/SMC.cs b/DiscImageChef.Devices/Device/ScsiCommands/SMC.cs index e52662798..98b4eceeb 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/SMC.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/SMC.cs @@ -76,13 +76,13 @@ namespace DiscImageChef.Devices cdb[11] = (byte)((buffer.Length & 0xFF0000) >> 16); cdb[12] = (byte)((buffer.Length & 0xFF00) >> 8); cdb[13] = (byte)(buffer.Length & 0xFF); - if (cache) + if(cache) cdb[14] += 0x01; lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); error = lastError != 0; - if (sense) + if(sense) return true; uint attrLen = (uint)(((int)buffer[0] << 24) + ((int)buffer[1] << 16) + ((int)buffer[2] << 8) + buffer[3] + 4); diff --git a/DiscImageChef.Devices/Device/ScsiCommands/SPC.cs b/DiscImageChef.Devices/Device/ScsiCommands/SPC.cs index fed1e3681..e5f5d8aa5 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/SPC.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/SPC.cs @@ -96,7 +96,7 @@ namespace DiscImageChef.Devices lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); error = lastError != 0; - if (sense) + if(sense) return true; byte pagesLength = (byte)(buffer[4] + 5); @@ -171,11 +171,11 @@ namespace DiscImageChef.Devices lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); error = lastError != 0; - if (sense) + if(sense) return true; // This is because INQ was returned instead of EVPD - if (buffer[1] != page) + if(buffer[1] != page) return true; byte pagesLength = (byte)(buffer[3] + 4); @@ -263,7 +263,7 @@ namespace DiscImageChef.Devices bool sense; cdb[0] = (byte)ScsiCommands.ModeSense; - if (DBD) + if(DBD) cdb[1] = 0x08; cdb[2] |= (byte)pageControl; cdb[2] |= (byte)(pageCode & 0x3F); @@ -274,7 +274,7 @@ namespace DiscImageChef.Devices lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); error = lastError != 0; - if (sense) + if(sense) return true; byte modeLength = (byte)(buffer[0] + 1); @@ -344,9 +344,9 @@ namespace DiscImageChef.Devices bool sense; cdb[0] = (byte)ScsiCommands.ModeSense10; - if (LLBAA) + if(LLBAA) cdb[1] |= 0x10; - if (DBD) + if(DBD) cdb[1] |= 0x08; cdb[2] |= (byte)pageControl; cdb[2] |= (byte)(pageCode & 0x3F); @@ -358,7 +358,7 @@ namespace DiscImageChef.Devices lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); error = lastError != 0; - if (sense) + if(sense) return true; ushort modeLength = (ushort)(((int)buffer[0] << 8) + buffer[1] + 2); @@ -409,7 +409,7 @@ namespace DiscImageChef.Devices /// true to prevent medium removal, false to allow it. public bool SpcPreventAllowMediumRemoval(out byte[] senseBuffer, bool prevent, uint timeout, out double duration) { - if (prevent) + if(prevent) return SpcPreventAllowMediumRemoval(out senseBuffer, ScsiPreventAllowMode.Prevent, timeout, out duration); else return SpcPreventAllowMediumRemoval(out senseBuffer, ScsiPreventAllowMode.Allow, timeout, out duration); @@ -474,10 +474,10 @@ namespace DiscImageChef.Devices cdb[0] = (byte)ScsiCommands.ReadCapacity; - if (PMI) + if(PMI) { cdb[8] = 0x01; - if (RelAddr) + if(RelAddr) cdb[1] = 0x01; cdb[2] = (byte)((address & 0xFF000000) >> 24); @@ -527,7 +527,7 @@ namespace DiscImageChef.Devices cdb[0] = (byte)ScsiCommands.ServiceActionIn; cdb[1] = (byte)ScsiServiceActions.ReadCapacity16; - if (PMI) + if(PMI) { cdb[14] = 0x01; byte[] temp = BitConverter.GetBytes(address); @@ -579,7 +579,7 @@ namespace DiscImageChef.Devices lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); error = lastError != 0; - if (sense) + if(sense) return true; uint strctLength = (uint)(((int)buffer[0] << 24) + ((int)buffer[1] << 16) + ((int)buffer[2] << 8) + buffer[3] + 4); @@ -704,9 +704,9 @@ namespace DiscImageChef.Devices senseBuffer = new byte[32]; // Prevent overflows - if (buffer.Length > 255) + if(buffer.Length > 255) { - if (platformID != Interop.PlatformID.Win32NT && platformID != Interop.PlatformID.Win32S && platformID != Interop.PlatformID.Win32Windows && platformID != Interop.PlatformID.WinCE && platformID != Interop.PlatformID.WindowsPhone && platformID != Interop.PlatformID.Xbox) + if(platformID != Interop.PlatformID.Win32NT && platformID != Interop.PlatformID.Win32S && platformID != Interop.PlatformID.Win32Windows && platformID != Interop.PlatformID.WinCE && platformID != Interop.PlatformID.WindowsPhone && platformID != Interop.PlatformID.Xbox) lastError = 75; else lastError = 111; @@ -719,9 +719,9 @@ namespace DiscImageChef.Devices bool sense; cdb[0] = (byte)ScsiCommands.ModeSelect; - if (pageFormat) + if(pageFormat) cdb[1] += 0x10; - if (savePages) + if(savePages) cdb[1] += 0x01; cdb[4] = (byte)buffer.Length; @@ -746,9 +746,9 @@ namespace DiscImageChef.Devices senseBuffer = new byte[32]; // Prevent overflows - if (buffer.Length > 65535) + if(buffer.Length > 65535) { - if (platformID != Interop.PlatformID.Win32NT && platformID != Interop.PlatformID.Win32S && platformID != Interop.PlatformID.Win32Windows && platformID != Interop.PlatformID.WinCE && platformID != Interop.PlatformID.WindowsPhone && platformID != Interop.PlatformID.Xbox) + if(platformID != Interop.PlatformID.Win32NT && platformID != Interop.PlatformID.Win32S && platformID != Interop.PlatformID.Win32Windows && platformID != Interop.PlatformID.WinCE && platformID != Interop.PlatformID.WindowsPhone && platformID != Interop.PlatformID.Xbox) lastError = 75; else lastError = 111; @@ -761,9 +761,9 @@ namespace DiscImageChef.Devices bool sense; cdb[0] = (byte)ScsiCommands.ModeSelect10; - if (pageFormat) + if(pageFormat) cdb[1] += 0x10; - if (savePages) + if(savePages) cdb[1] += 0x01; cdb[7] = (byte)((buffer.Length & 0xFF00) << 8); cdb[8] = (byte)(buffer.Length & 0xFF); diff --git a/DiscImageChef.Devices/Device/ScsiCommands/SSC.cs b/DiscImageChef.Devices/Device/ScsiCommands/SSC.cs index ffb45a546..3125931c6 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/SSC.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/SSC.cs @@ -86,15 +86,15 @@ namespace DiscImageChef.Devices bool sense; cdb[0] = (byte)ScsiCommands.LoadUnload; - if (immediate) + if(immediate) cdb[1] = 0x01; - if (load) + if(load) cdb[4] += 0x01; - if (retense) + if(retense) cdb[4] += 0x02; - if (endOfTape) + if(endOfTape) cdb[4] += 0x04; - if (hold) + if(hold) cdb[4] += 0x08; lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense); @@ -176,11 +176,11 @@ namespace DiscImageChef.Devices bool sense; cdb[0] = (byte)ScsiCommands.Locate; - if (immediate) + if(immediate) cdb[1] += 0x01; - if (changePartition) + if(changePartition) cdb[1] += 0x02; - if (blockType) + if(blockType) cdb[1] += 0x04; cdb[3] = (byte)((objectId & 0xFF000000) >> 24); cdb[4] = (byte)((objectId & 0xFF0000) >> 16); @@ -270,11 +270,11 @@ namespace DiscImageChef.Devices cdb[0] = (byte)ScsiCommands.Locate16; cdb[1] = (byte)((byte)destType << 3); - if (immediate) + if(immediate) cdb[1] += 0x01; - if (changePartition) + if(changePartition) cdb[1] += 0x02; - if (bam) + if(bam) cdb[2] = 0x01; cdb[3] = partition; @@ -337,7 +337,7 @@ namespace DiscImageChef.Devices /// Duration. public bool Read6(out byte[] buffer, out byte[] senseBuffer, bool sili, bool fixedLen, uint transferLen, uint blockSize, uint timeout, out double duration) { - if (fixedLen) + if(fixedLen) buffer = new byte[blockSize * transferLen]; else buffer = new byte[transferLen]; @@ -346,9 +346,9 @@ namespace DiscImageChef.Devices bool sense; cdb[0] = (byte)ScsiCommands.Read6; - if (fixedLen) + if(fixedLen) cdb[1] += 0x01; - if (sili) + if(sili) cdb[1] += 0x02; cdb[2] = (byte)((transferLen & 0xFF0000) >> 16); cdb[3] = (byte)((transferLen & 0xFF00) >> 8); @@ -441,7 +441,7 @@ namespace DiscImageChef.Devices /// Duration. public bool Read16(out byte[] buffer, out byte[] senseBuffer, bool sili, bool fixedLen, byte partition, ulong objectId, uint transferLen, uint objectSize, uint timeout, out double duration) { - if (fixedLen) + if(fixedLen) buffer = new byte[objectSize * transferLen]; else buffer = new byte[transferLen]; @@ -451,9 +451,9 @@ namespace DiscImageChef.Devices byte[] idBytes = BitConverter.GetBytes(objectId); cdb[0] = (byte)ScsiCommands.Read16; - if (fixedLen) + if(fixedLen) cdb[1] += 0x01; - if (sili) + if(sili) cdb[1] += 0x02; cdb[3] = partition; cdb[4] = idBytes[7]; @@ -537,11 +537,11 @@ namespace DiscImageChef.Devices public bool ReadPosition(out byte[] buffer, out byte[] senseBuffer, bool vendorType, bool longForm, bool totalPosition, uint timeout, out double duration) { byte responseForm = 0; - if (vendorType) + if(vendorType) responseForm += 0x01; - if (longForm) + if(longForm) responseForm += 0x02; - if (totalPosition) + if(totalPosition) responseForm += 0x04; return ReadPosition(out buffer, out senseBuffer, (SscPositionForms)responseForm, timeout, out duration); @@ -557,7 +557,7 @@ namespace DiscImageChef.Devices /// Duration. public bool ReadPosition(out byte[] buffer, out byte[] senseBuffer, SscPositionForms responseForm, uint timeout, out double duration) { - switch (responseForm) + switch(responseForm) { case SscPositionForms.Long: case SscPositionForms.OldLong: @@ -639,7 +639,7 @@ namespace DiscImageChef.Devices /// Duration. public bool ReadReverse6(out byte[] buffer, out byte[] senseBuffer, bool byteOrder, bool sili, bool fixedLen, uint transferLen, uint blockSize, uint timeout, out double duration) { - if (fixedLen) + if(fixedLen) buffer = new byte[blockSize * transferLen]; else buffer = new byte[transferLen]; @@ -648,11 +648,11 @@ namespace DiscImageChef.Devices bool sense; cdb[0] = (byte)ScsiCommands.ReadReverse; - if (fixedLen) + if(fixedLen) cdb[1] += 0x01; - if (sili) + if(sili) cdb[1] += 0x02; - if (byteOrder) + if(byteOrder) cdb[1] += 0x04; cdb[2] = (byte)((transferLen & 0xFF0000) >> 16); cdb[3] = (byte)((transferLen & 0xFF00) >> 8); @@ -746,7 +746,7 @@ namespace DiscImageChef.Devices /// Duration. public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, bool byteOrder, bool sili, bool fixedLen, byte partition, ulong objectId, uint transferLen, uint objectSize, uint timeout, out double duration) { - if (fixedLen) + if(fixedLen) buffer = new byte[objectSize * transferLen]; else buffer = new byte[transferLen]; @@ -756,11 +756,11 @@ namespace DiscImageChef.Devices byte[] idBytes = BitConverter.GetBytes(objectId); cdb[0] = (byte)ScsiCommands.Read16; - if (fixedLen) + if(fixedLen) cdb[1] += 0x01; - if (sili) + if(sili) cdb[1] += 0x02; - if (byteOrder) + if(byteOrder) cdb[1] += 0x04; cdb[3] = partition; cdb[4] = idBytes[7]; @@ -825,7 +825,7 @@ namespace DiscImageChef.Devices /// Duration. public bool RecoverBufferedData(out byte[] buffer, out byte[] senseBuffer, bool sili, bool fixedLen, uint transferLen, uint blockSize, uint timeout, out double duration) { - if (fixedLen) + if(fixedLen) buffer = new byte[blockSize * transferLen]; else buffer = new byte[transferLen]; @@ -834,9 +834,9 @@ namespace DiscImageChef.Devices bool sense; cdb[0] = (byte)ScsiCommands.RecoverBufferedData; - if (fixedLen) + if(fixedLen) cdb[1] += 0x01; - if (sili) + if(sili) cdb[1] += 0x02; cdb[2] = (byte)((transferLen & 0xFF0000) >> 16); cdb[3] = (byte)((transferLen & 0xFF00) >> 8); @@ -892,9 +892,9 @@ namespace DiscImageChef.Devices bool sense; cdb[0] = (byte)ScsiCommands.ReportDensitySupport; - if (currentMedia) + if(currentMedia) cdb[1] += 0x01; - if (mediumType) + if(mediumType) cdb[1] += 0x02; cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8); cdb[8] = (byte)(buffer.Length & 0xFF); @@ -902,7 +902,7 @@ namespace DiscImageChef.Devices lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); error = lastError != 0; - if (sense) + if(sense) return true; ushort availableLength = (ushort)(((int)buffer[0] << 8) + buffer[1] + 2); @@ -945,7 +945,7 @@ namespace DiscImageChef.Devices bool sense; cdb[0] = (byte)ScsiCommands.Rewind; - if (immediate) + if(immediate) cdb[1] += 0x01; lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense); diff --git a/DiscImageChef.Devices/Device/ScsiCommands/SyQuest.cs b/DiscImageChef.Devices/Device/ScsiCommands/SyQuest.cs index 70c870683..06cc2b5e5 100644 --- a/DiscImageChef.Devices/Device/ScsiCommands/SyQuest.cs +++ b/DiscImageChef.Devices/Device/ScsiCommands/SyQuest.cs @@ -95,14 +95,14 @@ namespace DiscImageChef.Devices cdb[2] = (byte)((lba & 0xFF00) >> 8); cdb[3] = (byte)(lba & 0xFF); cdb[4] = transferLength; - if (inhibitDma) + if(inhibitDma) cdb[5] += 0x80; - if (readLong) + if(readLong) cdb[5] += 0x40; - if (!inhibitDma && !readLong) + if(!inhibitDma && !readLong) { - if (transferLength == 0) + if(transferLength == 0) buffer = new byte[256 * blockSize]; else buffer = new byte[transferLength * blockSize]; @@ -115,11 +115,11 @@ namespace DiscImageChef.Devices else buffer = new byte[0]; - if (!inhibitDma) + if(!inhibitDma) lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); else lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense); - + error = lastError != 0; DicConsole.DebugWriteLine("SCSI Device", "SYQUEST READ (6) took {0} ms.", duration); @@ -180,12 +180,12 @@ namespace DiscImageChef.Devices cdb[5] = (byte)(lba & 0xFF); cdb[7] = (byte)((transferLength & 0xFF00) >> 8); cdb[8] = (byte)(transferLength & 0xFF); - if (inhibitDma) + if(inhibitDma) cdb[9] += 0x80; - if (readLong) + if(readLong) cdb[9] += 0x40; - if (!inhibitDma && !readLong) + if(!inhibitDma && !readLong) { buffer = new byte[transferLength * blockSize]; } @@ -197,7 +197,7 @@ namespace DiscImageChef.Devices else buffer = new byte[0]; - if (!inhibitDma) + if(!inhibitDma) lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense); else lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense); diff --git a/DiscImageChef.Devices/Enums.cs b/DiscImageChef.Devices/Enums.cs index 9fa3d8dd8..1a035d6bc 100644 --- a/DiscImageChef.Devices/Enums.cs +++ b/DiscImageChef.Devices/Enums.cs @@ -921,7 +921,7 @@ namespace DiscImageChef.Devices /// Commands 0xA0 to 0xBF are 12-byte /// #region SASI Commands - public enum SasiCommands : byte + public enum SasiCommands : byte { #region SASI Class 0 commands @@ -2941,7 +2941,7 @@ namespace DiscImageChef.Devices /// READ/SEND DISC STRUCTURE capability list /// CapabilityList = 0xFF, - + // DVD Disc Structures /// /// DVD Lead-in Physical Information diff --git a/DiscImageChef.Devices/Linux/Command.cs b/DiscImageChef.Devices/Linux/Command.cs index 8e7ea4d70..e078c9f55 100644 --- a/DiscImageChef.Devices/Linux/Command.cs +++ b/DiscImageChef.Devices/Linux/Command.cs @@ -63,7 +63,7 @@ namespace DiscImageChef.Devices.Linux duration = 0; sense = false; - if (buffer == null) + if(buffer == null) return -1; sg_io_hdr_t io_hdr = new sg_io_hdr_t(); @@ -88,7 +88,7 @@ namespace DiscImageChef.Devices.Linux int error = Extern.ioctlSg(fd, LinuxIoctl.SG_IO, ref io_hdr); DateTime end = DateTime.UtcNow; - if (error < 0) + if(error < 0) error = Marshal.GetLastWin32Error(); Marshal.Copy(io_hdr.dxferp, buffer, 0, buffer.Length); @@ -97,7 +97,7 @@ namespace DiscImageChef.Devices.Linux sense |= (io_hdr.info & SgInfo.OkMask) != SgInfo.Ok; - if (io_hdr.duration > 0) + if(io_hdr.duration > 0) duration = (double)io_hdr.duration; else duration = (end - start).TotalMilliseconds; @@ -111,7 +111,7 @@ namespace DiscImageChef.Devices.Linux static ScsiIoctlDirection AtaProtocolToScsiDirection(AtaProtocol protocol) { - switch (protocol) + switch(protocol) { case AtaProtocol.DeviceDiagnostic: case AtaProtocol.DeviceReset: @@ -140,16 +140,16 @@ namespace DiscImageChef.Devices.Linux sense = false; errorRegisters = new AtaErrorRegistersCHS(); - if (buffer == null) + if(buffer == null) return -1; byte[] cdb = new byte[16]; cdb[0] = (byte)ScsiCommands.AtaPassThrough16; cdb[1] = (byte)(((byte)protocol << 1) & 0x1E); - if (transferRegister != AtaTransferRegister.NoTransfer && + if(transferRegister != AtaTransferRegister.NoTransfer && protocol != AtaProtocol.NonData) { - switch (protocol) + switch(protocol) { case AtaProtocol.PioIn: case AtaProtocol.UDmaIn: @@ -160,7 +160,7 @@ namespace DiscImageChef.Devices.Linux break; } - if (transferBlocks) + if(transferBlocks) cdb[2] |= 0x04; cdb[2] |= (byte)((int)transferRegister & 0x03); @@ -179,7 +179,7 @@ namespace DiscImageChef.Devices.Linux byte[] senseBuffer; int error = SendScsiCommand(fd, cdb, ref buffer, out senseBuffer, timeout, AtaProtocolToScsiDirection(protocol), out duration, out sense); - if (senseBuffer.Length < 22 || (senseBuffer[8] != 0x09 && senseBuffer[9] != 0x0C)) + if(senseBuffer.Length < 22 || (senseBuffer[8] != 0x09 && senseBuffer[9] != 0x0C)) return error; errorRegisters.error = senseBuffer[11]; @@ -205,16 +205,16 @@ namespace DiscImageChef.Devices.Linux sense = false; errorRegisters = new AtaErrorRegistersLBA28(); - if (buffer == null) + if(buffer == null) return -1; byte[] cdb = new byte[16]; cdb[0] = (byte)ScsiCommands.AtaPassThrough16; cdb[1] = (byte)(((byte)protocol << 1) & 0x1E); - if (transferRegister != AtaTransferRegister.NoTransfer && + if(transferRegister != AtaTransferRegister.NoTransfer && protocol != AtaProtocol.NonData) { - switch (protocol) + switch(protocol) { case AtaProtocol.PioIn: case AtaProtocol.UDmaIn: @@ -225,7 +225,7 @@ namespace DiscImageChef.Devices.Linux break; } - if (transferBlocks) + if(transferBlocks) cdb[2] |= 0x04; cdb[2] |= (byte)((int)transferRegister & 0x03); @@ -244,7 +244,7 @@ namespace DiscImageChef.Devices.Linux byte[] senseBuffer; int error = SendScsiCommand(fd, cdb, ref buffer, out senseBuffer, timeout, AtaProtocolToScsiDirection(protocol), out duration, out sense); - if (senseBuffer.Length < 22 || (senseBuffer[8] != 0x09 && senseBuffer[9] != 0x0C)) + if(senseBuffer.Length < 22 || (senseBuffer[8] != 0x09 && senseBuffer[9] != 0x0C)) return error; errorRegisters.error = senseBuffer[11]; @@ -270,17 +270,17 @@ namespace DiscImageChef.Devices.Linux sense = false; errorRegisters = new AtaErrorRegistersLBA48(); - if (buffer == null) + if(buffer == null) return -1; byte[] cdb = new byte[16]; cdb[0] = (byte)ScsiCommands.AtaPassThrough16; cdb[1] |= 0x01; cdb[1] = (byte)(((byte)protocol << 1) & 0x1E); - if (transferRegister != AtaTransferRegister.NoTransfer && + if(transferRegister != AtaTransferRegister.NoTransfer && protocol != AtaProtocol.NonData) { - switch (protocol) + switch(protocol) { case AtaProtocol.PioIn: case AtaProtocol.UDmaIn: @@ -291,7 +291,7 @@ namespace DiscImageChef.Devices.Linux break; } - if (transferBlocks) + if(transferBlocks) cdb[2] |= 0x04; cdb[2] |= (byte)((int)transferRegister & 0x03); @@ -315,7 +315,7 @@ namespace DiscImageChef.Devices.Linux byte[] senseBuffer; int error = SendScsiCommand(fd, cdb, ref buffer, out senseBuffer, timeout, AtaProtocolToScsiDirection(protocol), out duration, out sense); - if (senseBuffer.Length < 22 || (senseBuffer[8] != 0x09 && senseBuffer[9] != 0x0C)) + if(senseBuffer.Length < 22 || (senseBuffer[8] != 0x09 && senseBuffer[9] != 0x0C)) return error; errorRegisters.error = senseBuffer[11]; @@ -339,18 +339,18 @@ namespace DiscImageChef.Devices.Linux IntPtr buf = Marshal.AllocHGlobal(4096); int resultSize; - if (Interop.DetectOS.Is64Bit()) + if(Interop.DetectOS.Is64Bit()) { long result64 = Extern.readlink64(path, buf, (long)4096); - if (result64 <= 0) + if(result64 <= 0) return null; - + resultSize = (int)result64; } else { int result = Extern.readlink(path, buf, 4096); - if (result <= 0) + if(result <= 0) return null; resultSize = result; diff --git a/DiscImageChef.Devices/Linux/Extern.cs b/DiscImageChef.Devices/Linux/Extern.cs index ad13eedde..684e858b3 100644 --- a/DiscImageChef.Devices/Linux/Extern.cs +++ b/DiscImageChef.Devices/Linux/Extern.cs @@ -51,17 +51,17 @@ namespace DiscImageChef.Devices.Linux [DllImport("libc")] internal static extern int close(int fd); - [DllImport("libc", EntryPoint="ioctl", SetLastError = true)] + [DllImport("libc", EntryPoint = "ioctl", SetLastError = true)] internal static extern int ioctlInt(int fd, LinuxIoctl request, out int value); - [DllImport("libc", EntryPoint="ioctl", SetLastError = true)] + [DllImport("libc", EntryPoint = "ioctl", SetLastError = true)] internal static extern int ioctlSg(int fd, LinuxIoctl request, ref sg_io_hdr_t value); [DllImport("libc", CharSet = CharSet.Ansi, SetLastError = true)] - internal static extern int readlink(string path, System.IntPtr buf, int bufsize); + internal static extern int readlink(string path, System.IntPtr buf, int bufsize); - [DllImport("libc", CharSet = CharSet.Ansi, EntryPoint="readlink", SetLastError = true)] - internal static extern long readlink64(string path, System.IntPtr buf, long bufsize); + [DllImport("libc", CharSet = CharSet.Ansi, EntryPoint = "readlink", SetLastError = true)] + internal static extern long readlink64(string path, System.IntPtr buf, long bufsize); } } diff --git a/DiscImageChef.Devices/Windows/Command.cs b/DiscImageChef.Devices/Windows/Command.cs index 847627938..967f4630d 100644 --- a/DiscImageChef.Devices/Windows/Command.cs +++ b/DiscImageChef.Devices/Windows/Command.cs @@ -63,7 +63,7 @@ namespace DiscImageChef.Devices.Windows duration = 0; sense = false; - if (buffer == null) + if(buffer == null) return -1; ScsiPassThroughDirectAndSenseBuffer sptd_sb = new ScsiPassThroughDirectAndSenseBuffer(); @@ -88,7 +88,7 @@ namespace DiscImageChef.Devices.Windows (uint)Marshal.SizeOf(sptd_sb), ref k, IntPtr.Zero); DateTime end = DateTime.Now; - if (hasError) + if(hasError) error = Marshal.GetLastWin32Error(); Marshal.Copy(sptd_sb.sptd.DataBuffer, buffer, 0, buffer.Length); diff --git a/DiscImageChef.Devices/Windows/Extern.cs b/DiscImageChef.Devices/Windows/Extern.cs index 77eef4c79..24ca5a78a 100644 --- a/DiscImageChef.Devices/Windows/Extern.cs +++ b/DiscImageChef.Devices/Windows/Extern.cs @@ -54,7 +54,7 @@ namespace DiscImageChef.Devices.Windows [MarshalAs(UnmanagedType.U4)] FileAttributes flagsAndAttributes, IntPtr templateFile); - [DllImport("Kernel32.dll", SetLastError = true, EntryPoint="ioctl", CharSet = CharSet.Auto)] + [DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "ioctl", CharSet = CharSet.Auto)] internal static extern bool DeviceIoControlScsi( SafeFileHandle hDevice, WindowsIoctl IoControlCode, @@ -66,7 +66,7 @@ namespace DiscImageChef.Devices.Windows IntPtr Overlapped ); - [DllImport("Kernel32.dll", SetLastError = true, EntryPoint="ioctl", CharSet = CharSet.Auto)] + [DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "ioctl", CharSet = CharSet.Auto)] internal static extern bool DeviceIoControlAta( SafeFileHandle hDevice, WindowsIoctl IoControlCode, diff --git a/DiscImageChef.Devices/Windows/Structs.cs b/DiscImageChef.Devices/Windows/Structs.cs index 72d10dc70..f51f56711 100644 --- a/DiscImageChef.Devices/Windows/Structs.cs +++ b/DiscImageChef.Devices/Windows/Structs.cs @@ -89,20 +89,30 @@ namespace DiscImageChef.Devices.Windows struct AtaTaskFile { // Fields for commands sent - [FieldOffset(0)] public byte Features; - [FieldOffset(6)] public byte Command; + [FieldOffset(0)] + public byte Features; + [FieldOffset(6)] + public byte Command; // Fields on command return - [FieldOffset(0)] public byte Error; - [FieldOffset(6)] public byte Status; + [FieldOffset(0)] + public byte Error; + [FieldOffset(6)] + public byte Status; // Common fields - [FieldOffset(1)] public byte SectorCount; - [FieldOffset(2)] public byte SectorNumber; - [FieldOffset(3)] public byte CylinderLow; - [FieldOffset(4)] public byte CylinderHigh; - [FieldOffset(5)] public byte DeviceHead; - [FieldOffset(7)] public byte Reserved; + [FieldOffset(1)] + public byte SectorCount; + [FieldOffset(2)] + public byte SectorNumber; + [FieldOffset(3)] + public byte CylinderLow; + [FieldOffset(4)] + public byte CylinderHigh; + [FieldOffset(5)] + public byte DeviceHead; + [FieldOffset(7)] + public byte Reserved; } } diff --git a/DiscImageChef.DiscImages/Apple2MG.cs b/DiscImageChef.DiscImages/Apple2MG.cs index b1e81a705..f01b338bc 100644 --- a/DiscImageChef.DiscImages/Apple2MG.cs +++ b/DiscImageChef.DiscImages/Apple2MG.cs @@ -202,37 +202,37 @@ namespace DiscImageChef.ImagePlugins FileStream stream = new FileStream(imagePath, FileMode.Open, FileAccess.Read); stream.Seek(0, SeekOrigin.Begin); - if (stream.Length < 65) + if(stream.Length < 65) return false; byte[] header = new byte[64]; stream.Read(header, 0, 64); UInt32 magic = BitConverter.ToUInt32(header, 0x00); - if (magic != MAGIC) + if(magic != MAGIC) return false; UInt32 dataoff = BitConverter.ToUInt32(header, 0x18); - if (dataoff > stream.Length) + if(dataoff > stream.Length) return false; UInt32 datasize = BitConverter.ToUInt32(header, 0x1C); // There seems to be incorrect endian in some images on the wild - if (datasize == 0x00800C00) + if(datasize == 0x00800C00) datasize = 0x000C8000; - if (dataoff + datasize > stream.Length) + if(dataoff + datasize > stream.Length) return false; UInt32 commentoff = BitConverter.ToUInt32(header, 0x20); - if (commentoff > stream.Length) + if(commentoff > stream.Length) return false; UInt32 commentsize = BitConverter.ToUInt32(header, 0x24); - if (commentoff + commentsize > stream.Length) + if(commentoff + commentsize > stream.Length) return false; UInt32 creatoroff = BitConverter.ToUInt32(header, 0x28); - if (creatoroff > stream.Length) + if(creatoroff > stream.Length) return false; UInt32 creatorsize = BitConverter.ToUInt32(header, 0x2C); @@ -272,7 +272,7 @@ namespace DiscImageChef.ImagePlugins ImageHeader.reserved3 = BitConverter.ToUInt32(header, 0x38); ImageHeader.reserved4 = BitConverter.ToUInt32(header, 0x3C); - if (ImageHeader.dataSize == 0x00800C00) + if(ImageHeader.dataSize == 0x00800C00) { ImageHeader.dataSize = 0x000C8000; DicConsole.DebugWriteLine("2MG plugin", "Detected incorrect endian on data size field, correcting."); @@ -296,17 +296,17 @@ namespace DiscImageChef.ImagePlugins DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.reserved3 = 0x{0:X8}", ImageHeader.reserved3); DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.reserved4 = 0x{0:X8}", ImageHeader.reserved4); - if (ImageHeader.dataSize == 0 && ImageHeader.blocks == 0 && ImageHeader.imageFormat != ProDOSSectorOrder) + if(ImageHeader.dataSize == 0 && ImageHeader.blocks == 0 && ImageHeader.imageFormat != ProDOSSectorOrder) return false; - if (ImageHeader.imageFormat == ProDOSSectorOrder && ImageHeader.blocks == 0) + if(ImageHeader.imageFormat == ProDOSSectorOrder && ImageHeader.blocks == 0) return false; - if (ImageHeader.imageFormat == ProDOSSectorOrder) + if(ImageHeader.imageFormat == ProDOSSectorOrder) ImageHeader.dataSize = ImageHeader.blocks * 512; - else if (ImageHeader.blocks == 0 && ImageHeader.dataSize != 0) + else if(ImageHeader.blocks == 0 && ImageHeader.dataSize != 0) ImageHeader.blocks = ImageHeader.dataSize / 256; - else if (ImageHeader.dataSize == 0 && ImageHeader.blocks != 0) + else if(ImageHeader.dataSize == 0 && ImageHeader.blocks != 0) ImageHeader.dataSize = ImageHeader.blocks * 256; ImageInfo.sectorSize = (uint)(ImageHeader.imageFormat == ProDOSSectorOrder ? 512 : 256); @@ -314,9 +314,9 @@ namespace DiscImageChef.ImagePlugins ImageInfo.sectors = ImageHeader.blocks; ImageInfo.imageSize = ImageHeader.dataSize; - switch (ImageHeader.creator) + switch(ImageHeader.creator) { - + case CreatorAsimov: ImageInfo.imageApplication = "ASIMOV2"; break; @@ -342,7 +342,7 @@ namespace DiscImageChef.ImagePlugins ImageInfo.imageVersion = ImageHeader.version.ToString(); - if (ImageHeader.commentOffset != 0 && ImageHeader.commentSize != 0) + if(ImageHeader.commentOffset != 0 && ImageHeader.commentSize != 0) { stream.Seek(ImageHeader.commentOffset, SeekOrigin.Begin); @@ -432,7 +432,7 @@ namespace DiscImageChef.ImagePlugins public override MediaType GetMediaType() { - switch (ImageInfo.sectors) + switch(ImageInfo.sectors) { case 455: return MediaType.Apple32SS; @@ -458,10 +458,10 @@ namespace DiscImageChef.ImagePlugins public override byte[] ReadSectors(ulong sectorAddress, uint length) { - if (sectorAddress > ImageInfo.sectors - 1) + if(sectorAddress > ImageInfo.sectors - 1) throw new ArgumentOutOfRangeException("sectorAddress", "Sector address not found"); - if (sectorAddress + length > ImageInfo.sectors) + if(sectorAddress + length > ImageInfo.sectors) throw new ArgumentOutOfRangeException("length", "Requested more sectors than available"); byte[] buffer = new byte[length * ImageInfo.sectorSize]; @@ -623,7 +623,7 @@ namespace DiscImageChef.ImagePlugins { FailingLBAs = new List(); UnknownLBAs = new List(); - for (ulong i = 0; i < ImageInfo.sectors; i++) + for(ulong i = 0; i < ImageInfo.sectors; i++) UnknownLBAs.Add(i); return null; } diff --git a/DiscImageChef.DiscImages/CDRDAO.cs b/DiscImageChef.DiscImages/CDRDAO.cs index 555547640..fd633b11d 100644 --- a/DiscImageChef.DiscImages/CDRDAO.cs +++ b/DiscImageChef.DiscImages/CDRDAO.cs @@ -257,7 +257,7 @@ namespace DiscImageChef.ImagePlugins return Dm.Success; } - catch (Exception ex) + catch(Exception ex) { DicConsole.ErrorWriteLine("Exception trying to identify image file {0}", this.imagePath); DicConsole.ErrorWriteLine("Exception: {0}", ex.Message); @@ -270,9 +270,9 @@ namespace DiscImageChef.ImagePlugins public override bool OpenImage(string imagePath) { - if (imagePath == null) + if(imagePath == null) return false; - if (imagePath == "") + if(imagePath == "") return false; this.imagePath = imagePath; @@ -361,7 +361,7 @@ namespace DiscImageChef.ImagePlugins MatchDiskType = RegexDiskType.Match(_line); - if (!MatchDiskType.Success) + if(!MatchDiskType.Success) { DicConsole.DebugWriteLine("CDRDAO plugin", "Not a CDRDAO TOC or TOC type not in first line."); return false; @@ -370,7 +370,7 @@ namespace DiscImageChef.ImagePlugins tocStream.Close(); tocStream = new StreamReader(this.imagePath); - while (tocStream.Peek() >= 0) + while(tocStream.Peek() >= 0) { line++; _line = tocStream.ReadLine(); @@ -404,20 +404,20 @@ namespace DiscImageChef.ImagePlugins MatchLanguageMap = RegexLanguageMap.Match(_line); MatchLanguageMapping = RegexLanguageMapping.Match(_line); - if (MatchComment.Success) + if(MatchComment.Success) { // Ignore "// Track X" comments - if (!MatchComment.Groups["comment"].Value.StartsWith(" Track ", StringComparison.Ordinal)) + if(!MatchComment.Groups["comment"].Value.StartsWith(" Track ", StringComparison.Ordinal)) { DicConsole.DebugWriteLine("CDRDAO plugin", "Found comment \"{1}\" at line {0}", line, MatchComment.Groups["comment"].Value.Trim()); commentBuilder.AppendLine(MatchComment.Groups["comment"].Value.Trim()); } } - else if (MatchDiskType.Success) + else if(MatchDiskType.Success) { DicConsole.DebugWriteLine("CDRDAO plugin", "Found {1} at line {0}", line, MatchDiskType.Groups["type"].Value); discimage.disktypestr = MatchDiskType.Groups["type"].Value; - switch (MatchDiskType.Groups["type"].Value) + switch(MatchDiskType.Groups["type"].Value) { case "CD_DA": discimage.disktype = MediaType.CDDA; @@ -436,19 +436,19 @@ namespace DiscImageChef.ImagePlugins break; } } - else if (MatchMCN.Success) + else if(MatchMCN.Success) { DicConsole.DebugWriteLine("CDRDAO plugin", "Found CATALOG \"{1}\" at line {0}", line, MatchMCN.Groups["catalog"].Value); discimage.mcn = MatchMCN.Groups["catalog"].Value; } - else if (MatchTrack.Success) + else if(MatchTrack.Success) { - if (MatchTrack.Groups["subchan"].Value == "") + if(MatchTrack.Groups["subchan"].Value == "") DicConsole.DebugWriteLine("CDRDAO plugin", "Found TRACK type \"{1}\" with no subchannel at line {0}", line, MatchTrack.Groups["type"].Value); else DicConsole.DebugWriteLine("CDRDAO plugin", "Found TRACK type \"{1}\" subchannel {2} at line {0}", line, MatchTrack.Groups["type"].Value, MatchTrack.Groups["subchan"].Value); - if (intrack) + if(intrack) { currentSector += currenttrack.sectors; if(currenttrack.pregap != currenttrack.sectors && !currenttrack.indexes.ContainsKey(1)) @@ -462,7 +462,7 @@ namespace DiscImageChef.ImagePlugins currentTrackNumber++; intrack = true; - switch (MatchTrack.Groups["type"].Value) + switch(MatchTrack.Groups["type"].Value) { case "AUDIO": case "MODE1_RAW": @@ -484,7 +484,7 @@ namespace DiscImageChef.ImagePlugins throw new NotSupportedException(String.Format("Track mode {0} is unsupported", MatchTrack.Groups["type"].Value)); } - switch (MatchTrack.Groups["subchan"].Value) + switch(MatchTrack.Groups["subchan"].Value) { case "": break; @@ -504,28 +504,28 @@ namespace DiscImageChef.ImagePlugins currenttrack.sequence = currentTrackNumber; currenttrack.startSector = currentSector; } - else if (MatchCopy.Success) + else if(MatchCopy.Success) { DicConsole.DebugWriteLine("CDRDAO plugin", "Found {1} COPY at line {0}", line, MatchCopy.Groups["no"].Value); currenttrack.flag_dcp |= intrack && MatchCopy.Groups["no"].Value == ""; } - else if (MatchEmphasis.Success) + else if(MatchEmphasis.Success) { DicConsole.DebugWriteLine("CDRDAO plugin", "Found {1} PRE_EMPHASIS at line {0}", line, MatchEmphasis.Groups["no"].Value); currenttrack.flag_pre |= intrack && MatchCopy.Groups["no"].Value == ""; } - else if (MatchStereo.Success) + else if(MatchStereo.Success) { DicConsole.DebugWriteLine("CDRDAO plugin", "Found {1}_CHANNEL_AUDIO at line {0}", line, MatchStereo.Groups["num"].Value); currenttrack.flag_4ch |= intrack && MatchCopy.Groups["num"].Value == "FOUR"; } - else if (MatchISRC.Success) + else if(MatchISRC.Success) { DicConsole.DebugWriteLine("CDRDAO plugin", "Found ISRC \"{1}\" at line {0}", line, MatchISRC.Groups["isrc"].Value); - if (intrack) + if(intrack) currenttrack.isrc = MatchISRC.Groups["isrc"].Value; } - else if (MatchIndex.Success) + else if(MatchIndex.Success) { DicConsole.DebugWriteLine("CDRDAO plugin", "Found INDEX \"{1}\" at line {0}", line, MatchIndex.Groups["address"].Value); @@ -533,7 +533,7 @@ namespace DiscImageChef.ImagePlugins ulong nextIndexPos = ulong.Parse(lengthString[0]) * 60 * 75 + ulong.Parse(lengthString[1]) * 75 + ulong.Parse(lengthString[2]); currenttrack.indexes.Add(nextindex, nextIndexPos + currenttrack.pregap + currenttrack.startSector); } - else if (MatchPregap.Success) + else if(MatchPregap.Success) { DicConsole.DebugWriteLine("CDRDAO plugin", "Found START \"{1}\" at line {0}", line, MatchPregap.Groups["address"].Value); @@ -546,24 +546,24 @@ namespace DiscImageChef.ImagePlugins else currenttrack.pregap = currenttrack.sectors; } - else if (MatchZeroPregap.Success) + else if(MatchZeroPregap.Success) { DicConsole.DebugWriteLine("CDRDAO plugin", "Found PREGAP \"{1}\" at line {0}", line, MatchZeroPregap.Groups["length"].Value); currenttrack.indexes.Add(0, currenttrack.startSector); string[] lengthString = MatchZeroPregap.Groups["length"].Value.Split(new char[] { ':' }); currenttrack.pregap = ulong.Parse(lengthString[0]) * 60 * 75 + ulong.Parse(lengthString[1]) * 75 + ulong.Parse(lengthString[2]); } - else if (MatchZeroData.Success) + else if(MatchZeroData.Success) { DicConsole.DebugWriteLine("CDRDAO plugin", "Found ZERO \"{1}\" at line {0}", line, MatchZeroData.Groups["length"].Value); // Seems can be ignored as the data is still in the image } - else if (MatchZeroAudio.Success) + else if(MatchZeroAudio.Success) { DicConsole.DebugWriteLine("CDRDAO plugin", "Found SILENCE \"{1}\" at line {0}", line, MatchZeroAudio.Groups["length"].Value); // Seems can be ignored as the data is still in the image } - else if (MatchAudioFile.Success) + else if(MatchAudioFile.Success) { DicConsole.DebugWriteLine("CDRDAO plugin", "Found AUDIOFILE \"{1}\" at line {0}", line, MatchAudioFile.Groups["filename"].Value); @@ -576,7 +576,7 @@ namespace DiscImageChef.ImagePlugins ulong startSectors = 0; - if (MatchFile.Groups["start"].Value != "") + if(MatchFile.Groups["start"].Value != "") { string[] startString = MatchAudioFile.Groups["start"].Value.Split(new char[] { ':' }); startSectors = ulong.Parse(startString[0]) * 60 * 75 + ulong.Parse(startString[1]) * 75 + ulong.Parse(startString[2]); @@ -584,7 +584,7 @@ namespace DiscImageChef.ImagePlugins currenttrack.trackfile.offset += (startSectors * currenttrack.bps); - if (MatchFile.Groups["length"].Value != "") + if(MatchFile.Groups["length"].Value != "") { string[] lengthString = MatchAudioFile.Groups["length"].Value.Split(new char[] { ':' }); currenttrack.sectors = ulong.Parse(lengthString[0]) * 60 * 75 + ulong.Parse(lengthString[1]) * 75 + ulong.Parse(lengthString[2]); @@ -595,7 +595,7 @@ namespace DiscImageChef.ImagePlugins currenttrack.sectors = ((ulong)pfi.Length - currenttrack.trackfile.offset) / currenttrack.bps; } } - else if (MatchFile.Success) + else if(MatchFile.Success) { DicConsole.DebugWriteLine("CDRDAO plugin", "Found DATAFILE \"{1}\" at line {0}", line, MatchFile.Groups["filename"].Value); @@ -605,7 +605,7 @@ namespace DiscImageChef.ImagePlugins currenttrack.trackfile.filetype = "BINARY"; currenttrack.trackfile.sequence = currentTrackNumber; - if (MatchFile.Groups["length"].Value != "") + if(MatchFile.Groups["length"].Value != "") { string[] lengthString = MatchFile.Groups["length"].Value.Split(new char[] { ':' }); currenttrack.sectors = ulong.Parse(lengthString[0]) * 60 * 75 + ulong.Parse(lengthString[1]) * 75 + ulong.Parse(lengthString[2]); @@ -616,73 +616,73 @@ namespace DiscImageChef.ImagePlugins currenttrack.sectors = ((ulong)pfi.Length - currenttrack.trackfile.offset) / currenttrack.bps; } } - else if (MatchTitle.Success) + else if(MatchTitle.Success) { DicConsole.DebugWriteLine("CDRDAO plugin", "Found TITLE \"{1}\" at line {0}", line, MatchTitle.Groups["title"].Value); - if (intrack) + if(intrack) currenttrack.title = MatchTitle.Groups["title"].Value; else discimage.title = MatchTitle.Groups["title"].Value; } - else if (MatchPerformer.Success) + else if(MatchPerformer.Success) { DicConsole.DebugWriteLine("CDRDAO plugin", "Found PERFORMER \"{1}\" at line {0}", line, MatchPerformer.Groups["performer"].Value); - if (intrack) + if(intrack) currenttrack.performer = MatchPerformer.Groups["performer"].Value; else discimage.performer = MatchPerformer.Groups["performer"].Value; } - else if (MatchSongwriter.Success) + else if(MatchSongwriter.Success) { DicConsole.DebugWriteLine("CDRDAO plugin", "Found SONGWRITER \"{1}\" at line {0}", line, MatchSongwriter.Groups["songwriter"].Value); - if (intrack) + if(intrack) currenttrack.songwriter = MatchSongwriter.Groups["songwriter"].Value; else discimage.songwriter = MatchSongwriter.Groups["songwriter"].Value; } - else if (MatchComposer.Success) + else if(MatchComposer.Success) { DicConsole.DebugWriteLine("CDRDAO plugin", "Found COMPOSER \"{1}\" at line {0}", line, MatchComposer.Groups["composer"].Value); - if (intrack) + if(intrack) currenttrack.composer = MatchComposer.Groups["composer"].Value; else discimage.composer = MatchComposer.Groups["composer"].Value; } - else if (MatchArranger.Success) + else if(MatchArranger.Success) { DicConsole.DebugWriteLine("CDRDAO plugin", "Found ARRANGER \"{1}\" at line {0}", line, MatchArranger.Groups["arranger"].Value); - if (intrack) + if(intrack) currenttrack.arranger = MatchArranger.Groups["arranger"].Value; else discimage.arranger = MatchArranger.Groups["arranger"].Value; } - else if (MatchMessage.Success) + else if(MatchMessage.Success) { DicConsole.DebugWriteLine("CDRDAO plugin", "Found MESSAGE \"{1}\" at line {0}", line, MatchMessage.Groups["message"].Value); - if (intrack) + if(intrack) currenttrack.message = MatchMessage.Groups["message"].Value; else discimage.message = MatchMessage.Groups["message"].Value; } - else if (MatchDiscID.Success) + else if(MatchDiscID.Success) { DicConsole.DebugWriteLine("CDRDAO plugin", "Found DISC_ID \"{1}\" at line {0}", line, MatchDiscID.Groups["discid"].Value); - if (!intrack) + if(!intrack) discimage.disk_id = MatchDiscID.Groups["discid"].Value; } - else if (MatchUPC.Success) + else if(MatchUPC.Success) { DicConsole.DebugWriteLine("CDRDAO plugin", "Found UPC_EAN \"{1}\" at line {0}", line, MatchUPC.Groups["catalog"].Value); - if (!intrack) + if(!intrack) discimage.barcode = MatchUPC.Groups["catalog"].Value; } // Ignored fields - else if (MatchCDText.Success || MatchLanguage.Success || MatchClosure.Success || - MatchLanguageMap.Success || MatchLanguageMapping.Success) + else if(MatchCDText.Success || MatchLanguage.Success || MatchClosure.Success || + MatchLanguageMap.Success || MatchLanguageMapping.Success) { } - else if (_line == "") // Empty line, ignore it + else if(_line == "") // Empty line, ignore it { } @@ -695,11 +695,11 @@ namespace DiscImageChef.ImagePlugins */ } - if (currenttrack.sequence != 0) + if(currenttrack.sequence != 0) { if(currenttrack.pregap != currenttrack.sectors && !currenttrack.indexes.ContainsKey(1)) currenttrack.indexes.Add(1, currenttrack.startSector + currenttrack.pregap); - + discimage.tracks.Add(currenttrack); } @@ -708,48 +708,48 @@ namespace DiscImageChef.ImagePlugins // DEBUG information DicConsole.DebugWriteLine("CDRDAO plugin", "Disc image parsing results"); DicConsole.DebugWriteLine("CDRDAO plugin", "Disc CD-TEXT:"); - if (discimage.arranger == null) + if(discimage.arranger == null) DicConsole.DebugWriteLine("CDRDAO plugin", "\tArranger is not set."); else DicConsole.DebugWriteLine("CDRDAO plugin", "\tArranger: {0}", discimage.arranger); - if (discimage.composer == null) + if(discimage.composer == null) DicConsole.DebugWriteLine("CDRDAO plugin", "\tComposer is not set."); else DicConsole.DebugWriteLine("CDRDAO plugin", "\tComposer: {0}", discimage.composer); - if (discimage.performer == null) + if(discimage.performer == null) DicConsole.DebugWriteLine("CDRDAO plugin", "\tPerformer is not set."); else DicConsole.DebugWriteLine("CDRDAO plugin", "\tPerformer: {0}", discimage.performer); - if (discimage.songwriter == null) + if(discimage.songwriter == null) DicConsole.DebugWriteLine("CDRDAO plugin", "\tSongwriter is not set."); else DicConsole.DebugWriteLine("CDRDAO plugin", "\tSongwriter: {0}", discimage.songwriter); - if (discimage.title == null) + if(discimage.title == null) DicConsole.DebugWriteLine("CDRDAO plugin", "\tTitle is not set."); else DicConsole.DebugWriteLine("CDRDAO plugin", "\tTitle: {0}", discimage.title); DicConsole.DebugWriteLine("CDRDAO plugin", "Disc information:"); DicConsole.DebugWriteLine("CDRDAO plugin", "\tGuessed disk type: {0}", discimage.disktype); - if (discimage.barcode == null) + if(discimage.barcode == null) DicConsole.DebugWriteLine("CDRDAO plugin", "\tBarcode not set."); else DicConsole.DebugWriteLine("CDRDAO plugin", "\tBarcode: {0}", discimage.barcode); - if (discimage.disk_id == null) + if(discimage.disk_id == null) DicConsole.DebugWriteLine("CDRDAO plugin", "\tDisc ID not set."); else DicConsole.DebugWriteLine("CDRDAO plugin", "\tDisc ID: {0}", discimage.disk_id); - if (discimage.mcn == null) + if(discimage.mcn == null) DicConsole.DebugWriteLine("CDRDAO plugin", "\tMCN not set."); else DicConsole.DebugWriteLine("CDRDAO plugin", "\tMCN: {0}", discimage.mcn); - if (string.IsNullOrEmpty(discimage.comment)) + if(string.IsNullOrEmpty(discimage.comment)) DicConsole.DebugWriteLine("CDRDAO plugin", "\tComment not set."); else DicConsole.DebugWriteLine("CDRDAO plugin", "\tComment: \"{0}\"", discimage.comment); DicConsole.DebugWriteLine("CDRDAO plugin", "Track information:"); DicConsole.DebugWriteLine("CDRDAO plugin", "\tDisc contains {0} tracks", discimage.tracks.Count); - for (int i = 0; i < discimage.tracks.Count; i++) + for(int i = 0; i < discimage.tracks.Count; i++) { DicConsole.DebugWriteLine("CDRDAO plugin", "\tTrack {0} information:", discimage.tracks[i].sequence); @@ -758,42 +758,42 @@ namespace DiscImageChef.ImagePlugins DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tData: {0} sectors starting at sector {1}", discimage.tracks[i].sectors, discimage.tracks[i].startSector); DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tPostgap: {0} sectors", discimage.tracks[i].postgap); - if (discimage.tracks[i].flag_4ch) + if(discimage.tracks[i].flag_4ch) DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tTrack is flagged as quadraphonic"); - if (discimage.tracks[i].flag_dcp) + if(discimage.tracks[i].flag_dcp) DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tTrack allows digital copy"); - if (discimage.tracks[i].flag_pre) + if(discimage.tracks[i].flag_pre) DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tTrack has pre-emphasis applied"); DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tTrack resides in file {0}, type defined as {1}, starting at byte {2}", discimage.tracks[i].trackfile.datafile, discimage.tracks[i].trackfile.filetype, discimage.tracks[i].trackfile.offset); DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tIndexes:"); - foreach (KeyValuePair kvp in discimage.tracks[i].indexes) + foreach(KeyValuePair kvp in discimage.tracks[i].indexes) DicConsole.DebugWriteLine("CDRDAO plugin", "\t\t\tIndex {0} starts at sector {1}", kvp.Key, kvp.Value); - if (discimage.tracks[i].isrc == null) + if(discimage.tracks[i].isrc == null) DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tISRC is not set."); else DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tISRC: {0}", discimage.tracks[i].isrc); - if (discimage.tracks[i].arranger == null) + if(discimage.tracks[i].arranger == null) DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tArranger is not set."); else DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tArranger: {0}", discimage.tracks[i].arranger); - if (discimage.tracks[i].composer == null) + if(discimage.tracks[i].composer == null) DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tComposer is not set."); else DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tComposer: {0}", discimage.tracks[i].composer); - if (discimage.tracks[i].performer == null) + if(discimage.tracks[i].performer == null) DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tPerformer is not set."); else DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tPerformer: {0}", discimage.tracks[i].performer); - if (discimage.tracks[i].songwriter == null) + if(discimage.tracks[i].songwriter == null) DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tSongwriter is not set."); else DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tSongwriter: {0}", discimage.tracks[i].songwriter); - if (discimage.tracks[i].title == null) + if(discimage.tracks[i].title == null) DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tTitle is not set."); else DicConsole.DebugWriteLine("CDRDAO plugin", "\t\tTitle: {0}", discimage.tracks[i].title); @@ -806,11 +806,11 @@ namespace DiscImageChef.ImagePlugins ulong byte_offset = 0; ulong partitionSequence = 0; - for (int i = 0; i < discimage.tracks.Count; i++) + for(int i = 0; i < discimage.tracks.Count; i++) { ulong index0_len = 0; - if (discimage.tracks[i].sequence == 1 && i != 0) + if(discimage.tracks[i].sequence == 1 && i != 0) throw new ImageNotSupportedException("Unordered tracks"); Partition partition = new Partition(); @@ -828,14 +828,14 @@ namespace DiscImageChef.ImagePlugins byte_offset += partition.PartitionLength; partitionSequence++; - if (!offsetmap.ContainsKey(discimage.tracks[i].sequence)) + if(!offsetmap.ContainsKey(discimage.tracks[i].sequence)) offsetmap.Add(discimage.tracks[i].sequence, partition.PartitionStartSector); else { ulong old_start; offsetmap.TryGetValue(discimage.tracks[i].sequence, out old_start); - if (partition.PartitionStartSector < old_start) + if(partition.PartitionStartSector < old_start) { offsetmap.Remove(discimage.tracks[i].sequence); offsetmap.Add(discimage.tracks[i].sequence, partition.PartitionStartSector); @@ -848,7 +848,7 @@ namespace DiscImageChef.ImagePlugins // Print partition map DicConsole.DebugWriteLine("CDRDAO plugin", "printing partition map"); - foreach (Partition partition in partitions) + foreach(Partition partition in partitions) { DicConsole.DebugWriteLine("CDRDAO plugin", "Partition sequence: {0}", partition.PartitionSequence); DicConsole.DebugWriteLine("CDRDAO plugin", "\tPartition name: {0}", partition.PartitionName); @@ -860,20 +860,20 @@ namespace DiscImageChef.ImagePlugins DicConsole.DebugWriteLine("CDRDAO plugin", "\tPartition size in bytes: {0}", partition.PartitionLength); } - foreach (CDRDAOTrack track in discimage.tracks) + foreach(CDRDAOTrack track in discimage.tracks) { ImageInfo.imageSize += track.bps * track.sectors; ImageInfo.sectors += track.sectors; } - if (discimage.disktype == MediaType.CDG || discimage.disktype == MediaType.CDEG || discimage.disktype == MediaType.CDMIDI) + if(discimage.disktype == MediaType.CDG || discimage.disktype == MediaType.CDEG || discimage.disktype == MediaType.CDMIDI) ImageInfo.sectorSize = 2448; // CD+G subchannels ARE user data, as CD+G are useless without them - else if (discimage.disktype != MediaType.CDROMXA && discimage.disktype != MediaType.CDDA && discimage.disktype != MediaType.CDI && discimage.disktype != MediaType.CDPLUS) + else if(discimage.disktype != MediaType.CDROMXA && discimage.disktype != MediaType.CDDA && discimage.disktype != MediaType.CDI && discimage.disktype != MediaType.CDPLUS) ImageInfo.sectorSize = 2048; // Only data tracks else ImageInfo.sectorSize = 2352; // All others - if (discimage.mcn != null) + if(discimage.mcn != null) ImageInfo.readableMediaTags.Add(MediaTagType.CD_MCN); ImageInfo.imageApplication = "CDRDAO"; @@ -890,58 +890,58 @@ namespace DiscImageChef.ImagePlugins ImageInfo.readableSectorTags.Add(SectorTagType.CDTrackFlags); - foreach (CDRDAOTrack track in discimage.tracks) + foreach(CDRDAOTrack track in discimage.tracks) { - if (track.subchannel) + if(track.subchannel) { - if (!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubchannel)) + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubchannel)) ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubchannel); } - - switch (track.tracktype) + + switch(track.tracktype) { case CDRDAOTrackTypeAudio: { - if (!ImageInfo.readableSectorTags.Contains(SectorTagType.CDTrackISRC)) + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDTrackISRC)) ImageInfo.readableSectorTags.Add(SectorTagType.CDTrackISRC); break; } case CDRDAOTrackTypeMode2: case CDRDAOTrackTypeMode2Mix: { - if (!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubHeader)) + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubHeader)) ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubHeader); - if (!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC)) + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC)) ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC); break; } case CDRDAOTrackTypeMode2Raw: { - if (!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); - if (!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); - if (!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubHeader)) + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubHeader)) ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubHeader); - if (!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC)) + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC)) ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC); break; } case CDRDAOTrackTypeMode1Raw: { - if (!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync)) ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync); - if (!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader)) ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader); - if (!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubHeader)) + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubHeader)) ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubHeader); - if (!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC)) + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC)) ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC); - if (!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_P)) + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_P)) ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_P); - if (!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_Q)) + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_Q)) ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_Q); - if (!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC)) + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC)) ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC); break; } @@ -952,7 +952,7 @@ namespace DiscImageChef.ImagePlugins return true; } - catch (Exception ex) + catch(Exception ex) { DicConsole.ErrorWriteLine("Exception trying to identify image file {0}", imagePath); DicConsole.ErrorWriteLine("Exception: {0}", ex.Message); @@ -983,11 +983,11 @@ namespace DiscImageChef.ImagePlugins public override byte[] ReadDiskTag(MediaTagType tag) { - switch (tag) + switch(tag) { case MediaTagType.CD_MCN: { - if (discimage.mcn != null) + if(discimage.mcn != null) { return Encoding.ASCII.GetBytes(discimage.mcn); } @@ -1020,15 +1020,15 @@ namespace DiscImageChef.ImagePlugins public override byte[] ReadSectors(UInt64 sectorAddress, UInt32 length) { - foreach (KeyValuePair kvp in offsetmap) + foreach(KeyValuePair kvp in offsetmap) { - if (sectorAddress >= kvp.Value) + if(sectorAddress >= kvp.Value) { - foreach (CDRDAOTrack cdrdao_track in discimage.tracks) + foreach(CDRDAOTrack cdrdao_track in discimage.tracks) { - if (cdrdao_track.sequence == kvp.Key) + if(cdrdao_track.sequence == kvp.Key) { - if ((sectorAddress - kvp.Value) < cdrdao_track.sectors) + if((sectorAddress - kvp.Value) < cdrdao_track.sectors) return ReadSectors((sectorAddress - kvp.Value), length, kvp.Key); } } @@ -1040,15 +1040,15 @@ namespace DiscImageChef.ImagePlugins public override byte[] ReadSectorsTag(UInt64 sectorAddress, UInt32 length, SectorTagType tag) { - foreach (KeyValuePair kvp in offsetmap) + foreach(KeyValuePair kvp in offsetmap) { - if (sectorAddress >= kvp.Value) + if(sectorAddress >= kvp.Value) { - foreach (CDRDAOTrack cdrdao_track in discimage.tracks) + foreach(CDRDAOTrack cdrdao_track in discimage.tracks) { - if (cdrdao_track.sequence == kvp.Key) + if(cdrdao_track.sequence == kvp.Key) { - if ((sectorAddress - kvp.Value) < cdrdao_track.sectors) + if((sectorAddress - kvp.Value) < cdrdao_track.sectors) return ReadSectorsTag((sectorAddress - kvp.Value), length, kvp.Key, tag); } } @@ -1064,26 +1064,26 @@ namespace DiscImageChef.ImagePlugins _track.sequence = 0; - foreach (CDRDAOTrack cdrdao_track in discimage.tracks) + foreach(CDRDAOTrack cdrdao_track in discimage.tracks) { - if (cdrdao_track.sequence == track) + if(cdrdao_track.sequence == track) { _track = cdrdao_track; break; } } - if (_track.sequence == 0) + if(_track.sequence == 0) throw new ArgumentOutOfRangeException("track", "Track does not exist in disc image"); - if (length > _track.sectors) + if(length > _track.sectors) throw new ArgumentOutOfRangeException("length", "Requested more sectors than present in track, won't cross tracks"); uint sector_offset; uint sector_size; uint sector_skip; - switch (_track.tracktype) + switch(_track.tracktype) { case CDRDAOTrackTypeMode1: case CDRDAOTrackTypeMode2Form1: @@ -1133,20 +1133,20 @@ namespace DiscImageChef.ImagePlugins throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); } - if (_track.subchannel) + if(_track.subchannel) sector_skip += 96; byte[] buffer = new byte[sector_size * length]; imageStream = new FileStream(_track.trackfile.datafile, FileMode.Open, FileAccess.Read); - using (BinaryReader br = new BinaryReader(imageStream)) + using(BinaryReader br = new BinaryReader(imageStream)) { br.BaseStream.Seek((long)_track.trackfile.offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), SeekOrigin.Begin); - if (sector_offset == 0 && sector_skip == 0) + if(sector_offset == 0 && sector_skip == 0) buffer = br.ReadBytes((int)(sector_size * length)); else { - for (int i = 0; i < length; i++) + for(int i = 0; i < length; i++) { byte[] sector; br.BaseStream.Seek(sector_offset, SeekOrigin.Current); @@ -1166,29 +1166,29 @@ namespace DiscImageChef.ImagePlugins _track.sequence = 0; - foreach (CDRDAOTrack cdrdao_track in discimage.tracks) + foreach(CDRDAOTrack cdrdao_track in discimage.tracks) { - if (cdrdao_track.sequence == track) + if(cdrdao_track.sequence == track) { _track = cdrdao_track; break; } } - if (_track.sequence == 0) + if(_track.sequence == 0) throw new ArgumentOutOfRangeException("track", "Track does not exist in disc image"); - if (length > _track.sectors) + if(length > _track.sectors) throw new ArgumentOutOfRangeException("length", "Requested more sectors than present in track, won't cross tracks"); uint sector_offset; uint sector_size; uint sector_skip = 0; - if (!_track.subchannel && tag == SectorTagType.CDSectorSubchannel) + if(!_track.subchannel && tag == SectorTagType.CDSectorSubchannel) throw new ArgumentException("No tags in image for requested track", "tag"); - switch (tag) + switch(tag) { case SectorTagType.CDSectorECC: case SectorTagType.CDSectorECC_P: @@ -1203,16 +1203,16 @@ namespace DiscImageChef.ImagePlugins { byte[] flags = new byte[1]; - if (_track.tracktype != CDRDAOTrackTypeAudio) + if(_track.tracktype != CDRDAOTrackTypeAudio) flags[0] += 0x40; - if (_track.flag_dcp) + if(_track.flag_dcp) flags[0] += 0x20; - if (_track.flag_pre) + if(_track.flag_pre) flags[0] += 0x10; - if (_track.flag_4ch) + if(_track.flag_4ch) flags[0] += 0x80; return flags; @@ -1223,11 +1223,11 @@ namespace DiscImageChef.ImagePlugins throw new ArgumentException("Unsupported tag requested", "tag"); } - switch (_track.tracktype) + switch(_track.tracktype) { case CDRDAOTrackTypeMode1: case CDRDAOTrackTypeMode2Form1: - if (tag == SectorTagType.CDSectorSubchannel) + if(tag == SectorTagType.CDSectorSubchannel) { sector_offset = 2048; sector_size = 96; @@ -1236,7 +1236,7 @@ namespace DiscImageChef.ImagePlugins throw new ArgumentException("No tags in image for requested track", "tag"); case CDRDAOTrackTypeMode2Form2: case CDRDAOTrackTypeMode2Mix: - if (tag == SectorTagType.CDSectorSubchannel) + if(tag == SectorTagType.CDSectorSubchannel) { sector_offset = 2336; sector_size = 96; @@ -1244,7 +1244,7 @@ namespace DiscImageChef.ImagePlugins } throw new ArgumentException("No tags in image for requested track", "tag"); case CDRDAOTrackTypeAudio: - if (tag == SectorTagType.CDSectorSubchannel) + if(tag == SectorTagType.CDSectorSubchannel) { sector_offset = 2352; sector_size = 96; @@ -1253,7 +1253,7 @@ namespace DiscImageChef.ImagePlugins throw new ArgumentException("No tags in image for requested track", "tag"); case CDRDAOTrackTypeMode1Raw: { - switch (tag) + switch(tag) { case SectorTagType.CDSectorSync: { @@ -1325,14 +1325,14 @@ namespace DiscImageChef.ImagePlugins byte[] buffer = new byte[sector_size * length]; imageStream = new FileStream(_track.trackfile.datafile, FileMode.Open, FileAccess.Read); - using (BinaryReader br = new BinaryReader(imageStream)) + using(BinaryReader br = new BinaryReader(imageStream)) { br.BaseStream.Seek((long)_track.trackfile.offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), SeekOrigin.Begin); - if (sector_offset == 0 && sector_skip == 0) + if(sector_offset == 0 && sector_skip == 0) buffer = br.ReadBytes((int)(sector_size * length)); else { - for (int i = 0; i < length; i++) + for(int i = 0; i < length; i++) { byte[] sector; br.BaseStream.Seek(sector_offset, SeekOrigin.Current); @@ -1358,15 +1358,15 @@ namespace DiscImageChef.ImagePlugins public override byte[] ReadSectorsLong(UInt64 sectorAddress, UInt32 length) { - foreach (KeyValuePair kvp in offsetmap) + foreach(KeyValuePair kvp in offsetmap) { - if (sectorAddress >= kvp.Value) + if(sectorAddress >= kvp.Value) { - foreach (CDRDAOTrack cdrdao_track in discimage.tracks) + foreach(CDRDAOTrack cdrdao_track in discimage.tracks) { - if (cdrdao_track.sequence == kvp.Key) + if(cdrdao_track.sequence == kvp.Key) { - if ((sectorAddress - kvp.Value) < cdrdao_track.sectors) + if((sectorAddress - kvp.Value) < cdrdao_track.sectors) return ReadSectorsLong((sectorAddress - kvp.Value), length, kvp.Key); } } @@ -1382,26 +1382,26 @@ namespace DiscImageChef.ImagePlugins _track.sequence = 0; - foreach (CDRDAOTrack cdrdao_track in discimage.tracks) + foreach(CDRDAOTrack cdrdao_track in discimage.tracks) { - if (cdrdao_track.sequence == track) + if(cdrdao_track.sequence == track) { _track = cdrdao_track; break; } } - if (_track.sequence == 0) + if(_track.sequence == 0) throw new ArgumentOutOfRangeException("track", "Track does not exist in disc image"); - if (length > _track.sectors) + if(length > _track.sectors) throw new ArgumentOutOfRangeException("length", "Requested more sectors than present in track, won't cross tracks"); uint sector_offset; uint sector_size; uint sector_skip; - switch (_track.tracktype) + switch(_track.tracktype) { case CDRDAOTrackTypeMode1: case CDRDAOTrackTypeMode2Form1: @@ -1439,7 +1439,7 @@ namespace DiscImageChef.ImagePlugins throw new FeatureSupportedButNotImplementedImageException("Unsupported track type"); } - if (_track.subchannel) + if(_track.subchannel) sector_skip += 96; byte[] buffer = new byte[sector_size * length]; @@ -1449,11 +1449,11 @@ namespace DiscImageChef.ImagePlugins br.BaseStream.Seek((long)_track.trackfile.offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), SeekOrigin.Begin); - if (sector_offset == 0 && sector_skip == 0) + if(sector_offset == 0 && sector_skip == 0) buffer = br.ReadBytes((int)(sector_size * length)); else { - for (int i = 0; i < length; i++) + for(int i = 0; i < length; i++) { byte[] sector; br.BaseStream.Seek(sector_offset, SeekOrigin.Current); @@ -1467,22 +1467,22 @@ namespace DiscImageChef.ImagePlugins return buffer; } - public override string GetImageFormat() + public override string GetImageFormat() { return "CDRDAO tocfile"; } - public override string GetImageVersion() + public override string GetImageVersion() { return ImageInfo.imageVersion; } - public override string GetImageApplication() + public override string GetImageApplication() { return ImageInfo.imageApplication; } - public override string GetImageApplicationVersion() + public override string GetImageApplicationVersion() { return ImageInfo.imageApplicationVersion; } @@ -1497,7 +1497,7 @@ namespace DiscImageChef.ImagePlugins return ImageInfo.imageLastModificationTime; } - public override string GetImageComments() + public override string GetImageComments() { return ImageInfo.imageComments; } @@ -1526,13 +1526,13 @@ namespace DiscImageChef.ImagePlugins { List tracks = new List(); - foreach (CDRDAOTrack cdr_track in discimage.tracks) + foreach(CDRDAOTrack cdr_track in discimage.tracks) { Track _track = new Track(); _track.Indexes = cdr_track.indexes; _track.TrackDescription = cdr_track.title; - if (!cdr_track.indexes.TryGetValue(0, out _track.TrackStartSector)) + if(!cdr_track.indexes.TryGetValue(0, out _track.TrackStartSector)) cdr_track.indexes.TryGetValue(1, out _track.TrackStartSector); _track.TrackStartSector = cdr_track.startSector; _track.TrackEndSector = _track.TrackStartSector + cdr_track.sectors - 1; @@ -1545,7 +1545,7 @@ namespace DiscImageChef.ImagePlugins _track.TrackFileType = cdr_track.trackfile.filetype; _track.TrackRawBytesPerSector = cdr_track.bps; _track.TrackBytesPerSector = CDRDAOTrackTypeToCookedBytesPerSector(cdr_track.tracktype); - if (cdr_track.subchannel) + if(cdr_track.subchannel) { _track.TrackSubchannelType = cdr_track.packedsubchannel ? TrackSubchannelType.PackedInterleaved : TrackSubchannelType.RawInterleaved; @@ -1568,7 +1568,7 @@ namespace DiscImageChef.ImagePlugins public override List GetSessionTracks(ushort session) { - if (session == 1) + if(session == 1) return GetTracks(); throw new ImageNotSupportedException("Session does not exist in disc image"); } @@ -1599,12 +1599,12 @@ namespace DiscImageChef.ImagePlugins FailingLBAs = new List(); UnknownLBAs = new List(); - for (int i = 0; i < length; i++) + for(int i = 0; i < length; i++) { Array.Copy(buffer, i * bps, sector, 0, bps); bool? sectorStatus = Checksums.CDChecksums.CheckCDSector(sector); - switch (sectorStatus) + switch(sectorStatus) { case null: UnknownLBAs.Add((ulong)i + sectorAddress); @@ -1615,9 +1615,9 @@ namespace DiscImageChef.ImagePlugins } } - if (UnknownLBAs.Count > 0) + if(UnknownLBAs.Count > 0) return null; - if (FailingLBAs.Count > 0) + if(FailingLBAs.Count > 0) return false; return true; } @@ -1630,12 +1630,12 @@ namespace DiscImageChef.ImagePlugins FailingLBAs = new List(); UnknownLBAs = new List(); - for (int i = 0; i < length; i++) + for(int i = 0; i < length; i++) { Array.Copy(buffer, i * bps, sector, 0, bps); bool? sectorStatus = Checksums.CDChecksums.CheckCDSector(sector); - switch (sectorStatus) + switch(sectorStatus) { case null: UnknownLBAs.Add((ulong)i + sectorAddress); @@ -1646,9 +1646,9 @@ namespace DiscImageChef.ImagePlugins } } - if (UnknownLBAs.Count > 0) + if(UnknownLBAs.Count > 0) return null; - if (FailingLBAs.Count > 0) + if(FailingLBAs.Count > 0) return false; return true; } @@ -1664,7 +1664,7 @@ namespace DiscImageChef.ImagePlugins static UInt16 CDRDAOTrackTypeToBytesPerSector(string trackType) { - switch (trackType) + switch(trackType) { case CDRDAOTrackTypeMode1: case CDRDAOTrackTypeMode2Form1: @@ -1685,7 +1685,7 @@ namespace DiscImageChef.ImagePlugins static UInt16 CDRDAOTrackTypeToCookedBytesPerSector(string trackType) { - switch (trackType) + switch(trackType) { case CDRDAOTrackTypeMode1: case CDRDAOTrackTypeMode2Form1: @@ -1706,7 +1706,7 @@ namespace DiscImageChef.ImagePlugins static TrackType CDRDAOTrackTypeToTrackType(string trackType) { - switch (trackType) + switch(trackType) { case CDRDAOTrackTypeMode1: case CDRDAOTrackTypeMode1Raw: @@ -1730,12 +1730,12 @@ namespace DiscImageChef.ImagePlugins #region Unsupported features - public override int GetMediaSequence() + public override int GetMediaSequence() { return ImageInfo.mediaSequence; } - public override int GetLastDiskSequence() + public override int GetLastDiskSequence() { return ImageInfo.lastMediaSequence; } @@ -1770,12 +1770,12 @@ namespace DiscImageChef.ImagePlugins return ImageInfo.mediaModel; } - public override string GetImageName() + public override string GetImageName() { return ImageInfo.imageName; } - public override string GetImageCreator() + public override string GetImageCreator() { return ImageInfo.imageCreator; } diff --git a/DiscImageChef.DiscImages/CDRWin.cs b/DiscImageChef.DiscImages/CDRWin.cs index 22be54d48..519a350c2 100644 --- a/DiscImageChef.DiscImages/CDRWin.cs +++ b/DiscImageChef.DiscImages/CDRWin.cs @@ -324,7 +324,7 @@ namespace DiscImageChef.ImagePlugins cueStream = new StreamReader(this.imagePath); int line = 0; - while (cueStream.Peek() >= 0) + while(cueStream.Peek() >= 0) { line++; string _line = cueStream.ReadLine(); @@ -345,14 +345,14 @@ namespace DiscImageChef.ImagePlugins Cm = Cr.Match(_line); Fm = Fr.Match(_line); - if (!Sm.Success && !Rm.Success && !Cm.Success && !Fm.Success) + if(!Sm.Success && !Rm.Success && !Cm.Success && !Fm.Success) return false; return true; } return false; } - catch (Exception ex) + catch(Exception ex) { DicConsole.ErrorWriteLine("Exception trying to identify image file {0}", this.imagePath); DicConsole.ErrorWriteLine("Exception: {0}", ex.Message); @@ -363,9 +363,9 @@ namespace DiscImageChef.ImagePlugins public override bool OpenImage(string imagePath) { - if (imagePath == null) + if(imagePath == null) return false; - if (imagePath == "") + if(imagePath == "") return false; this.imagePath = imagePath; @@ -439,23 +439,23 @@ namespace DiscImageChef.ImagePlugins CDRWinTrack[] cuetracks; int track_count = 0; - while (cueStream.Peek() >= 0) + while(cueStream.Peek() >= 0) { line++; string _line = cueStream.ReadLine(); MatchTrack = RegexTrack.Match(_line); - if (MatchTrack.Success) + if(MatchTrack.Success) { uint track_seq = uint.Parse(MatchTrack.Groups[1].Value); - if (track_count + 1 != track_seq) + if(track_count + 1 != track_seq) throw new FeatureUnsupportedImageException(String.Format("Found TRACK {0} out of order in line {1}", track_seq, line)); track_count++; } } - if (track_count == 0) + if(track_count == 0) throw new FeatureUnsupportedImageException("No tracks found"); cuetracks = new CDRWinTrack[track_count]; @@ -470,7 +470,7 @@ namespace DiscImageChef.ImagePlugins cueStream.Close(); cueStream = new StreamReader(imagePath); - while (cueStream.Peek() >= 0) + while(cueStream.Peek() >= 0) { line++; string _line = cueStream.ReadLine(); @@ -481,36 +481,36 @@ namespace DiscImageChef.ImagePlugins MatchLBA = RegexLBA.Match(_line); // Unhandled, just ignored MatchLeadOut = RegexLeadOut.Match(_line); // Unhandled, just ignored - if (MatchDiskType.Success && !intrack) + if(MatchDiskType.Success && !intrack) { DicConsole.DebugWriteLine("CDRWin plugin", "Found REM ORIGINAL MEDIA TYPE at line {0}", line); discimage.disktypestr = MatchDiskType.Groups[1].Value; } - else if (MatchDiskType.Success && intrack) + else if(MatchDiskType.Success && intrack) { throw new FeatureUnsupportedImageException(String.Format("Found REM ORIGINAL MEDIA TYPE field after a track in line {0}", line)); } - else if (MatchSession.Success) + else if(MatchSession.Success) { DicConsole.DebugWriteLine("CDRWin plugin", "Found REM SESSION at line {0}", line); currentsession = Byte.Parse(MatchSession.Groups[1].Value); // What happens between sessions } - else if (MatchLBA.Success) + else if(MatchLBA.Success) { DicConsole.DebugWriteLine("CDRWin plugin", "Found REM MSF at line {0}", line); // Just ignored } - else if (MatchLeadOut.Success) + else if(MatchLeadOut.Success) { DicConsole.DebugWriteLine("CDRWin plugin", "Found REM LEAD-OUT at line {0}", line); // Just ignored } - else if (MatchComment.Success) + else if(MatchComment.Success) { DicConsole.DebugWriteLine("CDRWin plugin", "Found REM at line {0}", line); - if (discimage.comment == "") + if(discimage.comment == "") discimage.comment = MatchComment.Groups[1].Value; // First comment else discimage.comment += Environment.NewLine + MatchComment.Groups[1].Value; // Append new comments as new lines @@ -535,51 +535,51 @@ namespace DiscImageChef.ImagePlugins MatchBarCode = RegexBarCode.Match(_line); MatchArranger = RegexArranger.Match(_line); - if (MatchArranger.Success) + if(MatchArranger.Success) { DicConsole.DebugWriteLine("CDRWin plugin", "Found ARRANGER at line {0}", line); - if (intrack) + if(intrack) currenttrack.arranger = MatchArranger.Groups[1].Value; else discimage.arranger = MatchArranger.Groups[1].Value; } - else if (MatchBarCode.Success) + else if(MatchBarCode.Success) { DicConsole.DebugWriteLine("CDRWin plugin", "Found UPC_EAN at line {0}", line); - if (!intrack) + if(!intrack) discimage.barcode = MatchBarCode.Groups[1].Value; else throw new FeatureUnsupportedImageException(String.Format("Found barcode field in incorrect place at line {0}", line)); } - else if (MatchCDText.Success) + else if(MatchCDText.Success) { DicConsole.DebugWriteLine("CDRWin plugin", "Found CDTEXTFILE at line {0}", line); - if (!intrack) + if(!intrack) discimage.cdtextfile = MatchCDText.Groups[1].Value; else throw new FeatureUnsupportedImageException(String.Format("Found CD-Text file field in incorrect place at line {0}", line)); } - else if (MatchComposer.Success) + else if(MatchComposer.Success) { DicConsole.DebugWriteLine("CDRWin plugin", "Found COMPOSER at line {0}", line); - if (intrack) + if(intrack) currenttrack.arranger = MatchComposer.Groups[1].Value; else discimage.arranger = MatchComposer.Groups[1].Value; } - else if (MatchDiskID.Success) + else if(MatchDiskID.Success) { DicConsole.DebugWriteLine("CDRWin plugin", "Found DISC_ID at line {0}", line); - if (!intrack) + if(!intrack) discimage.disk_id = MatchDiskID.Groups[1].Value; else throw new FeatureUnsupportedImageException(String.Format("Found CDDB ID field in incorrect place at line {0}", line)); } - else if (MatchFile.Success) + else if(MatchFile.Success) { DicConsole.DebugWriteLine("CDRWin plugin", "Found FILE at line {0}", line); - if (currenttrack.sequence != 0) + if(currenttrack.sequence != 0) { currentfile.sequence = currenttrack.sequence; currenttrack.trackfile = currentfile; @@ -595,51 +595,51 @@ namespace DiscImageChef.ImagePlugins currentfile.filetype = MatchFile.Groups[2].Value; // Check if file path is quoted - if (currentfile.datafile[0] == '"' && currentfile.datafile[currentfile.datafile.Length - 1] == '"') + if(currentfile.datafile[0] == '"' && currentfile.datafile[currentfile.datafile.Length - 1] == '"') { currentfile.datafile = currentfile.datafile.Substring(1, currentfile.datafile.Length - 2); // Unquote it } // Check if file exists - if (!File.Exists(currentfile.datafile)) + if(!File.Exists(currentfile.datafile)) { - if (currentfile.datafile[0] == '/' || (currentfile.datafile[0] == '/' && currentfile.datafile[1] == '.')) // UNIX absolute path + if(currentfile.datafile[0] == '/' || (currentfile.datafile[0] == '/' && currentfile.datafile[1] == '.')) // UNIX absolute path { Regex unixpath = new Regex("^(.+)/([^/]+)$"); Match unixpathmatch = unixpath.Match(currentfile.datafile); - if (unixpathmatch.Success) + if(unixpathmatch.Success) { currentfile.datafile = unixpathmatch.Groups[1].Value; - if (!File.Exists(currentfile.datafile)) + if(!File.Exists(currentfile.datafile)) { string path = Path.GetPathRoot(imagePath); currentfile.datafile = path + Path.PathSeparator + currentfile.datafile; - if (!File.Exists(currentfile.datafile)) + if(!File.Exists(currentfile.datafile)) throw new FeatureUnsupportedImageException(String.Format("File \"{0}\" not found.", MatchFile.Groups[1].Value)); } } else throw new FeatureUnsupportedImageException(String.Format("File \"{0}\" not found.", MatchFile.Groups[1].Value)); } - else if ((currentfile.datafile[1] == ':' && currentfile.datafile[2] == '\\') || + else if((currentfile.datafile[1] == ':' && currentfile.datafile[2] == '\\') || (currentfile.datafile[0] == '\\' && currentfile.datafile[1] == '\\') || ((currentfile.datafile[0] == '.' && currentfile.datafile[1] == '\\'))) // Windows absolute path { Regex winpath = new Regex("^(?:[a-zA-Z]\\:(\\\\|\\/)|file\\:\\/\\/|\\\\\\\\|\\.(\\/|\\\\))([^\\\\\\/\\:\\*\\?\\<\\>\\\"\\|]+(\\\\|\\/){0,1})+$"); Match winpathmatch = winpath.Match(currentfile.datafile); - if (winpathmatch.Success) + if(winpathmatch.Success) { currentfile.datafile = winpathmatch.Groups[1].Value; - if (!File.Exists(currentfile.datafile)) + if(!File.Exists(currentfile.datafile)) { string path = Path.GetPathRoot(imagePath); currentfile.datafile = path + Path.PathSeparator + currentfile.datafile; - if (!File.Exists(currentfile.datafile)) + if(!File.Exists(currentfile.datafile)) throw new FeatureUnsupportedImageException(String.Format("File \"{0}\" not found.", MatchFile.Groups[1].Value)); } } @@ -651,7 +651,7 @@ namespace DiscImageChef.ImagePlugins string path = Path.GetDirectoryName(imagePath); currentfile.datafile = path + Path.DirectorySeparatorChar + currentfile.datafile; - if (!File.Exists(currentfile.datafile)) + if(!File.Exists(currentfile.datafile)) throw new FeatureUnsupportedImageException(String.Format("File \"{0}\" not found.", MatchFile.Groups[1].Value)); } } @@ -659,7 +659,7 @@ namespace DiscImageChef.ImagePlugins // File does exist, process it DicConsole.DebugWriteLine("CDRWin plugin", "File \"{0}\" found", currentfile.datafile); - switch (currentfile.filetype) + switch(currentfile.filetype) { case CDRWinDiskTypeLittleEndian: break; @@ -675,10 +675,10 @@ namespace DiscImageChef.ImagePlugins currentfile.offset = 0; currentfile.sequence = 0; } - else if (MatchFlags.Success) + else if(MatchFlags.Success) { DicConsole.DebugWriteLine("CDRWin plugin", "Found FLAGS at line {0}", line); - if (!intrack) + if(!intrack) throw new FeatureUnsupportedImageException(String.Format("Found FLAGS field in incorrect place at line {0}", line)); const string FlagsRegEx = "FLAGS\\s+(((?DCP)|(?4CH)|(?
PRE)|(?SCMS))\\s*)+$";
@@ -687,30 +687,30 @@ namespace DiscImageChef.ImagePlugins
                             currenttrack.flag_pre |= MatchFile.Groups["pre"].Value == "PRE";
                             currenttrack.flag_scms |= MatchFile.Groups["scms"].Value == "SCMS";
                         }
-                        else if (MatchGenre.Success)
+                        else if(MatchGenre.Success)
                         {
                             DicConsole.DebugWriteLine("CDRWin plugin", "Found GENRE at line {0}", line);
-                            if (intrack)
+                            if(intrack)
                                 currenttrack.genre = MatchGenre.Groups[1].Value;
                             else
                                 discimage.genre = MatchGenre.Groups[1].Value;
                         }
-                        else if (MatchIndex.Success)
+                        else if(MatchIndex.Success)
                         {
                             DicConsole.DebugWriteLine("CDRWin plugin", "Found INDEX at line {0}", line);
-                            if (!intrack)
+                            if(!intrack)
                                 throw new FeatureUnsupportedImageException(String.Format("Found INDEX before a track {0}", line));
                             else
                             {
                                 int index = int.Parse(MatchIndex.Groups[1].Value);
                                 ulong offset = CDRWinMSFToLBA(MatchIndex.Groups[2].Value);
 
-                                if ((index != 0 && index != 1) && currenttrack.indexes.Count == 0)
+                                if((index != 0 && index != 1) && currenttrack.indexes.Count == 0)
                                     throw new FeatureUnsupportedImageException(String.Format("Found INDEX {0} before INDEX 00 or INDEX 01", index));
 
-                                if ((index == 0 || (index == 1 && !currenttrack.indexes.ContainsKey(0))))
+                                if((index == 0 || (index == 1 && !currenttrack.indexes.ContainsKey(0))))
                                 {
-                                    if ((int)(currenttrack.sequence - 2) >= 0 && offset > 1)
+                                    if((int)(currenttrack.sequence - 2) >= 0 && offset > 1)
                                     {
                                         cuetracks[currenttrack.sequence - 2].sectors = offset - currentfileoffsetsector;
                                         currentfile.offset += cuetracks[currenttrack.sequence - 2].sectors * cuetracks[currenttrack.sequence - 2].bps;
@@ -720,83 +720,83 @@ namespace DiscImageChef.ImagePlugins
                                     }
                                 }
 
-                                if ((index == 0 || (index == 1 && !currenttrack.indexes.ContainsKey(0))) && currenttrack.sequence == 1)
+                                if((index == 0 || (index == 1 && !currenttrack.indexes.ContainsKey(0))) && currenttrack.sequence == 1)
                                 {
                                     DicConsole.DebugWriteLine("CDRWin plugin", "Sets currentfile.offset to {0} at line 559", offset * currenttrack.bps);
                                     currentfile.offset = offset * currenttrack.bps;
                                 }
-                                    
+
                                 currentfileoffsetsector = offset;
                                 currenttrack.indexes.Add(index, offset);
                             }
                         }
-                        else if (MatchISRC.Success)
+                        else if(MatchISRC.Success)
                         {
                             DicConsole.DebugWriteLine("CDRWin plugin", "Found ISRC at line {0}", line);
-                            if (!intrack)
+                            if(!intrack)
                                 throw new FeatureUnsupportedImageException(String.Format("Found ISRC before a track {0}", line));
                             currenttrack.isrc = MatchISRC.Groups[1].Value;
                         }
-                        else if (MatchMCN.Success)
+                        else if(MatchMCN.Success)
                         {
                             DicConsole.DebugWriteLine("CDRWin plugin", "Found CATALOG at line {0}", line);
-                            if (!intrack)
+                            if(!intrack)
                                 discimage.mcn = MatchMCN.Groups[1].Value;
                             else
                                 throw new FeatureUnsupportedImageException(String.Format("Found CATALOG field in incorrect place at line {0}", line));
                         }
-                        else if (MatchPerformer.Success)
+                        else if(MatchPerformer.Success)
                         {
                             DicConsole.DebugWriteLine("CDRWin plugin", "Found PERFORMER at line {0}", line);
-                            if (intrack)
+                            if(intrack)
                                 currenttrack.performer = MatchPerformer.Groups[1].Value;
                             else
                                 discimage.performer = MatchPerformer.Groups[1].Value;
                         }
-                        else if (MatchPostgap.Success)
+                        else if(MatchPostgap.Success)
                         {
                             DicConsole.DebugWriteLine("CDRWin plugin", "Found POSTGAP at line {0}", line);
-                            if (intrack)
+                            if(intrack)
                             {
                                 currenttrack.postgap = CDRWinMSFToLBA(MatchPostgap.Groups[1].Value);
                             }
                             else
                                 throw new FeatureUnsupportedImageException(String.Format("Found POSTGAP field before a track at line {0}", line));
                         }
-                        else if (MatchPregap.Success)
+                        else if(MatchPregap.Success)
                         {
                             DicConsole.DebugWriteLine("CDRWin plugin", "Found PREGAP at line {0}", line);
-                            if (intrack)
+                            if(intrack)
                             {
                                 currenttrack.pregap = CDRWinMSFToLBA(MatchPregap.Groups[1].Value);
                             }
                             else
                                 throw new FeatureUnsupportedImageException(String.Format("Found PREGAP field before a track at line {0}", line));
                         }
-                        else if (MatchSongWriter.Success)
+                        else if(MatchSongWriter.Success)
                         {
                             DicConsole.DebugWriteLine("CDRWin plugin", "Found SONGWRITER at line {0}", line);
-                            if (intrack)
+                            if(intrack)
                                 currenttrack.songwriter = MatchSongWriter.Groups[1].Value;
                             else
                                 discimage.songwriter = MatchSongWriter.Groups[1].Value;
                         }
-                        else if (MatchTitle.Success)
+                        else if(MatchTitle.Success)
                         {
                             DicConsole.DebugWriteLine("CDRWin plugin", "Found TITLE at line {0}", line);
-                            if (intrack)
+                            if(intrack)
                                 currenttrack.title = MatchTitle.Groups[1].Value;
                             else
                                 discimage.title = MatchTitle.Groups[1].Value;
                         }
-                        else if (MatchTrack.Success)
+                        else if(MatchTrack.Success)
                         {
                             DicConsole.DebugWriteLine("CDRWin plugin", "Found TRACK at line {0}", line);
-                            if (currentfile.datafile == "")
+                            if(currentfile.datafile == "")
                                 throw new FeatureUnsupportedImageException(String.Format("Found TRACK field before a file is defined at line {0}", line));
-                            if (intrack)
+                            if(intrack)
                             {
-                                if (currenttrack.indexes.ContainsKey(0) && currenttrack.pregap == 0)
+                                if(currenttrack.indexes.ContainsKey(0) && currenttrack.pregap == 0)
                                 {
                                     currenttrack.indexes.TryGetValue(0, out currenttrack.pregap);
                                 }
@@ -814,7 +814,7 @@ namespace DiscImageChef.ImagePlugins
                             currenttrack.session = currentsession;
                             intrack = true;
                         }
-                        else if (_line == "") // Empty line, ignore it
+                        else if(_line == "") // Empty line, ignore it
                         {
 
                         }
@@ -825,7 +825,7 @@ namespace DiscImageChef.ImagePlugins
                     }
                 }
 
-                if (currenttrack.sequence != 0)
+                if(currenttrack.sequence != 0)
                 {
                     currentfile.sequence = currenttrack.sequence;
                     currenttrack.trackfile = currentfile;
@@ -835,11 +835,11 @@ namespace DiscImageChef.ImagePlugins
                 }
 
                 Session[] _sessions = new Session[currentsession];
-                for (int s = 1; s <= _sessions.Length; s++)
+                for(int s = 1; s <= _sessions.Length; s++)
                 {
                     _sessions[s - 1].SessionSequence = 1;
 
-                    if (s > 1)
+                    if(s > 1)
                         _sessions[s - 1].StartSector = _sessions[s - 2].EndSector + 1;
                     else
                         _sessions[s - 1].StartSector = 0;
@@ -847,12 +847,12 @@ namespace DiscImageChef.ImagePlugins
                     ulong session_sectors = 0;
                     int last_session_track = 0;
 
-                    for (int i = 0; i < cuetracks.Length; i++)
+                    for(int i = 0; i < cuetracks.Length; i++)
                     {
-                        if (cuetracks[i].session == s)
+                        if(cuetracks[i].session == s)
                         {
                             session_sectors += cuetracks[i].sectors;
-                            if (i > last_session_track)
+                            if(i > last_session_track)
                                 last_session_track = i;
                         }
                     }
@@ -861,15 +861,15 @@ namespace DiscImageChef.ImagePlugins
                     _sessions[s - 1].EndSector = session_sectors - 1;
                 }
 
-                for (int s = 1; s <= _sessions.Length; s++)
+                for(int s = 1; s <= _sessions.Length; s++)
                     discimage.sessions.Add(_sessions[s - 1]);
 
-                for (int t = 1; t <= cuetracks.Length; t++)
+                for(int t = 1; t <= cuetracks.Length; t++)
                     discimage.tracks.Add(cuetracks[t - 1]);
 
                 discimage.disktype = CDRWinIsoBusterDiscTypeToMediaType(discimage.disktypestr);
 
-                if (discimage.disktype == MediaType.Unknown || discimage.disktype == MediaType.CD)
+                if(discimage.disktype == MediaType.Unknown || discimage.disktype == MediaType.CD)
                 {
                     bool data = false;
                     bool cdg = false;
@@ -879,7 +879,7 @@ namespace DiscImageChef.ImagePlugins
                     bool firstdata = false;
                     bool audio = false;
 
-                    for (int i = 0; i < discimage.tracks.Count; i++)
+                    for(int i = 0; i < discimage.tracks.Count; i++)
                     {
                         // First track is audio
                         firstaudio |= i == 0 && discimage.tracks[i].tracktype == CDRWinTrackTypeAudio;
@@ -893,7 +893,7 @@ namespace DiscImageChef.ImagePlugins
                         // Any non first track is audio
                         audio |= i != 0 && discimage.tracks[i].tracktype == CDRWinTrackTypeAudio;
 
-                        switch (discimage.tracks[i].tracktype)
+                        switch(discimage.tracks[i].tracktype)
                         {
                             case CDRWinTrackTypeCDG:
                                 cdg = true;
@@ -911,17 +911,17 @@ namespace DiscImageChef.ImagePlugins
                         }
                     }
 
-                    if (!data && !firstdata)
+                    if(!data && !firstdata)
                         discimage.disktype = MediaType.CDDA;
-                    else if (cdg)
+                    else if(cdg)
                         discimage.disktype = MediaType.CDG;
-                    else if (cdi)
+                    else if(cdi)
                         discimage.disktype = MediaType.CDI;
-                    else if (firstaudio && data && discimage.sessions.Count > 1 && mode2)
+                    else if(firstaudio && data && discimage.sessions.Count > 1 && mode2)
                         discimage.disktype = MediaType.CDPLUS;
-                    else if ((firstdata && audio) || mode2)
+                    else if((firstdata && audio) || mode2)
                         discimage.disktype = MediaType.CDROMXA;
-                    else if (!audio)
+                    else if(!audio)
                         discimage.disktype = MediaType.CDROM;
                     else
                         discimage.disktype = MediaType.CD;
@@ -930,59 +930,59 @@ namespace DiscImageChef.ImagePlugins
                 // DEBUG information
                 DicConsole.DebugWriteLine("CDRWin plugin", "Disc image parsing results");
                 DicConsole.DebugWriteLine("CDRWin plugin", "Disc CD-TEXT:");
-                if (discimage.arranger == null)
+                if(discimage.arranger == null)
                     DicConsole.DebugWriteLine("CDRWin plugin", "\tArranger is not set.");
                 else
                     DicConsole.DebugWriteLine("CDRWin plugin", "\tArranger: {0}", discimage.arranger);
-                if (discimage.composer == null)
+                if(discimage.composer == null)
                     DicConsole.DebugWriteLine("CDRWin plugin", "\tComposer is not set.");
                 else
                     DicConsole.DebugWriteLine("CDRWin plugin", "\tComposer: {0}", discimage.composer);
-                if (discimage.genre == null)
+                if(discimage.genre == null)
                     DicConsole.DebugWriteLine("CDRWin plugin", "\tGenre is not set.");
                 else
                     DicConsole.DebugWriteLine("CDRWin plugin", "\tGenre: {0}", discimage.genre);
-                if (discimage.performer == null)
+                if(discimage.performer == null)
                     DicConsole.DebugWriteLine("CDRWin plugin", "\tPerformer is not set.");
                 else
                     DicConsole.DebugWriteLine("CDRWin plugin", "\tPerformer: {0}", discimage.performer);
-                if (discimage.songwriter == null)
+                if(discimage.songwriter == null)
                     DicConsole.DebugWriteLine("CDRWin plugin", "\tSongwriter is not set.");
                 else
                     DicConsole.DebugWriteLine("CDRWin plugin", "\tSongwriter: {0}", discimage.songwriter);
-                if (discimage.title == null)
+                if(discimage.title == null)
                     DicConsole.DebugWriteLine("CDRWin plugin", "\tTitle is not set.");
                 else
                     DicConsole.DebugWriteLine("CDRWin plugin", "\tTitle: {0}", discimage.title);
-                if (discimage.cdtextfile == null)
+                if(discimage.cdtextfile == null)
                     DicConsole.DebugWriteLine("CDRWin plugin", "\tCD-TEXT binary file not set.");
                 else
                     DicConsole.DebugWriteLine("CDRWin plugin", "\tCD-TEXT binary file: {0}", discimage.cdtextfile);
                 DicConsole.DebugWriteLine("CDRWin plugin", "Disc information:");
-                if (discimage.disktypestr == null)
+                if(discimage.disktypestr == null)
                     DicConsole.DebugWriteLine("CDRWin plugin", "\tISOBuster disc type not set.");
                 else
                     DicConsole.DebugWriteLine("CDRWin plugin", "\tISOBuster disc type: {0}", discimage.disktypestr);
                 DicConsole.DebugWriteLine("CDRWin plugin", "\tGuessed disk type: {0}", discimage.disktype);
-                if (discimage.barcode == null)
+                if(discimage.barcode == null)
                     DicConsole.DebugWriteLine("CDRWin plugin", "\tBarcode not set.");
                 else
                     DicConsole.DebugWriteLine("CDRWin plugin", "\tBarcode: {0}", discimage.barcode);
-                if (discimage.disk_id == null)
+                if(discimage.disk_id == null)
                     DicConsole.DebugWriteLine("CDRWin plugin", "\tDisc ID not set.");
                 else
                     DicConsole.DebugWriteLine("CDRWin plugin", "\tDisc ID: {0}", discimage.disk_id);
-                if (discimage.mcn == null)
+                if(discimage.mcn == null)
                     DicConsole.DebugWriteLine("CDRWin plugin", "\tMCN not set.");
                 else
                     DicConsole.DebugWriteLine("CDRWin plugin", "\tMCN: {0}", discimage.mcn);
-                if (discimage.comment == null)
+                if(discimage.comment == null)
                     DicConsole.DebugWriteLine("CDRWin plugin", "\tComment not set.");
                 else
                     DicConsole.DebugWriteLine("CDRWin plugin", "\tComment: \"{0}\"", discimage.comment);
                 DicConsole.DebugWriteLine("CDRWin plugin", "Session information:");
                 DicConsole.DebugWriteLine("CDRWin plugin", "\tDisc contains {0} sessions", discimage.sessions.Count);
-                for (int i = 0; i < discimage.sessions.Count; i++)
+                for(int i = 0; i < discimage.sessions.Count; i++)
                 {
                     DicConsole.DebugWriteLine("CDRWin plugin", "\tSession {0} information:", i + 1);
                     DicConsole.DebugWriteLine("CDRWin plugin", "\t\tStarting track: {0}", discimage.sessions[i].StartTrack);
@@ -992,7 +992,7 @@ namespace DiscImageChef.ImagePlugins
                 }
                 DicConsole.DebugWriteLine("CDRWin plugin", "Track information:");
                 DicConsole.DebugWriteLine("CDRWin plugin", "\tDisc contains {0} tracks", discimage.tracks.Count);
-                for (int i = 0; i < discimage.tracks.Count; i++)
+                for(int i = 0; i < discimage.tracks.Count; i++)
                 {
                     DicConsole.DebugWriteLine("CDRWin plugin", "\tTrack {0} information:", discimage.tracks[i].sequence);
 
@@ -1001,48 +1001,48 @@ namespace DiscImageChef.ImagePlugins
                     DicConsole.DebugWriteLine("CDRWin plugin", "\t\tData: {0} sectors", discimage.tracks[i].sectors);
                     DicConsole.DebugWriteLine("CDRWin plugin", "\t\tPostgap: {0} sectors", discimage.tracks[i].postgap);
 
-                    if (discimage.tracks[i].flag_4ch)
+                    if(discimage.tracks[i].flag_4ch)
                         DicConsole.DebugWriteLine("CDRWin plugin", "\t\tTrack is flagged as quadraphonic");
-                    if (discimage.tracks[i].flag_dcp)
+                    if(discimage.tracks[i].flag_dcp)
                         DicConsole.DebugWriteLine("CDRWin plugin", "\t\tTrack allows digital copy");
-                    if (discimage.tracks[i].flag_pre)
+                    if(discimage.tracks[i].flag_pre)
                         DicConsole.DebugWriteLine("CDRWin plugin", "\t\tTrack has pre-emphasis applied");
-                    if (discimage.tracks[i].flag_scms)
+                    if(discimage.tracks[i].flag_scms)
                         DicConsole.DebugWriteLine("CDRWin plugin", "\t\tTrack has SCMS");
 
                     DicConsole.DebugWriteLine("CDRWin plugin", "\t\tTrack resides in file {0}, type defined as {1}, starting at byte {2}",
                         discimage.tracks[i].trackfile.datafile, discimage.tracks[i].trackfile.filetype, discimage.tracks[i].trackfile.offset);
 
                     DicConsole.DebugWriteLine("CDRWin plugin", "\t\tIndexes:");
-                    foreach (KeyValuePair kvp in discimage.tracks[i].indexes)
+                    foreach(KeyValuePair kvp in discimage.tracks[i].indexes)
                         DicConsole.DebugWriteLine("CDRWin plugin", "\t\t\tIndex {0} starts at sector {1}", kvp.Key, kvp.Value);
 
-                    if (discimage.tracks[i].isrc == null)
+                    if(discimage.tracks[i].isrc == null)
                         DicConsole.DebugWriteLine("CDRWin plugin", "\t\tISRC is not set.");
                     else
                         DicConsole.DebugWriteLine("CDRWin plugin", "\t\tISRC: {0}", discimage.tracks[i].isrc);
 
-                    if (discimage.tracks[i].arranger == null)
+                    if(discimage.tracks[i].arranger == null)
                         DicConsole.DebugWriteLine("CDRWin plugin", "\t\tArranger is not set.");
                     else
                         DicConsole.DebugWriteLine("CDRWin plugin", "\t\tArranger: {0}", discimage.tracks[i].arranger);
-                    if (discimage.tracks[i].composer == null)
+                    if(discimage.tracks[i].composer == null)
                         DicConsole.DebugWriteLine("CDRWin plugin", "\t\tComposer is not set.");
                     else
                         DicConsole.DebugWriteLine("CDRWin plugin", "\t\tComposer: {0}", discimage.tracks[i].composer);
-                    if (discimage.tracks[i].genre == null)
+                    if(discimage.tracks[i].genre == null)
                         DicConsole.DebugWriteLine("CDRWin plugin", "\t\tGenre is not set.");
                     else
                         DicConsole.DebugWriteLine("CDRWin plugin", "\t\tGenre: {0}", discimage.tracks[i].genre);
-                    if (discimage.tracks[i].performer == null)
+                    if(discimage.tracks[i].performer == null)
                         DicConsole.DebugWriteLine("CDRWin plugin", "\t\tPerformer is not set.");
                     else
                         DicConsole.DebugWriteLine("CDRWin plugin", "\t\tPerformer: {0}", discimage.tracks[i].performer);
-                    if (discimage.tracks[i].songwriter == null)
+                    if(discimage.tracks[i].songwriter == null)
                         DicConsole.DebugWriteLine("CDRWin plugin", "\t\tSongwriter is not set.");
                     else
                         DicConsole.DebugWriteLine("CDRWin plugin", "\t\tSongwriter: {0}", discimage.tracks[i].songwriter);
-                    if (discimage.tracks[i].title == null)
+                    if(discimage.tracks[i].title == null)
                         DicConsole.DebugWriteLine("CDRWin plugin", "\t\tTitle is not set.");
                     else
                         DicConsole.DebugWriteLine("CDRWin plugin", "\t\tTitle: {0}", discimage.tracks[i].title);
@@ -1061,16 +1061,16 @@ namespace DiscImageChef.ImagePlugins
 
                 offsetmap = new Dictionary();
 
-                for (int i = 0; i < discimage.tracks.Count; i++)
+                for(int i = 0; i < discimage.tracks.Count; i++)
                 {
                     ulong index0_len = 0;
 
-                    if (discimage.tracks[i].sequence == 1 && i != 0)
+                    if(discimage.tracks[i].sequence == 1 && i != 0)
                         throw new ImageNotSupportedException("Unordered tracks");
 
                     CommonTypes.Partition partition = new CommonTypes.Partition();
 
-                    if (discimage.tracks[i].pregap > 0)
+                    if(discimage.tracks[i].pregap > 0)
                     {
                         partition.PartitionDescription = String.Format("Track {0} pregap.", discimage.tracks[i].sequence);
                         partition.PartitionName = discimage.tracks[i].title;
@@ -1085,14 +1085,14 @@ namespace DiscImageChef.ImagePlugins
                         byte_offset += partition.PartitionLength;
                         partitionSequence++;
 
-                        if (!offsetmap.ContainsKey(discimage.tracks[i].sequence))
+                        if(!offsetmap.ContainsKey(discimage.tracks[i].sequence))
                             offsetmap.Add(discimage.tracks[i].sequence, partition.PartitionStartSector);
                         else
                         {
                             ulong old_start;
                             offsetmap.TryGetValue(discimage.tracks[i].sequence, out old_start);
 
-                            if (partition.PartitionStartSector < old_start)
+                            if(partition.PartitionStartSector < old_start)
                             {
                                 offsetmap.Remove(discimage.tracks[i].sequence);
                                 offsetmap.Add(discimage.tracks[i].sequence, partition.PartitionStartSector);
@@ -1105,10 +1105,10 @@ namespace DiscImageChef.ImagePlugins
 
                     index_zero |= discimage.tracks[i].indexes.TryGetValue(0, out index_zero_offset);
 
-                    if (!discimage.tracks[i].indexes.TryGetValue(1, out index_one_offset))
+                    if(!discimage.tracks[i].indexes.TryGetValue(1, out index_one_offset))
                         throw new ImageNotSupportedException(String.Format("Track {0} lacks index 01", discimage.tracks[i].sequence));
 
-                    if (index_zero && index_one_offset > index_zero_offset)
+                    if(index_zero && index_one_offset > index_zero_offset)
                     {
                         partition.PartitionDescription = String.Format("Track {0} index 00.", discimage.tracks[i].sequence);
                         partition.PartitionName = discimage.tracks[i].title;
@@ -1124,14 +1124,14 @@ namespace DiscImageChef.ImagePlugins
                         index0_len = partition.PartitionSectors;
                         partitionSequence++;
 
-                        if (!offsetmap.ContainsKey(discimage.tracks[i].sequence))
+                        if(!offsetmap.ContainsKey(discimage.tracks[i].sequence))
                             offsetmap.Add(discimage.tracks[i].sequence, partition.PartitionStartSector);
                         else
                         {
                             ulong old_start;
                             offsetmap.TryGetValue(discimage.tracks[i].sequence, out old_start);
 
-                            if (partition.PartitionStartSector < old_start)
+                            if(partition.PartitionStartSector < old_start)
                             {
                                 offsetmap.Remove(discimage.tracks[i].sequence);
                                 offsetmap.Add(discimage.tracks[i].sequence, partition.PartitionStartSector);
@@ -1156,14 +1156,14 @@ namespace DiscImageChef.ImagePlugins
                     byte_offset += partition.PartitionLength;
                     partitionSequence++;
 
-                    if (!offsetmap.ContainsKey(discimage.tracks[i].sequence))
+                    if(!offsetmap.ContainsKey(discimage.tracks[i].sequence))
                         offsetmap.Add(discimage.tracks[i].sequence, partition.PartitionStartSector);
                     else
                     {
                         ulong old_start;
                         offsetmap.TryGetValue(discimage.tracks[i].sequence, out old_start);
 
-                        if (partition.PartitionStartSector < old_start)
+                        if(partition.PartitionStartSector < old_start)
                         {
                             offsetmap.Remove(discimage.tracks[i].sequence);
                             offsetmap.Add(discimage.tracks[i].sequence, partition.PartitionStartSector);
@@ -1176,7 +1176,7 @@ namespace DiscImageChef.ImagePlugins
 
                 // Print offset map
                 DicConsole.DebugWriteLine("CDRWin plugin", "printing partition map");
-                foreach (CommonTypes.Partition partition in partitions)
+                foreach(CommonTypes.Partition partition in partitions)
                 {
                     DicConsole.DebugWriteLine("CDRWin plugin", "Partition sequence: {0}", partition.PartitionSequence);
                     DicConsole.DebugWriteLine("CDRWin plugin", "\tPartition name: {0}", partition.PartitionName);
@@ -1188,25 +1188,25 @@ namespace DiscImageChef.ImagePlugins
                     DicConsole.DebugWriteLine("CDRWin plugin", "\tPartition size in bytes: {0}", partition.PartitionLength);
                 }
 
-                foreach (CDRWinTrack track in discimage.tracks)
+                foreach(CDRWinTrack track in discimage.tracks)
                     ImageInfo.imageSize += track.bps * track.sectors;
-                foreach (CDRWinTrack track in discimage.tracks)
+                foreach(CDRWinTrack track in discimage.tracks)
                     ImageInfo.sectors += track.sectors;
 
-                if (discimage.disktype == MediaType.CDG || discimage.disktype == MediaType.CDEG || discimage.disktype == MediaType.CDMIDI)
+                if(discimage.disktype == MediaType.CDG || discimage.disktype == MediaType.CDEG || discimage.disktype == MediaType.CDMIDI)
                     ImageInfo.sectorSize = 2448; // CD+G subchannels ARE user data, as CD+G are useless without them
-                else if (discimage.disktype != MediaType.CDROMXA && discimage.disktype != MediaType.CDDA && discimage.disktype != MediaType.CDI && discimage.disktype != MediaType.CDPLUS)
+                else if(discimage.disktype != MediaType.CDROMXA && discimage.disktype != MediaType.CDDA && discimage.disktype != MediaType.CDI && discimage.disktype != MediaType.CDPLUS)
                     ImageInfo.sectorSize = 2048; // Only data tracks
                 else
                     ImageInfo.sectorSize = 2352; // All others
 
-                if (discimage.mcn != null)
+                if(discimage.mcn != null)
                     ImageInfo.readableMediaTags.Add(MediaTagType.CD_MCN);
-                if (discimage.cdtextfile != null)
+                if(discimage.cdtextfile != null)
                     ImageInfo.readableMediaTags.Add(MediaTagType.CD_TEXT);
 
                 // Detect ISOBuster extensions
-                if (discimage.disktypestr != null || discimage.comment.ToLower().Contains("isobuster") || discimage.sessions.Count > 1)
+                if(discimage.disktypestr != null || discimage.comment.ToLower().Contains("isobuster") || discimage.sessions.Count > 1)
                     ImageInfo.imageApplication = "ISOBuster";
                 else
                     ImageInfo.imageApplication = "CDRWin";
@@ -1223,61 +1223,61 @@ namespace DiscImageChef.ImagePlugins
 
                 ImageInfo.readableSectorTags.Add(SectorTagType.CDTrackFlags);
 
-                foreach (CDRWinTrack track in discimage.tracks)
+                foreach(CDRWinTrack track in discimage.tracks)
                 {
-                    switch (track.tracktype)
+                    switch(track.tracktype)
                     {
                         case CDRWinTrackTypeAudio:
                             {
-                                if (!ImageInfo.readableSectorTags.Contains(SectorTagType.CDTrackISRC))
+                                if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDTrackISRC))
                                     ImageInfo.readableSectorTags.Add(SectorTagType.CDTrackISRC);
                                 break;
                             }
                         case CDRWinTrackTypeCDG:
                             {
-                                if (!ImageInfo.readableSectorTags.Contains(SectorTagType.CDTrackISRC))
+                                if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDTrackISRC))
                                     ImageInfo.readableSectorTags.Add(SectorTagType.CDTrackISRC);
-                                if (!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubchannel))
+                                if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubchannel))
                                     ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubchannel);
                                 break;
                             }
                         case CDRWinTrackTypeMode2Formless:
                         case CDRWinTrackTypeCDI:
                             {
-                                if (!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubHeader))
+                                if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubHeader))
                                     ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubHeader);
-                                if (!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC))
+                                if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC))
                                     ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC);
                                 break;
                             }
                         case CDRWinTrackTypeMode2Raw:
                         case CDRWinTrackTypeCDIRaw:
                             {
-                                if (!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync))
+                                if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync))
                                     ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync);
-                                if (!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader))
+                                if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader))
                                     ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader);
-                                if (!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubHeader))
+                                if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubHeader))
                                     ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubHeader);
-                                if (!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC))
+                                if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC))
                                     ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC);
                                 break;
                             }
                         case CDRWinTrackTypeMode1Raw:
                             {
-                                if (!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync))
+                                if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync))
                                     ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync);
-                                if (!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader))
+                                if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader))
                                     ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader);
-                                if (!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubHeader))
+                                if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubHeader))
                                     ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubHeader);
-                                if (!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC))
+                                if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC))
                                     ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC);
-                                if (!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_P))
+                                if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_P))
                                     ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_P);
-                                if (!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_Q))
+                                if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_Q))
                                     ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_Q);
-                                if (!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC))
+                                if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC))
                                     ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC);
                                 break;
                             }
@@ -1288,7 +1288,7 @@ namespace DiscImageChef.ImagePlugins
 
                 return true;
             }
-            catch (Exception ex)
+            catch(Exception ex)
             {
                 DicConsole.ErrorWriteLine("Exception trying to identify image file {0}", imagePath);
                 DicConsole.ErrorWriteLine("Exception: {0}", ex.Message);
@@ -1319,11 +1319,11 @@ namespace DiscImageChef.ImagePlugins
 
         public override byte[] ReadDiskTag(MediaTagType tag)
         {
-            switch (tag)
+            switch(tag)
             {
                 case MediaTagType.CD_MCN:
                     {
-                        if (discimage.mcn != null)
+                        if(discimage.mcn != null)
                         {
                             return Encoding.ASCII.GetBytes(discimage.mcn);
                         }
@@ -1331,7 +1331,7 @@ namespace DiscImageChef.ImagePlugins
                     }
                 case MediaTagType.CD_TEXT:
                     {
-                        if (discimage.cdtextfile != null)
+                        if(discimage.cdtextfile != null)
                             // TODO: Check that binary text file exists, open it, read it, send it to caller.
                             throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
                         throw new FeatureNotPresentImageException("Image does not contain CD-TEXT information.");
@@ -1363,15 +1363,15 @@ namespace DiscImageChef.ImagePlugins
 
         public override byte[] ReadSectors(UInt64 sectorAddress, UInt32 length)
         {
-            foreach (KeyValuePair kvp in offsetmap)
+            foreach(KeyValuePair kvp in offsetmap)
             {
-                if (sectorAddress >= kvp.Value)
+                if(sectorAddress >= kvp.Value)
                 {
-                    foreach (CDRWinTrack cdrwin_track in discimage.tracks)
+                    foreach(CDRWinTrack cdrwin_track in discimage.tracks)
                     {
-                        if (cdrwin_track.sequence == kvp.Key)
+                        if(cdrwin_track.sequence == kvp.Key)
                         {
-                            if ((sectorAddress - kvp.Value) < cdrwin_track.sectors)
+                            if((sectorAddress - kvp.Value) < cdrwin_track.sectors)
                                 return ReadSectors((sectorAddress - kvp.Value), length, kvp.Key);
                         }
                     }
@@ -1383,15 +1383,15 @@ namespace DiscImageChef.ImagePlugins
 
         public override byte[] ReadSectorsTag(UInt64 sectorAddress, UInt32 length, SectorTagType tag)
         {
-            foreach (KeyValuePair kvp in offsetmap)
+            foreach(KeyValuePair kvp in offsetmap)
             {
-                if (sectorAddress >= kvp.Value)
+                if(sectorAddress >= kvp.Value)
                 {
-                    foreach (CDRWinTrack cdrwin_track in discimage.tracks)
+                    foreach(CDRWinTrack cdrwin_track in discimage.tracks)
                     {
-                        if (cdrwin_track.sequence == kvp.Key)
+                        if(cdrwin_track.sequence == kvp.Key)
                         {
-                            if ((sectorAddress - kvp.Value) < cdrwin_track.sectors)
+                            if((sectorAddress - kvp.Value) < cdrwin_track.sectors)
                                 return ReadSectorsTag((sectorAddress - kvp.Value), length, kvp.Key, tag);
                         }
                     }
@@ -1407,26 +1407,26 @@ namespace DiscImageChef.ImagePlugins
 
             _track.sequence = 0;
 
-            foreach (CDRWinTrack cdrwin_track in discimage.tracks)
+            foreach(CDRWinTrack cdrwin_track in discimage.tracks)
             {
-                if (cdrwin_track.sequence == track)
+                if(cdrwin_track.sequence == track)
                 {
                     _track = cdrwin_track;
                     break;
                 }
             }
 
-            if (_track.sequence == 0)
+            if(_track.sequence == 0)
                 throw new ArgumentOutOfRangeException("track", "Track does not exist in disc image");
 
-            if (length > _track.sectors)
+            if(length > _track.sectors)
                 throw new ArgumentOutOfRangeException("length", "Requested more sectors than present in track, won't cross tracks");
 
             uint sector_offset;
             uint sector_size;
             uint sector_skip;
 
-            switch (_track.tracktype)
+            switch(_track.tracktype)
             {
                 case CDRWinTrackTypeMode1:
                 case CDRWinTrackTypeMode2Form1:
@@ -1493,14 +1493,14 @@ namespace DiscImageChef.ImagePlugins
             byte[] buffer = new byte[sector_size * length];
 
             imageStream = new FileStream(_track.trackfile.datafile, FileMode.Open, FileAccess.Read);
-            using (BinaryReader br = new BinaryReader(imageStream))
+            using(BinaryReader br = new BinaryReader(imageStream))
             {
                 br.BaseStream.Seek((long)_track.trackfile.offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), SeekOrigin.Begin);
-                if (sector_offset == 0 && sector_skip == 0)
+                if(sector_offset == 0 && sector_skip == 0)
                     buffer = br.ReadBytes((int)(sector_size * length));
                 else
                 {
-                    for (int i = 0; i < length; i++)
+                    for(int i = 0; i < length; i++)
                     {
                         byte[] sector;
                         br.BaseStream.Seek(sector_offset, SeekOrigin.Current);
@@ -1522,26 +1522,26 @@ namespace DiscImageChef.ImagePlugins
 
             _track.sequence = 0;
 
-            foreach (CDRWinTrack cdrwin_track in discimage.tracks)
+            foreach(CDRWinTrack cdrwin_track in discimage.tracks)
             {
-                if (cdrwin_track.sequence == track)
+                if(cdrwin_track.sequence == track)
                 {
                     _track = cdrwin_track;
                     break;
                 }
             }
 
-            if (_track.sequence == 0)
+            if(_track.sequence == 0)
                 throw new ArgumentOutOfRangeException("track", "Track does not exist in disc image");
 
-            if (length > _track.sectors)
+            if(length > _track.sectors)
                 throw new ArgumentOutOfRangeException("length", "Requested more sectors than present in track, won't cross tracks");
 
             uint sector_offset;
             uint sector_size;
             uint sector_skip;
 
-            switch (tag)
+            switch(tag)
             {
                 case SectorTagType.CDSectorECC:
                 case SectorTagType.CDSectorECC_P:
@@ -1556,16 +1556,16 @@ namespace DiscImageChef.ImagePlugins
                     {
                         byte[] flags = new byte[1];
 
-                        if (_track.tracktype != CDRWinTrackTypeAudio && _track.tracktype != CDRWinTrackTypeCDG)
+                        if(_track.tracktype != CDRWinTrackTypeAudio && _track.tracktype != CDRWinTrackTypeCDG)
                             flags[0] += 0x40;
 
-                        if (_track.flag_dcp)
+                        if(_track.flag_dcp)
                             flags[0] += 0x20;
 
-                        if (_track.flag_pre)
+                        if(_track.flag_pre)
                             flags[0] += 0x10;
 
-                        if (_track.flag_4ch)
+                        if(_track.flag_4ch)
                             flags[0] += 0x80;
 
                         return flags;
@@ -1578,7 +1578,7 @@ namespace DiscImageChef.ImagePlugins
                     throw new ArgumentException("Unsupported tag requested", "tag");
             }
 
-            switch (_track.tracktype)
+            switch(_track.tracktype)
             {
                 case CDRWinTrackTypeMode1:
                 case CDRWinTrackTypeMode2Form1:
@@ -1587,7 +1587,7 @@ namespace DiscImageChef.ImagePlugins
                 case CDRWinTrackTypeMode2Formless:
                 case CDRWinTrackTypeCDI:
                     {
-                        switch (tag)
+                        switch(tag)
                         {
                             case SectorTagType.CDSectorSync:
                             case SectorTagType.CDSectorHeader:
@@ -1619,7 +1619,7 @@ namespace DiscImageChef.ImagePlugins
                     throw new ArgumentException("There are no tags on audio tracks", "tag");
                 case CDRWinTrackTypeMode1Raw:
                     {
-                        switch (tag)
+                        switch(tag)
                         {
                             case SectorTagType.CDSectorSync:
                                 {
@@ -1676,7 +1676,7 @@ namespace DiscImageChef.ImagePlugins
                     throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
                 case CDRWinTrackTypeCDG:
                     {
-                        if (tag != SectorTagType.CDSectorSubchannel)
+                        if(tag != SectorTagType.CDSectorSubchannel)
                             throw new ArgumentException("Unsupported tag requested for this track", "tag");
 
                         sector_offset = 2352;
@@ -1691,14 +1691,14 @@ namespace DiscImageChef.ImagePlugins
             byte[] buffer = new byte[sector_size * length];
 
             imageStream = new FileStream(_track.trackfile.datafile, FileMode.Open, FileAccess.Read);
-            using (BinaryReader br = new BinaryReader(imageStream))
+            using(BinaryReader br = new BinaryReader(imageStream))
             {
                 br.BaseStream.Seek((long)_track.trackfile.offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), SeekOrigin.Begin);
-                if (sector_offset == 0 && sector_skip == 0)
+                if(sector_offset == 0 && sector_skip == 0)
                     buffer = br.ReadBytes((int)(sector_size * length));
                 else
                 {
-                    for (int i = 0; i < length; i++)
+                    for(int i = 0; i < length; i++)
                     {
                         byte[] sector;
                         br.BaseStream.Seek(sector_offset, SeekOrigin.Current);
@@ -1726,15 +1726,15 @@ namespace DiscImageChef.ImagePlugins
 
         public override byte[] ReadSectorsLong(UInt64 sectorAddress, UInt32 length)
         {
-            foreach (KeyValuePair kvp in offsetmap)
+            foreach(KeyValuePair kvp in offsetmap)
             {
-                if (sectorAddress >= kvp.Value)
+                if(sectorAddress >= kvp.Value)
                 {
-                    foreach (CDRWinTrack cdrwin_track in discimage.tracks)
+                    foreach(CDRWinTrack cdrwin_track in discimage.tracks)
                     {
-                        if (cdrwin_track.sequence == kvp.Key)
+                        if(cdrwin_track.sequence == kvp.Key)
                         {
-                            if ((sectorAddress - kvp.Value) < cdrwin_track.sectors)
+                            if((sectorAddress - kvp.Value) < cdrwin_track.sectors)
                                 return ReadSectorsLong((sectorAddress - kvp.Value), length, kvp.Key);
                         }
                     }
@@ -1750,26 +1750,26 @@ namespace DiscImageChef.ImagePlugins
 
             _track.sequence = 0;
 
-            foreach (CDRWinTrack cdrwin_track in discimage.tracks)
+            foreach(CDRWinTrack cdrwin_track in discimage.tracks)
             {
-                if (cdrwin_track.sequence == track)
+                if(cdrwin_track.sequence == track)
                 {
                     _track = cdrwin_track;
                     break;
                 }
             }
 
-            if (_track.sequence == 0)
+            if(_track.sequence == 0)
                 throw new ArgumentOutOfRangeException("track", "Track does not exist in disc image");
 
-            if (length > _track.sectors)
+            if(length > _track.sectors)
                 throw new ArgumentOutOfRangeException("length", "Requested more sectors than present in track, won't cross tracks");
 
             uint sector_offset;
             uint sector_size;
             uint sector_skip;
 
-            switch (_track.tracktype)
+            switch(_track.tracktype)
             {
                 case CDRWinTrackTypeMode1:
                 case CDRWinTrackTypeMode2Form1:
@@ -1822,11 +1822,11 @@ namespace DiscImageChef.ImagePlugins
 
             br.BaseStream.Seek((long)_track.trackfile.offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), SeekOrigin.Begin);
 
-            if (sector_offset == 0 && sector_skip == 0)
+            if(sector_offset == 0 && sector_skip == 0)
                 buffer = br.ReadBytes((int)(sector_size * length));
             else
             {
-                for (int i = 0; i < length; i++)
+                for(int i = 0; i < length; i++)
                 {
                     byte[] sector;
                     br.BaseStream.Seek(sector_offset, SeekOrigin.Current);
@@ -1840,22 +1840,22 @@ namespace DiscImageChef.ImagePlugins
             return buffer;
         }
 
-        public override string   GetImageFormat()
+        public override string GetImageFormat()
         {
             return "CDRWin CUESheet";
         }
 
-        public override string   GetImageVersion()
+        public override string GetImageVersion()
         {
             return ImageInfo.imageVersion;
         }
 
-        public override string   GetImageApplication()
+        public override string GetImageApplication()
         {
             return ImageInfo.imageApplication;
         }
 
-        public override string   GetImageApplicationVersion()
+        public override string GetImageApplicationVersion()
         {
             return ImageInfo.imageApplicationVersion;
         }
@@ -1870,7 +1870,7 @@ namespace DiscImageChef.ImagePlugins
             return ImageInfo.imageLastModificationTime;
         }
 
-        public override string   GetImageComments()
+        public override string GetImageComments()
         {
             return ImageInfo.imageComments;
         }
@@ -1901,13 +1901,13 @@ namespace DiscImageChef.ImagePlugins
 
             UInt64 previousStartSector = 0;
 
-            foreach (CDRWinTrack cdr_track in discimage.tracks)
+            foreach(CDRWinTrack cdr_track in discimage.tracks)
             {
                 Track _track = new Track();
 
                 _track.Indexes = cdr_track.indexes;
                 _track.TrackDescription = cdr_track.title;
-                if (!cdr_track.indexes.TryGetValue(0, out _track.TrackStartSector))
+                if(!cdr_track.indexes.TryGetValue(0, out _track.TrackStartSector))
                     cdr_track.indexes.TryGetValue(1, out _track.TrackStartSector);
                 _track.TrackStartSector = previousStartSector;
                 _track.TrackEndSector = _track.TrackStartSector + cdr_track.sectors - 1;
@@ -1920,7 +1920,7 @@ namespace DiscImageChef.ImagePlugins
                 _track.TrackFileType = cdr_track.trackfile.filetype;
                 _track.TrackRawBytesPerSector = cdr_track.bps;
                 _track.TrackBytesPerSector = CDRWinTrackTypeToCookedBytesPerSector(cdr_track.tracktype);
-                if (cdr_track.bps == 2448)
+                if(cdr_track.bps == 2448)
                 {
                     _track.TrackSubchannelFile = cdr_track.trackfile.datafile;
                     _track.TrackSubchannelOffset = cdr_track.trackfile.offset;
@@ -1938,7 +1938,7 @@ namespace DiscImageChef.ImagePlugins
 
         public override List GetSessionTracks(Session session)
         {
-            if (discimage.sessions.Contains(session))
+            if(discimage.sessions.Contains(session))
             {
                 return GetSessionTracks(session.SessionSequence);
             }
@@ -1949,15 +1949,15 @@ namespace DiscImageChef.ImagePlugins
         {
             List tracks = new List();
 
-            foreach (CDRWinTrack cdr_track in discimage.tracks)
+            foreach(CDRWinTrack cdr_track in discimage.tracks)
             {
-                if (cdr_track.session == session)
+                if(cdr_track.session == session)
                 {
                     Track _track = new Track();
 
                     _track.Indexes = cdr_track.indexes;
                     _track.TrackDescription = cdr_track.title;
-                    if (!cdr_track.indexes.TryGetValue(0, out _track.TrackStartSector))
+                    if(!cdr_track.indexes.TryGetValue(0, out _track.TrackStartSector))
                         cdr_track.indexes.TryGetValue(1, out _track.TrackStartSector);
                     _track.TrackEndSector = _track.TrackStartSector + cdr_track.sectors - 1;
                     _track.TrackPregap = cdr_track.pregap;
@@ -1969,7 +1969,7 @@ namespace DiscImageChef.ImagePlugins
                     _track.TrackFileType = cdr_track.trackfile.filetype;
                     _track.TrackRawBytesPerSector = cdr_track.bps;
                     _track.TrackBytesPerSector = CDRWinTrackTypeToCookedBytesPerSector(cdr_track.tracktype);
-                    if (cdr_track.bps == 2448)
+                    if(cdr_track.bps == 2448)
                     {
                         _track.TrackSubchannelFile = cdr_track.trackfile.datafile;
                         _track.TrackSubchannelOffset = cdr_track.trackfile.offset;
@@ -2010,12 +2010,12 @@ namespace DiscImageChef.ImagePlugins
             FailingLBAs = new List();
             UnknownLBAs = new List();
 
-            for (int i = 0; i < length; i++)
+            for(int i = 0; i < length; i++)
             {
                 Array.Copy(buffer, i * bps, sector, 0, bps);
                 bool? sectorStatus = Checksums.CDChecksums.CheckCDSector(sector);
 
-                switch (sectorStatus)
+                switch(sectorStatus)
                 {
                     case null:
                         UnknownLBAs.Add((ulong)i + sectorAddress);
@@ -2026,9 +2026,9 @@ namespace DiscImageChef.ImagePlugins
                 }
             }
 
-            if (UnknownLBAs.Count > 0)
+            if(UnknownLBAs.Count > 0)
                 return null;
-            if (FailingLBAs.Count > 0)
+            if(FailingLBAs.Count > 0)
                 return false;
             return true;
         }
@@ -2041,12 +2041,12 @@ namespace DiscImageChef.ImagePlugins
             FailingLBAs = new List();
             UnknownLBAs = new List();
 
-            for (int i = 0; i < length; i++)
+            for(int i = 0; i < length; i++)
             {
                 Array.Copy(buffer, i * bps, sector, 0, bps);
                 bool? sectorStatus = Checksums.CDChecksums.CheckCDSector(sector);
 
-                switch (sectorStatus)
+                switch(sectorStatus)
                 {
                     case null:
                         UnknownLBAs.Add((ulong)i + sectorAddress);
@@ -2057,9 +2057,9 @@ namespace DiscImageChef.ImagePlugins
                 }
             }
 
-            if (UnknownLBAs.Count > 0)
+            if(UnknownLBAs.Count > 0)
                 return null;
-            if (FailingLBAs.Count > 0)
+            if(FailingLBAs.Count > 0)
                 return false;
             return true;
         }
@@ -2090,7 +2090,7 @@ namespace DiscImageChef.ImagePlugins
 
         static UInt16 CDRWinTrackTypeToBytesPerSector(string trackType)
         {
-            switch (trackType)
+            switch(trackType)
             {
                 case CDRWinTrackTypeMode1:
                 case CDRWinTrackTypeMode2Form1:
@@ -2114,7 +2114,7 @@ namespace DiscImageChef.ImagePlugins
 
         static UInt16 CDRWinTrackTypeToCookedBytesPerSector(string trackType)
         {
-            switch (trackType)
+            switch(trackType)
             {
                 case CDRWinTrackTypeMode1:
                 case CDRWinTrackTypeMode2Form1:
@@ -2138,7 +2138,7 @@ namespace DiscImageChef.ImagePlugins
 
         static TrackType CDRWinTrackTypeToTrackType(string trackType)
         {
-            switch (trackType)
+            switch(trackType)
             {
                 case CDRWinTrackTypeMode1:
                 case CDRWinTrackTypeMode1Raw:
@@ -2162,7 +2162,7 @@ namespace DiscImageChef.ImagePlugins
 
         static MediaType CDRWinIsoBusterDiscTypeToMediaType(string discType)
         {
-            switch (discType)
+            switch(discType)
             {
                 case CDRWinDiskTypeCD:
                     return MediaType.CD;
@@ -2223,12 +2223,12 @@ namespace DiscImageChef.ImagePlugins
 
         #region Unsupported features
 
-        public override int    GetMediaSequence()
+        public override int GetMediaSequence()
         {
             return ImageInfo.mediaSequence;
         }
 
-        public override int    GetLastDiskSequence()
+        public override int GetLastDiskSequence()
         {
             return ImageInfo.lastMediaSequence;
         }
@@ -2263,12 +2263,12 @@ namespace DiscImageChef.ImagePlugins
             return ImageInfo.mediaModel;
         }
 
-        public override string   GetImageName()
+        public override string GetImageName()
         {
             return ImageInfo.imageName;
         }
 
-        public override string   GetImageCreator()
+        public override string GetImageCreator()
         {
             return ImageInfo.imageCreator;
         }
diff --git a/DiscImageChef.DiscImages/DiskCopy42.cs b/DiscImageChef.DiscImages/DiskCopy42.cs
index b9b0852c1..4a24745ee 100644
--- a/DiscImageChef.DiscImages/DiskCopy42.cs
+++ b/DiscImageChef.DiscImages/DiskCopy42.cs
@@ -164,7 +164,7 @@ namespace DiscImageChef.ImagePlugins
             stream.Close();
 
             // Incorrect pascal string length, not DC42
-            if (buffer[0] > 63)
+            if(buffer[0] > 63)
                 return false;
 
             DC42Header tmp_header = new DC42Header();
@@ -193,15 +193,15 @@ namespace DiscImageChef.ImagePlugins
             DicConsole.DebugWriteLine("DC42 plugin", "tmp_header.valid = {0}", tmp_header.valid);
             DicConsole.DebugWriteLine("DC42 plugin", "tmp_header.reserved = {0}", tmp_header.reserved);
 
-            if (tmp_header.valid != 1 || tmp_header.reserved != 0)
+            if(tmp_header.valid != 1 || tmp_header.reserved != 0)
                 return false;
 
             FileInfo fi = new FileInfo(imagePath);
 
-            if (tmp_header.dataSize + tmp_header.tagSize + 0x54 != fi.Length && tmp_header.format != kSigmaFormatTwiggy)
+            if(tmp_header.dataSize + tmp_header.tagSize + 0x54 != fi.Length && tmp_header.format != kSigmaFormatTwiggy)
                 return false;
 
-            if (tmp_header.format != kSonyFormat400K && tmp_header.format != kSonyFormat800K && tmp_header.format != kSonyFormat720K &&
+            if(tmp_header.format != kSonyFormat400K && tmp_header.format != kSonyFormat800K && tmp_header.format != kSonyFormat720K &&
                 tmp_header.format != kSonyFormat1440K && tmp_header.format != kSonyFormat1680K && tmp_header.format != kSigmaFormatTwiggy)
             {
                 DicConsole.DebugWriteLine("DC42 plugin", "Unknown tmp_header.format = 0x{0:X2} value", tmp_header.format);
@@ -209,7 +209,7 @@ namespace DiscImageChef.ImagePlugins
                 return false;
             }
 
-            if (tmp_header.fmtByte != kSonyFmtByte400K && tmp_header.fmtByte != kSonyFmtByte800K && tmp_header.fmtByte != kSonyFmtByte800KIncorrect &&
+            if(tmp_header.fmtByte != kSonyFmtByte400K && tmp_header.fmtByte != kSonyFmtByte800K && tmp_header.fmtByte != kSonyFmtByte800KIncorrect &&
                 tmp_header.fmtByte != kSonyFmtByteProDos && tmp_header.fmtByte != kInvalidFmtByte && tmp_header.fmtByte != kSigmaFmtByteTwiggy)
             {
                 DicConsole.DebugWriteLine("DC42 plugin", "Unknown tmp_header.fmtByte = 0x{0:X2} value", tmp_header.fmtByte);
@@ -217,7 +217,7 @@ namespace DiscImageChef.ImagePlugins
                 return false;
             }
 
-            if (tmp_header.fmtByte == kInvalidFmtByte)
+            if(tmp_header.fmtByte == kInvalidFmtByte)
             {
                 DicConsole.DebugWriteLine("DC42 plugin", "Image says it's unformatted");
 
@@ -239,7 +239,7 @@ namespace DiscImageChef.ImagePlugins
             stream.Close();
 
             // Incorrect pascal string length, not DC42
-            if (buffer[0] > 63)
+            if(buffer[0] > 63)
                 return false;
 
             header = new DC42Header();
@@ -266,15 +266,15 @@ namespace DiscImageChef.ImagePlugins
             DicConsole.DebugWriteLine("DC42 plugin", "header.valid = {0}", header.valid);
             DicConsole.DebugWriteLine("DC42 plugin", "header.reserved = {0}", header.reserved);
 
-            if (header.valid != 1 || header.reserved != 0)
+            if(header.valid != 1 || header.reserved != 0)
                 return false;
 
             FileInfo fi = new FileInfo(imagePath);
 
-            if (header.dataSize + header.tagSize + 0x54 != fi.Length && header.format != kSigmaFormatTwiggy)
+            if(header.dataSize + header.tagSize + 0x54 != fi.Length && header.format != kSigmaFormatTwiggy)
                 return false;
 
-            if (header.format != kSonyFormat400K && header.format != kSonyFormat800K && header.format != kSonyFormat720K &&
+            if(header.format != kSonyFormat400K && header.format != kSonyFormat800K && header.format != kSonyFormat720K &&
                 header.format != kSonyFormat1440K && header.format != kSonyFormat1680K && header.format != kSigmaFormatTwiggy)
             {
                 DicConsole.DebugWriteLine("DC42 plugin", "Unknown header.format = 0x{0:X2} value", header.format);
@@ -282,7 +282,7 @@ namespace DiscImageChef.ImagePlugins
                 return false;
             }
 
-            if (header.fmtByte != kSonyFmtByte400K && header.fmtByte != kSonyFmtByte800K && header.fmtByte != kSonyFmtByte800KIncorrect &&
+            if(header.fmtByte != kSonyFmtByte400K && header.fmtByte != kSonyFmtByte800K && header.fmtByte != kSonyFmtByte800KIncorrect &&
                 header.fmtByte != kSonyFmtByteProDos && header.fmtByte != kInvalidFmtByte && header.fmtByte != kSigmaFmtByteTwiggy)
             {
                 DicConsole.DebugWriteLine("DC42 plugin", "Unknown tmp_header.fmtByte = 0x{0:X2} value", header.fmtByte);
@@ -290,7 +290,7 @@ namespace DiscImageChef.ImagePlugins
                 return false;
             }
 
-            if (header.fmtByte == kInvalidFmtByte)
+            if(header.fmtByte == kInvalidFmtByte)
             {
                 DicConsole.DebugWriteLine("DC42 plugin", "Image says it's unformatted");
 
@@ -305,9 +305,9 @@ namespace DiscImageChef.ImagePlugins
 
             ImageInfo.sectors = header.dataSize / 512;
 
-            if (header.tagSize != 0)
+            if(header.tagSize != 0)
             {
-                if (header.tagSize / 12 != ImageInfo.sectors)
+                if(header.tagSize / 12 != ImageInfo.sectors)
                 {
                     DicConsole.DebugWriteLine("DC42 plugin", "header.tagSize / 12 != sectors");
 
@@ -322,7 +322,7 @@ namespace DiscImageChef.ImagePlugins
             ImageInfo.imageLastModificationTime = fi.LastWriteTimeUtc;
             ImageInfo.imageName = header.diskName;
 
-            switch (header.format)
+            switch(header.format)
             {
                 case kSonyFormat400K:
                     ImageInfo.mediaType = MediaType.AppleSonySS;
@@ -365,7 +365,7 @@ namespace DiscImageChef.ImagePlugins
             FailingLBAs = new List();
             UnknownLBAs = new List();
 
-            for (UInt64 i = sectorAddress; i < sectorAddress + length; i++)
+            for(UInt64 i = sectorAddress; i < sectorAddress + length; i++)
                 UnknownLBAs.Add(i);
 
             return null;
@@ -376,7 +376,7 @@ namespace DiscImageChef.ImagePlugins
             FailingLBAs = new List();
             UnknownLBAs = new List();
 
-            for (UInt64 i = sectorAddress; i < sectorAddress + length; i++)
+            for(UInt64 i = sectorAddress; i < sectorAddress + length; i++)
                 UnknownLBAs.Add(i);
 
             return null;
@@ -400,7 +400,7 @@ namespace DiscImageChef.ImagePlugins
             DicConsole.DebugWriteLine("DC42 plugin", "Calculated data checksum = 0x{0:X8}", dataChk);
             DicConsole.DebugWriteLine("DC42 plugin", "Stored data checksum = 0x{0:X8}", header.dataChecksum);
 
-            if (header.tagSize > 0)
+            if(header.tagSize > 0)
             {
                 DicConsole.DebugWriteLine("DC42 plugin", "Reading tags");
                 FileStream tagstream = new FileStream(dc42ImagePath, FileMode.Open, FileAccess.Read);
@@ -449,10 +449,10 @@ namespace DiscImageChef.ImagePlugins
 
         public override byte[] ReadSectors(UInt64 sectorAddress, UInt32 length)
         {
-            if (sectorAddress > ImageInfo.sectors - 1)
+            if(sectorAddress > ImageInfo.sectors - 1)
                 throw new ArgumentOutOfRangeException("sectorAddress", "Sector address not found");
 
-            if (sectorAddress + length > ImageInfo.sectors)
+            if(sectorAddress + length > ImageInfo.sectors)
                 throw new ArgumentOutOfRangeException("length", "Requested more sectors than available");
 
             byte[] buffer = new byte[length * ImageInfo.sectorSize];
@@ -470,16 +470,16 @@ namespace DiscImageChef.ImagePlugins
 
         public override byte[] ReadSectorsTag(UInt64 sectorAddress, UInt32 length, SectorTagType tag)
         {
-            if (tag != SectorTagType.AppleSectorTag)
+            if(tag != SectorTagType.AppleSectorTag)
                 throw new FeatureUnsupportedImageException(String.Format("Tag {0} not supported by image format", tag));
 
-            if (header.tagSize == 0)
+            if(header.tagSize == 0)
                 throw new FeatureNotPresentImageException("Disk image does not have tags");
 
-            if (sectorAddress > ImageInfo.sectors - 1)
+            if(sectorAddress > ImageInfo.sectors - 1)
                 throw new ArgumentOutOfRangeException("sectorAddress", "Sector address not found");
 
-            if (sectorAddress + length > ImageInfo.sectors)
+            if(sectorAddress + length > ImageInfo.sectors)
                 throw new ArgumentOutOfRangeException("length", "Requested more sectors than available");
 
             byte[] buffer = new byte[length * bptag];
@@ -502,17 +502,17 @@ namespace DiscImageChef.ImagePlugins
 
         public override byte[] ReadSectorsLong(UInt64 sectorAddress, UInt32 length)
         {
-            if (sectorAddress > ImageInfo.sectors - 1)
+            if(sectorAddress > ImageInfo.sectors - 1)
                 throw new ArgumentOutOfRangeException("sectorAddress", "Sector address not found");
 
-            if (sectorAddress + length > ImageInfo.sectors)
+            if(sectorAddress + length > ImageInfo.sectors)
                 throw new ArgumentOutOfRangeException("length", "Requested more sectors than available");
 
             byte[] data = ReadSectors(sectorAddress, length);
             byte[] tags = ReadSectorsTag(sectorAddress, length, SectorTagType.AppleSectorTag);
             byte[] buffer = new byte[data.Length + tags.Length];
 
-            for (uint i = 0; i < length; i++)
+            for(uint i = 0; i < length; i++)
             {
                 Array.Copy(data, i * (ImageInfo.sectorSize), buffer, i * (ImageInfo.sectorSize + bptag), ImageInfo.sectorSize);
                 Array.Copy(tags, i * (bptag), buffer, i * (ImageInfo.sectorSize + bptag) + ImageInfo.sectorSize, bptag);
@@ -521,22 +521,22 @@ namespace DiscImageChef.ImagePlugins
             return buffer;
         }
 
-        public override string   GetImageFormat()
-        { 
+        public override string GetImageFormat()
+        {
             return "Apple DiskCopy 4.2";
         }
 
-        public override string   GetImageVersion()
+        public override string GetImageVersion()
         {
             return ImageInfo.imageVersion;
         }
 
-        public override string   GetImageApplication()
+        public override string GetImageApplication()
         {
             return ImageInfo.imageApplication;
         }
 
-        public override string   GetImageApplicationVersion()
+        public override string GetImageApplicationVersion()
         {
             return ImageInfo.imageApplicationVersion;
         }
@@ -551,7 +551,7 @@ namespace DiscImageChef.ImagePlugins
             return ImageInfo.imageLastModificationTime;
         }
 
-        public override string   GetImageName()
+        public override string GetImageName()
         {
             return ImageInfo.imageName;
         }
@@ -573,42 +573,42 @@ namespace DiscImageChef.ImagePlugins
             return ImageInfo.imageCreator;
         }
 
-        public override string   GetImageComments()
+        public override string GetImageComments()
         {
             return ImageInfo.imageComments;
         }
 
-        public override string   GetMediaManufacturer()
+        public override string GetMediaManufacturer()
         {
             return ImageInfo.mediaManufacturer;
         }
 
-        public override string   GetMediaModel()
+        public override string GetMediaModel()
         {
             return ImageInfo.mediaModel;
         }
 
-        public override string   GetMediaSerialNumber()
+        public override string GetMediaSerialNumber()
         {
             return ImageInfo.mediaSerialNumber;
         }
 
-        public override string   GetMediaBarcode()
+        public override string GetMediaBarcode()
         {
             return ImageInfo.mediaBarcode;
         }
 
-        public override string   GetMediaPartNumber()
+        public override string GetMediaPartNumber()
         {
             return ImageInfo.mediaPartNumber;
         }
 
-        public override int      GetMediaSequence()
+        public override int GetMediaSequence()
         {
             return ImageInfo.mediaSequence;
         }
 
-        public override int      GetLastDiskSequence()
+        public override int GetLastDiskSequence()
         {
             return ImageInfo.lastMediaSequence;
         }
@@ -688,12 +688,12 @@ namespace DiscImageChef.ImagePlugins
         #region Private methods
 
         private static UInt32 DC42CheckSum(byte[] buffer)
-        { 
+        {
             UInt32 dc42chk = 0;
-            if ((buffer.Length & 0x01) == 0x01)
+            if((buffer.Length & 0x01) == 0x01)
                 return 0xFFFFFFFF;
 
-            for (UInt32 i = 0; i < buffer.Length; i += 2)
+            for(UInt32 i = 0; i < buffer.Length; i += 2)
             {
                 dc42chk += (uint)(buffer[i] << 8);
                 dc42chk += buffer[i + 1];
diff --git a/DiscImageChef.DiscImages/GDI.cs b/DiscImageChef.DiscImages/GDI.cs
index 3539ab6d7..a18238684 100644
--- a/DiscImageChef.DiscImages/GDI.cs
+++ b/DiscImageChef.DiscImages/GDI.cs
@@ -143,7 +143,7 @@ namespace DiscImageChef.ImagePlugins
                 int tracksFound = 0;
                 int tracks = 0;
 
-                while (gdiStream.Peek() >= 0)
+                while(gdiStream.Peek() >= 0)
                 {
                     line++;
                     string _line = gdiStream.ReadLine();
@@ -171,7 +171,7 @@ namespace DiscImageChef.ImagePlugins
 
                 return tracks == tracksFound;
             }
-            catch (Exception ex)
+            catch(Exception ex)
             {
                 DicConsole.ErrorWriteLine("Exception trying to identify image file {0}", this.imagePath);
                 DicConsole.ErrorWriteLine("Exception: {0}", ex.Message);
@@ -182,9 +182,9 @@ namespace DiscImageChef.ImagePlugins
 
         public override bool OpenImage(string imagePath)
         {
-            if (imagePath == null)
+            if(imagePath == null)
                 return false;
-            if (imagePath == "")
+            if(imagePath == "")
                 return false;
 
             this.imagePath = imagePath;
@@ -214,7 +214,7 @@ namespace DiscImageChef.ImagePlugins
                 GDITrack currentTrack;
                 densitySeparationSectors = 0;
 
-                while (gdiStream.Peek() >= 0)
+                while(gdiStream.Peek() >= 0)
                 {
                     line++;
                     string _line = gdiStream.ReadLine();
@@ -233,8 +233,8 @@ namespace DiscImageChef.ImagePlugins
 
                         tracksFound++;
 
-                        DicConsole.DebugWriteLine("GDI plugin", "Found track {0} starts at {1} flags {2} type {3} file {4} offset {5} at line {6}", 
-                            TrackMatch.Groups["track"].Value, TrackMatch.Groups["start"].Value, TrackMatch.Groups["flags"].Value, 
+                        DicConsole.DebugWriteLine("GDI plugin", "Found track {0} starts at {1} flags {2} type {3} file {4} offset {5} at line {6}",
+                            TrackMatch.Groups["track"].Value, TrackMatch.Groups["start"].Value, TrackMatch.Groups["flags"].Value,
                             TrackMatch.Groups["type"].Value, TrackMatch.Groups["filename"].Value, TrackMatch.Groups["offset"].Value, line);
 
                         currentTrack = new GDITrack();
@@ -243,7 +243,7 @@ namespace DiscImageChef.ImagePlugins
                         currentTrack.offset = long.Parse(TrackMatch.Groups["offset"].Value);
                         currentTrack.sequence = uint.Parse(TrackMatch.Groups["track"].Value);
                         currentTrack.startSector = ulong.Parse(TrackMatch.Groups["start"].Value);
-                        currentTrack.trackfile = TrackMatch.Groups["filename"].Value.Replace("\\\"", "\"").Trim(new []{'"'});
+                        currentTrack.trackfile = TrackMatch.Groups["filename"].Value.Replace("\\\"", "\"").Trim(new[] { '"' });
 
                         if((currentTrack.startSector - currentStart) > 0)
                         {
@@ -280,7 +280,7 @@ namespace DiscImageChef.ImagePlugins
                 }
 
                 Session[] _sessions = new Session[2];
-                for (int s = 0; s < _sessions.Length; s++)
+                for(int s = 0; s < _sessions.Length; s++)
                 {
                     if(s == 0)
                     {
@@ -342,7 +342,7 @@ namespace DiscImageChef.ImagePlugins
 
                 DicConsole.DebugWriteLine("GDI plugin", "Session information:");
                 DicConsole.DebugWriteLine("GDI plugin", "\tDisc contains {0} sessions", discimage.sessions.Count);
-                for (int i = 0; i < discimage.sessions.Count; i++)
+                for(int i = 0; i < discimage.sessions.Count; i++)
                 {
                     DicConsole.DebugWriteLine("GDI plugin", "\tSession {0} information:", i + 1);
                     DicConsole.DebugWriteLine("GDI plugin", "\t\tStarting track: {0}", discimage.sessions[i].StartTrack);
@@ -352,19 +352,19 @@ namespace DiscImageChef.ImagePlugins
                 }
                 DicConsole.DebugWriteLine("GDI plugin", "Track information:");
                 DicConsole.DebugWriteLine("GDI plugin", "\tDisc contains {0} tracks", discimage.tracks.Count);
-                for (int i = 0; i < discimage.tracks.Count; i++)
+                for(int i = 0; i < discimage.tracks.Count; i++)
                 {
                     DicConsole.DebugWriteLine("GDI plugin", "\tTrack {0} information:", discimage.tracks[i].sequence);
                     DicConsole.DebugWriteLine("GDI plugin", "\t\t{0} bytes per sector", discimage.tracks[i].bps);
                     DicConsole.DebugWriteLine("GDI plugin", "\t\tPregap: {0} sectors", discimage.tracks[i].pregap);
 
-                    if ((discimage.tracks[i].flags & 0x80) == 0x80)
+                    if((discimage.tracks[i].flags & 0x80) == 0x80)
                         DicConsole.DebugWriteLine("GDI plugin", "\t\tTrack is flagged as quadraphonic");
-                    if ((discimage.tracks[i].flags & 0x40) == 0x40)
+                    if((discimage.tracks[i].flags & 0x40) == 0x40)
                         DicConsole.DebugWriteLine("GDI plugin", "\t\tTrack is data");
-                    if ((discimage.tracks[i].flags & 0x20) == 0x20)
+                    if((discimage.tracks[i].flags & 0x20) == 0x20)
                         DicConsole.DebugWriteLine("GDI plugin", "\t\tTrack allows digital copy");
-                    if ((discimage.tracks[i].flags & 0x10) == 0x10)
+                    if((discimage.tracks[i].flags & 0x10) == 0x10)
                         DicConsole.DebugWriteLine("GDI plugin", "\t\tTrack has pre-emphasis applied");
 
                     DicConsole.DebugWriteLine("GDI plugin", "\t\tTrack resides in file {0}, type defined as {1}, starting at byte {2}",
@@ -376,9 +376,9 @@ namespace DiscImageChef.ImagePlugins
                 partitions = new List();
                 ulong byte_offset = 0;
 
-                for (int i = 0; i < discimage.tracks.Count; i++)
+                for(int i = 0; i < discimage.tracks.Count; i++)
                 {
-                    if (discimage.tracks[i].sequence == 1 && i != 0)
+                    if(discimage.tracks[i].sequence == 1 && i != 0)
                         throw new ImageNotSupportedException("Unordered tracks");
 
                     Partition partition = new Partition();
@@ -398,16 +398,16 @@ namespace DiscImageChef.ImagePlugins
                     partitions.Add(partition);
                 }
 
-                foreach (GDITrack track in discimage.tracks)
+                foreach(GDITrack track in discimage.tracks)
                     ImageInfo.imageSize += track.bps * track.sectors;
-                foreach (GDITrack track in discimage.tracks)
+                foreach(GDITrack track in discimage.tracks)
                     ImageInfo.sectors += track.sectors;
 
                 ImageInfo.sectors += densitySeparationSectors;
 
                 ImageInfo.sectorSize = 2352; // All others
 
-                foreach (GDITrack track in discimage.tracks)
+                foreach(GDITrack track in discimage.tracks)
                 {
                     if((track.flags & 0x40) == 0x40 && track.bps == 2352)
                     {
@@ -434,7 +434,7 @@ namespace DiscImageChef.ImagePlugins
 
                 return true;
             }
-            catch (Exception ex)
+            catch(Exception ex)
             {
                 DicConsole.ErrorWriteLine("Exception trying to identify image file {0}", imagePath);
                 DicConsole.ErrorWriteLine("Exception: {0}", ex.Message);
@@ -490,15 +490,15 @@ namespace DiscImageChef.ImagePlugins
 
         public override byte[] ReadSectors(UInt64 sectorAddress, UInt32 length)
         {
-            foreach (KeyValuePair kvp in offsetmap)
+            foreach(KeyValuePair kvp in offsetmap)
             {
-                if (sectorAddress >= kvp.Value)
+                if(sectorAddress >= kvp.Value)
                 {
-                    foreach (GDITrack gdi_track in discimage.tracks)
+                    foreach(GDITrack gdi_track in discimage.tracks)
                     {
-                        if (gdi_track.sequence == kvp.Key)
+                        if(gdi_track.sequence == kvp.Key)
                         {
-                            if ((sectorAddress - kvp.Value) < gdi_track.sectors)
+                            if((sectorAddress - kvp.Value) < gdi_track.sectors)
                                 return ReadSectors((sectorAddress - kvp.Value), length, kvp.Key);
                         }
                     }
@@ -507,7 +507,7 @@ namespace DiscImageChef.ImagePlugins
 
             ulong transitionStart;
             offsetmap.TryGetValue(0, out transitionStart);
-            if (sectorAddress >= transitionStart && sectorAddress < (densitySeparationSectors + transitionStart))
+            if(sectorAddress >= transitionStart && sectorAddress < (densitySeparationSectors + transitionStart))
                 return ReadSectors((sectorAddress - transitionStart), length, 0);
 
             throw new ArgumentOutOfRangeException("sectorAddress", "Sector address not found");
@@ -515,15 +515,15 @@ namespace DiscImageChef.ImagePlugins
 
         public override byte[] ReadSectorsTag(UInt64 sectorAddress, UInt32 length, SectorTagType tag)
         {
-            foreach (KeyValuePair kvp in offsetmap)
+            foreach(KeyValuePair kvp in offsetmap)
             {
-                if (sectorAddress >= kvp.Value)
+                if(sectorAddress >= kvp.Value)
                 {
-                    foreach (GDITrack gdi_track in discimage.tracks)
+                    foreach(GDITrack gdi_track in discimage.tracks)
                     {
-                        if (gdi_track.sequence == kvp.Key)
+                        if(gdi_track.sequence == kvp.Key)
                         {
-                            if ((sectorAddress - kvp.Value) < gdi_track.sectors)
+                            if((sectorAddress - kvp.Value) < gdi_track.sectors)
                                 return ReadSectorsTag((sectorAddress - kvp.Value), length, kvp.Key, tag);
                         }
                     }
@@ -532,7 +532,7 @@ namespace DiscImageChef.ImagePlugins
 
             ulong transitionStart;
             offsetmap.TryGetValue(0, out transitionStart);
-            if (sectorAddress >= transitionStart && sectorAddress < (densitySeparationSectors + transitionStart))
+            if(sectorAddress >= transitionStart && sectorAddress < (densitySeparationSectors + transitionStart))
                 return ReadSectorsTag((sectorAddress - transitionStart), length, 0, tag);
 
             throw new ArgumentOutOfRangeException("sectorAddress", "Sector address not found");
@@ -540,7 +540,7 @@ namespace DiscImageChef.ImagePlugins
 
         public override byte[] ReadSectors(UInt64 sectorAddress, UInt32 length, UInt32 track)
         {
-            if (track == 0)
+            if(track == 0)
             {
                 if((sectorAddress + length) > densitySeparationSectors)
                     throw new ArgumentOutOfRangeException("length", "Requested more sectors than present in track, won't cross tracks");
@@ -552,26 +552,26 @@ namespace DiscImageChef.ImagePlugins
 
             _track.sequence = 0;
 
-            foreach (GDITrack gdi_track in discimage.tracks)
+            foreach(GDITrack gdi_track in discimage.tracks)
             {
-                if (gdi_track.sequence == track)
+                if(gdi_track.sequence == track)
                 {
                     _track = gdi_track;
                     break;
                 }
             }
 
-            if (_track.sequence == 0)
+            if(_track.sequence == 0)
                 throw new ArgumentOutOfRangeException("track", "Track does not exist in disc image");
 
-            if ((sectorAddress + length) > _track.sectors)
+            if((sectorAddress + length) > _track.sectors)
                 throw new ArgumentOutOfRangeException("length", "Requested more sectors than present in track, won't cross tracks");
 
             uint sector_offset;
             uint sector_size;
             uint sector_skip;
 
-            switch (_track.tracktype)
+            switch(_track.tracktype)
             {
                 case TrackType.Audio:
                     {
@@ -582,7 +582,7 @@ namespace DiscImageChef.ImagePlugins
                     }
                 case TrackType.CDMode1:
                     {
-                        if (_track.bps == 2352)
+                        if(_track.bps == 2352)
                         {
                             sector_offset = 16;
                             sector_size = 2048;
@@ -604,11 +604,11 @@ namespace DiscImageChef.ImagePlugins
 
             ulong remainingSectors = length;
 
-            if (_track.pregap > 0 && sectorAddress < _track.pregap)
+            if(_track.pregap > 0 && sectorAddress < _track.pregap)
             {
                 ulong remainingPregap = _track.pregap - sectorAddress;
                 byte[] zero;
-                if (length > remainingPregap)
+                if(length > remainingPregap)
                 {
                     zero = new byte[remainingPregap * sector_size];
                     remainingSectors -= remainingPregap;
@@ -626,14 +626,14 @@ namespace DiscImageChef.ImagePlugins
                 return buffer;
 
             imageStream = new FileStream(_track.trackfile, FileMode.Open, FileAccess.Read);
-            using (BinaryReader br = new BinaryReader(imageStream))
+            using(BinaryReader br = new BinaryReader(imageStream))
             {
                 br.BaseStream.Seek(_track.offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip) + _track.pregap * _track.bps), SeekOrigin.Begin);
-                if (sector_offset == 0 && sector_skip == 0)
+                if(sector_offset == 0 && sector_skip == 0)
                     buffer = br.ReadBytes((int)(sector_size * remainingSectors));
                 else
                 {
-                    for (ulong i = 0; i < remainingSectors; i++)
+                    for(ulong i = 0; i < remainingSectors; i++)
                     {
                         byte[] sector;
                         br.BaseStream.Seek(sector_offset, SeekOrigin.Current);
@@ -649,12 +649,12 @@ namespace DiscImageChef.ImagePlugins
 
         public override byte[] ReadSectorsTag(UInt64 sectorAddress, UInt32 length, UInt32 track, SectorTagType tag)
         {
-            if (track == 0)
+            if(track == 0)
             {
                 if((sectorAddress + length) > densitySeparationSectors)
                     throw new ArgumentOutOfRangeException("length", "Requested more sectors than present in track, won't cross tracks");
 
-                if (tag == SectorTagType.CDTrackFlags)
+                if(tag == SectorTagType.CDTrackFlags)
                     return new byte[] { 0x00 };
 
                 throw new ArgumentException("Unsupported tag requested for this track", "tag");
@@ -664,26 +664,26 @@ namespace DiscImageChef.ImagePlugins
 
             _track.sequence = 0;
 
-            foreach (GDITrack gdi_track in discimage.tracks)
+            foreach(GDITrack gdi_track in discimage.tracks)
             {
-                if (gdi_track.sequence == track)
+                if(gdi_track.sequence == track)
                 {
                     _track = gdi_track;
                     break;
                 }
             }
 
-            if (_track.sequence == 0)
+            if(_track.sequence == 0)
                 throw new ArgumentOutOfRangeException("track", "Track does not exist in disc image");
 
-            if (length > _track.sectors)
+            if(length > _track.sectors)
                 throw new ArgumentOutOfRangeException("length", "Requested more sectors than present in track, won't cross tracks");
 
             uint sector_offset;
             uint sector_size;
             uint sector_skip;
 
-            switch (tag)
+            switch(tag)
             {
                 case SectorTagType.CDSectorECC:
                 case SectorTagType.CDSectorECC_P:
@@ -704,16 +704,16 @@ namespace DiscImageChef.ImagePlugins
                     throw new ArgumentException("Unsupported tag requested", "tag");
             }
 
-            switch (_track.tracktype)
+            switch(_track.tracktype)
             {
                 case TrackType.Audio:
                     throw new ArgumentException("There are no tags on audio tracks", "tag");
                 case TrackType.CDMode1:
                     {
-                        if (_track.bps != 2352)
+                        if(_track.bps != 2352)
                             throw new FeatureNotPresentImageException("Image does not include tags for mode 1 sectors");
-                        
-                        switch (tag)
+
+                        switch(tag)
                         {
                             case SectorTagType.CDSectorSync:
                                 {
@@ -773,11 +773,11 @@ namespace DiscImageChef.ImagePlugins
 
             ulong remainingSectors = length;
 
-            if (_track.pregap > 0 && sectorAddress < _track.pregap)
+            if(_track.pregap > 0 && sectorAddress < _track.pregap)
             {
                 ulong remainingPregap = _track.pregap - sectorAddress;
                 byte[] zero;
-                if (length > remainingPregap)
+                if(length > remainingPregap)
                 {
                     zero = new byte[remainingPregap * sector_size];
                     remainingSectors -= remainingPregap;
@@ -795,14 +795,14 @@ namespace DiscImageChef.ImagePlugins
                 return buffer;
 
             imageStream = new FileStream(_track.trackfile, FileMode.Open, FileAccess.Read);
-            using (BinaryReader br = new BinaryReader(imageStream))
+            using(BinaryReader br = new BinaryReader(imageStream))
             {
                 br.BaseStream.Seek(_track.offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip) + _track.pregap * _track.bps), SeekOrigin.Begin);
-                if (sector_offset == 0 && sector_skip == 0)
+                if(sector_offset == 0 && sector_skip == 0)
                     buffer = br.ReadBytes((int)(sector_size * remainingSectors));
                 else
                 {
-                    for (ulong i = 0; i < remainingSectors; i++)
+                    for(ulong i = 0; i < remainingSectors; i++)
                     {
                         byte[] sector;
                         br.BaseStream.Seek(sector_offset, SeekOrigin.Current);
@@ -828,15 +828,15 @@ namespace DiscImageChef.ImagePlugins
 
         public override byte[] ReadSectorsLong(UInt64 sectorAddress, UInt32 length)
         {
-            foreach (KeyValuePair kvp in offsetmap)
+            foreach(KeyValuePair kvp in offsetmap)
             {
-                if (sectorAddress >= kvp.Value)
+                if(sectorAddress >= kvp.Value)
                 {
-                    foreach (GDITrack gdi_track in discimage.tracks)
+                    foreach(GDITrack gdi_track in discimage.tracks)
                     {
-                        if (gdi_track.sequence == kvp.Key)
+                        if(gdi_track.sequence == kvp.Key)
                         {
-                            if ((sectorAddress - kvp.Value) < gdi_track.sectors)
+                            if((sectorAddress - kvp.Value) < gdi_track.sectors)
                                 return ReadSectorsLong((sectorAddress - kvp.Value), length, kvp.Key);
                         }
                     }
@@ -848,7 +848,7 @@ namespace DiscImageChef.ImagePlugins
 
         public override byte[] ReadSectorsLong(UInt64 sectorAddress, UInt32 length, UInt32 track)
         {
-            if (track == 0)
+            if(track == 0)
             {
                 if((sectorAddress + length) > densitySeparationSectors)
                     throw new ArgumentOutOfRangeException("length", "Requested more sectors than present in track, won't cross tracks");
@@ -860,26 +860,26 @@ namespace DiscImageChef.ImagePlugins
 
             _track.sequence = 0;
 
-            foreach (GDITrack gdi_track in discimage.tracks)
+            foreach(GDITrack gdi_track in discimage.tracks)
             {
-                if (gdi_track.sequence == track)
+                if(gdi_track.sequence == track)
                 {
                     _track = gdi_track;
                     break;
                 }
             }
 
-            if (_track.sequence == 0)
+            if(_track.sequence == 0)
                 throw new ArgumentOutOfRangeException("track", "Track does not exist in disc image");
 
-            if ((sectorAddress + length) > _track.sectors)
+            if((sectorAddress + length) > _track.sectors)
                 throw new ArgumentOutOfRangeException("length", "Requested more sectors than present in track, won't cross tracks");
 
             uint sector_offset;
             uint sector_size;
             uint sector_skip;
 
-            switch (_track.tracktype)
+            switch(_track.tracktype)
             {
                 case TrackType.Audio:
                     {
@@ -890,7 +890,7 @@ namespace DiscImageChef.ImagePlugins
                     }
                 case TrackType.CDMode1:
                     {
-                        if (_track.bps == 2352)
+                        if(_track.bps == 2352)
                         {
                             sector_offset = 0;
                             sector_size = 2352;
@@ -912,11 +912,11 @@ namespace DiscImageChef.ImagePlugins
 
             ulong remainingSectors = length;
 
-            if (_track.pregap > 0 && sectorAddress < _track.pregap)
+            if(_track.pregap > 0 && sectorAddress < _track.pregap)
             {
                 ulong remainingPregap = _track.pregap - sectorAddress;
                 byte[] zero;
-                if (length > remainingPregap)
+                if(length > remainingPregap)
                 {
                     zero = new byte[remainingPregap * sector_size];
                     remainingSectors -= remainingPregap;
@@ -934,14 +934,14 @@ namespace DiscImageChef.ImagePlugins
                 return buffer;
 
             imageStream = new FileStream(_track.trackfile, FileMode.Open, FileAccess.Read);
-            using (BinaryReader br = new BinaryReader(imageStream))
+            using(BinaryReader br = new BinaryReader(imageStream))
             {
                 br.BaseStream.Seek(_track.offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip) + _track.pregap * _track.bps), SeekOrigin.Begin);
-                if (sector_offset == 0 && sector_skip == 0)
+                if(sector_offset == 0 && sector_skip == 0)
                     buffer = br.ReadBytes((int)(sector_size * remainingSectors));
                 else
                 {
-                    for (ulong i = 0; i < remainingSectors; i++)
+                    for(ulong i = 0; i < remainingSectors; i++)
                     {
                         byte[] sector;
                         br.BaseStream.Seek(sector_offset, SeekOrigin.Current);
@@ -955,22 +955,22 @@ namespace DiscImageChef.ImagePlugins
             return buffer;
         }
 
-        public override string   GetImageFormat()
+        public override string GetImageFormat()
         {
             return "Dreamcast GDI image";
         }
 
-        public override string   GetImageVersion()
+        public override string GetImageVersion()
         {
             return ImageInfo.imageVersion;
         }
 
-        public override string   GetImageApplication()
+        public override string GetImageApplication()
         {
             return ImageInfo.imageApplication;
         }
 
-        public override string   GetImageApplicationVersion()
+        public override string GetImageApplicationVersion()
         {
             return ImageInfo.imageApplicationVersion;
         }
@@ -985,7 +985,7 @@ namespace DiscImageChef.ImagePlugins
             return ImageInfo.imageLastModificationTime;
         }
 
-        public override string   GetImageComments()
+        public override string GetImageComments()
         {
             return ImageInfo.imageComments;
         }
@@ -1014,7 +1014,7 @@ namespace DiscImageChef.ImagePlugins
         {
             List tracks = new List();
 
-            foreach (GDITrack gdi_track in discimage.tracks)
+            foreach(GDITrack gdi_track in discimage.tracks)
             {
                 Track _track = new Track();
 
@@ -1023,7 +1023,7 @@ namespace DiscImageChef.ImagePlugins
                 _track.TrackStartSector = gdi_track.startSector;
                 _track.TrackEndSector = _track.TrackStartSector + gdi_track.sectors - 1;
                 _track.TrackPregap = gdi_track.pregap;
-                if (gdi_track.highDensity)
+                if(gdi_track.highDensity)
                     _track.TrackSession = 2;
                 else
                     _track.TrackSession = 1;
@@ -1047,7 +1047,7 @@ namespace DiscImageChef.ImagePlugins
 
         public override List GetSessionTracks(Session session)
         {
-            if (discimage.sessions.Contains(session))
+            if(discimage.sessions.Contains(session))
             {
                 return GetSessionTracks(session.SessionSequence);
             }
@@ -1071,9 +1071,9 @@ namespace DiscImageChef.ImagePlugins
                     throw new ImageNotSupportedException("Session does not exist in disc image");
             }
 
-            foreach (GDITrack gdi_track in discimage.tracks)
+            foreach(GDITrack gdi_track in discimage.tracks)
             {
-                if (gdi_track.highDensity == expectedDensity)
+                if(gdi_track.highDensity == expectedDensity)
                 {
                     Track _track = new Track();
 
@@ -1082,7 +1082,7 @@ namespace DiscImageChef.ImagePlugins
                     _track.TrackStartSector = gdi_track.startSector;
                     _track.TrackEndSector = _track.TrackStartSector + gdi_track.sectors - 1;
                     _track.TrackPregap = gdi_track.pregap;
-                    if (gdi_track.highDensity)
+                    if(gdi_track.highDensity)
                         _track.TrackSession = 2;
                     else
                         _track.TrackSession = 1;
@@ -1130,12 +1130,12 @@ namespace DiscImageChef.ImagePlugins
             FailingLBAs = new List();
             UnknownLBAs = new List();
 
-            for (int i = 0; i < length; i++)
+            for(int i = 0; i < length; i++)
             {
                 Array.Copy(buffer, i * bps, sector, 0, bps);
                 bool? sectorStatus = Checksums.CDChecksums.CheckCDSector(sector);
 
-                switch (sectorStatus)
+                switch(sectorStatus)
                 {
                     case null:
                         UnknownLBAs.Add((ulong)i + sectorAddress);
@@ -1146,9 +1146,9 @@ namespace DiscImageChef.ImagePlugins
                 }
             }
 
-            if (UnknownLBAs.Count > 0)
+            if(UnknownLBAs.Count > 0)
                 return null;
-            if (FailingLBAs.Count > 0)
+            if(FailingLBAs.Count > 0)
                 return false;
             return true;
         }
@@ -1161,12 +1161,12 @@ namespace DiscImageChef.ImagePlugins
             FailingLBAs = new List();
             UnknownLBAs = new List();
 
-            for (int i = 0; i < length; i++)
+            for(int i = 0; i < length; i++)
             {
                 Array.Copy(buffer, i * bps, sector, 0, bps);
                 bool? sectorStatus = Checksums.CDChecksums.CheckCDSector(sector);
 
-                switch (sectorStatus)
+                switch(sectorStatus)
                 {
                     case null:
                         UnknownLBAs.Add((ulong)i + sectorAddress);
@@ -1177,9 +1177,9 @@ namespace DiscImageChef.ImagePlugins
                 }
             }
 
-            if (UnknownLBAs.Count > 0)
+            if(UnknownLBAs.Count > 0)
                 return null;
-            if (FailingLBAs.Count > 0)
+            if(FailingLBAs.Count > 0)
                 return false;
             return true;
         }
@@ -1193,12 +1193,12 @@ namespace DiscImageChef.ImagePlugins
 
         #region Unsupported features
 
-        public override int    GetMediaSequence()
+        public override int GetMediaSequence()
         {
             return ImageInfo.mediaSequence;
         }
 
-        public override int    GetLastDiskSequence()
+        public override int GetLastDiskSequence()
         {
             return ImageInfo.lastMediaSequence;
         }
@@ -1233,12 +1233,12 @@ namespace DiscImageChef.ImagePlugins
             return ImageInfo.mediaModel;
         }
 
-        public override string   GetImageName()
+        public override string GetImageName()
         {
             return ImageInfo.imageName;
         }
 
-        public override string   GetImageCreator()
+        public override string GetImageCreator()
         {
             return ImageInfo.imageCreator;
         }
diff --git a/DiscImageChef.DiscImages/ImagePlugin.cs b/DiscImageChef.DiscImages/ImagePlugin.cs
index 6b2bb42ad..7408298ec 100644
--- a/DiscImageChef.DiscImages/ImagePlugin.cs
+++ b/DiscImageChef.DiscImages/ImagePlugin.cs
@@ -215,31 +215,31 @@ namespace DiscImageChef.ImagePlugins
         /// Gets the image format.
         /// 
/// The image format. - public abstract string GetImageFormat(); + public abstract string GetImageFormat(); /// /// Gets the image version. /// /// The image version. - public abstract string GetImageVersion(); + public abstract string GetImageVersion(); /// /// Gets the application that created the image. /// /// The application that created the image. - public abstract string GetImageApplication(); + public abstract string GetImageApplication(); /// /// Gets the version of the application that created the image. /// /// The version of the application that created the image. - public abstract string GetImageApplicationVersion(); + public abstract string GetImageApplicationVersion(); /// /// Gets the image creator. /// /// Who created the image. - public abstract string GetImageCreator(); + public abstract string GetImageCreator(); /// /// Gets the image creation time. @@ -257,13 +257,13 @@ namespace DiscImageChef.ImagePlugins /// Gets the name of the image. /// /// The image name. - public abstract string GetImageName(); + public abstract string GetImageName(); /// /// Gets the image comments. /// /// The image comments. - public abstract string GetImageComments(); + public abstract string GetImageComments(); // Functions to get information from disk represented by image @@ -271,31 +271,31 @@ namespace DiscImageChef.ImagePlugins /// Gets the media manufacturer. /// /// The media manufacturer. - public abstract string GetMediaManufacturer(); + public abstract string GetMediaManufacturer(); /// /// Gets the media model. /// /// The media model. - public abstract string GetMediaModel(); + public abstract string GetMediaModel(); /// /// Gets the media serial number. /// /// The media serial number. - public abstract string GetMediaSerialNumber(); + public abstract string GetMediaSerialNumber(); /// /// Gets the media (or product) barcode. /// /// The media barcode. - public abstract string GetMediaBarcode(); + public abstract string GetMediaBarcode(); /// /// Gets the media part number. /// /// The media part number. - public abstract string GetMediaPartNumber(); + public abstract string GetMediaPartNumber(); /// /// Gets the type of the media. @@ -307,13 +307,13 @@ namespace DiscImageChef.ImagePlugins /// Gets the media sequence. /// /// The media sequence, starting at 1. - public abstract int GetMediaSequence(); + public abstract int GetMediaSequence(); /// /// Gets the last media in the sequence. /// /// The last media in the sequence. - public abstract int GetLastDiskSequence(); + public abstract int GetLastDiskSequence(); // Functions to get information from drive used to create image @@ -727,7 +727,7 @@ namespace DiscImageChef.ImagePlugins protected FeatureSupportedButNotImplementedImageException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { - if (info == null) + if(info == null) throw new ArgumentNullException("info"); } } @@ -763,7 +763,7 @@ namespace DiscImageChef.ImagePlugins protected FeatureUnsupportedImageException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { - if (info == null) + if(info == null) throw new ArgumentNullException("info"); } } @@ -799,7 +799,7 @@ namespace DiscImageChef.ImagePlugins protected FeatureNotPresentImageException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { - if (info == null) + if(info == null) throw new ArgumentNullException("info"); } } @@ -835,7 +835,7 @@ namespace DiscImageChef.ImagePlugins protected FeaturedNotSupportedByDiscImageException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { - if (info == null) + if(info == null) throw new ArgumentNullException("info"); } } @@ -871,7 +871,7 @@ namespace DiscImageChef.ImagePlugins protected ImageNotSupportedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { - if (info == null) + if(info == null) throw new ArgumentNullException("info"); } } diff --git a/DiscImageChef.DiscImages/Nero.cs b/DiscImageChef.DiscImages/Nero.cs index bc1a8346e..73d99f5c3 100644 --- a/DiscImageChef.DiscImages/Nero.cs +++ b/DiscImageChef.DiscImages/Nero.cs @@ -908,12 +908,12 @@ namespace DiscImageChef.ImagePlugins DicConsole.DebugWriteLine("Nero plugin", "footerV2.ChunkID = 0x{0:X2} (\"{1}\")", footerV2.ChunkID, System.Text.Encoding.ASCII.GetString(BigEndianBitConverter.GetBytes(footerV2.ChunkID))); DicConsole.DebugWriteLine("Nero plugin", "footerV2.FirstChunkOffset = {0}", footerV2.FirstChunkOffset); - if (footerV2.ChunkID == NeroV2FooterID && footerV2.FirstChunkOffset < (ulong)imageInfo.Length) + if(footerV2.ChunkID == NeroV2FooterID && footerV2.FirstChunkOffset < (ulong)imageInfo.Length) { imageStream.Close(); return true; } - if (footerV1.ChunkID == NeroV1FooterID && footerV1.FirstChunkOffset < (ulong)imageInfo.Length) + if(footerV1.ChunkID == NeroV1FooterID && footerV1.FirstChunkOffset < (ulong)imageInfo.Length) { imageStream.Close(); return true; @@ -953,9 +953,9 @@ namespace DiscImageChef.ImagePlugins DicConsole.DebugWriteLine("Nero plugin", "footerV2.ChunkID = 0x{0:X2} (\"{1}\")", footerV2.ChunkID, System.Text.Encoding.ASCII.GetString(BigEndianBitConverter.GetBytes(footerV2.ChunkID))); DicConsole.DebugWriteLine("Nero plugin", "footerV2.FirstChunkOffset = {0}", footerV2.FirstChunkOffset); - if (footerV1.ChunkID == NeroV1FooterID && footerV1.FirstChunkOffset < (ulong)imageInfo.Length) + if(footerV1.ChunkID == NeroV1FooterID && footerV1.FirstChunkOffset < (ulong)imageInfo.Length) imageNewFormat = false; - else if (footerV2.ChunkID == NeroV2FooterID && footerV2.FirstChunkOffset < (ulong)imageInfo.Length) + else if(footerV2.ChunkID == NeroV2FooterID && footerV2.FirstChunkOffset < (ulong)imageInfo.Length) imageNewFormat = true; else { @@ -963,7 +963,7 @@ namespace DiscImageChef.ImagePlugins return true; } - if (imageNewFormat) + if(imageNewFormat) imageStream.Seek((long)footerV2.FirstChunkOffset, SeekOrigin.Begin); else imageStream.Seek(footerV1.FirstChunkOffset, SeekOrigin.Begin); @@ -979,7 +979,7 @@ namespace DiscImageChef.ImagePlugins ImageInfo.sectors = 0; ImageInfo.sectorSize = 0; - while (parsing) + while(parsing) { byte[] ChunkHeaderBuffer = new byte[8]; UInt32 ChunkID; @@ -992,7 +992,7 @@ namespace DiscImageChef.ImagePlugins DicConsole.DebugWriteLine("Nero plugin", "ChunkID = 0x{0:X2} (\"{1}\")", ChunkID, System.Text.Encoding.ASCII.GetString(BigEndianBitConverter.GetBytes(ChunkID))); DicConsole.DebugWriteLine("Nero plugin", "ChunkLength = {0}", ChunkLength); - switch (ChunkID) + switch(ChunkID) { case NeroV1CUEID: { @@ -1004,7 +1004,7 @@ namespace DiscImageChef.ImagePlugins neroCuesheetV1.Entries = new List(); byte[] tmpbuffer = new byte[8]; - for (int i = 0; i < neroCuesheetV1.ChunkSize; i += 8) + for(int i = 0; i < neroCuesheetV1.ChunkSize; i += 8) { NeroV1CueEntry _entry = new NeroV1CueEntry(); imageStream.Read(tmpbuffer, 0, 8); @@ -1040,7 +1040,7 @@ namespace DiscImageChef.ImagePlugins neroCuesheetV2.Entries = new List(); byte[] tmpbuffer = new byte[8]; - for (int i = 0; i < neroCuesheetV2.ChunkSize; i += 8) + for(int i = 0; i < neroCuesheetV2.ChunkSize; i += 8) { NeroV2CueEntry _entry = new NeroV2CueEntry(); imageStream.Read(tmpbuffer, 0, 8); @@ -1080,10 +1080,10 @@ namespace DiscImageChef.ImagePlugins neroDAOV1.LastTrack = tmpbuffer[21]; neroDAOV1.Tracks = new List(); - if (!ImageInfo.readableMediaTags.Contains(MediaTagType.CD_MCN)) + if(!ImageInfo.readableMediaTags.Contains(MediaTagType.CD_MCN)) ImageInfo.readableMediaTags.Add(MediaTagType.CD_MCN); - if (!ImageInfo.readableSectorTags.Contains(SectorTagType.CDTrackISRC)) + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDTrackISRC)) ImageInfo.readableSectorTags.Add(SectorTagType.CDTrackISRC); DicConsole.DebugWriteLine("Nero plugin", "neroDAOV1.ChunkSizeLe = {0} bytes", neroDAOV1.ChunkSizeLe); @@ -1095,7 +1095,7 @@ namespace DiscImageChef.ImagePlugins UPC = neroDAOV1.UPC; tmpbuffer = new byte[30]; - for (int i = 0; i < (neroDAOV1.ChunkSizeBe - 22); i += 30) + for(int i = 0; i < (neroDAOV1.ChunkSizeBe - 22); i += 30) { NeroV1DAOEntry _entry = new NeroV1DAOEntry(); imageStream.Read(tmpbuffer, 0, 30); @@ -1119,7 +1119,7 @@ namespace DiscImageChef.ImagePlugins neroDAOV1.Tracks.Add(_entry); - if (_entry.SectorSize > ImageInfo.sectorSize) + if(_entry.SectorSize > ImageInfo.sectorSize) ImageInfo.sectorSize = _entry.SectorSize; TrackISRCs.Add(currenttrack, _entry.ISRC); @@ -1163,10 +1163,10 @@ namespace DiscImageChef.ImagePlugins neroDAOV2.LastTrack = tmpbuffer[21]; neroDAOV2.Tracks = new List(); - if (!ImageInfo.readableMediaTags.Contains(MediaTagType.CD_MCN)) + if(!ImageInfo.readableMediaTags.Contains(MediaTagType.CD_MCN)) ImageInfo.readableMediaTags.Add(MediaTagType.CD_MCN); - if (!ImageInfo.readableSectorTags.Contains(SectorTagType.CDTrackISRC)) + if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDTrackISRC)) ImageInfo.readableSectorTags.Add(SectorTagType.CDTrackISRC); UPC = neroDAOV2.UPC; @@ -1178,7 +1178,7 @@ namespace DiscImageChef.ImagePlugins DicConsole.DebugWriteLine("Nero plugin", "neroDAOV2.LastTrack = {0}", neroDAOV2.LastTrack); tmpbuffer = new byte[42]; - for (int i = 0; i < (neroDAOV2.ChunkSizeBe - 22); i += 42) + for(int i = 0; i < (neroDAOV2.ChunkSizeBe - 22); i += 42) { NeroV2DAOEntry _entry = new NeroV2DAOEntry(); imageStream.Read(tmpbuffer, 0, 42); @@ -1202,7 +1202,7 @@ namespace DiscImageChef.ImagePlugins neroDAOV2.Tracks.Add(_entry); - if (_entry.SectorSize > ImageInfo.sectorSize) + if(_entry.SectorSize > ImageInfo.sectorSize) ImageInfo.sectorSize = _entry.SectorSize; TrackISRCs.Add(currenttrack, _entry.ISRC); @@ -1238,7 +1238,7 @@ namespace DiscImageChef.ImagePlugins neroCDTXT.Packs = new List(); byte[] tmpbuffer = new byte[18]; - for (int i = 0; i < (neroCDTXT.ChunkSize); i += 18) + for(int i = 0; i < (neroCDTXT.ChunkSize); i += 18) { NeroCDTextPack _entry = new NeroCDTextPack(); imageStream.Read(tmpbuffer, 0, 18); @@ -1274,7 +1274,7 @@ namespace DiscImageChef.ImagePlugins neroTAOV1.Tracks = new List(); byte[] tmpbuffer = new byte[20]; - for (int i = 0; i < (neroTAOV1.ChunkSize); i += 20) + for(int i = 0; i < (neroTAOV1.ChunkSize); i += 20) { NeroV1TAOEntry _entry = new NeroV1TAOEntry(); imageStream.Read(tmpbuffer, 0, 20); @@ -1294,7 +1294,7 @@ namespace DiscImageChef.ImagePlugins neroTAOV1.Tracks.Add(_entry); - if (NeroTrackModeToBytesPerSector((DAOMode)_entry.Mode) > ImageInfo.sectorSize) + if(NeroTrackModeToBytesPerSector((DAOMode)_entry.Mode) > ImageInfo.sectorSize) ImageInfo.sectorSize = NeroTrackModeToBytesPerSector((DAOMode)_entry.Mode); NeroTrack _neroTrack = new NeroTrack(); @@ -1328,7 +1328,7 @@ namespace DiscImageChef.ImagePlugins neroTAOV2.Tracks = new List(); byte[] tmpbuffer = new byte[32]; - for (int i = 0; i < (neroTAOV2.ChunkSize); i += 32) + for(int i = 0; i < (neroTAOV2.ChunkSize); i += 32) { NeroV2TAOEntry _entry = new NeroV2TAOEntry(); imageStream.Read(tmpbuffer, 0, 32); @@ -1350,7 +1350,7 @@ namespace DiscImageChef.ImagePlugins neroTAOV2.Tracks.Add(_entry); - if (NeroTrackModeToBytesPerSector((DAOMode)_entry.Mode) > ImageInfo.sectorSize) + if(NeroTrackModeToBytesPerSector((DAOMode)_entry.Mode) > ImageInfo.sectorSize) ImageInfo.sectorSize = NeroTrackModeToBytesPerSector((DAOMode)_entry.Mode); NeroTrack _neroTrack = new NeroTrack(); @@ -1485,7 +1485,7 @@ namespace DiscImageChef.ImagePlugins ImageInfo.driveSerialNumber = null; ImageInfo.mediaSequence = 0; ImageInfo.lastMediaSequence = 0; - if (imageNewFormat) + if(imageNewFormat) { ImageInfo.imageSize = footerV2.FirstChunkOffset; ImageInfo.imageVersion = "Nero Burning ROM >= 5.5"; @@ -1500,7 +1500,7 @@ namespace DiscImageChef.ImagePlugins ImageInfo.imageApplicationVersion = "<= 5.0"; } - if (neroSessions.Count == 0) + if(neroSessions.Count == 0) neroSessions.Add(1, currenttrack); DicConsole.DebugWriteLine("Nero plugin", "Building offset, track and session maps"); @@ -1511,10 +1511,10 @@ namespace DiscImageChef.ImagePlugins uint currentsessioncurrenttrack = 1; Session currentsessionstruct = new Session(); ulong PartitionSequence = 0; - for (uint i = 1; i <= neroTracks.Count; i++) + for(uint i = 1; i <= neroTracks.Count; i++) { NeroTrack _neroTrack; - if (neroTracks.TryGetValue(i, out _neroTrack)) + if(neroTracks.TryGetValue(i, out _neroTrack)) { DicConsole.DebugWriteLine("Nero plugin", "\tcurrentsession = {0}", currentsession); DicConsole.DebugWriteLine("Nero plugin", "\tcurrentsessionmaxtrack = {0}", currentsessionmaxtrack); @@ -1522,7 +1522,7 @@ namespace DiscImageChef.ImagePlugins Track _track = new Track(); _track.Indexes = new Dictionary(); - if (_neroTrack.Index0 < _neroTrack.Index1) + if(_neroTrack.Index0 < _neroTrack.Index1) _track.Indexes.Add(0, _neroTrack.Index0 / _neroTrack.SectorSize); _track.Indexes.Add(1, _neroTrack.Index1 / _neroTrack.SectorSize); _track.TrackDescription = StringHandlers.CToString(_neroTrack.ISRC); @@ -1591,7 +1591,7 @@ namespace DiscImageChef.ImagePlugins DicConsole.DebugWriteLine("Nero plugin", "\t\t _track.TrackStartSector = {0}", _track.TrackStartSector); DicConsole.DebugWriteLine("Nero plugin", "\t\t _track.TrackType = {0}", _track.TrackType); - if (currentsessioncurrenttrack == 1) + if(currentsessioncurrenttrack == 1) { currentsessionstruct = new Session(); currentsessionstruct.SessionSequence = currentsession; @@ -1599,7 +1599,7 @@ namespace DiscImageChef.ImagePlugins currentsessionstruct.StartTrack = _track.TrackSequence; } currentsessioncurrenttrack++; - if (currentsessioncurrenttrack > currentsessionmaxtrack) + if(currentsessioncurrenttrack > currentsessionmaxtrack) { currentsession++; neroSessions.TryGetValue(currentsession, out currentsessionmaxtrack); @@ -1611,10 +1611,10 @@ namespace DiscImageChef.ImagePlugins offsetmap.Add(_track.TrackSequence, _track.TrackStartSector); DicConsole.DebugWriteLine("Nero plugin", "\t\t Offset[{0}]: {1}", _track.TrackSequence, _track.TrackStartSector); - + CommonTypes.Partition partition; - if (_neroTrack.Index0 < _neroTrack.Index1) + if(_neroTrack.Index0 < _neroTrack.Index1) { partition = new CommonTypes.Partition(); partition.PartitionDescription = String.Format("Track {0} Index 0", _track.TrackSequence); @@ -1679,7 +1679,7 @@ namespace DiscImageChef.ImagePlugins public override byte[] ReadDiskTag(MediaTagType tag) { - switch (tag) + switch(tag) { case MediaTagType.CD_MCN: return UPC; @@ -1712,15 +1712,15 @@ namespace DiscImageChef.ImagePlugins public override byte[] ReadSectors(UInt64 sectorAddress, UInt32 length) { - foreach (KeyValuePair kvp in offsetmap) + foreach(KeyValuePair kvp in offsetmap) { - if (sectorAddress >= kvp.Value) + if(sectorAddress >= kvp.Value) { - foreach (Track _track in imageTracks) + foreach(Track _track in imageTracks) { - if (_track.TrackSequence == kvp.Key) + if(_track.TrackSequence == kvp.Key) { - if ((sectorAddress - kvp.Value) < (_track.TrackEndSector - _track.TrackStartSector)) + if((sectorAddress - kvp.Value) < (_track.TrackEndSector - _track.TrackStartSector)) return ReadSectors((sectorAddress - kvp.Value), length, kvp.Key); } } @@ -1732,15 +1732,15 @@ namespace DiscImageChef.ImagePlugins public override byte[] ReadSectorsTag(UInt64 sectorAddress, UInt32 length, SectorTagType tag) { - foreach (KeyValuePair kvp in offsetmap) + foreach(KeyValuePair kvp in offsetmap) { - if (sectorAddress >= kvp.Value) + if(sectorAddress >= kvp.Value) { - foreach (Track _track in imageTracks) + foreach(Track _track in imageTracks) { - if (_track.TrackSequence == kvp.Key) + if(_track.TrackSequence == kvp.Key) { - if ((sectorAddress - kvp.Value) < (_track.TrackEndSector - _track.TrackStartSector)) + if((sectorAddress - kvp.Value) < (_track.TrackEndSector - _track.TrackStartSector)) return ReadSectorsTag((sectorAddress - kvp.Value), length, kvp.Key, tag); } } @@ -1754,17 +1754,17 @@ namespace DiscImageChef.ImagePlugins { NeroTrack _track; - if (!neroTracks.TryGetValue(track, out _track)) + if(!neroTracks.TryGetValue(track, out _track)) throw new ArgumentOutOfRangeException("track", "Track not found"); - if (length > _track.Sectors) + if(length > _track.Sectors) throw new ArgumentOutOfRangeException("length", "Requested more sectors than present in track, won't cross tracks"); uint sector_offset; uint sector_size; uint sector_skip; - switch ((DAOMode)_track.Mode) + switch((DAOMode)_track.Mode) { case DAOMode.Data: case DAOMode.DataM2F1: @@ -1802,7 +1802,7 @@ namespace DiscImageChef.ImagePlugins sector_skip = 4; break; } - // TODO: Supposing Nero suffixes the subchannel to the channel + // TODO: Supposing Nero suffixes the subchannel to the channel case DAOMode.DataRawSub: { sector_offset = 16; @@ -1831,14 +1831,14 @@ namespace DiscImageChef.ImagePlugins byte[] buffer = new byte[sector_size * length]; imageStream = new FileStream(_imagePath, FileMode.Open, FileAccess.Read); - using (BinaryReader br = new BinaryReader(imageStream)) + using(BinaryReader br = new BinaryReader(imageStream)) { br.BaseStream.Seek((long)_track.Offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), SeekOrigin.Begin); - if (sector_offset == 0 && sector_skip == 0) + if(sector_offset == 0 && sector_skip == 0) buffer = br.ReadBytes((int)(sector_size * length)); else { - for (int i = 0; i < length; i++) + for(int i = 0; i < length; i++) { byte[] sector; br.BaseStream.Seek(sector_offset, SeekOrigin.Current); @@ -1857,17 +1857,17 @@ namespace DiscImageChef.ImagePlugins { NeroTrack _track; - if (!neroTracks.TryGetValue(track, out _track)) + if(!neroTracks.TryGetValue(track, out _track)) throw new ArgumentOutOfRangeException("track", "Track not found"); - if (length > _track.Sectors) + if(length > _track.Sectors) throw new ArgumentOutOfRangeException("length", "Requested more sectors than present in track, won't cross tracks"); uint sector_offset; uint sector_size; uint sector_skip; - switch (tag) + switch(tag) { case SectorTagType.CDSectorECC: case SectorTagType.CDSectorECC_P: @@ -1883,7 +1883,7 @@ namespace DiscImageChef.ImagePlugins byte[] flags = new byte[1]; flags[0] = 0x00; - if ((DAOMode)_track.Mode != DAOMode.Audio && (DAOMode)_track.Mode != DAOMode.AudioSub) + if((DAOMode)_track.Mode != DAOMode.Audio && (DAOMode)_track.Mode != DAOMode.AudioSub) flags[0] += 0x40; return flags; @@ -1896,14 +1896,14 @@ namespace DiscImageChef.ImagePlugins throw new ArgumentException("Unsupported tag requested", "tag"); } - switch ((DAOMode)_track.Mode) + switch((DAOMode)_track.Mode) { case DAOMode.Data: case DAOMode.DataM2F1: throw new ArgumentException("No tags in image for requested track", "tag"); case DAOMode.DataM2F2: { - switch (tag) + switch(tag) { case SectorTagType.CDSectorSync: case SectorTagType.CDSectorHeader: @@ -1935,7 +1935,7 @@ namespace DiscImageChef.ImagePlugins throw new ArgumentException("There are no tags on audio tracks", "tag"); case DAOMode.DataRaw: { - switch (tag) + switch(tag) { case SectorTagType.CDSectorSync: { @@ -1987,12 +1987,12 @@ namespace DiscImageChef.ImagePlugins } break; } - // TODO + // TODO case DAOMode.DataM2RawSub: throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented"); case DAOMode.DataRawSub: { - switch (tag) + switch(tag) { case SectorTagType.CDSectorSync: { @@ -2052,7 +2052,7 @@ namespace DiscImageChef.ImagePlugins } case DAOMode.AudioSub: { - if (tag != SectorTagType.CDSectorSubchannel) + if(tag != SectorTagType.CDSectorSubchannel) throw new ArgumentException("Unsupported tag requested for this track", "tag"); sector_offset = 2352; @@ -2067,14 +2067,14 @@ namespace DiscImageChef.ImagePlugins byte[] buffer = new byte[sector_size * length]; imageStream = new FileStream(_imagePath, FileMode.Open, FileAccess.Read); - using (BinaryReader br = new BinaryReader(imageStream)) + using(BinaryReader br = new BinaryReader(imageStream)) { br.BaseStream.Seek((long)_track.Offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), SeekOrigin.Begin); - if (sector_offset == 0 && sector_skip == 0) + if(sector_offset == 0 && sector_skip == 0) buffer = br.ReadBytes((int)(sector_size * length)); else { - for (int i = 0; i < length; i++) + for(int i = 0; i < length; i++) { byte[] sector; br.BaseStream.Seek(sector_offset, SeekOrigin.Current); @@ -2101,15 +2101,15 @@ namespace DiscImageChef.ImagePlugins public override byte[] ReadSectorsLong(UInt64 sectorAddress, UInt32 length) { - foreach (KeyValuePair kvp in offsetmap) + foreach(KeyValuePair kvp in offsetmap) { - if (sectorAddress >= kvp.Value) + if(sectorAddress >= kvp.Value) { - foreach (Track _track in imageTracks) + foreach(Track _track in imageTracks) { - if (_track.TrackSequence == kvp.Key) + if(_track.TrackSequence == kvp.Key) { - if ((sectorAddress - kvp.Value) < (_track.TrackEndSector - _track.TrackStartSector)) + if((sectorAddress - kvp.Value) < (_track.TrackEndSector - _track.TrackStartSector)) return ReadSectorsLong((sectorAddress - kvp.Value), length, kvp.Key); } } @@ -2123,17 +2123,17 @@ namespace DiscImageChef.ImagePlugins { NeroTrack _track; - if (!neroTracks.TryGetValue(track, out _track)) + if(!neroTracks.TryGetValue(track, out _track)) throw new ArgumentOutOfRangeException("track", "Track not found"); - if (length > _track.Sectors) + if(length > _track.Sectors) throw new ArgumentOutOfRangeException("length", "Requested more sectors than present in track, won't cross tracks"); uint sector_offset; uint sector_size; uint sector_skip; - switch ((DAOMode)_track.Mode) + switch((DAOMode)_track.Mode) { case DAOMode.Data: case DAOMode.DataM2F1: @@ -2179,11 +2179,11 @@ namespace DiscImageChef.ImagePlugins br.BaseStream.Seek((long)_track.Offset + (long)(sectorAddress * (sector_offset + sector_size + sector_skip)), SeekOrigin.Begin); - if (sector_offset == 0 && sector_skip == 0) + if(sector_offset == 0 && sector_skip == 0) buffer = br.ReadBytes((int)(sector_size * length)); else { - for (int i = 0; i < length; i++) + for(int i = 0; i < length; i++) { byte[] sector; br.BaseStream.Seek(sector_offset, SeekOrigin.Current); @@ -2256,8 +2256,8 @@ namespace DiscImageChef.ImagePlugins public override List GetSessionTracks(UInt16 session) { List sessionTracks = new List(); - foreach (Track _track in imageTracks) - if (_track.TrackSession == session) + foreach(Track _track in imageTracks) + if(_track.TrackSession == session) sessionTracks.Add(_track); return sessionTracks; @@ -2288,12 +2288,12 @@ namespace DiscImageChef.ImagePlugins FailingLBAs = new List(); UnknownLBAs = new List(); - for (int i = 0; i < length; i++) + for(int i = 0; i < length; i++) { Array.Copy(buffer, i * bps, sector, 0, bps); bool? sectorStatus = Checksums.CDChecksums.CheckCDSector(sector); - switch (sectorStatus) + switch(sectorStatus) { case null: UnknownLBAs.Add((ulong)i + sectorAddress); @@ -2304,9 +2304,9 @@ namespace DiscImageChef.ImagePlugins } } - if (UnknownLBAs.Count > 0) + if(UnknownLBAs.Count > 0) return null; - if (FailingLBAs.Count > 0) + if(FailingLBAs.Count > 0) return false; return true; } @@ -2319,12 +2319,12 @@ namespace DiscImageChef.ImagePlugins FailingLBAs = new List(); UnknownLBAs = new List(); - for (int i = 0; i < length; i++) + for(int i = 0; i < length; i++) { Array.Copy(buffer, i * bps, sector, 0, bps); bool? sectorStatus = Checksums.CDChecksums.CheckCDSector(sector); - switch (sectorStatus) + switch(sectorStatus) { case null: UnknownLBAs.Add((ulong)i + sectorAddress); @@ -2335,9 +2335,9 @@ namespace DiscImageChef.ImagePlugins } } - if (UnknownLBAs.Count > 0) + if(UnknownLBAs.Count > 0) return null; - if (FailingLBAs.Count > 0) + if(FailingLBAs.Count > 0) return false; return true; } @@ -2353,7 +2353,7 @@ namespace DiscImageChef.ImagePlugins static MediaType NeroMediaTypeToMediaType(NeroMediaTypes type) { - switch (type) + switch(type) { case NeroMediaTypes.NERO_MTYP_DDCD: return MediaType.DDCD; @@ -2406,7 +2406,7 @@ namespace DiscImageChef.ImagePlugins static TrackType NeroTrackModeToTrackType(DAOMode mode) { - switch (mode) + switch(mode) { case DAOMode.Data: case DAOMode.DataRaw: @@ -2429,7 +2429,7 @@ namespace DiscImageChef.ImagePlugins static UInt16 NeroTrackModeToBytesPerSector(DAOMode mode) { - switch (mode) + switch(mode) { case DAOMode.Data: case DAOMode.DataM2F1: diff --git a/DiscImageChef.DiscImages/TeleDisk.cs b/DiscImageChef.DiscImages/TeleDisk.cs index 81dc858b2..19fd3d1e7 100644 --- a/DiscImageChef.DiscImages/TeleDisk.cs +++ b/DiscImageChef.DiscImages/TeleDisk.cs @@ -242,7 +242,7 @@ namespace DiscImageChef.ImagePlugins header.signature = BitConverter.ToUInt16(headerBytes, 0); - if (header.signature != tdMagic && header.signature != tdAdvCompMagic) + if(header.signature != tdMagic && header.signature != tdAdvCompMagic) return false; header.sequence = headerBytes[2]; @@ -275,16 +275,16 @@ namespace DiscImageChef.ImagePlugins // This may deny legal images // That would be much of a coincidence - if (header.crc == calculatedHeaderCRC) + if(header.crc == calculatedHeaderCRC) return true; - if (header.sequence != 0x00) + if(header.sequence != 0x00) return false; - if (header.dataRate != DataRate250kbps && header.dataRate != DataRate300kbps && header.dataRate != DataRate500kbps) + if(header.dataRate != DataRate250kbps && header.dataRate != DataRate300kbps && header.dataRate != DataRate500kbps) return false; - if (header.driveType != DriveType35DD && header.driveType != DriveType35ED && header.driveType != DriveType35HD && header.driveType != DriveType525DD && + if(header.driveType != DriveType35DD && header.driveType != DriveType35ED && header.driveType != DriveType35HD && header.driveType != DriveType525DD && header.driveType != DriveType525HD && header.driveType != DriveType525HD_DDDisk && header.driveType != DriveType8inch) return false; @@ -296,14 +296,14 @@ namespace DiscImageChef.ImagePlugins header = new TD0Header(); byte[] headerBytes = new byte[12]; FileStream stream = new FileStream(imagePath, FileMode.Open, FileAccess.Read); - + stream.Read(headerBytes, 0, 12); - + header.signature = BitConverter.ToUInt16(headerBytes, 0); - - if (header.signature != tdMagic && header.signature != tdAdvCompMagic) + + if(header.signature != tdMagic && header.signature != tdAdvCompMagic) return false; - + header.sequence = headerBytes[2]; header.diskSet = headerBytes[3]; header.version = headerBytes[4]; @@ -321,7 +321,7 @@ namespace DiscImageChef.ImagePlugins byte[] headerBytesForCRC = new byte[10]; Array.Copy(headerBytes, headerBytesForCRC, 10); UInt16 calculatedHeaderCRC = TeleDiskCRC(0x0000, headerBytesForCRC); - + DicConsole.DebugWriteLine("TeleDisk plugin", "header.signature = 0x{0:X4}", header.signature); DicConsole.DebugWriteLine("TeleDisk plugin", "header.sequence = 0x{0:X2}", header.sequence); DicConsole.DebugWriteLine("TeleDisk plugin", "header.diskSet = 0x{0:X2}", header.diskSet); @@ -336,30 +336,30 @@ namespace DiscImageChef.ImagePlugins // We need more checks as the magic is too simply. // This may deny legal images - + // That would be much of a coincidence - if (header.crc != calculatedHeaderCRC) + if(header.crc != calculatedHeaderCRC) { ADiskCRCHasFailed = true; DicConsole.DebugWriteLine("TeleDisk plugin", "Calculated CRC does not coincide with stored one."); } - if (header.sequence != 0x00) + if(header.sequence != 0x00) return false; - - if (header.dataRate != DataRate250kbps && header.dataRate != DataRate300kbps && header.dataRate != DataRate500kbps) + + if(header.dataRate != DataRate250kbps && header.dataRate != DataRate300kbps && header.dataRate != DataRate500kbps) return false; - - if (header.driveType != DriveType35DD && header.driveType != DriveType35ED && header.driveType != DriveType35HD && header.driveType != DriveType525DD && + + if(header.driveType != DriveType35DD && header.driveType != DriveType35ED && header.driveType != DriveType35HD && header.driveType != DriveType525DD && header.driveType != DriveType525HD && header.driveType != DriveType525HD_DDDisk && header.driveType != DriveType8inch) return false; - if (header.signature == tdAdvCompMagic) + if(header.signature == tdAdvCompMagic) throw new NotImplementedException("TeleDisk Advanced Compression support not yet implemented"); ImageInfo.imageCreationTime = DateTime.MinValue; - if ((header.stepping & CommentBlockPresent) == CommentBlockPresent) + if((header.stepping & CommentBlockPresent) == CommentBlockPresent) { commentHeader = new TDCommentBlockHeader(); @@ -398,10 +398,10 @@ namespace DiscImageChef.ImagePlugins ADiskCRCHasFailed |= cmtcrc != commentHeader.crc; - for (int i = 0; i < commentBlock.Length; i++) + for(int i = 0; i < commentBlock.Length; i++) { // Replace NULLs, used by TeleDisk as newline markers, with UNIX newline marker - if (commentBlock[i] == 0x00) + if(commentBlock[i] == 0x00) commentBlock[i] = 0x0A; } @@ -415,7 +415,7 @@ namespace DiscImageChef.ImagePlugins } FileInfo fi = new FileInfo(imagePath); - if (ImageInfo.imageCreationTime == DateTime.MinValue) + if(ImageInfo.imageCreationTime == DateTime.MinValue) ImageInfo.imageCreationTime = fi.CreationTimeUtc; ImageInfo.imageLastModificationTime = fi.LastWriteTimeUtc; @@ -429,7 +429,7 @@ namespace DiscImageChef.ImagePlugins ImageInfo.imageSize = 0; sectorsData = new Dictionary(); ImageInfo.sectorSize = 0; - while (true) + while(true) { TDTrackHeader TDTrack = new TDTrackHeader(); byte[] TDTrackForCRC = new byte[3]; @@ -454,7 +454,7 @@ namespace DiscImageChef.ImagePlugins ADiskCRCHasFailed |= TDTrackCalculatedCRC != TDTrack.crc; - if (TDTrack.sectors == 0xFF) // End of disk image + if(TDTrack.sectors == 0xFF) // End of disk image { DicConsole.DebugWriteLine("TeleDisk plugin", "End of disk image arrived"); DicConsole.DebugWriteLine("TeleDisk plugin", "Total of {0} data sectors, for {1} bytes", sectorsData.Count, totalDiskSize); @@ -462,14 +462,14 @@ namespace DiscImageChef.ImagePlugins break; } - if (spt != TDTrack.sectors && TDTrack.sectors > 0) + if(spt != TDTrack.sectors && TDTrack.sectors > 0) { - if (spt != 0) + if(spt != 0) throw new FeatureUnsupportedImageException("Variable number of sectors per track. This kind of image is not yet supported"); spt = TDTrack.sectors; } - for (byte processedSectors = 0; processedSectors < TDTrack.sectors; processedSectors++) + for(byte processedSectors = 0; processedSectors < TDTrack.sectors; processedSectors++) { TDSectorHeader TDSector = new TDSectorHeader(); TDDataHeader TDData = new TDDataHeader(); @@ -493,7 +493,7 @@ namespace DiscImageChef.ImagePlugins DicConsole.DebugWriteLine("TeleDisk plugin", "\t\tSector CRC (plus headers): 0x{0:X2}", TDSector.crc); UInt32 LBA = (uint)((TDSector.cylinder * header.sides * spt) + (TDSector.head * spt) + (TDSector.sectorNumber - 1)); - if ((TDSector.flags & FlagsSectorDataless) != FlagsSectorDataless && (TDSector.flags & FlagsSectorSkipped) != FlagsSectorSkipped) + if((TDSector.flags & FlagsSectorDataless) != FlagsSectorDataless && (TDSector.flags & FlagsSectorSkipped) != FlagsSectorSkipped) { stream.Read(dataSizeBytes, 0, 2); TDData.dataSize = BitConverter.ToUInt16(dataSizeBytes, 0); @@ -509,17 +509,17 @@ namespace DiscImageChef.ImagePlugins byte TDSectorCalculatedCRC = (byte)(TeleDiskCRC(0, decodedData) & 0xFF); - if (TDSectorCalculatedCRC != TDSector.crc) + if(TDSectorCalculatedCRC != TDSector.crc) { DicConsole.DebugWriteLine("TeleDisk plugin", "Sector LBA {0} calculated CRC 0x{1:X2} differs from stored CRC 0x{2:X2}", LBA, TDSectorCalculatedCRC, TDSector.crc); - if ((TDSector.flags & FlagsSectorNoID) != FlagsSectorNoID) - if (!sectorsData.ContainsKey(LBA) && (TDSector.flags & FlagsSectorDuplicate) != FlagsSectorDuplicate) - SectorsWhereCRCHasFailed.Add((UInt64)LBA); + if((TDSector.flags & FlagsSectorNoID) != FlagsSectorNoID) + if(!sectorsData.ContainsKey(LBA) && (TDSector.flags & FlagsSectorDuplicate) != FlagsSectorDuplicate) + SectorsWhereCRCHasFailed.Add((UInt64)LBA); } } else { - switch (TDSector.sectorSize) + switch(TDSector.sectorSize) { case SectorSize128: decodedData = new byte[128]; @@ -550,11 +550,11 @@ namespace DiscImageChef.ImagePlugins } DicConsole.DebugWriteLine("TeleDisk plugin", "\t\tLBA: {0}", LBA); - if ((TDSector.flags & FlagsSectorNoID) != FlagsSectorNoID) + if((TDSector.flags & FlagsSectorNoID) != FlagsSectorNoID) { - if (sectorsData.ContainsKey(LBA)) + if(sectorsData.ContainsKey(LBA)) { - if ((TDSector.flags & FlagsSectorDuplicate) == FlagsSectorDuplicate) + if((TDSector.flags & FlagsSectorDuplicate) == FlagsSectorDuplicate) { DicConsole.DebugWriteLine("TeleDisk plugin", "\t\tSector {0} on cylinder {1} head {2} is duplicate, and marked so", TDSector.sectorNumber, TDSector.cylinder, TDSector.head); @@ -571,7 +571,7 @@ namespace DiscImageChef.ImagePlugins totalDiskSize += (uint)decodedData.Length; } } - if (decodedData.Length > ImageInfo.sectorSize) + if(decodedData.Length > ImageInfo.sectorSize) ImageInfo.sectorSize = (uint)decodedData.Length; } } @@ -613,27 +613,27 @@ namespace DiscImageChef.ImagePlugins public override byte[] ReadSectors(UInt64 sectorAddress, UInt32 length) { - if (sectorAddress > (ulong)sectorsData.Count - 1) + if(sectorAddress > (ulong)sectorsData.Count - 1) throw new ArgumentOutOfRangeException("sectorAddress", "Sector address not found"); - if (sectorAddress + length > (ulong)sectorsData.Count) + if(sectorAddress + length > (ulong)sectorsData.Count) throw new ArgumentOutOfRangeException("length", "Requested more sectors than available"); byte[] data = new byte[1]; // To make compiler happy bool first = true; int dataPosition = 0; - for (ulong i = sectorAddress; i < (sectorAddress + length); i++) + for(ulong i = sectorAddress; i < (sectorAddress + length); i++) { - if (!sectorsData.ContainsKey((uint)i)) + if(!sectorsData.ContainsKey((uint)i)) throw new ImageNotSupportedException(String.Format("Requested sector {0} not found", i)); byte[] sector; - if (!sectorsData.TryGetValue((uint)i, out sector)) + if(!sectorsData.TryGetValue((uint)i, out sector)) throw new ImageNotSupportedException(String.Format("Error reading sector {0}", i)); - if (first) + if(first) { data = new byte[sector.Length]; Array.Copy(sector, data, sector.Length); @@ -660,22 +660,22 @@ namespace DiscImageChef.ImagePlugins return ReadSectors(sectorAddress, length); } - public override string GetImageFormat() - { + public override string GetImageFormat() + { return "Sydex TeleDisk"; } - public override string GetImageVersion() + public override string GetImageVersion() { return ImageInfo.imageVersion; } - public override string GetImageApplication() + public override string GetImageApplication() { return ImageInfo.imageApplication; } - public override string GetImageApplicationVersion() + public override string GetImageApplicationVersion() { return ImageInfo.imageApplicationVersion; } @@ -690,7 +690,7 @@ namespace DiscImageChef.ImagePlugins return ImageInfo.imageLastModificationTime; } - public override string GetImageName() + public override string GetImageName() { return ImageInfo.imageName; } @@ -715,8 +715,8 @@ namespace DiscImageChef.ImagePlugins FailingLBAs = new List(); UnknownLBAs = new List(); - for (UInt64 i = sectorAddress; i < sectorAddress + length; i++) - if (SectorsWhereCRCHasFailed.Contains(sectorAddress)) + for(UInt64 i = sectorAddress; i < sectorAddress + length; i++) + if(SectorsWhereCRCHasFailed.Contains(sectorAddress)) FailingLBAs.Add(sectorAddress); return FailingLBAs.Count <= 0; @@ -727,7 +727,7 @@ namespace DiscImageChef.ImagePlugins FailingLBAs = new List(); UnknownLBAs = new List(); - for (UInt64 i = sectorAddress; i < sectorAddress + length; i++) + for(UInt64 i = sectorAddress; i < sectorAddress + length; i++) UnknownLBAs.Add(i); return null; @@ -744,13 +744,13 @@ namespace DiscImageChef.ImagePlugins { int counter = 0; - while (counter < buffer.Length) + while(counter < buffer.Length) { crc ^= (UInt16)((buffer[counter] & 0xFF) << 8); - for (int i = 0; i < 8; i++) + for(int i = 0; i < 8; i++) { - if ((crc & 0x8000) > 0) + if((crc & 0x8000) > 0) crc = (UInt16)((crc << 1) ^ TeleDiskCRCPoly); else crc = (UInt16)(crc << 1); @@ -765,7 +765,7 @@ namespace DiscImageChef.ImagePlugins static byte[] DecodeTeleDiskData(byte sectorSize, byte encodingType, byte[] encodedData) { byte[] decodedData; - switch (sectorSize) + switch(sectorSize) { case SectorSize128: decodedData = new byte[128]; @@ -792,7 +792,7 @@ namespace DiscImageChef.ImagePlugins throw new ImageNotSupportedException(String.Format("Sector size {0} is incorrect.", sectorSize)); } - switch (encodingType) + switch(encodingType) { case dataBlockCopy: Array.Copy(encodedData, decodedData, decodedData.Length); @@ -801,7 +801,7 @@ namespace DiscImageChef.ImagePlugins { int ins = 0; int outs = 0; - while (ins < encodedData.Length) + while(ins < encodedData.Length) { UInt16 repeatNumber; byte[] repeatValue = new byte[2]; @@ -825,7 +825,7 @@ namespace DiscImageChef.ImagePlugins { int ins = 0; int outs = 0; - while (ins < encodedData.Length) + while(ins < encodedData.Length) { byte Run; byte Length; @@ -833,7 +833,7 @@ namespace DiscImageChef.ImagePlugins byte[] Piece; Encoding = encodedData[ins]; - if (Encoding == 0x00) + if(Encoding == 0x00) { Length = encodedData[ins + 1]; Array.Copy(encodedData, ins + 2, decodedData, outs, Length); @@ -870,18 +870,18 @@ namespace DiscImageChef.ImagePlugins MediaType DecodeTeleDiskDiskType() { - switch (header.driveType) + switch(header.driveType) { case DriveType525DD: case DriveType525HD_DDDisk: case DriveType525HD: { - switch (totalDiskSize) + switch(totalDiskSize) { case 163840: { // Acorn disk uses 256 bytes/sector - if (ImageInfo.sectorSize == 256) + if(ImageInfo.sectorSize == 256) return MediaType.ACORN_525_SS_DD_40; else // DOS disks use 512 bytes/sector return MediaType.DOS_525_SS_DD_8; @@ -889,7 +889,7 @@ namespace DiscImageChef.ImagePlugins case 184320: { // Atari disk uses 256 bytes/sector - if (ImageInfo.sectorSize == 256) + if(ImageInfo.sectorSize == 256) return MediaType.ATARI_525_DD; else // DOS disks use 512 bytes/sector return MediaType.DOS_525_SS_DD_9; @@ -897,7 +897,7 @@ namespace DiscImageChef.ImagePlugins case 327680: { // Acorn disk uses 256 bytes/sector - if (ImageInfo.sectorSize == 256) + if(ImageInfo.sectorSize == 256) return MediaType.ACORN_525_SS_DD_80; else // DOS disks use 512 bytes/sector return MediaType.DOS_525_DS_DD_8; @@ -947,7 +947,7 @@ namespace DiscImageChef.ImagePlugins case DriveType35ED: case DriveType35HD: { - switch (totalDiskSize) + switch(totalDiskSize) { case 327680: return MediaType.DOS_35_SS_DD_8; @@ -989,7 +989,7 @@ namespace DiscImageChef.ImagePlugins } case DriveType8inch: { - switch (totalDiskSize) + switch(totalDiskSize) { case 81664: return MediaType.IBM23FD; @@ -1015,7 +1015,7 @@ namespace DiscImageChef.ImagePlugins case 512512: { // DEC disk uses 256 bytes/sector - if (ImageInfo.sectorSize == 256) + if(ImageInfo.sectorSize == 256) return MediaType.RX02; else // ECMA disks use 128 bytes/sector return MediaType.ECMA_59; @@ -1068,42 +1068,42 @@ namespace DiscImageChef.ImagePlugins return ImageInfo.imageCreator; } - public override string GetImageComments() + public override string GetImageComments() { return ImageInfo.imageComments; } - public override string GetMediaManufacturer() + public override string GetMediaManufacturer() { return ImageInfo.mediaManufacturer; } - public override string GetMediaModel() + public override string GetMediaModel() { return ImageInfo.mediaModel; } - public override string GetMediaSerialNumber() + public override string GetMediaSerialNumber() { return ImageInfo.mediaSerialNumber; } - public override string GetMediaBarcode() + public override string GetMediaBarcode() { return ImageInfo.mediaBarcode; } - public override string GetMediaPartNumber() + public override string GetMediaPartNumber() { return ImageInfo.mediaPartNumber; } - public override int GetMediaSequence() + public override int GetMediaSequence() { return ImageInfo.mediaSequence; } - public override int GetLastDiskSequence() + public override int GetLastDiskSequence() { return ImageInfo.lastMediaSequence; } diff --git a/DiscImageChef.DiscImages/VHD.cs b/DiscImageChef.DiscImages/VHD.cs index d4386e912..ac2be15eb 100644 --- a/DiscImageChef.DiscImages/VHD.cs +++ b/DiscImageChef.DiscImages/VHD.cs @@ -404,7 +404,7 @@ namespace DiscImageChef.ImagePlugins byte[] headerCookieBytes = new byte[8]; byte[] footerCookieBytes = new byte[8]; - if ((imageStream.Length % 2) == 0) + if((imageStream.Length % 2) == 0) imageStream.Seek(-512, SeekOrigin.End); else imageStream.Seek(-511, SeekOrigin.End); @@ -429,7 +429,7 @@ namespace DiscImageChef.ImagePlugins imageStream.Seek(0, SeekOrigin.Begin); imageStream.Read(header, 0, 512); - if ((imageStream.Length % 2) == 0) + if((imageStream.Length % 2) == 0) { footer = new byte[512]; imageStream.Seek(-512, SeekOrigin.End); @@ -467,12 +467,12 @@ namespace DiscImageChef.ImagePlugins byte[] usableHeader; UInt32 usableChecksum; - if (headerCookie == ImageCookie && headerChecksum == headerCalculatedChecksum) + if(headerCookie == ImageCookie && headerChecksum == headerCalculatedChecksum) { usableHeader = header; usableChecksum = headerChecksum; } - else if (footerCookie == ImageCookie && footerChecksum == footerCalculatedChecksum) + else if(footerCookie == ImageCookie && footerChecksum == footerCalculatedChecksum) { usableHeader = footer; usableChecksum = footerChecksum; @@ -526,12 +526,12 @@ namespace DiscImageChef.ImagePlugins DicConsole.DebugWriteLine("VirtualPC plugin", "footer.savedState = 0x{0:X2}", thisFooter.savedState); DicConsole.DebugWriteLine("VirtualPC plugin", "footer.reserved's SHA1 = 0x{0}", sha1Ctx.End()); - if (thisFooter.version == Version1) + if(thisFooter.version == Version1) ImageInfo.imageVersion = "1.0"; else throw new ImageNotSupportedException(String.Format("(VirtualPC plugin): Unknown image type {0} found. Please submit a bug with an example image.", thisFooter.diskType)); - switch (thisFooter.creatorApplication) + switch(thisFooter.creatorApplication) { case CreatorQEMU: { @@ -544,7 +544,7 @@ namespace DiscImageChef.ImagePlugins case CreatorVirtualBox: { ImageInfo.imageApplicationVersion = String.Format("{0}.{1:D2}", (thisFooter.creatorVersion & 0xFFFF0000) >> 16, (thisFooter.creatorVersion & 0x0000FFFF)); - switch (thisFooter.creatorHostOS) + switch(thisFooter.creatorHostOS) { case CreatorMacintosh: case CreatorMacintoshOld: @@ -563,7 +563,7 @@ namespace DiscImageChef.ImagePlugins case CreatorVirtualServer: { ImageInfo.imageApplication = "Microsoft Virtual Server"; - switch (thisFooter.creatorVersion) + switch(thisFooter.creatorVersion) { case VersionVirtualServer2004: ImageInfo.imageApplicationVersion = "2004"; @@ -576,11 +576,11 @@ namespace DiscImageChef.ImagePlugins } case CreatorVirtualPC: { - switch (thisFooter.creatorHostOS) + switch(thisFooter.creatorHostOS) { case CreatorMacintosh: case CreatorMacintoshOld: - switch (thisFooter.creatorVersion) + switch(thisFooter.creatorVersion) { case VersionVirtualPCMac: ImageInfo.imageApplication = "Connectix Virtual PC"; @@ -592,7 +592,7 @@ namespace DiscImageChef.ImagePlugins } break; case CreatorWindows: - switch (thisFooter.creatorVersion) + switch(thisFooter.creatorVersion) { case VersionVirtualPCMac: ImageInfo.imageApplication = "Connectix Virtual PC"; @@ -635,8 +635,8 @@ namespace DiscImageChef.ImagePlugins ImageInfo.imageCreationTime = fi.CreationTimeUtc; ImageInfo.imageLastModificationTime = thisDateTime; ImageInfo.imageName = Path.GetFileNameWithoutExtension(imagePath); - - if (thisFooter.diskType == typeDynamic || thisFooter.diskType == typeDifferencing) + + if(thisFooter.diskType == typeDynamic || thisFooter.diskType == typeDifferencing) { imageStream.Seek((long)thisFooter.offset, SeekOrigin.Begin); byte[] dynamicBytes = new byte[1024]; @@ -653,14 +653,14 @@ namespace DiscImageChef.ImagePlugins DicConsole.DebugWriteLine("VirtualPC plugin", "Dynamic header checksum = 0x{0:X8}, calculated = 0x{1:X8}", dynamicChecksum, dynamicChecksumCalculated); - if (dynamicChecksum != dynamicChecksumCalculated) + if(dynamicChecksum != dynamicChecksumCalculated) throw new ImageNotSupportedException("(VirtualPC plugin): Both header and footer are corrupt, image cannot be opened."); thisDynamic = new DynamicDiskHeader(); thisDynamic.locatorEntries = new ParentLocatorEntry[8]; thisDynamic.reserved2 = new byte[256]; - for (int i = 0; i < 8; i++) + for(int i = 0; i < 8; i++) thisDynamic.locatorEntries[i] = new ParentLocatorEntry(); thisDynamic.cookie = BigEndianBitConverter.ToUInt64(dynamicBytes, 0x00); @@ -675,7 +675,7 @@ namespace DiscImageChef.ImagePlugins thisDynamic.reserved = BigEndianBitConverter.ToUInt32(dynamicBytes, 0x3C); thisDynamic.parentName = Encoding.BigEndianUnicode.GetString(dynamicBytes, 0x40, 512); - for (int i = 0; i < 8; i++) + for(int i = 0; i < 8; i++) { thisDynamic.locatorEntries[i].platformCode = BigEndianBitConverter.ToUInt32(dynamicBytes, 0x240 + 0x00 + 24 * i); thisDynamic.locatorEntries[i].platformDataSpace = BigEndianBitConverter.ToUInt32(dynamicBytes, 0x240 + 0x04 + 24 * i); @@ -703,7 +703,7 @@ namespace DiscImageChef.ImagePlugins DicConsole.DebugWriteLine("VirtualPC plugin", "dynamic.parentID = {0}", thisDynamic.parentID); DicConsole.DebugWriteLine("VirtualPC plugin", "dynamic.parentTimestamp = 0x{0:X8} ({1})", thisDynamic.parentTimestamp, parentDateTime); DicConsole.DebugWriteLine("VirtualPC plugin", "dynamic.reserved = 0x{0:X8}", thisDynamic.reserved); - for (int i = 0; i < 8; i++) + for(int i = 0; i < 8; i++) { DicConsole.DebugWriteLine("VirtualPC plugin", "dynamic.locatorEntries[{0}].platformCode = 0x{1:X8} (\"{2}\")", i, thisDynamic.locatorEntries[i].platformCode, Encoding.ASCII.GetString(BigEndianBitConverter.GetBytes(thisDynamic.locatorEntries[i].platformCode))); @@ -715,7 +715,7 @@ namespace DiscImageChef.ImagePlugins DicConsole.DebugWriteLine("VirtualPC plugin", "dynamic.parentName = \"{0}\"", thisDynamic.parentName); DicConsole.DebugWriteLine("VirtualPC plugin", "dynamic.reserved2's SHA1 = 0x{0}", sha1Ctx.End()); - if (thisDynamic.headerVersion != Version1) + if(thisDynamic.headerVersion != Version1) throw new ImageNotSupportedException(String.Format("(VirtualPC plugin): Unknown image type {0} found. Please submit a bug with an example image.", thisFooter.diskType)); DateTime startTime = DateTime.UtcNow; @@ -741,7 +741,7 @@ namespace DiscImageChef.ImagePlugins BATSector batSector = new BATSector(); // Unsafe and fast code. It takes 4 ms to fill a 30720 entries BAT - for (int i = 0; i < batSectorCount; i++) + for(int i = 0; i < batSectorCount; i++) { imageStream.Seek((long)thisDynamic.tableOffset + i * 512, SeekOrigin.Begin); imageStream.Read(batSectorBytes, 0, 512); @@ -752,7 +752,7 @@ namespace DiscImageChef.ImagePlugins handle.Free(); // This restores the order of elements Array.Reverse(batSector.blockPointer); - if (blockAllocationTable.Length >= (i * 512) / 4 + 512 / 4) + if(blockAllocationTable.Length >= (i * 512) / 4 + 512 / 4) Array.Copy(batSector.blockPointer, 0, blockAllocationTable, (i * 512) / 4, 512 / 4); else Array.Copy(batSector.blockPointer, 0, blockAllocationTable, (i * 512) / 4, blockAllocationTable.Length - (i * 512) / 4); @@ -780,7 +780,7 @@ namespace DiscImageChef.ImagePlugins ImageInfo.xmlMediaType = XmlMediaType.BlockMedia; - switch (thisFooter.diskType) + switch(thisFooter.diskType) { case typeFixed: case typeDynamic: @@ -792,15 +792,15 @@ namespace DiscImageChef.ImagePlugins case typeDifferencing: { locatorEntriesData = new byte[8][]; - for (int i = 0; i < 8; i++) + for(int i = 0; i < 8; i++) { - if (thisDynamic.locatorEntries[i].platformCode != 0x00000000) + if(thisDynamic.locatorEntries[i].platformCode != 0x00000000) { locatorEntriesData[i] = new byte[thisDynamic.locatorEntries[i].platformDataLength]; imageStream.Seek((long)thisDynamic.locatorEntries[i].platformDataOffset, SeekOrigin.Begin); imageStream.Read(locatorEntriesData[i], 0, (int)thisDynamic.locatorEntries[i].platformDataLength); - switch (thisDynamic.locatorEntries[i].platformCode) + switch(thisDynamic.locatorEntries[i].platformCode) { case platformCodeWindowsAbsolute: case platformCodeWindowsRelative: @@ -825,9 +825,9 @@ namespace DiscImageChef.ImagePlugins bool locatorFound = false; string parentPath = null; - while (!locatorFound && currentLocator < 8) + while(!locatorFound && currentLocator < 8) { - switch (thisDynamic.locatorEntries[currentLocator].platformCode) + switch(thisDynamic.locatorEntries[currentLocator].platformCode) { case platformCodeWindowsAbsolute: case platformCodeWindowsRelative: @@ -839,7 +839,7 @@ namespace DiscImageChef.ImagePlugins break; case platformCodeMacintoshURI: parentPath = Uri.UnescapeDataString(Encoding.UTF8.GetString(locatorEntriesData[currentLocator])); - if (parentPath.StartsWith("file://localhost", StringComparison.InvariantCulture)) + if(parentPath.StartsWith("file://localhost", StringComparison.InvariantCulture)) parentPath = parentPath.Remove(0, 16); else { @@ -849,32 +849,32 @@ namespace DiscImageChef.ImagePlugins break; } - if (parentPath != null) + if(parentPath != null) { DicConsole.DebugWriteLine("VirtualPC plugin", "Possible parent path: \"{0}\"", parentPath); locatorFound |= File.Exists(parentPath); - if (!locatorFound) + if(!locatorFound) parentPath = null; } currentLocator++; } - if (!locatorFound || parentPath == null) + if(!locatorFound || parentPath == null) throw new FileNotFoundException("(VirtualPC plugin): Cannot find parent file for differencing disk image"); else { parentImage = new VHD(); -/* PluginBase plugins = new PluginBase(); - plugins.RegisterAllPlugins(); - if (!plugins.ImagePluginsList.TryGetValue(Name.ToLower(), out parentImage)) - throw new SystemException("(VirtualPC plugin): Unable to open myself");*/ + /* PluginBase plugins = new PluginBase(); + plugins.RegisterAllPlugins(); + if (!plugins.ImagePluginsList.TryGetValue(Name.ToLower(), out parentImage)) + throw new SystemException("(VirtualPC plugin): Unable to open myself");*/ - if (!parentImage.IdentifyImage(parentPath)) + if(!parentImage.IdentifyImage(parentPath)) throw new ImageNotSupportedException("(VirtualPC plugin): Parent image is not a Virtual PC disk image"); - if (!parentImage.OpenImage(parentPath)) + if(!parentImage.OpenImage(parentPath)) throw new ImageNotSupportedException("(VirtualPC plugin): Cannot open parent disk image"); // While specification says that parent and child disk images should contain UUID relationship @@ -882,7 +882,7 @@ namespace DiscImageChef.ImagePlugins // the parent never stored itself. So the only real way to know that images are related is // because the parent IS found and SAME SIZE. Ugly... // More funny even, tested parent images show an empty host OS, and child images a correct one. - if (parentImage.GetSectors() != GetSectors()) + if(parentImage.GetSectors() != GetSectors()) throw new ImageNotSupportedException("(VirtualPC plugin): Parent image is of different size"); } @@ -923,7 +923,7 @@ namespace DiscImageChef.ImagePlugins public override string GetImageFormat() { - switch (thisFooter.diskType) + switch(thisFooter.diskType) { case typeFixed: return "Virtual PC fixed size disk image"; @@ -978,7 +978,7 @@ namespace DiscImageChef.ImagePlugins public override byte[] ReadSector(ulong sectorAddress) { - switch (thisFooter.diskType) + switch(thisFooter.diskType) { case typeDifferencing: { @@ -1019,7 +1019,7 @@ namespace DiscImageChef.ImagePlugins */ // Sector has been written, read from child image - if (dirty) + if(dirty) { /* Too noisy DicConsole.DebugWriteLine("VirtualPC plugin", "Sector {0} is dirty", sectorAddress); @@ -1051,7 +1051,7 @@ namespace DiscImageChef.ImagePlugins public override byte[] ReadSectors(ulong sectorAddress, uint length) { - switch (thisFooter.diskType) + switch(thisFooter.diskType) { case typeFixed: { @@ -1066,10 +1066,10 @@ namespace DiscImageChef.ImagePlugins thisStream.Close(); return data; } - // Contrary to Microsoft's specifications that tell us to check the bitmap - // and in case of unused sector just return zeros, as blocks are allocated - // as a whole, this would waste time and miss cache, so we read any sector - // as long as it is in the block. + // Contrary to Microsoft's specifications that tell us to check the bitmap + // and in case of unused sector just return zeros, as blocks are allocated + // as a whole, this would waste time and miss cache, so we read any sector + // as long as it is in the block. case typeDynamic: { FileStream thisStream; @@ -1090,7 +1090,7 @@ namespace DiscImageChef.ImagePlugins UInt32 sectorsToReadHere; // Asked to read more sectors than are remaining in block - if (length > remainingInBlock) + if(length > remainingInBlock) { suffix = ReadSectors(sectorAddress + remainingInBlock, length - remainingInBlock); sectorsToReadHere = remainingInBlock; @@ -1103,7 +1103,7 @@ namespace DiscImageChef.ImagePlugins prefix = new byte[sectorsToReadHere * 512]; // 0xFFFFFFFF means unallocated - if (sectorOffset != 0xFFFFFFFF) + if(sectorOffset != 0xFFFFFFFF) { thisStream = new FileStream(thisPath, FileMode.Open, FileAccess.Read); thisStream.Seek((long)(sectorOffset * 512), SeekOrigin.Begin); @@ -1115,7 +1115,7 @@ namespace DiscImageChef.ImagePlugins Array.Clear(prefix, 0, prefix.Length); // If we needed to read from another block, join all the data - if (suffix != null) + if(suffix != null) { byte[] data = new byte[512 * length]; Array.Copy(prefix, 0, data, 0, prefix.Length); @@ -1130,7 +1130,7 @@ namespace DiscImageChef.ImagePlugins // As on differencing images, each independent sector can be read from child or parent // image, we must read sector one by one byte[] fullData = new byte[512 * length]; - for (ulong i = 0; i < length; i++) + for(ulong i = 0; i < length; i++) { byte[] oneSector = ReadSector(sectorAddress + i); Array.Copy(oneSector, 0, fullData, (int)(i * 512), 512); @@ -1157,7 +1157,7 @@ namespace DiscImageChef.ImagePlugins static UInt32 VHDChecksum(byte[] data) { UInt32 checksum = 0; - foreach (byte b in data) + foreach(byte b in data) checksum += b; return ~checksum; } @@ -1315,7 +1315,7 @@ namespace DiscImageChef.ImagePlugins { FailingLBAs = new List(); UnknownLBAs = new List(); - for (ulong i = 0; i < ImageInfo.sectors; i++) + for(ulong i = 0; i < ImageInfo.sectors; i++) UnknownLBAs.Add(i); return null; } diff --git a/DiscImageChef.DiscImages/ZZZRawImage.cs b/DiscImageChef.DiscImages/ZZZRawImage.cs index 381c5620b..7e4c61809 100644 --- a/DiscImageChef.DiscImages/ZZZRawImage.cs +++ b/DiscImageChef.DiscImages/ZZZRawImage.cs @@ -85,10 +85,10 @@ namespace DiscImageChef.ImagePlugins FileInfo fi = new FileInfo(imagePath); // Check if file is not multiple of 512 - if ((fi.Length % 512) != 0) + if((fi.Length % 512) != 0) { // Check known disk sizes with sectors smaller than 512 - switch (fi.Length) + switch(fi.Length) { case 81664: case 116480: @@ -122,11 +122,11 @@ namespace DiscImageChef.ImagePlugins FileInfo fi = new FileInfo(imagePath); string extension = Path.GetExtension(imagePath).ToLower(); - if (extension == ".iso" && (fi.Length % 2048) == 0) + if(extension == ".iso" && (fi.Length % 2048) == 0) ImageInfo.sectorSize = 2048; else { - switch (fi.Length) + switch(fi.Length) { case 242944: case 256256: @@ -182,7 +182,7 @@ namespace DiscImageChef.ImagePlugins differentTrackZeroSize = false; rawImagePath = imagePath; - switch (fi.Length) + switch(fi.Length) { case 242944: ImageInfo.sectors = 1898; @@ -263,7 +263,7 @@ namespace DiscImageChef.ImagePlugins ImageInfo.mediaType = CalculateDiskType(); - switch (ImageInfo.mediaType) + switch(ImageInfo.mediaType) { case MediaType.CD: case MediaType.DVDPR: @@ -309,16 +309,16 @@ namespace DiscImageChef.ImagePlugins public override byte[] ReadSectors(UInt64 sectorAddress, UInt32 length) { - if (differentTrackZeroSize) + if(differentTrackZeroSize) { throw new NotImplementedException("Not yet implemented"); } else { - if (sectorAddress > ImageInfo.sectors - 1) + if(sectorAddress > ImageInfo.sectors - 1) throw new ArgumentOutOfRangeException("sectorAddress", "Sector address not found"); - if (sectorAddress + length > ImageInfo.sectors) + if(sectorAddress + length > ImageInfo.sectors) throw new ArgumentOutOfRangeException("length", "Requested more sectors than available"); byte[] buffer = new byte[length * ImageInfo.sectorSize]; @@ -336,8 +336,8 @@ namespace DiscImageChef.ImagePlugins } } - public override string GetImageFormat() - { + public override string GetImageFormat() + { return "Raw disk image (sector by sector copy)"; } @@ -351,7 +351,7 @@ namespace DiscImageChef.ImagePlugins return ImageInfo.imageLastModificationTime; } - public override string GetImageName() + public override string GetImageName() { return ImageInfo.imageName; } @@ -376,7 +376,7 @@ namespace DiscImageChef.ImagePlugins FailingLBAs = new List(); UnknownLBAs = new List(); - for (UInt64 i = sectorAddress; i < sectorAddress + length; i++) + for(UInt64 i = sectorAddress; i < sectorAddress + length; i++) UnknownLBAs.Add(i); return null; @@ -387,7 +387,7 @@ namespace DiscImageChef.ImagePlugins FailingLBAs = new List(); UnknownLBAs = new List(); - for (UInt64 i = sectorAddress; i < sectorAddress + length; i++) + for(UInt64 i = sectorAddress; i < sectorAddress + length; i++) UnknownLBAs.Add(i); return null; @@ -400,7 +400,7 @@ namespace DiscImageChef.ImagePlugins public override List GetTracks() { - if (ImageInfo.xmlMediaType == XmlMediaType.OpticalDisc) + if(ImageInfo.xmlMediaType == XmlMediaType.OpticalDisc) { Track trk = new Track(); trk.TrackBytesPerSector = (int)ImageInfo.sectorSize; @@ -424,9 +424,9 @@ namespace DiscImageChef.ImagePlugins public override List GetSessionTracks(Session session) { - if (ImageInfo.xmlMediaType == XmlMediaType.OpticalDisc) + if(ImageInfo.xmlMediaType == XmlMediaType.OpticalDisc) { - if (session.SessionSequence != 1) + if(session.SessionSequence != 1) throw new ArgumentOutOfRangeException("session", "Only a single session is supported"); Track trk = new Track(); @@ -451,9 +451,9 @@ namespace DiscImageChef.ImagePlugins public override List GetSessionTracks(UInt16 session) { - if (ImageInfo.xmlMediaType == XmlMediaType.OpticalDisc) + if(ImageInfo.xmlMediaType == XmlMediaType.OpticalDisc) { - if (session != 1) + if(session != 1) throw new ArgumentOutOfRangeException("session", "Only a single session is supported"); Track trk = new Track(); @@ -478,7 +478,7 @@ namespace DiscImageChef.ImagePlugins public override List GetSessions() { - if (ImageInfo.xmlMediaType == XmlMediaType.OpticalDisc) + if(ImageInfo.xmlMediaType == XmlMediaType.OpticalDisc) { Session sess = new Session(); sess.EndSector = ImageInfo.sectors - 1; @@ -496,9 +496,9 @@ namespace DiscImageChef.ImagePlugins public override byte[] ReadSector(UInt64 sectorAddress, UInt32 track) { - if (ImageInfo.xmlMediaType == XmlMediaType.OpticalDisc) + if(ImageInfo.xmlMediaType == XmlMediaType.OpticalDisc) { - if (track != 1) + if(track != 1) throw new ArgumentOutOfRangeException("track", "Only a single session is supported"); return ReadSector(sectorAddress); @@ -509,9 +509,9 @@ namespace DiscImageChef.ImagePlugins public override byte[] ReadSectors(UInt64 sectorAddress, UInt32 length, UInt32 track) { - if (ImageInfo.xmlMediaType == XmlMediaType.OpticalDisc) + if(ImageInfo.xmlMediaType == XmlMediaType.OpticalDisc) { - if (track != 1) + if(track != 1) throw new ArgumentOutOfRangeException("track", "Only a single session is supported"); return ReadSectors(sectorAddress, length); @@ -522,9 +522,9 @@ namespace DiscImageChef.ImagePlugins public override byte[] ReadSectorLong(UInt64 sectorAddress, UInt32 track) { - if (ImageInfo.xmlMediaType == XmlMediaType.OpticalDisc) + if(ImageInfo.xmlMediaType == XmlMediaType.OpticalDisc) { - if (track != 1) + if(track != 1) throw new ArgumentOutOfRangeException("track", "Only a single session is supported"); return ReadSector(sectorAddress); @@ -535,9 +535,9 @@ namespace DiscImageChef.ImagePlugins public override byte[] ReadSectorsLong(UInt64 sectorAddress, UInt32 length, UInt32 track) { - if (ImageInfo.xmlMediaType == XmlMediaType.OpticalDisc) + if(ImageInfo.xmlMediaType == XmlMediaType.OpticalDisc) { - if (track != 1) + if(track != 1) throw new ArgumentOutOfRangeException("track", "Only a single session is supported"); return ReadSectors(sectorAddress, length); @@ -550,27 +550,27 @@ namespace DiscImageChef.ImagePlugins MediaType CalculateDiskType() { - if (ImageInfo.sectorSize == 2048) + if(ImageInfo.sectorSize == 2048) { - if (ImageInfo.sectors <= 360000) + if(ImageInfo.sectors <= 360000) return MediaType.CD; - if (ImageInfo.sectors <= 2295104) + if(ImageInfo.sectors <= 2295104) return MediaType.DVDPR; - if (ImageInfo.sectors <= 2298496) + if(ImageInfo.sectors <= 2298496) return MediaType.DVDR; - if (ImageInfo.sectors <= 4171712) + if(ImageInfo.sectors <= 4171712) return MediaType.DVDRDL; - if (ImageInfo.sectors <= 4173824) + if(ImageInfo.sectors <= 4173824) return MediaType.DVDPRDL; - if (ImageInfo.sectors <= 24438784) + if(ImageInfo.sectors <= 24438784) return MediaType.BDR; - if (ImageInfo.sectors <= 62500864) + if(ImageInfo.sectors <= 62500864) return MediaType.BDRXL; return MediaType.Unknown; } else { - switch (ImageInfo.imageSize) + switch(ImageInfo.imageSize) { case 80384: return MediaType.ECMA_66; @@ -708,17 +708,17 @@ namespace DiscImageChef.ImagePlugins throw new FeatureUnsupportedImageException("Feature not supported by image format"); } - public override string GetImageVersion() + public override string GetImageVersion() { return ImageInfo.imageVersion; } - public override string GetImageApplication() + public override string GetImageApplication() { return ImageInfo.imageApplication; } - public override string GetImageApplicationVersion() + public override string GetImageApplicationVersion() { return ImageInfo.imageApplicationVersion; } @@ -733,42 +733,42 @@ namespace DiscImageChef.ImagePlugins return ImageInfo.imageCreator; } - public override string GetImageComments() + public override string GetImageComments() { return ImageInfo.imageComments; } - public override string GetMediaManufacturer() + public override string GetMediaManufacturer() { return ImageInfo.mediaManufacturer; } - public override string GetMediaModel() + public override string GetMediaModel() { return ImageInfo.mediaModel; } - public override string GetMediaSerialNumber() + public override string GetMediaSerialNumber() { return ImageInfo.mediaSerialNumber; } - public override string GetMediaBarcode() + public override string GetMediaBarcode() { return ImageInfo.mediaBarcode; } - public override string GetMediaPartNumber() + public override string GetMediaPartNumber() { return ImageInfo.mediaPartNumber; } - public override int GetMediaSequence() + public override int GetMediaSequence() { return ImageInfo.mediaSequence; } - public override int GetLastDiskSequence() + public override int GetLastDiskSequence() { return ImageInfo.lastMediaSequence; } diff --git a/DiscImageChef.Filesystems/Acorn.cs b/DiscImageChef.Filesystems/Acorn.cs index c094c0432..7ab2422eb 100644 --- a/DiscImageChef.Filesystems/Acorn.cs +++ b/DiscImageChef.Filesystems/Acorn.cs @@ -85,12 +85,12 @@ namespace DiscImageChef.Plugins public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd) { - if (partitionStart >= imagePlugin.GetSectors()) + if(partitionStart >= imagePlugin.GetSectors()) return false; ulong sbSector; - if (imagePlugin.GetSectorSize() > ADFS_SB_POS) + if(imagePlugin.GetSectorSize() > ADFS_SB_POS) sbSector = 0; else sbSector = ADFS_SB_POS / imagePlugin.GetSectorSize(); @@ -109,24 +109,24 @@ namespace DiscImageChef.Plugins return false; } - if (drSb.log2secsize < 8 || drSb.log2secsize > 10) + if(drSb.log2secsize < 8 || drSb.log2secsize > 10) return false; - if (drSb.idlen < (drSb.log2secsize + 3) || drSb.idlen > 19) + if(drSb.idlen < (drSb.log2secsize + 3) || drSb.idlen > 19) return false; - if ((drSb.disc_size_high >> drSb.log2secsize) != 0) + if((drSb.disc_size_high >> drSb.log2secsize) != 0) return false; - if (!ArrayHelpers.ArrayIsNullOrEmpty(drSb.reserved)) + if(!ArrayHelpers.ArrayIsNullOrEmpty(drSb.reserved)) return false; ulong bytes = drSb.disc_size_high; bytes *= 0x100000000; bytes += drSb.disc_size; - if (bytes > (imagePlugin.GetSectors() * (ulong)imagePlugin.GetSectorSize())) - return false; + if(bytes > (imagePlugin.GetSectors() * (ulong)imagePlugin.GetSectorSize())) + return false; return true; } @@ -138,7 +138,7 @@ namespace DiscImageChef.Plugins ulong sbSector; - if (imagePlugin.GetSectorSize() > ADFS_SB_POS) + if(imagePlugin.GetSectorSize() > ADFS_SB_POS) sbSector = 0; else sbSector = ADFS_SB_POS / imagePlugin.GetSectorSize(); @@ -171,16 +171,16 @@ namespace DiscImageChef.Plugins DicConsole.DebugWriteLine("ADFS Plugin", "drSb.format_version = {0}", drSb.format_version); DicConsole.DebugWriteLine("ADFS Plugin", "drSb.root_size = {0}", drSb.root_size); - if (drSb.log2secsize < 8 || drSb.log2secsize > 10) + if(drSb.log2secsize < 8 || drSb.log2secsize > 10) return; - if (drSb.idlen < (drSb.log2secsize + 3) || drSb.idlen > 19) + if(drSb.idlen < (drSb.log2secsize + 3) || drSb.idlen > 19) return; - if ((drSb.disc_size_high >> drSb.log2secsize) != 0) + if((drSb.disc_size_high >> drSb.log2secsize) != 0) return; - if (!ArrayHelpers.ArrayIsNullOrEmpty(drSb.reserved)) + if(!ArrayHelpers.ArrayIsNullOrEmpty(drSb.reserved)) return; ulong bytes = drSb.disc_size_high; @@ -191,7 +191,7 @@ namespace DiscImageChef.Plugins zones *= 0x100000000; zones += drSb.nzones; - if (bytes > (imagePlugin.GetSectors() * (ulong)imagePlugin.GetSectorSize())) + if(bytes > (imagePlugin.GetSectors() * (ulong)imagePlugin.GetSectorSize())) return; string discname = StringHandlers.CToString(drSb.disc_name); diff --git a/DiscImageChef.Filesystems/AmigaDOS.cs b/DiscImageChef.Filesystems/AmigaDOS.cs index 846b43a44..8c926c32a 100644 --- a/DiscImageChef.Filesystems/AmigaDOS.cs +++ b/DiscImageChef.Filesystems/AmigaDOS.cs @@ -186,7 +186,7 @@ namespace DiscImageChef.Plugins public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd) { - if (partitionStart >= imagePlugin.GetSectors()) + if(partitionStart >= imagePlugin.GetSectors()) return false; BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; @@ -195,7 +195,7 @@ namespace DiscImageChef.Plugins UInt32 magic = BigEndianBitConverter.ToUInt32(sector, 0x00); - if ((magic & 0x6D754600) != 0x6D754600 && + if((magic & 0x6D754600) != 0x6D754600 && (magic & 0x444F5300) != 0x444F5300) return false; @@ -206,7 +206,7 @@ namespace DiscImageChef.Plugins DicConsole.DebugWriteLine("AmigaDOS plugin", "Nonetheless, going to block {0} for Rootblock", root_ptr); - if (root_ptr >= imagePlugin.GetSectors()) + if(root_ptr >= imagePlugin.GetSectors()) return false; sector = imagePlugin.ReadSector(root_ptr); @@ -214,7 +214,7 @@ namespace DiscImageChef.Plugins UInt32 type = BigEndianBitConverter.ToUInt32(sector, 0x00); UInt32 hashTableSize = BigEndianBitConverter.ToUInt32(sector, 0x0C); - if ((0x18 + hashTableSize * 4 + 196) > sector.Length) + if((0x18 + hashTableSize * 4 + 196) > sector.Length) return false; UInt32 sec_type = BigEndianBitConverter.ToUInt32(sector, (int)(0x18 + hashTableSize * 4 + 196)); @@ -257,13 +257,13 @@ namespace DiscImageChef.Plugins rootBlk.checksum = BigEndianBitConverter.ToUInt32(RootBlockSector, 0x14); rootBlk.hashTable = new uint[rootBlk.hashTableSize]; - for (int i = 0; i < rootBlk.hashTableSize; i++) + for(int i = 0; i < rootBlk.hashTableSize; i++) rootBlk.hashTable[i] = BigEndianBitConverter.ToUInt32(RootBlockSector, 0x18 + i * 4); rootBlk.bitmapFlag = BigEndianBitConverter.ToUInt32(RootBlockSector, (int)(0x18 + rootBlk.hashTableSize * 4 + 0)); rootBlk.bitmapPages = new uint[25]; - for (int i = 0; i < 25; i++) + for(int i = 0; i < 25; i++) rootBlk.bitmapPages[i] = BigEndianBitConverter.ToUInt32(RootBlockSector, (int)(0x18 + rootBlk.hashTableSize * 4 + 4 + i * 4)); rootBlk.bitmapExtensionBlock = BigEndianBitConverter.ToUInt32(RootBlockSector, (int)(0x18 + rootBlk.hashTableSize * 4 + 104)); @@ -290,7 +290,7 @@ namespace DiscImageChef.Plugins DicConsole.DebugWriteLine("AmigaDOS plugin", "Stored root block checksum is 0x{0:X8}", rootBlk.checksum); DicConsole.DebugWriteLine("AmigaDOS plugin", "Probably incorrect calculated root block checksum is 0x{0:X8}", AmigaChecksum(RootBlockSector)); - switch (bootBlk.diskType & 0xFF) + switch(bootBlk.diskType & 0xFF) { case 0: sbInformation.Append("Amiga Original File System"); @@ -326,12 +326,12 @@ namespace DiscImageChef.Plugins break; } - if ((bootBlk.diskType & 0x6D754600) == 0x6D754600) + if((bootBlk.diskType & 0x6D754600) == 0x6D754600) sbInformation.Append(", with multi-user patches"); sbInformation.AppendLine(); - if ((bootBlk.diskType & 0xFF) == 6 || (bootBlk.diskType & 0xFF) == 7) + if((bootBlk.diskType & 0xFF) == 6 || (bootBlk.diskType & 0xFF) == 7) { sbInformation.AppendLine("AFFS v2, following information may be completely incorrect or garbage."); xmlFSType.Type = "Amiga FFS2"; @@ -339,13 +339,13 @@ namespace DiscImageChef.Plugins sbInformation.AppendFormat("Volume name: {0}", rootBlk.diskName).AppendLine(); - if (rootBlk.bitmapFlag == 0xFFFFFFFF) + if(rootBlk.bitmapFlag == 0xFFFFFFFF) sbInformation.AppendLine("Volume bitmap is valid"); - if (rootBlk.bitmapExtensionBlock != 0x00000000 && rootBlk.bitmapExtensionBlock != 0xFFFFFFFF) + if(rootBlk.bitmapExtensionBlock != 0x00000000 && rootBlk.bitmapExtensionBlock != 0xFFFFFFFF) sbInformation.AppendFormat("Bitmap extension at block {0}", rootBlk.bitmapExtensionBlock).AppendLine(); - if ((bootBlk.diskType & 0xFF) == 4 || (bootBlk.diskType & 0xFF) == 5) + if((bootBlk.diskType & 0xFF) == 4 || (bootBlk.diskType & 0xFF) == 5) sbInformation.AppendFormat("Directory cache starts at block {0}", rootBlk.extension).AppendLine(); sbInformation.AppendFormat("Volume created on {0}", DateHandlers.AmigaToDateTime(rootBlk.cDays, rootBlk.cMins, rootBlk.cTicks)).AppendLine(); @@ -368,7 +368,7 @@ namespace DiscImageChef.Plugins BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; UInt32 sum = 0; - for (int i = 0; i < data.Length; i += 4) + for(int i = 0; i < data.Length; i += 4) sum += BigEndianBitConverter.ToUInt32(data, i); return sum; diff --git a/DiscImageChef.Filesystems/AppleHFS.cs b/DiscImageChef.Filesystems/AppleHFS.cs index 6f602a2b5..22c3f786a 100644 --- a/DiscImageChef.Filesystems/AppleHFS.cs +++ b/DiscImageChef.Filesystems/AppleHFS.cs @@ -70,18 +70,18 @@ namespace DiscImageChef.Plugins public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd) { - if ((2 + partitionStart) >= imagePlugin.GetSectors()) + if((2 + partitionStart) >= imagePlugin.GetSectors()) return false; byte[] mdb_sector; UInt16 drSigWord; - if (imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448 || imagePlugin.GetSectorSize() == 2048) + if(imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448 || imagePlugin.GetSectorSize() == 2048) { mdb_sector = imagePlugin.ReadSector(2 + partitionStart); drSigWord = BigEndianBitConverter.ToUInt16(mdb_sector, 0); - if (drSigWord == HFS_MAGIC) + if(drSigWord == HFS_MAGIC) { drSigWord = BigEndianBitConverter.ToUInt16(mdb_sector, 0x7C); // Seek to embedded HFS+ signature @@ -90,7 +90,7 @@ namespace DiscImageChef.Plugins mdb_sector = Read2048SectorAs512(imagePlugin, 2 + partitionStart); drSigWord = BigEndianBitConverter.ToUInt16(mdb_sector, 0); - if (drSigWord == HFS_MAGIC) + if(drSigWord == HFS_MAGIC) { DicConsole.DebugWriteLine("HFS plugin", "HFS sector size is 512 bytes, but device's 2048"); @@ -104,10 +104,10 @@ namespace DiscImageChef.Plugins mdb_sector = imagePlugin.ReadSector(2 + partitionStart); drSigWord = BigEndianBitConverter.ToUInt16(mdb_sector, 0); - if (drSigWord == HFS_MAGIC) + if(drSigWord == HFS_MAGIC) { drSigWord = BigEndianBitConverter.ToUInt16(mdb_sector, 0x7C); // Seek to embedded HFS+ signature - + return drSigWord != HFSP_MAGIC; } } @@ -117,9 +117,9 @@ namespace DiscImageChef.Plugins public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, out string information) { information = ""; - + StringBuilder sb = new StringBuilder(); - + HFS_MasterDirectoryBlock MDB = new HFS_MasterDirectoryBlock(); HFS_BootBlock BB = new HFS_BootBlock(); @@ -131,12 +131,12 @@ namespace DiscImageChef.Plugins bool APMFromHDDOnCD = false; - if (imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448 || imagePlugin.GetSectorSize() == 2048) + if(imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448 || imagePlugin.GetSectorSize() == 2048) { mdb_sector = imagePlugin.ReadSector(2 + partitionStart); drSigWord = BigEndianBitConverter.ToUInt16(mdb_sector, 0); - if (drSigWord == HFS_MAGIC) + if(drSigWord == HFS_MAGIC) { bb_sector = imagePlugin.ReadSector(partitionStart); } @@ -145,7 +145,7 @@ namespace DiscImageChef.Plugins mdb_sector = Read2048SectorAs512(imagePlugin, 2 + partitionStart); drSigWord = BigEndianBitConverter.ToUInt16(mdb_sector, 0); - if (drSigWord == HFS_MAGIC) + if(drSigWord == HFS_MAGIC) { bb_sector = Read2048SectorAs512(imagePlugin, partitionStart); APMFromHDDOnCD = true; @@ -159,16 +159,16 @@ namespace DiscImageChef.Plugins mdb_sector = imagePlugin.ReadSector(2 + partitionStart); drSigWord = BigEndianBitConverter.ToUInt16(mdb_sector, 0); - if (drSigWord == HFS_MAGIC) + if(drSigWord == HFS_MAGIC) bb_sector = imagePlugin.ReadSector(partitionStart); else return; } MDB.drSigWord = BigEndianBitConverter.ToUInt16(mdb_sector, 0x000); - if (MDB.drSigWord != HFS_MAGIC) + if(MDB.drSigWord != HFS_MAGIC) return; - + MDB.drCrDate = BigEndianBitConverter.ToUInt32(mdb_sector, 0x002); MDB.drLsMod = BigEndianBitConverter.ToUInt32(mdb_sector, 0x006); MDB.drAtrb = BigEndianBitConverter.ToUInt16(mdb_sector, 0x00A); @@ -184,7 +184,7 @@ namespace DiscImageChef.Plugins pString = new byte[28]; Array.Copy(mdb_sector, 0x024, pString, 0, 28); MDB.drVN = StringHandlers.PascalToString(pString); - + MDB.drVolBkUp = BigEndianBitConverter.ToUInt32(mdb_sector, 0x040); MDB.drVSeqNum = BigEndianBitConverter.ToUInt16(mdb_sector, 0x044); MDB.drWrCnt = BigEndianBitConverter.ToUInt32(mdb_sector, 0x046); @@ -193,7 +193,7 @@ namespace DiscImageChef.Plugins MDB.drNmRtDirs = BigEndianBitConverter.ToUInt16(mdb_sector, 0x052); MDB.drFilCnt = BigEndianBitConverter.ToUInt32(mdb_sector, 0x054); MDB.drDirCnt = BigEndianBitConverter.ToUInt32(mdb_sector, 0x058); - + MDB.drFndrInfo0 = BigEndianBitConverter.ToUInt32(mdb_sector, 0x05C); MDB.drFndrInfo1 = BigEndianBitConverter.ToUInt32(mdb_sector, 0x060); MDB.drFndrInfo2 = BigEndianBitConverter.ToUInt32(mdb_sector, 0x064); @@ -211,18 +211,18 @@ namespace DiscImageChef.Plugins MDB.drEmbedSigWord = BigEndianBitConverter.ToUInt16(mdb_sector, 0x07C); MDB.xdrStABNt = BigEndianBitConverter.ToUInt16(mdb_sector, 0x07E); MDB.xdrNumABlks = BigEndianBitConverter.ToUInt16(mdb_sector, 0x080); - + MDB.drXTFlSize = BigEndianBitConverter.ToUInt32(mdb_sector, 0x082); MDB.drCTFlSize = BigEndianBitConverter.ToUInt32(mdb_sector, 0x092); - + BB.signature = BigEndianBitConverter.ToUInt16(bb_sector, 0x000); - - if (BB.signature == HFSBB_MAGIC) + + if(BB.signature == HFSBB_MAGIC) { BB.branch = BigEndianBitConverter.ToUInt32(bb_sector, 0x002); BB.boot_flags = bb_sector[0x006]; BB.boot_version = bb_sector[0x007]; - + BB.sec_sv_pages = BigEndianBitConverter.ToInt16(bb_sector, 0x008); pString = new byte[16]; @@ -246,7 +246,7 @@ namespace DiscImageChef.Plugins pString = new byte[16]; Array.Copy(bb_sector, 0x06A, pString, 0, 16); BB.clipbrd_name = StringHandlers.PascalToString(pString); - + BB.max_files = BigEndianBitConverter.ToUInt16(bb_sector, 0x07A); BB.queue_size = BigEndianBitConverter.ToUInt16(bb_sector, 0x07C); BB.heap_128k = BigEndianBitConverter.ToUInt32(bb_sector, 0x07E); @@ -255,44 +255,44 @@ namespace DiscImageChef.Plugins } else BB.signature = 0x0000; - + sb.AppendLine("Apple Hierarchical File System"); sb.AppendLine(); - if (APMFromHDDOnCD) + if(APMFromHDDOnCD) sb.AppendLine("HFS uses 512 bytes/sector while devices uses 2048 bytes/sector.").AppendLine(); sb.AppendLine("Master Directory Block:"); sb.AppendFormat("Creation date: {0}", DateHandlers.MacToDateTime(MDB.drCrDate)).AppendLine(); sb.AppendFormat("Last modification date: {0}", DateHandlers.MacToDateTime(MDB.drLsMod)).AppendLine(); sb.AppendFormat("Last backup date: {0}", DateHandlers.MacToDateTime(MDB.drVolBkUp)).AppendLine(); sb.AppendFormat("Backup sequence number: {0}", MDB.drVSeqNum).AppendLine(); - - if ((MDB.drAtrb & 0x80) == 0x80) + + if((MDB.drAtrb & 0x80) == 0x80) sb.AppendLine("Volume is locked by hardware."); - if ((MDB.drAtrb & 0x100) == 0x100) + if((MDB.drAtrb & 0x100) == 0x100) sb.AppendLine("Volume was unmonted."); else sb.AppendLine("Volume is mounted."); - if ((MDB.drAtrb & 0x200) == 0x200) + if((MDB.drAtrb & 0x200) == 0x200) sb.AppendLine("Volume has spared bad blocks."); - if ((MDB.drAtrb & 0x400) == 0x400) + if((MDB.drAtrb & 0x400) == 0x400) sb.AppendLine("Volume does not need cache."); - if ((MDB.drAtrb & 0x800) == 0x800) + if((MDB.drAtrb & 0x800) == 0x800) sb.AppendLine("Boot volume is inconsistent."); - if ((MDB.drAtrb & 0x1000) == 0x1000) + if((MDB.drAtrb & 0x1000) == 0x1000) sb.AppendLine("There are reused CNIDs."); - if ((MDB.drAtrb & 0x2000) == 0x2000) + if((MDB.drAtrb & 0x2000) == 0x2000) sb.AppendLine("Volume is journaled."); - if ((MDB.drAtrb & 0x4000) == 0x4000) + if((MDB.drAtrb & 0x4000) == 0x4000) sb.AppendLine("Volume is seriously inconsistent."); - if ((MDB.drAtrb & 0x8000) == 0x8000) + if((MDB.drAtrb & 0x8000) == 0x8000) sb.AppendLine("Volume is locked by software."); - + sb.AppendFormat("{0} files on root directory", MDB.drNmFls).AppendLine(); sb.AppendFormat("{0} directories on root directory", MDB.drNmRtDirs).AppendLine(); sb.AppendFormat("{0} files on volume", MDB.drFilCnt).AppendLine(); sb.AppendFormat("{0} directories on volume", MDB.drDirCnt).AppendLine(); sb.AppendFormat("Volume write count: {0}", MDB.drWrCnt).AppendLine(); - + sb.AppendFormat("Volume bitmap starting sector (in 512-bytes): {0}", MDB.drVBMSt).AppendLine(); sb.AppendFormat("Next allocation block: {0}.", MDB.drAllocPtr).AppendLine(); sb.AppendFormat("{0} volume allocation blocks.", MDB.drNmAlBlks).AppendLine(); @@ -303,12 +303,12 @@ namespace DiscImageChef.Plugins sb.AppendFormat("Sector of first allocation block: {0}", MDB.drAlBlSt).AppendLine(); sb.AppendFormat("Next unused CNID: {0}", MDB.drNxtCNID).AppendLine(); sb.AppendFormat("{0} unused allocation blocks.", MDB.drFreeBks).AppendLine(); - + sb.AppendFormat("{0} bytes in the Extents B-Tree", MDB.drXTFlSize).AppendLine(); sb.AppendFormat("{0} bytes in the Catalog B-Tree", MDB.drCTFlSize).AppendLine(); sb.AppendFormat("Volume name: {0}", MDB.drVN).AppendLine(); - + sb.AppendLine("Finder info:"); sb.AppendFormat("CNID of bootable system's directory: {0}", MDB.drFndrInfo0).AppendLine(); sb.AppendFormat("CNID of first-run application's directory: {0}", MDB.drFndrInfo1).AppendLine(); @@ -316,8 +316,8 @@ namespace DiscImageChef.Plugins sb.AppendFormat("CNID of bootable Mac OS 8 or 9 directory: {0}", MDB.drFndrInfo3).AppendLine(); sb.AppendFormat("CNID of bootable Mac OS X directory: {0}", MDB.drFndrInfo5).AppendLine(); sb.AppendFormat("Mac OS X Volume ID: {0:X8}{1:X8}", MDB.drFndrInfo6, MDB.drFndrInfo7).AppendLine(); - - if (MDB.drEmbedSigWord == HFSP_MAGIC) + + if(MDB.drEmbedSigWord == HFSP_MAGIC) { sb.AppendLine("Volume wraps a HFS+ volume."); sb.AppendFormat("Starting block of the HFS+ volume: {0}", MDB.xdrStABNt).AppendLine(); @@ -329,25 +329,25 @@ namespace DiscImageChef.Plugins sb.AppendFormat("{0} blocks in volume bitmap cache", MDB.drVBMCSize).AppendLine(); sb.AppendFormat("{0} blocks in volume common cache", MDB.drCtlCSize).AppendLine(); } - - if (BB.signature == HFSBB_MAGIC) + + if(BB.signature == HFSBB_MAGIC) { sb.AppendLine("Volume is bootable."); sb.AppendLine(); sb.AppendLine("Boot Block:"); - if ((BB.boot_flags & 0x40) == 0x40) + if((BB.boot_flags & 0x40) == 0x40) sb.AppendLine("Boot block should be executed."); - if ((BB.boot_flags & 0x80) == 0x80) + if((BB.boot_flags & 0x80) == 0x80) { sb.AppendLine("Boot block is in new unknown format."); } else { - if (BB.sec_sv_pages > 0) + if(BB.sec_sv_pages > 0) sb.AppendLine("Allocate secondary sound buffer at boot."); - else if (BB.sec_sv_pages < 0) + else if(BB.sec_sv_pages < 0) sb.AppendLine("Allocate secondary sound and video buffers at boot."); - + sb.AppendFormat("System filename: {0}", BB.system_name).AppendLine(); sb.AppendFormat("Finder filename: {0}", BB.finder_name).AppendLine(); sb.AppendFormat("Debugger filename: {0}", BB.debug_name).AppendLine(); @@ -364,11 +364,11 @@ namespace DiscImageChef.Plugins } else sb.AppendLine("Volume is not bootable."); - + information = sb.ToString(); xmlFSType = new Schemas.FileSystemType(); - if (MDB.drVolBkUp > 0) + if(MDB.drVolBkUp > 0) { xmlFSType.BackupDate = DateHandlers.MacToDateTime(MDB.drVolBkUp); xmlFSType.BackupDateSpecified = true; @@ -376,7 +376,7 @@ namespace DiscImageChef.Plugins xmlFSType.Bootable = BB.signature == HFSBB_MAGIC; xmlFSType.Clusters = MDB.drNmAlBlks; xmlFSType.ClusterSize = (int)MDB.drAlBlkSiz; - if (MDB.drCrDate > 0) + if(MDB.drCrDate > 0) { xmlFSType.CreationDate = DateHandlers.MacToDateTime(MDB.drCrDate); xmlFSType.CreationDateSpecified = true; @@ -386,16 +386,16 @@ namespace DiscImageChef.Plugins xmlFSType.FilesSpecified = true; xmlFSType.FreeClusters = MDB.drFreeBks; xmlFSType.FreeClustersSpecified = true; - if (MDB.drLsMod > 0) + if(MDB.drLsMod > 0) { xmlFSType.ModificationDate = DateHandlers.MacToDateTime(MDB.drLsMod); xmlFSType.ModificationDateSpecified = true; } xmlFSType.Type = "HFS"; xmlFSType.VolumeName = MDB.drVN; - if (MDB.drFndrInfo6 != 0 && MDB.drFndrInfo7 != 0) + if(MDB.drFndrInfo6 != 0 && MDB.drFndrInfo7 != 0) xmlFSType.VolumeSerial = String.Format("{0:X8}{1:x8}", MDB.drFndrInfo6, MDB.drFndrInfo7); - + return; } diff --git a/DiscImageChef.Filesystems/AppleHFSPlus.cs b/DiscImageChef.Filesystems/AppleHFSPlus.cs index 81c0aff72..c75399232 100644 --- a/DiscImageChef.Filesystems/AppleHFSPlus.cs +++ b/DiscImageChef.Filesystems/AppleHFSPlus.cs @@ -66,33 +66,33 @@ namespace DiscImageChef.Plugins public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd) { - if ((2 + partitionStart) >= imagePlugin.GetSectors()) + if((2 + partitionStart) >= imagePlugin.GetSectors()) return false; UInt16 drSigWord; UInt16 xdrStABNt; UInt16 drAlBlSt; UInt32 drAlBlkSiz; - + byte[] vh_sector; ulong hfsp_offset; vh_sector = imagePlugin.ReadSector(2 + partitionStart); // Read volume header, of HFS Wrapper MDB - + drSigWord = BigEndianBitConverter.ToUInt16(vh_sector, 0); // Check for HFS Wrapper MDB - - if (drSigWord == HFS_MAGIC) // "BD" + + if(drSigWord == HFS_MAGIC) // "BD" { drSigWord = BigEndianBitConverter.ToUInt16(vh_sector, 0x07C); // Read embedded HFS+ signature - - if (drSigWord == HFSP_MAGIC) // "H+" + + if(drSigWord == HFSP_MAGIC) // "H+" { xdrStABNt = BigEndianBitConverter.ToUInt16(vh_sector, 0x07E); // Starting block number of embedded HFS+ volume - + drAlBlkSiz = BigEndianBitConverter.ToUInt32(vh_sector, 0x014); // Block size - + drAlBlSt = BigEndianBitConverter.ToUInt16(vh_sector, 0x01C); // Start of allocated blocks (in 512-byte/block) - + hfsp_offset = (drAlBlSt + xdrStABNt * (drAlBlkSiz / 512)) * (imagePlugin.GetSectorSize() / 512); } else @@ -104,11 +104,11 @@ namespace DiscImageChef.Plugins { hfsp_offset = 0; } - + vh_sector = imagePlugin.ReadSector(2 + partitionStart + hfsp_offset); // Read volume header - + drSigWord = BigEndianBitConverter.ToUInt16(vh_sector, 0); - if (drSigWord == HFSP_MAGIC || drSigWord == HFSX_MAGIC) + if(drSigWord == HFSP_MAGIC || drSigWord == HFSX_MAGIC) return true; return false; } @@ -116,26 +116,26 @@ namespace DiscImageChef.Plugins public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, out string information) { information = ""; - + UInt16 drSigWord; UInt16 xdrStABNt; UInt16 drAlBlSt; UInt32 drAlBlkSiz; HFSPlusVolumeHeader HPVH = new HFSPlusVolumeHeader(); - + ulong hfsp_offset; bool wrapped; byte[] vh_sector; - + vh_sector = imagePlugin.ReadSector(2 + partitionStart); // Read volume header, of HFS Wrapper MDB drSigWord = BigEndianBitConverter.ToUInt16(vh_sector, 0); // Check for HFS Wrapper MDB - - if (drSigWord == HFS_MAGIC) // "BD" + + if(drSigWord == HFS_MAGIC) // "BD" { drSigWord = BigEndianBitConverter.ToUInt16(vh_sector, 0x07C); // Read embedded HFS+ signature - - if (drSigWord == HFSP_MAGIC) // "H+" + + if(drSigWord == HFSP_MAGIC) // "H+" { xdrStABNt = BigEndianBitConverter.ToUInt16(vh_sector, 0x07E); // Starting block number of embedded HFS+ volume @@ -157,47 +157,47 @@ namespace DiscImageChef.Plugins hfsp_offset = 0; wrapped = false; } - + vh_sector = imagePlugin.ReadSector(2 + partitionStart + hfsp_offset); // Read volume header - + HPVH.signature = BigEndianBitConverter.ToUInt16(vh_sector, 0x000); - if (HPVH.signature == HFSP_MAGIC || HPVH.signature == HFSX_MAGIC) + if(HPVH.signature == HFSP_MAGIC || HPVH.signature == HFSX_MAGIC) { StringBuilder sb = new StringBuilder(); - if (HPVH.signature == 0x482B) + if(HPVH.signature == 0x482B) sb.AppendLine("HFS+ filesystem."); - if (HPVH.signature == 0x4858) + if(HPVH.signature == 0x4858) sb.AppendLine("HFSX filesystem."); - if (wrapped) + if(wrapped) sb.AppendLine("Volume is wrapped inside an HFS volume."); - + HPVH.version = BigEndianBitConverter.ToUInt16(vh_sector, 0x002); - - if (HPVH.version == 4 || HPVH.version == 5) + + if(HPVH.version == 4 || HPVH.version == 5) { HPVH.attributes = BigEndianBitConverter.ToUInt32(vh_sector, 0x004); byte[] lastMountedVersion_b = new byte[4]; Array.Copy(vh_sector, 0x008, lastMountedVersion_b, 0, 4); - HPVH.lastMountedVersion = Encoding.ASCII.GetString(lastMountedVersion_b); - HPVH.journalInfoBlock = BigEndianBitConverter.ToUInt32(vh_sector, 0x00C); + HPVH.lastMountedVersion = Encoding.ASCII.GetString(lastMountedVersion_b); + HPVH.journalInfoBlock = BigEndianBitConverter.ToUInt32(vh_sector, 0x00C); - HPVH.createDate = BigEndianBitConverter.ToUInt32(vh_sector, 0x010); - HPVH.modifyDate = BigEndianBitConverter.ToUInt32(vh_sector, 0x018); - HPVH.backupDate = BigEndianBitConverter.ToUInt32(vh_sector, 0x020); - HPVH.checkedDate = BigEndianBitConverter.ToUInt32(vh_sector, 0x028); + HPVH.createDate = BigEndianBitConverter.ToUInt32(vh_sector, 0x010); + HPVH.modifyDate = BigEndianBitConverter.ToUInt32(vh_sector, 0x018); + HPVH.backupDate = BigEndianBitConverter.ToUInt32(vh_sector, 0x020); + HPVH.checkedDate = BigEndianBitConverter.ToUInt32(vh_sector, 0x028); - HPVH.fileCount = BigEndianBitConverter.ToUInt32(vh_sector, 0x030); - HPVH.folderCount = BigEndianBitConverter.ToUInt32(vh_sector, 0x034); + HPVH.fileCount = BigEndianBitConverter.ToUInt32(vh_sector, 0x030); + HPVH.folderCount = BigEndianBitConverter.ToUInt32(vh_sector, 0x034); - HPVH.blockSize = BigEndianBitConverter.ToUInt32(vh_sector, 0x038); - HPVH.totalBlocks = BigEndianBitConverter.ToUInt32(vh_sector, 0x03C); - HPVH.freeBlocks = BigEndianBitConverter.ToUInt32(vh_sector, 0x040); + HPVH.blockSize = BigEndianBitConverter.ToUInt32(vh_sector, 0x038); + HPVH.totalBlocks = BigEndianBitConverter.ToUInt32(vh_sector, 0x03C); + HPVH.freeBlocks = BigEndianBitConverter.ToUInt32(vh_sector, 0x040); - HPVH.nextAllocation = BigEndianBitConverter.ToUInt32(vh_sector, 0x044); - HPVH.rsrcClumpSize = BigEndianBitConverter.ToUInt32(vh_sector, 0x048); - HPVH.dataClumpSize = BigEndianBitConverter.ToUInt32(vh_sector, 0x04C); - HPVH.nextCatalogID = BigEndianBitConverter.ToUInt32(vh_sector, 0x050); + HPVH.nextAllocation = BigEndianBitConverter.ToUInt32(vh_sector, 0x044); + HPVH.rsrcClumpSize = BigEndianBitConverter.ToUInt32(vh_sector, 0x048); + HPVH.dataClumpSize = BigEndianBitConverter.ToUInt32(vh_sector, 0x04C); + HPVH.nextCatalogID = BigEndianBitConverter.ToUInt32(vh_sector, 0x050); HPVH.writeCount = BigEndianBitConverter.ToUInt32(vh_sector, 0x054); @@ -208,34 +208,34 @@ namespace DiscImageChef.Plugins HPVH.drFndrInfo5 = BigEndianBitConverter.ToUInt32(vh_sector, 0x074); HPVH.drFndrInfo6 = BigEndianBitConverter.ToUInt32(vh_sector, 0x078); HPVH.drFndrInfo7 = BigEndianBitConverter.ToUInt32(vh_sector, 0x07C); - + HPVH.allocationFile_logicalSize = BigEndianBitConverter.ToUInt64(vh_sector, 0x080); HPVH.extentsFile_logicalSize = BigEndianBitConverter.ToUInt64(vh_sector, 0x0D0); HPVH.catalogFile_logicalSize = BigEndianBitConverter.ToUInt64(vh_sector, 0x120); HPVH.attributesFile_logicalSize = BigEndianBitConverter.ToUInt64(vh_sector, 0x170); HPVH.startupFile_logicalSize = BigEndianBitConverter.ToUInt64(vh_sector, 0x1C0); - + sb.AppendFormat("Filesystem version is {0}.", HPVH.version).AppendLine(); - if ((HPVH.attributes & 0x80) == 0x80) + if((HPVH.attributes & 0x80) == 0x80) sb.AppendLine("Volume is locked on hardware."); - if ((HPVH.attributes & 0x100) == 0x100) + if((HPVH.attributes & 0x100) == 0x100) sb.AppendLine("Volume is unmounted."); - if ((HPVH.attributes & 0x200) == 0x200) + if((HPVH.attributes & 0x200) == 0x200) sb.AppendLine("There are bad blocks in the extents file."); - if ((HPVH.attributes & 0x400) == 0x400) + if((HPVH.attributes & 0x400) == 0x400) sb.AppendLine("Volume does not require cache."); - if ((HPVH.attributes & 0x800) == 0x800) + if((HPVH.attributes & 0x800) == 0x800) sb.AppendLine("Volume state is inconsistent."); - if ((HPVH.attributes & 0x1000) == 0x1000) + if((HPVH.attributes & 0x1000) == 0x1000) sb.AppendLine("CNIDs are reused."); - if ((HPVH.attributes & 0x2000) == 0x2000) + if((HPVH.attributes & 0x2000) == 0x2000) sb.AppendLine("Volume is journaled."); - if ((HPVH.attributes & 0x8000) == 0x8000) + if((HPVH.attributes & 0x8000) == 0x8000) sb.AppendLine("Volume is locked on software."); sb.AppendFormat("Implementation that last mounted the volume: \"{0}\".", HPVH.lastMountedVersion).AppendLine(); - if ((HPVH.attributes & 0x2000) == 0x2000) + if((HPVH.attributes & 0x2000) == 0x2000) sb.AppendFormat("Journal starts at allocation block {0}.", HPVH.journalInfoBlock).AppendLine(); sb.AppendFormat("Creation date: {0}", DateHandlers.MacToDateTime(HPVH.createDate)).AppendLine(); sb.AppendFormat("Last modification date: {0}", DateHandlers.MacToDateTime(HPVH.modifyDate)).AppendLine(); @@ -265,7 +265,7 @@ namespace DiscImageChef.Plugins sb.AppendFormat("Mac OS X Volume ID: {0:X8}{1:X8}", HPVH.drFndrInfo6, HPVH.drFndrInfo7).AppendLine(); xmlFSType = new Schemas.FileSystemType(); - if (HPVH.backupDate > 0) + if(HPVH.backupDate > 0) { xmlFSType.BackupDate = DateHandlers.MacToDateTime(HPVH.backupDate); xmlFSType.BackupDateSpecified = true; @@ -274,7 +274,7 @@ namespace DiscImageChef.Plugins xmlFSType.Bootable = true; xmlFSType.Clusters = HPVH.totalBlocks; xmlFSType.ClusterSize = (int)HPVH.blockSize; - if (HPVH.createDate > 0) + if(HPVH.createDate > 0) { xmlFSType.CreationDate = DateHandlers.MacToDateTime(HPVH.createDate); xmlFSType.CreationDateSpecified = true; @@ -284,7 +284,7 @@ namespace DiscImageChef.Plugins xmlFSType.FilesSpecified = true; xmlFSType.FreeClusters = HPVH.freeBlocks; xmlFSType.FreeClustersSpecified = true; - if (HPVH.modifyDate > 0) + if(HPVH.modifyDate > 0) { xmlFSType.ModificationDate = DateHandlers.MacToDateTime(HPVH.modifyDate); xmlFSType.ModificationDateSpecified = true; @@ -293,7 +293,7 @@ namespace DiscImageChef.Plugins xmlFSType.Type = "HFS+"; if(HPVH.signature == 0x4858) xmlFSType.Type = "HFSX"; - if (HPVH.drFndrInfo6 != 0 && HPVH.drFndrInfo7 != 0) + if(HPVH.drFndrInfo6 != 0 && HPVH.drFndrInfo7 != 0) xmlFSType.VolumeSerial = String.Format("{0:X8}{1:x8}", HPVH.drFndrInfo6, HPVH.drFndrInfo7); } else @@ -301,7 +301,7 @@ namespace DiscImageChef.Plugins sb.AppendFormat("Filesystem version is {0}.", HPVH.version).AppendLine(); sb.AppendLine("This version is not supported yet."); } - + information = sb.ToString(); } else diff --git a/DiscImageChef.Filesystems/AppleMFS.cs b/DiscImageChef.Filesystems/AppleMFS.cs index fb87a84fb..73f7aae48 100644 --- a/DiscImageChef.Filesystems/AppleMFS.cs +++ b/DiscImageChef.Filesystems/AppleMFS.cs @@ -59,25 +59,25 @@ namespace DiscImageChef.Plugins { UInt16 drSigWord; - if ((2 + partitionStart) >= imagePlugin.GetSectors()) + if((2 + partitionStart) >= imagePlugin.GetSectors()) return false; byte[] mdb_sector = imagePlugin.ReadSector(2 + partitionStart); drSigWord = BigEndianBitConverter.ToUInt16(mdb_sector, 0x000); - + return drSigWord == MFS_MAGIC; } public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, out string information) { information = ""; - + StringBuilder sb = new StringBuilder(); - + MFS_MasterDirectoryBlock MDB = new MFS_MasterDirectoryBlock(); MFS_BootBlock BB = new MFS_BootBlock(); - + byte[] pString = new byte[16]; byte[] variable_size; @@ -85,9 +85,9 @@ namespace DiscImageChef.Plugins byte[] bb_sector = imagePlugin.ReadSector(0 + partitionStart); MDB.drSigWord = BigEndianBitConverter.ToUInt16(mdb_sector, 0x000); - if (MDB.drSigWord != MFS_MAGIC) + if(MDB.drSigWord != MFS_MAGIC) return; - + MDB.drCrDate = BigEndianBitConverter.ToUInt32(mdb_sector, 0x002); MDB.drLsBkUp = BigEndianBitConverter.ToUInt32(mdb_sector, 0x006); MDB.drAtrb = BigEndianBitConverter.ToUInt16(mdb_sector, 0x00A); @@ -104,15 +104,15 @@ namespace DiscImageChef.Plugins variable_size = new byte[MDB.drVNSiz]; Array.Copy(mdb_sector, 0x025, variable_size, 0, MDB.drVNSiz); MDB.drVN = Encoding.ASCII.GetString(variable_size); - + BB.signature = BigEndianBitConverter.ToUInt16(bb_sector, 0x000); - - if (BB.signature == MFSBB_MAGIC) + + if(BB.signature == MFSBB_MAGIC) { BB.branch = BigEndianBitConverter.ToUInt32(bb_sector, 0x002); BB.boot_flags = bb_sector[0x006]; BB.boot_version = bb_sector[0x007]; - + BB.sec_sv_pages = BigEndianBitConverter.ToInt16(bb_sector, 0x008); Array.Copy(mdb_sector, 0x00A, pString, 0, 16); @@ -138,15 +138,15 @@ namespace DiscImageChef.Plugins } else BB.signature = 0x0000; - + sb.AppendLine("Apple Macintosh File System"); sb.AppendLine(); sb.AppendLine("Master Directory Block:"); sb.AppendFormat("Creation date: {0}", DateHandlers.MacToDateTime(MDB.drCrDate)).AppendLine(); sb.AppendFormat("Last backup date: {0}", DateHandlers.MacToDateTime(MDB.drLsBkUp)).AppendLine(); - if ((MDB.drAtrb & 0x80) == 0x80) + if((MDB.drAtrb & 0x80) == 0x80) sb.AppendLine("Volume is locked by hardware."); - if ((MDB.drAtrb & 0x8000) == 0x8000) + if((MDB.drAtrb & 0x8000) == 0x8000) sb.AppendLine("Volume is locked by software."); sb.AppendFormat("{0} files on volume", MDB.drNmFls).AppendLine(); sb.AppendFormat("First directory block: {0}", MDB.drDirSt).AppendLine(); @@ -158,25 +158,25 @@ namespace DiscImageChef.Plugins sb.AppendFormat("Next unused file number: {0}", MDB.drNxtFNum).AppendLine(); sb.AppendFormat("{0} unused allocation blocks.", MDB.drFreeBks).AppendLine(); sb.AppendFormat("Volume name: {0}", MDB.drVN).AppendLine(); - - if (BB.signature == MFSBB_MAGIC) + + if(BB.signature == MFSBB_MAGIC) { sb.AppendLine("Volume is bootable."); sb.AppendLine(); sb.AppendLine("Boot Block:"); - if ((BB.boot_flags & 0x40) == 0x40) + if((BB.boot_flags & 0x40) == 0x40) sb.AppendLine("Boot block should be executed."); - if ((BB.boot_flags & 0x80) == 0x80) + if((BB.boot_flags & 0x80) == 0x80) { sb.AppendLine("Boot block is in new unknown format."); } else { - if (BB.sec_sv_pages > 0) + if(BB.sec_sv_pages > 0) sb.AppendLine("Allocate secondary sound buffer at boot."); - else if (BB.sec_sv_pages < 0) + else if(BB.sec_sv_pages < 0) sb.AppendLine("Allocate secondary sound and video buffers at boot."); - + sb.AppendFormat("System filename: {0}", BB.system_name).AppendLine(); sb.AppendFormat("Finder filename: {0}", BB.finder_name).AppendLine(); sb.AppendFormat("Debugger filename: {0}", BB.debug_name).AppendLine(); @@ -193,11 +193,11 @@ namespace DiscImageChef.Plugins } else sb.AppendLine("Volume is not bootable."); - + information = sb.ToString(); xmlFSType = new Schemas.FileSystemType(); - if (MDB.drLsBkUp > 0) + if(MDB.drLsBkUp > 0) { xmlFSType.BackupDate = DateHandlers.MacToDateTime(MDB.drLsBkUp); xmlFSType.BackupDateSpecified = true; @@ -205,7 +205,7 @@ namespace DiscImageChef.Plugins xmlFSType.Bootable = BB.signature == MFSBB_MAGIC; xmlFSType.Clusters = MDB.drNmAlBlks; xmlFSType.ClusterSize = (int)MDB.drAlBlkSiz; - if (MDB.drCrDate > 0) + if(MDB.drCrDate > 0) { xmlFSType.CreationDate = DateHandlers.MacToDateTime(MDB.drCrDate); xmlFSType.CreationDateSpecified = true; @@ -216,7 +216,7 @@ namespace DiscImageChef.Plugins xmlFSType.FreeClustersSpecified = true; xmlFSType.Type = "MFS"; xmlFSType.VolumeName = MDB.drVN; - + return; } diff --git a/DiscImageChef.Filesystems/BFS.cs b/DiscImageChef.Filesystems/BFS.cs index 8368e5b84..96a4b159d 100644 --- a/DiscImageChef.Filesystems/BFS.cs +++ b/DiscImageChef.Filesystems/BFS.cs @@ -65,7 +65,7 @@ namespace DiscImageChef.Plugins public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd) { - if ((2 + partitionStart) >= imagePlugin.GetSectors()) + if((2 + partitionStart) >= imagePlugin.GetSectors()) return false; UInt32 magic; @@ -76,24 +76,24 @@ namespace DiscImageChef.Plugins magic = BitConverter.ToUInt32(sb_sector, 0x20); magic_be = BigEndianBitConverter.ToUInt32(sb_sector, 0x20); - if (magic == BEFS_MAGIC1 || magic_be == BEFS_MAGIC1) + if(magic == BEFS_MAGIC1 || magic_be == BEFS_MAGIC1) return true; - if (sb_sector.Length >= 0x400) + if(sb_sector.Length >= 0x400) { magic = BitConverter.ToUInt32(sb_sector, 0x220); magic_be = BigEndianBitConverter.ToUInt32(sb_sector, 0x220); } - if (magic == BEFS_MAGIC1 || magic_be == BEFS_MAGIC1) + if(magic == BEFS_MAGIC1 || magic_be == BEFS_MAGIC1) return true; sb_sector = imagePlugin.ReadSector(1 + partitionStart); - + magic = BitConverter.ToUInt32(sb_sector, 0x20); magic_be = BigEndianBitConverter.ToUInt32(sb_sector, 0x20); - if (magic == BEFS_MAGIC1 || magic_be == BEFS_MAGIC1) + if(magic == BEFS_MAGIC1 || magic_be == BEFS_MAGIC1) return true; return false; } @@ -104,7 +104,7 @@ namespace DiscImageChef.Plugins byte[] name_bytes = new byte[32]; StringBuilder sb = new StringBuilder(); - + BeSuperBlock besb = new BeSuperBlock(); byte[] sb_sector = imagePlugin.ReadSector(0 + partitionStart); @@ -112,7 +112,7 @@ namespace DiscImageChef.Plugins BigEndianBitConverter.IsLittleEndian = true; // Default for little-endian besb.magic1 = BigEndianBitConverter.ToUInt32(sb_sector, 0x20); - if (besb.magic1 == BEFS_MAGIC1 || besb.magic1 == BEFS_CIGAM1) // Magic is at offset + if(besb.magic1 == BEFS_MAGIC1 || besb.magic1 == BEFS_CIGAM1) // Magic is at offset { BigEndianBitConverter.IsLittleEndian &= besb.magic1 != BEFS_CIGAM1; } @@ -120,20 +120,20 @@ namespace DiscImageChef.Plugins { sb_sector = imagePlugin.ReadSector(1 + partitionStart); besb.magic1 = BigEndianBitConverter.ToUInt32(sb_sector, 0x20); - - if (besb.magic1 == BEFS_MAGIC1 || besb.magic1 == BEFS_CIGAM1) // There is a boot sector + + if(besb.magic1 == BEFS_MAGIC1 || besb.magic1 == BEFS_CIGAM1) // There is a boot sector { BigEndianBitConverter.IsLittleEndian &= besb.magic1 != BEFS_CIGAM1; } - else if (sb_sector.Length >= 0x400) + else if(sb_sector.Length >= 0x400) { byte[] temp = imagePlugin.ReadSector(0 + partitionStart); besb.magic1 = BigEndianBitConverter.ToUInt32(temp, 0x220); - if (besb.magic1 == BEFS_MAGIC1 || besb.magic1 == BEFS_CIGAM1) // There is a boot sector + if(besb.magic1 == BEFS_MAGIC1 || besb.magic1 == BEFS_CIGAM1) // There is a boot sector { BigEndianBitConverter.IsLittleEndian &= besb.magic1 != BEFS_CIGAM1; - sb_sector = new byte[0x200]; + sb_sector = new byte[0x200]; Array.Copy(temp, 0x200, sb_sector, 0, 0x200); } else @@ -169,13 +169,13 @@ namespace DiscImageChef.Plugins besb.indices_ag = BigEndianBitConverter.ToInt32(sb_sector, 0x7C); besb.indices_start = BigEndianBitConverter.ToUInt16(sb_sector, 0x80); besb.indices_len = BigEndianBitConverter.ToUInt16(sb_sector, 0x82); - - if (!BigEndianBitConverter.IsLittleEndian) // Big-endian filesystem - sb.AppendLine("Little-endian BeFS"); + + if(!BigEndianBitConverter.IsLittleEndian) // Big-endian filesystem + sb.AppendLine("Little-endian BeFS"); else sb.AppendLine("Big-endian BeFS"); - - if (besb.magic1 != BEFS_MAGIC1 || besb.fs_byte_order != BEFS_ENDIAN || + + if(besb.magic1 != BEFS_MAGIC1 || besb.fs_byte_order != BEFS_ENDIAN || besb.magic2 != BEFS_MAGIC2 || besb.magic3 != BEFS_MAGIC3 || besb.root_dir_len != 1 || besb.indices_len != 1 || (1 << (int)besb.block_shift) != besb.block_size) @@ -190,19 +190,19 @@ namespace DiscImageChef.Plugins sb.AppendFormat("1 << block_shift == block_size => 1 << {0} == {1} (Should be {2})", besb.block_shift, 1 << (int)besb.block_shift, besb.block_size).AppendLine(); } - - if (besb.flags == BEFS_CLEAN) + + if(besb.flags == BEFS_CLEAN) { - if (besb.log_start == besb.log_end) + if(besb.log_start == besb.log_end) sb.AppendLine("Filesystem is clean"); else sb.AppendLine("Filesystem is dirty"); } - else if (besb.flags == BEFS_DIRTY) + else if(besb.flags == BEFS_DIRTY) sb.AppendLine("Filesystem is dirty"); else sb.AppendFormat("Unknown flags: {0:X8}", besb.flags).AppendLine(); - + sb.AppendFormat("Volume name: {0}", besb.name).AppendLine(); sb.AppendFormat("{0} bytes per block", besb.block_size).AppendLine(); sb.AppendFormat("{0} blocks in volume ({1} bytes)", besb.num_blocks, besb.num_blocks * besb.block_size).AppendLine(); @@ -217,7 +217,7 @@ namespace DiscImageChef.Plugins besb.root_dir_ag, besb.root_dir_len, besb.root_dir_len * besb.block_size).AppendLine(); sb.AppendFormat("Indices' i-node resides in block {0} of allocation group {1} and runs for {2} blocks ({3} bytes)", besb.indices_start, besb.indices_ag, besb.indices_len, besb.indices_len * besb.block_size).AppendLine(); - + information = sb.ToString(); xmlFSType = new Schemas.FileSystemType(); diff --git a/DiscImageChef.Filesystems/FAT.cs b/DiscImageChef.Filesystems/FAT.cs index 9da5bf146..65ffbe5fa 100644 --- a/DiscImageChef.Filesystems/FAT.cs +++ b/DiscImageChef.Filesystems/FAT.cs @@ -57,7 +57,7 @@ namespace DiscImageChef.Plugins public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd) { - if ((2 + partitionStart) >= imagePlugin.GetSectors()) + if((2 + partitionStart) >= imagePlugin.GetSectors()) return false; byte media_descriptor; // Not present on DOS <= 3, present on TOS but != of first FAT entry @@ -75,17 +75,17 @@ namespace DiscImageChef.Plugins media_descriptor = bpb_sector[0x015]; // Media Descriptor if present is in 0x15 Array.Copy(bpb_sector, 0x52, fat32_signature, 0, 8); // FAT32 signature, if present, is in 0x52 bps = BitConverter.ToUInt16(bpb_sector, 0x00B); // Bytes per sector - if (bps == 0) + if(bps == 0) bps = 0x200; rsectors = BitConverter.ToUInt16(bpb_sector, 0x00E); // Sectors between BPB and FAT, including the BPB sector => [BPB,FAT) - if (rsectors == 0) + if(rsectors == 0) rsectors = 1; - if (imagePlugin.GetSectors() > ((ulong)rsectors + partitionStart)) + if(imagePlugin.GetSectors() > ((ulong)rsectors + partitionStart)) fat_sector = imagePlugin.ReadSector(rsectors + partitionStart); // First FAT entry - else - bpb_found=false; + else + bpb_found = false; - if (bpb_found) + if(bpb_found) { first_fat_entry = BitConverter.ToUInt32(fat_sector, 0); // Easier to manage @@ -95,19 +95,19 @@ namespace DiscImageChef.Plugins DicConsole.DebugWriteLine("FAT plugin", "bps = {0}", bps); DicConsole.DebugWriteLine("FAT plugin", "first_fat_entry = 0x{0:X8}", first_fat_entry); - if (fats_no > 2) // Must be 1 or 2, but as TOS makes strange things and I have not checked if it puts this to 0, ignore if 0. MUST NOT BE BIGGER THAN 2! - return false; + if(fats_no > 2) // Must be 1 or 2, but as TOS makes strange things and I have not checked if it puts this to 0, ignore if 0. MUST NOT BE BIGGER THAN 2! + return false; // Let's start the fun - if (Encoding.ASCII.GetString(fat32_signature) == "FAT32 ") + if(Encoding.ASCII.GetString(fat32_signature) == "FAT32 ") return true; // Seems easy, check reading - - if ((first_fat_entry & 0xFFFFFFF0) == 0xFFFFFFF0) // Seems to be FAT16 + + if((first_fat_entry & 0xFFFFFFF0) == 0xFFFFFFF0) // Seems to be FAT16 { - if ((first_fat_entry & 0xFF) == media_descriptor) + if((first_fat_entry & 0xFF) == media_descriptor) return true; // It MUST be FAT16, or... maybe not :S } - else if ((first_fat_entry & 0x00FFFFF0) == 0x00FFFFF0) + else if((first_fat_entry & 0x00FFFFF0) == 0x00FFFFF0) { //if((first_fat_entry & 0xFF) == media_descriptor) // Pre DOS<4 does not implement this, TOS does and is != return true; // It MUST be FAT12, or... maybe not :S @@ -120,20 +120,20 @@ namespace DiscImageChef.Plugins first_fat_entry = BitConverter.ToUInt32(fat_sector, 0); byte fat_id = fat_sector[0]; - if ((first_fat_entry & 0x00FFFFF0) == 0x00FFFFF0) + if((first_fat_entry & 0x00FFFFF0) == 0x00FFFFF0) { - if (fat_id == 0xFF) + if(fat_id == 0xFF) { - if (imagePlugin.GetSectorSize() == 512 && imagePlugin.GetSectors() == 640) + if(imagePlugin.GetSectorSize() == 512 && imagePlugin.GetSectors() == 640) return true; - if (imagePlugin.GetSectorSize() == 128) + if(imagePlugin.GetSectorSize() == 128) { if(imagePlugin.GetSectors() == 2002) return true; if(imagePlugin.GetSectors() == 4004) return true; } - if (imagePlugin.GetSectorSize() == 1024) + if(imagePlugin.GetSectorSize() == 1024) { if(imagePlugin.GetSectors() == 616) return true; @@ -143,18 +143,18 @@ namespace DiscImageChef.Plugins return false; } - if (fat_id == 0xFE) + if(fat_id == 0xFE) { - if (imagePlugin.GetSectorSize() == 512 && imagePlugin.GetSectors() == 320) + if(imagePlugin.GetSectorSize() == 512 && imagePlugin.GetSectors() == 320) return true; - if (imagePlugin.GetSectorSize() == 128) + if(imagePlugin.GetSectorSize() == 128) { if(imagePlugin.GetSectors() == 2002) return true; if(imagePlugin.GetSectors() == 4004) return true; } - if (imagePlugin.GetSectorSize() == 1024) + if(imagePlugin.GetSectorSize() == 1024) { if(imagePlugin.GetSectors() == 616) return true; @@ -164,7 +164,7 @@ namespace DiscImageChef.Plugins return false; } - if (fat_id == 0xFD && imagePlugin.GetSectors() == 2002) + if(fat_id == 0xFD && imagePlugin.GetSectors() == 2002) return true; } } @@ -175,7 +175,7 @@ namespace DiscImageChef.Plugins public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, out string information) { information = ""; - + StringBuilder sb = new StringBuilder(); xmlFSType = new Schemas.FileSystemType(); @@ -197,39 +197,39 @@ namespace DiscImageChef.Plugins Array.Copy(bpb_sector, 0x52, dosString, 0, 8); // FAT32 signature, if present, is in 0x52 fat32_signature = Encoding.ASCII.GetString(dosString); bps = BitConverter.ToUInt16(bpb_sector, 0x00B); // Bytes per sector - if (bps == 0) + if(bps == 0) bps = 0x200; rsectors = BitConverter.ToUInt16(bpb_sector, 0x00E); // Sectors between BPB and FAT, including the BPB sector => [BPB,FAT) - if (rsectors == 0) + if(rsectors == 0) rsectors = 1; - if (imagePlugin.GetSectors() > ((ulong)rsectors + partitionStart)) + if(imagePlugin.GetSectors() > ((ulong)rsectors + partitionStart)) fat_sector = imagePlugin.ReadSector(rsectors + partitionStart); // First FAT entry else - bpb_found=false; + bpb_found = false; - if (bpb_found) + if(bpb_found) { first_fat_entry = BitConverter.ToUInt32(fat_sector, 0); // Easier to manage - if (fats_no > 2) // Must be 1 or 2, but as TOS makes strange things and I have not checked if it puts this to 0, ignore if 0. MUST NOT BE BIGGER THAN 2! - return; + if(fats_no > 2) // Must be 1 or 2, but as TOS makes strange things and I have not checked if it puts this to 0, ignore if 0. MUST NOT BE BIGGER THAN 2! + return; // Let's start the fun - if (fat32_signature == "FAT32 ") + if(fat32_signature == "FAT32 ") { sb.AppendLine("Microsoft FAT32"); // Seems easy, check reading xmlFSType.Type = "FAT32"; isFAT32 = true; } - else if ((first_fat_entry & 0xFFFFFFF0) == 0xFFFFFFF0) // Seems to be FAT16 + else if((first_fat_entry & 0xFFFFFFF0) == 0xFFFFFFF0) // Seems to be FAT16 { - if ((first_fat_entry & 0xFF) == media_descriptor) + if((first_fat_entry & 0xFF) == media_descriptor) { sb.AppendLine("Microsoft FAT16"); // It MUST be FAT16, or... maybe not :S xmlFSType.Type = "FAT16"; } } - else if ((first_fat_entry & 0x00FFFFF0) == 0x00FFFFF0) + else if((first_fat_entry & 0x00FFFFF0) == 0x00FFFFF0) { //if((first_fat_entry & 0xFF) == media_descriptor) // Pre DOS<4 does not implement this, TOS does and is != sb.AppendLine("Microsoft FAT12"); // It MUST be FAT12, or... maybe not :S @@ -237,11 +237,11 @@ namespace DiscImageChef.Plugins } else return; - + BIOSParameterBlock BPB = new BIOSParameterBlock(); ExtendedParameterBlock EPB = new ExtendedParameterBlock(); FAT32ParameterBlock FAT32PB = new FAT32ParameterBlock(); - + dosString = new byte[8]; Array.Copy(bpb_sector, 0x03, dosString, 0, 8); BPB.OEMName = StringHandlers.CToString(dosString); @@ -257,8 +257,8 @@ namespace DiscImageChef.Plugins BPB.heads = BitConverter.ToUInt16(bpb_sector, 0x1A); BPB.hsectors = BitConverter.ToUInt32(bpb_sector, 0x1C); BPB.big_sectors = BitConverter.ToUInt32(bpb_sector, 0x20); - - if (isFAT32) + + if(isFAT32) { FAT32PB.spfat = BitConverter.ToUInt32(bpb_sector, 0x24); FAT32PB.fat_flags = BitConverter.ToUInt16(bpb_sector, 0x28); @@ -290,7 +290,7 @@ namespace DiscImageChef.Plugins Array.Copy(bpb_sector, 0x36, dosString, 0, 8); EPB.fs_type = StringHandlers.CToString(dosString); } - + sb.AppendFormat("OEM Name: {0}", BPB.OEMName).AppendLine(); sb.AppendFormat("{0} bytes per sector.", BPB.bps).AppendLine(); sb.AppendFormat("{0} sectors per cluster.", BPB.spc).AppendLine(); @@ -298,7 +298,7 @@ namespace DiscImageChef.Plugins sb.AppendFormat("{0} sectors reserved between BPB and FAT.", BPB.rsectors).AppendLine(); sb.AppendFormat("{0} FATs.", BPB.fats_no).AppendLine(); sb.AppendFormat("{0} entries on root directory.", BPB.root_ent).AppendLine(); - if (BPB.sectors == 0) + if(BPB.sectors == 0) { sb.AppendFormat("{0} sectors on volume ({1} bytes).", BPB.big_sectors, BPB.big_sectors * BPB.bps).AppendLine(); xmlFSType.Clusters = BPB.big_sectors / BPB.spc; @@ -308,17 +308,17 @@ namespace DiscImageChef.Plugins sb.AppendFormat("{0} sectors on volume ({1} bytes).", BPB.sectors, BPB.sectors * BPB.bps).AppendLine(); xmlFSType.Clusters = BPB.sectors / BPB.spc; } - if ((BPB.media & 0xF0) == 0xF0) + if((BPB.media & 0xF0) == 0xF0) sb.AppendFormat("Media format: 0x{0:X2}", BPB.media).AppendLine(); - if (fat32_signature == "FAT32 ") + if(fat32_signature == "FAT32 ") sb.AppendFormat("{0} sectors per FAT.", FAT32PB.spfat).AppendLine(); else sb.AppendFormat("{0} sectors per FAT.", BPB.spfat).AppendLine(); sb.AppendFormat("{0} sectors per track.", BPB.sptrk).AppendLine(); sb.AppendFormat("{0} heads.", BPB.heads).AppendLine(); sb.AppendFormat("{0} hidden sectors before BPB.", BPB.hsectors).AppendLine(); - - if (isFAT32) + + if(isFAT32) { sb.AppendFormat("Cluster of root directory: {0}", FAT32PB.root_cluster).AppendLine(); sb.AppendFormat("Sector of FSINFO structure: {0}", FAT32PB.fsinfo_sector).AppendLine(); @@ -326,34 +326,34 @@ namespace DiscImageChef.Plugins sb.AppendFormat("Drive number: 0x{0:X2}", FAT32PB.drive_no).AppendLine(); sb.AppendFormat("Volume Serial Number: 0x{0:X8}", FAT32PB.serial_no).AppendLine(); xmlFSType.VolumeSerial = String.Format("{0:X8}", FAT32PB.serial_no); - if ((FAT32PB.nt_flags & 0x01) == 0x01) + if((FAT32PB.nt_flags & 0x01) == 0x01) { - sb.AppendLine("Volume should be checked on next mount."); - if ((EPB.nt_flags & 0x02) == 0x02) - sb.AppendLine("Disk surface should be checked also."); + sb.AppendLine("Volume should be checked on next mount."); + if((EPB.nt_flags & 0x02) == 0x02) + sb.AppendLine("Disk surface should be checked also."); xmlFSType.Dirty = true; } - + sb.AppendFormat("Volume label: {0}", EPB.volume_label).AppendLine(); if(!string.IsNullOrEmpty(EPB.volume_label)) xmlFSType.VolumeName = EPB.volume_label; sb.AppendFormat("Filesystem type: {0}", EPB.fs_type).AppendLine(); } - else if (EPB.signature == 0x28 || EPB.signature == 0x29) + else if(EPB.signature == 0x28 || EPB.signature == 0x29) { sb.AppendFormat("Drive number: 0x{0:X2}", EPB.drive_no).AppendLine(); sb.AppendFormat("Volume Serial Number: 0x{0:X8}", EPB.serial_no).AppendLine(); xmlFSType.VolumeSerial = String.Format("{0:X8}", EPB.serial_no); - if (EPB.signature == 0x29) + if(EPB.signature == 0x29) { - if ((EPB.nt_flags & 0x01) == 0x01) + if((EPB.nt_flags & 0x01) == 0x01) { - sb.AppendLine("Volume should be checked on next mount."); - if ((EPB.nt_flags & 0x02) == 0x02) - sb.AppendLine("Disk surface should be checked also."); + sb.AppendLine("Volume should be checked on next mount."); + if((EPB.nt_flags & 0x02) == 0x02) + sb.AppendLine("Disk surface should be checked also."); xmlFSType.Dirty = true; } - + sb.AppendFormat("Volume label: {0}", EPB.volume_label).AppendLine(); if(!string.IsNullOrEmpty(EPB.volume_label)) xmlFSType.VolumeName = EPB.volume_label; @@ -368,10 +368,10 @@ namespace DiscImageChef.Plugins sb.AppendLine("This may be a false positive."); sb.AppendFormat("Disk image identifies disk type as {0}.", imagePlugin.GetMediaType()).AppendLine(); } - + information = sb.ToString(); } - + /// FAT's BIOS Parameter Block. public struct BIOSParameterBlock { diff --git a/DiscImageChef.Filesystems/FFS.cs b/DiscImageChef.Filesystems/FFS.cs index fd6ecc81b..303d2d288 100644 --- a/DiscImageChef.Filesystems/FFS.cs +++ b/DiscImageChef.Filesystems/FFS.cs @@ -56,60 +56,60 @@ namespace DiscImageChef.Plugins public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd) { - if ((2 + partitionStart) >= imagePlugin.GetSectors()) + if((2 + partitionStart) >= imagePlugin.GetSectors()) return false; UInt32 magic; uint sb_size_in_sectors; byte[] ufs_sb_sectors; - if (imagePlugin.GetSectorSize() == 2336 || imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448) + if(imagePlugin.GetSectorSize() == 2336 || imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448) sb_size_in_sectors = block_size / 2048; else sb_size_in_sectors = block_size / imagePlugin.GetSectorSize(); - if (imagePlugin.GetSectors() > (partitionStart + sb_start_floppy * sb_size_in_sectors + sb_size_in_sectors)) + if(imagePlugin.GetSectors() > (partitionStart + sb_start_floppy * sb_size_in_sectors + sb_size_in_sectors)) { ufs_sb_sectors = imagePlugin.ReadSectors(partitionStart + sb_start_floppy * sb_size_in_sectors, sb_size_in_sectors); magic = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x055C); - if (magic == UFS_MAGIC || magic == UFS_MAGIC_BW || magic == UFS2_MAGIC || magic == UFS_CIGAM || magic == UFS_BAD_MAGIC) + if(magic == UFS_MAGIC || magic == UFS_MAGIC_BW || magic == UFS2_MAGIC || magic == UFS_CIGAM || magic == UFS_BAD_MAGIC) return true; } - if (imagePlugin.GetSectors() > (partitionStart + sb_start_ufs1 * sb_size_in_sectors + sb_size_in_sectors)) + if(imagePlugin.GetSectors() > (partitionStart + sb_start_ufs1 * sb_size_in_sectors + sb_size_in_sectors)) { ufs_sb_sectors = imagePlugin.ReadSectors(partitionStart + sb_start_ufs1 * sb_size_in_sectors, sb_size_in_sectors); magic = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x055C); - if (magic == UFS_MAGIC || magic == UFS_MAGIC_BW || magic == UFS2_MAGIC || magic == UFS_CIGAM || magic == UFS_BAD_MAGIC) + if(magic == UFS_MAGIC || magic == UFS_MAGIC_BW || magic == UFS2_MAGIC || magic == UFS_CIGAM || magic == UFS_BAD_MAGIC) return true; } - if (imagePlugin.GetSectors() > (partitionStart + sb_start_ufs2 * sb_size_in_sectors + sb_size_in_sectors)) + if(imagePlugin.GetSectors() > (partitionStart + sb_start_ufs2 * sb_size_in_sectors + sb_size_in_sectors)) { ufs_sb_sectors = imagePlugin.ReadSectors(partitionStart + sb_start_ufs2 * sb_size_in_sectors, sb_size_in_sectors); magic = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x055C); - if (magic == UFS_MAGIC || magic == UFS_MAGIC_BW || magic == UFS2_MAGIC || magic == UFS_CIGAM || magic == UFS_BAD_MAGIC) + if(magic == UFS_MAGIC || magic == UFS_MAGIC_BW || magic == UFS2_MAGIC || magic == UFS_CIGAM || magic == UFS_BAD_MAGIC) return true; } - if (imagePlugin.GetSectors() > (partitionStart + sb_start_piggy * sb_size_in_sectors + sb_size_in_sectors)) + if(imagePlugin.GetSectors() > (partitionStart + sb_start_piggy * sb_size_in_sectors + sb_size_in_sectors)) { ufs_sb_sectors = imagePlugin.ReadSectors(partitionStart + sb_start_piggy * sb_size_in_sectors, sb_size_in_sectors); magic = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x055C); - if (magic == UFS_MAGIC || magic == UFS_MAGIC_BW || magic == UFS2_MAGIC || magic == UFS_CIGAM || magic == UFS_BAD_MAGIC) + if(magic == UFS_MAGIC || magic == UFS_MAGIC_BW || magic == UFS2_MAGIC || magic == UFS_CIGAM || magic == UFS_BAD_MAGIC) return true; } - if (imagePlugin.GetSectors() > (partitionStart + sb_start_atari / imagePlugin.GetSectorSize() + sb_size_in_sectors)) + if(imagePlugin.GetSectors() > (partitionStart + sb_start_atari / imagePlugin.GetSectorSize() + sb_size_in_sectors)) { ufs_sb_sectors = imagePlugin.ReadSectors(partitionStart + (sb_start_atari / imagePlugin.GetSectorSize()), sb_size_in_sectors); magic = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x055C); - if (magic == UFS_MAGIC || magic == UFS_MAGIC_BW || magic == UFS2_MAGIC || magic == UFS_CIGAM || magic == UFS_BAD_MAGIC) + if(magic == UFS_MAGIC || magic == UFS_MAGIC_BW || magic == UFS2_MAGIC || magic == UFS_CIGAM || magic == UFS_BAD_MAGIC) return true; } @@ -133,67 +133,67 @@ namespace DiscImageChef.Plugins bool fs_type_sun = false; bool fs_type_sun86 = false; - if (imagePlugin.GetSectorSize() == 2336 || imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448) + if(imagePlugin.GetSectorSize() == 2336 || imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448) sb_size_in_sectors = block_size / 2048; else sb_size_in_sectors = block_size / imagePlugin.GetSectorSize(); - - if (imagePlugin.GetSectors() > (partitionStart + sb_start_floppy * sb_size_in_sectors + sb_size_in_sectors) && magic == 0) + + if(imagePlugin.GetSectors() > (partitionStart + sb_start_floppy * sb_size_in_sectors + sb_size_in_sectors) && magic == 0) { ufs_sb_sectors = imagePlugin.ReadSectors(partitionStart + sb_start_floppy * sb_size_in_sectors, sb_size_in_sectors); magic = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x055C); - - if (magic == UFS_MAGIC || magic == UFS_MAGIC_BW || magic == UFS2_MAGIC || magic == UFS_CIGAM || magic == UFS_BAD_MAGIC) + + if(magic == UFS_MAGIC || magic == UFS_MAGIC_BW || magic == UFS2_MAGIC || magic == UFS_CIGAM || magic == UFS_BAD_MAGIC) sb_offset = partitionStart + sb_start_floppy * sb_size_in_sectors; else magic = 0; } - if (imagePlugin.GetSectors() > (partitionStart + sb_start_ufs1 * sb_size_in_sectors + sb_size_in_sectors) && magic == 0) + if(imagePlugin.GetSectors() > (partitionStart + sb_start_ufs1 * sb_size_in_sectors + sb_size_in_sectors) && magic == 0) { ufs_sb_sectors = imagePlugin.ReadSectors(partitionStart + sb_start_ufs1 * sb_size_in_sectors, sb_size_in_sectors); magic = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x055C); - - if (magic == UFS_MAGIC || magic == UFS_MAGIC_BW || magic == UFS2_MAGIC || magic == UFS_CIGAM || magic == UFS_BAD_MAGIC) + + if(magic == UFS_MAGIC || magic == UFS_MAGIC_BW || magic == UFS2_MAGIC || magic == UFS_CIGAM || magic == UFS_BAD_MAGIC) sb_offset = partitionStart + sb_start_ufs1 * sb_size_in_sectors; else magic = 0; } - if (imagePlugin.GetSectors() > (partitionStart + sb_start_ufs2 * sb_size_in_sectors + sb_size_in_sectors) && magic == 0) + if(imagePlugin.GetSectors() > (partitionStart + sb_start_ufs2 * sb_size_in_sectors + sb_size_in_sectors) && magic == 0) { ufs_sb_sectors = imagePlugin.ReadSectors(partitionStart + sb_start_ufs2 * sb_size_in_sectors, sb_size_in_sectors); magic = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x055C); - - if (magic == UFS_MAGIC || magic == UFS_MAGIC_BW || magic == UFS2_MAGIC || magic == UFS_CIGAM || magic == UFS_BAD_MAGIC) + + if(magic == UFS_MAGIC || magic == UFS_MAGIC_BW || magic == UFS2_MAGIC || magic == UFS_CIGAM || magic == UFS_BAD_MAGIC) sb_offset = partitionStart + sb_start_ufs2 * sb_size_in_sectors; else magic = 0; } - if (imagePlugin.GetSectors() > (partitionStart + sb_start_piggy * sb_size_in_sectors + sb_size_in_sectors) && magic == 0) + if(imagePlugin.GetSectors() > (partitionStart + sb_start_piggy * sb_size_in_sectors + sb_size_in_sectors) && magic == 0) { ufs_sb_sectors = imagePlugin.ReadSectors(partitionStart + sb_start_piggy * sb_size_in_sectors, sb_size_in_sectors); magic = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x055C); - if (magic == UFS_MAGIC || magic == UFS_MAGIC_BW || magic == UFS2_MAGIC || magic == UFS_CIGAM || magic == UFS_BAD_MAGIC) + if(magic == UFS_MAGIC || magic == UFS_MAGIC_BW || magic == UFS2_MAGIC || magic == UFS_CIGAM || magic == UFS_BAD_MAGIC) sb_offset = partitionStart + sb_start_piggy * sb_size_in_sectors; else magic = 0; } - if (imagePlugin.GetSectors() > (partitionStart + sb_start_atari / imagePlugin.GetSectorSize() + sb_size_in_sectors) && magic == 0) - { + if(imagePlugin.GetSectors() > (partitionStart + sb_start_atari / imagePlugin.GetSectorSize() + sb_size_in_sectors) && magic == 0) + { ufs_sb_sectors = imagePlugin.ReadSectors(partitionStart + sb_start_atari / imagePlugin.GetSectorSize(), sb_size_in_sectors); magic = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x055C); - if (magic == UFS_MAGIC || magic == UFS_MAGIC_BW || magic == UFS2_MAGIC || magic == UFS_CIGAM || magic == UFS_BAD_MAGIC) + if(magic == UFS_MAGIC || magic == UFS_MAGIC_BW || magic == UFS2_MAGIC || magic == UFS_CIGAM || magic == UFS_BAD_MAGIC) sb_offset = partitionStart + sb_start_atari / imagePlugin.GetSectorSize(); else magic = 0; } - if (magic == 0) + if(magic == 0) { information = "Not a UFS filesystem, I shouldn't have arrived here!"; return; @@ -201,7 +201,7 @@ namespace DiscImageChef.Plugins xmlFSType = new Schemas.FileSystemType(); - switch (magic) + switch(magic) { case UFS_MAGIC: sbInformation.AppendLine("UFS filesystem"); @@ -549,7 +549,7 @@ namespace DiscImageChef.Plugins sbInformation.AppendLine("There are a lot of variants of UFS using overlapped values on same fields"); sbInformation.AppendLine("I will try to guess which one it is, but unless it's UFS2, I may be surely wrong"); - if (ufs_sb.fs_magic == UFS2_MAGIC) + if(ufs_sb.fs_magic == UFS2_MAGIC) { fs_type_ufs2 = true; } @@ -559,13 +559,13 @@ namespace DiscImageChef.Plugins fs_type_43bsd = true; // There is no way of knowing this is the version, but there is of knowing it is not. - if (ufs_sb.fs_link_42bsd > 0) + if(ufs_sb.fs_link_42bsd > 0) { fs_type_42bsd = true; // It was used in 4.2BSD fs_type_43bsd = false; } - if (ufs_sb.fs_state_t_sun > SunOSEpoch && DateHandlers.UNIXUnsignedToDateTime(ufs_sb.fs_state_t_sun) < DateTime.Now) + if(ufs_sb.fs_state_t_sun > SunOSEpoch && DateHandlers.UNIXUnsignedToDateTime(ufs_sb.fs_state_t_sun) < DateTime.Now) { fs_type_42bsd = false; fs_type_sun = true; @@ -573,7 +573,7 @@ namespace DiscImageChef.Plugins } // This is for sure, as it is shared with a sectors/track with non-x86 SunOS, Epoch is absurdly high for that - if (ufs_sb.fs_state_t_sun86 > SunOSEpoch && DateHandlers.UNIXUnsignedToDateTime(ufs_sb.fs_state_t_sun) < DateTime.Now) + if(ufs_sb.fs_state_t_sun86 > SunOSEpoch && DateHandlers.UNIXUnsignedToDateTime(ufs_sb.fs_state_t_sun) < DateTime.Now) { fs_type_42bsd = false; fs_type_sun86 = true; @@ -581,7 +581,7 @@ namespace DiscImageChef.Plugins fs_type_43bsd = false; } - if (ufs_sb.fs_cgrotor_ufs1 > 0x00000000 && ufs_sb.fs_cgrotor_ufs1 < 0xFFFFFFFF) + if(ufs_sb.fs_cgrotor_ufs1 > 0x00000000 && ufs_sb.fs_cgrotor_ufs1 < 0xFFFFFFFF) { fs_type_42bsd = false; fs_type_sun = false; @@ -597,24 +597,24 @@ namespace DiscImageChef.Plugins fs_type_44bsd |= ufs_sb.fs_inodefmt_44bsd == 2; } - if (fs_type_42bsd) + if(fs_type_42bsd) sbInformation.AppendLine("Guessed as 42BSD FFS"); - if (fs_type_43bsd) + if(fs_type_43bsd) sbInformation.AppendLine("Guessed as 43BSD FFS"); - if (fs_type_44bsd) + if(fs_type_44bsd) sbInformation.AppendLine("Guessed as 44BSD FFS"); - if (fs_type_sun) + if(fs_type_sun) sbInformation.AppendLine("Guessed as SunOS FFS"); - if (fs_type_sun86) + if(fs_type_sun86) sbInformation.AppendLine("Guessed as SunOS/x86 FFS"); - if (fs_type_ufs) + if(fs_type_ufs) sbInformation.AppendLine("Guessed as UFS"); - if (fs_type_ufs2) + if(fs_type_ufs2) sbInformation.AppendLine("Guessed as UFS2"); - if (fs_type_42bsd) + if(fs_type_42bsd) sbInformation.AppendFormat("Linked list of filesystems: 0x{0:X8}", ufs_sb.fs_link_42bsd).AppendLine(); - else if (fs_type_sun) + else if(fs_type_sun) sbInformation.AppendFormat("Filesystem state flag: 0x{0:X8}", ufs_sb.fs_state_sun).AppendLine(); sbInformation.AppendFormat("Superblock LBA: {0}", ufs_sb.fs_sblkno).AppendLine(); sbInformation.AppendFormat("Cylinder-block LBA: {0}", ufs_sb.fs_cblkno).AppendLine(); @@ -633,34 +633,34 @@ namespace DiscImageChef.Plugins sbInformation.AppendFormat("{0}% of blocks must be free", ufs_sb.fs_minfree).AppendLine(); sbInformation.AppendFormat("{0}ms for optimal next block", ufs_sb.fs_rotdelay).AppendLine(); sbInformation.AppendFormat("disk rotates {0} times per second ({1}rpm)", ufs_sb.fs_rps, ufs_sb.fs_rps * 60).AppendLine(); -/* sbInformation.AppendFormat("fs_bmask: 0x{0:X8}", ufs_sb.fs_bmask).AppendLine(); - sbInformation.AppendFormat("fs_fmask: 0x{0:X8}", ufs_sb.fs_fmask).AppendLine(); - sbInformation.AppendFormat("fs_bshift: 0x{0:X8}", ufs_sb.fs_bshift).AppendLine(); - sbInformation.AppendFormat("fs_fshift: 0x{0:X8}", ufs_sb.fs_fshift).AppendLine();*/ + /* sbInformation.AppendFormat("fs_bmask: 0x{0:X8}", ufs_sb.fs_bmask).AppendLine(); + sbInformation.AppendFormat("fs_fmask: 0x{0:X8}", ufs_sb.fs_fmask).AppendLine(); + sbInformation.AppendFormat("fs_bshift: 0x{0:X8}", ufs_sb.fs_bshift).AppendLine(); + sbInformation.AppendFormat("fs_fshift: 0x{0:X8}", ufs_sb.fs_fshift).AppendLine();*/ sbInformation.AppendFormat("{0} contiguous blocks at maximum", ufs_sb.fs_maxcontig).AppendLine(); sbInformation.AppendFormat("{0} blocks per cylinder group at maximum", ufs_sb.fs_maxbpg).AppendLine(); sbInformation.AppendFormat("Superblock is {0} bytes", ufs_sb.fs_sbsize).AppendLine(); sbInformation.AppendFormat("NINDIR: 0x{0:X8}", ufs_sb.fs_nindir).AppendLine(); sbInformation.AppendFormat("INOPB: 0x{0:X8}", ufs_sb.fs_inopb).AppendLine(); sbInformation.AppendFormat("NSPF: 0x{0:X8}", ufs_sb.fs_nspf).AppendLine(); - if (ufs_sb.fs_optim == 0) + if(ufs_sb.fs_optim == 0) sbInformation.AppendLine("Filesystem will minimize allocation time"); - else if (ufs_sb.fs_optim == 1) + else if(ufs_sb.fs_optim == 1) sbInformation.AppendLine("Filesystem will minimize volume fragmentation"); else sbInformation.AppendFormat("Unknown optimization value: 0x{0:X8}", ufs_sb.fs_optim).AppendLine(); - if (fs_type_sun) + if(fs_type_sun) sbInformation.AppendFormat("{0} sectors/track", ufs_sb.fs_npsect_sun).AppendLine(); - else if (fs_type_sun86) + else if(fs_type_sun86) sbInformation.AppendFormat("Volume state on {0}", DateHandlers.UNIXUnsignedToDateTime(ufs_sb.fs_state_t_sun86)).AppendLine(); sbInformation.AppendFormat("Hardware sector interleave: {0}", ufs_sb.fs_interleave).AppendLine(); sbInformation.AppendFormat("Sector 0 skew: {0}/track", ufs_sb.fs_trackskew).AppendLine(); - if (!fs_type_43bsd && ufs_sb.fs_id_1 > 0 && ufs_sb.fs_id_2 > 0) + if(!fs_type_43bsd && ufs_sb.fs_id_1 > 0 && ufs_sb.fs_id_2 > 0) { sbInformation.AppendFormat("Volume ID: 0x{0:X8}{1:X8}", ufs_sb.fs_id_1, ufs_sb.fs_id_2).AppendLine(); xmlFSType.VolumeSerial = String.Format("{0:X8}{1:x8}", ufs_sb.fs_id_1, ufs_sb.fs_id_2); } - else if (fs_type_43bsd && ufs_sb.fs_headswitch_43bsd > 0 && ufs_sb.fs_trkseek_43bsd > 0) + else if(fs_type_43bsd && ufs_sb.fs_headswitch_43bsd > 0 && ufs_sb.fs_trkseek_43bsd > 0) { sbInformation.AppendFormat("{0} µsec for head switch", ufs_sb.fs_headswitch_43bsd).AppendLine(); sbInformation.AppendFormat("{0} µsec for track-to-track seek", ufs_sb.fs_trkseek_43bsd).AppendLine(); @@ -681,22 +681,22 @@ namespace DiscImageChef.Plugins xmlFSType.FreeClustersSpecified = true; sbInformation.AppendFormat("{0} free inodes", ufs_sb.fs_cstotal_nifree).AppendLine(); sbInformation.AppendFormat("{0} free frags", ufs_sb.fs_cstotal_nffree).AppendLine(); - if (ufs_sb.fs_fmod == 1) + if(ufs_sb.fs_fmod == 1) { sbInformation.AppendLine("Superblock is under modification"); xmlFSType.Dirty = true; } - if (ufs_sb.fs_clean == 1) + if(ufs_sb.fs_clean == 1) sbInformation.AppendLine("Volume is clean"); - if (ufs_sb.fs_ronly == 1) + if(ufs_sb.fs_ronly == 1) sbInformation.AppendLine("Volume is read-only"); sbInformation.AppendFormat("Volume flags: 0x{0:X2}", ufs_sb.fs_flags).AppendLine(); - if (fs_type_ufs) + if(fs_type_ufs) { sbInformation.AppendFormat("Volume last mounted on \"{0}\"", ufs_sb.fs_fsmnt_ufs1).AppendLine(); sbInformation.AppendFormat("Last searched cylinder group: {0}", ufs_sb.fs_cgrotor_ufs1).AppendLine(); } - else if (fs_type_ufs2) + else if(fs_type_ufs2) { sbInformation.AppendFormat("Volume last mounted on \"{0}\"", ufs_sb.fs_fsmnt_ufs2).AppendLine(); sbInformation.AppendFormat("Volume name: \"{0}\"", ufs_sb.fs_volname_ufs2).AppendLine(); @@ -723,15 +723,15 @@ namespace DiscImageChef.Plugins sbInformation.AppendFormat("{0} blocks pending of being freed", ufs_sb.fs_pendingblocks_ufs2).AppendLine(); sbInformation.AppendFormat("{0} inodes pending of being freed", ufs_sb.fs_pendinginodes_ufs2).AppendLine(); } - if (fs_type_sun) + if(fs_type_sun) { sbInformation.AppendFormat("Volume state on {0}", DateHandlers.UNIXUnsignedToDateTime(ufs_sb.fs_state_t_sun)).AppendLine(); } - else if (fs_type_sun86) + else if(fs_type_sun86) { sbInformation.AppendFormat("{0} sectors/track", ufs_sb.fs_npsect_sun86).AppendLine(); } - else if (fs_type_44bsd) + else if(fs_type_44bsd) { sbInformation.AppendFormat("{0} blocks on cluster summary array", ufs_sb.fs_contigsumsize_44bsd).AppendLine(); sbInformation.AppendFormat("Maximum length of a symbolic link: {0}", ufs_sb.fs_maxsymlinklen_44bsd).AppendLine(); diff --git a/DiscImageChef.Filesystems/HPFS.cs b/DiscImageChef.Filesystems/HPFS.cs index 511457cb4..62f2c9ed2 100644 --- a/DiscImageChef.Filesystems/HPFS.cs +++ b/DiscImageChef.Filesystems/HPFS.cs @@ -54,16 +54,16 @@ namespace DiscImageChef.Plugins public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd) { - if ((2 + partitionStart) >= imagePlugin.GetSectors()) + if((2 + partitionStart) >= imagePlugin.GetSectors()) return false; UInt32 magic1, magic2; - + byte[] hpfs_sb_sector = imagePlugin.ReadSector(16 + partitionStart); // Seek to superblock, on logical sector 16 magic1 = BitConverter.ToUInt32(hpfs_sb_sector, 0x000); magic2 = BitConverter.ToUInt32(hpfs_sb_sector, 0x004); - - if (magic1 == 0xF995E849 && magic2 == 0xFA53E9C5) + + if(magic1 == 0xF995E849 && magic2 == 0xFA53E9C5) return true; return false; } @@ -71,16 +71,16 @@ namespace DiscImageChef.Plugins public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, out string information) { information = ""; - + StringBuilder sb = new StringBuilder(); - + HPFS_BIOSParameterBlock hpfs_bpb = new HPFS_BIOSParameterBlock(); HPFS_SuperBlock hpfs_sb = new HPFS_SuperBlock(); HPFS_SpareBlock hpfs_sp = new HPFS_SpareBlock(); - + byte[] oem_name = new byte[8]; byte[] volume_name = new byte[11]; - + byte[] hpfs_bpb_sector = imagePlugin.ReadSector(0 + partitionStart); // Seek to BIOS parameter block, on logical sector 0 byte[] hpfs_sb_sector = imagePlugin.ReadSector(16 + partitionStart); // Seek to superblock, on logical sector 16 byte[] hpfs_sp_sector = imagePlugin.ReadSector(17 + partitionStart); // Seek to spareblock, on logical sector 17 @@ -109,7 +109,7 @@ namespace DiscImageChef.Plugins hpfs_bpb.volume_label = StringHandlers.CToString(volume_name); Array.Copy(hpfs_bpb_sector, 0x03A, oem_name, 0, 8); hpfs_bpb.fs_type = StringHandlers.CToString(oem_name); - + hpfs_sb.magic1 = BitConverter.ToUInt32(hpfs_sb_sector, 0x000); hpfs_sb.magic2 = BitConverter.ToUInt32(hpfs_sb_sector, 0x004); hpfs_sb.version = hpfs_sb_sector[0x008]; @@ -148,8 +148,8 @@ namespace DiscImageChef.Plugins hpfs_sp.codepages = BitConverter.ToUInt32(hpfs_sp_sector, 0x024); hpfs_sp.sb_crc32 = BitConverter.ToUInt32(hpfs_sp_sector, 0x028); hpfs_sp.sp_crc32 = BitConverter.ToUInt32(hpfs_sp_sector, 0x02C); - - if (hpfs_bpb.fs_type != "HPFS " || + + if(hpfs_bpb.fs_type != "HPFS " || hpfs_sb.magic1 != 0xF995E849 || hpfs_sb.magic2 != 0xFA53E9C5 || hpfs_sp.magic1 != 0xF9911849 || hpfs_sp.magic2 != 0xFA5229C5) { @@ -160,39 +160,39 @@ namespace DiscImageChef.Plugins sb.AppendFormat("Spareblock magic1: 0x{0:X8} (Should be 0xF9911849)", hpfs_sp.magic1).AppendLine(); sb.AppendFormat("Spareblock magic2: 0x{0:X8} (Should be 0xFA5229C5)", hpfs_sp.magic2).AppendLine(); } - + sb.AppendFormat("OEM name: {0}", hpfs_bpb.OEMName).AppendLine(); sb.AppendFormat("{0} bytes per sector", hpfs_bpb.bps).AppendLine(); sb.AppendFormat("{0} sectors per cluster", hpfs_bpb.spc).AppendLine(); -// sb.AppendFormat("{0} reserved sectors", hpfs_bpb.rsectors).AppendLine(); -// sb.AppendFormat("{0} FATs", hpfs_bpb.fats_no).AppendLine(); -// sb.AppendFormat("{0} entries on root directory", hpfs_bpb.root_ent).AppendLine(); -// sb.AppendFormat("{0} mini sectors on volume", hpfs_bpb.sectors).AppendLine(); + // sb.AppendFormat("{0} reserved sectors", hpfs_bpb.rsectors).AppendLine(); + // sb.AppendFormat("{0} FATs", hpfs_bpb.fats_no).AppendLine(); + // sb.AppendFormat("{0} entries on root directory", hpfs_bpb.root_ent).AppendLine(); + // sb.AppendFormat("{0} mini sectors on volume", hpfs_bpb.sectors).AppendLine(); sb.AppendFormat("Media descriptor: 0x{0:X2}", hpfs_bpb.media).AppendLine(); -// sb.AppendFormat("{0} sectors per FAT", hpfs_bpb.spfat).AppendLine(); -// sb.AppendFormat("{0} sectors per track", hpfs_bpb.sptrk).AppendLine(); -// sb.AppendFormat("{0} heads", hpfs_bpb.heads).AppendLine(); + // sb.AppendFormat("{0} sectors per FAT", hpfs_bpb.spfat).AppendLine(); + // sb.AppendFormat("{0} sectors per track", hpfs_bpb.sptrk).AppendLine(); + // sb.AppendFormat("{0} heads", hpfs_bpb.heads).AppendLine(); sb.AppendFormat("{0} sectors hidden before BPB", hpfs_bpb.hsectors).AppendLine(); sb.AppendFormat("{0} sectors on volume ({1} bytes)", hpfs_bpb.big_sectors, hpfs_bpb.big_sectors * hpfs_bpb.bps).AppendLine(); sb.AppendFormat("BIOS Drive Number: 0x{0:X2}", hpfs_bpb.drive_no).AppendLine(); -// sb.AppendFormat("NT Flags: 0x{0:X2}", hpfs_bpb.nt_flags).AppendLine(); + // sb.AppendFormat("NT Flags: 0x{0:X2}", hpfs_bpb.nt_flags).AppendLine(); sb.AppendFormat("Signature: 0x{0:X2}", hpfs_bpb.signature).AppendLine(); sb.AppendFormat("Serial number: 0x{0:X8}", hpfs_bpb.serial_no).AppendLine(); sb.AppendFormat("Volume label: {0}", hpfs_bpb.volume_label).AppendLine(); -// sb.AppendFormat("Filesystem type: \"{0}\"", hpfs_bpb.fs_type).AppendLine(); - + // sb.AppendFormat("Filesystem type: \"{0}\"", hpfs_bpb.fs_type).AppendLine(); + DateTime last_chk = DateHandlers.UNIXToDateTime(hpfs_sb.last_chkdsk); DateTime last_optim = DateHandlers.UNIXToDateTime(hpfs_sb.last_optim); - + sb.AppendFormat("HPFS version: {0}", hpfs_sb.version).AppendLine(); sb.AppendFormat("Functional version: {0}", hpfs_sb.func_version).AppendLine(); sb.AppendFormat("Sector of root directory FNode: {0}", hpfs_sb.root_fnode).AppendLine(); -// sb.AppendFormat("{0} sectors on volume", hpfs_sb.sectors).AppendLine(); + // sb.AppendFormat("{0} sectors on volume", hpfs_sb.sectors).AppendLine(); sb.AppendFormat("{0} sectors are marked bad", hpfs_sb.badblocks).AppendLine(); sb.AppendFormat("Sector of free space bitmaps: {0}", hpfs_sb.bitmap_lsn).AppendLine(); sb.AppendFormat("Sector of bad blocks list: {0}", hpfs_sb.badblock_lsn).AppendLine(); sb.AppendFormat("Date of last integrity check: {0}", last_chk).AppendLine(); - if (hpfs_sb.last_optim > 0) + if(hpfs_sb.last_optim > 0) sb.AppendFormat("Date of last optimization {0}", last_optim).AppendLine(); else sb.AppendLine("Filesystem has never been optimized"); @@ -201,7 +201,7 @@ namespace DiscImageChef.Plugins sb.AppendFormat("Directory band ends at sector {0}", hpfs_sb.dband_last).AppendLine(); sb.AppendFormat("Sector of directory band bitmap: {0}", hpfs_sb.dband_bitmap).AppendLine(); sb.AppendFormat("Sector of ACL directory: {0}", hpfs_sb.acl_start).AppendLine(); - + sb.AppendFormat("Sector of Hotfix directory: {0}", hpfs_sp.hotfix_start).AppendLine(); sb.AppendFormat("{0} used Hotfix entries", hpfs_sp.hotfix_used).AppendLine(); sb.AppendFormat("{0} total Hotfix entries", hpfs_sp.hotfix_entries).AppendLine(); @@ -211,41 +211,41 @@ namespace DiscImageChef.Plugins sb.AppendFormat("{0} codepages used in the volume", hpfs_sp.codepages).AppendLine(); sb.AppendFormat("SuperBlock CRC32: {0:X8}", hpfs_sp.sb_crc32).AppendLine(); sb.AppendFormat("SpareBlock CRC32: {0:X8}", hpfs_sp.sp_crc32).AppendLine(); - + sb.AppendLine("Flags:"); - if ((hpfs_sp.flags1 & 0x01) == 0x01) + if((hpfs_sp.flags1 & 0x01) == 0x01) sb.AppendLine("Filesystem is dirty."); else sb.AppendLine("Filesystem is clean."); - if ((hpfs_sp.flags1 & 0x02) == 0x02) + if((hpfs_sp.flags1 & 0x02) == 0x02) sb.AppendLine("Spare directory blocks are in use"); - if ((hpfs_sp.flags1 & 0x04) == 0x04) + if((hpfs_sp.flags1 & 0x04) == 0x04) sb.AppendLine("Hotfixes are in use"); - if ((hpfs_sp.flags1 & 0x08) == 0x08) + if((hpfs_sp.flags1 & 0x08) == 0x08) sb.AppendLine("Disk contains bad sectors"); - if ((hpfs_sp.flags1 & 0x10) == 0x10) + if((hpfs_sp.flags1 & 0x10) == 0x10) sb.AppendLine("Disk has a bad bitmap"); - if ((hpfs_sp.flags1 & 0x20) == 0x20) + if((hpfs_sp.flags1 & 0x20) == 0x20) sb.AppendLine("Filesystem was formatted fast"); - if ((hpfs_sp.flags1 & 0x40) == 0x40) + if((hpfs_sp.flags1 & 0x40) == 0x40) sb.AppendLine("Unknown flag 0x40 on flags1 is active"); - if ((hpfs_sp.flags1 & 0x80) == 0x80) + if((hpfs_sp.flags1 & 0x80) == 0x80) sb.AppendLine("Filesystem has been mounted by an old IFS"); - if ((hpfs_sp.flags2 & 0x01) == 0x01) + if((hpfs_sp.flags2 & 0x01) == 0x01) sb.AppendLine("Install DASD limits"); - if ((hpfs_sp.flags2 & 0x02) == 0x02) + if((hpfs_sp.flags2 & 0x02) == 0x02) sb.AppendLine("Resync DASD limits"); - if ((hpfs_sp.flags2 & 0x04) == 0x04) + if((hpfs_sp.flags2 & 0x04) == 0x04) sb.AppendLine("DASD limits are operational"); - if ((hpfs_sp.flags2 & 0x08) == 0x08) + if((hpfs_sp.flags2 & 0x08) == 0x08) sb.AppendLine("Multimedia is active"); - if ((hpfs_sp.flags2 & 0x10) == 0x10) + if((hpfs_sp.flags2 & 0x10) == 0x10) sb.AppendLine("DCE ACLs are active"); - if ((hpfs_sp.flags2 & 0x20) == 0x20) + if((hpfs_sp.flags2 & 0x20) == 0x20) sb.AppendLine("DASD limits are dirty"); - if ((hpfs_sp.flags2 & 0x40) == 0x40) + if((hpfs_sp.flags2 & 0x40) == 0x40) sb.AppendLine("Unknown flag 0x40 on flags2 is active"); - if ((hpfs_sp.flags2 & 0x80) == 0x80) + if((hpfs_sp.flags2 & 0x80) == 0x80) sb.AppendLine("Unknown flag 0x80 on flags2 is active"); xmlFSType = new Schemas.FileSystemType(); @@ -255,7 +255,7 @@ namespace DiscImageChef.Plugins xmlFSType.Type = "HPFS"; xmlFSType.VolumeName = hpfs_bpb.volume_label; xmlFSType.VolumeSerial = String.Format("{0:X8}", hpfs_bpb.serial_no); - + information = sb.ToString(); } diff --git a/DiscImageChef.Filesystems/ISO9660.cs b/DiscImageChef.Filesystems/ISO9660.cs index 7c5661b12..c4ea555a8 100644 --- a/DiscImageChef.Filesystems/ISO9660.cs +++ b/DiscImageChef.Filesystems/ISO9660.cs @@ -52,13 +52,13 @@ namespace DiscImageChef.Plugins { class ISO9660Plugin : Plugin { - //static bool alreadyLaunched; + //static bool alreadyLaunched; public ISO9660Plugin() { Name = "ISO9660 Filesystem"; PluginUUID = new Guid("d812f4d3-c357-400d-90fd-3b22ef786aa8"); - //alreadyLaunched = false; + //alreadyLaunched = false; } struct DecodedVolumeDescriptor @@ -80,43 +80,43 @@ namespace DiscImageChef.Plugins public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd) { -/* if (alreadyLaunched) - return false; - alreadyLaunched = true;*/ + /* if (alreadyLaunched) + return false; + alreadyLaunched = true;*/ byte VDType; // ISO9660 is designed for 2048 bytes/sector devices - if (imagePlugin.GetSectorSize() < 2048) + if(imagePlugin.GetSectorSize() < 2048) return false; // ISO9660 Primary Volume Descriptor starts at sector 16, so that's minimal size. - if (imagePlugin.GetSectors() <= (16 + partitionStart)) + if(imagePlugin.GetSectors() <= (16 + partitionStart)) return false; // Read to Volume Descriptor byte[] vd_sector = imagePlugin.ReadSector(16 + partitionStart); int xa_off = 0; - if (vd_sector.Length == 2336) + if(vd_sector.Length == 2336) xa_off = 8; VDType = vd_sector[0 + xa_off]; byte[] VDMagic = new byte[5]; // Wrong, VDs can be any order! - if (VDType == 255) // Supposedly we are in the PVD. - return false; + if(VDType == 255) // Supposedly we are in the PVD. + return false; Array.Copy(vd_sector, 0x001 + xa_off, VDMagic, 0, 5); DicConsole.DebugWriteLine("ISO9660 plugin", "VDMagic = {0}", Encoding.ASCII.GetString(VDMagic)); - return Encoding.ASCII.GetString(VDMagic) == "CD001"; + return Encoding.ASCII.GetString(VDMagic) == "CD001"; } - - public override void GetInformation (ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, out string information) - { + + public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, out string information) + { information = ""; StringBuilder ISOMetadata = new StringBuilder(); bool Joliet = false; @@ -154,23 +154,23 @@ namespace DiscImageChef.Plugins byte[] RootDirectoryLocation = new byte[4]; // ISO9660 is designed for 2048 bytes/sector devices - if (imagePlugin.GetSectorSize() < 2048) + if(imagePlugin.GetSectorSize() < 2048) return; // ISO9660 Primary Volume Descriptor starts at sector 16, so that's minimal size. - if (imagePlugin.GetSectors() < 16) + if(imagePlugin.GetSectors() < 16) return; ulong counter = 0; - while (true) + while(true) { DicConsole.DebugWriteLine("ISO9660 plugin", "Processing VD loop no. {0}", counter); // Seek to Volume Descriptor DicConsole.DebugWriteLine("ISO9660 plugin", "Reading sector {0}", 16 + counter + partitionStart); byte[] vd_sector_tmp = imagePlugin.ReadSector(16 + counter + partitionStart); byte[] vd_sector; - if (vd_sector_tmp.Length == 2336) + if(vd_sector_tmp.Length == 2336) { vd_sector = new byte[2336 - 8]; Array.Copy(vd_sector_tmp, 8, vd_sector, 0, 2336 - 8); @@ -181,18 +181,18 @@ namespace DiscImageChef.Plugins VDType = vd_sector[0]; DicConsole.DebugWriteLine("ISO9660 plugin", "VDType = {0}", VDType); - if (VDType == 255) // Supposedly we are in the PVD. + if(VDType == 255) // Supposedly we are in the PVD. { - if (counter == 0) + if(counter == 0) return; break; } Array.Copy(vd_sector, 0x001, VDMagic, 0, 5); - if (Encoding.ASCII.GetString(VDMagic) != "CD001") // Recognized, it is an ISO9660, now check for rest of data. + if(Encoding.ASCII.GetString(VDMagic) != "CD001") // Recognized, it is an ISO9660, now check for rest of data. { - if (counter == 0) + if(counter == 0) return; break; } @@ -207,7 +207,7 @@ namespace DiscImageChef.Plugins // Read to boot system identifier Array.Copy(vd_sector, 0x007, BootSysId, 0, 32); - if (Encoding.ASCII.GetString(BootSysId).Substring(0, 23) == "EL TORITO SPECIFICATION") + if(Encoding.ASCII.GetString(BootSysId).Substring(0, 23) == "EL TORITO SPECIFICATION") BootSpec = "El Torito"; break; @@ -239,9 +239,9 @@ namespace DiscImageChef.Plugins { // Check if this is Joliet Array.Copy(vd_sector, 0x058, JolietMagic, 0, 3); - if (JolietMagic[0] == '%' && JolietMagic[1] == '/') + if(JolietMagic[0] == '%' && JolietMagic[1] == '/') { - if (JolietMagic[2] == '@' || JolietMagic[2] == 'C' || JolietMagic[2] == 'E') + if(JolietMagic[2] == '@' || JolietMagic[2] == 'C' || JolietMagic[2] == 'E') { Joliet = true; } @@ -276,19 +276,19 @@ namespace DiscImageChef.Plugins counter++; } - DecodedVolumeDescriptor decodedVD = new DecodedVolumeDescriptor(); - DecodedVolumeDescriptor decodedJolietVD = new DecodedVolumeDescriptor(); + DecodedVolumeDescriptor decodedVD = new DecodedVolumeDescriptor(); + DecodedVolumeDescriptor decodedJolietVD = new DecodedVolumeDescriptor(); - decodedVD = DecodeVolumeDescriptor(VDSysId, VDVolId, VDVolSetId, VDPubId, VDDataPrepId, VDAppId, VCTime, VMTime, VXTime, VETime); - if(Joliet) - decodedJolietVD = DecodeJolietDescriptor(JolietSysId, JolietVolId, JolietVolSetId, JolietPubId, JolietDataPrepId, JolietAppId, JolietCTime, JolietMTime, JolietXTime, JolietETime); + decodedVD = DecodeVolumeDescriptor(VDSysId, VDVolId, VDVolSetId, VDPubId, VDDataPrepId, VDAppId, VCTime, VMTime, VXTime, VETime); + if(Joliet) + decodedJolietVD = DecodeJolietDescriptor(JolietSysId, JolietVolId, JolietVolSetId, JolietPubId, JolietDataPrepId, JolietAppId, JolietCTime, JolietMTime, JolietXTime, JolietETime); ulong i = (ulong)BitConverter.ToInt32(VDPathTableStart, 0); - DicConsole.DebugWriteLine("ISO9660 plugin", "VDPathTableStart = {0} + {1} = {2}", i, partitionStart, i + partitionStart); + DicConsole.DebugWriteLine("ISO9660 plugin", "VDPathTableStart = {0} + {1} = {2}", i, partitionStart, i + partitionStart); // TODO: Check this - if ((i + partitionStart) < imagePlugin.GetSectors()) + if((i + partitionStart) < imagePlugin.GetSectors()) { byte[] path_table = imagePlugin.ReadSector(i + partitionStart); @@ -300,7 +300,7 @@ namespace DiscImageChef.Plugins byte[] RRMagic = new byte[2]; Array.Copy(root_dir, 0x22, SUSPMagic, 0, 2); - if (Encoding.ASCII.GetString(SUSPMagic) == "SP") + if(Encoding.ASCII.GetString(SUSPMagic) == "SP") { Array.Copy(root_dir, 0x29, RRMagic, 0, 2); RockRidge |= Encoding.ASCII.GetString(RRMagic) == "RR"; @@ -308,7 +308,7 @@ namespace DiscImageChef.Plugins } #region SEGA IP.BIN Read and decoding - + bool SegaCD = false; bool Saturn = false; bool Dreamcast = false; @@ -320,7 +320,7 @@ namespace DiscImageChef.Plugins DicConsole.DebugWriteLine("ISO9660 plugin", "SegaHardwareID = \"{0}\"", Encoding.ASCII.GetString(SegaHardwareID)); - switch (Encoding.ASCII.GetString(SegaHardwareID)) + switch(Encoding.ASCII.GetString(SegaHardwareID)) { case "SEGADISCSYSTEM ": case "SEGADATADISC ": @@ -389,7 +389,7 @@ namespace DiscImageChef.Plugins Array.Copy(ipbin_sector, 0x060, system_reserved, 0, 160); // System Reserved Area Array.Copy(ipbin_sector, 0x100, hardware_id, 0, 16); // Hardware ID Array.Copy(ipbin_sector, 0x110, copyright, 0, 3); // "(C)" -- Can be the developer code directly!, if that is the code release date will be displaced - if (Encoding.ASCII.GetString(copyright) == "(C)") + if(Encoding.ASCII.GetString(copyright) == "(C)") Array.Copy(ipbin_sector, 0x113, developer_code, 0, 5); // "SEGA" or "T-xx" else Array.Copy(ipbin_sector, 0x110, developer_code, 0, 5); // "SEGA" or "T-xx" @@ -439,7 +439,7 @@ namespace DiscImageChef.Plugins { ipbindate = DateTime.ParseExact(Encoding.ASCII.GetString(release_date2), "yyyy.MMM", provider); } - catch {} + catch { } } /* @@ -524,9 +524,9 @@ namespace DiscImageChef.Plugins } } IPBinInformation.AppendLine("Regions supported:"); - foreach (byte region in region_codes) + foreach(byte region in region_codes) { - switch ((char)region) + switch((char)region) { case 'J': IPBinInformation.AppendLine("Japanese NTSC."); @@ -609,9 +609,9 @@ namespace DiscImageChef.Plugins IPBinInformation.AppendFormat("Disc number {0} of {1}", Encoding.ASCII.GetString(disc_no), Encoding.ASCII.GetString(disc_total_nos)).AppendLine(); IPBinInformation.AppendFormat("Peripherals:").AppendLine(); - foreach (byte peripheral in peripherals) + foreach(byte peripheral in peripherals) { - switch ((char)peripheral) + switch((char)peripheral) { case 'A': IPBinInformation.AppendLine("Game supports analog controller."); @@ -639,9 +639,9 @@ namespace DiscImageChef.Plugins } } IPBinInformation.AppendLine("Regions supported:"); - foreach (byte region in region_codes) + foreach(byte region in region_codes) { - switch ((char)region) + switch((char)region) { case 'J': IPBinInformation.AppendLine("Japanese NTSC."); @@ -740,7 +740,7 @@ namespace DiscImageChef.Plugins IPBinInformation.AppendFormat("Disc media: {0}", Encoding.ASCII.GetString(dreamcast_media)).AppendLine(); IPBinInformation.AppendFormat("Disc number {0} of {1}", Encoding.ASCII.GetString(disc_no), Encoding.ASCII.GetString(disc_total_nos)).AppendLine(); IPBinInformation.AppendFormat("Release date: {0}", ipbindate).AppendLine(); - switch (Encoding.ASCII.GetString(boot_filename)) + switch(Encoding.ASCII.GetString(boot_filename)) { case "1ST_READ.BIN": IPBinInformation.AppendLine("Disc boots natively."); @@ -753,9 +753,9 @@ namespace DiscImageChef.Plugins break; } IPBinInformation.AppendLine("Regions supported:"); - foreach (byte region in region_codes) + foreach(byte region in region_codes) { - switch ((char)region) + switch((char)region) { case 'J': IPBinInformation.AppendLine("Japanese NTSC."); @@ -781,47 +781,47 @@ namespace DiscImageChef.Plugins IPBinInformation.AppendFormat("Peripherals:").AppendLine(); - if ((iPeripherals & 0x00000010) == 0x00000010) + if((iPeripherals & 0x00000010) == 0x00000010) IPBinInformation.AppendLine("Game supports the VGA Box."); - if ((iPeripherals & 0x00000100) == 0x00000100) + if((iPeripherals & 0x00000100) == 0x00000100) IPBinInformation.AppendLine("Game supports other expansion."); - if ((iPeripherals & 0x00000200) == 0x00000200) + if((iPeripherals & 0x00000200) == 0x00000200) IPBinInformation.AppendLine("Game supports Puru Puru pack."); - if ((iPeripherals & 0x00000400) == 0x00000400) + if((iPeripherals & 0x00000400) == 0x00000400) IPBinInformation.AppendLine("Game supports Mike Device."); - if ((iPeripherals & 0x00000800) == 0x00000800) + if((iPeripherals & 0x00000800) == 0x00000800) IPBinInformation.AppendLine("Game supports Memory Card."); - if ((iPeripherals & 0x00001000) == 0x00001000) + if((iPeripherals & 0x00001000) == 0x00001000) IPBinInformation.AppendLine("Game requires A + B + Start buttons and D-Pad."); - if ((iPeripherals & 0x00002000) == 0x00002000) + if((iPeripherals & 0x00002000) == 0x00002000) IPBinInformation.AppendLine("Game requires C button."); - if ((iPeripherals & 0x00004000) == 0x00004000) + if((iPeripherals & 0x00004000) == 0x00004000) IPBinInformation.AppendLine("Game requires D button."); - if ((iPeripherals & 0x00008000) == 0x00008000) + if((iPeripherals & 0x00008000) == 0x00008000) IPBinInformation.AppendLine("Game requires X button."); - if ((iPeripherals & 0x00010000) == 0x00010000) + if((iPeripherals & 0x00010000) == 0x00010000) IPBinInformation.AppendLine("Game requires Y button."); - if ((iPeripherals & 0x00020000) == 0x00020000) + if((iPeripherals & 0x00020000) == 0x00020000) IPBinInformation.AppendLine("Game requires Z button."); - if ((iPeripherals & 0x00040000) == 0x00040000) + if((iPeripherals & 0x00040000) == 0x00040000) IPBinInformation.AppendLine("Game requires expanded direction buttons."); - if ((iPeripherals & 0x00080000) == 0x00080000) + if((iPeripherals & 0x00080000) == 0x00080000) IPBinInformation.AppendLine("Game requires analog R trigger."); - if ((iPeripherals & 0x00100000) == 0x00100000) + if((iPeripherals & 0x00100000) == 0x00100000) IPBinInformation.AppendLine("Game requires analog L trigger."); - if ((iPeripherals & 0x00200000) == 0x00200000) + if((iPeripherals & 0x00200000) == 0x00200000) IPBinInformation.AppendLine("Game requires analog horizontal controller."); - if ((iPeripherals & 0x00400000) == 0x00400000) + if((iPeripherals & 0x00400000) == 0x00400000) IPBinInformation.AppendLine("Game requires analog vertical controller."); - if ((iPeripherals & 0x00800000) == 0x00800000) + if((iPeripherals & 0x00800000) == 0x00800000) IPBinInformation.AppendLine("Game requires expanded analog horizontal controller."); - if ((iPeripherals & 0x01000000) == 0x01000000) + if((iPeripherals & 0x01000000) == 0x01000000) IPBinInformation.AppendLine("Game requires expanded analog vertical controller."); - if ((iPeripherals & 0x02000000) == 0x02000000) + if((iPeripherals & 0x02000000) == 0x02000000) IPBinInformation.AppendLine("Game supports Gun."); - if ((iPeripherals & 0x04000000) == 0x04000000) + if((iPeripherals & 0x04000000) == 0x04000000) IPBinInformation.AppendLine("Game supports Keyboard."); - if ((iPeripherals & 0x08000000) == 0x08000000) + if((iPeripherals & 0x08000000) == 0x08000000) IPBinInformation.AppendLine("Game supports Mouse."); if((iPeripherals & 0xEE) != 0) @@ -835,21 +835,21 @@ namespace DiscImageChef.Plugins ISOMetadata.AppendFormat("ISO9660 file system").AppendLine(); if(Joliet) ISOMetadata.AppendFormat("Joliet extensions present.").AppendLine(); - if (RockRidge) + if(RockRidge) ISOMetadata.AppendFormat("Rock Ridge Interchange Protocol present.").AppendLine(); - if (Bootable) + if(Bootable) ISOMetadata.AppendFormat("Disc bootable following {0} specifications.", BootSpec).AppendLine(); - if (SegaCD) + if(SegaCD) { ISOMetadata.AppendLine("This is a SegaCD / MegaCD disc."); ISOMetadata.AppendLine(IPBinInformation.ToString()); } - if (Saturn) + if(Saturn) { ISOMetadata.AppendLine("This is a Sega Saturn disc."); ISOMetadata.AppendLine(IPBinInformation.ToString()); } - if (Dreamcast) + if(Dreamcast) { ISOMetadata.AppendLine("This is a Sega Dreamcast disc."); ISOMetadata.AppendLine(IPBinInformation.ToString()); @@ -864,49 +864,49 @@ namespace DiscImageChef.Plugins ISOMetadata.AppendFormat("Data preparer identifier: {0}", decodedVD.DataPreparerIdentifier).AppendLine(); ISOMetadata.AppendFormat("Application identifier: {0}", decodedVD.ApplicationIdentifier).AppendLine(); ISOMetadata.AppendFormat("Volume creation date: {0}", decodedVD.CreationTime).AppendLine(); - if (decodedVD.HasModificationTime) + if(decodedVD.HasModificationTime) ISOMetadata.AppendFormat("Volume modification date: {0}", decodedVD.ModificationTime).AppendLine(); else ISOMetadata.AppendFormat("Volume has not been modified.").AppendLine(); - if (decodedVD.HasExpirationTime) + if(decodedVD.HasExpirationTime) ISOMetadata.AppendFormat("Volume expiration date: {0}", decodedVD.ExpirationTime).AppendLine(); else ISOMetadata.AppendFormat("Volume does not expire.").AppendLine(); - if (decodedVD.HasEffectiveTime) + if(decodedVD.HasEffectiveTime) ISOMetadata.AppendFormat("Volume effective date: {0}", decodedVD.EffectiveTime).AppendLine(); else ISOMetadata.AppendFormat("Volume has always been effective.").AppendLine(); - if(Joliet) - { - ISOMetadata.AppendLine("---------------------------------------"); - ISOMetadata.AppendLine("JOLIET VOLUME DESCRIPTOR INFORMATION:"); - ISOMetadata.AppendLine("---------------------------------------"); - ISOMetadata.AppendFormat("System identifier: {0}", decodedJolietVD.SystemIdentifier).AppendLine(); - ISOMetadata.AppendFormat("Volume identifier: {0}", decodedJolietVD.VolumeIdentifier).AppendLine(); - ISOMetadata.AppendFormat("Volume set identifier: {0}", decodedJolietVD.VolumeSetIdentifier).AppendLine(); - ISOMetadata.AppendFormat("Publisher identifier: {0}", decodedJolietVD.PublisherIdentifier).AppendLine(); - ISOMetadata.AppendFormat("Data preparer identifier: {0}", decodedJolietVD.DataPreparerIdentifier).AppendLine(); - ISOMetadata.AppendFormat("Application identifier: {0}", decodedJolietVD.ApplicationIdentifier).AppendLine(); - ISOMetadata.AppendFormat("Volume creation date: {0}", decodedJolietVD.CreationTime).AppendLine(); - if (decodedJolietVD.HasModificationTime) - ISOMetadata.AppendFormat("Volume modification date: {0}", decodedJolietVD.ModificationTime).AppendLine(); - else - ISOMetadata.AppendFormat("Volume has not been modified.").AppendLine(); - if (decodedJolietVD.HasExpirationTime) - ISOMetadata.AppendFormat("Volume expiration date: {0}", decodedJolietVD.ExpirationTime).AppendLine(); - else - ISOMetadata.AppendFormat("Volume does not expire.").AppendLine(); - if (decodedJolietVD.HasEffectiveTime) + if(Joliet) + { + ISOMetadata.AppendLine("---------------------------------------"); + ISOMetadata.AppendLine("JOLIET VOLUME DESCRIPTOR INFORMATION:"); + ISOMetadata.AppendLine("---------------------------------------"); + ISOMetadata.AppendFormat("System identifier: {0}", decodedJolietVD.SystemIdentifier).AppendLine(); + ISOMetadata.AppendFormat("Volume identifier: {0}", decodedJolietVD.VolumeIdentifier).AppendLine(); + ISOMetadata.AppendFormat("Volume set identifier: {0}", decodedJolietVD.VolumeSetIdentifier).AppendLine(); + ISOMetadata.AppendFormat("Publisher identifier: {0}", decodedJolietVD.PublisherIdentifier).AppendLine(); + ISOMetadata.AppendFormat("Data preparer identifier: {0}", decodedJolietVD.DataPreparerIdentifier).AppendLine(); + ISOMetadata.AppendFormat("Application identifier: {0}", decodedJolietVD.ApplicationIdentifier).AppendLine(); + ISOMetadata.AppendFormat("Volume creation date: {0}", decodedJolietVD.CreationTime).AppendLine(); + if(decodedJolietVD.HasModificationTime) + ISOMetadata.AppendFormat("Volume modification date: {0}", decodedJolietVD.ModificationTime).AppendLine(); + else + ISOMetadata.AppendFormat("Volume has not been modified.").AppendLine(); + if(decodedJolietVD.HasExpirationTime) + ISOMetadata.AppendFormat("Volume expiration date: {0}", decodedJolietVD.ExpirationTime).AppendLine(); + else + ISOMetadata.AppendFormat("Volume does not expire.").AppendLine(); + if(decodedJolietVD.HasEffectiveTime) ISOMetadata.AppendFormat("Volume effective date: {0}", decodedJolietVD.EffectiveTime).AppendLine(); - else - ISOMetadata.AppendFormat("Volume has always been effective.").AppendLine(); - } + else + ISOMetadata.AppendFormat("Volume has always been effective.").AppendLine(); + } xmlFSType = new Schemas.FileSystemType(); xmlFSType.Type = "ISO9660"; - if (Joliet) + if(Joliet) { xmlFSType.VolumeName = decodedJolietVD.VolumeIdentifier; @@ -914,22 +914,22 @@ namespace DiscImageChef.Plugins xmlFSType.SystemIdentifier = decodedVD.SystemIdentifier; else xmlFSType.SystemIdentifier = decodedJolietVD.SystemIdentifier; - + if(decodedJolietVD.VolumeSetIdentifier == null || decodedVD.VolumeSetIdentifier.Length > decodedJolietVD.VolumeSetIdentifier.Length) xmlFSType.VolumeSetIdentifier = decodedVD.VolumeSetIdentifier; else xmlFSType.VolumeSetIdentifier = decodedJolietVD.VolumeSetIdentifier; - + if(decodedJolietVD.PublisherIdentifier == null || decodedVD.PublisherIdentifier.Length > decodedJolietVD.PublisherIdentifier.Length) xmlFSType.PublisherIdentifier = decodedVD.PublisherIdentifier; else xmlFSType.PublisherIdentifier = decodedJolietVD.PublisherIdentifier; - + if(decodedJolietVD.DataPreparerIdentifier == null || decodedVD.DataPreparerIdentifier.Length > decodedJolietVD.DataPreparerIdentifier.Length) xmlFSType.DataPreparerIdentifier = decodedVD.DataPreparerIdentifier; else xmlFSType.DataPreparerIdentifier = decodedJolietVD.SystemIdentifier; - + if(decodedJolietVD.ApplicationIdentifier == null || decodedVD.ApplicationIdentifier.Length > decodedJolietVD.ApplicationIdentifier.Length) xmlFSType.ApplicationIdentifier = decodedVD.ApplicationIdentifier; else @@ -937,17 +937,17 @@ namespace DiscImageChef.Plugins xmlFSType.CreationDate = decodedJolietVD.CreationTime; xmlFSType.CreationDateSpecified = true; - if (decodedJolietVD.HasModificationTime) + if(decodedJolietVD.HasModificationTime) { xmlFSType.ModificationDate = decodedJolietVD.ModificationTime; xmlFSType.ModificationDateSpecified = true; } - if (decodedJolietVD.HasExpirationTime) + if(decodedJolietVD.HasExpirationTime) { xmlFSType.ExpirationDate = decodedJolietVD.ExpirationTime; xmlFSType.ExpirationDateSpecified = true; } - if (decodedJolietVD.HasEffectiveTime) + if(decodedJolietVD.HasEffectiveTime) { xmlFSType.EffectiveDate = decodedJolietVD.EffectiveTime; xmlFSType.EffectiveDateSpecified = true; @@ -963,17 +963,17 @@ namespace DiscImageChef.Plugins xmlFSType.ApplicationIdentifier = decodedVD.ApplicationIdentifier; xmlFSType.CreationDate = decodedVD.CreationTime; xmlFSType.CreationDateSpecified = true; - if (decodedVD.HasModificationTime) + if(decodedVD.HasModificationTime) { xmlFSType.ModificationDate = decodedVD.ModificationTime; xmlFSType.ModificationDateSpecified = true; } - if (decodedVD.HasExpirationTime) + if(decodedVD.HasExpirationTime) { xmlFSType.ExpirationDate = decodedVD.ExpirationTime; xmlFSType.ExpirationDateSpecified = true; } - if (decodedVD.HasEffectiveTime) + if(decodedVD.HasEffectiveTime) { xmlFSType.EffectiveDate = decodedVD.EffectiveTime; xmlFSType.EffectiveDateSpecified = true; @@ -991,93 +991,93 @@ namespace DiscImageChef.Plugins { DecodedVolumeDescriptor decodedVD = new DecodedVolumeDescriptor(); - decodedVD.SystemIdentifier = Encoding.BigEndianUnicode.GetString(VDSysId).TrimEnd().Trim(new []{'\u0000'}); - decodedVD.VolumeIdentifier = Encoding.BigEndianUnicode.GetString(VDVolId).TrimEnd().Trim(new []{'\u0000'}); - decodedVD.VolumeSetIdentifier = Encoding.BigEndianUnicode.GetString(VDVolSetId).TrimEnd().Trim(new []{'\u0000'}); - decodedVD.PublisherIdentifier = Encoding.BigEndianUnicode.GetString(VDPubId).TrimEnd().Trim(new []{'\u0000'}); - decodedVD.DataPreparerIdentifier = Encoding.BigEndianUnicode.GetString(VDDataPrepId).TrimEnd().Trim(new []{'\u0000'}); - decodedVD.ApplicationIdentifier = Encoding.BigEndianUnicode.GetString(VDAppId).TrimEnd().Trim(new []{'\u0000'}); - if (VCTime[0] == '0' || VCTime[0] == 0x00) + decodedVD.SystemIdentifier = Encoding.BigEndianUnicode.GetString(VDSysId).TrimEnd().Trim(new[] { '\u0000' }); + decodedVD.VolumeIdentifier = Encoding.BigEndianUnicode.GetString(VDVolId).TrimEnd().Trim(new[] { '\u0000' }); + decodedVD.VolumeSetIdentifier = Encoding.BigEndianUnicode.GetString(VDVolSetId).TrimEnd().Trim(new[] { '\u0000' }); + decodedVD.PublisherIdentifier = Encoding.BigEndianUnicode.GetString(VDPubId).TrimEnd().Trim(new[] { '\u0000' }); + decodedVD.DataPreparerIdentifier = Encoding.BigEndianUnicode.GetString(VDDataPrepId).TrimEnd().Trim(new[] { '\u0000' }); + decodedVD.ApplicationIdentifier = Encoding.BigEndianUnicode.GetString(VDAppId).TrimEnd().Trim(new[] { '\u0000' }); + if(VCTime[0] == '0' || VCTime[0] == 0x00) decodedVD.CreationTime = DateTime.MinValue; else decodedVD.CreationTime = DateHandlers.ISO9660ToDateTime(VCTime); - if (VMTime[0] == '0' || VMTime[0] == 0x00) + if(VMTime[0] == '0' || VMTime[0] == 0x00) { decodedVD.HasModificationTime = false; } else { decodedVD.HasModificationTime = true; - decodedVD.ModificationTime = DateHandlers.ISO9660ToDateTime(VMTime); + decodedVD.ModificationTime = DateHandlers.ISO9660ToDateTime(VMTime); } - if (VXTime[0] == '0' || VXTime[0] == 0x00) + if(VXTime[0] == '0' || VXTime[0] == 0x00) { decodedVD.HasExpirationTime = false; } else { decodedVD.HasExpirationTime = true; - decodedVD.ExpirationTime = DateHandlers.ISO9660ToDateTime(VXTime); + decodedVD.ExpirationTime = DateHandlers.ISO9660ToDateTime(VXTime); } - if (VETime[0] == '0' || VETime[0] == 0x00) + if(VETime[0] == '0' || VETime[0] == 0x00) { decodedVD.HasEffectiveTime = false; } else { decodedVD.HasEffectiveTime = true; - decodedVD.EffectiveTime = DateHandlers.ISO9660ToDateTime(VETime); + decodedVD.EffectiveTime = DateHandlers.ISO9660ToDateTime(VETime); } return decodedVD; } - static DecodedVolumeDescriptor DecodeVolumeDescriptor(byte[] VDSysId, byte[] VDVolId, byte[] VDVolSetId, byte[] VDPubId, byte[] VDDataPrepId, byte[] VDAppId, byte[] VCTime, byte[] VMTime, byte[] VXTime, byte[] VETime) + static DecodedVolumeDescriptor DecodeVolumeDescriptor(byte[] VDSysId, byte[] VDVolId, byte[] VDVolSetId, byte[] VDPubId, byte[] VDDataPrepId, byte[] VDAppId, byte[] VCTime, byte[] VMTime, byte[] VXTime, byte[] VETime) { DecodedVolumeDescriptor decodedVD = new DecodedVolumeDescriptor(); - decodedVD.SystemIdentifier = Encoding.ASCII.GetString(VDSysId).TrimEnd().Trim(new []{'\u0000'}); - decodedVD.VolumeIdentifier = Encoding.ASCII.GetString(VDVolId).TrimEnd().Trim(new []{'\u0000'}); - decodedVD.VolumeSetIdentifier = Encoding.ASCII.GetString(VDVolSetId).TrimEnd().Trim(new []{'\u0000'}); - decodedVD.PublisherIdentifier = Encoding.ASCII.GetString(VDPubId).TrimEnd().Trim(new []{'\u0000'}); - decodedVD.DataPreparerIdentifier = Encoding.ASCII.GetString(VDDataPrepId).TrimEnd().Trim(new []{'\u0000'}); - decodedVD.ApplicationIdentifier = Encoding.ASCII.GetString(VDAppId).TrimEnd().Trim(new []{'\u0000'}); - if (VCTime[0] == '0' || VCTime[0] == 0x00) + decodedVD.SystemIdentifier = Encoding.ASCII.GetString(VDSysId).TrimEnd().Trim(new[] { '\u0000' }); + decodedVD.VolumeIdentifier = Encoding.ASCII.GetString(VDVolId).TrimEnd().Trim(new[] { '\u0000' }); + decodedVD.VolumeSetIdentifier = Encoding.ASCII.GetString(VDVolSetId).TrimEnd().Trim(new[] { '\u0000' }); + decodedVD.PublisherIdentifier = Encoding.ASCII.GetString(VDPubId).TrimEnd().Trim(new[] { '\u0000' }); + decodedVD.DataPreparerIdentifier = Encoding.ASCII.GetString(VDDataPrepId).TrimEnd().Trim(new[] { '\u0000' }); + decodedVD.ApplicationIdentifier = Encoding.ASCII.GetString(VDAppId).TrimEnd().Trim(new[] { '\u0000' }); + if(VCTime[0] == '0' || VCTime[0] == 0x00) decodedVD.CreationTime = DateTime.MinValue; else - decodedVD.CreationTime = DateHandlers.ISO9660ToDateTime(VCTime); + decodedVD.CreationTime = DateHandlers.ISO9660ToDateTime(VCTime); - if (VMTime[0] == '0' || VMTime[0] == 0x00) + if(VMTime[0] == '0' || VMTime[0] == 0x00) { decodedVD.HasModificationTime = false; } else { decodedVD.HasModificationTime = true; - decodedVD.ModificationTime = DateHandlers.ISO9660ToDateTime(VMTime); + decodedVD.ModificationTime = DateHandlers.ISO9660ToDateTime(VMTime); } - if (VXTime[0] == '0' || VXTime[0] == 0x00) + if(VXTime[0] == '0' || VXTime[0] == 0x00) { decodedVD.HasExpirationTime = false; } else { decodedVD.HasExpirationTime = true; - decodedVD.ExpirationTime = DateHandlers.ISO9660ToDateTime(VXTime); + decodedVD.ExpirationTime = DateHandlers.ISO9660ToDateTime(VXTime); } - if (VETime[0] == '0' || VETime[0] == 0x00) + if(VETime[0] == '0' || VETime[0] == 0x00) { decodedVD.HasEffectiveTime = false; } else { decodedVD.HasEffectiveTime = true; - decodedVD.EffectiveTime = DateHandlers.ISO9660ToDateTime(VETime); + decodedVD.EffectiveTime = DateHandlers.ISO9660ToDateTime(VETime); } return decodedVD; diff --git a/DiscImageChef.Filesystems/LisaFS.cs b/DiscImageChef.Filesystems/LisaFS.cs index 7d95a0cdc..1e02efdd4 100644 --- a/DiscImageChef.Filesystems/LisaFS.cs +++ b/DiscImageChef.Filesystems/LisaFS.cs @@ -76,7 +76,7 @@ namespace DiscImageChef.Plugins { try { - if(imagePlugin.ImageInfo.readableSectorTags==null) + if(imagePlugin.ImageInfo.readableSectorTags == null) return false; if(!imagePlugin.ImageInfo.readableSectorTags.Contains(SectorTagType.AppleSectorTag)) @@ -86,18 +86,18 @@ namespace DiscImageChef.Plugins BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; // Minimal LisaOS disk is 3.5" single sided double density, 800 sectors - if (imagePlugin.GetSectors() < 800) + if(imagePlugin.GetSectors() < 800) return false; // LisaOS searches sectors until tag tells MDDF resides there, so we'll search 100 sectors - for (int i = 0; i < 100; i++) + for(int i = 0; i < 100; i++) { byte[] tag = imagePlugin.ReadSectorTag((ulong)i, SectorTagType.AppleSectorTag); UInt16 fileid = BigEndianBitConverter.ToUInt16(tag, 0x04); DicConsole.DebugWriteLine("LisaFS plugin", "Sector {0}, file ID 0x{1:X4}", i, fileid); - if (fileid == FILEID_MDDF) + if(fileid == FILEID_MDDF) { byte[] sector = imagePlugin.ReadSector((ulong)i); Lisa_MDDF mddf = new Lisa_MDDF(); @@ -119,25 +119,25 @@ namespace DiscImageChef.Plugins DicConsole.DebugWriteLine("LisaFS plugin", "mddf.blocksize = {0} bytes", mddf.blocksize); DicConsole.DebugWriteLine("LisaFS plugin", "mddf.datasize = {0} bytes", mddf.datasize); - if (mddf.mddf_block != i) + if(mddf.mddf_block != i) return false; - if (mddf.vol_size > imagePlugin.GetSectors()) + if(mddf.vol_size > imagePlugin.GetSectors()) return false; - if (mddf.vol_size - 1 != mddf.volsize_minus_one) + if(mddf.vol_size - 1 != mddf.volsize_minus_one) return false; - if (mddf.vol_size - i - 1 != mddf.volsize_minus_mddf_minus_one) + if(mddf.vol_size - i - 1 != mddf.volsize_minus_mddf_minus_one) return false; - if (mddf.datasize > mddf.blocksize) + if(mddf.datasize > mddf.blocksize) return false; - if (mddf.blocksize < imagePlugin.GetSectorSize()) + if(mddf.blocksize < imagePlugin.GetSectorSize()) return false; - if (mddf.datasize != imagePlugin.GetSectorSize()) + if(mddf.datasize != imagePlugin.GetSectorSize()) return false; return true; @@ -146,7 +146,7 @@ namespace DiscImageChef.Plugins return false; } - catch (Exception ex) + catch(Exception ex) { DicConsole.ErrorWriteLine("Exception {0}, {1}, {2}", ex.Message, ex.InnerException, ex.StackTrace); return false; @@ -160,7 +160,7 @@ namespace DiscImageChef.Plugins try { - if(imagePlugin.ImageInfo.readableSectorTags==null) + if(imagePlugin.ImageInfo.readableSectorTags == null) return; if(!imagePlugin.ImageInfo.readableSectorTags.Contains(SectorTagType.AppleSectorTag)) @@ -170,18 +170,18 @@ namespace DiscImageChef.Plugins BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; // Minimal LisaOS disk is 3.5" single sided double density, 800 sectors - if (imagePlugin.GetSectors() < 800) + if(imagePlugin.GetSectors() < 800) return; // LisaOS searches sectors until tag tells MDDF resides there, so we'll search 100 sectors - for (int i = 0; i < 100; i++) + for(int i = 0; i < 100; i++) { byte[] tag = imagePlugin.ReadSectorTag((ulong)i, SectorTagType.AppleSectorTag); UInt16 fileid = BigEndianBitConverter.ToUInt16(tag, 0x04); DicConsole.DebugWriteLine("LisaFS plugin", "Sector {0}, file ID 0x{1:X4}", i, fileid); - if (fileid == FILEID_MDDF) + if(fileid == FILEID_MDDF) { byte[] sector = imagePlugin.ReadSector((ulong)i); Lisa_MDDF mddf = new Lisa_MDDF(); @@ -196,7 +196,7 @@ namespace DiscImageChef.Plugins mddf.unknown1 = sector[0x2D]; Array.Copy(sector, 0x2E, pString, 0, 33); // Prevent garbage - if (pString[0] <= 32) + if(pString[0] <= 32) mddf.password = StringHandlers.PascalToString(pString); else mddf.password = ""; @@ -309,28 +309,28 @@ namespace DiscImageChef.Plugins DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown38 = 0x{0:X8} ({0})", mddf.unknown38); DicConsole.DebugWriteLine("LisaFS plugin", "mddf.unknown_timestamp = 0x{0:X8} ({0}, {1})", mddf.unknown_timestamp, DateHandlers.LisaToDateTime(mddf.unknown_timestamp)); - if (mddf.mddf_block != i) + if(mddf.mddf_block != i) return; - if (mddf.vol_size > imagePlugin.GetSectors()) + if(mddf.vol_size > imagePlugin.GetSectors()) return; - if (mddf.vol_size - 1 != mddf.volsize_minus_one) + if(mddf.vol_size - 1 != mddf.volsize_minus_one) return; - if (mddf.vol_size - i - 1 != mddf.volsize_minus_mddf_minus_one) + if(mddf.vol_size - i - 1 != mddf.volsize_minus_mddf_minus_one) return; - if (mddf.datasize > mddf.blocksize) + if(mddf.datasize > mddf.blocksize) return; - if (mddf.blocksize < imagePlugin.GetSectorSize()) + if(mddf.blocksize < imagePlugin.GetSectorSize()) return; - if (mddf.datasize != imagePlugin.GetSectorSize()) + if(mddf.datasize != imagePlugin.GetSectorSize()) return; - switch (mddf.fsversion) + switch(mddf.fsversion) { case LisaFSv1: sb.AppendLine("LisaFS v1"); @@ -379,7 +379,7 @@ namespace DiscImageChef.Plugins sb.AppendFormat("Boot environment: 0x{0:X8}", mddf.boot_environ).AppendLine(); sb.AppendFormat("Overmount stamp: 0x{0:X16}", mddf.overmount_stamp).AppendLine(); - if (mddf.vol_left_mounted == 0) + if(mddf.vol_left_mounted == 0) sb.AppendLine("Volume is clean"); else sb.AppendLine("Volume is dirty"); @@ -414,7 +414,7 @@ namespace DiscImageChef.Plugins return; } - catch (Exception ex) + catch(Exception ex) { DicConsole.ErrorWriteLine("Exception {0}, {1}, {2}", ex.Message, ex.InnerException, ex.StackTrace); return; diff --git a/DiscImageChef.Filesystems/MinixFS.cs b/DiscImageChef.Filesystems/MinixFS.cs index fb92299d5..e472628f9 100644 --- a/DiscImageChef.Filesystems/MinixFS.cs +++ b/DiscImageChef.Filesystems/MinixFS.cs @@ -75,20 +75,20 @@ namespace DiscImageChef.Plugins public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd) { - if ((2 + partitionStart) >= imagePlugin.GetSectors()) + if((2 + partitionStart) >= imagePlugin.GetSectors()) return false; UInt16 magic; byte[] minix_sb_sector = imagePlugin.ReadSector(2 + partitionStart); magic = BitConverter.ToUInt16(minix_sb_sector, 0x010); // Here should reside magic number on Minix V1 & V2 - - if (magic == MINIX_MAGIC || magic == MINIX_MAGIC2 || magic == MINIX2_MAGIC || magic == MINIX2_MAGIC2 || + + if(magic == MINIX_MAGIC || magic == MINIX_MAGIC2 || magic == MINIX2_MAGIC || magic == MINIX2_MAGIC2 || magic == MINIX_CIGAM || magic == MINIX_CIGAM2 || magic == MINIX2_CIGAM || magic == MINIX2_CIGAM2) return true; magic = BitConverter.ToUInt16(minix_sb_sector, 0x018); // Here should reside magic number on Minix V3 - if (magic == MINIX3_MAGIC || magic == MINIX3_CIGAM) + if(magic == MINIX3_MAGIC || magic == MINIX3_CIGAM) return true; return false; } @@ -96,7 +96,7 @@ namespace DiscImageChef.Plugins public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, out string information) { information = ""; - + StringBuilder sb = new StringBuilder(); bool minix3 = false; @@ -109,7 +109,7 @@ namespace DiscImageChef.Plugins xmlFSType = new Schemas.FileSystemType(); - if (magic == MINIX3_MAGIC || magic == MINIX3_CIGAM) + if(magic == MINIX3_MAGIC || magic == MINIX3_CIGAM) { filenamesize = 60; minixVersion = "Minix V3 filesystem"; @@ -123,7 +123,7 @@ namespace DiscImageChef.Plugins { magic = BigEndianBitConverter.ToUInt16(minix_sb_sector, 0x010); - switch (magic) + switch(magic) { case MINIX_MAGIC: filenamesize = 14; @@ -178,7 +178,7 @@ namespace DiscImageChef.Plugins } } - if (minix3) + if(minix3) { Minix3SuperBlock mnx_sb = new Minix3SuperBlock(); @@ -214,7 +214,7 @@ namespace DiscImageChef.Plugins else { MinixSuperBlock mnx_sb = new MinixSuperBlock(); - + mnx_sb.s_ninodes = BigEndianBitConverter.ToUInt16(minix_sb_sector, 0x00); mnx_sb.s_nzones = BigEndianBitConverter.ToUInt16(minix_sb_sector, 0x02); mnx_sb.s_imap_blocks = BigEndianBitConverter.ToUInt16(minix_sb_sector, 0x04); @@ -228,8 +228,8 @@ namespace DiscImageChef.Plugins sb.AppendLine(minixVersion); sb.AppendFormat("{0} chars in filename", filenamesize).AppendLine(); - if (mnx_sb.s_zones > 0) // On V2 - sb.AppendFormat("{0} zones on volume ({1} bytes)", mnx_sb.s_zones, mnx_sb.s_zones * 1024).AppendLine(); + if(mnx_sb.s_zones > 0) // On V2 + sb.AppendFormat("{0} zones on volume ({1} bytes)", mnx_sb.s_zones, mnx_sb.s_zones * 1024).AppendLine(); else sb.AppendFormat("{0} zones on volume ({1} bytes)", mnx_sb.s_nzones, mnx_sb.s_nzones * 1024).AppendLine(); sb.AppendFormat("{0} inodes on volume", mnx_sb.s_ninodes).AppendLine(); diff --git a/DiscImageChef.Filesystems/NTFS.cs b/DiscImageChef.Filesystems/NTFS.cs index 09b8649c2..2823d94b9 100644 --- a/DiscImageChef.Filesystems/NTFS.cs +++ b/DiscImageChef.Filesystems/NTFS.cs @@ -53,49 +53,49 @@ namespace DiscImageChef.Plugins public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd) { - if ((2 + partitionStart) >= imagePlugin.GetSectors()) + if((2 + partitionStart) >= imagePlugin.GetSectors()) return false; byte[] eigth_bytes = new byte[8]; byte fats_no; UInt16 spfat, signature; string oem_name; - + byte[] ntfs_bpb = imagePlugin.ReadSector(0 + partitionStart); - + Array.Copy(ntfs_bpb, 0x003, eigth_bytes, 0, 8); oem_name = StringHandlers.CToString(eigth_bytes); - - if (oem_name != "NTFS ") + + if(oem_name != "NTFS ") return false; - + fats_no = ntfs_bpb[0x010]; - - if (fats_no != 0) + + if(fats_no != 0) return false; - + spfat = BitConverter.ToUInt16(ntfs_bpb, 0x016); - - if (spfat != 0) + + if(spfat != 0) return false; - + signature = BitConverter.ToUInt16(ntfs_bpb, 0x1FE); - + return signature == 0xAA55; } public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, out string information) { information = ""; - + StringBuilder sb = new StringBuilder(); - + byte[] ntfs_bpb = imagePlugin.ReadSector(0 + partitionStart); - + NTFS_BootBlock ntfs_bb = new NTFS_BootBlock(); - + byte[] oem_name = new byte[8]; - + ntfs_bb.jmp1 = ntfs_bpb[0x000]; ntfs_bb.jmp2 = BitConverter.ToUInt16(ntfs_bpb, 0x001); Array.Copy(ntfs_bpb, 0x003, oem_name, 0, 8); @@ -127,46 +127,46 @@ namespace DiscImageChef.Plugins ntfs_bb.dummy5 = BitConverter.ToUInt16(ntfs_bpb, 0x046); ntfs_bb.serial_no = BitConverter.ToUInt64(ntfs_bpb, 0x048); ntfs_bb.signature2 = BitConverter.ToUInt16(ntfs_bpb, 0x1FE); - + sb.AppendFormat("{0} bytes per sector", ntfs_bb.bps).AppendLine(); sb.AppendFormat("{0} sectors per cluster ({1} bytes)", ntfs_bb.spc, ntfs_bb.spc * ntfs_bb.bps).AppendLine(); -// sb.AppendFormat("{0} reserved sectors", ntfs_bb.rsectors).AppendLine(); -// sb.AppendFormat("{0} FATs", ntfs_bb.fats_no).AppendLine(); -// sb.AppendFormat("{0} entries in the root folder", ntfs_bb.root_ent).AppendLine(); -// sb.AppendFormat("{0} sectors on volume (small)", ntfs_bb.sml_sectors).AppendLine(); + // sb.AppendFormat("{0} reserved sectors", ntfs_bb.rsectors).AppendLine(); + // sb.AppendFormat("{0} FATs", ntfs_bb.fats_no).AppendLine(); + // sb.AppendFormat("{0} entries in the root folder", ntfs_bb.root_ent).AppendLine(); + // sb.AppendFormat("{0} sectors on volume (small)", ntfs_bb.sml_sectors).AppendLine(); sb.AppendFormat("Media descriptor: 0x{0:X2}", ntfs_bb.media).AppendLine(); -// sb.AppendFormat("{0} sectors per FAT", ntfs_bb.spfat).AppendLine(); + // sb.AppendFormat("{0} sectors per FAT", ntfs_bb.spfat).AppendLine(); sb.AppendFormat("{0} sectors per track", ntfs_bb.sptrk).AppendLine(); sb.AppendFormat("{0} heads", ntfs_bb.heads).AppendLine(); sb.AppendFormat("{0} hidden sectors before filesystem", ntfs_bb.hsectors).AppendLine(); -// sb.AppendFormat("{0} sectors on volume (big)", ntfs_bb.big_sectors).AppendLine(); + // sb.AppendFormat("{0} sectors on volume (big)", ntfs_bb.big_sectors).AppendLine(); sb.AppendFormat("BIOS drive number: 0x{0:X2}", ntfs_bb.drive_no).AppendLine(); -// sb.AppendFormat("NT flags: 0x{0:X2}", ntfs_bb.nt_flags).AppendLine(); -// sb.AppendFormat("Signature 1: 0x{0:X2}", ntfs_bb.signature1).AppendLine(); + // sb.AppendFormat("NT flags: 0x{0:X2}", ntfs_bb.nt_flags).AppendLine(); + // sb.AppendFormat("Signature 1: 0x{0:X2}", ntfs_bb.signature1).AppendLine(); sb.AppendFormat("{0} sectors on volume ({1} bytes)", ntfs_bb.sectors, ntfs_bb.sectors * ntfs_bb.bps).AppendLine(); sb.AppendFormat("Sectors where $MFT starts: {0}", ntfs_bb.mft_lsn).AppendLine(); sb.AppendFormat("Sectors where $MFTMirr starts: {0}", ntfs_bb.mftmirror_lsn).AppendLine(); - if (ntfs_bb.mft_rc_clusters > 0) + if(ntfs_bb.mft_rc_clusters > 0) sb.AppendFormat("{0} clusters per MFT record ({1} bytes)", ntfs_bb.mft_rc_clusters, ntfs_bb.mft_rc_clusters * ntfs_bb.bps * ntfs_bb.spc).AppendLine(); else sb.AppendFormat("{0} bytes per MFT record", 1 << -ntfs_bb.mft_rc_clusters).AppendLine(); - if (ntfs_bb.index_blk_cts > 0) + if(ntfs_bb.index_blk_cts > 0) sb.AppendFormat("{0} clusters per Index block ({1} bytes)", ntfs_bb.index_blk_cts, ntfs_bb.index_blk_cts * ntfs_bb.bps * ntfs_bb.spc).AppendLine(); else sb.AppendFormat("{0} bytes per Index block", 1 << -ntfs_bb.index_blk_cts).AppendLine(); sb.AppendFormat("Volume serial number: {0:X16}", ntfs_bb.serial_no).AppendLine(); -// sb.AppendFormat("Signature 2: 0x{0:X4}", ntfs_bb.signature2).AppendLine(); + // sb.AppendFormat("Signature 2: 0x{0:X4}", ntfs_bb.signature2).AppendLine(); xmlFSType = new Schemas.FileSystemType(); xmlFSType.ClusterSize = ntfs_bb.spc * ntfs_bb.bps; xmlFSType.Clusters = ntfs_bb.sectors / ntfs_bb.spc; xmlFSType.VolumeSerial = String.Format("{0:X16}", ntfs_bb.serial_no); xmlFSType.Type = "NTFS"; - + information = sb.ToString(); } diff --git a/DiscImageChef.Filesystems/Nintendo.cs b/DiscImageChef.Filesystems/Nintendo.cs index 85191b632..a0d24cf49 100644 --- a/DiscImageChef.Filesystems/Nintendo.cs +++ b/DiscImageChef.Filesystems/Nintendo.cs @@ -264,7 +264,7 @@ namespace DiscImageChef.Plugins for(int i = 0; i < fields.fourthPartitions.Length; i++) sbInformation.AppendFormat("Fourth {0} partition starts at sector {1}", PartitionTypeToString(fields.fourthPartitions[i].type), fields.fourthPartitions[i].offset / 2048).AppendLine(); -// sbInformation.AppendFormat("Region byte is {0}", fields.region).AppendLine(); + // sbInformation.AppendFormat("Region byte is {0}", fields.region).AppendLine(); if((fields.japanAge & 0x80) != 0x80) sbInformation.AppendFormat("Japan age rating is {0}", fields.japanAge).AppendLine(); if((fields.usaAge & 0x80) != 0x80) diff --git a/DiscImageChef.Filesystems/ODS.cs b/DiscImageChef.Filesystems/ODS.cs index 7eb3f2ef9..c0e3fceba 100644 --- a/DiscImageChef.Filesystems/ODS.cs +++ b/DiscImageChef.Filesystems/ODS.cs @@ -60,10 +60,10 @@ namespace DiscImageChef.Plugins public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd) { - if ((2 + partitionStart) >= imagePlugin.GetSectors()) + if((2 + partitionStart) >= imagePlugin.GetSectors()) return false; - if (imagePlugin.GetSectorSize() < 512) + if(imagePlugin.GetSectorSize() < 512) return false; byte[] magic_b = new byte[12]; @@ -72,22 +72,22 @@ namespace DiscImageChef.Plugins Array.Copy(hb_sector, 0x1F0, magic_b, 0, 12); magic = Encoding.ASCII.GetString(magic_b); - + return magic == "DECFILE11A " || magic == "DECFILE11B "; } public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, out string information) { information = ""; - + StringBuilder sb = new StringBuilder(); ODSHomeBlock homeblock = new ODSHomeBlock(); byte[] temp_string = new byte[12]; homeblock.min_class = new byte[20]; homeblock.max_class = new byte[20]; - + byte[] hb_sector = imagePlugin.ReadSector(1 + partitionStart); - + homeblock.homelbn = BitConverter.ToUInt32(hb_sector, 0x000); homeblock.alhomelbn = BitConverter.ToUInt32(hb_sector, 0x004); homeblock.altidxlbn = BitConverter.ToUInt32(hb_sector, 0x008); @@ -136,12 +136,12 @@ namespace DiscImageChef.Plugins Array.Copy(hb_sector, 0x1F0, temp_string, 0, 12); homeblock.format = StringHandlers.CToString(temp_string); homeblock.checksum2 = BitConverter.ToUInt16(hb_sector, 0x1FE); - - if ((homeblock.struclev & 0xFF00) != 0x0200 || (homeblock.struclev & 0xFF) != 1 || homeblock.format != "DECFILE11B ") + + if((homeblock.struclev & 0xFF00) != 0x0200 || (homeblock.struclev & 0xFF) != 1 || homeblock.format != "DECFILE11B ") sb.AppendLine("The following information may be incorrect for this volume."); - if (homeblock.resfiles < 5 || homeblock.devtype != 0) + if(homeblock.resfiles < 5 || homeblock.devtype != 0) sb.AppendLine("This volume may be corrupted."); - + sb.AppendFormat("Volume format is {0}", homeblock.format).AppendLine(); sb.AppendFormat("Volume is Level {0} revision {1}", (homeblock.struclev & 0xFF00) >> 8, homeblock.struclev & 0xFF).AppendLine(); sb.AppendFormat("Lowest structure in the volume is Level {0}, revision {1}", (homeblock.lowstruclev & 0xFF00) >> 8, homeblock.lowstruclev & 0xFF).AppendLine(); @@ -154,121 +154,121 @@ namespace DiscImageChef.Plugins sb.AppendFormat("Backup INDEXF.SYS;1 is in sector {0} (cluster {1})", homeblock.altidxlbn, homeblock.altidxvbn).AppendLine(); sb.AppendFormat("{0} maximum files on the volume", homeblock.maxfiles).AppendLine(); sb.AppendFormat("{0} reserved files", homeblock.resfiles).AppendLine(); - if (homeblock.rvn > 0 && homeblock.setcount > 0 && homeblock.strucname != " ") + if(homeblock.rvn > 0 && homeblock.setcount > 0 && homeblock.strucname != " ") sb.AppendFormat("Volume is {0} of {1} in set \"{2}\".", homeblock.rvn, homeblock.setcount, homeblock.strucname).AppendLine(); sb.AppendFormat("Volume owner is \"{0}\" (ID 0x{1:X8})", homeblock.ownername, homeblock.volowner).AppendLine(); sb.AppendFormat("Volume label: \"{0}\"", homeblock.volname).AppendLine(); sb.AppendFormat("Drive serial number: 0x{0:X8}", homeblock.serialnum).AppendLine(); sb.AppendFormat("Volume was created on {0}", DateHandlers.VMSToDateTime(homeblock.credate)).AppendLine(); - if (homeblock.revdate > 0) + if(homeblock.revdate > 0) sb.AppendFormat("Volume was last modified on {0}", DateHandlers.VMSToDateTime(homeblock.revdate)).AppendLine(); - if (homeblock.copydate > 0) + if(homeblock.copydate > 0) sb.AppendFormat("Volume copied on {0}", DateHandlers.VMSToDateTime(homeblock.copydate)).AppendLine(); sb.AppendFormat("Checksums: 0x{0:X4} and 0x{1:X4}", homeblock.checksum1, homeblock.checksum2).AppendLine(); sb.AppendLine("Flags:"); sb.AppendFormat("Window: {0}", homeblock.window).AppendLine(); sb.AppendFormat("Cached directores: {0}", homeblock.lru_lim).AppendLine(); sb.AppendFormat("Default allocation: {0} blocks", homeblock.extend).AppendLine(); - if ((homeblock.volchar & 0x01) == 0x01) + if((homeblock.volchar & 0x01) == 0x01) sb.AppendLine("Readings should be verified"); - if ((homeblock.volchar & 0x02) == 0x02) + if((homeblock.volchar & 0x02) == 0x02) sb.AppendLine("Writings should be verified"); - if ((homeblock.volchar & 0x04) == 0x04) + if((homeblock.volchar & 0x04) == 0x04) sb.AppendLine("Files should be erased or overwritten when deleted"); - if ((homeblock.volchar & 0x08) == 0x08) + if((homeblock.volchar & 0x08) == 0x08) sb.AppendLine("Highwater mark is to be disabled"); - if ((homeblock.volchar & 0x10) == 0x10) + if((homeblock.volchar & 0x10) == 0x10) sb.AppendLine("Classification checks are enabled"); sb.AppendLine("Volume permissions (r = read, w = write, c = create, d = delete)"); sb.AppendLine("System, owner, group, world"); // System - if ((homeblock.protect & 0x1000) == 0x1000) + if((homeblock.protect & 0x1000) == 0x1000) sb.Append("-"); else sb.Append("r"); - if ((homeblock.protect & 0x2000) == 0x2000) + if((homeblock.protect & 0x2000) == 0x2000) sb.Append("-"); else sb.Append("w"); - if ((homeblock.protect & 0x4000) == 0x4000) + if((homeblock.protect & 0x4000) == 0x4000) sb.Append("-"); else sb.Append("c"); - if ((homeblock.protect & 0x8000) == 0x8000) + if((homeblock.protect & 0x8000) == 0x8000) sb.Append("-"); else sb.Append("d"); // Owner - if ((homeblock.protect & 0x100) == 0x100) + if((homeblock.protect & 0x100) == 0x100) sb.Append("-"); else sb.Append("r"); - if ((homeblock.protect & 0x200) == 0x200) + if((homeblock.protect & 0x200) == 0x200) sb.Append("-"); else sb.Append("w"); - if ((homeblock.protect & 0x400) == 0x400) + if((homeblock.protect & 0x400) == 0x400) sb.Append("-"); else sb.Append("c"); - if ((homeblock.protect & 0x800) == 0x800) + if((homeblock.protect & 0x800) == 0x800) sb.Append("-"); else sb.Append("d"); // Group - if ((homeblock.protect & 0x10) == 0x10) + if((homeblock.protect & 0x10) == 0x10) sb.Append("-"); else sb.Append("r"); - if ((homeblock.protect & 0x20) == 0x20) + if((homeblock.protect & 0x20) == 0x20) sb.Append("-"); else sb.Append("w"); - if ((homeblock.protect & 0x40) == 0x40) + if((homeblock.protect & 0x40) == 0x40) sb.Append("-"); else sb.Append("c"); - if ((homeblock.protect & 0x80) == 0x80) + if((homeblock.protect & 0x80) == 0x80) sb.Append("-"); else sb.Append("d"); // World (other) - if ((homeblock.protect & 0x1) == 0x1) + if((homeblock.protect & 0x1) == 0x1) sb.Append("-"); else sb.Append("r"); - if ((homeblock.protect & 0x2) == 0x2) + if((homeblock.protect & 0x2) == 0x2) sb.Append("-"); else sb.Append("w"); - if ((homeblock.protect & 0x4) == 0x4) + if((homeblock.protect & 0x4) == 0x4) sb.Append("-"); else sb.Append("c"); - if ((homeblock.protect & 0x8) == 0x8) + if((homeblock.protect & 0x8) == 0x8) sb.Append("-"); else sb.Append("d"); - + sb.AppendLine(); - + sb.AppendLine("Unknown structures:"); sb.AppendFormat("Security mask: 0x{0:X8}", homeblock.sec_mask).AppendLine(); sb.AppendFormat("File protection: 0x{0:X4}", homeblock.fileprot).AppendLine(); sb.AppendFormat("Record protection: 0x{0:X4}", homeblock.recprot).AppendLine(); - + xmlFSType = new Schemas.FileSystemType(); xmlFSType.Type = "FILES-11"; xmlFSType.ClusterSize = homeblock.cluster * 512; xmlFSType.Clusters = homeblock.cluster; xmlFSType.VolumeName = homeblock.volname; xmlFSType.VolumeSerial = String.Format("{0:X8}", homeblock.serialnum); - if (homeblock.credate > 0) + if(homeblock.credate > 0) { xmlFSType.CreationDate = DateHandlers.VMSToDateTime(homeblock.credate); xmlFSType.CreationDateSpecified = true; } - if (homeblock.revdate > 0) + if(homeblock.revdate > 0) { xmlFSType.ModificationDate = DateHandlers.VMSToDateTime(homeblock.revdate); xmlFSType.ModificationDateSpecified = true; diff --git a/DiscImageChef.Filesystems/Opera.cs b/DiscImageChef.Filesystems/Opera.cs index efe0b8237..5a0c70178 100644 --- a/DiscImageChef.Filesystems/Opera.cs +++ b/DiscImageChef.Filesystems/Opera.cs @@ -53,7 +53,7 @@ namespace DiscImageChef.Plugins public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd) { - if ((2 + partitionStart) >= imagePlugin.GetSectors()) + if((2 + partitionStart) >= imagePlugin.GetSectors()) return false; byte[] sb_sector = imagePlugin.ReadSector(0 + partitionStart); @@ -61,15 +61,15 @@ namespace DiscImageChef.Plugins byte record_type; byte[] sync_bytes = new byte[5]; byte record_version; - + record_type = sb_sector[0x000]; Array.Copy(sb_sector, 0x001, sync_bytes, 0, 5); record_version = sb_sector[0x006]; - - if (record_type != 1 || record_version != 1) + + if(record_type != 1 || record_version != 1) return false; return Encoding.ASCII.GetString(sync_bytes) == "ZZZZZ"; - + } public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, out string information) @@ -99,15 +99,15 @@ namespace DiscImageChef.Plugins sb.rootdir_bsize = BigEndianBitConverter.ToInt32(sb_sector, 0x05C); sb.last_root_copy = BigEndianBitConverter.ToInt32(sb_sector, 0x060); - if (sb.record_type != 1 || sb.record_version != 1) + if(sb.record_type != 1 || sb.record_version != 1) return; - if (Encoding.ASCII.GetString(sb.sync_bytes) != "ZZZZZ") + if(Encoding.ASCII.GetString(sb.sync_bytes) != "ZZZZZ") return; - if (sb.volume_comment.Length == 0) + if(sb.volume_comment.Length == 0) sb.volume_comment = "Not set."; - if (sb.volume_label.Length == 0) + if(sb.volume_label.Length == 0) sb.volume_label = "Not set."; SuperBlockMetadata.AppendFormat("Opera filesystem disc.").AppendLine(); @@ -115,15 +115,15 @@ namespace DiscImageChef.Plugins SuperBlockMetadata.AppendFormat("Volume comment: {0}", sb.volume_comment).AppendLine(); SuperBlockMetadata.AppendFormat("Volume identifier: 0x{0:X8}", sb.volume_id).AppendLine(); SuperBlockMetadata.AppendFormat("Block size: {0} bytes", sb.block_size).AppendLine(); - if (imagePlugin.GetSectorSize() == 2336 || imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448) + if(imagePlugin.GetSectorSize() == 2336 || imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448) { - if (sb.block_size != 2048) + if(sb.block_size != 2048) SuperBlockMetadata.AppendFormat("WARNING: Filesystem indicates {0} bytes/block while device indicates {1} bytes/block", sb.block_size, 2048); } - else if (imagePlugin.GetSectorSize() != sb.block_size) + else if(imagePlugin.GetSectorSize() != sb.block_size) SuperBlockMetadata.AppendFormat("WARNING: Filesystem indicates {0} bytes/block while device indicates {1} bytes/block", sb.block_size, imagePlugin.GetSectorSize()); SuperBlockMetadata.AppendFormat("Volume size: {0} blocks, {1} bytes", sb.block_count, sb.block_size * sb.block_count).AppendLine(); - if ((ulong)sb.block_count > imagePlugin.GetSectors()) + if((ulong)sb.block_count > imagePlugin.GetSectors()) SuperBlockMetadata.AppendFormat("WARNING: Filesystem indicates {0} blocks while device indicates {1} blocks", sb.block_count, imagePlugin.GetSectors()); SuperBlockMetadata.AppendFormat("Root directory identifier: 0x{0:X8}", sb.root_dirid).AppendLine(); SuperBlockMetadata.AppendFormat("Root directory block size: {0} bytes", sb.rootdir_bsize).AppendLine(); diff --git a/DiscImageChef.Filesystems/PCEngine.cs b/DiscImageChef.Filesystems/PCEngine.cs index 71c0ce3d7..5a9c5d51d 100644 --- a/DiscImageChef.Filesystems/PCEngine.cs +++ b/DiscImageChef.Filesystems/PCEngine.cs @@ -52,7 +52,7 @@ namespace DiscImageChef.Plugins public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd) { - if ((2 + partitionStart) >= imagePlugin.GetSectors()) + if((2 + partitionStart) >= imagePlugin.GetSectors()) return false; byte[] system_descriptor = new byte[23]; diff --git a/DiscImageChef.Filesystems/Plugin.cs b/DiscImageChef.Filesystems/Plugin.cs index a0cb62c6f..c494e4eb8 100644 --- a/DiscImageChef.Filesystems/Plugin.cs +++ b/DiscImageChef.Filesystems/Plugin.cs @@ -44,7 +44,7 @@ namespace DiscImageChef.Plugins /// Abstract class to implement filesystem plugins. /// public abstract class Plugin - { + { /// Plugin name. public string Name; /// Plugin UUID. @@ -66,7 +66,7 @@ namespace DiscImageChef.Plugins protected Plugin() { } - + /// /// Identifies the filesystem in the specified LBA /// @@ -84,6 +84,6 @@ namespace DiscImageChef.Plugins /// Partition end sector (LBA). /// Filesystem information. public abstract void GetInformation(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, out string information); - } + } } diff --git a/DiscImageChef.Filesystems/ProDOS.cs b/DiscImageChef.Filesystems/ProDOS.cs index f2c55fcb7..858485490 100644 --- a/DiscImageChef.Filesystems/ProDOS.cs +++ b/DiscImageChef.Filesystems/ProDOS.cs @@ -94,30 +94,30 @@ namespace DiscImageChef.Plugins public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd) { - if (imagePlugin.GetSectors() < 3) + if(imagePlugin.GetSectors() < 3) return false; // Blocks 0 and 1 are boot code byte[] rootDirectoryKeyBlock = imagePlugin.ReadSector(2 + partitionStart); UInt16 prePointer = BitConverter.ToUInt16(rootDirectoryKeyBlock, 0); - if (prePointer != 0) + if(prePointer != 0) return false; byte storage_type = (byte)((rootDirectoryKeyBlock[0x04] & ProDOSStorageTypeMask) >> 4); - if (storage_type != RootDirectoryType) + if(storage_type != RootDirectoryType) return false; byte entry_length = rootDirectoryKeyBlock[0x23]; - if (entry_length != ProDOSEntryLength) + if(entry_length != ProDOSEntryLength) return false; byte entries_per_block = rootDirectoryKeyBlock[0x24]; - if (entries_per_block != ProDOSEntriesPerBlock) + if(entries_per_block != ProDOSEntriesPerBlock) return false; UInt16 bit_map_pointer = BitConverter.ToUInt16(rootDirectoryKeyBlock, 0x27); - if (bit_map_pointer > imagePlugin.GetSectors()) + if(bit_map_pointer > imagePlugin.GetSectors()) return false; UInt16 total_blocks = BitConverter.ToUInt16(rootDirectoryKeyBlock, 0x29); @@ -157,7 +157,7 @@ namespace DiscImageChef.Plugins hour = (int)((temp_timestamp & ProDOSHourMask) >> 8); minute = (int)(temp_timestamp & ProDOSMinuteMask); year += 1900; - if (year < 1940) + if(year < 1940) year += 100; DicConsole.DebugWriteLine("ProDOS plugin", "temp_timestamp_left = 0x{0:X4}", temp_timestamp_left); @@ -177,18 +177,18 @@ namespace DiscImageChef.Plugins rootDirectoryKeyBlock.header.bit_map_pointer = BitConverter.ToUInt16(rootDirectoryKeyBlockBytes, 0x27); rootDirectoryKeyBlock.header.total_blocks = BitConverter.ToUInt16(rootDirectoryKeyBlockBytes, 0x29); - if (rootDirectoryKeyBlock.header.version != ProDOSVersion1 || rootDirectoryKeyBlock.header.min_version != ProDOSVersion1) + if(rootDirectoryKeyBlock.header.version != ProDOSVersion1 || rootDirectoryKeyBlock.header.min_version != ProDOSVersion1) { sbInformation.AppendLine("Warning! Detected unknown ProDOS version ProDOS filesystem."); sbInformation.AppendLine("All of the following information may be incorrect"); } - if (rootDirectoryKeyBlock.header.version == ProDOSVersion1) + if(rootDirectoryKeyBlock.header.version == ProDOSVersion1) sbInformation.AppendLine("ProDOS version 1 used to create this volume."); else sbInformation.AppendFormat("Unknown ProDOS version with field {0} used to create this volume.", rootDirectoryKeyBlock.header.version).AppendLine(); - if (rootDirectoryKeyBlock.header.min_version == ProDOSVersion1) + if(rootDirectoryKeyBlock.header.min_version == ProDOSVersion1) sbInformation.AppendLine("ProDOS version 1 at least required for reading this volume."); else sbInformation.AppendFormat("Unknown ProDOS version with field {0} is at least required for reading this volume.", rootDirectoryKeyBlock.header.min_version).AppendLine(); @@ -201,25 +201,25 @@ namespace DiscImageChef.Plugins sbInformation.AppendFormat("{0} blocks in volume", rootDirectoryKeyBlock.header.total_blocks).AppendLine(); sbInformation.AppendFormat("Bitmap starts at block {0}", rootDirectoryKeyBlock.header.bit_map_pointer).AppendLine(); - if ((rootDirectoryKeyBlock.header.access & ProDOSReadAttribute) == ProDOSReadAttribute) + if((rootDirectoryKeyBlock.header.access & ProDOSReadAttribute) == ProDOSReadAttribute) sbInformation.AppendLine("Volume can be read"); - if ((rootDirectoryKeyBlock.header.access & ProDOSWriteAttribute) == ProDOSWriteAttribute) + if((rootDirectoryKeyBlock.header.access & ProDOSWriteAttribute) == ProDOSWriteAttribute) sbInformation.AppendLine("Volume can be written"); - if ((rootDirectoryKeyBlock.header.access & ProDOSRenameAttribute) == ProDOSRenameAttribute) + if((rootDirectoryKeyBlock.header.access & ProDOSRenameAttribute) == ProDOSRenameAttribute) sbInformation.AppendLine("Volume can be renamed"); - if ((rootDirectoryKeyBlock.header.access & ProDOSDestroyAttribute) == ProDOSDestroyAttribute) + if((rootDirectoryKeyBlock.header.access & ProDOSDestroyAttribute) == ProDOSDestroyAttribute) sbInformation.AppendLine("Volume can be destroyed"); - if ((rootDirectoryKeyBlock.header.access & ProDOSBackupAttribute) == ProDOSBackupAttribute) + if((rootDirectoryKeyBlock.header.access & ProDOSBackupAttribute) == ProDOSBackupAttribute) sbInformation.AppendLine("Volume must be backed up"); - if ((rootDirectoryKeyBlock.header.access & ProDOSReservedAttributeMask) != 0) + if((rootDirectoryKeyBlock.header.access & ProDOSReservedAttributeMask) != 0) DicConsole.DebugWriteLine("ProDOS plugin", "Reserved attributes are set: {0:X2}", rootDirectoryKeyBlock.header.access); information = sbInformation.ToString(); xmlFSType = new Schemas.FileSystemType(); xmlFSType.VolumeName = rootDirectoryKeyBlock.header.volume_name; - if (year != 0 || month != 0 || day != 0 || hour != 0 || minute != 0) + if(year != 0 || month != 0 || day != 0 || hour != 0 || minute != 0) { xmlFSType.CreationDate = rootDirectoryKeyBlock.header.creation_time; xmlFSType.CreationDateSpecified = true; diff --git a/DiscImageChef.Filesystems/SolarFS.cs b/DiscImageChef.Filesystems/SolarFS.cs index 045342ad7..e47dba8a7 100644 --- a/DiscImageChef.Filesystems/SolarFS.cs +++ b/DiscImageChef.Filesystems/SolarFS.cs @@ -56,7 +56,7 @@ namespace DiscImageChef.Plugins public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd) { - if ((2 + partitionStart) >= imagePlugin.GetSectors()) + if((2 + partitionStart) >= imagePlugin.GetSectors()) return false; byte signature; /// 0x29 @@ -70,7 +70,7 @@ namespace DiscImageChef.Plugins Array.Copy(bpb, 0x35, fs_type_b, 0, 8); fs_type = StringHandlers.CToString(fs_type_b); - if (signature == 0x29 && fs_type == "SOL_FS ") + if(signature == 0x29 && fs_type == "SOL_FS ") return true; return false; } @@ -78,7 +78,7 @@ namespace DiscImageChef.Plugins public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, out string information) { information = ""; - + StringBuilder sb = new StringBuilder(); byte[] bpb_sector = imagePlugin.ReadSector(0 + partitionStart); byte[] bpb_strings; @@ -131,19 +131,19 @@ namespace DiscImageChef.Plugins sb.AppendLine("Solar_OS filesystem"); sb.AppendFormat("Media descriptor: 0x{0:X2}", BPB.media).AppendLine(); sb.AppendFormat("{0} bytes per sector", BPB.bps).AppendLine(); - if (imagePlugin.GetSectorSize() == 2336 || imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448) + if(imagePlugin.GetSectorSize() == 2336 || imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448) { - if (BPB.bps != imagePlugin.GetSectorSize()) + if(BPB.bps != imagePlugin.GetSectorSize()) { sb.AppendFormat("WARNING: Filesystem describes a {0} bytes/sector, while device describes a {1} bytes/sector", BPB.bps, 2048).AppendLine(); } } - else if (BPB.bps != imagePlugin.GetSectorSize()) + else if(BPB.bps != imagePlugin.GetSectorSize()) { sb.AppendFormat("WARNING: Filesystem describes a {0} bytes/sector, while device describes a {1} bytes/sector", BPB.bps, imagePlugin.GetSectorSize()).AppendLine(); } sb.AppendFormat("{0} sectors on volume ({1} bytes)", BPB.sectors, BPB.sectors * BPB.bps).AppendLine(); - if (BPB.sectors > imagePlugin.GetSectors()) + if(BPB.sectors > imagePlugin.GetSectors()) sb.AppendFormat("WARNING: Filesystem describes a {0} sectors volume, bigger than device ({1} sectors)", BPB.sectors, imagePlugin.GetSectors()); sb.AppendFormat("{0} heads", BPB.heads).AppendLine(); sb.AppendFormat("{0} sectors per track", BPB.sptrk).AppendLine(); diff --git a/DiscImageChef.Filesystems/Symbian.cs b/DiscImageChef.Filesystems/Symbian.cs index 0ce25d5f1..445b3d0ce 100644 --- a/DiscImageChef.Filesystems/Symbian.cs +++ b/DiscImageChef.Filesystems/Symbian.cs @@ -370,4 +370,4 @@ namespace DiscImageChef.Plugins } } -*/ \ No newline at end of file +*/ diff --git a/DiscImageChef.Filesystems/SysV.cs b/DiscImageChef.Filesystems/SysV.cs index 2976243c1..99604299d 100644 --- a/DiscImageChef.Filesystems/SysV.cs +++ b/DiscImageChef.Filesystems/SysV.cs @@ -68,7 +68,7 @@ namespace DiscImageChef.Plugins public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd) { - if ((2 + partitionStart) >= imagePlugin.GetSectors()) + if((2 + partitionStart) >= imagePlugin.GetSectors()) return false; UInt32 magic; @@ -98,27 +98,27 @@ namespace DiscImageChef.Plugins byte sb_size_in_sectors; - if (imagePlugin.GetSectorSize() <= 0x400) // Check if underlying device sector size is smaller than SuperBlock size + if(imagePlugin.GetSectorSize() <= 0x400) // Check if underlying device sector size is smaller than SuperBlock size sb_size_in_sectors = (byte)(0x400 / imagePlugin.GetSectorSize()); else sb_size_in_sectors = 1; // If not a single sector can store it - if (imagePlugin.GetSectors() <= (partitionStart + 4 * (ulong)sb_size_in_sectors + (ulong)sb_size_in_sectors)) // Device must be bigger than SB location + SB size + offset + if(imagePlugin.GetSectors() <= (partitionStart + 4 * (ulong)sb_size_in_sectors + (ulong)sb_size_in_sectors)) // Device must be bigger than SB location + SB size + offset return false; // Superblock can start on 0x000, 0x200, 0x600 and 0x800, not aligned, so we assume 16 (128 bytes/sector) sectors as a safe value - for (int i = 0; i <= 16; i++) + for(int i = 0; i <= 16; i++) { byte[] sb_sector = imagePlugin.ReadSectors((ulong)i + partitionStart, sb_size_in_sectors); magic = BitConverter.ToUInt32(sb_sector, 0x3F8); // XENIX magic location - if (magic == XENIX_MAGIC || magic == XENIX_CIGAM) + if(magic == XENIX_MAGIC || magic == XENIX_CIGAM) return true; magic = BitConverter.ToUInt32(sb_sector, 0x1F8); // System V magic location - if (magic == SYSV_MAGIC || magic == SYSV_CIGAM) + if(magic == SYSV_MAGIC || magic == SYSV_CIGAM) return true; byte[] coherent_string = new byte[6]; @@ -127,7 +127,7 @@ namespace DiscImageChef.Plugins Array.Copy(sb_sector, 0x1EE, coherent_string, 0, 6); // Coherent UNIX s_fpack location s_fpack = StringHandlers.CToString(coherent_string); - if (s_fname == COH_FNAME || s_fpack == COH_FPACK) + if(s_fname == COH_FNAME || s_fpack == COH_FPACK) return true; // Now try to identify 7th edition @@ -135,9 +135,9 @@ namespace DiscImageChef.Plugins s_nfree = BitConverter.ToUInt16(sb_sector, 0x006); // 7th edition's s_nfree s_ninode = BitConverter.ToUInt16(sb_sector, 0x0D0); // 7th edition's s_ninode - if (s_fsize > 0 && s_fsize < 0xFFFFFFFF && s_nfree > 0 && s_nfree < 0xFFFF && s_ninode > 0 && s_ninode < 0xFFFF) + if(s_fsize > 0 && s_fsize < 0xFFFFFFFF && s_nfree > 0 && s_nfree < 0xFFFF && s_ninode > 0 && s_ninode < 0xFFFF) { - if ((s_fsize & 0xFF) == 0x00 && (s_nfree & 0xFF) == 0x00 && (s_ninode & 0xFF) == 0x00) + if((s_fsize & 0xFF) == 0x00 && (s_nfree & 0xFF) == 0x00 && (s_ninode & 0xFF) == 0x00) { // Byteswap s_fsize = ((s_fsize & 0xFF) << 24) + ((s_fsize & 0xFF00) << 8) + ((s_fsize & 0xFF0000) >> 8) + ((s_fsize & 0xFF000000) >> 24); @@ -145,11 +145,11 @@ namespace DiscImageChef.Plugins s_ninode = (UInt16)(s_ninode >> 8); } - if ((s_fsize & 0xFF000000) == 0x00 && (s_nfree & 0xFF00) == 0x00 && (s_ninode & 0xFF00) == 0x00) + if((s_fsize & 0xFF000000) == 0x00 && (s_nfree & 0xFF00) == 0x00 && (s_ninode & 0xFF00) == 0x00) { - if (s_fsize < V7_MAXSIZE && s_nfree < V7_NICFREE && s_ninode < V7_NICINOD) + if(s_fsize < V7_MAXSIZE && s_nfree < V7_NICFREE && s_ninode < V7_NICINOD) { - if ((s_fsize * 1024) == (imagePlugin.GetSectors() * imagePlugin.GetSectorSize()) || (s_fsize * 512) == (imagePlugin.GetSectors() * imagePlugin.GetSectorSize())) + if((s_fsize * 1024) == (imagePlugin.GetSectors() * imagePlugin.GetSectorSize()) || (s_fsize * 512) == (imagePlugin.GetSectors() * imagePlugin.GetSectorSize())) return true; } } @@ -162,7 +162,7 @@ namespace DiscImageChef.Plugins public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, out string information) { information = ""; - + StringBuilder sb = new StringBuilder(); BigEndianBitConverter.IsLittleEndian = true; // Start in little endian until we know what are we handling here int start; @@ -178,24 +178,24 @@ namespace DiscImageChef.Plugins byte[] sb_sector; byte sb_size_in_sectors; - if (imagePlugin.GetSectorSize() <= 0x400) // Check if underlying device sector size is smaller than SuperBlock size + if(imagePlugin.GetSectorSize() <= 0x400) // Check if underlying device sector size is smaller than SuperBlock size sb_size_in_sectors = (byte)(0x400 / imagePlugin.GetSectorSize()); else sb_size_in_sectors = 1; // If not a single sector can store it // Superblock can start on 0x000, 0x200, 0x600 and 0x800, not aligned, so we assume 16 (128 bytes/sector) sectors as a safe value - for (start = 0; start <= 16; start++) + for(start = 0; start <= 16; start++) { sb_sector = imagePlugin.ReadSectors((ulong)start + partitionStart, sb_size_in_sectors); magic = BigEndianBitConverter.ToUInt32(sb_sector, 0x3F8); // XENIX magic location - - if (magic == XENIX_MAGIC) + + if(magic == XENIX_MAGIC) { BigEndianBitConverter.IsLittleEndian = true; // Little endian xenix = true; break; } - if (magic == XENIX_CIGAM) + if(magic == XENIX_CIGAM) { BigEndianBitConverter.IsLittleEndian = false; // Big endian xenix = true; @@ -203,14 +203,14 @@ namespace DiscImageChef.Plugins } magic = BigEndianBitConverter.ToUInt32(sb_sector, 0x1F8); // XENIX magic location - - if (magic == SYSV_MAGIC) + + if(magic == SYSV_MAGIC) { BigEndianBitConverter.IsLittleEndian = true; // Little endian sysv = true; break; } - if (magic == SYSV_CIGAM) + if(magic == SYSV_CIGAM) { BigEndianBitConverter.IsLittleEndian = false; // Big endian sysv = true; @@ -222,8 +222,8 @@ namespace DiscImageChef.Plugins s_fname = StringHandlers.CToString(coherent_string); Array.Copy(sb_sector, 0x1EE, coherent_string, 0, 6); // Coherent UNIX s_fpack location s_fpack = StringHandlers.CToString(coherent_string); - - if (s_fname == COH_FNAME || s_fpack == COH_FPACK) + + if(s_fname == COH_FNAME || s_fpack == COH_FPACK) { BigEndianBitConverter.IsLittleEndian = true; // Coherent is in PDP endianness, use helper for that coherent = true; @@ -235,21 +235,21 @@ namespace DiscImageChef.Plugins s_nfree = BitConverter.ToUInt16(sb_sector, 0x006); // 7th edition's s_nfree s_ninode = BitConverter.ToUInt16(sb_sector, 0x0D0); // 7th edition's s_ninode - if (s_fsize > 0 && s_fsize < 0xFFFFFFFF && s_nfree > 0 && s_nfree < 0xFFFF && s_ninode > 0 && s_ninode < 0xFFFF) + if(s_fsize > 0 && s_fsize < 0xFFFFFFFF && s_nfree > 0 && s_nfree < 0xFFFF && s_ninode > 0 && s_ninode < 0xFFFF) { - if ((s_fsize & 0xFF) == 0x00 && (s_nfree & 0xFF) == 0x00 && (s_ninode & 0xFF) == 0x00) + if((s_fsize & 0xFF) == 0x00 && (s_nfree & 0xFF) == 0x00 && (s_ninode & 0xFF) == 0x00) { // Byteswap s_fsize = ((s_fsize & 0xFF) << 24) + ((s_fsize & 0xFF00) << 8) + ((s_fsize & 0xFF0000) >> 8) + ((s_fsize & 0xFF000000) >> 24); s_nfree = (UInt16)(s_nfree >> 8); s_ninode = (UInt16)(s_ninode >> 8); } - - if ((s_fsize & 0xFF000000) == 0x00 && (s_nfree & 0xFF00) == 0x00 && (s_ninode & 0xFF00) == 0x00) + + if((s_fsize & 0xFF000000) == 0x00 && (s_nfree & 0xFF00) == 0x00 && (s_ninode & 0xFF00) == 0x00) { - if (s_fsize < V7_MAXSIZE && s_nfree < V7_NICFREE && s_ninode < V7_NICINOD) + if(s_fsize < V7_MAXSIZE && s_nfree < V7_NICFREE && s_ninode < V7_NICINOD) { - if ((s_fsize * 1024) == (imagePlugin.GetSectors() * imagePlugin.GetSectorSize()) || (s_fsize * 512) == (imagePlugin.GetSectors() * imagePlugin.GetSectorSize())) + if((s_fsize * 1024) == (imagePlugin.GetSectors() * imagePlugin.GetSectorSize()) || (s_fsize * 512) == (imagePlugin.GetSectors() * imagePlugin.GetSectorSize())) { sys7th = true; BigEndianBitConverter.IsLittleEndian = true; @@ -259,17 +259,17 @@ namespace DiscImageChef.Plugins } } } - if (!sys7th && !sysv && !coherent && !xenix) + if(!sys7th && !sysv && !coherent && !xenix) return; xmlFSType = new Schemas.FileSystemType(); - if (xenix) + if(xenix) { byte[] xenix_strings = new byte[6]; XenixSuperBlock xnx_sb = new XenixSuperBlock(); sb_sector = imagePlugin.ReadSectors((ulong)start + partitionStart, sb_size_in_sectors); - + xnx_sb.s_isize = BigEndianBitConverter.ToUInt16(sb_sector, 0x000); xnx_sb.s_fsize = BigEndianBitConverter.ToUInt32(sb_sector, 0x002); xnx_sb.s_nfree = BigEndianBitConverter.ToUInt16(sb_sector, 0x006); @@ -296,7 +296,7 @@ namespace DiscImageChef.Plugins UInt32 bs = 512; sb.AppendLine("XENIX filesystem"); xmlFSType.Type = "XENIX fs"; - switch (xnx_sb.s_type) + switch(xnx_sb.s_type) { case 1: sb.AppendLine("512 bytes per block"); @@ -316,14 +316,14 @@ namespace DiscImageChef.Plugins sb.AppendFormat("Unknown s_type value: 0x{0:X8}", xnx_sb.s_type).AppendLine(); break; } - if (imagePlugin.GetSectorSize() == 2336 || imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448) + if(imagePlugin.GetSectorSize() == 2336 || imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448) { - if (bs != 2048) + if(bs != 2048) sb.AppendFormat("WARNING: Filesystem indicates {0} bytes/block while device indicates {1} bytes/sector", bs, 2048).AppendLine(); } else { - if (bs != imagePlugin.GetSectorSize()) + if(bs != imagePlugin.GetSectorSize()) sb.AppendFormat("WARNING: Filesystem indicates {0} bytes/block while device indicates {1} bytes/sector", bs, imagePlugin.GetSectorSize()).AppendLine(); } sb.AppendFormat("{0} zones on volume ({1} bytes)", xnx_sb.s_fsize, xnx_sb.s_fsize * bs).AppendLine(); @@ -334,16 +334,16 @@ namespace DiscImageChef.Plugins sb.AppendFormat("First data zone: {0}", xnx_sb.s_isize).AppendLine(); sb.AppendFormat("{0} free inodes on volume", xnx_sb.s_tinode).AppendLine(); sb.AppendFormat("{0} free inodes on list", xnx_sb.s_ninode).AppendLine(); - if (xnx_sb.s_flock > 0) + if(xnx_sb.s_flock > 0) sb.AppendLine("Free block list is locked"); - if (xnx_sb.s_ilock > 0) + if(xnx_sb.s_ilock > 0) sb.AppendLine("inode cache is locked"); - if (xnx_sb.s_fmod > 0) + if(xnx_sb.s_fmod > 0) sb.AppendLine("Superblock is being modified"); - if (xnx_sb.s_ronly > 0) + if(xnx_sb.s_ronly > 0) sb.AppendLine("Volume is mounted read-only"); sb.AppendFormat("Superblock last updated on {0}", DateHandlers.UNIXUnsignedToDateTime(xnx_sb.s_time)).AppendLine(); - if (xnx_sb.s_time != 0) + if(xnx_sb.s_time != 0) { xmlFSType.ModificationDate = DateHandlers.UNIXUnsignedToDateTime(xnx_sb.s_time); xmlFSType.ModificationDateSpecified = true; @@ -351,7 +351,7 @@ namespace DiscImageChef.Plugins sb.AppendFormat("Volume name: {0}", xnx_sb.s_fname).AppendLine(); xmlFSType.VolumeName = xnx_sb.s_fname; sb.AppendFormat("Pack name: {0}", xnx_sb.s_fpack).AppendLine(); - if (xnx_sb.s_clean == 0x46) + if(xnx_sb.s_clean == 0x46) sb.AppendLine("Volume is clean"); else { @@ -360,7 +360,7 @@ namespace DiscImageChef.Plugins } } - if (sysv) + if(sysv) { sb_sector = imagePlugin.ReadSectors((ulong)start + partitionStart, sb_size_in_sectors); UInt16 pad0, pad1, pad2; @@ -381,7 +381,7 @@ namespace DiscImageChef.Plugins sysv_sb.s_magic = BigEndianBitConverter.ToUInt32(sb_sector, 0x1F8); sysv_sb.s_type = BigEndianBitConverter.ToUInt32(sb_sector, 0x1FC); - if (sysvr4) + if(sysvr4) { sysv_sb.s_fsize = BigEndianBitConverter.ToUInt32(sb_sector, 0x004); sysv_sb.s_nfree = BigEndianBitConverter.ToUInt16(sb_sector, 0x008); @@ -425,7 +425,7 @@ namespace DiscImageChef.Plugins } UInt32 bs = 512; - if (sysvr4) + if(sysvr4) { sb.AppendLine("System V Release 4 filesystem"); xmlFSType.Type = "SVR4 fs"; @@ -435,7 +435,7 @@ namespace DiscImageChef.Plugins sb.AppendLine("System V Release 2 filesystem"); xmlFSType.Type = "SVR2 fs"; } - switch (sysv_sb.s_type) + switch(sysv_sb.s_type) { case 1: sb.AppendLine("512 bytes per block"); @@ -455,14 +455,14 @@ namespace DiscImageChef.Plugins sb.AppendFormat("Unknown s_type value: 0x{0:X8}", sysv_sb.s_type).AppendLine(); break; } - if (imagePlugin.GetSectorSize() == 2336 || imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448) + if(imagePlugin.GetSectorSize() == 2336 || imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448) { - if (bs != 2048) + if(bs != 2048) sb.AppendFormat("WARNING: Filesystem indicates {0} bytes/block while device indicates {1} bytes/sector", bs, 2048).AppendLine(); } else { - if (bs != imagePlugin.GetSectorSize()) + if(bs != imagePlugin.GetSectorSize()) sb.AppendFormat("WARNING: Filesystem indicates {0} bytes/block while device indicates {1} bytes/sector", bs, imagePlugin.GetSectorSize()).AppendLine(); } sb.AppendFormat("{0} zones on volume ({1} bytes)", sysv_sb.s_fsize, sysv_sb.s_fsize * bs).AppendLine(); @@ -473,16 +473,16 @@ namespace DiscImageChef.Plugins sb.AppendFormat("First data zone: {0}", sysv_sb.s_isize).AppendLine(); sb.AppendFormat("{0} free inodes on volume", sysv_sb.s_tinode).AppendLine(); sb.AppendFormat("{0} free inodes on list", sysv_sb.s_ninode).AppendLine(); - if (sysv_sb.s_flock > 0) + if(sysv_sb.s_flock > 0) sb.AppendLine("Free block list is locked"); - if (sysv_sb.s_ilock > 0) + if(sysv_sb.s_ilock > 0) sb.AppendLine("inode cache is locked"); - if (sysv_sb.s_fmod > 0) + if(sysv_sb.s_fmod > 0) sb.AppendLine("Superblock is being modified"); - if (sysv_sb.s_ronly > 0) + if(sysv_sb.s_ronly > 0) sb.AppendLine("Volume is mounted read-only"); sb.AppendFormat("Superblock last updated on {0}", DateHandlers.UNIXUnsignedToDateTime(sysv_sb.s_time)).AppendLine(); - if (sysv_sb.s_time != 0) + if(sysv_sb.s_time != 0) { xmlFSType.ModificationDate = DateHandlers.UNIXUnsignedToDateTime(sysv_sb.s_time); xmlFSType.ModificationDateSpecified = true; @@ -490,7 +490,7 @@ namespace DiscImageChef.Plugins sb.AppendFormat("Volume name: {0}", sysv_sb.s_fname).AppendLine(); xmlFSType.VolumeName = sysv_sb.s_fname; sb.AppendFormat("Pack name: {0}", sysv_sb.s_fpack).AppendLine(); - if (sysv_sb.s_state == (0x7C269D38 - sysv_sb.s_time)) + if(sysv_sb.s_state == (0x7C269D38 - sysv_sb.s_time)) sb.AppendLine("Volume is clean"); else { @@ -499,7 +499,7 @@ namespace DiscImageChef.Plugins } } - if (coherent) + if(coherent) { sb_sector = imagePlugin.ReadSectors((ulong)start + partitionStart, sb_size_in_sectors); CoherentSuperBlock coh_sb = new CoherentSuperBlock(); @@ -527,7 +527,7 @@ namespace DiscImageChef.Plugins xmlFSType.ClusterSize = 512; sb.AppendLine("Coherent UNIX filesystem"); - if (imagePlugin.GetSectorSize() != 512) + if(imagePlugin.GetSectorSize() != 512) sb.AppendFormat("WARNING: Filesystem indicates {0} bytes/block while device indicates {1} bytes/sector", 512, 2048).AppendLine(); sb.AppendFormat("{0} zones on volume ({1} bytes)", coh_sb.s_fsize, coh_sb.s_fsize * 512).AppendLine(); sb.AppendFormat("{0} free zones on volume ({1} bytes)", coh_sb.s_tfree, coh_sb.s_tfree * 512).AppendLine(); @@ -535,16 +535,16 @@ namespace DiscImageChef.Plugins sb.AppendFormat("First data zone: {0}", coh_sb.s_isize).AppendLine(); sb.AppendFormat("{0} free inodes on volume", coh_sb.s_tinode).AppendLine(); sb.AppendFormat("{0} free inodes on list", coh_sb.s_ninode).AppendLine(); - if (coh_sb.s_flock > 0) + if(coh_sb.s_flock > 0) sb.AppendLine("Free block list is locked"); - if (coh_sb.s_ilock > 0) + if(coh_sb.s_ilock > 0) sb.AppendLine("inode cache is locked"); - if (coh_sb.s_fmod > 0) + if(coh_sb.s_fmod > 0) sb.AppendLine("Superblock is being modified"); - if (coh_sb.s_ronly > 0) + if(coh_sb.s_ronly > 0) sb.AppendLine("Volume is mounted read-only"); sb.AppendFormat("Superblock last updated on {0}", DateHandlers.UNIXUnsignedToDateTime(coh_sb.s_time)).AppendLine(); - if (coh_sb.s_time != 0) + if(coh_sb.s_time != 0) { xmlFSType.ModificationDate = DateHandlers.UNIXUnsignedToDateTime(coh_sb.s_time); xmlFSType.ModificationDateSpecified = true; @@ -554,7 +554,7 @@ namespace DiscImageChef.Plugins sb.AppendFormat("Pack name: {0}", coh_sb.s_fpack).AppendLine(); } - if (sys7th) + if(sys7th) { sb_sector = imagePlugin.ReadSectors((ulong)start + partitionStart, sb_size_in_sectors); UNIX7thEditionSuperBlock v7_sb = new UNIX7thEditionSuperBlock(); @@ -581,7 +581,7 @@ namespace DiscImageChef.Plugins xmlFSType.Type = "UNIX 7th Edition fs"; xmlFSType.ClusterSize = 512; sb.AppendLine("UNIX 7th Edition filesystem"); - if (imagePlugin.GetSectorSize() != 512) + if(imagePlugin.GetSectorSize() != 512) sb.AppendFormat("WARNING: Filesystem indicates {0} bytes/block while device indicates {1} bytes/sector", 512, 2048).AppendLine(); sb.AppendFormat("{0} zones on volume ({1} bytes)", v7_sb.s_fsize, v7_sb.s_fsize * 512).AppendLine(); sb.AppendFormat("{0} free zones on volume ({1} bytes)", v7_sb.s_tfree, v7_sb.s_tfree * 512).AppendLine(); @@ -589,16 +589,16 @@ namespace DiscImageChef.Plugins sb.AppendFormat("First data zone: {0}", v7_sb.s_isize).AppendLine(); sb.AppendFormat("{0} free inodes on volume", v7_sb.s_tinode).AppendLine(); sb.AppendFormat("{0} free inodes on list", v7_sb.s_ninode).AppendLine(); - if (v7_sb.s_flock > 0) + if(v7_sb.s_flock > 0) sb.AppendLine("Free block list is locked"); - if (v7_sb.s_ilock > 0) + if(v7_sb.s_ilock > 0) sb.AppendLine("inode cache is locked"); - if (v7_sb.s_fmod > 0) + if(v7_sb.s_fmod > 0) sb.AppendLine("Superblock is being modified"); - if (v7_sb.s_ronly > 0) + if(v7_sb.s_ronly > 0) sb.AppendLine("Volume is mounted read-only"); sb.AppendFormat("Superblock last updated on {0}", DateHandlers.UNIXUnsignedToDateTime(v7_sb.s_time)).AppendLine(); - if (v7_sb.s_time != 0) + if(v7_sb.s_time != 0) { xmlFSType.ModificationDate = DateHandlers.UNIXUnsignedToDateTime(v7_sb.s_time); xmlFSType.ModificationDateSpecified = true; diff --git a/DiscImageChef.Filesystems/UNIXBFS.cs b/DiscImageChef.Filesystems/UNIXBFS.cs index 2614e6477..d5e763be9 100644 --- a/DiscImageChef.Filesystems/UNIXBFS.cs +++ b/DiscImageChef.Filesystems/UNIXBFS.cs @@ -58,7 +58,7 @@ namespace DiscImageChef.Plugins public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd) { - if ((2 + partitionStart) >= imagePlugin.GetSectors()) + if((2 + partitionStart) >= imagePlugin.GetSectors()) return false; UInt32 magic; @@ -71,7 +71,7 @@ namespace DiscImageChef.Plugins public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, out string information) { information = ""; - + StringBuilder sb = new StringBuilder(); byte[] bfs_sb_sector = imagePlugin.ReadSector(0 + partitionStart); byte[] sb_strings = new byte[6]; diff --git a/DiscImageChef.Filesystems/ext2FS.cs b/DiscImageChef.Filesystems/ext2FS.cs index 95797233a..569555302 100644 --- a/DiscImageChef.Filesystems/ext2FS.cs +++ b/DiscImageChef.Filesystems/ext2FS.cs @@ -53,14 +53,14 @@ namespace DiscImageChef.Plugins public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd) { - if ((2 + partitionStart) >= imagePlugin.GetSectors()) + if((2 + partitionStart) >= imagePlugin.GetSectors()) return false; byte[] sb_sector = imagePlugin.ReadSector(2 + partitionStart); UInt16 magic = BitConverter.ToUInt16(sb_sector, 0x038); - - if (magic == ext2FSMagic || magic == ext2OldFSMagic) + + if(magic == ext2FSMagic || magic == ext2OldFSMagic) return true; return false; } @@ -68,7 +68,7 @@ namespace DiscImageChef.Plugins public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, out string information) { information = ""; - + StringBuilder sb = new StringBuilder(); ext2FSSuperBlock supblk = new ext2FSSuperBlock(); @@ -82,12 +82,12 @@ namespace DiscImageChef.Plugins uint sb_size_in_sectors; - if (imagePlugin.GetSectorSize() < 1024) + if(imagePlugin.GetSectorSize() < 1024) sb_size_in_sectors = 1024 / imagePlugin.GetSectorSize(); else sb_size_in_sectors = 1; - if (sb_size_in_sectors == 0) + if(sb_size_in_sectors == 0) { information = "Error calculating size in sectors of ext2/3/4 superblocks"; return; @@ -227,16 +227,16 @@ namespace DiscImageChef.Plugins xmlFSType = new Schemas.FileSystemType(); - if (supblk.magic == ext2OldFSMagic) + if(supblk.magic == ext2OldFSMagic) { sb.AppendLine("ext2 (old) filesystem"); xmlFSType.Type = "ext2"; } - else if (supblk.magic == ext2FSMagic) + else if(supblk.magic == ext2FSMagic) { ext3 |= (supblk.ftr_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL) == EXT3_FEATURE_COMPAT_HAS_JOURNAL || (supblk.ftr_incompat & EXT3_FEATURE_INCOMPAT_RECOVER) == EXT3_FEATURE_INCOMPAT_RECOVER || (supblk.ftr_incompat & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) == EXT3_FEATURE_INCOMPAT_JOURNAL_DEV; - if ((supblk.ftr_ro_compat & EXT4_FEATURE_RO_COMPAT_HUGE_FILE) == EXT4_FEATURE_RO_COMPAT_HUGE_FILE || + if((supblk.ftr_ro_compat & EXT4_FEATURE_RO_COMPAT_HUGE_FILE) == EXT4_FEATURE_RO_COMPAT_HUGE_FILE || (supblk.ftr_ro_compat & EXT4_FEATURE_RO_COMPAT_GDT_CSUM) == EXT4_FEATURE_RO_COMPAT_GDT_CSUM || (supblk.ftr_ro_compat & EXT4_FEATURE_RO_COMPAT_DIR_NLINK) == EXT4_FEATURE_RO_COMPAT_DIR_NLINK || (supblk.ftr_ro_compat & EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE) == EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE || @@ -252,17 +252,17 @@ namespace DiscImageChef.Plugins new_ext2 |= !ext3 && !ext4; - if (new_ext2) + if(new_ext2) { sb.AppendLine("ext2 filesystem"); xmlFSType.Type = "ext2"; } - if (ext3) + if(ext3) { sb.AppendLine("ext3 filesystem"); xmlFSType.Type = "ext3"; } - if (ext4) + if(ext4) { sb.AppendLine("ext4 filesystem"); xmlFSType.Type = "ext4"; @@ -275,7 +275,7 @@ namespace DiscImageChef.Plugins } string ext_os; - switch (supblk.creator_os) + switch(supblk.creator_os) { case EXT2_OS_FREEBSD: ext_os = "FreeBSD"; @@ -297,7 +297,7 @@ namespace DiscImageChef.Plugins break; } - if (supblk.mkfs_t > 0) + if(supblk.mkfs_t > 0) { sb.AppendFormat("Volume was created on {0} for {1}", DateHandlers.UNIXUnsignedToDateTime(supblk.mkfs_t), ext_os).AppendLine(); xmlFSType.CreationDate = DateHandlers.UNIXUnsignedToDateTime(supblk.mkfs_t); @@ -310,7 +310,7 @@ namespace DiscImageChef.Plugins byte[] temp_bytes = new byte[8]; UInt64 blocks, reserved, free; - if ((supblk.ftr_incompat & EXT4_FEATURE_INCOMPAT_64BIT) == EXT4_FEATURE_INCOMPAT_64BIT) + if((supblk.ftr_incompat & EXT4_FEATURE_INCOMPAT_64BIT) == EXT4_FEATURE_INCOMPAT_64BIT) { temp_lo = BitConverter.GetBytes(supblk.blocks); temp_hi = BitConverter.GetBytes(supblk.blocks_hi); @@ -355,50 +355,50 @@ namespace DiscImageChef.Plugins free = supblk.free_blocks; } - if (supblk.block_size == 0) // Then it is 1024 bytes + if(supblk.block_size == 0) // Then it is 1024 bytes supblk.block_size = 1024; - sb.AppendFormat("Volume has {0} blocks of {1} bytes, for a total of {2} bytes", blocks, 1024<<(int)supblk.block_size, blocks * (ulong)(1024<<(int)supblk.block_size)).AppendLine(); + sb.AppendFormat("Volume has {0} blocks of {1} bytes, for a total of {2} bytes", blocks, 1024 << (int)supblk.block_size, blocks * (ulong)(1024 << (int)supblk.block_size)).AppendLine(); xmlFSType.Clusters = (long)blocks; xmlFSType.ClusterSize = 1024 << (int)supblk.block_size; - if (supblk.mount_t > 0 || supblk.mount_c > 0) + if(supblk.mount_t > 0 || supblk.mount_c > 0) { - if (supblk.mount_t > 0) + if(supblk.mount_t > 0) sb.AppendFormat("Last mounted on {0}", DateHandlers.UNIXUnsignedToDateTime(supblk.mount_t)).AppendLine(); - if (supblk.max_mount_c != -1) + if(supblk.max_mount_c != -1) sb.AppendFormat("Volume has been mounted {0} times of a maximum of {1} mounts before checking", supblk.mount_c, supblk.max_mount_c).AppendLine(); else sb.AppendFormat("Volume has been mounted {0} times with no maximum no. of mounts before checking", supblk.mount_c).AppendLine(); - if (supblk.last_mount_dir != "") + if(supblk.last_mount_dir != "") sb.AppendFormat("Last mounted on: \"{0}\"", supblk.last_mount_dir).AppendLine(); - if (supblk.mount_options != "") + if(supblk.mount_options != "") sb.AppendFormat("Last used mount options were: {0}", supblk.mount_options).AppendLine(); } else { sb.AppendLine("Volume has never been mounted"); - if (supblk.max_mount_c != -1) + if(supblk.max_mount_c != -1) sb.AppendFormat("Volume can be mounted {0} times before checking", supblk.max_mount_c).AppendLine(); else sb.AppendLine("Volume has no maximum no. of mounts before checking"); } - if (supblk.check_t > 0) + if(supblk.check_t > 0) { - if (supblk.check_inv > 0) + if(supblk.check_inv > 0) sb.AppendFormat("Last checked on {0} (should check every {1} seconds)", DateHandlers.UNIXUnsignedToDateTime(supblk.check_t), supblk.check_inv).AppendLine(); else sb.AppendFormat("Last checked on {0}", DateHandlers.UNIXUnsignedToDateTime(supblk.check_t)).AppendLine(); } else { - if (supblk.check_inv > 0) + if(supblk.check_inv > 0) sb.AppendFormat("Volume has never been checked (should check every {0})", supblk.check_inv).AppendLine(); else sb.AppendLine("Volume has never been checked"); } - if (supblk.write_t > 0) + if(supblk.write_t > 0) { sb.AppendFormat("Last written on {0}", DateHandlers.UNIXUnsignedToDateTime(supblk.write_t)).AppendLine(); xmlFSType.ModificationDate = DateHandlers.UNIXUnsignedToDateTime(supblk.write_t); @@ -408,7 +408,7 @@ namespace DiscImageChef.Plugins sb.AppendLine("Volume has never been written"); xmlFSType.Dirty = true; - switch (supblk.state) + switch(supblk.state) { case EXT2_VALID_FS: sb.AppendLine("Volume is clean"); @@ -425,10 +425,10 @@ namespace DiscImageChef.Plugins break; } - if (supblk.volume_name != "") + if(supblk.volume_name != "") sb.AppendFormat("Volume name: \"{0}\"", supblk.volume_name).AppendLine(); - switch (supblk.err_behaviour) + switch(supblk.err_behaviour) { case EXT2_ERRORS_CONTINUE: sb.AppendLine("On errors, filesystem should continue"); @@ -444,72 +444,72 @@ namespace DiscImageChef.Plugins break; } - if (supblk.revision > 0) + if(supblk.revision > 0) sb.AppendFormat("Filesystem revision: {0}.{1}", supblk.revision, supblk.minor_revision).AppendLine(); - if (supblk.uuid != Guid.Empty) + if(supblk.uuid != Guid.Empty) { sb.AppendFormat("Volume UUID: {0}", supblk.uuid).AppendLine(); xmlFSType.VolumeSerial = supblk.uuid.ToString(); } - if (supblk.kbytes_written > 0) + if(supblk.kbytes_written > 0) sb.AppendFormat("{0} KiB has been written on volume", supblk.kbytes_written).AppendLine(); sb.AppendFormat("{0} reserved and {1} free blocks", reserved, free).AppendLine(); xmlFSType.FreeClusters = (long)free; xmlFSType.FreeClustersSpecified = true; sb.AppendFormat("{0} inodes with {1} free inodes ({2}%)", supblk.inodes, supblk.free_inodes, supblk.free_inodes * 100 / supblk.inodes).AppendLine(); - if (supblk.first_inode > 0) + if(supblk.first_inode > 0) sb.AppendFormat("First inode is {0}", supblk.first_inode).AppendLine(); - if (supblk.frag_size > 0) + if(supblk.frag_size > 0) sb.AppendFormat("{0} bytes per fragment", supblk.frag_size).AppendLine(); - if (supblk.blocks_per_grp > 0 && supblk.flags_per_grp > 0 && supblk.inodes_per_grp > 0) + if(supblk.blocks_per_grp > 0 && supblk.flags_per_grp > 0 && supblk.inodes_per_grp > 0) sb.AppendFormat("{0} blocks, {1} flags and {2} inodes per group", supblk.blocks_per_grp, supblk.flags_per_grp, supblk.inodes_per_grp).AppendLine(); - if (supblk.first_block > 0) + if(supblk.first_block > 0) sb.AppendFormat("{0} is first data block", supblk.first_block).AppendLine(); sb.AppendFormat("Default UID: {0}, GID: {1}", supblk.default_uid, supblk.default_gid).AppendLine(); - if (supblk.block_group_no > 0) + if(supblk.block_group_no > 0) sb.AppendFormat("Block group number is {0}", supblk.block_group_no).AppendLine(); - if (supblk.desc_grp_size > 0) + if(supblk.desc_grp_size > 0) sb.AppendFormat("Group descriptor size is {0} bytes", supblk.desc_grp_size).AppendLine(); - if (supblk.first_meta_bg > 0) + if(supblk.first_meta_bg > 0) sb.AppendFormat("First metablock group is {0}", supblk.first_meta_bg).AppendLine(); - if (supblk.raid_stride > 0) + if(supblk.raid_stride > 0) sb.AppendFormat("RAID stride: {0}", supblk.raid_stride).AppendLine(); - if (supblk.raid_stripe_width > 0) + if(supblk.raid_stripe_width > 0) sb.AppendFormat("{0} blocks on all data disks", supblk.raid_stripe_width).AppendLine(); - if (supblk.mmp_interval > 0 && supblk.mmp_block > 0) + if(supblk.mmp_interval > 0 && supblk.mmp_block > 0) sb.AppendFormat("{0} seconds for multi-mount protection wait, on block {1}", supblk.mmp_interval, supblk.mmp_block).AppendLine(); - if (supblk.flex_bg_grp_size > 0) + if(supblk.flex_bg_grp_size > 0) sb.AppendFormat("{0} Flexible block group size", supblk.flex_bg_grp_size).AppendLine(); - if (supblk.hash_seed_1 > 0 && supblk.hash_seed_2 > 0 && supblk.hash_seed_3 > 0 && supblk.hash_seed_4 > 0) + if(supblk.hash_seed_1 > 0 && supblk.hash_seed_2 > 0 && supblk.hash_seed_3 > 0 && supblk.hash_seed_4 > 0) sb.AppendFormat("Hash seed: {0:X8}{1:X8}{2:X8}{3:X8}, version {4}", supblk.hash_seed_1, supblk.hash_seed_2, supblk.hash_seed_3, supblk.hash_seed_4, supblk.hash_version).AppendLine(); - if ((supblk.ftr_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL) == EXT3_FEATURE_COMPAT_HAS_JOURNAL || + if((supblk.ftr_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL) == EXT3_FEATURE_COMPAT_HAS_JOURNAL || (supblk.ftr_incompat & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) == EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) { sb.AppendLine("Volume is journaled"); - if (supblk.journal_uuid != Guid.Empty) + if(supblk.journal_uuid != Guid.Empty) sb.AppendFormat("Journal UUID: {0}", supblk.journal_uuid).AppendLine(); sb.AppendFormat("Journal has inode {0}", supblk.journal_inode).AppendLine(); - if ((supblk.ftr_compat & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) == EXT3_FEATURE_INCOMPAT_JOURNAL_DEV && supblk.journal_dev > 0) + if((supblk.ftr_compat & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) == EXT3_FEATURE_INCOMPAT_JOURNAL_DEV && supblk.journal_dev > 0) sb.AppendFormat("Journal is on device {0}", supblk.journal_dev).AppendLine(); - if (supblk.jnl_backup_type > 0) + if(supblk.jnl_backup_type > 0) sb.AppendFormat("Journal backup type: {0}", supblk.jnl_backup_type).AppendLine(); - if (supblk.last_orphan > 0) + if(supblk.last_orphan > 0) sb.AppendFormat("Last orphaned inode is {0}", supblk.last_orphan).AppendLine(); else sb.AppendLine("There are no orphaned inodes"); } - if (ext4) + if(ext4) { - if (supblk.snapshot_id > 0) + if(supblk.snapshot_id > 0) sb.AppendFormat("Active snapshot has ID {0}, on inode {1}, with {2} blocks reserved, list starting on block {3}", supblk.snapshot_id, supblk.snapshot_inum, supblk.snapshot_blocks, supblk.snapshot_list).AppendLine(); - if (supblk.error_count > 0) + if(supblk.error_count > 0) { sb.AppendFormat("{0} errors registered", supblk.error_count).AppendLine(); sb.AppendFormat("First error occurred on {0}, last on {1}", DateHandlers.UNIXUnsignedToDateTime(supblk.first_error_t), DateHandlers.UNIXUnsignedToDateTime(supblk.last_error_t)).AppendLine(); @@ -520,101 +520,101 @@ namespace DiscImageChef.Plugins } sb.AppendFormat("Flags…:").AppendLine(); - if ((supblk.flags & EXT2_FLAGS_SIGNED_HASH) == EXT2_FLAGS_SIGNED_HASH) + if((supblk.flags & EXT2_FLAGS_SIGNED_HASH) == EXT2_FLAGS_SIGNED_HASH) sb.AppendLine("Signed directory hash is in use"); - if ((supblk.flags & EXT2_FLAGS_UNSIGNED_HASH) == EXT2_FLAGS_UNSIGNED_HASH) + if((supblk.flags & EXT2_FLAGS_UNSIGNED_HASH) == EXT2_FLAGS_UNSIGNED_HASH) sb.AppendLine("Unsigned directory hash is in use"); - if ((supblk.flags & EXT2_FLAGS_TEST_FILESYS) == EXT2_FLAGS_TEST_FILESYS) + if((supblk.flags & EXT2_FLAGS_TEST_FILESYS) == EXT2_FLAGS_TEST_FILESYS) sb.AppendLine("Volume is testing development code"); - if ((supblk.flags & 0xFFFFFFF8) != 0) + if((supblk.flags & 0xFFFFFFF8) != 0) sb.AppendFormat("Unknown set flags: {0:X8}", supblk.flags); sb.AppendLine(); sb.AppendFormat("Default mount options…:").AppendLine(); - if ((supblk.default_mnt_opts & EXT2_DEFM_DEBUG) == EXT2_DEFM_DEBUG) + if((supblk.default_mnt_opts & EXT2_DEFM_DEBUG) == EXT2_DEFM_DEBUG) sb.AppendLine("(debug): Enable debugging code"); - if ((supblk.default_mnt_opts & EXT2_DEFM_BSDGROUPS) == EXT2_DEFM_BSDGROUPS) + if((supblk.default_mnt_opts & EXT2_DEFM_BSDGROUPS) == EXT2_DEFM_BSDGROUPS) sb.AppendLine("(bsdgroups): Emulate BSD behaviour when creating new files"); - if ((supblk.default_mnt_opts & EXT2_DEFM_XATTR_USER) == EXT2_DEFM_XATTR_USER) + if((supblk.default_mnt_opts & EXT2_DEFM_XATTR_USER) == EXT2_DEFM_XATTR_USER) sb.AppendLine("(user_xattr): Enable user-specified extended attributes"); - if ((supblk.default_mnt_opts & EXT2_DEFM_ACL) == EXT2_DEFM_ACL) + if((supblk.default_mnt_opts & EXT2_DEFM_ACL) == EXT2_DEFM_ACL) sb.AppendLine("(acl): Enable POSIX ACLs"); - if ((supblk.default_mnt_opts & EXT2_DEFM_UID16) == EXT2_DEFM_UID16) + if((supblk.default_mnt_opts & EXT2_DEFM_UID16) == EXT2_DEFM_UID16) sb.AppendLine("(uid16): Disable 32bit UIDs and GIDs"); - if ((supblk.default_mnt_opts & EXT3_DEFM_JMODE_DATA) == EXT3_DEFM_JMODE_DATA) + if((supblk.default_mnt_opts & EXT3_DEFM_JMODE_DATA) == EXT3_DEFM_JMODE_DATA) sb.AppendLine("(journal_data): Journal data and metadata"); - if ((supblk.default_mnt_opts & EXT3_DEFM_JMODE_ORDERED) == EXT3_DEFM_JMODE_ORDERED) + if((supblk.default_mnt_opts & EXT3_DEFM_JMODE_ORDERED) == EXT3_DEFM_JMODE_ORDERED) sb.AppendLine("(journal_data_ordered): Write data before journaling metadata"); - if ((supblk.default_mnt_opts & EXT3_DEFM_JMODE_WBACK) == EXT3_DEFM_JMODE_WBACK) + if((supblk.default_mnt_opts & EXT3_DEFM_JMODE_WBACK) == EXT3_DEFM_JMODE_WBACK) sb.AppendLine("(journal_data_writeback): Write journal before data"); - if ((supblk.default_mnt_opts & 0xFFFFFE20) != 0) + if((supblk.default_mnt_opts & 0xFFFFFE20) != 0) sb.AppendFormat("Unknown set default mount options: {0:X8}", supblk.default_mnt_opts); sb.AppendLine(); sb.AppendFormat("Compatible features…:").AppendLine(); - if ((supblk.ftr_compat & EXT2_FEATURE_COMPAT_DIR_PREALLOC) == EXT2_FEATURE_COMPAT_DIR_PREALLOC) + if((supblk.ftr_compat & EXT2_FEATURE_COMPAT_DIR_PREALLOC) == EXT2_FEATURE_COMPAT_DIR_PREALLOC) sb.AppendLine("Pre-allocate directories"); - if ((supblk.ftr_compat & EXT2_FEATURE_COMPAT_IMAGIC_INODES) == EXT2_FEATURE_COMPAT_IMAGIC_INODES) + if((supblk.ftr_compat & EXT2_FEATURE_COMPAT_IMAGIC_INODES) == EXT2_FEATURE_COMPAT_IMAGIC_INODES) sb.AppendLine("imagic inodes ?"); - if ((supblk.ftr_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL) == EXT3_FEATURE_COMPAT_HAS_JOURNAL) + if((supblk.ftr_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL) == EXT3_FEATURE_COMPAT_HAS_JOURNAL) sb.AppendLine("Has journal (ext3)"); - if ((supblk.ftr_compat & EXT2_FEATURE_COMPAT_EXT_ATTR) == EXT2_FEATURE_COMPAT_EXT_ATTR) + if((supblk.ftr_compat & EXT2_FEATURE_COMPAT_EXT_ATTR) == EXT2_FEATURE_COMPAT_EXT_ATTR) sb.AppendLine("Has extended attribute blocks"); - if ((supblk.ftr_compat & EXT2_FEATURE_COMPAT_RESIZE_INO) == EXT2_FEATURE_COMPAT_RESIZE_INO) + if((supblk.ftr_compat & EXT2_FEATURE_COMPAT_RESIZE_INO) == EXT2_FEATURE_COMPAT_RESIZE_INO) sb.AppendLine("Has online filesystem resize reservations"); - if ((supblk.ftr_compat & EXT2_FEATURE_COMPAT_DIR_INDEX) == EXT2_FEATURE_COMPAT_DIR_INDEX) + if((supblk.ftr_compat & EXT2_FEATURE_COMPAT_DIR_INDEX) == EXT2_FEATURE_COMPAT_DIR_INDEX) sb.AppendLine("Can use hashed indexes on directories"); - if ((supblk.ftr_compat & 0xFFFFFFC0) != 0) + if((supblk.ftr_compat & 0xFFFFFFC0) != 0) sb.AppendFormat("Unknown compatible features: {0:X8}", supblk.ftr_compat); sb.AppendLine(); sb.AppendFormat("Compatible features if read-only…:").AppendLine(); - if ((supblk.ftr_ro_compat & EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER) == EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER) + if((supblk.ftr_ro_compat & EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER) == EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER) sb.AppendLine("Reduced number of superblocks"); - if ((supblk.ftr_ro_compat & EXT2_FEATURE_RO_COMPAT_LARGE_FILE) == EXT2_FEATURE_RO_COMPAT_LARGE_FILE) + if((supblk.ftr_ro_compat & EXT2_FEATURE_RO_COMPAT_LARGE_FILE) == EXT2_FEATURE_RO_COMPAT_LARGE_FILE) sb.AppendLine("Can have files bigger than 2GiB"); - if ((supblk.ftr_ro_compat & EXT2_FEATURE_RO_COMPAT_BTREE_DIR) == EXT2_FEATURE_RO_COMPAT_BTREE_DIR) + if((supblk.ftr_ro_compat & EXT2_FEATURE_RO_COMPAT_BTREE_DIR) == EXT2_FEATURE_RO_COMPAT_BTREE_DIR) sb.AppendLine("Uses B-Tree for directories"); - if ((supblk.ftr_ro_compat & EXT4_FEATURE_RO_COMPAT_HUGE_FILE) == EXT4_FEATURE_RO_COMPAT_HUGE_FILE) + if((supblk.ftr_ro_compat & EXT4_FEATURE_RO_COMPAT_HUGE_FILE) == EXT4_FEATURE_RO_COMPAT_HUGE_FILE) sb.AppendLine("Can have files bigger than 2TiB (ext4)"); - if ((supblk.ftr_ro_compat & EXT4_FEATURE_RO_COMPAT_GDT_CSUM) == EXT4_FEATURE_RO_COMPAT_GDT_CSUM) + if((supblk.ftr_ro_compat & EXT4_FEATURE_RO_COMPAT_GDT_CSUM) == EXT4_FEATURE_RO_COMPAT_GDT_CSUM) sb.AppendLine("Group descriptor checksums and sparse inode table (ext4)"); - if ((supblk.ftr_ro_compat & EXT4_FEATURE_RO_COMPAT_DIR_NLINK) == EXT4_FEATURE_RO_COMPAT_DIR_NLINK) + if((supblk.ftr_ro_compat & EXT4_FEATURE_RO_COMPAT_DIR_NLINK) == EXT4_FEATURE_RO_COMPAT_DIR_NLINK) sb.AppendLine("More than 32000 directory entries (ext4)"); - if ((supblk.ftr_ro_compat & EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE) == EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE) + if((supblk.ftr_ro_compat & EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE) == EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE) sb.AppendLine("Supports nanosecond timestamps and creation time (ext4)"); - if ((supblk.ftr_ro_compat & 0xFFFFFF80) != 0) + if((supblk.ftr_ro_compat & 0xFFFFFF80) != 0) sb.AppendFormat("Unknown read-only compatible features: {0:X8}", supblk.ftr_ro_compat); sb.AppendLine(); sb.AppendFormat("Incompatible features…:").AppendLine(); - if ((supblk.ftr_incompat & EXT2_FEATURE_INCOMPAT_COMPRESSION) == EXT2_FEATURE_INCOMPAT_COMPRESSION) + if((supblk.ftr_incompat & EXT2_FEATURE_INCOMPAT_COMPRESSION) == EXT2_FEATURE_INCOMPAT_COMPRESSION) sb.AppendLine("Uses compression"); - if ((supblk.ftr_incompat & EXT2_FEATURE_INCOMPAT_FILETYPE) == EXT2_FEATURE_INCOMPAT_FILETYPE) + if((supblk.ftr_incompat & EXT2_FEATURE_INCOMPAT_FILETYPE) == EXT2_FEATURE_INCOMPAT_FILETYPE) sb.AppendLine("Filetype in directory entries"); - if ((supblk.ftr_incompat & EXT3_FEATURE_INCOMPAT_RECOVER) == EXT3_FEATURE_INCOMPAT_RECOVER) + if((supblk.ftr_incompat & EXT3_FEATURE_INCOMPAT_RECOVER) == EXT3_FEATURE_INCOMPAT_RECOVER) sb.AppendLine("Journal needs recovery (ext3)"); - if ((supblk.ftr_incompat & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) == EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) + if((supblk.ftr_incompat & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) == EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) sb.AppendLine("Has journal on another device (ext3)"); - if ((supblk.ftr_incompat & EXT2_FEATURE_INCOMPAT_META_BG) == EXT2_FEATURE_INCOMPAT_META_BG) + if((supblk.ftr_incompat & EXT2_FEATURE_INCOMPAT_META_BG) == EXT2_FEATURE_INCOMPAT_META_BG) sb.AppendLine("Reduced block group backups"); - if ((supblk.ftr_incompat & EXT4_FEATURE_INCOMPAT_EXTENTS) == EXT4_FEATURE_INCOMPAT_EXTENTS) + if((supblk.ftr_incompat & EXT4_FEATURE_INCOMPAT_EXTENTS) == EXT4_FEATURE_INCOMPAT_EXTENTS) sb.AppendLine("Volume use extents (ext4)"); - if ((supblk.ftr_incompat & EXT4_FEATURE_INCOMPAT_64BIT) == EXT4_FEATURE_INCOMPAT_64BIT) + if((supblk.ftr_incompat & EXT4_FEATURE_INCOMPAT_64BIT) == EXT4_FEATURE_INCOMPAT_64BIT) sb.AppendLine("Supports volumes bigger than 2^32 blocks (ext4)"); - if ((supblk.ftr_incompat & EXT4_FEATURE_INCOMPAT_MMP) == EXT4_FEATURE_INCOMPAT_MMP) + if((supblk.ftr_incompat & EXT4_FEATURE_INCOMPAT_MMP) == EXT4_FEATURE_INCOMPAT_MMP) sb.AppendLine("Multi-mount protection (ext4)"); - if ((supblk.ftr_incompat & EXT4_FEATURE_INCOMPAT_FLEX_BG) == EXT4_FEATURE_INCOMPAT_FLEX_BG) + if((supblk.ftr_incompat & EXT4_FEATURE_INCOMPAT_FLEX_BG) == EXT4_FEATURE_INCOMPAT_FLEX_BG) sb.AppendLine("Flexible block group metadata location (ext4)"); - if ((supblk.ftr_incompat & EXT4_FEATURE_INCOMPAT_EA_INODE) == EXT4_FEATURE_INCOMPAT_EA_INODE) + if((supblk.ftr_incompat & EXT4_FEATURE_INCOMPAT_EA_INODE) == EXT4_FEATURE_INCOMPAT_EA_INODE) sb.AppendLine("Extended attributes can reside in inode (ext4)"); - if ((supblk.ftr_incompat & EXT4_FEATURE_INCOMPAT_DIRDATA) == EXT4_FEATURE_INCOMPAT_DIRDATA) + if((supblk.ftr_incompat & EXT4_FEATURE_INCOMPAT_DIRDATA) == EXT4_FEATURE_INCOMPAT_DIRDATA) sb.AppendLine("Data can reside in directory entry (ext4)"); - if ((supblk.ftr_incompat & 0xFFFFF020) != 0) + if((supblk.ftr_incompat & 0xFFFFF020) != 0) sb.AppendFormat("Unknown incompatible features: {0:X8}", supblk.ftr_incompat); information = sb.ToString(); diff --git a/DiscImageChef.Filesystems/extFS.cs b/DiscImageChef.Filesystems/extFS.cs index 5998b0897..deef46ab3 100644 --- a/DiscImageChef.Filesystems/extFS.cs +++ b/DiscImageChef.Filesystems/extFS.cs @@ -53,20 +53,20 @@ namespace DiscImageChef.Plugins public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd) { - if ((2 + partitionStart) >= imagePlugin.GetSectors()) + if((2 + partitionStart) >= imagePlugin.GetSectors()) return false; byte[] sb_sector = imagePlugin.ReadSector(2 + partitionStart); // Superblock resides at 0x400 UInt16 magic = BitConverter.ToUInt16(sb_sector, 0x038); // Here should reside magic number - + return magic == extFSMagic; } public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, out string information) { information = ""; - + StringBuilder sb = new StringBuilder(); byte[] sb_sector = imagePlugin.ReadSector(2 + partitionStart); // Superblock resides at 0x400 diff --git a/DiscImageChef.Helpers/ArrayFill.cs b/DiscImageChef.Helpers/ArrayFill.cs index 9798aee1f..4e3193008 100644 --- a/DiscImageChef.Helpers/ArrayFill.cs +++ b/DiscImageChef.Helpers/ArrayFill.cs @@ -42,12 +42,12 @@ namespace DiscImageChef public static void ArrayFill(T[] destinationArray, T[] value) { - if (destinationArray == null) + if(destinationArray == null) { throw new ArgumentNullException("destinationArray"); } - if (value.Length > destinationArray.Length) + if(value.Length > destinationArray.Length) { throw new ArgumentException("Length of value array must not be more than length of destination"); } diff --git a/DiscImageChef.Helpers/ArrayIsEmpty.cs b/DiscImageChef.Helpers/ArrayIsEmpty.cs index 35ee8f868..d81457a3b 100644 --- a/DiscImageChef.Helpers/ArrayIsEmpty.cs +++ b/DiscImageChef.Helpers/ArrayIsEmpty.cs @@ -43,11 +43,11 @@ namespace DiscImageChef { public static bool ArrayIsNullOrWhiteSpace(byte[] array) { - if (array == null) + if(array == null) return true; - foreach (byte b in array) - if (b != 0x00 && b != 0x20) + foreach(byte b in array) + if(b != 0x00 && b != 0x20) return false; return true; @@ -55,11 +55,11 @@ namespace DiscImageChef public static bool ArrayIsNullOrEmpty(byte[] array) { - if (array == null) + if(array == null) return true; - foreach (byte b in array) - if (b != 0x00) + foreach(byte b in array) + if(b != 0x00) return false; return true; diff --git a/DiscImageChef.Helpers/BigEndianBitConverter.cs b/DiscImageChef.Helpers/BigEndianBitConverter.cs index 171848d98..5bc6f799f 100644 --- a/DiscImageChef.Helpers/BigEndianBitConverter.cs +++ b/DiscImageChef.Helpers/BigEndianBitConverter.cs @@ -649,7 +649,7 @@ namespace DiscImageChef public static Guid ToGuid(byte[] value, int startIndex) { return new Guid(BigEndianBitConverter.ToUInt32(value, 0 + startIndex), - BigEndianBitConverter.ToUInt16(value, 4 + startIndex), + BigEndianBitConverter.ToUInt16(value, 4 + startIndex), BigEndianBitConverter.ToUInt16(value, 6 + startIndex), value[8 + startIndex + 0], value[8 + startIndex + 1], value[8 + startIndex + 2], value[8 + startIndex + 3], diff --git a/DiscImageChef.Helpers/DateHandlers.cs b/DiscImageChef.Helpers/DateHandlers.cs index 72802a5de..c39be0a32 100644 --- a/DiscImageChef.Helpers/DateHandlers.cs +++ b/DiscImageChef.Helpers/DateHandlers.cs @@ -75,61 +75,61 @@ namespace DiscImageChef int year, month, day, hour, minute, second, hundredths; byte[] twocharvalue = new byte[2]; byte[] fourcharvalue = new byte[4]; - + fourcharvalue[0] = VDDateTime[0]; fourcharvalue[1] = VDDateTime[1]; fourcharvalue[2] = VDDateTime[2]; fourcharvalue[3] = VDDateTime[3]; DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "year = \"{0}\"", StringHandlers.CToString(fourcharvalue)); - if (!Int32.TryParse(StringHandlers.CToString(fourcharvalue), out year)) + if(!Int32.TryParse(StringHandlers.CToString(fourcharvalue), out year)) year = 0; -// year = Convert.ToInt32(StringHandlers.CToString(fourcharvalue)); - + // year = Convert.ToInt32(StringHandlers.CToString(fourcharvalue)); + twocharvalue[0] = VDDateTime[4]; twocharvalue[1] = VDDateTime[5]; DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "month = \"{0}\"", StringHandlers.CToString(twocharvalue)); - if (!Int32.TryParse(StringHandlers.CToString(twocharvalue), out month)) + if(!Int32.TryParse(StringHandlers.CToString(twocharvalue), out month)) month = 0; -// month = Convert.ToInt32(StringHandlers.CToString(twocharvalue)); - + // month = Convert.ToInt32(StringHandlers.CToString(twocharvalue)); + twocharvalue[0] = VDDateTime[6]; twocharvalue[1] = VDDateTime[7]; DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "day = \"{0}\"", StringHandlers.CToString(twocharvalue)); - if (!Int32.TryParse(StringHandlers.CToString(twocharvalue), out day)) + if(!Int32.TryParse(StringHandlers.CToString(twocharvalue), out day)) day = 0; -// day = Convert.ToInt32(StringHandlers.CToString(twocharvalue)); - + // day = Convert.ToInt32(StringHandlers.CToString(twocharvalue)); + twocharvalue[0] = VDDateTime[8]; twocharvalue[1] = VDDateTime[9]; DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "hour = \"{0}\"", StringHandlers.CToString(twocharvalue)); - if (!Int32.TryParse(StringHandlers.CToString(twocharvalue), out hour)) + if(!Int32.TryParse(StringHandlers.CToString(twocharvalue), out hour)) hour = 0; -// hour = Convert.ToInt32(StringHandlers.CToString(twocharvalue)); - + // hour = Convert.ToInt32(StringHandlers.CToString(twocharvalue)); + twocharvalue[0] = VDDateTime[10]; twocharvalue[1] = VDDateTime[11]; DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "minute = \"{0}\"", StringHandlers.CToString(twocharvalue)); - if (!Int32.TryParse(StringHandlers.CToString(twocharvalue), out minute)) + if(!Int32.TryParse(StringHandlers.CToString(twocharvalue), out minute)) minute = 0; -// minute = Convert.ToInt32(StringHandlers.CToString(twocharvalue)); - + // minute = Convert.ToInt32(StringHandlers.CToString(twocharvalue)); + twocharvalue[0] = VDDateTime[12]; twocharvalue[1] = VDDateTime[13]; DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "second = \"{0}\"", StringHandlers.CToString(twocharvalue)); - if (!Int32.TryParse(StringHandlers.CToString(twocharvalue), out second)) + if(!Int32.TryParse(StringHandlers.CToString(twocharvalue), out second)) second = 0; -// second = Convert.ToInt32(StringHandlers.CToString(twocharvalue)); - + // second = Convert.ToInt32(StringHandlers.CToString(twocharvalue)); + twocharvalue[0] = VDDateTime[14]; twocharvalue[1] = VDDateTime[15]; DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "hundredths = \"{0}\"", StringHandlers.CToString(twocharvalue)); - if (!Int32.TryParse(StringHandlers.CToString(twocharvalue), out hundredths)) + if(!Int32.TryParse(StringHandlers.CToString(twocharvalue), out hundredths)) hundredths = 0; -// hundredths = Convert.ToInt32(StringHandlers.CToString(twocharvalue)); + // hundredths = Convert.ToInt32(StringHandlers.CToString(twocharvalue)); DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "decodedDT = new DateTime({0}, {1}, {2}, {3}, {4}, {5}, {6}, DateTimeKind.Unspecified);", year, month, day, hour, minute, second, hundredths * 10); DateTime decodedDT = new DateTime(year, month, day, hour, minute, second, hundredths * 10, DateTimeKind.Unspecified); - + return decodedDT; } diff --git a/DiscImageChef.Helpers/EndianAwareBinaryReader.cs b/DiscImageChef.Helpers/EndianAwareBinaryReader.cs index dce8b6be8..4b5288572 100644 --- a/DiscImageChef.Helpers/EndianAwareBinaryReader.cs +++ b/DiscImageChef.Helpers/EndianAwareBinaryReader.cs @@ -48,13 +48,13 @@ namespace DiscImageChef byte[] buffer = new byte[8]; public EndianAwareBinaryReader(Stream input, Encoding encoding, bool isLittleEndian) - : base(input, encoding) + : base(input, encoding) { IsLittleEndian = isLittleEndian; } public EndianAwareBinaryReader(Stream input, bool isLittleEndian) - : this(input, Encoding.UTF8, isLittleEndian) + : this(input, Encoding.UTF8, isLittleEndian) { } @@ -66,7 +66,7 @@ namespace DiscImageChef public override double ReadDouble() { - if (IsLittleEndian) + if(IsLittleEndian) return base.ReadDouble(); FillMyBuffer(8); return BitConverter.ToDouble(buffer.Take(8).Reverse().ToArray(), 0); @@ -74,34 +74,34 @@ namespace DiscImageChef public override short ReadInt16() { - if (IsLittleEndian) + if(IsLittleEndian) return base.ReadInt16(); FillMyBuffer(2); return BitConverter.ToInt16(buffer.Take(2).Reverse().ToArray(), 0); - + } public override int ReadInt32() { - if (IsLittleEndian) + if(IsLittleEndian) return base.ReadInt32(); FillMyBuffer(4); return BitConverter.ToInt32(buffer.Take(4).Reverse().ToArray(), 0); - + } public override long ReadInt64() { - if (IsLittleEndian) + if(IsLittleEndian) return base.ReadInt64(); FillMyBuffer(8); return BitConverter.ToInt64(buffer.Take(8).Reverse().ToArray(), 0); - + } public override float ReadSingle() { - if (IsLittleEndian) + if(IsLittleEndian) return base.ReadSingle(); FillMyBuffer(4); return BitConverter.ToSingle(buffer.Take(4).Reverse().ToArray(), 0); @@ -109,7 +109,7 @@ namespace DiscImageChef public override ushort ReadUInt16() { - if (IsLittleEndian) + if(IsLittleEndian) return base.ReadUInt16(); FillMyBuffer(2); return BitConverter.ToUInt16(buffer.Take(2).Reverse().ToArray(), 0); @@ -117,7 +117,7 @@ namespace DiscImageChef public override uint ReadUInt32() { - if (IsLittleEndian) + if(IsLittleEndian) return base.ReadUInt32(); FillMyBuffer(4); return BitConverter.ToUInt32(buffer.Take(4).Reverse().ToArray(), 0); @@ -125,7 +125,7 @@ namespace DiscImageChef public override ulong ReadUInt64() { - if (IsLittleEndian) + if(IsLittleEndian) return base.ReadUInt64(); FillMyBuffer(8); return BitConverter.ToUInt64(buffer.Take(8).Reverse().ToArray(), 0); @@ -135,10 +135,10 @@ namespace DiscImageChef { int offset = 0; int num2; - if (numBytes == 1) + if(numBytes == 1) { num2 = BaseStream.ReadByte(); - if (num2 == -1) + if(num2 == -1) { throw new EndOfStreamException("Attempted to read past the end of the stream."); } @@ -149,13 +149,13 @@ namespace DiscImageChef do { num2 = BaseStream.Read(buffer, offset, numBytes - offset); - if (num2 == 0) + if(num2 == 0) { throw new EndOfStreamException("Attempted to read past the end of the stream."); } offset += num2; } - while (offset < numBytes); + while(offset < numBytes); } } } diff --git a/DiscImageChef.Helpers/PrintHex.cs b/DiscImageChef.Helpers/PrintHex.cs index 15c242397..ea4bd5c5e 100644 --- a/DiscImageChef.Helpers/PrintHex.cs +++ b/DiscImageChef.Helpers/PrintHex.cs @@ -53,16 +53,16 @@ namespace DiscImageChef int counter = 0; int subcounter = 0; - for (long i = 0; i < array.LongLength; i++) + for(long i = 0; i < array.LongLength; i++) { - if (counter == 0) + if(counter == 0) { sb.AppendLine(); sb.AppendFormat("{0:X16} ", i); } else { - if (subcounter == 3 ) + if(subcounter == 3) { sb.Append(" "); subcounter = 0; @@ -76,7 +76,7 @@ namespace DiscImageChef sb.AppendFormat("{0:X2}", array[i]); - if (counter == width - 1) + if(counter == width - 1) { counter = 0; subcounter = 0; diff --git a/DiscImageChef.Helpers/StringHandlers.cs b/DiscImageChef.Helpers/StringHandlers.cs index 19816cf81..19707d470 100644 --- a/DiscImageChef.Helpers/StringHandlers.cs +++ b/DiscImageChef.Helpers/StringHandlers.cs @@ -61,19 +61,19 @@ namespace DiscImageChef /// Encoding. public static string CToString(byte[] CString, Encoding encoding) { - if (CString == null) + if(CString == null) return null; StringBuilder sb = new StringBuilder(); - - for (int i = 0; i < CString.Length; i++) + + for(int i = 0; i < CString.Length; i++) { - if (CString[i] == 0) + if(CString[i] == 0) break; sb.Append(encoding.GetString(CString, i, 1)); } - + return sb.ToString(); } @@ -84,14 +84,14 @@ namespace DiscImageChef /// A length-prefixed (aka Pascal string) ASCII byte array public static string PascalToString(byte[] PascalString) { - if (PascalString == null) + if(PascalString == null) return null; StringBuilder sb = new StringBuilder(); byte length = PascalString[0]; - for (int i = 1; i < length + 1; i++) + for(int i = 1; i < length + 1; i++) { sb.Append(Encoding.ASCII.GetString(PascalString, i, 1)); } @@ -106,17 +106,17 @@ namespace DiscImageChef /// A space (' ', 0x20, ASCII SPACE) padded ASCII byte array public static string SpacePaddedToString(byte[] SpacePaddedString) { - if (SpacePaddedString == null) + if(SpacePaddedString == null) return null; - + int length = 0; - for (int i = SpacePaddedString.Length; i >= 0; i--) + for(int i = SpacePaddedString.Length; i >= 0; i--) { - if (i == 0) + if(i == 0) return ""; - if (SpacePaddedString[i - 1] != 0x20) + if(SpacePaddedString[i - 1] != 0x20) { length = i; break; diff --git a/DiscImageChef.Interop/DetectOS.cs b/DiscImageChef.Interop/DetectOS.cs index d88b350d3..29b8a37bc 100644 --- a/DiscImageChef.Interop/DetectOS.cs +++ b/DiscImageChef.Interop/DetectOS.cs @@ -71,7 +71,7 @@ namespace DiscImageChef.Interop public static Interop.PlatformID GetRealPlatformID() { - if ((int)Environment.OSVersion.Platform < 4 || + if((int)Environment.OSVersion.Platform < 4 || (int)Environment.OSVersion.Platform == 5) { return (Interop.PlatformID)((int)Environment.OSVersion.Platform); @@ -79,19 +79,19 @@ namespace DiscImageChef.Interop utsname unixname; int error = uname(out unixname); - if (error != 0) + if(error != 0) throw new Exception(String.Format("Unhandled exception calling uname: {0}", Marshal.GetLastWin32Error())); - switch (unixname.sysname) + switch(unixname.sysname) { // TODO: Differentiate Linux, Android, Tizen case "Linux": { - #if __ANDROID__ +#if __ANDROID__ return PlatformID.Android; - #else +#else return PlatformID.Linux; - #endif +#endif } case "Darwin": { @@ -99,7 +99,7 @@ namespace DiscImageChef.Interop IntPtr pLen = Marshal.AllocHGlobal(sizeof(int)); osx_error = OSX_sysctlbyname("hw.machine", IntPtr.Zero, pLen, IntPtr.Zero, 0); - if (osx_error != 0) + if(osx_error != 0) { Marshal.FreeHGlobal(pLen); @@ -109,7 +109,7 @@ namespace DiscImageChef.Interop int length = Marshal.ReadInt32(pLen); IntPtr pStr = Marshal.AllocHGlobal(length); osx_error = OSX_sysctlbyname("hw.machine", pStr, pLen, IntPtr.Zero, 0); - if (osx_error != 0) + if(osx_error != 0) { Marshal.FreeHGlobal(pStr); Marshal.FreeHGlobal(pLen); @@ -122,7 +122,7 @@ namespace DiscImageChef.Interop Marshal.FreeHGlobal(pStr); Marshal.FreeHGlobal(pLen); - if (machine.StartsWith("iPad", StringComparison.Ordinal) || + if(machine.StartsWith("iPad", StringComparison.Ordinal) || machine.StartsWith("iPod", StringComparison.Ordinal) || machine.StartsWith("iPhone", StringComparison.Ordinal)) return PlatformID.iOS; @@ -174,7 +174,7 @@ namespace DiscImageChef.Interop return PlatformID.Win32NT; default: { - if (unixname.sysname.StartsWith("CYGWIN_NT", StringComparison.Ordinal) || + if(unixname.sysname.StartsWith("CYGWIN_NT", StringComparison.Ordinal) || unixname.sysname.StartsWith("MINGW32_NT", StringComparison.Ordinal) || unixname.sysname.StartsWith("MSYS_NT", StringComparison.Ordinal) || unixname.sysname.StartsWith("UWIN", StringComparison.Ordinal)) diff --git a/DiscImageChef.Metadata/DeviceReport.cs b/DiscImageChef.Metadata/DeviceReport.cs index e80d04bf5..f2e00c169 100644 --- a/DiscImageChef.Metadata/DeviceReport.cs +++ b/DiscImageChef.Metadata/DeviceReport.cs @@ -43,7 +43,7 @@ using DiscImageChef.Decoders.SCSI; namespace DiscImageChef.Metadata { [SerializableAttribute()] - [XmlRootAttribute("DicDeviceReport", Namespace="", IsNullable=false)] + [XmlRootAttribute("DicDeviceReport", Namespace = "", IsNullable = false)] public class DeviceReport { public usbType USB; @@ -412,7 +412,7 @@ namespace DiscImageChef.Metadata public class pageType { [XmlAttributeAttribute()] - public byte page; + public byte page; [XmlTextAttribute()] public byte[] value; @@ -453,10 +453,10 @@ namespace DiscImageChef.Metadata public class modePageType { [XmlAttributeAttribute()] - public byte page; + public byte page; [XmlAttributeAttribute()] - public byte subpage; + public byte subpage; [XmlTextAttribute()] public byte[] value; @@ -641,7 +641,7 @@ namespace DiscImageChef.Metadata public bool DVDMultiRead; public bool EmbeddedChanger; public bool ErrorRecoveryPage; - [XmlElementAttribute(DataType="date")] + [XmlElementAttribute(DataType = "date")] public DateTime FirmwareDate; public byte LoadingMechanismType; public bool Locked; diff --git a/DiscImageChef.Metadata/Dimensions.cs b/DiscImageChef.Metadata/Dimensions.cs index b05e7412e..5525b76d6 100644 --- a/DiscImageChef.Metadata/Dimensions.cs +++ b/DiscImageChef.Metadata/Dimensions.cs @@ -45,7 +45,7 @@ namespace DiscImageChef.Metadata { DimensionsType dmns = new DimensionsType(); - switch (dskType) + switch(dskType) { #region 5.25" floppy disk case CommonTypes.MediaType.Apple32SS: @@ -816,7 +816,7 @@ namespace DiscImageChef.Metadata dmns.DiameterSpecified = true; dmns.Thickness = 2.5; return dmns; - + #region CD/DVD/BD case CommonTypes.MediaType.CDDA: case CommonTypes.MediaType.CDG: diff --git a/DiscImageChef.Metadata/MediaType.cs b/DiscImageChef.Metadata/MediaType.cs index 82f02c3ac..51cfd2218 100644 --- a/DiscImageChef.Metadata/MediaType.cs +++ b/DiscImageChef.Metadata/MediaType.cs @@ -42,7 +42,7 @@ namespace DiscImageChef.Metadata { public static void MediaTypeToString(CommonTypes.MediaType dskType, out string DiscType, out string DiscSubType) { - switch (dskType) + switch(dskType) { case CommonTypes.MediaType.BDR: DiscType = "BD"; @@ -655,15 +655,15 @@ namespace DiscImageChef.Metadata case CommonTypes.MediaType.ZIP100: DiscType = "Iomega ZIP"; DiscSubType = "Iomega ZIP100"; - break; + break; case CommonTypes.MediaType.ZIP250: DiscType = "Iomega ZIP"; DiscSubType = "Iomega ZIP250"; - break; + break; case CommonTypes.MediaType.ZIP750: DiscType = "Iomega ZIP"; DiscSubType = "Iomega ZIP750"; - break; + break; default: DiscType = "Unknown"; DiscSubType = "Unknown"; diff --git a/DiscImageChef.Partitions/AppleMap.cs b/DiscImageChef.Partitions/AppleMap.cs index b44f79628..ebaccd60a 100644 --- a/DiscImageChef.Partitions/AppleMap.cs +++ b/DiscImageChef.Partitions/AppleMap.cs @@ -68,13 +68,13 @@ namespace DiscImageChef.PartPlugins ulong apm_entries; uint sector_size; - if (imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448) + if(imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448) sector_size = 2048; else sector_size = imagePlugin.GetSectorSize(); - + partitions = new List(); - + AppleMapBootEntry APMB = new AppleMapBootEntry(); AppleMapPartitionEntry APMEntry; @@ -106,19 +106,19 @@ namespace DiscImageChef.PartPlugins ulong first_sector = 0; - if (APMB.signature == APM_MAGIC) // APM boot block found, APM starts in next sector + if(APMB.signature == APM_MAGIC) // APM boot block found, APM starts in next sector first_sector = 1; // Read first entry byte[] APMEntry_sector; bool APMFromHDDOnCD = false; - if (sector_size == 2048) + if(sector_size == 2048) { APMEntry_sector = Read2048SectorAs512(imagePlugin, first_sector); APMEntry = DecodeAPMEntry(APMEntry_sector); - if (APMEntry.signature == APM_ENTRY || APMEntry.signature == APM_OLDENT) + if(APMEntry.signature == APM_ENTRY || APMEntry.signature == APM_OLDENT) { sector_size = 512; APMFromHDDOnCD = true; @@ -129,7 +129,7 @@ namespace DiscImageChef.PartPlugins APMEntry_sector = imagePlugin.ReadSector(first_sector); APMEntry = DecodeAPMEntry(APMEntry_sector); - if (APMEntry.signature != APM_ENTRY && APMEntry.signature != APM_OLDENT) + if(APMEntry.signature != APM_ENTRY && APMEntry.signature != APM_OLDENT) return false; } } @@ -138,16 +138,16 @@ namespace DiscImageChef.PartPlugins APMEntry_sector = imagePlugin.ReadSector(first_sector); APMEntry = DecodeAPMEntry(APMEntry_sector); - if (APMEntry.signature != APM_ENTRY && APMEntry.signature != APM_OLDENT) + if(APMEntry.signature != APM_ENTRY && APMEntry.signature != APM_OLDENT) return false; } - if (APMEntry.entries <= 1) + if(APMEntry.entries <= 1) return false; apm_entries = APMEntry.entries; - - for (ulong i = 0; i < apm_entries; i++) // For each partition + + for(ulong i = 0; i < apm_entries; i++) // For each partition { if(APMFromHDDOnCD) APMEntry_sector = Read2048SectorAs512(imagePlugin, first_sector + i); @@ -156,11 +156,11 @@ namespace DiscImageChef.PartPlugins APMEntry = DecodeAPMEntry(APMEntry_sector); - if (APMEntry.signature == APM_ENTRY || APMEntry.signature == APM_OLDENT) // It should have partition entry signature + if(APMEntry.signature == APM_ENTRY || APMEntry.signature == APM_OLDENT) // It should have partition entry signature { CommonTypes.Partition _partition = new CommonTypes.Partition(); StringBuilder sb = new StringBuilder(); - + _partition.PartitionSequence = i; _partition.PartitionType = APMEntry.type; _partition.PartitionName = APMEntry.name; @@ -168,24 +168,24 @@ namespace DiscImageChef.PartPlugins _partition.PartitionLength = APMEntry.sectors * sector_size; _partition.PartitionStartSector = APMEntry.start; _partition.PartitionSectors = APMEntry.sectors; - + sb.AppendLine("Partition flags:"); - if ((APMEntry.status & 0x01) == 0x01) + if((APMEntry.status & 0x01) == 0x01) sb.AppendLine("Partition is valid."); - if ((APMEntry.status & 0x02) == 0x02) + if((APMEntry.status & 0x02) == 0x02) sb.AppendLine("Partition entry is not available."); - if ((APMEntry.status & 0x04) == 0x04) + if((APMEntry.status & 0x04) == 0x04) sb.AppendLine("Partition is mounted."); - if ((APMEntry.status & 0x08) == 0x08) + if((APMEntry.status & 0x08) == 0x08) sb.AppendLine("Partition is bootable."); - if ((APMEntry.status & 0x10) == 0x10) + if((APMEntry.status & 0x10) == 0x10) sb.AppendLine("Partition is readable."); - if ((APMEntry.status & 0x20) == 0x20) + if((APMEntry.status & 0x20) == 0x20) sb.AppendLine("Partition is writable."); - if ((APMEntry.status & 0x40) == 0x40) + if((APMEntry.status & 0x40) == 0x40) sb.AppendLine("Partition's boot code is position independent."); - - if ((APMEntry.status & 0x08) == 0x08) + + if((APMEntry.status & 0x08) == 0x08) { sb.AppendFormat("First boot sector: {0}", APMEntry.first_boot_block).AppendLine(); sb.AppendFormat("Boot is {0} bytes.", APMEntry.boot_size).AppendLine(); @@ -194,15 +194,15 @@ namespace DiscImageChef.PartPlugins sb.AppendFormat("Boot code checksum: 0x{0:X8}", APMEntry.checksum).AppendLine(); sb.AppendFormat("Processor: {0}", APMEntry.processor).AppendLine(); } - + _partition.PartitionDescription = sb.ToString(); - - if ((APMEntry.status & 0x01) == 0x01) - if (APMEntry.type != "Apple_partition_map") - partitions.Add(_partition); + + if((APMEntry.status & 0x01) == 0x01) + if(APMEntry.type != "Apple_partition_map") + partitions.Add(_partition); } } - + return true; } diff --git a/DiscImageChef.Partitions/Atari.cs b/DiscImageChef.Partitions/Atari.cs index 83f4e3f43..45d3bc8e1 100644 --- a/DiscImageChef.Partitions/Atari.cs +++ b/DiscImageChef.Partitions/Atari.cs @@ -72,7 +72,7 @@ namespace DiscImageChef.PartPlugins { partitions = new List(); - if (imagePlugin.GetSectorSize() < 512) + if(imagePlugin.GetSectorSize() < 512) return false; BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; @@ -87,7 +87,7 @@ namespace DiscImageChef.PartPlugins Array.Copy(sector, 0, table.boot, 0, 342); - for (int i = 0; i < 8; i++) + for(int i = 0; i < 8; i++) { table.icdEntries[i].type = BigEndianBitConverter.ToUInt32(sector, 342 + i * 12 + 0); table.icdEntries[i].start = BigEndianBitConverter.ToUInt32(sector, 342 + i * 12 + 4); @@ -98,7 +98,7 @@ namespace DiscImageChef.PartPlugins table.size = BigEndianBitConverter.ToUInt32(sector, 450); - for (int i = 0; i < 4; i++) + for(int i = 0; i < 4; i++) { table.entries[i].type = BigEndianBitConverter.ToUInt32(sector, 454 + i * 12 + 0); table.entries[i].start = BigEndianBitConverter.ToUInt32(sector, 454 + i * 12 + 4); @@ -114,7 +114,7 @@ namespace DiscImageChef.PartPlugins sha1Ctx.Update(table.boot); DicConsole.DebugWriteLine("Atari partition plugin", "Boot code SHA1: {0}", sha1Ctx.End()); - for (int i = 0; i < 8; i++) + for(int i = 0; i < 8; i++) { DicConsole.DebugWriteLine("Atari partition plugin", "table.icdEntries[{0}].flag = 0x{1:X2}", i, (table.icdEntries[i].type & 0xFF000000) >> 24); DicConsole.DebugWriteLine("Atari partition plugin", "table.icdEntries[{0}].type = 0x{1:X6}", i, (table.icdEntries[i].type & 0x00FFFFFF)); @@ -124,7 +124,7 @@ namespace DiscImageChef.PartPlugins DicConsole.DebugWriteLine("Atari partition plugin", "table.size = {0}", table.size); - for (int i = 0; i < 4; i++) + for(int i = 0; i < 4; i++) { DicConsole.DebugWriteLine("Atari partition plugin", "table.entries[{0}].flag = 0x{1:X2}", i, (table.entries[i].type & 0xFF000000) >> 24); DicConsole.DebugWriteLine("Atari partition plugin", "table.entries[{0}].type = 0x{1:X6}", i, (table.entries[i].type & 0x00FFFFFF)); @@ -138,24 +138,24 @@ namespace DiscImageChef.PartPlugins bool validTable = false; ulong partitionSequence = 0; - for (int i = 0; i < 4; i++) + for(int i = 0; i < 4; i++) { UInt32 type = table.entries[i].type & 0x00FFFFFF; - if (type == TypeGEMDOS || type == TypeBigGEMDOS || type == TypeLinux || + if(type == TypeGEMDOS || type == TypeBigGEMDOS || type == TypeLinux || type == TypeSwap || type == TypeRAW || type == TypeNetBSD || type == TypeNetBSDSwap || type == TypeSysV || type == TypeMac || type == TypeMinix || type == TypeMinix2) { validTable = true; - if (table.entries[i].start <= imagePlugin.GetSectors()) + if(table.entries[i].start <= imagePlugin.GetSectors()) { - if ((table.entries[i].start + table.entries[i].length) > imagePlugin.GetSectors()) + if((table.entries[i].start + table.entries[i].length) > imagePlugin.GetSectors()) DicConsole.DebugWriteLine("Atari partition plugin", "WARNING: End of partition goes beyond device size"); ulong sectorSize = imagePlugin.GetSectorSize(); - if (sectorSize == 2448 || sectorSize == 2352) + if(sectorSize == 2448 || sectorSize == 2352) sectorSize = 2048; CommonTypes.Partition part = new CommonTypes.Partition(); @@ -172,7 +172,7 @@ namespace DiscImageChef.PartPlugins partType[2] = (byte)(type & 0x0000FF); part.PartitionType = Encoding.ASCII.GetString(partType); - switch (type) + switch(type) { case TypeGEMDOS: part.PartitionDescription = "Atari GEMDOS partition"; @@ -215,36 +215,36 @@ namespace DiscImageChef.PartPlugins } } - if (type == TypeExtended) + if(type == TypeExtended) { byte[] extendedSector = imagePlugin.ReadSector(table.entries[i].start); AtariTable extendedTable = new AtariTable(); extendedTable.entries = new AtariEntry[4]; - for (int j = 0; j < 4; j++) + for(int j = 0; j < 4; j++) { extendedTable.entries[j].type = BigEndianBitConverter.ToUInt32(extendedSector, 454 + j * 12 + 0); extendedTable.entries[j].start = BigEndianBitConverter.ToUInt32(extendedSector, 454 + j * 12 + 4); extendedTable.entries[j].length = BigEndianBitConverter.ToUInt32(extendedSector, 454 + j * 12 + 8); } - for (int j = 0; j < 4; j++) + for(int j = 0; j < 4; j++) { UInt32 extendedType = extendedTable.entries[j].type & 0x00FFFFFF; - if (extendedType == TypeGEMDOS || extendedType == TypeBigGEMDOS || extendedType == TypeLinux || + if(extendedType == TypeGEMDOS || extendedType == TypeBigGEMDOS || extendedType == TypeLinux || extendedType == TypeSwap || extendedType == TypeRAW || extendedType == TypeNetBSD || extendedType == TypeNetBSDSwap || extendedType == TypeSysV || extendedType == TypeMac || extendedType == TypeMinix || extendedType == TypeMinix2) { validTable = true; - if (extendedTable.entries[j].start <= imagePlugin.GetSectors()) + if(extendedTable.entries[j].start <= imagePlugin.GetSectors()) { - if ((extendedTable.entries[j].start + extendedTable.entries[j].length) > imagePlugin.GetSectors()) + if((extendedTable.entries[j].start + extendedTable.entries[j].length) > imagePlugin.GetSectors()) DicConsole.DebugWriteLine("Atari partition plugin", "WARNING: End of partition goes beyond device size"); ulong sectorSize = imagePlugin.GetSectorSize(); - if (sectorSize == 2448 || sectorSize == 2352) + if(sectorSize == 2448 || sectorSize == 2352) sectorSize = 2048; CommonTypes.Partition part = new CommonTypes.Partition(); @@ -261,7 +261,7 @@ namespace DiscImageChef.PartPlugins partType[2] = (byte)(extendedType & 0x0000FF); part.PartitionType = Encoding.ASCII.GetString(partType); - switch (extendedType) + switch(extendedType) { case TypeGEMDOS: part.PartitionDescription = "Atari GEMDOS partition"; @@ -286,14 +286,14 @@ namespace DiscImageChef.PartPlugins break; case TypeSysV: part.PartitionDescription = "Atari UNIX partition"; - break; + break; case TypeMac: part.PartitionDescription = "Macintosh partition"; - break; + break; case TypeMinix: case TypeMinix2: part.PartitionDescription = "MINIX partition"; - break; + break; default: part.PartitionDescription = "Unknown partition type"; break; @@ -307,24 +307,24 @@ namespace DiscImageChef.PartPlugins } } - if (validTable) + if(validTable) { - for (int i = 0; i < 8; i++) + for(int i = 0; i < 8; i++) { UInt32 type = table.icdEntries[i].type & 0x00FFFFFF; - if (type == TypeGEMDOS || type == TypeBigGEMDOS || type == TypeLinux || + if(type == TypeGEMDOS || type == TypeBigGEMDOS || type == TypeLinux || type == TypeSwap || type == TypeRAW || type == TypeNetBSD || type == TypeNetBSDSwap || type == TypeSysV || type == TypeMac || type == TypeMinix || type == TypeMinix2) { - if (table.icdEntries[i].start <= imagePlugin.GetSectors()) + if(table.icdEntries[i].start <= imagePlugin.GetSectors()) { - if ((table.icdEntries[i].start + table.icdEntries[i].length) > imagePlugin.GetSectors()) + if((table.icdEntries[i].start + table.icdEntries[i].length) > imagePlugin.GetSectors()) DicConsole.DebugWriteLine("Atari partition plugin", "WARNING: End of partition goes beyond device size"); ulong sectorSize = imagePlugin.GetSectorSize(); - if (sectorSize == 2448 || sectorSize == 2352) + if(sectorSize == 2448 || sectorSize == 2352) sectorSize = 2048; CommonTypes.Partition part = new CommonTypes.Partition(); @@ -341,7 +341,7 @@ namespace DiscImageChef.PartPlugins partType[2] = (byte)(type & 0x0000FF); part.PartitionType = Encoding.ASCII.GetString(partType); - switch (type) + switch(type) { case TypeGEMDOS: part.PartitionDescription = "Atari GEMDOS partition"; @@ -366,14 +366,14 @@ namespace DiscImageChef.PartPlugins break; case TypeSysV: part.PartitionDescription = "Atari UNIX partition"; - break; + break; case TypeMac: part.PartitionDescription = "Macintosh partition"; - break; + break; case TypeMinix: case TypeMinix2: part.PartitionDescription = "MINIX partition"; - break; + break; default: part.PartitionDescription = "Unknown partition type"; break; diff --git a/DiscImageChef.Partitions/GPT.cs b/DiscImageChef.Partitions/GPT.cs index e4e17b371..306e86a41 100644 --- a/DiscImageChef.Partitions/GPT.cs +++ b/DiscImageChef.Partitions/GPT.cs @@ -41,7 +41,7 @@ using System.Runtime.InteropServices; using DiscImageChef.Console; namespace DiscImageChef.PartPlugins -{ +{ class GuidPartitionTable : PartPlugin { const ulong GptMagic = 0x5452415020494645; @@ -65,7 +65,7 @@ namespace DiscImageChef.PartPlugins GCHandle handle = GCHandle.Alloc(hdrBytes, GCHandleType.Pinned); hdr = (GptHeader)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(GptHeader)); handle.Free(); - } + } catch { return false; @@ -86,10 +86,10 @@ namespace DiscImageChef.PartPlugins DicConsole.DebugWriteLine("GPT Plugin", "hdr.entriesSize = {0}", hdr.entriesSize); DicConsole.DebugWriteLine("GPT Plugin", "hdr.entriesCrc = 0x{0:X8}", hdr.entriesCrc); - if (hdr.signature != GptMagic) + if(hdr.signature != GptMagic) return false; - if (hdr.myLBA != 1) + if(hdr.myLBA != 1) return false; uint totalEntriesSectors = (hdr.entries * hdr.entriesSize) / imagePlugin.GetSectorSize(); @@ -97,7 +97,7 @@ namespace DiscImageChef.PartPlugins byte[] entriesBytes = imagePlugin.ReadSectors(hdr.entryLBA, totalEntriesSectors); List entries = new List(); - for (int i = 0; i < hdr.entries; i++) + for(int i = 0; i < hdr.entries; i++) { try { @@ -113,14 +113,14 @@ namespace DiscImageChef.PartPlugins } } - if (entries.Count == 0) + if(entries.Count == 0) return false; ulong pseq = 0; - foreach (GptEntry entry in entries) + foreach(GptEntry entry in entries) { - if (entry.partitionType != Guid.Empty && entry.partitionId != Guid.Empty) + if(entry.partitionType != Guid.Empty && entry.partitionId != Guid.Empty) { DicConsole.DebugWriteLine("GPT Plugin", "entry.partitionType = {0}", entry.partitionType); DicConsole.DebugWriteLine("GPT Plugin", "entry.partitionId = {0}", entry.partitionId); @@ -129,7 +129,7 @@ namespace DiscImageChef.PartPlugins DicConsole.DebugWriteLine("GPT Plugin", "entry.attributes = 0x{0:X16}", entry.attributes); DicConsole.DebugWriteLine("GPT Plugin", "entry.name = {0}", entry.name); - if (entry.startLBA > imagePlugin.GetSectors() || entry.endLBA > imagePlugin.GetSectors()) + if(entry.startLBA > imagePlugin.GetSectors() || entry.endLBA > imagePlugin.GetSectors()) return false; CommonTypes.Partition part = new CommonTypes.Partition(); @@ -152,7 +152,7 @@ namespace DiscImageChef.PartPlugins public string GetGuidTypeName(Guid type) { string strType = type.ToString().ToUpperInvariant(); - switch (strType) + switch(strType) { case "024DEE41-33E7-11D3-9D69-0008C781F39F": return "MBR scheme"; diff --git a/DiscImageChef.Partitions/MBR.cs b/DiscImageChef.Partitions/MBR.cs index 060a70424..c157124ce 100644 --- a/DiscImageChef.Partitions/MBR.cs +++ b/DiscImageChef.Partitions/MBR.cs @@ -58,23 +58,23 @@ namespace DiscImageChef.PartPlugins byte cyl_sect1, cyl_sect2; // For decoding cylinder and sector UInt16 signature; ulong counter = 0; - + partitions = new List(); - if (imagePlugin.GetSectorSize() < 512) + if(imagePlugin.GetSectorSize() < 512) return false; byte[] sector = imagePlugin.ReadSector(0); signature = BitConverter.ToUInt16(sector, 0x1FE); - if (signature != MBRSignature) + if(signature != MBRSignature) return false; // Not MBR - - for (int i = 0; i < 4; i++) + + for(int i = 0; i < 4; i++) { MBRPartitionEntry entry = new MBRPartitionEntry(); - + entry.status = sector[0x1BE + 16 * i + 0x00]; entry.start_head = sector[0x1BE + 16 * i + 0x01]; @@ -83,36 +83,36 @@ namespace DiscImageChef.PartPlugins entry.start_sector = (byte)(cyl_sect1 & 0x3F); entry.start_cylinder = (ushort)(((cyl_sect1 & 0xC0) << 2) | cyl_sect2); - + entry.type = sector[0x1BE + 16 * i + 0x04]; entry.end_head = sector[0x1BE + 16 * i + 0x05]; cyl_sect1 = sector[0x1BE + 16 * i + 0x06]; cyl_sect2 = sector[0x1BE + 16 * i + 0x07]; - + entry.end_sector = (byte)(cyl_sect1 & 0x3F); entry.end_cylinder = (ushort)(((cyl_sect1 & 0xC0) << 2) | cyl_sect2); - + entry.lba_start = BitConverter.ToUInt32(sector, 0x1BE + 16 * i + 0x08); entry.lba_sectors = BitConverter.ToUInt32(sector, 0x1BE + 16 * i + 0x0C); - + // Let's start the fun... - + bool valid = true; bool extended = false; bool disklabel = false; - if (entry.status != 0x00 && entry.status != 0x80) + if(entry.status != 0x00 && entry.status != 0x80) return false; // Maybe a FAT filesystem valid &= entry.type != 0x00; - if (entry.type == 0xEE || entry.type == 0xEF) + if(entry.type == 0xEE || entry.type == 0xEF) return false; // This is a GPT - if (entry.type == 0x05 || entry.type == 0x0F || entry.type == 0x85) + if(entry.type == 0x05 || entry.type == 0x0F || entry.type == 0x85) { valid = false; extended = true; // Extended partition } - if (entry.type == 0x82 || entry.type == 0xBF || entry.type == 0xA5 || entry.type == 0xA6 || entry.type == 0xA9 || + if(entry.type == 0x82 || entry.type == 0xBF || entry.type == 0xA5 || entry.type == 0xA6 || entry.type == 0xA9 || entry.type == 0xB7 || entry.type == 0x81 || entry.type == 0x63) { valid = false; @@ -120,24 +120,24 @@ namespace DiscImageChef.PartPlugins } valid &= entry.lba_start != 0 || entry.lba_sectors != 0 || entry.start_cylinder != 0 || entry.start_head != 0 || entry.start_sector != 0 || entry.end_cylinder != 0 || entry.end_head != 0 || entry.end_sector != 0; - if (entry.lba_start == 0 && entry.lba_sectors == 0 && valid) + if(entry.lba_start == 0 && entry.lba_sectors == 0 && valid) { entry.lba_start = CHStoLBA(entry.start_cylinder, entry.start_head, entry.start_sector); entry.lba_sectors = CHStoLBA(entry.end_cylinder, entry.end_head, entry.end_sector) - entry.lba_start; } - if (entry.lba_start > imagePlugin.GetSectors() || entry.lba_start + entry.lba_sectors > imagePlugin.GetSectors()) + if(entry.lba_start > imagePlugin.GetSectors() || entry.lba_start + entry.lba_sectors > imagePlugin.GetSectors()) { valid = false; disklabel = false; extended = false; } - - if (disklabel) + + if(disklabel) { byte[] disklabel_sector = imagePlugin.ReadSector(entry.lba_start); - - switch (entry.type) + + switch(entry.type) { case 0xA5: case 0xA6: @@ -145,13 +145,13 @@ namespace DiscImageChef.PartPlugins case 0xB7: // BSD disklabels { UInt32 magic = BitConverter.ToUInt32(disklabel_sector, 0); - - if (magic == 0x82564557) + + if(magic == 0x82564557) { UInt16 no_parts = BitConverter.ToUInt16(disklabel_sector, 126); - + // TODO: Handle disklabels bigger than 1 sector or search max no_parts - for (int j = 0; j < no_parts; j++) + for(int j = 0; j < no_parts; j++) { CommonTypes.Partition part = new CommonTypes.Partition(); byte bsd_type; @@ -164,11 +164,11 @@ namespace DiscImageChef.PartPlugins part.PartitionType = String.Format("BSD: {0}", bsd_type); part.PartitionName = decodeBSDType(bsd_type); - + part.PartitionSequence = counter; part.PartitionDescription = "Partition inside a BSD disklabel."; - - if (bsd_type != 0) + + if(bsd_type != 0) { partitions.Add(part); counter++; @@ -185,7 +185,7 @@ namespace DiscImageChef.PartPlugins byte[] unix_dl_sector = imagePlugin.ReadSector(entry.lba_start + 29); // UNIX disklabel starts on sector 29 of partition magic = BitConverter.ToUInt32(unix_dl_sector, 4); - if (magic == UNIXDiskLabel_MAGIC) + if(magic == UNIXDiskLabel_MAGIC) { UNIXDiskLabel dl = new UNIXDiskLabel(); UNIXVTOC vtoc = new UNIXVTOC(); // old/new @@ -193,7 +193,7 @@ namespace DiscImageChef.PartPlugins int vtocoffset = 0; vtoc.magic = BitConverter.ToUInt32(unix_dl_sector, 172); - if (vtoc.magic == UNIXVTOC_MAGIC) + if(vtoc.magic == UNIXVTOC_MAGIC) { isNewDL = true; vtocoffset = 72; @@ -201,7 +201,7 @@ namespace DiscImageChef.PartPlugins else { vtoc.magic = BitConverter.ToUInt32(unix_dl_sector, 172); - if (vtoc.magic != UNIXDiskLabel_MAGIC) + if(vtoc.magic != UNIXDiskLabel_MAGIC) { valid = true; break; @@ -220,8 +220,8 @@ namespace DiscImageChef.PartPlugins //dl.unknown1 = br.ReadBytes(48); // 44 dl.alt_tbl = BitConverter.ToUInt32(unix_dl_sector, 92); // 92 dl.alt_len = BitConverter.ToUInt32(unix_dl_sector, 96); // 96 - - if (isNewDL) // Old version VTOC starts here + + if(isNewDL) // Old version VTOC starts here { dl.phys_cyl = BitConverter.ToUInt32(unix_dl_sector, 100); // 100 dl.phys_trk = BitConverter.ToUInt32(unix_dl_sector, 104); // 104 @@ -231,8 +231,8 @@ namespace DiscImageChef.PartPlugins dl.unknown3 = BitConverter.ToUInt32(unix_dl_sector, 120); // 120 //dl.pad = br.ReadBytes(48); // 124 } - - if (vtoc.magic == UNIXVTOC_MAGIC) + + if(vtoc.magic == UNIXVTOC_MAGIC) { vtoc.version = BitConverter.ToUInt32(unix_dl_sector, 104 + vtocoffset); // 104/176 byte[] vtoc_name = new byte[8]; @@ -240,10 +240,10 @@ namespace DiscImageChef.PartPlugins vtoc.name = StringHandlers.CToString(vtoc_name); // 108/180 vtoc.slices = BitConverter.ToUInt16(unix_dl_sector, 116 + vtocoffset); // 116/188 vtoc.unknown = BitConverter.ToUInt16(unix_dl_sector, 118 + vtocoffset); // 118/190 - //vtoc.reserved = br.ReadBytes(40); // 120/192 - + //vtoc.reserved = br.ReadBytes(40); // 120/192 + // TODO: What if number of slices overlaps sector (>23)? - for (int j = 0; j < vtoc.slices; j++) + for(int j = 0; j < vtoc.slices; j++) { UNIXVTOCEntry vtoc_ent = new UNIXVTOCEntry(); @@ -252,7 +252,7 @@ namespace DiscImageChef.PartPlugins vtoc_ent.start = BitConverter.ToUInt32(unix_dl_sector, 160 + vtocoffset + j * 12 + 6); // 166/238 + j*12 vtoc_ent.length = BitConverter.ToUInt32(unix_dl_sector, 160 + vtocoffset + j * 12 + 10); // 170/242 + j*12 - if ((vtoc_ent.flags & 0x200) == 0x200 && vtoc_ent.tag != UNIX_TAG_EMPTY && vtoc_ent.tag != UNIX_TAG_WHOLE) + if((vtoc_ent.flags & 0x200) == 0x200 && vtoc_ent.tag != UNIX_TAG_EMPTY && vtoc_ent.tag != UNIX_TAG_WHOLE) { CommonTypes.Partition part = new CommonTypes.Partition(); // TODO: Check if device bps == disklabel bps @@ -265,13 +265,13 @@ namespace DiscImageChef.PartPlugins string info = ""; - if ((vtoc_ent.flags & 0x01) == 0x01) + if((vtoc_ent.flags & 0x01) == 0x01) info += " (do not mount)"; - if ((vtoc_ent.flags & 0x10) == 0x10) + if((vtoc_ent.flags & 0x10) == 0x10) info += " (do not mount)"; part.PartitionDescription = "UNIX slice" + info + "."; - + partitions.Add(part); counter++; } @@ -288,9 +288,9 @@ namespace DiscImageChef.PartPlugins UInt32 magic = BitConverter.ToUInt32(disklabel_sector, 12); // 12 UInt32 version = BitConverter.ToUInt32(disklabel_sector, 16); // 16 - if (magic == 0x600DDEEE && version == 1) + if(magic == 0x600DDEEE && version == 1) { - for (int j = 0; j < 16; j++) + for(int j = 0; j < 16; j++) { CommonTypes.Partition part = new CommonTypes.Partition(); part.PartitionStartSector = BitConverter.ToUInt32(disklabel_sector, 68 + j * 12 + 4); @@ -298,10 +298,10 @@ namespace DiscImageChef.PartPlugins part.PartitionStart = part.PartitionStartSector * imagePlugin.GetSectorSize(); // 68+4+j*12 part.PartitionLength = part.PartitionSectors * imagePlugin.GetSectorSize(); // 68+8+j*12 part.PartitionDescription = "Solaris slice."; - + part.PartitionSequence = counter; - - if (part.PartitionLength > 0) + + if(part.PartitionLength > 0) { partitions.Add(part); counter++; @@ -316,12 +316,12 @@ namespace DiscImageChef.PartPlugins { bool minix_subs = false; byte type; - - for (int j = 0; j < 4; j++) + + for(int j = 0; j < 4; j++) { type = disklabel_sector[0x1BE + j * 16 + 4]; - - if (type == 0x81) + + if(type == 0x81) { CommonTypes.Partition part = new CommonTypes.Partition(); minix_subs = true; @@ -337,7 +337,7 @@ namespace DiscImageChef.PartPlugins } } valid |= !minix_subs; - + break; } default: @@ -345,41 +345,41 @@ namespace DiscImageChef.PartPlugins break; } } - - if (valid) + + if(valid) { CommonTypes.Partition part = new CommonTypes.Partition(); - if (entry.lba_start > 0 && entry.lba_sectors > 0) + if(entry.lba_start > 0 && entry.lba_sectors > 0) { part.PartitionStartSector = entry.lba_start; part.PartitionSectors = entry.lba_sectors; part.PartitionStart = part.PartitionStartSector * imagePlugin.GetSectorSize(); part.PartitionLength = part.PartitionSectors * imagePlugin.GetSectorSize(); } -/* else if(entry.start_head < 255 && entry.end_head < 255 && - entry.start_sector > 0 && entry.start_sector < 64 && - entry.end_sector > 0 && entry.end_sector < 64 && - entry.start_cylinder < 1024 && entry.end_cylinder < 1024) - { - - } */ // As we don't know the maxium cyl, head or sect of the device we need LBA - else + /* else if(entry.start_head < 255 && entry.end_head < 255 && + entry.start_sector > 0 && entry.start_sector < 64 && + entry.end_sector > 0 && entry.end_sector < 64 && + entry.start_cylinder < 1024 && entry.end_cylinder < 1024) + { + + } */ // As we don't know the maxium cyl, head or sect of the device we need LBA + else valid = false; - - if (valid) + + if(valid) { part.PartitionType = String.Format("0x{0:X2}", entry.type); part.PartitionName = decodeMBRType(entry.type); part.PartitionSequence = counter; part.PartitionDescription = entry.status == 0x80 ? "Partition is bootable." : ""; - + counter++; - + partitions.Add(part); } } - - if (extended) // Let's extend the fun + + if(extended) // Let's extend the fun { bool ext_valid = true; bool ext_disklabel = false; @@ -387,46 +387,46 @@ namespace DiscImageChef.PartPlugins sector = imagePlugin.ReadSector(entry.lba_start); - while (processing_extended) + while(processing_extended) { - for (int l = 0; l < 2; l++) + for(int l = 0; l < 2; l++) { bool ext_extended = false; - + MBRPartitionEntry entry2 = new MBRPartitionEntry(); - + entry2.status = sector[0x1BE + 16 * i + 0x00]; entry2.start_head = sector[0x1BE + 16 * i + 0x01]; - + cyl_sect1 = sector[0x1BE + 16 * i + 0x02]; cyl_sect2 = sector[0x1BE + 16 * i + 0x03]; - + entry2.start_sector = (byte)(cyl_sect1 & 0x3F); entry2.start_cylinder = (ushort)(((cyl_sect1 & 0xC0) << 2) | cyl_sect2); - + entry2.type = sector[0x1BE + 16 * i + 0x04]; entry2.end_head = sector[0x1BE + 16 * i + 0x05]; - + cyl_sect1 = sector[0x1BE + 16 * i + 0x06]; cyl_sect2 = sector[0x1BE + 16 * i + 0x07]; - + entry2.end_sector = (byte)(cyl_sect1 & 0x3F); entry2.end_cylinder = (ushort)(((cyl_sect1 & 0xC0) << 2) | cyl_sect2); - + entry2.lba_start = BitConverter.ToUInt32(sector, 0x1BE + 16 * i + 0x08); entry2.lba_sectors = BitConverter.ToUInt32(sector, 0x1BE + 16 * i + 0x0C); // Let's start the fun... - + ext_valid &= entry2.status == 0x00 || entry2.status == 0x80; valid &= entry2.type != 0x00; - if (entry2.type == 0x82 || entry2.type == 0xBF || entry2.type == 0xA5 || entry2.type == 0xA6 || + if(entry2.type == 0x82 || entry2.type == 0xBF || entry2.type == 0xA5 || entry2.type == 0xA6 || entry2.type == 0xA9 || entry2.type == 0xB7 || entry2.type == 0x81 || entry2.type == 0x63) { ext_valid = false; ext_disklabel = true; } - if (entry2.type == 0x05 || entry2.type == 0x0F || entry2.type == 0x85) + if(entry2.type == 0x05 || entry2.type == 0x0F || entry2.type == 0x85) { ext_valid = false; ext_disklabel = false; @@ -434,12 +434,12 @@ namespace DiscImageChef.PartPlugins } else processing_extended &= l != 1; - - if (ext_disklabel) + + if(ext_disklabel) { byte[] disklabel_sector = imagePlugin.ReadSector(entry2.lba_start); - switch (entry2.type) + switch(entry2.type) { case 0xA5: case 0xA6: @@ -447,30 +447,30 @@ namespace DiscImageChef.PartPlugins case 0xB7: // BSD disklabels { UInt32 magic = BitConverter.ToUInt32(disklabel_sector, 0); - - if (magic == 0x82564557) + + if(magic == 0x82564557) { UInt16 no_parts = BitConverter.ToUInt16(disklabel_sector, 126); - + // TODO: Handle disklabels bigger than 1 sector or search max no_parts - for (int j = 0; j < no_parts; j++) + for(int j = 0; j < no_parts; j++) { CommonTypes.Partition part = new CommonTypes.Partition(); byte bsd_type; - + part.PartitionSectors = BitConverter.ToUInt32(disklabel_sector, 134 + j * 16 + 4); part.PartitionStartSector = BitConverter.ToUInt32(disklabel_sector, 134 + j * 16 + 0); part.PartitionLength = part.PartitionSectors * imagePlugin.GetSectorSize(); part.PartitionStart = part.PartitionStartSector * imagePlugin.GetSectorSize(); bsd_type = disklabel_sector[134 + j * 16 + 8]; - + part.PartitionType = String.Format("BSD: {0}", bsd_type); part.PartitionName = decodeBSDType(bsd_type); - + part.PartitionSequence = counter; part.PartitionDescription = "Partition inside a BSD disklabel."; - - if (bsd_type != 0) + + if(bsd_type != 0) { partitions.Add(part); counter++; @@ -487,7 +487,7 @@ namespace DiscImageChef.PartPlugins byte[] unix_dl_sector = imagePlugin.ReadSector(entry.lba_start + 29); // UNIX disklabel starts on sector 29 of partition magic = BitConverter.ToUInt32(unix_dl_sector, 4); - if (magic == UNIXDiskLabel_MAGIC) + if(magic == UNIXDiskLabel_MAGIC) { UNIXDiskLabel dl = new UNIXDiskLabel(); UNIXVTOC vtoc = new UNIXVTOC(); // old/new @@ -495,7 +495,7 @@ namespace DiscImageChef.PartPlugins int vtocoffset = 0; vtoc.magic = BitConverter.ToUInt32(unix_dl_sector, 172); - if (vtoc.magic == UNIXVTOC_MAGIC) + if(vtoc.magic == UNIXVTOC_MAGIC) { isNewDL = true; vtocoffset = 72; @@ -503,7 +503,7 @@ namespace DiscImageChef.PartPlugins else { vtoc.magic = BitConverter.ToUInt32(unix_dl_sector, 172); - if (vtoc.magic != UNIXDiskLabel_MAGIC) + if(vtoc.magic != UNIXDiskLabel_MAGIC) { valid = true; break; @@ -523,7 +523,7 @@ namespace DiscImageChef.PartPlugins dl.alt_tbl = BitConverter.ToUInt32(unix_dl_sector, 92); // 92 dl.alt_len = BitConverter.ToUInt32(unix_dl_sector, 96); // 96 - if (isNewDL) // Old version VTOC starts here + if(isNewDL) // Old version VTOC starts here { dl.phys_cyl = BitConverter.ToUInt32(unix_dl_sector, 100); // 100 dl.phys_trk = BitConverter.ToUInt32(unix_dl_sector, 104); // 104 @@ -534,7 +534,7 @@ namespace DiscImageChef.PartPlugins //dl.pad = br.ReadBytes(48); // 124 } - if (vtoc.magic == UNIXVTOC_MAGIC) + if(vtoc.magic == UNIXVTOC_MAGIC) { vtoc.version = BitConverter.ToUInt32(unix_dl_sector, 104 + vtocoffset); // 104/176 byte[] vtoc_name = new byte[8]; @@ -545,7 +545,7 @@ namespace DiscImageChef.PartPlugins //vtoc.reserved = br.ReadBytes(40); // 120/192 // TODO: What if number of slices overlaps sector (>23)? - for (int j = 0; j < vtoc.slices; j++) + for(int j = 0; j < vtoc.slices; j++) { UNIXVTOCEntry vtoc_ent = new UNIXVTOCEntry(); @@ -554,7 +554,7 @@ namespace DiscImageChef.PartPlugins vtoc_ent.start = BitConverter.ToUInt32(unix_dl_sector, 160 + vtocoffset + j * 12 + 6); // 166/238 + j*12 vtoc_ent.length = BitConverter.ToUInt32(unix_dl_sector, 160 + vtocoffset + j * 12 + 10); // 170/242 + j*12 - if ((vtoc_ent.flags & 0x200) == 0x200 && vtoc_ent.tag != UNIX_TAG_EMPTY && vtoc_ent.tag != UNIX_TAG_WHOLE) + if((vtoc_ent.flags & 0x200) == 0x200 && vtoc_ent.tag != UNIX_TAG_EMPTY && vtoc_ent.tag != UNIX_TAG_WHOLE) { CommonTypes.Partition part = new CommonTypes.Partition(); // TODO: Check if device bps == disklabel bps @@ -567,9 +567,9 @@ namespace DiscImageChef.PartPlugins string info = ""; - if ((vtoc_ent.flags & 0x01) == 0x01) + if((vtoc_ent.flags & 0x01) == 0x01) info += " (do not mount)"; - if ((vtoc_ent.flags & 0x10) == 0x10) + if((vtoc_ent.flags & 0x10) == 0x10) info += " (do not mount)"; part.PartitionDescription = "UNIX slice" + info + "."; @@ -590,9 +590,9 @@ namespace DiscImageChef.PartPlugins UInt32 magic = BitConverter.ToUInt32(disklabel_sector, 12); // 12 UInt32 version = BitConverter.ToUInt32(disklabel_sector, 16); // 16 - if (magic == 0x600DDEEE && version == 1) + if(magic == 0x600DDEEE && version == 1) { - for (int j = 0; j < 16; j++) + for(int j = 0; j < 16; j++) { CommonTypes.Partition part = new CommonTypes.Partition(); part.PartitionStartSector = BitConverter.ToUInt32(disklabel_sector, 68 + j * 12 + 4); @@ -603,7 +603,7 @@ namespace DiscImageChef.PartPlugins part.PartitionSequence = counter; - if (part.PartitionLength > 0) + if(part.PartitionLength > 0) { partitions.Add(part); counter++; @@ -619,11 +619,11 @@ namespace DiscImageChef.PartPlugins bool minix_subs = false; byte type; - for (int j = 0; j < 4; j++) + for(int j = 0; j < 4; j++) { type = disklabel_sector[0x1BE + j * 16 + 4]; - if (type == 0x81) + if(type == 0x81) { CommonTypes.Partition part = new CommonTypes.Partition(); minix_subs = true; @@ -639,50 +639,50 @@ namespace DiscImageChef.PartPlugins } } ext_valid |= !minix_subs; - + break; } default: ext_valid = true; break; } - + } - - if (ext_valid) + + if(ext_valid) { CommonTypes.Partition part = new CommonTypes.Partition(); - if (entry2.lba_start > 0 && entry2.lba_sectors > 0) + if(entry2.lba_start > 0 && entry2.lba_sectors > 0) { part.PartitionStartSector = entry2.lba_start; part.PartitionSectors = entry2.lba_sectors; part.PartitionStart = part.PartitionStartSector * imagePlugin.GetSectorSize(); part.PartitionLength = part.PartitionSectors * imagePlugin.GetSectorSize(); } - /* else if(entry2.start_head < 255 && entry2.end_head < 255 && - entry2.start_sector > 0 && entry2.start_sector < 64 && - entry2.end_sector > 0 && entry2.end_sector < 64 && - entry2.start_cylinder < 1024 && entry2.end_cylinder < 1024) - { - - } */ // As we don't know the maxium cyl, head or sect of the device we need LBA - else + /* else if(entry2.start_head < 255 && entry2.end_head < 255 && + entry2.start_sector > 0 && entry2.start_sector < 64 && + entry2.end_sector > 0 && entry2.end_sector < 64 && + entry2.start_cylinder < 1024 && entry2.end_cylinder < 1024) + { + + } */ // As we don't know the maxium cyl, head or sect of the device we need LBA + else ext_valid = false; - - if (ext_valid) + + if(ext_valid) { part.PartitionType = String.Format("0x{0:X2}", entry2.type); part.PartitionName = decodeMBRType(entry2.type); part.PartitionSequence = counter; part.PartitionDescription = entry2.status == 0x80 ? "Partition is bootable." : ""; - + counter++; - + partitions.Add(part); } } - - if (ext_extended) + + if(ext_extended) { break; } @@ -690,7 +690,7 @@ namespace DiscImageChef.PartPlugins } } } - + // An empty MBR may exist, NeXT creates one and then hardcodes its disklabel return partitions.Count != 0; } @@ -702,7 +702,7 @@ namespace DiscImageChef.PartPlugins static string decodeBSDType(byte type) { - switch (type) + switch(type) { case 1: return "Swap"; @@ -739,7 +739,7 @@ namespace DiscImageChef.PartPlugins static string decodeMBRType(byte type) { - switch (type) + switch(type) { case 0x01: return "FAT12"; @@ -1198,7 +1198,7 @@ namespace DiscImageChef.PartPlugins // volume mgt private partition static string decodeUNIXTAG(UInt16 type, bool isNew) { - switch (type) + switch(type) { case UNIX_TAG_EMPTY: return "Unused"; diff --git a/DiscImageChef.Partitions/NeXT.cs b/DiscImageChef.Partitions/NeXT.cs index b8d1d0f04..add32d470 100644 --- a/DiscImageChef.Partitions/NeXT.cs +++ b/DiscImageChef.Partitions/NeXT.cs @@ -67,50 +67,50 @@ namespace DiscImageChef.PartPlugins byte[] cString; bool magic_found; byte[] entry_sector; - + UInt32 magic; UInt32 sector_size; UInt16 front_porch; - if (imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448) + if(imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448) sector_size = 2048; else sector_size = imagePlugin.GetSectorSize(); - + partitions = new List(); entry_sector = imagePlugin.ReadSector(0); // Starts on sector 0 on NeXT machines, CDs and floppies magic = BigEndianBitConverter.ToUInt32(entry_sector, 0x00); - if (magic == NEXT_MAGIC1 || magic == NEXT_MAGIC2 || magic == NEXT_MAGIC3) + if(magic == NEXT_MAGIC1 || magic == NEXT_MAGIC2 || magic == NEXT_MAGIC3) magic_found = true; else { entry_sector = imagePlugin.ReadSector(15); // Starts on sector 15 on MBR machines magic = BigEndianBitConverter.ToUInt32(entry_sector, 0x00); - if (magic == NEXT_MAGIC1 || magic == NEXT_MAGIC2 || magic == NEXT_MAGIC3) + if(magic == NEXT_MAGIC1 || magic == NEXT_MAGIC2 || magic == NEXT_MAGIC3) magic_found = true; else { - if (sector_size == 2048) + if(sector_size == 2048) entry_sector = imagePlugin.ReadSector(4); // Starts on sector 4 on RISC CDs else entry_sector = imagePlugin.ReadSector(16); // Starts on sector 16 on RISC disks magic = BigEndianBitConverter.ToUInt32(entry_sector, 0x00); - - if (magic == NEXT_MAGIC1 || magic == NEXT_MAGIC2 || magic == NEXT_MAGIC3) + + if(magic == NEXT_MAGIC1 || magic == NEXT_MAGIC2 || magic == NEXT_MAGIC3) magic_found = true; else return false; } } - + front_porch = BigEndianBitConverter.ToUInt16(entry_sector, 0x6A); - if (magic_found) + if(magic_found) { - for (int i = 0; i < 8; i++) + for(int i = 0; i < 8; i++) { NeXTEntry entry = new NeXTEntry(); @@ -131,11 +131,11 @@ namespace DiscImageChef.PartPlugins Array.Copy(entry_sector, disktabStart + disktabEntrySize * i + 0x24, cString, 0, 8); entry.type = StringHandlers.CToString(cString); - if (entry.sectors > 0 && entry.sectors < 0xFFFFFFFF && entry.start < 0xFFFFFFFF) + if(entry.sectors > 0 && entry.sectors < 0xFFFFFFFF && entry.start < 0xFFFFFFFF) { CommonTypes.Partition part = new CommonTypes.Partition(); StringBuilder sb = new StringBuilder(); - + part.PartitionLength = (ulong)entry.sectors * sector_size; part.PartitionStart = ((ulong)entry.start + front_porch) * sector_size; part.PartitionType = entry.type; @@ -143,29 +143,29 @@ namespace DiscImageChef.PartPlugins part.PartitionName = entry.mount_point; part.PartitionSectors = (ulong)entry.sectors; part.PartitionStartSector = ((ulong)entry.start + front_porch); - + sb.AppendFormat("{0} bytes per block", entry.block_size).AppendLine(); sb.AppendFormat("{0} bytes per fragment", entry.frag_size).AppendLine(); - if (entry.optimization == 's') + if(entry.optimization == 's') sb.AppendLine("Space optimized"); - else if (entry.optimization == 't') + else if(entry.optimization == 't') sb.AppendLine("Time optimized"); else sb.AppendFormat("Unknown optimization {0:X2}", entry.optimization).AppendLine(); sb.AppendFormat("{0} cylinders per group", entry.cpg).AppendLine(); sb.AppendFormat("{0} bytes per inode", entry.bpi).AppendLine(); sb.AppendFormat("{0}% of space must be free at minimum", entry.freemin).AppendLine(); - if (entry.newfs != 1) // Seems to indicate newfs has been already run - sb.AppendLine("Filesystem should be formatted at start"); - if (entry.automount == 1) + if(entry.newfs != 1) // Seems to indicate newfs has been already run + sb.AppendLine("Filesystem should be formatted at start"); + if(entry.automount == 1) sb.AppendLine("Filesystem should be automatically mounted"); - + part.PartitionDescription = sb.ToString(); - + partitions.Add(part); } } - + return true; } return false; diff --git a/DiscImageChef.Partitions/RDB.cs b/DiscImageChef.Partitions/RDB.cs index 249a13632..0f606468d 100644 --- a/DiscImageChef.Partitions/RDB.cs +++ b/DiscImageChef.Partitions/RDB.cs @@ -897,9 +897,9 @@ namespace DiscImageChef.PartPlugins ulong RDBBlock = 0; bool foundRDB = false; - while (RDBBlock < 16 && !foundRDB) + while(RDBBlock < 16 && !foundRDB) { - if (imagePlugin.GetSectors() <= RDBBlock) + if(imagePlugin.GetSectors() <= RDBBlock) return false; byte[] tmpSector = imagePlugin.ReadSector(RDBBlock); @@ -907,18 +907,18 @@ namespace DiscImageChef.PartPlugins DicConsole.DebugWriteLine("Amiga RDB plugin", "Possible magic at block {0} is 0x{1:X8}", RDBBlock, magic); - if (magic == RigidDiskBlockMagic) + if(magic == RigidDiskBlockMagic) { DicConsole.DebugWriteLine("Amiga RDB plugin", "Found RDB magic at block {0}", RDBBlock); - + foundRDB = true; break; } - + RDBBlock++; } - if (!foundRDB) + if(!foundRDB) return false; byte[] sector; @@ -1061,14 +1061,14 @@ namespace DiscImageChef.PartPlugins // Reading BadBlock list List BadBlockChain = new List(); nextBlock = RDB.badblock_ptr; - while (nextBlock != 0xFFFFFFFF) + while(nextBlock != 0xFFFFFFFF) { DicConsole.DebugWriteLine("Amiga RDB plugin", "Going to block {0} in search of a BadBlock block", nextBlock); sector = imagePlugin.ReadSector(nextBlock); UInt32 magic = BigEndianBitConverter.ToUInt32(sector, 0); - if (magic != BadBlockListMagic) + if(magic != BadBlockListMagic) break; DicConsole.DebugWriteLine("Amiga RDB plugin", "Found BadBlock block"); @@ -1091,7 +1091,7 @@ namespace DiscImageChef.PartPlugins DicConsole.DebugWriteLine("Amiga RDB plugin", "chainEntry.next_ptr = {0}", chainEntry.next_ptr); DicConsole.DebugWriteLine("Amiga RDB plugin", "chainEntry.reserved = 0x{0:X8}", chainEntry.reserved); - for (ulong i = 0; i < entries; i++) + for(ulong i = 0; i < entries; i++) { chainEntry.blockPairs[i].badBlock = BigEndianBitConverter.ToUInt32(sector, (int)(0x18 + i * 8 + 0)); chainEntry.blockPairs[i].goodBlock = BigEndianBitConverter.ToUInt32(sector, (int)(0x18 + i * 8 + 4)); @@ -1107,14 +1107,14 @@ namespace DiscImageChef.PartPlugins // Reading BadBlock list List PartitionEntries = new List(); nextBlock = RDB.partition_ptr; - while (nextBlock != 0xFFFFFFFF) + while(nextBlock != 0xFFFFFFFF) { DicConsole.DebugWriteLine("Amiga RDB plugin", "Going to block {0} in search of a PartitionEntry block", nextBlock); sector = imagePlugin.ReadSector(nextBlock); UInt32 magic = BigEndianBitConverter.ToUInt32(sector, 0); - if (magic != PartitionBlockMagic) + if(magic != PartitionBlockMagic) break; DicConsole.DebugWriteLine("Amiga RDB plugin", "Found PartitionEntry block"); @@ -1227,14 +1227,14 @@ namespace DiscImageChef.PartPlugins List FSHDEntries = new List(); List SegmentEntries = new List(); nextBlock = RDB.fsheader_ptr; - while (nextBlock != 0xFFFFFFFF) + while(nextBlock != 0xFFFFFFFF) { DicConsole.DebugWriteLine("Amiga RDB plugin", "Going to block {0} in search of a FileSystemHeader block", nextBlock); sector = imagePlugin.ReadSector(nextBlock); UInt32 magic = BigEndianBitConverter.ToUInt32(sector, 0); - if (magic != FilesystemHeaderMagic) + if(magic != FilesystemHeaderMagic) break; DicConsole.DebugWriteLine("Amiga RDB plugin", "Found FileSystemHeader block"); @@ -1290,14 +1290,14 @@ namespace DiscImageChef.PartPlugins bool thereAreLoadSegments = false; Checksums.SHA1Context sha1Ctx = new Checksums.SHA1Context(); sha1Ctx.Init(); - while (nextBlock != 0xFFFFFFFF) + while(nextBlock != 0xFFFFFFFF) { DicConsole.DebugWriteLine("Amiga RDB plugin", "Going to block {0} in search of a LoadSegment block", nextBlock); sector = imagePlugin.ReadSector(nextBlock); UInt32 magicSeg = BigEndianBitConverter.ToUInt32(sector, 0); - if (magicSeg != LoadSegMagic) + if(magicSeg != LoadSegMagic) break; DicConsole.DebugWriteLine("Amiga RDB plugin", "Found LoadSegment block"); @@ -1323,7 +1323,7 @@ namespace DiscImageChef.PartPlugins sha1Ctx.Update(loadSeg.loadData); } - if (thereAreLoadSegments) + if(thereAreLoadSegments) { string loadSegSHA1 = sha1Ctx.End(); DicConsole.DebugWriteLine("Amiga RDB plugin", "LoadSegment data SHA1: {0}", loadSegSHA1); @@ -1334,7 +1334,7 @@ namespace DiscImageChef.PartPlugins } ulong sequence = 0; - foreach (PartitionEntry RDBEntry in PartitionEntries) + foreach(PartitionEntry RDBEntry in PartitionEntries) { CommonTypes.Partition entry = new CommonTypes.Partition(); @@ -1356,7 +1356,7 @@ namespace DiscImageChef.PartPlugins static string AmigaDOSTypeToDescriptionString(UInt32 AmigaDOSType) { - switch (AmigaDOSType) + switch(AmigaDOSType) { case TypeIDOFS: @@ -1443,35 +1443,35 @@ namespace DiscImageChef.PartPlugins default: { - if ((AmigaDOSType & TypeIDOFS) == TypeIDOFS) + if((AmigaDOSType & TypeIDOFS) == TypeIDOFS) return String.Format("Unknown Amiga DOS filesystem type {0}", AmigaDOSTypeToString(AmigaDOSType)); - if ((AmigaDOSType & TypeIDAMIXSysV) == TypeIDAMIXSysV) + if((AmigaDOSType & TypeIDAMIXSysV) == TypeIDAMIXSysV) return String.Format("Unknown Amiga UNIX filesystem type {0}", AmigaDOSTypeToString(AmigaDOSType)); - if ((AmigaDOSType & 0x50465300) == 0x50465300 || + if((AmigaDOSType & 0x50465300) == 0x50465300 || (AmigaDOSType & 0x41465300) == 0x41465300) return String.Format("Unknown ProfessionalFileSystem type {0}", AmigaDOSTypeToString(AmigaDOSType)); - if ((AmigaDOSType & TypeIDSFS) == TypeIDSFS) + if((AmigaDOSType & TypeIDSFS) == TypeIDSFS) return String.Format("Unknown SmartFileSystem type {0}", AmigaDOSTypeToString(AmigaDOSType)); - - if ((AmigaDOSType & TypeIDmuOFS) == TypeIDmuOFS) + + if((AmigaDOSType & TypeIDmuOFS) == TypeIDmuOFS) return String.Format("Unknown Amiga DOS multi-user filesystem type {0}", AmigaDOSTypeToString(AmigaDOSType)); - if ((AmigaDOSType & TypeIDOldBSDUnused) == TypeIDOldBSDUnused) + if((AmigaDOSType & TypeIDOldBSDUnused) == TypeIDOldBSDUnused) return String.Format("Unknown BSD filesystem type {0}", AmigaDOSTypeToString(AmigaDOSType)); - if ((AmigaDOSType & TypeIDNetBSDRootUnused) == TypeIDNetBSDRootUnused) + if((AmigaDOSType & TypeIDNetBSDRootUnused) == TypeIDNetBSDRootUnused) return String.Format("Unknown NetBSD root filesystem type {0}", AmigaDOSTypeToString(AmigaDOSType)); - if ((AmigaDOSType & TypeIDNetBSDUserUnused) == TypeIDNetBSDUserUnused) + if((AmigaDOSType & TypeIDNetBSDUserUnused) == TypeIDNetBSDUserUnused) return String.Format("Unknown NetBSD user filesystem type {0}", AmigaDOSTypeToString(AmigaDOSType)); - if ((AmigaDOSType & TypeIDNetBSDSwap) == TypeIDNetBSDSwap) + if((AmigaDOSType & TypeIDNetBSDSwap) == TypeIDNetBSDSwap) return String.Format("Unknown NetBSD swap filesystem type {0}", AmigaDOSTypeToString(AmigaDOSType)); - - if ((AmigaDOSType & TypeIDLinux) == TypeIDLinux || + + if((AmigaDOSType & TypeIDLinux) == TypeIDLinux || (AmigaDOSType & TypeIDLinuxSwap) == TypeIDLinuxSwap) return String.Format("Unknown Linux filesystem type {0}", AmigaDOSTypeToString(AmigaDOSType)); diff --git a/DiscImageChef.Partitions/Sun.cs b/DiscImageChef.Partitions/Sun.cs index 5257de1ef..dd533a084 100644 --- a/DiscImageChef.Partitions/Sun.cs +++ b/DiscImageChef.Partitions/Sun.cs @@ -102,18 +102,18 @@ namespace DiscImageChef.PartPlugins Array.Copy(sunSector, 0x80 + 0x04, tmpString, 0, 8); sdl.vtoc.volname = StringHandlers.CToString(tmpString); sdl.vtoc.nparts = BigEndianBitConverter.ToUInt16(sunSector, 0x80 + 0x0C); - for (int i = 0; i < 8; i++) + for(int i = 0; i < 8; i++) { sdl.vtoc.infos[i] = new SunInfo(); sdl.vtoc.infos[i].id = BigEndianBitConverter.ToUInt16(sunSector, 0x80 + 0x0E + i * 4 + 0x00); sdl.vtoc.infos[i].flags = BigEndianBitConverter.ToUInt16(sunSector, 0x80 + 0x0E + i * 4 + 0x02); } sdl.vtoc.padding = BigEndianBitConverter.ToUInt16(sunSector, 0x80 + 0x2E); - for (int i = 0; i < 3; i++) + for(int i = 0; i < 3; i++) sdl.vtoc.bootinfo[i] = BigEndianBitConverter.ToUInt32(sunSector, 0x80 + 0x30 + i * 4); sdl.vtoc.sanity = BigEndianBitConverter.ToUInt32(sunSector, 0x80 + 0x3C); Array.Copy(sunSector, 0x80 + 0x40, sdl.vtoc.reserved, 0, 40); - for (int i = 0; i < 8; i++) + for(int i = 0; i < 8; i++) sdl.vtoc.timestamp[i] = BigEndianBitConverter.ToUInt32(sunSector, 0x80 + 0x68 + i * 4); sdl.write_reinstruct = BigEndianBitConverter.ToUInt32(sunSector, 0x108); @@ -132,7 +132,7 @@ namespace DiscImageChef.PartPlugins sdl.bhead = BigEndianBitConverter.ToUInt16(sunSector, 0x1B8); sdl.ppart = BigEndianBitConverter.ToUInt16(sunSector, 0x1BA); - for (int i = 0; i < 8; i++) + for(int i = 0; i < 8; i++) { sdl.partitions[i] = new SunPartition(); sdl.partitions[i].start_cylinder = BigEndianBitConverter.ToUInt32(sunSector, 0x1BC + i * 8 + 0x00); @@ -143,23 +143,23 @@ namespace DiscImageChef.PartPlugins sdl.csum = BigEndianBitConverter.ToUInt16(sunSector, 0x1FE); ushort csum = 0; - for (int i = 0; i < 510; i += 2) + for(int i = 0; i < 510; i += 2) csum ^= BigEndianBitConverter.ToUInt16(sunSector, i); DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.info = {0}", sdl.info); DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.vtoc.version = {0}", sdl.vtoc.version); DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.vtoc.volname = {0}", sdl.vtoc.volname); DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.vtoc.nparts = {0}", sdl.vtoc.nparts); - for (int i = 0; i < 8; i++) + for(int i = 0; i < 8; i++) { DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.vtoc.infos[{1}].id = 0x{0:X4}", sdl.vtoc.infos[i].id, i); DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.vtoc.infos[{1}].flags = 0x{0:X4}", sdl.vtoc.infos[i].flags, i); } DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.vtoc.padding = 0x{0:X4}", sdl.vtoc.padding); - for (int i = 0; i < 3; i++) + for(int i = 0; i < 3; i++) DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.vtoc.bootinfo[{1}].id = 0x{0:X8}", sdl.vtoc.bootinfo[i], i); DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.vtoc.sanity = 0x{0:X8}", sdl.vtoc.sanity); - for (int i = 0; i < 8; i++) + for(int i = 0; i < 8; i++) DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.vtoc.timestamp[{1}] = 0x{0:X8}", sdl.vtoc.timestamp[i], i); DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.rspeed = {0}", sdl.rspeed); DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.pcylcount = {0}", sdl.pcylcount); @@ -173,7 +173,7 @@ namespace DiscImageChef.PartPlugins DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.nsect = {0}", sdl.nsect); DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.bhead = {0}", sdl.bhead); DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.ppart = {0}", sdl.ppart); - for (int i = 0; i < 8; i++) + for(int i = 0; i < 8; i++) { DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.partitions[{1}].start_cylinder = {0}", sdl.partitions[i].start_cylinder, i); DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.partitions[{1}].num_sectors = {0}", sdl.partitions[i].num_sectors, i); @@ -184,12 +184,12 @@ namespace DiscImageChef.PartPlugins ulong sectorsPerCylinder = (ulong)(sdl.nsect * sdl.ntrks); - if (sectorsPerCylinder == 0 || sectorsPerCylinder * sdl.pcylcount > imagePlugin.GetSectors() || sdl.magic != SUN_MAGIC) + if(sectorsPerCylinder == 0 || sectorsPerCylinder * sdl.pcylcount > imagePlugin.GetSectors() || sdl.magic != SUN_MAGIC) return false; - for (int i = 0; i < 8; i++) + for(int i = 0; i < 8; i++) { - if ((SunTypes)sdl.vtoc.infos[i].id != SunTypes.SunWholeDisk && sdl.partitions[i].num_sectors > 0) + if((SunTypes)sdl.vtoc.infos[i].id != SunTypes.SunWholeDisk && sdl.partitions[i].num_sectors > 0) { CommonTypes.Partition part = new CommonTypes.Partition(); part.PartitionDescription = SunFlagsToString((SunFlags)sdl.vtoc.infos[i].flags); @@ -201,7 +201,7 @@ namespace DiscImageChef.PartPlugins part.PartitionStartSector = sdl.partitions[i].start_cylinder * sectorsPerCylinder; part.PartitionType = SunIdToString((SunTypes)sdl.vtoc.infos[i].id); - if (part.PartitionStartSector > imagePlugin.GetSectors() || (part.PartitionStartSector + part.PartitionSectors) > imagePlugin.GetSectors()) + if(part.PartitionStartSector > imagePlugin.GetSectors() || (part.PartitionStartSector + part.PartitionSectors) > imagePlugin.GetSectors()) return false; partitions.Add(part); @@ -214,21 +214,21 @@ namespace DiscImageChef.PartPlugins public static string SunFlagsToString(SunFlags flags) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); - if (flags.HasFlag(SunFlags.NoMount)) + if(flags.HasFlag(SunFlags.NoMount)) sb.AppendLine("Unmountable"); - if (flags.HasFlag(SunFlags.ReadOnly)) + if(flags.HasFlag(SunFlags.ReadOnly)) sb.AppendLine("Read-only"); return sb.ToString(); } public static string SunIdToString(SunTypes id) { - switch (id) + switch(id) { case SunTypes.Linux: return "Linux"; case SunTypes.LinuxRaid: - return "Linux RAID"; + return "Linux RAID"; case SunTypes.LinuxSwap: return "Linux swap"; case SunTypes.LVM: diff --git a/DiscImageChef.Settings/Settings.cs b/DiscImageChef.Settings/Settings.cs index cced10a48..6eccbfb18 100644 --- a/DiscImageChef.Settings/Settings.cs +++ b/DiscImageChef.Settings/Settings.cs @@ -100,25 +100,25 @@ namespace DiscImageChef.Settings try { - switch (ptID) + switch(ptID) { case Interop.PlatformID.MacOSX: case Interop.PlatformID.iOS: { string appSupportPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Library", "Application Support", "Claunia.com"); - if (!Directory.Exists(appSupportPath)) + if(!Directory.Exists(appSupportPath)) Directory.CreateDirectory(appSupportPath); string dicPath = Path.Combine(appSupportPath, "DiscImageChef"); - if (!Directory.Exists(dicPath)) + if(!Directory.Exists(dicPath)) Directory.CreateDirectory(dicPath); reportsPath = Path.Combine(dicPath, "Reports"); - if (!Directory.Exists(reportsPath)) + if(!Directory.Exists(reportsPath)) Directory.CreateDirectory(reportsPath); statsPath = Path.Combine(dicPath, "Statistics"); - if (!Directory.Exists(statsPath)) + if(!Directory.Exists(statsPath)) Directory.CreateDirectory(statsPath); } break; @@ -129,41 +129,41 @@ namespace DiscImageChef.Settings case Interop.PlatformID.WindowsPhone: { string appSupportPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Claunia.com"); - if (!Directory.Exists(appSupportPath)) + if(!Directory.Exists(appSupportPath)) Directory.CreateDirectory(appSupportPath); string dicPath = Path.Combine(appSupportPath, "DiscImageChef"); - if (!Directory.Exists(dicPath)) + if(!Directory.Exists(dicPath)) Directory.CreateDirectory(dicPath); reportsPath = Path.Combine(dicPath, "Reports"); - if (!Directory.Exists(reportsPath)) + if(!Directory.Exists(reportsPath)) Directory.CreateDirectory(reportsPath); statsPath = Path.Combine(dicPath, "Statistics"); - if (!Directory.Exists(statsPath)) + if(!Directory.Exists(statsPath)) Directory.CreateDirectory(statsPath); } break; default: { string appSupportPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".claunia.com"); - if (!Directory.Exists(appSupportPath)) + if(!Directory.Exists(appSupportPath)) Directory.CreateDirectory(appSupportPath); string dicPath = Path.Combine(appSupportPath, "DiscImageChef"); - if (!Directory.Exists(dicPath)) + if(!Directory.Exists(dicPath)) Directory.CreateDirectory(dicPath); reportsPath = Path.Combine(dicPath, "Reports"); - if (!Directory.Exists(reportsPath)) + if(!Directory.Exists(reportsPath)) Directory.CreateDirectory(reportsPath); statsPath = Path.Combine(dicPath, "Statistics"); - if (!Directory.Exists(statsPath)) + if(!Directory.Exists(statsPath)) Directory.CreateDirectory(statsPath); } - break; + break; } } catch @@ -173,7 +173,7 @@ namespace DiscImageChef.Settings try { - switch (ptID) + switch(ptID) { case Interop.PlatformID.MacOSX: case Interop.PlatformID.iOS: @@ -181,25 +181,25 @@ namespace DiscImageChef.Settings string preferencesPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Library", "Preferences"); string preferencesFilePath = Path.Combine(preferencesPath, "com.claunia.discimagechef.plist"); - if (!File.Exists(preferencesFilePath)) + if(!File.Exists(preferencesFilePath)) { SetDefaultSettings(); SaveSettings(); } NSDictionary parsedPreferences = (NSDictionary)BinaryPropertyListParser.Parse(new FileInfo(preferencesFilePath)); - if (parsedPreferences != null) + if(parsedPreferences != null) { NSObject obj; - if (parsedPreferences.TryGetValue("SaveReportsGlobally", out obj)) + if(parsedPreferences.TryGetValue("SaveReportsGlobally", out obj)) { Current.SaveReportsGlobally = ((NSNumber)obj).ToBool(); } else Current.SaveReportsGlobally = false; - if (parsedPreferences.TryGetValue("ShareReports", out obj)) + if(parsedPreferences.TryGetValue("ShareReports", out obj)) { Current.ShareReports = ((NSNumber)obj).ToBool(); } @@ -207,79 +207,79 @@ namespace DiscImageChef.Settings Current.ShareReports = false; NSDictionary stats; - if (parsedPreferences.TryGetValue("Stats", out obj)) + if(parsedPreferences.TryGetValue("Stats", out obj)) { stats = (NSDictionary)obj; - if (stats != null) + if(stats != null) { NSObject obj2; Current.Stats = new StatsSettings(); - if (stats.TryGetValue("ShareStats", out obj2)) + if(stats.TryGetValue("ShareStats", out obj2)) { Current.Stats.ShareStats = ((NSNumber)obj2).ToBool(); } else Current.Stats.ShareStats = false; - if (stats.TryGetValue("BenchmarkStats", out obj2)) + if(stats.TryGetValue("BenchmarkStats", out obj2)) { Current.Stats.BenchmarkStats = ((NSNumber)obj2).ToBool(); } else Current.Stats.BenchmarkStats = false; - if (stats.TryGetValue("CommandStats", out obj2)) + if(stats.TryGetValue("CommandStats", out obj2)) { Current.Stats.CommandStats = ((NSNumber)obj2).ToBool(); } else Current.Stats.CommandStats = false; - if (stats.TryGetValue("DeviceStats", out obj2)) + if(stats.TryGetValue("DeviceStats", out obj2)) { Current.Stats.DeviceStats = ((NSNumber)obj2).ToBool(); } else Current.Stats.DeviceStats = false; - if (stats.TryGetValue("FilesystemStats", out obj2)) + if(stats.TryGetValue("FilesystemStats", out obj2)) { Current.Stats.FilesystemStats = ((NSNumber)obj2).ToBool(); } else Current.Stats.FilesystemStats = false; - if (stats.TryGetValue("MediaImageStats", out obj2)) + if(stats.TryGetValue("MediaImageStats", out obj2)) { Current.Stats.MediaImageStats = ((NSNumber)obj2).ToBool(); } else Current.Stats.MediaImageStats = false; - if (stats.TryGetValue("MediaScanStats", out obj2)) + if(stats.TryGetValue("MediaScanStats", out obj2)) { Current.Stats.MediaScanStats = ((NSNumber)obj2).ToBool(); } else Current.Stats.MediaScanStats = false; - if (stats.TryGetValue("PartitionStats", out obj2)) + if(stats.TryGetValue("PartitionStats", out obj2)) { Current.Stats.PartitionStats = ((NSNumber)obj2).ToBool(); } else Current.Stats.PartitionStats = false; - if (stats.TryGetValue("MediaStats", out obj2)) + if(stats.TryGetValue("MediaStats", out obj2)) { Current.Stats.MediaStats = ((NSNumber)obj2).ToBool(); } else Current.Stats.MediaStats = false; - if (stats.TryGetValue("VerifyStats", out obj2)) + if(stats.TryGetValue("VerifyStats", out obj2)) { Current.Stats.VerifyStats = ((NSNumber)obj2).ToBool(); } @@ -304,7 +304,7 @@ namespace DiscImageChef.Settings case Interop.PlatformID.WindowsPhone: { RegistryKey parentKey = Registry.CurrentUser.OpenSubKey("SOFTWARE").OpenSubKey("Claunia.com"); - if (parentKey == null) + if(parentKey == null) { SetDefaultSettings(); SaveSettings(); @@ -312,7 +312,7 @@ namespace DiscImageChef.Settings } RegistryKey key = parentKey.OpenSubKey("DiscImageChef"); - if (key == null) + if(key == null) { SetDefaultSettings(); SaveSettings(); @@ -323,7 +323,7 @@ namespace DiscImageChef.Settings Current.ShareReports = Convert.ToBoolean(key.GetValue("ShareReports")); bool stats = Convert.ToBoolean(key.GetValue("Statistics")); - if (stats) + if(stats) { Current.Stats = new StatsSettings(); Current.Stats.ShareStats = Convert.ToBoolean(key.GetValue("ShareStats")); @@ -345,7 +345,7 @@ namespace DiscImageChef.Settings string configPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".config"); string settingsPath = Path.Combine(configPath, "DiscImageChef.xml"); - if (!Directory.Exists(configPath)) + if(!Directory.Exists(configPath)) { SetDefaultSettings(); SaveSettings(); @@ -372,7 +372,7 @@ namespace DiscImageChef.Settings { Interop.PlatformID ptID = DetectOS.GetRealPlatformID(); - switch (ptID) + switch(ptID) { case Interop.PlatformID.MacOSX: case Interop.PlatformID.iOS: @@ -380,7 +380,7 @@ namespace DiscImageChef.Settings NSDictionary root = new NSDictionary(); root.Add("SaveReportsGlobally", Current.SaveReportsGlobally); root.Add("ShareReports", Current.ShareReports); - if (Current.Stats != null) + if(Current.Stats != null) { NSDictionary stats = new NSDictionary(); stats.Add("ShareStats", Current.Stats.ShareStats); @@ -416,7 +416,7 @@ namespace DiscImageChef.Settings key.SetValue("SaveReportsGlobally", Current.SaveReportsGlobally); key.SetValue("ShareReports", Current.ShareReports); - if (Current.Stats != null) + if(Current.Stats != null) { key.SetValue("Statistics", true); key.SetValue("ShareStats", Current.Stats.ShareStats); @@ -451,7 +451,7 @@ namespace DiscImageChef.Settings string configPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".config"); string settingsPath = Path.Combine(configPath, "DiscImageChef.xml"); - if (!Directory.Exists(configPath)) + if(!Directory.Exists(configPath)) Directory.CreateDirectory(configPath); FileStream fs = new FileStream(settingsPath, FileMode.Create); diff --git a/DiscImageChef/Commands/Analyze.cs b/DiscImageChef/Commands/Analyze.cs index e10522aca..b40eafd35 100644 --- a/DiscImageChef/Commands/Analyze.cs +++ b/DiscImageChef/Commands/Analyze.cs @@ -54,7 +54,7 @@ namespace DiscImageChef.Commands DicConsole.DebugWriteLine("Analyze command", "--filesystems={0}", options.SearchForFilesystems); DicConsole.DebugWriteLine("Analyze command", "--partitions={0}", options.SearchForPartitions); - if (!System.IO.File.Exists(options.InputFile)) + if(!System.IO.File.Exists(options.InputFile)) { DicConsole.ErrorWriteLine("Specified file does not exist."); return; @@ -88,7 +88,7 @@ namespace DiscImageChef.Commands try { - if (!_imageFormat.OpenImage(options.InputFile)) + if(!_imageFormat.OpenImage(options.InputFile)) { DicConsole.WriteLine("Unable to open image format"); DicConsole.WriteLine("No error given"); @@ -103,23 +103,23 @@ namespace DiscImageChef.Commands Core.Statistics.AddMediaFormat(_imageFormat.GetImageFormat()); Core.Statistics.AddMedia(_imageFormat.ImageInfo.mediaType, false); } - catch (Exception ex) + catch(Exception ex) { DicConsole.ErrorWriteLine("Unable to open image format"); DicConsole.ErrorWriteLine("Error: {0}", ex.Message); return; } - if (options.SearchForPartitions) + if(options.SearchForPartitions) { List partitions = new List(); string partition_scheme = ""; // TODO: Solve possibility of multiple partition schemes (CUE + MBR, MBR + RDB, CUE + APM, etc) - foreach (PartPlugin _partplugin in plugins.PartPluginsList.Values) + foreach(PartPlugin _partplugin in plugins.PartPluginsList.Values) { List _partitions; - if (_partplugin.GetInformation(_imageFormat, out _partitions)) + if(_partplugin.GetInformation(_imageFormat, out _partitions)) { partition_scheme = _partplugin.Name; partitions.AddRange(_partitions); @@ -127,16 +127,16 @@ namespace DiscImageChef.Commands } } - if (_imageFormat.ImageHasPartitions()) + if(_imageFormat.ImageHasPartitions()) { partition_scheme = _imageFormat.GetImageFormat(); partitions.AddRange(_imageFormat.GetPartitions()); } - if (partition_scheme == "") + if(partition_scheme == "") { DicConsole.DebugWriteLine("Analyze command", "No partitions found"); - if (!options.SearchForFilesystems) + if(!options.SearchForFilesystems) { DicConsole.WriteLine("No partitions founds, not searching for filesystems"); return; @@ -148,34 +148,34 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Partition scheme identified as {0}", partition_scheme); DicConsole.WriteLine("{0} partitions found.", partitions.Count); - for (int i = 0; i < partitions.Count; i++) + for(int i = 0; i < partitions.Count; i++) { DicConsole.WriteLine(); - DicConsole.WriteLine("Partition {0}:", partitions[i].PartitionSequence); - DicConsole.WriteLine("Partition name: {0}", partitions[i].PartitionName); - DicConsole.WriteLine("Partition type: {0}", partitions[i].PartitionType); - DicConsole.WriteLine("Partition start: sector {0}, byte {1}", partitions[i].PartitionStartSector, partitions[i].PartitionStart); - DicConsole.WriteLine("Partition length: {0} sectors, {1} bytes", partitions[i].PartitionSectors, partitions[i].PartitionLength); - DicConsole.WriteLine("Partition description:"); + DicConsole.WriteLine("Partition {0}:", partitions[i].PartitionSequence); + DicConsole.WriteLine("Partition name: {0}", partitions[i].PartitionName); + DicConsole.WriteLine("Partition type: {0}", partitions[i].PartitionType); + DicConsole.WriteLine("Partition start: sector {0}, byte {1}", partitions[i].PartitionStartSector, partitions[i].PartitionStart); + DicConsole.WriteLine("Partition length: {0} sectors, {1} bytes", partitions[i].PartitionSectors, partitions[i].PartitionLength); + DicConsole.WriteLine("Partition description:"); DicConsole.WriteLine(partitions[i].PartitionDescription); - if (options.SearchForFilesystems) + if(options.SearchForFilesystems) { DicConsole.WriteLine("Identifying filesystem on partition"); - IdentifyFilesystems(_imageFormat, out id_plugins, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector+partitions[i].PartitionSectors); - if (id_plugins.Count == 0) + IdentifyFilesystems(_imageFormat, out id_plugins, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector + partitions[i].PartitionSectors); + if(id_plugins.Count == 0) DicConsole.WriteLine("Filesystem not identified"); - else if (id_plugins.Count > 1) + else if(id_plugins.Count > 1) { DicConsole.WriteLine(String.Format("Identified by {0} plugins", id_plugins.Count)); - foreach (string plugin_name in id_plugins) + foreach(string plugin_name in id_plugins) { - if (plugins.PluginsList.TryGetValue(plugin_name, out _plugin)) + if(plugins.PluginsList.TryGetValue(plugin_name, out _plugin)) { DicConsole.WriteLine(String.Format("As identified by {0}.", _plugin.Name)); - _plugin.GetInformation(_imageFormat, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector+partitions[i].PartitionSectors, out information); + _plugin.GetInformation(_imageFormat, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector + partitions[i].PartitionSectors, out information); DicConsole.Write(information); Core.Statistics.AddFilesystem(_plugin.XmlFSType.Type); } @@ -185,7 +185,7 @@ namespace DiscImageChef.Commands { plugins.PluginsList.TryGetValue(id_plugins[0], out _plugin); DicConsole.WriteLine(String.Format("Identified by {0}.", _plugin.Name)); - _plugin.GetInformation(_imageFormat, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector+partitions[i].PartitionSectors, out information); + _plugin.GetInformation(_imageFormat, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector + partitions[i].PartitionSectors, out information); DicConsole.Write(information); Core.Statistics.AddFilesystem(_plugin.XmlFSType.Type); } @@ -194,21 +194,21 @@ namespace DiscImageChef.Commands } } - if (checkraw) + if(checkraw) { - IdentifyFilesystems(_imageFormat, out id_plugins, 0, _imageFormat.GetSectors()-1); - if (id_plugins.Count == 0) + IdentifyFilesystems(_imageFormat, out id_plugins, 0, _imageFormat.GetSectors() - 1); + if(id_plugins.Count == 0) DicConsole.WriteLine("Filesystem not identified"); - else if (id_plugins.Count > 1) + else if(id_plugins.Count > 1) { DicConsole.WriteLine(String.Format("Identified by {0} plugins", id_plugins.Count)); - foreach (string plugin_name in id_plugins) + foreach(string plugin_name in id_plugins) { - if (plugins.PluginsList.TryGetValue(plugin_name, out _plugin)) + if(plugins.PluginsList.TryGetValue(plugin_name, out _plugin)) { DicConsole.WriteLine(String.Format("As identified by {0}.", _plugin.Name)); - _plugin.GetInformation(_imageFormat, 0, _imageFormat.GetSectors()-1, out information); + _plugin.GetInformation(_imageFormat, 0, _imageFormat.GetSectors() - 1, out information); DicConsole.Write(information); Core.Statistics.AddFilesystem(_plugin.XmlFSType.Type); } @@ -218,13 +218,13 @@ namespace DiscImageChef.Commands { plugins.PluginsList.TryGetValue(id_plugins[0], out _plugin); DicConsole.WriteLine(String.Format("Identified by {0}.", _plugin.Name)); - _plugin.GetInformation(_imageFormat, 0, _imageFormat.GetSectors()-1, out information); + _plugin.GetInformation(_imageFormat, 0, _imageFormat.GetSectors() - 1, out information); DicConsole.Write(information); Core.Statistics.AddFilesystem(_plugin.XmlFSType.Type); } } } - catch (Exception ex) + catch(Exception ex) { DicConsole.ErrorWriteLine(String.Format("Error reading file: {0}", ex.Message)); DicConsole.DebugWriteLine("Analyze command", ex.StackTrace); @@ -239,9 +239,9 @@ namespace DiscImageChef.Commands PluginBase plugins = new PluginBase(); plugins.RegisterAllPlugins(); - foreach (Plugin _plugin in plugins.PluginsList.Values) + foreach(Plugin _plugin in plugins.PluginsList.Values) { - if (_plugin.Identify(imagePlugin, partitionStart, partitionEnd)) + if(_plugin.Identify(imagePlugin, partitionStart, partitionEnd)) id_plugins.Add(_plugin.Name.ToLower()); } } diff --git a/DiscImageChef/Commands/Benchmark.cs b/DiscImageChef/Commands/Benchmark.cs index 2af5d04f1..0d735a74a 100644 --- a/DiscImageChef/Commands/Benchmark.cs +++ b/DiscImageChef/Commands/Benchmark.cs @@ -62,7 +62,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine(); start = DateTime.Now; - for (int i = 0; i < bufferSize / options.BlockSize; i++) + for(int i = 0; i < bufferSize / options.BlockSize; i++) { DicConsole.Write("\rWriting block {0} of {1} with random data.", i + 1, bufferSize / options.BlockSize); byte[] tmp = new byte[options.BlockSize]; @@ -76,12 +76,12 @@ namespace DiscImageChef.Commands ms.Seek(0, SeekOrigin.Begin); mem = GC.GetTotalMemory(false); - if (mem > maxMemory) + if(mem > maxMemory) maxMemory = mem; - if (mem < minMemory) + if(mem < minMemory) minMemory = mem; start = DateTime.Now; - for (int i = 0; i < bufferSize / options.BlockSize; i++) + for(int i = 0; i < bufferSize / options.BlockSize; i++) { DicConsole.Write("\rReading block {0} of {1}.", i + 1, bufferSize / options.BlockSize); byte[] tmp = new byte[options.BlockSize]; @@ -89,9 +89,9 @@ namespace DiscImageChef.Commands } end = DateTime.Now; mem = GC.GetTotalMemory(false); - if (mem > maxMemory) + if(mem > maxMemory) maxMemory = mem; - if (mem < minMemory) + if(mem < minMemory) minMemory = mem; DicConsole.WriteLine(); @@ -102,12 +102,12 @@ namespace DiscImageChef.Commands ((Adler32Context)ctx).Init(); ms.Seek(0, SeekOrigin.Begin); mem = GC.GetTotalMemory(false); - if (mem > maxMemory) + if(mem > maxMemory) maxMemory = mem; - if (mem < minMemory) + if(mem < minMemory) minMemory = mem; start = DateTime.Now; - for (int i = 0; i < bufferSize / options.BlockSize; i++) + for(int i = 0; i < bufferSize / options.BlockSize; i++) { DicConsole.Write("\rChecksumming block {0} of {1} with Adler32.", i + 1, bufferSize / options.BlockSize); byte[] tmp = new byte[options.BlockSize]; @@ -117,9 +117,9 @@ namespace DiscImageChef.Commands ((Adler32Context)ctx).End(); end = DateTime.Now; mem = GC.GetTotalMemory(false); - if (mem > maxMemory) + if(mem > maxMemory) maxMemory = mem; - if (mem < minMemory) + if(mem < minMemory) minMemory = mem; DicConsole.WriteLine(); @@ -133,12 +133,12 @@ namespace DiscImageChef.Commands ((CRC16Context)ctx).Init(); ms.Seek(0, SeekOrigin.Begin); mem = GC.GetTotalMemory(false); - if (mem > maxMemory) + if(mem > maxMemory) maxMemory = mem; - if (mem < minMemory) + if(mem < minMemory) minMemory = mem; start = DateTime.Now; - for (int i = 0; i < bufferSize / options.BlockSize; i++) + for(int i = 0; i < bufferSize / options.BlockSize; i++) { DicConsole.Write("\rChecksumming block {0} of {1} with CRC16.", i + 1, bufferSize / options.BlockSize); byte[] tmp = new byte[options.BlockSize]; @@ -148,9 +148,9 @@ namespace DiscImageChef.Commands ((CRC16Context)ctx).End(); end = DateTime.Now; mem = GC.GetTotalMemory(false); - if (mem > maxMemory) + if(mem > maxMemory) maxMemory = mem; - if (mem < minMemory) + if(mem < minMemory) minMemory = mem; DicConsole.WriteLine(); @@ -164,12 +164,12 @@ namespace DiscImageChef.Commands ((CRC32Context)ctx).Init(); ms.Seek(0, SeekOrigin.Begin); mem = GC.GetTotalMemory(false); - if (mem > maxMemory) + if(mem > maxMemory) maxMemory = mem; - if (mem < minMemory) + if(mem < minMemory) minMemory = mem; start = DateTime.Now; - for (int i = 0; i < bufferSize / options.BlockSize; i++) + for(int i = 0; i < bufferSize / options.BlockSize; i++) { DicConsole.Write("\rChecksumming block {0} of {1} with CRC32.", i + 1, bufferSize / options.BlockSize); byte[] tmp = new byte[options.BlockSize]; @@ -179,9 +179,9 @@ namespace DiscImageChef.Commands ((CRC32Context)ctx).End(); end = DateTime.Now; mem = GC.GetTotalMemory(false); - if (mem > maxMemory) + if(mem > maxMemory) maxMemory = mem; - if (mem < minMemory) + if(mem < minMemory) minMemory = mem; DicConsole.WriteLine(); @@ -195,12 +195,12 @@ namespace DiscImageChef.Commands ((CRC64Context)ctx).Init(); ms.Seek(0, SeekOrigin.Begin); mem = GC.GetTotalMemory(false); - if (mem > maxMemory) + if(mem > maxMemory) maxMemory = mem; - if (mem < minMemory) + if(mem < minMemory) minMemory = mem; start = DateTime.Now; - for (int i = 0; i < bufferSize / options.BlockSize; i++) + for(int i = 0; i < bufferSize / options.BlockSize; i++) { DicConsole.Write("\rChecksumming block {0} of {1} with CRC64.", i + 1, bufferSize / options.BlockSize); byte[] tmp = new byte[options.BlockSize]; @@ -210,9 +210,9 @@ namespace DiscImageChef.Commands ((CRC64Context)ctx).End(); end = DateTime.Now; mem = GC.GetTotalMemory(false); - if (mem > maxMemory) + if(mem > maxMemory) maxMemory = mem; - if (mem < minMemory) + if(mem < minMemory) minMemory = mem; DicConsole.WriteLine(); @@ -257,12 +257,12 @@ namespace DiscImageChef.Commands ((MD5Context)ctx).Init(); ms.Seek(0, SeekOrigin.Begin); mem = GC.GetTotalMemory(false); - if (mem > maxMemory) + if(mem > maxMemory) maxMemory = mem; - if (mem < minMemory) + if(mem < minMemory) minMemory = mem; start = DateTime.Now; - for (int i = 0; i < bufferSize / options.BlockSize; i++) + for(int i = 0; i < bufferSize / options.BlockSize; i++) { DicConsole.Write("\rChecksumming block {0} of {1} with MD5.", i + 1, bufferSize / options.BlockSize); byte[] tmp = new byte[options.BlockSize]; @@ -272,9 +272,9 @@ namespace DiscImageChef.Commands ((MD5Context)ctx).End(); end = DateTime.Now; mem = GC.GetTotalMemory(false); - if (mem > maxMemory) + if(mem > maxMemory) maxMemory = mem; - if (mem < minMemory) + if(mem < minMemory) minMemory = mem; DicConsole.WriteLine(); @@ -288,12 +288,12 @@ namespace DiscImageChef.Commands ((RIPEMD160Context)ctx).Init(); ms.Seek(0, SeekOrigin.Begin); mem = GC.GetTotalMemory(false); - if (mem > maxMemory) + if(mem > maxMemory) maxMemory = mem; - if (mem < minMemory) + if(mem < minMemory) minMemory = mem; start = DateTime.Now; - for (int i = 0; i < bufferSize / options.BlockSize; i++) + for(int i = 0; i < bufferSize / options.BlockSize; i++) { DicConsole.Write("\rChecksumming block {0} of {1} with RIPEMD160.", i + 1, bufferSize / options.BlockSize); byte[] tmp = new byte[options.BlockSize]; @@ -303,9 +303,9 @@ namespace DiscImageChef.Commands ((RIPEMD160Context)ctx).End(); end = DateTime.Now; mem = GC.GetTotalMemory(false); - if (mem > maxMemory) + if(mem > maxMemory) maxMemory = mem; - if (mem < minMemory) + if(mem < minMemory) minMemory = mem; DicConsole.WriteLine(); @@ -319,12 +319,12 @@ namespace DiscImageChef.Commands ((SHA1Context)ctx).Init(); ms.Seek(0, SeekOrigin.Begin); mem = GC.GetTotalMemory(false); - if (mem > maxMemory) + if(mem > maxMemory) maxMemory = mem; - if (mem < minMemory) + if(mem < minMemory) minMemory = mem; start = DateTime.Now; - for (int i = 0; i < bufferSize / options.BlockSize; i++) + for(int i = 0; i < bufferSize / options.BlockSize; i++) { DicConsole.Write("\rChecksumming block {0} of {1} with SHA1.", i + 1, bufferSize / options.BlockSize); byte[] tmp = new byte[options.BlockSize]; @@ -334,9 +334,9 @@ namespace DiscImageChef.Commands ((SHA1Context)ctx).End(); end = DateTime.Now; mem = GC.GetTotalMemory(false); - if (mem > maxMemory) + if(mem > maxMemory) maxMemory = mem; - if (mem < minMemory) + if(mem < minMemory) minMemory = mem; DicConsole.WriteLine(); @@ -350,12 +350,12 @@ namespace DiscImageChef.Commands ((SHA256Context)ctx).Init(); ms.Seek(0, SeekOrigin.Begin); mem = GC.GetTotalMemory(false); - if (mem > maxMemory) + if(mem > maxMemory) maxMemory = mem; - if (mem < minMemory) + if(mem < minMemory) minMemory = mem; start = DateTime.Now; - for (int i = 0; i < bufferSize / options.BlockSize; i++) + for(int i = 0; i < bufferSize / options.BlockSize; i++) { DicConsole.Write("\rChecksumming block {0} of {1} with SHA256.", i + 1, bufferSize / options.BlockSize); byte[] tmp = new byte[options.BlockSize]; @@ -365,9 +365,9 @@ namespace DiscImageChef.Commands ((SHA256Context)ctx).End(); end = DateTime.Now; mem = GC.GetTotalMemory(false); - if (mem > maxMemory) + if(mem > maxMemory) maxMemory = mem; - if (mem < minMemory) + if(mem < minMemory) minMemory = mem; DicConsole.WriteLine(); @@ -381,12 +381,12 @@ namespace DiscImageChef.Commands ((SHA384Context)ctx).Init(); ms.Seek(0, SeekOrigin.Begin); mem = GC.GetTotalMemory(false); - if (mem > maxMemory) + if(mem > maxMemory) maxMemory = mem; - if (mem < minMemory) + if(mem < minMemory) minMemory = mem; start = DateTime.Now; - for (int i = 0; i < bufferSize / options.BlockSize; i++) + for(int i = 0; i < bufferSize / options.BlockSize; i++) { DicConsole.Write("\rChecksumming block {0} of {1} with SHA384.", i + 1, bufferSize / options.BlockSize); byte[] tmp = new byte[options.BlockSize]; @@ -396,9 +396,9 @@ namespace DiscImageChef.Commands ((SHA384Context)ctx).End(); end = DateTime.Now; mem = GC.GetTotalMemory(false); - if (mem > maxMemory) + if(mem > maxMemory) maxMemory = mem; - if (mem < minMemory) + if(mem < minMemory) minMemory = mem; DicConsole.WriteLine(); @@ -412,12 +412,12 @@ namespace DiscImageChef.Commands ((SHA512Context)ctx).Init(); ms.Seek(0, SeekOrigin.Begin); mem = GC.GetTotalMemory(false); - if (mem > maxMemory) + if(mem > maxMemory) maxMemory = mem; - if (mem < minMemory) + if(mem < minMemory) minMemory = mem; start = DateTime.Now; - for (int i = 0; i < bufferSize / options.BlockSize; i++) + for(int i = 0; i < bufferSize / options.BlockSize; i++) { DicConsole.Write("\rChecksumming block {0} of {1} with SHA512.", i + 1, bufferSize / options.BlockSize); byte[] tmp = new byte[options.BlockSize]; @@ -427,9 +427,9 @@ namespace DiscImageChef.Commands ((SHA512Context)ctx).End(); end = DateTime.Now; mem = GC.GetTotalMemory(false); - if (mem > maxMemory) + if(mem > maxMemory) maxMemory = mem; - if (mem < minMemory) + if(mem < minMemory) minMemory = mem; DicConsole.WriteLine(); @@ -443,12 +443,12 @@ namespace DiscImageChef.Commands ((SpamSumContext)ctx).Init(); ms.Seek(0, SeekOrigin.Begin); mem = GC.GetTotalMemory(false); - if (mem > maxMemory) + if(mem > maxMemory) maxMemory = mem; - if (mem < minMemory) + if(mem < minMemory) minMemory = mem; start = DateTime.Now; - for (int i = 0; i < bufferSize / options.BlockSize; i++) + for(int i = 0; i < bufferSize / options.BlockSize; i++) { DicConsole.Write("\rChecksumming block {0} of {1} with SpamSum.", i + 1, bufferSize / options.BlockSize); byte[] tmp = new byte[options.BlockSize]; @@ -458,9 +458,9 @@ namespace DiscImageChef.Commands ((SpamSumContext)ctx).End(); end = DateTime.Now; mem = GC.GetTotalMemory(false); - if (mem > maxMemory) + if(mem > maxMemory) maxMemory = mem; - if (mem < minMemory) + if(mem < minMemory) minMemory = mem; DicConsole.WriteLine(); @@ -473,30 +473,30 @@ namespace DiscImageChef.Commands ulong[] entTable = new ulong[256]; ms.Seek(0, SeekOrigin.Begin); mem = GC.GetTotalMemory(false); - if (mem > maxMemory) + if(mem > maxMemory) maxMemory = mem; - if (mem < minMemory) + if(mem < minMemory) minMemory = mem; start = DateTime.Now; - for (int i = 0; i < bufferSize / options.BlockSize; i++) + for(int i = 0; i < bufferSize / options.BlockSize; i++) { DicConsole.Write("\rEntropying block {0} of {1}.", i + 1, bufferSize / options.BlockSize); byte[] tmp = new byte[options.BlockSize]; ms.Read(tmp, 0, options.BlockSize); - foreach (byte b in tmp) + foreach(byte b in tmp) entTable[b]++; } double entropy = 0; - foreach (ulong l in entTable) + foreach(ulong l in entTable) { double frequency = (double)l / (double)bufferSize; entropy += -(frequency * Math.Log(frequency, 2)); } end = DateTime.Now; mem = GC.GetTotalMemory(false); - if (mem > maxMemory) + if(mem > maxMemory) maxMemory = mem; - if (mem < minMemory) + if(mem < minMemory) minMemory = mem; DicConsole.WriteLine(); @@ -510,8 +510,8 @@ namespace DiscImageChef.Commands CRC16Context crc16ctx = new CRC16Context(); CRC32Context crc32ctx = new CRC32Context(); CRC64Context crc64ctx = new CRC64Context(); - //Fletcher16Context fletcher16ctx = new Fletcher16Context(); - //Fletcher32Context fletcher32ctx = new Fletcher32Context(); + //Fletcher16Context fletcher16ctx = new Fletcher16Context(); + //Fletcher32Context fletcher32ctx = new Fletcher32Context(); MD5Context md5ctx = new MD5Context(); RIPEMD160Context ripemd160ctx = new RIPEMD160Context(); SHA1Context sha1ctx = new SHA1Context(); @@ -524,8 +524,8 @@ namespace DiscImageChef.Commands Thread crc16Thread = new Thread(updateCRC16); Thread crc32Thread = new Thread(updateCRC32); Thread crc64Thread = new Thread(updateCRC64); - //Thread fletcher16Thread = new Thread(updateFletcher16); - //Thread fletcher32Thread = new Thread(updateFletcher32); + //Thread fletcher16Thread = new Thread(updateFletcher16); + //Thread fletcher32Thread = new Thread(updateFletcher32); Thread md5Thread = new Thread(updateMD5); Thread ripemd160Thread = new Thread(updateRIPEMD160); Thread sha1Thread = new Thread(updateSHA1); @@ -538,8 +538,8 @@ namespace DiscImageChef.Commands crc16Packet crc16Pkt = new crc16Packet(); crc32Packet crc32Pkt = new crc32Packet(); crc64Packet crc64Pkt = new crc64Packet(); - //fletcher16Packet fletcher16Pkt = new fletcher16Packet(); - //fletcher32Packet fletcher32Pkt = new fletcher32Packet(); + //fletcher16Packet fletcher16Pkt = new fletcher16Packet(); + //fletcher32Packet fletcher32Pkt = new fletcher32Packet(); md5Packet md5Pkt = new md5Packet(); ripemd160Packet ripemd160Pkt = new ripemd160Packet(); sha1Packet sha1Pkt = new sha1Packet(); @@ -557,10 +557,10 @@ namespace DiscImageChef.Commands crc32Pkt.context = crc32ctx; crc64ctx.Init(); crc64Pkt.context = crc64ctx; - //fletcher16ctx.Init(); - //fletcher16Pkt.context = fletcher16ctx; - //fletcher32ctx.Init(); - //fletcher32Pkt.context = fletcher32ctx; + //fletcher16ctx.Init(); + //fletcher16Pkt.context = fletcher16ctx; + //fletcher32ctx.Init(); + //fletcher32Pkt.context = fletcher32ctx; md5ctx.Init(); md5Pkt.context = md5ctx; ripemd160ctx.Init(); @@ -576,7 +576,7 @@ namespace DiscImageChef.Commands ssctx.Init(); spamsumPkt.context = ssctx; - for (int i = 0; i < bufferSize / options.BlockSize; i++) + for(int i = 0; i < bufferSize / options.BlockSize; i++) { DicConsole.Write("\rChecksumming block {0} of {1} with all algorithms at the same time.", i + 1, bufferSize / options.BlockSize); byte[] tmp = new byte[options.BlockSize]; @@ -586,8 +586,8 @@ namespace DiscImageChef.Commands crc16Thread = new Thread(updateCRC16); crc32Thread = new Thread(updateCRC32); crc64Thread = new Thread(updateCRC64); -// fletcher16Thread = new Thread(updateFletcher16); -// fletcher32Thread = new Thread(updateFletcher32); + // fletcher16Thread = new Thread(updateFletcher16); + // fletcher32Thread = new Thread(updateFletcher32); md5Thread = new Thread(updateMD5); ripemd160Thread = new Thread(updateRIPEMD160); sha1Thread = new Thread(updateSHA1); @@ -604,10 +604,10 @@ namespace DiscImageChef.Commands crc32Thread.Start(crc32Pkt); crc64Pkt.data = tmp; crc64Thread.Start(crc64Pkt); - //fletcher16Pkt.data = tmp; - //fletcher16Thread.Start(fletcher16Pkt); - //fletcher32Pkt.data = tmp; - //fletcher32Thread.Start(fletcher32Pkt); + //fletcher16Pkt.data = tmp; + //fletcher16Thread.Start(fletcher16Pkt); + //fletcher32Pkt.data = tmp; + //fletcher32Thread.Start(fletcher32Pkt); md5Pkt.data = tmp; md5Thread.Start(md5Pkt); ripemd160Pkt.data = tmp; @@ -629,23 +629,23 @@ namespace DiscImageChef.Commands if (mem < minMemory) minMemory = mem;*/ - while (adlerThread.IsAlive || crc16Thread.IsAlive || + while(adlerThread.IsAlive || crc16Thread.IsAlive || crc32Thread.IsAlive || crc64Thread.IsAlive || - //fletcher16Thread.IsAlive || fletcher32Thread.IsAlive || + //fletcher16Thread.IsAlive || fletcher32Thread.IsAlive || md5Thread.IsAlive || ripemd160Thread.IsAlive || sha1Thread.IsAlive || sha256Thread.IsAlive || sha384Thread.IsAlive || sha512Thread.IsAlive || spamsumThread.IsAlive) { } - + } adler32ctx.End(); crc16ctx.End(); crc32ctx.End(); crc64ctx.End(); - //fletcher16ctx.End(); - //fletcher32ctx.End(); + //fletcher16ctx.End(); + //fletcher32ctx.End(); md5ctx.End(); ripemd160ctx.End(); sha1ctx.End(); @@ -655,16 +655,16 @@ namespace DiscImageChef.Commands ssctx.End(); end = DateTime.Now; mem = GC.GetTotalMemory(false); - if (mem > maxMemory) + if(mem > maxMemory) maxMemory = mem; - if (mem < minMemory) + if(mem < minMemory) minMemory = mem; DicConsole.WriteLine(); DicConsole.WriteLine("Took {0} seconds to do all algorithms at the same time, {1} MiB/sec.", (end - start).TotalSeconds, (bufferSize / 1048576) / (end - start).TotalSeconds); #endregion - + DicConsole.WriteLine("Took {0} seconds to do all algorithms sequentially, {1} MiB/sec.", allSeparate, (bufferSize / 1048576) / allSeparate); DicConsole.WriteLine(); diff --git a/DiscImageChef/Commands/Checksum.cs b/DiscImageChef/Commands/Checksum.cs index 1a5468efd..a1b46c348 100644 --- a/DiscImageChef/Commands/Checksum.cs +++ b/DiscImageChef/Commands/Checksum.cs @@ -68,7 +68,7 @@ namespace DiscImageChef.Commands DicConsole.DebugWriteLine("Checksum command", "--sha512={0}", options.DoSHA512); DicConsole.DebugWriteLine("Checksum command", "--spamsum={0}", options.DoSpamSum); - if (!System.IO.File.Exists(options.InputFile)) + if(!System.IO.File.Exists(options.InputFile)) { DicConsole.ErrorWriteLine("Specified file does not exist."); return; @@ -76,7 +76,7 @@ namespace DiscImageChef.Commands ImagePlugin inputFormat = ImageFormat.Detect(options.InputFile); - if (inputFormat == null) + if(inputFormat == null) { DicConsole.ErrorWriteLine("Unable to recognize image format, not checksumming"); return; @@ -86,7 +86,7 @@ namespace DiscImageChef.Commands Core.Statistics.AddMediaFormat(inputFormat.GetImageFormat()); Core.Statistics.AddMedia(inputFormat.ImageInfo.mediaType, false); - if (inputFormat.ImageInfo.imageHasPartitions) + if(inputFormat.ImageInfo.imageHasPartitions) { try { @@ -160,24 +160,24 @@ namespace DiscImageChef.Commands sha512Packet sha512PktTrack = new sha512Packet(); spamsumPacket spamsumPktTrack = new spamsumPacket(); - if (options.WholeDisc) + if(options.WholeDisc) { - if (options.DoAdler32) + if(options.DoAdler32) { adler32ctx.Init(); adlerPkt.context = adler32ctx; } - if (options.DoCRC16) + if(options.DoCRC16) { crc16ctx.Init(); crc16Pkt.context = crc16ctx; } - if (options.DoCRC32) + if(options.DoCRC32) { crc32ctx.Init(); crc32Pkt.context = crc32ctx; } - if (options.DoCRC64) + if(options.DoCRC64) { crc64ctx.Init(); crc64Pkt.context = crc64ctx; @@ -192,37 +192,37 @@ namespace DiscImageChef.Commands fletcher32ctx.Init(); fletcher32Pkt.context = fletcher32ctx; }*/ - if (options.DoMD5) + if(options.DoMD5) { md5ctx.Init(); md5Pkt.context = md5ctx; } - if (options.DoRIPEMD160) + if(options.DoRIPEMD160) { ripemd160ctx.Init(); ripemd160Pkt.context = ripemd160ctx; } - if (options.DoSHA1) + if(options.DoSHA1) { sha1ctx.Init(); sha1Pkt.context = sha1ctx; } - if (options.DoSHA256) + if(options.DoSHA256) { sha256ctx.Init(); sha256Pkt.context = sha256ctx; } - if (options.DoSHA384) + if(options.DoSHA384) { sha384ctx.Init(); sha384Pkt.context = sha384ctx; } - if (options.DoSHA512) + if(options.DoSHA512) { sha512ctx.Init(); sha512Pkt.context = sha512ctx; } - if (options.DoSpamSum) + if(options.DoSpamSum) { ssctx.Init(); spamsumPkt.context = ssctx; @@ -232,33 +232,33 @@ namespace DiscImageChef.Commands ulong previousTrackEnd = 0; List inputTracks = inputFormat.GetTracks(); - foreach (Track currentTrack in inputTracks) + foreach(Track currentTrack in inputTracks) { - if ((currentTrack.TrackStartSector - previousTrackEnd) != 0 && + if((currentTrack.TrackStartSector - previousTrackEnd) != 0 && options.WholeDisc) { - for (ulong i = previousTrackEnd + 1; i < currentTrack.TrackStartSector; i++) + for(ulong i = previousTrackEnd + 1; i < currentTrack.TrackStartSector; i++) { DicConsole.Write("\rHashing track-less sector {0}", i); byte[] hiddenSector = inputFormat.ReadSector(i); - if (options.DoAdler32) + if(options.DoAdler32) { adlerPkt.data = hiddenSector; adlerThread.Start(adlerPkt); } - if (options.DoCRC16) + if(options.DoCRC16) { crc16Pkt.data = hiddenSector; crc16Thread.Start(crc16Pkt); } - if (options.DoCRC32) + if(options.DoCRC32) { crc32Pkt.data = hiddenSector; crc32Thread.Start(crc32Pkt); } - if (options.DoCRC64) + if(options.DoCRC64) { crc64Pkt.data = hiddenSector; crc64Thread.Start(crc64Pkt); @@ -273,43 +273,43 @@ namespace DiscImageChef.Commands fletcher32Pkt.data = hiddenSector; fletcher32Thread.Start(fletcher32Pkt); }*/ - if (options.DoMD5) + if(options.DoMD5) { md5Pkt.data = hiddenSector; md5Thread.Start(md5Pkt); } - if (options.DoRIPEMD160) + if(options.DoRIPEMD160) { ripemd160Pkt.data = hiddenSector; ripemd160Thread.Start(ripemd160Pkt); } - if (options.DoSHA1) + if(options.DoSHA1) { sha1Pkt.data = hiddenSector; sha1Thread.Start(sha1Pkt); } - if (options.DoSHA256) + if(options.DoSHA256) { sha256Pkt.data = hiddenSector; sha256Thread.Start(sha256Pkt); } - if (options.DoSHA384) + if(options.DoSHA384) { sha384Pkt.data = hiddenSector; sha384Thread.Start(sha384Pkt); } - if (options.DoSHA512) + if(options.DoSHA512) { sha512Pkt.data = hiddenSector; sha512Thread.Start(sha512Pkt); } - if (options.DoSpamSum) + if(options.DoSpamSum) { spamsumPkt.data = hiddenSector; spamsumThread.Start(spamsumPkt); } - while (adlerThread.IsAlive || crc16Thread.IsAlive || + while(adlerThread.IsAlive || crc16Thread.IsAlive || crc32Thread.IsAlive || crc64Thread.IsAlive || //fletcher16Thread.IsAlive || fletcher32Thread.IsAlive || md5Thread.IsAlive || ripemd160Thread.IsAlive || @@ -338,27 +338,27 @@ namespace DiscImageChef.Commands DicConsole.DebugWriteLine("Checksum command", "Track {0} starts at sector {1} and ends at sector {2}", currentTrack.TrackSequence, currentTrack.TrackStartSector, currentTrack.TrackEndSector); - if (options.SeparatedTracks) + if(options.SeparatedTracks) { - if (options.DoAdler32) + if(options.DoAdler32) { adler32ctxTrack = new Adler32Context(); adler32ctxTrack.Init(); adlerPktTrack.context = adler32ctxTrack; } - if (options.DoCRC16) + if(options.DoCRC16) { crc16ctxTrack = new CRC16Context(); crc16ctxTrack.Init(); crc16PktTrack.context = crc16ctxTrack; } - if (options.DoCRC32) + if(options.DoCRC32) { crc32ctxTrack = new CRC32Context(); crc32ctxTrack.Init(); crc32PktTrack.context = crc32ctxTrack; } - if (options.DoCRC64) + if(options.DoCRC64) { crc64ctxTrack = new CRC64Context(); crc64ctxTrack.Init(); @@ -376,43 +376,43 @@ namespace DiscImageChef.Commands fletcher32ctxTrack.Init(); fletcher32PktTrack.context = fletcher32ctxTrack; }*/ - if (options.DoMD5) + if(options.DoMD5) { md5ctxTrack = new MD5Context(); md5ctxTrack.Init(); md5PktTrack.context = md5ctxTrack; } - if (options.DoRIPEMD160) + if(options.DoRIPEMD160) { ripemd160ctxTrack = new RIPEMD160Context(); ripemd160ctxTrack.Init(); ripemd160PktTrack.context = ripemd160ctxTrack; } - if (options.DoSHA1) + if(options.DoSHA1) { sha1ctxTrack = new SHA1Context(); sha1ctxTrack.Init(); sha1PktTrack.context = sha1ctxTrack; } - if (options.DoSHA256) + if(options.DoSHA256) { sha256ctxTrack = new SHA256Context(); sha256ctxTrack.Init(); sha256PktTrack.context = sha256ctxTrack; } - if (options.DoSHA384) + if(options.DoSHA384) { sha384ctxTrack = new SHA384Context(); sha384ctxTrack.Init(); sha384PktTrack.context = sha384ctxTrack; } - if (options.DoSHA512) + if(options.DoSHA512) { sha512ctxTrack = new SHA512Context(); sha512ctxTrack.Init(); sha512PktTrack.context = sha512ctxTrack; } - if (options.DoSpamSum) + if(options.DoSpamSum) { ssctxTrack = new SpamSumContext(); ssctxTrack.Init(); @@ -424,11 +424,11 @@ namespace DiscImageChef.Commands ulong doneSectors = 0; DicConsole.WriteLine("Track {0} has {1} sectors", currentTrack.TrackSequence, sectors); - while (doneSectors < sectors) + while(doneSectors < sectors) { byte[] sector; - if ((sectors - doneSectors) >= sectorsToRead) + if((sectors - doneSectors) >= sectorsToRead) { sector = inputFormat.ReadSectors(doneSectors, sectorsToRead, currentTrack.TrackSequence); DicConsole.Write("\rHashings sectors {0} to {2} of track {1}", doneSectors, currentTrack.TrackSequence, doneSectors + sectorsToRead); @@ -441,24 +441,24 @@ namespace DiscImageChef.Commands doneSectors += (sectors - doneSectors); } - if (options.WholeDisc) + if(options.WholeDisc) { - if (options.DoAdler32) + if(options.DoAdler32) { adlerPkt.data = sector; adlerThread.Start(adlerPkt); } - if (options.DoCRC16) + if(options.DoCRC16) { crc16Pkt.data = sector; crc16Thread.Start(crc16Pkt); } - if (options.DoCRC32) + if(options.DoCRC32) { crc32Pkt.data = sector; crc32Thread.Start(crc32Pkt); } - if (options.DoCRC64) + if(options.DoCRC64) { crc64Pkt.data = sector; crc64Thread.Start(crc64Pkt); @@ -473,43 +473,43 @@ namespace DiscImageChef.Commands fletcher32Pkt.data = sector; fletcher32Thread.Start(fletcher32Pkt); }*/ - if (options.DoMD5) + if(options.DoMD5) { md5Pkt.data = sector; md5Thread.Start(md5Pkt); } - if (options.DoRIPEMD160) + if(options.DoRIPEMD160) { ripemd160Pkt.data = sector; ripemd160Thread.Start(ripemd160Pkt); } - if (options.DoSHA1) + if(options.DoSHA1) { sha1Pkt.data = sector; sha1Thread.Start(sha1Pkt); } - if (options.DoSHA256) + if(options.DoSHA256) { sha256Pkt.data = sector; sha256Thread.Start(sha256Pkt); } - if (options.DoSHA384) + if(options.DoSHA384) { sha384Pkt.data = sector; sha384Thread.Start(sha384Pkt); } - if (options.DoSHA512) + if(options.DoSHA512) { sha512Pkt.data = sector; sha512Thread.Start(sha512Pkt); } - if (options.DoSpamSum) + if(options.DoSpamSum) { spamsumPkt.data = sector; spamsumThread.Start(spamsumPkt); } - while (adlerThread.IsAlive || crc16Thread.IsAlive || + while(adlerThread.IsAlive || crc16Thread.IsAlive || crc32Thread.IsAlive || crc64Thread.IsAlive || //fletcher16Thread.IsAlive || fletcher32Thread.IsAlive || md5Thread.IsAlive || ripemd160Thread.IsAlive || @@ -534,24 +534,24 @@ namespace DiscImageChef.Commands spamsumThread = new Thread(updateSpamSum); } - if (options.SeparatedTracks) + if(options.SeparatedTracks) { - if (options.DoAdler32) + if(options.DoAdler32) { adlerPktTrack.data = sector; adlerThread.Start(adlerPktTrack); } - if (options.DoCRC16) + if(options.DoCRC16) { crc16PktTrack.data = sector; crc16Thread.Start(crc16PktTrack); } - if (options.DoCRC32) + if(options.DoCRC32) { crc32PktTrack.data = sector; crc32Thread.Start(crc32PktTrack); } - if (options.DoCRC64) + if(options.DoCRC64) { crc64PktTrack.data = sector; crc64Thread.Start(crc64PktTrack); @@ -566,43 +566,43 @@ namespace DiscImageChef.Commands fletcher32PktTrack.data = sector; fletcher32Thread.Start(fletcher32PktTrack); }*/ - if (options.DoMD5) + if(options.DoMD5) { md5PktTrack.data = sector; md5Thread.Start(md5PktTrack); } - if (options.DoRIPEMD160) + if(options.DoRIPEMD160) { ripemd160PktTrack.data = sector; ripemd160Thread.Start(ripemd160PktTrack); } - if (options.DoSHA1) + if(options.DoSHA1) { sha1PktTrack.data = sector; sha1Thread.Start(sha1PktTrack); } - if (options.DoSHA256) + if(options.DoSHA256) { sha256PktTrack.data = sector; sha256Thread.Start(sha256PktTrack); } - if (options.DoSHA384) + if(options.DoSHA384) { sha384PktTrack.data = sector; sha384Thread.Start(sha384PktTrack); } - if (options.DoSHA512) + if(options.DoSHA512) { sha512PktTrack.data = sector; sha512Thread.Start(sha512PktTrack); } - if (options.DoSpamSum) + if(options.DoSpamSum) { spamsumPktTrack.data = sector; spamsumThread.Start(spamsumPktTrack); } - while (adlerThread.IsAlive || crc16Thread.IsAlive || + while(adlerThread.IsAlive || crc16Thread.IsAlive || crc32Thread.IsAlive || crc64Thread.IsAlive || //fletcher16Thread.IsAlive || fletcher32Thread.IsAlive || md5Thread.IsAlive || ripemd160Thread.IsAlive || @@ -630,64 +630,64 @@ namespace DiscImageChef.Commands DicConsole.WriteLine(); - if (options.SeparatedTracks) + if(options.SeparatedTracks) { - if (options.DoAdler32) + if(options.DoAdler32) DicConsole.WriteLine("Track {0}'s Adler-32: 0x{1}", currentTrack.TrackSequence, adler32ctxTrack.End()); - if (options.DoCRC16) + if(options.DoCRC16) DicConsole.WriteLine("Track {0}'s CRC16: 0x{1}", currentTrack.TrackSequence, crc16ctxTrack.End()); - if (options.DoCRC32) + if(options.DoCRC32) DicConsole.WriteLine("Track {0}'s CRC32: 0x{1}", currentTrack.TrackSequence, crc32ctxTrack.End()); - if (options.DoCRC64) + if(options.DoCRC64) DicConsole.WriteLine("Track {0}'s CRC64 (ECMA): 0x{1}", currentTrack.TrackSequence, crc64ctxTrack.End()); /*if (options.DoFletcher16) DicConsole.WriteLine("Track {0}'s Fletcher-16: 0x{1}", currentTrack.TrackSequence, fletcher16ctxTrack.End()); if (options.DoFletcher32) DicConsole.WriteLine("Track {0}'s Fletcher-32: 0x{1}", currentTrack.TrackSequence, fletcher32ctxTrack.End());*/ - if (options.DoMD5) + if(options.DoMD5) DicConsole.WriteLine("Track {0}'s MD5: {1}", currentTrack.TrackSequence, md5ctxTrack.End()); - if (options.DoRIPEMD160) + if(options.DoRIPEMD160) DicConsole.WriteLine("Track {0}'s RIPEMD160: {1}", currentTrack.TrackSequence, ripemd160ctxTrack.End()); - if (options.DoSHA1) + if(options.DoSHA1) DicConsole.WriteLine("Track {0}'s SHA1: {1}", currentTrack.TrackSequence, sha1ctxTrack.End()); - if (options.DoSHA256) + if(options.DoSHA256) DicConsole.WriteLine("Track {0}'s SHA256: {1}", currentTrack.TrackSequence, sha256ctxTrack.End()); - if (options.DoSHA384) + if(options.DoSHA384) DicConsole.WriteLine("Track {0}'s SHA384: {1}", currentTrack.TrackSequence, sha384ctxTrack.End()); - if (options.DoSHA512) + if(options.DoSHA512) DicConsole.WriteLine("Track {0}'s SHA512: {1}", currentTrack.TrackSequence, sha512ctxTrack.End()); - if (options.DoSpamSum) + if(options.DoSpamSum) DicConsole.WriteLine("Track {0}'s SpamSum: {1}", currentTrack.TrackSequence, ssctxTrack.End()); } previousTrackEnd = currentTrack.TrackEndSector; } - if ((inputFormat.GetSectors() - previousTrackEnd) != 0 && + if((inputFormat.GetSectors() - previousTrackEnd) != 0 && options.WholeDisc) { - for (ulong i = previousTrackEnd + 1; i < inputFormat.GetSectors(); i++) + for(ulong i = previousTrackEnd + 1; i < inputFormat.GetSectors(); i++) { DicConsole.Write("\rHashing track-less sector {0}", i); byte[] hiddenSector = inputFormat.ReadSector(i); - if (options.DoAdler32) + if(options.DoAdler32) { adlerPkt.data = hiddenSector; adlerThread.Start(adlerPkt); } - if (options.DoCRC16) + if(options.DoCRC16) { crc16Pkt.data = hiddenSector; crc16Thread.Start(crc16Pkt); } - if (options.DoCRC32) + if(options.DoCRC32) { crc32Pkt.data = hiddenSector; crc32Thread.Start(crc32Pkt); } - if (options.DoCRC64) + if(options.DoCRC64) { crc64Pkt.data = hiddenSector; crc64Thread.Start(crc64Pkt); @@ -702,43 +702,43 @@ namespace DiscImageChef.Commands fletcher32Pkt.data = hiddenSector; fletcher32Thread.Start(fletcher32Pkt); }*/ - if (options.DoMD5) + if(options.DoMD5) { md5Pkt.data = hiddenSector; md5Thread.Start(md5Pkt); } - if (options.DoRIPEMD160) + if(options.DoRIPEMD160) { ripemd160Pkt.data = hiddenSector; ripemd160Thread.Start(ripemd160Pkt); } - if (options.DoSHA1) + if(options.DoSHA1) { sha1Pkt.data = hiddenSector; sha1Thread.Start(sha1Pkt); } - if (options.DoSHA256) + if(options.DoSHA256) { sha256Pkt.data = hiddenSector; sha256Thread.Start(sha256Pkt); } - if (options.DoSHA384) + if(options.DoSHA384) { sha384Pkt.data = hiddenSector; sha384Thread.Start(sha384Pkt); } - if (options.DoSHA512) + if(options.DoSHA512) { sha512Pkt.data = hiddenSector; sha512Thread.Start(sha512Pkt); } - if (options.DoSpamSum) + if(options.DoSpamSum) { spamsumPkt.data = hiddenSector; spamsumThread.Start(spamsumPkt); } - while (adlerThread.IsAlive || crc16Thread.IsAlive || + while(adlerThread.IsAlive || crc16Thread.IsAlive || crc32Thread.IsAlive || crc64Thread.IsAlive || //fletcher16Thread.IsAlive || fletcher32Thread.IsAlive || md5Thread.IsAlive || ripemd160Thread.IsAlive || @@ -764,39 +764,39 @@ namespace DiscImageChef.Commands } } - if (options.WholeDisc) + if(options.WholeDisc) { - if (options.DoAdler32) + if(options.DoAdler32) DicConsole.WriteLine("Disk's Adler-32: 0x{0}", adler32ctx.End()); - if (options.DoCRC16) + if(options.DoCRC16) DicConsole.WriteLine("Disk's CRC16: 0x{0}", crc16ctx.End()); - if (options.DoCRC32) + if(options.DoCRC32) DicConsole.WriteLine("Disk's CRC32: 0x{0}", crc32ctx.End()); - if (options.DoCRC64) + if(options.DoCRC64) DicConsole.WriteLine("Disk's CRC64 (ECMA): 0x{0}", crc64ctx.End()); /*if (options.DoFletcher16) DicConsole.WriteLine("Disk's Fletcher-16: 0x{0}", fletcher16ctx.End()); if (options.DoFletcher32) DicConsole.WriteLine("Disk's Fletcher-32: 0x{0}", fletcher32ctx.End());*/ - if (options.DoMD5) + if(options.DoMD5) DicConsole.WriteLine("Disk's MD5: {0}", md5ctx.End()); - if (options.DoRIPEMD160) + if(options.DoRIPEMD160) DicConsole.WriteLine("Disk's RIPEMD160: {0}", ripemd160ctx.End()); - if (options.DoSHA1) + if(options.DoSHA1) DicConsole.WriteLine("Disk's SHA1: {0}", sha1ctx.End()); - if (options.DoSHA256) + if(options.DoSHA256) DicConsole.WriteLine("Disk's SHA256: {0}", sha256ctx.End()); - if (options.DoSHA384) + if(options.DoSHA384) DicConsole.WriteLine("Disk's SHA384: {0}", sha384ctx.End()); - if (options.DoSHA512) + if(options.DoSHA512) DicConsole.WriteLine("Disk's SHA512: {0}", sha512ctx.End()); - if (options.DoSpamSum) + if(options.DoSpamSum) DicConsole.WriteLine("Disk's SpamSum: {0}", ssctx.End()); } } - catch (Exception ex) + catch(Exception ex) { - if (options.Debug) + if(options.Debug) DicConsole.DebugWriteLine("Could not get tracks because {0}", ex.Message); else DicConsole.WriteLine("Unable to get separate tracks, not checksumming them"); @@ -846,22 +846,22 @@ namespace DiscImageChef.Commands sha512Packet sha512Pkt = new sha512Packet(); spamsumPacket spamsumPkt = new spamsumPacket(); - if (options.DoAdler32) + if(options.DoAdler32) { adler32ctx.Init(); adlerPkt.context = adler32ctx; } - if (options.DoCRC16) + if(options.DoCRC16) { crc16ctx.Init(); crc16Pkt.context = crc16ctx; } - if (options.DoCRC32) + if(options.DoCRC32) { crc32ctx.Init(); crc32Pkt.context = crc32ctx; } - if (options.DoCRC64) + if(options.DoCRC64) { crc64ctx.Init(); crc64Pkt.context = crc64ctx; @@ -876,37 +876,37 @@ namespace DiscImageChef.Commands fletcher32ctx.Init(); fletcher32Pkt.context = fletcher32ctx; }*/ - if (options.DoMD5) + if(options.DoMD5) { md5ctx.Init(); md5Pkt.context = md5ctx; } - if (options.DoRIPEMD160) + if(options.DoRIPEMD160) { ripemd160ctx.Init(); ripemd160Pkt.context = ripemd160ctx; } - if (options.DoSHA1) + if(options.DoSHA1) { sha1ctx.Init(); sha1Pkt.context = sha1ctx; } - if (options.DoSHA256) + if(options.DoSHA256) { sha256ctx.Init(); sha256Pkt.context = sha256ctx; } - if (options.DoSHA384) + if(options.DoSHA384) { sha384ctx.Init(); sha384Pkt.context = sha384ctx; } - if (options.DoSHA512) + if(options.DoSHA512) { sha512ctx.Init(); sha512Pkt.context = sha512ctx; } - if (options.DoSpamSum) + if(options.DoSpamSum) { ssctx.Init(); spamsumPkt.context = ssctx; @@ -916,11 +916,11 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Sectors {0}", sectors); ulong doneSectors = 0; - while (doneSectors < sectors) + while(doneSectors < sectors) { byte[] sector; - if ((sectors - doneSectors) >= sectorsToRead) + if((sectors - doneSectors) >= sectorsToRead) { sector = inputFormat.ReadSectors(doneSectors, sectorsToRead); DicConsole.Write("\rHashings sectors {0} to {1}", doneSectors, doneSectors + sectorsToRead); @@ -933,22 +933,22 @@ namespace DiscImageChef.Commands doneSectors += (sectors - doneSectors); } - if (options.DoAdler32) + if(options.DoAdler32) { adlerPkt.data = sector; adlerThread.Start(adlerPkt); } - if (options.DoCRC16) + if(options.DoCRC16) { crc16Pkt.data = sector; crc16Thread.Start(crc16Pkt); } - if (options.DoCRC32) + if(options.DoCRC32) { crc32Pkt.data = sector; crc32Thread.Start(crc32Pkt); } - if (options.DoCRC64) + if(options.DoCRC64) { crc64Pkt.data = sector; crc64Thread.Start(crc64Pkt); @@ -963,43 +963,43 @@ namespace DiscImageChef.Commands fletcher32Pkt.data = sector; fletcher32Thread.Start(fletcher32Pkt); }*/ - if (options.DoMD5) + if(options.DoMD5) { md5Pkt.data = sector; md5Thread.Start(md5Pkt); } - if (options.DoRIPEMD160) + if(options.DoRIPEMD160) { ripemd160Pkt.data = sector; ripemd160Thread.Start(ripemd160Pkt); } - if (options.DoSHA1) + if(options.DoSHA1) { sha1Pkt.data = sector; sha1Thread.Start(sha1Pkt); } - if (options.DoSHA256) + if(options.DoSHA256) { sha256Pkt.data = sector; sha256Thread.Start(sha256Pkt); } - if (options.DoSHA384) + if(options.DoSHA384) { sha384Pkt.data = sector; sha384Thread.Start(sha384Pkt); } - if (options.DoSHA512) + if(options.DoSHA512) { sha512Pkt.data = sector; sha512Thread.Start(sha512Pkt); } - if (options.DoSpamSum) + if(options.DoSpamSum) { spamsumPkt.data = sector; spamsumThread.Start(spamsumPkt); } - while (adlerThread.IsAlive || crc16Thread.IsAlive || + while(adlerThread.IsAlive || crc16Thread.IsAlive || crc32Thread.IsAlive || crc64Thread.IsAlive || //fletcher16Thread.IsAlive || fletcher32Thread.IsAlive || md5Thread.IsAlive || ripemd160Thread.IsAlive || @@ -1026,31 +1026,31 @@ namespace DiscImageChef.Commands DicConsole.WriteLine(); - if (options.DoAdler32) + if(options.DoAdler32) DicConsole.WriteLine("Disk's Adler-32: 0x{0}", adler32ctx.End()); - if (options.DoCRC16) + if(options.DoCRC16) DicConsole.WriteLine("Disk's CRC16: 0x{0}", crc16ctx.End()); - if (options.DoCRC32) + if(options.DoCRC32) DicConsole.WriteLine("Disk's CRC32: 0x{0}", crc32ctx.End()); - if (options.DoCRC64) + if(options.DoCRC64) DicConsole.WriteLine("Disk's CRC64 (ECMA): 0x{0}", crc64ctx.End()); /*if (options.DoFletcher16) DicConsole.WriteLine("Disk's Fletcher-16: 0x{0}", fletcher16ctx.End()); if (options.DoFletcher32) DicConsole.WriteLine("Disk's Fletcher-32: 0x{0}", fletcher32ctx.End());*/ - if (options.DoMD5) + if(options.DoMD5) DicConsole.WriteLine("Disk's MD5: {0}", md5ctx.End()); - if (options.DoRIPEMD160) + if(options.DoRIPEMD160) DicConsole.WriteLine("Disk's RIPEMD160: {0}", ripemd160ctx.End()); - if (options.DoSHA1) + if(options.DoSHA1) DicConsole.WriteLine("Disk's SHA1: {0}", sha1ctx.End()); - if (options.DoSHA256) + if(options.DoSHA256) DicConsole.WriteLine("Disk's SHA256: {0}", sha256ctx.End()); - if (options.DoSHA384) + if(options.DoSHA384) DicConsole.WriteLine("Disk's SHA384: {0}", sha384ctx.End()); - if (options.DoSHA512) + if(options.DoSHA512) DicConsole.WriteLine("Disk's SHA512: {0}", sha512ctx.End()); - if (options.DoSpamSum) + if(options.DoSpamSum) DicConsole.WriteLine("Disk's SpamSum: {0}", ssctx.End()); } diff --git a/DiscImageChef/Commands/Compare.cs b/DiscImageChef/Commands/Compare.cs index a506c8423..67a959005 100644 --- a/DiscImageChef/Commands/Compare.cs +++ b/DiscImageChef/Commands/Compare.cs @@ -52,13 +52,13 @@ namespace DiscImageChef.Commands DicConsole.DebugWriteLine("Compare command", "--input1={0}", options.InputFile1); DicConsole.DebugWriteLine("Compare command", "--input2={0}", options.InputFile2); - if (!System.IO.File.Exists(options.InputFile1)) + if(!System.IO.File.Exists(options.InputFile1)) { DicConsole.ErrorWriteLine("Input file 1 does not exist."); return; } - if (!System.IO.File.Exists(options.InputFile2)) + if(!System.IO.File.Exists(options.InputFile2)) { DicConsole.ErrorWriteLine("Input file 2 does not exist."); return; @@ -103,7 +103,7 @@ namespace DiscImageChef.Commands StringBuilder sb = new StringBuilder(); - if (options.Verbose) + if(options.Verbose) { sb.AppendLine("\tDisc image 1\tDisc image 2"); sb.AppendLine("================================"); @@ -126,8 +126,8 @@ namespace DiscImageChef.Commands Dictionary image2DiskTags = new Dictionary(); image1Info.imageHasPartitions = input1Format.ImageHasPartitions(); - try{ image1Sessions = input1Format.GetSessions(); } catch{} - if (image1Sessions.Count > 0) + try { image1Sessions = input1Format.GetSessions(); } catch { } + if(image1Sessions.Count > 0) image1Info.imageHasSessions = true; image1Info.imageSize = input1Format.GetImageSize(); image1Info.sectors = input1Format.GetSectors(); @@ -135,35 +135,37 @@ namespace DiscImageChef.Commands image1Info.imageCreationTime = input1Format.GetImageCreationTime(); image1Info.imageLastModificationTime = input1Format.GetImageLastModificationTime(); image1Info.mediaType = input1Format.GetMediaType(); - try{ image1Info.imageVersion = input1Format.GetImageVersion(); } catch{ image1Info.imageVersion = null;} - try{ image1Info.imageApplication = input1Format.GetImageApplication(); } catch{ image1Info.imageApplication = null;} - try{ image1Info.imageApplicationVersion = input1Format.GetImageApplicationVersion(); } catch{ image1Info.imageApplicationVersion = null;} - try{ image1Info.imageCreator = input1Format.GetImageCreator(); } catch{ image1Info.imageCreator = null;} - try{ image1Info.imageName = input1Format.GetImageName(); } catch{ image1Info.imageName = null;} - try{ image1Info.imageComments = input1Format.GetImageComments(); } catch{ image1Info.imageComments = null;} - try{ image1Info.mediaManufacturer = input1Format.GetMediaManufacturer(); } catch{ image1Info.mediaManufacturer = null;} - try{ image1Info.mediaModel = input1Format.GetMediaModel(); } catch{ image1Info.mediaModel = null;} - try{ image1Info.mediaSerialNumber = input1Format.GetMediaSerialNumber(); } catch{ image1Info.mediaSerialNumber = null;} - try{ image1Info.mediaBarcode = input1Format.GetMediaBarcode(); } catch{ image1Info.mediaBarcode = null;} - try{ image1Info.mediaPartNumber = input1Format.GetMediaPartNumber(); } catch{ image1Info.mediaPartNumber = null;} - try{ image1Info.mediaSequence = input1Format.GetMediaSequence(); } catch{ image1Info.mediaSequence = 0;} - try{ image1Info.lastMediaSequence = input1Format.GetLastDiskSequence(); } catch{ image1Info.lastMediaSequence = 0;} - try{ image1Info.driveManufacturer = input1Format.GetDriveManufacturer(); } catch{ image1Info.driveManufacturer = null;} - try{ image1Info.driveModel = input1Format.GetDriveModel(); } catch{ image1Info.driveModel = null;} - try{ image1Info.driveSerialNumber = input1Format.GetDriveSerialNumber(); } catch{ image1Info.driveSerialNumber = null;} - foreach (MediaTagType disktag in Enum.GetValues(typeof(MediaTagType))) + try { image1Info.imageVersion = input1Format.GetImageVersion(); } catch { image1Info.imageVersion = null; } + try { image1Info.imageApplication = input1Format.GetImageApplication(); } catch { image1Info.imageApplication = null; } + try { image1Info.imageApplicationVersion = input1Format.GetImageApplicationVersion(); } catch { image1Info.imageApplicationVersion = null; } + try { image1Info.imageCreator = input1Format.GetImageCreator(); } catch { image1Info.imageCreator = null; } + try { image1Info.imageName = input1Format.GetImageName(); } catch { image1Info.imageName = null; } + try { image1Info.imageComments = input1Format.GetImageComments(); } catch { image1Info.imageComments = null; } + try { image1Info.mediaManufacturer = input1Format.GetMediaManufacturer(); } catch { image1Info.mediaManufacturer = null; } + try { image1Info.mediaModel = input1Format.GetMediaModel(); } catch { image1Info.mediaModel = null; } + try { image1Info.mediaSerialNumber = input1Format.GetMediaSerialNumber(); } catch { image1Info.mediaSerialNumber = null; } + try { image1Info.mediaBarcode = input1Format.GetMediaBarcode(); } catch { image1Info.mediaBarcode = null; } + try { image1Info.mediaPartNumber = input1Format.GetMediaPartNumber(); } catch { image1Info.mediaPartNumber = null; } + try { image1Info.mediaSequence = input1Format.GetMediaSequence(); } catch { image1Info.mediaSequence = 0; } + try { image1Info.lastMediaSequence = input1Format.GetLastDiskSequence(); } catch { image1Info.lastMediaSequence = 0; } + try { image1Info.driveManufacturer = input1Format.GetDriveManufacturer(); } catch { image1Info.driveManufacturer = null; } + try { image1Info.driveModel = input1Format.GetDriveModel(); } catch { image1Info.driveModel = null; } + try { image1Info.driveSerialNumber = input1Format.GetDriveSerialNumber(); } catch { image1Info.driveSerialNumber = null; } + foreach(MediaTagType disktag in Enum.GetValues(typeof(MediaTagType))) { - try{ + try + { byte[] temparray = input1Format.ReadDiskTag(disktag); image1DiskTags.Add(disktag, temparray); } - catch{ + catch + { } } image2Info.imageHasPartitions = input2Format.ImageHasPartitions(); - try{ image2Sessions = input2Format.GetSessions(); } catch{} - if (image2Sessions.Count > 0) + try { image2Sessions = input2Format.GetSessions(); } catch { } + if(image2Sessions.Count > 0) image2Info.imageHasSessions = true; image2Info.imageSize = input2Format.GetImageSize(); image2Info.sectors = input2Format.GetSectors(); @@ -171,33 +173,35 @@ namespace DiscImageChef.Commands image2Info.imageCreationTime = input2Format.GetImageCreationTime(); image2Info.imageLastModificationTime = input2Format.GetImageLastModificationTime(); image2Info.mediaType = input2Format.GetMediaType(); - try{ image2Info.imageVersion = input2Format.GetImageVersion(); } catch{ image2Info.imageVersion = null;} - try{ image2Info.imageApplication = input2Format.GetImageApplication(); } catch{ image2Info.imageApplication = null;} - try{ image2Info.imageApplicationVersion = input2Format.GetImageApplicationVersion(); } catch{ image2Info.imageApplicationVersion = null;} - try{ image2Info.imageCreator = input2Format.GetImageCreator(); } catch{ image2Info.imageCreator = null;} - try{ image2Info.imageName = input2Format.GetImageName(); } catch{ image2Info.imageName = null;} - try{ image2Info.imageComments = input2Format.GetImageComments(); } catch{ image2Info.imageComments = null;} - try{ image2Info.mediaManufacturer = input2Format.GetMediaManufacturer(); } catch{ image2Info.mediaManufacturer = null;} - try{ image2Info.mediaModel = input2Format.GetMediaModel(); } catch{ image2Info.mediaModel = null;} - try{ image2Info.mediaSerialNumber = input2Format.GetMediaSerialNumber(); } catch{ image2Info.mediaSerialNumber = null;} - try{ image2Info.mediaBarcode = input2Format.GetMediaBarcode(); } catch{ image2Info.mediaBarcode = null;} - try{ image2Info.mediaPartNumber = input2Format.GetMediaPartNumber(); } catch{ image2Info.mediaPartNumber = null;} - try{ image2Info.mediaSequence = input2Format.GetMediaSequence(); } catch{ image2Info.mediaSequence = 0;} - try{ image2Info.lastMediaSequence = input2Format.GetLastDiskSequence(); } catch{ image2Info.lastMediaSequence = 0;} - try{ image2Info.driveManufacturer = input2Format.GetDriveManufacturer(); } catch{ image2Info.driveManufacturer = null;} - try{ image2Info.driveModel = input2Format.GetDriveModel(); } catch{ image2Info.driveModel = null;} - try{ image2Info.driveSerialNumber = input2Format.GetDriveSerialNumber(); } catch{ image2Info.driveSerialNumber = null;} - foreach (MediaTagType disktag in Enum.GetValues(typeof(MediaTagType))) + try { image2Info.imageVersion = input2Format.GetImageVersion(); } catch { image2Info.imageVersion = null; } + try { image2Info.imageApplication = input2Format.GetImageApplication(); } catch { image2Info.imageApplication = null; } + try { image2Info.imageApplicationVersion = input2Format.GetImageApplicationVersion(); } catch { image2Info.imageApplicationVersion = null; } + try { image2Info.imageCreator = input2Format.GetImageCreator(); } catch { image2Info.imageCreator = null; } + try { image2Info.imageName = input2Format.GetImageName(); } catch { image2Info.imageName = null; } + try { image2Info.imageComments = input2Format.GetImageComments(); } catch { image2Info.imageComments = null; } + try { image2Info.mediaManufacturer = input2Format.GetMediaManufacturer(); } catch { image2Info.mediaManufacturer = null; } + try { image2Info.mediaModel = input2Format.GetMediaModel(); } catch { image2Info.mediaModel = null; } + try { image2Info.mediaSerialNumber = input2Format.GetMediaSerialNumber(); } catch { image2Info.mediaSerialNumber = null; } + try { image2Info.mediaBarcode = input2Format.GetMediaBarcode(); } catch { image2Info.mediaBarcode = null; } + try { image2Info.mediaPartNumber = input2Format.GetMediaPartNumber(); } catch { image2Info.mediaPartNumber = null; } + try { image2Info.mediaSequence = input2Format.GetMediaSequence(); } catch { image2Info.mediaSequence = 0; } + try { image2Info.lastMediaSequence = input2Format.GetLastDiskSequence(); } catch { image2Info.lastMediaSequence = 0; } + try { image2Info.driveManufacturer = input2Format.GetDriveManufacturer(); } catch { image2Info.driveManufacturer = null; } + try { image2Info.driveModel = input2Format.GetDriveModel(); } catch { image2Info.driveModel = null; } + try { image2Info.driveSerialNumber = input2Format.GetDriveSerialNumber(); } catch { image2Info.driveSerialNumber = null; } + foreach(MediaTagType disktag in Enum.GetValues(typeof(MediaTagType))) { - try{ + try + { byte[] temparray = input2Format.ReadDiskTag(disktag); image2DiskTags.Add(disktag, temparray); } - catch{ + catch + { } } - if (options.Verbose) + if(options.Verbose) { sb.AppendFormat("Has partitions?\t{0}\t{1}", image1Info.imageHasPartitions, image2Info.imageHasPartitions).AppendLine(); sb.AppendFormat("Has sessions?\t{0}\t{1}", image1Info.imageHasSessions, image2Info.imageHasSessions).AppendLine(); @@ -223,7 +227,7 @@ namespace DiscImageChef.Commands sb.AppendFormat("Drive manufacturer\t{0}\t{1}", image1Info.driveManufacturer, image2Info.driveManufacturer).AppendLine(); sb.AppendFormat("Drive model\t{0}\t{1}", image1Info.driveModel, image2Info.driveModel).AppendLine(); sb.AppendFormat("Drive serial number\t{0}\t{1}", image1Info.driveSerialNumber, image2Info.driveSerialNumber).AppendLine(); - foreach (MediaTagType disktag in Enum.GetValues(typeof(MediaTagType))) + foreach(MediaTagType disktag in Enum.GetValues(typeof(MediaTagType))) { sb.AppendFormat("Has {0}?\t{1}\t{2}", disktag, image1DiskTags.ContainsKey(disktag), image2DiskTags.ContainsKey(disktag)).AppendLine(); } @@ -231,164 +235,164 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Comparing disk image characteristics"); - if (image1Info.imageHasPartitions != image2Info.imageHasPartitions) + if(image1Info.imageHasPartitions != image2Info.imageHasPartitions) { imagesDiffer = true; - if (!options.Verbose) + if(!options.Verbose) sb.AppendLine("Image partitioned status differ"); } - if (image1Info.imageHasSessions != image2Info.imageHasSessions) + if(image1Info.imageHasSessions != image2Info.imageHasSessions) { imagesDiffer = true; - if (!options.Verbose) + if(!options.Verbose) sb.AppendLine("Image session status differ"); } - if (image1Info.imageSize != image2Info.imageSize) + if(image1Info.imageSize != image2Info.imageSize) { imagesDiffer = true; - if (!options.Verbose) + if(!options.Verbose) sb.AppendLine("Image size differ"); } - if (image1Info.sectors != image2Info.sectors) + if(image1Info.sectors != image2Info.sectors) { imagesDiffer = true; - if (!options.Verbose) + if(!options.Verbose) sb.AppendLine("Image sectors differ"); } - if (image1Info.sectorSize != image2Info.sectorSize) + if(image1Info.sectorSize != image2Info.sectorSize) { imagesDiffer = true; - if (!options.Verbose) + if(!options.Verbose) sb.AppendLine("Image sector size differ"); } - if (image1Info.imageCreationTime != image2Info.imageCreationTime) + if(image1Info.imageCreationTime != image2Info.imageCreationTime) { imagesDiffer = true; - if (!options.Verbose) + if(!options.Verbose) sb.AppendLine("Image creation time differ"); } - if (image1Info.imageLastModificationTime != image2Info.imageLastModificationTime) + if(image1Info.imageLastModificationTime != image2Info.imageLastModificationTime) { imagesDiffer = true; - if (!options.Verbose) + if(!options.Verbose) sb.AppendLine("Image last modification time differ"); } - if (image1Info.mediaType != image2Info.mediaType) + if(image1Info.mediaType != image2Info.mediaType) { imagesDiffer = true; - if (!options.Verbose) + if(!options.Verbose) sb.AppendLine("Disk type differ"); } - if (image1Info.imageVersion != image2Info.imageVersion) + if(image1Info.imageVersion != image2Info.imageVersion) { imagesDiffer = true; - if (!options.Verbose) + if(!options.Verbose) sb.AppendLine("Image version differ"); } - if (image1Info.imageApplication != image2Info.imageApplication) + if(image1Info.imageApplication != image2Info.imageApplication) { imagesDiffer = true; - if (!options.Verbose) + if(!options.Verbose) sb.AppendLine("Image application differ"); } - if (image1Info.imageApplicationVersion != image2Info.imageApplicationVersion) + if(image1Info.imageApplicationVersion != image2Info.imageApplicationVersion) { imagesDiffer = true; - if (!options.Verbose) + if(!options.Verbose) sb.AppendLine("Image application version differ"); } - if (image1Info.imageCreator != image2Info.imageCreator) + if(image1Info.imageCreator != image2Info.imageCreator) { imagesDiffer = true; - if (!options.Verbose) + if(!options.Verbose) sb.AppendLine("Image creator differ"); } - if (image1Info.imageName != image2Info.imageName) + if(image1Info.imageName != image2Info.imageName) { imagesDiffer = true; - if (!options.Verbose) + if(!options.Verbose) sb.AppendLine("Image name differ"); } - if (image1Info.imageComments != image2Info.imageComments) + if(image1Info.imageComments != image2Info.imageComments) { imagesDiffer = true; - if (!options.Verbose) + if(!options.Verbose) sb.AppendLine("Image comments differ"); } - if (image1Info.mediaManufacturer != image2Info.mediaManufacturer) + if(image1Info.mediaManufacturer != image2Info.mediaManufacturer) { imagesDiffer = true; - if (!options.Verbose) + if(!options.Verbose) sb.AppendLine("Disk manufacturer differ"); } - if (image1Info.mediaModel != image2Info.mediaModel) + if(image1Info.mediaModel != image2Info.mediaModel) { imagesDiffer = true; - if (!options.Verbose) + if(!options.Verbose) sb.AppendLine("Disk model differ"); } - if (image1Info.mediaSerialNumber != image2Info.mediaSerialNumber) + if(image1Info.mediaSerialNumber != image2Info.mediaSerialNumber) { imagesDiffer = true; - if (!options.Verbose) + if(!options.Verbose) sb.AppendLine("Disk serial number differ"); } - if (image1Info.mediaBarcode != image2Info.mediaBarcode) + if(image1Info.mediaBarcode != image2Info.mediaBarcode) { imagesDiffer = true; - if (!options.Verbose) + if(!options.Verbose) sb.AppendLine("Disk barcode differ"); } - if (image1Info.mediaPartNumber != image2Info.mediaPartNumber) + if(image1Info.mediaPartNumber != image2Info.mediaPartNumber) { imagesDiffer = true; - if (!options.Verbose) + if(!options.Verbose) sb.AppendLine("Disk part number differ"); } - if (image1Info.mediaSequence != image2Info.mediaSequence) + if(image1Info.mediaSequence != image2Info.mediaSequence) { imagesDiffer = true; - if (!options.Verbose) + if(!options.Verbose) sb.AppendLine("Disk sequence differ"); } - if (image1Info.lastMediaSequence != image2Info.lastMediaSequence) + if(image1Info.lastMediaSequence != image2Info.lastMediaSequence) { imagesDiffer = true; - if (!options.Verbose) + if(!options.Verbose) sb.AppendLine("Last disk in sequence differ"); } - if (image1Info.driveManufacturer != image2Info.driveManufacturer) + if(image1Info.driveManufacturer != image2Info.driveManufacturer) { imagesDiffer = true; - if (!options.Verbose) + if(!options.Verbose) sb.AppendLine("Drive manufacturer differ"); } - if (image1Info.driveModel != image2Info.driveModel) + if(image1Info.driveModel != image2Info.driveModel) { imagesDiffer = true; - if (!options.Verbose) + if(!options.Verbose) sb.AppendLine("Drive model differ"); } - if (image1Info.driveSerialNumber != image2Info.driveSerialNumber) + if(image1Info.driveSerialNumber != image2Info.driveSerialNumber) { imagesDiffer = true; - if (!options.Verbose) + if(!options.Verbose) sb.AppendLine("Drive serial number differ"); } UInt64 leastSectors; - if (image1Info.sectors < image2Info.sectors) + if(image1Info.sectors < image2Info.sectors) { imagesDiffer = true; leastSectors = image1Info.sectors; - if (!options.Verbose) + if(!options.Verbose) sb.AppendLine("Image 2 has more sectors"); } - else if (image1Info.sectors > image2Info.sectors) + else if(image1Info.sectors > image2Info.sectors) { imagesDiffer = true; leastSectors = image2Info.sectors; - if (!options.Verbose) + if(!options.Verbose) sb.AppendLine("Image 1 has more sectors"); } else @@ -396,9 +400,9 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Comparing sectors..."); - for (UInt64 sector = 0; sector < leastSectors; sector++) + for(UInt64 sector = 0; sector < leastSectors; sector++) { - DicConsole.Write("\rComparing sector {0} of {1}...", sector+1, leastSectors); + DicConsole.Write("\rComparing sector {0} of {1}...", sector + 1, leastSectors); try { byte[] image1Sector = input1Format.ReadSector(sector); @@ -417,11 +421,11 @@ namespace DiscImageChef.Commands sector, image1Sector.LongLength, image2Sector.LongLength).AppendLine(); } } - catch{} + catch { } } DicConsole.WriteLine(); - if (imagesDiffer) + if(imagesDiffer) sb.AppendLine("Images differ"); else sb.AppendLine("Images do not differ"); @@ -437,12 +441,12 @@ namespace DiscImageChef.Commands sameSize = true; Int64 leastBytes; - if (compareArray1.LongLength < compareArray2.LongLength) + if(compareArray1.LongLength < compareArray2.LongLength) { sameSize = false; leastBytes = compareArray1.LongLength; } - else if (compareArray1.LongLength > compareArray2.LongLength) + else if(compareArray1.LongLength > compareArray2.LongLength) { sameSize = false; leastBytes = compareArray2.LongLength; @@ -450,9 +454,9 @@ namespace DiscImageChef.Commands else leastBytes = compareArray1.LongLength; - for (Int64 i = 0; i < leastBytes; i++) + for(Int64 i = 0; i < leastBytes; i++) { - if (compareArray1[i] != compareArray2[i]) + if(compareArray1[i] != compareArray2[i]) { different = true; return; diff --git a/DiscImageChef/Commands/Configure.cs b/DiscImageChef/Commands/Configure.cs index 2820a1c61..c5d7c2f3e 100644 --- a/DiscImageChef/Commands/Configure.cs +++ b/DiscImageChef/Commands/Configure.cs @@ -43,12 +43,12 @@ namespace DiscImageChef.Commands { public static class Configure { - public static void doConfigure () + public static void doConfigure() { ConsoleKeyInfo pressedKey = new ConsoleKeyInfo(); pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { DicConsole.Write("Do you want to save device reports globally? (Y/N): "); pressedKey = System.Console.ReadKey(); @@ -58,19 +58,19 @@ namespace DiscImageChef.Commands Settings.Settings.Current.SaveReportsGlobally = pressedKey.Key == ConsoleKey.Y; pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { DicConsole.Write("Do you want to save stats about your DiscImageChef usage? (Y/N): "); pressedKey = System.Console.ReadKey(); DicConsole.WriteLine(); } - if (pressedKey.Key == ConsoleKey.Y) + if(pressedKey.Key == ConsoleKey.Y) { Settings.Settings.Current.Stats = new StatsSettings(); pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { DicConsole.Write("Do you want to share your stats anonymously? (Y/N): "); pressedKey = System.Console.ReadKey(); @@ -79,7 +79,7 @@ namespace DiscImageChef.Commands Settings.Settings.Current.Stats.ShareStats = pressedKey.Key == ConsoleKey.Y; pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { DicConsole.Write("Do you want to gather statistics about benchmarks? (Y/N): "); pressedKey = System.Console.ReadKey(); @@ -88,7 +88,7 @@ namespace DiscImageChef.Commands Settings.Settings.Current.Stats.BenchmarkStats = pressedKey.Key == ConsoleKey.Y; pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { DicConsole.Write("Do you want to gather statistics about command usage? (Y/N): "); pressedKey = System.Console.ReadKey(); @@ -97,7 +97,7 @@ namespace DiscImageChef.Commands Settings.Settings.Current.Stats.CommandStats = pressedKey.Key == ConsoleKey.Y; pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { DicConsole.Write("Do you want to gather statistics about found devices? (Y/N): "); pressedKey = System.Console.ReadKey(); @@ -106,7 +106,7 @@ namespace DiscImageChef.Commands Settings.Settings.Current.Stats.DeviceStats = pressedKey.Key == ConsoleKey.Y; pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { DicConsole.Write("Do you want to gather statistics about found filesystems? (Y/N): "); pressedKey = System.Console.ReadKey(); @@ -115,7 +115,7 @@ namespace DiscImageChef.Commands Settings.Settings.Current.Stats.FilesystemStats = pressedKey.Key == ConsoleKey.Y; pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { DicConsole.Write("Do you want to gather statistics about found media image formats? (Y/N): "); pressedKey = System.Console.ReadKey(); @@ -124,7 +124,7 @@ namespace DiscImageChef.Commands Settings.Settings.Current.Stats.MediaImageStats = pressedKey.Key == ConsoleKey.Y; pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { DicConsole.Write("Do you want to gather statistics about scanned media? (Y/N): "); pressedKey = System.Console.ReadKey(); @@ -133,7 +133,7 @@ namespace DiscImageChef.Commands Settings.Settings.Current.Stats.MediaScanStats = pressedKey.Key == ConsoleKey.Y; pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { DicConsole.Write("Do you want to gather statistics about found partitioning schemes? (Y/N): "); pressedKey = System.Console.ReadKey(); @@ -142,7 +142,7 @@ namespace DiscImageChef.Commands Settings.Settings.Current.Stats.PartitionStats = pressedKey.Key == ConsoleKey.Y; pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { DicConsole.Write("Do you want to gather statistics about media types? (Y/N): "); pressedKey = System.Console.ReadKey(); @@ -151,7 +151,7 @@ namespace DiscImageChef.Commands Settings.Settings.Current.Stats.MediaStats = pressedKey.Key == ConsoleKey.Y; pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { DicConsole.Write("Do you want to gather statistics about media image verifications? (Y/N): "); pressedKey = System.Console.ReadKey(); diff --git a/DiscImageChef/Commands/CreateSidecar.cs b/DiscImageChef/Commands/CreateSidecar.cs index 986bf1fbc..857eb48a2 100644 --- a/DiscImageChef/Commands/CreateSidecar.cs +++ b/DiscImageChef/Commands/CreateSidecar.cs @@ -58,7 +58,7 @@ namespace DiscImageChef.Commands plugins.RegisterAllPlugins(); ImagePlugin _imageFormat; - if (!System.IO.File.Exists(options.InputFile)) + if(!System.IO.File.Exists(options.InputFile)) { DicConsole.ErrorWriteLine("Specified file does not exist."); return; @@ -68,14 +68,14 @@ namespace DiscImageChef.Commands { _imageFormat = ImageFormat.Detect(options.InputFile); - if (_imageFormat == null) + if(_imageFormat == null) { DicConsole.WriteLine("Image format not identified, not proceeding with analysis."); return; } else { - if (options.Verbose) + if(options.Verbose) DicConsole.VerboseWriteLine("Image format identified by {0} ({1}).", _imageFormat.Name, _imageFormat.PluginUUID); else DicConsole.WriteLine("Image format identified by {0}.", _imageFormat.Name); @@ -83,7 +83,7 @@ namespace DiscImageChef.Commands try { - if (!_imageFormat.OpenImage(options.InputFile)) + if(!_imageFormat.OpenImage(options.InputFile)) { DicConsole.WriteLine("Unable to open image format"); DicConsole.WriteLine("No error given"); @@ -92,7 +92,7 @@ namespace DiscImageChef.Commands DicConsole.DebugWriteLine("Analyze command", "Correctly opened image file."); } - catch (Exception ex) + catch(Exception ex) { DicConsole.ErrorWriteLine("Unable to open image format"); DicConsole.ErrorWriteLine("Error: {0}", ex.Message); @@ -108,7 +108,7 @@ namespace DiscImageChef.Commands byte[] data; long position = 0; - while (position < (fi.Length - 1048576)) + while(position < (fi.Length - 1048576)) { data = new byte[1048576]; fs.Read(data, 0, 1048576); @@ -132,7 +132,7 @@ namespace DiscImageChef.Commands List imgChecksums = imgChkWorker.End(); - switch (_imageFormat.ImageInfo.xmlMediaType) + switch(_imageFormat.ImageInfo.xmlMediaType) { case XmlMediaType.OpticalDisc: { @@ -146,7 +146,7 @@ namespace DiscImageChef.Commands sidecar.OpticalDisc[0].Image.Value = Path.GetFileName(options.InputFile); sidecar.OpticalDisc[0].Size = fi.Length; sidecar.OpticalDisc[0].Sequence = new SequenceType(); - if (_imageFormat.GetMediaSequence() != 0 && _imageFormat.GetLastDiskSequence() != 0) + if(_imageFormat.GetMediaSequence() != 0 && _imageFormat.GetLastDiskSequence() != 0) { sidecar.OpticalDisc[0].Sequence.MediaSequence = _imageFormat.GetMediaSequence(); sidecar.OpticalDisc[0].Sequence.TotalMedia = _imageFormat.GetMediaSequence(); @@ -160,18 +160,18 @@ namespace DiscImageChef.Commands MediaType dskType = _imageFormat.ImageInfo.mediaType; - foreach (MediaTagType tagType in _imageFormat.ImageInfo.readableMediaTags) + foreach(MediaTagType tagType in _imageFormat.ImageInfo.readableMediaTags) { - switch (tagType) + switch(tagType) { case MediaTagType.CD_ATIP: sidecar.OpticalDisc[0].ATIP = new DumpType(); sidecar.OpticalDisc[0].ATIP.Checksums = Core.Checksum.GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.CD_ATIP)).ToArray(); sidecar.OpticalDisc[0].ATIP.Size = _imageFormat.ReadDiskTag(MediaTagType.CD_ATIP).Length; Decoders.CD.ATIP.CDATIP? atip = Decoders.CD.ATIP.Decode(_imageFormat.ReadDiskTag(MediaTagType.CD_ATIP)); - if (atip.HasValue) + if(atip.HasValue) { - if (atip.Value.DDCD) + if(atip.Value.DDCD) dskType = atip.Value.DiscType ? MediaType.DDCDRW : MediaType.DDCDR; else dskType = atip.Value.DiscType ? MediaType.CDRW : MediaType.CDR; @@ -190,9 +190,9 @@ namespace DiscImageChef.Commands case MediaTagType.DVD_CMI: sidecar.OpticalDisc[0].CMI = new DumpType(); Decoders.DVD.CSS_CPRM.LeadInCopyright? cmi = Decoders.DVD.CSS_CPRM.DecodeLeadInCopyright(_imageFormat.ReadDiskTag(MediaTagType.DVD_CMI)); - if (cmi.HasValue) + if(cmi.HasValue) { - switch (cmi.Value.CopyrightType) + switch(cmi.Value.CopyrightType) { case Decoders.DVD.CopyrightType.AACS: sidecar.OpticalDisc[0].CopyProtection = "AACS"; @@ -212,13 +212,13 @@ namespace DiscImageChef.Commands sidecar.OpticalDisc[0].DMI = new DumpType(); sidecar.OpticalDisc[0].DMI.Checksums = Core.Checksum.GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.DVD_DMI)).ToArray(); sidecar.OpticalDisc[0].DMI.Size = _imageFormat.ReadDiskTag(MediaTagType.DVD_DMI).Length; - if (Decoders.Xbox.DMI.IsXbox(_imageFormat.ReadDiskTag(MediaTagType.DVD_DMI))) + if(Decoders.Xbox.DMI.IsXbox(_imageFormat.ReadDiskTag(MediaTagType.DVD_DMI))) { dskType = MediaType.XGD; sidecar.OpticalDisc[0].Dimensions = new DimensionsType(); sidecar.OpticalDisc[0].Dimensions.Diameter = 120; } - else if (Decoders.Xbox.DMI.IsXbox360(_imageFormat.ReadDiskTag(MediaTagType.DVD_DMI))) + else if(Decoders.Xbox.DMI.IsXbox360(_imageFormat.ReadDiskTag(MediaTagType.DVD_DMI))) { dskType = MediaType.XGD2; sidecar.OpticalDisc[0].Dimensions = new DimensionsType(); @@ -230,13 +230,13 @@ namespace DiscImageChef.Commands sidecar.OpticalDisc[0].PFI.Checksums = Core.Checksum.GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.DVD_PFI)).ToArray(); sidecar.OpticalDisc[0].PFI.Size = _imageFormat.ReadDiskTag(MediaTagType.DVD_PFI).Length; Decoders.DVD.PFI.PhysicalFormatInformation? pfi = Decoders.DVD.PFI.Decode(_imageFormat.ReadDiskTag(MediaTagType.DVD_PFI)); - if (pfi.HasValue) + if(pfi.HasValue) { - if (dskType != MediaType.XGD && + if(dskType != MediaType.XGD && dskType != MediaType.XGD2 && dskType != MediaType.XGD3) { - switch (pfi.Value.DiskCategory) + switch(pfi.Value.DiskCategory) { case Decoders.DVD.DiskCategory.DVDPR: dskType = MediaType.DVDPR; @@ -282,19 +282,19 @@ namespace DiscImageChef.Commands break; } - if (dskType == MediaType.DVDR && pfi.Value.PartVersion == 6) + if(dskType == MediaType.DVDR && pfi.Value.PartVersion == 6) dskType = MediaType.DVDRDL; - if (dskType == MediaType.DVDRW && pfi.Value.PartVersion == 3) + if(dskType == MediaType.DVDRW && pfi.Value.PartVersion == 3) dskType = MediaType.DVDRWDL; - if (dskType == MediaType.GOD && pfi.Value.DiscSize == DiscImageChef.Decoders.DVD.DVDSize.OneTwenty) + if(dskType == MediaType.GOD && pfi.Value.DiscSize == DiscImageChef.Decoders.DVD.DVDSize.OneTwenty) dskType = MediaType.WOD; sidecar.OpticalDisc[0].Dimensions = new DimensionsType(); - if (dskType == MediaType.UMD) + if(dskType == MediaType.UMD) sidecar.OpticalDisc[0].Dimensions.Diameter = 60; - else if (pfi.Value.DiscSize == DiscImageChef.Decoders.DVD.DVDSize.Eighty) + else if(pfi.Value.DiscSize == DiscImageChef.Decoders.DVD.DVDSize.Eighty) sidecar.OpticalDisc[0].Dimensions.Diameter = 80; - else if (pfi.Value.DiscSize == DiscImageChef.Decoders.DVD.DVDSize.OneTwenty) + else if(pfi.Value.DiscSize == DiscImageChef.Decoders.DVD.DVDSize.OneTwenty) sidecar.OpticalDisc[0].Dimensions.Diameter = 120; } } @@ -319,17 +319,17 @@ namespace DiscImageChef.Commands List tracks = _imageFormat.GetTracks(); List trksLst = null; - if (tracks != null) + if(tracks != null) { sidecar.OpticalDisc[0].Tracks = new int[1]; sidecar.OpticalDisc[0].Tracks[0] = tracks.Count; trksLst = new List(); } - foreach (Track trk in tracks) + foreach(Track trk in tracks) { Schemas.TrackType xmlTrk = new Schemas.TrackType(); - switch (trk.TrackType) + switch(trk.TrackType) { case DiscImageChef.ImagePlugins.TrackType.Audio: xmlTrk.TrackType1 = TrackTypeTrackType.audio; @@ -347,7 +347,7 @@ namespace DiscImageChef.Commands xmlTrk.TrackType1 = TrackTypeTrackType.mode1; break; case DiscImageChef.ImagePlugins.TrackType.Data: - switch (sidecar.OpticalDisc[0].DiscType) + switch(sidecar.OpticalDisc[0].DiscType) { case "BD": xmlTrk.TrackType1 = TrackTypeTrackType.bluray; @@ -373,13 +373,13 @@ namespace DiscImageChef.Commands xmlTrk.StartSector = (long)trk.TrackStartSector; xmlTrk.EndSector = (long)trk.TrackEndSector; - if (sidecar.OpticalDisc[0].DiscType == "CD" || + if(sidecar.OpticalDisc[0].DiscType == "CD" || sidecar.OpticalDisc[0].DiscType == "GD") { xmlTrk.StartMSF = LbaToMsf(xmlTrk.StartSector); xmlTrk.EndMSF = LbaToMsf(xmlTrk.EndSector); } - else if (sidecar.OpticalDisc[0].DiscType == "DDCD") + else if(sidecar.OpticalDisc[0].DiscType == "DDCD") { xmlTrk.StartMSF = DdcdLbaToMsf(xmlTrk.StartSector); xmlTrk.EndMSF = DdcdLbaToMsf(xmlTrk.EndSector); @@ -387,7 +387,7 @@ namespace DiscImageChef.Commands xmlTrk.Image = new ImageType(); xmlTrk.Image.Value = Path.GetFileName(trk.TrackFile); - if (trk.TrackFileOffset > 0) + if(trk.TrackFileOffset > 0) { xmlTrk.Image.offset = (long)trk.TrackFileOffset; xmlTrk.Image.offsetSpecified = true; @@ -407,11 +407,11 @@ namespace DiscImageChef.Commands ulong sectors = (ulong)(xmlTrk.EndSector - xmlTrk.StartSector + 1); ulong doneSectors = 0; - while (doneSectors < sectors) + while(doneSectors < sectors) { byte[] sector; - if ((sectors - doneSectors) >= sectorsToRead) + if((sectors - doneSectors) >= sectorsToRead) { sector = _imageFormat.ReadSectorsLong(doneSectors, sectorsToRead, (uint)xmlTrk.Sequence.TrackNumber); DicConsole.Write("\rHashings sectors {0} to {2} of track {1} ({3} sectors)", doneSectors, xmlTrk.Sequence.TrackNumber, doneSectors + sectorsToRead, sectors); @@ -433,11 +433,11 @@ namespace DiscImageChef.Commands DicConsole.WriteLine(); - if (trk.TrackSubchannelType != TrackSubchannelType.None) + if(trk.TrackSubchannelType != TrackSubchannelType.None) { xmlTrk.SubChannel = new SubChannelType(); xmlTrk.SubChannel.Image = new ImageType(); - switch (trk.TrackSubchannelType) + switch(trk.TrackSubchannelType) { case TrackSubchannelType.Packed: case TrackSubchannelType.PackedInterleaved: @@ -449,7 +449,7 @@ namespace DiscImageChef.Commands break; } - if (trk.TrackFileOffset > 0) + if(trk.TrackFileOffset > 0) { xmlTrk.SubChannel.Image.offset = (long)trk.TrackSubchannelOffset; xmlTrk.SubChannel.Image.offsetSpecified = true; @@ -464,11 +464,11 @@ namespace DiscImageChef.Commands sectors = (ulong)(xmlTrk.EndSector - xmlTrk.StartSector + 1); doneSectors = 0; - while (doneSectors < sectors) + while(doneSectors < sectors) { byte[] sector; - if ((sectors - doneSectors) >= sectorsToRead) + if((sectors - doneSectors) >= sectorsToRead) { sector = _imageFormat.ReadSectorsTag(doneSectors, sectorsToRead, (uint)xmlTrk.Sequence.TrackNumber, SectorTagType.CDSectorSubchannel); DicConsole.Write("\rHashings subchannel sectors {0} to {2} of track {1} ({3} sectors)", doneSectors, xmlTrk.Sequence.TrackNumber, doneSectors + sectorsToRead, sectors); @@ -498,11 +498,11 @@ namespace DiscImageChef.Commands List partitions = new List(); - foreach (PartPlugin _partplugin in plugins.PartPluginsList.Values) + foreach(PartPlugin _partplugin in plugins.PartPluginsList.Values) { List _partitions; - if (_partplugin.GetInformation(_imageFormat, out _partitions)) + if(_partplugin.GetInformation(_imageFormat, out _partitions)) { partitions.AddRange(_partitions); Core.Statistics.AddPartition(_partplugin.Name); @@ -510,10 +510,10 @@ namespace DiscImageChef.Commands } xmlTrk.FileSystemInformation = new PartitionType[1]; - if (partitions.Count > 0) + if(partitions.Count > 0) { xmlTrk.FileSystemInformation = new PartitionType[partitions.Count]; - for (int i = 0; i < partitions.Count; i++) + for(int i = 0; i < partitions.Count; i++) { xmlTrk.FileSystemInformation[i] = new PartitionType(); xmlTrk.FileSystemInformation[i].Description = partitions[i].PartitionDescription; @@ -525,24 +525,24 @@ namespace DiscImageChef.Commands List lstFs = new List(); - foreach (Plugin _plugin in plugins.PluginsList.Values) + foreach(Plugin _plugin in plugins.PluginsList.Values) { try { - if (_plugin.Identify(_imageFormat, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector + partitions[i].PartitionSectors - 1)) + if(_plugin.Identify(_imageFormat, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector + partitions[i].PartitionSectors - 1)) { string foo; _plugin.GetInformation(_imageFormat, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector + partitions[i].PartitionSectors - 1, out foo); lstFs.Add(_plugin.XmlFSType); Core.Statistics.AddFilesystem(_plugin.XmlFSType.Type); - if (_plugin.XmlFSType.Type == "Opera") + if(_plugin.XmlFSType.Type == "Opera") dskType = MediaType.ThreeDO; - if (_plugin.XmlFSType.Type == "PC Engine filesystem") + if(_plugin.XmlFSType.Type == "PC Engine filesystem") dskType = MediaType.SuperCDROM2; - if (_plugin.XmlFSType.Type == "Nintendo Wii filesystem") + if(_plugin.XmlFSType.Type == "Nintendo Wii filesystem") dskType = MediaType.WOD; - if (_plugin.XmlFSType.Type == "Nintendo Gamecube filesystem") + if(_plugin.XmlFSType.Type == "Nintendo Gamecube filesystem") dskType = MediaType.GOD; } } @@ -552,7 +552,7 @@ namespace DiscImageChef.Commands } } - if (lstFs.Count > 0) + if(lstFs.Count > 0) xmlTrk.FileSystemInformation[i].FileSystems = lstFs.ToArray(); } } @@ -564,24 +564,24 @@ namespace DiscImageChef.Commands List lstFs = new List(); - foreach (Plugin _plugin in plugins.PluginsList.Values) + foreach(Plugin _plugin in plugins.PluginsList.Values) { try { - if (_plugin.Identify(_imageFormat, (ulong)xmlTrk.StartSector, (ulong)xmlTrk.EndSector)) + if(_plugin.Identify(_imageFormat, (ulong)xmlTrk.StartSector, (ulong)xmlTrk.EndSector)) { string foo; _plugin.GetInformation(_imageFormat, (ulong)xmlTrk.StartSector, (ulong)xmlTrk.EndSector, out foo); lstFs.Add(_plugin.XmlFSType); Core.Statistics.AddFilesystem(_plugin.XmlFSType.Type); - if (_plugin.XmlFSType.Type == "Opera") + if(_plugin.XmlFSType.Type == "Opera") dskType = MediaType.ThreeDO; - if (_plugin.XmlFSType.Type == "PC Engine filesystem") + if(_plugin.XmlFSType.Type == "PC Engine filesystem") dskType = MediaType.SuperCDROM2; - if (_plugin.XmlFSType.Type == "Nintendo Wii filesystem") + if(_plugin.XmlFSType.Type == "Nintendo Wii filesystem") dskType = MediaType.WOD; - if (_plugin.XmlFSType.Type == "Nintendo Gamecube filesystem") + if(_plugin.XmlFSType.Type == "Nintendo Gamecube filesystem") dskType = MediaType.GOD; } } @@ -591,16 +591,16 @@ namespace DiscImageChef.Commands } } - if (lstFs.Count > 0) + if(lstFs.Count > 0) xmlTrk.FileSystemInformation[0].FileSystems = lstFs.ToArray(); } trksLst.Add(xmlTrk); } - if (trksLst != null) + if(trksLst != null) sidecar.OpticalDisc[0].Track = trksLst.ToArray(); - + string dscType, dscSubType; Metadata.MediaType.MediaTypeToString(dskType, out dscType, out dscSubType); sidecar.OpticalDisc[0].DiscType = dscType; @@ -621,7 +621,7 @@ namespace DiscImageChef.Commands sidecar.BlockMedia[0].Image.Value = Path.GetFileName(options.InputFile); sidecar.BlockMedia[0].Size = fi.Length; sidecar.BlockMedia[0].Sequence = new SequenceType(); - if (_imageFormat.GetMediaSequence() != 0 && _imageFormat.GetLastDiskSequence() != 0) + if(_imageFormat.GetMediaSequence() != 0 && _imageFormat.GetLastDiskSequence() != 0) { sidecar.BlockMedia[0].Sequence.MediaSequence = _imageFormat.GetMediaSequence(); sidecar.BlockMedia[0].Sequence.TotalMedia = _imageFormat.GetMediaSequence(); @@ -633,9 +633,9 @@ namespace DiscImageChef.Commands } sidecar.BlockMedia[0].Sequence.MediaTitle = _imageFormat.GetImageName(); - foreach (MediaTagType tagType in _imageFormat.ImageInfo.readableMediaTags) + foreach(MediaTagType tagType in _imageFormat.ImageInfo.readableMediaTags) { - switch (tagType) + switch(tagType) { case MediaTagType.ATAPI_IDENTIFY: sidecar.BlockMedia[0].ATA = new ATAType(); @@ -702,11 +702,11 @@ namespace DiscImageChef.Commands List partitions = new List(); - foreach (PartPlugin _partplugin in plugins.PartPluginsList.Values) + foreach(PartPlugin _partplugin in plugins.PartPluginsList.Values) { List _partitions; - if (_partplugin.GetInformation(_imageFormat, out _partitions)) + if(_partplugin.GetInformation(_imageFormat, out _partitions)) { partitions = _partitions; Core.Statistics.AddPartition(_partplugin.Name); @@ -715,10 +715,10 @@ namespace DiscImageChef.Commands } sidecar.BlockMedia[0].FileSystemInformation = new PartitionType[1]; - if (partitions.Count > 0) + if(partitions.Count > 0) { sidecar.BlockMedia[0].FileSystemInformation = new PartitionType[partitions.Count]; - for (int i = 0; i < partitions.Count; i++) + for(int i = 0; i < partitions.Count; i++) { sidecar.BlockMedia[0].FileSystemInformation[i] = new PartitionType(); sidecar.BlockMedia[0].FileSystemInformation[i].Description = partitions[i].PartitionDescription; @@ -730,11 +730,11 @@ namespace DiscImageChef.Commands List lstFs = new List(); - foreach (Plugin _plugin in plugins.PluginsList.Values) + foreach(Plugin _plugin in plugins.PluginsList.Values) { try { - if (_plugin.Identify(_imageFormat, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector + partitions[i].PartitionSectors - 1)) + if(_plugin.Identify(_imageFormat, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector + partitions[i].PartitionSectors - 1)) { string foo; _plugin.GetInformation(_imageFormat, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector + partitions[i].PartitionSectors - 1, out foo); @@ -748,7 +748,7 @@ namespace DiscImageChef.Commands } } - if (lstFs.Count > 0) + if(lstFs.Count > 0) sidecar.BlockMedia[0].FileSystemInformation[i].FileSystems = lstFs.ToArray(); } } @@ -760,11 +760,11 @@ namespace DiscImageChef.Commands List lstFs = new List(); - foreach (Plugin _plugin in plugins.PluginsList.Values) + foreach(Plugin _plugin in plugins.PluginsList.Values) { try { - if (_plugin.Identify(_imageFormat, 0, _imageFormat.GetSectors() - 1)) + if(_plugin.Identify(_imageFormat, 0, _imageFormat.GetSectors() - 1)) { string foo; _plugin.GetInformation(_imageFormat, 0, _imageFormat.GetSectors() - 1, out foo); @@ -778,7 +778,7 @@ namespace DiscImageChef.Commands } } - if (lstFs.Count > 0) + if(lstFs.Count > 0) sidecar.BlockMedia[0].FileSystemInformation[0].FileSystems = lstFs.ToArray(); } @@ -814,7 +814,7 @@ namespace DiscImageChef.Commands sidecar.AudioMedia[0].Image.Value = Path.GetFileName(options.InputFile); sidecar.AudioMedia[0].Size = fi.Length; sidecar.AudioMedia[0].Sequence = new SequenceType(); - if (_imageFormat.GetMediaSequence() != 0 && _imageFormat.GetLastDiskSequence() != 0) + if(_imageFormat.GetMediaSequence() != 0 && _imageFormat.GetLastDiskSequence() != 0) { sidecar.AudioMedia[0].Sequence.MediaSequence = _imageFormat.GetMediaSequence(); sidecar.AudioMedia[0].Sequence.TotalMedia = _imageFormat.GetMediaSequence(); @@ -836,7 +836,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Writing metadata sidecar"); FileStream xmlFs = new FileStream(Path.GetDirectoryName(options.InputFile) + - //Path.PathSeparator + + //Path.PathSeparator + Path.GetFileNameWithoutExtension(options.InputFile) + ".cicm.xml", FileMode.CreateNew); @@ -846,7 +846,7 @@ namespace DiscImageChef.Commands Core.Statistics.AddCommand("create-sidecar"); } - catch (Exception ex) + catch(Exception ex) { DicConsole.ErrorWriteLine(String.Format("Error reading file: {0}", ex.Message)); DicConsole.DebugWriteLine("Analyze command", ex.StackTrace); @@ -857,7 +857,7 @@ namespace DiscImageChef.Commands static string LbaToMsf(long lba) { long m, s, f; - if (lba >= -150) + if(lba >= -150) { m = (lba + 150) / (75 * 60); lba -= m * (75 * 60); @@ -880,7 +880,7 @@ namespace DiscImageChef.Commands static string DdcdLbaToMsf(long lba) { long h, m, s, f; - if (lba >= -150) + if(lba >= -150) { h = (lba + 150) / (75 * 60 * 60); lba -= h * (75 * 60 * 60); diff --git a/DiscImageChef/Commands/Decode.cs b/DiscImageChef/Commands/Decode.cs index c8d9a65b6..64d9828f0 100644 --- a/DiscImageChef/Commands/Decode.cs +++ b/DiscImageChef/Commands/Decode.cs @@ -53,7 +53,7 @@ namespace DiscImageChef.Commands DicConsole.DebugWriteLine("Decode command", "--disk-tags={0}", options.DiskTags); DicConsole.DebugWriteLine("Decode command", "--sector-tags={0}", options.SectorTags); - if (!System.IO.File.Exists(options.InputFile)) + if(!System.IO.File.Exists(options.InputFile)) { DicConsole.ErrorWriteLine("Specified file does not exist."); return; @@ -61,7 +61,7 @@ namespace DiscImageChef.Commands ImagePlugin inputFormat = ImageFormat.Detect(options.InputFile); - if (inputFormat == null) + if(inputFormat == null) { DicConsole.ErrorWriteLine("Unable to recognize image format, not decoding"); return; @@ -71,20 +71,20 @@ namespace DiscImageChef.Commands Core.Statistics.AddMediaFormat(inputFormat.GetImageFormat()); Core.Statistics.AddMedia(inputFormat.ImageInfo.mediaType, false); - if (options.DiskTags) + if(options.DiskTags) { - if (inputFormat.ImageInfo.readableMediaTags.Count == 0) + if(inputFormat.ImageInfo.readableMediaTags.Count == 0) DicConsole.WriteLine("There are no disk tags in chosen disc image."); else { - foreach (MediaTagType tag in inputFormat.ImageInfo.readableMediaTags) + foreach(MediaTagType tag in inputFormat.ImageInfo.readableMediaTags) { - switch (tag) + switch(tag) { case MediaTagType.SCSI_INQUIRY: { byte[] inquiry = inputFormat.ReadDiskTag(MediaTagType.SCSI_INQUIRY); - if (inquiry == null) + if(inquiry == null) DicConsole.WriteLine("Error reading SCSI INQUIRY response from disc image"); else { @@ -98,7 +98,7 @@ namespace DiscImageChef.Commands case MediaTagType.ATA_IDENTIFY: { byte[] identify = inputFormat.ReadDiskTag(MediaTagType.ATA_IDENTIFY); - if (identify == null) + if(identify == null) DicConsole.WriteLine("Error reading ATA IDENTIFY DEVICE response from disc image"); else { @@ -112,7 +112,7 @@ namespace DiscImageChef.Commands case MediaTagType.ATAPI_IDENTIFY: { byte[] identify = inputFormat.ReadDiskTag(MediaTagType.ATAPI_IDENTIFY); - if (identify == null) + if(identify == null) DicConsole.WriteLine("Error reading ATA IDENTIFY PACKET DEVICE response from disc image"); else { @@ -126,7 +126,7 @@ namespace DiscImageChef.Commands case MediaTagType.CD_ATIP: { byte[] atip = inputFormat.ReadDiskTag(MediaTagType.CD_ATIP); - if (atip == null) + if(atip == null) DicConsole.WriteLine("Error reading CD ATIP from disc image"); else { @@ -140,7 +140,7 @@ namespace DiscImageChef.Commands case MediaTagType.CD_FullTOC: { byte[] fulltoc = inputFormat.ReadDiskTag(MediaTagType.CD_FullTOC); - if (fulltoc == null) + if(fulltoc == null) DicConsole.WriteLine("Error reading CD full TOC from disc image"); else { @@ -154,7 +154,7 @@ namespace DiscImageChef.Commands case MediaTagType.CD_PMA: { byte[] pma = inputFormat.ReadDiskTag(MediaTagType.CD_PMA); - if (pma == null) + if(pma == null) DicConsole.WriteLine("Error reading CD PMA from disc image"); else { @@ -168,7 +168,7 @@ namespace DiscImageChef.Commands case MediaTagType.CD_SessionInfo: { byte[] sessioninfo = inputFormat.ReadDiskTag(MediaTagType.CD_SessionInfo); - if (sessioninfo == null) + if(sessioninfo == null) DicConsole.WriteLine("Error reading CD session information from disc image"); else { @@ -182,7 +182,7 @@ namespace DiscImageChef.Commands case MediaTagType.CD_TEXT: { byte[] cdtext = inputFormat.ReadDiskTag(MediaTagType.CD_TEXT); - if (cdtext == null) + if(cdtext == null) DicConsole.WriteLine("Error reading CD-TEXT from disc image"); else { @@ -196,7 +196,7 @@ namespace DiscImageChef.Commands case MediaTagType.CD_TOC: { byte[] toc = inputFormat.ReadDiskTag(MediaTagType.CD_TOC); - if (toc == null) + if(toc == null) DicConsole.WriteLine("Error reading CD TOC from disc image"); else { @@ -215,15 +215,15 @@ namespace DiscImageChef.Commands } } - if (options.SectorTags) + if(options.SectorTags) { UInt64 length; - if (options.Length.ToLowerInvariant() == "all") + if(options.Length.ToLowerInvariant() == "all") length = inputFormat.GetSectors() - 1; else { - if (!UInt64.TryParse(options.Length, out length)) + if(!UInt64.TryParse(options.Length, out length)) { DicConsole.WriteLine("Value \"{0}\" is not a valid number for length.", options.Length); DicConsole.WriteLine("Not decoding sectors tags"); @@ -231,13 +231,13 @@ namespace DiscImageChef.Commands } } - if (inputFormat.ImageInfo.readableSectorTags.Count == 0) + if(inputFormat.ImageInfo.readableSectorTags.Count == 0) DicConsole.WriteLine("There are no sector tags in chosen disc image."); else { - foreach (SectorTagType tag in inputFormat.ImageInfo.readableSectorTags) + foreach(SectorTagType tag in inputFormat.ImageInfo.readableSectorTags) { - switch (tag) + switch(tag) { default: DicConsole.WriteLine("Decoder for disk tag type \"{0}\" not yet implemented, sorry.", tag); diff --git a/DiscImageChef/Commands/DeviceInfo.cs b/DiscImageChef/Commands/DeviceInfo.cs index 74d8243dd..911239a4f 100644 --- a/DiscImageChef/Commands/DeviceInfo.cs +++ b/DiscImageChef/Commands/DeviceInfo.cs @@ -53,13 +53,13 @@ namespace DiscImageChef.Commands DicConsole.DebugWriteLine("Device-Info command", "--device={0}", options.DevicePath); DicConsole.DebugWriteLine("Device-Info command", "--output-prefix={0}", options.OutputPrefix); - if (!System.IO.File.Exists(options.DevicePath)) + if(!System.IO.File.Exists(options.DevicePath)) { DicConsole.ErrorWriteLine("Specified device does not exist."); return; } - if (options.DevicePath.Length == 2 && options.DevicePath[1] == ':' && + if(options.DevicePath.Length == 2 && options.DevicePath[1] == ':' && options.DevicePath[0] != '/' && Char.IsLetter(options.DevicePath[0])) { options.DevicePath = "\\\\.\\" + Char.ToUpper(options.DevicePath[0]) + ':'; @@ -67,7 +67,7 @@ namespace DiscImageChef.Commands Device dev = new Device(options.DevicePath); - if (dev.Error) + if(dev.Error) { DicConsole.ErrorWriteLine("Error {0} opening device.", dev.LastError); return; @@ -75,7 +75,7 @@ namespace DiscImageChef.Commands Core.Statistics.AddDevice(dev); - if (dev.IsUSB) + if(dev.IsUSB) { DicConsole.WriteLine("USB device"); if(dev.USBDescriptors != null) @@ -88,7 +88,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine(); } - if (dev.IsFireWire) + if(dev.IsFireWire) { DicConsole.WriteLine("FireWire device"); DicConsole.WriteLine("FireWire Vendor ID: {0:X6}", dev.FireWireVendor); @@ -99,7 +99,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine(); } - switch (dev.Type) + switch(dev.Type) { case DeviceType.ATA: { @@ -108,7 +108,7 @@ namespace DiscImageChef.Commands byte[] ataBuf; bool sense = dev.AtaIdentify(out ataBuf, out errorRegisters); - if (sense) + if(sense) { DicConsole.DebugWriteLine("Device-Info command", "STATUS = 0x{0:X2}", errorRegisters.status); DicConsole.DebugWriteLine("Device-Info command", "ERROR = 0x{0:X2}", errorRegisters.error); @@ -129,24 +129,24 @@ namespace DiscImageChef.Commands double duration; dev.EnableMediaCardPassThrough(out errorRegisters, dev.Timeout, out duration); - if (errorRegisters.sector == 0xAA && errorRegisters.sectorCount == 0x55) + if(errorRegisters.sector == 0xAA && errorRegisters.sectorCount == 0x55) { DicConsole.WriteLine("Device supports the Media Card Pass Through Command Set"); - switch (errorRegisters.deviceHead & 0x7) + switch(errorRegisters.deviceHead & 0x7) { case 0: DicConsole.WriteLine("Device reports incorrect media card type"); break; - case 1: + case 1: DicConsole.WriteLine("Device contains a Secure Digital card"); break; - case 2: + case 2: DicConsole.WriteLine("Device contains a MultiMediaCard "); break; - case 3: + case 3: DicConsole.WriteLine("Device contains a Secure Digital I/O card"); break; - case 4: + case 4: DicConsole.WriteLine("Device contains a Smart Media card"); break; default: @@ -154,11 +154,11 @@ namespace DiscImageChef.Commands break; } - if ((errorRegisters.deviceHead & 0x08) == 0x08) + if((errorRegisters.deviceHead & 0x08) == 0x08) DicConsole.WriteLine("Media card is write protected"); ushort specificData = (ushort)((errorRegisters.cylinderHigh * 0x100) + errorRegisters.cylinderLow); - if (specificData != 0) + if(specificData != 0) DicConsole.WriteLine("Card specific data: 0x{0:X4}", specificData); } @@ -171,7 +171,7 @@ namespace DiscImageChef.Commands byte[] ataBuf; bool sense = dev.AtapiIdentify(out ataBuf, out errorRegisters); - if (sense) + if(sense) { DicConsole.DebugWriteLine("Device-Info command", "STATUS = 0x{0:X2}", errorRegisters.status); DicConsole.DebugWriteLine("Device-Info command", "ERROR = 0x{0:X2}", errorRegisters.error); @@ -199,14 +199,14 @@ namespace DiscImageChef.Commands bool sense = dev.ScsiInquiry(out inqBuf, out senseBuf); - if (sense) + if(sense) { DicConsole.ErrorWriteLine("SCSI error:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); break; } - if (dev.Type != DeviceType.ATAPI) + if(dev.Type != DeviceType.ATAPI) DicConsole.WriteLine("SCSI device"); doWriteFile(options.OutputPrefix, "_scsi_inquiry.bin", "SCSI INQUIRY", inqBuf); @@ -220,30 +220,30 @@ namespace DiscImageChef.Commands sense = dev.ScsiInquiry(out inqBuf, out senseBuf, 0x00); - if (!sense) + if(!sense) { byte[] pages = Decoders.SCSI.EVPD.DecodePage00(inqBuf); - if (pages != null) + if(pages != null) { - foreach (byte page in pages) + foreach(byte page in pages) { - if (page >= 0x01 && page <= 0x7F) + if(page >= 0x01 && page <= 0x7F) { sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); - if (!sense) + if(!sense) { - if (sb == null) + if(sb == null) sb = new StringBuilder(); sb.AppendFormat("Page 0x{0:X2}: ", Decoders.SCSI.EVPD.DecodeASCIIPage(inqBuf)).AppendLine(); doWriteFile(options.OutputPrefix, String.Format("_scsi_evpd_{0:X2}h.bin", page), String.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); } } - else if (page == 0x80) + else if(page == 0x80) { sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); - if (!sense) + if(!sense) { scsi80 = true; scsiSerial = Decoders.SCSI.EVPD.DecodePage80(inqBuf); @@ -253,12 +253,12 @@ namespace DiscImageChef.Commands } else { - if (page != 0x00) + if(page != 0x00) { DicConsole.DebugWriteLine("Device-Info command", "Found undecoded SCSI VPD page 0x{0:X2}", page); sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page); - if (!sense) + if(!sense) { doWriteFile(options.OutputPrefix, String.Format("_scsi_evpd_{0:X2}h.bin", page), String.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf); } @@ -268,10 +268,10 @@ namespace DiscImageChef.Commands } } - if (scsi80) + if(scsi80) DicConsole.WriteLine("Unit Serial Number: {0}", scsiSerial); - if (sb != null) + if(sb != null) { DicConsole.WriteLine("ASCII VPDs:"); DicConsole.WriteLine(sb.ToString()); @@ -283,12 +283,12 @@ namespace DiscImageChef.Commands Decoders.SCSI.PeripheralDeviceTypes devType = (DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes)inq.Value.PeripheralDeviceType; sense = dev.ModeSense10(out modeBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, 0x3F, 0xFF, 5, out duration); - if (sense || dev.Error) + if(sense || dev.Error) { sense = dev.ModeSense10(out modeBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out duration); } - if (!sense && !dev.Error) + if(!sense && !dev.Error) { decMode = Decoders.SCSI.Modes.DecodeMode10(modeBuf, devType); } @@ -296,36 +296,36 @@ namespace DiscImageChef.Commands if(sense || dev.Error || !decMode.HasValue) { sense = dev.ModeSense6(out modeBuf, out senseBuf, false, ScsiModeSensePageControl.Current, 0x3F, 0xFF, 5, out duration); - if (sense || dev.Error) + if(sense || dev.Error) sense = dev.ModeSense6(out modeBuf, out senseBuf, false, ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out duration); - if (sense || dev.Error) + if(sense || dev.Error) sense = dev.ModeSense(out modeBuf, out senseBuf, 5, out duration); - if (!sense && !dev.Error) + if(!sense && !dev.Error) decMode = Decoders.SCSI.Modes.DecodeMode6(modeBuf, devType); } - if (!sense) + if(!sense) doWriteFile(options.OutputPrefix, "_scsi_modesense.bin", "SCSI MODE SENSE", modeBuf); - if (decMode.HasValue) + if(decMode.HasValue) { DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModeHeader(decMode.Value.Header, devType)); - if (decMode.Value.Pages != null) + if(decMode.Value.Pages != null) { - foreach (Decoders.SCSI.Modes.ModePage page in decMode.Value.Pages) + foreach(Decoders.SCSI.Modes.ModePage page in decMode.Value.Pages) { //DicConsole.WriteLine("Page {0:X2}h subpage {1:X2}h is {2} bytes long", page.Page, page.Subpage, page.PageResponse.Length); - switch (page.Page) + switch(page.Page) { case 0x00: { - if (devType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice && page.Subpage == 0) + if(devType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice && page.Subpage == 0) DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_00_SFF(page.PageResponse)); else { - if (page.Subpage != 0) + if(page.Subpage != 0) DicConsole.WriteLine("Found unknown vendor mode page {0:X2}h subpage {1:X2}h", page.Page, page.Subpage); else DicConsole.WriteLine("Found unknown vendor mode page {0:X2}h", page.Page); @@ -334,9 +334,9 @@ namespace DiscImageChef.Commands } case 0x01: { - if (page.Subpage == 0) + if(page.Subpage == 0) { - if (devType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice) + if(devType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice) DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_01_MMC(page.PageResponse)); else DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_01(page.PageResponse)); @@ -348,7 +348,7 @@ namespace DiscImageChef.Commands } case 0x02: { - if (page.Subpage == 0) + if(page.Subpage == 0) DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_02(page.PageResponse)); else goto default; @@ -357,7 +357,7 @@ namespace DiscImageChef.Commands } case 0x03: { - if (page.Subpage == 0) + if(page.Subpage == 0) DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_03(page.PageResponse)); else goto default; @@ -366,7 +366,7 @@ namespace DiscImageChef.Commands } case 0x04: { - if (page.Subpage == 0) + if(page.Subpage == 0) DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_04(page.PageResponse)); else goto default; @@ -375,7 +375,7 @@ namespace DiscImageChef.Commands } case 0x05: { - if (page.Subpage == 0) + if(page.Subpage == 0) DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_05(page.PageResponse)); else goto default; @@ -384,7 +384,7 @@ namespace DiscImageChef.Commands } case 0x06: { - if (page.Subpage == 0) + if(page.Subpage == 0) DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_06(page.PageResponse)); else goto default; @@ -393,9 +393,9 @@ namespace DiscImageChef.Commands } case 0x07: { - if (page.Subpage == 0) + if(page.Subpage == 0) { - if (devType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice) + if(devType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice) DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_07_MMC(page.PageResponse)); else DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_07(page.PageResponse)); @@ -407,7 +407,7 @@ namespace DiscImageChef.Commands } case 0x08: { - if (page.Subpage == 0) + if(page.Subpage == 0) DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_08(page.PageResponse)); else goto default; @@ -416,9 +416,9 @@ namespace DiscImageChef.Commands } case 0x0A: { - if (page.Subpage == 0) + if(page.Subpage == 0) DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_0A(page.PageResponse)); - else if (page.Subpage == 1) + else if(page.Subpage == 1) DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_0A_S01(page.PageResponse)); else goto default; @@ -427,7 +427,7 @@ namespace DiscImageChef.Commands } case 0x0B: { - if (page.Subpage == 0) + if(page.Subpage == 0) DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_0B(page.PageResponse)); else goto default; @@ -436,7 +436,7 @@ namespace DiscImageChef.Commands } case 0x0D: { - if (page.Subpage == 0) + if(page.Subpage == 0) DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_0D(page.PageResponse)); else goto default; @@ -445,7 +445,7 @@ namespace DiscImageChef.Commands } case 0x0E: { - if (page.Subpage == 0) + if(page.Subpage == 0) DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_0E(page.PageResponse)); else goto default; @@ -454,7 +454,7 @@ namespace DiscImageChef.Commands } case 0x0F: { - if (page.Subpage == 0) + if(page.Subpage == 0) DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_0F(page.PageResponse)); else goto default; @@ -463,9 +463,9 @@ namespace DiscImageChef.Commands } case 0x10: { - if (page.Subpage == 0) + if(page.Subpage == 0) { - if (devType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess) + if(devType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess) DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_10_SSC(page.PageResponse)); else DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_10(page.PageResponse)); @@ -477,9 +477,9 @@ namespace DiscImageChef.Commands } case 0x1A: { - if (page.Subpage == 0) + if(page.Subpage == 0) DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_1A(page.PageResponse)); - else if (page.Subpage == 1) + else if(page.Subpage == 1) DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_1A_S01(page.PageResponse)); else goto default; @@ -488,7 +488,7 @@ namespace DiscImageChef.Commands } case 0x1B: { - if (page.Subpage == 0) + if(page.Subpage == 0) DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_1B(page.PageResponse)); else goto default; @@ -497,14 +497,14 @@ namespace DiscImageChef.Commands } case 0x1C: { - if (page.Subpage == 0) + if(page.Subpage == 0) { - if (devType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice) + if(devType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice) DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_1C_SFF(page.PageResponse)); else DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_1C(page.PageResponse)); } - else if (page.Subpage == 1) + else if(page.Subpage == 1) DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_1C_S01(page.PageResponse)); else goto default; @@ -513,7 +513,7 @@ namespace DiscImageChef.Commands } case 0x2A: { - if (page.Subpage == 0) + if(page.Subpage == 0) DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_2A(page.PageResponse)); else goto default; @@ -522,7 +522,7 @@ namespace DiscImageChef.Commands } case 0x3E: { - if (StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "FUJITSU") + if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "FUJITSU") DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyFujitsuModePage_3E(page.PageResponse)); else goto default; @@ -531,7 +531,7 @@ namespace DiscImageChef.Commands } default: { - if (page.Subpage != 0) + if(page.Subpage != 0) DicConsole.WriteLine("Found unknown mode page {0:X2}h subpage {1:X2}h", page.Page, page.Subpage); else DicConsole.WriteLine("Found unknown mode page {0:X2}h", page.Page); @@ -542,13 +542,13 @@ namespace DiscImageChef.Commands } } - if (devType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice) + if(devType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice) { - + byte[] confBuf; sense = dev.GetConfiguration(out confBuf, out senseBuf, dev.Timeout, out duration); - if (!sense) + if(!sense) { doWriteFile(options.OutputPrefix, "_mmc_getconfiguration.bin", "MMC GET CONFIGURATION", confBuf); @@ -556,14 +556,14 @@ namespace DiscImageChef.Commands DicConsole.DebugWriteLine("Device-Info command", "GET CONFIGURATION length is {0} bytes", ftr.DataLength); DicConsole.DebugWriteLine("Device-Info command", "GET CONFIGURATION current profile is {0:X4}h", ftr.CurrentProfile); - if (ftr.Descriptors != null) + if(ftr.Descriptors != null) { DicConsole.WriteLine("SCSI MMC GET CONFIGURATION Features:"); - foreach (Decoders.SCSI.MMC.Features.FeatureDescriptor desc in ftr.Descriptors) + foreach(Decoders.SCSI.MMC.Features.FeatureDescriptor desc in ftr.Descriptors) { DicConsole.DebugWriteLine("Device-Info command", "Feature {0:X4}h", desc.Code); - switch (desc.Code) + switch(desc.Code) { case 0x0000: DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0000(desc.Data)); @@ -795,13 +795,13 @@ namespace DiscImageChef.Commands */ #region Plextor - if (dev.Manufacturer == "PLEXTOR") + if(dev.Manufacturer == "PLEXTOR") { bool plxtSense = true; bool plxtDvd = false; byte[] plxtBuf = null; - switch (dev.Model) + switch(dev.Model) { case "DVDR PX-708A": case "DVDR PX-708A2": @@ -817,10 +817,10 @@ namespace DiscImageChef.Commands { byte[] plxtBufSmall; plxtBuf = new byte[256 * 4]; - for (byte i = 0; i < 4; i++) + for(byte i = 0; i < 4; i++) { plxtSense = dev.PlextorReadEepromBlock(out plxtBufSmall, out senseBuf, i, 256, dev.Timeout, out duration); - if (plxtSense) + if(plxtSense) break; Array.Copy(plxtBufSmall, 0, plxtBuf, i * 256, 256); } @@ -829,7 +829,7 @@ namespace DiscImageChef.Commands } default: { - if (dev.Model.StartsWith("CD-R ")) + if(dev.Model.StartsWith("CD-R ")) { plxtSense = dev.PlextorReadEepromCDR(out plxtBuf, out senseBuf, dev.Timeout, out duration); } @@ -837,7 +837,7 @@ namespace DiscImageChef.Commands } } - if (!plxtSense) + if(!plxtSense) { doWriteFile(options.OutputPrefix, "_plextor_eeprom.bin", "PLEXTOR READ EEPROM", plxtBuf); @@ -845,7 +845,7 @@ namespace DiscImageChef.Commands uint cdReadTime, cdWriteTime, dvdReadTime = 0, dvdWriteTime = 0; BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; - if (plxtDvd) + if(plxtDvd) { discs = BigEndianBitConverter.ToUInt16(plxtBuf, 0x0120); cdReadTime = BigEndianBitConverter.ToUInt32(plxtBuf, 0x0122); @@ -865,7 +865,7 @@ namespace DiscImageChef.Commands cdReadTime / 3600, (cdReadTime / 60) % 60, cdReadTime % 60); DicConsole.WriteLine("Drive has spent {0} hours, {1} minutes and {2} seconds writing CDs", cdWriteTime / 3600, (cdWriteTime / 60) % 60, cdWriteTime % 60); - if (plxtDvd) + if(plxtDvd) { DicConsole.WriteLine("Drive has spent {0} hours, {1} minutes and {2} seconds reading DVDs", dvdReadTime / 3600, (dvdReadTime / 60) % 60, dvdReadTime % 60); @@ -877,14 +877,14 @@ namespace DiscImageChef.Commands bool plxtPwrRecEnabled; ushort plxtPwrRecSpeed; plxtSense = dev.PlextorGetPoweRec(out senseBuf, out plxtPwrRecEnabled, out plxtPwrRecSpeed, dev.Timeout, out duration); - if (!plxtSense) + if(!plxtSense) { DicConsole.Write("Drive supports PoweRec"); - if (plxtPwrRecEnabled) + if(plxtPwrRecEnabled) { DicConsole.Write(", has it enabled"); - if (plxtPwrRecSpeed > 0) + if(plxtPwrRecSpeed > 0) DicConsole.WriteLine(" and recommends {0} Kb/sec.", plxtPwrRecSpeed); else DicConsole.WriteLine("."); @@ -892,13 +892,13 @@ namespace DiscImageChef.Commands ushort plxtPwrRecSelected, plxtPwrRecMax, plxtPwrRecLast; plxtSense = dev.PlextorGetSpeeds(out senseBuf, out plxtPwrRecSelected, out plxtPwrRecMax, out plxtPwrRecLast, dev.Timeout, out duration); - if (!plxtSense) + if(!plxtSense) { - if (plxtPwrRecSelected > 0) + if(plxtPwrRecSelected > 0) DicConsole.WriteLine("Selected PoweRec speed for currently inserted media is {0} Kb/sec ({1}x)", plxtPwrRecSelected, plxtPwrRecSelected / 177); - if (plxtPwrRecMax > 0) + if(plxtPwrRecMax > 0) DicConsole.WriteLine("Maximum PoweRec speed for currently inserted media is {0} Kb/sec ({1}x)", plxtPwrRecMax, plxtPwrRecMax / 177); - if (plxtPwrRecLast > 0) + if(plxtPwrRecLast > 0) DicConsole.WriteLine("Last used PoweRec was {0} Kb/sec ({1}x)", plxtPwrRecLast, plxtPwrRecLast / 177); } } @@ -908,101 +908,101 @@ namespace DiscImageChef.Commands // TODO: Check it with a drive plxtSense = dev.PlextorGetSilentMode(out plxtBuf, out senseBuf, dev.Timeout, out duration); - if (!plxtSense) + if(!plxtSense) { DicConsole.WriteLine("Drive supports Plextor SilentMode"); - if (plxtBuf[0] == 1) + if(plxtBuf[0] == 1) { DicConsole.WriteLine("Plextor SilentMode is enabled:"); - if (plxtBuf[1] == 2) + if(plxtBuf[1] == 2) DicConsole.WriteLine("\tAccess time is slow"); else DicConsole.WriteLine("\tAccess time is fast"); - if (plxtBuf[2] > 0) + if(plxtBuf[2] > 0) DicConsole.WriteLine("\tCD read speed limited to {0}x", plxtBuf[2]); - if (plxtBuf[3] > 0 && plxtDvd) + if(plxtBuf[3] > 0 && plxtDvd) DicConsole.WriteLine("\tDVD read speed limited to {0}x", plxtBuf[3]); - if (plxtBuf[4] > 0) + if(plxtBuf[4] > 0) DicConsole.WriteLine("\tCD write speed limited to {0}x", plxtBuf[4]); - if (plxtBuf[6] > 0) + if(plxtBuf[6] > 0) DicConsole.WriteLine("\tTray eject speed limited to {0}", -(plxtBuf[6] + 48)); - if (plxtBuf[7] > 0) + if(plxtBuf[7] > 0) DicConsole.WriteLine("\tTray eject speed limited to {0}", plxtBuf[7] - 47); } } plxtSense = dev.PlextorGetGigaRec(out plxtBuf, out senseBuf, dev.Timeout, out duration); - if (!plxtSense) + if(!plxtSense) { DicConsole.WriteLine("Drive supports Plextor GigaRec"); // TODO: Pretty print it } plxtSense = dev.PlextorGetSecuRec(out plxtBuf, out senseBuf, dev.Timeout, out duration); - if (!plxtSense) + if(!plxtSense) { DicConsole.WriteLine("Drive supports Plextor SecuRec"); // TODO: Pretty print it } plxtSense = dev.PlextorGetSpeedRead(out plxtBuf, out senseBuf, dev.Timeout, out duration); - if (!plxtSense) + if(!plxtSense) { DicConsole.Write("Drive supports Plextor SpeedRead"); - if ((plxtBuf[2] & 0x01) == 0x01) + if((plxtBuf[2] & 0x01) == 0x01) DicConsole.WriteLine("and has it enabled"); else DicConsole.WriteLine(); } plxtSense = dev.PlextorGetHiding(out plxtBuf, out senseBuf, dev.Timeout, out duration); - if (!plxtSense) + if(!plxtSense) { DicConsole.WriteLine("Drive supports hiding CD-Rs and forcing single session"); - if ((plxtBuf[2] & 0x02) == 0x02) + if((plxtBuf[2] & 0x02) == 0x02) DicConsole.WriteLine("Drive currently hides CD-Rs"); - if ((plxtBuf[2] & 0x01) == 0x01) + if((plxtBuf[2] & 0x01) == 0x01) DicConsole.WriteLine("Drive currently forces single session"); } plxtSense = dev.PlextorGetVariRec(out plxtBuf, out senseBuf, false, dev.Timeout, out duration); - if (!plxtSense) + if(!plxtSense) { DicConsole.WriteLine("Drive supports Plextor VariRec"); // TODO: Pretty print it } - if (plxtDvd) + if(plxtDvd) { plxtSense = dev.PlextorGetVariRec(out plxtBuf, out senseBuf, true, dev.Timeout, out duration); - if (!plxtSense) + if(!plxtSense) { DicConsole.WriteLine("Drive supports Plextor VariRec for DVDs"); // TODO: Pretty print it } plxtSense = dev.PlextorGetBitsetting(out plxtBuf, out senseBuf, false, dev.Timeout, out duration); - if (!plxtSense) + if(!plxtSense) DicConsole.WriteLine("Drive supports bitsetting DVD+R book type"); plxtSense = dev.PlextorGetBitsetting(out plxtBuf, out senseBuf, true, dev.Timeout, out duration); - if (!plxtSense) + if(!plxtSense) DicConsole.WriteLine("Drive supports bitsetting DVD+R DL book type"); plxtSense = dev.PlextorGetTestWriteDvdPlus(out plxtBuf, out senseBuf, dev.Timeout, out duration); - if (!plxtSense) + if(!plxtSense) DicConsole.WriteLine("Drive supports test writing DVD+"); } } #endregion Plextor } - if (devType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess) + if(devType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess) { byte[] seqBuf; sense = dev.ReadBlockLimits(out seqBuf, out senseBuf, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.ErrorWriteLine("READ BLOCK LIMITS:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { @@ -1012,13 +1012,13 @@ namespace DiscImageChef.Commands } sense = dev.ReportDensitySupport(out seqBuf, out senseBuf, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.ErrorWriteLine("REPORT DENSITY SUPPORT:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { doWriteFile(options.OutputPrefix, "_ssc_reportdensitysupport.bin", "SSC REPORT DENSITY SUPPORT", seqBuf); Decoders.SCSI.SSC.DensitySupport.DensitySupportHeader? dens = Decoders.SCSI.SSC.DensitySupport.DecodeDensity(seqBuf); - if (dens.HasValue) + if(dens.HasValue) { DicConsole.WriteLine("Densities supported by device:"); DicConsole.WriteLine(Decoders.SCSI.SSC.DensitySupport.PrettifyDensity(dens)); @@ -1026,13 +1026,13 @@ namespace DiscImageChef.Commands } sense = dev.ReportDensitySupport(out seqBuf, out senseBuf, true, false, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.ErrorWriteLine("REPORT DENSITY SUPPORT (MEDIUM):\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { doWriteFile(options.OutputPrefix, "_ssc_reportdensitysupport_medium.bin", "SSC REPORT DENSITY SUPPORT (MEDIUM)", seqBuf); Decoders.SCSI.SSC.DensitySupport.MediaTypeSupportHeader? meds = Decoders.SCSI.SSC.DensitySupport.DecodeMediumType(seqBuf); - if (meds.HasValue) + if(meds.HasValue) { DicConsole.WriteLine("Medium types supported by device:"); DicConsole.WriteLine(Decoders.SCSI.SSC.DensitySupport.PrettifyMediumType(meds)); @@ -1055,7 +1055,7 @@ namespace DiscImageChef.Commands { if(!string.IsNullOrEmpty(outputPrefix)) { - if (!File.Exists(outputPrefix + outputSuffix)) + if(!File.Exists(outputPrefix + outputSuffix)) { try { diff --git a/DiscImageChef/Commands/DeviceReport.cs b/DiscImageChef/Commands/DeviceReport.cs index 3e606ff00..610d8b897 100644 --- a/DiscImageChef/Commands/DeviceReport.cs +++ b/DiscImageChef/Commands/DeviceReport.cs @@ -52,13 +52,13 @@ namespace DiscImageChef.Commands DicConsole.DebugWriteLine("Device-Report command", "--verbose={0}", options.Verbose); DicConsole.DebugWriteLine("Device-Report command", "--device={0}", options.DevicePath); - if (!System.IO.File.Exists(options.DevicePath)) + if(!System.IO.File.Exists(options.DevicePath)) { DicConsole.ErrorWriteLine("Specified device does not exist."); return; } - if (options.DevicePath.Length == 2 && options.DevicePath[1] == ':' && + if(options.DevicePath.Length == 2 && options.DevicePath[1] == ':' && options.DevicePath[0] != '/' && Char.IsLetter(options.DevicePath[0])) { options.DevicePath = "\\\\.\\" + Char.ToUpper(options.DevicePath[0]) + ':'; @@ -66,7 +66,7 @@ namespace DiscImageChef.Commands Device dev = new Device(options.DevicePath); - if (dev.Error) + if(dev.Error) { DicConsole.ErrorWriteLine("Error {0} opening device.", dev.LastError); return; @@ -74,7 +74,7 @@ namespace DiscImageChef.Commands Core.Statistics.AddDevice(dev); - switch (dev.Type) + switch(dev.Type) { case DeviceType.ATA: doATADeviceReport(options, dev); @@ -105,29 +105,29 @@ namespace DiscImageChef.Commands uint timeout = 5; Metadata.DeviceReport report = new Metadata.DeviceReport(); string xmlFile; - if (!string.IsNullOrWhiteSpace(dev.Manufacturer) && !string.IsNullOrWhiteSpace(dev.Revision)) + if(!string.IsNullOrWhiteSpace(dev.Manufacturer) && !string.IsNullOrWhiteSpace(dev.Revision)) xmlFile = dev.Manufacturer + "_" + dev.Model + "_" + dev.Revision + ".xml"; - else if (!string.IsNullOrWhiteSpace(dev.Manufacturer)) + else if(!string.IsNullOrWhiteSpace(dev.Manufacturer)) xmlFile = dev.Manufacturer + "_" + dev.Model + ".xml"; - else if (!string.IsNullOrWhiteSpace(dev.Revision)) + else if(!string.IsNullOrWhiteSpace(dev.Revision)) xmlFile = dev.Model + "_" + dev.Revision + ".xml"; else xmlFile = dev.Model + ".xml"; - + ConsoleKeyInfo pressedKey; bool removable = false; - if (dev.IsUSB) + if(dev.IsUSB) { pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { DicConsole.Write("Is the device natively USB (in case of doubt, press Y)? (Y/N): "); pressedKey = System.Console.ReadKey(); DicConsole.WriteLine(); } - if (pressedKey.Key == ConsoleKey.Y) + if(pressedKey.Key == ConsoleKey.Y) { report.USB = new usbType(); report.USB.Manufacturer = dev.USBManufacturerString; @@ -136,7 +136,7 @@ namespace DiscImageChef.Commands report.USB.VendorID = dev.USBVendorID; pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { DicConsole.Write("Is the media removable from the reading/writing elements? (Y/N): "); pressedKey = System.Console.ReadKey(); @@ -148,17 +148,17 @@ namespace DiscImageChef.Commands } } - if (dev.IsFireWire) + if(dev.IsFireWire) { pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { DicConsole.Write("Is the device natively FireWire (in case of doubt, press Y)? (Y/N): "); pressedKey = System.Console.ReadKey(); DicConsole.WriteLine(); } - if (pressedKey.Key == ConsoleKey.Y) + if(pressedKey.Key == ConsoleKey.Y) { report.FireWire = new firewireType(); report.FireWire.Manufacturer = dev.FireWireVendorName; @@ -167,7 +167,7 @@ namespace DiscImageChef.Commands report.FireWire.VendorID = dev.FireWireVendor; pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { DicConsole.Write("Is the media removable from the reading/writing elements? (Y/N): "); pressedKey = System.Console.ReadKey(); @@ -183,20 +183,20 @@ namespace DiscImageChef.Commands dev.AtaIdentify(out buffer, out errorRegs, timeout, out duration); - if (Decoders.ATA.Identify.Decode(buffer).HasValue) + if(Decoders.ATA.Identify.Decode(buffer).HasValue) { Decoders.ATA.Identify.IdentifyDevice ataId = Decoders.ATA.Identify.Decode(buffer).Value; - if ((ushort)ataId.GeneralConfiguration == 0x848A) + if((ushort)ataId.GeneralConfiguration == 0x848A) { report.CompactFlash = true; report.CompactFlashSpecified = true; removable = false; } - else if (!removable && ataId.GeneralConfiguration.HasFlag(Decoders.ATA.Identify.GeneralConfigurationBit.Removable)) + else if(!removable && ataId.GeneralConfiguration.HasFlag(Decoders.ATA.Identify.GeneralConfigurationBit.Removable)) { pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { DicConsole.Write("Is the media removable from the reading/writing elements? (Y/N): "); pressedKey = System.Console.ReadKey(); @@ -207,7 +207,7 @@ namespace DiscImageChef.Commands } if(removable) - { + { DicConsole.WriteLine("Please remove any media from the device and press any key when it is out."); System.Console.ReadKey(true); DicConsole.WriteLine("Querying ATA IDENTIFY..."); @@ -217,413 +217,413 @@ namespace DiscImageChef.Commands report.ATA = new ataType(); - if (!string.IsNullOrWhiteSpace(ataId.AdditionalPID)) + if(!string.IsNullOrWhiteSpace(ataId.AdditionalPID)) { report.ATA.AdditionalPID = ataId.AdditionalPID; report.ATA.AdditionalPIDSpecified = true; } - if (ataId.APIOSupported != 0) + if(ataId.APIOSupported != 0) { report.ATA.APIOSupported = ataId.APIOSupported; report.ATA.APIOSupportedSpecified = true; } - if (ataId.BufferType != 0) + if(ataId.BufferType != 0) { report.ATA.BufferType = ataId.BufferType; report.ATA.BufferTypeSpecified = true; } - if (ataId.BufferSize != 0) + if(ataId.BufferSize != 0) { report.ATA.BufferSize = ataId.BufferSize; report.ATA.BufferSizeSpecified = true; } - if (ataId.Capabilities != 0) + if(ataId.Capabilities != 0) { report.ATA.Capabilities = ataId.Capabilities; report.ATA.CapabilitiesSpecified = true; } - if (ataId.Capabilities2 != 0) + if(ataId.Capabilities2 != 0) { report.ATA.Capabilities2 = ataId.Capabilities2; report.ATA.Capabilities2Specified = true; } - if (ataId.Capabilities3 != 0) + if(ataId.Capabilities3 != 0) { report.ATA.Capabilities3 = ataId.Capabilities3; report.ATA.Capabilities3Specified = true; } - if (ataId.CFAPowerMode != 0) + if(ataId.CFAPowerMode != 0) { report.ATA.CFAPowerMode = ataId.CFAPowerMode; report.ATA.CFAPowerModeSpecified = true; } - if (ataId.CommandSet != 0) + if(ataId.CommandSet != 0) { report.ATA.CommandSet = ataId.CommandSet; report.ATA.CommandSetSpecified = true; } - if (ataId.CommandSet2 != 0) + if(ataId.CommandSet2 != 0) { report.ATA.CommandSet2 = ataId.CommandSet2; report.ATA.CommandSet2Specified = true; } - if (ataId.CommandSet3 != 0) + if(ataId.CommandSet3 != 0) { report.ATA.CommandSet3 = ataId.CommandSet3; report.ATA.CommandSet3Specified = true; } - if (ataId.CommandSet4 != 0) + if(ataId.CommandSet4 != 0) { report.ATA.CommandSet4 = ataId.CommandSet4; report.ATA.CommandSet4Specified = true; } - if (ataId.CommandSet5 != 0) + if(ataId.CommandSet5 != 0) { report.ATA.CommandSet5 = ataId.CommandSet5; report.ATA.CommandSet5Specified = true; } - if (ataId.CurrentAAM != 0) + if(ataId.CurrentAAM != 0) { report.ATA.CurrentAAM = ataId.CurrentAAM; report.ATA.CurrentAAMSpecified = true; } - if (ataId.CurrentAPM != 0) + if(ataId.CurrentAPM != 0) { report.ATA.CurrentAPM = ataId.CurrentAPM; report.ATA.CurrentAPMSpecified = true; } - if (ataId.DataSetMgmt != 0) + if(ataId.DataSetMgmt != 0) { report.ATA.DataSetMgmt = ataId.DataSetMgmt; report.ATA.DataSetMgmtSpecified = true; } - if (ataId.DataSetMgmtSize != 0) + if(ataId.DataSetMgmtSize != 0) { report.ATA.DataSetMgmtSize = ataId.DataSetMgmtSize; report.ATA.DataSetMgmtSizeSpecified = true; } - if (ataId.DeviceFormFactor != 0) + if(ataId.DeviceFormFactor != 0) { report.ATA.DeviceFormFactor = ataId.DeviceFormFactor; report.ATA.DeviceFormFactorSpecified = true; } - if (ataId.DMAActive != 0) + if(ataId.DMAActive != 0) { report.ATA.DMAActive = ataId.DMAActive; report.ATA.DMAActiveSpecified = true; } - if (ataId.DMASupported != 0) + if(ataId.DMASupported != 0) { report.ATA.DMASupported = ataId.DMASupported; report.ATA.DMASupportedSpecified = true; } - if (ataId.DMATransferTimingMode != 0) + if(ataId.DMATransferTimingMode != 0) { report.ATA.DMATransferTimingMode = ataId.DMATransferTimingMode; report.ATA.DMATransferTimingModeSpecified = true; } - if (ataId.EnhancedSecurityEraseTime != 0) + if(ataId.EnhancedSecurityEraseTime != 0) { report.ATA.EnhancedSecurityEraseTime = ataId.EnhancedSecurityEraseTime; report.ATA.EnhancedSecurityEraseTimeSpecified = true; } - if (ataId.EnabledCommandSet != 0) + if(ataId.EnabledCommandSet != 0) { report.ATA.EnabledCommandSet = ataId.EnabledCommandSet; report.ATA.EnabledCommandSetSpecified = true; } - if (ataId.EnabledCommandSet2 != 0) + if(ataId.EnabledCommandSet2 != 0) { report.ATA.EnabledCommandSet2 = ataId.EnabledCommandSet2; report.ATA.EnabledCommandSet2Specified = true; } - if (ataId.EnabledCommandSet3 != 0) + if(ataId.EnabledCommandSet3 != 0) { report.ATA.EnabledCommandSet3 = ataId.EnabledCommandSet3; report.ATA.EnabledCommandSet3Specified = true; } - if (ataId.EnabledCommandSet4 != 0) + if(ataId.EnabledCommandSet4 != 0) { report.ATA.EnabledCommandSet4 = ataId.EnabledCommandSet4; report.ATA.EnabledCommandSet4Specified = true; } - if (ataId.EnabledSATAFeatures != 0) + if(ataId.EnabledSATAFeatures != 0) { report.ATA.EnabledSATAFeatures = ataId.EnabledSATAFeatures; report.ATA.EnabledSATAFeaturesSpecified = true; } - if (ataId.ExtendedUserSectors != 0) + if(ataId.ExtendedUserSectors != 0) { report.ATA.ExtendedUserSectors = ataId.ExtendedUserSectors; report.ATA.ExtendedUserSectorsSpecified = true; } - if (ataId.FreeFallSensitivity != 0) + if(ataId.FreeFallSensitivity != 0) { report.ATA.FreeFallSensitivity = ataId.FreeFallSensitivity; report.ATA.FreeFallSensitivitySpecified = true; } - if (!string.IsNullOrWhiteSpace(ataId.FirmwareRevision)) + if(!string.IsNullOrWhiteSpace(ataId.FirmwareRevision)) { report.ATA.FirmwareRevision = ataId.FirmwareRevision; report.ATA.FirmwareRevisionSpecified = true; } - if (ataId.GeneralConfiguration != 0) + if(ataId.GeneralConfiguration != 0) { report.ATA.GeneralConfiguration = ataId.GeneralConfiguration; report.ATA.GeneralConfigurationSpecified = true; } - if (ataId.HardwareResetResult != 0) + if(ataId.HardwareResetResult != 0) { report.ATA.HardwareResetResult = ataId.HardwareResetResult; report.ATA.HardwareResetResultSpecified = true; } - if (ataId.InterseekDelay != 0) + if(ataId.InterseekDelay != 0) { report.ATA.InterseekDelay = ataId.InterseekDelay; report.ATA.InterseekDelaySpecified = true; } - if (ataId.MajorVersion != 0) + if(ataId.MajorVersion != 0) { report.ATA.MajorVersion = ataId.MajorVersion; report.ATA.MajorVersionSpecified = true; } - if (ataId.MasterPasswordRevisionCode != 0) + if(ataId.MasterPasswordRevisionCode != 0) { report.ATA.MasterPasswordRevisionCode = ataId.MasterPasswordRevisionCode; report.ATA.MasterPasswordRevisionCodeSpecified = true; } - if (ataId.MaxDownloadMicroMode3 != 0) + if(ataId.MaxDownloadMicroMode3 != 0) { report.ATA.MaxDownloadMicroMode3 = ataId.MaxDownloadMicroMode3; report.ATA.MaxDownloadMicroMode3Specified = true; } - if (ataId.MaxQueueDepth != 0) + if(ataId.MaxQueueDepth != 0) { report.ATA.MaxQueueDepth = ataId.MaxQueueDepth; report.ATA.MaxQueueDepthSpecified = true; } - if (ataId.MDMAActive != 0) + if(ataId.MDMAActive != 0) { report.ATA.MDMAActive = ataId.MDMAActive; report.ATA.MDMAActiveSpecified = true; } - if (ataId.MDMASupported != 0) + if(ataId.MDMASupported != 0) { report.ATA.MDMASupported = ataId.MDMASupported; report.ATA.MDMASupportedSpecified = true; } - if (ataId.MinDownloadMicroMode3 != 0) + if(ataId.MinDownloadMicroMode3 != 0) { report.ATA.MinDownloadMicroMode3 = ataId.MinDownloadMicroMode3; report.ATA.MinDownloadMicroMode3Specified = true; } - if (ataId.MinMDMACycleTime != 0) + if(ataId.MinMDMACycleTime != 0) { report.ATA.MinMDMACycleTime = ataId.MinMDMACycleTime; report.ATA.MinMDMACycleTimeSpecified = true; } - if (ataId.MinorVersion != 0) + if(ataId.MinorVersion != 0) { report.ATA.MinorVersion = ataId.MinorVersion; report.ATA.MinorVersionSpecified = true; } - if (ataId.MinPIOCycleTimeNoFlow != 0) + if(ataId.MinPIOCycleTimeNoFlow != 0) { report.ATA.MinPIOCycleTimeNoFlow = ataId.MinPIOCycleTimeNoFlow; report.ATA.MinPIOCycleTimeNoFlowSpecified = true; } - if (ataId.MinPIOCycleTimeFlow != 0) + if(ataId.MinPIOCycleTimeFlow != 0) { report.ATA.MinPIOCycleTimeFlow = ataId.MinPIOCycleTimeFlow; report.ATA.MinPIOCycleTimeFlowSpecified = true; } - if (!string.IsNullOrWhiteSpace(ataId.Model)) + if(!string.IsNullOrWhiteSpace(ataId.Model)) { report.ATA.Model = ataId.Model; report.ATA.ModelSpecified = true; } - if (ataId.MultipleMaxSectors != 0) + if(ataId.MultipleMaxSectors != 0) { report.ATA.MultipleMaxSectors = ataId.MultipleMaxSectors; report.ATA.MultipleMaxSectorsSpecified = true; } - if (ataId.MultipleSectorNumber != 0) + if(ataId.MultipleSectorNumber != 0) { report.ATA.MultipleSectorNumber = ataId.MultipleSectorNumber; report.ATA.MultipleSectorNumberSpecified = true; } - if (ataId.NVCacheCaps != 0) + if(ataId.NVCacheCaps != 0) { report.ATA.NVCacheCaps = ataId.NVCacheCaps; report.ATA.NVCacheCapsSpecified = true; } - if (ataId.NVCacheSize != 0) + if(ataId.NVCacheSize != 0) { report.ATA.NVCacheSize = ataId.NVCacheSize; report.ATA.NVCacheSizeSpecified = true; } - if (ataId.NVCacheWriteSpeed != 0) + if(ataId.NVCacheWriteSpeed != 0) { report.ATA.NVCacheWriteSpeed = ataId.NVCacheWriteSpeed; report.ATA.NVCacheWriteSpeedSpecified = true; } - if (ataId.NVEstimatedSpinUp != 0) + if(ataId.NVEstimatedSpinUp != 0) { report.ATA.NVEstimatedSpinUp = ataId.NVEstimatedSpinUp; report.ATA.NVEstimatedSpinUpSpecified = true; } - if (ataId.PacketBusRelease != 0) + if(ataId.PacketBusRelease != 0) { report.ATA.PacketBusRelease = ataId.PacketBusRelease; report.ATA.PacketBusReleaseSpecified = true; } - if (ataId.PIOTransferTimingMode != 0) + if(ataId.PIOTransferTimingMode != 0) { report.ATA.PIOTransferTimingMode = ataId.PIOTransferTimingMode; report.ATA.PIOTransferTimingModeSpecified = true; } - if (ataId.RecommendedAAM != 0) + if(ataId.RecommendedAAM != 0) { report.ATA.RecommendedAAM = ataId.RecommendedAAM; report.ATA.RecommendedAAMSpecified = true; } - if (ataId.RecMDMACycleTime != 0) + if(ataId.RecMDMACycleTime != 0) { report.ATA.RecommendedMDMACycleTime = ataId.RecMDMACycleTime; report.ATA.RecommendedMDMACycleTimeSpecified = true; } - if (ataId.RemovableStatusSet != 0) + if(ataId.RemovableStatusSet != 0) { report.ATA.RemovableStatusSet = ataId.RemovableStatusSet; report.ATA.RemovableStatusSetSpecified = true; } - if (ataId.SATACapabilities != 0) + if(ataId.SATACapabilities != 0) { report.ATA.SATACapabilities = ataId.SATACapabilities; report.ATA.SATACapabilitiesSpecified = true; } - if (ataId.SATACapabilities2 != 0) + if(ataId.SATACapabilities2 != 0) { report.ATA.SATACapabilities2 = ataId.SATACapabilities2; report.ATA.SATACapabilities2Specified = true; } - if (ataId.SATAFeatures != 0) + if(ataId.SATAFeatures != 0) { report.ATA.SATAFeatures = ataId.SATAFeatures; report.ATA.SATAFeaturesSpecified = true; } - if (ataId.SCTCommandTransport != 0) + if(ataId.SCTCommandTransport != 0) { report.ATA.SCTCommandTransport = ataId.SCTCommandTransport; report.ATA.SCTCommandTransportSpecified = true; } - if (ataId.SectorsPerCard != 0) + if(ataId.SectorsPerCard != 0) { report.ATA.SectorsPerCard = ataId.SectorsPerCard; report.ATA.SectorsPerCardSpecified = true; } - if (ataId.SecurityEraseTime != 0) + if(ataId.SecurityEraseTime != 0) { report.ATA.SecurityEraseTime = ataId.SecurityEraseTime; report.ATA.SecurityEraseTimeSpecified = true; } - if (ataId.SecurityStatus != 0) + if(ataId.SecurityStatus != 0) { report.ATA.SecurityStatus = ataId.SecurityStatus; report.ATA.SecurityStatusSpecified = true; } - if (ataId.ServiceBusyClear != 0) + if(ataId.ServiceBusyClear != 0) { report.ATA.ServiceBusyClear = ataId.ServiceBusyClear; report.ATA.ServiceBusyClearSpecified = true; } - if (ataId.SpecificConfiguration != 0) + if(ataId.SpecificConfiguration != 0) { report.ATA.SpecificConfiguration = ataId.SpecificConfiguration; report.ATA.SpecificConfigurationSpecified = true; } - if (ataId.StreamAccessLatency != 0) + if(ataId.StreamAccessLatency != 0) { report.ATA.StreamAccessLatency = ataId.StreamAccessLatency; report.ATA.StreamAccessLatencySpecified = true; } - if (ataId.StreamMinReqSize != 0) + if(ataId.StreamMinReqSize != 0) { report.ATA.StreamMinReqSize = ataId.StreamMinReqSize; report.ATA.StreamMinReqSizeSpecified = true; } - if (ataId.StreamPerformanceGranularity != 0) + if(ataId.StreamPerformanceGranularity != 0) { report.ATA.StreamPerformanceGranularity = ataId.StreamPerformanceGranularity; report.ATA.StreamPerformanceGranularitySpecified = true; } - if (ataId.StreamTransferTimeDMA != 0) + if(ataId.StreamTransferTimeDMA != 0) { report.ATA.StreamTransferTimeDMA = ataId.StreamTransferTimeDMA; report.ATA.StreamTransferTimeDMASpecified = true; } - if (ataId.StreamTransferTimePIO != 0) + if(ataId.StreamTransferTimePIO != 0) { report.ATA.StreamTransferTimePIO = ataId.StreamTransferTimePIO; report.ATA.StreamTransferTimePIOSpecified = true; } - if (ataId.TransportMajorVersion != 0) + if(ataId.TransportMajorVersion != 0) { report.ATA.TransportMajorVersion = ataId.TransportMajorVersion; report.ATA.TransportMajorVersionSpecified = true; } - if (ataId.TransportMinorVersion != 0) + if(ataId.TransportMinorVersion != 0) { report.ATA.TransportMinorVersion = ataId.TransportMinorVersion; report.ATA.TransportMinorVersionSpecified = true; } - if (ataId.TrustedComputing != 0) + if(ataId.TrustedComputing != 0) { report.ATA.TrustedComputing = ataId.TrustedComputing; report.ATA.TrustedComputingSpecified = true; } - if (ataId.UDMAActive != 0) + if(ataId.UDMAActive != 0) { report.ATA.UDMAActive = ataId.UDMAActive; report.ATA.UDMAActiveSpecified = true; } - if (ataId.UDMASupported != 0) + if(ataId.UDMASupported != 0) { report.ATA.UDMASupported = ataId.UDMASupported; report.ATA.UDMASupportedSpecified = true; } - if (ataId.WRVMode != 0) + if(ataId.WRVMode != 0) { report.ATA.WRVMode = ataId.WRVMode; report.ATA.WRVModeSpecified = true; } - if (ataId.WRVSectorCountMode3 != 0) + if(ataId.WRVSectorCountMode3 != 0) { report.ATA.WRVSectorCountMode3 = ataId.WRVSectorCountMode3; report.ATA.WRVSectorCountMode3Specified = true; } - if (ataId.WRVSectorCountMode2 != 0) + if(ataId.WRVSectorCountMode2 != 0) { report.ATA.WRVSectorCountMode2 = ataId.WRVSectorCountMode2; report.ATA.WRVSectorCountMode2Specified = true; } - if (removable) + if(removable) { List mediaTests = new List(); pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.N) { pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { DicConsole.Write("Do you have media that you can insert in the drive? (Y/N): "); pressedKey = System.Console.ReadKey(); DicConsole.WriteLine(); } - if (pressedKey.Key == ConsoleKey.Y) + if(pressedKey.Key == ConsoleKey.Y) { DicConsole.WriteLine("Please insert it in the drive and press any key when it is ready."); System.Console.ReadKey(true); @@ -641,22 +641,22 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Querying ATA IDENTIFY..."); dev.AtaIdentify(out buffer, out errorRegs, timeout, out duration); - if (Decoders.ATA.Identify.Decode(buffer).HasValue) + if(Decoders.ATA.Identify.Decode(buffer).HasValue) { ataId = Decoders.ATA.Identify.Decode(buffer).Value; - if (ataId.UnformattedBPT != 0) + if(ataId.UnformattedBPT != 0) { mediaTest.UnformattedBPT = ataId.UnformattedBPT; mediaTest.UnformattedBPTSpecified = true; } - if (ataId.UnformattedBPS != 0) + if(ataId.UnformattedBPS != 0) { mediaTest.UnformattedBPS = ataId.UnformattedBPS; mediaTest.UnformattedBPSSpecified = true; } - if (ataId.Cylinders > 0 && ataId.Heads > 0 && ataId.SectorsPerTrack > 0) + if(ataId.Cylinders > 0 && ataId.Heads > 0 && ataId.SectorsPerTrack > 0) { mediaTest.CHS = new chsType(); mediaTest.CHS.Cylinders = ataId.Cylinders; @@ -666,7 +666,7 @@ namespace DiscImageChef.Commands mediaTest.BlocksSpecified = true; } - if (ataId.CurrentCylinders > 0 && ataId.CurrentHeads > 0 && ataId.CurrentSectorsPerTrack > 0) + if(ataId.CurrentCylinders > 0 && ataId.CurrentHeads > 0 && ataId.CurrentSectorsPerTrack > 0) { mediaTest.CurrentCHS = new chsType(); mediaTest.CurrentCHS.Cylinders = ataId.CurrentCylinders; @@ -676,7 +676,7 @@ namespace DiscImageChef.Commands mediaTest.BlocksSpecified = true; } - if (ataId.Capabilities.HasFlag(Decoders.ATA.Identify.CapabilitiesBit.LBASupport)) + if(ataId.Capabilities.HasFlag(Decoders.ATA.Identify.CapabilitiesBit.LBASupport)) { mediaTest.LBASectors = ataId.LBASectors; mediaTest.LBASectorsSpecified = true; @@ -684,7 +684,7 @@ namespace DiscImageChef.Commands mediaTest.BlocksSpecified = true; } - if (ataId.CommandSet2.HasFlag(Decoders.ATA.Identify.CommandSetBit2.LBA48)) + if(ataId.CommandSet2.HasFlag(Decoders.ATA.Identify.CommandSetBit2.LBA48)) { mediaTest.LBA48Sectors = ataId.LBA48Sectors; mediaTest.LBA48SectorsSpecified = true; @@ -692,10 +692,10 @@ namespace DiscImageChef.Commands mediaTest.BlocksSpecified = true; } - if (ataId.NominalRotationRate != 0x0000 && + if(ataId.NominalRotationRate != 0x0000 && ataId.NominalRotationRate != 0xFFFF) { - if (ataId.NominalRotationRate == 0x0001) + if(ataId.NominalRotationRate == 0x0001) { mediaTest.SolidStateDevice = true; mediaTest.SolidStateDeviceSpecified = true; @@ -711,12 +711,12 @@ namespace DiscImageChef.Commands uint logicalsectorsize = 0; uint physicalsectorsize; - if ((ataId.PhysLogSectorSize & 0x8000) == 0x0000 && + if((ataId.PhysLogSectorSize & 0x8000) == 0x0000 && (ataId.PhysLogSectorSize & 0x4000) == 0x4000) { - if ((ataId.PhysLogSectorSize & 0x1000) == 0x1000) + if((ataId.PhysLogSectorSize & 0x1000) == 0x1000) { - if (ataId.LogicalSectorWords <= 255 || ataId.LogicalAlignment == 0xFFFF) + if(ataId.LogicalSectorWords <= 255 || ataId.LogicalAlignment == 0xFFFF) logicalsectorsize = 512; else logicalsectorsize = ataId.LogicalSectorWords * 2; @@ -724,7 +724,7 @@ namespace DiscImageChef.Commands else logicalsectorsize = 512; - if ((ataId.PhysLogSectorSize & 0x2000) == 0x2000) + if((ataId.PhysLogSectorSize & 0x2000) == 0x2000) { physicalsectorsize = logicalsectorsize * (uint)Math.Pow(2, (double)(ataId.PhysLogSectorSize & 0xF)); } @@ -739,12 +739,12 @@ namespace DiscImageChef.Commands mediaTest.BlockSize = logicalsectorsize; mediaTest.BlockSizeSpecified = true; - if (physicalsectorsize != logicalsectorsize) + if(physicalsectorsize != logicalsectorsize) { mediaTest.PhysicalBlockSize = physicalsectorsize; mediaTest.PhysicalBlockSizeSpecified = true; - if ((ataId.LogicalAlignment & 0x8000) == 0x0000 && + if((ataId.LogicalAlignment & 0x8000) == 0x0000 && (ataId.LogicalAlignment & 0x4000) == 0x4000) { mediaTest.LogicalAlignment = (ushort)(ataId.LogicalAlignment & 0x3FFF); @@ -752,19 +752,19 @@ namespace DiscImageChef.Commands } } - if (ataId.EccBytes != 0x0000 && ataId.EccBytes != 0xFFFF) + if(ataId.EccBytes != 0x0000 && ataId.EccBytes != 0xFFFF) { mediaTest.LongBlockSize = logicalsectorsize + ataId.EccBytes; mediaTest.LongBlockSizeSpecified = true; } - if (ataId.CommandSet3.HasFlag(Decoders.ATA.Identify.CommandSetBit3.MustBeSet) && + if(ataId.CommandSet3.HasFlag(Decoders.ATA.Identify.CommandSetBit3.MustBeSet) && !ataId.CommandSet3.HasFlag(Decoders.ATA.Identify.CommandSetBit3.MustBeClear) && ataId.EnabledCommandSet3.HasFlag(Decoders.ATA.Identify.CommandSetBit3.MediaSerial)) { mediaTest.CanReadMediaSerial = true; mediaTest.CanReadMediaSerialSpecified = true; - if (!string.IsNullOrWhiteSpace(ataId.MediaManufacturer)) + if(!string.IsNullOrWhiteSpace(ataId.MediaManufacturer)) { mediaTest.Manufacturer = ataId.MediaManufacturer; mediaTest.ManufacturerSpecified = true; @@ -851,28 +851,28 @@ namespace DiscImageChef.Commands } else mediaTest.MediaIsRecognized = false; - + mediaTests.Add(mediaTest); } - } + } report.ATA.RemovableMedias = mediaTests.ToArray(); } else { report.ATA.ReadCapabilities = new testedMediaType(); - if (ataId.UnformattedBPT != 0) + if(ataId.UnformattedBPT != 0) { report.ATA.ReadCapabilities.UnformattedBPT = ataId.UnformattedBPT; report.ATA.ReadCapabilities.UnformattedBPTSpecified = true; } - if (ataId.UnformattedBPS != 0) + if(ataId.UnformattedBPS != 0) { report.ATA.ReadCapabilities.UnformattedBPS = ataId.UnformattedBPS; report.ATA.ReadCapabilities.UnformattedBPSSpecified = true; } - if (ataId.Cylinders > 0 && ataId.Heads > 0 && ataId.SectorsPerTrack > 0) + if(ataId.Cylinders > 0 && ataId.Heads > 0 && ataId.SectorsPerTrack > 0) { report.ATA.ReadCapabilities.CHS = new chsType(); report.ATA.ReadCapabilities.CHS.Cylinders = ataId.Cylinders; @@ -882,7 +882,7 @@ namespace DiscImageChef.Commands report.ATA.ReadCapabilities.BlocksSpecified = true; } - if (ataId.CurrentCylinders > 0 && ataId.CurrentHeads > 0 && ataId.CurrentSectorsPerTrack > 0) + if(ataId.CurrentCylinders > 0 && ataId.CurrentHeads > 0 && ataId.CurrentSectorsPerTrack > 0) { report.ATA.ReadCapabilities.CurrentCHS = new chsType(); report.ATA.ReadCapabilities.CurrentCHS.Cylinders = ataId.CurrentCylinders; @@ -892,7 +892,7 @@ namespace DiscImageChef.Commands report.ATA.ReadCapabilities.BlocksSpecified = true; } - if (ataId.Capabilities.HasFlag(Decoders.ATA.Identify.CapabilitiesBit.LBASupport)) + if(ataId.Capabilities.HasFlag(Decoders.ATA.Identify.CapabilitiesBit.LBASupport)) { report.ATA.ReadCapabilities.LBASectors = ataId.LBASectors; report.ATA.ReadCapabilities.LBASectorsSpecified = true; @@ -900,7 +900,7 @@ namespace DiscImageChef.Commands report.ATA.ReadCapabilities.BlocksSpecified = true; } - if (ataId.CommandSet2.HasFlag(Decoders.ATA.Identify.CommandSetBit2.LBA48)) + if(ataId.CommandSet2.HasFlag(Decoders.ATA.Identify.CommandSetBit2.LBA48)) { report.ATA.ReadCapabilities.LBA48Sectors = ataId.LBA48Sectors; report.ATA.ReadCapabilities.LBA48SectorsSpecified = true; @@ -908,10 +908,10 @@ namespace DiscImageChef.Commands report.ATA.ReadCapabilities.BlocksSpecified = true; } - if (ataId.NominalRotationRate != 0x0000 && + if(ataId.NominalRotationRate != 0x0000 && ataId.NominalRotationRate != 0xFFFF) { - if (ataId.NominalRotationRate == 0x0001) + if(ataId.NominalRotationRate == 0x0001) { report.ATA.ReadCapabilities.SolidStateDevice = true; report.ATA.ReadCapabilities.SolidStateDeviceSpecified = true; @@ -927,12 +927,12 @@ namespace DiscImageChef.Commands uint logicalsectorsize = 0; uint physicalsectorsize; - if ((ataId.PhysLogSectorSize & 0x8000) == 0x0000 && + if((ataId.PhysLogSectorSize & 0x8000) == 0x0000 && (ataId.PhysLogSectorSize & 0x4000) == 0x4000) { - if ((ataId.PhysLogSectorSize & 0x1000) == 0x1000) + if((ataId.PhysLogSectorSize & 0x1000) == 0x1000) { - if (ataId.LogicalSectorWords <= 255 || ataId.LogicalAlignment == 0xFFFF) + if(ataId.LogicalSectorWords <= 255 || ataId.LogicalAlignment == 0xFFFF) logicalsectorsize = 512; else logicalsectorsize = ataId.LogicalSectorWords * 2; @@ -940,7 +940,7 @@ namespace DiscImageChef.Commands else logicalsectorsize = 512; - if ((ataId.PhysLogSectorSize & 0x2000) == 0x2000) + if((ataId.PhysLogSectorSize & 0x2000) == 0x2000) { physicalsectorsize = logicalsectorsize * (uint)Math.Pow(2, (double)(ataId.PhysLogSectorSize & 0xF)); } @@ -955,12 +955,12 @@ namespace DiscImageChef.Commands report.ATA.ReadCapabilities.BlockSize = logicalsectorsize; report.ATA.ReadCapabilities.BlockSizeSpecified = true; - if (physicalsectorsize != logicalsectorsize) + if(physicalsectorsize != logicalsectorsize) { report.ATA.ReadCapabilities.PhysicalBlockSize = physicalsectorsize; report.ATA.ReadCapabilities.PhysicalBlockSizeSpecified = true; - if ((ataId.LogicalAlignment & 0x8000) == 0x0000 && + if((ataId.LogicalAlignment & 0x8000) == 0x0000 && (ataId.LogicalAlignment & 0x4000) == 0x4000) { report.ATA.ReadCapabilities.LogicalAlignment = (ushort)(ataId.LogicalAlignment & 0x3FFF); @@ -968,19 +968,19 @@ namespace DiscImageChef.Commands } } - if (ataId.EccBytes != 0x0000 && ataId.EccBytes != 0xFFFF) + if(ataId.EccBytes != 0x0000 && ataId.EccBytes != 0xFFFF) { report.ATA.ReadCapabilities.LongBlockSize = logicalsectorsize + ataId.EccBytes; report.ATA.ReadCapabilities.LongBlockSizeSpecified = true; } - if (ataId.CommandSet3.HasFlag(Decoders.ATA.Identify.CommandSetBit3.MustBeSet) && + if(ataId.CommandSet3.HasFlag(Decoders.ATA.Identify.CommandSetBit3.MustBeSet) && !ataId.CommandSet3.HasFlag(Decoders.ATA.Identify.CommandSetBit3.MustBeClear) && ataId.EnabledCommandSet3.HasFlag(Decoders.ATA.Identify.CommandSetBit3.MediaSerial)) { report.ATA.ReadCapabilities.CanReadMediaSerial = true; report.ATA.ReadCapabilities.CanReadMediaSerialSpecified = true; - if (!string.IsNullOrWhiteSpace(ataId.MediaManufacturer)) + if(!string.IsNullOrWhiteSpace(ataId.MediaManufacturer)) { report.ATA.ReadCapabilities.Manufacturer = ataId.MediaManufacturer; report.ATA.ReadCapabilities.ManufacturerSpecified = true; @@ -1093,28 +1093,28 @@ namespace DiscImageChef.Commands uint timeout = 5; Metadata.DeviceReport report = new Metadata.DeviceReport(); string xmlFile; - if (!string.IsNullOrWhiteSpace(dev.Manufacturer) && !string.IsNullOrWhiteSpace(dev.Revision)) + if(!string.IsNullOrWhiteSpace(dev.Manufacturer) && !string.IsNullOrWhiteSpace(dev.Revision)) xmlFile = dev.Manufacturer + "_" + dev.Model + "_" + dev.Revision + ".xml"; - else if (!string.IsNullOrWhiteSpace(dev.Manufacturer)) + else if(!string.IsNullOrWhiteSpace(dev.Manufacturer)) xmlFile = dev.Manufacturer + "_" + dev.Model + ".xml"; - else if (!string.IsNullOrWhiteSpace(dev.Revision)) + else if(!string.IsNullOrWhiteSpace(dev.Revision)) xmlFile = dev.Model + "_" + dev.Revision + ".xml"; else xmlFile = dev.Model + ".xml"; ConsoleKeyInfo pressedKey; bool removable = false; - if (dev.IsUSB) + if(dev.IsUSB) { pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { DicConsole.Write("Is the device natively USB (in case of doubt, press Y)? (Y/N): "); pressedKey = System.Console.ReadKey(); DicConsole.WriteLine(); } - if (pressedKey.Key == ConsoleKey.Y) + if(pressedKey.Key == ConsoleKey.Y) { report.USB = new usbType(); report.USB.Manufacturer = dev.USBManufacturerString; @@ -1123,7 +1123,7 @@ namespace DiscImageChef.Commands report.USB.VendorID = dev.USBVendorID; pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { DicConsole.Write("Is the media removable from the reading/writing elements? (Y/N): "); pressedKey = System.Console.ReadKey(); @@ -1135,17 +1135,17 @@ namespace DiscImageChef.Commands } } - if (dev.IsFireWire) + if(dev.IsFireWire) { pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { DicConsole.Write("Is the device natively FireWire (in case of doubt, press Y)? (Y/N): "); pressedKey = System.Console.ReadKey(); DicConsole.WriteLine(); } - if (pressedKey.Key == ConsoleKey.Y) + if(pressedKey.Key == ConsoleKey.Y) { report.FireWire = new firewireType(); report.FireWire.Manufacturer = dev.FireWireVendorName; @@ -1154,7 +1154,7 @@ namespace DiscImageChef.Commands report.FireWire.VendorID = dev.FireWireVendor; pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { DicConsole.Write("Is the media removable from the reading/writing elements? (Y/N): "); pressedKey = System.Console.ReadKey(); @@ -1166,10 +1166,10 @@ namespace DiscImageChef.Commands } } - if (!dev.IsUSB && !dev.IsFireWire && dev.IsRemovable) + if(!dev.IsUSB && !dev.IsFireWire && dev.IsRemovable) { pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { DicConsole.Write("Is the media removable from the reading/writing elements (flash memories ARE NOT removable)? (Y/N): "); pressedKey = System.Console.ReadKey(); @@ -1179,410 +1179,410 @@ namespace DiscImageChef.Commands removable = pressedKey.Key == ConsoleKey.Y; } - if (dev.Type == DeviceType.ATAPI) + if(dev.Type == DeviceType.ATAPI) { DicConsole.WriteLine("Querying ATAPI IDENTIFY..."); DiscImageChef.Decoders.ATA.AtaErrorRegistersCHS errorRegs; dev.AtapiIdentify(out buffer, out errorRegs, timeout, out duration); - if (Decoders.ATA.Identify.Decode(buffer).HasValue) + if(Decoders.ATA.Identify.Decode(buffer).HasValue) { Decoders.ATA.Identify.IdentifyDevice atapiId = Decoders.ATA.Identify.Decode(buffer).Value; report.ATAPI = new ataType(); - if (!string.IsNullOrWhiteSpace(atapiId.AdditionalPID)) + if(!string.IsNullOrWhiteSpace(atapiId.AdditionalPID)) { report.ATAPI.AdditionalPID = atapiId.AdditionalPID; report.ATAPI.AdditionalPIDSpecified = true; } - if (atapiId.APIOSupported != 0) + if(atapiId.APIOSupported != 0) { report.ATAPI.APIOSupported = atapiId.APIOSupported; report.ATAPI.APIOSupportedSpecified = true; } - if (atapiId.ATAPIByteCount != 0) + if(atapiId.ATAPIByteCount != 0) { report.ATAPI.ATAPIByteCount = atapiId.ATAPIByteCount; report.ATAPI.ATAPIByteCountSpecified = true; } - if (atapiId.BufferType != 0) + if(atapiId.BufferType != 0) { report.ATAPI.BufferType = atapiId.BufferType; report.ATAPI.BufferTypeSpecified = true; } - if (atapiId.BufferSize != 0) + if(atapiId.BufferSize != 0) { report.ATAPI.BufferSize = atapiId.BufferSize; report.ATAPI.BufferSizeSpecified = true; } - if (atapiId.Capabilities != 0) + if(atapiId.Capabilities != 0) { report.ATAPI.Capabilities = atapiId.Capabilities; report.ATAPI.CapabilitiesSpecified = true; } - if (atapiId.Capabilities2 != 0) + if(atapiId.Capabilities2 != 0) { report.ATAPI.Capabilities2 = atapiId.Capabilities2; report.ATAPI.Capabilities2Specified = true; } - if (atapiId.Capabilities3 != 0) + if(atapiId.Capabilities3 != 0) { report.ATAPI.Capabilities3 = atapiId.Capabilities3; report.ATAPI.Capabilities3Specified = true; } - if (atapiId.CFAPowerMode != 0) + if(atapiId.CFAPowerMode != 0) { report.ATAPI.CFAPowerMode = atapiId.CFAPowerMode; report.ATAPI.CFAPowerModeSpecified = true; } - if (atapiId.CommandSet != 0) + if(atapiId.CommandSet != 0) { report.ATAPI.CommandSet = atapiId.CommandSet; report.ATAPI.CommandSetSpecified = true; } - if (atapiId.CommandSet2 != 0) + if(atapiId.CommandSet2 != 0) { report.ATAPI.CommandSet2 = atapiId.CommandSet2; report.ATAPI.CommandSet2Specified = true; } - if (atapiId.CommandSet3 != 0) + if(atapiId.CommandSet3 != 0) { report.ATAPI.CommandSet3 = atapiId.CommandSet3; report.ATAPI.CommandSet3Specified = true; } - if (atapiId.CommandSet4 != 0) + if(atapiId.CommandSet4 != 0) { report.ATAPI.CommandSet4 = atapiId.CommandSet4; report.ATAPI.CommandSet4Specified = true; } - if (atapiId.CommandSet5 != 0) + if(atapiId.CommandSet5 != 0) { report.ATAPI.CommandSet5 = atapiId.CommandSet5; report.ATAPI.CommandSet5Specified = true; } - if (atapiId.CurrentAAM != 0) + if(atapiId.CurrentAAM != 0) { report.ATAPI.CurrentAAM = atapiId.CurrentAAM; report.ATAPI.CurrentAAMSpecified = true; } - if (atapiId.CurrentAPM != 0) + if(atapiId.CurrentAPM != 0) { report.ATAPI.CurrentAPM = atapiId.CurrentAPM; report.ATAPI.CurrentAPMSpecified = true; } - if (atapiId.DataSetMgmt != 0) + if(atapiId.DataSetMgmt != 0) { report.ATAPI.DataSetMgmt = atapiId.DataSetMgmt; report.ATAPI.DataSetMgmtSpecified = true; } - if (atapiId.DataSetMgmtSize != 0) + if(atapiId.DataSetMgmtSize != 0) { report.ATAPI.DataSetMgmtSize = atapiId.DataSetMgmtSize; report.ATAPI.DataSetMgmtSizeSpecified = true; } - if (atapiId.DeviceFormFactor != 0) + if(atapiId.DeviceFormFactor != 0) { report.ATAPI.DeviceFormFactor = atapiId.DeviceFormFactor; report.ATAPI.DeviceFormFactorSpecified = true; } - if (atapiId.DMAActive != 0) + if(atapiId.DMAActive != 0) { report.ATAPI.DMAActive = atapiId.DMAActive; report.ATAPI.DMAActiveSpecified = true; } - if (atapiId.DMASupported != 0) + if(atapiId.DMASupported != 0) { report.ATAPI.DMASupported = atapiId.DMASupported; report.ATAPI.DMASupportedSpecified = true; } - if (atapiId.DMATransferTimingMode != 0) + if(atapiId.DMATransferTimingMode != 0) { report.ATAPI.DMATransferTimingMode = atapiId.DMATransferTimingMode; report.ATAPI.DMATransferTimingModeSpecified = true; } - if (atapiId.EnhancedSecurityEraseTime != 0) + if(atapiId.EnhancedSecurityEraseTime != 0) { report.ATAPI.EnhancedSecurityEraseTime = atapiId.EnhancedSecurityEraseTime; report.ATAPI.EnhancedSecurityEraseTimeSpecified = true; } - if (atapiId.EnabledCommandSet != 0) + if(atapiId.EnabledCommandSet != 0) { report.ATAPI.EnabledCommandSet = atapiId.EnabledCommandSet; report.ATAPI.EnabledCommandSetSpecified = true; } - if (atapiId.EnabledCommandSet2 != 0) + if(atapiId.EnabledCommandSet2 != 0) { report.ATAPI.EnabledCommandSet2 = atapiId.EnabledCommandSet2; report.ATAPI.EnabledCommandSet2Specified = true; } - if (atapiId.EnabledCommandSet3 != 0) + if(atapiId.EnabledCommandSet3 != 0) { report.ATAPI.EnabledCommandSet3 = atapiId.EnabledCommandSet3; report.ATAPI.EnabledCommandSet3Specified = true; } - if (atapiId.EnabledCommandSet4 != 0) + if(atapiId.EnabledCommandSet4 != 0) { report.ATAPI.EnabledCommandSet4 = atapiId.EnabledCommandSet4; report.ATAPI.EnabledCommandSet4Specified = true; } - if (atapiId.EnabledSATAFeatures != 0) + if(atapiId.EnabledSATAFeatures != 0) { report.ATAPI.EnabledSATAFeatures = atapiId.EnabledSATAFeatures; report.ATAPI.EnabledSATAFeaturesSpecified = true; } - if (atapiId.ExtendedUserSectors != 0) + if(atapiId.ExtendedUserSectors != 0) { report.ATAPI.ExtendedUserSectors = atapiId.ExtendedUserSectors; report.ATAPI.ExtendedUserSectorsSpecified = true; } - if (atapiId.FreeFallSensitivity != 0) + if(atapiId.FreeFallSensitivity != 0) { report.ATAPI.FreeFallSensitivity = atapiId.FreeFallSensitivity; report.ATAPI.FreeFallSensitivitySpecified = true; } - if (!string.IsNullOrWhiteSpace(atapiId.FirmwareRevision)) + if(!string.IsNullOrWhiteSpace(atapiId.FirmwareRevision)) { report.ATAPI.FirmwareRevision = atapiId.FirmwareRevision; report.ATAPI.FirmwareRevisionSpecified = true; } - if (atapiId.GeneralConfiguration != 0) + if(atapiId.GeneralConfiguration != 0) { report.ATAPI.GeneralConfiguration = atapiId.GeneralConfiguration; report.ATAPI.GeneralConfigurationSpecified = true; } - if (atapiId.HardwareResetResult != 0) + if(atapiId.HardwareResetResult != 0) { report.ATAPI.HardwareResetResult = atapiId.HardwareResetResult; report.ATAPI.HardwareResetResultSpecified = true; } - if (atapiId.InterseekDelay != 0) + if(atapiId.InterseekDelay != 0) { report.ATAPI.InterseekDelay = atapiId.InterseekDelay; report.ATAPI.InterseekDelaySpecified = true; } - if (atapiId.MajorVersion != 0) + if(atapiId.MajorVersion != 0) { report.ATAPI.MajorVersion = atapiId.MajorVersion; report.ATAPI.MajorVersionSpecified = true; } - if (atapiId.MasterPasswordRevisionCode != 0) + if(atapiId.MasterPasswordRevisionCode != 0) { report.ATAPI.MasterPasswordRevisionCode = atapiId.MasterPasswordRevisionCode; report.ATAPI.MasterPasswordRevisionCodeSpecified = true; } - if (atapiId.MaxDownloadMicroMode3 != 0) + if(atapiId.MaxDownloadMicroMode3 != 0) { report.ATAPI.MaxDownloadMicroMode3 = atapiId.MaxDownloadMicroMode3; report.ATAPI.MaxDownloadMicroMode3Specified = true; } - if (atapiId.MaxQueueDepth != 0) + if(atapiId.MaxQueueDepth != 0) { report.ATAPI.MaxQueueDepth = atapiId.MaxQueueDepth; report.ATAPI.MaxQueueDepthSpecified = true; } - if (atapiId.MDMAActive != 0) + if(atapiId.MDMAActive != 0) { report.ATAPI.MDMAActive = atapiId.MDMAActive; report.ATAPI.MDMAActiveSpecified = true; } - if (atapiId.MDMASupported != 0) + if(atapiId.MDMASupported != 0) { report.ATAPI.MDMASupported = atapiId.MDMASupported; report.ATAPI.MDMASupportedSpecified = true; } - if (atapiId.MinDownloadMicroMode3 != 0) + if(atapiId.MinDownloadMicroMode3 != 0) { report.ATAPI.MinDownloadMicroMode3 = atapiId.MinDownloadMicroMode3; report.ATAPI.MinDownloadMicroMode3Specified = true; } - if (atapiId.MinMDMACycleTime != 0) + if(atapiId.MinMDMACycleTime != 0) { report.ATAPI.MinMDMACycleTime = atapiId.MinMDMACycleTime; report.ATAPI.MinMDMACycleTimeSpecified = true; } - if (atapiId.MinorVersion != 0) + if(atapiId.MinorVersion != 0) { report.ATAPI.MinorVersion = atapiId.MinorVersion; report.ATAPI.MinorVersionSpecified = true; } - if (atapiId.MinPIOCycleTimeNoFlow != 0) + if(atapiId.MinPIOCycleTimeNoFlow != 0) { report.ATAPI.MinPIOCycleTimeNoFlow = atapiId.MinPIOCycleTimeNoFlow; report.ATAPI.MinPIOCycleTimeNoFlowSpecified = true; } - if (atapiId.MinPIOCycleTimeFlow != 0) + if(atapiId.MinPIOCycleTimeFlow != 0) { report.ATAPI.MinPIOCycleTimeFlow = atapiId.MinPIOCycleTimeFlow; report.ATAPI.MinPIOCycleTimeFlowSpecified = true; } - if (!string.IsNullOrWhiteSpace(atapiId.Model)) + if(!string.IsNullOrWhiteSpace(atapiId.Model)) { report.ATAPI.Model = atapiId.Model; report.ATAPI.ModelSpecified = true; } - if (atapiId.MultipleMaxSectors != 0) + if(atapiId.MultipleMaxSectors != 0) { report.ATAPI.MultipleMaxSectors = atapiId.MultipleMaxSectors; report.ATAPI.MultipleMaxSectorsSpecified = true; } - if (atapiId.MultipleSectorNumber != 0) + if(atapiId.MultipleSectorNumber != 0) { report.ATAPI.MultipleSectorNumber = atapiId.MultipleSectorNumber; report.ATAPI.MultipleSectorNumberSpecified = true; } - if (atapiId.NVCacheCaps != 0) + if(atapiId.NVCacheCaps != 0) { report.ATAPI.NVCacheCaps = atapiId.NVCacheCaps; report.ATAPI.NVCacheCapsSpecified = true; } - if (atapiId.NVCacheSize != 0) + if(atapiId.NVCacheSize != 0) { report.ATAPI.NVCacheSize = atapiId.NVCacheSize; report.ATAPI.NVCacheSizeSpecified = true; } - if (atapiId.NVCacheWriteSpeed != 0) + if(atapiId.NVCacheWriteSpeed != 0) { report.ATAPI.NVCacheWriteSpeed = atapiId.NVCacheWriteSpeed; report.ATAPI.NVCacheWriteSpeedSpecified = true; } - if (atapiId.NVEstimatedSpinUp != 0) + if(atapiId.NVEstimatedSpinUp != 0) { report.ATAPI.NVEstimatedSpinUp = atapiId.NVEstimatedSpinUp; report.ATAPI.NVEstimatedSpinUpSpecified = true; } - if (atapiId.PacketBusRelease != 0) + if(atapiId.PacketBusRelease != 0) { report.ATAPI.PacketBusRelease = atapiId.PacketBusRelease; report.ATAPI.PacketBusReleaseSpecified = true; } - if (atapiId.PIOTransferTimingMode != 0) + if(atapiId.PIOTransferTimingMode != 0) { report.ATAPI.PIOTransferTimingMode = atapiId.PIOTransferTimingMode; report.ATAPI.PIOTransferTimingModeSpecified = true; } - if (atapiId.RecommendedAAM != 0) + if(atapiId.RecommendedAAM != 0) { report.ATAPI.RecommendedAAM = atapiId.RecommendedAAM; report.ATAPI.RecommendedAAMSpecified = true; } - if (atapiId.RecMDMACycleTime != 0) + if(atapiId.RecMDMACycleTime != 0) { report.ATAPI.RecommendedMDMACycleTime = atapiId.RecMDMACycleTime; report.ATAPI.RecommendedMDMACycleTimeSpecified = true; } - if (atapiId.RemovableStatusSet != 0) + if(atapiId.RemovableStatusSet != 0) { report.ATAPI.RemovableStatusSet = atapiId.RemovableStatusSet; report.ATAPI.RemovableStatusSetSpecified = true; } - if (atapiId.SATACapabilities != 0) + if(atapiId.SATACapabilities != 0) { report.ATAPI.SATACapabilities = atapiId.SATACapabilities; report.ATAPI.SATACapabilitiesSpecified = true; } - if (atapiId.SATACapabilities2 != 0) + if(atapiId.SATACapabilities2 != 0) { report.ATAPI.SATACapabilities2 = atapiId.SATACapabilities2; report.ATAPI.SATACapabilities2Specified = true; } - if (atapiId.SATAFeatures != 0) + if(atapiId.SATAFeatures != 0) { report.ATAPI.SATAFeatures = atapiId.SATAFeatures; report.ATAPI.SATAFeaturesSpecified = true; } - if (atapiId.SCTCommandTransport != 0) + if(atapiId.SCTCommandTransport != 0) { report.ATAPI.SCTCommandTransport = atapiId.SCTCommandTransport; report.ATAPI.SCTCommandTransportSpecified = true; } - if (atapiId.SectorsPerCard != 0) + if(atapiId.SectorsPerCard != 0) { report.ATAPI.SectorsPerCard = atapiId.SectorsPerCard; report.ATAPI.SectorsPerCardSpecified = true; } - if (atapiId.SecurityEraseTime != 0) + if(atapiId.SecurityEraseTime != 0) { report.ATAPI.SecurityEraseTime = atapiId.SecurityEraseTime; report.ATAPI.SecurityEraseTimeSpecified = true; } - if (atapiId.SecurityStatus != 0) + if(atapiId.SecurityStatus != 0) { report.ATAPI.SecurityStatus = atapiId.SecurityStatus; report.ATAPI.SecurityStatusSpecified = true; } - if (atapiId.ServiceBusyClear != 0) + if(atapiId.ServiceBusyClear != 0) { report.ATAPI.ServiceBusyClear = atapiId.ServiceBusyClear; report.ATAPI.ServiceBusyClearSpecified = true; } - if (atapiId.SpecificConfiguration != 0) + if(atapiId.SpecificConfiguration != 0) { report.ATAPI.SpecificConfiguration = atapiId.SpecificConfiguration; report.ATAPI.SpecificConfigurationSpecified = true; } - if (atapiId.StreamAccessLatency != 0) + if(atapiId.StreamAccessLatency != 0) { report.ATAPI.StreamAccessLatency = atapiId.StreamAccessLatency; report.ATAPI.StreamAccessLatencySpecified = true; } - if (atapiId.StreamMinReqSize != 0) + if(atapiId.StreamMinReqSize != 0) { report.ATAPI.StreamMinReqSize = atapiId.StreamMinReqSize; report.ATAPI.StreamMinReqSizeSpecified = true; } - if (atapiId.StreamPerformanceGranularity != 0) + if(atapiId.StreamPerformanceGranularity != 0) { report.ATAPI.StreamPerformanceGranularity = atapiId.StreamPerformanceGranularity; report.ATAPI.StreamPerformanceGranularitySpecified = true; } - if (atapiId.StreamTransferTimeDMA != 0) + if(atapiId.StreamTransferTimeDMA != 0) { report.ATAPI.StreamTransferTimeDMA = atapiId.StreamTransferTimeDMA; report.ATAPI.StreamTransferTimeDMASpecified = true; } - if (atapiId.StreamTransferTimePIO != 0) + if(atapiId.StreamTransferTimePIO != 0) { report.ATAPI.StreamTransferTimePIO = atapiId.StreamTransferTimePIO; report.ATAPI.StreamTransferTimePIOSpecified = true; } - if (atapiId.TransportMajorVersion != 0) + if(atapiId.TransportMajorVersion != 0) { report.ATAPI.TransportMajorVersion = atapiId.TransportMajorVersion; report.ATAPI.TransportMajorVersionSpecified = true; } - if (atapiId.TransportMinorVersion != 0) + if(atapiId.TransportMinorVersion != 0) { report.ATAPI.TransportMinorVersion = atapiId.TransportMinorVersion; report.ATAPI.TransportMinorVersionSpecified = true; } - if (atapiId.TrustedComputing != 0) + if(atapiId.TrustedComputing != 0) { report.ATAPI.TrustedComputing = atapiId.TrustedComputing; report.ATAPI.TrustedComputingSpecified = true; } - if (atapiId.UDMAActive != 0) + if(atapiId.UDMAActive != 0) { report.ATAPI.UDMAActive = atapiId.UDMAActive; report.ATAPI.UDMAActiveSpecified = true; } - if (atapiId.UDMASupported != 0) + if(atapiId.UDMASupported != 0) { report.ATAPI.UDMASupported = atapiId.UDMASupported; report.ATAPI.UDMASupportedSpecified = true; } - if (atapiId.WRVMode != 0) + if(atapiId.WRVMode != 0) { report.ATAPI.WRVMode = atapiId.WRVMode; report.ATAPI.WRVModeSpecified = true; } - if (atapiId.WRVSectorCountMode3 != 0) + if(atapiId.WRVSectorCountMode3 != 0) { report.ATAPI.WRVSectorCountMode3 = atapiId.WRVSectorCountMode3; report.ATAPI.WRVSectorCountMode3Specified = true; } - if (atapiId.WRVSectorCountMode2 != 0) + if(atapiId.WRVSectorCountMode2 != 0) { report.ATAPI.WRVSectorCountMode2 = atapiId.WRVSectorCountMode2; report.ATAPI.WRVSectorCountMode2Specified = true; @@ -1595,65 +1595,65 @@ namespace DiscImageChef.Commands report.SCSI = new scsiType(); - if (!sense && Decoders.SCSI.Inquiry.Decode(buffer).HasValue) + if(!sense && Decoders.SCSI.Inquiry.Decode(buffer).HasValue) { Decoders.SCSI.Inquiry.SCSIInquiry inq = Decoders.SCSI.Inquiry.Decode(buffer).Value; List versionDescriptors = new List(); report.SCSI.Inquiry = new scsiInquiryType(); - if (inq.DeviceTypeModifier != 0) + if(inq.DeviceTypeModifier != 0) { report.SCSI.Inquiry.DeviceTypeModifier = inq.DeviceTypeModifier; report.SCSI.Inquiry.DeviceTypeModifierSpecified = true; } - if (inq.ISOVersion != 0) + if(inq.ISOVersion != 0) { report.SCSI.Inquiry.ISOVersion = inq.ISOVersion; report.SCSI.Inquiry.ISOVersionSpecified = true; } - if (inq.ECMAVersion != 0) + if(inq.ECMAVersion != 0) { report.SCSI.Inquiry.ECMAVersion = inq.ECMAVersion; report.SCSI.Inquiry.ECMAVersionSpecified = true; } - if (inq.ANSIVersion != 0) + if(inq.ANSIVersion != 0) { report.SCSI.Inquiry.ANSIVersion = inq.ANSIVersion; report.SCSI.Inquiry.ANSIVersionSpecified = true; } - if (inq.ResponseDataFormat != 0) + if(inq.ResponseDataFormat != 0) { report.SCSI.Inquiry.ResponseDataFormat = inq.ResponseDataFormat; report.SCSI.Inquiry.ResponseDataFormatSpecified = true; } - if (!string.IsNullOrWhiteSpace(StringHandlers.CToString(inq.VendorIdentification))) + if(!string.IsNullOrWhiteSpace(StringHandlers.CToString(inq.VendorIdentification))) { report.SCSI.Inquiry.VendorIdentification = StringHandlers.CToString(inq.VendorIdentification).Trim(); - if (!string.IsNullOrWhiteSpace(report.SCSI.Inquiry.VendorIdentification)) + if(!string.IsNullOrWhiteSpace(report.SCSI.Inquiry.VendorIdentification)) report.SCSI.Inquiry.VendorIdentificationSpecified = true; } - if (!string.IsNullOrWhiteSpace(StringHandlers.CToString(inq.ProductIdentification))) + if(!string.IsNullOrWhiteSpace(StringHandlers.CToString(inq.ProductIdentification))) { report.SCSI.Inquiry.ProductIdentification = StringHandlers.CToString(inq.ProductIdentification).Trim(); - if (!string.IsNullOrWhiteSpace(report.SCSI.Inquiry.ProductIdentification)) + if(!string.IsNullOrWhiteSpace(report.SCSI.Inquiry.ProductIdentification)) report.SCSI.Inquiry.ProductIdentificationSpecified = true; } - if (!string.IsNullOrWhiteSpace(StringHandlers.CToString(inq.ProductRevisionLevel))) + if(!string.IsNullOrWhiteSpace(StringHandlers.CToString(inq.ProductRevisionLevel))) { report.SCSI.Inquiry.ProductRevisionLevel = StringHandlers.CToString(inq.ProductRevisionLevel).Trim(); - if (!string.IsNullOrWhiteSpace(report.SCSI.Inquiry.ProductRevisionLevel)) + if(!string.IsNullOrWhiteSpace(report.SCSI.Inquiry.ProductRevisionLevel)) report.SCSI.Inquiry.ProductRevisionLevelSpecified = true; } - if (inq.VersionDescriptors != null) + if(inq.VersionDescriptors != null) { - foreach (UInt16 descriptor in inq.VersionDescriptors) + foreach(UInt16 descriptor in inq.VersionDescriptors) { - if (descriptor != 0) + if(descriptor != 0) versionDescriptors.Add(descriptor); } - if (versionDescriptors.Count > 0) + if(versionDescriptors.Count > 0) report.SCSI.Inquiry.VersionDescriptors = versionDescriptors.ToArray(); } @@ -1693,19 +1693,19 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Querying list of SCSI EVPDs..."); sense = dev.ScsiInquiry(out buffer, out senseBuffer, 0x00); - if (!sense) + if(!sense) { byte[] evpdPages = Decoders.SCSI.EVPD.DecodePage00(buffer); - if (evpdPages != null && evpdPages.Length > 0) + if(evpdPages != null && evpdPages.Length > 0) { List evpds = new List(); - foreach (byte page in evpdPages) + foreach(byte page in evpdPages) { - if (page != 0x80) + if(page != 0x80) { DicConsole.WriteLine("Querying SCSI EVPD {0:X2}h...", page); sense = dev.ScsiInquiry(out buffer, out senseBuffer, page); - if (!sense) + if(!sense) { pageType evpd = new pageType(); evpd.page = page; @@ -1714,19 +1714,19 @@ namespace DiscImageChef.Commands } } } - if (evpds.Count > 0) + if(evpds.Count > 0) report.SCSI.EVPDPages = evpds.ToArray(); } } - if (removable) + if(removable) { - if (dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice) + if(dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice) { dev.AllowMediumRemoval(out senseBuffer, timeout, out duration); dev.EjectTray(out senseBuffer, timeout, out duration); } - else if (dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess) + else if(dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess) { dev.SpcAllowMediumRemoval(out senseBuffer, timeout, out duration); DicConsole.WriteLine("Asking drive to unload tape (can take a few minutes)..."); @@ -1741,11 +1741,11 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Querying all mode pages and subpages using SCSI MODE SENSE (10)..."); sense = dev.ModeSense10(out buffer, out senseBuffer, false, true, ScsiModeSensePageControl.Default, 0x3F, 0xFF, timeout, out duration); - if (sense || dev.Error) + if(sense || dev.Error) { DicConsole.WriteLine("Querying all mode pages using SCSI MODE SENSE (10)..."); sense = dev.ModeSense10(out buffer, out senseBuffer, false, true, ScsiModeSensePageControl.Default, 0x3F, 0x00, timeout, out duration); - if (!sense && dev.Error) + if(!sense && dev.Error) { report.SCSI.SupportsModeSense10 = true; report.SCSI.SupportsModeSubpages = false; @@ -1758,14 +1758,14 @@ namespace DiscImageChef.Commands report.SCSI.SupportsModeSubpages = true; decMode = Decoders.SCSI.Modes.DecodeMode10(buffer, devType); } - + DicConsole.WriteLine("Querying all mode pages and subpages using SCSI MODE SENSE (6)..."); sense = dev.ModeSense6(out buffer, out senseBuffer, false, ScsiModeSensePageControl.Default, 0x3F, 0xFF, timeout, out duration); - if (sense || dev.Error) + if(sense || dev.Error) { DicConsole.WriteLine("Querying all mode pages using SCSI MODE SENSE (6)..."); sense = dev.ModeSense6(out buffer, out senseBuffer, false, ScsiModeSensePageControl.Default, 0x3F, 0x00, timeout, out duration); - if (sense || dev.Error) + if(sense || dev.Error) { DicConsole.WriteLine("Querying SCSI MODE SENSE (6)..."); sense = dev.ModeSense(out buffer, out senseBuffer, timeout, out duration); @@ -1774,37 +1774,37 @@ namespace DiscImageChef.Commands else report.SCSI.SupportsModeSubpages = true; - if (!sense && !dev.Error && !decMode.HasValue) + if(!sense && !dev.Error && !decMode.HasValue) decMode = Decoders.SCSI.Modes.DecodeMode6(buffer, devType); - - if (!sense && !dev.Error) + + if(!sense && !dev.Error) report.SCSI.SupportsModeSense6 = true; Decoders.SCSI.Modes.ModePage_2A? cdromMode = null; - if (decMode.HasValue) + if(decMode.HasValue) { report.SCSI.ModeSense = new modeType(); report.SCSI.ModeSense.BlankCheckEnabled = decMode.Value.Header.EBC; report.SCSI.ModeSense.DPOandFUA = decMode.Value.Header.DPOFUA; report.SCSI.ModeSense.WriteProtected = decMode.Value.Header.WriteProtected; - if (decMode.Value.Header.BufferedMode > 0) + if(decMode.Value.Header.BufferedMode > 0) { report.SCSI.ModeSense.BufferedMode = decMode.Value.Header.BufferedMode; report.SCSI.ModeSense.BufferedModeSpecified = true; } - if (decMode.Value.Header.Speed > 0) + if(decMode.Value.Header.Speed > 0) { report.SCSI.ModeSense.Speed = decMode.Value.Header.Speed; report.SCSI.ModeSense.SpeedSpecified = true; } - if (decMode.Value.Pages != null) + if(decMode.Value.Pages != null) { List modePages = new List(); - foreach (Decoders.SCSI.Modes.ModePage page in decMode.Value.Pages) + foreach(Decoders.SCSI.Modes.ModePage page in decMode.Value.Pages) { modePageType modePage = new modePageType(); modePage.page = page.Page; @@ -1812,13 +1812,13 @@ namespace DiscImageChef.Commands modePage.value = page.PageResponse; modePages.Add(modePage); - if (modePage.page == 0x2A && modePage.subpage == 0x00) + if(modePage.page == 0x2A && modePage.subpage == 0x00) { cdromMode = Decoders.SCSI.Modes.DecodeModePage_2A(page.PageResponse); } } - if (modePages.Count > 0) + if(modePages.Count > 0) report.SCSI.ModeSense.ModePages = modePages.ToArray(); } } @@ -1826,49 +1826,49 @@ namespace DiscImageChef.Commands List mediaTypes = new List(); #region MultiMediaDevice - if (dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice) + if(dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice) { report.SCSI.MultiMediaDevice = new mmcType(); - if (cdromMode.HasValue) + if(cdromMode.HasValue) { report.SCSI.MultiMediaDevice.ModeSense2A = new mmcModeType(); - if (cdromMode.Value.BufferSize != 0) + if(cdromMode.Value.BufferSize != 0) { report.SCSI.MultiMediaDevice.ModeSense2A.BufferSize = cdromMode.Value.BufferSize; report.SCSI.MultiMediaDevice.ModeSense2A.BufferSizeSpecified = true; } - if (cdromMode.Value.CurrentSpeed != 0) + if(cdromMode.Value.CurrentSpeed != 0) { report.SCSI.MultiMediaDevice.ModeSense2A.CurrentSpeed = cdromMode.Value.CurrentSpeed; report.SCSI.MultiMediaDevice.ModeSense2A.CurrentSpeedSpecified = true; } - if (cdromMode.Value.CurrentWriteSpeed != 0) + if(cdromMode.Value.CurrentWriteSpeed != 0) { report.SCSI.MultiMediaDevice.ModeSense2A.CurrentWriteSpeed = cdromMode.Value.CurrentWriteSpeed; report.SCSI.MultiMediaDevice.ModeSense2A.CurrentWriteSpeedSpecified = true; } - if (cdromMode.Value.CurrentWriteSpeedSelected != 0) + if(cdromMode.Value.CurrentWriteSpeedSelected != 0) { report.SCSI.MultiMediaDevice.ModeSense2A.CurrentWriteSpeedSelected = cdromMode.Value.CurrentWriteSpeedSelected; report.SCSI.MultiMediaDevice.ModeSense2A.CurrentWriteSpeedSelectedSpecified = true; } - if (cdromMode.Value.MaximumSpeed != 0) + if(cdromMode.Value.MaximumSpeed != 0) { report.SCSI.MultiMediaDevice.ModeSense2A.MaximumSpeed = cdromMode.Value.MaximumSpeed; report.SCSI.MultiMediaDevice.ModeSense2A.MaximumSpeedSpecified = true; } - if (cdromMode.Value.MaxWriteSpeed != 0) + if(cdromMode.Value.MaxWriteSpeed != 0) { report.SCSI.MultiMediaDevice.ModeSense2A.MaximumWriteSpeed = cdromMode.Value.MaxWriteSpeed; report.SCSI.MultiMediaDevice.ModeSense2A.MaximumWriteSpeedSpecified = true; } - if (cdromMode.Value.RotationControlSelected != 0) + if(cdromMode.Value.RotationControlSelected != 0) { report.SCSI.MultiMediaDevice.ModeSense2A.RotationControlSelected = cdromMode.Value.RotationControlSelected; report.SCSI.MultiMediaDevice.ModeSense2A.RotationControlSelectedSpecified = true; } - if (cdromMode.Value.SupportedVolumeLevels != 0) + if(cdromMode.Value.SupportedVolumeLevels != 0) { report.SCSI.MultiMediaDevice.ModeSense2A.SupportedVolumeLevels = cdromMode.Value.SupportedVolumeLevels; report.SCSI.MultiMediaDevice.ModeSense2A.SupportedVolumeLevelsSpecified = true; @@ -1920,35 +1920,35 @@ namespace DiscImageChef.Commands mediaTypes.Add("CD-ROM"); mediaTypes.Add("Audio CD"); - if (cdromMode.Value.ReadCDR) + if(cdromMode.Value.ReadCDR) mediaTypes.Add("CD-R"); - if (cdromMode.Value.ReadCDRW) + if(cdromMode.Value.ReadCDRW) mediaTypes.Add("CD-RW"); - if (cdromMode.Value.ReadDVDROM) + if(cdromMode.Value.ReadDVDROM) mediaTypes.Add("DVD-ROM"); - if (cdromMode.Value.ReadDVDRAM) + if(cdromMode.Value.ReadDVDRAM) mediaTypes.Add("DVD-RAM"); - if (cdromMode.Value.ReadDVDR) + if(cdromMode.Value.ReadDVDR) mediaTypes.Add("DVD-R"); } DicConsole.WriteLine("Querying MMC GET CONFIGURATION..."); sense = dev.GetConfiguration(out buffer, out senseBuffer, timeout, out duration); - if (!sense) + if(!sense) { Decoders.SCSI.MMC.Features.SeparatedFeatures ftr = Decoders.SCSI.MMC.Features.Separate(buffer); - if (ftr.Descriptors != null && ftr.Descriptors.Length > 0) + if(ftr.Descriptors != null && ftr.Descriptors.Length > 0) { report.SCSI.MultiMediaDevice.Features = new mmcFeaturesType(); - foreach (Decoders.SCSI.MMC.Features.FeatureDescriptor desc in ftr.Descriptors) + foreach(Decoders.SCSI.MMC.Features.FeatureDescriptor desc in ftr.Descriptors) { - switch (desc.Code) + switch(desc.Code) { case 0x0001: { Decoders.SCSI.MMC.Feature_0001? ftr0001 = Decoders.SCSI.MMC.Features.Decode_0001(desc.Data); - if (ftr0001.HasValue) + if(ftr0001.HasValue) { report.SCSI.MultiMediaDevice.Features.PhysicalInterfaceStandard = ftr0001.Value.PhysicalInterfaceStandard; report.SCSI.MultiMediaDevice.Features.PhysicalInterfaceStandardSpecified = true; @@ -1959,7 +1959,7 @@ namespace DiscImageChef.Commands case 0x0003: { Decoders.SCSI.MMC.Feature_0003? ftr0003 = Decoders.SCSI.MMC.Features.Decode_0003(desc.Data); - if (ftr0003.HasValue) + if(ftr0003.HasValue) { report.SCSI.MultiMediaDevice.Features.LoadingMechanismType = ftr0003.Value.LoadingMechanismType; report.SCSI.MultiMediaDevice.Features.LoadingMechanismTypeSpecified = true; @@ -1974,7 +1974,7 @@ namespace DiscImageChef.Commands case 0x0004: { Decoders.SCSI.MMC.Feature_0004? ftr0004 = Decoders.SCSI.MMC.Features.Decode_0004(desc.Data); - if (ftr0004.HasValue) + if(ftr0004.HasValue) { report.SCSI.MultiMediaDevice.Features.SupportsWriteProtectPAC = ftr0004.Value.DWP; report.SCSI.MultiMediaDevice.Features.SupportsWriteInhibitDCB = ftr0004.Value.WDCB; @@ -1986,14 +1986,14 @@ namespace DiscImageChef.Commands case 0x0010: { Decoders.SCSI.MMC.Feature_0010? ftr0010 = Decoders.SCSI.MMC.Features.Decode_0010(desc.Data); - if (ftr0010.HasValue) + if(ftr0010.HasValue) { - if (ftr0010.Value.LogicalBlockSize > 0) + if(ftr0010.Value.LogicalBlockSize > 0) { report.SCSI.MultiMediaDevice.Features.LogicalBlockSize = ftr0010.Value.LogicalBlockSize; report.SCSI.MultiMediaDevice.Features.LogicalBlockSizeSpecified = true; } - if (ftr0010.Value.Blocking > 0) + if(ftr0010.Value.Blocking > 0) { report.SCSI.MultiMediaDevice.Features.BlocksPerReadableUnit = ftr0010.Value.Blocking; report.SCSI.MultiMediaDevice.Features.BlocksPerReadableUnitSpecified = true; @@ -2009,7 +2009,7 @@ namespace DiscImageChef.Commands { report.SCSI.MultiMediaDevice.Features.CanReadCD = true; Decoders.SCSI.MMC.Feature_001E? ftr001E = Decoders.SCSI.MMC.Features.Decode_001E(desc.Data); - if (ftr001E.HasValue) + if(ftr001E.HasValue) { report.SCSI.MultiMediaDevice.Features.SupportsDAP = ftr001E.Value.DAP; report.SCSI.MultiMediaDevice.Features.SupportsC2 = ftr001E.Value.C2; @@ -2021,7 +2021,7 @@ namespace DiscImageChef.Commands { report.SCSI.MultiMediaDevice.Features.CanReadDVD = true; Decoders.SCSI.MMC.Feature_001F? ftr001F = Decoders.SCSI.MMC.Features.Decode_001F(desc.Data); - if (ftr001F.HasValue) + if(ftr001F.HasValue) { report.SCSI.MultiMediaDevice.Features.DVDMultiRead = ftr001F.Value.MULTI110; report.SCSI.MultiMediaDevice.Features.CanReadAllDualRW = ftr001F.Value.DualRW; @@ -2036,7 +2036,7 @@ namespace DiscImageChef.Commands { report.SCSI.MultiMediaDevice.Features.CanFormat = true; Decoders.SCSI.MMC.Feature_0023? ftr0023 = Decoders.SCSI.MMC.Features.Decode_0023(desc.Data); - if (ftr0023.HasValue) + if(ftr0023.HasValue) { report.SCSI.MultiMediaDevice.Features.CanFormatBDREWithoutSpare = ftr0023.Value.RENoSA; report.SCSI.MultiMediaDevice.Features.CanExpandBDRESpareArea = ftr0023.Value.Expand; @@ -2057,7 +2057,7 @@ namespace DiscImageChef.Commands { report.SCSI.MultiMediaDevice.Features.CanReadCDMRW = true; Decoders.SCSI.MMC.Feature_0028? ftr0028 = Decoders.SCSI.MMC.Features.Decode_0028(desc.Data); - if (ftr0028.HasValue) + if(ftr0028.HasValue) { report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusMRW = ftr0028.Value.DVDPRead; report.SCSI.MultiMediaDevice.Features.CanWriteDVDPlusMRW = ftr0028.Value.DVDPWrite; @@ -2069,7 +2069,7 @@ namespace DiscImageChef.Commands { report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusRW = true; Decoders.SCSI.MMC.Feature_002A? ftr002A = Decoders.SCSI.MMC.Features.Decode_002A(desc.Data); - if (ftr002A.HasValue) + if(ftr002A.HasValue) { report.SCSI.MultiMediaDevice.Features.CanWriteDVDPlusRW = ftr002A.Value.Write; } @@ -2079,7 +2079,7 @@ namespace DiscImageChef.Commands { report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusR = true; Decoders.SCSI.MMC.Feature_002B? ftr002B = Decoders.SCSI.MMC.Features.Decode_002B(desc.Data); - if (ftr002B.HasValue) + if(ftr002B.HasValue) { report.SCSI.MultiMediaDevice.Features.CanWriteDVDPlusR = ftr002B.Value.Write; } @@ -2089,7 +2089,7 @@ namespace DiscImageChef.Commands { report.SCSI.MultiMediaDevice.Features.CanWriteCDTAO = true; Decoders.SCSI.MMC.Feature_002D? ftr002D = Decoders.SCSI.MMC.Features.Decode_002D(desc.Data); - if (ftr002D.HasValue) + if(ftr002D.HasValue) { report.SCSI.MultiMediaDevice.Features.BufferUnderrunFreeInTAO = ftr002D.Value.BUF; report.SCSI.MultiMediaDevice.Features.CanWriteRawSubchannelInTAO = ftr002D.Value.RWRaw; @@ -2104,7 +2104,7 @@ namespace DiscImageChef.Commands { report.SCSI.MultiMediaDevice.Features.CanWriteCDSAO = true; Decoders.SCSI.MMC.Feature_002E? ftr002E = Decoders.SCSI.MMC.Features.Decode_002E(desc.Data); - if (ftr002E.HasValue) + if(ftr002E.HasValue) { report.SCSI.MultiMediaDevice.Features.BufferUnderrunFreeInSAO = ftr002E.Value.BUF; report.SCSI.MultiMediaDevice.Features.CanWriteRawMultiSession = ftr002E.Value.RAWMS; @@ -2119,7 +2119,7 @@ namespace DiscImageChef.Commands { report.SCSI.MultiMediaDevice.Features.CanWriteDVDR = true; Decoders.SCSI.MMC.Feature_002F? ftr002F = Decoders.SCSI.MMC.Features.Decode_002F(desc.Data); - if (ftr002F.HasValue) + if(ftr002F.HasValue) { report.SCSI.MultiMediaDevice.Features.BufferUnderrunFreeInDVD = ftr002F.Value.BUF; report.SCSI.MultiMediaDevice.Features.CanWriteDVDRDL = ftr002F.Value.RDL; @@ -2136,7 +2136,7 @@ namespace DiscImageChef.Commands report.SCSI.MultiMediaDevice.Features.CanWriteDDCDR = true; ; Decoders.SCSI.MMC.Feature_0031? ftr0031 = Decoders.SCSI.MMC.Features.Decode_0031(desc.Data); - if (ftr0031.HasValue) + if(ftr0031.HasValue) report.SCSI.MultiMediaDevice.Features.CanTestWriteDDCDR = ftr0031.Value.TestWrite; } break; @@ -2153,7 +2153,7 @@ namespace DiscImageChef.Commands { report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusRWDL = true; Decoders.SCSI.MMC.Feature_003A? ftr003A = Decoders.SCSI.MMC.Features.Decode_003A(desc.Data); - if (ftr003A.HasValue) + if(ftr003A.HasValue) report.SCSI.MultiMediaDevice.Features.CanWriteDVDPlusRWDL = ftr003A.Value.Write; } break; @@ -2161,7 +2161,7 @@ namespace DiscImageChef.Commands { report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusRDL = true; Decoders.SCSI.MMC.Feature_003B? ftr003B = Decoders.SCSI.MMC.Features.Decode_003B(desc.Data); - if (ftr003B.HasValue) + if(ftr003B.HasValue) report.SCSI.MultiMediaDevice.Features.CanWriteDVDPlusRDL = ftr003B.Value.Write; } break; @@ -2169,7 +2169,7 @@ namespace DiscImageChef.Commands { report.SCSI.MultiMediaDevice.Features.CanReadBD = true; Decoders.SCSI.MMC.Feature_0040? ftr0040 = Decoders.SCSI.MMC.Features.Decode_0040(desc.Data); - if (ftr0040.HasValue) + if(ftr0040.HasValue) { report.SCSI.MultiMediaDevice.Features.CanReadBluBCA = ftr0040.Value.BCA; report.SCSI.MultiMediaDevice.Features.CanReadBDRE2 = ftr0040.Value.RE2; @@ -2186,7 +2186,7 @@ namespace DiscImageChef.Commands { report.SCSI.MultiMediaDevice.Features.CanWriteBD = true; Decoders.SCSI.MMC.Feature_0041? ftr0041 = Decoders.SCSI.MMC.Features.Decode_0041(desc.Data); - if (ftr0041.HasValue) + if(ftr0041.HasValue) { report.SCSI.MultiMediaDevice.Features.CanWriteBDRE2 = ftr0041.Value.RE2; report.SCSI.MultiMediaDevice.Features.CanWriteBDRE1 = ftr0041.Value.RE1; @@ -2200,7 +2200,7 @@ namespace DiscImageChef.Commands { report.SCSI.MultiMediaDevice.Features.CanReadHDDVD = true; Decoders.SCSI.MMC.Feature_0050? ftr0050 = Decoders.SCSI.MMC.Features.Decode_0050(desc.Data); - if (ftr0050.HasValue) + if(ftr0050.HasValue) { report.SCSI.MultiMediaDevice.Features.CanReadHDDVDR = ftr0050.Value.HDDVDR; report.SCSI.MultiMediaDevice.Features.CanReadHDDVDRAM = ftr0050.Value.HDDVDRAM; @@ -2210,7 +2210,7 @@ namespace DiscImageChef.Commands case 0x0051: { Decoders.SCSI.MMC.Feature_0051? ftr0051 = Decoders.SCSI.MMC.Features.Decode_0051(desc.Data); - if (ftr0051.HasValue) + if(ftr0051.HasValue) { report.SCSI.MultiMediaDevice.Features.CanWriteHDDVDR = ftr0051.Value.HDDVDR; report.SCSI.MultiMediaDevice.Features.CanWriteHDDVDRAM = ftr0051.Value.HDDVDRAM; @@ -2227,7 +2227,7 @@ namespace DiscImageChef.Commands { report.SCSI.MultiMediaDevice.Features.EmbeddedChanger = true; Decoders.SCSI.MMC.Feature_0102? ftr0102 = Decoders.SCSI.MMC.Features.Decode_0102(desc.Data); - if (ftr0102.HasValue) + if(ftr0102.HasValue) { report.SCSI.MultiMediaDevice.Features.ChangerIsSideChangeCapable = ftr0102.Value.SCC; report.SCSI.MultiMediaDevice.Features.ChangerSupportsDiscPresent = ftr0102.Value.SDP; @@ -2239,12 +2239,12 @@ namespace DiscImageChef.Commands { report.SCSI.MultiMediaDevice.Features.CanPlayCDAudio = true; Decoders.SCSI.MMC.Feature_0103? ftr0103 = Decoders.SCSI.MMC.Features.Decode_0103(desc.Data); - if (ftr0103.HasValue) + if(ftr0103.HasValue) { report.SCSI.MultiMediaDevice.Features.CanAudioScan = ftr0103.Value.Scan; report.SCSI.MultiMediaDevice.Features.CanMuteSeparateChannels = ftr0103.Value.SCM; report.SCSI.MultiMediaDevice.Features.SupportsSeparateVolume = ftr0103.Value.SV; - if (ftr0103.Value.VolumeLevels > 0) + if(ftr0103.Value.VolumeLevels > 0) { report.SCSI.MultiMediaDevice.Features.VolumeLevelsSpecified = true; report.SCSI.MultiMediaDevice.Features.VolumeLevels = ftr0103.Value.VolumeLevels; @@ -2259,9 +2259,9 @@ namespace DiscImageChef.Commands { report.SCSI.MultiMediaDevice.Features.SupportsCSS = true; Decoders.SCSI.MMC.Feature_0106? ftr0106 = Decoders.SCSI.MMC.Features.Decode_0106(desc.Data); - if (ftr0106.HasValue) + if(ftr0106.HasValue) { - if (ftr0106.Value.CSSVersion > 0) + if(ftr0106.Value.CSSVersion > 0) { report.SCSI.MultiMediaDevice.Features.CSSVersionSpecified = true; report.SCSI.MultiMediaDevice.Features.CSSVersion = ftr0106.Value.CSSVersion; @@ -2279,9 +2279,9 @@ namespace DiscImageChef.Commands { report.SCSI.MultiMediaDevice.Features.SupportsCPRM = true; Decoders.SCSI.MMC.Feature_010B? ftr010B = Decoders.SCSI.MMC.Features.Decode_010B(desc.Data); - if (ftr010B.HasValue) + if(ftr010B.HasValue) { - if (ftr010B.Value.CPRMVersion > 0) + if(ftr010B.Value.CPRMVersion > 0) { report.SCSI.MultiMediaDevice.Features.CPRMVersionSpecified = true; report.SCSI.MultiMediaDevice.Features.CPRMVersion = ftr010B.Value.CPRMVersion; @@ -2292,7 +2292,7 @@ namespace DiscImageChef.Commands case 0x010C: { Decoders.SCSI.MMC.Feature_010C? ftr010C = Decoders.SCSI.MMC.Features.Decode_010C(desc.Data); - if (ftr010C.HasValue) + if(ftr010C.HasValue) { string syear, smonth, sday, shour, sminute, ssecond; byte[] temp; @@ -2342,7 +2342,7 @@ namespace DiscImageChef.Commands { report.SCSI.MultiMediaDevice.Features.SupportsAACS = true; Decoders.SCSI.MMC.Feature_010D? ftr010D = Decoders.SCSI.MMC.Features.Decode_010D(desc.Data); - if (ftr010D.HasValue) + if(ftr010D.HasValue) { report.SCSI.MultiMediaDevice.Features.CanReadDriveAACSCertificate = ftr010D.Value.RDC; report.SCSI.MultiMediaDevice.Features.CanReadCPRM_MKB = ftr010D.Value.RMC; @@ -2350,19 +2350,19 @@ namespace DiscImageChef.Commands report.SCSI.MultiMediaDevice.Features.SupportsBusEncryption = ftr010D.Value.BEC; report.SCSI.MultiMediaDevice.Features.CanGenerateBindingNonce = ftr010D.Value.BNG; - if (ftr010D.Value.BindNonceBlocks > 0) + if(ftr010D.Value.BindNonceBlocks > 0) { report.SCSI.MultiMediaDevice.Features.BindingNonceBlocksSpecified = true; report.SCSI.MultiMediaDevice.Features.BindingNonceBlocks = ftr010D.Value.BindNonceBlocks; } - if (ftr010D.Value.AGIDs > 0) + if(ftr010D.Value.AGIDs > 0) { report.SCSI.MultiMediaDevice.Features.AGIDsSpecified = true; report.SCSI.MultiMediaDevice.Features.AGIDs = ftr010D.Value.AGIDs; } - if (ftr010D.Value.AACSVersion > 0) + if(ftr010D.Value.AACSVersion > 0) { report.SCSI.MultiMediaDevice.Features.AACSVersionSpecified = true; report.SCSI.MultiMediaDevice.Features.AACSVersion = ftr010D.Value.AACSVersion; @@ -2386,7 +2386,7 @@ namespace DiscImageChef.Commands } } - if (report.SCSI.MultiMediaDevice.Features.CanReadBD || + if(report.SCSI.MultiMediaDevice.Features.CanReadBD || report.SCSI.MultiMediaDevice.Features.CanReadBDR || report.SCSI.MultiMediaDevice.Features.CanReadBDRE1 || report.SCSI.MultiMediaDevice.Features.CanReadBDRE2 || @@ -2395,91 +2395,91 @@ namespace DiscImageChef.Commands report.SCSI.MultiMediaDevice.Features.CanReadOldBDRE || report.SCSI.MultiMediaDevice.Features.CanReadOldBDROM) { - if (!mediaTypes.Contains("BD-ROM")) + if(!mediaTypes.Contains("BD-ROM")) mediaTypes.Add("BD-ROM"); - if (!mediaTypes.Contains("BD-R")) + if(!mediaTypes.Contains("BD-R")) mediaTypes.Add("BD-R"); - if (!mediaTypes.Contains("BD-RE")) + if(!mediaTypes.Contains("BD-RE")) mediaTypes.Add("BD-RE"); - if (!mediaTypes.Contains("BD-R LTH")) + if(!mediaTypes.Contains("BD-R LTH")) mediaTypes.Add("BD-R LTH"); - if (!mediaTypes.Contains("BD-R XL")) + if(!mediaTypes.Contains("BD-R XL")) mediaTypes.Add("BD-R XL"); } - if (report.SCSI.MultiMediaDevice.Features.CanReadCD || + if(report.SCSI.MultiMediaDevice.Features.CanReadCD || report.SCSI.MultiMediaDevice.Features.MultiRead) { - if (!mediaTypes.Contains("CD-ROM")) + if(!mediaTypes.Contains("CD-ROM")) mediaTypes.Add("CD-ROM"); - if (!mediaTypes.Contains("Audio CD")) + if(!mediaTypes.Contains("Audio CD")) mediaTypes.Add("Audio CD"); - if (!mediaTypes.Contains("CD-R")) + if(!mediaTypes.Contains("CD-R")) mediaTypes.Add("CD-R"); - if (!mediaTypes.Contains("CD-RW")) + if(!mediaTypes.Contains("CD-RW")) mediaTypes.Add("CD-RW"); } - if (report.SCSI.MultiMediaDevice.Features.CanReadCDMRW) + if(report.SCSI.MultiMediaDevice.Features.CanReadCDMRW) { - if (!mediaTypes.Contains("CD-MRW")) + if(!mediaTypes.Contains("CD-MRW")) mediaTypes.Add("CD-MRW"); } - if (report.SCSI.MultiMediaDevice.Features.CanReadDDCD) + if(report.SCSI.MultiMediaDevice.Features.CanReadDDCD) { - if (!mediaTypes.Contains("DDCD-ROM")) + if(!mediaTypes.Contains("DDCD-ROM")) mediaTypes.Add("DDCD-ROM"); - if (!mediaTypes.Contains("DDCD-R")) + if(!mediaTypes.Contains("DDCD-R")) mediaTypes.Add("DDCD-R"); - if (!mediaTypes.Contains("DDCD-RW")) + if(!mediaTypes.Contains("DDCD-RW")) mediaTypes.Add("DDCD-RW"); } - if (report.SCSI.MultiMediaDevice.Features.CanReadDVD || + if(report.SCSI.MultiMediaDevice.Features.CanReadDVD || report.SCSI.MultiMediaDevice.Features.DVDMultiRead || report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusR || report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusRDL || report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusRW || report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusRWDL) { - if (!mediaTypes.Contains("DVD-ROM")) + if(!mediaTypes.Contains("DVD-ROM")) mediaTypes.Add("DVD-ROM"); - if (!mediaTypes.Contains("DVD-R")) + if(!mediaTypes.Contains("DVD-R")) mediaTypes.Add("DVD-R"); - if (!mediaTypes.Contains("DVD-RW")) + if(!mediaTypes.Contains("DVD-RW")) mediaTypes.Add("DVD-RW"); - if (!mediaTypes.Contains("DVD+R")) + if(!mediaTypes.Contains("DVD+R")) mediaTypes.Add("DVD+R"); - if (!mediaTypes.Contains("DVD+RW")) + if(!mediaTypes.Contains("DVD+RW")) mediaTypes.Add("DVD+RW"); - if (!mediaTypes.Contains("DVD-R DL")) + if(!mediaTypes.Contains("DVD-R DL")) mediaTypes.Add("DVD-R DL"); - if (!mediaTypes.Contains("DVD+R DL")) + if(!mediaTypes.Contains("DVD+R DL")) mediaTypes.Add("DVD+R DL"); } - if (report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusMRW) + if(report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusMRW) { - if (!mediaTypes.Contains("DVD+MRW")) + if(!mediaTypes.Contains("DVD+MRW")) mediaTypes.Add("DVD+MRW"); } - if (report.SCSI.MultiMediaDevice.Features.CanReadHDDVD || + if(report.SCSI.MultiMediaDevice.Features.CanReadHDDVD || report.SCSI.MultiMediaDevice.Features.CanReadHDDVDR) { - if (!mediaTypes.Contains("HD DVD-ROM")) + if(!mediaTypes.Contains("HD DVD-ROM")) mediaTypes.Add("HD DVD-ROM"); - if (!mediaTypes.Contains("HD DVD-R")) + if(!mediaTypes.Contains("HD DVD-R")) mediaTypes.Add("HD DVD-R"); - if (!mediaTypes.Contains("HD DVD-RW")) + if(!mediaTypes.Contains("HD DVD-RW")) mediaTypes.Add("HD DVD-RW"); } - if (report.SCSI.MultiMediaDevice.Features.CanReadHDDVDRAM) + if(report.SCSI.MultiMediaDevice.Features.CanReadHDDVDRAM) { - if (!mediaTypes.Contains("HD DVD-RAM")) + if(!mediaTypes.Contains("HD DVD-RAM")) mediaTypes.Add("HD DVD-RAM"); } } @@ -2493,31 +2493,31 @@ namespace DiscImageChef.Commands // Very old CD drives do not contain mode page 2Ah neither GET CONFIGURATION, so just try all CDs on them // Also don't get confident, some drives didn't know CD-RW but are able to read them - if (mediaTypes.Count == 0 || mediaTypes.Contains("CD-ROM")) + if(mediaTypes.Count == 0 || mediaTypes.Contains("CD-ROM")) { - if (!mediaTypes.Contains("CD-ROM")) + if(!mediaTypes.Contains("CD-ROM")) mediaTypes.Add("CD-ROM"); - if (!mediaTypes.Contains("Audio CD")) + if(!mediaTypes.Contains("Audio CD")) mediaTypes.Add("Audio CD"); - if (!mediaTypes.Contains("CD-R")) + if(!mediaTypes.Contains("CD-R")) mediaTypes.Add("CD-R"); - if (!mediaTypes.Contains("CD-RW")) + if(!mediaTypes.Contains("CD-RW")) mediaTypes.Add("CD-RW"); } mediaTypes.Sort(); List mediaTests = new List(); - foreach (string mediaType in mediaTypes) + foreach(string mediaType in mediaTypes) { pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { DicConsole.Write("Do you have a {0} disc that you can insert in the drive? (Y/N): ", mediaType); pressedKey = System.Console.ReadKey(); DicConsole.WriteLine(); } - if (pressedKey.Key == ConsoleKey.Y) + if(pressedKey.Key == ConsoleKey.Y) { dev.AllowMediumRemoval(out senseBuffer, timeout, out duration); dev.EjectTray(out senseBuffer, timeout, out duration); @@ -2529,20 +2529,20 @@ namespace DiscImageChef.Commands mediaTest.MediaIsRecognized = true; sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration); - if (sense) + if(sense) { Decoders.SCSI.FixedSense? decSense = Decoders.SCSI.Sense.DecodeFixed(senseBuffer); - if (decSense.HasValue) + if(decSense.HasValue) { - if (decSense.Value.ASC == 0x3A) + if(decSense.Value.ASC == 0x3A) { int leftRetries = 20; - while (leftRetries > 0) + while(leftRetries > 0) { DicConsole.Write("\rWaiting for drive to become ready"); System.Threading.Thread.Sleep(2000); sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration); - if (!sense) + if(!sense) break; leftRetries--; @@ -2550,15 +2550,15 @@ namespace DiscImageChef.Commands mediaTest.MediaIsRecognized &= !sense; } - else if (decSense.Value.ASC == 0x04 && decSense.Value.ASCQ == 0x01) + else if(decSense.Value.ASC == 0x04 && decSense.Value.ASCQ == 0x01) { int leftRetries = 20; - while (leftRetries > 0) + while(leftRetries > 0) { DicConsole.Write("\rWaiting for drive to become ready"); System.Threading.Thread.Sleep(2000); sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration); - if (!sense) + if(!sense) break; leftRetries--; @@ -2573,14 +2573,14 @@ namespace DiscImageChef.Commands mediaTest.MediaIsRecognized = false; } - if (mediaTest.MediaIsRecognized) + if(mediaTest.MediaIsRecognized) { mediaTest.SupportsReadCapacitySpecified = true; mediaTest.SupportsReadCapacity16Specified = true; DicConsole.WriteLine("Querying SCSI READ CAPACITY..."); sense = dev.ReadCapacity(out buffer, out senseBuffer, timeout, out duration); - if (!sense && !dev.Error) + if(!sense && !dev.Error) { mediaTest.SupportsReadCapacity = true; mediaTest.Blocks = (ulong)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + (buffer[3])) + 1; @@ -2591,7 +2591,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Querying SCSI READ CAPACITY (16)..."); sense = dev.ReadCapacity16(out buffer, out buffer, timeout, out duration); - if (!sense && !dev.Error) + if(!sense && !dev.Error) { mediaTest.SupportsReadCapacity16 = true; byte[] temp = new byte[8]; @@ -2607,32 +2607,32 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Querying SCSI MODE SENSE (10)..."); sense = dev.ModeSense10(out buffer, out senseBuffer, false, true, ScsiModeSensePageControl.Current, 0x3F, 0x00, timeout, out duration); - if (!sense && !dev.Error) + if(!sense && !dev.Error) { report.SCSI.SupportsModeSense10 = true; decMode = Decoders.SCSI.Modes.DecodeMode10(buffer, dev.SCSIType); } DicConsole.WriteLine("Querying SCSI MODE SENSE..."); sense = dev.ModeSense(out buffer, out senseBuffer, timeout, out duration); - if (!sense && !dev.Error) - { + if(!sense && !dev.Error) + { report.SCSI.SupportsModeSense6 = true; - if (!decMode.HasValue) + if(!decMode.HasValue) decMode = Decoders.SCSI.Modes.DecodeMode6(buffer, dev.SCSIType); } - if (decMode.HasValue) + if(decMode.HasValue) { mediaTest.MediumType = (byte)decMode.Value.Header.MediumType; mediaTest.MediumTypeSpecified = true; - if (decMode.Value.Header.BlockDescriptors != null && decMode.Value.Header.BlockDescriptors.Length > 0) + if(decMode.Value.Header.BlockDescriptors != null && decMode.Value.Header.BlockDescriptors.Length > 0) { mediaTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density; mediaTest.DensitySpecified = true; } } - if (mediaType.StartsWith("CD-") || mediaType == "Audio CD") + if(mediaType.StartsWith("CD-") || mediaType == "Audio CD") { mediaTest.CanReadTOCSpecified = true; mediaTest.CanReadFullTOCSpecified = true; @@ -2642,7 +2642,7 @@ namespace DiscImageChef.Commands mediaTest.CanReadFullTOC = !dev.ReadRawToc(out buffer, out senseBuffer, 1, timeout, out duration); } - if (mediaType.StartsWith("CD-R")) + if(mediaType.StartsWith("CD-R")) { mediaTest.CanReadATIPSpecified = true; mediaTest.CanReadPMASpecified = true; @@ -2652,7 +2652,7 @@ namespace DiscImageChef.Commands mediaTest.CanReadPMA = !dev.ReadPma(out buffer, out senseBuffer, timeout, out duration); } - if (mediaType.StartsWith("DVD-") || mediaType.StartsWith("HD DVD-")) + if(mediaType.StartsWith("DVD-") || mediaType.StartsWith("HD DVD-")) { mediaTest.CanReadPFISpecified = true; mediaTest.CanReadDMISpecified = true; @@ -2662,14 +2662,14 @@ namespace DiscImageChef.Commands mediaTest.CanReadDMI = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DiscManufacturingInformation, 0, timeout, out duration); } - if (mediaType == "DVD-ROM") + if(mediaType == "DVD-ROM") { mediaTest.CanReadCMISpecified = true; DicConsole.WriteLine("Querying DVD CMI..."); mediaTest.CanReadCMI = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.CopyrightInformation, 0, timeout, out duration); } - if (mediaType == "DVD-ROM" || mediaType == "HD DVD-ROM") + if(mediaType == "DVD-ROM" || mediaType == "HD DVD-ROM") { mediaTest.CanReadBCASpecified = true; DicConsole.WriteLine("Querying DVD BCA..."); @@ -2679,14 +2679,14 @@ namespace DiscImageChef.Commands mediaTest.CanReadAACS = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVD_AACS, 0, timeout, out duration); } - if (mediaType == "BD-ROM") + if(mediaType == "BD-ROM") { mediaTest.CanReadBCASpecified = true; DicConsole.WriteLine("Querying BD BCA..."); mediaTest.CanReadBCA = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.BD_BurstCuttingArea, 0, timeout, out duration); } - if (mediaType == "DVD-RAM" || mediaType == "HD DVD-RAM") + if(mediaType == "DVD-RAM" || mediaType == "HD DVD-RAM") { mediaTest.CanReadDDSSpecified = true; mediaTest.CanReadSpareAreaInformationSpecified = true; @@ -2694,7 +2694,7 @@ namespace DiscImageChef.Commands mediaTest.CanReadSpareAreaInformation = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDRAM_SpareAreaInformation, 0, timeout, out duration); } - if (mediaType.StartsWith("BD-R") && mediaType != "BD-ROM") + if(mediaType.StartsWith("BD-R") && mediaType != "BD-ROM") { mediaTest.CanReadDDSSpecified = true; mediaTest.CanReadSpareAreaInformationSpecified = true; @@ -2704,14 +2704,14 @@ namespace DiscImageChef.Commands mediaTest.CanReadSpareAreaInformation = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.BD_SpareAreaInformation, 0, timeout, out duration); } - if (mediaType == "DVD-R" || mediaType == "DVD-RW") + if(mediaType == "DVD-R" || mediaType == "DVD-RW") { mediaTest.CanReadPRISpecified = true; DicConsole.WriteLine("Querying DVD PRI..."); mediaTest.CanReadPRI = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.PreRecordedInfo, 0, timeout, out duration); } - if (mediaType == "DVD-R" || mediaType == "DVD-RW" || mediaType == "HD DVD-R") + if(mediaType == "DVD-R" || mediaType == "DVD-RW" || mediaType == "HD DVD-R") { mediaTest.CanReadMediaIDSpecified = true; mediaTest.CanReadRecordablePFISpecified = true; @@ -2721,7 +2721,7 @@ namespace DiscImageChef.Commands mediaTest.CanReadRecordablePFI = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDR_PhysicalInformation, 0, timeout, out duration); } - if (mediaType.StartsWith("DVD+R")) + if(mediaType.StartsWith("DVD+R")) { mediaTest.CanReadADIPSpecified = true; mediaTest.CanReadDCBSpecified = true; @@ -2731,21 +2731,21 @@ namespace DiscImageChef.Commands mediaTest.CanReadDCB = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DCB, 0, timeout, out duration); } - if (mediaType == "HD DVD-ROM") + if(mediaType == "HD DVD-ROM") { mediaTest.CanReadHDCMISpecified = true; DicConsole.WriteLine("Querying HD DVD CMI..."); mediaTest.CanReadHDCMI = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.HDDVD_CopyrightInformation, 0, timeout, out duration); } - if (mediaType.EndsWith(" DL")) + if(mediaType.EndsWith(" DL")) { mediaTest.CanReadLayerCapacitySpecified = true; DicConsole.WriteLine("Querying DVD Layer Capacity..."); mediaTest.CanReadLayerCapacity = !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDR_LayerCapacity, 0, timeout, out duration); } - if (mediaType.StartsWith("BD-R")) + if(mediaType.StartsWith("BD-R")) { mediaTest.CanReadDiscInformationSpecified = true; mediaTest.CanReadPACSpecified = true; @@ -2769,12 +2769,12 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Trying SCSI READ (16)..."); mediaTest.SupportsRead16 = !dev.Read16(out buffer, out senseBuffer, 0, false, true, false, 0, 2048, 0, 1, false, timeout, out duration); - if (options.Debug) + if(options.Debug) { - if (!tryPlextor) + if(!tryPlextor) { pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { DicConsole.Write("Do you have want to try Plextor vendor commands? THIS IS DANGEROUS AND CAN IRREVERSIBLY DESTROY YOUR DRIVE (IF IN DOUBT PRESS 'N') (Y/N): "); pressedKey = System.Console.ReadKey(); @@ -2785,7 +2785,7 @@ namespace DiscImageChef.Commands } } - if (mediaType.StartsWith("CD-") || mediaType == "Audio CD") + if(mediaType.StartsWith("CD-") || mediaType == "Audio CD") { mediaTest.CanReadC2PointersSpecified = true; mediaTest.CanReadCorrectedSubchannelSpecified = true; @@ -2801,7 +2801,7 @@ namespace DiscImageChef.Commands mediaTest.SupportsReadCdMsfRawSpecified = true; mediaTest.SupportsReadCdRawSpecified = true; - if (mediaType == "Audio CD") + if(mediaType == "Audio CD") { DicConsole.WriteLine("Trying SCSI READ CD..."); mediaTest.SupportsReadCd = !dev.ReadCd(out buffer, out senseBuffer, 0, 2352, 1, MmcSectorTypes.CDDA, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None, MmcSubchannel.None, timeout, out duration); @@ -2820,16 +2820,16 @@ namespace DiscImageChef.Commands mediaTest.SupportsReadCdMsfRaw = !dev.ReadCdMsf(out buffer, out senseBuffer, 0x00000200, 0x00000201, 2352, MmcSectorTypes.AllTypes, false, false, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.None, timeout, out duration); } - if (mediaTest.SupportsReadCdRaw || mediaType == "Audio CD") + if(mediaTest.SupportsReadCdRaw || mediaType == "Audio CD") { DicConsole.WriteLine("Trying to read CD Lead-In..."); - for (int i = -150; i < 0; i++) + for(int i = -150; i < 0; i++) { - if (mediaType == "Audio CD") + if(mediaType == "Audio CD") sense = dev.ReadCd(out buffer, out senseBuffer, (uint)i, 2352, 1, MmcSectorTypes.CDDA, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None, MmcSubchannel.None, timeout, out duration); else sense = dev.ReadCd(out buffer, out senseBuffer, (uint)i, 2352, 1, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.None, timeout, out duration); - if (!sense) + if(!sense) { mediaTest.CanReadLeadIn = true; break; @@ -2837,17 +2837,17 @@ namespace DiscImageChef.Commands } DicConsole.WriteLine("Trying to read CD Lead-Out..."); - if (mediaType == "Audio CD") + if(mediaType == "Audio CD") mediaTest.CanReadLeadOut = dev.ReadCd(out buffer, out senseBuffer, (uint)(mediaTest.Blocks + 1), 2352, 1, MmcSectorTypes.CDDA, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None, MmcSubchannel.None, timeout, out duration); else mediaTest.CanReadLeadOut = !dev.ReadCd(out buffer, out senseBuffer, (uint)(mediaTest.Blocks + 1), 2352, 1, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.None, timeout, out duration); } - if (mediaType == "Audio CD" && mediaTest.SupportsReadCd) + if(mediaType == "Audio CD" && mediaTest.SupportsReadCd) { DicConsole.WriteLine("Trying to read C2 Pointers..."); mediaTest.CanReadC2Pointers = !dev.ReadCd(out buffer, out senseBuffer, 0, 2646, 1, MmcSectorTypes.CDDA, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2Pointers, MmcSubchannel.None, timeout, out duration); - if (!mediaTest.CanReadC2Pointers) + if(!mediaTest.CanReadC2Pointers) mediaTest.CanReadC2Pointers = !dev.ReadCd(out buffer, out senseBuffer, 0, 2648, 1, MmcSectorTypes.CDDA, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2PointersAndBlock, MmcSubchannel.None, timeout, out duration); DicConsole.WriteLine("Trying to read subchannels..."); @@ -2857,22 +2857,22 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Trying to read subchannels with C2 Pointers..."); mediaTest.CanReadPQSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2662, 1, MmcSectorTypes.CDDA, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2Pointers, MmcSubchannel.Q16, timeout, out duration); - if (!mediaTest.CanReadPQSubchannelWithC2) + if(!mediaTest.CanReadPQSubchannelWithC2) mediaTest.CanReadPQSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2664, 1, MmcSectorTypes.CDDA, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2PointersAndBlock, MmcSubchannel.Q16, timeout, out duration); mediaTest.CanReadRWSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2712, 1, MmcSectorTypes.CDDA, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2Pointers, MmcSubchannel.Raw, timeout, out duration); - if (!mediaTest.CanReadRWSubchannelWithC2) + if(!mediaTest.CanReadRWSubchannelWithC2) mediaTest.CanReadRWSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2714, 1, MmcSectorTypes.CDDA, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2PointersAndBlock, MmcSubchannel.Raw, timeout, out duration); mediaTest.CanReadCorrectedSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2712, 1, MmcSectorTypes.CDDA, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2Pointers, MmcSubchannel.RW, timeout, out duration); - if (!mediaTest.CanReadCorrectedSubchannelWithC2) + if(!mediaTest.CanReadCorrectedSubchannelWithC2) mediaTest.CanReadCorrectedSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2714, 1, MmcSectorTypes.CDDA, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2PointersAndBlock, MmcSubchannel.RW, timeout, out duration); } - else if (mediaTest.SupportsReadCdRaw) + else if(mediaTest.SupportsReadCdRaw) { DicConsole.WriteLine("Trying to read C2 Pointers..."); mediaTest.CanReadC2Pointers = !dev.ReadCd(out buffer, out senseBuffer, 0, 2646, 1, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.C2Pointers, MmcSubchannel.None, timeout, out duration); - if (!mediaTest.CanReadC2Pointers) + if(!mediaTest.CanReadC2Pointers) mediaTest.CanReadC2Pointers = !dev.ReadCd(out buffer, out senseBuffer, 0, 2646, 1, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.C2PointersAndBlock, MmcSubchannel.None, timeout, out duration); DicConsole.WriteLine("Trying to read subchannels..."); @@ -2882,22 +2882,22 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Trying to read subchannels with C2 Pointers..."); mediaTest.CanReadPQSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2662, 1, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.C2Pointers, MmcSubchannel.Q16, timeout, out duration); - if (!mediaTest.CanReadPQSubchannelWithC2) + if(!mediaTest.CanReadPQSubchannelWithC2) mediaTest.CanReadPQSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2664, 1, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.C2PointersAndBlock, MmcSubchannel.Q16, timeout, out duration); mediaTest.CanReadRWSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2712, 1, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.C2Pointers, MmcSubchannel.Raw, timeout, out duration); - if (!mediaTest.CanReadRWSubchannelWithC2) + if(!mediaTest.CanReadRWSubchannelWithC2) mediaTest.CanReadRWSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2714, 1, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.C2PointersAndBlock, MmcSubchannel.Raw, timeout, out duration); mediaTest.CanReadCorrectedSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2712, 1, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.C2Pointers, MmcSubchannel.RW, timeout, out duration); - if (!mediaTest.CanReadCorrectedSubchannelWithC2) + if(!mediaTest.CanReadCorrectedSubchannelWithC2) mediaTest.CanReadCorrectedSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2714, 1, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.C2PointersAndBlock, MmcSubchannel.RW, timeout, out duration); } else { DicConsole.WriteLine("Trying to read C2 Pointers..."); mediaTest.CanReadC2Pointers = !dev.ReadCd(out buffer, out senseBuffer, 0, 2342, 1, MmcSectorTypes.AllTypes, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2Pointers, MmcSubchannel.None, timeout, out duration); - if (!mediaTest.CanReadC2Pointers) + if(!mediaTest.CanReadC2Pointers) mediaTest.CanReadC2Pointers = !dev.ReadCd(out buffer, out senseBuffer, 0, 2344, 1, MmcSectorTypes.AllTypes, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2PointersAndBlock, MmcSubchannel.None, timeout, out duration); DicConsole.WriteLine("Trying to read subchannels..."); @@ -2907,24 +2907,24 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Trying to read subchannels with C2 Pointers..."); mediaTest.CanReadPQSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2358, 1, MmcSectorTypes.AllTypes, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2Pointers, MmcSubchannel.Q16, timeout, out duration); - if (!mediaTest.CanReadPQSubchannelWithC2) + if(!mediaTest.CanReadPQSubchannelWithC2) mediaTest.CanReadPQSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2360, 1, MmcSectorTypes.AllTypes, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2PointersAndBlock, MmcSubchannel.Q16, timeout, out duration); mediaTest.CanReadRWSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2438, 1, MmcSectorTypes.AllTypes, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2Pointers, MmcSubchannel.Raw, timeout, out duration); - if (!mediaTest.CanReadRWSubchannelWithC2) + if(!mediaTest.CanReadRWSubchannelWithC2) mediaTest.CanReadRWSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2440, 1, MmcSectorTypes.AllTypes, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2PointersAndBlock, MmcSubchannel.Raw, timeout, out duration); mediaTest.CanReadCorrectedSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2438, 1, MmcSectorTypes.AllTypes, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2Pointers, MmcSubchannel.RW, timeout, out duration); - if (!mediaTest.CanReadCorrectedSubchannelWithC2) + if(!mediaTest.CanReadCorrectedSubchannelWithC2) mediaTest.CanReadCorrectedSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2440, 1, MmcSectorTypes.AllTypes, false, false, false, MmcHeaderCodes.None, true, false, MmcErrorField.C2PointersAndBlock, MmcSubchannel.RW, timeout, out duration); } - if (options.Debug) + if(options.Debug) { - if (!tryNEC) + if(!tryNEC) { pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { DicConsole.Write("Do you have want to try NEC vendor commands? THIS IS DANGEROUS AND CAN IRREVERSIBLY DESTROY YOUR DRIVE (IF IN DOUBT PRESS 'N') (Y/N): "); pressedKey = System.Console.ReadKey(); @@ -2934,10 +2934,10 @@ namespace DiscImageChef.Commands tryNEC |= pressedKey.Key == ConsoleKey.Y; } - if (!tryPioneer) + if(!tryPioneer) { pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { DicConsole.Write("Do you have want to try Pioneer vendor commands? THIS IS DANGEROUS AND CAN IRREVERSIBLY DESTROY YOUR DRIVE (IF IN DOUBT PRESS 'N') (Y/N): "); pressedKey = System.Console.ReadKey(); @@ -2948,14 +2948,14 @@ namespace DiscImageChef.Commands } } - if (tryPlextor) + if(tryPlextor) { mediaTest.SupportsPlextorReadCDDASpecified = true; DicConsole.WriteLine("Trying Plextor READ CD-DA..."); mediaTest.SupportsPlextorReadCDDA = !dev.PlextorReadCdDa(out buffer, out senseBuffer, 0, 2352, 1, PlextorSubchannel.None, timeout, out duration); } - if (tryPioneer) + if(tryPioneer) { mediaTest.SupportsPioneerReadCDDASpecified = true; mediaTest.SupportsPioneerReadCDDAMSFSpecified = true; @@ -2965,7 +2965,7 @@ namespace DiscImageChef.Commands mediaTest.SupportsPioneerReadCDDAMSF = !dev.PioneerReadCdDaMsf(out buffer, out senseBuffer, 0x00000200, 0x00000201, 2352, PioneerSubchannel.None, timeout, out duration); } - if (tryNEC) + if(tryNEC) { mediaTest.SupportsNECReadCDDASpecified = true; DicConsole.WriteLine("Trying NEC READ CD-DA..."); @@ -2976,16 +2976,16 @@ namespace DiscImageChef.Commands mediaTest.LongBlockSize = mediaTest.BlockSize; DicConsole.WriteLine("Trying SCSI READ LONG (10)..."); sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 0xFFFF, timeout, out duration); - if (sense && !dev.Error) + if(sense && !dev.Error) { Decoders.SCSI.FixedSense? decSense = Decoders.SCSI.Sense.DecodeFixed(senseBuffer); - if (decSense.HasValue) + if(decSense.HasValue) { - if (decSense.Value.SenseKey == DiscImageChef.Decoders.SCSI.SenseKeys.IllegalRequest && + if(decSense.Value.SenseKey == DiscImageChef.Decoders.SCSI.SenseKeys.IllegalRequest && decSense.Value.ASC == 0x24 && decSense.Value.ASCQ == 0x00) { mediaTest.SupportsReadLong = true; - if (decSense.Value.InformationValid && decSense.Value.ILI) + if(decSense.Value.InformationValid && decSense.Value.ILI) { mediaTest.LongBlockSize = 0xFFFF - (decSense.Value.Information & 0xFFFF); mediaTest.LongBlockSizeSpecified = true; @@ -2994,12 +2994,12 @@ namespace DiscImageChef.Commands } } - if (options.Debug) + if(options.Debug) { - if (!tryHLDTST) + if(!tryHLDTST) { pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { DicConsole.Write("Do you have want to try HL-DT-ST (aka LG) vendor commands? THIS IS DANGEROUS AND CAN IRREVERSIBLY DESTROY YOUR DRIVE (IF IN DOUBT PRESS 'N') (Y/N): "); pressedKey = System.Console.ReadKey(); @@ -3010,15 +3010,15 @@ namespace DiscImageChef.Commands } } - if (mediaTest.SupportsReadLong && mediaTest.LongBlockSize == mediaTest.BlockSize) + if(mediaTest.SupportsReadLong && mediaTest.LongBlockSize == mediaTest.BlockSize) { - if (mediaTest.BlockSize == 512) + if(mediaTest.BlockSize == 512) { // Long sector sizes for 512-byte magneto-opticals - foreach (ushort testSize in new []{ 600, 610, 630 }) + foreach(ushort testSize in new[] { 600, 610, 630 }) { sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, testSize, timeout, out duration); - if (!sense && !dev.Error) + if(!sense && !dev.Error) { mediaTest.SupportsReadLong = true; mediaTest.LongBlockSize = testSize; @@ -3027,22 +3027,22 @@ namespace DiscImageChef.Commands } } } - else if (mediaTest.BlockSize == 1024) + else if(mediaTest.BlockSize == 1024) { sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 1200, timeout, out duration); - if (!sense && !dev.Error) + if(!sense && !dev.Error) { mediaTest.SupportsReadLong = true; mediaTest.LongBlockSize = 1200; mediaTest.LongBlockSizeSpecified = true; } } - else if (mediaTest.BlockSize == 2048) + else if(mediaTest.BlockSize == 2048) { - if (mediaType.StartsWith("DVD")) + if(mediaType.StartsWith("DVD")) { sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 37856, timeout, out duration); - if (!sense && !dev.Error) + if(!sense && !dev.Error) { mediaTest.SupportsReadLong = true; mediaTest.LongBlockSize = 37856; @@ -3052,7 +3052,7 @@ namespace DiscImageChef.Commands else { sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 2380, timeout, out duration); - if (!sense && !dev.Error) + if(!sense && !dev.Error) { mediaTest.SupportsReadLong = true; mediaTest.LongBlockSize = 2380; @@ -3060,20 +3060,20 @@ namespace DiscImageChef.Commands } } } - else if (mediaTest.BlockSize == 4096) + else if(mediaTest.BlockSize == 4096) { sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 4760, timeout, out duration); - if (!sense && !dev.Error) + if(!sense && !dev.Error) { mediaTest.SupportsReadLong = true; mediaTest.LongBlockSize = 4760; mediaTest.LongBlockSizeSpecified = true; } } - else if (mediaTest.BlockSize == 8192) + else if(mediaTest.BlockSize == 8192) { sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 9424, timeout, out duration); - if (!sense && !dev.Error) + if(!sense && !dev.Error) { mediaTest.SupportsReadLong = true; mediaTest.LongBlockSize = 9424; @@ -3082,41 +3082,41 @@ namespace DiscImageChef.Commands } } - if (tryPlextor) + if(tryPlextor) { mediaTest.SupportsPlextorReadRawDVDSpecified = true; DicConsole.WriteLine("Trying Plextor trick to raw read DVDs..."); mediaTest.SupportsPlextorReadRawDVD = !dev.PlextorReadRawDvd(out buffer, out senseBuffer, 0, 1, timeout, out duration); - if (mediaTest.SupportsPlextorReadRawDVD) + if(mediaTest.SupportsPlextorReadRawDVD) mediaTest.SupportsPlextorReadRawDVD = !ArrayHelpers.ArrayIsNullOrEmpty(buffer); } - if (tryHLDTST) + if(tryHLDTST) { mediaTest.SupportsHLDTSTReadRawDVDSpecified = true; DicConsole.WriteLine("Trying HL-DT-ST (aka LG) trick to raw read DVDs..."); mediaTest.SupportsHLDTSTReadRawDVD = !dev.HlDtStReadRawDvd(out buffer, out senseBuffer, 0, 1, timeout, out duration); } - if (mediaTest.SupportsReadLong && mediaTest.LongBlockSize == mediaTest.BlockSize) + if(mediaTest.SupportsReadLong && mediaTest.LongBlockSize == mediaTest.BlockSize) { pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { DicConsole.Write("Drive supports SCSI READ LONG but I cannot find the correct size. Do you want me to try? (This can take hours) (Y/N): "); pressedKey = System.Console.ReadKey(); DicConsole.WriteLine(); } - if (pressedKey.Key == ConsoleKey.Y) + if(pressedKey.Key == ConsoleKey.Y) { - for (ushort i = (ushort)mediaTest.BlockSize; i < (ushort)mediaTest.BlockSize * 36; i++) + for(ushort i = (ushort)mediaTest.BlockSize; i < (ushort)mediaTest.BlockSize * 36; i++) { DicConsole.Write("\rTrying to READ LONG with a size of {0} bytes...", i); sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, i, timeout, out duration); - if (!sense) + if(!sense) { - if (options.Debug) + if(options.Debug) { FileStream bingo = new FileStream(string.Format("{0}_readlong.bin", mediaType), FileMode.Create); bingo.Write(buffer, 0, buffer.Length); @@ -3132,33 +3132,33 @@ namespace DiscImageChef.Commands } } mediaTests.Add(mediaTest); - } + } report.SCSI.MultiMediaDevice.TestedMedia = mediaTests.ToArray(); } } #endregion MultiMediaDevice #region SequentialAccessDevice - else if (dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess) + else if(dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess) { report.SCSI.SequentialDevice = new sscType(); DicConsole.WriteLine("Querying SCSI READ BLOCK LIMITS..."); sense = dev.ReadBlockLimits(out buffer, out senseBuffer, timeout, out duration); - if (!sense) + if(!sense) { Decoders.SCSI.SSC.BlockLimits.BlockLimitsData? decBL = Decoders.SCSI.SSC.BlockLimits.Decode(buffer); - if (decBL.HasValue) + if(decBL.HasValue) { - if (decBL.Value.granularity > 0) + if(decBL.Value.granularity > 0) { report.SCSI.SequentialDevice.BlockSizeGranularitySpecified = true; report.SCSI.SequentialDevice.BlockSizeGranularity = decBL.Value.granularity; } - if (decBL.Value.maxBlockLen > 0) + if(decBL.Value.maxBlockLen > 0) { report.SCSI.SequentialDevice.MaxBlockLengthSpecified = true; report.SCSI.SequentialDevice.MaxBlockLength = decBL.Value.maxBlockLen; } - if (decBL.Value.minBlockLen > 0) + if(decBL.Value.minBlockLen > 0) { report.SCSI.SequentialDevice.MinBlockLengthSpecified = true; report.SCSI.SequentialDevice.MinBlockLength = decBL.Value.minBlockLen; @@ -3168,13 +3168,13 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Querying SCSI REPORT DENSITY SUPPORT..."); sense = dev.ReportDensitySupport(out buffer, out senseBuffer, false, false, timeout, out duration); - if (!sense) + if(!sense) { Decoders.SCSI.SSC.DensitySupport.DensitySupportHeader? dsh = Decoders.SCSI.SSC.DensitySupport.DecodeDensity(buffer); - if (dsh.HasValue) + if(dsh.HasValue) { report.SCSI.SequentialDevice.SupportedDensities = new SupportedDensity[dsh.Value.descriptors.Length]; - for (int i = 0; i < dsh.Value.descriptors.Length; i++) + for(int i = 0; i < dsh.Value.descriptors.Length; i++) { report.SCSI.SequentialDevice.SupportedDensities[i].BitsPerMm = dsh.Value.descriptors[i].bpmm; report.SCSI.SequentialDevice.SupportedDensities[i].Capacity = dsh.Value.descriptors[i].capacity; @@ -3194,13 +3194,13 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Querying SCSI REPORT DENSITY SUPPORT for medium types..."); sense = dev.ReportDensitySupport(out buffer, out senseBuffer, true, false, timeout, out duration); - if (!sense) + if(!sense) { Decoders.SCSI.SSC.DensitySupport.MediaTypeSupportHeader? mtsh = Decoders.SCSI.SSC.DensitySupport.DecodeMediumType(buffer); - if (mtsh.HasValue) + if(mtsh.HasValue) { report.SCSI.SequentialDevice.SupportedMediaTypes = new SupportedMedia[mtsh.Value.descriptors.Length]; - for (int i = 0; i < mtsh.Value.descriptors.Length; i++) + for(int i = 0; i < mtsh.Value.descriptors.Length; i++) { report.SCSI.SequentialDevice.SupportedMediaTypes[i].Description = mtsh.Value.descriptors[i].description; report.SCSI.SequentialDevice.SupportedMediaTypes[i].Length = mtsh.Value.descriptors[i].length; @@ -3208,10 +3208,10 @@ namespace DiscImageChef.Commands report.SCSI.SequentialDevice.SupportedMediaTypes[i].Name = mtsh.Value.descriptors[i].name; report.SCSI.SequentialDevice.SupportedMediaTypes[i].Organization = mtsh.Value.descriptors[i].organization; report.SCSI.SequentialDevice.SupportedMediaTypes[i].Width = mtsh.Value.descriptors[i].width; - if (mtsh.Value.descriptors[i].densityCodes != null) + if(mtsh.Value.descriptors[i].densityCodes != null) { report.SCSI.SequentialDevice.SupportedMediaTypes[i].DensityCodes = new int[mtsh.Value.descriptors[i].densityCodes.Length]; - for (int j = 0; j < mtsh.Value.descriptors.Length; j++) + for(int j = 0; j < mtsh.Value.descriptors.Length; j++) report.SCSI.SequentialDevice.SupportedMediaTypes[i].DensityCodes[j] = (int)mtsh.Value.descriptors[i].densityCodes[j]; } } @@ -3221,17 +3221,17 @@ namespace DiscImageChef.Commands List seqTests = new List(); pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.N) { pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { DicConsole.Write("Do you have media that you can insert in the drive? (Y/N): "); pressedKey = System.Console.ReadKey(); DicConsole.WriteLine(); } - if (pressedKey.Key == ConsoleKey.Y) + if(pressedKey.Key == ConsoleKey.Y) { DicConsole.WriteLine("Please insert it in the drive and press any key when it is ready."); System.Console.ReadKey(true); @@ -3248,20 +3248,20 @@ namespace DiscImageChef.Commands sense = dev.Load(out senseBuffer, timeout, out duration); sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration); - if (sense) + if(sense) { Decoders.SCSI.FixedSense? decSense = Decoders.SCSI.Sense.DecodeFixed(senseBuffer); - if (decSense.HasValue) + if(decSense.HasValue) { - if (decSense.Value.ASC == 0x3A) + if(decSense.Value.ASC == 0x3A) { int leftRetries = 20; - while (leftRetries > 0) + while(leftRetries > 0) { DicConsole.Write("\rWaiting for drive to become ready"); System.Threading.Thread.Sleep(2000); sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration); - if (!sense) + if(!sense) break; leftRetries--; @@ -3269,15 +3269,15 @@ namespace DiscImageChef.Commands seqTest.MediaIsRecognized &= !sense; } - else if (decSense.Value.ASC == 0x04 && decSense.Value.ASCQ == 0x01) + else if(decSense.Value.ASC == 0x04 && decSense.Value.ASCQ == 0x01) { int leftRetries = 20; - while (leftRetries > 0) + while(leftRetries > 0) { DicConsole.Write("\rWaiting for drive to become ready"); System.Threading.Thread.Sleep(2000); sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration); - if (!sense) + if(!sense) break; leftRetries--; @@ -3292,13 +3292,13 @@ namespace DiscImageChef.Commands seqTest.MediaIsRecognized = false; } - if (seqTest.MediaIsRecognized) + if(seqTest.MediaIsRecognized) { decMode = null; DicConsole.WriteLine("Querying SCSI MODE SENSE (10)..."); sense = dev.ModeSense10(out buffer, out senseBuffer, false, true, ScsiModeSensePageControl.Current, 0x3F, 0x00, timeout, out duration); - if (!sense && !dev.Error) + if(!sense && !dev.Error) { report.SCSI.SupportsModeSense10 = true; decMode = Decoders.SCSI.Modes.DecodeMode10(buffer, dev.SCSIType); @@ -3306,18 +3306,18 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Querying SCSI MODE SENSE..."); sense = dev.ModeSense(out buffer, out senseBuffer, timeout, out duration); - if (!sense && !dev.Error) + if(!sense && !dev.Error) { report.SCSI.SupportsModeSense6 = true; - if (!decMode.HasValue) + if(!decMode.HasValue) decMode = Decoders.SCSI.Modes.DecodeMode6(buffer, dev.SCSIType); } - if (decMode.HasValue) + if(decMode.HasValue) { seqTest.MediumType = (byte)decMode.Value.Header.MediumType; seqTest.MediumTypeSpecified = true; - if (decMode.Value.Header.BlockDescriptors != null && decMode.Value.Header.BlockDescriptors.Length > 0) + if(decMode.Value.Header.BlockDescriptors != null && decMode.Value.Header.BlockDescriptors.Length > 0) { seqTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density; seqTest.DensitySpecified = true; @@ -3327,13 +3327,13 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Querying SCSI REPORT DENSITY SUPPORT for current media..."); sense = dev.ReportDensitySupport(out buffer, out senseBuffer, false, true, timeout, out duration); - if (!sense) + if(!sense) { Decoders.SCSI.SSC.DensitySupport.DensitySupportHeader? dsh = Decoders.SCSI.SSC.DensitySupport.DecodeDensity(buffer); - if (dsh.HasValue) + if(dsh.HasValue) { seqTest.SupportedDensities = new SupportedDensity[dsh.Value.descriptors.Length]; - for (int i = 0; i < dsh.Value.descriptors.Length; i++) + for(int i = 0; i < dsh.Value.descriptors.Length; i++) { seqTest.SupportedDensities[i].BitsPerMm = dsh.Value.descriptors[i].bpmm; seqTest.SupportedDensities[i].Capacity = dsh.Value.descriptors[i].capacity; @@ -3353,13 +3353,13 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Querying SCSI REPORT DENSITY SUPPORT for medium types for current media..."); sense = dev.ReportDensitySupport(out buffer, out senseBuffer, true, true, timeout, out duration); - if (!sense) + if(!sense) { Decoders.SCSI.SSC.DensitySupport.MediaTypeSupportHeader? mtsh = Decoders.SCSI.SSC.DensitySupport.DecodeMediumType(buffer); - if (mtsh.HasValue) + if(mtsh.HasValue) { seqTest.SupportedMediaTypes = new SupportedMedia[mtsh.Value.descriptors.Length]; - for (int i = 0; i < mtsh.Value.descriptors.Length; i++) + for(int i = 0; i < mtsh.Value.descriptors.Length; i++) { seqTest.SupportedMediaTypes[i].Description = mtsh.Value.descriptors[i].description; seqTest.SupportedMediaTypes[i].Length = mtsh.Value.descriptors[i].length; @@ -3367,10 +3367,10 @@ namespace DiscImageChef.Commands seqTest.SupportedMediaTypes[i].Name = mtsh.Value.descriptors[i].name; seqTest.SupportedMediaTypes[i].Organization = mtsh.Value.descriptors[i].organization; seqTest.SupportedMediaTypes[i].Width = mtsh.Value.descriptors[i].width; - if (mtsh.Value.descriptors[i].densityCodes != null) + if(mtsh.Value.descriptors[i].densityCodes != null) { seqTest.SupportedMediaTypes[i].DensityCodes = new int[mtsh.Value.descriptors[i].densityCodes.Length]; - for (int j = 0; j < mtsh.Value.descriptors.Length; j++) + for(int j = 0; j < mtsh.Value.descriptors.Length; j++) seqTest.SupportedMediaTypes[i].DensityCodes[j] = (int)mtsh.Value.descriptors[i].densityCodes[j]; } } @@ -3389,22 +3389,22 @@ namespace DiscImageChef.Commands #region OtherDevices else { - if (removable) + if(removable) { List mediaTests = new List(); pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.N) { pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { DicConsole.Write("Do you have media that you can insert in the drive? (Y/N): "); pressedKey = System.Console.ReadKey(); DicConsole.WriteLine(); } - if (pressedKey.Key == ConsoleKey.Y) + if(pressedKey.Key == ConsoleKey.Y) { DicConsole.WriteLine("Please insert it in the drive and press any key when it is ready."); System.Console.ReadKey(true); @@ -3422,20 +3422,20 @@ namespace DiscImageChef.Commands mediaTest.MediaIsRecognized = true; sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration); - if (sense) + if(sense) { Decoders.SCSI.FixedSense? decSense = Decoders.SCSI.Sense.DecodeFixed(senseBuffer); - if (decSense.HasValue) + if(decSense.HasValue) { - if (decSense.Value.ASC == 0x3A) + if(decSense.Value.ASC == 0x3A) { int leftRetries = 20; - while (leftRetries > 0) + while(leftRetries > 0) { DicConsole.Write("\rWaiting for drive to become ready"); System.Threading.Thread.Sleep(2000); sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration); - if (!sense) + if(!sense) break; leftRetries--; @@ -3443,15 +3443,15 @@ namespace DiscImageChef.Commands mediaTest.MediaIsRecognized &= !sense; } - else if (decSense.Value.ASC == 0x04 && decSense.Value.ASCQ == 0x01) + else if(decSense.Value.ASC == 0x04 && decSense.Value.ASCQ == 0x01) { int leftRetries = 20; - while (leftRetries > 0) + while(leftRetries > 0) { DicConsole.Write("\rWaiting for drive to become ready"); System.Threading.Thread.Sleep(2000); sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration); - if (!sense) + if(!sense) break; leftRetries--; @@ -3466,14 +3466,14 @@ namespace DiscImageChef.Commands mediaTest.MediaIsRecognized = false; } - if (mediaTest.MediaIsRecognized) + if(mediaTest.MediaIsRecognized) { mediaTest.SupportsReadCapacitySpecified = true; mediaTest.SupportsReadCapacity16Specified = true; DicConsole.WriteLine("Querying SCSI READ CAPACITY..."); sense = dev.ReadCapacity(out buffer, out senseBuffer, timeout, out duration); - if (!sense && !dev.Error) + if(!sense && !dev.Error) { mediaTest.SupportsReadCapacity = true; mediaTest.Blocks = (ulong)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + (buffer[3])) + 1; @@ -3484,7 +3484,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Querying SCSI READ CAPACITY (16)..."); sense = dev.ReadCapacity16(out buffer, out buffer, timeout, out duration); - if (!sense && !dev.Error) + if(!sense && !dev.Error) { mediaTest.SupportsReadCapacity16 = true; byte[] temp = new byte[8]; @@ -3500,7 +3500,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Querying SCSI MODE SENSE (10)..."); sense = dev.ModeSense10(out buffer, out senseBuffer, false, true, ScsiModeSensePageControl.Current, 0x3F, 0x00, timeout, out duration); - if (!sense && !dev.Error) + if(!sense && !dev.Error) { report.SCSI.SupportsModeSense10 = true; decMode = Decoders.SCSI.Modes.DecodeMode10(buffer, dev.SCSIType); @@ -3508,18 +3508,18 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Querying SCSI MODE SENSE..."); sense = dev.ModeSense(out buffer, out senseBuffer, timeout, out duration); - if (!sense && !dev.Error) + if(!sense && !dev.Error) { report.SCSI.SupportsModeSense6 = true; - if (!decMode.HasValue) + if(!decMode.HasValue) decMode = Decoders.SCSI.Modes.DecodeMode6(buffer, dev.SCSIType); } - if (decMode.HasValue) + if(decMode.HasValue) { mediaTest.MediumType = (byte)decMode.Value.Header.MediumType; mediaTest.MediumTypeSpecified = true; - if (decMode.Value.Header.BlockDescriptors != null && decMode.Value.Header.BlockDescriptors.Length > 0) + if(decMode.Value.Header.BlockDescriptors != null && decMode.Value.Header.BlockDescriptors.Length > 0) { mediaTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density; mediaTest.DensitySpecified = true; @@ -3544,16 +3544,16 @@ namespace DiscImageChef.Commands mediaTest.LongBlockSize = mediaTest.BlockSize; DicConsole.WriteLine("Trying SCSI READ LONG (10)..."); sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 0xFFFF, timeout, out duration); - if (sense && !dev.Error) + if(sense && !dev.Error) { Decoders.SCSI.FixedSense? decSense = Decoders.SCSI.Sense.DecodeFixed(senseBuffer); - if (decSense.HasValue) + if(decSense.HasValue) { - if (decSense.Value.SenseKey == DiscImageChef.Decoders.SCSI.SenseKeys.IllegalRequest && + if(decSense.Value.SenseKey == DiscImageChef.Decoders.SCSI.SenseKeys.IllegalRequest && decSense.Value.ASC == 0x24 && decSense.Value.ASCQ == 0x00) { mediaTest.SupportsReadLong = true; - if (decSense.Value.InformationValid && decSense.Value.ILI) + if(decSense.Value.InformationValid && decSense.Value.ILI) { mediaTest.LongBlockSize = 0xFFFF - (decSense.Value.Information & 0xFFFF); mediaTest.LongBlockSizeSpecified = true; @@ -3562,15 +3562,15 @@ namespace DiscImageChef.Commands } } - if (mediaTest.SupportsReadLong && mediaTest.LongBlockSize == mediaTest.BlockSize) + if(mediaTest.SupportsReadLong && mediaTest.LongBlockSize == mediaTest.BlockSize) { - if (mediaTest.BlockSize == 512) + if(mediaTest.BlockSize == 512) { // Long sector sizes for 512-byte magneto-opticals - foreach (ushort testSize in new []{ 600, 610, 630 }) + foreach(ushort testSize in new[] { 600, 610, 630 }) { sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, testSize, timeout, out duration); - if (!sense && !dev.Error) + if(!sense && !dev.Error) { mediaTest.SupportsReadLong = true; mediaTest.LongBlockSize = testSize; @@ -3579,40 +3579,40 @@ namespace DiscImageChef.Commands } } } - else if (mediaTest.BlockSize == 1024) + else if(mediaTest.BlockSize == 1024) { sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 1200, timeout, out duration); - if (!sense && !dev.Error) + if(!sense && !dev.Error) { mediaTest.SupportsReadLong = true; mediaTest.LongBlockSize = 1200; mediaTest.LongBlockSizeSpecified = true; } } - else if (mediaTest.BlockSize == 2048) + else if(mediaTest.BlockSize == 2048) { sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 2380, timeout, out duration); - if (!sense && !dev.Error) + if(!sense && !dev.Error) { mediaTest.SupportsReadLong = true; mediaTest.LongBlockSize = 2380; mediaTest.LongBlockSizeSpecified = true; } } - else if (mediaTest.BlockSize == 4096) + else if(mediaTest.BlockSize == 4096) { sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 4760, timeout, out duration); - if (!sense && !dev.Error) + if(!sense && !dev.Error) { mediaTest.SupportsReadLong = true; mediaTest.LongBlockSize = 4760; mediaTest.LongBlockSizeSpecified = true; } } - else if (mediaTest.BlockSize == 8192) + else if(mediaTest.BlockSize == 8192) { sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 9424, timeout, out duration); - if (!sense && !dev.Error) + if(!sense && !dev.Error) { mediaTest.SupportsReadLong = true; mediaTest.LongBlockSize = 9424; @@ -3621,25 +3621,25 @@ namespace DiscImageChef.Commands } } - if (mediaTest.SupportsReadLong && mediaTest.LongBlockSize == mediaTest.BlockSize) + if(mediaTest.SupportsReadLong && mediaTest.LongBlockSize == mediaTest.BlockSize) { pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { DicConsole.Write("Drive supports SCSI READ LONG but I cannot find the correct size. Do you want me to try? (This can take hours) (Y/N): "); pressedKey = System.Console.ReadKey(); DicConsole.WriteLine(); } - if (pressedKey.Key == ConsoleKey.Y) + if(pressedKey.Key == ConsoleKey.Y) { - for (ushort i = (ushort)mediaTest.BlockSize; i < (ushort)mediaTest.BlockSize * 36; i++) + for(ushort i = (ushort)mediaTest.BlockSize; i < (ushort)mediaTest.BlockSize * 36; i++) { DicConsole.Write("\rTrying to READ LONG with a size of {0} bytes...", i); sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, i, timeout, out duration); - if (!sense) + if(!sense) { - if (options.Debug) + if(options.Debug) { FileStream bingo = new FileStream(string.Format("{0}_readlong.bin", mediaTest.MediumTypeName), FileMode.Create); bingo.Write(buffer, 0, buffer.Length); @@ -3660,7 +3660,7 @@ namespace DiscImageChef.Commands } mediaTests.Add(mediaTest); } - } + } report.SCSI.RemovableMedias = mediaTests.ToArray(); } else @@ -3674,7 +3674,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Querying SCSI READ CAPACITY..."); sense = dev.ReadCapacity(out buffer, out senseBuffer, timeout, out duration); - if (!sense && !dev.Error) + if(!sense && !dev.Error) { report.SCSI.ReadCapabilities.SupportsReadCapacity = true; report.SCSI.ReadCapabilities.Blocks = (ulong)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + (buffer[3])) + 1; @@ -3685,7 +3685,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Querying SCSI READ CAPACITY (16)..."); sense = dev.ReadCapacity16(out buffer, out buffer, timeout, out duration); - if (!sense && !dev.Error) + if(!sense && !dev.Error) { report.SCSI.ReadCapabilities.SupportsReadCapacity16 = true; byte[] temp = new byte[8]; @@ -3701,7 +3701,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Querying SCSI MODE SENSE (10)..."); sense = dev.ModeSense10(out buffer, out senseBuffer, false, true, ScsiModeSensePageControl.Current, 0x3F, 0x00, timeout, out duration); - if (!sense && !dev.Error) + if(!sense && !dev.Error) { report.SCSI.SupportsModeSense10 = true; decMode = Decoders.SCSI.Modes.DecodeMode10(buffer, dev.SCSIType); @@ -3709,18 +3709,18 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Querying SCSI MODE SENSE..."); sense = dev.ModeSense(out buffer, out senseBuffer, timeout, out duration); - if (!sense && !dev.Error) + if(!sense && !dev.Error) { report.SCSI.SupportsModeSense6 = true; - if (!decMode.HasValue) + if(!decMode.HasValue) decMode = Decoders.SCSI.Modes.DecodeMode6(buffer, dev.SCSIType); } - if (decMode.HasValue) + if(decMode.HasValue) { report.SCSI.ReadCapabilities.MediumType = (byte)decMode.Value.Header.MediumType; report.SCSI.ReadCapabilities.MediumTypeSpecified = true; - if (decMode.Value.Header.BlockDescriptors != null && decMode.Value.Header.BlockDescriptors.Length > 0) + if(decMode.Value.Header.BlockDescriptors != null && decMode.Value.Header.BlockDescriptors.Length > 0) { report.SCSI.ReadCapabilities.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density; report.SCSI.ReadCapabilities.DensitySpecified = true; @@ -3745,16 +3745,16 @@ namespace DiscImageChef.Commands report.SCSI.ReadCapabilities.LongBlockSize = report.SCSI.ReadCapabilities.BlockSize; DicConsole.WriteLine("Trying SCSI READ LONG (10)..."); sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 0xFFFF, timeout, out duration); - if (sense && !dev.Error) + if(sense && !dev.Error) { Decoders.SCSI.FixedSense? decSense = Decoders.SCSI.Sense.DecodeFixed(senseBuffer); - if (decSense.HasValue) + if(decSense.HasValue) { - if (decSense.Value.SenseKey == DiscImageChef.Decoders.SCSI.SenseKeys.IllegalRequest && + if(decSense.Value.SenseKey == DiscImageChef.Decoders.SCSI.SenseKeys.IllegalRequest && decSense.Value.ASC == 0x24 && decSense.Value.ASCQ == 0x00) { report.SCSI.ReadCapabilities.SupportsReadLong = true; - if (decSense.Value.InformationValid && decSense.Value.ILI) + if(decSense.Value.InformationValid && decSense.Value.ILI) { report.SCSI.ReadCapabilities.LongBlockSize = 0xFFFF - (decSense.Value.Information & 0xFFFF); report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true; @@ -3763,15 +3763,15 @@ namespace DiscImageChef.Commands } } - if (report.SCSI.ReadCapabilities.SupportsReadLong && report.SCSI.ReadCapabilities.LongBlockSize == report.SCSI.ReadCapabilities.BlockSize) + if(report.SCSI.ReadCapabilities.SupportsReadLong && report.SCSI.ReadCapabilities.LongBlockSize == report.SCSI.ReadCapabilities.BlockSize) { - if (report.SCSI.ReadCapabilities.BlockSize == 512) + if(report.SCSI.ReadCapabilities.BlockSize == 512) { // Long sector sizes for 512-byte magneto-opticals - foreach (ushort testSize in new []{ 600, 610, 630 }) + foreach(ushort testSize in new[] { 600, 610, 630 }) { sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, testSize, timeout, out duration); - if (!sense && !dev.Error) + if(!sense && !dev.Error) { report.SCSI.ReadCapabilities.SupportsReadLong = true; report.SCSI.ReadCapabilities.LongBlockSize = testSize; @@ -3780,40 +3780,40 @@ namespace DiscImageChef.Commands } } } - else if (report.SCSI.ReadCapabilities.BlockSize == 1024) + else if(report.SCSI.ReadCapabilities.BlockSize == 1024) { sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 1200, timeout, out duration); - if (!sense && !dev.Error) + if(!sense && !dev.Error) { report.SCSI.ReadCapabilities.SupportsReadLong = true; report.SCSI.ReadCapabilities.LongBlockSize = 1200; report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true; } } - else if (report.SCSI.ReadCapabilities.BlockSize == 2048) + else if(report.SCSI.ReadCapabilities.BlockSize == 2048) { sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 2380, timeout, out duration); - if (!sense && !dev.Error) + if(!sense && !dev.Error) { report.SCSI.ReadCapabilities.SupportsReadLong = true; report.SCSI.ReadCapabilities.LongBlockSize = 2380; report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true; } } - else if (report.SCSI.ReadCapabilities.BlockSize == 4096) + else if(report.SCSI.ReadCapabilities.BlockSize == 4096) { sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 4760, timeout, out duration); - if (!sense && !dev.Error) + if(!sense && !dev.Error) { report.SCSI.ReadCapabilities.SupportsReadLong = true; report.SCSI.ReadCapabilities.LongBlockSize = 4760; report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true; } } - else if (report.SCSI.ReadCapabilities.BlockSize == 8192) + else if(report.SCSI.ReadCapabilities.BlockSize == 8192) { sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 9424, timeout, out duration); - if (!sense && !dev.Error) + if(!sense && !dev.Error) { report.SCSI.ReadCapabilities.SupportsReadLong = true; report.SCSI.ReadCapabilities.LongBlockSize = 9424; @@ -3822,25 +3822,25 @@ namespace DiscImageChef.Commands } } - if (report.SCSI.ReadCapabilities.SupportsReadLong && report.SCSI.ReadCapabilities.LongBlockSize == report.SCSI.ReadCapabilities.BlockSize) + if(report.SCSI.ReadCapabilities.SupportsReadLong && report.SCSI.ReadCapabilities.LongBlockSize == report.SCSI.ReadCapabilities.BlockSize) { pressedKey = new ConsoleKeyInfo(); - while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { DicConsole.Write("Drive supports SCSI READ LONG but I cannot find the correct size. Do you want me to try? (This can take hours) (Y/N): "); pressedKey = System.Console.ReadKey(); DicConsole.WriteLine(); } - if (pressedKey.Key == ConsoleKey.Y) + if(pressedKey.Key == ConsoleKey.Y) { - for (ushort i = (ushort)report.SCSI.ReadCapabilities.BlockSize; i < (ushort)report.SCSI.ReadCapabilities.BlockSize * 36; i++) + for(ushort i = (ushort)report.SCSI.ReadCapabilities.BlockSize; i < (ushort)report.SCSI.ReadCapabilities.BlockSize * 36; i++) { DicConsole.Write("\rTrying to READ LONG with a size of {0} bytes...", i); sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, (ushort)i, timeout, out duration); - if (!sense) + if(!sense) { - if (options.Debug) + if(options.Debug) { FileStream bingo = new FileStream(string.Format("{0}_readlong.bin", dev.Model), FileMode.Create); bingo.Write(buffer, 0, buffer.Length); @@ -3864,14 +3864,14 @@ namespace DiscImageChef.Commands xmlSer.Serialize(xmlFs, report); xmlFs.Close(); - if (Settings.Settings.Current.SaveReportsGlobally && !String.IsNullOrEmpty (Settings.Settings.ReportsPath)) + if(Settings.Settings.Current.SaveReportsGlobally && !String.IsNullOrEmpty(Settings.Settings.ReportsPath)) { xmlFs = new FileStream(Path.Combine(Settings.Settings.ReportsPath, xmlFile), FileMode.Create); xmlSer.Serialize(xmlFs, report); xmlFs.Close(); } - if (Settings.Settings.Current.ShareReports) + if(Settings.Settings.Current.ShareReports) { SubmitReport(xmlSer); } diff --git a/DiscImageChef/Commands/Entropy.cs b/DiscImageChef/Commands/Entropy.cs index efa7a2616..79650a2ce 100644 --- a/DiscImageChef/Commands/Entropy.cs +++ b/DiscImageChef/Commands/Entropy.cs @@ -54,7 +54,7 @@ namespace DiscImageChef.Commands DicConsole.DebugWriteLine("Entropy command", "--input={0}", options.InputFile); DicConsole.DebugWriteLine("Entropy command", "--duplicated-sectors={0}", options.DuplicatedSectors); - if (!System.IO.File.Exists(options.InputFile)) + if(!System.IO.File.Exists(options.InputFile)) { DicConsole.ErrorWriteLine("Specified file does not exist."); return; @@ -62,7 +62,7 @@ namespace DiscImageChef.Commands ImagePlugin inputFormat = ImageFormat.Detect(options.InputFile); - if (inputFormat == null) + if(inputFormat == null) { DicConsole.ErrorWriteLine("Unable to recognize image format, not checksumming"); return; @@ -72,13 +72,13 @@ namespace DiscImageChef.Commands Core.Statistics.AddMediaFormat(inputFormat.GetImageFormat()); Core.Statistics.AddMedia(inputFormat.ImageInfo.mediaType, false); - if (options.SeparatedTracks) + if(options.SeparatedTracks) { try { List inputTracks = inputFormat.GetTracks(); - foreach (Track currentTrack in inputTracks) + foreach(Track currentTrack in inputTracks) { SHA1Context sha1ctxTrack = new SHA1Context(); ulong[] entTable = new ulong[256]; @@ -88,7 +88,7 @@ namespace DiscImageChef.Commands ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1; DicConsole.WriteLine("Track {0} has {1} sectors", currentTrack.TrackSequence, sectors); - for (ulong i = currentTrack.TrackStartSector; i <= currentTrack.TrackEndSector; i++) + for(ulong i = currentTrack.TrackStartSector; i <= currentTrack.TrackEndSector; i++) { DicConsole.Write("\rEntropying sector {0} of track {1}", i + 1, currentTrack.TrackSequence); byte[] sector = inputFormat.ReadSector(i, currentTrack.TrackSequence); @@ -110,21 +110,21 @@ namespace DiscImageChef.Commands double entropy = 0; foreach(ulong l in entTable) { - double frequency = (double)l/(double)trackSize; + double frequency = (double)l / (double)trackSize; entropy += -(frequency * Math.Log(frequency, 2)); } - + DicConsole.WriteLine("Entropy for track {0} is {1:F4}.", currentTrack.TrackSequence, entropy); if(options.DuplicatedSectors) - DicConsole.WriteLine("Track {0} has {1} unique sectors ({1:P3})", currentTrack.TrackSequence, uniqueSectorsPerTrack.Count, (double)uniqueSectorsPerTrack.Count/(double)sectors); + DicConsole.WriteLine("Track {0} has {1} unique sectors ({1:P3})", currentTrack.TrackSequence, uniqueSectorsPerTrack.Count, (double)uniqueSectorsPerTrack.Count / (double)sectors); DicConsole.WriteLine(); } } - catch (Exception ex) + catch(Exception ex) { - if (options.Debug) + if(options.Debug) DicConsole.DebugWriteLine("Could not get tracks because {0}", ex.Message); else DicConsole.ErrorWriteLine("Unable to get separate tracks, not calculating their entropy"); @@ -132,7 +132,7 @@ namespace DiscImageChef.Commands } - if (options.WholeDisc) + if(options.WholeDisc) { SHA1Context sha1Ctx = new SHA1Context(); ulong[] entTable = new ulong[256]; @@ -144,7 +144,7 @@ namespace DiscImageChef.Commands sha1Ctx.Init(); - for (ulong i = 0; i < sectors; i++) + for(ulong i = 0; i < sectors; i++) { DicConsole.Write("\rEntropying sector {0}", i + 1); byte[] sector = inputFormat.ReadSector(i); @@ -167,7 +167,7 @@ namespace DiscImageChef.Commands double entropy = 0; foreach(ulong l in entTable) { - double frequency = (double)l/(double)diskSize; + double frequency = (double)l / (double)diskSize; entropy += -(frequency * Math.Log(frequency, 2)); } @@ -176,7 +176,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Entropy for disk is {0:F4}.", entropy); if(options.DuplicatedSectors) - DicConsole.WriteLine("Disk has {0} unique sectors ({1:P3})", uniqueSectors.Count, (double)uniqueSectors.Count/(double)sectors); + DicConsole.WriteLine("Disk has {0} unique sectors ({1:P3})", uniqueSectors.Count, (double)uniqueSectors.Count / (double)sectors); Core.Statistics.AddCommand("entropy"); } diff --git a/DiscImageChef/Commands/Formats.cs b/DiscImageChef/Commands/Formats.cs index ed240392d..0586c623b 100644 --- a/DiscImageChef/Commands/Formats.cs +++ b/DiscImageChef/Commands/Formats.cs @@ -54,7 +54,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Supported disc image formats:"); if(FormatsOptions.Verbose) DicConsole.VerboseWriteLine("GUID\t\t\t\t\tPlugin"); - foreach (KeyValuePair kvp in plugins.ImagePluginsList) + foreach(KeyValuePair kvp in plugins.ImagePluginsList) { if(FormatsOptions.Verbose) DicConsole.VerboseWriteLine("{0}\t{1}", kvp.Value.PluginUUID, kvp.Value.Name); @@ -65,7 +65,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Supported filesystems:"); if(FormatsOptions.Verbose) DicConsole.VerboseWriteLine("GUID\t\t\t\t\tPlugin"); - foreach (KeyValuePair kvp in plugins.PluginsList) + foreach(KeyValuePair kvp in plugins.PluginsList) { if(FormatsOptions.Verbose) DicConsole.VerboseWriteLine("{0}\t{1}", kvp.Value.PluginUUID, kvp.Value.Name); @@ -76,7 +76,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Supported partitioning schemes:"); if(FormatsOptions.Verbose) DicConsole.VerboseWriteLine("GUID\t\t\t\t\tPlugin"); - foreach (KeyValuePair kvp in plugins.PartPluginsList) + foreach(KeyValuePair kvp in plugins.PartPluginsList) { if(FormatsOptions.Verbose) DicConsole.VerboseWriteLine("{0}\t{1}", kvp.Value.PluginUUID, kvp.Value.Name); diff --git a/DiscImageChef/Commands/MediaInfo.cs b/DiscImageChef/Commands/MediaInfo.cs index 4c246fb6b..50024d708 100644 --- a/DiscImageChef/Commands/MediaInfo.cs +++ b/DiscImageChef/Commands/MediaInfo.cs @@ -53,13 +53,13 @@ namespace DiscImageChef.Commands DicConsole.DebugWriteLine("Media-Info command", "--device={0}", options.DevicePath); DicConsole.DebugWriteLine("Media-Info command", "--output-prefix={0}", options.OutputPrefix); - if (!System.IO.File.Exists(options.DevicePath)) + if(!System.IO.File.Exists(options.DevicePath)) { DicConsole.ErrorWriteLine("Specified device does not exist."); return; } - if (options.DevicePath.Length == 2 && options.DevicePath[1] == ':' && + if(options.DevicePath.Length == 2 && options.DevicePath[1] == ':' && options.DevicePath[0] != '/' && Char.IsLetter(options.DevicePath[0])) { options.DevicePath = "\\\\.\\" + Char.ToUpper(options.DevicePath[0]) + ':'; @@ -67,7 +67,7 @@ namespace DiscImageChef.Commands Device dev = new Device(options.DevicePath); - if (dev.Error) + if(dev.Error) { DicConsole.ErrorWriteLine("Error {0} opening device.", dev.LastError); return; @@ -75,7 +75,7 @@ namespace DiscImageChef.Commands Core.Statistics.AddDevice(dev); - switch (dev.Type) + switch(dev.Type) { case DeviceType.ATA: doATAMediaInfo(options.OutputPrefix, dev); @@ -123,49 +123,49 @@ namespace DiscImageChef.Commands ulong blocks = 0; uint blockSize = 0; - if (dev.IsRemovable) + if(dev.IsRemovable) { sense = dev.ScsiTestUnitReady(out senseBuf, dev.Timeout, out duration); - if (sense) + if(sense) { Decoders.SCSI.FixedSense? decSense = Decoders.SCSI.Sense.DecodeFixed(senseBuf); - if (decSense.HasValue) + if(decSense.HasValue) { - if (decSense.Value.ASC == 0x3A) + if(decSense.Value.ASC == 0x3A) { int leftRetries = 5; - while (leftRetries > 0) + while(leftRetries > 0) { DicConsole.WriteLine("\rWaiting for drive to become ready"); System.Threading.Thread.Sleep(2000); sense = dev.ScsiTestUnitReady(out senseBuf, dev.Timeout, out duration); - if (!sense) + if(!sense) break; leftRetries--; } - if (sense) + if(sense) { DicConsole.ErrorWriteLine("Please insert media in drive"); return; } } - else if (decSense.Value.ASC == 0x04 && decSense.Value.ASCQ == 0x01) + else if(decSense.Value.ASC == 0x04 && decSense.Value.ASCQ == 0x01) { int leftRetries = 10; - while (leftRetries > 0) + while(leftRetries > 0) { DicConsole.WriteLine("\rWaiting for drive to become ready"); System.Threading.Thread.Sleep(2000); sense = dev.ScsiTestUnitReady(out senseBuf, dev.Timeout, out duration); - if (!sense) + if(!sense) break; leftRetries--; } - if (sense) + if(sense) { DicConsole.ErrorWriteLine("Error testing unit was ready:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); return; @@ -190,12 +190,12 @@ namespace DiscImageChef.Commands Decoders.SCSI.PeripheralDeviceTypes devType = dev.SCSIType; sense = dev.ModeSense10(out modeBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, 0x3F, 0xFF, 5, out duration); - if (sense || dev.Error) + if(sense || dev.Error) { sense = dev.ModeSense10(out modeBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out duration); } - if (!sense && !dev.Error) + if(!sense && !dev.Error) { decMode = Decoders.SCSI.Modes.DecodeMode10(modeBuf, devType); } @@ -203,16 +203,16 @@ namespace DiscImageChef.Commands if(sense || dev.Error || !decMode.HasValue) { sense = dev.ModeSense6(out modeBuf, out senseBuf, false, ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out duration); - if (sense || dev.Error) + if(sense || dev.Error) sense = dev.ModeSense6(out modeBuf, out senseBuf, false, ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out duration); - if (sense || dev.Error) + if(sense || dev.Error) sense = dev.ModeSense(out modeBuf, out senseBuf, 5, out duration); - if (!sense && !dev.Error) + if(!sense && !dev.Error) decMode = Decoders.SCSI.Modes.DecodeMode6(modeBuf, devType); } - if (!sense) + if(!sense) doWriteFile(outputPrefix, "_scsi_modesense.bin", "SCSI MODE SENSE", modeBuf); byte scsiMediumType = 0; @@ -230,7 +230,7 @@ namespace DiscImageChef.Commands containsFloppyPage = true; } - if (dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.DirectAccess || + if(dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.DirectAccess || dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice || dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.OCRWDevice || dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.OpticalDevice || @@ -238,28 +238,28 @@ namespace DiscImageChef.Commands dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.WriteOnceDevice) { sense = dev.ReadCapacity(out cmdBuf, out senseBuf, dev.Timeout, out duration); - if (!sense) + if(!sense) { doWriteFile(outputPrefix, "_readcapacity.bin", "SCSI READ CAPACITY", cmdBuf); blocks = (ulong)((cmdBuf[0] << 24) + (cmdBuf[1] << 16) + (cmdBuf[2] << 8) + (cmdBuf[3])); blockSize = (uint)((cmdBuf[5] << 24) + (cmdBuf[5] << 16) + (cmdBuf[6] << 8) + (cmdBuf[7])); } - if (sense || blocks == 0xFFFFFFFF) + if(sense || blocks == 0xFFFFFFFF) { sense = dev.ReadCapacity16(out cmdBuf, out senseBuf, dev.Timeout, out duration); - if (sense && blocks == 0) + if(sense && blocks == 0) { // Not all MMC devices support READ CAPACITY, as they have READ TOC - if (dev.SCSIType != DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice) + if(dev.SCSIType != DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice) { DicConsole.ErrorWriteLine("Unable to get media capacity"); DicConsole.ErrorWriteLine("{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); } } - if (!sense) + if(!sense) { doWriteFile(outputPrefix, "_readcapacity16.bin", "SCSI READ CAPACITY(16)", cmdBuf); byte[] temp = new byte[8]; @@ -271,7 +271,7 @@ namespace DiscImageChef.Commands } } - if (blocks != 0 && blockSize != 0) + if(blocks != 0 && blockSize != 0) { blocks++; DicConsole.WriteLine("Media has {0} blocks of {1} bytes/each. (for a total of {2} bytes)", @@ -279,21 +279,21 @@ namespace DiscImageChef.Commands } } - if (dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess) + if(dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess) { byte[] seqBuf; byte[] medBuf; sense = dev.ReportDensitySupport(out seqBuf, out senseBuf, false, dev.Timeout, out duration); - if (!sense) + if(!sense) { sense = dev.ReportDensitySupport(out medBuf, out senseBuf, true, dev.Timeout, out duration); - if (!sense && !seqBuf.SequenceEqual(medBuf)) + if(!sense && !seqBuf.SequenceEqual(medBuf)) { doWriteFile(outputPrefix, "_ssc_reportdensitysupport_media.bin", "SSC REPORT DENSITY SUPPORT (MEDIA)", seqBuf); Decoders.SCSI.SSC.DensitySupport.DensitySupportHeader? dens = Decoders.SCSI.SSC.DensitySupport.DecodeDensity(seqBuf); - if (dens.HasValue) + if(dens.HasValue) { DicConsole.WriteLine("Densities supported by currently inserted media:"); DicConsole.WriteLine(Decoders.SCSI.SSC.DensitySupport.PrettifyDensity(dens)); @@ -302,15 +302,15 @@ namespace DiscImageChef.Commands } sense = dev.ReportDensitySupport(out seqBuf, out senseBuf, true, false, dev.Timeout, out duration); - if (!sense) + if(!sense) { sense = dev.ReportDensitySupport(out medBuf, out senseBuf, true, true, dev.Timeout, out duration); - if (!sense && !seqBuf.SequenceEqual(medBuf)) + if(!sense && !seqBuf.SequenceEqual(medBuf)) { doWriteFile(outputPrefix, "_ssc_reportdensitysupport_medium_media.bin", "SSC REPORT DENSITY SUPPORT (MEDIUM & MEDIA)", seqBuf); Decoders.SCSI.SSC.DensitySupport.MediaTypeSupportHeader? meds = Decoders.SCSI.SSC.DensitySupport.DecodeMediumType(seqBuf); - if (meds.HasValue) + if(meds.HasValue) { DicConsole.WriteLine("Medium types currently inserted in device:"); DicConsole.WriteLine(Decoders.SCSI.SSC.DensitySupport.PrettifyMediumType(meds)); @@ -331,10 +331,10 @@ namespace DiscImageChef.Commands */ } - if (dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice) + if(dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice) { sense = dev.GetConfiguration(out cmdBuf, out senseBuf, 0, MmcGetConfigurationRt.Current, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ GET CONFIGURATION:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { @@ -344,7 +344,7 @@ namespace DiscImageChef.Commands DicConsole.DebugWriteLine("Media-Info command", "GET CONFIGURATION current profile is {0:X4}h", ftr.CurrentProfile); - switch (ftr.CurrentProfile) + switch(ftr.CurrentProfile) { case 0x0001: dskType = MediaType.GENERIC_HDD; @@ -437,12 +437,12 @@ namespace DiscImageChef.Commands } sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.RecognizedFormatLayers, 0, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Recognized Format Layers\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else doWriteFile(outputPrefix, "_readdiscstructure_formatlayers.bin", "SCSI READ DISC STRUCTURE", cmdBuf); sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.WriteProtectionStatus, 0, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Write Protection Status\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else doWriteFile(outputPrefix, "_readdiscstructure_writeprotection.bin", "SCSI READ DISC STRUCTURE", cmdBuf); @@ -457,7 +457,7 @@ namespace DiscImageChef.Commands */ #region All DVD and HD DVD types - if (dskType == MediaType.DVDDownload || dskType == MediaType.DVDPR || + if(dskType == MediaType.DVDDownload || dskType == MediaType.DVDPR || dskType == MediaType.DVDPRDL || dskType == MediaType.DVDPRW || dskType == MediaType.DVDPRWDL || dskType == MediaType.DVDR || dskType == MediaType.DVDRAM || dskType == MediaType.DVDRDL || @@ -469,7 +469,7 @@ namespace DiscImageChef.Commands { sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.PhysicalInformation, 0, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: PFI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { @@ -529,7 +529,7 @@ namespace DiscImageChef.Commands case Decoders.DVD.DiskCategory.Nintendo: if(decPfi.Value.DiscSize == DiscImageChef.Decoders.DVD.DVDSize.Eighty) dskType = MediaType.GOD; - else + else dskType = MediaType.WOD; break; case Decoders.DVD.DiskCategory.UMD: @@ -540,7 +540,7 @@ namespace DiscImageChef.Commands } } sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DiscManufacturingInformation, 0, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DMI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { @@ -548,7 +548,7 @@ namespace DiscImageChef.Commands //if(Decoders.Xbox.DMI.IsXbox(cmdBuf)) // Nop(); //else if - if (Decoders.Xbox.DMI.IsXbox360(cmdBuf)) + if(Decoders.Xbox.DMI.IsXbox360(cmdBuf)) { // TODO: Detect XGD3 from XGD2... dskType = MediaType.XGD2; @@ -559,10 +559,10 @@ namespace DiscImageChef.Commands #endregion All DVD and HD DVD types #region DVD-ROM - if (dskType == MediaType.DVDDownload || dskType == MediaType.DVDROM) + if(dskType == MediaType.DVDDownload || dskType == MediaType.DVDROM) { sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.CopyrightInformation, 0, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: CMI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { @@ -573,16 +573,16 @@ namespace DiscImageChef.Commands #endregion DVD-ROM #region DVD-ROM and HD DVD-ROM - if (dskType == MediaType.DVDDownload || dskType == MediaType.DVDROM || + if(dskType == MediaType.DVDDownload || dskType == MediaType.DVDROM || dskType == MediaType.HDDVDROM) { sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.BurstCuttingArea, 0, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: BCA\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else doWriteFile(outputPrefix, "_readdiscstructure_dvd_bca.bin", "SCSI READ DISC STRUCTURE", cmdBuf); sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVD_AACS, 0, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DVD AACS\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else doWriteFile(outputPrefix, "_readdiscstructure_dvd_aacs.bin", "SCSI READ DISC STRUCTURE", cmdBuf); @@ -650,10 +650,10 @@ namespace DiscImageChef.Commands #endregion Require drive authentication, won't work #region DVD-RAM and HD DVD-RAM - if (dskType == MediaType.DVDRAM || dskType == MediaType.HDDVDRAM) + if(dskType == MediaType.DVDRAM || dskType == MediaType.HDDVDRAM) { sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDRAM_DDS, 0, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DDS\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { @@ -661,7 +661,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Disc Definition Structure:\n{0}", Decoders.DVD.DDS.Prettify(cmdBuf)); } sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDRAM_MediumStatus, 0, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Medium Status\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { @@ -669,7 +669,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Medium Status:\n{0}", Decoders.DVD.Cartridge.Prettify(cmdBuf)); } sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDRAM_SpareAreaInformation, 0, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: SAI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { @@ -680,10 +680,10 @@ namespace DiscImageChef.Commands #endregion DVD-RAM and HD DVD-RAM #region DVD-R and HD DVD-R - if (dskType == MediaType.DVDR || dskType == MediaType.HDDVDR) + if(dskType == MediaType.DVDR || dskType == MediaType.HDDVDR) { sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.LastBorderOutRMD, 0, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Last-Out Border RMD\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else doWriteFile(outputPrefix, "_readdiscstructure_dvd_lastrmd.bin", "SCSI READ DISC STRUCTURE", cmdBuf); @@ -691,10 +691,10 @@ namespace DiscImageChef.Commands #endregion DVD-R and HD DVD-R #region DVD-R and DVD-RW - if (dskType == MediaType.DVDR || dskType == MediaType.DVDRW) + if(dskType == MediaType.DVDR || dskType == MediaType.DVDRW) { sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.PreRecordedInfo, 0, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Pre-Recorded Info\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else doWriteFile(outputPrefix, "_readdiscstructure_dvd_pri.bin", "SCSI READ DISC STRUCTURE", cmdBuf); @@ -702,15 +702,15 @@ namespace DiscImageChef.Commands #endregion DVD-R and DVD-RW #region DVD-R, DVD-RW and HD DVD-R - if (dskType == MediaType.DVDR || dskType == MediaType.DVDRW || dskType == MediaType.HDDVDR) + if(dskType == MediaType.DVDR || dskType == MediaType.DVDRW || dskType == MediaType.HDDVDR) { sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDR_MediaIdentifier, 0, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DVD-R Media ID\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else doWriteFile(outputPrefix, "_readdiscstructure_dvdr_mediaid.bin", "SCSI READ DISC STRUCTURE", cmdBuf); sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDR_PhysicalInformation, 0, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DVD-R PFI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else doWriteFile(outputPrefix, "_readdiscstructure_dvdr_pfi.bin", "SCSI READ DISC STRUCTURE", cmdBuf); @@ -718,7 +718,7 @@ namespace DiscImageChef.Commands #endregion DVD-R, DVD-RW and HD DVD-R #region All DVD+ - if (dskType == MediaType.DVDPR || dskType == MediaType.DVDPRDL || + if(dskType == MediaType.DVDPR || dskType == MediaType.DVDPRDL || dskType == MediaType.DVDPRW || dskType == MediaType.DVDPRWDL) { sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.ADIP, 0, dev.Timeout, out duration); @@ -728,7 +728,7 @@ namespace DiscImageChef.Commands doWriteFile(outputPrefix, "_readdiscstructure_dvd+_adip.bin", "SCSI READ DISC STRUCTURE", cmdBuf); sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DCB, 0, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DCB\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else doWriteFile(outputPrefix, "_readdiscstructure_dvd+_dcb.bin", "SCSI READ DISC STRUCTURE", cmdBuf); @@ -736,10 +736,10 @@ namespace DiscImageChef.Commands #endregion All DVD+ #region HD DVD-ROM - if (dskType == MediaType.HDDVDROM) + if(dskType == MediaType.HDDVDROM) { sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.HDDVD_CopyrightInformation, 0, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: HDDVD CMI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else doWriteFile(outputPrefix, "_readdiscstructure_hddvd_cmi.bin", "SCSI READ DISC STRUCTURE", cmdBuf); @@ -747,15 +747,15 @@ namespace DiscImageChef.Commands #endregion HD DVD-ROM #region HD DVD-R - if (dskType == MediaType.HDDVDR) + if(dskType == MediaType.HDDVDR) { sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.HDDVDR_MediumStatus, 0, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: HDDVD-R Medium Status\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else doWriteFile(outputPrefix, "_readdiscstructure_hddvdr_status.bin", "SCSI READ DISC STRUCTURE", cmdBuf); sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.HDDVDR_LastRMD, 0, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Last RMD\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else doWriteFile(outputPrefix, "_readdiscstructure_hddvdr_lastrmd.bin", "SCSI READ DISC STRUCTURE", cmdBuf); @@ -763,11 +763,11 @@ namespace DiscImageChef.Commands #endregion HD DVD-R #region DVD-R DL, DVD-RW DL, DVD+R DL, DVD+RW DL - if (dskType == MediaType.DVDPRDL || dskType == MediaType.DVDRDL || + if(dskType == MediaType.DVDPRDL || dskType == MediaType.DVDRDL || dskType == MediaType.DVDRWDL || dskType == MediaType.DVDPRWDL) { sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDR_LayerCapacity, 0, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Layer Capacity\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else doWriteFile(outputPrefix, "_readdiscstructure_dvdr_layercap.bin", "SCSI READ DISC STRUCTURE", cmdBuf); @@ -775,25 +775,25 @@ namespace DiscImageChef.Commands #endregion DVD-R DL, DVD-RW DL, DVD+R DL, DVD+RW DL #region DVD-R DL - if (dskType == MediaType.DVDRDL) + if(dskType == MediaType.DVDRDL) { sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.MiddleZoneStart, 0, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Middle Zone Start\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else doWriteFile(outputPrefix, "_readdiscstructure_dvd_mzs.bin", "SCSI READ DISC STRUCTURE", cmdBuf); sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.JumpIntervalSize, 0, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Jump Interval Size\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else doWriteFile(outputPrefix, "_readdiscstructure_dvd_jis.bin", "SCSI READ DISC STRUCTURE", cmdBuf); sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.ManualLayerJumpStartLBA, 0, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Manual Layer Jump Start LBA\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else doWriteFile(outputPrefix, "_readdiscstructure_dvd_manuallj.bin", "SCSI READ DISC STRUCTURE", cmdBuf); sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.RemapAnchorPoint, 0, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Remap Anchor Point\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else doWriteFile(outputPrefix, "_readdiscstructure_dvd_remapanchor.bin", "SCSI READ DISC STRUCTURE", cmdBuf); @@ -801,11 +801,11 @@ namespace DiscImageChef.Commands #endregion DVD-R DL #region All Blu-ray - if (dskType == MediaType.BDR || dskType == MediaType.BDRE || dskType == MediaType.BDROM || + if(dskType == MediaType.BDR || dskType == MediaType.BDRE || dskType == MediaType.BDROM || dskType == MediaType.BDRXL || dskType == MediaType.BDREXL) { sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.DiscInformation, 0, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { @@ -813,7 +813,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Blu-ray Disc Information:\n{0}", Decoders.Bluray.DI.Prettify(cmdBuf)); } sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.PAC, 0, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: PAC\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else doWriteFile(outputPrefix, "_readdiscstructure_bd_pac.bin", "SCSI READ DISC STRUCTURE", cmdBuf); @@ -821,10 +821,10 @@ namespace DiscImageChef.Commands #endregion All Blu-ray #region BD-ROM only - if (dskType == MediaType.BDROM) + if(dskType == MediaType.BDROM) { sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.BD_BurstCuttingArea, 0, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: BCA\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { @@ -835,11 +835,11 @@ namespace DiscImageChef.Commands #endregion BD-ROM only #region Writable Blu-ray only - if (dskType == MediaType.BDR || dskType == MediaType.BDRE || + if(dskType == MediaType.BDR || dskType == MediaType.BDRE || dskType == MediaType.BDRXL || dskType == MediaType.BDREXL) { sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.BD_DDS, 0, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DDS\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { @@ -847,7 +847,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Blu-ray Disc Definition Structure:\n{0}", Decoders.Bluray.DDS.Prettify(cmdBuf)); } sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.CartridgeStatus, 0, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Cartridge Status\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { @@ -855,7 +855,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Blu-ray Cartridge Status:\n{0}", Decoders.Bluray.DI.Prettify(cmdBuf)); } sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.BD_SpareAreaInformation, 0, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Spare Area Information\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { @@ -863,12 +863,12 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Blu-ray Spare Area Information:\n{0}", Decoders.Bluray.DI.Prettify(cmdBuf)); } sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.RawDFL, 0, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Raw DFL\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else doWriteFile(outputPrefix, "_readdiscstructure_bd_dfl.bin", "SCSI READ DISC STRUCTURE", cmdBuf); sense = dev.ReadDiscInformation(out cmdBuf, out senseBuf, MmcDiscInformationDataTypes.TrackResources, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ DISC INFORMATION 001b\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { @@ -876,7 +876,7 @@ namespace DiscImageChef.Commands doWriteFile(outputPrefix, "_readdiscinformation_001b.bin", "SCSI READ DISC INFORMATION", cmdBuf); } sense = dev.ReadDiscInformation(out cmdBuf, out senseBuf, MmcDiscInformationDataTypes.POWResources, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ DISC INFORMATION 010b\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { @@ -887,7 +887,7 @@ namespace DiscImageChef.Commands #endregion Writable Blu-ray only #region CDs - if (dskType == MediaType.CD || + if(dskType == MediaType.CD || dskType == MediaType.CDR || dskType == MediaType.CDROM || dskType == MediaType.CDRW || @@ -898,7 +898,7 @@ namespace DiscImageChef.Commands // We discarded all discs that falsify a TOC before requesting a real TOC // No TOC, no CD (or an empty one) bool tocSense = dev.ReadTocPmaAtip(out cmdBuf, out senseBuf, false, 0, 0, dev.Timeout, out duration); - if (tocSense) + if(tocSense) DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: TOC\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { @@ -907,19 +907,19 @@ namespace DiscImageChef.Commands doWriteFile(outputPrefix, "_toc.bin", "SCSI READ TOC/PMA/ATIP", cmdBuf); // As we have a TOC we know it is a CD - if (dskType == MediaType.Unknown) + if(dskType == MediaType.Unknown) dskType = MediaType.CD; } // ATIP exists on blank CDs sense = dev.ReadAtip(out cmdBuf, out senseBuf, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: ATIP\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { doWriteFile(outputPrefix, "_atip.bin", "SCSI READ TOC/PMA/ATIP", cmdBuf); Decoders.CD.ATIP.CDATIP? atip = Decoders.CD.ATIP.Decode(cmdBuf); - if (atip.HasValue) + if(atip.HasValue) { DicConsole.WriteLine("ATIP:\n{0}", Decoders.CD.ATIP.Prettify(atip)); // Only CD-R and CD-RW have ATIP @@ -928,23 +928,23 @@ namespace DiscImageChef.Commands } // We got a TOC, get information about a recorded/mastered CD - if (!tocSense) + if(!tocSense) { sense = dev.ReadDiscInformation(out cmdBuf, out senseBuf, MmcDiscInformationDataTypes.DiscInformation, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ DISC INFORMATION 000b\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { Decoders.SCSI.MMC.DiscInformation.StandardDiscInformation? discInfo = Decoders.SCSI.MMC.DiscInformation.Decode000b(cmdBuf); - if (discInfo.HasValue) + if(discInfo.HasValue) { DicConsole.WriteLine("Standard Disc Information:\n{0}", Decoders.SCSI.MMC.DiscInformation.Prettify000b(discInfo)); doWriteFile(outputPrefix, "_readdiscinformation_000b.bin", "SCSI READ DISC INFORMATION", cmdBuf); // If it is a read-only CD, check CD type if available - if (dskType == MediaType.CD) + if(dskType == MediaType.CD) { - switch (discInfo.Value.DiscType) + switch(discInfo.Value.DiscType) { case 0x10: dskType = MediaType.CDI; @@ -961,39 +961,39 @@ namespace DiscImageChef.Commands int firstTrackLastSession = 0; sense = dev.ReadSessionInfo(out cmdBuf, out senseBuf, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: Session info\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { doWriteFile(outputPrefix, "_session.bin", "SCSI READ TOC/PMA/ATIP", cmdBuf); Decoders.CD.Session.CDSessionInfo? session = Decoders.CD.Session.Decode(cmdBuf); DicConsole.WriteLine("Session information:\n{0}", Decoders.CD.Session.Prettify(session)); - if (session.HasValue) + if(session.HasValue) { sessions = session.Value.LastCompleteSession; firstTrackLastSession = session.Value.TrackDescriptors[0].TrackNumber; } } - if (dskType == MediaType.CD) + if(dskType == MediaType.CD) { bool hasDataTrack = false; bool hasAudioTrack = false; bool allFirstSessionTracksAreAudio = true; bool hasVideoTrack = false; - if (toc.HasValue) + if(toc.HasValue) { - foreach (Decoders.CD.TOC.CDTOCTrackDataDescriptor track in toc.Value.TrackDescriptors) + foreach(Decoders.CD.TOC.CDTOCTrackDataDescriptor track in toc.Value.TrackDescriptors) { - if (track.TrackNumber == 1 && + if(track.TrackNumber == 1 && ((Decoders.CD.TOC_CONTROL)(track.CONTROL & 0x0D) == Decoders.CD.TOC_CONTROL.DataTrack || (Decoders.CD.TOC_CONTROL)(track.CONTROL & 0x0D) == Decoders.CD.TOC_CONTROL.DataTrackIncremental)) { allFirstSessionTracksAreAudio &= firstTrackLastSession != 1; } - if ((Decoders.CD.TOC_CONTROL)(track.CONTROL & 0x0D) == Decoders.CD.TOC_CONTROL.DataTrack || + if((Decoders.CD.TOC_CONTROL)(track.CONTROL & 0x0D) == Decoders.CD.TOC_CONTROL.DataTrack || (Decoders.CD.TOC_CONTROL)(track.CONTROL & 0x0D) == Decoders.CD.TOC_CONTROL.DataTrackIncremental) { hasDataTrack = true; @@ -1002,23 +1002,23 @@ namespace DiscImageChef.Commands else hasAudioTrack = true; - if (track.ADR == 4) + if(track.ADR == 4) hasVideoTrack = true; } } - if (hasDataTrack && hasAudioTrack && allFirstSessionTracksAreAudio && sessions == 2) + if(hasDataTrack && hasAudioTrack && allFirstSessionTracksAreAudio && sessions == 2) dskType = MediaType.CDPLUS; - if (!hasDataTrack && hasAudioTrack && sessions == 1) + if(!hasDataTrack && hasAudioTrack && sessions == 1) dskType = MediaType.CDDA; - if (hasDataTrack && !hasAudioTrack && sessions == 1) + if(hasDataTrack && !hasAudioTrack && sessions == 1) dskType = MediaType.CDROM; - if (hasVideoTrack && !hasDataTrack && sessions == 1) + if(hasVideoTrack && !hasDataTrack && sessions == 1) dskType = MediaType.CDV; } sense = dev.ReadRawToc(out cmdBuf, out senseBuf, 1, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: Raw TOC\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { @@ -1026,7 +1026,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Raw TOC:\n{0}", Decoders.CD.FullTOC.Prettify(cmdBuf)); } sense = dev.ReadPma(out cmdBuf, out senseBuf, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: PMA\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { @@ -1035,12 +1035,12 @@ namespace DiscImageChef.Commands } sense = dev.ReadCdText(out cmdBuf, out senseBuf, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: CD-TEXT\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { doWriteFile(outputPrefix, "_cdtext.bin", "SCSI READ TOC/PMA/ATIP", cmdBuf); - if (Decoders.CD.CDTextOnLeadIn.Decode(cmdBuf).HasValue) + if(Decoders.CD.CDTextOnLeadIn.Decode(cmdBuf).HasValue) DicConsole.WriteLine("CD-TEXT on Lead-In:\n{0}", Decoders.CD.CDTextOnLeadIn.Prettify(cmdBuf)); } } @@ -1048,30 +1048,30 @@ namespace DiscImageChef.Commands #endregion CDs #region Nintendo - if (dskType == MediaType.Unknown && blocks > 0) + if(dskType == MediaType.Unknown && blocks > 0) { sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.PhysicalInformation, 0, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: PFI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { doWriteFile(outputPrefix, "_readdiscstructure_dvd_pfi.bin", "SCSI READ DISC STRUCTURE", cmdBuf); Decoders.DVD.PFI.PhysicalFormatInformation? nintendoPfi = Decoders.DVD.PFI.Decode(cmdBuf); - if (nintendoPfi != null) + if(nintendoPfi != null) { DicConsole.WriteLine("PFI:\n{0}", Decoders.DVD.PFI.Prettify(cmdBuf)); - if (nintendoPfi.Value.DiskCategory == DiscImageChef.Decoders.DVD.DiskCategory.Nintendo && + if(nintendoPfi.Value.DiskCategory == DiscImageChef.Decoders.DVD.DiskCategory.Nintendo && nintendoPfi.Value.PartVersion == 15) { - if (nintendoPfi.Value.DiscSize == DiscImageChef.Decoders.DVD.DVDSize.Eighty) + if(nintendoPfi.Value.DiscSize == DiscImageChef.Decoders.DVD.DVDSize.Eighty) dskType = MediaType.GOD; - else if (nintendoPfi.Value.DiscSize == DiscImageChef.Decoders.DVD.DVDSize.OneTwenty) + else if(nintendoPfi.Value.DiscSize == DiscImageChef.Decoders.DVD.DVDSize.OneTwenty) dskType = MediaType.WOD; } } } sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DiscManufacturingInformation, 0, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DMI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else doWriteFile(outputPrefix, "_readdiscstructure_dvd_dmi.bin", "SCSI READ DISC STRUCTURE", cmdBuf); @@ -1089,15 +1089,15 @@ namespace DiscImageChef.Commands Core.Statistics.AddMedia(dskType, true); sense = dev.ReadMediaSerialNumber(out cmdBuf, out senseBuf, dev.Timeout, out duration); - if (sense) + if(sense) DicConsole.DebugWriteLine("Media-Info command", "READ MEDIA SERIAL NUMBER\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); else { doWriteFile(outputPrefix, "_mediaserialnumber.bin", "SCSI READ MEDIA SERIAL NUMBER", cmdBuf); - if (cmdBuf.Length >= 4) + if(cmdBuf.Length >= 4) { DicConsole.Write("Media Serial Number: "); - for (int i = 4; i < cmdBuf.Length; i++) + for(int i = 4; i < cmdBuf.Length; i++) DicConsole.Write("{0:X2}", cmdBuf[i]); DicConsole.WriteLine(); } @@ -1106,9 +1106,9 @@ namespace DiscImageChef.Commands static void doWriteFile(string outputPrefix, string outputSuffix, string whatWriting, byte[] data) { - if (!string.IsNullOrEmpty(outputPrefix)) + if(!string.IsNullOrEmpty(outputPrefix)) { - if (!File.Exists(outputPrefix + outputSuffix)) + if(!File.Exists(outputPrefix + outputSuffix)) { try { diff --git a/DiscImageChef/Commands/MediaScan.cs b/DiscImageChef/Commands/MediaScan.cs index 55699048e..173bc5431 100644 --- a/DiscImageChef/Commands/MediaScan.cs +++ b/DiscImageChef/Commands/MediaScan.cs @@ -56,13 +56,13 @@ namespace DiscImageChef.Commands DicConsole.DebugWriteLine("Media-Scan command", "--mhdd-log={0}", options.MHDDLogPath); DicConsole.DebugWriteLine("Media-Scan command", "--ibg-log={0}", options.IBGLogPath); - if (!System.IO.File.Exists(options.DevicePath)) + if(!System.IO.File.Exists(options.DevicePath)) { DicConsole.ErrorWriteLine("Specified device does not exist."); return; } - if (options.DevicePath.Length == 2 && options.DevicePath[1] == ':' && + if(options.DevicePath.Length == 2 && options.DevicePath[1] == ':' && options.DevicePath[0] != '/' && Char.IsLetter(options.DevicePath[0])) { options.DevicePath = "\\\\.\\" + Char.ToUpper(options.DevicePath[0]) + ':'; @@ -73,7 +73,7 @@ namespace DiscImageChef.Commands Device dev = new Device(options.DevicePath); - if (dev.Error) + if(dev.Error) { DicConsole.ErrorWriteLine("Error {0} opening device.", dev.LastError); return; @@ -81,7 +81,7 @@ namespace DiscImageChef.Commands Core.Statistics.AddDevice(dev); - switch (dev.Type) + switch(dev.Type) { case DeviceType.ATA: doATAMediaScan(options.MHDDLogPath, options.IBGLogPath, options.DevicePath, dev); @@ -121,11 +121,11 @@ namespace DiscImageChef.Commands double duration; sense = dev.AtaIdentify(out cmdBuf, out errorChs); - if (!sense && Decoders.ATA.Identify.Decode(cmdBuf).HasValue) + if(!sense && Decoders.ATA.Identify.Decode(cmdBuf).HasValue) { Decoders.ATA.Identify.IdentifyDevice ataId = Decoders.ATA.Identify.Decode(cmdBuf).Value; - if (ataId.CurrentCylinders > 0 && ataId.CurrentHeads > 0 && ataId.CurrentSectorsPerTrack > 0) + if(ataId.CurrentCylinders > 0 && ataId.CurrentHeads > 0 && ataId.CurrentSectorsPerTrack > 0) { cylinders = ataId.CurrentCylinders; heads = (byte)ataId.CurrentHeads; @@ -133,7 +133,7 @@ namespace DiscImageChef.Commands blocks = (ulong)(cylinders * heads * sectors); } - if ((ataId.CurrentCylinders == 0 || ataId.CurrentHeads == 0 || ataId.CurrentSectorsPerTrack == 0) && + if((ataId.CurrentCylinders == 0 || ataId.CurrentHeads == 0 || ataId.CurrentSectorsPerTrack == 0) && (ataId.Cylinders > 0 && ataId.Heads > 0 && ataId.SectorsPerTrack > 0)) { cylinders = ataId.Cylinders; @@ -142,24 +142,24 @@ namespace DiscImageChef.Commands blocks = (ulong)(cylinders * heads * sectors); } - if (ataId.Capabilities.HasFlag(Decoders.ATA.Identify.CapabilitiesBit.LBASupport)) + if(ataId.Capabilities.HasFlag(Decoders.ATA.Identify.CapabilitiesBit.LBASupport)) { blocks = ataId.LBASectors; lbaMode = true; } - if (ataId.CommandSet2.HasFlag(Decoders.ATA.Identify.CommandSetBit2.LBA48)) + if(ataId.CommandSet2.HasFlag(Decoders.ATA.Identify.CommandSetBit2.LBA48)) { blocks = ataId.LBA48Sectors; lbaMode = true; } - if ((ataId.PhysLogSectorSize & 0x8000) == 0x0000 && + if((ataId.PhysLogSectorSize & 0x8000) == 0x0000 && (ataId.PhysLogSectorSize & 0x4000) == 0x4000) { - if ((ataId.PhysLogSectorSize & 0x1000) == 0x1000) + if((ataId.PhysLogSectorSize & 0x1000) == 0x1000) { - if (ataId.LogicalSectorWords <= 255 || ataId.LogicalAlignment == 0xFFFF) + if(ataId.LogicalSectorWords <= 255 || ataId.LogicalAlignment == 0xFFFF) blockSize = 512; else blockSize = ataId.LogicalSectorWords * 2; @@ -212,15 +212,15 @@ namespace DiscImageChef.Commands sense = dev.ReadDma(out cmdBuf, out errorLba48, 0, 1, timeout, out duration); ReadDmaLba48 = (!sense && (errorLba48.status & 0x27) == 0 && errorLba48.error == 0 && cmdBuf.Length > 0); - if (!lbaMode) + if(!lbaMode) { - if (blocks > 0xFFFFFFF && !ReadLba48 && !ReadDmaLba48) + if(blocks > 0xFFFFFFF && !ReadLba48 && !ReadDmaLba48) { DicConsole.ErrorWriteLine("Device needs 48-bit LBA commands but I can't issue them... Aborting."); return; } - if (!ReadLba && !ReadRetryLba && !ReadDmaLba && !ReadDmaRetryLba) + if(!ReadLba && !ReadRetryLba && !ReadDmaLba && !ReadDmaRetryLba) { DicConsole.ErrorWriteLine("Device needs 28-bit LBA commands but I can't issue them... Aborting."); return; @@ -228,77 +228,77 @@ namespace DiscImageChef.Commands } else { - if (!Read && !ReadRetry && !ReadDma && !ReadDmaRetry) + if(!Read && !ReadRetry && !ReadDma && !ReadDmaRetry) { DicConsole.ErrorWriteLine("Device needs CHS commands but I can't issue them... Aborting."); return; } } - if (ReadDmaLba48) + if(ReadDmaLba48) DicConsole.WriteLine("Using ATA READ DMA EXT command."); - else if (ReadLba48) + else if(ReadLba48) DicConsole.WriteLine("Using ATA READ EXT command."); - else if (ReadDmaRetryLba) + else if(ReadDmaRetryLba) DicConsole.WriteLine("Using ATA READ DMA command with retries (LBA)."); - else if (ReadDmaLba) + else if(ReadDmaLba) DicConsole.WriteLine("Using ATA READ DMA command (LBA)."); - else if (ReadRetryLba) + else if(ReadRetryLba) DicConsole.WriteLine("Using ATA READ command with retries (LBA)."); - else if (ReadLba) + else if(ReadLba) DicConsole.WriteLine("Using ATA READ command (LBA)."); - else if (ReadDmaRetry) + else if(ReadDmaRetry) DicConsole.WriteLine("Using ATA READ DMA command with retries (CHS)."); - else if (ReadDma) + else if(ReadDma) DicConsole.WriteLine("Using ATA READ DMA command (CHS)."); - else if (ReadRetry) + else if(ReadRetry) DicConsole.WriteLine("Using ATA READ command with retries (CHS)."); - else if (Read) + else if(Read) DicConsole.WriteLine("Using ATA READ command (CHS)."); byte blocksToRead = 254; bool error = true; - while (lbaMode) + while(lbaMode) { - if (ReadDmaLba48) + if(ReadDmaLba48) { sense = dev.ReadDma(out cmdBuf, out errorLba48, 0, blocksToRead, timeout, out duration); error = !(!sense && (errorLba48.status & 0x27) == 0 && errorLba48.error == 0 && cmdBuf.Length > 0); } - else if (ReadLba48) + else if(ReadLba48) { sense = dev.Read(out cmdBuf, out errorLba48, 0, blocksToRead, timeout, out duration); error = !(!sense && (errorLba48.status & 0x27) == 0 && errorLba48.error == 0 && cmdBuf.Length > 0); } - else if (ReadDmaRetryLba) + else if(ReadDmaRetryLba) { sense = dev.ReadDma(out cmdBuf, out errorLba, true, 0, blocksToRead, timeout, out duration); error = !(!sense && (errorLba.status & 0x27) == 0 && errorLba.error == 0 && cmdBuf.Length > 0); } - else if (ReadDmaLba) + else if(ReadDmaLba) { sense = dev.ReadDma(out cmdBuf, out errorLba, false, 0, blocksToRead, timeout, out duration); error = !(!sense && (errorLba.status & 0x27) == 0 && errorLba.error == 0 && cmdBuf.Length > 0); } - else if (ReadRetryLba) + else if(ReadRetryLba) { sense = dev.Read(out cmdBuf, out errorLba, true, 0, blocksToRead, timeout, out duration); error = !(!sense && (errorLba.status & 0x27) == 0 && errorLba.error == 0 && cmdBuf.Length > 0); } - else if (ReadLba) + else if(ReadLba) { sense = dev.Read(out cmdBuf, out errorLba, false, 0, blocksToRead, timeout, out duration); error = !(!sense && (errorLba.status & 0x27) == 0 && errorLba.error == 0 && cmdBuf.Length > 0); } - if (error) + if(error) blocksToRead /= 2; - if (!error || blocksToRead == 1) + if(!error || blocksToRead == 1) break; } - if (error && lbaMode) + if(error && lbaMode) { DicConsole.ErrorWriteLine("Device error {0} trying to guess ideal transfer length.", dev.LastError); return; @@ -338,7 +338,7 @@ namespace DiscImageChef.Commands e.Cancel = aborted = true; }; - if (lbaMode) + if(lbaMode) { DicConsole.WriteLine("Reading {0} sectors at a time.", blocksToRead); @@ -346,19 +346,19 @@ namespace DiscImageChef.Commands ibgLog = new Core.IBGLog(IBGLogPath, currentProfile); start = DateTime.UtcNow; - for (ulong i = 0; i < blocks; i += blocksToRead) + for(ulong i = 0; i < blocks; i += blocksToRead) { - if (aborted) + if(aborted) break; double cmdDuration = 0; - if ((blocks - i) < blocksToRead) + if((blocks - i) < blocksToRead) blocksToRead = (byte)(blocks - i); - if (currentSpeed > maxSpeed && currentSpeed != 0) + if(currentSpeed > maxSpeed && currentSpeed != 0) maxSpeed = currentSpeed; - if (currentSpeed < minSpeed && currentSpeed != 0) + if(currentSpeed < minSpeed && currentSpeed != 0) minSpeed = currentSpeed; DicConsole.Write("\rReading sector {0} of {1} ({2:F3} MiB/sec.)", i, blocks, currentSpeed); @@ -366,42 +366,42 @@ namespace DiscImageChef.Commands error = true; byte status = 0, errorByte = 0; - if (ReadDmaLba48) + if(ReadDmaLba48) { sense = dev.ReadDma(out cmdBuf, out errorLba48, i, blocksToRead, timeout, out cmdDuration); error = !(!sense && (errorLba48.status & 0x27) == 0 && errorLba48.error == 0 && cmdBuf.Length > 0); status = errorLba48.status; errorByte = errorLba48.error; } - else if (ReadLba48) + else if(ReadLba48) { sense = dev.Read(out cmdBuf, out errorLba48, i, blocksToRead, timeout, out cmdDuration); error = !(!sense && (errorLba48.status & 0x27) == 0 && errorLba48.error == 0 && cmdBuf.Length > 0); status = errorLba48.status; errorByte = errorLba48.error; } - else if (ReadDmaRetryLba) + else if(ReadDmaRetryLba) { sense = dev.ReadDma(out cmdBuf, out errorLba, true, (uint)i, blocksToRead, timeout, out cmdDuration); error = !(!sense && (errorLba.status & 0x27) == 0 && errorLba.error == 0 && cmdBuf.Length > 0); status = errorLba.status; errorByte = errorLba.error; } - else if (ReadDmaLba) + else if(ReadDmaLba) { sense = dev.ReadDma(out cmdBuf, out errorLba, false, (uint)i, blocksToRead, timeout, out cmdDuration); error = !(!sense && (errorLba.status & 0x27) == 0 && errorLba.error == 0 && cmdBuf.Length > 0); status = errorLba.status; errorByte = errorLba.error; } - else if (ReadRetryLba) + else if(ReadRetryLba) { sense = dev.Read(out cmdBuf, out errorLba, true, (uint)i, blocksToRead, timeout, out cmdDuration); error = !(!sense && (errorLba.status & 0x27) == 0 && errorLba.error == 0 && cmdBuf.Length > 0); status = errorLba.status; errorByte = errorLba.error; } - else if (ReadLba) + else if(ReadLba) { sense = dev.Read(out cmdBuf, out errorLba, false, (uint)i, blocksToRead, timeout, out cmdDuration); error = !(!sense && (errorLba.status & 0x27) == 0 && errorLba.error == 0 && cmdBuf.Length > 0); @@ -409,25 +409,25 @@ namespace DiscImageChef.Commands errorByte = errorLba.error; } - if (!error) + if(!error) { - if (cmdDuration >= 500) + if(cmdDuration >= 500) { F += blocksToRead; } - else if (cmdDuration >= 150) + else if(cmdDuration >= 150) { E += blocksToRead; } - else if (cmdDuration >= 50) + else if(cmdDuration >= 50) { D += blocksToRead; } - else if (cmdDuration >= 10) + else if(cmdDuration >= 10) { C += blocksToRead; } - else if (cmdDuration >= 3) + else if(cmdDuration >= 3) { B += blocksToRead; } @@ -444,7 +444,7 @@ namespace DiscImageChef.Commands DicConsole.DebugWriteLine("Media-Scan", "ATA ERROR: {0} STATUS: {1}", errorByte, status); errored += blocksToRead; unreadableSectors.Add(i); - if (cmdDuration < 500) + if(cmdDuration < 500) mhddLog.Write(i, 65535); else mhddLog.Write(i, cmdDuration); @@ -460,23 +460,23 @@ namespace DiscImageChef.Commands mhddLog.Close(); ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalDuration / 1000), devicePath); - if (SeekLba) + if(SeekLba) { - for (int i = 0; i < seekTimes; i++) + for(int i = 0; i < seekTimes; i++) { - if (aborted) + if(aborted) break; seekPos = (uint)rnd.Next((int)blocks); DicConsole.Write("\rSeeking to sector {0}...\t\t", seekPos); - if (SeekLba) + if(SeekLba) dev.Seek(out errorLba, seekPos, timeout, out seekCur); - if (seekCur > seekMax && seekCur != 0) + if(seekCur > seekMax && seekCur != 0) seekMax = seekCur; - if (seekCur < seekMin && seekCur != 0) + if(seekCur < seekMin && seekCur != 0) seekMin = seekCur; seekTotal += seekCur; @@ -492,20 +492,20 @@ namespace DiscImageChef.Commands ulong currentBlock = 0; blocks = (ulong)(cylinders * heads * sectors); start = DateTime.UtcNow; - for (ushort Cy = 0; Cy < cylinders; Cy++) + for(ushort Cy = 0; Cy < cylinders; Cy++) { - for (byte Hd = 0; Hd < heads; Hd++) + for(byte Hd = 0; Hd < heads; Hd++) { - for (byte Sc = 1; Sc < sectors; Sc++) + for(byte Sc = 1; Sc < sectors; Sc++) { - if (aborted) + if(aborted) break; double cmdDuration = 0; - if (currentSpeed > maxSpeed && currentSpeed != 0) + if(currentSpeed > maxSpeed && currentSpeed != 0) maxSpeed = currentSpeed; - if (currentSpeed < minSpeed && currentSpeed != 0) + if(currentSpeed < minSpeed && currentSpeed != 0) minSpeed = currentSpeed; DicConsole.Write("\rReading cylinder {0} head {1} sector {2} ({3:F3} MiB/sec.)", Cy, Hd, Sc, currentSpeed); @@ -513,28 +513,28 @@ namespace DiscImageChef.Commands error = true; byte status = 0, errorByte = 0; - if (ReadDmaRetry) + if(ReadDmaRetry) { sense = dev.ReadDma(out cmdBuf, out errorChs, true, Cy, Hd, Sc, 1, timeout, out cmdDuration); error = !(!sense && (errorChs.status & 0x27) == 0 && errorChs.error == 0 && cmdBuf.Length > 0); status = errorChs.status; errorByte = errorChs.error; } - else if (ReadDma) + else if(ReadDma) { sense = dev.ReadDma(out cmdBuf, out errorChs, false, Cy, Hd, Sc, 1, timeout, out cmdDuration); error = !(!sense && (errorChs.status & 0x27) == 0 && errorChs.error == 0 && cmdBuf.Length > 0); status = errorChs.status; errorByte = errorChs.error; } - else if (ReadRetry) + else if(ReadRetry) { sense = dev.Read(out cmdBuf, out errorChs, true, Cy, Hd, Sc, 1, timeout, out cmdDuration); error = !(!sense && (errorChs.status & 0x27) == 0 && errorChs.error == 0 && cmdBuf.Length > 0); status = errorChs.status; errorByte = errorChs.error; } - else if (Read) + else if(Read) { sense = dev.Read(out cmdBuf, out errorChs, false, Cy, Hd, Sc, 1, timeout, out cmdDuration); error = !(!sense && (errorChs.status & 0x27) == 0 && errorChs.error == 0 && cmdBuf.Length > 0); @@ -542,25 +542,25 @@ namespace DiscImageChef.Commands errorByte = errorChs.error; } - if (!error) + if(!error) { - if (cmdDuration >= 500) + if(cmdDuration >= 500) { F += blocksToRead; } - else if (cmdDuration >= 150) + else if(cmdDuration >= 150) { E += blocksToRead; } - else if (cmdDuration >= 50) + else if(cmdDuration >= 50) { D += blocksToRead; } - else if (cmdDuration >= 10) + else if(cmdDuration >= 10) { C += blocksToRead; } - else if (cmdDuration >= 3) + else if(cmdDuration >= 3) { B += blocksToRead; } @@ -577,7 +577,7 @@ namespace DiscImageChef.Commands DicConsole.DebugWriteLine("Media-Scan", "ATA ERROR: {0} STATUS: {1}", errorByte, status); errored += blocksToRead; unreadableSectors.Add(currentBlock); - if (cmdDuration < 500) + if(cmdDuration < 500) mhddLog.Write(currentBlock, 65535); else mhddLog.Write(currentBlock, cmdDuration); @@ -597,11 +597,11 @@ namespace DiscImageChef.Commands mhddLog.Close(); ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024, (((double)blockSize * (double)(blocks + 1)) / 1024) / (totalDuration / 1000), devicePath); - if (Seek) + if(Seek) { - for (int i = 0; i < seekTimes; i++) + for(int i = 0; i < seekTimes; i++) { - if (aborted) + if(aborted) break; seekCy = (ushort)rnd.Next((int)cylinders); @@ -610,12 +610,12 @@ namespace DiscImageChef.Commands DicConsole.Write("\rSeeking to cylinder {0}, head {1}, sector {2}...\t\t", seekCy, seekHd, seekSc); - if (Seek) + if(Seek) dev.Seek(out errorChs, seekCy, seekHd, seekSc, timeout, out seekCur); - if (seekCur > seekMax && seekCur != 0) + if(seekCur > seekMax && seekCur != 0) seekMax = seekCur; - if (seekCur < seekMin && seekCur != 0) + if(seekCur < seekMin && seekCur != 0) seekMin = seekCur; seekTotal += seekCur; @@ -638,14 +638,14 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("{0} sectors took less than 500 ms but more than 150 ms.", E); DicConsole.WriteLine("{0} sectors took more than 500 ms.", F); DicConsole.WriteLine("{0} sectors could not be read.", unreadableSectors.Count); - if (unreadableSectors.Count > 0) + if(unreadableSectors.Count > 0) { - foreach (ulong bad in unreadableSectors) + foreach(ulong bad in unreadableSectors) DicConsole.WriteLine("Sector {0} could not be read", bad); } DicConsole.WriteLine(); - if (seekTotal != 0 || seekMin != double.MaxValue || seekMax != double.MinValue) + if(seekTotal != 0 || seekMin != double.MaxValue || seekMax != double.MinValue) DicConsole.WriteLine("Testing {0} seeks, longest seek took {1:F3} ms, fastest one took {2:F3} ms. ({3:F3} ms average)", seekTimes, seekMax, seekMin, seekTotal / 1000); @@ -675,49 +675,49 @@ namespace DiscImageChef.Commands uint blockSize = 0; ushort currentProfile = 0x0001; - if (dev.IsRemovable) + if(dev.IsRemovable) { sense = dev.ScsiTestUnitReady(out senseBuf, dev.Timeout, out duration); - if (sense) + if(sense) { Decoders.SCSI.FixedSense? decSense = Decoders.SCSI.Sense.DecodeFixed(senseBuf); - if (decSense.HasValue) + if(decSense.HasValue) { - if (decSense.Value.ASC == 0x3A) + if(decSense.Value.ASC == 0x3A) { int leftRetries = 5; - while (leftRetries > 0) + while(leftRetries > 0) { DicConsole.WriteLine("\rWaiting for drive to become ready"); System.Threading.Thread.Sleep(2000); sense = dev.ScsiTestUnitReady(out senseBuf, dev.Timeout, out duration); - if (!sense) + if(!sense) break; leftRetries--; } - if (sense) + if(sense) { DicConsole.ErrorWriteLine("Please insert media in drive"); return; } } - else if (decSense.Value.ASC == 0x04 && decSense.Value.ASCQ == 0x01) + else if(decSense.Value.ASC == 0x04 && decSense.Value.ASCQ == 0x01) { int leftRetries = 10; - while (leftRetries > 0) + while(leftRetries > 0) { DicConsole.WriteLine("\rWaiting for drive to become ready"); System.Threading.Thread.Sleep(2000); sense = dev.ScsiTestUnitReady(out senseBuf, dev.Timeout, out duration); - if (!sense) + if(!sense) break; leftRetries--; } - if (sense) + if(sense) { DicConsole.ErrorWriteLine("Error testing unit was ready:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); return; @@ -737,7 +737,7 @@ namespace DiscImageChef.Commands } } - if (dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.DirectAccess || + if(dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.DirectAccess || dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice || dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.OCRWDevice || dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.OpticalDevice || @@ -745,27 +745,27 @@ namespace DiscImageChef.Commands dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.WriteOnceDevice) { sense = dev.ReadCapacity(out cmdBuf, out senseBuf, dev.Timeout, out duration); - if (!sense) + if(!sense) { blocks = (ulong)((cmdBuf[0] << 24) + (cmdBuf[1] << 16) + (cmdBuf[2] << 8) + (cmdBuf[3])); blockSize = (uint)((cmdBuf[5] << 24) + (cmdBuf[5] << 16) + (cmdBuf[6] << 8) + (cmdBuf[7])); } - if (sense || blocks == 0xFFFFFFFF) + if(sense || blocks == 0xFFFFFFFF) { sense = dev.ReadCapacity16(out cmdBuf, out senseBuf, dev.Timeout, out duration); - if (sense && blocks == 0) + if(sense && blocks == 0) { // Not all MMC devices support READ CAPACITY, as they have READ TOC - if (dev.SCSIType != DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice) + if(dev.SCSIType != DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice) { DicConsole.ErrorWriteLine("Unable to get media capacity"); DicConsole.ErrorWriteLine("{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); } } - if (!sense) + if(!sense) { byte[] temp = new byte[8]; @@ -776,7 +776,7 @@ namespace DiscImageChef.Commands } } - if (blocks != 0 && blockSize != 0) + if(blocks != 0 && blockSize != 0) { blocks++; DicConsole.WriteLine("Media has {0} blocks of {1} bytes/each. (for a total of {2} bytes)", @@ -784,14 +784,14 @@ namespace DiscImageChef.Commands } } - if (dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess) + if(dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess) { DicConsole.WriteLine("Scanning will never be supported on SCSI Streaming Devices."); DicConsole.WriteLine("It has no sense to do it, and it will put too much strain on the tape."); return; - } + } - if (blocks == 0) + if(blocks == 0) { DicConsole.ErrorWriteLine("Unable to read medium or empty medium present..."); return; @@ -800,16 +800,16 @@ namespace DiscImageChef.Commands bool compactDisc = true; Decoders.CD.FullTOC.CDFullTOC? toc = null; - if (dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice) + if(dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice) { sense = dev.GetConfiguration(out cmdBuf, out senseBuf, 0, MmcGetConfigurationRt.Current, dev.Timeout, out duration); - if (!sense) + if(!sense) { Decoders.SCSI.MMC.Features.SeparatedFeatures ftr = Decoders.SCSI.MMC.Features.Separate(cmdBuf); currentProfile = ftr.CurrentProfile; - switch (ftr.CurrentProfile) + switch(ftr.CurrentProfile) { case 0x0005: case 0x0008: @@ -825,13 +825,13 @@ namespace DiscImageChef.Commands } } - if (compactDisc) + if(compactDisc) { currentProfile = 0x0008; // We discarded all discs that falsify a TOC before requesting a real TOC // No TOC, no CD (or an empty one) bool tocSense = dev.ReadRawToc(out cmdBuf, out senseBuf, 1, dev.Timeout, out duration); - if (!tocSense) + if(!tocSense) toc = Decoders.CD.FullTOC.Decode(cmdBuf); } } @@ -864,9 +864,9 @@ namespace DiscImageChef.Commands bool read6 = false, read10 = false, read12 = false, read16 = false, readcd; - if (compactDisc) + if(compactDisc) { - if (toc == null) + if(toc == null) { DicConsole.ErrorWriteLine("Error trying to decode TOC..."); return; @@ -875,26 +875,26 @@ namespace DiscImageChef.Commands readcd = !dev.ReadCd(out readBuffer, out senseBuf, 0, 2352, 1, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out duration); - if (readcd) + if(readcd) DicConsole.WriteLine("Using MMC READ CD command."); start = DateTime.UtcNow; - while (true) + while(true) { - if (readcd) + if(readcd) { sense = dev.ReadCd(out readBuffer, out senseBuf, 0, 2352, blocksToRead, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out duration); - if (dev.Error) + if(dev.Error) blocksToRead /= 2; } - if (!dev.Error || blocksToRead == 1) + if(!dev.Error || blocksToRead == 1) break; } - if (dev.Error) + if(dev.Error) { DicConsole.ErrorWriteLine("Device error {0} trying to guess ideal transfer length.", dev.LastError); return; @@ -905,49 +905,49 @@ namespace DiscImageChef.Commands mhddLog = new Core.MHDDLog(MHDDLogPath, dev, blocks, blockSize, blocksToRead); ibgLog = new Core.IBGLog(IBGLogPath, currentProfile); - for (ulong i = 0; i < blocks; i += blocksToRead) + for(ulong i = 0; i < blocks; i += blocksToRead) { - if (aborted) + if(aborted) break; double cmdDuration = 0; - if ((blocks - i) < blocksToRead) + if((blocks - i) < blocksToRead) blocksToRead = (uint)(blocks - i); - if (currentSpeed > maxSpeed && currentSpeed != 0) + if(currentSpeed > maxSpeed && currentSpeed != 0) maxSpeed = currentSpeed; - if (currentSpeed < minSpeed && currentSpeed != 0) + if(currentSpeed < minSpeed && currentSpeed != 0) minSpeed = currentSpeed; DicConsole.Write("\rReading sector {0} of {1} ({2:F3} MiB/sec.)", i, blocks, currentSpeed); - if (readcd) + if(readcd) { sense = dev.ReadCd(out readBuffer, out senseBuf, (uint)i, 2352, blocksToRead, MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out cmdDuration); totalDuration += cmdDuration; } - if (!sense) + if(!sense) { - if (cmdDuration >= 500) + if(cmdDuration >= 500) { F += blocksToRead; } - else if (cmdDuration >= 150) + else if(cmdDuration >= 150) { E += blocksToRead; } - else if (cmdDuration >= 50) + else if(cmdDuration >= 50) { D += blocksToRead; } - else if (cmdDuration >= 10) + else if(cmdDuration >= 10) { C += blocksToRead; } - else if (cmdDuration >= 3) + else if(cmdDuration >= 3) { B += blocksToRead; } @@ -964,22 +964,22 @@ namespace DiscImageChef.Commands DicConsole.DebugWriteLine("Media-Scan", "READ CD error:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); Decoders.SCSI.FixedSense? senseDecoded = Decoders.SCSI.Sense.DecodeFixed(senseBuf); - if (senseDecoded.HasValue) + if(senseDecoded.HasValue) { // TODO: This error happens when changing from track type afaik. Need to solve that more cleanly // LOGICAL BLOCK ADDRESS OUT OF RANGE - if ((senseDecoded.Value.ASC != 0x21 || senseDecoded.Value.ASCQ != 0x00) && + if((senseDecoded.Value.ASC != 0x21 || senseDecoded.Value.ASCQ != 0x00) && // ILLEGAL MODE FOR THIS TRACK (requesting sectors as-is, this is a firmware misconception when audio sectors // are in a track where subchannel indicates data) (senseDecoded.Value.ASC != 0x64 || senseDecoded.Value.ASCQ != 0x00)) { errored += blocksToRead; unreadableSectors.Add(i); - if (cmdDuration < 500) + if(cmdDuration < 500) mhddLog.Write(i, 65535); else mhddLog.Write(i, cmdDuration); - + ibgLog.Write(i, 0); } } @@ -987,11 +987,11 @@ namespace DiscImageChef.Commands { errored += blocksToRead; unreadableSectors.Add(i); - if (cmdDuration < 500) + if(cmdDuration < 500) mhddLog.Write(i, 65535); else mhddLog.Write(i, cmdDuration); - + ibgLog.Write(i, 0); } } @@ -1014,67 +1014,67 @@ namespace DiscImageChef.Commands read16 = !dev.Read16(out readBuffer, out senseBuf, 0, false, true, false, 0, blockSize, 0, 1, false, dev.Timeout, out duration); - if (!read6 && !read10 && !read12 && !read16) + if(!read6 && !read10 && !read12 && !read16) { DicConsole.ErrorWriteLine("Cannot read medium, aborting scan..."); return; } - if (read6 && !read10 && !read12 && !read16 && blocks > (0x001FFFFF + 1)) + if(read6 && !read10 && !read12 && !read16 && blocks > (0x001FFFFF + 1)) { DicConsole.ErrorWriteLine("Device only supports SCSI READ (6) but has more than {0} blocks ({1} blocks total)", 0x001FFFFF + 1, blocks); return; } - if (!read16 && blocks > ((long)0xFFFFFFFF + (long)1)) + if(!read16 && blocks > ((long)0xFFFFFFFF + (long)1)) { DicConsole.ErrorWriteLine("Device only supports SCSI READ (10) but has more than {0} blocks ({1} blocks total)", (long)0xFFFFFFFF + (long)1, blocks); return; } - if (read16) + if(read16) DicConsole.WriteLine("Using SCSI READ (16) command."); - else if (read12) + else if(read12) DicConsole.WriteLine("Using SCSI READ (12) command."); - else if (read10) + else if(read10) DicConsole.WriteLine("Using SCSI READ (10) command."); - else if (read6) + else if(read6) DicConsole.WriteLine("Using SCSI READ (6) command."); start = DateTime.UtcNow; - while (true) + while(true) { - if (read16) + if(read16) { sense = dev.Read16(out readBuffer, out senseBuf, 0, false, true, false, 0, blockSize, 0, blocksToRead, false, dev.Timeout, out duration); - if (dev.Error) + if(dev.Error) blocksToRead /= 2; } - else if (read12) + else if(read12) { sense = dev.Read12(out readBuffer, out senseBuf, 0, false, false, false, false, 0, blockSize, 0, blocksToRead, false, dev.Timeout, out duration); - if (dev.Error) + if(dev.Error) blocksToRead /= 2; } - else if (read10) + else if(read10) { sense = dev.Read10(out readBuffer, out senseBuf, 0, false, true, false, false, 0, blockSize, 0, (ushort)blocksToRead, dev.Timeout, out duration); - if (dev.Error) + if(dev.Error) blocksToRead /= 2; } - else if (read6) + else if(read6) { sense = dev.Read6(out readBuffer, out senseBuf, 0, blockSize, (byte)blocksToRead, dev.Timeout, out duration); - if (dev.Error) + if(dev.Error) blocksToRead /= 2; } - if (!dev.Error || blocksToRead == 1) + if(!dev.Error || blocksToRead == 1) break; } - if (dev.Error) + if(dev.Error) { DicConsole.ErrorWriteLine("Device error {0} trying to guess ideal transfer length.", dev.LastError); return; @@ -1085,55 +1085,55 @@ namespace DiscImageChef.Commands mhddLog = new Core.MHDDLog(MHDDLogPath, dev, blocks, blockSize, blocksToRead); ibgLog = new Core.IBGLog(IBGLogPath, currentProfile); - for (ulong i = 0; i < blocks; i += blocksToRead) + for(ulong i = 0; i < blocks; i += blocksToRead) { - if (aborted) + if(aborted) break; double cmdDuration = 0; - if ((blocks - i) < blocksToRead) + if((blocks - i) < blocksToRead) blocksToRead = (uint)(blocks - i); - if (currentSpeed > maxSpeed && currentSpeed != 0) + if(currentSpeed > maxSpeed && currentSpeed != 0) maxSpeed = currentSpeed; - if (currentSpeed < minSpeed && currentSpeed != 0) + if(currentSpeed < minSpeed && currentSpeed != 0) minSpeed = currentSpeed; DicConsole.Write("\rReading sector {0} of {1} ({2:F3} MiB/sec.)", i, blocks, currentSpeed); - if (read16) + if(read16) { sense = dev.Read16(out readBuffer, out senseBuf, 0, false, true, false, i, blockSize, 0, blocksToRead, false, dev.Timeout, out cmdDuration); totalDuration += cmdDuration; } - else if (read12) + else if(read12) { sense = dev.Read12(out readBuffer, out senseBuf, 0, false, false, false, false, (uint)i, blockSize, 0, blocksToRead, false, dev.Timeout, out cmdDuration); totalDuration += cmdDuration; } - else if (read10) + else if(read10) { sense = dev.Read10(out readBuffer, out senseBuf, 0, false, true, false, false, (uint)i, blockSize, 0, (ushort)blocksToRead, dev.Timeout, out cmdDuration); totalDuration += cmdDuration; } - else if (read6) + else if(read6) { sense = dev.Read6(out readBuffer, out senseBuf, (uint)i, blockSize, (byte)blocksToRead, dev.Timeout, out cmdDuration); totalDuration += cmdDuration; } - if (!sense && !dev.Error) + if(!sense && !dev.Error) { - if (cmdDuration >= 500) + if(cmdDuration >= 500) F += blocksToRead; - else if (cmdDuration >= 150) + else if(cmdDuration >= 150) E += blocksToRead; - else if (cmdDuration >= 50) + else if(cmdDuration >= 50) D += blocksToRead; - else if (cmdDuration >= 10) + else if(cmdDuration >= 10) C += blocksToRead; - else if (cmdDuration >= 3) + else if(cmdDuration >= 3) B += blocksToRead; else A += blocksToRead; @@ -1147,7 +1147,7 @@ namespace DiscImageChef.Commands errored += blocksToRead; unreadableSectors.Add(i); DicConsole.DebugWriteLine("Media-Scan", "READ error:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf)); - if (cmdDuration < 500) + if(cmdDuration < 500) mhddLog.Write(i, 65535); else mhddLog.Write(i, cmdDuration); @@ -1179,64 +1179,64 @@ namespace DiscImageChef.Commands uint seekPos = (uint)rnd.Next((int)blocks); - if (seek6) + if(seek6) { dev.Seek6(out senseBuf, seekPos, dev.Timeout, out seekCur); DicConsole.WriteLine("Using SCSI SEEK (6) command."); } - else if (seek10) + else if(seek10) { dev.Seek10(out senseBuf, seekPos, dev.Timeout, out seekCur); DicConsole.WriteLine("Using SCSI SEEK (10) command."); } else { - if (read16) + if(read16) DicConsole.WriteLine("Using SCSI READ (16) command for seeking."); - else if (read12) + else if(read12) DicConsole.WriteLine("Using SCSI READ (12) command for seeking."); - else if (read10) + else if(read10) DicConsole.WriteLine("Using SCSI READ (10) command for seeking."); - else if (read6) + else if(read6) DicConsole.WriteLine("Using SCSI READ (6) command for seeking."); } - for (int i = 0; i < seekTimes; i++) + for(int i = 0; i < seekTimes; i++) { - if (aborted) + if(aborted) break; - + seekPos = (uint)rnd.Next((int)blocks); DicConsole.Write("\rSeeking to sector {0}...\t\t", seekPos); - if (seek6) + if(seek6) dev.Seek6(out senseBuf, seekPos, dev.Timeout, out seekCur); - else if (seek10) + else if(seek10) dev.Seek10(out senseBuf, seekPos, dev.Timeout, out seekCur); else { - if (read16) + if(read16) { dev.Read16(out readBuffer, out senseBuf, 0, false, true, false, seekPos, blockSize, 0, 1, false, dev.Timeout, out seekCur); } - else if (read12) + else if(read12) { dev.Read12(out readBuffer, out senseBuf, 0, false, false, false, false, seekPos, blockSize, 0, 1, false, dev.Timeout, out seekCur); } - else if (read10) + else if(read10) { dev.Read10(out readBuffer, out senseBuf, 0, false, true, false, false, seekPos, blockSize, 0, (ushort)1, dev.Timeout, out seekCur); } - else if (read6) + else if(read6) { dev.Read6(out readBuffer, out senseBuf, seekPos, blockSize, 1, dev.Timeout, out seekCur); } } - if (seekCur > seekMax && seekCur != 0) + if(seekCur > seekMax && seekCur != 0) seekMax = seekCur; - if (seekCur < seekMin && seekCur != 0) + if(seekCur < seekMin && seekCur != 0) seekMin = seekCur; seekTotal += seekCur; @@ -1257,14 +1257,14 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("{0} sectors took less than 500 ms but more than 150 ms.", E); DicConsole.WriteLine("{0} sectors took more than 500 ms.", F); DicConsole.WriteLine("{0} sectors could not be read.", unreadableSectors.Count); - if (unreadableSectors.Count > 0) + if(unreadableSectors.Count > 0) { - foreach (ulong bad in unreadableSectors) + foreach(ulong bad in unreadableSectors) DicConsole.WriteLine("Sector {0} could not be read", bad); } DicConsole.WriteLine(); - if (seekTotal != 0 || seekMin != double.MaxValue || seekMax != double.MinValue) + if(seekTotal != 0 || seekMin != double.MaxValue || seekMax != double.MinValue) DicConsole.WriteLine("Testing {0} seeks, longest seek took {1:F3} ms, fastest one took {2:F3} ms. ({3:F3} ms average)", seekTimes, seekMax, seekMin, seekTotal / 1000); diff --git a/DiscImageChef/Commands/PrintHex.cs b/DiscImageChef/Commands/PrintHex.cs index d1ac56dff..f2e079df7 100644 --- a/DiscImageChef/Commands/PrintHex.cs +++ b/DiscImageChef/Commands/PrintHex.cs @@ -53,7 +53,7 @@ namespace DiscImageChef.Commands DicConsole.DebugWriteLine("PrintHex command", "--long-sectors={0}", options.LongSectors); DicConsole.DebugWriteLine("PrintHex command", "--WidthBytes={0}", options.WidthBytes); - if (!System.IO.File.Exists(options.InputFile)) + if(!System.IO.File.Exists(options.InputFile)) { DicConsole.ErrorWriteLine("Specified file does not exist."); return; @@ -61,7 +61,7 @@ namespace DiscImageChef.Commands ImagePlugin inputFormat = ImageFormat.Detect(options.InputFile); - if (inputFormat == null) + if(inputFormat == null) { DicConsole.ErrorWriteLine("Unable to recognize image format, not verifying"); return; @@ -74,21 +74,21 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Sector {0}", options.StartSector + i); byte[] sector; - if (inputFormat.ImageInfo.readableSectorTags == null) + if(inputFormat.ImageInfo.readableSectorTags == null) { DicConsole.WriteLine("Requested sectors with tags, unsupported by underlying image format, printing only user data."); options.LongSectors = false; } else { - if (inputFormat.ImageInfo.readableSectorTags.Count == 0) + if(inputFormat.ImageInfo.readableSectorTags.Count == 0) { DicConsole.WriteLine("Requested sectors with tags, unsupported by underlying image format, printing only user data."); options.LongSectors = false; } } - if (options.LongSectors) + if(options.LongSectors) sector = inputFormat.ReadSectorLong(options.StartSector + i); else sector = inputFormat.ReadSector(options.StartSector + i); diff --git a/DiscImageChef/Commands/Statistics.cs b/DiscImageChef/Commands/Statistics.cs index de2cd7b0c..04b24e1bc 100644 --- a/DiscImageChef/Commands/Statistics.cs +++ b/DiscImageChef/Commands/Statistics.cs @@ -52,39 +52,39 @@ namespace DiscImageChef.Commands bool thereAreStats = false; - if (Core.Statistics.AllStats.Commands != null) + if(Core.Statistics.AllStats.Commands != null) { DicConsole.WriteLine("Commands statistics"); DicConsole.WriteLine("==================="); - if (Core.Statistics.AllStats.Commands.Analyze > 0) + if(Core.Statistics.AllStats.Commands.Analyze > 0) DicConsole.WriteLine("You have called the Analyze command {0} times", Core.Statistics.AllStats.Commands.Analyze); - if (Core.Statistics.AllStats.Commands.Benchmark > 0) + if(Core.Statistics.AllStats.Commands.Benchmark > 0) DicConsole.WriteLine("You have called the Benchmark command {0} times", Core.Statistics.AllStats.Commands.Benchmark); - if (Core.Statistics.AllStats.Commands.Checksum > 0) + if(Core.Statistics.AllStats.Commands.Checksum > 0) DicConsole.WriteLine("You have called the Checksum command {0} times", Core.Statistics.AllStats.Commands.Checksum); - if (Core.Statistics.AllStats.Commands.Compare > 0) + if(Core.Statistics.AllStats.Commands.Compare > 0) DicConsole.WriteLine("You have called the Compare command {0} times", Core.Statistics.AllStats.Commands.Compare); - if (Core.Statistics.AllStats.Commands.CreateSidecar > 0) + if(Core.Statistics.AllStats.Commands.CreateSidecar > 0) DicConsole.WriteLine("You have called the Create-Sidecar command {0} times", Core.Statistics.AllStats.Commands.CreateSidecar); - if (Core.Statistics.AllStats.Commands.Decode > 0) + if(Core.Statistics.AllStats.Commands.Decode > 0) DicConsole.WriteLine("You have called the Decode command {0} times", Core.Statistics.AllStats.Commands.Decode); - if (Core.Statistics.AllStats.Commands.DeviceInfo > 0) + if(Core.Statistics.AllStats.Commands.DeviceInfo > 0) DicConsole.WriteLine("You have called the Device-Info command {0} times", Core.Statistics.AllStats.Commands.DeviceInfo); - if (Core.Statistics.AllStats.Commands.DeviceReport > 0) + if(Core.Statistics.AllStats.Commands.DeviceReport > 0) DicConsole.WriteLine("You have called the Device-Report command {0} times", Core.Statistics.AllStats.Commands.DeviceReport); - if (Core.Statistics.AllStats.Commands.DumpMedia > 0) + if(Core.Statistics.AllStats.Commands.DumpMedia > 0) DicConsole.WriteLine("You have called the Dump-Media command {0} times", Core.Statistics.AllStats.Commands.DumpMedia); - if (Core.Statistics.AllStats.Commands.Entropy > 0) + if(Core.Statistics.AllStats.Commands.Entropy > 0) DicConsole.WriteLine("You have called the Entropy command {0} times", Core.Statistics.AllStats.Commands.Entropy); - if (Core.Statistics.AllStats.Commands.Formats > 0) + if(Core.Statistics.AllStats.Commands.Formats > 0) DicConsole.WriteLine("You have called the Formats command {0} times", Core.Statistics.AllStats.Commands.Formats); - if (Core.Statistics.AllStats.Commands.MediaInfo > 0) + if(Core.Statistics.AllStats.Commands.MediaInfo > 0) DicConsole.WriteLine("You have called the Media-Info command {0} times", Core.Statistics.AllStats.Commands.MediaInfo); - if (Core.Statistics.AllStats.Commands.MediaScan > 0) + if(Core.Statistics.AllStats.Commands.MediaScan > 0) DicConsole.WriteLine("You have called the Media-Scan command {0} times", Core.Statistics.AllStats.Commands.MediaScan); - if (Core.Statistics.AllStats.Commands.PrintHex > 0) + if(Core.Statistics.AllStats.Commands.PrintHex > 0) DicConsole.WriteLine("You have called the Print-Hex command {0} times", Core.Statistics.AllStats.Commands.PrintHex); - if (Core.Statistics.AllStats.Commands.Verify > 0) + if(Core.Statistics.AllStats.Commands.Verify > 0) DicConsole.WriteLine("You have called the Verify command {0} times", Core.Statistics.AllStats.Commands.Verify); DicConsole.WriteLine(); thereAreStats = true; @@ -94,7 +94,7 @@ namespace DiscImageChef.Commands { DicConsole.WriteLine("Benchmark statistics"); DicConsole.WriteLine("===================="); - foreach (Core.ChecksumStats chk in Core.Statistics.AllStats.Benchmark.Checksum) + foreach(Core.ChecksumStats chk in Core.Statistics.AllStats.Benchmark.Checksum) { DicConsole.WriteLine("Took {0} seconds to calculate {1} algorithm", chk.Value, chk.algorithm); } @@ -107,53 +107,53 @@ namespace DiscImageChef.Commands thereAreStats = true; } - if (Core.Statistics.AllStats.MediaImages != null && Core.Statistics.AllStats.MediaImages.Count > 0) + if(Core.Statistics.AllStats.MediaImages != null && Core.Statistics.AllStats.MediaImages.Count > 0) { DicConsole.WriteLine("Media image statistics"); DicConsole.WriteLine("======================"); - foreach (Core.NameValueStats nvs in Core.Statistics.AllStats.MediaImages) + foreach(Core.NameValueStats nvs in Core.Statistics.AllStats.MediaImages) DicConsole.WriteLine("Format {0} has been found {1} times.", nvs.name, nvs.Value); DicConsole.WriteLine(); thereAreStats = true; } - if (Core.Statistics.AllStats.Partitions != null && Core.Statistics.AllStats.Partitions.Count > 0) + if(Core.Statistics.AllStats.Partitions != null && Core.Statistics.AllStats.Partitions.Count > 0) { DicConsole.WriteLine("Partition statistics"); DicConsole.WriteLine("===================="); - foreach (Core.NameValueStats nvs in Core.Statistics.AllStats.Partitions) + foreach(Core.NameValueStats nvs in Core.Statistics.AllStats.Partitions) DicConsole.WriteLine("Partitioning scheme {0} has been found {1} times.", nvs.name, nvs.Value); DicConsole.WriteLine(); thereAreStats = true; } - if (Core.Statistics.AllStats.Filesystems != null && Core.Statistics.AllStats.Filesystems.Count > 0) + if(Core.Statistics.AllStats.Filesystems != null && Core.Statistics.AllStats.Filesystems.Count > 0) { DicConsole.WriteLine("Filesystem statistics"); DicConsole.WriteLine("====================="); - foreach (Core.NameValueStats nvs in Core.Statistics.AllStats.Filesystems) + foreach(Core.NameValueStats nvs in Core.Statistics.AllStats.Filesystems) DicConsole.WriteLine("Filesystem {0} has been found {1} times.", nvs.name, nvs.Value); DicConsole.WriteLine(); thereAreStats = true; } - if (Core.Statistics.AllStats.Devices != null && Core.Statistics.AllStats.Devices.Count > 0) + if(Core.Statistics.AllStats.Devices != null && Core.Statistics.AllStats.Devices.Count > 0) { DicConsole.WriteLine("Device statistics"); DicConsole.WriteLine("================="); - foreach (Core.DeviceStats ds in Core.Statistics.AllStats.Devices) + foreach(Core.DeviceStats ds in Core.Statistics.AllStats.Devices) DicConsole.WriteLine("Device model {0}, manufactured by {1}, with revision {2} and attached via {3}.", ds.Model, ds.Manufacturer, ds.Revision, ds.Bus); DicConsole.WriteLine(); thereAreStats = true; } - if (Core.Statistics.AllStats.Medias != null && Core.Statistics.AllStats.Medias.Count > 0) + if(Core.Statistics.AllStats.Medias != null && Core.Statistics.AllStats.Medias.Count > 0) { DicConsole.WriteLine("Media statistics"); DicConsole.WriteLine("================"); - foreach (Core.MediaStats ms in Core.Statistics.AllStats.Medias) + foreach(Core.MediaStats ms in Core.Statistics.AllStats.Medias) { - if (ms.real) + if(ms.real) DicConsole.WriteLine("Media type {0} has been found {1} times in a real device.", ms.type, ms.Value); else DicConsole.WriteLine("Media type {0} has been found {1} times in a media image.", ms.type, ms.Value); @@ -162,7 +162,7 @@ namespace DiscImageChef.Commands thereAreStats = true; } - if (Core.Statistics.AllStats.MediaScan != null) + if(Core.Statistics.AllStats.MediaScan != null) { DicConsole.WriteLine("Media scan statistics"); DicConsole.WriteLine("====================="); @@ -178,7 +178,7 @@ namespace DiscImageChef.Commands thereAreStats = true; } - if (Core.Statistics.AllStats.Verify != null) + if(Core.Statistics.AllStats.Verify != null) { DicConsole.WriteLine("Verification statistics"); DicConsole.WriteLine("======================="); @@ -191,7 +191,7 @@ namespace DiscImageChef.Commands thereAreStats = true; } - if (!thereAreStats) + if(!thereAreStats) DicConsole.WriteLine("There are no statistics."); } } diff --git a/DiscImageChef/Commands/Verify.cs b/DiscImageChef/Commands/Verify.cs index 5fddcb3da..62d9dd94a 100644 --- a/DiscImageChef/Commands/Verify.cs +++ b/DiscImageChef/Commands/Verify.cs @@ -52,7 +52,7 @@ namespace DiscImageChef.Commands DicConsole.DebugWriteLine("Verify command", "--verify-disc={0}", options.VerifyDisc); DicConsole.DebugWriteLine("Verify command", "--verify-sectors={0}", options.VerifySectors); - if (!System.IO.File.Exists(options.InputFile)) + if(!System.IO.File.Exists(options.InputFile)) { DicConsole.ErrorWriteLine("Specified file does not exist."); return; @@ -60,7 +60,7 @@ namespace DiscImageChef.Commands ImagePlugin inputFormat = ImageFormat.Detect(options.InputFile); - if (inputFormat == null) + if(inputFormat == null) { DicConsole.ErrorWriteLine("Unable to recognize image format, not verifying"); return; @@ -76,7 +76,7 @@ namespace DiscImageChef.Commands long correctSectors = 0; long unknownSectors = 0; - if (options.VerifyDisc) + if(options.VerifyDisc) { DateTime StartCheck = DateTime.UtcNow; bool? discCheckStatus = inputFormat.VerifyMediaImage(); @@ -84,7 +84,7 @@ namespace DiscImageChef.Commands TimeSpan CheckTime = EndCheck - StartCheck; - switch (discCheckStatus) + switch(discCheckStatus) { case true: DicConsole.WriteLine("Disc image checksums are correct"); @@ -101,13 +101,13 @@ namespace DiscImageChef.Commands DicConsole.VerboseWriteLine("Checking disc image checksums took {0} seconds", CheckTime.TotalSeconds); } - if (options.VerifySectors) + if(options.VerifySectors) { bool formatHasTracks; try { List inputTracks = inputFormat.GetTracks(); - if (inputTracks.Count > 0) + if(inputTracks.Count > 0) formatHasTracks = true; else formatHasTracks = false; @@ -123,18 +123,18 @@ namespace DiscImageChef.Commands List UnknownLBAs = new List(); bool? checkStatus = null; - if (formatHasTracks) + if(formatHasTracks) { List inputTracks = inputFormat.GetTracks(); UInt64 currentSectorAll = 0; StartCheck = DateTime.UtcNow; - foreach (Track currentTrack in inputTracks) + foreach(Track currentTrack in inputTracks) { UInt64 remainingSectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector; UInt64 currentSector = 0; - while (remainingSectors > 0) + while(remainingSectors > 0) { DicConsole.Write("\rChecking sector {0} of {1}, on track {2}", currentSectorAll, inputFormat.GetSectors(), currentTrack.TrackSequence); @@ -142,27 +142,27 @@ namespace DiscImageChef.Commands List tempUnknownLBAs; bool? tempStatus; - if (remainingSectors < 512) + if(remainingSectors < 512) tempStatus = inputFormat.VerifySectors(currentSector, (uint)remainingSectors, currentTrack.TrackSequence, out tempFailingLBAs, out tempUnknownLBAs); else tempStatus = inputFormat.VerifySectors(currentSector, 512, currentTrack.TrackSequence, out tempFailingLBAs, out tempUnknownLBAs); - if (checkStatus == null || tempStatus == null) + if(checkStatus == null || tempStatus == null) checkStatus = null; - else if (checkStatus == false || tempStatus == false) + else if(checkStatus == false || tempStatus == false) checkStatus = false; - else if (checkStatus == true && tempStatus == true) + else if(checkStatus == true && tempStatus == true) checkStatus = true; else checkStatus = null; - foreach (UInt64 failLBA in tempFailingLBAs) + foreach(UInt64 failLBA in tempFailingLBAs) FailingLBAs.Add(failLBA); - foreach (UInt64 unknownLBA in tempUnknownLBAs) + foreach(UInt64 unknownLBA in tempUnknownLBAs) UnknownLBAs.Add(unknownLBA); - if (remainingSectors < 512) + if(remainingSectors < 512) { currentSector += remainingSectors; currentSectorAll += remainingSectors; @@ -185,7 +185,7 @@ namespace DiscImageChef.Commands UInt64 currentSector = 0; StartCheck = DateTime.UtcNow; - while (remainingSectors > 0) + while(remainingSectors > 0) { DicConsole.Write("\rChecking sector {0} of {1}", currentSector, inputFormat.GetSectors()); @@ -193,27 +193,27 @@ namespace DiscImageChef.Commands List tempUnknownLBAs; bool? tempStatus; - if (remainingSectors < 512) + if(remainingSectors < 512) tempStatus = inputFormat.VerifySectors(currentSector, (uint)remainingSectors, out tempFailingLBAs, out tempUnknownLBAs); else tempStatus = inputFormat.VerifySectors(currentSector, 512, out tempFailingLBAs, out tempUnknownLBAs); - if (checkStatus == null || tempStatus == null) + if(checkStatus == null || tempStatus == null) checkStatus = null; - else if (checkStatus == false || tempStatus == false) + else if(checkStatus == false || tempStatus == false) checkStatus = false; - else if (checkStatus == true && tempStatus == true) + else if(checkStatus == true && tempStatus == true) checkStatus = true; else checkStatus = null; - foreach (UInt64 failLBA in tempFailingLBAs) + foreach(UInt64 failLBA in tempFailingLBAs) FailingLBAs.Add(failLBA); - foreach (UInt64 unknownLBA in tempUnknownLBAs) + foreach(UInt64 unknownLBA in tempUnknownLBAs) UnknownLBAs.Add(unknownLBA); - if (remainingSectors < 512) + if(remainingSectors < 512) { currentSector += remainingSectors; remainingSectors = 0; @@ -232,7 +232,7 @@ namespace DiscImageChef.Commands DicConsole.Write("\r"); - switch (checkStatus) + switch(checkStatus) { case true: DicConsole.WriteLine("All sector checksums are correct"); @@ -247,20 +247,20 @@ namespace DiscImageChef.Commands DicConsole.VerboseWriteLine("Checking sector checksums took {0} seconds", CheckTime.TotalSeconds); - if (options.Verbose) + if(options.Verbose) { DicConsole.VerboseWriteLine("LBAs with error:"); - if (FailingLBAs.Count == (int)inputFormat.GetSectors()) + if(FailingLBAs.Count == (int)inputFormat.GetSectors()) DicConsole.VerboseWriteLine("\tall sectors."); else - for (int i = 0; i < FailingLBAs.Count; i++) + for(int i = 0; i < FailingLBAs.Count; i++) DicConsole.VerboseWriteLine("\t{0}", FailingLBAs[i]); DicConsole.WriteLine("LBAs without checksum:"); - if (UnknownLBAs.Count == (int)inputFormat.GetSectors()) + if(UnknownLBAs.Count == (int)inputFormat.GetSectors()) DicConsole.VerboseWriteLine("\tall sectors."); else - for (int i = 0; i < UnknownLBAs.Count; i++) + for(int i = 0; i < UnknownLBAs.Count; i++) DicConsole.VerboseWriteLine("\t{0}", UnknownLBAs[i]); } diff --git a/DiscImageChef/Core/Checksum.cs b/DiscImageChef/Core/Checksum.cs index 809286143..b95ef398a 100644 --- a/DiscImageChef/Core/Checksum.cs +++ b/DiscImageChef/Core/Checksum.cs @@ -84,41 +84,41 @@ namespace DiscImageChef.Core internal Checksum() { - adler32ctx = new Adler32Context(); - crc16ctx = new CRC16Context(); - crc32ctx = new CRC32Context(); - crc64ctx = new CRC64Context(); - md5ctx = new MD5Context(); - ripemd160ctx = new RIPEMD160Context(); - sha1ctx = new SHA1Context(); - sha256ctx = new SHA256Context(); - sha384ctx = new SHA384Context(); - sha512ctx = new SHA512Context(); - ssctx = new SpamSumContext(); + adler32ctx = new Adler32Context(); + crc16ctx = new CRC16Context(); + crc32ctx = new CRC32Context(); + crc64ctx = new CRC64Context(); + md5ctx = new MD5Context(); + ripemd160ctx = new RIPEMD160Context(); + sha1ctx = new SHA1Context(); + sha256ctx = new SHA256Context(); + sha384ctx = new SHA384Context(); + sha512ctx = new SHA512Context(); + ssctx = new SpamSumContext(); - adlerThread = new Thread(updateAdler); - crc16Thread = new Thread(updateCRC16); - crc32Thread = new Thread(updateCRC32); - crc64Thread = new Thread(updateCRC64); - md5Thread = new Thread(updateMD5); - ripemd160Thread = new Thread(updateRIPEMD160); - sha1Thread = new Thread(updateSHA1); - sha256Thread = new Thread(updateSHA256); - sha384Thread = new Thread(updateSHA384); - sha512Thread = new Thread(updateSHA512); - spamsumThread = new Thread(updateSpamSum); + adlerThread = new Thread(updateAdler); + crc16Thread = new Thread(updateCRC16); + crc32Thread = new Thread(updateCRC32); + crc64Thread = new Thread(updateCRC64); + md5Thread = new Thread(updateMD5); + ripemd160Thread = new Thread(updateRIPEMD160); + sha1Thread = new Thread(updateSHA1); + sha256Thread = new Thread(updateSHA256); + sha384Thread = new Thread(updateSHA384); + sha512Thread = new Thread(updateSHA512); + spamsumThread = new Thread(updateSpamSum); - adlerPkt = new adlerPacket(); - crc16Pkt = new crc16Packet(); - crc32Pkt = new crc32Packet(); - crc64Pkt = new crc64Packet(); - md5Pkt = new md5Packet(); - ripemd160Pkt = new ripemd160Packet(); - sha1Pkt = new sha1Packet(); - sha256Pkt = new sha256Packet(); - sha384Pkt = new sha384Packet(); - sha512Pkt = new sha512Packet(); - spamsumPkt = new spamsumPacket(); + adlerPkt = new adlerPacket(); + crc16Pkt = new crc16Packet(); + crc32Pkt = new crc32Packet(); + crc64Pkt = new crc64Packet(); + md5Pkt = new md5Packet(); + ripemd160Pkt = new ripemd160Packet(); + sha1Pkt = new sha1Packet(); + sha256Pkt = new sha256Packet(); + sha384Pkt = new sha384Packet(); + sha512Pkt = new sha512Packet(); + spamsumPkt = new spamsumPacket(); adler32ctx.Init(); adlerPkt.context = adler32ctx; @@ -146,49 +146,49 @@ namespace DiscImageChef.Core internal void Update(byte[] data) { - adlerPkt.data = data; - adlerThread.Start(adlerPkt); - crc16Pkt.data = data; - crc16Thread.Start(crc16Pkt); - crc32Pkt.data = data; - crc32Thread.Start(crc32Pkt); - crc64Pkt.data = data; - crc64Thread.Start(crc64Pkt); - md5Pkt.data = data; - md5Thread.Start(md5Pkt); - ripemd160Pkt.data = data; - ripemd160Thread.Start(ripemd160Pkt); - sha1Pkt.data = data; - sha1Thread.Start(sha1Pkt); - sha256Pkt.data = data; - sha256Thread.Start(sha256Pkt); - sha384Pkt.data = data; - sha384Thread.Start(sha384Pkt); - sha512Pkt.data = data; - sha512Thread.Start(sha512Pkt); - spamsumPkt.data = data; - spamsumThread.Start(spamsumPkt); + adlerPkt.data = data; + adlerThread.Start(adlerPkt); + crc16Pkt.data = data; + crc16Thread.Start(crc16Pkt); + crc32Pkt.data = data; + crc32Thread.Start(crc32Pkt); + crc64Pkt.data = data; + crc64Thread.Start(crc64Pkt); + md5Pkt.data = data; + md5Thread.Start(md5Pkt); + ripemd160Pkt.data = data; + ripemd160Thread.Start(ripemd160Pkt); + sha1Pkt.data = data; + sha1Thread.Start(sha1Pkt); + sha256Pkt.data = data; + sha256Thread.Start(sha256Pkt); + sha384Pkt.data = data; + sha384Thread.Start(sha384Pkt); + sha512Pkt.data = data; + sha512Thread.Start(sha512Pkt); + spamsumPkt.data = data; + spamsumThread.Start(spamsumPkt); - while (adlerThread.IsAlive || crc16Thread.IsAlive || - crc32Thread.IsAlive || crc64Thread.IsAlive || - md5Thread.IsAlive || ripemd160Thread.IsAlive || - sha1Thread.IsAlive || sha256Thread.IsAlive || - sha384Thread.IsAlive || sha512Thread.IsAlive || - spamsumThread.IsAlive) - { - } + while(adlerThread.IsAlive || crc16Thread.IsAlive || + crc32Thread.IsAlive || crc64Thread.IsAlive || + md5Thread.IsAlive || ripemd160Thread.IsAlive || + sha1Thread.IsAlive || sha256Thread.IsAlive || + sha384Thread.IsAlive || sha512Thread.IsAlive || + spamsumThread.IsAlive) + { + } - adlerThread = new Thread(updateAdler); - crc16Thread = new Thread(updateCRC16); - crc32Thread = new Thread(updateCRC32); - crc64Thread = new Thread(updateCRC64); - md5Thread = new Thread(updateMD5); - ripemd160Thread = new Thread(updateRIPEMD160); - sha1Thread = new Thread(updateSHA1); - sha256Thread = new Thread(updateSHA256); - sha384Thread = new Thread(updateSHA384); - sha512Thread = new Thread(updateSHA512); - spamsumThread = new Thread(updateSpamSum); + adlerThread = new Thread(updateAdler); + crc16Thread = new Thread(updateCRC16); + crc32Thread = new Thread(updateCRC32); + crc64Thread = new Thread(updateCRC64); + md5Thread = new Thread(updateMD5); + ripemd160Thread = new Thread(updateRIPEMD160); + sha1Thread = new Thread(updateSHA1); + sha256Thread = new Thread(updateSHA256); + sha384Thread = new Thread(updateSHA384); + sha512Thread = new Thread(updateSHA512); + spamsumThread = new Thread(updateSpamSum); } internal List End() @@ -337,7 +337,7 @@ namespace DiscImageChef.Core spamsumPktData.data = data; spamsumThreadData.Start(spamsumPktData); - while (adlerThreadData.IsAlive || crc16ThreadData.IsAlive || + while(adlerThreadData.IsAlive || crc16ThreadData.IsAlive || crc32ThreadData.IsAlive || crc64ThreadData.IsAlive || md5ThreadData.IsAlive || ripemd160ThreadData.IsAlive || sha1ThreadData.IsAlive || sha256ThreadData.IsAlive || diff --git a/DiscImageChef/Core/IBGLog.cs b/DiscImageChef/Core/IBGLog.cs index ddd880763..df2ecd2e9 100644 --- a/DiscImageChef/Core/IBGLog.cs +++ b/DiscImageChef/Core/IBGLog.cs @@ -61,7 +61,7 @@ namespace DiscImageChef.Core public IBGLog(string outputFile, ushort currentProfile) { - if (!string.IsNullOrEmpty(outputFile)) + if(!string.IsNullOrEmpty(outputFile)) { ibgFs = new FileStream(outputFile, FileMode.Create); ibgSb = new StringBuilder(); @@ -73,149 +73,149 @@ namespace DiscImageChef.Core ibgSnaps = 0; ibgIntSector = 0; - switch (currentProfile) + switch(currentProfile) { - case 0x0001: - ibgMediaType = "HDD"; - ibgDivider = 1353; - break; - case 0x0005: - ibgMediaType = "CD-MO"; - ibgDivider = 150; - break; - case 0x0008: - ibgMediaType = "CD-ROM"; - ibgDivider = 150; - break; - case 0x0009: - ibgMediaType = "CD-R"; - ibgDivider = 150; - break; - case 0x000A: - ibgMediaType = "CD-RW"; - ibgDivider = 150; - break; - case 0x0010: - ibgMediaType = "DVD-ROM"; - ibgDivider = 1353; - break; - case 0x0011: - ibgMediaType = "DVD-R"; - ibgDivider = 1353; - break; - case 0x0012: - ibgMediaType = "DVD-RAM"; - ibgDivider = 1353; - break; - case 0x0013: - case 0x0014: - ibgMediaType = "DVD-RW"; - ibgDivider = 1353; - break; - case 0x0015: - case 0x0016: - ibgMediaType = "DVD-R DL"; - ibgDivider = 1353; - break; - case 0x0017: - ibgMediaType = "DVD-RW DL"; - ibgDivider = 1353; - break; - case 0x0018: - ibgMediaType = "DVD-Download"; - ibgDivider = 1353; - break; - case 0x001A: - ibgMediaType = "DVD+RW"; - ibgDivider = 1353; - break; - case 0x001B: - ibgMediaType = "DVD+R"; - ibgDivider = 1353; - break; - case 0x0020: - ibgMediaType = "DDCD-ROM"; - ibgDivider = 150; - break; - case 0x0021: - ibgMediaType = "DDCD-R"; - ibgDivider = 150; - break; - case 0x0022: - ibgMediaType = "DDCD-RW"; - ibgDivider = 150; - break; - case 0x002A: - ibgMediaType = "DVD+RW DL"; - ibgDivider = 1353; - break; - case 0x002B: - ibgMediaType = "DVD+R DL"; - ibgDivider = 1353; - break; - case 0x0040: - ibgMediaType = "BD-ROM"; - ibgDivider = 4500; - break; - case 0x0041: - case 0x0042: - ibgMediaType = "BD-R"; - ibgDivider = 4500; - break; - case 0x0043: - ibgMediaType = "BD-RE"; - ibgDivider = 4500; - break; - case 0x0050: - ibgMediaType = "HD DVD-ROM"; - ibgDivider = 4500; - break; - case 0x0051: - ibgMediaType = "HD DVD-R"; - ibgDivider = 4500; - break; - case 0x0052: - ibgMediaType = "HD DVD-RAM"; - ibgDivider = 4500; - break; - case 0x0053: - ibgMediaType = "HD DVD-RW"; - ibgDivider = 4500; - break; - case 0x0058: - ibgMediaType = "HD DVD-R DL"; - ibgDivider = 4500; - break; - case 0x005A: - ibgMediaType = "HD DVD-RW DL"; - ibgDivider = 4500; - break; - default: - ibgMediaType = "Unknown"; - ibgDivider = 1353; - break; + case 0x0001: + ibgMediaType = "HDD"; + ibgDivider = 1353; + break; + case 0x0005: + ibgMediaType = "CD-MO"; + ibgDivider = 150; + break; + case 0x0008: + ibgMediaType = "CD-ROM"; + ibgDivider = 150; + break; + case 0x0009: + ibgMediaType = "CD-R"; + ibgDivider = 150; + break; + case 0x000A: + ibgMediaType = "CD-RW"; + ibgDivider = 150; + break; + case 0x0010: + ibgMediaType = "DVD-ROM"; + ibgDivider = 1353; + break; + case 0x0011: + ibgMediaType = "DVD-R"; + ibgDivider = 1353; + break; + case 0x0012: + ibgMediaType = "DVD-RAM"; + ibgDivider = 1353; + break; + case 0x0013: + case 0x0014: + ibgMediaType = "DVD-RW"; + ibgDivider = 1353; + break; + case 0x0015: + case 0x0016: + ibgMediaType = "DVD-R DL"; + ibgDivider = 1353; + break; + case 0x0017: + ibgMediaType = "DVD-RW DL"; + ibgDivider = 1353; + break; + case 0x0018: + ibgMediaType = "DVD-Download"; + ibgDivider = 1353; + break; + case 0x001A: + ibgMediaType = "DVD+RW"; + ibgDivider = 1353; + break; + case 0x001B: + ibgMediaType = "DVD+R"; + ibgDivider = 1353; + break; + case 0x0020: + ibgMediaType = "DDCD-ROM"; + ibgDivider = 150; + break; + case 0x0021: + ibgMediaType = "DDCD-R"; + ibgDivider = 150; + break; + case 0x0022: + ibgMediaType = "DDCD-RW"; + ibgDivider = 150; + break; + case 0x002A: + ibgMediaType = "DVD+RW DL"; + ibgDivider = 1353; + break; + case 0x002B: + ibgMediaType = "DVD+R DL"; + ibgDivider = 1353; + break; + case 0x0040: + ibgMediaType = "BD-ROM"; + ibgDivider = 4500; + break; + case 0x0041: + case 0x0042: + ibgMediaType = "BD-R"; + ibgDivider = 4500; + break; + case 0x0043: + ibgMediaType = "BD-RE"; + ibgDivider = 4500; + break; + case 0x0050: + ibgMediaType = "HD DVD-ROM"; + ibgDivider = 4500; + break; + case 0x0051: + ibgMediaType = "HD DVD-R"; + ibgDivider = 4500; + break; + case 0x0052: + ibgMediaType = "HD DVD-RAM"; + ibgDivider = 4500; + break; + case 0x0053: + ibgMediaType = "HD DVD-RW"; + ibgDivider = 4500; + break; + case 0x0058: + ibgMediaType = "HD DVD-R DL"; + ibgDivider = 4500; + break; + case 0x005A: + ibgMediaType = "HD DVD-RW DL"; + ibgDivider = 4500; + break; + default: + ibgMediaType = "Unknown"; + ibgDivider = 1353; + break; } } } public void Write(ulong sector, double currentSpeed) { - if (ibgFs != null) + if(ibgFs != null) { ibgIntSpeed += currentSpeed; ibgSampleRate += (int)Math.Floor((DateTime.Now - ibgDatePoint).TotalMilliseconds); ibgSnaps++; - if (ibgSampleRate >= 100) + if(ibgSampleRate >= 100) { - if (ibgIntSpeed > 0 && !ibgStartSet) + if(ibgIntSpeed > 0 && !ibgStartSet) { ibgStartSpeed = ibgIntSpeed / ibgSnaps / ibgDivider; ibgStartSet = true; } ibgSb.AppendFormat("{0:0.00},{1},{2:0},0", ibgIntSpeed / ibgSnaps / ibgDivider, ibgIntSector, ibgSampleRate).AppendLine(); - if ((ibgIntSpeed / ibgSnaps / ibgDivider) > ibgMaxSpeed) + if((ibgIntSpeed / ibgSnaps / ibgDivider) > ibgMaxSpeed) ibgMaxSpeed = ibgIntSpeed / ibgDivider; ibgDatePoint = DateTime.Now; @@ -229,14 +229,14 @@ namespace DiscImageChef.Core public void Close(Device dev, ulong blocks, ulong blockSize, double totalSeconds, double currentSpeed, double averageSpeed, string devicePath) { - if (ibgFs != null) + if(ibgFs != null) { StringBuilder ibgHeader = new StringBuilder(); string ibgBusType; - if (dev.IsUSB) + if(dev.IsUSB) ibgBusType = "USB"; - else if (dev.IsFireWire) + else if(dev.IsFireWire) ibgBusType = "FireWire"; else ibgBusType = dev.Type.ToString(); diff --git a/DiscImageChef/Core/MHDDLog.cs b/DiscImageChef/Core/MHDDLog.cs index 2cd224f8d..e6df4b6d0 100644 --- a/DiscImageChef/Core/MHDDLog.cs +++ b/DiscImageChef/Core/MHDDLog.cs @@ -48,7 +48,7 @@ namespace DiscImageChef.Core public MHDDLog(string outputFile, Device dev, ulong blocks, ulong blockSize, ulong blocksToRead) { - if (dev != null && !string.IsNullOrEmpty(outputFile)) + if(dev != null && !string.IsNullOrEmpty(outputFile)) { mhddFs = new FileStream(outputFile, FileMode.Create); @@ -61,27 +61,27 @@ namespace DiscImageChef.Core string scanblocksize; string ver; - switch (dev.Type) + switch(dev.Type) { - case DeviceType.ATA: - case DeviceType.ATAPI: - mode = "MODE: IDE"; - break; - case DeviceType.SCSI: - mode = "MODE: SCSI"; - break; - case DeviceType.MMC: - mode = "MODE: MMC"; - break; - case DeviceType.NVMe: - mode = "MODE: NVMe"; - break; - case DeviceType.SecureDigital: - mode = "MODE: SD"; - break; - default: - mode = "MODE: IDE"; - break; + case DeviceType.ATA: + case DeviceType.ATAPI: + mode = "MODE: IDE"; + break; + case DeviceType.SCSI: + mode = "MODE: SCSI"; + break; + case DeviceType.MMC: + mode = "MODE: MMC"; + break; + case DeviceType.NVMe: + mode = "MODE: NVMe"; + break; + case DeviceType.SecureDigital: + mode = "MODE: SD"; + break; + default: + mode = "MODE: IDE"; + break; } device = string.Format("DEVICE: {0} {1}", dev.Manufacturer, dev.Model); @@ -134,7 +134,7 @@ namespace DiscImageChef.Core public void Write(ulong sector, double duration) { - if (mhddFs != null) + if(mhddFs != null) { byte[] sectorBytes = BitConverter.GetBytes(sector); byte[] durationBytes = BitConverter.GetBytes((ulong)(duration * 1000)); @@ -146,7 +146,7 @@ namespace DiscImageChef.Core public void Close() { - if (mhddFs != null) + if(mhddFs != null) mhddFs.Close(); } } diff --git a/DiscImageChef/Core/Statistics.cs b/DiscImageChef/Core/Statistics.cs index b7fcce0c9..d280d84b5 100644 --- a/DiscImageChef/Core/Statistics.cs +++ b/DiscImageChef/Core/Statistics.cs @@ -171,7 +171,7 @@ namespace DiscImageChef.Core public static void LoadStats() { - if (File.Exists(Path.Combine(Settings.Settings.StatsPath, "Statistics.xml"))) + if(File.Exists(Path.Combine(Settings.Settings.StatsPath, "Statistics.xml"))) { AllStats = new Stats(); CurrentStats = new Stats(); @@ -181,7 +181,7 @@ namespace DiscImageChef.Core AllStats = (Stats)xs.Deserialize(sr); sr.Close(); } - else if (Settings.Settings.Current.Stats != null) + else if(Settings.Settings.Current.Stats != null) { AllStats = new Stats(); CurrentStats = new Stats(); @@ -195,14 +195,14 @@ namespace DiscImageChef.Core public static void SaveStats() { - if (AllStats != null) + if(AllStats != null) { FileStream fs = new FileStream(Path.Combine(Settings.Settings.StatsPath, "Statistics.xml"), FileMode.Create); XmlSerializer xs = new XmlSerializer(AllStats.GetType()); xs.Serialize(fs, AllStats); fs.Close(); - if (CurrentStats != null) + if(CurrentStats != null) { string partial = string.Format("PartialStats_{0:yyyyMMddHHmmssfff}.xml", DateTime.UtcNow); @@ -212,7 +212,7 @@ namespace DiscImageChef.Core fs.Close(); } - if (Settings.Settings.Current.Stats.ShareStats) + if(Settings.Settings.Current.Stats.ShareStats) SubmitStats(); } } @@ -224,93 +224,93 @@ namespace DiscImageChef.Core public static void AddCommand(string command) { - if (Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.DeviceStats) + if(Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.DeviceStats) { - if (AllStats.Commands == null) + if(AllStats.Commands == null) AllStats.Commands = new CommandsStats(); - if (CurrentStats.Commands == null) + if(CurrentStats.Commands == null) CurrentStats.Commands = new CommandsStats(); - switch (command) + switch(command) { - case "analyze": - AllStats.Commands.Analyze++; - CurrentStats.Commands.Analyze++; - break; - case "benchmark": - AllStats.Commands.Benchmark++; - CurrentStats.Commands.Benchmark++; - break; - case "checksum": - AllStats.Commands.Checksum++; - CurrentStats.Commands.Checksum++; - break; - case "compare": - AllStats.Commands.Compare++; - CurrentStats.Commands.Compare++; - break; - case "create-sidecar": - AllStats.Commands.CreateSidecar++; - CurrentStats.Commands.CreateSidecar++; - break; - case "decode": - AllStats.Commands.Decode++; - CurrentStats.Commands.Decode++; - break; - case "device-info": - AllStats.Commands.DeviceInfo++; - CurrentStats.Commands.DeviceInfo++; - break; - case "device-report": - AllStats.Commands.DeviceReport++; - CurrentStats.Commands.DeviceReport++; - break; - case "dump-media": - AllStats.Commands.DumpMedia++; - CurrentStats.Commands.DumpMedia++; - break; - case "entropy": - AllStats.Commands.Entropy++; - CurrentStats.Commands.Entropy++; - break; - case "formats": - AllStats.Commands.Formats++; - CurrentStats.Commands.Formats++; - break; - case "media-info": - AllStats.Commands.MediaInfo++; - CurrentStats.Commands.MediaInfo++; - break; - case "media-scan": - AllStats.Commands.MediaScan++; - CurrentStats.Commands.MediaScan++; - break; - case "print-hex": - AllStats.Commands.PrintHex++; - CurrentStats.Commands.PrintHex++; - break; - case "verify": - AllStats.Commands.Verify++; - CurrentStats.Commands.Verify++; - break; + case "analyze": + AllStats.Commands.Analyze++; + CurrentStats.Commands.Analyze++; + break; + case "benchmark": + AllStats.Commands.Benchmark++; + CurrentStats.Commands.Benchmark++; + break; + case "checksum": + AllStats.Commands.Checksum++; + CurrentStats.Commands.Checksum++; + break; + case "compare": + AllStats.Commands.Compare++; + CurrentStats.Commands.Compare++; + break; + case "create-sidecar": + AllStats.Commands.CreateSidecar++; + CurrentStats.Commands.CreateSidecar++; + break; + case "decode": + AllStats.Commands.Decode++; + CurrentStats.Commands.Decode++; + break; + case "device-info": + AllStats.Commands.DeviceInfo++; + CurrentStats.Commands.DeviceInfo++; + break; + case "device-report": + AllStats.Commands.DeviceReport++; + CurrentStats.Commands.DeviceReport++; + break; + case "dump-media": + AllStats.Commands.DumpMedia++; + CurrentStats.Commands.DumpMedia++; + break; + case "entropy": + AllStats.Commands.Entropy++; + CurrentStats.Commands.Entropy++; + break; + case "formats": + AllStats.Commands.Formats++; + CurrentStats.Commands.Formats++; + break; + case "media-info": + AllStats.Commands.MediaInfo++; + CurrentStats.Commands.MediaInfo++; + break; + case "media-scan": + AllStats.Commands.MediaScan++; + CurrentStats.Commands.MediaScan++; + break; + case "print-hex": + AllStats.Commands.PrintHex++; + CurrentStats.Commands.PrintHex++; + break; + case "verify": + AllStats.Commands.Verify++; + CurrentStats.Commands.Verify++; + break; } } } public static void AddFilesystem(string filesystem) { - if (Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.FilesystemStats) + if(Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.FilesystemStats) { - if (AllStats.Filesystems == null) + if(AllStats.Filesystems == null) AllStats.Filesystems = new List(); - if (CurrentStats.Filesystems == null) + if(CurrentStats.Filesystems == null) CurrentStats.Filesystems = new List(); NameValueStats old = null; - foreach (NameValueStats nvs in AllStats.Filesystems) + foreach(NameValueStats nvs in AllStats.Filesystems) { - if (nvs.name == filesystem) + if(nvs.name == filesystem) { old = nvs; break; @@ -318,7 +318,7 @@ namespace DiscImageChef.Core } NameValueStats nw = new NameValueStats(); - if (old != null) + if(old != null) { nw.name = old.name; nw.Value = old.Value + 1; @@ -332,9 +332,9 @@ namespace DiscImageChef.Core AllStats.Filesystems.Add(nw); old = null; - foreach (NameValueStats nvs in CurrentStats.Filesystems) + foreach(NameValueStats nvs in CurrentStats.Filesystems) { - if (nvs.name == filesystem) + if(nvs.name == filesystem) { old = nvs; break; @@ -342,7 +342,7 @@ namespace DiscImageChef.Core } nw = new NameValueStats(); - if (old != null) + if(old != null) { nw.name = old.name; nw.Value = old.Value + 1; @@ -359,17 +359,17 @@ namespace DiscImageChef.Core public static void AddPartition(string partition) { - if (Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.PartitionStats) + if(Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.PartitionStats) { - if (AllStats.Partitions == null) + if(AllStats.Partitions == null) AllStats.Partitions = new List(); - if (CurrentStats.Partitions == null) + if(CurrentStats.Partitions == null) CurrentStats.Partitions = new List(); NameValueStats old = null; - foreach (NameValueStats nvs in AllStats.Partitions) + foreach(NameValueStats nvs in AllStats.Partitions) { - if (nvs.name == partition) + if(nvs.name == partition) { old = nvs; break; @@ -377,7 +377,7 @@ namespace DiscImageChef.Core } NameValueStats nw = new NameValueStats(); - if (old != null) + if(old != null) { nw.name = old.name; nw.Value = old.Value + 1; @@ -391,9 +391,9 @@ namespace DiscImageChef.Core AllStats.Partitions.Add(nw); old = null; - foreach (NameValueStats nvs in CurrentStats.Partitions) + foreach(NameValueStats nvs in CurrentStats.Partitions) { - if (nvs.name == partition) + if(nvs.name == partition) { old = nvs; break; @@ -401,7 +401,7 @@ namespace DiscImageChef.Core } nw = new NameValueStats(); - if (old != null) + if(old != null) { nw.name = old.name; nw.Value = old.Value + 1; @@ -418,17 +418,17 @@ namespace DiscImageChef.Core public static void AddMediaFormat(string format) { - if (Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.MediaImageStats) + if(Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.MediaImageStats) { - if (AllStats.MediaImages == null) + if(AllStats.MediaImages == null) AllStats.MediaImages = new List(); - if (CurrentStats.MediaImages == null) + if(CurrentStats.MediaImages == null) CurrentStats.MediaImages = new List(); NameValueStats old = null; - foreach (NameValueStats nvs in AllStats.MediaImages) + foreach(NameValueStats nvs in AllStats.MediaImages) { - if (nvs.name == format) + if(nvs.name == format) { old = nvs; break; @@ -436,7 +436,7 @@ namespace DiscImageChef.Core } NameValueStats nw = new NameValueStats(); - if (old != null) + if(old != null) { nw.name = old.name; nw.Value = old.Value + 1; @@ -450,9 +450,9 @@ namespace DiscImageChef.Core AllStats.MediaImages.Add(nw); old = null; - foreach (NameValueStats nvs in CurrentStats.MediaImages) + foreach(NameValueStats nvs in CurrentStats.MediaImages) { - if (nvs.name == format) + if(nvs.name == format) { old = nvs; break; @@ -460,7 +460,7 @@ namespace DiscImageChef.Core } nw = new NameValueStats(); - if (old != null) + if(old != null) { nw.name = old.name; nw.Value = old.Value + 1; @@ -477,25 +477,25 @@ namespace DiscImageChef.Core public static void AddDevice(Devices.Device dev) { - if (Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.DeviceStats) + if(Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.DeviceStats) { - if (AllStats.Devices == null) + if(AllStats.Devices == null) AllStats.Devices = new List(); - if (CurrentStats.Devices == null) + if(CurrentStats.Devices == null) CurrentStats.Devices = new List(); string deviceBus; - if (dev.IsUSB) + if(dev.IsUSB) deviceBus = "USB"; - else if (dev.IsFireWire) + else if(dev.IsFireWire) deviceBus = "FireWire"; else deviceBus = dev.Type.ToString(); DeviceStats old = null; - foreach (DeviceStats ds in AllStats.Devices) + foreach(DeviceStats ds in AllStats.Devices) { - if (ds.Manufacturer == dev.Manufacturer && + if(ds.Manufacturer == dev.Manufacturer && ds.Model == dev.Model && ds.Revision == dev.Revision && ds.Bus == deviceBus) @@ -505,7 +505,7 @@ namespace DiscImageChef.Core } } - if (old != null) + if(old != null) AllStats.Devices.Remove(old); DeviceStats nw = new DeviceStats(); @@ -517,9 +517,9 @@ namespace DiscImageChef.Core AllStats.Devices.Add(nw); old = null; - foreach (DeviceStats ds in CurrentStats.Devices) + foreach(DeviceStats ds in CurrentStats.Devices) { - if (ds.Manufacturer == dev.Manufacturer && + if(ds.Manufacturer == dev.Manufacturer && ds.Model == dev.Model && ds.Revision == dev.Revision && ds.Bus == deviceBus) @@ -529,7 +529,7 @@ namespace DiscImageChef.Core } } - if (old != null) + if(old != null) CurrentStats.Devices.Remove(old); nw = new DeviceStats(); @@ -544,17 +544,17 @@ namespace DiscImageChef.Core public static void AddMedia(CommonTypes.MediaType type, bool real) { - if (Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.MediaStats) + if(Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.MediaStats) { - if (AllStats.Medias == null) + if(AllStats.Medias == null) AllStats.Medias = new List(); - if (CurrentStats.Medias == null) + if(CurrentStats.Medias == null) CurrentStats.Medias = new List(); MediaStats old = null; - foreach (MediaStats ms in AllStats.Medias) + foreach(MediaStats ms in AllStats.Medias) { - if (ms.real == real && ms.type == type.ToString()) + if(ms.real == real && ms.type == type.ToString()) { old = ms; break; @@ -562,7 +562,7 @@ namespace DiscImageChef.Core } MediaStats nw = new MediaStats(); - if (old != null) + if(old != null) { nw.type = old.type; nw.real = old.real; @@ -578,9 +578,9 @@ namespace DiscImageChef.Core AllStats.Medias.Add(nw); old = null; - foreach (MediaStats ms in CurrentStats.Medias) + foreach(MediaStats ms in CurrentStats.Medias) { - if (ms.real == real && ms.type == type.ToString()) + if(ms.real == real && ms.type == type.ToString()) { old = ms; break; @@ -588,7 +588,7 @@ namespace DiscImageChef.Core } nw = new MediaStats(); - if (old != null) + if(old != null) { nw.type = old.type; nw.real = old.real; @@ -607,14 +607,14 @@ namespace DiscImageChef.Core public static void AddBenchmark(Dictionary checksums, double entropy, double all, double sequential, long maxMemory, long minMemory) { - if (Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.BenchmarkStats) + if(Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.BenchmarkStats) { CurrentStats.Benchmark = new BenchmarkStats(); CurrentStats.Benchmark.Checksum = new List(); AllStats.Benchmark = new BenchmarkStats(); AllStats.Benchmark.Checksum = new List(); - foreach (KeyValuePair kvp in checksums) + foreach(KeyValuePair kvp in checksums) { ChecksumStats st = new ChecksumStats(); st.algorithm = kvp.Key; @@ -639,25 +639,25 @@ namespace DiscImageChef.Core public static void AddVerify(bool? mediaVerified, long correct, long failed, long unknown, long total) { - if (Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.VerifyStats) + if(Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.VerifyStats) { - if (CurrentStats.Verify == null) + if(CurrentStats.Verify == null) { CurrentStats.Verify = new VerifyStats(); CurrentStats.Verify.MediaImages = new VerifiedItems(); CurrentStats.Verify.Sectors = new ScannedSectors(); } - if (AllStats.Verify == null) + if(AllStats.Verify == null) { AllStats.Verify = new VerifyStats(); AllStats.Verify.MediaImages = new VerifiedItems(); AllStats.Verify.Sectors = new ScannedSectors(); } - if (mediaVerified.HasValue) + if(mediaVerified.HasValue) { - if (mediaVerified.Value) + if(mediaVerified.Value) { CurrentStats.Verify.MediaImages.Correct++; AllStats.Verify.MediaImages.Correct++; @@ -683,16 +683,16 @@ namespace DiscImageChef.Core public static void AddMediaScan(long lessThan3ms, long lessThan10ms, long lessThan50ms, long lessThan150ms, long lessThan500ms, long moreThan500ms, long total, long error, long correct) { - if (Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.MediaScanStats) + if(Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.MediaScanStats) { - if (CurrentStats.MediaScan == null) + if(CurrentStats.MediaScan == null) { CurrentStats.MediaScan = new MediaScanStats(); CurrentStats.MediaScan.Sectors = new ScannedSectors(); CurrentStats.MediaScan.Times = new TimeStats(); } - if (AllStats.MediaScan == null) + if(AllStats.MediaScan == null) { AllStats.MediaScan = new MediaScanStats(); AllStats.MediaScan.Sectors = new ScannedSectors();