Code cleanup.

This commit is contained in:
2018-06-22 08:08:38 +01:00
parent 82f474c7e3
commit 88da8fc019
581 changed files with 22423 additions and 20839 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);

View File

@@ -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

View File

@@ -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);

View File

@@ -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[]>();

View File

@@ -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.");
}

View File

@@ -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)
{

View File

@@ -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(),

View File

@@ -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;

View File

@@ -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)

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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",

View File

@@ -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;
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}

View File

@@ -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)
{

View File

@@ -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;
}

View File

@@ -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 =

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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:");

View File

@@ -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();

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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();

View File

@@ -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;
}
}
}

View File

@@ -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();

View File

@@ -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";
}

View File

@@ -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()
{

View File

@@ -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);

View File

@@ -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
}

View File

@@ -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

View File

@@ -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);

View File

@@ -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));