Reformatted.

This commit is contained in:
2016-04-19 02:11:47 +01:00
parent 6a8499f8ed
commit f8bc81d4f5
149 changed files with 6983 additions and 6970 deletions

View File

@@ -54,7 +54,7 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("Analyze command", "--filesystems={0}", options.SearchForFilesystems);
DicConsole.DebugWriteLine("Analyze command", "--partitions={0}", options.SearchForPartitions);
if (!System.IO.File.Exists(options.InputFile))
if(!System.IO.File.Exists(options.InputFile))
{
DicConsole.ErrorWriteLine("Specified file does not exist.");
return;
@@ -88,7 +88,7 @@ namespace DiscImageChef.Commands
try
{
if (!_imageFormat.OpenImage(options.InputFile))
if(!_imageFormat.OpenImage(options.InputFile))
{
DicConsole.WriteLine("Unable to open image format");
DicConsole.WriteLine("No error given");
@@ -103,23 +103,23 @@ namespace DiscImageChef.Commands
Core.Statistics.AddMediaFormat(_imageFormat.GetImageFormat());
Core.Statistics.AddMedia(_imageFormat.ImageInfo.mediaType, false);
}
catch (Exception ex)
catch(Exception ex)
{
DicConsole.ErrorWriteLine("Unable to open image format");
DicConsole.ErrorWriteLine("Error: {0}", ex.Message);
return;
}
if (options.SearchForPartitions)
if(options.SearchForPartitions)
{
List<CommonTypes.Partition> partitions = new List<CommonTypes.Partition>();
string partition_scheme = "";
// TODO: Solve possibility of multiple partition schemes (CUE + MBR, MBR + RDB, CUE + APM, etc)
foreach (PartPlugin _partplugin in plugins.PartPluginsList.Values)
foreach(PartPlugin _partplugin in plugins.PartPluginsList.Values)
{
List<CommonTypes.Partition> _partitions;
if (_partplugin.GetInformation(_imageFormat, out _partitions))
if(_partplugin.GetInformation(_imageFormat, out _partitions))
{
partition_scheme = _partplugin.Name;
partitions.AddRange(_partitions);
@@ -127,16 +127,16 @@ namespace DiscImageChef.Commands
}
}
if (_imageFormat.ImageHasPartitions())
if(_imageFormat.ImageHasPartitions())
{
partition_scheme = _imageFormat.GetImageFormat();
partitions.AddRange(_imageFormat.GetPartitions());
}
if (partition_scheme == "")
if(partition_scheme == "")
{
DicConsole.DebugWriteLine("Analyze command", "No partitions found");
if (!options.SearchForFilesystems)
if(!options.SearchForFilesystems)
{
DicConsole.WriteLine("No partitions founds, not searching for filesystems");
return;
@@ -148,34 +148,34 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Partition scheme identified as {0}", partition_scheme);
DicConsole.WriteLine("{0} partitions found.", partitions.Count);
for (int i = 0; i < partitions.Count; i++)
for(int i = 0; i < partitions.Count; i++)
{
DicConsole.WriteLine();
DicConsole.WriteLine("Partition {0}:", partitions[i].PartitionSequence);
DicConsole.WriteLine("Partition name: {0}", partitions[i].PartitionName);
DicConsole.WriteLine("Partition type: {0}", partitions[i].PartitionType);
DicConsole.WriteLine("Partition start: sector {0}, byte {1}", partitions[i].PartitionStartSector, partitions[i].PartitionStart);
DicConsole.WriteLine("Partition length: {0} sectors, {1} bytes", partitions[i].PartitionSectors, partitions[i].PartitionLength);
DicConsole.WriteLine("Partition description:");
DicConsole.WriteLine("Partition {0}:", partitions[i].PartitionSequence);
DicConsole.WriteLine("Partition name: {0}", partitions[i].PartitionName);
DicConsole.WriteLine("Partition type: {0}", partitions[i].PartitionType);
DicConsole.WriteLine("Partition start: sector {0}, byte {1}", partitions[i].PartitionStartSector, partitions[i].PartitionStart);
DicConsole.WriteLine("Partition length: {0} sectors, {1} bytes", partitions[i].PartitionSectors, partitions[i].PartitionLength);
DicConsole.WriteLine("Partition description:");
DicConsole.WriteLine(partitions[i].PartitionDescription);
if (options.SearchForFilesystems)
if(options.SearchForFilesystems)
{
DicConsole.WriteLine("Identifying filesystem on partition");
IdentifyFilesystems(_imageFormat, out id_plugins, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector+partitions[i].PartitionSectors);
if (id_plugins.Count == 0)
IdentifyFilesystems(_imageFormat, out id_plugins, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector + partitions[i].PartitionSectors);
if(id_plugins.Count == 0)
DicConsole.WriteLine("Filesystem not identified");
else if (id_plugins.Count > 1)
else if(id_plugins.Count > 1)
{
DicConsole.WriteLine(String.Format("Identified by {0} plugins", id_plugins.Count));
foreach (string plugin_name in id_plugins)
foreach(string plugin_name in id_plugins)
{
if (plugins.PluginsList.TryGetValue(plugin_name, out _plugin))
if(plugins.PluginsList.TryGetValue(plugin_name, out _plugin))
{
DicConsole.WriteLine(String.Format("As identified by {0}.", _plugin.Name));
_plugin.GetInformation(_imageFormat, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector+partitions[i].PartitionSectors, out information);
_plugin.GetInformation(_imageFormat, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector + partitions[i].PartitionSectors, out information);
DicConsole.Write(information);
Core.Statistics.AddFilesystem(_plugin.XmlFSType.Type);
}
@@ -185,7 +185,7 @@ namespace DiscImageChef.Commands
{
plugins.PluginsList.TryGetValue(id_plugins[0], out _plugin);
DicConsole.WriteLine(String.Format("Identified by {0}.", _plugin.Name));
_plugin.GetInformation(_imageFormat, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector+partitions[i].PartitionSectors, out information);
_plugin.GetInformation(_imageFormat, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector + partitions[i].PartitionSectors, out information);
DicConsole.Write(information);
Core.Statistics.AddFilesystem(_plugin.XmlFSType.Type);
}
@@ -194,21 +194,21 @@ namespace DiscImageChef.Commands
}
}
if (checkraw)
if(checkraw)
{
IdentifyFilesystems(_imageFormat, out id_plugins, 0, _imageFormat.GetSectors()-1);
if (id_plugins.Count == 0)
IdentifyFilesystems(_imageFormat, out id_plugins, 0, _imageFormat.GetSectors() - 1);
if(id_plugins.Count == 0)
DicConsole.WriteLine("Filesystem not identified");
else if (id_plugins.Count > 1)
else if(id_plugins.Count > 1)
{
DicConsole.WriteLine(String.Format("Identified by {0} plugins", id_plugins.Count));
foreach (string plugin_name in id_plugins)
foreach(string plugin_name in id_plugins)
{
if (plugins.PluginsList.TryGetValue(plugin_name, out _plugin))
if(plugins.PluginsList.TryGetValue(plugin_name, out _plugin))
{
DicConsole.WriteLine(String.Format("As identified by {0}.", _plugin.Name));
_plugin.GetInformation(_imageFormat, 0, _imageFormat.GetSectors()-1, out information);
_plugin.GetInformation(_imageFormat, 0, _imageFormat.GetSectors() - 1, out information);
DicConsole.Write(information);
Core.Statistics.AddFilesystem(_plugin.XmlFSType.Type);
}
@@ -218,13 +218,13 @@ namespace DiscImageChef.Commands
{
plugins.PluginsList.TryGetValue(id_plugins[0], out _plugin);
DicConsole.WriteLine(String.Format("Identified by {0}.", _plugin.Name));
_plugin.GetInformation(_imageFormat, 0, _imageFormat.GetSectors()-1, out information);
_plugin.GetInformation(_imageFormat, 0, _imageFormat.GetSectors() - 1, out information);
DicConsole.Write(information);
Core.Statistics.AddFilesystem(_plugin.XmlFSType.Type);
}
}
}
catch (Exception ex)
catch(Exception ex)
{
DicConsole.ErrorWriteLine(String.Format("Error reading file: {0}", ex.Message));
DicConsole.DebugWriteLine("Analyze command", ex.StackTrace);
@@ -239,9 +239,9 @@ namespace DiscImageChef.Commands
PluginBase plugins = new PluginBase();
plugins.RegisterAllPlugins();
foreach (Plugin _plugin in plugins.PluginsList.Values)
foreach(Plugin _plugin in plugins.PluginsList.Values)
{
if (_plugin.Identify(imagePlugin, partitionStart, partitionEnd))
if(_plugin.Identify(imagePlugin, partitionStart, partitionEnd))
id_plugins.Add(_plugin.Name.ToLower());
}
}

View File

@@ -62,7 +62,7 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine();
start = DateTime.Now;
for (int i = 0; i < bufferSize / options.BlockSize; i++)
for(int i = 0; i < bufferSize / options.BlockSize; i++)
{
DicConsole.Write("\rWriting block {0} of {1} with random data.", i + 1, bufferSize / options.BlockSize);
byte[] tmp = new byte[options.BlockSize];
@@ -76,12 +76,12 @@ namespace DiscImageChef.Commands
ms.Seek(0, SeekOrigin.Begin);
mem = GC.GetTotalMemory(false);
if (mem > maxMemory)
if(mem > maxMemory)
maxMemory = mem;
if (mem < minMemory)
if(mem < minMemory)
minMemory = mem;
start = DateTime.Now;
for (int i = 0; i < bufferSize / options.BlockSize; i++)
for(int i = 0; i < bufferSize / options.BlockSize; i++)
{
DicConsole.Write("\rReading block {0} of {1}.", i + 1, bufferSize / options.BlockSize);
byte[] tmp = new byte[options.BlockSize];
@@ -89,9 +89,9 @@ namespace DiscImageChef.Commands
}
end = DateTime.Now;
mem = GC.GetTotalMemory(false);
if (mem > maxMemory)
if(mem > maxMemory)
maxMemory = mem;
if (mem < minMemory)
if(mem < minMemory)
minMemory = mem;
DicConsole.WriteLine();
@@ -102,12 +102,12 @@ namespace DiscImageChef.Commands
((Adler32Context)ctx).Init();
ms.Seek(0, SeekOrigin.Begin);
mem = GC.GetTotalMemory(false);
if (mem > maxMemory)
if(mem > maxMemory)
maxMemory = mem;
if (mem < minMemory)
if(mem < minMemory)
minMemory = mem;
start = DateTime.Now;
for (int i = 0; i < bufferSize / options.BlockSize; i++)
for(int i = 0; i < bufferSize / options.BlockSize; i++)
{
DicConsole.Write("\rChecksumming block {0} of {1} with Adler32.", i + 1, bufferSize / options.BlockSize);
byte[] tmp = new byte[options.BlockSize];
@@ -117,9 +117,9 @@ namespace DiscImageChef.Commands
((Adler32Context)ctx).End();
end = DateTime.Now;
mem = GC.GetTotalMemory(false);
if (mem > maxMemory)
if(mem > maxMemory)
maxMemory = mem;
if (mem < minMemory)
if(mem < minMemory)
minMemory = mem;
DicConsole.WriteLine();
@@ -133,12 +133,12 @@ namespace DiscImageChef.Commands
((CRC16Context)ctx).Init();
ms.Seek(0, SeekOrigin.Begin);
mem = GC.GetTotalMemory(false);
if (mem > maxMemory)
if(mem > maxMemory)
maxMemory = mem;
if (mem < minMemory)
if(mem < minMemory)
minMemory = mem;
start = DateTime.Now;
for (int i = 0; i < bufferSize / options.BlockSize; i++)
for(int i = 0; i < bufferSize / options.BlockSize; i++)
{
DicConsole.Write("\rChecksumming block {0} of {1} with CRC16.", i + 1, bufferSize / options.BlockSize);
byte[] tmp = new byte[options.BlockSize];
@@ -148,9 +148,9 @@ namespace DiscImageChef.Commands
((CRC16Context)ctx).End();
end = DateTime.Now;
mem = GC.GetTotalMemory(false);
if (mem > maxMemory)
if(mem > maxMemory)
maxMemory = mem;
if (mem < minMemory)
if(mem < minMemory)
minMemory = mem;
DicConsole.WriteLine();
@@ -164,12 +164,12 @@ namespace DiscImageChef.Commands
((CRC32Context)ctx).Init();
ms.Seek(0, SeekOrigin.Begin);
mem = GC.GetTotalMemory(false);
if (mem > maxMemory)
if(mem > maxMemory)
maxMemory = mem;
if (mem < minMemory)
if(mem < minMemory)
minMemory = mem;
start = DateTime.Now;
for (int i = 0; i < bufferSize / options.BlockSize; i++)
for(int i = 0; i < bufferSize / options.BlockSize; i++)
{
DicConsole.Write("\rChecksumming block {0} of {1} with CRC32.", i + 1, bufferSize / options.BlockSize);
byte[] tmp = new byte[options.BlockSize];
@@ -179,9 +179,9 @@ namespace DiscImageChef.Commands
((CRC32Context)ctx).End();
end = DateTime.Now;
mem = GC.GetTotalMemory(false);
if (mem > maxMemory)
if(mem > maxMemory)
maxMemory = mem;
if (mem < minMemory)
if(mem < minMemory)
minMemory = mem;
DicConsole.WriteLine();
@@ -195,12 +195,12 @@ namespace DiscImageChef.Commands
((CRC64Context)ctx).Init();
ms.Seek(0, SeekOrigin.Begin);
mem = GC.GetTotalMemory(false);
if (mem > maxMemory)
if(mem > maxMemory)
maxMemory = mem;
if (mem < minMemory)
if(mem < minMemory)
minMemory = mem;
start = DateTime.Now;
for (int i = 0; i < bufferSize / options.BlockSize; i++)
for(int i = 0; i < bufferSize / options.BlockSize; i++)
{
DicConsole.Write("\rChecksumming block {0} of {1} with CRC64.", i + 1, bufferSize / options.BlockSize);
byte[] tmp = new byte[options.BlockSize];
@@ -210,9 +210,9 @@ namespace DiscImageChef.Commands
((CRC64Context)ctx).End();
end = DateTime.Now;
mem = GC.GetTotalMemory(false);
if (mem > maxMemory)
if(mem > maxMemory)
maxMemory = mem;
if (mem < minMemory)
if(mem < minMemory)
minMemory = mem;
DicConsole.WriteLine();
@@ -257,12 +257,12 @@ namespace DiscImageChef.Commands
((MD5Context)ctx).Init();
ms.Seek(0, SeekOrigin.Begin);
mem = GC.GetTotalMemory(false);
if (mem > maxMemory)
if(mem > maxMemory)
maxMemory = mem;
if (mem < minMemory)
if(mem < minMemory)
minMemory = mem;
start = DateTime.Now;
for (int i = 0; i < bufferSize / options.BlockSize; i++)
for(int i = 0; i < bufferSize / options.BlockSize; i++)
{
DicConsole.Write("\rChecksumming block {0} of {1} with MD5.", i + 1, bufferSize / options.BlockSize);
byte[] tmp = new byte[options.BlockSize];
@@ -272,9 +272,9 @@ namespace DiscImageChef.Commands
((MD5Context)ctx).End();
end = DateTime.Now;
mem = GC.GetTotalMemory(false);
if (mem > maxMemory)
if(mem > maxMemory)
maxMemory = mem;
if (mem < minMemory)
if(mem < minMemory)
minMemory = mem;
DicConsole.WriteLine();
@@ -288,12 +288,12 @@ namespace DiscImageChef.Commands
((RIPEMD160Context)ctx).Init();
ms.Seek(0, SeekOrigin.Begin);
mem = GC.GetTotalMemory(false);
if (mem > maxMemory)
if(mem > maxMemory)
maxMemory = mem;
if (mem < minMemory)
if(mem < minMemory)
minMemory = mem;
start = DateTime.Now;
for (int i = 0; i < bufferSize / options.BlockSize; i++)
for(int i = 0; i < bufferSize / options.BlockSize; i++)
{
DicConsole.Write("\rChecksumming block {0} of {1} with RIPEMD160.", i + 1, bufferSize / options.BlockSize);
byte[] tmp = new byte[options.BlockSize];
@@ -303,9 +303,9 @@ namespace DiscImageChef.Commands
((RIPEMD160Context)ctx).End();
end = DateTime.Now;
mem = GC.GetTotalMemory(false);
if (mem > maxMemory)
if(mem > maxMemory)
maxMemory = mem;
if (mem < minMemory)
if(mem < minMemory)
minMemory = mem;
DicConsole.WriteLine();
@@ -319,12 +319,12 @@ namespace DiscImageChef.Commands
((SHA1Context)ctx).Init();
ms.Seek(0, SeekOrigin.Begin);
mem = GC.GetTotalMemory(false);
if (mem > maxMemory)
if(mem > maxMemory)
maxMemory = mem;
if (mem < minMemory)
if(mem < minMemory)
minMemory = mem;
start = DateTime.Now;
for (int i = 0; i < bufferSize / options.BlockSize; i++)
for(int i = 0; i < bufferSize / options.BlockSize; i++)
{
DicConsole.Write("\rChecksumming block {0} of {1} with SHA1.", i + 1, bufferSize / options.BlockSize);
byte[] tmp = new byte[options.BlockSize];
@@ -334,9 +334,9 @@ namespace DiscImageChef.Commands
((SHA1Context)ctx).End();
end = DateTime.Now;
mem = GC.GetTotalMemory(false);
if (mem > maxMemory)
if(mem > maxMemory)
maxMemory = mem;
if (mem < minMemory)
if(mem < minMemory)
minMemory = mem;
DicConsole.WriteLine();
@@ -350,12 +350,12 @@ namespace DiscImageChef.Commands
((SHA256Context)ctx).Init();
ms.Seek(0, SeekOrigin.Begin);
mem = GC.GetTotalMemory(false);
if (mem > maxMemory)
if(mem > maxMemory)
maxMemory = mem;
if (mem < minMemory)
if(mem < minMemory)
minMemory = mem;
start = DateTime.Now;
for (int i = 0; i < bufferSize / options.BlockSize; i++)
for(int i = 0; i < bufferSize / options.BlockSize; i++)
{
DicConsole.Write("\rChecksumming block {0} of {1} with SHA256.", i + 1, bufferSize / options.BlockSize);
byte[] tmp = new byte[options.BlockSize];
@@ -365,9 +365,9 @@ namespace DiscImageChef.Commands
((SHA256Context)ctx).End();
end = DateTime.Now;
mem = GC.GetTotalMemory(false);
if (mem > maxMemory)
if(mem > maxMemory)
maxMemory = mem;
if (mem < minMemory)
if(mem < minMemory)
minMemory = mem;
DicConsole.WriteLine();
@@ -381,12 +381,12 @@ namespace DiscImageChef.Commands
((SHA384Context)ctx).Init();
ms.Seek(0, SeekOrigin.Begin);
mem = GC.GetTotalMemory(false);
if (mem > maxMemory)
if(mem > maxMemory)
maxMemory = mem;
if (mem < minMemory)
if(mem < minMemory)
minMemory = mem;
start = DateTime.Now;
for (int i = 0; i < bufferSize / options.BlockSize; i++)
for(int i = 0; i < bufferSize / options.BlockSize; i++)
{
DicConsole.Write("\rChecksumming block {0} of {1} with SHA384.", i + 1, bufferSize / options.BlockSize);
byte[] tmp = new byte[options.BlockSize];
@@ -396,9 +396,9 @@ namespace DiscImageChef.Commands
((SHA384Context)ctx).End();
end = DateTime.Now;
mem = GC.GetTotalMemory(false);
if (mem > maxMemory)
if(mem > maxMemory)
maxMemory = mem;
if (mem < minMemory)
if(mem < minMemory)
minMemory = mem;
DicConsole.WriteLine();
@@ -412,12 +412,12 @@ namespace DiscImageChef.Commands
((SHA512Context)ctx).Init();
ms.Seek(0, SeekOrigin.Begin);
mem = GC.GetTotalMemory(false);
if (mem > maxMemory)
if(mem > maxMemory)
maxMemory = mem;
if (mem < minMemory)
if(mem < minMemory)
minMemory = mem;
start = DateTime.Now;
for (int i = 0; i < bufferSize / options.BlockSize; i++)
for(int i = 0; i < bufferSize / options.BlockSize; i++)
{
DicConsole.Write("\rChecksumming block {0} of {1} with SHA512.", i + 1, bufferSize / options.BlockSize);
byte[] tmp = new byte[options.BlockSize];
@@ -427,9 +427,9 @@ namespace DiscImageChef.Commands
((SHA512Context)ctx).End();
end = DateTime.Now;
mem = GC.GetTotalMemory(false);
if (mem > maxMemory)
if(mem > maxMemory)
maxMemory = mem;
if (mem < minMemory)
if(mem < minMemory)
minMemory = mem;
DicConsole.WriteLine();
@@ -443,12 +443,12 @@ namespace DiscImageChef.Commands
((SpamSumContext)ctx).Init();
ms.Seek(0, SeekOrigin.Begin);
mem = GC.GetTotalMemory(false);
if (mem > maxMemory)
if(mem > maxMemory)
maxMemory = mem;
if (mem < minMemory)
if(mem < minMemory)
minMemory = mem;
start = DateTime.Now;
for (int i = 0; i < bufferSize / options.BlockSize; i++)
for(int i = 0; i < bufferSize / options.BlockSize; i++)
{
DicConsole.Write("\rChecksumming block {0} of {1} with SpamSum.", i + 1, bufferSize / options.BlockSize);
byte[] tmp = new byte[options.BlockSize];
@@ -458,9 +458,9 @@ namespace DiscImageChef.Commands
((SpamSumContext)ctx).End();
end = DateTime.Now;
mem = GC.GetTotalMemory(false);
if (mem > maxMemory)
if(mem > maxMemory)
maxMemory = mem;
if (mem < minMemory)
if(mem < minMemory)
minMemory = mem;
DicConsole.WriteLine();
@@ -473,30 +473,30 @@ namespace DiscImageChef.Commands
ulong[] entTable = new ulong[256];
ms.Seek(0, SeekOrigin.Begin);
mem = GC.GetTotalMemory(false);
if (mem > maxMemory)
if(mem > maxMemory)
maxMemory = mem;
if (mem < minMemory)
if(mem < minMemory)
minMemory = mem;
start = DateTime.Now;
for (int i = 0; i < bufferSize / options.BlockSize; i++)
for(int i = 0; i < bufferSize / options.BlockSize; i++)
{
DicConsole.Write("\rEntropying block {0} of {1}.", i + 1, bufferSize / options.BlockSize);
byte[] tmp = new byte[options.BlockSize];
ms.Read(tmp, 0, options.BlockSize);
foreach (byte b in tmp)
foreach(byte b in tmp)
entTable[b]++;
}
double entropy = 0;
foreach (ulong l in entTable)
foreach(ulong l in entTable)
{
double frequency = (double)l / (double)bufferSize;
entropy += -(frequency * Math.Log(frequency, 2));
}
end = DateTime.Now;
mem = GC.GetTotalMemory(false);
if (mem > maxMemory)
if(mem > maxMemory)
maxMemory = mem;
if (mem < minMemory)
if(mem < minMemory)
minMemory = mem;
DicConsole.WriteLine();
@@ -510,8 +510,8 @@ namespace DiscImageChef.Commands
CRC16Context crc16ctx = new CRC16Context();
CRC32Context crc32ctx = new CRC32Context();
CRC64Context crc64ctx = new CRC64Context();
//Fletcher16Context fletcher16ctx = new Fletcher16Context();
//Fletcher32Context fletcher32ctx = new Fletcher32Context();
//Fletcher16Context fletcher16ctx = new Fletcher16Context();
//Fletcher32Context fletcher32ctx = new Fletcher32Context();
MD5Context md5ctx = new MD5Context();
RIPEMD160Context ripemd160ctx = new RIPEMD160Context();
SHA1Context sha1ctx = new SHA1Context();
@@ -524,8 +524,8 @@ namespace DiscImageChef.Commands
Thread crc16Thread = new Thread(updateCRC16);
Thread crc32Thread = new Thread(updateCRC32);
Thread crc64Thread = new Thread(updateCRC64);
//Thread fletcher16Thread = new Thread(updateFletcher16);
//Thread fletcher32Thread = new Thread(updateFletcher32);
//Thread fletcher16Thread = new Thread(updateFletcher16);
//Thread fletcher32Thread = new Thread(updateFletcher32);
Thread md5Thread = new Thread(updateMD5);
Thread ripemd160Thread = new Thread(updateRIPEMD160);
Thread sha1Thread = new Thread(updateSHA1);
@@ -538,8 +538,8 @@ namespace DiscImageChef.Commands
crc16Packet crc16Pkt = new crc16Packet();
crc32Packet crc32Pkt = new crc32Packet();
crc64Packet crc64Pkt = new crc64Packet();
//fletcher16Packet fletcher16Pkt = new fletcher16Packet();
//fletcher32Packet fletcher32Pkt = new fletcher32Packet();
//fletcher16Packet fletcher16Pkt = new fletcher16Packet();
//fletcher32Packet fletcher32Pkt = new fletcher32Packet();
md5Packet md5Pkt = new md5Packet();
ripemd160Packet ripemd160Pkt = new ripemd160Packet();
sha1Packet sha1Pkt = new sha1Packet();
@@ -557,10 +557,10 @@ namespace DiscImageChef.Commands
crc32Pkt.context = crc32ctx;
crc64ctx.Init();
crc64Pkt.context = crc64ctx;
//fletcher16ctx.Init();
//fletcher16Pkt.context = fletcher16ctx;
//fletcher32ctx.Init();
//fletcher32Pkt.context = fletcher32ctx;
//fletcher16ctx.Init();
//fletcher16Pkt.context = fletcher16ctx;
//fletcher32ctx.Init();
//fletcher32Pkt.context = fletcher32ctx;
md5ctx.Init();
md5Pkt.context = md5ctx;
ripemd160ctx.Init();
@@ -576,7 +576,7 @@ namespace DiscImageChef.Commands
ssctx.Init();
spamsumPkt.context = ssctx;
for (int i = 0; i < bufferSize / options.BlockSize; i++)
for(int i = 0; i < bufferSize / options.BlockSize; i++)
{
DicConsole.Write("\rChecksumming block {0} of {1} with all algorithms at the same time.", i + 1, bufferSize / options.BlockSize);
byte[] tmp = new byte[options.BlockSize];
@@ -586,8 +586,8 @@ namespace DiscImageChef.Commands
crc16Thread = new Thread(updateCRC16);
crc32Thread = new Thread(updateCRC32);
crc64Thread = new Thread(updateCRC64);
// fletcher16Thread = new Thread(updateFletcher16);
// fletcher32Thread = new Thread(updateFletcher32);
// fletcher16Thread = new Thread(updateFletcher16);
// fletcher32Thread = new Thread(updateFletcher32);
md5Thread = new Thread(updateMD5);
ripemd160Thread = new Thread(updateRIPEMD160);
sha1Thread = new Thread(updateSHA1);
@@ -604,10 +604,10 @@ namespace DiscImageChef.Commands
crc32Thread.Start(crc32Pkt);
crc64Pkt.data = tmp;
crc64Thread.Start(crc64Pkt);
//fletcher16Pkt.data = tmp;
//fletcher16Thread.Start(fletcher16Pkt);
//fletcher32Pkt.data = tmp;
//fletcher32Thread.Start(fletcher32Pkt);
//fletcher16Pkt.data = tmp;
//fletcher16Thread.Start(fletcher16Pkt);
//fletcher32Pkt.data = tmp;
//fletcher32Thread.Start(fletcher32Pkt);
md5Pkt.data = tmp;
md5Thread.Start(md5Pkt);
ripemd160Pkt.data = tmp;
@@ -629,23 +629,23 @@ namespace DiscImageChef.Commands
if (mem < minMemory)
minMemory = mem;*/
while (adlerThread.IsAlive || crc16Thread.IsAlive ||
while(adlerThread.IsAlive || crc16Thread.IsAlive ||
crc32Thread.IsAlive || crc64Thread.IsAlive ||
//fletcher16Thread.IsAlive || fletcher32Thread.IsAlive ||
//fletcher16Thread.IsAlive || fletcher32Thread.IsAlive ||
md5Thread.IsAlive || ripemd160Thread.IsAlive ||
sha1Thread.IsAlive || sha256Thread.IsAlive ||
sha384Thread.IsAlive || sha512Thread.IsAlive ||
spamsumThread.IsAlive)
{
}
}
adler32ctx.End();
crc16ctx.End();
crc32ctx.End();
crc64ctx.End();
//fletcher16ctx.End();
//fletcher32ctx.End();
//fletcher16ctx.End();
//fletcher32ctx.End();
md5ctx.End();
ripemd160ctx.End();
sha1ctx.End();
@@ -655,16 +655,16 @@ namespace DiscImageChef.Commands
ssctx.End();
end = DateTime.Now;
mem = GC.GetTotalMemory(false);
if (mem > maxMemory)
if(mem > maxMemory)
maxMemory = mem;
if (mem < minMemory)
if(mem < minMemory)
minMemory = mem;
DicConsole.WriteLine();
DicConsole.WriteLine("Took {0} seconds to do all algorithms at the same time, {1} MiB/sec.", (end - start).TotalSeconds, (bufferSize / 1048576) / (end - start).TotalSeconds);
#endregion
DicConsole.WriteLine("Took {0} seconds to do all algorithms sequentially, {1} MiB/sec.", allSeparate, (bufferSize / 1048576) / allSeparate);
DicConsole.WriteLine();

View File

@@ -68,7 +68,7 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("Checksum command", "--sha512={0}", options.DoSHA512);
DicConsole.DebugWriteLine("Checksum command", "--spamsum={0}", options.DoSpamSum);
if (!System.IO.File.Exists(options.InputFile))
if(!System.IO.File.Exists(options.InputFile))
{
DicConsole.ErrorWriteLine("Specified file does not exist.");
return;
@@ -76,7 +76,7 @@ namespace DiscImageChef.Commands
ImagePlugin inputFormat = ImageFormat.Detect(options.InputFile);
if (inputFormat == null)
if(inputFormat == null)
{
DicConsole.ErrorWriteLine("Unable to recognize image format, not checksumming");
return;
@@ -86,7 +86,7 @@ namespace DiscImageChef.Commands
Core.Statistics.AddMediaFormat(inputFormat.GetImageFormat());
Core.Statistics.AddMedia(inputFormat.ImageInfo.mediaType, false);
if (inputFormat.ImageInfo.imageHasPartitions)
if(inputFormat.ImageInfo.imageHasPartitions)
{
try
{
@@ -160,24 +160,24 @@ namespace DiscImageChef.Commands
sha512Packet sha512PktTrack = new sha512Packet();
spamsumPacket spamsumPktTrack = new spamsumPacket();
if (options.WholeDisc)
if(options.WholeDisc)
{
if (options.DoAdler32)
if(options.DoAdler32)
{
adler32ctx.Init();
adlerPkt.context = adler32ctx;
}
if (options.DoCRC16)
if(options.DoCRC16)
{
crc16ctx.Init();
crc16Pkt.context = crc16ctx;
}
if (options.DoCRC32)
if(options.DoCRC32)
{
crc32ctx.Init();
crc32Pkt.context = crc32ctx;
}
if (options.DoCRC64)
if(options.DoCRC64)
{
crc64ctx.Init();
crc64Pkt.context = crc64ctx;
@@ -192,37 +192,37 @@ namespace DiscImageChef.Commands
fletcher32ctx.Init();
fletcher32Pkt.context = fletcher32ctx;
}*/
if (options.DoMD5)
if(options.DoMD5)
{
md5ctx.Init();
md5Pkt.context = md5ctx;
}
if (options.DoRIPEMD160)
if(options.DoRIPEMD160)
{
ripemd160ctx.Init();
ripemd160Pkt.context = ripemd160ctx;
}
if (options.DoSHA1)
if(options.DoSHA1)
{
sha1ctx.Init();
sha1Pkt.context = sha1ctx;
}
if (options.DoSHA256)
if(options.DoSHA256)
{
sha256ctx.Init();
sha256Pkt.context = sha256ctx;
}
if (options.DoSHA384)
if(options.DoSHA384)
{
sha384ctx.Init();
sha384Pkt.context = sha384ctx;
}
if (options.DoSHA512)
if(options.DoSHA512)
{
sha512ctx.Init();
sha512Pkt.context = sha512ctx;
}
if (options.DoSpamSum)
if(options.DoSpamSum)
{
ssctx.Init();
spamsumPkt.context = ssctx;
@@ -232,33 +232,33 @@ namespace DiscImageChef.Commands
ulong previousTrackEnd = 0;
List<Track> inputTracks = inputFormat.GetTracks();
foreach (Track currentTrack in inputTracks)
foreach(Track currentTrack in inputTracks)
{
if ((currentTrack.TrackStartSector - previousTrackEnd) != 0 &&
if((currentTrack.TrackStartSector - previousTrackEnd) != 0 &&
options.WholeDisc)
{
for (ulong i = previousTrackEnd + 1; i < currentTrack.TrackStartSector; i++)
for(ulong i = previousTrackEnd + 1; i < currentTrack.TrackStartSector; i++)
{
DicConsole.Write("\rHashing track-less sector {0}", i);
byte[] hiddenSector = inputFormat.ReadSector(i);
if (options.DoAdler32)
if(options.DoAdler32)
{
adlerPkt.data = hiddenSector;
adlerThread.Start(adlerPkt);
}
if (options.DoCRC16)
if(options.DoCRC16)
{
crc16Pkt.data = hiddenSector;
crc16Thread.Start(crc16Pkt);
}
if (options.DoCRC32)
if(options.DoCRC32)
{
crc32Pkt.data = hiddenSector;
crc32Thread.Start(crc32Pkt);
}
if (options.DoCRC64)
if(options.DoCRC64)
{
crc64Pkt.data = hiddenSector;
crc64Thread.Start(crc64Pkt);
@@ -273,43 +273,43 @@ namespace DiscImageChef.Commands
fletcher32Pkt.data = hiddenSector;
fletcher32Thread.Start(fletcher32Pkt);
}*/
if (options.DoMD5)
if(options.DoMD5)
{
md5Pkt.data = hiddenSector;
md5Thread.Start(md5Pkt);
}
if (options.DoRIPEMD160)
if(options.DoRIPEMD160)
{
ripemd160Pkt.data = hiddenSector;
ripemd160Thread.Start(ripemd160Pkt);
}
if (options.DoSHA1)
if(options.DoSHA1)
{
sha1Pkt.data = hiddenSector;
sha1Thread.Start(sha1Pkt);
}
if (options.DoSHA256)
if(options.DoSHA256)
{
sha256Pkt.data = hiddenSector;
sha256Thread.Start(sha256Pkt);
}
if (options.DoSHA384)
if(options.DoSHA384)
{
sha384Pkt.data = hiddenSector;
sha384Thread.Start(sha384Pkt);
}
if (options.DoSHA512)
if(options.DoSHA512)
{
sha512Pkt.data = hiddenSector;
sha512Thread.Start(sha512Pkt);
}
if (options.DoSpamSum)
if(options.DoSpamSum)
{
spamsumPkt.data = hiddenSector;
spamsumThread.Start(spamsumPkt);
}
while (adlerThread.IsAlive || crc16Thread.IsAlive ||
while(adlerThread.IsAlive || crc16Thread.IsAlive ||
crc32Thread.IsAlive || crc64Thread.IsAlive ||
//fletcher16Thread.IsAlive || fletcher32Thread.IsAlive ||
md5Thread.IsAlive || ripemd160Thread.IsAlive ||
@@ -338,27 +338,27 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("Checksum command", "Track {0} starts at sector {1} and ends at sector {2}", currentTrack.TrackSequence,
currentTrack.TrackStartSector, currentTrack.TrackEndSector);
if (options.SeparatedTracks)
if(options.SeparatedTracks)
{
if (options.DoAdler32)
if(options.DoAdler32)
{
adler32ctxTrack = new Adler32Context();
adler32ctxTrack.Init();
adlerPktTrack.context = adler32ctxTrack;
}
if (options.DoCRC16)
if(options.DoCRC16)
{
crc16ctxTrack = new CRC16Context();
crc16ctxTrack.Init();
crc16PktTrack.context = crc16ctxTrack;
}
if (options.DoCRC32)
if(options.DoCRC32)
{
crc32ctxTrack = new CRC32Context();
crc32ctxTrack.Init();
crc32PktTrack.context = crc32ctxTrack;
}
if (options.DoCRC64)
if(options.DoCRC64)
{
crc64ctxTrack = new CRC64Context();
crc64ctxTrack.Init();
@@ -376,43 +376,43 @@ namespace DiscImageChef.Commands
fletcher32ctxTrack.Init();
fletcher32PktTrack.context = fletcher32ctxTrack;
}*/
if (options.DoMD5)
if(options.DoMD5)
{
md5ctxTrack = new MD5Context();
md5ctxTrack.Init();
md5PktTrack.context = md5ctxTrack;
}
if (options.DoRIPEMD160)
if(options.DoRIPEMD160)
{
ripemd160ctxTrack = new RIPEMD160Context();
ripemd160ctxTrack.Init();
ripemd160PktTrack.context = ripemd160ctxTrack;
}
if (options.DoSHA1)
if(options.DoSHA1)
{
sha1ctxTrack = new SHA1Context();
sha1ctxTrack.Init();
sha1PktTrack.context = sha1ctxTrack;
}
if (options.DoSHA256)
if(options.DoSHA256)
{
sha256ctxTrack = new SHA256Context();
sha256ctxTrack.Init();
sha256PktTrack.context = sha256ctxTrack;
}
if (options.DoSHA384)
if(options.DoSHA384)
{
sha384ctxTrack = new SHA384Context();
sha384ctxTrack.Init();
sha384PktTrack.context = sha384ctxTrack;
}
if (options.DoSHA512)
if(options.DoSHA512)
{
sha512ctxTrack = new SHA512Context();
sha512ctxTrack.Init();
sha512PktTrack.context = sha512ctxTrack;
}
if (options.DoSpamSum)
if(options.DoSpamSum)
{
ssctxTrack = new SpamSumContext();
ssctxTrack.Init();
@@ -424,11 +424,11 @@ namespace DiscImageChef.Commands
ulong doneSectors = 0;
DicConsole.WriteLine("Track {0} has {1} sectors", currentTrack.TrackSequence, sectors);
while (doneSectors < sectors)
while(doneSectors < sectors)
{
byte[] sector;
if ((sectors - doneSectors) >= sectorsToRead)
if((sectors - doneSectors) >= sectorsToRead)
{
sector = inputFormat.ReadSectors(doneSectors, sectorsToRead, currentTrack.TrackSequence);
DicConsole.Write("\rHashings sectors {0} to {2} of track {1}", doneSectors, currentTrack.TrackSequence, doneSectors + sectorsToRead);
@@ -441,24 +441,24 @@ namespace DiscImageChef.Commands
doneSectors += (sectors - doneSectors);
}
if (options.WholeDisc)
if(options.WholeDisc)
{
if (options.DoAdler32)
if(options.DoAdler32)
{
adlerPkt.data = sector;
adlerThread.Start(adlerPkt);
}
if (options.DoCRC16)
if(options.DoCRC16)
{
crc16Pkt.data = sector;
crc16Thread.Start(crc16Pkt);
}
if (options.DoCRC32)
if(options.DoCRC32)
{
crc32Pkt.data = sector;
crc32Thread.Start(crc32Pkt);
}
if (options.DoCRC64)
if(options.DoCRC64)
{
crc64Pkt.data = sector;
crc64Thread.Start(crc64Pkt);
@@ -473,43 +473,43 @@ namespace DiscImageChef.Commands
fletcher32Pkt.data = sector;
fletcher32Thread.Start(fletcher32Pkt);
}*/
if (options.DoMD5)
if(options.DoMD5)
{
md5Pkt.data = sector;
md5Thread.Start(md5Pkt);
}
if (options.DoRIPEMD160)
if(options.DoRIPEMD160)
{
ripemd160Pkt.data = sector;
ripemd160Thread.Start(ripemd160Pkt);
}
if (options.DoSHA1)
if(options.DoSHA1)
{
sha1Pkt.data = sector;
sha1Thread.Start(sha1Pkt);
}
if (options.DoSHA256)
if(options.DoSHA256)
{
sha256Pkt.data = sector;
sha256Thread.Start(sha256Pkt);
}
if (options.DoSHA384)
if(options.DoSHA384)
{
sha384Pkt.data = sector;
sha384Thread.Start(sha384Pkt);
}
if (options.DoSHA512)
if(options.DoSHA512)
{
sha512Pkt.data = sector;
sha512Thread.Start(sha512Pkt);
}
if (options.DoSpamSum)
if(options.DoSpamSum)
{
spamsumPkt.data = sector;
spamsumThread.Start(spamsumPkt);
}
while (adlerThread.IsAlive || crc16Thread.IsAlive ||
while(adlerThread.IsAlive || crc16Thread.IsAlive ||
crc32Thread.IsAlive || crc64Thread.IsAlive ||
//fletcher16Thread.IsAlive || fletcher32Thread.IsAlive ||
md5Thread.IsAlive || ripemd160Thread.IsAlive ||
@@ -534,24 +534,24 @@ namespace DiscImageChef.Commands
spamsumThread = new Thread(updateSpamSum);
}
if (options.SeparatedTracks)
if(options.SeparatedTracks)
{
if (options.DoAdler32)
if(options.DoAdler32)
{
adlerPktTrack.data = sector;
adlerThread.Start(adlerPktTrack);
}
if (options.DoCRC16)
if(options.DoCRC16)
{
crc16PktTrack.data = sector;
crc16Thread.Start(crc16PktTrack);
}
if (options.DoCRC32)
if(options.DoCRC32)
{
crc32PktTrack.data = sector;
crc32Thread.Start(crc32PktTrack);
}
if (options.DoCRC64)
if(options.DoCRC64)
{
crc64PktTrack.data = sector;
crc64Thread.Start(crc64PktTrack);
@@ -566,43 +566,43 @@ namespace DiscImageChef.Commands
fletcher32PktTrack.data = sector;
fletcher32Thread.Start(fletcher32PktTrack);
}*/
if (options.DoMD5)
if(options.DoMD5)
{
md5PktTrack.data = sector;
md5Thread.Start(md5PktTrack);
}
if (options.DoRIPEMD160)
if(options.DoRIPEMD160)
{
ripemd160PktTrack.data = sector;
ripemd160Thread.Start(ripemd160PktTrack);
}
if (options.DoSHA1)
if(options.DoSHA1)
{
sha1PktTrack.data = sector;
sha1Thread.Start(sha1PktTrack);
}
if (options.DoSHA256)
if(options.DoSHA256)
{
sha256PktTrack.data = sector;
sha256Thread.Start(sha256PktTrack);
}
if (options.DoSHA384)
if(options.DoSHA384)
{
sha384PktTrack.data = sector;
sha384Thread.Start(sha384PktTrack);
}
if (options.DoSHA512)
if(options.DoSHA512)
{
sha512PktTrack.data = sector;
sha512Thread.Start(sha512PktTrack);
}
if (options.DoSpamSum)
if(options.DoSpamSum)
{
spamsumPktTrack.data = sector;
spamsumThread.Start(spamsumPktTrack);
}
while (adlerThread.IsAlive || crc16Thread.IsAlive ||
while(adlerThread.IsAlive || crc16Thread.IsAlive ||
crc32Thread.IsAlive || crc64Thread.IsAlive ||
//fletcher16Thread.IsAlive || fletcher32Thread.IsAlive ||
md5Thread.IsAlive || ripemd160Thread.IsAlive ||
@@ -630,64 +630,64 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine();
if (options.SeparatedTracks)
if(options.SeparatedTracks)
{
if (options.DoAdler32)
if(options.DoAdler32)
DicConsole.WriteLine("Track {0}'s Adler-32: 0x{1}", currentTrack.TrackSequence, adler32ctxTrack.End());
if (options.DoCRC16)
if(options.DoCRC16)
DicConsole.WriteLine("Track {0}'s CRC16: 0x{1}", currentTrack.TrackSequence, crc16ctxTrack.End());
if (options.DoCRC32)
if(options.DoCRC32)
DicConsole.WriteLine("Track {0}'s CRC32: 0x{1}", currentTrack.TrackSequence, crc32ctxTrack.End());
if (options.DoCRC64)
if(options.DoCRC64)
DicConsole.WriteLine("Track {0}'s CRC64 (ECMA): 0x{1}", currentTrack.TrackSequence, crc64ctxTrack.End());
/*if (options.DoFletcher16)
DicConsole.WriteLine("Track {0}'s Fletcher-16: 0x{1}", currentTrack.TrackSequence, fletcher16ctxTrack.End());
if (options.DoFletcher32)
DicConsole.WriteLine("Track {0}'s Fletcher-32: 0x{1}", currentTrack.TrackSequence, fletcher32ctxTrack.End());*/
if (options.DoMD5)
if(options.DoMD5)
DicConsole.WriteLine("Track {0}'s MD5: {1}", currentTrack.TrackSequence, md5ctxTrack.End());
if (options.DoRIPEMD160)
if(options.DoRIPEMD160)
DicConsole.WriteLine("Track {0}'s RIPEMD160: {1}", currentTrack.TrackSequence, ripemd160ctxTrack.End());
if (options.DoSHA1)
if(options.DoSHA1)
DicConsole.WriteLine("Track {0}'s SHA1: {1}", currentTrack.TrackSequence, sha1ctxTrack.End());
if (options.DoSHA256)
if(options.DoSHA256)
DicConsole.WriteLine("Track {0}'s SHA256: {1}", currentTrack.TrackSequence, sha256ctxTrack.End());
if (options.DoSHA384)
if(options.DoSHA384)
DicConsole.WriteLine("Track {0}'s SHA384: {1}", currentTrack.TrackSequence, sha384ctxTrack.End());
if (options.DoSHA512)
if(options.DoSHA512)
DicConsole.WriteLine("Track {0}'s SHA512: {1}", currentTrack.TrackSequence, sha512ctxTrack.End());
if (options.DoSpamSum)
if(options.DoSpamSum)
DicConsole.WriteLine("Track {0}'s SpamSum: {1}", currentTrack.TrackSequence, ssctxTrack.End());
}
previousTrackEnd = currentTrack.TrackEndSector;
}
if ((inputFormat.GetSectors() - previousTrackEnd) != 0 &&
if((inputFormat.GetSectors() - previousTrackEnd) != 0 &&
options.WholeDisc)
{
for (ulong i = previousTrackEnd + 1; i < inputFormat.GetSectors(); i++)
for(ulong i = previousTrackEnd + 1; i < inputFormat.GetSectors(); i++)
{
DicConsole.Write("\rHashing track-less sector {0}", i);
byte[] hiddenSector = inputFormat.ReadSector(i);
if (options.DoAdler32)
if(options.DoAdler32)
{
adlerPkt.data = hiddenSector;
adlerThread.Start(adlerPkt);
}
if (options.DoCRC16)
if(options.DoCRC16)
{
crc16Pkt.data = hiddenSector;
crc16Thread.Start(crc16Pkt);
}
if (options.DoCRC32)
if(options.DoCRC32)
{
crc32Pkt.data = hiddenSector;
crc32Thread.Start(crc32Pkt);
}
if (options.DoCRC64)
if(options.DoCRC64)
{
crc64Pkt.data = hiddenSector;
crc64Thread.Start(crc64Pkt);
@@ -702,43 +702,43 @@ namespace DiscImageChef.Commands
fletcher32Pkt.data = hiddenSector;
fletcher32Thread.Start(fletcher32Pkt);
}*/
if (options.DoMD5)
if(options.DoMD5)
{
md5Pkt.data = hiddenSector;
md5Thread.Start(md5Pkt);
}
if (options.DoRIPEMD160)
if(options.DoRIPEMD160)
{
ripemd160Pkt.data = hiddenSector;
ripemd160Thread.Start(ripemd160Pkt);
}
if (options.DoSHA1)
if(options.DoSHA1)
{
sha1Pkt.data = hiddenSector;
sha1Thread.Start(sha1Pkt);
}
if (options.DoSHA256)
if(options.DoSHA256)
{
sha256Pkt.data = hiddenSector;
sha256Thread.Start(sha256Pkt);
}
if (options.DoSHA384)
if(options.DoSHA384)
{
sha384Pkt.data = hiddenSector;
sha384Thread.Start(sha384Pkt);
}
if (options.DoSHA512)
if(options.DoSHA512)
{
sha512Pkt.data = hiddenSector;
sha512Thread.Start(sha512Pkt);
}
if (options.DoSpamSum)
if(options.DoSpamSum)
{
spamsumPkt.data = hiddenSector;
spamsumThread.Start(spamsumPkt);
}
while (adlerThread.IsAlive || crc16Thread.IsAlive ||
while(adlerThread.IsAlive || crc16Thread.IsAlive ||
crc32Thread.IsAlive || crc64Thread.IsAlive ||
//fletcher16Thread.IsAlive || fletcher32Thread.IsAlive ||
md5Thread.IsAlive || ripemd160Thread.IsAlive ||
@@ -764,39 +764,39 @@ namespace DiscImageChef.Commands
}
}
if (options.WholeDisc)
if(options.WholeDisc)
{
if (options.DoAdler32)
if(options.DoAdler32)
DicConsole.WriteLine("Disk's Adler-32: 0x{0}", adler32ctx.End());
if (options.DoCRC16)
if(options.DoCRC16)
DicConsole.WriteLine("Disk's CRC16: 0x{0}", crc16ctx.End());
if (options.DoCRC32)
if(options.DoCRC32)
DicConsole.WriteLine("Disk's CRC32: 0x{0}", crc32ctx.End());
if (options.DoCRC64)
if(options.DoCRC64)
DicConsole.WriteLine("Disk's CRC64 (ECMA): 0x{0}", crc64ctx.End());
/*if (options.DoFletcher16)
DicConsole.WriteLine("Disk's Fletcher-16: 0x{0}", fletcher16ctx.End());
if (options.DoFletcher32)
DicConsole.WriteLine("Disk's Fletcher-32: 0x{0}", fletcher32ctx.End());*/
if (options.DoMD5)
if(options.DoMD5)
DicConsole.WriteLine("Disk's MD5: {0}", md5ctx.End());
if (options.DoRIPEMD160)
if(options.DoRIPEMD160)
DicConsole.WriteLine("Disk's RIPEMD160: {0}", ripemd160ctx.End());
if (options.DoSHA1)
if(options.DoSHA1)
DicConsole.WriteLine("Disk's SHA1: {0}", sha1ctx.End());
if (options.DoSHA256)
if(options.DoSHA256)
DicConsole.WriteLine("Disk's SHA256: {0}", sha256ctx.End());
if (options.DoSHA384)
if(options.DoSHA384)
DicConsole.WriteLine("Disk's SHA384: {0}", sha384ctx.End());
if (options.DoSHA512)
if(options.DoSHA512)
DicConsole.WriteLine("Disk's SHA512: {0}", sha512ctx.End());
if (options.DoSpamSum)
if(options.DoSpamSum)
DicConsole.WriteLine("Disk's SpamSum: {0}", ssctx.End());
}
}
catch (Exception ex)
catch(Exception ex)
{
if (options.Debug)
if(options.Debug)
DicConsole.DebugWriteLine("Could not get tracks because {0}", ex.Message);
else
DicConsole.WriteLine("Unable to get separate tracks, not checksumming them");
@@ -846,22 +846,22 @@ namespace DiscImageChef.Commands
sha512Packet sha512Pkt = new sha512Packet();
spamsumPacket spamsumPkt = new spamsumPacket();
if (options.DoAdler32)
if(options.DoAdler32)
{
adler32ctx.Init();
adlerPkt.context = adler32ctx;
}
if (options.DoCRC16)
if(options.DoCRC16)
{
crc16ctx.Init();
crc16Pkt.context = crc16ctx;
}
if (options.DoCRC32)
if(options.DoCRC32)
{
crc32ctx.Init();
crc32Pkt.context = crc32ctx;
}
if (options.DoCRC64)
if(options.DoCRC64)
{
crc64ctx.Init();
crc64Pkt.context = crc64ctx;
@@ -876,37 +876,37 @@ namespace DiscImageChef.Commands
fletcher32ctx.Init();
fletcher32Pkt.context = fletcher32ctx;
}*/
if (options.DoMD5)
if(options.DoMD5)
{
md5ctx.Init();
md5Pkt.context = md5ctx;
}
if (options.DoRIPEMD160)
if(options.DoRIPEMD160)
{
ripemd160ctx.Init();
ripemd160Pkt.context = ripemd160ctx;
}
if (options.DoSHA1)
if(options.DoSHA1)
{
sha1ctx.Init();
sha1Pkt.context = sha1ctx;
}
if (options.DoSHA256)
if(options.DoSHA256)
{
sha256ctx.Init();
sha256Pkt.context = sha256ctx;
}
if (options.DoSHA384)
if(options.DoSHA384)
{
sha384ctx.Init();
sha384Pkt.context = sha384ctx;
}
if (options.DoSHA512)
if(options.DoSHA512)
{
sha512ctx.Init();
sha512Pkt.context = sha512ctx;
}
if (options.DoSpamSum)
if(options.DoSpamSum)
{
ssctx.Init();
spamsumPkt.context = ssctx;
@@ -916,11 +916,11 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Sectors {0}", sectors);
ulong doneSectors = 0;
while (doneSectors < sectors)
while(doneSectors < sectors)
{
byte[] sector;
if ((sectors - doneSectors) >= sectorsToRead)
if((sectors - doneSectors) >= sectorsToRead)
{
sector = inputFormat.ReadSectors(doneSectors, sectorsToRead);
DicConsole.Write("\rHashings sectors {0} to {1}", doneSectors, doneSectors + sectorsToRead);
@@ -933,22 +933,22 @@ namespace DiscImageChef.Commands
doneSectors += (sectors - doneSectors);
}
if (options.DoAdler32)
if(options.DoAdler32)
{
adlerPkt.data = sector;
adlerThread.Start(adlerPkt);
}
if (options.DoCRC16)
if(options.DoCRC16)
{
crc16Pkt.data = sector;
crc16Thread.Start(crc16Pkt);
}
if (options.DoCRC32)
if(options.DoCRC32)
{
crc32Pkt.data = sector;
crc32Thread.Start(crc32Pkt);
}
if (options.DoCRC64)
if(options.DoCRC64)
{
crc64Pkt.data = sector;
crc64Thread.Start(crc64Pkt);
@@ -963,43 +963,43 @@ namespace DiscImageChef.Commands
fletcher32Pkt.data = sector;
fletcher32Thread.Start(fletcher32Pkt);
}*/
if (options.DoMD5)
if(options.DoMD5)
{
md5Pkt.data = sector;
md5Thread.Start(md5Pkt);
}
if (options.DoRIPEMD160)
if(options.DoRIPEMD160)
{
ripemd160Pkt.data = sector;
ripemd160Thread.Start(ripemd160Pkt);
}
if (options.DoSHA1)
if(options.DoSHA1)
{
sha1Pkt.data = sector;
sha1Thread.Start(sha1Pkt);
}
if (options.DoSHA256)
if(options.DoSHA256)
{
sha256Pkt.data = sector;
sha256Thread.Start(sha256Pkt);
}
if (options.DoSHA384)
if(options.DoSHA384)
{
sha384Pkt.data = sector;
sha384Thread.Start(sha384Pkt);
}
if (options.DoSHA512)
if(options.DoSHA512)
{
sha512Pkt.data = sector;
sha512Thread.Start(sha512Pkt);
}
if (options.DoSpamSum)
if(options.DoSpamSum)
{
spamsumPkt.data = sector;
spamsumThread.Start(spamsumPkt);
}
while (adlerThread.IsAlive || crc16Thread.IsAlive ||
while(adlerThread.IsAlive || crc16Thread.IsAlive ||
crc32Thread.IsAlive || crc64Thread.IsAlive ||
//fletcher16Thread.IsAlive || fletcher32Thread.IsAlive ||
md5Thread.IsAlive || ripemd160Thread.IsAlive ||
@@ -1026,31 +1026,31 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine();
if (options.DoAdler32)
if(options.DoAdler32)
DicConsole.WriteLine("Disk's Adler-32: 0x{0}", adler32ctx.End());
if (options.DoCRC16)
if(options.DoCRC16)
DicConsole.WriteLine("Disk's CRC16: 0x{0}", crc16ctx.End());
if (options.DoCRC32)
if(options.DoCRC32)
DicConsole.WriteLine("Disk's CRC32: 0x{0}", crc32ctx.End());
if (options.DoCRC64)
if(options.DoCRC64)
DicConsole.WriteLine("Disk's CRC64 (ECMA): 0x{0}", crc64ctx.End());
/*if (options.DoFletcher16)
DicConsole.WriteLine("Disk's Fletcher-16: 0x{0}", fletcher16ctx.End());
if (options.DoFletcher32)
DicConsole.WriteLine("Disk's Fletcher-32: 0x{0}", fletcher32ctx.End());*/
if (options.DoMD5)
if(options.DoMD5)
DicConsole.WriteLine("Disk's MD5: {0}", md5ctx.End());
if (options.DoRIPEMD160)
if(options.DoRIPEMD160)
DicConsole.WriteLine("Disk's RIPEMD160: {0}", ripemd160ctx.End());
if (options.DoSHA1)
if(options.DoSHA1)
DicConsole.WriteLine("Disk's SHA1: {0}", sha1ctx.End());
if (options.DoSHA256)
if(options.DoSHA256)
DicConsole.WriteLine("Disk's SHA256: {0}", sha256ctx.End());
if (options.DoSHA384)
if(options.DoSHA384)
DicConsole.WriteLine("Disk's SHA384: {0}", sha384ctx.End());
if (options.DoSHA512)
if(options.DoSHA512)
DicConsole.WriteLine("Disk's SHA512: {0}", sha512ctx.End());
if (options.DoSpamSum)
if(options.DoSpamSum)
DicConsole.WriteLine("Disk's SpamSum: {0}", ssctx.End());
}

View File

@@ -52,13 +52,13 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("Compare command", "--input1={0}", options.InputFile1);
DicConsole.DebugWriteLine("Compare command", "--input2={0}", options.InputFile2);
if (!System.IO.File.Exists(options.InputFile1))
if(!System.IO.File.Exists(options.InputFile1))
{
DicConsole.ErrorWriteLine("Input file 1 does not exist.");
return;
}
if (!System.IO.File.Exists(options.InputFile2))
if(!System.IO.File.Exists(options.InputFile2))
{
DicConsole.ErrorWriteLine("Input file 2 does not exist.");
return;
@@ -103,7 +103,7 @@ namespace DiscImageChef.Commands
StringBuilder sb = new StringBuilder();
if (options.Verbose)
if(options.Verbose)
{
sb.AppendLine("\tDisc image 1\tDisc image 2");
sb.AppendLine("================================");
@@ -126,8 +126,8 @@ namespace DiscImageChef.Commands
Dictionary<MediaTagType, byte[]> image2DiskTags = new Dictionary<MediaTagType, byte[]>();
image1Info.imageHasPartitions = input1Format.ImageHasPartitions();
try{ image1Sessions = input1Format.GetSessions(); } catch{}
if (image1Sessions.Count > 0)
try { image1Sessions = input1Format.GetSessions(); } catch { }
if(image1Sessions.Count > 0)
image1Info.imageHasSessions = true;
image1Info.imageSize = input1Format.GetImageSize();
image1Info.sectors = input1Format.GetSectors();
@@ -135,35 +135,37 @@ namespace DiscImageChef.Commands
image1Info.imageCreationTime = input1Format.GetImageCreationTime();
image1Info.imageLastModificationTime = input1Format.GetImageLastModificationTime();
image1Info.mediaType = input1Format.GetMediaType();
try{ image1Info.imageVersion = input1Format.GetImageVersion(); } catch{ image1Info.imageVersion = null;}
try{ image1Info.imageApplication = input1Format.GetImageApplication(); } catch{ image1Info.imageApplication = null;}
try{ image1Info.imageApplicationVersion = input1Format.GetImageApplicationVersion(); } catch{ image1Info.imageApplicationVersion = null;}
try{ image1Info.imageCreator = input1Format.GetImageCreator(); } catch{ image1Info.imageCreator = null;}
try{ image1Info.imageName = input1Format.GetImageName(); } catch{ image1Info.imageName = null;}
try{ image1Info.imageComments = input1Format.GetImageComments(); } catch{ image1Info.imageComments = null;}
try{ image1Info.mediaManufacturer = input1Format.GetMediaManufacturer(); } catch{ image1Info.mediaManufacturer = null;}
try{ image1Info.mediaModel = input1Format.GetMediaModel(); } catch{ image1Info.mediaModel = null;}
try{ image1Info.mediaSerialNumber = input1Format.GetMediaSerialNumber(); } catch{ image1Info.mediaSerialNumber = null;}
try{ image1Info.mediaBarcode = input1Format.GetMediaBarcode(); } catch{ image1Info.mediaBarcode = null;}
try{ image1Info.mediaPartNumber = input1Format.GetMediaPartNumber(); } catch{ image1Info.mediaPartNumber = null;}
try{ image1Info.mediaSequence = input1Format.GetMediaSequence(); } catch{ image1Info.mediaSequence = 0;}
try{ image1Info.lastMediaSequence = input1Format.GetLastDiskSequence(); } catch{ image1Info.lastMediaSequence = 0;}
try{ image1Info.driveManufacturer = input1Format.GetDriveManufacturer(); } catch{ image1Info.driveManufacturer = null;}
try{ image1Info.driveModel = input1Format.GetDriveModel(); } catch{ image1Info.driveModel = null;}
try{ image1Info.driveSerialNumber = input1Format.GetDriveSerialNumber(); } catch{ image1Info.driveSerialNumber = null;}
foreach (MediaTagType disktag in Enum.GetValues(typeof(MediaTagType)))
try { image1Info.imageVersion = input1Format.GetImageVersion(); } catch { image1Info.imageVersion = null; }
try { image1Info.imageApplication = input1Format.GetImageApplication(); } catch { image1Info.imageApplication = null; }
try { image1Info.imageApplicationVersion = input1Format.GetImageApplicationVersion(); } catch { image1Info.imageApplicationVersion = null; }
try { image1Info.imageCreator = input1Format.GetImageCreator(); } catch { image1Info.imageCreator = null; }
try { image1Info.imageName = input1Format.GetImageName(); } catch { image1Info.imageName = null; }
try { image1Info.imageComments = input1Format.GetImageComments(); } catch { image1Info.imageComments = null; }
try { image1Info.mediaManufacturer = input1Format.GetMediaManufacturer(); } catch { image1Info.mediaManufacturer = null; }
try { image1Info.mediaModel = input1Format.GetMediaModel(); } catch { image1Info.mediaModel = null; }
try { image1Info.mediaSerialNumber = input1Format.GetMediaSerialNumber(); } catch { image1Info.mediaSerialNumber = null; }
try { image1Info.mediaBarcode = input1Format.GetMediaBarcode(); } catch { image1Info.mediaBarcode = null; }
try { image1Info.mediaPartNumber = input1Format.GetMediaPartNumber(); } catch { image1Info.mediaPartNumber = null; }
try { image1Info.mediaSequence = input1Format.GetMediaSequence(); } catch { image1Info.mediaSequence = 0; }
try { image1Info.lastMediaSequence = input1Format.GetLastDiskSequence(); } catch { image1Info.lastMediaSequence = 0; }
try { image1Info.driveManufacturer = input1Format.GetDriveManufacturer(); } catch { image1Info.driveManufacturer = null; }
try { image1Info.driveModel = input1Format.GetDriveModel(); } catch { image1Info.driveModel = null; }
try { image1Info.driveSerialNumber = input1Format.GetDriveSerialNumber(); } catch { image1Info.driveSerialNumber = null; }
foreach(MediaTagType disktag in Enum.GetValues(typeof(MediaTagType)))
{
try{
try
{
byte[] temparray = input1Format.ReadDiskTag(disktag);
image1DiskTags.Add(disktag, temparray);
}
catch{
catch
{
}
}
image2Info.imageHasPartitions = input2Format.ImageHasPartitions();
try{ image2Sessions = input2Format.GetSessions(); } catch{}
if (image2Sessions.Count > 0)
try { image2Sessions = input2Format.GetSessions(); } catch { }
if(image2Sessions.Count > 0)
image2Info.imageHasSessions = true;
image2Info.imageSize = input2Format.GetImageSize();
image2Info.sectors = input2Format.GetSectors();
@@ -171,33 +173,35 @@ namespace DiscImageChef.Commands
image2Info.imageCreationTime = input2Format.GetImageCreationTime();
image2Info.imageLastModificationTime = input2Format.GetImageLastModificationTime();
image2Info.mediaType = input2Format.GetMediaType();
try{ image2Info.imageVersion = input2Format.GetImageVersion(); } catch{ image2Info.imageVersion = null;}
try{ image2Info.imageApplication = input2Format.GetImageApplication(); } catch{ image2Info.imageApplication = null;}
try{ image2Info.imageApplicationVersion = input2Format.GetImageApplicationVersion(); } catch{ image2Info.imageApplicationVersion = null;}
try{ image2Info.imageCreator = input2Format.GetImageCreator(); } catch{ image2Info.imageCreator = null;}
try{ image2Info.imageName = input2Format.GetImageName(); } catch{ image2Info.imageName = null;}
try{ image2Info.imageComments = input2Format.GetImageComments(); } catch{ image2Info.imageComments = null;}
try{ image2Info.mediaManufacturer = input2Format.GetMediaManufacturer(); } catch{ image2Info.mediaManufacturer = null;}
try{ image2Info.mediaModel = input2Format.GetMediaModel(); } catch{ image2Info.mediaModel = null;}
try{ image2Info.mediaSerialNumber = input2Format.GetMediaSerialNumber(); } catch{ image2Info.mediaSerialNumber = null;}
try{ image2Info.mediaBarcode = input2Format.GetMediaBarcode(); } catch{ image2Info.mediaBarcode = null;}
try{ image2Info.mediaPartNumber = input2Format.GetMediaPartNumber(); } catch{ image2Info.mediaPartNumber = null;}
try{ image2Info.mediaSequence = input2Format.GetMediaSequence(); } catch{ image2Info.mediaSequence = 0;}
try{ image2Info.lastMediaSequence = input2Format.GetLastDiskSequence(); } catch{ image2Info.lastMediaSequence = 0;}
try{ image2Info.driveManufacturer = input2Format.GetDriveManufacturer(); } catch{ image2Info.driveManufacturer = null;}
try{ image2Info.driveModel = input2Format.GetDriveModel(); } catch{ image2Info.driveModel = null;}
try{ image2Info.driveSerialNumber = input2Format.GetDriveSerialNumber(); } catch{ image2Info.driveSerialNumber = null;}
foreach (MediaTagType disktag in Enum.GetValues(typeof(MediaTagType)))
try { image2Info.imageVersion = input2Format.GetImageVersion(); } catch { image2Info.imageVersion = null; }
try { image2Info.imageApplication = input2Format.GetImageApplication(); } catch { image2Info.imageApplication = null; }
try { image2Info.imageApplicationVersion = input2Format.GetImageApplicationVersion(); } catch { image2Info.imageApplicationVersion = null; }
try { image2Info.imageCreator = input2Format.GetImageCreator(); } catch { image2Info.imageCreator = null; }
try { image2Info.imageName = input2Format.GetImageName(); } catch { image2Info.imageName = null; }
try { image2Info.imageComments = input2Format.GetImageComments(); } catch { image2Info.imageComments = null; }
try { image2Info.mediaManufacturer = input2Format.GetMediaManufacturer(); } catch { image2Info.mediaManufacturer = null; }
try { image2Info.mediaModel = input2Format.GetMediaModel(); } catch { image2Info.mediaModel = null; }
try { image2Info.mediaSerialNumber = input2Format.GetMediaSerialNumber(); } catch { image2Info.mediaSerialNumber = null; }
try { image2Info.mediaBarcode = input2Format.GetMediaBarcode(); } catch { image2Info.mediaBarcode = null; }
try { image2Info.mediaPartNumber = input2Format.GetMediaPartNumber(); } catch { image2Info.mediaPartNumber = null; }
try { image2Info.mediaSequence = input2Format.GetMediaSequence(); } catch { image2Info.mediaSequence = 0; }
try { image2Info.lastMediaSequence = input2Format.GetLastDiskSequence(); } catch { image2Info.lastMediaSequence = 0; }
try { image2Info.driveManufacturer = input2Format.GetDriveManufacturer(); } catch { image2Info.driveManufacturer = null; }
try { image2Info.driveModel = input2Format.GetDriveModel(); } catch { image2Info.driveModel = null; }
try { image2Info.driveSerialNumber = input2Format.GetDriveSerialNumber(); } catch { image2Info.driveSerialNumber = null; }
foreach(MediaTagType disktag in Enum.GetValues(typeof(MediaTagType)))
{
try{
try
{
byte[] temparray = input2Format.ReadDiskTag(disktag);
image2DiskTags.Add(disktag, temparray);
}
catch{
catch
{
}
}
if (options.Verbose)
if(options.Verbose)
{
sb.AppendFormat("Has partitions?\t{0}\t{1}", image1Info.imageHasPartitions, image2Info.imageHasPartitions).AppendLine();
sb.AppendFormat("Has sessions?\t{0}\t{1}", image1Info.imageHasSessions, image2Info.imageHasSessions).AppendLine();
@@ -223,7 +227,7 @@ namespace DiscImageChef.Commands
sb.AppendFormat("Drive manufacturer\t{0}\t{1}", image1Info.driveManufacturer, image2Info.driveManufacturer).AppendLine();
sb.AppendFormat("Drive model\t{0}\t{1}", image1Info.driveModel, image2Info.driveModel).AppendLine();
sb.AppendFormat("Drive serial number\t{0}\t{1}", image1Info.driveSerialNumber, image2Info.driveSerialNumber).AppendLine();
foreach (MediaTagType disktag in Enum.GetValues(typeof(MediaTagType)))
foreach(MediaTagType disktag in Enum.GetValues(typeof(MediaTagType)))
{
sb.AppendFormat("Has {0}?\t{1}\t{2}", disktag, image1DiskTags.ContainsKey(disktag), image2DiskTags.ContainsKey(disktag)).AppendLine();
}
@@ -231,164 +235,164 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Comparing disk image characteristics");
if (image1Info.imageHasPartitions != image2Info.imageHasPartitions)
if(image1Info.imageHasPartitions != image2Info.imageHasPartitions)
{
imagesDiffer = true;
if (!options.Verbose)
if(!options.Verbose)
sb.AppendLine("Image partitioned status differ");
}
if (image1Info.imageHasSessions != image2Info.imageHasSessions)
if(image1Info.imageHasSessions != image2Info.imageHasSessions)
{
imagesDiffer = true;
if (!options.Verbose)
if(!options.Verbose)
sb.AppendLine("Image session status differ");
}
if (image1Info.imageSize != image2Info.imageSize)
if(image1Info.imageSize != image2Info.imageSize)
{
imagesDiffer = true;
if (!options.Verbose)
if(!options.Verbose)
sb.AppendLine("Image size differ");
}
if (image1Info.sectors != image2Info.sectors)
if(image1Info.sectors != image2Info.sectors)
{
imagesDiffer = true;
if (!options.Verbose)
if(!options.Verbose)
sb.AppendLine("Image sectors differ");
}
if (image1Info.sectorSize != image2Info.sectorSize)
if(image1Info.sectorSize != image2Info.sectorSize)
{
imagesDiffer = true;
if (!options.Verbose)
if(!options.Verbose)
sb.AppendLine("Image sector size differ");
}
if (image1Info.imageCreationTime != image2Info.imageCreationTime)
if(image1Info.imageCreationTime != image2Info.imageCreationTime)
{
imagesDiffer = true;
if (!options.Verbose)
if(!options.Verbose)
sb.AppendLine("Image creation time differ");
}
if (image1Info.imageLastModificationTime != image2Info.imageLastModificationTime)
if(image1Info.imageLastModificationTime != image2Info.imageLastModificationTime)
{
imagesDiffer = true;
if (!options.Verbose)
if(!options.Verbose)
sb.AppendLine("Image last modification time differ");
}
if (image1Info.mediaType != image2Info.mediaType)
if(image1Info.mediaType != image2Info.mediaType)
{
imagesDiffer = true;
if (!options.Verbose)
if(!options.Verbose)
sb.AppendLine("Disk type differ");
}
if (image1Info.imageVersion != image2Info.imageVersion)
if(image1Info.imageVersion != image2Info.imageVersion)
{
imagesDiffer = true;
if (!options.Verbose)
if(!options.Verbose)
sb.AppendLine("Image version differ");
}
if (image1Info.imageApplication != image2Info.imageApplication)
if(image1Info.imageApplication != image2Info.imageApplication)
{
imagesDiffer = true;
if (!options.Verbose)
if(!options.Verbose)
sb.AppendLine("Image application differ");
}
if (image1Info.imageApplicationVersion != image2Info.imageApplicationVersion)
if(image1Info.imageApplicationVersion != image2Info.imageApplicationVersion)
{
imagesDiffer = true;
if (!options.Verbose)
if(!options.Verbose)
sb.AppendLine("Image application version differ");
}
if (image1Info.imageCreator != image2Info.imageCreator)
if(image1Info.imageCreator != image2Info.imageCreator)
{
imagesDiffer = true;
if (!options.Verbose)
if(!options.Verbose)
sb.AppendLine("Image creator differ");
}
if (image1Info.imageName != image2Info.imageName)
if(image1Info.imageName != image2Info.imageName)
{
imagesDiffer = true;
if (!options.Verbose)
if(!options.Verbose)
sb.AppendLine("Image name differ");
}
if (image1Info.imageComments != image2Info.imageComments)
if(image1Info.imageComments != image2Info.imageComments)
{
imagesDiffer = true;
if (!options.Verbose)
if(!options.Verbose)
sb.AppendLine("Image comments differ");
}
if (image1Info.mediaManufacturer != image2Info.mediaManufacturer)
if(image1Info.mediaManufacturer != image2Info.mediaManufacturer)
{
imagesDiffer = true;
if (!options.Verbose)
if(!options.Verbose)
sb.AppendLine("Disk manufacturer differ");
}
if (image1Info.mediaModel != image2Info.mediaModel)
if(image1Info.mediaModel != image2Info.mediaModel)
{
imagesDiffer = true;
if (!options.Verbose)
if(!options.Verbose)
sb.AppendLine("Disk model differ");
}
if (image1Info.mediaSerialNumber != image2Info.mediaSerialNumber)
if(image1Info.mediaSerialNumber != image2Info.mediaSerialNumber)
{
imagesDiffer = true;
if (!options.Verbose)
if(!options.Verbose)
sb.AppendLine("Disk serial number differ");
}
if (image1Info.mediaBarcode != image2Info.mediaBarcode)
if(image1Info.mediaBarcode != image2Info.mediaBarcode)
{
imagesDiffer = true;
if (!options.Verbose)
if(!options.Verbose)
sb.AppendLine("Disk barcode differ");
}
if (image1Info.mediaPartNumber != image2Info.mediaPartNumber)
if(image1Info.mediaPartNumber != image2Info.mediaPartNumber)
{
imagesDiffer = true;
if (!options.Verbose)
if(!options.Verbose)
sb.AppendLine("Disk part number differ");
}
if (image1Info.mediaSequence != image2Info.mediaSequence)
if(image1Info.mediaSequence != image2Info.mediaSequence)
{
imagesDiffer = true;
if (!options.Verbose)
if(!options.Verbose)
sb.AppendLine("Disk sequence differ");
}
if (image1Info.lastMediaSequence != image2Info.lastMediaSequence)
if(image1Info.lastMediaSequence != image2Info.lastMediaSequence)
{
imagesDiffer = true;
if (!options.Verbose)
if(!options.Verbose)
sb.AppendLine("Last disk in sequence differ");
}
if (image1Info.driveManufacturer != image2Info.driveManufacturer)
if(image1Info.driveManufacturer != image2Info.driveManufacturer)
{
imagesDiffer = true;
if (!options.Verbose)
if(!options.Verbose)
sb.AppendLine("Drive manufacturer differ");
}
if (image1Info.driveModel != image2Info.driveModel)
if(image1Info.driveModel != image2Info.driveModel)
{
imagesDiffer = true;
if (!options.Verbose)
if(!options.Verbose)
sb.AppendLine("Drive model differ");
}
if (image1Info.driveSerialNumber != image2Info.driveSerialNumber)
if(image1Info.driveSerialNumber != image2Info.driveSerialNumber)
{
imagesDiffer = true;
if (!options.Verbose)
if(!options.Verbose)
sb.AppendLine("Drive serial number differ");
}
UInt64 leastSectors;
if (image1Info.sectors < image2Info.sectors)
if(image1Info.sectors < image2Info.sectors)
{
imagesDiffer = true;
leastSectors = image1Info.sectors;
if (!options.Verbose)
if(!options.Verbose)
sb.AppendLine("Image 2 has more sectors");
}
else if (image1Info.sectors > image2Info.sectors)
else if(image1Info.sectors > image2Info.sectors)
{
imagesDiffer = true;
leastSectors = image2Info.sectors;
if (!options.Verbose)
if(!options.Verbose)
sb.AppendLine("Image 1 has more sectors");
}
else
@@ -396,9 +400,9 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Comparing sectors...");
for (UInt64 sector = 0; sector < leastSectors; sector++)
for(UInt64 sector = 0; sector < leastSectors; sector++)
{
DicConsole.Write("\rComparing sector {0} of {1}...", sector+1, leastSectors);
DicConsole.Write("\rComparing sector {0} of {1}...", sector + 1, leastSectors);
try
{
byte[] image1Sector = input1Format.ReadSector(sector);
@@ -417,11 +421,11 @@ namespace DiscImageChef.Commands
sector, image1Sector.LongLength, image2Sector.LongLength).AppendLine();
}
}
catch{}
catch { }
}
DicConsole.WriteLine();
if (imagesDiffer)
if(imagesDiffer)
sb.AppendLine("Images differ");
else
sb.AppendLine("Images do not differ");
@@ -437,12 +441,12 @@ namespace DiscImageChef.Commands
sameSize = true;
Int64 leastBytes;
if (compareArray1.LongLength < compareArray2.LongLength)
if(compareArray1.LongLength < compareArray2.LongLength)
{
sameSize = false;
leastBytes = compareArray1.LongLength;
}
else if (compareArray1.LongLength > compareArray2.LongLength)
else if(compareArray1.LongLength > compareArray2.LongLength)
{
sameSize = false;
leastBytes = compareArray2.LongLength;
@@ -450,9 +454,9 @@ namespace DiscImageChef.Commands
else
leastBytes = compareArray1.LongLength;
for (Int64 i = 0; i < leastBytes; i++)
for(Int64 i = 0; i < leastBytes; i++)
{
if (compareArray1[i] != compareArray2[i])
if(compareArray1[i] != compareArray2[i])
{
different = true;
return;

View File

@@ -43,12 +43,12 @@ namespace DiscImageChef.Commands
{
public static class Configure
{
public static void doConfigure ()
public static void doConfigure()
{
ConsoleKeyInfo pressedKey = new ConsoleKeyInfo();
pressedKey = new ConsoleKeyInfo();
while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
{
DicConsole.Write("Do you want to save device reports globally? (Y/N): ");
pressedKey = System.Console.ReadKey();
@@ -58,19 +58,19 @@ namespace DiscImageChef.Commands
Settings.Settings.Current.SaveReportsGlobally = pressedKey.Key == ConsoleKey.Y;
pressedKey = new ConsoleKeyInfo();
while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
{
DicConsole.Write("Do you want to save stats about your DiscImageChef usage? (Y/N): ");
pressedKey = System.Console.ReadKey();
DicConsole.WriteLine();
}
if (pressedKey.Key == ConsoleKey.Y)
if(pressedKey.Key == ConsoleKey.Y)
{
Settings.Settings.Current.Stats = new StatsSettings();
pressedKey = new ConsoleKeyInfo();
while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
{
DicConsole.Write("Do you want to share your stats anonymously? (Y/N): ");
pressedKey = System.Console.ReadKey();
@@ -79,7 +79,7 @@ namespace DiscImageChef.Commands
Settings.Settings.Current.Stats.ShareStats = pressedKey.Key == ConsoleKey.Y;
pressedKey = new ConsoleKeyInfo();
while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
{
DicConsole.Write("Do you want to gather statistics about benchmarks? (Y/N): ");
pressedKey = System.Console.ReadKey();
@@ -88,7 +88,7 @@ namespace DiscImageChef.Commands
Settings.Settings.Current.Stats.BenchmarkStats = pressedKey.Key == ConsoleKey.Y;
pressedKey = new ConsoleKeyInfo();
while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
{
DicConsole.Write("Do you want to gather statistics about command usage? (Y/N): ");
pressedKey = System.Console.ReadKey();
@@ -97,7 +97,7 @@ namespace DiscImageChef.Commands
Settings.Settings.Current.Stats.CommandStats = pressedKey.Key == ConsoleKey.Y;
pressedKey = new ConsoleKeyInfo();
while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
{
DicConsole.Write("Do you want to gather statistics about found devices? (Y/N): ");
pressedKey = System.Console.ReadKey();
@@ -106,7 +106,7 @@ namespace DiscImageChef.Commands
Settings.Settings.Current.Stats.DeviceStats = pressedKey.Key == ConsoleKey.Y;
pressedKey = new ConsoleKeyInfo();
while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
{
DicConsole.Write("Do you want to gather statistics about found filesystems? (Y/N): ");
pressedKey = System.Console.ReadKey();
@@ -115,7 +115,7 @@ namespace DiscImageChef.Commands
Settings.Settings.Current.Stats.FilesystemStats = pressedKey.Key == ConsoleKey.Y;
pressedKey = new ConsoleKeyInfo();
while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
{
DicConsole.Write("Do you want to gather statistics about found media image formats? (Y/N): ");
pressedKey = System.Console.ReadKey();
@@ -124,7 +124,7 @@ namespace DiscImageChef.Commands
Settings.Settings.Current.Stats.MediaImageStats = pressedKey.Key == ConsoleKey.Y;
pressedKey = new ConsoleKeyInfo();
while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
{
DicConsole.Write("Do you want to gather statistics about scanned media? (Y/N): ");
pressedKey = System.Console.ReadKey();
@@ -133,7 +133,7 @@ namespace DiscImageChef.Commands
Settings.Settings.Current.Stats.MediaScanStats = pressedKey.Key == ConsoleKey.Y;
pressedKey = new ConsoleKeyInfo();
while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
{
DicConsole.Write("Do you want to gather statistics about found partitioning schemes? (Y/N): ");
pressedKey = System.Console.ReadKey();
@@ -142,7 +142,7 @@ namespace DiscImageChef.Commands
Settings.Settings.Current.Stats.PartitionStats = pressedKey.Key == ConsoleKey.Y;
pressedKey = new ConsoleKeyInfo();
while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
{
DicConsole.Write("Do you want to gather statistics about media types? (Y/N): ");
pressedKey = System.Console.ReadKey();
@@ -151,7 +151,7 @@ namespace DiscImageChef.Commands
Settings.Settings.Current.Stats.MediaStats = pressedKey.Key == ConsoleKey.Y;
pressedKey = new ConsoleKeyInfo();
while (pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N)
{
DicConsole.Write("Do you want to gather statistics about media image verifications? (Y/N): ");
pressedKey = System.Console.ReadKey();

View File

@@ -58,7 +58,7 @@ namespace DiscImageChef.Commands
plugins.RegisterAllPlugins();
ImagePlugin _imageFormat;
if (!System.IO.File.Exists(options.InputFile))
if(!System.IO.File.Exists(options.InputFile))
{
DicConsole.ErrorWriteLine("Specified file does not exist.");
return;
@@ -68,14 +68,14 @@ namespace DiscImageChef.Commands
{
_imageFormat = ImageFormat.Detect(options.InputFile);
if (_imageFormat == null)
if(_imageFormat == null)
{
DicConsole.WriteLine("Image format not identified, not proceeding with analysis.");
return;
}
else
{
if (options.Verbose)
if(options.Verbose)
DicConsole.VerboseWriteLine("Image format identified by {0} ({1}).", _imageFormat.Name, _imageFormat.PluginUUID);
else
DicConsole.WriteLine("Image format identified by {0}.", _imageFormat.Name);
@@ -83,7 +83,7 @@ namespace DiscImageChef.Commands
try
{
if (!_imageFormat.OpenImage(options.InputFile))
if(!_imageFormat.OpenImage(options.InputFile))
{
DicConsole.WriteLine("Unable to open image format");
DicConsole.WriteLine("No error given");
@@ -92,7 +92,7 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("Analyze command", "Correctly opened image file.");
}
catch (Exception ex)
catch(Exception ex)
{
DicConsole.ErrorWriteLine("Unable to open image format");
DicConsole.ErrorWriteLine("Error: {0}", ex.Message);
@@ -108,7 +108,7 @@ namespace DiscImageChef.Commands
byte[] data;
long position = 0;
while (position < (fi.Length - 1048576))
while(position < (fi.Length - 1048576))
{
data = new byte[1048576];
fs.Read(data, 0, 1048576);
@@ -132,7 +132,7 @@ namespace DiscImageChef.Commands
List<ChecksumType> imgChecksums = imgChkWorker.End();
switch (_imageFormat.ImageInfo.xmlMediaType)
switch(_imageFormat.ImageInfo.xmlMediaType)
{
case XmlMediaType.OpticalDisc:
{
@@ -146,7 +146,7 @@ namespace DiscImageChef.Commands
sidecar.OpticalDisc[0].Image.Value = Path.GetFileName(options.InputFile);
sidecar.OpticalDisc[0].Size = fi.Length;
sidecar.OpticalDisc[0].Sequence = new SequenceType();
if (_imageFormat.GetMediaSequence() != 0 && _imageFormat.GetLastDiskSequence() != 0)
if(_imageFormat.GetMediaSequence() != 0 && _imageFormat.GetLastDiskSequence() != 0)
{
sidecar.OpticalDisc[0].Sequence.MediaSequence = _imageFormat.GetMediaSequence();
sidecar.OpticalDisc[0].Sequence.TotalMedia = _imageFormat.GetMediaSequence();
@@ -160,18 +160,18 @@ namespace DiscImageChef.Commands
MediaType dskType = _imageFormat.ImageInfo.mediaType;
foreach (MediaTagType tagType in _imageFormat.ImageInfo.readableMediaTags)
foreach(MediaTagType tagType in _imageFormat.ImageInfo.readableMediaTags)
{
switch (tagType)
switch(tagType)
{
case MediaTagType.CD_ATIP:
sidecar.OpticalDisc[0].ATIP = new DumpType();
sidecar.OpticalDisc[0].ATIP.Checksums = Core.Checksum.GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.CD_ATIP)).ToArray();
sidecar.OpticalDisc[0].ATIP.Size = _imageFormat.ReadDiskTag(MediaTagType.CD_ATIP).Length;
Decoders.CD.ATIP.CDATIP? atip = Decoders.CD.ATIP.Decode(_imageFormat.ReadDiskTag(MediaTagType.CD_ATIP));
if (atip.HasValue)
if(atip.HasValue)
{
if (atip.Value.DDCD)
if(atip.Value.DDCD)
dskType = atip.Value.DiscType ? MediaType.DDCDRW : MediaType.DDCDR;
else
dskType = atip.Value.DiscType ? MediaType.CDRW : MediaType.CDR;
@@ -190,9 +190,9 @@ namespace DiscImageChef.Commands
case MediaTagType.DVD_CMI:
sidecar.OpticalDisc[0].CMI = new DumpType();
Decoders.DVD.CSS_CPRM.LeadInCopyright? cmi = Decoders.DVD.CSS_CPRM.DecodeLeadInCopyright(_imageFormat.ReadDiskTag(MediaTagType.DVD_CMI));
if (cmi.HasValue)
if(cmi.HasValue)
{
switch (cmi.Value.CopyrightType)
switch(cmi.Value.CopyrightType)
{
case Decoders.DVD.CopyrightType.AACS:
sidecar.OpticalDisc[0].CopyProtection = "AACS";
@@ -212,13 +212,13 @@ namespace DiscImageChef.Commands
sidecar.OpticalDisc[0].DMI = new DumpType();
sidecar.OpticalDisc[0].DMI.Checksums = Core.Checksum.GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.DVD_DMI)).ToArray();
sidecar.OpticalDisc[0].DMI.Size = _imageFormat.ReadDiskTag(MediaTagType.DVD_DMI).Length;
if (Decoders.Xbox.DMI.IsXbox(_imageFormat.ReadDiskTag(MediaTagType.DVD_DMI)))
if(Decoders.Xbox.DMI.IsXbox(_imageFormat.ReadDiskTag(MediaTagType.DVD_DMI)))
{
dskType = MediaType.XGD;
sidecar.OpticalDisc[0].Dimensions = new DimensionsType();
sidecar.OpticalDisc[0].Dimensions.Diameter = 120;
}
else if (Decoders.Xbox.DMI.IsXbox360(_imageFormat.ReadDiskTag(MediaTagType.DVD_DMI)))
else if(Decoders.Xbox.DMI.IsXbox360(_imageFormat.ReadDiskTag(MediaTagType.DVD_DMI)))
{
dskType = MediaType.XGD2;
sidecar.OpticalDisc[0].Dimensions = new DimensionsType();
@@ -230,13 +230,13 @@ namespace DiscImageChef.Commands
sidecar.OpticalDisc[0].PFI.Checksums = Core.Checksum.GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.DVD_PFI)).ToArray();
sidecar.OpticalDisc[0].PFI.Size = _imageFormat.ReadDiskTag(MediaTagType.DVD_PFI).Length;
Decoders.DVD.PFI.PhysicalFormatInformation? pfi = Decoders.DVD.PFI.Decode(_imageFormat.ReadDiskTag(MediaTagType.DVD_PFI));
if (pfi.HasValue)
if(pfi.HasValue)
{
if (dskType != MediaType.XGD &&
if(dskType != MediaType.XGD &&
dskType != MediaType.XGD2 &&
dskType != MediaType.XGD3)
{
switch (pfi.Value.DiskCategory)
switch(pfi.Value.DiskCategory)
{
case Decoders.DVD.DiskCategory.DVDPR:
dskType = MediaType.DVDPR;
@@ -282,19 +282,19 @@ namespace DiscImageChef.Commands
break;
}
if (dskType == MediaType.DVDR && pfi.Value.PartVersion == 6)
if(dskType == MediaType.DVDR && pfi.Value.PartVersion == 6)
dskType = MediaType.DVDRDL;
if (dskType == MediaType.DVDRW && pfi.Value.PartVersion == 3)
if(dskType == MediaType.DVDRW && pfi.Value.PartVersion == 3)
dskType = MediaType.DVDRWDL;
if (dskType == MediaType.GOD && pfi.Value.DiscSize == DiscImageChef.Decoders.DVD.DVDSize.OneTwenty)
if(dskType == MediaType.GOD && pfi.Value.DiscSize == DiscImageChef.Decoders.DVD.DVDSize.OneTwenty)
dskType = MediaType.WOD;
sidecar.OpticalDisc[0].Dimensions = new DimensionsType();
if (dskType == MediaType.UMD)
if(dskType == MediaType.UMD)
sidecar.OpticalDisc[0].Dimensions.Diameter = 60;
else if (pfi.Value.DiscSize == DiscImageChef.Decoders.DVD.DVDSize.Eighty)
else if(pfi.Value.DiscSize == DiscImageChef.Decoders.DVD.DVDSize.Eighty)
sidecar.OpticalDisc[0].Dimensions.Diameter = 80;
else if (pfi.Value.DiscSize == DiscImageChef.Decoders.DVD.DVDSize.OneTwenty)
else if(pfi.Value.DiscSize == DiscImageChef.Decoders.DVD.DVDSize.OneTwenty)
sidecar.OpticalDisc[0].Dimensions.Diameter = 120;
}
}
@@ -319,17 +319,17 @@ namespace DiscImageChef.Commands
List<Track> tracks = _imageFormat.GetTracks();
List<Schemas.TrackType> trksLst = null;
if (tracks != null)
if(tracks != null)
{
sidecar.OpticalDisc[0].Tracks = new int[1];
sidecar.OpticalDisc[0].Tracks[0] = tracks.Count;
trksLst = new List<Schemas.TrackType>();
}
foreach (Track trk in tracks)
foreach(Track trk in tracks)
{
Schemas.TrackType xmlTrk = new Schemas.TrackType();
switch (trk.TrackType)
switch(trk.TrackType)
{
case DiscImageChef.ImagePlugins.TrackType.Audio:
xmlTrk.TrackType1 = TrackTypeTrackType.audio;
@@ -347,7 +347,7 @@ namespace DiscImageChef.Commands
xmlTrk.TrackType1 = TrackTypeTrackType.mode1;
break;
case DiscImageChef.ImagePlugins.TrackType.Data:
switch (sidecar.OpticalDisc[0].DiscType)
switch(sidecar.OpticalDisc[0].DiscType)
{
case "BD":
xmlTrk.TrackType1 = TrackTypeTrackType.bluray;
@@ -373,13 +373,13 @@ namespace DiscImageChef.Commands
xmlTrk.StartSector = (long)trk.TrackStartSector;
xmlTrk.EndSector = (long)trk.TrackEndSector;
if (sidecar.OpticalDisc[0].DiscType == "CD" ||
if(sidecar.OpticalDisc[0].DiscType == "CD" ||
sidecar.OpticalDisc[0].DiscType == "GD")
{
xmlTrk.StartMSF = LbaToMsf(xmlTrk.StartSector);
xmlTrk.EndMSF = LbaToMsf(xmlTrk.EndSector);
}
else if (sidecar.OpticalDisc[0].DiscType == "DDCD")
else if(sidecar.OpticalDisc[0].DiscType == "DDCD")
{
xmlTrk.StartMSF = DdcdLbaToMsf(xmlTrk.StartSector);
xmlTrk.EndMSF = DdcdLbaToMsf(xmlTrk.EndSector);
@@ -387,7 +387,7 @@ namespace DiscImageChef.Commands
xmlTrk.Image = new ImageType();
xmlTrk.Image.Value = Path.GetFileName(trk.TrackFile);
if (trk.TrackFileOffset > 0)
if(trk.TrackFileOffset > 0)
{
xmlTrk.Image.offset = (long)trk.TrackFileOffset;
xmlTrk.Image.offsetSpecified = true;
@@ -407,11 +407,11 @@ namespace DiscImageChef.Commands
ulong sectors = (ulong)(xmlTrk.EndSector - xmlTrk.StartSector + 1);
ulong doneSectors = 0;
while (doneSectors < sectors)
while(doneSectors < sectors)
{
byte[] sector;
if ((sectors - doneSectors) >= sectorsToRead)
if((sectors - doneSectors) >= sectorsToRead)
{
sector = _imageFormat.ReadSectorsLong(doneSectors, sectorsToRead, (uint)xmlTrk.Sequence.TrackNumber);
DicConsole.Write("\rHashings sectors {0} to {2} of track {1} ({3} sectors)", doneSectors, xmlTrk.Sequence.TrackNumber, doneSectors + sectorsToRead, sectors);
@@ -433,11 +433,11 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine();
if (trk.TrackSubchannelType != TrackSubchannelType.None)
if(trk.TrackSubchannelType != TrackSubchannelType.None)
{
xmlTrk.SubChannel = new SubChannelType();
xmlTrk.SubChannel.Image = new ImageType();
switch (trk.TrackSubchannelType)
switch(trk.TrackSubchannelType)
{
case TrackSubchannelType.Packed:
case TrackSubchannelType.PackedInterleaved:
@@ -449,7 +449,7 @@ namespace DiscImageChef.Commands
break;
}
if (trk.TrackFileOffset > 0)
if(trk.TrackFileOffset > 0)
{
xmlTrk.SubChannel.Image.offset = (long)trk.TrackSubchannelOffset;
xmlTrk.SubChannel.Image.offsetSpecified = true;
@@ -464,11 +464,11 @@ namespace DiscImageChef.Commands
sectors = (ulong)(xmlTrk.EndSector - xmlTrk.StartSector + 1);
doneSectors = 0;
while (doneSectors < sectors)
while(doneSectors < sectors)
{
byte[] sector;
if ((sectors - doneSectors) >= sectorsToRead)
if((sectors - doneSectors) >= sectorsToRead)
{
sector = _imageFormat.ReadSectorsTag(doneSectors, sectorsToRead, (uint)xmlTrk.Sequence.TrackNumber, SectorTagType.CDSectorSubchannel);
DicConsole.Write("\rHashings subchannel sectors {0} to {2} of track {1} ({3} sectors)", doneSectors, xmlTrk.Sequence.TrackNumber, doneSectors + sectorsToRead, sectors);
@@ -498,11 +498,11 @@ namespace DiscImageChef.Commands
List<Partition> partitions = new List<Partition>();
foreach (PartPlugin _partplugin in plugins.PartPluginsList.Values)
foreach(PartPlugin _partplugin in plugins.PartPluginsList.Values)
{
List<Partition> _partitions;
if (_partplugin.GetInformation(_imageFormat, out _partitions))
if(_partplugin.GetInformation(_imageFormat, out _partitions))
{
partitions.AddRange(_partitions);
Core.Statistics.AddPartition(_partplugin.Name);
@@ -510,10 +510,10 @@ namespace DiscImageChef.Commands
}
xmlTrk.FileSystemInformation = new PartitionType[1];
if (partitions.Count > 0)
if(partitions.Count > 0)
{
xmlTrk.FileSystemInformation = new PartitionType[partitions.Count];
for (int i = 0; i < partitions.Count; i++)
for(int i = 0; i < partitions.Count; i++)
{
xmlTrk.FileSystemInformation[i] = new PartitionType();
xmlTrk.FileSystemInformation[i].Description = partitions[i].PartitionDescription;
@@ -525,24 +525,24 @@ namespace DiscImageChef.Commands
List<FileSystemType> lstFs = new List<FileSystemType>();
foreach (Plugin _plugin in plugins.PluginsList.Values)
foreach(Plugin _plugin in plugins.PluginsList.Values)
{
try
{
if (_plugin.Identify(_imageFormat, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector + partitions[i].PartitionSectors - 1))
if(_plugin.Identify(_imageFormat, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector + partitions[i].PartitionSectors - 1))
{
string foo;
_plugin.GetInformation(_imageFormat, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector + partitions[i].PartitionSectors - 1, out foo);
lstFs.Add(_plugin.XmlFSType);
Core.Statistics.AddFilesystem(_plugin.XmlFSType.Type);
if (_plugin.XmlFSType.Type == "Opera")
if(_plugin.XmlFSType.Type == "Opera")
dskType = MediaType.ThreeDO;
if (_plugin.XmlFSType.Type == "PC Engine filesystem")
if(_plugin.XmlFSType.Type == "PC Engine filesystem")
dskType = MediaType.SuperCDROM2;
if (_plugin.XmlFSType.Type == "Nintendo Wii filesystem")
if(_plugin.XmlFSType.Type == "Nintendo Wii filesystem")
dskType = MediaType.WOD;
if (_plugin.XmlFSType.Type == "Nintendo Gamecube filesystem")
if(_plugin.XmlFSType.Type == "Nintendo Gamecube filesystem")
dskType = MediaType.GOD;
}
}
@@ -552,7 +552,7 @@ namespace DiscImageChef.Commands
}
}
if (lstFs.Count > 0)
if(lstFs.Count > 0)
xmlTrk.FileSystemInformation[i].FileSystems = lstFs.ToArray();
}
}
@@ -564,24 +564,24 @@ namespace DiscImageChef.Commands
List<FileSystemType> lstFs = new List<FileSystemType>();
foreach (Plugin _plugin in plugins.PluginsList.Values)
foreach(Plugin _plugin in plugins.PluginsList.Values)
{
try
{
if (_plugin.Identify(_imageFormat, (ulong)xmlTrk.StartSector, (ulong)xmlTrk.EndSector))
if(_plugin.Identify(_imageFormat, (ulong)xmlTrk.StartSector, (ulong)xmlTrk.EndSector))
{
string foo;
_plugin.GetInformation(_imageFormat, (ulong)xmlTrk.StartSector, (ulong)xmlTrk.EndSector, out foo);
lstFs.Add(_plugin.XmlFSType);
Core.Statistics.AddFilesystem(_plugin.XmlFSType.Type);
if (_plugin.XmlFSType.Type == "Opera")
if(_plugin.XmlFSType.Type == "Opera")
dskType = MediaType.ThreeDO;
if (_plugin.XmlFSType.Type == "PC Engine filesystem")
if(_plugin.XmlFSType.Type == "PC Engine filesystem")
dskType = MediaType.SuperCDROM2;
if (_plugin.XmlFSType.Type == "Nintendo Wii filesystem")
if(_plugin.XmlFSType.Type == "Nintendo Wii filesystem")
dskType = MediaType.WOD;
if (_plugin.XmlFSType.Type == "Nintendo Gamecube filesystem")
if(_plugin.XmlFSType.Type == "Nintendo Gamecube filesystem")
dskType = MediaType.GOD;
}
}
@@ -591,16 +591,16 @@ namespace DiscImageChef.Commands
}
}
if (lstFs.Count > 0)
if(lstFs.Count > 0)
xmlTrk.FileSystemInformation[0].FileSystems = lstFs.ToArray();
}
trksLst.Add(xmlTrk);
}
if (trksLst != null)
if(trksLst != null)
sidecar.OpticalDisc[0].Track = trksLst.ToArray();
string dscType, dscSubType;
Metadata.MediaType.MediaTypeToString(dskType, out dscType, out dscSubType);
sidecar.OpticalDisc[0].DiscType = dscType;
@@ -621,7 +621,7 @@ namespace DiscImageChef.Commands
sidecar.BlockMedia[0].Image.Value = Path.GetFileName(options.InputFile);
sidecar.BlockMedia[0].Size = fi.Length;
sidecar.BlockMedia[0].Sequence = new SequenceType();
if (_imageFormat.GetMediaSequence() != 0 && _imageFormat.GetLastDiskSequence() != 0)
if(_imageFormat.GetMediaSequence() != 0 && _imageFormat.GetLastDiskSequence() != 0)
{
sidecar.BlockMedia[0].Sequence.MediaSequence = _imageFormat.GetMediaSequence();
sidecar.BlockMedia[0].Sequence.TotalMedia = _imageFormat.GetMediaSequence();
@@ -633,9 +633,9 @@ namespace DiscImageChef.Commands
}
sidecar.BlockMedia[0].Sequence.MediaTitle = _imageFormat.GetImageName();
foreach (MediaTagType tagType in _imageFormat.ImageInfo.readableMediaTags)
foreach(MediaTagType tagType in _imageFormat.ImageInfo.readableMediaTags)
{
switch (tagType)
switch(tagType)
{
case MediaTagType.ATAPI_IDENTIFY:
sidecar.BlockMedia[0].ATA = new ATAType();
@@ -702,11 +702,11 @@ namespace DiscImageChef.Commands
List<Partition> partitions = new List<Partition>();
foreach (PartPlugin _partplugin in plugins.PartPluginsList.Values)
foreach(PartPlugin _partplugin in plugins.PartPluginsList.Values)
{
List<Partition> _partitions;
if (_partplugin.GetInformation(_imageFormat, out _partitions))
if(_partplugin.GetInformation(_imageFormat, out _partitions))
{
partitions = _partitions;
Core.Statistics.AddPartition(_partplugin.Name);
@@ -715,10 +715,10 @@ namespace DiscImageChef.Commands
}
sidecar.BlockMedia[0].FileSystemInformation = new PartitionType[1];
if (partitions.Count > 0)
if(partitions.Count > 0)
{
sidecar.BlockMedia[0].FileSystemInformation = new PartitionType[partitions.Count];
for (int i = 0; i < partitions.Count; i++)
for(int i = 0; i < partitions.Count; i++)
{
sidecar.BlockMedia[0].FileSystemInformation[i] = new PartitionType();
sidecar.BlockMedia[0].FileSystemInformation[i].Description = partitions[i].PartitionDescription;
@@ -730,11 +730,11 @@ namespace DiscImageChef.Commands
List<FileSystemType> lstFs = new List<FileSystemType>();
foreach (Plugin _plugin in plugins.PluginsList.Values)
foreach(Plugin _plugin in plugins.PluginsList.Values)
{
try
{
if (_plugin.Identify(_imageFormat, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector + partitions[i].PartitionSectors - 1))
if(_plugin.Identify(_imageFormat, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector + partitions[i].PartitionSectors - 1))
{
string foo;
_plugin.GetInformation(_imageFormat, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector + partitions[i].PartitionSectors - 1, out foo);
@@ -748,7 +748,7 @@ namespace DiscImageChef.Commands
}
}
if (lstFs.Count > 0)
if(lstFs.Count > 0)
sidecar.BlockMedia[0].FileSystemInformation[i].FileSystems = lstFs.ToArray();
}
}
@@ -760,11 +760,11 @@ namespace DiscImageChef.Commands
List<FileSystemType> lstFs = new List<FileSystemType>();
foreach (Plugin _plugin in plugins.PluginsList.Values)
foreach(Plugin _plugin in plugins.PluginsList.Values)
{
try
{
if (_plugin.Identify(_imageFormat, 0, _imageFormat.GetSectors() - 1))
if(_plugin.Identify(_imageFormat, 0, _imageFormat.GetSectors() - 1))
{
string foo;
_plugin.GetInformation(_imageFormat, 0, _imageFormat.GetSectors() - 1, out foo);
@@ -778,7 +778,7 @@ namespace DiscImageChef.Commands
}
}
if (lstFs.Count > 0)
if(lstFs.Count > 0)
sidecar.BlockMedia[0].FileSystemInformation[0].FileSystems = lstFs.ToArray();
}
@@ -814,7 +814,7 @@ namespace DiscImageChef.Commands
sidecar.AudioMedia[0].Image.Value = Path.GetFileName(options.InputFile);
sidecar.AudioMedia[0].Size = fi.Length;
sidecar.AudioMedia[0].Sequence = new SequenceType();
if (_imageFormat.GetMediaSequence() != 0 && _imageFormat.GetLastDiskSequence() != 0)
if(_imageFormat.GetMediaSequence() != 0 && _imageFormat.GetLastDiskSequence() != 0)
{
sidecar.AudioMedia[0].Sequence.MediaSequence = _imageFormat.GetMediaSequence();
sidecar.AudioMedia[0].Sequence.TotalMedia = _imageFormat.GetMediaSequence();
@@ -836,7 +836,7 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Writing metadata sidecar");
FileStream xmlFs = new FileStream(Path.GetDirectoryName(options.InputFile) +
//Path.PathSeparator +
//Path.PathSeparator +
Path.GetFileNameWithoutExtension(options.InputFile) + ".cicm.xml",
FileMode.CreateNew);
@@ -846,7 +846,7 @@ namespace DiscImageChef.Commands
Core.Statistics.AddCommand("create-sidecar");
}
catch (Exception ex)
catch(Exception ex)
{
DicConsole.ErrorWriteLine(String.Format("Error reading file: {0}", ex.Message));
DicConsole.DebugWriteLine("Analyze command", ex.StackTrace);
@@ -857,7 +857,7 @@ namespace DiscImageChef.Commands
static string LbaToMsf(long lba)
{
long m, s, f;
if (lba >= -150)
if(lba >= -150)
{
m = (lba + 150) / (75 * 60);
lba -= m * (75 * 60);
@@ -880,7 +880,7 @@ namespace DiscImageChef.Commands
static string DdcdLbaToMsf(long lba)
{
long h, m, s, f;
if (lba >= -150)
if(lba >= -150)
{
h = (lba + 150) / (75 * 60 * 60);
lba -= h * (75 * 60 * 60);

View File

@@ -53,7 +53,7 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("Decode command", "--disk-tags={0}", options.DiskTags);
DicConsole.DebugWriteLine("Decode command", "--sector-tags={0}", options.SectorTags);
if (!System.IO.File.Exists(options.InputFile))
if(!System.IO.File.Exists(options.InputFile))
{
DicConsole.ErrorWriteLine("Specified file does not exist.");
return;
@@ -61,7 +61,7 @@ namespace DiscImageChef.Commands
ImagePlugin inputFormat = ImageFormat.Detect(options.InputFile);
if (inputFormat == null)
if(inputFormat == null)
{
DicConsole.ErrorWriteLine("Unable to recognize image format, not decoding");
return;
@@ -71,20 +71,20 @@ namespace DiscImageChef.Commands
Core.Statistics.AddMediaFormat(inputFormat.GetImageFormat());
Core.Statistics.AddMedia(inputFormat.ImageInfo.mediaType, false);
if (options.DiskTags)
if(options.DiskTags)
{
if (inputFormat.ImageInfo.readableMediaTags.Count == 0)
if(inputFormat.ImageInfo.readableMediaTags.Count == 0)
DicConsole.WriteLine("There are no disk tags in chosen disc image.");
else
{
foreach (MediaTagType tag in inputFormat.ImageInfo.readableMediaTags)
foreach(MediaTagType tag in inputFormat.ImageInfo.readableMediaTags)
{
switch (tag)
switch(tag)
{
case MediaTagType.SCSI_INQUIRY:
{
byte[] inquiry = inputFormat.ReadDiskTag(MediaTagType.SCSI_INQUIRY);
if (inquiry == null)
if(inquiry == null)
DicConsole.WriteLine("Error reading SCSI INQUIRY response from disc image");
else
{
@@ -98,7 +98,7 @@ namespace DiscImageChef.Commands
case MediaTagType.ATA_IDENTIFY:
{
byte[] identify = inputFormat.ReadDiskTag(MediaTagType.ATA_IDENTIFY);
if (identify == null)
if(identify == null)
DicConsole.WriteLine("Error reading ATA IDENTIFY DEVICE response from disc image");
else
{
@@ -112,7 +112,7 @@ namespace DiscImageChef.Commands
case MediaTagType.ATAPI_IDENTIFY:
{
byte[] identify = inputFormat.ReadDiskTag(MediaTagType.ATAPI_IDENTIFY);
if (identify == null)
if(identify == null)
DicConsole.WriteLine("Error reading ATA IDENTIFY PACKET DEVICE response from disc image");
else
{
@@ -126,7 +126,7 @@ namespace DiscImageChef.Commands
case MediaTagType.CD_ATIP:
{
byte[] atip = inputFormat.ReadDiskTag(MediaTagType.CD_ATIP);
if (atip == null)
if(atip == null)
DicConsole.WriteLine("Error reading CD ATIP from disc image");
else
{
@@ -140,7 +140,7 @@ namespace DiscImageChef.Commands
case MediaTagType.CD_FullTOC:
{
byte[] fulltoc = inputFormat.ReadDiskTag(MediaTagType.CD_FullTOC);
if (fulltoc == null)
if(fulltoc == null)
DicConsole.WriteLine("Error reading CD full TOC from disc image");
else
{
@@ -154,7 +154,7 @@ namespace DiscImageChef.Commands
case MediaTagType.CD_PMA:
{
byte[] pma = inputFormat.ReadDiskTag(MediaTagType.CD_PMA);
if (pma == null)
if(pma == null)
DicConsole.WriteLine("Error reading CD PMA from disc image");
else
{
@@ -168,7 +168,7 @@ namespace DiscImageChef.Commands
case MediaTagType.CD_SessionInfo:
{
byte[] sessioninfo = inputFormat.ReadDiskTag(MediaTagType.CD_SessionInfo);
if (sessioninfo == null)
if(sessioninfo == null)
DicConsole.WriteLine("Error reading CD session information from disc image");
else
{
@@ -182,7 +182,7 @@ namespace DiscImageChef.Commands
case MediaTagType.CD_TEXT:
{
byte[] cdtext = inputFormat.ReadDiskTag(MediaTagType.CD_TEXT);
if (cdtext == null)
if(cdtext == null)
DicConsole.WriteLine("Error reading CD-TEXT from disc image");
else
{
@@ -196,7 +196,7 @@ namespace DiscImageChef.Commands
case MediaTagType.CD_TOC:
{
byte[] toc = inputFormat.ReadDiskTag(MediaTagType.CD_TOC);
if (toc == null)
if(toc == null)
DicConsole.WriteLine("Error reading CD TOC from disc image");
else
{
@@ -215,15 +215,15 @@ namespace DiscImageChef.Commands
}
}
if (options.SectorTags)
if(options.SectorTags)
{
UInt64 length;
if (options.Length.ToLowerInvariant() == "all")
if(options.Length.ToLowerInvariant() == "all")
length = inputFormat.GetSectors() - 1;
else
{
if (!UInt64.TryParse(options.Length, out length))
if(!UInt64.TryParse(options.Length, out length))
{
DicConsole.WriteLine("Value \"{0}\" is not a valid number for length.", options.Length);
DicConsole.WriteLine("Not decoding sectors tags");
@@ -231,13 +231,13 @@ namespace DiscImageChef.Commands
}
}
if (inputFormat.ImageInfo.readableSectorTags.Count == 0)
if(inputFormat.ImageInfo.readableSectorTags.Count == 0)
DicConsole.WriteLine("There are no sector tags in chosen disc image.");
else
{
foreach (SectorTagType tag in inputFormat.ImageInfo.readableSectorTags)
foreach(SectorTagType tag in inputFormat.ImageInfo.readableSectorTags)
{
switch (tag)
switch(tag)
{
default:
DicConsole.WriteLine("Decoder for disk tag type \"{0}\" not yet implemented, sorry.", tag);

View File

@@ -53,13 +53,13 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("Device-Info command", "--device={0}", options.DevicePath);
DicConsole.DebugWriteLine("Device-Info command", "--output-prefix={0}", options.OutputPrefix);
if (!System.IO.File.Exists(options.DevicePath))
if(!System.IO.File.Exists(options.DevicePath))
{
DicConsole.ErrorWriteLine("Specified device does not exist.");
return;
}
if (options.DevicePath.Length == 2 && options.DevicePath[1] == ':' &&
if(options.DevicePath.Length == 2 && options.DevicePath[1] == ':' &&
options.DevicePath[0] != '/' && Char.IsLetter(options.DevicePath[0]))
{
options.DevicePath = "\\\\.\\" + Char.ToUpper(options.DevicePath[0]) + ':';
@@ -67,7 +67,7 @@ namespace DiscImageChef.Commands
Device dev = new Device(options.DevicePath);
if (dev.Error)
if(dev.Error)
{
DicConsole.ErrorWriteLine("Error {0} opening device.", dev.LastError);
return;
@@ -75,7 +75,7 @@ namespace DiscImageChef.Commands
Core.Statistics.AddDevice(dev);
if (dev.IsUSB)
if(dev.IsUSB)
{
DicConsole.WriteLine("USB device");
if(dev.USBDescriptors != null)
@@ -88,7 +88,7 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine();
}
if (dev.IsFireWire)
if(dev.IsFireWire)
{
DicConsole.WriteLine("FireWire device");
DicConsole.WriteLine("FireWire Vendor ID: {0:X6}", dev.FireWireVendor);
@@ -99,7 +99,7 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine();
}
switch (dev.Type)
switch(dev.Type)
{
case DeviceType.ATA:
{
@@ -108,7 +108,7 @@ namespace DiscImageChef.Commands
byte[] ataBuf;
bool sense = dev.AtaIdentify(out ataBuf, out errorRegisters);
if (sense)
if(sense)
{
DicConsole.DebugWriteLine("Device-Info command", "STATUS = 0x{0:X2}", errorRegisters.status);
DicConsole.DebugWriteLine("Device-Info command", "ERROR = 0x{0:X2}", errorRegisters.error);
@@ -129,24 +129,24 @@ namespace DiscImageChef.Commands
double duration;
dev.EnableMediaCardPassThrough(out errorRegisters, dev.Timeout, out duration);
if (errorRegisters.sector == 0xAA && errorRegisters.sectorCount == 0x55)
if(errorRegisters.sector == 0xAA && errorRegisters.sectorCount == 0x55)
{
DicConsole.WriteLine("Device supports the Media Card Pass Through Command Set");
switch (errorRegisters.deviceHead & 0x7)
switch(errorRegisters.deviceHead & 0x7)
{
case 0:
DicConsole.WriteLine("Device reports incorrect media card type");
break;
case 1:
case 1:
DicConsole.WriteLine("Device contains a Secure Digital card");
break;
case 2:
case 2:
DicConsole.WriteLine("Device contains a MultiMediaCard ");
break;
case 3:
case 3:
DicConsole.WriteLine("Device contains a Secure Digital I/O card");
break;
case 4:
case 4:
DicConsole.WriteLine("Device contains a Smart Media card");
break;
default:
@@ -154,11 +154,11 @@ namespace DiscImageChef.Commands
break;
}
if ((errorRegisters.deviceHead & 0x08) == 0x08)
if((errorRegisters.deviceHead & 0x08) == 0x08)
DicConsole.WriteLine("Media card is write protected");
ushort specificData = (ushort)((errorRegisters.cylinderHigh * 0x100) + errorRegisters.cylinderLow);
if (specificData != 0)
if(specificData != 0)
DicConsole.WriteLine("Card specific data: 0x{0:X4}", specificData);
}
@@ -171,7 +171,7 @@ namespace DiscImageChef.Commands
byte[] ataBuf;
bool sense = dev.AtapiIdentify(out ataBuf, out errorRegisters);
if (sense)
if(sense)
{
DicConsole.DebugWriteLine("Device-Info command", "STATUS = 0x{0:X2}", errorRegisters.status);
DicConsole.DebugWriteLine("Device-Info command", "ERROR = 0x{0:X2}", errorRegisters.error);
@@ -199,14 +199,14 @@ namespace DiscImageChef.Commands
bool sense = dev.ScsiInquiry(out inqBuf, out senseBuf);
if (sense)
if(sense)
{
DicConsole.ErrorWriteLine("SCSI error:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
break;
}
if (dev.Type != DeviceType.ATAPI)
if(dev.Type != DeviceType.ATAPI)
DicConsole.WriteLine("SCSI device");
doWriteFile(options.OutputPrefix, "_scsi_inquiry.bin", "SCSI INQUIRY", inqBuf);
@@ -220,30 +220,30 @@ namespace DiscImageChef.Commands
sense = dev.ScsiInquiry(out inqBuf, out senseBuf, 0x00);
if (!sense)
if(!sense)
{
byte[] pages = Decoders.SCSI.EVPD.DecodePage00(inqBuf);
if (pages != null)
if(pages != null)
{
foreach (byte page in pages)
foreach(byte page in pages)
{
if (page >= 0x01 && page <= 0x7F)
if(page >= 0x01 && page <= 0x7F)
{
sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page);
if (!sense)
if(!sense)
{
if (sb == null)
if(sb == null)
sb = new StringBuilder();
sb.AppendFormat("Page 0x{0:X2}: ", Decoders.SCSI.EVPD.DecodeASCIIPage(inqBuf)).AppendLine();
doWriteFile(options.OutputPrefix, String.Format("_scsi_evpd_{0:X2}h.bin", page), String.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf);
}
}
else if (page == 0x80)
else if(page == 0x80)
{
sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page);
if (!sense)
if(!sense)
{
scsi80 = true;
scsiSerial = Decoders.SCSI.EVPD.DecodePage80(inqBuf);
@@ -253,12 +253,12 @@ namespace DiscImageChef.Commands
}
else
{
if (page != 0x00)
if(page != 0x00)
{
DicConsole.DebugWriteLine("Device-Info command", "Found undecoded SCSI VPD page 0x{0:X2}", page);
sense = dev.ScsiInquiry(out inqBuf, out senseBuf, page);
if (!sense)
if(!sense)
{
doWriteFile(options.OutputPrefix, String.Format("_scsi_evpd_{0:X2}h.bin", page), String.Format("SCSI INQUIRY EVPD {0:X2}h", page), inqBuf);
}
@@ -268,10 +268,10 @@ namespace DiscImageChef.Commands
}
}
if (scsi80)
if(scsi80)
DicConsole.WriteLine("Unit Serial Number: {0}", scsiSerial);
if (sb != null)
if(sb != null)
{
DicConsole.WriteLine("ASCII VPDs:");
DicConsole.WriteLine(sb.ToString());
@@ -283,12 +283,12 @@ namespace DiscImageChef.Commands
Decoders.SCSI.PeripheralDeviceTypes devType = (DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes)inq.Value.PeripheralDeviceType;
sense = dev.ModeSense10(out modeBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, 0x3F, 0xFF, 5, out duration);
if (sense || dev.Error)
if(sense || dev.Error)
{
sense = dev.ModeSense10(out modeBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out duration);
}
if (!sense && !dev.Error)
if(!sense && !dev.Error)
{
decMode = Decoders.SCSI.Modes.DecodeMode10(modeBuf, devType);
}
@@ -296,36 +296,36 @@ namespace DiscImageChef.Commands
if(sense || dev.Error || !decMode.HasValue)
{
sense = dev.ModeSense6(out modeBuf, out senseBuf, false, ScsiModeSensePageControl.Current, 0x3F, 0xFF, 5, out duration);
if (sense || dev.Error)
if(sense || dev.Error)
sense = dev.ModeSense6(out modeBuf, out senseBuf, false, ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out duration);
if (sense || dev.Error)
if(sense || dev.Error)
sense = dev.ModeSense(out modeBuf, out senseBuf, 5, out duration);
if (!sense && !dev.Error)
if(!sense && !dev.Error)
decMode = Decoders.SCSI.Modes.DecodeMode6(modeBuf, devType);
}
if (!sense)
if(!sense)
doWriteFile(options.OutputPrefix, "_scsi_modesense.bin", "SCSI MODE SENSE", modeBuf);
if (decMode.HasValue)
if(decMode.HasValue)
{
DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModeHeader(decMode.Value.Header, devType));
if (decMode.Value.Pages != null)
if(decMode.Value.Pages != null)
{
foreach (Decoders.SCSI.Modes.ModePage page in decMode.Value.Pages)
foreach(Decoders.SCSI.Modes.ModePage page in decMode.Value.Pages)
{
//DicConsole.WriteLine("Page {0:X2}h subpage {1:X2}h is {2} bytes long", page.Page, page.Subpage, page.PageResponse.Length);
switch (page.Page)
switch(page.Page)
{
case 0x00:
{
if (devType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice && page.Subpage == 0)
if(devType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice && page.Subpage == 0)
DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_00_SFF(page.PageResponse));
else
{
if (page.Subpage != 0)
if(page.Subpage != 0)
DicConsole.WriteLine("Found unknown vendor mode page {0:X2}h subpage {1:X2}h", page.Page, page.Subpage);
else
DicConsole.WriteLine("Found unknown vendor mode page {0:X2}h", page.Page);
@@ -334,9 +334,9 @@ namespace DiscImageChef.Commands
}
case 0x01:
{
if (page.Subpage == 0)
if(page.Subpage == 0)
{
if (devType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
if(devType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_01_MMC(page.PageResponse));
else
DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_01(page.PageResponse));
@@ -348,7 +348,7 @@ namespace DiscImageChef.Commands
}
case 0x02:
{
if (page.Subpage == 0)
if(page.Subpage == 0)
DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_02(page.PageResponse));
else
goto default;
@@ -357,7 +357,7 @@ namespace DiscImageChef.Commands
}
case 0x03:
{
if (page.Subpage == 0)
if(page.Subpage == 0)
DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_03(page.PageResponse));
else
goto default;
@@ -366,7 +366,7 @@ namespace DiscImageChef.Commands
}
case 0x04:
{
if (page.Subpage == 0)
if(page.Subpage == 0)
DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_04(page.PageResponse));
else
goto default;
@@ -375,7 +375,7 @@ namespace DiscImageChef.Commands
}
case 0x05:
{
if (page.Subpage == 0)
if(page.Subpage == 0)
DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_05(page.PageResponse));
else
goto default;
@@ -384,7 +384,7 @@ namespace DiscImageChef.Commands
}
case 0x06:
{
if (page.Subpage == 0)
if(page.Subpage == 0)
DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_06(page.PageResponse));
else
goto default;
@@ -393,9 +393,9 @@ namespace DiscImageChef.Commands
}
case 0x07:
{
if (page.Subpage == 0)
if(page.Subpage == 0)
{
if (devType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
if(devType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_07_MMC(page.PageResponse));
else
DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_07(page.PageResponse));
@@ -407,7 +407,7 @@ namespace DiscImageChef.Commands
}
case 0x08:
{
if (page.Subpage == 0)
if(page.Subpage == 0)
DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_08(page.PageResponse));
else
goto default;
@@ -416,9 +416,9 @@ namespace DiscImageChef.Commands
}
case 0x0A:
{
if (page.Subpage == 0)
if(page.Subpage == 0)
DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_0A(page.PageResponse));
else if (page.Subpage == 1)
else if(page.Subpage == 1)
DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_0A_S01(page.PageResponse));
else
goto default;
@@ -427,7 +427,7 @@ namespace DiscImageChef.Commands
}
case 0x0B:
{
if (page.Subpage == 0)
if(page.Subpage == 0)
DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_0B(page.PageResponse));
else
goto default;
@@ -436,7 +436,7 @@ namespace DiscImageChef.Commands
}
case 0x0D:
{
if (page.Subpage == 0)
if(page.Subpage == 0)
DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_0D(page.PageResponse));
else
goto default;
@@ -445,7 +445,7 @@ namespace DiscImageChef.Commands
}
case 0x0E:
{
if (page.Subpage == 0)
if(page.Subpage == 0)
DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_0E(page.PageResponse));
else
goto default;
@@ -454,7 +454,7 @@ namespace DiscImageChef.Commands
}
case 0x0F:
{
if (page.Subpage == 0)
if(page.Subpage == 0)
DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_0F(page.PageResponse));
else
goto default;
@@ -463,9 +463,9 @@ namespace DiscImageChef.Commands
}
case 0x10:
{
if (page.Subpage == 0)
if(page.Subpage == 0)
{
if (devType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess)
if(devType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess)
DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_10_SSC(page.PageResponse));
else
DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_10(page.PageResponse));
@@ -477,9 +477,9 @@ namespace DiscImageChef.Commands
}
case 0x1A:
{
if (page.Subpage == 0)
if(page.Subpage == 0)
DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_1A(page.PageResponse));
else if (page.Subpage == 1)
else if(page.Subpage == 1)
DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_1A_S01(page.PageResponse));
else
goto default;
@@ -488,7 +488,7 @@ namespace DiscImageChef.Commands
}
case 0x1B:
{
if (page.Subpage == 0)
if(page.Subpage == 0)
DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_1B(page.PageResponse));
else
goto default;
@@ -497,14 +497,14 @@ namespace DiscImageChef.Commands
}
case 0x1C:
{
if (page.Subpage == 0)
if(page.Subpage == 0)
{
if (devType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
if(devType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_1C_SFF(page.PageResponse));
else
DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_1C(page.PageResponse));
}
else if (page.Subpage == 1)
else if(page.Subpage == 1)
DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_1C_S01(page.PageResponse));
else
goto default;
@@ -513,7 +513,7 @@ namespace DiscImageChef.Commands
}
case 0x2A:
{
if (page.Subpage == 0)
if(page.Subpage == 0)
DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyModePage_2A(page.PageResponse));
else
goto default;
@@ -522,7 +522,7 @@ namespace DiscImageChef.Commands
}
case 0x3E:
{
if (StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "FUJITSU")
if(StringHandlers.CToString(inq.Value.VendorIdentification).Trim() == "FUJITSU")
DicConsole.WriteLine(Decoders.SCSI.Modes.PrettifyFujitsuModePage_3E(page.PageResponse));
else
goto default;
@@ -531,7 +531,7 @@ namespace DiscImageChef.Commands
}
default:
{
if (page.Subpage != 0)
if(page.Subpage != 0)
DicConsole.WriteLine("Found unknown mode page {0:X2}h subpage {1:X2}h", page.Page, page.Subpage);
else
DicConsole.WriteLine("Found unknown mode page {0:X2}h", page.Page);
@@ -542,13 +542,13 @@ namespace DiscImageChef.Commands
}
}
if (devType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
if(devType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
{
byte[] confBuf;
sense = dev.GetConfiguration(out confBuf, out senseBuf, dev.Timeout, out duration);
if (!sense)
if(!sense)
{
doWriteFile(options.OutputPrefix, "_mmc_getconfiguration.bin", "MMC GET CONFIGURATION", confBuf);
@@ -556,14 +556,14 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("Device-Info command", "GET CONFIGURATION length is {0} bytes", ftr.DataLength);
DicConsole.DebugWriteLine("Device-Info command", "GET CONFIGURATION current profile is {0:X4}h", ftr.CurrentProfile);
if (ftr.Descriptors != null)
if(ftr.Descriptors != null)
{
DicConsole.WriteLine("SCSI MMC GET CONFIGURATION Features:");
foreach (Decoders.SCSI.MMC.Features.FeatureDescriptor desc in ftr.Descriptors)
foreach(Decoders.SCSI.MMC.Features.FeatureDescriptor desc in ftr.Descriptors)
{
DicConsole.DebugWriteLine("Device-Info command", "Feature {0:X4}h", desc.Code);
switch (desc.Code)
switch(desc.Code)
{
case 0x0000:
DicConsole.WriteLine(Decoders.SCSI.MMC.Features.Prettify_0000(desc.Data));
@@ -795,13 +795,13 @@ namespace DiscImageChef.Commands
*/
#region Plextor
if (dev.Manufacturer == "PLEXTOR")
if(dev.Manufacturer == "PLEXTOR")
{
bool plxtSense = true;
bool plxtDvd = false;
byte[] plxtBuf = null;
switch (dev.Model)
switch(dev.Model)
{
case "DVDR PX-708A":
case "DVDR PX-708A2":
@@ -817,10 +817,10 @@ namespace DiscImageChef.Commands
{
byte[] plxtBufSmall;
plxtBuf = new byte[256 * 4];
for (byte i = 0; i < 4; i++)
for(byte i = 0; i < 4; i++)
{
plxtSense = dev.PlextorReadEepromBlock(out plxtBufSmall, out senseBuf, i, 256, dev.Timeout, out duration);
if (plxtSense)
if(plxtSense)
break;
Array.Copy(plxtBufSmall, 0, plxtBuf, i * 256, 256);
}
@@ -829,7 +829,7 @@ namespace DiscImageChef.Commands
}
default:
{
if (dev.Model.StartsWith("CD-R "))
if(dev.Model.StartsWith("CD-R "))
{
plxtSense = dev.PlextorReadEepromCDR(out plxtBuf, out senseBuf, dev.Timeout, out duration);
}
@@ -837,7 +837,7 @@ namespace DiscImageChef.Commands
}
}
if (!plxtSense)
if(!plxtSense)
{
doWriteFile(options.OutputPrefix, "_plextor_eeprom.bin", "PLEXTOR READ EEPROM", plxtBuf);
@@ -845,7 +845,7 @@ namespace DiscImageChef.Commands
uint cdReadTime, cdWriteTime, dvdReadTime = 0, dvdWriteTime = 0;
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
if (plxtDvd)
if(plxtDvd)
{
discs = BigEndianBitConverter.ToUInt16(plxtBuf, 0x0120);
cdReadTime = BigEndianBitConverter.ToUInt32(plxtBuf, 0x0122);
@@ -865,7 +865,7 @@ namespace DiscImageChef.Commands
cdReadTime / 3600, (cdReadTime / 60) % 60, cdReadTime % 60);
DicConsole.WriteLine("Drive has spent {0} hours, {1} minutes and {2} seconds writing CDs",
cdWriteTime / 3600, (cdWriteTime / 60) % 60, cdWriteTime % 60);
if (plxtDvd)
if(plxtDvd)
{
DicConsole.WriteLine("Drive has spent {0} hours, {1} minutes and {2} seconds reading DVDs",
dvdReadTime / 3600, (dvdReadTime / 60) % 60, dvdReadTime % 60);
@@ -877,14 +877,14 @@ namespace DiscImageChef.Commands
bool plxtPwrRecEnabled;
ushort plxtPwrRecSpeed;
plxtSense = dev.PlextorGetPoweRec(out senseBuf, out plxtPwrRecEnabled, out plxtPwrRecSpeed, dev.Timeout, out duration);
if (!plxtSense)
if(!plxtSense)
{
DicConsole.Write("Drive supports PoweRec");
if (plxtPwrRecEnabled)
if(plxtPwrRecEnabled)
{
DicConsole.Write(", has it enabled");
if (plxtPwrRecSpeed > 0)
if(plxtPwrRecSpeed > 0)
DicConsole.WriteLine(" and recommends {0} Kb/sec.", plxtPwrRecSpeed);
else
DicConsole.WriteLine(".");
@@ -892,13 +892,13 @@ namespace DiscImageChef.Commands
ushort plxtPwrRecSelected, plxtPwrRecMax, plxtPwrRecLast;
plxtSense = dev.PlextorGetSpeeds(out senseBuf, out plxtPwrRecSelected, out plxtPwrRecMax, out plxtPwrRecLast, dev.Timeout, out duration);
if (!plxtSense)
if(!plxtSense)
{
if (plxtPwrRecSelected > 0)
if(plxtPwrRecSelected > 0)
DicConsole.WriteLine("Selected PoweRec speed for currently inserted media is {0} Kb/sec ({1}x)", plxtPwrRecSelected, plxtPwrRecSelected / 177);
if (plxtPwrRecMax > 0)
if(plxtPwrRecMax > 0)
DicConsole.WriteLine("Maximum PoweRec speed for currently inserted media is {0} Kb/sec ({1}x)", plxtPwrRecMax, plxtPwrRecMax / 177);
if (plxtPwrRecLast > 0)
if(plxtPwrRecLast > 0)
DicConsole.WriteLine("Last used PoweRec was {0} Kb/sec ({1}x)", plxtPwrRecLast, plxtPwrRecLast / 177);
}
}
@@ -908,101 +908,101 @@ namespace DiscImageChef.Commands
// TODO: Check it with a drive
plxtSense = dev.PlextorGetSilentMode(out plxtBuf, out senseBuf, dev.Timeout, out duration);
if (!plxtSense)
if(!plxtSense)
{
DicConsole.WriteLine("Drive supports Plextor SilentMode");
if (plxtBuf[0] == 1)
if(plxtBuf[0] == 1)
{
DicConsole.WriteLine("Plextor SilentMode is enabled:");
if (plxtBuf[1] == 2)
if(plxtBuf[1] == 2)
DicConsole.WriteLine("\tAccess time is slow");
else
DicConsole.WriteLine("\tAccess time is fast");
if (plxtBuf[2] > 0)
if(plxtBuf[2] > 0)
DicConsole.WriteLine("\tCD read speed limited to {0}x", plxtBuf[2]);
if (plxtBuf[3] > 0 && plxtDvd)
if(plxtBuf[3] > 0 && plxtDvd)
DicConsole.WriteLine("\tDVD read speed limited to {0}x", plxtBuf[3]);
if (plxtBuf[4] > 0)
if(plxtBuf[4] > 0)
DicConsole.WriteLine("\tCD write speed limited to {0}x", plxtBuf[4]);
if (plxtBuf[6] > 0)
if(plxtBuf[6] > 0)
DicConsole.WriteLine("\tTray eject speed limited to {0}", -(plxtBuf[6] + 48));
if (plxtBuf[7] > 0)
if(plxtBuf[7] > 0)
DicConsole.WriteLine("\tTray eject speed limited to {0}", plxtBuf[7] - 47);
}
}
plxtSense = dev.PlextorGetGigaRec(out plxtBuf, out senseBuf, dev.Timeout, out duration);
if (!plxtSense)
if(!plxtSense)
{
DicConsole.WriteLine("Drive supports Plextor GigaRec");
// TODO: Pretty print it
}
plxtSense = dev.PlextorGetSecuRec(out plxtBuf, out senseBuf, dev.Timeout, out duration);
if (!plxtSense)
if(!plxtSense)
{
DicConsole.WriteLine("Drive supports Plextor SecuRec");
// TODO: Pretty print it
}
plxtSense = dev.PlextorGetSpeedRead(out plxtBuf, out senseBuf, dev.Timeout, out duration);
if (!plxtSense)
if(!plxtSense)
{
DicConsole.Write("Drive supports Plextor SpeedRead");
if ((plxtBuf[2] & 0x01) == 0x01)
if((plxtBuf[2] & 0x01) == 0x01)
DicConsole.WriteLine("and has it enabled");
else
DicConsole.WriteLine();
}
plxtSense = dev.PlextorGetHiding(out plxtBuf, out senseBuf, dev.Timeout, out duration);
if (!plxtSense)
if(!plxtSense)
{
DicConsole.WriteLine("Drive supports hiding CD-Rs and forcing single session");
if ((plxtBuf[2] & 0x02) == 0x02)
if((plxtBuf[2] & 0x02) == 0x02)
DicConsole.WriteLine("Drive currently hides CD-Rs");
if ((plxtBuf[2] & 0x01) == 0x01)
if((plxtBuf[2] & 0x01) == 0x01)
DicConsole.WriteLine("Drive currently forces single session");
}
plxtSense = dev.PlextorGetVariRec(out plxtBuf, out senseBuf, false, dev.Timeout, out duration);
if (!plxtSense)
if(!plxtSense)
{
DicConsole.WriteLine("Drive supports Plextor VariRec");
// TODO: Pretty print it
}
if (plxtDvd)
if(plxtDvd)
{
plxtSense = dev.PlextorGetVariRec(out plxtBuf, out senseBuf, true, dev.Timeout, out duration);
if (!plxtSense)
if(!plxtSense)
{
DicConsole.WriteLine("Drive supports Plextor VariRec for DVDs");
// TODO: Pretty print it
}
plxtSense = dev.PlextorGetBitsetting(out plxtBuf, out senseBuf, false, dev.Timeout, out duration);
if (!plxtSense)
if(!plxtSense)
DicConsole.WriteLine("Drive supports bitsetting DVD+R book type");
plxtSense = dev.PlextorGetBitsetting(out plxtBuf, out senseBuf, true, dev.Timeout, out duration);
if (!plxtSense)
if(!plxtSense)
DicConsole.WriteLine("Drive supports bitsetting DVD+R DL book type");
plxtSense = dev.PlextorGetTestWriteDvdPlus(out plxtBuf, out senseBuf, dev.Timeout, out duration);
if (!plxtSense)
if(!plxtSense)
DicConsole.WriteLine("Drive supports test writing DVD+");
}
}
#endregion Plextor
}
if (devType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess)
if(devType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess)
{
byte[] seqBuf;
sense = dev.ReadBlockLimits(out seqBuf, out senseBuf, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.ErrorWriteLine("READ BLOCK LIMITS:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
@@ -1012,13 +1012,13 @@ namespace DiscImageChef.Commands
}
sense = dev.ReportDensitySupport(out seqBuf, out senseBuf, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.ErrorWriteLine("REPORT DENSITY SUPPORT:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
doWriteFile(options.OutputPrefix, "_ssc_reportdensitysupport.bin", "SSC REPORT DENSITY SUPPORT", seqBuf);
Decoders.SCSI.SSC.DensitySupport.DensitySupportHeader? dens = Decoders.SCSI.SSC.DensitySupport.DecodeDensity(seqBuf);
if (dens.HasValue)
if(dens.HasValue)
{
DicConsole.WriteLine("Densities supported by device:");
DicConsole.WriteLine(Decoders.SCSI.SSC.DensitySupport.PrettifyDensity(dens));
@@ -1026,13 +1026,13 @@ namespace DiscImageChef.Commands
}
sense = dev.ReportDensitySupport(out seqBuf, out senseBuf, true, false, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.ErrorWriteLine("REPORT DENSITY SUPPORT (MEDIUM):\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
doWriteFile(options.OutputPrefix, "_ssc_reportdensitysupport_medium.bin", "SSC REPORT DENSITY SUPPORT (MEDIUM)", seqBuf);
Decoders.SCSI.SSC.DensitySupport.MediaTypeSupportHeader? meds = Decoders.SCSI.SSC.DensitySupport.DecodeMediumType(seqBuf);
if (meds.HasValue)
if(meds.HasValue)
{
DicConsole.WriteLine("Medium types supported by device:");
DicConsole.WriteLine(Decoders.SCSI.SSC.DensitySupport.PrettifyMediumType(meds));
@@ -1055,7 +1055,7 @@ namespace DiscImageChef.Commands
{
if(!string.IsNullOrEmpty(outputPrefix))
{
if (!File.Exists(outputPrefix + outputSuffix))
if(!File.Exists(outputPrefix + outputSuffix))
{
try
{

File diff suppressed because it is too large Load Diff

View File

@@ -54,7 +54,7 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("Entropy command", "--input={0}", options.InputFile);
DicConsole.DebugWriteLine("Entropy command", "--duplicated-sectors={0}", options.DuplicatedSectors);
if (!System.IO.File.Exists(options.InputFile))
if(!System.IO.File.Exists(options.InputFile))
{
DicConsole.ErrorWriteLine("Specified file does not exist.");
return;
@@ -62,7 +62,7 @@ namespace DiscImageChef.Commands
ImagePlugin inputFormat = ImageFormat.Detect(options.InputFile);
if (inputFormat == null)
if(inputFormat == null)
{
DicConsole.ErrorWriteLine("Unable to recognize image format, not checksumming");
return;
@@ -72,13 +72,13 @@ namespace DiscImageChef.Commands
Core.Statistics.AddMediaFormat(inputFormat.GetImageFormat());
Core.Statistics.AddMedia(inputFormat.ImageInfo.mediaType, false);
if (options.SeparatedTracks)
if(options.SeparatedTracks)
{
try
{
List<Track> inputTracks = inputFormat.GetTracks();
foreach (Track currentTrack in inputTracks)
foreach(Track currentTrack in inputTracks)
{
SHA1Context sha1ctxTrack = new SHA1Context();
ulong[] entTable = new ulong[256];
@@ -88,7 +88,7 @@ namespace DiscImageChef.Commands
ulong sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
DicConsole.WriteLine("Track {0} has {1} sectors", currentTrack.TrackSequence, sectors);
for (ulong i = currentTrack.TrackStartSector; i <= currentTrack.TrackEndSector; i++)
for(ulong i = currentTrack.TrackStartSector; i <= currentTrack.TrackEndSector; i++)
{
DicConsole.Write("\rEntropying sector {0} of track {1}", i + 1, currentTrack.TrackSequence);
byte[] sector = inputFormat.ReadSector(i, currentTrack.TrackSequence);
@@ -110,21 +110,21 @@ namespace DiscImageChef.Commands
double entropy = 0;
foreach(ulong l in entTable)
{
double frequency = (double)l/(double)trackSize;
double frequency = (double)l / (double)trackSize;
entropy += -(frequency * Math.Log(frequency, 2));
}
DicConsole.WriteLine("Entropy for track {0} is {1:F4}.", currentTrack.TrackSequence, entropy);
if(options.DuplicatedSectors)
DicConsole.WriteLine("Track {0} has {1} unique sectors ({1:P3})", currentTrack.TrackSequence, uniqueSectorsPerTrack.Count, (double)uniqueSectorsPerTrack.Count/(double)sectors);
DicConsole.WriteLine("Track {0} has {1} unique sectors ({1:P3})", currentTrack.TrackSequence, uniqueSectorsPerTrack.Count, (double)uniqueSectorsPerTrack.Count / (double)sectors);
DicConsole.WriteLine();
}
}
catch (Exception ex)
catch(Exception ex)
{
if (options.Debug)
if(options.Debug)
DicConsole.DebugWriteLine("Could not get tracks because {0}", ex.Message);
else
DicConsole.ErrorWriteLine("Unable to get separate tracks, not calculating their entropy");
@@ -132,7 +132,7 @@ namespace DiscImageChef.Commands
}
if (options.WholeDisc)
if(options.WholeDisc)
{
SHA1Context sha1Ctx = new SHA1Context();
ulong[] entTable = new ulong[256];
@@ -144,7 +144,7 @@ namespace DiscImageChef.Commands
sha1Ctx.Init();
for (ulong i = 0; i < sectors; i++)
for(ulong i = 0; i < sectors; i++)
{
DicConsole.Write("\rEntropying sector {0}", i + 1);
byte[] sector = inputFormat.ReadSector(i);
@@ -167,7 +167,7 @@ namespace DiscImageChef.Commands
double entropy = 0;
foreach(ulong l in entTable)
{
double frequency = (double)l/(double)diskSize;
double frequency = (double)l / (double)diskSize;
entropy += -(frequency * Math.Log(frequency, 2));
}
@@ -176,7 +176,7 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Entropy for disk is {0:F4}.", entropy);
if(options.DuplicatedSectors)
DicConsole.WriteLine("Disk has {0} unique sectors ({1:P3})", uniqueSectors.Count, (double)uniqueSectors.Count/(double)sectors);
DicConsole.WriteLine("Disk has {0} unique sectors ({1:P3})", uniqueSectors.Count, (double)uniqueSectors.Count / (double)sectors);
Core.Statistics.AddCommand("entropy");
}

View File

@@ -54,7 +54,7 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Supported disc image formats:");
if(FormatsOptions.Verbose)
DicConsole.VerboseWriteLine("GUID\t\t\t\t\tPlugin");
foreach (KeyValuePair<string, ImagePlugin> kvp in plugins.ImagePluginsList)
foreach(KeyValuePair<string, ImagePlugin> kvp in plugins.ImagePluginsList)
{
if(FormatsOptions.Verbose)
DicConsole.VerboseWriteLine("{0}\t{1}", kvp.Value.PluginUUID, kvp.Value.Name);
@@ -65,7 +65,7 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Supported filesystems:");
if(FormatsOptions.Verbose)
DicConsole.VerboseWriteLine("GUID\t\t\t\t\tPlugin");
foreach (KeyValuePair<string, Plugin> kvp in plugins.PluginsList)
foreach(KeyValuePair<string, Plugin> kvp in plugins.PluginsList)
{
if(FormatsOptions.Verbose)
DicConsole.VerboseWriteLine("{0}\t{1}", kvp.Value.PluginUUID, kvp.Value.Name);
@@ -76,7 +76,7 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Supported partitioning schemes:");
if(FormatsOptions.Verbose)
DicConsole.VerboseWriteLine("GUID\t\t\t\t\tPlugin");
foreach (KeyValuePair<string, PartPlugin> kvp in plugins.PartPluginsList)
foreach(KeyValuePair<string, PartPlugin> kvp in plugins.PartPluginsList)
{
if(FormatsOptions.Verbose)
DicConsole.VerboseWriteLine("{0}\t{1}", kvp.Value.PluginUUID, kvp.Value.Name);

View File

@@ -53,13 +53,13 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("Media-Info command", "--device={0}", options.DevicePath);
DicConsole.DebugWriteLine("Media-Info command", "--output-prefix={0}", options.OutputPrefix);
if (!System.IO.File.Exists(options.DevicePath))
if(!System.IO.File.Exists(options.DevicePath))
{
DicConsole.ErrorWriteLine("Specified device does not exist.");
return;
}
if (options.DevicePath.Length == 2 && options.DevicePath[1] == ':' &&
if(options.DevicePath.Length == 2 && options.DevicePath[1] == ':' &&
options.DevicePath[0] != '/' && Char.IsLetter(options.DevicePath[0]))
{
options.DevicePath = "\\\\.\\" + Char.ToUpper(options.DevicePath[0]) + ':';
@@ -67,7 +67,7 @@ namespace DiscImageChef.Commands
Device dev = new Device(options.DevicePath);
if (dev.Error)
if(dev.Error)
{
DicConsole.ErrorWriteLine("Error {0} opening device.", dev.LastError);
return;
@@ -75,7 +75,7 @@ namespace DiscImageChef.Commands
Core.Statistics.AddDevice(dev);
switch (dev.Type)
switch(dev.Type)
{
case DeviceType.ATA:
doATAMediaInfo(options.OutputPrefix, dev);
@@ -123,49 +123,49 @@ namespace DiscImageChef.Commands
ulong blocks = 0;
uint blockSize = 0;
if (dev.IsRemovable)
if(dev.IsRemovable)
{
sense = dev.ScsiTestUnitReady(out senseBuf, dev.Timeout, out duration);
if (sense)
if(sense)
{
Decoders.SCSI.FixedSense? decSense = Decoders.SCSI.Sense.DecodeFixed(senseBuf);
if (decSense.HasValue)
if(decSense.HasValue)
{
if (decSense.Value.ASC == 0x3A)
if(decSense.Value.ASC == 0x3A)
{
int leftRetries = 5;
while (leftRetries > 0)
while(leftRetries > 0)
{
DicConsole.WriteLine("\rWaiting for drive to become ready");
System.Threading.Thread.Sleep(2000);
sense = dev.ScsiTestUnitReady(out senseBuf, dev.Timeout, out duration);
if (!sense)
if(!sense)
break;
leftRetries--;
}
if (sense)
if(sense)
{
DicConsole.ErrorWriteLine("Please insert media in drive");
return;
}
}
else if (decSense.Value.ASC == 0x04 && decSense.Value.ASCQ == 0x01)
else if(decSense.Value.ASC == 0x04 && decSense.Value.ASCQ == 0x01)
{
int leftRetries = 10;
while (leftRetries > 0)
while(leftRetries > 0)
{
DicConsole.WriteLine("\rWaiting for drive to become ready");
System.Threading.Thread.Sleep(2000);
sense = dev.ScsiTestUnitReady(out senseBuf, dev.Timeout, out duration);
if (!sense)
if(!sense)
break;
leftRetries--;
}
if (sense)
if(sense)
{
DicConsole.ErrorWriteLine("Error testing unit was ready:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
return;
@@ -190,12 +190,12 @@ namespace DiscImageChef.Commands
Decoders.SCSI.PeripheralDeviceTypes devType = dev.SCSIType;
sense = dev.ModeSense10(out modeBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, 0x3F, 0xFF, 5, out duration);
if (sense || dev.Error)
if(sense || dev.Error)
{
sense = dev.ModeSense10(out modeBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out duration);
}
if (!sense && !dev.Error)
if(!sense && !dev.Error)
{
decMode = Decoders.SCSI.Modes.DecodeMode10(modeBuf, devType);
}
@@ -203,16 +203,16 @@ namespace DiscImageChef.Commands
if(sense || dev.Error || !decMode.HasValue)
{
sense = dev.ModeSense6(out modeBuf, out senseBuf, false, ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out duration);
if (sense || dev.Error)
if(sense || dev.Error)
sense = dev.ModeSense6(out modeBuf, out senseBuf, false, ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out duration);
if (sense || dev.Error)
if(sense || dev.Error)
sense = dev.ModeSense(out modeBuf, out senseBuf, 5, out duration);
if (!sense && !dev.Error)
if(!sense && !dev.Error)
decMode = Decoders.SCSI.Modes.DecodeMode6(modeBuf, devType);
}
if (!sense)
if(!sense)
doWriteFile(outputPrefix, "_scsi_modesense.bin", "SCSI MODE SENSE", modeBuf);
byte scsiMediumType = 0;
@@ -230,7 +230,7 @@ namespace DiscImageChef.Commands
containsFloppyPage = true;
}
if (dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.DirectAccess ||
if(dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.DirectAccess ||
dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice ||
dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.OCRWDevice ||
dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.OpticalDevice ||
@@ -238,28 +238,28 @@ namespace DiscImageChef.Commands
dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.WriteOnceDevice)
{
sense = dev.ReadCapacity(out cmdBuf, out senseBuf, dev.Timeout, out duration);
if (!sense)
if(!sense)
{
doWriteFile(outputPrefix, "_readcapacity.bin", "SCSI READ CAPACITY", cmdBuf);
blocks = (ulong)((cmdBuf[0] << 24) + (cmdBuf[1] << 16) + (cmdBuf[2] << 8) + (cmdBuf[3]));
blockSize = (uint)((cmdBuf[5] << 24) + (cmdBuf[5] << 16) + (cmdBuf[6] << 8) + (cmdBuf[7]));
}
if (sense || blocks == 0xFFFFFFFF)
if(sense || blocks == 0xFFFFFFFF)
{
sense = dev.ReadCapacity16(out cmdBuf, out senseBuf, dev.Timeout, out duration);
if (sense && blocks == 0)
if(sense && blocks == 0)
{
// Not all MMC devices support READ CAPACITY, as they have READ TOC
if (dev.SCSIType != DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
if(dev.SCSIType != DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
{
DicConsole.ErrorWriteLine("Unable to get media capacity");
DicConsole.ErrorWriteLine("{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
}
}
if (!sense)
if(!sense)
{
doWriteFile(outputPrefix, "_readcapacity16.bin", "SCSI READ CAPACITY(16)", cmdBuf);
byte[] temp = new byte[8];
@@ -271,7 +271,7 @@ namespace DiscImageChef.Commands
}
}
if (blocks != 0 && blockSize != 0)
if(blocks != 0 && blockSize != 0)
{
blocks++;
DicConsole.WriteLine("Media has {0} blocks of {1} bytes/each. (for a total of {2} bytes)",
@@ -279,21 +279,21 @@ namespace DiscImageChef.Commands
}
}
if (dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess)
if(dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess)
{
byte[] seqBuf;
byte[] medBuf;
sense = dev.ReportDensitySupport(out seqBuf, out senseBuf, false, dev.Timeout, out duration);
if (!sense)
if(!sense)
{
sense = dev.ReportDensitySupport(out medBuf, out senseBuf, true, dev.Timeout, out duration);
if (!sense && !seqBuf.SequenceEqual(medBuf))
if(!sense && !seqBuf.SequenceEqual(medBuf))
{
doWriteFile(outputPrefix, "_ssc_reportdensitysupport_media.bin", "SSC REPORT DENSITY SUPPORT (MEDIA)", seqBuf);
Decoders.SCSI.SSC.DensitySupport.DensitySupportHeader? dens = Decoders.SCSI.SSC.DensitySupport.DecodeDensity(seqBuf);
if (dens.HasValue)
if(dens.HasValue)
{
DicConsole.WriteLine("Densities supported by currently inserted media:");
DicConsole.WriteLine(Decoders.SCSI.SSC.DensitySupport.PrettifyDensity(dens));
@@ -302,15 +302,15 @@ namespace DiscImageChef.Commands
}
sense = dev.ReportDensitySupport(out seqBuf, out senseBuf, true, false, dev.Timeout, out duration);
if (!sense)
if(!sense)
{
sense = dev.ReportDensitySupport(out medBuf, out senseBuf, true, true, dev.Timeout, out duration);
if (!sense && !seqBuf.SequenceEqual(medBuf))
if(!sense && !seqBuf.SequenceEqual(medBuf))
{
doWriteFile(outputPrefix, "_ssc_reportdensitysupport_medium_media.bin", "SSC REPORT DENSITY SUPPORT (MEDIUM & MEDIA)", seqBuf);
Decoders.SCSI.SSC.DensitySupport.MediaTypeSupportHeader? meds = Decoders.SCSI.SSC.DensitySupport.DecodeMediumType(seqBuf);
if (meds.HasValue)
if(meds.HasValue)
{
DicConsole.WriteLine("Medium types currently inserted in device:");
DicConsole.WriteLine(Decoders.SCSI.SSC.DensitySupport.PrettifyMediumType(meds));
@@ -331,10 +331,10 @@ namespace DiscImageChef.Commands
*/
}
if (dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
if(dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.MultiMediaDevice)
{
sense = dev.GetConfiguration(out cmdBuf, out senseBuf, 0, MmcGetConfigurationRt.Current, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ GET CONFIGURATION:\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
@@ -344,7 +344,7 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("Media-Info command", "GET CONFIGURATION current profile is {0:X4}h", ftr.CurrentProfile);
switch (ftr.CurrentProfile)
switch(ftr.CurrentProfile)
{
case 0x0001:
dskType = MediaType.GENERIC_HDD;
@@ -437,12 +437,12 @@ namespace DiscImageChef.Commands
}
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.RecognizedFormatLayers, 0, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Recognized Format Layers\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_formatlayers.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.WriteProtectionStatus, 0, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Write Protection Status\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_writeprotection.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
@@ -457,7 +457,7 @@ namespace DiscImageChef.Commands
*/
#region All DVD and HD DVD types
if (dskType == MediaType.DVDDownload || dskType == MediaType.DVDPR ||
if(dskType == MediaType.DVDDownload || dskType == MediaType.DVDPR ||
dskType == MediaType.DVDPRDL || dskType == MediaType.DVDPRW ||
dskType == MediaType.DVDPRWDL || dskType == MediaType.DVDR ||
dskType == MediaType.DVDRAM || dskType == MediaType.DVDRDL ||
@@ -469,7 +469,7 @@ namespace DiscImageChef.Commands
{
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.PhysicalInformation, 0, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: PFI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
@@ -529,7 +529,7 @@ namespace DiscImageChef.Commands
case Decoders.DVD.DiskCategory.Nintendo:
if(decPfi.Value.DiscSize == DiscImageChef.Decoders.DVD.DVDSize.Eighty)
dskType = MediaType.GOD;
else
else
dskType = MediaType.WOD;
break;
case Decoders.DVD.DiskCategory.UMD:
@@ -540,7 +540,7 @@ namespace DiscImageChef.Commands
}
}
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DiscManufacturingInformation, 0, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DMI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
@@ -548,7 +548,7 @@ namespace DiscImageChef.Commands
//if(Decoders.Xbox.DMI.IsXbox(cmdBuf))
// Nop();
//else if
if (Decoders.Xbox.DMI.IsXbox360(cmdBuf))
if(Decoders.Xbox.DMI.IsXbox360(cmdBuf))
{
// TODO: Detect XGD3 from XGD2...
dskType = MediaType.XGD2;
@@ -559,10 +559,10 @@ namespace DiscImageChef.Commands
#endregion All DVD and HD DVD types
#region DVD-ROM
if (dskType == MediaType.DVDDownload || dskType == MediaType.DVDROM)
if(dskType == MediaType.DVDDownload || dskType == MediaType.DVDROM)
{
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.CopyrightInformation, 0, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: CMI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
@@ -573,16 +573,16 @@ namespace DiscImageChef.Commands
#endregion DVD-ROM
#region DVD-ROM and HD DVD-ROM
if (dskType == MediaType.DVDDownload || dskType == MediaType.DVDROM ||
if(dskType == MediaType.DVDDownload || dskType == MediaType.DVDROM ||
dskType == MediaType.HDDVDROM)
{
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.BurstCuttingArea, 0, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: BCA\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_dvd_bca.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVD_AACS, 0, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DVD AACS\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_dvd_aacs.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
@@ -650,10 +650,10 @@ namespace DiscImageChef.Commands
#endregion Require drive authentication, won't work
#region DVD-RAM and HD DVD-RAM
if (dskType == MediaType.DVDRAM || dskType == MediaType.HDDVDRAM)
if(dskType == MediaType.DVDRAM || dskType == MediaType.HDDVDRAM)
{
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDRAM_DDS, 0, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DDS\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
@@ -661,7 +661,7 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Disc Definition Structure:\n{0}", Decoders.DVD.DDS.Prettify(cmdBuf));
}
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDRAM_MediumStatus, 0, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Medium Status\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
@@ -669,7 +669,7 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Medium Status:\n{0}", Decoders.DVD.Cartridge.Prettify(cmdBuf));
}
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDRAM_SpareAreaInformation, 0, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: SAI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
@@ -680,10 +680,10 @@ namespace DiscImageChef.Commands
#endregion DVD-RAM and HD DVD-RAM
#region DVD-R and HD DVD-R
if (dskType == MediaType.DVDR || dskType == MediaType.HDDVDR)
if(dskType == MediaType.DVDR || dskType == MediaType.HDDVDR)
{
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.LastBorderOutRMD, 0, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Last-Out Border RMD\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_dvd_lastrmd.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
@@ -691,10 +691,10 @@ namespace DiscImageChef.Commands
#endregion DVD-R and HD DVD-R
#region DVD-R and DVD-RW
if (dskType == MediaType.DVDR || dskType == MediaType.DVDRW)
if(dskType == MediaType.DVDR || dskType == MediaType.DVDRW)
{
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.PreRecordedInfo, 0, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Pre-Recorded Info\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_dvd_pri.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
@@ -702,15 +702,15 @@ namespace DiscImageChef.Commands
#endregion DVD-R and DVD-RW
#region DVD-R, DVD-RW and HD DVD-R
if (dskType == MediaType.DVDR || dskType == MediaType.DVDRW || dskType == MediaType.HDDVDR)
if(dskType == MediaType.DVDR || dskType == MediaType.DVDRW || dskType == MediaType.HDDVDR)
{
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDR_MediaIdentifier, 0, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DVD-R Media ID\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_dvdr_mediaid.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDR_PhysicalInformation, 0, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DVD-R PFI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_dvdr_pfi.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
@@ -718,7 +718,7 @@ namespace DiscImageChef.Commands
#endregion DVD-R, DVD-RW and HD DVD-R
#region All DVD+
if (dskType == MediaType.DVDPR || dskType == MediaType.DVDPRDL ||
if(dskType == MediaType.DVDPR || dskType == MediaType.DVDPRDL ||
dskType == MediaType.DVDPRW || dskType == MediaType.DVDPRWDL)
{
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.ADIP, 0, dev.Timeout, out duration);
@@ -728,7 +728,7 @@ namespace DiscImageChef.Commands
doWriteFile(outputPrefix, "_readdiscstructure_dvd+_adip.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DCB, 0, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DCB\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_dvd+_dcb.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
@@ -736,10 +736,10 @@ namespace DiscImageChef.Commands
#endregion All DVD+
#region HD DVD-ROM
if (dskType == MediaType.HDDVDROM)
if(dskType == MediaType.HDDVDROM)
{
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.HDDVD_CopyrightInformation, 0, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: HDDVD CMI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_hddvd_cmi.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
@@ -747,15 +747,15 @@ namespace DiscImageChef.Commands
#endregion HD DVD-ROM
#region HD DVD-R
if (dskType == MediaType.HDDVDR)
if(dskType == MediaType.HDDVDR)
{
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.HDDVDR_MediumStatus, 0, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: HDDVD-R Medium Status\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_hddvdr_status.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.HDDVDR_LastRMD, 0, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Last RMD\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_hddvdr_lastrmd.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
@@ -763,11 +763,11 @@ namespace DiscImageChef.Commands
#endregion HD DVD-R
#region DVD-R DL, DVD-RW DL, DVD+R DL, DVD+RW DL
if (dskType == MediaType.DVDPRDL || dskType == MediaType.DVDRDL ||
if(dskType == MediaType.DVDPRDL || dskType == MediaType.DVDRDL ||
dskType == MediaType.DVDRWDL || dskType == MediaType.DVDPRWDL)
{
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DVDR_LayerCapacity, 0, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Layer Capacity\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_dvdr_layercap.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
@@ -775,25 +775,25 @@ namespace DiscImageChef.Commands
#endregion DVD-R DL, DVD-RW DL, DVD+R DL, DVD+RW DL
#region DVD-R DL
if (dskType == MediaType.DVDRDL)
if(dskType == MediaType.DVDRDL)
{
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.MiddleZoneStart, 0, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Middle Zone Start\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_dvd_mzs.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.JumpIntervalSize, 0, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Jump Interval Size\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_dvd_jis.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.ManualLayerJumpStartLBA, 0, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Manual Layer Jump Start LBA\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_dvd_manuallj.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.RemapAnchorPoint, 0, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Remap Anchor Point\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_dvd_remapanchor.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
@@ -801,11 +801,11 @@ namespace DiscImageChef.Commands
#endregion DVD-R DL
#region All Blu-ray
if (dskType == MediaType.BDR || dskType == MediaType.BDRE || dskType == MediaType.BDROM ||
if(dskType == MediaType.BDR || dskType == MediaType.BDRE || dskType == MediaType.BDROM ||
dskType == MediaType.BDRXL || dskType == MediaType.BDREXL)
{
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.DiscInformation, 0, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
@@ -813,7 +813,7 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Blu-ray Disc Information:\n{0}", Decoders.Bluray.DI.Prettify(cmdBuf));
}
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.PAC, 0, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: PAC\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_bd_pac.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
@@ -821,10 +821,10 @@ namespace DiscImageChef.Commands
#endregion All Blu-ray
#region BD-ROM only
if (dskType == MediaType.BDROM)
if(dskType == MediaType.BDROM)
{
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.BD_BurstCuttingArea, 0, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: BCA\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
@@ -835,11 +835,11 @@ namespace DiscImageChef.Commands
#endregion BD-ROM only
#region Writable Blu-ray only
if (dskType == MediaType.BDR || dskType == MediaType.BDRE ||
if(dskType == MediaType.BDR || dskType == MediaType.BDRE ||
dskType == MediaType.BDRXL || dskType == MediaType.BDREXL)
{
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.BD_DDS, 0, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DDS\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
@@ -847,7 +847,7 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Blu-ray Disc Definition Structure:\n{0}", Decoders.Bluray.DDS.Prettify(cmdBuf));
}
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.CartridgeStatus, 0, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Cartridge Status\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
@@ -855,7 +855,7 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Blu-ray Cartridge Status:\n{0}", Decoders.Bluray.DI.Prettify(cmdBuf));
}
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.BD_SpareAreaInformation, 0, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Spare Area Information\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
@@ -863,12 +863,12 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Blu-ray Spare Area Information:\n{0}", Decoders.Bluray.DI.Prettify(cmdBuf));
}
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.BD, 0, 0, MmcDiscStructureFormat.RawDFL, 0, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Raw DFL\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_bd_dfl.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
sense = dev.ReadDiscInformation(out cmdBuf, out senseBuf, MmcDiscInformationDataTypes.TrackResources, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC INFORMATION 001b\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
@@ -876,7 +876,7 @@ namespace DiscImageChef.Commands
doWriteFile(outputPrefix, "_readdiscinformation_001b.bin", "SCSI READ DISC INFORMATION", cmdBuf);
}
sense = dev.ReadDiscInformation(out cmdBuf, out senseBuf, MmcDiscInformationDataTypes.POWResources, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC INFORMATION 010b\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
@@ -887,7 +887,7 @@ namespace DiscImageChef.Commands
#endregion Writable Blu-ray only
#region CDs
if (dskType == MediaType.CD ||
if(dskType == MediaType.CD ||
dskType == MediaType.CDR ||
dskType == MediaType.CDROM ||
dskType == MediaType.CDRW ||
@@ -898,7 +898,7 @@ namespace DiscImageChef.Commands
// We discarded all discs that falsify a TOC before requesting a real TOC
// No TOC, no CD (or an empty one)
bool tocSense = dev.ReadTocPmaAtip(out cmdBuf, out senseBuf, false, 0, 0, dev.Timeout, out duration);
if (tocSense)
if(tocSense)
DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: TOC\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
@@ -907,19 +907,19 @@ namespace DiscImageChef.Commands
doWriteFile(outputPrefix, "_toc.bin", "SCSI READ TOC/PMA/ATIP", cmdBuf);
// As we have a TOC we know it is a CD
if (dskType == MediaType.Unknown)
if(dskType == MediaType.Unknown)
dskType = MediaType.CD;
}
// ATIP exists on blank CDs
sense = dev.ReadAtip(out cmdBuf, out senseBuf, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: ATIP\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
doWriteFile(outputPrefix, "_atip.bin", "SCSI READ TOC/PMA/ATIP", cmdBuf);
Decoders.CD.ATIP.CDATIP? atip = Decoders.CD.ATIP.Decode(cmdBuf);
if (atip.HasValue)
if(atip.HasValue)
{
DicConsole.WriteLine("ATIP:\n{0}", Decoders.CD.ATIP.Prettify(atip));
// Only CD-R and CD-RW have ATIP
@@ -928,23 +928,23 @@ namespace DiscImageChef.Commands
}
// We got a TOC, get information about a recorded/mastered CD
if (!tocSense)
if(!tocSense)
{
sense = dev.ReadDiscInformation(out cmdBuf, out senseBuf, MmcDiscInformationDataTypes.DiscInformation, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC INFORMATION 000b\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
Decoders.SCSI.MMC.DiscInformation.StandardDiscInformation? discInfo = Decoders.SCSI.MMC.DiscInformation.Decode000b(cmdBuf);
if (discInfo.HasValue)
if(discInfo.HasValue)
{
DicConsole.WriteLine("Standard Disc Information:\n{0}", Decoders.SCSI.MMC.DiscInformation.Prettify000b(discInfo));
doWriteFile(outputPrefix, "_readdiscinformation_000b.bin", "SCSI READ DISC INFORMATION", cmdBuf);
// If it is a read-only CD, check CD type if available
if (dskType == MediaType.CD)
if(dskType == MediaType.CD)
{
switch (discInfo.Value.DiscType)
switch(discInfo.Value.DiscType)
{
case 0x10:
dskType = MediaType.CDI;
@@ -961,39 +961,39 @@ namespace DiscImageChef.Commands
int firstTrackLastSession = 0;
sense = dev.ReadSessionInfo(out cmdBuf, out senseBuf, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: Session info\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
doWriteFile(outputPrefix, "_session.bin", "SCSI READ TOC/PMA/ATIP", cmdBuf);
Decoders.CD.Session.CDSessionInfo? session = Decoders.CD.Session.Decode(cmdBuf);
DicConsole.WriteLine("Session information:\n{0}", Decoders.CD.Session.Prettify(session));
if (session.HasValue)
if(session.HasValue)
{
sessions = session.Value.LastCompleteSession;
firstTrackLastSession = session.Value.TrackDescriptors[0].TrackNumber;
}
}
if (dskType == MediaType.CD)
if(dskType == MediaType.CD)
{
bool hasDataTrack = false;
bool hasAudioTrack = false;
bool allFirstSessionTracksAreAudio = true;
bool hasVideoTrack = false;
if (toc.HasValue)
if(toc.HasValue)
{
foreach (Decoders.CD.TOC.CDTOCTrackDataDescriptor track in toc.Value.TrackDescriptors)
foreach(Decoders.CD.TOC.CDTOCTrackDataDescriptor track in toc.Value.TrackDescriptors)
{
if (track.TrackNumber == 1 &&
if(track.TrackNumber == 1 &&
((Decoders.CD.TOC_CONTROL)(track.CONTROL & 0x0D) == Decoders.CD.TOC_CONTROL.DataTrack ||
(Decoders.CD.TOC_CONTROL)(track.CONTROL & 0x0D) == Decoders.CD.TOC_CONTROL.DataTrackIncremental))
{
allFirstSessionTracksAreAudio &= firstTrackLastSession != 1;
}
if ((Decoders.CD.TOC_CONTROL)(track.CONTROL & 0x0D) == Decoders.CD.TOC_CONTROL.DataTrack ||
if((Decoders.CD.TOC_CONTROL)(track.CONTROL & 0x0D) == Decoders.CD.TOC_CONTROL.DataTrack ||
(Decoders.CD.TOC_CONTROL)(track.CONTROL & 0x0D) == Decoders.CD.TOC_CONTROL.DataTrackIncremental)
{
hasDataTrack = true;
@@ -1002,23 +1002,23 @@ namespace DiscImageChef.Commands
else
hasAudioTrack = true;
if (track.ADR == 4)
if(track.ADR == 4)
hasVideoTrack = true;
}
}
if (hasDataTrack && hasAudioTrack && allFirstSessionTracksAreAudio && sessions == 2)
if(hasDataTrack && hasAudioTrack && allFirstSessionTracksAreAudio && sessions == 2)
dskType = MediaType.CDPLUS;
if (!hasDataTrack && hasAudioTrack && sessions == 1)
if(!hasDataTrack && hasAudioTrack && sessions == 1)
dskType = MediaType.CDDA;
if (hasDataTrack && !hasAudioTrack && sessions == 1)
if(hasDataTrack && !hasAudioTrack && sessions == 1)
dskType = MediaType.CDROM;
if (hasVideoTrack && !hasDataTrack && sessions == 1)
if(hasVideoTrack && !hasDataTrack && sessions == 1)
dskType = MediaType.CDV;
}
sense = dev.ReadRawToc(out cmdBuf, out senseBuf, 1, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: Raw TOC\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
@@ -1026,7 +1026,7 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Raw TOC:\n{0}", Decoders.CD.FullTOC.Prettify(cmdBuf));
}
sense = dev.ReadPma(out cmdBuf, out senseBuf, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: PMA\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
@@ -1035,12 +1035,12 @@ namespace DiscImageChef.Commands
}
sense = dev.ReadCdText(out cmdBuf, out senseBuf, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: CD-TEXT\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
doWriteFile(outputPrefix, "_cdtext.bin", "SCSI READ TOC/PMA/ATIP", cmdBuf);
if (Decoders.CD.CDTextOnLeadIn.Decode(cmdBuf).HasValue)
if(Decoders.CD.CDTextOnLeadIn.Decode(cmdBuf).HasValue)
DicConsole.WriteLine("CD-TEXT on Lead-In:\n{0}", Decoders.CD.CDTextOnLeadIn.Prettify(cmdBuf));
}
}
@@ -1048,30 +1048,30 @@ namespace DiscImageChef.Commands
#endregion CDs
#region Nintendo
if (dskType == MediaType.Unknown && blocks > 0)
if(dskType == MediaType.Unknown && blocks > 0)
{
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.PhysicalInformation, 0, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: PFI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
doWriteFile(outputPrefix, "_readdiscstructure_dvd_pfi.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
Decoders.DVD.PFI.PhysicalFormatInformation? nintendoPfi = Decoders.DVD.PFI.Decode(cmdBuf);
if (nintendoPfi != null)
if(nintendoPfi != null)
{
DicConsole.WriteLine("PFI:\n{0}", Decoders.DVD.PFI.Prettify(cmdBuf));
if (nintendoPfi.Value.DiskCategory == DiscImageChef.Decoders.DVD.DiskCategory.Nintendo &&
if(nintendoPfi.Value.DiskCategory == DiscImageChef.Decoders.DVD.DiskCategory.Nintendo &&
nintendoPfi.Value.PartVersion == 15)
{
if (nintendoPfi.Value.DiscSize == DiscImageChef.Decoders.DVD.DVDSize.Eighty)
if(nintendoPfi.Value.DiscSize == DiscImageChef.Decoders.DVD.DVDSize.Eighty)
dskType = MediaType.GOD;
else if (nintendoPfi.Value.DiscSize == DiscImageChef.Decoders.DVD.DVDSize.OneTwenty)
else if(nintendoPfi.Value.DiscSize == DiscImageChef.Decoders.DVD.DVDSize.OneTwenty)
dskType = MediaType.WOD;
}
}
}
sense = dev.ReadDiscStructure(out cmdBuf, out senseBuf, MmcDiscStructureMediaType.DVD, 0, 0, MmcDiscStructureFormat.DiscManufacturingInformation, 0, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DMI\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
doWriteFile(outputPrefix, "_readdiscstructure_dvd_dmi.bin", "SCSI READ DISC STRUCTURE", cmdBuf);
@@ -1089,15 +1089,15 @@ namespace DiscImageChef.Commands
Core.Statistics.AddMedia(dskType, true);
sense = dev.ReadMediaSerialNumber(out cmdBuf, out senseBuf, dev.Timeout, out duration);
if (sense)
if(sense)
DicConsole.DebugWriteLine("Media-Info command", "READ MEDIA SERIAL NUMBER\n{0}", Decoders.SCSI.Sense.PrettifySense(senseBuf));
else
{
doWriteFile(outputPrefix, "_mediaserialnumber.bin", "SCSI READ MEDIA SERIAL NUMBER", cmdBuf);
if (cmdBuf.Length >= 4)
if(cmdBuf.Length >= 4)
{
DicConsole.Write("Media Serial Number: ");
for (int i = 4; i < cmdBuf.Length; i++)
for(int i = 4; i < cmdBuf.Length; i++)
DicConsole.Write("{0:X2}", cmdBuf[i]);
DicConsole.WriteLine();
}
@@ -1106,9 +1106,9 @@ namespace DiscImageChef.Commands
static void doWriteFile(string outputPrefix, string outputSuffix, string whatWriting, byte[] data)
{
if (!string.IsNullOrEmpty(outputPrefix))
if(!string.IsNullOrEmpty(outputPrefix))
{
if (!File.Exists(outputPrefix + outputSuffix))
if(!File.Exists(outputPrefix + outputSuffix))
{
try
{

File diff suppressed because it is too large Load Diff

View File

@@ -53,7 +53,7 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("PrintHex command", "--long-sectors={0}", options.LongSectors);
DicConsole.DebugWriteLine("PrintHex command", "--WidthBytes={0}", options.WidthBytes);
if (!System.IO.File.Exists(options.InputFile))
if(!System.IO.File.Exists(options.InputFile))
{
DicConsole.ErrorWriteLine("Specified file does not exist.");
return;
@@ -61,7 +61,7 @@ namespace DiscImageChef.Commands
ImagePlugin inputFormat = ImageFormat.Detect(options.InputFile);
if (inputFormat == null)
if(inputFormat == null)
{
DicConsole.ErrorWriteLine("Unable to recognize image format, not verifying");
return;
@@ -74,21 +74,21 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Sector {0}", options.StartSector + i);
byte[] sector;
if (inputFormat.ImageInfo.readableSectorTags == null)
if(inputFormat.ImageInfo.readableSectorTags == null)
{
DicConsole.WriteLine("Requested sectors with tags, unsupported by underlying image format, printing only user data.");
options.LongSectors = false;
}
else
{
if (inputFormat.ImageInfo.readableSectorTags.Count == 0)
if(inputFormat.ImageInfo.readableSectorTags.Count == 0)
{
DicConsole.WriteLine("Requested sectors with tags, unsupported by underlying image format, printing only user data.");
options.LongSectors = false;
}
}
if (options.LongSectors)
if(options.LongSectors)
sector = inputFormat.ReadSectorLong(options.StartSector + i);
else
sector = inputFormat.ReadSector(options.StartSector + i);

View File

@@ -52,39 +52,39 @@ namespace DiscImageChef.Commands
bool thereAreStats = false;
if (Core.Statistics.AllStats.Commands != null)
if(Core.Statistics.AllStats.Commands != null)
{
DicConsole.WriteLine("Commands statistics");
DicConsole.WriteLine("===================");
if (Core.Statistics.AllStats.Commands.Analyze > 0)
if(Core.Statistics.AllStats.Commands.Analyze > 0)
DicConsole.WriteLine("You have called the Analyze command {0} times", Core.Statistics.AllStats.Commands.Analyze);
if (Core.Statistics.AllStats.Commands.Benchmark > 0)
if(Core.Statistics.AllStats.Commands.Benchmark > 0)
DicConsole.WriteLine("You have called the Benchmark command {0} times", Core.Statistics.AllStats.Commands.Benchmark);
if (Core.Statistics.AllStats.Commands.Checksum > 0)
if(Core.Statistics.AllStats.Commands.Checksum > 0)
DicConsole.WriteLine("You have called the Checksum command {0} times", Core.Statistics.AllStats.Commands.Checksum);
if (Core.Statistics.AllStats.Commands.Compare > 0)
if(Core.Statistics.AllStats.Commands.Compare > 0)
DicConsole.WriteLine("You have called the Compare command {0} times", Core.Statistics.AllStats.Commands.Compare);
if (Core.Statistics.AllStats.Commands.CreateSidecar > 0)
if(Core.Statistics.AllStats.Commands.CreateSidecar > 0)
DicConsole.WriteLine("You have called the Create-Sidecar command {0} times", Core.Statistics.AllStats.Commands.CreateSidecar);
if (Core.Statistics.AllStats.Commands.Decode > 0)
if(Core.Statistics.AllStats.Commands.Decode > 0)
DicConsole.WriteLine("You have called the Decode command {0} times", Core.Statistics.AllStats.Commands.Decode);
if (Core.Statistics.AllStats.Commands.DeviceInfo > 0)
if(Core.Statistics.AllStats.Commands.DeviceInfo > 0)
DicConsole.WriteLine("You have called the Device-Info command {0} times", Core.Statistics.AllStats.Commands.DeviceInfo);
if (Core.Statistics.AllStats.Commands.DeviceReport > 0)
if(Core.Statistics.AllStats.Commands.DeviceReport > 0)
DicConsole.WriteLine("You have called the Device-Report command {0} times", Core.Statistics.AllStats.Commands.DeviceReport);
if (Core.Statistics.AllStats.Commands.DumpMedia > 0)
if(Core.Statistics.AllStats.Commands.DumpMedia > 0)
DicConsole.WriteLine("You have called the Dump-Media command {0} times", Core.Statistics.AllStats.Commands.DumpMedia);
if (Core.Statistics.AllStats.Commands.Entropy > 0)
if(Core.Statistics.AllStats.Commands.Entropy > 0)
DicConsole.WriteLine("You have called the Entropy command {0} times", Core.Statistics.AllStats.Commands.Entropy);
if (Core.Statistics.AllStats.Commands.Formats > 0)
if(Core.Statistics.AllStats.Commands.Formats > 0)
DicConsole.WriteLine("You have called the Formats command {0} times", Core.Statistics.AllStats.Commands.Formats);
if (Core.Statistics.AllStats.Commands.MediaInfo > 0)
if(Core.Statistics.AllStats.Commands.MediaInfo > 0)
DicConsole.WriteLine("You have called the Media-Info command {0} times", Core.Statistics.AllStats.Commands.MediaInfo);
if (Core.Statistics.AllStats.Commands.MediaScan > 0)
if(Core.Statistics.AllStats.Commands.MediaScan > 0)
DicConsole.WriteLine("You have called the Media-Scan command {0} times", Core.Statistics.AllStats.Commands.MediaScan);
if (Core.Statistics.AllStats.Commands.PrintHex > 0)
if(Core.Statistics.AllStats.Commands.PrintHex > 0)
DicConsole.WriteLine("You have called the Print-Hex command {0} times", Core.Statistics.AllStats.Commands.PrintHex);
if (Core.Statistics.AllStats.Commands.Verify > 0)
if(Core.Statistics.AllStats.Commands.Verify > 0)
DicConsole.WriteLine("You have called the Verify command {0} times", Core.Statistics.AllStats.Commands.Verify);
DicConsole.WriteLine();
thereAreStats = true;
@@ -94,7 +94,7 @@ namespace DiscImageChef.Commands
{
DicConsole.WriteLine("Benchmark statistics");
DicConsole.WriteLine("====================");
foreach (Core.ChecksumStats chk in Core.Statistics.AllStats.Benchmark.Checksum)
foreach(Core.ChecksumStats chk in Core.Statistics.AllStats.Benchmark.Checksum)
{
DicConsole.WriteLine("Took {0} seconds to calculate {1} algorithm", chk.Value, chk.algorithm);
}
@@ -107,53 +107,53 @@ namespace DiscImageChef.Commands
thereAreStats = true;
}
if (Core.Statistics.AllStats.MediaImages != null && Core.Statistics.AllStats.MediaImages.Count > 0)
if(Core.Statistics.AllStats.MediaImages != null && Core.Statistics.AllStats.MediaImages.Count > 0)
{
DicConsole.WriteLine("Media image statistics");
DicConsole.WriteLine("======================");
foreach (Core.NameValueStats nvs in Core.Statistics.AllStats.MediaImages)
foreach(Core.NameValueStats nvs in Core.Statistics.AllStats.MediaImages)
DicConsole.WriteLine("Format {0} has been found {1} times.", nvs.name, nvs.Value);
DicConsole.WriteLine();
thereAreStats = true;
}
if (Core.Statistics.AllStats.Partitions != null && Core.Statistics.AllStats.Partitions.Count > 0)
if(Core.Statistics.AllStats.Partitions != null && Core.Statistics.AllStats.Partitions.Count > 0)
{
DicConsole.WriteLine("Partition statistics");
DicConsole.WriteLine("====================");
foreach (Core.NameValueStats nvs in Core.Statistics.AllStats.Partitions)
foreach(Core.NameValueStats nvs in Core.Statistics.AllStats.Partitions)
DicConsole.WriteLine("Partitioning scheme {0} has been found {1} times.", nvs.name, nvs.Value);
DicConsole.WriteLine();
thereAreStats = true;
}
if (Core.Statistics.AllStats.Filesystems != null && Core.Statistics.AllStats.Filesystems.Count > 0)
if(Core.Statistics.AllStats.Filesystems != null && Core.Statistics.AllStats.Filesystems.Count > 0)
{
DicConsole.WriteLine("Filesystem statistics");
DicConsole.WriteLine("=====================");
foreach (Core.NameValueStats nvs in Core.Statistics.AllStats.Filesystems)
foreach(Core.NameValueStats nvs in Core.Statistics.AllStats.Filesystems)
DicConsole.WriteLine("Filesystem {0} has been found {1} times.", nvs.name, nvs.Value);
DicConsole.WriteLine();
thereAreStats = true;
}
if (Core.Statistics.AllStats.Devices != null && Core.Statistics.AllStats.Devices.Count > 0)
if(Core.Statistics.AllStats.Devices != null && Core.Statistics.AllStats.Devices.Count > 0)
{
DicConsole.WriteLine("Device statistics");
DicConsole.WriteLine("=================");
foreach (Core.DeviceStats ds in Core.Statistics.AllStats.Devices)
foreach(Core.DeviceStats ds in Core.Statistics.AllStats.Devices)
DicConsole.WriteLine("Device model {0}, manufactured by {1}, with revision {2} and attached via {3}.", ds.Model, ds.Manufacturer, ds.Revision, ds.Bus);
DicConsole.WriteLine();
thereAreStats = true;
}
if (Core.Statistics.AllStats.Medias != null && Core.Statistics.AllStats.Medias.Count > 0)
if(Core.Statistics.AllStats.Medias != null && Core.Statistics.AllStats.Medias.Count > 0)
{
DicConsole.WriteLine("Media statistics");
DicConsole.WriteLine("================");
foreach (Core.MediaStats ms in Core.Statistics.AllStats.Medias)
foreach(Core.MediaStats ms in Core.Statistics.AllStats.Medias)
{
if (ms.real)
if(ms.real)
DicConsole.WriteLine("Media type {0} has been found {1} times in a real device.", ms.type, ms.Value);
else
DicConsole.WriteLine("Media type {0} has been found {1} times in a media image.", ms.type, ms.Value);
@@ -162,7 +162,7 @@ namespace DiscImageChef.Commands
thereAreStats = true;
}
if (Core.Statistics.AllStats.MediaScan != null)
if(Core.Statistics.AllStats.MediaScan != null)
{
DicConsole.WriteLine("Media scan statistics");
DicConsole.WriteLine("=====================");
@@ -178,7 +178,7 @@ namespace DiscImageChef.Commands
thereAreStats = true;
}
if (Core.Statistics.AllStats.Verify != null)
if(Core.Statistics.AllStats.Verify != null)
{
DicConsole.WriteLine("Verification statistics");
DicConsole.WriteLine("=======================");
@@ -191,7 +191,7 @@ namespace DiscImageChef.Commands
thereAreStats = true;
}
if (!thereAreStats)
if(!thereAreStats)
DicConsole.WriteLine("There are no statistics.");
}
}

View File

@@ -52,7 +52,7 @@ namespace DiscImageChef.Commands
DicConsole.DebugWriteLine("Verify command", "--verify-disc={0}", options.VerifyDisc);
DicConsole.DebugWriteLine("Verify command", "--verify-sectors={0}", options.VerifySectors);
if (!System.IO.File.Exists(options.InputFile))
if(!System.IO.File.Exists(options.InputFile))
{
DicConsole.ErrorWriteLine("Specified file does not exist.");
return;
@@ -60,7 +60,7 @@ namespace DiscImageChef.Commands
ImagePlugin inputFormat = ImageFormat.Detect(options.InputFile);
if (inputFormat == null)
if(inputFormat == null)
{
DicConsole.ErrorWriteLine("Unable to recognize image format, not verifying");
return;
@@ -76,7 +76,7 @@ namespace DiscImageChef.Commands
long correctSectors = 0;
long unknownSectors = 0;
if (options.VerifyDisc)
if(options.VerifyDisc)
{
DateTime StartCheck = DateTime.UtcNow;
bool? discCheckStatus = inputFormat.VerifyMediaImage();
@@ -84,7 +84,7 @@ namespace DiscImageChef.Commands
TimeSpan CheckTime = EndCheck - StartCheck;
switch (discCheckStatus)
switch(discCheckStatus)
{
case true:
DicConsole.WriteLine("Disc image checksums are correct");
@@ -101,13 +101,13 @@ namespace DiscImageChef.Commands
DicConsole.VerboseWriteLine("Checking disc image checksums took {0} seconds", CheckTime.TotalSeconds);
}
if (options.VerifySectors)
if(options.VerifySectors)
{
bool formatHasTracks;
try
{
List<Track> inputTracks = inputFormat.GetTracks();
if (inputTracks.Count > 0)
if(inputTracks.Count > 0)
formatHasTracks = true;
else
formatHasTracks = false;
@@ -123,18 +123,18 @@ namespace DiscImageChef.Commands
List<UInt64> UnknownLBAs = new List<UInt64>();
bool? checkStatus = null;
if (formatHasTracks)
if(formatHasTracks)
{
List<Track> inputTracks = inputFormat.GetTracks();
UInt64 currentSectorAll = 0;
StartCheck = DateTime.UtcNow;
foreach (Track currentTrack in inputTracks)
foreach(Track currentTrack in inputTracks)
{
UInt64 remainingSectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector;
UInt64 currentSector = 0;
while (remainingSectors > 0)
while(remainingSectors > 0)
{
DicConsole.Write("\rChecking sector {0} of {1}, on track {2}", currentSectorAll, inputFormat.GetSectors(), currentTrack.TrackSequence);
@@ -142,27 +142,27 @@ namespace DiscImageChef.Commands
List<UInt64> tempUnknownLBAs;
bool? tempStatus;
if (remainingSectors < 512)
if(remainingSectors < 512)
tempStatus = inputFormat.VerifySectors(currentSector, (uint)remainingSectors, currentTrack.TrackSequence, out tempFailingLBAs, out tempUnknownLBAs);
else
tempStatus = inputFormat.VerifySectors(currentSector, 512, currentTrack.TrackSequence, out tempFailingLBAs, out tempUnknownLBAs);
if (checkStatus == null || tempStatus == null)
if(checkStatus == null || tempStatus == null)
checkStatus = null;
else if (checkStatus == false || tempStatus == false)
else if(checkStatus == false || tempStatus == false)
checkStatus = false;
else if (checkStatus == true && tempStatus == true)
else if(checkStatus == true && tempStatus == true)
checkStatus = true;
else
checkStatus = null;
foreach (UInt64 failLBA in tempFailingLBAs)
foreach(UInt64 failLBA in tempFailingLBAs)
FailingLBAs.Add(failLBA);
foreach (UInt64 unknownLBA in tempUnknownLBAs)
foreach(UInt64 unknownLBA in tempUnknownLBAs)
UnknownLBAs.Add(unknownLBA);
if (remainingSectors < 512)
if(remainingSectors < 512)
{
currentSector += remainingSectors;
currentSectorAll += remainingSectors;
@@ -185,7 +185,7 @@ namespace DiscImageChef.Commands
UInt64 currentSector = 0;
StartCheck = DateTime.UtcNow;
while (remainingSectors > 0)
while(remainingSectors > 0)
{
DicConsole.Write("\rChecking sector {0} of {1}", currentSector, inputFormat.GetSectors());
@@ -193,27 +193,27 @@ namespace DiscImageChef.Commands
List<UInt64> tempUnknownLBAs;
bool? tempStatus;
if (remainingSectors < 512)
if(remainingSectors < 512)
tempStatus = inputFormat.VerifySectors(currentSector, (uint)remainingSectors, out tempFailingLBAs, out tempUnknownLBAs);
else
tempStatus = inputFormat.VerifySectors(currentSector, 512, out tempFailingLBAs, out tempUnknownLBAs);
if (checkStatus == null || tempStatus == null)
if(checkStatus == null || tempStatus == null)
checkStatus = null;
else if (checkStatus == false || tempStatus == false)
else if(checkStatus == false || tempStatus == false)
checkStatus = false;
else if (checkStatus == true && tempStatus == true)
else if(checkStatus == true && tempStatus == true)
checkStatus = true;
else
checkStatus = null;
foreach (UInt64 failLBA in tempFailingLBAs)
foreach(UInt64 failLBA in tempFailingLBAs)
FailingLBAs.Add(failLBA);
foreach (UInt64 unknownLBA in tempUnknownLBAs)
foreach(UInt64 unknownLBA in tempUnknownLBAs)
UnknownLBAs.Add(unknownLBA);
if (remainingSectors < 512)
if(remainingSectors < 512)
{
currentSector += remainingSectors;
remainingSectors = 0;
@@ -232,7 +232,7 @@ namespace DiscImageChef.Commands
DicConsole.Write("\r");
switch (checkStatus)
switch(checkStatus)
{
case true:
DicConsole.WriteLine("All sector checksums are correct");
@@ -247,20 +247,20 @@ namespace DiscImageChef.Commands
DicConsole.VerboseWriteLine("Checking sector checksums took {0} seconds", CheckTime.TotalSeconds);
if (options.Verbose)
if(options.Verbose)
{
DicConsole.VerboseWriteLine("LBAs with error:");
if (FailingLBAs.Count == (int)inputFormat.GetSectors())
if(FailingLBAs.Count == (int)inputFormat.GetSectors())
DicConsole.VerboseWriteLine("\tall sectors.");
else
for (int i = 0; i < FailingLBAs.Count; i++)
for(int i = 0; i < FailingLBAs.Count; i++)
DicConsole.VerboseWriteLine("\t{0}", FailingLBAs[i]);
DicConsole.WriteLine("LBAs without checksum:");
if (UnknownLBAs.Count == (int)inputFormat.GetSectors())
if(UnknownLBAs.Count == (int)inputFormat.GetSectors())
DicConsole.VerboseWriteLine("\tall sectors.");
else
for (int i = 0; i < UnknownLBAs.Count; i++)
for(int i = 0; i < UnknownLBAs.Count; i++)
DicConsole.VerboseWriteLine("\t{0}", UnknownLBAs[i]);
}

View File

@@ -84,41 +84,41 @@ namespace DiscImageChef.Core
internal Checksum()
{
adler32ctx = new Adler32Context();
crc16ctx = new CRC16Context();
crc32ctx = new CRC32Context();
crc64ctx = new CRC64Context();
md5ctx = new MD5Context();
ripemd160ctx = new RIPEMD160Context();
sha1ctx = new SHA1Context();
sha256ctx = new SHA256Context();
sha384ctx = new SHA384Context();
sha512ctx = new SHA512Context();
ssctx = new SpamSumContext();
adler32ctx = new Adler32Context();
crc16ctx = new CRC16Context();
crc32ctx = new CRC32Context();
crc64ctx = new CRC64Context();
md5ctx = new MD5Context();
ripemd160ctx = new RIPEMD160Context();
sha1ctx = new SHA1Context();
sha256ctx = new SHA256Context();
sha384ctx = new SHA384Context();
sha512ctx = new SHA512Context();
ssctx = new SpamSumContext();
adlerThread = new Thread(updateAdler);
crc16Thread = new Thread(updateCRC16);
crc32Thread = new Thread(updateCRC32);
crc64Thread = new Thread(updateCRC64);
md5Thread = new Thread(updateMD5);
ripemd160Thread = new Thread(updateRIPEMD160);
sha1Thread = new Thread(updateSHA1);
sha256Thread = new Thread(updateSHA256);
sha384Thread = new Thread(updateSHA384);
sha512Thread = new Thread(updateSHA512);
spamsumThread = new Thread(updateSpamSum);
adlerThread = new Thread(updateAdler);
crc16Thread = new Thread(updateCRC16);
crc32Thread = new Thread(updateCRC32);
crc64Thread = new Thread(updateCRC64);
md5Thread = new Thread(updateMD5);
ripemd160Thread = new Thread(updateRIPEMD160);
sha1Thread = new Thread(updateSHA1);
sha256Thread = new Thread(updateSHA256);
sha384Thread = new Thread(updateSHA384);
sha512Thread = new Thread(updateSHA512);
spamsumThread = new Thread(updateSpamSum);
adlerPkt = new adlerPacket();
crc16Pkt = new crc16Packet();
crc32Pkt = new crc32Packet();
crc64Pkt = new crc64Packet();
md5Pkt = new md5Packet();
ripemd160Pkt = new ripemd160Packet();
sha1Pkt = new sha1Packet();
sha256Pkt = new sha256Packet();
sha384Pkt = new sha384Packet();
sha512Pkt = new sha512Packet();
spamsumPkt = new spamsumPacket();
adlerPkt = new adlerPacket();
crc16Pkt = new crc16Packet();
crc32Pkt = new crc32Packet();
crc64Pkt = new crc64Packet();
md5Pkt = new md5Packet();
ripemd160Pkt = new ripemd160Packet();
sha1Pkt = new sha1Packet();
sha256Pkt = new sha256Packet();
sha384Pkt = new sha384Packet();
sha512Pkt = new sha512Packet();
spamsumPkt = new spamsumPacket();
adler32ctx.Init();
adlerPkt.context = adler32ctx;
@@ -146,49 +146,49 @@ namespace DiscImageChef.Core
internal void Update(byte[] data)
{
adlerPkt.data = data;
adlerThread.Start(adlerPkt);
crc16Pkt.data = data;
crc16Thread.Start(crc16Pkt);
crc32Pkt.data = data;
crc32Thread.Start(crc32Pkt);
crc64Pkt.data = data;
crc64Thread.Start(crc64Pkt);
md5Pkt.data = data;
md5Thread.Start(md5Pkt);
ripemd160Pkt.data = data;
ripemd160Thread.Start(ripemd160Pkt);
sha1Pkt.data = data;
sha1Thread.Start(sha1Pkt);
sha256Pkt.data = data;
sha256Thread.Start(sha256Pkt);
sha384Pkt.data = data;
sha384Thread.Start(sha384Pkt);
sha512Pkt.data = data;
sha512Thread.Start(sha512Pkt);
spamsumPkt.data = data;
spamsumThread.Start(spamsumPkt);
adlerPkt.data = data;
adlerThread.Start(adlerPkt);
crc16Pkt.data = data;
crc16Thread.Start(crc16Pkt);
crc32Pkt.data = data;
crc32Thread.Start(crc32Pkt);
crc64Pkt.data = data;
crc64Thread.Start(crc64Pkt);
md5Pkt.data = data;
md5Thread.Start(md5Pkt);
ripemd160Pkt.data = data;
ripemd160Thread.Start(ripemd160Pkt);
sha1Pkt.data = data;
sha1Thread.Start(sha1Pkt);
sha256Pkt.data = data;
sha256Thread.Start(sha256Pkt);
sha384Pkt.data = data;
sha384Thread.Start(sha384Pkt);
sha512Pkt.data = data;
sha512Thread.Start(sha512Pkt);
spamsumPkt.data = data;
spamsumThread.Start(spamsumPkt);
while (adlerThread.IsAlive || crc16Thread.IsAlive ||
crc32Thread.IsAlive || crc64Thread.IsAlive ||
md5Thread.IsAlive || ripemd160Thread.IsAlive ||
sha1Thread.IsAlive || sha256Thread.IsAlive ||
sha384Thread.IsAlive || sha512Thread.IsAlive ||
spamsumThread.IsAlive)
{
}
while(adlerThread.IsAlive || crc16Thread.IsAlive ||
crc32Thread.IsAlive || crc64Thread.IsAlive ||
md5Thread.IsAlive || ripemd160Thread.IsAlive ||
sha1Thread.IsAlive || sha256Thread.IsAlive ||
sha384Thread.IsAlive || sha512Thread.IsAlive ||
spamsumThread.IsAlive)
{
}
adlerThread = new Thread(updateAdler);
crc16Thread = new Thread(updateCRC16);
crc32Thread = new Thread(updateCRC32);
crc64Thread = new Thread(updateCRC64);
md5Thread = new Thread(updateMD5);
ripemd160Thread = new Thread(updateRIPEMD160);
sha1Thread = new Thread(updateSHA1);
sha256Thread = new Thread(updateSHA256);
sha384Thread = new Thread(updateSHA384);
sha512Thread = new Thread(updateSHA512);
spamsumThread = new Thread(updateSpamSum);
adlerThread = new Thread(updateAdler);
crc16Thread = new Thread(updateCRC16);
crc32Thread = new Thread(updateCRC32);
crc64Thread = new Thread(updateCRC64);
md5Thread = new Thread(updateMD5);
ripemd160Thread = new Thread(updateRIPEMD160);
sha1Thread = new Thread(updateSHA1);
sha256Thread = new Thread(updateSHA256);
sha384Thread = new Thread(updateSHA384);
sha512Thread = new Thread(updateSHA512);
spamsumThread = new Thread(updateSpamSum);
}
internal List<ChecksumType> End()
@@ -337,7 +337,7 @@ namespace DiscImageChef.Core
spamsumPktData.data = data;
spamsumThreadData.Start(spamsumPktData);
while (adlerThreadData.IsAlive || crc16ThreadData.IsAlive ||
while(adlerThreadData.IsAlive || crc16ThreadData.IsAlive ||
crc32ThreadData.IsAlive || crc64ThreadData.IsAlive ||
md5ThreadData.IsAlive || ripemd160ThreadData.IsAlive ||
sha1ThreadData.IsAlive || sha256ThreadData.IsAlive ||

View File

@@ -61,7 +61,7 @@ namespace DiscImageChef.Core
public IBGLog(string outputFile, ushort currentProfile)
{
if (!string.IsNullOrEmpty(outputFile))
if(!string.IsNullOrEmpty(outputFile))
{
ibgFs = new FileStream(outputFile, FileMode.Create);
ibgSb = new StringBuilder();
@@ -73,149 +73,149 @@ namespace DiscImageChef.Core
ibgSnaps = 0;
ibgIntSector = 0;
switch (currentProfile)
switch(currentProfile)
{
case 0x0001:
ibgMediaType = "HDD";
ibgDivider = 1353;
break;
case 0x0005:
ibgMediaType = "CD-MO";
ibgDivider = 150;
break;
case 0x0008:
ibgMediaType = "CD-ROM";
ibgDivider = 150;
break;
case 0x0009:
ibgMediaType = "CD-R";
ibgDivider = 150;
break;
case 0x000A:
ibgMediaType = "CD-RW";
ibgDivider = 150;
break;
case 0x0010:
ibgMediaType = "DVD-ROM";
ibgDivider = 1353;
break;
case 0x0011:
ibgMediaType = "DVD-R";
ibgDivider = 1353;
break;
case 0x0012:
ibgMediaType = "DVD-RAM";
ibgDivider = 1353;
break;
case 0x0013:
case 0x0014:
ibgMediaType = "DVD-RW";
ibgDivider = 1353;
break;
case 0x0015:
case 0x0016:
ibgMediaType = "DVD-R DL";
ibgDivider = 1353;
break;
case 0x0017:
ibgMediaType = "DVD-RW DL";
ibgDivider = 1353;
break;
case 0x0018:
ibgMediaType = "DVD-Download";
ibgDivider = 1353;
break;
case 0x001A:
ibgMediaType = "DVD+RW";
ibgDivider = 1353;
break;
case 0x001B:
ibgMediaType = "DVD+R";
ibgDivider = 1353;
break;
case 0x0020:
ibgMediaType = "DDCD-ROM";
ibgDivider = 150;
break;
case 0x0021:
ibgMediaType = "DDCD-R";
ibgDivider = 150;
break;
case 0x0022:
ibgMediaType = "DDCD-RW";
ibgDivider = 150;
break;
case 0x002A:
ibgMediaType = "DVD+RW DL";
ibgDivider = 1353;
break;
case 0x002B:
ibgMediaType = "DVD+R DL";
ibgDivider = 1353;
break;
case 0x0040:
ibgMediaType = "BD-ROM";
ibgDivider = 4500;
break;
case 0x0041:
case 0x0042:
ibgMediaType = "BD-R";
ibgDivider = 4500;
break;
case 0x0043:
ibgMediaType = "BD-RE";
ibgDivider = 4500;
break;
case 0x0050:
ibgMediaType = "HD DVD-ROM";
ibgDivider = 4500;
break;
case 0x0051:
ibgMediaType = "HD DVD-R";
ibgDivider = 4500;
break;
case 0x0052:
ibgMediaType = "HD DVD-RAM";
ibgDivider = 4500;
break;
case 0x0053:
ibgMediaType = "HD DVD-RW";
ibgDivider = 4500;
break;
case 0x0058:
ibgMediaType = "HD DVD-R DL";
ibgDivider = 4500;
break;
case 0x005A:
ibgMediaType = "HD DVD-RW DL";
ibgDivider = 4500;
break;
default:
ibgMediaType = "Unknown";
ibgDivider = 1353;
break;
case 0x0001:
ibgMediaType = "HDD";
ibgDivider = 1353;
break;
case 0x0005:
ibgMediaType = "CD-MO";
ibgDivider = 150;
break;
case 0x0008:
ibgMediaType = "CD-ROM";
ibgDivider = 150;
break;
case 0x0009:
ibgMediaType = "CD-R";
ibgDivider = 150;
break;
case 0x000A:
ibgMediaType = "CD-RW";
ibgDivider = 150;
break;
case 0x0010:
ibgMediaType = "DVD-ROM";
ibgDivider = 1353;
break;
case 0x0011:
ibgMediaType = "DVD-R";
ibgDivider = 1353;
break;
case 0x0012:
ibgMediaType = "DVD-RAM";
ibgDivider = 1353;
break;
case 0x0013:
case 0x0014:
ibgMediaType = "DVD-RW";
ibgDivider = 1353;
break;
case 0x0015:
case 0x0016:
ibgMediaType = "DVD-R DL";
ibgDivider = 1353;
break;
case 0x0017:
ibgMediaType = "DVD-RW DL";
ibgDivider = 1353;
break;
case 0x0018:
ibgMediaType = "DVD-Download";
ibgDivider = 1353;
break;
case 0x001A:
ibgMediaType = "DVD+RW";
ibgDivider = 1353;
break;
case 0x001B:
ibgMediaType = "DVD+R";
ibgDivider = 1353;
break;
case 0x0020:
ibgMediaType = "DDCD-ROM";
ibgDivider = 150;
break;
case 0x0021:
ibgMediaType = "DDCD-R";
ibgDivider = 150;
break;
case 0x0022:
ibgMediaType = "DDCD-RW";
ibgDivider = 150;
break;
case 0x002A:
ibgMediaType = "DVD+RW DL";
ibgDivider = 1353;
break;
case 0x002B:
ibgMediaType = "DVD+R DL";
ibgDivider = 1353;
break;
case 0x0040:
ibgMediaType = "BD-ROM";
ibgDivider = 4500;
break;
case 0x0041:
case 0x0042:
ibgMediaType = "BD-R";
ibgDivider = 4500;
break;
case 0x0043:
ibgMediaType = "BD-RE";
ibgDivider = 4500;
break;
case 0x0050:
ibgMediaType = "HD DVD-ROM";
ibgDivider = 4500;
break;
case 0x0051:
ibgMediaType = "HD DVD-R";
ibgDivider = 4500;
break;
case 0x0052:
ibgMediaType = "HD DVD-RAM";
ibgDivider = 4500;
break;
case 0x0053:
ibgMediaType = "HD DVD-RW";
ibgDivider = 4500;
break;
case 0x0058:
ibgMediaType = "HD DVD-R DL";
ibgDivider = 4500;
break;
case 0x005A:
ibgMediaType = "HD DVD-RW DL";
ibgDivider = 4500;
break;
default:
ibgMediaType = "Unknown";
ibgDivider = 1353;
break;
}
}
}
public void Write(ulong sector, double currentSpeed)
{
if (ibgFs != null)
if(ibgFs != null)
{
ibgIntSpeed += currentSpeed;
ibgSampleRate += (int)Math.Floor((DateTime.Now - ibgDatePoint).TotalMilliseconds);
ibgSnaps++;
if (ibgSampleRate >= 100)
if(ibgSampleRate >= 100)
{
if (ibgIntSpeed > 0 && !ibgStartSet)
if(ibgIntSpeed > 0 && !ibgStartSet)
{
ibgStartSpeed = ibgIntSpeed / ibgSnaps / ibgDivider;
ibgStartSet = true;
}
ibgSb.AppendFormat("{0:0.00},{1},{2:0},0", ibgIntSpeed / ibgSnaps / ibgDivider, ibgIntSector, ibgSampleRate).AppendLine();
if ((ibgIntSpeed / ibgSnaps / ibgDivider) > ibgMaxSpeed)
if((ibgIntSpeed / ibgSnaps / ibgDivider) > ibgMaxSpeed)
ibgMaxSpeed = ibgIntSpeed / ibgDivider;
ibgDatePoint = DateTime.Now;
@@ -229,14 +229,14 @@ namespace DiscImageChef.Core
public void Close(Device dev, ulong blocks, ulong blockSize, double totalSeconds, double currentSpeed, double averageSpeed, string devicePath)
{
if (ibgFs != null)
if(ibgFs != null)
{
StringBuilder ibgHeader = new StringBuilder();
string ibgBusType;
if (dev.IsUSB)
if(dev.IsUSB)
ibgBusType = "USB";
else if (dev.IsFireWire)
else if(dev.IsFireWire)
ibgBusType = "FireWire";
else
ibgBusType = dev.Type.ToString();

View File

@@ -48,7 +48,7 @@ namespace DiscImageChef.Core
public MHDDLog(string outputFile, Device dev, ulong blocks, ulong blockSize, ulong blocksToRead)
{
if (dev != null && !string.IsNullOrEmpty(outputFile))
if(dev != null && !string.IsNullOrEmpty(outputFile))
{
mhddFs = new FileStream(outputFile, FileMode.Create);
@@ -61,27 +61,27 @@ namespace DiscImageChef.Core
string scanblocksize;
string ver;
switch (dev.Type)
switch(dev.Type)
{
case DeviceType.ATA:
case DeviceType.ATAPI:
mode = "MODE: IDE";
break;
case DeviceType.SCSI:
mode = "MODE: SCSI";
break;
case DeviceType.MMC:
mode = "MODE: MMC";
break;
case DeviceType.NVMe:
mode = "MODE: NVMe";
break;
case DeviceType.SecureDigital:
mode = "MODE: SD";
break;
default:
mode = "MODE: IDE";
break;
case DeviceType.ATA:
case DeviceType.ATAPI:
mode = "MODE: IDE";
break;
case DeviceType.SCSI:
mode = "MODE: SCSI";
break;
case DeviceType.MMC:
mode = "MODE: MMC";
break;
case DeviceType.NVMe:
mode = "MODE: NVMe";
break;
case DeviceType.SecureDigital:
mode = "MODE: SD";
break;
default:
mode = "MODE: IDE";
break;
}
device = string.Format("DEVICE: {0} {1}", dev.Manufacturer, dev.Model);
@@ -134,7 +134,7 @@ namespace DiscImageChef.Core
public void Write(ulong sector, double duration)
{
if (mhddFs != null)
if(mhddFs != null)
{
byte[] sectorBytes = BitConverter.GetBytes(sector);
byte[] durationBytes = BitConverter.GetBytes((ulong)(duration * 1000));
@@ -146,7 +146,7 @@ namespace DiscImageChef.Core
public void Close()
{
if (mhddFs != null)
if(mhddFs != null)
mhddFs.Close();
}
}

View File

@@ -171,7 +171,7 @@ namespace DiscImageChef.Core
public static void LoadStats()
{
if (File.Exists(Path.Combine(Settings.Settings.StatsPath, "Statistics.xml")))
if(File.Exists(Path.Combine(Settings.Settings.StatsPath, "Statistics.xml")))
{
AllStats = new Stats();
CurrentStats = new Stats();
@@ -181,7 +181,7 @@ namespace DiscImageChef.Core
AllStats = (Stats)xs.Deserialize(sr);
sr.Close();
}
else if (Settings.Settings.Current.Stats != null)
else if(Settings.Settings.Current.Stats != null)
{
AllStats = new Stats();
CurrentStats = new Stats();
@@ -195,14 +195,14 @@ namespace DiscImageChef.Core
public static void SaveStats()
{
if (AllStats != null)
if(AllStats != null)
{
FileStream fs = new FileStream(Path.Combine(Settings.Settings.StatsPath, "Statistics.xml"), FileMode.Create);
XmlSerializer xs = new XmlSerializer(AllStats.GetType());
xs.Serialize(fs, AllStats);
fs.Close();
if (CurrentStats != null)
if(CurrentStats != null)
{
string partial = string.Format("PartialStats_{0:yyyyMMddHHmmssfff}.xml", DateTime.UtcNow);
@@ -212,7 +212,7 @@ namespace DiscImageChef.Core
fs.Close();
}
if (Settings.Settings.Current.Stats.ShareStats)
if(Settings.Settings.Current.Stats.ShareStats)
SubmitStats();
}
}
@@ -224,93 +224,93 @@ namespace DiscImageChef.Core
public static void AddCommand(string command)
{
if (Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.DeviceStats)
if(Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.DeviceStats)
{
if (AllStats.Commands == null)
if(AllStats.Commands == null)
AllStats.Commands = new CommandsStats();
if (CurrentStats.Commands == null)
if(CurrentStats.Commands == null)
CurrentStats.Commands = new CommandsStats();
switch (command)
switch(command)
{
case "analyze":
AllStats.Commands.Analyze++;
CurrentStats.Commands.Analyze++;
break;
case "benchmark":
AllStats.Commands.Benchmark++;
CurrentStats.Commands.Benchmark++;
break;
case "checksum":
AllStats.Commands.Checksum++;
CurrentStats.Commands.Checksum++;
break;
case "compare":
AllStats.Commands.Compare++;
CurrentStats.Commands.Compare++;
break;
case "create-sidecar":
AllStats.Commands.CreateSidecar++;
CurrentStats.Commands.CreateSidecar++;
break;
case "decode":
AllStats.Commands.Decode++;
CurrentStats.Commands.Decode++;
break;
case "device-info":
AllStats.Commands.DeviceInfo++;
CurrentStats.Commands.DeviceInfo++;
break;
case "device-report":
AllStats.Commands.DeviceReport++;
CurrentStats.Commands.DeviceReport++;
break;
case "dump-media":
AllStats.Commands.DumpMedia++;
CurrentStats.Commands.DumpMedia++;
break;
case "entropy":
AllStats.Commands.Entropy++;
CurrentStats.Commands.Entropy++;
break;
case "formats":
AllStats.Commands.Formats++;
CurrentStats.Commands.Formats++;
break;
case "media-info":
AllStats.Commands.MediaInfo++;
CurrentStats.Commands.MediaInfo++;
break;
case "media-scan":
AllStats.Commands.MediaScan++;
CurrentStats.Commands.MediaScan++;
break;
case "print-hex":
AllStats.Commands.PrintHex++;
CurrentStats.Commands.PrintHex++;
break;
case "verify":
AllStats.Commands.Verify++;
CurrentStats.Commands.Verify++;
break;
case "analyze":
AllStats.Commands.Analyze++;
CurrentStats.Commands.Analyze++;
break;
case "benchmark":
AllStats.Commands.Benchmark++;
CurrentStats.Commands.Benchmark++;
break;
case "checksum":
AllStats.Commands.Checksum++;
CurrentStats.Commands.Checksum++;
break;
case "compare":
AllStats.Commands.Compare++;
CurrentStats.Commands.Compare++;
break;
case "create-sidecar":
AllStats.Commands.CreateSidecar++;
CurrentStats.Commands.CreateSidecar++;
break;
case "decode":
AllStats.Commands.Decode++;
CurrentStats.Commands.Decode++;
break;
case "device-info":
AllStats.Commands.DeviceInfo++;
CurrentStats.Commands.DeviceInfo++;
break;
case "device-report":
AllStats.Commands.DeviceReport++;
CurrentStats.Commands.DeviceReport++;
break;
case "dump-media":
AllStats.Commands.DumpMedia++;
CurrentStats.Commands.DumpMedia++;
break;
case "entropy":
AllStats.Commands.Entropy++;
CurrentStats.Commands.Entropy++;
break;
case "formats":
AllStats.Commands.Formats++;
CurrentStats.Commands.Formats++;
break;
case "media-info":
AllStats.Commands.MediaInfo++;
CurrentStats.Commands.MediaInfo++;
break;
case "media-scan":
AllStats.Commands.MediaScan++;
CurrentStats.Commands.MediaScan++;
break;
case "print-hex":
AllStats.Commands.PrintHex++;
CurrentStats.Commands.PrintHex++;
break;
case "verify":
AllStats.Commands.Verify++;
CurrentStats.Commands.Verify++;
break;
}
}
}
public static void AddFilesystem(string filesystem)
{
if (Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.FilesystemStats)
if(Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.FilesystemStats)
{
if (AllStats.Filesystems == null)
if(AllStats.Filesystems == null)
AllStats.Filesystems = new List<NameValueStats>();
if (CurrentStats.Filesystems == null)
if(CurrentStats.Filesystems == null)
CurrentStats.Filesystems = new List<NameValueStats>();
NameValueStats old = null;
foreach (NameValueStats nvs in AllStats.Filesystems)
foreach(NameValueStats nvs in AllStats.Filesystems)
{
if (nvs.name == filesystem)
if(nvs.name == filesystem)
{
old = nvs;
break;
@@ -318,7 +318,7 @@ namespace DiscImageChef.Core
}
NameValueStats nw = new NameValueStats();
if (old != null)
if(old != null)
{
nw.name = old.name;
nw.Value = old.Value + 1;
@@ -332,9 +332,9 @@ namespace DiscImageChef.Core
AllStats.Filesystems.Add(nw);
old = null;
foreach (NameValueStats nvs in CurrentStats.Filesystems)
foreach(NameValueStats nvs in CurrentStats.Filesystems)
{
if (nvs.name == filesystem)
if(nvs.name == filesystem)
{
old = nvs;
break;
@@ -342,7 +342,7 @@ namespace DiscImageChef.Core
}
nw = new NameValueStats();
if (old != null)
if(old != null)
{
nw.name = old.name;
nw.Value = old.Value + 1;
@@ -359,17 +359,17 @@ namespace DiscImageChef.Core
public static void AddPartition(string partition)
{
if (Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.PartitionStats)
if(Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.PartitionStats)
{
if (AllStats.Partitions == null)
if(AllStats.Partitions == null)
AllStats.Partitions = new List<NameValueStats>();
if (CurrentStats.Partitions == null)
if(CurrentStats.Partitions == null)
CurrentStats.Partitions = new List<NameValueStats>();
NameValueStats old = null;
foreach (NameValueStats nvs in AllStats.Partitions)
foreach(NameValueStats nvs in AllStats.Partitions)
{
if (nvs.name == partition)
if(nvs.name == partition)
{
old = nvs;
break;
@@ -377,7 +377,7 @@ namespace DiscImageChef.Core
}
NameValueStats nw = new NameValueStats();
if (old != null)
if(old != null)
{
nw.name = old.name;
nw.Value = old.Value + 1;
@@ -391,9 +391,9 @@ namespace DiscImageChef.Core
AllStats.Partitions.Add(nw);
old = null;
foreach (NameValueStats nvs in CurrentStats.Partitions)
foreach(NameValueStats nvs in CurrentStats.Partitions)
{
if (nvs.name == partition)
if(nvs.name == partition)
{
old = nvs;
break;
@@ -401,7 +401,7 @@ namespace DiscImageChef.Core
}
nw = new NameValueStats();
if (old != null)
if(old != null)
{
nw.name = old.name;
nw.Value = old.Value + 1;
@@ -418,17 +418,17 @@ namespace DiscImageChef.Core
public static void AddMediaFormat(string format)
{
if (Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.MediaImageStats)
if(Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.MediaImageStats)
{
if (AllStats.MediaImages == null)
if(AllStats.MediaImages == null)
AllStats.MediaImages = new List<NameValueStats>();
if (CurrentStats.MediaImages == null)
if(CurrentStats.MediaImages == null)
CurrentStats.MediaImages = new List<NameValueStats>();
NameValueStats old = null;
foreach (NameValueStats nvs in AllStats.MediaImages)
foreach(NameValueStats nvs in AllStats.MediaImages)
{
if (nvs.name == format)
if(nvs.name == format)
{
old = nvs;
break;
@@ -436,7 +436,7 @@ namespace DiscImageChef.Core
}
NameValueStats nw = new NameValueStats();
if (old != null)
if(old != null)
{
nw.name = old.name;
nw.Value = old.Value + 1;
@@ -450,9 +450,9 @@ namespace DiscImageChef.Core
AllStats.MediaImages.Add(nw);
old = null;
foreach (NameValueStats nvs in CurrentStats.MediaImages)
foreach(NameValueStats nvs in CurrentStats.MediaImages)
{
if (nvs.name == format)
if(nvs.name == format)
{
old = nvs;
break;
@@ -460,7 +460,7 @@ namespace DiscImageChef.Core
}
nw = new NameValueStats();
if (old != null)
if(old != null)
{
nw.name = old.name;
nw.Value = old.Value + 1;
@@ -477,25 +477,25 @@ namespace DiscImageChef.Core
public static void AddDevice(Devices.Device dev)
{
if (Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.DeviceStats)
if(Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.DeviceStats)
{
if (AllStats.Devices == null)
if(AllStats.Devices == null)
AllStats.Devices = new List<DeviceStats>();
if (CurrentStats.Devices == null)
if(CurrentStats.Devices == null)
CurrentStats.Devices = new List<DeviceStats>();
string deviceBus;
if (dev.IsUSB)
if(dev.IsUSB)
deviceBus = "USB";
else if (dev.IsFireWire)
else if(dev.IsFireWire)
deviceBus = "FireWire";
else
deviceBus = dev.Type.ToString();
DeviceStats old = null;
foreach (DeviceStats ds in AllStats.Devices)
foreach(DeviceStats ds in AllStats.Devices)
{
if (ds.Manufacturer == dev.Manufacturer &&
if(ds.Manufacturer == dev.Manufacturer &&
ds.Model == dev.Model &&
ds.Revision == dev.Revision &&
ds.Bus == deviceBus)
@@ -505,7 +505,7 @@ namespace DiscImageChef.Core
}
}
if (old != null)
if(old != null)
AllStats.Devices.Remove(old);
DeviceStats nw = new DeviceStats();
@@ -517,9 +517,9 @@ namespace DiscImageChef.Core
AllStats.Devices.Add(nw);
old = null;
foreach (DeviceStats ds in CurrentStats.Devices)
foreach(DeviceStats ds in CurrentStats.Devices)
{
if (ds.Manufacturer == dev.Manufacturer &&
if(ds.Manufacturer == dev.Manufacturer &&
ds.Model == dev.Model &&
ds.Revision == dev.Revision &&
ds.Bus == deviceBus)
@@ -529,7 +529,7 @@ namespace DiscImageChef.Core
}
}
if (old != null)
if(old != null)
CurrentStats.Devices.Remove(old);
nw = new DeviceStats();
@@ -544,17 +544,17 @@ namespace DiscImageChef.Core
public static void AddMedia(CommonTypes.MediaType type, bool real)
{
if (Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.MediaStats)
if(Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.MediaStats)
{
if (AllStats.Medias == null)
if(AllStats.Medias == null)
AllStats.Medias = new List<MediaStats>();
if (CurrentStats.Medias == null)
if(CurrentStats.Medias == null)
CurrentStats.Medias = new List<MediaStats>();
MediaStats old = null;
foreach (MediaStats ms in AllStats.Medias)
foreach(MediaStats ms in AllStats.Medias)
{
if (ms.real == real && ms.type == type.ToString())
if(ms.real == real && ms.type == type.ToString())
{
old = ms;
break;
@@ -562,7 +562,7 @@ namespace DiscImageChef.Core
}
MediaStats nw = new MediaStats();
if (old != null)
if(old != null)
{
nw.type = old.type;
nw.real = old.real;
@@ -578,9 +578,9 @@ namespace DiscImageChef.Core
AllStats.Medias.Add(nw);
old = null;
foreach (MediaStats ms in CurrentStats.Medias)
foreach(MediaStats ms in CurrentStats.Medias)
{
if (ms.real == real && ms.type == type.ToString())
if(ms.real == real && ms.type == type.ToString())
{
old = ms;
break;
@@ -588,7 +588,7 @@ namespace DiscImageChef.Core
}
nw = new MediaStats();
if (old != null)
if(old != null)
{
nw.type = old.type;
nw.real = old.real;
@@ -607,14 +607,14 @@ namespace DiscImageChef.Core
public static void AddBenchmark(Dictionary<string, double> checksums, double entropy, double all, double sequential, long maxMemory, long minMemory)
{
if (Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.BenchmarkStats)
if(Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.BenchmarkStats)
{
CurrentStats.Benchmark = new BenchmarkStats();
CurrentStats.Benchmark.Checksum = new List<ChecksumStats>();
AllStats.Benchmark = new BenchmarkStats();
AllStats.Benchmark.Checksum = new List<ChecksumStats>();
foreach (KeyValuePair<string, double> kvp in checksums)
foreach(KeyValuePair<string, double> kvp in checksums)
{
ChecksumStats st = new ChecksumStats();
st.algorithm = kvp.Key;
@@ -639,25 +639,25 @@ namespace DiscImageChef.Core
public static void AddVerify(bool? mediaVerified, long correct, long failed, long unknown, long total)
{
if (Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.VerifyStats)
if(Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.VerifyStats)
{
if (CurrentStats.Verify == null)
if(CurrentStats.Verify == null)
{
CurrentStats.Verify = new VerifyStats();
CurrentStats.Verify.MediaImages = new VerifiedItems();
CurrentStats.Verify.Sectors = new ScannedSectors();
}
if (AllStats.Verify == null)
if(AllStats.Verify == null)
{
AllStats.Verify = new VerifyStats();
AllStats.Verify.MediaImages = new VerifiedItems();
AllStats.Verify.Sectors = new ScannedSectors();
}
if (mediaVerified.HasValue)
if(mediaVerified.HasValue)
{
if (mediaVerified.Value)
if(mediaVerified.Value)
{
CurrentStats.Verify.MediaImages.Correct++;
AllStats.Verify.MediaImages.Correct++;
@@ -683,16 +683,16 @@ namespace DiscImageChef.Core
public static void AddMediaScan(long lessThan3ms, long lessThan10ms, long lessThan50ms, long lessThan150ms, long lessThan500ms, long moreThan500ms, long total, long error, long correct)
{
if (Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.MediaScanStats)
if(Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.MediaScanStats)
{
if (CurrentStats.MediaScan == null)
if(CurrentStats.MediaScan == null)
{
CurrentStats.MediaScan = new MediaScanStats();
CurrentStats.MediaScan.Sectors = new ScannedSectors();
CurrentStats.MediaScan.Times = new TimeStats();
}
if (AllStats.MediaScan == null)
if(AllStats.MediaScan == null)
{
AllStats.MediaScan = new MediaScanStats();
AllStats.MediaScan.Sectors = new ScannedSectors();