diff --git a/DiscImageChef.Checksums/Adler32Context.cs b/DiscImageChef.Checksums/Adler32Context.cs
index 1d812cbeb..8a352aabc 100644
--- a/DiscImageChef.Checksums/Adler32Context.cs
+++ b/DiscImageChef.Checksums/Adler32Context.cs
@@ -39,7 +39,7 @@ namespace DiscImageChef.Checksums
public class Adler32Context
{
ushort sum1, sum2;
- const ushort AdlerModule = 65521;
+ const ushort ADLER_MODULE = 65521;
///
/// Initializes the Adler-32 sums
@@ -59,8 +59,8 @@ namespace DiscImageChef.Checksums
{
for(int i = 0; i < len; i++)
{
- sum1 = (ushort)((sum1 + data[i]) % AdlerModule);
- sum2 = (ushort)((sum2 + sum1) % AdlerModule);
+ sum1 = (ushort)((sum1 + data[i]) % ADLER_MODULE);
+ sum2 = (ushort)((sum2 + sum1) % ADLER_MODULE);
}
}
@@ -127,8 +127,8 @@ namespace DiscImageChef.Checksums
for(int i = 0; i < fileStream.Length; i++)
{
- localSum1 = (ushort)((localSum1 + fileStream.ReadByte()) % AdlerModule);
- localSum2 = (ushort)((localSum2 + localSum1) % AdlerModule);
+ localSum1 = (ushort)((localSum1 + fileStream.ReadByte()) % ADLER_MODULE);
+ localSum2 = (ushort)((localSum2 + localSum1) % ADLER_MODULE);
}
finalSum = (uint)((localSum2 << 16) | localSum1);
@@ -161,8 +161,8 @@ namespace DiscImageChef.Checksums
for(int i = 0; i < len; i++)
{
- localSum1 = (ushort)((localSum1 + data[i]) % AdlerModule);
- localSum2 = (ushort)((localSum2 + localSum1) % AdlerModule);
+ localSum1 = (ushort)((localSum1 + data[i]) % ADLER_MODULE);
+ localSum2 = (ushort)((localSum2 + localSum1) % ADLER_MODULE);
}
finalSum = (uint)((localSum2 << 16) | localSum1);
diff --git a/DiscImageChef.Checksums/CDChecksums.cs b/DiscImageChef.Checksums/CDChecksums.cs
index f94bdc679..173b73a60 100644
--- a/DiscImageChef.Checksums/CDChecksums.cs
+++ b/DiscImageChef.Checksums/CDChecksums.cs
@@ -36,14 +36,14 @@ using DiscImageChef.Console;
namespace DiscImageChef.Checksums
{
- public static class CDChecksums
+ public static class CdChecksums
{
- static byte[] ECC_F_Table;
- static byte[] ECC_B_Table;
- const uint CDCRC32Poly = 0xD8018001;
- const uint CDCRC32Seed = 0x00000000;
+ static byte[] eccFTable;
+ static byte[] eccBTable;
+ const uint CDCRC32_POLY = 0xD8018001;
+ const uint CDCRC32_SEED = 0x00000000;
- public static bool? CheckCDSector(byte[] buffer)
+ public static bool? CheckCdSector(byte[] buffer)
{
switch(buffer.Length)
{
@@ -55,8 +55,8 @@ namespace DiscImageChef.Checksums
Array.Copy(buffer, 0, channel, 0, 2352);
Array.Copy(buffer, 2352, subchannel, 0, 96);
- bool? channelStatus = CheckCDSectorChannel(channel);
- bool? subchannelStatus = CheckCDSectorSubChannel(subchannel);
+ bool? channelStatus = CheckCdSectorChannel(channel);
+ bool? subchannelStatus = CheckCdSectorSubChannel(subchannel);
bool? status = null;
if(channelStatus == null && subchannelStatus == null) status = null;
@@ -67,57 +67,57 @@ namespace DiscImageChef.Checksums
return status;
}
- case 2352: return CheckCDSectorChannel(buffer);
+ case 2352: return CheckCdSectorChannel(buffer);
default: return null;
}
}
- static void ECCInit()
+ static void EccInit()
{
- ECC_F_Table = new byte[256];
- ECC_B_Table = new byte[256];
+ eccFTable = new byte[256];
+ eccBTable = new byte[256];
for(uint i = 0; i < 256; i++)
{
uint j = (uint)((i << 1) ^ ((i & 0x80) == 0x80 ? 0x11D : 0));
- ECC_F_Table[i] = (byte)j;
- ECC_B_Table[i ^ j] = (byte)i;
+ eccFTable[i] = (byte)j;
+ eccBTable[i ^ j] = (byte)i;
}
}
- static bool CheckECC(byte[] address, byte[] data, uint major_count, uint minor_count, uint major_mult,
- uint minor_inc, byte[] ecc)
+ static bool CheckEcc(byte[] address, byte[] data, uint majorCount, uint minorCount, uint majorMult,
+ uint minorInc, byte[] ecc)
{
- uint size = major_count * minor_count;
+ uint size = majorCount * minorCount;
uint major;
- for(major = 0; major < major_count; major++)
+ for(major = 0; major < majorCount; major++)
{
- uint index = (major >> 1) * major_mult + (major & 1);
- byte ecc_a = 0;
- byte ecc_b = 0;
+ uint index = (major >> 1) * majorMult + (major & 1);
+ byte eccA = 0;
+ byte eccB = 0;
uint minor;
- for(minor = 0; minor < minor_count; minor++)
+ for(minor = 0; minor < minorCount; minor++)
{
byte temp;
if(index < 4) { temp = address[index]; }
else { temp = data[index - 4]; }
- index += minor_inc;
+ index += minorInc;
if(index >= size) { index -= size; }
- ecc_a ^= temp;
- ecc_b ^= temp;
- ecc_a = ECC_F_Table[ecc_a];
+ eccA ^= temp;
+ eccB ^= temp;
+ eccA = eccFTable[eccA];
}
- ecc_a = ECC_B_Table[ECC_F_Table[ecc_a] ^ ecc_b];
- if(ecc[major] != (ecc_a) || ecc[major + major_count] != (ecc_a ^ ecc_b)) { return false; }
+ eccA = eccBTable[eccFTable[eccA] ^ eccB];
+ if(ecc[major] != (eccA) || ecc[major + majorCount] != (eccA ^ eccB)) { return false; }
}
return true;
}
- static bool? CheckCDSectorChannel(byte[] channel)
+ static bool? CheckCdSectorChannel(byte[] channel)
{
- ECCInit();
+ EccInit();
if(channel[0x000] == 0x00 && // sync (12 bytes)
channel[0x001] == 0xFF && channel[0x002] == 0xFF && channel[0x003] == 0xFF && channel[0x004] == 0xFF &&
@@ -163,28 +163,28 @@ namespace DiscImageChef.Checksums
byte[] address = new byte[4];
byte[] data = new byte[2060];
byte[] data2 = new byte[2232];
- byte[] ecc_p = new byte[172];
- byte[] ecc_q = new byte[104];
+ byte[] eccP = new byte[172];
+ byte[] eccQ = new byte[104];
Array.Copy(channel, 0x0C, address, 0, 4);
Array.Copy(channel, 0x0C, data, 0, 2060);
Array.Copy(channel, 0x0C, data2, 0, 2232);
- Array.Copy(channel, 0x81C, ecc_p, 0, 172);
- Array.Copy(channel, 0x8C8, ecc_q, 0, 104);
+ Array.Copy(channel, 0x81C, eccP, 0, 172);
+ Array.Copy(channel, 0x8C8, eccQ, 0, 104);
- bool FailedECC_P = CheckECC(address, data, 86, 24, 2, 86, ecc_p);
- bool FailedECC_Q = CheckECC(address, data2, 52, 43, 86, 88, ecc_q);
+ bool failedEccP = CheckEcc(address, data, 86, 24, 2, 86, eccP);
+ bool failedEccQ = CheckEcc(address, data2, 52, 43, 86, 88, eccQ);
- if(FailedECC_P)
+ if(failedEccP)
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(failedEccQ)
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) return false;
+ if(failedEccP || failedEccQ) return false;
/* TODO: This is not working
byte[] SectorForCheck = new byte[0x810];
@@ -244,8 +244,8 @@ namespace DiscImageChef.Checksums
byte[] address = new byte[4];
byte[] data = new byte[2060];
byte[] data2 = new byte[2232];
- byte[] ecc_p = new byte[172];
- byte[] ecc_q = new byte[104];
+ byte[] eccP = new byte[172];
+ byte[] eccQ = new byte[104];
address[0] = 0;
address[1] = 0;
@@ -253,22 +253,22 @@ namespace DiscImageChef.Checksums
address[3] = 0;
Array.Copy(channel, 0x0C, data, 0, 2060);
Array.Copy(channel, 0x0C, data2, 0, 2232);
- Array.Copy(channel, 0x80C, ecc_p, 0, 172);
- Array.Copy(channel, 0x8B8, ecc_q, 0, 104);
+ Array.Copy(channel, 0x80C, eccP, 0, 172);
+ Array.Copy(channel, 0x8B8, eccQ, 0, 104);
- bool FailedECC_P = CheckECC(address, data, 86, 24, 2, 86, ecc_p);
- bool FailedECC_Q = CheckECC(address, data2, 52, 43, 86, 88, ecc_q);
+ bool failedEccP = CheckEcc(address, data, 86, 24, 2, 86, eccP);
+ bool failedEccQ = CheckEcc(address, data2, 52, 43, 86, 88, eccQ);
- if(FailedECC_P)
+ if(failedEccP)
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(failedEccQ)
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) return false;
+ if(failedEccP || failedEccQ) return false;
/* TODO: This is not working
byte[] SectorForCheck = new byte[0x808];
@@ -299,93 +299,93 @@ namespace DiscImageChef.Checksums
return null;
}
- static bool? CheckCDSectorSubChannel(byte[] subchannel)
+ static bool? CheckCdSectorSubChannel(byte[] subchannel)
{
bool? status = true;
- byte[] QSubChannel = new byte[12];
- byte[] CDTextPack1 = new byte[18];
- byte[] CDTextPack2 = new byte[18];
- byte[] CDTextPack3 = new byte[18];
- byte[] CDTextPack4 = new byte[18];
- byte[] CDSubRWPack1 = new byte[24];
- byte[] CDSubRWPack2 = new byte[24];
- byte[] CDSubRWPack3 = new byte[24];
- byte[] CDSubRWPack4 = new byte[24];
+ byte[] qSubChannel = new byte[12];
+ byte[] cdTextPack1 = new byte[18];
+ byte[] cdTextPack2 = new byte[18];
+ byte[] cdTextPack3 = new byte[18];
+ byte[] cdTextPack4 = new byte[18];
+ byte[] cdSubRwPack1 = new byte[24];
+ byte[] cdSubRwPack2 = new byte[24];
+ byte[] cdSubRwPack3 = new byte[24];
+ byte[] cdSubRwPack4 = new byte[24];
int i = 0;
- for(int j = 0; j < 12; j++) QSubChannel[j] = 0;
+ for(int j = 0; j < 12; j++) qSubChannel[j] = 0;
for(int j = 0; j < 18; j++)
{
- CDTextPack1[j] = 0;
- CDTextPack2[j] = 0;
- CDTextPack3[j] = 0;
- CDTextPack4[j] = 0;
+ cdTextPack1[j] = 0;
+ cdTextPack2[j] = 0;
+ cdTextPack3[j] = 0;
+ cdTextPack4[j] = 0;
}
for(int j = 0; j < 24; j++)
{
- CDSubRWPack1[j] = 0;
- CDSubRWPack2[j] = 0;
- CDSubRWPack3[j] = 0;
- CDSubRWPack4[j] = 0;
+ cdSubRwPack1[j] = 0;
+ cdSubRwPack2[j] = 0;
+ cdSubRwPack3[j] = 0;
+ cdSubRwPack4[j] = 0;
}
for(int j = 0; j < 12; j++)
{
- QSubChannel[j] = (byte)(QSubChannel[j] | ((subchannel[i++] & 0x40) << 1));
- QSubChannel[j] = (byte)(QSubChannel[j] | (subchannel[i++] & 0x40));
- QSubChannel[j] = (byte)(QSubChannel[j] | ((subchannel[i++] & 0x40) >> 1));
- QSubChannel[j] = (byte)(QSubChannel[j] | ((subchannel[i++] & 0x40) >> 2));
- QSubChannel[j] = (byte)(QSubChannel[j] | ((subchannel[i++] & 0x40) >> 3));
- QSubChannel[j] = (byte)(QSubChannel[j] | ((subchannel[i++] & 0x40) >> 4));
- QSubChannel[j] = (byte)(QSubChannel[j] | ((subchannel[i++] & 0x40) >> 5));
- QSubChannel[j] = (byte)(QSubChannel[j] | ((subchannel[i++] & 0x40) >> 6));
+ qSubChannel[j] = (byte)(qSubChannel[j] | ((subchannel[i++] & 0x40) << 1));
+ qSubChannel[j] = (byte)(qSubChannel[j] | (subchannel[i++] & 0x40));
+ qSubChannel[j] = (byte)(qSubChannel[j] | ((subchannel[i++] & 0x40) >> 1));
+ qSubChannel[j] = (byte)(qSubChannel[j] | ((subchannel[i++] & 0x40) >> 2));
+ qSubChannel[j] = (byte)(qSubChannel[j] | ((subchannel[i++] & 0x40) >> 3));
+ qSubChannel[j] = (byte)(qSubChannel[j] | ((subchannel[i++] & 0x40) >> 4));
+ qSubChannel[j] = (byte)(qSubChannel[j] | ((subchannel[i++] & 0x40) >> 5));
+ qSubChannel[j] = (byte)(qSubChannel[j] | ((subchannel[i++] & 0x40) >> 6));
}
i = 0;
for(int j = 0; j < 18; j++)
{
- if(j < 18) CDTextPack1[j] = (byte)(CDTextPack1[j] | ((subchannel[i++] & 0x3F) << 2));
- if(j < 18) CDTextPack1[j] = (byte)(CDTextPack1[j++] | ((subchannel[i] & 0xC0) >> 4));
- if(j < 18) CDTextPack1[j] = (byte)(CDTextPack1[j] | ((subchannel[i++] & 0x0F) << 4));
- if(j < 18) CDTextPack1[j] = (byte)(CDTextPack1[j++] | ((subchannel[i] & 0x3C) >> 2));
- if(j < 18) CDTextPack1[j] = (byte)(CDTextPack1[j] | ((subchannel[i++] & 0x03) << 6));
- if(j < 18) CDTextPack1[j] = (byte)(CDTextPack1[j] | (subchannel[i++] & 0x3F));
+ if(j < 18) cdTextPack1[j] = (byte)(cdTextPack1[j] | ((subchannel[i++] & 0x3F) << 2));
+ if(j < 18) cdTextPack1[j] = (byte)(cdTextPack1[j++] | ((subchannel[i] & 0xC0) >> 4));
+ if(j < 18) cdTextPack1[j] = (byte)(cdTextPack1[j] | ((subchannel[i++] & 0x0F) << 4));
+ if(j < 18) cdTextPack1[j] = (byte)(cdTextPack1[j++] | ((subchannel[i] & 0x3C) >> 2));
+ if(j < 18) cdTextPack1[j] = (byte)(cdTextPack1[j] | ((subchannel[i++] & 0x03) << 6));
+ if(j < 18) cdTextPack1[j] = (byte)(cdTextPack1[j] | (subchannel[i++] & 0x3F));
}
for(int j = 0; j < 18; j++)
{
- if(j < 18) CDTextPack2[j] = (byte)(CDTextPack2[j] | ((subchannel[i++] & 0x3F) << 2));
- if(j < 18) CDTextPack2[j] = (byte)(CDTextPack2[j++] | ((subchannel[i] & 0xC0) >> 4));
- if(j < 18) CDTextPack2[j] = (byte)(CDTextPack2[j] | ((subchannel[i++] & 0x0F) << 4));
- if(j < 18) CDTextPack2[j] = (byte)(CDTextPack2[j++] | ((subchannel[i] & 0x3C) >> 2));
- if(j < 18) CDTextPack2[j] = (byte)(CDTextPack2[j] | ((subchannel[i++] & 0x03) << 6));
- if(j < 18) CDTextPack2[j] = (byte)(CDTextPack2[j] | (subchannel[i++] & 0x3F));
+ if(j < 18) cdTextPack2[j] = (byte)(cdTextPack2[j] | ((subchannel[i++] & 0x3F) << 2));
+ if(j < 18) cdTextPack2[j] = (byte)(cdTextPack2[j++] | ((subchannel[i] & 0xC0) >> 4));
+ if(j < 18) cdTextPack2[j] = (byte)(cdTextPack2[j] | ((subchannel[i++] & 0x0F) << 4));
+ if(j < 18) cdTextPack2[j] = (byte)(cdTextPack2[j++] | ((subchannel[i] & 0x3C) >> 2));
+ if(j < 18) cdTextPack2[j] = (byte)(cdTextPack2[j] | ((subchannel[i++] & 0x03) << 6));
+ if(j < 18) cdTextPack2[j] = (byte)(cdTextPack2[j] | (subchannel[i++] & 0x3F));
}
for(int j = 0; j < 18; j++)
{
- if(j < 18) CDTextPack3[j] = (byte)(CDTextPack3[j] | ((subchannel[i++] & 0x3F) << 2));
- if(j < 18) CDTextPack3[j] = (byte)(CDTextPack3[j++] | ((subchannel[i] & 0xC0) >> 4));
- if(j < 18) CDTextPack3[j] = (byte)(CDTextPack3[j] | ((subchannel[i++] & 0x0F) << 4));
- if(j < 18) CDTextPack3[j] = (byte)(CDTextPack3[j++] | ((subchannel[i] & 0x3C) >> 2));
- if(j < 18) CDTextPack3[j] = (byte)(CDTextPack3[j] | ((subchannel[i++] & 0x03) << 6));
- if(j < 18) CDTextPack3[j] = (byte)(CDTextPack3[j] | (subchannel[i++] & 0x3F));
+ if(j < 18) cdTextPack3[j] = (byte)(cdTextPack3[j] | ((subchannel[i++] & 0x3F) << 2));
+ if(j < 18) cdTextPack3[j] = (byte)(cdTextPack3[j++] | ((subchannel[i] & 0xC0) >> 4));
+ if(j < 18) cdTextPack3[j] = (byte)(cdTextPack3[j] | ((subchannel[i++] & 0x0F) << 4));
+ if(j < 18) cdTextPack3[j] = (byte)(cdTextPack3[j++] | ((subchannel[i] & 0x3C) >> 2));
+ if(j < 18) cdTextPack3[j] = (byte)(cdTextPack3[j] | ((subchannel[i++] & 0x03) << 6));
+ if(j < 18) cdTextPack3[j] = (byte)(cdTextPack3[j] | (subchannel[i++] & 0x3F));
}
for(int j = 0; j < 18; j++)
{
- if(j < 18) CDTextPack4[j] = (byte)(CDTextPack4[j] | ((subchannel[i++] & 0x3F) << 2));
- if(j < 18) CDTextPack4[j] = (byte)(CDTextPack4[j++] | ((subchannel[i] & 0xC0) >> 4));
- if(j < 18) CDTextPack4[j] = (byte)(CDTextPack4[j] | ((subchannel[i++] & 0x0F) << 4));
- if(j < 18) CDTextPack4[j] = (byte)(CDTextPack4[j++] | ((subchannel[i] & 0x3C) >> 2));
- if(j < 18) CDTextPack4[j] = (byte)(CDTextPack4[j] | ((subchannel[i++] & 0x03) << 6));
- if(j < 18) CDTextPack4[j] = (byte)(CDTextPack4[j] | (subchannel[i++] & 0x3F));
+ if(j < 18) cdTextPack4[j] = (byte)(cdTextPack4[j] | ((subchannel[i++] & 0x3F) << 2));
+ if(j < 18) cdTextPack4[j] = (byte)(cdTextPack4[j++] | ((subchannel[i] & 0xC0) >> 4));
+ if(j < 18) cdTextPack4[j] = (byte)(cdTextPack4[j] | ((subchannel[i++] & 0x0F) << 4));
+ if(j < 18) cdTextPack4[j] = (byte)(cdTextPack4[j++] | ((subchannel[i] & 0x3C) >> 2));
+ if(j < 18) cdTextPack4[j] = (byte)(cdTextPack4[j] | ((subchannel[i++] & 0x03) << 6));
+ if(j < 18) cdTextPack4[j] = (byte)(cdTextPack4[j] | (subchannel[i++] & 0x3F));
}
i = 0;
- for(int j = 0; j < 24; j++) { CDSubRWPack1[j] = (byte)(subchannel[i++] & 0x3F); }
- for(int j = 0; j < 24; j++) { CDSubRWPack2[j] = (byte)(subchannel[i++] & 0x3F); }
- for(int j = 0; j < 24; j++) { CDSubRWPack3[j] = (byte)(subchannel[i++] & 0x3F); }
- for(int j = 0; j < 24; j++) { CDSubRWPack4[j] = (byte)(subchannel[i++] & 0x3F); }
+ for(int j = 0; j < 24; j++) { cdSubRwPack1[j] = (byte)(subchannel[i++] & 0x3F); }
+ for(int j = 0; j < 24; j++) { cdSubRwPack2[j] = (byte)(subchannel[i++] & 0x3F); }
+ for(int j = 0; j < 24; j++) { cdSubRwPack3[j] = (byte)(subchannel[i++] & 0x3F); }
+ 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");
@@ -411,87 +411,87 @@ namespace DiscImageChef.Checksums
default:
DicConsole.DebugWriteLine("CD checksums",
"Detected unknown Pack type in subchannel: mode {0}, item {1}",
- Convert.ToString(CDSubRWPack1[0] & 0x38, 2),
- Convert.ToString(CDSubRWPack1[0] & 0x07, 2));
+ Convert.ToString(cdSubRwPack1[0] & 0x38, 2),
+ Convert.ToString(cdSubRwPack1[0] & 0x07, 2));
break;
}
BigEndianBitConverter.IsLittleEndian = true;
- ushort QSubChannelCRC = BigEndianBitConverter.ToUInt16(QSubChannel, 10);
- byte[] QSubChannelForCRC = new byte[10];
- Array.Copy(QSubChannel, 0, QSubChannelForCRC, 0, 10);
- ushort CalculatedQCRC = CalculateCCITT_CRC16(QSubChannelForCRC);
+ ushort qSubChannelCrc = BigEndianBitConverter.ToUInt16(qSubChannel, 10);
+ byte[] qSubChannelForCrc = new byte[10];
+ Array.Copy(qSubChannel, 0, qSubChannelForCrc, 0, 10);
+ ushort 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);
+ calculatedQcrc, qSubChannelCrc);
status = false;
}
- if((CDTextPack1[0] & 0x80) == 0x80)
+ if((cdTextPack1[0] & 0x80) == 0x80)
{
- ushort CDTextPack1CRC = BigEndianBitConverter.ToUInt16(CDTextPack1, 16);
- byte[] CDTextPack1ForCRC = new byte[16];
- Array.Copy(CDTextPack1, 0, CDTextPack1ForCRC, 0, 16);
- ushort CalculatedCDTP1CRC = CalculateCCITT_CRC16(CDTextPack1ForCRC);
+ ushort cdTextPack1Crc = BigEndianBitConverter.ToUInt16(cdTextPack1, 16);
+ byte[] cdTextPack1ForCrc = new byte[16];
+ Array.Copy(cdTextPack1, 0, cdTextPack1ForCrc, 0, 16);
+ ushort 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);
+ cdTextPack1Crc, calculatedCdtp1Crc);
status = false;
}
}
- if((CDTextPack2[0] & 0x80) == 0x80)
+ if((cdTextPack2[0] & 0x80) == 0x80)
{
- ushort CDTextPack2CRC = BigEndianBitConverter.ToUInt16(CDTextPack2, 16);
- byte[] CDTextPack2ForCRC = new byte[16];
- Array.Copy(CDTextPack2, 0, CDTextPack2ForCRC, 0, 16);
- ushort CalculatedCDTP2CRC = CalculateCCITT_CRC16(CDTextPack2ForCRC);
- DicConsole.DebugWriteLine("CD checksums", "Cyclic CDTP2 0x{0:X4}, Calc CDTP2 0x{1:X4}", CDTextPack2CRC,
- CalculatedCDTP2CRC);
+ ushort cdTextPack2Crc = BigEndianBitConverter.ToUInt16(cdTextPack2, 16);
+ byte[] cdTextPack2ForCrc = new byte[16];
+ Array.Copy(cdTextPack2, 0, cdTextPack2ForCrc, 0, 16);
+ ushort 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);
+ cdTextPack2Crc, calculatedCdtp2Crc);
status = false;
}
}
- if((CDTextPack3[0] & 0x80) == 0x80)
+ if((cdTextPack3[0] & 0x80) == 0x80)
{
- ushort CDTextPack3CRC = BigEndianBitConverter.ToUInt16(CDTextPack3, 16);
- byte[] CDTextPack3ForCRC = new byte[16];
- Array.Copy(CDTextPack3, 0, CDTextPack3ForCRC, 0, 16);
- ushort CalculatedCDTP3CRC = CalculateCCITT_CRC16(CDTextPack3ForCRC);
- DicConsole.DebugWriteLine("CD checksums", "Cyclic CDTP3 0x{0:X4}, Calc CDTP3 0x{1:X4}", CDTextPack3CRC,
- CalculatedCDTP3CRC);
+ ushort cdTextPack3Crc = BigEndianBitConverter.ToUInt16(cdTextPack3, 16);
+ byte[] cdTextPack3ForCrc = new byte[16];
+ Array.Copy(cdTextPack3, 0, cdTextPack3ForCrc, 0, 16);
+ ushort 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);
+ cdTextPack3Crc, calculatedCdtp3Crc);
status = false;
}
}
- if((CDTextPack4[0] & 0x80) == 0x80)
+ if((cdTextPack4[0] & 0x80) == 0x80)
{
- ushort CDTextPack4CRC = BigEndianBitConverter.ToUInt16(CDTextPack4, 16);
- byte[] CDTextPack4ForCRC = new byte[16];
- Array.Copy(CDTextPack4, 0, CDTextPack4ForCRC, 0, 16);
- ushort CalculatedCDTP4CRC = CalculateCCITT_CRC16(CDTextPack4ForCRC);
- DicConsole.DebugWriteLine("CD checksums", "Cyclic CDTP4 0x{0:X4}, Calc CDTP4 0x{1:X4}", CDTextPack4CRC,
- CalculatedCDTP4CRC);
+ ushort cdTextPack4Crc = BigEndianBitConverter.ToUInt16(cdTextPack4, 16);
+ byte[] cdTextPack4ForCrc = new byte[16];
+ Array.Copy(cdTextPack4, 0, cdTextPack4ForCrc, 0, 16);
+ ushort 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);
+ cdTextPack4Crc, calculatedCdtp4Crc);
status = false;
}
}
@@ -499,7 +499,7 @@ namespace DiscImageChef.Checksums
return status;
}
- static readonly ushort[] CCITT_CRC16Table =
+ static readonly ushort[] CcittCrc16Table =
{
0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c,
0xd1ad, 0xe1ce, 0xf1ef, 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, 0x9339, 0x8318,
@@ -525,15 +525,15 @@ namespace DiscImageChef.Checksums
static ushort CalculateCCITT_CRC16(byte[] buffer)
{
- ushort CRC16 = 0;
+ ushort crc16 = 0;
for(int i = 0; i < buffer.Length; i++)
{
- CRC16 = (ushort)(CCITT_CRC16Table[(CRC16 >> 8) ^ buffer[i]] ^ (CRC16 << 8));
+ crc16 = (ushort)(CcittCrc16Table[(crc16 >> 8) ^ buffer[i]] ^ (crc16 << 8));
}
- CRC16 = (ushort)~CRC16;
+ crc16 = (ushort)~crc16;
- return CRC16;
+ return crc16;
}
}
}
\ No newline at end of file
diff --git a/DiscImageChef.Checksums/CRC16Context.cs b/DiscImageChef.Checksums/CRC16Context.cs
index fb853c74c..bbac567d9 100644
--- a/DiscImageChef.Checksums/CRC16Context.cs
+++ b/DiscImageChef.Checksums/CRC16Context.cs
@@ -39,10 +39,10 @@ namespace DiscImageChef.Checksums
///
/// Provides a UNIX similar API to calculate CRC16.
///
- public class CRC16Context
+ public class Crc16Context
{
- const ushort crc16Poly = 0xA001;
- const ushort crc16Seed = 0x0000;
+ const ushort CRC16_POLY = 0xA001;
+ const ushort CRC16_SEED = 0x0000;
ushort[] table;
ushort hashInt;
@@ -52,14 +52,14 @@ namespace DiscImageChef.Checksums
///
public void Init()
{
- hashInt = crc16Seed;
+ hashInt = CRC16_SEED;
table = new ushort[256];
for(int i = 0; i < 256; i++)
{
ushort entry = (ushort)i;
for(int j = 0; j < 8; j++)
- if((entry & 1) == 1) entry = (ushort)((entry >> 1) ^ crc16Poly);
+ if((entry & 1) == 1) entry = (ushort)((entry >> 1) ^ CRC16_POLY);
else entry = (ushort)(entry >> 1);
table[i] = entry;
@@ -90,7 +90,7 @@ namespace DiscImageChef.Checksums
///
public byte[] Final()
{
- hashInt ^= crc16Seed;
+ hashInt ^= CRC16_SEED;
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
return BigEndianBitConverter.GetBytes(hashInt);
}
@@ -100,7 +100,7 @@ namespace DiscImageChef.Checksums
///
public string End()
{
- hashInt ^= crc16Seed;
+ hashInt ^= CRC16_SEED;
StringBuilder crc16Output = new StringBuilder();
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
@@ -134,14 +134,14 @@ namespace DiscImageChef.Checksums
ushort[] localTable;
ushort localhashInt;
- localhashInt = crc16Seed;
+ localhashInt = CRC16_SEED;
localTable = new ushort[256];
for(int i = 0; i < 256; i++)
{
ushort entry = (ushort)i;
for(int j = 0; j < 8; j++)
- if((entry & 1) == 1) entry = (ushort)((entry >> 1) ^ crc16Poly);
+ if((entry & 1) == 1) entry = (ushort)((entry >> 1) ^ CRC16_POLY);
else entry = (ushort)(entry >> 1);
localTable[i] = entry;
@@ -170,7 +170,7 @@ namespace DiscImageChef.Checksums
/// Byte array of the hash value.
public static string Data(byte[] data, uint len, out byte[] hash)
{
- return Data(data, len, out hash, crc16Poly, crc16Seed);
+ return Data(data, len, out hash, CRC16_POLY, CRC16_SEED);
}
///
diff --git a/DiscImageChef.Checksums/CRC32Context.cs b/DiscImageChef.Checksums/CRC32Context.cs
index d99bc7c71..485880f0d 100644
--- a/DiscImageChef.Checksums/CRC32Context.cs
+++ b/DiscImageChef.Checksums/CRC32Context.cs
@@ -39,10 +39,10 @@ namespace DiscImageChef.Checksums
///
/// Provides a UNIX similar API to calculate CRC32.
///
- public class CRC32Context
+ public class Crc32Context
{
- const uint crc32Poly = 0xEDB88320;
- const uint crc32Seed = 0xFFFFFFFF;
+ const uint CRC32_POLY = 0xEDB88320;
+ const uint CRC32_SEED = 0xFFFFFFFF;
uint[] table;
uint hashInt;
@@ -52,14 +52,14 @@ namespace DiscImageChef.Checksums
///
public void Init()
{
- hashInt = crc32Seed;
+ hashInt = CRC32_SEED;
table = new uint[256];
for(int i = 0; i < 256; i++)
{
uint entry = (uint)i;
for(int j = 0; j < 8; j++)
- if((entry & 1) == 1) entry = (entry >> 1) ^ crc32Poly;
+ if((entry & 1) == 1) entry = (entry >> 1) ^ CRC32_POLY;
else entry = entry >> 1;
table[i] = entry;
@@ -90,7 +90,7 @@ namespace DiscImageChef.Checksums
///
public byte[] Final()
{
- hashInt ^= crc32Seed;
+ hashInt ^= CRC32_SEED;
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
return BigEndianBitConverter.GetBytes(hashInt);
}
@@ -100,7 +100,7 @@ namespace DiscImageChef.Checksums
///
public string End()
{
- hashInt ^= crc32Seed;
+ hashInt ^= CRC32_SEED;
StringBuilder crc32Output = new StringBuilder();
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
@@ -134,14 +134,14 @@ namespace DiscImageChef.Checksums
uint[] localTable;
uint localhashInt;
- localhashInt = crc32Seed;
+ localhashInt = CRC32_SEED;
localTable = new uint[256];
for(int i = 0; i < 256; i++)
{
uint entry = (uint)i;
for(int j = 0; j < 8; j++)
- if((entry & 1) == 1) entry = (entry >> 1) ^ crc32Poly;
+ if((entry & 1) == 1) entry = (entry >> 1) ^ CRC32_POLY;
else entry = entry >> 1;
localTable[i] = entry;
@@ -150,7 +150,7 @@ namespace DiscImageChef.Checksums
for(int i = 0; i < fileStream.Length; i++)
localhashInt = (localhashInt >> 8) ^ localTable[fileStream.ReadByte() ^ localhashInt & 0xff];
- localhashInt ^= crc32Seed;
+ localhashInt ^= CRC32_SEED;
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
hash = BigEndianBitConverter.GetBytes(localhashInt);
@@ -171,7 +171,7 @@ namespace DiscImageChef.Checksums
/// Byte array of the hash value.
public static string Data(byte[] data, uint len, out byte[] hash)
{
- return Data(data, len, out hash, crc32Poly, crc32Seed);
+ return Data(data, len, out hash, CRC32_POLY, CRC32_SEED);
}
///
@@ -202,7 +202,7 @@ namespace DiscImageChef.Checksums
for(int i = 0; i < len; i++) localhashInt = (localhashInt >> 8) ^ localTable[data[i] ^ localhashInt & 0xff];
- localhashInt ^= crc32Seed;
+ localhashInt ^= CRC32_SEED;
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
hash = BigEndianBitConverter.GetBytes(localhashInt);
diff --git a/DiscImageChef.Checksums/CRC64Context.cs b/DiscImageChef.Checksums/CRC64Context.cs
index cb17db0c4..c15ad5ebb 100644
--- a/DiscImageChef.Checksums/CRC64Context.cs
+++ b/DiscImageChef.Checksums/CRC64Context.cs
@@ -38,10 +38,10 @@ namespace DiscImageChef.Checksums
///
/// Provides a UNIX similar API to calculate CRC64 (ECMA).
///
- public class CRC64Context
+ public class Crc64Context
{
- const ulong crc64Poly = 0xC96C5795D7870F42;
- const ulong crc64Seed = 0xFFFFFFFFFFFFFFFF;
+ const ulong CRC64_POLY = 0xC96C5795D7870F42;
+ const ulong CRC64_SEED = 0xFFFFFFFFFFFFFFFF;
ulong[] table;
ulong hashInt;
@@ -51,14 +51,14 @@ namespace DiscImageChef.Checksums
///
public void Init()
{
- hashInt = crc64Seed;
+ hashInt = CRC64_SEED;
table = new ulong[256];
for(int i = 0; i < 256; i++)
{
ulong entry = (ulong)i;
for(int j = 0; j < 8; j++)
- if((entry & 1) == 1) entry = (entry >> 1) ^ crc64Poly;
+ if((entry & 1) == 1) entry = (entry >> 1) ^ CRC64_POLY;
else entry = entry >> 1;
table[i] = entry;
@@ -89,7 +89,7 @@ namespace DiscImageChef.Checksums
///
public byte[] Final()
{
- hashInt ^= crc64Seed;
+ hashInt ^= CRC64_SEED;
BigEndianBitConverter.IsLittleEndian = BigEndianBitConverter.IsLittleEndian;
return BigEndianBitConverter.GetBytes(hashInt);
}
@@ -99,7 +99,7 @@ namespace DiscImageChef.Checksums
///
public string End()
{
- hashInt ^= crc64Seed;
+ hashInt ^= CRC64_SEED;
StringBuilder crc64Output = new StringBuilder();
BigEndianBitConverter.IsLittleEndian = BigEndianBitConverter.IsLittleEndian;
@@ -133,14 +133,14 @@ namespace DiscImageChef.Checksums
ulong[] localTable;
ulong localhashInt;
- localhashInt = crc64Seed;
+ localhashInt = CRC64_SEED;
localTable = new ulong[256];
for(int i = 0; i < 256; i++)
{
ulong entry = (ulong)i;
for(int j = 0; j < 8; j++)
- if((entry & 1) == 1) entry = (entry >> 1) ^ crc64Poly;
+ if((entry & 1) == 1) entry = (entry >> 1) ^ CRC64_POLY;
else entry = entry >> 1;
localTable[i] = entry;
@@ -149,7 +149,7 @@ namespace DiscImageChef.Checksums
for(int i = 0; i < fileStream.Length; i++)
localhashInt = (localhashInt >> 8) ^ localTable[(ulong)fileStream.ReadByte() ^ localhashInt & 0xffL];
- localhashInt ^= crc64Seed;
+ localhashInt ^= CRC64_SEED;
BigEndianBitConverter.IsLittleEndian = BigEndianBitConverter.IsLittleEndian;
hash = BigEndianBitConverter.GetBytes(localhashInt);
@@ -170,7 +170,7 @@ namespace DiscImageChef.Checksums
/// Byte array of the hash value.
public static string Data(byte[] data, uint len, out byte[] hash)
{
- return Data(data, len, out hash, crc64Poly, crc64Seed);
+ return Data(data, len, out hash, CRC64_POLY, CRC64_SEED);
}
///
@@ -201,7 +201,7 @@ namespace DiscImageChef.Checksums
for(int i = 0; i < len; i++) localhashInt = (localhashInt >> 8) ^ localTable[data[i] ^ localhashInt & 0xff];
- localhashInt ^= crc64Seed;
+ localhashInt ^= CRC64_SEED;
BigEndianBitConverter.IsLittleEndian = BigEndianBitConverter.IsLittleEndian;
hash = BigEndianBitConverter.GetBytes(localhashInt);
diff --git a/DiscImageChef.Checksums/MD5Context.cs b/DiscImageChef.Checksums/MD5Context.cs
index 678986103..0e49ea3f8 100644
--- a/DiscImageChef.Checksums/MD5Context.cs
+++ b/DiscImageChef.Checksums/MD5Context.cs
@@ -39,16 +39,16 @@ namespace DiscImageChef.Checksums
///
/// Provides a UNIX similar API to .NET MD5.
///
- public class MD5Context
+ public class Md5Context
{
- MD5 _md5Provider;
+ MD5 md5Provider;
///
/// Initializes the MD5 hash provider
///
public void Init()
{
- _md5Provider = MD5.Create();
+ md5Provider = MD5.Create();
}
///
@@ -58,7 +58,7 @@ namespace DiscImageChef.Checksums
/// Length of buffer to hash.
public void Update(byte[] data, uint len)
{
- _md5Provider.TransformBlock(data, 0, (int)len, data, 0);
+ md5Provider.TransformBlock(data, 0, (int)len, data, 0);
}
///
@@ -75,8 +75,8 @@ namespace DiscImageChef.Checksums
///
public byte[] Final()
{
- _md5Provider.TransformFinalBlock(new byte[0], 0, 0);
- return _md5Provider.Hash;
+ md5Provider.TransformFinalBlock(new byte[0], 0, 0);
+ return md5Provider.Hash;
}
///
@@ -84,10 +84,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++) { md5Output.Append(_md5Provider.Hash[i].ToString("x2")); }
+ for(int i = 0; i < md5Provider.Hash.Length; i++) { md5Output.Append(md5Provider.Hash[i].ToString("x2")); }
return md5Output.ToString();
}
@@ -99,7 +99,7 @@ namespace DiscImageChef.Checksums
public byte[] File(string filename)
{
FileStream fileStream = new FileStream(filename, FileMode.Open);
- byte[] result = _md5Provider.ComputeHash(fileStream);
+ byte[] result = md5Provider.ComputeHash(fileStream);
fileStream.Close();
return result;
}
@@ -112,7 +112,7 @@ namespace DiscImageChef.Checksums
public string File(string filename, out byte[] hash)
{
FileStream fileStream = new FileStream(filename, FileMode.Open);
- hash = _md5Provider.ComputeHash(fileStream);
+ hash = md5Provider.ComputeHash(fileStream);
StringBuilder md5Output = new StringBuilder();
for(int i = 0; i < hash.Length; i++) { md5Output.Append(hash[i].ToString("x2")); }
@@ -130,7 +130,7 @@ namespace DiscImageChef.Checksums
/// Byte array of the hash value.
public string Data(byte[] data, uint len, out byte[] hash)
{
- hash = _md5Provider.ComputeHash(data, 0, (int)len);
+ hash = md5Provider.ComputeHash(data, 0, (int)len);
StringBuilder md5Output = new StringBuilder();
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 60028593c..b261ecd7f 100644
--- a/DiscImageChef.Checksums/RIPEMD160Context.cs
+++ b/DiscImageChef.Checksums/RIPEMD160Context.cs
@@ -39,16 +39,16 @@ namespace DiscImageChef.Checksums
///
/// Provides a UNIX similar API to .NET RIPEMD160.
///
- public class RIPEMD160Context
+ public class Ripemd160Context
{
- RIPEMD160 _ripemd160Provider;
+ RIPEMD160 ripemd160Provider;
///
/// Initializes the RIPEMD160 hash provider
///
public void Init()
{
- _ripemd160Provider = RIPEMD160.Create();
+ ripemd160Provider = RIPEMD160.Create();
}
///
@@ -58,7 +58,7 @@ namespace DiscImageChef.Checksums
/// Length of buffer to hash.
public void Update(byte[] data, uint len)
{
- _ripemd160Provider.TransformBlock(data, 0, (int)len, data, 0);
+ ripemd160Provider.TransformBlock(data, 0, (int)len, data, 0);
}
///
@@ -75,8 +75,8 @@ namespace DiscImageChef.Checksums
///
public byte[] Final()
{
- _ripemd160Provider.TransformFinalBlock(new byte[0], 0, 0);
- return _ripemd160Provider.Hash;
+ ripemd160Provider.TransformFinalBlock(new byte[0], 0, 0);
+ return ripemd160Provider.Hash;
}
///
@@ -84,12 +84,12 @@ namespace DiscImageChef.Checksums
///
public string End()
{
- _ripemd160Provider.TransformFinalBlock(new byte[0], 0, 0);
+ 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"));
+ ripemd160Output.Append(ripemd160Provider.Hash[i].ToString("x2"));
}
return ripemd160Output.ToString();
@@ -102,7 +102,7 @@ namespace DiscImageChef.Checksums
public byte[] File(string filename)
{
FileStream fileStream = new FileStream(filename, FileMode.Open);
- byte[] result = _ripemd160Provider.ComputeHash(fileStream);
+ byte[] result = ripemd160Provider.ComputeHash(fileStream);
fileStream.Close();
return result;
}
@@ -115,7 +115,7 @@ namespace DiscImageChef.Checksums
public string File(string filename, out byte[] hash)
{
FileStream fileStream = new FileStream(filename, FileMode.Open);
- hash = _ripemd160Provider.ComputeHash(fileStream);
+ hash = ripemd160Provider.ComputeHash(fileStream);
StringBuilder ripemd160Output = new StringBuilder();
for(int i = 0; i < hash.Length; i++) { ripemd160Output.Append(hash[i].ToString("x2")); }
@@ -133,7 +133,7 @@ namespace DiscImageChef.Checksums
/// Byte array of the hash value.
public string Data(byte[] data, uint len, out byte[] hash)
{
- hash = _ripemd160Provider.ComputeHash(data, 0, (int)len);
+ hash = ripemd160Provider.ComputeHash(data, 0, (int)len);
StringBuilder ripemd160Output = new StringBuilder();
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 e85384dfd..12cb5e08d 100644
--- a/DiscImageChef.Checksums/ReedSolomon.cs
+++ b/DiscImageChef.Checksums/ReedSolomon.cs
@@ -67,21 +67,21 @@ namespace DiscImageChef.Checksums
/* Primitive polynomials - see Lin & Costello, Error Control Coding Appendix A,
* and Lee & Messerschmitt, Digital Communication p. 453.
*/
- int[] Pp;
+ int[] pp;
/* index->polynomial form conversion table */
- int[] Alpha_to;
+ int[] alpha_to;
/* Polynomial->index form conversion table */
- int[] Index_of;
+ int[] index_of;
/* Generator polynomial g(x)
* Degree of g(x) = 2*TT
* has roots @**B0, @**(B0+1), ... ,@^(B0+2*TT-1)
*/
- int[] Gg;
- int MM, KK, NN;
+ int[] gg;
+ int mm, kk, nn;
/* No legal value in index form represents zero, so
* we need a special value for this purpose
*/
- int A0;
+ int a0;
bool initialized;
/* Alpha exponent for the first root of the generator polynomial */
const int B0 = 1;
@@ -89,66 +89,66 @@ namespace DiscImageChef.Checksums
///
/// Initializes the Reed-Solomon with RS(n,k) with GF(2^m)
///
- public void InitRS(int n, int k, int m)
+ public void InitRs(int n, int k, int 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(nameof(m), "m must be between 2 and 16 inclusive");
}
- MM = m;
- KK = k;
- NN = n;
- A0 = n;
- Alpha_to = new int[n + 1];
- Index_of = new int[n + 1];
+ mm = m;
+ kk = k;
+ nn = n;
+ a0 = n;
+ alpha_to = new int[n + 1];
+ index_of = new int[n + 1];
- Gg = new int[NN - KK + 1];
+ gg = new int[nn - kk + 1];
generate_gf();
gen_poly();
@@ -156,35 +156,35 @@ namespace DiscImageChef.Checksums
initialized = true;
}
- int modnn(int x)
+ int Modnn(int x)
{
- while(x >= NN)
+ while(x >= nn)
{
- x -= NN;
- x = (x >> MM) + (x & NN);
+ x -= nn;
+ x = (x >> mm) + (x & nn);
}
return x;
}
- static int min(int a, int b)
+ static int Min(int a, int b)
{
return ((a) < (b) ? (a) : (b));
}
- static void CLEAR(ref int[] a, int n)
+ static void Clear(ref int[] a, int n)
{
int ci;
for(ci = (n) - 1; ci >= 0; ci--) (a)[ci] = 0;
}
- static void COPY(ref int[] a, ref int[] b, int n)
+ static void Copy(ref int[] a, ref int[] b, int n)
{
int ci;
for(ci = (n) - 1; ci >= 0; ci--) (a)[ci] = (b)[ci];
}
- static void COPYDOWN(ref int[] a, ref int[] b, int n)
+ static void Copydown(ref int[] a, ref int[] b, int n)
{
int ci;
for(ci = (n) - 1; ci >= 0; ci--) (a)[ci] = (b)[ci];
@@ -225,32 +225,32 @@ namespace DiscImageChef.Checksums
int i, mask;
mask = 1;
- Alpha_to[MM] = 0;
- for(i = 0; i < MM; i++)
+ alpha_to[mm] = 0;
+ for(i = 0; i < mm; i++)
{
- Alpha_to[i] = mask;
- Index_of[Alpha_to[i]] = 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) Alpha_to[MM] ^= mask; /* Bit-wise EXOR operation */
+ if(pp[i] != 0) alpha_to[mm] ^= mask; /* Bit-wise EXOR operation */
mask <<= 1; /* single left-shift */
}
- Index_of[Alpha_to[MM]] = MM;
+ index_of[alpha_to[mm]] = mm;
/*
* Have obtained poly-repr of @^MM. Poly-repr of @^(i+1) is given by
* poly-repr of @^i shifted left one-bit and accounting for any @^MM
* 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) Alpha_to[i] = Alpha_to[MM] ^ ((Alpha_to[i - 1] ^ mask) << 1);
- else Alpha_to[i] = Alpha_to[i - 1] << 1;
- Index_of[Alpha_to[i]] = i;
+ 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;
+ index_of[alpha_to[i]] = i;
}
- Index_of[0] = A0;
- Alpha_to[NN] = 0;
+ index_of[0] = a0;
+ alpha_to[nn] = 0;
}
/*
@@ -270,23 +270,23 @@ namespace DiscImageChef.Checksums
{
int i, j;
- Gg[0] = Alpha_to[B0];
- Gg[1] = 1; /* g(x) = (X+@**B0) initially */
- for(i = 2; i <= NN - KK; i++)
+ gg[0] = alpha_to[B0];
+ gg[1] = 1; /* g(x) = (X+@**B0) initially */
+ for(i = 2; i <= nn - kk; i++)
{
- Gg[i] = 1;
+ 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) Gg[j] = Gg[j - 1] ^ Alpha_to[modnn((Index_of[Gg[j]]) + B0 + i - 1)];
- else Gg[j] = Gg[j - 1];
+ 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];
/* Gg[0] can never be zero */
- Gg[0] = Alpha_to[modnn((Index_of[Gg[0]]) + B0 + i - 1)];
+ 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++) Gg[i] = Index_of[Gg[i]];
+ for(i = 0; i <= nn - kk; i++) gg[i] = index_of[gg[i]];
}
/*
@@ -309,28 +309,28 @@ namespace DiscImageChef.Checksums
{
int i, j;
int feedback;
- bb = new int[NN - KK];
+ bb = new int[nn - kk];
- CLEAR(ref bb, NN - KK);
- for(i = KK - 1; i >= 0; i--)
+ Clear(ref bb, nn - kk);
+ for(i = kk - 1; i >= 0; i--)
{
- if(MM != 8) { if(data[i] > NN) return -1; /* Illegal symbol */ }
+ if(mm != 8) { if(data[i] > nn) return -1; /* Illegal symbol */ }
- feedback = Index_of[data[i] ^ bb[NN - KK - 1]];
- if(feedback != A0)
+ feedback = index_of[data[i] ^ bb[nn - kk - 1]];
+ if(feedback != a0)
{
/* feedback term is non-zero */
- for(j = NN - KK - 1; j > 0; j--)
- if(Gg[j] != A0) bb[j] = bb[j - 1] ^ Alpha_to[modnn(Gg[j] + feedback)];
+ 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];
- bb[0] = Alpha_to[modnn(Gg[0] + feedback)];
+ bb[0] = alpha_to[Modnn(gg[0] + feedback)];
}
else
{
/* feedback term is zero. encoder becomes a
* single-byte shifter */
- for(j = NN - KK - 1; j > 0; j--) bb[j] = bb[j - 1];
+ for(j = nn - kk - 1; j > 0; j--) bb[j] = bb[j - 1];
bb[0] = 0;
}
@@ -360,52 +360,52 @@ namespace DiscImageChef.Checksums
///
/// Returns corrected symbols, -1 if illegal or uncorrectable
/// Data symbols.
- /// Position of erasures.
- /// Number of erasures.
- public int eras_dec_rs(ref int[] data, out int[] eras_pos, int no_eras)
+ /// Position of erasures.
+ /// Number of erasures.
+ public int eras_dec_rs(ref int[] data, out int[] erasPos, int noEras)
{
if(initialized)
{
- eras_pos = new int[NN - KK];
- int deg_lambda, el, deg_omega;
+ erasPos = new int[nn - kk];
+ int degLambda, el, degOmega;
int i, j, r;
- int u, q, tmp, num1, num2, den, discr_r;
- int[] recd = new int[NN];
- int[] lambda = new int[NN - KK + 1]; /* Err+Eras Locator poly */
- int[] s = new int[NN - KK + 1]; /* syndrome poly */
- int[] b = new int[NN - KK + 1];
- int[] t = new int[NN - KK + 1];
- int[] omega = new int[NN - KK + 1];
- int[] root = new int[NN - KK];
- int[] reg = new int[NN - KK + 1];
- int[] loc = new int[NN - KK];
- int syn_error, count;
+ int u, q, tmp, num1, num2, den, discrR;
+ int[] recd = new int[nn];
+ int[] lambda = new int[nn - kk + 1]; /* Err+Eras Locator poly */
+ int[] s = new int[nn - kk + 1]; /* syndrome poly */
+ int[] b = new int[nn - kk + 1];
+ int[] t = new int[nn - kk + 1];
+ int[] omega = new int[nn - kk + 1];
+ int[] root = new int[nn - kk];
+ int[] reg = new int[nn - kk + 1];
+ int[] loc = new int[nn - kk];
+ int synError, 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(data[i] > NN) return -1; /* Illegal symbol */ }
+ if(mm != 8) { if(data[i] > nn) return -1; /* Illegal symbol */ }
- recd[i] = Index_of[data[i]];
+ recd[i] = index_of[data[i]];
}
/* first form the syndromes; i.e., evaluate recd(x) at roots of g(x)
* namely @**(B0+i), i = 0, ... ,(NN-KK-1)
*/
- syn_error = 0;
- for(i = 1; i <= NN - KK; i++)
+ synError = 0;
+ for(i = 1; i <= nn - kk; i++)
{
tmp = 0;
- 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)];
+ 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 =>
+ synError |= tmp; /* set flag if non-zero syndrome =>
* error */
/* store syndrome in index form */
- s[i] = Index_of[tmp];
+ s[i] = index_of[tmp];
}
- if(syn_error == 0)
+ if(synError == 0)
{
/*
* if syndrome is zero, data[] is a codeword and there are no
@@ -414,35 +414,35 @@ namespace DiscImageChef.Checksums
return 0;
}
- CLEAR(ref lambda, NN - KK);
+ Clear(ref lambda, nn - kk);
lambda[0] = 1;
- if(no_eras > 0)
+ if(noEras > 0)
{
/* Init lambda to be the erasure locator polynomial */
- lambda[1] = Alpha_to[eras_pos[0]];
- for(i = 1; i < no_eras; i++)
+ lambda[1] = alpha_to[erasPos[0]];
+ for(i = 1; i < noEras; i++)
{
- u = eras_pos[i];
+ u = erasPos[i];
for(j = i + 1; j > 0; j--)
{
- tmp = Index_of[lambda[j - 1]];
- if(tmp != A0) lambda[j] ^= Alpha_to[modnn(u + tmp)];
+ tmp = index_of[lambda[j - 1]];
+ if(tmp != a0) lambda[j] ^= alpha_to[Modnn(u + tmp)];
}
}
#if DEBUG
/* find roots of the erasure location polynomial */
- for(i = 1; i <= no_eras; i++) reg[i] = Index_of[lambda[i]];
+ for(i = 1; i <= noEras; 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 <= noEras; j++)
+ if(reg[j] != a0)
{
- reg[j] = modnn(reg[j] + j);
- q ^= Alpha_to[reg[j]];
+ reg[j] = Modnn(reg[j] + j);
+ q ^= alpha_to[reg[j]];
}
if(q == 0)
@@ -451,12 +451,12 @@ namespace DiscImageChef.Checksums
* number indices
*/
root[count] = i;
- loc[count] = NN - i;
+ loc[count] = nn - i;
count++;
}
}
- if(count != no_eras)
+ if(count != noEras)
{
DicConsole.DebugWriteLine("Reed Solomon", "\n lambda(x) is WRONG\n");
return -1;
@@ -470,95 +470,95 @@ namespace DiscImageChef.Checksums
#endif
}
- for(i = 0; i < NN - KK + 1; i++) b[i] = Index_of[lambda[i]];
+ for(i = 0; i < nn - kk + 1; i++) b[i] = index_of[lambda[i]];
/*
* Begin Berlekamp-Massey algorithm to determine error+erasure
* locator polynomial
*/
- r = no_eras;
- el = no_eras;
- while(++r <= NN - KK)
+ r = noEras;
+ el = noEras;
+ while(++r <= nn - kk)
{
/* r is the step number */
/* Compute discrepancy at the r-th step in poly-form */
- discr_r = 0;
+ discrR = 0;
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])];
+ discrR ^= alpha_to[Modnn(index_of[lambda[i]] + s[r - i])];
}
}
- discr_r = Index_of[discr_r]; /* Index form */
- if(discr_r == A0)
+ discrR = index_of[discrR]; /* Index form */
+ if(discrR == a0)
{
/* 2 lines below: B(x) <-- x*B(x) */
- COPYDOWN(ref b, ref b, NN - KK);
- b[0] = A0;
+ Copydown(ref b, ref b, nn - kk);
+ b[0] = a0;
}
else
{
/* 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) t[i + 1] = lambda[i + 1] ^ Alpha_to[modnn(discr_r + b[i])];
+ if(b[i] != a0) t[i + 1] = lambda[i + 1] ^ alpha_to[Modnn(discrR + b[i])];
else t[i + 1] = lambda[i + 1];
}
- if(2 * el <= r + no_eras - 1)
+ if(2 * el <= r + noEras - 1)
{
- el = r + no_eras - el;
+ el = r + noEras - el;
/*
* 2 lines below: B(x) <-- inv(discr_r) *
* lambda(x)
*/
- for(i = 0; i <= NN - KK; i++)
- b[i] = (lambda[i] == 0) ? A0 : modnn(Index_of[lambda[i]] - discr_r + NN);
+ for(i = 0; i <= nn - kk; i++)
+ b[i] = (lambda[i] == 0) ? a0 : Modnn(index_of[lambda[i]] - discrR + nn);
}
else
{
/* 2 lines below: B(x) <-- x*B(x) */
- COPYDOWN(ref b, ref b, NN - KK);
- b[0] = A0;
+ Copydown(ref b, ref b, nn - kk);
+ b[0] = a0;
}
- COPY(ref lambda, ref t, NN - KK + 1);
+ Copy(ref lambda, ref t, nn - kk + 1);
}
}
/* Convert lambda to index form and compute deg(lambda(x)) */
- deg_lambda = 0;
- for(i = 0; i < NN - KK + 1; i++)
+ degLambda = 0;
+ for(i = 0; i < nn - kk + 1; i++)
{
- lambda[i] = Index_of[lambda[i]];
- if(lambda[i] != A0) deg_lambda = i;
+ lambda[i] = index_of[lambda[i]];
+ if(lambda[i] != a0) degLambda = i;
}
/*
* Find roots of the error+erasure locator polynomial. By Chien
* Search
*/
int temp = reg[0];
- COPY(ref reg, ref lambda, NN - KK);
+ 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 = degLambda; j > 0; j--)
+ if(reg[j] != a0)
{
- reg[j] = modnn(reg[j] + j);
- q ^= Alpha_to[reg[j]];
+ reg[j] = Modnn(reg[j] + j);
+ q ^= alpha_to[reg[j]];
}
if(q == 0)
{
/* store root (index-form) and error location number */
root[count] = i;
- loc[count] = NN - i;
+ loc[count] = nn - i;
count++;
}
}
@@ -570,7 +570,7 @@ namespace DiscImageChef.Checksums
DicConsole.DebugWriteLine("Reed Solomon", "\n");
#endif
- if(deg_lambda != count)
+ if(degLambda != count)
{
/*
* deg(lambda) unequal to number of roots => uncorrectable
@@ -582,21 +582,21 @@ namespace DiscImageChef.Checksums
* Compute err+eras evaluator poly omega(x) = s(x)*lambda(x) (modulo
* x**(NN-KK)). in index form. Also find deg(omega).
*/
- deg_omega = 0;
- for(i = 0; i < NN - KK; i++)
+ degOmega = 0;
+ for(i = 0; i < nn - kk; i++)
{
tmp = 0;
- j = (deg_lambda < i) ? deg_lambda : i;
+ j = (degLambda < i) ? degLambda : i;
for(; j >= 0; j--)
{
- if((s[i + 1 - j] != A0) && (lambda[j] != A0)) tmp ^= Alpha_to[modnn(s[i + 1 - j] + lambda[j])];
+ if((s[i + 1 - j] != a0) && (lambda[j] != a0)) tmp ^= alpha_to[Modnn(s[i + 1 - j] + lambda[j])];
}
- if(tmp != 0) deg_omega = i;
- omega[i] = Index_of[tmp];
+ if(tmp != 0) degOmega = i;
+ omega[i] = index_of[tmp];
}
- omega[NN - KK] = A0;
+ omega[nn - kk] = a0;
/*
* Compute error values in poly-form. num1 = omega(inv(X(l))), num2 =
@@ -605,18 +605,18 @@ namespace DiscImageChef.Checksums
for(j = count - 1; j >= 0; j--)
{
num1 = 0;
- for(i = deg_omega; i >= 0; i--)
+ for(i = degOmega; i >= 0; i--)
{
- if(omega[i] != A0) num1 ^= Alpha_to[modnn(omega[i] + i * root[j])];
+ if(omega[i] != a0) num1 ^= alpha_to[Modnn(omega[i] + i * root[j])];
}
- num2 = Alpha_to[modnn(root[j] * (B0 - 1) + NN)];
+ 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(degLambda, nn - kk - 1) & ~1; i >= 0; i -= 2)
{
- if(lambda[i + 1] != A0) den ^= Alpha_to[modnn(lambda[i + 1] + i * root[j])];
+ if(lambda[i + 1] != a0) den ^= alpha_to[Modnn(lambda[i + 1] + i * root[j])];
}
if(den == 0)
@@ -627,7 +627,7 @@ namespace DiscImageChef.Checksums
/* Apply error to data */
if(num1 != 0)
{
- data[loc[j]] ^= Alpha_to[modnn(Index_of[num1] + Index_of[num2] + NN - Index_of[den])];
+ 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 ce3db615b..340913463 100644
--- a/DiscImageChef.Checksums/SHA1Context.cs
+++ b/DiscImageChef.Checksums/SHA1Context.cs
@@ -39,16 +39,16 @@ namespace DiscImageChef.Checksums
///
/// Provides a UNIX similar API to .NET SHA1.
///
- public class SHA1Context
+ public class Sha1Context
{
- SHA1 _sha1Provider;
+ SHA1 sha1Provider;
///
/// Initializes the SHA1 hash provider
///
public void Init()
{
- _sha1Provider = SHA1.Create();
+ sha1Provider = SHA1.Create();
}
///
@@ -58,7 +58,7 @@ namespace DiscImageChef.Checksums
/// Length of buffer to hash.
public void Update(byte[] data, uint len)
{
- _sha1Provider.TransformBlock(data, 0, (int)len, data, 0);
+ sha1Provider.TransformBlock(data, 0, (int)len, data, 0);
}
///
@@ -75,8 +75,8 @@ namespace DiscImageChef.Checksums
///
public byte[] Final()
{
- _sha1Provider.TransformFinalBlock(new byte[0], 0, 0);
- return _sha1Provider.Hash;
+ sha1Provider.TransformFinalBlock(new byte[0], 0, 0);
+ return sha1Provider.Hash;
}
///
@@ -84,12 +84,12 @@ namespace DiscImageChef.Checksums
///
public string End()
{
- _sha1Provider.TransformFinalBlock(new byte[0], 0, 0);
+ 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"));
+ sha1Output.Append(sha1Provider.Hash[i].ToString("x2"));
}
return sha1Output.ToString();
@@ -102,7 +102,7 @@ namespace DiscImageChef.Checksums
public byte[] File(string filename)
{
FileStream fileStream = new FileStream(filename, FileMode.Open);
- byte[] result = _sha1Provider.ComputeHash(fileStream);
+ byte[] result = sha1Provider.ComputeHash(fileStream);
fileStream.Close();
return result;
}
@@ -115,7 +115,7 @@ namespace DiscImageChef.Checksums
public string File(string filename, out byte[] hash)
{
FileStream fileStream = new FileStream(filename, FileMode.Open);
- hash = _sha1Provider.ComputeHash(fileStream);
+ hash = sha1Provider.ComputeHash(fileStream);
StringBuilder sha1Output = new StringBuilder();
for(int i = 0; i < hash.Length; i++) { sha1Output.Append(hash[i].ToString("x2")); }
@@ -133,7 +133,7 @@ namespace DiscImageChef.Checksums
/// Byte array of the hash value.
public string Data(byte[] data, uint len, out byte[] hash)
{
- hash = _sha1Provider.ComputeHash(data, 0, (int)len);
+ hash = sha1Provider.ComputeHash(data, 0, (int)len);
StringBuilder sha1Output = new StringBuilder();
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 c0e0df57c..026183e1a 100644
--- a/DiscImageChef.Checksums/SHA256Context.cs
+++ b/DiscImageChef.Checksums/SHA256Context.cs
@@ -39,16 +39,16 @@ namespace DiscImageChef.Checksums
///
/// Provides a UNIX similar API to .NET SHA256.
///
- public class SHA256Context
+ public class Sha256Context
{
- SHA256 _sha256Provider;
+ SHA256 sha256Provider;
///
/// Initializes the SHA256 hash provider
///
public void Init()
{
- _sha256Provider = SHA256.Create();
+ sha256Provider = SHA256.Create();
}
///
@@ -58,7 +58,7 @@ namespace DiscImageChef.Checksums
/// Length of buffer to hash.
public void Update(byte[] data, uint len)
{
- _sha256Provider.TransformBlock(data, 0, (int)len, data, 0);
+ sha256Provider.TransformBlock(data, 0, (int)len, data, 0);
}
///
@@ -75,8 +75,8 @@ namespace DiscImageChef.Checksums
///
public byte[] Final()
{
- _sha256Provider.TransformFinalBlock(new byte[0], 0, 0);
- return _sha256Provider.Hash;
+ sha256Provider.TransformFinalBlock(new byte[0], 0, 0);
+ return sha256Provider.Hash;
}
///
@@ -84,12 +84,12 @@ namespace DiscImageChef.Checksums
///
public string End()
{
- _sha256Provider.TransformFinalBlock(new byte[0], 0, 0);
+ 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"));
+ sha256Output.Append(sha256Provider.Hash[i].ToString("x2"));
}
return sha256Output.ToString();
@@ -102,7 +102,7 @@ namespace DiscImageChef.Checksums
public byte[] File(string filename)
{
FileStream fileStream = new FileStream(filename, FileMode.Open);
- byte[] result = _sha256Provider.ComputeHash(fileStream);
+ byte[] result = sha256Provider.ComputeHash(fileStream);
fileStream.Close();
return result;
}
@@ -115,7 +115,7 @@ namespace DiscImageChef.Checksums
public string File(string filename, out byte[] hash)
{
FileStream fileStream = new FileStream(filename, FileMode.Open);
- hash = _sha256Provider.ComputeHash(fileStream);
+ hash = sha256Provider.ComputeHash(fileStream);
StringBuilder sha256Output = new StringBuilder();
for(int i = 0; i < hash.Length; i++) { sha256Output.Append(hash[i].ToString("x2")); }
@@ -133,7 +133,7 @@ namespace DiscImageChef.Checksums
/// Byte array of the hash value.
public string Data(byte[] data, uint len, out byte[] hash)
{
- hash = _sha256Provider.ComputeHash(data, 0, (int)len);
+ hash = sha256Provider.ComputeHash(data, 0, (int)len);
StringBuilder sha256Output = new StringBuilder();
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 847680672..c7c2a434c 100644
--- a/DiscImageChef.Checksums/SHA384Context.cs
+++ b/DiscImageChef.Checksums/SHA384Context.cs
@@ -39,16 +39,16 @@ namespace DiscImageChef.Checksums
///
/// Provides a UNIX similar API to .NET SHA384.
///
- public class SHA384Context
+ public class Sha384Context
{
- SHA384 _sha384Provider;
+ SHA384 sha384Provider;
///
/// Initializes the SHA384 hash provider
///
public void Init()
{
- _sha384Provider = SHA384.Create();
+ sha384Provider = SHA384.Create();
}
///
@@ -58,7 +58,7 @@ namespace DiscImageChef.Checksums
/// Length of buffer to hash.
public void Update(byte[] data, uint len)
{
- _sha384Provider.TransformBlock(data, 0, (int)len, data, 0);
+ sha384Provider.TransformBlock(data, 0, (int)len, data, 0);
}
///
@@ -75,8 +75,8 @@ namespace DiscImageChef.Checksums
///
public byte[] Final()
{
- _sha384Provider.TransformFinalBlock(new byte[0], 0, 0);
- return _sha384Provider.Hash;
+ sha384Provider.TransformFinalBlock(new byte[0], 0, 0);
+ return sha384Provider.Hash;
}
///
@@ -84,12 +84,12 @@ namespace DiscImageChef.Checksums
///
public string End()
{
- _sha384Provider.TransformFinalBlock(new byte[0], 0, 0);
+ 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"));
+ sha384Output.Append(sha384Provider.Hash[i].ToString("x2"));
}
return sha384Output.ToString();
@@ -102,7 +102,7 @@ namespace DiscImageChef.Checksums
public byte[] File(string filename)
{
FileStream fileStream = new FileStream(filename, FileMode.Open);
- byte[] result = _sha384Provider.ComputeHash(fileStream);
+ byte[] result = sha384Provider.ComputeHash(fileStream);
fileStream.Close();
return result;
}
@@ -115,7 +115,7 @@ namespace DiscImageChef.Checksums
public string File(string filename, out byte[] hash)
{
FileStream fileStream = new FileStream(filename, FileMode.Open);
- hash = _sha384Provider.ComputeHash(fileStream);
+ hash = sha384Provider.ComputeHash(fileStream);
StringBuilder sha384Output = new StringBuilder();
for(int i = 0; i < hash.Length; i++) { sha384Output.Append(hash[i].ToString("x2")); }
@@ -133,7 +133,7 @@ namespace DiscImageChef.Checksums
/// Byte array of the hash value.
public string Data(byte[] data, uint len, out byte[] hash)
{
- hash = _sha384Provider.ComputeHash(data, 0, (int)len);
+ hash = sha384Provider.ComputeHash(data, 0, (int)len);
StringBuilder sha384Output = new StringBuilder();
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 1d049c2db..8567c705f 100644
--- a/DiscImageChef.Checksums/SHA512Context.cs
+++ b/DiscImageChef.Checksums/SHA512Context.cs
@@ -39,16 +39,16 @@ namespace DiscImageChef.Checksums
///
/// Provides a UNIX similar API to .NET SHA512.
///
- public class SHA512Context
+ public class Sha512Context
{
- SHA512 _sha512Provider;
+ SHA512 sha512Provider;
///
/// Initializes the SHA512 hash provider
///
public void Init()
{
- _sha512Provider = SHA512.Create();
+ sha512Provider = SHA512.Create();
}
///
@@ -58,7 +58,7 @@ namespace DiscImageChef.Checksums
/// Length of buffer to hash.
public void Update(byte[] data, uint len)
{
- _sha512Provider.TransformBlock(data, 0, (int)len, data, 0);
+ sha512Provider.TransformBlock(data, 0, (int)len, data, 0);
}
///
@@ -75,8 +75,8 @@ namespace DiscImageChef.Checksums
///
public byte[] Final()
{
- _sha512Provider.TransformFinalBlock(new byte[0], 0, 0);
- return _sha512Provider.Hash;
+ sha512Provider.TransformFinalBlock(new byte[0], 0, 0);
+ return sha512Provider.Hash;
}
///
@@ -84,12 +84,12 @@ namespace DiscImageChef.Checksums
///
public string End()
{
- _sha512Provider.TransformFinalBlock(new byte[0], 0, 0);
+ 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"));
+ sha512Output.Append(sha512Provider.Hash[i].ToString("x2"));
}
return sha512Output.ToString();
@@ -102,7 +102,7 @@ namespace DiscImageChef.Checksums
public byte[] File(string filename)
{
FileStream fileStream = new FileStream(filename, FileMode.Open);
- byte[] result = _sha512Provider.ComputeHash(fileStream);
+ byte[] result = sha512Provider.ComputeHash(fileStream);
fileStream.Close();
return result;
}
@@ -115,7 +115,7 @@ namespace DiscImageChef.Checksums
public string File(string filename, out byte[] hash)
{
FileStream fileStream = new FileStream(filename, FileMode.Open);
- hash = _sha512Provider.ComputeHash(fileStream);
+ hash = sha512Provider.ComputeHash(fileStream);
StringBuilder sha512Output = new StringBuilder();
for(int i = 0; i < hash.Length; i++) { sha512Output.Append(hash[i].ToString("x2")); }
@@ -133,7 +133,7 @@ namespace DiscImageChef.Checksums
/// Byte array of the hash value.
public string Data(byte[] data, uint len, out byte[] hash)
{
- hash = _sha512Provider.ComputeHash(data, 0, (int)len);
+ hash = sha512Provider.ComputeHash(data, 0, (int)len);
StringBuilder sha512Output = new StringBuilder();
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 edfe7e344..017fe41a0 100644
--- a/DiscImageChef.Checksums/SpamSumContext.cs
+++ b/DiscImageChef.Checksums/SpamSumContext.cs
@@ -65,14 +65,14 @@ namespace DiscImageChef.Checksums
0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x2B, 0x2F
};
- struct roll_state
+ struct RollState
{
- public byte[] window;
+ public byte[] Window;
// ROLLING_WINDOW
- public uint h1;
- public uint h2;
- public uint h3;
- public uint n;
+ public uint H1;
+ public uint H2;
+ public uint H3;
+ public uint N;
}
/* A blockhash contains a signature state for a specific (implicit) blocksize.
@@ -80,32 +80,32 @@ namespace DiscImageChef.Checksums
* FNV hashes, where halfh stops to be reset after digest is SPAMSUM_LENGTH/2
* long. The halfh hash is needed be able to truncate digest for the second
* output hash to stay compatible with ssdeep output. */
- struct blockhash_context
+ struct BlockhashContext
{
- public uint h;
- public uint halfh;
- public byte[] digest;
+ public uint H;
+ public uint Halfh;
+ public byte[] Digest;
// SPAMSUM_LENGTH
- public byte halfdigest;
- public uint dlen;
+ public byte Halfdigest;
+ public uint Dlen;
}
- struct fuzzy_state
+ struct FuzzyState
{
- public uint bhstart;
- public uint bhend;
- public blockhash_context[] bh;
+ public uint Bhstart;
+ public uint Bhend;
+ public BlockhashContext[] Bh;
//NUM_BLOCKHASHES
- public ulong total_size;
- public roll_state roll;
+ public ulong TotalSize;
+ public RollState Roll;
}
- fuzzy_state self;
+ FuzzyState self;
void roll_init()
{
- self.roll = new roll_state();
- self.roll.window = new byte[ROLLING_WINDOW];
+ self.Roll = new RollState();
+ self.Roll.Window = new byte[ROLLING_WINDOW];
}
///
@@ -113,18 +113,18 @@ namespace DiscImageChef.Checksums
///
public void Init()
{
- self = new fuzzy_state();
- self.bh = new blockhash_context[NUM_BLOCKHASHES];
- for(int i = 0; i < NUM_BLOCKHASHES; i++) self.bh[i].digest = new byte[SPAMSUM_LENGTH];
+ self = new FuzzyState();
+ self.Bh = new BlockhashContext[NUM_BLOCKHASHES];
+ for(int i = 0; i < NUM_BLOCKHASHES; i++) self.Bh[i].Digest = new byte[SPAMSUM_LENGTH];
- self.bhstart = 0;
- self.bhend = 1;
- self.bh[0].h = HASH_INIT;
- self.bh[0].halfh = HASH_INIT;
- self.bh[0].digest[0] = 0;
- self.bh[0].halfdigest = 0;
- self.bh[0].dlen = 0;
- self.total_size = 0;
+ self.Bhstart = 0;
+ self.Bhend = 1;
+ self.Bh[0].H = HASH_INIT;
+ self.Bh[0].Halfh = HASH_INIT;
+ self.Bh[0].Digest[0] = 0;
+ self.Bh[0].Halfdigest = 0;
+ self.Bh[0].Dlen = 0;
+ self.TotalSize = 0;
roll_init();
}
@@ -140,25 +140,25 @@ namespace DiscImageChef.Checksums
*/
void roll_hash(byte c)
{
- self.roll.h2 -= self.roll.h1;
- self.roll.h2 += ROLLING_WINDOW * c;
+ self.Roll.H2 -= self.Roll.H1;
+ self.Roll.H2 += ROLLING_WINDOW * c;
- self.roll.h1 += c;
- self.roll.h1 -= self.roll.window[self.roll.n % ROLLING_WINDOW];
+ self.Roll.H1 += c;
+ self.Roll.H1 -= self.Roll.Window[self.Roll.N % ROLLING_WINDOW];
- self.roll.window[self.roll.n % ROLLING_WINDOW] = c;
- self.roll.n++;
+ self.Roll.Window[self.Roll.N % ROLLING_WINDOW] = c;
+ self.Roll.N++;
/* The original spamsum AND'ed this value with 0xFFFFFFFF which
* in theory should have no effect. This AND has been removed
* for performance (jk) */
- self.roll.h3 <<= 5;
- self.roll.h3 ^= c;
+ self.Roll.H3 <<= 5;
+ self.Roll.H3 ^= c;
}
uint roll_sum()
{
- return self.roll.h1 + self.roll.h2 + self.roll.h3;
+ return self.Roll.H1 + self.Roll.H2 + self.Roll.H3;
}
/* A simple non-rolling hash, based on the FNV hash. */
@@ -176,35 +176,35 @@ namespace DiscImageChef.Checksums
{
uint obh, nbh;
- if(self.bhend >= NUM_BLOCKHASHES) return;
+ 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;
- nbh = self.bhend;
- self.bh[nbh].h = self.bh[obh].h;
- self.bh[nbh].halfh = self.bh[obh].halfh;
- self.bh[nbh].digest[0] = 0;
- self.bh[nbh].halfdigest = 0;
- self.bh[nbh].dlen = 0;
- ++self.bhend;
+ obh = self.Bhend - 1;
+ nbh = self.Bhend;
+ self.Bh[nbh].H = self.Bh[obh].H;
+ self.Bh[nbh].Halfh = self.Bh[obh].Halfh;
+ self.Bh[nbh].Digest[0] = 0;
+ self.Bh[nbh].Halfdigest = 0;
+ self.Bh[nbh].Dlen = 0;
+ ++self.Bhend;
}
void fuzzy_try_reduce_blockhash()
{
- if(self.bhstart >= self.bhend) throw new Exception("Assertion failed");
+ 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((ulong)SSDEEP_BS(self.bhstart) * SPAMSUM_LENGTH >= self.total_size)
+ if((ulong)SSDEEP_BS(self.Bhstart) * SPAMSUM_LENGTH >= self.TotalSize)
/* 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
* start_blocksize. Get rid of it. */
- ++self.bhstart;
+ ++self.Bhstart;
}
void fuzzy_engine_step(byte c)
@@ -217,13 +217,13 @@ 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);
+ 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)
@@ -233,15 +233,15 @@ 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. */
fuzzy_try_fork_blockhash();
}
- 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)
+ 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)
{
/* We can have a problem with the tail overflowing. The
* easiest way to cope with this is to only reset the
@@ -249,12 +249,12 @@ namespace DiscImageChef.Checksums
* our signature. This has the effect of combining the
* last few pieces of the message into a single piece
* */
- self.bh[i].digest[++(self.bh[i].dlen)] = 0;
- self.bh[i].h = HASH_INIT;
- if(self.bh[i].dlen < SPAMSUM_LENGTH / 2)
+ self.Bh[i].Digest[++(self.Bh[i].Dlen)] = 0;
+ self.Bh[i].H = HASH_INIT;
+ if(self.Bh[i].Dlen < SPAMSUM_LENGTH / 2)
{
- self.bh[i].halfh = HASH_INIT;
- self.bh[i].halfdigest = 0;
+ self.Bh[i].Halfh = HASH_INIT;
+ self.Bh[i].Halfdigest = 0;
}
}
else fuzzy_try_reduce_blockhash();
@@ -268,7 +268,7 @@ namespace DiscImageChef.Checksums
/// Length of buffer to hash.
public void Update(byte[] data, uint len)
{
- self.total_size += len;
+ self.TotalSize += len;
for(int i = 0; i < len; i++) fuzzy_engine_step(data[i]);
}
@@ -285,28 +285,28 @@ namespace DiscImageChef.Checksums
uint fuzzy_digest(out byte[] result)
{
StringBuilder sb = new StringBuilder();
- uint bi = self.bhstart;
+ uint bi = self.Bhstart;
uint h = roll_sum();
- int i, result_off;
+ int i, resultOff;
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 || (ulong)SSDEEP_BS(bi) / 2 * SPAMSUM_LENGTH < self.total_size))
+ if(!(bi == 0 || (ulong)SSDEEP_BS(bi) / 2 * SPAMSUM_LENGTH < self.TotalSize))
throw new Exception("Assertion failed");
- result_off = 0;
+ resultOff = 0;
/* Initial blocksize guess. */
- while((ulong)SSDEEP_BS(bi) * SPAMSUM_LENGTH < self.total_size)
+ while((ulong)SSDEEP_BS(bi) * SPAMSUM_LENGTH < self.TotalSize)
{
++bi;
if(bi >= NUM_BLOCKHASHES) { throw new OverflowException("The input exceeds data types."); }
}
/* Adapt blocksize guess to actual digest length. */
- while(bi >= self.bhend) --bi;
- while(bi > self.bhstart && self.bh[bi].dlen < SPAMSUM_LENGTH / 2) --bi;
+ while(bi >= self.Bhend) --bi;
+ while(bi > self.Bhstart && self.Bh[bi].Dlen < SPAMSUM_LENGTH / 2) --bi;
- if((bi > 0 && self.bh[bi].dlen < SPAMSUM_LENGTH / 2)) throw new Exception("Assertion failed");
+ 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;
@@ -318,78 +318,78 @@ namespace DiscImageChef.Checksums
Array.Copy(Encoding.ASCII.GetBytes(sb.ToString()), 0, result, 0, i);
- result_off += i;
+ resultOff += i;
- i = (int)self.bh[bi].dlen;
+ i = (int)self.Bh[bi].Dlen;
if(i > remain) throw new Exception("Assertion failed");
- Array.Copy(self.bh[bi].digest, 0, result, result_off, i);
- result_off += i;
+ Array.Copy(self.Bh[bi].Digest, 0, result, resultOff, i);
+ resultOff += i;
remain -= i;
if(h != 0)
{
if(remain <= 0) throw new Exception("Assertion failed");
- result[result_off] = b64[self.bh[bi].h % 64];
- if(i < 3 || result[result_off] != result[result_off - 1] ||
- result[result_off] != result[result_off - 2] || result[result_off] != result[result_off - 3])
+ result[resultOff] = b64[self.Bh[bi].H % 64];
+ if(i < 3 || result[resultOff] != result[resultOff - 1] ||
+ result[resultOff] != result[resultOff - 2] || result[resultOff] != result[resultOff - 3])
{
- ++result_off;
+ ++resultOff;
--remain;
}
}
- else if(self.bh[bi].digest[i] != 0)
+ else if(self.Bh[bi].Digest[i] != 0)
{
if(remain <= 0) throw new Exception("Assertion failed");
- result[result_off] = self.bh[bi].digest[i];
- if(i < 3 || result[result_off] != result[result_off - 1] ||
- result[result_off] != result[result_off - 2] || result[result_off] != result[result_off - 3])
+ result[resultOff] = self.Bh[bi].Digest[i];
+ if(i < 3 || result[resultOff] != result[resultOff - 1] ||
+ result[resultOff] != result[resultOff - 2] || result[resultOff] != result[resultOff - 3])
{
- ++result_off;
+ ++resultOff;
--remain;
}
}
if(remain <= 0) throw new Exception("Assertion failed");
- result[result_off++] = 0x3A; // ':'
+ result[resultOff++] = 0x3A; // ':'
--remain;
- if(bi < self.bhend - 1)
+ if(bi < self.Bhend - 1)
{
++bi;
- i = (int)self.bh[bi].dlen;
+ i = (int)self.Bh[bi].Dlen;
if(i > remain) throw new Exception("Assertion failed");
- Array.Copy(self.bh[bi].digest, 0, result, result_off, i);
- result_off += i;
+ Array.Copy(self.Bh[bi].Digest, 0, result, resultOff, i);
+ resultOff += i;
remain -= i;
if(h != 0)
{
if(remain <= 0) throw new Exception("Assertion failed");
- h = self.bh[bi].halfh;
- result[result_off] = b64[h % 64];
- if(i < 3 || result[result_off] != result[result_off - 1] ||
- result[result_off] != result[result_off - 2] || result[result_off] != result[result_off - 3])
+ h = self.Bh[bi].Halfh;
+ result[resultOff] = b64[h % 64];
+ if(i < 3 || result[resultOff] != result[resultOff - 1] ||
+ result[resultOff] != result[resultOff - 2] || result[resultOff] != result[resultOff - 3])
{
- ++result_off;
+ ++resultOff;
--remain;
}
}
else
{
- i = self.bh[bi].halfdigest;
+ i = self.Bh[bi].Halfdigest;
if(i != 0)
{
if(remain <= 0) throw new Exception("Assertion failed");
- result[result_off] = (byte)i;
- if(i < 3 || result[result_off] != result[result_off - 1] ||
- result[result_off] != result[result_off - 2] || result[result_off] != result[result_off - 3])
+ result[resultOff] = (byte)i;
+ if(i < 3 || result[resultOff] != result[resultOff - 1] ||
+ result[resultOff] != result[resultOff - 2] || result[resultOff] != result[resultOff - 3])
{
- ++result_off;
+ ++resultOff;
--remain;
}
}
@@ -397,16 +397,16 @@ namespace DiscImageChef.Checksums
}
else if(h != 0)
{
- if(self.bh[bi].dlen != 0) throw new Exception("Assertion failed");
+ if(self.Bh[bi].Dlen != 0) throw new Exception("Assertion failed");
if(remain <= 0) throw new Exception("Assertion failed");
- result[result_off++] = b64[self.bh[bi].h % 64];
+ result[resultOff++] = b64[self.Bh[bi].H % 64];
/* No need to bother with FUZZY_FLAG_ELIMSEQ, because this
* digest has length 1. */
--remain;
}
- result[result_off] = 0;
+ result[resultOff] = 0;
return 0;
}
@@ -482,15 +482,15 @@ namespace DiscImageChef.Checksums
}
// Converts an ASCII null-terminated string to .NET string
- private string CToString(byte[] CString)
+ private string CToString(byte[] cString)
{
StringBuilder sb = new StringBuilder();
- for(int i = 0; i < CString.Length; i++)
+ for(int i = 0; i < cString.Length; i++)
{
- if(CString[i] == 0) break;
+ if(cString[i] == 0) break;
- sb.Append(Encoding.ASCII.GetString(CString, i, 1));
+ sb.Append(Encoding.ASCII.GetString(cString, i, 1));
}
return sb.ToString();
diff --git a/DiscImageChef.CommonTypes/MediaType.cs b/DiscImageChef.CommonTypes/MediaType.cs
index e5e99a6a1..b091770f6 100644
--- a/DiscImageChef.CommonTypes/MediaType.cs
+++ b/DiscImageChef.CommonTypes/MediaType.cs
@@ -30,6 +30,8 @@
// Copyright © 2011-2018 Natalia Portillo
// ****************************************************************************/
+// ReSharper disable InconsistentNaming
+// TODO: Rename contents
namespace DiscImageChef.CommonTypes
{
// Media (disk, cartridge, tape, cassette, etc) types
diff --git a/DiscImageChef.CommonTypes/MediaTypeFromSCSI.cs b/DiscImageChef.CommonTypes/MediaTypeFromSCSI.cs
index 71dcf4f73..776ae6651 100644
--- a/DiscImageChef.CommonTypes/MediaTypeFromSCSI.cs
+++ b/DiscImageChef.CommonTypes/MediaTypeFromSCSI.cs
@@ -33,7 +33,7 @@
namespace DiscImageChef.CommonTypes
{
#pragma warning disable RECS0063 // Warns when a culture-aware 'StartsWith' call is used by default.
- public static class MediaTypeFromSCSI
+ public static class MediaTypeFromScsi
{
public static MediaType Get(byte scsiPeripheralType, string vendor, string model, byte mediumType,
byte densityCode, ulong blocks, uint blockSize)
diff --git a/DiscImageChef.Core/Benchmark.cs b/DiscImageChef.Core/Benchmark.cs
index 846d94db4..478129742 100644
--- a/DiscImageChef.Core/Benchmark.cs
+++ b/DiscImageChef.Core/Benchmark.cs
@@ -39,25 +39,25 @@ namespace DiscImageChef.Core
{
public struct BenchmarkResults
{
- public double fillTime;
- public double fillSpeed;
- public double readTime;
- public double readSpeed;
- public double entropyTime;
- public double entropySpeed;
- public Dictionary entries;
- public long minMemory;
- public long maxMemory;
- public double separateTime;
- public double separateSpeed;
- public double totalTime;
- public double totalSpeed;
+ public double FillTime;
+ public double FillSpeed;
+ public double ReadTime;
+ public double ReadSpeed;
+ public double EntropyTime;
+ public double EntropySpeed;
+ public Dictionary Entries;
+ public long MinMemory;
+ public long MaxMemory;
+ public double SeparateTime;
+ public double SeparateSpeed;
+ public double TotalTime;
+ public double TotalSpeed;
}
public struct BenchmarkEntry
{
- public double timeSpan;
- public double speed;
+ public double TimeSpan;
+ public double Speed;
}
public static class Benchmark
@@ -85,10 +85,10 @@ namespace DiscImageChef.Core
public static BenchmarkResults Do(int bufferSize, int blockSize)
{
BenchmarkResults results = new BenchmarkResults();
- results.entries = new Dictionary();
- results.minMemory = long.MaxValue;
- results.maxMemory = 0;
- results.separateTime = 0;
+ results.Entries = new Dictionary();
+ results.MinMemory = long.MaxValue;
+ results.MaxMemory = 0;
+ results.SeparateTime = 0;
MemoryStream ms = new MemoryStream(bufferSize);
Random rnd = new Random();
DateTime start;
@@ -109,13 +109,13 @@ namespace DiscImageChef.Core
EndProgress();
end = DateTime.Now;
- results.fillTime = (end - start).TotalSeconds;
- results.fillSpeed = (bufferSize / 1048576) / (end - start).TotalSeconds;
+ results.FillTime = (end - start).TotalSeconds;
+ results.FillSpeed = (bufferSize / 1048576) / (end - start).TotalSeconds;
ms.Seek(0, SeekOrigin.Begin);
mem = GC.GetTotalMemory(false);
- if(mem > results.maxMemory) results.maxMemory = mem;
- if(mem < results.minMemory) results.minMemory = mem;
+ if(mem > results.MaxMemory) results.MaxMemory = mem;
+ if(mem < results.MinMemory) results.MinMemory = mem;
start = DateTime.Now;
InitProgress();
for(int i = 0; i < bufferSize / blockSize; i++)
@@ -128,19 +128,19 @@ namespace DiscImageChef.Core
EndProgress();
end = DateTime.Now;
mem = GC.GetTotalMemory(false);
- if(mem > results.maxMemory) results.maxMemory = mem;
- if(mem < results.minMemory) results.minMemory = mem;
+ if(mem > results.MaxMemory) results.MaxMemory = mem;
+ if(mem < results.MinMemory) results.MinMemory = mem;
- results.readTime = (end - start).TotalSeconds;
- results.readSpeed = (bufferSize / 1048576) / (end - start).TotalSeconds;
+ results.ReadTime = (end - start).TotalSeconds;
+ results.ReadSpeed = (bufferSize / 1048576) / (end - start).TotalSeconds;
#region Adler32
ctx = new Adler32Context();
((Adler32Context)ctx).Init();
ms.Seek(0, SeekOrigin.Begin);
mem = GC.GetTotalMemory(false);
- if(mem > results.maxMemory) results.maxMemory = mem;
- if(mem < results.minMemory) results.minMemory = mem;
+ if(mem > results.MaxMemory) results.MaxMemory = mem;
+ if(mem < results.MinMemory) results.MinMemory = mem;
start = DateTime.Now;
InitProgress();
for(int i = 0; i < bufferSize / blockSize; i++)
@@ -155,25 +155,25 @@ namespace DiscImageChef.Core
((Adler32Context)ctx).End();
end = DateTime.Now;
mem = GC.GetTotalMemory(false);
- if(mem > results.maxMemory) results.maxMemory = mem;
- if(mem < results.minMemory) results.minMemory = mem;
+ if(mem > results.MaxMemory) results.MaxMemory = mem;
+ if(mem < results.MinMemory) results.MinMemory = mem;
- results.entries.Add("Adler32",
+ results.Entries.Add("Adler32",
new BenchmarkEntry()
{
- timeSpan = (end - start).TotalSeconds,
- speed = (bufferSize / 1048576) / (end - start).TotalSeconds
+ TimeSpan = (end - start).TotalSeconds,
+ Speed = (bufferSize / 1048576) / (end - start).TotalSeconds
});
- results.separateTime += (end - start).TotalSeconds;
+ results.SeparateTime += (end - start).TotalSeconds;
#endregion Adler32
#region CRC16
- ctx = new CRC16Context();
- ((CRC16Context)ctx).Init();
+ ctx = new Crc16Context();
+ ((Crc16Context)ctx).Init();
ms.Seek(0, SeekOrigin.Begin);
mem = GC.GetTotalMemory(false);
- if(mem > results.maxMemory) results.maxMemory = mem;
- if(mem < results.minMemory) results.minMemory = mem;
+ if(mem > results.MaxMemory) results.MaxMemory = mem;
+ if(mem < results.MinMemory) results.MinMemory = mem;
start = DateTime.Now;
InitProgress();
for(int i = 0; i < bufferSize / blockSize; i++)
@@ -181,32 +181,32 @@ namespace DiscImageChef.Core
UpdateProgress("Checksumming block {0} of {1} with CRC16.", i + 1, bufferSize / blockSize);
byte[] tmp = new byte[blockSize];
ms.Read(tmp, 0, blockSize);
- ((CRC16Context)ctx).Update(tmp);
+ ((Crc16Context)ctx).Update(tmp);
}
EndProgress();
- ((CRC16Context)ctx).End();
+ ((Crc16Context)ctx).End();
end = DateTime.Now;
mem = GC.GetTotalMemory(false);
- if(mem > results.maxMemory) results.maxMemory = mem;
- if(mem < results.minMemory) results.minMemory = mem;
+ if(mem > results.MaxMemory) results.MaxMemory = mem;
+ if(mem < results.MinMemory) results.MinMemory = mem;
- results.entries.Add("CRC16",
+ results.Entries.Add("CRC16",
new BenchmarkEntry()
{
- timeSpan = (end - start).TotalSeconds,
- speed = (bufferSize / 1048576) / (end - start).TotalSeconds
+ TimeSpan = (end - start).TotalSeconds,
+ Speed = (bufferSize / 1048576) / (end - start).TotalSeconds
});
- results.separateTime += (end - start).TotalSeconds;
+ results.SeparateTime += (end - start).TotalSeconds;
#endregion CRC16
#region CRC32
- ctx = new CRC32Context();
- ((CRC32Context)ctx).Init();
+ ctx = new Crc32Context();
+ ((Crc32Context)ctx).Init();
ms.Seek(0, SeekOrigin.Begin);
mem = GC.GetTotalMemory(false);
- if(mem > results.maxMemory) results.maxMemory = mem;
- if(mem < results.minMemory) results.minMemory = mem;
+ if(mem > results.MaxMemory) results.MaxMemory = mem;
+ if(mem < results.MinMemory) results.MinMemory = mem;
start = DateTime.Now;
InitProgress();
for(int i = 0; i < bufferSize / blockSize; i++)
@@ -214,32 +214,32 @@ namespace DiscImageChef.Core
UpdateProgress("Checksumming block {0} of {1} with CRC32.", i + 1, bufferSize / blockSize);
byte[] tmp = new byte[blockSize];
ms.Read(tmp, 0, blockSize);
- ((CRC32Context)ctx).Update(tmp);
+ ((Crc32Context)ctx).Update(tmp);
}
EndProgress();
- ((CRC32Context)ctx).End();
+ ((Crc32Context)ctx).End();
end = DateTime.Now;
mem = GC.GetTotalMemory(false);
- if(mem > results.maxMemory) results.maxMemory = mem;
- if(mem < results.minMemory) results.minMemory = mem;
+ if(mem > results.MaxMemory) results.MaxMemory = mem;
+ if(mem < results.MinMemory) results.MinMemory = mem;
- results.entries.Add("CRC32",
+ results.Entries.Add("CRC32",
new BenchmarkEntry()
{
- timeSpan = (end - start).TotalSeconds,
- speed = (bufferSize / 1048576) / (end - start).TotalSeconds
+ TimeSpan = (end - start).TotalSeconds,
+ Speed = (bufferSize / 1048576) / (end - start).TotalSeconds
});
- results.separateTime += (end - start).TotalSeconds;
+ results.SeparateTime += (end - start).TotalSeconds;
#endregion CRC32
#region CRC64
- ctx = new CRC64Context();
- ((CRC64Context)ctx).Init();
+ ctx = new Crc64Context();
+ ((Crc64Context)ctx).Init();
ms.Seek(0, SeekOrigin.Begin);
mem = GC.GetTotalMemory(false);
- if(mem > results.maxMemory) results.maxMemory = mem;
- if(mem < results.minMemory) results.minMemory = mem;
+ if(mem > results.MaxMemory) results.MaxMemory = mem;
+ if(mem < results.MinMemory) results.MinMemory = mem;
start = DateTime.Now;
InitProgress();
for(int i = 0; i < bufferSize / blockSize; i++)
@@ -247,32 +247,32 @@ namespace DiscImageChef.Core
UpdateProgress("Checksumming block {0} of {1} with CRC64.", i + 1, bufferSize / blockSize);
byte[] tmp = new byte[blockSize];
ms.Read(tmp, 0, blockSize);
- ((CRC64Context)ctx).Update(tmp);
+ ((Crc64Context)ctx).Update(tmp);
}
EndProgress();
- ((CRC64Context)ctx).End();
+ ((Crc64Context)ctx).End();
end = DateTime.Now;
mem = GC.GetTotalMemory(false);
- if(mem > results.maxMemory) results.maxMemory = mem;
- if(mem < results.minMemory) results.minMemory = mem;
+ if(mem > results.MaxMemory) results.MaxMemory = mem;
+ if(mem < results.MinMemory) results.MinMemory = mem;
- results.entries.Add("CRC64",
+ results.Entries.Add("CRC64",
new BenchmarkEntry()
{
- timeSpan = (end - start).TotalSeconds,
- speed = (bufferSize / 1048576) / (end - start).TotalSeconds
+ TimeSpan = (end - start).TotalSeconds,
+ Speed = (bufferSize / 1048576) / (end - start).TotalSeconds
});
- results.separateTime += (end - start).TotalSeconds;
+ results.SeparateTime += (end - start).TotalSeconds;
#endregion CRC64
#region MD5
- ctx = new MD5Context();
- ((MD5Context)ctx).Init();
+ ctx = new Md5Context();
+ ((Md5Context)ctx).Init();
ms.Seek(0, SeekOrigin.Begin);
mem = GC.GetTotalMemory(false);
- if(mem > results.maxMemory) results.maxMemory = mem;
- if(mem < results.minMemory) results.minMemory = mem;
+ if(mem > results.MaxMemory) results.MaxMemory = mem;
+ if(mem < results.MinMemory) results.MinMemory = mem;
start = DateTime.Now;
InitProgress();
for(int i = 0; i < bufferSize / blockSize; i++)
@@ -280,32 +280,32 @@ namespace DiscImageChef.Core
UpdateProgress("Checksumming block {0} of {1} with MD5.", i + 1, bufferSize / blockSize);
byte[] tmp = new byte[blockSize];
ms.Read(tmp, 0, blockSize);
- ((MD5Context)ctx).Update(tmp);
+ ((Md5Context)ctx).Update(tmp);
}
EndProgress();
- ((MD5Context)ctx).End();
+ ((Md5Context)ctx).End();
end = DateTime.Now;
mem = GC.GetTotalMemory(false);
- if(mem > results.maxMemory) results.maxMemory = mem;
- if(mem < results.minMemory) results.minMemory = mem;
+ if(mem > results.MaxMemory) results.MaxMemory = mem;
+ if(mem < results.MinMemory) results.MinMemory = mem;
- results.entries.Add("MD5",
+ results.Entries.Add("MD5",
new BenchmarkEntry()
{
- timeSpan = (end - start).TotalSeconds,
- speed = (bufferSize / 1048576) / (end - start).TotalSeconds
+ TimeSpan = (end - start).TotalSeconds,
+ Speed = (bufferSize / 1048576) / (end - start).TotalSeconds
});
- results.separateTime += (end - start).TotalSeconds;
+ results.SeparateTime += (end - start).TotalSeconds;
#endregion MD5
#region RIPEMD160
- ctx = new RIPEMD160Context();
- ((RIPEMD160Context)ctx).Init();
+ ctx = new Ripemd160Context();
+ ((Ripemd160Context)ctx).Init();
ms.Seek(0, SeekOrigin.Begin);
mem = GC.GetTotalMemory(false);
- if(mem > results.maxMemory) results.maxMemory = mem;
- if(mem < results.minMemory) results.minMemory = mem;
+ if(mem > results.MaxMemory) results.MaxMemory = mem;
+ if(mem < results.MinMemory) results.MinMemory = mem;
start = DateTime.Now;
InitProgress();
for(int i = 0; i < bufferSize / blockSize; i++)
@@ -313,32 +313,32 @@ namespace DiscImageChef.Core
UpdateProgress("Checksumming block {0} of {1} with RIPEMD160.", i + 1, bufferSize / blockSize);
byte[] tmp = new byte[blockSize];
ms.Read(tmp, 0, blockSize);
- ((RIPEMD160Context)ctx).Update(tmp);
+ ((Ripemd160Context)ctx).Update(tmp);
}
EndProgress();
- ((RIPEMD160Context)ctx).End();
+ ((Ripemd160Context)ctx).End();
end = DateTime.Now;
mem = GC.GetTotalMemory(false);
- if(mem > results.maxMemory) results.maxMemory = mem;
- if(mem < results.minMemory) results.minMemory = mem;
+ if(mem > results.MaxMemory) results.MaxMemory = mem;
+ if(mem < results.MinMemory) results.MinMemory = mem;
- results.entries.Add("RIPEMD160",
+ results.Entries.Add("RIPEMD160",
new BenchmarkEntry()
{
- timeSpan = (end - start).TotalSeconds,
- speed = (bufferSize / 1048576) / (end - start).TotalSeconds
+ TimeSpan = (end - start).TotalSeconds,
+ Speed = (bufferSize / 1048576) / (end - start).TotalSeconds
});
- results.separateTime += (end - start).TotalSeconds;
+ results.SeparateTime += (end - start).TotalSeconds;
#endregion RIPEMD160
#region SHA1
- ctx = new SHA1Context();
- ((SHA1Context)ctx).Init();
+ ctx = new Sha1Context();
+ ((Sha1Context)ctx).Init();
ms.Seek(0, SeekOrigin.Begin);
mem = GC.GetTotalMemory(false);
- if(mem > results.maxMemory) results.maxMemory = mem;
- if(mem < results.minMemory) results.minMemory = mem;
+ if(mem > results.MaxMemory) results.MaxMemory = mem;
+ if(mem < results.MinMemory) results.MinMemory = mem;
start = DateTime.Now;
InitProgress();
for(int i = 0; i < bufferSize / blockSize; i++)
@@ -346,32 +346,32 @@ namespace DiscImageChef.Core
UpdateProgress("Checksumming block {0} of {1} with SHA1.", i + 1, bufferSize / blockSize);
byte[] tmp = new byte[blockSize];
ms.Read(tmp, 0, blockSize);
- ((SHA1Context)ctx).Update(tmp);
+ ((Sha1Context)ctx).Update(tmp);
}
EndProgress();
- ((SHA1Context)ctx).End();
+ ((Sha1Context)ctx).End();
end = DateTime.Now;
mem = GC.GetTotalMemory(false);
- if(mem > results.maxMemory) results.maxMemory = mem;
- if(mem < results.minMemory) results.minMemory = mem;
+ if(mem > results.MaxMemory) results.MaxMemory = mem;
+ if(mem < results.MinMemory) results.MinMemory = mem;
- results.entries.Add("SHA1",
+ results.Entries.Add("SHA1",
new BenchmarkEntry()
{
- timeSpan = (end - start).TotalSeconds,
- speed = (bufferSize / 1048576) / (end - start).TotalSeconds
+ TimeSpan = (end - start).TotalSeconds,
+ Speed = (bufferSize / 1048576) / (end - start).TotalSeconds
});
- results.separateTime += (end - start).TotalSeconds;
+ results.SeparateTime += (end - start).TotalSeconds;
#endregion SHA1
#region SHA256
- ctx = new SHA256Context();
- ((SHA256Context)ctx).Init();
+ ctx = new Sha256Context();
+ ((Sha256Context)ctx).Init();
ms.Seek(0, SeekOrigin.Begin);
mem = GC.GetTotalMemory(false);
- if(mem > results.maxMemory) results.maxMemory = mem;
- if(mem < results.minMemory) results.minMemory = mem;
+ if(mem > results.MaxMemory) results.MaxMemory = mem;
+ if(mem < results.MinMemory) results.MinMemory = mem;
start = DateTime.Now;
InitProgress();
for(int i = 0; i < bufferSize / blockSize; i++)
@@ -379,32 +379,32 @@ namespace DiscImageChef.Core
UpdateProgress("Checksumming block {0} of {1} with SHA256.", i + 1, bufferSize / blockSize);
byte[] tmp = new byte[blockSize];
ms.Read(tmp, 0, blockSize);
- ((SHA256Context)ctx).Update(tmp);
+ ((Sha256Context)ctx).Update(tmp);
}
EndProgress();
- ((SHA256Context)ctx).End();
+ ((Sha256Context)ctx).End();
end = DateTime.Now;
mem = GC.GetTotalMemory(false);
- if(mem > results.maxMemory) results.maxMemory = mem;
- if(mem < results.minMemory) results.minMemory = mem;
+ if(mem > results.MaxMemory) results.MaxMemory = mem;
+ if(mem < results.MinMemory) results.MinMemory = mem;
- results.entries.Add("SHA256",
+ results.Entries.Add("SHA256",
new BenchmarkEntry()
{
- timeSpan = (end - start).TotalSeconds,
- speed = (bufferSize / 1048576) / (end - start).TotalSeconds
+ TimeSpan = (end - start).TotalSeconds,
+ Speed = (bufferSize / 1048576) / (end - start).TotalSeconds
});
- results.separateTime += (end - start).TotalSeconds;
+ results.SeparateTime += (end - start).TotalSeconds;
#endregion SHA256
#region SHA384
- ctx = new SHA384Context();
- ((SHA384Context)ctx).Init();
+ ctx = new Sha384Context();
+ ((Sha384Context)ctx).Init();
ms.Seek(0, SeekOrigin.Begin);
mem = GC.GetTotalMemory(false);
- if(mem > results.maxMemory) results.maxMemory = mem;
- if(mem < results.minMemory) results.minMemory = mem;
+ if(mem > results.MaxMemory) results.MaxMemory = mem;
+ if(mem < results.MinMemory) results.MinMemory = mem;
start = DateTime.Now;
InitProgress();
for(int i = 0; i < bufferSize / blockSize; i++)
@@ -412,32 +412,32 @@ namespace DiscImageChef.Core
UpdateProgress("Checksumming block {0} of {1} with SHA384.", i + 1, bufferSize / blockSize);
byte[] tmp = new byte[blockSize];
ms.Read(tmp, 0, blockSize);
- ((SHA384Context)ctx).Update(tmp);
+ ((Sha384Context)ctx).Update(tmp);
}
EndProgress();
- ((SHA384Context)ctx).End();
+ ((Sha384Context)ctx).End();
end = DateTime.Now;
mem = GC.GetTotalMemory(false);
- if(mem > results.maxMemory) results.maxMemory = mem;
- if(mem < results.minMemory) results.minMemory = mem;
+ if(mem > results.MaxMemory) results.MaxMemory = mem;
+ if(mem < results.MinMemory) results.MinMemory = mem;
- results.entries.Add("SHA384",
+ results.Entries.Add("SHA384",
new BenchmarkEntry()
{
- timeSpan = (end - start).TotalSeconds,
- speed = (bufferSize / 1048576) / (end - start).TotalSeconds
+ TimeSpan = (end - start).TotalSeconds,
+ Speed = (bufferSize / 1048576) / (end - start).TotalSeconds
});
- results.separateTime += (end - start).TotalSeconds;
+ results.SeparateTime += (end - start).TotalSeconds;
#endregion SHA384
#region SHA512
- ctx = new SHA512Context();
- ((SHA512Context)ctx).Init();
+ ctx = new Sha512Context();
+ ((Sha512Context)ctx).Init();
ms.Seek(0, SeekOrigin.Begin);
mem = GC.GetTotalMemory(false);
- if(mem > results.maxMemory) results.maxMemory = mem;
- if(mem < results.minMemory) results.minMemory = mem;
+ if(mem > results.MaxMemory) results.MaxMemory = mem;
+ if(mem < results.MinMemory) results.MinMemory = mem;
start = DateTime.Now;
InitProgress();
for(int i = 0; i < bufferSize / blockSize; i++)
@@ -445,23 +445,23 @@ namespace DiscImageChef.Core
UpdateProgress("Checksumming block {0} of {1} with SHA512.", i + 1, bufferSize / blockSize);
byte[] tmp = new byte[blockSize];
ms.Read(tmp, 0, blockSize);
- ((SHA512Context)ctx).Update(tmp);
+ ((Sha512Context)ctx).Update(tmp);
}
EndProgress();
- ((SHA512Context)ctx).End();
+ ((Sha512Context)ctx).End();
end = DateTime.Now;
mem = GC.GetTotalMemory(false);
- if(mem > results.maxMemory) results.maxMemory = mem;
- if(mem < results.minMemory) results.minMemory = mem;
+ if(mem > results.MaxMemory) results.MaxMemory = mem;
+ if(mem < results.MinMemory) results.MinMemory = mem;
- results.entries.Add("SHA512",
+ results.Entries.Add("SHA512",
new BenchmarkEntry()
{
- timeSpan = (end - start).TotalSeconds,
- speed = (bufferSize / 1048576) / (end - start).TotalSeconds
+ TimeSpan = (end - start).TotalSeconds,
+ Speed = (bufferSize / 1048576) / (end - start).TotalSeconds
});
- results.separateTime += (end - start).TotalSeconds;
+ results.SeparateTime += (end - start).TotalSeconds;
#endregion SHA512
#region SpamSum
@@ -469,8 +469,8 @@ namespace DiscImageChef.Core
((SpamSumContext)ctx).Init();
ms.Seek(0, SeekOrigin.Begin);
mem = GC.GetTotalMemory(false);
- if(mem > results.maxMemory) results.maxMemory = mem;
- if(mem < results.minMemory) results.minMemory = mem;
+ if(mem > results.MaxMemory) results.MaxMemory = mem;
+ if(mem < results.MinMemory) results.MinMemory = mem;
start = DateTime.Now;
InitProgress();
for(int i = 0; i < bufferSize / blockSize; i++)
@@ -485,24 +485,24 @@ namespace DiscImageChef.Core
((SpamSumContext)ctx).End();
end = DateTime.Now;
mem = GC.GetTotalMemory(false);
- if(mem > results.maxMemory) results.maxMemory = mem;
- if(mem < results.minMemory) results.minMemory = mem;
+ if(mem > results.MaxMemory) results.MaxMemory = mem;
+ if(mem < results.MinMemory) results.MinMemory = mem;
- results.entries.Add("SpamSum",
+ results.Entries.Add("SpamSum",
new BenchmarkEntry()
{
- timeSpan = (end - start).TotalSeconds,
- speed = (bufferSize / 1048576) / (end - start).TotalSeconds
+ TimeSpan = (end - start).TotalSeconds,
+ Speed = (bufferSize / 1048576) / (end - start).TotalSeconds
});
- results.separateTime += (end - start).TotalSeconds;
+ results.SeparateTime += (end - start).TotalSeconds;
#endregion SpamSum
#region Entropy
ulong[] entTable = new ulong[256];
ms.Seek(0, SeekOrigin.Begin);
mem = GC.GetTotalMemory(false);
- if(mem > results.maxMemory) results.maxMemory = mem;
- if(mem < results.minMemory) results.minMemory = mem;
+ if(mem > results.MaxMemory) results.MaxMemory = mem;
+ if(mem < results.MinMemory) results.MinMemory = mem;
start = DateTime.Now;
InitProgress();
for(int i = 0; i < bufferSize / blockSize; i++)
@@ -525,11 +525,11 @@ namespace DiscImageChef.Core
end = DateTime.Now;
mem = GC.GetTotalMemory(false);
- if(mem > results.maxMemory) results.maxMemory = mem;
- if(mem < results.minMemory) results.minMemory = mem;
+ if(mem > results.MaxMemory) results.MaxMemory = mem;
+ if(mem < results.MinMemory) results.MinMemory = mem;
- results.entropyTime = (end - start).TotalSeconds;
- results.entropySpeed = (bufferSize / 1048576) / (end - start).TotalSeconds;
+ results.EntropyTime = (end - start).TotalSeconds;
+ results.EntropySpeed = (bufferSize / 1048576) / (end - start).TotalSeconds;
#endregion Entropy
#region Multitasking
@@ -551,14 +551,14 @@ namespace DiscImageChef.Core
allChecksums.End();
end = DateTime.Now;
mem = GC.GetTotalMemory(false);
- if(mem > results.maxMemory) results.maxMemory = mem;
- if(mem < results.minMemory) results.minMemory = mem;
+ if(mem > results.MaxMemory) results.MaxMemory = mem;
+ if(mem < results.MinMemory) results.MinMemory = mem;
- results.totalTime = (end - start).TotalSeconds;
- results.totalSpeed = (bufferSize / 1048576) / results.totalTime;
+ results.TotalTime = (end - start).TotalSeconds;
+ results.TotalSpeed = (bufferSize / 1048576) / results.TotalTime;
#endregion
- results.separateSpeed = (bufferSize / 1048576) / results.separateTime;
+ results.SeparateSpeed = (bufferSize / 1048576) / results.SeparateTime;
return results;
}
diff --git a/DiscImageChef.Core/Checksum.cs b/DiscImageChef.Core/Checksum.cs
index b79f22ef0..ccf4595c9 100644
--- a/DiscImageChef.Core/Checksum.cs
+++ b/DiscImageChef.Core/Checksum.cs
@@ -42,31 +42,31 @@ namespace DiscImageChef.Core
public enum EnableChecksum
{
Adler32 = 1,
- CRC16 = 2,
- CRC32 = 4,
- CRC64 = 8,
- MD5 = 16,
- RIPEMD160 = 32,
- SHA1 = 64,
- SHA256 = 128,
- SHA384 = 256,
- SHA512 = 512,
+ Crc16 = 2,
+ Crc32 = 4,
+ Crc64 = 8,
+ Md5 = 16,
+ Ripemd160 = 32,
+ Sha1 = 64,
+ Sha256 = 128,
+ Sha384 = 256,
+ Sha512 = 512,
SpamSum = 1024,
- All = Adler32 | CRC16 | CRC32 | CRC64 | MD5 | RIPEMD160 | SHA1 | SHA256 | SHA384 | SHA512 | SpamSum
+ All = Adler32 | Crc16 | Crc32 | Crc64 | Md5 | Ripemd160 | Sha1 | Sha256 | Sha384 | Sha512 | SpamSum
}
public class Checksum
{
- Adler32Context adler32ctx;
- CRC16Context crc16ctx;
- CRC32Context crc32ctx;
- CRC64Context crc64ctx;
- MD5Context md5ctx;
- RIPEMD160Context ripemd160ctx;
- SHA1Context sha1ctx;
- SHA256Context sha256ctx;
- SHA384Context sha384ctx;
- SHA512Context sha512ctx;
+ Adler32Context adler32Ctx;
+ Crc16Context crc16Ctx;
+ Crc32Context crc32Ctx;
+ Crc64Context crc64Ctx;
+ Md5Context md5Ctx;
+ Ripemd160Context ripemd160Ctx;
+ Sha1Context sha1Ctx;
+ Sha256Context sha256Ctx;
+ Sha384Context sha384Ctx;
+ Sha512Context sha512Ctx;
SpamSumContext ssctx;
Thread adlerThread;
@@ -81,17 +81,17 @@ namespace DiscImageChef.Core
Thread sha512Thread;
Thread spamsumThread;
- adlerPacket adlerPkt;
- crc16Packet crc16Pkt;
- crc32Packet crc32Pkt;
- crc64Packet crc64Pkt;
- md5Packet md5Pkt;
- ripemd160Packet ripemd160Pkt;
- sha1Packet sha1Pkt;
- sha256Packet sha256Pkt;
- sha384Packet sha384Pkt;
- sha512Packet sha512Pkt;
- spamsumPacket spamsumPkt;
+ AdlerPacket adlerPkt;
+ Crc16Packet crc16Pkt;
+ Crc32Packet crc32Pkt;
+ Crc64Packet crc64Pkt;
+ Md5Packet md5Pkt;
+ Ripemd160Packet ripemd160Pkt;
+ Sha1Packet sha1Pkt;
+ Sha256Packet sha256Pkt;
+ Sha384Packet sha384Pkt;
+ Sha512Packet sha512Pkt;
+ SpamsumPacket spamsumPkt;
EnableChecksum enabled;
@@ -101,169 +101,169 @@ namespace DiscImageChef.Core
if(enabled.HasFlag(EnableChecksum.Adler32))
{
- adler32ctx = new Adler32Context();
- adlerPkt = new adlerPacket();
- adler32ctx.Init();
- adlerPkt.context = adler32ctx;
+ adler32Ctx = new Adler32Context();
+ adlerPkt = new AdlerPacket();
+ adler32Ctx.Init();
+ adlerPkt.Context = adler32Ctx;
}
- if(enabled.HasFlag(EnableChecksum.CRC16))
+ if(enabled.HasFlag(EnableChecksum.Crc16))
{
- crc16ctx = new CRC16Context();
- crc16Pkt = new crc16Packet();
- crc16ctx.Init();
- crc16Pkt.context = crc16ctx;
+ crc16Ctx = new Crc16Context();
+ crc16Pkt = new Crc16Packet();
+ crc16Ctx.Init();
+ crc16Pkt.Context = crc16Ctx;
}
- if(enabled.HasFlag(EnableChecksum.CRC32))
+ if(enabled.HasFlag(EnableChecksum.Crc32))
{
- crc32ctx = new CRC32Context();
- crc32Pkt = new crc32Packet();
- crc32ctx.Init();
- crc32Pkt.context = crc32ctx;
+ crc32Ctx = new Crc32Context();
+ crc32Pkt = new Crc32Packet();
+ crc32Ctx.Init();
+ crc32Pkt.Context = crc32Ctx;
}
- if(enabled.HasFlag(EnableChecksum.CRC64))
+ if(enabled.HasFlag(EnableChecksum.Crc64))
{
- crc64ctx = new CRC64Context();
- crc64Pkt = new crc64Packet();
- crc64ctx.Init();
- crc64Pkt.context = crc64ctx;
+ crc64Ctx = new Crc64Context();
+ crc64Pkt = new Crc64Packet();
+ crc64Ctx.Init();
+ crc64Pkt.Context = crc64Ctx;
}
- if(enabled.HasFlag(EnableChecksum.MD5))
+ if(enabled.HasFlag(EnableChecksum.Md5))
{
- md5ctx = new MD5Context();
- md5Pkt = new md5Packet();
- md5ctx.Init();
- md5Pkt.context = md5ctx;
+ md5Ctx = new Md5Context();
+ md5Pkt = new Md5Packet();
+ md5Ctx.Init();
+ md5Pkt.Context = md5Ctx;
}
- if(enabled.HasFlag(EnableChecksum.RIPEMD160))
+ if(enabled.HasFlag(EnableChecksum.Ripemd160))
{
- ripemd160ctx = new RIPEMD160Context();
- ripemd160Pkt = new ripemd160Packet();
- ripemd160ctx.Init();
- ripemd160Pkt.context = ripemd160ctx;
+ ripemd160Ctx = new Ripemd160Context();
+ ripemd160Pkt = new Ripemd160Packet();
+ ripemd160Ctx.Init();
+ ripemd160Pkt.Context = ripemd160Ctx;
}
- if(enabled.HasFlag(EnableChecksum.SHA1))
+ if(enabled.HasFlag(EnableChecksum.Sha1))
{
- sha1ctx = new SHA1Context();
- sha1Pkt = new sha1Packet();
- sha1ctx.Init();
- sha1Pkt.context = sha1ctx;
+ sha1Ctx = new Sha1Context();
+ sha1Pkt = new Sha1Packet();
+ sha1Ctx.Init();
+ sha1Pkt.Context = sha1Ctx;
}
- if(enabled.HasFlag(EnableChecksum.SHA256))
+ if(enabled.HasFlag(EnableChecksum.Sha256))
{
- sha256ctx = new SHA256Context();
- sha256Pkt = new sha256Packet();
- sha256ctx.Init();
- sha256Pkt.context = sha256ctx;
+ sha256Ctx = new Sha256Context();
+ sha256Pkt = new Sha256Packet();
+ sha256Ctx.Init();
+ sha256Pkt.Context = sha256Ctx;
}
- if(enabled.HasFlag(EnableChecksum.SHA384))
+ if(enabled.HasFlag(EnableChecksum.Sha384))
{
- sha384ctx = new SHA384Context();
- sha384Pkt = new sha384Packet();
- sha384ctx.Init();
- sha384Pkt.context = sha384ctx;
+ sha384Ctx = new Sha384Context();
+ sha384Pkt = new Sha384Packet();
+ sha384Ctx.Init();
+ sha384Pkt.Context = sha384Ctx;
}
- if(enabled.HasFlag(EnableChecksum.SHA512))
+ if(enabled.HasFlag(EnableChecksum.Sha512))
{
- sha512ctx = new SHA512Context();
- sha512Pkt = new sha512Packet();
- sha512ctx.Init();
- sha512Pkt.context = sha512ctx;
+ sha512Ctx = new Sha512Context();
+ sha512Pkt = new Sha512Packet();
+ sha512Ctx.Init();
+ sha512Pkt.Context = sha512Ctx;
}
if(enabled.HasFlag(EnableChecksum.SpamSum))
{
ssctx = new SpamSumContext();
- spamsumPkt = new spamsumPacket();
+ spamsumPkt = new SpamsumPacket();
ssctx.Init();
- spamsumPkt.context = ssctx;
+ spamsumPkt.Context = ssctx;
}
- 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);
}
public void Update(byte[] data)
{
if(enabled.HasFlag(EnableChecksum.Adler32))
{
- adlerPkt.data = data;
+ adlerPkt.Data = data;
adlerThread.Start(adlerPkt);
}
- if(enabled.HasFlag(EnableChecksum.CRC16))
+ if(enabled.HasFlag(EnableChecksum.Crc16))
{
- crc16Pkt.data = data;
+ crc16Pkt.Data = data;
crc16Thread.Start(crc16Pkt);
}
- if(enabled.HasFlag(EnableChecksum.CRC32))
+ if(enabled.HasFlag(EnableChecksum.Crc32))
{
- crc32Pkt.data = data;
+ crc32Pkt.Data = data;
crc32Thread.Start(crc32Pkt);
}
- if(enabled.HasFlag(EnableChecksum.CRC64))
+ if(enabled.HasFlag(EnableChecksum.Crc64))
{
- crc64Pkt.data = data;
+ crc64Pkt.Data = data;
crc64Thread.Start(crc64Pkt);
}
- if(enabled.HasFlag(EnableChecksum.MD5))
+ if(enabled.HasFlag(EnableChecksum.Md5))
{
- md5Pkt.data = data;
+ md5Pkt.Data = data;
md5Thread.Start(md5Pkt);
}
- if(enabled.HasFlag(EnableChecksum.RIPEMD160))
+ if(enabled.HasFlag(EnableChecksum.Ripemd160))
{
- ripemd160Pkt.data = data;
+ ripemd160Pkt.Data = data;
ripemd160Thread.Start(ripemd160Pkt);
}
- if(enabled.HasFlag(EnableChecksum.SHA1))
+ if(enabled.HasFlag(EnableChecksum.Sha1))
{
- sha1Pkt.data = data;
+ sha1Pkt.Data = data;
sha1Thread.Start(sha1Pkt);
}
- if(enabled.HasFlag(EnableChecksum.SHA256))
+ if(enabled.HasFlag(EnableChecksum.Sha256))
{
- sha256Pkt.data = data;
+ sha256Pkt.Data = data;
sha256Thread.Start(sha256Pkt);
}
- if(enabled.HasFlag(EnableChecksum.SHA384))
+ if(enabled.HasFlag(EnableChecksum.Sha384))
{
- sha384Pkt.data = data;
+ sha384Pkt.Data = data;
sha384Thread.Start(sha384Pkt);
}
- if(enabled.HasFlag(EnableChecksum.SHA512))
+ if(enabled.HasFlag(EnableChecksum.Sha512))
{
- sha512Pkt.data = data;
+ sha512Pkt.Data = data;
sha512Thread.Start(sha512Pkt);
}
if(enabled.HasFlag(EnableChecksum.SpamSum))
{
- spamsumPkt.data = data;
+ spamsumPkt.Data = data;
spamsumThread.Start(spamsumPkt);
}
@@ -271,17 +271,17 @@ namespace DiscImageChef.Core
md5Thread.IsAlive || ripemd160Thread.IsAlive || sha1Thread.IsAlive || sha256Thread.IsAlive ||
sha384Thread.IsAlive || sha512Thread.IsAlive || spamsumThread.IsAlive) { }
- if(enabled.HasFlag(EnableChecksum.SpamSum)) adlerThread = new Thread(updateAdler);
- if(enabled.HasFlag(EnableChecksum.SpamSum)) crc16Thread = new Thread(updateCRC16);
- if(enabled.HasFlag(EnableChecksum.SpamSum)) crc32Thread = new Thread(updateCRC32);
- if(enabled.HasFlag(EnableChecksum.SpamSum)) crc64Thread = new Thread(updateCRC64);
- if(enabled.HasFlag(EnableChecksum.SpamSum)) md5Thread = new Thread(updateMD5);
- if(enabled.HasFlag(EnableChecksum.SpamSum)) ripemd160Thread = new Thread(updateRIPEMD160);
- if(enabled.HasFlag(EnableChecksum.SpamSum)) sha1Thread = new Thread(updateSHA1);
- if(enabled.HasFlag(EnableChecksum.SpamSum)) sha256Thread = new Thread(updateSHA256);
- if(enabled.HasFlag(EnableChecksum.SpamSum)) sha384Thread = new Thread(updateSHA384);
- if(enabled.HasFlag(EnableChecksum.SpamSum)) sha512Thread = new Thread(updateSHA512);
- if(enabled.HasFlag(EnableChecksum.SpamSum)) spamsumThread = new Thread(updateSpamSum);
+ if(enabled.HasFlag(EnableChecksum.SpamSum)) adlerThread = new Thread(UpdateAdler);
+ if(enabled.HasFlag(EnableChecksum.SpamSum)) crc16Thread = new Thread(UpdateCrc16);
+ if(enabled.HasFlag(EnableChecksum.SpamSum)) crc32Thread = new Thread(UpdateCrc32);
+ if(enabled.HasFlag(EnableChecksum.SpamSum)) crc64Thread = new Thread(UpdateCrc64);
+ if(enabled.HasFlag(EnableChecksum.SpamSum)) md5Thread = new Thread(UpdateMd5);
+ if(enabled.HasFlag(EnableChecksum.SpamSum)) ripemd160Thread = new Thread(UpdateRipemd160);
+ if(enabled.HasFlag(EnableChecksum.SpamSum)) sha1Thread = new Thread(UpdateSha1);
+ if(enabled.HasFlag(EnableChecksum.SpamSum)) sha256Thread = new Thread(UpdateSha256);
+ if(enabled.HasFlag(EnableChecksum.SpamSum)) sha384Thread = new Thread(UpdateSha384);
+ if(enabled.HasFlag(EnableChecksum.SpamSum)) sha512Thread = new Thread(UpdateSha512);
+ if(enabled.HasFlag(EnableChecksum.SpamSum)) spamsumThread = new Thread(UpdateSpamSum);
}
public List End()
@@ -294,79 +294,79 @@ namespace DiscImageChef.Core
{
chk = new ChecksumType();
chk.type = ChecksumTypeType.adler32;
- chk.Value = adler32ctx.End();
+ chk.Value = adler32Ctx.End();
chks.Add(chk);
}
- if(enabled.HasFlag(EnableChecksum.CRC16))
+ if(enabled.HasFlag(EnableChecksum.Crc16))
{
chk = new ChecksumType();
chk.type = ChecksumTypeType.crc16;
- chk.Value = crc16ctx.End();
+ chk.Value = crc16Ctx.End();
chks.Add(chk);
}
- if(enabled.HasFlag(EnableChecksum.CRC32))
+ if(enabled.HasFlag(EnableChecksum.Crc32))
{
chk = new ChecksumType();
chk.type = ChecksumTypeType.crc32;
- chk.Value = crc32ctx.End();
+ chk.Value = crc32Ctx.End();
chks.Add(chk);
}
- if(enabled.HasFlag(EnableChecksum.CRC64))
+ if(enabled.HasFlag(EnableChecksum.Crc64))
{
chk = new ChecksumType();
chk.type = ChecksumTypeType.crc64;
- chk.Value = crc64ctx.End();
+ chk.Value = crc64Ctx.End();
chks.Add(chk);
}
- if(enabled.HasFlag(EnableChecksum.MD5))
+ if(enabled.HasFlag(EnableChecksum.Md5))
{
chk = new ChecksumType();
chk.type = ChecksumTypeType.md5;
- chk.Value = md5ctx.End();
+ chk.Value = md5Ctx.End();
chks.Add(chk);
}
- if(enabled.HasFlag(EnableChecksum.RIPEMD160))
+ if(enabled.HasFlag(EnableChecksum.Ripemd160))
{
chk = new ChecksumType();
chk.type = ChecksumTypeType.ripemd160;
- chk.Value = ripemd160ctx.End();
+ chk.Value = ripemd160Ctx.End();
chks.Add(chk);
}
- if(enabled.HasFlag(EnableChecksum.SHA1))
+ if(enabled.HasFlag(EnableChecksum.Sha1))
{
chk = new ChecksumType();
chk.type = ChecksumTypeType.sha1;
- chk.Value = sha1ctx.End();
+ chk.Value = sha1Ctx.End();
chks.Add(chk);
}
- if(enabled.HasFlag(EnableChecksum.SHA256))
+ if(enabled.HasFlag(EnableChecksum.Sha256))
{
chk = new ChecksumType();
chk.type = ChecksumTypeType.sha256;
- chk.Value = sha256ctx.End();
+ chk.Value = sha256Ctx.End();
chks.Add(chk);
}
- if(enabled.HasFlag(EnableChecksum.SHA384))
+ if(enabled.HasFlag(EnableChecksum.Sha384))
{
chk = new ChecksumType();
chk.type = ChecksumTypeType.sha384;
- chk.Value = sha384ctx.End();
+ chk.Value = sha384Ctx.End();
chks.Add(chk);
}
- if(enabled.HasFlag(EnableChecksum.SHA512))
+ if(enabled.HasFlag(EnableChecksum.Sha512))
{
chk = new ChecksumType();
chk.type = ChecksumTypeType.sha512;
- chk.Value = sha512ctx.End();
+ chk.Value = sha512Ctx.End();
chks.Add(chk);
}
@@ -383,149 +383,149 @@ namespace DiscImageChef.Core
internal static List GetChecksums(byte[] data, EnableChecksum enabled = EnableChecksum.All)
{
- Adler32Context adler32ctxData = null;
- CRC16Context crc16ctxData = null;
- CRC32Context crc32ctxData = null;
- CRC64Context crc64ctxData = null;
- MD5Context md5ctxData = null;
- RIPEMD160Context ripemd160ctxData = null;
- SHA1Context sha1ctxData = null;
- SHA256Context sha256ctxData = null;
- SHA384Context sha384ctxData = null;
- SHA512Context sha512ctxData = null;
+ Adler32Context adler32CtxData = null;
+ Crc16Context crc16CtxData = null;
+ Crc32Context crc32CtxData = null;
+ Crc64Context crc64CtxData = null;
+ Md5Context md5CtxData = null;
+ Ripemd160Context ripemd160CtxData = null;
+ Sha1Context sha1CtxData = null;
+ Sha256Context sha256CtxData = null;
+ Sha384Context sha384CtxData = null;
+ Sha512Context sha512CtxData = null;
SpamSumContext ssctxData = null;
- adlerPacket adlerPktData;
- crc16Packet crc16PktData;
- crc32Packet crc32PktData;
- crc64Packet crc64PktData;
- md5Packet md5PktData;
- ripemd160Packet ripemd160PktData;
- sha1Packet sha1PktData;
- sha256Packet sha256PktData;
- sha384Packet sha384PktData;
- sha512Packet sha512PktData;
- spamsumPacket spamsumPktData;
+ AdlerPacket adlerPktData;
+ Crc16Packet crc16PktData;
+ Crc32Packet crc32PktData;
+ Crc64Packet crc64PktData;
+ Md5Packet md5PktData;
+ Ripemd160Packet ripemd160PktData;
+ Sha1Packet sha1PktData;
+ Sha256Packet sha256PktData;
+ Sha384Packet sha384PktData;
+ Sha512Packet sha512PktData;
+ SpamsumPacket spamsumPktData;
- Thread adlerThreadData = new Thread(updateAdler);
- Thread crc16ThreadData = new Thread(updateCRC16);
- Thread crc32ThreadData = new Thread(updateCRC32);
- Thread crc64ThreadData = new Thread(updateCRC64);
- Thread md5ThreadData = new Thread(updateMD5);
- Thread ripemd160ThreadData = new Thread(updateRIPEMD160);
- Thread sha1ThreadData = new Thread(updateSHA1);
- Thread sha256ThreadData = new Thread(updateSHA256);
- Thread sha384ThreadData = new Thread(updateSHA384);
- Thread sha512ThreadData = new Thread(updateSHA512);
- Thread spamsumThreadData = new Thread(updateSpamSum);
+ Thread adlerThreadData = new Thread(UpdateAdler);
+ Thread crc16ThreadData = new Thread(UpdateCrc16);
+ Thread crc32ThreadData = new Thread(UpdateCrc32);
+ Thread crc64ThreadData = new Thread(UpdateCrc64);
+ Thread md5ThreadData = new Thread(UpdateMd5);
+ Thread ripemd160ThreadData = new Thread(UpdateRipemd160);
+ Thread sha1ThreadData = new Thread(UpdateSha1);
+ Thread sha256ThreadData = new Thread(UpdateSha256);
+ Thread sha384ThreadData = new Thread(UpdateSha384);
+ Thread sha512ThreadData = new Thread(UpdateSha512);
+ Thread spamsumThreadData = new Thread(UpdateSpamSum);
if(enabled.HasFlag(EnableChecksum.SpamSum))
{
- adler32ctxData = new Adler32Context();
- adlerPktData = new adlerPacket();
- adler32ctxData.Init();
- adlerPktData.context = adler32ctxData;
- adlerPktData.data = data;
+ adler32CtxData = new Adler32Context();
+ adlerPktData = new AdlerPacket();
+ adler32CtxData.Init();
+ adlerPktData.Context = adler32CtxData;
+ adlerPktData.Data = data;
adlerThreadData.Start(adlerPktData);
}
if(enabled.HasFlag(EnableChecksum.SpamSum))
{
- crc16PktData = new crc16Packet();
- crc16ctxData = new CRC16Context();
- crc16ctxData.Init();
- crc16PktData.context = crc16ctxData;
- crc16PktData.data = data;
+ crc16PktData = new Crc16Packet();
+ crc16CtxData = new Crc16Context();
+ crc16CtxData.Init();
+ crc16PktData.Context = crc16CtxData;
+ crc16PktData.Data = data;
crc16ThreadData.Start(crc16PktData);
}
if(enabled.HasFlag(EnableChecksum.SpamSum))
{
- crc32PktData = new crc32Packet();
- crc32ctxData = new CRC32Context();
- crc32ctxData.Init();
- crc32PktData.context = crc32ctxData;
- crc32PktData.data = data;
+ crc32PktData = new Crc32Packet();
+ crc32CtxData = new Crc32Context();
+ crc32CtxData.Init();
+ crc32PktData.Context = crc32CtxData;
+ crc32PktData.Data = data;
crc32ThreadData.Start(crc32PktData);
}
if(enabled.HasFlag(EnableChecksum.SpamSum))
{
- crc64PktData = new crc64Packet();
- crc64ctxData = new CRC64Context();
- crc64ctxData.Init();
- crc64PktData.context = crc64ctxData;
- crc64PktData.data = data;
+ crc64PktData = new Crc64Packet();
+ crc64CtxData = new Crc64Context();
+ crc64CtxData.Init();
+ crc64PktData.Context = crc64CtxData;
+ crc64PktData.Data = data;
crc64ThreadData.Start(crc64PktData);
}
if(enabled.HasFlag(EnableChecksum.SpamSum))
{
- md5PktData = new md5Packet();
- md5ctxData = new MD5Context();
- md5ctxData.Init();
- md5PktData.context = md5ctxData;
- md5PktData.data = data;
+ md5PktData = new Md5Packet();
+ md5CtxData = new Md5Context();
+ md5CtxData.Init();
+ md5PktData.Context = md5CtxData;
+ md5PktData.Data = data;
md5ThreadData.Start(md5PktData);
}
if(enabled.HasFlag(EnableChecksum.SpamSum))
{
- ripemd160PktData = new ripemd160Packet();
- ripemd160ctxData = new RIPEMD160Context();
- ripemd160ctxData.Init();
- ripemd160PktData.context = ripemd160ctxData;
- ripemd160PktData.data = data;
+ ripemd160PktData = new Ripemd160Packet();
+ ripemd160CtxData = new Ripemd160Context();
+ ripemd160CtxData.Init();
+ ripemd160PktData.Context = ripemd160CtxData;
+ ripemd160PktData.Data = data;
ripemd160ThreadData.Start(ripemd160PktData);
}
if(enabled.HasFlag(EnableChecksum.SpamSum))
{
- sha1PktData = new sha1Packet();
- sha1ctxData = new SHA1Context();
- sha1ctxData.Init();
- sha1PktData.context = sha1ctxData;
- sha1PktData.data = data;
+ sha1PktData = new Sha1Packet();
+ sha1CtxData = new Sha1Context();
+ sha1CtxData.Init();
+ sha1PktData.Context = sha1CtxData;
+ sha1PktData.Data = data;
sha1ThreadData.Start(sha1PktData);
}
if(enabled.HasFlag(EnableChecksum.SpamSum))
{
- sha256PktData = new sha256Packet();
- sha256ctxData = new SHA256Context();
- sha256ctxData.Init();
- sha256PktData.context = sha256ctxData;
- sha256PktData.data = data;
+ sha256PktData = new Sha256Packet();
+ sha256CtxData = new Sha256Context();
+ sha256CtxData.Init();
+ sha256PktData.Context = sha256CtxData;
+ sha256PktData.Data = data;
sha256ThreadData.Start(sha256PktData);
}
if(enabled.HasFlag(EnableChecksum.SpamSum))
{
- sha384PktData = new sha384Packet();
- sha384ctxData = new SHA384Context();
- sha384ctxData.Init();
- sha384PktData.context = sha384ctxData;
- sha384PktData.data = data;
+ sha384PktData = new Sha384Packet();
+ sha384CtxData = new Sha384Context();
+ sha384CtxData.Init();
+ sha384PktData.Context = sha384CtxData;
+ sha384PktData.Data = data;
sha384ThreadData.Start(sha384PktData);
}
if(enabled.HasFlag(EnableChecksum.SpamSum))
{
- sha512PktData = new sha512Packet();
- sha512ctxData = new SHA512Context();
- sha512ctxData.Init();
- sha512PktData.context = sha512ctxData;
- sha512PktData.data = data;
+ sha512PktData = new Sha512Packet();
+ sha512CtxData = new Sha512Context();
+ sha512CtxData.Init();
+ sha512PktData.Context = sha512CtxData;
+ sha512PktData.Data = data;
sha512ThreadData.Start(sha512PktData);
}
if(enabled.HasFlag(EnableChecksum.SpamSum))
{
- spamsumPktData = new spamsumPacket();
+ spamsumPktData = new SpamsumPacket();
ssctxData = new SpamSumContext();
ssctxData.Init();
- spamsumPktData.context = ssctxData;
- spamsumPktData.data = data;
+ spamsumPktData.Context = ssctxData;
+ spamsumPktData.Data = data;
spamsumThreadData.Start(spamsumPktData);
}
@@ -541,79 +541,79 @@ namespace DiscImageChef.Core
{
chk = new ChecksumType();
chk.type = ChecksumTypeType.adler32;
- chk.Value = adler32ctxData.End();
+ chk.Value = adler32CtxData.End();
dataChecksums.Add(chk);
}
- if(enabled.HasFlag(EnableChecksum.CRC16))
+ if(enabled.HasFlag(EnableChecksum.Crc16))
{
chk = new ChecksumType();
chk.type = ChecksumTypeType.crc16;
- chk.Value = crc16ctxData.End();
+ chk.Value = crc16CtxData.End();
dataChecksums.Add(chk);
}
- if(enabled.HasFlag(EnableChecksum.CRC32))
+ if(enabled.HasFlag(EnableChecksum.Crc32))
{
chk = new ChecksumType();
chk.type = ChecksumTypeType.crc32;
- chk.Value = crc32ctxData.End();
+ chk.Value = crc32CtxData.End();
dataChecksums.Add(chk);
}
- if(enabled.HasFlag(EnableChecksum.CRC64))
+ if(enabled.HasFlag(EnableChecksum.Crc64))
{
chk = new ChecksumType();
chk.type = ChecksumTypeType.crc64;
- chk.Value = crc64ctxData.End();
+ chk.Value = crc64CtxData.End();
dataChecksums.Add(chk);
}
- if(enabled.HasFlag(EnableChecksum.MD5))
+ if(enabled.HasFlag(EnableChecksum.Md5))
{
chk = new ChecksumType();
chk.type = ChecksumTypeType.md5;
- chk.Value = md5ctxData.End();
+ chk.Value = md5CtxData.End();
dataChecksums.Add(chk);
}
- if(enabled.HasFlag(EnableChecksum.RIPEMD160))
+ if(enabled.HasFlag(EnableChecksum.Ripemd160))
{
chk = new ChecksumType();
chk.type = ChecksumTypeType.ripemd160;
- chk.Value = ripemd160ctxData.End();
+ chk.Value = ripemd160CtxData.End();
dataChecksums.Add(chk);
}
- if(enabled.HasFlag(EnableChecksum.SHA1))
+ if(enabled.HasFlag(EnableChecksum.Sha1))
{
chk = new ChecksumType();
chk.type = ChecksumTypeType.sha1;
- chk.Value = sha1ctxData.End();
+ chk.Value = sha1CtxData.End();
dataChecksums.Add(chk);
}
- if(enabled.HasFlag(EnableChecksum.SHA256))
+ if(enabled.HasFlag(EnableChecksum.Sha256))
{
chk = new ChecksumType();
chk.type = ChecksumTypeType.sha256;
- chk.Value = sha256ctxData.End();
+ chk.Value = sha256CtxData.End();
dataChecksums.Add(chk);
}
- if(enabled.HasFlag(EnableChecksum.SHA384))
+ if(enabled.HasFlag(EnableChecksum.Sha384))
{
chk = new ChecksumType();
chk.type = ChecksumTypeType.sha384;
- chk.Value = sha384ctxData.End();
+ chk.Value = sha384CtxData.End();
dataChecksums.Add(chk);
}
- if(enabled.HasFlag(EnableChecksum.SHA512))
+ if(enabled.HasFlag(EnableChecksum.Sha512))
{
chk = new ChecksumType();
chk.type = ChecksumTypeType.sha512;
- chk.Value = sha512ctxData.End();
+ chk.Value = sha512CtxData.End();
dataChecksums.Add(chk);
}
@@ -629,125 +629,125 @@ namespace DiscImageChef.Core
}
#region Threading helpers
- struct adlerPacket
+ struct AdlerPacket
{
- public Adler32Context context;
- public byte[] data;
+ public Adler32Context Context;
+ public byte[] Data;
}
- struct crc16Packet
+ struct Crc16Packet
{
- public CRC16Context context;
- public byte[] data;
+ public Crc16Context Context;
+ public byte[] Data;
}
- struct crc32Packet
+ struct Crc32Packet
{
- public CRC32Context context;
- public byte[] data;
+ public Crc32Context Context;
+ public byte[] Data;
}
- struct crc64Packet
+ struct Crc64Packet
{
- public CRC64Context context;
- public byte[] data;
+ public Crc64Context Context;
+ public byte[] Data;
}
- struct md5Packet
+ struct Md5Packet
{
- public MD5Context context;
- public byte[] data;
+ public Md5Context Context;
+ public byte[] Data;
}
- struct ripemd160Packet
+ struct Ripemd160Packet
{
- public RIPEMD160Context context;
- public byte[] data;
+ public Ripemd160Context Context;
+ public byte[] Data;
}
- struct sha1Packet
+ struct Sha1Packet
{
- public SHA1Context context;
- public byte[] data;
+ public Sha1Context Context;
+ public byte[] Data;
}
- struct sha256Packet
+ struct Sha256Packet
{
- public SHA256Context context;
- public byte[] data;
+ public Sha256Context Context;
+ public byte[] Data;
}
- struct sha384Packet
+ struct Sha384Packet
{
- public SHA384Context context;
- public byte[] data;
+ public Sha384Context Context;
+ public byte[] Data;
}
- struct sha512Packet
+ struct Sha512Packet
{
- public SHA512Context context;
- public byte[] data;
+ public Sha512Context Context;
+ public byte[] Data;
}
- struct spamsumPacket
+ struct SpamsumPacket
{
- public SpamSumContext context;
- public byte[] data;
+ public SpamSumContext Context;
+ public byte[] Data;
}
- static void updateAdler(object packet)
+ static void UpdateAdler(object packet)
{
- ((adlerPacket)packet).context.Update(((adlerPacket)packet).data);
+ ((AdlerPacket)packet).Context.Update(((AdlerPacket)packet).Data);
}
- static void updateCRC16(object packet)
+ static void UpdateCrc16(object packet)
{
- ((crc16Packet)packet).context.Update(((crc16Packet)packet).data);
+ ((Crc16Packet)packet).Context.Update(((Crc16Packet)packet).Data);
}
- static void updateCRC32(object packet)
+ static void UpdateCrc32(object packet)
{
- ((crc32Packet)packet).context.Update(((crc32Packet)packet).data);
+ ((Crc32Packet)packet).Context.Update(((Crc32Packet)packet).Data);
}
- static void updateCRC64(object packet)
+ static void UpdateCrc64(object packet)
{
- ((crc64Packet)packet).context.Update(((crc64Packet)packet).data);
+ ((Crc64Packet)packet).Context.Update(((Crc64Packet)packet).Data);
}
- static void updateMD5(object packet)
+ static void UpdateMd5(object packet)
{
- ((md5Packet)packet).context.Update(((md5Packet)packet).data);
+ ((Md5Packet)packet).Context.Update(((Md5Packet)packet).Data);
}
- static void updateRIPEMD160(object packet)
+ static void UpdateRipemd160(object packet)
{
- ((ripemd160Packet)packet).context.Update(((ripemd160Packet)packet).data);
+ ((Ripemd160Packet)packet).Context.Update(((Ripemd160Packet)packet).Data);
}
- static void updateSHA1(object packet)
+ static void UpdateSha1(object packet)
{
- ((sha1Packet)packet).context.Update(((sha1Packet)packet).data);
+ ((Sha1Packet)packet).Context.Update(((Sha1Packet)packet).Data);
}
- static void updateSHA256(object packet)
+ static void UpdateSha256(object packet)
{
- ((sha256Packet)packet).context.Update(((sha256Packet)packet).data);
+ ((Sha256Packet)packet).Context.Update(((Sha256Packet)packet).Data);
}
- static void updateSHA384(object packet)
+ static void UpdateSha384(object packet)
{
- ((sha384Packet)packet).context.Update(((sha384Packet)packet).data);
+ ((Sha384Packet)packet).Context.Update(((Sha384Packet)packet).Data);
}
- static void updateSHA512(object packet)
+ static void UpdateSha512(object packet)
{
- ((sha512Packet)packet).context.Update(((sha512Packet)packet).data);
+ ((Sha512Packet)packet).Context.Update(((Sha512Packet)packet).Data);
}
- static void updateSpamSum(object packet)
+ static void UpdateSpamSum(object packet)
{
- ((spamsumPacket)packet).context.Update(((spamsumPacket)packet).data);
+ ((SpamsumPacket)packet).Context.Update(((SpamsumPacket)packet).Data);
}
#endregion Threading helpers
}
diff --git a/DiscImageChef.Core/Devices/Dumping/ATA.cs b/DiscImageChef.Core/Devices/Dumping/ATA.cs
index ef27f40ee..36ce05345 100644
--- a/DiscImageChef.Core/Devices/Dumping/ATA.cs
+++ b/DiscImageChef.Core/Devices/Dumping/ATA.cs
@@ -41,22 +41,22 @@ using DiscImageChef.Decoders.PCMCIA;
using DiscImageChef.Devices;
using DiscImageChef.Filesystems;
using DiscImageChef.Filters;
-using DiscImageChef.ImagePlugins;
-using DiscImageChef.PartPlugins;
+using DiscImageChef.DiscImages;
+using DiscImageChef.Partitions;
using Schemas;
using Extents;
namespace DiscImageChef.Core.Devices.Dumping
{
- public class ATA
+ public class Ata
{
public static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force,
bool dumpRaw, bool persistent, bool stopOnError, ref Metadata.Resume resume,
ref DumpLog dumpLog, Encoding encoding)
{
bool aborted;
- MHDDLog mhddLog;
- IBGLog ibgLog;
+ MhddLog mhddLog;
+ IbgLog ibgLog;
if(dumpRaw)
{
@@ -84,24 +84,24 @@ namespace DiscImageChef.Core.Devices.Dumping
CICMMetadataType sidecar =
new CICMMetadataType() {BlockMedia = new BlockMediaType[] {new BlockMediaType()}};
- if(dev.IsUSB)
+ if(dev.IsUsb)
{
dumpLog.WriteLine("Reading USB descriptors.");
sidecar.BlockMedia[0].USB = new USBType
{
- ProductID = dev.USBProductID,
- VendorID = dev.USBVendorID,
+ ProductID = dev.UsbProductId,
+ VendorID = dev.UsbVendorId,
Descriptors = new DumpType
{
Image = outputPrefix + ".usbdescriptors.bin",
- Size = dev.USBDescriptors.Length,
- Checksums = Checksum.GetChecksums(dev.USBDescriptors).ToArray()
+ Size = dev.UsbDescriptors.Length,
+ Checksums = Checksum.GetChecksums(dev.UsbDescriptors).ToArray()
}
};
- DataFile.WriteTo("ATA Dump", sidecar.BlockMedia[0].USB.Descriptors.Image, dev.USBDescriptors);
+ DataFile.WriteTo("ATA Dump", sidecar.BlockMedia[0].USB.Descriptors.Image, dev.UsbDescriptors);
}
- if(dev.IsPCMCIA)
+ if(dev.IsPcmcia)
{
dumpLog.WriteLine("Reading PCMCIA CIS.");
sidecar.BlockMedia[0].PCMCIA = new PCMCIAType
@@ -109,13 +109,13 @@ namespace DiscImageChef.Core.Devices.Dumping
CIS = new DumpType
{
Image = outputPrefix + ".cis.bin",
- Size = dev.CIS.Length,
- Checksums = Checksum.GetChecksums(dev.CIS).ToArray()
+ Size = dev.Cis.Length,
+ Checksums = Checksum.GetChecksums(dev.Cis).ToArray()
}
};
- DataFile.WriteTo("ATA Dump", sidecar.BlockMedia[0].PCMCIA.CIS.Image, dev.CIS);
+ DataFile.WriteTo("ATA Dump", sidecar.BlockMedia[0].PCMCIA.CIS.Image, dev.Cis);
dumpLog.WriteLine("Decoding PCMCIA CIS.");
- Decoders.PCMCIA.Tuple[] tuples = CIS.GetTuples(dev.CIS);
+ Decoders.PCMCIA.Tuple[] tuples = CIS.GetTuples(dev.Cis);
if(tuples != null)
{
foreach(Decoders.PCMCIA.Tuple tuple in tuples)
@@ -222,17 +222,17 @@ namespace DiscImageChef.Core.Devices.Dumping
.Removable));
DumpHardwareType currentTry = null;
ExtentsULong extents = null;
- ResumeSupport.Process(ataReader.IsLBA, removable, blocks, dev.Manufacturer, dev.Model, dev.Serial,
- dev.PlatformID, ref resume, ref currentTry, ref extents);
+ ResumeSupport.Process(ataReader.IsLba, removable, blocks, dev.Manufacturer, dev.Model, dev.Serial,
+ dev.PlatformId, ref resume, ref currentTry, ref extents);
if(currentTry == null || extents == null)
throw new Exception("Could not process resume file, not continuing...");
- if(ataReader.IsLBA)
+ if(ataReader.IsLba)
{
DicConsole.WriteLine("Reading {0} sectors at a time.", blocksToRead);
- mhddLog = new MHDDLog(outputPrefix + ".mhddlog.bin", dev, blocks, blockSize, blocksToRead);
- ibgLog = new IBGLog(outputPrefix + ".ibg", currentProfile);
+ mhddLog = new MhddLog(outputPrefix + ".mhddlog.bin", dev, blocks, blockSize, blocksToRead);
+ ibgLog = new IbgLog(outputPrefix + ".ibg", currentProfile);
dumpFile = new DataFile(outputPrefix + ".bin");
if(resume.NextBlock > 0) dumpLog.WriteLine("Resuming from block {0}.", resume.NextBlock);
@@ -350,18 +350,18 @@ namespace DiscImageChef.Core.Devices.Dumping
}
else
{
- mhddLog = new MHDDLog(outputPrefix + ".mhddlog.bin", dev, blocks, blockSize, blocksToRead);
- ibgLog = new IBGLog(outputPrefix + ".ibg", currentProfile);
+ mhddLog = new MhddLog(outputPrefix + ".mhddlog.bin", dev, blocks, blockSize, blocksToRead);
+ ibgLog = new IbgLog(outputPrefix + ".ibg", currentProfile);
dumpFile = new DataFile(outputPrefix + ".bin");
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)
{
@@ -375,10 +375,10 @@ namespace DiscImageChef.Core.Devices.Dumping
if(currentSpeed < minSpeed && currentSpeed != 0) minSpeed = currentSpeed;
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
- DicConsole.Write("\rReading cylinder {0} head {1} sector {2} ({3:F3} MiB/sec.)", Cy, Hd,
- Sc, currentSpeed);
+ DicConsole.Write("\rReading cylinder {0} head {1} sector {2} ({3:F3} MiB/sec.)", cy, hd,
+ sc, currentSpeed);
- bool error = ataReader.ReadCHS(out cmdBuf, Cy, Hd, Sc, out duration);
+ bool error = ataReader.ReadChs(out cmdBuf, cy, hd, sc, out duration);
totalDuration += duration;
@@ -388,7 +388,7 @@ namespace DiscImageChef.Core.Devices.Dumping
ibgLog.Write(currentBlock, currentSpeed * 1024);
dumpFile.Write(cmdBuf);
extents.Add(currentBlock);
- dumpLog.WriteLine("Error reading cylinder {0} head {1} sector {2}.", Cy, Hd, Sc);
+ dumpLog.WriteLine("Error reading cylinder {0} head {1} sector {2}.", cy, hd, sc);
}
else
{
@@ -461,7 +461,7 @@ namespace DiscImageChef.Core.Devices.Dumping
PluginBase plugins = new PluginBase();
plugins.RegisterAllPlugins(encoding);
- ImagePlugin _imageFormat;
+ ImagePlugin imageFormat;
FiltersList filtersList = new FiltersList();
Filter inputFilter = filtersList.GetFilter(outputPrefix + ".bin");
@@ -472,16 +472,16 @@ namespace DiscImageChef.Core.Devices.Dumping
return;
}
- _imageFormat = ImageFormat.Detect(inputFilter);
+ imageFormat = ImageFormat.Detect(inputFilter);
PartitionType[] xmlFileSysInfo = null;
- try { if(!_imageFormat.OpenImage(inputFilter)) _imageFormat = null; }
- catch { _imageFormat = null; }
+ try { if(!imageFormat.OpenImage(inputFilter)) imageFormat = null; }
+ catch { imageFormat = null; }
- if(_imageFormat != null)
+ if(imageFormat != null)
{
dumpLog.WriteLine("Getting partitions.");
- List partitions = Partitions.GetAll(_imageFormat);
+ List partitions = Partitions.GetAll(imageFormat);
Partitions.AddSchemesToStats(partitions);
dumpLog.WriteLine("Found {0} partitions.", partitions.Count);
@@ -505,16 +505,16 @@ namespace DiscImageChef.Core.Devices.Dumping
i, partitions[i].Start, partitions[i].End, partitions[i].Type,
partitions[i].Scheme);
- foreach(Filesystem _plugin in plugins.PluginsList.Values)
+ foreach(Filesystem plugin in plugins.PluginsList.Values)
{
try
{
- if(_plugin.Identify(_imageFormat, partitions[i]))
+ if(plugin.Identify(imageFormat, partitions[i]))
{
- _plugin.GetInformation(_imageFormat, partitions[i], out string foo);
- lstFs.Add(_plugin.XmlFSType);
- Statistics.AddFilesystem(_plugin.XmlFSType.Type);
- dumpLog.WriteLine("Filesystem {0} found.", _plugin.XmlFSType.Type);
+ plugin.GetInformation(imageFormat, partitions[i], out string foo);
+ lstFs.Add(plugin.XmlFSType);
+ Statistics.AddFilesystem(plugin.XmlFSType.Type);
+ dumpLog.WriteLine("Filesystem {0} found.", plugin.XmlFSType.Type);
}
}
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
@@ -543,16 +543,16 @@ namespace DiscImageChef.Core.Devices.Dumping
Size = blocks * blockSize
};
- foreach(Filesystem _plugin in plugins.PluginsList.Values)
+ foreach(Filesystem plugin in plugins.PluginsList.Values)
{
try
{
- if(_plugin.Identify(_imageFormat, wholePart))
+ if(plugin.Identify(imageFormat, wholePart))
{
- _plugin.GetInformation(_imageFormat, wholePart, out string foo);
- lstFs.Add(_plugin.XmlFSType);
- Statistics.AddFilesystem(_plugin.XmlFSType.Type);
- dumpLog.WriteLine("Filesystem {0} found.", _plugin.XmlFSType.Type);
+ plugin.GetInformation(imageFormat, wholePart, out string foo);
+ lstFs.Add(plugin.XmlFSType);
+ Statistics.AddFilesystem(plugin.XmlFSType.Type);
+ dumpLog.WriteLine("Filesystem {0} found.", plugin.XmlFSType.Type);
}
}
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
@@ -571,7 +571,7 @@ namespace DiscImageChef.Core.Devices.Dumping
string xmlDskTyp, xmlDskSubTyp;
if(dev.IsCompactFlash)
Metadata.MediaType.MediaTypeToString(MediaType.CompactFlash, out xmlDskTyp, out xmlDskSubTyp);
- else if(dev.IsPCMCIA)
+ else if(dev.IsPcmcia)
Metadata.MediaType.MediaTypeToString(MediaType.PCCardTypeI, out xmlDskTyp, out xmlDskSubTyp);
else Metadata.MediaType.MediaTypeToString(MediaType.GENERIC_HDD, out xmlDskTyp, out xmlDskSubTyp);
sidecar.BlockMedia[0].DiskType = xmlDskTyp;
diff --git a/DiscImageChef.Core/Devices/Dumping/Alcohol120.cs b/DiscImageChef.Core/Devices/Dumping/Alcohol120.cs
index 5a0341935..5513baf08 100644
--- a/DiscImageChef.Core/Devices/Dumping/Alcohol120.cs
+++ b/DiscImageChef.Core/Devices/Dumping/Alcohol120.cs
@@ -36,7 +36,7 @@ using System.IO;
using System.Collections.Generic;
using System.Text;
using DiscImageChef.CommonTypes;
-using DiscImageChef.ImagePlugins;
+using DiscImageChef.DiscImages;
namespace DiscImageChef.Core.Devices.Dumping
{
@@ -121,17 +121,17 @@ namespace DiscImageChef.Core.Devices.Dumping
#region Internal enumerations
enum AlcoholMediumType : ushort
{
- CD = 0x00,
- CDR = 0x01,
- CDRW = 0x02,
- DVD = 0x10,
- DVDR = 0x12
+ Cd = 0x00,
+ Cdr = 0x01,
+ Cdrw = 0x02,
+ Dvd = 0x10,
+ Dvdr = 0x12
}
enum AlcoholTrackMode : byte
{
NoData = 0x00,
- DVD = 0x02,
+ Dvd = 0x02,
Audio = 0xA9,
Mode1 = 0xAA,
Mode2 = 0xAB,
@@ -205,7 +205,7 @@ namespace DiscImageChef.Core.Devices.Dumping
if(tracksArray[i].point >= 0xA0) continue;
if(!trackLengths.TryGetValue(tracksArray[i].point, out uint trkLen)) continue;
- if(tracksArray[i].mode == AlcoholTrackMode.DVD) { tracksArray[i].extraOffset = trkLen; }
+ if(tracksArray[i].mode == AlcoholTrackMode.Dvd) { tracksArray[i].extraOffset = trkLen; }
else
{
AlcoholTrackExtra extra = new AlcoholTrackExtra();
@@ -272,8 +272,8 @@ namespace DiscImageChef.Core.Devices.Dumping
Marshal.FreeHGlobal(trkPtr);
}
- if(header.type == AlcoholMediumType.CD || header.type == AlcoholMediumType.CDR ||
- header.type == AlcoholMediumType.CDRW)
+ if(header.type == AlcoholMediumType.Cd || header.type == AlcoholMediumType.Cdr ||
+ header.type == AlcoholMediumType.Cdrw)
{
foreach(AlcoholTrackExtra extra in extrasArray)
{
@@ -331,7 +331,7 @@ namespace DiscImageChef.Core.Devices.Dumping
case MediaType.DVDRDL:
case MediaType.DVDRW:
case MediaType.DVDRWDL:
- header.type = AlcoholMediumType.DVDR;
+ header.type = AlcoholMediumType.Dvdr;
break;
case MediaType.CD:
case MediaType.CDDA:
@@ -357,21 +357,21 @@ namespace DiscImageChef.Core.Devices.Dumping
case MediaType.VCDHD:
case MediaType.GDROM:
case MediaType.ThreeDO:
- header.type = AlcoholMediumType.CD;
+ header.type = AlcoholMediumType.Cd;
break;
case MediaType.CDR:
case MediaType.DDCDR:
case MediaType.GDR:
- header.type = AlcoholMediumType.CDR;
+ header.type = AlcoholMediumType.Cdr;
break;
case MediaType.CDRW:
case MediaType.DDCDRW:
case MediaType.CDMO:
case MediaType.CDMRW:
- header.type = AlcoholMediumType.CDRW;
+ header.type = AlcoholMediumType.Cdrw;
break;
default:
- header.type = AlcoholMediumType.DVD;
+ header.type = AlcoholMediumType.Dvd;
break;
}
}
@@ -404,18 +404,18 @@ namespace DiscImageChef.Core.Devices.Dumping
trkArray[i].mode = AlcoholTrackMode.Audio;
break;
case TrackType.Data:
- trkArray[i].mode = AlcoholTrackMode.DVD;
+ trkArray[i].mode = AlcoholTrackMode.Dvd;
break;
- case TrackType.CDMode1:
+ case TrackType.CdMode1:
trkArray[i].mode = AlcoholTrackMode.Mode1;
break;
- case TrackType.CDMode2Formless:
+ case TrackType.CdMode2Formless:
trkArray[i].mode = AlcoholTrackMode.Mode2;
break;
- case TrackType.CDMode2Form1:
+ case TrackType.CdMode2Form1:
trkArray[i].mode = AlcoholTrackMode.Mode2F1;
break;
- case TrackType.CDMode2Form2:
+ case TrackType.CdMode2Form2:
trkArray[i].mode = AlcoholTrackMode.Mode2F2;
break;
default: throw new ArgumentOutOfRangeException(nameof(mode), mode, null);
@@ -507,12 +507,12 @@ namespace DiscImageChef.Core.Devices.Dumping
sessions = new List(sess);
}
- internal void AddBCA(byte[] bca)
+ internal void AddBca(byte[] bca)
{
this.bca = bca;
}
- internal void AddPFI(byte[] pfi)
+ internal void AddPfi(byte[] pfi)
{
if(pfi.Length == 2052)
{
@@ -522,7 +522,7 @@ namespace DiscImageChef.Core.Devices.Dumping
else this.pfi = pfi;
}
- internal void AddDMI(byte[] dmi)
+ internal void AddDmi(byte[] dmi)
{
if(dmi.Length == 2052)
{
diff --git a/DiscImageChef.Core/Devices/Dumping/CompactDisc.cs b/DiscImageChef.Core/Devices/Dumping/CompactDisc.cs
index 814841dd7..ee860756a 100644
--- a/DiscImageChef.Core/Devices/Dumping/CompactDisc.cs
+++ b/DiscImageChef.Core/Devices/Dumping/CompactDisc.cs
@@ -43,7 +43,7 @@ using Extents;
namespace DiscImageChef.Core.Devices.Dumping
{
- using ImagePlugins;
+ using DiscImages;
using Metadata;
using MediaType = CommonTypes.MediaType;
using Session = Decoders.CD.Session;
@@ -56,8 +56,8 @@ namespace DiscImageChef.Core.Devices.Dumping
ref MediaType dskType, bool separateSubchannel, ref Resume resume,
ref DumpLog dumpLog, Alcohol120 alcohol, bool dumpLeadIn)
{
- MHDDLog mhddLog;
- IBGLog ibgLog;
+ MhddLog mhddLog;
+ IbgLog ibgLog;
bool sense = false;
ulong blocks = 0;
// TODO: Check subchannel support
@@ -252,7 +252,7 @@ namespace DiscImageChef.Core.Devices.Dumping
return;
}
- ImagePlugins.Session[] sessionsForAlcohol = new ImagePlugins.Session[toc.Value.LastCompleteSession];
+ DiscImages.Session[] sessionsForAlcohol = new DiscImages.Session[toc.Value.LastCompleteSession];
for(int i = 0; i < sessionsForAlcohol.Length; i++)
{
sessionsForAlcohol[i].SessionSequence = (ushort)(i + 1);
@@ -281,7 +281,7 @@ namespace DiscImageChef.Core.Devices.Dumping
toc.Value.TrackDescriptors.OrderBy(track => track.POINT).ToArray();
List trackList = new List();
long lastSector = 0;
- string lastMSF = null;
+ string lastMsf = null;
foreach(FullTOC.TrackDataDescriptor trk in sortedTracks)
{
if(trk.ADR == 1 || trk.ADR == 4)
@@ -341,8 +341,8 @@ namespace DiscImageChef.Core.Devices.Dumping
phour = trk.PHOUR;
}
- if(phour > 0) lastMSF = string.Format("{3:D2}:{0:D2}:{1:D2}:{2:D2}", pmin, psec, pframe, phour);
- else lastMSF = string.Format("{0:D2}:{1:D2}:{2:D2}", pmin, psec, pframe);
+ if(phour > 0) lastMsf = string.Format("{3:D2}:{0:D2}:{1:D2}:{2:D2}", pmin, psec, pframe, phour);
+ else lastMsf = string.Format("{0:D2}:{1:D2}:{2:D2}", pmin, psec, pframe);
lastSector = phour * 3600 * 75 + pmin * 60 * 75 + psec * 75 + pframe - 150;
}
}
@@ -376,7 +376,7 @@ namespace DiscImageChef.Core.Devices.Dumping
else tracks[t - 1].EndMSF = string.Format("{0:D2}:{1:D2}:{2:D2}", pmin, psec, pframe);
}
- tracks[tracks.Length - 1].EndMSF = lastMSF;
+ tracks[tracks.Length - 1].EndMSF = lastMsf;
tracks[tracks.Length - 1].EndSector = lastSector;
blocks = (ulong)(lastSector + 1);
@@ -399,7 +399,7 @@ namespace DiscImageChef.Core.Devices.Dumping
DumpHardwareType currentTry = null;
ExtentsULong extents = null;
- ResumeSupport.Process(true, true, blocks, dev.Manufacturer, dev.Model, dev.Serial, dev.PlatformID,
+ ResumeSupport.Process(true, true, blocks, dev.Manufacturer, dev.Model, dev.Serial, dev.PlatformId,
ref resume, ref currentTry, ref extents);
if(currentTry == null || extents == null)
throw new Exception("Could not process resume file, not continuing...");
@@ -420,7 +420,7 @@ namespace DiscImageChef.Core.Devices.Dumping
dumpLog.WriteLine("Reading Lead-in");
for(int leadInBlock = -150; leadInBlock < 0 && resume.NextBlock == 0; leadInBlock++)
{
- if(dev.PlatformID == Interop.PlatformID.FreeBSD)
+ if(dev.PlatformId == Interop.PlatformID.FreeBSD)
{
DicConsole.DebugWriteLine("Dump-Media",
"FreeBSD panics when reading CD Lead-in, see upstream bug #224253.");
@@ -515,7 +515,7 @@ namespace DiscImageChef.Core.Devices.Dumping
dumpLog.WriteLine("Device reports {0} blocks ({1} bytes).", blocks, blocks * blockSize);
dumpLog.WriteLine("Device can read {0} blocks at a time.", blocksToRead);
dumpLog.WriteLine("Device reports {0} bytes per logical block.", blockSize);
- dumpLog.WriteLine("SCSI device type: {0}.", dev.SCSIType);
+ dumpLog.WriteLine("SCSI device type: {0}.", dev.ScsiType);
dumpLog.WriteLine("Media identified as {0}.", dskType);
alcohol.SetMediaType(dskType);
@@ -523,8 +523,8 @@ namespace DiscImageChef.Core.Devices.Dumping
alcohol.SetExtension(".bin");
DataFile subFile = null;
if(separateSubchannel) subFile = new DataFile(outputPrefix + ".sub");
- mhddLog = new MHDDLog(outputPrefix + ".mhddlog.bin", dev, blocks, blockSize, blocksToRead);
- ibgLog = new IBGLog(outputPrefix + ".ibg", 0x0008);
+ mhddLog = new MhddLog(outputPrefix + ".mhddlog.bin", dev, blocks, blockSize, blocksToRead);
+ ibgLog = new IbgLog(outputPrefix + ".ibg", 0x0008);
dumpFile.Seek(resume.NextBlock, (ulong)sectorSize);
if(separateSubchannel) subFile.Seek(resume.NextBlock, subSize);
@@ -669,30 +669,30 @@ namespace DiscImageChef.Core.Devices.Dumping
resume.NextBlock = i + blocksToRead;
}
- ImagePlugins.TrackType trkType;
+ DiscImages.TrackType trkType;
switch(tracks[t].TrackType1)
{
case TrackTypeTrackType.audio:
- trkType = ImagePlugins.TrackType.Audio;
+ trkType = DiscImages.TrackType.Audio;
break;
case TrackTypeTrackType.mode1:
- trkType = ImagePlugins.TrackType.CDMode1;
+ trkType = DiscImages.TrackType.CdMode1;
break;
case TrackTypeTrackType.mode2:
- trkType = ImagePlugins.TrackType.CDMode2Formless;
+ trkType = DiscImages.TrackType.CdMode2Formless;
break;
case TrackTypeTrackType.m2f1:
- trkType = ImagePlugins.TrackType.CDMode2Form1;
+ trkType = DiscImages.TrackType.CdMode2Form1;
break;
case TrackTypeTrackType.m2f2:
- trkType = ImagePlugins.TrackType.CDMode2Form2;
+ trkType = DiscImages.TrackType.CdMode2Form2;
break;
case TrackTypeTrackType.dvd:
case TrackTypeTrackType.hddvd:
case TrackTypeTrackType.bluray:
case TrackTypeTrackType.ddcd:
case TrackTypeTrackType.mode0:
- trkType = ImagePlugins.TrackType.Data;
+ trkType = DiscImages.TrackType.Data;
break;
default: throw new ArgumentOutOfRangeException();
}
@@ -786,13 +786,13 @@ namespace DiscImageChef.Core.Devices.Dumping
{
sense = dev.ModeSense10(out readBuffer, out senseBuf, false, ScsiModeSensePageControl.Current,
0x01, dev.Timeout, out duration);
- if(!sense) currentMode = Decoders.SCSI.Modes.DecodeMode10(readBuffer, dev.SCSIType);
+ if(!sense) currentMode = Decoders.SCSI.Modes.DecodeMode10(readBuffer, dev.ScsiType);
}
- else currentMode = Decoders.SCSI.Modes.DecodeMode6(readBuffer, dev.SCSIType);
+ else currentMode = Decoders.SCSI.Modes.DecodeMode6(readBuffer, dev.ScsiType);
if(currentMode.HasValue) currentModePage = currentMode.Value.Pages[0];
- Decoders.SCSI.Modes.ModePage_01_MMC pgMMC =
+ Decoders.SCSI.Modes.ModePage_01_MMC pgMmc =
new Decoders.SCSI.Modes.ModePage_01_MMC {PS = false, ReadRetryCount = 255, Parameter = 0x20};
Decoders.SCSI.Modes.DecodedMode md = new Decoders.SCSI.Modes.DecodedMode
{
@@ -803,12 +803,12 @@ namespace DiscImageChef.Core.Devices.Dumping
{
Page = 0x01,
Subpage = 0x00,
- PageResponse = Decoders.SCSI.Modes.EncodeModePage_01_MMC(pgMMC)
+ PageResponse = Decoders.SCSI.Modes.EncodeModePage_01_MMC(pgMmc)
}
}
};
- md6 = Decoders.SCSI.Modes.EncodeMode6(md, dev.SCSIType);
- md10 = Decoders.SCSI.Modes.EncodeMode10(md, dev.SCSIType);
+ md6 = Decoders.SCSI.Modes.EncodeMode6(md, dev.ScsiType);
+ md10 = Decoders.SCSI.Modes.EncodeMode10(md, dev.ScsiType);
dumpLog.WriteLine("Sending MODE SELECT to drive.");
sense = dev.ModeSelect(md6, out senseBuf, true, false, dev.Timeout, out duration);
@@ -828,8 +828,8 @@ namespace DiscImageChef.Core.Devices.Dumping
Header = new Decoders.SCSI.Modes.ModeHeader(),
Pages = new Decoders.SCSI.Modes.ModePage[] {currentModePage.Value}
};
- md6 = Decoders.SCSI.Modes.EncodeMode6(md, dev.SCSIType);
- md10 = Decoders.SCSI.Modes.EncodeMode10(md, dev.SCSIType);
+ md6 = Decoders.SCSI.Modes.EncodeMode6(md, dev.ScsiType);
+ md10 = Decoders.SCSI.Modes.EncodeMode10(md, dev.ScsiType);
dumpLog.WriteLine("Sending MODE SELECT to drive.");
sense = dev.ModeSelect(md6, out senseBuf, true, false, dev.Timeout, out duration);
diff --git a/DiscImageChef.Core/Devices/Dumping/MMC.cs b/DiscImageChef.Core/Devices/Dumping/MMC.cs
index 65a4eaa24..f007ca081 100644
--- a/DiscImageChef.Core/Devices/Dumping/MMC.cs
+++ b/DiscImageChef.Core/Devices/Dumping/MMC.cs
@@ -40,7 +40,7 @@ using Schemas;
namespace DiscImageChef.Core.Devices.Dumping
{
- internal static class MMC
+ internal static class Mmc
{
internal static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force,
bool dumpRaw, bool persistent, bool stopOnError, ref CICMMetadataType sidecar,
@@ -182,7 +182,7 @@ namespace DiscImageChef.Core.Devices.Dumping
if(dskType == MediaType.Unknown && blocks > 0)
{
dumpLog.WriteLine("Reading Physical Format Information");
- sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0,
+ sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.PhysicalInformation, 0, dev.Timeout, out duration);
if(!sense)
{
@@ -210,11 +210,11 @@ namespace DiscImageChef.Core.Devices.Dumping
dskType == MediaType.HDDVDRW || dskType == MediaType.HDDVDRWDL)
{
dumpLog.WriteLine("Reading Physical Format Information");
- sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0,
+ sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.PhysicalInformation, 0, dev.Timeout, out duration);
if(!sense)
{
- alcohol.AddPFI(cmdBuf);
+ alcohol.AddPfi(cmdBuf);
if(Decoders.DVD.PFI.Decode(cmdBuf).HasValue)
{
tmpBuf = new byte[cmdBuf.Length - 4];
@@ -286,7 +286,7 @@ namespace DiscImageChef.Core.Devices.Dumping
}
dumpLog.WriteLine("Reading Disc Manufacturing Information");
- sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0,
+ sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.DiscManufacturingInformation, 0, dev.Timeout,
out duration);
if(!sense)
@@ -327,7 +327,7 @@ namespace DiscImageChef.Core.Devices.Dumping
isXbox = true;
}
- alcohol.AddDMI(cmdBuf);
+ alcohol.AddDmi(cmdBuf);
if(cmdBuf.Length == 2052)
{
@@ -349,7 +349,7 @@ namespace DiscImageChef.Core.Devices.Dumping
if(dskType == MediaType.DVDDownload || dskType == MediaType.DVDROM)
{
dumpLog.WriteLine("Reading Lead-in Copyright Information.");
- sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0,
+ sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.CopyrightInformation, 0, dev.Timeout,
out duration);
if(!sense)
@@ -379,13 +379,13 @@ namespace DiscImageChef.Core.Devices.Dumping
if(dskType == MediaType.DVDDownload || dskType == MediaType.DVDROM || dskType == MediaType.HDDVDROM)
{
dumpLog.WriteLine("Reading Burst Cutting Area.");
- sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0,
+ sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.BurstCuttingArea, 0, dev.Timeout, out duration);
if(!sense)
{
tmpBuf = new byte[cmdBuf.Length - 4];
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
- alcohol.AddBCA(tmpBuf);
+ alcohol.AddBca(tmpBuf);
sidecar.OpticalDisc[0].BCA = new DumpType
{
Image = outputPrefix + ".bca.bin",
@@ -401,8 +401,8 @@ namespace DiscImageChef.Core.Devices.Dumping
if(dskType == MediaType.DVDRAM || dskType == MediaType.HDDVDRAM)
{
dumpLog.WriteLine("Reading Disc Description Structure.");
- sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0,
- MmcDiscStructureFormat.DVDRAM_DDS, 0, dev.Timeout, out duration);
+ sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
+ MmcDiscStructureFormat.DvdramDds, 0, dev.Timeout, out duration);
if(!sense)
{
if(Decoders.DVD.DDS.Decode(cmdBuf).HasValue)
@@ -420,8 +420,8 @@ namespace DiscImageChef.Core.Devices.Dumping
}
dumpLog.WriteLine("Reading Spare Area Information.");
- sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0,
- MmcDiscStructureFormat.DVDRAM_SpareAreaInformation, 0, dev.Timeout,
+ sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
+ MmcDiscStructureFormat.DvdramSpareAreaInformation, 0, dev.Timeout,
out duration);
if(!sense)
{
@@ -445,7 +445,7 @@ namespace DiscImageChef.Core.Devices.Dumping
if(dskType == MediaType.DVDR || dskType == MediaType.DVDRW)
{
dumpLog.WriteLine("Reading Pre-Recorded Information.");
- sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0,
+ sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.PreRecordedInfo, 0, dev.Timeout, out duration);
if(!sense)
{
@@ -466,8 +466,8 @@ namespace DiscImageChef.Core.Devices.Dumping
if(dskType == MediaType.DVDR || dskType == MediaType.DVDRW || dskType == MediaType.HDDVDR)
{
dumpLog.WriteLine("Reading Media Identifier.");
- sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0,
- MmcDiscStructureFormat.DVDR_MediaIdentifier, 0, dev.Timeout,
+ sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
+ MmcDiscStructureFormat.DvdrMediaIdentifier, 0, dev.Timeout,
out duration);
if(!sense)
{
@@ -483,8 +483,8 @@ namespace DiscImageChef.Core.Devices.Dumping
}
dumpLog.WriteLine("Reading Recordable Physical Information.");
- sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0,
- MmcDiscStructureFormat.DVDR_PhysicalInformation, 0, dev.Timeout,
+ sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
+ MmcDiscStructureFormat.DvdrPhysicalInformation, 0, dev.Timeout,
out duration);
if(!sense)
{
@@ -506,8 +506,8 @@ namespace DiscImageChef.Core.Devices.Dumping
dskType == MediaType.DVDPRWDL)
{
dumpLog.WriteLine("Reading ADdress In Pregroove.");
- sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0,
- MmcDiscStructureFormat.ADIP, 0, dev.Timeout, out duration);
+ sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
+ MmcDiscStructureFormat.Adip, 0, dev.Timeout, out duration);
if(!sense)
{
tmpBuf = new byte[cmdBuf.Length - 4];
@@ -522,8 +522,8 @@ namespace DiscImageChef.Core.Devices.Dumping
}
dumpLog.WriteLine("Reading Disc Control Blocks.");
- sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0,
- MmcDiscStructureFormat.DCB, 0, dev.Timeout, out duration);
+ sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
+ MmcDiscStructureFormat.Dcb, 0, dev.Timeout, out duration);
if(!sense)
{
tmpBuf = new byte[cmdBuf.Length - 4];
@@ -543,8 +543,8 @@ namespace DiscImageChef.Core.Devices.Dumping
if(dskType == MediaType.HDDVDROM)
{
dumpLog.WriteLine("Reading Lead-in Copyright Information.");
- sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0,
- MmcDiscStructureFormat.HDDVD_CopyrightInformation, 0, dev.Timeout,
+ sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
+ MmcDiscStructureFormat.HddvdCopyrightInformation, 0, dev.Timeout,
out duration);
if(!sense)
{
@@ -566,7 +566,7 @@ namespace DiscImageChef.Core.Devices.Dumping
dskType == MediaType.BDRXL || dskType == MediaType.BDREXL)
{
dumpLog.WriteLine("Reading Disc Information.");
- sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0,
+ sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Bd, 0, 0,
MmcDiscStructureFormat.DiscInformation, 0, dev.Timeout, out duration);
if(!sense)
{
@@ -585,8 +585,8 @@ namespace DiscImageChef.Core.Devices.Dumping
}
dumpLog.WriteLine("Reading PAC.");
- sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0,
- MmcDiscStructureFormat.PAC, 0, dev.Timeout, out duration);
+ sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Bd, 0, 0,
+ MmcDiscStructureFormat.Pac, 0, dev.Timeout, out duration);
if(!sense)
{
tmpBuf = new byte[cmdBuf.Length - 4];
@@ -606,13 +606,13 @@ namespace DiscImageChef.Core.Devices.Dumping
if(dskType == MediaType.BDROM)
{
dumpLog.WriteLine("Reading Burst Cutting Area.");
- sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0,
- MmcDiscStructureFormat.BD_BurstCuttingArea, 0, dev.Timeout, out duration);
+ sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Bd, 0, 0,
+ MmcDiscStructureFormat.BdBurstCuttingArea, 0, dev.Timeout, out duration);
if(!sense)
{
tmpBuf = new byte[cmdBuf.Length - 4];
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
- alcohol.AddBCA(tmpBuf);
+ alcohol.AddBca(tmpBuf);
sidecar.OpticalDisc[0].BCA = new DumpType
{
Image = outputPrefix + ".bca.bin",
@@ -629,8 +629,8 @@ namespace DiscImageChef.Core.Devices.Dumping
dskType == MediaType.BDREXL)
{
dumpLog.WriteLine("Reading Disc Definition Structure.");
- sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0,
- MmcDiscStructureFormat.BD_DDS, 0, dev.Timeout, out duration);
+ sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Bd, 0, 0,
+ MmcDiscStructureFormat.BdDds, 0, dev.Timeout, out duration);
if(!sense)
{
tmpBuf = new byte[cmdBuf.Length - 4];
@@ -645,8 +645,8 @@ namespace DiscImageChef.Core.Devices.Dumping
}
dumpLog.WriteLine("Reading Spare Area Information.");
- sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0,
- MmcDiscStructureFormat.BD_SpareAreaInformation, 0, dev.Timeout,
+ sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.Bd, 0, 0,
+ MmcDiscStructureFormat.BdSpareAreaInformation, 0, dev.Timeout,
out duration);
if(!sense)
{
@@ -665,12 +665,12 @@ namespace DiscImageChef.Core.Devices.Dumping
if(isXbox)
{
- XGD.Dump(dev, devicePath, outputPrefix, retryPasses, force, dumpRaw, persistent, stopOnError,
+ Xgd.Dump(dev, devicePath, outputPrefix, retryPasses, force, dumpRaw, persistent, stopOnError,
ref sidecar, ref dskType, ref resume, ref dumpLog, encoding);
return;
}
- SBC.Dump(dev, devicePath, outputPrefix, retryPasses, force, dumpRaw, persistent, stopOnError, ref sidecar,
+ Sbc.Dump(dev, devicePath, outputPrefix, retryPasses, force, dumpRaw, persistent, stopOnError, ref sidecar,
ref dskType, true, ref resume, ref dumpLog, encoding, alcohol);
}
}
diff --git a/DiscImageChef.Core/Devices/Dumping/NVMe.cs b/DiscImageChef.Core/Devices/Dumping/NVMe.cs
index 42fd06209..2e96aec1e 100644
--- a/DiscImageChef.Core/Devices/Dumping/NVMe.cs
+++ b/DiscImageChef.Core/Devices/Dumping/NVMe.cs
@@ -37,7 +37,7 @@ using DiscImageChef.Core.Logging;
namespace DiscImageChef.Core.Devices.Dumping
{
- public static class NVMe
+ public static class NvMe
{
public static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force,
bool dumpRaw, bool persistent, bool stopOnError, ref Metadata.Resume resume,
diff --git a/DiscImageChef.Core/Devices/Dumping/ResumeSupport.cs b/DiscImageChef.Core/Devices/Dumping/ResumeSupport.cs
index e14c13222..3a95c38da 100644
--- a/DiscImageChef.Core/Devices/Dumping/ResumeSupport.cs
+++ b/DiscImageChef.Core/Devices/Dumping/ResumeSupport.cs
@@ -40,8 +40,8 @@ namespace DiscImageChef.Core.Devices.Dumping
{
static class ResumeSupport
{
- internal static void Process(bool isLba, bool removable, ulong blocks, string Manufacturer, string Model,
- string Serial, Interop.PlatformID platform, ref Resume resume,
+ internal static void Process(bool isLba, bool removable, ulong blocks, string manufacturer, string model,
+ string serial, Interop.PlatformID platform, ref Resume resume,
ref DumpHardwareType currentTry, ref ExtentsULong extents)
{
if(resume != null)
@@ -61,20 +61,20 @@ namespace DiscImageChef.Core.Devices.Dumping
foreach(DumpHardwareType oldtry in resume.Tries)
{
- if(oldtry.Manufacturer != Manufacturer && !removable)
+ if(oldtry.Manufacturer != manufacturer && !removable)
throw new
Exception(string.Format("Resume file specifies a device manufactured by {0} but you're requesting to dump one by {1}, not continuing...",
- oldtry.Manufacturer, Manufacturer));
+ oldtry.Manufacturer, manufacturer));
- if(oldtry.Model != Model && !removable)
+ if(oldtry.Model != model && !removable)
throw new
Exception(string.Format("Resume file specifies a device model {0} but you're requesting to dump model {1}, not continuing...",
- oldtry.Model, Model));
+ oldtry.Model, model));
- if(oldtry.Serial != Serial && !removable)
+ if(oldtry.Serial != serial && !removable)
throw new
Exception(string.Format("Resume file specifies a device with serial {0} but you're requesting to dump one with serial {1}, not continuing...",
- oldtry.Serial, Serial));
+ oldtry.Serial, serial));
if(oldtry.Software == null) throw new Exception("Found corrupt resume file, cannot continue...");
@@ -82,8 +82,8 @@ namespace DiscImageChef.Core.Devices.Dumping
oldtry.Software.OperatingSystem == platform.ToString() &&
oldtry.Software.Version == Version.GetVersion())
{
- if(removable && (oldtry.Manufacturer != Manufacturer || oldtry.Model != Model ||
- oldtry.Serial != Serial)) continue;
+ if(removable && (oldtry.Manufacturer != manufacturer || oldtry.Model != model ||
+ oldtry.Serial != serial)) continue;
currentTry = oldtry;
extents = ExtentsConverter.FromMetadata(currentTry.Extents);
@@ -96,9 +96,9 @@ namespace DiscImageChef.Core.Devices.Dumping
currentTry = new DumpHardwareType
{
Software = Version.GetSoftwareType(platform),
- Manufacturer = Manufacturer,
- Model = Model,
- Serial = Serial,
+ Manufacturer = manufacturer,
+ Model = model,
+ Serial = serial,
};
resume.Tries.Add(currentTry);
extents = new ExtentsULong();
@@ -116,9 +116,9 @@ namespace DiscImageChef.Core.Devices.Dumping
currentTry = new DumpHardwareType
{
Software = Version.GetSoftwareType(platform),
- Manufacturer = Manufacturer,
- Model = Model,
- Serial = Serial
+ Manufacturer = manufacturer,
+ Model = model,
+ Serial = serial
};
resume.Tries.Add(currentTry);
extents = new ExtentsULong();
diff --git a/DiscImageChef.Core/Devices/Dumping/SBC.cs b/DiscImageChef.Core/Devices/Dumping/SBC.cs
index fc7d2bb79..627c344b5 100644
--- a/DiscImageChef.Core/Devices/Dumping/SBC.cs
+++ b/DiscImageChef.Core/Devices/Dumping/SBC.cs
@@ -40,24 +40,24 @@ using DiscImageChef.Core.Logging;
using DiscImageChef.Devices;
using DiscImageChef.Filesystems;
using DiscImageChef.Filters;
-using DiscImageChef.ImagePlugins;
-using DiscImageChef.PartPlugins;
+using DiscImageChef.DiscImages;
+using DiscImageChef.Partitions;
using Schemas;
using Extents;
namespace DiscImageChef.Core.Devices.Dumping
{
- using TrackType = ImagePlugins.TrackType;
+ using TrackType = DiscImages.TrackType;
- internal static class SBC
+ internal static class Sbc
{
internal static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force,
bool dumpRaw, bool persistent, bool stopOnError, ref CICMMetadataType sidecar,
ref MediaType dskType, bool opticalDisc, ref Metadata.Resume resume,
ref DumpLog dumpLog, Encoding encoding, Alcohol120 alcohol = null)
{
- MHDDLog mhddLog;
- IBGLog ibgLog;
+ MhddLog mhddLog;
+ IbgLog ibgLog;
byte[] cmdBuf = null;
byte[] senseBuf = null;
bool sense = false;
@@ -122,10 +122,10 @@ namespace DiscImageChef.Core.Devices.Dumping
}
if(dskType == MediaType.Unknown)
- dskType = MediaTypeFromSCSI.Get((byte)dev.SCSIType, dev.Manufacturer, dev.Model, scsiMediumType,
+ dskType = MediaTypeFromScsi.Get((byte)dev.ScsiType, dev.Manufacturer, dev.Model, scsiMediumType,
scsiDensityCode, blocks, blockSize);
- if(dskType == MediaType.Unknown && dev.IsUSB && containsFloppyPage) dskType = MediaType.FlashDrive;
+ if(dskType == MediaType.Unknown && dev.IsUsb && containsFloppyPage) dskType = MediaType.FlashDrive;
DicConsole.WriteLine("Media identified as {0}", dskType);
@@ -133,7 +133,7 @@ namespace DiscImageChef.Core.Devices.Dumping
dumpLog.WriteLine("Device can read {0} blocks at a time.", blocksToRead);
dumpLog.WriteLine("Device reports {0} bytes per logical block.", blockSize);
dumpLog.WriteLine("Device reports {0} bytes per physical block.", scsiReader.LongBlockSize);
- dumpLog.WriteLine("SCSI device type: {0}.", dev.SCSIType);
+ dumpLog.WriteLine("SCSI device type: {0}.", dev.ScsiType);
dumpLog.WriteLine("SCSI medium type: {0}.", scsiMediumType);
dumpLog.WriteLine("SCSI density type: {0}.", scsiDensityCode);
dumpLog.WriteLine("SCSI floppy mode page present: {0}.", containsFloppyPage);
@@ -145,23 +145,23 @@ namespace DiscImageChef.Core.Devices.Dumping
sidecar.BlockMedia[0] = new BlockMediaType();
// All USB flash drives report as removable, even if the media is not removable
- if(!dev.IsRemovable || dev.IsUSB)
+ if(!dev.IsRemovable || dev.IsUsb)
{
- if(dev.IsUSB)
+ if(dev.IsUsb)
{
dumpLog.WriteLine("Reading USB descriptors.");
sidecar.BlockMedia[0].USB = new USBType
{
- ProductID = dev.USBProductID,
- VendorID = dev.USBVendorID,
+ ProductID = dev.UsbProductId,
+ VendorID = dev.UsbVendorId,
Descriptors = new DumpType()
{
Image = outputPrefix + ".usbdescriptors.bin",
- Size = dev.USBDescriptors.Length,
- Checksums = Checksum.GetChecksums(dev.USBDescriptors).ToArray()
+ Size = dev.UsbDescriptors.Length,
+ Checksums = Checksum.GetChecksums(dev.UsbDescriptors).ToArray()
}
};
- DataFile.WriteTo("SCSI Dump", sidecar.BlockMedia[0].USB.Descriptors.Image, dev.USBDescriptors);
+ DataFile.WriteTo("SCSI Dump", sidecar.BlockMedia[0].USB.Descriptors.Image, dev.UsbDescriptors);
}
if(dev.Type == DeviceType.ATAPI)
@@ -242,9 +242,9 @@ namespace DiscImageChef.Core.Devices.Dumping
if(!sense && !dev.Error)
{
- if(Decoders.SCSI.Modes.DecodeMode10(cmdBuf, dev.SCSIType).HasValue)
+ if(Decoders.SCSI.Modes.DecodeMode10(cmdBuf, dev.ScsiType).HasValue)
{
- decMode = Decoders.SCSI.Modes.DecodeMode10(cmdBuf, dev.SCSIType);
+ decMode = Decoders.SCSI.Modes.DecodeMode10(cmdBuf, dev.ScsiType);
sidecar.BlockMedia[0].SCSI.ModeSense10 = new DumpType
{
Image = outputPrefix + ".modesense10.bin",
@@ -265,9 +265,9 @@ namespace DiscImageChef.Core.Devices.Dumping
if(!sense && !dev.Error)
{
- if(Decoders.SCSI.Modes.DecodeMode6(cmdBuf, dev.SCSIType).HasValue)
+ if(Decoders.SCSI.Modes.DecodeMode6(cmdBuf, dev.ScsiType).HasValue)
{
- decMode = Decoders.SCSI.Modes.DecodeMode6(cmdBuf, dev.SCSIType);
+ decMode = Decoders.SCSI.Modes.DecodeMode6(cmdBuf, dev.ScsiType);
sidecar.BlockMedia[0].SCSI.ModeSense = new DumpType
{
Image = outputPrefix + ".modesense.bin",
@@ -336,8 +336,8 @@ namespace DiscImageChef.Core.Devices.Dumping
string outputExtension = ".bin";
if(opticalDisc && blockSize == 2048) outputExtension = ".iso";
- mhddLog = new MHDDLog(outputPrefix + ".mhddlog.bin", dev, blocks, blockSize, blocksToRead);
- ibgLog = new IBGLog(outputPrefix + ".ibg", currentProfile);
+ mhddLog = new MhddLog(outputPrefix + ".mhddlog.bin", dev, blocks, blockSize, blocksToRead);
+ ibgLog = new IbgLog(outputPrefix + ".ibg", currentProfile);
dumpFile = new DataFile(outputPrefix + outputExtension);
start = DateTime.UtcNow;
@@ -356,7 +356,7 @@ namespace DiscImageChef.Core.Devices.Dumping
DumpHardwareType currentTry = null;
ExtentsULong extents = null;
ResumeSupport.Process(true, dev.IsRemovable, blocks, dev.Manufacturer, dev.Model, dev.Serial,
- dev.PlatformID, ref resume, ref currentTry, ref extents);
+ dev.PlatformId, ref resume, ref currentTry, ref extents);
if(currentTry == null || extents == null)
throw new Exception("Could not process resume file, not continuing...");
@@ -483,15 +483,15 @@ namespace DiscImageChef.Core.Devices.Dumping
{
sense = dev.ModeSense10(out readBuffer, out senseBuf, false, ScsiModeSensePageControl.Current,
0x01, dev.Timeout, out duration);
- if(!sense) currentMode = Decoders.SCSI.Modes.DecodeMode10(readBuffer, dev.SCSIType);
+ if(!sense) currentMode = Decoders.SCSI.Modes.DecodeMode10(readBuffer, dev.ScsiType);
}
- else currentMode = Decoders.SCSI.Modes.DecodeMode6(readBuffer, dev.SCSIType);
+ else currentMode = Decoders.SCSI.Modes.DecodeMode6(readBuffer, dev.ScsiType);
if(currentMode.HasValue) currentModePage = currentMode.Value.Pages[0];
- if(dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
+ if(dev.ScsiType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
{
- Decoders.SCSI.Modes.ModePage_01_MMC pgMMC =
+ Decoders.SCSI.Modes.ModePage_01_MMC pgMmc =
new Decoders.SCSI.Modes.ModePage_01_MMC
{
PS = false,
@@ -507,12 +507,12 @@ namespace DiscImageChef.Core.Devices.Dumping
{
Page = 0x01,
Subpage = 0x00,
- PageResponse = Decoders.SCSI.Modes.EncodeModePage_01_MMC(pgMMC)
+ PageResponse = Decoders.SCSI.Modes.EncodeModePage_01_MMC(pgMmc)
}
}
};
- md6 = Decoders.SCSI.Modes.EncodeMode6(md, dev.SCSIType);
- md10 = Decoders.SCSI.Modes.EncodeMode10(md, dev.SCSIType);
+ md6 = Decoders.SCSI.Modes.EncodeMode6(md, dev.ScsiType);
+ md10 = Decoders.SCSI.Modes.EncodeMode10(md, dev.ScsiType);
}
else
{
@@ -542,8 +542,8 @@ namespace DiscImageChef.Core.Devices.Dumping
}
}
};
- md6 = Decoders.SCSI.Modes.EncodeMode6(md, dev.SCSIType);
- md10 = Decoders.SCSI.Modes.EncodeMode10(md, dev.SCSIType);
+ md6 = Decoders.SCSI.Modes.EncodeMode6(md, dev.ScsiType);
+ md10 = Decoders.SCSI.Modes.EncodeMode10(md, dev.ScsiType);
}
dumpLog.WriteLine("Sending MODE SELECT to drive.");
@@ -564,8 +564,8 @@ namespace DiscImageChef.Core.Devices.Dumping
Header = new Decoders.SCSI.Modes.ModeHeader(),
Pages = new Decoders.SCSI.Modes.ModePage[] {currentModePage.Value}
};
- md6 = Decoders.SCSI.Modes.EncodeMode6(md, dev.SCSIType);
- md10 = Decoders.SCSI.Modes.EncodeMode10(md, dev.SCSIType);
+ md6 = Decoders.SCSI.Modes.EncodeMode6(md, dev.ScsiType);
+ md10 = Decoders.SCSI.Modes.EncodeMode10(md, dev.ScsiType);
dumpLog.WriteLine("Sending MODE SELECT to drive.");
sense = dev.ModeSelect(md6, out senseBuf, true, false, dev.Timeout, out duration);
@@ -619,7 +619,7 @@ namespace DiscImageChef.Core.Devices.Dumping
PluginBase plugins = new PluginBase();
plugins.RegisterAllPlugins(encoding);
- ImagePlugin _imageFormat;
+ ImagePlugin imageFormat;
FiltersList filtersList = new FiltersList();
Filter inputFilter = filtersList.GetFilter(outputPrefix + outputExtension);
@@ -629,16 +629,16 @@ namespace DiscImageChef.Core.Devices.Dumping
return;
}
- _imageFormat = ImageFormat.Detect(inputFilter);
+ imageFormat = ImageFormat.Detect(inputFilter);
PartitionType[] xmlFileSysInfo = null;
- try { if(!_imageFormat.OpenImage(inputFilter)) _imageFormat = null; }
- catch { _imageFormat = null; }
+ try { if(!imageFormat.OpenImage(inputFilter)) imageFormat = null; }
+ catch { imageFormat = null; }
- if(_imageFormat != null)
+ if(imageFormat != null)
{
dumpLog.WriteLine("Getting partitions.");
- List partitions = Partitions.GetAll(_imageFormat);
+ List partitions = Partitions.GetAll(imageFormat);
Partitions.AddSchemesToStats(partitions);
dumpLog.WriteLine("Found {0} partitions.", partitions.Count);
@@ -661,22 +661,22 @@ namespace DiscImageChef.Core.Devices.Dumping
i, partitions[i].Start, partitions[i].End, partitions[i].Type,
partitions[i].Scheme);
- foreach(Filesystem _plugin in plugins.PluginsList.Values)
+ foreach(Filesystem plugin in plugins.PluginsList.Values)
{
try
{
- if(_plugin.Identify(_imageFormat, partitions[i]))
+ if(plugin.Identify(imageFormat, partitions[i]))
{
- _plugin.GetInformation(_imageFormat, partitions[i], out string foo);
- lstFs.Add(_plugin.XmlFSType);
- Statistics.AddFilesystem(_plugin.XmlFSType.Type);
- dumpLog.WriteLine("Filesystem {0} found.", _plugin.XmlFSType.Type);
+ plugin.GetInformation(imageFormat, partitions[i], out string foo);
+ lstFs.Add(plugin.XmlFSType);
+ Statistics.AddFilesystem(plugin.XmlFSType.Type);
+ dumpLog.WriteLine("Filesystem {0} found.", plugin.XmlFSType.Type);
- if(_plugin.XmlFSType.Type == "Opera") dskType = MediaType.ThreeDO;
- if(_plugin.XmlFSType.Type == "PC Engine filesystem")
+ if(plugin.XmlFSType.Type == "Opera") dskType = MediaType.ThreeDO;
+ if(plugin.XmlFSType.Type == "PC Engine filesystem")
dskType = MediaType.SuperCDROM2;
- if(_plugin.XmlFSType.Type == "Nintendo Wii filesystem") dskType = MediaType.WOD;
- if(_plugin.XmlFSType.Type == "Nintendo Gamecube filesystem")
+ if(plugin.XmlFSType.Type == "Nintendo Wii filesystem") dskType = MediaType.WOD;
+ if(plugin.XmlFSType.Type == "Nintendo Gamecube filesystem")
dskType = MediaType.GOD;
}
}
@@ -701,21 +701,21 @@ namespace DiscImageChef.Core.Devices.Dumping
Partition wholePart =
new Partition {Name = "Whole device", Length = blocks, Size = blocks * blockSize};
- foreach(Filesystem _plugin in plugins.PluginsList.Values)
+ foreach(Filesystem plugin in plugins.PluginsList.Values)
{
try
{
- if(_plugin.Identify(_imageFormat, wholePart))
+ if(plugin.Identify(imageFormat, wholePart))
{
- _plugin.GetInformation(_imageFormat, wholePart, out string foo);
- lstFs.Add(_plugin.XmlFSType);
- Statistics.AddFilesystem(_plugin.XmlFSType.Type);
- dumpLog.WriteLine("Filesystem {0} found.", _plugin.XmlFSType.Type);
+ plugin.GetInformation(imageFormat, wholePart, out string foo);
+ lstFs.Add(plugin.XmlFSType);
+ Statistics.AddFilesystem(plugin.XmlFSType.Type);
+ dumpLog.WriteLine("Filesystem {0} found.", plugin.XmlFSType.Type);
- if(_plugin.XmlFSType.Type == "Opera") dskType = MediaType.ThreeDO;
- if(_plugin.XmlFSType.Type == "PC Engine filesystem") dskType = MediaType.SuperCDROM2;
- if(_plugin.XmlFSType.Type == "Nintendo Wii filesystem") dskType = MediaType.WOD;
- if(_plugin.XmlFSType.Type == "Nintendo Gamecube filesystem") dskType = MediaType.GOD;
+ if(plugin.XmlFSType.Type == "Opera") dskType = MediaType.ThreeDO;
+ if(plugin.XmlFSType.Type == "PC Engine filesystem") dskType = MediaType.SuperCDROM2;
+ if(plugin.XmlFSType.Type == "Nintendo Wii filesystem") dskType = MediaType.WOD;
+ if(plugin.XmlFSType.Type == "Nintendo Gamecube filesystem") dskType = MediaType.GOD;
}
}
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
@@ -819,10 +819,10 @@ namespace DiscImageChef.Core.Devices.Dumping
format = "Raw disk image (sector by sector copy)",
Value = outputPrefix + ".bin"
};
- if(!dev.IsRemovable || dev.IsUSB)
+ if(!dev.IsRemovable || dev.IsUsb)
{
if(dev.Type == DeviceType.ATAPI) sidecar.BlockMedia[0].Interface = "ATAPI";
- else if(dev.IsUSB) sidecar.BlockMedia[0].Interface = "USB";
+ else if(dev.IsUsb) sidecar.BlockMedia[0].Interface = "USB";
else if(dev.IsFireWire) sidecar.BlockMedia[0].Interface = "FireWire";
else sidecar.BlockMedia[0].Interface = "SCSI";
}
diff --git a/DiscImageChef.Core/Devices/Dumping/SCSI.cs b/DiscImageChef.Core/Devices/Dumping/SCSI.cs
index a5868b81f..44b26a370 100644
--- a/DiscImageChef.Core/Devices/Dumping/SCSI.cs
+++ b/DiscImageChef.Core/Devices/Dumping/SCSI.cs
@@ -41,7 +41,7 @@ using Schemas;
namespace DiscImageChef.Core.Devices.Dumping
{
- public class SCSI
+ public class Scsi
{
// TODO: Get cartridge serial number from Certance vendor EVPD
public static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force,
@@ -173,22 +173,22 @@ namespace DiscImageChef.Core.Devices.Dumping
CICMMetadataType sidecar = new CICMMetadataType();
- if(dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess)
+ if(dev.ScsiType == Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess)
{
if(dumpRaw) throw new ArgumentException("Tapes cannot be dumped raw.");
- SSC.Dump(dev, outputPrefix, devicePath, ref sidecar, ref resume, ref dumpLog);
+ Ssc.Dump(dev, outputPrefix, devicePath, ref sidecar, ref resume, ref dumpLog);
return;
}
- if(dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
+ if(dev.ScsiType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
{
- MMC.Dump(dev, devicePath, outputPrefix, retryPasses, force, dumpRaw, persistent, stopOnError,
+ Mmc.Dump(dev, devicePath, outputPrefix, retryPasses, force, dumpRaw, persistent, stopOnError,
ref sidecar, ref dskType, separateSubchannel, ref resume, ref dumpLog, dumpLeadIn, encoding);
return;
}
- SBC.Dump(dev, devicePath, outputPrefix, retryPasses, force, dumpRaw, persistent, stopOnError, ref sidecar,
+ Sbc.Dump(dev, devicePath, outputPrefix, retryPasses, force, dumpRaw, persistent, stopOnError, ref sidecar,
ref dskType, false, ref resume, ref dumpLog, encoding);
}
}
diff --git a/DiscImageChef.Core/Devices/Dumping/SSC.cs b/DiscImageChef.Core/Devices/Dumping/SSC.cs
index 9fa46c0c3..528880621 100644
--- a/DiscImageChef.Core/Devices/Dumping/SSC.cs
+++ b/DiscImageChef.Core/Devices/Dumping/SSC.cs
@@ -42,15 +42,15 @@ using Schemas;
namespace DiscImageChef.Core.Devices.Dumping
{
- internal static class SSC
+ internal static class Ssc
{
internal static void Dump(Device dev, string outputPrefix, string devicePath, ref CICMMetadataType sidecar,
ref Metadata.Resume resume, ref DumpLog dumpLog)
{
Decoders.SCSI.FixedSense? fxSense;
bool aborted;
- MHDDLog mhddLog;
- IBGLog ibgLog;
+ MhddLog mhddLog;
+ IbgLog ibgLog;
bool sense = false;
ulong blocks = 0;
uint blockSize = 0;
@@ -226,9 +226,9 @@ namespace DiscImageChef.Core.Devices.Dumping
if(!sense && !dev.Error)
{
- if(Decoders.SCSI.Modes.DecodeMode10(cmdBuf, dev.SCSIType).HasValue)
+ if(Decoders.SCSI.Modes.DecodeMode10(cmdBuf, dev.ScsiType).HasValue)
{
- decMode = Decoders.SCSI.Modes.DecodeMode10(cmdBuf, dev.SCSIType);
+ decMode = Decoders.SCSI.Modes.DecodeMode10(cmdBuf, dev.ScsiType);
sidecar.BlockMedia[0].SCSI.ModeSense10 = new DumpType
{
Image = outputPrefix + ".modesense10.bin",
@@ -249,9 +249,9 @@ namespace DiscImageChef.Core.Devices.Dumping
if(!sense && !dev.Error)
{
- if(Decoders.SCSI.Modes.DecodeMode6(cmdBuf, dev.SCSIType).HasValue)
+ if(Decoders.SCSI.Modes.DecodeMode6(cmdBuf, dev.ScsiType).HasValue)
{
- decMode = Decoders.SCSI.Modes.DecodeMode6(cmdBuf, dev.SCSIType);
+ decMode = Decoders.SCSI.Modes.DecodeMode6(cmdBuf, dev.ScsiType);
sidecar.BlockMedia[0].SCSI.ModeSense = new DumpType
{
Image = outputPrefix + ".modesense.bin",
@@ -274,12 +274,12 @@ namespace DiscImageChef.Core.Devices.Dumping
else blockSize = 1;
if(dskType == MediaType.Unknown)
- dskType = MediaTypeFromSCSI.Get((byte)dev.SCSIType, dev.Manufacturer, dev.Model, scsiMediumTypeTape,
+ dskType = MediaTypeFromScsi.Get((byte)dev.ScsiType, dev.Manufacturer, dev.Model, scsiMediumTypeTape,
scsiDensityCodeTape, blocks, blockSize);
DicConsole.WriteLine("Media identified as {0}", dskType);
- dumpLog.WriteLine("SCSI device type: {0}.", dev.SCSIType);
+ dumpLog.WriteLine("SCSI device type: {0}.", dev.ScsiType);
dumpLog.WriteLine("SCSI medium type: {0}.", scsiMediumTypeTape);
dumpLog.WriteLine("SCSI density type: {0}.", scsiDensityCodeTape);
dumpLog.WriteLine("Media identified as {0}.", dskType);
@@ -383,8 +383,8 @@ namespace DiscImageChef.Core.Devices.Dumping
DataFile dumpFile = new DataFile(outputPrefix + ".bin");
dataChk = new Checksum();
start = DateTime.UtcNow;
- mhddLog = new MHDDLog(outputPrefix + ".mhddlog.bin", dev, blocks, blockSize, 1);
- ibgLog = new IBGLog(outputPrefix + ".ibg", 0x0008);
+ mhddLog = new MhddLog(outputPrefix + ".mhddlog.bin", dev, blocks, blockSize, 1);
+ ibgLog = new IbgLog(outputPrefix + ".ibg", 0x0008);
currentTapeFile = new TapeFileType
{
@@ -664,7 +664,7 @@ namespace DiscImageChef.Core.Devices.Dumping
sidecar.BlockMedia[0].DumpHardwareArray[0].Model = dev.Model;
sidecar.BlockMedia[0].DumpHardwareArray[0].Revision = dev.Revision;
sidecar.BlockMedia[0].DumpHardwareArray[0].Serial = dev.Serial;
- sidecar.BlockMedia[0].DumpHardwareArray[0].Software = Version.GetSoftwareType(dev.PlatformID);
+ sidecar.BlockMedia[0].DumpHardwareArray[0].Software = Version.GetSoftwareType(dev.PlatformId);
sidecar.BlockMedia[0].TapeInformation = partitions.ToArray();
if(!aborted)
diff --git a/DiscImageChef.Core/Devices/Dumping/SecureDigital.cs b/DiscImageChef.Core/Devices/Dumping/SecureDigital.cs
index 65ddfd2ce..ed6f534f5 100644
--- a/DiscImageChef.Core/Devices/Dumping/SecureDigital.cs
+++ b/DiscImageChef.Core/Devices/Dumping/SecureDigital.cs
@@ -41,7 +41,7 @@ using DiscImageChef.Decoders.MMC;
using DiscImageChef.Devices;
using DiscImageChef.Filesystems;
using DiscImageChef.Filters;
-using DiscImageChef.ImagePlugins;
+using DiscImageChef.DiscImages;
using Extents;
using Schemas;
@@ -54,8 +54,8 @@ namespace DiscImageChef.Core.Devices.Dumping
ref DumpLog dumpLog, Encoding encoding)
{
bool aborted;
- MHDDLog mhddLog;
- IBGLog ibgLog;
+ MhddLog mhddLog;
+ IbgLog ibgLog;
if(dumpRaw)
{
@@ -95,7 +95,7 @@ namespace DiscImageChef.Core.Devices.Dumping
CSD csdDecoded = new CSD();
dumpLog.WriteLine("Reading Extended CSD");
- sense = dev.ReadExtendedCSD(out ecsd, out response, timeout, out duration);
+ sense = dev.ReadExtendedCsd(out ecsd, out response, timeout, out duration);
if(!sense)
{
ecsdDecoded = Decoders.MMC.Decoders.DecodeExtendedCSD(ecsd);
@@ -110,7 +110,7 @@ namespace DiscImageChef.Core.Devices.Dumping
else ecsd = null;
dumpLog.WriteLine("Reading CSD");
- sense = dev.ReadCSD(out csd, out response, timeout, out duration);
+ sense = dev.ReadCsd(out csd, out response, timeout, out duration);
if(!sense)
{
if(blocks == 0)
@@ -123,7 +123,7 @@ namespace DiscImageChef.Core.Devices.Dumping
else csd = null;
dumpLog.WriteLine("Reading OCR");
- sense = dev.ReadOCR(out ocr, out response, timeout, out duration);
+ sense = dev.ReadOcr(out ocr, out response, timeout, out duration);
if(sense) ocr = null;
sidecar.BlockMedia[0].MultiMediaCard = new MultiMediaCardType();
@@ -133,7 +133,7 @@ namespace DiscImageChef.Core.Devices.Dumping
Decoders.SecureDigital.CSD csdDecoded = new Decoders.SecureDigital.CSD();
dumpLog.WriteLine("Reading CSD");
- sense = dev.ReadCSD(out csd, out response, timeout, out duration);
+ sense = dev.ReadCsd(out csd, out response, timeout, out duration);
if(!sense)
{
csdDecoded = Decoders.SecureDigital.Decoders.DecodeCSD(csd);
@@ -147,18 +147,18 @@ namespace DiscImageChef.Core.Devices.Dumping
else csd = null;
dumpLog.WriteLine("Reading OCR");
- sense = dev.ReadSDOCR(out ocr, out response, timeout, out duration);
+ sense = dev.ReadSdocr(out ocr, out response, timeout, out duration);
if(sense) ocr = null;
dumpLog.WriteLine("Reading SCR");
- sense = dev.ReadSCR(out scr, out response, timeout, out duration);
+ sense = dev.ReadScr(out scr, out response, timeout, out duration);
if(sense) scr = null;
sidecar.BlockMedia[0].SecureDigital = new SecureDigitalType();
}
dumpLog.WriteLine("Reading CID");
- sense = dev.ReadCID(out cid, out response, timeout, out duration);
+ sense = dev.ReadCid(out cid, out response, timeout, out duration);
if(sense) cid = null;
DumpType cidDump = null;
@@ -283,15 +283,15 @@ namespace DiscImageChef.Core.Devices.Dumping
DumpHardwareType currentTry = null;
ExtentsULong extents = null;
- ResumeSupport.Process(true, false, blocks, dev.Manufacturer, dev.Model, dev.Serial, dev.PlatformID,
+ ResumeSupport.Process(true, false, blocks, dev.Manufacturer, dev.Model, dev.Serial, dev.PlatformId,
ref resume, ref currentTry, ref extents);
if(currentTry == null || extents == null)
throw new Exception("Could not process resume file, not continuing...");
DicConsole.WriteLine("Reading {0} sectors at a time.", blocksToRead);
- mhddLog = new MHDDLog(outputPrefix + ".mhddlog.bin", dev, blocks, blockSize, blocksToRead);
- ibgLog = new IBGLog(outputPrefix + ".ibg", currentProfile);
+ mhddLog = new MhddLog(outputPrefix + ".mhddlog.bin", dev, blocks, blockSize, blocksToRead);
+ ibgLog = new IbgLog(outputPrefix + ".ibg", currentProfile);
dumpFile = new DataFile(outputPrefix + ".bin");
dumpFile.Seek(resume.NextBlock, blockSize);
if(resume.NextBlock > 0) dumpLog.WriteLine("Resuming from block {0}.", resume.NextBlock);
@@ -445,7 +445,7 @@ namespace DiscImageChef.Core.Devices.Dumping
PluginBase plugins = new PluginBase();
plugins.RegisterAllPlugins(encoding);
- ImagePlugin _imageFormat;
+ ImagePlugin imageFormat;
FiltersList filtersList = new FiltersList();
Filter inputFilter = filtersList.GetFilter(outputPrefix + ".bin");
@@ -456,16 +456,16 @@ namespace DiscImageChef.Core.Devices.Dumping
return;
}
- _imageFormat = ImageFormat.Detect(inputFilter);
+ imageFormat = ImageFormat.Detect(inputFilter);
PartitionType[] xmlFileSysInfo = null;
- try { if(!_imageFormat.OpenImage(inputFilter)) _imageFormat = null; }
- catch { _imageFormat = null; }
+ try { if(!imageFormat.OpenImage(inputFilter)) imageFormat = null; }
+ catch { imageFormat = null; }
- if(_imageFormat != null)
+ if(imageFormat != null)
{
dumpLog.WriteLine("Getting partitions.");
- List partitions = Partitions.GetAll(_imageFormat);
+ List partitions = Partitions.GetAll(imageFormat);
Partitions.AddSchemesToStats(partitions);
dumpLog.WriteLine("Found {0} partitions.", partitions.Count);
@@ -488,16 +488,16 @@ namespace DiscImageChef.Core.Devices.Dumping
i, partitions[i].Start, partitions[i].End, partitions[i].Type,
partitions[i].Scheme);
- foreach(Filesystem _plugin in plugins.PluginsList.Values)
+ foreach(Filesystem plugin in plugins.PluginsList.Values)
{
try
{
- if(_plugin.Identify(_imageFormat, partitions[i]))
+ if(plugin.Identify(imageFormat, partitions[i]))
{
- _plugin.GetInformation(_imageFormat, partitions[i], out string foo);
- lstFs.Add(_plugin.XmlFSType);
- Statistics.AddFilesystem(_plugin.XmlFSType.Type);
- dumpLog.WriteLine("Filesystem {0} found.", _plugin.XmlFSType.Type);
+ plugin.GetInformation(imageFormat, partitions[i], out string foo);
+ lstFs.Add(plugin.XmlFSType);
+ Statistics.AddFilesystem(plugin.XmlFSType.Type);
+ dumpLog.WriteLine("Filesystem {0} found.", plugin.XmlFSType.Type);
}
}
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
@@ -522,16 +522,16 @@ namespace DiscImageChef.Core.Devices.Dumping
Partition wholePart =
new Partition {Name = "Whole device", Length = blocks, Size = blocks * blockSize};
- foreach(Filesystem _plugin in plugins.PluginsList.Values)
+ foreach(Filesystem plugin in plugins.PluginsList.Values)
{
try
{
- if(_plugin.Identify(_imageFormat, wholePart))
+ if(plugin.Identify(imageFormat, wholePart))
{
- _plugin.GetInformation(_imageFormat, wholePart, out string foo);
- lstFs.Add(_plugin.XmlFSType);
- Statistics.AddFilesystem(_plugin.XmlFSType.Type);
- dumpLog.WriteLine("Filesystem {0} found.", _plugin.XmlFSType.Type);
+ plugin.GetInformation(imageFormat, wholePart, out string foo);
+ lstFs.Add(plugin.XmlFSType);
+ Statistics.AddFilesystem(plugin.XmlFSType.Type);
+ dumpLog.WriteLine("Filesystem {0} found.", plugin.XmlFSType.Type);
}
}
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
diff --git a/DiscImageChef.Core/Devices/Dumping/XGD.cs b/DiscImageChef.Core/Devices/Dumping/XGD.cs
index d77f5b8e7..187d294fd 100644
--- a/DiscImageChef.Core/Devices/Dumping/XGD.cs
+++ b/DiscImageChef.Core/Devices/Dumping/XGD.cs
@@ -40,22 +40,22 @@ using DiscImageChef.Core.Logging;
using DiscImageChef.Devices;
using DiscImageChef.Filesystems;
using DiscImageChef.Filters;
-using DiscImageChef.ImagePlugins;
-using DiscImageChef.PartPlugins;
+using DiscImageChef.DiscImages;
+using DiscImageChef.Partitions;
using Extents;
using Schemas;
namespace DiscImageChef.Core.Devices.Dumping
{
- internal static class XGD
+ internal static class Xgd
{
internal static void Dump(Device dev, string devicePath, string outputPrefix, ushort retryPasses, bool force,
bool dumpRaw, bool persistent, bool stopOnError, ref CICMMetadataType sidecar,
ref MediaType dskType, ref Metadata.Resume resume, ref DumpLog dumpLog,
Encoding encoding)
{
- MHDDLog mhddLog;
- IBGLog ibgLog;
+ MhddLog mhddLog;
+ IbgLog ibgLog;
bool sense = false;
ulong blocks = 0;
uint blockSize = 2048;
@@ -74,7 +74,7 @@ namespace DiscImageChef.Core.Devices.Dumping
System.Console.CancelKeyPress += (sender, e) => { e.Cancel = aborted = true; };
dumpLog.WriteLine("Reading Xbox Security Sector.");
- sense = dev.KreonExtractSS(out byte[] ssBuf, out byte[] senseBuf, dev.Timeout, out double duration);
+ sense = dev.KreonExtractSs(out byte[] ssBuf, out byte[] senseBuf, dev.Timeout, out double duration);
if(sense)
{
dumpLog.WriteLine("Cannot get Xbox Security Sector, not continuing.");
@@ -83,8 +83,8 @@ namespace DiscImageChef.Core.Devices.Dumping
}
dumpLog.WriteLine("Decoding Xbox Security Sector.");
- Decoders.Xbox.SS.SecuritySector? xboxSS = Decoders.Xbox.SS.Decode(ssBuf);
- if(!xboxSS.HasValue)
+ Decoders.Xbox.SS.SecuritySector? xboxSs = Decoders.Xbox.SS.Decode(ssBuf);
+ if(!xboxSs.HasValue)
{
dumpLog.WriteLine("Cannot decode Xbox Security Sector, not continuing.");
DicConsole.ErrorWriteLine("Cannot decode Xbox Security Sector, not continuing.");
@@ -136,7 +136,7 @@ namespace DiscImageChef.Core.Devices.Dumping
totalSize = (ulong)((readBuffer[0] << 24) + (readBuffer[1] << 16) + (readBuffer[2] << 8) + (readBuffer[3]));
dumpLog.WriteLine("Reading Physical Format Information.");
- sense = dev.ReadDiscStructure(out readBuffer, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0,
+ sense = dev.ReadDiscStructure(out readBuffer, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.PhysicalInformation, 0, 0, out duration);
if(sense)
{
@@ -159,7 +159,7 @@ namespace DiscImageChef.Core.Devices.Dumping
Decoders.DVD.PFI.Decode(readBuffer).Value.DataAreaStartPSN + 1;
l1Video = totalSize - l0Video + 1;
dumpLog.WriteLine("Reading Disc Manufacturing Information.");
- sense = dev.ReadDiscStructure(out readBuffer, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0,
+ sense = dev.ReadDiscStructure(out readBuffer, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.DiscManufacturingInformation, 0, 0, out duration);
if(sense)
{
@@ -224,7 +224,7 @@ namespace DiscImageChef.Core.Devices.Dumping
totalSize = (ulong)((readBuffer[0] << 24) + (readBuffer[1] << 16) + (readBuffer[2] << 8) + (readBuffer[3]));
dumpLog.WriteLine("Reading Physical Format Information.");
- sense = dev.ReadDiscStructure(out readBuffer, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0,
+ sense = dev.ReadDiscStructure(out readBuffer, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.PhysicalInformation, 0, 0, out duration);
if(sense)
{
@@ -249,7 +249,7 @@ namespace DiscImageChef.Core.Devices.Dumping
DataFile.WriteTo("SCSI Dump", sidecar.OpticalDisc[0].Xbox.PFI.Image, tmpBuf, "Unlocked PFI", true);
dumpLog.WriteLine("Reading Disc Manufacturing Information.");
- sense = dev.ReadDiscStructure(out readBuffer, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0,
+ sense = dev.ReadDiscStructure(out readBuffer, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.DiscManufacturingInformation, 0, 0, out duration);
if(sense)
{
@@ -320,8 +320,8 @@ namespace DiscImageChef.Core.Devices.Dumping
dumpLog.WriteLine("Reading {0} sectors at a time.", blocksToRead);
DicConsole.WriteLine("Reading {0} sectors at a time.", blocksToRead);
- mhddLog = new MHDDLog(outputPrefix + ".mhddlog.bin", dev, blocks, blockSize, blocksToRead);
- ibgLog = new IBGLog(outputPrefix + ".ibg", 0x0010);
+ mhddLog = new MhddLog(outputPrefix + ".mhddlog.bin", dev, blocks, blockSize, blocksToRead);
+ ibgLog = new IbgLog(outputPrefix + ".ibg", 0x0010);
dumpFile = new DataFile(outputPrefix + ".iso");
start = DateTime.UtcNow;
@@ -332,7 +332,7 @@ namespace DiscImageChef.Core.Devices.Dumping
uint saveBlocksToRead = blocksToRead;
DumpHardwareType currentTry = null;
ExtentsULong extents = null;
- ResumeSupport.Process(true, true, totalSize, dev.Manufacturer, dev.Model, dev.Serial, dev.PlatformID,
+ ResumeSupport.Process(true, true, totalSize, dev.Manufacturer, dev.Model, dev.Serial, dev.PlatformId,
ref resume, ref currentTry, ref extents);
if(currentTry == null || extents == null)
throw new Exception("Could not process resume file, not continuing...");
@@ -358,16 +358,16 @@ namespace DiscImageChef.Core.Devices.Dumping
// Extents
if(e < 16)
{
- if(xboxSS.Value.Extents[e].StartPSN <= xboxSS.Value.Layer0EndPSN)
- extentStart = xboxSS.Value.Extents[e].StartPSN - 0x30000;
+ if(xboxSs.Value.Extents[e].StartPSN <= xboxSs.Value.Layer0EndPSN)
+ extentStart = xboxSs.Value.Extents[e].StartPSN - 0x30000;
else
- extentStart = (xboxSS.Value.Layer0EndPSN + 1) * 2 -
- ((xboxSS.Value.Extents[e].StartPSN ^ 0xFFFFFF) + 1) - 0x30000;
- if(xboxSS.Value.Extents[e].EndPSN <= xboxSS.Value.Layer0EndPSN)
- extentEnd = xboxSS.Value.Extents[e].EndPSN - 0x30000;
+ extentStart = (xboxSs.Value.Layer0EndPSN + 1) * 2 -
+ ((xboxSs.Value.Extents[e].StartPSN ^ 0xFFFFFF) + 1) - 0x30000;
+ if(xboxSs.Value.Extents[e].EndPSN <= xboxSs.Value.Layer0EndPSN)
+ extentEnd = xboxSs.Value.Extents[e].EndPSN - 0x30000;
else
- extentEnd = (xboxSS.Value.Layer0EndPSN + 1) * 2 -
- ((xboxSS.Value.Extents[e].EndPSN ^ 0xFFFFFF) + 1) - 0x30000;
+ extentEnd = (xboxSs.Value.Layer0EndPSN + 1) * 2 -
+ ((xboxSs.Value.Extents[e].EndPSN ^ 0xFFFFFF) + 1) - 0x30000;
}
// After last extent
else
@@ -667,15 +667,15 @@ namespace DiscImageChef.Core.Devices.Dumping
{
sense = dev.ModeSense10(out readBuffer, out senseBuf, false, ScsiModeSensePageControl.Current,
0x01, dev.Timeout, out duration);
- if(!sense) currentMode = Decoders.SCSI.Modes.DecodeMode10(readBuffer, dev.SCSIType);
+ if(!sense) currentMode = Decoders.SCSI.Modes.DecodeMode10(readBuffer, dev.ScsiType);
}
- else currentMode = Decoders.SCSI.Modes.DecodeMode6(readBuffer, dev.SCSIType);
+ else currentMode = Decoders.SCSI.Modes.DecodeMode6(readBuffer, dev.ScsiType);
if(currentMode.HasValue) currentModePage = currentMode.Value.Pages[0];
- if(dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
+ if(dev.ScsiType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
{
- Decoders.SCSI.Modes.ModePage_01_MMC pgMMC =
+ Decoders.SCSI.Modes.ModePage_01_MMC pgMmc =
new Decoders.SCSI.Modes.ModePage_01_MMC
{
PS = false,
@@ -691,12 +691,12 @@ namespace DiscImageChef.Core.Devices.Dumping
{
Page = 0x01,
Subpage = 0x00,
- PageResponse = Decoders.SCSI.Modes.EncodeModePage_01_MMC(pgMMC)
+ PageResponse = Decoders.SCSI.Modes.EncodeModePage_01_MMC(pgMmc)
}
}
};
- md6 = Decoders.SCSI.Modes.EncodeMode6(md, dev.SCSIType);
- md10 = Decoders.SCSI.Modes.EncodeMode10(md, dev.SCSIType);
+ md6 = Decoders.SCSI.Modes.EncodeMode6(md, dev.ScsiType);
+ md10 = Decoders.SCSI.Modes.EncodeMode10(md, dev.ScsiType);
}
else
{
@@ -726,8 +726,8 @@ namespace DiscImageChef.Core.Devices.Dumping
}
}
};
- md6 = Decoders.SCSI.Modes.EncodeMode6(md, dev.SCSIType);
- md10 = Decoders.SCSI.Modes.EncodeMode10(md, dev.SCSIType);
+ md6 = Decoders.SCSI.Modes.EncodeMode6(md, dev.ScsiType);
+ md10 = Decoders.SCSI.Modes.EncodeMode10(md, dev.ScsiType);
}
dumpLog.WriteLine("Sending MODE SELECT to drive.");
@@ -748,8 +748,8 @@ namespace DiscImageChef.Core.Devices.Dumping
Header = new Decoders.SCSI.Modes.ModeHeader(),
Pages = new Decoders.SCSI.Modes.ModePage[] {currentModePage.Value}
};
- md6 = Decoders.SCSI.Modes.EncodeMode6(md, dev.SCSIType);
- md10 = Decoders.SCSI.Modes.EncodeMode10(md, dev.SCSIType);
+ md6 = Decoders.SCSI.Modes.EncodeMode6(md, dev.ScsiType);
+ md10 = Decoders.SCSI.Modes.EncodeMode10(md, dev.ScsiType);
dumpLog.WriteLine("Sending MODE SELECT to drive.");
sense = dev.ModeSelect(md6, out senseBuf, true, false, dev.Timeout, out duration);
@@ -805,7 +805,7 @@ namespace DiscImageChef.Core.Devices.Dumping
PluginBase plugins = new PluginBase();
plugins.RegisterAllPlugins(encoding);
- ImagePlugin _imageFormat;
+ ImagePlugin imageFormat;
FiltersList filtersList = new FiltersList();
Filter inputFilter = filtersList.GetFilter(outputPrefix + ".iso");
@@ -815,16 +815,16 @@ namespace DiscImageChef.Core.Devices.Dumping
return;
}
- _imageFormat = ImageFormat.Detect(inputFilter);
+ imageFormat = ImageFormat.Detect(inputFilter);
PartitionType[] xmlFileSysInfo = null;
- try { if(!_imageFormat.OpenImage(inputFilter)) _imageFormat = null; }
- catch { _imageFormat = null; }
+ try { if(!imageFormat.OpenImage(inputFilter)) imageFormat = null; }
+ catch { imageFormat = null; }
- if(_imageFormat != null)
+ if(imageFormat != null)
{
dumpLog.WriteLine("Getting partitions.");
- List partitions = Partitions.GetAll(_imageFormat);
+ List partitions = Partitions.GetAll(imageFormat);
Partitions.AddSchemesToStats(partitions);
dumpLog.WriteLine("Found {0} partitions.", partitions.Count);
@@ -847,22 +847,22 @@ namespace DiscImageChef.Core.Devices.Dumping
i, partitions[i].Start, partitions[i].End, partitions[i].Type,
partitions[i].Scheme);
- foreach(Filesystem _plugin in plugins.PluginsList.Values)
+ foreach(Filesystem plugin in plugins.PluginsList.Values)
{
try
{
- if(_plugin.Identify(_imageFormat, partitions[i]))
+ if(plugin.Identify(imageFormat, partitions[i]))
{
- _plugin.GetInformation(_imageFormat, partitions[i], out string foo);
- lstFs.Add(_plugin.XmlFSType);
- Statistics.AddFilesystem(_plugin.XmlFSType.Type);
- dumpLog.WriteLine("Filesystem {0} found.", _plugin.XmlFSType.Type);
+ plugin.GetInformation(imageFormat, partitions[i], out string foo);
+ lstFs.Add(plugin.XmlFSType);
+ Statistics.AddFilesystem(plugin.XmlFSType.Type);
+ dumpLog.WriteLine("Filesystem {0} found.", plugin.XmlFSType.Type);
- if(_plugin.XmlFSType.Type == "Opera") dskType = MediaType.ThreeDO;
- if(_plugin.XmlFSType.Type == "PC Engine filesystem")
+ if(plugin.XmlFSType.Type == "Opera") dskType = MediaType.ThreeDO;
+ if(plugin.XmlFSType.Type == "PC Engine filesystem")
dskType = MediaType.SuperCDROM2;
- if(_plugin.XmlFSType.Type == "Nintendo Wii filesystem") dskType = MediaType.WOD;
- if(_plugin.XmlFSType.Type == "Nintendo Gamecube filesystem")
+ if(plugin.XmlFSType.Type == "Nintendo Wii filesystem") dskType = MediaType.WOD;
+ if(plugin.XmlFSType.Type == "Nintendo Gamecube filesystem")
dskType = MediaType.GOD;
}
}
@@ -887,21 +887,21 @@ namespace DiscImageChef.Core.Devices.Dumping
Partition wholePart =
new Partition {Name = "Whole device", Length = blocks, Size = blocks * blockSize};
- foreach(Filesystem _plugin in plugins.PluginsList.Values)
+ foreach(Filesystem plugin in plugins.PluginsList.Values)
{
try
{
- if(_plugin.Identify(_imageFormat, wholePart))
+ if(plugin.Identify(imageFormat, wholePart))
{
- _plugin.GetInformation(_imageFormat, wholePart, out string foo);
- lstFs.Add(_plugin.XmlFSType);
- Statistics.AddFilesystem(_plugin.XmlFSType.Type);
- dumpLog.WriteLine("Filesystem {0} found.", _plugin.XmlFSType.Type);
+ plugin.GetInformation(imageFormat, wholePart, out string foo);
+ lstFs.Add(plugin.XmlFSType);
+ Statistics.AddFilesystem(plugin.XmlFSType.Type);
+ dumpLog.WriteLine("Filesystem {0} found.", plugin.XmlFSType.Type);
- if(_plugin.XmlFSType.Type == "Opera") dskType = MediaType.ThreeDO;
- if(_plugin.XmlFSType.Type == "PC Engine filesystem") dskType = MediaType.SuperCDROM2;
- if(_plugin.XmlFSType.Type == "Nintendo Wii filesystem") dskType = MediaType.WOD;
- if(_plugin.XmlFSType.Type == "Nintendo Gamecube filesystem") dskType = MediaType.GOD;
+ if(plugin.XmlFSType.Type == "Opera") dskType = MediaType.ThreeDO;
+ if(plugin.XmlFSType.Type == "PC Engine filesystem") dskType = MediaType.SuperCDROM2;
+ if(plugin.XmlFSType.Type == "Nintendo Wii filesystem") dskType = MediaType.WOD;
+ if(plugin.XmlFSType.Type == "Nintendo Gamecube filesystem") dskType = MediaType.GOD;
}
}
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
diff --git a/DiscImageChef.Core/Devices/Reader.cs b/DiscImageChef.Core/Devices/Reader.cs
index 87fdf0374..1b8f91d8f 100644
--- a/DiscImageChef.Core/Devices/Reader.cs
+++ b/DiscImageChef.Core/Devices/Reader.cs
@@ -80,7 +80,7 @@ namespace DiscImageChef.Core.Devices
{
get { return ataSeek || seek6 || seek10; }
}
- internal bool CanSeekLBA
+ internal bool CanSeekLba
{
get { return ataSeekLba || seek6 || seek10; }
}
@@ -177,11 +177,11 @@ namespace DiscImageChef.Core.Devices
}
}
- internal bool ReadCHS(out byte[] buffer, ushort cylinder, byte head, byte sector, out double duration)
+ internal bool ReadChs(out byte[] buffer, ushort cylinder, byte head, byte sector, out double duration)
{
switch(dev.Type)
{
- case DeviceType.ATA: return AtaReadCHS(out buffer, cylinder, head, sector, out duration);
+ case DeviceType.ATA: return AtaReadChs(out buffer, cylinder, head, sector, out duration);
default:
buffer = null;
duration = 0d;
@@ -202,11 +202,11 @@ namespace DiscImageChef.Core.Devices
}
}
- internal bool SeekCHS(ushort cylinder, byte head, byte sector, out double duration)
+ internal bool SeekChs(ushort cylinder, byte head, byte sector, out double duration)
{
switch(dev.Type)
{
- case DeviceType.ATA: return AtaSeekCHS(cylinder, head, sector, out duration);
+ case DeviceType.ATA: return AtaSeekChs(cylinder, head, sector, out duration);
default:
duration = 0;
return true;
diff --git a/DiscImageChef.Core/Devices/ReaderATA.cs b/DiscImageChef.Core/Devices/ReaderATA.cs
index b7fec3504..dd494c452 100644
--- a/DiscImageChef.Core/Devices/ReaderATA.cs
+++ b/DiscImageChef.Core/Devices/ReaderATA.cs
@@ -57,7 +57,7 @@ namespace DiscImageChef.Core.Devices
Identify.IdentifyDevice ataId;
- internal bool IsLBA
+ internal bool IsLba
{
get { return lbaMode; }
}
@@ -74,7 +74,7 @@ namespace DiscImageChef.Core.Devices
get { return sectors; }
}
- (uint, byte, byte) GetDeviceCHS()
+ (uint, byte, byte) GetDeviceChs()
{
if(dev.Type != DeviceType.ATA) return (0, 0, 0);
@@ -100,7 +100,7 @@ namespace DiscImageChef.Core.Devices
ulong AtaGetBlocks()
{
- GetDeviceCHS();
+ GetDeviceChs();
if(ataId.Capabilities.HasFlag(Identify.CapabilitiesBit.LBASupport))
{
@@ -350,7 +350,7 @@ namespace DiscImageChef.Core.Devices
return error;
}
- bool AtaReadCHS(out byte[] buffer, ushort cylinder, byte head, byte sectir, out double duration)
+ bool AtaReadChs(out byte[] buffer, ushort cylinder, byte head, byte sectir, out double duration)
{
bool error = true;
bool sense;
@@ -401,7 +401,7 @@ namespace DiscImageChef.Core.Devices
return !(!sense && (errorLba.status & 0x27) == 0 && errorLba.error == 0);
}
- bool AtaSeekCHS(ushort cylinder, byte head, byte sector, out double duration)
+ bool AtaSeekChs(ushort cylinder, byte head, byte sector, out double duration)
{
AtaErrorRegistersCHS errorChs;
diff --git a/DiscImageChef.Core/Devices/ReaderSCSI.cs b/DiscImageChef.Core/Devices/ReaderSCSI.cs
index 016aa67c0..34f7d7465 100644
--- a/DiscImageChef.Core/Devices/ReaderSCSI.cs
+++ b/DiscImageChef.Core/Devices/ReaderSCSI.cs
@@ -110,7 +110,7 @@ namespace DiscImageChef.Core.Devices
Decoders.SCSI.FixedSense? decSense;
readRaw = false;
- if(dev.SCSIType != Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
+ if(dev.ScsiType != Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
{
/*testSense = dev.ReadLong16(out readBuffer, out senseBuf, false, 0, 0xFFFF, timeout, out duration);
if (testSense && !dev.Error)
@@ -417,7 +417,7 @@ namespace DiscImageChef.Core.Devices
if(sense && blocks == 0)
{
// Not all MMC devices support READ CAPACITY, as they have READ TOC
- if(dev.SCSIType != Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
+ if(dev.ScsiType != Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
{
errorMessage = string.Format("Unable to get media capacity\n" + "{0}",
Decoders.SCSI.Sense.PrettifySense(senseBuf));
diff --git a/DiscImageChef.Core/Devices/Report/ATA.cs b/DiscImageChef.Core/Devices/Report/ATA.cs
index 34237d71d..a816c1f80 100644
--- a/DiscImageChef.Core/Devices/Report/ATA.cs
+++ b/DiscImageChef.Core/Devices/Report/ATA.cs
@@ -38,7 +38,7 @@ using DiscImageChef.Metadata;
namespace DiscImageChef.Core.Devices.Report
{
- public static class ATA
+ public static class Ata
{
public static void Report(Device dev, ref DeviceReport report, bool debug, ref bool removable)
{
@@ -50,11 +50,11 @@ namespace DiscImageChef.Core.Devices.Report
uint timeout = 5;
ConsoleKeyInfo pressedKey;
- if(dev.IsUSB) USB.Report(dev, ref report, debug, ref removable);
+ if(dev.IsUsb) Usb.Report(dev, ref report, debug, ref removable);
if(dev.IsFireWire) FireWire.Report(dev, ref report, debug, ref removable);
- if(dev.IsPCMCIA) PCMCIA.Report(dev, ref report, debug, ref removable);
+ if(dev.IsPcmcia) Pcmcia.Report(dev, ref report, debug, ref removable);
DicConsole.WriteLine("Querying ATA IDENTIFY...");
diff --git a/DiscImageChef.Core/Devices/Report/ATAPI.cs b/DiscImageChef.Core/Devices/Report/ATAPI.cs
index 31485aec0..bacad152f 100644
--- a/DiscImageChef.Core/Devices/Report/ATAPI.cs
+++ b/DiscImageChef.Core/Devices/Report/ATAPI.cs
@@ -36,7 +36,7 @@ using DiscImageChef.Metadata;
namespace DiscImageChef.Core.Devices.Report
{
- static class ATAPI
+ static class Atapi
{
internal static void Report(Device dev, ref DeviceReport report, bool debug, ref bool removable)
{
diff --git a/DiscImageChef.Core/Devices/Report/NVMe.cs b/DiscImageChef.Core/Devices/Report/NVMe.cs
index c4ff8cc04..1fc6f326f 100644
--- a/DiscImageChef.Core/Devices/Report/NVMe.cs
+++ b/DiscImageChef.Core/Devices/Report/NVMe.cs
@@ -36,7 +36,7 @@ using DiscImageChef.Metadata;
namespace DiscImageChef.Core.Devices.Report
{
- public static class NVMe
+ public static class Nvme
{
public static void Report(Device dev, ref DeviceReport report, bool debug, ref bool removable)
{
diff --git a/DiscImageChef.Core/Devices/Report/PCMCIA.cs b/DiscImageChef.Core/Devices/Report/PCMCIA.cs
index f3b84ee49..a3cdce823 100644
--- a/DiscImageChef.Core/Devices/Report/PCMCIA.cs
+++ b/DiscImageChef.Core/Devices/Report/PCMCIA.cs
@@ -36,13 +36,13 @@ using DiscImageChef.Metadata;
namespace DiscImageChef.Core.Devices.Report
{
- static class PCMCIA
+ static class Pcmcia
{
internal static void Report(Device dev, ref DeviceReport report, bool debug, ref bool removable)
{
report.PCMCIA = new pcmciaType();
- report.PCMCIA.CIS = dev.CIS;
- Tuple[] tuples = CIS.GetTuples(dev.CIS);
+ report.PCMCIA.CIS = dev.Cis;
+ Tuple[] tuples = CIS.GetTuples(dev.Cis);
if(tuples != null)
{
foreach(Tuple tuple in tuples)
diff --git a/DiscImageChef.Core/Devices/Report/SCSI/General.cs b/DiscImageChef.Core/Devices/Report/SCSI/General.cs
index de8954157..759e1e959 100644
--- a/DiscImageChef.Core/Devices/Report/SCSI/General.cs
+++ b/DiscImageChef.Core/Devices/Report/SCSI/General.cs
@@ -52,13 +52,13 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
uint timeout = 5;
ConsoleKeyInfo pressedKey;
- if(dev.IsUSB) USB.Report(dev, ref report, debug, ref removable);
+ if(dev.IsUsb) Usb.Report(dev, ref report, debug, ref removable);
if(dev.IsFireWire) FireWire.Report(dev, ref report, debug, ref removable);
- if(dev.IsPCMCIA) PCMCIA.Report(dev, ref report, debug, ref removable);
+ if(dev.IsPcmcia) Pcmcia.Report(dev, ref report, debug, ref removable);
- 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)
@@ -71,7 +71,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
removable = pressedKey.Key == ConsoleKey.Y;
}
- if(dev.Type == DeviceType.ATAPI) ATAPI.Report(dev, ref report, debug, ref removable);
+ if(dev.Type == DeviceType.ATAPI) Atapi.Report(dev, ref report, debug, ref removable);
DicConsole.WriteLine("Querying SCSI INQUIRY...");
sense = dev.ScsiInquiry(out buffer, out senseBuffer);
@@ -209,12 +209,12 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
if(removable)
{
- if(dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
+ if(dev.ScsiType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
{
dev.AllowMediumRemoval(out senseBuffer, timeout, out duration);
dev.EjectTray(out senseBuffer, timeout, out duration);
}
- else if(dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess)
+ else if(dev.ScsiType == Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess)
{
dev.SpcAllowMediumRemoval(out senseBuffer, timeout, out duration);
DicConsole.WriteLine("Asking drive to unload tape (can take a few minutes)...");
@@ -225,7 +225,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
}
Decoders.SCSI.Modes.DecodedMode? decMode = null;
- Decoders.SCSI.PeripheralDeviceTypes devType = dev.SCSIType;
+ Decoders.SCSI.PeripheralDeviceTypes devType = dev.ScsiType;
DicConsole.WriteLine("Querying all mode pages and subpages using SCSI MODE SENSE (10)...");
sense = dev.ModeSense10(out byte[] mode10Buffer, out senseBuffer, false, true,
@@ -317,10 +317,10 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
List mediaTypes = new List();
- if(dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
- MMC.Report(dev, ref report, debug, ref cdromMode, ref mediaTypes);
- else if(dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess)
- SSC.Report(dev, ref report, debug);
+ if(dev.ScsiType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
+ Mmc.Report(dev, ref report, debug, ref cdromMode, ref mediaTypes);
+ else if(dev.ScsiType == Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess)
+ Ssc.Report(dev, ref report, debug);
else
{
if(removable)
@@ -440,7 +440,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
if(!sense && !dev.Error)
{
report.SCSI.SupportsModeSense10 = true;
- decMode = Decoders.SCSI.Modes.DecodeMode10(buffer, dev.SCSIType);
+ decMode = Decoders.SCSI.Modes.DecodeMode10(buffer, dev.ScsiType);
if(debug) mediaTest.ModeSense10Data = buffer;
}
@@ -450,7 +450,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
{
report.SCSI.SupportsModeSense6 = true;
if(!decMode.HasValue)
- decMode = Decoders.SCSI.Modes.DecodeMode6(buffer, dev.SCSIType);
+ decMode = Decoders.SCSI.Modes.DecodeMode6(buffer, dev.ScsiType);
if(debug) mediaTest.ModeSense6Data = buffer;
}
@@ -715,7 +715,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
if(!sense && !dev.Error)
{
report.SCSI.SupportsModeSense10 = true;
- decMode = Decoders.SCSI.Modes.DecodeMode10(buffer, dev.SCSIType);
+ decMode = Decoders.SCSI.Modes.DecodeMode10(buffer, dev.ScsiType);
if(debug) report.SCSI.ReadCapabilities.ModeSense10Data = buffer;
}
@@ -724,7 +724,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
if(!sense && !dev.Error)
{
report.SCSI.SupportsModeSense6 = true;
- if(!decMode.HasValue) decMode = Decoders.SCSI.Modes.DecodeMode6(buffer, dev.SCSIType);
+ if(!decMode.HasValue) decMode = Decoders.SCSI.Modes.DecodeMode6(buffer, dev.ScsiType);
if(debug) report.SCSI.ReadCapabilities.ModeSense6Data = buffer;
}
diff --git a/DiscImageChef.Core/Devices/Report/SCSI/MMC.cs b/DiscImageChef.Core/Devices/Report/SCSI/MMC.cs
index 0a46962a1..b5ac6c164 100644
--- a/DiscImageChef.Core/Devices/Report/SCSI/MMC.cs
+++ b/DiscImageChef.Core/Devices/Report/SCSI/MMC.cs
@@ -39,7 +39,7 @@ using DiscImageChef.Metadata;
namespace DiscImageChef.Core.Devices.Report.SCSI
{
- internal static class MMC
+ internal static class Mmc
{
internal static void Report(Device dev, ref DeviceReport report, bool debug,
ref Decoders.SCSI.Modes.ModePage_2A? cdromMode, ref List mediaTypes)
@@ -733,12 +733,12 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
}
}
- bool tryPlextor = false, tryHLDTST = false, tryPioneer = false, tryNEC = false;
+ bool tryPlextor = false, tryHldtst = false, tryPioneer = false, tryNec = false;
tryPlextor |= dev.Manufacturer.ToLowerInvariant() == "plextor";
- tryHLDTST |= dev.Manufacturer.ToLowerInvariant() == "hl-dt-st";
+ tryHldtst |= dev.Manufacturer.ToLowerInvariant() == "hl-dt-st";
tryPioneer |= dev.Manufacturer.ToLowerInvariant() == "pioneer";
- tryNEC |= dev.Manufacturer.ToLowerInvariant() == "nec";
+ tryNec |= dev.Manufacturer.ToLowerInvariant() == "nec";
// 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
@@ -871,7 +871,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
if(!sense && !dev.Error)
{
report.SCSI.SupportsModeSense10 = true;
- decMode = Decoders.SCSI.Modes.DecodeMode10(buffer, dev.SCSIType);
+ decMode = Decoders.SCSI.Modes.DecodeMode10(buffer, dev.ScsiType);
if(debug) mediaTest.ModeSense10Data = buffer;
}
DicConsole.WriteLine("Querying SCSI MODE SENSE...");
@@ -879,7 +879,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
if(!sense && !dev.Error)
{
report.SCSI.SupportsModeSense6 = true;
- if(!decMode.HasValue) decMode = Decoders.SCSI.Modes.DecodeMode6(buffer, dev.SCSIType);
+ if(!decMode.HasValue) decMode = Decoders.SCSI.Modes.DecodeMode6(buffer, dev.ScsiType);
if(debug) mediaTest.ModeSense6Data = buffer;
}
@@ -947,7 +947,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
mediaTest.CanReadDMISpecified = true;
DicConsole.WriteLine("Querying DVD PFI...");
mediaTest.CanReadPFI =
- !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0,
+ !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.PhysicalInformation, 0, timeout,
out duration);
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadPFI);
@@ -957,7 +957,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
mediaType + ".bin", "read results", buffer);
DicConsole.WriteLine("Querying DVD DMI...");
mediaTest.CanReadDMI =
- !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0,
+ !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.DiscManufacturingInformation, 0, timeout,
out duration);
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadDMI);
@@ -972,7 +972,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
mediaTest.CanReadCMISpecified = true;
DicConsole.WriteLine("Querying DVD CMI...");
mediaTest.CanReadCMI =
- !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0,
+ !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.CopyrightInformation, 0, timeout,
out duration);
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadCMI);
@@ -987,7 +987,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
mediaTest.CanReadBCASpecified = true;
DicConsole.WriteLine("Querying DVD BCA...");
mediaTest.CanReadBCA =
- !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0,
+ !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.BurstCuttingArea, 0, timeout,
out duration);
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadBCA);
@@ -998,8 +998,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
mediaTest.CanReadAACSSpecified = true;
DicConsole.WriteLine("Querying DVD AACS...");
mediaTest.CanReadAACS =
- !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0,
- MmcDiscStructureFormat.DVD_AACS, 0, timeout, out duration);
+ !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0,
+ MmcDiscStructureFormat.DvdAacs, 0, timeout, out duration);
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadAACS);
if(debug)
DataFile.WriteTo("SCSI Report", "aacs",
@@ -1012,8 +1012,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
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,
+ !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Bd, 0, 0,
+ MmcDiscStructureFormat.BdBurstCuttingArea, 0, timeout,
out duration);
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadBCA);
if(debug)
@@ -1027,16 +1027,16 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
mediaTest.CanReadDDSSpecified = true;
mediaTest.CanReadSpareAreaInformationSpecified = true;
mediaTest.CanReadDDS =
- !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0,
- MmcDiscStructureFormat.DVDRAM_DDS, 0, timeout, out duration);
+ !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0,
+ MmcDiscStructureFormat.DvdramDds, 0, timeout, out duration);
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadDDS);
if(debug)
DataFile.WriteTo("SCSI Report", "dds",
"_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" +
mediaType + ".bin", "read results", buffer);
mediaTest.CanReadSpareAreaInformation =
- !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0,
- MmcDiscStructureFormat.DVDRAM_SpareAreaInformation, 0, timeout,
+ !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0,
+ MmcDiscStructureFormat.DvdramSpareAreaInformation, 0, timeout,
out duration);
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}",
!mediaTest.CanReadSpareAreaInformation);
@@ -1052,8 +1052,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
mediaTest.CanReadSpareAreaInformationSpecified = true;
DicConsole.WriteLine("Querying BD DDS...");
mediaTest.CanReadDDS =
- !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.BD, 0, 0,
- MmcDiscStructureFormat.BD_DDS, 0, timeout, out duration);
+ !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Bd, 0, 0,
+ MmcDiscStructureFormat.BdDds, 0, timeout, out duration);
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadDDS);
if(debug)
DataFile.WriteTo("SCSI Report", "bddds",
@@ -1061,8 +1061,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
mediaType + ".bin", "read results", buffer);
DicConsole.WriteLine("Querying BD SAI...");
mediaTest.CanReadSpareAreaInformation =
- !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.BD, 0, 0,
- MmcDiscStructureFormat.BD_SpareAreaInformation, 0, timeout,
+ !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Bd, 0, 0,
+ MmcDiscStructureFormat.BdSpareAreaInformation, 0, timeout,
out duration);
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}",
!mediaTest.CanReadSpareAreaInformation);
@@ -1077,7 +1077,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
mediaTest.CanReadPRISpecified = true;
DicConsole.WriteLine("Querying DVD PRI...");
mediaTest.CanReadPRI =
- !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0,
+ !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0,
MmcDiscStructureFormat.PreRecordedInfo, 0, timeout,
out duration);
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadPRI);
@@ -1093,8 +1093,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
mediaTest.CanReadRecordablePFISpecified = true;
DicConsole.WriteLine("Querying DVD Media ID...");
mediaTest.CanReadMediaID =
- !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0,
- MmcDiscStructureFormat.DVDR_MediaIdentifier, 0, timeout,
+ !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0,
+ MmcDiscStructureFormat.DvdrMediaIdentifier, 0, timeout,
out duration);
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadMediaID);
if(debug)
@@ -1103,8 +1103,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
mediaType + ".bin", "read results", buffer);
DicConsole.WriteLine("Querying DVD Embossed PFI...");
mediaTest.CanReadRecordablePFI =
- !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0,
- MmcDiscStructureFormat.DVDR_PhysicalInformation, 0, timeout,
+ !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0,
+ MmcDiscStructureFormat.DvdrPhysicalInformation, 0, timeout,
out duration);
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadRecordablePFI);
if(debug)
@@ -1119,8 +1119,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
mediaTest.CanReadDCBSpecified = true;
DicConsole.WriteLine("Querying DVD ADIP...");
mediaTest.CanReadADIP =
- !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0,
- MmcDiscStructureFormat.ADIP, 0, timeout, out duration);
+ !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0,
+ MmcDiscStructureFormat.Adip, 0, timeout, out duration);
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadADIP);
if(debug)
DataFile.WriteTo("SCSI Report", "adip",
@@ -1128,8 +1128,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
mediaType + ".bin", "read results", buffer);
DicConsole.WriteLine("Querying DVD DCB...");
mediaTest.CanReadDCB =
- !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.DVD, 0, 0,
- MmcDiscStructureFormat.DCB, 0, timeout, out duration);
+ !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0,
+ MmcDiscStructureFormat.Dcb, 0, timeout, out duration);
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadDCB);
if(debug)
DataFile.WriteTo("SCSI Report", "dcb",
@@ -1142,8 +1142,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
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,
+ !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0,
+ MmcDiscStructureFormat.HddvdCopyrightInformation, 0, timeout,
out duration);
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadHDCMI);
if(debug)
@@ -1157,8 +1157,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
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,
+ !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0,
+ MmcDiscStructureFormat.DvdrLayerCapacity, 0, timeout,
out duration);
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadLayerCapacity);
if(debug)
@@ -1173,7 +1173,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
mediaTest.CanReadPACSpecified = true;
DicConsole.WriteLine("Querying BD Disc Information...");
mediaTest.CanReadDiscInformation =
- !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.BD, 0, 0,
+ !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Bd, 0, 0,
MmcDiscStructureFormat.DiscInformation, 0, timeout,
out duration);
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadDiscInformation);
@@ -1183,8 +1183,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
mediaType + ".bin", "read results", buffer);
DicConsole.WriteLine("Querying BD PAC...");
mediaTest.CanReadPAC =
- !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.BD, 0, 0,
- MmcDiscStructureFormat.PAC, 0, timeout, out duration);
+ !dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Bd, 0, 0,
+ MmcDiscStructureFormat.Pac, 0, timeout, out duration);
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadPAC);
if(debug)
DataFile.WriteTo("SCSI Report", "pac",
@@ -1268,7 +1268,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
{
DicConsole.WriteLine("Trying SCSI READ CD...");
mediaTest.SupportsReadCd = !dev.ReadCd(out buffer, out senseBuffer, 0, 2352, 1,
- MmcSectorTypes.CDDA, false, false, false,
+ MmcSectorTypes.Cdda, false, false, false,
MmcHeaderCodes.None, true, false,
MmcErrorField.None, MmcSubchannel.None, timeout,
out duration);
@@ -1279,7 +1279,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
mediaType + ".bin", "read results", buffer);
DicConsole.WriteLine("Trying SCSI READ CD MSF...");
mediaTest.SupportsReadCdMsf = !dev.ReadCdMsf(out buffer, out senseBuffer, 0x00000200,
- 0x00000201, 2352, MmcSectorTypes.CDDA,
+ 0x00000201, 2352, MmcSectorTypes.Cdda,
false, false, MmcHeaderCodes.None, true,
false, MmcErrorField.None,
MmcSubchannel.None, timeout, out duration);
@@ -1346,7 +1346,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
{
if(mediaType == "Audio CD")
sense = dev.ReadCd(out buffer, out senseBuffer, (uint)i, 2352, 1,
- MmcSectorTypes.CDDA, false, false, false,
+ MmcSectorTypes.Cdda, false, false, false,
MmcHeaderCodes.None, true, false, MmcErrorField.None,
MmcSubchannel.None, timeout, out duration);
else
@@ -1370,7 +1370,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
if(mediaType == "Audio CD")
mediaTest.CanReadLeadOut = !dev.ReadCd(out buffer, out senseBuffer,
(uint)(mediaTest.Blocks + 1), 2352, 1,
- MmcSectorTypes.CDDA, false, false, false,
+ MmcSectorTypes.Cdda, false, false, false,
MmcHeaderCodes.None, true, false,
MmcErrorField.None, MmcSubchannel.None,
timeout, out duration);
@@ -1392,13 +1392,13 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
{
DicConsole.WriteLine("Trying to read C2 Pointers...");
mediaTest.CanReadC2Pointers = !dev.ReadCd(out buffer, out senseBuffer, 0, 2646, 1,
- MmcSectorTypes.CDDA, false, false, false,
+ MmcSectorTypes.Cdda, false, false, false,
MmcHeaderCodes.None, true, false,
MmcErrorField.C2Pointers, MmcSubchannel.None,
timeout, out duration);
if(!mediaTest.CanReadC2Pointers)
mediaTest.CanReadC2Pointers = !dev.ReadCd(out buffer, out senseBuffer, 0, 2648, 1,
- MmcSectorTypes.CDDA, false, false, false,
+ MmcSectorTypes.Cdda, false, false, false,
MmcHeaderCodes.None, true, false,
MmcErrorField.C2PointersAndBlock,
MmcSubchannel.None, timeout,
@@ -1411,7 +1411,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
DicConsole.WriteLine("Trying to read subchannels...");
mediaTest.CanReadPQSubchannel = !dev.ReadCd(out buffer, out senseBuffer, 0, 2368, 1,
- MmcSectorTypes.CDDA, false, false, false,
+ MmcSectorTypes.Cdda, false, false, false,
MmcHeaderCodes.None, true, false,
MmcErrorField.None, MmcSubchannel.Q16,
timeout, out duration);
@@ -1421,7 +1421,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
"_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" +
mediaType + ".bin", "read results", buffer);
mediaTest.CanReadRWSubchannel = !dev.ReadCd(out buffer, out senseBuffer, 0, 2448, 1,
- MmcSectorTypes.CDDA, false, false, false,
+ MmcSectorTypes.Cdda, false, false, false,
MmcHeaderCodes.None, true, false,
MmcErrorField.None, MmcSubchannel.Raw,
timeout, out duration);
@@ -1431,10 +1431,10 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
"_debug_" + report.SCSI.Inquiry.ProductIdentification + "_" +
mediaType + ".bin", "read results", buffer);
mediaTest.CanReadCorrectedSubchannel = !dev.ReadCd(out buffer, out senseBuffer, 0, 2448,
- 1, MmcSectorTypes.CDDA, false, false,
+ 1, MmcSectorTypes.Cdda, false, false,
false, MmcHeaderCodes.None, true,
false, MmcErrorField.None,
- MmcSubchannel.RW, timeout,
+ MmcSubchannel.Rw, timeout,
out duration);
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}",
!mediaTest.CanReadCorrectedSubchannel);
@@ -1445,14 +1445,14 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
DicConsole.WriteLine("Trying to read subchannels with C2 Pointers...");
mediaTest.CanReadPQSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2662,
- 1, MmcSectorTypes.CDDA, false, false,
+ 1, MmcSectorTypes.Cdda, false, false,
false, MmcHeaderCodes.None, true,
false, MmcErrorField.C2Pointers,
MmcSubchannel.Q16, timeout,
out duration);
if(!mediaTest.CanReadPQSubchannelWithC2)
mediaTest.CanReadPQSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0,
- 2664, 1, MmcSectorTypes.CDDA,
+ 2664, 1, MmcSectorTypes.Cdda,
false, false, false,
MmcHeaderCodes.None, true, false,
MmcErrorField.C2PointersAndBlock,
@@ -1466,14 +1466,14 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
mediaType + ".bin", "read results", buffer);
mediaTest.CanReadRWSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0, 2712,
- 1, MmcSectorTypes.CDDA, false, false,
+ 1, MmcSectorTypes.Cdda, false, false,
false, MmcHeaderCodes.None, true,
false, MmcErrorField.C2Pointers,
MmcSubchannel.Raw, timeout,
out duration);
if(!mediaTest.CanReadRWSubchannelWithC2)
mediaTest.CanReadRWSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0,
- 2714, 1, MmcSectorTypes.CDDA,
+ 2714, 1, MmcSectorTypes.Cdda,
false, false, false,
MmcHeaderCodes.None, true, false,
MmcErrorField.C2PointersAndBlock,
@@ -1487,18 +1487,18 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
mediaType + ".bin", "read results", buffer);
mediaTest.CanReadCorrectedSubchannelWithC2 = !dev.ReadCd(out buffer, out senseBuffer, 0,
- 2712, 1, MmcSectorTypes.CDDA,
+ 2712, 1, MmcSectorTypes.Cdda,
false, false, false,
MmcHeaderCodes.None, true,
false,
MmcErrorField.C2Pointers,
- MmcSubchannel.RW, timeout,
+ MmcSubchannel.Rw, timeout,
out duration);
if(!mediaTest.CanReadCorrectedSubchannelWithC2)
mediaTest.CanReadCorrectedSubchannelWithC2 =
- !dev.ReadCd(out buffer, out senseBuffer, 0, 2714, 1, MmcSectorTypes.CDDA, false,
+ !dev.ReadCd(out buffer, out senseBuffer, 0, 2714, 1, MmcSectorTypes.Cdda, false,
false, false, MmcHeaderCodes.None, true, false,
- MmcErrorField.C2PointersAndBlock, MmcSubchannel.RW, timeout,
+ MmcErrorField.C2PointersAndBlock, MmcSubchannel.Rw, timeout,
out duration);
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}",
!mediaTest.CanReadCorrectedSubchannelWithC2);
@@ -1554,7 +1554,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
false, true,
MmcHeaderCodes.AllHeaders, true,
true, MmcErrorField.None,
- MmcSubchannel.RW, timeout,
+ MmcSubchannel.Rw, timeout,
out duration);
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}",
!mediaTest.CanReadCorrectedSubchannel);
@@ -1617,13 +1617,13 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
MmcHeaderCodes.AllHeaders,
true, true,
MmcErrorField.C2Pointers,
- MmcSubchannel.RW, timeout,
+ MmcSubchannel.Rw, timeout,
out duration);
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,
+ MmcErrorField.C2PointersAndBlock, MmcSubchannel.Rw, timeout,
out duration);
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}",
!mediaTest.CanReadCorrectedSubchannelWithC2);
@@ -1678,7 +1678,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
1, MmcSectorTypes.AllTypes, false,
false, false, MmcHeaderCodes.None,
true, false, MmcErrorField.None,
- MmcSubchannel.RW, timeout,
+ MmcSubchannel.Rw, timeout,
out duration);
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}",
!mediaTest.CanReadCorrectedSubchannel);
@@ -1737,13 +1737,13 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
MmcHeaderCodes.None, true,
false,
MmcErrorField.C2Pointers,
- MmcSubchannel.RW, timeout,
+ MmcSubchannel.Rw, timeout,
out duration);
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,
+ MmcErrorField.C2PointersAndBlock, MmcSubchannel.Rw, timeout,
out duration);
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}",
!mediaTest.CanReadCorrectedSubchannelWithC2);
@@ -1755,7 +1755,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
if(debug)
{
- if(!tryNEC)
+ if(!tryNec)
{
pressedKey = new ConsoleKeyInfo();
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
@@ -1766,7 +1766,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
DicConsole.WriteLine();
}
- tryNEC |= pressedKey.Key == ConsoleKey.Y;
+ tryNec |= pressedKey.Key == ConsoleKey.Y;
}
if(!tryPioneer)
@@ -1825,7 +1825,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
mediaType + ".bin", "read results", buffer);
}
- if(tryNEC)
+ if(tryNec)
{
mediaTest.SupportsNECReadCDDASpecified = true;
DicConsole.WriteLine("Trying NEC READ CD-DA...");
@@ -1863,7 +1863,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
if(debug)
{
- if(!tryHLDTST)
+ if(!tryHldtst)
{
pressedKey = new ConsoleKeyInfo();
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
@@ -1874,7 +1874,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
DicConsole.WriteLine();
}
- tryHLDTST |= pressedKey.Key == ConsoleKey.Y;
+ tryHldtst |= pressedKey.Key == ConsoleKey.Y;
}
}
@@ -1907,7 +1907,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
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...");
diff --git a/DiscImageChef.Core/Devices/Report/SCSI/SSC.cs b/DiscImageChef.Core/Devices/Report/SCSI/SSC.cs
index 3e16b1005..a7957b94c 100644
--- a/DiscImageChef.Core/Devices/Report/SCSI/SSC.cs
+++ b/DiscImageChef.Core/Devices/Report/SCSI/SSC.cs
@@ -38,7 +38,7 @@ using DiscImageChef.Metadata;
namespace DiscImageChef.Core.Devices.Report.SCSI
{
- internal static class SSC
+ internal static class Ssc
{
internal static void Report(Device dev, ref DeviceReport report, bool debug)
{
@@ -57,23 +57,23 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
sense = dev.ReadBlockLimits(out buffer, out senseBuffer, timeout, out duration);
if(!sense)
{
- Decoders.SCSI.SSC.BlockLimits.BlockLimitsData? decBL = Decoders.SCSI.SSC.BlockLimits.Decode(buffer);
- if(decBL.HasValue)
+ Decoders.SCSI.SSC.BlockLimits.BlockLimitsData? decBl = Decoders.SCSI.SSC.BlockLimits.Decode(buffer);
+ 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;
+ 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;
+ 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;
+ report.SCSI.SequentialDevice.MinBlockLength = decBl.Value.minBlockLen;
}
}
}
@@ -225,7 +225,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
if(!sense && !dev.Error)
{
report.SCSI.SupportsModeSense10 = true;
- decMode = Decoders.SCSI.Modes.DecodeMode10(buffer, dev.SCSIType);
+ decMode = Decoders.SCSI.Modes.DecodeMode10(buffer, dev.ScsiType);
if(debug) seqTest.ModeSense10Data = buffer;
}
@@ -234,7 +234,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
if(!sense && !dev.Error)
{
report.SCSI.SupportsModeSense6 = true;
- if(!decMode.HasValue) decMode = Decoders.SCSI.Modes.DecodeMode6(buffer, dev.SCSIType);
+ if(!decMode.HasValue) decMode = Decoders.SCSI.Modes.DecodeMode6(buffer, dev.ScsiType);
if(debug) seqTest.ModeSense6Data = buffer;
}
diff --git a/DiscImageChef.Core/Devices/Report/SecureDigital.cs b/DiscImageChef.Core/Devices/Report/SecureDigital.cs
index 77860ac98..183286f4a 100644
--- a/DiscImageChef.Core/Devices/Report/SecureDigital.cs
+++ b/DiscImageChef.Core/Devices/Report/SecureDigital.cs
@@ -46,7 +46,7 @@ namespace DiscImageChef.Core.Devices.Report
else if(dev.Type == DeviceType.SecureDigital) report.SecureDigital = new mmcsdType();
DicConsole.WriteLine("Trying to get CID...");
- bool sense = dev.ReadCID(out byte[] cid, out uint[] response, dev.Timeout, out double duration);
+ bool sense = dev.ReadCid(out byte[] cid, out uint[] response, dev.Timeout, out double duration);
if(!sense)
{
@@ -77,7 +77,7 @@ namespace DiscImageChef.Core.Devices.Report
else DicConsole.WriteLine("Could not read CID...");
DicConsole.WriteLine("Trying to get CSD...");
- sense = dev.ReadCSD(out byte[] csd, out response, dev.Timeout, out duration);
+ sense = dev.ReadCsd(out byte[] csd, out response, dev.Timeout, out duration);
if(!sense)
{
@@ -91,7 +91,7 @@ namespace DiscImageChef.Core.Devices.Report
if(dev.Type == DeviceType.MMC)
{
DicConsole.WriteLine("Trying to get OCR...");
- sense = dev.ReadOCR(out byte[] ocr, out response, dev.Timeout, out duration);
+ sense = dev.ReadOcr(out byte[] ocr, out response, dev.Timeout, out duration);
if(!sense)
{
@@ -101,7 +101,7 @@ namespace DiscImageChef.Core.Devices.Report
else DicConsole.WriteLine("Could not read OCR...");
DicConsole.WriteLine("Trying to get Extended CSD...");
- sense = dev.ReadExtendedCSD(out byte[] ecsd, out response, dev.Timeout, out duration);
+ sense = dev.ReadExtendedCsd(out byte[] ecsd, out response, dev.Timeout, out duration);
if(!sense)
{
@@ -113,7 +113,7 @@ namespace DiscImageChef.Core.Devices.Report
else if(dev.Type == DeviceType.SecureDigital)
{
DicConsole.WriteLine("Trying to get OCR...");
- sense = dev.ReadSDOCR(out byte[] ocr, out response, dev.Timeout, out duration);
+ sense = dev.ReadSdocr(out byte[] ocr, out response, dev.Timeout, out duration);
if(!sense)
{
@@ -123,7 +123,7 @@ namespace DiscImageChef.Core.Devices.Report
else DicConsole.WriteLine("Could not read OCR...");
DicConsole.WriteLine("Trying to get SCR...");
- sense = dev.ReadSCR(out byte[] scr, out response, dev.Timeout, out duration);
+ sense = dev.ReadScr(out byte[] scr, out response, dev.Timeout, out duration);
if(!sense)
{
diff --git a/DiscImageChef.Core/Devices/Report/USB.cs b/DiscImageChef.Core/Devices/Report/USB.cs
index 841e04db8..f8ea73109 100644
--- a/DiscImageChef.Core/Devices/Report/USB.cs
+++ b/DiscImageChef.Core/Devices/Report/USB.cs
@@ -37,7 +37,7 @@ using DiscImageChef.Metadata;
namespace DiscImageChef.Core.Devices.Report
{
- static class USB
+ static class Usb
{
internal static void Report(Device dev, ref DeviceReport report, bool debug, ref bool removable)
{
@@ -54,10 +54,10 @@ namespace DiscImageChef.Core.Devices.Report
if(pressedKey.Key == ConsoleKey.Y)
{
report.USB = new usbType();
- report.USB.Manufacturer = dev.USBManufacturerString;
- report.USB.Product = dev.USBProductString;
- report.USB.ProductID = dev.USBProductID;
- report.USB.VendorID = dev.USBVendorID;
+ report.USB.Manufacturer = dev.UsbManufacturerString;
+ report.USB.Product = dev.UsbProductString;
+ report.USB.ProductID = dev.UsbProductId;
+ report.USB.VendorID = dev.UsbVendorId;
pressedKey = new ConsoleKeyInfo();
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
@@ -69,7 +69,7 @@ namespace DiscImageChef.Core.Devices.Report
report.USB.RemovableMedia = pressedKey.Key == ConsoleKey.Y;
removable = report.USB.RemovableMedia;
- if(debug) report.USB.Descriptors = dev.USBDescriptors;
+ if(debug) report.USB.Descriptors = dev.UsbDescriptors;
}
}
}
diff --git a/DiscImageChef.Core/Devices/Scanning/ATA.cs b/DiscImageChef.Core/Devices/Scanning/ATA.cs
index 094d3d616..eff7be6b3 100644
--- a/DiscImageChef.Core/Devices/Scanning/ATA.cs
+++ b/DiscImageChef.Core/Devices/Scanning/ATA.cs
@@ -38,17 +38,17 @@ using DiscImageChef.Devices;
namespace DiscImageChef.Core.Devices.Scanning
{
- public static class ATA
+ public static class Ata
{
- public static ScanResults Scan(string MHDDLogPath, string IBGLogPath, string devicePath, Device dev)
+ public static ScanResults Scan(string mhddLogPath, string ibgLogPath, string devicePath, Device dev)
{
ScanResults results = new ScanResults();
bool aborted;
- MHDDLog mhddLog;
- IBGLog ibgLog;
+ MhddLog mhddLog;
+ IbgLog ibgLog;
byte[] cmdBuf;
bool sense;
- results.blocks = 0;
+ results.Blocks = 0;
ushort currentProfile = 0x0001;
Decoders.ATA.AtaErrorRegistersCHS errorChs;
uint timeout = 5;
@@ -62,7 +62,7 @@ namespace DiscImageChef.Core.Devices.Scanning
// Initializate reader
Reader ataReader = new Reader(dev, timeout, cmdBuf);
// Fill reader blocks
- results.blocks = ataReader.GetDeviceBlocks();
+ results.Blocks = ataReader.GetDeviceBlocks();
if(ataReader.FindReadCommand())
{
DicConsole.ErrorWriteLine(ataReader.ErrorMessage);
@@ -94,24 +94,24 @@ namespace DiscImageChef.Core.Devices.Scanning
results.D = 0; // >=50ms, <150ms
results.E = 0; // >=150ms, <500ms
results.F = 0; // >=500ms
- results.errored = 0;
+ results.Errored = 0;
DateTime start;
DateTime end;
- results.processingTime = 0;
+ results.ProcessingTime = 0;
double currentSpeed = 0;
- results.maxSpeed = double.MinValue;
- results.minSpeed = double.MaxValue;
- results.unreadableSectors = new List();
- results.seekMax = double.MinValue;
- results.seekMin = double.MaxValue;
- results.seekTotal = 0;
- const int seekTimes = 1000;
+ results.MaxSpeed = double.MinValue;
+ results.MinSpeed = double.MaxValue;
+ results.UnreadableSectors = new List();
+ results.SeekMax = double.MinValue;
+ results.SeekMin = double.MaxValue;
+ results.SeekTotal = 0;
+ const int SEEK_TIMES = 1000;
double seekCur = 0;
Random rnd = new Random();
- uint seekPos = (uint)rnd.Next((int)results.blocks);
+ uint seekPos = (uint)rnd.Next((int)results.Blocks);
ushort seekCy = (ushort)rnd.Next(cylinders);
byte seekHd = (byte)rnd.Next(heads);
byte seekSc = (byte)rnd.Next(sectors);
@@ -119,26 +119,26 @@ namespace DiscImageChef.Core.Devices.Scanning
aborted = false;
System.Console.CancelKeyPress += (sender, e) => { e.Cancel = aborted = true; };
- if(ataReader.IsLBA)
+ if(ataReader.IsLba)
{
DicConsole.WriteLine("Reading {0} sectors at a time.", blocksToRead);
- mhddLog = new MHDDLog(MHDDLogPath, dev, results.blocks, blockSize, blocksToRead);
- ibgLog = new IBGLog(IBGLogPath, currentProfile);
+ mhddLog = new MhddLog(mhddLogPath, dev, results.Blocks, blockSize, blocksToRead);
+ ibgLog = new IbgLog(ibgLogPath, currentProfile);
start = DateTime.UtcNow;
- for(ulong i = 0; i < results.blocks; i += blocksToRead)
+ for(ulong i = 0; i < results.Blocks; i += blocksToRead)
{
if(aborted) break;
- if((results.blocks - i) < blocksToRead) blocksToRead = (byte)(results.blocks - i);
+ if((results.Blocks - i) < blocksToRead) blocksToRead = (byte)(results.Blocks - i);
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
- if(currentSpeed > results.maxSpeed && currentSpeed != 0) results.maxSpeed = currentSpeed;
- if(currentSpeed < results.minSpeed && currentSpeed != 0) results.minSpeed = currentSpeed;
+ if(currentSpeed > results.MaxSpeed && currentSpeed != 0) results.MaxSpeed = currentSpeed;
+ if(currentSpeed < results.MinSpeed && currentSpeed != 0) results.MinSpeed = currentSpeed;
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
- DicConsole.Write("\rReading sector {0} of {1} ({2:F3} MiB/sec.)", i, results.blocks,
+ DicConsole.Write("\rReading sector {0} of {1} ({2:F3} MiB/sec.)", i, results.Blocks,
currentSpeed);
bool error = ataReader.ReadBlocks(out cmdBuf, i, blocksToRead, out duration);
@@ -157,8 +157,8 @@ namespace DiscImageChef.Core.Devices.Scanning
}
else
{
- results.errored += blocksToRead;
- for(ulong b = i; b < i + blocksToRead; b++) results.unreadableSectors.Add(b);
+ results.Errored += blocksToRead;
+ for(ulong b = i; b < i + blocksToRead; b++) results.UnreadableSectors.Add(b);
if(duration < 500) mhddLog.Write(i, 65535);
else mhddLog.Write(i, duration);
@@ -176,60 +176,60 @@ namespace DiscImageChef.Core.Devices.Scanning
DicConsole.WriteLine();
mhddLog.Close();
#pragma warning disable IDE0004 // Without this specific cast, it gives incorrect values
- ibgLog.Close(dev, results.blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
- (((double)blockSize * (double)(results.blocks + 1)) / 1024) /
- (results.processingTime / 1000), devicePath);
+ ibgLog.Close(dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
+ (((double)blockSize * (double)(results.Blocks + 1)) / 1024) /
+ (results.ProcessingTime / 1000), devicePath);
#pragma warning restore IDE0004 // Without this specific cast, it gives incorrect values
- if(ataReader.CanSeekLBA)
+ if(ataReader.CanSeekLba)
{
- for(int i = 0; i < seekTimes; i++)
+ for(int i = 0; i < SEEK_TIMES; i++)
{
if(aborted) break;
- seekPos = (uint)rnd.Next((int)results.blocks);
+ seekPos = (uint)rnd.Next((int)results.Blocks);
DicConsole.Write("\rSeeking to sector {0}...\t\t", seekPos);
ataReader.Seek(seekPos, out seekCur);
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
- if(seekCur > results.seekMax && seekCur != 0) results.seekMax = seekCur;
- if(seekCur < results.seekMin && seekCur != 0) results.seekMin = seekCur;
+ if(seekCur > results.SeekMax && seekCur != 0) results.SeekMax = seekCur;
+ if(seekCur < results.SeekMin && seekCur != 0) results.SeekMin = seekCur;
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
- results.seekTotal += seekCur;
+ results.SeekTotal += seekCur;
GC.Collect();
}
}
}
else
{
- mhddLog = new MHDDLog(MHDDLogPath, dev, results.blocks, blockSize, blocksToRead);
- ibgLog = new IBGLog(IBGLogPath, currentProfile);
+ mhddLog = new MhddLog(mhddLogPath, dev, results.Blocks, blockSize, blocksToRead);
+ ibgLog = new IbgLog(ibgLogPath, currentProfile);
ulong currentBlock = 0;
- results.blocks = (ulong)(cylinders * heads * sectors);
+ results.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) break;
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
- if(currentSpeed > results.maxSpeed && currentSpeed != 0)
- results.maxSpeed = currentSpeed;
- if(currentSpeed < results.minSpeed && currentSpeed != 0)
- results.minSpeed = currentSpeed;
+ if(currentSpeed > results.MaxSpeed && currentSpeed != 0)
+ results.MaxSpeed = currentSpeed;
+ if(currentSpeed < results.MinSpeed && currentSpeed != 0)
+ results.MinSpeed = currentSpeed;
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
- DicConsole.Write("\rReading cylinder {0} head {1} sector {2} ({3:F3} MiB/sec.)", Cy, Hd,
- Sc, currentSpeed);
+ DicConsole.Write("\rReading cylinder {0} head {1} sector {2} ({3:F3} MiB/sec.)", cy, hd,
+ sc, currentSpeed);
- bool error = ataReader.ReadCHS(out cmdBuf, Cy, Hd, Sc, out duration);
+ bool error = ataReader.ReadChs(out cmdBuf, cy, hd, sc, out duration);
if(!error)
{
@@ -245,8 +245,8 @@ namespace DiscImageChef.Core.Devices.Scanning
}
else
{
- results.errored += blocksToRead;
- results.unreadableSectors.Add(currentBlock);
+ results.Errored += blocksToRead;
+ results.UnreadableSectors.Add(currentBlock);
if(duration < 500) mhddLog.Write(currentBlock, 65535);
else mhddLog.Write(currentBlock, duration);
@@ -267,14 +267,14 @@ namespace DiscImageChef.Core.Devices.Scanning
DicConsole.WriteLine();
mhddLog.Close();
#pragma warning disable IDE0004 // Without this specific cast, it gives incorrect values
- ibgLog.Close(dev, results.blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
- (((double)blockSize * (double)(results.blocks + 1)) / 1024) /
- (results.processingTime / 1000), devicePath);
+ ibgLog.Close(dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
+ (((double)blockSize * (double)(results.Blocks + 1)) / 1024) /
+ (results.ProcessingTime / 1000), devicePath);
#pragma warning restore IDE0004 // Without this specific cast, it gives incorrect values
if(ataReader.CanSeek)
{
- for(int i = 0; i < seekTimes; i++)
+ for(int i = 0; i < SEEK_TIMES; i++)
{
if(aborted) break;
@@ -285,14 +285,14 @@ namespace DiscImageChef.Core.Devices.Scanning
DicConsole.Write("\rSeeking to cylinder {0}, head {1}, sector {2}...\t\t", seekCy, seekHd,
seekSc);
- ataReader.SeekCHS(seekCy, seekHd, seekSc, out seekCur);
+ ataReader.SeekChs(seekCy, seekHd, seekSc, out seekCur);
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
- if(seekCur > results.seekMax && seekCur != 0) results.seekMax = seekCur;
- if(seekCur < results.seekMin && seekCur != 0) results.seekMin = seekCur;
+ if(seekCur > results.SeekMax && seekCur != 0) results.SeekMax = seekCur;
+ if(seekCur < results.SeekMin && seekCur != 0) results.SeekMin = seekCur;
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
- results.seekTotal += seekCur;
+ results.SeekTotal += seekCur;
GC.Collect();
}
}
@@ -300,13 +300,13 @@ namespace DiscImageChef.Core.Devices.Scanning
DicConsole.WriteLine();
- results.processingTime /= 1000;
- results.totalTime = (end - start).TotalSeconds;
+ results.ProcessingTime /= 1000;
+ results.TotalTime = (end - start).TotalSeconds;
#pragma warning disable IDE0004 // Without this specific cast, it gives incorrect values
- results.avgSpeed = (((double)blockSize * (double)(results.blocks + 1)) / 1048576) /
- results.processingTime;
+ results.AvgSpeed = (((double)blockSize * (double)(results.Blocks + 1)) / 1048576) /
+ results.ProcessingTime;
#pragma warning restore IDE0004 // Without this specific cast, it gives incorrect values
- results.seekTimes = seekTimes;
+ results.SeekTimes = SEEK_TIMES;
return results;
}
diff --git a/DiscImageChef.Core/Devices/Scanning/NVMe.cs b/DiscImageChef.Core/Devices/Scanning/NVMe.cs
index 9ad89d857..ced229d5d 100644
--- a/DiscImageChef.Core/Devices/Scanning/NVMe.cs
+++ b/DiscImageChef.Core/Devices/Scanning/NVMe.cs
@@ -35,9 +35,9 @@ using DiscImageChef.Devices;
namespace DiscImageChef.Core.Devices.Scanning
{
- public static class NVMe
+ public static class Nvme
{
- public static ScanResults Scan(string MHDDLogPath, string IBGLogPath, string devicePath, Device dev)
+ public static ScanResults Scan(string mhddLogPath, string ibgLogPath, string devicePath, Device dev)
{
throw new NotImplementedException("NVMe devices not yet supported.");
}
diff --git a/DiscImageChef.Core/Devices/Scanning/SCSI.cs b/DiscImageChef.Core/Devices/Scanning/SCSI.cs
index 62cb6fb46..dcf1a4479 100644
--- a/DiscImageChef.Core/Devices/Scanning/SCSI.cs
+++ b/DiscImageChef.Core/Devices/Scanning/SCSI.cs
@@ -38,19 +38,19 @@ using DiscImageChef.Devices;
namespace DiscImageChef.Core.Devices.Scanning
{
- public static class SCSI
+ public static class Scsi
{
- public static ScanResults Scan(string MHDDLogPath, string IBGLogPath, string devicePath, Device dev)
+ public static ScanResults Scan(string mhddLogPath, string ibgLogPath, string devicePath, Device dev)
{
ScanResults results = new ScanResults();
bool aborted;
- MHDDLog mhddLog;
- IBGLog ibgLog;
+ MhddLog mhddLog;
+ IbgLog ibgLog;
byte[] cmdBuf;
byte[] senseBuf;
bool sense = false;
double duration;
- results.blocks = 0;
+ results.Blocks = 0;
uint blockSize = 0;
ushort currentProfile = 0x0001;
@@ -139,15 +139,15 @@ namespace DiscImageChef.Core.Devices.Scanning
Reader scsiReader = null;
- if(dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.DirectAccess ||
- dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice ||
- dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.OCRWDevice ||
- dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.OpticalDevice ||
- dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.SimplifiedDevice ||
- dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.WriteOnceDevice)
+ if(dev.ScsiType == Decoders.SCSI.PeripheralDeviceTypes.DirectAccess ||
+ dev.ScsiType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice ||
+ dev.ScsiType == Decoders.SCSI.PeripheralDeviceTypes.OCRWDevice ||
+ dev.ScsiType == Decoders.SCSI.PeripheralDeviceTypes.OpticalDevice ||
+ dev.ScsiType == Decoders.SCSI.PeripheralDeviceTypes.SimplifiedDevice ||
+ dev.ScsiType == Decoders.SCSI.PeripheralDeviceTypes.WriteOnceDevice)
{
scsiReader = new Reader(dev, dev.Timeout, null, false);
- results.blocks = scsiReader.GetDeviceBlocks();
+ results.Blocks = scsiReader.GetDeviceBlocks();
if(scsiReader.FindReadCommand())
{
DicConsole.ErrorWriteLine("Unable to read medium.");
@@ -156,24 +156,24 @@ namespace DiscImageChef.Core.Devices.Scanning
blockSize = scsiReader.LogicalBlockSize;
- if(results.blocks != 0 && blockSize != 0)
+ if(results.Blocks != 0 && blockSize != 0)
{
- results.blocks++;
+ results.Blocks++;
#pragma warning disable IDE0004 // Without this specific cast, it gives incorrect values
DicConsole.WriteLine("Media has {0} blocks of {1} bytes/each. (for a total of {2} bytes)",
- results.blocks, blockSize, results.blocks * (ulong)blockSize);
+ results.Blocks, blockSize, results.Blocks * (ulong)blockSize);
#pragma warning restore IDE0004 // Without this specific cast, it gives incorrect values
}
}
- if(dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess)
+ if(dev.ScsiType == 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 results;
}
- if(results.blocks == 0)
+ if(results.Blocks == 0)
{
DicConsole.ErrorWriteLine("Unable to read medium or empty medium present...");
return results;
@@ -182,7 +182,7 @@ namespace DiscImageChef.Core.Devices.Scanning
bool compactDisc = true;
Decoders.CD.FullTOC.CDFullTOC? toc = null;
- if(dev.SCSIType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
+ if(dev.ScsiType == Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
{
sense = dev.GetConfiguration(out cmdBuf, out senseBuf, 0, MmcGetConfigurationRt.Current, dev.Timeout,
out duration);
@@ -227,15 +227,15 @@ namespace DiscImageChef.Core.Devices.Scanning
results.D = 0; // >=50ms, <150ms
results.E = 0; // >=150ms, <500ms
results.F = 0; // >=500ms
- results.errored = 0;
+ results.Errored = 0;
DateTime start;
DateTime end;
- results.processingTime = 0;
- results.totalTime = 0;
+ results.ProcessingTime = 0;
+ results.TotalTime = 0;
double currentSpeed = 0;
- results.maxSpeed = double.MinValue;
- results.minSpeed = double.MaxValue;
- results.unreadableSectors = new List();
+ results.MaxSpeed = double.MinValue;
+ results.MinSpeed = double.MaxValue;
+ results.UnreadableSectors = new List();
aborted = false;
System.Console.CancelKeyPress += (sender, e) => { e.Cancel = aborted = true; };
@@ -279,30 +279,30 @@ namespace DiscImageChef.Core.Devices.Scanning
DicConsole.WriteLine("Reading {0} sectors at a time.", blocksToRead);
- mhddLog = new MHDDLog(MHDDLogPath, dev, results.blocks, blockSize, blocksToRead);
- ibgLog = new IBGLog(IBGLogPath, currentProfile);
+ mhddLog = new MhddLog(mhddLogPath, dev, results.Blocks, blockSize, blocksToRead);
+ ibgLog = new IbgLog(ibgLogPath, currentProfile);
- for(ulong i = 0; i < results.blocks; i += blocksToRead)
+ for(ulong i = 0; i < results.Blocks; i += blocksToRead)
{
if(aborted) break;
double cmdDuration = 0;
- if((results.blocks - i) < blocksToRead) blocksToRead = (uint)(results.blocks - i);
+ if((results.Blocks - i) < blocksToRead) blocksToRead = (uint)(results.Blocks - i);
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
- if(currentSpeed > results.maxSpeed && currentSpeed != 0) results.maxSpeed = currentSpeed;
- if(currentSpeed < results.minSpeed && currentSpeed != 0) results.minSpeed = currentSpeed;
+ if(currentSpeed > results.MaxSpeed && currentSpeed != 0) results.MaxSpeed = currentSpeed;
+ if(currentSpeed < results.MinSpeed && currentSpeed != 0) results.MinSpeed = currentSpeed;
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
- DicConsole.Write("\rReading sector {0} of {1} ({2:F3} MiB/sec.)", i, results.blocks, currentSpeed);
+ DicConsole.Write("\rReading sector {0} of {1} ({2:F3} MiB/sec.)", i, results.Blocks, currentSpeed);
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);
- results.processingTime += cmdDuration;
+ results.ProcessingTime += cmdDuration;
}
if(!sense)
@@ -332,8 +332,8 @@ namespace DiscImageChef.Core.Devices.Scanning
// are in a track where subchannel indicates data)
(senseDecoded.Value.ASC != 0x64 || senseDecoded.Value.ASCQ != 0x00))
{
- results.errored += blocksToRead;
- for(ulong b = i; b < i + blocksToRead; b++) results.unreadableSectors.Add(b);
+ results.Errored += blocksToRead;
+ for(ulong b = i; b < i + blocksToRead; b++) results.UnreadableSectors.Add(b);
if(cmdDuration < 500) mhddLog.Write(i, 65535);
else mhddLog.Write(i, cmdDuration);
@@ -343,8 +343,8 @@ namespace DiscImageChef.Core.Devices.Scanning
}
else
{
- results.errored += blocksToRead;
- for(ulong b = i; b < i + blocksToRead; b++) results.unreadableSectors.Add(b);
+ results.Errored += blocksToRead;
+ for(ulong b = i; b < i + blocksToRead; b++) results.UnreadableSectors.Add(b);
if(cmdDuration < 500) mhddLog.Write(i, 65535);
else mhddLog.Write(i, cmdDuration);
@@ -363,9 +363,9 @@ namespace DiscImageChef.Core.Devices.Scanning
DicConsole.WriteLine();
mhddLog.Close();
#pragma warning disable IDE0004 // Without this specific cast, it gives incorrect values
- ibgLog.Close(dev, results.blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
- (((double)blockSize * (double)(results.blocks + 1)) / 1024) /
- (results.processingTime / 1000), devicePath);
+ ibgLog.Close(dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
+ (((double)blockSize * (double)(results.Blocks + 1)) / 1024) /
+ (results.ProcessingTime / 1000), devicePath);
#pragma warning restore IDE0004 // Without this specific cast, it gives incorrect values
}
else
@@ -374,26 +374,26 @@ namespace DiscImageChef.Core.Devices.Scanning
DicConsole.WriteLine("Reading {0} sectors at a time.", blocksToRead);
- mhddLog = new MHDDLog(MHDDLogPath, dev, results.blocks, blockSize, blocksToRead);
- ibgLog = new IBGLog(IBGLogPath, currentProfile);
+ mhddLog = new MhddLog(mhddLogPath, dev, results.Blocks, blockSize, blocksToRead);
+ ibgLog = new IbgLog(ibgLogPath, currentProfile);
- for(ulong i = 0; i < results.blocks; i += blocksToRead)
+ for(ulong i = 0; i < results.Blocks; i += blocksToRead)
{
if(aborted) break;
double cmdDuration = 0;
- if((results.blocks - i) < blocksToRead) blocksToRead = (uint)(results.blocks - i);
+ if((results.Blocks - i) < blocksToRead) blocksToRead = (uint)(results.Blocks - i);
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
- if(currentSpeed > results.maxSpeed && currentSpeed != 0) results.maxSpeed = currentSpeed;
- if(currentSpeed < results.minSpeed && currentSpeed != 0) results.minSpeed = currentSpeed;
+ if(currentSpeed > results.MaxSpeed && currentSpeed != 0) results.MaxSpeed = currentSpeed;
+ if(currentSpeed < results.MinSpeed && currentSpeed != 0) results.MinSpeed = currentSpeed;
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
- DicConsole.Write("\rReading sector {0} of {1} ({2:F3} MiB/sec.)", i, results.blocks, currentSpeed);
+ DicConsole.Write("\rReading sector {0} of {1} ({2:F3} MiB/sec.)", i, results.Blocks, currentSpeed);
sense = scsiReader.ReadBlocks(out readBuffer, i, blocksToRead, out cmdDuration);
- results.processingTime += cmdDuration;
+ results.ProcessingTime += cmdDuration;
if(!sense && !dev.Error)
{
@@ -410,8 +410,8 @@ namespace DiscImageChef.Core.Devices.Scanning
// TODO: Separate errors on kind of errors.
else
{
- results.errored += blocksToRead;
- for(ulong b = i; b < i + blocksToRead; b++) results.unreadableSectors.Add(b);
+ results.Errored += blocksToRead;
+ for(ulong b = i; b < i + blocksToRead; b++) results.UnreadableSectors.Add(b);
if(cmdDuration < 500) mhddLog.Write(i, 65535);
else mhddLog.Write(i, cmdDuration);
@@ -427,28 +427,28 @@ namespace DiscImageChef.Core.Devices.Scanning
DicConsole.WriteLine();
mhddLog.Close();
#pragma warning disable IDE0004 // Without this specific cast, it gives incorrect values
- ibgLog.Close(dev, results.blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
- (((double)blockSize * (double)(results.blocks + 1)) / 1024) /
- (results.processingTime / 1000), devicePath);
+ ibgLog.Close(dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
+ (((double)blockSize * (double)(results.Blocks + 1)) / 1024) /
+ (results.ProcessingTime / 1000), devicePath);
#pragma warning restore IDE0004 // Without this specific cast, it gives incorrect values
}
- results.seekMax = double.MinValue;
- results.seekMin = double.MaxValue;
- results.seekTotal = 0;
- const int seekTimes = 1000;
+ results.SeekMax = double.MinValue;
+ results.SeekMin = double.MaxValue;
+ results.SeekTotal = 0;
+ const int SEEK_TIMES = 1000;
double seekCur = 0;
Random rnd = new Random();
- uint seekPos = (uint)rnd.Next((int)results.blocks);
+ uint seekPos = (uint)rnd.Next((int)results.Blocks);
- for(int i = 0; i < seekTimes; i++)
+ for(int i = 0; i < SEEK_TIMES; i++)
{
if(aborted) break;
- seekPos = (uint)rnd.Next((int)results.blocks);
+ seekPos = (uint)rnd.Next((int)results.Blocks);
DicConsole.Write("\rSeeking to sector {0}...\t\t", seekPos);
@@ -456,22 +456,22 @@ namespace DiscImageChef.Core.Devices.Scanning
else scsiReader.ReadBlock(out readBuffer, seekPos, out seekCur);
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
- if(seekCur > results.seekMax && seekCur != 0) results.seekMax = seekCur;
- if(seekCur < results.seekMin && seekCur != 0) results.seekMin = seekCur;
+ if(seekCur > results.SeekMax && seekCur != 0) results.SeekMax = seekCur;
+ if(seekCur < results.SeekMin && seekCur != 0) results.SeekMin = seekCur;
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
- results.seekTotal += seekCur;
+ results.SeekTotal += seekCur;
GC.Collect();
}
DicConsole.WriteLine();
- results.processingTime /= 1000;
- results.totalTime = (end - start).TotalSeconds;
+ results.ProcessingTime /= 1000;
+ results.TotalTime = (end - start).TotalSeconds;
#pragma warning disable IDE0004 // Without this specific cast, it gives incorrect values
- results.avgSpeed = (((double)blockSize * (double)(results.blocks + 1)) / 1048576) / results.processingTime;
+ results.AvgSpeed = (((double)blockSize * (double)(results.Blocks + 1)) / 1048576) / results.ProcessingTime;
#pragma warning restore IDE0004 // Without this specific cast, it gives incorrect values
- results.seekTimes = seekTimes;
+ results.SeekTimes = SEEK_TIMES;
return results;
}
diff --git a/DiscImageChef.Core/Devices/Scanning/ScanResults.cs b/DiscImageChef.Core/Devices/Scanning/ScanResults.cs
index 9419f677d..fa8a76f84 100644
--- a/DiscImageChef.Core/Devices/Scanning/ScanResults.cs
+++ b/DiscImageChef.Core/Devices/Scanning/ScanResults.cs
@@ -36,23 +36,23 @@ namespace DiscImageChef.Core.Devices.Scanning
{
public struct ScanResults
{
- public double totalTime;
- public double processingTime;
- public double avgSpeed;
- public double maxSpeed;
- public double minSpeed;
+ public double TotalTime;
+ public double ProcessingTime;
+ public double AvgSpeed;
+ public double MaxSpeed;
+ public double MinSpeed;
public ulong A;
public ulong B;
public ulong C;
public ulong D;
public ulong E;
public ulong F;
- public List unreadableSectors;
- public double seekMax;
- public double seekMin;
- public double seekTotal;
- public int seekTimes;
- public ulong blocks;
- public ulong errored;
+ public List UnreadableSectors;
+ public double SeekMax;
+ public double SeekMin;
+ public double SeekTotal;
+ public int SeekTimes;
+ public ulong Blocks;
+ public ulong Errored;
}
}
\ No newline at end of file
diff --git a/DiscImageChef.Core/Devices/Scanning/SecureDigital.cs b/DiscImageChef.Core/Devices/Scanning/SecureDigital.cs
index 61ac9a919..2282dcba2 100644
--- a/DiscImageChef.Core/Devices/Scanning/SecureDigital.cs
+++ b/DiscImageChef.Core/Devices/Scanning/SecureDigital.cs
@@ -41,15 +41,15 @@ namespace DiscImageChef.Core.Devices.Scanning
{
public static class SecureDigital
{
- public static ScanResults Scan(string MHDDLogPath, string IBGLogPath, string devicePath, Device dev)
+ public static ScanResults Scan(string mhddLogPath, string ibgLogPath, string devicePath, Device dev)
{
ScanResults results = new ScanResults();
bool aborted;
- MHDDLog mhddLog;
- IBGLog ibgLog;
+ MhddLog mhddLog;
+ IbgLog ibgLog;
byte[] cmdBuf;
bool sense;
- results.blocks = 0;
+ results.Blocks = 0;
uint[] response;
uint timeout = 5;
double duration = 0;
@@ -63,24 +63,24 @@ namespace DiscImageChef.Core.Devices.Scanning
ExtendedCSD ecsd = new ExtendedCSD();
CSD csd = new CSD();
- sense = dev.ReadExtendedCSD(out cmdBuf, out response, timeout, out duration);
+ sense = dev.ReadExtendedCsd(out cmdBuf, out response, timeout, out duration);
if(!sense)
{
ecsd = Decoders.MMC.Decoders.DecodeExtendedCSD(cmdBuf);
blocksToRead = ecsd.OptimalReadSize;
- results.blocks = ecsd.SectorCount;
+ results.Blocks = ecsd.SectorCount;
blockSize = (uint)(ecsd.SectorSize == 1 ? 4096 : 512);
// Supposing it's high-capacity MMC if it has Extended CSD...
byteAddressed = false;
}
- if(sense || results.blocks == 0)
+ if(sense || results.Blocks == 0)
{
- sense = dev.ReadCSD(out cmdBuf, out response, timeout, out duration);
+ sense = dev.ReadCsd(out cmdBuf, out response, timeout, out duration);
if(!sense)
{
csd = Decoders.MMC.Decoders.DecodeCSD(cmdBuf);
- results.blocks = (ulong)((csd.Size + 1) * Math.Pow(2, csd.SizeMultiplier + 2));
+ results.Blocks = (ulong)((csd.Size + 1) * Math.Pow(2, csd.SizeMultiplier + 2));
blockSize = (uint)Math.Pow(2, csd.ReadBlockLength);
}
}
@@ -89,11 +89,11 @@ namespace DiscImageChef.Core.Devices.Scanning
{
Decoders.SecureDigital.CSD csd = new Decoders.SecureDigital.CSD();
- sense = dev.ReadCSD(out cmdBuf, out response, timeout, out duration);
+ sense = dev.ReadCsd(out cmdBuf, out response, timeout, out duration);
if(!sense)
{
csd = Decoders.SecureDigital.Decoders.DecodeCSD(cmdBuf);
- results.blocks = (ulong)(csd.Structure == 0
+ results.Blocks = (ulong)(csd.Structure == 0
? (csd.Size + 1) * Math.Pow(2, csd.SizeMultiplier + 2)
: (csd.Size + 1) * 1024);
blockSize = (uint)Math.Pow(2, csd.ReadBlockLength);
@@ -102,7 +102,7 @@ namespace DiscImageChef.Core.Devices.Scanning
}
}
- if(results.blocks == 0)
+ if(results.Blocks == 0)
{
DicConsole.ErrorWriteLine("Unable to get device size.");
return results;
@@ -133,46 +133,46 @@ namespace DiscImageChef.Core.Devices.Scanning
results.D = 0; // >=50ms, <150ms
results.E = 0; // >=150ms, <500ms
results.F = 0; // >=500ms
- results.errored = 0;
+ results.Errored = 0;
DateTime start;
DateTime end;
- results.processingTime = 0;
+ results.ProcessingTime = 0;
double currentSpeed = 0;
- results.maxSpeed = double.MinValue;
- results.minSpeed = double.MaxValue;
- results.unreadableSectors = new List();
- results.seekMax = double.MinValue;
- results.seekMin = double.MaxValue;
- results.seekTotal = 0;
- const int seekTimes = 1000;
+ results.MaxSpeed = double.MinValue;
+ results.MinSpeed = double.MaxValue;
+ results.UnreadableSectors = new List();
+ results.SeekMax = double.MinValue;
+ results.SeekMin = double.MaxValue;
+ results.SeekTotal = 0;
+ const int SEEK_TIMES = 1000;
double seekCur = 0;
Random rnd = new Random();
- uint seekPos = (uint)rnd.Next((int)results.blocks);
+ uint seekPos = (uint)rnd.Next((int)results.Blocks);
aborted = false;
System.Console.CancelKeyPress += (sender, e) => { e.Cancel = aborted = true; };
DicConsole.WriteLine("Reading {0} sectors at a time.", blocksToRead);
- mhddLog = new MHDDLog(MHDDLogPath, dev, results.blocks, blockSize, blocksToRead);
- ibgLog = new IBGLog(IBGLogPath, currentProfile);
+ mhddLog = new MhddLog(mhddLogPath, dev, results.Blocks, blockSize, blocksToRead);
+ ibgLog = new IbgLog(ibgLogPath, currentProfile);
start = DateTime.UtcNow;
- for(ulong i = 0; i < results.blocks; i += blocksToRead)
+ for(ulong i = 0; i < results.Blocks; i += blocksToRead)
{
if(aborted) break;
- if((results.blocks - i) < blocksToRead) blocksToRead = (byte)(results.blocks - i);
+ if((results.Blocks - i) < blocksToRead) blocksToRead = (byte)(results.Blocks - i);
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
- if(currentSpeed > results.maxSpeed && currentSpeed != 0) results.maxSpeed = currentSpeed;
- if(currentSpeed < results.minSpeed && currentSpeed != 0) results.minSpeed = currentSpeed;
+ if(currentSpeed > results.MaxSpeed && currentSpeed != 0) results.MaxSpeed = currentSpeed;
+ if(currentSpeed < results.MinSpeed && currentSpeed != 0) results.MinSpeed = currentSpeed;
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
- DicConsole.Write("\rReading sector {0} of {1} ({2:F3} MiB/sec.)", i, results.blocks, currentSpeed);
+ DicConsole.Write("\rReading sector {0} of {1} ({2:F3} MiB/sec.)", i, results.Blocks, currentSpeed);
bool error = dev.Read(out cmdBuf, out response, (uint)i, blockSize, blocksToRead, byteAddressed,
timeout, out duration);
@@ -191,8 +191,8 @@ namespace DiscImageChef.Core.Devices.Scanning
}
else
{
- results.errored += blocksToRead;
- for(ulong b = i; b < i + blocksToRead; b++) results.unreadableSectors.Add(b);
+ results.Errored += blocksToRead;
+ for(ulong b = i; b < i + blocksToRead; b++) results.UnreadableSectors.Add(b);
if(duration < 500) mhddLog.Write(i, 65535);
else mhddLog.Write(i, duration);
@@ -210,16 +210,16 @@ namespace DiscImageChef.Core.Devices.Scanning
DicConsole.WriteLine();
mhddLog.Close();
#pragma warning disable IDE0004 // Without this specific cast, it gives incorrect values
- ibgLog.Close(dev, results.blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
- (((double)blockSize * (double)(results.blocks + 1)) / 1024) / (results.processingTime / 1000),
+ ibgLog.Close(dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
+ (((double)blockSize * (double)(results.Blocks + 1)) / 1024) / (results.ProcessingTime / 1000),
devicePath);
#pragma warning restore IDE0004 // Without this specific cast, it gives incorrect values
- for(int i = 0; i < seekTimes; i++)
+ for(int i = 0; i < SEEK_TIMES; i++)
{
if(aborted) break;
- seekPos = (uint)rnd.Next((int)results.blocks);
+ seekPos = (uint)rnd.Next((int)results.Blocks);
DicConsole.Write("\rSeeking to sector {0}...\t\t", seekPos);
@@ -227,22 +227,22 @@ namespace DiscImageChef.Core.Devices.Scanning
out seekCur);
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
- if(seekCur > results.seekMax && seekCur != 0) results.seekMax = seekCur;
- if(seekCur < results.seekMin && seekCur != 0) results.seekMin = seekCur;
+ if(seekCur > results.SeekMax && seekCur != 0) results.SeekMax = seekCur;
+ if(seekCur < results.SeekMin && seekCur != 0) results.SeekMin = seekCur;
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
- results.seekTotal += seekCur;
+ results.SeekTotal += seekCur;
GC.Collect();
}
DicConsole.WriteLine();
- results.processingTime /= 1000;
- results.totalTime = (end - start).TotalSeconds;
+ results.ProcessingTime /= 1000;
+ results.TotalTime = (end - start).TotalSeconds;
#pragma warning disable IDE0004 // Without this specific cast, it gives incorrect values
- results.avgSpeed = (((double)blockSize * (double)(results.blocks + 1)) / 1048576) / results.processingTime;
+ results.AvgSpeed = (((double)blockSize * (double)(results.Blocks + 1)) / 1048576) / results.ProcessingTime;
#pragma warning restore IDE0004 // Without this specific cast, it gives incorrect values
- results.seekTimes = seekTimes;
+ results.SeekTimes = SEEK_TIMES;
return results;
}
diff --git a/DiscImageChef.Core/Filesystems.cs b/DiscImageChef.Core/Filesystems.cs
index 18e3454de..371ced3f7 100644
--- a/DiscImageChef.Core/Filesystems.cs
+++ b/DiscImageChef.Core/Filesystems.cs
@@ -33,21 +33,21 @@
using System.Collections.Generic;
using DiscImageChef.CommonTypes;
using DiscImageChef.Filesystems;
-using DiscImageChef.ImagePlugins;
+using DiscImageChef.DiscImages;
namespace DiscImageChef.Core
{
public static class Filesystems
{
- public static void Identify(ImagePlugin imagePlugin, out List id_plugins, Partition partition)
+ public static void Identify(ImagePlugin imagePlugin, out List idPlugins, Partition partition)
{
- id_plugins = new List();
+ idPlugins = new List();
PluginBase plugins = new PluginBase();
plugins.RegisterAllPlugins();
- foreach(Filesystem _plugin in plugins.PluginsList.Values)
+ foreach(Filesystem plugin in plugins.PluginsList.Values)
{
- if(_plugin.Identify(imagePlugin, partition)) id_plugins.Add(_plugin.Name.ToLower());
+ if(plugin.Identify(imagePlugin, partition)) idPlugins.Add(plugin.Name.ToLower());
}
}
}
diff --git a/DiscImageChef.Core/ImageFormat.cs b/DiscImageChef.Core/ImageFormat.cs
index 5f11a3ba3..c69892e59 100644
--- a/DiscImageChef.Core/ImageFormat.cs
+++ b/DiscImageChef.Core/ImageFormat.cs
@@ -33,7 +33,7 @@
using System;
using DiscImageChef.Console;
using DiscImageChef.Filters;
-using DiscImageChef.ImagePlugins;
+using DiscImageChef.DiscImages;
namespace DiscImageChef.Core
{
@@ -43,23 +43,23 @@ namespace DiscImageChef.Core
{
try
{
- ImagePlugin _imageFormat;
+ ImagePlugin imageFormat;
PluginBase plugins = new PluginBase();
plugins.RegisterAllPlugins();
- _imageFormat = null;
+ imageFormat = null;
// Check all but RAW plugin
- foreach(ImagePlugin _imageplugin in plugins.ImagePluginsList.Values)
+ foreach(ImagePlugin imageplugin in plugins.ImagePluginsList.Values)
{
- if(_imageplugin.PluginUUID != new Guid("12345678-AAAA-BBBB-CCCC-123456789000"))
+ if(imageplugin.PluginUuid != new Guid("12345678-AAAA-BBBB-CCCC-123456789000"))
{
try
{
- DicConsole.DebugWriteLine("Format detection", "Trying plugin {0}", _imageplugin.Name);
- if(_imageplugin.IdentifyImage(imageFilter))
+ DicConsole.DebugWriteLine("Format detection", "Trying plugin {0}", imageplugin.Name);
+ if(imageplugin.IdentifyImage(imageFilter))
{
- _imageFormat = _imageplugin;
+ imageFormat = imageplugin;
break;
}
}
@@ -70,18 +70,18 @@ namespace DiscImageChef.Core
}
// Check only RAW plugin
- if(_imageFormat == null)
+ if(imageFormat == null)
{
- foreach(ImagePlugin _imageplugin in plugins.ImagePluginsList.Values)
+ foreach(ImagePlugin imageplugin in plugins.ImagePluginsList.Values)
{
- if(_imageplugin.PluginUUID == new Guid("12345678-AAAA-BBBB-CCCC-123456789000"))
+ if(imageplugin.PluginUuid == new Guid("12345678-AAAA-BBBB-CCCC-123456789000"))
{
try
{
- DicConsole.DebugWriteLine("Format detection", "Trying plugin {0}", _imageplugin.Name);
- if(_imageplugin.IdentifyImage(imageFilter))
+ DicConsole.DebugWriteLine("Format detection", "Trying plugin {0}", imageplugin.Name);
+ if(imageplugin.IdentifyImage(imageFilter))
{
- _imageFormat = _imageplugin;
+ imageFormat = imageplugin;
break;
}
}
@@ -93,9 +93,9 @@ namespace DiscImageChef.Core
}
// Still not recognized
- if(_imageFormat == null) { return null; }
+ if(imageFormat == null) { return null; }
- return _imageFormat;
+ return imageFormat;
}
catch { return null; }
}
diff --git a/DiscImageChef.Core/Logging/DumpLog.cs b/DiscImageChef.Core/Logging/DumpLog.cs
index 6cbb9dabf..eac4b52e8 100644
--- a/DiscImageChef.Core/Logging/DumpLog.cs
+++ b/DiscImageChef.Core/Logging/DumpLog.cs
@@ -84,22 +84,22 @@ namespace DiscImageChef.Core.Logging
logSw.WriteLine("Removable device: {0}", dev.IsRemovable);
logSw.WriteLine("Device type: {0}", dev.Type);
logSw.WriteLine("CompactFlash device: {0}", dev.IsCompactFlash);
- logSw.WriteLine("PCMCIA device: {0}", dev.IsPCMCIA);
- logSw.WriteLine("USB device: {0}", dev.IsUSB);
- if(dev.IsUSB)
+ logSw.WriteLine("PCMCIA device: {0}", dev.IsPcmcia);
+ logSw.WriteLine("USB device: {0}", dev.IsUsb);
+ if(dev.IsUsb)
{
- logSw.WriteLine("USB manufacturer: {0}", dev.USBManufacturerString);
- logSw.WriteLine("USB product: {0}", dev.USBProductString);
- logSw.WriteLine("USB serial: {0}", dev.USBSerialString);
- logSw.WriteLine("USB vendor ID: {0:X4}h", dev.USBVendorID);
- logSw.WriteLine("USB product ID: {0:X4}h", dev.USBProductID);
+ logSw.WriteLine("USB manufacturer: {0}", dev.UsbManufacturerString);
+ logSw.WriteLine("USB product: {0}", dev.UsbProductString);
+ logSw.WriteLine("USB serial: {0}", dev.UsbSerialString);
+ logSw.WriteLine("USB vendor ID: {0:X4}h", dev.UsbVendorId);
+ logSw.WriteLine("USB product ID: {0:X4}h", dev.UsbProductId);
}
logSw.WriteLine("FireWire device: {0}", dev.IsFireWire);
if(dev.IsFireWire)
{
logSw.WriteLine("FireWire vendor: {0}", dev.FireWireVendorName);
logSw.WriteLine("FireWire model: {0}", dev.FireWireModelName);
- logSw.WriteLine("FireWire GUID: 0x{0:X16}", dev.FireWireGUID);
+ logSw.WriteLine("FireWire GUID: 0x{0:X16}", dev.FireWireGuid);
logSw.WriteLine("FireWire vendor ID: 0x{0:X8}", dev.FireWireVendor);
logSw.WriteLine("FireWire product ID: 0x{0:X8}", dev.FireWireModel);
}
diff --git a/DiscImageChef.Core/Logging/IBGLog.cs b/DiscImageChef.Core/Logging/IBGLog.cs
index ed7e1364c..3de9021be 100644
--- a/DiscImageChef.Core/Logging/IBGLog.cs
+++ b/DiscImageChef.Core/Logging/IBGLog.cs
@@ -38,7 +38,7 @@ using DiscImageChef.Devices;
namespace DiscImageChef.Core.Logging
{
- class IBGLog
+ class IbgLog
{
static FileStream ibgFs;
static StringBuilder ibgSb;
@@ -54,7 +54,7 @@ namespace DiscImageChef.Core.Logging
static ulong ibgIntSector;
static int ibgSampleRate;
- internal IBGLog(string outputFile, ushort currentProfile)
+ internal IbgLog(string outputFile, ushort currentProfile)
{
if(!string.IsNullOrEmpty(outputFile))
{
@@ -230,7 +230,7 @@ namespace DiscImageChef.Core.Logging
StringBuilder ibgHeader = new StringBuilder();
string ibgBusType;
- if(dev.IsUSB) ibgBusType = "USB";
+ if(dev.IsUsb) ibgBusType = "USB";
else if(dev.IsFireWire) ibgBusType = "FireWire";
else ibgBusType = dev.Type.ToString();
diff --git a/DiscImageChef.Core/Logging/MHDDLog.cs b/DiscImageChef.Core/Logging/MHDDLog.cs
index ff48867d1..6078b1fff 100644
--- a/DiscImageChef.Core/Logging/MHDDLog.cs
+++ b/DiscImageChef.Core/Logging/MHDDLog.cs
@@ -37,11 +37,11 @@ using DiscImageChef.Devices;
namespace DiscImageChef.Core.Logging
{
- class MHDDLog
+ class MhddLog
{
FileStream mhddFs;
- internal MHDDLog(string outputFile, Device dev, ulong blocks, ulong blockSize, ulong blocksToRead)
+ internal MhddLog(string outputFile, Device dev, ulong blocks, ulong blockSize, ulong blocksToRead)
{
if(dev != null && !string.IsNullOrEmpty(outputFile))
{
@@ -98,7 +98,7 @@ namespace DiscImageChef.Core.Logging
byte[] scanblocksizeBytes = Encoding.ASCII.GetBytes(scanblocksize);
byte[] verBytes = Encoding.ASCII.GetBytes(ver);
- uint Pointer = (uint)(deviceBytes.Length + modeBytes.Length + fwBytes.Length + snBytes.Length +
+ uint pointer = (uint)(deviceBytes.Length + modeBytes.Length + fwBytes.Length + snBytes.Length +
sectorsBytes.Length + sectorsizeBytes.Length + scanblocksizeBytes.Length +
verBytes.Length + 2 * 9 + // New lines
4); // Pointer
@@ -107,7 +107,7 @@ namespace DiscImageChef.Core.Logging
newLine[0] = 0x0D;
newLine[1] = 0x0A;
- mhddFs.Write(BitConverter.GetBytes(Pointer), 0, 4);
+ mhddFs.Write(BitConverter.GetBytes(pointer), 0, 4);
mhddFs.Write(newLine, 0, 2);
mhddFs.Write(verBytes, 0, verBytes.Length);
mhddFs.Write(newLine, 0, 2);
diff --git a/DiscImageChef.Core/Partitions.cs b/DiscImageChef.Core/Partitions.cs
index 19870c58e..b0fc3b7fd 100644
--- a/DiscImageChef.Core/Partitions.cs
+++ b/DiscImageChef.Core/Partitions.cs
@@ -34,8 +34,8 @@ using System.Collections.Generic;
using System.Linq;
using DiscImageChef.CommonTypes;
using DiscImageChef.Console;
-using DiscImageChef.ImagePlugins;
-using DiscImageChef.PartPlugins;
+using DiscImageChef.DiscImages;
+using DiscImageChef.Partitions;
namespace DiscImageChef.Core
{
@@ -50,11 +50,11 @@ namespace DiscImageChef.Core
List checkedLocations = new List();
// Getting all partitions from device (e.g. tracks)
- if(image.ImageInfo.imageHasPartitions)
+ if(image.ImageInfo.ImageHasPartitions)
{
foreach(Partition imagePartition in image.GetPartitions())
{
- foreach(PartPlugin _partplugin in plugins.PartPluginsList.Values)
+ foreach(PartitionPlugin _partplugin in plugins.PartPluginsList.Values)
{
if(_partplugin.GetInformation(image, out List _partitions, imagePartition.Start))
{
@@ -70,7 +70,7 @@ namespace DiscImageChef.Core
// Getting all partitions at start of device
else
{
- foreach(PartPlugin _partplugin in plugins.PartPluginsList.Values)
+ foreach(PartitionPlugin _partplugin in plugins.PartPluginsList.Values)
{
if(_partplugin.GetInformation(image, out List _partitions, 0))
{
@@ -93,7 +93,7 @@ namespace DiscImageChef.Core
List childs = new List();
- foreach(PartPlugin _partplugin in plugins.PartPluginsList.Values)
+ foreach(PartitionPlugin _partplugin in plugins.PartPluginsList.Values)
{
DicConsole.DebugWriteLine("Partitions", "Trying {0} @ {1}", _partplugin.Name, partitions[0].Start);
if(_partplugin.GetInformation(image, out List _partitions, partitions[0].Start))
@@ -129,7 +129,7 @@ namespace DiscImageChef.Core
}
// Be sure that device partitions are not excluded if not mapped by any scheme...
- if(image.ImageInfo.imageHasPartitions)
+ if(image.ImageInfo.ImageHasPartitions)
{
List startLocations = new List();
diff --git a/DiscImageChef.Core/PluginBase.cs b/DiscImageChef.Core/PluginBase.cs
index 52a224196..3225ac8b5 100644
--- a/DiscImageChef.Core/PluginBase.cs
+++ b/DiscImageChef.Core/PluginBase.cs
@@ -36,21 +36,21 @@ using System.Reflection;
using System.Text;
using DiscImageChef.Console;
using DiscImageChef.Filesystems;
-using DiscImageChef.ImagePlugins;
-using DiscImageChef.PartPlugins;
+using DiscImageChef.DiscImages;
+using DiscImageChef.Partitions;
namespace DiscImageChef.Core
{
public class PluginBase
{
public SortedDictionary PluginsList;
- public SortedDictionary PartPluginsList;
+ public SortedDictionary PartPluginsList;
public SortedDictionary ImagePluginsList;
public PluginBase()
{
PluginsList = new SortedDictionary();
- PartPluginsList = new SortedDictionary();
+ PartPluginsList = new SortedDictionary();
ImagePluginsList = new SortedDictionary();
}
@@ -73,15 +73,15 @@ namespace DiscImageChef.Core
catch(Exception exception) { DicConsole.ErrorWriteLine("Exception {0}", exception); }
}
- assembly = Assembly.GetAssembly(typeof(PartPlugin));
+ assembly = Assembly.GetAssembly(typeof(PartitionPlugin));
foreach(Type type in assembly.GetTypes())
{
try
{
- if(type.IsSubclassOf(typeof(PartPlugin)))
+ if(type.IsSubclassOf(typeof(PartitionPlugin)))
{
- PartPlugin plugin = (PartPlugin)type.GetConstructor(Type.EmptyTypes).Invoke(new object[] { });
+ PartitionPlugin plugin = (PartitionPlugin)type.GetConstructor(Type.EmptyTypes).Invoke(new object[] { });
RegisterPartPlugin(plugin);
}
}
@@ -121,7 +121,7 @@ namespace DiscImageChef.Core
if(!PluginsList.ContainsKey(plugin.Name.ToLower())) { PluginsList.Add(plugin.Name.ToLower(), plugin); }
}
- void RegisterPartPlugin(PartPlugin partplugin)
+ void RegisterPartPlugin(PartitionPlugin partplugin)
{
if(!PartPluginsList.ContainsKey(partplugin.Name.ToLower()))
{
diff --git a/DiscImageChef.Core/Sidecar/AudioMedia.cs b/DiscImageChef.Core/Sidecar/AudioMedia.cs
index da03c0dab..3aec46fb9 100644
--- a/DiscImageChef.Core/Sidecar/AudioMedia.cs
+++ b/DiscImageChef.Core/Sidecar/AudioMedia.cs
@@ -32,7 +32,7 @@
using System.Collections.Generic;
using System.IO;
-using DiscImageChef.ImagePlugins;
+using DiscImageChef.DiscImages;
using Schemas;
namespace DiscImageChef.Core
diff --git a/DiscImageChef.Core/Sidecar/BlockMedia.cs b/DiscImageChef.Core/Sidecar/BlockMedia.cs
index 9137c9ca1..0aa8d52e9 100644
--- a/DiscImageChef.Core/Sidecar/BlockMedia.cs
+++ b/DiscImageChef.Core/Sidecar/BlockMedia.cs
@@ -39,7 +39,7 @@ using DiscImageChef.Console;
using DiscImageChef.Decoders.PCMCIA;
using DiscImageChef.Filesystems;
using DiscImageChef.Filters;
-using DiscImageChef.ImagePlugins;
+using DiscImageChef.DiscImages;
using Schemas;
using Tuple = DiscImageChef.Decoders.PCMCIA.Tuple;
@@ -78,7 +78,7 @@ namespace DiscImageChef.Core
sidecar.BlockMedia[0].Sequence.TotalMedia = 1;
}
- foreach(MediaTagType tagType in image.ImageInfo.readableMediaTags)
+ foreach(MediaTagType tagType in image.ImageInfo.ReadableMediaTags)
{
switch(tagType)
{
@@ -233,7 +233,7 @@ namespace DiscImageChef.Core
}
// If there is only one track, and it's the same as the image file (e.g. ".iso" files), don't re-checksum.
- if(image.PluginUUID == new System.Guid("12345678-AAAA-BBBB-CCCC-123456789000") &&
+ if(image.PluginUuid == new System.Guid("12345678-AAAA-BBBB-CCCC-123456789000") &&
filterId == new System.Guid("12345678-AAAA-BBBB-CCCC-123456789000"))
{
sidecar.BlockMedia[0].ContentChecksums = sidecar.BlockMedia[0].Checksums;
@@ -280,12 +280,12 @@ namespace DiscImageChef.Core
EndProgress2();
}
- Metadata.MediaType.MediaTypeToString(image.ImageInfo.mediaType, out string dskType, out string dskSubType);
+ Metadata.MediaType.MediaTypeToString(image.ImageInfo.MediaType, out string dskType, out string dskSubType);
sidecar.BlockMedia[0].DiskType = dskType;
sidecar.BlockMedia[0].DiskSubType = dskSubType;
- Statistics.AddMedia(image.ImageInfo.mediaType, false);
+ Statistics.AddMedia(image.ImageInfo.MediaType, false);
- sidecar.BlockMedia[0].Dimensions = Metadata.Dimensions.DimensionsFromMediaType(image.ImageInfo.mediaType);
+ sidecar.BlockMedia[0].Dimensions = Metadata.Dimensions.DimensionsFromMediaType(image.ImageInfo.MediaType);
sidecar.BlockMedia[0].LogicalBlocks = (long)image.GetSectors();
sidecar.BlockMedia[0].LogicalBlockSize = (int)image.GetSectorSize();
@@ -314,15 +314,15 @@ namespace DiscImageChef.Core
};
List lstFs = new List();
- foreach(Filesystem _plugin in plugins.PluginsList.Values)
+ foreach(Filesystem plugin in plugins.PluginsList.Values)
{
try
{
- if(_plugin.Identify(image, partitions[i]))
+ if(plugin.Identify(image, partitions[i]))
{
- _plugin.GetInformation(image, partitions[i], out string foo);
- lstFs.Add(_plugin.XmlFSType);
- Statistics.AddFilesystem(_plugin.XmlFSType.Type);
+ plugin.GetInformation(image, partitions[i], out string foo);
+ lstFs.Add(plugin.XmlFSType);
+ Statistics.AddFilesystem(plugin.XmlFSType.Type);
}
}
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
@@ -350,15 +350,15 @@ namespace DiscImageChef.Core
List lstFs = new List();
- foreach(Filesystem _plugin in plugins.PluginsList.Values)
+ foreach(Filesystem plugin in plugins.PluginsList.Values)
{
try
{
- if(_plugin.Identify(image, wholePart))
+ if(plugin.Identify(image, wholePart))
{
- _plugin.GetInformation(image, wholePart, out string foo);
- lstFs.Add(_plugin.XmlFSType);
- Statistics.AddFilesystem(_plugin.XmlFSType.Type);
+ plugin.GetInformation(image, wholePart, out string foo);
+ lstFs.Add(plugin.XmlFSType);
+ Statistics.AddFilesystem(plugin.XmlFSType.Type);
}
}
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
@@ -372,17 +372,17 @@ namespace DiscImageChef.Core
if(lstFs.Count > 0) sidecar.BlockMedia[0].FileSystemInformation[0].FileSystems = lstFs.ToArray();
}
- if(image.ImageInfo.cylinders > 0 && image.ImageInfo.heads > 0 && image.ImageInfo.sectorsPerTrack > 0)
+ if(image.ImageInfo.Cylinders > 0 && image.ImageInfo.Heads > 0 && image.ImageInfo.SectorsPerTrack > 0)
{
sidecar.BlockMedia[0].CylindersSpecified = true;
sidecar.BlockMedia[0].HeadsSpecified = true;
sidecar.BlockMedia[0].SectorsPerTrackSpecified = true;
- sidecar.BlockMedia[0].Cylinders = image.ImageInfo.cylinders;
- sidecar.BlockMedia[0].Heads = image.ImageInfo.heads;
- sidecar.BlockMedia[0].SectorsPerTrack = image.ImageInfo.sectorsPerTrack;
+ sidecar.BlockMedia[0].Cylinders = image.ImageInfo.Cylinders;
+ sidecar.BlockMedia[0].Heads = image.ImageInfo.Heads;
+ sidecar.BlockMedia[0].SectorsPerTrack = image.ImageInfo.SectorsPerTrack;
}
- if(image.ImageInfo.readableMediaTags.Contains(MediaTagType.ATA_IDENTIFY))
+ if(image.ImageInfo.ReadableMediaTags.Contains(MediaTagType.ATA_IDENTIFY))
{
Decoders.ATA.Identify.IdentifyDevice? ataId =
Decoders.ATA.Identify.Decode(image.ReadDiskTag(MediaTagType.ATA_IDENTIFY));
@@ -413,7 +413,7 @@ namespace DiscImageChef.Core
// TODO: This is more of a hack, redo it planned for >4.0
string trkFormat = null;
- switch(image.ImageInfo.mediaType)
+ switch(image.ImageInfo.MediaType)
{
case MediaType.Apple32SS:
case MediaType.Apple32DS:
@@ -536,51 +536,51 @@ namespace DiscImageChef.Core
if(File.Exists(scpFilePath))
{
- ImagePlugins.SuperCardPro scpImage = new SuperCardPro();
+ DiscImages.SuperCardPro scpImage = new SuperCardPro();
Filters.ZZZNoFilter scpFilter = new ZZZNoFilter();
scpFilter.Open(scpFilePath);
- if(image.ImageInfo.heads <= 2 && scpImage.IdentifyImage(scpFilter))
+ if(image.ImageInfo.Heads <= 2 && scpImage.IdentifyImage(scpFilter))
{
try { scpImage.OpenImage(scpFilter); }
catch(NotImplementedException) { }
- if((image.ImageInfo.heads == 2 && scpImage.header.heads == 0) ||
- (image.ImageInfo.heads == 1 && (scpImage.header.heads == 1 || scpImage.header.heads == 2)))
+ if((image.ImageInfo.Heads == 2 && scpImage.Header.heads == 0) ||
+ (image.ImageInfo.Heads == 1 && (scpImage.Header.heads == 1 || scpImage.Header.heads == 2)))
{
- if(scpImage.header.end + 1 >= image.ImageInfo.cylinders)
+ if(scpImage.Header.end + 1 >= image.ImageInfo.Cylinders)
{
List scpBlockTrackTypes = new List();
long currentSector = 0;
Stream scpStream = scpFilter.GetDataForkStream();
- for(byte t = scpImage.header.start; t <= scpImage.header.end; t++)
+ for(byte t = scpImage.Header.start; t <= scpImage.Header.end; t++)
{
BlockTrackType scpBlockTrackType = new BlockTrackType();
- scpBlockTrackType.Cylinder = t / image.ImageInfo.heads;
- scpBlockTrackType.Head = t % image.ImageInfo.heads;
+ scpBlockTrackType.Cylinder = t / image.ImageInfo.Heads;
+ scpBlockTrackType.Head = t % image.ImageInfo.Heads;
scpBlockTrackType.Image = new ImageType();
scpBlockTrackType.Image.format = scpImage.GetImageFormat();
scpBlockTrackType.Image.Value = Path.GetFileName(scpFilePath);
- scpBlockTrackType.Image.offset = scpImage.header.offsets[t];
+ scpBlockTrackType.Image.offset = scpImage.Header.offsets[t];
- if(scpBlockTrackType.Cylinder < image.ImageInfo.cylinders)
+ if(scpBlockTrackType.Cylinder < image.ImageInfo.Cylinders)
{
scpBlockTrackType.StartSector = currentSector;
- currentSector += image.ImageInfo.sectorsPerTrack;
+ currentSector += image.ImageInfo.SectorsPerTrack;
scpBlockTrackType.EndSector = currentSector - 1;
- scpBlockTrackType.Sectors = image.ImageInfo.sectorsPerTrack;
- scpBlockTrackType.BytesPerSector = (int)image.ImageInfo.sectorSize;
+ scpBlockTrackType.Sectors = image.ImageInfo.SectorsPerTrack;
+ scpBlockTrackType.BytesPerSector = (int)image.ImageInfo.SectorSize;
scpBlockTrackType.Format = trkFormat;
}
- if(scpImage.tracks.TryGetValue(t, out SuperCardPro.TrackHeader scpTrack))
+ if(scpImage.Tracks.TryGetValue(t, out SuperCardPro.TrackHeader scpTrack))
{
byte[] trackContents =
- new byte[(scpTrack.entries.Last().dataOffset +
- scpTrack.entries.Last().trackLength) - scpImage.header.offsets[t] +
+ new byte[(scpTrack.Entries.Last().dataOffset +
+ scpTrack.Entries.Last().trackLength) - scpImage.Header.offsets[t] +
1];
- scpStream.Position = scpImage.header.offsets[t];
+ scpStream.Position = scpImage.Header.offsets[t];
scpStream.Read(trackContents, 0, trackContents.Length);
scpBlockTrackType.Size = trackContents.Length;
scpBlockTrackType.Checksums = Checksum.GetChecksums(trackContents).ToArray();
@@ -595,12 +595,12 @@ namespace DiscImageChef.Core
else
DicConsole
.ErrorWriteLine("SuperCardPro image do not contain same number of tracks ({0}) than disk image ({1}), ignoring...",
- scpImage.header.end + 1, image.ImageInfo.cylinders);
+ scpImage.Header.end + 1, image.ImageInfo.Cylinders);
}
else
DicConsole
.ErrorWriteLine("SuperCardPro image do not contain same number of heads ({0}) than disk image ({1}), ignoring...",
- 2, image.ImageInfo.heads);
+ 2, image.ImageInfo.Heads);
}
}
#endregion
@@ -625,17 +625,17 @@ namespace DiscImageChef.Core
if(kfFile != null)
{
- ImagePlugins.KryoFlux kfImage = new KryoFlux();
+ DiscImages.KryoFlux kfImage = new KryoFlux();
Filters.ZZZNoFilter kfFilter = new ZZZNoFilter();
kfFilter.Open(kfFile);
- if(image.ImageInfo.heads <= 2 && kfImage.IdentifyImage(kfFilter))
+ if(image.ImageInfo.Heads <= 2 && kfImage.IdentifyImage(kfFilter))
{
try { kfImage.OpenImage(kfFilter); }
catch(NotImplementedException) { }
- if(kfImage.ImageInfo.heads == image.ImageInfo.heads)
+ if(kfImage.ImageInfo.Heads == image.ImageInfo.Heads)
{
- if(kfImage.ImageInfo.cylinders >= image.ImageInfo.cylinders)
+ if(kfImage.ImageInfo.Cylinders >= image.ImageInfo.Cylinders)
{
List kfBlockTrackTypes = new List();
@@ -644,8 +644,8 @@ namespace DiscImageChef.Core
foreach(KeyValuePair kvp in kfImage.tracks)
{
BlockTrackType kfBlockTrackType = new BlockTrackType();
- kfBlockTrackType.Cylinder = kvp.Key / image.ImageInfo.heads;
- kfBlockTrackType.Head = kvp.Key % image.ImageInfo.heads;
+ kfBlockTrackType.Cylinder = kvp.Key / image.ImageInfo.Heads;
+ kfBlockTrackType.Head = kvp.Key % image.ImageInfo.Heads;
kfBlockTrackType.Image = new ImageType();
kfBlockTrackType.Image.format = kfImage.GetImageFormat();
kfBlockTrackType.Image.Value =
@@ -655,13 +655,13 @@ namespace DiscImageChef.Core
: kvp.Value.GetFilename();
kfBlockTrackType.Image.offset = 0;
- if(kfBlockTrackType.Cylinder < image.ImageInfo.cylinders)
+ if(kfBlockTrackType.Cylinder < image.ImageInfo.Cylinders)
{
kfBlockTrackType.StartSector = currentSector;
- currentSector += image.ImageInfo.sectorsPerTrack;
+ currentSector += image.ImageInfo.SectorsPerTrack;
kfBlockTrackType.EndSector = currentSector - 1;
- kfBlockTrackType.Sectors = image.ImageInfo.sectorsPerTrack;
- kfBlockTrackType.BytesPerSector = (int)image.ImageInfo.sectorSize;
+ kfBlockTrackType.Sectors = image.ImageInfo.SectorsPerTrack;
+ kfBlockTrackType.BytesPerSector = (int)image.ImageInfo.SectorSize;
kfBlockTrackType.Format = trkFormat;
}
@@ -681,12 +681,12 @@ namespace DiscImageChef.Core
else
DicConsole
.ErrorWriteLine("KryoFlux image do not contain same number of tracks ({0}) than disk image ({1}), ignoring...",
- kfImage.ImageInfo.cylinders, image.ImageInfo.cylinders);
+ kfImage.ImageInfo.Cylinders, image.ImageInfo.Cylinders);
}
else
DicConsole
.ErrorWriteLine("KryoFluximage do not contain same number of heads ({0}) than disk image ({1}), ignoring...",
- kfImage.ImageInfo.heads, image.ImageInfo.heads);
+ kfImage.ImageInfo.Heads, image.ImageInfo.Heads);
}
}
#endregion
@@ -697,7 +697,7 @@ namespace DiscImageChef.Core
if(File.Exists(dfiFilePath))
{
- ImagePlugins.DiscFerret dfiImage = new DiscFerret();
+ DiscImages.DiscFerret dfiImage = new DiscFerret();
Filters.ZZZNoFilter dfiFilter = new ZZZNoFilter();
dfiFilter.Open(dfiFilePath);
@@ -706,35 +706,35 @@ namespace DiscImageChef.Core
try { dfiImage.OpenImage(dfiFilter); }
catch(NotImplementedException) { }
- if(image.ImageInfo.heads == dfiImage.ImageInfo.heads)
+ if(image.ImageInfo.Heads == dfiImage.ImageInfo.Heads)
{
- if(dfiImage.ImageInfo.cylinders >= image.ImageInfo.cylinders)
+ if(dfiImage.ImageInfo.Cylinders >= image.ImageInfo.Cylinders)
{
List dfiBlockTrackTypes = new List();
long currentSector = 0;
Stream dfiStream = dfiFilter.GetDataForkStream();
- foreach(int t in dfiImage.trackOffsets.Keys)
+ foreach(int t in dfiImage.TrackOffsets.Keys)
{
BlockTrackType dfiBlockTrackType = new BlockTrackType();
- dfiBlockTrackType.Cylinder = t / image.ImageInfo.heads;
- dfiBlockTrackType.Head = t % image.ImageInfo.heads;
+ dfiBlockTrackType.Cylinder = t / image.ImageInfo.Heads;
+ dfiBlockTrackType.Head = t % image.ImageInfo.Heads;
dfiBlockTrackType.Image = new ImageType();
dfiBlockTrackType.Image.format = dfiImage.GetImageFormat();
dfiBlockTrackType.Image.Value = Path.GetFileName(dfiFilePath);
- if(dfiBlockTrackType.Cylinder < image.ImageInfo.cylinders)
+ if(dfiBlockTrackType.Cylinder < image.ImageInfo.Cylinders)
{
dfiBlockTrackType.StartSector = currentSector;
- currentSector += image.ImageInfo.sectorsPerTrack;
+ currentSector += image.ImageInfo.SectorsPerTrack;
dfiBlockTrackType.EndSector = currentSector - 1;
- dfiBlockTrackType.Sectors = image.ImageInfo.sectorsPerTrack;
- dfiBlockTrackType.BytesPerSector = (int)image.ImageInfo.sectorSize;
+ dfiBlockTrackType.Sectors = image.ImageInfo.SectorsPerTrack;
+ dfiBlockTrackType.BytesPerSector = (int)image.ImageInfo.SectorSize;
dfiBlockTrackType.Format = trkFormat;
}
- if(dfiImage.trackOffsets.TryGetValue(t, out long offset) &&
- dfiImage.trackLengths.TryGetValue(t, out long length))
+ if(dfiImage.TrackOffsets.TryGetValue(t, out long offset) &&
+ dfiImage.TrackLengths.TryGetValue(t, out long length))
{
dfiBlockTrackType.Image.offset = offset;
byte[] trackContents = new byte[length];
@@ -753,12 +753,12 @@ namespace DiscImageChef.Core
else
DicConsole
.ErrorWriteLine("DiscFerret image do not contain same number of tracks ({0}) than disk image ({1}), ignoring...",
- dfiImage.ImageInfo.cylinders, image.ImageInfo.cylinders);
+ dfiImage.ImageInfo.Cylinders, image.ImageInfo.Cylinders);
}
else
DicConsole
.ErrorWriteLine("DiscFerret image do not contain same number of heads ({0}) than disk image ({1}), ignoring...",
- dfiImage.ImageInfo.heads, image.ImageInfo.heads);
+ dfiImage.ImageInfo.Heads, image.ImageInfo.Heads);
}
}
#endregion
diff --git a/DiscImageChef.Core/Sidecar/LinearMedia.cs b/DiscImageChef.Core/Sidecar/LinearMedia.cs
index fa6c3e502..769e51dce 100644
--- a/DiscImageChef.Core/Sidecar/LinearMedia.cs
+++ b/DiscImageChef.Core/Sidecar/LinearMedia.cs
@@ -32,7 +32,7 @@
using System.Collections.Generic;
using System.IO;
-using DiscImageChef.ImagePlugins;
+using DiscImageChef.DiscImages;
using Schemas;
namespace DiscImageChef.Core
diff --git a/DiscImageChef.Core/Sidecar/OpticalDisc.cs b/DiscImageChef.Core/Sidecar/OpticalDisc.cs
index 3494fbb12..bac5e733c 100644
--- a/DiscImageChef.Core/Sidecar/OpticalDisc.cs
+++ b/DiscImageChef.Core/Sidecar/OpticalDisc.cs
@@ -34,7 +34,7 @@ using System.Collections.Generic;
using System.IO;
using DiscImageChef.CommonTypes;
using DiscImageChef.Filesystems;
-using DiscImageChef.ImagePlugins;
+using DiscImageChef.DiscImages;
using Schemas;
namespace DiscImageChef.Core
@@ -72,9 +72,9 @@ namespace DiscImageChef.Core
sidecar.OpticalDisc[0].Sequence.TotalMedia = 1;
}
- MediaType dskType = image.ImageInfo.mediaType;
+ MediaType dskType = image.ImageInfo.MediaType;
- foreach(MediaTagType tagType in image.ImageInfo.readableMediaTags)
+ foreach(MediaTagType tagType in image.ImageInfo.ReadableMediaTags)
{
switch(tagType)
{
@@ -254,22 +254,22 @@ namespace DiscImageChef.Core
Schemas.TrackType xmlTrk = new Schemas.TrackType();
switch(trk.TrackType)
{
- case ImagePlugins.TrackType.Audio:
+ case DiscImages.TrackType.Audio:
xmlTrk.TrackType1 = TrackTypeTrackType.audio;
break;
- case ImagePlugins.TrackType.CDMode2Form2:
+ case DiscImages.TrackType.CdMode2Form2:
xmlTrk.TrackType1 = TrackTypeTrackType.m2f2;
break;
- case ImagePlugins.TrackType.CDMode2Formless:
+ case DiscImages.TrackType.CdMode2Formless:
xmlTrk.TrackType1 = TrackTypeTrackType.mode2;
break;
- case ImagePlugins.TrackType.CDMode2Form1:
+ case DiscImages.TrackType.CdMode2Form1:
xmlTrk.TrackType1 = TrackTypeTrackType.m2f1;
break;
- case ImagePlugins.TrackType.CDMode1:
+ case DiscImages.TrackType.CdMode1:
xmlTrk.TrackType1 = TrackTypeTrackType.mode1;
break;
- case ImagePlugins.TrackType.Data:
+ case DiscImages.TrackType.Data:
switch(sidecar.OpticalDisc[0].DiscType)
{
case "BD":
@@ -329,7 +329,7 @@ namespace DiscImageChef.Core
ulong doneSectors = 0;
// If there is only one track, and it's the same as the image file (e.g. ".iso" files), don't re-checksum.
- if(image.PluginUUID == new System.Guid("12345678-AAAA-BBBB-CCCC-123456789000") &&
+ if(image.PluginUuid == new System.Guid("12345678-AAAA-BBBB-CCCC-123456789000") &&
// Only if filter is none...
(filterId == new System.Guid("12345678-AAAA-BBBB-CCCC-123456789000") ||
// ...or AppleDouble
@@ -422,7 +422,7 @@ namespace DiscImageChef.Core
if((sectors - doneSectors) >= sectorsToRead)
{
sector = image.ReadSectorsTag(doneSectors, sectorsToRead, (uint)xmlTrk.Sequence.TrackNumber,
- SectorTagType.CDSectorSubchannel);
+ SectorTagType.CdSectorSubchannel);
UpdateProgress2("Hashings subchannel sector {0} of {1}", (long)doneSectors,
(long)(trk.TrackEndSector - trk.TrackStartSector + 1));
doneSectors += sectorsToRead;
@@ -431,7 +431,7 @@ namespace DiscImageChef.Core
{
sector = image.ReadSectorsTag(doneSectors, (uint)(sectors - doneSectors),
(uint)xmlTrk.Sequence.TrackNumber,
- SectorTagType.CDSectorSubchannel);
+ SectorTagType.CdSectorSubchannel);
UpdateProgress2("Hashings subchannel sector {0} of {1}", (long)doneSectors,
(long)(trk.TrackEndSector - trk.TrackStartSector + 1));
doneSectors += (sectors - doneSectors);
@@ -473,21 +473,21 @@ namespace DiscImageChef.Core
};
List lstFs = new List();
- foreach(Filesystem _plugin in plugins.PluginsList.Values)
+ foreach(Filesystem plugin in plugins.PluginsList.Values)
{
try
{
- if(_plugin.Identify(image, partitions[i]))
+ if(plugin.Identify(image, partitions[i]))
{
- _plugin.GetInformation(image, partitions[i], out string foo);
- lstFs.Add(_plugin.XmlFSType);
- Statistics.AddFilesystem(_plugin.XmlFSType.Type);
+ plugin.GetInformation(image, partitions[i], out string foo);
+ lstFs.Add(plugin.XmlFSType);
+ Statistics.AddFilesystem(plugin.XmlFSType.Type);
- if(_plugin.XmlFSType.Type == "Opera") dskType = MediaType.ThreeDO;
- if(_plugin.XmlFSType.Type == "PC Engine filesystem")
+ if(plugin.XmlFSType.Type == "Opera") dskType = MediaType.ThreeDO;
+ if(plugin.XmlFSType.Type == "PC Engine filesystem")
dskType = MediaType.SuperCDROM2;
- if(_plugin.XmlFSType.Type == "Nintendo Wii filesystem") dskType = MediaType.WOD;
- if(_plugin.XmlFSType.Type == "Nintendo Gamecube filesystem")
+ if(plugin.XmlFSType.Type == "Nintendo Wii filesystem") dskType = MediaType.WOD;
+ if(plugin.XmlFSType.Type == "Nintendo Gamecube filesystem")
dskType = MediaType.GOD;
}
}
@@ -519,20 +519,20 @@ namespace DiscImageChef.Core
Size = (ulong)xmlTrk.Size,
Sequence = (ulong)xmlTrk.Sequence.TrackNumber
};
- foreach(Filesystem _plugin in plugins.PluginsList.Values)
+ foreach(Filesystem plugin in plugins.PluginsList.Values)
{
try
{
- if(_plugin.Identify(image, xmlPart))
+ if(plugin.Identify(image, xmlPart))
{
- _plugin.GetInformation(image, xmlPart, out string foo);
- lstFs.Add(_plugin.XmlFSType);
- Statistics.AddFilesystem(_plugin.XmlFSType.Type);
+ plugin.GetInformation(image, xmlPart, out string foo);
+ lstFs.Add(plugin.XmlFSType);
+ Statistics.AddFilesystem(plugin.XmlFSType.Type);
- if(_plugin.XmlFSType.Type == "Opera") dskType = MediaType.ThreeDO;
- if(_plugin.XmlFSType.Type == "PC Engine filesystem") dskType = MediaType.SuperCDROM2;
- if(_plugin.XmlFSType.Type == "Nintendo Wii filesystem") dskType = MediaType.WOD;
- if(_plugin.XmlFSType.Type == "Nintendo Gamecube filesystem") dskType = MediaType.GOD;
+ if(plugin.XmlFSType.Type == "Opera") dskType = MediaType.ThreeDO;
+ if(plugin.XmlFSType.Type == "PC Engine filesystem") dskType = MediaType.SuperCDROM2;
+ if(plugin.XmlFSType.Type == "Nintendo Wii filesystem") dskType = MediaType.WOD;
+ if(plugin.XmlFSType.Type == "Nintendo Gamecube filesystem") dskType = MediaType.GOD;
}
}
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
@@ -569,20 +569,20 @@ namespace DiscImageChef.Core
sidecar.OpticalDisc[0].DiscSubType = dscSubType;
Statistics.AddMedia(dskType, false);
- if(!string.IsNullOrEmpty(image.ImageInfo.driveManufacturer) ||
- !string.IsNullOrEmpty(image.ImageInfo.driveModel) ||
- !string.IsNullOrEmpty(image.ImageInfo.driveFirmwareRevision) ||
- !string.IsNullOrEmpty(image.ImageInfo.driveSerialNumber))
+ if(!string.IsNullOrEmpty(image.ImageInfo.DriveManufacturer) ||
+ !string.IsNullOrEmpty(image.ImageInfo.DriveModel) ||
+ !string.IsNullOrEmpty(image.ImageInfo.DriveFirmwareRevision) ||
+ !string.IsNullOrEmpty(image.ImageInfo.DriveSerialNumber))
{
sidecar.OpticalDisc[0].DumpHardwareArray = new[]
{
new DumpHardwareType
{
- Extents = new[] {new ExtentType {Start = 0, End = image.ImageInfo.sectors}},
- Manufacturer = image.ImageInfo.driveManufacturer,
- Model = image.ImageInfo.driveModel,
- Firmware = image.ImageInfo.driveFirmwareRevision,
- Serial = image.ImageInfo.driveSerialNumber,
+ Extents = new[] {new ExtentType {Start = 0, End = image.ImageInfo.Sectors}},
+ Manufacturer = image.ImageInfo.DriveManufacturer,
+ Model = image.ImageInfo.DriveModel,
+ Firmware = image.ImageInfo.DriveFirmwareRevision,
+ Serial = image.ImageInfo.DriveSerialNumber,
Software = new SoftwareType
{
Name = image.GetImageApplication(),
diff --git a/DiscImageChef.Core/Sidecar/Sidecar.cs b/DiscImageChef.Core/Sidecar/Sidecar.cs
index 87f166b42..ac966e117 100644
--- a/DiscImageChef.Core/Sidecar/Sidecar.cs
+++ b/DiscImageChef.Core/Sidecar/Sidecar.cs
@@ -32,7 +32,7 @@
using System.Collections.Generic;
using System.IO;
-using DiscImageChef.ImagePlugins;
+using DiscImageChef.DiscImages;
using Schemas;
namespace DiscImageChef.Core
@@ -84,7 +84,7 @@ namespace DiscImageChef.Core
List imgChecksums = imgChkWorker.End();
- switch(image.ImageInfo.xmlMediaType)
+ switch(image.ImageInfo.XmlMediaType)
{
case XmlMediaType.OpticalDisc:
OpticalDisc(image, filterId, imagePath, fi, plugins, imgChecksums, ref sidecar);
diff --git a/DiscImageChef.Core/Statistics.cs b/DiscImageChef.Core/Statistics.cs
index 6fa52cb7f..fccdb7f9e 100644
--- a/DiscImageChef.Core/Statistics.cs
+++ b/DiscImageChef.Core/Statistics.cs
@@ -570,7 +570,7 @@ namespace DiscImageChef.Core
if(CurrentStats.Devices == null) CurrentStats.Devices = new List();
string deviceBus;
- if(dev.IsUSB) deviceBus = "USB";
+ if(dev.IsUsb) deviceBus = "USB";
else if(dev.IsFireWire) deviceBus = "FireWire";
else deviceBus = dev.Type.ToString();
diff --git a/DiscImageChef.Devices/Command.cs b/DiscImageChef.Devices/Command.cs
index d556326ad..5bb1940f9 100644
--- a/DiscImageChef.Devices/Command.cs
+++ b/DiscImageChef.Devices/Command.cs
@@ -54,9 +54,9 @@ namespace DiscImageChef.Devices
internal static int SendScsiCommand(object fd, byte[] cdb, ref byte[] buffer, out byte[] senseBuffer,
uint timeout, ScsiDirection direction, out double duration, out bool sense)
{
- Interop.PlatformID ptID = DetectOS.GetRealPlatformID();
+ Interop.PlatformID ptId = DetectOS.GetRealPlatformID();
- return SendScsiCommand(ptID, fd, cdb, ref buffer, out senseBuffer, timeout, direction, out duration,
+ return SendScsiCommand(ptId, fd, cdb, ref buffer, out senseBuffer, timeout, direction, out duration,
out sense);
}
@@ -64,7 +64,7 @@ namespace DiscImageChef.Devices
/// Sends a SCSI command
///
/// 0 if no error occurred, otherwise, errno
- /// Platform ID for executing the command
+ /// Platform ID for executing the command
/// File handle
/// SCSI CDB
/// Buffer for SCSI command response
@@ -73,11 +73,11 @@ namespace DiscImageChef.Devices
/// SCSI command transfer direction
/// Time it took to execute the command in milliseconds
/// True if SCSI error returned non-OK status and contains SCSI sense
- internal static int SendScsiCommand(Interop.PlatformID ptID, object fd, byte[] cdb, ref byte[] buffer,
+ internal 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:
{
@@ -127,21 +127,21 @@ namespace DiscImageChef.Devices
}
case Interop.PlatformID.FreeBSD:
{
- FreeBSD.ccb_flags flags = 0;
+ FreeBSD.CcbFlags flags = 0;
switch(direction)
{
case ScsiDirection.In:
- flags = FreeBSD.ccb_flags.CAM_DIR_IN;
+ flags = FreeBSD.CcbFlags.CamDirIn;
break;
case ScsiDirection.Out:
- flags = FreeBSD.ccb_flags.CAM_DIR_OUT;
+ flags = FreeBSD.CcbFlags.CamDirOut;
break;
case ScsiDirection.Bidirectional:
- flags = FreeBSD.ccb_flags.CAM_DIR_BOTH;
+ flags = FreeBSD.CcbFlags.CamDirBoth;
break;
case ScsiDirection.None:
- flags = FreeBSD.ccb_flags.CAM_DIR_NONE;
+ flags = FreeBSD.CcbFlags.CamDirNone;
break;
}
@@ -151,7 +151,7 @@ namespace DiscImageChef.Devices
: FreeBSD.Command.SendScsiCommand((IntPtr)fd, cdb, ref buffer, out senseBuffer, timeout,
flags, out duration, out sense);
}
- default: throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", ptID));
+ default: throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", ptId));
}
}
@@ -159,18 +159,18 @@ namespace DiscImageChef.Devices
AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer,
uint timeout, bool transferBlocks, out double duration, out bool sense)
{
- Interop.PlatformID ptID = DetectOS.GetRealPlatformID();
+ Interop.PlatformID ptId = DetectOS.GetRealPlatformID();
- return SendAtaCommand(ptID, fd, registers, out errorRegisters, protocol, transferRegister, ref buffer,
+ return SendAtaCommand(ptId, fd, registers, out errorRegisters, protocol, transferRegister, ref buffer,
timeout, transferBlocks, out duration, out sense);
}
- internal static int SendAtaCommand(Interop.PlatformID ptID, object fd, AtaRegistersCHS registers,
+ internal static int SendAtaCommand(Interop.PlatformID ptId, object fd, AtaRegistersCHS registers,
out AtaErrorRegistersCHS errorRegisters, AtaProtocol protocol,
AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout,
bool transferBlocks, out double duration, out bool sense)
{
- switch(ptID)
+ switch(ptId)
{
case Interop.PlatformID.Win32NT:
{
@@ -200,7 +200,7 @@ namespace DiscImageChef.Devices
return FreeBSD.Command.SendAtaCommand((IntPtr)fd, registers, out errorRegisters, protocol,
ref buffer, timeout, out duration, out sense);
}
- default: throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", ptID));
+ default: throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", ptId));
}
}
@@ -209,18 +209,18 @@ namespace DiscImageChef.Devices
AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout,
bool transferBlocks, out double duration, out bool sense)
{
- Interop.PlatformID ptID = DetectOS.GetRealPlatformID();
+ Interop.PlatformID ptId = DetectOS.GetRealPlatformID();
- return SendAtaCommand(ptID, fd, registers, out errorRegisters, protocol, transferRegister, ref buffer,
+ return SendAtaCommand(ptId, fd, registers, out errorRegisters, protocol, transferRegister, ref buffer,
timeout, transferBlocks, out duration, out sense);
}
- internal static int SendAtaCommand(Interop.PlatformID ptID, object fd, AtaRegistersLBA28 registers,
+ internal static int SendAtaCommand(Interop.PlatformID ptId, object fd, AtaRegistersLBA28 registers,
out AtaErrorRegistersLBA28 errorRegisters, AtaProtocol protocol,
AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout,
bool transferBlocks, out double duration, out bool sense)
{
- switch(ptID)
+ switch(ptId)
{
case Interop.PlatformID.Win32NT:
{
@@ -250,7 +250,7 @@ namespace DiscImageChef.Devices
return FreeBSD.Command.SendAtaCommand((IntPtr)fd, registers, out errorRegisters, protocol,
ref buffer, timeout, out duration, out sense);
}
- default: throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", ptID));
+ default: throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", ptId));
}
}
@@ -259,18 +259,18 @@ namespace DiscImageChef.Devices
AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout,
bool transferBlocks, out double duration, out bool sense)
{
- Interop.PlatformID ptID = DetectOS.GetRealPlatformID();
+ Interop.PlatformID ptId = DetectOS.GetRealPlatformID();
- return SendAtaCommand(ptID, fd, registers, out errorRegisters, protocol, transferRegister, ref buffer,
+ return SendAtaCommand(ptId, fd, registers, out errorRegisters, protocol, transferRegister, ref buffer,
timeout, transferBlocks, out duration, out sense);
}
- internal static int SendAtaCommand(Interop.PlatformID ptID, object fd, AtaRegistersLBA48 registers,
+ internal static int SendAtaCommand(Interop.PlatformID ptId, object fd, AtaRegistersLBA48 registers,
out AtaErrorRegistersLBA48 errorRegisters, AtaProtocol protocol,
AtaTransferRegister transferRegister, ref byte[] buffer, uint timeout,
bool transferBlocks, out double duration, out bool sense)
{
- switch(ptID)
+ switch(ptId)
{
case Interop.PlatformID.Win32NT:
{
@@ -289,7 +289,7 @@ namespace DiscImageChef.Devices
return FreeBSD.Command.SendAtaCommand((IntPtr)fd, registers, out errorRegisters, protocol,
ref buffer, timeout, out duration, out sense);
}
- default: throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", ptID));
+ default: throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", ptId));
}
}
@@ -297,18 +297,18 @@ namespace DiscImageChef.Devices
uint argument, uint blockSize, uint blocks, ref byte[] buffer,
out uint[] response, out double duration, out bool sense, uint timeout = 0)
{
- Interop.PlatformID ptID = DetectOS.GetRealPlatformID();
+ Interop.PlatformID ptId = DetectOS.GetRealPlatformID();
- return SendMmcCommand(ptID, (int)fd, command, write, isApplication, flags, argument, blockSize, blocks,
+ return SendMmcCommand(ptId, (int)fd, command, write, isApplication, flags, argument, blockSize, blocks,
ref buffer, out response, out duration, out sense, timeout);
}
- internal static int SendMmcCommand(Interop.PlatformID ptID, object fd, MmcCommands command, bool write,
+ internal static int SendMmcCommand(Interop.PlatformID ptId, object fd, MmcCommands command, bool write,
bool isApplication, MmcFlags flags, uint argument, uint blockSize, uint blocks,
ref byte[] buffer, out uint[] response, out double duration, out bool sense,
uint timeout = 0)
{
- switch(ptID)
+ switch(ptId)
{
case Interop.PlatformID.Win32NT:
{
@@ -322,7 +322,7 @@ namespace DiscImageChef.Devices
blockSize, blocks, ref buffer, out response, out duration,
out sense, timeout);
}
- default: throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", ptID));
+ default: throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", ptId));
}
}
}
diff --git a/DiscImageChef.Devices/Device/Commands.cs b/DiscImageChef.Devices/Device/Commands.cs
index b89c747cd..ba681a3d3 100644
--- a/DiscImageChef.Devices/Device/Commands.cs
+++ b/DiscImageChef.Devices/Device/Commands.cs
@@ -50,7 +50,7 @@ namespace DiscImageChef.Devices
public int SendScsiCommand(byte[] cdb, ref byte[] buffer, out byte[] senseBuffer, uint timeout,
ScsiDirection direction, out double duration, out bool sense)
{
- return Command.SendScsiCommand(platformID, fd, cdb, ref buffer, out senseBuffer, timeout, direction,
+ return Command.SendScsiCommand(platformId, fd, cdb, ref buffer, out senseBuffer, timeout, direction,
out duration, out sense);
}
@@ -71,7 +71,7 @@ namespace DiscImageChef.Devices
AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer,
uint timeout, bool transferBlocks, out double duration, out bool sense)
{
- return Command.SendAtaCommand(platformID, fd, registers, out errorRegisters, protocol, transferRegister,
+ return Command.SendAtaCommand(platformId, fd, registers, out errorRegisters, protocol, transferRegister,
ref buffer, timeout, transferBlocks, out duration, out sense);
}
@@ -92,7 +92,7 @@ namespace DiscImageChef.Devices
AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer,
uint timeout, bool transferBlocks, out double duration, out bool sense)
{
- return Command.SendAtaCommand(platformID, fd, registers, out errorRegisters, protocol, transferRegister,
+ return Command.SendAtaCommand(platformId, fd, registers, out errorRegisters, protocol, transferRegister,
ref buffer, timeout, transferBlocks, out duration, out sense);
}
@@ -113,7 +113,7 @@ namespace DiscImageChef.Devices
AtaProtocol protocol, AtaTransferRegister transferRegister, ref byte[] buffer,
uint timeout, bool transferBlocks, out double duration, out bool sense)
{
- return Command.SendAtaCommand(platformID, fd, registers, out errorRegisters, protocol, transferRegister,
+ return Command.SendAtaCommand(platformId, fd, registers, out errorRegisters, protocol, transferRegister,
ref buffer, timeout, transferBlocks, out duration, out sense);
}
@@ -137,7 +137,7 @@ namespace DiscImageChef.Devices
uint blockSize, uint blocks, ref byte[] buffer, out uint[] response,
out double duration, out bool sense, uint timeout = 0)
{
- if(command == MmcCommands.SendCID && cachedCid != null)
+ if(command == MmcCommands.SendCid && cachedCid != null)
{
System.DateTime start = System.DateTime.Now;
buffer = new byte[cachedCid.Length];
@@ -149,7 +149,7 @@ namespace DiscImageChef.Devices
return 0;
}
- if(command == MmcCommands.SendCSD && cachedCid != null)
+ if(command == MmcCommands.SendCsd && cachedCid != null)
{
System.DateTime start = System.DateTime.Now;
buffer = new byte[cachedCsd.Length];
@@ -161,7 +161,7 @@ namespace DiscImageChef.Devices
return 0;
}
- if(command == (MmcCommands)SecureDigitalCommands.SendSCR && cachedScr != null)
+ if(command == (MmcCommands)SecureDigitalCommands.SendScr && cachedScr != null)
{
System.DateTime start = System.DateTime.Now;
buffer = new byte[cachedScr.Length];
@@ -186,7 +186,7 @@ namespace DiscImageChef.Devices
return 0;
}
- return Command.SendMmcCommand(platformID, fd, command, write, isApplication, flags, argument, blockSize,
+ return Command.SendMmcCommand(platformId, fd, command, write, isApplication, flags, argument, blockSize,
blocks, ref buffer, out response, out duration, out sense, timeout);
}
}
diff --git a/DiscImageChef.Devices/Device/Constructor.cs b/DiscImageChef.Devices/Device/Constructor.cs
index 0e70027da..61e4b1b22 100644
--- a/DiscImageChef.Devices/Device/Constructor.cs
+++ b/DiscImageChef.Devices/Device/Constructor.cs
@@ -46,12 +46,12 @@ namespace DiscImageChef.Devices
/// Device path
public Device(string devicePath)
{
- platformID = Interop.DetectOS.GetRealPlatformID();
+ platformId = Interop.DetectOS.GetRealPlatformID();
Timeout = 15;
error = false;
removable = false;
- switch(platformID)
+ switch(platformId)
{
case Interop.PlatformID.Win32NT:
{
@@ -91,17 +91,17 @@ namespace DiscImageChef.Devices
lastError = Marshal.GetLastWin32Error();
}
- FreeBSD.cam_device camDevice =
- (FreeBSD.cam_device)Marshal.PtrToStructure((IntPtr)fd, typeof(FreeBSD.cam_device));
+ FreeBSD.CamDevice camDevice =
+ (FreeBSD.CamDevice)Marshal.PtrToStructure((IntPtr)fd, typeof(FreeBSD.CamDevice));
- if(StringHandlers.CToString(camDevice.sim_name) == "ata")
+ if(StringHandlers.CToString(camDevice.SimName) == "ata")
throw new
InvalidOperationException("Parallel ATA devices are not supported on FreeBSD due to upstream bug #224250.");
break;
}
default:
- throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", platformID));
+ throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", platformId));
}
if(error) throw new SystemException(string.Format("Error {0} opening device.", lastError));
@@ -121,7 +121,7 @@ namespace DiscImageChef.Devices
string ntDevicePath = null;
// Windows is answering SCSI INQUIRY for all device types so it needs to be detected first
- if(platformID == Interop.PlatformID.Win32NT)
+ if(platformId == Interop.PlatformID.Win32NT)
{
Windows.StoragePropertyQuery query = new Windows.StoragePropertyQuery();
query.PropertyId = Windows.StoragePropertyId.Device;
@@ -129,39 +129,39 @@ namespace DiscImageChef.Devices
query.AdditionalParameters = new byte[1];
IntPtr descriptorPtr = Marshal.AllocHGlobal(1000);
- byte[] descriptor_b = new byte[1000];
+ byte[] descriptorB = new byte[1000];
uint returned = 0;
int error = 0;
bool hasError = !Windows.Extern.DeviceIoControlStorageQuery((SafeFileHandle)fd,
Windows.WindowsIoctl
- .IOCTL_STORAGE_QUERY_PROPERTY,
+ .IoctlStorageQueryProperty,
ref query, (uint)Marshal.SizeOf(query),
descriptorPtr, 1000, ref returned,
IntPtr.Zero);
if(hasError) error = Marshal.GetLastWin32Error();
- Marshal.Copy(descriptorPtr, descriptor_b, 0, 1000);
+ Marshal.Copy(descriptorPtr, descriptorB, 0, 1000);
if(!hasError && error == 0)
{
Windows.StorageDeviceDescriptor descriptor = new Windows.StorageDeviceDescriptor();
- descriptor.Version = BitConverter.ToUInt32(descriptor_b, 0);
- descriptor.Size = BitConverter.ToUInt32(descriptor_b, 4);
- descriptor.DeviceType = descriptor_b[8];
- descriptor.DeviceTypeModifier = descriptor_b[9];
- descriptor.RemovableMedia = descriptor_b[10] > 0;
- descriptor.CommandQueueing = descriptor_b[11] > 0;
- descriptor.VendorIdOffset = BitConverter.ToUInt32(descriptor_b, 12);
- descriptor.ProductIdOffset = BitConverter.ToUInt32(descriptor_b, 16);
- descriptor.ProductRevisionOffset = BitConverter.ToUInt32(descriptor_b, 20);
- descriptor.SerialNumberOffset = BitConverter.ToUInt32(descriptor_b, 24);
- descriptor.BusType = (Windows.StorageBusType)BitConverter.ToUInt32(descriptor_b, 28);
- descriptor.RawPropertiesLength = BitConverter.ToUInt32(descriptor_b, 32);
+ descriptor.Version = BitConverter.ToUInt32(descriptorB, 0);
+ descriptor.Size = BitConverter.ToUInt32(descriptorB, 4);
+ descriptor.DeviceType = descriptorB[8];
+ descriptor.DeviceTypeModifier = descriptorB[9];
+ descriptor.RemovableMedia = descriptorB[10] > 0;
+ descriptor.CommandQueueing = descriptorB[11] > 0;
+ descriptor.VendorIdOffset = BitConverter.ToUInt32(descriptorB, 12);
+ descriptor.ProductIdOffset = BitConverter.ToUInt32(descriptorB, 16);
+ descriptor.ProductRevisionOffset = BitConverter.ToUInt32(descriptorB, 20);
+ descriptor.SerialNumberOffset = BitConverter.ToUInt32(descriptorB, 24);
+ descriptor.BusType = (Windows.StorageBusType)BitConverter.ToUInt32(descriptorB, 28);
+ descriptor.RawPropertiesLength = BitConverter.ToUInt32(descriptorB, 32);
descriptor.RawDeviceProperties = new byte[descriptor.RawPropertiesLength];
- Array.Copy(descriptor_b, 36, descriptor.RawDeviceProperties, 0, descriptor.RawPropertiesLength);
+ Array.Copy(descriptorB, 36, descriptor.RawDeviceProperties, 0, descriptor.RawPropertiesLength);
switch(descriptor.BusType)
{
@@ -207,9 +207,9 @@ namespace DiscImageChef.Devices
if(!atapiSense)
{
type = DeviceType.ATAPI;
- Identify.IdentifyDevice? ATAID = Identify.Decode(ataBuf);
+ Identify.IdentifyDevice? ataid = Identify.Decode(ataBuf);
- if(ATAID.HasValue) scsiSense = ScsiInquiry(out inqBuf, out senseBuf);
+ if(ataid.HasValue) scsiSense = ScsiInquiry(out inqBuf, out senseBuf);
}
else manufacturer = "ATA";
}
@@ -224,9 +224,9 @@ namespace DiscImageChef.Devices
byte[] sdBuffer = new byte[16];
bool sense = false;
- lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd, MmcCommands.SendCSD, false, false,
- MmcFlags.ResponseSPI_R2 | MmcFlags.Response_R2 |
- MmcFlags.CommandAC, 0, 16, 1, ref sdBuffer,
+ lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd, MmcCommands.SendCsd, false, false,
+ MmcFlags.ResponseSpiR2 | MmcFlags.ResponseR2 |
+ MmcFlags.CommandAc, 0, 16, 1, ref sdBuffer,
out uint[] response, out double duration, out sense, 0);
if(!sense)
@@ -238,9 +238,9 @@ namespace DiscImageChef.Devices
sdBuffer = new byte[16];
sense = false;
- lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd, MmcCommands.SendCID, false, false,
- MmcFlags.ResponseSPI_R2 | MmcFlags.Response_R2 |
- MmcFlags.CommandAC, 0, 16, 1, ref sdBuffer, out response,
+ lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd, MmcCommands.SendCid, false, false,
+ MmcFlags.ResponseSpiR2 | MmcFlags.ResponseR2 |
+ MmcFlags.CommandAc, 0, 16, 1, ref sdBuffer, out response,
out duration, out sense, 0);
if(!sense)
@@ -253,9 +253,9 @@ namespace DiscImageChef.Devices
sense = false;
lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd,
- (MmcCommands)SecureDigitalCommands.SendSCR, false, true,
- MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 |
- MmcFlags.CommandADTC, 0, 8, 1, ref sdBuffer,
+ (MmcCommands)SecureDigitalCommands.SendScr, false, true,
+ MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 |
+ MmcFlags.CommandAdtc, 0, 8, 1, ref sdBuffer,
out response, out duration, out sense, 0);
if(!sense)
@@ -272,8 +272,8 @@ namespace DiscImageChef.Devices
lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd,
(MmcCommands)SecureDigitalCommands
.SendOperatingCondition, false, true,
- MmcFlags.ResponseSPI_R3 | MmcFlags.Response_R3 |
- MmcFlags.CommandBCR, 0, 4, 1, ref sdBuffer,
+ MmcFlags.ResponseSpiR3 | MmcFlags.ResponseR3 |
+ MmcFlags.CommandBcr, 0, 4, 1, ref sdBuffer,
out response, out duration, out sense, 0);
if(!sense)
@@ -289,8 +289,8 @@ namespace DiscImageChef.Devices
lastError = Windows.Command.SendMmcCommand((SafeFileHandle)fd, MmcCommands.SendOpCond, false,
true,
- MmcFlags.ResponseSPI_R3 | MmcFlags.Response_R3 |
- MmcFlags.CommandBCR, 0, 4, 1, ref sdBuffer,
+ MmcFlags.ResponseSpiR3 | MmcFlags.ResponseR3 |
+ MmcFlags.CommandBcr, 0, 4, 1, ref sdBuffer,
out response, out duration, out sense, 0);
if(!sense)
@@ -301,7 +301,7 @@ namespace DiscImageChef.Devices
}
}
}
- else if(platformID == Interop.PlatformID.Linux)
+ else if(platformId == Interop.PlatformID.Linux)
{
if(devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) ||
devicePath.StartsWith("/dev/sr", StringComparison.Ordinal) ||
@@ -313,22 +313,22 @@ namespace DiscImageChef.Devices
string devPath = devicePath.Substring(5);
if(System.IO.File.Exists("/sys/block/" + devPath + "/device/csd"))
{
- int len = ConvertFromHexASCII("/sys/block/" + devPath + "/device/csd", out cachedCsd);
+ int len = ConvertFromHexAscii("/sys/block/" + devPath + "/device/csd", out cachedCsd);
if(len == 0) cachedCsd = null;
}
if(System.IO.File.Exists("/sys/block/" + devPath + "/device/cid"))
{
- int len = ConvertFromHexASCII("/sys/block/" + devPath + "/device/cid", out cachedCid);
+ int len = ConvertFromHexAscii("/sys/block/" + devPath + "/device/cid", out cachedCid);
if(len == 0) cachedCid = null;
}
if(System.IO.File.Exists("/sys/block/" + devPath + "/device/scr"))
{
- int len = ConvertFromHexASCII("/sys/block/" + devPath + "/device/scr", out cachedScr);
+ int len = ConvertFromHexAscii("/sys/block/" + devPath + "/device/scr", out cachedScr);
if(len == 0) cachedScr = null;
}
if(System.IO.File.Exists("/sys/block/" + devPath + "/device/ocr"))
{
- int len = ConvertFromHexASCII("/sys/block/" + devPath + "/device/ocr", out cachedOcr);
+ int len = ConvertFromHexAscii("/sys/block/" + devPath + "/device/ocr", out cachedOcr);
if(len == 0) cachedOcr = null;
}
}
@@ -365,7 +365,7 @@ namespace DiscImageChef.Devices
#endregion SecureDigital / MultiMediaCard
#region USB
- if(platformID == Interop.PlatformID.Linux)
+ if(platformId == Interop.PlatformID.Linux)
{
if(devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) ||
devicePath.StartsWith("/dev/sr", StringComparison.Ordinal) ||
@@ -439,15 +439,15 @@ namespace DiscImageChef.Devices
}
}
}
- else if(platformID == Interop.PlatformID.Win32NT)
+ else if(platformId == Interop.PlatformID.Win32NT)
{
- Windows.Usb.USBDevice usbDevice = null;
+ Windows.Usb.UsbDevice usbDevice = null;
// I have to search for USB disks, floppies and CD-ROMs as separate device types
foreach(string devGuid in new[]
{
- Windows.Usb.GUID_DEVINTERFACE_FLOPPY, Windows.Usb.GUID_DEVINTERFACE_CDROM,
- Windows.Usb.GUID_DEVINTERFACE_DISK
+ Windows.Usb.GuidDevinterfaceFloppy, Windows.Usb.GuidDevinterfaceCdrom,
+ Windows.Usb.GuidDevinterfaceDisk
})
{
usbDevice = Windows.Usb.FindDrivePath(devicePath, devGuid);
@@ -470,7 +470,7 @@ namespace DiscImageChef.Devices
#endregion USB
#region FireWire
- if(platformID == Interop.PlatformID.Linux)
+ if(platformId == Interop.PlatformID.Linux)
{
if(devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) ||
devicePath.StartsWith("/dev/sr", StringComparison.Ordinal) ||
@@ -539,7 +539,7 @@ namespace DiscImageChef.Devices
#endregion FireWire
#region PCMCIA
- if(platformID == Interop.PlatformID.Linux)
+ if(platformId == Interop.PlatformID.Linux)
{
if(devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) ||
devicePath.StartsWith("/dev/sr", StringComparison.Ordinal) ||
@@ -596,23 +596,23 @@ namespace DiscImageChef.Devices
if(!scsiSense)
{
- Decoders.SCSI.Inquiry.SCSIInquiry? Inquiry = Decoders.SCSI.Inquiry.Decode(inqBuf);
+ Decoders.SCSI.Inquiry.SCSIInquiry? inquiry = Decoders.SCSI.Inquiry.Decode(inqBuf);
type = DeviceType.SCSI;
bool serialSense = ScsiInquiry(out inqBuf, out senseBuf, 0x80);
if(!serialSense) serial = Decoders.SCSI.EVPD.DecodePage80(inqBuf);
- if(Inquiry.HasValue)
+ if(inquiry.HasValue)
{
- string tmp = StringHandlers.CToString(Inquiry.Value.ProductRevisionLevel);
+ string tmp = StringHandlers.CToString(inquiry.Value.ProductRevisionLevel);
if(tmp != null) revision = tmp.Trim();
- tmp = StringHandlers.CToString(Inquiry.Value.ProductIdentification);
+ tmp = StringHandlers.CToString(inquiry.Value.ProductIdentification);
if(tmp != null) model = tmp.Trim();
- tmp = StringHandlers.CToString(Inquiry.Value.VendorIdentification);
+ tmp = StringHandlers.CToString(inquiry.Value.VendorIdentification);
if(tmp != null) manufacturer = tmp.Trim();
- removable = Inquiry.Value.RMB;
+ removable = inquiry.Value.RMB;
- scsiType = (Decoders.SCSI.PeripheralDeviceTypes)Inquiry.Value.PeripheralDeviceType;
+ scsiType = (Decoders.SCSI.PeripheralDeviceTypes)inquiry.Value.PeripheralDeviceType;
}
bool atapiSense = AtapiIdentify(out ataBuf, out errorRegisters);
@@ -620,9 +620,9 @@ namespace DiscImageChef.Devices
if(!atapiSense)
{
type = DeviceType.ATAPI;
- Identify.IdentifyDevice? ATAID = Identify.Decode(ataBuf);
+ Identify.IdentifyDevice? ataId = Identify.Decode(ataBuf);
- if(ATAID.HasValue) serial = ATAID.Value.SerialNumber;
+ if(ataId.HasValue) serial = ataId.Value.SerialNumber;
}
else
{
@@ -637,11 +637,11 @@ namespace DiscImageChef.Devices
if(!ataSense)
{
type = DeviceType.ATA;
- Identify.IdentifyDevice? ATAID = Identify.Decode(ataBuf);
+ Identify.IdentifyDevice? ataid = Identify.Decode(ataBuf);
- if(ATAID.HasValue)
+ if(ataid.HasValue)
{
- string[] separated = ATAID.Value.Model.Split(' ');
+ string[] separated = ataid.Value.Model.Split(' ');
if(separated.Length == 1) model = separated[0];
else
@@ -650,15 +650,15 @@ namespace DiscImageChef.Devices
model = separated[separated.Length - 1];
}
- revision = ATAID.Value.FirmwareRevision;
- serial = ATAID.Value.SerialNumber;
+ revision = ataid.Value.FirmwareRevision;
+ serial = ataid.Value.SerialNumber;
scsiType = Decoders.SCSI.PeripheralDeviceTypes.DirectAccess;
- if((ushort)ATAID.Value.GeneralConfiguration != 0x848A)
+ if((ushort)ataid.Value.GeneralConfiguration != 0x848A)
{
removable |=
- (ATAID.Value.GeneralConfiguration & Identify.GeneralConfigurationBit.Removable) ==
+ (ataid.Value.GeneralConfiguration & Identify.GeneralConfigurationBit.Removable) ==
Identify.GeneralConfigurationBit.Removable;
}
else compactFlash = true;
@@ -694,7 +694,7 @@ namespace DiscImageChef.Devices
}
}
- static int ConvertFromHexASCII(string file, out byte[] outBuf)
+ static int ConvertFromHexAscii(string file, out byte[] outBuf)
{
System.IO.StreamReader sr = new System.IO.StreamReader(file);
string ins = sr.ReadToEnd().Trim();
diff --git a/DiscImageChef.Devices/Device/Destructor.cs b/DiscImageChef.Devices/Device/Destructor.cs
index 6f0224f53..0eafd1477 100644
--- a/DiscImageChef.Devices/Device/Destructor.cs
+++ b/DiscImageChef.Devices/Device/Destructor.cs
@@ -45,7 +45,7 @@ namespace DiscImageChef.Devices
{
if(fd != null)
{
- switch(platformID)
+ switch(platformId)
{
case Interop.PlatformID.Win32NT:
Windows.Extern.CloseHandle((SafeFileHandle)fd);
diff --git a/DiscImageChef.Devices/Device/List.cs b/DiscImageChef.Devices/Device/List.cs
index 9f381c608..6c093bd1b 100644
--- a/DiscImageChef.Devices/Device/List.cs
+++ b/DiscImageChef.Devices/Device/List.cs
@@ -36,12 +36,12 @@ namespace DiscImageChef.Devices
{
public struct DeviceInfo
{
- public string path;
- public string vendor;
- public string model;
- public string serial;
- public string bus;
- public bool supported;
+ public string Path;
+ public string Vendor;
+ public string Model;
+ public string Serial;
+ public string Bus;
+ public bool Supported;
}
public partial class Device
diff --git a/DiscImageChef.Devices/Device/MmcCommands/MMC.cs b/DiscImageChef.Devices/Device/MmcCommands/MMC.cs
index a7b8b955f..f73ef6e9e 100644
--- a/DiscImageChef.Devices/Device/MmcCommands/MMC.cs
+++ b/DiscImageChef.Devices/Device/MmcCommands/MMC.cs
@@ -36,13 +36,13 @@ namespace DiscImageChef.Devices
{
public partial class Device
{
- public bool ReadCSD(out byte[] buffer, out uint[] response, uint timeout, out double duration)
+ public bool ReadCsd(out byte[] buffer, out uint[] response, uint timeout, out double duration)
{
buffer = new byte[16];
bool sense = false;
- lastError = SendMmcCommand(MmcCommands.SendCSD, false, false,
- MmcFlags.ResponseSPI_R2 | MmcFlags.Response_R2 | MmcFlags.CommandAC, 0, 16, 1,
+ lastError = SendMmcCommand(MmcCommands.SendCsd, false, false,
+ MmcFlags.ResponseSpiR2 | MmcFlags.ResponseR2 | MmcFlags.CommandAc, 0, 16, 1,
ref buffer, out response, out duration, out sense, timeout);
error = lastError != 0;
@@ -51,13 +51,13 @@ namespace DiscImageChef.Devices
return sense;
}
- public bool ReadCID(out byte[] buffer, out uint[] response, uint timeout, out double duration)
+ public bool ReadCid(out byte[] buffer, out uint[] response, uint timeout, out double duration)
{
buffer = new byte[16];
bool sense = false;
- lastError = SendMmcCommand(MmcCommands.SendCID, false, false,
- MmcFlags.ResponseSPI_R2 | MmcFlags.Response_R2 | MmcFlags.CommandAC, 0, 16, 1,
+ lastError = SendMmcCommand(MmcCommands.SendCid, false, false,
+ MmcFlags.ResponseSpiR2 | MmcFlags.ResponseR2 | MmcFlags.CommandAc, 0, 16, 1,
ref buffer, out response, out duration, out sense, timeout);
error = lastError != 0;
@@ -66,13 +66,13 @@ namespace DiscImageChef.Devices
return sense;
}
- public bool ReadOCR(out byte[] buffer, out uint[] response, uint timeout, out double duration)
+ public bool ReadOcr(out byte[] buffer, out uint[] response, uint timeout, out double duration)
{
buffer = new byte[4];
bool sense = false;
lastError = SendMmcCommand(MmcCommands.SendOpCond, false, true,
- MmcFlags.ResponseSPI_R3 | MmcFlags.Response_R3 | MmcFlags.CommandBCR, 0, 4, 1,
+ MmcFlags.ResponseSpiR3 | MmcFlags.ResponseR3 | MmcFlags.CommandBcr, 0, 4, 1,
ref buffer, out response, out duration, out sense, timeout);
error = lastError != 0;
@@ -81,13 +81,13 @@ namespace DiscImageChef.Devices
return sense;
}
- public bool ReadExtendedCSD(out byte[] buffer, out uint[] response, uint timeout, out double duration)
+ public bool ReadExtendedCsd(out byte[] buffer, out uint[] response, uint timeout, out double duration)
{
buffer = new byte[512];
bool sense = false;
- lastError = SendMmcCommand(MmcCommands.SendExtCSD, false, false,
- MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandADTC, 0, 512, 1,
+ lastError = SendMmcCommand(MmcCommands.SendExtCsd, false, false,
+ MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAdtc, 0, 512, 1,
ref buffer, out response, out duration, out sense, timeout);
error = lastError != 0;
@@ -102,7 +102,7 @@ namespace DiscImageChef.Devices
bool sense = false;
lastError = SendMmcCommand(MmcCommands.SetBlocklen, false, false,
- MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandAC, length, 0,
+ MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAc, length, 0,
0, ref buffer, out response, out duration, out sense, timeout);
error = lastError != 0;
@@ -125,7 +125,7 @@ namespace DiscImageChef.Devices
else command = MmcCommands.ReadSingleBlock;
lastError = SendMmcCommand(command, false, false,
- MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandADTC, address,
+ MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAdtc, address,
blockSize, transferLength, ref buffer, out response, out duration, out sense,
timeout);
error = lastError != 0;
@@ -134,7 +134,7 @@ namespace DiscImageChef.Devices
{
byte[] foo = new byte[0];
SendMmcCommand(MmcCommands.StopTransmission, false, false,
- MmcFlags.Response_R1b | MmcFlags.ResponseSPI_R1b | MmcFlags.CommandAC, 0, 0, 0, ref foo,
+ MmcFlags.ResponseR1B | MmcFlags.ResponseSpiR1B | MmcFlags.CommandAc, 0, 0, 0, ref foo,
out uint[] responseStop, out double stopDuration, out bool stopSense, timeout);
duration += stopDuration;
DicConsole.DebugWriteLine("MMC Device", "READ_MULTIPLE_BLOCK took {0} ms.", duration);
@@ -150,7 +150,7 @@ namespace DiscImageChef.Devices
bool sense = false;
lastError = SendMmcCommand(MmcCommands.SendStatus, false, true,
- MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandAC, 0, 4, 1,
+ MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAc, 0, 4, 1,
ref buffer, out response, out duration, out sense, timeout);
error = lastError != 0;
diff --git a/DiscImageChef.Devices/Device/MmcCommands/SecureDigital.cs b/DiscImageChef.Devices/Device/MmcCommands/SecureDigital.cs
index 11b396dbd..37752212f 100644
--- a/DiscImageChef.Devices/Device/MmcCommands/SecureDigital.cs
+++ b/DiscImageChef.Devices/Device/MmcCommands/SecureDigital.cs
@@ -36,13 +36,13 @@ namespace DiscImageChef.Devices
{
public partial class Device
{
- public bool ReadSDStatus(out byte[] buffer, out uint[] response, uint timeout, out double duration)
+ public bool ReadSdStatus(out byte[] buffer, out uint[] response, uint timeout, out double duration)
{
buffer = new byte[64];
bool sense = false;
lastError = SendMmcCommand((MmcCommands)SecureDigitalCommands.SendStatus, false, true,
- MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandADTC, 0, 64, 1,
+ MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAdtc, 0, 64, 1,
ref buffer, out response, out duration, out sense, timeout);
error = lastError != 0;
@@ -51,13 +51,13 @@ namespace DiscImageChef.Devices
return sense;
}
- public bool ReadSDOCR(out byte[] buffer, out uint[] response, uint timeout, out double duration)
+ public bool ReadSdocr(out byte[] buffer, out uint[] response, uint timeout, out double duration)
{
buffer = new byte[4];
bool sense = false;
lastError = SendMmcCommand((MmcCommands)SecureDigitalCommands.SendOperatingCondition, false, true,
- MmcFlags.ResponseSPI_R3 | MmcFlags.Response_R3 | MmcFlags.CommandBCR, 0, 4, 1,
+ MmcFlags.ResponseSpiR3 | MmcFlags.ResponseR3 | MmcFlags.CommandBcr, 0, 4, 1,
ref buffer, out response, out duration, out sense, timeout);
error = lastError != 0;
@@ -66,13 +66,13 @@ namespace DiscImageChef.Devices
return sense;
}
- public bool ReadSCR(out byte[] buffer, out uint[] response, uint timeout, out double duration)
+ public bool ReadScr(out byte[] buffer, out uint[] response, uint timeout, out double duration)
{
buffer = new byte[8];
bool sense = false;
- lastError = SendMmcCommand((MmcCommands)SecureDigitalCommands.SendSCR, false, true,
- MmcFlags.ResponseSPI_R1 | MmcFlags.Response_R1 | MmcFlags.CommandADTC, 0, 8, 1,
+ lastError = SendMmcCommand((MmcCommands)SecureDigitalCommands.SendScr, false, true,
+ MmcFlags.ResponseSpiR1 | MmcFlags.ResponseR1 | MmcFlags.CommandAdtc, 0, 8, 1,
ref buffer, out response, out duration, out sense, timeout);
error = lastError != 0;
diff --git a/DiscImageChef.Devices/Device/ScsiCommands/Adaptec.cs b/DiscImageChef.Devices/Device/ScsiCommands/Adaptec.cs
index 360e84de5..10278f881 100644
--- a/DiscImageChef.Devices/Device/ScsiCommands/Adaptec.cs
+++ b/DiscImageChef.Devices/Device/ScsiCommands/Adaptec.cs
@@ -69,7 +69,7 @@ namespace DiscImageChef.Devices
senseBuffer = new byte[32];
bool sense;
- cdb[0] = (byte)ScsiCommands.Adaptec_Translate;
+ cdb[0] = (byte)ScsiCommands.AdaptecTranslate;
cdb[1] = (byte)((lba & 0x1F0000) >> 16);
cdb[2] = (byte)((lba & 0xFF00) >> 8);
cdb[3] = (byte)(lba & 0xFF);
@@ -115,7 +115,7 @@ namespace DiscImageChef.Devices
senseBuffer = new byte[32];
bool sense;
- cdb[0] = (byte)ScsiCommands.Adaptec_SetErrorThreshold;
+ cdb[0] = (byte)ScsiCommands.AdaptecSetErrorThreshold;
if(drive1) cdb[1] += 0x20;
cdb[4] = 1;
@@ -157,7 +157,7 @@ namespace DiscImageChef.Devices
senseBuffer = new byte[32];
bool sense;
- cdb[0] = (byte)ScsiCommands.Adaptec_Translate;
+ cdb[0] = (byte)ScsiCommands.AdaptecTranslate;
if(drive1) cdb[1] += 0x20;
cdb[4] = (byte)buffer.Length;
@@ -187,7 +187,7 @@ namespace DiscImageChef.Devices
senseBuffer = new byte[32];
bool sense;
- cdb[0] = (byte)ScsiCommands.Adaptec_WriteBuffer;
+ cdb[0] = (byte)ScsiCommands.AdaptecWriteBuffer;
lastError = SendScsiCommand(cdb, ref oneKBuffer, out senseBuffer, timeout, ScsiDirection.Out, out duration,
out sense);
@@ -212,7 +212,7 @@ namespace DiscImageChef.Devices
senseBuffer = new byte[32];
bool sense;
- cdb[0] = (byte)ScsiCommands.Adaptec_ReadBuffer;
+ cdb[0] = (byte)ScsiCommands.AdaptecReadBuffer;
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
out sense);
diff --git a/DiscImageChef.Devices/Device/ScsiCommands/ArchiveCorp.cs b/DiscImageChef.Devices/Device/ScsiCommands/ArchiveCorp.cs
index 626b0b5f5..09e08cd69 100644
--- a/DiscImageChef.Devices/Device/ScsiCommands/ArchiveCorp.cs
+++ b/DiscImageChef.Devices/Device/ScsiCommands/ArchiveCorp.cs
@@ -51,7 +51,7 @@ namespace DiscImageChef.Devices
senseBuffer = new byte[32];
bool sense;
- cdb[0] = (byte)ScsiCommands.Archive_RequestBlockAddress;
+ cdb[0] = (byte)ScsiCommands.ArchiveRequestBlockAddress;
cdb[1] = (byte)((lba & 0x1F0000) >> 16);
cdb[2] = (byte)((lba & 0xFF00) >> 8);
cdb[3] = (byte)(lba & 0xFF);
@@ -94,7 +94,7 @@ namespace DiscImageChef.Devices
senseBuffer = new byte[32];
bool sense;
- cdb[0] = (byte)ScsiCommands.Archive_SeekBlock;
+ cdb[0] = (byte)ScsiCommands.ArchiveSeekBlock;
cdb[1] = (byte)((lba & 0x1F0000) >> 16);
cdb[2] = (byte)((lba & 0xFF00) >> 8);
cdb[3] = (byte)(lba & 0xFF);
diff --git a/DiscImageChef.Devices/Device/ScsiCommands/Certance.cs b/DiscImageChef.Devices/Device/ScsiCommands/Certance.cs
index 6db6e2581..1e059224a 100644
--- a/DiscImageChef.Devices/Device/ScsiCommands/Certance.cs
+++ b/DiscImageChef.Devices/Device/ScsiCommands/Certance.cs
@@ -72,7 +72,7 @@ namespace DiscImageChef.Devices
senseBuffer = new byte[32];
bool sense;
- cdb[0] = (byte)ScsiCommands.Certance_ParkUnpark;
+ cdb[0] = (byte)ScsiCommands.CertanceParkUnpark;
if(park) cdb[4] = 1;
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
diff --git a/DiscImageChef.Devices/Device/ScsiCommands/Fujitsu.cs b/DiscImageChef.Devices/Device/ScsiCommands/Fujitsu.cs
index 0e19f1196..4ab0203f4 100644
--- a/DiscImageChef.Devices/Device/ScsiCommands/Fujitsu.cs
+++ b/DiscImageChef.Devices/Device/ScsiCommands/Fujitsu.cs
@@ -96,7 +96,7 @@ namespace DiscImageChef.Devices
Array.Copy(firstHalfBytes, 0, buffer, 1, 8);
Array.Copy(secondHalfBytes, 0, buffer, 9, 8);
- cdb[0] = (byte)ScsiCommands.Fujitsu_Display;
+ cdb[0] = (byte)ScsiCommands.FujitsuDisplay;
cdb[6] = (byte)buffer.Length;
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.Out, out duration,
diff --git a/DiscImageChef.Devices/Device/ScsiCommands/HL-DT-ST.cs b/DiscImageChef.Devices/Device/ScsiCommands/HL-DT-ST.cs
index 3edd78afb..071addb11 100644
--- a/DiscImageChef.Devices/Device/ScsiCommands/HL-DT-ST.cs
+++ b/DiscImageChef.Devices/Device/ScsiCommands/HL-DT-ST.cs
@@ -54,7 +54,7 @@ namespace DiscImageChef.Devices
buffer = new byte[2064 * transferLength];
bool sense;
- cdb[0] = (byte)ScsiCommands.HlDtSt_Vendor;
+ cdb[0] = (byte)ScsiCommands.HlDtStVendor;
cdb[1] = 0x48;
cdb[2] = 0x49;
cdb[3] = 0x54;
diff --git a/DiscImageChef.Devices/Device/ScsiCommands/HP.cs b/DiscImageChef.Devices/Device/ScsiCommands/HP.cs
index f2512c324..2861d14f9 100644
--- a/DiscImageChef.Devices/Device/ScsiCommands/HP.cs
+++ b/DiscImageChef.Devices/Device/ScsiCommands/HP.cs
@@ -48,10 +48,10 @@ namespace DiscImageChef.Devices
/// If set to true address contain physical block address.
/// Timeout in seconds.
/// Duration in milliseconds it took for the device to execute the command.
- public bool HPReadLong(out byte[] buffer, out byte[] senseBuffer, bool relAddr, uint address, ushort blockBytes,
+ public bool HpReadLong(out byte[] buffer, out byte[] senseBuffer, bool relAddr, uint address, ushort blockBytes,
bool pba, uint timeout, out double duration)
{
- return HPReadLong(out buffer, out senseBuffer, relAddr, address, 0, blockBytes, pba, false, timeout,
+ return HpReadLong(out buffer, out senseBuffer, relAddr, address, 0, blockBytes, pba, false, timeout,
out duration);
}
@@ -69,7 +69,7 @@ namespace DiscImageChef.Devices
/// If set to true is a count of secors to read. Otherwise it will be ignored
/// Timeout in seconds.
/// Duration in milliseconds it took for the device to execute the command.
- public bool HPReadLong(out byte[] buffer, out byte[] senseBuffer, bool relAddr, uint address,
+ public bool HpReadLong(out byte[] buffer, out byte[] senseBuffer, bool relAddr, uint address,
ushort transferLen, ushort blockBytes, bool pba, bool sectorCount, uint timeout,
out double duration)
{
diff --git a/DiscImageChef.Devices/Device/ScsiCommands/Kreon.cs b/DiscImageChef.Devices/Device/ScsiCommands/Kreon.cs
index bb02ae1cd..6a961cc1d 100644
--- a/DiscImageChef.Devices/Device/ScsiCommands/Kreon.cs
+++ b/DiscImageChef.Devices/Device/ScsiCommands/Kreon.cs
@@ -51,7 +51,7 @@ namespace DiscImageChef.Devices
byte[] buffer = new byte[0];
bool sense;
- cdb[0] = (byte)ScsiCommands.Kreon_Command;
+ cdb[0] = (byte)ScsiCommands.KreonCommand;
cdb[1] = 0x08;
cdb[2] = 0x01;
cdb[3] = 0x01;
@@ -116,7 +116,7 @@ namespace DiscImageChef.Devices
byte[] buffer = new byte[0];
bool sense;
- cdb[0] = (byte)ScsiCommands.Kreon_Command;
+ cdb[0] = (byte)ScsiCommands.KreonCommand;
cdb[1] = 0x08;
cdb[2] = 0x01;
cdb[3] = 0x11;
@@ -148,7 +148,7 @@ namespace DiscImageChef.Devices
bool sense;
features = 0;
- cdb[0] = (byte)ScsiCommands.Kreon_Command;
+ cdb[0] = (byte)ScsiCommands.KreonCommand;
cdb[1] = 0x08;
cdb[2] = 0x01;
cdb[3] = 0x10;
@@ -178,7 +178,7 @@ namespace DiscImageChef.Devices
features |= KreonFeatures.WxripperUnlock360;
break;
case 0x2001:
- features |= KreonFeatures.DecryptSS360;
+ features |= KreonFeatures.DecryptSs360;
break;
case 0x2101:
features |= KreonFeatures.ChallengeResponse360;
@@ -190,7 +190,7 @@ namespace DiscImageChef.Devices
features |= KreonFeatures.WxripperUnlock;
break;
case 0x2002:
- features |= KreonFeatures.DecryptSS;
+ features |= KreonFeatures.DecryptSs;
break;
case 0x2102:
features |= KreonFeatures.ChallengeResponse;
@@ -215,7 +215,7 @@ namespace DiscImageChef.Devices
/// Timeout.
/// Duration.
/// The SS sector.
- public bool KreonExtractSS(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration,
+ public bool KreonExtractSs(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration,
byte requestNumber = 0x00)
{
buffer = new byte[2048];
@@ -223,7 +223,7 @@ namespace DiscImageChef.Devices
senseBuffer = new byte[32];
bool sense;
- cdb[0] = (byte)ScsiCommands.Kreon_SS_Command;
+ cdb[0] = (byte)ScsiCommands.KreonSsCommand;
cdb[1] = 0x00;
cdb[2] = 0xFF;
cdb[3] = 0x02;
diff --git a/DiscImageChef.Devices/Device/ScsiCommands/MMC.cs b/DiscImageChef.Devices/Device/ScsiCommands/MMC.cs
index cd2151128..aa2ab6ea5 100644
--- a/DiscImageChef.Devices/Device/ScsiCommands/MMC.cs
+++ b/DiscImageChef.Devices/Device/ScsiCommands/MMC.cs
@@ -76,9 +76,9 @@ namespace DiscImageChef.Devices
/// Timeout in seconds.
/// Duration in milliseconds it took for the device to execute the command.
/// Starting Feature number.
- /// Return type, .
+ /// Return type, .
public bool GetConfiguration(out byte[] buffer, out byte[] senseBuffer, ushort startingFeatureNumber,
- MmcGetConfigurationRt RT, uint timeout, out double duration)
+ MmcGetConfigurationRt rt, uint timeout, out double duration)
{
senseBuffer = new byte[32];
byte[] cdb = new byte[10];
@@ -86,7 +86,7 @@ namespace DiscImageChef.Devices
bool sense;
cdb[0] = (byte)ScsiCommands.GetConfiguration;
- cdb[1] = (byte)((byte)RT & 0x03);
+ cdb[1] = (byte)((byte)rt & 0x03);
cdb[2] = (byte)((startingFeatureNumber & 0xFF00) >> 8);
cdb[3] = (byte)(startingFeatureNumber & 0xFF);
cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8);
@@ -127,10 +127,10 @@ namespace DiscImageChef.Devices
/// Medium layer for requested disc structure
/// Timeout in seconds.
/// Which disc structure are we requesting
- /// AGID used in medium copy protection
+ /// AGID used in medium copy protection
/// Duration in milliseconds it took for the device to execute the command.
public bool ReadDiscStructure(out byte[] buffer, out byte[] senseBuffer, MmcDiscStructureMediaType mediaType,
- uint address, byte layerNumber, MmcDiscStructureFormat format, byte AGID,
+ uint address, byte layerNumber, MmcDiscStructureFormat format, byte agid,
uint timeout, out double duration)
{
senseBuffer = new byte[32];
@@ -148,7 +148,7 @@ namespace DiscImageChef.Devices
cdb[7] = (byte)format;
cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8);
cdb[9] = (byte)(buffer.Length & 0xFF);
- cdb[10] = (byte)((AGID & 0x03) << 6);
+ cdb[10] = (byte)((agid & 0x03) << 6);
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
out sense);
@@ -193,14 +193,14 @@ namespace DiscImageChef.Devices
/// true if the command failed and contains the sense buffer.
/// Buffer where the SCSI READ TOC/PMA/ATIP response will be stored
/// Sense buffer.
- /// If true, request data in MM:SS:FF units, otherwise, in blocks
+ /// If true, request data in MM:SS:FF units, otherwise, in blocks
/// Start TOC from this track
/// Timeout in seconds.
/// Duration in milliseconds it took for the device to execute the command.
- public bool ReadToc(out byte[] buffer, out byte[] senseBuffer, bool MSF, byte track, uint timeout,
+ public bool ReadToc(out byte[] buffer, out byte[] senseBuffer, bool msf, byte track, uint timeout,
out double duration)
{
- return ReadTocPmaAtip(out buffer, out senseBuffer, MSF, 0, track, timeout, out duration);
+ return ReadTocPmaAtip(out buffer, out senseBuffer, msf, 0, track, timeout, out duration);
}
///
@@ -222,13 +222,13 @@ namespace DiscImageChef.Devices
/// true if the command failed and contains the sense buffer.
/// Buffer where the SCSI READ TOC/PMA/ATIP response will be stored
/// Sense buffer.
- /// If true, request data in MM:SS:FF units, otherwise, in blocks
+ /// If true, request data in MM:SS:FF units, otherwise, in blocks
/// Timeout in seconds.
/// Duration in milliseconds it took for the device to execute the command.
- public bool ReadSessionInfo(out byte[] buffer, out byte[] senseBuffer, bool MSF, uint timeout,
+ public bool ReadSessionInfo(out byte[] buffer, out byte[] senseBuffer, bool msf, uint timeout,
out double duration)
{
- return ReadTocPmaAtip(out buffer, out senseBuffer, MSF, 1, 0, timeout, out duration);
+ return ReadTocPmaAtip(out buffer, out senseBuffer, msf, 1, 0, timeout, out duration);
}
///
@@ -291,12 +291,12 @@ namespace DiscImageChef.Devices
/// true if the command failed and contains the sense buffer.
/// Buffer where the SCSI READ TOC/PMA/ATIP response will be stored
/// Sense buffer.
- /// If true, request data in MM:SS:FF units, otherwise, in blocks
+ /// If true, request data in MM:SS:FF units, otherwise, in blocks
/// What structure is requested
/// Track/Session number
/// Timeout in seconds.
/// Duration in milliseconds it took for the device to execute the command.
- public bool ReadTocPmaAtip(out byte[] buffer, out byte[] senseBuffer, bool MSF, byte format,
+ public bool ReadTocPmaAtip(out byte[] buffer, out byte[] senseBuffer, bool msf, byte format,
byte trackSessionNumber, uint timeout, out double duration)
{
senseBuffer = new byte[32];
@@ -308,7 +308,7 @@ namespace DiscImageChef.Devices
else tmpBuffer = new byte[1024];
cdb[0] = (byte)ScsiCommands.ReadTocPmaAtip;
- if(MSF) cdb[1] = 0x02;
+ if(msf) cdb[1] = 0x02;
cdb[2] = (byte)(format & 0x0F);
cdb[6] = trackSessionNumber;
cdb[7] = (byte)((tmpBuffer.Length & 0xFF00) >> 8);
@@ -404,17 +404,17 @@ namespace DiscImageChef.Devices
/// How many blocks to read.
/// Block size.
/// Expected sector type.
- /// If set to true CD-DA should be modified by mute and interpolation
+ /// If set to true CD-DA should be modified by mute and interpolation
/// If set to true address is relative to current position.
/// If set to true we request the sync bytes for data sectors.
/// Header codes.
/// If set to true we request the user data.
/// If set to true we request the EDC/ECC fields for data sectors.
- /// C2 error options.
+ /// C2 error options.
/// Subchannel selection.
public bool ReadCd(out byte[] buffer, out byte[] senseBuffer, uint lba, uint blockSize, uint transferLength,
- MmcSectorTypes expectedSectorType, bool DAP, bool relAddr, bool sync,
- MmcHeaderCodes headerCodes, bool userData, bool edcEcc, MmcErrorField C2Error,
+ MmcSectorTypes expectedSectorType, bool dap, bool relAddr, bool sync,
+ MmcHeaderCodes headerCodes, bool userData, bool edcEcc, MmcErrorField c2Error,
MmcSubchannel subchannel, uint timeout, out double duration)
{
senseBuffer = new byte[32];
@@ -423,7 +423,7 @@ namespace DiscImageChef.Devices
cdb[0] = (byte)ScsiCommands.ReadCd;
cdb[1] = (byte)((byte)expectedSectorType << 2);
- if(DAP) cdb[1] += 0x02;
+ if(dap) cdb[1] += 0x02;
if(relAddr) cdb[1] += 0x01;
cdb[2] = (byte)((lba & 0xFF000000) >> 24);
cdb[3] = (byte)((lba & 0xFF0000) >> 16);
@@ -432,7 +432,7 @@ namespace DiscImageChef.Devices
cdb[6] = (byte)((transferLength & 0xFF0000) >> 16);
cdb[7] = (byte)((transferLength & 0xFF00) >> 8);
cdb[8] = (byte)(transferLength & 0xFF);
- cdb[9] = (byte)((byte)C2Error << 1);
+ cdb[9] = (byte)((byte)c2Error << 1);
cdb[9] += (byte)((byte)headerCodes << 5);
if(sync) cdb[9] += 0x80;
if(userData) cdb[9] += 0x10;
@@ -462,16 +462,16 @@ namespace DiscImageChef.Devices
/// End MM:SS:FF of read encoded as 0x00MMSSFF.
/// Block size.
/// Expected sector type.
- /// If set to true CD-DA should be modified by mute and interpolation
+ /// If set to true CD-DA should be modified by mute and interpolation
/// If set to true we request the sync bytes for data sectors.
/// Header codes.
/// If set to true we request the user data.
/// If set to true we request the EDC/ECC fields for data sectors.
- /// C2 error options.
+ /// C2 error options.
/// Subchannel selection.
public bool ReadCdMsf(out byte[] buffer, out byte[] senseBuffer, uint startMsf, uint endMsf, uint blockSize,
- MmcSectorTypes expectedSectorType, bool DAP, bool sync, MmcHeaderCodes headerCodes,
- bool userData, bool edcEcc, MmcErrorField C2Error, MmcSubchannel subchannel, uint timeout,
+ MmcSectorTypes expectedSectorType, bool dap, bool sync, MmcHeaderCodes headerCodes,
+ bool userData, bool edcEcc, MmcErrorField c2Error, MmcSubchannel subchannel, uint timeout,
out double duration)
{
senseBuffer = new byte[32];
@@ -480,14 +480,14 @@ namespace DiscImageChef.Devices
cdb[0] = (byte)ScsiCommands.ReadCdMsf;
cdb[1] = (byte)((byte)expectedSectorType << 2);
- if(DAP) cdb[1] += 0x02;
+ if(dap) cdb[1] += 0x02;
cdb[3] = (byte)((startMsf & 0xFF0000) >> 16);
cdb[4] = (byte)((startMsf & 0xFF00) >> 8);
cdb[5] = (byte)(startMsf & 0xFF);
cdb[6] = (byte)((endMsf & 0xFF0000) >> 16);
cdb[7] = (byte)((endMsf & 0xFF00) >> 8);
cdb[8] = (byte)(endMsf & 0xFF);
- cdb[9] = (byte)((byte)C2Error << 1);
+ cdb[9] = (byte)((byte)c2Error << 1);
cdb[9] += (byte)((byte)headerCodes << 5);
if(sync) cdb[9] += 0x80;
if(userData) cdb[9] += 0x10;
diff --git a/DiscImageChef.Devices/Device/ScsiCommands/NEC.cs b/DiscImageChef.Devices/Device/ScsiCommands/NEC.cs
index 8bfe3913f..2d650bd55 100644
--- a/DiscImageChef.Devices/Device/ScsiCommands/NEC.cs
+++ b/DiscImageChef.Devices/Device/ScsiCommands/NEC.cs
@@ -53,7 +53,7 @@ namespace DiscImageChef.Devices
byte[] cdb = new byte[10];
bool sense;
- cdb[0] = (byte)ScsiCommands.NEC_ReadCdDa;
+ cdb[0] = (byte)ScsiCommands.NecReadCdDa;
cdb[2] = (byte)((lba & 0xFF000000) >> 24);
cdb[3] = (byte)((lba & 0xFF0000) >> 16);
cdb[4] = (byte)((lba & 0xFF00) >> 8);
diff --git a/DiscImageChef.Devices/Device/ScsiCommands/Plasmon.cs b/DiscImageChef.Devices/Device/ScsiCommands/Plasmon.cs
index 753bf7276..68791e237 100644
--- a/DiscImageChef.Devices/Device/ScsiCommands/Plasmon.cs
+++ b/DiscImageChef.Devices/Device/ScsiCommands/Plasmon.cs
@@ -51,7 +51,7 @@ namespace DiscImageChef.Devices
public bool PlasmonReadLong(out byte[] buffer, out byte[] senseBuffer, bool relAddr, uint address,
ushort blockBytes, bool pba, uint timeout, out double duration)
{
- return HPReadLong(out buffer, out senseBuffer, relAddr, address, 0, blockBytes, pba, false, timeout,
+ return HpReadLong(out buffer, out senseBuffer, relAddr, address, 0, blockBytes, pba, false, timeout,
out duration);
}
@@ -73,7 +73,7 @@ namespace DiscImageChef.Devices
ushort transferLen, ushort blockBytes, bool pba, bool sectorCount, uint timeout,
out double duration)
{
- return HPReadLong(out buffer, out senseBuffer, relAddr, address, transferLen, blockBytes, pba, sectorCount,
+ return HpReadLong(out buffer, out senseBuffer, relAddr, address, transferLen, blockBytes, pba, sectorCount,
timeout, out duration);
}
@@ -94,7 +94,7 @@ namespace DiscImageChef.Devices
byte[] cdb = new byte[10];
bool sense;
- cdb[0] = (byte)ScsiCommands.Plasmon_ReadSectorLocation;
+ cdb[0] = (byte)ScsiCommands.PlasmonReadSectorLocation;
cdb[2] = (byte)((address & 0xFF000000) >> 24);
cdb[3] = (byte)((address & 0xFF0000) >> 16);
cdb[4] = (byte)((address & 0xFF00) >> 8);
diff --git a/DiscImageChef.Devices/Device/ScsiCommands/Plextor.cs b/DiscImageChef.Devices/Device/ScsiCommands/Plextor.cs
index fbd4a1e60..63765b26c 100644
--- a/DiscImageChef.Devices/Device/ScsiCommands/Plextor.cs
+++ b/DiscImageChef.Devices/Device/ScsiCommands/Plextor.cs
@@ -123,14 +123,14 @@ namespace DiscImageChef.Devices
/// Sense buffer.
/// Timeout.
/// Duration.
- public bool PlextorReadEepromCDR(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration)
+ public bool PlextorReadEepromCdr(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration)
{
buffer = new byte[256];
senseBuffer = new byte[32];
byte[] cdb = new byte[12];
bool sense;
- cdb[0] = (byte)ScsiCommands.Plextor_ReadEeprom;
+ cdb[0] = (byte)ScsiCommands.PlextorReadEeprom;
cdb[8] = 1;
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
@@ -157,7 +157,7 @@ namespace DiscImageChef.Devices
byte[] cdb = new byte[12];
bool sense;
- cdb[0] = (byte)ScsiCommands.Plextor_ReadEeprom;
+ cdb[0] = (byte)ScsiCommands.PlextorReadEeprom;
cdb[8] = 2;
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
@@ -187,7 +187,7 @@ namespace DiscImageChef.Devices
byte[] cdb = new byte[12];
bool sense;
- cdb[0] = (byte)ScsiCommands.Plextor_ReadEeprom;
+ cdb[0] = (byte)ScsiCommands.PlextorReadEeprom;
cdb[1] = 1;
cdb[7] = block;
cdb[8] = (byte)((blockSize & 0xFF00) >> 8);
@@ -224,7 +224,7 @@ namespace DiscImageChef.Devices
max = 0;
last = 0;
- cdb[0] = (byte)ScsiCommands.Plextor_PoweRec;
+ cdb[0] = (byte)ScsiCommands.PlextorPoweRec;
cdb[9] = (byte)buf.Length;
lastError = SendScsiCommand(cdb, ref buf, out senseBuffer, timeout, ScsiDirection.In, out duration,
@@ -264,7 +264,7 @@ namespace DiscImageChef.Devices
enabled = false;
speed = 0;
- cdb[0] = (byte)ScsiCommands.Plextor_Extend2;
+ cdb[0] = (byte)ScsiCommands.PlextorExtend2;
cdb[1] = (byte)PlextorSubCommands.GetMode;
cdb[9] = (byte)buf.Length;
@@ -299,7 +299,7 @@ namespace DiscImageChef.Devices
byte[] cdb = new byte[12];
bool sense;
- cdb[0] = (byte)ScsiCommands.Plextor_Extend;
+ cdb[0] = (byte)ScsiCommands.PlextorExtend;
cdb[1] = (byte)PlextorSubCommands.GetMode;
cdb[2] = (byte)PlextorSubCommands.Silent;
cdb[3] = 4;
@@ -329,7 +329,7 @@ namespace DiscImageChef.Devices
byte[] cdb = new byte[12];
bool sense;
- cdb[0] = (byte)ScsiCommands.Plextor_Extend;
+ cdb[0] = (byte)ScsiCommands.PlextorExtend;
cdb[1] = (byte)PlextorSubCommands.GetMode;
cdb[2] = (byte)PlextorSubCommands.GigaRec;
cdb[10] = (byte)buffer.Length;
@@ -359,7 +359,7 @@ namespace DiscImageChef.Devices
byte[] cdb = new byte[12];
bool sense;
- cdb[0] = (byte)ScsiCommands.Plextor_Extend;
+ cdb[0] = (byte)ScsiCommands.PlextorExtend;
cdb[1] = (byte)PlextorSubCommands.GetMode;
cdb[2] = (byte)PlextorSubCommands.VariRec;
cdb[10] = (byte)buffer.Length;
@@ -391,7 +391,7 @@ namespace DiscImageChef.Devices
byte[] cdb = new byte[12];
bool sense;
- cdb[0] = (byte)ScsiCommands.Plextor_Extend;
+ cdb[0] = (byte)ScsiCommands.PlextorExtend;
cdb[2] = (byte)PlextorSubCommands.SecuRec;
cdb[10] = (byte)buffer.Length;
@@ -419,7 +419,7 @@ namespace DiscImageChef.Devices
byte[] cdb = new byte[12];
bool sense;
- cdb[0] = (byte)ScsiCommands.Plextor_Extend;
+ cdb[0] = (byte)ScsiCommands.PlextorExtend;
cdb[1] = (byte)PlextorSubCommands.GetMode;
cdb[2] = (byte)PlextorSubCommands.SpeedRead;
cdb[10] = (byte)buffer.Length;
@@ -448,7 +448,7 @@ namespace DiscImageChef.Devices
byte[] cdb = new byte[12];
bool sense;
- cdb[0] = (byte)ScsiCommands.Plextor_Extend;
+ cdb[0] = (byte)ScsiCommands.PlextorExtend;
cdb[1] = (byte)PlextorSubCommands.GetMode;
cdb[2] = (byte)PlextorSubCommands.SessionHide;
cdb[9] = (byte)buffer.Length;
@@ -478,12 +478,12 @@ namespace DiscImageChef.Devices
byte[] cdb = new byte[12];
bool sense;
- cdb[0] = (byte)ScsiCommands.Plextor_Extend;
+ cdb[0] = (byte)ScsiCommands.PlextorExtend;
cdb[1] = (byte)PlextorSubCommands.GetMode;
cdb[2] = (byte)PlextorSubCommands.BitSet;
cdb[9] = (byte)buffer.Length;
- if(dualLayer) cdb[3] = (byte)PlextorSubCommands.BitSetRDL;
+ if(dualLayer) cdb[3] = (byte)PlextorSubCommands.BitSetRdl;
else cdb[3] = (byte)PlextorSubCommands.BitSetR;
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
@@ -511,7 +511,7 @@ namespace DiscImageChef.Devices
byte[] cdb = new byte[12];
bool sense;
- cdb[0] = (byte)ScsiCommands.Plextor_Extend;
+ cdb[0] = (byte)ScsiCommands.PlextorExtend;
cdb[1] = (byte)PlextorSubCommands.GetMode;
cdb[2] = (byte)PlextorSubCommands.TestWriteDvdPlus;
cdb[10] = (byte)buffer.Length;
diff --git a/DiscImageChef.Devices/Device/ScsiCommands/SPC.cs b/DiscImageChef.Devices/Device/ScsiCommands/SPC.cs
index 8a581b8e1..0db9b946c 100644
--- a/DiscImageChef.Devices/Device/ScsiCommands/SPC.cs
+++ b/DiscImageChef.Devices/Device/ScsiCommands/SPC.cs
@@ -233,13 +233,13 @@ namespace DiscImageChef.Devices
/// Sense buffer.
/// Timeout in seconds.
/// Duration in milliseconds it took for the device to execute the command.
- /// If set to true device MUST not return any block descriptor.
+ /// If set to true device MUST not return any block descriptor.
/// Page control.
/// Page code.
- public bool ModeSense6(out byte[] buffer, out byte[] senseBuffer, bool DBD,
+ public bool ModeSense6(out byte[] buffer, out byte[] senseBuffer, bool dbd,
ScsiModeSensePageControl pageControl, byte pageCode, uint timeout, out double duration)
{
- return ModeSense6(out buffer, out senseBuffer, DBD, pageControl, pageCode, 0, timeout, out duration);
+ return ModeSense6(out buffer, out senseBuffer, dbd, pageControl, pageCode, 0, timeout, out duration);
}
///
@@ -250,11 +250,11 @@ namespace DiscImageChef.Devices
/// Sense buffer.
/// Timeout in seconds.
/// Duration in milliseconds it took for the device to execute the command.
- /// If set to true device MUST not return any block descriptor.
+ /// If set to true device MUST not return any block descriptor.
/// Page control.
/// Page code.
/// Sub-page code.
- public bool ModeSense6(out byte[] buffer, out byte[] senseBuffer, bool DBD,
+ public bool ModeSense6(out byte[] buffer, out byte[] senseBuffer, bool dbd,
ScsiModeSensePageControl pageControl, byte pageCode, byte subPageCode, uint timeout,
out double duration)
{
@@ -264,7 +264,7 @@ namespace DiscImageChef.Devices
bool sense;
cdb[0] = (byte)ScsiCommands.ModeSense;
- if(DBD) cdb[1] = 0x08;
+ if(dbd) cdb[1] = 0x08;
cdb[2] |= (byte)pageControl;
cdb[2] |= (byte)(pageCode & 0x3F);
cdb[3] = subPageCode;
@@ -299,13 +299,13 @@ namespace DiscImageChef.Devices
/// Sense buffer.
/// Timeout in seconds.
/// Duration in milliseconds it took for the device to execute the command.
- /// If set to true device MUST not return any block descriptor.
+ /// If set to true device MUST not return any block descriptor.
/// Page control.
/// Page code.
- public bool ModeSense10(out byte[] buffer, out byte[] senseBuffer, bool DBD,
+ public bool ModeSense10(out byte[] buffer, out byte[] senseBuffer, bool dbd,
ScsiModeSensePageControl pageControl, byte pageCode, uint timeout, out double duration)
{
- return ModeSense10(out buffer, out senseBuffer, false, DBD, pageControl, pageCode, 0, timeout,
+ return ModeSense10(out buffer, out senseBuffer, false, dbd, pageControl, pageCode, 0, timeout,
out duration);
}
@@ -317,14 +317,14 @@ namespace DiscImageChef.Devices
/// Sense buffer.
/// Timeout in seconds.
/// Duration in milliseconds it took for the device to execute the command.
- /// If set to true device MUST not return any block descriptor.
+ /// If set to true device MUST not return any block descriptor.
/// Page control.
/// Page code.
- /// If set means 64-bit LBAs are accepted by the caller.
- public bool ModeSense10(out byte[] buffer, out byte[] senseBuffer, bool LLBAA, bool DBD,
+ /// If set means 64-bit LBAs are accepted by the caller.
+ public bool ModeSense10(out byte[] buffer, out byte[] senseBuffer, bool llbaa, bool dbd,
ScsiModeSensePageControl pageControl, byte pageCode, uint timeout, out double duration)
{
- return ModeSense10(out buffer, out senseBuffer, LLBAA, DBD, pageControl, pageCode, 0, timeout,
+ return ModeSense10(out buffer, out senseBuffer, llbaa, dbd, pageControl, pageCode, 0, timeout,
out duration);
}
@@ -336,12 +336,12 @@ namespace DiscImageChef.Devices
/// Sense buffer.
/// Timeout in seconds.
/// Duration in milliseconds it took for the device to execute the command.
- /// If set to true device MUST not return any block descriptor.
+ /// If set to true device MUST not return any block descriptor.
/// Page control.
/// Page code.
/// Sub-page code.
- /// If set means 64-bit LBAs are accepted by the caller.
- public bool ModeSense10(out byte[] buffer, out byte[] senseBuffer, bool LLBAA, bool DBD,
+ /// If set means 64-bit LBAs are accepted by the caller.
+ public bool ModeSense10(out byte[] buffer, out byte[] senseBuffer, bool llbaa, bool dbd,
ScsiModeSensePageControl pageControl, byte pageCode, byte subPageCode, uint timeout,
out double duration)
{
@@ -351,8 +351,8 @@ namespace DiscImageChef.Devices
bool sense;
cdb[0] = (byte)ScsiCommands.ModeSense10;
- if(LLBAA) cdb[1] |= 0x10;
- if(DBD) cdb[1] |= 0x08;
+ if(llbaa) cdb[1] |= 0x10;
+ if(dbd) cdb[1] |= 0x08;
cdb[2] |= (byte)pageControl;
cdb[2] |= (byte)(pageCode & 0x3F);
cdb[3] = subPageCode;
@@ -472,12 +472,12 @@ namespace DiscImageChef.Devices
/// true if the command failed and contains the sense buffer.
/// Buffer where the SCSI READ CAPACITY response will be stored
/// Sense buffer.
- /// Indicates that is relative to current medium position
- /// Address where information is requested from, only valid if is set
- /// If set, it is requesting partial media capacity
+ /// Indicates that is relative to current medium position
+ /// Address where information is requested from, only valid if is set
+ /// If set, it is requesting partial media capacity
/// Timeout in seconds.
/// Duration in milliseconds it took for the device to execute the command.
- public bool ReadCapacity(out byte[] buffer, out byte[] senseBuffer, bool RelAddr, uint address, bool PMI,
+ public bool ReadCapacity(out byte[] buffer, out byte[] senseBuffer, bool relAddr, uint address, bool pmi,
uint timeout, out double duration)
{
senseBuffer = new byte[32];
@@ -487,10 +487,10 @@ namespace DiscImageChef.Devices
cdb[0] = (byte)ScsiCommands.ReadCapacity;
- if(PMI)
+ if(pmi)
{
cdb[8] = 0x01;
- if(RelAddr) cdb[1] = 0x01;
+ if(relAddr) cdb[1] = 0x01;
cdb[2] = (byte)((address & 0xFF000000) >> 24);
cdb[3] = (byte)((address & 0xFF0000) >> 16);
@@ -526,11 +526,11 @@ namespace DiscImageChef.Devices
/// true if the command failed and contains the sense buffer.
/// Buffer where the SCSI READ CAPACITY(16) response will be stored
/// Sense buffer.
- /// Address where information is requested from, only valid if is set
- /// If set, it is requesting partial media capacity
+ /// Address where information is requested from, only valid if is set
+ /// If set, it is requesting partial media capacity
/// Timeout in seconds.
/// Duration in milliseconds it took for the device to execute the command.
- public bool ReadCapacity16(out byte[] buffer, out byte[] senseBuffer, ulong address, bool PMI, uint timeout,
+ public bool ReadCapacity16(out byte[] buffer, out byte[] senseBuffer, ulong address, bool pmi, uint timeout,
out double duration)
{
senseBuffer = new byte[32];
@@ -541,7 +541,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);
@@ -738,10 +738,10 @@ namespace DiscImageChef.Devices
// Prevent overflows
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) lastError = 75;
+ 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;
error = true;
duration = 0;
@@ -781,10 +781,10 @@ namespace DiscImageChef.Devices
// Prevent overflows
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) lastError = 75;
+ 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;
error = true;
duration = 0;
diff --git a/DiscImageChef.Devices/Device/ScsiCommands/SSC.cs b/DiscImageChef.Devices/Device/ScsiCommands/SSC.cs
index 34b0f2d7f..cc547a645 100644
--- a/DiscImageChef.Devices/Device/ScsiCommands/SSC.cs
+++ b/DiscImageChef.Devices/Device/ScsiCommands/SSC.cs
@@ -1004,13 +1004,13 @@ namespace DiscImageChef.Devices
byte[] cdb = new byte[6];
byte[] buffer = new byte[0];
bool sense;
- byte[] count_b = BitConverter.GetBytes(count);
+ byte[] countB = BitConverter.GetBytes(count);
cdb[0] = (byte)ScsiCommands.Space;
cdb[1] = (byte)((byte)code & 0x0F);
- cdb[2] = count_b[2];
- cdb[3] = count_b[1];
- cdb[4] = count_b[0];
+ cdb[2] = countB[2];
+ cdb[3] = countB[1];
+ cdb[4] = countB[0];
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
out sense);
diff --git a/DiscImageChef.Devices/Device/Variables.cs b/DiscImageChef.Devices/Device/Variables.cs
index 9a01bc216..d913a1cc3 100644
--- a/DiscImageChef.Devices/Device/Variables.cs
+++ b/DiscImageChef.Devices/Device/Variables.cs
@@ -34,7 +34,7 @@ namespace DiscImageChef.Devices
{
public partial class Device
{
- Interop.PlatformID platformID;
+ Interop.PlatformID platformId;
object fd;
bool error;
int lastError;
@@ -73,9 +73,9 @@ namespace DiscImageChef.Devices
/// Gets the Platform ID for this device
///
/// The Platform ID
- public Interop.PlatformID PlatformID
+ public Interop.PlatformID PlatformId
{
- get { return platformID; }
+ get { return platformId; }
}
///
@@ -160,7 +160,7 @@ namespace DiscImageChef.Devices
/// Gets the device's SCSI peripheral device type
///
/// The SCSI peripheral device type.
- public Decoders.SCSI.PeripheralDeviceTypes SCSIType
+ public Decoders.SCSI.PeripheralDeviceTypes ScsiType
{
get { return scsiType; }
}
@@ -178,7 +178,7 @@ namespace DiscImageChef.Devices
/// Gets a value indicating whether this device is attached via USB.
///
/// true if this device is attached via USB; otherwise, false.
- public bool IsUSB
+ public bool IsUsb
{
get { return usb; }
}
@@ -187,7 +187,7 @@ namespace DiscImageChef.Devices
/// Gets the USB vendor ID.
///
/// The USB vendor ID.
- public ushort USBVendorID
+ public ushort UsbVendorId
{
get { return usbVendor; }
}
@@ -196,7 +196,7 @@ namespace DiscImageChef.Devices
/// Gets the USB product ID.
///
/// The USB product ID.
- public ushort USBProductID
+ public ushort UsbProductId
{
get { return usbProduct; }
}
@@ -205,7 +205,7 @@ namespace DiscImageChef.Devices
/// Gets the USB descriptors.
///
/// The USB descriptors.
- public byte[] USBDescriptors
+ public byte[] UsbDescriptors
{
get { return usbDescriptors; }
}
@@ -214,7 +214,7 @@ namespace DiscImageChef.Devices
/// Gets the USB manufacturer string.
///
/// The USB manufacturer string.
- public string USBManufacturerString
+ public string UsbManufacturerString
{
get { return usbManufacturerString; }
}
@@ -223,7 +223,7 @@ namespace DiscImageChef.Devices
/// Gets the USB product string.
///
/// The USB product string.
- public string USBProductString
+ public string UsbProductString
{
get { return usbProductString; }
}
@@ -232,7 +232,7 @@ namespace DiscImageChef.Devices
/// Gets the USB serial string.
///
/// The USB serial string.
- public string USBSerialString
+ public string UsbSerialString
{
get { return usbSerialString; }
}
@@ -250,7 +250,7 @@ namespace DiscImageChef.Devices
/// Gets the FireWire GUID
///
/// The FireWire GUID.
- public ulong FireWireGUID
+ public ulong FireWireGuid
{
get { return firewireGuid; }
}
@@ -304,7 +304,7 @@ namespace DiscImageChef.Devices
/// Gets a value indicating whether this device is a PCMCIA device.
///
/// true if this device is a PCMCIA device; otherwise, false.
- public bool IsPCMCIA
+ public bool IsPcmcia
{
get { return pcmcia; }
}
@@ -312,7 +312,7 @@ namespace DiscImageChef.Devices
///
/// Contains the PCMCIA CIS if applicable
///
- public byte[] CIS
+ public byte[] Cis
{
get { return cis; }
}
diff --git a/DiscImageChef.Devices/Enums.cs b/DiscImageChef.Devices/Enums.cs
index 7b267cbf9..2a7fb10ed 100644
--- a/DiscImageChef.Devices/Enums.cs
+++ b/DiscImageChef.Devices/Enums.cs
@@ -259,7 +259,7 @@ namespace DiscImageChef.Devices
///
/// Unknown vendor command
///
- Vendor_8x = 0x80,
+ Vendor_8X = 0x80,
///
/// Unknown vendor command
///
@@ -267,83 +267,83 @@ namespace DiscImageChef.Devices
///
/// Unknown vendor command
///
- Vendor_C0 = 0xC0,
+ VendorC0 = 0xC0,
///
/// Unknown vendor command
///
- Vendor_C1 = 0xC1,
+ VendorC1 = 0xC1,
///
/// Unknown vendor command
///
- Vendor_C2 = 0xC2,
+ VendorC2 = 0xC2,
///
/// Unknown vendor command
///
- Vendor_C3 = 0xC3,
+ VendorC3 = 0xC3,
///
/// Unknown vendor command
///
- Vendor_F0 = 0xF0,
+ VendorF0 = 0xF0,
///
/// Unknown vendor command
///
- Vendor_F1 = 0xF1,
+ VendorF1 = 0xF1,
///
/// Unknown vendor command
///
- Vendor_F2 = 0xF2,
+ VendorF2 = 0xF2,
///
/// Unknown vendor command
///
- Vendor_F3 = 0xF3,
+ VendorF3 = 0xF3,
///
/// Unknown vendor command
///
- Vendor_F4 = 0xF4,
+ VendorF4 = 0xF4,
///
/// Unknown vendor command
///
- Vendor_F5 = 0xF5,
+ VendorF5 = 0xF5,
///
/// Unknown vendor command
///
- Vendor_F6 = 0xF6,
+ VendorF6 = 0xF6,
///
/// Unknown vendor command
///
- Vendor_F7 = 0xF7,
+ VendorF7 = 0xF7,
///
/// Unknown vendor command
///
- Vendor_F8 = 0xF8,
+ VendorF8 = 0xF8,
///
/// Unknown vendor command
///
- Vendor_F9 = 0xF9,
+ VendorF9 = 0xF9,
///
/// Unknown vendor command
///
- Vendor_FA = 0xFA,
+ VendorFa = 0xFA,
///
/// Unknown vendor command
///
- Vendor_FB = 0xFB,
+ VendorFb = 0xFB,
///
/// Unknown vendor command
///
- Vendor_FC = 0xFC,
+ VendorFc = 0xFC,
///
/// Unknown vendor command
///
- Vendor_FD = 0xFD,
+ VendorFd = 0xFD,
///
/// Unknown vendor command
///
- Vendor_FE = 0xFE,
+ VendorFe = 0xFE,
///
/// Unknown vendor command
///
- Vendor_FF = 0xFF,
+ VendorFf = 0xFF,
#endregion Commands defined on ATA rev. 4c
#region Commands defined on ATA-2 rev. 4c
@@ -651,9 +651,9 @@ namespace DiscImageChef.Devices
#region Commands defined on ATA/ATAPI Command Set 3 (ACS-3) rev. 5
///
- /// Sends
+ /// Sends
///
- NCQQueueManagement = 0x63,
+ NcqQueueManagement = 0x63,
///
/// Sets the device date and time
///
@@ -867,13 +867,13 @@ namespace DiscImageChef.Devices
///
/// All known ATA NCQ QUEUE MANAGEMENT sub-commands
///
- public enum AtaNCQQueueManagementSubcommands : byte
+ public enum AtaNcqQueueManagementSubcommands : byte
{
#region Commands defined on ATA/ATAPI Command Set 3 (ACS-3) rev. 5
///
/// Aborts pending NCQ commands
///
- AbortNCQQueue = 0x00,
+ AbortNcqQueue = 0x00,
///
/// Controls how NCQ Streaming commands are processed by the device
///
@@ -1321,11 +1321,11 @@ namespace DiscImageChef.Devices
///
/// SASI rev. 0a
///
- WriteECC = 0xE1,
+ WriteEcc = 0xE1,
///
/// SASI rev. 0a
///
- ReadID = 0xE2,
+ ReadId = 0xE2,
///
/// SASI rev. 0a
///
@@ -1574,7 +1574,7 @@ namespace DiscImageChef.Devices
/// 4.- Write the buffer to the blocks
/// SBC-3 rev. 16
///
- ORWrite = 0x8B,
+ OrWrite = 0x8B,
///
/// Transfers requested blocks to devices' cache
/// SCSI-2 X3T9.2/375R rev. 10l
@@ -1737,29 +1737,29 @@ namespace DiscImageChef.Devices
///
WriteSame16 = 0x93,
///
- /// Requets XOR data generated by an or command
+ /// Requets XOR data generated by an or command
/// SBC-1 rev. 8c
///
- XDRead = 0x52,
+ XdRead = 0x52,
///
- /// XORs the data sent with data on the medium and stores it until an is issued
+ /// XORs the data sent with data on the medium and stores it until an is issued
/// SBC-1 rev. 8c
///
- XDWrite = 0x50,
+ XdWrite = 0x50,
///
- /// XORs the data sent with data on the medium and stores it until an is issued
+ /// XORs the data sent with data on the medium and stores it until an is issued
/// SBC-1 rev. 8c
///
- XDWrite16 = 0x80,
+ XdWrite16 = 0x80,
///
/// Requets the target to XOR the sent data with the data on the medium and return the results
///
- XDWriteRead = 0x53,
+ XdWriteRead = 0x53,
///
/// Requests the target to XOR the data transferred with the data on the medium and writes it to the medium
/// SBC-1 rev. 8c
///
- XPWrite = 0x51,
+ XpWrite = 0x51,
#endregion SCSI Block Commands (SBC)
#region SCSI Streaming Commands (SSC)
@@ -2361,7 +2361,7 @@ namespace DiscImageChef.Devices
///
/// Requests the drive the status from the previous WriteCDP command.
///
- ReadCDP = 0xE4,
+ ReadCdp = 0xE4,
///
/// Requests status from the drive
///
@@ -2443,200 +2443,200 @@ namespace DiscImageChef.Devices
/// Verifies that the device can be accessed
/// Sega SPI ver. 1.30
///
- Sega_TestUnit = TestUnitReady,
+ SegaTestUnit = TestUnitReady,
///
/// Gets current CD status
/// Sega SPI ver. 1.30
///
- Sega_RequestStatus = 0x10,
+ SegaRequestStatus = 0x10,
///
/// Gets CD block mode info
/// Sega SPI ver. 1.30
///
- Sega_RequestMode = 0x11,
+ SegaRequestMode = 0x11,
///
/// Sets CD block mode
/// Sega SPI ver. 1.30
///
- Sega_SetMode = 0x12,
+ SegaSetMode = 0x12,
///
/// Requests device error info
/// Sega SPI ver. 1.30
///
- Sega_RequestError = 0x13,
+ SegaRequestError = 0x13,
///
/// Gets disc TOC
/// Sega SPI ver. 1.30
///
- Sega_GetToc = 0x14,
+ SegaGetToc = 0x14,
///
/// Gets specified session data
/// Sega SPI ver. 1.30
///
- Sega_RequestSession = 0x15,
+ SegaRequestSession = 0x15,
///
/// Stops the drive and opens the drive tray, or, on manual trays, stays busy until it is opened
/// Sega SPI ver. 1.30
///
- Sega_OpenTray = 0x16,
+ SegaOpenTray = 0x16,
///
/// Starts audio playback
/// Sega SPI ver. 1.30
///
- Sega_PlayCd = 0x20,
+ SegaPlayCd = 0x20,
///
/// Moves drive pickup to specified block
/// Sega SPI ver. 1.30
///
- Sega_Seek = 0x21,
+ SegaSeek = 0x21,
///
/// Fast-forwards or fast-reverses until Lead-In or Lead-Out arrive, or until another command is issued
/// Sega SPI ver. 1.30
///
- Sega_Scan = 0x22,
+ SegaScan = 0x22,
///
/// Reads blocks from the disc
/// Sega SPI ver. 1.30
///
- Sega_Read = 0x30,
+ SegaRead = 0x30,
///
/// Reads blocks from the disc seeking to another position at end
/// Sega SPI ver. 1.30
///
- Sega_Read2 = 0x31,
+ SegaRead2 = 0x31,
///
/// Reads disc subcode
/// Sega SPI ver. 1.30
///
- Sega_GetSubcode = 0x40,
+ SegaGetSubcode = 0x40,
#endregion SEGA Packet Interface (all are 12-byte CDB)
///
/// Variable sized Command Description Block
/// SPC-4 rev. 16
///
- VariableSizedCDB = 0x7F,
+ VariableSizedCdb = 0x7F,
#region Plextor vendor commands
///
/// Sends extended commands (like SpeedRead) to Plextor drives
///
- Plextor_Extend = 0xE9,
+ PlextorExtend = 0xE9,
///
/// Command for Plextor PoweRec
///
- Plextor_PoweRec = 0xEB,
+ PlextorPoweRec = 0xEB,
///
/// Sends extended commands (like PoweRec) to Plextor drives
///
- Plextor_Extend2 = 0xED,
+ PlextorExtend2 = 0xED,
///
/// Resets Plextor drives
///
- Plextor_Reset = 0xEE,
+ PlextorReset = 0xEE,
///
/// Reads drive statistics from Plextor drives EEPROM
///
- Plextor_ReadEeprom = 0xF1,
+ PlextorReadEeprom = 0xF1,
#endregion Plextor vendor commands
#region HL-DT-ST vendor commands
///
/// Sends debugging commands to HL-DT-ST DVD drives
///
- HlDtSt_Vendor = 0xE7,
+ HlDtStVendor = 0xE7,
#endregion HL-DT-ST vendor commands
#region NEC vendor commands
///
/// Reads CD-DA data
///
- NEC_ReadCdDa = 0xD4,
+ NecReadCdDa = 0xD4,
#endregion NEC vendor commands
#region Adaptec vendor commands
///
/// Translates a SCSI LBA to a drive's CHS
///
- Adaptec_Translate = 0x0F,
+ AdaptecTranslate = 0x0F,
///
/// Configures Adaptec controller error threshold
///
- Adaptec_SetErrorThreshold = 0x10,
+ AdaptecSetErrorThreshold = 0x10,
///
/// Reads and resets error and statistical counters
///
- Adaptec_ReadCounters = 0x11,
+ AdaptecReadCounters = 0x11,
///
/// Writes to controller's RAM
///
- Adaptec_WriteBuffer = 0x13,
+ AdaptecWriteBuffer = 0x13,
///
/// Reads controller's RAM
///
- Adaptec_ReadBuffer = 0x14,
+ AdaptecReadBuffer = 0x14,
#endregion Adaptec vendor commands
#region Archive Corp. vendor commands
///
/// Gets current position's block address
///
- Archive_RequestBlockAddress = 0x02,
+ ArchiveRequestBlockAddress = 0x02,
///
/// Seeks to specified block address
///
- Archive_SeekBlock = 0x0C,
+ ArchiveSeekBlock = 0x0C,
#endregion Archive Corp. vendor commands
#region Certance vendor commands
///
/// Parks the load arm in preparation for transport
///
- Certance_ParkUnpark = 0x06,
+ CertanceParkUnpark = 0x06,
#endregion Certance vendor commands
#region Fujitsu vendor commands
///
/// Used to check the controller's data and control path
///
- Fujitsu_LoopWriteToRead = 0xC1,
+ FujitsuLoopWriteToRead = 0xC1,
///
/// Used to display a message on the operator panel
///
- Fujitsu_Display = 0xCF,
+ FujitsuDisplay = 0xCF,
#endregion Fujitsu vendor commands
#region M-Systems vendor commands
///
/// Securely erases all flash blocks, including defective, spared and unused
///
- MSystems_SecurityErase = 0xFF,
+ MSystemsSecurityErase = 0xFF,
///
/// Securely erases all flash blocks, including defective, spared and unused
///
- MSystems_SecurityEraseOld = 0xDF,
+ MSystemsSecurityEraseOld = 0xDF,
#endregion M-Systems vendor commands
#region Plasmon vendor commands
///
/// Retrieves sector address
///
- Plasmon_ReadSectorLocation = 0xE6,
+ PlasmonReadSectorLocation = 0xE6,
///
/// Makes a Compliant WORM block completely unreadable
///
- Plasmon_Shred = 0xEE,
+ PlasmonShred = 0xEE,
#endregion Plasmon vendor commands
#region Kreon vendor commands
///
/// Most Kreon commands start with this
///
- Kreon_Command = 0xFF,
+ KreonCommand = 0xFF,
///
/// Kreon extract Security Sectors command start with this
///
- Kreon_SS_Command = 0xAD
+ KreonSsCommand = 0xAD
#endregion Kreon vendor commands
}
#endregion SCSI Commands
@@ -2718,7 +2718,7 @@ namespace DiscImageChef.Devices
///
/// Unknown Serial ATA
///
- FPDma = 12,
+ FpDma = 12,
///
/// Requests the Extended ATA Status Return Descriptor
///
@@ -2746,14 +2746,14 @@ namespace DiscImageChef.Devices
///
/// The STPSIU contains the data length
///
- SPTSIU = 3
+ Sptsiu = 3
}
#endregion SCSI's ATA Command Pass-Through
///
/// ZBC sub-commands, mask 0x1F
///
- public enum ZBCSubCommands : byte
+ public enum ZbcSubCommands : byte
{
///
/// Returns list with zones of specified types
@@ -2842,11 +2842,11 @@ namespace DiscImageChef.Devices
///
/// Disc Structures for DVD and HD DVD
///
- DVD = 0x00,
+ Dvd = 0x00,
///
/// Disc Structures for BD
///
- BD = 0x01
+ Bd = 0x01
}
public enum MmcDiscStructureFormat : byte
@@ -2856,31 +2856,31 @@ namespace DiscImageChef.Devices
///
/// AACS Volume Identifier
///
- AACSVolId = 0x80,
+ AacsVolId = 0x80,
///
/// AACS Pre-recorded Media Serial Number
///
- AACSMediaSerial = 0x81,
+ AacsMediaSerial = 0x81,
///
/// AACS Media Identifier
///
- AACSMediaId = 0x82,
+ AacsMediaId = 0x82,
///
/// AACS Lead-in Media Key Block
///
- AACSMKB = 0x83,
+ Aacsmkb = 0x83,
///
/// AACS Data Keys
///
- AACSDataKeys = 0x84,
+ AacsDataKeys = 0x84,
///
/// AACS LBA extents
///
- AACSLBAExtents = 0x85,
+ AacslbaExtents = 0x85,
///
/// CPRM Media Key Block specified by AACS
///
- AACSMKBCPRM = 0x86,
+ Aacsmkbcprm = 0x86,
///
/// Recognized format layers
///
@@ -2930,27 +2930,27 @@ namespace DiscImageChef.Devices
///
/// DDS from DVD-RAM
///
- DVDRAM_DDS = 0x08,
+ DvdramDds = 0x08,
///
/// DVD-RAM Medium Status
///
- DVDRAM_MediumStatus = 0x09,
+ DvdramMediumStatus = 0x09,
///
/// DVD-RAM Spare Area Information
///
- DVDRAM_SpareAreaInformation = 0x0A,
+ DvdramSpareAreaInformation = 0x0A,
///
/// DVD-RAM Recording Type Information
///
- DVDRAM_RecordingType = 0x0B,
+ DvdramRecordingType = 0x0B,
///
/// DVD-R/-RW RMD in last Border-out
///
- LastBorderOutRMD = 0x0C,
+ LastBorderOutRmd = 0x0C,
///
/// Specified RMD from last recorded Border-out
///
- SpecifiedRMD = 0x0D,
+ SpecifiedRmd = 0x0D,
///
/// DVD-R/-RW Lead-in pre-recorded information
///
@@ -2958,35 +2958,35 @@ namespace DiscImageChef.Devices
///
/// DVD-R/-RW Media Identifier
///
- DVDR_MediaIdentifier = 0x0F,
+ DvdrMediaIdentifier = 0x0F,
///
/// DVD-R/-RW Physical Format Information
///
- DVDR_PhysicalInformation = 0x10,
+ DvdrPhysicalInformation = 0x10,
///
/// ADIP
///
- ADIP = 0x11,
+ Adip = 0x11,
///
/// HD DVD Lead-in Copyright Protection Information
///
- HDDVD_CopyrightInformation = 0x12,
+ HddvdCopyrightInformation = 0x12,
///
/// AACS Lead-in Copyright Data Section
///
- DVD_AACS = 0x15,
+ DvdAacs = 0x15,
///
/// HD DVD-R Medium Status
///
- HDDVDR_MediumStatus = 0x19,
+ HddvdrMediumStatus = 0x19,
///
/// HD DVD-R Last recorded RMD in the latest RMZ
///
- HDDVDR_LastRMD = 0x1A,
+ HddvdrLastRmd = 0x1A,
///
/// DVD+/-R DL and DVD-Download DL layer capacity
///
- DVDR_LayerCapacity = 0x20,
+ DvdrLayerCapacity = 0x20,
///
/// DVD-R DL Middle Zone start address
///
@@ -2998,7 +2998,7 @@ namespace DiscImageChef.Devices
///
/// DVD-R DL Start LBA of the manual layer jump
///
- ManualLayerJumpStartLBA = 0x23,
+ ManualLayerJumpStartLba = 0x23,
///
/// DVD-R DL Remapping information of the specified Anchor Point
///
@@ -3006,7 +3006,7 @@ namespace DiscImageChef.Devices
///
/// Disc Control Block
///
- DCB = 0x30,
+ Dcb = 0x30,
// BD Disc Structures
///
@@ -3016,11 +3016,11 @@ namespace DiscImageChef.Devices
///
/// Blu-ray Burst Cutting Area
///
- BD_BurstCuttingArea = 0x03,
+ BdBurstCuttingArea = 0x03,
///
/// Blu-ray DDS
///
- BD_DDS = 0x08,
+ BdDds = 0x08,
///
/// Blu-ray Cartridge Status
///
@@ -3028,15 +3028,15 @@ namespace DiscImageChef.Devices
///
/// Blu-ray Spare Area Information
///
- BD_SpareAreaInformation = 0x0A,
+ BdSpareAreaInformation = 0x0A,
///
/// Unmodified DFL
///
- RawDFL = 0x12,
+ RawDfl = 0x12,
///
/// Physical Access Control
///
- PAC = 0x30
+ Pac = 0x30
}
public enum ScsiServiceActions : byte
@@ -3047,7 +3047,7 @@ namespace DiscImageChef.Devices
/// Requests parameter data describing provisioning status for the specified LBA
/// SBC-3 rev. 25
///
- GetLBAStatus = 0x12,
+ GetLbaStatus = 0x12,
///
/// Gets device capacity
/// SBC-2 rev. 4
@@ -3086,7 +3086,7 @@ namespace DiscImageChef.Devices
///
/// POW Resources Information
///
- POWResources = 0x02
+ PowResources = 0x02
}
public enum MmcSectorTypes : byte
@@ -3098,7 +3098,7 @@ namespace DiscImageChef.Devices
///
/// Only CD-DA sectors shall be returned
///
- CDDA = 0x01,
+ Cdda = 0x01,
///
/// Only Mode 1 sectors shall be returned
///
@@ -3170,7 +3170,7 @@ namespace DiscImageChef.Devices
///
/// De-interleaved and error-corrected R to W subchannel data shall be transferred
///
- RW = 0x04
+ Rw = 0x04
}
public enum PioneerSubchannel : byte
@@ -3272,7 +3272,7 @@ namespace DiscImageChef.Devices
///
/// Book setting for DVD+R DL
///
- BitSetRDL = 0x0E,
+ BitSetRdl = 0x0E,
///
/// Plextor SpeedRead
///
@@ -3439,7 +3439,7 @@ namespace DiscImageChef.Devices
///
/// Asks device to send their CID numbers (BCR, R2)
///
- AllSendCID = 2,
+ AllSendCid = 2,
///
/// Assigns a relative address to the device (AC, R1)
///
@@ -3447,7 +3447,7 @@ namespace DiscImageChef.Devices
///
/// Programs the DSR of the device (BC)
///
- SetDSR = 4,
+ SetDsr = 4,
///
/// Toggles the device between sleep and standby (AC, R1b)
///
@@ -3463,15 +3463,15 @@ namespace DiscImageChef.Devices
///
/// Asks device to send its extended card-specific data (ExtCSD) (ADTC, R1)
///
- SendExtCSD = 8,
+ SendExtCsd = 8,
///
/// Asks device to send its card-specific data (CSD) (AC, R2)
///
- SendCSD = 9,
+ SendCsd = 9,
///
/// Asks device to send its card identification (CID) (AC, R2)
///
- SendCID = 10,
+ SendCid = 10,
///
/// Reads data stream from device, starting at given address, until a follows (ADTC, R1)
///
@@ -3496,8 +3496,8 @@ namespace DiscImageChef.Devices
/// The host sends the bus testing data pattern to a device (ADTC, R1)
///
BusTestWrite = 19,
- SPIReadOCR = 58,
- SPICRCOnOff = 59,
+ SpiReadOcr = 58,
+ SpicrcOnOff = 59,
#endregion Class 1 MMC Commands (Basic and read-stream)
#region Class 2 MMC Commands (Block-oriented read)
@@ -3516,7 +3516,7 @@ namespace DiscImageChef.Devices
///
/// 128 blocks of tuning pattern is sent for HS200 optimal sampling point detection (ADTC, R1)
///
- SendTuningBlockHS200 = 21,
+ SendTuningBlockHs200 = 21,
#endregion Class 2 MMC Commands (Block-oriented read)
#region Class 3 MMC Commands (Stream write)
@@ -3542,11 +3542,11 @@ namespace DiscImageChef.Devices
///
/// Programs the Card Information register (ADTC, R1)
///
- ProgramCID = 26,
+ ProgramCid = 26,
///
/// Programs the programmable bits of the CSD (ADTC, R1)
///
- ProgramCSD = 27,
+ ProgramCsd = 27,
///
/// Sets the real time clock according to information in block (ADTC, R1)
///
@@ -3609,11 +3609,11 @@ namespace DiscImageChef.Devices
///
/// Used to write and read 8 bit data field, used to access application dependent registers not defined in MMC standard (AC, R4)
///
- FastIO = 39,
+ FastIo = 39,
///
/// Sets the system into interrupt mode (BCR, R5)
///
- GoIRQState = 40,
+ GoIrqState = 40,
#endregion Class 9 MMC Commands (I/O mode)
#region Class 10 MMC Commands (Security Protocols)
@@ -3724,7 +3724,7 @@ namespace DiscImageChef.Devices
///
/// Reads the SD Configuration Register SCR (ADTC, R1)
///
- SendSCR = 51,
+ SendScr = 51,
}
[Flags]
@@ -3736,30 +3736,30 @@ namespace DiscImageChef.Devices
ResponseBusy = 1 << 3,
ResponseOpcode = 1 << 4,
CommandMask = 3 << 5,
- CommandAC = 0 << 5,
- CommandADTC = 1 << 5,
- CommandBC = 2 << 5,
- CommandBCR = 3 << 5,
- ResponseSPI_S1 = 1 << 7,
- ResponseSPI_S2 = 1 << 8,
- ResponseSPI_B4 = 1 << 9,
- ResponseSPI_Busy = 1 << 10,
+ CommandAc = 0 << 5,
+ CommandAdtc = 1 << 5,
+ CommandBc = 2 << 5,
+ CommandBcr = 3 << 5,
+ ResponseSpiS1 = 1 << 7,
+ ResponseSpiS2 = 1 << 8,
+ ResponseSpiB4 = 1 << 9,
+ ResponseSpiBusy = 1 << 10,
ResponseNone = 0,
- Response_R1 = ResponsePresent | ResponseCrc | ResponseOpcode,
- Response_R1b = ResponsePresent | ResponseCrc | ResponseOpcode | ResponseBusy,
- Response_R2 = ResponsePresent | Response136 | ResponseCrc,
- Response_R3 = ResponsePresent,
- Response_R4 = ResponsePresent,
- Response_R5 = ResponsePresent | ResponseCrc | ResponseOpcode,
- Response_R6 = ResponsePresent | ResponseCrc | ResponseOpcode,
- Response_R7 = ResponsePresent | ResponseCrc | ResponseOpcode,
- ResponseSPI_R1 = ResponseSPI_S1,
- ResponseSPI_R1b = ResponseSPI_S1 | ResponseSPI_Busy,
- ResponseSPI_R2 = ResponseSPI_S1 | ResponseSPI_S2,
- ResponseSPI_R3 = ResponseSPI_S1 | ResponseSPI_B4,
- ResponseSPI_R4 = ResponseSPI_S1 | ResponseSPI_B4,
- ResponseSPI_R5 = ResponseSPI_S1 | ResponseSPI_S2,
- ResponseSPI_R7 = ResponseSPI_S1 | ResponseSPI_B4
+ ResponseR1 = ResponsePresent | ResponseCrc | ResponseOpcode,
+ ResponseR1B = ResponsePresent | ResponseCrc | ResponseOpcode | ResponseBusy,
+ ResponseR2 = ResponsePresent | Response136 | ResponseCrc,
+ ResponseR3 = ResponsePresent,
+ ResponseR4 = ResponsePresent,
+ ResponseR5 = ResponsePresent | ResponseCrc | ResponseOpcode,
+ ResponseR6 = ResponsePresent | ResponseCrc | ResponseOpcode,
+ ResponseR7 = ResponsePresent | ResponseCrc | ResponseOpcode,
+ ResponseSpiR1 = ResponseSpiS1,
+ ResponseSpiR1B = ResponseSpiS1 | ResponseSpiBusy,
+ ResponseSpiR2 = ResponseSpiS1 | ResponseSpiS2,
+ ResponseSpiR3 = ResponseSpiS1 | ResponseSpiB4,
+ ResponseSpiR4 = ResponseSpiS1 | ResponseSpiB4,
+ ResponseSpiR5 = ResponseSpiS1 | ResponseSpiS2,
+ ResponseSpiR7 = ResponseSpiS1 | ResponseSpiB4
}
[Flags]
@@ -3776,7 +3776,7 @@ namespace DiscImageChef.Devices
///
/// Drive can read and decrypt the SS from Xbox 360 discs
///
- DecryptSS360,
+ DecryptSs360,
///
/// Drive has full challenge response capabilities with Xbox 360 discs
///
@@ -3792,7 +3792,7 @@ namespace DiscImageChef.Devices
///
/// Drive can read and decrypt the SS from Xbox discs
///
- DecryptSS,
+ DecryptSs,
///
/// Drive has full challenge response capabilities with Xbox discs
///
diff --git a/DiscImageChef.Devices/FreeBSD/Command.cs b/DiscImageChef.Devices/FreeBSD/Command.cs
index 9f6fe3d16..3b55be0cb 100644
--- a/DiscImageChef.Devices/FreeBSD/Command.cs
+++ b/DiscImageChef.Devices/FreeBSD/Command.cs
@@ -56,7 +56,7 @@ namespace DiscImageChef.Devices.FreeBSD
/// Time it took to execute the command in milliseconds
/// True if SCSI error returned non-OK status and contains SCSI sense
internal static int SendScsiCommand64(IntPtr dev, byte[] cdb, ref byte[] buffer, out byte[] senseBuffer,
- uint timeout, ccb_flags direction, out double duration, out bool sense)
+ uint timeout, CcbFlags direction, out double duration, out bool sense)
{
senseBuffer = null;
duration = 0;
@@ -73,8 +73,8 @@ namespace DiscImageChef.Devices.FreeBSD
return Marshal.GetLastWin32Error();
}
- ccb_scsiio64 csio = (ccb_scsiio64)Marshal.PtrToStructure(ccbPtr, typeof(ccb_scsiio64));
- csio.ccb_h.func_code = xpt_opcode.XPT_SCSI_IO;
+ CcbScsiio64 csio = (CcbScsiio64)Marshal.PtrToStructure(ccbPtr, typeof(CcbScsiio64));
+ csio.ccb_h.func_code = XptOpcode.XptScsiIo;
csio.ccb_h.flags = direction;
csio.ccb_h.xflags = 0;
csio.ccb_h.retry_count = 1;
@@ -93,9 +93,9 @@ namespace DiscImageChef.Devices.FreeBSD
cdbPtr = Marshal.AllocHGlobal(cdb.Length);
byte[] cdbPtrBytes = BitConverter.GetBytes(cdbPtr.ToInt64());
Array.Copy(cdbPtrBytes, 0, csio.cdb_bytes, 0, IntPtr.Size);
- csio.ccb_h.flags |= ccb_flags.CAM_CDB_POINTER;
+ csio.ccb_h.flags |= CcbFlags.CamCdbPointer;
}
- csio.ccb_h.flags |= ccb_flags.CAM_DEV_QFRZDIS;
+ csio.ccb_h.flags |= CcbFlags.CamDevQfrzdis;
Marshal.Copy(buffer, 0, csio.data_ptr, buffer.Length);
Marshal.StructureToPtr(csio, ccbPtr, false);
@@ -106,28 +106,28 @@ namespace DiscImageChef.Devices.FreeBSD
if(error < 0) error = Marshal.GetLastWin32Error();
- csio = (ccb_scsiio64)Marshal.PtrToStructure(ccbPtr, typeof(ccb_scsiio64));
+ csio = (CcbScsiio64)Marshal.PtrToStructure(ccbPtr, typeof(CcbScsiio64));
- if((csio.ccb_h.status & cam_status.CAM_STATUS_MASK) != cam_status.CAM_REQ_CMP &&
- (csio.ccb_h.status & cam_status.CAM_STATUS_MASK) != cam_status.CAM_SCSI_STATUS_ERROR)
+ if((csio.ccb_h.status & CamStatus.CamStatusMask) != CamStatus.CamReqCmp &&
+ (csio.ccb_h.status & CamStatus.CamStatusMask) != CamStatus.CamScsiStatusError)
{
error = Marshal.GetLastWin32Error();
DicConsole.DebugWriteLine("FreeBSD devices", "CAM status {0} error {1}", csio.ccb_h.status, error);
sense = true;
}
- if((csio.ccb_h.status & cam_status.CAM_STATUS_MASK) == cam_status.CAM_SCSI_STATUS_ERROR)
+ if((csio.ccb_h.status & CamStatus.CamStatusMask) == CamStatus.CamScsiStatusError)
{
sense = true;
senseBuffer = new byte[1];
senseBuffer[0] = csio.scsi_status;
}
- if((csio.ccb_h.status & cam_status.CAM_AUTOSNS_VALID) != 0)
+ if((csio.ccb_h.status & CamStatus.CamAutosnsValid) != 0)
{
if(csio.sense_len - csio.sense_resid > 0)
{
- sense = (csio.ccb_h.status & cam_status.CAM_STATUS_MASK) == cam_status.CAM_SCSI_STATUS_ERROR;
+ sense = (csio.ccb_h.status & CamStatus.CamStatusMask) == CamStatus.CamScsiStatusError;
senseBuffer = new byte[csio.sense_len - csio.sense_resid];
senseBuffer[0] = csio.sense_data.error_code;
Array.Copy(csio.sense_data.sense_buf, 0, senseBuffer, 1, senseBuffer.Length - 1);
@@ -138,12 +138,12 @@ namespace DiscImageChef.Devices.FreeBSD
cdb = new byte[csio.cdb_len];
Marshal.Copy(csio.data_ptr, buffer, 0, buffer.Length);
- if(csio.ccb_h.flags.HasFlag(ccb_flags.CAM_CDB_POINTER))
+ if(csio.ccb_h.flags.HasFlag(CcbFlags.CamCdbPointer))
Marshal.Copy(new IntPtr(BitConverter.ToInt64(csio.cdb_bytes, 0)), cdb, 0, cdb.Length);
else Array.Copy(csio.cdb_bytes, 0, cdb, 0, cdb.Length);
duration = (end - start).TotalMilliseconds;
- if(csio.ccb_h.flags.HasFlag(ccb_flags.CAM_CDB_POINTER)) Marshal.FreeHGlobal(cdbPtr);
+ if(csio.ccb_h.flags.HasFlag(CcbFlags.CamCdbPointer)) Marshal.FreeHGlobal(cdbPtr);
Marshal.FreeHGlobal(csio.data_ptr);
cam_freeccb(ccbPtr);
@@ -163,7 +163,7 @@ namespace DiscImageChef.Devices.FreeBSD
/// Time it took to execute the command in milliseconds
/// True if SCSI error returned non-OK status and contains SCSI sense
internal static int SendScsiCommand(IntPtr dev, byte[] cdb, ref byte[] buffer, out byte[] senseBuffer,
- uint timeout, ccb_flags direction, out double duration, out bool sense)
+ uint timeout, CcbFlags direction, out double duration, out bool sense)
{
senseBuffer = null;
duration = 0;
@@ -180,8 +180,8 @@ namespace DiscImageChef.Devices.FreeBSD
return Marshal.GetLastWin32Error();
}
- ccb_scsiio csio = (ccb_scsiio)Marshal.PtrToStructure(ccbPtr, typeof(ccb_scsiio));
- csio.ccb_h.func_code = xpt_opcode.XPT_SCSI_IO;
+ CcbScsiio csio = (CcbScsiio)Marshal.PtrToStructure(ccbPtr, typeof(CcbScsiio));
+ csio.ccb_h.func_code = XptOpcode.XptScsiIo;
csio.ccb_h.flags = direction;
csio.ccb_h.xflags = 0;
csio.ccb_h.retry_count = 1;
@@ -200,9 +200,9 @@ namespace DiscImageChef.Devices.FreeBSD
cdbPtr = Marshal.AllocHGlobal(cdb.Length);
byte[] cdbPtrBytes = BitConverter.GetBytes(cdbPtr.ToInt32());
Array.Copy(cdbPtrBytes, 0, csio.cdb_bytes, 0, IntPtr.Size);
- csio.ccb_h.flags |= ccb_flags.CAM_CDB_POINTER;
+ csio.ccb_h.flags |= CcbFlags.CamCdbPointer;
}
- csio.ccb_h.flags |= ccb_flags.CAM_DEV_QFRZDIS;
+ csio.ccb_h.flags |= CcbFlags.CamDevQfrzdis;
Marshal.Copy(buffer, 0, csio.data_ptr, buffer.Length);
Marshal.StructureToPtr(csio, ccbPtr, false);
@@ -213,28 +213,28 @@ namespace DiscImageChef.Devices.FreeBSD
if(error < 0) error = Marshal.GetLastWin32Error();
- csio = (ccb_scsiio)Marshal.PtrToStructure(ccbPtr, typeof(ccb_scsiio));
+ csio = (CcbScsiio)Marshal.PtrToStructure(ccbPtr, typeof(CcbScsiio));
- if((csio.ccb_h.status & cam_status.CAM_STATUS_MASK) != cam_status.CAM_REQ_CMP &&
- (csio.ccb_h.status & cam_status.CAM_STATUS_MASK) != cam_status.CAM_SCSI_STATUS_ERROR)
+ if((csio.ccb_h.status & CamStatus.CamStatusMask) != CamStatus.CamReqCmp &&
+ (csio.ccb_h.status & CamStatus.CamStatusMask) != CamStatus.CamScsiStatusError)
{
error = Marshal.GetLastWin32Error();
DicConsole.DebugWriteLine("FreeBSD devices", "CAM status {0} error {1}", csio.ccb_h.status, error);
sense = true;
}
- if((csio.ccb_h.status & cam_status.CAM_STATUS_MASK) == cam_status.CAM_SCSI_STATUS_ERROR)
+ if((csio.ccb_h.status & CamStatus.CamStatusMask) == CamStatus.CamScsiStatusError)
{
sense = true;
senseBuffer = new byte[1];
senseBuffer[0] = csio.scsi_status;
}
- if((csio.ccb_h.status & cam_status.CAM_AUTOSNS_VALID) != 0)
+ if((csio.ccb_h.status & CamStatus.CamAutosnsValid) != 0)
{
if(csio.sense_len - csio.sense_resid > 0)
{
- sense = (csio.ccb_h.status & cam_status.CAM_STATUS_MASK) == cam_status.CAM_SCSI_STATUS_ERROR;
+ sense = (csio.ccb_h.status & CamStatus.CamStatusMask) == CamStatus.CamScsiStatusError;
senseBuffer = new byte[csio.sense_len - csio.sense_resid];
senseBuffer[0] = csio.sense_data.error_code;
Array.Copy(csio.sense_data.sense_buf, 0, senseBuffer, 1, senseBuffer.Length - 1);
@@ -245,19 +245,19 @@ namespace DiscImageChef.Devices.FreeBSD
cdb = new byte[csio.cdb_len];
Marshal.Copy(csio.data_ptr, buffer, 0, buffer.Length);
- if(csio.ccb_h.flags.HasFlag(ccb_flags.CAM_CDB_POINTER))
+ if(csio.ccb_h.flags.HasFlag(CcbFlags.CamCdbPointer))
Marshal.Copy(new IntPtr(BitConverter.ToInt32(csio.cdb_bytes, 0)), cdb, 0, cdb.Length);
else Array.Copy(csio.cdb_bytes, 0, cdb, 0, cdb.Length);
duration = (end - start).TotalMilliseconds;
- if(csio.ccb_h.flags.HasFlag(ccb_flags.CAM_CDB_POINTER)) Marshal.FreeHGlobal(cdbPtr);
+ if(csio.ccb_h.flags.HasFlag(CcbFlags.CamCdbPointer)) Marshal.FreeHGlobal(cdbPtr);
Marshal.FreeHGlobal(csio.data_ptr);
cam_freeccb(ccbPtr);
return error;
}
- static ccb_flags AtaProtocolToCamFlags(AtaProtocol protocol)
+ static CcbFlags AtaProtocolToCamFlags(AtaProtocol protocol)
{
switch(protocol)
{
@@ -266,12 +266,12 @@ namespace DiscImageChef.Devices.FreeBSD
case AtaProtocol.HardReset:
case AtaProtocol.NonData:
case AtaProtocol.SoftReset:
- case AtaProtocol.ReturnResponse: return ccb_flags.CAM_DIR_NONE;
+ case AtaProtocol.ReturnResponse: return CcbFlags.CamDirNone;
case AtaProtocol.PioIn:
- case AtaProtocol.UDmaIn: return ccb_flags.CAM_DIR_IN;
+ case AtaProtocol.UDmaIn: return CcbFlags.CamDirIn;
case AtaProtocol.PioOut:
- case AtaProtocol.UDmaOut: return ccb_flags.CAM_DIR_OUT;
- default: return ccb_flags.CAM_DIR_NONE;
+ case AtaProtocol.UDmaOut: return CcbFlags.CamDirOut;
+ default: return CcbFlags.CamDirNone;
}
}
@@ -287,8 +287,8 @@ namespace DiscImageChef.Devices.FreeBSD
IntPtr ccbPtr = cam_getccb(dev);
- ccb_ataio ataio = (ccb_ataio)Marshal.PtrToStructure(ccbPtr, typeof(ccb_ataio));
- ataio.ccb_h.func_code = xpt_opcode.XPT_ATA_IO;
+ CcbAtaio ataio = (CcbAtaio)Marshal.PtrToStructure(ccbPtr, typeof(CcbAtaio));
+ ataio.ccb_h.func_code = XptOpcode.XptAtaIo;
ataio.ccb_h.flags = AtaProtocolToCamFlags(protocol);
ataio.ccb_h.xflags = 0;
ataio.ccb_h.retry_count = 1;
@@ -296,7 +296,7 @@ namespace DiscImageChef.Devices.FreeBSD
ataio.ccb_h.timeout = timeout;
ataio.data_ptr = Marshal.AllocHGlobal(buffer.Length);
ataio.dxfer_len = (uint)buffer.Length;
- ataio.ccb_h.flags |= ccb_flags.CAM_DEV_QFRZDIS;
+ ataio.ccb_h.flags |= CcbFlags.CamDevQfrzdis;
ataio.cmd.flags = CamAtaIoFlags.NeedResult;
switch(protocol)
{
@@ -304,10 +304,10 @@ namespace DiscImageChef.Devices.FreeBSD
case AtaProtocol.DmaQueued:
case AtaProtocol.UDmaIn:
case AtaProtocol.UDmaOut:
- ataio.cmd.flags |= CamAtaIoFlags.DMA;
+ ataio.cmd.flags |= CamAtaIoFlags.Dma;
break;
- case AtaProtocol.FPDma:
- ataio.cmd.flags |= CamAtaIoFlags.FPDMA;
+ case AtaProtocol.FpDma:
+ ataio.cmd.flags |= CamAtaIoFlags.Fpdma;
break;
}
@@ -328,17 +328,17 @@ namespace DiscImageChef.Devices.FreeBSD
if(error < 0) error = Marshal.GetLastWin32Error();
- ataio = (ccb_ataio)Marshal.PtrToStructure(ccbPtr, typeof(ccb_ataio));
+ ataio = (CcbAtaio)Marshal.PtrToStructure(ccbPtr, typeof(CcbAtaio));
- if((ataio.ccb_h.status & cam_status.CAM_STATUS_MASK) != cam_status.CAM_REQ_CMP &&
- (ataio.ccb_h.status & cam_status.CAM_STATUS_MASK) != cam_status.CAM_SCSI_STATUS_ERROR)
+ if((ataio.ccb_h.status & CamStatus.CamStatusMask) != CamStatus.CamReqCmp &&
+ (ataio.ccb_h.status & CamStatus.CamStatusMask) != CamStatus.CamScsiStatusError)
{
error = Marshal.GetLastWin32Error();
DicConsole.DebugWriteLine("FreeBSD devices", "CAM status {0} error {1}", ataio.ccb_h.status, error);
sense = true;
}
- if((ataio.ccb_h.status & cam_status.CAM_STATUS_MASK) == cam_status.CAM_ATA_STATUS_ERROR) sense = true;
+ if((ataio.ccb_h.status & CamStatus.CamStatusMask) == CamStatus.CamAtaStatusError) sense = true;
errorRegisters.cylinderHigh = ataio.res.lba_high;
errorRegisters.cylinderLow = ataio.res.lba_mid;
@@ -373,8 +373,8 @@ namespace DiscImageChef.Devices.FreeBSD
IntPtr ccbPtr = cam_getccb(dev);
- ccb_ataio ataio = (ccb_ataio)Marshal.PtrToStructure(ccbPtr, typeof(ccb_ataio));
- ataio.ccb_h.func_code = xpt_opcode.XPT_ATA_IO;
+ CcbAtaio ataio = (CcbAtaio)Marshal.PtrToStructure(ccbPtr, typeof(CcbAtaio));
+ ataio.ccb_h.func_code = XptOpcode.XptAtaIo;
ataio.ccb_h.flags = AtaProtocolToCamFlags(protocol);
ataio.ccb_h.xflags = 0;
ataio.ccb_h.retry_count = 1;
@@ -382,7 +382,7 @@ namespace DiscImageChef.Devices.FreeBSD
ataio.ccb_h.timeout = timeout;
ataio.data_ptr = Marshal.AllocHGlobal(buffer.Length);
ataio.dxfer_len = (uint)buffer.Length;
- ataio.ccb_h.flags |= ccb_flags.CAM_DEV_QFRZDIS;
+ ataio.ccb_h.flags |= CcbFlags.CamDevQfrzdis;
ataio.cmd.flags = CamAtaIoFlags.NeedResult;
switch(protocol)
{
@@ -390,10 +390,10 @@ namespace DiscImageChef.Devices.FreeBSD
case AtaProtocol.DmaQueued:
case AtaProtocol.UDmaIn:
case AtaProtocol.UDmaOut:
- ataio.cmd.flags |= CamAtaIoFlags.DMA;
+ ataio.cmd.flags |= CamAtaIoFlags.Dma;
break;
- case AtaProtocol.FPDma:
- ataio.cmd.flags |= CamAtaIoFlags.FPDMA;
+ case AtaProtocol.FpDma:
+ ataio.cmd.flags |= CamAtaIoFlags.Fpdma;
break;
}
@@ -414,17 +414,17 @@ namespace DiscImageChef.Devices.FreeBSD
if(error < 0) error = Marshal.GetLastWin32Error();
- ataio = (ccb_ataio)Marshal.PtrToStructure(ccbPtr, typeof(ccb_ataio));
+ ataio = (CcbAtaio)Marshal.PtrToStructure(ccbPtr, typeof(CcbAtaio));
- if((ataio.ccb_h.status & cam_status.CAM_STATUS_MASK) != cam_status.CAM_REQ_CMP &&
- (ataio.ccb_h.status & cam_status.CAM_STATUS_MASK) != cam_status.CAM_SCSI_STATUS_ERROR)
+ if((ataio.ccb_h.status & CamStatus.CamStatusMask) != CamStatus.CamReqCmp &&
+ (ataio.ccb_h.status & CamStatus.CamStatusMask) != CamStatus.CamScsiStatusError)
{
error = Marshal.GetLastWin32Error();
DicConsole.DebugWriteLine("FreeBSD devices", "CAM status {0} error {1}", ataio.ccb_h.status, error);
sense = true;
}
- if((ataio.ccb_h.status & cam_status.CAM_STATUS_MASK) == cam_status.CAM_ATA_STATUS_ERROR) sense = true;
+ if((ataio.ccb_h.status & CamStatus.CamStatusMask) == CamStatus.CamAtaStatusError) sense = true;
errorRegisters.lbaHigh = ataio.res.lba_high;
errorRegisters.lbaMid = ataio.res.lba_mid;
@@ -463,8 +463,8 @@ namespace DiscImageChef.Devices.FreeBSD
IntPtr ccbPtr = cam_getccb(dev);
- ccb_ataio ataio = (ccb_ataio)Marshal.PtrToStructure(ccbPtr, typeof(ccb_ataio));
- ataio.ccb_h.func_code = xpt_opcode.XPT_ATA_IO;
+ CcbAtaio ataio = (CcbAtaio)Marshal.PtrToStructure(ccbPtr, typeof(CcbAtaio));
+ ataio.ccb_h.func_code = XptOpcode.XptAtaIo;
ataio.ccb_h.flags = AtaProtocolToCamFlags(protocol);
ataio.ccb_h.xflags = 0;
ataio.ccb_h.retry_count = 1;
@@ -472,7 +472,7 @@ namespace DiscImageChef.Devices.FreeBSD
ataio.ccb_h.timeout = timeout;
ataio.data_ptr = Marshal.AllocHGlobal(buffer.Length);
ataio.dxfer_len = (uint)buffer.Length;
- ataio.ccb_h.flags |= ccb_flags.CAM_DEV_QFRZDIS;
+ ataio.ccb_h.flags |= CcbFlags.CamDevQfrzdis;
ataio.cmd.flags = CamAtaIoFlags.NeedResult | CamAtaIoFlags.ExtendedCommand;
switch(protocol)
{
@@ -480,10 +480,10 @@ namespace DiscImageChef.Devices.FreeBSD
case AtaProtocol.DmaQueued:
case AtaProtocol.UDmaIn:
case AtaProtocol.UDmaOut:
- ataio.cmd.flags |= CamAtaIoFlags.DMA;
+ ataio.cmd.flags |= CamAtaIoFlags.Dma;
break;
- case AtaProtocol.FPDma:
- ataio.cmd.flags |= CamAtaIoFlags.FPDMA;
+ case AtaProtocol.FpDma:
+ ataio.cmd.flags |= CamAtaIoFlags.Fpdma;
break;
}
@@ -509,17 +509,17 @@ namespace DiscImageChef.Devices.FreeBSD
if(error < 0) error = Marshal.GetLastWin32Error();
- ataio = (ccb_ataio)Marshal.PtrToStructure(ccbPtr, typeof(ccb_ataio));
+ ataio = (CcbAtaio)Marshal.PtrToStructure(ccbPtr, typeof(CcbAtaio));
- if((ataio.ccb_h.status & cam_status.CAM_STATUS_MASK) != cam_status.CAM_REQ_CMP &&
- (ataio.ccb_h.status & cam_status.CAM_STATUS_MASK) != cam_status.CAM_SCSI_STATUS_ERROR)
+ if((ataio.ccb_h.status & CamStatus.CamStatusMask) != CamStatus.CamReqCmp &&
+ (ataio.ccb_h.status & CamStatus.CamStatusMask) != CamStatus.CamScsiStatusError)
{
error = Marshal.GetLastWin32Error();
DicConsole.DebugWriteLine("FreeBSD devices", "CAM status {0} error {1}", ataio.ccb_h.status, error);
sense = true;
}
- if((ataio.ccb_h.status & cam_status.CAM_STATUS_MASK) == cam_status.CAM_ATA_STATUS_ERROR) sense = true;
+ if((ataio.ccb_h.status & CamStatus.CamStatusMask) == CamStatus.CamAtaStatusError) sense = true;
errorRegisters.sectorCount = (ushort)((ataio.res.sector_count_exp << 8) + ataio.res.sector_count);
errorRegisters.lbaLow = (ushort)((ataio.res.lba_low_exp << 8) + ataio.res.lba_low);
diff --git a/DiscImageChef.Devices/FreeBSD/Enums.cs b/DiscImageChef.Devices/FreeBSD/Enums.cs
index 581bce798..4303c28c7 100644
--- a/DiscImageChef.Devices/FreeBSD/Enums.cs
+++ b/DiscImageChef.Devices/FreeBSD/Enums.cs
@@ -93,7 +93,7 @@ namespace DiscImageChef.Devices.FreeBSD
///
/// O_NOCTTY
///
- NoControlTTY = 0x00008000,
+ NoControlTty = 0x00008000,
///
/// O_DIRECT
///
@@ -109,7 +109,7 @@ namespace DiscImageChef.Devices.FreeBSD
///
/// O_TTY_INIT
///
- InitializeTTY = 0x00080000,
+ InitializeTty = 0x00080000,
///
/// O_CLOEXEC
///
@@ -126,7 +126,7 @@ namespace DiscImageChef.Devices.FreeBSD
///
/// FPDMA command
///
- FPDMA = 0x02,
+ Fpdma = 0x02,
///
/// Control, not a command
///
@@ -138,595 +138,595 @@ namespace DiscImageChef.Devices.FreeBSD
///
/// DMA command
///
- DMA = 0x10
+ Dma = 0x10
}
/// XPT Opcodes for xpt_action
[Flags]
- enum xpt_opcode
+ enum XptOpcode
{
// Function code flags are bits greater than 0xff
/// Non-immediate function code
- XPT_FC_QUEUED = 0x100,
- XPT_FC_USER_CCB = 0x200,
+ XptFcQueued = 0x100,
+ XptFcUserCcb = 0x200,
/// Only for the transport layer device
- XPT_FC_XPT_ONLY = 0x400,
+ XptFcXptOnly = 0x400,
/// Passes through the device queues
- XPT_FC_DEV_QUEUED = 0x800 | XPT_FC_QUEUED,
+ XptFcDevQueued = 0x800 | XptFcQueued,
// Common function commands: 0x00->0x0F
/// Execute Nothing
- XPT_NOOP = 0x00,
+ XptNoop = 0x00,
/// Execute the requested I/O operation
- XPT_SCSI_IO = 0x01 | XPT_FC_DEV_QUEUED,
+ XptScsiIo = 0x01 | XptFcDevQueued,
/// Get type information for specified device
- XPT_GDEV_TYPE = 0x02,
+ XptGdevType = 0x02,
/// Get a list of peripheral devices
- XPT_GDEVLIST = 0x03,
+ XptGdevlist = 0x03,
/// Path routing inquiry
- XPT_PATH_INQ = 0x04,
+ XptPathInq = 0x04,
/// Release a frozen device queue
- XPT_REL_SIMQ = 0x05,
+ XptRelSimq = 0x05,
/// Set Asynchronous Callback Parameters
- XPT_SASYNC_CB = 0x06,
+ XptSasyncCb = 0x06,
/// Set device type information
- XPT_SDEV_TYPE = 0x07,
+ XptSdevType = 0x07,
/// (Re)Scan the SCSI Bus
- XPT_SCAN_BUS = 0x08 | XPT_FC_QUEUED | XPT_FC_USER_CCB | XPT_FC_XPT_ONLY,
+ XptScanBus = 0x08 | XptFcQueued | XptFcUserCcb | XptFcXptOnly,
/// Get EDT entries matching the given pattern
- XPT_DEV_MATCH = 0x09 | XPT_FC_XPT_ONLY,
+ XptDevMatch = 0x09 | XptFcXptOnly,
/// Turn on debugging for a bus, target or lun
- XPT_DEBUG = 0x0a,
+ XptDebug = 0x0a,
/// Path statistics (error counts, etc.)
- XPT_PATH_STATS = 0x0b,
+ XptPathStats = 0x0b,
/// Device statistics (error counts, etc.)
- XPT_GDEV_STATS = 0x0c,
+ XptGdevStats = 0x0c,
/// Get/Set Device advanced information
- XPT_DEV_ADVINFO = 0x0e,
+ XptDevAdvinfo = 0x0e,
/// Asynchronous event
- XPT_ASYNC = 0x0f | XPT_FC_QUEUED | XPT_FC_USER_CCB | XPT_FC_XPT_ONLY,
+ XptAsync = 0x0f | XptFcQueued | XptFcUserCcb | XptFcXptOnly,
/// SCSI Control Functions: 0x10->0x1F
/// Abort the specified CCB
- XPT_ABORT = 0x10,
+ XptAbort = 0x10,
/// Reset the specified SCSI bus
- XPT_RESET_BUS = 0x11 | XPT_FC_XPT_ONLY,
+ XptResetBus = 0x11 | XptFcXptOnly,
/// Bus Device Reset the specified SCSI device
- XPT_RESET_DEV = 0x12 | XPT_FC_DEV_QUEUED,
+ XptResetDev = 0x12 | XptFcDevQueued,
/// Terminate the I/O process
- XPT_TERM_IO = 0x13,
+ XptTermIo = 0x13,
/// Scan Logical Unit
- XPT_SCAN_LUN = 0x14 | XPT_FC_QUEUED | XPT_FC_USER_CCB | XPT_FC_XPT_ONLY,
+ XptScanLun = 0x14 | XptFcQueued | XptFcUserCcb | XptFcXptOnly,
/// Get default/user transfer settings for the target
- XPT_GET_TRAN_SETTINGS = 0x15,
+ XptGetTranSettings = 0x15,
/// Set transfer rate/width negotiation settings
- XPT_SET_TRAN_SETTINGS = 0x16,
+ XptSetTranSettings = 0x16,
/// Calculate the geometry parameters for a device give the sector size and volume size.
- XPT_CALC_GEOMETRY = 0x17,
+ XptCalcGeometry = 0x17,
/// Execute the requested ATA I/O operation
- XPT_ATA_IO = 0x18 | XPT_FC_DEV_QUEUED,
+ XptAtaIo = 0x18 | XptFcDevQueued,
/// Compat only
- XPT_GET_SIM_KNOB_OLD = 0x18,
+ XptGetSimKnobOld = 0x18,
/// Set SIM specific knob values.
- XPT_SET_SIM_KNOB = 0x19,
+ XptSetSimKnob = 0x19,
/// Get SIM specific knob values.
- XPT_GET_SIM_KNOB = 0x1a,
+ XptGetSimKnob = 0x1a,
/// Serial Management Protocol
- XPT_SMP_IO = 0x1b | XPT_FC_DEV_QUEUED,
+ XptSmpIo = 0x1b | XptFcDevQueued,
/// Scan Target
- XPT_SCAN_TGT = 0x1E | XPT_FC_QUEUED | XPT_FC_USER_CCB | XPT_FC_XPT_ONLY,
+ XptScanTgt = 0x1E | XptFcQueued | XptFcUserCcb | XptFcXptOnly,
// HBA engine commands 0x20->0x2F
/// HBA engine feature inquiry
- XPT_ENG_INQ = 0x20 | XPT_FC_XPT_ONLY,
+ XptEngInq = 0x20 | XptFcXptOnly,
/// HBA execute engine request
- XPT_ENG_EXEC = 0x21 | XPT_FC_DEV_QUEUED,
+ XptEngExec = 0x21 | XptFcDevQueued,
// Target mode commands: 0x30->0x3F
/// Enable LUN as a target
- XPT_EN_LUN = 0x30,
+ XptEnLun = 0x30,
/// Execute target I/O request
- XPT_TARGET_IO = 0x31 | XPT_FC_DEV_QUEUED,
+ XptTargetIo = 0x31 | XptFcDevQueued,
/// Accept Host Target Mode CDB
- XPT_ACCEPT_TARGET_IO = 0x32 | XPT_FC_QUEUED | XPT_FC_USER_CCB,
+ XptAcceptTargetIo = 0x32 | XptFcQueued | XptFcUserCcb,
/// Continue Host Target I/O Connection
- XPT_CONT_TARGET_IO = 0x33 | XPT_FC_DEV_QUEUED,
+ XptContTargetIo = 0x33 | XptFcDevQueued,
/// Notify Host Target driver of event (obsolete)
- XPT_IMMED_NOTIFY = 0x34 | XPT_FC_QUEUED | XPT_FC_USER_CCB,
+ XptImmedNotify = 0x34 | XptFcQueued | XptFcUserCcb,
/// Acknowledgement of event (obsolete)
- XPT_NOTIFY_ACK = 0x35,
+ XptNotifyAck = 0x35,
/// Notify Host Target driver of event
- XPT_IMMEDIATE_NOTIFY = 0x36 | XPT_FC_QUEUED | XPT_FC_USER_CCB,
+ XptImmediateNotify = 0x36 | XptFcQueued | XptFcUserCcb,
/// Acknowledgement of event
- XPT_NOTIFY_ACKNOWLEDGE = 0x37 | XPT_FC_QUEUED | XPT_FC_USER_CCB,
+ XptNotifyAcknowledge = 0x37 | XptFcQueued | XptFcUserCcb,
/// Vendor Unique codes: 0x80->0x8F
- XPT_VUNIQUE = 0x80
+ XptVunique = 0x80
}
- enum ccb_dev_match_status
+ enum CcbDevMatchStatus
{
- CAM_DEV_MATCH_LAST,
- CAM_DEV_MATCH_MORE,
- CAM_DEV_MATCH_LIST_CHANGED,
- CAM_DEV_MATCH_SIZE_ERROR,
- CAM_DEV_MATCH_ERROR
+ CamDevMatchLast,
+ CamDevMatchMore,
+ CamDevMatchListChanged,
+ CamDevMatchSizeError,
+ CamDevMatchError
}
- enum dev_match_type
+ enum DevMatchType
{
- DEV_MATCH_PERIPH = 0,
- DEV_MATCH_DEVICE,
- DEV_MATCH_BUS
+ DevMatchPeriph = 0,
+ DevMatchDevice,
+ DevMatchBus
}
[Flags]
- enum periph_pattern_flags
+ enum PeriphPatternFlags
{
- PERIPH_MATCH_NONE = 0x000,
- PERIPH_MATCH_PATH = 0x001,
- PERIPH_MATCH_TARGET = 0x002,
- PERIPH_MATCH_LUN = 0x004,
- PERIPH_MATCH_NAME = 0x008,
- PERIPH_MATCH_UNIT = 0x010,
+ PeriphMatchNone = 0x000,
+ PeriphMatchPath = 0x001,
+ PeriphMatchTarget = 0x002,
+ PeriphMatchLun = 0x004,
+ PeriphMatchName = 0x008,
+ PeriphMatchUnit = 0x010,
// PERIPH_MATCH_ANY = 0x01f
}
[Flags]
- enum dev_pattern_flags
+ enum DevPatternFlags
{
- DEV_MATCH_NONE = 0x000,
- DEV_MATCH_PATH = 0x001,
- DEV_MATCH_TARGET = 0x002,
- DEV_MATCH_LUN = 0x004,
- DEV_MATCH_INQUIRY = 0x008,
- DEV_MATCH_DEVID = 0x010,
+ DevMatchNone = 0x000,
+ DevMatchPath = 0x001,
+ DevMatchTarget = 0x002,
+ DevMatchLun = 0x004,
+ DevMatchInquiry = 0x008,
+ DevMatchDevid = 0x010,
// DEV_MATCH_ANY = 0x00f
}
[Flags]
- enum bus_pattern_flags
+ enum BusPatternFlags
{
- BUS_MATCH_NONE = 0x000,
- BUS_MATCH_PATH = 0x001,
- BUS_MATCH_NAME = 0x002,
- BUS_MATCH_UNIT = 0x004,
- BUS_MATCH_BUS_ID = 0x008,
+ BusMatchNone = 0x000,
+ BusMatchPath = 0x001,
+ BusMatchName = 0x002,
+ BusMatchUnit = 0x004,
+ BusMatchBusId = 0x008,
// BUS_MATCH_ANY = 0x00f
}
[Flags]
- enum dev_result_flags
+ enum DevResultFlags
{
- DEV_RESULT_NOFLAG = 0x00,
- DEV_RESULT_UNCONFIGURED = 0x01
+ DevResultNoflag = 0x00,
+ DevResultUnconfigured = 0x01
}
- enum cam_proto
+ enum CamProto
{
- PROTO_UNKNOWN,
- PROTO_UNSPECIFIED,
+ ProtoUnknown,
+ ProtoUnspecified,
///
/// Small Computer System Interface
///
- PROTO_SCSI,
+ ProtoScsi,
///
/// AT Attachment
///
- PROTO_ATA,
+ ProtoAta,
///
/// AT Attachment Packetized Interface
///
- PROTO_ATAPI,
+ ProtoAtapi,
///
/// SATA Port Multiplier
///
- PROTO_SATAPM,
+ ProtoSatapm,
///
/// SATA Enclosure Management Bridge
///
- PROTO_SEMB,
+ ProtoSemb,
///
/// NVMe
///
- PROTO_NVME,
+ ProtoNvme,
///
/// MMC, SD, SDIO
///
- PROTO_MMCSD,
+ ProtoMmcsd,
}
[Flags]
- enum mmc_card_features
+ enum MmcCardFeatures
{
- CARD_FEATURE_MEMORY = 0x1,
- CARD_FEATURE_SDHC = 0x1 << 1,
- CARD_FEATURE_SDIO = 0x1 << 2,
- CARD_FEATURE_SD20 = 0x1 << 3,
- CARD_FEATURE_MMC = 0x1 << 4,
- CARD_FEATURE_18V = 0x1 << 5,
+ CardFeatureMemory = 0x1,
+ CardFeatureSdhc = 0x1 << 1,
+ CardFeatureSdio = 0x1 << 2,
+ CardFeatureSd20 = 0x1 << 3,
+ CardFeatureMmc = 0x1 << 4,
+ CardFeature18V = 0x1 << 5,
}
- enum cam_generations : uint
+ enum CamGenerations : uint
{
- CAM_BUS_GENERATION = 0x00,
- CAM_TARGET_GENERATION = 0x01,
- CAM_DEV_GENERATION = 0x02,
- CAM_PERIPH_GENERATION = 0x03,
+ CamBusGeneration = 0x00,
+ CamTargetGeneration = 0x01,
+ CamDevGeneration = 0x02,
+ CamPeriphGeneration = 0x03,
}
[Flags]
- enum dev_pos_type
+ enum DevPosType
{
- CAM_DEV_POS_NONE = 0x000,
- CAM_DEV_POS_BUS = 0x001,
- CAM_DEV_POS_TARGET = 0x002,
- CAM_DEV_POS_DEVICE = 0x004,
- CAM_DEV_POS_PERIPH = 0x008,
- CAM_DEV_POS_PDPTR = 0x010,
+ CamDevPosNone = 0x000,
+ CamDevPosBus = 0x001,
+ CamDevPosTarget = 0x002,
+ CamDevPosDevice = 0x004,
+ CamDevPosPeriph = 0x008,
+ CamDevPosPdptr = 0x010,
// CAM_DEV_POS_TYPEMASK = 0xf00,
- CAM_DEV_POS_EDT = 0x100,
- CAM_DEV_POS_PDRV = 0x200
+ CamDevPosEdt = 0x100,
+ CamDevPosPdrv = 0x200
}
enum FreebsdIoctl : uint
{
- CAMIOCOMMAND = 0xC4D81802,
+ Camiocommand = 0xC4D81802,
}
[Flags]
- enum ccb_flags : uint
+ enum CcbFlags : uint
{
///
/// The CDB field is a pointer
///
- CAM_CDB_POINTER = 0x00000001,
+ CamCdbPointer = 0x00000001,
///
/// SIM queue actions are enabled
///
- CAM_QUEUE_ENABLE = 0x00000002,
+ CamQueueEnable = 0x00000002,
///
/// CCB contains a linked CDB
///
- CAM_CDB_LINKED = 0x00000004,
+ CamCdbLinked = 0x00000004,
///
/// Perform transport negotiation with this command.
///
- CAM_NEGOTIATE = 0x00000008,
+ CamNegotiate = 0x00000008,
///
/// Data type with physical addrs
///
- CAM_DATA_ISPHYS = 0x00000010,
+ CamDataIsphys = 0x00000010,
///
/// Disable autosense feature
///
- CAM_DIS_AUTOSENSE = 0x00000020,
+ CamDisAutosense = 0x00000020,
///
/// Data direction (00:IN/OUT)
///
- CAM_DIR_BOTH = 0x00000000,
+ CamDirBoth = 0x00000000,
///
/// Data direction (01:DATA IN)
///
- CAM_DIR_IN = 0x00000040,
+ CamDirIn = 0x00000040,
///
/// Data direction (10:DATA OUT)
///
- CAM_DIR_OUT = 0x00000080,
+ CamDirOut = 0x00000080,
///
/// Data direction (11:no data)
///
- CAM_DIR_NONE = 0x000000C0,
+ CamDirNone = 0x000000C0,
///
/// Data type (000:Virtual)
///
- CAM_DATA_VADDR = 0x00000000,
+ CamDataVaddr = 0x00000000,
///
/// Data type (001:Physical)
///
- CAM_DATA_PADDR = 0x00000010,
+ CamDataPaddr = 0x00000010,
///
/// Data type (010:sglist)
///
- CAM_DATA_SG = 0x00040000,
+ CamDataSg = 0x00040000,
///
/// Data type (011:sglist phys)
///
- CAM_DATA_SG_PADDR = 0x00040010,
+ CamDataSgPaddr = 0x00040010,
///
/// Data type (100:bio)
///
- CAM_DATA_BIO = 0x00200000,
+ CamDataBio = 0x00200000,
///
/// Use Soft reset alternative
///
- CAM_SOFT_RST_OP = 0x00000100,
+ CamSoftRstOp = 0x00000100,
///
/// Flush resid bytes on complete
///
- CAM_ENG_SYNC = 0x00000200,
+ CamEngSync = 0x00000200,
///
/// Disable DEV Q freezing
///
- CAM_DEV_QFRZDIS = 0x00000400,
+ CamDevQfrzdis = 0x00000400,
///
/// Freeze DEV Q on execution
///
- CAM_DEV_QFREEZE = 0x00000800,
+ CamDevQfreeze = 0x00000800,
///
/// Command takes a lot of power
///
- CAM_HIGH_POWER = 0x00001000,
+ CamHighPower = 0x00001000,
///
/// Sense data is a pointer
///
- CAM_SENSE_PTR = 0x00002000,
+ CamSensePtr = 0x00002000,
///
/// Sense pointer is physical addr
///
- CAM_SENSE_PHYS = 0x00004000,
+ CamSensePhys = 0x00004000,
///
/// Use the tag action in this ccb
///
- CAM_TAG_ACTION_VALID = 0x00008000,
+ CamTagActionValid = 0x00008000,
///
/// Pass driver does err. recovery
///
- CAM_PASS_ERR_RECOVER = 0x00010000,
+ CamPassErrRecover = 0x00010000,
///
/// Disable disconnect
///
- CAM_DIS_DISCONNECT = 0x00020000,
+ CamDisDisconnect = 0x00020000,
///
/// Message buffer ptr is physical
///
- CAM_MSG_BUF_PHYS = 0x00080000,
+ CamMsgBufPhys = 0x00080000,
///
/// Autosense data ptr is physical
///
- CAM_SNS_BUF_PHYS = 0x00100000,
+ CamSnsBufPhys = 0x00100000,
///
/// CDB poiner is physical
///
- CAM_CDB_PHYS = 0x00400000,
+ CamCdbPhys = 0x00400000,
///
/// SG list is for the HBA engine
///
- CAM_ENG_SGLIST = 0x00800000,
+ CamEngSglist = 0x00800000,
/* Phase cognizant mode flags */
///
/// Disable autosave/restore ptrs
///
- CAM_DIS_AUTOSRP = 0x01000000,
+ CamDisAutosrp = 0x01000000,
///
/// Disable auto disconnect
///
- CAM_DIS_AUTODISC = 0x02000000,
+ CamDisAutodisc = 0x02000000,
///
/// Target CCB available
///
- CAM_TGT_CCB_AVAIL = 0x04000000,
+ CamTgtCcbAvail = 0x04000000,
///
/// The SIM runs in phase mode
///
- CAM_TGT_PHASE_MODE = 0x08000000,
+ CamTgtPhaseMode = 0x08000000,
///
/// Message buffer valid
///
- CAM_MSGB_VALID = 0x10000000,
+ CamMsgbValid = 0x10000000,
///
/// Status buffer valid
///
- CAM_STATUS_VALID = 0x20000000,
+ CamStatusValid = 0x20000000,
///
/// Data buffer valid
///
- CAM_DATAB_VALID = 0x40000000,
+ CamDatabValid = 0x40000000,
/* Host target Mode flags */
///
/// Send sense data with status
///
- CAM_SEND_SENSE = 0x08000000,
+ CamSendSense = 0x08000000,
///
/// Terminate I/O Message sup.
///
- CAM_TERM_IO = 0x10000000,
+ CamTermIo = 0x10000000,
///
/// Disconnects are mandatory
///
- CAM_DISCONNECT = 0x20000000,
+ CamDisconnect = 0x20000000,
///
/// Send status after data phase
///
- CAM_SEND_STATUS = 0x40000000,
+ CamSendStatus = 0x40000000,
///
/// Call callback without lock.
///
- CAM_UNLOCKED = 0x80000000
+ CamUnlocked = 0x80000000
}
- enum cam_status : uint
+ enum CamStatus : uint
{
/// CCB request is in progress
- CAM_REQ_INPROG = 0x00,
+ CamReqInprog = 0x00,
/// CCB request completed without error
- CAM_REQ_CMP = 0x01,
+ CamReqCmp = 0x01,
/// CCB request aborted by the host
- CAM_REQ_ABORTED = 0x02,
+ CamReqAborted = 0x02,
/// Unable to abort CCB request
- CAM_UA_ABORT = 0x03,
+ CamUaAbort = 0x03,
/// CCB request completed with an error
- CAM_REQ_CMP_ERR = 0x04,
+ CamReqCmpErr = 0x04,
/// CAM subsystem is busy
- CAM_BUSY = 0x05,
+ CamBusy = 0x05,
/// CCB request was invalid
- CAM_REQ_INVALID = 0x06,
+ CamReqInvalid = 0x06,
/// Supplied Path ID is invalid
- CAM_PATH_INVALID = 0x07,
+ CamPathInvalid = 0x07,
/// SCSI Device Not Installed/there
- CAM_DEV_NOT_THERE = 0x08,
+ CamDevNotThere = 0x08,
/// Unable to terminate I/O CCB request
- CAM_UA_TERMIO = 0x09,
+ CamUaTermio = 0x09,
/// Target Selection Timeout
- CAM_SEL_TIMEOUT = 0x0a,
+ CamSelTimeout = 0x0a,
/// Command timeout
- CAM_CMD_TIMEOUT = 0x0b,
+ CamCmdTimeout = 0x0b,
/// SCSI error, look at error code in CCB
- CAM_SCSI_STATUS_ERROR = 0x0c,
+ CamScsiStatusError = 0x0c,
/// Message Reject Received
- CAM_MSG_REJECT_REC = 0x0d,
+ CamMsgRejectRec = 0x0d,
/// SCSI Bus Reset Sent/Received
- CAM_SCSI_BUS_RESET = 0x0e,
+ CamScsiBusReset = 0x0e,
/// Uncorrectable parity error occurred
- CAM_UNCOR_PARITY = 0x0f,
+ CamUncorParity = 0x0f,
/// Autosense: request sense cmd fail
- CAM_AUTOSENSE_FAIL = 0x10,
+ CamAutosenseFail = 0x10,
/// No HBA Detected error
- CAM_NO_HBA = 0x11,
+ CamNoHba = 0x11,
/// Data Overrun error
- CAM_DATA_RUN_ERR = 0x12,
+ CamDataRunErr = 0x12,
/// Unexpected Bus Free
- CAM_UNEXP_BUSFREE = 0x13,
+ CamUnexpBusfree = 0x13,
/// Target Bus Phase Sequence Failure
- CAM_SEQUENCE_FAIL = 0x14,
+ CamSequenceFail = 0x14,
/// CCB length supplied is inadequate
- CAM_CCB_LEN_ERR = 0x15,
+ CamCcbLenErr = 0x15,
/// Unable to provide requested capability
- CAM_PROVIDE_FAIL = 0x16,
+ CamProvideFail = 0x16,
/// A SCSI BDR msg was sent to target
- CAM_BDR_SENT = 0x17,
+ CamBdrSent = 0x17,
/// CCB request terminated by the host
- CAM_REQ_TERMIO = 0x18,
+ CamReqTermio = 0x18,
/// Unrecoverable Host Bus Adapter Error
- CAM_UNREC_HBA_ERROR = 0x19,
+ CamUnrecHbaError = 0x19,
/// Request was too large for this host
- CAM_REQ_TOO_BIG = 0x1a,
+ CamReqTooBig = 0x1a,
/// This request should be requeued to preserve transaction ordering. This typically occurs when the SIM recognizes an error that should freeze the queue and must place additional requests for the target at the sim level back into the XPT queue.
- CAM_REQUEUE_REQ = 0x1b,
+ CamRequeueReq = 0x1b,
/// ATA error, look at error code in CCB
- CAM_ATA_STATUS_ERROR = 0x1c,
+ CamAtaStatusError = 0x1c,
/// Initiator/Target Nexus lost.
- CAM_SCSI_IT_NEXUS_LOST = 0x1d,
+ CamScsiItNexusLost = 0x1d,
/// SMP error, look at error code in CCB
- CAM_SMP_STATUS_ERROR = 0x1e,
+ CamSmpStatusError = 0x1e,
/// Command completed without error but exceeded the soft timeout threshold.
- CAM_REQ_SOFTTIMEOUT = 0x1f,
+ CamReqSofttimeout = 0x1f,
/*
* 0x20 - 0x32 are unassigned
*/
/// Initiator Detected Error
- CAM_IDE = 0x33,
+ CamIde = 0x33,
/// Resource Unavailable
- CAM_RESRC_UNAVAIL = 0x34,
+ CamResrcUnavail = 0x34,
/// Unacknowledged Event by Host
- CAM_UNACKED_EVENT = 0x35,
+ CamUnackedEvent = 0x35,
/// Message Received in Host Target Mode
- CAM_MESSAGE_RECV = 0x36,
+ CamMessageRecv = 0x36,
/// Invalid CDB received in Host Target Mode
- CAM_INVALID_CDB = 0x37,
+ CamInvalidCdb = 0x37,
/// Lun supplied is invalid
- CAM_LUN_INVALID = 0x38,
+ CamLunInvalid = 0x38,
/// Target ID supplied is invalid
- CAM_TID_INVALID = 0x39,
+ CamTidInvalid = 0x39,
/// The requested function is not available
- CAM_FUNC_NOTAVAIL = 0x3a,
+ CamFuncNotavail = 0x3a,
/// Nexus is not established
- CAM_NO_NEXUS = 0x3b,
+ CamNoNexus = 0x3b,
/// The initiator ID is invalid
- CAM_IID_INVALID = 0x3c,
+ CamIidInvalid = 0x3c,
/// The SCSI CDB has been received
- CAM_CDB_RECVD = 0x3d,
+ CamCdbRecvd = 0x3d,
/// The LUN is already enabled for target mode
- CAM_LUN_ALRDY_ENA = 0x3e,
+ CamLunAlrdyEna = 0x3e,
/// SCSI Bus Busy
- CAM_SCSI_BUSY = 0x3f,
+ CamScsiBusy = 0x3f,
/*
* Flags
*/
/// The DEV queue is frozen w/this err
- CAM_DEV_QFRZN = 0x40,
+ CamDevQfrzn = 0x40,
/// Autosense data valid for target
- CAM_AUTOSNS_VALID = 0x80,
+ CamAutosnsValid = 0x80,
/// SIM ready to take more commands
- CAM_RELEASE_SIMQ = 0x100,
+ CamReleaseSimq = 0x100,
/// SIM has this command in its queue
- CAM_SIM_QUEUED = 0x200,
+ CamSimQueued = 0x200,
/// Quality of service data is valid
- CAM_QOS_VALID = 0x400,
+ CamQosValid = 0x400,
/// Mask bits for just the status #
- CAM_STATUS_MASK = 0x3F,
+ CamStatusMask = 0x3F,
/*
* Target Specific Adjunct Status
*/
/// sent sense with status
- CAM_SENT_SENSE = 0x40000000
+ CamSentSense = 0x40000000
}
}
\ No newline at end of file
diff --git a/DiscImageChef.Devices/FreeBSD/ListDevices.cs b/DiscImageChef.Devices/FreeBSD/ListDevices.cs
index fc5b3a66b..317a20eb9 100644
--- a/DiscImageChef.Devices/FreeBSD/ListDevices.cs
+++ b/DiscImageChef.Devices/FreeBSD/ListDevices.cs
@@ -50,15 +50,15 @@ namespace DiscImageChef.Devices.FreeBSD
{
DeviceInfo deviceInfo = new DeviceInfo();
IntPtr dev = cam_open_device(passDevice, FileFlags.ReadWrite);
- cam_device camDevice = (cam_device)Marshal.PtrToStructure(dev, typeof(cam_device));
+ CamDevice camDevice = (CamDevice)Marshal.PtrToStructure(dev, typeof(CamDevice));
IntPtr ccbPtr = cam_getccb(dev);
if(ccbPtr.ToInt64() == 0) continue;
- ccb_getdev cgd = (ccb_getdev)Marshal.PtrToStructure(ccbPtr, typeof(ccb_getdev));
+ CcbGetdev cgd = (CcbGetdev)Marshal.PtrToStructure(ccbPtr, typeof(CcbGetdev));
- cgd.ccb_h.func_code = xpt_opcode.XPT_GDEV_TYPE;
+ cgd.ccb_h.func_code = XptOpcode.XptGdevType;
Marshal.StructureToPtr(cgd, ccbPtr, false);
@@ -70,22 +70,22 @@ namespace DiscImageChef.Devices.FreeBSD
continue;
}
- cgd = (ccb_getdev)Marshal.PtrToStructure(ccbPtr, typeof(ccb_getdev));
+ cgd = (CcbGetdev)Marshal.PtrToStructure(ccbPtr, typeof(CcbGetdev));
cam_freeccb(ccbPtr);
cam_close_device(dev);
- string simName = StringHandlers.CToString(camDevice.sim_name);
- deviceInfo.path = passDevice;
- byte[] serialNumber = new byte[camDevice.serial_num_len];
- Array.Copy(camDevice.serial_num, 0, serialNumber, 0, serialNumber.Length);
- deviceInfo.serial = StringHandlers.CToString(serialNumber);
+ string simName = StringHandlers.CToString(camDevice.SimName);
+ deviceInfo.Path = passDevice;
+ byte[] serialNumber = new byte[camDevice.SerialNumLen];
+ Array.Copy(camDevice.SerialNum, 0, serialNumber, 0, serialNumber.Length);
+ deviceInfo.Serial = StringHandlers.CToString(serialNumber);
switch(cgd.protocol)
{
- case cam_proto.PROTO_ATA:
- case cam_proto.PROTO_ATAPI:
- case cam_proto.PROTO_SATAPM:
+ case CamProto.ProtoAta:
+ case CamProto.ProtoAtapi:
+ case CamProto.ProtoSatapm:
{
// Little-endian FreeBSD gives it resorted
// Big-endian FreeBSD, no idea
@@ -103,49 +103,49 @@ namespace DiscImageChef.Devices.FreeBSD
if(separated.Length == 1)
{
- deviceInfo.vendor = "ATA";
- deviceInfo.model = separated[0];
+ deviceInfo.Vendor = "ATA";
+ deviceInfo.Model = separated[0];
}
else
{
- deviceInfo.vendor = separated[0];
- deviceInfo.model = separated[separated.Length - 1];
+ deviceInfo.Vendor = separated[0];
+ deviceInfo.Model = separated[separated.Length - 1];
}
- deviceInfo.serial = idt.Value.SerialNumber;
- deviceInfo.bus = simName == "ahcich" ? "SATA" : "ATA";
- deviceInfo.supported = simName != "ata";
+ deviceInfo.Serial = idt.Value.SerialNumber;
+ deviceInfo.Bus = simName == "ahcich" ? "SATA" : "ATA";
+ deviceInfo.Supported = simName != "ata";
}
- if(cgd.protocol == cam_proto.PROTO_ATAPI) goto case cam_proto.PROTO_SCSI;
+ if(cgd.protocol == CamProto.ProtoAtapi) goto case CamProto.ProtoScsi;
break;
}
- case cam_proto.PROTO_SCSI:
+ case CamProto.ProtoScsi:
{
Decoders.SCSI.Inquiry.SCSIInquiry? inq = Decoders.SCSI.Inquiry.Decode(cgd.inq_data);
if(inq.HasValue)
{
- deviceInfo.vendor = StringHandlers.CToString(inq.Value.VendorIdentification).Trim();
- deviceInfo.model = StringHandlers.CToString(inq.Value.ProductIdentification).Trim();
- deviceInfo.bus = simName == "ata" || simName == "ahcich" ? "ATAPI" : "SCSI";
- deviceInfo.supported = simName != "ata";
+ deviceInfo.Vendor = StringHandlers.CToString(inq.Value.VendorIdentification).Trim();
+ deviceInfo.Model = StringHandlers.CToString(inq.Value.ProductIdentification).Trim();
+ deviceInfo.Bus = simName == "ata" || simName == "ahcich" ? "ATAPI" : "SCSI";
+ deviceInfo.Supported = simName != "ata";
}
break;
}
- case cam_proto.PROTO_NVME:
- deviceInfo.bus = "NVMe";
- deviceInfo.supported = false;
+ case CamProto.ProtoNvme:
+ deviceInfo.Bus = "NVMe";
+ deviceInfo.Supported = false;
break;
- case cam_proto.PROTO_MMCSD:
- deviceInfo.model = "Unknown card";
- deviceInfo.bus = "MMC/SD";
- deviceInfo.supported = false;
+ case CamProto.ProtoMmcsd:
+ deviceInfo.Model = "Unknown card";
+ deviceInfo.Bus = "MMC/SD";
+ deviceInfo.Supported = false;
break;
}
listDevices.Add(deviceInfo);
}
- return listDevices.Count > 0 ? listDevices.OrderBy(t => t.path).ToArray() : null;
+ return listDevices.Count > 0 ? listDevices.OrderBy(t => t.Path).ToArray() : null;
}
}
}
\ No newline at end of file
diff --git a/DiscImageChef.Devices/FreeBSD/Structs.cs b/DiscImageChef.Devices/FreeBSD/Structs.cs
index 307899ed1..c0fe8fa02 100644
--- a/DiscImageChef.Devices/FreeBSD/Structs.cs
+++ b/DiscImageChef.Devices/FreeBSD/Structs.cs
@@ -40,7 +40,7 @@ using target_id_t = System.UInt32;
namespace DiscImageChef.Devices.FreeBSD
{
[StructLayout(LayoutKind.Sequential)]
- struct ata_cmd
+ struct AtaCmd
{
public CamAtaIoFlags flags;
public byte command;
@@ -59,7 +59,7 @@ namespace DiscImageChef.Devices.FreeBSD
}
[StructLayout(LayoutKind.Sequential)]
- struct ata_res
+ struct AtaRes
{
public CamAtaIoFlags flags;
public byte status;
@@ -76,64 +76,64 @@ namespace DiscImageChef.Devices.FreeBSD
}
[StructLayout(LayoutKind.Sequential)]
- struct cam_pinfo
+ struct CamPinfo
{
public uint priority;
public uint generation;
public int index;
}
- struct LIST_ENTRY
+ struct ListEntry
{
///
/// LIST_ENTRY(ccb_hdr)=le->*le_next
///
- public IntPtr le_next;
+ public IntPtr LeNext;
///
/// LIST_ENTRY(ccb_hdr)=le->**le_prev
///
- public IntPtr le_prev;
+ public IntPtr LePrev;
}
- struct SLIST_ENTRY
+ struct SlistEntry
{
///
/// SLIST_ENTRY(ccb_hdr)=sle->*sle_next
///
- public IntPtr sle_next;
+ public IntPtr SleNext;
}
- struct TAILQ_ENTRY
+ struct TailqEntry
{
///
/// TAILQ_ENTRY(ccb_hdr)=tqe->*tqe_next
///
- public IntPtr tqe_next;
+ public IntPtr TqeNext;
///
/// TAILQ_ENTRY(ccb_hdr)=tqe->**tqe_prev
///
- public IntPtr tqe_prev;
+ public IntPtr TqePrev;
}
- struct STAILQ_ENTRY
+ struct StailqEntry
{
///
/// STAILQ_ENTRY(ccb_hdr)=stqe->*stqe_next
///
- public IntPtr stqe_next;
+ public IntPtr StqeNext;
}
[StructLayout(LayoutKind.Explicit)]
- struct camq_entry
+ struct CamqEntry
{
- [FieldOffset(0)] public LIST_ENTRY le;
- [FieldOffset(0)] public SLIST_ENTRY sle;
- [FieldOffset(0)] public TAILQ_ENTRY tqe;
- [FieldOffset(0)] public STAILQ_ENTRY stqe;
+ [FieldOffset(0)] public ListEntry le;
+ [FieldOffset(0)] public SlistEntry sle;
+ [FieldOffset(0)] public TailqEntry tqe;
+ [FieldOffset(0)] public StailqEntry stqe;
}
[StructLayout(LayoutKind.Sequential)]
- struct timeval
+ struct Timeval
{
public long tv_sec;
/// long
@@ -141,39 +141,39 @@ namespace DiscImageChef.Devices.FreeBSD
}
[StructLayout(LayoutKind.Sequential)]
- struct ccb_qos_area
+ struct CcbQosArea
{
- public timeval etime;
+ public Timeval etime;
public UIntPtr sim_data;
public UIntPtr periph_data;
}
[StructLayout(LayoutKind.Sequential)]
- struct ccb_hdr
+ struct CcbHdr
{
- public cam_pinfo pinfo;
- public camq_entry xpt_links;
- public camq_entry sim_links;
- public camq_entry periph_links;
+ public CamPinfo pinfo;
+ public CamqEntry xpt_links;
+ public CamqEntry sim_links;
+ public CamqEntry periph_links;
public uint retry_count;
public IntPtr cbfcnp;
- public xpt_opcode func_code;
- public cam_status status;
+ public XptOpcode func_code;
+ public CamStatus status;
public IntPtr path;
public uint path_id;
public uint target_id;
public ulong target_lun;
- public ccb_flags flags;
+ public CcbFlags flags;
public uint xflags;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public IntPtr[] periph_priv;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public IntPtr[] sim_priv;
- public ccb_qos_area qos;
+ public CcbQosArea qos;
public uint timeout;
- public timeval softtimeout;
+ public Timeval softtimeout;
}
[StructLayout(LayoutKind.Sequential)]
- struct scsi_sense_data
+ struct ScsiSenseData
{
const int SSD_FULL_SIZE = 252;
public byte error_code;
@@ -184,9 +184,9 @@ namespace DiscImageChef.Devices.FreeBSD
/// SCSI I/O Request CCB used for the XPT_SCSI_IO and XPT_CONT_TARGET_IO function codes.
///
[StructLayout(LayoutKind.Sequential)]
- struct ccb_scsiio
+ struct CcbScsiio
{
- public ccb_hdr ccb_h;
+ public CcbHdr ccb_h;
/// Ptr for next CCB for action
public IntPtr next_ccb;
/// Ptr to mapping info
@@ -196,7 +196,7 @@ namespace DiscImageChef.Devices.FreeBSD
/// Data transfer length
public uint dxfer_len;
/// Autosense storage
- public scsi_sense_data sense_data;
+ public ScsiSenseData sense_data;
/// Number of bytes to autosense
public byte sense_len;
/// Number of bytes for the CDB
@@ -230,9 +230,9 @@ namespace DiscImageChef.Devices.FreeBSD
/// SCSI I/O Request CCB used for the XPT_SCSI_IO and XPT_CONT_TARGET_IO function codes.
///
[StructLayout(LayoutKind.Sequential)]
- struct ccb_scsiio64
+ struct CcbScsiio64
{
- public ccb_hdr ccb_h;
+ public CcbHdr ccb_h;
/// Ptr for next CCB for action
public IntPtr next_ccb;
/// Ptr to mapping info
@@ -242,7 +242,7 @@ namespace DiscImageChef.Devices.FreeBSD
/// Data transfer length
public uint dxfer_len;
/// Autosense storage
- public scsi_sense_data sense_data;
+ public ScsiSenseData sense_data;
/// Number of bytes to autosense
public byte sense_len;
/// Number of bytes for the CDB
@@ -277,15 +277,15 @@ namespace DiscImageChef.Devices.FreeBSD
/// ATA I/O Request CCB used for the XPT_ATA_IO function code.
///
[StructLayout(LayoutKind.Sequential)]
- struct ccb_ataio
+ struct CcbAtaio
{
- public ccb_hdr ccb_h;
+ public CcbHdr ccb_h;
/// Ptr for next CCB for action
public IntPtr next_ccb;
/// ATA command register set
- public ata_cmd cmd;
+ public AtaCmd cmd;
/// ATA result register set
- public ata_res res;
+ public AtaRes res;
/// Ptr to the data buf/SG list
public IntPtr data_ptr;
/// Data transfer length
@@ -299,7 +299,7 @@ namespace DiscImageChef.Devices.FreeBSD
}
[StructLayout(LayoutKind.Sequential)]
- struct nvme_command
+ struct NvmeCommand
{
private ushort opc_fuse_rsvd1;
///
@@ -358,55 +358,55 @@ namespace DiscImageChef.Devices.FreeBSD
///
/// opcode
///
- public byte opc => (byte)((opc_fuse_rsvd1 & 0xFF00) >> 8);
+ public byte Opc => (byte)((opc_fuse_rsvd1 & 0xFF00) >> 8);
///
/// fused operation
///
- public byte fuse => (byte)((opc_fuse_rsvd1 & 0xC0) >> 6);
+ public byte Fuse => (byte)((opc_fuse_rsvd1 & 0xC0) >> 6);
///
/// reserved
///
- public byte rsvd1 => (byte)(opc_fuse_rsvd1 & 0x3F);
+ public byte Rsvd1 => (byte)(opc_fuse_rsvd1 & 0x3F);
}
[StructLayout(LayoutKind.Sequential)]
- struct nvme_status
+ struct NvmeStatus
{
private ushort status;
///
/// phase tag
///
- public byte p => (byte)((status & 0x8000) >> 15);
+ public byte P => (byte)((status & 0x8000) >> 15);
///
/// status code
///
- public byte sc => (byte)((status & 0x7F80) >> 7);
+ public byte Sc => (byte)((status & 0x7F80) >> 7);
///
/// status code type
///
- public byte sct => (byte)((status & 0x70) >> 4);
+ public byte Sct => (byte)((status & 0x70) >> 4);
///
/// reserved
///
- public byte rsvd2 => (byte)((status & 0xC) >> 15);
+ public byte Rsvd2 => (byte)((status & 0xC) >> 15);
///
/// more
///
- public byte m => (byte)((status & 0x2) >> 1);
+ public byte M => (byte)((status & 0x2) >> 1);
///
/// do not retry
///
- public byte dnr => (byte)(status & 0x1);
+ public byte Dnr => (byte)(status & 0x1);
}
[StructLayout(LayoutKind.Sequential)]
- struct nvme_completion
+ struct NvmeCompletion
{
///
/// command-specific
@@ -433,22 +433,22 @@ namespace DiscImageChef.Devices.FreeBSD
///
public ushort cid;
- public nvme_status status;
+ public NvmeStatus status;
}
///
/// NVMe I/O Request CCB used for the XPT_NVME_IO and XPT_NVME_ADMIN function codes.
///
[StructLayout(LayoutKind.Sequential)]
- struct ccb_nvmeio
+ struct CcbNvmeio
{
- public ccb_hdr ccb_h;
+ public CcbHdr ccb_h;
/// Ptr for next CCB for action
public IntPtr next_ccb;
/// NVME command, per NVME standard
- public nvme_command cmd;
+ public NvmeCommand cmd;
/// NVME completion, per NVME standard
- public nvme_completion cpl;
+ public NvmeCompletion cpl;
/// Ptr to the data buf/SG list
public IntPtr data_ptr;
/// Data transfer length
@@ -460,7 +460,7 @@ namespace DiscImageChef.Devices.FreeBSD
}
[StructLayout(LayoutKind.Sequential)]
- struct periph_match_pattern
+ struct PeriphMatchPattern
{
private const int DEV_IDLEN = 16;
@@ -469,18 +469,18 @@ namespace DiscImageChef.Devices.FreeBSD
public path_id_t path_id;
public target_id_t target_id;
public lun_id_t target_lun;
- public periph_pattern_flags flags;
+ public PeriphPatternFlags flags;
}
[StructLayout(LayoutKind.Sequential)]
- struct device_id_match_pattern
+ struct DeviceIdMatchPattern
{
public byte id_len;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public byte[] id;
}
[StructLayout(LayoutKind.Sequential)]
- struct scsi_static_inquiry_pattern
+ struct ScsiStaticInquiryPattern
{
private const int SID_VENDOR_SIZE = 8;
private const int SID_PRODUCT_SIZE = 16;
@@ -493,24 +493,24 @@ namespace DiscImageChef.Devices.FreeBSD
}
[StructLayout(LayoutKind.Explicit)]
- struct device_match_pattern_data
+ struct DeviceMatchPatternData
{
- [FieldOffset(0)] public scsi_static_inquiry_pattern inq_pat;
- [FieldOffset(0)] public device_id_match_pattern devid_pat;
+ [FieldOffset(0)] public ScsiStaticInquiryPattern inq_pat;
+ [FieldOffset(0)] public DeviceIdMatchPattern devid_pat;
}
[StructLayout(LayoutKind.Sequential)]
- struct device_match_pattern
+ struct DeviceMatchPattern
{
public path_id_t path_id;
public target_id_t target_id;
public lun_id_t target_lun;
- public dev_pattern_flags flags;
- public device_match_pattern_data data;
+ public DevPatternFlags flags;
+ public DeviceMatchPatternData data;
}
[StructLayout(LayoutKind.Sequential)]
- struct bus_match_pattern
+ struct BusMatchPattern
{
private const int DEV_IDLEN = 16;
@@ -518,26 +518,26 @@ namespace DiscImageChef.Devices.FreeBSD
[MarshalAs(UnmanagedType.ByValArray, SizeConst = DEV_IDLEN)] public byte[] dev_name;
public uint unit_number;
public uint bus_id;
- bus_pattern_flags flags;
+ BusPatternFlags flags;
}
[StructLayout(LayoutKind.Explicit)]
- struct match_pattern
+ struct MatchPattern
{
- [FieldOffset(0)] public periph_match_pattern periph_pattern;
- [FieldOffset(0)] public device_match_pattern device_pattern;
- [FieldOffset(0)] public bus_match_pattern bus_pattern;
+ [FieldOffset(0)] public PeriphMatchPattern periph_pattern;
+ [FieldOffset(0)] public DeviceMatchPattern device_pattern;
+ [FieldOffset(0)] public BusMatchPattern bus_pattern;
}
[StructLayout(LayoutKind.Sequential)]
- struct dev_match_pattern
+ struct DevMatchPattern
{
- public dev_match_type type;
- public match_pattern pattern;
+ public DevMatchType type;
+ public MatchPattern pattern;
}
[StructLayout(LayoutKind.Sequential)]
- struct periph_match_result
+ struct PeriphMatchResult
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] periph_name;
public uint unit_number;
@@ -547,7 +547,7 @@ namespace DiscImageChef.Devices.FreeBSD
}
[StructLayout(LayoutKind.Sequential)]
- struct mmc_cid
+ struct MmcCid
{
public uint mid;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] pnm;
@@ -560,7 +560,7 @@ namespace DiscImageChef.Devices.FreeBSD
}
[StructLayout(LayoutKind.Sequential)]
- struct mmc_params
+ struct MmcParams
{
///
/// Card model
@@ -585,7 +585,7 @@ namespace DiscImageChef.Devices.FreeBSD
///
/// Card CID -- parsed
///
- public mmc_cid cid;
+ public MmcCid cid;
///
/// Card CSD -- raw
@@ -600,26 +600,26 @@ namespace DiscImageChef.Devices.FreeBSD
///
/// What kind of card is it
///
- public mmc_card_features card_features;
+ public MmcCardFeatures card_features;
public byte sdio_func_count;
}
[StructLayout(LayoutKind.Sequential)]
- struct device_match_result
+ struct DeviceMatchResult
{
public path_id_t path_id;
public target_id_t target_id;
public lun_id_t target_lun;
- public cam_proto protocol;
+ public CamProto protocol;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public byte[] inq_data;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] public byte[] ident_data;
- public dev_result_flags flags;
- public mmc_params mmc_ident_data;
+ public DevResultFlags flags;
+ public MmcParams mmc_ident_data;
}
[StructLayout(LayoutKind.Sequential)]
- struct bus_match_result
+ struct BusMatchResult
{
public path_id_t path_id;
private const int DEV_IDLEN = 16;
@@ -629,22 +629,22 @@ namespace DiscImageChef.Devices.FreeBSD
}
[StructLayout(LayoutKind.Explicit)]
- struct match_result
+ struct MatchResult
{
- [FieldOffset(0)] public periph_match_result periph_result;
- [FieldOffset(0)] public device_match_result device_result;
- [FieldOffset(0)] public bus_match_result bus_result;
+ [FieldOffset(0)] public PeriphMatchResult periph_result;
+ [FieldOffset(0)] public DeviceMatchResult device_result;
+ [FieldOffset(0)] public BusMatchResult bus_result;
}
[StructLayout(LayoutKind.Sequential)]
- struct dev_match_result
+ struct DevMatchResult
{
- public dev_match_type type;
- public match_result result;
+ public DevMatchType type;
+ public MatchResult result;
}
[StructLayout(LayoutKind.Sequential)]
- struct ccb_dm_cookie
+ struct CcbDmCookie
{
public IntPtr bus;
public IntPtr target;
@@ -654,18 +654,18 @@ namespace DiscImageChef.Devices.FreeBSD
}
[StructLayout(LayoutKind.Sequential)]
- struct ccb_dev_position
+ struct CcbDevPosition
{
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public cam_generations[] generations;
- dev_pos_type position_type;
- public ccb_dm_cookie cookie;
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public CamGenerations[] generations;
+ DevPosType position_type;
+ public CcbDmCookie cookie;
}
[StructLayout(LayoutKind.Sequential)]
- struct ccb_dev_match
+ struct CcbDevMatch
{
- public ccb_hdr ccb_h;
- ccb_dev_match_status status;
+ public CcbHdr ccb_h;
+ CcbDevMatchStatus status;
public uint num_patterns;
public uint pattern_buf_len;
@@ -682,10 +682,10 @@ namespace DiscImageChef.Devices.FreeBSD
///
public IntPtr matches;
- public ccb_dev_position pos;
+ public CcbDevPosition pos;
}
- struct cam_device
+ struct CamDevice
{
private const int MAXPATHLEN = 1024;
private const int DEV_IDLEN = 16;
@@ -693,86 +693,86 @@ namespace DiscImageChef.Devices.FreeBSD
///
/// Pathname of the device given by the user. This may be null if the user states the device name and unit number separately.
///
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAXPATHLEN)] public byte[] device_path;
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = MAXPATHLEN)] public byte[] DevicePath;
///
/// Device name given by the user.
///
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = DEV_IDLEN + 1)] public byte[] given_dev_name;
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = DEV_IDLEN + 1)] public byte[] GivenDevName;
///
/// Unit number given by the user.
///
- public uint given_unit_number;
+ public uint GivenUnitNumber;
///
/// Name of the device, e.g. 'pass'
///
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = DEV_IDLEN + 1)] public byte[] device_name;
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = DEV_IDLEN + 1)] public byte[] DeviceName;
///
/// Unit number of the passthrough device associated with this particular device.
///
- public uint dev_unit_num;
+ public uint DevUnitNum;
///
/// Controller name, e.g. 'ahc'
///
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = SIM_IDLEN + 1)] public byte[] sim_name;
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = SIM_IDLEN + 1)] public byte[] SimName;
///
/// Controller unit number
///
- public uint sim_unit_number;
+ public uint SimUnitNumber;
///
/// Controller bus number
///
- public uint bus_id;
+ public uint BusId;
///
/// Logical Unit Number
///
- public lun_id_t target_lun;
+ public lun_id_t TargetLun;
///
/// Target ID
///
- public target_id_t target_id;
+ public target_id_t TargetId;
///
/// System SCSI bus number
///
- public path_id_t path_id;
+ public path_id_t PathId;
///
/// type of peripheral device
///
- public ushort pd_type;
+ public ushort PdType;
///
/// SCSI Inquiry data
///
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public byte[] inq_data;
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public byte[] InqData;
///
/// device serial number
///
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 252)] public byte[] serial_num;
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 252)] public byte[] SerialNum;
///
/// length of the serial number
///
- public byte serial_num_len;
+ public byte SerialNumLen;
///
/// Negotiated sync period
///
- public byte sync_period;
+ public byte SyncPeriod;
///
/// Negotiated sync offset
///
- public byte sync_offset;
+ public byte SyncOffset;
///
/// Negotiated bus width
///
- public byte bus_width;
+ public byte BusWidth;
///
/// file descriptor for device
///
- public int fd;
+ public int Fd;
}
[StructLayout(LayoutKind.Sequential)]
- struct ccb_getdev
+ struct CcbGetdev
{
- public ccb_hdr ccb_h;
- public cam_proto protocol;
+ public CcbHdr ccb_h;
+ public CamProto protocol;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public byte[] inq_data;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] public byte[] ident_data;
///
diff --git a/DiscImageChef.Devices/Linux/Command.cs b/DiscImageChef.Devices/Linux/Command.cs
index 290c0240a..021bbb0c8 100644
--- a/DiscImageChef.Devices/Linux/Command.cs
+++ b/DiscImageChef.Devices/Linux/Command.cs
@@ -60,42 +60,42 @@ namespace DiscImageChef.Devices.Linux
if(buffer == null) return -1;
- sg_io_hdr_t io_hdr = new sg_io_hdr_t();
+ SgIoHdrT ioHdr = new SgIoHdrT();
senseBuffer = new byte[32];
- io_hdr.interface_id = 'S';
- io_hdr.cmd_len = (byte)cdb.Length;
- io_hdr.mx_sb_len = (byte)senseBuffer.Length;
- io_hdr.dxfer_direction = direction;
- io_hdr.dxfer_len = (uint)buffer.Length;
- io_hdr.dxferp = Marshal.AllocHGlobal(buffer.Length);
- io_hdr.cmdp = Marshal.AllocHGlobal(cdb.Length);
- io_hdr.sbp = Marshal.AllocHGlobal(senseBuffer.Length);
- io_hdr.timeout = timeout * 1000;
+ ioHdr.interface_id = 'S';
+ ioHdr.cmd_len = (byte)cdb.Length;
+ ioHdr.mx_sb_len = (byte)senseBuffer.Length;
+ ioHdr.dxfer_direction = direction;
+ ioHdr.dxfer_len = (uint)buffer.Length;
+ ioHdr.dxferp = Marshal.AllocHGlobal(buffer.Length);
+ ioHdr.cmdp = Marshal.AllocHGlobal(cdb.Length);
+ ioHdr.sbp = Marshal.AllocHGlobal(senseBuffer.Length);
+ ioHdr.timeout = timeout * 1000;
- Marshal.Copy(buffer, 0, io_hdr.dxferp, buffer.Length);
- Marshal.Copy(cdb, 0, io_hdr.cmdp, cdb.Length);
- Marshal.Copy(senseBuffer, 0, io_hdr.sbp, senseBuffer.Length);
+ Marshal.Copy(buffer, 0, ioHdr.dxferp, buffer.Length);
+ Marshal.Copy(cdb, 0, ioHdr.cmdp, cdb.Length);
+ Marshal.Copy(senseBuffer, 0, ioHdr.sbp, senseBuffer.Length);
DateTime start = DateTime.UtcNow;
- int error = Extern.ioctlSg(fd, LinuxIoctl.SG_IO, ref io_hdr);
+ int error = Extern.ioctlSg(fd, LinuxIoctl.SgIo, ref ioHdr);
DateTime end = DateTime.UtcNow;
if(error < 0) error = Marshal.GetLastWin32Error();
- Marshal.Copy(io_hdr.dxferp, buffer, 0, buffer.Length);
- Marshal.Copy(io_hdr.cmdp, cdb, 0, cdb.Length);
- Marshal.Copy(io_hdr.sbp, senseBuffer, 0, senseBuffer.Length);
+ Marshal.Copy(ioHdr.dxferp, buffer, 0, buffer.Length);
+ Marshal.Copy(ioHdr.cmdp, cdb, 0, cdb.Length);
+ Marshal.Copy(ioHdr.sbp, senseBuffer, 0, senseBuffer.Length);
- sense |= (io_hdr.info & SgInfo.OkMask) != SgInfo.Ok;
+ sense |= (ioHdr.info & SgInfo.OkMask) != SgInfo.Ok;
- if(io_hdr.duration > 0) duration = io_hdr.duration;
+ if(ioHdr.duration > 0) duration = ioHdr.duration;
else duration = (end - start).TotalMilliseconds;
- Marshal.FreeHGlobal(io_hdr.dxferp);
- Marshal.FreeHGlobal(io_hdr.cmdp);
- Marshal.FreeHGlobal(io_hdr.sbp);
+ Marshal.FreeHGlobal(ioHdr.dxferp);
+ Marshal.FreeHGlobal(ioHdr.cmdp);
+ Marshal.FreeHGlobal(ioHdr.sbp);
return error;
}
@@ -339,28 +339,28 @@ namespace DiscImageChef.Devices.Linux
if(buffer == null) return -1;
- mmc_ioc_cmd io_cmd = new mmc_ioc_cmd();
+ MmcIocCmd ioCmd = new MmcIocCmd();
IntPtr bufPtr = Marshal.AllocHGlobal(buffer.Length);
- io_cmd.write_flag = write;
- io_cmd.is_ascmd = isApplication;
- io_cmd.opcode = (uint)command;
- io_cmd.arg = argument;
- io_cmd.flags = flags;
- io_cmd.blksz = blockSize;
- io_cmd.blocks = blocks;
+ ioCmd.write_flag = write;
+ ioCmd.is_ascmd = isApplication;
+ ioCmd.opcode = (uint)command;
+ ioCmd.arg = argument;
+ ioCmd.flags = flags;
+ ioCmd.blksz = blockSize;
+ ioCmd.blocks = blocks;
if(timeout > 0)
{
- io_cmd.data_timeout_ns = timeout * 1000000000;
- io_cmd.cmd_timeout_ms = timeout * 1000;
+ ioCmd.data_timeout_ns = timeout * 1000000000;
+ ioCmd.cmd_timeout_ms = timeout * 1000;
}
- io_cmd.data_ptr = (ulong)bufPtr;
+ ioCmd.data_ptr = (ulong)bufPtr;
Marshal.Copy(buffer, 0, bufPtr, buffer.Length);
DateTime start = DateTime.UtcNow;
- int error = Extern.ioctlMmc(fd, LinuxIoctl.MMC_IOC_CMD, ref io_cmd);
+ int error = Extern.ioctlMmc(fd, LinuxIoctl.MmcIocCmd, ref ioCmd);
DateTime end = DateTime.UtcNow;
sense |= error < 0;
@@ -369,7 +369,7 @@ namespace DiscImageChef.Devices.Linux
Marshal.Copy(bufPtr, buffer, 0, buffer.Length);
- response = io_cmd.response;
+ response = ioCmd.response;
duration = (end - start).TotalMilliseconds;
Marshal.FreeHGlobal(bufPtr);
diff --git a/DiscImageChef.Devices/Linux/Enums.cs b/DiscImageChef.Devices/Linux/Enums.cs
index 52c010a4e..1723b3674 100644
--- a/DiscImageChef.Devices/Linux/Enums.cs
+++ b/DiscImageChef.Devices/Linux/Enums.cs
@@ -61,7 +61,7 @@ namespace DiscImageChef.Devices.Linux
///
/// O_NOCTTY
///
- NoControlTTY = 00000400,
+ NoControlTty = 00000400,
///
/// O_TRUNC
///
@@ -143,10 +143,10 @@ namespace DiscImageChef.Devices.Linux
enum LinuxIoctl : uint
{
// SCSI IOCtls
- SG_GET_VERSION_NUM = 0x2282,
- SG_IO = 0x2285,
+ SgGetVersionNum = 0x2282,
+ SgIo = 0x2285,
// MMC IOCtl
- MMC_IOC_CMD = 0xC048B300
+ MmcIocCmd = 0xC048B300
}
[Flags]
diff --git a/DiscImageChef.Devices/Linux/Extern.cs b/DiscImageChef.Devices/Linux/Extern.cs
index 36a867235..9da5744df 100644
--- a/DiscImageChef.Devices/Linux/Extern.cs
+++ b/DiscImageChef.Devices/Linux/Extern.cs
@@ -48,10 +48,10 @@ namespace DiscImageChef.Devices.Linux
internal static extern int ioctlInt(int fd, LinuxIoctl request, out int value);
[DllImport("libc", EntryPoint = "ioctl", SetLastError = true)]
- internal static extern int ioctlSg(int fd, LinuxIoctl request, ref sg_io_hdr_t value);
+ internal static extern int ioctlSg(int fd, LinuxIoctl request, ref SgIoHdrT value);
[DllImport("libc", EntryPoint = "ioctl", SetLastError = true)]
- internal static extern int ioctlMmc(int fd, LinuxIoctl request, ref mmc_ioc_cmd value);
+ internal static extern int ioctlMmc(int fd, LinuxIoctl request, ref MmcIocCmd value);
[DllImport("libc", CharSet = CharSet.Ansi, SetLastError = true)]
internal static extern int readlink(string path, System.IntPtr buf, int bufsize);
@@ -67,6 +67,6 @@ namespace DiscImageChef.Devices.Linux
IntPtr udev, string subsystem, string sysname);
[DllImport("libudev", CharSet = CharSet.Ansi, SetLastError = true)]
- internal static extern string udev_device_get_property_value(IntPtr udev_device, string key);
+ internal static extern string udev_device_get_property_value(IntPtr udevDevice, string key);
}
}
\ No newline at end of file
diff --git a/DiscImageChef.Devices/Linux/ListDevices.cs b/DiscImageChef.Devices/Linux/ListDevices.cs
index d0e14c7eb..91729b41f 100644
--- a/DiscImageChef.Devices/Linux/ListDevices.cs
+++ b/DiscImageChef.Devices/Linux/ListDevices.cs
@@ -60,70 +60,70 @@ namespace DiscImageChef.Devices.Linux
for(int i = 0; i < sysdevs.Length; i++)
{
devices[i] = new DeviceInfo();
- devices[i].path = "/dev/" + Path.GetFileName(sysdevs[i]);
+ devices[i].Path = "/dev/" + Path.GetFileName(sysdevs[i]);
if(hasUdev)
{
udevDev = Extern.udev_device_new_from_subsystem_sysname(udev, "block",
Path.GetFileName(sysdevs[i]));
- devices[i].vendor = Extern.udev_device_get_property_value(udevDev, "ID_VENDOR");
- devices[i].model = Extern.udev_device_get_property_value(udevDev, "ID_MODEL");
- if(!string.IsNullOrEmpty(devices[i].model)) devices[i].model = devices[i].model.Replace('_', ' ');
- devices[i].serial = Extern.udev_device_get_property_value(udevDev, "ID_SCSI_SERIAL");
- if(string.IsNullOrEmpty(devices[i].serial))
- devices[i].serial = Extern.udev_device_get_property_value(udevDev, "ID_SERIAL_SHORT");
- devices[i].bus = Extern.udev_device_get_property_value(udevDev, "ID_BUS");
+ devices[i].Vendor = Extern.udev_device_get_property_value(udevDev, "ID_VENDOR");
+ devices[i].Model = Extern.udev_device_get_property_value(udevDev, "ID_MODEL");
+ if(!string.IsNullOrEmpty(devices[i].Model)) devices[i].Model = devices[i].Model.Replace('_', ' ');
+ devices[i].Serial = Extern.udev_device_get_property_value(udevDev, "ID_SCSI_SERIAL");
+ if(string.IsNullOrEmpty(devices[i].Serial))
+ devices[i].Serial = Extern.udev_device_get_property_value(udevDev, "ID_SERIAL_SHORT");
+ devices[i].Bus = Extern.udev_device_get_property_value(udevDev, "ID_BUS");
}
- if(File.Exists(Path.Combine(sysdevs[i], "device/vendor")) && string.IsNullOrEmpty(devices[i].vendor))
+ if(File.Exists(Path.Combine(sysdevs[i], "device/vendor")) && string.IsNullOrEmpty(devices[i].Vendor))
{
sr = new StreamReader(Path.Combine(sysdevs[i], "device/vendor"), Encoding.ASCII);
- devices[i].vendor = sr.ReadLine().Trim();
+ devices[i].Vendor = sr.ReadLine().Trim();
}
- else if(devices[i].path.StartsWith("/dev/loop", StringComparison.CurrentCulture))
- devices[i].vendor = "Linux";
+ else if(devices[i].Path.StartsWith("/dev/loop", StringComparison.CurrentCulture))
+ devices[i].Vendor = "Linux";
if(File.Exists(Path.Combine(sysdevs[i], "device/model")) &&
- (string.IsNullOrEmpty(devices[i].model) || devices[i].bus == "ata"))
+ (string.IsNullOrEmpty(devices[i].Model) || devices[i].Bus == "ata"))
{
sr = new StreamReader(Path.Combine(sysdevs[i], "device/model"), Encoding.ASCII);
- devices[i].model = sr.ReadLine().Trim();
+ devices[i].Model = sr.ReadLine().Trim();
}
- else if(devices[i].path.StartsWith("/dev/loop", StringComparison.CurrentCulture))
- devices[i].model = "Linux";
+ else if(devices[i].Path.StartsWith("/dev/loop", StringComparison.CurrentCulture))
+ devices[i].Model = "Linux";
- if(File.Exists(Path.Combine(sysdevs[i], "device/serial")) && string.IsNullOrEmpty(devices[i].serial))
+ if(File.Exists(Path.Combine(sysdevs[i], "device/serial")) && string.IsNullOrEmpty(devices[i].Serial))
{
sr = new StreamReader(Path.Combine(sysdevs[i], "device/serial"), Encoding.ASCII);
- devices[i].serial = sr.ReadLine().Trim();
+ devices[i].Serial = sr.ReadLine().Trim();
}
- if(string.IsNullOrEmpty(devices[i].vendor) || devices[i].vendor == "ATA")
+ if(string.IsNullOrEmpty(devices[i].Vendor) || devices[i].Vendor == "ATA")
{
- if(devices[i].model != null)
+ if(devices[i].Model != null)
{
- string[] pieces = devices[i].model.Split(' ');
+ string[] pieces = devices[i].Model.Split(' ');
if(pieces.Length > 1)
{
- devices[i].vendor = pieces[0];
- devices[i].model = devices[i].model.Substring(pieces[0].Length + 1);
+ devices[i].Vendor = pieces[0];
+ devices[i].Model = devices[i].Model.Substring(pieces[0].Length + 1);
}
}
}
// TODO: Get better device type from sysfs paths
- if(string.IsNullOrEmpty(devices[i].bus))
+ if(string.IsNullOrEmpty(devices[i].Bus))
{
- if(devices[i].path.StartsWith("/dev/loop", StringComparison.CurrentCulture))
- devices[i].bus = "loop";
- else if(devices[i].path.StartsWith("/dev/nvme", StringComparison.CurrentCulture))
- devices[i].bus = "NVMe";
- else if(devices[i].path.StartsWith("/dev/mmc", StringComparison.CurrentCulture))
- devices[i].bus = "MMC/SD";
+ if(devices[i].Path.StartsWith("/dev/loop", StringComparison.CurrentCulture))
+ devices[i].Bus = "loop";
+ else if(devices[i].Path.StartsWith("/dev/nvme", StringComparison.CurrentCulture))
+ devices[i].Bus = "NVMe";
+ else if(devices[i].Path.StartsWith("/dev/mmc", StringComparison.CurrentCulture))
+ devices[i].Bus = "MMC/SD";
}
- else devices[i].bus = devices[i].bus.ToUpper();
+ else devices[i].Bus = devices[i].Bus.ToUpper();
- switch(devices[i].bus)
+ switch(devices[i].Bus)
{
case "ATA":
case "ATAPI":
@@ -132,7 +132,7 @@ namespace DiscImageChef.Devices.Linux
case "PCMCIA":
case "FireWire":
case "MMC/SD":
- devices[i].supported = true;
+ devices[i].Supported = true;
break;
}
}
diff --git a/DiscImageChef.Devices/Linux/Structs.cs b/DiscImageChef.Devices/Linux/Structs.cs
index 7a1b1128d..6f46b6130 100644
--- a/DiscImageChef.Devices/Linux/Structs.cs
+++ b/DiscImageChef.Devices/Linux/Structs.cs
@@ -37,7 +37,7 @@ using System.Runtime.InteropServices;
namespace DiscImageChef.Devices.Linux
{
[StructLayout(LayoutKind.Sequential)]
- struct sg_io_hdr_t
+ struct SgIoHdrT
{
///
/// Always 'S' for SG v3
@@ -67,7 +67,7 @@ namespace DiscImageChef.Devices.Linux
}
[StructLayout(LayoutKind.Sequential)]
- struct mmc_ioc_cmd
+ struct MmcIocCmd
{
///
/// Implies direction of data. true = write, false = read
diff --git a/DiscImageChef.Devices/Windows/Command.cs b/DiscImageChef.Devices/Windows/Command.cs
index 488821677..3eaa2959a 100644
--- a/DiscImageChef.Devices/Windows/Command.cs
+++ b/DiscImageChef.Devices/Windows/Command.cs
@@ -63,43 +63,43 @@ namespace DiscImageChef.Devices.Windows
if(buffer == null) return -1;
- ScsiPassThroughDirectAndSenseBuffer sptd_sb = new ScsiPassThroughDirectAndSenseBuffer();
- sptd_sb.sptd = new ScsiPassThroughDirect();
- sptd_sb.SenseBuf = new byte[32];
- sptd_sb.sptd.Cdb = new byte[16];
- Array.Copy(cdb, sptd_sb.sptd.Cdb, cdb.Length);
- sptd_sb.sptd.Length = (ushort)Marshal.SizeOf(sptd_sb.sptd);
- sptd_sb.sptd.CdbLength = (byte)cdb.Length;
- sptd_sb.sptd.SenseInfoLength = (byte)sptd_sb.SenseBuf.Length;
- sptd_sb.sptd.DataIn = direction;
- sptd_sb.sptd.DataTransferLength = (uint)buffer.Length;
- sptd_sb.sptd.TimeOutValue = timeout;
- sptd_sb.sptd.DataBuffer = Marshal.AllocHGlobal(buffer.Length);
- sptd_sb.sptd.SenseInfoOffset = (uint)Marshal.SizeOf(sptd_sb.sptd);
+ ScsiPassThroughDirectAndSenseBuffer sptdSb = new ScsiPassThroughDirectAndSenseBuffer();
+ sptdSb.sptd = new ScsiPassThroughDirect();
+ sptdSb.SenseBuf = new byte[32];
+ sptdSb.sptd.Cdb = new byte[16];
+ Array.Copy(cdb, sptdSb.sptd.Cdb, cdb.Length);
+ sptdSb.sptd.Length = (ushort)Marshal.SizeOf(sptdSb.sptd);
+ sptdSb.sptd.CdbLength = (byte)cdb.Length;
+ sptdSb.sptd.SenseInfoLength = (byte)sptdSb.SenseBuf.Length;
+ sptdSb.sptd.DataIn = direction;
+ sptdSb.sptd.DataTransferLength = (uint)buffer.Length;
+ sptdSb.sptd.TimeOutValue = timeout;
+ sptdSb.sptd.DataBuffer = Marshal.AllocHGlobal(buffer.Length);
+ sptdSb.sptd.SenseInfoOffset = (uint)Marshal.SizeOf(sptdSb.sptd);
uint k = 0;
int error = 0;
- Marshal.Copy(buffer, 0, sptd_sb.sptd.DataBuffer, buffer.Length);
+ Marshal.Copy(buffer, 0, sptdSb.sptd.DataBuffer, buffer.Length);
DateTime start = DateTime.Now;
- bool hasError = !Extern.DeviceIoControlScsi(fd, WindowsIoctl.IOCTL_SCSI_PASS_THROUGH_DIRECT, ref sptd_sb,
- (uint)Marshal.SizeOf(sptd_sb), ref sptd_sb,
- (uint)Marshal.SizeOf(sptd_sb), ref k, IntPtr.Zero);
+ bool hasError = !Extern.DeviceIoControlScsi(fd, WindowsIoctl.IoctlScsiPassThroughDirect, ref sptdSb,
+ (uint)Marshal.SizeOf(sptdSb), ref sptdSb,
+ (uint)Marshal.SizeOf(sptdSb), ref k, IntPtr.Zero);
DateTime end = DateTime.Now;
if(hasError) error = Marshal.GetLastWin32Error();
- Marshal.Copy(sptd_sb.sptd.DataBuffer, buffer, 0, buffer.Length);
+ Marshal.Copy(sptdSb.sptd.DataBuffer, buffer, 0, buffer.Length);
- sense |= sptd_sb.sptd.ScsiStatus != 0;
+ sense |= sptdSb.sptd.ScsiStatus != 0;
senseBuffer = new byte[32];
- Array.Copy(sptd_sb.SenseBuf, senseBuffer, 32);
+ Array.Copy(sptdSb.SenseBuf, senseBuffer, 32);
duration = (end - start).TotalMilliseconds;
- Marshal.FreeHGlobal(sptd_sb.sptd.DataBuffer);
+ Marshal.FreeHGlobal(sptdSb.sptd.DataBuffer);
return error;
}
@@ -116,7 +116,7 @@ namespace DiscImageChef.Devices.Windows
uint offsetForBuffer = (uint)(Marshal.SizeOf(typeof(AtaPassThroughDirect)) + Marshal.SizeOf(typeof(uint)));
- AtaPassThroughDirectWithBuffer aptd_buf = new AtaPassThroughDirectWithBuffer
+ AtaPassThroughDirectWithBuffer aptdBuf = new AtaPassThroughDirectWithBuffer
{
aptd = new AtaPassThroughDirect
{
@@ -140,49 +140,49 @@ namespace DiscImageChef.Devices.Windows
};
if(protocol == AtaProtocol.PioIn || protocol == AtaProtocol.UDmaIn || protocol == AtaProtocol.Dma)
- aptd_buf.aptd.AtaFlags = AtaFlags.DataIn;
+ aptdBuf.aptd.AtaFlags = AtaFlags.DataIn;
else if(protocol == AtaProtocol.PioOut || protocol == AtaProtocol.UDmaOut)
- aptd_buf.aptd.AtaFlags = AtaFlags.DataOut;
+ aptdBuf.aptd.AtaFlags = AtaFlags.DataOut;
switch(protocol)
{
case AtaProtocol.Dma:
case AtaProtocol.DmaQueued:
- case AtaProtocol.FPDma:
+ case AtaProtocol.FpDma:
case AtaProtocol.UDmaIn:
case AtaProtocol.UDmaOut:
- aptd_buf.aptd.AtaFlags |= AtaFlags.DMA;
+ aptdBuf.aptd.AtaFlags |= AtaFlags.Dma;
break;
}
// Unknown if needed
- aptd_buf.aptd.AtaFlags |= AtaFlags.DrdyRequired;
+ aptdBuf.aptd.AtaFlags |= AtaFlags.DrdyRequired;
uint k = 0;
int error = 0;
- Array.Copy(buffer, 0, aptd_buf.dataBuffer, 0, buffer.Length);
+ Array.Copy(buffer, 0, aptdBuf.dataBuffer, 0, buffer.Length);
DateTime start = DateTime.Now;
- sense = !Extern.DeviceIoControlAta(fd, WindowsIoctl.IOCTL_ATA_PASS_THROUGH, ref aptd_buf,
- (uint)Marshal.SizeOf(aptd_buf), ref aptd_buf,
- (uint)Marshal.SizeOf(aptd_buf), ref k, IntPtr.Zero);
+ sense = !Extern.DeviceIoControlAta(fd, WindowsIoctl.IoctlAtaPassThrough, ref aptdBuf,
+ (uint)Marshal.SizeOf(aptdBuf), ref aptdBuf,
+ (uint)Marshal.SizeOf(aptdBuf), ref k, IntPtr.Zero);
DateTime end = DateTime.Now;
if(sense) error = Marshal.GetLastWin32Error();
- Array.Copy(aptd_buf.dataBuffer, 0, buffer, 0, buffer.Length);
+ Array.Copy(aptdBuf.dataBuffer, 0, buffer, 0, buffer.Length);
duration = (end - start).TotalMilliseconds;
- errorRegisters.command = aptd_buf.aptd.CurrentTaskFile.Command;
- errorRegisters.cylinderHigh = aptd_buf.aptd.CurrentTaskFile.CylinderHigh;
- errorRegisters.cylinderLow = aptd_buf.aptd.CurrentTaskFile.CylinderLow;
- errorRegisters.deviceHead = aptd_buf.aptd.CurrentTaskFile.DeviceHead;
- errorRegisters.error = aptd_buf.aptd.CurrentTaskFile.Error;
- errorRegisters.sector = aptd_buf.aptd.CurrentTaskFile.SectorNumber;
- errorRegisters.sectorCount = aptd_buf.aptd.CurrentTaskFile.SectorCount;
- errorRegisters.status = aptd_buf.aptd.CurrentTaskFile.Status;
+ errorRegisters.command = aptdBuf.aptd.CurrentTaskFile.Command;
+ errorRegisters.cylinderHigh = aptdBuf.aptd.CurrentTaskFile.CylinderHigh;
+ errorRegisters.cylinderLow = aptdBuf.aptd.CurrentTaskFile.CylinderLow;
+ errorRegisters.deviceHead = aptdBuf.aptd.CurrentTaskFile.DeviceHead;
+ errorRegisters.error = aptdBuf.aptd.CurrentTaskFile.Error;
+ errorRegisters.sector = aptdBuf.aptd.CurrentTaskFile.SectorNumber;
+ errorRegisters.sectorCount = aptdBuf.aptd.CurrentTaskFile.SectorCount;
+ errorRegisters.status = aptdBuf.aptd.CurrentTaskFile.Status;
sense = errorRegisters.error != 0 || (errorRegisters.status & 0xA5) != 0;
@@ -201,7 +201,7 @@ namespace DiscImageChef.Devices.Windows
uint offsetForBuffer = (uint)(Marshal.SizeOf(typeof(AtaPassThroughDirect)) + Marshal.SizeOf(typeof(uint)));
- AtaPassThroughDirectWithBuffer aptd_buf = new AtaPassThroughDirectWithBuffer
+ AtaPassThroughDirectWithBuffer aptdBuf = new AtaPassThroughDirectWithBuffer
{
aptd = new AtaPassThroughDirect
{
@@ -225,49 +225,49 @@ namespace DiscImageChef.Devices.Windows
};
if(protocol == AtaProtocol.PioIn || protocol == AtaProtocol.UDmaIn || protocol == AtaProtocol.Dma)
- aptd_buf.aptd.AtaFlags = AtaFlags.DataIn;
+ aptdBuf.aptd.AtaFlags = AtaFlags.DataIn;
else if(protocol == AtaProtocol.PioOut || protocol == AtaProtocol.UDmaOut)
- aptd_buf.aptd.AtaFlags = AtaFlags.DataOut;
+ aptdBuf.aptd.AtaFlags = AtaFlags.DataOut;
switch(protocol)
{
case AtaProtocol.Dma:
case AtaProtocol.DmaQueued:
- case AtaProtocol.FPDma:
+ case AtaProtocol.FpDma:
case AtaProtocol.UDmaIn:
case AtaProtocol.UDmaOut:
- aptd_buf.aptd.AtaFlags |= AtaFlags.DMA;
+ aptdBuf.aptd.AtaFlags |= AtaFlags.Dma;
break;
}
// Unknown if needed
- aptd_buf.aptd.AtaFlags |= AtaFlags.DrdyRequired;
+ aptdBuf.aptd.AtaFlags |= AtaFlags.DrdyRequired;
uint k = 0;
int error = 0;
- Array.Copy(buffer, 0, aptd_buf.dataBuffer, 0, buffer.Length);
+ Array.Copy(buffer, 0, aptdBuf.dataBuffer, 0, buffer.Length);
DateTime start = DateTime.Now;
- sense = !Extern.DeviceIoControlAta(fd, WindowsIoctl.IOCTL_ATA_PASS_THROUGH, ref aptd_buf,
- (uint)Marshal.SizeOf(aptd_buf), ref aptd_buf,
- (uint)Marshal.SizeOf(aptd_buf), ref k, IntPtr.Zero);
+ sense = !Extern.DeviceIoControlAta(fd, WindowsIoctl.IoctlAtaPassThrough, ref aptdBuf,
+ (uint)Marshal.SizeOf(aptdBuf), ref aptdBuf,
+ (uint)Marshal.SizeOf(aptdBuf), ref k, IntPtr.Zero);
DateTime end = DateTime.Now;
if(sense) error = Marshal.GetLastWin32Error();
- Array.Copy(aptd_buf.dataBuffer, 0, buffer, 0, buffer.Length);
+ Array.Copy(aptdBuf.dataBuffer, 0, buffer, 0, buffer.Length);
duration = (end - start).TotalMilliseconds;
- errorRegisters.command = aptd_buf.aptd.CurrentTaskFile.Command;
- errorRegisters.lbaHigh = aptd_buf.aptd.CurrentTaskFile.CylinderHigh;
- errorRegisters.lbaMid = aptd_buf.aptd.CurrentTaskFile.CylinderLow;
- errorRegisters.deviceHead = aptd_buf.aptd.CurrentTaskFile.DeviceHead;
- errorRegisters.error = aptd_buf.aptd.CurrentTaskFile.Error;
- errorRegisters.lbaLow = aptd_buf.aptd.CurrentTaskFile.SectorNumber;
- errorRegisters.sectorCount = aptd_buf.aptd.CurrentTaskFile.SectorCount;
- errorRegisters.status = aptd_buf.aptd.CurrentTaskFile.Status;
+ errorRegisters.command = aptdBuf.aptd.CurrentTaskFile.Command;
+ errorRegisters.lbaHigh = aptdBuf.aptd.CurrentTaskFile.CylinderHigh;
+ errorRegisters.lbaMid = aptdBuf.aptd.CurrentTaskFile.CylinderLow;
+ errorRegisters.deviceHead = aptdBuf.aptd.CurrentTaskFile.DeviceHead;
+ errorRegisters.error = aptdBuf.aptd.CurrentTaskFile.Error;
+ errorRegisters.lbaLow = aptdBuf.aptd.CurrentTaskFile.SectorNumber;
+ errorRegisters.sectorCount = aptdBuf.aptd.CurrentTaskFile.SectorCount;
+ errorRegisters.status = aptdBuf.aptd.CurrentTaskFile.Status;
sense = errorRegisters.error != 0 || (errorRegisters.status & 0xA5) != 0;
@@ -286,7 +286,7 @@ namespace DiscImageChef.Devices.Windows
uint offsetForBuffer = (uint)(Marshal.SizeOf(typeof(AtaPassThroughDirect)) + Marshal.SizeOf(typeof(uint)));
- AtaPassThroughDirectWithBuffer aptd_buf = new AtaPassThroughDirectWithBuffer
+ AtaPassThroughDirectWithBuffer aptdBuf = new AtaPassThroughDirectWithBuffer
{
aptd = new AtaPassThroughDirect
{
@@ -318,53 +318,53 @@ namespace DiscImageChef.Devices.Windows
};
if(protocol == AtaProtocol.PioIn || protocol == AtaProtocol.UDmaIn || protocol == AtaProtocol.Dma)
- aptd_buf.aptd.AtaFlags = AtaFlags.DataIn;
+ aptdBuf.aptd.AtaFlags = AtaFlags.DataIn;
else if(protocol == AtaProtocol.PioOut || protocol == AtaProtocol.UDmaOut)
- aptd_buf.aptd.AtaFlags = AtaFlags.DataOut;
+ aptdBuf.aptd.AtaFlags = AtaFlags.DataOut;
switch(protocol)
{
case AtaProtocol.Dma:
case AtaProtocol.DmaQueued:
- case AtaProtocol.FPDma:
+ case AtaProtocol.FpDma:
case AtaProtocol.UDmaIn:
case AtaProtocol.UDmaOut:
- aptd_buf.aptd.AtaFlags |= AtaFlags.DMA;
+ aptdBuf.aptd.AtaFlags |= AtaFlags.Dma;
break;
}
// Unknown if needed
- aptd_buf.aptd.AtaFlags |= AtaFlags.DrdyRequired;
+ aptdBuf.aptd.AtaFlags |= AtaFlags.DrdyRequired;
uint k = 0;
int error = 0;
- Array.Copy(buffer, 0, aptd_buf.dataBuffer, 0, buffer.Length);
+ Array.Copy(buffer, 0, aptdBuf.dataBuffer, 0, buffer.Length);
DateTime start = DateTime.Now;
- sense = !Extern.DeviceIoControlAta(fd, WindowsIoctl.IOCTL_ATA_PASS_THROUGH, ref aptd_buf,
- (uint)Marshal.SizeOf(aptd_buf), ref aptd_buf,
- (uint)Marshal.SizeOf(aptd_buf), ref k, IntPtr.Zero);
+ sense = !Extern.DeviceIoControlAta(fd, WindowsIoctl.IoctlAtaPassThrough, ref aptdBuf,
+ (uint)Marshal.SizeOf(aptdBuf), ref aptdBuf,
+ (uint)Marshal.SizeOf(aptdBuf), ref k, IntPtr.Zero);
DateTime end = DateTime.Now;
if(sense) error = Marshal.GetLastWin32Error();
- Array.Copy(aptd_buf.dataBuffer, 0, buffer, 0, buffer.Length);
+ Array.Copy(aptdBuf.dataBuffer, 0, buffer, 0, buffer.Length);
duration = (end - start).TotalMilliseconds;
- errorRegisters.sectorCount = (ushort)((aptd_buf.aptd.PreviousTaskFile.SectorCount << 8) +
- aptd_buf.aptd.CurrentTaskFile.SectorCount);
- errorRegisters.lbaLow = (ushort)((aptd_buf.aptd.PreviousTaskFile.SectorNumber << 8) +
- aptd_buf.aptd.CurrentTaskFile.SectorNumber);
- errorRegisters.lbaMid = (ushort)((aptd_buf.aptd.PreviousTaskFile.CylinderLow << 8) +
- aptd_buf.aptd.CurrentTaskFile.CylinderLow);
- errorRegisters.lbaHigh = (ushort)((aptd_buf.aptd.PreviousTaskFile.CylinderHigh << 8) +
- aptd_buf.aptd.CurrentTaskFile.CylinderHigh);
- errorRegisters.command = aptd_buf.aptd.CurrentTaskFile.Command;
- errorRegisters.deviceHead = aptd_buf.aptd.CurrentTaskFile.DeviceHead;
- errorRegisters.error = aptd_buf.aptd.CurrentTaskFile.Error;
- errorRegisters.status = aptd_buf.aptd.CurrentTaskFile.Status;
+ errorRegisters.sectorCount = (ushort)((aptdBuf.aptd.PreviousTaskFile.SectorCount << 8) +
+ aptdBuf.aptd.CurrentTaskFile.SectorCount);
+ errorRegisters.lbaLow = (ushort)((aptdBuf.aptd.PreviousTaskFile.SectorNumber << 8) +
+ aptdBuf.aptd.CurrentTaskFile.SectorNumber);
+ errorRegisters.lbaMid = (ushort)((aptdBuf.aptd.PreviousTaskFile.CylinderLow << 8) +
+ aptdBuf.aptd.CurrentTaskFile.CylinderLow);
+ errorRegisters.lbaHigh = (ushort)((aptdBuf.aptd.PreviousTaskFile.CylinderHigh << 8) +
+ aptdBuf.aptd.CurrentTaskFile.CylinderHigh);
+ errorRegisters.command = aptdBuf.aptd.CurrentTaskFile.Command;
+ errorRegisters.deviceHead = aptdBuf.aptd.CurrentTaskFile.DeviceHead;
+ errorRegisters.error = aptdBuf.aptd.CurrentTaskFile.Error;
+ errorRegisters.status = aptdBuf.aptd.CurrentTaskFile.Status;
sense = errorRegisters.error != 0 || (errorRegisters.status & 0xA5) != 0;
@@ -403,7 +403,7 @@ namespace DiscImageChef.Devices.Windows
Array.Copy(buffer, 0, iptd.DataBuffer, 0, buffer.Length);
DateTime start = DateTime.Now;
- sense = !Extern.DeviceIoControlIde(fd, WindowsIoctl.IOCTL_IDE_PASS_THROUGH, ref iptd,
+ sense = !Extern.DeviceIoControlIde(fd, WindowsIoctl.IoctlIdePassThrough, ref iptd,
(uint)Marshal.SizeOf(iptd), ref iptd, (uint)Marshal.SizeOf(iptd), ref k,
IntPtr.Zero);
DateTime end = DateTime.Now;
@@ -463,7 +463,7 @@ namespace DiscImageChef.Devices.Windows
Array.Copy(buffer, 0, iptd.DataBuffer, 0, buffer.Length);
DateTime start = DateTime.Now;
- sense = !Extern.DeviceIoControlIde(fd, WindowsIoctl.IOCTL_IDE_PASS_THROUGH, ref iptd,
+ sense = !Extern.DeviceIoControlIde(fd, WindowsIoctl.IoctlIdePassThrough, ref iptd,
(uint)Marshal.SizeOf(iptd), ref iptd, (uint)Marshal.SizeOf(iptd), ref k,
IntPtr.Zero);
DateTime end = DateTime.Now;
@@ -494,7 +494,7 @@ namespace DiscImageChef.Devices.Windows
StorageDeviceNumber sdn = new StorageDeviceNumber();
sdn.deviceNumber = -1;
uint k = 0;
- if(!Extern.DeviceIoControlGetDeviceNumber(deviceHandle, WindowsIoctl.IOCTL_STORAGE_GET_DEVICE_NUMBER,
+ if(!Extern.DeviceIoControlGetDeviceNumber(deviceHandle, WindowsIoctl.IoctlStorageGetDeviceNumber,
IntPtr.Zero, 0, ref sdn, (uint)Marshal.SizeOf(sdn), ref k,
IntPtr.Zero)) { return uint.MaxValue; }
@@ -507,7 +507,7 @@ namespace DiscImageChef.Devices.Windows
if(devNumber == uint.MaxValue) return null;
- SafeFileHandle hDevInfo = Extern.SetupDiGetClassDevs(ref Consts.GUID_DEVINTERFACE_DISK, IntPtr.Zero,
+ SafeFileHandle hDevInfo = Extern.SetupDiGetClassDevs(ref Consts.GuidDevinterfaceDisk, IntPtr.Zero,
IntPtr.Zero,
DeviceGetClassFlags.Present |
DeviceGetClassFlags.DeviceInterface);
@@ -524,7 +524,7 @@ namespace DiscImageChef.Devices.Windows
{
buffer = new byte[2048];
- if(!Extern.SetupDiEnumDeviceInterfaces(hDevInfo, IntPtr.Zero, ref Consts.GUID_DEVINTERFACE_DISK, index,
+ if(!Extern.SetupDiEnumDeviceInterfaces(hDevInfo, IntPtr.Zero, ref Consts.GuidDevinterfaceDisk, index,
ref spdid)) break;
uint size = 0;
@@ -581,9 +581,9 @@ namespace DiscImageChef.Devices.Windows
SffdiskQueryDeviceProtocolData queryData1 = new SffdiskQueryDeviceProtocolData();
queryData1.size = (ushort)Marshal.SizeOf(queryData1);
uint bytesReturned;
- Extern.DeviceIoControl(fd, WindowsIoctl.IOCTL_SFFDISK_QUERY_DEVICE_PROTOCOL, IntPtr.Zero, 0, ref queryData1,
+ Extern.DeviceIoControl(fd, WindowsIoctl.IoctlSffdiskQueryDeviceProtocol, IntPtr.Zero, 0, ref queryData1,
queryData1.size, out bytesReturned, IntPtr.Zero);
- return queryData1.protocolGuid.Equals(Consts.GUID_SFF_PROTOCOL_SD);
+ return queryData1.protocolGuid.Equals(Consts.GuidSffProtocolSd);
}
///
@@ -617,46 +617,46 @@ namespace DiscImageChef.Devices.Windows
commandDescriptor.commandCode = (byte)command;
commandDescriptor.cmdClass = isApplication ? SdCommandClass.AppCmd : SdCommandClass.Standard;
commandDescriptor.transferDirection = write ? SdTransferDirection.Write : SdTransferDirection.Read;
- commandDescriptor.transferType = flags.HasFlag(MmcFlags.CommandADTC)
+ commandDescriptor.transferType = flags.HasFlag(MmcFlags.CommandAdtc)
? SdTransferType.SingleBlock
: SdTransferType.CmdOnly;
commandDescriptor.responseType = 0;
- if(flags.HasFlag(MmcFlags.Response_R1) || flags.HasFlag(MmcFlags.ResponseSPI_R1))
+ if(flags.HasFlag(MmcFlags.ResponseR1) || flags.HasFlag(MmcFlags.ResponseSpiR1))
commandDescriptor.responseType = SdResponseType.R1;
- if(flags.HasFlag(MmcFlags.Response_R1b) || flags.HasFlag(MmcFlags.ResponseSPI_R1b))
+ if(flags.HasFlag(MmcFlags.ResponseR1B) || flags.HasFlag(MmcFlags.ResponseSpiR1B))
commandDescriptor.responseType = SdResponseType.R1b;
- if(flags.HasFlag(MmcFlags.Response_R2) || flags.HasFlag(MmcFlags.ResponseSPI_R2))
+ if(flags.HasFlag(MmcFlags.ResponseR2) || flags.HasFlag(MmcFlags.ResponseSpiR2))
commandDescriptor.responseType = SdResponseType.R2;
- if(flags.HasFlag(MmcFlags.Response_R3) || flags.HasFlag(MmcFlags.ResponseSPI_R3))
+ if(flags.HasFlag(MmcFlags.ResponseR3) || flags.HasFlag(MmcFlags.ResponseSpiR3))
commandDescriptor.responseType = SdResponseType.R3;
- if(flags.HasFlag(MmcFlags.Response_R4) || flags.HasFlag(MmcFlags.ResponseSPI_R4))
+ if(flags.HasFlag(MmcFlags.ResponseR4) || flags.HasFlag(MmcFlags.ResponseSpiR4))
commandDescriptor.responseType = SdResponseType.R4;
- if(flags.HasFlag(MmcFlags.Response_R5) || flags.HasFlag(MmcFlags.ResponseSPI_R5))
+ if(flags.HasFlag(MmcFlags.ResponseR5) || flags.HasFlag(MmcFlags.ResponseSpiR5))
commandDescriptor.responseType = SdResponseType.R5;
- if(flags.HasFlag(MmcFlags.Response_R6)) commandDescriptor.responseType = SdResponseType.R6;
+ if(flags.HasFlag(MmcFlags.ResponseR6)) commandDescriptor.responseType = SdResponseType.R6;
- byte[] command_b = new byte[commandData.size + commandData.protocolArgumentSize +
+ byte[] commandB = new byte[commandData.size + commandData.protocolArgumentSize +
commandData.deviceDataBufferSize];
- IntPtr hBuf = Marshal.AllocHGlobal(command_b.Length);
+ IntPtr hBuf = Marshal.AllocHGlobal(commandB.Length);
Marshal.StructureToPtr(commandData, hBuf, true);
IntPtr descriptorOffset = new IntPtr(hBuf.ToInt32() + commandData.size);
Marshal.StructureToPtr(commandDescriptor, descriptorOffset, true);
- Marshal.Copy(hBuf, command_b, 0, command_b.Length);
+ Marshal.Copy(hBuf, commandB, 0, commandB.Length);
Marshal.FreeHGlobal(hBuf);
uint bytesReturned;
int error = 0;
DateTime start = DateTime.Now;
- sense = !Extern.DeviceIoControl(fd, WindowsIoctl.IOCTL_SFFDISK_DEVICE_COMMAND, command_b,
- (uint)command_b.Length, command_b, (uint)command_b.Length,
+ sense = !Extern.DeviceIoControl(fd, WindowsIoctl.IoctlSffdiskDeviceCommand, commandB,
+ (uint)commandB.Length, commandB, (uint)commandB.Length,
out bytesReturned, IntPtr.Zero);
DateTime end = DateTime.Now;
if(sense) error = Marshal.GetLastWin32Error();
buffer = new byte[blockSize * blocks];
- Buffer.BlockCopy(command_b, command_b.Length - buffer.Length, buffer, 0, buffer.Length);
+ Buffer.BlockCopy(commandB, commandB.Length - buffer.Length, buffer, 0, buffer.Length);
response = new uint[4];
duration = (end - start).TotalMilliseconds;
diff --git a/DiscImageChef.Devices/Windows/Enums.cs b/DiscImageChef.Devices/Windows/Enums.cs
index 232534434..dd0585a65 100644
--- a/DiscImageChef.Devices/Windows/Enums.cs
+++ b/DiscImageChef.Devices/Windows/Enums.cs
@@ -213,11 +213,11 @@ namespace DiscImageChef.Devices.Windows
///
/// FILE_READ_EA
///
- ReadEA = 0x0008,
+ ReadEa = 0x0008,
///
/// FILE_WRITE_EA
///
- WriteEA = 0x0010,
+ WriteEa = 0x0010,
///
/// FILE_EXECUTE
///
@@ -326,25 +326,25 @@ namespace DiscImageChef.Devices.Windows
enum WindowsIoctl : uint
{
- IOCTL_ATA_PASS_THROUGH = 0x4D02C,
- IOCTL_ATA_PASS_THROUGH_DIRECT = 0x4D030,
+ IoctlAtaPassThrough = 0x4D02C,
+ IoctlAtaPassThroughDirect = 0x4D030,
///
/// ScsiPassThrough
///
- IOCTL_SCSI_PASS_THROUGH = 0x4D004,
+ IoctlScsiPassThrough = 0x4D004,
///
/// ScsiPassThroughDirect
///
- IOCTL_SCSI_PASS_THROUGH_DIRECT = 0x4D014,
+ IoctlScsiPassThroughDirect = 0x4D014,
///
/// ScsiGetAddress
///
- IOCTL_SCSI_GET_ADDRESS = 0x41018,
- IOCTL_STORAGE_QUERY_PROPERTY = 0x2D1400,
- IOCTL_IDE_PASS_THROUGH = 0x4D028,
- IOCTL_STORAGE_GET_DEVICE_NUMBER = 0x2D1080,
- IOCTL_SFFDISK_QUERY_DEVICE_PROTOCOL = 0x71E80,
- IOCTL_SFFDISK_DEVICE_COMMAND = 0x79E84,
+ IoctlScsiGetAddress = 0x41018,
+ IoctlStorageQueryProperty = 0x2D1400,
+ IoctlIdePassThrough = 0x4D028,
+ IoctlStorageGetDeviceNumber = 0x2D1080,
+ IoctlSffdiskQueryDeviceProtocol = 0x71E80,
+ IoctlSffdiskDeviceCommand = 0x79E84,
}
[Flags]
@@ -369,7 +369,7 @@ namespace DiscImageChef.Devices.Windows
///
/// ATA_FLAGS_USE_DMA
///
- DMA = 0x10,
+ Dma = 0x10,
///
/// ATA_FLAGS_NO_MULTIPLE
///
@@ -389,7 +389,7 @@ namespace DiscImageChef.Devices.Windows
Trim = 8,
WriteAggregation = 9,
Telemetry = 10,
- LBProvisioning = 11,
+ LbProvisioning = 11,
Power = 12,
Copyoffload = 13,
Resiliency = 14
@@ -495,8 +495,8 @@ namespace DiscImageChef.Devices.Windows
static class Consts
{
- public static Guid GUID_SFF_PROTOCOL_SD = new Guid("AD7536A8-D055-4C40-AA4D-96312DDB6B38");
- public static Guid GUID_DEVINTERFACE_DISK =
+ public static Guid GuidSffProtocolSd = new Guid("AD7536A8-D055-4C40-AA4D-96312DDB6B38");
+ public static Guid GuidDevinterfaceDisk =
new Guid(0x53F56307, 0xB6BF, 0x11D0, 0x94, 0xF2, 0x00, 0xA0, 0xC9, 0x1E, 0xFB, 0x8B);
}
}
\ No newline at end of file
diff --git a/DiscImageChef.Devices/Windows/Extern.cs b/DiscImageChef.Devices/Windows/Extern.cs
index 3e80bc661..5e3104126 100644
--- a/DiscImageChef.Devices/Windows/Extern.cs
+++ b/DiscImageChef.Devices/Windows/Extern.cs
@@ -49,51 +49,51 @@ namespace DiscImageChef.Devices.Windows
FileAttributes flagsAndAttributes, IntPtr templateFile);
[DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "DeviceIoControl", CharSet = CharSet.Auto)]
- internal static extern bool DeviceIoControlScsi(SafeFileHandle hDevice, WindowsIoctl IoControlCode,
- ref ScsiPassThroughDirectAndSenseBuffer InBuffer,
+ internal static extern bool DeviceIoControlScsi(SafeFileHandle hDevice, WindowsIoctl ioControlCode,
+ ref ScsiPassThroughDirectAndSenseBuffer inBuffer,
uint nInBufferSize,
- ref ScsiPassThroughDirectAndSenseBuffer OutBuffer,
+ ref ScsiPassThroughDirectAndSenseBuffer outBuffer,
uint nOutBufferSize, ref uint pBytesReturned,
- IntPtr Overlapped);
+ IntPtr overlapped);
[DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "DeviceIoControl", CharSet = CharSet.Auto)]
- internal static extern bool DeviceIoControlAta(SafeFileHandle hDevice, WindowsIoctl IoControlCode,
- ref AtaPassThroughDirectWithBuffer InBuffer, uint nInBufferSize,
- ref AtaPassThroughDirectWithBuffer OutBuffer,
- uint nOutBufferSize, ref uint pBytesReturned, IntPtr Overlapped);
+ internal static extern bool DeviceIoControlAta(SafeFileHandle hDevice, WindowsIoctl ioControlCode,
+ ref AtaPassThroughDirectWithBuffer inBuffer, uint nInBufferSize,
+ ref AtaPassThroughDirectWithBuffer outBuffer,
+ uint nOutBufferSize, ref uint pBytesReturned, IntPtr overlapped);
[DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "DeviceIoControl", CharSet = CharSet.Auto)]
- internal static extern bool DeviceIoControlStorageQuery(SafeFileHandle hDevice, WindowsIoctl IoControlCode,
- ref StoragePropertyQuery InBuffer, uint nInBufferSize,
- IntPtr OutBuffer, uint nOutBufferSize,
- ref uint pBytesReturned, IntPtr Overlapped);
+ internal static extern bool DeviceIoControlStorageQuery(SafeFileHandle hDevice, WindowsIoctl ioControlCode,
+ ref StoragePropertyQuery inBuffer, uint nInBufferSize,
+ IntPtr outBuffer, uint nOutBufferSize,
+ ref uint pBytesReturned, IntPtr overlapped);
[DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "DeviceIoControl", CharSet = CharSet.Auto)]
- internal static extern bool DeviceIoControlIde(SafeFileHandle hDevice, WindowsIoctl IoControlCode,
- ref IdePassThroughDirect InBuffer, uint nInBufferSize,
- ref IdePassThroughDirect OutBuffer, uint nOutBufferSize,
- ref uint pBytesReturned, IntPtr Overlapped);
+ internal static extern bool DeviceIoControlIde(SafeFileHandle hDevice, WindowsIoctl ioControlCode,
+ ref IdePassThroughDirect inBuffer, uint nInBufferSize,
+ ref IdePassThroughDirect outBuffer, uint nOutBufferSize,
+ ref uint pBytesReturned, IntPtr overlapped);
[DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "DeviceIoControl", CharSet = CharSet.Auto)]
- internal static extern bool DeviceIoControlGetDeviceNumber(SafeFileHandle hDevice, WindowsIoctl IoControlCode,
- IntPtr InBuffer, uint nInBufferSize,
- ref StorageDeviceNumber OutBuffer,
+ internal static extern bool DeviceIoControlGetDeviceNumber(SafeFileHandle hDevice, WindowsIoctl ioControlCode,
+ IntPtr inBuffer, uint nInBufferSize,
+ ref StorageDeviceNumber outBuffer,
uint nOutBufferSize, ref uint pBytesReturned,
- IntPtr Overlapped);
+ IntPtr overlapped);
[DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "DeviceIoControl", CharSet = CharSet.Auto)]
- internal static extern bool DeviceIoControl(SafeFileHandle hDevice, WindowsIoctl IoControlCode, IntPtr InBuffer,
- uint nInBufferSize, ref SffdiskQueryDeviceProtocolData OutBuffer,
- uint nOutBufferSize, out uint pBytesReturned, IntPtr Overlapped);
+ internal static extern bool DeviceIoControl(SafeFileHandle hDevice, WindowsIoctl ioControlCode, IntPtr inBuffer,
+ uint nInBufferSize, ref SffdiskQueryDeviceProtocolData outBuffer,
+ uint nOutBufferSize, out uint pBytesReturned, IntPtr overlapped);
[DllImport("Kernel32.dll", SetLastError = true, EntryPoint = "DeviceIoControl", CharSet = CharSet.Auto)]
- internal static extern bool DeviceIoControl(SafeFileHandle hDevice, WindowsIoctl IoControlCode, byte[] InBuffer,
- uint nInBufferSize, byte[] OutBuffer, uint nOutBufferSize,
- out uint pBytesReturned, IntPtr Overlapped);
+ internal static extern bool DeviceIoControl(SafeFileHandle hDevice, WindowsIoctl ioControlCode, byte[] inBuffer,
+ uint nInBufferSize, byte[] outBuffer, uint nOutBufferSize,
+ out uint pBytesReturned, IntPtr overlapped);
[DllImport("setupapi.dll", CharSet = CharSet.Auto)]
- internal static extern SafeFileHandle SetupDiGetClassDevs(ref Guid ClassGuid, IntPtr Enumerator,
- IntPtr hwndParent, DeviceGetClassFlags Flags);
+ internal static extern SafeFileHandle SetupDiGetClassDevs(ref Guid classGuid, IntPtr enumerator,
+ IntPtr hwndParent, DeviceGetClassFlags flags);
[DllImport("setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern bool SetupDiEnumDeviceInterfaces(SafeFileHandle hDevInfo, IntPtr devInfo,
diff --git a/DiscImageChef.Devices/Windows/ListDevices.cs b/DiscImageChef.Devices/Windows/ListDevices.cs
index e7ad8fe4b..d7378ee98 100644
--- a/DiscImageChef.Devices/Windows/ListDevices.cs
+++ b/DiscImageChef.Devices/Windows/ListDevices.cs
@@ -43,7 +43,7 @@ namespace DiscImageChef.Devices.Windows
{
internal static DeviceInfo[] GetList()
{
- List DeviceIDs = new List();
+ List deviceIDs = new List();
try
{
@@ -51,17 +51,17 @@ namespace DiscImageChef.Devices.Windows
new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive");
ManagementObjectCollection objCol = mgmtObjSearcher.Get();
- foreach(ManagementObject drive in objCol) DeviceIDs.Add((string)drive["DeviceID"]);
+ foreach(ManagementObject drive in objCol) deviceIDs.Add((string)drive["DeviceID"]);
mgmtObjSearcher = new ManagementObjectSearcher("SELECT * FROM Win32_TapeDrive");
objCol = mgmtObjSearcher.Get();
- foreach(ManagementObject drive in objCol) DeviceIDs.Add((string)drive["DeviceID"]);
+ foreach(ManagementObject drive in objCol) deviceIDs.Add((string)drive["DeviceID"]);
mgmtObjSearcher = new ManagementObjectSearcher("SELECT * FROM Win32_CDROMDrive");
objCol = mgmtObjSearcher.Get();
- foreach(ManagementObject drive in objCol) DeviceIDs.Add((string)drive["Drive"]);
+ foreach(ManagementObject drive in objCol) deviceIDs.Add((string)drive["Drive"]);
}
catch(Exception ex)
{
@@ -72,9 +72,9 @@ namespace DiscImageChef.Devices.Windows
#endif
}
- List dev_list = new List();
+ List devList = new List();
- foreach(string devId in DeviceIDs)
+ foreach(string devId in deviceIDs)
{
string physId = devId;
// TODO: This can be done better
@@ -92,56 +92,56 @@ namespace DiscImageChef.Devices.Windows
//descriptor.RawDeviceProperties = new byte[16384];
IntPtr descriptorPtr = Marshal.AllocHGlobal(1000);
- byte[] descriptor_b = new byte[1000];
+ byte[] descriptorB = new byte[1000];
uint returned = 0;
int error = 0;
- bool hasError = !Extern.DeviceIoControlStorageQuery(fd, WindowsIoctl.IOCTL_STORAGE_QUERY_PROPERTY,
+ bool hasError = !Extern.DeviceIoControlStorageQuery(fd, WindowsIoctl.IoctlStorageQueryProperty,
ref query, (uint)Marshal.SizeOf(query),
descriptorPtr, 1000, ref returned, IntPtr.Zero);
if(hasError) error = Marshal.GetLastWin32Error();
- Marshal.Copy(descriptorPtr, descriptor_b, 0, 1000);
+ Marshal.Copy(descriptorPtr, descriptorB, 0, 1000);
if(hasError && error != 0) continue;
StorageDeviceDescriptor descriptor = new StorageDeviceDescriptor();
- descriptor.Version = BitConverter.ToUInt32(descriptor_b, 0);
- descriptor.Size = BitConverter.ToUInt32(descriptor_b, 4);
- descriptor.DeviceType = descriptor_b[8];
- descriptor.DeviceTypeModifier = descriptor_b[9];
- descriptor.RemovableMedia = BitConverter.ToBoolean(descriptor_b, 10);
- descriptor.CommandQueueing = BitConverter.ToBoolean(descriptor_b, 11);
- descriptor.VendorIdOffset = BitConverter.ToUInt32(descriptor_b, 12);
- descriptor.ProductIdOffset = BitConverter.ToUInt32(descriptor_b, 16);
- descriptor.ProductRevisionOffset = BitConverter.ToUInt32(descriptor_b, 20);
- descriptor.SerialNumberOffset = BitConverter.ToUInt32(descriptor_b, 24);
- descriptor.BusType = (StorageBusType)BitConverter.ToUInt32(descriptor_b, 28);
- descriptor.RawPropertiesLength = BitConverter.ToUInt32(descriptor_b, 32);
+ descriptor.Version = BitConverter.ToUInt32(descriptorB, 0);
+ descriptor.Size = BitConverter.ToUInt32(descriptorB, 4);
+ descriptor.DeviceType = descriptorB[8];
+ descriptor.DeviceTypeModifier = descriptorB[9];
+ descriptor.RemovableMedia = BitConverter.ToBoolean(descriptorB, 10);
+ descriptor.CommandQueueing = BitConverter.ToBoolean(descriptorB, 11);
+ descriptor.VendorIdOffset = BitConverter.ToUInt32(descriptorB, 12);
+ descriptor.ProductIdOffset = BitConverter.ToUInt32(descriptorB, 16);
+ descriptor.ProductRevisionOffset = BitConverter.ToUInt32(descriptorB, 20);
+ descriptor.SerialNumberOffset = BitConverter.ToUInt32(descriptorB, 24);
+ descriptor.BusType = (StorageBusType)BitConverter.ToUInt32(descriptorB, 28);
+ descriptor.RawPropertiesLength = BitConverter.ToUInt32(descriptorB, 32);
- DeviceInfo info = new DeviceInfo {path = physId, bus = descriptor.BusType.ToString()};
+ DeviceInfo info = new DeviceInfo {Path = physId, Bus = descriptor.BusType.ToString()};
if(descriptor.VendorIdOffset > 0)
- info.vendor =
- StringHandlers.CToString(descriptor_b, Encoding.ASCII, start: (int)descriptor.VendorIdOffset);
+ info.Vendor =
+ StringHandlers.CToString(descriptorB, Encoding.ASCII, start: (int)descriptor.VendorIdOffset);
if(descriptor.ProductIdOffset > 0)
- info.model =
- StringHandlers.CToString(descriptor_b, Encoding.ASCII, start: (int)descriptor.ProductIdOffset);
+ info.Model =
+ StringHandlers.CToString(descriptorB, Encoding.ASCII, start: (int)descriptor.ProductIdOffset);
// TODO: Get serial number of SCSI and USB devices, probably also FireWire (untested)
if(descriptor.SerialNumberOffset > 0)
- info.serial =
- StringHandlers.CToString(descriptor_b, Encoding.ASCII,
+ info.Serial =
+ StringHandlers.CToString(descriptorB, Encoding.ASCII,
start: (int)descriptor.SerialNumberOffset);
- if(string.IsNullOrEmpty(info.vendor) || info.vendor == "ATA")
+ if(string.IsNullOrEmpty(info.Vendor) || info.Vendor == "ATA")
{
- string[] pieces = info.model.Split(' ');
+ string[] pieces = info.Model.Split(' ');
if(pieces.Length > 1)
{
- info.vendor = pieces[0];
- info.model = info.model.Substring(pieces[0].Length + 1);
+ info.Vendor = pieces[0];
+ info.Model = info.Model.Substring(pieces[0].Length + 1);
}
}
@@ -157,15 +157,15 @@ namespace DiscImageChef.Devices.Windows
case StorageBusType.iSCSI:
case StorageBusType.SAS:
case StorageBusType.SATA:
- info.supported = true;
+ info.Supported = true;
break;
}
Marshal.FreeHGlobal(descriptorPtr);
- dev_list.Add(info);
+ devList.Add(info);
}
- DeviceInfo[] devices = dev_list.ToArray();
+ DeviceInfo[] devices = devList.ToArray();
return devices;
}
diff --git a/DiscImageChef.Devices/Windows/Structs.cs b/DiscImageChef.Devices/Windows/Structs.cs
index 37e9b5d1e..e64ac0841 100644
--- a/DiscImageChef.Devices/Windows/Structs.cs
+++ b/DiscImageChef.Devices/Windows/Structs.cs
@@ -219,7 +219,7 @@ namespace DiscImageChef.Devices.Windows
}
[StructLayout(LayoutKind.Sequential)]
- struct USB_SETUP_PACKET
+ struct UsbSetupPacket
{
public byte bmRequest;
public byte bRequest;
@@ -229,10 +229,10 @@ namespace DiscImageChef.Devices.Windows
}
[StructLayout(LayoutKind.Sequential)]
- struct USB_DESCRIPTOR_REQUEST
+ struct UsbDescriptorRequest
{
public int ConnectionIndex;
- public USB_SETUP_PACKET SetupPacket;
+ public UsbSetupPacket SetupPacket;
//public byte[] Data;
}
diff --git a/DiscImageChef.Devices/Windows/Usb.cs b/DiscImageChef.Devices/Windows/Usb.cs
index 4bc10bff6..91b2fce91 100644
--- a/DiscImageChef.Devices/Windows/Usb.cs
+++ b/DiscImageChef.Devices/Windows/Usb.cs
@@ -79,10 +79,10 @@ namespace DiscImageChef.Devices.Windows
// UsbHub,
// UsbMIParent
//} USB_HUB_NODE;
- enum USB_HUB_NODE
+ enum UsbHubNode
{
UsbHub,
- UsbMIParent
+ UsbMiParent
}
//typedef enum _USB_CONNECTION_STATUS {
@@ -96,7 +96,7 @@ namespace DiscImageChef.Devices.Windows
// DeviceHubNestedTooDeeply,
// DeviceInLegacyHub
//} USB_CONNECTION_STATUS, *PUSB_CONNECTION_STATUS;
- enum USB_CONNECTION_STATUS
+ enum UsbConnectionStatus
{
NoDeviceConnected,
DeviceConnected,
@@ -114,7 +114,7 @@ namespace DiscImageChef.Devices.Windows
// UsbFullSpeed,
// UsbHighSpeed
//} USB_DEVICE_SPEED;
- enum USB_DEVICE_SPEED : byte
+ enum UsbDeviceSpeed : byte
{
UsbLowSpeed,
UsbFullSpeed,
@@ -130,7 +130,7 @@ namespace DiscImageChef.Devices.Windows
// ULONG_PTR Reserved;
//} SP_DEVINFO_DATA, *PSP_DEVINFO_DATA;
[StructLayout(LayoutKind.Sequential)]
- struct SP_DEVINFO_DATA
+ struct SpDevinfoData
{
internal int cbSize;
internal Guid ClassGuid;
@@ -145,7 +145,7 @@ namespace DiscImageChef.Devices.Windows
// ULONG_PTR Reserved;
//} SP_DEVICE_INTERFACE_DATA, *PSP_DEVICE_INTERFACE_DATA;
[StructLayout(LayoutKind.Sequential)]
- struct SP_DEVICE_INTERFACE_DATA
+ struct SpDeviceInterfaceData
{
internal int cbSize;
internal Guid InterfaceClassGuid;
@@ -158,7 +158,7 @@ namespace DiscImageChef.Devices.Windows
// TCHAR DevicePath[ANYSIZE_ARRAY];
//} SP_DEVICE_INTERFACE_DETAIL_DATA, *PSP_DEVICE_INTERFACE_DETAIL_DATA;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
- struct SP_DEVICE_INTERFACE_DETAIL_DATA
+ struct SpDeviceInterfaceDetailData
{
internal int cbSize;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = BUFFER_SIZE)] internal string DevicePath;
@@ -169,7 +169,7 @@ namespace DiscImageChef.Devices.Windows
// WCHAR DriverKeyName[1];
//} USB_HCD_DRIVERKEY_NAME, *PUSB_HCD_DRIVERKEY_NAME;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
- struct USB_HCD_DRIVERKEY_NAME
+ struct UsbHcdDriverkeyName
{
internal int ActualLength;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = BUFFER_SIZE)] internal string DriverKeyName;
@@ -180,7 +180,7 @@ namespace DiscImageChef.Devices.Windows
// WCHAR RootHubName[1];
//} USB_ROOT_HUB_NAME, *PUSB_ROOT_HUB_NAME;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
- struct USB_ROOT_HUB_NAME
+ struct UsbRootHubName
{
internal int ActualLength;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = BUFFER_SIZE)] internal string RootHubName;
@@ -196,7 +196,7 @@ namespace DiscImageChef.Devices.Windows
// UCHAR bRemoveAndPowerMask[64];
//} USB_HUB_DESCRIPTOR, *PUSB_HUB_DESCRIPTOR;
[StructLayout(LayoutKind.Sequential, Pack = 1)]
- struct USB_HUB_DESCRIPTOR
+ struct UsbHubDescriptor
{
internal byte bDescriptorLength;
internal byte bDescriptorType;
@@ -212,9 +212,9 @@ namespace DiscImageChef.Devices.Windows
// BOOLEAN HubIsBusPowered;
//} USB_HUB_INFORMATION, *PUSB_HUB_INFORMATION;
[StructLayout(LayoutKind.Sequential)]
- struct USB_HUB_INFORMATION
+ struct UsbHubInformation
{
- internal USB_HUB_DESCRIPTOR HubDescriptor;
+ internal UsbHubDescriptor HubDescriptor;
internal byte HubIsBusPowered;
}
@@ -226,10 +226,10 @@ namespace DiscImageChef.Devices.Windows
// } u;
//} USB_NODE_INFORMATION, *PUSB_NODE_INFORMATION;
[StructLayout(LayoutKind.Sequential)]
- struct USB_NODE_INFORMATION
+ struct UsbNodeInformation
{
internal int NodeType;
- internal USB_HUB_INFORMATION HubInformation; // Yeah, I'm assuming we'll just use the first form
+ internal UsbHubInformation HubInformation; // Yeah, I'm assuming we'll just use the first form
}
//typedef struct _USB_NODE_CONNECTION_INFORMATION_EX {
@@ -244,10 +244,10 @@ namespace DiscImageChef.Devices.Windows
// USB_PIPE_INFO PipeList[0];
//} USB_NODE_CONNECTION_INFORMATION_EX, *PUSB_NODE_CONNECTION_INFORMATION_EX;
[StructLayout(LayoutKind.Sequential, Pack = 1)]
- struct USB_NODE_CONNECTION_INFORMATION_EX
+ struct UsbNodeConnectionInformationEx
{
internal int ConnectionIndex;
- internal USB_DEVICE_DESCRIPTOR DeviceDescriptor;
+ internal UsbDeviceDescriptor DeviceDescriptor;
internal byte CurrentConfigurationValue;
internal byte Speed;
internal byte DeviceIsHub;
@@ -275,7 +275,7 @@ namespace DiscImageChef.Devices.Windows
// UCHAR bNumConfigurations;
//} USB_DEVICE_DESCRIPTOR, *PUSB_DEVICE_DESCRIPTOR ;
[StructLayout(LayoutKind.Sequential, Pack = 1)]
- internal struct USB_DEVICE_DESCRIPTOR
+ internal struct UsbDeviceDescriptor
{
internal byte bLength;
internal byte bDescriptorType;
@@ -299,7 +299,7 @@ namespace DiscImageChef.Devices.Windows
// WCHAR bString[1];
//} USB_STRING_DESCRIPTOR, *PUSB_STRING_DESCRIPTOR;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
- struct USB_STRING_DESCRIPTOR
+ struct UsbStringDescriptor
{
internal byte bLength;
internal byte bDescriptorType;
@@ -318,7 +318,7 @@ namespace DiscImageChef.Devices.Windows
// UCHAR Data[0];
//} USB_DESCRIPTOR_REQUEST, *PUSB_DESCRIPTOR_REQUEST
[StructLayout(LayoutKind.Sequential)]
- struct USB_SETUP_PACKET
+ struct UsbSetupPacket
{
internal byte bmRequest;
internal byte bRequest;
@@ -328,11 +328,11 @@ namespace DiscImageChef.Devices.Windows
}
[StructLayout(LayoutKind.Sequential)]
- struct USB_DESCRIPTOR_REQUEST
+ struct UsbDescriptorRequest
{
internal int ConnectionIndex;
- internal USB_SETUP_PACKET SetupPacket;
+ internal UsbSetupPacket SetupPacket;
//internal byte[] Data;
}
@@ -342,7 +342,7 @@ namespace DiscImageChef.Devices.Windows
// WCHAR NodeName[1];
//} USB_NODE_CONNECTION_NAME, *PUSB_NODE_CONNECTION_NAME;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
- struct USB_NODE_CONNECTION_NAME
+ struct UsbNodeConnectionName
{
internal int ConnectionIndex;
internal int ActualLength;
@@ -355,7 +355,7 @@ namespace DiscImageChef.Devices.Windows
// WCHAR DriverKeyName[1];
//} USB_NODE_CONNECTION_DRIVERKEY_NAME, *PUSB_NODE_CONNECTION_DRIVERKEY_NAME;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
- struct USB_NODE_CONNECTION_DRIVERKEY_NAME // Yes, this is the same as the structure above...
+ struct UsbNodeConnectionDriverkeyName // Yes, this is the same as the structure above...
{
internal int ConnectionIndex;
internal int ActualLength;
@@ -372,10 +372,10 @@ namespace DiscImageChef.Devices.Windows
//);
[DllImport("setupapi.dll", CharSet = CharSet.Auto)]
static extern IntPtr SetupDiGetClassDevs( // 1st form using a ClassGUID
- ref Guid ClassGuid, int Enumerator, IntPtr hwndParent, int Flags);
+ ref Guid classGuid, int enumerator, IntPtr hwndParent, int flags);
[DllImport("setupapi.dll", CharSet = CharSet.Auto)] // 2nd form uses an Enumerator
- static extern IntPtr SetupDiGetClassDevs(int ClassGuid, string Enumerator, IntPtr hwndParent, int Flags);
+ static extern IntPtr SetupDiGetClassDevs(int classGuid, string enumerator, IntPtr hwndParent, int flags);
//BOOL SetupDiEnumDeviceInterfaces(
// HDEVINFO DeviceInfoSet,
@@ -385,9 +385,9 @@ namespace DiscImageChef.Devices.Windows
// PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData
//);
[DllImport("setupapi.dll", SetLastError = true, CharSet = CharSet.Auto)]
- static extern bool SetupDiEnumDeviceInterfaces(IntPtr DeviceInfoSet, IntPtr DeviceInfoData,
- ref Guid InterfaceClassGuid, int MemberIndex,
- ref SP_DEVICE_INTERFACE_DATA DeviceInterfaceData);
+ static extern bool SetupDiEnumDeviceInterfaces(IntPtr deviceInfoSet, IntPtr deviceInfoData,
+ ref Guid interfaceClassGuid, int memberIndex,
+ ref SpDeviceInterfaceData deviceInterfaceData);
//BOOL SetupDiGetDeviceInterfaceDetail(
// HDEVINFO DeviceInfoSet,
@@ -398,12 +398,12 @@ namespace DiscImageChef.Devices.Windows
// PSP_DEVINFO_DATA DeviceInfoData
//);
[DllImport("setupapi.dll", SetLastError = true, CharSet = CharSet.Auto)]
- static extern bool SetupDiGetDeviceInterfaceDetail(IntPtr DeviceInfoSet,
- ref SP_DEVICE_INTERFACE_DATA DeviceInterfaceData,
- ref SP_DEVICE_INTERFACE_DETAIL_DATA
- DeviceInterfaceDetailData,
- int DeviceInterfaceDetailDataSize, ref int RequiredSize,
- ref SP_DEVINFO_DATA DeviceInfoData);
+ static extern bool SetupDiGetDeviceInterfaceDetail(IntPtr deviceInfoSet,
+ ref SpDeviceInterfaceData deviceInterfaceData,
+ ref SpDeviceInterfaceDetailData
+ deviceInterfaceDetailData,
+ int deviceInterfaceDetailDataSize, ref int requiredSize,
+ ref SpDevinfoData deviceInfoData);
//BOOL SetupDiGetDeviceRegistryProperty(
// HDEVINFO DeviceInfoSet,
@@ -415,10 +415,10 @@ namespace DiscImageChef.Devices.Windows
// PDWORD RequiredSize
//);
[DllImport("setupapi.dll", SetLastError = true, CharSet = CharSet.Auto)]
- static extern bool SetupDiGetDeviceRegistryProperty(IntPtr DeviceInfoSet, ref SP_DEVINFO_DATA DeviceInfoData,
- int iProperty, ref int PropertyRegDataType,
- IntPtr PropertyBuffer, int PropertyBufferSize,
- ref int RequiredSize);
+ static extern bool SetupDiGetDeviceRegistryProperty(IntPtr deviceInfoSet, ref SpDevinfoData deviceInfoData,
+ int iProperty, ref int propertyRegDataType,
+ IntPtr propertyBuffer, int propertyBufferSize,
+ ref int requiredSize);
//BOOL SetupDiEnumDeviceInfo(
// HDEVINFO DeviceInfoSet,
@@ -426,14 +426,14 @@ namespace DiscImageChef.Devices.Windows
// PSP_DEVINFO_DATA DeviceInfoData
//);
[DllImport("setupapi.dll", SetLastError = true, CharSet = CharSet.Auto)]
- static extern bool SetupDiEnumDeviceInfo(IntPtr DeviceInfoSet, int MemberIndex,
- ref SP_DEVINFO_DATA DeviceInfoData);
+ static extern bool SetupDiEnumDeviceInfo(IntPtr deviceInfoSet, int memberIndex,
+ ref SpDevinfoData deviceInfoData);
//BOOL SetupDiDestroyDeviceInfoList(
// HDEVINFO DeviceInfoSet
//);
[DllImport("setupapi.dll", SetLastError = true)]
- static extern bool SetupDiDestroyDeviceInfoList(IntPtr DeviceInfoSet);
+ static extern bool SetupDiDestroyDeviceInfoList(IntPtr deviceInfoSet);
//WINSETUPAPI BOOL WINAPI SetupDiGetDeviceInstanceId(
// IN HDEVINFO DeviceInfoSet,
@@ -443,9 +443,9 @@ namespace DiscImageChef.Devices.Windows
// OUT PDWORD RequiredSize OPTIONAL
//);
[DllImport("setupapi.dll", SetLastError = true, CharSet = CharSet.Auto)]
- static extern bool SetupDiGetDeviceInstanceId(IntPtr DeviceInfoSet, ref SP_DEVINFO_DATA DeviceInfoData,
- StringBuilder DeviceInstanceId, int DeviceInstanceIdSize,
- out int RequiredSize);
+ static extern bool SetupDiGetDeviceInstanceId(IntPtr deviceInfoSet, ref SpDevinfoData deviceInfoData,
+ StringBuilder deviceInstanceId, int deviceInstanceIdSize,
+ out int requiredSize);
//BOOL DeviceIoControl(
// HANDLE hDevice,
@@ -486,38 +486,38 @@ namespace DiscImageChef.Devices.Windows
//
// Return a list of USB Host Controllers
//
- static internal System.Collections.ObjectModel.ReadOnlyCollection GetHostControllers()
+ static internal System.Collections.ObjectModel.ReadOnlyCollection GetHostControllers()
{
- List HostList = new List();
- Guid HostGUID = new Guid(GUID_DEVINTERFACE_HUBCONTROLLER);
+ List hostList = new List();
+ Guid hostGuid = new Guid(GUID_DEVINTERFACE_HUBCONTROLLER);
// We start at the "root" of the device tree and look for all
// devices that match the interface GUID of a Hub Controller
- IntPtr h = SetupDiGetClassDevs(ref HostGUID, 0, IntPtr.Zero, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
+ IntPtr h = SetupDiGetClassDevs(ref hostGuid, 0, IntPtr.Zero, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
if(h.ToInt32() != INVALID_HANDLE_VALUE)
{
IntPtr ptrBuf = Marshal.AllocHGlobal(BUFFER_SIZE);
- bool Success;
+ bool success;
int i = 0;
do
{
- USBController host = new USBController();
+ UsbController host = new UsbController();
host.ControllerIndex = i;
// create a Device Interface Data structure
- SP_DEVICE_INTERFACE_DATA dia = new SP_DEVICE_INTERFACE_DATA();
+ SpDeviceInterfaceData dia = new SpDeviceInterfaceData();
dia.cbSize = Marshal.SizeOf(dia);
// start the enumeration
- Success = SetupDiEnumDeviceInterfaces(h, IntPtr.Zero, ref HostGUID, i, ref dia);
- if(Success)
+ success = SetupDiEnumDeviceInterfaces(h, IntPtr.Zero, ref hostGuid, i, ref dia);
+ if(success)
{
// build a DevInfo Data structure
- SP_DEVINFO_DATA da = new SP_DEVINFO_DATA();
+ SpDevinfoData da = new SpDevinfoData();
da.cbSize = Marshal.SizeOf(da);
// build a Device Interface Detail Data structure
- SP_DEVICE_INTERFACE_DETAIL_DATA didd = new SP_DEVICE_INTERFACE_DETAIL_DATA();
+ SpDeviceInterfaceDetailData didd = new SpDeviceInterfaceDetailData();
didd.cbSize = 4 + Marshal.SystemDefaultCharSize; // trust me :)
// now we can get some more detailed information
@@ -528,44 +528,44 @@ namespace DiscImageChef.Devices.Windows
host.ControllerDevicePath = didd.DevicePath;
// get the Device Description and DriverKeyName
- int RequiredSize = 0;
- int RegType = REG_SZ;
+ int requiredSize = 0;
+ int regType = REG_SZ;
- if(SetupDiGetDeviceRegistryProperty(h, ref da, SPDRP_DEVICEDESC, ref RegType, ptrBuf,
- BUFFER_SIZE, ref RequiredSize))
+ if(SetupDiGetDeviceRegistryProperty(h, ref da, SPDRP_DEVICEDESC, ref regType, ptrBuf,
+ BUFFER_SIZE, ref requiredSize))
{
host.ControllerDeviceDesc = Marshal.PtrToStringAuto(ptrBuf);
}
- if(SetupDiGetDeviceRegistryProperty(h, ref da, SPDRP_DRIVER, ref RegType, ptrBuf,
- BUFFER_SIZE, ref RequiredSize))
+ if(SetupDiGetDeviceRegistryProperty(h, ref da, SPDRP_DRIVER, ref regType, ptrBuf,
+ BUFFER_SIZE, ref requiredSize))
{
host.ControllerDriverKeyName = Marshal.PtrToStringAuto(ptrBuf);
}
}
- HostList.Add(host);
+ hostList.Add(host);
}
i++;
}
- while(Success);
+ while(success);
Marshal.FreeHGlobal(ptrBuf);
SetupDiDestroyDeviceInfoList(h);
}
// convert it into a Collection
- return new System.Collections.ObjectModel.ReadOnlyCollection(HostList);
+ return new System.Collections.ObjectModel.ReadOnlyCollection(hostList);
}
//
// The USB Host Controller Class
//
- internal class USBController
+ internal class UsbController
{
internal int ControllerIndex;
internal string ControllerDriverKeyName, ControllerDevicePath, ControllerDeviceDesc;
// A simple default constructor
- internal USBController()
+ internal UsbController()
{
ControllerIndex = 0;
ControllerDevicePath = "";
@@ -598,12 +598,12 @@ namespace DiscImageChef.Devices.Windows
}
// Return Root Hub for this Controller
- internal USBHub GetRootHub()
+ internal UsbHub GetRootHub()
{
IntPtr h, h2;
- USBHub Root = new USBHub();
- Root.HubIsRootHub = true;
- Root.HubDeviceDesc = "Root Hub";
+ UsbHub root = new UsbHub();
+ root.HubIsRootHub = true;
+ root.HubDeviceDesc = "Root Hub";
// Open a handle to the Host Controller
h = CreateFile(ControllerDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0,
@@ -611,39 +611,39 @@ namespace DiscImageChef.Devices.Windows
if(h.ToInt32() != INVALID_HANDLE_VALUE)
{
int nBytesReturned;
- USB_ROOT_HUB_NAME HubName = new USB_ROOT_HUB_NAME();
- int nBytes = Marshal.SizeOf(HubName);
+ UsbRootHubName hubName = new UsbRootHubName();
+ int nBytes = Marshal.SizeOf(hubName);
IntPtr ptrHubName = Marshal.AllocHGlobal(nBytes);
// get the Hub Name
if(DeviceIoControl(h, IOCTL_USB_GET_ROOT_HUB_NAME, ptrHubName, nBytes, ptrHubName, nBytes,
out nBytesReturned, IntPtr.Zero))
{
- HubName = (USB_ROOT_HUB_NAME)Marshal.PtrToStructure(ptrHubName, typeof(USB_ROOT_HUB_NAME));
- Root.HubDevicePath = @"\\.\" + HubName.RootHubName;
+ hubName = (UsbRootHubName)Marshal.PtrToStructure(ptrHubName, typeof(UsbRootHubName));
+ root.HubDevicePath = @"\\.\" + hubName.RootHubName;
}
// TODO: Get DriverKeyName for Root Hub
// Now let's open the Hub (based upon the HubName we got above)
- h2 = CreateFile(Root.HubDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0,
+ h2 = CreateFile(root.HubDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0,
IntPtr.Zero);
if(h2.ToInt32() != INVALID_HANDLE_VALUE)
{
- USB_NODE_INFORMATION NodeInfo = new USB_NODE_INFORMATION();
- NodeInfo.NodeType = (int)USB_HUB_NODE.UsbHub;
- nBytes = Marshal.SizeOf(NodeInfo);
+ UsbNodeInformation nodeInfo = new UsbNodeInformation();
+ nodeInfo.NodeType = (int)UsbHubNode.UsbHub;
+ nBytes = Marshal.SizeOf(nodeInfo);
IntPtr ptrNodeInfo = Marshal.AllocHGlobal(nBytes);
- Marshal.StructureToPtr(NodeInfo, ptrNodeInfo, true);
+ Marshal.StructureToPtr(nodeInfo, ptrNodeInfo, true);
// get the Hub Information
if(DeviceIoControl(h2, IOCTL_USB_GET_NODE_INFORMATION, ptrNodeInfo, nBytes, ptrNodeInfo, nBytes,
out nBytesReturned, IntPtr.Zero))
{
- NodeInfo = (USB_NODE_INFORMATION)Marshal.PtrToStructure(ptrNodeInfo,
- typeof(USB_NODE_INFORMATION));
- Root.HubIsBusPowered = Convert.ToBoolean(NodeInfo.HubInformation.HubIsBusPowered);
- Root.HubPortCount = NodeInfo.HubInformation.HubDescriptor.bNumberOfPorts;
+ nodeInfo = (UsbNodeInformation)Marshal.PtrToStructure(ptrNodeInfo,
+ typeof(UsbNodeInformation));
+ root.HubIsBusPowered = Convert.ToBoolean(nodeInfo.HubInformation.HubIsBusPowered);
+ root.HubPortCount = nodeInfo.HubInformation.HubDescriptor.bNumberOfPorts;
}
Marshal.FreeHGlobal(ptrNodeInfo);
CloseHandle(h2);
@@ -652,22 +652,22 @@ namespace DiscImageChef.Devices.Windows
Marshal.FreeHGlobal(ptrHubName);
CloseHandle(h);
}
- return Root;
+ return root;
}
}
//
// The Hub class
//
- internal class USBHub
+ internal class UsbHub
{
internal int HubPortCount;
internal string HubDriverKey, HubDevicePath, HubDeviceDesc;
- internal string HubManufacturer, HubProduct, HubSerialNumber, HubInstanceID;
+ internal string HubManufacturer, HubProduct, HubSerialNumber, HubInstanceId;
internal bool HubIsBusPowered, HubIsRootHub;
// a simple default constructor
- internal USBHub()
+ internal UsbHub()
{
HubPortCount = 0;
HubDevicePath = "";
@@ -678,7 +678,7 @@ namespace DiscImageChef.Devices.Windows
HubManufacturer = "";
HubProduct = "";
HubSerialNumber = "";
- HubInstanceID = "";
+ HubInstanceId = "";
}
// return Port Count
@@ -706,9 +706,9 @@ namespace DiscImageChef.Devices.Windows
}
// the device path of this device
- internal string InstanceID
+ internal string InstanceId
{
- get { return HubInstanceID; }
+ get { return HubInstanceId; }
}
// is is this a self-powered hub?
@@ -739,16 +739,16 @@ namespace DiscImageChef.Devices.Windows
}
// return a list of the down stream ports
- internal System.Collections.ObjectModel.ReadOnlyCollection GetPorts()
+ internal System.Collections.ObjectModel.ReadOnlyCollection GetPorts()
{
- List PortList = new List();
+ List portList = new List();
// Open a handle to the Hub device
IntPtr h = CreateFile(HubDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0,
IntPtr.Zero);
if(h.ToInt32() != INVALID_HANDLE_VALUE)
{
- int nBytes = Marshal.SizeOf(typeof(USB_NODE_CONNECTION_INFORMATION_EX));
+ int nBytes = Marshal.SizeOf(typeof(UsbNodeConnectionInformationEx));
IntPtr ptrNodeConnection = Marshal.AllocHGlobal(nBytes);
// loop thru all of the ports on the hub
@@ -756,34 +756,34 @@ namespace DiscImageChef.Devices.Windows
for(int i = 1; i <= HubPortCount; i++)
{
int nBytesReturned;
- USB_NODE_CONNECTION_INFORMATION_EX NodeConnection = new USB_NODE_CONNECTION_INFORMATION_EX();
- NodeConnection.ConnectionIndex = i;
- Marshal.StructureToPtr(NodeConnection, ptrNodeConnection, true);
+ UsbNodeConnectionInformationEx nodeConnection = new UsbNodeConnectionInformationEx();
+ nodeConnection.ConnectionIndex = i;
+ Marshal.StructureToPtr(nodeConnection, ptrNodeConnection, true);
if(DeviceIoControl(h, IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX, ptrNodeConnection, nBytes,
ptrNodeConnection, nBytes, out nBytesReturned, IntPtr.Zero))
{
- NodeConnection =
- (USB_NODE_CONNECTION_INFORMATION_EX)Marshal.PtrToStructure(ptrNodeConnection,
+ nodeConnection =
+ (UsbNodeConnectionInformationEx)Marshal.PtrToStructure(ptrNodeConnection,
typeof(
- USB_NODE_CONNECTION_INFORMATION_EX
+ UsbNodeConnectionInformationEx
));
// load up the USBPort class
- USBPort port = new USBPort();
+ UsbPort port = new UsbPort();
port.PortPortNumber = i;
port.PortHubDevicePath = HubDevicePath;
- USB_CONNECTION_STATUS Status = (USB_CONNECTION_STATUS)NodeConnection.ConnectionStatus;
- port.PortStatus = Status.ToString();
- USB_DEVICE_SPEED Speed = (USB_DEVICE_SPEED)NodeConnection.Speed;
- port.PortSpeed = Speed.ToString();
+ UsbConnectionStatus status = (UsbConnectionStatus)nodeConnection.ConnectionStatus;
+ port.PortStatus = status.ToString();
+ UsbDeviceSpeed speed = (UsbDeviceSpeed)nodeConnection.Speed;
+ port.PortSpeed = speed.ToString();
port.PortIsDeviceConnected =
- (NodeConnection.ConnectionStatus == (int)USB_CONNECTION_STATUS.DeviceConnected);
- port.PortIsHub = Convert.ToBoolean(NodeConnection.DeviceIsHub);
- port.PortDeviceDescriptor = NodeConnection.DeviceDescriptor;
+ (nodeConnection.ConnectionStatus == (int)UsbConnectionStatus.DeviceConnected);
+ port.PortIsHub = Convert.ToBoolean(nodeConnection.DeviceIsHub);
+ port.PortDeviceDescriptor = nodeConnection.DeviceDescriptor;
// add it to the list
- PortList.Add(port);
+ portList.Add(port);
}
}
@@ -791,22 +791,22 @@ namespace DiscImageChef.Devices.Windows
CloseHandle(h);
}
// convert it into a Collection
- return new System.Collections.ObjectModel.ReadOnlyCollection(PortList);
+ return new System.Collections.ObjectModel.ReadOnlyCollection(portList);
}
}
//
// The Port Class
//
- internal class USBPort
+ internal class UsbPort
{
internal int PortPortNumber;
internal string PortStatus, PortHubDevicePath, PortSpeed;
internal bool PortIsHub, PortIsDeviceConnected;
- internal USB_DEVICE_DESCRIPTOR PortDeviceDescriptor;
+ internal UsbDeviceDescriptor PortDeviceDescriptor;
// a simple default constructor
- internal USBPort()
+ internal UsbPort()
{
PortPortNumber = 0;
PortStatus = "";
@@ -853,17 +853,17 @@ namespace DiscImageChef.Devices.Windows
}
// return a down stream external hub
- internal USBDevice GetDevice()
+ internal UsbDevice GetDevice()
{
if(!PortIsDeviceConnected) { return null; }
- USBDevice Device = new USBDevice();
+ UsbDevice device = new UsbDevice();
// Copy over some values from the Port class
// Ya know, I've given some thought about making Device a derived class...
- Device.DevicePortNumber = PortPortNumber;
- Device.DeviceHubDevicePath = PortHubDevicePath;
- Device.DeviceDescriptor = PortDeviceDescriptor;
+ device.DevicePortNumber = PortPortNumber;
+ device.DeviceHubDevicePath = PortHubDevicePath;
+ device.DeviceDescriptor = PortDeviceDescriptor;
// Open a handle to the Hub device
IntPtr h = CreateFile(PortHubDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0,
@@ -873,7 +873,7 @@ namespace DiscImageChef.Devices.Windows
int nBytesReturned;
int nBytes = BUFFER_SIZE;
// We use this to zero fill a buffer
- string NullString = new string((char)0, BUFFER_SIZE / Marshal.SystemDefaultCharSize);
+ string nullString = new string((char)0, BUFFER_SIZE / Marshal.SystemDefaultCharSize);
// The iManufacturer, iProduct and iSerialNumber entries in the
// Device Descriptor are really just indexes. So, we have to
@@ -882,15 +882,15 @@ namespace DiscImageChef.Devices.Windows
if(PortDeviceDescriptor.iManufacturer > 0)
{
// build a request for string descriptor
- USB_DESCRIPTOR_REQUEST Request = new USB_DESCRIPTOR_REQUEST();
- Request.ConnectionIndex = PortPortNumber;
- Request.SetupPacket.wValue =
+ UsbDescriptorRequest request = new UsbDescriptorRequest();
+ request.ConnectionIndex = PortPortNumber;
+ request.SetupPacket.wValue =
(short)((USB_STRING_DESCRIPTOR_TYPE << 8) + PortDeviceDescriptor.iManufacturer);
- Request.SetupPacket.wLength = (short)(nBytes - Marshal.SizeOf(Request));
- Request.SetupPacket.wIndex = 0x409; // Language Code
+ request.SetupPacket.wLength = (short)(nBytes - Marshal.SizeOf(request));
+ request.SetupPacket.wIndex = 0x409; // Language Code
// Geez, I wish C# had a Marshal.MemSet() method
- IntPtr ptrRequest = Marshal.StringToHGlobalAuto(NullString);
- Marshal.StructureToPtr(Request, ptrRequest, true);
+ IntPtr ptrRequest = Marshal.StringToHGlobalAuto(nullString);
+ Marshal.StructureToPtr(request, ptrRequest, true);
// Use an IOCTL call to request the String Descriptor
if(DeviceIoControl(h, IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, ptrRequest, nBytes,
@@ -900,75 +900,75 @@ namespace DiscImageChef.Devices.Windows
// the Request structure. Because this location is not "covered"
// by the structure allocation, we're forced to zero out this
// chunk of memory by using the StringToHGlobalAuto() hack above
- IntPtr ptrStringDesc = new IntPtr(ptrRequest.ToInt32() + Marshal.SizeOf(Request));
- USB_STRING_DESCRIPTOR StringDesc =
- (USB_STRING_DESCRIPTOR)Marshal.PtrToStructure(ptrStringDesc,
- typeof(USB_STRING_DESCRIPTOR));
- Device.DeviceManufacturer = StringDesc.bString;
+ IntPtr ptrStringDesc = new IntPtr(ptrRequest.ToInt32() + Marshal.SizeOf(request));
+ UsbStringDescriptor stringDesc =
+ (UsbStringDescriptor)Marshal.PtrToStructure(ptrStringDesc,
+ typeof(UsbStringDescriptor));
+ device.DeviceManufacturer = stringDesc.bString;
}
Marshal.FreeHGlobal(ptrRequest);
}
if(PortDeviceDescriptor.iProduct > 0)
{
// build a request for string descriptor
- USB_DESCRIPTOR_REQUEST Request = new USB_DESCRIPTOR_REQUEST();
- Request.ConnectionIndex = PortPortNumber;
- Request.SetupPacket.wValue =
+ UsbDescriptorRequest request = new UsbDescriptorRequest();
+ request.ConnectionIndex = PortPortNumber;
+ request.SetupPacket.wValue =
(short)((USB_STRING_DESCRIPTOR_TYPE << 8) + PortDeviceDescriptor.iProduct);
- Request.SetupPacket.wLength = (short)(nBytes - Marshal.SizeOf(Request));
- Request.SetupPacket.wIndex = 0x409; // Language Code
+ request.SetupPacket.wLength = (short)(nBytes - Marshal.SizeOf(request));
+ request.SetupPacket.wIndex = 0x409; // Language Code
// Geez, I wish C# had a Marshal.MemSet() method
- IntPtr ptrRequest = Marshal.StringToHGlobalAuto(NullString);
- Marshal.StructureToPtr(Request, ptrRequest, true);
+ IntPtr ptrRequest = Marshal.StringToHGlobalAuto(nullString);
+ Marshal.StructureToPtr(request, ptrRequest, true);
// Use an IOCTL call to request the String Descriptor
if(DeviceIoControl(h, IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, ptrRequest, nBytes,
ptrRequest, nBytes, out nBytesReturned, IntPtr.Zero))
{
// the location of the string descriptor is immediately after the Request structure
- IntPtr ptrStringDesc = new IntPtr(ptrRequest.ToInt32() + Marshal.SizeOf(Request));
- USB_STRING_DESCRIPTOR StringDesc =
- (USB_STRING_DESCRIPTOR)Marshal.PtrToStructure(ptrStringDesc,
- typeof(USB_STRING_DESCRIPTOR));
- Device.DeviceProduct = StringDesc.bString;
+ IntPtr ptrStringDesc = new IntPtr(ptrRequest.ToInt32() + Marshal.SizeOf(request));
+ UsbStringDescriptor stringDesc =
+ (UsbStringDescriptor)Marshal.PtrToStructure(ptrStringDesc,
+ typeof(UsbStringDescriptor));
+ device.DeviceProduct = stringDesc.bString;
}
Marshal.FreeHGlobal(ptrRequest);
}
if(PortDeviceDescriptor.iSerialNumber > 0)
{
// build a request for string descriptor
- USB_DESCRIPTOR_REQUEST Request = new USB_DESCRIPTOR_REQUEST();
- Request.ConnectionIndex = PortPortNumber;
- Request.SetupPacket.wValue =
+ UsbDescriptorRequest request = new UsbDescriptorRequest();
+ request.ConnectionIndex = PortPortNumber;
+ request.SetupPacket.wValue =
(short)((USB_STRING_DESCRIPTOR_TYPE << 8) + PortDeviceDescriptor.iSerialNumber);
- Request.SetupPacket.wLength = (short)(nBytes - Marshal.SizeOf(Request));
- Request.SetupPacket.wIndex = 0x409; // Language Code
+ request.SetupPacket.wLength = (short)(nBytes - Marshal.SizeOf(request));
+ request.SetupPacket.wIndex = 0x409; // Language Code
// Geez, I wish C# had a Marshal.MemSet() method
- IntPtr ptrRequest = Marshal.StringToHGlobalAuto(NullString);
- Marshal.StructureToPtr(Request, ptrRequest, true);
+ IntPtr ptrRequest = Marshal.StringToHGlobalAuto(nullString);
+ Marshal.StructureToPtr(request, ptrRequest, true);
// Use an IOCTL call to request the String Descriptor
if(DeviceIoControl(h, IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, ptrRequest, nBytes,
ptrRequest, nBytes, out nBytesReturned, IntPtr.Zero))
{
// the location of the string descriptor is immediately after the Request structure
- IntPtr ptrStringDesc = new IntPtr(ptrRequest.ToInt32() + Marshal.SizeOf(Request));
- USB_STRING_DESCRIPTOR StringDesc =
- (USB_STRING_DESCRIPTOR)Marshal.PtrToStructure(ptrStringDesc,
- typeof(USB_STRING_DESCRIPTOR));
- Device.DeviceSerialNumber = StringDesc.bString;
+ IntPtr ptrStringDesc = new IntPtr(ptrRequest.ToInt32() + Marshal.SizeOf(request));
+ UsbStringDescriptor stringDesc =
+ (UsbStringDescriptor)Marshal.PtrToStructure(ptrStringDesc,
+ typeof(UsbStringDescriptor));
+ device.DeviceSerialNumber = stringDesc.bString;
}
Marshal.FreeHGlobal(ptrRequest);
}
// build a request for configuration descriptor
- USB_DESCRIPTOR_REQUEST dcrRequest = new USB_DESCRIPTOR_REQUEST();
+ UsbDescriptorRequest dcrRequest = new UsbDescriptorRequest();
dcrRequest.ConnectionIndex = PortPortNumber;
dcrRequest.SetupPacket.wValue = (short)((USB_CONFIGURATION_DESCRIPTOR_TYPE << 8));
dcrRequest.SetupPacket.wLength = (short)(nBytes - Marshal.SizeOf(dcrRequest));
dcrRequest.SetupPacket.wIndex = 0;
// Geez, I wish C# had a Marshal.MemSet() method
- IntPtr dcrPtrRequest = Marshal.StringToHGlobalAuto(NullString);
+ IntPtr dcrPtrRequest = Marshal.StringToHGlobalAuto(nullString);
Marshal.StructureToPtr(dcrRequest, dcrPtrRequest, true);
// Use an IOCTL call to request the String Descriptor
@@ -976,47 +976,47 @@ namespace DiscImageChef.Devices.Windows
dcrPtrRequest, nBytes, out nBytesReturned, IntPtr.Zero))
{
IntPtr ptrStringDesc = new IntPtr(dcrPtrRequest.ToInt32() + Marshal.SizeOf(dcrRequest));
- Device.BinaryDeviceDescriptors = new byte[nBytesReturned];
- Marshal.Copy(ptrStringDesc, Device.BinaryDeviceDescriptors, 0, nBytesReturned);
+ device.BinaryDeviceDescriptors = new byte[nBytesReturned];
+ Marshal.Copy(ptrStringDesc, device.BinaryDeviceDescriptors, 0, nBytesReturned);
}
Marshal.FreeHGlobal(dcrPtrRequest);
// Get the Driver Key Name (usefull in locating a device)
- USB_NODE_CONNECTION_DRIVERKEY_NAME DriverKey = new USB_NODE_CONNECTION_DRIVERKEY_NAME();
- DriverKey.ConnectionIndex = PortPortNumber;
- nBytes = Marshal.SizeOf(DriverKey);
+ UsbNodeConnectionDriverkeyName driverKey = new UsbNodeConnectionDriverkeyName();
+ driverKey.ConnectionIndex = PortPortNumber;
+ nBytes = Marshal.SizeOf(driverKey);
IntPtr ptrDriverKey = Marshal.AllocHGlobal(nBytes);
- Marshal.StructureToPtr(DriverKey, ptrDriverKey, true);
+ Marshal.StructureToPtr(driverKey, ptrDriverKey, true);
// Use an IOCTL call to request the Driver Key Name
if(DeviceIoControl(h, IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME, ptrDriverKey, nBytes,
ptrDriverKey, nBytes, out nBytesReturned, IntPtr.Zero))
{
- DriverKey = (USB_NODE_CONNECTION_DRIVERKEY_NAME)Marshal.PtrToStructure(ptrDriverKey,
+ driverKey = (UsbNodeConnectionDriverkeyName)Marshal.PtrToStructure(ptrDriverKey,
typeof(
- USB_NODE_CONNECTION_DRIVERKEY_NAME
+ UsbNodeConnectionDriverkeyName
));
- Device.DeviceDriverKey = DriverKey.DriverKeyName;
+ device.DeviceDriverKey = driverKey.DriverKeyName;
// use the DriverKeyName to get the Device Description and Instance ID
- Device.DeviceName = GetDescriptionByKeyName(Device.DeviceDriverKey);
- Device.DeviceInstanceID = GetInstanceIDByKeyName(Device.DeviceDriverKey);
+ device.DeviceName = GetDescriptionByKeyName(device.DeviceDriverKey);
+ device.DeviceInstanceId = GetInstanceIdByKeyName(device.DeviceDriverKey);
}
Marshal.FreeHGlobal(ptrDriverKey);
CloseHandle(h);
}
- return Device;
+ return device;
}
// return a down stream external hub
- internal USBHub GetHub()
+ internal UsbHub GetHub()
{
if(!PortIsHub) { return null; }
- USBHub Hub = new USBHub();
+ UsbHub hub = new UsbHub();
IntPtr h, h2;
- Hub.HubIsRootHub = false;
- Hub.HubDeviceDesc = "External Hub";
+ hub.HubIsRootHub = false;
+ hub.HubDeviceDesc = "External Hub";
// Open a handle to the Host Controller
h = CreateFile(PortHubDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0,
@@ -1025,40 +1025,40 @@ namespace DiscImageChef.Devices.Windows
{
// Get the DevicePath for downstream hub
int nBytesReturned;
- USB_NODE_CONNECTION_NAME NodeName = new USB_NODE_CONNECTION_NAME();
- NodeName.ConnectionIndex = PortPortNumber;
- int nBytes = Marshal.SizeOf(NodeName);
+ UsbNodeConnectionName nodeName = new UsbNodeConnectionName();
+ nodeName.ConnectionIndex = PortPortNumber;
+ int nBytes = Marshal.SizeOf(nodeName);
IntPtr ptrNodeName = Marshal.AllocHGlobal(nBytes);
- Marshal.StructureToPtr(NodeName, ptrNodeName, true);
+ Marshal.StructureToPtr(nodeName, ptrNodeName, true);
// Use an IOCTL call to request the Node Name
if(DeviceIoControl(h, IOCTL_USB_GET_NODE_CONNECTION_NAME, ptrNodeName, nBytes, ptrNodeName, nBytes,
out nBytesReturned, IntPtr.Zero))
{
- NodeName = (USB_NODE_CONNECTION_NAME)Marshal.PtrToStructure(ptrNodeName,
- typeof(USB_NODE_CONNECTION_NAME));
- Hub.HubDevicePath = @"\\.\" + NodeName.NodeName;
+ nodeName = (UsbNodeConnectionName)Marshal.PtrToStructure(ptrNodeName,
+ typeof(UsbNodeConnectionName));
+ hub.HubDevicePath = @"\\.\" + nodeName.NodeName;
}
// Now let's open the Hub (based upon the HubName we got above)
- h2 = CreateFile(Hub.HubDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0,
+ h2 = CreateFile(hub.HubDevicePath, GENERIC_WRITE, FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0,
IntPtr.Zero);
if(h2.ToInt32() != INVALID_HANDLE_VALUE)
{
- USB_NODE_INFORMATION NodeInfo = new USB_NODE_INFORMATION();
- NodeInfo.NodeType = (int)USB_HUB_NODE.UsbHub;
- nBytes = Marshal.SizeOf(NodeInfo);
+ UsbNodeInformation nodeInfo = new UsbNodeInformation();
+ nodeInfo.NodeType = (int)UsbHubNode.UsbHub;
+ nBytes = Marshal.SizeOf(nodeInfo);
IntPtr ptrNodeInfo = Marshal.AllocHGlobal(nBytes);
- Marshal.StructureToPtr(NodeInfo, ptrNodeInfo, true);
+ Marshal.StructureToPtr(nodeInfo, ptrNodeInfo, true);
// get the Hub Information
if(DeviceIoControl(h2, IOCTL_USB_GET_NODE_INFORMATION, ptrNodeInfo, nBytes, ptrNodeInfo, nBytes,
out nBytesReturned, IntPtr.Zero))
{
- NodeInfo = (USB_NODE_INFORMATION)Marshal.PtrToStructure(ptrNodeInfo,
- typeof(USB_NODE_INFORMATION));
- Hub.HubIsBusPowered = Convert.ToBoolean(NodeInfo.HubInformation.HubIsBusPowered);
- Hub.HubPortCount = NodeInfo.HubInformation.HubDescriptor.bNumberOfPorts;
+ nodeInfo = (UsbNodeInformation)Marshal.PtrToStructure(ptrNodeInfo,
+ typeof(UsbNodeInformation));
+ hub.HubIsBusPowered = Convert.ToBoolean(nodeInfo.HubInformation.HubIsBusPowered);
+ hub.HubPortCount = nodeInfo.HubInformation.HubDescriptor.bNumberOfPorts;
}
Marshal.FreeHGlobal(ptrNodeInfo);
CloseHandle(h2);
@@ -1066,33 +1066,33 @@ namespace DiscImageChef.Devices.Windows
// Fill in the missing Manufacture, Product, and SerialNumber values
// values by just creating a Device instance and copying the values
- USBDevice Device = GetDevice();
- Hub.HubInstanceID = Device.DeviceInstanceID;
- Hub.HubManufacturer = Device.Manufacturer;
- Hub.HubProduct = Device.Product;
- Hub.HubSerialNumber = Device.SerialNumber;
- Hub.HubDriverKey = Device.DriverKey;
+ UsbDevice device = GetDevice();
+ hub.HubInstanceId = device.DeviceInstanceId;
+ hub.HubManufacturer = device.Manufacturer;
+ hub.HubProduct = device.Product;
+ hub.HubSerialNumber = device.SerialNumber;
+ hub.HubDriverKey = device.DriverKey;
Marshal.FreeHGlobal(ptrNodeName);
CloseHandle(h);
}
- return Hub;
+ return hub;
}
}
//
// The USB Device Class
//
- internal class USBDevice
+ internal class UsbDevice
{
internal int DevicePortNumber;
- internal string DeviceDriverKey, DeviceHubDevicePath, DeviceInstanceID, DeviceName;
+ internal string DeviceDriverKey, DeviceHubDevicePath, DeviceInstanceId, DeviceName;
internal string DeviceManufacturer, DeviceProduct, DeviceSerialNumber;
- internal USB_DEVICE_DESCRIPTOR DeviceDescriptor;
+ internal UsbDeviceDescriptor DeviceDescriptor;
internal byte[] BinaryDeviceDescriptors;
// a simple default constructor
- internal USBDevice()
+ internal UsbDevice()
{
DevicePortNumber = 0;
DeviceHubDevicePath = "";
@@ -1101,7 +1101,7 @@ namespace DiscImageChef.Devices.Windows
DeviceProduct = "Unknown USB Device";
DeviceSerialNumber = "";
DeviceName = "";
- DeviceInstanceID = "";
+ DeviceInstanceId = "";
BinaryDeviceDescriptors = null;
}
@@ -1124,9 +1124,9 @@ namespace DiscImageChef.Devices.Windows
}
// the device path of this device
- internal string InstanceID
+ internal string InstanceId
{
- get { return DeviceInstanceID; }
+ get { return DeviceInstanceId; }
}
// the friendly name
@@ -1159,46 +1159,46 @@ namespace DiscImageChef.Devices.Windows
//
// private function for finding a USB device's Description
//
- static string GetDescriptionByKeyName(string DriverKeyName)
+ static string GetDescriptionByKeyName(string driverKeyName)
{
string ans = "";
- string DevEnum = REGSTR_KEY_USB;
+ string devEnum = REGSTR_KEY_USB;
// Use the "enumerator form" of the SetupDiGetClassDevs API
// to generate a list of all USB devices
- IntPtr h = SetupDiGetClassDevs(0, DevEnum, IntPtr.Zero, DIGCF_PRESENT | DIGCF_ALLCLASSES);
+ IntPtr h = SetupDiGetClassDevs(0, devEnum, IntPtr.Zero, DIGCF_PRESENT | DIGCF_ALLCLASSES);
if(h.ToInt32() != INVALID_HANDLE_VALUE)
{
IntPtr ptrBuf = Marshal.AllocHGlobal(BUFFER_SIZE);
- string KeyName;
+ string keyName;
- bool Success;
+ bool success;
int i = 0;
do
{
// create a Device Interface Data structure
- SP_DEVINFO_DATA da = new SP_DEVINFO_DATA();
+ SpDevinfoData da = new SpDevinfoData();
da.cbSize = Marshal.SizeOf(da);
// start the enumeration
- Success = SetupDiEnumDeviceInfo(h, i, ref da);
- if(Success)
+ success = SetupDiEnumDeviceInfo(h, i, ref da);
+ if(success)
{
- int RequiredSize = 0;
- int RegType = REG_SZ;
- KeyName = "";
+ int requiredSize = 0;
+ int regType = REG_SZ;
+ keyName = "";
- if(SetupDiGetDeviceRegistryProperty(h, ref da, SPDRP_DRIVER, ref RegType, ptrBuf, BUFFER_SIZE,
- ref RequiredSize))
+ if(SetupDiGetDeviceRegistryProperty(h, ref da, SPDRP_DRIVER, ref regType, ptrBuf, BUFFER_SIZE,
+ ref requiredSize))
{
- KeyName = Marshal.PtrToStringAuto(ptrBuf);
+ keyName = Marshal.PtrToStringAuto(ptrBuf);
}
// is it a match?
- if(KeyName == DriverKeyName)
+ if(keyName == driverKeyName)
{
- if(SetupDiGetDeviceRegistryProperty(h, ref da, SPDRP_DEVICEDESC, ref RegType, ptrBuf,
- BUFFER_SIZE, ref RequiredSize))
+ if(SetupDiGetDeviceRegistryProperty(h, ref da, SPDRP_DEVICEDESC, ref regType, ptrBuf,
+ BUFFER_SIZE, ref requiredSize))
{
ans = Marshal.PtrToStringAuto(ptrBuf);
}
@@ -1208,7 +1208,7 @@ namespace DiscImageChef.Devices.Windows
i++;
}
- while(Success);
+ while(success);
Marshal.FreeHGlobal(ptrBuf);
SetupDiDestroyDeviceInfoList(h);
@@ -1220,47 +1220,47 @@ namespace DiscImageChef.Devices.Windows
//
// private function for finding a USB device's Instance ID
//
- static string GetInstanceIDByKeyName(string DriverKeyName)
+ static string GetInstanceIdByKeyName(string driverKeyName)
{
string ans = "";
- string DevEnum = REGSTR_KEY_USB;
+ string devEnum = REGSTR_KEY_USB;
// Use the "enumerator form" of the SetupDiGetClassDevs API
// to generate a list of all USB devices
- IntPtr h = SetupDiGetClassDevs(0, DevEnum, IntPtr.Zero, DIGCF_PRESENT | DIGCF_ALLCLASSES);
+ IntPtr h = SetupDiGetClassDevs(0, devEnum, IntPtr.Zero, DIGCF_PRESENT | DIGCF_ALLCLASSES);
if(h.ToInt32() != INVALID_HANDLE_VALUE)
{
IntPtr ptrBuf = Marshal.AllocHGlobal(BUFFER_SIZE);
- string KeyName;
+ string keyName;
- bool Success;
+ bool success;
int i = 0;
do
{
// create a Device Interface Data structure
- SP_DEVINFO_DATA da = new SP_DEVINFO_DATA();
+ SpDevinfoData da = new SpDevinfoData();
da.cbSize = Marshal.SizeOf(da);
// start the enumeration
- Success = SetupDiEnumDeviceInfo(h, i, ref da);
- if(Success)
+ success = SetupDiEnumDeviceInfo(h, i, ref da);
+ if(success)
{
- int RequiredSize = 0;
- int RegType = REG_SZ;
+ int requiredSize = 0;
+ int regType = REG_SZ;
- KeyName = "";
- if(SetupDiGetDeviceRegistryProperty(h, ref da, SPDRP_DRIVER, ref RegType, ptrBuf, BUFFER_SIZE,
- ref RequiredSize))
+ keyName = "";
+ if(SetupDiGetDeviceRegistryProperty(h, ref da, SPDRP_DRIVER, ref regType, ptrBuf, BUFFER_SIZE,
+ ref requiredSize))
{
- KeyName = Marshal.PtrToStringAuto(ptrBuf);
+ keyName = Marshal.PtrToStringAuto(ptrBuf);
}
// is it a match?
- if(KeyName == DriverKeyName)
+ if(keyName == driverKeyName)
{
int nBytes = BUFFER_SIZE;
StringBuilder sb = new StringBuilder(nBytes);
- SetupDiGetDeviceInstanceId(h, ref da, sb, nBytes, out RequiredSize);
+ SetupDiGetDeviceInstanceId(h, ref da, sb, nBytes, out requiredSize);
ans = sb.ToString();
break;
}
@@ -1268,7 +1268,7 @@ namespace DiscImageChef.Devices.Windows
i++;
}
- while(Success);
+ while(success);
Marshal.FreeHGlobal(ptrBuf);
SetupDiDestroyDeviceInfoList(h);
diff --git a/DiscImageChef.Devices/Windows/UsbFunctions.cs b/DiscImageChef.Devices/Windows/UsbFunctions.cs
index 188d54756..39f93c9ac 100644
--- a/DiscImageChef.Devices/Windows/UsbFunctions.cs
+++ b/DiscImageChef.Devices/Windows/UsbFunctions.cs
@@ -46,63 +46,63 @@ namespace DiscImageChef.Devices.Windows
//
// Get a list of all connected devices
//
- static internal List GetConnectedDevices()
+ static internal List GetConnectedDevices()
{
- List DevList = new List();
+ List devList = new List();
- foreach(USBController Controller in GetHostControllers()) { ListHub(Controller.GetRootHub(), DevList); }
+ foreach(UsbController controller in GetHostControllers()) { ListHub(controller.GetRootHub(), devList); }
- return DevList;
+ return devList;
}
// private routine for enumerating a hub
- static void ListHub(USBHub Hub, List DevList)
+ static void ListHub(UsbHub hub, List devList)
{
- foreach(USBPort Port in Hub.GetPorts())
+ foreach(UsbPort port in hub.GetPorts())
{
- if(Port.IsHub)
+ if(port.IsHub)
{
// recursive
- ListHub(Port.GetHub(), DevList);
+ ListHub(port.GetHub(), devList);
}
- else { if(Port.IsDeviceConnected) { DevList.Add(Port.GetDevice()); } }
+ else { if(port.IsDeviceConnected) { devList.Add(port.GetDevice()); } }
}
}
//
// Find a device based upon it's DriverKeyName
//
- static internal USBDevice FindDeviceByDriverKeyName(string DriverKeyName)
+ static internal UsbDevice FindDeviceByDriverKeyName(string driverKeyName)
{
- USBDevice FoundDevice = null;
+ UsbDevice foundDevice = null;
- foreach(USBController Controller in GetHostControllers())
+ foreach(UsbController controller in GetHostControllers())
{
- SearchHubDriverKeyName(Controller.GetRootHub(), ref FoundDevice, DriverKeyName);
- if(FoundDevice != null) break;
+ SearchHubDriverKeyName(controller.GetRootHub(), ref foundDevice, driverKeyName);
+ if(foundDevice != null) break;
}
- return FoundDevice;
+ return foundDevice;
}
// private routine for enumerating a hub
- static void SearchHubDriverKeyName(USBHub Hub, ref USBDevice FoundDevice, string DriverKeyName)
+ static void SearchHubDriverKeyName(UsbHub hub, ref UsbDevice foundDevice, string driverKeyName)
{
- foreach(USBPort Port in Hub.GetPorts())
+ foreach(UsbPort port in hub.GetPorts())
{
- if(Port.IsHub)
+ if(port.IsHub)
{
// recursive
- SearchHubDriverKeyName(Port.GetHub(), ref FoundDevice, DriverKeyName);
+ SearchHubDriverKeyName(port.GetHub(), ref foundDevice, driverKeyName);
}
else
{
- if(Port.IsDeviceConnected)
+ if(port.IsDeviceConnected)
{
- USBDevice Device = Port.GetDevice();
- if(Device.DeviceDriverKey == DriverKeyName)
+ UsbDevice device = port.GetDevice();
+ if(device.DeviceDriverKey == driverKeyName)
{
- FoundDevice = Device;
+ foundDevice = device;
break;
}
}
@@ -113,37 +113,37 @@ namespace DiscImageChef.Devices.Windows
//
// Find a device based upon it's Instance ID
//
- static internal USBDevice FindDeviceByInstanceID(string InstanceID)
+ static internal UsbDevice FindDeviceByInstanceId(string instanceId)
{
- USBDevice FoundDevice = null;
+ UsbDevice foundDevice = null;
- foreach(USBController Controller in GetHostControllers())
+ foreach(UsbController controller in GetHostControllers())
{
- SearchHubInstanceID(Controller.GetRootHub(), ref FoundDevice, InstanceID);
- if(FoundDevice != null) break;
+ SearchHubInstanceId(controller.GetRootHub(), ref foundDevice, instanceId);
+ if(foundDevice != null) break;
}
- return FoundDevice;
+ return foundDevice;
}
// private routine for enumerating a hub
- static void SearchHubInstanceID(USBHub Hub, ref USBDevice FoundDevice, string InstanceID)
+ static void SearchHubInstanceId(UsbHub hub, ref UsbDevice foundDevice, string instanceId)
{
- foreach(USBPort Port in Hub.GetPorts())
+ foreach(UsbPort port in hub.GetPorts())
{
- if(Port.IsHub)
+ if(port.IsHub)
{
// recursive
- SearchHubInstanceID(Port.GetHub(), ref FoundDevice, InstanceID);
+ SearchHubInstanceId(port.GetHub(), ref foundDevice, instanceId);
}
else
{
- if(Port.IsDeviceConnected)
+ if(port.IsDeviceConnected)
{
- USBDevice Device = Port.GetDevice();
- if(Device.InstanceID == InstanceID)
+ UsbDevice device = port.GetDevice();
+ if(device.InstanceId == instanceId)
{
- FoundDevice = Device;
+ foundDevice = device;
break;
}
}
@@ -152,9 +152,9 @@ namespace DiscImageChef.Devices.Windows
}
const int IOCTL_STORAGE_GET_DEVICE_NUMBER = 0x2D1080;
- internal const string GUID_DEVINTERFACE_DISK = "53f56307-b6bf-11d0-94f2-00a0c91efb8b";
- internal const string GUID_DEVINTERFACE_CDROM = "53f56308-b6bf-11d0-94f2-00a0c91efb8b";
- internal const string GUID_DEVINTERFACE_FLOPPY = "53f56311-b6bf-11d0-94f2-00a0c91efb8b";
+ internal const string GuidDevinterfaceDisk = "53f56307-b6bf-11d0-94f2-00a0c91efb8b";
+ internal const string GuidDevinterfaceCdrom = "53f56308-b6bf-11d0-94f2-00a0c91efb8b";
+ internal const string GuidDevinterfaceFloppy = "53f56311-b6bf-11d0-94f2-00a0c91efb8b";
//typedef struct _STORAGE_DEVICE_NUMBER {
// DEVICE_TYPE DeviceType;
@@ -162,7 +162,7 @@ namespace DiscImageChef.Devices.Windows
// ULONG PartitionNumber;
//} STORAGE_DEVICE_NUMBER, *PSTORAGE_DEVICE_NUMBER;
[StructLayout(LayoutKind.Sequential)]
- struct STORAGE_DEVICE_NUMBER
+ struct StorageDeviceNumber
{
internal int DeviceType;
internal int DeviceNumber;
@@ -184,72 +184,72 @@ namespace DiscImageChef.Devices.Windows
// IN ULONG ulFlags
//);
[DllImport("setupapi.dll", CharSet = CharSet.Auto)]
- static extern int CM_Get_Device_ID(IntPtr dnDevInst, IntPtr Buffer, int BufferLen, int ulFlags);
+ static extern int CM_Get_Device_ID(IntPtr dnDevInst, IntPtr buffer, int bufferLen, int ulFlags);
//
// Find a device based upon a Drive Letter
//
- static internal USBDevice FindDriveLetter(string DriveLetter, string deviceGuid)
+ static internal UsbDevice FindDriveLetter(string driveLetter, string deviceGuid)
{
- USBDevice FoundDevice = null;
- string InstanceID = "";
+ UsbDevice foundDevice = null;
+ string instanceId = "";
// We start by getting the unique DeviceNumber of the given
// DriveLetter. We'll use this later to find a matching
// DevicePath "symbolic name"
- int DevNum = GetDeviceNumber(@"\\.\" + DriveLetter.TrimEnd('\\'));
- if(DevNum < 0) { return null; }
+ int devNum = GetDeviceNumber(@"\\.\" + driveLetter.TrimEnd('\\'));
+ if(devNum < 0) { return null; }
- return FindDeviceNumber(DevNum, deviceGuid);
+ return FindDeviceNumber(devNum, deviceGuid);
}
- static internal USBDevice FindDrivePath(string DrivePath, string deviceGuid)
+ static internal UsbDevice FindDrivePath(string drivePath, string deviceGuid)
{
- USBDevice FoundDevice = null;
- string InstanceID = "";
+ UsbDevice foundDevice = null;
+ string instanceId = "";
// We start by getting the unique DeviceNumber of the given
// DriveLetter. We'll use this later to find a matching
// DevicePath "symbolic name"
- int DevNum = GetDeviceNumber(DrivePath);
- if(DevNum < 0) { return null; }
+ int devNum = GetDeviceNumber(drivePath);
+ if(devNum < 0) { return null; }
- return FindDeviceNumber(DevNum, deviceGuid);
+ return FindDeviceNumber(devNum, deviceGuid);
}
//
// Find a device based upon a Drive Letter
//
- static internal USBDevice FindDeviceNumber(int DevNum, string deviceGuid)
+ static internal UsbDevice FindDeviceNumber(int devNum, string deviceGuid)
{
- USBDevice FoundDevice = null;
- string InstanceID = "";
+ UsbDevice foundDevice = null;
+ string instanceId = "";
- Guid DiskGUID = new Guid(deviceGuid);
+ Guid diskGuid = new Guid(deviceGuid);
// We start at the "root" of the device tree and look for all
// devices that match the interface GUID of a disk
- IntPtr h = SetupDiGetClassDevs(ref DiskGUID, 0, IntPtr.Zero, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
+ IntPtr h = SetupDiGetClassDevs(ref diskGuid, 0, IntPtr.Zero, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
if(h.ToInt32() != INVALID_HANDLE_VALUE)
{
- bool Success = true;
+ bool success = true;
int i = 0;
do
{
// create a Device Interface Data structure
- SP_DEVICE_INTERFACE_DATA dia = new SP_DEVICE_INTERFACE_DATA();
+ SpDeviceInterfaceData dia = new SpDeviceInterfaceData();
dia.cbSize = Marshal.SizeOf(dia);
// start the enumeration
- Success = SetupDiEnumDeviceInterfaces(h, IntPtr.Zero, ref DiskGUID, i, ref dia);
- if(Success)
+ success = SetupDiEnumDeviceInterfaces(h, IntPtr.Zero, ref diskGuid, i, ref dia);
+ if(success)
{
// build a DevInfo Data structure
- SP_DEVINFO_DATA da = new SP_DEVINFO_DATA();
+ SpDevinfoData da = new SpDevinfoData();
da.cbSize = Marshal.SizeOf(da);
// build a Device Interface Detail Data structure
- SP_DEVICE_INTERFACE_DETAIL_DATA didd = new SP_DEVICE_INTERFACE_DETAIL_DATA();
+ SpDeviceInterfaceDetailData didd = new SpDeviceInterfaceDetailData();
didd.cbSize = 4 + Marshal.SystemDefaultCharSize; // trust me :)
// now we can get some more detailed information
@@ -260,7 +260,7 @@ namespace DiscImageChef.Devices.Windows
// Now that we have a DevicePath... we can use it to
// generate another DeviceNumber to see if it matches
// the one we're looking for.
- if(GetDeviceNumber(didd.DevicePath) == DevNum)
+ if(GetDeviceNumber(didd.DevicePath) == devNum)
{
// current InstanceID is at the "USBSTOR" level, so we
// need up "move up" one level to get to the "USB" level
@@ -270,46 +270,46 @@ namespace DiscImageChef.Devices.Windows
// Now we get the InstanceID of the USB level device
IntPtr ptrInstanceBuf = Marshal.AllocHGlobal(nBytes);
CM_Get_Device_ID(ptrPrevious, ptrInstanceBuf, nBytes, 0);
- InstanceID = Marshal.PtrToStringAuto(ptrInstanceBuf);
+ instanceId = Marshal.PtrToStringAuto(ptrInstanceBuf);
Marshal.FreeHGlobal(ptrInstanceBuf);
- System.Console.WriteLine("InstanceId: {0}", InstanceID);
+ System.Console.WriteLine("InstanceId: {0}", instanceId);
//break;
}
}
}
i++;
}
- while(Success);
+ while(success);
SetupDiDestroyDeviceInfoList(h);
}
// Did we find an InterfaceID of a USB device?
- if(InstanceID.StartsWith("USB\\")) { FoundDevice = FindDeviceByInstanceID(InstanceID); }
- return FoundDevice;
+ if(instanceId.StartsWith("USB\\")) { foundDevice = FindDeviceByInstanceId(instanceId); }
+ return foundDevice;
}
// return a unique device number for the given device path
- private static int GetDeviceNumber(string DevicePath)
+ private static int GetDeviceNumber(string devicePath)
{
int ans = -1;
- IntPtr h = CreateFile(DevicePath.TrimEnd('\\'), 0, 0, IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero);
+ IntPtr h = CreateFile(devicePath.TrimEnd('\\'), 0, 0, IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero);
if(h.ToInt32() != INVALID_HANDLE_VALUE)
{
int requiredSize;
- STORAGE_DEVICE_NUMBER Sdn = new STORAGE_DEVICE_NUMBER();
- int nBytes = Marshal.SizeOf(Sdn);
+ StorageDeviceNumber sdn = new StorageDeviceNumber();
+ int nBytes = Marshal.SizeOf(sdn);
IntPtr ptrSdn = Marshal.AllocHGlobal(nBytes);
if(DeviceIoControl(h, IOCTL_STORAGE_GET_DEVICE_NUMBER, IntPtr.Zero, 0, ptrSdn, nBytes, out requiredSize,
IntPtr.Zero))
{
- Sdn = (STORAGE_DEVICE_NUMBER)Marshal.PtrToStructure(ptrSdn, typeof(STORAGE_DEVICE_NUMBER));
+ sdn = (StorageDeviceNumber)Marshal.PtrToStructure(ptrSdn, typeof(StorageDeviceNumber));
// just my way of combining the relevant parts of the
// STORAGE_DEVICE_NUMBER into a single number
- ans = (Sdn.DeviceType << 8) + Sdn.DeviceNumber;
+ ans = (sdn.DeviceType << 8) + sdn.DeviceNumber;
}
Marshal.FreeHGlobal(ptrSdn);
CloseHandle(h);
diff --git a/DiscImageChef.DiscImages/Alcohol120.cs b/DiscImageChef.DiscImages/Alcohol120.cs
index d7172f934..3a601ea8d 100644
--- a/DiscImageChef.DiscImages/Alcohol120.cs
+++ b/DiscImageChef.DiscImages/Alcohol120.cs
@@ -39,7 +39,7 @@ using DiscImageChef.CommonTypes;
using DiscImageChef.Console;
using DiscImageChef.Filters;
-namespace DiscImageChef.ImagePlugins
+namespace DiscImageChef.DiscImages
{
public class Alcohol120 : ImagePlugin
{
@@ -169,28 +169,28 @@ namespace DiscImageChef.ImagePlugins
public Alcohol120()
{
Name = "Alcohol 120% Media Descriptor Structure";
- PluginUUID = new Guid("A78FBEBA-0307-4915-BDE3-B8A3B57F843F");
+ PluginUuid = new Guid("A78FBEBA-0307-4915-BDE3-B8A3B57F843F");
ImageInfo = new ImageInfo();
- ImageInfo.readableSectorTags = new List();
- ImageInfo.readableMediaTags = new List();
- ImageInfo.imageHasPartitions = false;
- ImageInfo.imageHasSessions = false;
- ImageInfo.imageVersion = null;
- ImageInfo.imageApplication = null;
- ImageInfo.imageApplicationVersion = null;
- ImageInfo.imageCreator = null;
- ImageInfo.imageComments = null;
- ImageInfo.mediaManufacturer = null;
- ImageInfo.mediaModel = null;
- ImageInfo.mediaSerialNumber = null;
- ImageInfo.mediaBarcode = null;
- ImageInfo.mediaPartNumber = null;
- ImageInfo.mediaSequence = 0;
- ImageInfo.lastMediaSequence = 0;
- ImageInfo.driveManufacturer = null;
- ImageInfo.driveModel = null;
- ImageInfo.driveSerialNumber = null;
- ImageInfo.driveFirmwareRevision = null;
+ ImageInfo.ReadableSectorTags = new List();
+ ImageInfo.ReadableMediaTags = new List();
+ ImageInfo.ImageHasPartitions = false;
+ ImageInfo.ImageHasSessions = false;
+ ImageInfo.ImageVersion = null;
+ ImageInfo.ImageApplication = null;
+ ImageInfo.ImageApplicationVersion = null;
+ ImageInfo.ImageCreator = null;
+ ImageInfo.ImageComments = null;
+ ImageInfo.MediaManufacturer = null;
+ ImageInfo.MediaModel = null;
+ ImageInfo.MediaSerialNumber = null;
+ ImageInfo.MediaBarcode = null;
+ ImageInfo.MediaPartNumber = null;
+ ImageInfo.MediaSequence = 0;
+ ImageInfo.LastMediaSequence = 0;
+ ImageInfo.DriveManufacturer = null;
+ ImageInfo.DriveModel = null;
+ ImageInfo.DriveSerialNumber = null;
+ ImageInfo.DriveFirmwareRevision = null;
}
public override bool IdentifyImage(Filter imageFilter)
@@ -437,13 +437,13 @@ namespace DiscImageChef.ImagePlugins
{
case AlcoholMediumType.DVD:
case AlcoholMediumType.DVDR:
- ImageInfo.readableMediaTags.Add(MediaTagType.DVD_BCA);
+ ImageInfo.ReadableMediaTags.Add(MediaTagType.DVD_BCA);
break;
}
}
}
- ImageInfo.mediaType = AlcoholMediumTypeToMediaType(header.type);
+ ImageInfo.MediaType = AlcoholMediumTypeToMediaType(header.type);
if(isDvd)
{
@@ -473,58 +473,58 @@ namespace DiscImageChef.ImagePlugins
switch(pfi0.Value.DiskCategory)
{
case Decoders.DVD.DiskCategory.DVDPR:
- ImageInfo.mediaType = MediaType.DVDPR;
+ ImageInfo.MediaType = MediaType.DVDPR;
break;
case Decoders.DVD.DiskCategory.DVDPRDL:
- ImageInfo.mediaType = MediaType.DVDPRDL;
+ ImageInfo.MediaType = MediaType.DVDPRDL;
break;
case Decoders.DVD.DiskCategory.DVDPRW:
- ImageInfo.mediaType = MediaType.DVDPRW;
+ ImageInfo.MediaType = MediaType.DVDPRW;
break;
case Decoders.DVD.DiskCategory.DVDPRWDL:
- ImageInfo.mediaType = MediaType.DVDPRWDL;
+ ImageInfo.MediaType = MediaType.DVDPRWDL;
break;
case Decoders.DVD.DiskCategory.DVDR:
- if(pfi0.Value.PartVersion == 6) ImageInfo.mediaType = MediaType.DVDRDL;
- else ImageInfo.mediaType = MediaType.DVDR;
+ if(pfi0.Value.PartVersion == 6) ImageInfo.MediaType = MediaType.DVDRDL;
+ else ImageInfo.MediaType = MediaType.DVDR;
break;
case Decoders.DVD.DiskCategory.DVDRAM:
- ImageInfo.mediaType = MediaType.DVDRAM;
+ ImageInfo.MediaType = MediaType.DVDRAM;
break;
default:
- ImageInfo.mediaType = MediaType.DVDROM;
+ ImageInfo.MediaType = MediaType.DVDROM;
break;
case Decoders.DVD.DiskCategory.DVDRW:
- if(pfi0.Value.PartVersion == 3) ImageInfo.mediaType = MediaType.DVDRWDL;
- else ImageInfo.mediaType = MediaType.DVDRW;
+ if(pfi0.Value.PartVersion == 3) ImageInfo.MediaType = MediaType.DVDRWDL;
+ else ImageInfo.MediaType = MediaType.DVDRW;
break;
case Decoders.DVD.DiskCategory.HDDVDR:
- ImageInfo.mediaType = MediaType.HDDVDR;
+ ImageInfo.MediaType = MediaType.HDDVDR;
break;
case Decoders.DVD.DiskCategory.HDDVDRAM:
- ImageInfo.mediaType = MediaType.HDDVDRAM;
+ ImageInfo.MediaType = MediaType.HDDVDRAM;
break;
case Decoders.DVD.DiskCategory.HDDVDROM:
- ImageInfo.mediaType = MediaType.HDDVDROM;
+ ImageInfo.MediaType = MediaType.HDDVDROM;
break;
case Decoders.DVD.DiskCategory.HDDVDRW:
- ImageInfo.mediaType = MediaType.HDDVDRW;
+ ImageInfo.MediaType = MediaType.HDDVDRW;
break;
case Decoders.DVD.DiskCategory.Nintendo:
if(pfi0.Value.DiscSize == Decoders.DVD.DVDSize.Eighty)
- ImageInfo.mediaType = MediaType.GOD;
- else ImageInfo.mediaType = MediaType.WOD;
+ ImageInfo.MediaType = MediaType.GOD;
+ else ImageInfo.MediaType = MediaType.WOD;
break;
case Decoders.DVD.DiskCategory.UMD:
- ImageInfo.mediaType = MediaType.UMD;
+ ImageInfo.MediaType = MediaType.UMD;
break;
}
- if(Decoders.Xbox.DMI.IsXbox(dmi)) ImageInfo.mediaType = MediaType.XGD;
- else if(Decoders.Xbox.DMI.IsXbox360(dmi)) ImageInfo.mediaType = MediaType.XGD2;
+ if(Decoders.Xbox.DMI.IsXbox(dmi)) ImageInfo.MediaType = MediaType.XGD;
+ else if(Decoders.Xbox.DMI.IsXbox360(dmi)) ImageInfo.MediaType = MediaType.XGD2;
- ImageInfo.readableMediaTags.Add(MediaTagType.DVD_PFI);
- ImageInfo.readableMediaTags.Add(MediaTagType.DVD_DMI);
+ ImageInfo.ReadableMediaTags.Add(MediaTagType.DVD_PFI);
+ ImageInfo.ReadableMediaTags.Add(MediaTagType.DVD_DMI);
}
}
}
@@ -560,14 +560,14 @@ namespace DiscImageChef.ImagePlugins
}
}
- if(!data && !firstdata) ImageInfo.mediaType = MediaType.CDDA;
- else if(firstaudio && data && sessions.Count > 1 && mode2) ImageInfo.mediaType = MediaType.CDPLUS;
- else if((firstdata && audio) || mode2) ImageInfo.mediaType = MediaType.CDROMXA;
- else if(!audio) ImageInfo.mediaType = MediaType.CDROM;
- else ImageInfo.mediaType = MediaType.CD;
+ if(!data && !firstdata) ImageInfo.MediaType = MediaType.CDDA;
+ else if(firstaudio && data && sessions.Count > 1 && mode2) ImageInfo.MediaType = MediaType.CDPLUS;
+ else if((firstdata && audio) || mode2) ImageInfo.MediaType = MediaType.CDROMXA;
+ else if(!audio) ImageInfo.MediaType = MediaType.CDROM;
+ else ImageInfo.MediaType = MediaType.CD;
}
- DicConsole.DebugWriteLine("Alcohol 120% plugin", "ImageInfo.mediaType = {0}", ImageInfo.mediaType);
+ DicConsole.DebugWriteLine("Alcohol 120% plugin", "ImageInfo.mediaType = {0}", ImageInfo.MediaType);
sessions = new List();
foreach(AlcoholSession alcSes in alcSessions.Values)
@@ -610,7 +610,7 @@ namespace DiscImageChef.ImagePlugins
partition.Type = trk.mode.ToString();
partitions.Add(partition);
- ImageInfo.sectors += extra.sectors;
+ ImageInfo.Sectors += extra.sectors;
byte_offset += partition.Size;
}
@@ -621,45 +621,45 @@ namespace DiscImageChef.ImagePlugins
case AlcoholTrackMode.Mode1:
case AlcoholTrackMode.Mode2F1:
case AlcoholTrackMode.Mode2F1Alt:
- if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync))
- ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync);
- if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader))
- ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader);
- if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubHeader))
- ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubHeader);
- if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC))
- ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC);
- if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_P))
- ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_P);
- if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorECC_Q))
- ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorECC_Q);
- if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC))
- ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC);
- if(ImageInfo.sectorSize < 2048) ImageInfo.sectorSize = 2048;
+ if(!ImageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorSync))
+ ImageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorSync);
+ if(!ImageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorHeader))
+ ImageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorHeader);
+ if(!ImageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorSubHeader))
+ ImageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorSubHeader);
+ if(!ImageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorEcc))
+ ImageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorEcc);
+ if(!ImageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorEccP))
+ ImageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorEccP);
+ if(!ImageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorEccQ))
+ ImageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorEccQ);
+ if(!ImageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorEdc))
+ ImageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorEdc);
+ if(ImageInfo.SectorSize < 2048) ImageInfo.SectorSize = 2048;
break;
case AlcoholTrackMode.Mode2:
- if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync))
- ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync);
- if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader))
- ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader);
- if(ImageInfo.sectorSize < 2336) ImageInfo.sectorSize = 2336;
+ if(!ImageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorSync))
+ ImageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorSync);
+ if(!ImageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorHeader))
+ ImageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorHeader);
+ if(ImageInfo.SectorSize < 2336) ImageInfo.SectorSize = 2336;
break;
case AlcoholTrackMode.Mode2F2:
- if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSync))
- ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSync);
- if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorHeader))
- ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorHeader);
- if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorSubHeader))
- ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorSubHeader);
- if(!ImageInfo.readableSectorTags.Contains(SectorTagType.CDSectorEDC))
- ImageInfo.readableSectorTags.Add(SectorTagType.CDSectorEDC);
- if(ImageInfo.sectorSize < 2324) ImageInfo.sectorSize = 2324;
+ if(!ImageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorSync))
+ ImageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorSync);
+ if(!ImageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorHeader))
+ ImageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorHeader);
+ if(!ImageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorSubHeader))
+ ImageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorSubHeader);
+ if(!ImageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorEdc))
+ ImageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorEdc);
+ if(ImageInfo.SectorSize < 2324) ImageInfo.SectorSize = 2324;
break;
case AlcoholTrackMode.DVD:
- ImageInfo.sectorSize = 2048;
+ ImageInfo.SectorSize = 2048;
break;
default:
- ImageInfo.sectorSize = 2352;
+ ImageInfo.SectorSize = 2352;
break;
}
}
@@ -677,7 +677,7 @@ namespace DiscImageChef.ImagePlugins
DicConsole.DebugWriteLine("Alcohol 120% plugin", "\tPartition size in bytes: {0}", partition.Size);
}
- ImageInfo.imageApplication = "Alcohol 120%";
+ ImageInfo.ImageApplication = "Alcohol 120%";
DicConsole.DebugWriteLine("Alcohol 120% plugin", "Data filename: {0}", alcFile);
@@ -686,11 +686,11 @@ namespace DiscImageChef.ImagePlugins
if(alcImage == null) throw new Exception("Cannot open data file");
- ImageInfo.imageSize = (ulong)alcImage.GetDataForkLength();
- ImageInfo.imageCreationTime = alcImage.GetCreationTime();
- ImageInfo.imageLastModificationTime = alcImage.GetLastWriteTime();
- ImageInfo.xmlMediaType = XmlMediaType.OpticalDisc;
- ImageInfo.imageVersion = string.Format("{0}.{1}", header.version[0], header.version[1]);
+ ImageInfo.ImageSize = (ulong)alcImage.GetDataForkLength();
+ ImageInfo.ImageCreationTime = alcImage.GetCreationTime();
+ ImageInfo.ImageLastModificationTime = alcImage.GetLastWriteTime();
+ ImageInfo.XmlMediaType = XmlMediaType.OpticalDisc;
+ ImageInfo.ImageVersion = string.Format("{0}.{1}", header.version[0], header.version[1]);
if(!isDvd)
{
@@ -735,43 +735,43 @@ namespace DiscImageChef.ImagePlugins
DicConsole.DebugWriteLine("Alcohol 120% plugin", "TOC not correctly rebuilt");
fullToc = null;
}
- else ImageInfo.readableMediaTags.Add(MediaTagType.CD_FullTOC);
+ else ImageInfo.ReadableMediaTags.Add(MediaTagType.CD_FullTOC);
- ImageInfo.readableSectorTags.Add(SectorTagType.CDTrackFlags);
+ ImageInfo.ReadableSectorTags.Add(SectorTagType.CdTrackFlags);
}
- if(ImageInfo.mediaType == MediaType.XGD2)
+ if(ImageInfo.MediaType == MediaType.XGD2)
{
// All XGD3 all have the same number of blocks
- if(ImageInfo.sectors == 25063 || // Locked (or non compatible drive)
- ImageInfo.sectors == 4229664 || // Xtreme unlock
- ImageInfo.sectors == 4246304) // Wxripper unlock
- ImageInfo.mediaType = MediaType.XGD3;
+ if(ImageInfo.Sectors == 25063 || // Locked (or non compatible drive)
+ ImageInfo.Sectors == 4229664 || // Xtreme unlock
+ ImageInfo.Sectors == 4246304) // Wxripper unlock
+ ImageInfo.MediaType = MediaType.XGD3;
}
- DicConsole.VerboseWriteLine("Alcohol 120% image describes a disc of type {0}", ImageInfo.mediaType);
+ DicConsole.VerboseWriteLine("Alcohol 120% image describes a disc of type {0}", ImageInfo.MediaType);
return true;
}
public override bool ImageHasPartitions()
{
- return ImageInfo.imageHasPartitions;
+ return ImageInfo.ImageHasPartitions;
}
public override ulong GetImageSize()
{
- return ImageInfo.imageSize;
+ return ImageInfo.ImageSize;
}
public override ulong GetSectors()
{
- return ImageInfo.sectors;
+ return ImageInfo.Sectors;
}
public override uint GetSectorSize()
{
- return ImageInfo.sectorSize;
+ return ImageInfo.SectorSize;
}
public override byte[] ReadDiskTag(MediaTagType tag)
@@ -994,15 +994,15 @@ namespace DiscImageChef.ImagePlugins
switch(tag)
{
- case SectorTagType.CDSectorECC:
- case SectorTagType.CDSectorECC_P:
- case SectorTagType.CDSectorECC_Q:
- case SectorTagType.CDSectorEDC:
- case SectorTagType.CDSectorHeader:
- case SectorTagType.CDSectorSubchannel:
- case SectorTagType.CDSectorSubHeader:
- case SectorTagType.CDSectorSync: break;
- case SectorTagType.CDTrackFlags: return new byte[] {((byte)(_track.adrCtl & 0x0F))};
+ case SectorTagType.CdSectorEcc:
+ case SectorTagType.CdSectorEccP:
+ case SectorTagType.CdSectorEccQ:
+ case SectorTagType.CdSectorEdc:
+ case SectorTagType.CdSectorHeader:
+ case SectorTagType.CdSectorSubchannel:
+ case SectorTagType.CdSectorSubHeader:
+ case SectorTagType.CdSectorSync: break;
+ case SectorTagType.CdTrackFlags: return new byte[] {((byte)(_track.adrCtl & 0x0F))};
default: throw new ArgumentException("Unsupported tag requested", nameof(tag));
}
@@ -1011,51 +1011,51 @@ namespace DiscImageChef.ImagePlugins
case AlcoholTrackMode.Mode1:
switch(tag)
{
- case SectorTagType.CDSectorSync:
+ case SectorTagType.CdSectorSync:
{
sector_offset = 0;
sector_size = 12;
sector_skip = 2340;
break;
}
- case SectorTagType.CDSectorHeader:
+ case SectorTagType.CdSectorHeader:
{
sector_offset = 12;
sector_size = 4;
sector_skip = 2336;
break;
}
- case SectorTagType.CDSectorSubHeader:
+ case SectorTagType.CdSectorSubHeader:
throw new ArgumentException("Unsupported tag requested for this track", nameof(tag));
- case SectorTagType.CDSectorECC:
+ case SectorTagType.CdSectorEcc:
{
sector_offset = 2076;
sector_size = 276;
sector_skip = 0;
break;
}
- case SectorTagType.CDSectorECC_P:
+ case SectorTagType.CdSectorEccP:
{
sector_offset = 2076;
sector_size = 172;
sector_skip = 104;
break;
}
- case SectorTagType.CDSectorECC_Q:
+ case SectorTagType.CdSectorEccQ:
{
sector_offset = 2248;
sector_size = 104;
sector_skip = 0;
break;
}
- case SectorTagType.CDSectorEDC:
+ case SectorTagType.CdSectorEdc:
{
sector_offset = 2064;
sector_size = 4;
sector_skip = 284;
break;
}
- case SectorTagType.CDSectorSubchannel:
+ case SectorTagType.CdSectorSubchannel:
{
switch(_track.subMode)
{
@@ -1078,27 +1078,27 @@ namespace DiscImageChef.ImagePlugins
{
switch(tag)
{
- case SectorTagType.CDSectorSync:
- case SectorTagType.CDSectorHeader:
- case SectorTagType.CDSectorECC:
- case SectorTagType.CDSectorECC_P:
- case SectorTagType.CDSectorECC_Q:
+ case SectorTagType.CdSectorSync:
+ case SectorTagType.CdSectorHeader:
+ case SectorTagType.CdSectorEcc:
+ case SectorTagType.CdSectorEccP:
+ case SectorTagType.CdSectorEccQ:
throw new ArgumentException("Unsupported tag requested for this track", nameof(tag));
- case SectorTagType.CDSectorSubHeader:
+ case SectorTagType.CdSectorSubHeader:
{
sector_offset = 0;
sector_size = 8;
sector_skip = 2328;
break;
}
- case SectorTagType.CDSectorEDC:
+ case SectorTagType.CdSectorEdc:
{
sector_offset = 2332;
sector_size = 4;
sector_skip = 0;
break;
}
- case SectorTagType.CDSectorSubchannel:
+ case SectorTagType.CdSectorSubchannel:
{
switch(_track.subMode)
{
@@ -1122,56 +1122,56 @@ namespace DiscImageChef.ImagePlugins
case AlcoholTrackMode.Mode2F1Alt:
switch(tag)
{
- case SectorTagType.CDSectorSync:
+ case SectorTagType.CdSectorSync:
{
sector_offset = 0;
sector_size = 12;
sector_skip = 2340;
break;
}
- case SectorTagType.CDSectorHeader:
+ case SectorTagType.CdSectorHeader:
{
sector_offset = 12;
sector_size = 4;
sector_skip = 2336;
break;
}
- case SectorTagType.CDSectorSubHeader:
+ case SectorTagType.CdSectorSubHeader:
{
sector_offset = 16;
sector_size = 8;
sector_skip = 2328;
break;
}
- case SectorTagType.CDSectorECC:
+ case SectorTagType.CdSectorEcc:
{
sector_offset = 2076;
sector_size = 276;
sector_skip = 0;
break;
}
- case SectorTagType.CDSectorECC_P:
+ case SectorTagType.CdSectorEccP:
{
sector_offset = 2076;
sector_size = 172;
sector_skip = 104;
break;
}
- case SectorTagType.CDSectorECC_Q:
+ case SectorTagType.CdSectorEccQ:
{
sector_offset = 2248;
sector_size = 104;
sector_skip = 0;
break;
}
- case SectorTagType.CDSectorEDC:
+ case SectorTagType.CdSectorEdc:
{
sector_offset = 2072;
sector_size = 4;
sector_skip = 276;
break;
}
- case SectorTagType.CDSectorSubchannel:
+ case SectorTagType.CdSectorSubchannel:
{
switch(_track.subMode)
{
@@ -1193,35 +1193,35 @@ namespace DiscImageChef.ImagePlugins
case AlcoholTrackMode.Mode2F2:
switch(tag)
{
- case SectorTagType.CDSectorSync:
+ case SectorTagType.CdSectorSync:
{
sector_offset = 0;
sector_size = 12;
sector_skip = 2340;
break;
}
- case SectorTagType.CDSectorHeader:
+ case SectorTagType.CdSectorHeader:
{
sector_offset = 12;
sector_size = 4;
sector_skip = 2336;
break;
}
- case SectorTagType.CDSectorSubHeader:
+ case SectorTagType.CdSectorSubHeader:
{
sector_offset = 16;
sector_size = 8;
sector_skip = 2328;
break;
}
- case SectorTagType.CDSectorEDC:
+ case SectorTagType.CdSectorEdc:
{
sector_offset = 2348;
sector_size = 4;
sector_skip = 0;
break;
}
- case SectorTagType.CDSectorSubchannel:
+ case SectorTagType.CdSectorSubchannel:
{
switch(_track.subMode)
{
@@ -1244,7 +1244,7 @@ namespace DiscImageChef.ImagePlugins
{
switch(tag)
{
- case SectorTagType.CDSectorSubchannel:
+ case SectorTagType.CdSectorSubchannel:
{
switch(_track.subMode)
{
@@ -1273,7 +1273,7 @@ namespace DiscImageChef.ImagePlugins
sector_skip += 0;
break;
case AlcoholSubchannelMode.Interleaved:
- if(tag != SectorTagType.CDSectorSubchannel) sector_skip += 96;
+ if(tag != SectorTagType.CdSectorSubchannel) sector_skip += 96;
break;
default: throw new FeatureSupportedButNotImplementedImageException("Unsupported subchannel type");
}
@@ -1388,17 +1388,17 @@ namespace DiscImageChef.ImagePlugins
public override string GetImageVersion()
{
- return ImageInfo.imageVersion;
+ return ImageInfo.ImageVersion;
}
public override string GetImageApplication()
{
- return ImageInfo.imageApplication;
+ return ImageInfo.ImageApplication;
}
public override MediaType GetMediaType()
{
- return ImageInfo.mediaType;
+ return ImageInfo.MediaType;
}
public override List GetPartitions()
@@ -1535,73 +1535,73 @@ namespace DiscImageChef.ImagePlugins
public override bool? VerifySector(ulong sectorAddress)
{
byte[] buffer = ReadSectorLong(sectorAddress);
- return Checksums.CDChecksums.CheckCDSector(buffer);
+ return Checksums.CdChecksums.CheckCdSector(buffer);
}
public override bool? VerifySector(ulong sectorAddress, uint track)
{
byte[] buffer = ReadSectorLong(sectorAddress, track);
- return Checksums.CDChecksums.CheckCDSector(buffer);
+ return Checksums.CdChecksums.CheckCdSector(buffer);
}
- public override bool? VerifySectors(ulong sectorAddress, uint length, out List FailingLBAs,
- out List UnknownLBAs)
+ public override bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas,
+ out List unknownLbas)
{
byte[] buffer = ReadSectorsLong(sectorAddress, length);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
- FailingLBAs = new List();
- UnknownLBAs = new List();
+ failingLbas = new List();
+ unknownLbas = new List();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
- bool? sectorStatus = Checksums.CDChecksums.CheckCDSector(sector);
+ bool? sectorStatus = Checksums.CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
- UnknownLBAs.Add((ulong)i + sectorAddress);
+ unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
- FailingLBAs.Add((ulong)i + sectorAddress);
+ failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
- if(UnknownLBAs.Count > 0) return null;
- if(FailingLBAs.Count > 0) return false;
+ if(unknownLbas.Count > 0) return null;
+ if(failingLbas.Count > 0) return false;
return true;
}
- public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List FailingLBAs,
- out List UnknownLBAs)
+ public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas,
+ out List unknownLbas)
{
byte[] buffer = ReadSectorsLong(sectorAddress, length, track);
int bps = (int)(buffer.Length / length);
byte[] sector = new byte[bps];
- FailingLBAs = new List();
- UnknownLBAs = new List();
+ failingLbas = new List();
+ unknownLbas = new List();
for(int i = 0; i < length; i++)
{
Array.Copy(buffer, i * bps, sector, 0, bps);
- bool? sectorStatus = Checksums.CDChecksums.CheckCDSector(sector);
+ bool? sectorStatus = Checksums.CdChecksums.CheckCdSector(sector);
switch(sectorStatus)
{
case null:
- UnknownLBAs.Add((ulong)i + sectorAddress);
+ unknownLbas.Add((ulong)i + sectorAddress);
break;
case false:
- FailingLBAs.Add((ulong)i + sectorAddress);
+ failingLbas.Add((ulong)i + sectorAddress);
break;
}
}
- if(UnknownLBAs.Count > 0) return null;
- if(FailingLBAs.Count > 0) return false;
+ if(unknownLbas.Count > 0) return null;
+ if(failingLbas.Count > 0) return false;
return true;
}
@@ -1647,11 +1647,11 @@ namespace DiscImageChef.ImagePlugins
{
switch(trackType)
{
- case AlcoholTrackMode.Mode1: return TrackType.CDMode1;
+ case AlcoholTrackMode.Mode1: return TrackType.CdMode1;
case AlcoholTrackMode.Mode2F1:
- case AlcoholTrackMode.Mode2F1Alt: return TrackType.CDMode2Form1;
- case AlcoholTrackMode.Mode2F2: return TrackType.CDMode2Form2;
- case AlcoholTrackMode.Mode2: return TrackType.CDMode2Formless;
+ case AlcoholTrackMode.Mode2F1Alt: return TrackType.CdMode2Form1;
+ case AlcoholTrackMode.Mode2F2: return TrackType.CdMode2Form2;
+ case AlcoholTrackMode.Mode2: return TrackType.CdMode2Formless;
case AlcoholTrackMode.Audio: return TrackType.Audio;
default: return TrackType.Data;
}
@@ -1674,82 +1674,82 @@ namespace DiscImageChef.ImagePlugins
#region Unsupported features
public override string GetImageApplicationVersion()
{
- return ImageInfo.imageApplicationVersion;
+ return ImageInfo.ImageApplicationVersion;
}
public override DateTime GetImageCreationTime()
{
- return ImageInfo.imageCreationTime;
+ return ImageInfo.ImageCreationTime;
}
public override DateTime GetImageLastModificationTime()
{
- return ImageInfo.imageLastModificationTime;
+ return ImageInfo.ImageLastModificationTime;
}
public override string GetImageComments()
{
- return ImageInfo.imageComments;
+ return ImageInfo.ImageComments;
}
public override string GetMediaSerialNumber()
{
- return ImageInfo.mediaSerialNumber;
+ return ImageInfo.MediaSerialNumber;
}
public override string GetMediaBarcode()
{
- return ImageInfo.mediaBarcode;
+ return ImageInfo.MediaBarcode;
}
public override int GetMediaSequence()
{
- return ImageInfo.mediaSequence;
+ return ImageInfo.MediaSequence;
}
public override int GetLastDiskSequence()
{
- return ImageInfo.lastMediaSequence;
+ return ImageInfo.LastMediaSequence;
}
public override string GetDriveManufacturer()
{
- return ImageInfo.driveManufacturer;
+ return ImageInfo.DriveManufacturer;
}
public override string GetDriveModel()
{
- return ImageInfo.driveModel;
+ return ImageInfo.DriveModel;
}
public override string GetDriveSerialNumber()
{
- return ImageInfo.driveSerialNumber;
+ return ImageInfo.DriveSerialNumber;
}
public override string GetMediaPartNumber()
{
- return ImageInfo.mediaPartNumber;
+ return ImageInfo.MediaPartNumber;
}
public override string GetMediaManufacturer()
{
- return ImageInfo.mediaManufacturer;
+ return ImageInfo.MediaManufacturer;
}
public override string GetMediaModel()
{
- return ImageInfo.mediaModel;
+ return ImageInfo.MediaModel;
}
public override string GetImageName()
{
- return ImageInfo.imageName;
+ return ImageInfo.ImageName;
}
public override string GetImageCreator()
{
- return ImageInfo.imageCreator;
+ return ImageInfo.ImageCreator;
}
#endregion Unsupported features
}
diff --git a/DiscImageChef.DiscImages/Anex86.cs b/DiscImageChef.DiscImages/Anex86.cs
index 0243a0505..1b513f659 100644
--- a/DiscImageChef.DiscImages/Anex86.cs
+++ b/DiscImageChef.DiscImages/Anex86.cs
@@ -38,7 +38,7 @@ using DiscImageChef.CommonTypes;
using DiscImageChef.Console;
using DiscImageChef.Filters;
-namespace DiscImageChef.ImagePlugins
+namespace DiscImageChef.DiscImages
{
public class Anex86 : ImagePlugin
{
@@ -60,29 +60,29 @@ namespace DiscImageChef.ImagePlugins
public Anex86()
{
Name = "Anex86 Disk Image";
- PluginUUID = new Guid("0410003E-6E7B-40E6-9328-BA5651ADF6B7");
+ PluginUuid = new Guid("0410003E-6E7B-40E6-9328-BA5651ADF6B7");
ImageInfo = new ImageInfo()
{
- readableSectorTags = new List(),
- readableMediaTags = new List(),
- imageHasPartitions = false,
- imageHasSessions = false,
- imageVersion = null,
- imageApplication = null,
- imageApplicationVersion = null,
- imageCreator = null,
- imageComments = null,
- mediaManufacturer = null,
- mediaModel = null,
- mediaSerialNumber = null,
- mediaBarcode = null,
- mediaPartNumber = null,
- mediaSequence = 0,
- lastMediaSequence = 0,
- driveManufacturer = null,
- driveModel = null,
- driveSerialNumber = null,
- driveFirmwareRevision = null
+ ReadableSectorTags = new List(),
+ ReadableMediaTags = new List(),
+ ImageHasPartitions = false,
+ ImageHasSessions = false,
+ ImageVersion = null,
+ ImageApplication = null,
+ ImageApplicationVersion = null,
+ ImageCreator = null,
+ ImageComments = null,
+ MediaManufacturer = null,
+ MediaModel = null,
+ MediaSerialNumber = null,
+ MediaBarcode = null,
+ MediaPartNumber = null,
+ MediaSequence = 0,
+ LastMediaSequence = 0,
+ DriveManufacturer = null,
+ DriveModel = null,
+ DriveSerialNumber = null,
+ DriveFirmwareRevision = null
};
}
@@ -98,10 +98,10 @@ namespace DiscImageChef.ImagePlugins
if(stream.Length < Marshal.SizeOf(fdihdr)) return false;
- byte[] hdr_b = new byte[Marshal.SizeOf(fdihdr)];
- stream.Read(hdr_b, 0, hdr_b.Length);
+ byte[] hdrB = new byte[Marshal.SizeOf(fdihdr)];
+ stream.Read(hdrB, 0, hdrB.Length);
- GCHandle handle = GCHandle.Alloc(hdr_b, GCHandleType.Pinned);
+ GCHandle handle = GCHandle.Alloc(hdrB, GCHandleType.Pinned);
fdihdr = (Anex86Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(Anex86Header));
handle.Free();
@@ -127,14 +127,14 @@ namespace DiscImageChef.ImagePlugins
if(stream.Length < Marshal.SizeOf(fdihdr)) return false;
- byte[] hdr_b = new byte[Marshal.SizeOf(fdihdr)];
- stream.Read(hdr_b, 0, hdr_b.Length);
+ byte[] hdrB = new byte[Marshal.SizeOf(fdihdr)];
+ stream.Read(hdrB, 0, hdrB.Length);
- GCHandle handle = GCHandle.Alloc(hdr_b, GCHandleType.Pinned);
+ GCHandle handle = GCHandle.Alloc(hdrB, GCHandleType.Pinned);
fdihdr = (Anex86Header)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(Anex86Header));
handle.Free();
- ImageInfo.mediaType = MediaType.GENERIC_HDD;
+ ImageInfo.MediaType = MediaType.GENERIC_HDD;
switch(fdihdr.cylinders)
{
@@ -145,12 +145,12 @@ namespace DiscImageChef.ImagePlugins
switch(fdihdr.spt)
{
case 8:
- if(fdihdr.heads == 1) ImageInfo.mediaType = MediaType.DOS_525_SS_DD_8;
- else if(fdihdr.heads == 2) ImageInfo.mediaType = MediaType.DOS_525_DS_DD_8;
+ if(fdihdr.heads == 1) ImageInfo.MediaType = MediaType.DOS_525_SS_DD_8;
+ else if(fdihdr.heads == 2) ImageInfo.MediaType = MediaType.DOS_525_DS_DD_8;
break;
case 9:
- if(fdihdr.heads == 1) ImageInfo.mediaType = MediaType.DOS_525_SS_DD_9;
- else if(fdihdr.heads == 2) ImageInfo.mediaType = MediaType.DOS_525_DS_DD_9;
+ if(fdihdr.heads == 1) ImageInfo.MediaType = MediaType.DOS_525_SS_DD_9;
+ else if(fdihdr.heads == 2) ImageInfo.MediaType = MediaType.DOS_525_DS_DD_9;
break;
}
@@ -165,7 +165,7 @@ namespace DiscImageChef.ImagePlugins
switch(fdihdr.spt)
{
case 9:
- if(fdihdr.heads == 1) ImageInfo.mediaType = MediaType.Apricot_35;
+ if(fdihdr.heads == 1) ImageInfo.MediaType = MediaType.Apricot_35;
break;
}
@@ -180,7 +180,7 @@ namespace DiscImageChef.ImagePlugins
switch(fdihdr.spt)
{
case 26:
- if(fdihdr.heads == 2) ImageInfo.mediaType = MediaType.NEC_8_SD;
+ if(fdihdr.heads == 2) ImageInfo.MediaType = MediaType.NEC_8_SD;
break;
}
@@ -189,7 +189,7 @@ namespace DiscImageChef.ImagePlugins
switch(fdihdr.spt)
{
case 26:
- if(fdihdr.heads == 2) ImageInfo.mediaType = MediaType.NEC_8_DD;
+ if(fdihdr.heads == 2) ImageInfo.MediaType = MediaType.NEC_8_DD;
break;
}
@@ -198,7 +198,7 @@ namespace DiscImageChef.ImagePlugins
switch(fdihdr.spt)
{
case 8:
- if(fdihdr.heads == 1) ImageInfo.mediaType = MediaType.Apricot_35;
+ if(fdihdr.heads == 1) ImageInfo.MediaType = MediaType.Apricot_35;
break;
}
@@ -207,7 +207,7 @@ namespace DiscImageChef.ImagePlugins
switch(fdihdr.spt)
{
case 8:
- if(fdihdr.heads == 2) ImageInfo.mediaType = MediaType.NEC_525_HD;
+ if(fdihdr.heads == 2) ImageInfo.MediaType = MediaType.NEC_525_HD;
break;
}
@@ -222,8 +222,8 @@ namespace DiscImageChef.ImagePlugins
switch(fdihdr.spt)
{
case 16:
- if(fdihdr.heads == 1) ImageInfo.mediaType = MediaType.NEC_525_SS;
- else if(fdihdr.heads == 2) ImageInfo.mediaType = MediaType.NEC_525_DS;
+ if(fdihdr.heads == 1) ImageInfo.MediaType = MediaType.NEC_525_SS;
+ else if(fdihdr.heads == 2) ImageInfo.MediaType = MediaType.NEC_525_DS;
break;
}
@@ -232,21 +232,21 @@ namespace DiscImageChef.ImagePlugins
switch(fdihdr.spt)
{
case 8:
- if(fdihdr.heads == 1) ImageInfo.mediaType = MediaType.DOS_35_SS_DD_8;
- else if(fdihdr.heads == 2) ImageInfo.mediaType = MediaType.DOS_35_DS_DD_8;
+ if(fdihdr.heads == 1) ImageInfo.MediaType = MediaType.DOS_35_SS_DD_8;
+ else if(fdihdr.heads == 2) ImageInfo.MediaType = MediaType.DOS_35_DS_DD_8;
break;
case 9:
- if(fdihdr.heads == 1) ImageInfo.mediaType = MediaType.DOS_35_SS_DD_9;
- else if(fdihdr.heads == 2) ImageInfo.mediaType = MediaType.DOS_35_DS_DD_9;
+ if(fdihdr.heads == 1) ImageInfo.MediaType = MediaType.DOS_35_SS_DD_9;
+ else if(fdihdr.heads == 2) ImageInfo.MediaType = MediaType.DOS_35_DS_DD_9;
break;
case 15:
- if(fdihdr.heads == 2) ImageInfo.mediaType = MediaType.NEC_35_HD_15;
+ if(fdihdr.heads == 2) ImageInfo.MediaType = MediaType.NEC_35_HD_15;
break;
case 18:
- if(fdihdr.heads == 2) ImageInfo.mediaType = MediaType.DOS_35_HD;
+ if(fdihdr.heads == 2) ImageInfo.MediaType = MediaType.DOS_35_HD;
break;
case 36:
- if(fdihdr.heads == 2) ImageInfo.mediaType = MediaType.DOS_35_ED;
+ if(fdihdr.heads == 2) ImageInfo.MediaType = MediaType.DOS_35_ED;
break;
}
@@ -261,7 +261,7 @@ namespace DiscImageChef.ImagePlugins
switch(fdihdr.spt)
{
case 38:
- if(fdihdr.heads == 2) ImageInfo.mediaType = MediaType.NEC_35_TD;
+ if(fdihdr.heads == 2) ImageInfo.MediaType = MediaType.NEC_35_TD;
break;
}
@@ -271,18 +271,18 @@ namespace DiscImageChef.ImagePlugins
break;
}
- DicConsole.DebugWriteLine("Anex86 plugin", "MediaType: {0}", ImageInfo.mediaType);
+ DicConsole.DebugWriteLine("Anex86 plugin", "MediaType: {0}", ImageInfo.MediaType);
- ImageInfo.imageSize = (ulong)fdihdr.dskSize;
- ImageInfo.imageCreationTime = imageFilter.GetCreationTime();
- ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime();
- ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename());
- ImageInfo.sectors = (ulong)(fdihdr.cylinders * fdihdr.heads * fdihdr.spt);
- ImageInfo.xmlMediaType = XmlMediaType.BlockMedia;
- ImageInfo.sectorSize = (uint)fdihdr.bps;
- ImageInfo.cylinders = (uint)fdihdr.cylinders;
- ImageInfo.heads = (uint)fdihdr.heads;
- ImageInfo.sectorsPerTrack = (uint)fdihdr.spt;
+ ImageInfo.ImageSize = (ulong)fdihdr.dskSize;
+ ImageInfo.ImageCreationTime = imageFilter.GetCreationTime();
+ ImageInfo.ImageLastModificationTime = imageFilter.GetLastWriteTime();
+ ImageInfo.ImageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename());
+ ImageInfo.Sectors = (ulong)(fdihdr.cylinders * fdihdr.heads * fdihdr.spt);
+ ImageInfo.XmlMediaType = XmlMediaType.BlockMedia;
+ ImageInfo.SectorSize = (uint)fdihdr.bps;
+ ImageInfo.Cylinders = (uint)fdihdr.cylinders;
+ ImageInfo.Heads = (uint)fdihdr.heads;
+ ImageInfo.SectorsPerTrack = (uint)fdihdr.spt;
anexImageFilter = imageFilter;
@@ -296,17 +296,17 @@ namespace DiscImageChef.ImagePlugins
public override ulong GetImageSize()
{
- return ImageInfo.imageSize;
+ return ImageInfo.ImageSize;
}
public override ulong GetSectors()
{
- return ImageInfo.sectors;
+ return ImageInfo.Sectors;
}
public override uint GetSectorSize()
{
- return ImageInfo.sectorSize;
+ return ImageInfo.SectorSize;
}
public override string GetImageFormat()
@@ -316,47 +316,47 @@ namespace DiscImageChef.ImagePlugins
public override string GetImageVersion()
{
- return ImageInfo.imageVersion;
+ return ImageInfo.ImageVersion;
}
public override string GetImageApplication()
{
- return ImageInfo.imageApplication;
+ return ImageInfo.ImageApplication;
}
public override string GetImageApplicationVersion()
{
- return ImageInfo.imageApplicationVersion;
+ return ImageInfo.ImageApplicationVersion;
}
public override string GetImageCreator()
{
- return ImageInfo.imageCreator;
+ return ImageInfo.ImageCreator;
}
public override DateTime GetImageCreationTime()
{
- return ImageInfo.imageCreationTime;
+ return ImageInfo.ImageCreationTime;
}
public override DateTime GetImageLastModificationTime()
{
- return ImageInfo.imageLastModificationTime;
+ return ImageInfo.ImageLastModificationTime;
}
public override string GetImageName()
{
- return ImageInfo.imageName;
+ return ImageInfo.ImageName;
}
public override string GetImageComments()
{
- return ImageInfo.imageComments;
+ return ImageInfo.ImageComments;
}
public override MediaType GetMediaType()
{
- return ImageInfo.mediaType;
+ return ImageInfo.MediaType;
}
public override byte[] ReadSector(ulong sectorAddress)
@@ -366,19 +366,19 @@ namespace DiscImageChef.ImagePlugins
public override byte[] ReadSectors(ulong sectorAddress, uint length)
{
- if(sectorAddress > ImageInfo.sectors - 1)
+ if(sectorAddress > ImageInfo.Sectors - 1)
throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found");
- if(sectorAddress + length > ImageInfo.sectors)
+ if(sectorAddress + length > ImageInfo.Sectors)
throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available");
- byte[] buffer = new byte[length * ImageInfo.sectorSize];
+ byte[] buffer = new byte[length * ImageInfo.SectorSize];
Stream stream = anexImageFilter.GetDataForkStream();
- stream.Seek((long)((ulong)fdihdr.hdrSize + sectorAddress * ImageInfo.sectorSize), SeekOrigin.Begin);
+ stream.Seek((long)((ulong)fdihdr.hdrSize + sectorAddress * ImageInfo.SectorSize), SeekOrigin.Begin);
- stream.Read(buffer, 0, (int)(length * ImageInfo.sectorSize));
+ stream.Read(buffer, 0, (int)(length * ImageInfo.SectorSize));
return buffer;
}
@@ -524,18 +524,18 @@ namespace DiscImageChef.ImagePlugins
throw new FeatureUnsupportedImageException("Feature not supported by image format");
}
- public override bool? VerifySectors(ulong sectorAddress, uint length, out List FailingLBAs,
- out List UnknownLBAs)
+ public override bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas,
+ out List unknownLbas)
{
- FailingLBAs = new List();
- UnknownLBAs = new List();
- for(ulong i = 0; i < ImageInfo.sectors; i++) UnknownLBAs.Add(i);
+ failingLbas = new List();
+ unknownLbas = new List();
+ for(ulong i = 0; i < ImageInfo.Sectors; i++) unknownLbas.Add(i);
return null;
}
- public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List FailingLBAs,
- out List UnknownLBAs)
+ public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas,
+ out List unknownLbas)
{
throw new FeatureUnsupportedImageException("Feature not supported by image format");
}
diff --git a/DiscImageChef.DiscImages/Apple2MG.cs b/DiscImageChef.DiscImages/Apple2MG.cs
index 94e1330db..8c5c764bf 100644
--- a/DiscImageChef.DiscImages/Apple2MG.cs
+++ b/DiscImageChef.DiscImages/Apple2MG.cs
@@ -38,82 +38,82 @@ using DiscImageChef.CommonTypes;
using DiscImageChef.Console;
using DiscImageChef.Filters;
-namespace DiscImageChef.ImagePlugins
+namespace DiscImageChef.DiscImages
{
- public class Apple2MG : ImagePlugin
+ public class Apple2Mg : ImagePlugin
{
#region Internal Structures
// DiskCopy 4.2 header, big-endian, data-fork, start of file, 84 bytes
- struct A2IMGHeader
+ struct A2ImgHeader
{
///
/// Offset 0x00, magic
///
- public uint magic;
+ public uint Magic;
///
/// Offset 0x04, disk image creator ID
///
- public uint creator;
+ public uint Creator;
///
/// Offset 0x08, header size, constant 0x0040
///
- public ushort headerSize;
+ public ushort HeaderSize;
///
/// Offset 0x0A, disk image version
///
- public ushort version;
+ public ushort Version;
///
/// Offset 0x0C, disk image format
///
- public uint imageFormat;
+ public uint ImageFormat;
///
/// Offset 0x10, flags and volume number
///
- public uint flags;
+ public uint Flags;
///
/// Offset 0x14, blocks for ProDOS, 0 otherwise
///
- public uint blocks;
+ public uint Blocks;
///
/// Offset 0x18, offset to data
///
- public uint dataOffset;
+ public uint DataOffset;
///
/// Offset 0x1C, data size in bytes
///
- public uint dataSize;
+ public uint DataSize;
///
/// Offset 0x20, offset to optional comment
///
- public uint commentOffset;
+ public uint CommentOffset;
///
/// Offset 0x24, length of optional comment
///
- public uint commentSize;
+ public uint CommentSize;
///
/// Offset 0x28, offset to creator specific chunk
///
- public uint creatorSpecificOffset;
+ public uint CreatorSpecificOffset;
///
/// Offset 0x2C, creator specific chunk size
///
- public uint creatorSpecificSize;
+ public uint CreatorSpecificSize;
///
/// Offset 0x30, reserved, should be zero
///
- public uint reserved1;
+ public uint Reserved1;
///
/// Offset 0x34, reserved, should be zero
///
- public uint reserved2;
+ public uint Reserved2;
///
/// Offset 0x38, reserved, should be zero
///
- public uint reserved3;
+ public uint Reserved3;
///
/// Offset 0x3C, reserved, should be zero
///
- public uint reserved4;
+ public uint Reserved4;
}
#endregion
@@ -121,75 +121,75 @@ namespace DiscImageChef.ImagePlugins
///
/// Magic number, "2IMG"
///
- public const uint MAGIC = 0x474D4932;
+ const uint MAGIC = 0x474D4932;
///
/// Disk image created by ASIMOV2, "!nfc"
///
- public const uint CreatorAsimov = 0x63666E21;
+ const uint CREATOR_ASIMOV = 0x63666E21;
///
/// Disk image created by Bernie ][ the Rescue, "B2TR"
///
- public const uint CreatorBernie = 0x52543242;
+ const uint CREATOR_BERNIE = 0x52543242;
///
/// Disk image created by Catakig, "CTKG"
///
- public const uint CreatorCatakig = 0x474B5443;
+ const uint CREATOR_CATAKIG = 0x474B5443;
///
/// Disk image created by Sheppy's ImageMaker, "ShIm"
///
- public const uint CreatorSheppy = 0x6D496853;
+ const uint CREATOR_SHEPPY = 0x6D496853;
///
/// Disk image created by Sweet16, "WOOF"
///
- public const uint CreatorSweet = 0x464F4F57;
+ const uint CREATOR_SWEET = 0x464F4F57;
///
/// Disk image created by XGS, "XGS!"
///
- public const uint CreatorXGS = 0x21534758;
+ const uint CREATOR_XGS = 0x21534758;
///
/// Disk image created by CiderPress, "CdrP"
///
- public const uint CreatorCider = 0x50726443;
+ const uint CREATOR_CIDER = 0x50726443;
- public const uint DOSSectorOrder = 0x00000000;
- public const uint ProDOSSectorOrder = 0x00000001;
- public const uint NIBSectorOrder = 0x00000002;
+ const uint DOS_SECTOR_ORDER = 0x00000000;
+ const uint PRODOS_SECTOR_ORDER = 0x00000001;
+ const uint NIB_SECTOR_ORDER = 0x00000002;
- public const uint LockedDisk = 0x80000000;
- public const uint ValidVolumeNumber = 0x00000100;
- public const uint VolumeNumberMask = 0x000000FF;
+ const uint LOCKED_DISK = 0x80000000;
+ const uint VALID_VOLUME_NUMBER = 0x00000100;
+ const uint VOLUME_NUMBER_MASK = 0x000000FF;
#endregion
#region Internal variables
- A2IMGHeader ImageHeader;
- Filter a2mgImageFilter;
+ A2ImgHeader imageHeader;
+ Filter a2MgImageFilter;
#endregion
- public Apple2MG()
+ public Apple2Mg()
{
Name = "Apple 2IMG";
- PluginUUID = new Guid("CBAF8824-BA5F-415F-953A-19A03519B2D1");
+ PluginUuid = new Guid("CBAF8824-BA5F-415F-953A-19A03519B2D1");
ImageInfo = new ImageInfo();
- ImageInfo.readableSectorTags = new List();
- ImageInfo.readableMediaTags = new List();
- ImageInfo.imageHasPartitions = false;
- ImageInfo.imageHasSessions = false;
- ImageInfo.imageVersion = null;
- ImageInfo.imageApplication = null;
- ImageInfo.imageApplicationVersion = null;
- ImageInfo.imageCreator = null;
- ImageInfo.imageComments = null;
- ImageInfo.mediaManufacturer = null;
- ImageInfo.mediaModel = null;
- ImageInfo.mediaSerialNumber = null;
- ImageInfo.mediaBarcode = null;
- ImageInfo.mediaPartNumber = null;
- ImageInfo.mediaSequence = 0;
- ImageInfo.lastMediaSequence = 0;
- ImageInfo.driveManufacturer = null;
- ImageInfo.driveModel = null;
- ImageInfo.driveSerialNumber = null;
- ImageInfo.driveFirmwareRevision = null;
+ ImageInfo.ReadableSectorTags = new List();
+ ImageInfo.ReadableMediaTags = new List();
+ ImageInfo.ImageHasPartitions = false;
+ ImageInfo.ImageHasSessions = false;
+ ImageInfo.ImageVersion = null;
+ ImageInfo.ImageApplication = null;
+ ImageInfo.ImageApplicationVersion = null;
+ ImageInfo.ImageCreator = null;
+ ImageInfo.ImageComments = null;
+ ImageInfo.MediaManufacturer = null;
+ ImageInfo.MediaModel = null;
+ ImageInfo.MediaSerialNumber = null;
+ ImageInfo.MediaBarcode = null;
+ ImageInfo.MediaPartNumber = null;
+ ImageInfo.MediaSequence = 0;
+ ImageInfo.LastMediaSequence = 0;
+ ImageInfo.DriveManufacturer = null;
+ ImageInfo.DriveModel = null;
+ ImageInfo.DriveSerialNumber = null;
+ ImageInfo.DriveFirmwareRevision = null;
}
public override bool IdentifyImage(Filter imageFilter)
@@ -231,7 +231,7 @@ namespace DiscImageChef.ImagePlugins
Stream stream = imageFilter.GetDataForkStream();
stream.Seek(0, SeekOrigin.Begin);
- ImageHeader = new A2IMGHeader();
+ imageHeader = new A2ImgHeader();
byte[] header = new byte[64];
stream.Read(header, 0, 64);
@@ -241,152 +241,152 @@ namespace DiscImageChef.ImagePlugins
Array.Copy(header, 0, magic, 0, 4);
Array.Copy(header, 4, creator, 0, 4);
- ImageHeader.magic = BitConverter.ToUInt32(header, 0x00);
- ImageHeader.creator = BitConverter.ToUInt32(header, 0x04);
- ImageHeader.headerSize = BitConverter.ToUInt16(header, 0x08);
- ImageHeader.version = BitConverter.ToUInt16(header, 0x0A);
- ImageHeader.imageFormat = BitConverter.ToUInt32(header, 0x0C);
- ImageHeader.flags = BitConverter.ToUInt32(header, 0x10);
- ImageHeader.blocks = BitConverter.ToUInt32(header, 0x14);
- ImageHeader.dataOffset = BitConverter.ToUInt32(header, 0x18);
- ImageHeader.dataSize = BitConverter.ToUInt32(header, 0x1C);
- ImageHeader.commentOffset = BitConverter.ToUInt32(header, 0x20);
- ImageHeader.commentSize = BitConverter.ToUInt32(header, 0x24);
- ImageHeader.creatorSpecificOffset = BitConverter.ToUInt32(header, 0x28);
- ImageHeader.creatorSpecificSize = BitConverter.ToUInt32(header, 0x2C);
- ImageHeader.reserved1 = BitConverter.ToUInt32(header, 0x30);
- ImageHeader.reserved2 = BitConverter.ToUInt32(header, 0x34);
- ImageHeader.reserved3 = BitConverter.ToUInt32(header, 0x38);
- ImageHeader.reserved4 = BitConverter.ToUInt32(header, 0x3C);
+ imageHeader.Magic = BitConverter.ToUInt32(header, 0x00);
+ imageHeader.Creator = BitConverter.ToUInt32(header, 0x04);
+ imageHeader.HeaderSize = BitConverter.ToUInt16(header, 0x08);
+ imageHeader.Version = BitConverter.ToUInt16(header, 0x0A);
+ imageHeader.ImageFormat = BitConverter.ToUInt32(header, 0x0C);
+ imageHeader.Flags = BitConverter.ToUInt32(header, 0x10);
+ imageHeader.Blocks = BitConverter.ToUInt32(header, 0x14);
+ imageHeader.DataOffset = BitConverter.ToUInt32(header, 0x18);
+ imageHeader.DataSize = BitConverter.ToUInt32(header, 0x1C);
+ imageHeader.CommentOffset = BitConverter.ToUInt32(header, 0x20);
+ imageHeader.CommentSize = BitConverter.ToUInt32(header, 0x24);
+ imageHeader.CreatorSpecificOffset = BitConverter.ToUInt32(header, 0x28);
+ imageHeader.CreatorSpecificSize = BitConverter.ToUInt32(header, 0x2C);
+ imageHeader.Reserved1 = BitConverter.ToUInt32(header, 0x30);
+ imageHeader.Reserved2 = BitConverter.ToUInt32(header, 0x34);
+ imageHeader.Reserved3 = BitConverter.ToUInt32(header, 0x38);
+ imageHeader.Reserved4 = BitConverter.ToUInt32(header, 0x3C);
- if(ImageHeader.dataSize == 0x00800C00)
+ if(imageHeader.DataSize == 0x00800C00)
{
- ImageHeader.dataSize = 0x000C8000;
+ imageHeader.DataSize = 0x000C8000;
DicConsole.DebugWriteLine("2MG plugin", "Detected incorrect endian on data size field, correcting.");
}
DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.magic = \"{0}\"", Encoding.ASCII.GetString(magic));
DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.creator = \"{0}\"", Encoding.ASCII.GetString(creator));
- DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.headerSize = {0}", ImageHeader.headerSize);
- DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.version = {0}", ImageHeader.version);
- DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.imageFormat = {0}", ImageHeader.imageFormat);
- DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.flags = 0x{0:X8}", ImageHeader.flags);
- DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.blocks = {0}", ImageHeader.blocks);
- DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.dataOffset = 0x{0:X8}", ImageHeader.dataOffset);
- DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.dataSize = {0}", ImageHeader.dataSize);
- DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.commentOffset = 0x{0:X8}", ImageHeader.commentOffset);
- DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.commentSize = {0}", ImageHeader.commentSize);
+ DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.headerSize = {0}", imageHeader.HeaderSize);
+ DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.version = {0}", imageHeader.Version);
+ DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.imageFormat = {0}", imageHeader.ImageFormat);
+ DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.flags = 0x{0:X8}", imageHeader.Flags);
+ DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.blocks = {0}", imageHeader.Blocks);
+ DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.dataOffset = 0x{0:X8}", imageHeader.DataOffset);
+ DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.dataSize = {0}", imageHeader.DataSize);
+ DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.commentOffset = 0x{0:X8}", imageHeader.CommentOffset);
+ DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.commentSize = {0}", imageHeader.CommentSize);
DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.creatorSpecificOffset = 0x{0:X8}",
- ImageHeader.creatorSpecificOffset);
+ imageHeader.CreatorSpecificOffset);
DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.creatorSpecificSize = {0}",
- ImageHeader.creatorSpecificSize);
- DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.reserved1 = 0x{0:X8}", ImageHeader.reserved1);
- DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.reserved2 = 0x{0:X8}", ImageHeader.reserved2);
- DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.reserved3 = 0x{0:X8}", ImageHeader.reserved3);
- DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.reserved4 = 0x{0:X8}", ImageHeader.reserved4);
+ imageHeader.CreatorSpecificSize);
+ DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.reserved1 = 0x{0:X8}", imageHeader.Reserved1);
+ DicConsole.DebugWriteLine("2MG plugin", "ImageHeader.reserved2 = 0x{0:X8}", imageHeader.Reserved2);
+ 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) return false;
+ if(imageHeader.DataSize == 0 && imageHeader.Blocks == 0 &&
+ imageHeader.ImageFormat != PRODOS_SECTOR_ORDER) return false;
- if(ImageHeader.imageFormat == ProDOSSectorOrder && ImageHeader.blocks == 0) return false;
+ if(imageHeader.ImageFormat == PRODOS_SECTOR_ORDER && imageHeader.Blocks == 0) return false;
- if(ImageHeader.imageFormat == ProDOSSectorOrder) ImageHeader.dataSize = ImageHeader.blocks * 512;
- else if(ImageHeader.blocks == 0 && ImageHeader.dataSize != 0)
- ImageHeader.blocks = ImageHeader.dataSize / 256;
- else if(ImageHeader.dataSize == 0 && ImageHeader.blocks != 0)
- ImageHeader.dataSize = ImageHeader.blocks * 256;
+ if(imageHeader.ImageFormat == PRODOS_SECTOR_ORDER) imageHeader.DataSize = imageHeader.Blocks * 512;
+ else if(imageHeader.Blocks == 0 && imageHeader.DataSize != 0)
+ imageHeader.Blocks = imageHeader.DataSize / 256;
+ else if(imageHeader.DataSize == 0 && imageHeader.Blocks != 0)
+ imageHeader.DataSize = imageHeader.Blocks * 256;
- ImageInfo.sectorSize = (uint)(ImageHeader.imageFormat == ProDOSSectorOrder ? 512 : 256);
+ ImageInfo.SectorSize = (uint)(imageHeader.ImageFormat == PRODOS_SECTOR_ORDER ? 512 : 256);
- ImageInfo.sectors = ImageHeader.blocks;
- ImageInfo.imageSize = ImageHeader.dataSize;
+ ImageInfo.Sectors = imageHeader.Blocks;
+ ImageInfo.ImageSize = imageHeader.DataSize;
- switch(ImageHeader.creator)
+ switch(imageHeader.Creator)
{
- case CreatorAsimov:
- ImageInfo.imageApplication = "ASIMOV2";
+ case CREATOR_ASIMOV:
+ ImageInfo.ImageApplication = "ASIMOV2";
break;
- case CreatorBernie:
- ImageInfo.imageApplication = "Bernie ][ the Rescue";
+ case CREATOR_BERNIE:
+ ImageInfo.ImageApplication = "Bernie ][ the Rescue";
break;
- case CreatorCatakig:
- ImageInfo.imageApplication = "Catakig";
+ case CREATOR_CATAKIG:
+ ImageInfo.ImageApplication = "Catakig";
break;
- case CreatorSheppy:
- ImageInfo.imageApplication = "Sheppy's ImageMaker";
+ case CREATOR_SHEPPY:
+ ImageInfo.ImageApplication = "Sheppy's ImageMaker";
break;
- case CreatorSweet:
- ImageInfo.imageApplication = "Sweet16";
+ case CREATOR_SWEET:
+ ImageInfo.ImageApplication = "Sweet16";
break;
- case CreatorXGS:
- ImageInfo.imageApplication = "XGS";
+ case CREATOR_XGS:
+ ImageInfo.ImageApplication = "XGS";
break;
- case CreatorCider:
- ImageInfo.imageApplication = "CiderPress";
+ case CREATOR_CIDER:
+ ImageInfo.ImageApplication = "CiderPress";
break;
default:
- ImageInfo.imageApplication =
+ ImageInfo.ImageApplication =
string.Format("Unknown creator code \"{0}\"", Encoding.ASCII.GetString(creator));
break;
}
- ImageInfo.imageVersion = ImageHeader.version.ToString();
+ 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);
+ stream.Seek(imageHeader.CommentOffset, SeekOrigin.Begin);
- byte[] comments = new byte[ImageHeader.commentSize];
- stream.Read(comments, 0, (int)ImageHeader.commentSize);
- ImageInfo.imageComments = Encoding.ASCII.GetString(comments);
+ byte[] comments = new byte[imageHeader.CommentSize];
+ stream.Read(comments, 0, (int)imageHeader.CommentSize);
+ ImageInfo.ImageComments = Encoding.ASCII.GetString(comments);
}
- ImageInfo.imageCreationTime = imageFilter.GetCreationTime();
- ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime();
- ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename());
- ImageInfo.mediaType = GetMediaType();
+ ImageInfo.ImageCreationTime = imageFilter.GetCreationTime();
+ ImageInfo.ImageLastModificationTime = imageFilter.GetLastWriteTime();
+ ImageInfo.ImageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename());
+ ImageInfo.MediaType = GetMediaType();
- a2mgImageFilter = imageFilter;
+ a2MgImageFilter = imageFilter;
- ImageInfo.xmlMediaType = XmlMediaType.BlockMedia;
+ ImageInfo.XmlMediaType = XmlMediaType.BlockMedia;
- DicConsole.VerboseWriteLine("2MG image contains a disk of type {0}", ImageInfo.mediaType);
- if(!string.IsNullOrEmpty(ImageInfo.imageComments))
- DicConsole.VerboseWriteLine("2MG comments: {0}", ImageInfo.imageComments);
+ DicConsole.VerboseWriteLine("2MG image contains a disk of type {0}", ImageInfo.MediaType);
+ if(!string.IsNullOrEmpty(ImageInfo.ImageComments))
+ DicConsole.VerboseWriteLine("2MG comments: {0}", ImageInfo.ImageComments);
- switch(ImageInfo.mediaType)
+ switch(ImageInfo.MediaType)
{
case MediaType.Apple32SS:
- ImageInfo.cylinders = 35;
- ImageInfo.heads = 1;
- ImageInfo.sectorsPerTrack = 13;
+ ImageInfo.Cylinders = 35;
+ ImageInfo.Heads = 1;
+ ImageInfo.SectorsPerTrack = 13;
break;
case MediaType.Apple32DS:
- ImageInfo.cylinders = 35;
- ImageInfo.heads = 2;
- ImageInfo.sectorsPerTrack = 13;
+ ImageInfo.Cylinders = 35;
+ ImageInfo.Heads = 2;
+ ImageInfo.SectorsPerTrack = 13;
break;
case MediaType.Apple33SS:
- ImageInfo.cylinders = 35;
- ImageInfo.heads = 1;
- ImageInfo.sectorsPerTrack = 16;
+ ImageInfo.Cylinders = 35;
+ ImageInfo.Heads = 1;
+ ImageInfo.SectorsPerTrack = 16;
break;
case MediaType.Apple33DS:
- ImageInfo.cylinders = 35;
- ImageInfo.heads = 2;
- ImageInfo.sectorsPerTrack = 16;
+ ImageInfo.Cylinders = 35;
+ ImageInfo.Heads = 2;
+ ImageInfo.SectorsPerTrack = 16;
break;
case MediaType.AppleSonySS:
- ImageInfo.cylinders = 80;
- ImageInfo.heads = 1;
+ ImageInfo.Cylinders = 80;
+ ImageInfo.Heads = 1;
// Variable sectors per track, this suffices
- ImageInfo.sectorsPerTrack = 10;
+ ImageInfo.SectorsPerTrack = 10;
break;
case MediaType.AppleSonyDS:
- ImageInfo.cylinders = 80;
- ImageInfo.heads = 2;
+ ImageInfo.Cylinders = 80;
+ ImageInfo.Heads = 2;
// Variable sectors per track, this suffices
- ImageInfo.sectorsPerTrack = 10;
+ ImageInfo.SectorsPerTrack = 10;
break;
}
@@ -400,17 +400,17 @@ namespace DiscImageChef.ImagePlugins
public override ulong GetImageSize()
{
- return ImageInfo.imageSize;
+ return ImageInfo.ImageSize;
}
public override ulong GetSectors()
{
- return ImageInfo.sectors;
+ return ImageInfo.Sectors;
}
public override uint GetSectorSize()
{
- return ImageInfo.sectorSize;
+ return ImageInfo.SectorSize;
}
public override string GetImageFormat()
@@ -420,47 +420,47 @@ namespace DiscImageChef.ImagePlugins
public override string GetImageVersion()
{
- return ImageInfo.imageVersion;
+ return ImageInfo.ImageVersion;
}
public override string GetImageApplication()
{
- return ImageInfo.imageApplication;
+ return ImageInfo.ImageApplication;
}
public override string GetImageApplicationVersion()
{
- return ImageInfo.imageApplicationVersion;
+ return ImageInfo.ImageApplicationVersion;
}
public override string GetImageCreator()
{
- return ImageInfo.imageCreator;
+ return ImageInfo.ImageCreator;
}
public override DateTime GetImageCreationTime()
{
- return ImageInfo.imageCreationTime;
+ return ImageInfo.ImageCreationTime;
}
public override DateTime GetImageLastModificationTime()
{
- return ImageInfo.imageLastModificationTime;
+ return ImageInfo.ImageLastModificationTime;
}
public override string GetImageName()
{
- return ImageInfo.imageName;
+ return ImageInfo.ImageName;
}
public override string GetImageComments()
{
- return ImageInfo.imageComments;
+ return ImageInfo.ImageComments;
}
public override MediaType GetMediaType()
{
- switch(ImageInfo.sectors)
+ switch(ImageInfo.Sectors)
{
case 455: return MediaType.Apple32SS;
case 910: return MediaType.Apple32DS;
@@ -479,19 +479,19 @@ namespace DiscImageChef.ImagePlugins
public override byte[] ReadSectors(ulong sectorAddress, uint length)
{
- if(sectorAddress > ImageInfo.sectors - 1)
+ if(sectorAddress > ImageInfo.Sectors - 1)
throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found");
- if(sectorAddress + length > ImageInfo.sectors)
+ if(sectorAddress + length > ImageInfo.Sectors)
throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available");
- byte[] buffer = new byte[length * ImageInfo.sectorSize];
+ byte[] buffer = new byte[length * ImageInfo.SectorSize];
- Stream stream = a2mgImageFilter.GetDataForkStream();
+ Stream stream = a2MgImageFilter.GetDataForkStream();
- stream.Seek((long)(ImageHeader.dataOffset + sectorAddress * ImageInfo.sectorSize), SeekOrigin.Begin);
+ stream.Seek((long)(imageHeader.DataOffset + sectorAddress * ImageInfo.SectorSize), SeekOrigin.Begin);
- stream.Read(buffer, 0, (int)(length * ImageInfo.sectorSize));
+ stream.Read(buffer, 0, (int)(length * ImageInfo.SectorSize));
return buffer;
}
@@ -637,18 +637,18 @@ namespace DiscImageChef.ImagePlugins
throw new FeatureUnsupportedImageException("Feature not supported by image format");
}
- public override bool? VerifySectors(ulong sectorAddress, uint length, out List FailingLBAs,
- out List UnknownLBAs)
+ public override bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas,
+ out List unknownLbas)
{
- FailingLBAs = new List();
- UnknownLBAs = new List();
- for(ulong i = 0; i < ImageInfo.sectors; i++) UnknownLBAs.Add(i);
+ failingLbas = new List();
+ unknownLbas = new List();
+ for(ulong i = 0; i < ImageInfo.Sectors; i++) unknownLbas.Add(i);
return null;
}
- public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List FailingLBAs,
- out List UnknownLBAs)
+ public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas,
+ out List unknownLbas)
{
throw new FeatureUnsupportedImageException("Feature not supported by image format");
}
diff --git a/DiscImageChef.DiscImages/AppleDOS.cs b/DiscImageChef.DiscImages/AppleDOS.cs
index 5e8518eb5..419494302 100644
--- a/DiscImageChef.DiscImages/AppleDOS.cs
+++ b/DiscImageChef.DiscImages/AppleDOS.cs
@@ -36,42 +36,42 @@ using System.IO;
using DiscImageChef.CommonTypes;
using DiscImageChef.Filters;
-namespace DiscImageChef.ImagePlugins
+namespace DiscImageChef.DiscImages
{
// Checked using several images and strings inside Apple's DiskImages.framework
- public class AppleDOS : ImagePlugin
+ public class AppleDos : ImagePlugin
{
#region Internal variables
byte[] deinterleaved;
string extension;
#endregion
- public AppleDOS()
+ public AppleDos()
{
Name = "Apple ][ Interleaved Disk Image";
- PluginUUID = new Guid("A5828AC0-62C9-4304-81D4-EFD4AAE47360");
+ PluginUuid = new Guid("A5828AC0-62C9-4304-81D4-EFD4AAE47360");
ImageInfo = new ImageInfo
{
- readableSectorTags = new List(),
- readableMediaTags = new List(),
- imageHasPartitions = false,
- imageHasSessions = false,
- imageVersion = null,
- imageApplication = null,
- imageApplicationVersion = null,
- imageCreator = null,
- imageComments = null,
- mediaManufacturer = null,
- mediaModel = null,
- mediaSerialNumber = null,
- mediaBarcode = null,
- mediaPartNumber = null,
- mediaSequence = 0,
- lastMediaSequence = 0,
- driveManufacturer = null,
- driveModel = null,
- driveSerialNumber = null,
- driveFirmwareRevision = null
+ ReadableSectorTags = new List(),
+ ReadableMediaTags = new List(),
+ ImageHasPartitions = false,
+ ImageHasSessions = false,
+ ImageVersion = null,
+ ImageApplication = null,
+ ImageApplicationVersion = null,
+ ImageCreator = null,
+ ImageComments = null,
+ MediaManufacturer = null,
+ MediaModel = null,
+ MediaSerialNumber = null,
+ MediaBarcode = null,
+ MediaPartNumber = null,
+ MediaSequence = 0,
+ LastMediaSequence = 0,
+ DriveManufacturer = null,
+ DriveModel = null,
+ DriveSerialNumber = null,
+ DriveFirmwareRevision = null
};
}
@@ -111,39 +111,39 @@ namespace DiscImageChef.ImagePlugins
256);
}
- ImageInfo.sectorSize = 256;
- ImageInfo.imageSize = (ulong)imageFilter.GetDataForkLength();
- ImageInfo.imageCreationTime = imageFilter.GetCreationTime();
- ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime();
- ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename());
- ImageInfo.sectors = 560;
- ImageInfo.mediaType = MediaType.Apple33SS;
- ImageInfo.xmlMediaType = XmlMediaType.BlockMedia;
- ImageInfo.cylinders = 35;
- ImageInfo.heads = 2;
- ImageInfo.sectorsPerTrack = 16;
+ ImageInfo.SectorSize = 256;
+ ImageInfo.ImageSize = (ulong)imageFilter.GetDataForkLength();
+ ImageInfo.ImageCreationTime = imageFilter.GetCreationTime();
+ ImageInfo.ImageLastModificationTime = imageFilter.GetLastWriteTime();
+ ImageInfo.ImageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename());
+ ImageInfo.Sectors = 560;
+ ImageInfo.MediaType = MediaType.Apple33SS;
+ ImageInfo.XmlMediaType = XmlMediaType.BlockMedia;
+ ImageInfo.Cylinders = 35;
+ ImageInfo.Heads = 2;
+ ImageInfo.SectorsPerTrack = 16;
return true;
}
public override bool ImageHasPartitions()
{
- return ImageInfo.imageHasPartitions;
+ return ImageInfo.ImageHasPartitions;
}
public override ulong GetImageSize()
{
- return ImageInfo.imageSize;
+ return ImageInfo.ImageSize;
}
public override ulong GetSectors()
{
- return ImageInfo.sectors;
+ return ImageInfo.Sectors;
}
public override uint GetSectorSize()
{
- return ImageInfo.sectorSize;
+ return ImageInfo.SectorSize;
}
public override byte[] ReadSector(ulong sectorAddress)
@@ -153,15 +153,15 @@ namespace DiscImageChef.ImagePlugins
public override byte[] ReadSectors(ulong sectorAddress, uint length)
{
- if(sectorAddress > ImageInfo.sectors - 1)
+ if(sectorAddress > ImageInfo.Sectors - 1)
throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found");
- if(sectorAddress + length > ImageInfo.sectors)
+ if(sectorAddress + length > ImageInfo.Sectors)
throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available");
- byte[] buffer = new byte[length * ImageInfo.sectorSize];
+ byte[] buffer = new byte[length * ImageInfo.SectorSize];
- Array.Copy(deinterleaved, (int)(sectorAddress * ImageInfo.sectorSize), buffer, 0, buffer.Length);
+ Array.Copy(deinterleaved, (int)(sectorAddress * ImageInfo.SectorSize), buffer, 0, buffer.Length);
return buffer;
}
@@ -175,22 +175,22 @@ namespace DiscImageChef.ImagePlugins
public override DateTime GetImageCreationTime()
{
- return ImageInfo.imageCreationTime;
+ return ImageInfo.ImageCreationTime;
}
public override DateTime GetImageLastModificationTime()
{
- return ImageInfo.imageLastModificationTime;
+ return ImageInfo.ImageLastModificationTime;
}
public override string GetImageName()
{
- return ImageInfo.imageName;
+ return ImageInfo.ImageName;
}
public override MediaType GetMediaType()
{
- return ImageInfo.mediaType;
+ return ImageInfo.MediaType;
}
public override bool? VerifySector(ulong sectorAddress)
@@ -203,24 +203,24 @@ namespace DiscImageChef.ImagePlugins
return null;
}
- public override bool? VerifySectors(ulong sectorAddress, uint length, out List FailingLBAs,
- out List UnknownLBAs)
+ public override bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas,
+ out List unknownLbas)
{
- FailingLBAs = new List();
- UnknownLBAs = new List();
+ failingLbas = new List();
+ unknownLbas = new List();
- for(ulong i = sectorAddress; i < sectorAddress + length; i++) UnknownLBAs.Add(i);
+ for(ulong i = sectorAddress; i < sectorAddress + length; i++) unknownLbas.Add(i);
return null;
}
- public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List FailingLBAs,
- out List UnknownLBAs)
+ public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas,
+ out List unknownLbas)
{
- FailingLBAs = new List();
- UnknownLBAs = new List();
+ failingLbas = new List();
+ unknownLbas = new List();
- for(ulong i = sectorAddress; i < sectorAddress + length; i++) UnknownLBAs.Add(i);
+ for(ulong i = sectorAddress; i < sectorAddress + length; i++) unknownLbas.Add(i);
return null;
}
@@ -293,17 +293,17 @@ namespace DiscImageChef.ImagePlugins
public override string GetImageVersion()
{
- return ImageInfo.imageVersion;
+ return ImageInfo.ImageVersion;
}
public override string GetImageApplication()
{
- return ImageInfo.imageApplication;
+ return ImageInfo.ImageApplication;
}
public override string GetImageApplicationVersion()
{
- return ImageInfo.imageApplicationVersion;
+ return ImageInfo.ImageApplicationVersion;
}
public override byte[] ReadDiskTag(MediaTagType tag)
@@ -313,62 +313,62 @@ namespace DiscImageChef.ImagePlugins
public override string GetImageCreator()
{
- return ImageInfo.imageCreator;
+ return ImageInfo.ImageCreator;
}
public override string GetImageComments()
{
- return ImageInfo.imageComments;
+ return ImageInfo.ImageComments;
}
public override string GetMediaManufacturer()
{
- return ImageInfo.mediaManufacturer;
+ return ImageInfo.MediaManufacturer;
}
public override string GetMediaModel()
{
- return ImageInfo.mediaModel;
+ return ImageInfo.MediaModel;
}
public override string GetMediaSerialNumber()
{
- return ImageInfo.mediaSerialNumber;
+ return ImageInfo.MediaSerialNumber;
}
public override string GetMediaBarcode()
{
- return ImageInfo.mediaBarcode;
+ return ImageInfo.MediaBarcode;
}
public override string GetMediaPartNumber()
{
- return ImageInfo.mediaPartNumber;
+ return ImageInfo.MediaPartNumber;
}
public override int GetMediaSequence()
{
- return ImageInfo.mediaSequence;
+ return ImageInfo.MediaSequence;
}
public override int GetLastDiskSequence()
{
- return ImageInfo.lastMediaSequence;
+ return ImageInfo.LastMediaSequence;
}
public override string GetDriveManufacturer()
{
- return ImageInfo.driveManufacturer;
+ return ImageInfo.DriveManufacturer;
}
public override string GetDriveModel()
{
- return ImageInfo.driveModel;
+ return ImageInfo.DriveModel;
}
public override string GetDriveSerialNumber()
{
- return ImageInfo.driveSerialNumber;
+ return ImageInfo.DriveSerialNumber;
}
public override List GetPartitions()
diff --git a/DiscImageChef.DiscImages/AppleNIB.cs b/DiscImageChef.DiscImages/AppleNIB.cs
index 1e4f1d60d..9931caa75 100644
--- a/DiscImageChef.DiscImages/AppleNIB.cs
+++ b/DiscImageChef.DiscImages/AppleNIB.cs
@@ -39,10 +39,10 @@ using DiscImageChef.Console;
using DiscImageChef.Decoders.Floppy;
using DiscImageChef.Filters;
-namespace DiscImageChef.ImagePlugins
+namespace DiscImageChef.DiscImages
{
// TODO: Checksum sectors
- public class AppleNIB : ImagePlugin
+ public class AppleNib : ImagePlugin
{
Dictionary longSectors;
Dictionary cookedSectors;
@@ -65,31 +65,31 @@ namespace DiscImageChef.ImagePlugins
0x2C, 0x20, 0x44, 0x49, 0x47, 0x49, 0x54, 0x41, 0x4C, 0x20, 0x52, 0x45, 0x53, 0x45, 0x41, 0x52, 0x43, 0x48
};
- public AppleNIB()
+ public AppleNib()
{
Name = "Apple NIB";
- PluginUUID = new Guid("AE171AE8-6747-49CC-B861-9D450B7CD42E");
+ PluginUuid = new Guid("AE171AE8-6747-49CC-B861-9D450B7CD42E");
ImageInfo = new ImageInfo();
- ImageInfo.readableSectorTags = new List();
- ImageInfo.readableMediaTags = new List();
- ImageInfo.imageHasPartitions = false;
- ImageInfo.imageHasSessions = false;
- ImageInfo.imageVersion = null;
- ImageInfo.imageApplication = null;
- ImageInfo.imageApplicationVersion = null;
- ImageInfo.imageCreator = null;
- ImageInfo.imageComments = null;
- ImageInfo.mediaManufacturer = null;
- ImageInfo.mediaModel = null;
- ImageInfo.mediaSerialNumber = null;
- ImageInfo.mediaBarcode = null;
- ImageInfo.mediaPartNumber = null;
- ImageInfo.mediaSequence = 0;
- ImageInfo.lastMediaSequence = 0;
- ImageInfo.driveManufacturer = null;
- ImageInfo.driveModel = null;
- ImageInfo.driveSerialNumber = null;
- ImageInfo.driveFirmwareRevision = null;
+ ImageInfo.ReadableSectorTags = new List();
+ ImageInfo.ReadableMediaTags = new List();
+ ImageInfo.ImageHasPartitions = false;
+ ImageInfo.ImageHasSessions = false;
+ ImageInfo.ImageVersion = null;
+ ImageInfo.ImageApplication = null;
+ ImageInfo.ImageApplicationVersion = null;
+ ImageInfo.ImageCreator = null;
+ ImageInfo.ImageComments = null;
+ ImageInfo.MediaManufacturer = null;
+ ImageInfo.MediaModel = null;
+ ImageInfo.MediaSerialNumber = null;
+ ImageInfo.MediaBarcode = null;
+ ImageInfo.MediaPartNumber = null;
+ ImageInfo.MediaSequence = 0;
+ ImageInfo.LastMediaSequence = 0;
+ ImageInfo.DriveManufacturer = null;
+ ImageInfo.DriveModel = null;
+ ImageInfo.DriveSerialNumber = null;
+ ImageInfo.DriveFirmwareRevision = null;
}
public override bool IdentifyImage(Filter imageFilter)
@@ -196,17 +196,17 @@ namespace DiscImageChef.ImagePlugins
"Hardware sector {0} of track {1} goes to logical sector {2}",
sectorNo, i, skewing[sectorNo] + (ulong)(i * spt));
rawSectors.Add(skewing[sectorNo] + (ulong)(i * spt), sector);
- ImageInfo.sectors++;
+ ImageInfo.Sectors++;
}
else
{
- rawSectors.Add(ImageInfo.sectors, sector);
- ImageInfo.sectors++;
+ rawSectors.Add(ImageInfo.Sectors, sector);
+ ImageInfo.Sectors++;
}
}
}
- DicConsole.DebugWriteLine("Apple NIB Plugin", "Got {0} sectors", ImageInfo.sectors);
+ DicConsole.DebugWriteLine("Apple NIB Plugin", "Got {0} sectors", ImageInfo.Sectors);
DicConsole.DebugWriteLine("Apple NIB Plugin", "Cooking sectors");
@@ -224,27 +224,27 @@ namespace DiscImageChef.ImagePlugins
addressFields.Add(kvp.Key, addr);
}
- ImageInfo.imageSize = (ulong)imageFilter.GetDataForkLength();
- ImageInfo.imageCreationTime = imageFilter.GetCreationTime();
- ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime();
- ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename());
- if(ImageInfo.sectors == 455) ImageInfo.mediaType = MediaType.Apple32SS;
- else if(ImageInfo.sectors == 560) ImageInfo.mediaType = MediaType.Apple33SS;
- else ImageInfo.mediaType = MediaType.Unknown;
- ImageInfo.sectorSize = 256;
- ImageInfo.xmlMediaType = XmlMediaType.BlockMedia;
- ImageInfo.readableSectorTags.Add(SectorTagType.FloppyAddressMark);
- switch(ImageInfo.mediaType)
+ ImageInfo.ImageSize = (ulong)imageFilter.GetDataForkLength();
+ ImageInfo.ImageCreationTime = imageFilter.GetCreationTime();
+ ImageInfo.ImageLastModificationTime = imageFilter.GetLastWriteTime();
+ ImageInfo.ImageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename());
+ if(ImageInfo.Sectors == 455) ImageInfo.MediaType = MediaType.Apple32SS;
+ else if(ImageInfo.Sectors == 560) ImageInfo.MediaType = MediaType.Apple33SS;
+ else ImageInfo.MediaType = MediaType.Unknown;
+ ImageInfo.SectorSize = 256;
+ ImageInfo.XmlMediaType = XmlMediaType.BlockMedia;
+ ImageInfo.ReadableSectorTags.Add(SectorTagType.FloppyAddressMark);
+ switch(ImageInfo.MediaType)
{
case MediaType.Apple32SS:
- ImageInfo.cylinders = 35;
- ImageInfo.heads = 1;
- ImageInfo.sectorsPerTrack = 13;
+ ImageInfo.Cylinders = 35;
+ ImageInfo.Heads = 1;
+ ImageInfo.SectorsPerTrack = 13;
break;
case MediaType.Apple33SS:
- ImageInfo.cylinders = 35;
- ImageInfo.heads = 1;
- ImageInfo.sectorsPerTrack = 16;
+ ImageInfo.Cylinders = 35;
+ ImageInfo.Heads = 1;
+ ImageInfo.SectorsPerTrack = 16;
break;
}
@@ -258,17 +258,17 @@ namespace DiscImageChef.ImagePlugins
public override ulong GetImageSize()
{
- return ImageInfo.imageSize;
+ return ImageInfo.ImageSize;
}
public override ulong GetSectors()
{
- return ImageInfo.sectors;
+ return ImageInfo.Sectors;
}
public override uint GetSectorSize()
{
- return ImageInfo.sectorSize;
+ return ImageInfo.SectorSize;
}
public override string GetImageFormat()
@@ -278,47 +278,47 @@ namespace DiscImageChef.ImagePlugins
public override string GetImageVersion()
{
- return ImageInfo.imageVersion;
+ return ImageInfo.ImageVersion;
}
public override string GetImageApplication()
{
- return ImageInfo.imageApplication;
+ return ImageInfo.ImageApplication;
}
public override string GetImageApplicationVersion()
{
- return ImageInfo.imageApplicationVersion;
+ return ImageInfo.ImageApplicationVersion;
}
public override string GetImageCreator()
{
- return ImageInfo.imageCreator;
+ return ImageInfo.ImageCreator;
}
public override DateTime GetImageCreationTime()
{
- return ImageInfo.imageCreationTime;
+ return ImageInfo.ImageCreationTime;
}
public override DateTime GetImageLastModificationTime()
{
- return ImageInfo.imageLastModificationTime;
+ return ImageInfo.ImageLastModificationTime;
}
public override string GetImageName()
{
- return ImageInfo.imageName;
+ return ImageInfo.ImageName;
}
public override string GetImageComments()
{
- return ImageInfo.imageComments;
+ return ImageInfo.ImageComments;
}
public override MediaType GetMediaType()
{
- switch(ImageInfo.sectors)
+ switch(ImageInfo.Sectors)
{
case 455: return MediaType.Apple32SS;
case 560: return MediaType.Apple33SS;
@@ -328,7 +328,7 @@ namespace DiscImageChef.ImagePlugins
public override byte[] ReadSector(ulong sectorAddress)
{
- if(sectorAddress > ImageInfo.sectors - 1)
+ if(sectorAddress > ImageInfo.Sectors - 1)
throw new ArgumentOutOfRangeException(nameof(sectorAddress),
string.Format("Sector address {0} not found", sectorAddress));
@@ -339,11 +339,11 @@ namespace DiscImageChef.ImagePlugins
public override byte[] ReadSectors(ulong sectorAddress, uint length)
{
- if(sectorAddress > ImageInfo.sectors - 1)
+ if(sectorAddress > ImageInfo.Sectors - 1)
throw new ArgumentOutOfRangeException(nameof(sectorAddress),
string.Format("Sector address {0} not found", sectorAddress));
- if(sectorAddress + length > ImageInfo.sectors)
+ if(sectorAddress + length > ImageInfo.Sectors)
throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available");
MemoryStream ms = new MemoryStream();
@@ -359,7 +359,7 @@ namespace DiscImageChef.ImagePlugins
public override byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag)
{
- if(sectorAddress > ImageInfo.sectors - 1)
+ if(sectorAddress > ImageInfo.Sectors - 1)
throw new ArgumentOutOfRangeException(nameof(sectorAddress),
string.Format("Sector address {0} not found", sectorAddress));
@@ -373,11 +373,11 @@ namespace DiscImageChef.ImagePlugins
public override byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag)
{
- if(sectorAddress > ImageInfo.sectors - 1)
+ if(sectorAddress > ImageInfo.Sectors - 1)
throw new ArgumentOutOfRangeException(nameof(sectorAddress),
string.Format("Sector address {0} not found", sectorAddress));
- if(sectorAddress + length > ImageInfo.sectors)
+ if(sectorAddress + length > ImageInfo.Sectors)
throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available");
if(tag != SectorTagType.FloppyAddressMark)
@@ -396,7 +396,7 @@ namespace DiscImageChef.ImagePlugins
public override byte[] ReadSectorLong(ulong sectorAddress)
{
- if(sectorAddress > ImageInfo.sectors - 1)
+ if(sectorAddress > ImageInfo.Sectors - 1)
throw new ArgumentOutOfRangeException(nameof(sectorAddress),
string.Format("Sector address {0} not found", sectorAddress));
@@ -407,11 +407,11 @@ namespace DiscImageChef.ImagePlugins
public override byte[] ReadSectorsLong(ulong sectorAddress, uint length)
{
- if(sectorAddress > ImageInfo.sectors - 1)
+ if(sectorAddress > ImageInfo.Sectors - 1)
throw new ArgumentOutOfRangeException(nameof(sectorAddress),
string.Format("Sector address {0} not found", sectorAddress));
- if(sectorAddress + length > ImageInfo.sectors)
+ if(sectorAddress + length > ImageInfo.Sectors)
throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available");
MemoryStream ms = new MemoryStream();
@@ -546,18 +546,18 @@ namespace DiscImageChef.ImagePlugins
throw new FeatureUnsupportedImageException("Feature not supported by image format");
}
- public override bool? VerifySectors(ulong sectorAddress, uint length, out List FailingLBAs,
- out List UnknownLBAs)
+ public override bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas,
+ out List unknownLbas)
{
- FailingLBAs = new List();
- UnknownLBAs = new List();
- for(ulong i = 0; i < ImageInfo.sectors; i++) UnknownLBAs.Add(i);
+ failingLbas = new List();
+ unknownLbas = new List();
+ for(ulong i = 0; i < ImageInfo.Sectors; i++) unknownLbas.Add(i);
return null;
}
- public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List FailingLBAs,
- out List UnknownLBAs)
+ public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas,
+ out List unknownLbas)
{
throw new FeatureUnsupportedImageException("Feature not supported by image format");
}
diff --git a/DiscImageChef.DiscImages/Apridisk.cs b/DiscImageChef.DiscImages/Apridisk.cs
index be99512a5..9e1b3ab7c 100644
--- a/DiscImageChef.DiscImages/Apridisk.cs
+++ b/DiscImageChef.DiscImages/Apridisk.cs
@@ -39,7 +39,7 @@ using DiscImageChef.CommonTypes;
using DiscImageChef.Console;
using DiscImageChef.Filters;
-namespace DiscImageChef.ImagePlugins
+namespace DiscImageChef.DiscImages
{
public class Apridisk : ImagePlugin
{
@@ -93,29 +93,29 @@ namespace DiscImageChef.ImagePlugins
public Apridisk()
{
Name = "ACT Apricot Disk Image";
- PluginUUID = new Guid("43408CF3-6DB3-449F-A779-2B0E497C5B14");
+ PluginUuid = new Guid("43408CF3-6DB3-449F-A779-2B0E497C5B14");
ImageInfo = new ImageInfo()
{
- readableSectorTags = new List(),
- readableMediaTags = new List(),
- imageHasPartitions = false,
- imageHasSessions = false,
- imageVersion = null,
- imageApplication = null,
- imageApplicationVersion = null,
- imageCreator = null,
- imageComments = null,
- mediaManufacturer = null,
- mediaModel = null,
- mediaSerialNumber = null,
- mediaBarcode = null,
- mediaPartNumber = null,
- mediaSequence = 0,
- lastMediaSequence = 0,
- driveManufacturer = null,
- driveModel = null,
- driveSerialNumber = null,
- driveFirmwareRevision = null
+ ReadableSectorTags = new List(),
+ ReadableMediaTags = new List(),
+ ImageHasPartitions = false,
+ ImageHasSessions = false,
+ ImageVersion = null,
+ ImageApplication = null,
+ ImageApplicationVersion = null,
+ ImageCreator = null,
+ ImageComments = null,
+ MediaManufacturer = null,
+ MediaModel = null,
+ MediaSerialNumber = null,
+ MediaBarcode = null,
+ MediaPartNumber = null,
+ MediaSequence = 0,
+ LastMediaSequence = 0,
+ DriveManufacturer = null,
+ DriveModel = null,
+ DriveSerialNumber = null,
+ DriveFirmwareRevision = null
};
}
@@ -168,16 +168,16 @@ namespace DiscImageChef.ImagePlugins
stream.Seek(record.headerSize - recordSize, SeekOrigin.Current);
byte[] comment_b = new byte[record.dataSize];
stream.Read(comment_b, 0, comment_b.Length);
- ImageInfo.imageComments = StringHandlers.CToString(comment_b);
- DicConsole.DebugWriteLine("Apridisk plugin", "Comment: \"{0}\"", ImageInfo.imageComments);
+ ImageInfo.ImageComments = StringHandlers.CToString(comment_b);
+ DicConsole.DebugWriteLine("Apridisk plugin", "Comment: \"{0}\"", ImageInfo.ImageComments);
break;
case RecordType.Creator:
DicConsole.DebugWriteLine("Apridisk plugin", "Found creator record at {0}", stream.Position);
stream.Seek(record.headerSize - recordSize, SeekOrigin.Current);
byte[] creator_b = new byte[record.dataSize];
stream.Read(creator_b, 0, creator_b.Length);
- ImageInfo.imageCreator = StringHandlers.CToString(creator_b);
- DicConsole.DebugWriteLine("Apridisk plugin", "Creator: \"{0}\"", ImageInfo.imageCreator);
+ ImageInfo.ImageCreator = StringHandlers.CToString(creator_b);
+ DicConsole.DebugWriteLine("Apridisk plugin", "Creator: \"{0}\"", ImageInfo.ImageCreator);
break;
case RecordType.Sector:
if(record.compression != CompressType.Compressed &&
@@ -217,8 +217,8 @@ namespace DiscImageChef.ImagePlugins
// Total sectors per track
uint[][] spts = new uint[totalCylinders][];
- ImageInfo.cylinders = (ushort)totalCylinders;
- ImageInfo.heads = (byte)totalHeads;
+ ImageInfo.Cylinders = (ushort)totalCylinders;
+ ImageInfo.Heads = (byte)totalHeads;
DicConsole.DebugWriteLine("Apridisk plugin",
"Found {0} cylinders and {1} heads with a maximum sector number of {2}",
@@ -233,7 +233,7 @@ namespace DiscImageChef.ImagePlugins
for(int j = 0; j < totalHeads; j++) sectorsData[i][j] = new byte[maxSector + 1][];
}
- ImageInfo.sectorSize = uint.MaxValue;
+ ImageInfo.SectorSize = uint.MaxValue;
ulong headersizes = 0;
@@ -271,7 +271,7 @@ namespace DiscImageChef.ImagePlugins
realLength = Decompress(data, out sectorsData[record.cylinder][record.head][record.sector]);
else sectorsData[record.cylinder][record.head][record.sector] = data;
- if(realLength < ImageInfo.sectorSize) ImageInfo.sectorSize = realLength;
+ if(realLength < ImageInfo.SectorSize) ImageInfo.SectorSize = realLength;
headersizes += record.headerSize + record.dataSize;
@@ -280,36 +280,36 @@ namespace DiscImageChef.ImagePlugins
}
DicConsole.DebugWriteLine("Apridisk plugin", "Found a minimum of {0} bytes per sector",
- ImageInfo.sectorSize);
+ ImageInfo.SectorSize);
// Count sectors per track
uint spt = uint.MaxValue;
- for(ushort cyl = 0; cyl < ImageInfo.cylinders; cyl++)
+ for(ushort cyl = 0; cyl < ImageInfo.Cylinders; cyl++)
{
- for(ushort head = 0; head < ImageInfo.heads; head++)
+ for(ushort head = 0; head < ImageInfo.Heads; head++)
{
if(spts[cyl][head] < spt) spt = spts[cyl][head];
}
}
- ImageInfo.sectorsPerTrack = spt;
+ ImageInfo.SectorsPerTrack = spt;
DicConsole.DebugWriteLine("Apridisk plugin", "Found a minimum of {0} sectors per track",
- ImageInfo.sectorsPerTrack);
+ ImageInfo.SectorsPerTrack);
- if(ImageInfo.cylinders == 70 && ImageInfo.heads == 1 && ImageInfo.sectorsPerTrack == 9)
- ImageInfo.mediaType = MediaType.Apricot_35;
- else if(ImageInfo.cylinders == 80 && ImageInfo.heads == 1 && ImageInfo.sectorsPerTrack == 9)
- ImageInfo.mediaType = MediaType.DOS_35_SS_DD_9;
- else if(ImageInfo.cylinders == 80 && ImageInfo.heads == 2 && ImageInfo.sectorsPerTrack == 9)
- ImageInfo.mediaType = MediaType.DOS_35_DS_DD_9;
+ if(ImageInfo.Cylinders == 70 && ImageInfo.Heads == 1 && ImageInfo.SectorsPerTrack == 9)
+ ImageInfo.MediaType = MediaType.Apricot_35;
+ else if(ImageInfo.Cylinders == 80 && ImageInfo.Heads == 1 && ImageInfo.SectorsPerTrack == 9)
+ ImageInfo.MediaType = MediaType.DOS_35_SS_DD_9;
+ else if(ImageInfo.Cylinders == 80 && ImageInfo.Heads == 2 && ImageInfo.SectorsPerTrack == 9)
+ ImageInfo.MediaType = MediaType.DOS_35_DS_DD_9;
- ImageInfo.imageSize = (ulong)stream.Length - headersizes;
- ImageInfo.imageCreationTime = imageFilter.GetCreationTime();
- ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime();
- ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename());
- ImageInfo.sectors = ImageInfo.cylinders * ImageInfo.heads * ImageInfo.sectorsPerTrack;
- ImageInfo.xmlMediaType = XmlMediaType.BlockMedia;
+ ImageInfo.ImageSize = (ulong)stream.Length - headersizes;
+ ImageInfo.ImageCreationTime = imageFilter.GetCreationTime();
+ ImageInfo.ImageLastModificationTime = imageFilter.GetLastWriteTime();
+ ImageInfo.ImageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename());
+ ImageInfo.Sectors = ImageInfo.Cylinders * ImageInfo.Heads * ImageInfo.SectorsPerTrack;
+ ImageInfo.XmlMediaType = XmlMediaType.BlockMedia;
/*
FileStream debugFs = new FileStream("debug.img", FileMode.CreateNew, FileAccess.Write);
@@ -354,17 +354,17 @@ namespace DiscImageChef.ImagePlugins
public override ulong GetImageSize()
{
- return ImageInfo.imageSize;
+ return ImageInfo.ImageSize;
}
public override ulong GetSectors()
{
- return ImageInfo.sectors;
+ return ImageInfo.Sectors;
}
public override uint GetSectorSize()
{
- return ImageInfo.sectorSize;
+ return ImageInfo.SectorSize;
}
public override string GetImageFormat()
@@ -374,47 +374,47 @@ namespace DiscImageChef.ImagePlugins
public override string GetImageVersion()
{
- return ImageInfo.imageVersion;
+ return ImageInfo.ImageVersion;
}
public override string GetImageApplication()
{
- return ImageInfo.imageApplication;
+ return ImageInfo.ImageApplication;
}
public override string GetImageApplicationVersion()
{
- return ImageInfo.imageApplicationVersion;
+ return ImageInfo.ImageApplicationVersion;
}
public override string GetImageCreator()
{
- return ImageInfo.imageCreator;
+ return ImageInfo.ImageCreator;
}
public override DateTime GetImageCreationTime()
{
- return ImageInfo.imageCreationTime;
+ return ImageInfo.ImageCreationTime;
}
public override DateTime GetImageLastModificationTime()
{
- return ImageInfo.imageLastModificationTime;
+ return ImageInfo.ImageLastModificationTime;
}
public override string GetImageName()
{
- return ImageInfo.imageName;
+ return ImageInfo.ImageName;
}
public override string GetImageComments()
{
- return ImageInfo.imageComments;
+ return ImageInfo.ImageComments;
}
public override MediaType GetMediaType()
{
- return ImageInfo.mediaType;
+ return ImageInfo.MediaType;
}
public override byte[] ReadSector(ulong sectorAddress)
@@ -435,10 +435,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(nameof(sectorAddress), "Sector address not found");
- if(sectorAddress + length > ImageInfo.sectors)
+ if(sectorAddress + length > ImageInfo.Sectors)
throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available");
MemoryStream buffer = new MemoryStream();
@@ -453,9 +453,9 @@ namespace DiscImageChef.ImagePlugins
(ushort cylinder, byte head, byte sector) LbaToChs(ulong lba)
{
- ushort cylinder = (ushort)(lba / (ImageInfo.heads * ImageInfo.sectorsPerTrack));
- byte head = (byte)((lba / ImageInfo.sectorsPerTrack) % ImageInfo.heads);
- byte sector = (byte)((lba % ImageInfo.sectorsPerTrack) + 1);
+ ushort cylinder = (ushort)(lba / (ImageInfo.Heads * ImageInfo.SectorsPerTrack));
+ byte head = (byte)((lba / ImageInfo.SectorsPerTrack) % ImageInfo.Heads);
+ byte sector = (byte)((lba % ImageInfo.SectorsPerTrack) + 1);
return (cylinder, head, sector);
}
@@ -601,18 +601,18 @@ namespace DiscImageChef.ImagePlugins
throw new FeatureUnsupportedImageException("Feature not supported by image format");
}
- public override bool? VerifySectors(ulong sectorAddress, uint length, out List FailingLBAs,
- out List UnknownLBAs)
+ public override bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas,
+ out List unknownLbas)
{
- FailingLBAs = new List();
- UnknownLBAs = new List();
- for(ulong i = 0; i < ImageInfo.sectors; i++) UnknownLBAs.Add(i);
+ failingLbas = new List();
+ unknownLbas = new List();
+ for(ulong i = 0; i < ImageInfo.Sectors; i++) unknownLbas.Add(i);
return null;
}
- public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List FailingLBAs,
- out List UnknownLBAs)
+ public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas,
+ out List unknownLbas)
{
throw new FeatureUnsupportedImageException("Feature not supported by image format");
}
diff --git a/DiscImageChef.DiscImages/BLU.cs b/DiscImageChef.DiscImages/BLU.cs
index dca25dc94..1eec9e072 100644
--- a/DiscImageChef.DiscImages/BLU.cs
+++ b/DiscImageChef.DiscImages/BLU.cs
@@ -37,59 +37,59 @@ using DiscImageChef.CommonTypes;
using DiscImageChef.Console;
using DiscImageChef.Filters;
-namespace DiscImageChef.ImagePlugins
+namespace DiscImageChef.DiscImages
{
- public class BLU : ImagePlugin
+ public class Blu : ImagePlugin
{
#region Internal Structures
- struct BLUHeader
+ struct BluHeader
{
- public byte[] deviceName;
- public uint deviceType;
- public uint deviceBlocks;
- public ushort bytesPerBlock;
+ public byte[] DeviceName;
+ public uint DeviceType;
+ public uint DeviceBlocks;
+ public ushort BytesPerBlock;
}
#endregion Internal Structures
#region Internal Constants
- const string profileName = "PROFILE ";
- const string profile10Name = "PROFILE 10 ";
- const string widgetName = "WIDGET-10 ";
- const string priamName = "PRIAMDTATOWER";
+ const string PROFILE_NAME = "PROFILE ";
+ const string PROFILE10_NAME = "PROFILE 10 ";
+ const string WIDGET_NAME = "WIDGET-10 ";
+ const string PRIAM_NAME = "PRIAMDTATOWER";
#endregion Internal Constants
#region Internal variables
- BLUHeader ImageHeader;
+ BluHeader imageHeader;
Filter bluImageFilter;
int bptag;
#endregion Internal variables
#region Public methods
- public BLU()
+ public Blu()
{
Name = "Basic Lisa Utility";
- PluginUUID = new Guid("A153E2F8-4235-432D-9A7F-20807B0BCD74");
+ PluginUuid = new Guid("A153E2F8-4235-432D-9A7F-20807B0BCD74");
ImageInfo = new ImageInfo();
- ImageInfo.readableSectorTags = new List();
- ImageInfo.readableMediaTags = new List();
- ImageInfo.imageHasPartitions = false;
- ImageInfo.imageHasSessions = false;
- ImageInfo.imageVersion = null;
- ImageInfo.imageApplication = null;
- ImageInfo.imageApplicationVersion = null;
- ImageInfo.imageCreator = null;
- ImageInfo.imageComments = null;
- ImageInfo.mediaManufacturer = null;
- ImageInfo.mediaModel = null;
- ImageInfo.mediaSerialNumber = null;
- ImageInfo.mediaBarcode = null;
- ImageInfo.mediaPartNumber = null;
- ImageInfo.mediaSequence = 0;
- ImageInfo.lastMediaSequence = 0;
- ImageInfo.driveManufacturer = null;
- ImageInfo.driveModel = null;
- ImageInfo.driveSerialNumber = null;
- ImageInfo.driveFirmwareRevision = null;
+ ImageInfo.ReadableSectorTags = new List();
+ ImageInfo.ReadableMediaTags = new List();
+ ImageInfo.ImageHasPartitions = false;
+ ImageInfo.ImageHasSessions = false;
+ ImageInfo.ImageVersion = null;
+ ImageInfo.ImageApplication = null;
+ ImageInfo.ImageApplicationVersion = null;
+ ImageInfo.ImageCreator = null;
+ ImageInfo.ImageComments = null;
+ ImageInfo.MediaManufacturer = null;
+ ImageInfo.MediaModel = null;
+ ImageInfo.MediaSerialNumber = null;
+ ImageInfo.MediaBarcode = null;
+ ImageInfo.MediaPartNumber = null;
+ ImageInfo.MediaSequence = 0;
+ ImageInfo.LastMediaSequence = 0;
+ ImageInfo.DriveManufacturer = null;
+ ImageInfo.DriveModel = null;
+ ImageInfo.DriveSerialNumber = null;
+ ImageInfo.DriveFirmwareRevision = null;
}
public override bool IdentifyImage(Filter imageFilter)
@@ -102,18 +102,18 @@ namespace DiscImageChef.ImagePlugins
byte[] header = new byte[0x17];
stream.Read(header, 0, 0x17);
- BLUHeader tmpHdr = new BLUHeader();
- tmpHdr.deviceName = new byte[0x0D];
+ BluHeader tmpHdr = new BluHeader();
+ tmpHdr.DeviceName = new byte[0x0D];
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
- Array.Copy(header, 0, tmpHdr.deviceName, 0, 0x0D);
- tmpHdr.deviceType = BigEndianBitConverter.ToUInt32(header, 0x0C) & 0x00FFFFFF;
- tmpHdr.deviceBlocks = BigEndianBitConverter.ToUInt32(header, 0x11) & 0x00FFFFFF;
- tmpHdr.bytesPerBlock = BigEndianBitConverter.ToUInt16(header, 0x15);
+ Array.Copy(header, 0, tmpHdr.DeviceName, 0, 0x0D);
+ tmpHdr.DeviceType = BigEndianBitConverter.ToUInt32(header, 0x0C) & 0x00FFFFFF;
+ tmpHdr.DeviceBlocks = BigEndianBitConverter.ToUInt32(header, 0x11) & 0x00FFFFFF;
+ tmpHdr.BytesPerBlock = BigEndianBitConverter.ToUInt16(header, 0x15);
- for(int i = 0; i < 0xD; i++) { if(tmpHdr.deviceName[i] < 0x20) return false; }
+ for(int i = 0; i < 0xD; i++) { if(tmpHdr.DeviceName[i] < 0x20) return false; }
- if((tmpHdr.bytesPerBlock & 0xFE00) != 0x200) return false;
+ if((tmpHdr.BytesPerBlock & 0xFE00) != 0x200) return false;
return true;
}
@@ -123,91 +123,91 @@ namespace DiscImageChef.ImagePlugins
Stream stream = imageFilter.GetDataForkStream();
stream.Seek(0, SeekOrigin.Begin);
- ImageHeader = new BLUHeader();
- ImageHeader.deviceName = new byte[0x0D];
+ imageHeader = new BluHeader();
+ imageHeader.DeviceName = new byte[0x0D];
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
byte[] header = new byte[0x17];
stream.Read(header, 0, 0x17);
- Array.Copy(header, 0, ImageHeader.deviceName, 0, 0x0D);
- ImageHeader.deviceType = BigEndianBitConverter.ToUInt32(header, 0x0C) & 0x00FFFFFF;
- ImageHeader.deviceBlocks = BigEndianBitConverter.ToUInt32(header, 0x11) & 0x00FFFFFF;
- ImageHeader.bytesPerBlock = BigEndianBitConverter.ToUInt16(header, 0x15);
+ Array.Copy(header, 0, imageHeader.DeviceName, 0, 0x0D);
+ imageHeader.DeviceType = BigEndianBitConverter.ToUInt32(header, 0x0C) & 0x00FFFFFF;
+ imageHeader.DeviceBlocks = BigEndianBitConverter.ToUInt32(header, 0x11) & 0x00FFFFFF;
+ imageHeader.BytesPerBlock = BigEndianBitConverter.ToUInt16(header, 0x15);
DicConsole.DebugWriteLine("BLU plugin", "ImageHeader.deviceName = \"{0}\"",
- StringHandlers.CToString(ImageHeader.deviceName));
- DicConsole.DebugWriteLine("BLU plugin", "ImageHeader.deviceType = {0}", ImageHeader.deviceType);
- DicConsole.DebugWriteLine("BLU plugin", "ImageHeader.deviceBlock = {0}", ImageHeader.deviceBlocks);
- DicConsole.DebugWriteLine("BLU plugin", "ImageHeader.bytesPerBlock = {0}", ImageHeader.bytesPerBlock);
+ StringHandlers.CToString(imageHeader.DeviceName));
+ DicConsole.DebugWriteLine("BLU plugin", "ImageHeader.deviceType = {0}", imageHeader.DeviceType);
+ DicConsole.DebugWriteLine("BLU plugin", "ImageHeader.deviceBlock = {0}", imageHeader.DeviceBlocks);
+ DicConsole.DebugWriteLine("BLU plugin", "ImageHeader.bytesPerBlock = {0}", imageHeader.BytesPerBlock);
- for(int i = 0; i < 0xD; i++) { if(ImageHeader.deviceName[i] < 0x20) return false; }
+ for(int i = 0; i < 0xD; i++) { if(imageHeader.DeviceName[i] < 0x20) return false; }
- if((ImageHeader.bytesPerBlock & 0xFE00) != 0x200) return false;
+ if((imageHeader.BytesPerBlock & 0xFE00) != 0x200) return false;
stream.Seek(0, SeekOrigin.Begin);
- header = new byte[ImageHeader.bytesPerBlock];
- stream.Read(header, 0, ImageHeader.bytesPerBlock);
+ header = new byte[imageHeader.BytesPerBlock];
+ stream.Read(header, 0, imageHeader.BytesPerBlock);
- ImageInfo.sectorSize = 0x200;
+ ImageInfo.SectorSize = 0x200;
- ImageInfo.sectors = ImageHeader.deviceBlocks;
- ImageInfo.imageSize = ImageHeader.deviceBlocks * ImageHeader.bytesPerBlock;
- bptag = ImageHeader.bytesPerBlock - 0x200;
+ ImageInfo.Sectors = imageHeader.DeviceBlocks;
+ ImageInfo.ImageSize = imageHeader.DeviceBlocks * imageHeader.BytesPerBlock;
+ bptag = imageHeader.BytesPerBlock - 0x200;
byte[] hdrTag = new byte[bptag];
Array.Copy(header, 0x200, hdrTag, 0, bptag);
- switch(StringHandlers.CToString(ImageHeader.deviceName))
+ switch(StringHandlers.CToString(imageHeader.DeviceName))
{
- case profileName:
- if(ImageInfo.sectors == 0x2600) ImageInfo.mediaType = MediaType.AppleProfile;
- else ImageInfo.mediaType = MediaType.GENERIC_HDD;
- ImageInfo.cylinders = 152;
- ImageInfo.heads = 4;
- ImageInfo.sectorsPerTrack = 16;
+ case PROFILE_NAME:
+ if(ImageInfo.Sectors == 0x2600) ImageInfo.MediaType = MediaType.AppleProfile;
+ else ImageInfo.MediaType = MediaType.GENERIC_HDD;
+ ImageInfo.Cylinders = 152;
+ ImageInfo.Heads = 4;
+ ImageInfo.SectorsPerTrack = 16;
break;
- case profile10Name:
- if(ImageInfo.sectors == 0x4C00) ImageInfo.mediaType = MediaType.AppleProfile;
- else ImageInfo.mediaType = MediaType.GENERIC_HDD;
- ImageInfo.cylinders = 304;
- ImageInfo.heads = 4;
- ImageInfo.sectorsPerTrack = 16;
+ case PROFILE10_NAME:
+ if(ImageInfo.Sectors == 0x4C00) ImageInfo.MediaType = MediaType.AppleProfile;
+ else ImageInfo.MediaType = MediaType.GENERIC_HDD;
+ ImageInfo.Cylinders = 304;
+ ImageInfo.Heads = 4;
+ ImageInfo.SectorsPerTrack = 16;
break;
- case widgetName:
- if(ImageInfo.sectors == 0x4C00) ImageInfo.mediaType = MediaType.AppleWidget;
- else ImageInfo.mediaType = MediaType.GENERIC_HDD;
- ImageInfo.cylinders = 304;
- ImageInfo.heads = 4;
- ImageInfo.sectorsPerTrack = 16;
+ case WIDGET_NAME:
+ if(ImageInfo.Sectors == 0x4C00) ImageInfo.MediaType = MediaType.AppleWidget;
+ else ImageInfo.MediaType = MediaType.GENERIC_HDD;
+ ImageInfo.Cylinders = 304;
+ ImageInfo.Heads = 4;
+ ImageInfo.SectorsPerTrack = 16;
break;
- case priamName:
- if(ImageInfo.sectors == 0x022C7C) ImageInfo.mediaType = MediaType.PriamDataTower;
- else ImageInfo.mediaType = MediaType.GENERIC_HDD;
+ case PRIAM_NAME:
+ if(ImageInfo.Sectors == 0x022C7C) ImageInfo.MediaType = MediaType.PriamDataTower;
+ else ImageInfo.MediaType = MediaType.GENERIC_HDD;
// This values are invented...
- ImageInfo.cylinders = 419;
- ImageInfo.heads = 4;
- ImageInfo.sectorsPerTrack = 85;
+ ImageInfo.Cylinders = 419;
+ ImageInfo.Heads = 4;
+ ImageInfo.SectorsPerTrack = 85;
break;
default:
- ImageInfo.mediaType = MediaType.GENERIC_HDD;
- ImageInfo.cylinders = (uint)((ImageInfo.sectors / 16) / 63);
- ImageInfo.heads = 16;
- ImageInfo.sectorsPerTrack = 63;
+ ImageInfo.MediaType = MediaType.GENERIC_HDD;
+ ImageInfo.Cylinders = (uint)((ImageInfo.Sectors / 16) / 63);
+ ImageInfo.Heads = 16;
+ ImageInfo.SectorsPerTrack = 63;
break;
}
- ImageInfo.imageApplication = StringHandlers.CToString(hdrTag);
+ ImageInfo.ImageApplication = StringHandlers.CToString(hdrTag);
- ImageInfo.imageCreationTime = imageFilter.GetCreationTime();
- ImageInfo.imageLastModificationTime = imageFilter.GetLastWriteTime();
- ImageInfo.imageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename());
+ ImageInfo.ImageCreationTime = imageFilter.GetCreationTime();
+ ImageInfo.ImageLastModificationTime = imageFilter.GetLastWriteTime();
+ ImageInfo.ImageName = Path.GetFileNameWithoutExtension(imageFilter.GetFilename());
bluImageFilter = imageFilter;
- ImageInfo.xmlMediaType = XmlMediaType.BlockMedia;
+ ImageInfo.XmlMediaType = XmlMediaType.BlockMedia;
- if(bptag > 0) ImageInfo.readableSectorTags.Add(SectorTagType.AppleSectorTag);
+ if(bptag > 0) ImageInfo.ReadableSectorTags.Add(SectorTagType.AppleSectorTag);
- DicConsole.VerboseWriteLine("BLU image contains a disk of type {0}", ImageInfo.mediaType);
+ DicConsole.VerboseWriteLine("BLU image contains a disk of type {0}", ImageInfo.MediaType);
return true;
}
@@ -223,24 +223,24 @@ namespace DiscImageChef.ImagePlugins
return null;
}
- public override bool? VerifySectors(ulong sectorAddress, uint length, out List FailingLBAs,
- out List UnknownLBAs)
+ public override bool? VerifySectors(ulong sectorAddress, uint length, out List failingLbas,
+ out List unknownLbas)
{
- FailingLBAs = new List();
- UnknownLBAs = new List();
+ failingLbas = new List();
+ unknownLbas = new List();
- for(ulong i = sectorAddress; i < sectorAddress + length; i++) UnknownLBAs.Add(i);
+ for(ulong i = sectorAddress; i < sectorAddress + length; i++) unknownLbas.Add(i);
return null;
}
- public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List FailingLBAs,
- out List UnknownLBAs)
+ public override bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas,
+ out List unknownLbas)
{
- FailingLBAs = new List();
- UnknownLBAs = new List();
+ failingLbas = new List();
+ unknownLbas = new List();
- for(ulong i = sectorAddress; i < sectorAddress + length; i++) UnknownLBAs.Add(i);
+ for(ulong i = sectorAddress; i < sectorAddress + length; i++) unknownLbas.Add(i);
return null;
}
@@ -253,22 +253,22 @@ namespace DiscImageChef.ImagePlugins
public override bool ImageHasPartitions()
{
- return ImageInfo.imageHasPartitions;
+ return ImageInfo.ImageHasPartitions;
}
public override ulong GetImageSize()
{
- return ImageInfo.imageSize;
+ return ImageInfo.ImageSize;
}
public override ulong GetSectors()
{
- return ImageInfo.sectors;
+ return ImageInfo.Sectors;
}
public override uint GetSectorSize()
{
- return ImageInfo.sectorSize;
+ return ImageInfo.SectorSize;
}
public override byte[] ReadSector(ulong sectorAddress)
@@ -283,10 +283,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(nameof(sectorAddress), "Sector address not found");
- if(sectorAddress + length > ImageInfo.sectors)
+ if(sectorAddress + length > ImageInfo.Sectors)
throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available");
MemoryStream buffer = new MemoryStream();
@@ -295,7 +295,7 @@ namespace DiscImageChef.ImagePlugins
int skip = bptag;
Stream stream = bluImageFilter.GetDataForkStream();
- stream.Seek((long)((sectorAddress + 1) * ImageHeader.bytesPerBlock), SeekOrigin.Begin);
+ stream.Seek((long)((sectorAddress + 1) * imageHeader.BytesPerBlock), SeekOrigin.Begin);
for(int i = 0; i < length; i++)
{
@@ -316,10 +316,10 @@ namespace DiscImageChef.ImagePlugins
if(bptag == 0) throw new FeatureNotPresentImageException("Disk image does not have tags");
- if(sectorAddress > ImageInfo.sectors - 1)
+ if(sectorAddress > ImageInfo.Sectors - 1)
throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found");
- if(sectorAddress + length > ImageInfo.sectors)
+ if(sectorAddress + length > ImageInfo.Sectors)
throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available");
MemoryStream buffer = new MemoryStream();
@@ -328,7 +328,7 @@ namespace DiscImageChef.ImagePlugins
int skip = 0;
Stream stream = bluImageFilter.GetDataForkStream();
- stream.Seek((long)((sectorAddress + 1) * ImageHeader.bytesPerBlock), SeekOrigin.Begin);
+ stream.Seek((long)((sectorAddress + 1) * imageHeader.BytesPerBlock), SeekOrigin.Begin);
for(int i = 0; i < length; i++)
{
@@ -349,15 +349,15 @@ namespace DiscImageChef.ImagePlugins
public override byte[] ReadSectorsLong(ulong sectorAddress, uint length)
{
- if(sectorAddress > ImageInfo.sectors - 1)
+ if(sectorAddress > ImageInfo.Sectors - 1)
throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found");
- if(sectorAddress + length > ImageInfo.sectors)
+ if(sectorAddress + length > ImageInfo.Sectors)
throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available");
- byte[] buffer = new byte[length * ImageHeader.bytesPerBlock];
+ byte[] buffer = new byte[length * imageHeader.BytesPerBlock];
Stream stream = bluImageFilter.GetDataForkStream();
- stream.Seek((long)((sectorAddress + 1) * ImageHeader.bytesPerBlock), SeekOrigin.Begin);
+ stream.Seek((long)((sectorAddress + 1) * imageHeader.BytesPerBlock), SeekOrigin.Begin);
stream.Read(buffer, 0, buffer.Length);
return buffer;
@@ -370,37 +370,37 @@ namespace DiscImageChef.ImagePlugins
public override string GetImageVersion()
{
- return ImageInfo.imageVersion;
+ return ImageInfo.ImageVersion;
}
public override string GetImageApplication()
{
- return ImageInfo.imageApplication;
+ return ImageInfo.ImageApplication;
}
public override string GetImageApplicationVersion()
{
- return ImageInfo.imageApplicationVersion;
+ return ImageInfo.ImageApplicationVersion;
}
public override DateTime GetImageCreationTime()
{
- return ImageInfo.imageCreationTime;
+ return ImageInfo.ImageCreationTime;
}
public override DateTime GetImageLastModificationTime()
{
- return ImageInfo.imageLastModificationTime;
+ return ImageInfo.ImageLastModificationTime;
}
public override string GetImageName()
{
- return ImageInfo.imageName;
+ return ImageInfo.ImageName;
}
public override MediaType GetMediaType()
{
- return ImageInfo.mediaType;
+ return ImageInfo.MediaType;
}
#endregion Public methods
@@ -412,62 +412,62 @@ namespace DiscImageChef.ImagePlugins
public override string GetImageCreator()
{
- return ImageInfo.imageCreator;
+ return ImageInfo.ImageCreator;
}
public override string GetImageComments()
{
- return ImageInfo.imageComments;
+ return ImageInfo.ImageComments;
}
public override string GetMediaManufacturer()
{
- return ImageInfo.mediaManufacturer;
+ return ImageInfo.MediaManufacturer;
}
public override string GetMediaModel()
{
- return ImageInfo.mediaModel;
+ return ImageInfo.MediaModel;
}
public override string GetMediaSerialNumber()
{
- return ImageInfo.mediaSerialNumber;
+ return ImageInfo.MediaSerialNumber;
}
public override string GetMediaBarcode()
{
- return ImageInfo.mediaBarcode;
+ return ImageInfo.MediaBarcode;
}
public override string GetMediaPartNumber()
{
- return ImageInfo.mediaPartNumber;
+ return ImageInfo.MediaPartNumber;
}
public override int GetMediaSequence()
{
- return ImageInfo.mediaSequence;
+ return ImageInfo.MediaSequence;
}
public override int GetLastDiskSequence()
{
- return ImageInfo.lastMediaSequence;
+ return ImageInfo.LastMediaSequence;
}
public override string GetDriveManufacturer()
{
- return ImageInfo.driveManufacturer;
+ return ImageInfo.DriveManufacturer;
}
public override string GetDriveModel()
{
- return ImageInfo.driveModel;
+ return ImageInfo.DriveModel;
}
public override string GetDriveSerialNumber()
{
- return ImageInfo.driveSerialNumber;
+ return ImageInfo.DriveSerialNumber;
}
public override List GetPartitions()
diff --git a/DiscImageChef.DiscImages/BlindWrite4.cs b/DiscImageChef.DiscImages/BlindWrite4.cs
index 3cb6b79dc..c4849bfc3 100644
--- a/DiscImageChef.DiscImages/BlindWrite4.cs
+++ b/DiscImageChef.DiscImages/BlindWrite4.cs
@@ -41,13 +41,13 @@ using DiscImageChef.CommonTypes;
using DiscImageChef.Console;
using DiscImageChef.Filters;
-namespace DiscImageChef.ImagePlugins
+namespace DiscImageChef.DiscImages
{
public class BlindWrite4 : ImagePlugin
{
#region Internal Constants
/// "BLINDWRITE TOC FILE"
- readonly byte[] BW4_Signature =
+ readonly byte[] bw4Signature =
{
0x42, 0x4C, 0x49, 0x4E, 0x44, 0x57, 0x52, 0x49, 0x54, 0x45, 0x20, 0x54, 0x4F, 0x43, 0x20, 0x46, 0x49, 0x4C,
0x45
@@ -55,38 +55,38 @@ namespace DiscImageChef.ImagePlugins
#endregion Internal Constants
#region Internal Structures
- struct BW4_Header
+ struct Bw4Header
{
- public byte[] signature;
- public uint unknown1;
- public ulong timestamp;
- public uint volumeIdLength;
- public byte[] volumeIdBytes;
- public uint sysIdLength;
- public byte[] sysIdBytes;
- public uint commentsLength;
- public byte[] commentsBytes;
- public uint trackDescriptors;
- public uint dataFileLength;
- public byte[] dataFileBytes;
- public uint subchannelFileLength;
- public byte[] subchannelFileBytes;
- public uint unknown2;
- public byte unknown3;
- public byte[] unknown4;
+ public byte[] Signature;
+ public uint Unknown1;
+ public ulong Timestamp;
+ public uint VolumeIdLength;
+ public byte[] VolumeIdBytes;
+ public uint SysIdLength;
+ public byte[] SysIdBytes;
+ public uint CommentsLength;
+ public byte[] CommentsBytes;
+ public uint TrackDescriptors;
+ public uint DataFileLength;
+ public byte[] DataFileBytes;
+ public uint SubchannelFileLength;
+ public byte[] SubchannelFileBytes;
+ public uint Unknown2;
+ public byte Unknown3;
+ public byte[] Unknown4;
// On memory only
- public string volumeIdentifier;
- public string systemIdentifier;
- public string comments;
- public Filter dataFilter;
- public Filter subchannelFilter;
- public string dataFile;
- public string subchannelFile;
+ public string VolumeIdentifier;
+ public string SystemIdentifier;
+ public string Comments;
+ public Filter DataFilter;
+ public Filter SubchannelFilter;
+ public string DataFile;
+ public string SubchannelFile;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
- struct BW4_TrackDescriptor
+ struct Bw4TrackDescriptor
{
public uint filenameLen;
public byte[] filenameBytes;
@@ -99,7 +99,7 @@ namespace DiscImageChef.ImagePlugins
public byte unknown4;
public byte adrCtl;
public byte unknown5;
- public BW4_TrackType trackMode;
+ public Bw4TrackType trackMode;
public byte unknown6;
public byte point;
public uint unknown7;
@@ -164,7 +164,7 @@ namespace DiscImageChef.ImagePlugins
#endregion Internal Structures
#region Internal enumerations
- enum BW4_TrackType : byte
+ enum Bw4TrackType : byte
{
Audio = 0,
Mode1 = 1,
@@ -173,8 +173,8 @@ namespace DiscImageChef.ImagePlugins
#endregion Internal enumerations
#region Internal variables
- BW4_Header header;
- List bwTracks;
+ Bw4Header header;
+ List bwTracks;
List