mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Code cleanup.
This commit is contained in:
@@ -81,7 +81,7 @@ namespace DiscImageChef.Checksums
|
||||
/// </summary>
|
||||
public byte[] Final()
|
||||
{
|
||||
uint finalSum = (uint)((sum2 << 16) | sum1);
|
||||
uint finalSum = (uint)((sum2 << 16) | sum1);
|
||||
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
||||
return BigEndianBitConverter.GetBytes(finalSum);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace DiscImageChef.Checksums
|
||||
for(int i = 0; i < 256; i++)
|
||||
{
|
||||
ushort entry = (ushort)i;
|
||||
for(int j = 0; j < 8; j++)
|
||||
for(int j = 0; j < 8; j++)
|
||||
if((entry & 1) == 1)
|
||||
entry = (ushort)((entry >> 1) ^ CRC16_IBM_POLY);
|
||||
else
|
||||
@@ -84,7 +84,7 @@ namespace DiscImageChef.Checksums
|
||||
for(int i = 0; i < 256; i++)
|
||||
{
|
||||
ushort entry = (ushort)i;
|
||||
for(int j = 0; j < 8; j++)
|
||||
for(int j = 0; j < 8; j++)
|
||||
if((entry & 1) == 1)
|
||||
entry = (ushort)((entry >> 1) ^ polynomial);
|
||||
else
|
||||
@@ -130,7 +130,7 @@ namespace DiscImageChef.Checksums
|
||||
StringBuilder crc16Output = new StringBuilder();
|
||||
|
||||
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
||||
for(int i = 0; i < BigEndianBitConverter.GetBytes((ushort)(hashInt ^ finalSeed)).Length; i++)
|
||||
for(int i = 0; i < BigEndianBitConverter.GetBytes((ushort)(hashInt ^ finalSeed)).Length; i++)
|
||||
crc16Output.Append(BigEndianBitConverter.GetBytes((ushort)(hashInt ^ finalSeed))[i].ToString("x2"));
|
||||
|
||||
return crc16Output.ToString();
|
||||
@@ -171,7 +171,7 @@ namespace DiscImageChef.Checksums
|
||||
for(int i = 0; i < 256; i++)
|
||||
{
|
||||
ushort entry = (ushort)i;
|
||||
for(int j = 0; j < 8; j++)
|
||||
for(int j = 0; j < 8; j++)
|
||||
if((entry & 1) == 1)
|
||||
entry = (ushort)((entry >> 1) ^ polynomial);
|
||||
else
|
||||
@@ -224,7 +224,7 @@ namespace DiscImageChef.Checksums
|
||||
for(int i = 0; i < 256; i++)
|
||||
{
|
||||
ushort entry = (ushort)i;
|
||||
for(int j = 0; j < 8; j++)
|
||||
for(int j = 0; j < 8; j++)
|
||||
if((entry & 1) == 1)
|
||||
entry = (ushort)((entry >> 1) ^ polynomial);
|
||||
else
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace DiscImageChef.Checksums
|
||||
for(int i = 0; i < 256; i++)
|
||||
{
|
||||
uint entry = (uint)i;
|
||||
for(int j = 0; j < 8; j++)
|
||||
for(int j = 0; j < 8; j++)
|
||||
if((entry & 1) == 1)
|
||||
entry = (entry >> 1) ^ CRC32_ISO_POLY;
|
||||
else
|
||||
@@ -84,7 +84,7 @@ namespace DiscImageChef.Checksums
|
||||
for(int i = 0; i < 256; i++)
|
||||
{
|
||||
uint entry = (uint)i;
|
||||
for(int j = 0; j < 8; j++)
|
||||
for(int j = 0; j < 8; j++)
|
||||
if((entry & 1) == 1)
|
||||
entry = (entry >> 1) ^ polynomial;
|
||||
else
|
||||
@@ -130,7 +130,7 @@ namespace DiscImageChef.Checksums
|
||||
StringBuilder crc32Output = new StringBuilder();
|
||||
|
||||
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
||||
for(int i = 0; i < BigEndianBitConverter.GetBytes(hashInt ^ finalSeed).Length; i++)
|
||||
for(int i = 0; i < BigEndianBitConverter.GetBytes(hashInt ^ finalSeed).Length; i++)
|
||||
crc32Output.Append(BigEndianBitConverter.GetBytes(hashInt ^ finalSeed)[i].ToString("x2"));
|
||||
|
||||
return crc32Output.ToString();
|
||||
@@ -171,7 +171,7 @@ namespace DiscImageChef.Checksums
|
||||
for(int i = 0; i < 256; i++)
|
||||
{
|
||||
uint entry = (uint)i;
|
||||
for(int j = 0; j < 8; j++)
|
||||
for(int j = 0; j < 8; j++)
|
||||
if((entry & 1) == 1)
|
||||
entry = (entry >> 1) ^ polynomial;
|
||||
else
|
||||
@@ -223,7 +223,7 @@ namespace DiscImageChef.Checksums
|
||||
for(int i = 0; i < 256; i++)
|
||||
{
|
||||
uint entry = (uint)i;
|
||||
for(int j = 0; j < 8; j++)
|
||||
for(int j = 0; j < 8; j++)
|
||||
if((entry & 1) == 1)
|
||||
entry = (entry >> 1) ^ polynomial;
|
||||
else
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace DiscImageChef.Checksums
|
||||
public const ulong CRC64_ECMA_POLY = 0xC96C5795D7870F42;
|
||||
public const ulong CRC64_ECMA_SEED = 0xFFFFFFFFFFFFFFFF;
|
||||
|
||||
readonly ulong finalSeed;
|
||||
readonly ulong finalSeed;
|
||||
readonly ulong[] table;
|
||||
ulong hashInt;
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace DiscImageChef.Checksums
|
||||
for(int i = 0; i < 256; i++)
|
||||
{
|
||||
ulong entry = (ulong)i;
|
||||
for(int j = 0; j < 8; j++)
|
||||
for(int j = 0; j < 8; j++)
|
||||
if((entry & 1) == 1)
|
||||
entry = (entry >> 1) ^ CRC64_ECMA_POLY;
|
||||
else
|
||||
@@ -82,7 +82,7 @@ namespace DiscImageChef.Checksums
|
||||
for(int i = 0; i < 256; i++)
|
||||
{
|
||||
ulong entry = (ulong)i;
|
||||
for(int j = 0; j < 8; j++)
|
||||
for(int j = 0; j < 8; j++)
|
||||
if((entry & 1) == 1)
|
||||
entry = (entry >> 1) ^ polynomial;
|
||||
else
|
||||
@@ -171,7 +171,7 @@ namespace DiscImageChef.Checksums
|
||||
for(int i = 0; i < 256; i++)
|
||||
{
|
||||
ulong entry = (ulong)i;
|
||||
for(int j = 0; j < 8; j++)
|
||||
for(int j = 0; j < 8; j++)
|
||||
if((entry & 1) == 1)
|
||||
entry = (entry >> 1) ^ polynomial;
|
||||
else
|
||||
@@ -223,7 +223,7 @@ namespace DiscImageChef.Checksums
|
||||
for(int i = 0; i < 256; i++)
|
||||
{
|
||||
ulong entry = (ulong)i;
|
||||
for(int j = 0; j < 8; j++)
|
||||
for(int j = 0; j < 8; j++)
|
||||
if((entry & 1) == 1)
|
||||
entry = (entry >> 1) ^ polynomial;
|
||||
else
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace DiscImageChef.Checksums
|
||||
/// </summary>
|
||||
public byte[] Final()
|
||||
{
|
||||
uint finalSum = (uint)((sum2 << 16) | sum1);
|
||||
uint finalSum = (uint)((sum2 << 16) | sum1);
|
||||
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
||||
return BigEndianBitConverter.GetBytes(finalSum);
|
||||
}
|
||||
@@ -230,7 +230,7 @@ namespace DiscImageChef.Checksums
|
||||
/// </summary>
|
||||
public byte[] Final()
|
||||
{
|
||||
ushort finalSum = (ushort)((sum2 << 8) | sum1);
|
||||
ushort finalSum = (ushort)((sum2 << 8) | sum1);
|
||||
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
||||
return BigEndianBitConverter.GetBytes(finalSum);
|
||||
}
|
||||
|
||||
@@ -114,8 +114,8 @@ namespace DiscImageChef.Checksums
|
||||
{
|
||||
MD5 localMd5Provider = MD5.Create();
|
||||
FileStream fileStream = new FileStream(filename, FileMode.Open);
|
||||
hash = localMd5Provider.ComputeHash(fileStream);
|
||||
StringBuilder md5Output = new StringBuilder();
|
||||
hash = localMd5Provider.ComputeHash(fileStream);
|
||||
StringBuilder md5Output = new StringBuilder();
|
||||
|
||||
foreach(byte h in hash) md5Output.Append(h.ToString("x2"));
|
||||
|
||||
@@ -132,8 +132,8 @@ namespace DiscImageChef.Checksums
|
||||
/// <param name="hash">Byte array of the hash value.</param>
|
||||
public static string Data(byte[] data, uint len, out byte[] hash)
|
||||
{
|
||||
MD5 localMd5Provider = MD5.Create();
|
||||
hash = localMd5Provider.ComputeHash(data, 0, (int)len);
|
||||
MD5 localMd5Provider = MD5.Create();
|
||||
hash = localMd5Provider.ComputeHash(data, 0, (int)len);
|
||||
StringBuilder md5Output = new StringBuilder();
|
||||
|
||||
foreach(byte h in hash) md5Output.Append(h.ToString("x2"));
|
||||
|
||||
@@ -114,8 +114,8 @@ namespace DiscImageChef.Checksums
|
||||
{
|
||||
RIPEMD160 localRipemd160Provider = RIPEMD160.Create();
|
||||
FileStream fileStream = new FileStream(filename, FileMode.Open);
|
||||
hash = localRipemd160Provider.ComputeHash(fileStream);
|
||||
StringBuilder ripemd160Output = new StringBuilder();
|
||||
hash = localRipemd160Provider.ComputeHash(fileStream);
|
||||
StringBuilder ripemd160Output = new StringBuilder();
|
||||
|
||||
foreach(byte h in hash) ripemd160Output.Append(h.ToString("x2"));
|
||||
|
||||
@@ -133,8 +133,8 @@ namespace DiscImageChef.Checksums
|
||||
public static string Data(byte[] data, uint len, out byte[] hash)
|
||||
{
|
||||
RIPEMD160 localRipemd160Provider = RIPEMD160.Create();
|
||||
hash = localRipemd160Provider.ComputeHash(data, 0, (int)len);
|
||||
StringBuilder ripemd160Output = new StringBuilder();
|
||||
hash = localRipemd160Provider.ComputeHash(data, 0, (int)len);
|
||||
StringBuilder ripemd160Output = new StringBuilder();
|
||||
|
||||
foreach(byte h in hash) ripemd160Output.Append(h.ToString("x2"));
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace DiscImageChef.Checksums
|
||||
/// </summary>
|
||||
int[] index_of;
|
||||
bool initialized;
|
||||
int mm, kk, nn;
|
||||
int mm, kk, nn;
|
||||
/// <summary>
|
||||
/// Primitive polynomials - see Lin & Costello, Error Control Coding Appendix A, and Lee & Messerschmitt, Digital
|
||||
/// Communication p. 453.
|
||||
@@ -150,10 +150,10 @@ namespace DiscImageChef.Checksums
|
||||
default: throw new ArgumentOutOfRangeException(nameof(m), "m must be between 2 and 16 inclusive");
|
||||
}
|
||||
|
||||
mm = m;
|
||||
kk = k;
|
||||
nn = n;
|
||||
a0 = n;
|
||||
mm = m;
|
||||
kk = k;
|
||||
nn = n;
|
||||
a0 = n;
|
||||
alpha_to = new int[n + 1];
|
||||
index_of = new int[n + 1];
|
||||
|
||||
@@ -170,7 +170,7 @@ namespace DiscImageChef.Checksums
|
||||
while(x >= nn)
|
||||
{
|
||||
x -= nn;
|
||||
x = (x >> mm) + (x & nn);
|
||||
x = (x >> mm) + (x & nn);
|
||||
}
|
||||
|
||||
return x;
|
||||
@@ -237,11 +237,11 @@ namespace DiscImageChef.Checksums
|
||||
alpha_to[mm] = 0;
|
||||
for(i = 0; i < mm; i++)
|
||||
{
|
||||
alpha_to[i] = mask;
|
||||
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 */
|
||||
mask <<= 1; /* single left-shift */
|
||||
mask <<= 1; /* single left-shift */
|
||||
}
|
||||
|
||||
index_of[alpha_to[mm]] = mm;
|
||||
@@ -254,11 +254,11 @@ namespace DiscImageChef.Checksums
|
||||
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;
|
||||
else alpha_to[i] = alpha_to[i - 1] << 1;
|
||||
index_of[alpha_to[i]] = i;
|
||||
}
|
||||
|
||||
index_of[0] = a0;
|
||||
index_of[0] = a0;
|
||||
alpha_to[nn] = 0;
|
||||
}
|
||||
|
||||
@@ -289,11 +289,14 @@ namespace DiscImageChef.Checksums
|
||||
* (@**(B0+i-1) + x)
|
||||
*/
|
||||
for(int 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)];
|
||||
}
|
||||
|
||||
/* convert Gg[] to index form for quicker encoding */
|
||||
for(i = 0; i <= nn - kk; i++) gg[i] = index_of[gg[i]];
|
||||
}
|
||||
@@ -322,15 +325,19 @@ namespace DiscImageChef.Checksums
|
||||
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 */
|
||||
|
||||
int feedback = index_of[data[i] ^ bb[nn - kk - 1]];
|
||||
if(feedback != a0)
|
||||
{
|
||||
/* feedback term is non-zero */
|
||||
for(int 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];
|
||||
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)];
|
||||
}
|
||||
@@ -372,26 +379,29 @@ namespace DiscImageChef.Checksums
|
||||
if(!initialized) throw new UnauthorizedAccessException("Trying to calculate RS without initializing!");
|
||||
|
||||
erasPos = new int[nn - kk];
|
||||
int i, j;
|
||||
int q, tmp;
|
||||
int[] recd = new int[nn];
|
||||
int i, j;
|
||||
int q, tmp;
|
||||
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 count;
|
||||
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 count;
|
||||
|
||||
/* data[] is in polynomial form, copy and convert to index form */
|
||||
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]];
|
||||
}
|
||||
|
||||
/* first form the syndromes; i.e., evaluate recd(x) at roots of g(x)
|
||||
* namely @**(B0+i), i = 0, ... ,(NN-KK-1)
|
||||
*/
|
||||
@@ -400,7 +410,8 @@ namespace DiscImageChef.Checksums
|
||||
{
|
||||
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)];
|
||||
if(recd[j] != a0) /* recd[j] in index form */
|
||||
tmp ^= alpha_to[Modnn(recd[j] + (B0 + i - 1) * j)];
|
||||
|
||||
synError |= tmp; /* set flag if non-zero syndrome =>
|
||||
* error */
|
||||
@@ -426,7 +437,7 @@ namespace DiscImageChef.Checksums
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
#if DEBUG
|
||||
/* find roots of the erasure location polynomial */
|
||||
for(i = 1; i <= noEras; i++) reg[i] = index_of[lambda[i]];
|
||||
|
||||
@@ -437,16 +448,17 @@ namespace DiscImageChef.Checksums
|
||||
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) continue;
|
||||
|
||||
/* store root and error location
|
||||
* number indices
|
||||
*/
|
||||
root[count] = i;
|
||||
loc[count] = nn - i;
|
||||
loc[count] = nn - i;
|
||||
count++;
|
||||
}
|
||||
|
||||
@@ -461,7 +473,7 @@ namespace DiscImageChef.Checksums
|
||||
for(i = 0; i < count; i++) DicConsole.DebugWriteLine("Reed Solomon", "{0} ", loc[i]);
|
||||
|
||||
DicConsole.DebugWriteLine("Reed Solomon", "\n");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
for(i = 0; i < nn - kk + 1; i++) b[i] = index_of[lambda[i]];
|
||||
@@ -470,7 +482,7 @@ namespace DiscImageChef.Checksums
|
||||
* Begin Berlekamp-Massey algorithm to determine error+erasure
|
||||
* locator polynomial
|
||||
*/
|
||||
int r = noEras;
|
||||
int r = noEras;
|
||||
int el = noEras;
|
||||
while(++r <= nn - kk)
|
||||
{
|
||||
@@ -478,7 +490,8 @@ namespace DiscImageChef.Checksums
|
||||
/* Compute discrepancy at the r-th step in poly-form */
|
||||
int discrR = 0;
|
||||
for(i = 0; i < r; i++)
|
||||
if(lambda[i] != 0 && s[r - i] != a0) discrR ^= alpha_to[Modnn(index_of[lambda[i]] + s[r - i])];
|
||||
if(lambda[i] != 0 && s[r - i] != a0)
|
||||
discrR ^= alpha_to[Modnn(index_of[lambda[i]] + s[r - i])];
|
||||
|
||||
discrR = index_of[discrR]; /* Index form */
|
||||
if(discrR == a0)
|
||||
@@ -492,8 +505,10 @@ namespace DiscImageChef.Checksums
|
||||
/* 7 lines below: T(x) <-- lambda(x) - discr_r*x*b(x) */
|
||||
t[0] = lambda[0];
|
||||
for(i = 0; i < nn - kk; i++)
|
||||
if(b[i] != a0) t[i + 1] = lambda[i + 1] ^ alpha_to[Modnn(discrR + b[i])];
|
||||
else t[i + 1] = lambda[i + 1];
|
||||
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 + noEras - 1)
|
||||
{
|
||||
@@ -523,6 +538,7 @@ namespace DiscImageChef.Checksums
|
||||
lambda[i] = index_of[lambda[i]];
|
||||
if(lambda[i] != a0) degLambda = i;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find roots of the error+erasure locator polynomial. By Chien
|
||||
* Search
|
||||
@@ -530,32 +546,34 @@ namespace DiscImageChef.Checksums
|
||||
int temp = reg[0];
|
||||
Copy(ref reg, ref lambda, nn - kk);
|
||||
reg[0] = temp;
|
||||
count = 0; /* Number of roots of lambda(x) */
|
||||
count = 0; /* Number of roots of lambda(x) */
|
||||
for(i = 1; i <= nn; i++)
|
||||
{
|
||||
q = 1;
|
||||
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) continue;
|
||||
|
||||
/* store root (index-form) and error location number */
|
||||
root[count] = i;
|
||||
loc[count] = nn - i;
|
||||
loc[count] = nn - i;
|
||||
count++;
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
#if DEBUG
|
||||
DicConsole.DebugWriteLine("Reed Solomon", "\n Final error positions:\t");
|
||||
for(i = 0; i < count; i++) DicConsole.DebugWriteLine("Reed Solomon", "{0} ", loc[i]);
|
||||
|
||||
DicConsole.DebugWriteLine("Reed Solomon", "\n");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if(degLambda != count) return -1;
|
||||
|
||||
/*
|
||||
* Compute err+eras evaluator poly omega(x) = s(x)*lambda(x) (modulo
|
||||
* x**(NN-KK)). in index form. Also find deg(omega).
|
||||
@@ -564,9 +582,10 @@ namespace DiscImageChef.Checksums
|
||||
for(i = 0; i < nn - kk; i++)
|
||||
{
|
||||
tmp = 0;
|
||||
j = degLambda < i ? degLambda : 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) degOmega = i;
|
||||
omega[i] = index_of[tmp];
|
||||
@@ -581,20 +600,24 @@ namespace DiscImageChef.Checksums
|
||||
for(j = count - 1; j >= 0; j--)
|
||||
{
|
||||
int num1 = 0;
|
||||
for(i = degOmega; i >= 0; i--) if(omega[i] != a0) num1 ^= alpha_to[Modnn(omega[i] + i * root[j])];
|
||||
for(i = degOmega; i >= 0; i--)
|
||||
if(omega[i] != a0)
|
||||
num1 ^= alpha_to[Modnn(omega[i] + i * root[j])];
|
||||
|
||||
int num2 = alpha_to[Modnn(root[j] * (B0 - 1) + nn)];
|
||||
int den = 0;
|
||||
int den = 0;
|
||||
|
||||
/* lambda[i+1] for i even is the formal derivative lambda_pr of lambda[i] */
|
||||
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)
|
||||
{
|
||||
DicConsole.DebugWriteLine("Reed Solomon", "\n ERROR: denominator = 0\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Apply error to data */
|
||||
if(num1 != 0) data[loc[j]] ^= alpha_to[Modnn(index_of[num1] + index_of[num2] + nn - index_of[den])];
|
||||
}
|
||||
|
||||
@@ -114,8 +114,8 @@ namespace DiscImageChef.Checksums
|
||||
{
|
||||
SHA1 localSha1Provider = SHA1.Create();
|
||||
FileStream fileStream = new FileStream(filename, FileMode.Open);
|
||||
hash = localSha1Provider.ComputeHash(fileStream);
|
||||
StringBuilder sha1Output = new StringBuilder();
|
||||
hash = localSha1Provider.ComputeHash(fileStream);
|
||||
StringBuilder sha1Output = new StringBuilder();
|
||||
|
||||
foreach(byte h in hash) sha1Output.Append(h.ToString("x2"));
|
||||
|
||||
@@ -132,8 +132,8 @@ namespace DiscImageChef.Checksums
|
||||
/// <param name="hash">Byte array of the hash value.</param>
|
||||
public static string Data(byte[] data, uint len, out byte[] hash)
|
||||
{
|
||||
SHA1 localSha1Provider = SHA1.Create();
|
||||
hash = localSha1Provider.ComputeHash(data, 0, (int)len);
|
||||
SHA1 localSha1Provider = SHA1.Create();
|
||||
hash = localSha1Provider.ComputeHash(data, 0, (int)len);
|
||||
StringBuilder sha1Output = new StringBuilder();
|
||||
|
||||
foreach(byte h in hash) sha1Output.Append(h.ToString("x2"));
|
||||
|
||||
@@ -114,8 +114,8 @@ namespace DiscImageChef.Checksums
|
||||
{
|
||||
SHA256 localSha256Provider = SHA256.Create();
|
||||
FileStream fileStream = new FileStream(filename, FileMode.Open);
|
||||
hash = localSha256Provider.ComputeHash(fileStream);
|
||||
StringBuilder sha256Output = new StringBuilder();
|
||||
hash = localSha256Provider.ComputeHash(fileStream);
|
||||
StringBuilder sha256Output = new StringBuilder();
|
||||
|
||||
foreach(byte h in hash) sha256Output.Append(h.ToString("x2"));
|
||||
|
||||
@@ -133,7 +133,7 @@ namespace DiscImageChef.Checksums
|
||||
public static string Data(byte[] data, uint len, out byte[] hash)
|
||||
{
|
||||
SHA256 localSha256Provider = SHA256.Create();
|
||||
hash = localSha256Provider.ComputeHash(data, 0, (int)len);
|
||||
hash = localSha256Provider.ComputeHash(data, 0, (int)len);
|
||||
StringBuilder sha256Output = new StringBuilder();
|
||||
|
||||
foreach(byte h in hash) sha256Output.Append(h.ToString("x2"));
|
||||
|
||||
@@ -114,8 +114,8 @@ namespace DiscImageChef.Checksums
|
||||
{
|
||||
SHA384 localSha384Provider = SHA384.Create();
|
||||
FileStream fileStream = new FileStream(filename, FileMode.Open);
|
||||
hash = localSha384Provider.ComputeHash(fileStream);
|
||||
StringBuilder sha384Output = new StringBuilder();
|
||||
hash = localSha384Provider.ComputeHash(fileStream);
|
||||
StringBuilder sha384Output = new StringBuilder();
|
||||
|
||||
foreach(byte h in hash) sha384Output.Append(h.ToString("x2"));
|
||||
|
||||
@@ -133,7 +133,7 @@ namespace DiscImageChef.Checksums
|
||||
public static string Data(byte[] data, uint len, out byte[] hash)
|
||||
{
|
||||
SHA384 localSha384Provider = SHA384.Create();
|
||||
hash = localSha384Provider.ComputeHash(data, 0, (int)len);
|
||||
hash = localSha384Provider.ComputeHash(data, 0, (int)len);
|
||||
StringBuilder sha384Output = new StringBuilder();
|
||||
|
||||
foreach(byte h in hash) sha384Output.Append(h.ToString("x2"));
|
||||
|
||||
@@ -114,8 +114,8 @@ namespace DiscImageChef.Checksums
|
||||
{
|
||||
SHA512 localSha512Provider = SHA512.Create();
|
||||
FileStream fileStream = new FileStream(filename, FileMode.Open);
|
||||
hash = localSha512Provider.ComputeHash(fileStream);
|
||||
StringBuilder sha512Output = new StringBuilder();
|
||||
hash = localSha512Provider.ComputeHash(fileStream);
|
||||
StringBuilder sha512Output = new StringBuilder();
|
||||
|
||||
foreach(byte h in hash) sha512Output.Append(h.ToString("x2"));
|
||||
|
||||
@@ -133,7 +133,7 @@ namespace DiscImageChef.Checksums
|
||||
public static string Data(byte[] data, uint len, out byte[] hash)
|
||||
{
|
||||
SHA512 localSha512Provider = SHA512.Create();
|
||||
hash = localSha512Provider.ComputeHash(data, 0, (int)len);
|
||||
hash = localSha512Provider.ComputeHash(data, 0, (int)len);
|
||||
StringBuilder sha512Output = new StringBuilder();
|
||||
|
||||
foreach(byte h in hash) sha512Output.Append(h.ToString("x2"));
|
||||
|
||||
@@ -72,8 +72,7 @@ namespace DiscImageChef.Checksums
|
||||
/// </summary>
|
||||
public SpamSumContext()
|
||||
{
|
||||
self =
|
||||
new FuzzyState {Bh = new BlockhashContext[NUM_BLOCKHASHES]};
|
||||
self = new FuzzyState {Bh = new BlockhashContext[NUM_BLOCKHASHES]};
|
||||
for(int i = 0; i < NUM_BLOCKHASHES; i++) self.Bh[i].Digest = new byte[SPAMSUM_LENGTH];
|
||||
|
||||
self.Bhstart = 0;
|
||||
@@ -211,7 +210,7 @@ namespace DiscImageChef.Checksums
|
||||
|
||||
void fuzzy_engine_step(byte c)
|
||||
{
|
||||
uint i;
|
||||
uint i;
|
||||
/* At each character we update the rolling hash and the normal hashes.
|
||||
* When the rolling hash hits a reset value then we emit a normal hash
|
||||
* as a element of the signature and reset the normal hash. */
|
||||
@@ -260,11 +259,11 @@ namespace DiscImageChef.Checksums
|
||||
// CLAUNIA: Flags seems to never be used in ssdeep, so I just removed it for code simplicity
|
||||
uint FuzzyDigest(out byte[] result)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
uint bi = self.Bhstart;
|
||||
uint h = roll_sum();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
uint bi = self.Bhstart;
|
||||
uint h = roll_sum();
|
||||
int remain = (int)(FUZZY_MAX_RESULT - 1); /* Exclude terminating '\0'. */
|
||||
result = new byte[FUZZY_MAX_RESULT];
|
||||
result = new byte[FUZZY_MAX_RESULT];
|
||||
/* Verify that our elimination was not overeager. */
|
||||
if(!(bi == 0 || (ulong)SSDEEP_BS(bi) / 2 * SPAMSUM_LENGTH < self.TotalSize))
|
||||
throw new Exception("Assertion failed");
|
||||
|
||||
@@ -58,9 +58,9 @@ namespace DiscImageChef.CommonTypes
|
||||
/// <summary>Generic hard disk</summary>
|
||||
GENERIC_HDD = 2,
|
||||
/// <summary>Microdrive type hard disk</summary>
|
||||
Microdrive = 3,
|
||||
Microdrive = 3,
|
||||
/// <summary>Zoned hard disk</summary>
|
||||
Zone_HDD = 4,
|
||||
Zone_HDD = 4,
|
||||
/// <summary>USB flash drives</summary>
|
||||
FlashDrive = 5,
|
||||
#endregion Generics, types 0 to 9
|
||||
@@ -194,7 +194,7 @@ namespace DiscImageChef.CommonTypes
|
||||
/// <summary>Pioneer LaserDisc data</summary>
|
||||
LDROM = 81,
|
||||
LDROM2 = 82,
|
||||
LVROM = 83,
|
||||
LVROM = 83,
|
||||
MegaLD = 84,
|
||||
#endregion LaserDisc based, types 80 to 89
|
||||
|
||||
@@ -203,7 +203,7 @@ namespace DiscImageChef.CommonTypes
|
||||
HiMD = 90,
|
||||
/// <summary>Sony MiniDisc</summary>
|
||||
MD = 91,
|
||||
MDData = 92,
|
||||
MDData = 92,
|
||||
MDData2 = 93,
|
||||
#endregion MiniDisc based, types 90 to 99
|
||||
|
||||
@@ -217,7 +217,7 @@ namespace DiscImageChef.CommonTypes
|
||||
#endregion Plasmon UDO, types 100 to 109
|
||||
|
||||
#region Sony game media, types 110 to 129
|
||||
PlayStationMemoryCard = 110,
|
||||
PlayStationMemoryCard = 110,
|
||||
PlayStationMemoryCard2 = 111,
|
||||
/// <summary>Sony PlayStation game CD</summary>
|
||||
PS1CD = 112,
|
||||
@@ -521,46 +521,46 @@ namespace DiscImageChef.CommonTypes
|
||||
|
||||
#region OnStream ADR, types 310 to 319
|
||||
ADR2120 = 310,
|
||||
ADR260 = 311,
|
||||
ADR30 = 312,
|
||||
ADR50 = 313,
|
||||
ADR260 = 311,
|
||||
ADR30 = 312,
|
||||
ADR50 = 313,
|
||||
#endregion OnStream ADR, types 310 to 319
|
||||
|
||||
#region Advanced Intelligent Tape, types 320 to 339
|
||||
AIT1 = 320,
|
||||
AIT1 = 320,
|
||||
AIT1Turbo = 321,
|
||||
AIT2 = 322,
|
||||
AIT2 = 322,
|
||||
AIT2Turbo = 323,
|
||||
AIT3 = 324,
|
||||
AIT3Ex = 325,
|
||||
AIT3 = 324,
|
||||
AIT3Ex = 325,
|
||||
AIT3Turbo = 326,
|
||||
AIT4 = 327,
|
||||
AIT5 = 328,
|
||||
AIT4 = 327,
|
||||
AIT5 = 328,
|
||||
AITETurbo = 329,
|
||||
SAIT1 = 330,
|
||||
SAIT2 = 331,
|
||||
SAIT1 = 330,
|
||||
SAIT2 = 331,
|
||||
#endregion Advanced Intelligent Tape, types 320 to 339
|
||||
|
||||
#region Iomega, types 340 to 359
|
||||
Bernoulli = 340,
|
||||
Bernoulli = 340,
|
||||
Bernoulli2 = 341,
|
||||
Ditto = 342,
|
||||
DittoMax = 343,
|
||||
Jaz = 344,
|
||||
Jaz2 = 345,
|
||||
PocketZip = 346,
|
||||
REV120 = 347,
|
||||
REV35 = 348,
|
||||
REV70 = 349,
|
||||
ZIP100 = 350,
|
||||
ZIP250 = 351,
|
||||
ZIP750 = 352,
|
||||
Ditto = 342,
|
||||
DittoMax = 343,
|
||||
Jaz = 344,
|
||||
Jaz2 = 345,
|
||||
PocketZip = 346,
|
||||
REV120 = 347,
|
||||
REV35 = 348,
|
||||
REV70 = 349,
|
||||
ZIP100 = 350,
|
||||
ZIP250 = 351,
|
||||
ZIP750 = 352,
|
||||
#endregion Iomega, types 340 to 359
|
||||
|
||||
#region Audio or video media, types 360 to 369
|
||||
CompactCassette = 360,
|
||||
Data8 = 361,
|
||||
MiniDV = 362,
|
||||
Data8 = 361,
|
||||
MiniDV = 362,
|
||||
/// <summary>D/CAS-25: Digital data on Compact Cassette form factor, special magnetic media, 9-track</summary>
|
||||
Dcas25 = 363,
|
||||
/// <summary>D/CAS-85: Digital data on Compact Cassette form factor, special magnetic media, 17-track</summary>
|
||||
@@ -570,96 +570,96 @@ namespace DiscImageChef.CommonTypes
|
||||
#endregion Audio media, types 360 to 369
|
||||
|
||||
#region CompactFlash Association, types 370 to 379
|
||||
CFast = 370,
|
||||
CompactFlash = 371,
|
||||
CFast = 370,
|
||||
CompactFlash = 371,
|
||||
CompactFlashType2 = 372,
|
||||
#endregion CompactFlash Association, types 370 to 379
|
||||
|
||||
#region Digital Audio Tape / Digital Data Storage, types 380 to 389
|
||||
DigitalAudioTape = 380,
|
||||
DAT160 = 381,
|
||||
DAT320 = 382,
|
||||
DAT72 = 383,
|
||||
DDS1 = 384,
|
||||
DDS2 = 385,
|
||||
DDS3 = 386,
|
||||
DDS4 = 387,
|
||||
DAT160 = 381,
|
||||
DAT320 = 382,
|
||||
DAT72 = 383,
|
||||
DDS1 = 384,
|
||||
DDS2 = 385,
|
||||
DDS3 = 386,
|
||||
DDS4 = 387,
|
||||
#endregion Digital Audio Tape / Digital Data Storage, types 380 to 389
|
||||
|
||||
#region DEC, types 390 to 399
|
||||
CompactTapeI = 390,
|
||||
CompactTapeI = 390,
|
||||
CompactTapeII = 391,
|
||||
DECtapeII = 392,
|
||||
DLTtapeIII = 393,
|
||||
DLTtapeIIIxt = 394,
|
||||
DLTtapeIV = 395,
|
||||
DLTtapeS4 = 396,
|
||||
SDLT1 = 397,
|
||||
SDLT2 = 398,
|
||||
VStapeI = 399,
|
||||
DECtapeII = 392,
|
||||
DLTtapeIII = 393,
|
||||
DLTtapeIIIxt = 394,
|
||||
DLTtapeIV = 395,
|
||||
DLTtapeS4 = 396,
|
||||
SDLT1 = 397,
|
||||
SDLT2 = 398,
|
||||
VStapeI = 399,
|
||||
#endregion DEC, types 390 to 399
|
||||
|
||||
#region Exatape, types 400 to 419
|
||||
Exatape15m = 400,
|
||||
Exatape22m = 401,
|
||||
Exatape15m = 400,
|
||||
Exatape22m = 401,
|
||||
Exatape22mAME = 402,
|
||||
Exatape28m = 403,
|
||||
Exatape40m = 404,
|
||||
Exatape45m = 405,
|
||||
Exatape54m = 406,
|
||||
Exatape75m = 407,
|
||||
Exatape76m = 408,
|
||||
Exatape80m = 409,
|
||||
Exatape106m = 410,
|
||||
Exatape28m = 403,
|
||||
Exatape40m = 404,
|
||||
Exatape45m = 405,
|
||||
Exatape54m = 406,
|
||||
Exatape75m = 407,
|
||||
Exatape76m = 408,
|
||||
Exatape80m = 409,
|
||||
Exatape106m = 410,
|
||||
Exatape160mXL = 411,
|
||||
Exatape112m = 412,
|
||||
Exatape125m = 413,
|
||||
Exatape150m = 414,
|
||||
Exatape170m = 415,
|
||||
Exatape225m = 416,
|
||||
Exatape112m = 412,
|
||||
Exatape125m = 413,
|
||||
Exatape150m = 414,
|
||||
Exatape170m = 415,
|
||||
Exatape225m = 416,
|
||||
#endregion Exatape, types 400 to 419
|
||||
|
||||
#region PCMCIA / ExpressCard, types 420 to 429
|
||||
ExpressCard34 = 420,
|
||||
ExpressCard54 = 421,
|
||||
PCCardTypeI = 422,
|
||||
PCCardTypeII = 423,
|
||||
PCCardTypeI = 422,
|
||||
PCCardTypeII = 423,
|
||||
PCCardTypeIII = 424,
|
||||
PCCardTypeIV = 425,
|
||||
PCCardTypeIV = 425,
|
||||
#endregion PCMCIA / ExpressCard, types 420 to 429
|
||||
|
||||
#region SyQuest, types 430 to 449
|
||||
EZ135 = 430,
|
||||
EZ230 = 431,
|
||||
Quest = 432,
|
||||
SparQ = 433,
|
||||
SQ100 = 434,
|
||||
SQ200 = 435,
|
||||
SQ300 = 436,
|
||||
SQ310 = 437,
|
||||
SQ327 = 438,
|
||||
SQ400 = 439,
|
||||
SQ800 = 440,
|
||||
EZ135 = 430,
|
||||
EZ230 = 431,
|
||||
Quest = 432,
|
||||
SparQ = 433,
|
||||
SQ100 = 434,
|
||||
SQ200 = 435,
|
||||
SQ300 = 436,
|
||||
SQ310 = 437,
|
||||
SQ327 = 438,
|
||||
SQ400 = 439,
|
||||
SQ800 = 440,
|
||||
SQ1500 = 441,
|
||||
SQ2000 = 442,
|
||||
SyJet = 443,
|
||||
SyJet = 443,
|
||||
#endregion SyQuest, types 430 to 449
|
||||
|
||||
#region Nintendo, types 450 to 469
|
||||
FamicomGamePak = 450,
|
||||
FamicomGamePak = 450,
|
||||
GameBoyAdvanceGamePak = 451,
|
||||
GameBoyGamePak = 452,
|
||||
GameBoyGamePak = 452,
|
||||
/// <summary>Nintendo GameCube Optical Disc</summary>
|
||||
GOD = 453,
|
||||
N64DD = 454,
|
||||
N64GamePak = 455,
|
||||
NESGamePak = 456,
|
||||
N64DD = 454,
|
||||
N64GamePak = 455,
|
||||
NESGamePak = 456,
|
||||
Nintendo3DSGameCard = 457,
|
||||
NintendoDiskCard = 458,
|
||||
NintendoDSGameCard = 459,
|
||||
NintendoDiskCard = 458,
|
||||
NintendoDSGameCard = 459,
|
||||
NintendoDSiGameCard = 460,
|
||||
SNESGamePak = 461,
|
||||
SNESGamePakUS = 462,
|
||||
SNESGamePak = 461,
|
||||
SNESGamePakUS = 462,
|
||||
/// <summary>Nintendo Wii Optical Disc</summary>
|
||||
WOD = 463,
|
||||
/// <summary>Nintendo Wii U Optical Disc</summary>
|
||||
@@ -668,101 +668,101 @@ namespace DiscImageChef.CommonTypes
|
||||
#endregion Nintendo, types 450 to 469
|
||||
|
||||
#region IBM Tapes, types 470 to 479
|
||||
IBM3470 = 470,
|
||||
IBM3480 = 471,
|
||||
IBM3490 = 472,
|
||||
IBM3470 = 470,
|
||||
IBM3480 = 471,
|
||||
IBM3490 = 472,
|
||||
IBM3490E = 473,
|
||||
IBM3592 = 474,
|
||||
IBM3592 = 474,
|
||||
#endregion IBM Tapes, types 470 to 479
|
||||
|
||||
#region LTO Ultrium, types 480 to 509
|
||||
LTO = 480,
|
||||
LTO2 = 481,
|
||||
LTO3 = 482,
|
||||
LTO = 480,
|
||||
LTO2 = 481,
|
||||
LTO3 = 482,
|
||||
LTO3WORM = 483,
|
||||
LTO4 = 484,
|
||||
LTO4 = 484,
|
||||
LTO4WORM = 485,
|
||||
LTO5 = 486,
|
||||
LTO5 = 486,
|
||||
LTO5WORM = 487,
|
||||
LTO6 = 488,
|
||||
LTO6 = 488,
|
||||
LTO6WORM = 489,
|
||||
LTO7 = 490,
|
||||
LTO7 = 490,
|
||||
LTO7WORM = 491,
|
||||
#endregion LTO Ultrium, types 480 to 509
|
||||
|
||||
#region MemoryStick, types 510 to 519
|
||||
MemoryStick = 510,
|
||||
MemoryStickDuo = 511,
|
||||
MemoryStickMicro = 512,
|
||||
MemoryStickPro = 513,
|
||||
MemoryStick = 510,
|
||||
MemoryStickDuo = 511,
|
||||
MemoryStickMicro = 512,
|
||||
MemoryStickPro = 513,
|
||||
MemoryStickProDuo = 514,
|
||||
#endregion MemoryStick, types 510 to 519
|
||||
|
||||
#region SecureDigital, types 520 to 529
|
||||
microSD = 520,
|
||||
miniSD = 521,
|
||||
microSD = 520,
|
||||
miniSD = 521,
|
||||
SecureDigital = 522,
|
||||
#endregion SecureDigital, types 520 to 529
|
||||
|
||||
#region MultiMediaCard, types 530 to 539
|
||||
MMC = 530,
|
||||
MMCmicro = 531,
|
||||
RSMMC = 532,
|
||||
MMCplus = 533,
|
||||
MMC = 530,
|
||||
MMCmicro = 531,
|
||||
RSMMC = 532,
|
||||
MMCplus = 533,
|
||||
MMCmobile = 534,
|
||||
#endregion MultiMediaCard, types 530 to 539
|
||||
|
||||
#region SLR, types 540 to 569
|
||||
MLR1 = 540,
|
||||
MLR1SL = 541,
|
||||
MLR3 = 542,
|
||||
SLR1 = 543,
|
||||
SLR2 = 544,
|
||||
SLR3 = 545,
|
||||
SLR32 = 546,
|
||||
SLR32SL = 547,
|
||||
SLR4 = 548,
|
||||
SLR5 = 549,
|
||||
SLR5SL = 550,
|
||||
SLR6 = 551,
|
||||
SLRtape7 = 552,
|
||||
SLRtape7SL = 553,
|
||||
SLRtape24 = 554,
|
||||
MLR1 = 540,
|
||||
MLR1SL = 541,
|
||||
MLR3 = 542,
|
||||
SLR1 = 543,
|
||||
SLR2 = 544,
|
||||
SLR3 = 545,
|
||||
SLR32 = 546,
|
||||
SLR32SL = 547,
|
||||
SLR4 = 548,
|
||||
SLR5 = 549,
|
||||
SLR5SL = 550,
|
||||
SLR6 = 551,
|
||||
SLRtape7 = 552,
|
||||
SLRtape7SL = 553,
|
||||
SLRtape24 = 554,
|
||||
SLRtape24SL = 555,
|
||||
SLRtape40 = 556,
|
||||
SLRtape50 = 557,
|
||||
SLRtape60 = 558,
|
||||
SLRtape75 = 559,
|
||||
SLRtape100 = 560,
|
||||
SLRtape140 = 561,
|
||||
SLRtape40 = 556,
|
||||
SLRtape50 = 557,
|
||||
SLRtape60 = 558,
|
||||
SLRtape75 = 559,
|
||||
SLRtape100 = 560,
|
||||
SLRtape140 = 561,
|
||||
#endregion SLR, types 540 to 569
|
||||
|
||||
#region QIC, types 570 to 589
|
||||
QIC11 = 570,
|
||||
QIC120 = 571,
|
||||
QIC11 = 570,
|
||||
QIC120 = 571,
|
||||
QIC1350 = 572,
|
||||
QIC150 = 573,
|
||||
QIC24 = 574,
|
||||
QIC150 = 573,
|
||||
QIC24 = 574,
|
||||
QIC3010 = 575,
|
||||
QIC3020 = 576,
|
||||
QIC3080 = 577,
|
||||
QIC3095 = 578,
|
||||
QIC320 = 579,
|
||||
QIC40 = 580,
|
||||
QIC525 = 581,
|
||||
QIC80 = 582,
|
||||
QIC320 = 579,
|
||||
QIC40 = 580,
|
||||
QIC525 = 581,
|
||||
QIC80 = 582,
|
||||
#endregion QIC, types 570 to 589
|
||||
|
||||
#region StorageTek tapes, types 590 to 609
|
||||
STK4480 = 590,
|
||||
STK4490 = 591,
|
||||
STK9490 = 592,
|
||||
T9840A = 593,
|
||||
T9840B = 594,
|
||||
T9840C = 595,
|
||||
T9840D = 596,
|
||||
T9940A = 597,
|
||||
T9940B = 598,
|
||||
T9840A = 593,
|
||||
T9840B = 594,
|
||||
T9840C = 595,
|
||||
T9840D = 596,
|
||||
T9940A = 597,
|
||||
T9940B = 598,
|
||||
T10000A = 599,
|
||||
T10000B = 600,
|
||||
T10000C = 601,
|
||||
@@ -770,13 +770,13 @@ namespace DiscImageChef.CommonTypes
|
||||
#endregion StorageTek tapes, types 590 to 609
|
||||
|
||||
#region Travan, types 610 to 619
|
||||
Travan = 610,
|
||||
Travan = 610,
|
||||
Travan1Ex = 611,
|
||||
Travan3 = 612,
|
||||
Travan3 = 612,
|
||||
Travan3Ex = 613,
|
||||
Travan4 = 614,
|
||||
Travan5 = 615,
|
||||
Travan7 = 616,
|
||||
Travan4 = 614,
|
||||
Travan5 = 615,
|
||||
Travan7 = 616,
|
||||
#endregion Travan, types 610 to 619
|
||||
|
||||
#region VXA, types 620 to 629
|
||||
@@ -840,43 +840,43 @@ namespace DiscImageChef.CommonTypes
|
||||
|
||||
#region Other floppy standards, types 660 to 689
|
||||
CompactFloppy = 660,
|
||||
DemiDiskette = 661,
|
||||
DemiDiskette = 661,
|
||||
/// <summary>3.5", 652 tracks, 2 sides, 512 bytes/sector, Floptical, ECMA-207, ISO 14169</summary>
|
||||
Floptical = 662,
|
||||
HiFD = 663,
|
||||
QuickDisk = 664,
|
||||
UHD144 = 665,
|
||||
VideoFloppy = 666,
|
||||
Wafer = 667,
|
||||
HiFD = 663,
|
||||
QuickDisk = 664,
|
||||
UHD144 = 665,
|
||||
VideoFloppy = 666,
|
||||
Wafer = 667,
|
||||
ZXMicrodrive = 668,
|
||||
#endregion Other floppy standards, types 660 to 669
|
||||
|
||||
#region Miscellaneous, types 670 to 689
|
||||
BeeCard = 670,
|
||||
Borsu = 671,
|
||||
DataStore = 672,
|
||||
DIR = 673,
|
||||
DST = 674,
|
||||
DTF = 675,
|
||||
DTF2 = 676,
|
||||
BeeCard = 670,
|
||||
Borsu = 671,
|
||||
DataStore = 672,
|
||||
DIR = 673,
|
||||
DST = 674,
|
||||
DTF = 675,
|
||||
DTF2 = 676,
|
||||
Flextra3020 = 677,
|
||||
Flextra3225 = 678,
|
||||
HiTC1 = 679,
|
||||
HiTC2 = 680,
|
||||
LT1 = 681,
|
||||
MiniCard = 872,
|
||||
Orb = 683,
|
||||
Orb5 = 684,
|
||||
SmartMedia = 685,
|
||||
xD = 686,
|
||||
XQD = 687,
|
||||
DataPlay = 688,
|
||||
HiTC1 = 679,
|
||||
HiTC2 = 680,
|
||||
LT1 = 681,
|
||||
MiniCard = 872,
|
||||
Orb = 683,
|
||||
Orb5 = 684,
|
||||
SmartMedia = 685,
|
||||
xD = 686,
|
||||
XQD = 687,
|
||||
DataPlay = 688,
|
||||
#endregion Miscellaneous, types 670 to 689
|
||||
|
||||
#region Apple Hard Disks, types 690 to 699
|
||||
AppleProfile = 690,
|
||||
AppleWidget = 691,
|
||||
AppleHD20 = 692,
|
||||
AppleProfile = 690,
|
||||
AppleWidget = 691,
|
||||
AppleHD20 = 692,
|
||||
PriamDataTower = 693,
|
||||
#endregion Apple Hard Disks, types 690 to 699
|
||||
|
||||
@@ -1022,7 +1022,7 @@ namespace DiscImageChef.CommonTypes
|
||||
LS120 = 730,
|
||||
LS240 = 731,
|
||||
FD32MB = 732,
|
||||
RDX = 733,
|
||||
RDX = 733,
|
||||
/// <summary>Imation 320Gb RDX</summary>
|
||||
RDX320 = 734,
|
||||
#endregion Imation, types 730 to 739
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace DiscImageChef.CommonTypes
|
||||
/// <param name="blockSize">Size in bytes of each block</param>
|
||||
/// <returns></returns>
|
||||
public static MediaType Get(byte scsiPeripheralType, string vendor, string model, byte mediumType,
|
||||
byte densityCode, ulong blocks, uint blockSize)
|
||||
byte densityCode, ulong blocks, uint blockSize)
|
||||
{
|
||||
switch(scsiPeripheralType)
|
||||
{
|
||||
@@ -113,7 +113,7 @@ namespace DiscImageChef.CommonTypes
|
||||
if(blocks == 1440) return MediaType.DOS_35_DS_DD_9;
|
||||
}
|
||||
else if(blockSize == 1024)
|
||||
if(blocks == 1232)
|
||||
if(blocks == 1232)
|
||||
return MediaType.NEC_35_HD_8;
|
||||
|
||||
return MediaType.Unknown;
|
||||
@@ -197,7 +197,7 @@ namespace DiscImageChef.CommonTypes
|
||||
case 603466:
|
||||
case 637041: return MediaType.ECMA_184;
|
||||
case 936921:
|
||||
case 948770: return MediaType.ECMA_195;
|
||||
case 948770: return MediaType.ECMA_195;
|
||||
case 1244621: return MediaType.ECMA_238;
|
||||
case 14476734: return MediaType.ECMA_260;
|
||||
case 24445990: return MediaType.ECMA_260_Double;
|
||||
@@ -212,7 +212,7 @@ namespace DiscImageChef.CommonTypes
|
||||
case 310352: // Found in real media
|
||||
case 318988:
|
||||
case 320332:
|
||||
case 321100: return MediaType.ECMA_239;
|
||||
case 321100: return MediaType.ECMA_239;
|
||||
case 605846: return MediaType.GigaMo;
|
||||
case 1063146: return MediaType.GigaMo2;
|
||||
case 1128134: return MediaType.ECMA_280;
|
||||
@@ -315,7 +315,7 @@ namespace DiscImageChef.CommonTypes
|
||||
case 603466:
|
||||
case 637041: return MediaType.ECMA_184;
|
||||
case 936921:
|
||||
case 948770: return MediaType.ECMA_195;
|
||||
case 948770: return MediaType.ECMA_195;
|
||||
case 1244621: return MediaType.ECMA_238;
|
||||
case 14476734: return MediaType.ECMA_260;
|
||||
case 24445990: return MediaType.ECMA_260_Double;
|
||||
@@ -329,7 +329,7 @@ namespace DiscImageChef.CommonTypes
|
||||
case 310352: // Found in real media
|
||||
case 318988:
|
||||
case 320332:
|
||||
case 321100: return MediaType.ECMA_239;
|
||||
case 321100: return MediaType.ECMA_239;
|
||||
case 605846: return MediaType.GigaMo;
|
||||
case 1063146: return MediaType.GigaMo2;
|
||||
case 1128134: return MediaType.ECMA_280;
|
||||
@@ -1412,7 +1412,7 @@ namespace DiscImageChef.CommonTypes
|
||||
case 1298496: return MediaType.PD650;
|
||||
case 1644581:
|
||||
case 1647371: return MediaType.ECMA_195_512;
|
||||
default: return MediaType.UnknownMO;
|
||||
default: return MediaType.UnknownMO;
|
||||
}
|
||||
}
|
||||
case 1024:
|
||||
@@ -1424,7 +1424,7 @@ namespace DiscImageChef.CommonTypes
|
||||
case 603466:
|
||||
case 637041: return MediaType.ECMA_184;
|
||||
case 936921:
|
||||
case 948770: return MediaType.ECMA_195;
|
||||
case 948770: return MediaType.ECMA_195;
|
||||
case 1244621: return MediaType.ECMA_238;
|
||||
case 14476734: return MediaType.ECMA_260;
|
||||
case 24445990: return MediaType.ECMA_260_Double;
|
||||
@@ -1438,7 +1438,7 @@ namespace DiscImageChef.CommonTypes
|
||||
case 310352: // Found in real media
|
||||
case 318988:
|
||||
case 320332:
|
||||
case 321100: return MediaType.ECMA_239;
|
||||
case 321100: return MediaType.ECMA_239;
|
||||
case 605846: return MediaType.GigaMo;
|
||||
case 1063146: return MediaType.GigaMo2;
|
||||
case 1128134: return MediaType.ECMA_280;
|
||||
|
||||
@@ -161,7 +161,7 @@ namespace DiscImageChef.Compression
|
||||
buf = new byte[len];
|
||||
int count; // was an unsigned long, seems unnecessary
|
||||
for(count = 0; count < len;)
|
||||
if(tdctl.Bufcnt == 0)
|
||||
if(tdctl.Bufcnt == 0)
|
||||
{
|
||||
if((c = DecodeChar()) < 0) return count; // fatal error
|
||||
|
||||
@@ -178,7 +178,7 @@ namespace DiscImageChef.Compression
|
||||
if((pos = DecodePosition()) < 0) return count; // fatal error
|
||||
|
||||
tdctl.Bufpos = (ushort)((tdctl.R - pos - 1) & (N - 1));
|
||||
tdctl.Bufcnt = (ushort)(c - 255 + THRESHOLD);
|
||||
tdctl.Bufcnt = (ushort)(c - 255 + THRESHOLD);
|
||||
tdctl.Bufndx = 0;
|
||||
}
|
||||
}
|
||||
@@ -259,9 +259,9 @@ namespace DiscImageChef.Compression
|
||||
|
||||
for(i = 0; i < N_CHAR; i++)
|
||||
{
|
||||
freq[i] = 1;
|
||||
son[i] = (short)(i + T);
|
||||
prnt[i + T] = (short)i;
|
||||
freq[i] = 1;
|
||||
son[i] = (short)(i + T);
|
||||
prnt[i + T] = (short)i;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
@@ -287,7 +287,7 @@ namespace DiscImageChef.Compression
|
||||
|
||||
/* halven cumulative freq for leaf nodes */
|
||||
short j = 0;
|
||||
for(i = 0; i < T; i++)
|
||||
for(i = 0; i < T; i++)
|
||||
if(son[i] >= T)
|
||||
{
|
||||
freq[j] = (ushort)((freq[i] + 1) / 2);
|
||||
@@ -298,9 +298,9 @@ namespace DiscImageChef.Compression
|
||||
/* make a tree : first, connect children nodes */
|
||||
for(i = 0, j = N_CHAR; j < T; i += 2, j++)
|
||||
{
|
||||
k = (short)(i + 1);
|
||||
k = (short)(i + 1);
|
||||
ushort f = freq[j] = (ushort)(freq[i] + freq[k]);
|
||||
for(k = (short)(j - 1); f < freq[k]; k--) { }
|
||||
for(k = (short)(j - 1); f < freq[k]; k--) { }
|
||||
|
||||
k++;
|
||||
ushort l = (ushort)((j - k) * 2);
|
||||
@@ -312,7 +312,7 @@ namespace DiscImageChef.Compression
|
||||
}
|
||||
|
||||
/* connect parent nodes */
|
||||
for(i = 0; i < T; i++)
|
||||
for(i = 0; i < T; i++)
|
||||
if((k = son[i]) >= T)
|
||||
prnt[k] = i;
|
||||
else
|
||||
@@ -339,16 +339,16 @@ namespace DiscImageChef.Compression
|
||||
freq[c] = freq[l];
|
||||
freq[l] = (ushort)k;
|
||||
|
||||
int i = son[c];
|
||||
prnt[i] = (short)l;
|
||||
int i = son[c];
|
||||
prnt[i] = (short)l;
|
||||
if(i < T) prnt[i + 1] = (short)l;
|
||||
|
||||
int j = son[l];
|
||||
int j = son[l];
|
||||
son[l] = (short)i;
|
||||
|
||||
prnt[j] = (short)c;
|
||||
prnt[j] = (short)c;
|
||||
if(j < T) prnt[j + 1] = (short)c;
|
||||
son[c] = (short)j;
|
||||
son[c] = (short)j;
|
||||
|
||||
c = l;
|
||||
}
|
||||
@@ -380,7 +380,7 @@ namespace DiscImageChef.Compression
|
||||
|
||||
short DecodePosition()
|
||||
{
|
||||
short bit;
|
||||
short bit;
|
||||
|
||||
/* decode upper 6 bits from given table */
|
||||
if((bit = (short)GetByte()) < 0) return -1;
|
||||
|
||||
@@ -54,15 +54,15 @@ namespace DiscImageChef.Console
|
||||
/// </summary>
|
||||
public static class DicConsole
|
||||
{
|
||||
public static event WriteLineHandler WriteLineEvent;
|
||||
public static event ErrorWriteLineHandler ErrorWriteLineEvent;
|
||||
public static event WriteLineHandler WriteLineEvent;
|
||||
public static event ErrorWriteLineHandler ErrorWriteLineEvent;
|
||||
public static event VerboseWriteLineHandler VerboseWriteLineEvent;
|
||||
public static event DebugWriteLineHandler DebugWriteLineEvent;
|
||||
public static event DebugWriteLineHandler DebugWriteLineEvent;
|
||||
|
||||
public static event WriteHandler WriteEvent;
|
||||
public static event ErrorWriteHandler ErrorWriteEvent;
|
||||
public static event WriteHandler WriteEvent;
|
||||
public static event ErrorWriteHandler ErrorWriteEvent;
|
||||
public static event VerboseWriteHandler VerboseWriteEvent;
|
||||
public static event DebugWriteHandler DebugWriteEvent;
|
||||
public static event DebugWriteHandler DebugWriteEvent;
|
||||
|
||||
public static void WriteLine(string format, params object[] arg)
|
||||
{
|
||||
|
||||
@@ -111,14 +111,14 @@ namespace DiscImageChef.Core
|
||||
EndProgress();
|
||||
end = DateTime.Now;
|
||||
|
||||
results.FillTime = (end - start).TotalSeconds;
|
||||
results.FillTime = (end - start).TotalSeconds;
|
||||
results.FillSpeed = bufferSize / 1048576.0 / (end - start).TotalSeconds;
|
||||
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
long mem = GC.GetTotalMemory(false);
|
||||
long mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
if(mem < results.MinMemory) results.MinMemory = mem;
|
||||
start = DateTime.Now;
|
||||
start = DateTime.Now;
|
||||
InitProgress();
|
||||
for(int i = 0; i < bufferSize / blockSize; i++)
|
||||
{
|
||||
@@ -128,21 +128,21 @@ namespace DiscImageChef.Core
|
||||
}
|
||||
|
||||
EndProgress();
|
||||
end = DateTime.Now;
|
||||
mem = GC.GetTotalMemory(false);
|
||||
end = DateTime.Now;
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
if(mem < results.MinMemory) results.MinMemory = mem;
|
||||
|
||||
results.ReadTime = (end - start).TotalSeconds;
|
||||
results.ReadTime = (end - start).TotalSeconds;
|
||||
results.ReadSpeed = bufferSize / 1048576.0 / (end - start).TotalSeconds;
|
||||
|
||||
#region Adler32
|
||||
IChecksum ctx = new Adler32Context();
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
if(mem < results.MinMemory) results.MinMemory = mem;
|
||||
start = DateTime.Now;
|
||||
start = DateTime.Now;
|
||||
InitProgress();
|
||||
for(int i = 0; i < bufferSize / blockSize; i++)
|
||||
{
|
||||
@@ -154,27 +154,27 @@ namespace DiscImageChef.Core
|
||||
|
||||
EndProgress();
|
||||
ctx.End();
|
||||
end = DateTime.Now;
|
||||
mem = GC.GetTotalMemory(false);
|
||||
end = DateTime.Now;
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
if(mem < results.MinMemory) results.MinMemory = mem;
|
||||
|
||||
results.Entries.Add("Adler32",
|
||||
new BenchmarkEntry
|
||||
{
|
||||
TimeSpan = (end - start).TotalSeconds,
|
||||
TimeSpan = (end - start).TotalSeconds,
|
||||
Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds
|
||||
});
|
||||
results.SeparateTime += (end - start).TotalSeconds;
|
||||
#endregion Adler32
|
||||
|
||||
|
||||
#region Fletcher16
|
||||
ctx = new Fletcher16Context();
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
if(mem < results.MinMemory) results.MinMemory = mem;
|
||||
start = DateTime.Now;
|
||||
start = DateTime.Now;
|
||||
InitProgress();
|
||||
for(int i = 0; i < bufferSize / blockSize; i++)
|
||||
{
|
||||
@@ -186,15 +186,15 @@ namespace DiscImageChef.Core
|
||||
|
||||
EndProgress();
|
||||
ctx.End();
|
||||
end = DateTime.Now;
|
||||
mem = GC.GetTotalMemory(false);
|
||||
end = DateTime.Now;
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
if(mem < results.MinMemory) results.MinMemory = mem;
|
||||
|
||||
results.Entries.Add("Fletcher16",
|
||||
new BenchmarkEntry
|
||||
{
|
||||
TimeSpan = (end - start).TotalSeconds,
|
||||
TimeSpan = (end - start).TotalSeconds,
|
||||
Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds
|
||||
});
|
||||
results.SeparateTime += (end - start).TotalSeconds;
|
||||
@@ -203,10 +203,10 @@ namespace DiscImageChef.Core
|
||||
#region Fletcher32
|
||||
ctx = new Fletcher32Context();
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
if(mem < results.MinMemory) results.MinMemory = mem;
|
||||
start = DateTime.Now;
|
||||
start = DateTime.Now;
|
||||
InitProgress();
|
||||
for(int i = 0; i < bufferSize / blockSize; i++)
|
||||
{
|
||||
@@ -218,15 +218,15 @@ namespace DiscImageChef.Core
|
||||
|
||||
EndProgress();
|
||||
ctx.End();
|
||||
end = DateTime.Now;
|
||||
mem = GC.GetTotalMemory(false);
|
||||
end = DateTime.Now;
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
if(mem < results.MinMemory) results.MinMemory = mem;
|
||||
|
||||
results.Entries.Add("Fletcher32",
|
||||
new BenchmarkEntry
|
||||
{
|
||||
TimeSpan = (end - start).TotalSeconds,
|
||||
TimeSpan = (end - start).TotalSeconds,
|
||||
Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds
|
||||
});
|
||||
results.SeparateTime += (end - start).TotalSeconds;
|
||||
@@ -235,10 +235,10 @@ namespace DiscImageChef.Core
|
||||
#region CRC16
|
||||
ctx = new Crc16Context();
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
if(mem < results.MinMemory) results.MinMemory = mem;
|
||||
start = DateTime.Now;
|
||||
start = DateTime.Now;
|
||||
InitProgress();
|
||||
for(int i = 0; i < bufferSize / blockSize; i++)
|
||||
{
|
||||
@@ -250,15 +250,15 @@ namespace DiscImageChef.Core
|
||||
|
||||
EndProgress();
|
||||
ctx.End();
|
||||
end = DateTime.Now;
|
||||
mem = GC.GetTotalMemory(false);
|
||||
end = DateTime.Now;
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
if(mem < results.MinMemory) results.MinMemory = mem;
|
||||
|
||||
results.Entries.Add("CRC16",
|
||||
new BenchmarkEntry
|
||||
{
|
||||
TimeSpan = (end - start).TotalSeconds,
|
||||
TimeSpan = (end - start).TotalSeconds,
|
||||
Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds
|
||||
});
|
||||
results.SeparateTime += (end - start).TotalSeconds;
|
||||
@@ -267,10 +267,10 @@ namespace DiscImageChef.Core
|
||||
#region CRC32
|
||||
ctx = new Crc32Context();
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
if(mem < results.MinMemory) results.MinMemory = mem;
|
||||
start = DateTime.Now;
|
||||
start = DateTime.Now;
|
||||
InitProgress();
|
||||
for(int i = 0; i < bufferSize / blockSize; i++)
|
||||
{
|
||||
@@ -282,15 +282,15 @@ namespace DiscImageChef.Core
|
||||
|
||||
EndProgress();
|
||||
ctx.End();
|
||||
end = DateTime.Now;
|
||||
mem = GC.GetTotalMemory(false);
|
||||
end = DateTime.Now;
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
if(mem < results.MinMemory) results.MinMemory = mem;
|
||||
|
||||
results.Entries.Add("CRC32",
|
||||
new BenchmarkEntry
|
||||
{
|
||||
TimeSpan = (end - start).TotalSeconds,
|
||||
TimeSpan = (end - start).TotalSeconds,
|
||||
Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds
|
||||
});
|
||||
results.SeparateTime += (end - start).TotalSeconds;
|
||||
@@ -299,10 +299,10 @@ namespace DiscImageChef.Core
|
||||
#region CRC64
|
||||
ctx = new Crc64Context();
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
if(mem < results.MinMemory) results.MinMemory = mem;
|
||||
start = DateTime.Now;
|
||||
start = DateTime.Now;
|
||||
InitProgress();
|
||||
for(int i = 0; i < bufferSize / blockSize; i++)
|
||||
{
|
||||
@@ -314,15 +314,15 @@ namespace DiscImageChef.Core
|
||||
|
||||
EndProgress();
|
||||
ctx.End();
|
||||
end = DateTime.Now;
|
||||
mem = GC.GetTotalMemory(false);
|
||||
end = DateTime.Now;
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
if(mem < results.MinMemory) results.MinMemory = mem;
|
||||
|
||||
results.Entries.Add("CRC64",
|
||||
new BenchmarkEntry
|
||||
{
|
||||
TimeSpan = (end - start).TotalSeconds,
|
||||
TimeSpan = (end - start).TotalSeconds,
|
||||
Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds
|
||||
});
|
||||
results.SeparateTime += (end - start).TotalSeconds;
|
||||
@@ -331,10 +331,10 @@ namespace DiscImageChef.Core
|
||||
#region MD5
|
||||
ctx = new Md5Context();
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
if(mem < results.MinMemory) results.MinMemory = mem;
|
||||
start = DateTime.Now;
|
||||
start = DateTime.Now;
|
||||
InitProgress();
|
||||
for(int i = 0; i < bufferSize / blockSize; i++)
|
||||
{
|
||||
@@ -346,15 +346,15 @@ namespace DiscImageChef.Core
|
||||
|
||||
EndProgress();
|
||||
ctx.End();
|
||||
end = DateTime.Now;
|
||||
mem = GC.GetTotalMemory(false);
|
||||
end = DateTime.Now;
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
if(mem < results.MinMemory) results.MinMemory = mem;
|
||||
|
||||
results.Entries.Add("MD5",
|
||||
new BenchmarkEntry
|
||||
{
|
||||
TimeSpan = (end - start).TotalSeconds,
|
||||
TimeSpan = (end - start).TotalSeconds,
|
||||
Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds
|
||||
});
|
||||
results.SeparateTime += (end - start).TotalSeconds;
|
||||
@@ -363,10 +363,10 @@ namespace DiscImageChef.Core
|
||||
#region RIPEMD160
|
||||
ctx = new Ripemd160Context();
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
if(mem < results.MinMemory) results.MinMemory = mem;
|
||||
start = DateTime.Now;
|
||||
start = DateTime.Now;
|
||||
InitProgress();
|
||||
for(int i = 0; i < bufferSize / blockSize; i++)
|
||||
{
|
||||
@@ -378,15 +378,15 @@ namespace DiscImageChef.Core
|
||||
|
||||
EndProgress();
|
||||
ctx.End();
|
||||
end = DateTime.Now;
|
||||
mem = GC.GetTotalMemory(false);
|
||||
end = DateTime.Now;
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
if(mem < results.MinMemory) results.MinMemory = mem;
|
||||
|
||||
results.Entries.Add("RIPEMD160",
|
||||
new BenchmarkEntry
|
||||
{
|
||||
TimeSpan = (end - start).TotalSeconds,
|
||||
TimeSpan = (end - start).TotalSeconds,
|
||||
Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds
|
||||
});
|
||||
results.SeparateTime += (end - start).TotalSeconds;
|
||||
@@ -395,10 +395,10 @@ namespace DiscImageChef.Core
|
||||
#region SHA1
|
||||
ctx = new Sha1Context();
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
if(mem < results.MinMemory) results.MinMemory = mem;
|
||||
start = DateTime.Now;
|
||||
start = DateTime.Now;
|
||||
InitProgress();
|
||||
for(int i = 0; i < bufferSize / blockSize; i++)
|
||||
{
|
||||
@@ -410,15 +410,15 @@ namespace DiscImageChef.Core
|
||||
|
||||
EndProgress();
|
||||
ctx.End();
|
||||
end = DateTime.Now;
|
||||
mem = GC.GetTotalMemory(false);
|
||||
end = DateTime.Now;
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
if(mem < results.MinMemory) results.MinMemory = mem;
|
||||
|
||||
results.Entries.Add("SHA1",
|
||||
new BenchmarkEntry
|
||||
{
|
||||
TimeSpan = (end - start).TotalSeconds,
|
||||
TimeSpan = (end - start).TotalSeconds,
|
||||
Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds
|
||||
});
|
||||
results.SeparateTime += (end - start).TotalSeconds;
|
||||
@@ -427,10 +427,10 @@ namespace DiscImageChef.Core
|
||||
#region SHA256
|
||||
ctx = new Sha256Context();
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
if(mem < results.MinMemory) results.MinMemory = mem;
|
||||
start = DateTime.Now;
|
||||
start = DateTime.Now;
|
||||
InitProgress();
|
||||
for(int i = 0; i < bufferSize / blockSize; i++)
|
||||
{
|
||||
@@ -442,15 +442,15 @@ namespace DiscImageChef.Core
|
||||
|
||||
EndProgress();
|
||||
ctx.End();
|
||||
end = DateTime.Now;
|
||||
mem = GC.GetTotalMemory(false);
|
||||
end = DateTime.Now;
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
if(mem < results.MinMemory) results.MinMemory = mem;
|
||||
|
||||
results.Entries.Add("SHA256",
|
||||
new BenchmarkEntry
|
||||
{
|
||||
TimeSpan = (end - start).TotalSeconds,
|
||||
TimeSpan = (end - start).TotalSeconds,
|
||||
Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds
|
||||
});
|
||||
results.SeparateTime += (end - start).TotalSeconds;
|
||||
@@ -459,10 +459,10 @@ namespace DiscImageChef.Core
|
||||
#region SHA384
|
||||
ctx = new Sha384Context();
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
if(mem < results.MinMemory) results.MinMemory = mem;
|
||||
start = DateTime.Now;
|
||||
start = DateTime.Now;
|
||||
InitProgress();
|
||||
for(int i = 0; i < bufferSize / blockSize; i++)
|
||||
{
|
||||
@@ -474,15 +474,15 @@ namespace DiscImageChef.Core
|
||||
|
||||
EndProgress();
|
||||
ctx.End();
|
||||
end = DateTime.Now;
|
||||
mem = GC.GetTotalMemory(false);
|
||||
end = DateTime.Now;
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
if(mem < results.MinMemory) results.MinMemory = mem;
|
||||
|
||||
results.Entries.Add("SHA384",
|
||||
new BenchmarkEntry
|
||||
{
|
||||
TimeSpan = (end - start).TotalSeconds,
|
||||
TimeSpan = (end - start).TotalSeconds,
|
||||
Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds
|
||||
});
|
||||
results.SeparateTime += (end - start).TotalSeconds;
|
||||
@@ -491,10 +491,10 @@ namespace DiscImageChef.Core
|
||||
#region SHA512
|
||||
ctx = new Sha512Context();
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
if(mem < results.MinMemory) results.MinMemory = mem;
|
||||
start = DateTime.Now;
|
||||
start = DateTime.Now;
|
||||
InitProgress();
|
||||
for(int i = 0; i < bufferSize / blockSize; i++)
|
||||
{
|
||||
@@ -506,15 +506,15 @@ namespace DiscImageChef.Core
|
||||
|
||||
EndProgress();
|
||||
ctx.End();
|
||||
end = DateTime.Now;
|
||||
mem = GC.GetTotalMemory(false);
|
||||
end = DateTime.Now;
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
if(mem < results.MinMemory) results.MinMemory = mem;
|
||||
|
||||
results.Entries.Add("SHA512",
|
||||
new BenchmarkEntry
|
||||
{
|
||||
TimeSpan = (end - start).TotalSeconds,
|
||||
TimeSpan = (end - start).TotalSeconds,
|
||||
Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds
|
||||
});
|
||||
results.SeparateTime += (end - start).TotalSeconds;
|
||||
@@ -523,10 +523,10 @@ namespace DiscImageChef.Core
|
||||
#region SpamSum
|
||||
ctx = new SpamSumContext();
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
if(mem < results.MinMemory) results.MinMemory = mem;
|
||||
start = DateTime.Now;
|
||||
start = DateTime.Now;
|
||||
InitProgress();
|
||||
for(int i = 0; i < bufferSize / blockSize; i++)
|
||||
{
|
||||
@@ -538,15 +538,15 @@ namespace DiscImageChef.Core
|
||||
|
||||
EndProgress();
|
||||
ctx.End();
|
||||
end = DateTime.Now;
|
||||
mem = GC.GetTotalMemory(false);
|
||||
end = DateTime.Now;
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
if(mem < results.MinMemory) results.MinMemory = mem;
|
||||
|
||||
results.Entries.Add("SpamSum",
|
||||
new BenchmarkEntry
|
||||
{
|
||||
TimeSpan = (end - start).TotalSeconds,
|
||||
TimeSpan = (end - start).TotalSeconds,
|
||||
Speed = bufferSize / 1048576.0 / (end - start).TotalSeconds
|
||||
});
|
||||
results.SeparateTime += (end - start).TotalSeconds;
|
||||
@@ -555,10 +555,10 @@ namespace DiscImageChef.Core
|
||||
#region Entropy
|
||||
ulong[] entTable = new ulong[256];
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
if(mem < results.MinMemory) results.MinMemory = mem;
|
||||
start = DateTime.Now;
|
||||
start = DateTime.Now;
|
||||
InitProgress();
|
||||
for(int i = 0; i < bufferSize / blockSize; i++)
|
||||
{
|
||||
@@ -570,15 +570,16 @@ namespace DiscImageChef.Core
|
||||
|
||||
EndProgress();
|
||||
|
||||
end = DateTime.Now;
|
||||
mem = GC.GetTotalMemory(false);
|
||||
end = DateTime.Now;
|
||||
mem = GC.GetTotalMemory(false);
|
||||
if(mem > results.MaxMemory) results.MaxMemory = mem;
|
||||
if(mem < results.MinMemory) results.MinMemory = mem;
|
||||
|
||||
results.EntropyTime = (end - start).TotalSeconds;
|
||||
results.EntropyTime = (end - start).TotalSeconds;
|
||||
results.EntropySpeed = bufferSize / 1048576.0 / (end - start).TotalSeconds;
|
||||
#endregion Entropy
|
||||
/*
|
||||
|
||||
/*
|
||||
#region Multitasking
|
||||
start = DateTime.Now;
|
||||
Checksum allChecksums = new Checksum();
|
||||
@@ -604,7 +605,7 @@ namespace DiscImageChef.Core
|
||||
results.TotalTime = (end - start).TotalSeconds;
|
||||
results.TotalSpeed = bufferSize / 1048576.0 / results.TotalTime;
|
||||
#endregion
|
||||
*/
|
||||
*/
|
||||
results.SeparateSpeed = bufferSize / 1048576.0 / results.SeparateTime;
|
||||
|
||||
return results;
|
||||
|
||||
@@ -54,7 +54,8 @@ namespace DiscImageChef.Core
|
||||
SpamSum = 1024,
|
||||
Fletcher16 = 2048,
|
||||
Fletcher32 = 4096,
|
||||
All = Adler32 | Crc16 | Crc32 | Crc64 | Md5 | Ripemd160 | Sha1 | Sha256 | Sha384 | Sha512 | SpamSum | Fletcher16 | Fletcher32
|
||||
All = Adler32 | Crc16 | Crc32 | Crc64 | Md5 | Ripemd160 | Sha1 | Sha256 | Sha384 | Sha512 | SpamSum |
|
||||
Fletcher16 | Fletcher32
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -75,6 +76,12 @@ namespace DiscImageChef.Core
|
||||
HashPacket crc64Pkt;
|
||||
Thread crc64Thread;
|
||||
EnableChecksum enabled;
|
||||
IChecksum f16Ctx;
|
||||
HashPacket f16Pkt;
|
||||
Thread f16Thread;
|
||||
IChecksum f32Ctx;
|
||||
HashPacket f32Pkt;
|
||||
Thread f32Thread;
|
||||
IChecksum md5Ctx;
|
||||
HashPacket md5Pkt;
|
||||
Thread md5Thread;
|
||||
@@ -96,12 +103,6 @@ namespace DiscImageChef.Core
|
||||
HashPacket spamsumPkt;
|
||||
Thread spamsumThread;
|
||||
IChecksum ssctx;
|
||||
HashPacket f16Pkt;
|
||||
Thread f16Thread;
|
||||
IChecksum f16Ctx;
|
||||
HashPacket f32Pkt;
|
||||
Thread f32Thread;
|
||||
IChecksum f32Ctx;
|
||||
|
||||
public Checksum(EnableChecksum enabled = EnableChecksum.All)
|
||||
{
|
||||
@@ -196,8 +197,8 @@ namespace DiscImageChef.Core
|
||||
sha384Thread = new Thread(UpdateHash);
|
||||
sha512Thread = new Thread(UpdateHash);
|
||||
spamsumThread = new Thread(UpdateHash);
|
||||
f16Thread = new Thread(UpdateHash);
|
||||
f32Thread = new Thread(UpdateHash);
|
||||
f16Thread = new Thread(UpdateHash);
|
||||
f32Thread = new Thread(UpdateHash);
|
||||
}
|
||||
|
||||
public void Update(byte[] data)
|
||||
@@ -280,9 +281,10 @@ namespace DiscImageChef.Core
|
||||
f32Thread.Start(f32Pkt);
|
||||
}
|
||||
|
||||
while(adlerThread.IsAlive || crc16Thread.IsAlive || crc32Thread.IsAlive || crc64Thread.IsAlive ||
|
||||
md5Thread.IsAlive || ripemd160Thread.IsAlive || sha1Thread.IsAlive || sha256Thread.IsAlive ||
|
||||
sha384Thread.IsAlive || sha512Thread.IsAlive || spamsumThread.IsAlive || f16Thread.IsAlive || f32Thread.IsAlive) { }
|
||||
while(adlerThread.IsAlive || crc16Thread.IsAlive || crc32Thread.IsAlive || crc64Thread.IsAlive ||
|
||||
md5Thread.IsAlive || ripemd160Thread.IsAlive || sha1Thread.IsAlive || sha256Thread.IsAlive ||
|
||||
sha384Thread.IsAlive || sha512Thread.IsAlive || spamsumThread.IsAlive || f16Thread.IsAlive ||
|
||||
f32Thread.IsAlive) { }
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.SpamSum)) adlerThread = new Thread(UpdateHash);
|
||||
if(enabled.HasFlag(EnableChecksum.SpamSum)) crc16Thread = new Thread(UpdateHash);
|
||||
@@ -295,8 +297,8 @@ namespace DiscImageChef.Core
|
||||
if(enabled.HasFlag(EnableChecksum.SpamSum)) sha384Thread = new Thread(UpdateHash);
|
||||
if(enabled.HasFlag(EnableChecksum.SpamSum)) sha512Thread = new Thread(UpdateHash);
|
||||
if(enabled.HasFlag(EnableChecksum.SpamSum)) spamsumThread = new Thread(UpdateHash);
|
||||
if(enabled.HasFlag(EnableChecksum.SpamSum)) f16Thread = new Thread(UpdateHash);
|
||||
if(enabled.HasFlag(EnableChecksum.SpamSum)) f32Thread = new Thread(UpdateHash);
|
||||
if(enabled.HasFlag(EnableChecksum.SpamSum)) f16Thread = new Thread(UpdateHash);
|
||||
if(enabled.HasFlag(EnableChecksum.SpamSum)) f32Thread = new Thread(UpdateHash);
|
||||
}
|
||||
|
||||
public List<ChecksumType> End()
|
||||
@@ -398,8 +400,8 @@ namespace DiscImageChef.Core
|
||||
IChecksum sha384CtxData = null;
|
||||
IChecksum sha512CtxData = null;
|
||||
IChecksum ssctxData = null;
|
||||
IChecksum f16CtxData = null;
|
||||
IChecksum f32CtxData = null;
|
||||
IChecksum f16CtxData = null;
|
||||
IChecksum f32CtxData = null;
|
||||
|
||||
Thread adlerThreadData = new Thread(UpdateHash);
|
||||
Thread crc16ThreadData = new Thread(UpdateHash);
|
||||
@@ -412,104 +414,105 @@ namespace DiscImageChef.Core
|
||||
Thread sha384ThreadData = new Thread(UpdateHash);
|
||||
Thread sha512ThreadData = new Thread(UpdateHash);
|
||||
Thread spamsumThreadData = new Thread(UpdateHash);
|
||||
Thread f16ThreadData = new Thread(UpdateHash);
|
||||
Thread f32ThreadData = new Thread(UpdateHash);
|
||||
Thread f16ThreadData = new Thread(UpdateHash);
|
||||
Thread f32ThreadData = new Thread(UpdateHash);
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.SpamSum))
|
||||
{
|
||||
adler32CtxData = new Adler32Context();
|
||||
adler32CtxData = new Adler32Context();
|
||||
HashPacket adlerPktData = new HashPacket {Context = adler32CtxData, Data = data};
|
||||
adlerThreadData.Start(adlerPktData);
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.SpamSum))
|
||||
{
|
||||
crc16CtxData = new Crc16Context();
|
||||
crc16CtxData = new Crc16Context();
|
||||
HashPacket crc16PktData = new HashPacket {Context = crc16CtxData, Data = data};
|
||||
crc16ThreadData.Start(crc16PktData);
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.SpamSum))
|
||||
{
|
||||
crc32CtxData = new Crc32Context();
|
||||
crc32CtxData = new Crc32Context();
|
||||
HashPacket crc32PktData = new HashPacket {Context = crc32CtxData, Data = data};
|
||||
crc32ThreadData.Start(crc32PktData);
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.SpamSum))
|
||||
{
|
||||
crc64CtxData = new Crc64Context();
|
||||
crc64CtxData = new Crc64Context();
|
||||
HashPacket crc64PktData = new HashPacket {Context = crc64CtxData, Data = data};
|
||||
crc64ThreadData.Start(crc64PktData);
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.SpamSum))
|
||||
{
|
||||
md5CtxData = new Md5Context();
|
||||
md5CtxData = new Md5Context();
|
||||
HashPacket md5PktData = new HashPacket {Context = md5CtxData, Data = data};
|
||||
md5ThreadData.Start(md5PktData);
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.SpamSum))
|
||||
{
|
||||
ripemd160CtxData = new Ripemd160Context();
|
||||
ripemd160CtxData = new Ripemd160Context();
|
||||
HashPacket ripemd160PktData = new HashPacket {Context = ripemd160CtxData, Data = data};
|
||||
ripemd160ThreadData.Start(ripemd160PktData);
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.SpamSum))
|
||||
{
|
||||
sha1CtxData = new Sha1Context();
|
||||
sha1CtxData = new Sha1Context();
|
||||
HashPacket sha1PktData = new HashPacket {Context = sha1CtxData, Data = data};
|
||||
sha1ThreadData.Start(sha1PktData);
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.SpamSum))
|
||||
{
|
||||
sha256CtxData = new Sha256Context();
|
||||
sha256CtxData = new Sha256Context();
|
||||
HashPacket sha256PktData = new HashPacket {Context = sha256CtxData, Data = data};
|
||||
sha256ThreadData.Start(sha256PktData);
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.SpamSum))
|
||||
{
|
||||
sha384CtxData = new Sha384Context();
|
||||
sha384CtxData = new Sha384Context();
|
||||
HashPacket sha384PktData = new HashPacket {Context = sha384CtxData, Data = data};
|
||||
sha384ThreadData.Start(sha384PktData);
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.SpamSum))
|
||||
{
|
||||
sha512CtxData = new Sha512Context();
|
||||
sha512CtxData = new Sha512Context();
|
||||
HashPacket sha512PktData = new HashPacket {Context = sha512CtxData, Data = data};
|
||||
sha512ThreadData.Start(sha512PktData);
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.SpamSum))
|
||||
{
|
||||
ssctxData = new SpamSumContext();
|
||||
ssctxData = new SpamSumContext();
|
||||
HashPacket spamsumPktData = new HashPacket {Context = ssctxData, Data = data};
|
||||
spamsumThreadData.Start(spamsumPktData);
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.Fletcher16))
|
||||
{
|
||||
f16CtxData = new Fletcher16Context();
|
||||
f16CtxData = new Fletcher16Context();
|
||||
HashPacket f16PktData = new HashPacket {Context = f16CtxData, Data = data};
|
||||
f16ThreadData.Start(f16PktData);
|
||||
}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.Fletcher32))
|
||||
{
|
||||
f32CtxData = new Fletcher32Context();
|
||||
f32CtxData = new Fletcher32Context();
|
||||
HashPacket f32PktData = new HashPacket {Context = f32CtxData, Data = data};
|
||||
f32ThreadData.Start(f32PktData);
|
||||
}
|
||||
|
||||
while(adlerThreadData.IsAlive || crc16ThreadData.IsAlive || crc32ThreadData.IsAlive ||
|
||||
crc64ThreadData.IsAlive || md5ThreadData.IsAlive || ripemd160ThreadData.IsAlive ||
|
||||
sha1ThreadData.IsAlive || sha256ThreadData.IsAlive || sha384ThreadData.IsAlive ||
|
||||
sha512ThreadData.IsAlive || spamsumThreadData.IsAlive || f16ThreadData.IsAlive || f32ThreadData.IsAlive) { }
|
||||
|
||||
while(adlerThreadData.IsAlive || crc16ThreadData.IsAlive || crc32ThreadData.IsAlive ||
|
||||
crc64ThreadData.IsAlive || md5ThreadData.IsAlive || ripemd160ThreadData.IsAlive ||
|
||||
sha1ThreadData.IsAlive || sha256ThreadData.IsAlive || sha384ThreadData.IsAlive ||
|
||||
sha512ThreadData.IsAlive || spamsumThreadData.IsAlive || f16ThreadData.IsAlive ||
|
||||
f32ThreadData.IsAlive) { }
|
||||
|
||||
List<ChecksumType> dataChecksums = new List<ChecksumType>();
|
||||
ChecksumType chk;
|
||||
|
||||
@@ -180,12 +180,13 @@ namespace DiscImageChef.Core
|
||||
/// <param name="whatWriting">What is the data about?</param>
|
||||
/// <param name="overwrite">If set to <c>true</c> overwrites the file, does nothing otherwise</param>
|
||||
public static void WriteTo(string who, string filename, byte[] data, string whatWriting = null,
|
||||
bool overwrite = false)
|
||||
bool overwrite = false)
|
||||
{
|
||||
if(string.IsNullOrEmpty(filename)) return;
|
||||
|
||||
if(File.Exists(filename))
|
||||
if(overwrite) File.Delete(filename);
|
||||
if(overwrite)
|
||||
File.Delete(filename);
|
||||
else
|
||||
{
|
||||
DicConsole.ErrorWriteLine("Not overwriting file {0}", filename);
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace DiscImageChef.Core
|
||||
/// Updates two progress indicators with text
|
||||
/// </summary>
|
||||
public delegate void UpdateTwoProgressHandler(string text, long current, long maximum, string text2, long current2,
|
||||
long maximum2);
|
||||
long maximum2);
|
||||
|
||||
/// <summary>
|
||||
/// Pulses a progress indicator with indeterminate boundaries
|
||||
|
||||
@@ -814,9 +814,9 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
// If a subchannel is supported, check if output plugin allows us to write it.
|
||||
if(supportedSubchannel != MmcSubchannel.None)
|
||||
{
|
||||
dev.ReadCd(out readBuffer, out senseBuf, 0, blockSize, 1, MmcSectorTypes.AllTypes, false, false,
|
||||
true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, supportedSubchannel,
|
||||
dev.Timeout, out _);
|
||||
dev.ReadCd(out readBuffer, out senseBuf, 0, blockSize, 1, MmcSectorTypes.AllTypes, false, false, true,
|
||||
MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, supportedSubchannel, dev.Timeout,
|
||||
out _);
|
||||
|
||||
byte[] tmpBuf = new byte[subSize];
|
||||
Array.Copy(readBuffer, SECTOR_SIZE, tmpBuf, 0, subSize);
|
||||
@@ -1031,14 +1031,11 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
DicConsole.Write("\rTrimming sector {0}", badSector);
|
||||
|
||||
double cmdDuration = 0;
|
||||
|
||||
|
||||
if(readcd)
|
||||
{
|
||||
sense = dev.ReadCd(out readBuffer, out senseBuf, (uint)badSector, blockSize, 1,
|
||||
MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true,
|
||||
true, MmcErrorField.None, supportedSubchannel, dev.Timeout,
|
||||
out cmdDuration);
|
||||
}
|
||||
true, MmcErrorField.None, supportedSubchannel, dev.Timeout, out cmdDuration);
|
||||
else if(read16)
|
||||
sense = dev.Read16(out readBuffer, out senseBuf, 0, false, true, false, badSector, blockSize, 0,
|
||||
blocksToRead, false, dev.Timeout, out cmdDuration);
|
||||
|
||||
@@ -203,7 +203,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
}
|
||||
|
||||
Reader scsiReader = new Reader(dev, dev.Timeout, null, dumpRaw);
|
||||
ulong blocks = scsiReader.GetDeviceBlocks();
|
||||
ulong blocks = scsiReader.GetDeviceBlocks();
|
||||
dumpLog.WriteLine("Device reports disc has {0} blocks", blocks);
|
||||
Dictionary<MediaTagType, byte[]> mediaTags = new Dictionary<MediaTagType, byte[]>();
|
||||
|
||||
|
||||
@@ -43,14 +43,15 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
{
|
||||
public static class NvMe
|
||||
{
|
||||
public static void Dump(Device dev, string devicePath, IWritableImage outputPlugin, ushort retryPasses,
|
||||
bool force, bool dumpRaw, bool persistent, bool stopOnError,
|
||||
ref Resume resume,
|
||||
ref
|
||||
DumpLog dumpLog, Encoding encoding, string outputPrefix,
|
||||
string outputPath,
|
||||
Dictionary<string, string>
|
||||
formatOptions, CICMMetadataType preSidecar, uint skip, bool nometadata, bool notrim)
|
||||
public static void Dump(Device dev, string devicePath,
|
||||
IWritableImage outputPlugin, ushort retryPasses,
|
||||
bool force, bool dumpRaw,
|
||||
bool persistent, bool stopOnError, ref Resume resume,
|
||||
ref DumpLog dumpLog, Encoding encoding,
|
||||
string outputPrefix, string outputPath,
|
||||
Dictionary<string, string> formatOptions, CICMMetadataType preSidecar,
|
||||
uint skip,
|
||||
bool nometadata, bool notrim)
|
||||
{
|
||||
throw new NotImplementedException("NVMe devices not yet supported.");
|
||||
}
|
||||
|
||||
@@ -63,11 +63,10 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
/// If the provided resume does not correspond with the current in
|
||||
/// progress dump
|
||||
/// </exception>
|
||||
internal static void Process(bool isLba, bool removable, ulong blocks,
|
||||
string manufacturer, string model,
|
||||
string serial, PlatformID platform, ref Resume resume,
|
||||
ref DumpHardwareType currentTry,
|
||||
ref ExtentsULong extents)
|
||||
internal static void Process(bool isLba, bool removable, ulong blocks,
|
||||
string manufacturer, string model,
|
||||
string serial, PlatformID platform, ref Resume resume,
|
||||
ref DumpHardwareType currentTry, ref ExtentsULong extents)
|
||||
{
|
||||
if(resume != null)
|
||||
{
|
||||
|
||||
@@ -107,8 +107,8 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
|
||||
dumpLog.WriteLine("Initializing reader.");
|
||||
Reader scsiReader = new Reader(dev, dev.Timeout, null, dumpRaw);
|
||||
ulong blocks = scsiReader.GetDeviceBlocks();
|
||||
uint blockSize = scsiReader.LogicalBlockSize;
|
||||
ulong blocks = scsiReader.GetDeviceBlocks();
|
||||
uint blockSize = scsiReader.LogicalBlockSize;
|
||||
if(scsiReader.FindReadCommand())
|
||||
{
|
||||
dumpLog.WriteLine("ERROR: Cannot find correct read command: {0}.", scsiReader.ErrorMessage);
|
||||
@@ -131,8 +131,8 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
return;
|
||||
}
|
||||
|
||||
uint blocksToRead = scsiReader.BlocksToRead;
|
||||
uint logicalBlockSize = blockSize;
|
||||
uint blocksToRead = scsiReader.BlocksToRead;
|
||||
uint logicalBlockSize = blockSize;
|
||||
uint physicalBlockSize = scsiReader.PhysicalBlockSize;
|
||||
|
||||
if(blocks == 0)
|
||||
@@ -460,45 +460,39 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
if(persistent)
|
||||
{
|
||||
Modes.ModePage_01_MMC pgMmc;
|
||||
Modes.ModePage_01 pg;
|
||||
|
||||
Modes.ModePage_01 pg;
|
||||
|
||||
sense = dev.ModeSense6(out readBuffer, out _, false, ScsiModeSensePageControl.Current, 0x01,
|
||||
dev.Timeout, out _);
|
||||
if(sense)
|
||||
{
|
||||
sense = dev.ModeSense10(out readBuffer, out _, false, ScsiModeSensePageControl.Current,
|
||||
0x01, dev.Timeout, out _);
|
||||
sense = dev.ModeSense10(out readBuffer, out _, false, ScsiModeSensePageControl.Current, 0x01,
|
||||
dev.Timeout, out _);
|
||||
|
||||
if(!sense)
|
||||
{
|
||||
Modes.DecodedMode? dcMode10 =
|
||||
Modes.DecodeMode10(readBuffer, dev.ScsiType);
|
||||
|
||||
Modes.DecodedMode? dcMode10 = Modes.DecodeMode10(readBuffer, dev.ScsiType);
|
||||
|
||||
if(dcMode10.HasValue)
|
||||
{
|
||||
foreach(Modes.ModePage modePage in dcMode10.Value.Pages)
|
||||
if(modePage.Page == 0x01 && modePage.Subpage == 0x00) currentModePage = modePage;
|
||||
}
|
||||
if(modePage.Page == 0x01 && modePage.Subpage == 0x00)
|
||||
currentModePage = modePage;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Modes.DecodedMode? dcMode6 =
|
||||
Modes.DecodeMode6(readBuffer, dev.ScsiType);
|
||||
Modes.DecodedMode? dcMode6 = Modes.DecodeMode6(readBuffer, dev.ScsiType);
|
||||
|
||||
if(dcMode6.HasValue)
|
||||
{
|
||||
foreach(Modes.ModePage modePage in dcMode6.Value.Pages)
|
||||
if(modePage.Page == 0x01 && modePage.Subpage == 0x00)
|
||||
currentModePage = modePage;
|
||||
}
|
||||
}
|
||||
|
||||
if(currentModePage == null)
|
||||
{
|
||||
if(dev.ScsiType == PeripheralDeviceTypes.MultiMediaDevice)
|
||||
{
|
||||
|
||||
pgMmc = new Modes.ModePage_01_MMC {PS = false, ReadRetryCount = 32, Parameter = 0x00};
|
||||
currentModePage = new Modes.ModePage
|
||||
{
|
||||
@@ -522,21 +516,19 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
DCR = false,
|
||||
ReadRetryCount = 32
|
||||
};
|
||||
|
||||
currentModePage =
|
||||
new Modes.ModePage
|
||||
{
|
||||
Page = 0x01,
|
||||
Subpage = 0x00,
|
||||
PageResponse = Modes.EncodeModePage_01(pg)
|
||||
} ;
|
||||
|
||||
currentModePage = new Modes.ModePage
|
||||
{
|
||||
Page = 0x01,
|
||||
Subpage = 0x00,
|
||||
PageResponse = Modes.EncodeModePage_01(pg)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if(dev.ScsiType == PeripheralDeviceTypes.MultiMediaDevice)
|
||||
{
|
||||
pgMmc =
|
||||
new Modes.ModePage_01_MMC {PS = false, ReadRetryCount = 255, Parameter = 0x20};
|
||||
pgMmc = new Modes.ModePage_01_MMC {PS = false, ReadRetryCount = 255, Parameter = 0x20};
|
||||
Modes.DecodedMode md = new Modes.DecodedMode
|
||||
{
|
||||
Header = new Modes.ModeHeader(),
|
||||
|
||||
@@ -58,9 +58,9 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
/// <param name="outputPrefix">Prefix for output data files</param>
|
||||
/// <param name="resume">Information for dump resuming</param>
|
||||
/// <param name="dumpLog">Dump logger</param>
|
||||
internal static void Dump(Device dev, string outputPrefix, string devicePath, ref Resume resume,
|
||||
ref DumpLog dumpLog,
|
||||
CICMMetadataType preSidecar)
|
||||
internal static void Dump(Device dev, string outputPrefix, string devicePath,
|
||||
ref Resume resume,
|
||||
ref DumpLog dumpLog, CICMMetadataType preSidecar)
|
||||
{
|
||||
FixedSense? fxSense;
|
||||
bool aborted;
|
||||
@@ -107,13 +107,13 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
fxSense = Sense.DecodeFixed(senseBuf, out strSense);
|
||||
}
|
||||
while(fxSense.HasValue && fxSense.Value.ASC == 0x00 &&
|
||||
(fxSense.Value.ASCQ == 0x1A || fxSense.Value.ASCQ != 0x04));
|
||||
(fxSense.Value.ASCQ == 0x1A || fxSense.Value.ASCQ != 0x04));
|
||||
|
||||
dev.RequestSense(out senseBuf, dev.Timeout, out duration);
|
||||
fxSense = Sense.DecodeFixed(senseBuf, out strSense);
|
||||
|
||||
// And yet, did not rewind!
|
||||
if(fxSense.HasValue &&
|
||||
if(fxSense.HasValue &&
|
||||
(fxSense.Value.ASC == 0x00 && fxSense.Value.ASCQ != 0x04 || fxSense.Value.ASC != 0x00))
|
||||
{
|
||||
DicConsole.WriteLine();
|
||||
@@ -138,7 +138,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
// Anyway, <=SCSI-1 tapes do not support partitions
|
||||
fxSense = Sense.DecodeFixed(senseBuf, out strSense);
|
||||
|
||||
if(fxSense.HasValue && (fxSense.Value.ASC == 0x20 && fxSense.Value.ASCQ != 0x00 ||
|
||||
if(fxSense.HasValue && (fxSense.Value.ASC == 0x20 && fxSense.Value.ASCQ != 0x00 ||
|
||||
fxSense.Value.ASC != 0x20 &&
|
||||
fxSense.Value.SenseKey != SenseKeys.IllegalRequest))
|
||||
{
|
||||
@@ -180,7 +180,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
fxSense = Sense.DecodeFixed(senseBuf, out strSense);
|
||||
}
|
||||
while(fxSense.HasValue && fxSense.Value.ASC == 0x00 &&
|
||||
(fxSense.Value.ASCQ == 0x1A || fxSense.Value.ASCQ == 0x19));
|
||||
(fxSense.Value.ASCQ == 0x1A || fxSense.Value.ASCQ == 0x19));
|
||||
|
||||
// And yet, did not rewind!
|
||||
if(fxSense.HasValue && (fxSense.Value.ASC == 0x00 && fxSense.Value.ASCQ != 0x04 ||
|
||||
@@ -220,8 +220,8 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
}
|
||||
}
|
||||
|
||||
sidecar.BlockMedia = new BlockMediaType[1];
|
||||
sidecar.BlockMedia[0] = new BlockMediaType {SCSI = new SCSIType()};
|
||||
sidecar.BlockMedia = new BlockMediaType[1];
|
||||
sidecar.BlockMedia[0] = new BlockMediaType {SCSI = new SCSIType()};
|
||||
byte scsiMediumTypeTape = 0;
|
||||
byte scsiDensityCodeTape = 0;
|
||||
|
||||
@@ -237,7 +237,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
if(!sense && !dev.Error)
|
||||
if(Modes.DecodeMode10(cmdBuf, dev.ScsiType).HasValue)
|
||||
{
|
||||
decMode = Modes.DecodeMode10(cmdBuf, dev.ScsiType);
|
||||
decMode = Modes.DecodeMode10(cmdBuf, dev.ScsiType);
|
||||
sidecar.BlockMedia[0].SCSI.ModeSense10 = new DumpType
|
||||
{
|
||||
Image = outputPrefix + ".modesense10.bin",
|
||||
@@ -258,7 +258,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
if(!sense && !dev.Error)
|
||||
if(Modes.DecodeMode6(cmdBuf, dev.ScsiType).HasValue)
|
||||
{
|
||||
decMode = Modes.DecodeMode6(cmdBuf, dev.ScsiType);
|
||||
decMode = Modes.DecodeMode6(cmdBuf, dev.ScsiType);
|
||||
sidecar.BlockMedia[0].SCSI.ModeSense = new DumpType
|
||||
{
|
||||
Image = outputPrefix + ".modesense.bin",
|
||||
@@ -274,7 +274,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
scsiMediumTypeTape = (byte)decMode.Value.Header.MediumType;
|
||||
if(decMode.Value.Header.BlockDescriptors != null && decMode.Value.Header.BlockDescriptors.Length >= 1)
|
||||
scsiDensityCodeTape = (byte)decMode.Value.Header.BlockDescriptors[0].Density;
|
||||
blockSize = decMode.Value.Header.BlockDescriptors[0].BlockLength;
|
||||
blockSize = decMode.Value.Header.BlockDescriptors[0].BlockLength;
|
||||
dumpLog.WriteLine("Device reports {0} blocks ({1} bytes).", blocks, blocks * blockSize);
|
||||
}
|
||||
else blockSize = 1;
|
||||
@@ -328,8 +328,8 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
|
||||
fixedLen = true;
|
||||
transferLen = 1;
|
||||
sense = dev.Read6(out cmdBuf, out senseBuf, false, fixedLen, transferLen, blockSize,
|
||||
dev.Timeout, out duration);
|
||||
sense = dev.Read6(out cmdBuf, out senseBuf, false, fixedLen, transferLen, blockSize,
|
||||
dev.Timeout, out duration);
|
||||
if(sense)
|
||||
{
|
||||
DicConsole.WriteLine();
|
||||
@@ -382,9 +382,9 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
DicConsole.WriteLine();
|
||||
DataFile dumpFile = new DataFile(outputPrefix + ".bin");
|
||||
Checksum dataChk = new Checksum();
|
||||
start = DateTime.UtcNow;
|
||||
MhddLog mhddLog = new MhddLog(outputPrefix + ".mhddlog.bin", dev, blocks, blockSize, 1);
|
||||
IbgLog ibgLog = new IbgLog(outputPrefix + ".ibg", 0x0008);
|
||||
start = DateTime.UtcNow;
|
||||
MhddLog mhddLog = new MhddLog(outputPrefix + ".mhddlog.bin", dev, blocks, blockSize, 1);
|
||||
IbgLog ibgLog = new IbgLog(outputPrefix + ".ibg", 0x0008);
|
||||
|
||||
TapeFileType currentTapeFile = new TapeFileType
|
||||
{
|
||||
@@ -399,7 +399,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
StartBlock = (long)currentBlock,
|
||||
BlockSize = blockSize
|
||||
};
|
||||
Checksum fileChk = new Checksum();
|
||||
Checksum fileChk = new Checksum();
|
||||
TapePartitionType currentTapePartition = new TapePartitionType
|
||||
{
|
||||
Image = new ImageType
|
||||
@@ -454,9 +454,9 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
StartBlock = (long)currentBlock,
|
||||
BlockSize = blockSize
|
||||
};
|
||||
currentFileSize = 0;
|
||||
fileChk = new Checksum();
|
||||
files = new List<TapeFileType>();
|
||||
currentFileSize = 0;
|
||||
fileChk = new Checksum();
|
||||
files = new List<TapeFileType>();
|
||||
currentTapePartition = new TapePartitionType
|
||||
{
|
||||
Image = new ImageType
|
||||
@@ -524,37 +524,33 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
continue;
|
||||
}
|
||||
|
||||
if(fxSense.Value.SenseKey == SenseKeys.BlankCheck)
|
||||
switch(fxSense.Value.SenseKey)
|
||||
{
|
||||
if(currentBlock == 0)
|
||||
{
|
||||
case SenseKeys.BlankCheck when currentBlock == 0:
|
||||
DicConsole.WriteLine();
|
||||
DicConsole.ErrorWriteLine("Cannot dump a blank tape...");
|
||||
dumpFile.Close();
|
||||
dumpLog.WriteLine("Cannot dump a blank tape...");
|
||||
return;
|
||||
}
|
||||
|
||||
// For sure this is an end-of-tape/partition
|
||||
if(fxSense.Value.ASC == 0x00 &&
|
||||
(fxSense.Value.ASCQ == 0x02 || fxSense.Value.ASCQ == 0x05 || fxSense.Value.EOM))
|
||||
{
|
||||
case SenseKeys.BlankCheck when fxSense.Value.ASC == 0x00 &&
|
||||
(fxSense.Value.ASCQ == 0x02 || fxSense.Value.ASCQ == 0x05 ||
|
||||
fxSense.Value.EOM):
|
||||
// TODO: Detect end of partition
|
||||
endOfMedia = true;
|
||||
dumpLog.WriteLine("Found end-of-tape/partition...");
|
||||
continue;
|
||||
}
|
||||
|
||||
DicConsole.WriteLine();
|
||||
DicConsole.WriteLine("Blank block found, end of tape?");
|
||||
endOfMedia = true;
|
||||
dumpLog.WriteLine("Blank block found, end of tape?...");
|
||||
continue;
|
||||
case SenseKeys.BlankCheck:
|
||||
DicConsole.WriteLine();
|
||||
DicConsole.WriteLine("Blank block found, end of tape?");
|
||||
endOfMedia = true;
|
||||
dumpLog.WriteLine("Blank block found, end of tape?...");
|
||||
continue;
|
||||
}
|
||||
|
||||
if((fxSense.Value.SenseKey == SenseKeys.NoSense ||
|
||||
fxSense.Value.SenseKey == SenseKeys.RecoveredError) &&
|
||||
(fxSense.Value.ASCQ == 0x02 || fxSense.Value.ASCQ == 0x05 || fxSense.Value.EOM))
|
||||
(fxSense.Value.ASCQ == 0x02 || fxSense.Value.ASCQ == 0x05 || fxSense.Value.EOM))
|
||||
{
|
||||
// TODO: Detect end of partition
|
||||
endOfMedia = true;
|
||||
@@ -564,7 +560,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
|
||||
if((fxSense.Value.SenseKey == SenseKeys.NoSense ||
|
||||
fxSense.Value.SenseKey == SenseKeys.RecoveredError) &&
|
||||
(fxSense.Value.ASCQ == 0x01 || fxSense.Value.Filemark))
|
||||
(fxSense.Value.ASCQ == 0x01 || fxSense.Value.Filemark))
|
||||
{
|
||||
currentTapeFile.Checksums = fileChk.End().ToArray();
|
||||
currentTapeFile.EndBlock = (long)(currentBlock - 1);
|
||||
@@ -614,7 +610,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
partitionChk.Update(cmdBuf);
|
||||
DateTime chkEnd = DateTime.UtcNow;
|
||||
double chkDuration = (chkEnd - chkStart).TotalMilliseconds;
|
||||
totalChkDuration += chkDuration;
|
||||
totalChkDuration += chkDuration;
|
||||
|
||||
if(currentBlock % 10 == 0)
|
||||
{
|
||||
@@ -633,10 +629,9 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
end = DateTime.UtcNow;
|
||||
mhddLog.Close();
|
||||
ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
|
||||
blockSize * (double)(blocks + 1) /
|
||||
1024 / (totalDuration / 1000), devicePath);
|
||||
dumpLog.WriteLine("Dump finished in {0} seconds.",
|
||||
(end - start).TotalSeconds);
|
||||
blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000),
|
||||
devicePath);
|
||||
dumpLog.WriteLine("Dump finished in {0} seconds.", (end - start).TotalSeconds);
|
||||
dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.",
|
||||
(double)blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000));
|
||||
dumpLog.WriteLine("Average checksum speed {0:F3} KiB/sec.",
|
||||
@@ -660,13 +655,13 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
format = "Raw disk image (sector by sector copy)",
|
||||
Value = outputPrefix + ".bin"
|
||||
};
|
||||
sidecar.BlockMedia[0].LogicalBlocks = (long)blocks;
|
||||
sidecar.BlockMedia[0].Size = (long)currentSize;
|
||||
sidecar.BlockMedia[0].DumpHardwareArray = new DumpHardwareType[1];
|
||||
sidecar.BlockMedia[0].DumpHardwareArray[0] =
|
||||
new DumpHardwareType {Extents = new ExtentType[1]};
|
||||
sidecar.BlockMedia[0].DumpHardwareArray[0].Extents[0] =
|
||||
new ExtentType {Start = 0, End = blocks - 1};
|
||||
sidecar.BlockMedia[0].LogicalBlocks = (long)blocks;
|
||||
sidecar.BlockMedia[0].Size = (long)currentSize;
|
||||
sidecar.BlockMedia[0].DumpHardwareArray = new DumpHardwareType[1];
|
||||
sidecar.BlockMedia[0].DumpHardwareArray[0] =
|
||||
new DumpHardwareType {Extents = new ExtentType[1]};
|
||||
sidecar.BlockMedia[0].DumpHardwareArray[0].Extents[0] =
|
||||
new ExtentType {Start = 0, End = blocks - 1};
|
||||
sidecar.BlockMedia[0].DumpHardwareArray[0].Manufacturer = dev.Manufacturer;
|
||||
sidecar.BlockMedia[0].DumpHardwareArray[0].Model = dev.Model;
|
||||
sidecar.BlockMedia[0].DumpHardwareArray[0].Revision = dev.Revision;
|
||||
|
||||
@@ -149,7 +149,8 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
return;
|
||||
}
|
||||
|
||||
ulong totalSize = (ulong)((readBuffer[0] << 24) + (readBuffer[1] << 16) + (readBuffer[2] << 8) + readBuffer[3]);
|
||||
ulong 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,
|
||||
MmcDiscStructureFormat.PhysicalInformation, 0, 0, out _);
|
||||
@@ -164,7 +165,8 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
Array.Copy(readBuffer, 4, tmpBuf, 0, readBuffer.Length - 4);
|
||||
mediaTags.Add(MediaTagType.DVD_PFI, tmpBuf);
|
||||
DicConsole.DebugWriteLine("Dump-media command", "Video partition total size: {0} sectors", totalSize);
|
||||
ulong l0Video = PFI.Decode(readBuffer).Value.Layer0EndPSN - PFI.Decode(readBuffer).Value.DataAreaStartPSN + 1;
|
||||
ulong l0Video = PFI.Decode(readBuffer).Value.Layer0EndPSN - PFI.Decode(readBuffer).Value.DataAreaStartPSN +
|
||||
1;
|
||||
ulong l1Video = totalSize - l0Video + 1;
|
||||
dumpLog.WriteLine("Reading Disc Manufacturing Information.");
|
||||
sense = dev.ReadDiscStructure(out readBuffer, out senseBuf, MmcDiscStructureMediaType.Dvd, 0, 0,
|
||||
@@ -200,8 +202,8 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
return;
|
||||
}
|
||||
|
||||
ulong gameSize = (ulong)((readBuffer[0] << 24) + (readBuffer[1] << 16) + (readBuffer[2] << 8) + readBuffer[3]) +
|
||||
1;
|
||||
ulong gameSize =
|
||||
(ulong)((readBuffer[0] << 24) + (readBuffer[1] << 16) + (readBuffer[2] << 8) + readBuffer[3]) + 1;
|
||||
DicConsole.DebugWriteLine("Dump-media command", "Game partition total size: {0} sectors", gameSize);
|
||||
|
||||
// Get middle zone size
|
||||
@@ -237,9 +239,10 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
|
||||
DicConsole.DebugWriteLine("Dump-media command", "Unlocked total size: {0} sectors", totalSize);
|
||||
ulong blocks = totalSize + 1;
|
||||
ulong middleZone = totalSize - (PFI.Decode(readBuffer).Value.Layer0EndPSN -
|
||||
PFI.Decode(readBuffer).Value.DataAreaStartPSN +
|
||||
1) - gameSize + 1;
|
||||
ulong middleZone =
|
||||
totalSize - (PFI.Decode(readBuffer).Value.Layer0EndPSN -
|
||||
PFI.Decode(readBuffer).Value.DataAreaStartPSN +
|
||||
1) - gameSize + 1;
|
||||
|
||||
tmpBuf = new byte[readBuffer.Length - 4];
|
||||
Array.Copy(readBuffer, 4, tmpBuf, 0, readBuffer.Length - 4);
|
||||
@@ -259,7 +262,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
Array.Copy(readBuffer, 4, tmpBuf, 0, readBuffer.Length - 4);
|
||||
mediaTags.Add(MediaTagType.Xbox_DMI, tmpBuf);
|
||||
|
||||
totalSize = l0Video + l1Video + middleZone * 2 + gameSize;
|
||||
totalSize = l0Video + l1Video + middleZone * 2 + gameSize;
|
||||
ulong layerBreak = l0Video + middleZone + gameSize / 2;
|
||||
|
||||
DicConsole.WriteLine("Video layer 0 size: {0} sectors", l0Video);
|
||||
@@ -705,24 +708,23 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
if(persistent)
|
||||
{
|
||||
Modes.ModePage_01_MMC pgMmc;
|
||||
|
||||
|
||||
sense = dev.ModeSense6(out readBuffer, out _, false, ScsiModeSensePageControl.Current, 0x01,
|
||||
dev.Timeout, out _);
|
||||
if(sense)
|
||||
{
|
||||
sense = dev.ModeSense10(out readBuffer, out _, false, ScsiModeSensePageControl.Current,
|
||||
0x01, dev.Timeout, out _);
|
||||
sense = dev.ModeSense10(out readBuffer, out _, false, ScsiModeSensePageControl.Current, 0x01,
|
||||
dev.Timeout, out _);
|
||||
|
||||
if(!sense)
|
||||
{
|
||||
Modes.DecodedMode? dcMode10 =
|
||||
Modes.DecodeMode10(readBuffer, PeripheralDeviceTypes.MultiMediaDevice);
|
||||
|
||||
|
||||
if(dcMode10.HasValue)
|
||||
{
|
||||
foreach(Modes.ModePage modePage in dcMode10.Value.Pages)
|
||||
if(modePage.Page == 0x01 && modePage.Subpage == 0x00) currentModePage = modePage;
|
||||
}
|
||||
if(modePage.Page == 0x01 && modePage.Subpage == 0x00)
|
||||
currentModePage = modePage;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -731,18 +733,14 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
Modes.DecodeMode6(readBuffer, PeripheralDeviceTypes.MultiMediaDevice);
|
||||
|
||||
if(dcMode6.HasValue)
|
||||
{
|
||||
foreach(Modes.ModePage modePage in dcMode6.Value.Pages)
|
||||
if(modePage.Page == 0x01 && modePage.Subpage == 0x00)
|
||||
currentModePage = modePage;
|
||||
}
|
||||
}
|
||||
|
||||
if(currentModePage == null)
|
||||
{
|
||||
|
||||
pgMmc =
|
||||
new Modes.ModePage_01_MMC {PS = false, ReadRetryCount = 0x20, Parameter = 0x00};
|
||||
pgMmc = new Modes.ModePage_01_MMC {PS = false, ReadRetryCount = 0x20, Parameter = 0x00};
|
||||
currentModePage = new Modes.ModePage
|
||||
{
|
||||
Page = 0x01,
|
||||
@@ -750,9 +748,8 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
PageResponse = Modes.EncodeModePage_01_MMC(pgMmc)
|
||||
};
|
||||
}
|
||||
|
||||
pgMmc =
|
||||
new Modes.ModePage_01_MMC {PS = false, ReadRetryCount = 255, Parameter = 0x20};
|
||||
|
||||
pgMmc = new Modes.ModePage_01_MMC {PS = false, ReadRetryCount = 255, Parameter = 0x20};
|
||||
Modes.DecodedMode md = new Modes.DecodedMode
|
||||
{
|
||||
Header = new Modes.ModeHeader(),
|
||||
@@ -782,7 +779,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
}
|
||||
else runningPersistent = true;
|
||||
}
|
||||
|
||||
|
||||
repeatRetry:
|
||||
ulong[] tmpArray = resume.BadBlocks.ToArray();
|
||||
foreach(ulong badSector in tmpArray)
|
||||
|
||||
@@ -42,34 +42,34 @@ namespace DiscImageChef.Core.Devices
|
||||
partial class Reader
|
||||
{
|
||||
Device dev;
|
||||
uint timeout;
|
||||
uint timeout;
|
||||
|
||||
internal Reader(Device dev, uint timeout, byte[] identification, bool raw = false)
|
||||
{
|
||||
this.dev = dev;
|
||||
this.dev = dev;
|
||||
this.timeout = timeout;
|
||||
BlocksToRead = 64;
|
||||
CanReadRaw = raw;
|
||||
CanReadRaw = raw;
|
||||
|
||||
switch(dev.Type)
|
||||
{
|
||||
case DeviceType.ATA:
|
||||
Identify.IdentifyDevice? ataIdNullable = Identify.Decode(identification);
|
||||
if(ataIdNullable.HasValue) ataId = ataIdNullable.Value;
|
||||
if(ataIdNullable.HasValue) ataId = ataIdNullable.Value;
|
||||
break;
|
||||
case DeviceType.NVMe: throw new NotImplementedException("NVMe devices not yet supported.");
|
||||
}
|
||||
}
|
||||
|
||||
internal string ErrorMessage { get; private set; }
|
||||
internal ulong Blocks { get; private set; }
|
||||
internal uint BlocksToRead { get; private set; }
|
||||
internal uint LogicalBlockSize { get; private set; }
|
||||
internal uint PhysicalBlockSize { get; private set; }
|
||||
internal uint LongBlockSize { get; private set; }
|
||||
internal bool CanReadRaw { get; private set; }
|
||||
internal bool CanSeek => ataSeek || seek6 || seek10;
|
||||
internal bool CanSeekLba => ataSeekLba || seek6 || seek10;
|
||||
internal string ErrorMessage { get; private set; }
|
||||
internal ulong Blocks { get; private set; }
|
||||
internal uint BlocksToRead { get; private set; }
|
||||
internal uint LogicalBlockSize { get; private set; }
|
||||
internal uint PhysicalBlockSize { get; private set; }
|
||||
internal uint LongBlockSize { get; private set; }
|
||||
internal bool CanReadRaw { get; private set; }
|
||||
internal bool CanSeek => ataSeek || seek6 || seek10;
|
||||
internal bool CanSeekLba => ataSeekLba || seek6 || seek10;
|
||||
|
||||
internal ulong GetDeviceBlocks()
|
||||
{
|
||||
@@ -141,7 +141,7 @@ namespace DiscImageChef.Core.Devices
|
||||
case DeviceType.ATAPI:
|
||||
case DeviceType.SCSI: return ScsiReadBlocks(out buffer, block, count, out duration);
|
||||
default:
|
||||
buffer = null;
|
||||
buffer = null;
|
||||
duration = 0d;
|
||||
return true;
|
||||
}
|
||||
@@ -153,7 +153,7 @@ namespace DiscImageChef.Core.Devices
|
||||
{
|
||||
case DeviceType.ATA: return AtaReadChs(out buffer, cylinder, head, sector, out duration);
|
||||
default:
|
||||
buffer = null;
|
||||
buffer = null;
|
||||
duration = 0d;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -40,23 +40,23 @@ namespace DiscImageChef.Core.Devices
|
||||
partial class Reader
|
||||
{
|
||||
Identify.IdentifyDevice ataId;
|
||||
bool ataRead;
|
||||
bool ataReadDma;
|
||||
bool ataReadDmaLba;
|
||||
bool ataReadDmaLba48;
|
||||
bool ataReadDmaRetry;
|
||||
bool ataReadDmaRetryLba;
|
||||
bool ataReadLba;
|
||||
bool ataReadLba48;
|
||||
bool ataReadRetry;
|
||||
bool ataReadRetryLba;
|
||||
bool ataSeek;
|
||||
bool ataSeekLba;
|
||||
bool ataRead;
|
||||
bool ataReadDma;
|
||||
bool ataReadDmaLba;
|
||||
bool ataReadDmaLba48;
|
||||
bool ataReadDmaRetry;
|
||||
bool ataReadDmaRetryLba;
|
||||
bool ataReadLba;
|
||||
bool ataReadLba48;
|
||||
bool ataReadRetry;
|
||||
bool ataReadRetryLba;
|
||||
bool ataSeek;
|
||||
bool ataSeekLba;
|
||||
|
||||
internal bool IsLba { get; private set; }
|
||||
internal bool IsLba { get; private set; }
|
||||
internal ushort Cylinders { get; private set; }
|
||||
internal byte Heads { get; private set; }
|
||||
internal byte Sectors { get; private set; }
|
||||
internal byte Heads { get; private set; }
|
||||
internal byte Sectors { get; private set; }
|
||||
|
||||
(uint, byte, byte) GetDeviceChs()
|
||||
{
|
||||
@@ -65,19 +65,20 @@ namespace DiscImageChef.Core.Devices
|
||||
if(ataId.CurrentCylinders > 0 && ataId.CurrentHeads > 0 && ataId.CurrentSectorsPerTrack > 0)
|
||||
{
|
||||
Cylinders = ataId.CurrentCylinders;
|
||||
Heads = (byte)ataId.CurrentHeads;
|
||||
Sectors = (byte)ataId.CurrentSectorsPerTrack;
|
||||
Blocks = (ulong)(Cylinders * Heads * Sectors);
|
||||
Heads = (byte)ataId.CurrentHeads;
|
||||
Sectors = (byte)ataId.CurrentSectorsPerTrack;
|
||||
Blocks = (ulong)(Cylinders * Heads * Sectors);
|
||||
}
|
||||
|
||||
if(ataId.CurrentCylinders != 0 && ataId.CurrentHeads != 0 && ataId.CurrentSectorsPerTrack != 0 ||
|
||||
ataId.Cylinders <= 0 || ataId.Heads <= 0 ||
|
||||
ataId.Cylinders <= 0 ||
|
||||
ataId.Heads <= 0 ||
|
||||
ataId.SectorsPerTrack <= 0) return (Cylinders, Heads, Sectors);
|
||||
|
||||
Cylinders = ataId.Cylinders;
|
||||
Heads = (byte)ataId.Heads;
|
||||
Sectors = (byte)ataId.SectorsPerTrack;
|
||||
Blocks = (ulong)(Cylinders * Heads * Sectors);
|
||||
Heads = (byte)ataId.Heads;
|
||||
Sectors = (byte)ataId.SectorsPerTrack;
|
||||
Blocks = (ulong)(Cylinders * Heads * Sectors);
|
||||
|
||||
return (Cylinders, Heads, Sectors);
|
||||
}
|
||||
@@ -89,13 +90,13 @@ namespace DiscImageChef.Core.Devices
|
||||
if(ataId.Capabilities.HasFlag(Identify.CapabilitiesBit.LBASupport))
|
||||
{
|
||||
Blocks = ataId.LBASectors;
|
||||
IsLba = true;
|
||||
IsLba = true;
|
||||
}
|
||||
|
||||
if(!ataId.CommandSet2.HasFlag(Identify.CommandSetBit2.LBA48)) return Blocks;
|
||||
|
||||
Blocks = ataId.LBA48Sectors;
|
||||
IsLba = true;
|
||||
IsLba = true;
|
||||
|
||||
return Blocks;
|
||||
}
|
||||
@@ -104,31 +105,31 @@ namespace DiscImageChef.Core.Devices
|
||||
{
|
||||
bool sense = dev.Read(out byte[] cmdBuf, out AtaErrorRegistersChs errorChs, false, 0, 0, 1, 1, timeout,
|
||||
out _);
|
||||
ataRead = !sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && cmdBuf.Length > 0;
|
||||
sense = dev.Read(out cmdBuf, out errorChs, true, 0, 0, 1, 1, timeout, out _);
|
||||
ataReadRetry = !sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && cmdBuf.Length > 0;
|
||||
sense = dev.ReadDma(out cmdBuf, out errorChs, false, 0, 0, 1, 1, timeout, out _);
|
||||
ataReadDma = !sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && cmdBuf.Length > 0;
|
||||
sense = dev.ReadDma(out cmdBuf, out errorChs, true, 0, 0, 1, 1, timeout, out _);
|
||||
ataRead = !sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && cmdBuf.Length > 0;
|
||||
sense = dev.Read(out cmdBuf, out errorChs, true, 0, 0, 1, 1, timeout, out _);
|
||||
ataReadRetry = !sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && cmdBuf.Length > 0;
|
||||
sense = dev.ReadDma(out cmdBuf, out errorChs, false, 0, 0, 1, 1, timeout, out _);
|
||||
ataReadDma = !sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && cmdBuf.Length > 0;
|
||||
sense = dev.ReadDma(out cmdBuf, out errorChs, true, 0, 0, 1, 1, timeout, out _);
|
||||
ataReadDmaRetry = !sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && cmdBuf.Length > 0;
|
||||
|
||||
sense = dev.Read(out cmdBuf, out AtaErrorRegistersLba28 errorLba, false, 0, 1, timeout, out _);
|
||||
ataReadLba = !sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && cmdBuf.Length > 0;
|
||||
sense = dev.Read(out cmdBuf, out errorLba, true, 0, 1, timeout, out _);
|
||||
ataReadRetryLba = !sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && cmdBuf.Length > 0;
|
||||
sense = dev.ReadDma(out cmdBuf, out errorLba, false, 0, 1, timeout, out _);
|
||||
ataReadDmaLba = !sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && cmdBuf.Length > 0;
|
||||
sense = dev.ReadDma(out cmdBuf, out errorLba, true, 0, 1, timeout, out _);
|
||||
sense = dev.Read(out cmdBuf, out AtaErrorRegistersLba28 errorLba, false, 0, 1, timeout, out _);
|
||||
ataReadLba = !sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && cmdBuf.Length > 0;
|
||||
sense = dev.Read(out cmdBuf, out errorLba, true, 0, 1, timeout, out _);
|
||||
ataReadRetryLba = !sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && cmdBuf.Length > 0;
|
||||
sense = dev.ReadDma(out cmdBuf, out errorLba, false, 0, 1, timeout, out _);
|
||||
ataReadDmaLba = !sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && cmdBuf.Length > 0;
|
||||
sense = dev.ReadDma(out cmdBuf, out errorLba, true, 0, 1, timeout, out _);
|
||||
ataReadDmaRetryLba = !sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && cmdBuf.Length > 0;
|
||||
|
||||
sense = dev.Read(out cmdBuf, out AtaErrorRegistersLba48 errorLba48, 0, 1, timeout, out _);
|
||||
ataReadLba48 = !sense && (errorLba48.Status & 0x27) == 0 && errorLba48.Error == 0 && cmdBuf.Length > 0;
|
||||
sense = dev.ReadDma(out cmdBuf, out errorLba48, 0, 1, timeout, out _);
|
||||
sense = dev.Read(out cmdBuf, out AtaErrorRegistersLba48 errorLba48, 0, 1, timeout, out _);
|
||||
ataReadLba48 = !sense && (errorLba48.Status & 0x27) == 0 && errorLba48.Error == 0 && cmdBuf.Length > 0;
|
||||
sense = dev.ReadDma(out cmdBuf, out errorLba48, 0, 1, timeout, out _);
|
||||
ataReadDmaLba48 = !sense && (errorLba48.Status & 0x27) == 0 && errorLba48.Error == 0 && cmdBuf.Length > 0;
|
||||
|
||||
sense = dev.Seek(out errorChs, 0, 0, 1, timeout, out _);
|
||||
ataSeek = !sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0;
|
||||
sense = dev.Seek(out errorLba, 0, timeout, out _);
|
||||
sense = dev.Seek(out errorChs, 0, 0, 1, timeout, out _);
|
||||
ataSeek = !sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0;
|
||||
sense = dev.Seek(out errorLba, 0, timeout, out _);
|
||||
ataSeekLba = !sense && (errorLba.Status & 0x27) == 0 && errorChs.Error == 0;
|
||||
|
||||
if(IsLba)
|
||||
@@ -178,17 +179,19 @@ namespace DiscImageChef.Core.Devices
|
||||
if((ataId.PhysLogSectorSize & 0x8000) == 0x0000 && (ataId.PhysLogSectorSize & 0x4000) == 0x4000)
|
||||
{
|
||||
if((ataId.PhysLogSectorSize & 0x1000) == 0x1000)
|
||||
if(ataId.LogicalSectorWords <= 255 || ataId.LogicalAlignment == 0xFFFF) LogicalBlockSize = 512;
|
||||
else LogicalBlockSize = ataId.LogicalSectorWords * 2;
|
||||
if(ataId.LogicalSectorWords <= 255 || ataId.LogicalAlignment == 0xFFFF)
|
||||
LogicalBlockSize = 512;
|
||||
else
|
||||
LogicalBlockSize = ataId.LogicalSectorWords * 2;
|
||||
else LogicalBlockSize = 512;
|
||||
|
||||
if((ataId.PhysLogSectorSize & 0x2000) == 0x2000)
|
||||
PhysicalBlockSize = LogicalBlockSize * (uint)Math.Pow(2, ataId.PhysLogSectorSize & 0xF);
|
||||
PhysicalBlockSize = LogicalBlockSize * (uint)Math.Pow(2, ataId.PhysLogSectorSize & 0xF);
|
||||
else PhysicalBlockSize = LogicalBlockSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
LogicalBlockSize = 512;
|
||||
LogicalBlockSize = 512;
|
||||
PhysicalBlockSize = 512;
|
||||
}
|
||||
|
||||
@@ -212,8 +215,8 @@ namespace DiscImageChef.Core.Devices
|
||||
|
||||
while(IsLba)
|
||||
{
|
||||
byte[] cmdBuf;
|
||||
bool sense;
|
||||
byte[] cmdBuf;
|
||||
bool sense;
|
||||
AtaErrorRegistersLba48 errorLba48;
|
||||
if(ataReadDmaLba48)
|
||||
{
|
||||
@@ -264,54 +267,56 @@ namespace DiscImageChef.Core.Devices
|
||||
|
||||
bool AtaReadBlocks(out byte[] buffer, ulong block, uint count, out double duration)
|
||||
{
|
||||
bool error = true;
|
||||
bool sense;
|
||||
bool error = true;
|
||||
bool sense;
|
||||
AtaErrorRegistersLba28 errorLba;
|
||||
AtaErrorRegistersLba48 errorLba48;
|
||||
byte status = 0, errorByte = 0;
|
||||
buffer = null;
|
||||
byte status = 0, errorByte = 0;
|
||||
buffer = null;
|
||||
duration = 0;
|
||||
|
||||
if(ataReadDmaLba48)
|
||||
{
|
||||
sense = dev.ReadDma(out buffer, out errorLba48, block, (byte)count, timeout, out duration);
|
||||
error = !(!sense && (errorLba48.Status & 0x27) == 0 && errorLba48.Error == 0 && buffer.Length > 0);
|
||||
status = errorLba48.Status;
|
||||
sense = dev.ReadDma(out buffer, out errorLba48, block, (byte)count, timeout, out duration);
|
||||
error = !(!sense && (errorLba48.Status & 0x27) == 0 && errorLba48.Error == 0 && buffer.Length > 0);
|
||||
status = errorLba48.Status;
|
||||
errorByte = errorLba48.Error;
|
||||
}
|
||||
else if(ataReadLba48)
|
||||
{
|
||||
sense = dev.Read(out buffer, out errorLba48, block, (byte)count, timeout, out duration);
|
||||
error = !(!sense && (errorLba48.Status & 0x27) == 0 && errorLba48.Error == 0 && buffer.Length > 0);
|
||||
status = errorLba48.Status;
|
||||
sense = dev.Read(out buffer, out errorLba48, block, (byte)count, timeout, out duration);
|
||||
error = !(!sense && (errorLba48.Status & 0x27) == 0 && errorLba48.Error == 0 && buffer.Length > 0);
|
||||
status = errorLba48.Status;
|
||||
errorByte = errorLba48.Error;
|
||||
}
|
||||
else if(ataReadDmaRetryLba)
|
||||
{
|
||||
sense = dev.ReadDma(out buffer, out errorLba, true, (uint)block, (byte)count, timeout, out duration);
|
||||
error = !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && buffer.Length > 0);
|
||||
status = errorLba.Status;
|
||||
sense = dev.ReadDma(out buffer, out errorLba, true, (uint)block, (byte)count, timeout,
|
||||
out duration);
|
||||
error = !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && buffer.Length > 0);
|
||||
status = errorLba.Status;
|
||||
errorByte = errorLba.Error;
|
||||
}
|
||||
else if(ataReadDmaLba)
|
||||
{
|
||||
sense = dev.ReadDma(out buffer, out errorLba, false, (uint)block, (byte)count, timeout, out duration);
|
||||
error = !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && buffer.Length > 0);
|
||||
status = errorLba.Status;
|
||||
sense = dev.ReadDma(out buffer, out errorLba, false, (uint)block, (byte)count, timeout,
|
||||
out duration);
|
||||
error = !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && buffer.Length > 0);
|
||||
status = errorLba.Status;
|
||||
errorByte = errorLba.Error;
|
||||
}
|
||||
else if(ataReadRetryLba)
|
||||
{
|
||||
sense = dev.Read(out buffer, out errorLba, true, (uint)block, (byte)count, timeout, out duration);
|
||||
error = !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && buffer.Length > 0);
|
||||
status = errorLba.Status;
|
||||
sense = dev.Read(out buffer, out errorLba, true, (uint)block, (byte)count, timeout, out duration);
|
||||
error = !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && buffer.Length > 0);
|
||||
status = errorLba.Status;
|
||||
errorByte = errorLba.Error;
|
||||
}
|
||||
else if(ataReadLba)
|
||||
{
|
||||
sense = dev.Read(out buffer, out errorLba, false, (uint)block, (byte)count, timeout, out duration);
|
||||
error = !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && buffer.Length > 0);
|
||||
status = errorLba.Status;
|
||||
sense = dev.Read(out buffer, out errorLba, false, (uint)block, (byte)count, timeout, out duration);
|
||||
error = !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && buffer.Length > 0);
|
||||
status = errorLba.Status;
|
||||
errorByte = errorLba.Error;
|
||||
}
|
||||
|
||||
@@ -322,39 +327,41 @@ namespace DiscImageChef.Core.Devices
|
||||
|
||||
bool AtaReadChs(out byte[] buffer, ushort cylinder, byte head, byte sectir, out double duration)
|
||||
{
|
||||
bool error = true;
|
||||
bool sense;
|
||||
bool error = true;
|
||||
bool sense;
|
||||
AtaErrorRegistersChs errorChs;
|
||||
byte status = 0, errorByte = 0;
|
||||
buffer = null;
|
||||
byte status = 0, errorByte = 0;
|
||||
buffer = null;
|
||||
duration = 0;
|
||||
|
||||
if(ataReadDmaRetry)
|
||||
{
|
||||
sense = dev.ReadDma(out buffer, out errorChs, true, cylinder, head, sectir, 1, timeout, out duration);
|
||||
error = !(!sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && buffer.Length > 0);
|
||||
status = errorChs.Status;
|
||||
sense = dev.ReadDma(out buffer, out errorChs, true, cylinder, head, sectir, 1, timeout,
|
||||
out duration);
|
||||
error = !(!sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && buffer.Length > 0);
|
||||
status = errorChs.Status;
|
||||
errorByte = errorChs.Error;
|
||||
}
|
||||
else if(ataReadDma)
|
||||
{
|
||||
sense = dev.ReadDma(out buffer, out errorChs, false, cylinder, head, sectir, 1, timeout, out duration);
|
||||
error = !(!sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && buffer.Length > 0);
|
||||
status = errorChs.Status;
|
||||
sense = dev.ReadDma(out buffer, out errorChs, false, cylinder, head, sectir, 1, timeout,
|
||||
out duration);
|
||||
error = !(!sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && buffer.Length > 0);
|
||||
status = errorChs.Status;
|
||||
errorByte = errorChs.Error;
|
||||
}
|
||||
else if(ataReadRetry)
|
||||
{
|
||||
sense = dev.Read(out buffer, out errorChs, true, cylinder, head, sectir, 1, timeout, out duration);
|
||||
error = !(!sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && buffer.Length > 0);
|
||||
status = errorChs.Status;
|
||||
sense = dev.Read(out buffer, out errorChs, true, cylinder, head, sectir, 1, timeout, out duration);
|
||||
error = !(!sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && buffer.Length > 0);
|
||||
status = errorChs.Status;
|
||||
errorByte = errorChs.Error;
|
||||
}
|
||||
else if(ataRead)
|
||||
{
|
||||
sense = dev.Read(out buffer, out errorChs, false, cylinder, head, sectir, 1, timeout, out duration);
|
||||
error = !(!sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && buffer.Length > 0);
|
||||
status = errorChs.Status;
|
||||
sense = dev.Read(out buffer, out errorChs, false, cylinder, head, sectir, 1, timeout, out duration);
|
||||
error = !(!sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && buffer.Length > 0);
|
||||
status = errorChs.Status;
|
||||
errorByte = errorChs.Error;
|
||||
}
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ namespace DiscImageChef.Core.Devices
|
||||
decSense = Sense.DecodeFixed(senseBuf);
|
||||
if(decSense.HasValue)
|
||||
if(decSense.Value.SenseKey == SenseKeys.IllegalRequest && decSense.Value.ASC == 0x24 &&
|
||||
decSense.Value.ASCQ == 0x00)
|
||||
decSense.Value.ASCQ == 0x00)
|
||||
{
|
||||
CanReadRaw = true;
|
||||
if(decSense.Value.InformationValid && decSense.Value.ILI)
|
||||
@@ -156,9 +156,9 @@ namespace DiscImageChef.Core.Devices
|
||||
testSense = dev.ReadLong16(out _, out senseBuf, false, 0, testSize, timeout, out _);
|
||||
if(!testSense && !dev.Error)
|
||||
{
|
||||
readLong16 = true;
|
||||
readLong16 = true;
|
||||
LongBlockSize = testSize;
|
||||
CanReadRaw = true;
|
||||
CanReadRaw = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -166,9 +166,9 @@ namespace DiscImageChef.Core.Devices
|
||||
out _);
|
||||
if(testSense || dev.Error) continue;
|
||||
|
||||
readLong10 = true;
|
||||
readLong10 = true;
|
||||
LongBlockSize = testSize;
|
||||
CanReadRaw = true;
|
||||
CanReadRaw = true;
|
||||
break;
|
||||
}
|
||||
else if(LogicalBlockSize == 1024)
|
||||
@@ -184,9 +184,9 @@ namespace DiscImageChef.Core.Devices
|
||||
testSense = dev.ReadLong16(out _, out senseBuf, false, 0, testSize, timeout, out _);
|
||||
if(!testSense && !dev.Error)
|
||||
{
|
||||
readLong16 = true;
|
||||
readLong16 = true;
|
||||
LongBlockSize = testSize;
|
||||
CanReadRaw = true;
|
||||
CanReadRaw = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -194,9 +194,9 @@ namespace DiscImageChef.Core.Devices
|
||||
out _);
|
||||
if(testSense || dev.Error) continue;
|
||||
|
||||
readLong10 = true;
|
||||
readLong10 = true;
|
||||
LongBlockSize = testSize;
|
||||
CanReadRaw = true;
|
||||
CanReadRaw = true;
|
||||
break;
|
||||
}
|
||||
else if(LogicalBlockSize == 2048)
|
||||
@@ -204,18 +204,18 @@ namespace DiscImageChef.Core.Devices
|
||||
testSense = dev.ReadLong16(out _, out senseBuf, false, 0, 2380, timeout, out _);
|
||||
if(!testSense && !dev.Error)
|
||||
{
|
||||
readLong16 = true;
|
||||
readLong16 = true;
|
||||
LongBlockSize = 2380;
|
||||
CanReadRaw = true;
|
||||
CanReadRaw = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
testSense = dev.ReadLong10(out _, out senseBuf, false, false, 0, 2380, timeout, out _);
|
||||
if(!testSense && !dev.Error)
|
||||
{
|
||||
readLong10 = true;
|
||||
readLong10 = true;
|
||||
LongBlockSize = 2380;
|
||||
CanReadRaw = true;
|
||||
CanReadRaw = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -224,18 +224,18 @@ namespace DiscImageChef.Core.Devices
|
||||
testSense = dev.ReadLong16(out _, out senseBuf, false, 0, 4760, timeout, out _);
|
||||
if(!testSense && !dev.Error)
|
||||
{
|
||||
readLong16 = true;
|
||||
readLong16 = true;
|
||||
LongBlockSize = 4760;
|
||||
CanReadRaw = true;
|
||||
CanReadRaw = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
testSense = dev.ReadLong10(out _, out senseBuf, false, false, 0, 4760, timeout, out _);
|
||||
if(!testSense && !dev.Error)
|
||||
{
|
||||
readLong10 = true;
|
||||
readLong10 = true;
|
||||
LongBlockSize = 4760;
|
||||
CanReadRaw = true;
|
||||
CanReadRaw = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -244,18 +244,18 @@ namespace DiscImageChef.Core.Devices
|
||||
testSense = dev.ReadLong16(out _, out senseBuf, false, 0, 9424, timeout, out _);
|
||||
if(!testSense && !dev.Error)
|
||||
{
|
||||
readLong16 = true;
|
||||
readLong16 = true;
|
||||
LongBlockSize = 9424;
|
||||
CanReadRaw = true;
|
||||
CanReadRaw = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
testSense = dev.ReadLong10(out _, out senseBuf, false, false, 0, 9424, timeout, out _);
|
||||
if(!testSense && !dev.Error)
|
||||
{
|
||||
readLong10 = true;
|
||||
readLong10 = true;
|
||||
LongBlockSize = 9424;
|
||||
CanReadRaw = true;
|
||||
CanReadRaw = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -268,7 +268,7 @@ namespace DiscImageChef.Core.Devices
|
||||
decSense = Sense.DecodeFixed(senseBuf);
|
||||
if(decSense.HasValue)
|
||||
if(decSense.Value.SenseKey == SenseKeys.IllegalRequest && decSense.Value.ASC == 0x24 &&
|
||||
decSense.Value.ASCQ == 0x00)
|
||||
decSense.Value.ASCQ == 0x00)
|
||||
{
|
||||
CanReadRaw = true;
|
||||
if(decSense.Value.InformationValid && decSense.Value.ILI)
|
||||
@@ -287,7 +287,8 @@ namespace DiscImageChef.Core.Devices
|
||||
decSense = Sense.DecodeFixed(senseBuf);
|
||||
if(decSense.HasValue)
|
||||
if(decSense.Value.SenseKey == SenseKeys.IllegalRequest &&
|
||||
decSense.Value.ASC == 0x24 && decSense.Value.ASCQ == 0x00)
|
||||
decSense.Value.ASC == 0x24 &&
|
||||
decSense.Value.ASCQ == 0x00)
|
||||
{
|
||||
CanReadRaw = true;
|
||||
if(decSense.Value.InformationValid && decSense.Value.ILI)
|
||||
@@ -307,9 +308,9 @@ namespace DiscImageChef.Core.Devices
|
||||
testSense = dev.SyQuestReadLong6(out _, out senseBuf, 0, 262, timeout, out _);
|
||||
if(!testSense && !dev.Error)
|
||||
{
|
||||
syqReadLong6 = true;
|
||||
syqReadLong6 = true;
|
||||
LongBlockSize = 262;
|
||||
CanReadRaw = true;
|
||||
CanReadRaw = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -328,7 +329,7 @@ namespace DiscImageChef.Core.Devices
|
||||
|
||||
if(hldtstReadRaw || plextorReadRaw)
|
||||
{
|
||||
CanReadRaw = true;
|
||||
CanReadRaw = true;
|
||||
LongBlockSize = 2064;
|
||||
}
|
||||
|
||||
@@ -338,9 +339,9 @@ namespace DiscImageChef.Core.Devices
|
||||
testSense = dev.ReadLong10(out _, out senseBuf, false, false, 0, 37856, timeout, out _);
|
||||
if(!testSense && !dev.Error)
|
||||
{
|
||||
readLongDvd = true;
|
||||
readLongDvd = true;
|
||||
LongBlockSize = 37856;
|
||||
CanReadRaw = true;
|
||||
CanReadRaw = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -371,8 +372,8 @@ namespace DiscImageChef.Core.Devices
|
||||
sense = dev.ReadCapacity(out byte[] cmdBuf, out byte[] senseBuf, timeout, out _);
|
||||
if(!sense)
|
||||
{
|
||||
Blocks = (ulong)((cmdBuf[0] << 24) + (cmdBuf[1] << 16) + (cmdBuf[2] << 8) + cmdBuf[3]);
|
||||
LogicalBlockSize = (uint)((cmdBuf[5] << 24) + (cmdBuf[5] << 16) + (cmdBuf[6] << 8) + cmdBuf[7]);
|
||||
Blocks = (ulong)((cmdBuf[0] << 24) + (cmdBuf[1] << 16) + (cmdBuf[2] << 8) + cmdBuf[3]);
|
||||
LogicalBlockSize = (uint)((cmdBuf[5] << 24) + (cmdBuf[5] << 16) + (cmdBuf[6] << 8) + cmdBuf[7]);
|
||||
}
|
||||
|
||||
if(sense || Blocks == 0xFFFFFFFF)
|
||||
@@ -393,13 +394,13 @@ namespace DiscImageChef.Core.Devices
|
||||
|
||||
Array.Copy(cmdBuf, 0, temp, 0, 8);
|
||||
Array.Reverse(temp);
|
||||
Blocks = BitConverter.ToUInt64(temp, 0);
|
||||
Blocks = BitConverter.ToUInt64(temp, 0);
|
||||
LogicalBlockSize = (uint)((cmdBuf[5] << 24) + (cmdBuf[5] << 16) + (cmdBuf[6] << 8) + cmdBuf[7]);
|
||||
}
|
||||
}
|
||||
|
||||
PhysicalBlockSize = LogicalBlockSize;
|
||||
LongBlockSize = LogicalBlockSize;
|
||||
LongBlockSize = LogicalBlockSize;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -445,9 +446,9 @@ namespace DiscImageChef.Core.Devices
|
||||
|
||||
bool ScsiReadBlocks(out byte[] buffer, ulong block, uint count, out double duration)
|
||||
{
|
||||
bool sense;
|
||||
bool sense;
|
||||
byte[] senseBuf;
|
||||
buffer = null;
|
||||
buffer = null;
|
||||
duration = 0;
|
||||
|
||||
if(CanReadRaw)
|
||||
@@ -498,7 +499,7 @@ namespace DiscImageChef.Core.Devices
|
||||
bool sense = true;
|
||||
duration = 0;
|
||||
|
||||
if(seek6) sense = dev.Seek6(out _, (uint)block, timeout, out duration);
|
||||
if(seek6) sense = dev.Seek6(out _, (uint)block, timeout, out duration);
|
||||
else if(seek10) sense = dev.Seek10(out _, (uint)block, timeout, out duration);
|
||||
|
||||
return sense;
|
||||
|
||||
@@ -666,7 +666,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
mediaTest.BlocksSpecified = true;
|
||||
}
|
||||
|
||||
if(ataId.NominalRotationRate != 0x0000 && ataId.NominalRotationRate != 0xFFFF)
|
||||
if(ataId.NominalRotationRate != 0x0000 && ataId.NominalRotationRate != 0xFFFF)
|
||||
if(ataId.NominalRotationRate == 0x0001)
|
||||
{
|
||||
mediaTest.SolidStateDevice = true;
|
||||
@@ -685,14 +685,13 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
if((ataId.PhysLogSectorSize & 0x8000) == 0x0000 && (ataId.PhysLogSectorSize & 0x4000) == 0x4000)
|
||||
{
|
||||
if((ataId.PhysLogSectorSize & 0x1000) == 0x1000)
|
||||
if(ataId.LogicalSectorWords <= 255 || ataId.LogicalAlignment == 0xFFFF)
|
||||
if(ataId.LogicalSectorWords <= 255 || ataId.LogicalAlignment == 0xFFFF)
|
||||
logicalsectorsize = 512;
|
||||
else
|
||||
logicalsectorsize = ataId.LogicalSectorWords * 2;
|
||||
else logicalsectorsize = 512;
|
||||
else logicalsectorsize = 512;
|
||||
|
||||
if((ataId.PhysLogSectorSize &
|
||||
0x2000) == 0x2000)
|
||||
if((ataId.PhysLogSectorSize & 0x2000) == 0x2000)
|
||||
physicalsectorsize =
|
||||
(uint)(logicalsectorsize * ((1 << ataId.PhysLogSectorSize) & 0xF));
|
||||
else physicalsectorsize = logicalsectorsize;
|
||||
@@ -724,7 +723,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
}
|
||||
|
||||
if(ataId.UnformattedBPS > logicalsectorsize &&
|
||||
if(ataId.UnformattedBPS > logicalsectorsize &&
|
||||
(!mediaTest.LongBlockSizeSpecified || mediaTest.LongBlockSize == 516))
|
||||
{
|
||||
mediaTest.LongBlockSize = ataId.UnformattedBPS;
|
||||
@@ -779,8 +778,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results", readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ SECTOR(S) RETRY in CHS mode...");
|
||||
sense =
|
||||
dev.Read(out readBuf, out errorChs, true, 0, 0, 1, 1, TIMEOUT, out _);
|
||||
sense = dev.Read(out readBuf, out errorChs, true, 0, 0, 1, 1, TIMEOUT, out _);
|
||||
mediaTest.SupportsReadRetry = !sense && (errorChs.Status & 0x01) != 0x01 &&
|
||||
errorChs.Error == 0 && readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
@@ -791,8 +789,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results", readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ DMA in CHS mode...");
|
||||
sense =
|
||||
dev.ReadDma(out readBuf, out errorChs, false, 0, 0, 1, 1, TIMEOUT, out _);
|
||||
sense = dev.ReadDma(out readBuf, out errorChs, false, 0, 0, 1, 1, TIMEOUT, out _);
|
||||
mediaTest.SupportsReadDma = !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 &&
|
||||
readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
@@ -803,8 +800,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
"read results", readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ DMA RETRY in CHS mode...");
|
||||
sense =
|
||||
dev.ReadDma(out readBuf, out errorChs, true, 0, 0, 1, 1, TIMEOUT, out _);
|
||||
sense = dev.ReadDma(out readBuf, out errorChs, true, 0, 0, 1, 1, TIMEOUT, out _);
|
||||
mediaTest.SupportsReadDmaRetry = !sense && (errorChs.Status & 0x01) != 0x01 &&
|
||||
errorChs.Error == 0 &&
|
||||
readBuf.Length > 0;
|
||||
@@ -822,8 +818,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
sense, errorChs.Status, errorChs.Error);
|
||||
|
||||
DicConsole.WriteLine("Trying READ SECTOR(S) in LBA mode...");
|
||||
sense = dev.Read(out readBuf, out AtaErrorRegistersLba28 errorLba, false, 0,
|
||||
1, TIMEOUT, out _);
|
||||
sense = dev.Read(out readBuf, out AtaErrorRegistersLba28 errorLba, false, 0, 1, TIMEOUT, out _);
|
||||
mediaTest.SupportsReadLba = !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 &&
|
||||
readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
@@ -834,8 +829,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
"read results", readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ SECTOR(S) RETRY in LBA mode...");
|
||||
sense =
|
||||
dev.Read(out readBuf, out errorLba, true, 0, 1, TIMEOUT, out _);
|
||||
sense = dev.Read(out readBuf, out errorLba, true, 0, 1, TIMEOUT, out _);
|
||||
mediaTest.SupportsReadRetryLba = !sense && (errorLba.Status & 0x01) != 0x01 &&
|
||||
errorLba.Error == 0 &&
|
||||
readBuf.Length > 0;
|
||||
@@ -847,8 +841,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results", readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ DMA in LBA mode...");
|
||||
sense =
|
||||
dev.ReadDma(out readBuf, out errorLba, false, 0, 1, TIMEOUT, out _);
|
||||
sense = dev.ReadDma(out readBuf, out errorLba, false, 0, 1, TIMEOUT, out _);
|
||||
mediaTest.SupportsReadDmaLba = !sense && (errorLba.Status & 0x01) != 0x01 &&
|
||||
errorLba.Error == 0 && readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
@@ -859,8 +852,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
"read results", readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ DMA RETRY in LBA mode...");
|
||||
sense =
|
||||
dev.ReadDma(out readBuf, out errorLba, true, 0, 1, TIMEOUT, out _);
|
||||
sense = dev.ReadDma(out readBuf, out errorLba, true, 0, 1, TIMEOUT, out _);
|
||||
mediaTest.SupportsReadDmaRetryLba =
|
||||
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
@@ -877,8 +869,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
sense, errorChs.Status, errorChs.Error);
|
||||
|
||||
DicConsole.WriteLine("Trying READ SECTOR(S) in LBA48 mode...");
|
||||
sense =
|
||||
dev.Read(out readBuf, out AtaErrorRegistersLba48 errorLba48, 0, 1, TIMEOUT, out _);
|
||||
sense = dev.Read(out readBuf, out AtaErrorRegistersLba48 errorLba48, 0, 1, TIMEOUT, out _);
|
||||
mediaTest.SupportsReadLba48 = !sense && (errorLba48.Status & 0x01) != 0x01 &&
|
||||
errorLba48.Error == 0 &&
|
||||
readBuf.Length > 0;
|
||||
@@ -890,7 +881,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
"_debug_" + mediaTest.MediumTypeName + ".bin", "read results", readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ DMA in LBA48 mode...");
|
||||
sense = dev.ReadDma(out readBuf, out errorLba48, 0, 1, TIMEOUT, out _);
|
||||
sense = dev.ReadDma(out readBuf, out errorLba48, 0, 1, TIMEOUT, out _);
|
||||
mediaTest.SupportsReadDmaLba48 = !sense && (errorLba48.Status & 0x01) != 0x01 &&
|
||||
errorLba48.Error == 0 &&
|
||||
readBuf.Length > 0;
|
||||
@@ -918,7 +909,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
}
|
||||
|
||||
if(ataId.UnformattedBPS > logicalsectorsize &&
|
||||
if(ataId.UnformattedBPS > logicalsectorsize &&
|
||||
(!mediaTest.LongBlockSizeSpecified || mediaTest.LongBlockSize == 516))
|
||||
{
|
||||
mediaTest.LongBlockSize = ataId.UnformattedBPS;
|
||||
@@ -1044,7 +1035,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
report.ATA.ReadCapabilities.BlocksSpecified = true;
|
||||
}
|
||||
|
||||
if(ataId.NominalRotationRate != 0x0000 && ataId.NominalRotationRate != 0xFFFF)
|
||||
if(ataId.NominalRotationRate != 0x0000 && ataId.NominalRotationRate != 0xFFFF)
|
||||
if(ataId.NominalRotationRate == 0x0001)
|
||||
{
|
||||
report.ATA.ReadCapabilities.SolidStateDevice = true;
|
||||
@@ -1063,14 +1054,13 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
if((ataId.PhysLogSectorSize & 0x8000) == 0x0000 && (ataId.PhysLogSectorSize & 0x4000) == 0x4000)
|
||||
{
|
||||
if((ataId.PhysLogSectorSize & 0x1000) == 0x1000)
|
||||
if(ataId.LogicalSectorWords <= 255 || ataId.LogicalAlignment == 0xFFFF)
|
||||
if(ataId.LogicalSectorWords <= 255 || ataId.LogicalAlignment == 0xFFFF)
|
||||
logicalsectorsize = 512;
|
||||
else
|
||||
logicalsectorsize = ataId.LogicalSectorWords * 2;
|
||||
else logicalsectorsize = 512;
|
||||
else logicalsectorsize = 512;
|
||||
|
||||
if((ataId.PhysLogSectorSize & 0x2000) ==
|
||||
0x2000)
|
||||
if((ataId.PhysLogSectorSize & 0x2000) == 0x2000)
|
||||
physicalsectorsize = logicalsectorsize * (uint)Math.Pow(2, ataId.PhysLogSectorSize & 0xF);
|
||||
else physicalsectorsize = logicalsectorsize;
|
||||
}
|
||||
@@ -1157,8 +1147,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
"read results", readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ SECTOR(S) RETRY in CHS mode...");
|
||||
sense =
|
||||
dev.Read(out readBuf, out errorChs, true, 0, 0, 1, 1, TIMEOUT, out _);
|
||||
sense = dev.Read(out readBuf, out errorChs, true, 0, 0, 1, 1, TIMEOUT, out _);
|
||||
report.ATA.ReadCapabilities.SupportsReadRetry =
|
||||
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
@@ -1169,8 +1158,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
"read results", readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ DMA in CHS mode...");
|
||||
sense =
|
||||
dev.ReadDma(out readBuf, out errorChs, false, 0, 0, 1, 1, TIMEOUT, out _);
|
||||
sense = dev.ReadDma(out readBuf, out errorChs, false, 0, 0, 1, 1, TIMEOUT, out _);
|
||||
report.ATA.ReadCapabilities.SupportsReadDma =
|
||||
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
@@ -1181,8 +1169,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ DMA RETRY in CHS mode...");
|
||||
sense =
|
||||
dev.ReadDma(out readBuf, out errorChs, true, 0, 0, 1, 1, TIMEOUT, out _);
|
||||
sense = dev.ReadDma(out readBuf, out errorChs, true, 0, 0, 1, 1, TIMEOUT, out _);
|
||||
report.ATA.ReadCapabilities.SupportsReadDmaRetry =
|
||||
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
@@ -1193,15 +1180,14 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
"read results", readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying SEEK in CHS mode...");
|
||||
sense = dev.Seek(out errorChs, 0, 0, 1, TIMEOUT, out _);
|
||||
sense = dev.Seek(out errorChs, 0, 0, 1, TIMEOUT, out _);
|
||||
report.ATA.ReadCapabilities.SupportsSeek =
|
||||
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0;
|
||||
DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}", sense,
|
||||
errorChs.Status, errorChs.Error);
|
||||
|
||||
DicConsole.WriteLine("Trying READ SECTOR(S) in LBA mode...");
|
||||
sense =
|
||||
dev.Read(out readBuf, out AtaErrorRegistersLba28 errorLba, false, 0, 1, TIMEOUT, out _);
|
||||
sense = dev.Read(out readBuf, out AtaErrorRegistersLba28 errorLba, false, 0, 1, TIMEOUT, out _);
|
||||
report.ATA.ReadCapabilities.SupportsReadLba =
|
||||
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
@@ -1212,8 +1198,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ SECTOR(S) RETRY in LBA mode...");
|
||||
sense =
|
||||
dev.Read(out readBuf, out errorLba, true, 0, 1, TIMEOUT, out _);
|
||||
sense = dev.Read(out readBuf, out errorLba, true, 0, 1, TIMEOUT, out _);
|
||||
report.ATA.ReadCapabilities.SupportsReadRetryLba =
|
||||
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
@@ -1224,8 +1209,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
"read results", readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ DMA in LBA mode...");
|
||||
sense =
|
||||
dev.ReadDma(out readBuf, out errorLba, false, 0, 1, TIMEOUT, out _);
|
||||
sense = dev.ReadDma(out readBuf, out errorLba, false, 0, 1, TIMEOUT, out _);
|
||||
report.ATA.ReadCapabilities.SupportsReadDmaLba =
|
||||
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
@@ -1236,8 +1220,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ DMA RETRY in LBA mode...");
|
||||
sense =
|
||||
dev.ReadDma(out readBuf, out errorLba, true, 0, 1, TIMEOUT, out _);
|
||||
sense = dev.ReadDma(out readBuf, out errorLba, true, 0, 1, TIMEOUT, out _);
|
||||
report.ATA.ReadCapabilities.SupportsReadDmaRetryLba =
|
||||
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
@@ -1248,15 +1231,14 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
"read results", readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying SEEK in LBA mode...");
|
||||
sense = dev.Seek(out errorLba, 0, TIMEOUT, out _);
|
||||
sense = dev.Seek(out errorLba, 0, TIMEOUT, out _);
|
||||
report.ATA.ReadCapabilities.SupportsSeekLba =
|
||||
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0;
|
||||
DicConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}", sense,
|
||||
errorLba.Status, errorLba.Error);
|
||||
|
||||
DicConsole.WriteLine("Trying READ SECTOR(S) in LBA48 mode...");
|
||||
sense =
|
||||
dev.Read(out readBuf, out AtaErrorRegistersLba48 errorLba48, 0, 1, TIMEOUT, out _);
|
||||
sense = dev.Read(out readBuf, out AtaErrorRegistersLba48 errorLba48, 0, 1, TIMEOUT, out _);
|
||||
report.ATA.ReadCapabilities.SupportsReadLba48 =
|
||||
!sense && (errorLba48.Status & 0x01) != 0x01 && errorLba48.Error == 0 && readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
@@ -1267,8 +1249,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
"read results", readBuf);
|
||||
|
||||
DicConsole.WriteLine("Trying READ DMA in LBA48 mode...");
|
||||
sense =
|
||||
dev.ReadDma(out readBuf, out errorLba48, 0, 1, TIMEOUT, out _);
|
||||
sense = dev.ReadDma(out readBuf, out errorLba48, 0, 1, TIMEOUT, out _);
|
||||
report.ATA.ReadCapabilities.SupportsReadDmaLba48 =
|
||||
!sense && (errorLba48.Status & 0x01) != 0x01 && errorLba48.Error == 0 && readBuf.Length > 0;
|
||||
DicConsole.DebugWriteLine("ATA Report",
|
||||
|
||||
@@ -69,400 +69,479 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(atapiId.AdditionalPID))
|
||||
{
|
||||
report.ATAPI.AdditionalPID = atapiId.AdditionalPID;
|
||||
report.ATAPI.AdditionalPID = atapiId.AdditionalPID;
|
||||
report.ATAPI.AdditionalPIDSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.APIOSupported != 0)
|
||||
{
|
||||
report.ATAPI.APIOSupported = atapiId.APIOSupported;
|
||||
report.ATAPI.APIOSupported = atapiId.APIOSupported;
|
||||
report.ATAPI.APIOSupportedSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.ATAPIByteCount != 0)
|
||||
{
|
||||
report.ATAPI.ATAPIByteCount = atapiId.ATAPIByteCount;
|
||||
report.ATAPI.ATAPIByteCount = atapiId.ATAPIByteCount;
|
||||
report.ATAPI.ATAPIByteCountSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.BufferType != 0)
|
||||
{
|
||||
report.ATAPI.BufferType = atapiId.BufferType;
|
||||
report.ATAPI.BufferType = atapiId.BufferType;
|
||||
report.ATAPI.BufferTypeSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.BufferSize != 0)
|
||||
{
|
||||
report.ATAPI.BufferSize = atapiId.BufferSize;
|
||||
report.ATAPI.BufferSize = atapiId.BufferSize;
|
||||
report.ATAPI.BufferSizeSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.Capabilities != 0)
|
||||
{
|
||||
report.ATAPI.Capabilities = atapiId.Capabilities;
|
||||
report.ATAPI.Capabilities = atapiId.Capabilities;
|
||||
report.ATAPI.CapabilitiesSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.Capabilities2 != 0)
|
||||
{
|
||||
report.ATAPI.Capabilities2 = atapiId.Capabilities2;
|
||||
report.ATAPI.Capabilities2 = atapiId.Capabilities2;
|
||||
report.ATAPI.Capabilities2Specified = true;
|
||||
}
|
||||
|
||||
if(atapiId.Capabilities3 != 0)
|
||||
{
|
||||
report.ATAPI.Capabilities3 = atapiId.Capabilities3;
|
||||
report.ATAPI.Capabilities3 = atapiId.Capabilities3;
|
||||
report.ATAPI.Capabilities3Specified = true;
|
||||
}
|
||||
|
||||
if(atapiId.CFAPowerMode != 0)
|
||||
{
|
||||
report.ATAPI.CFAPowerMode = atapiId.CFAPowerMode;
|
||||
report.ATAPI.CFAPowerMode = atapiId.CFAPowerMode;
|
||||
report.ATAPI.CFAPowerModeSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.CommandSet != 0)
|
||||
{
|
||||
report.ATAPI.CommandSet = atapiId.CommandSet;
|
||||
report.ATAPI.CommandSet = atapiId.CommandSet;
|
||||
report.ATAPI.CommandSetSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.CommandSet2 != 0)
|
||||
{
|
||||
report.ATAPI.CommandSet2 = atapiId.CommandSet2;
|
||||
report.ATAPI.CommandSet2 = atapiId.CommandSet2;
|
||||
report.ATAPI.CommandSet2Specified = true;
|
||||
}
|
||||
|
||||
if(atapiId.CommandSet3 != 0)
|
||||
{
|
||||
report.ATAPI.CommandSet3 = atapiId.CommandSet3;
|
||||
report.ATAPI.CommandSet3 = atapiId.CommandSet3;
|
||||
report.ATAPI.CommandSet3Specified = true;
|
||||
}
|
||||
|
||||
if(atapiId.CommandSet4 != 0)
|
||||
{
|
||||
report.ATAPI.CommandSet4 = atapiId.CommandSet4;
|
||||
report.ATAPI.CommandSet4 = atapiId.CommandSet4;
|
||||
report.ATAPI.CommandSet4Specified = true;
|
||||
}
|
||||
|
||||
if(atapiId.CommandSet5 != 0)
|
||||
{
|
||||
report.ATAPI.CommandSet5 = atapiId.CommandSet5;
|
||||
report.ATAPI.CommandSet5 = atapiId.CommandSet5;
|
||||
report.ATAPI.CommandSet5Specified = true;
|
||||
}
|
||||
|
||||
if(atapiId.CurrentAAM != 0)
|
||||
{
|
||||
report.ATAPI.CurrentAAM = atapiId.CurrentAAM;
|
||||
report.ATAPI.CurrentAAM = atapiId.CurrentAAM;
|
||||
report.ATAPI.CurrentAAMSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.CurrentAPM != 0)
|
||||
{
|
||||
report.ATAPI.CurrentAPM = atapiId.CurrentAPM;
|
||||
report.ATAPI.CurrentAPM = atapiId.CurrentAPM;
|
||||
report.ATAPI.CurrentAPMSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.DataSetMgmt != 0)
|
||||
{
|
||||
report.ATAPI.DataSetMgmt = atapiId.DataSetMgmt;
|
||||
report.ATAPI.DataSetMgmt = atapiId.DataSetMgmt;
|
||||
report.ATAPI.DataSetMgmtSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.DataSetMgmtSize != 0)
|
||||
{
|
||||
report.ATAPI.DataSetMgmtSize = atapiId.DataSetMgmtSize;
|
||||
report.ATAPI.DataSetMgmtSize = atapiId.DataSetMgmtSize;
|
||||
report.ATAPI.DataSetMgmtSizeSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.DeviceFormFactor != 0)
|
||||
{
|
||||
report.ATAPI.DeviceFormFactor = atapiId.DeviceFormFactor;
|
||||
report.ATAPI.DeviceFormFactor = atapiId.DeviceFormFactor;
|
||||
report.ATAPI.DeviceFormFactorSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.DMAActive != 0)
|
||||
{
|
||||
report.ATAPI.DMAActive = atapiId.DMAActive;
|
||||
report.ATAPI.DMAActive = atapiId.DMAActive;
|
||||
report.ATAPI.DMAActiveSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.DMASupported != 0)
|
||||
{
|
||||
report.ATAPI.DMASupported = atapiId.DMASupported;
|
||||
report.ATAPI.DMASupported = atapiId.DMASupported;
|
||||
report.ATAPI.DMASupportedSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.DMATransferTimingMode != 0)
|
||||
{
|
||||
report.ATAPI.DMATransferTimingMode = atapiId.DMATransferTimingMode;
|
||||
report.ATAPI.DMATransferTimingMode = atapiId.DMATransferTimingMode;
|
||||
report.ATAPI.DMATransferTimingModeSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.EnhancedSecurityEraseTime != 0)
|
||||
{
|
||||
report.ATAPI.EnhancedSecurityEraseTime = atapiId.EnhancedSecurityEraseTime;
|
||||
report.ATAPI.EnhancedSecurityEraseTime = atapiId.EnhancedSecurityEraseTime;
|
||||
report.ATAPI.EnhancedSecurityEraseTimeSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.EnabledCommandSet != 0)
|
||||
{
|
||||
report.ATAPI.EnabledCommandSet = atapiId.EnabledCommandSet;
|
||||
report.ATAPI.EnabledCommandSet = atapiId.EnabledCommandSet;
|
||||
report.ATAPI.EnabledCommandSetSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.EnabledCommandSet2 != 0)
|
||||
{
|
||||
report.ATAPI.EnabledCommandSet2 = atapiId.EnabledCommandSet2;
|
||||
report.ATAPI.EnabledCommandSet2 = atapiId.EnabledCommandSet2;
|
||||
report.ATAPI.EnabledCommandSet2Specified = true;
|
||||
}
|
||||
|
||||
if(atapiId.EnabledCommandSet3 != 0)
|
||||
{
|
||||
report.ATAPI.EnabledCommandSet3 = atapiId.EnabledCommandSet3;
|
||||
report.ATAPI.EnabledCommandSet3 = atapiId.EnabledCommandSet3;
|
||||
report.ATAPI.EnabledCommandSet3Specified = true;
|
||||
}
|
||||
|
||||
if(atapiId.EnabledCommandSet4 != 0)
|
||||
{
|
||||
report.ATAPI.EnabledCommandSet4 = atapiId.EnabledCommandSet4;
|
||||
report.ATAPI.EnabledCommandSet4 = atapiId.EnabledCommandSet4;
|
||||
report.ATAPI.EnabledCommandSet4Specified = true;
|
||||
}
|
||||
|
||||
if(atapiId.EnabledSATAFeatures != 0)
|
||||
{
|
||||
report.ATAPI.EnabledSATAFeatures = atapiId.EnabledSATAFeatures;
|
||||
report.ATAPI.EnabledSATAFeatures = atapiId.EnabledSATAFeatures;
|
||||
report.ATAPI.EnabledSATAFeaturesSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.ExtendedUserSectors != 0)
|
||||
{
|
||||
report.ATAPI.ExtendedUserSectors = atapiId.ExtendedUserSectors;
|
||||
report.ATAPI.ExtendedUserSectors = atapiId.ExtendedUserSectors;
|
||||
report.ATAPI.ExtendedUserSectorsSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.FreeFallSensitivity != 0)
|
||||
{
|
||||
report.ATAPI.FreeFallSensitivity = atapiId.FreeFallSensitivity;
|
||||
report.ATAPI.FreeFallSensitivity = atapiId.FreeFallSensitivity;
|
||||
report.ATAPI.FreeFallSensitivitySpecified = true;
|
||||
}
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(atapiId.FirmwareRevision))
|
||||
{
|
||||
report.ATAPI.FirmwareRevision = atapiId.FirmwareRevision;
|
||||
report.ATAPI.FirmwareRevision = atapiId.FirmwareRevision;
|
||||
report.ATAPI.FirmwareRevisionSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.GeneralConfiguration != 0)
|
||||
{
|
||||
report.ATAPI.GeneralConfiguration = atapiId.GeneralConfiguration;
|
||||
report.ATAPI.GeneralConfiguration = atapiId.GeneralConfiguration;
|
||||
report.ATAPI.GeneralConfigurationSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.HardwareResetResult != 0)
|
||||
{
|
||||
report.ATAPI.HardwareResetResult = atapiId.HardwareResetResult;
|
||||
report.ATAPI.HardwareResetResult = atapiId.HardwareResetResult;
|
||||
report.ATAPI.HardwareResetResultSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.InterseekDelay != 0)
|
||||
{
|
||||
report.ATAPI.InterseekDelay = atapiId.InterseekDelay;
|
||||
report.ATAPI.InterseekDelay = atapiId.InterseekDelay;
|
||||
report.ATAPI.InterseekDelaySpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.MajorVersion != 0)
|
||||
{
|
||||
report.ATAPI.MajorVersion = atapiId.MajorVersion;
|
||||
report.ATAPI.MajorVersion = atapiId.MajorVersion;
|
||||
report.ATAPI.MajorVersionSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.MasterPasswordRevisionCode != 0)
|
||||
{
|
||||
report.ATAPI.MasterPasswordRevisionCode = atapiId.MasterPasswordRevisionCode;
|
||||
report.ATAPI.MasterPasswordRevisionCode = atapiId.MasterPasswordRevisionCode;
|
||||
report.ATAPI.MasterPasswordRevisionCodeSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.MaxDownloadMicroMode3 != 0)
|
||||
{
|
||||
report.ATAPI.MaxDownloadMicroMode3 = atapiId.MaxDownloadMicroMode3;
|
||||
report.ATAPI.MaxDownloadMicroMode3 = atapiId.MaxDownloadMicroMode3;
|
||||
report.ATAPI.MaxDownloadMicroMode3Specified = true;
|
||||
}
|
||||
|
||||
if(atapiId.MaxQueueDepth != 0)
|
||||
{
|
||||
report.ATAPI.MaxQueueDepth = atapiId.MaxQueueDepth;
|
||||
report.ATAPI.MaxQueueDepth = atapiId.MaxQueueDepth;
|
||||
report.ATAPI.MaxQueueDepthSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.MDMAActive != 0)
|
||||
{
|
||||
report.ATAPI.MDMAActive = atapiId.MDMAActive;
|
||||
report.ATAPI.MDMAActive = atapiId.MDMAActive;
|
||||
report.ATAPI.MDMAActiveSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.MDMASupported != 0)
|
||||
{
|
||||
report.ATAPI.MDMASupported = atapiId.MDMASupported;
|
||||
report.ATAPI.MDMASupported = atapiId.MDMASupported;
|
||||
report.ATAPI.MDMASupportedSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.MinDownloadMicroMode3 != 0)
|
||||
{
|
||||
report.ATAPI.MinDownloadMicroMode3 = atapiId.MinDownloadMicroMode3;
|
||||
report.ATAPI.MinDownloadMicroMode3 = atapiId.MinDownloadMicroMode3;
|
||||
report.ATAPI.MinDownloadMicroMode3Specified = true;
|
||||
}
|
||||
|
||||
if(atapiId.MinMDMACycleTime != 0)
|
||||
{
|
||||
report.ATAPI.MinMDMACycleTime = atapiId.MinMDMACycleTime;
|
||||
report.ATAPI.MinMDMACycleTime = atapiId.MinMDMACycleTime;
|
||||
report.ATAPI.MinMDMACycleTimeSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.MinorVersion != 0)
|
||||
{
|
||||
report.ATAPI.MinorVersion = atapiId.MinorVersion;
|
||||
report.ATAPI.MinorVersion = atapiId.MinorVersion;
|
||||
report.ATAPI.MinorVersionSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.MinPIOCycleTimeNoFlow != 0)
|
||||
{
|
||||
report.ATAPI.MinPIOCycleTimeNoFlow = atapiId.MinPIOCycleTimeNoFlow;
|
||||
report.ATAPI.MinPIOCycleTimeNoFlow = atapiId.MinPIOCycleTimeNoFlow;
|
||||
report.ATAPI.MinPIOCycleTimeNoFlowSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.MinPIOCycleTimeFlow != 0)
|
||||
{
|
||||
report.ATAPI.MinPIOCycleTimeFlow = atapiId.MinPIOCycleTimeFlow;
|
||||
report.ATAPI.MinPIOCycleTimeFlow = atapiId.MinPIOCycleTimeFlow;
|
||||
report.ATAPI.MinPIOCycleTimeFlowSpecified = true;
|
||||
}
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(atapiId.Model))
|
||||
{
|
||||
report.ATAPI.Model = atapiId.Model;
|
||||
report.ATAPI.Model = atapiId.Model;
|
||||
report.ATAPI.ModelSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.MultipleMaxSectors != 0)
|
||||
{
|
||||
report.ATAPI.MultipleMaxSectors = atapiId.MultipleMaxSectors;
|
||||
report.ATAPI.MultipleMaxSectors = atapiId.MultipleMaxSectors;
|
||||
report.ATAPI.MultipleMaxSectorsSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.MultipleSectorNumber != 0)
|
||||
{
|
||||
report.ATAPI.MultipleSectorNumber = atapiId.MultipleSectorNumber;
|
||||
report.ATAPI.MultipleSectorNumber = atapiId.MultipleSectorNumber;
|
||||
report.ATAPI.MultipleSectorNumberSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.NVCacheCaps != 0)
|
||||
{
|
||||
report.ATAPI.NVCacheCaps = atapiId.NVCacheCaps;
|
||||
report.ATAPI.NVCacheCaps = atapiId.NVCacheCaps;
|
||||
report.ATAPI.NVCacheCapsSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.NVCacheSize != 0)
|
||||
{
|
||||
report.ATAPI.NVCacheSize = atapiId.NVCacheSize;
|
||||
report.ATAPI.NVCacheSize = atapiId.NVCacheSize;
|
||||
report.ATAPI.NVCacheSizeSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.NVCacheWriteSpeed != 0)
|
||||
{
|
||||
report.ATAPI.NVCacheWriteSpeed = atapiId.NVCacheWriteSpeed;
|
||||
report.ATAPI.NVCacheWriteSpeed = atapiId.NVCacheWriteSpeed;
|
||||
report.ATAPI.NVCacheWriteSpeedSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.NVEstimatedSpinUp != 0)
|
||||
{
|
||||
report.ATAPI.NVEstimatedSpinUp = atapiId.NVEstimatedSpinUp;
|
||||
report.ATAPI.NVEstimatedSpinUp = atapiId.NVEstimatedSpinUp;
|
||||
report.ATAPI.NVEstimatedSpinUpSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.PacketBusRelease != 0)
|
||||
{
|
||||
report.ATAPI.PacketBusRelease = atapiId.PacketBusRelease;
|
||||
report.ATAPI.PacketBusRelease = atapiId.PacketBusRelease;
|
||||
report.ATAPI.PacketBusReleaseSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.PIOTransferTimingMode != 0)
|
||||
{
|
||||
report.ATAPI.PIOTransferTimingMode = atapiId.PIOTransferTimingMode;
|
||||
report.ATAPI.PIOTransferTimingMode = atapiId.PIOTransferTimingMode;
|
||||
report.ATAPI.PIOTransferTimingModeSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.RecommendedAAM != 0)
|
||||
{
|
||||
report.ATAPI.RecommendedAAM = atapiId.RecommendedAAM;
|
||||
report.ATAPI.RecommendedAAM = atapiId.RecommendedAAM;
|
||||
report.ATAPI.RecommendedAAMSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.RecMDMACycleTime != 0)
|
||||
{
|
||||
report.ATAPI.RecommendedMDMACycleTime = atapiId.RecMDMACycleTime;
|
||||
report.ATAPI.RecommendedMDMACycleTime = atapiId.RecMDMACycleTime;
|
||||
report.ATAPI.RecommendedMDMACycleTimeSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.RemovableStatusSet != 0)
|
||||
{
|
||||
report.ATAPI.RemovableStatusSet = atapiId.RemovableStatusSet;
|
||||
report.ATAPI.RemovableStatusSet = atapiId.RemovableStatusSet;
|
||||
report.ATAPI.RemovableStatusSetSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.SATACapabilities != 0)
|
||||
{
|
||||
report.ATAPI.SATACapabilities = atapiId.SATACapabilities;
|
||||
report.ATAPI.SATACapabilities = atapiId.SATACapabilities;
|
||||
report.ATAPI.SATACapabilitiesSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.SATACapabilities2 != 0)
|
||||
{
|
||||
report.ATAPI.SATACapabilities2 = atapiId.SATACapabilities2;
|
||||
report.ATAPI.SATACapabilities2 = atapiId.SATACapabilities2;
|
||||
report.ATAPI.SATACapabilities2Specified = true;
|
||||
}
|
||||
|
||||
if(atapiId.SATAFeatures != 0)
|
||||
{
|
||||
report.ATAPI.SATAFeatures = atapiId.SATAFeatures;
|
||||
report.ATAPI.SATAFeatures = atapiId.SATAFeatures;
|
||||
report.ATAPI.SATAFeaturesSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.SCTCommandTransport != 0)
|
||||
{
|
||||
report.ATAPI.SCTCommandTransport = atapiId.SCTCommandTransport;
|
||||
report.ATAPI.SCTCommandTransport = atapiId.SCTCommandTransport;
|
||||
report.ATAPI.SCTCommandTransportSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.SectorsPerCard != 0)
|
||||
{
|
||||
report.ATAPI.SectorsPerCard = atapiId.SectorsPerCard;
|
||||
report.ATAPI.SectorsPerCard = atapiId.SectorsPerCard;
|
||||
report.ATAPI.SectorsPerCardSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.SecurityEraseTime != 0)
|
||||
{
|
||||
report.ATAPI.SecurityEraseTime = atapiId.SecurityEraseTime;
|
||||
report.ATAPI.SecurityEraseTime = atapiId.SecurityEraseTime;
|
||||
report.ATAPI.SecurityEraseTimeSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.SecurityStatus != 0)
|
||||
{
|
||||
report.ATAPI.SecurityStatus = atapiId.SecurityStatus;
|
||||
report.ATAPI.SecurityStatus = atapiId.SecurityStatus;
|
||||
report.ATAPI.SecurityStatusSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.ServiceBusyClear != 0)
|
||||
{
|
||||
report.ATAPI.ServiceBusyClear = atapiId.ServiceBusyClear;
|
||||
report.ATAPI.ServiceBusyClear = atapiId.ServiceBusyClear;
|
||||
report.ATAPI.ServiceBusyClearSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.SpecificConfiguration != 0)
|
||||
{
|
||||
report.ATAPI.SpecificConfiguration = atapiId.SpecificConfiguration;
|
||||
report.ATAPI.SpecificConfiguration = atapiId.SpecificConfiguration;
|
||||
report.ATAPI.SpecificConfigurationSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.StreamAccessLatency != 0)
|
||||
{
|
||||
report.ATAPI.StreamAccessLatency = atapiId.StreamAccessLatency;
|
||||
report.ATAPI.StreamAccessLatency = atapiId.StreamAccessLatency;
|
||||
report.ATAPI.StreamAccessLatencySpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.StreamMinReqSize != 0)
|
||||
{
|
||||
report.ATAPI.StreamMinReqSize = atapiId.StreamMinReqSize;
|
||||
report.ATAPI.StreamMinReqSize = atapiId.StreamMinReqSize;
|
||||
report.ATAPI.StreamMinReqSizeSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.StreamPerformanceGranularity != 0)
|
||||
{
|
||||
report.ATAPI.StreamPerformanceGranularity = atapiId.StreamPerformanceGranularity;
|
||||
report.ATAPI.StreamPerformanceGranularity = atapiId.StreamPerformanceGranularity;
|
||||
report.ATAPI.StreamPerformanceGranularitySpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.StreamTransferTimeDMA != 0)
|
||||
{
|
||||
report.ATAPI.StreamTransferTimeDMA = atapiId.StreamTransferTimeDMA;
|
||||
report.ATAPI.StreamTransferTimeDMA = atapiId.StreamTransferTimeDMA;
|
||||
report.ATAPI.StreamTransferTimeDMASpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.StreamTransferTimePIO != 0)
|
||||
{
|
||||
report.ATAPI.StreamTransferTimePIO = atapiId.StreamTransferTimePIO;
|
||||
report.ATAPI.StreamTransferTimePIO = atapiId.StreamTransferTimePIO;
|
||||
report.ATAPI.StreamTransferTimePIOSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.TransportMajorVersion != 0)
|
||||
{
|
||||
report.ATAPI.TransportMajorVersion = atapiId.TransportMajorVersion;
|
||||
report.ATAPI.TransportMajorVersion = atapiId.TransportMajorVersion;
|
||||
report.ATAPI.TransportMajorVersionSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.TransportMinorVersion != 0)
|
||||
{
|
||||
report.ATAPI.TransportMinorVersion = atapiId.TransportMinorVersion;
|
||||
report.ATAPI.TransportMinorVersion = atapiId.TransportMinorVersion;
|
||||
report.ATAPI.TransportMinorVersionSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.TrustedComputing != 0)
|
||||
{
|
||||
report.ATAPI.TrustedComputing = atapiId.TrustedComputing;
|
||||
report.ATAPI.TrustedComputing = atapiId.TrustedComputing;
|
||||
report.ATAPI.TrustedComputingSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.UDMAActive != 0)
|
||||
{
|
||||
report.ATAPI.UDMAActive = atapiId.UDMAActive;
|
||||
report.ATAPI.UDMAActive = atapiId.UDMAActive;
|
||||
report.ATAPI.UDMAActiveSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.UDMASupported != 0)
|
||||
{
|
||||
report.ATAPI.UDMASupported = atapiId.UDMASupported;
|
||||
report.ATAPI.UDMASupported = atapiId.UDMASupported;
|
||||
report.ATAPI.UDMASupportedSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.WRVMode != 0)
|
||||
{
|
||||
report.ATAPI.WRVMode = atapiId.WRVMode;
|
||||
report.ATAPI.WRVMode = atapiId.WRVMode;
|
||||
report.ATAPI.WRVModeSpecified = true;
|
||||
}
|
||||
|
||||
if(atapiId.WRVSectorCountMode3 != 0)
|
||||
{
|
||||
report.ATAPI.WRVSectorCountMode3 = atapiId.WRVSectorCountMode3;
|
||||
report.ATAPI.WRVSectorCountMode3 = atapiId.WRVSectorCountMode3;
|
||||
report.ATAPI.WRVSectorCountMode3Specified = true;
|
||||
}
|
||||
|
||||
if(atapiId.WRVSectorCountMode2 != 0)
|
||||
{
|
||||
report.ATAPI.WRVSectorCountMode2 = atapiId.WRVSectorCountMode2;
|
||||
report.ATAPI.WRVSectorCountMode2 = atapiId.WRVSectorCountMode2;
|
||||
report.ATAPI.WRVSectorCountMode2Specified = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(debug) report.ATAPI.Identify = buffer;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,9 +65,9 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
report.FireWire = new firewireType
|
||||
{
|
||||
Manufacturer = dev.FireWireVendorName,
|
||||
Product = dev.FireWireModelName,
|
||||
ProductID = dev.FireWireModel,
|
||||
VendorID = dev.FireWireVendor
|
||||
Product = dev.FireWireModelName,
|
||||
ProductID = dev.FireWireModel,
|
||||
VendorID = dev.FireWireVendor
|
||||
};
|
||||
|
||||
pressedKey = new ConsoleKeyInfo();
|
||||
@@ -79,7 +79,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
}
|
||||
|
||||
report.FireWire.RemovableMedia = pressedKey.Key == ConsoleKey.Y;
|
||||
removable = report.FireWire.RemovableMedia;
|
||||
removable = report.FireWire.RemovableMedia;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -60,22 +60,24 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
|
||||
if(manfid != null)
|
||||
{
|
||||
report.PCMCIA.ManufacturerCode = manfid.ManufacturerID;
|
||||
report.PCMCIA.CardCode = manfid.CardID;
|
||||
report.PCMCIA.ManufacturerCode = manfid.ManufacturerID;
|
||||
report.PCMCIA.CardCode = manfid.CardID;
|
||||
report.PCMCIA.ManufacturerCodeSpecified = true;
|
||||
report.PCMCIA.CardCodeSpecified = true;
|
||||
report.PCMCIA.CardCodeSpecified = true;
|
||||
}
|
||||
|
||||
break;
|
||||
case TupleCodes.CISTPL_VERS_1:
|
||||
Level1VersionTuple vers = CIS.DecodeLevel1VersionTuple(tuple);
|
||||
|
||||
if(vers != null)
|
||||
{
|
||||
report.PCMCIA.Manufacturer = vers.Manufacturer;
|
||||
report.PCMCIA.ProductName = vers.Product;
|
||||
report.PCMCIA.Compliance = $"{vers.MajorVersion}.{vers.MinorVersion}";
|
||||
report.PCMCIA.Manufacturer = vers.Manufacturer;
|
||||
report.PCMCIA.ProductName = vers.Product;
|
||||
report.PCMCIA.Compliance = $"{vers.MajorVersion}.{vers.MinorVersion}";
|
||||
report.PCMCIA.AdditionalInformation = vers.AdditionalInformation;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,8 +59,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
{
|
||||
if(report == null) return;
|
||||
|
||||
bool sense;
|
||||
const uint TIMEOUT = 5;
|
||||
bool sense;
|
||||
const uint TIMEOUT = 5;
|
||||
ConsoleKeyInfo pressedKey;
|
||||
|
||||
if(dev.IsUsb) Usb.Report(dev, ref report, debug, ref removable);
|
||||
@@ -98,29 +98,34 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
|
||||
if(inq.DeviceTypeModifier != 0)
|
||||
{
|
||||
report.SCSI.Inquiry.DeviceTypeModifier = inq.DeviceTypeModifier;
|
||||
report.SCSI.Inquiry.DeviceTypeModifier = inq.DeviceTypeModifier;
|
||||
report.SCSI.Inquiry.DeviceTypeModifierSpecified = true;
|
||||
}
|
||||
|
||||
if(inq.ISOVersion != 0)
|
||||
{
|
||||
report.SCSI.Inquiry.ISOVersion = inq.ISOVersion;
|
||||
report.SCSI.Inquiry.ISOVersion = inq.ISOVersion;
|
||||
report.SCSI.Inquiry.ISOVersionSpecified = true;
|
||||
}
|
||||
|
||||
if(inq.ECMAVersion != 0)
|
||||
{
|
||||
report.SCSI.Inquiry.ECMAVersion = inq.ECMAVersion;
|
||||
report.SCSI.Inquiry.ECMAVersion = inq.ECMAVersion;
|
||||
report.SCSI.Inquiry.ECMAVersionSpecified = true;
|
||||
}
|
||||
|
||||
if(inq.ANSIVersion != 0)
|
||||
{
|
||||
report.SCSI.Inquiry.ANSIVersion = inq.ANSIVersion;
|
||||
report.SCSI.Inquiry.ANSIVersion = inq.ANSIVersion;
|
||||
report.SCSI.Inquiry.ANSIVersionSpecified = true;
|
||||
}
|
||||
|
||||
if(inq.ResponseDataFormat != 0)
|
||||
{
|
||||
report.SCSI.Inquiry.ResponseDataFormat = inq.ResponseDataFormat;
|
||||
report.SCSI.Inquiry.ResponseDataFormat = inq.ResponseDataFormat;
|
||||
report.SCSI.Inquiry.ResponseDataFormatSpecified = true;
|
||||
}
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(StringHandlers.CToString(inq.VendorIdentification)))
|
||||
{
|
||||
report.SCSI.Inquiry.VendorIdentification =
|
||||
@@ -128,6 +133,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(!string.IsNullOrWhiteSpace(report.SCSI.Inquiry.VendorIdentification))
|
||||
report.SCSI.Inquiry.VendorIdentificationSpecified = true;
|
||||
}
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(StringHandlers.CToString(inq.ProductIdentification)))
|
||||
{
|
||||
report.SCSI.Inquiry.ProductIdentification =
|
||||
@@ -135,6 +141,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(!string.IsNullOrWhiteSpace(report.SCSI.Inquiry.ProductIdentification))
|
||||
report.SCSI.Inquiry.ProductIdentificationSpecified = true;
|
||||
}
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(StringHandlers.CToString(inq.ProductRevisionLevel)))
|
||||
{
|
||||
report.SCSI.Inquiry.ProductRevisionLevel =
|
||||
@@ -142,6 +149,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(!string.IsNullOrWhiteSpace(report.SCSI.Inquiry.ProductRevisionLevel))
|
||||
report.SCSI.Inquiry.ProductRevisionLevelSpecified = true;
|
||||
}
|
||||
|
||||
if(inq.VersionDescriptors != null)
|
||||
{
|
||||
versionDescriptors.AddRange(inq.VersionDescriptors.Where(descriptor => descriptor != 0));
|
||||
@@ -150,37 +158,37 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
report.SCSI.Inquiry.VersionDescriptors = versionDescriptors.ToArray();
|
||||
}
|
||||
|
||||
report.SCSI.Inquiry.PeripheralQualifier = (PeripheralQualifiers)inq.PeripheralQualifier;
|
||||
report.SCSI.Inquiry.PeripheralDeviceType = (PeripheralDeviceTypes)inq.PeripheralDeviceType;
|
||||
report.SCSI.Inquiry.PeripheralQualifier = (PeripheralQualifiers)inq.PeripheralQualifier;
|
||||
report.SCSI.Inquiry.PeripheralDeviceType = (PeripheralDeviceTypes)inq.PeripheralDeviceType;
|
||||
report.SCSI.Inquiry.AsymmetricalLUNAccess = (TGPSValues)inq.TPGS;
|
||||
report.SCSI.Inquiry.SPIClocking = (SPIClocking)inq.Clocking;
|
||||
report.SCSI.Inquiry.SPIClocking = (SPIClocking)inq.Clocking;
|
||||
|
||||
report.SCSI.Inquiry.AccessControlCoordinator = inq.ACC;
|
||||
report.SCSI.Inquiry.ACKRequests = inq.ACKREQQ;
|
||||
report.SCSI.Inquiry.AERCSupported = inq.AERC;
|
||||
report.SCSI.Inquiry.Address16 = inq.Addr16;
|
||||
report.SCSI.Inquiry.Address32 = inq.Addr32;
|
||||
report.SCSI.Inquiry.BasicQueueing = inq.BQue;
|
||||
report.SCSI.Inquiry.EnclosureServices = inq.EncServ;
|
||||
report.SCSI.Inquiry.HierarchicalLUN = inq.HiSup;
|
||||
report.SCSI.Inquiry.IUS = inq.IUS;
|
||||
report.SCSI.Inquiry.LinkedCommands = inq.Linked;
|
||||
report.SCSI.Inquiry.MediumChanger = inq.MChngr;
|
||||
report.SCSI.Inquiry.MultiPortDevice = inq.MultiP;
|
||||
report.SCSI.Inquiry.NormalACA = inq.NormACA;
|
||||
report.SCSI.Inquiry.Protection = inq.Protect;
|
||||
report.SCSI.Inquiry.QAS = inq.QAS;
|
||||
report.SCSI.Inquiry.RelativeAddressing = inq.RelAddr;
|
||||
report.SCSI.Inquiry.Removable = inq.RMB;
|
||||
report.SCSI.Inquiry.TaggedCommandQueue = inq.CmdQue;
|
||||
report.SCSI.Inquiry.TerminateTaskSupported = inq.TrmTsk;
|
||||
report.SCSI.Inquiry.ThirdPartyCopy = inq.ThreePC;
|
||||
report.SCSI.Inquiry.TranferDisable = inq.TranDis;
|
||||
report.SCSI.Inquiry.SoftReset = inq.SftRe;
|
||||
report.SCSI.Inquiry.StorageArrayController = inq.SCCS;
|
||||
report.SCSI.Inquiry.SyncTransfer = inq.Sync;
|
||||
report.SCSI.Inquiry.WideBus16 = inq.WBus16;
|
||||
report.SCSI.Inquiry.WideBus32 = inq.WBus32;
|
||||
report.SCSI.Inquiry.ACKRequests = inq.ACKREQQ;
|
||||
report.SCSI.Inquiry.AERCSupported = inq.AERC;
|
||||
report.SCSI.Inquiry.Address16 = inq.Addr16;
|
||||
report.SCSI.Inquiry.Address32 = inq.Addr32;
|
||||
report.SCSI.Inquiry.BasicQueueing = inq.BQue;
|
||||
report.SCSI.Inquiry.EnclosureServices = inq.EncServ;
|
||||
report.SCSI.Inquiry.HierarchicalLUN = inq.HiSup;
|
||||
report.SCSI.Inquiry.IUS = inq.IUS;
|
||||
report.SCSI.Inquiry.LinkedCommands = inq.Linked;
|
||||
report.SCSI.Inquiry.MediumChanger = inq.MChngr;
|
||||
report.SCSI.Inquiry.MultiPortDevice = inq.MultiP;
|
||||
report.SCSI.Inquiry.NormalACA = inq.NormACA;
|
||||
report.SCSI.Inquiry.Protection = inq.Protect;
|
||||
report.SCSI.Inquiry.QAS = inq.QAS;
|
||||
report.SCSI.Inquiry.RelativeAddressing = inq.RelAddr;
|
||||
report.SCSI.Inquiry.Removable = inq.RMB;
|
||||
report.SCSI.Inquiry.TaggedCommandQueue = inq.CmdQue;
|
||||
report.SCSI.Inquiry.TerminateTaskSupported = inq.TrmTsk;
|
||||
report.SCSI.Inquiry.ThirdPartyCopy = inq.ThreePC;
|
||||
report.SCSI.Inquiry.TranferDisable = inq.TranDis;
|
||||
report.SCSI.Inquiry.SoftReset = inq.SftRe;
|
||||
report.SCSI.Inquiry.StorageArrayController = inq.SCCS;
|
||||
report.SCSI.Inquiry.SyncTransfer = inq.Sync;
|
||||
report.SCSI.Inquiry.WideBus16 = inq.WBus16;
|
||||
report.SCSI.Inquiry.WideBus32 = inq.WBus32;
|
||||
|
||||
if(debug) report.SCSI.Inquiry.Data = buffer;
|
||||
}
|
||||
@@ -227,7 +235,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
System.Console.ReadKey(true);
|
||||
}
|
||||
|
||||
Modes.DecodedMode? decMode = null;
|
||||
Modes.DecodedMode? decMode = null;
|
||||
PeripheralDeviceTypes devType = dev.ScsiType;
|
||||
|
||||
DicConsole.WriteLine("Querying all mode pages and subpages using SCSI MODE SENSE (10)...");
|
||||
@@ -240,16 +248,16 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
ScsiModeSensePageControl.Default, 0x3F, 0x00, TIMEOUT, out _);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense10 = true;
|
||||
report.SCSI.SupportsModeSense10 = true;
|
||||
report.SCSI.SupportsModeSubpages = false;
|
||||
decMode = Modes.DecodeMode10(mode10Buffer, devType);
|
||||
decMode = Modes.DecodeMode10(mode10Buffer, devType);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
report.SCSI.SupportsModeSense10 = true;
|
||||
report.SCSI.SupportsModeSense10 = true;
|
||||
report.SCSI.SupportsModeSubpages = true;
|
||||
decMode = Modes.DecodeMode10(mode10Buffer, devType);
|
||||
decMode = Modes.DecodeMode10(mode10Buffer, devType);
|
||||
}
|
||||
|
||||
DicConsole.WriteLine("Querying all mode pages and subpages using SCSI MODE SENSE (6)...");
|
||||
@@ -274,7 +282,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
|
||||
Modes.ModePage_2A? cdromMode = null;
|
||||
|
||||
if(debug && report.SCSI.SupportsModeSense6) report.SCSI.ModeSense6Data = mode6Buffer;
|
||||
if(debug && report.SCSI.SupportsModeSense6) report.SCSI.ModeSense6Data = mode6Buffer;
|
||||
if(debug && report.SCSI.SupportsModeSense10) report.SCSI.ModeSense10Data = mode10Buffer;
|
||||
|
||||
if(decMode.HasValue)
|
||||
@@ -282,19 +290,19 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
report.SCSI.ModeSense = new modeType
|
||||
{
|
||||
BlankCheckEnabled = decMode.Value.Header.EBC,
|
||||
DPOandFUA = decMode.Value.Header.DPOFUA,
|
||||
WriteProtected = decMode.Value.Header.WriteProtected
|
||||
DPOandFUA = decMode.Value.Header.DPOFUA,
|
||||
WriteProtected = decMode.Value.Header.WriteProtected
|
||||
};
|
||||
|
||||
if(decMode.Value.Header.BufferedMode > 0)
|
||||
{
|
||||
report.SCSI.ModeSense.BufferedMode = decMode.Value.Header.BufferedMode;
|
||||
report.SCSI.ModeSense.BufferedMode = decMode.Value.Header.BufferedMode;
|
||||
report.SCSI.ModeSense.BufferedModeSpecified = true;
|
||||
}
|
||||
|
||||
if(decMode.Value.Header.Speed > 0)
|
||||
{
|
||||
report.SCSI.ModeSense.Speed = decMode.Value.Header.Speed;
|
||||
report.SCSI.ModeSense.Speed = decMode.Value.Header.Speed;
|
||||
report.SCSI.ModeSense.SpeedSpecified = true;
|
||||
}
|
||||
|
||||
@@ -305,9 +313,9 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
{
|
||||
modePageType modePage = new modePageType
|
||||
{
|
||||
page = page.Page,
|
||||
page = page.Page,
|
||||
subpage = page.Subpage,
|
||||
value = page.PageResponse
|
||||
value = page.PageResponse
|
||||
};
|
||||
modePages.Add(modePage);
|
||||
|
||||
@@ -357,8 +365,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
mediaTest.Model = System.Console.ReadLine();
|
||||
|
||||
mediaTest.ManufacturerSpecified = true;
|
||||
mediaTest.ModelSpecified = true;
|
||||
mediaTest.MediaIsRecognized = true;
|
||||
mediaTest.ModelSpecified = true;
|
||||
mediaTest.MediaIsRecognized = true;
|
||||
|
||||
sense = dev.ScsiTestUnitReady(out senseBuffer, TIMEOUT, out _);
|
||||
if(sense)
|
||||
@@ -401,7 +409,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
|
||||
if(mediaTest.MediaIsRecognized)
|
||||
{
|
||||
mediaTest.SupportsReadCapacitySpecified = true;
|
||||
mediaTest.SupportsReadCapacitySpecified = true;
|
||||
mediaTest.SupportsReadCapacity16Specified = true;
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI READ CAPACITY...");
|
||||
@@ -414,7 +422,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
1;
|
||||
mediaTest.BlockSize =
|
||||
(uint)((buffer[4] << 24) + (buffer[5] << 16) + (buffer[6] << 8) + buffer[7]);
|
||||
mediaTest.BlocksSpecified = true;
|
||||
mediaTest.BlocksSpecified = true;
|
||||
mediaTest.BlockSizeSpecified = true;
|
||||
}
|
||||
|
||||
@@ -429,7 +437,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
mediaTest.Blocks = BitConverter.ToUInt64(temp, 0) + 1;
|
||||
mediaTest.BlockSize =
|
||||
(uint)((buffer[8] << 24) + (buffer[9] << 16) + (buffer[10] << 8) + buffer[11]);
|
||||
mediaTest.BlocksSpecified = true;
|
||||
mediaTest.BlocksSpecified = true;
|
||||
mediaTest.BlockSizeSpecified = true;
|
||||
}
|
||||
|
||||
@@ -441,7 +449,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense10 = true;
|
||||
decMode = Modes.DecodeMode10(buffer, dev.ScsiType);
|
||||
decMode = Modes.DecodeMode10(buffer, dev.ScsiType);
|
||||
if(debug) mediaTest.ModeSense10Data = buffer;
|
||||
}
|
||||
|
||||
@@ -450,26 +458,27 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense6 = true;
|
||||
if(!decMode.HasValue) decMode = Modes.DecodeMode6(buffer, dev.ScsiType);
|
||||
if(!decMode.HasValue) decMode = Modes.DecodeMode6(buffer, dev.ScsiType);
|
||||
if(debug) mediaTest.ModeSense6Data = buffer;
|
||||
}
|
||||
|
||||
if(decMode.HasValue)
|
||||
{
|
||||
mediaTest.MediumType = (byte)decMode.Value.Header.MediumType;
|
||||
mediaTest.MediumType = (byte)decMode.Value.Header.MediumType;
|
||||
mediaTest.MediumTypeSpecified = true;
|
||||
if(decMode.Value.Header.BlockDescriptors != null &&
|
||||
if(decMode.Value.Header.BlockDescriptors != null &&
|
||||
decMode.Value.Header.BlockDescriptors.Length > 0)
|
||||
{
|
||||
mediaTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density;
|
||||
mediaTest.Density =
|
||||
(byte)decMode.Value.Header.BlockDescriptors[0].Density;
|
||||
mediaTest.DensitySpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
mediaTest.SupportsReadSpecified = true;
|
||||
mediaTest.SupportsRead10Specified = true;
|
||||
mediaTest.SupportsRead12Specified = true;
|
||||
mediaTest.SupportsRead16Specified = true;
|
||||
mediaTest.SupportsReadSpecified = true;
|
||||
mediaTest.SupportsRead10Specified = true;
|
||||
mediaTest.SupportsRead12Specified = true;
|
||||
mediaTest.SupportsRead16Specified = true;
|
||||
mediaTest.SupportsReadLongSpecified = true;
|
||||
|
||||
DicConsole.WriteLine("Trying SCSI READ (6)...");
|
||||
@@ -520,7 +529,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
FixedSense? decSense = Sense.DecodeFixed(senseBuffer);
|
||||
if(decSense.HasValue)
|
||||
if(decSense.Value.SenseKey == SenseKeys.IllegalRequest &&
|
||||
decSense.Value.ASC == 0x24 && decSense.Value.ASCQ == 0x00)
|
||||
decSense.Value.ASC == 0x24 &&
|
||||
decSense.Value.ASCQ == 0x00)
|
||||
{
|
||||
mediaTest.SupportsReadLong = true;
|
||||
if(decSense.Value.InformationValid && decSense.Value.ILI)
|
||||
@@ -549,8 +559,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
testSize, TIMEOUT, out _);
|
||||
if(sense || dev.Error) continue;
|
||||
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = testSize;
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = testSize;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
break;
|
||||
}
|
||||
@@ -568,8 +578,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
(ushort)i, TIMEOUT, out _);
|
||||
if(sense || dev.Error) continue;
|
||||
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = testSize;
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = testSize;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
break;
|
||||
}
|
||||
@@ -579,8 +589,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
TIMEOUT, out _);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = 2380;
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = 2380;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
}
|
||||
}
|
||||
@@ -590,8 +600,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
TIMEOUT, out _);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = 4760;
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = 4760;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
}
|
||||
}
|
||||
@@ -601,8 +611,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
TIMEOUT, out _);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = 9424;
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = 9424;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
}
|
||||
}
|
||||
@@ -613,7 +623,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
|
||||
{
|
||||
DicConsole
|
||||
.Write("Drive supports SCSI READ LONG but I cannot find the correct size. Do you want me to try? (This can take hours) (Y/N): ");
|
||||
.Write("Drive supports SCSI READ LONG but I cannot find the correct size. Do you want me to try? (This can take hours) (Y/N): ");
|
||||
pressedKey = System.Console.ReadKey();
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
@@ -627,7 +637,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
TIMEOUT, out _);
|
||||
if(!sense)
|
||||
{
|
||||
mediaTest.LongBlockSize = i;
|
||||
mediaTest.LongBlockSize = i;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
break;
|
||||
}
|
||||
@@ -663,11 +673,11 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
}
|
||||
else
|
||||
{
|
||||
report.SCSI.ReadCapabilities = new testedMediaType();
|
||||
report.SCSI.ReadCapabilitiesSpecified = true;
|
||||
report.SCSI.ReadCapabilities = new testedMediaType();
|
||||
report.SCSI.ReadCapabilitiesSpecified = true;
|
||||
report.SCSI.ReadCapabilities.MediaIsRecognized = true;
|
||||
|
||||
report.SCSI.ReadCapabilities.SupportsReadCapacitySpecified = true;
|
||||
report.SCSI.ReadCapabilities.SupportsReadCapacitySpecified = true;
|
||||
report.SCSI.ReadCapabilities.SupportsReadCapacity16Specified = true;
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI READ CAPACITY...");
|
||||
@@ -679,7 +689,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
(ulong)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3]) + 1;
|
||||
report.SCSI.ReadCapabilities.BlockSize =
|
||||
(uint)((buffer[4] << 24) + (buffer[5] << 16) + (buffer[6] << 8) + buffer[7]);
|
||||
report.SCSI.ReadCapabilities.BlocksSpecified = true;
|
||||
report.SCSI.ReadCapabilities.BlocksSpecified = true;
|
||||
report.SCSI.ReadCapabilities.BlockSizeSpecified = true;
|
||||
}
|
||||
|
||||
@@ -694,7 +704,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
report.SCSI.ReadCapabilities.Blocks = BitConverter.ToUInt64(temp, 0) + 1;
|
||||
report.SCSI.ReadCapabilities.BlockSize =
|
||||
(uint)((buffer[8] << 24) + (buffer[9] << 16) + (buffer[10] << 8) + buffer[11]);
|
||||
report.SCSI.ReadCapabilities.BlocksSpecified = true;
|
||||
report.SCSI.ReadCapabilities.BlocksSpecified = true;
|
||||
report.SCSI.ReadCapabilities.BlockSizeSpecified = true;
|
||||
}
|
||||
|
||||
@@ -706,7 +716,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense10 = true;
|
||||
decMode = Modes.DecodeMode10(buffer, dev.ScsiType);
|
||||
decMode = Modes.DecodeMode10(buffer, dev.ScsiType);
|
||||
if(debug) report.SCSI.ReadCapabilities.ModeSense10Data = buffer;
|
||||
}
|
||||
|
||||
@@ -715,15 +725,16 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense6 = true;
|
||||
if(!decMode.HasValue) decMode = Modes.DecodeMode6(buffer, dev.ScsiType);
|
||||
if(!decMode.HasValue)
|
||||
decMode = Modes.DecodeMode6(buffer, dev.ScsiType);
|
||||
if(debug) report.SCSI.ReadCapabilities.ModeSense6Data = buffer;
|
||||
}
|
||||
|
||||
if(decMode.HasValue)
|
||||
{
|
||||
report.SCSI.ReadCapabilities.MediumType = (byte)decMode.Value.Header.MediumType;
|
||||
report.SCSI.ReadCapabilities.MediumType = (byte)decMode.Value.Header.MediumType;
|
||||
report.SCSI.ReadCapabilities.MediumTypeSpecified = true;
|
||||
if(decMode.Value.Header.BlockDescriptors != null &&
|
||||
if(decMode.Value.Header.BlockDescriptors != null &&
|
||||
decMode.Value.Header.BlockDescriptors.Length > 0)
|
||||
{
|
||||
report.SCSI.ReadCapabilities.Density =
|
||||
@@ -732,10 +743,10 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
}
|
||||
}
|
||||
|
||||
report.SCSI.ReadCapabilities.SupportsReadSpecified = true;
|
||||
report.SCSI.ReadCapabilities.SupportsRead10Specified = true;
|
||||
report.SCSI.ReadCapabilities.SupportsRead12Specified = true;
|
||||
report.SCSI.ReadCapabilities.SupportsRead16Specified = true;
|
||||
report.SCSI.ReadCapabilities.SupportsReadSpecified = true;
|
||||
report.SCSI.ReadCapabilities.SupportsRead10Specified = true;
|
||||
report.SCSI.ReadCapabilities.SupportsRead12Specified = true;
|
||||
report.SCSI.ReadCapabilities.SupportsRead16Specified = true;
|
||||
report.SCSI.ReadCapabilities.SupportsReadLongSpecified = true;
|
||||
|
||||
DicConsole.WriteLine("Trying SCSI READ (6)...");
|
||||
@@ -790,7 +801,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
FixedSense? decSense = Sense.DecodeFixed(senseBuffer);
|
||||
if(decSense.HasValue)
|
||||
if(decSense.Value.SenseKey == SenseKeys.IllegalRequest && decSense.Value.ASC == 0x24 &&
|
||||
decSense.Value.ASCQ == 0x00)
|
||||
decSense.Value.ASCQ == 0x00)
|
||||
{
|
||||
report.SCSI.ReadCapabilities.SupportsReadLong = true;
|
||||
if(decSense.Value.InformationValid && decSense.Value.ILI)
|
||||
@@ -820,8 +831,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
TIMEOUT, out _);
|
||||
if(sense || dev.Error) continue;
|
||||
|
||||
report.SCSI.ReadCapabilities.SupportsReadLong = true;
|
||||
report.SCSI.ReadCapabilities.LongBlockSize = testSize;
|
||||
report.SCSI.ReadCapabilities.SupportsReadLong = true;
|
||||
report.SCSI.ReadCapabilities.LongBlockSize = testSize;
|
||||
report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true;
|
||||
break;
|
||||
}
|
||||
@@ -839,8 +850,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
TIMEOUT, out _);
|
||||
if(sense || dev.Error) continue;
|
||||
|
||||
report.SCSI.ReadCapabilities.SupportsReadLong = true;
|
||||
report.SCSI.ReadCapabilities.LongBlockSize = testSize;
|
||||
report.SCSI.ReadCapabilities.SupportsReadLong = true;
|
||||
report.SCSI.ReadCapabilities.LongBlockSize = testSize;
|
||||
report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true;
|
||||
break;
|
||||
}
|
||||
@@ -850,8 +861,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
out _);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.ReadCapabilities.SupportsReadLong = true;
|
||||
report.SCSI.ReadCapabilities.LongBlockSize = 2380;
|
||||
report.SCSI.ReadCapabilities.SupportsReadLong = true;
|
||||
report.SCSI.ReadCapabilities.LongBlockSize = 2380;
|
||||
report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true;
|
||||
}
|
||||
}
|
||||
@@ -861,8 +872,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
out _);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.ReadCapabilities.SupportsReadLong = true;
|
||||
report.SCSI.ReadCapabilities.LongBlockSize = 4760;
|
||||
report.SCSI.ReadCapabilities.SupportsReadLong = true;
|
||||
report.SCSI.ReadCapabilities.LongBlockSize = 4760;
|
||||
report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true;
|
||||
}
|
||||
}
|
||||
@@ -872,8 +883,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
out _);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.ReadCapabilities.SupportsReadLong = true;
|
||||
report.SCSI.ReadCapabilities.LongBlockSize = 9424;
|
||||
report.SCSI.ReadCapabilities.SupportsReadLong = true;
|
||||
report.SCSI.ReadCapabilities.LongBlockSize = 9424;
|
||||
report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true;
|
||||
}
|
||||
}
|
||||
@@ -885,7 +896,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
|
||||
{
|
||||
DicConsole
|
||||
.Write("Drive supports SCSI READ LONG but I cannot find the correct size. Do you want me to try? (This can take hours) (Y/N): ");
|
||||
.Write("Drive supports SCSI READ LONG but I cannot find the correct size. Do you want me to try? (This can take hours) (Y/N): ");
|
||||
pressedKey = System.Console.ReadKey();
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
@@ -906,7 +917,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
bingo.Write(buffer, 0, buffer.Length);
|
||||
bingo.Close();
|
||||
}
|
||||
report.SCSI.ReadCapabilities.LongBlockSize = i;
|
||||
|
||||
report.SCSI.ReadCapabilities.LongBlockSize = i;
|
||||
report.SCSI.ReadCapabilities.LongBlockSizeSpecified = true;
|
||||
break;
|
||||
}
|
||||
@@ -918,7 +930,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
}
|
||||
}
|
||||
|
||||
if(debug && report.SCSI.ReadCapabilities.SupportsReadLong &&
|
||||
if(debug &&
|
||||
report.SCSI.ReadCapabilities.SupportsReadLong &&
|
||||
report.SCSI.ReadCapabilities.LongBlockSizeSpecified &&
|
||||
report.SCSI.ReadCapabilities.LongBlockSize != report.SCSI.ReadCapabilities.BlockSize)
|
||||
{
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
{
|
||||
if(report == null) return;
|
||||
|
||||
bool sense;
|
||||
bool sense;
|
||||
const uint TIMEOUT = 5;
|
||||
|
||||
List<string> mediaTypes = new List<string>();
|
||||
@@ -70,41 +70,49 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A = new mmcModeType();
|
||||
if(cdromMode.Value.BufferSize != 0)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.BufferSize = cdromMode.Value.BufferSize;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.BufferSize = cdromMode.Value.BufferSize;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.BufferSizeSpecified = true;
|
||||
}
|
||||
|
||||
if(cdromMode.Value.CurrentSpeed != 0)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CurrentSpeed = cdromMode.Value.CurrentSpeed;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CurrentSpeed = cdromMode.Value.CurrentSpeed;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CurrentSpeedSpecified = true;
|
||||
}
|
||||
|
||||
if(cdromMode.Value.CurrentWriteSpeed != 0)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CurrentWriteSpeed = cdromMode.Value.CurrentWriteSpeed;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CurrentWriteSpeed =
|
||||
cdromMode.Value.CurrentWriteSpeed;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CurrentWriteSpeedSpecified = true;
|
||||
}
|
||||
|
||||
if(cdromMode.Value.CurrentWriteSpeedSelected != 0)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CurrentWriteSpeedSelected =
|
||||
cdromMode.Value.CurrentWriteSpeedSelected;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CurrentWriteSpeedSelectedSpecified = true;
|
||||
}
|
||||
|
||||
if(cdromMode.Value.MaximumSpeed != 0)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.MaximumSpeed = cdromMode.Value.MaximumSpeed;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.MaximumSpeed = cdromMode.Value.MaximumSpeed;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.MaximumSpeedSpecified = true;
|
||||
}
|
||||
|
||||
if(cdromMode.Value.MaxWriteSpeed != 0)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.MaximumWriteSpeed = cdromMode.Value.MaxWriteSpeed;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.MaximumWriteSpeed = cdromMode.Value.MaxWriteSpeed;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.MaximumWriteSpeedSpecified = true;
|
||||
}
|
||||
|
||||
if(cdromMode.Value.RotationControlSelected != 0)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.RotationControlSelected =
|
||||
cdromMode.Value.RotationControlSelected;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.RotationControlSelectedSpecified = true;
|
||||
}
|
||||
|
||||
if(cdromMode.Value.SupportedVolumeLevels != 0)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.SupportedVolumeLevels =
|
||||
@@ -112,49 +120,49 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.SupportedVolumeLevelsSpecified = true;
|
||||
}
|
||||
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.AccurateCDDA = cdromMode.Value.AccurateCDDA;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.BCK = cdromMode.Value.BCK;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.AccurateCDDA = cdromMode.Value.AccurateCDDA;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.BCK = cdromMode.Value.BCK;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.BufferUnderRunProtection = cdromMode.Value.BUF;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CanEject = cdromMode.Value.Eject;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CanLockMedia = cdromMode.Value.Lock;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CDDACommand = cdromMode.Value.CDDACommand;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CompositeAudioVideo = cdromMode.Value.Composite;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CSSandCPPMSupported = cdromMode.Value.CMRSupported == 1;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CanEject = cdromMode.Value.Eject;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CanLockMedia = cdromMode.Value.Lock;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CDDACommand = cdromMode.Value.CDDACommand;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CompositeAudioVideo = cdromMode.Value.Composite;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.CSSandCPPMSupported = cdromMode.Value.CMRSupported == 1;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.DeterministicSlotChanger = cdromMode.Value.SDP;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.DigitalPort1 = cdromMode.Value.DigitalPort1;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.DigitalPort2 = cdromMode.Value.DigitalPort2;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.LeadInPW = cdromMode.Value.LeadInPW;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.LoadingMechanismType = cdromMode.Value.LoadingMechanism;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.LockStatus = cdromMode.Value.LockState;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.LSBF = cdromMode.Value.LSBF;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.PlaysAudio = cdromMode.Value.AudioPlay;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.PreventJumperStatus = cdromMode.Value.PreventJumper;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.RCK = cdromMode.Value.RCK;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsBarcode = cdromMode.Value.ReadBarcode;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsBothSides = cdromMode.Value.SCC;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsCDR = cdromMode.Value.ReadCDR;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsCDRW = cdromMode.Value.ReadCDRW;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.DigitalPort1 = cdromMode.Value.DigitalPort1;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.DigitalPort2 = cdromMode.Value.DigitalPort2;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.LeadInPW = cdromMode.Value.LeadInPW;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.LoadingMechanismType = cdromMode.Value.LoadingMechanism;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.LockStatus = cdromMode.Value.LockState;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.LSBF = cdromMode.Value.LSBF;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.PlaysAudio = cdromMode.Value.AudioPlay;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.PreventJumperStatus = cdromMode.Value.PreventJumper;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.RCK = cdromMode.Value.RCK;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsBarcode = cdromMode.Value.ReadBarcode;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsBothSides = cdromMode.Value.SCC;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsCDR = cdromMode.Value.ReadCDR;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsCDRW = cdromMode.Value.ReadCDRW;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsDeinterlavedSubchannel =
|
||||
cdromMode.Value.DeinterlaveSubchannel;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsDVDR = cdromMode.Value.ReadDVDR;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsDVDRAM = cdromMode.Value.ReadDVDRAM;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsDVDROM = cdromMode.Value.ReadDVDROM;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsISRC = cdromMode.Value.ISRC;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsMode2Form2 = cdromMode.Value.Mode2Form2;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsMode2Form1 = cdromMode.Value.Mode2Form1;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsPacketCDR = cdromMode.Value.Method2;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsSubchannel = cdromMode.Value.Subchannel;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsUPC = cdromMode.Value.UPC;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReturnsC2Pointers = cdromMode.Value.C2Pointer;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.SeparateChannelMute = cdromMode.Value.SeparateChannelMute;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsDVDR = cdromMode.Value.ReadDVDR;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsDVDRAM = cdromMode.Value.ReadDVDRAM;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsDVDROM = cdromMode.Value.ReadDVDROM;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsISRC = cdromMode.Value.ISRC;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsMode2Form2 = cdromMode.Value.Mode2Form2;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsMode2Form1 = cdromMode.Value.Mode2Form1;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsPacketCDR = cdromMode.Value.Method2;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsSubchannel = cdromMode.Value.Subchannel;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReadsUPC = cdromMode.Value.UPC;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.ReturnsC2Pointers = cdromMode.Value.C2Pointer;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.SeparateChannelMute = cdromMode.Value.SeparateChannelMute;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.SeparateChannelVolume = cdromMode.Value.SeparateChannelVolume;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.SSS = cdromMode.Value.SSS;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.SupportsMultiSession = cdromMode.Value.MultiSession;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.TestWrite = cdromMode.Value.TestWrite;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.WritesCDR = cdromMode.Value.WriteCDR;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.WritesCDRW = cdromMode.Value.WriteCDRW;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.WritesDVDR = cdromMode.Value.WriteDVDR;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.WritesDVDRAM = cdromMode.Value.WriteDVDRAM;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.SSS = cdromMode.Value.SSS;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.SupportsMultiSession = cdromMode.Value.MultiSession;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.TestWrite = cdromMode.Value.TestWrite;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.WritesCDR = cdromMode.Value.WriteCDR;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.WritesCDRW = cdromMode.Value.WriteCDRW;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.WritesDVDR = cdromMode.Value.WriteDVDR;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.WritesDVDRAM = cdromMode.Value.WriteDVDRAM;
|
||||
report.SCSI.MultiMediaDevice.ModeSense2A.WriteSpeedPerformanceDescriptors =
|
||||
cdromMode.Value.WriteSpeedPerformanceDescriptors;
|
||||
|
||||
@@ -196,6 +204,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
report.SCSI.MultiMediaDevice.Features.PhysicalInterfaceStandard =
|
||||
PhysicalInterfaces.Unspecified;
|
||||
}
|
||||
|
||||
report.SCSI.MultiMediaDevice.Features.SupportsDeviceBusyEvent = ftr0001.Value.DBE;
|
||||
}
|
||||
}
|
||||
@@ -208,11 +217,16 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
report.SCSI.MultiMediaDevice.Features.LoadingMechanismType =
|
||||
ftr0003.Value.LoadingMechanismType;
|
||||
report.SCSI.MultiMediaDevice.Features.LoadingMechanismTypeSpecified = true;
|
||||
report.SCSI.MultiMediaDevice.Features.CanLoad = ftr0003.Value.Load;
|
||||
report.SCSI.MultiMediaDevice.Features.CanEject = ftr0003.Value.Eject;
|
||||
report.SCSI.MultiMediaDevice.Features.PreventJumper = ftr0003.Value.PreventJumper;
|
||||
report.SCSI.MultiMediaDevice.Features.DBML = ftr0003.Value.DBML;
|
||||
report.SCSI.MultiMediaDevice.Features.Locked = ftr0003.Value.Lock;
|
||||
report.SCSI.MultiMediaDevice.Features.CanLoad =
|
||||
ftr0003.Value.Load;
|
||||
report.SCSI.MultiMediaDevice.Features.CanEject =
|
||||
ftr0003.Value.Eject;
|
||||
report.SCSI.MultiMediaDevice.Features.PreventJumper =
|
||||
ftr0003.Value.PreventJumper;
|
||||
report.SCSI.MultiMediaDevice.Features.DBML =
|
||||
ftr0003.Value.DBML;
|
||||
report.SCSI.MultiMediaDevice.Features.Locked =
|
||||
ftr0003.Value.Lock;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -223,8 +237,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.SupportsWriteProtectPAC = ftr0004.Value.DWP;
|
||||
report.SCSI.MultiMediaDevice.Features.SupportsWriteInhibitDCB = ftr0004.Value.WDCB;
|
||||
report.SCSI.MultiMediaDevice.Features.SupportsPWP = ftr0004.Value.SPWP;
|
||||
report.SCSI.MultiMediaDevice.Features.SupportsSWPP = ftr0004.Value.SSWPP;
|
||||
report.SCSI.MultiMediaDevice.Features.SupportsPWP = ftr0004.Value.SPWP;
|
||||
report.SCSI.MultiMediaDevice.Features.SupportsSWPP = ftr0004.Value.SSWPP;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -239,12 +253,14 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
ftr0010.Value.LogicalBlockSize;
|
||||
report.SCSI.MultiMediaDevice.Features.LogicalBlockSizeSpecified = true;
|
||||
}
|
||||
|
||||
if(ftr0010.Value.Blocking > 0)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.BlocksPerReadableUnit =
|
||||
ftr0010.Value.Blocking;
|
||||
report.SCSI.MultiMediaDevice.Features.BlocksPerReadableUnitSpecified = true;
|
||||
}
|
||||
|
||||
report.SCSI.MultiMediaDevice.Features.ErrorRecoveryPage = ftr0010.Value.PP;
|
||||
}
|
||||
}
|
||||
@@ -258,8 +274,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
Feature_001E? ftr001E = Features.Decode_001E(desc.Data);
|
||||
if(ftr001E.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.SupportsDAP = ftr001E.Value.DAP;
|
||||
report.SCSI.MultiMediaDevice.Features.SupportsC2 = ftr001E.Value.C2;
|
||||
report.SCSI.MultiMediaDevice.Features.SupportsDAP = ftr001E.Value.DAP;
|
||||
report.SCSI.MultiMediaDevice.Features.SupportsC2 = ftr001E.Value.C2;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadLeadInCDText = ftr001E.Value.CDText;
|
||||
}
|
||||
}
|
||||
@@ -270,9 +286,9 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
Feature_001F? ftr001F = Features.Decode_001F(desc.Data);
|
||||
if(ftr001F.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.DVDMultiRead = ftr001F.Value.MULTI110;
|
||||
report.SCSI.MultiMediaDevice.Features.DVDMultiRead = ftr001F.Value.MULTI110;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadAllDualRW = ftr001F.Value.DualRW;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadAllDualR = ftr001F.Value.DualR;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadAllDualR = ftr001F.Value.DualR;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -288,10 +304,10 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
report.SCSI.MultiMediaDevice.Features.CanFormatBDREWithoutSpare =
|
||||
ftr0023.Value.RENoSA;
|
||||
report.SCSI.MultiMediaDevice.Features.CanExpandBDRESpareArea = ftr0023.Value.Expand;
|
||||
report.SCSI.MultiMediaDevice.Features.CanFormatQCert = ftr0023.Value.QCert;
|
||||
report.SCSI.MultiMediaDevice.Features.CanFormatCert = ftr0023.Value.Cert;
|
||||
report.SCSI.MultiMediaDevice.Features.CanFormatFRF = ftr0023.Value.FRF;
|
||||
report.SCSI.MultiMediaDevice.Features.CanFormatRRM = ftr0023.Value.RRM;
|
||||
report.SCSI.MultiMediaDevice.Features.CanFormatQCert = ftr0023.Value.QCert;
|
||||
report.SCSI.MultiMediaDevice.Features.CanFormatCert = ftr0023.Value.Cert;
|
||||
report.SCSI.MultiMediaDevice.Features.CanFormatFRF = ftr0023.Value.FRF;
|
||||
report.SCSI.MultiMediaDevice.Features.CanFormatRRM = ftr0023.Value.RRM;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -307,9 +323,9 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
Feature_0028? ftr0028 = Features.Decode_0028(desc.Data);
|
||||
if(ftr0028.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusMRW = ftr0028.Value.DVDPRead;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusMRW = ftr0028.Value.DVDPRead;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteDVDPlusMRW = ftr0028.Value.DVDPWrite;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteCDMRW = ftr0028.Value.Write;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteCDMRW = ftr0028.Value.Write;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -340,7 +356,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
ftr002D.Value.RWRaw;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWritePackedSubchannelInTAO =
|
||||
ftr002D.Value.RWPack;
|
||||
report.SCSI.MultiMediaDevice.Features.CanTestWriteInTAO = ftr002D.Value.TestWrite;
|
||||
report.SCSI.MultiMediaDevice.Features.CanTestWriteInTAO =
|
||||
ftr002D.Value.TestWrite;
|
||||
report.SCSI.MultiMediaDevice.Features.CanOverwriteTAOTrack = ftr002D.Value.CDRW;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteRWSubchannelInTAO =
|
||||
ftr002D.Value.RWSubchannel;
|
||||
@@ -354,10 +371,13 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(ftr002E.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.BufferUnderrunFreeInSAO = ftr002E.Value.BUF;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteRawMultiSession = ftr002E.Value.RAWMS;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteRawMultiSession =
|
||||
ftr002E.Value.RAWMS;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteRaw = ftr002E.Value.RAW;
|
||||
report.SCSI.MultiMediaDevice.Features.CanTestWriteInSAO = ftr002E.Value.TestWrite;
|
||||
report.SCSI.MultiMediaDevice.Features.CanOverwriteSAOTrack = ftr002E.Value.CDRW;
|
||||
report.SCSI.MultiMediaDevice.Features.CanTestWriteInSAO =
|
||||
ftr002E.Value.TestWrite;
|
||||
report.SCSI.MultiMediaDevice.Features.CanOverwriteSAOTrack =
|
||||
ftr002E.Value.CDRW;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteRWSubchannelInSAO = ftr002E.Value.RW;
|
||||
}
|
||||
}
|
||||
@@ -369,8 +389,9 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(ftr002F.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.BufferUnderrunFreeInDVD = ftr002F.Value.BUF;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteDVDRDL = ftr002F.Value.RDL;
|
||||
report.SCSI.MultiMediaDevice.Features.CanTestWriteDVD = ftr002F.Value.TestWrite;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteDVDRDL = ftr002F.Value.RDL;
|
||||
report.SCSI.MultiMediaDevice.Features.CanTestWriteDVD =
|
||||
ftr002F.Value.TestWrite;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteDVDRW = ftr002F.Value.DVDRW;
|
||||
}
|
||||
}
|
||||
@@ -417,13 +438,13 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
Feature_0040? ftr0040 = Features.Decode_0040(desc.Data);
|
||||
if(ftr0040.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBluBCA = ftr0040.Value.BCA;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBDRE2 = ftr0040.Value.RE2;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBDRE1 = ftr0040.Value.RE1;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadOldBDRE = ftr0040.Value.OldRE;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBDR = ftr0040.Value.R;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadOldBDR = ftr0040.Value.OldR;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBDROM = ftr0040.Value.ROM;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBluBCA = ftr0040.Value.BCA;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBDRE2 = ftr0040.Value.RE2;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBDRE1 = ftr0040.Value.RE1;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadOldBDRE = ftr0040.Value.OldRE;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBDR = ftr0040.Value.R;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadOldBDR = ftr0040.Value.OldR;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBDROM = ftr0040.Value.ROM;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadOldBDROM = ftr0040.Value.OldROM;
|
||||
}
|
||||
}
|
||||
@@ -434,11 +455,11 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
Feature_0041? ftr0041 = Features.Decode_0041(desc.Data);
|
||||
if(ftr0041.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteBDRE2 = ftr0041.Value.RE2;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteBDRE1 = ftr0041.Value.RE1;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteBDRE2 = ftr0041.Value.RE2;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteBDRE1 = ftr0041.Value.RE1;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteOldBDRE = ftr0041.Value.OldRE;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteBDR = ftr0041.Value.R;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteOldBDR = ftr0041.Value.OldR;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteBDR = ftr0041.Value.R;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteOldBDR = ftr0041.Value.OldR;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -448,7 +469,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
Feature_0050? ftr0050 = Features.Decode_0050(desc.Data);
|
||||
if(ftr0050.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadHDDVDR = ftr0050.Value.HDDVDR;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadHDDVDR = ftr0050.Value.HDDVDR;
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadHDDVDRAM = ftr0050.Value.HDDVDRAM;
|
||||
}
|
||||
}
|
||||
@@ -459,7 +480,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
Feature_0051? ftr0051 = Features.Decode_0051(desc.Data);
|
||||
if(ftr0051.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteHDDVDR = ftr0051.Value.HDDVDR;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteHDDVDR = ftr0051.Value.HDDVDR;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteHDDVDRAM = ftr0051.Value.HDDVDRAM;
|
||||
}
|
||||
}
|
||||
@@ -491,13 +512,14 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
Feature_0103? ftr0103 = Features.Decode_0103(desc.Data);
|
||||
if(ftr0103.HasValue)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CanAudioScan = ftr0103.Value.Scan;
|
||||
report.SCSI.MultiMediaDevice.Features.CanAudioScan = ftr0103.Value.Scan;
|
||||
report.SCSI.MultiMediaDevice.Features.CanMuteSeparateChannels = ftr0103.Value.SCM;
|
||||
report.SCSI.MultiMediaDevice.Features.SupportsSeparateVolume = ftr0103.Value.SV;
|
||||
report.SCSI.MultiMediaDevice.Features.SupportsSeparateVolume = ftr0103.Value.SV;
|
||||
if(ftr0103.Value.VolumeLevels > 0)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.VolumeLevelsSpecified = true;
|
||||
report.SCSI.MultiMediaDevice.Features.VolumeLevels = ftr0103.Value.VolumeLevels;
|
||||
report.SCSI.MultiMediaDevice.Features.VolumeLevels =
|
||||
ftr0103.Value.VolumeLevels;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -513,7 +535,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(ftr0106.Value.CSSVersion > 0)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CSSVersionSpecified = true;
|
||||
report.SCSI.MultiMediaDevice.Features.CSSVersion = ftr0106.Value.CSSVersion;
|
||||
report.SCSI.MultiMediaDevice.Features.CSSVersion =
|
||||
ftr0106.Value.CSSVersion;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -531,7 +554,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(ftr010B.Value.CPRMVersion > 0)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.CPRMVersionSpecified = true;
|
||||
report.SCSI.MultiMediaDevice.Features.CPRMVersion = ftr010B.Value.CPRMVersion;
|
||||
report.SCSI.MultiMediaDevice.Features.CPRMVersion =
|
||||
ftr010B.Value.CPRMVersion;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -546,23 +570,23 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
temp[2] = (byte)((ftr010C.Value.Year & 0xFF00) >> 8);
|
||||
temp[3] = (byte)(ftr010C.Value.Year & 0xFF);
|
||||
string syear = Encoding.ASCII.GetString(temp);
|
||||
temp = new byte[2];
|
||||
temp = new byte[2];
|
||||
temp[0] = (byte)((ftr010C.Value.Month & 0xFF00) >> 8);
|
||||
temp[1] = (byte)(ftr010C.Value.Month & 0xFF);
|
||||
string smonth = Encoding.ASCII.GetString(temp);
|
||||
temp = new byte[2];
|
||||
temp = new byte[2];
|
||||
temp[0] = (byte)((ftr010C.Value.Day & 0xFF00) >> 8);
|
||||
temp[1] = (byte)(ftr010C.Value.Day & 0xFF);
|
||||
string sday = Encoding.ASCII.GetString(temp);
|
||||
temp = new byte[2];
|
||||
temp = new byte[2];
|
||||
temp[0] = (byte)((ftr010C.Value.Hour & 0xFF00) >> 8);
|
||||
temp[1] = (byte)(ftr010C.Value.Hour & 0xFF);
|
||||
string shour = Encoding.ASCII.GetString(temp);
|
||||
temp = new byte[2];
|
||||
temp = new byte[2];
|
||||
temp[0] = (byte)((ftr010C.Value.Minute & 0xFF00) >> 8);
|
||||
temp[1] = (byte)(ftr010C.Value.Minute & 0xFF);
|
||||
string sminute = Encoding.ASCII.GetString(temp);
|
||||
temp = new byte[2];
|
||||
temp = new byte[2];
|
||||
temp[0] = (byte)((ftr010C.Value.Second & 0xFF00) >> 8);
|
||||
temp[1] = (byte)(ftr010C.Value.Second & 0xFF);
|
||||
string ssecond = Encoding.ASCII.GetString(temp);
|
||||
@@ -576,12 +600,12 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
|
||||
report.SCSI.MultiMediaDevice.Features.FirmwareDateSpecified = true;
|
||||
}
|
||||
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -596,7 +620,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadCPRM_MKB = ftr010D.Value.RMC;
|
||||
report.SCSI.MultiMediaDevice.Features.CanWriteBusEncryptedBlocks =
|
||||
ftr010D.Value.WBE;
|
||||
report.SCSI.MultiMediaDevice.Features.SupportsBusEncryption = ftr010D.Value.BEC;
|
||||
report.SCSI.MultiMediaDevice.Features.SupportsBusEncryption = ftr010D.Value.BEC;
|
||||
report.SCSI.MultiMediaDevice.Features.CanGenerateBindingNonce = ftr010D.Value.BNG;
|
||||
|
||||
if(ftr010D.Value.BindNonceBlocks > 0)
|
||||
@@ -609,13 +633,14 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(ftr010D.Value.AGIDs > 0)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.AGIDsSpecified = true;
|
||||
report.SCSI.MultiMediaDevice.Features.AGIDs = ftr010D.Value.AGIDs;
|
||||
report.SCSI.MultiMediaDevice.Features.AGIDs = ftr010D.Value.AGIDs;
|
||||
}
|
||||
|
||||
if(ftr010D.Value.AACSVersion > 0)
|
||||
{
|
||||
report.SCSI.MultiMediaDevice.Features.AACSVersionSpecified = true;
|
||||
report.SCSI.MultiMediaDevice.Features.AACSVersion = ftr010D.Value.AACSVersion;
|
||||
report.SCSI.MultiMediaDevice.Features.AACSVersion =
|
||||
ftr010D.Value.AACSVersion;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -635,12 +660,12 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
}
|
||||
}
|
||||
|
||||
if(report.SCSI.MultiMediaDevice.Features.CanReadBD ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBDR ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBDRE1 ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBDRE2 ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBDROM ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadOldBDR ||
|
||||
if(report.SCSI.MultiMediaDevice.Features.CanReadBD ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBDR ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBDRE1 ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBDRE2 ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadBDROM ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadOldBDR ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadOldBDRE ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadOldBDROM)
|
||||
{
|
||||
@@ -660,7 +685,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
}
|
||||
|
||||
if(report.SCSI.MultiMediaDevice.Features.CanReadCDMRW)
|
||||
if(!mediaTypes.Contains("CD-MRW")) mediaTypes.Add("CD-MRW");
|
||||
if(!mediaTypes.Contains("CD-MRW"))
|
||||
mediaTypes.Add("CD-MRW");
|
||||
|
||||
if(report.SCSI.MultiMediaDevice.Features.CanReadDDCD)
|
||||
{
|
||||
@@ -669,11 +695,11 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(!mediaTypes.Contains("DDCD-RW")) mediaTypes.Add("DDCD-RW");
|
||||
}
|
||||
|
||||
if(report.SCSI.MultiMediaDevice.Features.CanReadDVD ||
|
||||
report.SCSI.MultiMediaDevice.Features.DVDMultiRead ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusR ||
|
||||
if(report.SCSI.MultiMediaDevice.Features.CanReadDVD ||
|
||||
report.SCSI.MultiMediaDevice.Features.DVDMultiRead ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusR ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusRDL ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusRW ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusRW ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusRWDL)
|
||||
{
|
||||
if(!mediaTypes.Contains("DVD-ROM")) mediaTypes.Add("DVD-ROM");
|
||||
@@ -686,7 +712,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
}
|
||||
|
||||
if(report.SCSI.MultiMediaDevice.Features.CanReadDVDPlusMRW)
|
||||
if(!mediaTypes.Contains("DVD+MRW")) mediaTypes.Add("DVD+MRW");
|
||||
if(!mediaTypes.Contains("DVD+MRW"))
|
||||
mediaTypes.Add("DVD+MRW");
|
||||
|
||||
if(report.SCSI.MultiMediaDevice.Features.CanReadHDDVD ||
|
||||
report.SCSI.MultiMediaDevice.Features.CanReadHDDVDR)
|
||||
@@ -697,15 +724,16 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
}
|
||||
|
||||
if(report.SCSI.MultiMediaDevice.Features.CanReadHDDVDRAM)
|
||||
if(!mediaTypes.Contains("HD DVD-RAM")) mediaTypes.Add("HD DVD-RAM");
|
||||
if(!mediaTypes.Contains("HD DVD-RAM"))
|
||||
mediaTypes.Add("HD DVD-RAM");
|
||||
}
|
||||
|
||||
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
|
||||
@@ -796,7 +824,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
|
||||
if(mediaTest.MediaIsRecognized)
|
||||
{
|
||||
mediaTest.SupportsReadCapacitySpecified = true;
|
||||
mediaTest.SupportsReadCapacitySpecified = true;
|
||||
mediaTest.SupportsReadCapacity16Specified = true;
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI READ CAPACITY...");
|
||||
@@ -808,7 +836,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
(ulong)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3]) + 1;
|
||||
mediaTest.BlockSize =
|
||||
(uint)((buffer[5] << 24) + (buffer[5] << 16) + (buffer[6] << 8) + buffer[7]);
|
||||
mediaTest.BlocksSpecified = true;
|
||||
mediaTest.BlocksSpecified = true;
|
||||
mediaTest.BlockSizeSpecified = true;
|
||||
}
|
||||
|
||||
@@ -823,7 +851,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
mediaTest.Blocks = BitConverter.ToUInt64(temp, 0) + 1;
|
||||
mediaTest.BlockSize =
|
||||
(uint)((buffer[5] << 24) + (buffer[5] << 16) + (buffer[6] << 8) + buffer[7]);
|
||||
mediaTest.BlocksSpecified = true;
|
||||
mediaTest.BlocksSpecified = true;
|
||||
mediaTest.BlockSizeSpecified = true;
|
||||
}
|
||||
|
||||
@@ -835,34 +863,35 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense10 = true;
|
||||
decMode = Modes.DecodeMode10(buffer, dev.ScsiType);
|
||||
decMode = Modes.DecodeMode10(buffer, dev.ScsiType);
|
||||
if(debug) mediaTest.ModeSense10Data = buffer;
|
||||
}
|
||||
|
||||
DicConsole.WriteLine("Querying SCSI MODE SENSE...");
|
||||
sense = dev.ModeSense(out buffer, out senseBuffer, TIMEOUT, out _);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense6 = true;
|
||||
if(!decMode.HasValue) decMode = Modes.DecodeMode6(buffer, dev.ScsiType);
|
||||
if(!decMode.HasValue) decMode = Modes.DecodeMode6(buffer, dev.ScsiType);
|
||||
if(debug) mediaTest.ModeSense6Data = buffer;
|
||||
}
|
||||
|
||||
if(decMode.HasValue)
|
||||
{
|
||||
mediaTest.MediumType = (byte)decMode.Value.Header.MediumType;
|
||||
mediaTest.MediumType = (byte)decMode.Value.Header.MediumType;
|
||||
mediaTest.MediumTypeSpecified = true;
|
||||
if(decMode.Value.Header.BlockDescriptors != null &&
|
||||
if(decMode.Value.Header.BlockDescriptors != null &&
|
||||
decMode.Value.Header.BlockDescriptors.Length > 0)
|
||||
{
|
||||
mediaTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density;
|
||||
mediaTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density;
|
||||
mediaTest.DensitySpecified = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(mediaType.StartsWith("CD-", StringComparison.Ordinal) ||
|
||||
if(mediaType.StartsWith("CD-", StringComparison.Ordinal) ||
|
||||
mediaType.StartsWith("DDCD-", StringComparison.Ordinal) || mediaType == "Audio CD")
|
||||
{
|
||||
mediaTest.CanReadTOCSpecified = true;
|
||||
mediaTest.CanReadTOCSpecified = true;
|
||||
mediaTest.CanReadFullTOCSpecified = true;
|
||||
DicConsole.WriteLine("Querying CD TOC...");
|
||||
mediaTest.CanReadTOC =
|
||||
@@ -882,11 +911,11 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
mediaType + ".bin", "read results", buffer);
|
||||
}
|
||||
|
||||
if(mediaType.StartsWith("CD-R", StringComparison.Ordinal) ||
|
||||
if(mediaType.StartsWith("CD-R", StringComparison.Ordinal) ||
|
||||
mediaType.StartsWith("DDCD-R", StringComparison.Ordinal))
|
||||
{
|
||||
mediaTest.CanReadATIPSpecified = true;
|
||||
mediaTest.CanReadPMASpecified = true;
|
||||
mediaTest.CanReadPMASpecified = true;
|
||||
DicConsole.WriteLine("Querying CD ATIP...");
|
||||
mediaTest.CanReadATIP = !dev.ReadAtip(out buffer, out senseBuffer, TIMEOUT, out _);
|
||||
DicConsole.DebugWriteLine("SCSI Report", "Sense = {0}", !mediaTest.CanReadATIP);
|
||||
@@ -903,7 +932,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
mediaType + ".bin", "read results", buffer);
|
||||
}
|
||||
|
||||
if(mediaType.StartsWith("DVD-", StringComparison.Ordinal) ||
|
||||
if(mediaType.StartsWith("DVD-", StringComparison.Ordinal) ||
|
||||
mediaType.StartsWith("HD DVD-", StringComparison.Ordinal))
|
||||
{
|
||||
mediaTest.CanReadPFISpecified = true;
|
||||
@@ -984,7 +1013,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
break;
|
||||
case "DVD-RAM":
|
||||
case "HD DVD-RAM":
|
||||
mediaTest.CanReadDDSSpecified = true;
|
||||
mediaTest.CanReadDDSSpecified = true;
|
||||
mediaTest.CanReadSpareAreaInformationSpecified = true;
|
||||
mediaTest.CanReadDDS =
|
||||
!dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd,
|
||||
@@ -1009,7 +1038,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
|
||||
if(mediaType.StartsWith("BD-R", StringComparison.Ordinal) && mediaType != "BD-ROM")
|
||||
{
|
||||
mediaTest.CanReadDDSSpecified = true;
|
||||
mediaTest.CanReadDDSSpecified = true;
|
||||
mediaTest.CanReadSpareAreaInformationSpecified = true;
|
||||
DicConsole.WriteLine("Querying BD DDS...");
|
||||
mediaTest.CanReadDDS =
|
||||
@@ -1049,7 +1078,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
|
||||
if(mediaType == "DVD-R" || mediaType == "DVD-RW" || mediaType == "HD DVD-R")
|
||||
{
|
||||
mediaTest.CanReadMediaIDSpecified = true;
|
||||
mediaTest.CanReadMediaIDSpecified = true;
|
||||
mediaTest.CanReadRecordablePFISpecified = true;
|
||||
DicConsole.WriteLine("Querying DVD Media ID...");
|
||||
mediaTest.CanReadMediaID =
|
||||
@@ -1075,7 +1104,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(mediaType.StartsWith("DVD+R", StringComparison.Ordinal) || mediaType == "DVD+MRW")
|
||||
{
|
||||
mediaTest.CanReadADIPSpecified = true;
|
||||
mediaTest.CanReadDCBSpecified = true;
|
||||
mediaTest.CanReadDCBSpecified = true;
|
||||
DicConsole.WriteLine("Querying DVD ADIP...");
|
||||
mediaTest.CanReadADIP =
|
||||
!dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Dvd, 0, 0,
|
||||
@@ -1128,7 +1157,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(mediaType.StartsWith("BD-R", StringComparison.Ordinal))
|
||||
{
|
||||
mediaTest.CanReadDiscInformationSpecified = true;
|
||||
mediaTest.CanReadPACSpecified = true;
|
||||
mediaTest.CanReadPACSpecified = true;
|
||||
DicConsole.WriteLine("Querying BD Disc Information...");
|
||||
mediaTest.CanReadDiscInformation =
|
||||
!dev.ReadDiscStructure(out buffer, out senseBuffer, MmcDiscStructureMediaType.Bd, 0, 0,
|
||||
@@ -1149,7 +1178,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
mediaType + ".bin", "read results", buffer);
|
||||
}
|
||||
|
||||
mediaTest.SupportsReadSpecified = true;
|
||||
mediaTest.SupportsReadSpecified = true;
|
||||
mediaTest.SupportsRead10Specified = true;
|
||||
mediaTest.SupportsRead12Specified = true;
|
||||
mediaTest.SupportsRead16Specified = true;
|
||||
@@ -1193,7 +1222,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
|
||||
{
|
||||
DicConsole
|
||||
.Write("Do you have want to try Plextor vendor commands? THIS IS DANGEROUS AND CAN IRREVERSIBLY DESTROY YOUR DRIVE (IF IN DOUBT PRESS 'N') (Y/N): ");
|
||||
.Write("Do you have want to try Plextor vendor commands? THIS IS DANGEROUS AND CAN IRREVERSIBLY DESTROY YOUR DRIVE (IF IN DOUBT PRESS 'N') (Y/N): ");
|
||||
pressedKey = System.Console.ReadKey();
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
@@ -1201,22 +1230,22 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
tryPlextor |= pressedKey.Key == ConsoleKey.Y;
|
||||
}
|
||||
|
||||
if(mediaType.StartsWith("CD-", StringComparison.Ordinal) ||
|
||||
if(mediaType.StartsWith("CD-", StringComparison.Ordinal) ||
|
||||
mediaType.StartsWith("DDCD-", StringComparison.Ordinal) || mediaType == "Audio CD")
|
||||
{
|
||||
mediaTest.CanReadC2PointersSpecified = true;
|
||||
mediaTest.CanReadCorrectedSubchannelSpecified = true;
|
||||
mediaTest.CanReadC2PointersSpecified = true;
|
||||
mediaTest.CanReadCorrectedSubchannelSpecified = true;
|
||||
mediaTest.CanReadCorrectedSubchannelWithC2Specified = true;
|
||||
mediaTest.CanReadLeadInSpecified = true;
|
||||
mediaTest.CanReadLeadOutSpecified = true;
|
||||
mediaTest.CanReadPQSubchannelSpecified = true;
|
||||
mediaTest.CanReadPQSubchannelWithC2Specified = true;
|
||||
mediaTest.CanReadRWSubchannelSpecified = true;
|
||||
mediaTest.CanReadRWSubchannelWithC2Specified = true;
|
||||
mediaTest.SupportsReadCdMsfSpecified = true;
|
||||
mediaTest.SupportsReadCdSpecified = true;
|
||||
mediaTest.SupportsReadCdMsfRawSpecified = true;
|
||||
mediaTest.SupportsReadCdRawSpecified = true;
|
||||
mediaTest.CanReadLeadInSpecified = true;
|
||||
mediaTest.CanReadLeadOutSpecified = true;
|
||||
mediaTest.CanReadPQSubchannelSpecified = true;
|
||||
mediaTest.CanReadPQSubchannelWithC2Specified = true;
|
||||
mediaTest.CanReadRWSubchannelSpecified = true;
|
||||
mediaTest.CanReadRWSubchannelWithC2Specified = true;
|
||||
mediaTest.SupportsReadCdMsfSpecified = true;
|
||||
mediaTest.SupportsReadCdSpecified = true;
|
||||
mediaTest.SupportsReadCdMsfRawSpecified = true;
|
||||
mediaTest.SupportsReadCdRawSpecified = true;
|
||||
|
||||
if(mediaType == "Audio CD")
|
||||
{
|
||||
@@ -1687,7 +1716,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
|
||||
{
|
||||
DicConsole
|
||||
.Write("Do you have want to try NEC vendor commands? THIS IS DANGEROUS AND CAN IRREVERSIBLY DESTROY YOUR DRIVE (IF IN DOUBT PRESS 'N') (Y/N): ");
|
||||
.Write("Do you have want to try NEC vendor commands? THIS IS DANGEROUS AND CAN IRREVERSIBLY DESTROY YOUR DRIVE (IF IN DOUBT PRESS 'N') (Y/N): ");
|
||||
pressedKey = System.Console.ReadKey();
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
@@ -1701,7 +1730,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
|
||||
{
|
||||
DicConsole
|
||||
.Write("Do you have want to try Pioneer vendor commands? THIS IS DANGEROUS AND CAN IRREVERSIBLY DESTROY YOUR DRIVE (IF IN DOUBT PRESS 'N') (Y/N): ");
|
||||
.Write("Do you have want to try Pioneer vendor commands? THIS IS DANGEROUS AND CAN IRREVERSIBLY DESTROY YOUR DRIVE (IF IN DOUBT PRESS 'N') (Y/N): ");
|
||||
pressedKey = System.Console.ReadKey();
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
@@ -1727,7 +1756,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
|
||||
if(tryPioneer)
|
||||
{
|
||||
mediaTest.SupportsPioneerReadCDDASpecified = true;
|
||||
mediaTest.SupportsPioneerReadCDDASpecified = true;
|
||||
mediaTest.SupportsPioneerReadCDDAMSFSpecified = true;
|
||||
DicConsole.WriteLine("Trying Pioneer READ CD-DA...");
|
||||
mediaTest.SupportsPioneerReadCDDA =
|
||||
@@ -1773,12 +1802,13 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
FixedSense? decSense = Sense.DecodeFixed(senseBuffer);
|
||||
if(decSense.HasValue)
|
||||
if(decSense.Value.SenseKey == SenseKeys.IllegalRequest && decSense.Value.ASC == 0x24 &&
|
||||
decSense.Value.ASCQ == 0x00)
|
||||
decSense.Value.ASCQ == 0x00)
|
||||
{
|
||||
mediaTest.SupportsReadLong = true;
|
||||
if(decSense.Value.InformationValid && decSense.Value.ILI)
|
||||
{
|
||||
mediaTest.LongBlockSize = 0xFFFF - (decSense.Value.Information & 0xFFFF);
|
||||
mediaTest.LongBlockSize =
|
||||
0xFFFF - (decSense.Value.Information & 0xFFFF);
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
}
|
||||
}
|
||||
@@ -1791,7 +1821,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
|
||||
{
|
||||
DicConsole
|
||||
.Write("Do you have want to try HL-DT-ST (aka LG) vendor commands? THIS IS DANGEROUS AND CAN IRREVERSIBLY DESTROY YOUR DRIVE (IF IN DOUBT PRESS 'N') (Y/N): ");
|
||||
.Write("Do you have want to try HL-DT-ST (aka LG) vendor commands? THIS IS DANGEROUS AND CAN IRREVERSIBLY DESTROY YOUR DRIVE (IF IN DOUBT PRESS 'N') (Y/N): ");
|
||||
pressedKey = System.Console.ReadKey();
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
@@ -1805,8 +1835,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
sense = dev.ReadLong10(out buffer, out senseBuffer, false, false, 0, 37856, TIMEOUT, out _);
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = 37856;
|
||||
mediaTest.SupportsReadLong = true;
|
||||
mediaTest.LongBlockSize = 37856;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
}
|
||||
}
|
||||
@@ -1847,7 +1877,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
|
||||
{
|
||||
DicConsole
|
||||
.Write("Drive supports SCSI READ LONG but I cannot find the correct size. Do you want me to try? (This can take hours) (Y/N): ");
|
||||
.Write("Drive supports SCSI READ LONG but I cannot find the correct size. Do you want me to try? (This can take hours) (Y/N): ");
|
||||
pressedKey = System.Console.ReadKey();
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
@@ -1868,7 +1898,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
bingo.Write(buffer, 0, buffer.Length);
|
||||
bingo.Close();
|
||||
}
|
||||
mediaTest.LongBlockSize = i;
|
||||
|
||||
mediaTest.LongBlockSize = i;
|
||||
mediaTest.LongBlockSizeSpecified = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -56,8 +56,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
{
|
||||
if(report == null) return;
|
||||
|
||||
bool sense;
|
||||
const uint TIMEOUT = 5;
|
||||
bool sense;
|
||||
const uint TIMEOUT = 5;
|
||||
ConsoleKeyInfo pressedKey;
|
||||
|
||||
report.SCSI.SequentialDevice = new sscType();
|
||||
@@ -71,17 +71,19 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
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)
|
||||
{
|
||||
report.SCSI.SequentialDevice.MaxBlockLengthSpecified = true;
|
||||
report.SCSI.SequentialDevice.MaxBlockLength = decBl.Value.maxBlockLen;
|
||||
report.SCSI.SequentialDevice.MaxBlockLength = decBl.Value.maxBlockLen;
|
||||
}
|
||||
|
||||
if(decBl.Value.minBlockLen > 0)
|
||||
{
|
||||
report.SCSI.SequentialDevice.MinBlockLengthSpecified = true;
|
||||
report.SCSI.SequentialDevice.MinBlockLength = decBl.Value.minBlockLen;
|
||||
report.SCSI.SequentialDevice.MinBlockLength = decBl.Value.minBlockLen;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -98,7 +100,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
for(int i = 0; i < dsh.Value.descriptors.Length; i++)
|
||||
{
|
||||
report.SCSI.SequentialDevice.SupportedDensities[i].BitsPerMm = dsh.Value.descriptors[i].bpmm;
|
||||
report.SCSI.SequentialDevice.SupportedDensities[i].Capacity = dsh.Value.descriptors[i].capacity;
|
||||
report.SCSI.SequentialDevice.SupportedDensities[i].Capacity =
|
||||
dsh.Value.descriptors[i].capacity;
|
||||
report.SCSI.SequentialDevice.SupportedDensities[i].DefaultDensity =
|
||||
dsh.Value.descriptors[i].defaultDensity;
|
||||
report.SCSI.SequentialDevice.SupportedDensities[i].Description =
|
||||
@@ -112,8 +115,8 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
dsh.Value.descriptors[i].primaryCode;
|
||||
report.SCSI.SequentialDevice.SupportedDensities[i].SecondaryCode =
|
||||
dsh.Value.descriptors[i].secondaryCode;
|
||||
report.SCSI.SequentialDevice.SupportedDensities[i].Tracks = dsh.Value.descriptors[i].tracks;
|
||||
report.SCSI.SequentialDevice.SupportedDensities[i].Width = dsh.Value.descriptors[i].width;
|
||||
report.SCSI.SequentialDevice.SupportedDensities[i].Tracks = dsh.Value.descriptors[i].tracks;
|
||||
report.SCSI.SequentialDevice.SupportedDensities[i].Width = dsh.Value.descriptors[i].width;
|
||||
report.SCSI.SequentialDevice.SupportedDensities[i].Writable = dsh.Value.descriptors[i].writable;
|
||||
}
|
||||
}
|
||||
@@ -228,7 +231,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense10 = true;
|
||||
decMode = Modes.DecodeMode10(buffer, dev.ScsiType);
|
||||
decMode = Modes.DecodeMode10(buffer, dev.ScsiType);
|
||||
if(debug) seqTest.ModeSense10Data = buffer;
|
||||
}
|
||||
|
||||
@@ -237,18 +240,18 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
report.SCSI.SupportsModeSense6 = true;
|
||||
if(!decMode.HasValue) decMode = Modes.DecodeMode6(buffer, dev.ScsiType);
|
||||
if(!decMode.HasValue) decMode = Modes.DecodeMode6(buffer, dev.ScsiType);
|
||||
if(debug) seqTest.ModeSense6Data = buffer;
|
||||
}
|
||||
|
||||
if(decMode.HasValue)
|
||||
{
|
||||
seqTest.MediumType = (byte)decMode.Value.Header.MediumType;
|
||||
seqTest.MediumType = (byte)decMode.Value.Header.MediumType;
|
||||
seqTest.MediumTypeSpecified = true;
|
||||
if(decMode.Value.Header.BlockDescriptors != null &&
|
||||
if(decMode.Value.Header.BlockDescriptors != null &&
|
||||
decMode.Value.Header.BlockDescriptors.Length > 0)
|
||||
{
|
||||
seqTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density;
|
||||
seqTest.Density = (byte)decMode.Value.Header.BlockDescriptors[0].Density;
|
||||
seqTest.DensitySpecified = true;
|
||||
}
|
||||
}
|
||||
@@ -264,18 +267,18 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
seqTest.SupportedDensities = new SupportedDensity[dsh.Value.descriptors.Length];
|
||||
for(int i = 0; i < dsh.Value.descriptors.Length; i++)
|
||||
{
|
||||
seqTest.SupportedDensities[i].BitsPerMm = dsh.Value.descriptors[i].bpmm;
|
||||
seqTest.SupportedDensities[i].Capacity = dsh.Value.descriptors[i].capacity;
|
||||
seqTest.SupportedDensities[i].BitsPerMm = dsh.Value.descriptors[i].bpmm;
|
||||
seqTest.SupportedDensities[i].Capacity = dsh.Value.descriptors[i].capacity;
|
||||
seqTest.SupportedDensities[i].DefaultDensity = dsh.Value.descriptors[i].defaultDensity;
|
||||
seqTest.SupportedDensities[i].Description = dsh.Value.descriptors[i].description;
|
||||
seqTest.SupportedDensities[i].Duplicate = dsh.Value.descriptors[i].duplicate;
|
||||
seqTest.SupportedDensities[i].Name = dsh.Value.descriptors[i].name;
|
||||
seqTest.SupportedDensities[i].Organization = dsh.Value.descriptors[i].organization;
|
||||
seqTest.SupportedDensities[i].PrimaryCode = dsh.Value.descriptors[i].primaryCode;
|
||||
seqTest.SupportedDensities[i].SecondaryCode = dsh.Value.descriptors[i].secondaryCode;
|
||||
seqTest.SupportedDensities[i].Tracks = dsh.Value.descriptors[i].tracks;
|
||||
seqTest.SupportedDensities[i].Width = dsh.Value.descriptors[i].width;
|
||||
seqTest.SupportedDensities[i].Writable = dsh.Value.descriptors[i].writable;
|
||||
seqTest.SupportedDensities[i].Description = dsh.Value.descriptors[i].description;
|
||||
seqTest.SupportedDensities[i].Duplicate = dsh.Value.descriptors[i].duplicate;
|
||||
seqTest.SupportedDensities[i].Name = dsh.Value.descriptors[i].name;
|
||||
seqTest.SupportedDensities[i].Organization = dsh.Value.descriptors[i].organization;
|
||||
seqTest.SupportedDensities[i].PrimaryCode = dsh.Value.descriptors[i].primaryCode;
|
||||
seqTest.SupportedDensities[i].SecondaryCode = dsh.Value.descriptors[i].secondaryCode;
|
||||
seqTest.SupportedDensities[i].Tracks = dsh.Value.descriptors[i].tracks;
|
||||
seqTest.SupportedDensities[i].Width = dsh.Value.descriptors[i].width;
|
||||
seqTest.SupportedDensities[i].Writable = dsh.Value.descriptors[i].writable;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -290,12 +293,12 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
|
||||
seqTest.SupportedMediaTypes = new SupportedMedia[mtsh.Value.descriptors.Length];
|
||||
for(int i = 0; i < mtsh.Value.descriptors.Length; i++)
|
||||
{
|
||||
seqTest.SupportedMediaTypes[i].Description = mtsh.Value.descriptors[i].description;
|
||||
seqTest.SupportedMediaTypes[i].Length = mtsh.Value.descriptors[i].length;
|
||||
seqTest.SupportedMediaTypes[i].MediumType = mtsh.Value.descriptors[i].mediumType;
|
||||
seqTest.SupportedMediaTypes[i].Name = mtsh.Value.descriptors[i].name;
|
||||
seqTest.SupportedMediaTypes[i].Description = mtsh.Value.descriptors[i].description;
|
||||
seqTest.SupportedMediaTypes[i].Length = mtsh.Value.descriptors[i].length;
|
||||
seqTest.SupportedMediaTypes[i].MediumType = mtsh.Value.descriptors[i].mediumType;
|
||||
seqTest.SupportedMediaTypes[i].Name = mtsh.Value.descriptors[i].name;
|
||||
seqTest.SupportedMediaTypes[i].Organization = mtsh.Value.descriptors[i].organization;
|
||||
seqTest.SupportedMediaTypes[i].Width = mtsh.Value.descriptors[i].width;
|
||||
seqTest.SupportedMediaTypes[i].Width = mtsh.Value.descriptors[i].width;
|
||||
if(mtsh.Value.descriptors[i].densityCodes == null) continue;
|
||||
|
||||
seqTest.SupportedMediaTypes[i].DensityCodes =
|
||||
|
||||
@@ -71,21 +71,21 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
{
|
||||
case DeviceType.SecureDigital:
|
||||
// Clear serial number and manufacturing date
|
||||
cid[9] = 0;
|
||||
cid[10] = 0;
|
||||
cid[11] = 0;
|
||||
cid[12] = 0;
|
||||
cid[13] = 0;
|
||||
cid[14] = 0;
|
||||
cid[9] = 0;
|
||||
cid[10] = 0;
|
||||
cid[11] = 0;
|
||||
cid[12] = 0;
|
||||
cid[13] = 0;
|
||||
cid[14] = 0;
|
||||
report.SecureDigital.CID = cid;
|
||||
break;
|
||||
case DeviceType.MMC:
|
||||
// Clear serial number and manufacturing date
|
||||
cid[10] = 0;
|
||||
cid[11] = 0;
|
||||
cid[12] = 0;
|
||||
cid[13] = 0;
|
||||
cid[14] = 0;
|
||||
cid[10] = 0;
|
||||
cid[11] = 0;
|
||||
cid[12] = 0;
|
||||
cid[13] = 0;
|
||||
cid[14] = 0;
|
||||
report.MultiMediaCard.CID = cid;
|
||||
break;
|
||||
}
|
||||
@@ -134,6 +134,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
report.MultiMediaCard.ExtendedCSD = ecsd;
|
||||
}
|
||||
else DicConsole.WriteLine("Could not read Extended CSD...");
|
||||
|
||||
break;
|
||||
}
|
||||
case DeviceType.SecureDigital:
|
||||
@@ -157,6 +158,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
report.SecureDigital.SCR = scr;
|
||||
}
|
||||
else DicConsole.WriteLine("Could not read SCR...");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,9 +66,9 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
report.USB = new usbType
|
||||
{
|
||||
Manufacturer = dev.UsbManufacturerString,
|
||||
Product = dev.UsbProductString,
|
||||
ProductID = dev.UsbProductId,
|
||||
VendorID = dev.UsbVendorId
|
||||
Product = dev.UsbProductString,
|
||||
ProductID = dev.UsbProductId,
|
||||
VendorID = dev.UsbVendorId
|
||||
};
|
||||
|
||||
pressedKey = new ConsoleKeyInfo();
|
||||
@@ -80,7 +80,7 @@ namespace DiscImageChef.Core.Devices.Report
|
||||
}
|
||||
|
||||
report.USB.RemovableMedia = pressedKey.Key == ConsoleKey.Y;
|
||||
removable = report.USB.RemovableMedia;
|
||||
removable = report.USB.RemovableMedia;
|
||||
if(debug) report.USB.Descriptors = dev.UsbDescriptors;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,11 +55,11 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
public static ScanResults Scan(string mhddLogPath, string ibgLogPath, string devicePath, Device dev)
|
||||
{
|
||||
ScanResults results = new ScanResults();
|
||||
bool aborted;
|
||||
bool sense;
|
||||
bool aborted;
|
||||
bool sense;
|
||||
results.Blocks = 0;
|
||||
const ushort ATA_PROFILE = 0x0001;
|
||||
const uint TIMEOUT = 5;
|
||||
const uint TIMEOUT = 5;
|
||||
|
||||
sense = dev.AtaIdentify(out byte[] cmdBuf, out _);
|
||||
if(!sense && Identify.Decode(cmdBuf).HasValue)
|
||||
@@ -73,6 +73,7 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
DicConsole.ErrorWriteLine(ataReader.ErrorMessage);
|
||||
return results;
|
||||
}
|
||||
|
||||
// Check block sizes
|
||||
if(ataReader.GetBlockSize())
|
||||
{
|
||||
@@ -88,46 +89,46 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
return results;
|
||||
}
|
||||
|
||||
uint blocksToRead = ataReader.BlocksToRead;
|
||||
ushort cylinders = ataReader.Cylinders;
|
||||
byte heads = ataReader.Heads;
|
||||
byte sectors = ataReader.Sectors;
|
||||
uint blocksToRead = ataReader.BlocksToRead;
|
||||
ushort cylinders = ataReader.Cylinders;
|
||||
byte heads = ataReader.Heads;
|
||||
byte sectors = ataReader.Sectors;
|
||||
|
||||
results.A = 0; // <3ms
|
||||
results.B = 0; // >=3ms, <10ms
|
||||
results.C = 0; // >=10ms, <50ms
|
||||
results.D = 0; // >=50ms, <150ms
|
||||
results.E = 0; // >=150ms, <500ms
|
||||
results.F = 0; // >=500ms
|
||||
results.A = 0; // <3ms
|
||||
results.B = 0; // >=3ms, <10ms
|
||||
results.C = 0; // >=10ms, <50ms
|
||||
results.D = 0; // >=50ms, <150ms
|
||||
results.E = 0; // >=150ms, <500ms
|
||||
results.F = 0; // >=500ms
|
||||
results.Errored = 0;
|
||||
DateTime start;
|
||||
DateTime end;
|
||||
results.ProcessingTime = 0;
|
||||
double currentSpeed = 0;
|
||||
results.MaxSpeed = double.MinValue;
|
||||
results.MinSpeed = double.MaxValue;
|
||||
results.MaxSpeed = double.MinValue;
|
||||
results.MinSpeed = double.MaxValue;
|
||||
results.UnreadableSectors = new List<ulong>();
|
||||
results.SeekMax = double.MinValue;
|
||||
results.SeekMin = double.MaxValue;
|
||||
results.SeekTotal = 0;
|
||||
results.SeekMax = double.MinValue;
|
||||
results.SeekMin = double.MaxValue;
|
||||
results.SeekTotal = 0;
|
||||
const int SEEK_TIMES = 1000;
|
||||
|
||||
double seekCur;
|
||||
|
||||
Random rnd = new Random();
|
||||
|
||||
aborted = false;
|
||||
aborted = false;
|
||||
System.Console.CancelKeyPress += (sender, e) => e.Cancel = aborted = true;
|
||||
|
||||
MhddLog mhddLog;
|
||||
IbgLog ibgLog;
|
||||
double duration;
|
||||
IbgLog ibgLog;
|
||||
double duration;
|
||||
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, ATA_PROFILE);
|
||||
ibgLog = new IbgLog(ibgLogPath, ATA_PROFILE);
|
||||
|
||||
start = DateTime.UtcNow;
|
||||
for(ulong i = 0; i < results.Blocks; i += blocksToRead)
|
||||
@@ -136,10 +137,10 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
|
||||
if(results.Blocks - i < blocksToRead) blocksToRead = (byte)(results.Blocks - i);
|
||||
|
||||
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#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;
|
||||
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#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);
|
||||
@@ -148,12 +149,12 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
|
||||
if(!error)
|
||||
{
|
||||
if(duration >= 500) results.F += blocksToRead;
|
||||
if(duration >= 500) results.F += blocksToRead;
|
||||
else if(duration >= 150) results.E += blocksToRead;
|
||||
else if(duration >= 50) results.D += blocksToRead;
|
||||
else if(duration >= 10) results.C += blocksToRead;
|
||||
else if(duration >= 3) results.B += blocksToRead;
|
||||
else results.A += blocksToRead;
|
||||
else if(duration >= 50) results.D += blocksToRead;
|
||||
else if(duration >= 10) results.C += blocksToRead;
|
||||
else if(duration >= 3) results.B += blocksToRead;
|
||||
else results.A += blocksToRead;
|
||||
|
||||
mhddLog.Write(i, duration);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
@@ -168,7 +169,8 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
ibgLog.Write(i, 0);
|
||||
}
|
||||
|
||||
double newSpeed = (double)blockSize * blocksToRead / 1048576 / (duration / 1000);
|
||||
double newSpeed =
|
||||
(double)blockSize * blocksToRead / 1048576 / (duration / 1000);
|
||||
if(!double.IsInfinity(newSpeed)) currentSpeed = newSpeed;
|
||||
}
|
||||
|
||||
@@ -176,7 +178,8 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
DicConsole.WriteLine();
|
||||
mhddLog.Close();
|
||||
ibgLog.Close(dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
|
||||
blockSize * (double)(results.Blocks + 1) / 1024 / (results.ProcessingTime / 1000),
|
||||
blockSize * (double)(results.Blocks + 1) / 1024 /
|
||||
(results.ProcessingTime / 1000),
|
||||
devicePath);
|
||||
|
||||
if(ataReader.CanSeekLba)
|
||||
@@ -190,10 +193,10 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
|
||||
ataReader.Seek(seekPos, out seekCur);
|
||||
|
||||
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#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;
|
||||
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
|
||||
|
||||
results.SeekTotal += seekCur;
|
||||
GC.Collect();
|
||||
@@ -202,11 +205,11 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
else
|
||||
{
|
||||
mhddLog = new MhddLog(mhddLogPath, dev, results.Blocks, blockSize, blocksToRead);
|
||||
ibgLog = new IbgLog(ibgLogPath, ATA_PROFILE);
|
||||
ibgLog = new IbgLog(ibgLogPath, ATA_PROFILE);
|
||||
|
||||
ulong currentBlock = 0;
|
||||
results.Blocks = (ulong)(cylinders * heads * sectors);
|
||||
start = DateTime.UtcNow;
|
||||
start = DateTime.UtcNow;
|
||||
for(ushort cy = 0; cy < cylinders; cy++)
|
||||
{
|
||||
for(byte hd = 0; hd < heads; hd++)
|
||||
@@ -215,12 +218,12 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
{
|
||||
if(aborted) break;
|
||||
|
||||
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#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;
|
||||
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#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);
|
||||
@@ -229,12 +232,12 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
|
||||
if(!error)
|
||||
{
|
||||
if(duration >= 500) results.F += blocksToRead;
|
||||
if(duration >= 500) results.F += blocksToRead;
|
||||
else if(duration >= 150) results.E += blocksToRead;
|
||||
else if(duration >= 50) results.D += blocksToRead;
|
||||
else if(duration >= 10) results.C += blocksToRead;
|
||||
else if(duration >= 3) results.B += blocksToRead;
|
||||
else results.A += blocksToRead;
|
||||
else if(duration >= 50) results.D += blocksToRead;
|
||||
else if(duration >= 10) results.C += blocksToRead;
|
||||
else if(duration >= 3) results.B += blocksToRead;
|
||||
else results.A += blocksToRead;
|
||||
|
||||
mhddLog.Write(currentBlock, duration);
|
||||
ibgLog.Write(currentBlock, currentSpeed * 1024);
|
||||
@@ -248,7 +251,8 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
ibgLog.Write(currentBlock, 0);
|
||||
}
|
||||
|
||||
double newSpeed = blockSize / (double)1048576 / (duration / 1000);
|
||||
double newSpeed =
|
||||
blockSize / (double)1048576 / (duration / 1000);
|
||||
if(!double.IsInfinity(newSpeed)) currentSpeed = newSpeed;
|
||||
|
||||
currentBlock++;
|
||||
@@ -260,7 +264,8 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
DicConsole.WriteLine();
|
||||
mhddLog.Close();
|
||||
ibgLog.Close(dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
|
||||
blockSize * (double)(results.Blocks + 1) / 1024 / (results.ProcessingTime / 1000),
|
||||
blockSize * (double)(results.Blocks + 1) / 1024 /
|
||||
(results.ProcessingTime / 1000),
|
||||
devicePath);
|
||||
|
||||
if(ataReader.CanSeek)
|
||||
@@ -269,18 +274,18 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
if(aborted) break;
|
||||
|
||||
ushort seekCy = (ushort)rnd.Next(cylinders);
|
||||
byte seekHd = (byte)rnd.Next(heads);
|
||||
byte seekSc = (byte)rnd.Next(sectors);
|
||||
byte seekHd = (byte)rnd.Next(heads);
|
||||
byte seekSc = (byte)rnd.Next(sectors);
|
||||
|
||||
DicConsole.Write("\rSeeking to cylinder {0}, head {1}, sector {2}...\t\t", seekCy, seekHd,
|
||||
seekSc);
|
||||
|
||||
ataReader.SeekChs(seekCy, seekHd, seekSc, out seekCur);
|
||||
|
||||
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#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;
|
||||
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
|
||||
|
||||
results.SeekTotal += seekCur;
|
||||
GC.Collect();
|
||||
@@ -290,9 +295,9 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
DicConsole.WriteLine();
|
||||
|
||||
results.ProcessingTime /= 1000;
|
||||
results.TotalTime = (end - start).TotalSeconds;
|
||||
results.AvgSpeed = blockSize * (double)(results.Blocks + 1) / 1048576 / results.ProcessingTime;
|
||||
results.SeekTimes = SEEK_TIMES;
|
||||
results.TotalTime = (end - start).TotalSeconds;
|
||||
results.AvgSpeed = blockSize * (double)(results.Blocks + 1) / 1048576 / results.ProcessingTime;
|
||||
results.SeekTimes = SEEK_TIMES;
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
@@ -50,13 +50,13 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
public static ScanResults Scan(string mhddLogPath, string ibgLogPath, string devicePath, Device dev)
|
||||
{
|
||||
ScanResults results = new ScanResults();
|
||||
bool aborted;
|
||||
MhddLog mhddLog;
|
||||
IbgLog ibgLog;
|
||||
byte[] senseBuf;
|
||||
bool sense = false;
|
||||
bool aborted;
|
||||
MhddLog mhddLog;
|
||||
IbgLog ibgLog;
|
||||
byte[] senseBuf;
|
||||
bool sense = false;
|
||||
results.Blocks = 0;
|
||||
uint blockSize = 0;
|
||||
uint blockSize = 0;
|
||||
ushort currentProfile = 0x0001;
|
||||
|
||||
if(dev.IsRemovable)
|
||||
@@ -150,7 +150,7 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
case PeripheralDeviceTypes.OpticalDevice:
|
||||
case PeripheralDeviceTypes.SimplifiedDevice:
|
||||
case PeripheralDeviceTypes.WriteOnceDevice:
|
||||
scsiReader = new Reader(dev, dev.Timeout, null);
|
||||
scsiReader = new Reader(dev, dev.Timeout, null);
|
||||
results.Blocks = scsiReader.GetDeviceBlocks();
|
||||
if(scsiReader.FindReadCommand())
|
||||
{
|
||||
@@ -166,6 +166,7 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
DicConsole.WriteLine("Media has {0} blocks of {1} bytes/each. (for a total of {2} bytes)",
|
||||
results.Blocks, blockSize, results.Blocks * (ulong)blockSize);
|
||||
}
|
||||
|
||||
break;
|
||||
case PeripheralDeviceTypes.SequentialAccess:
|
||||
DicConsole.WriteLine("Scanning will never be supported on SCSI Streaming Devices.");
|
||||
@@ -179,8 +180,8 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
return results;
|
||||
}
|
||||
|
||||
bool compactDisc = true;
|
||||
FullTOC.CDFullTOC? toc = null;
|
||||
bool compactDisc = true;
|
||||
FullTOC.CDFullTOC? toc = null;
|
||||
|
||||
if(dev.ScsiType == PeripheralDeviceTypes.MultiMediaDevice)
|
||||
{
|
||||
@@ -212,7 +213,7 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
currentProfile = 0x0008;
|
||||
// We discarded all discs that falsify a TOC before requesting a real TOC
|
||||
// No TOC, no CD (or an empty one)
|
||||
bool tocSense = dev.ReadRawToc(out cmdBuf, out senseBuf, 1, dev.Timeout, out _);
|
||||
bool tocSense = dev.ReadRawToc(out cmdBuf, out senseBuf, 1, dev.Timeout, out _);
|
||||
if(!tocSense) toc = FullTOC.Decode(cmdBuf);
|
||||
}
|
||||
}
|
||||
@@ -220,23 +221,23 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
|
||||
uint blocksToRead = 64;
|
||||
|
||||
results.A = 0; // <3ms
|
||||
results.B = 0; // >=3ms, <10ms
|
||||
results.C = 0; // >=10ms, <50ms
|
||||
results.D = 0; // >=50ms, <150ms
|
||||
results.E = 0; // >=150ms, <500ms
|
||||
results.F = 0; // >=500ms
|
||||
results.A = 0; // <3ms
|
||||
results.B = 0; // >=3ms, <10ms
|
||||
results.C = 0; // >=10ms, <50ms
|
||||
results.D = 0; // >=50ms, <150ms
|
||||
results.E = 0; // >=150ms, <500ms
|
||||
results.F = 0; // >=500ms
|
||||
results.Errored = 0;
|
||||
DateTime start;
|
||||
DateTime end;
|
||||
results.ProcessingTime = 0;
|
||||
results.TotalTime = 0;
|
||||
results.TotalTime = 0;
|
||||
double currentSpeed = 0;
|
||||
results.MaxSpeed = double.MinValue;
|
||||
results.MinSpeed = double.MaxValue;
|
||||
results.MaxSpeed = double.MinValue;
|
||||
results.MinSpeed = double.MaxValue;
|
||||
results.UnreadableSectors = new List<ulong>();
|
||||
|
||||
aborted = false;
|
||||
aborted = false;
|
||||
System.Console.CancelKeyPress += (sender, e) => e.Cancel = aborted = true;
|
||||
|
||||
if(compactDisc)
|
||||
@@ -277,7 +278,7 @@ 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);
|
||||
ibgLog = new IbgLog(ibgLogPath, currentProfile);
|
||||
|
||||
for(ulong i = 0; i < results.Blocks; i += blocksToRead)
|
||||
{
|
||||
@@ -287,10 +288,10 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
|
||||
if(results.Blocks - i < blocksToRead) blocksToRead = (uint)(results.Blocks - i);
|
||||
|
||||
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#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;
|
||||
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#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);
|
||||
|
||||
@@ -304,12 +305,12 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
|
||||
if(!sense)
|
||||
{
|
||||
if(cmdDuration >= 500) results.F += blocksToRead;
|
||||
if(cmdDuration >= 500) results.F += blocksToRead;
|
||||
else if(cmdDuration >= 150) results.E += blocksToRead;
|
||||
else if(cmdDuration >= 50) results.D += blocksToRead;
|
||||
else if(cmdDuration >= 10) results.C += blocksToRead;
|
||||
else if(cmdDuration >= 3) results.B += blocksToRead;
|
||||
else results.A += blocksToRead;
|
||||
else if(cmdDuration >= 50) results.D += blocksToRead;
|
||||
else if(cmdDuration >= 10) results.C += blocksToRead;
|
||||
else if(cmdDuration >= 3) results.B += blocksToRead;
|
||||
else results.A += blocksToRead;
|
||||
|
||||
mhddLog.Write(i, cmdDuration);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
@@ -347,7 +348,8 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
}
|
||||
}
|
||||
|
||||
double newSpeed = (double)blockSize * blocksToRead / 1048576 / (cmdDuration / 1000);
|
||||
double newSpeed =
|
||||
(double)blockSize * blocksToRead / 1048576 / (cmdDuration / 1000);
|
||||
if(!double.IsInfinity(newSpeed)) currentSpeed = newSpeed;
|
||||
}
|
||||
|
||||
@@ -355,7 +357,8 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
DicConsole.WriteLine();
|
||||
mhddLog.Close();
|
||||
ibgLog.Close(dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
|
||||
blockSize * (double)(results.Blocks + 1) / 1024 / (results.ProcessingTime / 1000),
|
||||
blockSize * (double)(results.Blocks + 1) / 1024 /
|
||||
(results.ProcessingTime / 1000),
|
||||
devicePath);
|
||||
}
|
||||
else
|
||||
@@ -365,7 +368,7 @@ 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);
|
||||
ibgLog = new IbgLog(ibgLogPath, currentProfile);
|
||||
|
||||
for(ulong i = 0; i < results.Blocks; i += blocksToRead)
|
||||
{
|
||||
@@ -373,24 +376,24 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
|
||||
if(results.Blocks - i < blocksToRead) blocksToRead = (uint)(results.Blocks - i);
|
||||
|
||||
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#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;
|
||||
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#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);
|
||||
|
||||
sense = scsiReader.ReadBlocks(out _, i, blocksToRead, out double cmdDuration);
|
||||
sense = scsiReader.ReadBlocks(out _, i, blocksToRead, out double cmdDuration);
|
||||
results.ProcessingTime += cmdDuration;
|
||||
|
||||
if(!sense && !dev.Error)
|
||||
{
|
||||
if(cmdDuration >= 500) results.F += blocksToRead;
|
||||
if(cmdDuration >= 500) results.F += blocksToRead;
|
||||
else if(cmdDuration >= 150) results.E += blocksToRead;
|
||||
else if(cmdDuration >= 50) results.D += blocksToRead;
|
||||
else if(cmdDuration >= 10) results.C += blocksToRead;
|
||||
else if(cmdDuration >= 3) results.B += blocksToRead;
|
||||
else results.A += blocksToRead;
|
||||
else if(cmdDuration >= 50) results.D += blocksToRead;
|
||||
else if(cmdDuration >= 10) results.C += blocksToRead;
|
||||
else if(cmdDuration >= 3) results.B += blocksToRead;
|
||||
else results.A += blocksToRead;
|
||||
|
||||
mhddLog.Write(i, cmdDuration);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
@@ -405,7 +408,8 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
ibgLog.Write(i, 0);
|
||||
}
|
||||
|
||||
double newSpeed = (double)blockSize * blocksToRead / 1048576 / (cmdDuration / 1000);
|
||||
double newSpeed =
|
||||
(double)blockSize * blocksToRead / 1048576 / (cmdDuration / 1000);
|
||||
if(!double.IsInfinity(newSpeed)) currentSpeed = newSpeed;
|
||||
}
|
||||
|
||||
@@ -413,12 +417,13 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
DicConsole.WriteLine();
|
||||
mhddLog.Close();
|
||||
ibgLog.Close(dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
|
||||
blockSize * (double)(results.Blocks + 1) / 1024 / (results.ProcessingTime / 1000),
|
||||
blockSize * (double)(results.Blocks + 1) / 1024 /
|
||||
(results.ProcessingTime / 1000),
|
||||
devicePath);
|
||||
}
|
||||
|
||||
results.SeekMax = double.MinValue;
|
||||
results.SeekMin = double.MaxValue;
|
||||
results.SeekMax = double.MinValue;
|
||||
results.SeekMin = double.MaxValue;
|
||||
results.SeekTotal = 0;
|
||||
const int SEEK_TIMES = 1000;
|
||||
|
||||
@@ -436,10 +441,10 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
if(scsiReader.CanSeek) scsiReader.Seek(seekPos, out seekCur);
|
||||
else scsiReader.ReadBlock(out _, seekPos, out seekCur);
|
||||
|
||||
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#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;
|
||||
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
|
||||
|
||||
results.SeekTotal += seekCur;
|
||||
GC.Collect();
|
||||
@@ -448,9 +453,9 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
DicConsole.WriteLine();
|
||||
|
||||
results.ProcessingTime /= 1000;
|
||||
results.TotalTime = (end - start).TotalSeconds;
|
||||
results.AvgSpeed = blockSize * (double)(results.Blocks + 1) / 1048576 / results.ProcessingTime;
|
||||
results.SeekTimes = SEEK_TIMES;
|
||||
results.TotalTime = (end - start).TotalSeconds;
|
||||
results.AvgSpeed = blockSize * (double)(results.Blocks + 1) / 1048576 / results.ProcessingTime;
|
||||
results.SeekTimes = SEEK_TIMES;
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
@@ -47,16 +47,16 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
public static ScanResults Scan(string mhddLogPath, string ibgLogPath, string devicePath, Device dev)
|
||||
{
|
||||
ScanResults results = new ScanResults();
|
||||
bool aborted;
|
||||
byte[] cmdBuf;
|
||||
bool sense;
|
||||
bool aborted;
|
||||
byte[] cmdBuf;
|
||||
bool sense;
|
||||
results.Blocks = 0;
|
||||
const uint TIMEOUT = 5;
|
||||
double duration;
|
||||
const ushort SD_PROFILE = 0x0001;
|
||||
uint blocksToRead = 128;
|
||||
uint blockSize = 512;
|
||||
bool byteAddressed = true;
|
||||
const uint TIMEOUT = 5;
|
||||
double duration;
|
||||
const ushort SD_PROFILE = 0x0001;
|
||||
uint blocksToRead = 128;
|
||||
uint blockSize = 512;
|
||||
bool byteAddressed = true;
|
||||
|
||||
switch(dev.Type)
|
||||
{
|
||||
@@ -66,9 +66,9 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
if(!sense)
|
||||
{
|
||||
ExtendedCSD ecsd = Decoders.MMC.Decoders.DecodeExtendedCSD(cmdBuf);
|
||||
blocksToRead = ecsd.OptimalReadSize;
|
||||
blocksToRead = ecsd.OptimalReadSize;
|
||||
results.Blocks = ecsd.SectorCount;
|
||||
blockSize = (uint)(ecsd.SectorSize == 1 ? 4096 : 512);
|
||||
blockSize = (uint)(ecsd.SectorSize == 1 ? 4096 : 512);
|
||||
// Supposing it's high-capacity MMC if it has Extended CSD...
|
||||
byteAddressed = false;
|
||||
}
|
||||
@@ -80,9 +80,10 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
{
|
||||
CSD csd = Decoders.MMC.Decoders.DecodeCSD(cmdBuf);
|
||||
results.Blocks = (ulong)((csd.Size + 1) * Math.Pow(2, csd.SizeMultiplier + 2));
|
||||
blockSize = (uint)Math.Pow(2, csd.ReadBlockLength);
|
||||
blockSize = (uint)Math.Pow(2, csd.ReadBlockLength);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case DeviceType.SecureDigital:
|
||||
@@ -98,6 +99,7 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
// Structure >=1 for SDHC/SDXC, so that's block addressed
|
||||
byteAddressed = csd.Structure == 0;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -123,34 +125,34 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
return results;
|
||||
}
|
||||
|
||||
results.A = 0; // <3ms
|
||||
results.B = 0; // >=3ms, <10ms
|
||||
results.C = 0; // >=10ms, <50ms
|
||||
results.D = 0; // >=50ms, <150ms
|
||||
results.E = 0; // >=150ms, <500ms
|
||||
results.F = 0; // >=500ms
|
||||
results.A = 0; // <3ms
|
||||
results.B = 0; // >=3ms, <10ms
|
||||
results.C = 0; // >=10ms, <50ms
|
||||
results.D = 0; // >=50ms, <150ms
|
||||
results.E = 0; // >=150ms, <500ms
|
||||
results.F = 0; // >=500ms
|
||||
results.Errored = 0;
|
||||
DateTime start;
|
||||
DateTime end;
|
||||
results.ProcessingTime = 0;
|
||||
double currentSpeed = 0;
|
||||
results.MaxSpeed = double.MinValue;
|
||||
results.MinSpeed = double.MaxValue;
|
||||
results.MaxSpeed = double.MinValue;
|
||||
results.MinSpeed = double.MaxValue;
|
||||
results.UnreadableSectors = new List<ulong>();
|
||||
results.SeekMax = double.MinValue;
|
||||
results.SeekMin = double.MaxValue;
|
||||
results.SeekTotal = 0;
|
||||
results.SeekMax = double.MinValue;
|
||||
results.SeekMin = double.MaxValue;
|
||||
results.SeekTotal = 0;
|
||||
const int SEEK_TIMES = 1000;
|
||||
|
||||
Random rnd = new Random();
|
||||
|
||||
aborted = false;
|
||||
aborted = false;
|
||||
System.Console.CancelKeyPress += (sender, e) => e.Cancel = aborted = true;
|
||||
|
||||
DicConsole.WriteLine("Reading {0} sectors at a time.", blocksToRead);
|
||||
|
||||
MhddLog mhddLog = new MhddLog(mhddLogPath, dev, results.Blocks, blockSize, blocksToRead);
|
||||
IbgLog ibgLog = new IbgLog(ibgLogPath, SD_PROFILE);
|
||||
IbgLog ibgLog = new IbgLog(ibgLogPath, SD_PROFILE);
|
||||
|
||||
start = DateTime.UtcNow;
|
||||
for(ulong i = 0; i < results.Blocks; i += blocksToRead)
|
||||
@@ -159,10 +161,10 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
|
||||
if(results.Blocks - i < blocksToRead) blocksToRead = (byte)(results.Blocks - i);
|
||||
|
||||
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#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;
|
||||
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#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);
|
||||
|
||||
@@ -171,12 +173,12 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
|
||||
if(!error)
|
||||
{
|
||||
if(duration >= 500) results.F += blocksToRead;
|
||||
if(duration >= 500) results.F += blocksToRead;
|
||||
else if(duration >= 150) results.E += blocksToRead;
|
||||
else if(duration >= 50) results.D += blocksToRead;
|
||||
else if(duration >= 10) results.C += blocksToRead;
|
||||
else if(duration >= 3) results.B += blocksToRead;
|
||||
else results.A += blocksToRead;
|
||||
else if(duration >= 50) results.D += blocksToRead;
|
||||
else if(duration >= 10) results.C += blocksToRead;
|
||||
else if(duration >= 3) results.B += blocksToRead;
|
||||
else results.A += blocksToRead;
|
||||
|
||||
mhddLog.Write(i, duration);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
@@ -191,7 +193,8 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
ibgLog.Write(i, 0);
|
||||
}
|
||||
|
||||
double newSpeed = (double)blockSize * blocksToRead / 1048576 / (duration / 1000);
|
||||
double newSpeed =
|
||||
(double)blockSize * blocksToRead / 1048576 / (duration / 1000);
|
||||
if(!double.IsInfinity(newSpeed)) currentSpeed = newSpeed;
|
||||
}
|
||||
|
||||
@@ -199,7 +202,8 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
DicConsole.WriteLine();
|
||||
mhddLog.Close();
|
||||
ibgLog.Close(dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
|
||||
blockSize * (double)(results.Blocks + 1) / 1024 / (results.ProcessingTime / 1000), devicePath);
|
||||
blockSize * (double)(results.Blocks + 1) / 1024 /
|
||||
(results.ProcessingTime / 1000), devicePath);
|
||||
|
||||
for(int i = 0; i < SEEK_TIMES; i++)
|
||||
{
|
||||
@@ -212,10 +216,10 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
dev.Read(out cmdBuf, out _, seekPos, blockSize, blocksToRead, byteAddressed, TIMEOUT,
|
||||
out double seekCur);
|
||||
|
||||
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#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;
|
||||
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
|
||||
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
|
||||
|
||||
results.SeekTotal += seekCur;
|
||||
GC.Collect();
|
||||
@@ -224,9 +228,9 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
DicConsole.WriteLine();
|
||||
|
||||
results.ProcessingTime /= 1000;
|
||||
results.TotalTime = (end - start).TotalSeconds;
|
||||
results.AvgSpeed = blockSize * (double)(results.Blocks + 1) / 1048576 / results.ProcessingTime;
|
||||
results.SeekTimes = SEEK_TIMES;
|
||||
results.TotalTime = (end - start).TotalSeconds;
|
||||
results.AvgSpeed = blockSize * (double)(results.Blocks + 1) / 1048576 / results.ProcessingTime;
|
||||
results.SeekTimes = SEEK_TIMES;
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace DiscImageChef.Core
|
||||
imageFormat = imageplugin;
|
||||
break;
|
||||
}
|
||||
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
@@ -89,7 +89,7 @@ namespace DiscImageChef.Core
|
||||
imageFormat = imageplugin;
|
||||
break;
|
||||
}
|
||||
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace DiscImageChef.Core
|
||||
DicConsole.WriteLine("Was created with {0} version {1}", imageFormat.Info.Application,
|
||||
imageFormat.Info.ApplicationVersion);
|
||||
else if(!string.IsNullOrWhiteSpace(imageFormat.Info.Application))
|
||||
DicConsole.WriteLine("Was created with {0}", imageFormat.Info.Application);
|
||||
DicConsole.WriteLine("Was created with {0}", imageFormat.Info.Application);
|
||||
DicConsole.WriteLine("Image without headers is {0} bytes long", imageFormat.Info.ImageSize);
|
||||
DicConsole.WriteLine("Contains a media of {0} sectors with a maximum sector size of {1} bytes (if all sectors are of the same size this would be {2} bytes)",
|
||||
imageFormat.Info.Sectors, imageFormat.Info.SectorSize,
|
||||
@@ -214,7 +214,7 @@ namespace DiscImageChef.Core
|
||||
Array.Copy(toc, 0, tmp, 2, toc.Length);
|
||||
tmp[0] = (byte)((toc.Length & 0xFF00) >> 8);
|
||||
tmp[1] = (byte)(toc.Length & 0xFF);
|
||||
toc = tmp;
|
||||
toc = tmp;
|
||||
}
|
||||
|
||||
DicConsole.WriteLine("CompactDisc Table of Contents contained in image:");
|
||||
@@ -233,8 +233,8 @@ namespace DiscImageChef.Core
|
||||
byte[] tmp = new byte[pma.Length + 2];
|
||||
Array.Copy(pma, 0, tmp, 2, pma.Length);
|
||||
tmp[0] = (byte)((pma.Length & 0xFF00) >> 8);
|
||||
tmp[1] = (byte)(pma.Length & 0xFF);
|
||||
pma = tmp;
|
||||
tmp[1] = (byte)(pma.Length & 0xFF);
|
||||
pma = tmp;
|
||||
}
|
||||
|
||||
DicConsole.WriteLine("CompactDisc Power Management Area contained in image:");
|
||||
@@ -253,10 +253,10 @@ namespace DiscImageChef.Core
|
||||
byte[] tmp = new byte[atip.Length + 4];
|
||||
Array.Copy(atip, 0, tmp, 4, atip.Length);
|
||||
tmp[0] = (byte)((atip.Length & 0xFF000000) >> 24);
|
||||
tmp[1] = (byte)((atip.Length & 0xFF0000) >> 16);
|
||||
tmp[2] = (byte)((atip.Length & 0xFF00) >> 8);
|
||||
tmp[3] = (byte)(atip.Length & 0xFF);
|
||||
atip = tmp;
|
||||
tmp[1] = (byte)((atip.Length & 0xFF0000) >> 16);
|
||||
tmp[2] = (byte)((atip.Length & 0xFF00) >> 8);
|
||||
tmp[3] = (byte)(atip.Length & 0xFF);
|
||||
atip = tmp;
|
||||
}
|
||||
|
||||
DicConsole.WriteLine("CompactDisc Absolute Time In Pregroove (ATIP) contained in image:");
|
||||
@@ -277,7 +277,7 @@ namespace DiscImageChef.Core
|
||||
tmp[0] = (byte)((cdtext.Length & 0xFF000000) >> 24);
|
||||
tmp[1] = (byte)((cdtext.Length & 0xFF0000) >> 16);
|
||||
tmp[2] = (byte)((cdtext.Length & 0xFF00) >> 8);
|
||||
tmp[3] = (byte)(cdtext.Length & 0xFF);
|
||||
tmp[3] = (byte)(cdtext.Length & 0xFF);
|
||||
cdtext = tmp;
|
||||
}
|
||||
|
||||
@@ -547,10 +547,13 @@ namespace DiscImageChef.Core
|
||||
if(imageFormat.Sessions != null && imageFormat.Sessions.Count > 0)
|
||||
{
|
||||
DicConsole.WriteLine("Image sessions:");
|
||||
DicConsole.WriteLine("{0,-9}{1,-13}{2,-12}{3,-12}{4,-12}", "Session", "First track", "Last track", "Start", "End");
|
||||
DicConsole.WriteLine("{0,-9}{1,-13}{2,-12}{3,-12}{4,-12}", "Session", "First track", "Last track",
|
||||
"Start", "End");
|
||||
DicConsole.WriteLine("=========================================================");
|
||||
foreach(Session session in imageFormat.Sessions)
|
||||
DicConsole.WriteLine("{0,-9}{1,-13}{2,-12}{3,-12}{4,-12}", session.SessionSequence, session.StartTrack, session.EndTrack, session.StartSector, session.EndSector);
|
||||
DicConsole.WriteLine("{0,-9}{1,-13}{2,-12}{3,-12}{4,-12}", session.SessionSequence,
|
||||
session.StartTrack, session.EndTrack, session.StartSector,
|
||||
session.EndSector);
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
}
|
||||
@@ -564,10 +567,15 @@ namespace DiscImageChef.Core
|
||||
if(imageFormat.Tracks != null && imageFormat.Tracks.Count > 0)
|
||||
{
|
||||
DicConsole.WriteLine("Image tracks:");
|
||||
DicConsole.WriteLine("{0,-7}{1,-17}{2,-6}{3,-8}{4,-12}{5,-8}{6,-12}{7,-12}", "Track", "Type", "Bps", "Raw bps", "Subchannel", "Pregap", "Start", "End");
|
||||
DicConsole.WriteLine("=================================================================================");
|
||||
DicConsole.WriteLine("{0,-7}{1,-17}{2,-6}{3,-8}{4,-12}{5,-8}{6,-12}{7,-12}", "Track", "Type", "Bps",
|
||||
"Raw bps", "Subchannel", "Pregap", "Start", "End");
|
||||
DicConsole
|
||||
.WriteLine("=================================================================================");
|
||||
foreach(Track track in imageFormat.Tracks)
|
||||
DicConsole.WriteLine("{0,-7}{1,-17}{2,-6}{3,-8}{4,-12}{5,-8}{6,-12}{7,-12}", track.TrackSequence, track.TrackType, track.TrackBytesPerSector, track.TrackRawBytesPerSector, track.TrackSubchannelType, track.TrackPregap, track.TrackStartSector, track.TrackEndSector);
|
||||
DicConsole.WriteLine("{0,-7}{1,-17}{2,-6}{3,-8}{4,-12}{5,-8}{6,-12}{7,-12}",
|
||||
track.TrackSequence, track.TrackType, track.TrackBytesPerSector,
|
||||
track.TrackRawBytesPerSector, track.TrackSubchannelType, track.TrackPregap,
|
||||
track.TrackStartSector, track.TrackEndSector);
|
||||
DicConsole.WriteLine();
|
||||
}
|
||||
}
|
||||
@@ -596,10 +604,9 @@ namespace DiscImageChef.Core
|
||||
|
||||
foreach(DumpHardwareType dump in imageFormat.DumpHardware)
|
||||
{
|
||||
if(dump.Manufacturer?.Length > manufacturerLen)
|
||||
manufacturerLen = dump.Manufacturer.Length;
|
||||
if(dump.Model?.Length > modelLen) modelLen = dump.Model.Length;
|
||||
if(dump.Serial?.Length > serialLen) serialLen = dump.Serial.Length;
|
||||
if(dump.Manufacturer?.Length > manufacturerLen) manufacturerLen = dump.Manufacturer.Length;
|
||||
if(dump.Model?.Length > modelLen) modelLen = dump.Model.Length;
|
||||
if(dump.Serial?.Length > serialLen) serialLen = dump.Serial.Length;
|
||||
if(dump.Software?.Name?.Length > softwareLen)
|
||||
softwareLen = dump.Software.Name.Length;
|
||||
if(dump.Software?.Version?.Length > versionLen)
|
||||
@@ -625,7 +632,7 @@ namespace DiscImageChef.Core
|
||||
char[] separator = new char[manufacturerLen + modelLen + serialLen + softwareLen + versionLen + osLen +
|
||||
sectorLen + sectorLen];
|
||||
for(int i = 0; i < separator.Length; i++) separator[i] = '=';
|
||||
string format =
|
||||
string format =
|
||||
$"{{0,-{manufacturerLen}}}{{1,-{modelLen}}}{{2,-{serialLen}}}{{3,-{softwareLen}}}{{4,-{versionLen}}}{{5,-{osLen}}}{{6,-{sectorLen}}}{{7,-{sectorLen}}}";
|
||||
|
||||
DicConsole.WriteLine("Dump hardware information:");
|
||||
|
||||
@@ -43,19 +43,19 @@ namespace DiscImageChef.Core.Logging
|
||||
/// </summary>
|
||||
class IbgLog
|
||||
{
|
||||
CultureInfo ibgCulture;
|
||||
DateTime ibgDatePoint;
|
||||
double ibgDivider;
|
||||
ulong ibgIntSector;
|
||||
double ibgIntSpeed;
|
||||
double ibgMaxSpeed;
|
||||
string ibgMediaType;
|
||||
int ibgSampleRate;
|
||||
CultureInfo ibgCulture;
|
||||
DateTime ibgDatePoint;
|
||||
double ibgDivider;
|
||||
ulong ibgIntSector;
|
||||
double ibgIntSpeed;
|
||||
double ibgMaxSpeed;
|
||||
string ibgMediaType;
|
||||
int ibgSampleRate;
|
||||
StringBuilder ibgSb;
|
||||
int ibgSnaps;
|
||||
bool ibgStartSet;
|
||||
double ibgStartSpeed;
|
||||
string logFile;
|
||||
int ibgSnaps;
|
||||
bool ibgStartSet;
|
||||
double ibgStartSpeed;
|
||||
string logFile;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the IMGBurn log
|
||||
@@ -66,136 +66,136 @@ namespace DiscImageChef.Core.Logging
|
||||
{
|
||||
if(string.IsNullOrEmpty(outputFile)) return;
|
||||
|
||||
logFile = outputFile;
|
||||
ibgSb = new StringBuilder();
|
||||
logFile = outputFile;
|
||||
ibgSb = new StringBuilder();
|
||||
ibgDatePoint = DateTime.Now;
|
||||
ibgCulture = new CultureInfo("en-US");
|
||||
ibgStartSet = false;
|
||||
ibgMaxSpeed = 0;
|
||||
ibgIntSpeed = 0;
|
||||
ibgSnaps = 0;
|
||||
ibgCulture = new CultureInfo("en-US");
|
||||
ibgStartSet = false;
|
||||
ibgMaxSpeed = 0;
|
||||
ibgIntSpeed = 0;
|
||||
ibgSnaps = 0;
|
||||
ibgIntSector = 0;
|
||||
|
||||
switch(currentProfile)
|
||||
{
|
||||
case 0x0001:
|
||||
ibgMediaType = "HDD";
|
||||
ibgDivider = 1353;
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x0005:
|
||||
ibgMediaType = "CD-MO";
|
||||
ibgDivider = 150;
|
||||
ibgDivider = 150;
|
||||
break;
|
||||
case 0x0008:
|
||||
ibgMediaType = "CD-ROM";
|
||||
ibgDivider = 150;
|
||||
ibgDivider = 150;
|
||||
break;
|
||||
case 0x0009:
|
||||
ibgMediaType = "CD-R";
|
||||
ibgDivider = 150;
|
||||
ibgDivider = 150;
|
||||
break;
|
||||
case 0x000A:
|
||||
ibgMediaType = "CD-RW";
|
||||
ibgDivider = 150;
|
||||
ibgDivider = 150;
|
||||
break;
|
||||
case 0x0010:
|
||||
ibgMediaType = "DVD-ROM";
|
||||
ibgDivider = 1353;
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x0011:
|
||||
ibgMediaType = "DVD-R";
|
||||
ibgDivider = 1353;
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x0012:
|
||||
ibgMediaType = "DVD-RAM";
|
||||
ibgDivider = 1353;
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x0013:
|
||||
case 0x0014:
|
||||
ibgMediaType = "DVD-RW";
|
||||
ibgDivider = 1353;
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x0015:
|
||||
case 0x0016:
|
||||
ibgMediaType = "DVD-R DL";
|
||||
ibgDivider = 1353;
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x0017:
|
||||
ibgMediaType = "DVD-RW DL";
|
||||
ibgDivider = 1353;
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x0018:
|
||||
ibgMediaType = "DVD-Download";
|
||||
ibgDivider = 1353;
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x001A:
|
||||
ibgMediaType = "DVD+RW";
|
||||
ibgDivider = 1353;
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x001B:
|
||||
ibgMediaType = "DVD+R";
|
||||
ibgDivider = 1353;
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x0020:
|
||||
ibgMediaType = "DDCD-ROM";
|
||||
ibgDivider = 150;
|
||||
ibgDivider = 150;
|
||||
break;
|
||||
case 0x0021:
|
||||
ibgMediaType = "DDCD-R";
|
||||
ibgDivider = 150;
|
||||
ibgDivider = 150;
|
||||
break;
|
||||
case 0x0022:
|
||||
ibgMediaType = "DDCD-RW";
|
||||
ibgDivider = 150;
|
||||
ibgDivider = 150;
|
||||
break;
|
||||
case 0x002A:
|
||||
ibgMediaType = "DVD+RW DL";
|
||||
ibgDivider = 1353;
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x002B:
|
||||
ibgMediaType = "DVD+R DL";
|
||||
ibgDivider = 1353;
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
case 0x0040:
|
||||
ibgMediaType = "BD-ROM";
|
||||
ibgDivider = 4500;
|
||||
ibgDivider = 4500;
|
||||
break;
|
||||
case 0x0041:
|
||||
case 0x0042:
|
||||
ibgMediaType = "BD-R";
|
||||
ibgDivider = 4500;
|
||||
ibgDivider = 4500;
|
||||
break;
|
||||
case 0x0043:
|
||||
ibgMediaType = "BD-RE";
|
||||
ibgDivider = 4500;
|
||||
ibgDivider = 4500;
|
||||
break;
|
||||
case 0x0050:
|
||||
ibgMediaType = "HD DVD-ROM";
|
||||
ibgDivider = 4500;
|
||||
ibgDivider = 4500;
|
||||
break;
|
||||
case 0x0051:
|
||||
ibgMediaType = "HD DVD-R";
|
||||
ibgDivider = 4500;
|
||||
ibgDivider = 4500;
|
||||
break;
|
||||
case 0x0052:
|
||||
ibgMediaType = "HD DVD-RAM";
|
||||
ibgDivider = 4500;
|
||||
ibgDivider = 4500;
|
||||
break;
|
||||
case 0x0053:
|
||||
ibgMediaType = "HD DVD-RW";
|
||||
ibgDivider = 4500;
|
||||
ibgDivider = 4500;
|
||||
break;
|
||||
case 0x0058:
|
||||
ibgMediaType = "HD DVD-R DL";
|
||||
ibgDivider = 4500;
|
||||
ibgDivider = 4500;
|
||||
break;
|
||||
case 0x005A:
|
||||
ibgMediaType = "HD DVD-RW DL";
|
||||
ibgDivider = 4500;
|
||||
ibgDivider = 4500;
|
||||
break;
|
||||
default:
|
||||
ibgMediaType = "Unknown";
|
||||
ibgDivider = 1353;
|
||||
ibgDivider = 1353;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -209,7 +209,7 @@ namespace DiscImageChef.Core.Logging
|
||||
{
|
||||
if(logFile == null) return;
|
||||
|
||||
ibgIntSpeed += currentSpeed;
|
||||
ibgIntSpeed += currentSpeed;
|
||||
ibgSampleRate += (int)Math.Floor((DateTime.Now - ibgDatePoint).TotalMilliseconds);
|
||||
ibgSnaps++;
|
||||
|
||||
@@ -218,18 +218,18 @@ namespace DiscImageChef.Core.Logging
|
||||
if(ibgIntSpeed > 0 && !ibgStartSet)
|
||||
{
|
||||
ibgStartSpeed = ibgIntSpeed / ibgSnaps / ibgDivider;
|
||||
ibgStartSet = true;
|
||||
ibgStartSet = true;
|
||||
}
|
||||
|
||||
ibgSb.AppendFormat("{0:0.00},{1},{2:0},0", ibgIntSpeed / ibgSnaps / ibgDivider, ibgIntSector, ibgSampleRate)
|
||||
.AppendLine();
|
||||
if(ibgIntSpeed / ibgSnaps / ibgDivider > ibgMaxSpeed) ibgMaxSpeed = ibgIntSpeed / ibgDivider;
|
||||
|
||||
ibgDatePoint = DateTime.Now;
|
||||
ibgIntSpeed = 0;
|
||||
ibgDatePoint = DateTime.Now;
|
||||
ibgIntSpeed = 0;
|
||||
ibgSampleRate = 0;
|
||||
ibgSnaps = 0;
|
||||
ibgIntSector = sector;
|
||||
ibgSnaps = 0;
|
||||
ibgIntSector = sector;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -242,18 +242,19 @@ namespace DiscImageChef.Core.Logging
|
||||
/// <param name="currentSpeed">Speed at the end</param>
|
||||
/// <param name="averageSpeed">Average speed</param>
|
||||
/// <param name="devicePath">Device path</param>
|
||||
internal void Close(Device dev, ulong blocks, ulong blockSize, double totalSeconds, double currentSpeed,
|
||||
internal void Close(Device dev, ulong blocks, ulong blockSize, double totalSeconds,
|
||||
double currentSpeed,
|
||||
double averageSpeed, string devicePath)
|
||||
{
|
||||
if(logFile == null) return;
|
||||
|
||||
FileStream ibgFs = new FileStream(logFile, FileMode.Create);
|
||||
FileStream ibgFs = new FileStream(logFile, FileMode.Create);
|
||||
StringBuilder ibgHeader = new StringBuilder();
|
||||
string ibgBusType;
|
||||
string ibgBusType;
|
||||
|
||||
if(dev.IsUsb) ibgBusType = "USB";
|
||||
if(dev.IsUsb) ibgBusType = "USB";
|
||||
else if(dev.IsFireWire) ibgBusType = "FireWire";
|
||||
else ibgBusType = dev.Type.ToString();
|
||||
else ibgBusType = dev.Type.ToString();
|
||||
|
||||
ibgHeader.AppendLine("IBGD");
|
||||
ibgHeader.AppendLine();
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace DiscImageChef.Core.Logging
|
||||
/// </summary>
|
||||
class MhddLog
|
||||
{
|
||||
string logFile;
|
||||
string logFile;
|
||||
MemoryStream mhddFs;
|
||||
|
||||
/// <summary>
|
||||
@@ -58,7 +58,7 @@ namespace DiscImageChef.Core.Logging
|
||||
{
|
||||
if(dev == null || string.IsNullOrEmpty(outputFile)) return;
|
||||
|
||||
mhddFs = new MemoryStream();
|
||||
mhddFs = new MemoryStream();
|
||||
logFile = outputFile;
|
||||
|
||||
string mode;
|
||||
@@ -86,51 +86,52 @@ namespace DiscImageChef.Core.Logging
|
||||
break;
|
||||
}
|
||||
|
||||
string device = $"DEVICE: {dev.Manufacturer} {dev.Model}";
|
||||
string fw = $"F/W: {dev.Revision}";
|
||||
string sn = $"S/N: {dev.Serial}";
|
||||
string sectors = string.Format(new CultureInfo("en-US"), "SECTORS: {0:n0}", blocks);
|
||||
string device = $"DEVICE: {dev.Manufacturer} {dev.Model}";
|
||||
string fw = $"F/W: {dev.Revision}";
|
||||
string sn = $"S/N: {dev.Serial}";
|
||||
string sectors = string.Format(new CultureInfo("en-US"), "SECTORS: {0:n0}", blocks);
|
||||
string sectorsize = string.Format(new CultureInfo("en-US"), "SECTOR SIZE: {0:n0} bytes", blockSize);
|
||||
string scanblocksize =
|
||||
string.Format(new CultureInfo("en-US"), "SCAN BLOCK SIZE: {0:n0} sectors", blocksToRead);
|
||||
const string MHDD_VER = "VER:2 ";
|
||||
|
||||
byte[] deviceBytes = Encoding.ASCII.GetBytes(device);
|
||||
byte[] modeBytes = Encoding.ASCII.GetBytes(mode);
|
||||
byte[] fwBytes = Encoding.ASCII.GetBytes(fw);
|
||||
byte[] snBytes = Encoding.ASCII.GetBytes(sn);
|
||||
byte[] sectorsBytes = Encoding.ASCII.GetBytes(sectors);
|
||||
byte[] sectorsizeBytes = Encoding.ASCII.GetBytes(sectorsize);
|
||||
byte[] deviceBytes = Encoding.ASCII.GetBytes(device);
|
||||
byte[] modeBytes = Encoding.ASCII.GetBytes(mode);
|
||||
byte[] fwBytes = Encoding.ASCII.GetBytes(fw);
|
||||
byte[] snBytes = Encoding.ASCII.GetBytes(sn);
|
||||
byte[] sectorsBytes = Encoding.ASCII.GetBytes(sectors);
|
||||
byte[] sectorsizeBytes = Encoding.ASCII.GetBytes(sectorsize);
|
||||
byte[] scanblocksizeBytes = Encoding.ASCII.GetBytes(scanblocksize);
|
||||
byte[] verBytes = Encoding.ASCII.GetBytes(MHDD_VER);
|
||||
byte[] verBytes = Encoding.ASCII.GetBytes(MHDD_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
|
||||
verBytes.Length + 2 * 9 + // New lines
|
||||
4); // Pointer
|
||||
|
||||
byte[] newLine = new byte[2];
|
||||
newLine[0] = 0x0D;
|
||||
newLine[1] = 0x0A;
|
||||
|
||||
mhddFs.Write(BitConverter.GetBytes(pointer), 0, 4);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
mhddFs.Write(verBytes, 0, verBytes.Length);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
mhddFs.Write(modeBytes, 0, modeBytes.Length);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
mhddFs.Write(deviceBytes, 0, deviceBytes.Length);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
mhddFs.Write(fwBytes, 0, fwBytes.Length);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
mhddFs.Write(snBytes, 0, snBytes.Length);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
mhddFs.Write(sectorsBytes, 0, sectorsBytes.Length);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
mhddFs.Write(sectorsizeBytes, 0, sectorsizeBytes.Length);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
mhddFs.Write(scanblocksizeBytes, 0, scanblocksizeBytes.Length);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
mhddFs.Write(verBytes, 0, verBytes.Length);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
mhddFs.Write(modeBytes, 0, modeBytes.Length);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
mhddFs.Write(deviceBytes, 0, deviceBytes.Length);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
mhddFs.Write(fwBytes, 0, fwBytes.Length);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
mhddFs.Write(snBytes, 0, snBytes.Length);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
mhddFs.Write(sectorsBytes, 0, sectorsBytes.Length);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
mhddFs.Write(sectorsizeBytes, 0, sectorsizeBytes.Length);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
mhddFs.Write(scanblocksizeBytes, 0, scanblocksizeBytes.Length);
|
||||
mhddFs.Write(newLine, 0, 2);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -142,10 +143,10 @@ namespace DiscImageChef.Core.Logging
|
||||
{
|
||||
if(logFile == null) return;
|
||||
|
||||
byte[] sectorBytes = BitConverter.GetBytes(sector);
|
||||
byte[] sectorBytes = BitConverter.GetBytes(sector);
|
||||
byte[] durationBytes = BitConverter.GetBytes((ulong)(duration * 1000));
|
||||
|
||||
mhddFs.Write(sectorBytes, 0, 8);
|
||||
mhddFs.Write(sectorBytes, 0, 8);
|
||||
mhddFs.Write(durationBytes, 0, 8);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace DiscImageChef.Core
|
||||
bool inValue = false;
|
||||
string name = null;
|
||||
string value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if(options == null) return parsed;
|
||||
|
||||
|
||||
@@ -51,10 +51,10 @@ namespace DiscImageChef.Core
|
||||
/// <returns>List of found partitions</returns>
|
||||
public static List<Partition> GetAll(IMediaImage image)
|
||||
{
|
||||
PluginBase plugins = new PluginBase();
|
||||
List<Partition> foundPartitions = new List<Partition>();
|
||||
List<Partition> childPartitions = new List<Partition>();
|
||||
List<ulong> checkedLocations = new List<ulong>();
|
||||
PluginBase plugins = new PluginBase();
|
||||
List<Partition> foundPartitions = new List<Partition>();
|
||||
List<Partition> childPartitions = new List<Partition>();
|
||||
List<ulong> checkedLocations = new List<ulong>();
|
||||
|
||||
// Getting all partitions from device (e.g. tracks)
|
||||
if(image.Info.HasPartitions)
|
||||
@@ -98,8 +98,8 @@ namespace DiscImageChef.Core
|
||||
{
|
||||
DicConsole.DebugWriteLine("Partitions", "Trying {0} @ {1}", partitionPlugin.Name,
|
||||
foundPartitions[0].Start);
|
||||
if(!partitionPlugin.GetInformation(image, out List<Partition> partitions, foundPartitions[0].Start)
|
||||
) continue;
|
||||
if(!partitionPlugin.GetInformation(image, out List<Partition> partitions, foundPartitions[0].Start))
|
||||
continue;
|
||||
|
||||
DicConsole.DebugWriteLine("Partitions", "Found {0} @ {1}", partitionPlugin.Name,
|
||||
foundPartitions[0].Start);
|
||||
@@ -115,8 +115,10 @@ namespace DiscImageChef.Core
|
||||
foundPartitions.RemoveAt(0);
|
||||
|
||||
foreach(Partition child in childs)
|
||||
if(checkedLocations.Contains(child.Start)) childPartitions.Add(child);
|
||||
else foundPartitions.Add(child);
|
||||
if(checkedLocations.Contains(child.Start))
|
||||
childPartitions.Add(child);
|
||||
else
|
||||
foundPartitions.Add(child);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -124,7 +126,7 @@ namespace DiscImageChef.Core
|
||||
foundPartitions.RemoveAt(0);
|
||||
}
|
||||
|
||||
DicConsole.DebugWriteLine("Partitions", "Got {0} parents", foundPartitions.Count);
|
||||
DicConsole.DebugWriteLine("Partitions", "Got {0} parents", foundPartitions.Count);
|
||||
DicConsole.DebugWriteLine("Partitions", "Got {0} partitions", childPartitions.Count);
|
||||
}
|
||||
|
||||
@@ -139,7 +141,8 @@ namespace DiscImageChef.Core
|
||||
}
|
||||
|
||||
Partition[] childArray = childPartitions
|
||||
.OrderBy(part => part.Start).ThenBy(part => part.Length).ThenBy(part => part.Scheme).ToArray();
|
||||
.OrderBy(part => part.Start).ThenBy(part => part.Length).ThenBy(part => part.Scheme)
|
||||
.ToArray();
|
||||
|
||||
for(long i = 0; i < childArray.LongLength; i++) childArray[i].Sequence = (ulong)i;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ using DiscImageChef.Decoders.SCSI;
|
||||
|
||||
namespace DiscImageChef.Core
|
||||
{
|
||||
public class PrintScsiModePages
|
||||
public static class PrintScsiModePages
|
||||
{
|
||||
public static void Print(Modes.DecodedMode decMode, PeripheralDeviceTypes devType, byte[] vendorId)
|
||||
{
|
||||
@@ -31,7 +31,7 @@ namespace DiscImageChef.Core
|
||||
}
|
||||
case 0x01:
|
||||
{
|
||||
if(page.Subpage == 0)
|
||||
if(page.Subpage == 0)
|
||||
DicConsole.WriteLine(devType == PeripheralDeviceTypes.MultiMediaDevice
|
||||
? Modes.PrettifyModePage_01_MMC(page.PageResponse)
|
||||
: Modes.PrettifyModePage_01(page.PageResponse));
|
||||
@@ -76,7 +76,7 @@ namespace DiscImageChef.Core
|
||||
}
|
||||
case 0x07:
|
||||
{
|
||||
if(page.Subpage == 0)
|
||||
if(page.Subpage == 0)
|
||||
DicConsole.WriteLine(devType == PeripheralDeviceTypes.MultiMediaDevice
|
||||
? Modes.PrettifyModePage_07_MMC(page.PageResponse)
|
||||
: Modes.PrettifyModePage_07(page.PageResponse));
|
||||
@@ -96,8 +96,7 @@ namespace DiscImageChef.Core
|
||||
if(page.Subpage == 0) DicConsole.WriteLine(Modes.PrettifyModePage_0A(page.PageResponse));
|
||||
else if(page.Subpage == 1)
|
||||
DicConsole.WriteLine(Modes.PrettifyModePage_0A_S01(page.PageResponse));
|
||||
else
|
||||
goto default;
|
||||
else goto default;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -131,7 +130,7 @@ namespace DiscImageChef.Core
|
||||
}
|
||||
case 0x10:
|
||||
{
|
||||
if(page.Subpage == 0)
|
||||
if(page.Subpage == 0)
|
||||
DicConsole.WriteLine(devType == PeripheralDeviceTypes.SequentialAccess
|
||||
? Modes.PrettifyModePage_10_SSC(page.PageResponse)
|
||||
: Modes.PrettifyModePage_10(page.PageResponse));
|
||||
@@ -160,8 +159,7 @@ namespace DiscImageChef.Core
|
||||
if(page.Subpage == 0) DicConsole.WriteLine(Modes.PrettifyModePage_1A(page.PageResponse));
|
||||
else if(page.Subpage == 1)
|
||||
DicConsole.WriteLine(Modes.PrettifyModePage_1A_S01(page.PageResponse));
|
||||
else
|
||||
goto default;
|
||||
else goto default;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -174,14 +172,13 @@ namespace DiscImageChef.Core
|
||||
}
|
||||
case 0x1C:
|
||||
{
|
||||
if(page.Subpage == 0)
|
||||
if(page.Subpage == 0)
|
||||
DicConsole.WriteLine(devType == PeripheralDeviceTypes.MultiMediaDevice
|
||||
? Modes.PrettifyModePage_1C_SFF(page.PageResponse)
|
||||
: Modes.PrettifyModePage_1C(page.PageResponse));
|
||||
else if(page.Subpage == 1)
|
||||
DicConsole.WriteLine(Modes.PrettifyModePage_1C_S01(page.PageResponse));
|
||||
else
|
||||
goto default;
|
||||
else goto default;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -261,8 +258,7 @@ namespace DiscImageChef.Core
|
||||
DicConsole.WriteLine(Modes.PrettifyIBMModePage_3D(page.PageResponse));
|
||||
else if(StringHandlers.CToString(vendorId).Trim() == "HP")
|
||||
DicConsole.WriteLine(Modes.PrettifyHPModePage_3D(page.PageResponse));
|
||||
else
|
||||
goto default;
|
||||
else goto default;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -272,8 +268,7 @@ namespace DiscImageChef.Core
|
||||
DicConsole.WriteLine(Modes.PrettifyFujitsuModePage_3E(page.PageResponse));
|
||||
else if(StringHandlers.CToString(vendorId).Trim() == "HP")
|
||||
DicConsole.WriteLine(Modes.PrettifyHPModePage_3E(page.PageResponse));
|
||||
else
|
||||
goto default;
|
||||
else goto default;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -65,13 +65,12 @@ namespace DiscImageChef.Core
|
||||
XmlSerializer xmlSer = new XmlSerializer(typeof(DeviceReport));
|
||||
xmlSer.Serialize(xmlStream, report);
|
||||
xmlStream.Seek(0, SeekOrigin.Begin);
|
||||
WebRequest request =
|
||||
WebRequest.Create("http://discimagechef.claunia.com/api/uploadreport");
|
||||
WebRequest request = WebRequest.Create("http://discimagechef.claunia.com/api/uploadreport");
|
||||
((HttpWebRequest)request).UserAgent = $"DiscImageChef {typeof(Version).Assembly.GetName().Version}";
|
||||
request.Method = "POST";
|
||||
request.ContentLength = xmlStream.Length;
|
||||
request.ContentType = "application/xml";
|
||||
Stream reqStream = request.GetRequestStream();
|
||||
Stream reqStream = request.GetRequestStream();
|
||||
xmlStream.CopyTo(reqStream);
|
||||
reqStream.Close();
|
||||
WebResponse response = request.GetResponse();
|
||||
|
||||
@@ -52,7 +52,8 @@ namespace DiscImageChef.Core
|
||||
/// <param name="plugins">Image plugins</param>
|
||||
/// <param name="imgChecksums">List of image checksums</param>
|
||||
/// <param name="sidecar">Metadata sidecar</param>
|
||||
static void AudioMedia(IMediaImage image, Guid filterId, string imagePath, FileInfo fi, PluginBase plugins,
|
||||
static void AudioMedia(IMediaImage image, Guid filterId, string imagePath,
|
||||
FileInfo fi, PluginBase plugins,
|
||||
List<ChecksumType> imgChecksums, ref CICMMetadataType sidecar, Encoding encoding)
|
||||
{
|
||||
sidecar.AudioMedia = new[]
|
||||
@@ -62,12 +63,12 @@ namespace DiscImageChef.Core
|
||||
Checksums = imgChecksums.ToArray(),
|
||||
Image = new ImageType
|
||||
{
|
||||
format = image.Format,
|
||||
offset = 0,
|
||||
format = image.Format,
|
||||
offset = 0,
|
||||
offsetSpecified = true,
|
||||
Value = Path.GetFileName(imagePath)
|
||||
Value = Path.GetFileName(imagePath)
|
||||
},
|
||||
Size = fi.Length,
|
||||
Size = fi.Length,
|
||||
Sequence = new SequenceType {MediaTitle = image.Info.MediaTitle}
|
||||
}
|
||||
};
|
||||
@@ -75,12 +76,12 @@ namespace DiscImageChef.Core
|
||||
if(image.Info.MediaSequence != 0 && image.Info.LastMediaSequence != 0)
|
||||
{
|
||||
sidecar.AudioMedia[0].Sequence.MediaSequence = image.Info.MediaSequence;
|
||||
sidecar.AudioMedia[0].Sequence.TotalMedia = image.Info.LastMediaSequence;
|
||||
sidecar.AudioMedia[0].Sequence.TotalMedia = image.Info.LastMediaSequence;
|
||||
}
|
||||
else
|
||||
{
|
||||
sidecar.AudioMedia[0].Sequence.MediaSequence = 1;
|
||||
sidecar.AudioMedia[0].Sequence.TotalMedia = 1;
|
||||
sidecar.AudioMedia[0].Sequence.TotalMedia = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,8 +61,8 @@ namespace DiscImageChef.Core
|
||||
/// <param name="plugins">Image plugins</param>
|
||||
/// <param name="imgChecksums">List of image checksums</param>
|
||||
/// <param name="sidecar">Metadata sidecar</param>
|
||||
static void BlockMedia(IMediaImage image, Guid filterId, string imagePath,
|
||||
FileInfo fi, PluginBase plugins,
|
||||
static void BlockMedia(IMediaImage image, Guid filterId, string imagePath,
|
||||
FileInfo fi, PluginBase plugins,
|
||||
List<ChecksumType> imgChecksums, ref CICMMetadataType sidecar, Encoding encoding)
|
||||
{
|
||||
sidecar.BlockMedia = new[]
|
||||
@@ -70,7 +70,7 @@ namespace DiscImageChef.Core
|
||||
new BlockMediaType
|
||||
{
|
||||
Checksums = imgChecksums.ToArray(),
|
||||
Image = new ImageType
|
||||
Image = new ImageType
|
||||
{
|
||||
format = image.Format,
|
||||
offset = 0,
|
||||
@@ -119,7 +119,7 @@ namespace DiscImageChef.Core
|
||||
};
|
||||
break;
|
||||
case MediaTagType.PCMCIA_CIS:
|
||||
byte[] cis = image.ReadDiskTag(MediaTagType.PCMCIA_CIS);
|
||||
byte[] cis = image.ReadDiskTag(MediaTagType.PCMCIA_CIS);
|
||||
sidecar.BlockMedia[0].PCMCIA = new PCMCIAType
|
||||
{
|
||||
CIS = new DumpType {Checksums = Checksum.GetChecksums(cis).ToArray(), Size = cis.Length}
|
||||
@@ -150,7 +150,7 @@ namespace DiscImageChef.Core
|
||||
{
|
||||
sidecar.BlockMedia[0].PCMCIA.Manufacturer = vers.Manufacturer;
|
||||
sidecar.BlockMedia[0].PCMCIA.ProductName = vers.Product;
|
||||
sidecar.BlockMedia[0].PCMCIA.Compliance =
|
||||
sidecar.BlockMedia[0].PCMCIA.Compliance =
|
||||
$"{vers.MajorVersion}.{vers.MinorVersion}";
|
||||
sidecar.BlockMedia[0].PCMCIA.AdditionalInformation =
|
||||
vers.AdditionalInformation;
|
||||
@@ -236,7 +236,7 @@ namespace DiscImageChef.Core
|
||||
break;
|
||||
case MediaTagType.MMC_ExtendedCSD:
|
||||
if(sidecar.BlockMedia[0].MultiMediaCard == null)
|
||||
sidecar.BlockMedia[0].MultiMediaCard = new MultiMediaCardType();
|
||||
sidecar.BlockMedia[0].MultiMediaCard = new MultiMediaCardType();
|
||||
sidecar.BlockMedia[0].MultiMediaCard.ExtendedCSD = new DumpType
|
||||
{
|
||||
Checksums =
|
||||
@@ -245,8 +245,7 @@ namespace DiscImageChef.Core
|
||||
};
|
||||
break;
|
||||
case MediaTagType.USB_Descriptors:
|
||||
if(sidecar.BlockMedia[0].USB == null)
|
||||
sidecar.BlockMedia[0].USB = new USBType();
|
||||
if(sidecar.BlockMedia[0].USB == null) sidecar.BlockMedia[0].USB = new USBType();
|
||||
sidecar.BlockMedia[0].USB.Descriptors = new DumpType
|
||||
{
|
||||
Checksums =
|
||||
@@ -255,8 +254,7 @@ namespace DiscImageChef.Core
|
||||
};
|
||||
break;
|
||||
case MediaTagType.SCSI_MODESENSE_6:
|
||||
if(sidecar.BlockMedia[0].SCSI == null)
|
||||
sidecar.BlockMedia[0].SCSI = new SCSIType();
|
||||
if(sidecar.BlockMedia[0].SCSI == null) sidecar.BlockMedia[0].SCSI = new SCSIType();
|
||||
sidecar.BlockMedia[0].SCSI.ModeSense = new DumpType
|
||||
{
|
||||
Checksums =
|
||||
@@ -265,8 +263,7 @@ namespace DiscImageChef.Core
|
||||
};
|
||||
break;
|
||||
case MediaTagType.SCSI_MODESENSE_10:
|
||||
if(sidecar.BlockMedia[0].SCSI == null)
|
||||
sidecar.BlockMedia[0].SCSI = new SCSIType();
|
||||
if(sidecar.BlockMedia[0].SCSI == null) sidecar.BlockMedia[0].SCSI = new SCSIType();
|
||||
sidecar.BlockMedia[0].SCSI.ModeSense10 = new DumpType
|
||||
{
|
||||
Checksums =
|
||||
@@ -378,7 +375,7 @@ namespace DiscImageChef.Core
|
||||
else
|
||||
{
|
||||
sidecar.BlockMedia[0].FileSystemInformation[0] =
|
||||
new PartitionType {StartSector = 0, EndSector = (int)(image.Info.Sectors - 1)};
|
||||
new PartitionType {StartSector = 0, EndSector = (int)(image.Info.Sectors - 1)};
|
||||
|
||||
Partition wholePart = new Partition
|
||||
{
|
||||
@@ -575,8 +572,8 @@ namespace DiscImageChef.Core
|
||||
try { scpImage.Open(scpFilter); }
|
||||
catch(NotImplementedException) { }
|
||||
|
||||
if(image.Info.Heads == 2 && scpImage.Header.heads == 0 || image.Info.Heads == 1 &&
|
||||
(scpImage.Header.heads == 1 || scpImage.Header.heads == 2))
|
||||
if(image.Info.Heads == 2 && scpImage.Header.heads == 0 || image.Info.Heads == 1 &&
|
||||
(scpImage.Header.heads == 1 || scpImage.Header.heads == 2))
|
||||
if(scpImage.Header.end + 1 >= image.Info.Cylinders)
|
||||
{
|
||||
List<BlockTrackType> scpBlockTrackTypes = new List<BlockTrackType>();
|
||||
@@ -589,7 +586,7 @@ namespace DiscImageChef.Core
|
||||
{
|
||||
Cylinder = t / image.Info.Heads,
|
||||
Head = t % image.Info.Heads,
|
||||
Image = new ImageType
|
||||
Image = new ImageType
|
||||
{
|
||||
format = scpImage.Format,
|
||||
Value = Path.GetFileName(scpFilePath),
|
||||
@@ -610,7 +607,7 @@ namespace DiscImageChef.Core
|
||||
if(scpImage.ScpTracks.TryGetValue(t, out SuperCardPro.TrackHeader scpTrack))
|
||||
{
|
||||
byte[] trackContents =
|
||||
new byte[scpTrack.Entries.Last().dataOffset +
|
||||
new byte[scpTrack.Entries.Last().dataOffset +
|
||||
scpTrack.Entries.Last().trackLength - scpImage.Header.offsets[t] + 1];
|
||||
scpStream.Position = scpImage.Header.offsets[t];
|
||||
scpStream.Read(trackContents, 0, trackContents.Length);
|
||||
@@ -637,7 +634,7 @@ namespace DiscImageChef.Core
|
||||
#endregion
|
||||
|
||||
#region KryoFlux
|
||||
string kfFile = null;
|
||||
string kfFile = null;
|
||||
string basename = Path.Combine(Path.GetDirectoryName(imagePath),
|
||||
Path.GetFileNameWithoutExtension(imagePath));
|
||||
bool kfDir = false;
|
||||
@@ -651,10 +648,8 @@ namespace DiscImageChef.Core
|
||||
kfDir = true;
|
||||
}
|
||||
}
|
||||
else if(File.Exists(basename + "00.0.raw"))
|
||||
kfFile = basename + "00.0.raw";
|
||||
else if(File.Exists(basename + "00.1.raw"))
|
||||
kfFile = basename + "00.1.raw";
|
||||
else if(File.Exists(basename + "00.0.raw")) kfFile = basename + "00.0.raw";
|
||||
else if(File.Exists(basename + "00.1.raw")) kfFile = basename + "00.1.raw";
|
||||
|
||||
if(kfFile != null)
|
||||
{
|
||||
@@ -666,7 +661,7 @@ namespace DiscImageChef.Core
|
||||
try { kfImage.Open(kfFilter); }
|
||||
catch(NotImplementedException) { }
|
||||
|
||||
if(kfImage.Info.Heads == image.Info.Heads)
|
||||
if(kfImage.Info.Heads == image.Info.Heads)
|
||||
if(kfImage.Info.Cylinders >= image.Info.Cylinders)
|
||||
{
|
||||
List<BlockTrackType> kfBlockTrackTypes = new List<BlockTrackType>();
|
||||
@@ -679,14 +674,14 @@ namespace DiscImageChef.Core
|
||||
{
|
||||
Cylinder = kvp.Key / image.Info.Heads,
|
||||
Head = kvp.Key % image.Info.Heads,
|
||||
Image = new ImageType
|
||||
Image = new ImageType
|
||||
{
|
||||
format = kfImage.Format,
|
||||
Value = kfDir
|
||||
? Path
|
||||
.Combine(Path.GetFileName(Path.GetDirectoryName(kvp.Value.GetBasePath())),
|
||||
kvp.Value.GetFilename())
|
||||
: kvp.Value.GetFilename(),
|
||||
Value = kfDir
|
||||
? Path
|
||||
.Combine(Path.GetFileName(Path.GetDirectoryName(kvp.Value.GetBasePath())),
|
||||
kvp.Value.GetFilename())
|
||||
: kvp.Value.GetFilename(),
|
||||
offset = 0
|
||||
}
|
||||
};
|
||||
@@ -703,7 +698,7 @@ namespace DiscImageChef.Core
|
||||
|
||||
Stream kfStream = kvp.Value.GetDataForkStream();
|
||||
byte[] trackContents = new byte[kfStream.Length];
|
||||
kfStream.Position = 0;
|
||||
kfStream.Position = 0;
|
||||
kfStream.Read(trackContents, 0, trackContents.Length);
|
||||
kfBlockTrackType.Size = trackContents.Length;
|
||||
kfBlockTrackType.Checksums = Checksum.GetChecksums(trackContents).ToArray();
|
||||
@@ -741,7 +736,7 @@ namespace DiscImageChef.Core
|
||||
try { dfiImage.Open(dfiFilter); }
|
||||
catch(NotImplementedException) { }
|
||||
|
||||
if(image.Info.Heads == dfiImage.Info.Heads)
|
||||
if(image.Info.Heads == dfiImage.Info.Heads)
|
||||
if(dfiImage.Info.Cylinders >= image.Info.Cylinders)
|
||||
{
|
||||
List<BlockTrackType> dfiBlockTrackTypes = new List<BlockTrackType>();
|
||||
@@ -771,8 +766,8 @@ namespace DiscImageChef.Core
|
||||
dfiImage.TrackLengths.TryGetValue(t, out long length))
|
||||
{
|
||||
dfiBlockTrackType.Image.offset = offset;
|
||||
byte[] trackContents = new byte[length];
|
||||
dfiStream.Position = offset;
|
||||
byte[] trackContents = new byte[length];
|
||||
dfiStream.Position = offset;
|
||||
dfiStream.Read(trackContents, 0, trackContents.Length);
|
||||
dfiBlockTrackType.Size = trackContents.Length;
|
||||
dfiBlockTrackType.Checksums = Checksum.GetChecksums(trackContents).ToArray();
|
||||
|
||||
@@ -52,19 +52,25 @@ namespace DiscImageChef.Core
|
||||
{
|
||||
new BlockMediaType
|
||||
{
|
||||
Image = new ImageType {format = "Directory", offsetSpecified = false, Value = folderName},
|
||||
Sequence = new SequenceType {MediaTitle = folderName, MediaSequence = 1, TotalMedia = 1},
|
||||
Image = new ImageType
|
||||
{
|
||||
format = "Directory",
|
||||
offsetSpecified = false,
|
||||
Value = folderName
|
||||
},
|
||||
Sequence =
|
||||
new SequenceType {MediaTitle = folderName, MediaSequence = 1, TotalMedia = 1},
|
||||
PhysicalBlockSize = blockSize,
|
||||
LogicalBlockSize = blockSize,
|
||||
LogicalBlockSize = blockSize,
|
||||
TapeInformation = new[]
|
||||
{
|
||||
new TapePartitionType
|
||||
{
|
||||
Image = new ImageType
|
||||
{
|
||||
format = "Directory",
|
||||
format = "Directory",
|
||||
offsetSpecified = false,
|
||||
Value = folderName
|
||||
Value = folderName
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -72,32 +78,32 @@ namespace DiscImageChef.Core
|
||||
}
|
||||
};
|
||||
|
||||
long currentBlock = 0;
|
||||
long totalSize = 0;
|
||||
Checksum tapeWorker = new Checksum();
|
||||
List<TapeFileType> tapeFiles = new List<TapeFileType>();
|
||||
long currentBlock = 0;
|
||||
long totalSize = 0;
|
||||
Checksum tapeWorker = new Checksum();
|
||||
List<TapeFileType> tapeFiles = new List<TapeFileType>();
|
||||
|
||||
for(int i = 0; i < files.Count; i++)
|
||||
{
|
||||
FileStream fs = new FileStream(files[i], FileMode.Open, FileAccess.Read);
|
||||
Checksum fileWorker = new Checksum();
|
||||
FileStream fs = new FileStream(files[i], FileMode.Open, FileAccess.Read);
|
||||
Checksum fileWorker = new Checksum();
|
||||
TapeFileType tapeFile = new TapeFileType
|
||||
{
|
||||
Image = new ImageType
|
||||
{
|
||||
format = "Raw disk image (sector by sector copy)",
|
||||
offset = 0,
|
||||
Value = Path.GetFileName(files[i])
|
||||
Value = Path.GetFileName(files[i])
|
||||
},
|
||||
Size = fs.Length,
|
||||
BlockSize = blockSize,
|
||||
Size = fs.Length,
|
||||
BlockSize = blockSize,
|
||||
StartBlock = currentBlock,
|
||||
Sequence = i
|
||||
Sequence = i
|
||||
};
|
||||
|
||||
const uint SECTORS_TO_READ = 512;
|
||||
long sectors = fs.Length / blockSize;
|
||||
long doneSectors = 0;
|
||||
long sectors = fs.Length / blockSize;
|
||||
long doneSectors = 0;
|
||||
|
||||
InitProgress2();
|
||||
while(doneSectors < sectors)
|
||||
@@ -125,51 +131,51 @@ namespace DiscImageChef.Core
|
||||
tapeWorker.Update(sector);
|
||||
}
|
||||
|
||||
tapeFile.EndBlock = tapeFile.StartBlock + sectors - 1;
|
||||
currentBlock += sectors;
|
||||
totalSize += fs.Length;
|
||||
tapeFile.Checksums = fileWorker.End().ToArray();
|
||||
tapeFile.EndBlock = tapeFile.StartBlock + sectors - 1;
|
||||
currentBlock += sectors;
|
||||
totalSize += fs.Length;
|
||||
tapeFile.Checksums = fileWorker.End().ToArray();
|
||||
tapeFiles.Add(tapeFile);
|
||||
|
||||
EndProgress2();
|
||||
}
|
||||
|
||||
sidecar.BlockMedia[0].Checksums = tapeWorker.End().ToArray();
|
||||
sidecar.BlockMedia[0].ContentChecksums = sidecar.BlockMedia[0].Checksums;
|
||||
sidecar.BlockMedia[0].Size = totalSize;
|
||||
sidecar.BlockMedia[0].LogicalBlocks = currentBlock;
|
||||
sidecar.BlockMedia[0].TapeInformation[0].EndBlock = currentBlock - 1;
|
||||
sidecar.BlockMedia[0].TapeInformation[0].Size = totalSize;
|
||||
sidecar.BlockMedia[0].Checksums = tapeWorker.End().ToArray();
|
||||
sidecar.BlockMedia[0].ContentChecksums = sidecar.BlockMedia[0].Checksums;
|
||||
sidecar.BlockMedia[0].Size = totalSize;
|
||||
sidecar.BlockMedia[0].LogicalBlocks = currentBlock;
|
||||
sidecar.BlockMedia[0].TapeInformation[0].EndBlock = currentBlock - 1;
|
||||
sidecar.BlockMedia[0].TapeInformation[0].Size = totalSize;
|
||||
sidecar.BlockMedia[0].TapeInformation[0].Checksums = sidecar.BlockMedia[0].Checksums;
|
||||
sidecar.BlockMedia[0].TapeInformation[0].File = tapeFiles.ToArray();
|
||||
sidecar.BlockMedia[0].TapeInformation[0].File = tapeFiles.ToArray();
|
||||
|
||||
// This is purely for convenience, as typically these kind of data represents QIC tapes
|
||||
if(blockSize == 512)
|
||||
{
|
||||
sidecar.BlockMedia[0].DiskType = "Quarter-inch cartridge";
|
||||
|
||||
if(totalSize <= 20 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-11";
|
||||
else if(totalSize <= 40 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-40";
|
||||
else if(totalSize <= 60 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-24";
|
||||
else if(totalSize <= 80 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-80";
|
||||
else if(totalSize <= 120 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-120";
|
||||
else if(totalSize <= 150 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-150";
|
||||
else if(totalSize <= 320 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-320";
|
||||
else if(totalSize <= 340 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-3010";
|
||||
else if(totalSize <= 525 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-525";
|
||||
else if(totalSize <= 670 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-3020";
|
||||
else if(totalSize <= 1200 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-3080";
|
||||
else if(totalSize <= 1350 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-1350";
|
||||
if(totalSize <= 20 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-11";
|
||||
else if(totalSize <= 40 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-40";
|
||||
else if(totalSize <= 60 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-24";
|
||||
else if(totalSize <= 80 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-80";
|
||||
else if(totalSize <= 120 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-120";
|
||||
else if(totalSize <= 150 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-150";
|
||||
else if(totalSize <= 320 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-320";
|
||||
else if(totalSize <= 340 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-3010";
|
||||
else if(totalSize <= 525 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-525";
|
||||
else if(totalSize <= 670 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-3020";
|
||||
else if(totalSize <= 1200 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-3080";
|
||||
else if(totalSize <= 1350 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-1350";
|
||||
else if(totalSize <= (long)4000 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-3095";
|
||||
else
|
||||
{
|
||||
sidecar.BlockMedia[0].DiskType = "Unknown tape";
|
||||
sidecar.BlockMedia[0].DiskType = "Unknown tape";
|
||||
sidecar.BlockMedia[0].DiskSubType = "Unknown tape";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sidecar.BlockMedia[0].DiskType = "Unknown tape";
|
||||
sidecar.BlockMedia[0].DiskType = "Unknown tape";
|
||||
sidecar.BlockMedia[0].DiskSubType = "Unknown tape";
|
||||
}
|
||||
|
||||
|
||||
@@ -34,13 +34,13 @@ namespace DiscImageChef.Core
|
||||
{
|
||||
public static partial class Sidecar
|
||||
{
|
||||
public static event InitProgressHandler InitProgressEvent;
|
||||
public static event UpdateProgressHandler UpdateProgressEvent;
|
||||
public static event EndProgressHandler EndProgressEvent;
|
||||
public static event InitProgressHandler2 InitProgressEvent2;
|
||||
public static event InitProgressHandler InitProgressEvent;
|
||||
public static event UpdateProgressHandler UpdateProgressEvent;
|
||||
public static event EndProgressHandler EndProgressEvent;
|
||||
public static event InitProgressHandler2 InitProgressEvent2;
|
||||
public static event UpdateProgressHandler2 UpdateProgressEvent2;
|
||||
public static event EndProgressHandler2 EndProgressEvent2;
|
||||
public static event UpdateStatusHandler UpdateStatusEvent;
|
||||
public static event EndProgressHandler2 EndProgressEvent2;
|
||||
public static event UpdateStatusHandler UpdateStatusEvent;
|
||||
|
||||
public static void InitProgress()
|
||||
{
|
||||
|
||||
@@ -44,19 +44,19 @@ namespace DiscImageChef.Core
|
||||
long m, s, f;
|
||||
if(lba >= -150)
|
||||
{
|
||||
m = (lba + 150) / (75 * 60);
|
||||
lba -= m * (75 * 60);
|
||||
s = (lba + 150) / 75;
|
||||
lba -= s * 75;
|
||||
f = lba + 150;
|
||||
m = (lba + 150) / (75 * 60);
|
||||
lba -= m * (75 * 60);
|
||||
s = (lba + 150) / 75;
|
||||
lba -= s * 75;
|
||||
f = lba + 150;
|
||||
}
|
||||
else
|
||||
{
|
||||
m = (lba + 450150) / (75 * 60);
|
||||
lba -= m * (75 * 60);
|
||||
s = (lba + 450150) / 75;
|
||||
lba -= s * 75;
|
||||
f = lba + 450150;
|
||||
m = (lba + 450150) / (75 * 60);
|
||||
lba -= m * (75 * 60);
|
||||
s = (lba + 450150) / 75;
|
||||
lba -= s * 75;
|
||||
f = lba + 450150;
|
||||
}
|
||||
|
||||
return $"{m}:{s:D2}:{f:D2}";
|
||||
@@ -72,23 +72,23 @@ namespace DiscImageChef.Core
|
||||
long h, m, s, f;
|
||||
if(lba >= -150)
|
||||
{
|
||||
h = (lba + 150) / (75 * 60 * 60);
|
||||
lba -= h * (75 * 60 * 60);
|
||||
m = (lba + 150) / (75 * 60);
|
||||
lba -= m * (75 * 60);
|
||||
s = (lba + 150) / 75;
|
||||
lba -= s * 75;
|
||||
f = lba + 150;
|
||||
h = (lba + 150) / (75 * 60 * 60);
|
||||
lba -= h * (75 * 60 * 60);
|
||||
m = (lba + 150) / (75 * 60);
|
||||
lba -= m * (75 * 60);
|
||||
s = (lba + 150) / 75;
|
||||
lba -= s * 75;
|
||||
f = lba + 150;
|
||||
}
|
||||
else
|
||||
{
|
||||
h = (lba + 450150 * 2) / (75 * 60 * 60);
|
||||
lba -= h * (75 * 60 * 60);
|
||||
m = (lba + 450150 * 2) / (75 * 60);
|
||||
lba -= m * (75 * 60);
|
||||
s = (lba + 450150 * 2) / 75;
|
||||
lba -= s * 75;
|
||||
f = lba + 450150 * 2;
|
||||
h = (lba + 450150 * 2) / (75 * 60 * 60);
|
||||
lba -= h * (75 * 60 * 60);
|
||||
m = (lba + 450150 * 2) / (75 * 60);
|
||||
lba -= m * (75 * 60);
|
||||
s = (lba + 450150 * 2) / 75;
|
||||
lba -= s * 75;
|
||||
f = lba + 450150 * 2;
|
||||
}
|
||||
|
||||
return string.Format("{3}:{0:D2}:{1:D2}:{2:D2}", m, s, f, h);
|
||||
|
||||
@@ -52,7 +52,8 @@ namespace DiscImageChef.Core
|
||||
/// <param name="plugins">Image plugins</param>
|
||||
/// <param name="imgChecksums">List of image checksums</param>
|
||||
/// <param name="sidecar">Metadata sidecar</param>
|
||||
static void LinearMedia(IMediaImage image, Guid filterId, string imagePath, FileInfo fi, PluginBase plugins,
|
||||
static void LinearMedia(IMediaImage image, Guid filterId, string imagePath,
|
||||
FileInfo fi, PluginBase plugins,
|
||||
List<ChecksumType> imgChecksums, ref CICMMetadataType sidecar, Encoding encoding)
|
||||
{
|
||||
sidecar.LinearMedia = new[]
|
||||
@@ -62,10 +63,10 @@ namespace DiscImageChef.Core
|
||||
Checksums = imgChecksums.ToArray(),
|
||||
Image = new ImageType
|
||||
{
|
||||
format = image.Format,
|
||||
offset = 0,
|
||||
format = image.Format,
|
||||
offset = 0,
|
||||
offsetSpecified = true,
|
||||
Value = Path.GetFileName(imagePath)
|
||||
Value = Path.GetFileName(imagePath)
|
||||
},
|
||||
Size = fi.Length
|
||||
}
|
||||
|
||||
@@ -61,8 +61,8 @@ namespace DiscImageChef.Core
|
||||
/// <param name="plugins">Image plugins</param>
|
||||
/// <param name="imgChecksums">List of image checksums</param>
|
||||
/// <param name="sidecar">Metadata sidecar</param>
|
||||
static void OpticalDisc(IMediaImage image, Guid filterId, string imagePath,
|
||||
FileInfo fi, PluginBase plugins,
|
||||
static void OpticalDisc(IMediaImage image, Guid filterId, string imagePath,
|
||||
FileInfo fi, PluginBase plugins,
|
||||
List<ChecksumType> imgChecksums, ref CICMMetadataType sidecar, Encoding encoding)
|
||||
{
|
||||
sidecar.OpticalDisc = new[]
|
||||
@@ -70,7 +70,7 @@ namespace DiscImageChef.Core
|
||||
new OpticalDiscType
|
||||
{
|
||||
Checksums = imgChecksums.ToArray(),
|
||||
Image = new ImageType
|
||||
Image = new ImageType
|
||||
{
|
||||
format = image.Format,
|
||||
offset = 0,
|
||||
@@ -228,7 +228,7 @@ namespace DiscImageChef.Core
|
||||
break;
|
||||
}
|
||||
|
||||
if(dskType == MediaType.DVDR && pfi.Value.PartVersion == 6) dskType = MediaType.DVDRDL;
|
||||
if(dskType == MediaType.DVDR && pfi.Value.PartVersion == 6) dskType = MediaType.DVDRDL;
|
||||
if(dskType == MediaType.DVDRW && pfi.Value.PartVersion == 3)
|
||||
dskType = MediaType.DVDRWDL;
|
||||
if(dskType == MediaType.GOD && pfi.Value.DiscSize == DVDSize.OneTwenty)
|
||||
@@ -294,11 +294,11 @@ namespace DiscImageChef.Core
|
||||
{
|
||||
new XboxSecuritySectorsType
|
||||
{
|
||||
RequestNumber = 0,
|
||||
RequestVersion = 1,
|
||||
RequestNumber = 0,
|
||||
RequestVersion = 1,
|
||||
SecuritySectors = new DumpType
|
||||
{
|
||||
Image = Path.GetFileName(imagePath),
|
||||
Image = Path.GetFileName(imagePath),
|
||||
Checksums =
|
||||
Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.Xbox_SecuritySector))
|
||||
.ToArray(),
|
||||
@@ -332,7 +332,7 @@ namespace DiscImageChef.Core
|
||||
|
||||
try
|
||||
{
|
||||
List<Session> sessions = image.Sessions;
|
||||
List<Session> sessions = image.Sessions;
|
||||
sidecar.OpticalDisc[0].Sessions = sessions?.Count ?? 1;
|
||||
}
|
||||
catch { sidecar.OpticalDisc[0].Sessions = 1; }
|
||||
@@ -350,7 +350,7 @@ namespace DiscImageChef.Core
|
||||
sidecar.OpticalDisc[0].Dimensions = Dimensions.DimensionsFromMediaType(image.Info.MediaType);
|
||||
|
||||
InitProgress();
|
||||
|
||||
|
||||
UpdateStatus("Checking filesystems");
|
||||
List<Partition> partitions = Partitions.GetAll(image);
|
||||
Partitions.AddSchemesToStats(partitions);
|
||||
@@ -398,10 +398,10 @@ namespace DiscImageChef.Core
|
||||
break;
|
||||
}
|
||||
|
||||
xmlTrk.Sequence =
|
||||
xmlTrk.Sequence =
|
||||
new TrackSequenceType {Session = trk.TrackSession, TrackNumber = (int)trk.TrackSequence};
|
||||
xmlTrk.StartSector = (long)trk.TrackStartSector;
|
||||
xmlTrk.EndSector = (long)trk.TrackEndSector;
|
||||
xmlTrk.StartSector = (long)trk.TrackStartSector;
|
||||
xmlTrk.EndSector = (long)trk.TrackEndSector;
|
||||
|
||||
if(trk.Indexes != null && trk.Indexes.ContainsKey(0))
|
||||
if(trk.Indexes.TryGetValue(0, out ulong idx0))
|
||||
@@ -470,7 +470,7 @@ namespace DiscImageChef.Core
|
||||
(uint)xmlTrk.Sequence.TrackNumber);
|
||||
UpdateProgress2("Hashings sector {0} of {1}", (long)doneSectors,
|
||||
(long)(trk.TrackEndSector - trk.TrackStartSector + 1));
|
||||
doneSectors += sectors - doneSectors;
|
||||
doneSectors += sectors - doneSectors;
|
||||
}
|
||||
|
||||
trkChkWorker.Update(sector);
|
||||
@@ -539,7 +539,7 @@ namespace DiscImageChef.Core
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
UpdateProgress2("Hashings subchannel sector {0} of {1}", (long)doneSectors,
|
||||
(long)(trk.TrackEndSector - trk.TrackStartSector + 1));
|
||||
doneSectors += sectors - doneSectors;
|
||||
doneSectors += sectors - doneSectors;
|
||||
}
|
||||
|
||||
subChkWorker.Update(sector);
|
||||
@@ -555,9 +555,10 @@ namespace DiscImageChef.Core
|
||||
// For fast debugging, skip checksum
|
||||
//skipChecksum:
|
||||
|
||||
List<Partition> trkPartitions =
|
||||
partitions.Where(p => p.Start >= trk.TrackStartSector && p.End <= trk.TrackEndSector).ToList();
|
||||
|
||||
List<Partition> trkPartitions = partitions
|
||||
.Where(p => p.Start >= trk.TrackStartSector &&
|
||||
p.End <= trk.TrackEndSector).ToList();
|
||||
|
||||
xmlTrk.FileSystemInformation = new PartitionType[1];
|
||||
if(trkPartitions.Count > 0)
|
||||
{
|
||||
@@ -672,7 +673,7 @@ namespace DiscImageChef.Core
|
||||
// All XGD3 all have the same number of blocks
|
||||
if(dskType == MediaType.XGD2 && sidecar.OpticalDisc[0].Track.Length == 1)
|
||||
{
|
||||
ulong blocks = (ulong)(sidecar.OpticalDisc[0].Track[0].EndSector -
|
||||
ulong blocks = (ulong)(sidecar.OpticalDisc[0].Track[0].EndSector -
|
||||
sidecar.OpticalDisc[0].Track[0].StartSector + 1);
|
||||
if(blocks == 25063 || // Locked (or non compatible drive)
|
||||
blocks == 4229664 || // Xtreme unlock
|
||||
@@ -699,7 +700,7 @@ namespace DiscImageChef.Core
|
||||
Model = image.Info.DriveModel,
|
||||
Firmware = image.Info.DriveFirmwareRevision,
|
||||
Serial = image.Info.DriveSerialNumber,
|
||||
Software = new SoftwareType
|
||||
Software = new SoftwareType
|
||||
{
|
||||
Name = image.Info.Application,
|
||||
Version = image.Info.ApplicationVersion
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace DiscImageChef.Core
|
||||
position += 1048576;
|
||||
}
|
||||
|
||||
data = new byte[fi.Length - position];
|
||||
data = new byte[fi.Length - position];
|
||||
fs.Read(data, 0, (int)(fi.Length - position));
|
||||
|
||||
UpdateProgress("Hashing image file byte {0} of {1}", position, fi.Length);
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace DiscImageChef.Core
|
||||
{
|
||||
if(File.Exists(Path.Combine(Settings.Settings.StatsPath, "Statistics.xml")))
|
||||
{
|
||||
AllStats = new Stats();
|
||||
AllStats = new Stats();
|
||||
CurrentStats = new Stats
|
||||
{
|
||||
OperatingSystems =
|
||||
@@ -87,12 +87,12 @@ namespace DiscImageChef.Core
|
||||
};
|
||||
XmlSerializer xs = new XmlSerializer(AllStats.GetType());
|
||||
StreamReader sr = new StreamReader(Path.Combine(Settings.Settings.StatsPath, "Statistics.xml"));
|
||||
AllStats = (Stats)xs.Deserialize(sr);
|
||||
AllStats = (Stats)xs.Deserialize(sr);
|
||||
sr.Close();
|
||||
}
|
||||
else if(Settings.Settings.Current.Stats != null)
|
||||
{
|
||||
AllStats = new Stats();
|
||||
AllStats = new Stats();
|
||||
CurrentStats = new Stats
|
||||
{
|
||||
OperatingSystems =
|
||||
@@ -147,8 +147,7 @@ namespace DiscImageChef.Core
|
||||
version = DetectOS.GetVersion()
|
||||
});
|
||||
}
|
||||
else if(CurrentStats != null)
|
||||
AllStats.OperatingSystems = CurrentStats.OperatingSystems;
|
||||
else if(CurrentStats != null) AllStats.OperatingSystems = CurrentStats.OperatingSystems;
|
||||
|
||||
if(AllStats.Versions != null)
|
||||
{
|
||||
@@ -167,8 +166,7 @@ namespace DiscImageChef.Core
|
||||
count++;
|
||||
AllStats.Versions.Add(new NameValueStats {name = Version.GetVersion(), Value = count});
|
||||
}
|
||||
else if(CurrentStats != null)
|
||||
AllStats.Versions = CurrentStats.Versions;
|
||||
else if(CurrentStats != null) AllStats.Versions = CurrentStats.Versions;
|
||||
|
||||
FileStream fs = new FileStream(Path.Combine(Settings.Settings.StatsPath, "Statistics.xml"),
|
||||
FileMode.Create);
|
||||
@@ -223,14 +221,13 @@ namespace DiscImageChef.Core
|
||||
xs.Deserialize(fs); // Just to test validity of stats file
|
||||
fs.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
WebRequest request =
|
||||
WebRequest.Create("http://discimagechef.claunia.com/api/uploadstats");
|
||||
WebRequest request = WebRequest.Create("http://discimagechef.claunia.com/api/uploadstats");
|
||||
((HttpWebRequest)request).UserAgent =
|
||||
$"DiscImageChef {typeof(Version).Assembly.GetName().Version}";
|
||||
request.Method = "POST";
|
||||
request.ContentLength = fs.Length;
|
||||
request.ContentType = "application/xml";
|
||||
Stream reqStream = request.GetRequestStream();
|
||||
Stream reqStream = request.GetRequestStream();
|
||||
fs.CopyTo(reqStream);
|
||||
reqStream.Close();
|
||||
WebResponse response = request.GetResponse();
|
||||
@@ -563,11 +560,9 @@ namespace DiscImageChef.Core
|
||||
if(CurrentStats.Devices == null) CurrentStats.Devices = new List<DeviceStats>();
|
||||
|
||||
string deviceBus;
|
||||
if(dev.IsUsb) deviceBus = "USB";
|
||||
else if(dev.IsFireWire)
|
||||
deviceBus = "FireWire";
|
||||
else
|
||||
deviceBus = dev.Type.ToString();
|
||||
if(dev.IsUsb) deviceBus = "USB";
|
||||
else if(dev.IsFireWire) deviceBus = "FireWire";
|
||||
else deviceBus = dev.Type.ToString();
|
||||
|
||||
DeviceStats old = AllStats.Devices.FirstOrDefault(ds => ds.Manufacturer == dev.Manufacturer &&
|
||||
ds.Model == dev.Model &&
|
||||
@@ -664,8 +659,8 @@ namespace DiscImageChef.Core
|
||||
/// <param name="sequential">Time for sequential running</param>
|
||||
/// <param name="maxMemory">Maximum used memory</param>
|
||||
/// <param name="minMemory">Minimum used memory</param>
|
||||
public static void AddBenchmark(Dictionary<string, double> checksums, double entropy, double all,
|
||||
double sequential, long maxMemory, long minMemory)
|
||||
public static void AddBenchmark(Dictionary<string, double> checksums, double entropy, double all,
|
||||
double sequential, long maxMemory, long minMemory)
|
||||
{
|
||||
if(Settings.Settings.Current.Stats == null || !Settings.Settings.Current.Stats.BenchmarkStats) return;
|
||||
|
||||
@@ -708,7 +703,7 @@ namespace DiscImageChef.Core
|
||||
if(Settings.Settings.Current.Stats == null || !Settings.Settings.Current.Stats.VerifyStats) return;
|
||||
|
||||
if(CurrentStats.Verify == null)
|
||||
CurrentStats.Verify =
|
||||
CurrentStats.Verify =
|
||||
new VerifyStats {MediaImages = new VerifiedItems(), Sectors = new ScannedSectors()};
|
||||
|
||||
if(AllStats.Verify == null)
|
||||
@@ -749,8 +744,8 @@ namespace DiscImageChef.Core
|
||||
/// <param name="total">Total sectors</param>
|
||||
/// <param name="error">Errored sectors</param>
|
||||
/// <param name="correct">Correct sectors</param>
|
||||
public static void AddMediaScan(long lessThan3Ms, long lessThan10Ms, long lessThan50Ms, long lessThan150Ms,
|
||||
long lessThan500Ms, long moreThan500Ms, long total, long error,
|
||||
public static void AddMediaScan(long lessThan3Ms, long lessThan10Ms, long lessThan50Ms, long lessThan150Ms,
|
||||
long lessThan500Ms, long moreThan500Ms, long total, long error,
|
||||
long correct)
|
||||
{
|
||||
if(lessThan500Ms <= 0) throw new ArgumentOutOfRangeException(nameof(lessThan500Ms));
|
||||
|
||||
@@ -127,7 +127,8 @@ namespace DiscImageChef.Decoders.ATA
|
||||
/// Words 10 to 19
|
||||
/// Device serial number, right justified, padded with spaces
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)] public string SerialNumber;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
|
||||
public string SerialNumber;
|
||||
/// <summary>
|
||||
/// Word 20
|
||||
/// Manufacturer defined
|
||||
@@ -153,12 +154,14 @@ namespace DiscImageChef.Decoders.ATA
|
||||
/// Words 23 to 26
|
||||
/// Firmware revision, left justified, padded with spaces
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)] public string FirmwareRevision;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
|
||||
public string FirmwareRevision;
|
||||
/// <summary>
|
||||
/// Words 27 to 46
|
||||
/// Model number, left justified, padded with spaces
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)] public string Model;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
|
||||
public string Model;
|
||||
/// <summary>
|
||||
/// Word 47 bits 7 to 0
|
||||
/// Maximum number of sectors that can be transferred per
|
||||
@@ -565,7 +568,8 @@ namespace DiscImageChef.Decoders.ATA
|
||||
/// Words 121 to 125
|
||||
/// Reserved
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public ushort[] ReservedWords121;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
|
||||
public ushort[] ReservedWords121;
|
||||
|
||||
/// <summary>
|
||||
/// Word 126
|
||||
@@ -591,7 +595,8 @@ namespace DiscImageChef.Decoders.ATA
|
||||
/// <summary>
|
||||
/// Words 129 to 159
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 31)] public ushort[] ReservedWords129;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 31)]
|
||||
public ushort[] ReservedWords129;
|
||||
|
||||
/// <summary>
|
||||
/// Word 160
|
||||
@@ -607,7 +612,8 @@ namespace DiscImageChef.Decoders.ATA
|
||||
/// Words 161 to 167
|
||||
/// Reserved for CFA
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)] public ushort[] ReservedCFA;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)]
|
||||
public ushort[] ReservedCFA;
|
||||
|
||||
/// <summary>
|
||||
/// Word 168
|
||||
@@ -624,7 +630,8 @@ namespace DiscImageChef.Decoders.ATA
|
||||
/// Words 170 to 173
|
||||
/// Additional product identifier
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)] public string AdditionalPID;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
|
||||
public string AdditionalPID;
|
||||
|
||||
/// <summary>
|
||||
/// Word 174
|
||||
@@ -641,12 +648,14 @@ namespace DiscImageChef.Decoders.ATA
|
||||
/// Words 176 to 195
|
||||
/// Current media serial number
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)] public string MediaSerial;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 40)]
|
||||
public string MediaSerial;
|
||||
/// <summary>
|
||||
/// Words 196 to 205
|
||||
/// Current media manufacturer
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)] public string MediaManufacturer;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)]
|
||||
public string MediaManufacturer;
|
||||
|
||||
/// <summary>
|
||||
/// Word 206
|
||||
@@ -759,7 +768,8 @@ namespace DiscImageChef.Decoders.ATA
|
||||
/// Words 224 to 229
|
||||
/// Reserved for CE-ATA
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public ushort[] ReservedCEATA224;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
|
||||
public ushort[] ReservedCEATA224;
|
||||
|
||||
/// <summary>
|
||||
/// Words 230 to 233
|
||||
@@ -781,7 +791,8 @@ namespace DiscImageChef.Decoders.ATA
|
||||
/// <summary>
|
||||
/// Words 236 to 254
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 19)] public ushort[] ReservedWords;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 19)]
|
||||
public ushort[] ReservedWords;
|
||||
|
||||
/// <summary>
|
||||
/// Word 255 bits 7 to 0
|
||||
@@ -1490,10 +1501,10 @@ namespace DiscImageChef.Decoders.ATA
|
||||
[Flags]
|
||||
public enum SCTCommandTransportBit : ushort
|
||||
{
|
||||
Vendor15 = 0x8000,
|
||||
Vendor14 = 0x4000,
|
||||
Vendor13 = 0x2000,
|
||||
Vendor12 = 0x1000,
|
||||
Vendor15 = 0x8000,
|
||||
Vendor14 = 0x4000,
|
||||
Vendor13 = 0x2000,
|
||||
Vendor12 = 0x1000,
|
||||
Reserved11 = 0x0800,
|
||||
Reserved10 = 0x0400,
|
||||
Reserved09 = 0x0200,
|
||||
@@ -1857,14 +1868,14 @@ namespace DiscImageChef.Decoders.ATA
|
||||
IdentifyDevice ATAID = (IdentifyDevice)Marshal.PtrToStructure(ptr, typeof(IdentifyDevice));
|
||||
Marshal.FreeHGlobal(ptr);
|
||||
|
||||
ATAID.WWN = DescrambleWWN(ATAID.WWN);
|
||||
ATAID.WWN = DescrambleWWN(ATAID.WWN);
|
||||
ATAID.WWNExtension = DescrambleWWN(ATAID.WWNExtension);
|
||||
|
||||
ATAID.SerialNumber = DescrambleATAString(IdentifyDeviceResponse, 10 * 2, 20);
|
||||
ATAID.FirmwareRevision = DescrambleATAString(IdentifyDeviceResponse, 23 * 2, 8);
|
||||
ATAID.Model = DescrambleATAString(IdentifyDeviceResponse, 27 * 2, 40);
|
||||
ATAID.AdditionalPID = DescrambleATAString(IdentifyDeviceResponse, 170 * 2, 8);
|
||||
ATAID.MediaSerial = DescrambleATAString(IdentifyDeviceResponse, 176 * 2, 40);
|
||||
ATAID.SerialNumber = DescrambleATAString(IdentifyDeviceResponse, 10 * 2, 20);
|
||||
ATAID.FirmwareRevision = DescrambleATAString(IdentifyDeviceResponse, 23 * 2, 8);
|
||||
ATAID.Model = DescrambleATAString(IdentifyDeviceResponse, 27 * 2, 40);
|
||||
ATAID.AdditionalPID = DescrambleATAString(IdentifyDeviceResponse, 170 * 2, 8);
|
||||
ATAID.MediaSerial = DescrambleATAString(IdentifyDeviceResponse, 176 * 2, 40);
|
||||
ATAID.MediaManufacturer = DescrambleATAString(IdentifyDeviceResponse, 196 * 2, 20);
|
||||
|
||||
return ATAID;
|
||||
@@ -1885,12 +1896,14 @@ namespace DiscImageChef.Decoders.ATA
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
bool atapi = false;
|
||||
bool cfa = false;
|
||||
bool cfa = false;
|
||||
|
||||
IdentifyDevice ATAID = IdentifyDeviceResponse.Value;
|
||||
if(ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.NonMagnetic))
|
||||
if((ushort)ATAID.GeneralConfiguration != 0x848A) atapi = true;
|
||||
else cfa = true;
|
||||
if((ushort)ATAID.GeneralConfiguration != 0x848A)
|
||||
atapi = true;
|
||||
else
|
||||
cfa = true;
|
||||
|
||||
if(atapi) sb.AppendLine("ATAPI device");
|
||||
else if(cfa) sb.AppendLine("CompactFlash device");
|
||||
@@ -1924,7 +1937,7 @@ namespace DiscImageChef.Decoders.ATA
|
||||
ata5 = false,
|
||||
ata6 = false,
|
||||
ata7 = false,
|
||||
acs = false,
|
||||
acs = false,
|
||||
acs2 = false,
|
||||
acs3 = false,
|
||||
acs4 = false;
|
||||
@@ -1957,7 +1970,7 @@ namespace DiscImageChef.Decoders.ATA
|
||||
ata5 |= ATAID.MajorVersion.HasFlag(MajorVersionBit.AtaAtapi5);
|
||||
ata6 |= ATAID.MajorVersion.HasFlag(MajorVersionBit.AtaAtapi6);
|
||||
ata7 |= ATAID.MajorVersion.HasFlag(MajorVersionBit.AtaAtapi7);
|
||||
acs |= ATAID.MajorVersion.HasFlag(MajorVersionBit.Ata8ACS);
|
||||
acs |= ATAID.MajorVersion.HasFlag(MajorVersionBit.Ata8ACS);
|
||||
acs2 |= ATAID.MajorVersion.HasFlag(MajorVersionBit.ACS2);
|
||||
acs3 |= ATAID.MajorVersion.HasFlag(MajorVersionBit.ACS3);
|
||||
acs4 |= ATAID.MajorVersion.HasFlag(MajorVersionBit.ACS4);
|
||||
@@ -1972,66 +1985,77 @@ namespace DiscImageChef.Decoders.ATA
|
||||
maxatalevel = 1;
|
||||
if(minatalevel > 1) minatalevel = 1;
|
||||
}
|
||||
|
||||
if(ata2)
|
||||
{
|
||||
sb.Append("ATA-2 ");
|
||||
maxatalevel = 2;
|
||||
if(minatalevel > 2) minatalevel = 2;
|
||||
}
|
||||
|
||||
if(ata3)
|
||||
{
|
||||
sb.Append("ATA-3 ");
|
||||
maxatalevel = 3;
|
||||
if(minatalevel > 3) minatalevel = 3;
|
||||
}
|
||||
|
||||
if(ata4)
|
||||
{
|
||||
sb.Append("ATA/ATAPI-4 ");
|
||||
maxatalevel = 4;
|
||||
if(minatalevel > 4) minatalevel = 4;
|
||||
}
|
||||
|
||||
if(ata5)
|
||||
{
|
||||
sb.Append("ATA/ATAPI-5 ");
|
||||
maxatalevel = 5;
|
||||
if(minatalevel > 5) minatalevel = 5;
|
||||
}
|
||||
|
||||
if(ata6)
|
||||
{
|
||||
sb.Append("ATA/ATAPI-6 ");
|
||||
maxatalevel = 6;
|
||||
if(minatalevel > 6) minatalevel = 6;
|
||||
}
|
||||
|
||||
if(ata7)
|
||||
{
|
||||
sb.Append("ATA/ATAPI-7 ");
|
||||
maxatalevel = 7;
|
||||
if(minatalevel > 7) minatalevel = 7;
|
||||
}
|
||||
|
||||
if(acs)
|
||||
{
|
||||
sb.Append("ATA8-ACS ");
|
||||
maxatalevel = 8;
|
||||
if(minatalevel > 8) minatalevel = 8;
|
||||
}
|
||||
|
||||
if(acs2)
|
||||
{
|
||||
sb.Append("ATA8-ACS2 ");
|
||||
maxatalevel = 9;
|
||||
if(minatalevel > 9) minatalevel = 9;
|
||||
}
|
||||
|
||||
if(acs3)
|
||||
{
|
||||
sb.Append("ATA8-ACS3 ");
|
||||
maxatalevel = 10;
|
||||
if(minatalevel > 10) minatalevel = 10;
|
||||
}
|
||||
|
||||
if(acs4)
|
||||
{
|
||||
sb.Append("ATA8-ACS4 ");
|
||||
maxatalevel = 11;
|
||||
if(minatalevel > 11) minatalevel = 11;
|
||||
}
|
||||
|
||||
sb.AppendLine();
|
||||
|
||||
sb.Append("Maximum ATA revision supported: ");
|
||||
@@ -2365,8 +2389,10 @@ namespace DiscImageChef.Decoders.ATA
|
||||
}
|
||||
|
||||
if(ATAID.NominalRotationRate != 0x0000 && ATAID.NominalRotationRate != 0xFFFF)
|
||||
if(ATAID.NominalRotationRate == 0x0001) sb.AppendLine("Device does not rotate.");
|
||||
else sb.AppendFormat("Device rotate at {0} rpm", ATAID.NominalRotationRate).AppendLine();
|
||||
if(ATAID.NominalRotationRate == 0x0001)
|
||||
sb.AppendLine("Device does not rotate.");
|
||||
else
|
||||
sb.AppendFormat("Device rotate at {0} rpm", ATAID.NominalRotationRate).AppendLine();
|
||||
|
||||
uint logicalsectorsize = 0;
|
||||
if(!atapi)
|
||||
@@ -2376,17 +2402,19 @@ namespace DiscImageChef.Decoders.ATA
|
||||
if((ATAID.PhysLogSectorSize & 0x8000) == 0x0000 && (ATAID.PhysLogSectorSize & 0x4000) == 0x4000)
|
||||
{
|
||||
if((ATAID.PhysLogSectorSize & 0x1000) == 0x1000)
|
||||
if(ATAID.LogicalSectorWords <= 255 || ATAID.LogicalAlignment == 0xFFFF) logicalsectorsize = 512;
|
||||
else logicalsectorsize = ATAID.LogicalSectorWords * 2;
|
||||
if(ATAID.LogicalSectorWords <= 255 || ATAID.LogicalAlignment == 0xFFFF)
|
||||
logicalsectorsize = 512;
|
||||
else
|
||||
logicalsectorsize = ATAID.LogicalSectorWords * 2;
|
||||
else logicalsectorsize = 512;
|
||||
|
||||
if((ATAID.PhysLogSectorSize & 0x2000) == 0x2000)
|
||||
physicalsectorsize = logicalsectorsize * (uint)Math.Pow(2, ATAID.PhysLogSectorSize & 0xF);
|
||||
physicalsectorsize = logicalsectorsize * (uint)Math.Pow(2, ATAID.PhysLogSectorSize & 0xF);
|
||||
else physicalsectorsize = logicalsectorsize;
|
||||
}
|
||||
else
|
||||
{
|
||||
logicalsectorsize = 512;
|
||||
logicalsectorsize = 512;
|
||||
physicalsectorsize = 512;
|
||||
}
|
||||
|
||||
@@ -2394,7 +2422,7 @@ namespace DiscImageChef.Decoders.ATA
|
||||
sb.AppendFormat("Logical sector size: {0} bytes", logicalsectorsize).AppendLine();
|
||||
|
||||
if(logicalsectorsize != physicalsectorsize && (ATAID.LogicalAlignment & 0x8000) == 0x0000 &&
|
||||
(ATAID.LogicalAlignment & 0x4000) == 0x4000)
|
||||
(ATAID.LogicalAlignment & 0x4000) == 0x4000)
|
||||
sb.AppendFormat("Logical sector starts at offset {0} from physical sector",
|
||||
ATAID.LogicalAlignment & 0x3FFF).AppendLine();
|
||||
|
||||
@@ -2428,70 +2456,75 @@ namespace DiscImageChef.Decoders.ATA
|
||||
if(minatalevel <= 5)
|
||||
if(ATAID.CurrentSectors > 0)
|
||||
sb.AppendFormat("Device size in CHS mode: {0} bytes, {1} Mb, {2} MiB",
|
||||
(ulong)ATAID.CurrentSectors * logicalsectorsize,
|
||||
(ulong)ATAID.CurrentSectors * logicalsectorsize,
|
||||
(ulong)ATAID.CurrentSectors * logicalsectorsize / 1000 / 1000,
|
||||
(ulong)ATAID.CurrentSectors * 512 / 1024 / 1024).AppendLine();
|
||||
(ulong)ATAID.CurrentSectors * 512 / 1024 / 1024).AppendLine();
|
||||
else
|
||||
{
|
||||
ulong currentSectors = (ulong)(ATAID.Cylinders * ATAID.Heads * ATAID.SectorsPerTrack);
|
||||
sb.AppendFormat("Device size in CHS mode: {0} bytes, {1} Mb, {2} MiB",
|
||||
currentSectors * logicalsectorsize,
|
||||
currentSectors * logicalsectorsize,
|
||||
currentSectors * logicalsectorsize / 1000 / 1000,
|
||||
currentSectors * 512 / 1024 / 1024).AppendLine();
|
||||
currentSectors * 512 / 1024 / 1024).AppendLine();
|
||||
}
|
||||
|
||||
if(ATAID.Capabilities.HasFlag(CapabilitiesBit.LBASupport))
|
||||
if((ulong)ATAID.LBASectors * logicalsectorsize / 1024 / 1024 > 1000000)
|
||||
sb.AppendFormat("Device size in 28-bit LBA mode: {0} bytes, {1} Tb, {2} TiB",
|
||||
(ulong)ATAID.LBASectors * logicalsectorsize,
|
||||
(ulong)ATAID.LBASectors *
|
||||
logicalsectorsize,
|
||||
(ulong)ATAID.LBASectors * logicalsectorsize / 1000 / 1000 / 1000 / 1000,
|
||||
(ulong)ATAID.LBASectors * 512 / 1024 / 1024 / 1024 / 1024).AppendLine();
|
||||
(ulong)ATAID.LBASectors * 512 / 1024 / 1024 / 1024 / 1024)
|
||||
.AppendLine();
|
||||
else if((ulong)ATAID.LBASectors * logicalsectorsize / 1024 / 1024 > 1000)
|
||||
sb.AppendFormat("Device size in 28-bit LBA mode: {0} bytes, {1} Gb, {2} GiB",
|
||||
(ulong)ATAID.LBASectors * logicalsectorsize,
|
||||
(ulong)ATAID.LBASectors * logicalsectorsize,
|
||||
(ulong)ATAID.LBASectors * logicalsectorsize / 1000 / 1000 / 1000,
|
||||
(ulong)ATAID.LBASectors * 512 / 1024 / 1024 / 1024).AppendLine();
|
||||
(ulong)ATAID.LBASectors * 512 / 1024 / 1024 / 1024).AppendLine();
|
||||
else
|
||||
sb.AppendFormat("Device size in 28-bit LBA mode: {0} bytes, {1} Mb, {2} MiB",
|
||||
(ulong)ATAID.LBASectors * logicalsectorsize,
|
||||
(ulong)ATAID.LBASectors * logicalsectorsize,
|
||||
(ulong)ATAID.LBASectors * logicalsectorsize / 1000 / 1000,
|
||||
(ulong)ATAID.LBASectors * 512 / 1024 / 1024).AppendLine();
|
||||
(ulong)ATAID.LBASectors * 512 / 1024 / 1024).AppendLine();
|
||||
|
||||
if(ATAID.CommandSet2.HasFlag(CommandSetBit2.LBA48))
|
||||
if(ATAID.CommandSet5.HasFlag(CommandSetBit5.ExtSectors))
|
||||
if(ATAID.ExtendedUserSectors * logicalsectorsize / 1024 / 1024 > 1000000)
|
||||
sb.AppendFormat("Device size in 48-bit LBA mode: {0} bytes, {1} Tb, {2} TiB",
|
||||
ATAID.ExtendedUserSectors * logicalsectorsize,
|
||||
ATAID.ExtendedUserSectors *
|
||||
logicalsectorsize,
|
||||
ATAID.ExtendedUserSectors * logicalsectorsize / 1000 / 1000 / 1000 / 1000,
|
||||
ATAID.ExtendedUserSectors * logicalsectorsize / 1024 / 1024 / 1024 / 1024)
|
||||
.AppendLine();
|
||||
else if(ATAID.ExtendedUserSectors * logicalsectorsize / 1024 / 1024 > 1000)
|
||||
sb.AppendFormat("Device size in 48-bit LBA mode: {0} bytes, {1} Gb, {2} GiB",
|
||||
ATAID.ExtendedUserSectors * logicalsectorsize,
|
||||
ATAID.ExtendedUserSectors *
|
||||
logicalsectorsize,
|
||||
ATAID.ExtendedUserSectors * logicalsectorsize / 1000 / 1000 / 1000,
|
||||
ATAID.ExtendedUserSectors * logicalsectorsize / 1024 / 1024 / 1024)
|
||||
.AppendLine();
|
||||
else
|
||||
sb.AppendFormat("Device size in 48-bit LBA mode: {0} bytes, {1} Mb, {2} MiB",
|
||||
ATAID.ExtendedUserSectors * logicalsectorsize,
|
||||
ATAID.ExtendedUserSectors * logicalsectorsize,
|
||||
ATAID.ExtendedUserSectors * logicalsectorsize / 1000 / 1000,
|
||||
ATAID.ExtendedUserSectors * logicalsectorsize / 1024 / 1024).AppendLine();
|
||||
else
|
||||
{
|
||||
if(ATAID.LBA48Sectors * logicalsectorsize / 1024 / 1024 > 1000000)
|
||||
sb.AppendFormat("Device size in 48-bit LBA mode: {0} bytes, {1} Tb, {2} TiB",
|
||||
ATAID.LBA48Sectors * logicalsectorsize,
|
||||
ATAID.LBA48Sectors *
|
||||
logicalsectorsize,
|
||||
ATAID.LBA48Sectors * logicalsectorsize / 1000 / 1000 / 1000 / 1000,
|
||||
ATAID.LBA48Sectors * logicalsectorsize / 1024 / 1024 / 1024 / 1024)
|
||||
.AppendLine();
|
||||
else if(ATAID.LBA48Sectors * logicalsectorsize / 1024 / 1024 > 1000)
|
||||
sb.AppendFormat("Device size in 48-bit LBA mode: {0} bytes, {1} Gb, {2} GiB",
|
||||
ATAID.LBA48Sectors * logicalsectorsize,
|
||||
ATAID.LBA48Sectors * logicalsectorsize,
|
||||
ATAID.LBA48Sectors * logicalsectorsize / 1000 / 1000 / 1000,
|
||||
ATAID.LBA48Sectors * logicalsectorsize / 1024 / 1024 / 1024).AppendLine();
|
||||
else
|
||||
sb.AppendFormat("Device size in 48-bit LBA mode: {0} bytes, {1} Mb, {2} MiB",
|
||||
ATAID.LBA48Sectors * logicalsectorsize,
|
||||
ATAID.LBA48Sectors * logicalsectorsize,
|
||||
ATAID.LBA48Sectors * logicalsectorsize / 1000 / 1000,
|
||||
ATAID.LBA48Sectors * logicalsectorsize / 1024 / 1024).AppendLine();
|
||||
}
|
||||
@@ -2505,6 +2538,7 @@ namespace DiscImageChef.Decoders.ATA
|
||||
sb.AppendFormat("{0} bytes per unformatted sector", ATAID.UnformattedBPS).AppendLine();
|
||||
}
|
||||
}
|
||||
|
||||
if((ushort)ATAID.SpecificConfiguration != 0x0000 && (ushort)ATAID.SpecificConfiguration != 0xFFFF)
|
||||
switch(ATAID.SpecificConfiguration)
|
||||
{
|
||||
@@ -2562,6 +2596,7 @@ namespace DiscImageChef.Decoders.ATA
|
||||
sb.AppendLine().Append("IORDY is supported");
|
||||
if(ATAID.Capabilities.HasFlag(CapabilitiesBit.CanDisableIORDY)) sb.Append(" and can be disabled");
|
||||
}
|
||||
|
||||
if(ATAID.Capabilities.HasFlag(CapabilitiesBit.DMASupport)) sb.AppendLine().Append("DMA is supported");
|
||||
|
||||
if(ATAID.Capabilities2.HasFlag(CapabilitiesBit2.MustBeSet) &&
|
||||
@@ -2623,36 +2658,43 @@ namespace DiscImageChef.Decoders.ATA
|
||||
sb.Append("DMA0 ");
|
||||
if(ATAID.DMAActive.HasFlag(TransferMode.Mode0)) sb.Append("(active) ");
|
||||
}
|
||||
|
||||
if(ATAID.DMASupported.HasFlag(TransferMode.Mode1))
|
||||
{
|
||||
sb.Append("DMA1 ");
|
||||
if(ATAID.DMAActive.HasFlag(TransferMode.Mode1)) sb.Append("(active) ");
|
||||
}
|
||||
|
||||
if(ATAID.DMASupported.HasFlag(TransferMode.Mode2))
|
||||
{
|
||||
sb.Append("DMA2 ");
|
||||
if(ATAID.DMAActive.HasFlag(TransferMode.Mode2)) sb.Append("(active) ");
|
||||
}
|
||||
|
||||
if(ATAID.DMASupported.HasFlag(TransferMode.Mode3))
|
||||
{
|
||||
sb.Append("DMA3 ");
|
||||
if(ATAID.DMAActive.HasFlag(TransferMode.Mode3)) sb.Append("(active) ");
|
||||
}
|
||||
|
||||
if(ATAID.DMASupported.HasFlag(TransferMode.Mode4))
|
||||
{
|
||||
sb.Append("DMA4 ");
|
||||
if(ATAID.DMAActive.HasFlag(TransferMode.Mode4)) sb.Append("(active) ");
|
||||
}
|
||||
|
||||
if(ATAID.DMASupported.HasFlag(TransferMode.Mode5))
|
||||
{
|
||||
sb.Append("DMA5 ");
|
||||
if(ATAID.DMAActive.HasFlag(TransferMode.Mode5)) sb.Append("(active) ");
|
||||
}
|
||||
|
||||
if(ATAID.DMASupported.HasFlag(TransferMode.Mode6))
|
||||
{
|
||||
sb.Append("DMA6 ");
|
||||
if(ATAID.DMAActive.HasFlag(TransferMode.Mode6)) sb.Append("(active) ");
|
||||
}
|
||||
|
||||
if(ATAID.DMASupported.HasFlag(TransferMode.Mode7))
|
||||
{
|
||||
sb.Append("DMA7 ");
|
||||
@@ -2666,36 +2708,43 @@ namespace DiscImageChef.Decoders.ATA
|
||||
sb.Append("MDMA0 ");
|
||||
if(ATAID.MDMAActive.HasFlag(TransferMode.Mode0)) sb.Append("(active) ");
|
||||
}
|
||||
|
||||
if(ATAID.MDMASupported.HasFlag(TransferMode.Mode1))
|
||||
{
|
||||
sb.Append("MDMA1 ");
|
||||
if(ATAID.MDMAActive.HasFlag(TransferMode.Mode1)) sb.Append("(active) ");
|
||||
}
|
||||
|
||||
if(ATAID.MDMASupported.HasFlag(TransferMode.Mode2))
|
||||
{
|
||||
sb.Append("MDMA2 ");
|
||||
if(ATAID.MDMAActive.HasFlag(TransferMode.Mode2)) sb.Append("(active) ");
|
||||
}
|
||||
|
||||
if(ATAID.MDMASupported.HasFlag(TransferMode.Mode3))
|
||||
{
|
||||
sb.Append("MDMA3 ");
|
||||
if(ATAID.MDMAActive.HasFlag(TransferMode.Mode3)) sb.Append("(active) ");
|
||||
}
|
||||
|
||||
if(ATAID.MDMASupported.HasFlag(TransferMode.Mode4))
|
||||
{
|
||||
sb.Append("MDMA4 ");
|
||||
if(ATAID.MDMAActive.HasFlag(TransferMode.Mode4)) sb.Append("(active) ");
|
||||
}
|
||||
|
||||
if(ATAID.MDMASupported.HasFlag(TransferMode.Mode5))
|
||||
{
|
||||
sb.Append("MDMA5 ");
|
||||
if(ATAID.MDMAActive.HasFlag(TransferMode.Mode5)) sb.Append("(active) ");
|
||||
}
|
||||
|
||||
if(ATAID.MDMASupported.HasFlag(TransferMode.Mode6))
|
||||
{
|
||||
sb.Append("MDMA6 ");
|
||||
if(ATAID.MDMAActive.HasFlag(TransferMode.Mode6)) sb.Append("(active) ");
|
||||
}
|
||||
|
||||
if(ATAID.MDMASupported.HasFlag(TransferMode.Mode7))
|
||||
{
|
||||
sb.Append("MDMA7 ");
|
||||
@@ -2708,36 +2757,43 @@ namespace DiscImageChef.Decoders.ATA
|
||||
sb.Append("UDMA0 ");
|
||||
if(ATAID.UDMAActive.HasFlag(TransferMode.Mode0)) sb.Append("(active) ");
|
||||
}
|
||||
|
||||
if(ATAID.UDMASupported.HasFlag(TransferMode.Mode1))
|
||||
{
|
||||
sb.Append("UDMA1 ");
|
||||
if(ATAID.UDMAActive.HasFlag(TransferMode.Mode1)) sb.Append("(active) ");
|
||||
}
|
||||
|
||||
if(ATAID.UDMASupported.HasFlag(TransferMode.Mode2))
|
||||
{
|
||||
sb.Append("UDMA2 ");
|
||||
if(ATAID.UDMAActive.HasFlag(TransferMode.Mode2)) sb.Append("(active) ");
|
||||
}
|
||||
|
||||
if(ATAID.UDMASupported.HasFlag(TransferMode.Mode3))
|
||||
{
|
||||
sb.Append("UDMA3 ");
|
||||
if(ATAID.UDMAActive.HasFlag(TransferMode.Mode3)) sb.Append("(active) ");
|
||||
}
|
||||
|
||||
if(ATAID.UDMASupported.HasFlag(TransferMode.Mode4))
|
||||
{
|
||||
sb.Append("UDMA4 ");
|
||||
if(ATAID.UDMAActive.HasFlag(TransferMode.Mode4)) sb.Append("(active) ");
|
||||
}
|
||||
|
||||
if(ATAID.UDMASupported.HasFlag(TransferMode.Mode5))
|
||||
{
|
||||
sb.Append("UDMA5 ");
|
||||
if(ATAID.UDMAActive.HasFlag(TransferMode.Mode5)) sb.Append("(active) ");
|
||||
}
|
||||
|
||||
if(ATAID.UDMASupported.HasFlag(TransferMode.Mode6))
|
||||
{
|
||||
sb.Append("UDMA6 ");
|
||||
if(ATAID.UDMAActive.HasFlag(TransferMode.Mode6)) sb.Append("(active) ");
|
||||
}
|
||||
|
||||
if(ATAID.UDMASupported.HasFlag(TransferMode.Mode7))
|
||||
{
|
||||
sb.Append("UDMA7 ");
|
||||
@@ -2876,66 +2932,79 @@ namespace DiscImageChef.Decoders.ATA
|
||||
sb.AppendLine().Append("NOP is supported");
|
||||
if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.Nop)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet.HasFlag(CommandSetBit.ReadBuffer))
|
||||
{
|
||||
sb.AppendLine().Append("READ BUFFER is supported");
|
||||
if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.ReadBuffer)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet.HasFlag(CommandSetBit.WriteBuffer))
|
||||
{
|
||||
sb.AppendLine().Append("WRITE BUFFER is supported");
|
||||
if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.WriteBuffer)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet.HasFlag(CommandSetBit.HPA))
|
||||
{
|
||||
sb.AppendLine().Append("Host Protected Area is supported");
|
||||
if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.HPA)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet.HasFlag(CommandSetBit.DeviceReset))
|
||||
{
|
||||
sb.AppendLine().Append("DEVICE RESET is supported");
|
||||
if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.DeviceReset)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet.HasFlag(CommandSetBit.Service))
|
||||
{
|
||||
sb.AppendLine().Append("SERVICE interrupt is supported");
|
||||
if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.Service)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet.HasFlag(CommandSetBit.Release))
|
||||
{
|
||||
sb.AppendLine().Append("Release is supported");
|
||||
if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.Release)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet.HasFlag(CommandSetBit.LookAhead))
|
||||
{
|
||||
sb.AppendLine().Append("Look-ahead read is supported");
|
||||
if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.LookAhead)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet.HasFlag(CommandSetBit.WriteCache))
|
||||
{
|
||||
sb.AppendLine().Append("Write cache is supported");
|
||||
if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.WriteCache)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet.HasFlag(CommandSetBit.Packet))
|
||||
{
|
||||
sb.AppendLine().Append("PACKET is supported");
|
||||
if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.Packet)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet.HasFlag(CommandSetBit.PowerManagement))
|
||||
{
|
||||
sb.AppendLine().Append("Power management is supported");
|
||||
if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.PowerManagement)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet.HasFlag(CommandSetBit.RemovableMedia))
|
||||
{
|
||||
sb.AppendLine().Append("Removable media feature set is supported");
|
||||
if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.RemovableMedia)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet.HasFlag(CommandSetBit.SecurityMode))
|
||||
{
|
||||
sb.AppendLine().Append("Security mode is supported");
|
||||
if(ATAID.EnabledCommandSet.HasFlag(CommandSetBit.SecurityMode)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.Capabilities.HasFlag(CapabilitiesBit.LBASupport))
|
||||
sb.AppendLine().Append("28-bit LBA is supported");
|
||||
|
||||
@@ -2947,21 +3016,25 @@ namespace DiscImageChef.Decoders.ATA
|
||||
sb.AppendLine().Append("48-bit LBA is supported");
|
||||
if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.LBA48)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet2.HasFlag(CommandSetBit2.FlushCache))
|
||||
{
|
||||
sb.AppendLine().Append("FLUSH CACHE is supported");
|
||||
if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.FlushCache)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet2.HasFlag(CommandSetBit2.FlushCacheExt))
|
||||
{
|
||||
sb.AppendLine().Append("FLUSH CACHE EXT is supported");
|
||||
if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.FlushCacheExt)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet2.HasFlag(CommandSetBit2.DCO))
|
||||
{
|
||||
sb.AppendLine().Append("Device Configuration Overlay feature set is supported");
|
||||
if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.DCO)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet2.HasFlag(CommandSetBit2.AAM))
|
||||
{
|
||||
sb.AppendLine().Append("Automatic Acoustic Management is supported");
|
||||
@@ -2969,17 +3042,20 @@ namespace DiscImageChef.Decoders.ATA
|
||||
sb.AppendFormat(" and enabled with value {0} (vendor recommends {1}", ATAID.CurrentAAM,
|
||||
ATAID.RecommendedAAM);
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet2.HasFlag(CommandSetBit2.SetMax))
|
||||
{
|
||||
sb.AppendLine().Append("SET MAX security extension is supported");
|
||||
if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.SetMax)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet2.HasFlag(CommandSetBit2.AddressOffsetReservedAreaBoot))
|
||||
{
|
||||
sb.AppendLine().Append("Address Offset Reserved Area Boot is supported");
|
||||
if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.AddressOffsetReservedAreaBoot))
|
||||
sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet2.HasFlag(CommandSetBit2.SetFeaturesRequired))
|
||||
sb.AppendLine().Append("SET FEATURES is required before spin-up");
|
||||
if(ATAID.CommandSet2.HasFlag(CommandSetBit2.PowerUpInStandby))
|
||||
@@ -2987,28 +3063,33 @@ namespace DiscImageChef.Decoders.ATA
|
||||
sb.AppendLine().Append("Power-up in standby is supported");
|
||||
if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.PowerUpInStandby)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet2.HasFlag(CommandSetBit2.RemovableNotification))
|
||||
{
|
||||
sb.AppendLine().Append("Removable Media Status Notification is supported");
|
||||
if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.RemovableNotification))
|
||||
sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet2.HasFlag(CommandSetBit2.APM))
|
||||
{
|
||||
sb.AppendLine().Append("Advanced Power Management is supported");
|
||||
if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.APM))
|
||||
sb.AppendFormat(" and enabled with value {0}", ATAID.CurrentAPM);
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet2.HasFlag(CommandSetBit2.CompactFlash))
|
||||
{
|
||||
sb.AppendLine().Append("CompactFlash feature set is supported");
|
||||
if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.CompactFlash)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet2.HasFlag(CommandSetBit2.RWQueuedDMA))
|
||||
{
|
||||
sb.AppendLine().Append("READ DMA QUEUED and WRITE DMA QUEUED are supported");
|
||||
if(ATAID.EnabledCommandSet2.HasFlag(CommandSetBit2.RWQueuedDMA)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet2.HasFlag(CommandSetBit2.DownloadMicrocode))
|
||||
{
|
||||
sb.AppendLine().Append("DOWNLOAD MICROCODE is supported");
|
||||
@@ -3033,16 +3114,19 @@ namespace DiscImageChef.Decoders.ATA
|
||||
sb.AppendLine().Append("S.M.A.R.T. self-testing is supported");
|
||||
if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.SMARTSelfTest)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet3.HasFlag(CommandSetBit3.SMARTLog))
|
||||
{
|
||||
sb.AppendLine().Append("S.M.A.R.T. error logging is supported");
|
||||
if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.SMARTLog)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet3.HasFlag(CommandSetBit3.IdleImmediate))
|
||||
{
|
||||
sb.AppendLine().Append("IDLE IMMEDIATE with UNLOAD FEATURE is supported");
|
||||
if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.IdleImmediate)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet3.HasFlag(CommandSetBit3.WriteURG))
|
||||
sb.AppendLine().Append("URG bit is supported in WRITE STREAM DMA EXT and WRITE STREAM EXT");
|
||||
if(ATAID.CommandSet3.HasFlag(CommandSetBit3.ReadURG))
|
||||
@@ -3054,26 +3138,31 @@ namespace DiscImageChef.Decoders.ATA
|
||||
sb.AppendLine().Append("WRITE DMA QUEUED FUA EXT is supported");
|
||||
if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.FUAWriteQ)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet3.HasFlag(CommandSetBit3.FUAWrite))
|
||||
{
|
||||
sb.AppendLine().Append("WRITE DMA FUA EXT and WRITE MULTIPLE FUA EXT are supported");
|
||||
if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.FUAWrite)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet3.HasFlag(CommandSetBit3.GPL))
|
||||
{
|
||||
sb.AppendLine().Append("General Purpose Logging is supported");
|
||||
if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.GPL)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet3.HasFlag(CommandSetBit3.Streaming))
|
||||
{
|
||||
sb.AppendLine().Append("Streaming feature set is supported");
|
||||
if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.Streaming)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet3.HasFlag(CommandSetBit3.MCPT))
|
||||
{
|
||||
sb.AppendLine().Append("Media Card Pass Through command set is supported");
|
||||
if(ATAID.EnabledCommandSet3.HasFlag(CommandSetBit3.MCPT)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet3.HasFlag(CommandSetBit3.MediaSerial))
|
||||
{
|
||||
sb.AppendLine().Append("Media Serial is supported");
|
||||
@@ -3089,42 +3178,50 @@ namespace DiscImageChef.Decoders.ATA
|
||||
sb.AppendLine().Append("DSN feature set is supported");
|
||||
if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.DSN)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet4.HasFlag(CommandSetBit4.AMAC))
|
||||
{
|
||||
sb.AppendLine().Append("Accessible Max Address Configuration is supported");
|
||||
if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.AMAC)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet4.HasFlag(CommandSetBit4.ExtPowerCond))
|
||||
{
|
||||
sb.AppendLine().Append("Extended Power Conditions are supported");
|
||||
if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.ExtPowerCond)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet4.HasFlag(CommandSetBit4.ExtStatusReport))
|
||||
{
|
||||
sb.AppendLine().Append("Extended Status Reporting is supported");
|
||||
if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.ExtStatusReport)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet4.HasFlag(CommandSetBit4.FreeFallControl))
|
||||
{
|
||||
sb.AppendLine().Append("Free-fall control feature set is supported");
|
||||
if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.FreeFallControl)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet4.HasFlag(CommandSetBit4.SegmentedDownloadMicrocode))
|
||||
{
|
||||
sb.AppendLine().Append("Segmented feature in DOWNLOAD MICROCODE is supported");
|
||||
if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.SegmentedDownloadMicrocode))
|
||||
sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet4.HasFlag(CommandSetBit4.RWDMAExtGpl))
|
||||
{
|
||||
sb.AppendLine().Append("READ/WRITE DMA EXT GPL are supported");
|
||||
if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.RWDMAExtGpl)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet4.HasFlag(CommandSetBit4.WriteUnc))
|
||||
{
|
||||
sb.AppendLine().Append("WRITE UNCORRECTABLE is supported");
|
||||
if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.WriteUnc)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet4.HasFlag(CommandSetBit4.WRV))
|
||||
{
|
||||
sb.AppendLine().Append("Write/Read/Verify is supported");
|
||||
@@ -3134,12 +3231,14 @@ namespace DiscImageChef.Decoders.ATA
|
||||
if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.WRV))
|
||||
sb.AppendLine().AppendFormat("Current Write/Read/Verify mode: {0}", ATAID.WRVMode);
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet4.HasFlag(CommandSetBit4.DT1825))
|
||||
{
|
||||
sb.AppendLine().Append("DT1825 is supported");
|
||||
if(ATAID.EnabledCommandSet4.HasFlag(CommandSetBit4.DT1825)) sb.Append(" and enabled");
|
||||
}
|
||||
}
|
||||
|
||||
if(ATAID.Capabilities3.HasFlag(CapabilitiesBit3.BlockErase))
|
||||
sb.AppendLine().Append("BLOCK ERASE EXT is supported");
|
||||
if(ATAID.Capabilities3.HasFlag(CapabilitiesBit3.Overwrite))
|
||||
@@ -3171,6 +3270,7 @@ namespace DiscImageChef.Decoders.ATA
|
||||
if(ATAID.CommandSet5.HasFlag(CommandSetBit5.ReadZeroTrim))
|
||||
sb.AppendLine().Append("Read after TRIM returns empty data");
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet5.HasFlag(CommandSetBit5.LongPhysSectorAligError))
|
||||
sb.AppendLine().Append("Device supports Long Physical Sector Alignment Error Reporting Control");
|
||||
if(ATAID.CommandSet5.HasFlag(CommandSetBit5.Encrypted))
|
||||
@@ -3192,7 +3292,7 @@ namespace DiscImageChef.Decoders.ATA
|
||||
}
|
||||
|
||||
if(!ata1 && maxatalevel >= 8)
|
||||
if(ATAID.TrustedComputing.HasFlag(TrustedComputingBit.Set) &&
|
||||
if(ATAID.TrustedComputing.HasFlag(TrustedComputingBit.Set) &&
|
||||
!ATAID.TrustedComputing.HasFlag(TrustedComputingBit.Clear) &&
|
||||
ATAID.TrustedComputing.HasFlag(TrustedComputingBit.TrustedComputing))
|
||||
sb.AppendLine().Append("Trusted Computing feature set is supported");
|
||||
@@ -3216,21 +3316,25 @@ namespace DiscImageChef.Decoders.ATA
|
||||
if(ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.NonZeroBufferOffset))
|
||||
sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.SATAFeatures.HasFlag(SATAFeaturesBit.DMASetup))
|
||||
{
|
||||
sb.AppendLine().Append("DMA Setup auto-activation is supported");
|
||||
if(ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.DMASetup)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.SATAFeatures.HasFlag(SATAFeaturesBit.InitPowerMgmt))
|
||||
{
|
||||
sb.AppendLine().Append("Device-initiated power management is supported");
|
||||
if(ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.InitPowerMgmt)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.SATAFeatures.HasFlag(SATAFeaturesBit.InOrderData))
|
||||
{
|
||||
sb.AppendLine().Append("In-order data delivery is supported");
|
||||
if(ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.InOrderData)) sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(!atapi)
|
||||
if(ATAID.SATAFeatures.HasFlag(SATAFeaturesBit.HardwareFeatureControl))
|
||||
{
|
||||
@@ -3238,6 +3342,7 @@ namespace DiscImageChef.Decoders.ATA
|
||||
if(ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.HardwareFeatureControl))
|
||||
sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(atapi)
|
||||
if(ATAID.SATAFeatures.HasFlag(SATAFeaturesBit.AsyncNotification))
|
||||
{
|
||||
@@ -3245,18 +3350,21 @@ namespace DiscImageChef.Decoders.ATA
|
||||
if(ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.AsyncNotification))
|
||||
sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.SATAFeatures.HasFlag(SATAFeaturesBit.SettingsPreserve))
|
||||
{
|
||||
sb.AppendLine().Append("Software Settings Preservation is supported");
|
||||
if(ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.SettingsPreserve))
|
||||
sb.Append(" and enabled");
|
||||
}
|
||||
|
||||
if(ATAID.SATAFeatures.HasFlag(SATAFeaturesBit.NCQAutoSense))
|
||||
sb.AppendLine().Append("NCQ Autosense is supported");
|
||||
if(ATAID.EnabledSATAFeatures.HasFlag(SATAFeaturesBit.EnabledSlumber))
|
||||
sb.AppendLine().Append("Automatic Partial to Slumber transitions are enabled");
|
||||
}
|
||||
}
|
||||
|
||||
if((ATAID.RemovableStatusSet & 0x03) > 0)
|
||||
sb.AppendLine().Append("Removable Media Status Notification feature set is supported");
|
||||
|
||||
@@ -3304,15 +3412,15 @@ namespace DiscImageChef.Decoders.ATA
|
||||
sb.AppendFormat("Master password revision code: {0}", ATAID.MasterPasswordRevisionCode).AppendLine();
|
||||
}
|
||||
|
||||
if(ATAID.CommandSet3.HasFlag(CommandSetBit3.MustBeSet) &&
|
||||
if(ATAID.CommandSet3.HasFlag(CommandSetBit3.MustBeSet) &&
|
||||
!ATAID.CommandSet3.HasFlag(CommandSetBit3.MustBeClear) &&
|
||||
ATAID.CommandSet3.HasFlag(CommandSetBit3.Streaming))
|
||||
{
|
||||
sb.AppendLine().AppendLine("Streaming:");
|
||||
sb.AppendFormat("Minimum request size is {0}", ATAID.StreamMinReqSize);
|
||||
sb.AppendFormat("Streaming transfer time in PIO is {0}", ATAID.StreamTransferTimePIO);
|
||||
sb.AppendFormat("Streaming transfer time in DMA is {0}", ATAID.StreamTransferTimeDMA);
|
||||
sb.AppendFormat("Streaming access latency is {0}", ATAID.StreamAccessLatency);
|
||||
sb.AppendFormat("Minimum request size is {0}", ATAID.StreamMinReqSize);
|
||||
sb.AppendFormat("Streaming transfer time in PIO is {0}", ATAID.StreamTransferTimePIO);
|
||||
sb.AppendFormat("Streaming transfer time in DMA is {0}", ATAID.StreamTransferTimeDMA);
|
||||
sb.AppendFormat("Streaming access latency is {0}", ATAID.StreamAccessLatency);
|
||||
sb.AppendFormat("Streaming performance granularity is {0}", ATAID.StreamPerformanceGranularity);
|
||||
}
|
||||
|
||||
@@ -3343,11 +3451,12 @@ namespace DiscImageChef.Decoders.ATA
|
||||
|
||||
sb.AppendLine().AppendFormat("Version {0}", (ATAID.NVCacheCaps & 0x0F00) >> 8).AppendLine();
|
||||
}
|
||||
|
||||
sb.AppendLine().AppendFormat("Non-Volatile Cache is {0} bytes", ATAID.NVCacheSize * logicalsectorsize)
|
||||
.AppendLine();
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
#if DEBUG
|
||||
sb.AppendLine();
|
||||
if(ATAID.VendorWord9 != 0x0000 && ATAID.VendorWord9 != 0xFFFF)
|
||||
sb.AppendFormat("Word 9: 0x{0:X4}", ATAID.VendorWord9).AppendLine();
|
||||
@@ -3397,13 +3506,13 @@ namespace DiscImageChef.Decoders.ATA
|
||||
for(int i = 0; i < ATAID.ReservedWords.Length; i++)
|
||||
if(ATAID.ReservedWords[i] != 0x0000 && ATAID.ReservedWords[i] != 0xFFFF)
|
||||
sb.AppendFormat("Word {1}: 0x{0:X4}", ATAID.ReservedWords[i], 236 + i).AppendLine();
|
||||
#endif
|
||||
#endif
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
static ulong DescrambleWWN(ulong WWN)
|
||||
{
|
||||
byte[] qwb = BitConverter.GetBytes(WWN);
|
||||
byte[] qwb = BitConverter.GetBytes(WWN);
|
||||
byte[] qword = new byte[8];
|
||||
|
||||
qword[7] = qwb[1];
|
||||
@@ -3425,7 +3534,7 @@ namespace DiscImageChef.Decoders.ATA
|
||||
for(int i = 0; i < length; i += 2)
|
||||
{
|
||||
outbuf[i] = buffer[offset + i + 1];
|
||||
outbuf[i + 1] = buffer[offset + i];
|
||||
outbuf[i + 1] = buffer[offset + i];
|
||||
}
|
||||
|
||||
string outStr = StringHandlers.CToString(outbuf);
|
||||
|
||||
@@ -61,8 +61,8 @@ namespace DiscImageChef.Decoders.ATA
|
||||
public ushort LbaLow;
|
||||
public ushort LbaMid;
|
||||
public ushort LbaHigh;
|
||||
public byte DeviceHead;
|
||||
public byte Command;
|
||||
public byte DeviceHead;
|
||||
public byte Command;
|
||||
}
|
||||
|
||||
public struct AtaErrorRegistersChs
|
||||
@@ -89,12 +89,12 @@ namespace DiscImageChef.Decoders.ATA
|
||||
|
||||
public struct AtaErrorRegistersLba48
|
||||
{
|
||||
public byte Status;
|
||||
public byte Error;
|
||||
public byte Status;
|
||||
public byte Error;
|
||||
public ushort SectorCount;
|
||||
public ushort LbaLow;
|
||||
public ushort LbaMid;
|
||||
public ushort LbaHigh;
|
||||
public byte DeviceHead;
|
||||
public byte DeviceHead;
|
||||
}
|
||||
}
|
||||
@@ -75,9 +75,9 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
||||
|
||||
decoded.DataLength = BigEndianBitConverter.ToUInt16(BCAResponse, 0);
|
||||
decoded.Reserved1 = BCAResponse[2];
|
||||
decoded.Reserved2 = BCAResponse[3];
|
||||
decoded.BCA = new byte[64];
|
||||
decoded.Reserved1 = BCAResponse[2];
|
||||
decoded.Reserved2 = BCAResponse[3];
|
||||
decoded.BCA = new byte[64];
|
||||
Array.Copy(BCAResponse, 4, decoded.BCA, 0, 64);
|
||||
|
||||
return decoded;
|
||||
@@ -91,10 +91,10 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
#if DEBUG
|
||||
#if DEBUG
|
||||
if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
if(response.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
sb.AppendFormat("Blu-ray Burst Cutting Area in hex follows:");
|
||||
sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.BCA, 80));
|
||||
|
||||
@@ -77,16 +77,16 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
||||
|
||||
decoded.DataLength = BigEndianBitConverter.ToUInt16(CSResponse, 0);
|
||||
decoded.Reserved1 = CSResponse[2];
|
||||
decoded.Reserved2 = CSResponse[3];
|
||||
decoded.Cartridge = Convert.ToBoolean(CSResponse[4] & 0x80);
|
||||
decoded.OUT = Convert.ToBoolean(CSResponse[4] & 0x40);
|
||||
decoded.Reserved3 = (byte)((CSResponse[4] & 0x38) >> 3);
|
||||
decoded.OUT = Convert.ToBoolean(CSResponse[4] & 0x04);
|
||||
decoded.Reserved4 = (byte)(CSResponse[4] & 0x03);
|
||||
decoded.Reserved5 = CSResponse[5];
|
||||
decoded.Reserved6 = CSResponse[6];
|
||||
decoded.Reserved7 = CSResponse[7];
|
||||
decoded.Reserved1 = CSResponse[2];
|
||||
decoded.Reserved2 = CSResponse[3];
|
||||
decoded.Cartridge = Convert.ToBoolean(CSResponse[4] & 0x80);
|
||||
decoded.OUT = Convert.ToBoolean(CSResponse[4] & 0x40);
|
||||
decoded.Reserved3 = (byte)((CSResponse[4] & 0x38) >> 3);
|
||||
decoded.OUT = Convert.ToBoolean(CSResponse[4] & 0x04);
|
||||
decoded.Reserved4 = (byte)(CSResponse[4] & 0x03);
|
||||
decoded.Reserved5 = CSResponse[5];
|
||||
decoded.Reserved6 = CSResponse[6];
|
||||
decoded.Reserved7 = CSResponse[7];
|
||||
|
||||
return decoded;
|
||||
}
|
||||
@@ -99,7 +99,7 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
#if DEBUG
|
||||
#if DEBUG
|
||||
if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
if(response.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
if(response.Reserved3 != 0) sb.AppendFormat("Reserved3 = 0x{0:X8}", response.Reserved3).AppendLine();
|
||||
@@ -107,7 +107,7 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
if(response.Reserved5 != 0) sb.AppendFormat("Reserved5 = 0x{0:X8}", response.Reserved5).AppendLine();
|
||||
if(response.Reserved6 != 0) sb.AppendFormat("Reserved6 = 0x{0:X8}", response.Reserved6).AppendLine();
|
||||
if(response.Reserved7 != 0) sb.AppendFormat("Reserved7 = 0x{0:X8}", response.Reserved7).AppendLine();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if(response.Cartridge)
|
||||
{
|
||||
@@ -119,11 +119,12 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
{
|
||||
sb.AppendLine("Media is not in a cartridge");
|
||||
|
||||
#if DEBUG
|
||||
#if DEBUG
|
||||
if(response.OUT) sb.AppendLine("Media has out bit marked, shouldn't");
|
||||
if(response.CWP) sb.AppendLine("Media has write protection bit marked, shouldn't");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
|
||||
@@ -75,9 +75,9 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
||||
|
||||
decoded.DataLength = BigEndianBitConverter.ToUInt16(DDSResponse, 0);
|
||||
decoded.Reserved1 = DDSResponse[2];
|
||||
decoded.Reserved2 = DDSResponse[3];
|
||||
decoded.Signature = BigEndianBitConverter.ToUInt16(DDSResponse, 4);
|
||||
decoded.Reserved1 = DDSResponse[2];
|
||||
decoded.Reserved2 = DDSResponse[3];
|
||||
decoded.Signature = BigEndianBitConverter.ToUInt16(DDSResponse, 4);
|
||||
if(decoded.Signature != DDSIdentifier)
|
||||
{
|
||||
DicConsole.DebugWriteLine("BD DDS decoder", "Found incorrect DDS signature (0x{0:X4})",
|
||||
@@ -85,26 +85,26 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
return null;
|
||||
}
|
||||
|
||||
decoded.Format = DDSResponse[6];
|
||||
decoded.Reserved3 = DDSResponse[7];
|
||||
decoded.UpdateCount = BigEndianBitConverter.ToUInt32(DDSResponse, 8);
|
||||
decoded.Reserved4 = BigEndianBitConverter.ToUInt64(DDSResponse, 12);
|
||||
decoded.DriveAreaPSN = BigEndianBitConverter.ToUInt32(DDSResponse, 20);
|
||||
decoded.Reserved5 = BigEndianBitConverter.ToUInt32(DDSResponse, 24);
|
||||
decoded.DefectListPSN = BigEndianBitConverter.ToUInt32(DDSResponse, 28);
|
||||
decoded.Reserved6 = BigEndianBitConverter.ToUInt32(DDSResponse, 32);
|
||||
decoded.PSNofLSNZero = BigEndianBitConverter.ToUInt32(DDSResponse, 36);
|
||||
decoded.LastUserAreaLSN = BigEndianBitConverter.ToUInt32(DDSResponse, 40);
|
||||
decoded.ISA0 = BigEndianBitConverter.ToUInt32(DDSResponse, 44);
|
||||
decoded.OSA = BigEndianBitConverter.ToUInt32(DDSResponse, 48);
|
||||
decoded.ISA1 = BigEndianBitConverter.ToUInt32(DDSResponse, 52);
|
||||
decoded.SpareAreaFullFlags = DDSResponse[56];
|
||||
decoded.Reserved7 = DDSResponse[57];
|
||||
decoded.Format = DDSResponse[6];
|
||||
decoded.Reserved3 = DDSResponse[7];
|
||||
decoded.UpdateCount = BigEndianBitConverter.ToUInt32(DDSResponse, 8);
|
||||
decoded.Reserved4 = BigEndianBitConverter.ToUInt64(DDSResponse, 12);
|
||||
decoded.DriveAreaPSN = BigEndianBitConverter.ToUInt32(DDSResponse, 20);
|
||||
decoded.Reserved5 = BigEndianBitConverter.ToUInt32(DDSResponse, 24);
|
||||
decoded.DefectListPSN = BigEndianBitConverter.ToUInt32(DDSResponse, 28);
|
||||
decoded.Reserved6 = BigEndianBitConverter.ToUInt32(DDSResponse, 32);
|
||||
decoded.PSNofLSNZero = BigEndianBitConverter.ToUInt32(DDSResponse, 36);
|
||||
decoded.LastUserAreaLSN = BigEndianBitConverter.ToUInt32(DDSResponse, 40);
|
||||
decoded.ISA0 = BigEndianBitConverter.ToUInt32(DDSResponse, 44);
|
||||
decoded.OSA = BigEndianBitConverter.ToUInt32(DDSResponse, 48);
|
||||
decoded.ISA1 = BigEndianBitConverter.ToUInt32(DDSResponse, 52);
|
||||
decoded.SpareAreaFullFlags = DDSResponse[56];
|
||||
decoded.Reserved7 = DDSResponse[57];
|
||||
decoded.DiscTypeSpecificField1 = DDSResponse[58];
|
||||
decoded.Reserved8 = DDSResponse[59];
|
||||
decoded.Reserved8 = DDSResponse[59];
|
||||
decoded.DiscTypeSpecificField2 = BigEndianBitConverter.ToUInt32(DDSResponse, 60);
|
||||
decoded.Reserved9 = BigEndianBitConverter.ToUInt32(DDSResponse, 64);
|
||||
decoded.StatusBits = new byte[32];
|
||||
decoded.Reserved9 = BigEndianBitConverter.ToUInt32(DDSResponse, 64);
|
||||
decoded.StatusBits = new byte[32];
|
||||
Array.Copy(DDSResponse, 68, decoded.StatusBits, 0, 32);
|
||||
decoded.DiscTypeSpecificData = new byte[DDSResponse.Length - 100];
|
||||
Array.Copy(DDSResponse, 100, decoded.DiscTypeSpecificData, 0, DDSResponse.Length - 100);
|
||||
@@ -137,7 +137,7 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
sb.AppendFormat("Blu-ray DDS Disc Type Specific Data in hex follows:");
|
||||
sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.DiscTypeSpecificData, 80));
|
||||
|
||||
#if DEBUG
|
||||
#if DEBUG
|
||||
if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
if(response.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
if(response.Reserved3 != 0) sb.AppendFormat("Reserved3 = 0x{0:X2}", response.Reserved3).AppendLine();
|
||||
@@ -147,7 +147,7 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
if(response.Reserved7 != 0) sb.AppendFormat("Reserved7 = 0x{0:X2}", response.Reserved7).AppendLine();
|
||||
if(response.Reserved8 != 0) sb.AppendFormat("Reserved8 = 0x{0:X2}", response.Reserved8).AppendLine();
|
||||
if(response.Reserved9 != 0) sb.AppendFormat("Reserved9 = 0x{0:X8}", response.Reserved9).AppendLine();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
@@ -75,11 +75,11 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
|
||||
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
||||
|
||||
decoded.DataLength = BigEndianBitConverter.ToUInt16(SAIResponse, 0);
|
||||
decoded.Reserved1 = SAIResponse[2];
|
||||
decoded.Reserved2 = SAIResponse[3];
|
||||
decoded.Reserved3 = BigEndianBitConverter.ToUInt32(SAIResponse, 4);
|
||||
decoded.FreeSpareBlocks = BigEndianBitConverter.ToUInt32(SAIResponse, 8);
|
||||
decoded.DataLength = BigEndianBitConverter.ToUInt16(SAIResponse, 0);
|
||||
decoded.Reserved1 = SAIResponse[2];
|
||||
decoded.Reserved2 = SAIResponse[3];
|
||||
decoded.Reserved3 = BigEndianBitConverter.ToUInt32(SAIResponse, 4);
|
||||
decoded.FreeSpareBlocks = BigEndianBitConverter.ToUInt32(SAIResponse, 8);
|
||||
decoded.AllocatedSpareBlocks = BigEndianBitConverter.ToUInt32(SAIResponse, 12);
|
||||
|
||||
return decoded;
|
||||
@@ -93,11 +93,11 @@ namespace DiscImageChef.Decoders.Bluray
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
#if DEBUG
|
||||
#if DEBUG
|
||||
if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
if(response.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
if(response.Reserved3 != 0) sb.AppendFormat("Reserved3 = 0x{0:X8}", response.Reserved3).AppendLine();
|
||||
#endif
|
||||
#endif
|
||||
sb.AppendFormat("{0} free spare blocks", response.FreeSpareBlocks).AppendLine();
|
||||
sb.AppendFormat("{0} allocated spare blocks", response.AllocatedSpareBlocks).AppendLine();
|
||||
|
||||
|
||||
@@ -238,32 +238,32 @@ namespace DiscImageChef.Decoders.CD
|
||||
return null;
|
||||
}
|
||||
|
||||
decoded.DataLength = BigEndianBitConverter.ToUInt16(CDATIPResponse, 0);
|
||||
decoded.Reserved1 = CDATIPResponse[2];
|
||||
decoded.Reserved2 = CDATIPResponse[3];
|
||||
decoded.ITWP = (byte)((CDATIPResponse[4] & 0xF0) >> 4);
|
||||
decoded.DDCD = Convert.ToBoolean(CDATIPResponse[4] & 0x08);
|
||||
decoded.DataLength = BigEndianBitConverter.ToUInt16(CDATIPResponse, 0);
|
||||
decoded.Reserved1 = CDATIPResponse[2];
|
||||
decoded.Reserved2 = CDATIPResponse[3];
|
||||
decoded.ITWP = (byte)((CDATIPResponse[4] & 0xF0) >> 4);
|
||||
decoded.DDCD = Convert.ToBoolean(CDATIPResponse[4] & 0x08);
|
||||
decoded.ReferenceSpeed = (byte)(CDATIPResponse[4] & 0x07);
|
||||
decoded.AlwaysZero = Convert.ToBoolean(CDATIPResponse[5] & 0x80);
|
||||
decoded.URU = Convert.ToBoolean(CDATIPResponse[5] & 0x40);
|
||||
decoded.Reserved3 = (byte)(CDATIPResponse[5] & 0x3F);
|
||||
decoded.AlwaysZero = Convert.ToBoolean(CDATIPResponse[5] & 0x80);
|
||||
decoded.URU = Convert.ToBoolean(CDATIPResponse[5] & 0x40);
|
||||
decoded.Reserved3 = (byte)(CDATIPResponse[5] & 0x3F);
|
||||
|
||||
decoded.AlwaysOne = Convert.ToBoolean(CDATIPResponse[6] & 0x80);
|
||||
decoded.DiscType = Convert.ToBoolean(CDATIPResponse[6] & 0x40);
|
||||
decoded.AlwaysOne = Convert.ToBoolean(CDATIPResponse[6] & 0x80);
|
||||
decoded.DiscType = Convert.ToBoolean(CDATIPResponse[6] & 0x40);
|
||||
decoded.DiscSubType = (byte)((CDATIPResponse[6] & 0x38) >> 3);
|
||||
decoded.A1Valid = Convert.ToBoolean(CDATIPResponse[6] & 0x04);
|
||||
decoded.A2Valid = Convert.ToBoolean(CDATIPResponse[6] & 0x02);
|
||||
decoded.A3Valid = Convert.ToBoolean(CDATIPResponse[6] & 0x01);
|
||||
decoded.A1Valid = Convert.ToBoolean(CDATIPResponse[6] & 0x04);
|
||||
decoded.A2Valid = Convert.ToBoolean(CDATIPResponse[6] & 0x02);
|
||||
decoded.A3Valid = Convert.ToBoolean(CDATIPResponse[6] & 0x01);
|
||||
|
||||
decoded.Reserved4 = CDATIPResponse[7];
|
||||
decoded.LeadInStartMin = CDATIPResponse[8];
|
||||
decoded.LeadInStartSec = CDATIPResponse[9];
|
||||
decoded.LeadInStartFrame = CDATIPResponse[10];
|
||||
decoded.Reserved5 = CDATIPResponse[11];
|
||||
decoded.LeadOutStartMin = CDATIPResponse[12];
|
||||
decoded.LeadOutStartSec = CDATIPResponse[13];
|
||||
decoded.Reserved4 = CDATIPResponse[7];
|
||||
decoded.LeadInStartMin = CDATIPResponse[8];
|
||||
decoded.LeadInStartSec = CDATIPResponse[9];
|
||||
decoded.LeadInStartFrame = CDATIPResponse[10];
|
||||
decoded.Reserved5 = CDATIPResponse[11];
|
||||
decoded.LeadOutStartMin = CDATIPResponse[12];
|
||||
decoded.LeadOutStartSec = CDATIPResponse[13];
|
||||
decoded.LeadOutStartFrame = CDATIPResponse[14];
|
||||
decoded.Reserved6 = CDATIPResponse[15];
|
||||
decoded.Reserved6 = CDATIPResponse[15];
|
||||
|
||||
decoded.A1Values = new byte[3];
|
||||
decoded.A2Values = new byte[3];
|
||||
@@ -356,6 +356,7 @@ namespace DiscImageChef.Decoders.CD
|
||||
sb.AppendFormat("Unknown CD-RW disc subtype: {0}", response.DiscSubType).AppendLine();
|
||||
break;
|
||||
}
|
||||
|
||||
switch(response.ReferenceSpeed)
|
||||
{
|
||||
case 1:
|
||||
@@ -430,7 +431,7 @@ namespace DiscImageChef.Decoders.CD
|
||||
if(response.LeadInStartMin != 97) return sb.ToString();
|
||||
|
||||
int type = response.LeadInStartFrame % 10;
|
||||
int frm = response.LeadInStartFrame - type;
|
||||
int frm = response.LeadInStartFrame - type;
|
||||
|
||||
if(response.DiscType) sb.AppendLine("Disc uses phase change");
|
||||
else
|
||||
|
||||
@@ -199,9 +199,9 @@ namespace DiscImageChef.Decoders.CD
|
||||
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
||||
|
||||
decoded.DataLength = BigEndianBitConverter.ToUInt16(CDTextResponse, 0);
|
||||
decoded.Reserved1 = CDTextResponse[2];
|
||||
decoded.Reserved2 = CDTextResponse[3];
|
||||
decoded.DataPacks = new CDTextPack[(decoded.DataLength - 2) / 18];
|
||||
decoded.Reserved1 = CDTextResponse[2];
|
||||
decoded.Reserved2 = CDTextResponse[3];
|
||||
decoded.DataPacks = new CDTextPack[(decoded.DataLength - 2) / 18];
|
||||
|
||||
if(decoded.DataLength == 2) return null;
|
||||
|
||||
@@ -215,13 +215,13 @@ namespace DiscImageChef.Decoders.CD
|
||||
|
||||
for(int i = 0; i < (decoded.DataLength - 2) / 18; i++)
|
||||
{
|
||||
decoded.DataPacks[i].HeaderID1 = CDTextResponse[0 + i * 18 + 4];
|
||||
decoded.DataPacks[i].HeaderID2 = CDTextResponse[1 + i * 18 + 4];
|
||||
decoded.DataPacks[i].HeaderID3 = CDTextResponse[2 + i * 18 + 4];
|
||||
decoded.DataPacks[i].DBCC = Convert.ToBoolean(CDTextResponse[3 + i * 18 + 4] & 0x80);
|
||||
decoded.DataPacks[i].BlockNumber = (byte)((CDTextResponse[3 + i * 18 + 4] & 0x70) >> 4);
|
||||
decoded.DataPacks[i].HeaderID1 = CDTextResponse[0 + i * 18 + 4];
|
||||
decoded.DataPacks[i].HeaderID2 = CDTextResponse[1 + i * 18 + 4];
|
||||
decoded.DataPacks[i].HeaderID3 = CDTextResponse[2 + i * 18 + 4];
|
||||
decoded.DataPacks[i].DBCC = Convert.ToBoolean(CDTextResponse[3 + i * 18 + 4] & 0x80);
|
||||
decoded.DataPacks[i].BlockNumber = (byte)((CDTextResponse[3 + i * 18 + 4] & 0x70) >> 4);
|
||||
decoded.DataPacks[i].CharacterPosition = (byte)(CDTextResponse[3 + i * 18 + 4] & 0x0F);
|
||||
decoded.DataPacks[i].TextDataField = new byte[12];
|
||||
decoded.DataPacks[i].TextDataField = new byte[12];
|
||||
Array.Copy(CDTextResponse, 4 + i * 18 + 4, decoded.DataPacks[i].TextDataField, 0, 12);
|
||||
decoded.DataPacks[i].CRC = BigEndianBitConverter.ToUInt16(CDTextResponse, 16 + i * 18 + 4);
|
||||
}
|
||||
@@ -233,13 +233,13 @@ namespace DiscImageChef.Decoders.CD
|
||||
{
|
||||
if(CDTextResponse == null) return null;
|
||||
|
||||
CDText response = CDTextResponse.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
CDText response = CDTextResponse.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
#if DEBUG
|
||||
#if DEBUG
|
||||
if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
if(response.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
foreach(CDTextPack descriptor in response.DataPacks)
|
||||
if((descriptor.HeaderID1 & 0x80) != 0x80)
|
||||
|
||||
@@ -172,20 +172,20 @@ namespace DiscImageChef.Decoders.CD
|
||||
|
||||
for(int i = 0; i < (decoded.DataLength - 2) / 11; i++)
|
||||
{
|
||||
decoded.TrackDescriptors[i].SessionNumber = CDFullTOCResponse[0 + i * 11 + 4];
|
||||
decoded.TrackDescriptors[i].SessionNumber = CDFullTOCResponse[0 + i * 11 + 4];
|
||||
decoded.TrackDescriptors[i].ADR = (byte)((CDFullTOCResponse[1 + i * 11 + 4] & 0xF0) >> 4);
|
||||
decoded.TrackDescriptors[i].CONTROL = (byte)(CDFullTOCResponse[1 + i * 11 + 4] & 0x0F);
|
||||
decoded.TrackDescriptors[i].TNO = CDFullTOCResponse[2 + i * 11 + 4];
|
||||
decoded.TrackDescriptors[i].POINT = CDFullTOCResponse[3 + i * 11 + 4];
|
||||
decoded.TrackDescriptors[i].Min = CDFullTOCResponse[4 + i * 11 + 4];
|
||||
decoded.TrackDescriptors[i].Sec = CDFullTOCResponse[5 + i * 11 + 4];
|
||||
decoded.TrackDescriptors[i].Frame = CDFullTOCResponse[6 + i * 11 + 4];
|
||||
decoded.TrackDescriptors[i].Zero = CDFullTOCResponse[7 + i * 11 + 4];
|
||||
decoded.TrackDescriptors[i].CONTROL = (byte)(CDFullTOCResponse[1 + i * 11 + 4] & 0x0F);
|
||||
decoded.TrackDescriptors[i].TNO = CDFullTOCResponse[2 + i * 11 + 4];
|
||||
decoded.TrackDescriptors[i].POINT = CDFullTOCResponse[3 + i * 11 + 4];
|
||||
decoded.TrackDescriptors[i].Min = CDFullTOCResponse[4 + i * 11 + 4];
|
||||
decoded.TrackDescriptors[i].Sec = CDFullTOCResponse[5 + i * 11 + 4];
|
||||
decoded.TrackDescriptors[i].Frame = CDFullTOCResponse[6 + i * 11 + 4];
|
||||
decoded.TrackDescriptors[i].Zero = CDFullTOCResponse[7 + i * 11 + 4];
|
||||
decoded.TrackDescriptors[i].HOUR = (byte)((CDFullTOCResponse[7 + i * 11 + 4] & 0xF0) >> 4);
|
||||
decoded.TrackDescriptors[i].PHOUR = (byte)(CDFullTOCResponse[7 + i * 11 + 4] & 0x0F);
|
||||
decoded.TrackDescriptors[i].PMIN = CDFullTOCResponse[8 + i * 11 + 4];
|
||||
decoded.TrackDescriptors[i].PSEC = CDFullTOCResponse[9 + i * 11 + 4];
|
||||
decoded.TrackDescriptors[i].PFRAME = CDFullTOCResponse[10 + i * 11 + 4];
|
||||
decoded.TrackDescriptors[i].PHOUR = (byte)(CDFullTOCResponse[7 + i * 11 + 4] & 0x0F);
|
||||
decoded.TrackDescriptors[i].PMIN = CDFullTOCResponse[8 + i * 11 + 4];
|
||||
decoded.TrackDescriptors[i].PSEC = CDFullTOCResponse[9 + i * 11 + 4];
|
||||
decoded.TrackDescriptors[i].PFRAME = CDFullTOCResponse[10 + i * 11 + 4];
|
||||
}
|
||||
|
||||
return decoded;
|
||||
@@ -202,28 +202,26 @@ namespace DiscImageChef.Decoders.CD
|
||||
int lastSession = 0;
|
||||
|
||||
sb.AppendFormat("First complete session number: {0}", response.FirstCompleteSession).AppendLine();
|
||||
sb.AppendFormat("Last complete session number: {0}", response.LastCompleteSession).AppendLine();
|
||||
sb.AppendFormat("Last complete session number: {0}", response.LastCompleteSession).AppendLine();
|
||||
foreach(TrackDataDescriptor descriptor in response.TrackDescriptors)
|
||||
if((descriptor.CONTROL & 0x08) ==
|
||||
0x08 ||
|
||||
descriptor.ADR != 1 && descriptor.ADR != 5 && descriptor.ADR != 4 &&
|
||||
descriptor.ADR != 6 ||
|
||||
if((descriptor.CONTROL & 0x08) == 0x08 ||
|
||||
descriptor.ADR != 1 && descriptor.ADR != 5 && descriptor.ADR != 4 && descriptor.ADR != 6 ||
|
||||
descriptor.TNO != 0)
|
||||
{
|
||||
sb.AppendLine("Unknown TOC entry format, printing values as-is");
|
||||
sb.AppendFormat("SessionNumber = {0}", descriptor.SessionNumber).AppendLine();
|
||||
sb.AppendFormat("ADR = {0}", descriptor.ADR).AppendLine();
|
||||
sb.AppendFormat("CONTROL = {0}", descriptor.CONTROL).AppendLine();
|
||||
sb.AppendFormat("TNO = {0}", descriptor.TNO).AppendLine();
|
||||
sb.AppendFormat("POINT = {0}", descriptor.POINT).AppendLine();
|
||||
sb.AppendFormat("Min = {0}", descriptor.Min).AppendLine();
|
||||
sb.AppendFormat("Sec = {0}", descriptor.Sec).AppendLine();
|
||||
sb.AppendFormat("Frame = {0}", descriptor.Frame).AppendLine();
|
||||
sb.AppendFormat("HOUR = {0}", descriptor.HOUR).AppendLine();
|
||||
sb.AppendFormat("PHOUR = {0}", descriptor.PHOUR).AppendLine();
|
||||
sb.AppendFormat("PMIN = {0}", descriptor.PMIN).AppendLine();
|
||||
sb.AppendFormat("PSEC = {0}", descriptor.PSEC).AppendLine();
|
||||
sb.AppendFormat("PFRAME = {0}", descriptor.PFRAME).AppendLine();
|
||||
sb.AppendFormat("ADR = {0}", descriptor.ADR).AppendLine();
|
||||
sb.AppendFormat("CONTROL = {0}", descriptor.CONTROL).AppendLine();
|
||||
sb.AppendFormat("TNO = {0}", descriptor.TNO).AppendLine();
|
||||
sb.AppendFormat("POINT = {0}", descriptor.POINT).AppendLine();
|
||||
sb.AppendFormat("Min = {0}", descriptor.Min).AppendLine();
|
||||
sb.AppendFormat("Sec = {0}", descriptor.Sec).AppendLine();
|
||||
sb.AppendFormat("Frame = {0}", descriptor.Frame).AppendLine();
|
||||
sb.AppendFormat("HOUR = {0}", descriptor.HOUR).AppendLine();
|
||||
sb.AppendFormat("PHOUR = {0}", descriptor.PHOUR).AppendLine();
|
||||
sb.AppendFormat("PMIN = {0}", descriptor.PMIN).AppendLine();
|
||||
sb.AppendFormat("PSEC = {0}", descriptor.PSEC).AppendLine();
|
||||
sb.AppendFormat("PFRAME = {0}", descriptor.PFRAME).AppendLine();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -378,7 +376,7 @@ namespace DiscImageChef.Decoders.CD
|
||||
}
|
||||
default:
|
||||
{
|
||||
if(descriptor.POINT >= 0x01 && descriptor.POINT <= 0x63)
|
||||
if(descriptor.POINT >= 0x01 && descriptor.POINT <= 0x63)
|
||||
if(descriptor.ADR == 4)
|
||||
sb.AppendFormat("Video track {3} starts at: {0:D2}:{1:D2}:{2:D2}",
|
||||
descriptor.PMIN, descriptor.PSEC, descriptor.PFRAME,
|
||||
@@ -426,18 +424,18 @@ namespace DiscImageChef.Decoders.CD
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.AppendFormat("ADR = {0}", descriptor.ADR).AppendLine();
|
||||
sb.AppendFormat("ADR = {0}", descriptor.ADR).AppendLine();
|
||||
sb.AppendFormat("CONTROL = {0}", descriptor.CONTROL).AppendLine();
|
||||
sb.AppendFormat("TNO = {0}", descriptor.TNO).AppendLine();
|
||||
sb.AppendFormat("POINT = {0}", descriptor.POINT).AppendLine();
|
||||
sb.AppendFormat("Min = {0}", descriptor.Min).AppendLine();
|
||||
sb.AppendFormat("Sec = {0}", descriptor.Sec).AppendLine();
|
||||
sb.AppendFormat("Frame = {0}", descriptor.Frame).AppendLine();
|
||||
sb.AppendFormat("HOUR = {0}", descriptor.HOUR).AppendLine();
|
||||
sb.AppendFormat("PHOUR = {0}", descriptor.PHOUR).AppendLine();
|
||||
sb.AppendFormat("PMIN = {0}", descriptor.PMIN).AppendLine();
|
||||
sb.AppendFormat("PSEC = {0}", descriptor.PSEC).AppendLine();
|
||||
sb.AppendFormat("PFRAME = {0}", descriptor.PFRAME).AppendLine();
|
||||
sb.AppendFormat("TNO = {0}", descriptor.TNO).AppendLine();
|
||||
sb.AppendFormat("POINT = {0}", descriptor.POINT).AppendLine();
|
||||
sb.AppendFormat("Min = {0}", descriptor.Min).AppendLine();
|
||||
sb.AppendFormat("Sec = {0}", descriptor.Sec).AppendLine();
|
||||
sb.AppendFormat("Frame = {0}", descriptor.Frame).AppendLine();
|
||||
sb.AppendFormat("HOUR = {0}", descriptor.HOUR).AppendLine();
|
||||
sb.AppendFormat("PHOUR = {0}", descriptor.PHOUR).AppendLine();
|
||||
sb.AppendFormat("PMIN = {0}", descriptor.PMIN).AppendLine();
|
||||
sb.AppendFormat("PSEC = {0}", descriptor.PSEC).AppendLine();
|
||||
sb.AppendFormat("PFRAME = {0}", descriptor.PFRAME).AppendLine();
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -514,12 +512,12 @@ namespace DiscImageChef.Decoders.CD
|
||||
case 0xC1:
|
||||
{
|
||||
sb.AppendFormat("Copy of information of A1 from ATIP found");
|
||||
sb.AppendFormat("Min = {0}", descriptor.Min).AppendLine();
|
||||
sb.AppendFormat("Sec = {0}", descriptor.Sec).AppendLine();
|
||||
sb.AppendFormat("Frame = {0}", descriptor.Frame).AppendLine();
|
||||
sb.AppendFormat("Zero = {0}", descriptor.Zero).AppendLine();
|
||||
sb.AppendFormat("PMIN = {0}", descriptor.PMIN).AppendLine();
|
||||
sb.AppendFormat("PSEC = {0}", descriptor.PSEC).AppendLine();
|
||||
sb.AppendFormat("Min = {0}", descriptor.Min).AppendLine();
|
||||
sb.AppendFormat("Sec = {0}", descriptor.Sec).AppendLine();
|
||||
sb.AppendFormat("Frame = {0}", descriptor.Frame).AppendLine();
|
||||
sb.AppendFormat("Zero = {0}", descriptor.Zero).AppendLine();
|
||||
sb.AppendFormat("PMIN = {0}", descriptor.PMIN).AppendLine();
|
||||
sb.AppendFormat("PSEC = {0}", descriptor.PSEC).AppendLine();
|
||||
sb.AppendFormat("PFRAME = {0}", descriptor.PFRAME).AppendLine();
|
||||
break;
|
||||
}
|
||||
@@ -563,18 +561,18 @@ namespace DiscImageChef.Decoders.CD
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.AppendFormat("ADR = {0}", descriptor.ADR).AppendLine();
|
||||
sb.AppendFormat("ADR = {0}", descriptor.ADR).AppendLine();
|
||||
sb.AppendFormat("CONTROL = {0}", descriptor.CONTROL).AppendLine();
|
||||
sb.AppendFormat("TNO = {0}", descriptor.TNO).AppendLine();
|
||||
sb.AppendFormat("POINT = {0}", descriptor.POINT).AppendLine();
|
||||
sb.AppendFormat("Min = {0}", descriptor.Min).AppendLine();
|
||||
sb.AppendFormat("Sec = {0}", descriptor.Sec).AppendLine();
|
||||
sb.AppendFormat("Frame = {0}", descriptor.Frame).AppendLine();
|
||||
sb.AppendFormat("HOUR = {0}", descriptor.HOUR).AppendLine();
|
||||
sb.AppendFormat("PHOUR = {0}", descriptor.PHOUR).AppendLine();
|
||||
sb.AppendFormat("PMIN = {0}", descriptor.PMIN).AppendLine();
|
||||
sb.AppendFormat("PSEC = {0}", descriptor.PSEC).AppendLine();
|
||||
sb.AppendFormat("PFRAME = {0}", descriptor.PFRAME).AppendLine();
|
||||
sb.AppendFormat("TNO = {0}", descriptor.TNO).AppendLine();
|
||||
sb.AppendFormat("POINT = {0}", descriptor.POINT).AppendLine();
|
||||
sb.AppendFormat("Min = {0}", descriptor.Min).AppendLine();
|
||||
sb.AppendFormat("Sec = {0}", descriptor.Sec).AppendLine();
|
||||
sb.AppendFormat("Frame = {0}", descriptor.Frame).AppendLine();
|
||||
sb.AppendFormat("HOUR = {0}", descriptor.HOUR).AppendLine();
|
||||
sb.AppendFormat("PHOUR = {0}", descriptor.PHOUR).AppendLine();
|
||||
sb.AppendFormat("PMIN = {0}", descriptor.PMIN).AppendLine();
|
||||
sb.AppendFormat("PSEC = {0}", descriptor.PSEC).AppendLine();
|
||||
sb.AppendFormat("PFRAME = {0}", descriptor.PFRAME).AppendLine();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -144,9 +144,9 @@ namespace DiscImageChef.Decoders.CD
|
||||
|
||||
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
||||
|
||||
decoded.DataLength = BigEndianBitConverter.ToUInt16(CDPMAResponse, 0);
|
||||
decoded.Reserved1 = CDPMAResponse[2];
|
||||
decoded.Reserved2 = CDPMAResponse[3];
|
||||
decoded.DataLength = BigEndianBitConverter.ToUInt16(CDPMAResponse, 0);
|
||||
decoded.Reserved1 = CDPMAResponse[2];
|
||||
decoded.Reserved2 = CDPMAResponse[3];
|
||||
decoded.PMADescriptors = new CDPMADescriptors[(decoded.DataLength - 2) / 11];
|
||||
|
||||
if(decoded.DataLength + 2 != CDPMAResponse.Length)
|
||||
@@ -160,18 +160,18 @@ namespace DiscImageChef.Decoders.CD
|
||||
for(int i = 0; i < (decoded.DataLength - 2) / 11; i++)
|
||||
{
|
||||
decoded.PMADescriptors[i].Reserved = CDPMAResponse[0 + i * 11 + 4];
|
||||
decoded.PMADescriptors[i].ADR = (byte)((CDPMAResponse[1 + i * 11 + 4] & 0xF0) >> 4);
|
||||
decoded.PMADescriptors[i].CONTROL = (byte)(CDPMAResponse[1 + i * 11 + 4] & 0x0F);
|
||||
decoded.PMADescriptors[i].TNO = CDPMAResponse[2 + i * 11 + 4];
|
||||
decoded.PMADescriptors[i].POINT = CDPMAResponse[3 + i * 11 + 4];
|
||||
decoded.PMADescriptors[i].Min = CDPMAResponse[4 + i * 11 + 4];
|
||||
decoded.PMADescriptors[i].Sec = CDPMAResponse[5 + i * 11 + 4];
|
||||
decoded.PMADescriptors[i].Frame = CDPMAResponse[6 + i * 11 + 4];
|
||||
decoded.PMADescriptors[i].HOUR = (byte)((CDPMAResponse[7 + i * 11 + 4] & 0xF0) >> 4);
|
||||
decoded.PMADescriptors[i].PHOUR = (byte)(CDPMAResponse[7 + i * 11 + 4] & 0x0F);
|
||||
decoded.PMADescriptors[i].PMIN = CDPMAResponse[8 + i * 11 + 4];
|
||||
decoded.PMADescriptors[i].PSEC = CDPMAResponse[9 + i * 11 + 4];
|
||||
decoded.PMADescriptors[i].PFRAME = CDPMAResponse[10 + i * 11 + 4];
|
||||
decoded.PMADescriptors[i].ADR = (byte)((CDPMAResponse[1 + i * 11 + 4] & 0xF0) >> 4);
|
||||
decoded.PMADescriptors[i].CONTROL = (byte)(CDPMAResponse[1 + i * 11 + 4] & 0x0F);
|
||||
decoded.PMADescriptors[i].TNO = CDPMAResponse[2 + i * 11 + 4];
|
||||
decoded.PMADescriptors[i].POINT = CDPMAResponse[3 + i * 11 + 4];
|
||||
decoded.PMADescriptors[i].Min = CDPMAResponse[4 + i * 11 + 4];
|
||||
decoded.PMADescriptors[i].Sec = CDPMAResponse[5 + i * 11 + 4];
|
||||
decoded.PMADescriptors[i].Frame = CDPMAResponse[6 + i * 11 + 4];
|
||||
decoded.PMADescriptors[i].HOUR = (byte)((CDPMAResponse[7 + i * 11 + 4] & 0xF0) >> 4);
|
||||
decoded.PMADescriptors[i].PHOUR = (byte)(CDPMAResponse[7 + i * 11 + 4] & 0x0F);
|
||||
decoded.PMADescriptors[i].PMIN = CDPMAResponse[8 + i * 11 + 4];
|
||||
decoded.PMADescriptors[i].PSEC = CDPMAResponse[9 + i * 11 + 4];
|
||||
decoded.PMADescriptors[i].PFRAME = CDPMAResponse[10 + i * 11 + 4];
|
||||
}
|
||||
|
||||
return decoded;
|
||||
@@ -185,16 +185,16 @@ namespace DiscImageChef.Decoders.CD
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
#if DEBUG
|
||||
#if DEBUG
|
||||
if(response.Reserved1 != 0) sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
if(response.Reserved2 != 0) sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
foreach(CDPMADescriptors descriptor in response.PMADescriptors)
|
||||
{
|
||||
#if DEBUG
|
||||
#if DEBUG
|
||||
if(descriptor.Reserved != 0) sb.AppendFormat("Reserved = 0x{0:X2}", descriptor.Reserved).AppendLine();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
switch(descriptor.ADR)
|
||||
{
|
||||
@@ -248,21 +248,21 @@ namespace DiscImageChef.Decoders.CD
|
||||
break;
|
||||
case 3:
|
||||
sb.AppendFormat("Skip track assignment {0} says that tracks ", descriptor.POINT);
|
||||
if(descriptor.Min > 0) sb.AppendFormat("{0} ", descriptor.Min);
|
||||
if(descriptor.Sec > 0) sb.AppendFormat("{0} ", descriptor.Sec);
|
||||
if(descriptor.Frame > 0) sb.AppendFormat("{0} ", descriptor.Frame);
|
||||
if(descriptor.PMIN > 0) sb.AppendFormat("{0} ", descriptor.PMIN);
|
||||
if(descriptor.PSEC > 0) sb.AppendFormat("{0} ", descriptor.PSEC);
|
||||
if(descriptor.Min > 0) sb.AppendFormat("{0} ", descriptor.Min);
|
||||
if(descriptor.Sec > 0) sb.AppendFormat("{0} ", descriptor.Sec);
|
||||
if(descriptor.Frame > 0) sb.AppendFormat("{0} ", descriptor.Frame);
|
||||
if(descriptor.PMIN > 0) sb.AppendFormat("{0} ", descriptor.PMIN);
|
||||
if(descriptor.PSEC > 0) sb.AppendFormat("{0} ", descriptor.PSEC);
|
||||
if(descriptor.PFRAME > 0) sb.AppendFormat("{0} ", descriptor.PFRAME);
|
||||
sb.AppendLine("should be skipped");
|
||||
break;
|
||||
case 4:
|
||||
sb.AppendFormat("Unskip track assignment {0} says that tracks ", descriptor.POINT);
|
||||
if(descriptor.Min > 0) sb.AppendFormat("{0} ", descriptor.Min);
|
||||
if(descriptor.Sec > 0) sb.AppendFormat("{0} ", descriptor.Sec);
|
||||
if(descriptor.Frame > 0) sb.AppendFormat("{0} ", descriptor.Frame);
|
||||
if(descriptor.PMIN > 0) sb.AppendFormat("{0} ", descriptor.PMIN);
|
||||
if(descriptor.PSEC > 0) sb.AppendFormat("{0} ", descriptor.PSEC);
|
||||
if(descriptor.Min > 0) sb.AppendFormat("{0} ", descriptor.Min);
|
||||
if(descriptor.Sec > 0) sb.AppendFormat("{0} ", descriptor.Sec);
|
||||
if(descriptor.Frame > 0) sb.AppendFormat("{0} ", descriptor.Frame);
|
||||
if(descriptor.PMIN > 0) sb.AppendFormat("{0} ", descriptor.PMIN);
|
||||
if(descriptor.PSEC > 0) sb.AppendFormat("{0} ", descriptor.PSEC);
|
||||
if(descriptor.PFRAME > 0) sb.AppendFormat("{0} ", descriptor.PFRAME);
|
||||
sb.AppendLine("should not be skipped");
|
||||
break;
|
||||
|
||||
@@ -188,7 +188,7 @@ namespace DiscImageChef.Decoders.CD
|
||||
|
||||
if(!SyncMark.SequenceEqual(sync)) return sector;
|
||||
|
||||
byte[] scrambled = new byte[sector.Length];
|
||||
byte[] scrambled = new byte[sector.Length];
|
||||
for(int i = 0; i < 2352; i++) scrambled[i] = (byte)(sector[i] ^ ScrambleTable[i]);
|
||||
|
||||
if(sector.Length <= 2352) return scrambled;
|
||||
|
||||
@@ -119,10 +119,10 @@ namespace DiscImageChef.Decoders.CD
|
||||
|
||||
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
||||
|
||||
decoded.DataLength = BigEndianBitConverter.ToUInt16(CDSessionInfoResponse, 0);
|
||||
decoded.DataLength = BigEndianBitConverter.ToUInt16(CDSessionInfoResponse, 0);
|
||||
decoded.FirstCompleteSession = CDSessionInfoResponse[2];
|
||||
decoded.LastCompleteSession = CDSessionInfoResponse[3];
|
||||
decoded.TrackDescriptors = new TrackDataDescriptor[(decoded.DataLength - 2) / 8];
|
||||
decoded.LastCompleteSession = CDSessionInfoResponse[3];
|
||||
decoded.TrackDescriptors = new TrackDataDescriptor[(decoded.DataLength - 2) / 8];
|
||||
|
||||
if(decoded.DataLength + 2 != CDSessionInfoResponse.Length)
|
||||
{
|
||||
@@ -134,11 +134,11 @@ namespace DiscImageChef.Decoders.CD
|
||||
|
||||
for(int i = 0; i < (decoded.DataLength - 2) / 8; i++)
|
||||
{
|
||||
decoded.TrackDescriptors[i].Reserved1 = CDSessionInfoResponse[0 + i * 8 + 4];
|
||||
decoded.TrackDescriptors[i].ADR = (byte)((CDSessionInfoResponse[1 + i * 8 + 4] & 0xF0) >> 4);
|
||||
decoded.TrackDescriptors[i].CONTROL = (byte)(CDSessionInfoResponse[1 + i * 8 + 4] & 0x0F);
|
||||
decoded.TrackDescriptors[i].Reserved1 = CDSessionInfoResponse[0 + i * 8 + 4];
|
||||
decoded.TrackDescriptors[i].ADR = (byte)((CDSessionInfoResponse[1 + i * 8 + 4] & 0xF0) >> 4);
|
||||
decoded.TrackDescriptors[i].CONTROL = (byte)(CDSessionInfoResponse[1 + i * 8 + 4] & 0x0F);
|
||||
decoded.TrackDescriptors[i].TrackNumber = CDSessionInfoResponse[2 + i * 8 + 4];
|
||||
decoded.TrackDescriptors[i].Reserved2 = CDSessionInfoResponse[3 + i * 8 + 4];
|
||||
decoded.TrackDescriptors[i].Reserved2 = CDSessionInfoResponse[3 + i * 8 + 4];
|
||||
decoded.TrackDescriptors[i].TrackStartAddress =
|
||||
BigEndianBitConverter.ToUInt32(CDSessionInfoResponse, 4 + i * 8 + 4);
|
||||
}
|
||||
@@ -212,12 +212,12 @@ namespace DiscImageChef.Decoders.CD
|
||||
? "Digital copy of track is permitted"
|
||||
: "Digital copy of track is prohibited");
|
||||
|
||||
#if DEBUG
|
||||
#if DEBUG
|
||||
if(descriptor.Reserved1 != 0)
|
||||
sb.AppendFormat("Reserved1 = 0x{0:X2}", descriptor.Reserved1).AppendLine();
|
||||
if(descriptor.Reserved2 != 0)
|
||||
sb.AppendFormat("Reserved2 = 0x{0:X2}", descriptor.Reserved2).AppendLine();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
sb.AppendLine();
|
||||
}
|
||||
|
||||
@@ -121,9 +121,9 @@ namespace DiscImageChef.Decoders.CD
|
||||
|
||||
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
||||
|
||||
decoded.DataLength = BigEndianBitConverter.ToUInt16(CDTOCResponse, 0);
|
||||
decoded.FirstTrack = CDTOCResponse[2];
|
||||
decoded.LastTrack = CDTOCResponse[3];
|
||||
decoded.DataLength = BigEndianBitConverter.ToUInt16(CDTOCResponse, 0);
|
||||
decoded.FirstTrack = CDTOCResponse[2];
|
||||
decoded.LastTrack = CDTOCResponse[3];
|
||||
decoded.TrackDescriptors = new CDTOCTrackDataDescriptor[(decoded.DataLength - 2) / 8];
|
||||
|
||||
if(decoded.DataLength + 2 != CDTOCResponse.Length)
|
||||
@@ -136,11 +136,11 @@ namespace DiscImageChef.Decoders.CD
|
||||
|
||||
for(int i = 0; i < (decoded.DataLength - 2) / 8; i++)
|
||||
{
|
||||
decoded.TrackDescriptors[i].Reserved1 = CDTOCResponse[0 + i * 8 + 4];
|
||||
decoded.TrackDescriptors[i].ADR = (byte)((CDTOCResponse[1 + i * 8 + 4] & 0xF0) >> 4);
|
||||
decoded.TrackDescriptors[i].CONTROL = (byte)(CDTOCResponse[1 + i * 8 + 4] & 0x0F);
|
||||
decoded.TrackDescriptors[i].Reserved1 = CDTOCResponse[0 + i * 8 + 4];
|
||||
decoded.TrackDescriptors[i].ADR = (byte)((CDTOCResponse[1 + i * 8 + 4] & 0xF0) >> 4);
|
||||
decoded.TrackDescriptors[i].CONTROL = (byte)(CDTOCResponse[1 + i * 8 + 4] & 0x0F);
|
||||
decoded.TrackDescriptors[i].TrackNumber = CDTOCResponse[2 + i * 8 + 4];
|
||||
decoded.TrackDescriptors[i].Reserved2 = CDTOCResponse[3 + i * 8 + 4];
|
||||
decoded.TrackDescriptors[i].Reserved2 = CDTOCResponse[3 + i * 8 + 4];
|
||||
decoded.TrackDescriptors[i].TrackStartAddress =
|
||||
BigEndianBitConverter.ToUInt32(CDTOCResponse, 4 + i * 8 + 4);
|
||||
}
|
||||
@@ -220,12 +220,12 @@ namespace DiscImageChef.Decoders.CD
|
||||
? "Digital copy of track is permitted"
|
||||
: "Digital copy of track is prohibited");
|
||||
|
||||
#if DEBUG
|
||||
#if DEBUG
|
||||
if(descriptor.Reserved1 != 0)
|
||||
sb.AppendFormat("Reserved1 = 0x{0:X2}", descriptor.Reserved1).AppendLine();
|
||||
if(descriptor.Reserved2 != 0)
|
||||
sb.AppendFormat("Reserved2 = 0x{0:X2}", descriptor.Reserved2).AppendLine();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
sb.AppendLine();
|
||||
}
|
||||
|
||||
@@ -126,13 +126,13 @@ namespace DiscImageChef.Decoders.DVD
|
||||
|
||||
return new LeadInCopyright
|
||||
{
|
||||
DataLength = (ushort)((response[0] << 8) + response[1]),
|
||||
Reserved1 = response[2],
|
||||
Reserved2 = response[3],
|
||||
CopyrightType = (CopyrightType)response[4],
|
||||
DataLength = (ushort)((response[0] << 8) + response[1]),
|
||||
Reserved1 = response[2],
|
||||
Reserved2 = response[3],
|
||||
CopyrightType = (CopyrightType)response[4],
|
||||
RegionInformation = response[5],
|
||||
Reserved3 = response[6],
|
||||
Reserved4 = response[7]
|
||||
Reserved3 = response[6],
|
||||
Reserved4 = response[7]
|
||||
};
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ namespace DiscImageChef.Decoders.DVD
|
||||
if(cmi == null) return null;
|
||||
|
||||
LeadInCopyright decoded = cmi.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
switch(decoded.CopyrightType)
|
||||
{
|
||||
@@ -164,7 +164,7 @@ namespace DiscImageChef.Decoders.DVD
|
||||
|
||||
if(decoded.CopyrightType == 0) return sb.ToString();
|
||||
|
||||
if(decoded.RegionInformation == 0xFF) sb.AppendLine("Disc cannot be played in any region at all.");
|
||||
if(decoded.RegionInformation == 0xFF) sb.AppendLine("Disc cannot be played in any region at all.");
|
||||
else if(decoded.RegionInformation == 0x00) sb.AppendLine("Disc can be played in any region.");
|
||||
else
|
||||
{
|
||||
|
||||
@@ -132,18 +132,18 @@ namespace DiscImageChef.Decoders.DVD
|
||||
return new MediumStatus
|
||||
{
|
||||
DataLength = (ushort)((response[0] << 8) + response[1]),
|
||||
Reserved1 = response[2],
|
||||
Reserved2 = response[3],
|
||||
Cartridge = (response[4] & 0x80) == 0x80,
|
||||
OUT = (response[4] & 0x40) == 0x40,
|
||||
Reserved3 = (byte)((response[4] & 0x30) >> 4),
|
||||
MSWI = (response[4] & 0x08) == 0x08,
|
||||
CWP = (response[4] & 0x04) == 0x04,
|
||||
PWP = (response[4] & 0x02) == 0x02,
|
||||
Reserved4 = (response[4] & 0x01) == 0x01,
|
||||
DiscType = response[5],
|
||||
Reserved5 = response[6],
|
||||
RAMSWI = response[7]
|
||||
Reserved1 = response[2],
|
||||
Reserved2 = response[3],
|
||||
Cartridge = (response[4] & 0x80) == 0x80,
|
||||
OUT = (response[4] & 0x40) == 0x40,
|
||||
Reserved3 = (byte)((response[4] & 0x30) >> 4),
|
||||
MSWI = (response[4] & 0x08) == 0x08,
|
||||
CWP = (response[4] & 0x04) == 0x04,
|
||||
PWP = (response[4] & 0x02) == 0x02,
|
||||
Reserved4 = (response[4] & 0x01) == 0x01,
|
||||
DiscType = response[5],
|
||||
Reserved5 = response[6],
|
||||
RAMSWI = response[7]
|
||||
};
|
||||
}
|
||||
|
||||
@@ -151,8 +151,8 @@ namespace DiscImageChef.Decoders.DVD
|
||||
{
|
||||
if(status == null) return null;
|
||||
|
||||
MediumStatus decoded = status.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
MediumStatus decoded = status.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if(decoded.PWP) sb.AppendLine("Disc surface is set to write protected status");
|
||||
|
||||
|
||||
@@ -209,32 +209,34 @@ namespace DiscImageChef.Decoders.DVD
|
||||
if(dds.Identifier != 0x0A0A) return null;
|
||||
|
||||
// Common to both DVD-RAM versions
|
||||
dds.DataLength = (ushort)((response[0] << 8) + response[1]);
|
||||
dds.Reserved1 = response[2];
|
||||
dds.Reserved2 = response[3];
|
||||
dds.Reserved3 = response[6];
|
||||
dds.InProcess |= (response[7] & 0x80) == 0x80;
|
||||
dds.UserCertification |= (response[7] & 0x02) == 0x02;
|
||||
dds.DataLength = (ushort)((response[0] << 8) + response[1]);
|
||||
dds.Reserved1 = response[2];
|
||||
dds.Reserved2 = response[3];
|
||||
dds.Reserved3 = response[6];
|
||||
dds.InProcess |= (response[7] & 0x80) == 0x80;
|
||||
dds.UserCertification |= (response[7] & 0x02) == 0x02;
|
||||
dds.ManufacturerCertification |= (response[7] & 0x01) == 0x01;
|
||||
dds.UpdateCount = (uint)((response[8] << 24) + (response[9] << 16) + (response[10] << 8) + response[11]);
|
||||
dds.Groups = (ushort)((response[12] << 8) + response[13]);
|
||||
dds.UpdateCount =
|
||||
(uint)((response[8] << 24) + (response[9] << 16) + (response[10] << 8) + response[11]);
|
||||
dds.Groups =
|
||||
(ushort)((response[12] << 8) + response[13]);
|
||||
|
||||
// ECMA-272
|
||||
if(dds.Groups == 24)
|
||||
{
|
||||
dds.PartialCertification |= (response[7] & 0x40) == 0x40;
|
||||
dds.FormattingOnlyAGroup |= (response[7] & 0x20) == 0x20;
|
||||
dds.Reserved4 = (byte)((response[7] & 0x1C) >> 2);
|
||||
dds.Reserved = new byte[6];
|
||||
dds.Reserved4 = (byte)((response[7] & 0x1C) >> 2);
|
||||
dds.Reserved = new byte[6];
|
||||
Array.Copy(response, 14, dds.Reserved, 0, 6);
|
||||
dds.GroupCertificationFlags = new GroupCertificationFlag[24];
|
||||
for(int i = 0; i < 24; i++)
|
||||
{
|
||||
dds.GroupCertificationFlags[i].InProcess |= (response[20 + i] & 0x80) == 0x80;
|
||||
dds.GroupCertificationFlags[i].InProcess |= (response[20 + i] & 0x80) == 0x80;
|
||||
dds.GroupCertificationFlags[i].PartialCertification |= (response[20 + i] & 0x40) == 0x40;
|
||||
dds.GroupCertificationFlags[i].Reserved1 = (byte)((response[20 + i] & 0x3C) >> 2);
|
||||
dds.GroupCertificationFlags[i].UserCertification |= (response[20 + i] & 0x02) == 0x02;
|
||||
dds.GroupCertificationFlags[i].Reserved2 |= (response[20 + i] & 0x01) == 0x01;
|
||||
dds.GroupCertificationFlags[i].Reserved1 = (byte)((response[20 + i] & 0x3C) >> 2);
|
||||
dds.GroupCertificationFlags[i].UserCertification |= (response[20 + i] & 0x02) == 0x02;
|
||||
dds.GroupCertificationFlags[i].Reserved2 |= (response[20 + i] & 0x01) == 0x01;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,17 +245,17 @@ namespace DiscImageChef.Decoders.DVD
|
||||
|
||||
{
|
||||
dds.Reserved4 = (byte)((response[7] & 0x7C) >> 2);
|
||||
dds.Reserved = new byte[68];
|
||||
dds.Reserved = new byte[68];
|
||||
Array.Copy(response, 16, dds.Reserved, 0, 68);
|
||||
dds.Zones = (ushort)((response[14] << 8) + response[15]);
|
||||
dds.Zones = (ushort)((response[14] << 8) + response[15]);
|
||||
dds.SpareAreaFirstPSN = (uint)((response[85] << 16) + (response[86] << 8) + response[87]);
|
||||
dds.SpareAreaLastPSN = (uint)((response[89] << 16) + (response[90] << 8) + response[91]);
|
||||
dds.LSN0Location = (uint)((response[93] << 16) + (response[94] << 8) + response[95]);
|
||||
dds.StartLSNForZone = new uint[dds.Zones];
|
||||
dds.SpareAreaLastPSN = (uint)((response[89] << 16) + (response[90] << 8) + response[91]);
|
||||
dds.LSN0Location = (uint)((response[93] << 16) + (response[94] << 8) + response[95]);
|
||||
dds.StartLSNForZone = new uint[dds.Zones];
|
||||
|
||||
for(int i = 0; i < dds.Zones; i++)
|
||||
dds.StartLSNForZone[i] = (uint)((response[260 + i * 4 + 1] << 16) +
|
||||
(response[260 + i * 4 + 2] << 8) + response[260 + i * 4 + 3]);
|
||||
(response[260 + i * 4 + 2] << 8) + response[260 + i * 4 + 3]);
|
||||
}
|
||||
|
||||
return dds;
|
||||
@@ -264,7 +266,7 @@ namespace DiscImageChef.Decoders.DVD
|
||||
if(dds == null) return null;
|
||||
|
||||
DiscDefinitionStructure decoded = dds.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if(decoded.InProcess)
|
||||
{
|
||||
@@ -290,6 +292,7 @@ namespace DiscImageChef.Decoders.DVD
|
||||
if(decoded.GroupCertificationFlags[i].PartialCertification)
|
||||
sb.AppendFormat("Group {0} is being certified partially", i).AppendLine();
|
||||
}
|
||||
|
||||
if(decoded.GroupCertificationFlags[i].UserCertification)
|
||||
sb.AppendFormat("Group {0} has been certified by an user", i).AppendLine();
|
||||
}
|
||||
|
||||
@@ -126,10 +126,10 @@ namespace DiscImageChef.Decoders.DVD
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum LayerTypeFieldMask : byte
|
||||
{
|
||||
Embossed = 0x01,
|
||||
Embossed = 0x01,
|
||||
Recordable = 0x02,
|
||||
Rewritable = 0x04,
|
||||
Reserved = 0x08
|
||||
Reserved = 0x08
|
||||
}
|
||||
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
@@ -255,21 +255,21 @@ namespace DiscImageChef.Decoders.DVD
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum DVDLayerStructure
|
||||
{
|
||||
Unspecified = 0,
|
||||
Unspecified = 0,
|
||||
InvertedStack = 1,
|
||||
TwoP = 2,
|
||||
Reserved = 3
|
||||
TwoP = 2,
|
||||
Reserved = 3
|
||||
}
|
||||
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum DVDRecordingSpeed
|
||||
{
|
||||
None = 0,
|
||||
Two = 0,
|
||||
Four = 0x10,
|
||||
Six = 0x20,
|
||||
Eight = 0x30,
|
||||
Ten = 0x40,
|
||||
None = 0,
|
||||
Two = 0,
|
||||
Four = 0x10,
|
||||
Six = 0x20,
|
||||
Eight = 0x30,
|
||||
Ten = 0x40,
|
||||
Twelve = 0x50
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -1070,32 +1070,33 @@ namespace DiscImageChef.Decoders.DVD
|
||||
Array.Copy(response, 0, tmp2, 4, 2048);
|
||||
response = tmp2;
|
||||
}
|
||||
|
||||
|
||||
if(response.Length < 2052) return null;
|
||||
|
||||
PhysicalFormatInformation pfi = new PhysicalFormatInformation();
|
||||
byte[] tmp;
|
||||
byte[] tmp;
|
||||
|
||||
pfi.DataLength = (ushort)((response[0] << 8) + response[1]);
|
||||
pfi.Reserved1 = response[2];
|
||||
pfi.Reserved2 = response[3];
|
||||
pfi.Reserved1 = response[2];
|
||||
pfi.Reserved2 = response[3];
|
||||
|
||||
// Common
|
||||
pfi.DiskCategory = (DiskCategory)((response[4] & 0xF0) >> 4);
|
||||
pfi.PartVersion = (byte)(response[4] & 0x0F);
|
||||
pfi.DiscSize = (DVDSize)((response[5] & 0xF0) >> 4);
|
||||
pfi.MaximumRate = (MaximumRateField)(response[5] & 0x0F);
|
||||
pfi.Reserved3 |= (response[6] & 0x80) == 0x80;
|
||||
pfi.Layers = (byte)((response[6] & 0x60) >> 5);
|
||||
pfi.TrackPath |= (response[6] & 0x08) == 0x08;
|
||||
pfi.LayerType = (LayerTypeFieldMask)(response[6] & 0x07);
|
||||
pfi.LinearDensity = (LinearDensityField)((response[7] & 0xF0) >> 4);
|
||||
pfi.TrackDensity = (TrackDensityField)(response[7] & 0x0F);
|
||||
pfi.DiskCategory = (DiskCategory)((response[4] & 0xF0) >> 4);
|
||||
pfi.PartVersion = (byte)(response[4] & 0x0F);
|
||||
pfi.DiscSize = (DVDSize)((response[5] & 0xF0) >> 4);
|
||||
pfi.MaximumRate = (MaximumRateField)(response[5] & 0x0F);
|
||||
pfi.Reserved3 |= (response[6] & 0x80) == 0x80;
|
||||
pfi.Layers = (byte)((response[6] & 0x60) >> 5);
|
||||
pfi.TrackPath |= (response[6] & 0x08) == 0x08;
|
||||
pfi.LayerType = (LayerTypeFieldMask)(response[6] & 0x07);
|
||||
pfi.LinearDensity = (LinearDensityField)((response[7] & 0xF0) >> 4);
|
||||
pfi.TrackDensity = (TrackDensityField)(response[7] & 0x0F);
|
||||
pfi.DataAreaStartPSN =
|
||||
(uint)((response[8] << 24) + (response[9] << 16) + (response[10] << 8) + response[11]);
|
||||
pfi.DataAreaEndPSN =
|
||||
(uint)((response[12] << 24) + (response[13] << 16) + (response[14] << 8) + response[15]);
|
||||
pfi.Layer0EndPSN = (uint)((response[16] << 24) + (response[17] << 16) + (response[18] << 8) + response[19]);
|
||||
pfi.Layer0EndPSN =
|
||||
(uint)((response[16] << 24) + (response[17] << 16) + (response[18] << 8) + response[19]);
|
||||
pfi.BCA |= (response[20] & 0x80) == 0x80;
|
||||
|
||||
switch(pfi.DiskCategory)
|
||||
@@ -1110,97 +1111,98 @@ namespace DiscImageChef.Decoders.DVD
|
||||
|
||||
if(pfi.PartVersion == 1)
|
||||
{
|
||||
pfi.Velocity = response[52];
|
||||
pfi.ReadPower = response[53];
|
||||
pfi.PeakPower = response[54];
|
||||
pfi.BiasPower = response[55];
|
||||
pfi.FirstPulseStart = response[56];
|
||||
pfi.FirstPulseEnd = response[57];
|
||||
pfi.MultiPulseDuration = response[58];
|
||||
pfi.LastPulseStart = response[59];
|
||||
pfi.LastPulseEnd = response[60];
|
||||
pfi.BiasPowerDuration = response[61];
|
||||
pfi.PeakPowerGroove = response[62];
|
||||
pfi.BiasPowerGroove = response[63];
|
||||
pfi.FirstPulseStartGroove = response[64];
|
||||
pfi.FirstPulseEndGroove = response[65];
|
||||
pfi.Velocity = response[52];
|
||||
pfi.ReadPower = response[53];
|
||||
pfi.PeakPower = response[54];
|
||||
pfi.BiasPower = response[55];
|
||||
pfi.FirstPulseStart = response[56];
|
||||
pfi.FirstPulseEnd = response[57];
|
||||
pfi.MultiPulseDuration = response[58];
|
||||
pfi.LastPulseStart = response[59];
|
||||
pfi.LastPulseEnd = response[60];
|
||||
pfi.BiasPowerDuration = response[61];
|
||||
pfi.PeakPowerGroove = response[62];
|
||||
pfi.BiasPowerGroove = response[63];
|
||||
pfi.FirstPulseStartGroove = response[64];
|
||||
pfi.FirstPulseEndGroove = response[65];
|
||||
pfi.MultiplePulseDurationGroove = response[66];
|
||||
pfi.LastPulseStartGroove = response[67];
|
||||
pfi.LastPulseEndGroove = response[68];
|
||||
pfi.BiasPowerDurationGroove = response[69];
|
||||
pfi.LastPulseStartGroove = response[67];
|
||||
pfi.LastPulseEndGroove = response[68];
|
||||
pfi.BiasPowerDurationGroove = response[69];
|
||||
}
|
||||
else if(pfi.PartVersion == 6)
|
||||
{
|
||||
pfi.Velocity = response[504];
|
||||
pfi.ReadPower = response[505];
|
||||
pfi.Velocity = response[504];
|
||||
pfi.ReadPower = response[505];
|
||||
pfi.AdaptativeWritePulseControlFlag |= (response[506] & 0x80) == 0x80;
|
||||
pfi.PeakPower = response[507];
|
||||
pfi.BiasPower1 = response[508];
|
||||
pfi.BiasPower2 = response[509];
|
||||
pfi.BiasPower3 = response[510];
|
||||
pfi.PeakPowerGroove = response[511];
|
||||
pfi.BiasPower1Groove = response[512];
|
||||
pfi.BiasPower2Groove = response[513];
|
||||
pfi.BiasPower3Groove = response[514];
|
||||
pfi.FirstPulseEnd = response[515];
|
||||
pfi.FirstPulseDuration = response[516];
|
||||
pfi.MultiPulseDuration = response[518];
|
||||
pfi.LastPulseStart = response[519];
|
||||
pfi.BiasPower2Duration = response[520];
|
||||
pfi.FirstPulseStart3TSpace3T = response[521];
|
||||
pfi.FirstPulseStart4TSpace3T = response[522];
|
||||
pfi.FirstPulseStart5TSpace3T = response[523];
|
||||
pfi.FirstPulseStartSpace3T = response[524];
|
||||
pfi.FirstPulseStart3TSpace4T = response[525];
|
||||
pfi.FirstPulseStart4TSpace4T = response[526];
|
||||
pfi.FirstPulseStart5TSpace4T = response[527];
|
||||
pfi.FirstPulseStartSpace4T = response[528];
|
||||
pfi.FirstPulseStart3TSpace5T = response[529];
|
||||
pfi.FirstPulseStart4TSpace5T = response[530];
|
||||
pfi.FirstPulseStart5TSpace5T = response[531];
|
||||
pfi.FirstPulseStartSpace5T = response[532];
|
||||
pfi.FirstPulseStart3TSpace = response[533];
|
||||
pfi.FirstPulseStart4TSpace = response[534];
|
||||
pfi.FirstPulseStart5TSpace = response[535];
|
||||
pfi.FirstPulseStartSpace = response[536];
|
||||
pfi.FirstPulse3TStartTSpace3T = response[537];
|
||||
pfi.FirstPulse4TStartTSpace3T = response[538];
|
||||
pfi.FirstPulse5TStartTSpace3T = response[539];
|
||||
pfi.FirstPulseStartTSpace3T = response[540];
|
||||
pfi.FirstPulse3TStartTSpace4T = response[541];
|
||||
pfi.FirstPulse4TStartTSpace4T = response[542];
|
||||
pfi.FirstPulse5TStartTSpace4T = response[543];
|
||||
pfi.FirstPulseStartTSpace4T = response[544];
|
||||
pfi.FirstPulse3TStartTSpace5T = response[545];
|
||||
pfi.FirstPulse4TStartTSpace5T = response[546];
|
||||
pfi.FirstPulse5TStartTSpace5T = response[547];
|
||||
pfi.FirstPulseStartTSpace5T = response[548];
|
||||
pfi.FirstPulse3TStartTSpace = response[549];
|
||||
pfi.FirstPulse4TStartTSpace = response[550];
|
||||
pfi.FirstPulse5TStartTSpace = response[551];
|
||||
pfi.FirstPulseStartTSpace = response[552];
|
||||
tmp = new byte[48];
|
||||
pfi.PeakPower = response[507];
|
||||
pfi.BiasPower1 = response[508];
|
||||
pfi.BiasPower2 = response[509];
|
||||
pfi.BiasPower3 = response[510];
|
||||
pfi.PeakPowerGroove = response[511];
|
||||
pfi.BiasPower1Groove = response[512];
|
||||
pfi.BiasPower2Groove = response[513];
|
||||
pfi.BiasPower3Groove = response[514];
|
||||
pfi.FirstPulseEnd = response[515];
|
||||
pfi.FirstPulseDuration = response[516];
|
||||
pfi.MultiPulseDuration = response[518];
|
||||
pfi.LastPulseStart = response[519];
|
||||
pfi.BiasPower2Duration = response[520];
|
||||
pfi.FirstPulseStart3TSpace3T = response[521];
|
||||
pfi.FirstPulseStart4TSpace3T = response[522];
|
||||
pfi.FirstPulseStart5TSpace3T = response[523];
|
||||
pfi.FirstPulseStartSpace3T = response[524];
|
||||
pfi.FirstPulseStart3TSpace4T = response[525];
|
||||
pfi.FirstPulseStart4TSpace4T = response[526];
|
||||
pfi.FirstPulseStart5TSpace4T = response[527];
|
||||
pfi.FirstPulseStartSpace4T = response[528];
|
||||
pfi.FirstPulseStart3TSpace5T = response[529];
|
||||
pfi.FirstPulseStart4TSpace5T = response[530];
|
||||
pfi.FirstPulseStart5TSpace5T = response[531];
|
||||
pfi.FirstPulseStartSpace5T = response[532];
|
||||
pfi.FirstPulseStart3TSpace = response[533];
|
||||
pfi.FirstPulseStart4TSpace = response[534];
|
||||
pfi.FirstPulseStart5TSpace = response[535];
|
||||
pfi.FirstPulseStartSpace = response[536];
|
||||
pfi.FirstPulse3TStartTSpace3T = response[537];
|
||||
pfi.FirstPulse4TStartTSpace3T = response[538];
|
||||
pfi.FirstPulse5TStartTSpace3T = response[539];
|
||||
pfi.FirstPulseStartTSpace3T = response[540];
|
||||
pfi.FirstPulse3TStartTSpace4T = response[541];
|
||||
pfi.FirstPulse4TStartTSpace4T = response[542];
|
||||
pfi.FirstPulse5TStartTSpace4T = response[543];
|
||||
pfi.FirstPulseStartTSpace4T = response[544];
|
||||
pfi.FirstPulse3TStartTSpace5T = response[545];
|
||||
pfi.FirstPulse4TStartTSpace5T = response[546];
|
||||
pfi.FirstPulse5TStartTSpace5T = response[547];
|
||||
pfi.FirstPulseStartTSpace5T = response[548];
|
||||
pfi.FirstPulse3TStartTSpace = response[549];
|
||||
pfi.FirstPulse4TStartTSpace = response[550];
|
||||
pfi.FirstPulse5TStartTSpace = response[551];
|
||||
pfi.FirstPulseStartTSpace = response[552];
|
||||
tmp = new byte[48];
|
||||
Array.Copy(response, 553, tmp, 0, 48);
|
||||
pfi.DiskManufacturer = StringHandlers.SpacePaddedToString(tmp);
|
||||
tmp = new byte[16];
|
||||
tmp = new byte[16];
|
||||
Array.Copy(response, 601, tmp, 0, 16);
|
||||
pfi.DiskManufacturerSupplementary = StringHandlers.SpacePaddedToString(tmp);
|
||||
pfi.WritePowerControlParams = new byte[2];
|
||||
pfi.WritePowerControlParams[0] = response[617];
|
||||
pfi.WritePowerControlParams[1] = response[618];
|
||||
pfi.PowerRatioLandThreshold = response[619];
|
||||
pfi.TargetAsymmetry = response[620];
|
||||
pfi.TemporaryPeakPower = response[621];
|
||||
pfi.TemporaryBiasPower1 = response[622];
|
||||
pfi.TemporaryBiasPower2 = response[623];
|
||||
pfi.TemporaryBiasPower3 = response[624];
|
||||
pfi.PowerRatioGrooveThreshold = response[625];
|
||||
pfi.PowerRatioLandThreshold6T = response[626];
|
||||
pfi.PowerRatioGrooveThreshold6T = response[627];
|
||||
pfi.WritePowerControlParams = new byte[2];
|
||||
pfi.WritePowerControlParams[0] = response[617];
|
||||
pfi.WritePowerControlParams[1] = response[618];
|
||||
pfi.PowerRatioLandThreshold = response[619];
|
||||
pfi.TargetAsymmetry = response[620];
|
||||
pfi.TemporaryPeakPower = response[621];
|
||||
pfi.TemporaryBiasPower1 = response[622];
|
||||
pfi.TemporaryBiasPower2 = response[623];
|
||||
pfi.TemporaryBiasPower3 = response[624];
|
||||
pfi.PowerRatioGrooveThreshold = response[625];
|
||||
pfi.PowerRatioLandThreshold6T = response[626];
|
||||
pfi.PowerRatioGrooveThreshold6T = response[627];
|
||||
}
|
||||
|
||||
break;
|
||||
// DVD-R and DVD-RW
|
||||
case DiskCategory.DVDR when pfi.PartVersion < 6:
|
||||
case DiskCategory.DVDR when pfi.PartVersion < 6:
|
||||
case DiskCategory.DVDRW when pfi.PartVersion < 3:
|
||||
pfi.CurrentBorderOutSector =
|
||||
(uint)((response[36] << 24) + (response[37] << 16) + (response[38] << 8) + response[39]);
|
||||
@@ -1209,39 +1211,39 @@ namespace DiscImageChef.Decoders.DVD
|
||||
break;
|
||||
// DVD+RW
|
||||
case DiskCategory.DVDPRW:
|
||||
pfi.RecordingVelocity = response[36];
|
||||
pfi.RecordingVelocity = response[36];
|
||||
pfi.ReadPowerMaxVelocity = response[37];
|
||||
pfi.PIndMaxVelocity = response[38];
|
||||
pfi.PMaxVelocity = response[39];
|
||||
pfi.E1MaxVelocity = response[40];
|
||||
pfi.E2MaxVelocity = response[41];
|
||||
pfi.YTargetMaxVelocity = response[42];
|
||||
pfi.PIndMaxVelocity = response[38];
|
||||
pfi.PMaxVelocity = response[39];
|
||||
pfi.E1MaxVelocity = response[40];
|
||||
pfi.E2MaxVelocity = response[41];
|
||||
pfi.YTargetMaxVelocity = response[42];
|
||||
pfi.ReadPowerRefVelocity = response[43];
|
||||
pfi.PIndRefVelocity = response[44];
|
||||
pfi.PRefVelocity = response[45];
|
||||
pfi.E1RefVelocity = response[46];
|
||||
pfi.E2RefVelocity = response[47];
|
||||
pfi.YTargetRefVelocity = response[48];
|
||||
pfi.PIndRefVelocity = response[44];
|
||||
pfi.PRefVelocity = response[45];
|
||||
pfi.E1RefVelocity = response[46];
|
||||
pfi.E2RefVelocity = response[47];
|
||||
pfi.YTargetRefVelocity = response[48];
|
||||
pfi.ReadPowerMinVelocity = response[49];
|
||||
pfi.PIndMinVelocity = response[50];
|
||||
pfi.PMinVelocity = response[51];
|
||||
pfi.E1MinVelocity = response[52];
|
||||
pfi.E2MinVelocity = response[53];
|
||||
pfi.YTargetMinVelocity = response[54];
|
||||
pfi.PIndMinVelocity = response[50];
|
||||
pfi.PMinVelocity = response[51];
|
||||
pfi.E1MinVelocity = response[52];
|
||||
pfi.E2MinVelocity = response[53];
|
||||
pfi.YTargetMinVelocity = response[54];
|
||||
break;
|
||||
}
|
||||
|
||||
// DVD+R, DVD+RW, DVD+R DL and DVD+RW DL
|
||||
if(pfi.DiskCategory == DiskCategory.DVDPR || pfi.DiskCategory == DiskCategory.DVDPRW ||
|
||||
if(pfi.DiskCategory == DiskCategory.DVDPR || pfi.DiskCategory == DiskCategory.DVDPRW ||
|
||||
pfi.DiskCategory == DiskCategory.DVDPRDL || pfi.DiskCategory == DiskCategory.DVDPRWDL)
|
||||
{
|
||||
pfi.VCPS |= (response[20] & 0x40) == 0x40;
|
||||
pfi.ApplicationCode = response[21];
|
||||
pfi.ExtendedInformation = response[22];
|
||||
tmp = new byte[8];
|
||||
pfi.VCPS |= (response[20] & 0x40) == 0x40;
|
||||
pfi.ApplicationCode = response[21];
|
||||
pfi.ExtendedInformation = response[22];
|
||||
tmp = new byte[8];
|
||||
Array.Copy(response, 23, tmp, 0, 8);
|
||||
pfi.DiskManufacturerID = StringHandlers.CToString(tmp);
|
||||
tmp = new byte[3];
|
||||
tmp = new byte[3];
|
||||
Array.Copy(response, 31, tmp, 0, 3);
|
||||
pfi.MediaTypeID = StringHandlers.CToString(tmp);
|
||||
pfi.ProductRevision =
|
||||
@@ -1253,39 +1255,39 @@ namespace DiscImageChef.Decoders.DVD
|
||||
{
|
||||
// DVD+RW
|
||||
case DiskCategory.DVDPRW when pfi.PartVersion == 2:
|
||||
pfi.TopFirstPulseDuration = response[55];
|
||||
pfi.MultiPulseDuration = response[56];
|
||||
pfi.FirstPulseLeadTime = response[57];
|
||||
pfi.TopFirstPulseDuration = response[55];
|
||||
pfi.MultiPulseDuration = response[56];
|
||||
pfi.FirstPulseLeadTime = response[57];
|
||||
pfi.EraseLeadTimeRefVelocity = response[58];
|
||||
pfi.EraseLeadTimeUppVelocity = response[59];
|
||||
break;
|
||||
// DVD+R and DVD+R DL
|
||||
case DiskCategory.DVDPR:
|
||||
case DiskCategory.DVDPRDL:
|
||||
pfi.PrimaryVelocity = response[36];
|
||||
pfi.UpperVelocity = response[37];
|
||||
pfi.Wavelength = response[38];
|
||||
pfi.NormalizedPowerDependency = response[39];
|
||||
pfi.MaximumPowerAtPrimaryVelocity = response[40];
|
||||
pfi.PindAtPrimaryVelocity = response[41];
|
||||
pfi.BtargetAtPrimaryVelocity = response[42];
|
||||
pfi.MaximumPowerAtUpperVelocity = response[43];
|
||||
pfi.PindAtUpperVelocity = response[44];
|
||||
pfi.BtargetAtUpperVelocity = response[45];
|
||||
pfi.FirstPulseDuration4TPrimaryVelocity = response[46];
|
||||
pfi.FirstPulseDuration3TPrimaryVelocity = response[47];
|
||||
pfi.MultiPulseDurationPrimaryVelocity = response[48];
|
||||
pfi.LastPulseDurationPrimaryVelocity = response[49];
|
||||
pfi.FirstPulseLeadTime4TPrimaryVelocity = response[50];
|
||||
pfi.FirstPulseLeadTime3TPrimaryVelocity = response[51];
|
||||
pfi.PrimaryVelocity = response[36];
|
||||
pfi.UpperVelocity = response[37];
|
||||
pfi.Wavelength = response[38];
|
||||
pfi.NormalizedPowerDependency = response[39];
|
||||
pfi.MaximumPowerAtPrimaryVelocity = response[40];
|
||||
pfi.PindAtPrimaryVelocity = response[41];
|
||||
pfi.BtargetAtPrimaryVelocity = response[42];
|
||||
pfi.MaximumPowerAtUpperVelocity = response[43];
|
||||
pfi.PindAtUpperVelocity = response[44];
|
||||
pfi.BtargetAtUpperVelocity = response[45];
|
||||
pfi.FirstPulseDuration4TPrimaryVelocity = response[46];
|
||||
pfi.FirstPulseDuration3TPrimaryVelocity = response[47];
|
||||
pfi.MultiPulseDurationPrimaryVelocity = response[48];
|
||||
pfi.LastPulseDurationPrimaryVelocity = response[49];
|
||||
pfi.FirstPulseLeadTime4TPrimaryVelocity = response[50];
|
||||
pfi.FirstPulseLeadTime3TPrimaryVelocity = response[51];
|
||||
pfi.FirstPulseLeadingEdgePrimaryVelocity = response[52];
|
||||
pfi.FirstPulseDuration4TUpperVelocity = response[53];
|
||||
pfi.FirstPulseDuration3TUpperVelocity = response[54];
|
||||
pfi.MultiPulseDurationUpperVelocity = response[55];
|
||||
pfi.LastPulseDurationUpperVelocity = response[56];
|
||||
pfi.FirstPulseLeadTime4TUpperVelocity = response[57];
|
||||
pfi.FirstPulseLeadTime3TUpperVelocity = response[58];
|
||||
pfi.FirstPulseLeadingEdgeUpperVelocity = response[59];
|
||||
pfi.FirstPulseDuration4TUpperVelocity = response[53];
|
||||
pfi.FirstPulseDuration3TUpperVelocity = response[54];
|
||||
pfi.MultiPulseDurationUpperVelocity = response[55];
|
||||
pfi.LastPulseDurationUpperVelocity = response[56];
|
||||
pfi.FirstPulseLeadTime4TUpperVelocity = response[57];
|
||||
pfi.FirstPulseLeadTime3TUpperVelocity = response[58];
|
||||
pfi.FirstPulseLeadingEdgeUpperVelocity = response[59];
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1297,48 +1299,48 @@ namespace DiscImageChef.Decoders.DVD
|
||||
break;
|
||||
// DVD+RW DL
|
||||
case DiskCategory.DVDPRWDL:
|
||||
pfi.BasicPrimaryVelocity = response[36];
|
||||
pfi.BasicPrimaryVelocity = response[36];
|
||||
pfi.MaxReadPowerPrimaryVelocity = response[37];
|
||||
pfi.PindPrimaryVelocity = response[38];
|
||||
pfi.PPrimaryVelocity = response[39];
|
||||
pfi.E1PrimaryVelocity = response[40];
|
||||
pfi.E2PrimaryVelocity = response[41];
|
||||
pfi.YtargetPrimaryVelocity = response[42];
|
||||
pfi.BOptimumPrimaryVelocity = response[43];
|
||||
pfi.TFirstPulseDuration = response[46];
|
||||
pfi.TMultiPulseDuration = response[47];
|
||||
pfi.FirstPulseLeadTimeAnyRun = response[48];
|
||||
pfi.FirstPulseLeadTimeRun3T = response[49];
|
||||
pfi.LastPulseLeadTimeAnyRun = response[50];
|
||||
pfi.LastPulseLeadTime3T = response[51];
|
||||
pfi.LastPulseLeadTime4T = response[52];
|
||||
pfi.ErasePulseLeadTimeAny = response[53];
|
||||
pfi.ErasePulseLeadTime3T = response[54];
|
||||
pfi.ErasePulseLeadTime4T = response[55];
|
||||
pfi.PindPrimaryVelocity = response[38];
|
||||
pfi.PPrimaryVelocity = response[39];
|
||||
pfi.E1PrimaryVelocity = response[40];
|
||||
pfi.E2PrimaryVelocity = response[41];
|
||||
pfi.YtargetPrimaryVelocity = response[42];
|
||||
pfi.BOptimumPrimaryVelocity = response[43];
|
||||
pfi.TFirstPulseDuration = response[46];
|
||||
pfi.TMultiPulseDuration = response[47];
|
||||
pfi.FirstPulseLeadTimeAnyRun = response[48];
|
||||
pfi.FirstPulseLeadTimeRun3T = response[49];
|
||||
pfi.LastPulseLeadTimeAnyRun = response[50];
|
||||
pfi.LastPulseLeadTime3T = response[51];
|
||||
pfi.LastPulseLeadTime4T = response[52];
|
||||
pfi.ErasePulseLeadTimeAny = response[53];
|
||||
pfi.ErasePulseLeadTime3T = response[54];
|
||||
pfi.ErasePulseLeadTime4T = response[55];
|
||||
break;
|
||||
// DVD-R DL and DVD-RW DL
|
||||
case DiskCategory.DVDR when pfi.PartVersion == 6:
|
||||
case DiskCategory.DVDR when pfi.PartVersion == 6:
|
||||
case DiskCategory.DVDRW when pfi.PartVersion == 3:
|
||||
pfi.MaxRecordingSpeed = (DVDRecordingSpeed)response[21];
|
||||
pfi.MinRecordingSpeed = (DVDRecordingSpeed)response[22];
|
||||
pfi.RecordingSpeed1 = (DVDRecordingSpeed)response[23];
|
||||
pfi.RecordingSpeed2 = (DVDRecordingSpeed)response[24];
|
||||
pfi.RecordingSpeed3 = (DVDRecordingSpeed)response[25];
|
||||
pfi.RecordingSpeed4 = (DVDRecordingSpeed)response[26];
|
||||
pfi.RecordingSpeed5 = (DVDRecordingSpeed)response[27];
|
||||
pfi.RecordingSpeed6 = (DVDRecordingSpeed)response[28];
|
||||
pfi.RecordingSpeed7 = (DVDRecordingSpeed)response[29];
|
||||
pfi.Class = response[30];
|
||||
pfi.ExtendedVersion = response[31];
|
||||
pfi.RecordingSpeed1 = (DVDRecordingSpeed)response[23];
|
||||
pfi.RecordingSpeed2 = (DVDRecordingSpeed)response[24];
|
||||
pfi.RecordingSpeed3 = (DVDRecordingSpeed)response[25];
|
||||
pfi.RecordingSpeed4 = (DVDRecordingSpeed)response[26];
|
||||
pfi.RecordingSpeed5 = (DVDRecordingSpeed)response[27];
|
||||
pfi.RecordingSpeed6 = (DVDRecordingSpeed)response[28];
|
||||
pfi.RecordingSpeed7 = (DVDRecordingSpeed)response[29];
|
||||
pfi.Class = response[30];
|
||||
pfi.ExtendedVersion = response[31];
|
||||
pfi.CurrentBorderOutSector =
|
||||
(uint)((response[36] << 24) + (response[37] << 16) + (response[38] << 8) + response[39]);
|
||||
pfi.NextBorderInSector =
|
||||
(uint)((response[40] << 24) + (response[41] << 16) + (response[42] << 8) + response[43]);
|
||||
pfi.PreRecordedControlDataInv |= (response[44] & 0x01) == 0x01;
|
||||
pfi.PreRecordedLeadIn |= (response[44] & 0x02) == 0x02;
|
||||
pfi.PreRecordedLeadOut |= (response[44] & 0x08) == 0x08;
|
||||
pfi.ARCharLayer1 = (byte)(response[45] & 0x0F);
|
||||
pfi.TrackPolarityLayer1 = (byte)((response[45] & 0xF0) >> 4);
|
||||
pfi.PreRecordedControlDataInv |= (response[44] & 0x01) == 0x01;
|
||||
pfi.PreRecordedLeadIn |= (response[44] & 0x02) == 0x02;
|
||||
pfi.PreRecordedLeadOut |= (response[44] & 0x08) == 0x08;
|
||||
pfi.ARCharLayer1 = (byte)(response[45] & 0x0F);
|
||||
pfi.TrackPolarityLayer1 = (byte)((response[45] & 0xF0) >> 4);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1350,7 +1352,7 @@ namespace DiscImageChef.Decoders.DVD
|
||||
if(pfi == null) return null;
|
||||
|
||||
PhysicalFormatInformation decoded = pfi.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
string sizeString;
|
||||
switch(decoded.DiscSize)
|
||||
@@ -1541,7 +1543,7 @@ namespace DiscImageChef.Decoders.DVD
|
||||
}
|
||||
|
||||
sb.AppendFormat("Disc has {0} layers", decoded.Layers + 1).AppendLine();
|
||||
if(decoded.TrackPath && decoded.Layers == 1) sb.AppendLine("Layers are in parallel track path");
|
||||
if(decoded.TrackPath && decoded.Layers == 1) sb.AppendLine("Layers are in parallel track path");
|
||||
else if(!decoded.TrackPath && decoded.Layers == 1) sb.AppendLine("Layers are in opposite track path");
|
||||
|
||||
switch(decoded.LinearDensity)
|
||||
@@ -1602,7 +1604,8 @@ namespace DiscImageChef.Decoders.DVD
|
||||
if(decoded.Layers == 1 && !decoded.TrackPath)
|
||||
sb.AppendFormat("Layer 0 ends at PSN {0:X}h", decoded.Layer0EndPSN).AppendLine();
|
||||
}
|
||||
else sb.AppendLine("Disc is empty");
|
||||
else
|
||||
sb.AppendLine("Disc is empty");
|
||||
else sb.AppendLine("Disc is empty");
|
||||
|
||||
if(decoded.BCA) sb.AppendLine("Disc has a burst cutting area");
|
||||
@@ -1632,8 +1635,9 @@ namespace DiscImageChef.Decoders.DVD
|
||||
sb.AppendFormat("Disc manufacturer supplementary information is {0}",
|
||||
decoded.DiskManufacturerSupplementary).AppendLine();
|
||||
}
|
||||
|
||||
break;
|
||||
case DiskCategory.DVDR when decoded.PartVersion < 6:
|
||||
case DiskCategory.DVDR when decoded.PartVersion < 6:
|
||||
case DiskCategory.DVDRW when decoded.PartVersion < 3:
|
||||
sb.AppendFormat("Current Border-Out first sector is PSN {0:X}h", decoded.CurrentBorderOutSector)
|
||||
.AppendLine();
|
||||
@@ -1652,7 +1656,7 @@ namespace DiscImageChef.Decoders.DVD
|
||||
break;
|
||||
}
|
||||
|
||||
if((decoded.DiskCategory != DiskCategory.DVDR || decoded.PartVersion < 6) &&
|
||||
if((decoded.DiskCategory != DiskCategory.DVDR || decoded.PartVersion < 6) &&
|
||||
(decoded.DiskCategory != DiskCategory.DVDRW || decoded.PartVersion < 3)) return sb.ToString();
|
||||
|
||||
sb.AppendFormat("Current RMD in extra Border zone starts at PSN {0:X}h", decoded.CurrentRMDExtraBorderPSN)
|
||||
|
||||
@@ -97,8 +97,8 @@ namespace DiscImageChef.Decoders.DVD
|
||||
return new SpareAreaInformation
|
||||
{
|
||||
DataLength = (ushort)((response[0] << 8) + response[1]),
|
||||
Reserved1 = response[2],
|
||||
Reserved2 = response[3],
|
||||
Reserved1 = response[2],
|
||||
Reserved2 = response[3],
|
||||
UnusedPrimaryBlocks =
|
||||
(uint)((response[4] << 24) + (response[5] << 16) + (response[6] << 8) + response[7]),
|
||||
UnusedSupplementaryBlocks =
|
||||
@@ -113,7 +113,7 @@ namespace DiscImageChef.Decoders.DVD
|
||||
if(sai == null) return null;
|
||||
|
||||
SpareAreaInformation decoded = sai.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.AppendFormat("{0} unused primary spare blocks", decoded.UnusedPrimaryBlocks).AppendLine();
|
||||
sb.AppendFormat("{0} unused supplementary spare blocks", decoded.UnusedSupplementaryBlocks).AppendLine();
|
||||
|
||||
@@ -48,11 +48,13 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
/// <summary>
|
||||
/// Set to 0x00
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] zero;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
|
||||
public byte[] zero;
|
||||
/// <summary>
|
||||
/// Set to 0xA1
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] sync;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
|
||||
public byte[] sync;
|
||||
/// <summary>
|
||||
/// Set to 0xFF
|
||||
/// </summary>
|
||||
@@ -72,7 +74,8 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
/// <summary>
|
||||
/// OS dependent tag
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] label;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||
public byte[] label;
|
||||
/// <summary>
|
||||
/// Checksum from <see cref="amiga" /> to <see cref="label" />
|
||||
/// </summary>
|
||||
@@ -81,7 +84,8 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
/// Checksum from <see cref="data" />
|
||||
/// </summary>
|
||||
public uint dataChecksum;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] public byte[] data;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)]
|
||||
public byte[] data;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -93,33 +93,39 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
/// checksum[0] = (decodedChecksum >> 1) | 0xAA
|
||||
/// checksum[1] = decodedChecksum | 0xAA
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] checksum;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
|
||||
public byte[] checksum;
|
||||
/// <summary>
|
||||
/// Always 0xDE, 0xAA, 0xEB
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] epilogue;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
||||
public byte[] epilogue;
|
||||
/// <summary>
|
||||
/// Always 0xD5, 0xAA, 0x96
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] prologue;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
||||
public byte[] prologue;
|
||||
/// <summary>
|
||||
/// Sector number encoded as:
|
||||
/// sector[0] = (decodedSector >> 1) | 0xAA
|
||||
/// sector[1] = decodedSector | 0xAA
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] sector;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
|
||||
public byte[] sector;
|
||||
/// <summary>
|
||||
/// Track number encoded as:
|
||||
/// track[0] = (decodedTrack >> 1) | 0xAA
|
||||
/// track[1] = decodedTrack | 0xAA
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] track;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
|
||||
public byte[] track;
|
||||
/// <summary>
|
||||
/// Volume number encoded as:
|
||||
/// volume[0] = (decodedVolume >> 1) | 0xAA
|
||||
/// volume[1] = decodedVolume | 0xAA
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] volume;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
|
||||
public byte[] volume;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -137,11 +143,13 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
/// <summary>
|
||||
/// Always 0xDE, 0xAA, 0xEB
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] epilogue;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
||||
public byte[] epilogue;
|
||||
/// <summary>
|
||||
/// Always 0xD5, 0xAA, 0xAD
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] prologue;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
||||
public byte[] prologue;
|
||||
}
|
||||
|
||||
static readonly byte[] ReadTable5and3 =
|
||||
@@ -225,11 +233,11 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
if(data == null || data.Length != 410) return null;
|
||||
|
||||
byte[] buffer = new byte[data.Length];
|
||||
byte carry = 0;
|
||||
byte carry = 0;
|
||||
for(int i = 0; i < data.Length; i++)
|
||||
{
|
||||
carry ^= ReadTable5and3[data[i]];
|
||||
buffer[i] = carry;
|
||||
carry ^= ReadTable5and3[data[i]];
|
||||
buffer[i] = carry;
|
||||
}
|
||||
|
||||
byte[] output = new byte[256];
|
||||
@@ -237,14 +245,14 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
{
|
||||
byte b1 = buffer[51 * 3 - i];
|
||||
byte b2 = buffer[51 * 2 - i];
|
||||
byte b3 = buffer[51 - i];
|
||||
byte b4 = (byte)((((b1 & 2) << 1) | (b2 & 2) | ((b3 & 2) >> 1)) & 0xFF);
|
||||
byte b5 = (byte)((((b1 & 1) << 2) | ((b2 & 1) << 1) | (b3 & 1)) & 0xFF);
|
||||
byte b3 = buffer[51 - i];
|
||||
byte b4 = (byte)((((b1 & 2) << 1) | (b2 & 2) | ((b3 & 2) >> 1)) & 0xFF);
|
||||
byte b5 = (byte)((((b1 & 1) << 2) | ((b2 & 1) << 1) | (b3 & 1)) & 0xFF);
|
||||
output[250 - 5 * i] = (byte)(((buffer[i + 51 * 3 + 1] << 3) | ((b1 >> 2) & 0x7)) & 0xFF);
|
||||
output[251 - 5 * i] = (byte)(((buffer[i + 51 * 4 + 1] << 3) | ((b2 >> 2) & 0x7)) & 0xFF);
|
||||
output[252 - 5 * i] = (byte)(((buffer[i + 51 * 5 + 1] << 3) | ((b3 >> 2) & 0x7)) & 0xFF);
|
||||
output[253 - 5 * i] = (byte)(((buffer[i + 51 * 6 + 1] << 3) | b4) & 0xFF);
|
||||
output[254 - 5 * i] = (byte)(((buffer[i + 51 * 7 + 1] << 3) | b5) & 0xFF);
|
||||
output[253 - 5 * i] = (byte)(((buffer[i + 51 * 6 + 1] << 3) | b4) & 0xFF);
|
||||
output[254 - 5 * i] = (byte)(((buffer[i + 51 * 7 + 1] << 3) | b5) & 0xFF);
|
||||
}
|
||||
|
||||
output[255] = (byte)(((buffer[409] << 3) | (buffer[0] & 0x7)) & 0xFF);
|
||||
@@ -261,11 +269,11 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
if(data == null || data.Length != 342) return null;
|
||||
|
||||
byte[] buffer = new byte[data.Length];
|
||||
byte carry = 0;
|
||||
byte carry = 0;
|
||||
for(int i = 0; i < data.Length; i++)
|
||||
{
|
||||
carry ^= ReadTable6and2[data[i]];
|
||||
buffer[i] = carry;
|
||||
carry ^= ReadTable6and2[data[i]];
|
||||
buffer[i] = carry;
|
||||
}
|
||||
|
||||
byte[] output = new byte[256];
|
||||
@@ -296,8 +304,10 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
public static byte[] DecodeSector(RawSector sector)
|
||||
{
|
||||
if(sector.addressField.prologue[0] != 0xD5 || sector.addressField.prologue[1] != 0xAA) return null;
|
||||
|
||||
// Pre DOS 3.3
|
||||
if(sector.addressField.prologue[2] == 0xB5) return Decode5and3(sector.dataField.data);
|
||||
|
||||
// DOS 3.3
|
||||
return sector.addressField.prologue[2] == 0x96 ? Decode6and2(sector.dataField.data) : null;
|
||||
// Unknown
|
||||
@@ -336,11 +346,12 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
addressField = new RawAddressField
|
||||
{
|
||||
prologue = new[] {data[position], data[position + 1], data[position + 2]},
|
||||
volume = new[] {data[position + 3], data[position + 4]},
|
||||
track = new[] {data[position + 5], data[position + 6]},
|
||||
sector = new[] {data[position + 7], data[position + 8]},
|
||||
checksum = new[] {data[position + 9], data[position + 10]},
|
||||
epilogue = new[] {data[position + 11], data[position + 12], data[position + 13]}
|
||||
volume = new[] {data[position + 3], data[position + 4]},
|
||||
track = new[] {data[position + 5], data[position + 6]},
|
||||
sector = new[] {data[position + 7], data[position + 8]},
|
||||
checksum = new[] {data[position + 9], data[position + 10]},
|
||||
epilogue = new[]
|
||||
{data[position + 11], data[position + 12], data[position + 13]}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -361,9 +372,9 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
sector.addressField.epilogue[2]);
|
||||
|
||||
position += 14;
|
||||
int syncCount = 0;
|
||||
bool onSync = false;
|
||||
MemoryStream gaps = new MemoryStream();
|
||||
int syncCount = 0;
|
||||
bool onSync = false;
|
||||
MemoryStream gaps = new MemoryStream();
|
||||
|
||||
while(data[position] == 0xFF)
|
||||
{
|
||||
@@ -379,17 +390,17 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
// Prologue not found
|
||||
if(data[position] != 0xD5 || data[position + 1] != 0xAA) return null;
|
||||
|
||||
sector.innerGap = gaps.ToArray();
|
||||
sector.innerGap = gaps.ToArray();
|
||||
sector.dataField = new RawDataField();
|
||||
|
||||
DicConsole.DebugWriteLine("Apple ][ GCR Decoder", "Inner gap has {0} bytes",
|
||||
sector.innerGap.Length);
|
||||
DicConsole.DebugWriteLine("Apple ][ GCR Decoder", "Prologue found at {0}", position);
|
||||
sector.dataField.prologue = new byte[3];
|
||||
sector.dataField.prologue[0] = data[position];
|
||||
sector.dataField.prologue[1] = data[position + 1];
|
||||
sector.dataField.prologue[2] = data[position + 2];
|
||||
position += 3;
|
||||
sector.dataField.prologue = new byte[3];
|
||||
sector.dataField.prologue[0] = data[position];
|
||||
sector.dataField.prologue[1] = data[position + 1];
|
||||
sector.dataField.prologue[2] = data[position + 2];
|
||||
position += 3;
|
||||
|
||||
gaps = new MemoryStream();
|
||||
// Read data until epilogue is found
|
||||
@@ -405,14 +416,14 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
sector.dataField.data = gaps.ToArray();
|
||||
DicConsole.DebugWriteLine("Apple ][ GCR Decoder", "Data has {0} bytes",
|
||||
sector.dataField.data.Length);
|
||||
sector.dataField.checksum = data[position];
|
||||
sector.dataField.epilogue = new byte[3];
|
||||
sector.dataField.checksum = data[position];
|
||||
sector.dataField.epilogue = new byte[3];
|
||||
sector.dataField.epilogue[0] = data[position + 1];
|
||||
sector.dataField.epilogue[1] = data[position + 2];
|
||||
sector.dataField.epilogue[2] = data[position + 3];
|
||||
|
||||
position += 4;
|
||||
gaps = new MemoryStream();
|
||||
gaps = new MemoryStream();
|
||||
// Read gap, if any
|
||||
while(position < data.Length && data[position] == 0xFF)
|
||||
{
|
||||
@@ -430,7 +441,7 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
sector.gap = gaps.ToArray();
|
||||
// Return current position to be able to read separate sectors
|
||||
endOffset = position;
|
||||
DicConsole.DebugWriteLine("Apple ][ GCR Decoder", "Got {0} bytes of gap", sector.gap.Length);
|
||||
DicConsole.DebugWriteLine("Apple ][ GCR Decoder", "Got {0} bytes of gap", sector.gap.Length);
|
||||
DicConsole.DebugWriteLine("Apple ][ GCR Decoder", "Finished sector at {0}", position);
|
||||
return sector;
|
||||
}
|
||||
@@ -451,9 +462,9 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
|
||||
MemoryStream raw = new MemoryStream();
|
||||
raw.Write(addressField.prologue, 0, addressField.prologue.Length);
|
||||
raw.Write(addressField.volume, 0, addressField.volume.Length);
|
||||
raw.Write(addressField.track, 0, addressField.track.Length);
|
||||
raw.Write(addressField.sector, 0, addressField.sector.Length);
|
||||
raw.Write(addressField.volume, 0, addressField.volume.Length);
|
||||
raw.Write(addressField.track, 0, addressField.track.Length);
|
||||
raw.Write(addressField.sector, 0, addressField.sector.Length);
|
||||
raw.Write(addressField.checksum, 0, addressField.checksum.Length);
|
||||
raw.Write(addressField.epilogue, 0, addressField.epilogue.Length);
|
||||
|
||||
@@ -466,17 +477,17 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
|
||||
MemoryStream raw = new MemoryStream();
|
||||
raw.Write(sector.addressField.prologue, 0, sector.addressField.prologue.Length);
|
||||
raw.Write(sector.addressField.volume, 0, sector.addressField.volume.Length);
|
||||
raw.Write(sector.addressField.track, 0, sector.addressField.track.Length);
|
||||
raw.Write(sector.addressField.sector, 0, sector.addressField.sector.Length);
|
||||
raw.Write(sector.addressField.volume, 0, sector.addressField.volume.Length);
|
||||
raw.Write(sector.addressField.track, 0, sector.addressField.track.Length);
|
||||
raw.Write(sector.addressField.sector, 0, sector.addressField.sector.Length);
|
||||
raw.Write(sector.addressField.checksum, 0, sector.addressField.checksum.Length);
|
||||
raw.Write(sector.addressField.epilogue, 0, sector.addressField.epilogue.Length);
|
||||
raw.Write(sector.innerGap, 0, sector.innerGap.Length);
|
||||
raw.Write(sector.dataField.prologue, 0, sector.dataField.prologue.Length);
|
||||
raw.Write(sector.dataField.data, 0, sector.dataField.data.Length);
|
||||
raw.Write(sector.innerGap, 0, sector.innerGap.Length);
|
||||
raw.Write(sector.dataField.prologue, 0, sector.dataField.prologue.Length);
|
||||
raw.Write(sector.dataField.data, 0, sector.dataField.data.Length);
|
||||
raw.WriteByte(sector.dataField.checksum);
|
||||
raw.Write(sector.dataField.epilogue, 0, sector.dataField.epilogue.Length);
|
||||
raw.Write(sector.gap, 0, sector.gap.Length);
|
||||
raw.Write(sector.gap, 0, sector.gap.Length);
|
||||
|
||||
return raw.ToArray();
|
||||
}
|
||||
@@ -488,13 +499,13 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
|
||||
public static RawTrack MarshalTrack(byte[] data, out int endOffset, int offset = 0)
|
||||
{
|
||||
int position = offset;
|
||||
bool firstSector = true;
|
||||
bool onSync = false;
|
||||
MemoryStream gaps = new MemoryStream();
|
||||
int count = 0;
|
||||
List<RawSector> sectors = new List<RawSector>();
|
||||
byte[] trackNumber = new byte[2];
|
||||
int position = offset;
|
||||
bool firstSector = true;
|
||||
bool onSync = false;
|
||||
MemoryStream gaps = new MemoryStream();
|
||||
int count = 0;
|
||||
List<RawSector> sectors = new List<RawSector>();
|
||||
byte[] trackNumber = new byte[2];
|
||||
endOffset = offset;
|
||||
|
||||
while(position < data.Length && data[position] == 0xFF)
|
||||
@@ -511,15 +522,15 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
|
||||
while(position < data.Length)
|
||||
{
|
||||
int oldPosition = position;
|
||||
RawSector sector = MarshalSector(data, out position, position);
|
||||
int oldPosition = position;
|
||||
RawSector sector = MarshalSector(data, out position, position);
|
||||
if(sector == null) break;
|
||||
|
||||
if(firstSector)
|
||||
{
|
||||
trackNumber[0] = sector.addressField.track[0];
|
||||
trackNumber[1] = sector.addressField.track[1];
|
||||
firstSector = false;
|
||||
firstSector = false;
|
||||
}
|
||||
|
||||
if(sector.addressField.track[0] != trackNumber[0] || sector.addressField.track[1] != trackNumber[1])
|
||||
@@ -562,8 +573,8 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
public static List<RawTrack> MarshalDisk(byte[] data, out int endOffset, int offset = 0)
|
||||
{
|
||||
endOffset = offset;
|
||||
List<RawTrack> tracks = new List<RawTrack>();
|
||||
int position = offset;
|
||||
List<RawTrack> tracks = new List<RawTrack>();
|
||||
int position = offset;
|
||||
|
||||
RawTrack track = MarshalTrack(data, out position, position);
|
||||
while(track != null)
|
||||
|
||||
@@ -98,7 +98,8 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
/// <summary>
|
||||
/// Always 0xDE, 0xAA
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] epilogue;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
|
||||
public byte[] epilogue;
|
||||
/// <summary>
|
||||
/// Disk format
|
||||
/// </summary>
|
||||
@@ -106,7 +107,8 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
/// <summary>
|
||||
/// Always 0xD5, 0xAA, 0x96
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] prologue;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
||||
public byte[] prologue;
|
||||
/// <summary>
|
||||
/// Encoded sector number
|
||||
/// </summary>
|
||||
@@ -129,19 +131,23 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
/// <summary>
|
||||
/// Checksum
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] checksum;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
|
||||
public byte[] checksum;
|
||||
/// <summary>
|
||||
/// Encoded data bytes.
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 698)] public byte[] data;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 698)]
|
||||
public byte[] data;
|
||||
/// <summary>
|
||||
/// Always 0xDE, 0xAA
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] epilogue;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
|
||||
public byte[] epilogue;
|
||||
/// <summary>
|
||||
/// Always 0xD5, 0xAA, 0xAD
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] prologue;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
||||
public byte[] prologue;
|
||||
/// <summary>
|
||||
/// Spare, usually <see cref="RawAddressField.sector" />
|
||||
/// </summary>
|
||||
@@ -153,13 +159,13 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
if(sector.addressField.prologue[0] != 0xD5 || sector.addressField.prologue[1] != 0xAA ||
|
||||
sector.addressField.prologue[2] != 0x96) return null;
|
||||
|
||||
byte[] bf1 = new byte[175];
|
||||
byte[] bf2 = new byte[175];
|
||||
byte[] bf3 = new byte[175];
|
||||
byte[] nib_data = sector.dataField.data;
|
||||
MemoryStream ms = new MemoryStream();
|
||||
byte[] bf1 = new byte[175];
|
||||
byte[] bf2 = new byte[175];
|
||||
byte[] bf3 = new byte[175];
|
||||
byte[] nib_data = sector.dataField.data;
|
||||
MemoryStream ms = new MemoryStream();
|
||||
|
||||
int j = 0;
|
||||
int j = 0;
|
||||
byte w3 = 0;
|
||||
for(int i = 0; i <= 174; i++)
|
||||
{
|
||||
@@ -190,26 +196,29 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
ck3++;
|
||||
ck1 &= 0xFF;
|
||||
}
|
||||
|
||||
ms.WriteByte(carry);
|
||||
|
||||
carry = (byte)((bf2[j] ^ ck3) & 0xFF);
|
||||
ck2 += carry;
|
||||
carry = (byte)((bf2[j] ^ ck3) & 0xFF);
|
||||
ck2 += carry;
|
||||
if(ck3 > 0xFF)
|
||||
{
|
||||
ck2++;
|
||||
ck3 &= 0xFF;
|
||||
}
|
||||
|
||||
ms.WriteByte(carry);
|
||||
|
||||
if(ms.Length == 524) break;
|
||||
|
||||
carry = (byte)((bf3[j] ^ ck2) & 0xFF);
|
||||
ck1 += carry;
|
||||
carry = (byte)((bf3[j] ^ ck2) & 0xFF);
|
||||
ck1 += carry;
|
||||
if(ck2 > 0xFF)
|
||||
{
|
||||
ck1++;
|
||||
ck2 &= 0xFF;
|
||||
}
|
||||
|
||||
ms.WriteByte(carry);
|
||||
j++;
|
||||
}
|
||||
@@ -248,19 +257,19 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
addressField = new RawAddressField
|
||||
{
|
||||
prologue = new[] {data[position], data[position + 1], data[position + 2]},
|
||||
track = data[position + 3],
|
||||
sector = data[position + 4],
|
||||
side = data[position + 5],
|
||||
format = (AppleEncodedFormat)data[position + 6],
|
||||
track = data[position + 3],
|
||||
sector = data[position + 4],
|
||||
side = data[position + 5],
|
||||
format = (AppleEncodedFormat)data[position + 6],
|
||||
checksum = data[position + 7],
|
||||
epilogue = new[] {data[position + 8], data[position + 9]}
|
||||
}
|
||||
};
|
||||
|
||||
position += 10;
|
||||
int syncCount = 0;
|
||||
bool onSync = false;
|
||||
MemoryStream gaps = new MemoryStream();
|
||||
int syncCount = 0;
|
||||
bool onSync = false;
|
||||
MemoryStream gaps = new MemoryStream();
|
||||
|
||||
while(data[position] == 0xFF)
|
||||
{
|
||||
@@ -281,7 +290,7 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
sector.dataField = new RawDataField
|
||||
{
|
||||
prologue = new[] {data[position], data[position + 1], data[position + 2]},
|
||||
spare = data[position + 3]
|
||||
spare = data[position + 3]
|
||||
};
|
||||
position += 4;
|
||||
|
||||
@@ -296,18 +305,18 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
if(position + 7 > data.Length) return null;
|
||||
}
|
||||
|
||||
sector.dataField.data = gaps.ToArray();
|
||||
sector.dataField.checksum = new byte[4];
|
||||
sector.dataField.data = gaps.ToArray();
|
||||
sector.dataField.checksum = new byte[4];
|
||||
sector.dataField.checksum[0] = data[position];
|
||||
sector.dataField.checksum[1] = data[position + 2];
|
||||
sector.dataField.checksum[2] = data[position + 3];
|
||||
sector.dataField.checksum[3] = data[position + 4];
|
||||
sector.dataField.epilogue = new byte[2];
|
||||
sector.dataField.epilogue = new byte[2];
|
||||
sector.dataField.epilogue[0] = data[position + 5];
|
||||
sector.dataField.epilogue[1] = data[position + 6];
|
||||
|
||||
position += 7;
|
||||
gaps = new MemoryStream();
|
||||
gaps = new MemoryStream();
|
||||
// Read gap, if any
|
||||
while(position < data.Length && data[position] == 0xFF)
|
||||
{
|
||||
@@ -364,13 +373,13 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
raw.WriteByte(sector.addressField.side);
|
||||
raw.WriteByte((byte)sector.addressField.format);
|
||||
raw.WriteByte(sector.addressField.checksum);
|
||||
raw.Write(sector.innerGap, 0, sector.innerGap.Length);
|
||||
raw.Write(sector.innerGap, 0, sector.innerGap.Length);
|
||||
raw.Write(sector.dataField.prologue, 0, sector.dataField.prologue.Length);
|
||||
raw.WriteByte(sector.dataField.spare);
|
||||
raw.Write(sector.dataField.data, 0, sector.dataField.data.Length);
|
||||
raw.Write(sector.dataField.data, 0, sector.dataField.data.Length);
|
||||
raw.Write(sector.dataField.checksum, 0, sector.dataField.checksum.Length);
|
||||
raw.Write(sector.dataField.epilogue, 0, sector.dataField.epilogue.Length);
|
||||
raw.Write(sector.gap, 0, sector.gap.Length);
|
||||
raw.Write(sector.gap, 0, sector.gap.Length);
|
||||
|
||||
return raw.ToArray();
|
||||
}
|
||||
@@ -382,14 +391,14 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
|
||||
public static RawTrack MarshalTrack(byte[] data, out int endOffset, int offset = 0)
|
||||
{
|
||||
int position = offset;
|
||||
bool firstSector = true;
|
||||
bool onSync = false;
|
||||
MemoryStream gaps = new MemoryStream();
|
||||
int count = 0;
|
||||
List<RawSector> sectors = new List<RawSector>();
|
||||
byte trackNumber = 0;
|
||||
byte sideNumber = 0;
|
||||
int position = offset;
|
||||
bool firstSector = true;
|
||||
bool onSync = false;
|
||||
MemoryStream gaps = new MemoryStream();
|
||||
int count = 0;
|
||||
List<RawSector> sectors = new List<RawSector>();
|
||||
byte trackNumber = 0;
|
||||
byte sideNumber = 0;
|
||||
endOffset = offset;
|
||||
|
||||
while(position < data.Length && data[position] == 0xFF)
|
||||
@@ -406,14 +415,14 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
|
||||
while(position < data.Length)
|
||||
{
|
||||
int oldPosition = position;
|
||||
RawSector sector = MarshalSector(data, out position, position);
|
||||
int oldPosition = position;
|
||||
RawSector sector = MarshalSector(data, out position, position);
|
||||
if(sector == null) break;
|
||||
|
||||
if(firstSector)
|
||||
{
|
||||
trackNumber = sector.addressField.track;
|
||||
sideNumber = sector.addressField.side;
|
||||
sideNumber = sector.addressField.side;
|
||||
firstSector = false;
|
||||
}
|
||||
|
||||
@@ -452,8 +461,8 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
public static List<RawTrack> MarshalDisk(byte[] data, out int endOffset, int offset = 0)
|
||||
{
|
||||
endOffset = offset;
|
||||
List<RawTrack> tracks = new List<RawTrack>();
|
||||
int position = offset;
|
||||
List<RawTrack> tracks = new List<RawTrack>();
|
||||
int position = offset;
|
||||
|
||||
RawTrack track = MarshalTrack(data, out position, position);
|
||||
while(track != null)
|
||||
|
||||
@@ -86,7 +86,8 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
/// <summary>
|
||||
/// User data
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public byte data;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)]
|
||||
public byte data;
|
||||
/// <summary>
|
||||
/// XOR of <see cref="data" />
|
||||
/// </summary>
|
||||
|
||||
@@ -77,9 +77,9 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum IBMIdType : byte
|
||||
{
|
||||
IndexMark = 0xFC,
|
||||
AddressMark = 0xFE,
|
||||
DataMark = 0xFB,
|
||||
IndexMark = 0xFC,
|
||||
AddressMark = 0xFE,
|
||||
DataMark = 0xFB,
|
||||
DeletedDataMark = 0xF8
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,8 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
/// <summary>
|
||||
/// Start of track, 32 bytes set to 0x4E
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] innerGap;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
|
||||
public byte[] innerGap;
|
||||
/// <summary>
|
||||
/// Track sectors
|
||||
/// </summary>
|
||||
@@ -84,7 +85,8 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
/// <summary>
|
||||
/// 22 bytes set to 0x4E, set to 0x22 on Commodore 1581
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 22)] public byte[] innerGap;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 22)]
|
||||
public byte[] innerGap;
|
||||
/// <summary>
|
||||
/// Sector data block
|
||||
/// </summary>
|
||||
@@ -103,11 +105,13 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
/// <summary>
|
||||
/// 12 bytes set to 0
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] zero;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
|
||||
public byte[] zero;
|
||||
/// <summary>
|
||||
/// 3 bytes set to 0xA1
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] aone;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
||||
public byte[] aone;
|
||||
/// <summary>
|
||||
/// Set to <see cref="IBMIdType.AddressMark" />
|
||||
/// </summary>
|
||||
@@ -142,11 +146,13 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
/// <summary>
|
||||
/// 12 bytes set to 0
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] zero;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
|
||||
public byte[] zero;
|
||||
/// <summary>
|
||||
/// 3 bytes set to 0xA1
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] aone;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
||||
public byte[] aone;
|
||||
/// <summary>
|
||||
/// Set to <see cref="IBMIdType.DataMark" /> or to <see cref="IBMIdType.DeletedDataMark" />
|
||||
/// </summary>
|
||||
|
||||
@@ -84,7 +84,8 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
/// <summary>
|
||||
/// 41 bytes set to 0x4E
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 41)] public byte[] innerGap;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 41)]
|
||||
public byte[] innerGap;
|
||||
/// <summary>
|
||||
/// Sector data block
|
||||
/// </summary>
|
||||
@@ -104,15 +105,18 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
/// <summary>
|
||||
/// Gap from index pulse, 80 bytes set to 0x4E
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 80)] public byte[] gap;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 80)]
|
||||
public byte[] gap;
|
||||
/// <summary>
|
||||
/// 12 bytes set to 0x00
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] zero;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
|
||||
public byte[] zero;
|
||||
/// <summary>
|
||||
/// 3 bytes set to 0xC2
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] ctwo;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
||||
public byte[] ctwo;
|
||||
/// <summary>
|
||||
/// Set to <see cref="IBMIdType.IndexMark" />
|
||||
/// </summary>
|
||||
@@ -120,7 +124,8 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
/// <summary>
|
||||
/// Gap until first sector, 50 bytes to 0x4E
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 50)] public byte[] gap1;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 50)]
|
||||
public byte[] gap1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -131,11 +136,13 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
/// <summary>
|
||||
/// 12 bytes set to 0
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] zero;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
|
||||
public byte[] zero;
|
||||
/// <summary>
|
||||
/// 3 bytes set to 0xA1
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] aone;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
||||
public byte[] aone;
|
||||
/// <summary>
|
||||
/// Set to <see cref="IBMIdType.AddressMark" />
|
||||
/// </summary>
|
||||
@@ -170,11 +177,13 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
/// <summary>
|
||||
/// 12 bytes set to 0
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] zero;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
|
||||
public byte[] zero;
|
||||
/// <summary>
|
||||
/// 3 bytes set to 0xA1
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] aone;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
||||
public byte[] aone;
|
||||
/// <summary>
|
||||
/// Set to <see cref="IBMIdType.DataMark" /> or to <see cref="IBMIdType.DeletedDataMark" />
|
||||
/// </summary>
|
||||
|
||||
@@ -82,15 +82,18 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
/// <summary>
|
||||
/// Gap from index pulse, 80 bytes set to 0x4E
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 80)] public byte[] gap;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 80)]
|
||||
public byte[] gap;
|
||||
/// <summary>
|
||||
/// 12 bytes set to 0x00
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] zero;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
|
||||
public byte[] zero;
|
||||
/// <summary>
|
||||
/// 3 bytes set to 0xC2
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] ctwo;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
||||
public byte[] ctwo;
|
||||
/// <summary>
|
||||
/// Set to <see cref="IBMIdType.IndexMark" />
|
||||
/// </summary>
|
||||
@@ -98,7 +101,8 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
/// <summary>
|
||||
/// Gap until first sector, 50 bytes to 0x4E
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 50)] public byte[] gap1;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 50)]
|
||||
public byte[] gap1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -113,7 +117,8 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
/// <summary>
|
||||
/// 22 bytes set to 0x4E, set to 0x22 on Commodore 1581
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 22)] public byte[] innerGap;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 22)]
|
||||
public byte[] innerGap;
|
||||
/// <summary>
|
||||
/// Sector data block
|
||||
/// </summary>
|
||||
@@ -132,11 +137,13 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
/// <summary>
|
||||
/// 12 bytes set to 0
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] zero;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
|
||||
public byte[] zero;
|
||||
/// <summary>
|
||||
/// 3 bytes set to 0xA1
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] aone;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
||||
public byte[] aone;
|
||||
/// <summary>
|
||||
/// Set to <see cref="IBMIdType.AddressMark" />
|
||||
/// </summary>
|
||||
@@ -171,11 +178,13 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
/// <summary>
|
||||
/// 12 bytes set to 0
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] zero;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
|
||||
public byte[] zero;
|
||||
/// <summary>
|
||||
/// 3 bytes set to 0xA1
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] aone;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
||||
public byte[] aone;
|
||||
/// <summary>
|
||||
/// Set to <see cref="IBMIdType.DataMark" /> or to <see cref="IBMIdType.DeletedDataMark" />
|
||||
/// </summary>
|
||||
|
||||
@@ -80,11 +80,13 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
/// <summary>
|
||||
/// Gap from index pulse, 80 bytes set to 0xFF
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 40)] public byte[] gap;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 40)]
|
||||
public byte[] gap;
|
||||
/// <summary>
|
||||
/// 6 bytes set to 0x00
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] zero;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
|
||||
public byte[] zero;
|
||||
/// <summary>
|
||||
/// Set to <see cref="IBMIdType.IndexMark" />
|
||||
/// </summary>
|
||||
@@ -92,7 +94,8 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
/// <summary>
|
||||
/// Gap until first sector, 26 bytes to 0xFF
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 26)] public byte[] gap1;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 26)]
|
||||
public byte[] gap1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -107,7 +110,8 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
/// <summary>
|
||||
/// 11 bytes set to 0xFF
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] public byte[] innerGap;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)]
|
||||
public byte[] innerGap;
|
||||
/// <summary>
|
||||
/// Sector data block
|
||||
/// </summary>
|
||||
@@ -126,7 +130,8 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
/// <summary>
|
||||
/// 6 bytes set to 0
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] zero;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
|
||||
public byte[] zero;
|
||||
/// <summary>
|
||||
/// Set to <see cref="IBMIdType.AddressMark" />
|
||||
/// </summary>
|
||||
@@ -161,7 +166,8 @@ namespace DiscImageChef.Decoders.Floppy
|
||||
/// <summary>
|
||||
/// 12 bytes set to 0
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] zero;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
|
||||
public byte[] zero;
|
||||
/// <summary>
|
||||
/// Set to <see cref="IBMIdType.DataMark" /> or to <see cref="IBMIdType.DeletedDataMark" />
|
||||
/// </summary>
|
||||
|
||||
@@ -149,7 +149,7 @@ namespace DiscImageChef.Decoders
|
||||
tmp = BigEndianBitConverter.GetBytes((ushort)(UsedBytes & 0x7FFF));
|
||||
Array.Copy(tmp, 0, tagBytes, 6, 2);
|
||||
if(ValidChk) tagBytes[6] += 0x80;
|
||||
tmp = BigEndianBitConverter.GetBytes(AbsPage);
|
||||
tmp = BigEndianBitConverter.GetBytes(AbsPage);
|
||||
Array.Copy(tmp, 1, tagBytes, 8, 3);
|
||||
tagBytes[11] = Checksum;
|
||||
tmp = BigEndianBitConverter.GetBytes(RelPage);
|
||||
@@ -276,7 +276,7 @@ namespace DiscImageChef.Decoders
|
||||
tmp = BigEndianBitConverter.GetBytes((ushort)(UsedBytes & 0x7FFF));
|
||||
Array.Copy(tmp, 0, tagBytes, 6, 2);
|
||||
if(ValidChk) tagBytes[6] += 0x80;
|
||||
tmp = BigEndianBitConverter.GetBytes(AbsPage);
|
||||
tmp = BigEndianBitConverter.GetBytes(AbsPage);
|
||||
Array.Copy(tmp, 1, tagBytes, 8, 3);
|
||||
tagBytes[11] = Checksum;
|
||||
tmp = BigEndianBitConverter.GetBytes(RelPage);
|
||||
@@ -399,10 +399,10 @@ namespace DiscImageChef.Decoders
|
||||
|
||||
snTag.Version = BigEndianBitConverter.ToUInt16(tag, 0);
|
||||
snTag.Kind = (byte)((tag[2] & 0xC0) >> 6);
|
||||
snTag.Reserved = (byte)(tag[2] & 0x3F);
|
||||
snTag.Reserved = (byte)(tag[2] & 0x3F);
|
||||
snTag.Volume = tag[3];
|
||||
snTag.FileId = BigEndianBitConverter.ToInt16(tag, 4);
|
||||
snTag.RelPage = BigEndianBitConverter.ToUInt16(tag, 6);
|
||||
snTag.RelPage = BigEndianBitConverter.ToUInt16(tag, 6);
|
||||
snTag.NextBlock = (ushort)(BigEndianBitConverter.ToUInt16(tag, 8) & 0x7FF);
|
||||
snTag.PrevBlock = (ushort)(BigEndianBitConverter.ToUInt16(tag, 10) & 0x7FF);
|
||||
|
||||
@@ -424,7 +424,7 @@ namespace DiscImageChef.Decoders
|
||||
|
||||
phTag.Version = BigEndianBitConverter.ToUInt16(tag, 0);
|
||||
phTag.Kind = (byte)((tag[2] & 0xC0) >> 6);
|
||||
phTag.Reserved = (byte)(tag[2] & 0x3F);
|
||||
phTag.Reserved = (byte)(tag[2] & 0x3F);
|
||||
phTag.Volume = tag[3];
|
||||
phTag.FileId = BigEndianBitConverter.ToInt16(tag, 4);
|
||||
phTag.ValidChk |= (tag[6] & 0x80) == 0x80;
|
||||
@@ -469,7 +469,7 @@ namespace DiscImageChef.Decoders
|
||||
|
||||
pmTag.Version = BigEndianBitConverter.ToUInt16(tag, 0);
|
||||
pmTag.Kind = (byte)((tag[2] & 0xC0) >> 6);
|
||||
pmTag.Reserved = (byte)(tag[2] & 0x3F);
|
||||
pmTag.Reserved = (byte)(tag[2] & 0x3F);
|
||||
pmTag.Volume = tag[3];
|
||||
pmTag.FileId = BigEndianBitConverter.ToInt16(tag, 4);
|
||||
pmTag.ValidChk |= (tag[6] & 0x80) == 0x80;
|
||||
|
||||
@@ -42,14 +42,14 @@ namespace DiscImageChef.Decoders.MMC
|
||||
[SuppressMessage("ReSharper", "UnassignedField.Global")]
|
||||
public class CID
|
||||
{
|
||||
public byte Manufacturer;
|
||||
public byte DeviceType;
|
||||
public byte ApplicationID;
|
||||
public byte Manufacturer;
|
||||
public byte DeviceType;
|
||||
public byte ApplicationID;
|
||||
public string ProductName;
|
||||
public byte ProductRevision;
|
||||
public uint ProductSerialNumber;
|
||||
public byte ManufacturingDate;
|
||||
public byte CRC;
|
||||
public byte ProductRevision;
|
||||
public uint ProductSerialNumber;
|
||||
public byte ManufacturingDate;
|
||||
public byte CRC;
|
||||
}
|
||||
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
@@ -81,12 +81,12 @@ namespace DiscImageChef.Decoders.MMC
|
||||
|
||||
CID cid = new CID
|
||||
{
|
||||
Manufacturer = response[0],
|
||||
DeviceType = (byte)(response[1] & 0x03),
|
||||
ProductRevision = response[9],
|
||||
Manufacturer = response[0],
|
||||
DeviceType = (byte)(response[1] & 0x03),
|
||||
ProductRevision = response[9],
|
||||
ProductSerialNumber = BitConverter.ToUInt32(response, 10),
|
||||
ManufacturingDate = response[14],
|
||||
CRC = (byte)((response[15] & 0xFE) >> 1)
|
||||
ManufacturingDate = response[14],
|
||||
CRC = (byte)((response[15] & 0xFE) >> 1)
|
||||
};
|
||||
byte[] tmp = new byte[6];
|
||||
Array.Copy(response, 3, tmp, 0, 6);
|
||||
|
||||
@@ -42,39 +42,39 @@ namespace DiscImageChef.Decoders.MMC
|
||||
[SuppressMessage("ReSharper", "NotAccessedField.Global")]
|
||||
public class CSD
|
||||
{
|
||||
public byte Structure;
|
||||
public byte Version;
|
||||
public byte TAAC;
|
||||
public byte NSAC;
|
||||
public byte Speed;
|
||||
public byte Structure;
|
||||
public byte Version;
|
||||
public byte TAAC;
|
||||
public byte NSAC;
|
||||
public byte Speed;
|
||||
public ushort Classes;
|
||||
public byte ReadBlockLength;
|
||||
public bool ReadsPartialBlocks;
|
||||
public bool WriteMisalignment;
|
||||
public bool ReadMisalignment;
|
||||
public bool DSRImplemented;
|
||||
public byte ReadBlockLength;
|
||||
public bool ReadsPartialBlocks;
|
||||
public bool WriteMisalignment;
|
||||
public bool ReadMisalignment;
|
||||
public bool DSRImplemented;
|
||||
public ushort Size;
|
||||
public byte ReadCurrentAtVddMin;
|
||||
public byte ReadCurrentAtVddMax;
|
||||
public byte WriteCurrentAtVddMin;
|
||||
public byte WriteCurrentAtVddMax;
|
||||
public byte SizeMultiplier;
|
||||
public byte EraseGroupSize;
|
||||
public byte EraseGroupSizeMultiplier;
|
||||
public byte WriteProtectGroupSize;
|
||||
public bool WriteProtectGroupEnable;
|
||||
public byte DefaultECC;
|
||||
public byte WriteSpeedFactor;
|
||||
public byte WriteBlockLength;
|
||||
public bool WritesPartialBlocks;
|
||||
public bool ContentProtection;
|
||||
public bool FileFormatGroup;
|
||||
public bool Copy;
|
||||
public bool PermanentWriteProtect;
|
||||
public bool TemporaryWriteProtect;
|
||||
public byte FileFormat;
|
||||
public byte ECC;
|
||||
public byte CRC;
|
||||
public byte ReadCurrentAtVddMin;
|
||||
public byte ReadCurrentAtVddMax;
|
||||
public byte WriteCurrentAtVddMin;
|
||||
public byte WriteCurrentAtVddMax;
|
||||
public byte SizeMultiplier;
|
||||
public byte EraseGroupSize;
|
||||
public byte EraseGroupSizeMultiplier;
|
||||
public byte WriteProtectGroupSize;
|
||||
public bool WriteProtectGroupEnable;
|
||||
public byte DefaultECC;
|
||||
public byte WriteSpeedFactor;
|
||||
public byte WriteBlockLength;
|
||||
public bool WritesPartialBlocks;
|
||||
public bool ContentProtection;
|
||||
public bool FileFormatGroup;
|
||||
public bool Copy;
|
||||
public bool PermanentWriteProtect;
|
||||
public bool TemporaryWriteProtect;
|
||||
public byte FileFormat;
|
||||
public byte ECC;
|
||||
public byte CRC;
|
||||
}
|
||||
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
@@ -106,39 +106,40 @@ namespace DiscImageChef.Decoders.MMC
|
||||
|
||||
return new CSD
|
||||
{
|
||||
Structure = (byte)((response[0] & 0xC0) >> 6),
|
||||
Version = (byte)((response[0] & 0x3C) >> 2),
|
||||
TAAC = response[1],
|
||||
NSAC = response[2],
|
||||
Speed = response[3],
|
||||
Classes = (ushort)((response[4] << 4) + ((response[5] & 0xF0) >> 4)),
|
||||
ReadBlockLength = (byte)(response[5] & 0x0F),
|
||||
ReadsPartialBlocks = (response[6] & 0x80) == 0x80,
|
||||
WriteMisalignment = (response[6] & 0x40) == 0x40,
|
||||
ReadMisalignment = (response[6] & 0x20) == 0x20,
|
||||
DSRImplemented = (response[6] & 0x10) == 0x10,
|
||||
Size = (ushort)(((response[6] & 0x03) << 10) + (response[7] << 2) + ((response[8] & 0xC0) >> 6)),
|
||||
ReadCurrentAtVddMin = (byte)((response[8] & 0x38) >> 3),
|
||||
ReadCurrentAtVddMax = (byte)(response[8] & 0x07),
|
||||
WriteCurrentAtVddMin = (byte)((response[9] & 0xE0) >> 5),
|
||||
WriteCurrentAtVddMax = (byte)((response[9] & 0x1C) >> 2),
|
||||
SizeMultiplier = (byte)(((response[9] & 0x03) << 1) + ((response[10] & 0x80) >> 7)),
|
||||
EraseGroupSize = (byte)((response[10] & 0x7C) >> 2),
|
||||
Structure = (byte)((response[0] & 0xC0) >> 6),
|
||||
Version = (byte)((response[0] & 0x3C) >> 2),
|
||||
TAAC = response[1],
|
||||
NSAC = response[2],
|
||||
Speed = response[3],
|
||||
Classes = (ushort)((response[4] << 4) + ((response[5] & 0xF0) >> 4)),
|
||||
ReadBlockLength = (byte)(response[5] & 0x0F),
|
||||
ReadsPartialBlocks = (response[6] & 0x80) == 0x80,
|
||||
WriteMisalignment = (response[6] & 0x40) == 0x40,
|
||||
ReadMisalignment = (response[6] & 0x20) == 0x20,
|
||||
DSRImplemented = (response[6] & 0x10) == 0x10,
|
||||
Size =
|
||||
(ushort)(((response[6] & 0x03) << 10) + (response[7] << 2) + ((response[8] & 0xC0) >> 6)),
|
||||
ReadCurrentAtVddMin = (byte)((response[8] & 0x38) >> 3),
|
||||
ReadCurrentAtVddMax = (byte)(response[8] & 0x07),
|
||||
WriteCurrentAtVddMin = (byte)((response[9] & 0xE0) >> 5),
|
||||
WriteCurrentAtVddMax = (byte)((response[9] & 0x1C) >> 2),
|
||||
SizeMultiplier = (byte)(((response[9] & 0x03) << 1) + ((response[10] & 0x80) >> 7)),
|
||||
EraseGroupSize = (byte)((response[10] & 0x7C) >> 2),
|
||||
EraseGroupSizeMultiplier = (byte)(((response[10] & 0x03) << 3) + ((response[11] & 0xE0) >> 5)),
|
||||
WriteProtectGroupSize = (byte)(response[11] & 0x1F),
|
||||
WriteProtectGroupEnable = (response[12] & 0x80) == 0x80,
|
||||
DefaultECC = (byte)((response[12] & 0x60) >> 5),
|
||||
WriteSpeedFactor = (byte)((response[12] & 0x1C) >> 2),
|
||||
WriteBlockLength = (byte)(((response[12] & 0x03) << 2) + ((response[13] & 0xC0) >> 6)),
|
||||
WritesPartialBlocks = (response[13] & 0x20) == 0x20,
|
||||
ContentProtection = (response[13] & 0x01) == 0x01,
|
||||
FileFormatGroup = (response[14] & 0x80) == 0x80,
|
||||
Copy = (response[14] & 0x40) == 0x40,
|
||||
PermanentWriteProtect = (response[14] & 0x20) == 0x20,
|
||||
TemporaryWriteProtect = (response[14] & 0x10) == 0x10,
|
||||
FileFormat = (byte)((response[14] & 0x0C) >> 2),
|
||||
ECC = (byte)(response[14] & 0x03),
|
||||
CRC = (byte)((response[15] & 0xFE) >> 1)
|
||||
WriteProtectGroupSize = (byte)(response[11] & 0x1F),
|
||||
WriteProtectGroupEnable = (response[12] & 0x80) == 0x80,
|
||||
DefaultECC = (byte)((response[12] & 0x60) >> 5),
|
||||
WriteSpeedFactor = (byte)((response[12] & 0x1C) >> 2),
|
||||
WriteBlockLength = (byte)(((response[12] & 0x03) << 2) + ((response[13] & 0xC0) >> 6)),
|
||||
WritesPartialBlocks = (response[13] & 0x20) == 0x20,
|
||||
ContentProtection = (response[13] & 0x01) == 0x01,
|
||||
FileFormatGroup = (response[14] & 0x80) == 0x80,
|
||||
Copy = (response[14] & 0x40) == 0x40,
|
||||
PermanentWriteProtect = (response[14] & 0x20) == 0x20,
|
||||
TemporaryWriteProtect = (response[14] & 0x10) == 0x10,
|
||||
FileFormat = (byte)((response[14] & 0x0C) >> 2),
|
||||
ECC = (byte)(response[14] & 0x03),
|
||||
CRC = (byte)((response[15] & 0xFE) >> 1)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -148,7 +149,7 @@ namespace DiscImageChef.Decoders.MMC
|
||||
|
||||
double unitFactor = 0;
|
||||
double multiplier = 0;
|
||||
string unit = "";
|
||||
string unit = "";
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine("MultiMediaCard Device Specific Data Register:");
|
||||
@@ -171,35 +172,35 @@ namespace DiscImageChef.Decoders.MMC
|
||||
switch(csd.TAAC & 0x07)
|
||||
{
|
||||
case 0:
|
||||
unit = "ns";
|
||||
unit = "ns";
|
||||
unitFactor = 1;
|
||||
break;
|
||||
case 1:
|
||||
unit = "ns";
|
||||
unit = "ns";
|
||||
unitFactor = 10;
|
||||
break;
|
||||
case 2:
|
||||
unit = "ns";
|
||||
unit = "ns";
|
||||
unitFactor = 100;
|
||||
break;
|
||||
case 3:
|
||||
unit = "μs";
|
||||
unit = "μs";
|
||||
unitFactor = 1;
|
||||
break;
|
||||
case 4:
|
||||
unit = "μs";
|
||||
unit = "μs";
|
||||
unitFactor = 10;
|
||||
break;
|
||||
case 5:
|
||||
unit = "μs";
|
||||
unit = "μs";
|
||||
unitFactor = 100;
|
||||
break;
|
||||
case 6:
|
||||
unit = "ms";
|
||||
unit = "ms";
|
||||
unitFactor = 1;
|
||||
break;
|
||||
case 7:
|
||||
unit = "ms";
|
||||
unit = "ms";
|
||||
unitFactor = 10;
|
||||
break;
|
||||
}
|
||||
@@ -277,7 +278,7 @@ namespace DiscImageChef.Decoders.MMC
|
||||
unitFactor = 100;
|
||||
break;
|
||||
default:
|
||||
unit = "unknown";
|
||||
unit = "unknown";
|
||||
unitFactor = 0;
|
||||
break;
|
||||
}
|
||||
@@ -338,7 +339,9 @@ namespace DiscImageChef.Decoders.MMC
|
||||
sb.AppendFormat("\tDevice's clock frequency: {0}{1}", result, unit).AppendLine();
|
||||
|
||||
unit = "";
|
||||
for(int cl = 0, mask = 1; cl <= 11; cl++, mask <<= 1) if((csd.Classes & mask) == mask) unit += $" {cl}";
|
||||
for(int cl = 0, mask = 1; cl <= 11; cl++, mask <<= 1)
|
||||
if((csd.Classes & mask) == mask)
|
||||
unit += $" {cl}";
|
||||
|
||||
sb.AppendFormat("\tDevice support command classes {0}", unit).AppendLine();
|
||||
if(csd.ReadBlockLength == 15) sb.AppendLine("\tRead block length size is defined in extended CSD");
|
||||
@@ -358,7 +361,7 @@ namespace DiscImageChef.Decoders.MMC
|
||||
sb.AppendFormat("\tDevice has {0} blocks", (int)result).AppendLine();
|
||||
|
||||
result = (csd.Size + 1) * Math.Pow(2, csd.SizeMultiplier + 2) * Math.Pow(2, csd.ReadBlockLength);
|
||||
if(result > 1073741824) sb.AppendFormat("\tDevice has {0} GiB", result / 1073741824.0).AppendLine();
|
||||
if(result > 1073741824) sb.AppendFormat("\tDevice has {0} GiB", result / 1073741824.0).AppendLine();
|
||||
else if(result > 1048576) sb.AppendFormat("\tDevice has {0} MiB", result / 1048576.0).AppendLine();
|
||||
else if(result > 1024) sb.AppendFormat("\tDevice has {0} KiB", result / 1024.0).AppendLine();
|
||||
else sb.AppendFormat("\tDevice has {0} bytes", result).AppendLine();
|
||||
@@ -478,7 +481,7 @@ namespace DiscImageChef.Decoders.MMC
|
||||
// TODO: Check specification
|
||||
unitFactor = Convert.ToDouble(csd.EraseGroupSize);
|
||||
multiplier = Convert.ToDouble(csd.EraseGroupSizeMultiplier);
|
||||
result = (unitFactor + 1) * (multiplier + 1);
|
||||
result = (unitFactor + 1) * (multiplier + 1);
|
||||
sb.AppendFormat("\tDevice can erase a minimum of {0} blocks at a time", (int)result).AppendLine();
|
||||
|
||||
if(csd.WriteProtectGroupEnable)
|
||||
|
||||
@@ -44,7 +44,8 @@ namespace DiscImageChef.Decoders.MMC
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public class ExtendedCSD
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public byte[] Reserved0;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
|
||||
public byte[] Reserved0;
|
||||
public byte ExtendedSecurityCommandsError;
|
||||
public byte SupportedCommandSets;
|
||||
public byte HPIFeatures;
|
||||
@@ -62,144 +63,152 @@ namespace DiscImageChef.Decoders.MMC
|
||||
public byte OperationCodesTimeout;
|
||||
public uint FFUArgument;
|
||||
public byte BarrierSupport;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 177)] public byte[] Reserved1;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 177)]
|
||||
public byte[] Reserved1;
|
||||
public byte CMDQueuingSupport;
|
||||
public byte CMDQueuingDepth;
|
||||
public uint NumberofFWSectorsCorrectlyProgrammed;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] VendorHealthReport;
|
||||
public byte DeviceLifeEstimationTypeB;
|
||||
public byte DeviceLifeEstimationTypeA;
|
||||
public byte PreEOLInformation;
|
||||
public byte OptimalReadSize;
|
||||
public byte OptimalWriteSize;
|
||||
public byte OptimalTrimUnitSize;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
|
||||
public byte[] VendorHealthReport;
|
||||
public byte DeviceLifeEstimationTypeB;
|
||||
public byte DeviceLifeEstimationTypeA;
|
||||
public byte PreEOLInformation;
|
||||
public byte OptimalReadSize;
|
||||
public byte OptimalWriteSize;
|
||||
public byte OptimalTrimUnitSize;
|
||||
public ushort DeviceVersion;
|
||||
public ulong FirmwareVersion;
|
||||
public byte PowerClassDDR200;
|
||||
public uint CacheSize;
|
||||
public byte GenericCMD6Timeout;
|
||||
public byte PowerOffNotificationTimeout;
|
||||
public byte BackgroundOperationsStatus;
|
||||
public uint CorrectlyProgrammedSectors;
|
||||
public byte InitializationTimeAfterPartition;
|
||||
public byte CacheFlushingPolicy;
|
||||
public byte PowerClassDDR52;
|
||||
public byte PowerClassDDR52_195;
|
||||
public byte PowerClassDDR200_195;
|
||||
public byte PowerClassDDR200_130;
|
||||
public byte MinimumWritePerformanceDDR52;
|
||||
public byte MinimumReadPerformanceDDR52;
|
||||
public byte Reserved2;
|
||||
public byte TRIMMultiplier;
|
||||
public byte SecureFeatureSupport;
|
||||
public byte SecureEraseMultiplier;
|
||||
public byte SecureTRIMMultiplier;
|
||||
public byte BootInformation;
|
||||
public byte Reserved3;
|
||||
public byte BootPartitionSize;
|
||||
public byte AccessSize;
|
||||
public byte HighCapacityEraseUnitSize;
|
||||
public byte HighCapacityEraseTimeout;
|
||||
public byte ReliableWriteSectorCount;
|
||||
public byte HighCapacityWriteProtectGroupSize;
|
||||
public byte SleepCurrentVcc;
|
||||
public byte SleepCurrentVccq;
|
||||
public byte ProductionStateAwarenessTimeout;
|
||||
public byte SleepAwakeTimeout;
|
||||
public byte SleepNotificationTimeout;
|
||||
public uint SectorCount;
|
||||
public byte SecureWriteProtectInformation;
|
||||
public byte MinimumWritePerformance52;
|
||||
public byte MinimumReadPerformance52;
|
||||
public byte MinimumWritePerformance26;
|
||||
public byte MinimumReadPerformance26;
|
||||
public byte MinimumWritePerformance26_4;
|
||||
public byte MinimumReadPerformance26_4;
|
||||
public byte Reserved4;
|
||||
public byte PowerClass26;
|
||||
public byte PowerClass52;
|
||||
public byte PowerClass26_195;
|
||||
public byte PowerClass52_195;
|
||||
public byte PartitionSwitchingTime;
|
||||
public byte OutOfInterruptBusyTiming;
|
||||
public byte DriverStrength;
|
||||
public byte DeviceType;
|
||||
public byte Reserved5;
|
||||
public byte Structure;
|
||||
public byte Reserved6;
|
||||
public byte Revision;
|
||||
public byte CommandSet;
|
||||
public byte Reserved7;
|
||||
public byte CommandSetRevision;
|
||||
public byte Reserved8;
|
||||
public byte PowerClass;
|
||||
public byte Reserved9;
|
||||
public byte HighSpeedInterfaceTiming;
|
||||
public byte StrobeSupport;
|
||||
public byte BusWidth;
|
||||
public byte Reserved10;
|
||||
public byte ErasedMemoryContent;
|
||||
public byte Reserved11;
|
||||
public byte PartitionConfiguration;
|
||||
public byte BootConfigProtection;
|
||||
public byte BootBusConditions;
|
||||
public byte Reserved12;
|
||||
public byte HighDensityEraseGroupDefinition;
|
||||
public byte BootWriteProtectionStatus;
|
||||
public byte BootAreaWriteProtectionRegister;
|
||||
public byte Reserved13;
|
||||
public byte UserAreaWriteProtectionRegister;
|
||||
public byte Reserved14;
|
||||
public byte FirmwareConfiguration;
|
||||
public byte RPMBSize;
|
||||
public byte WriteReliabilitySettingRegister;
|
||||
public byte WriteReliabilityParameterRegister;
|
||||
public byte StartSanitizeOperation;
|
||||
public byte ManuallyStartBackgroundOperations;
|
||||
public byte EnableBackgroundOperationsHandshake;
|
||||
public byte HWResetFunction;
|
||||
public byte HPIManagement;
|
||||
public byte PartitioningSupport;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] MaxEnhancedAreaSize;
|
||||
public ulong FirmwareVersion;
|
||||
public byte PowerClassDDR200;
|
||||
public uint CacheSize;
|
||||
public byte GenericCMD6Timeout;
|
||||
public byte PowerOffNotificationTimeout;
|
||||
public byte BackgroundOperationsStatus;
|
||||
public uint CorrectlyProgrammedSectors;
|
||||
public byte InitializationTimeAfterPartition;
|
||||
public byte CacheFlushingPolicy;
|
||||
public byte PowerClassDDR52;
|
||||
public byte PowerClassDDR52_195;
|
||||
public byte PowerClassDDR200_195;
|
||||
public byte PowerClassDDR200_130;
|
||||
public byte MinimumWritePerformanceDDR52;
|
||||
public byte MinimumReadPerformanceDDR52;
|
||||
public byte Reserved2;
|
||||
public byte TRIMMultiplier;
|
||||
public byte SecureFeatureSupport;
|
||||
public byte SecureEraseMultiplier;
|
||||
public byte SecureTRIMMultiplier;
|
||||
public byte BootInformation;
|
||||
public byte Reserved3;
|
||||
public byte BootPartitionSize;
|
||||
public byte AccessSize;
|
||||
public byte HighCapacityEraseUnitSize;
|
||||
public byte HighCapacityEraseTimeout;
|
||||
public byte ReliableWriteSectorCount;
|
||||
public byte HighCapacityWriteProtectGroupSize;
|
||||
public byte SleepCurrentVcc;
|
||||
public byte SleepCurrentVccq;
|
||||
public byte ProductionStateAwarenessTimeout;
|
||||
public byte SleepAwakeTimeout;
|
||||
public byte SleepNotificationTimeout;
|
||||
public uint SectorCount;
|
||||
public byte SecureWriteProtectInformation;
|
||||
public byte MinimumWritePerformance52;
|
||||
public byte MinimumReadPerformance52;
|
||||
public byte MinimumWritePerformance26;
|
||||
public byte MinimumReadPerformance26;
|
||||
public byte MinimumWritePerformance26_4;
|
||||
public byte MinimumReadPerformance26_4;
|
||||
public byte Reserved4;
|
||||
public byte PowerClass26;
|
||||
public byte PowerClass52;
|
||||
public byte PowerClass26_195;
|
||||
public byte PowerClass52_195;
|
||||
public byte PartitionSwitchingTime;
|
||||
public byte OutOfInterruptBusyTiming;
|
||||
public byte DriverStrength;
|
||||
public byte DeviceType;
|
||||
public byte Reserved5;
|
||||
public byte Structure;
|
||||
public byte Reserved6;
|
||||
public byte Revision;
|
||||
public byte CommandSet;
|
||||
public byte Reserved7;
|
||||
public byte CommandSetRevision;
|
||||
public byte Reserved8;
|
||||
public byte PowerClass;
|
||||
public byte Reserved9;
|
||||
public byte HighSpeedInterfaceTiming;
|
||||
public byte StrobeSupport;
|
||||
public byte BusWidth;
|
||||
public byte Reserved10;
|
||||
public byte ErasedMemoryContent;
|
||||
public byte Reserved11;
|
||||
public byte PartitionConfiguration;
|
||||
public byte BootConfigProtection;
|
||||
public byte BootBusConditions;
|
||||
public byte Reserved12;
|
||||
public byte HighDensityEraseGroupDefinition;
|
||||
public byte BootWriteProtectionStatus;
|
||||
public byte BootAreaWriteProtectionRegister;
|
||||
public byte Reserved13;
|
||||
public byte UserAreaWriteProtectionRegister;
|
||||
public byte Reserved14;
|
||||
public byte FirmwareConfiguration;
|
||||
public byte RPMBSize;
|
||||
public byte WriteReliabilitySettingRegister;
|
||||
public byte WriteReliabilityParameterRegister;
|
||||
public byte StartSanitizeOperation;
|
||||
public byte ManuallyStartBackgroundOperations;
|
||||
public byte EnableBackgroundOperationsHandshake;
|
||||
public byte HWResetFunction;
|
||||
public byte HPIManagement;
|
||||
public byte PartitioningSupport;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
||||
public byte[] MaxEnhancedAreaSize;
|
||||
public byte PartitionsAttribute;
|
||||
public byte PartitioningSetting;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] GeneralPurposePartitionSize;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public byte[] EnhancedUserDataAreaSize;
|
||||
public uint EnhancedUserDataStartAddress;
|
||||
public byte Reserved15;
|
||||
public byte BadBlockManagementMode;
|
||||
public byte ProductionStateAwareness;
|
||||
public byte PackageCaseTemperatureControl;
|
||||
public byte PeriodicWakeUp;
|
||||
public byte SupportsProgramCxDInDDR;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
|
||||
public byte[] GeneralPurposePartitionSize;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
||||
public byte[] EnhancedUserDataAreaSize;
|
||||
public uint EnhancedUserDataStartAddress;
|
||||
public byte Reserved15;
|
||||
public byte BadBlockManagementMode;
|
||||
public byte ProductionStateAwareness;
|
||||
public byte PackageCaseTemperatureControl;
|
||||
public byte PeriodicWakeUp;
|
||||
public byte SupportsProgramCxDInDDR;
|
||||
public ushort Reserved16;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] VendorSpecific;
|
||||
public byte NativeSectorSize;
|
||||
public byte SectorSizeEmulation;
|
||||
public byte SectorSize;
|
||||
public byte InitializationTimeout;
|
||||
public byte Class6CommandsControl;
|
||||
public byte AddressedGroupToBeReleased;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
|
||||
public byte[] VendorSpecific;
|
||||
public byte NativeSectorSize;
|
||||
public byte SectorSizeEmulation;
|
||||
public byte SectorSize;
|
||||
public byte InitializationTimeout;
|
||||
public byte Class6CommandsControl;
|
||||
public byte AddressedGroupToBeReleased;
|
||||
public ushort ExceptionEventsControl;
|
||||
public ushort ExceptionEventsStatus;
|
||||
public ushort ExtendedPartitionsAttribute;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)] public byte[] ContextConfiguration;
|
||||
public byte PackedCommandStatus;
|
||||
public byte PackedCommandFailureIndex;
|
||||
public byte PowerOffNotification;
|
||||
public byte CacheControl;
|
||||
public byte CacheFlushing;
|
||||
public byte BarrierControl;
|
||||
public byte ModeConfig;
|
||||
public byte ModeOperationCodes;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)]
|
||||
public byte[] ContextConfiguration;
|
||||
public byte PackedCommandStatus;
|
||||
public byte PackedCommandFailureIndex;
|
||||
public byte PowerOffNotification;
|
||||
public byte CacheControl;
|
||||
public byte CacheFlushing;
|
||||
public byte BarrierControl;
|
||||
public byte ModeConfig;
|
||||
public byte ModeOperationCodes;
|
||||
public ushort Reserved17;
|
||||
public byte FFUStatus;
|
||||
public uint PreLoadingDataSize;
|
||||
public uint MaxPreLoadingDataSize;
|
||||
public byte ProductStateAwarenessEnablement;
|
||||
public byte SecureRemovalType;
|
||||
public byte CommandQueueModeEnable;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)] public byte[] Reserved18;
|
||||
public byte FFUStatus;
|
||||
public uint PreLoadingDataSize;
|
||||
public uint MaxPreLoadingDataSize;
|
||||
public byte ProductStateAwarenessEnablement;
|
||||
public byte SecureRemovalType;
|
||||
public byte CommandQueueModeEnable;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)]
|
||||
public byte[] Reserved18;
|
||||
}
|
||||
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
@@ -213,8 +222,8 @@ namespace DiscImageChef.Decoders.MMC
|
||||
|
||||
if(response.Length != 512) return null;
|
||||
|
||||
GCHandle handle = GCHandle.Alloc(response, GCHandleType.Pinned);
|
||||
ExtendedCSD csd = (ExtendedCSD)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(ExtendedCSD));
|
||||
GCHandle handle = GCHandle.Alloc(response, GCHandleType.Pinned);
|
||||
ExtendedCSD csd = (ExtendedCSD)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(ExtendedCSD));
|
||||
handle.Free();
|
||||
|
||||
return csd;
|
||||
@@ -364,8 +373,8 @@ namespace DiscImageChef.Decoders.MMC
|
||||
|
||||
if(csd.PowerOffNotificationTimeout > 0)
|
||||
sb
|
||||
.AppendFormat("\tDevice takes a maximum of {0} by default to power off from a SWITCH command notification",
|
||||
csd.PowerOffNotificationTimeout * 10).AppendLine();
|
||||
.AppendFormat("\tDevice takes a maximum of {0} by default to power off from a SWITCH command notification",
|
||||
csd.PowerOffNotificationTimeout * 10).AppendLine();
|
||||
|
||||
switch(csd.BackgroundOperationsStatus & 0x03)
|
||||
{
|
||||
|
||||
@@ -72,25 +72,25 @@ namespace DiscImageChef.Decoders.MMC
|
||||
{
|
||||
return new OCR
|
||||
{
|
||||
PowerUp = (response & 0x80000000) == 0x80000000,
|
||||
PowerUp = (response & 0x80000000) == 0x80000000,
|
||||
AccessMode = (byte)((response & 0x60000000) >> 29),
|
||||
ThreeFive = (response & 0x00800000) == 0x00800000,
|
||||
ThreeFour = (response & 0x00400000) == 0x00400000,
|
||||
ThreeFive = (response & 0x00800000) == 0x00800000,
|
||||
ThreeFour = (response & 0x00400000) == 0x00400000,
|
||||
ThreeThree = (response & 0x00200000) == 0x00200000,
|
||||
ThreeTwo = (response & 0x00100000) == 0x00100000,
|
||||
ThreeOne = (response & 0x00080000) == 0x00080000,
|
||||
ThreeZero = (response & 0x00040000) == 0x00040000,
|
||||
TwoNine = (response & 0x00020000) == 0x00020000,
|
||||
TwoEight = (response & 0x00010000) == 0x00010000,
|
||||
TwoSeven = (response & 0x00008000) == 0x00008000,
|
||||
TwoSix = (response & 0x00004000) == 0x00004000,
|
||||
TwoFive = (response & 0x00002000) == 0x00002000,
|
||||
TwoFour = (response & 0x00001000) == 0x00001000,
|
||||
TwoThree = (response & 0x00000800) == 0x00000800,
|
||||
TwoTwo = (response & 0x00000400) == 0x00000400,
|
||||
TwoOne = (response & 0x00000200) == 0x00000200,
|
||||
TwoZero = (response & 0x00000100) == 0x00000100,
|
||||
OneSix = (response & 0x00000080) == 0x00000080
|
||||
ThreeTwo = (response & 0x00100000) == 0x00100000,
|
||||
ThreeOne = (response & 0x00080000) == 0x00080000,
|
||||
ThreeZero = (response & 0x00040000) == 0x00040000,
|
||||
TwoNine = (response & 0x00020000) == 0x00020000,
|
||||
TwoEight = (response & 0x00010000) == 0x00010000,
|
||||
TwoSeven = (response & 0x00008000) == 0x00008000,
|
||||
TwoSix = (response & 0x00004000) == 0x00004000,
|
||||
TwoFive = (response & 0x00002000) == 0x00002000,
|
||||
TwoFour = (response & 0x00001000) == 0x00001000,
|
||||
TwoThree = (response & 0x00000800) == 0x00000800,
|
||||
TwoTwo = (response & 0x00000400) == 0x00000400,
|
||||
TwoOne = (response & 0x00000200) == 0x00000200,
|
||||
TwoZero = (response & 0x00000100) == 0x00000100,
|
||||
OneSix = (response & 0x00000080) == 0x00000080
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace DiscImageChef.Decoders.MMC
|
||||
switch(mmcVendorId)
|
||||
{
|
||||
case 0x15: return "Samsung";
|
||||
default: return $"Unknown manufacturer ID 0x{mmcVendorId:X2}";
|
||||
default: return $"Unknown manufacturer ID 0x{mmcVendorId:X2}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,8 +46,8 @@ namespace DiscImageChef.Decoders.PCMCIA
|
||||
// TODO: Handle links? Or are they removed in lower layers of the operating system drivers?
|
||||
public static Tuple[] GetTuples(byte[] data)
|
||||
{
|
||||
List<Tuple> tuples = new List<Tuple>();
|
||||
int position = 0;
|
||||
List<Tuple> tuples = new List<Tuple>();
|
||||
int position = 0;
|
||||
|
||||
while(position < data.Length)
|
||||
{
|
||||
@@ -84,25 +84,25 @@ namespace DiscImageChef.Decoders.PCMCIA
|
||||
{
|
||||
if((data?.Length - 2) % 6 != 0) return null;
|
||||
|
||||
DeviceGeometryTuple tuple = new DeviceGeometryTuple();
|
||||
DeviceGeometryTuple tuple = new DeviceGeometryTuple();
|
||||
List<DeviceGeometry> geometries = new List<DeviceGeometry>();
|
||||
|
||||
for(int position = 2; position < data.Length; position += 6)
|
||||
{
|
||||
DeviceGeometry geometry = new DeviceGeometry
|
||||
{
|
||||
CardInterface = data[position],
|
||||
CardInterface = data[position],
|
||||
EraseBlockSize = data[position + 1],
|
||||
ReadBlockSize = data[position + 2],
|
||||
ReadBlockSize = data[position + 2],
|
||||
WriteBlockSize = data[position + 3],
|
||||
Partitions = data[position + 4],
|
||||
Interleaving = data[position + 5]
|
||||
Partitions = data[position + 4],
|
||||
Interleaving = data[position + 5]
|
||||
};
|
||||
geometries.Add(geometry);
|
||||
}
|
||||
|
||||
tuple.Code = (TupleCodes)data[0];
|
||||
tuple.Link = data[1];
|
||||
tuple.Code = (TupleCodes)data[0];
|
||||
tuple.Link = data[1];
|
||||
tuple.Geometries = geometries.ToArray();
|
||||
|
||||
return tuple;
|
||||
@@ -128,7 +128,7 @@ namespace DiscImageChef.Decoders.PCMCIA
|
||||
(1 << (geometry.WriteBlockSize - 1)) * (1 << (geometry.Interleaving - 1))).AppendLine();
|
||||
sb.AppendFormat("\t\tPartition alignment = {0} bytes",
|
||||
(1 << (geometry.EraseBlockSize - 1)) * (1 << (geometry.Interleaving - 1)) *
|
||||
(1 << (geometry.Partitions - 1))).AppendLine();
|
||||
(1 << (geometry.Partitions - 1))).AppendLine();
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
@@ -159,10 +159,10 @@ namespace DiscImageChef.Decoders.PCMCIA
|
||||
|
||||
return new ManufacturerIdentificationTuple
|
||||
{
|
||||
Code = (TupleCodes)data[0],
|
||||
Link = data[1],
|
||||
Code = (TupleCodes)data[0],
|
||||
Link = data[1],
|
||||
ManufacturerID = BitConverter.ToUInt16(data, 2),
|
||||
CardID = BitConverter.ToUInt16(data, 4)
|
||||
CardID = BitConverter.ToUInt16(data, 4)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -201,15 +201,15 @@ namespace DiscImageChef.Decoders.PCMCIA
|
||||
|
||||
if(data.Length < 4) return null;
|
||||
|
||||
List<byte> buffer = new List<byte>();
|
||||
List<string> strings = null;
|
||||
bool firstString = false;
|
||||
bool secondString = false;
|
||||
List<byte> buffer = new List<byte>();
|
||||
List<string> strings = null;
|
||||
bool firstString = false;
|
||||
bool secondString = false;
|
||||
|
||||
Level1VersionTuple tuple = new Level1VersionTuple
|
||||
{
|
||||
Code = (TupleCodes)data[0],
|
||||
Link = data[1],
|
||||
Code = (TupleCodes)data[0],
|
||||
Link = data[1],
|
||||
MajorVersion = data[2],
|
||||
MinorVersion = data[3]
|
||||
};
|
||||
@@ -225,8 +225,8 @@ namespace DiscImageChef.Decoders.PCMCIA
|
||||
if(!firstString)
|
||||
{
|
||||
tuple.Manufacturer = StringHandlers.CToString(buffer.ToArray());
|
||||
buffer = new List<byte>();
|
||||
firstString = true;
|
||||
buffer = new List<byte>();
|
||||
firstString = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -234,8 +234,8 @@ namespace DiscImageChef.Decoders.PCMCIA
|
||||
if(!secondString)
|
||||
{
|
||||
tuple.Product = StringHandlers.CToString(buffer.ToArray());
|
||||
buffer = new List<byte>();
|
||||
firstString = true;
|
||||
buffer = new List<byte>();
|
||||
firstString = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -279,18 +279,18 @@ namespace DiscImageChef.Decoders.PCMCIA
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum FunctionCodes : byte
|
||||
{
|
||||
MultiFunction = 0x00,
|
||||
Memory = 0x01,
|
||||
Serial = 0x02,
|
||||
Parallel = 0x03,
|
||||
FixedDisk = 0x04,
|
||||
Video = 0x05,
|
||||
Network = 0x06,
|
||||
AIMS = 0x07,
|
||||
SCSI = 0x08,
|
||||
Security = 0x09,
|
||||
Instrument = 0x0A,
|
||||
MultiFunction = 0x00,
|
||||
Memory = 0x01,
|
||||
Serial = 0x02,
|
||||
Parallel = 0x03,
|
||||
FixedDisk = 0x04,
|
||||
Video = 0x05,
|
||||
Network = 0x06,
|
||||
AIMS = 0x07,
|
||||
SCSI = 0x08,
|
||||
Security = 0x09,
|
||||
Instrument = 0x0A,
|
||||
HighSpeedSerial = 0x0B,
|
||||
VendorSpecific = 0xFE
|
||||
VendorSpecific = 0xFE
|
||||
}
|
||||
}
|
||||
@@ -43,8 +43,8 @@ namespace DiscImageChef.Decoders.PCMCIA
|
||||
public class Tuple
|
||||
{
|
||||
public TupleCodes Code;
|
||||
public byte Link;
|
||||
public byte[] Data;
|
||||
public byte Link;
|
||||
public byte[] Data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -42,130 +42,130 @@ namespace DiscImageChef.Decoders.PCMCIA
|
||||
switch(id)
|
||||
{
|
||||
#region JEDEC
|
||||
case 0x01: return "AMD";
|
||||
case 0x02: return "AMI";
|
||||
case 0x83: return "Fairchild";
|
||||
case 0x04: return "Fujitsu";
|
||||
case 0x85: return "GTE";
|
||||
case 0x86: return "Harris";
|
||||
case 0x07: return "Hitachi";
|
||||
case 0x08: return "Inmos";
|
||||
case 0x89: return "Intel";
|
||||
case 0x8A: return "I.T.T.";
|
||||
case 0x0B: return "Intersil";
|
||||
case 0x8C: return "Monolithic Memories";
|
||||
case 0x0D: return "Mostek";
|
||||
case 0x0E: return "Freescale";
|
||||
case 0x8F: return "National";
|
||||
case 0x10: return "NEC";
|
||||
case 0x91: return "RCA";
|
||||
case 0x92: return "Raytheon";
|
||||
case 0x13: return "Conexant";
|
||||
case 0x94: return "Seeq";
|
||||
case 0x15: return "NXP";
|
||||
case 0x16: return "Synertek";
|
||||
case 0x97: return "Texas Instruments";
|
||||
case 0x98: return "Toshiba";
|
||||
case 0x19: return "Xicor";
|
||||
case 0x1A: return "Zilog";
|
||||
case 0x9B: return "Eurotechnique";
|
||||
case 0x1C: return "Mitsubishi2";
|
||||
case 0x9D: return "Lucent";
|
||||
case 0x9E: return "Exel";
|
||||
case 0x1F: return "Atmel";
|
||||
case 0x20: return "SGS/Thomson";
|
||||
case 0xA1: return "Lattice Semiconductor";
|
||||
case 0xA2: return "NCR";
|
||||
case 0x23: return "Wafer Scale Integration";
|
||||
case 0xA4: return "International Business Machines";
|
||||
case 0x25: return "Tristar";
|
||||
case 0x26: return "Visic";
|
||||
case 0xA7: return "International CMOS Technology";
|
||||
case 0xA8: return "SSSI";
|
||||
case 0x29: return "Microchip Technology";
|
||||
case 0x2A: return "Ricoh";
|
||||
case 0xAB: return "VLSI";
|
||||
case 0x2C: return "Micron Technology";
|
||||
case 0xAD: return "Hynix Semiconductor";
|
||||
case 0xAE: return "OKI Semiconductor";
|
||||
case 0x2F: return "ACTEL";
|
||||
case 0xB0: return "Sharp";
|
||||
case 0x31: return "Catalyst";
|
||||
case 0x32: return "Panasonic";
|
||||
case 0xB3: return "IDT";
|
||||
case 0x34: return "Cypress";
|
||||
case 0xB5: return "Digital Equipment Corporation";
|
||||
case 0xB6: return "LSI Logic";
|
||||
case 0x37: return "Zarlink";
|
||||
case 0x38: return "UTMC";
|
||||
case 0xB9: return "Thinking Machine";
|
||||
case 0xBA: return "Thomson CSF";
|
||||
case 0x3B: return "Integrated CMOS";
|
||||
case 0xBC: return "Honeywell";
|
||||
case 0x3D: return "Tektronix";
|
||||
case 0x3E: return "Oracle Corporation";
|
||||
case 0xBF: return "Silicon Storage Technology";
|
||||
case 0x40: return "ProMos";
|
||||
case 0xC1: return "Infineon";
|
||||
case 0xC2: return "Macronix";
|
||||
case 0x43: return "Xerox";
|
||||
case 0xC4: return "Plus Logic";
|
||||
case 0x45: return "SanDisk Corporation";
|
||||
case 0x46: return "Elan Circuit Technology";
|
||||
case 0xC7: return "European Silicon";
|
||||
case 0xC8: return "Apple";
|
||||
case 0x49: return "Xilinx";
|
||||
case 0x4A: return "Compaq";
|
||||
case 0xCB: return "Protocol Engines";
|
||||
case 0x4C: return "SCI";
|
||||
case 0xCD: return "Seiko Instruments";
|
||||
case 0xCE: return "Samsung";
|
||||
case 0x4F: return "I3 Design System";
|
||||
case 0xD0: return "Klic";
|
||||
case 0x51: return "Crosspoint Solutions";
|
||||
case 0x52: return "Alliance Semiconductor";
|
||||
case 0xD3: return "Tandem";
|
||||
case 0x54: return "Hewlett-Packard";
|
||||
case 0xD5: return "Integrated Silicon Solutions";
|
||||
case 0xD6: return "Brooktree";
|
||||
case 0x57: return "New Media";
|
||||
case 0x58: return "MHS Electronic";
|
||||
case 0xD9: return "Performance Semiconductors";
|
||||
case 0xDA: return "Winbond Electronic";
|
||||
case 0x5B: return "Kawasaki Steel";
|
||||
case 0x5D: return "TECMAR";
|
||||
case 0x5E: return "Exar";
|
||||
case 0xDF: return "PCMCIA";
|
||||
case 0xE0: return "LG Semiconductor";
|
||||
case 0x61: return "Northern Telecom";
|
||||
case 0x62: return "Sanyo2";
|
||||
case 0xE3: return "Array Microsystems";
|
||||
case 0x64: return "Crystal Semiconductor";
|
||||
case 0xE5: return "Analog Devices";
|
||||
case 0xE6: return "PMC-Sierra";
|
||||
case 0x67: return "Asparix";
|
||||
case 0x68: return "Convex Computer";
|
||||
case 0xE9: return "Nimbus Technology";
|
||||
case 0x6B: return "Transwitch";
|
||||
case 0xEC: return "Micronas";
|
||||
case 0x6D: return "Canon";
|
||||
case 0x6E: return "Altera";
|
||||
case 0xEF: return "NEXCOM";
|
||||
case 0x70: return "Qualcomm";
|
||||
case 0xF1: return "Sony";
|
||||
case 0xF2: return "Cray Research";
|
||||
case 0x73: return "AMS";
|
||||
case 0xF4: return "Vitesse";
|
||||
case 0x75: return "Aster Electronics";
|
||||
case 0x76: return "Bay Networks";
|
||||
case 0xF7: return "Zentrum";
|
||||
case 0xF8: return "TRW";
|
||||
case 0x79: return "Thesys";
|
||||
case 0x7A: return "Solbourne Computer";
|
||||
case 0xFB: return "Allied-Signal";
|
||||
case 0x7C: return "Dialog Semiconductor";
|
||||
case 0xFD: return "Media Vision";
|
||||
case 0xFE: return "Numonyx Corporation";
|
||||
case 0x01: return "AMD";
|
||||
case 0x02: return "AMI";
|
||||
case 0x83: return "Fairchild";
|
||||
case 0x04: return "Fujitsu";
|
||||
case 0x85: return "GTE";
|
||||
case 0x86: return "Harris";
|
||||
case 0x07: return "Hitachi";
|
||||
case 0x08: return "Inmos";
|
||||
case 0x89: return "Intel";
|
||||
case 0x8A: return "I.T.T.";
|
||||
case 0x0B: return "Intersil";
|
||||
case 0x8C: return "Monolithic Memories";
|
||||
case 0x0D: return "Mostek";
|
||||
case 0x0E: return "Freescale";
|
||||
case 0x8F: return "National";
|
||||
case 0x10: return "NEC";
|
||||
case 0x91: return "RCA";
|
||||
case 0x92: return "Raytheon";
|
||||
case 0x13: return "Conexant";
|
||||
case 0x94: return "Seeq";
|
||||
case 0x15: return "NXP";
|
||||
case 0x16: return "Synertek";
|
||||
case 0x97: return "Texas Instruments";
|
||||
case 0x98: return "Toshiba";
|
||||
case 0x19: return "Xicor";
|
||||
case 0x1A: return "Zilog";
|
||||
case 0x9B: return "Eurotechnique";
|
||||
case 0x1C: return "Mitsubishi2";
|
||||
case 0x9D: return "Lucent";
|
||||
case 0x9E: return "Exel";
|
||||
case 0x1F: return "Atmel";
|
||||
case 0x20: return "SGS/Thomson";
|
||||
case 0xA1: return "Lattice Semiconductor";
|
||||
case 0xA2: return "NCR";
|
||||
case 0x23: return "Wafer Scale Integration";
|
||||
case 0xA4: return "International Business Machines";
|
||||
case 0x25: return "Tristar";
|
||||
case 0x26: return "Visic";
|
||||
case 0xA7: return "International CMOS Technology";
|
||||
case 0xA8: return "SSSI";
|
||||
case 0x29: return "Microchip Technology";
|
||||
case 0x2A: return "Ricoh";
|
||||
case 0xAB: return "VLSI";
|
||||
case 0x2C: return "Micron Technology";
|
||||
case 0xAD: return "Hynix Semiconductor";
|
||||
case 0xAE: return "OKI Semiconductor";
|
||||
case 0x2F: return "ACTEL";
|
||||
case 0xB0: return "Sharp";
|
||||
case 0x31: return "Catalyst";
|
||||
case 0x32: return "Panasonic";
|
||||
case 0xB3: return "IDT";
|
||||
case 0x34: return "Cypress";
|
||||
case 0xB5: return "Digital Equipment Corporation";
|
||||
case 0xB6: return "LSI Logic";
|
||||
case 0x37: return "Zarlink";
|
||||
case 0x38: return "UTMC";
|
||||
case 0xB9: return "Thinking Machine";
|
||||
case 0xBA: return "Thomson CSF";
|
||||
case 0x3B: return "Integrated CMOS";
|
||||
case 0xBC: return "Honeywell";
|
||||
case 0x3D: return "Tektronix";
|
||||
case 0x3E: return "Oracle Corporation";
|
||||
case 0xBF: return "Silicon Storage Technology";
|
||||
case 0x40: return "ProMos";
|
||||
case 0xC1: return "Infineon";
|
||||
case 0xC2: return "Macronix";
|
||||
case 0x43: return "Xerox";
|
||||
case 0xC4: return "Plus Logic";
|
||||
case 0x45: return "SanDisk Corporation";
|
||||
case 0x46: return "Elan Circuit Technology";
|
||||
case 0xC7: return "European Silicon";
|
||||
case 0xC8: return "Apple";
|
||||
case 0x49: return "Xilinx";
|
||||
case 0x4A: return "Compaq";
|
||||
case 0xCB: return "Protocol Engines";
|
||||
case 0x4C: return "SCI";
|
||||
case 0xCD: return "Seiko Instruments";
|
||||
case 0xCE: return "Samsung";
|
||||
case 0x4F: return "I3 Design System";
|
||||
case 0xD0: return "Klic";
|
||||
case 0x51: return "Crosspoint Solutions";
|
||||
case 0x52: return "Alliance Semiconductor";
|
||||
case 0xD3: return "Tandem";
|
||||
case 0x54: return "Hewlett-Packard";
|
||||
case 0xD5: return "Integrated Silicon Solutions";
|
||||
case 0xD6: return "Brooktree";
|
||||
case 0x57: return "New Media";
|
||||
case 0x58: return "MHS Electronic";
|
||||
case 0xD9: return "Performance Semiconductors";
|
||||
case 0xDA: return "Winbond Electronic";
|
||||
case 0x5B: return "Kawasaki Steel";
|
||||
case 0x5D: return "TECMAR";
|
||||
case 0x5E: return "Exar";
|
||||
case 0xDF: return "PCMCIA";
|
||||
case 0xE0: return "LG Semiconductor";
|
||||
case 0x61: return "Northern Telecom";
|
||||
case 0x62: return "Sanyo2";
|
||||
case 0xE3: return "Array Microsystems";
|
||||
case 0x64: return "Crystal Semiconductor";
|
||||
case 0xE5: return "Analog Devices";
|
||||
case 0xE6: return "PMC-Sierra";
|
||||
case 0x67: return "Asparix";
|
||||
case 0x68: return "Convex Computer";
|
||||
case 0xE9: return "Nimbus Technology";
|
||||
case 0x6B: return "Transwitch";
|
||||
case 0xEC: return "Micronas";
|
||||
case 0x6D: return "Canon";
|
||||
case 0x6E: return "Altera";
|
||||
case 0xEF: return "NEXCOM";
|
||||
case 0x70: return "Qualcomm";
|
||||
case 0xF1: return "Sony";
|
||||
case 0xF2: return "Cray Research";
|
||||
case 0x73: return "AMS";
|
||||
case 0xF4: return "Vitesse";
|
||||
case 0x75: return "Aster Electronics";
|
||||
case 0x76: return "Bay Networks";
|
||||
case 0xF7: return "Zentrum";
|
||||
case 0xF8: return "TRW";
|
||||
case 0x79: return "Thesys";
|
||||
case 0x7A: return "Solbourne Computer";
|
||||
case 0xFB: return "Allied-Signal";
|
||||
case 0x7C: return "Dialog Semiconductor";
|
||||
case 0xFD: return "Media Vision";
|
||||
case 0xFE: return "Numonyx Corporation";
|
||||
case 0x7F01: return "Cirrus Logic";
|
||||
case 0x7F02: return "National Instruments";
|
||||
case 0x7F04: return "Alcatel Mietec";
|
||||
@@ -356,7 +356,7 @@ namespace DiscImageChef.Decoders.PCMCIA
|
||||
case 0xC020: return "NextCom K.K.";
|
||||
case 0xC250: return "EMTAC Technology Corporation";
|
||||
case 0xD601: return "Elsa";
|
||||
default: return $"Unknown vendor id 0x{id:X4}";
|
||||
default: return $"Unknown vendor id 0x{id:X4}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,8 +72,8 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
Capability cap = new Capability
|
||||
{
|
||||
FormatCode = response[offset],
|
||||
SDS = (response[offset + 1] & 0x80) == 0x80,
|
||||
RDS = (response[offset + 1] & 0x40) == 0x40
|
||||
SDS = (response[offset + 1] & 0x80) == 0x80,
|
||||
RDS = (response[offset + 1] & 0x40) == 0x40
|
||||
};
|
||||
caps.Add(cap);
|
||||
offset += 4;
|
||||
|
||||
@@ -150,14 +150,14 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
|
||||
Page_81 decoded = new Page_81
|
||||
{
|
||||
PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5),
|
||||
PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5),
|
||||
PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F),
|
||||
PageLength = (byte)(pageResponse[3] + 4),
|
||||
Current = (ScsiDefinitions)(pageResponse[4] & 0x7F),
|
||||
Default = (ScsiDefinitions)(pageResponse[5] & 0x7F)
|
||||
PageLength = (byte)(pageResponse[3] + 4),
|
||||
Current = (ScsiDefinitions)(pageResponse[4] & 0x7F),
|
||||
Default = (ScsiDefinitions)(pageResponse[5] & 0x7F)
|
||||
};
|
||||
|
||||
int position = 6;
|
||||
int position = 6;
|
||||
List<ScsiDefinitions> definitions = new List<ScsiDefinitions>();
|
||||
|
||||
while(position < pageResponse.Length)
|
||||
@@ -182,11 +182,11 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
switch(definition)
|
||||
{
|
||||
case ScsiDefinitions.Current: return "";
|
||||
case ScsiDefinitions.CCS: return "CCS";
|
||||
case ScsiDefinitions.SCSI1: return "SCSI-1";
|
||||
case ScsiDefinitions.SCSI2: return "SCSI-2";
|
||||
case ScsiDefinitions.SCSI3: return "SCSI-3";
|
||||
default: return $"Unknown definition code {(byte)definition}";
|
||||
case ScsiDefinitions.CCS: return "CCS";
|
||||
case ScsiDefinitions.SCSI1: return "SCSI-1";
|
||||
case ScsiDefinitions.SCSI2: return "SCSI-2";
|
||||
case ScsiDefinitions.SCSI3: return "SCSI-3";
|
||||
default: return $"Unknown definition code {(byte)definition}";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,8 +194,8 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
{
|
||||
if(!modePage.HasValue) return null;
|
||||
|
||||
Page_81 page = modePage.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Page_81 page = modePage.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.AppendLine("SCSI Implemented operating definitions:");
|
||||
|
||||
@@ -385,12 +385,12 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
|
||||
Page_83 decoded = new Page_83
|
||||
{
|
||||
PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5),
|
||||
PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5),
|
||||
PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F),
|
||||
PageLength = (byte)(pageResponse[3] + 4)
|
||||
PageLength = (byte)(pageResponse[3] + 4)
|
||||
};
|
||||
|
||||
int position = 4;
|
||||
int position = 4;
|
||||
List<IdentificatonDescriptor> descriptors = new List<IdentificatonDescriptor>();
|
||||
|
||||
while(position < pageResponse.Length)
|
||||
@@ -398,11 +398,11 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
IdentificatonDescriptor descriptor = new IdentificatonDescriptor
|
||||
{
|
||||
ProtocolIdentifier = (ProtocolIdentifiers)((pageResponse[position] & 0xF0) >> 4),
|
||||
CodeSet = (IdentificationCodeSet)(pageResponse[position] & 0x0F),
|
||||
PIV = (pageResponse[position + 1] & 0x80) == 0x80,
|
||||
Association = (IdentificationAssociation)((pageResponse[position + 1] & 0x30) >> 4),
|
||||
Type = (IdentificationTypes)(pageResponse[position + 1] & 0x0F),
|
||||
Length = pageResponse[position + 3]
|
||||
CodeSet = (IdentificationCodeSet)(pageResponse[position] & 0x0F),
|
||||
PIV = (pageResponse[position + 1] & 0x80) == 0x80,
|
||||
Association = (IdentificationAssociation)((pageResponse[position + 1] & 0x30) >> 4),
|
||||
Type = (IdentificationTypes)(pageResponse[position + 1] & 0x0F),
|
||||
Length = pageResponse[position + 3]
|
||||
};
|
||||
descriptor.Binary = new byte[descriptor.Length];
|
||||
if(descriptor.Length + position + 4 >= pageResponse.Length)
|
||||
@@ -439,8 +439,8 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
{
|
||||
if(!modePage.HasValue) return null;
|
||||
|
||||
Page_83 page = modePage.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Page_83 page = modePage.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.AppendLine("SCSI Device identification:");
|
||||
|
||||
@@ -642,69 +642,69 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
{
|
||||
case ProtocolIdentifiers.ADT:
|
||||
sb
|
||||
.AppendFormat("\tProtocol (Automation/Drive Interface Transport) specific descriptor with unknown format (hex): {0}",
|
||||
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40))
|
||||
.AppendLine();
|
||||
.AppendFormat("\tProtocol (Automation/Drive Interface Transport) specific descriptor with unknown format (hex): {0}",
|
||||
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40))
|
||||
.AppendLine();
|
||||
break;
|
||||
case ProtocolIdentifiers.ATA:
|
||||
sb
|
||||
.AppendFormat("\tProtocol (ATA/ATAPI) specific descriptor with unknown format (hex): {0}",
|
||||
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40))
|
||||
.AppendLine();
|
||||
.AppendFormat("\tProtocol (ATA/ATAPI) specific descriptor with unknown format (hex): {0}",
|
||||
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40))
|
||||
.AppendLine();
|
||||
break;
|
||||
case ProtocolIdentifiers.FibreChannel:
|
||||
sb
|
||||
.AppendFormat("\tProtocol (Fibre Channel) specific descriptor with unknown format (hex): {0}",
|
||||
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40))
|
||||
.AppendLine();
|
||||
.AppendFormat("\tProtocol (Fibre Channel) specific descriptor with unknown format (hex): {0}",
|
||||
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40))
|
||||
.AppendLine();
|
||||
break;
|
||||
case ProtocolIdentifiers.Firewire:
|
||||
sb
|
||||
.AppendFormat("\tProtocol (IEEE 1394) specific descriptor with unknown format (hex): {0}",
|
||||
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40))
|
||||
.AppendLine();
|
||||
.AppendFormat("\tProtocol (IEEE 1394) specific descriptor with unknown format (hex): {0}",
|
||||
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40))
|
||||
.AppendLine();
|
||||
break;
|
||||
case ProtocolIdentifiers.iSCSI:
|
||||
sb
|
||||
.AppendFormat("\tProtocol (Internet SCSI) specific descriptor with unknown format (hex): {0}",
|
||||
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40))
|
||||
.AppendLine();
|
||||
.AppendFormat("\tProtocol (Internet SCSI) specific descriptor with unknown format (hex): {0}",
|
||||
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40))
|
||||
.AppendLine();
|
||||
break;
|
||||
case ProtocolIdentifiers.NoProtocol:
|
||||
sb
|
||||
.AppendFormat("\tProtocol (unknown) specific descriptor with unknown format (hex): {0}",
|
||||
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40))
|
||||
.AppendLine();
|
||||
.AppendFormat("\tProtocol (unknown) specific descriptor with unknown format (hex): {0}",
|
||||
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40))
|
||||
.AppendLine();
|
||||
break;
|
||||
case ProtocolIdentifiers.PCIe:
|
||||
sb
|
||||
.AppendFormat("\tProtocol (PCI Express) specific descriptor with unknown format (hex): {0}",
|
||||
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40))
|
||||
.AppendLine();
|
||||
.AppendFormat("\tProtocol (PCI Express) specific descriptor with unknown format (hex): {0}",
|
||||
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40))
|
||||
.AppendLine();
|
||||
break;
|
||||
case ProtocolIdentifiers.RDMAP:
|
||||
sb
|
||||
.AppendFormat("\tProtocol (SCSI Remote Direct Memory Access) specific descriptor with unknown format (hex): {0}",
|
||||
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40))
|
||||
.AppendLine();
|
||||
.AppendFormat("\tProtocol (SCSI Remote Direct Memory Access) specific descriptor with unknown format (hex): {0}",
|
||||
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40))
|
||||
.AppendLine();
|
||||
break;
|
||||
case ProtocolIdentifiers.SAS:
|
||||
sb
|
||||
.AppendFormat("\tProtocol (Serial Attachment SCSI) specific descriptor with unknown format (hex): {0}",
|
||||
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40))
|
||||
.AppendLine();
|
||||
.AppendFormat("\tProtocol (Serial Attachment SCSI) specific descriptor with unknown format (hex): {0}",
|
||||
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40))
|
||||
.AppendLine();
|
||||
break;
|
||||
case ProtocolIdentifiers.SCSI:
|
||||
sb
|
||||
.AppendFormat("\tProtocol (Parallel SCSI) specific descriptor with unknown format (hex): {0}",
|
||||
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40))
|
||||
.AppendLine();
|
||||
.AppendFormat("\tProtocol (Parallel SCSI) specific descriptor with unknown format (hex): {0}",
|
||||
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40))
|
||||
.AppendLine();
|
||||
break;
|
||||
case ProtocolIdentifiers.SSA:
|
||||
sb
|
||||
.AppendFormat("\tProtocol (SSA) specific descriptor with unknown format (hex): {0}",
|
||||
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40))
|
||||
.AppendLine();
|
||||
.AppendFormat("\tProtocol (SSA) specific descriptor with unknown format (hex): {0}",
|
||||
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40))
|
||||
.AppendLine();
|
||||
break;
|
||||
case ProtocolIdentifiers.SCSIe:
|
||||
sb.AppendFormat("\tProtocol (SCSIe) specific descriptor: Routing ID is {0}",
|
||||
@@ -712,15 +712,15 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
break;
|
||||
case ProtocolIdentifiers.UAS:
|
||||
sb
|
||||
.AppendFormat("\tProtocol (UAS) specific descriptor: USB address {0} interface {1}",
|
||||
descriptor.Binary[0] & 0x7F, descriptor.Binary[2]).AppendLine();
|
||||
.AppendFormat("\tProtocol (UAS) specific descriptor: USB address {0} interface {1}",
|
||||
descriptor.Binary[0] & 0x7F, descriptor.Binary[2]).AppendLine();
|
||||
break;
|
||||
default:
|
||||
sb
|
||||
.AppendFormat("\tProtocol (unknown code {0}) specific descriptor with unknown format (hex): {1}",
|
||||
(byte)descriptor.ProtocolIdentifier,
|
||||
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40))
|
||||
.AppendLine();
|
||||
.AppendFormat("\tProtocol (unknown code {0}) specific descriptor with unknown format (hex): {1}",
|
||||
(byte)descriptor.ProtocolIdentifier,
|
||||
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40))
|
||||
.AppendLine();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -741,9 +741,9 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
break;
|
||||
default:
|
||||
sb
|
||||
.AppendFormat("Inquiry descriptor type {2} contains unknown kind {1} of data (hex): {0}",
|
||||
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40),
|
||||
(byte)descriptor.CodeSet, (byte)descriptor.Type).AppendLine();
|
||||
.AppendFormat("Inquiry descriptor type {2} contains unknown kind {1} of data (hex): {0}",
|
||||
PrintHex.ByteArrayToHexArrayString(descriptor.Binary, 40),
|
||||
(byte)descriptor.CodeSet, (byte)descriptor.Type).AppendLine();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -802,12 +802,12 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
|
||||
Page_84 decoded = new Page_84
|
||||
{
|
||||
PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5),
|
||||
PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5),
|
||||
PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F),
|
||||
PageLength = (byte)(pageResponse[3] + 4)
|
||||
PageLength = (byte)(pageResponse[3] + 4)
|
||||
};
|
||||
|
||||
int position = 4;
|
||||
int position = 4;
|
||||
List<SoftwareIdentifier> identifiers = new List<SoftwareIdentifier>();
|
||||
|
||||
while(position < pageResponse.Length)
|
||||
@@ -832,8 +832,8 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
{
|
||||
if(!modePage.HasValue) return null;
|
||||
|
||||
Page_84 page = modePage.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Page_84 page = modePage.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.AppendLine("SCSI Software Interface Identifiers:");
|
||||
|
||||
@@ -859,13 +859,13 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
#region EVPD Page 0x85: Management Network Addresses page
|
||||
public enum NetworkServiceTypes : byte
|
||||
{
|
||||
Unspecified = 0,
|
||||
StorageConf = 1,
|
||||
Diagnostics = 2,
|
||||
Status = 3,
|
||||
Logging = 4,
|
||||
CodeDownload = 5,
|
||||
CopyService = 6,
|
||||
Unspecified = 0,
|
||||
StorageConf = 1,
|
||||
Diagnostics = 2,
|
||||
Status = 3,
|
||||
Logging = 4,
|
||||
CodeDownload = 5,
|
||||
CopyService = 6,
|
||||
Administrative = 7
|
||||
}
|
||||
|
||||
@@ -927,12 +927,12 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
|
||||
Page_85 decoded = new Page_85
|
||||
{
|
||||
PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5),
|
||||
PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5),
|
||||
PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F),
|
||||
PageLength = (ushort)((pageResponse[2] << 8) + pageResponse[3] + 4)
|
||||
PageLength = (ushort)((pageResponse[2] << 8) + pageResponse[3] + 4)
|
||||
};
|
||||
|
||||
int position = 4;
|
||||
int position = 4;
|
||||
List<NetworkDescriptor> descriptors = new List<NetworkDescriptor>();
|
||||
|
||||
while(position < pageResponse.Length)
|
||||
@@ -940,8 +940,8 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
NetworkDescriptor descriptor = new NetworkDescriptor
|
||||
{
|
||||
Association = (IdentificationAssociation)((pageResponse[position] & 0x60) >> 5),
|
||||
Type = (NetworkServiceTypes)(pageResponse[position] & 0x1F),
|
||||
Length = (ushort)((pageResponse[position + 2] << 8) + pageResponse[position + 3])
|
||||
Type = (NetworkServiceTypes)(pageResponse[position] & 0x1F),
|
||||
Length = (ushort)((pageResponse[position + 2] << 8) + pageResponse[position + 3])
|
||||
};
|
||||
descriptor.Address = new byte[descriptor.Length];
|
||||
Array.Copy(pageResponse, position + 4, descriptor.Address, 0, descriptor.Length);
|
||||
@@ -964,8 +964,8 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
{
|
||||
if(!modePage.HasValue) return null;
|
||||
|
||||
Page_85 page = modePage.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Page_85 page = modePage.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.AppendLine("SCSI Management Network Addresses:");
|
||||
|
||||
@@ -1183,36 +1183,36 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
|
||||
return new Page_86
|
||||
{
|
||||
PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5),
|
||||
PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5),
|
||||
PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F),
|
||||
PageLength = (byte)(pageResponse[3] + 4),
|
||||
ActivateMicrocode = (byte)((pageResponse[4] & 0xC0) >> 6),
|
||||
SPT = (byte)((pageResponse[4] & 0x38) >> 3),
|
||||
GRD_CHK = (pageResponse[4] & 0x04) == 0x04,
|
||||
APP_CHK = (pageResponse[4] & 0x02) == 0x02,
|
||||
REF_CHK = (pageResponse[4] & 0x01) == 0x01,
|
||||
UASK_SUP = (pageResponse[5] & 0x20) == 0x20,
|
||||
GROUP_SUP = (pageResponse[5] & 0x10) == 0x10,
|
||||
PRIOR_SUP = (pageResponse[5] & 0x08) == 0x08,
|
||||
HEADSUP = (pageResponse[5] & 0x04) == 0x04,
|
||||
ORDSUP = (pageResponse[5] & 0x02) == 0x02,
|
||||
SIMPSUP = (pageResponse[5] & 0x01) == 0x01,
|
||||
WU_SUP = (pageResponse[6] & 0x08) == 0x08,
|
||||
CRD_SUP = (pageResponse[6] & 0x04) == 0x04,
|
||||
NV_SUP = (pageResponse[6] & 0x02) == 0x02,
|
||||
V_SUP = (pageResponse[6] & 0x01) == 0x01,
|
||||
NO_PI_CHK = (pageResponse[7] & 0x20) == 0x20,
|
||||
P_I_I_SUP = (pageResponse[7] & 0x10) == 0x10,
|
||||
LUICLR = (pageResponse[7] & 0x01) == 0x01,
|
||||
R_SUP = (pageResponse[8] & 0x10) == 0x10,
|
||||
HSSRELEF = (pageResponse[8] & 0x02) == 0x02,
|
||||
CBCS = (pageResponse[8] & 0x01) == 0x01,
|
||||
Nexus = (byte)(pageResponse[9] & 0x0F),
|
||||
ExtendedTestMinutes = (ushort)((pageResponse[10] << 8) + pageResponse[11]),
|
||||
POA_SUP = (pageResponse[12] & 0x80) == 0x80,
|
||||
HRA_SUP = (pageResponse[12] & 0x40) == 0x40,
|
||||
VSA_SUP = (pageResponse[12] & 0x20) == 0x20,
|
||||
MaximumSenseLength = pageResponse[13]
|
||||
PageLength = (byte)(pageResponse[3] + 4),
|
||||
ActivateMicrocode = (byte)((pageResponse[4] & 0xC0) >> 6),
|
||||
SPT = (byte)((pageResponse[4] & 0x38) >> 3),
|
||||
GRD_CHK = (pageResponse[4] & 0x04) == 0x04,
|
||||
APP_CHK = (pageResponse[4] & 0x02) == 0x02,
|
||||
REF_CHK = (pageResponse[4] & 0x01) == 0x01,
|
||||
UASK_SUP = (pageResponse[5] & 0x20) == 0x20,
|
||||
GROUP_SUP = (pageResponse[5] & 0x10) == 0x10,
|
||||
PRIOR_SUP = (pageResponse[5] & 0x08) == 0x08,
|
||||
HEADSUP = (pageResponse[5] & 0x04) == 0x04,
|
||||
ORDSUP = (pageResponse[5] & 0x02) == 0x02,
|
||||
SIMPSUP = (pageResponse[5] & 0x01) == 0x01,
|
||||
WU_SUP = (pageResponse[6] & 0x08) == 0x08,
|
||||
CRD_SUP = (pageResponse[6] & 0x04) == 0x04,
|
||||
NV_SUP = (pageResponse[6] & 0x02) == 0x02,
|
||||
V_SUP = (pageResponse[6] & 0x01) == 0x01,
|
||||
NO_PI_CHK = (pageResponse[7] & 0x20) == 0x20,
|
||||
P_I_I_SUP = (pageResponse[7] & 0x10) == 0x10,
|
||||
LUICLR = (pageResponse[7] & 0x01) == 0x01,
|
||||
R_SUP = (pageResponse[8] & 0x10) == 0x10,
|
||||
HSSRELEF = (pageResponse[8] & 0x02) == 0x02,
|
||||
CBCS = (pageResponse[8] & 0x01) == 0x01,
|
||||
Nexus = (byte)(pageResponse[9] & 0x0F),
|
||||
ExtendedTestMinutes = (ushort)((pageResponse[10] << 8) + pageResponse[11]),
|
||||
POA_SUP = (pageResponse[12] & 0x80) == 0x80,
|
||||
HRA_SUP = (pageResponse[12] & 0x40) == 0x40,
|
||||
VSA_SUP = (pageResponse[12] & 0x20) == 0x20,
|
||||
MaximumSenseLength = pageResponse[13]
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1225,8 +1225,8 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
{
|
||||
if(!modePage.HasValue) return null;
|
||||
|
||||
Page_86 page = modePage.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Page_86 page = modePage.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.AppendLine("SCSI Extended INQUIRY Data:");
|
||||
|
||||
@@ -1364,20 +1364,20 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
|
||||
Page_89 decoded = new Page_89
|
||||
{
|
||||
PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5),
|
||||
PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F),
|
||||
PageLength = (ushort)((pageResponse[2] << 8) + pageResponse[3] + 4),
|
||||
VendorIdentification = new byte[8],
|
||||
PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5),
|
||||
PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F),
|
||||
PageLength = (ushort)((pageResponse[2] << 8) + pageResponse[3] + 4),
|
||||
VendorIdentification = new byte[8],
|
||||
ProductIdentification = new byte[16],
|
||||
ProductRevisionLevel = new byte[4],
|
||||
Signature = new byte[20],
|
||||
IdentifyData = new byte[512]
|
||||
ProductRevisionLevel = new byte[4],
|
||||
Signature = new byte[20],
|
||||
IdentifyData = new byte[512]
|
||||
};
|
||||
|
||||
Array.Copy(pageResponse, 8, decoded.VendorIdentification, 0, 8);
|
||||
Array.Copy(pageResponse, 8, decoded.VendorIdentification, 0, 8);
|
||||
Array.Copy(pageResponse, 8, decoded.ProductIdentification, 0, 16);
|
||||
Array.Copy(pageResponse, 8, decoded.ProductRevisionLevel, 0, 4);
|
||||
Array.Copy(pageResponse, 8, decoded.Signature, 0, 20);
|
||||
Array.Copy(pageResponse, 8, decoded.ProductRevisionLevel, 0, 4);
|
||||
Array.Copy(pageResponse, 8, decoded.Signature, 0, 20);
|
||||
decoded.CommandCode = pageResponse[56];
|
||||
Array.Copy(pageResponse, 8, decoded.IdentifyData, 0, 512);
|
||||
|
||||
@@ -1394,8 +1394,8 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
{
|
||||
if(!modePage.HasValue) return null;
|
||||
|
||||
Page_89 page = modePage.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Page_89 page = modePage.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.AppendLine("SCSI to ATA Translation Layer Data:");
|
||||
|
||||
@@ -1418,6 +1418,7 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
sb.AppendFormat("\tDevice responded to ATA command {0:X2}h", page.CommandCode).AppendLine();
|
||||
break;
|
||||
}
|
||||
|
||||
switch(page.Signature[0])
|
||||
{
|
||||
case 0x00:
|
||||
@@ -1494,11 +1495,11 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
|
||||
Page_C0_Quantum decoded = new Page_C0_Quantum
|
||||
{
|
||||
PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5),
|
||||
PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F),
|
||||
PageLength = (byte)(pageResponse[3] + 4),
|
||||
PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5),
|
||||
PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F),
|
||||
PageLength = (byte)(pageResponse[3] + 4),
|
||||
ServoFirmwareChecksum = (ushort)((pageResponse[4] << 8) + pageResponse[5]),
|
||||
ServoEEPROMChecksum = (ushort)((pageResponse[6] << 8) + pageResponse[7]),
|
||||
ServoEEPROMChecksum = (ushort)((pageResponse[6] << 8) + pageResponse[7]),
|
||||
ReadWriteFirmwareChecksum =
|
||||
(uint)((pageResponse[8] << 24) + (pageResponse[9] << 16) + (pageResponse[10] << 8) +
|
||||
pageResponse[11]),
|
||||
@@ -1520,7 +1521,7 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
if(!modePage.HasValue) return null;
|
||||
|
||||
Page_C0_Quantum page = modePage.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.AppendLine("Quantum Firmware Build Information page:");
|
||||
|
||||
@@ -1575,19 +1576,19 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
|
||||
Page_C0_C1_Certance decoded = new Page_C0_C1_Certance
|
||||
{
|
||||
PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5),
|
||||
PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5),
|
||||
PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F),
|
||||
PageLength = (byte)(pageResponse[3] + 4),
|
||||
Component = new byte[26],
|
||||
Version = new byte[19],
|
||||
Date = new byte[24],
|
||||
Variant = new byte[23]
|
||||
PageLength = (byte)(pageResponse[3] + 4),
|
||||
Component = new byte[26],
|
||||
Version = new byte[19],
|
||||
Date = new byte[24],
|
||||
Variant = new byte[23]
|
||||
};
|
||||
|
||||
Array.Copy(pageResponse, 4, decoded.Component, 0, 26);
|
||||
Array.Copy(pageResponse, 30, decoded.Version, 0, 19);
|
||||
Array.Copy(pageResponse, 49, decoded.Date, 0, 24);
|
||||
Array.Copy(pageResponse, 73, decoded.Variant, 0, 23);
|
||||
Array.Copy(pageResponse, 4, decoded.Component, 0, 26);
|
||||
Array.Copy(pageResponse, 30, decoded.Version, 0, 19);
|
||||
Array.Copy(pageResponse, 49, decoded.Date, 0, 24);
|
||||
Array.Copy(pageResponse, 73, decoded.Variant, 0, 23);
|
||||
|
||||
return decoded;
|
||||
}
|
||||
@@ -1602,7 +1603,7 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
if(!modePage.HasValue) return null;
|
||||
|
||||
Page_C0_C1_Certance page = modePage.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.AppendLine("Certance Drive Component Revision Levels page:");
|
||||
|
||||
@@ -1654,10 +1655,10 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
|
||||
Page_C2_C3_C4_C5_C6_Certance decoded = new Page_C2_C3_C4_C5_C6_Certance
|
||||
{
|
||||
PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5),
|
||||
PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5),
|
||||
PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F),
|
||||
PageLength = (byte)(pageResponse[3] + 4),
|
||||
SerialNumber = new byte[12]
|
||||
PageLength = (byte)(pageResponse[3] + 4),
|
||||
SerialNumber = new byte[12]
|
||||
};
|
||||
|
||||
Array.Copy(pageResponse, 4, decoded.SerialNumber, 0, 12);
|
||||
@@ -1675,7 +1676,7 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
if(!modePage.HasValue) return null;
|
||||
|
||||
Page_C2_C3_C4_C5_C6_Certance page = modePage.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.AppendLine("Certance Drive Component Serial Number page:");
|
||||
|
||||
@@ -1806,22 +1807,22 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
|
||||
Page_DF_Certance decoded = new Page_DF_Certance
|
||||
{
|
||||
PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5),
|
||||
PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5),
|
||||
PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F),
|
||||
PageLength = (byte)(pageResponse[3] + 4),
|
||||
CmdFwd = (byte)((pageResponse[5] & 0xC0) >> 5),
|
||||
Alerts = (pageResponse[5] & 0x20) == 0x20,
|
||||
NoRemov = (pageResponse[5] & 0x08) == 0x08,
|
||||
UnitRsvd = (pageResponse[5] & 0x04) == 0x04,
|
||||
Clean = (pageResponse[5] & 0x01) == 0x01,
|
||||
Threaded = (pageResponse[6] & 0x10) == 0x10,
|
||||
Lun1Cmd = (pageResponse[6] & 0x08) == 0x08,
|
||||
AutoloadMode = (byte)(pageResponse[6] & 0x07),
|
||||
CartridgeType = pageResponse[8],
|
||||
CartridgeFormat = pageResponse[9],
|
||||
CartridgeCapacity = (ushort)((pageResponse[10] << 8) + pageResponse[11] + 4),
|
||||
PortATransportType = pageResponse[12],
|
||||
PortASelectionID = pageResponse[15],
|
||||
PageLength = (byte)(pageResponse[3] + 4),
|
||||
CmdFwd = (byte)((pageResponse[5] & 0xC0) >> 5),
|
||||
Alerts = (pageResponse[5] & 0x20) == 0x20,
|
||||
NoRemov = (pageResponse[5] & 0x08) == 0x08,
|
||||
UnitRsvd = (pageResponse[5] & 0x04) == 0x04,
|
||||
Clean = (pageResponse[5] & 0x01) == 0x01,
|
||||
Threaded = (pageResponse[6] & 0x10) == 0x10,
|
||||
Lun1Cmd = (pageResponse[6] & 0x08) == 0x08,
|
||||
AutoloadMode = (byte)(pageResponse[6] & 0x07),
|
||||
CartridgeType = pageResponse[8],
|
||||
CartridgeFormat = pageResponse[9],
|
||||
CartridgeCapacity = (ushort)((pageResponse[10] << 8) + pageResponse[11] + 4),
|
||||
PortATransportType = pageResponse[12],
|
||||
PortASelectionID = pageResponse[15],
|
||||
OperatingHours =
|
||||
(uint)((pageResponse[20] << 24) + (pageResponse[21] << 16) + (pageResponse[22] << 8) +
|
||||
pageResponse[23]),
|
||||
@@ -1846,7 +1847,7 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
if(!modePage.HasValue) return null;
|
||||
|
||||
Page_DF_Certance page = modePage.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.AppendLine("Certance drive status page:");
|
||||
|
||||
@@ -1999,15 +2000,15 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
|
||||
Page_C0_IBM decoded = new Page_C0_IBM
|
||||
{
|
||||
PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5),
|
||||
PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5),
|
||||
PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F),
|
||||
PageLength = (byte)(pageResponse[3] + 4),
|
||||
CodeName = new byte[12],
|
||||
Date = new byte[8]
|
||||
PageLength = (byte)(pageResponse[3] + 4),
|
||||
CodeName = new byte[12],
|
||||
Date = new byte[8]
|
||||
};
|
||||
|
||||
Array.Copy(pageResponse, 4, decoded.CodeName, 0, 12);
|
||||
Array.Copy(pageResponse, 23, decoded.Date, 0, 8);
|
||||
Array.Copy(pageResponse, 4, decoded.CodeName, 0, 12);
|
||||
Array.Copy(pageResponse, 23, decoded.Date, 0, 8);
|
||||
|
||||
return decoded;
|
||||
}
|
||||
@@ -2021,8 +2022,8 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
{
|
||||
if(!modePage.HasValue) return null;
|
||||
|
||||
Page_C0_IBM page = modePage.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Page_C0_IBM page = modePage.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.AppendLine("IBM Drive Component Revision Levels page:");
|
||||
|
||||
@@ -2070,15 +2071,15 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
|
||||
Page_C1_IBM decoded = new Page_C1_IBM
|
||||
{
|
||||
PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5),
|
||||
PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5),
|
||||
PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F),
|
||||
PageLength = (byte)(pageResponse[3] + 4),
|
||||
ManufacturingSerial = new byte[12],
|
||||
ReportedSerial = new byte[12]
|
||||
PageLength = (byte)(pageResponse[3] + 4),
|
||||
ManufacturingSerial = new byte[12],
|
||||
ReportedSerial = new byte[12]
|
||||
};
|
||||
|
||||
Array.Copy(pageResponse, 4, decoded.ManufacturingSerial, 0, 12);
|
||||
Array.Copy(pageResponse, 16, decoded.ReportedSerial, 0, 12);
|
||||
Array.Copy(pageResponse, 4, decoded.ManufacturingSerial, 0, 12);
|
||||
Array.Copy(pageResponse, 16, decoded.ReportedSerial, 0, 12);
|
||||
|
||||
return decoded;
|
||||
}
|
||||
@@ -2092,8 +2093,8 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
{
|
||||
if(!modePage.HasValue) return null;
|
||||
|
||||
Page_C1_IBM page = modePage.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Page_C1_IBM page = modePage.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.AppendLine("IBM Drive Serial Numbers page:");
|
||||
|
||||
@@ -2143,11 +2144,11 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
|
||||
Page_B0 decoded = new Page_B0
|
||||
{
|
||||
PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5),
|
||||
PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5),
|
||||
PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F),
|
||||
PageLength = (ushort)((pageResponse[2] << 8) + pageResponse[3] + 4),
|
||||
TSMC = (pageResponse[4] & 0x02) == 0x02,
|
||||
WORM = (pageResponse[4] & 0x01) == 0x01
|
||||
PageLength = (ushort)((pageResponse[2] << 8) + pageResponse[3] + 4),
|
||||
TSMC = (pageResponse[4] & 0x02) == 0x02,
|
||||
WORM = (pageResponse[4] & 0x01) == 0x01
|
||||
};
|
||||
|
||||
return decoded;
|
||||
@@ -2162,8 +2163,8 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
{
|
||||
if(!modePage.HasValue) return null;
|
||||
|
||||
Page_B0 page = modePage.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Page_B0 page = modePage.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.AppendLine("SCSI Sequential-access Device Capabilities:");
|
||||
|
||||
@@ -2226,8 +2227,8 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
|
||||
if(page.Length != page[3] + 4) return null;
|
||||
|
||||
byte[] element = new byte[page.Length - 4];
|
||||
StringBuilder sb = new StringBuilder();
|
||||
byte[] element = new byte[page.Length - 4];
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach(byte b in element) sb.AppendFormat("{0:X2}", b);
|
||||
|
||||
return sb.ToString();
|
||||
@@ -2275,23 +2276,23 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
|
||||
Page_C0_to_C5_HP decoded = new Page_C0_to_C5_HP
|
||||
{
|
||||
PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5),
|
||||
PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5),
|
||||
PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F),
|
||||
PageLength = (byte)(pageResponse[3] + 4),
|
||||
PageCode = pageResponse[1]
|
||||
PageLength = (byte)(pageResponse[3] + 4),
|
||||
PageCode = pageResponse[1]
|
||||
};
|
||||
|
||||
if(pageResponse[3] == 92 && pageResponse.Length >= 96)
|
||||
{
|
||||
decoded.Component = new byte[26];
|
||||
decoded.Version = new byte[19];
|
||||
decoded.Date = new byte[24];
|
||||
decoded.Variant = new byte[23];
|
||||
decoded.Version = new byte[19];
|
||||
decoded.Date = new byte[24];
|
||||
decoded.Variant = new byte[23];
|
||||
|
||||
Array.Copy(pageResponse, 4, decoded.Component, 0, 26);
|
||||
Array.Copy(pageResponse, 30, decoded.Version, 0, 19);
|
||||
Array.Copy(pageResponse, 49, decoded.Date, 0, 24);
|
||||
Array.Copy(pageResponse, 73, decoded.Variant, 0, 23);
|
||||
Array.Copy(pageResponse, 4, decoded.Component, 0, 26);
|
||||
Array.Copy(pageResponse, 30, decoded.Version, 0, 19);
|
||||
Array.Copy(pageResponse, 49, decoded.Date, 0, 24);
|
||||
Array.Copy(pageResponse, 73, decoded.Variant, 0, 23);
|
||||
|
||||
return decoded;
|
||||
}
|
||||
@@ -2301,38 +2302,39 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
List<byte> array = new List<byte>();
|
||||
const string fwRegExStr =
|
||||
@"Firmware Rev\s+=\s+(?<fw>\d+\.\d+)\s+Build date\s+=\s+(?<date>(\w|\d|\s*.)*)\s*$";
|
||||
const string fwcRegExStr = @"FW_CONF\s+=\s+(?<value>0x[0-9A-Fa-f]{8})\s*$";
|
||||
const string fwcRegExStr = @"FW_CONF\s+=\s+(?<value>0x[0-9A-Fa-f]{8})\s*$";
|
||||
const string servoRegExStr = @"Servo\s+Rev\s+=\s+(?<version>\d+\.\d+)\s*$";
|
||||
Regex fwRegEx = new Regex(fwRegExStr);
|
||||
Regex fwcRegEx = new Regex(fwcRegExStr);
|
||||
Regex servoRegEx = new Regex(servoRegExStr);
|
||||
Regex fwRegEx = new Regex(fwRegExStr);
|
||||
Regex fwcRegEx = new Regex(fwcRegExStr);
|
||||
Regex servoRegEx = new Regex(servoRegExStr);
|
||||
|
||||
for(int pos = 5; pos < pageResponse.Length; pos++)
|
||||
if(pageResponse[pos] == 0x00)
|
||||
{
|
||||
string str = StringHandlers.CToString(array.ToArray());
|
||||
Match fwMatch = fwRegEx.Match(str);
|
||||
Match fwcMatch = fwcRegEx.Match(str);
|
||||
Match servoMatch = servoRegEx.Match(str);
|
||||
string str = StringHandlers.CToString(array.ToArray());
|
||||
Match fwMatch = fwRegEx.Match(str);
|
||||
Match fwcMatch = fwcRegEx.Match(str);
|
||||
Match servoMatch = servoRegEx.Match(str);
|
||||
|
||||
if(str.ToLowerInvariant().StartsWith("copyright", StringComparison.Ordinal))
|
||||
decoded.Copyright = Encoding.ASCII.GetBytes(str);
|
||||
else if(fwMatch.Success)
|
||||
{
|
||||
decoded.Component = Encoding.ASCII.GetBytes("Firmware");
|
||||
decoded.Version = Encoding.ASCII.GetBytes(fwMatch.Groups["fw"].Value);
|
||||
decoded.Date = Encoding.ASCII.GetBytes(fwMatch.Groups["date"].Value);
|
||||
decoded.Version = Encoding.ASCII.GetBytes(fwMatch.Groups["fw"].Value);
|
||||
decoded.Date = Encoding.ASCII.GetBytes(fwMatch.Groups["date"].Value);
|
||||
}
|
||||
else if(fwcMatch.Success) decoded.Variant = Encoding.ASCII.GetBytes(fwMatch.Groups["value"].Value);
|
||||
else if(servoMatch.Success)
|
||||
{
|
||||
decoded.Component = Encoding.ASCII.GetBytes("Servo");
|
||||
decoded.Version = Encoding.ASCII.GetBytes(servoMatch.Groups["version"].Value);
|
||||
decoded.Version = Encoding.ASCII.GetBytes(servoMatch.Groups["version"].Value);
|
||||
}
|
||||
|
||||
array = new List<byte>();
|
||||
}
|
||||
else array.Add(pageResponse[pos]);
|
||||
else
|
||||
array.Add(pageResponse[pos]);
|
||||
|
||||
return decoded;
|
||||
}
|
||||
@@ -2347,7 +2349,7 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
if(!modePage.HasValue) return null;
|
||||
|
||||
Page_C0_to_C5_HP page = modePage.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
switch(page.PageCode)
|
||||
{
|
||||
@@ -2424,18 +2426,18 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
|
||||
Page_C0_Seagate decoded = new Page_C0_Seagate
|
||||
{
|
||||
PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5),
|
||||
PeripheralQualifier = (PeripheralQualifiers)((pageResponse[0] & 0xE0) >> 5),
|
||||
PeripheralDeviceType = (PeripheralDeviceTypes)(pageResponse[0] & 0x1F),
|
||||
PageLength = (byte)(pageResponse[3] + 4),
|
||||
PageCode = pageResponse[1],
|
||||
ControllerFirmware = new byte[4],
|
||||
BootFirmware = new byte[4],
|
||||
ServoFirmware = new byte[4]
|
||||
PageLength = (byte)(pageResponse[3] + 4),
|
||||
PageCode = pageResponse[1],
|
||||
ControllerFirmware = new byte[4],
|
||||
BootFirmware = new byte[4],
|
||||
ServoFirmware = new byte[4]
|
||||
};
|
||||
|
||||
Array.Copy(pageResponse, 4, decoded.ControllerFirmware, 0, 4);
|
||||
Array.Copy(pageResponse, 8, decoded.BootFirmware, 0, 4);
|
||||
Array.Copy(pageResponse, 12, decoded.ServoFirmware, 0, 4);
|
||||
Array.Copy(pageResponse, 4, decoded.ControllerFirmware, 0, 4);
|
||||
Array.Copy(pageResponse, 8, decoded.BootFirmware, 0, 4);
|
||||
Array.Copy(pageResponse, 12, decoded.ServoFirmware, 0, 4);
|
||||
|
||||
return decoded;
|
||||
}
|
||||
@@ -2450,7 +2452,7 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
if(!modePage.HasValue) return null;
|
||||
|
||||
Page_C0_Seagate page = modePage.Value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.AppendLine("Seagate Firmware Numbers page:");
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user