Moved version from Core to Interop.

This commit is contained in:
2017-12-29 01:26:58 +00:00
parent b066a4ade7
commit cfee0226dd
8 changed files with 322 additions and 275 deletions

View File

@@ -162,7 +162,6 @@
<e p="Sidecar.cs" t="Include" />
</e>
<e p="Statistics.cs" t="Include" />
<e p="Version.cs" t="Include" />
<e p="bin" t="ExcludeRecursive" />
<e p="obj" t="ExcludeRecursive" />
<e p="packages.config" t="Include" />
@@ -665,6 +664,7 @@
<e p="Properties" t="Include">
<e p="AssemblyInfo.cs" t="Include" />
</e>
<e p="Version.cs" t="Include" />
<e p="bin" t="ExcludeRecursive" />
<e p="obj" t="ExcludeRecursive" />
</e>

View File

@@ -36,6 +36,7 @@ using DiscImageChef.Metadata;
using Extents;
using Schemas;
using PlatformID = DiscImageChef.Interop.PlatformID;
using Version = DiscImageChef.Interop.Version;
namespace DiscImageChef.Core.Devices.Dumping
{
@@ -62,9 +63,11 @@ namespace DiscImageChef.Core.Devices.Dumping
/// If the provided resume does not correspond with the current in
/// progress dump
/// </exception>
internal static void Process(bool isLba, bool removable, ulong blocks, string manufacturer, string model,
string serial, PlatformID platform, ref Resume resume,
ref DumpHardwareType currentTry, ref ExtentsULong extents)
internal static void Process(bool isLba, bool removable, ulong blocks,
string manufacturer, string model,
string serial, PlatformID platform, ref Resume resume,
ref DumpHardwareType currentTry,
ref ExtentsULong extents)
{
if(resume != null)
{
@@ -98,15 +101,15 @@ namespace DiscImageChef.Core.Devices.Dumping
if(oldtry.Software == null)
throw new InvalidOperationException("Found corrupt resume file, cannot continue...");
if(oldtry.Software.Name != "DiscImageChef" ||
if(oldtry.Software.Name != "DiscImageChef" ||
oldtry.Software.OperatingSystem != platform.ToString() ||
oldtry.Software.Version != Version.GetVersion()) continue;
oldtry.Software.Version != Version.GetVersion()) continue;
if(removable && (oldtry.Manufacturer != manufacturer || oldtry.Model != model ||
oldtry.Serial != serial)) continue;
oldtry.Serial != serial)) continue;
currentTry = oldtry;
extents = ExtentsConverter.FromMetadata(currentTry.Extents);
extents = ExtentsConverter.FromMetadata(currentTry.Extents);
break;
}
@@ -114,10 +117,10 @@ namespace DiscImageChef.Core.Devices.Dumping
currentTry = new DumpHardwareType
{
Software = Version.GetSoftwareType(platform),
Software = Version.GetSoftwareType(platform),
Manufacturer = manufacturer,
Model = model,
Serial = serial
Model = model,
Serial = serial
};
resume.Tries.Add(currentTry);
extents = new ExtentsULong();
@@ -126,20 +129,20 @@ namespace DiscImageChef.Core.Devices.Dumping
{
resume = new Resume
{
Tries = new List<DumpHardwareType>(),
Tries = new List<DumpHardwareType>(),
CreationDate = DateTime.UtcNow,
BadBlocks = new List<ulong>(),
LastBlock = blocks - 1
BadBlocks = new List<ulong>(),
LastBlock = blocks - 1
};
currentTry = new DumpHardwareType
{
Software = Version.GetSoftwareType(platform),
Software = Version.GetSoftwareType(platform),
Manufacturer = manufacturer,
Model = model,
Serial = serial
Model = model,
Serial = serial
};
resume.Tries.Add(currentTry);
extents = new ExtentsULong();
extents = new ExtentsULong();
resume.Removable = removable;
}
}

View File

@@ -43,6 +43,7 @@ using DiscImageChef.Devices;
using DiscImageChef.Metadata;
using Schemas;
using MediaType = DiscImageChef.CommonTypes.MediaType;
using Version = DiscImageChef.Interop.Version;
namespace DiscImageChef.Core.Devices.Dumping
{
@@ -58,21 +59,22 @@ namespace DiscImageChef.Core.Devices.Dumping
/// <param name="dumpLog">Dump logger</param>
/// <param name="sidecar">Partially filled initialized sidecar</param>
internal static void Dump(Device dev, string outputPrefix, string devicePath, ref CICMMetadataType sidecar,
ref Resume resume, ref DumpLog dumpLog)
ref Resume resume,
ref DumpLog dumpLog)
{
FixedSense? fxSense;
bool aborted;
bool sense;
ulong blocks = 0;
uint blockSize;
MediaType dskType = MediaType.Unknown;
DateTime start;
DateTime end;
double totalDuration = 0;
double totalChkDuration = 0;
double currentSpeed = 0;
double maxSpeed = double.MinValue;
double minSpeed = double.MaxValue;
bool aborted;
bool sense;
ulong blocks = 0;
uint blockSize;
MediaType dskType = MediaType.Unknown;
DateTime start;
DateTime end;
double totalDuration = 0;
double totalChkDuration = 0;
double currentSpeed = 0;
double maxSpeed = double.MinValue;
double minSpeed = double.MaxValue;
dev.RequestSense(out byte[] senseBuf, dev.Timeout, out double duration);
fxSense = Sense.DecodeFixed(senseBuf, out string strSense);
@@ -87,8 +89,8 @@ namespace DiscImageChef.Core.Devices.Dumping
}
// Not in BOM/P
if(fxSense.HasValue && fxSense.Value.ASC == 0x00 && fxSense.Value.ASCQ != 0x00 &&
fxSense.Value.ASCQ != 0x04 && fxSense.Value.SenseKey != SenseKeys.IllegalRequest)
if(fxSense.HasValue && fxSense.Value.ASC == 0x00 && fxSense.Value.ASCQ != 0x00 &&
fxSense.Value.ASCQ != 0x04 && fxSense.Value.SenseKey != SenseKeys.IllegalRequest)
{
dumpLog.WriteLine("Rewinding, please wait...");
DicConsole.Write("Rewinding, please wait...");
@@ -104,13 +106,13 @@ namespace DiscImageChef.Core.Devices.Dumping
fxSense = Sense.DecodeFixed(senseBuf, out strSense);
}
while(fxSense.HasValue && fxSense.Value.ASC == 0x00 &&
(fxSense.Value.ASCQ == 0x1A || fxSense.Value.ASCQ != 0x04));
(fxSense.Value.ASCQ == 0x1A || fxSense.Value.ASCQ != 0x04));
dev.RequestSense(out senseBuf, dev.Timeout, out duration);
fxSense = Sense.DecodeFixed(senseBuf, out strSense);
// And yet, did not rewind!
if(fxSense.HasValue &&
if(fxSense.HasValue &&
(fxSense.Value.ASC == 0x00 && fxSense.Value.ASCQ != 0x04 || fxSense.Value.ASC != 0x00))
{
DicConsole.WriteLine();
@@ -135,9 +137,9 @@ namespace DiscImageChef.Core.Devices.Dumping
// Anyway, <=SCSI-1 tapes do not support partitions
fxSense = Sense.DecodeFixed(senseBuf, out strSense);
if(fxSense.HasValue && (fxSense.Value.ASC == 0x20 && fxSense.Value.ASCQ != 0x00 ||
fxSense.Value.ASC != 0x20 && fxSense.Value.SenseKey != SenseKeys.IllegalRequest)
)
if(fxSense.HasValue && (fxSense.Value.ASC == 0x20 && fxSense.Value.ASCQ != 0x00 ||
fxSense.Value.ASC != 0x20 &&
fxSense.Value.SenseKey != SenseKeys.IllegalRequest))
{
DicConsole.ErrorWriteLine("Could not get position. Sense follows...");
DicConsole.ErrorWriteLine("{0}", strSense);
@@ -177,7 +179,7 @@ namespace DiscImageChef.Core.Devices.Dumping
fxSense = Sense.DecodeFixed(senseBuf, out strSense);
}
while(fxSense.HasValue && fxSense.Value.ASC == 0x00 &&
(fxSense.Value.ASCQ == 0x1A || fxSense.Value.ASCQ == 0x19));
(fxSense.Value.ASCQ == 0x1A || fxSense.Value.ASCQ == 0x19));
// And yet, did not rewind!
if(fxSense.HasValue && (fxSense.Value.ASC == 0x00 && fxSense.Value.ASCQ != 0x04 ||
@@ -217,9 +219,9 @@ namespace DiscImageChef.Core.Devices.Dumping
}
}
sidecar.BlockMedia = new BlockMediaType[1];
sidecar.BlockMedia[0] = new BlockMediaType {SCSI = new SCSIType()};
byte scsiMediumTypeTape = 0;
sidecar.BlockMedia = new BlockMediaType[1];
sidecar.BlockMedia[0] = new BlockMediaType {SCSI = new SCSIType()};
byte scsiMediumTypeTape = 0;
byte scsiDensityCodeTape = 0;
dumpLog.WriteLine("Requesting MODE SENSE (10).");
@@ -234,11 +236,11 @@ namespace DiscImageChef.Core.Devices.Dumping
if(!sense && !dev.Error)
if(Modes.DecodeMode10(cmdBuf, dev.ScsiType).HasValue)
{
decMode = Modes.DecodeMode10(cmdBuf, dev.ScsiType);
decMode = Modes.DecodeMode10(cmdBuf, dev.ScsiType);
sidecar.BlockMedia[0].SCSI.ModeSense10 = new DumpType
{
Image = outputPrefix + ".modesense10.bin",
Size = cmdBuf.Length,
Image = outputPrefix + ".modesense10.bin",
Size = cmdBuf.Length,
Checksums = Checksum.GetChecksums(cmdBuf).ToArray()
};
DataFile.WriteTo("SCSI Dump", sidecar.BlockMedia[0].SCSI.ModeSense10.Image, cmdBuf);
@@ -255,11 +257,11 @@ namespace DiscImageChef.Core.Devices.Dumping
if(!sense && !dev.Error)
if(Modes.DecodeMode6(cmdBuf, dev.ScsiType).HasValue)
{
decMode = Modes.DecodeMode6(cmdBuf, dev.ScsiType);
decMode = Modes.DecodeMode6(cmdBuf, dev.ScsiType);
sidecar.BlockMedia[0].SCSI.ModeSense = new DumpType
{
Image = outputPrefix + ".modesense.bin",
Size = cmdBuf.Length,
Image = outputPrefix + ".modesense.bin",
Size = cmdBuf.Length,
Checksums = Checksum.GetChecksums(cmdBuf).ToArray()
};
DataFile.WriteTo("SCSI Dump", sidecar.BlockMedia[0].SCSI.ModeSense.Image, cmdBuf);
@@ -271,7 +273,7 @@ namespace DiscImageChef.Core.Devices.Dumping
scsiMediumTypeTape = (byte)decMode.Value.Header.MediumType;
if(decMode.Value.Header.BlockDescriptors != null && decMode.Value.Header.BlockDescriptors.Length >= 1)
scsiDensityCodeTape = (byte)decMode.Value.Header.BlockDescriptors[0].Density;
blockSize = decMode.Value.Header.BlockDescriptors[0].BlockLength;
blockSize = decMode.Value.Header.BlockDescriptors[0].BlockLength;
dumpLog.WriteLine("Device reports {0} blocks ({1} bytes).", blocks, blocks * blockSize);
}
else blockSize = 1;
@@ -282,21 +284,21 @@ namespace DiscImageChef.Core.Devices.Dumping
DicConsole.WriteLine("Media identified as {0}", dskType);
dumpLog.WriteLine("SCSI device type: {0}.", dev.ScsiType);
dumpLog.WriteLine("SCSI medium type: {0}.", scsiMediumTypeTape);
dumpLog.WriteLine("SCSI density type: {0}.", scsiDensityCodeTape);
dumpLog.WriteLine("SCSI device type: {0}.", dev.ScsiType);
dumpLog.WriteLine("SCSI medium type: {0}.", scsiMediumTypeTape);
dumpLog.WriteLine("SCSI density type: {0}.", scsiDensityCodeTape);
dumpLog.WriteLine("Media identified as {0}.", dskType);
bool endOfMedia = false;
ulong currentBlock = 0;
ulong currentFile = 0;
byte currentPartition = 0;
byte totalPartitions = 1; // TODO: Handle partitions.
ulong currentSize = 0;
bool endOfMedia = false;
ulong currentBlock = 0;
ulong currentFile = 0;
byte currentPartition = 0;
byte totalPartitions = 1; // TODO: Handle partitions.
ulong currentSize = 0;
ulong currentPartitionSize = 0;
ulong currentFileSize = 0;
ulong currentFileSize = 0;
bool fixedLen = false;
bool fixedLen = false;
uint transferLen = blockSize;
sense = dev.Read6(out cmdBuf, out senseBuf, false, fixedLen, transferLen, blockSize, dev.Timeout,
@@ -323,10 +325,10 @@ namespace DiscImageChef.Core.Devices.Dumping
}
}
fixedLen = true;
fixedLen = true;
transferLen = 1;
sense = dev.Read6(out cmdBuf, out senseBuf, false, fixedLen, transferLen, blockSize,
dev.Timeout, out duration);
sense = dev.Read6(out cmdBuf, out senseBuf, false, fixedLen, transferLen, blockSize,
dev.Timeout, out duration);
if(sense)
{
DicConsole.WriteLine();
@@ -374,44 +376,44 @@ namespace DiscImageChef.Core.Devices.Dumping
}
List<TapePartitionType> partitions = new List<TapePartitionType>();
List<TapeFileType> files = new List<TapeFileType>();
List<TapeFileType> files = new List<TapeFileType>();
DicConsole.WriteLine();
DataFile dumpFile = new DataFile(outputPrefix + ".bin");
Checksum dataChk = new Checksum();
start = DateTime.UtcNow;
MhddLog mhddLog = new MhddLog(outputPrefix + ".mhddlog.bin", dev, blocks, blockSize, 1);
IbgLog ibgLog = new IbgLog(outputPrefix + ".ibg", 0x0008);
Checksum dataChk = new Checksum();
start = DateTime.UtcNow;
MhddLog mhddLog = new MhddLog(outputPrefix + ".mhddlog.bin", dev, blocks, blockSize, 1);
IbgLog ibgLog = new IbgLog(outputPrefix + ".ibg", 0x0008);
TapeFileType currentTapeFile = new TapeFileType
{
Image = new ImageType
{
format = "BINARY",
offset = (long)currentSize,
format = "BINARY",
offset = (long)currentSize,
offsetSpecified = true,
Value = outputPrefix + ".bin"
Value = outputPrefix + ".bin"
},
Sequence = (long)currentFile,
Sequence = (long)currentFile,
StartBlock = (long)currentBlock,
BlockSize = blockSize
BlockSize = blockSize
};
Checksum fileChk = new Checksum();
Checksum fileChk = new Checksum();
TapePartitionType currentTapePartition = new TapePartitionType
{
Image = new ImageType
{
format = "BINARY",
offset = (long)currentSize,
format = "BINARY",
offset = (long)currentSize,
offsetSpecified = true,
Value = outputPrefix + ".bin"
Value = outputPrefix + ".bin"
},
Sequence = currentPartition,
Sequence = currentPartition,
StartBlock = (long)currentBlock
};
Checksum partitionChk = new Checksum();
aborted = false;
aborted = false;
System.Console.CancelKeyPress += (sender, e) => e.Cancel = aborted = true;
while(currentPartition < totalPartitions)
@@ -427,10 +429,10 @@ namespace DiscImageChef.Core.Devices.Dumping
DicConsole.WriteLine();
DicConsole.WriteLine("Finished partition {0}", currentPartition);
dumpLog.WriteLine("Finished partition {0}", currentPartition);
currentTapePartition.File = files.ToArray();
currentTapePartition.File = files.ToArray();
currentTapePartition.Checksums = partitionChk.End().ToArray();
currentTapePartition.EndBlock = (long)(currentBlock - 1);
currentTapePartition.Size = (long)currentPartitionSize;
currentTapePartition.EndBlock = (long)(currentBlock - 1);
currentTapePartition.Size = (long)currentPartitionSize;
partitions.Add(currentTapePartition);
currentPartition++;
@@ -442,32 +444,32 @@ namespace DiscImageChef.Core.Devices.Dumping
{
Image = new ImageType
{
format = "BINARY",
offset = (long)currentSize,
format = "BINARY",
offset = (long)currentSize,
offsetSpecified = true,
Value = outputPrefix + ".bin"
Value = outputPrefix + ".bin"
},
Sequence = (long)currentFile,
Sequence = (long)currentFile,
StartBlock = (long)currentBlock,
BlockSize = blockSize
BlockSize = blockSize
};
currentFileSize = 0;
fileChk = new Checksum();
files = new List<TapeFileType>();
currentFileSize = 0;
fileChk = new Checksum();
files = new List<TapeFileType>();
currentTapePartition = new TapePartitionType
{
Image = new ImageType
{
format = "BINARY",
offset = (long)currentSize,
format = "BINARY",
offset = (long)currentSize,
offsetSpecified = true,
Value = outputPrefix + ".bin"
Value = outputPrefix + ".bin"
},
Sequence = currentPartition,
Sequence = currentPartition,
StartBlock = (long)currentBlock
};
currentPartitionSize = 0;
partitionChk = new Checksum();
partitionChk = new Checksum();
DicConsole.WriteLine("Seeking to partition {0}", currentPartition);
dev.Locate(out senseBuf, false, currentPartition, 0, dev.Timeout, out duration);
totalDuration += duration;
@@ -476,10 +478,10 @@ namespace DiscImageChef.Core.Devices.Dumping
continue;
}
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
if(currentSpeed > maxSpeed && currentSpeed != 0) maxSpeed = currentSpeed;
if(currentSpeed < minSpeed && currentSpeed != 0) minSpeed = currentSpeed;
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
DicConsole.Write("\rReading block {0} ({1:F3} MiB/sec.)", currentBlock, currentSpeed);
@@ -501,7 +503,8 @@ namespace DiscImageChef.Core.Devices.Dumping
DicConsole.WriteLine("Blocksize changed to {0} bytes at block {1}", blockSize, currentBlock);
dumpLog.WriteLine("Blocksize changed to {0} bytes at block {1}", blockSize, currentBlock);
sense = dev.Space(out senseBuf, SscSpaceCodes.LogicalBlock, -1, dev.Timeout, out duration);
sense = dev.Space(out senseBuf, SscSpaceCodes.LogicalBlock, -1, dev.Timeout,
out duration);
totalDuration += duration;
if(sense)
@@ -532,7 +535,7 @@ namespace DiscImageChef.Core.Devices.Dumping
}
// For sure this is an end-of-tape/partition
if(fxSense.Value.ASC == 0x00 &&
if(fxSense.Value.ASC == 0x00 &&
(fxSense.Value.ASCQ == 0x02 || fxSense.Value.ASCQ == 0x05 || fxSense.Value.EOM))
{
// TODO: Detect end of partition
@@ -550,7 +553,7 @@ namespace DiscImageChef.Core.Devices.Dumping
if((fxSense.Value.SenseKey == SenseKeys.NoSense ||
fxSense.Value.SenseKey == SenseKeys.RecoveredError) &&
(fxSense.Value.ASCQ == 0x02 || fxSense.Value.ASCQ == 0x05 || fxSense.Value.EOM))
(fxSense.Value.ASCQ == 0x02 || fxSense.Value.ASCQ == 0x05 || fxSense.Value.EOM))
{
// TODO: Detect end of partition
endOfMedia = true;
@@ -560,11 +563,11 @@ namespace DiscImageChef.Core.Devices.Dumping
if((fxSense.Value.SenseKey == SenseKeys.NoSense ||
fxSense.Value.SenseKey == SenseKeys.RecoveredError) &&
(fxSense.Value.ASCQ == 0x01 || fxSense.Value.Filemark))
(fxSense.Value.ASCQ == 0x01 || fxSense.Value.Filemark))
{
currentTapeFile.Checksums = fileChk.End().ToArray();
currentTapeFile.EndBlock = (long)(currentBlock - 1);
currentTapeFile.Size = (long)currentFileSize;
currentTapeFile.EndBlock = (long)(currentBlock - 1);
currentTapeFile.Size = (long)currentFileSize;
files.Add(currentTapeFile);
currentFile++;
@@ -572,17 +575,17 @@ namespace DiscImageChef.Core.Devices.Dumping
{
Image = new ImageType
{
format = "BINARY",
offset = (long)currentSize,
format = "BINARY",
offset = (long)currentSize,
offsetSpecified = true,
Value = outputPrefix + ".bin"
Value = outputPrefix + ".bin"
},
Sequence = (long)currentFile,
Sequence = (long)currentFile,
StartBlock = (long)currentBlock,
BlockSize = blockSize
BlockSize = blockSize
};
currentFileSize = 0;
fileChk = new Checksum();
fileChk = new Checksum();
DicConsole.WriteLine();
DicConsole.WriteLine("Changed to file {0} at block {1}", currentFile, currentBlock);
@@ -608,18 +611,19 @@ namespace DiscImageChef.Core.Devices.Dumping
dataChk.Update(cmdBuf);
fileChk.Update(cmdBuf);
partitionChk.Update(cmdBuf);
DateTime chkEnd = DateTime.UtcNow;
double chkDuration = (chkEnd - chkStart).TotalMilliseconds;
totalChkDuration += chkDuration;
DateTime chkEnd = DateTime.UtcNow;
double chkDuration = (chkEnd - chkStart).TotalMilliseconds;
totalChkDuration += chkDuration;
if(currentBlock % 10 == 0)
{
double newSpeed = blockSize / (double)1048576 / (duration / 1000);
double newSpeed = blockSize / (double)1048576 / (duration / 1000);
if(!double.IsInfinity(newSpeed)) currentSpeed = newSpeed;
}
currentBlock++;
currentSize += blockSize;
currentFileSize += blockSize;
currentSize += blockSize;
currentFileSize += blockSize;
currentPartitionSize += blockSize;
}
@@ -628,8 +632,10 @@ namespace DiscImageChef.Core.Devices.Dumping
end = DateTime.UtcNow;
mhddLog.Close();
ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000), devicePath);
dumpLog.WriteLine("Dump finished in {0} seconds.", (end - start).TotalSeconds);
blockSize * (double)(blocks + 1) /
1024 / (totalDuration / 1000), devicePath);
dumpLog.WriteLine("Dump finished in {0} seconds.",
(end - start).TotalSeconds);
dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.",
(double)blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000));
dumpLog.WriteLine("Average checksum speed {0:F3} KiB/sec.",
@@ -642,28 +648,30 @@ namespace DiscImageChef.Core.Devices.Dumping
DicConsole.WriteLine("Fastest speed burst: {0:F3} MiB/sec.", maxSpeed);
DicConsole.WriteLine("Slowest speed burst: {0:F3} MiB/sec.", minSpeed);
sidecar.BlockMedia[0].Checksums = dataChk.End().ToArray();
sidecar.BlockMedia[0].Checksums = dataChk.End().ToArray();
sidecar.BlockMedia[0].Dimensions = Dimensions.DimensionsFromMediaType(dskType);
Metadata.MediaType.MediaTypeToString(dskType, out string xmlDskTyp, out string xmlDskSubTyp);
sidecar.BlockMedia[0].DiskType = xmlDskTyp;
sidecar.BlockMedia[0].DiskType = xmlDskTyp;
sidecar.BlockMedia[0].DiskSubType = xmlDskSubTyp;
// TODO: Implement device firmware revision
sidecar.BlockMedia[0].Image = new ImageType
{
format = "Raw disk image (sector by sector copy)",
Value = outputPrefix + ".bin"
Value = outputPrefix + ".bin"
};
sidecar.BlockMedia[0].LogicalBlocks = (long)blocks;
sidecar.BlockMedia[0].Size = (long)currentSize;
sidecar.BlockMedia[0].DumpHardwareArray = new DumpHardwareType[1];
sidecar.BlockMedia[0].DumpHardwareArray[0] = new DumpHardwareType {Extents = new ExtentType[1]};
sidecar.BlockMedia[0].DumpHardwareArray[0].Extents[0] = new ExtentType {Start = 0, End = blocks - 1};
sidecar.BlockMedia[0].LogicalBlocks = (long)blocks;
sidecar.BlockMedia[0].Size = (long)currentSize;
sidecar.BlockMedia[0].DumpHardwareArray = new DumpHardwareType[1];
sidecar.BlockMedia[0].DumpHardwareArray[0] =
new DumpHardwareType {Extents = new ExtentType[1]};
sidecar.BlockMedia[0].DumpHardwareArray[0].Extents[0] =
new ExtentType {Start = 0, End = blocks - 1};
sidecar.BlockMedia[0].DumpHardwareArray[0].Manufacturer = dev.Manufacturer;
sidecar.BlockMedia[0].DumpHardwareArray[0].Model = dev.Model;
sidecar.BlockMedia[0].DumpHardwareArray[0].Revision = dev.Revision;
sidecar.BlockMedia[0].DumpHardwareArray[0].Serial = dev.Serial;
sidecar.BlockMedia[0].DumpHardwareArray[0].Software = Version.GetSoftwareType(dev.PlatformId);
sidecar.BlockMedia[0].TapeInformation = partitions.ToArray();
sidecar.BlockMedia[0].DumpHardwareArray[0].Model = dev.Model;
sidecar.BlockMedia[0].DumpHardwareArray[0].Revision = dev.Revision;
sidecar.BlockMedia[0].DumpHardwareArray[0].Serial = dev.Serial;
sidecar.BlockMedia[0].DumpHardwareArray[0].Software = Version.GetSoftwareType(dev.PlatformId);
sidecar.BlockMedia[0].TapeInformation = partitions.ToArray();
if(!aborted)
{

View File

@@ -70,7 +70,6 @@
<Compile Include="Devices\Reader.cs" />
<Compile Include="Devices\ReaderATA.cs" />
<Compile Include="Devices\ReaderSCSI.cs" />
<Compile Include="Version.cs" />
<Compile Include="Devices\Dumping\SSC.cs" />
<Compile Include="Devices\Dumping\MMC.cs" />
<Compile Include="Devices\Dumping\CompactDisc.cs" />

View File

@@ -36,6 +36,7 @@ using System.Reflection;
using DiscImageChef.Devices;
using DiscImageChef.Interop;
using PlatformID = DiscImageChef.Interop.PlatformID;
using Version = DiscImageChef.Interop.Version;
namespace DiscImageChef.Core.Logging
{
@@ -59,60 +60,63 @@ namespace DiscImageChef.Core.Logging
logSw.WriteLine("Start logging at {0}", DateTime.Now);
PlatformID platId = DetectOS.GetRealPlatformID();
string platVer = DetectOS.GetVersion();
Type monoRunType = Type.GetType("Mono.Runtime");
PlatformID platId = DetectOS.GetRealPlatformID();
string platVer = DetectOS.GetVersion();
Type monoRunType = Type.GetType("Mono.Runtime");
logSw.WriteLine("################# System information #################");
logSw.WriteLine("{0} {1} ({2}-bit)", DetectOS.GetPlatformName(platId, platVer), platVer,
Environment.Is64BitOperatingSystem ? 64 : 32);
if(monoRunType != null)
{
string monoVer = "unknown version";
string monoVer = "unknown version";
MethodInfo monoDisplayName =
monoRunType.GetMethod("GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static);
if(monoDisplayName != null) monoVer = (string)monoDisplayName.Invoke(null, null);
logSw.WriteLine("Mono {0}", monoVer);
}
else logSw.WriteLine(".NET Framework {0}", Environment.Version);
logSw.WriteLine();
logSw.WriteLine("################# Program information ################");
logSw.WriteLine("DiscImageChef {0} running in {1}-bit", Version.GetVersion(),
Environment.Is64BitProcess ? 64 : 32);
#if DEBUG
#if DEBUG
logSw.WriteLine("DEBUG version");
#endif
#endif
logSw.WriteLine("Command line: {0}", Environment.CommandLine);
logSw.WriteLine();
logSw.WriteLine("################# Device information #################");
logSw.WriteLine("Manufacturer: {0}", dev.Manufacturer);
logSw.WriteLine("Model: {0}", dev.Model);
logSw.WriteLine("Firmware revision: {0}", dev.Revision);
logSw.WriteLine("Serial number: {0}", dev.Serial);
logSw.WriteLine("Removable device: {0}", dev.IsRemovable);
logSw.WriteLine("Device type: {0}", dev.Type);
logSw.WriteLine("Manufacturer: {0}", dev.Manufacturer);
logSw.WriteLine("Model: {0}", dev.Model);
logSw.WriteLine("Firmware revision: {0}", dev.Revision);
logSw.WriteLine("Serial number: {0}", dev.Serial);
logSw.WriteLine("Removable device: {0}", dev.IsRemovable);
logSw.WriteLine("Device type: {0}", dev.Type);
logSw.WriteLine("CompactFlash device: {0}", dev.IsCompactFlash);
logSw.WriteLine("PCMCIA device: {0}", dev.IsPcmcia);
logSw.WriteLine("USB device: {0}", dev.IsUsb);
logSw.WriteLine("PCMCIA device: {0}", dev.IsPcmcia);
logSw.WriteLine("USB device: {0}", dev.IsUsb);
if(dev.IsUsb)
{
logSw.WriteLine("USB manufacturer: {0}", dev.UsbManufacturerString);
logSw.WriteLine("USB product: {0}", dev.UsbProductString);
logSw.WriteLine("USB serial: {0}", dev.UsbSerialString);
logSw.WriteLine("USB vendor ID: {0:X4}h", dev.UsbVendorId);
logSw.WriteLine("USB manufacturer: {0}", dev.UsbManufacturerString);
logSw.WriteLine("USB product: {0}", dev.UsbProductString);
logSw.WriteLine("USB serial: {0}", dev.UsbSerialString);
logSw.WriteLine("USB vendor ID: {0:X4}h", dev.UsbVendorId);
logSw.WriteLine("USB product ID: {0:X4}h", dev.UsbProductId);
}
logSw.WriteLine("FireWire device: {0}", dev.IsFireWire);
if(dev.IsFireWire)
{
logSw.WriteLine("FireWire vendor: {0}", dev.FireWireVendorName);
logSw.WriteLine("FireWire model: {0}", dev.FireWireModelName);
logSw.WriteLine("FireWire GUID: 0x{0:X16}", dev.FireWireGuid);
logSw.WriteLine("FireWire vendor ID: 0x{0:X8}", dev.FireWireVendor);
logSw.WriteLine("FireWire vendor: {0}", dev.FireWireVendorName);
logSw.WriteLine("FireWire model: {0}", dev.FireWireModelName);
logSw.WriteLine("FireWire GUID: 0x{0:X16}", dev.FireWireGuid);
logSw.WriteLine("FireWire vendor ID: 0x{0:X8}", dev.FireWireVendor);
logSw.WriteLine("FireWire product ID: 0x{0:X8}", dev.FireWireModel);
}
logSw.WriteLine();
logSw.WriteLine("######################################################");

View File

@@ -41,6 +41,7 @@ using DiscImageChef.Devices;
using DiscImageChef.Interop;
using DiscImageChef.Metadata;
using MediaType = DiscImageChef.CommonTypes.MediaType;
using Version = DiscImageChef.Interop.Version;
namespace DiscImageChef.Core
{
@@ -69,7 +70,7 @@ namespace DiscImageChef.Core
{
if(File.Exists(Path.Combine(Settings.Settings.StatsPath, "Statistics.xml")))
{
AllStats = new Stats();
AllStats = new Stats();
CurrentStats = new Stats
{
OperatingSystems =
@@ -77,21 +78,21 @@ namespace DiscImageChef.Core
{
new OsStats
{
name = DetectOS.GetRealPlatformID().ToString(),
Value = 1,
name = DetectOS.GetRealPlatformID().ToString(),
Value = 1,
version = DetectOS.GetVersion()
}
},
Versions = new List<NameValueStats> {new NameValueStats {name = Version.GetVersion(), Value = 1}}
};
XmlSerializer xs = new XmlSerializer(AllStats.GetType());
StreamReader sr = new StreamReader(Path.Combine(Settings.Settings.StatsPath, "Statistics.xml"));
AllStats = (Stats)xs.Deserialize(sr);
StreamReader sr = new StreamReader(Path.Combine(Settings.Settings.StatsPath, "Statistics.xml"));
AllStats = (Stats)xs.Deserialize(sr);
sr.Close();
}
else if(Settings.Settings.Current.Stats != null)
{
AllStats = new Stats();
AllStats = new Stats();
CurrentStats = new Stats
{
OperatingSystems =
@@ -99,8 +100,8 @@ namespace DiscImageChef.Core
{
new OsStats
{
name = DetectOS.GetRealPlatformID().ToString(),
Value = 1,
name = DetectOS.GetRealPlatformID().ToString(),
Value = 1,
version = DetectOS.GetVersion()
}
},
@@ -109,7 +110,7 @@ namespace DiscImageChef.Core
}
else
{
AllStats = null;
AllStats = null;
CurrentStats = null;
}
}
@@ -126,12 +127,13 @@ namespace DiscImageChef.Core
long count = 0;
OsStats old = null;
foreach(OsStats nvs in
AllStats.OperatingSystems.Where(nvs => nvs.name == DetectOS.GetRealPlatformID().ToString() &&
nvs.version == DetectOS.GetVersion()))
foreach(OsStats nvs in AllStats.OperatingSystems.Where(nvs =>
nvs.name == DetectOS
.GetRealPlatformID().ToString() &&
nvs.version == DetectOS.GetVersion()))
{
count = nvs.Value + 1;
old = nvs;
old = nvs;
break;
}
@@ -140,12 +142,13 @@ namespace DiscImageChef.Core
count++;
AllStats.OperatingSystems.Add(new OsStats
{
name = DetectOS.GetRealPlatformID().ToString(),
Value = count,
name = DetectOS.GetRealPlatformID().ToString(),
Value = count,
version = DetectOS.GetVersion()
});
}
else if(CurrentStats != null) AllStats.OperatingSystems = CurrentStats.OperatingSystems;
else if(CurrentStats != null)
AllStats.OperatingSystems = CurrentStats.OperatingSystems;
if(AllStats.Versions != null)
{
@@ -155,7 +158,7 @@ namespace DiscImageChef.Core
foreach(NameValueStats nvs in AllStats.Versions.Where(nvs => nvs.name == Version.GetVersion()))
{
count = nvs.Value + 1;
old = nvs;
old = nvs;
break;
}
@@ -164,7 +167,8 @@ namespace DiscImageChef.Core
count++;
AllStats.Versions.Add(new NameValueStats {name = Version.GetVersion(), Value = count});
}
else if(CurrentStats != null) AllStats.Versions = CurrentStats.Versions;
else if(CurrentStats != null)
AllStats.Versions = CurrentStats.Versions;
FileStream fs = new FileStream(Path.Combine(Settings.Settings.StatsPath, "Statistics.xml"),
FileMode.Create);
@@ -208,31 +212,32 @@ namespace DiscImageChef.Core
Stats stats = new Stats();
// This can execute before debug console has been inited
#if DEBUG
#if DEBUG
System.Console.WriteLine("Uploading partial statistics file {0}", statsFile);
#else
#else
DiscImageChef.Console.DicConsole.DebugWriteLine("Submit stats", "Uploading partial statistics file {0}", statsFile);
#endif
#endif
FileStream fs = new FileStream(statsFile, FileMode.Open, FileAccess.Read);
FileStream fs = new FileStream(statsFile, FileMode.Open, FileAccess.Read);
XmlSerializer xs = new XmlSerializer(stats.GetType());
xs.Deserialize(fs); // Just to test validity of stats file
fs.Seek(0, SeekOrigin.Begin);
WebRequest request = WebRequest.Create("http://discimagechef.claunia.com/api/uploadstats");
WebRequest request =
WebRequest.Create("http://discimagechef.claunia.com/api/uploadstats");
((HttpWebRequest)request).UserAgent =
$"DiscImageChef {typeof(Version).Assembly.GetName().Version}";
request.Method = "POST";
request.Method = "POST";
request.ContentLength = fs.Length;
request.ContentType = "application/xml";
Stream reqStream = request.GetRequestStream();
request.ContentType = "application/xml";
Stream reqStream = request.GetRequestStream();
fs.CopyTo(reqStream);
reqStream.Close();
WebResponse response = request.GetResponse();
if(((HttpWebResponse)response).StatusCode != HttpStatusCode.OK) return;
Stream data = response.GetResponseStream();
Stream data = response.GetResponseStream();
StreamReader reader = new StreamReader(data ?? throw new InvalidOperationException());
string responseFromServer = reader.ReadToEnd();
@@ -248,12 +253,12 @@ namespace DiscImageChef.Core
}
catch
{
#if DEBUG
#if DEBUG
submitStatsLock = false;
throw;
#else
#else
continue;
#endif
#endif
}
submitStatsLock = false;
@@ -366,7 +371,7 @@ namespace DiscImageChef.Core
{
if(Settings.Settings.Current.Stats == null || !Settings.Settings.Current.Stats.FilesystemStats) return;
if(AllStats.Filesystems == null) AllStats.Filesystems = new List<NameValueStats>();
if(AllStats.Filesystems == null) AllStats.Filesystems = new List<NameValueStats>();
if(CurrentStats.Filesystems == null) CurrentStats.Filesystems = new List<NameValueStats>();
NameValueStats old = AllStats.Filesystems.FirstOrDefault(nvs => nvs.name == filesystem);
@@ -374,15 +379,16 @@ namespace DiscImageChef.Core
NameValueStats nw = new NameValueStats();
if(old != null)
{
nw.name = old.name;
nw.name = old.name;
nw.Value = old.Value + 1;
AllStats.Filesystems.Remove(old);
}
else
{
nw.name = filesystem;
nw.name = filesystem;
nw.Value = 1;
}
AllStats.Filesystems.Add(nw);
old = CurrentStats.Filesystems.FirstOrDefault(nvs => nvs.name == filesystem);
@@ -390,15 +396,16 @@ namespace DiscImageChef.Core
nw = new NameValueStats();
if(old != null)
{
nw.name = old.name;
nw.name = old.name;
nw.Value = old.Value + 1;
CurrentStats.Filesystems.Remove(old);
}
else
{
nw.name = filesystem;
nw.name = filesystem;
nw.Value = 1;
}
CurrentStats.Filesystems.Add(nw);
}
@@ -410,7 +417,7 @@ namespace DiscImageChef.Core
{
if(Settings.Settings.Current.Stats == null || !Settings.Settings.Current.Stats.PartitionStats) return;
if(AllStats.Partitions == null) AllStats.Partitions = new List<NameValueStats>();
if(AllStats.Partitions == null) AllStats.Partitions = new List<NameValueStats>();
if(CurrentStats.Partitions == null) CurrentStats.Partitions = new List<NameValueStats>();
NameValueStats old = AllStats.Partitions.FirstOrDefault(nvs => nvs.name == partition);
@@ -418,15 +425,16 @@ namespace DiscImageChef.Core
NameValueStats nw = new NameValueStats();
if(old != null)
{
nw.name = old.name;
nw.name = old.name;
nw.Value = old.Value + 1;
AllStats.Partitions.Remove(old);
}
else
{
nw.name = partition;
nw.name = partition;
nw.Value = 1;
}
AllStats.Partitions.Add(nw);
old = CurrentStats.Partitions.FirstOrDefault(nvs => nvs.name == partition);
@@ -434,15 +442,16 @@ namespace DiscImageChef.Core
nw = new NameValueStats();
if(old != null)
{
nw.name = old.name;
nw.name = old.name;
nw.Value = old.Value + 1;
CurrentStats.Partitions.Remove(old);
}
else
{
nw.name = partition;
nw.name = partition;
nw.Value = 1;
}
CurrentStats.Partitions.Add(nw);
}
@@ -454,7 +463,7 @@ namespace DiscImageChef.Core
{
if(Settings.Settings.Current.Stats == null || !Settings.Settings.Current.Stats.FilterStats) return;
if(AllStats.Filters == null) AllStats.Filters = new List<NameValueStats>();
if(AllStats.Filters == null) AllStats.Filters = new List<NameValueStats>();
if(CurrentStats.Filters == null) CurrentStats.Filters = new List<NameValueStats>();
NameValueStats old = AllStats.Filters.FirstOrDefault(nvs => nvs.name == format);
@@ -462,15 +471,16 @@ namespace DiscImageChef.Core
NameValueStats nw = new NameValueStats();
if(old != null)
{
nw.name = old.name;
nw.name = old.name;
nw.Value = old.Value + 1;
AllStats.Filters.Remove(old);
}
else
{
nw.name = format;
nw.name = format;
nw.Value = 1;
}
AllStats.Filters.Add(nw);
old = CurrentStats.Filters.FirstOrDefault(nvs => nvs.name == format);
@@ -478,15 +488,16 @@ namespace DiscImageChef.Core
nw = new NameValueStats();
if(old != null)
{
nw.name = old.name;
nw.name = old.name;
nw.Value = old.Value + 1;
CurrentStats.Filters.Remove(old);
}
else
{
nw.name = format;
nw.name = format;
nw.Value = 1;
}
CurrentStats.Filters.Add(nw);
}
@@ -498,7 +509,7 @@ namespace DiscImageChef.Core
{
if(Settings.Settings.Current.Stats == null || !Settings.Settings.Current.Stats.MediaImageStats) return;
if(AllStats.MediaImages == null) AllStats.MediaImages = new List<NameValueStats>();
if(AllStats.MediaImages == null) AllStats.MediaImages = new List<NameValueStats>();
if(CurrentStats.MediaImages == null) CurrentStats.MediaImages = new List<NameValueStats>();
NameValueStats old = AllStats.MediaImages.FirstOrDefault(nvs => nvs.name == format);
@@ -506,15 +517,16 @@ namespace DiscImageChef.Core
NameValueStats nw = new NameValueStats();
if(old != null)
{
nw.name = old.name;
nw.name = old.name;
nw.Value = old.Value + 1;
AllStats.MediaImages.Remove(old);
}
else
{
nw.name = format;
nw.name = format;
nw.Value = 1;
}
AllStats.MediaImages.Add(nw);
old = CurrentStats.MediaImages.FirstOrDefault(nvs => nvs.name == format);
@@ -522,15 +534,16 @@ namespace DiscImageChef.Core
nw = new NameValueStats();
if(old != null)
{
nw.name = old.name;
nw.name = old.name;
nw.Value = old.Value + 1;
CurrentStats.MediaImages.Remove(old);
}
else
{
nw.name = format;
nw.name = format;
nw.Value = 1;
}
CurrentStats.MediaImages.Add(nw);
}
@@ -542,42 +555,46 @@ namespace DiscImageChef.Core
{
if(Settings.Settings.Current.Stats == null || !Settings.Settings.Current.Stats.DeviceStats) return;
if(AllStats.Devices == null) AllStats.Devices = new List<DeviceStats>();
if(AllStats.Devices == null) AllStats.Devices = new List<DeviceStats>();
if(CurrentStats.Devices == null) CurrentStats.Devices = new List<DeviceStats>();
string deviceBus;
if(dev.IsUsb) deviceBus = "USB";
else if(dev.IsFireWire) deviceBus = "FireWire";
else deviceBus = dev.Type.ToString();
else if(dev.IsFireWire)
deviceBus = "FireWire";
else
deviceBus = dev.Type.ToString();
DeviceStats old = AllStats.Devices.FirstOrDefault(ds => ds.Manufacturer == dev.Manufacturer &&
ds.Model == dev.Model &&
ds.Revision == dev.Revision && ds.Bus == deviceBus);
ds.Model == dev.Model &&
ds.Revision == dev.Revision &&
ds.Bus == deviceBus);
if(old != null) AllStats.Devices.Remove(old);
DeviceStats nw = new DeviceStats
{
Model = dev.Model,
Manufacturer = dev.Manufacturer,
Revision = dev.Revision,
Bus = deviceBus,
Model = dev.Model,
Manufacturer = dev.Manufacturer,
Revision = dev.Revision,
Bus = deviceBus,
ManufacturerSpecified = true
};
AllStats.Devices.Add(nw);
old = CurrentStats.Devices.FirstOrDefault(ds => ds.Manufacturer == dev.Manufacturer &&
ds.Model == dev.Model && ds.Revision == dev.Revision &&
ds.Bus == deviceBus);
ds.Model == dev.Model &&
ds.Revision == dev.Revision &&
ds.Bus == deviceBus);
if(old != null) CurrentStats.Devices.Remove(old);
nw = new DeviceStats
{
Model = dev.Model,
Manufacturer = dev.Manufacturer,
Revision = dev.Revision,
Bus = deviceBus,
Model = dev.Model,
Manufacturer = dev.Manufacturer,
Revision = dev.Revision,
Bus = deviceBus,
ManufacturerSpecified = true
};
CurrentStats.Devices.Add(nw);
@@ -592,7 +609,7 @@ namespace DiscImageChef.Core
{
if(Settings.Settings.Current.Stats == null || !Settings.Settings.Current.Stats.MediaStats) return;
if(AllStats.Medias == null) AllStats.Medias = new List<MediaStats>();
if(AllStats.Medias == null) AllStats.Medias = new List<MediaStats>();
if(CurrentStats.Medias == null) CurrentStats.Medias = new List<MediaStats>();
MediaStats old = AllStats.Medias.FirstOrDefault(ms => ms.real == real && ms.type == type.ToString());
@@ -600,17 +617,18 @@ namespace DiscImageChef.Core
MediaStats nw = new MediaStats();
if(old != null)
{
nw.type = old.type;
nw.real = old.real;
nw.type = old.type;
nw.real = old.real;
nw.Value = old.Value + 1;
AllStats.Medias.Remove(old);
}
else
{
nw.type = type.ToString();
nw.real = real;
nw.type = type.ToString();
nw.real = real;
nw.Value = 1;
}
AllStats.Medias.Add(nw);
old = CurrentStats.Medias.FirstOrDefault(ms => ms.real == real && ms.type == type.ToString());
@@ -618,17 +636,18 @@ namespace DiscImageChef.Core
nw = new MediaStats();
if(old != null)
{
nw.type = old.type;
nw.real = old.real;
nw.type = old.type;
nw.real = old.real;
nw.Value = old.Value + 1;
CurrentStats.Medias.Remove(old);
}
else
{
nw.type = type.ToString();
nw.real = real;
nw.type = type.ToString();
nw.real = real;
nw.Value = 1;
}
CurrentStats.Medias.Add(nw);
}
@@ -642,33 +661,33 @@ namespace DiscImageChef.Core
/// <param name="maxMemory">Maximum used memory</param>
/// <param name="minMemory">Minimum used memory</param>
public static void AddBenchmark(Dictionary<string, double> checksums, double entropy, double all,
double sequential, long maxMemory, long minMemory)
double sequential, long maxMemory, long minMemory)
{
if(Settings.Settings.Current.Stats == null || !Settings.Settings.Current.Stats.BenchmarkStats) return;
CurrentStats.Benchmark = new BenchmarkStats {Checksum = new List<ChecksumStats>()};
AllStats.Benchmark = new BenchmarkStats {Checksum = new List<ChecksumStats>()};
AllStats.Benchmark = new BenchmarkStats {Checksum = new List<ChecksumStats>()};
foreach(ChecksumStats st in checksums.Select(kvp => new ChecksumStats
{
algorithm = kvp.Key,
Value = kvp.Value
Value = kvp.Value
}))
{
CurrentStats.Benchmark.Checksum.Add(st);
AllStats.Benchmark.Checksum.Add(st);
}
CurrentStats.Benchmark.All = all;
CurrentStats.Benchmark.Entropy = entropy;
CurrentStats.Benchmark.MaxMemory = maxMemory;
CurrentStats.Benchmark.MinMemory = minMemory;
CurrentStats.Benchmark.All = all;
CurrentStats.Benchmark.Entropy = entropy;
CurrentStats.Benchmark.MaxMemory = maxMemory;
CurrentStats.Benchmark.MinMemory = minMemory;
CurrentStats.Benchmark.Sequential = sequential;
AllStats.Benchmark.All = all;
AllStats.Benchmark.Entropy = entropy;
AllStats.Benchmark.MaxMemory = maxMemory;
AllStats.Benchmark.MinMemory = minMemory;
AllStats.Benchmark.All = all;
AllStats.Benchmark.Entropy = entropy;
AllStats.Benchmark.MaxMemory = maxMemory;
AllStats.Benchmark.MinMemory = minMemory;
AllStats.Benchmark.Sequential = sequential;
}
@@ -685,7 +704,7 @@ namespace DiscImageChef.Core
if(Settings.Settings.Current.Stats == null || !Settings.Settings.Current.Stats.VerifyStats) return;
if(CurrentStats.Verify == null)
CurrentStats.Verify =
CurrentStats.Verify =
new VerifyStats {MediaImages = new VerifiedItems(), Sectors = new ScannedSectors()};
if(AllStats.Verify == null)
@@ -703,15 +722,15 @@ namespace DiscImageChef.Core
AllStats.Verify.MediaImages.Failed++;
}
CurrentStats.Verify.Sectors.Correct += correct;
CurrentStats.Verify.Sectors.Error += failed;
CurrentStats.Verify.Sectors.Correct += correct;
CurrentStats.Verify.Sectors.Error += failed;
CurrentStats.Verify.Sectors.Unverifiable += unknown;
CurrentStats.Verify.Sectors.Total += total;
CurrentStats.Verify.Sectors.Total += total;
AllStats.Verify.Sectors.Correct += correct;
AllStats.Verify.Sectors.Error += failed;
AllStats.Verify.Sectors.Correct += correct;
AllStats.Verify.Sectors.Error += failed;
AllStats.Verify.Sectors.Unverifiable += unknown;
AllStats.Verify.Sectors.Total += total;
AllStats.Verify.Sectors.Total += total;
}
/// <summary>
@@ -726,8 +745,9 @@ namespace DiscImageChef.Core
/// <param name="total">Total sectors</param>
/// <param name="error">Errored sectors</param>
/// <param name="correct">Correct sectors</param>
public static void AddMediaScan(long lessThan3ms, long lessThan10ms, long lessThan50ms, long lessThan150ms,
long lessThan500ms, long moreThan500ms, long total, long error, long correct)
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) return;
@@ -737,22 +757,22 @@ namespace DiscImageChef.Core
if(AllStats.MediaScan == null)
AllStats.MediaScan = new MediaScanStats {Sectors = new ScannedSectors(), Times = new TimeStats()};
CurrentStats.MediaScan.Sectors.Correct += correct;
CurrentStats.MediaScan.Sectors.Error += error;
CurrentStats.MediaScan.Sectors.Total += total;
CurrentStats.MediaScan.Times.LessThan3ms += lessThan3ms;
CurrentStats.MediaScan.Times.LessThan10ms += lessThan10ms;
CurrentStats.MediaScan.Times.LessThan50ms += lessThan50ms;
CurrentStats.MediaScan.Sectors.Correct += correct;
CurrentStats.MediaScan.Sectors.Error += error;
CurrentStats.MediaScan.Sectors.Total += total;
CurrentStats.MediaScan.Times.LessThan3ms += lessThan3ms;
CurrentStats.MediaScan.Times.LessThan10ms += lessThan10ms;
CurrentStats.MediaScan.Times.LessThan50ms += lessThan50ms;
CurrentStats.MediaScan.Times.LessThan150ms += lessThan150ms;
CurrentStats.MediaScan.Times.LessThan500ms += lessThan500ms;
CurrentStats.MediaScan.Times.MoreThan500ms += moreThan500ms;
AllStats.MediaScan.Sectors.Correct += correct;
AllStats.MediaScan.Sectors.Error += error;
AllStats.MediaScan.Sectors.Total += total;
AllStats.MediaScan.Times.LessThan3ms += lessThan3ms;
AllStats.MediaScan.Times.LessThan10ms += lessThan10ms;
AllStats.MediaScan.Times.LessThan50ms += lessThan50ms;
AllStats.MediaScan.Sectors.Correct += correct;
AllStats.MediaScan.Sectors.Error += error;
AllStats.MediaScan.Sectors.Total += total;
AllStats.MediaScan.Times.LessThan3ms += lessThan3ms;
AllStats.MediaScan.Times.LessThan10ms += lessThan10ms;
AllStats.MediaScan.Times.LessThan50ms += lessThan50ms;
AllStats.MediaScan.Times.LessThan150ms += lessThan150ms;
AllStats.MediaScan.Times.LessThan500ms += lessThan500ms;
AllStats.MediaScan.Times.MoreThan500ms += moreThan500ms;

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -37,12 +37,19 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="DetectOS.cs" />
<Compile Include="PlatformID.cs" />
<Compile Include="Version.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\LICENSE.MIT">
<Link>LICENSE.MIT</Link>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DiscImageChef.Metadata\DiscImageChef.Metadata.csproj">
<Project>{9F213318-5CB8-4066-A757-074489C9F818}</Project>
<Name>DiscImageChef.Metadata</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<MonoDevelop>

View File

@@ -5,7 +5,7 @@
// Filename : Version.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Core algorithms.
// Component : Interop services.
//
// --[ Description ] ----------------------------------------------------------
//
@@ -13,18 +13,24 @@
//
// --[ License ] --------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General internal License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General internal License for more details.
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// You should have received a copy of the GNU General internal License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2018 Natalia Portillo
@@ -33,16 +39,16 @@
using DiscImageChef.Interop;
using Schemas;
namespace DiscImageChef.Core
namespace DiscImageChef.Interop
{
static class Version
public static class Version
{
/// <summary>
/// Gets XML software type for the running version
/// </summary>
/// <param name="platform">Platform we are running in</param>
/// <returns>XML software type</returns>
internal static SoftwareType GetSoftwareType(PlatformID platform)
public static SoftwareType GetSoftwareType(PlatformID platform)
{
// TODO: Platform should be get automatically
return new SoftwareType
@@ -57,7 +63,7 @@ namespace DiscImageChef.Core
/// Gets version string
/// </summary>
/// <returns>Version</returns>
internal static string GetVersion()
public static string GetVersion()
{
return typeof(Version).Assembly.GetName().Version.ToString();
}