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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -5,7 +5,7 @@
// Filename : Version.cs // Filename : Version.cs
// Author(s) : Natalia Portillo <claunia@claunia.com> // Author(s) : Natalia Portillo <claunia@claunia.com>
// //
// Component : Core algorithms. // Component : Interop services.
// //
// --[ Description ] ---------------------------------------------------------- // --[ Description ] ----------------------------------------------------------
// //
@@ -13,18 +13,24 @@
// //
// --[ License ] -------------------------------------------------------------- // --[ License ] --------------------------------------------------------------
// //
// This program is free software: you can redistribute it and/or modify // Permission is hereby granted, free of charge, to any person obtaining a
// it under the terms of the GNU General internal License as // copy of this software and associated documentation files (the
// published by the Free Software Foundation, either version 3 of the // "Software"), to deal in the Software without restriction, including
// License, or (at your option) any later version. // 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, // The above copyright notice and this permission notice shall be included
// but WITHOUT ANY WARRANTY; without even the implied warranty of // in all copies or substantial portions of the Software.
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General internal License for more details.
// //
// You should have received a copy of the GNU General internal License // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// along with this program. If not, see <http://www.gnu.org/licenses/>. // 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 // Copyright © 2011-2018 Natalia Portillo
@@ -33,16 +39,16 @@
using DiscImageChef.Interop; using DiscImageChef.Interop;
using Schemas; using Schemas;
namespace DiscImageChef.Core namespace DiscImageChef.Interop
{ {
static class Version public static class Version
{ {
/// <summary> /// <summary>
/// Gets XML software type for the running version /// Gets XML software type for the running version
/// </summary> /// </summary>
/// <param name="platform">Platform we are running in</param> /// <param name="platform">Platform we are running in</param>
/// <returns>XML software type</returns> /// <returns>XML software type</returns>
internal static SoftwareType GetSoftwareType(PlatformID platform) public static SoftwareType GetSoftwareType(PlatformID platform)
{ {
// TODO: Platform should be get automatically // TODO: Platform should be get automatically
return new SoftwareType return new SoftwareType
@@ -57,7 +63,7 @@ namespace DiscImageChef.Core
/// Gets version string /// Gets version string
/// </summary> /// </summary>
/// <returns>Version</returns> /// <returns>Version</returns>
internal static string GetVersion() public static string GetVersion()
{ {
return typeof(Version).Assembly.GetName().Version.ToString(); return typeof(Version).Assembly.GetName().Version.ToString();
} }