mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Code restyling.
This commit is contained in:
@@ -54,42 +54,42 @@ namespace Aaru.Core
|
||||
public class Checksum
|
||||
{
|
||||
readonly IChecksum adler32Ctx;
|
||||
HashPacket adlerPkt;
|
||||
Thread adlerThread;
|
||||
readonly IChecksum crc16Ctx;
|
||||
HashPacket crc16Pkt;
|
||||
Thread crc16Thread;
|
||||
readonly IChecksum crc32Ctx;
|
||||
HashPacket crc32Pkt;
|
||||
Thread crc32Thread;
|
||||
readonly IChecksum crc64Ctx;
|
||||
HashPacket crc64Pkt;
|
||||
Thread crc64Thread;
|
||||
readonly EnableChecksum enabled;
|
||||
readonly IChecksum f16Ctx;
|
||||
readonly IChecksum f32Ctx;
|
||||
readonly IChecksum md5Ctx;
|
||||
readonly IChecksum sha1Ctx;
|
||||
readonly IChecksum sha256Ctx;
|
||||
readonly IChecksum sha384Ctx;
|
||||
readonly IChecksum sha512Ctx;
|
||||
readonly IChecksum ssctx;
|
||||
HashPacket adlerPkt;
|
||||
Thread adlerThread;
|
||||
HashPacket crc16Pkt;
|
||||
Thread crc16Thread;
|
||||
HashPacket crc32Pkt;
|
||||
Thread crc32Thread;
|
||||
HashPacket crc64Pkt;
|
||||
Thread crc64Thread;
|
||||
HashPacket f16Pkt;
|
||||
Thread f16Thread;
|
||||
readonly IChecksum f32Ctx;
|
||||
HashPacket f32Pkt;
|
||||
Thread f32Thread;
|
||||
readonly IChecksum md5Ctx;
|
||||
HashPacket md5Pkt;
|
||||
Thread md5Thread;
|
||||
readonly IChecksum sha1Ctx;
|
||||
HashPacket sha1Pkt;
|
||||
Thread sha1Thread;
|
||||
readonly IChecksum sha256Ctx;
|
||||
HashPacket sha256Pkt;
|
||||
Thread sha256Thread;
|
||||
readonly IChecksum sha384Ctx;
|
||||
HashPacket sha384Pkt;
|
||||
Thread sha384Thread;
|
||||
readonly IChecksum sha512Ctx;
|
||||
HashPacket sha512Pkt;
|
||||
Thread sha512Thread;
|
||||
HashPacket spamsumPkt;
|
||||
Thread spamsumThread;
|
||||
readonly IChecksum ssctx;
|
||||
|
||||
public Checksum(EnableChecksum enabled = EnableChecksum.All)
|
||||
{
|
||||
@@ -314,7 +314,7 @@ namespace Aaru.Core
|
||||
sha512Thread.IsAlive ||
|
||||
spamsumThread.IsAlive ||
|
||||
f16Thread.IsAlive ||
|
||||
f32Thread.IsAlive) { }
|
||||
f32Thread.IsAlive) {}
|
||||
|
||||
if(enabled.HasFlag(EnableChecksum.SpamSum))
|
||||
adlerThread = new Thread(UpdateHash);
|
||||
@@ -665,7 +665,7 @@ namespace Aaru.Core
|
||||
sha512ThreadData.IsAlive ||
|
||||
spamsumThreadData.IsAlive ||
|
||||
f16ThreadData.IsAlive ||
|
||||
f32ThreadData.IsAlive) { }
|
||||
f32ThreadData.IsAlive) {}
|
||||
|
||||
List<ChecksumType> dataChecksums = new List<ChecksumType>();
|
||||
ChecksumType chk;
|
||||
|
||||
@@ -36,98 +36,63 @@ using Aaru.Console;
|
||||
|
||||
namespace Aaru.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Abstracts a datafile with a block based interface
|
||||
/// </summary>
|
||||
/// <summary>Abstracts a datafile with a block based interface</summary>
|
||||
[SuppressMessage("ReSharper", "UnusedMethodReturnValue.Global")]
|
||||
public class DataFile
|
||||
{
|
||||
FileStream dataFs;
|
||||
readonly FileStream dataFs;
|
||||
|
||||
/// <summary>
|
||||
/// Opens, or create, a new file
|
||||
/// </summary>
|
||||
/// <summary>Opens, or create, a new file</summary>
|
||||
/// <param name="outputFile">File</param>
|
||||
public DataFile(string outputFile)
|
||||
{
|
||||
public DataFile(string outputFile) =>
|
||||
dataFs = new FileStream(outputFile, FileMode.OpenOrCreate, FileAccess.ReadWrite);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Closes the file
|
||||
/// </summary>
|
||||
public void Close()
|
||||
{
|
||||
dataFs?.Close();
|
||||
}
|
||||
/// <summary>Closes the file</summary>
|
||||
public void Close() => dataFs?.Close();
|
||||
|
||||
/// <summary>
|
||||
/// Reads bytes at current position
|
||||
/// </summary>
|
||||
/// <summary>Reads bytes at current position</summary>
|
||||
/// <param name="array">Array to place read data within</param>
|
||||
/// <param name="offset">Offset of <see cref="array" /> where data will be read</param>
|
||||
/// <param name="count">How many bytes to read</param>
|
||||
/// <returns>How many bytes were read</returns>
|
||||
public int Read(byte[] array, int offset, int count) => dataFs.Read(array, offset, count);
|
||||
|
||||
/// <summary>
|
||||
/// Seeks to the specified block
|
||||
/// </summary>
|
||||
/// <summary>Seeks to the specified block</summary>
|
||||
/// <param name="block">Block to seek to</param>
|
||||
/// <param name="blockSize">Block size in bytes</param>
|
||||
/// <returns>Position</returns>
|
||||
public long Seek(ulong block, ulong blockSize) => dataFs.Seek((long)(block * blockSize), SeekOrigin.Begin);
|
||||
|
||||
/// <summary>
|
||||
/// Seeks to specified byte position
|
||||
/// </summary>
|
||||
/// <summary>Seeks to specified byte position</summary>
|
||||
/// <param name="offset">Byte position</param>
|
||||
/// <param name="origin">Where to count for position</param>
|
||||
/// <returns>Position</returns>
|
||||
public long Seek(ulong offset, SeekOrigin origin) => dataFs.Seek((long)offset, origin);
|
||||
|
||||
/// <summary>
|
||||
/// Seeks to specified byte position
|
||||
/// </summary>
|
||||
/// <summary>Seeks to specified byte position</summary>
|
||||
/// <param name="offset">Byte position</param>
|
||||
/// <param name="origin">Where to count for position</param>
|
||||
/// <returns>Position</returns>
|
||||
public long Seek(long offset, SeekOrigin origin) => dataFs.Seek(offset, origin);
|
||||
|
||||
/// <summary>
|
||||
/// Writes data at current position
|
||||
/// </summary>
|
||||
/// <summary>Writes data at current position</summary>
|
||||
/// <param name="data">Data</param>
|
||||
public void Write(byte[] data)
|
||||
{
|
||||
Write(data, 0, data.Length);
|
||||
}
|
||||
public void Write(byte[] data) => Write(data, 0, data.Length);
|
||||
|
||||
/// <summary>
|
||||
/// Writes data at current position
|
||||
/// </summary>
|
||||
/// <summary>Writes data at current position</summary>
|
||||
/// <param name="data">Data</param>
|
||||
/// <param name="offset">Offset of data from where to start taking data to write</param>
|
||||
/// <param name="count">How many bytes to write</param>
|
||||
public void Write(byte[] data, int offset, int count)
|
||||
{
|
||||
dataFs.Write(data, offset, count);
|
||||
}
|
||||
public void Write(byte[] data, int offset, int count) => dataFs.Write(data, offset, count);
|
||||
|
||||
/// <summary>
|
||||
/// Writes data at specified block
|
||||
/// </summary>
|
||||
/// <summary>Writes data at specified block</summary>
|
||||
/// <param name="data">Data</param>
|
||||
/// <param name="block">Block</param>
|
||||
/// <param name="blockSize">Bytes per block</param>
|
||||
public void WriteAt(byte[] data, ulong block, uint blockSize)
|
||||
{
|
||||
public void WriteAt(byte[] data, ulong block, uint blockSize) =>
|
||||
WriteAt(data, block, blockSize, 0, data.Length);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes data at specified block
|
||||
/// </summary>
|
||||
/// <summary>Writes data at specified block</summary>
|
||||
/// <param name="data">Data</param>
|
||||
/// <param name="block">Block</param>
|
||||
/// <param name="blockSize">Bytes per block</param>
|
||||
@@ -139,14 +104,10 @@ namespace Aaru.Core
|
||||
dataFs.Write(data, offset, count);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current file position
|
||||
/// </summary>
|
||||
/// <summary>Current file position</summary>
|
||||
public long Position => dataFs.Position;
|
||||
|
||||
/// <summary>
|
||||
/// Writes data to a newly created file
|
||||
/// </summary>
|
||||
/// <summary>Writes data to a newly created file</summary>
|
||||
/// <param name="who">Who asked the file to be written (class, plugin, etc.)</param>
|
||||
/// <param name="data">Data to write</param>
|
||||
/// <param name="outputPrefix">First part of the file name</param>
|
||||
@@ -155,22 +116,22 @@ namespace Aaru.Core
|
||||
public static void WriteTo(string who, string outputPrefix, string outputSuffix, string whatWriting,
|
||||
byte[] data)
|
||||
{
|
||||
if(!string.IsNullOrEmpty(outputPrefix) && !string.IsNullOrEmpty(outputSuffix))
|
||||
if(!string.IsNullOrEmpty(outputPrefix) &&
|
||||
!string.IsNullOrEmpty(outputSuffix))
|
||||
WriteTo(who, outputPrefix + outputSuffix, data, whatWriting);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes data to a newly created file
|
||||
/// </summary>
|
||||
/// <summary>Writes data to a newly created file</summary>
|
||||
/// <param name="who">Who asked the file to be written (class, plugin, etc.)</param>
|
||||
/// <param name="filename">Filename to create</param>
|
||||
/// <param name="data">Data to write</param>
|
||||
/// <param name="whatWriting">What is the data about?</param>
|
||||
/// <param name="overwrite">If set to <c>true</c> overwrites the file, does nothing otherwise</param>
|
||||
public static void WriteTo(string who, string filename, byte[] data, string whatWriting = null,
|
||||
bool overwrite = false)
|
||||
bool overwrite = false)
|
||||
{
|
||||
if(string.IsNullOrEmpty(filename)) return;
|
||||
if(string.IsNullOrEmpty(filename))
|
||||
return;
|
||||
|
||||
if(File.Exists(filename))
|
||||
if(overwrite)
|
||||
@@ -178,17 +139,21 @@ namespace Aaru.Core
|
||||
else
|
||||
{
|
||||
AaruConsole.ErrorWriteLine("Not overwriting file {0}", filename);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
AaruConsole.DebugWriteLine(who, "Writing " + whatWriting + " to {0}", filename);
|
||||
FileStream outputFs = new FileStream(filename, FileMode.CreateNew);
|
||||
var outputFs = new FileStream(filename, FileMode.CreateNew);
|
||||
outputFs.Write(data, 0, data.Length);
|
||||
outputFs.Close();
|
||||
}
|
||||
catch { AaruConsole.ErrorWriteLine("Unable to write file {0}", filename); }
|
||||
catch
|
||||
{
|
||||
AaruConsole.ErrorWriteLine("Unable to write file {0}", filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,88 +32,56 @@
|
||||
|
||||
namespace Aaru.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializates a progress indicator (e.g. makes a progress bar visible)
|
||||
/// </summary>
|
||||
/// <summary>Initializates a progress indicator (e.g. makes a progress bar visible)</summary>
|
||||
public delegate void InitProgressHandler();
|
||||
|
||||
/// <summary>
|
||||
/// Updates a progress indicator with text
|
||||
/// </summary>
|
||||
/// <summary>Updates a progress indicator with text</summary>
|
||||
public delegate void UpdateProgressHandler(string text, long current, long maximum);
|
||||
|
||||
/// <summary>
|
||||
/// Pulses a progress indicator with indeterminate boundaries
|
||||
/// </summary>
|
||||
/// <summary>Pulses a progress indicator with indeterminate boundaries</summary>
|
||||
public delegate void PulseProgressHandler(string text);
|
||||
|
||||
/// <summary>
|
||||
/// Uninitializates a progress indicator (e.g. adds a newline to the console)
|
||||
/// </summary>
|
||||
/// <summary>Uninitializates a progress indicator (e.g. adds a newline to the console)</summary>
|
||||
public delegate void EndProgressHandler();
|
||||
|
||||
/// <summary>
|
||||
/// Initializates a secondary progress indicator (e.g. makes a progress bar visible)
|
||||
/// </summary>
|
||||
/// <summary>Initializates a secondary progress indicator (e.g. makes a progress bar visible)</summary>
|
||||
public delegate void InitProgressHandler2();
|
||||
|
||||
/// <summary>
|
||||
/// Updates a secondary progress indicator with text
|
||||
/// </summary>
|
||||
/// <summary>Updates a secondary progress indicator with text</summary>
|
||||
public delegate void UpdateProgressHandler2(string text, long current, long maximum);
|
||||
|
||||
/// <summary>
|
||||
/// Pulses a secondary progress indicator with indeterminate boundaries
|
||||
/// </summary>
|
||||
/// <summary>Pulses a secondary progress indicator with indeterminate boundaries</summary>
|
||||
public delegate void PulseProgressHandler2(string text);
|
||||
|
||||
/// <summary>
|
||||
/// Uninitializates a secondary progress indicator (e.g. adds a newline to the console)
|
||||
/// </summary>
|
||||
/// <summary>Uninitializates a secondary progress indicator (e.g. adds a newline to the console)</summary>
|
||||
public delegate void EndProgressHandler2();
|
||||
|
||||
/// <summary>
|
||||
/// Initializates two progress indicators (e.g. makes a progress bar visible)
|
||||
/// </summary>
|
||||
/// <summary>Initializates two progress indicators (e.g. makes a progress bar visible)</summary>
|
||||
public delegate void InitTwoProgressHandler();
|
||||
|
||||
/// <summary>
|
||||
/// Updates two progress indicators with text
|
||||
/// </summary>
|
||||
/// <summary>Updates two progress indicators with text</summary>
|
||||
public delegate void UpdateTwoProgressHandler(string text, long current, long maximum, string text2, long current2,
|
||||
long maximum2);
|
||||
long maximum2);
|
||||
|
||||
/// <summary>
|
||||
/// Pulses a progress indicator with indeterminate boundaries
|
||||
/// </summary>
|
||||
/// <summary>Pulses a progress indicator with indeterminate boundaries</summary>
|
||||
public delegate void PulseTwoProgressHandler(string text, string text2);
|
||||
|
||||
/// <summary>
|
||||
/// Uninitializates a progress indicator (e.g. adds a newline to the console)
|
||||
/// </summary>
|
||||
/// <summary>Uninitializates a progress indicator (e.g. adds a newline to the console)</summary>
|
||||
public delegate void EndTwoProgressHandler();
|
||||
|
||||
/// <summary>
|
||||
/// Updates a status indicator
|
||||
/// </summary>
|
||||
/// <summary>Updates a status indicator</summary>
|
||||
public delegate void UpdateStatusHandler(string text);
|
||||
|
||||
/// <summary>
|
||||
/// Shows an error message
|
||||
/// </summary>
|
||||
/// <summary>Shows an error message</summary>
|
||||
public delegate void ErrorMessageHandler(string text);
|
||||
|
||||
public delegate void InitBlockMapHandler(ulong blocks, ulong blockSize, ulong blocksToRead, ushort currentProfile);
|
||||
|
||||
/// <summary>
|
||||
/// Updates lists of time taken on scanning from the specified sector
|
||||
/// </summary>
|
||||
/// <summary>Updates lists of time taken on scanning from the specified sector</summary>
|
||||
/// <param name="duration">Time in milliseconds</param>
|
||||
public delegate void ScanTimeHandler(ulong sector, double duration);
|
||||
|
||||
/// <summary>
|
||||
/// Specified a number of blocks could not be read on scan
|
||||
/// </summary>
|
||||
/// <summary>Specified a number of blocks could not be read on scan</summary>
|
||||
public delegate void ScanUnreadableHandler(ulong sector);
|
||||
|
||||
public delegate void ScanSpeedHandler(ulong sector, double currentSpeed);
|
||||
|
||||
@@ -35,12 +35,12 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Extents;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Structs.Devices.ATA;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Decoders.PCMCIA;
|
||||
using Schemas;
|
||||
using Tuple = Aaru.Decoders.PCMCIA.Tuple;
|
||||
|
||||
@@ -32,11 +32,11 @@
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Extents;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.Console;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Decoders.SCSI;
|
||||
using Aaru.Devices;
|
||||
using Schemas;
|
||||
@@ -247,8 +247,7 @@ namespace Aaru.Core.Devices.Dumping
|
||||
|
||||
for(int b = 0; b < blocksToRead; b++)
|
||||
{
|
||||
Array.Copy(cmdBuf, (int)(0 + (b * blockSize)), data, sectorSize * b,
|
||||
sectorSize);
|
||||
Array.Copy(cmdBuf, (int)(0 + (b * blockSize)), data, sectorSize * b, sectorSize);
|
||||
|
||||
Array.Copy(cmdBuf, (int)(sectorSize + (b * blockSize)), sub, subSize * b, subSize);
|
||||
}
|
||||
@@ -276,8 +275,7 @@ namespace Aaru.Core.Devices.Dumping
|
||||
|
||||
for(int b = 0; b < blocksToRead; b++)
|
||||
{
|
||||
Array.Copy(data, sectorSize * b, cmdBuf, (int)(0 + (b * blockSize)),
|
||||
sectorSize);
|
||||
Array.Copy(data, sectorSize * b, cmdBuf, (int)(0 + (b * blockSize)), sectorSize);
|
||||
|
||||
Array.Copy(sub, subSize * b, cmdBuf, (int)(sectorSize + (b * blockSize)), subSize);
|
||||
}
|
||||
|
||||
@@ -34,14 +34,14 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Core.Media.Detection;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Extents;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.Console;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Core.Media.Detection;
|
||||
using Aaru.Database.Models;
|
||||
using Aaru.Decoders.CD;
|
||||
using Aaru.Devices;
|
||||
|
||||
@@ -31,9 +31,9 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Extents;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Devices;
|
||||
using Schemas;
|
||||
|
||||
@@ -295,8 +295,7 @@ namespace Aaru.Core.Devices.Dumping
|
||||
|
||||
for(int b = 0; b < _maximumReadable; b++)
|
||||
{
|
||||
Array.Copy(cmdBuf, (int)(0 + (b * blockSize)), data, sectorSize * b,
|
||||
sectorSize);
|
||||
Array.Copy(cmdBuf, (int)(0 + (b * blockSize)), data, sectorSize * b, sectorSize);
|
||||
|
||||
Array.Copy(cmdBuf, (int)(sectorSize + (b * blockSize)), sub, subSize * b, subSize);
|
||||
}
|
||||
|
||||
@@ -34,11 +34,11 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Checksums;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.Console;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Devices;
|
||||
|
||||
// ReSharper disable JoinDeclarationAndInitializer
|
||||
@@ -124,7 +124,7 @@ namespace Aaru.Core.Devices.Dumping
|
||||
|
||||
public static void SolveTrackPregaps(Device dev, DumpLog dumpLog, UpdateStatusHandler updateStatus,
|
||||
Track[] tracks, bool supportsPqSubchannel, bool supportsRwSubchannel,
|
||||
Aaru.Database.Models.Device dbDev, out bool inexactPositioning)
|
||||
Database.Models.Device dbDev, out bool inexactPositioning)
|
||||
{
|
||||
bool sense = true; // Sense indicator
|
||||
byte[] subBuf = null;
|
||||
@@ -154,10 +154,10 @@ namespace Aaru.Core.Devices.Dumping
|
||||
}
|
||||
|
||||
AaruConsole.DebugWriteLine("Pregap calculator", bcd == true
|
||||
? "Subchannel is BCD"
|
||||
: bcd == false
|
||||
? "Subchannel is not BCD"
|
||||
: "Could not detect drive subchannel BCD");
|
||||
? "Subchannel is BCD"
|
||||
: bcd == false
|
||||
? "Subchannel is not BCD"
|
||||
: "Could not detect drive subchannel BCD");
|
||||
|
||||
if(bcd is null)
|
||||
{
|
||||
@@ -209,8 +209,8 @@ namespace Aaru.Core.Devices.Dumping
|
||||
|
||||
if(sense)
|
||||
{
|
||||
AaruConsole.DebugWriteLine("Pregap calculator", "LBA: {0}, Try {1}, Sense {2}", lba, retries + 1,
|
||||
sense);
|
||||
AaruConsole.DebugWriteLine("Pregap calculator", "LBA: {0}, Try {1}, Sense {2}", lba,
|
||||
retries + 1, sense);
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -221,10 +221,10 @@ namespace Aaru.Core.Devices.Dumping
|
||||
CRC16CCITTContext.Data(subBuf, 10, out crc);
|
||||
|
||||
AaruConsole.DebugWriteLine("Pregap calculator",
|
||||
"LBA: {0}, Try {1}, Sense {2}, Q: {3:X2} {4:X2} {5:X2} {6:X2} {7:X2} {8:X2} {9:X2} {10:X2} {11:X2} {12:X2} CRC 0x{13:X2}{14:X2}, Calculated CRC: 0x{15:X2}{16:X2}",
|
||||
lba, retries + 1, sense, subBuf[0], subBuf[1], subBuf[2], subBuf[3],
|
||||
subBuf[4], subBuf[5], subBuf[6], subBuf[7], subBuf[8], subBuf[9],
|
||||
subBuf[10], subBuf[11], crc[0], crc[1]);
|
||||
"LBA: {0}, Try {1}, Sense {2}, Q: {3:X2} {4:X2} {5:X2} {6:X2} {7:X2} {8:X2} {9:X2} {10:X2} {11:X2} {12:X2} CRC 0x{13:X2}{14:X2}, Calculated CRC: 0x{15:X2}{16:X2}",
|
||||
lba, retries + 1, sense, subBuf[0], subBuf[1], subBuf[2], subBuf[3],
|
||||
subBuf[4], subBuf[5], subBuf[6], subBuf[7], subBuf[8], subBuf[9],
|
||||
subBuf[10], subBuf[11], crc[0], crc[1]);
|
||||
|
||||
crcOk = crc[0] == subBuf[10] && crc[1] == subBuf[11];
|
||||
|
||||
@@ -262,10 +262,10 @@ namespace Aaru.Core.Devices.Dumping
|
||||
if(crcOk)
|
||||
{
|
||||
AaruConsole.DebugWriteLine("Pregap calculator",
|
||||
"LBA: {0}, Try {1}, Sense {2}, Q (FIXED): {3:X2} {4:X2} {5:X2} {6:X2} {7:X2} {8:X2} {9:X2} {10:X2} {11:X2} {12:X2} CRC 0x{13:X2}{14:X2}, Calculated CRC: 0x{15:X2}{16:X2}",
|
||||
lba, retries + 1, sense, subBuf[0], subBuf[1], subBuf[2],
|
||||
subBuf[3], subBuf[4], subBuf[5], subBuf[6], subBuf[7], subBuf[8],
|
||||
subBuf[9], subBuf[10], subBuf[11], crc[0], crc[1]);
|
||||
"LBA: {0}, Try {1}, Sense {2}, Q (FIXED): {3:X2} {4:X2} {5:X2} {6:X2} {7:X2} {8:X2} {9:X2} {10:X2} {11:X2} {12:X2} CRC 0x{13:X2}{14:X2}, Calculated CRC: 0x{15:X2}{16:X2}",
|
||||
lba, retries + 1, sense, subBuf[0], subBuf[1], subBuf[2],
|
||||
subBuf[3], subBuf[4], subBuf[5], subBuf[6], subBuf[7], subBuf[8],
|
||||
subBuf[9], subBuf[10], subBuf[11], crc[0], crc[1]);
|
||||
}
|
||||
else
|
||||
continue;
|
||||
@@ -317,10 +317,10 @@ namespace Aaru.Core.Devices.Dumping
|
||||
CRC16CCITTContext.Data(subBuf, 10, out crc);
|
||||
|
||||
AaruConsole.DebugWriteLine("Pregap calculator",
|
||||
"LBA: {0}, Try {1}, Sense {2}, Q: {3:X2} {4:X2} {5:X2} {6:X2} {7:X2} {8:X2} {9:X2} {10:X2} {11:X2} {12:X2} CRC 0x{13:X2}{14:X2}, Calculated CRC: 0x{15:X2}{16:X2}",
|
||||
lba, retries + 1, sense, subBuf[0], subBuf[1], subBuf[2], subBuf[3],
|
||||
subBuf[4], subBuf[5], subBuf[6], subBuf[7], subBuf[8], subBuf[9],
|
||||
subBuf[10], subBuf[11], crc[0], crc[1]);
|
||||
"LBA: {0}, Try {1}, Sense {2}, Q: {3:X2} {4:X2} {5:X2} {6:X2} {7:X2} {8:X2} {9:X2} {10:X2} {11:X2} {12:X2} CRC 0x{13:X2}{14:X2}, Calculated CRC: 0x{15:X2}{16:X2}",
|
||||
lba, retries + 1, sense, subBuf[0], subBuf[1], subBuf[2], subBuf[3],
|
||||
subBuf[4], subBuf[5], subBuf[6], subBuf[7], subBuf[8], subBuf[9],
|
||||
subBuf[10], subBuf[11], crc[0], crc[1]);
|
||||
|
||||
crcOk = crc[0] == subBuf[10] && crc[1] == subBuf[11];
|
||||
|
||||
@@ -358,10 +358,11 @@ namespace Aaru.Core.Devices.Dumping
|
||||
if(crcOk)
|
||||
{
|
||||
AaruConsole.DebugWriteLine("Pregap calculator",
|
||||
"LBA: {0}, Try {1}, Sense {2}, Q (FIXED): {3:X2} {4:X2} {5:X2} {6:X2} {7:X2} {8:X2} {9:X2} {10:X2} {11:X2} {12:X2} CRC 0x{13:X2}{14:X2}, Calculated CRC: 0x{15:X2}{16:X2}",
|
||||
lba, retries + 1, sense, subBuf[0], subBuf[1], subBuf[2],
|
||||
subBuf[3], subBuf[4], subBuf[5], subBuf[6], subBuf[7],
|
||||
subBuf[8], subBuf[9], subBuf[10], subBuf[11], crc[0], crc[1]);
|
||||
"LBA: {0}, Try {1}, Sense {2}, Q (FIXED): {3:X2} {4:X2} {5:X2} {6:X2} {7:X2} {8:X2} {9:X2} {10:X2} {11:X2} {12:X2} CRC 0x{13:X2}{14:X2}, Calculated CRC: 0x{15:X2}{16:X2}",
|
||||
lba, retries + 1, sense, subBuf[0], subBuf[1], subBuf[2],
|
||||
subBuf[3], subBuf[4], subBuf[5], subBuf[6], subBuf[7],
|
||||
subBuf[8], subBuf[9], subBuf[10], subBuf[11], crc[0],
|
||||
crc[1]);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -387,18 +388,18 @@ namespace Aaru.Core.Devices.Dumping
|
||||
track.TrackType == TrackType.Audio))
|
||||
{
|
||||
dumpLog?.
|
||||
WriteLine($"Could not read subchannel for this track, supposing 150 sectors.");
|
||||
WriteLine("Could not read subchannel for this track, supposing 150 sectors.");
|
||||
|
||||
updateStatus?.
|
||||
Invoke($"Could not read subchannel for this track, supposing 150 sectors.");
|
||||
Invoke("Could not read subchannel for this track, supposing 150 sectors.");
|
||||
}
|
||||
else
|
||||
{
|
||||
dumpLog?.
|
||||
WriteLine($"Could not read subchannel for this track, supposing 0 sectors.");
|
||||
WriteLine("Could not read subchannel for this track, supposing 0 sectors.");
|
||||
|
||||
updateStatus?.
|
||||
Invoke($"Could not read subchannel for this track, supposing 0 sectors.");
|
||||
Invoke("Could not read subchannel for this track, supposing 0 sectors.");
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -501,7 +502,7 @@ namespace Aaru.Core.Devices.Dumping
|
||||
if(diff != 0)
|
||||
{
|
||||
AaruConsole.DebugWriteLine("Pregap calculator", "Invalid Q position for LBA {0}, got {1}", lba,
|
||||
posQ);
|
||||
posQ);
|
||||
|
||||
inexactPositioning = true;
|
||||
}
|
||||
@@ -513,7 +514,7 @@ namespace Aaru.Core.Devices.Dumping
|
||||
if(crcOk || pregapQ - pregaps[track.TrackSequence] < 10)
|
||||
{
|
||||
AaruConsole.DebugWriteLine("Pregap calculator", "Pregap for track {0}: {1}",
|
||||
track.TrackSequence, pregapQ);
|
||||
track.TrackSequence, pregapQ);
|
||||
|
||||
pregaps[track.TrackSequence] = pregapQ;
|
||||
}
|
||||
@@ -546,7 +547,7 @@ namespace Aaru.Core.Devices.Dumping
|
||||
}
|
||||
}
|
||||
|
||||
static bool GetSectorForPregapRaw(Device dev, uint lba, Aaru.Database.Models.Device dbDev, out byte[] subBuf)
|
||||
static bool GetSectorForPregapRaw(Device dev, uint lba, Database.Models.Device dbDev, out byte[] subBuf)
|
||||
{
|
||||
byte[] cmdBuf;
|
||||
bool sense;
|
||||
@@ -601,7 +602,7 @@ namespace Aaru.Core.Devices.Dumping
|
||||
return sense;
|
||||
}
|
||||
|
||||
static bool GetSectorForPregapQ16(Device dev, uint lba, Aaru.Database.Models.Device dbDev, out byte[] subBuf)
|
||||
static bool GetSectorForPregapQ16(Device dev, uint lba, Database.Models.Device dbDev, out byte[] subBuf)
|
||||
{
|
||||
byte[] cmdBuf;
|
||||
bool sense;
|
||||
|
||||
@@ -46,9 +46,9 @@ namespace Aaru.Core.Devices.Dumping
|
||||
dumpLog?.WriteLine("Checking if drive supports full raw subchannel reading...");
|
||||
updateStatus?.Invoke("Checking if drive supports full raw subchannel reading...");
|
||||
|
||||
return!dev.ReadCd(out _, out _, 0, 2352 + 96, 1, MmcSectorTypes.AllTypes, false, false, true,
|
||||
MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.Raw, dev.Timeout,
|
||||
out _);
|
||||
return !dev.ReadCd(out _, out _, 0, 2352 + 96, 1, MmcSectorTypes.AllTypes, false, false, true,
|
||||
MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.Raw,
|
||||
dev.Timeout, out _);
|
||||
}
|
||||
|
||||
public static bool SupportsPqSubchannel(Device dev, DumpLog dumpLog, UpdateStatusHandler updateStatus)
|
||||
@@ -56,9 +56,9 @@ namespace Aaru.Core.Devices.Dumping
|
||||
dumpLog?.WriteLine("Checking if drive supports PQ subchannel reading...");
|
||||
updateStatus?.Invoke("Checking if drive supports PQ subchannel reading...");
|
||||
|
||||
return!dev.ReadCd(out _, out _, 0, 2352 + 16, 1, MmcSectorTypes.AllTypes, false, false, true,
|
||||
MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.Q16, dev.Timeout,
|
||||
out _);
|
||||
return !dev.ReadCd(out _, out _, 0, 2352 + 16, 1, MmcSectorTypes.AllTypes, false, false, true,
|
||||
MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.Q16,
|
||||
dev.Timeout, out _);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,10 +33,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Decoders.CD;
|
||||
using Aaru.Devices;
|
||||
|
||||
|
||||
@@ -4,10 +4,10 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Metadata;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Database;
|
||||
using Aaru.Devices;
|
||||
using Schemas;
|
||||
@@ -42,8 +42,8 @@ namespace Aaru.Core.Devices.Dumping
|
||||
readonly DumpSubchannel _subchannel;
|
||||
readonly bool _trim;
|
||||
bool _aborted;
|
||||
AaruContext _ctx; // Master database context
|
||||
Aaru.Database.Models.Device _dbDev; // Device database entry
|
||||
AaruContext _ctx; // Master database context
|
||||
Database.Models.Device _dbDev; // Device database entry
|
||||
bool _dumpFirstTrackPregap;
|
||||
bool _fixOffset;
|
||||
uint _maximumReadable; // Maximum number of sectors drive can read at once
|
||||
@@ -113,7 +113,7 @@ namespace Aaru.Core.Devices.Dumping
|
||||
public void Start()
|
||||
{
|
||||
// Open master database
|
||||
_ctx = AaruContext.Create(Aaru.Settings.Settings.MasterDbPath);
|
||||
_ctx = AaruContext.Create(Settings.Settings.MasterDbPath);
|
||||
|
||||
// Search for device in master database
|
||||
_dbDev = _ctx.Devices.FirstOrDefault(d => d.Manufacturer == _dev.Manufacturer && d.Model == _dev.Model &&
|
||||
|
||||
@@ -30,17 +30,12 @@
|
||||
// Copyright © 2011-2020 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
|
||||
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace Aaru.Core.Devices.Dumping
|
||||
{
|
||||
public partial class Dump
|
||||
{
|
||||
public void NVMe()
|
||||
{
|
||||
StoppingErrorMessage?.Invoke("NVMe devices not yet supported.");
|
||||
}
|
||||
public void NVMe() => StoppingErrorMessage?.Invoke("NVMe devices not yet supported.");
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,6 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Extents;
|
||||
@@ -13,6 +12,7 @@ using Aaru.CommonTypes.Metadata;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.CommonTypes.Structs.Devices.SCSI;
|
||||
using Aaru.Console;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Decoders.SCSI;
|
||||
using Aaru.Devices;
|
||||
using Schemas;
|
||||
@@ -622,8 +622,7 @@ namespace Aaru.Core.Devices.Dumping
|
||||
|
||||
var metadata = new CommonTypes.Structs.ImageInfo
|
||||
{
|
||||
Application = "Aaru", ApplicationVersion = Version.GetVersion(),
|
||||
MediaPartNumber = mediaPartNumber
|
||||
Application = "Aaru", ApplicationVersion = Version.GetVersion(), MediaPartNumber = mediaPartNumber
|
||||
};
|
||||
|
||||
if(!_outputPlugin.SetMetadata(metadata))
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace Aaru.Core.Devices.Dumping
|
||||
if(oldTry.Software == null)
|
||||
throw new InvalidOperationException("Found corrupt resume file, cannot continue...");
|
||||
|
||||
if(oldTry.Software.Name != "Aaru" ||
|
||||
if(oldTry.Software.Name != "Aaru" ||
|
||||
oldTry.Software.OperatingSystem != platform.ToString() ||
|
||||
oldTry.Software.Version != Version.GetVersion())
|
||||
continue;
|
||||
|
||||
@@ -35,7 +35,6 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Extents;
|
||||
@@ -44,6 +43,7 @@ using Aaru.CommonTypes.Metadata;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.CommonTypes.Structs.Devices.SCSI;
|
||||
using Aaru.Console;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Decoders.SCSI;
|
||||
using Aaru.Devices;
|
||||
using Schemas;
|
||||
|
||||
@@ -36,13 +36,13 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Xml.Serialization;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Extents;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Metadata;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Decoders.SCSI;
|
||||
using Aaru.Decoders.SCSI.SSC;
|
||||
using Aaru.Devices;
|
||||
|
||||
@@ -35,12 +35,12 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Extents;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Metadata;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Decoders.MMC;
|
||||
using Schemas;
|
||||
using MediaType = Aaru.CommonTypes.MediaType;
|
||||
@@ -95,7 +95,7 @@ namespace Aaru.Core.Devices.Dumping
|
||||
|
||||
if(!sense)
|
||||
{
|
||||
ExtendedCSD ecsdDecoded = Aaru.Decoders.MMC.Decoders.DecodeExtendedCSD(ecsd);
|
||||
ExtendedCSD ecsdDecoded = Decoders.MMC.Decoders.DecodeExtendedCSD(ecsd);
|
||||
blocksToRead = ecsdDecoded.OptimalReadSize;
|
||||
blocks = ecsdDecoded.SectorCount;
|
||||
blockSize = (uint)(ecsdDecoded.SectorSize == 1 ? 4096 : 512);
|
||||
@@ -120,7 +120,7 @@ namespace Aaru.Core.Devices.Dumping
|
||||
{
|
||||
if(blocks == 0)
|
||||
{
|
||||
CSD csdDecoded = Aaru.Decoders.MMC.Decoders.DecodeCSD(csd);
|
||||
CSD csdDecoded = Decoders.MMC.Decoders.DecodeCSD(csd);
|
||||
blocks = (ulong)((csdDecoded.Size + 1) * Math.Pow(2, csdDecoded.SizeMultiplier + 2));
|
||||
blockSize = (uint)Math.Pow(2, csdDecoded.ReadBlockLength);
|
||||
}
|
||||
@@ -150,7 +150,7 @@ namespace Aaru.Core.Devices.Dumping
|
||||
|
||||
if(!sense)
|
||||
{
|
||||
Aaru.Decoders.SecureDigital.CSD csdDecoded = Aaru.Decoders.SecureDigital.Decoders.DecodeCSD(csd);
|
||||
Decoders.SecureDigital.CSD csdDecoded = Decoders.SecureDigital.Decoders.DecodeCSD(csd);
|
||||
|
||||
blocks = (ulong)(csdDecoded.Structure == 0
|
||||
? (csdDecoded.Size + 1) * Math.Pow(2, csdDecoded.SizeMultiplier + 2)
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Extents;
|
||||
@@ -42,6 +41,7 @@ using Aaru.CommonTypes.Interop;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.CommonTypes.Structs.Devices.SCSI;
|
||||
using Aaru.Console;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Decoders.DVD;
|
||||
using Aaru.Decoders.SCSI;
|
||||
using Aaru.Decoders.Xbox;
|
||||
|
||||
@@ -82,18 +82,18 @@ namespace Aaru.Core.Devices.Info
|
||||
AaruConsole.DebugWriteLine("Device-Info command", "ERROR = 0x{0:X2}", errorRegisters.Error);
|
||||
|
||||
AaruConsole.DebugWriteLine("Device-Info command", "NSECTOR = 0x{0:X2}",
|
||||
errorRegisters.SectorCount);
|
||||
errorRegisters.SectorCount);
|
||||
|
||||
AaruConsole.DebugWriteLine("Device-Info command", "SECTOR = 0x{0:X2}", errorRegisters.Sector);
|
||||
|
||||
AaruConsole.DebugWriteLine("Device-Info command", "CYLHIGH = 0x{0:X2}",
|
||||
errorRegisters.CylinderHigh);
|
||||
errorRegisters.CylinderHigh);
|
||||
|
||||
AaruConsole.DebugWriteLine("Device-Info command", "CYLLOW = 0x{0:X2}",
|
||||
errorRegisters.CylinderLow);
|
||||
errorRegisters.CylinderLow);
|
||||
|
||||
AaruConsole.DebugWriteLine("Device-Info command", "DEVICE = 0x{0:X2}",
|
||||
errorRegisters.DeviceHead);
|
||||
errorRegisters.DeviceHead);
|
||||
|
||||
AaruConsole.DebugWriteLine("Device-Info command", "Error code = {0}", dev.LastError);
|
||||
|
||||
@@ -128,18 +128,18 @@ namespace Aaru.Core.Devices.Info
|
||||
AaruConsole.DebugWriteLine("Device-Info command", "ERROR = 0x{0:X2}", errorRegisters.Error);
|
||||
|
||||
AaruConsole.DebugWriteLine("Device-Info command", "NSECTOR = 0x{0:X2}",
|
||||
errorRegisters.SectorCount);
|
||||
errorRegisters.SectorCount);
|
||||
|
||||
AaruConsole.DebugWriteLine("Device-Info command", "SECTOR = 0x{0:X2}", errorRegisters.Sector);
|
||||
|
||||
AaruConsole.DebugWriteLine("Device-Info command", "CYLHIGH = 0x{0:X2}",
|
||||
errorRegisters.CylinderHigh);
|
||||
errorRegisters.CylinderHigh);
|
||||
|
||||
AaruConsole.DebugWriteLine("Device-Info command", "CYLLOW = 0x{0:X2}",
|
||||
errorRegisters.CylinderLow);
|
||||
errorRegisters.CylinderLow);
|
||||
|
||||
AaruConsole.DebugWriteLine("Device-Info command", "DEVICE = 0x{0:X2}",
|
||||
errorRegisters.DeviceHead);
|
||||
errorRegisters.DeviceHead);
|
||||
|
||||
AaruConsole.DebugWriteLine("Device-Info command", "Error code = {0}", dev.LastError);
|
||||
|
||||
@@ -308,20 +308,20 @@ namespace Aaru.Core.Devices.Info
|
||||
|
||||
switch(dev.Model)
|
||||
{
|
||||
case"DVDR PX-708A":
|
||||
case"DVDR PX-708A2":
|
||||
case"DVDR PX-712A":
|
||||
case "DVDR PX-708A":
|
||||
case "DVDR PX-708A2":
|
||||
case "DVDR PX-712A":
|
||||
plxtDvd = true;
|
||||
|
||||
plxtSense = dev.PlextorReadEeprom(out plxtBuf, out senseBuf, dev.Timeout,
|
||||
out _);
|
||||
|
||||
break;
|
||||
case"DVDR PX-714A":
|
||||
case"DVDR PX-716A":
|
||||
case"DVDR PX-716AL":
|
||||
case"DVDR PX-755A":
|
||||
case"DVDR PX-760A":
|
||||
case "DVDR PX-714A":
|
||||
case "DVDR PX-716A":
|
||||
case "DVDR PX-716AL":
|
||||
case "DVDR PX-755A":
|
||||
case "DVDR PX-760A":
|
||||
{
|
||||
plxtBuf = new byte[256 * 4];
|
||||
|
||||
@@ -514,22 +514,22 @@ namespace Aaru.Core.Devices.Info
|
||||
|
||||
if(sense)
|
||||
AaruConsole.ErrorWriteLine("REPORT DENSITY SUPPORT:\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
{
|
||||
DensitySupport = seqBuf;
|
||||
DensitySupportHeader = Aaru.Decoders.SCSI.SSC.DensitySupport.DecodeDensity(seqBuf);
|
||||
DensitySupportHeader = Decoders.SCSI.SSC.DensitySupport.DecodeDensity(seqBuf);
|
||||
}
|
||||
|
||||
sense = dev.ReportDensitySupport(out seqBuf, out senseBuf, true, false, dev.Timeout, out _);
|
||||
|
||||
if(sense)
|
||||
AaruConsole.ErrorWriteLine("REPORT DENSITY SUPPORT (MEDIUM):\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
{
|
||||
MediumDensitySupport = seqBuf;
|
||||
MediaTypeSupportHeader = Aaru.Decoders.SCSI.SSC.DensitySupport.DecodeMediumType(seqBuf);
|
||||
MediaTypeSupportHeader = Decoders.SCSI.SSC.DensitySupport.DecodeMediumType(seqBuf);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace Aaru.Core.Devices
|
||||
(uint, byte, byte) GetDeviceChs()
|
||||
{
|
||||
if(dev.Type != DeviceType.ATA)
|
||||
return(0, 0, 0);
|
||||
return (0, 0, 0);
|
||||
|
||||
if(ataId.CurrentCylinders > 0 &&
|
||||
ataId.CurrentHeads > 0 &&
|
||||
@@ -78,14 +78,14 @@ namespace Aaru.Core.Devices
|
||||
ataId.Cylinders <= 0 ||
|
||||
ataId.Heads <= 0 ||
|
||||
ataId.SectorsPerTrack <= 0)
|
||||
return(Cylinders, Heads, Sectors);
|
||||
return (Cylinders, Heads, Sectors);
|
||||
|
||||
Cylinders = ataId.Cylinders;
|
||||
Heads = (byte)ataId.Heads;
|
||||
Sectors = (byte)ataId.SectorsPerTrack;
|
||||
Blocks = (ulong)(Cylinders * Heads * Sectors);
|
||||
|
||||
return(Cylinders, Heads, Sectors);
|
||||
return (Cylinders, Heads, Sectors);
|
||||
}
|
||||
|
||||
ulong AtaGetBlocks()
|
||||
@@ -333,8 +333,7 @@ namespace Aaru.Core.Devices
|
||||
}
|
||||
else if(ataReadDmaRetryLba)
|
||||
{
|
||||
sense = dev.ReadDma(out buffer, out errorLba, true, (uint)block, (byte)count, timeout,
|
||||
out duration);
|
||||
sense = dev.ReadDma(out buffer, out errorLba, true, (uint)block, (byte)count, timeout, out duration);
|
||||
|
||||
error = !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && buffer.Length > 0);
|
||||
status = errorLba.Status;
|
||||
@@ -342,8 +341,7 @@ namespace Aaru.Core.Devices
|
||||
}
|
||||
else if(ataReadDmaLba)
|
||||
{
|
||||
sense = dev.ReadDma(out buffer, out errorLba, false, (uint)block, (byte)count, timeout,
|
||||
out duration);
|
||||
sense = dev.ReadDma(out buffer, out errorLba, false, (uint)block, (byte)count, timeout, out duration);
|
||||
|
||||
error = !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0 && buffer.Length > 0);
|
||||
status = errorLba.Status;
|
||||
@@ -381,8 +379,7 @@ namespace Aaru.Core.Devices
|
||||
|
||||
if(ataReadDmaRetry)
|
||||
{
|
||||
sense = dev.ReadDma(out buffer, out errorChs, true, cylinder, head, sectir, 1, timeout,
|
||||
out duration);
|
||||
sense = dev.ReadDma(out buffer, out errorChs, true, cylinder, head, sectir, 1, timeout, out duration);
|
||||
|
||||
error = !(!sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && buffer.Length > 0);
|
||||
status = errorChs.Status;
|
||||
@@ -390,8 +387,7 @@ namespace Aaru.Core.Devices
|
||||
}
|
||||
else if(ataReadDma)
|
||||
{
|
||||
sense = dev.ReadDma(out buffer, out errorChs, false, cylinder, head, sectir, 1, timeout,
|
||||
out duration);
|
||||
sense = dev.ReadDma(out buffer, out errorChs, false, cylinder, head, sectir, 1, timeout, out duration);
|
||||
|
||||
error = !(!sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0 && buffer.Length > 0);
|
||||
status = errorChs.Status;
|
||||
@@ -422,14 +418,14 @@ namespace Aaru.Core.Devices
|
||||
{
|
||||
bool sense = dev.Seek(out AtaErrorRegistersLba28 errorLba, (uint)block, timeout, out duration);
|
||||
|
||||
return!(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0);
|
||||
return !(!sense && (errorLba.Status & 0x27) == 0 && errorLba.Error == 0);
|
||||
}
|
||||
|
||||
bool AtaSeekChs(ushort cylinder, byte head, byte sector, out double duration)
|
||||
{
|
||||
bool sense = dev.Seek(out AtaErrorRegistersChs errorChs, cylinder, head, sector, timeout, out duration);
|
||||
|
||||
return!(!sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0);
|
||||
return !(!sense && (errorChs.Status & 0x27) == 0 && errorChs.Error == 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -376,11 +376,11 @@ namespace Aaru.Core.Devices
|
||||
{
|
||||
switch(dev.Manufacturer)
|
||||
{
|
||||
case"HL-DT-ST":
|
||||
case "HL-DT-ST":
|
||||
hldtstReadRaw = !dev.HlDtStReadRawDvd(out _, out senseBuf, 0, 1, timeout, out _);
|
||||
|
||||
break;
|
||||
case"PLEXTOR":
|
||||
case "PLEXTOR":
|
||||
plextorReadRaw = !dev.PlextorReadRawDvd(out _, out senseBuf, 0, 1, timeout, out _);
|
||||
|
||||
break;
|
||||
|
||||
@@ -183,8 +183,8 @@ namespace Aaru.Core.Devices.Report
|
||||
readBuf.Length > 0;
|
||||
|
||||
AaruConsole.DebugWriteLine("ATA Report",
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
||||
errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
||||
errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
|
||||
mediaTest.ReadSectorsData = readBuf;
|
||||
|
||||
@@ -195,8 +195,8 @@ namespace Aaru.Core.Devices.Report
|
||||
readBuf.Length > 0;
|
||||
|
||||
AaruConsole.DebugWriteLine("ATA Report",
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
||||
errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
||||
errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
|
||||
mediaTest.ReadSectorsRetryData = readBuf;
|
||||
|
||||
@@ -207,8 +207,8 @@ namespace Aaru.Core.Devices.Report
|
||||
readBuf.Length > 0;
|
||||
|
||||
AaruConsole.DebugWriteLine("ATA Report",
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
||||
errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
||||
errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
|
||||
mediaTest.ReadDmaData = readBuf;
|
||||
|
||||
@@ -219,8 +219,8 @@ namespace Aaru.Core.Devices.Report
|
||||
readBuf.Length > 0;
|
||||
|
||||
AaruConsole.DebugWriteLine("ATA Report",
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
||||
errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
||||
errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
|
||||
mediaTest.ReadDmaRetryData = readBuf;
|
||||
|
||||
@@ -229,7 +229,7 @@ namespace Aaru.Core.Devices.Report
|
||||
mediaTest.SupportsSeek = !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0;
|
||||
|
||||
AaruConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}", sense,
|
||||
errorChs.Status, errorChs.Error);
|
||||
errorChs.Status, errorChs.Error);
|
||||
|
||||
AaruConsole.WriteLine("Trying READ SECTOR(S) in LBA mode...");
|
||||
sense = _dev.Read(out readBuf, out AtaErrorRegistersLba28 errorLba, false, 0, 1, _dev.Timeout, out _);
|
||||
@@ -238,8 +238,8 @@ namespace Aaru.Core.Devices.Report
|
||||
readBuf.Length > 0;
|
||||
|
||||
AaruConsole.DebugWriteLine("ATA Report",
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
||||
errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
||||
errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
|
||||
mediaTest.ReadLbaData = readBuf;
|
||||
|
||||
@@ -250,8 +250,8 @@ namespace Aaru.Core.Devices.Report
|
||||
readBuf.Length > 0;
|
||||
|
||||
AaruConsole.DebugWriteLine("ATA Report",
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
||||
errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
||||
errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
|
||||
mediaTest.ReadRetryLbaData = readBuf;
|
||||
|
||||
@@ -262,8 +262,8 @@ namespace Aaru.Core.Devices.Report
|
||||
readBuf.Length > 0;
|
||||
|
||||
AaruConsole.DebugWriteLine("ATA Report",
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
||||
errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
||||
errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
|
||||
mediaTest.ReadDmaLbaData = readBuf;
|
||||
|
||||
@@ -274,8 +274,8 @@ namespace Aaru.Core.Devices.Report
|
||||
readBuf.Length > 0;
|
||||
|
||||
AaruConsole.DebugWriteLine("ATA Report",
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
||||
errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
||||
errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
|
||||
mediaTest.ReadDmaRetryLbaData = readBuf;
|
||||
|
||||
@@ -284,7 +284,7 @@ namespace Aaru.Core.Devices.Report
|
||||
mediaTest.SupportsSeekLba = !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0;
|
||||
|
||||
AaruConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}", sense,
|
||||
errorChs.Status, errorChs.Error);
|
||||
errorChs.Status, errorChs.Error);
|
||||
|
||||
AaruConsole.WriteLine("Trying READ SECTOR(S) in LBA48 mode...");
|
||||
sense = _dev.Read(out readBuf, out AtaErrorRegistersLba48 errorLba48, 0, 1, _dev.Timeout, out _);
|
||||
@@ -293,8 +293,8 @@ namespace Aaru.Core.Devices.Report
|
||||
readBuf.Length > 0;
|
||||
|
||||
AaruConsole.DebugWriteLine("ATA Report",
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
||||
errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
||||
errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
|
||||
mediaTest.ReadLba48Data = readBuf;
|
||||
|
||||
@@ -305,8 +305,8 @@ namespace Aaru.Core.Devices.Report
|
||||
errorLba48.Error == 0 && readBuf.Length > 0;
|
||||
|
||||
AaruConsole.DebugWriteLine("ATA Report",
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
||||
errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
||||
errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
|
||||
mediaTest.ReadDmaLba48Data = readBuf;
|
||||
|
||||
@@ -340,8 +340,8 @@ namespace Aaru.Core.Devices.Report
|
||||
BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
|
||||
|
||||
AaruConsole.DebugWriteLine("ATA Report",
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
||||
errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
||||
errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
|
||||
mediaTest.ReadLongData = readBuf;
|
||||
|
||||
@@ -356,8 +356,8 @@ namespace Aaru.Core.Devices.Report
|
||||
checkCorrectRead;
|
||||
|
||||
AaruConsole.DebugWriteLine("ATA Report",
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
||||
errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
||||
errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
|
||||
mediaTest.ReadLongRetryData = readBuf;
|
||||
|
||||
@@ -371,8 +371,8 @@ namespace Aaru.Core.Devices.Report
|
||||
BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
|
||||
|
||||
AaruConsole.DebugWriteLine("ATA Report",
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
||||
errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
||||
errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
|
||||
mediaTest.ReadLongLbaData = readBuf;
|
||||
|
||||
@@ -386,8 +386,8 @@ namespace Aaru.Core.Devices.Report
|
||||
BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
|
||||
|
||||
AaruConsole.DebugWriteLine("ATA Report",
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
||||
errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
"Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}", sense,
|
||||
errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
|
||||
mediaTest.ReadLongRetryLbaData = readBuf;
|
||||
}
|
||||
@@ -523,7 +523,7 @@ namespace Aaru.Core.Devices.Report
|
||||
readBuf.Length > 0;
|
||||
|
||||
AaruConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
|
||||
sense, errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
sense, errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
|
||||
capabilities.ReadSectorsData = readBuf;
|
||||
|
||||
@@ -534,7 +534,7 @@ namespace Aaru.Core.Devices.Report
|
||||
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0;
|
||||
|
||||
AaruConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
|
||||
sense, errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
sense, errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
|
||||
capabilities.ReadSectorsRetryData = readBuf;
|
||||
|
||||
@@ -545,7 +545,7 @@ namespace Aaru.Core.Devices.Report
|
||||
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0;
|
||||
|
||||
AaruConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
|
||||
sense, errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
sense, errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
|
||||
capabilities.ReadDmaData = readBuf;
|
||||
|
||||
@@ -556,7 +556,7 @@ namespace Aaru.Core.Devices.Report
|
||||
readBuf.Length > 0;
|
||||
|
||||
AaruConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
|
||||
sense, errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
sense, errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
|
||||
capabilities.ReadDmaRetryData = readBuf;
|
||||
|
||||
@@ -565,7 +565,7 @@ namespace Aaru.Core.Devices.Report
|
||||
capabilities.SupportsSeek = !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0;
|
||||
|
||||
AaruConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}", sense,
|
||||
errorChs.Status, errorChs.Error);
|
||||
errorChs.Status, errorChs.Error);
|
||||
|
||||
AaruConsole.WriteLine("Trying READ SECTOR(S) in LBA mode...");
|
||||
sense = _dev.Read(out readBuf, out AtaErrorRegistersLba28 errorLba, false, 0, 1, _dev.Timeout, out _);
|
||||
@@ -574,7 +574,7 @@ namespace Aaru.Core.Devices.Report
|
||||
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0;
|
||||
|
||||
AaruConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
|
||||
sense, errorLba.Status, errorLba.Error, readBuf.Length);
|
||||
sense, errorLba.Status, errorLba.Error, readBuf.Length);
|
||||
|
||||
capabilities.ReadLbaData = readBuf;
|
||||
|
||||
@@ -585,7 +585,7 @@ namespace Aaru.Core.Devices.Report
|
||||
readBuf.Length > 0;
|
||||
|
||||
AaruConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
|
||||
sense, errorLba.Status, errorLba.Error, readBuf.Length);
|
||||
sense, errorLba.Status, errorLba.Error, readBuf.Length);
|
||||
|
||||
capabilities.ReadRetryLbaData = readBuf;
|
||||
|
||||
@@ -596,7 +596,7 @@ namespace Aaru.Core.Devices.Report
|
||||
readBuf.Length > 0;
|
||||
|
||||
AaruConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
|
||||
sense, errorLba.Status, errorLba.Error, readBuf.Length);
|
||||
sense, errorLba.Status, errorLba.Error, readBuf.Length);
|
||||
|
||||
capabilities.ReadDmaLbaData = readBuf;
|
||||
|
||||
@@ -607,7 +607,7 @@ namespace Aaru.Core.Devices.Report
|
||||
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0;
|
||||
|
||||
AaruConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
|
||||
sense, errorLba.Status, errorLba.Error, readBuf.Length);
|
||||
sense, errorLba.Status, errorLba.Error, readBuf.Length);
|
||||
|
||||
capabilities.ReadDmaRetryLbaData = readBuf;
|
||||
|
||||
@@ -616,7 +616,7 @@ namespace Aaru.Core.Devices.Report
|
||||
capabilities.SupportsSeekLba = !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0;
|
||||
|
||||
AaruConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}", sense,
|
||||
errorLba.Status, errorLba.Error);
|
||||
errorLba.Status, errorLba.Error);
|
||||
|
||||
AaruConsole.WriteLine("Trying READ SECTOR(S) in LBA48 mode...");
|
||||
sense = _dev.Read(out readBuf, out AtaErrorRegistersLba48 errorLba48, 0, 1, _dev.Timeout, out _);
|
||||
@@ -625,7 +625,7 @@ namespace Aaru.Core.Devices.Report
|
||||
readBuf.Length > 0;
|
||||
|
||||
AaruConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
|
||||
sense, errorLba48.Status, errorLba48.Error, readBuf.Length);
|
||||
sense, errorLba48.Status, errorLba48.Error, readBuf.Length);
|
||||
|
||||
capabilities.ReadLba48Data = readBuf;
|
||||
|
||||
@@ -636,7 +636,7 @@ namespace Aaru.Core.Devices.Report
|
||||
readBuf.Length > 0;
|
||||
|
||||
AaruConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
|
||||
sense, errorLba48.Status, errorLba48.Error, readBuf.Length);
|
||||
sense, errorLba48.Status, errorLba48.Error, readBuf.Length);
|
||||
|
||||
capabilities.ReadDmaLba48Data = readBuf;
|
||||
|
||||
@@ -671,7 +671,7 @@ namespace Aaru.Core.Devices.Report
|
||||
BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
|
||||
|
||||
AaruConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
|
||||
sense, errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
sense, errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
|
||||
capabilities.ReadLongData = readBuf;
|
||||
|
||||
@@ -686,7 +686,7 @@ namespace Aaru.Core.Devices.Report
|
||||
checkCorrectRead;
|
||||
|
||||
AaruConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
|
||||
sense, errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
sense, errorChs.Status, errorChs.Error, readBuf.Length);
|
||||
|
||||
capabilities.ReadLongRetryData = readBuf;
|
||||
|
||||
@@ -700,7 +700,7 @@ namespace Aaru.Core.Devices.Report
|
||||
BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
|
||||
|
||||
AaruConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
|
||||
sense, errorLba.Status, errorLba.Error, readBuf.Length);
|
||||
sense, errorLba.Status, errorLba.Error, readBuf.Length);
|
||||
|
||||
capabilities.ReadLongLbaData = readBuf;
|
||||
|
||||
@@ -715,7 +715,7 @@ namespace Aaru.Core.Devices.Report
|
||||
checkCorrectRead;
|
||||
|
||||
AaruConsole.DebugWriteLine("ATA Report", "Sense = {0}, Status = 0x{1:X2}, Error = 0x{2:X2}, Length = {3}",
|
||||
sense, errorLba.Status, errorLba.Error, readBuf.Length);
|
||||
sense, errorLba.Status, errorLba.Error, readBuf.Length);
|
||||
|
||||
capabilities.ReadLongRetryLbaData = readBuf;
|
||||
|
||||
|
||||
@@ -718,8 +718,8 @@ namespace Aaru.Core.Devices.Report
|
||||
|
||||
switch(mediaType)
|
||||
{
|
||||
case"DVD-ROM":
|
||||
case"HD DVD-ROM":
|
||||
case "DVD-ROM":
|
||||
case "HD DVD-ROM":
|
||||
AaruConsole.WriteLine("Querying DVD BCA...");
|
||||
|
||||
mediaTest.CanReadBCA = !_dev.ReadDiscStructure(out buffer, out senseBuffer,
|
||||
@@ -743,8 +743,8 @@ namespace Aaru.Core.Devices.Report
|
||||
mediaTest.DvdAacsData = buffer;
|
||||
|
||||
break;
|
||||
case"Nintendo GameCube game":
|
||||
case"Nintendo Wii game":
|
||||
case "Nintendo GameCube game":
|
||||
case "Nintendo Wii game":
|
||||
AaruConsole.WriteLine("Querying DVD BCA...");
|
||||
|
||||
mediaTest.CanReadBCA = !_dev.ReadDiscStructure(out buffer, out senseBuffer,
|
||||
@@ -757,12 +757,12 @@ namespace Aaru.Core.Devices.Report
|
||||
mediaTest.DvdBcaData = buffer;
|
||||
|
||||
break;
|
||||
case"BD-ROM":
|
||||
case"Ultra HD Blu-ray movie":
|
||||
case"PlayStation 3 game":
|
||||
case"PlayStation 4 game":
|
||||
case"Xbox One game":
|
||||
case"Nintendo Wii U game":
|
||||
case "BD-ROM":
|
||||
case "Ultra HD Blu-ray movie":
|
||||
case "PlayStation 3 game":
|
||||
case "PlayStation 4 game":
|
||||
case "Xbox One game":
|
||||
case "Nintendo Wii U game":
|
||||
AaruConsole.WriteLine("Querying BD BCA...");
|
||||
|
||||
mediaTest.CanReadBCA = !_dev.ReadDiscStructure(out buffer, out senseBuffer,
|
||||
@@ -775,10 +775,10 @@ namespace Aaru.Core.Devices.Report
|
||||
mediaTest.BluBcaData = buffer;
|
||||
|
||||
break;
|
||||
case"DVD-RAM (1st gen, marked 2.6Gb or 5.2Gb)":
|
||||
case"DVD-RAM (2nd gen, marked 4.7Gb or 9.4Gb)":
|
||||
case"HD DVD-RAM":
|
||||
case"PD-650":
|
||||
case "DVD-RAM (1st gen, marked 2.6Gb or 5.2Gb)":
|
||||
case "DVD-RAM (2nd gen, marked 4.7Gb or 9.4Gb)":
|
||||
case "HD DVD-RAM":
|
||||
case "PD-650":
|
||||
mediaTest.CanReadDDS = !_dev.ReadDiscStructure(out buffer, out senseBuffer,
|
||||
MmcDiscStructureMediaType.Dvd, 0, 0,
|
||||
MmcDiscStructureFormat.DvdramDds, 0, _dev.Timeout,
|
||||
@@ -1284,7 +1284,7 @@ namespace Aaru.Core.Devices.Report
|
||||
out _);
|
||||
|
||||
AaruConsole.DebugWriteLine("SCSI Report", "Sense = {0}",
|
||||
!mediaTest.CanReadCorrectedSubchannelWithC2);
|
||||
!mediaTest.CanReadCorrectedSubchannelWithC2);
|
||||
|
||||
mediaTest.CorrectedSubchannelWithC2Data = buffer;
|
||||
}
|
||||
@@ -1393,7 +1393,7 @@ namespace Aaru.Core.Devices.Report
|
||||
out _);
|
||||
|
||||
AaruConsole.DebugWriteLine("SCSI Report", "Sense = {0}",
|
||||
!mediaTest.CanReadCorrectedSubchannelWithC2);
|
||||
!mediaTest.CanReadCorrectedSubchannelWithC2);
|
||||
|
||||
mediaTest.CorrectedSubchannelWithC2Data = buffer;
|
||||
}
|
||||
@@ -1500,7 +1500,7 @@ namespace Aaru.Core.Devices.Report
|
||||
out _);
|
||||
|
||||
AaruConsole.DebugWriteLine("SCSI Report", "Sense = {0}",
|
||||
!mediaTest.CanReadCorrectedSubchannelWithC2);
|
||||
!mediaTest.CanReadCorrectedSubchannelWithC2);
|
||||
|
||||
mediaTest.CorrectedSubchannelWithC2Data = buffer;
|
||||
}
|
||||
@@ -1665,13 +1665,13 @@ namespace Aaru.Core.Devices.Report
|
||||
}
|
||||
|
||||
AaruConsole.DebugWriteLine("SCSI Report",
|
||||
"First session Lead-Out starts at {0:D2}:{1:D2}:{2:D2}",
|
||||
firstSessionLeadOutTrack.PMIN, firstSessionLeadOutTrack.PSEC,
|
||||
firstSessionLeadOutTrack.PFRAME);
|
||||
"First session Lead-Out starts at {0:D2}:{1:D2}:{2:D2}",
|
||||
firstSessionLeadOutTrack.PMIN, firstSessionLeadOutTrack.PSEC,
|
||||
firstSessionLeadOutTrack.PFRAME);
|
||||
|
||||
AaruConsole.DebugWriteLine("SCSI Report", "Second session starts at {0:D2}:{1:D2}:{2:D2}",
|
||||
secondSessionFirstTrack.PMIN, secondSessionFirstTrack.PSEC,
|
||||
secondSessionFirstTrack.PFRAME);
|
||||
secondSessionFirstTrack.PMIN, secondSessionFirstTrack.PSEC,
|
||||
secondSessionFirstTrack.PFRAME);
|
||||
|
||||
// Skip Lead-Out pre-gap
|
||||
uint firstSessionLeadOutLba = (uint)((firstSessionLeadOutTrack.PMIN * 60 * 75) +
|
||||
@@ -1715,7 +1715,7 @@ namespace Aaru.Core.Devices.Report
|
||||
}
|
||||
|
||||
AaruConsole.DebugWriteLine("SCSI Report", "Sense = {0}",
|
||||
!mediaTest.CanReadingIntersessionLeadOut);
|
||||
!mediaTest.CanReadingIntersessionLeadOut);
|
||||
|
||||
mediaTest.IntersessionLeadOutData = buffer;
|
||||
|
||||
@@ -1750,7 +1750,7 @@ namespace Aaru.Core.Devices.Report
|
||||
}
|
||||
|
||||
AaruConsole.DebugWriteLine("SCSI Report", "Sense = {0}",
|
||||
!mediaTest.CanReadingIntersessionLeadIn);
|
||||
!mediaTest.CanReadingIntersessionLeadIn);
|
||||
|
||||
mediaTest.IntersessionLeadInData = buffer;
|
||||
}
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.CommonTypes.Structs.Devices.ATA;
|
||||
using Aaru.Core.Logging;
|
||||
|
||||
namespace Aaru.Core.Devices.Scanning
|
||||
{
|
||||
|
||||
@@ -39,34 +39,19 @@ namespace Aaru.Core.Devices.Scanning
|
||||
}
|
||||
}
|
||||
|
||||
public void Abort()
|
||||
{
|
||||
aborted = true;
|
||||
}
|
||||
public void Abort() => aborted = true;
|
||||
|
||||
/// <summary>
|
||||
/// Event raised when the progress bar is not longer needed
|
||||
/// </summary>
|
||||
/// <summary>Event raised when the progress bar is not longer needed</summary>
|
||||
public event EndProgressHandler EndProgress;
|
||||
/// <summary>
|
||||
/// Event raised when a progress bar is needed
|
||||
/// </summary>
|
||||
/// <summary>Event raised when a progress bar is needed</summary>
|
||||
public event InitProgressHandler InitProgress;
|
||||
/// <summary>
|
||||
/// Event raised to report status updates
|
||||
/// </summary>
|
||||
/// <summary>Event raised to report status updates</summary>
|
||||
public event UpdateStatusHandler UpdateStatus;
|
||||
/// <summary>
|
||||
/// Event raised to report a fatal error that stops the dumping operation and should call user's attention
|
||||
/// </summary>
|
||||
/// <summary>Event raised to report a fatal error that stops the dumping operation and should call user's attention</summary>
|
||||
public event ErrorMessageHandler StoppingErrorMessage;
|
||||
/// <summary>
|
||||
/// Event raised to update the values of a determinate progress bar
|
||||
/// </summary>
|
||||
/// <summary>Event raised to update the values of a determinate progress bar</summary>
|
||||
public event UpdateProgressHandler UpdateProgress;
|
||||
/// <summary>
|
||||
/// Event raised to update the status of an undeterminate progress bar
|
||||
/// </summary>
|
||||
/// <summary>Event raised to update the status of an undeterminate progress bar</summary>
|
||||
public event PulseProgressHandler PulseProgress;
|
||||
public event ScanTimeHandler ScanTime;
|
||||
public event ScanUnreadableHandler ScanUnreadable;
|
||||
|
||||
@@ -37,6 +37,7 @@ namespace Aaru.Core.Devices.Scanning
|
||||
ScanResults Nvme()
|
||||
{
|
||||
StoppingErrorMessage?.Invoke("NVMe devices not yet supported.");
|
||||
|
||||
return default;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,9 +33,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.CommonTypes.Structs.Devices.SCSI;
|
||||
using Aaru.Console;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Decoders.CD;
|
||||
using Aaru.Decoders.SCSI;
|
||||
using Aaru.Decoders.SCSI.MMC;
|
||||
|
||||
@@ -34,82 +34,44 @@ using System.Collections.Generic;
|
||||
|
||||
namespace Aaru.Core.Devices.Scanning
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains the results of a media scan
|
||||
/// </summary>
|
||||
/// <summary>Contains the results of a media scan</summary>
|
||||
public struct ScanResults
|
||||
{
|
||||
/// <summary>
|
||||
/// Total time spent scanning
|
||||
/// </summary>
|
||||
/// <summary>Total time spent scanning</summary>
|
||||
public double TotalTime;
|
||||
/// <summary>
|
||||
/// Total time spent by the device processing commands
|
||||
/// </summary>
|
||||
/// <summary>Total time spent by the device processing commands</summary>
|
||||
public double ProcessingTime;
|
||||
/// <summary>
|
||||
/// Average scan speed
|
||||
/// </summary>
|
||||
/// <summary>Average scan speed</summary>
|
||||
public double AvgSpeed;
|
||||
/// <summary>
|
||||
/// Maximum scan speed burst
|
||||
/// </summary>
|
||||
/// <summary>Maximum scan speed burst</summary>
|
||||
public double MaxSpeed;
|
||||
/// <summary>
|
||||
/// Minimum scan speed
|
||||
/// </summary>
|
||||
/// <summary>Minimum scan speed</summary>
|
||||
public double MinSpeed;
|
||||
/// <summary>
|
||||
/// Sectors that took less than 3 milliseconds to be processed
|
||||
/// </summary>
|
||||
/// <summary>Sectors that took less than 3 milliseconds to be processed</summary>
|
||||
public ulong A;
|
||||
/// <summary>
|
||||
/// Sectors that took less than 10 milliseconds but more than 3 milliseconds to be processed
|
||||
/// </summary>
|
||||
/// <summary>Sectors that took less than 10 milliseconds but more than 3 milliseconds to be processed</summary>
|
||||
public ulong B;
|
||||
/// <summary>
|
||||
/// Sectors that took less than 50 milliseconds but more than 10 milliseconds to be processed
|
||||
/// </summary>
|
||||
/// <summary>Sectors that took less than 50 milliseconds but more than 10 milliseconds to be processed</summary>
|
||||
public ulong C;
|
||||
/// <summary>
|
||||
/// Sectors that took less than 150 milliseconds but more than 50 milliseconds to be processed
|
||||
/// </summary>
|
||||
/// <summary>Sectors that took less than 150 milliseconds but more than 50 milliseconds to be processed</summary>
|
||||
public ulong D;
|
||||
/// <summary>
|
||||
/// Sectors that took less than 500 milliseconds but more than 150 milliseconds to be processed
|
||||
/// </summary>
|
||||
/// <summary>Sectors that took less than 500 milliseconds but more than 150 milliseconds to be processed</summary>
|
||||
public ulong E;
|
||||
/// <summary>
|
||||
/// Sectors that took more than 500 milliseconds to be processed
|
||||
/// </summary>
|
||||
/// <summary>Sectors that took more than 500 milliseconds to be processed</summary>
|
||||
public ulong F;
|
||||
/// <summary>
|
||||
/// List of sectors that could not be read
|
||||
/// </summary>
|
||||
/// <summary>List of sectors that could not be read</summary>
|
||||
public List<ulong> UnreadableSectors;
|
||||
/// <summary>
|
||||
/// Slowest seek
|
||||
/// </summary>
|
||||
/// <summary>Slowest seek</summary>
|
||||
public double SeekMax;
|
||||
/// <summary>
|
||||
/// Fastest seek
|
||||
/// </summary>
|
||||
/// <summary>Fastest seek</summary>
|
||||
public double SeekMin;
|
||||
/// <summary>
|
||||
/// Total time spent seeking
|
||||
/// </summary>
|
||||
/// <summary>Total time spent seeking</summary>
|
||||
public double SeekTotal;
|
||||
/// <summary>
|
||||
/// How many seeks have been done
|
||||
/// </summary>
|
||||
/// <summary>How many seeks have been done</summary>
|
||||
public int SeekTimes;
|
||||
/// <summary>
|
||||
/// How many blocks were scanned
|
||||
/// </summary>
|
||||
/// <summary>How many blocks were scanned</summary>
|
||||
public ulong Blocks;
|
||||
/// <summary>
|
||||
/// How many blocks could not be read
|
||||
/// </summary>
|
||||
/// <summary>How many blocks could not be read</summary>
|
||||
public ulong Errored;
|
||||
}
|
||||
}
|
||||
@@ -32,22 +32,20 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Decoders.MMC;
|
||||
|
||||
namespace Aaru.Core.Devices.Scanning
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements scanning a SecureDigital or MultiMediaCard flash card
|
||||
/// </summary>
|
||||
/// <summary>Implements scanning a SecureDigital or MultiMediaCard flash card</summary>
|
||||
public partial class MediaScan
|
||||
{
|
||||
ScanResults SecureDigital()
|
||||
{
|
||||
ScanResults results = new ScanResults();
|
||||
byte[] cmdBuf;
|
||||
bool sense;
|
||||
var results = new ScanResults();
|
||||
byte[] cmdBuf;
|
||||
bool sense;
|
||||
results.Blocks = 0;
|
||||
const uint TIMEOUT = 5;
|
||||
double duration;
|
||||
@@ -61,12 +59,14 @@ namespace Aaru.Core.Devices.Scanning
|
||||
case DeviceType.MMC:
|
||||
{
|
||||
sense = dev.ReadExtendedCsd(out cmdBuf, out _, TIMEOUT, out _);
|
||||
|
||||
if(!sense)
|
||||
{
|
||||
ExtendedCSD ecsd = Aaru.Decoders.MMC.Decoders.DecodeExtendedCSD(cmdBuf);
|
||||
ExtendedCSD ecsd = Decoders.MMC.Decoders.DecodeExtendedCSD(cmdBuf);
|
||||
blocksToRead = ecsd.OptimalReadSize;
|
||||
results.Blocks = ecsd.SectorCount;
|
||||
blockSize = (uint)(ecsd.SectorSize == 1 ? 4096 : 512);
|
||||
|
||||
// Supposing it's high-capacity MMC if it has Extended CSD...
|
||||
byteAddressed = false;
|
||||
}
|
||||
@@ -74,9 +74,10 @@ namespace Aaru.Core.Devices.Scanning
|
||||
if(sense || results.Blocks == 0)
|
||||
{
|
||||
sense = dev.ReadCsd(out cmdBuf, out _, TIMEOUT, out _);
|
||||
|
||||
if(!sense)
|
||||
{
|
||||
CSD csd = Aaru.Decoders.MMC.Decoders.DecodeCSD(cmdBuf);
|
||||
CSD csd = Decoders.MMC.Decoders.DecodeCSD(cmdBuf);
|
||||
results.Blocks = (ulong)((csd.Size + 1) * Math.Pow(2, csd.SizeMultiplier + 2));
|
||||
blockSize = (uint)Math.Pow(2, csd.ReadBlockLength);
|
||||
}
|
||||
@@ -88,13 +89,17 @@ namespace Aaru.Core.Devices.Scanning
|
||||
case DeviceType.SecureDigital:
|
||||
{
|
||||
sense = dev.ReadCsd(out cmdBuf, out _, TIMEOUT, out _);
|
||||
|
||||
if(!sense)
|
||||
{
|
||||
Aaru.Decoders.SecureDigital.CSD csd = Aaru.Decoders.SecureDigital.Decoders.DecodeCSD(cmdBuf);
|
||||
Decoders.SecureDigital.CSD csd = Decoders.SecureDigital.Decoders.DecodeCSD(cmdBuf);
|
||||
|
||||
results.Blocks = (ulong)(csd.Structure == 0
|
||||
? (csd.Size + 1) * Math.Pow(2, csd.SizeMultiplier + 2)
|
||||
: (csd.Size + 1) * 1024);
|
||||
|
||||
blockSize = (uint)Math.Pow(2, csd.ReadBlockLength);
|
||||
|
||||
// Structure >=1 for SDHC/SDXC, so that's block addressed
|
||||
byteAddressed = csd.Structure == 0;
|
||||
}
|
||||
@@ -106,6 +111,7 @@ namespace Aaru.Core.Devices.Scanning
|
||||
if(results.Blocks == 0)
|
||||
{
|
||||
StoppingErrorMessage?.Invoke("Unable to get device size.");
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
@@ -113,14 +119,18 @@ namespace Aaru.Core.Devices.Scanning
|
||||
{
|
||||
sense = dev.Read(out cmdBuf, out _, 0, blockSize, blocksToRead, byteAddressed, TIMEOUT, out duration);
|
||||
|
||||
if(sense) blocksToRead /= 2;
|
||||
if(sense)
|
||||
blocksToRead /= 2;
|
||||
|
||||
if(!sense || blocksToRead == 1) break;
|
||||
if(!sense ||
|
||||
blocksToRead == 1)
|
||||
break;
|
||||
}
|
||||
|
||||
if(sense)
|
||||
{
|
||||
StoppingErrorMessage?.Invoke($"Device error {dev.LastError} trying to guess ideal transfer length.");
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
@@ -143,27 +153,35 @@ namespace Aaru.Core.Devices.Scanning
|
||||
results.SeekTotal = 0;
|
||||
const int SEEK_TIMES = 1000;
|
||||
|
||||
Random rnd = new Random();
|
||||
var rnd = new Random();
|
||||
|
||||
UpdateStatus?.Invoke($"Reading {blocksToRead} sectors at a time.");
|
||||
|
||||
InitBlockMap?.Invoke(results.Blocks, blockSize, blocksToRead, SD_PROFILE);
|
||||
MhddLog mhddLog = new MhddLog(mhddLogPath, dev, results.Blocks, blockSize, blocksToRead);
|
||||
IbgLog ibgLog = new IbgLog(ibgLogPath, SD_PROFILE);
|
||||
var mhddLog = new MhddLog(mhddLogPath, dev, results.Blocks, blockSize, blocksToRead);
|
||||
var ibgLog = new IbgLog(ibgLogPath, SD_PROFILE);
|
||||
|
||||
start = DateTime.UtcNow;
|
||||
DateTime timeSpeedStart = DateTime.UtcNow;
|
||||
ulong sectorSpeedStart = 0;
|
||||
InitProgress?.Invoke();
|
||||
|
||||
for(ulong i = 0; i < results.Blocks; i += blocksToRead)
|
||||
{
|
||||
if(aborted) break;
|
||||
if(aborted)
|
||||
break;
|
||||
|
||||
if(results.Blocks - i < blocksToRead) blocksToRead = (byte)(results.Blocks - i);
|
||||
if(results.Blocks - i < blocksToRead)
|
||||
blocksToRead = (byte)(results.Blocks - i);
|
||||
|
||||
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
|
||||
if(currentSpeed > results.MaxSpeed && currentSpeed != 0) results.MaxSpeed = currentSpeed;
|
||||
if(currentSpeed < results.MinSpeed && currentSpeed != 0) results.MinSpeed = currentSpeed;
|
||||
if(currentSpeed > results.MaxSpeed &&
|
||||
currentSpeed != 0)
|
||||
results.MaxSpeed = currentSpeed;
|
||||
|
||||
if(currentSpeed < results.MinSpeed &&
|
||||
currentSpeed != 0)
|
||||
results.MinSpeed = currentSpeed;
|
||||
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
|
||||
|
||||
UpdateProgress?.Invoke($"Reading sector {i} of {results.Blocks} ({currentSpeed:F3} MiB/sec.)", (long)i,
|
||||
@@ -174,12 +192,18 @@ namespace Aaru.Core.Devices.Scanning
|
||||
|
||||
if(!error)
|
||||
{
|
||||
if(duration >= 500) results.F += blocksToRead;
|
||||
else if(duration >= 150) results.E += blocksToRead;
|
||||
else if(duration >= 50) results.D += blocksToRead;
|
||||
else if(duration >= 10) results.C += blocksToRead;
|
||||
else if(duration >= 3) results.B += blocksToRead;
|
||||
else results.A += blocksToRead;
|
||||
if(duration >= 500)
|
||||
results.F += blocksToRead;
|
||||
else if(duration >= 150)
|
||||
results.E += blocksToRead;
|
||||
else if(duration >= 50)
|
||||
results.D += blocksToRead;
|
||||
else if(duration >= 10)
|
||||
results.C += blocksToRead;
|
||||
else if(duration >= 3)
|
||||
results.B += blocksToRead;
|
||||
else
|
||||
results.A += blocksToRead;
|
||||
|
||||
ScanTime?.Invoke(i, duration);
|
||||
mhddLog.Write(i, duration);
|
||||
@@ -189,7 +213,9 @@ namespace Aaru.Core.Devices.Scanning
|
||||
{
|
||||
ScanUnreadable?.Invoke(i);
|
||||
results.Errored += blocksToRead;
|
||||
for(ulong b = i; b < i + blocksToRead; b++) results.UnreadableSectors.Add(b);
|
||||
|
||||
for(ulong b = i; b < i + blocksToRead; b++)
|
||||
results.UnreadableSectors.Add(b);
|
||||
|
||||
mhddLog.Write(i, duration < 500 ? 65535 : duration);
|
||||
|
||||
@@ -199,10 +225,12 @@ namespace Aaru.Core.Devices.Scanning
|
||||
sectorSpeedStart += blocksToRead;
|
||||
|
||||
double elapsed = (DateTime.UtcNow - timeSpeedStart).TotalSeconds;
|
||||
if(elapsed < 1) continue;
|
||||
|
||||
currentSpeed = sectorSpeedStart * blockSize / (1048576 * elapsed);
|
||||
ScanSpeed?.Invoke(i, currentSpeed * 1024);
|
||||
if(elapsed < 1)
|
||||
continue;
|
||||
|
||||
currentSpeed = (sectorSpeedStart * blockSize) / (1048576 * elapsed);
|
||||
ScanSpeed?.Invoke(i, currentSpeed * 1024);
|
||||
sectorSpeedStart = 0;
|
||||
timeSpeedStart = DateTime.UtcNow;
|
||||
}
|
||||
@@ -210,14 +238,18 @@ namespace Aaru.Core.Devices.Scanning
|
||||
end = DateTime.UtcNow;
|
||||
EndProgress?.Invoke();
|
||||
mhddLog.Close();
|
||||
|
||||
ibgLog.Close(dev, results.Blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
|
||||
blockSize * (double)(results.Blocks + 1) / 1024 /
|
||||
(results.ProcessingTime / 1000), devicePath);
|
||||
(blockSize * (double)(results.Blocks + 1)) / 1024 /
|
||||
(results.ProcessingTime / 1000),
|
||||
devicePath);
|
||||
|
||||
InitProgress?.Invoke();
|
||||
|
||||
for(int i = 0; i < SEEK_TIMES; i++)
|
||||
{
|
||||
if(aborted) break;
|
||||
if(aborted)
|
||||
break;
|
||||
|
||||
uint seekPos = (uint)rnd.Next((int)results.Blocks);
|
||||
|
||||
@@ -227,8 +259,13 @@ namespace Aaru.Core.Devices.Scanning
|
||||
out double seekCur);
|
||||
|
||||
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
|
||||
if(seekCur > results.SeekMax && seekCur != 0) results.SeekMax = seekCur;
|
||||
if(seekCur < results.SeekMin && seekCur != 0) results.SeekMin = seekCur;
|
||||
if(seekCur > results.SeekMax &&
|
||||
seekCur != 0)
|
||||
results.SeekMax = seekCur;
|
||||
|
||||
if(seekCur < results.SeekMin &&
|
||||
seekCur != 0)
|
||||
results.SeekMin = seekCur;
|
||||
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
|
||||
|
||||
results.SeekTotal += seekCur;
|
||||
@@ -239,7 +276,7 @@ namespace Aaru.Core.Devices.Scanning
|
||||
|
||||
results.ProcessingTime /= 1000;
|
||||
results.TotalTime = (end - start).TotalSeconds;
|
||||
results.AvgSpeed = blockSize * (double)(results.Blocks + 1) / 1048576 / results.ProcessingTime;
|
||||
results.AvgSpeed = (blockSize * (double)(results.Blocks + 1)) / 1048576 / results.ProcessingTime;
|
||||
results.SeekTimes = SEEK_TIMES;
|
||||
|
||||
return results;
|
||||
|
||||
@@ -42,9 +42,9 @@ namespace Aaru.Core
|
||||
{
|
||||
public class Entropy
|
||||
{
|
||||
bool debug;
|
||||
IMediaImage inputFormat;
|
||||
bool verbose;
|
||||
readonly bool debug;
|
||||
readonly IMediaImage inputFormat;
|
||||
bool verbose;
|
||||
|
||||
public Entropy(bool debug, bool verbose, IMediaImage inputFormat)
|
||||
{
|
||||
@@ -67,6 +67,7 @@ namespace Aaru.Core
|
||||
if(!(inputFormat is IOpticalMediaImage opticalMediaImage))
|
||||
{
|
||||
AaruConsole.ErrorWriteLine("The selected image does not support tracks.");
|
||||
|
||||
return entropyResultses.ToArray();
|
||||
}
|
||||
|
||||
@@ -78,46 +79,56 @@ namespace Aaru.Core
|
||||
|
||||
foreach(Track currentTrack in inputTracks)
|
||||
{
|
||||
EntropyResults trackEntropy = new EntropyResults {Track = currentTrack.TrackSequence, Entropy = 0};
|
||||
UpdateProgressEvent
|
||||
?.Invoke($"Entropying track {currentTrack.TrackSequence} of {inputTracks.Max(t => t.TrackSequence)}",
|
||||
var trackEntropy = new EntropyResults
|
||||
{
|
||||
Track = currentTrack.TrackSequence, Entropy = 0
|
||||
};
|
||||
|
||||
UpdateProgressEvent?.
|
||||
Invoke($"Entropying track {currentTrack.TrackSequence} of {inputTracks.Max(t => t.TrackSequence)}",
|
||||
currentTrack.TrackSequence, inputTracks.Max(t => t.TrackSequence));
|
||||
|
||||
ulong[] entTable = new ulong[256];
|
||||
ulong trackSize = 0;
|
||||
List<string> uniqueSectorsPerTrack = new List<string>();
|
||||
|
||||
trackEntropy.Sectors = currentTrack.TrackEndSector - currentTrack.TrackStartSector + 1;
|
||||
trackEntropy.Sectors = (currentTrack.TrackEndSector - currentTrack.TrackStartSector) + 1;
|
||||
|
||||
AaruConsole.VerboseWriteLine("Track {0} has {1} sectors", currentTrack.TrackSequence,
|
||||
trackEntropy.Sectors);
|
||||
trackEntropy.Sectors);
|
||||
|
||||
InitProgress2Event?.Invoke();
|
||||
|
||||
for(ulong i = currentTrack.TrackStartSector; i <= currentTrack.TrackEndSector; i++)
|
||||
{
|
||||
UpdateProgress2Event
|
||||
?.Invoke($"Entropying sector {i + 1} of track {currentTrack.TrackSequence}",
|
||||
UpdateProgress2Event?.
|
||||
Invoke($"Entropying sector {i + 1} of track {currentTrack.TrackSequence}",
|
||||
(long)(currentTrack.TrackEndSector - (i + 1)),
|
||||
(long)trackEntropy.Sectors);
|
||||
|
||||
byte[] sector = opticalMediaImage.ReadSector(i, currentTrack.TrackSequence);
|
||||
|
||||
if(duplicatedSectors)
|
||||
{
|
||||
string sectorHash = Sha1Context.Data(sector, out _);
|
||||
if(!uniqueSectorsPerTrack.Contains(sectorHash)) uniqueSectorsPerTrack.Add(sectorHash);
|
||||
|
||||
if(!uniqueSectorsPerTrack.Contains(sectorHash))
|
||||
uniqueSectorsPerTrack.Add(sectorHash);
|
||||
}
|
||||
|
||||
foreach(byte b in sector) entTable[b]++;
|
||||
foreach(byte b in sector)
|
||||
entTable[b]++;
|
||||
|
||||
trackSize += (ulong)sector.LongLength;
|
||||
}
|
||||
|
||||
EndProgress2Event?.Invoke();
|
||||
|
||||
trackEntropy.Entropy += entTable.Select(l => (double)l / (double)trackSize)
|
||||
.Select(frequency => -(frequency * Math.Log(frequency, 2))).Sum();
|
||||
trackEntropy.Entropy += entTable.Select(l => (double)l / (double)trackSize).
|
||||
Select(frequency => -(frequency * Math.Log(frequency, 2))).Sum();
|
||||
|
||||
if(duplicatedSectors) trackEntropy.UniqueSectors = uniqueSectorsPerTrack.Count;
|
||||
if(duplicatedSectors)
|
||||
trackEntropy.UniqueSectors = uniqueSectorsPerTrack.Count;
|
||||
|
||||
entropyResultses.Add(trackEntropy);
|
||||
}
|
||||
@@ -126,8 +137,10 @@ namespace Aaru.Core
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
if(debug) AaruConsole.DebugWriteLine("Could not get tracks because {0}", ex.Message);
|
||||
else AaruConsole.ErrorWriteLine("Unable to get separate tracks, not calculating their entropy");
|
||||
if(debug)
|
||||
AaruConsole.DebugWriteLine("Could not get tracks because {0}", ex.Message);
|
||||
else
|
||||
AaruConsole.ErrorWriteLine("Unable to get separate tracks, not calculating their entropy");
|
||||
}
|
||||
|
||||
return entropyResultses.ToArray();
|
||||
@@ -135,14 +148,19 @@ namespace Aaru.Core
|
||||
|
||||
public EntropyResults CalculateMediaEntropy(bool duplicatedSectors)
|
||||
{
|
||||
EntropyResults entropy = new EntropyResults {Entropy = 0};
|
||||
ulong[] entTable = new ulong[256];
|
||||
ulong diskSize = 0;
|
||||
List<string> uniqueSectors = new List<string>();
|
||||
var entropy = new EntropyResults
|
||||
{
|
||||
Entropy = 0
|
||||
};
|
||||
|
||||
ulong[] entTable = new ulong[256];
|
||||
ulong diskSize = 0;
|
||||
List<string> uniqueSectors = new List<string>();
|
||||
|
||||
entropy.Sectors = inputFormat.Info.Sectors;
|
||||
AaruConsole.WriteLine("Sectors {0}", entropy.Sectors);
|
||||
InitProgressEvent?.Invoke();
|
||||
|
||||
for(ulong i = 0; i < entropy.Sectors; i++)
|
||||
{
|
||||
UpdateProgressEvent?.Invoke($"Entropying sector {i + 1}", (long)(i + 1), (long)entropy.Sectors);
|
||||
@@ -151,20 +169,24 @@ namespace Aaru.Core
|
||||
if(duplicatedSectors)
|
||||
{
|
||||
string sectorHash = Sha1Context.Data(sector, out _);
|
||||
if(!uniqueSectors.Contains(sectorHash)) uniqueSectors.Add(sectorHash);
|
||||
|
||||
if(!uniqueSectors.Contains(sectorHash))
|
||||
uniqueSectors.Add(sectorHash);
|
||||
}
|
||||
|
||||
foreach(byte b in sector) entTable[b]++;
|
||||
foreach(byte b in sector)
|
||||
entTable[b]++;
|
||||
|
||||
diskSize += (ulong)sector.LongLength;
|
||||
}
|
||||
|
||||
EndProgressEvent?.Invoke();
|
||||
|
||||
entropy.Entropy += entTable.Select(l => (double)l / (double)diskSize)
|
||||
.Select(frequency => -(frequency * Math.Log(frequency, 2))).Sum();
|
||||
entropy.Entropy += entTable.Select(l => (double)l / (double)diskSize).
|
||||
Select(frequency => -(frequency * Math.Log(frequency, 2))).Sum();
|
||||
|
||||
if(duplicatedSectors) entropy.UniqueSectors = uniqueSectors.Count;
|
||||
if(duplicatedSectors)
|
||||
entropy.UniqueSectors = uniqueSectors.Count;
|
||||
|
||||
return entropy;
|
||||
}
|
||||
|
||||
@@ -8,15 +8,14 @@ namespace Aaru.Core
|
||||
{
|
||||
public static string Print(int errno)
|
||||
{
|
||||
switch (DetectOS.GetRealPlatformID())
|
||||
switch(DetectOS.GetRealPlatformID())
|
||||
{
|
||||
case PlatformID.Win32S:
|
||||
case PlatformID.Win32Windows:
|
||||
case PlatformID.Win32NT:
|
||||
case PlatformID.WinCE:
|
||||
case PlatformID.WindowsPhone:
|
||||
case PlatformID.Xbox:
|
||||
return PrintWin32Error(errno);
|
||||
case PlatformID.Xbox: return PrintWin32Error(errno);
|
||||
case PlatformID.Unix:
|
||||
case PlatformID.MacOSX:
|
||||
case PlatformID.iOS:
|
||||
@@ -41,32 +40,24 @@ namespace Aaru.Core
|
||||
case PlatformID.Ultrix:
|
||||
case PlatformID.OpenServer:
|
||||
case PlatformID.UnixWare:
|
||||
case PlatformID.zOS:
|
||||
return PrintUnixError(errno);
|
||||
case PlatformID.Wii:
|
||||
return $"Unknown error code {errno}";
|
||||
case PlatformID.WiiU:
|
||||
return $"Unknown error code {errno}";
|
||||
case PlatformID.PlayStation3:
|
||||
return $"Unknown error code {errno}";
|
||||
case PlatformID.PlayStation4:
|
||||
return $"Unknown error code {errno}";
|
||||
case PlatformID.NonStop:
|
||||
return $"Unknown error code {errno}";
|
||||
case PlatformID.Unknown:
|
||||
return $"Unknown error code {errno}";
|
||||
default:
|
||||
return $"Unknown error code {errno}";
|
||||
case PlatformID.zOS: return PrintUnixError(errno);
|
||||
case PlatformID.Wii: return $"Unknown error code {errno}";
|
||||
case PlatformID.WiiU: return $"Unknown error code {errno}";
|
||||
case PlatformID.PlayStation3: return $"Unknown error code {errno}";
|
||||
case PlatformID.PlayStation4: return $"Unknown error code {errno}";
|
||||
case PlatformID.NonStop: return $"Unknown error code {errno}";
|
||||
case PlatformID.Unknown: return $"Unknown error code {errno}";
|
||||
default: return $"Unknown error code {errno}";
|
||||
}
|
||||
|
||||
throw new Exception("Arrived an unexpected place");
|
||||
}
|
||||
|
||||
private static string PrintUnixError(int errno)
|
||||
static string PrintUnixError(int errno)
|
||||
{
|
||||
switch (errno)
|
||||
switch(errno)
|
||||
{
|
||||
case 2: // ENOENT
|
||||
case 2: // ENOENT
|
||||
case 19: // ENODEV
|
||||
return "The specified device cannot be found.";
|
||||
case 13: // EACCESS
|
||||
@@ -75,14 +66,13 @@ namespace Aaru.Core
|
||||
return "The specified device is in use by another process.";
|
||||
case 30: // EROFS
|
||||
return "Cannot open the device in writable mode, as needed by some commands.";
|
||||
default:
|
||||
return $"Unknown error code {errno}";
|
||||
default: return $"Unknown error code {errno}";
|
||||
}
|
||||
}
|
||||
|
||||
private static string PrintWin32Error(int errno)
|
||||
static string PrintWin32Error(int errno)
|
||||
{
|
||||
switch (errno)
|
||||
switch(errno)
|
||||
{
|
||||
case 2: // ERROR_FILE_NOT_FOUND
|
||||
case 3: // ERROR_PATH_NOT_FOUND
|
||||
@@ -91,15 +81,14 @@ namespace Aaru.Core
|
||||
return "Not enough permissions to open the device.";
|
||||
case 19: // ERROR_WRITE_PROTECT
|
||||
return "Cannot open the device in writable mode, as needed by some commands.";
|
||||
case 32: // ERROR_SHARING_VIOLATION
|
||||
case 33: // ERROR_LOCK_VIOLATION
|
||||
case 32: // ERROR_SHARING_VIOLATION
|
||||
case 33: // ERROR_LOCK_VIOLATION
|
||||
case 108: // ERROR_DRIVE_LOCKED
|
||||
case 170: // ERROR_BUSY
|
||||
return "The specified device is in use by another process.";
|
||||
case 130: // ERROR_DIRECT_ACCESS_HANDLE
|
||||
return "Tried to open a file instead of a device.";
|
||||
default:
|
||||
return $"Unknown error code {errno}";
|
||||
default: return $"Unknown error code {errno}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,8 +50,7 @@ namespace Aaru.Core
|
||||
{
|
||||
PluginBase plugins = GetPluginBase.Instance;
|
||||
|
||||
idPlugins = (from plugin in plugins.PluginsList.Values
|
||||
where plugin.Identify(imagePlugin, partition)
|
||||
idPlugins = (from plugin in plugins.PluginsList.Values where plugin.Identify(imagePlugin, partition)
|
||||
select plugin.Name.ToLower()).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,12 +42,12 @@ namespace Aaru.Core
|
||||
{
|
||||
get
|
||||
{
|
||||
PluginBase instance = new PluginBase();
|
||||
var instance = new PluginBase();
|
||||
|
||||
IPluginRegister checksumRegister = new Register();
|
||||
IPluginRegister imagesRegister = new Aaru.DiscImages.Register();
|
||||
IPluginRegister imagesRegister = new DiscImages.Register();
|
||||
IPluginRegister filesystemsRegister = new Aaru.Filesystems.Register();
|
||||
IPluginRegister filtersRegister = new Aaru.Filters.Register();
|
||||
IPluginRegister filtersRegister = new Filters.Register();
|
||||
IPluginRegister partitionsRegister = new Aaru.Partitions.Register();
|
||||
|
||||
instance.AddPlugins(checksumRegister);
|
||||
|
||||
@@ -40,9 +40,7 @@ namespace Aaru.Core
|
||||
{
|
||||
public static class ImageFormat
|
||||
{
|
||||
/// <summary>
|
||||
/// Detects the image plugin that recognizes the data inside a filter
|
||||
/// </summary>
|
||||
/// <summary>Detects the image plugin that recognizes the data inside a filter</summary>
|
||||
/// <param name="imageFilter">Filter</param>
|
||||
/// <returns>Detected image plugin</returns>
|
||||
public static IMediaImage Detect(IFilter imageFilter)
|
||||
@@ -62,9 +60,12 @@ namespace Aaru.Core
|
||||
try
|
||||
{
|
||||
AaruConsole.DebugWriteLine("Format detection", "Trying plugin {0}", imageplugin.Name);
|
||||
if(!imageplugin.Identify(imageFilter)) continue;
|
||||
|
||||
if(!imageplugin.Identify(imageFilter))
|
||||
continue;
|
||||
|
||||
imageFormat = imageplugin;
|
||||
|
||||
break;
|
||||
}
|
||||
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
@@ -73,7 +74,8 @@ namespace Aaru.Core
|
||||
// ignored
|
||||
}
|
||||
|
||||
if(imageFormat != null) return imageFormat;
|
||||
if(imageFormat != null)
|
||||
return imageFormat;
|
||||
|
||||
// Check only RAW plugin
|
||||
foreach(IMediaImage imageplugin in plugins.ImagePluginsList.Values.Where(imageplugin =>
|
||||
@@ -84,9 +86,12 @@ namespace Aaru.Core
|
||||
try
|
||||
{
|
||||
AaruConsole.DebugWriteLine("Format detection", "Trying plugin {0}", imageplugin.Name);
|
||||
if(!imageplugin.Identify(imageFilter)) continue;
|
||||
|
||||
if(!imageplugin.Identify(imageFilter))
|
||||
continue;
|
||||
|
||||
imageFormat = imageplugin;
|
||||
|
||||
break;
|
||||
}
|
||||
#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body
|
||||
@@ -98,7 +103,10 @@ namespace Aaru.Core
|
||||
// Still not recognized
|
||||
return imageFormat;
|
||||
}
|
||||
catch { return null; }
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -68,15 +68,16 @@ namespace Aaru.Core
|
||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.Application) &&
|
||||
!string.IsNullOrWhiteSpace(imageFormat.Info.ApplicationVersion))
|
||||
AaruConsole.WriteLine("Was created with {0} version {1}", imageFormat.Info.Application,
|
||||
imageFormat.Info.ApplicationVersion);
|
||||
imageFormat.Info.ApplicationVersion);
|
||||
else if(!string.IsNullOrWhiteSpace(imageFormat.Info.Application))
|
||||
AaruConsole.WriteLine("Was created with {0}", imageFormat.Info.Application);
|
||||
|
||||
AaruConsole.WriteLine("Image without headers is {0} bytes long", imageFormat.Info.ImageSize);
|
||||
|
||||
AaruConsole.WriteLine("Contains a media of {0} sectors with a maximum sector size of {1} bytes (if all sectors are of the same size this would be {2} bytes)",
|
||||
imageFormat.Info.Sectors, imageFormat.Info.SectorSize,
|
||||
imageFormat.Info.Sectors * imageFormat.Info.SectorSize);
|
||||
AaruConsole.
|
||||
WriteLine("Contains a media of {0} sectors with a maximum sector size of {1} bytes (if all sectors are of the same size this would be {2} bytes)",
|
||||
imageFormat.Info.Sectors, imageFormat.Info.SectorSize,
|
||||
imageFormat.Info.Sectors * imageFormat.Info.SectorSize);
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.Creator))
|
||||
AaruConsole.WriteLine("Created by: {0}", imageFormat.Info.Creator);
|
||||
@@ -88,7 +89,7 @@ namespace Aaru.Core
|
||||
AaruConsole.WriteLine("Last modified on {0}", imageFormat.Info.LastModificationTime);
|
||||
|
||||
AaruConsole.WriteLine("Contains a media of type {0} and XML type {1}", imageFormat.Info.MediaType,
|
||||
imageFormat.Info.XmlMediaType);
|
||||
imageFormat.Info.XmlMediaType);
|
||||
|
||||
AaruConsole.WriteLine("{0} partitions", imageFormat.Info.HasPartitions ? "Has" : "Doesn't have");
|
||||
AaruConsole.WriteLine("{0} sessions", imageFormat.Info.HasSessions ? "Has" : "Doesn't have");
|
||||
@@ -99,7 +100,7 @@ namespace Aaru.Core
|
||||
if(imageFormat.Info.MediaSequence != 0 &&
|
||||
imageFormat.Info.LastMediaSequence != 0)
|
||||
AaruConsole.WriteLine("Media is number {0} on a set of {1} medias", imageFormat.Info.MediaSequence,
|
||||
imageFormat.Info.LastMediaSequence);
|
||||
imageFormat.Info.LastMediaSequence);
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(imageFormat.Info.MediaTitle))
|
||||
AaruConsole.WriteLine("Media title: {0}", imageFormat.Info.MediaTitle);
|
||||
@@ -137,8 +138,8 @@ namespace Aaru.Core
|
||||
imageFormat.Info.XmlMediaType != XmlMediaType.OpticalDisc &&
|
||||
(!(imageFormat is ITapeImage tapeImage) || !tapeImage.IsTape))
|
||||
AaruConsole.WriteLine("Media geometry: {0} cylinders, {1} heads, {2} sectors per track",
|
||||
imageFormat.Info.Cylinders, imageFormat.Info.Heads,
|
||||
imageFormat.Info.SectorsPerTrack);
|
||||
imageFormat.Info.Cylinders, imageFormat.Info.Heads,
|
||||
imageFormat.Info.SectorsPerTrack);
|
||||
|
||||
if(imageFormat.Info.ReadableMediaTags != null &&
|
||||
imageFormat.Info.ReadableMediaTags.Count > 0)
|
||||
@@ -339,7 +340,7 @@ namespace Aaru.Core
|
||||
byte[] mcn = imageFormat.ReadDiskTag(MediaTagType.CD_MCN);
|
||||
|
||||
AaruConsole.WriteLine("CompactDisc Media Catalogue Number contained in image: {0}",
|
||||
Encoding.UTF8.GetString(mcn));
|
||||
Encoding.UTF8.GetString(mcn));
|
||||
|
||||
AaruConsole.WriteLine();
|
||||
}
|
||||
@@ -390,7 +391,7 @@ namespace Aaru.Core
|
||||
byte[] dds = imageFormat.ReadDiskTag(MediaTagType.BD_DDS);
|
||||
|
||||
AaruConsole.WriteLine("Bluray Disc Definition Structure contained in image:");
|
||||
AaruConsole.Write("{0}", Aaru.Decoders.Bluray.DDS.Prettify(dds));
|
||||
AaruConsole.Write("{0}", Decoders.Bluray.DDS.Prettify(dds));
|
||||
AaruConsole.WriteLine();
|
||||
}
|
||||
|
||||
@@ -456,12 +457,12 @@ namespace Aaru.Core
|
||||
case TupleCodes.CISTPL_SWIL:
|
||||
case TupleCodes.CISTPL_VERS_2:
|
||||
AaruConsole.DebugWriteLine("Device-Info command", "Found undecoded tuple ID {0}",
|
||||
tuple.Code);
|
||||
tuple.Code);
|
||||
|
||||
break;
|
||||
default:
|
||||
AaruConsole.DebugWriteLine("Device-Info command", "Found unknown tuple ID 0x{0:X2}",
|
||||
(byte)tuple.Code);
|
||||
(byte)tuple.Code);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -475,7 +476,7 @@ namespace Aaru.Core
|
||||
byte[] cid = imageFormat.ReadDiskTag(MediaTagType.SD_CID);
|
||||
|
||||
AaruConsole.WriteLine("SecureDigital CID contained in image:");
|
||||
AaruConsole.Write("{0}", Aaru.Decoders.SecureDigital.Decoders.PrettifyCID(cid));
|
||||
AaruConsole.Write("{0}", Decoders.SecureDigital.Decoders.PrettifyCID(cid));
|
||||
AaruConsole.WriteLine();
|
||||
}
|
||||
|
||||
@@ -485,7 +486,7 @@ namespace Aaru.Core
|
||||
byte[] csd = imageFormat.ReadDiskTag(MediaTagType.SD_CSD);
|
||||
|
||||
AaruConsole.WriteLine("SecureDigital CSD contained in image:");
|
||||
AaruConsole.Write("{0}", Aaru.Decoders.SecureDigital.Decoders.PrettifyCSD(csd));
|
||||
AaruConsole.Write("{0}", Decoders.SecureDigital.Decoders.PrettifyCSD(csd));
|
||||
AaruConsole.WriteLine();
|
||||
}
|
||||
|
||||
@@ -495,7 +496,7 @@ namespace Aaru.Core
|
||||
byte[] scr = imageFormat.ReadDiskTag(MediaTagType.SD_SCR);
|
||||
|
||||
AaruConsole.WriteLine("SecureDigital SCR contained in image:");
|
||||
AaruConsole.Write("{0}", Aaru.Decoders.SecureDigital.Decoders.PrettifySCR(scr));
|
||||
AaruConsole.Write("{0}", Decoders.SecureDigital.Decoders.PrettifySCR(scr));
|
||||
AaruConsole.WriteLine();
|
||||
}
|
||||
|
||||
@@ -505,7 +506,7 @@ namespace Aaru.Core
|
||||
byte[] ocr = imageFormat.ReadDiskTag(MediaTagType.SD_OCR);
|
||||
|
||||
AaruConsole.WriteLine("SecureDigital OCR contained in image:");
|
||||
AaruConsole.Write("{0}", Aaru.Decoders.SecureDigital.Decoders.PrettifyOCR(ocr));
|
||||
AaruConsole.Write("{0}", Decoders.SecureDigital.Decoders.PrettifyOCR(ocr));
|
||||
AaruConsole.WriteLine();
|
||||
}
|
||||
|
||||
@@ -515,7 +516,7 @@ namespace Aaru.Core
|
||||
byte[] cid = imageFormat.ReadDiskTag(MediaTagType.MMC_CID);
|
||||
|
||||
AaruConsole.WriteLine("MultiMediaCard CID contained in image:");
|
||||
AaruConsole.Write("{0}", Aaru.Decoders.MMC.Decoders.PrettifyCID(cid));
|
||||
AaruConsole.Write("{0}", Decoders.MMC.Decoders.PrettifyCID(cid));
|
||||
AaruConsole.WriteLine();
|
||||
}
|
||||
|
||||
@@ -525,7 +526,7 @@ namespace Aaru.Core
|
||||
byte[] csd = imageFormat.ReadDiskTag(MediaTagType.MMC_CSD);
|
||||
|
||||
AaruConsole.WriteLine("MultiMediaCard CSD contained in image:");
|
||||
AaruConsole.Write("{0}", Aaru.Decoders.MMC.Decoders.PrettifyCSD(csd));
|
||||
AaruConsole.Write("{0}", Decoders.MMC.Decoders.PrettifyCSD(csd));
|
||||
AaruConsole.WriteLine();
|
||||
}
|
||||
|
||||
@@ -535,7 +536,7 @@ namespace Aaru.Core
|
||||
byte[] ecsd = imageFormat.ReadDiskTag(MediaTagType.MMC_ExtendedCSD);
|
||||
|
||||
AaruConsole.WriteLine("MultiMediaCard ExtendedCSD contained in image:");
|
||||
AaruConsole.Write("{0}", Aaru.Decoders.MMC.Decoders.PrettifyExtendedCSD(ecsd));
|
||||
AaruConsole.Write("{0}", Decoders.MMC.Decoders.PrettifyExtendedCSD(ecsd));
|
||||
AaruConsole.WriteLine();
|
||||
}
|
||||
|
||||
@@ -545,7 +546,7 @@ namespace Aaru.Core
|
||||
byte[] ocr = imageFormat.ReadDiskTag(MediaTagType.MMC_OCR);
|
||||
|
||||
AaruConsole.WriteLine("MultiMediaCard OCR contained in image:");
|
||||
AaruConsole.Write("{0}", Aaru.Decoders.MMC.Decoders.PrettifyOCR(ocr));
|
||||
AaruConsole.Write("{0}", Decoders.MMC.Decoders.PrettifyOCR(ocr));
|
||||
AaruConsole.WriteLine();
|
||||
}
|
||||
|
||||
@@ -609,14 +610,14 @@ namespace Aaru.Core
|
||||
AaruConsole.WriteLine("Image sessions:");
|
||||
|
||||
AaruConsole.WriteLine("{0,-9}{1,-13}{2,-12}{3,-12}{4,-12}", "Session", "First track",
|
||||
"Last track", "Start", "End");
|
||||
"Last track", "Start", "End");
|
||||
|
||||
AaruConsole.WriteLine("=========================================================");
|
||||
|
||||
foreach(Session session in opticalImage.Sessions)
|
||||
AaruConsole.WriteLine("{0,-9}{1,-13}{2,-12}{3,-12}{4,-12}", session.SessionSequence,
|
||||
session.StartTrack, session.EndTrack, session.StartSector,
|
||||
session.EndSector);
|
||||
session.StartTrack, session.EndTrack, session.StartSector,
|
||||
session.EndSector);
|
||||
|
||||
AaruConsole.WriteLine();
|
||||
}
|
||||
@@ -634,16 +635,16 @@ namespace Aaru.Core
|
||||
AaruConsole.WriteLine("Image tracks:");
|
||||
|
||||
AaruConsole.WriteLine("{0,-7}{1,-17}{2,-6}{3,-8}{4,-12}{5,-8}{6,-12}{7,-12}", "Track", "Type",
|
||||
"Bps", "Raw bps", "Subchannel", "Pregap", "Start", "End");
|
||||
"Bps", "Raw bps", "Subchannel", "Pregap", "Start", "End");
|
||||
|
||||
AaruConsole.
|
||||
WriteLine("=================================================================================");
|
||||
|
||||
foreach(Track track in opticalImage.Tracks)
|
||||
AaruConsole.WriteLine("{0,-7}{1,-17}{2,-6}{3,-8}{4,-12}{5,-8}{6,-12}{7,-12}",
|
||||
track.TrackSequence, track.TrackType, track.TrackBytesPerSector,
|
||||
track.TrackRawBytesPerSector, track.TrackSubchannelType,
|
||||
track.TrackPregap, track.TrackStartSector, track.TrackEndSector);
|
||||
track.TrackSequence, track.TrackType, track.TrackBytesPerSector,
|
||||
track.TrackRawBytesPerSector, track.TrackSubchannelType,
|
||||
track.TrackPregap, track.TrackStartSector, track.TrackEndSector);
|
||||
|
||||
AaruConsole.WriteLine();
|
||||
}
|
||||
@@ -724,7 +725,7 @@ namespace Aaru.Core
|
||||
AaruConsole.WriteLine("Dump hardware information:");
|
||||
|
||||
AaruConsole.WriteLine(format, MANUFACTURER_STRING, MODEL_STRING, SERIAL_STRING, SOFTWARE_STRING,
|
||||
VERSION_STRING, OS_STRING, START_STRING, END_STRING);
|
||||
VERSION_STRING, OS_STRING, START_STRING, END_STRING);
|
||||
|
||||
AaruConsole.WriteLine(new string(separator));
|
||||
|
||||
@@ -732,8 +733,8 @@ namespace Aaru.Core
|
||||
{
|
||||
foreach(ExtentType extent in dump.Extents)
|
||||
AaruConsole.WriteLine(format, dump.Manufacturer, dump.Model, dump.Serial, dump.Software.Name,
|
||||
dump.Software.Version, dump.Software.OperatingSystem, extent.Start,
|
||||
extent.End);
|
||||
dump.Software.Version, dump.Software.OperatingSystem, extent.Start,
|
||||
extent.End);
|
||||
}
|
||||
|
||||
AaruConsole.WriteLine();
|
||||
|
||||
@@ -836,7 +836,7 @@ namespace Aaru.Core.Media.Detection
|
||||
string ps2BootSectorsHash = Sha256Context.Data(ps2BootSectors, out _);
|
||||
|
||||
AaruConsole.DebugWriteLine("Media-info Command", "PlayStation 2 boot sectors SHA256: {0}",
|
||||
ps2BootSectorsHash);
|
||||
ps2BootSectorsHash);
|
||||
|
||||
if(ps2BootSectorsHash == PS2_PAL_HASH ||
|
||||
ps2BootSectorsHash == PS2_NTSC_HASH ||
|
||||
@@ -942,7 +942,7 @@ namespace Aaru.Core.Media.Detection
|
||||
string ps2BootSectorsHash = Sha256Context.Data(ps2BootSectors, out _);
|
||||
|
||||
AaruConsole.DebugWriteLine("Media-info Command", "PlayStation 2 boot sectors SHA256: {0}",
|
||||
ps2BootSectorsHash);
|
||||
ps2BootSectorsHash);
|
||||
|
||||
if(ps2BootSectorsHash == PS2_PAL_HASH ||
|
||||
ps2BootSectorsHash == PS2_NTSC_HASH ||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Core.Media.Detection;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.Core.Logging;
|
||||
using Aaru.Core.Media.Detection;
|
||||
using Aaru.Database.Models;
|
||||
using Aaru.Decoders.CD;
|
||||
using Aaru.Devices;
|
||||
@@ -125,17 +125,18 @@ namespace Aaru.Core.Media.Info
|
||||
// Clear cache
|
||||
for(int i = 0; i < 63; i++)
|
||||
{
|
||||
sense = dev.ReadCd(out _, out _, (uint)(wantedLba + 3 + (16 * i)), sectorSize, 16, MmcSectorTypes.AllTypes, false,
|
||||
false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None,
|
||||
sense = dev.ReadCd(out _, out _, (uint)(wantedLba + 3 + (16 * i)), sectorSize, 16,
|
||||
MmcSectorTypes.AllTypes, false, false, false,
|
||||
MmcHeaderCodes.None, true, false, MmcErrorField.None,
|
||||
MmcSubchannel.None, dev.Timeout, out _);
|
||||
|
||||
if(sense || dev.Error)
|
||||
break;
|
||||
}
|
||||
|
||||
sense = dev.ReadCd(out cmdBuf, out _, wantedLba, sectorSize, 3, MmcSectorTypes.Cdda, false,
|
||||
false, false, MmcHeaderCodes.None, true, false, MmcErrorField.None,
|
||||
MmcSubchannel.None, dev.Timeout, out _);
|
||||
sense = dev.ReadCd(out cmdBuf, out _, wantedLba, sectorSize, 3, MmcSectorTypes.Cdda,
|
||||
false, false, false, MmcHeaderCodes.None, true, false,
|
||||
MmcErrorField.None, MmcSubchannel.None, dev.Timeout, out _);
|
||||
|
||||
for(int i = 0; i < cmdBuf.Length - sectorSync.Length; i++)
|
||||
{
|
||||
|
||||
@@ -34,11 +34,11 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using Aaru.Core.Media.Detection;
|
||||
using Aaru.CommonTypes;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Structs.Devices.SCSI;
|
||||
using Aaru.Console;
|
||||
using Aaru.Core.Media.Detection;
|
||||
using Aaru.Decoders.CD;
|
||||
using Aaru.Decoders.DVD;
|
||||
using Aaru.Decoders.SCSI;
|
||||
@@ -133,7 +133,7 @@ namespace Aaru.Core.Media.Info
|
||||
if(sense)
|
||||
{
|
||||
AaruConsole.ErrorWriteLine("Error testing unit was ready:\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -141,7 +141,7 @@ namespace Aaru.Core.Media.Info
|
||||
else
|
||||
{
|
||||
AaruConsole.ErrorWriteLine("Error testing unit was ready:\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -157,7 +157,7 @@ namespace Aaru.Core.Media.Info
|
||||
|
||||
MediaInserted = true;
|
||||
|
||||
DeviceInfo = new Devices.Info.DeviceInfo(dev);
|
||||
DeviceInfo = new DeviceInfo(dev);
|
||||
|
||||
byte scsiMediumType = 0;
|
||||
byte scsiDensityCode = 0;
|
||||
@@ -240,7 +240,7 @@ namespace Aaru.Core.Media.Info
|
||||
!seqBuf.SequenceEqual(medBuf))
|
||||
{
|
||||
DensitySupport = seqBuf;
|
||||
DensitySupportHeader = Aaru.Decoders.SCSI.SSC.DensitySupport.DecodeDensity(seqBuf);
|
||||
DensitySupportHeader = Decoders.SCSI.SSC.DensitySupport.DecodeDensity(seqBuf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ namespace Aaru.Core.Media.Info
|
||||
!seqBuf.SequenceEqual(medBuf))
|
||||
{
|
||||
MediaTypeSupport = medBuf;
|
||||
MediaTypeSupportHeader = Aaru.Decoders.SCSI.SSC.DensitySupport.DecodeMediumType(seqBuf);
|
||||
MediaTypeSupportHeader = Decoders.SCSI.SSC.DensitySupport.DecodeMediumType(seqBuf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,7 +279,7 @@ namespace Aaru.Core.Media.Info
|
||||
if(sense)
|
||||
{
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "READ GET CONFIGURATION:\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -287,7 +287,7 @@ namespace Aaru.Core.Media.Info
|
||||
Features.SeparatedFeatures ftr = Features.Separate(cmdBuf);
|
||||
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "GET CONFIGURATION current profile is {0:X4}h",
|
||||
ftr.CurrentProfile);
|
||||
ftr.CurrentProfile);
|
||||
|
||||
switch(ftr.CurrentProfile)
|
||||
{
|
||||
@@ -451,8 +451,8 @@ namespace Aaru.Core.Media.Info
|
||||
|
||||
if(sense)
|
||||
AaruConsole.DebugWriteLine("Media-Info command",
|
||||
"READ DISC STRUCTURE: Recognized Format Layers\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
"READ DISC STRUCTURE: Recognized Format Layers\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
RecognizedFormatLayers = cmdBuf;
|
||||
|
||||
@@ -460,8 +460,9 @@ namespace Aaru.Core.Media.Info
|
||||
MmcDiscStructureFormat.WriteProtectionStatus, 0, dev.Timeout, out _);
|
||||
|
||||
if(sense)
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Write Protection Status\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
AaruConsole.DebugWriteLine("Media-Info command",
|
||||
"READ DISC STRUCTURE: Write Protection Status\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
WriteProtectionStatus = cmdBuf;
|
||||
|
||||
@@ -499,7 +500,7 @@ namespace Aaru.Core.Media.Info
|
||||
if(sense)
|
||||
{
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: PFI\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -579,7 +580,7 @@ namespace Aaru.Core.Media.Info
|
||||
if(sense)
|
||||
{
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DMI\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -612,7 +613,7 @@ namespace Aaru.Core.Media.Info
|
||||
|
||||
if(sense)
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: CMI\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
DvdCmi = cmdBuf;
|
||||
}
|
||||
@@ -629,7 +630,7 @@ namespace Aaru.Core.Media.Info
|
||||
|
||||
if(sense)
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: BCA\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
DvdBca = cmdBuf;
|
||||
|
||||
@@ -638,7 +639,7 @@ namespace Aaru.Core.Media.Info
|
||||
|
||||
if(sense)
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DVD AACS\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
DvdAacs = cmdBuf;
|
||||
|
||||
@@ -653,7 +654,7 @@ namespace Aaru.Core.Media.Info
|
||||
|
||||
if(sense)
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DDS\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
DvdRamDds = cmdBuf;
|
||||
|
||||
@@ -662,7 +663,7 @@ namespace Aaru.Core.Media.Info
|
||||
|
||||
if(sense)
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Medium Status\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
DvdRamCartridgeStatus = cmdBuf;
|
||||
|
||||
@@ -672,7 +673,7 @@ namespace Aaru.Core.Media.Info
|
||||
|
||||
if(sense)
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: SAI\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
DvdRamSpareArea = cmdBuf;
|
||||
|
||||
@@ -687,8 +688,8 @@ namespace Aaru.Core.Media.Info
|
||||
|
||||
if(sense)
|
||||
AaruConsole.DebugWriteLine("Media-Info command",
|
||||
"READ DISC STRUCTURE: Last-Out Border RMD\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
"READ DISC STRUCTURE: Last-Out Border RMD\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
LastBorderOutRmd = cmdBuf;
|
||||
|
||||
@@ -765,7 +766,7 @@ namespace Aaru.Core.Media.Info
|
||||
|
||||
if(sense)
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Pre-Recorded Info\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
DvdPreRecordedInfo = cmdBuf;
|
||||
}
|
||||
@@ -783,7 +784,7 @@ namespace Aaru.Core.Media.Info
|
||||
|
||||
if(sense)
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DVD-R Media ID\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
DvdrMediaIdentifier = cmdBuf;
|
||||
|
||||
@@ -793,7 +794,7 @@ namespace Aaru.Core.Media.Info
|
||||
|
||||
if(sense)
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DVD-R PFI\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
DvdrPhysicalInformation = cmdBuf;
|
||||
|
||||
@@ -810,7 +811,7 @@ namespace Aaru.Core.Media.Info
|
||||
|
||||
if(sense)
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: ADIP\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
DvdPlusAdip = cmdBuf;
|
||||
|
||||
@@ -819,7 +820,7 @@ namespace Aaru.Core.Media.Info
|
||||
|
||||
if(sense)
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DCB\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
DvdPlusDcb = cmdBuf;
|
||||
|
||||
@@ -834,7 +835,7 @@ namespace Aaru.Core.Media.Info
|
||||
|
||||
if(sense)
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: HD DVD CMI\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
HddvdCopyrightInformation = cmdBuf;
|
||||
|
||||
@@ -850,8 +851,8 @@ namespace Aaru.Core.Media.Info
|
||||
|
||||
if(sense)
|
||||
AaruConsole.DebugWriteLine("Media-Info command",
|
||||
"READ DISC STRUCTURE: HD DVD-R Medium Status\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
"READ DISC STRUCTURE: HD DVD-R Medium Status\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
HddvdrMediumStatus = cmdBuf;
|
||||
|
||||
@@ -860,7 +861,7 @@ namespace Aaru.Core.Media.Info
|
||||
|
||||
if(sense)
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Last RMD\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
HddvdrLastRmd = cmdBuf;
|
||||
}
|
||||
@@ -877,7 +878,7 @@ namespace Aaru.Core.Media.Info
|
||||
|
||||
if(sense)
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Layer Capacity\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
DvdrLayerCapacity = cmdBuf;
|
||||
}
|
||||
@@ -892,8 +893,8 @@ namespace Aaru.Core.Media.Info
|
||||
|
||||
if(sense)
|
||||
AaruConsole.DebugWriteLine("Media-Info command",
|
||||
"READ DISC STRUCTURE: Middle Zone Start\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
"READ DISC STRUCTURE: Middle Zone Start\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
DvdrDlMiddleZoneStart = cmdBuf;
|
||||
|
||||
@@ -902,8 +903,8 @@ namespace Aaru.Core.Media.Info
|
||||
|
||||
if(sense)
|
||||
AaruConsole.DebugWriteLine("Media-Info command",
|
||||
"READ DISC STRUCTURE: Jump Interval Size\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
"READ DISC STRUCTURE: Jump Interval Size\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
DvdrDlJumpIntervalSize = cmdBuf;
|
||||
|
||||
@@ -913,8 +914,8 @@ namespace Aaru.Core.Media.Info
|
||||
|
||||
if(sense)
|
||||
AaruConsole.DebugWriteLine("Media-Info command",
|
||||
"READ DISC STRUCTURE: Manual Layer Jump Start LBA\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
"READ DISC STRUCTURE: Manual Layer Jump Start LBA\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
DvdrDlManualLayerJumpStartLba = cmdBuf;
|
||||
|
||||
@@ -923,8 +924,8 @@ namespace Aaru.Core.Media.Info
|
||||
|
||||
if(sense)
|
||||
AaruConsole.DebugWriteLine("Media-Info command",
|
||||
"READ DISC STRUCTURE: Remap Anchor Point\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
"READ DISC STRUCTURE: Remap Anchor Point\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
DvdrDlRemapAnchorPoint = cmdBuf;
|
||||
|
||||
@@ -942,7 +943,7 @@ namespace Aaru.Core.Media.Info
|
||||
|
||||
if(sense)
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DI\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
BlurayDiscInformation = cmdBuf;
|
||||
|
||||
@@ -951,7 +952,7 @@ namespace Aaru.Core.Media.Info
|
||||
|
||||
if(sense)
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: PAC\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
BlurayPac = cmdBuf;
|
||||
|
||||
@@ -968,7 +969,7 @@ namespace Aaru.Core.Media.Info
|
||||
|
||||
if(sense)
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: BCA\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
BlurayBurstCuttingArea = cmdBuf;
|
||||
|
||||
@@ -985,7 +986,7 @@ namespace Aaru.Core.Media.Info
|
||||
|
||||
if(sense)
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DDS\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
BlurayDds = cmdBuf;
|
||||
|
||||
@@ -994,8 +995,8 @@ namespace Aaru.Core.Media.Info
|
||||
|
||||
if(sense)
|
||||
AaruConsole.DebugWriteLine("Media-Info command",
|
||||
"READ DISC STRUCTURE: Cartridge Status\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
"READ DISC STRUCTURE: Cartridge Status\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
BlurayCartridgeStatus = cmdBuf;
|
||||
|
||||
@@ -1005,8 +1006,8 @@ namespace Aaru.Core.Media.Info
|
||||
|
||||
if(sense)
|
||||
AaruConsole.DebugWriteLine("Media-Info command",
|
||||
"READ DISC STRUCTURE: Spare Area Information\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
"READ DISC STRUCTURE: Spare Area Information\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
BluraySpareAreaInformation = cmdBuf;
|
||||
|
||||
@@ -1015,7 +1016,7 @@ namespace Aaru.Core.Media.Info
|
||||
|
||||
if(sense)
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: Raw DFL\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
BlurayRawDfl = cmdBuf;
|
||||
|
||||
@@ -1024,7 +1025,7 @@ namespace Aaru.Core.Media.Info
|
||||
|
||||
if(sense)
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "READ DISC INFORMATION 001b\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
BlurayTrackResources = cmdBuf;
|
||||
|
||||
@@ -1033,7 +1034,7 @@ namespace Aaru.Core.Media.Info
|
||||
|
||||
if(sense)
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "READ DISC INFORMATION 010b\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
BlurayPowResources = cmdBuf;
|
||||
|
||||
@@ -1053,7 +1054,7 @@ namespace Aaru.Core.Media.Info
|
||||
if(tocSense)
|
||||
{
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: TOC\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1071,7 +1072,7 @@ namespace Aaru.Core.Media.Info
|
||||
if(sense)
|
||||
{
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: ATIP\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1094,7 +1095,7 @@ namespace Aaru.Core.Media.Info
|
||||
if(sense)
|
||||
{
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "READ DISC INFORMATION 000b\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1121,12 +1122,12 @@ namespace Aaru.Core.Media.Info
|
||||
if(sense)
|
||||
{
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: Session info\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
}
|
||||
else
|
||||
{
|
||||
Session = cmdBuf;
|
||||
DecodedSession = Aaru.Decoders.CD.Session.Decode(cmdBuf);
|
||||
DecodedSession = Decoders.CD.Session.Decode(cmdBuf);
|
||||
|
||||
if(DecodedSession.HasValue)
|
||||
{
|
||||
@@ -1140,7 +1141,7 @@ namespace Aaru.Core.Media.Info
|
||||
if(sense)
|
||||
{
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: Raw TOC\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1173,7 +1174,7 @@ namespace Aaru.Core.Media.Info
|
||||
|
||||
if(sense)
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: PMA\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
Pma = cmdBuf;
|
||||
|
||||
@@ -1182,7 +1183,7 @@ namespace Aaru.Core.Media.Info
|
||||
if(sense)
|
||||
{
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "READ TOC/PMA/ATIP: CD-TEXT\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1227,7 +1228,7 @@ namespace Aaru.Core.Media.Info
|
||||
if(sense)
|
||||
{
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: PFI\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1260,7 +1261,7 @@ namespace Aaru.Core.Media.Info
|
||||
|
||||
if(sense)
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "READ DISC STRUCTURE: DMI\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
DvdDmi = cmdBuf;
|
||||
}
|
||||
@@ -1272,7 +1273,7 @@ namespace Aaru.Core.Media.Info
|
||||
if(sense)
|
||||
{
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "READ MEDIA SERIAL NUMBER\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1300,7 +1301,7 @@ namespace Aaru.Core.Media.Info
|
||||
|
||||
if(sense)
|
||||
AaruConsole.DebugWriteLine("Media-Info command", "KREON EXTRACT SS:\n{0}",
|
||||
Sense.PrettifySense(senseBuf));
|
||||
Sense.PrettifySense(senseBuf));
|
||||
else
|
||||
XboxSecuritySector = cmdBuf;
|
||||
|
||||
@@ -1340,7 +1341,7 @@ namespace Aaru.Core.Media.Info
|
||||
}
|
||||
|
||||
AaruConsole.DebugWriteLine("Dump-media command", "Video partition total size: {0} sectors",
|
||||
totalSize);
|
||||
totalSize);
|
||||
|
||||
ulong l0Video = (PFI.Decode(cmdBuf).Value.Layer0EndPSN -
|
||||
PFI.Decode(cmdBuf).Value.DataAreaStartPSN) + 1;
|
||||
@@ -1371,7 +1372,7 @@ namespace Aaru.Core.Media.Info
|
||||
(ulong)((cmdBuf[0] << 24) + (cmdBuf[1] << 16) + (cmdBuf[2] << 8) + cmdBuf[3]) + 1;
|
||||
|
||||
AaruConsole.DebugWriteLine("Dump-media command", "Game partition total size: {0} sectors",
|
||||
gameSize);
|
||||
gameSize);
|
||||
|
||||
// Get middle zone size
|
||||
AaruConsole.DebugWriteLine("Dump-media command", "Getting middle zone size");
|
||||
@@ -1406,7 +1407,7 @@ namespace Aaru.Core.Media.Info
|
||||
}
|
||||
|
||||
AaruConsole.DebugWriteLine("Dump-media command", "Unlocked total size: {0} sectors",
|
||||
totalSize);
|
||||
totalSize);
|
||||
|
||||
ulong middleZone =
|
||||
(totalSize -
|
||||
@@ -1505,7 +1506,7 @@ namespace Aaru.Core.Media.Info
|
||||
public Dictionary<byte, string> Isrcs { get; }
|
||||
public bool MediaInserted { get; }
|
||||
public MediaType MediaType { get; }
|
||||
public Devices.Info.DeviceInfo DeviceInfo { get; }
|
||||
public DeviceInfo DeviceInfo { get; }
|
||||
public byte[] ReadCapacity { get; }
|
||||
public ulong Blocks { get; }
|
||||
public uint BlockSize { get; }
|
||||
|
||||
@@ -46,9 +46,10 @@ namespace Aaru.Core
|
||||
bool inValue = false;
|
||||
string name = null;
|
||||
string value;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
var sb = new StringBuilder();
|
||||
|
||||
if(options == null) return parsed;
|
||||
if(options == null)
|
||||
return parsed;
|
||||
|
||||
for(int index = 0; index < options.Length; index++)
|
||||
{
|
||||
@@ -58,31 +59,40 @@ namespace Aaru.Core
|
||||
{
|
||||
case '\\' when !escaped:
|
||||
escaped = true;
|
||||
|
||||
break;
|
||||
case '"' when !escaped:
|
||||
quoted = !quoted;
|
||||
|
||||
break;
|
||||
case '=' when quoted:
|
||||
sb.Append(c);
|
||||
|
||||
break;
|
||||
case '=':
|
||||
name = sb.ToString().ToLower(CultureInfo.CurrentCulture);
|
||||
sb = new StringBuilder();
|
||||
inValue = true;
|
||||
|
||||
break;
|
||||
case ',' when quoted:
|
||||
sb.Append(c);
|
||||
|
||||
break;
|
||||
case ',' when inValue:
|
||||
value = sb.ToString();
|
||||
sb = new StringBuilder();
|
||||
inValue = false;
|
||||
|
||||
if(string.IsNullOrEmpty(name) || string.IsNullOrEmpty(value)) continue;
|
||||
if(string.IsNullOrEmpty(name) ||
|
||||
string.IsNullOrEmpty(value))
|
||||
continue;
|
||||
|
||||
if(parsed.ContainsKey(name)) parsed.Remove(name);
|
||||
if(parsed.ContainsKey(name))
|
||||
parsed.Remove(name);
|
||||
|
||||
parsed.Add(name, value);
|
||||
|
||||
break;
|
||||
default:
|
||||
if(escaped)
|
||||
@@ -91,76 +101,96 @@ namespace Aaru.Core
|
||||
case 'a':
|
||||
sb.Append('\a');
|
||||
escaped = false;
|
||||
|
||||
break;
|
||||
case 'b':
|
||||
sb.Append('\b');
|
||||
escaped = false;
|
||||
|
||||
break;
|
||||
case 'f':
|
||||
sb.Append('\f');
|
||||
escaped = false;
|
||||
|
||||
break;
|
||||
case 'n':
|
||||
sb.Append('\n');
|
||||
escaped = false;
|
||||
|
||||
break;
|
||||
case 'r':
|
||||
sb.Append('\r');
|
||||
escaped = false;
|
||||
|
||||
break;
|
||||
case 't':
|
||||
sb.Append('\t');
|
||||
escaped = false;
|
||||
|
||||
break;
|
||||
case 'v':
|
||||
sb.Append('\v');
|
||||
escaped = false;
|
||||
|
||||
break;
|
||||
case '\\':
|
||||
sb.Append('\\');
|
||||
escaped = false;
|
||||
|
||||
break;
|
||||
case '\'':
|
||||
sb.Append('\'');
|
||||
escaped = false;
|
||||
|
||||
break;
|
||||
case '"':
|
||||
sb.Append('"');
|
||||
escaped = false;
|
||||
|
||||
break;
|
||||
case '0':
|
||||
sb.Append('\0');
|
||||
escaped = false;
|
||||
|
||||
break;
|
||||
case 'u':
|
||||
string unicode = options.Substring(index + 1, 4);
|
||||
sb.Append((char)int.Parse(unicode, NumberStyles.HexNumber));
|
||||
escaped = false;
|
||||
index += 4;
|
||||
|
||||
break;
|
||||
case 'U':
|
||||
string longUnicode = options.Substring(index + 1, 8);
|
||||
sb.Append((char)int.Parse(longUnicode, NumberStyles.HexNumber));
|
||||
escaped = false;
|
||||
index += 8;
|
||||
|
||||
break;
|
||||
default:
|
||||
sb.Append(c);
|
||||
escaped = false;
|
||||
|
||||
break;
|
||||
}
|
||||
else sb.Append(c);
|
||||
else
|
||||
sb.Append(c);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!inValue) return parsed;
|
||||
if(!inValue)
|
||||
return parsed;
|
||||
|
||||
value = sb.ToString();
|
||||
|
||||
if(string.IsNullOrEmpty(name) || string.IsNullOrEmpty(value)) return parsed;
|
||||
if(string.IsNullOrEmpty(name) ||
|
||||
string.IsNullOrEmpty(value))
|
||||
return parsed;
|
||||
|
||||
if(parsed.ContainsKey(name)) parsed.Remove(name);
|
||||
if(parsed.ContainsKey(name))
|
||||
parsed.Remove(name);
|
||||
|
||||
parsed.Add(name, value);
|
||||
|
||||
|
||||
@@ -40,14 +40,10 @@ using Aaru.Partitions;
|
||||
|
||||
namespace Aaru.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements methods for handling partitions
|
||||
/// </summary>
|
||||
/// <summary>Implements methods for handling partitions</summary>
|
||||
public static class Partitions
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a list of all partitions present in the specified image
|
||||
/// </summary>
|
||||
/// <summary>Gets a list of all partitions present in the specified image</summary>
|
||||
/// <param name="image">Image</param>
|
||||
/// <returns>List of found partitions</returns>
|
||||
public static List<Partition> GetAll(IMediaImage image)
|
||||
@@ -57,8 +53,8 @@ namespace Aaru.Core
|
||||
List<Partition> childPartitions = new List<Partition>();
|
||||
List<ulong> checkedLocations = new List<ulong>();
|
||||
|
||||
ITapeImage tapeImage = image as ITapeImage;
|
||||
IPartitionableMediaImage partitionableImage = image as IPartitionableMediaImage;
|
||||
var tapeImage = image as ITapeImage;
|
||||
var partitionableImage = image as IPartitionableMediaImage;
|
||||
|
||||
// Create partitions from image files
|
||||
if(tapeImage?.Files != null)
|
||||
@@ -68,12 +64,14 @@ namespace Aaru.Core
|
||||
if(partitionPlugin.GetInformation(image, out List<Partition> partitions, tapeFile.FirstBlock))
|
||||
{
|
||||
foundPartitions.AddRange(partitions);
|
||||
|
||||
AaruConsole.DebugWriteLine("Partitions", "Found {0} @ {1}", partitionPlugin.Name,
|
||||
tapeFile.FirstBlock);
|
||||
tapeFile.FirstBlock);
|
||||
}
|
||||
|
||||
checkedLocations.Add(tapeFile.FirstBlock);
|
||||
}
|
||||
|
||||
// Getting all partitions from device (e.g. tracks)
|
||||
else if(partitionableImage?.Partitions != null)
|
||||
foreach(Partition imagePartition in partitionableImage.Partitions)
|
||||
@@ -82,12 +80,14 @@ namespace Aaru.Core
|
||||
if(partitionPlugin.GetInformation(image, out List<Partition> partitions, imagePartition.Start))
|
||||
{
|
||||
foundPartitions.AddRange(partitions);
|
||||
|
||||
AaruConsole.DebugWriteLine("Partitions", "Found {0} @ {1}", partitionPlugin.Name,
|
||||
imagePartition.Start);
|
||||
imagePartition.Start);
|
||||
}
|
||||
|
||||
checkedLocations.Add(imagePartition.Start);
|
||||
}
|
||||
|
||||
// Getting all partitions at start of device
|
||||
else
|
||||
{
|
||||
@@ -107,6 +107,7 @@ namespace Aaru.Core
|
||||
{
|
||||
childPartitions.Add(foundPartitions[0]);
|
||||
foundPartitions.RemoveAt(0);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -115,12 +116,14 @@ namespace Aaru.Core
|
||||
foreach(IPartition partitionPlugin in plugins.PartPluginsList.Values)
|
||||
{
|
||||
AaruConsole.DebugWriteLine("Partitions", "Trying {0} @ {1}", partitionPlugin.Name,
|
||||
foundPartitions[0].Start);
|
||||
foundPartitions[0].Start);
|
||||
|
||||
if(!partitionPlugin.GetInformation(image, out List<Partition> partitions, foundPartitions[0].Start))
|
||||
continue;
|
||||
|
||||
AaruConsole.DebugWriteLine("Partitions", "Found {0} @ {1}", partitionPlugin.Name,
|
||||
foundPartitions[0].Start);
|
||||
foundPartitions[0].Start);
|
||||
|
||||
childs.AddRange(partitions);
|
||||
}
|
||||
|
||||
@@ -133,8 +136,10 @@ namespace Aaru.Core
|
||||
foundPartitions.RemoveAt(0);
|
||||
|
||||
foreach(Partition child in childs)
|
||||
if(checkedLocations.Contains(child.Start)) childPartitions.Add(child);
|
||||
else foundPartitions.Add(child);
|
||||
if(checkedLocations.Contains(child.Start))
|
||||
childPartitions.Add(child);
|
||||
else
|
||||
foundPartitions.Add(child);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -142,7 +147,7 @@ namespace Aaru.Core
|
||||
foundPartitions.RemoveAt(0);
|
||||
}
|
||||
|
||||
AaruConsole.DebugWriteLine("Partitions", "Got {0} parents", foundPartitions.Count);
|
||||
AaruConsole.DebugWriteLine("Partitions", "Got {0} parents", foundPartitions.Count);
|
||||
AaruConsole.DebugWriteLine("Partitions", "Got {0} partitions", childPartitions.Count);
|
||||
}
|
||||
|
||||
@@ -153,12 +158,11 @@ namespace Aaru.Core
|
||||
childPartitions.Select(detectedPartition => detectedPartition.Start).ToList();
|
||||
|
||||
if(tapeImage.Files != null)
|
||||
childPartitions.AddRange(tapeImage.Files.Where(f => !startLocations.Contains(f.FirstBlock))
|
||||
.Select(tapeFile => new Partition
|
||||
childPartitions.AddRange(tapeImage.Files.Where(f => !startLocations.Contains(f.FirstBlock)).
|
||||
Select(tapeFile => new Partition
|
||||
{
|
||||
Start = tapeFile.FirstBlock,
|
||||
Length = tapeFile.LastBlock -
|
||||
tapeFile.FirstBlock + 1,
|
||||
Start = tapeFile.FirstBlock,
|
||||
Length = (tapeFile.LastBlock - tapeFile.FirstBlock) + 1,
|
||||
Sequence = tapeFile.File
|
||||
}));
|
||||
}
|
||||
@@ -169,34 +173,36 @@ namespace Aaru.Core
|
||||
|
||||
if(partitionableImage.Partitions != null)
|
||||
childPartitions.AddRange(partitionableImage.Partitions.Where(imagePartition =>
|
||||
!startLocations
|
||||
.Contains(imagePartition
|
||||
.Start)));
|
||||
!startLocations.
|
||||
Contains(imagePartition.
|
||||
Start)));
|
||||
}
|
||||
|
||||
Partition[] childArray = childPartitions
|
||||
.OrderBy(part => part.Start).ThenBy(part => part.Length).ThenBy(part => part.Scheme)
|
||||
.ToArray();
|
||||
Partition[] childArray = childPartitions.
|
||||
OrderBy(part => part.Start).ThenBy(part => part.Length).
|
||||
ThenBy(part => part.Scheme).ToArray();
|
||||
|
||||
for(long i = 0; i < childArray.LongLength; i++) childArray[i].Sequence = (ulong)i;
|
||||
for(long i = 0; i < childArray.LongLength; i++)
|
||||
childArray[i].Sequence = (ulong)i;
|
||||
|
||||
return childArray.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds all partition schemes from the specified list of partitions to statistics
|
||||
/// </summary>
|
||||
/// <summary>Adds all partition schemes from the specified list of partitions to statistics</summary>
|
||||
/// <param name="partitions">List of partitions</param>
|
||||
public static void AddSchemesToStats(List<Partition> partitions)
|
||||
{
|
||||
if(partitions == null || partitions.Count == 0) return;
|
||||
if(partitions == null ||
|
||||
partitions.Count == 0)
|
||||
return;
|
||||
|
||||
List<string> schemes = new List<string>();
|
||||
|
||||
foreach(Partition part in partitions.Where(part => !schemes.Contains(part.Scheme)))
|
||||
schemes.Add(part.Scheme);
|
||||
|
||||
foreach(string scheme in schemes) Statistics.AddPartition(scheme);
|
||||
foreach(string scheme in schemes)
|
||||
Statistics.AddPartition(scheme);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,7 @@ namespace Aaru.Core
|
||||
{
|
||||
if(page.Subpage != 0)
|
||||
AaruConsole.WriteLine("Found unknown vendor mode page {0:X2}h subpage {1:X2}h",
|
||||
page.Page, page.Subpage);
|
||||
page.Page, page.Subpage);
|
||||
else
|
||||
AaruConsole.WriteLine("Found unknown vendor mode page {0:X2}h", page.Page);
|
||||
}
|
||||
@@ -70,8 +70,8 @@ namespace Aaru.Core
|
||||
{
|
||||
if(page.Subpage == 0)
|
||||
AaruConsole.WriteLine(devType == PeripheralDeviceTypes.MultiMediaDevice
|
||||
? Modes.PrettifyModePage_01_MMC(page.PageResponse)
|
||||
: Modes.PrettifyModePage_01(page.PageResponse));
|
||||
? Modes.PrettifyModePage_01_MMC(page.PageResponse)
|
||||
: Modes.PrettifyModePage_01(page.PageResponse));
|
||||
else
|
||||
goto default;
|
||||
|
||||
@@ -126,8 +126,8 @@ namespace Aaru.Core
|
||||
{
|
||||
if(page.Subpage == 0)
|
||||
AaruConsole.WriteLine(devType == PeripheralDeviceTypes.MultiMediaDevice
|
||||
? Modes.PrettifyModePage_07_MMC(page.PageResponse)
|
||||
: Modes.PrettifyModePage_07(page.PageResponse));
|
||||
? Modes.PrettifyModePage_07_MMC(page.PageResponse)
|
||||
: Modes.PrettifyModePage_07(page.PageResponse));
|
||||
else
|
||||
goto default;
|
||||
|
||||
@@ -193,8 +193,8 @@ namespace Aaru.Core
|
||||
{
|
||||
if(page.Subpage == 0)
|
||||
AaruConsole.WriteLine(devType == PeripheralDeviceTypes.SequentialAccess
|
||||
? Modes.PrettifyModePage_10_SSC(page.PageResponse)
|
||||
: Modes.PrettifyModePage_10(page.PageResponse));
|
||||
? Modes.PrettifyModePage_10_SSC(page.PageResponse)
|
||||
: Modes.PrettifyModePage_10(page.PageResponse));
|
||||
else
|
||||
goto default;
|
||||
|
||||
@@ -244,8 +244,8 @@ namespace Aaru.Core
|
||||
{
|
||||
if(page.Subpage == 0)
|
||||
AaruConsole.WriteLine(devType == PeripheralDeviceTypes.MultiMediaDevice
|
||||
? Modes.PrettifyModePage_1C_SFF(page.PageResponse)
|
||||
: Modes.PrettifyModePage_1C(page.PageResponse));
|
||||
? Modes.PrettifyModePage_1C_SFF(page.PageResponse)
|
||||
: Modes.PrettifyModePage_1C(page.PageResponse));
|
||||
else if(page.Subpage == 1)
|
||||
AaruConsole.WriteLine(Modes.PrettifyModePage_1C_S01(page.PageResponse));
|
||||
else
|
||||
@@ -360,7 +360,7 @@ namespace Aaru.Core
|
||||
{
|
||||
if(page.Subpage != 0)
|
||||
AaruConsole.WriteLine("Found unknown mode page {0:X2}h subpage {1:X2}h", page.Page,
|
||||
page.Subpage);
|
||||
page.Subpage);
|
||||
else
|
||||
AaruConsole.WriteLine("Found unknown mode page {0:X2}h", page.Page);
|
||||
|
||||
|
||||
@@ -50,34 +50,30 @@ using Version = Aaru.CommonTypes.Metadata.Version;
|
||||
|
||||
namespace Aaru.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Handles connections to Aaru.Server
|
||||
/// </summary>
|
||||
/// <summary>Handles connections to Aaru.Server</summary>
|
||||
public static class Remote
|
||||
{
|
||||
/// <summary>
|
||||
/// Submits a device report
|
||||
/// </summary>
|
||||
/// <summary>Submits a device report</summary>
|
||||
/// <param name="report">Device report</param>
|
||||
public static void SubmitReport(DeviceReportV2 report)
|
||||
{
|
||||
Thread submitThread = new Thread(() =>
|
||||
var submitThread = new Thread(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
#if DEBUG
|
||||
#if DEBUG
|
||||
System.Console.WriteLine("Uploading device report");
|
||||
#else
|
||||
#else
|
||||
Aaru.Console.AaruConsole.DebugWriteLine("Submit stats", "Uploading device report");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
string json = JsonConvert.SerializeObject(report, Formatting.Indented,
|
||||
new JsonSerializerSettings
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore
|
||||
});
|
||||
byte[] jsonBytes = Encoding.UTF8.GetBytes(json);
|
||||
WebRequest request = WebRequest.Create("https://www.aaru.app/api/uploadreportv2");
|
||||
string json = JsonConvert.SerializeObject(report, Formatting.Indented, new JsonSerializerSettings
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore
|
||||
});
|
||||
|
||||
byte[] jsonBytes = Encoding.UTF8.GetBytes(json);
|
||||
var request = WebRequest.Create("https://www.aaru.app/api/uploadreportv2");
|
||||
((HttpWebRequest)request).UserAgent = $"Aaru {typeof(Version).Assembly.GetName().Version}";
|
||||
request.Method = "POST";
|
||||
request.ContentLength = jsonBytes.Length;
|
||||
@@ -87,10 +83,11 @@ namespace Aaru.Core
|
||||
reqStream.Close();
|
||||
WebResponse response = request.GetResponse();
|
||||
|
||||
if(((HttpWebResponse)response).StatusCode != HttpStatusCode.OK) return;
|
||||
if(((HttpWebResponse)response).StatusCode != HttpStatusCode.OK)
|
||||
return;
|
||||
|
||||
Stream data = response.GetResponseStream();
|
||||
StreamReader reader = new StreamReader(data ?? throw new InvalidOperationException());
|
||||
Stream data = response.GetResponseStream();
|
||||
var reader = new StreamReader(data ?? throw new InvalidOperationException());
|
||||
|
||||
reader.ReadToEnd();
|
||||
data.Close();
|
||||
@@ -100,20 +97,23 @@ namespace Aaru.Core
|
||||
{
|
||||
// Can't connect to the server, do nothing
|
||||
}
|
||||
|
||||
// ReSharper disable once RedundantCatchClause
|
||||
catch
|
||||
{
|
||||
#if DEBUG
|
||||
if(Debugger.IsAttached) throw;
|
||||
#endif
|
||||
#if DEBUG
|
||||
if(Debugger.IsAttached)
|
||||
throw;
|
||||
#endif
|
||||
}
|
||||
});
|
||||
|
||||
submitThread.Start();
|
||||
}
|
||||
|
||||
public static void UpdateMasterDatabase(bool create)
|
||||
{
|
||||
AaruContext mctx = AaruContext.Create(Aaru.Settings.Settings.MasterDbPath);
|
||||
var mctx = AaruContext.Create(Settings.Settings.MasterDbPath);
|
||||
mctx.Database.Migrate();
|
||||
mctx.SaveChanges();
|
||||
|
||||
@@ -125,10 +125,18 @@ namespace Aaru.Core
|
||||
if(!create)
|
||||
{
|
||||
List<DateTime> latestAll = new List<DateTime>();
|
||||
if(mctx.UsbVendors.Any()) latestAll.Add(mctx.UsbVendors.Max(v => v.ModifiedWhen));
|
||||
if(mctx.UsbProducts.Any()) latestAll.Add(mctx.UsbProducts.Max(p => p.ModifiedWhen));
|
||||
if(mctx.CdOffsets.Any()) latestAll.Add(mctx.CdOffsets.Max(o => o.ModifiedWhen));
|
||||
if(mctx.Devices.Any()) latestAll.Add(mctx.Devices.Max(d => d.LastSynchronized));
|
||||
|
||||
if(mctx.UsbVendors.Any())
|
||||
latestAll.Add(mctx.UsbVendors.Max(v => v.ModifiedWhen));
|
||||
|
||||
if(mctx.UsbProducts.Any())
|
||||
latestAll.Add(mctx.UsbProducts.Max(p => p.ModifiedWhen));
|
||||
|
||||
if(mctx.CdOffsets.Any())
|
||||
latestAll.Add(mctx.CdOffsets.Max(o => o.ModifiedWhen));
|
||||
|
||||
if(mctx.Devices.Any())
|
||||
latestAll.Add(mctx.Devices.Max(d => d.LastSynchronized));
|
||||
|
||||
if(latestAll.Any())
|
||||
{
|
||||
@@ -150,8 +158,7 @@ namespace Aaru.Core
|
||||
|
||||
DateTime updateStart = DateTime.UtcNow;
|
||||
|
||||
WebRequest request =
|
||||
WebRequest.Create($"https://www.aaru.app/api/update?timestamp={lastUpdate}");
|
||||
var request = WebRequest.Create($"https://www.aaru.app/api/update?timestamp={lastUpdate}");
|
||||
((HttpWebRequest)request).UserAgent = $"Aaru {typeof(Version).Assembly.GetName().Version}";
|
||||
request.Method = "GET";
|
||||
request.ContentType = "application/json";
|
||||
@@ -160,36 +167,48 @@ namespace Aaru.Core
|
||||
if(((HttpWebResponse)response).StatusCode != HttpStatusCode.OK)
|
||||
{
|
||||
AaruConsole.ErrorWriteLine("Error {0} when trying to get updated entities.",
|
||||
((HttpWebResponse)response).StatusCode);
|
||||
((HttpWebResponse)response).StatusCode);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Stream data = response.GetResponseStream();
|
||||
StreamReader reader = new StreamReader(data ?? throw new InvalidOperationException());
|
||||
SyncDto sync = JsonConvert.DeserializeObject<SyncDto>(reader.ReadToEnd());
|
||||
Stream data = response.GetResponseStream();
|
||||
var reader = new StreamReader(data ?? throw new InvalidOperationException());
|
||||
SyncDto sync = JsonConvert.DeserializeObject<SyncDto>(reader.ReadToEnd());
|
||||
|
||||
if(create)
|
||||
{
|
||||
AaruConsole.WriteLine("Adding USB vendors");
|
||||
|
||||
foreach(UsbVendorDto vendor in sync.UsbVendors)
|
||||
mctx.UsbVendors.Add(new UsbVendor(vendor.VendorId, vendor.Vendor));
|
||||
|
||||
AaruConsole.WriteLine("Added {0} usb vendors", sync.UsbVendors.Count);
|
||||
|
||||
AaruConsole.WriteLine("Adding USB products");
|
||||
|
||||
foreach(UsbProductDto product in sync.UsbProducts)
|
||||
mctx.UsbProducts.Add(new UsbProduct(product.VendorId, product.ProductId, product.Product));
|
||||
|
||||
AaruConsole.WriteLine("Added {0} usb products", sync.UsbProducts.Count);
|
||||
|
||||
AaruConsole.WriteLine("Adding CompactDisc read offsets");
|
||||
|
||||
foreach(CdOffsetDto offset in sync.Offsets)
|
||||
mctx.CdOffsets.Add(new CdOffset(offset) {Id = offset.Id});
|
||||
mctx.CdOffsets.Add(new CdOffset(offset)
|
||||
{
|
||||
Id = offset.Id
|
||||
});
|
||||
|
||||
AaruConsole.WriteLine("Added {0} CompactDisc read offsets", sync.Offsets.Count);
|
||||
|
||||
AaruConsole.WriteLine("Adding known devices");
|
||||
foreach(DeviceDto device in sync.Devices) mctx.Devices.Add(new Device(device) {Id = device.Id});
|
||||
|
||||
foreach(DeviceDto device in sync.Devices)
|
||||
mctx.Devices.Add(new Device(device)
|
||||
{
|
||||
Id = device.Id
|
||||
});
|
||||
|
||||
AaruConsole.WriteLine("Added {0} known devices", sync.Devices.Count);
|
||||
}
|
||||
@@ -205,6 +224,7 @@ namespace Aaru.Core
|
||||
long modifiedDevices = 0;
|
||||
|
||||
AaruConsole.WriteLine("Updating USB vendors");
|
||||
|
||||
foreach(UsbVendorDto vendor in sync.UsbVendors)
|
||||
{
|
||||
UsbVendor existing = mctx.UsbVendors.FirstOrDefault(v => v.Id == vendor.VendorId);
|
||||
@@ -223,10 +243,11 @@ namespace Aaru.Core
|
||||
}
|
||||
}
|
||||
|
||||
AaruConsole.WriteLine("Added {0} USB vendors", addedVendors);
|
||||
AaruConsole.WriteLine("Added {0} USB vendors", addedVendors);
|
||||
AaruConsole.WriteLine("Modified {0} USB vendors", modifiedVendors);
|
||||
|
||||
AaruConsole.WriteLine("Updating USB products");
|
||||
|
||||
foreach(UsbProductDto product in sync.UsbProducts)
|
||||
{
|
||||
UsbProduct existing =
|
||||
@@ -247,10 +268,11 @@ namespace Aaru.Core
|
||||
}
|
||||
}
|
||||
|
||||
AaruConsole.WriteLine("Added {0} USB products", addedProducts);
|
||||
AaruConsole.WriteLine("Added {0} USB products", addedProducts);
|
||||
AaruConsole.WriteLine("Modified {0} USB products", modifiedProducts);
|
||||
|
||||
AaruConsole.WriteLine("Updating CompactDisc read offsets");
|
||||
|
||||
foreach(CdOffsetDto offset in sync.Offsets)
|
||||
{
|
||||
CdOffset existing = mctx.CdOffsets.FirstOrDefault(o => o.Id == offset.Id);
|
||||
@@ -269,14 +291,19 @@ namespace Aaru.Core
|
||||
else
|
||||
{
|
||||
addedOffsets++;
|
||||
mctx.CdOffsets.Add(new CdOffset(offset) {Id = offset.Id});
|
||||
|
||||
mctx.CdOffsets.Add(new CdOffset(offset)
|
||||
{
|
||||
Id = offset.Id
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
AaruConsole.WriteLine("Added {0} CompactDisc read offsets", addedOffsets);
|
||||
AaruConsole.WriteLine("Added {0} CompactDisc read offsets", addedOffsets);
|
||||
AaruConsole.WriteLine("Modified {0} CompactDisc read offsets", modifiedOffsets);
|
||||
|
||||
AaruConsole.WriteLine("Updating known devices");
|
||||
|
||||
foreach(DeviceDto device in sync.Devices)
|
||||
{
|
||||
Device existing = mctx.Devices.FirstOrDefault(d => d.Id == device.Id);
|
||||
@@ -297,19 +324,22 @@ namespace Aaru.Core
|
||||
else
|
||||
{
|
||||
addedDevices++;
|
||||
|
||||
mctx.Devices.Add(new Device(device)
|
||||
{
|
||||
Id = device.Id,
|
||||
OptimalMultipleSectorsRead = device.OptimalMultipleSectorsRead
|
||||
Id = device.Id, OptimalMultipleSectorsRead = device.OptimalMultipleSectorsRead
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
AaruConsole.WriteLine("Added {0} known devices", addedDevices);
|
||||
AaruConsole.WriteLine("Added {0} known devices", addedDevices);
|
||||
AaruConsole.WriteLine("Modified {0} known devices", modifiedDevices);
|
||||
}
|
||||
}
|
||||
catch(Exception ex) { AaruConsole.ErrorWriteLine("Exception {0} when updating database.", ex); }
|
||||
catch(Exception ex)
|
||||
{
|
||||
AaruConsole.ErrorWriteLine("Exception {0} when updating database.", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
AaruConsole.WriteLine("Saving changes...");
|
||||
|
||||
@@ -43,9 +43,7 @@ namespace Aaru.Core
|
||||
public partial class Sidecar
|
||||
{
|
||||
// TODO: Complete it
|
||||
/// <summary>
|
||||
/// Creates a metadata sidecar for an audio media (e.g. cassette)
|
||||
/// </summary>
|
||||
/// <summary>Creates a metadata sidecar for an audio media (e.g. cassette)</summary>
|
||||
/// <param name="image">Image</param>
|
||||
/// <param name="filterId">Filter uuid</param>
|
||||
/// <param name="imagePath">Image path</param>
|
||||
@@ -53,28 +51,26 @@ namespace Aaru.Core
|
||||
/// <param name="plugins">Image plugins</param>
|
||||
/// <param name="imgChecksums">List of image checksums</param>
|
||||
/// <param name="sidecar">Metadata sidecar</param>
|
||||
static void AudioMedia(IMediaImage image, Guid filterId, string imagePath,
|
||||
FileInfo fi, PluginBase plugins,
|
||||
static void AudioMedia(IMediaImage image, Guid filterId, string imagePath, FileInfo fi, PluginBase plugins,
|
||||
List<ChecksumType> imgChecksums, ref CICMMetadataType sidecar, Encoding encoding)
|
||||
{
|
||||
sidecar.AudioMedia = new[]
|
||||
{
|
||||
new AudioMediaType
|
||||
{
|
||||
Checksums = imgChecksums.ToArray(),
|
||||
Image = new ImageType
|
||||
Checksums = imgChecksums.ToArray(), Image = new ImageType
|
||||
{
|
||||
format = image.Format,
|
||||
offset = 0,
|
||||
offsetSpecified = true,
|
||||
Value = Path.GetFileName(imagePath)
|
||||
format = image.Format, offset = 0, offsetSpecified = true, Value = Path.GetFileName(imagePath)
|
||||
},
|
||||
Size = (ulong)fi.Length,
|
||||
Sequence = new SequenceType {MediaTitle = image.Info.MediaTitle}
|
||||
Size = (ulong)fi.Length, Sequence = new SequenceType
|
||||
{
|
||||
MediaTitle = image.Info.MediaTitle
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if(image.Info.MediaSequence != 0 && image.Info.LastMediaSequence != 0)
|
||||
if(image.Info.MediaSequence != 0 &&
|
||||
image.Info.LastMediaSequence != 0)
|
||||
{
|
||||
sidecar.AudioMedia[0].Sequence.MediaSequence = (uint)image.Info.MediaSequence;
|
||||
sidecar.AudioMedia[0].Sequence.TotalMedia = (uint)image.Info.LastMediaSequence;
|
||||
|
||||
@@ -40,14 +40,12 @@ using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.CommonTypes.Metadata;
|
||||
using Aaru.CommonTypes.Structs;
|
||||
using Aaru.CommonTypes.Structs.Devices.ATA;
|
||||
using Aaru.Console;
|
||||
using Aaru.Decoders.ATA;
|
||||
using Aaru.Decoders.PCMCIA;
|
||||
using Aaru.DiscImages;
|
||||
using Aaru.Filters;
|
||||
using Aaru.CommonTypes.Structs.Devices.ATA;
|
||||
using Schemas;
|
||||
using Identify = Aaru.CommonTypes.Structs.Devices.ATA.Identify;
|
||||
using MediaType = Aaru.CommonTypes.Metadata.MediaType;
|
||||
using Tuple = Aaru.Decoders.PCMCIA.Tuple;
|
||||
|
||||
@@ -152,8 +150,7 @@ namespace Aaru.Core
|
||||
|
||||
if(manfid != null)
|
||||
{
|
||||
sidecar.BlockMedia[0].PCMCIA.ManufacturerCode =
|
||||
manfid.ManufacturerID;
|
||||
sidecar.BlockMedia[0].PCMCIA.ManufacturerCode = manfid.ManufacturerID;
|
||||
|
||||
sidecar.BlockMedia[0].PCMCIA.CardCode = manfid.CardID;
|
||||
sidecar.BlockMedia[0].PCMCIA.ManufacturerCodeSpecified = true;
|
||||
@@ -417,7 +414,7 @@ namespace Aaru.Core
|
||||
//goto skipImageChecksum;
|
||||
|
||||
uint sectorsToRead = 64;
|
||||
ulong sectors = tapePartition.LastBlock - tapePartition.FirstBlock + 1;
|
||||
ulong sectors = (tapePartition.LastBlock - tapePartition.FirstBlock) + 1;
|
||||
ulong doneSectors = 0;
|
||||
|
||||
InitProgress2();
|
||||
@@ -492,7 +489,7 @@ namespace Aaru.Core
|
||||
//goto skipImageChecksum;
|
||||
|
||||
uint sectorsToRead = 64;
|
||||
ulong sectors = tapeFile.LastBlock - tapeFile.FirstBlock + 1;
|
||||
ulong sectors = (tapeFile.LastBlock - tapeFile.FirstBlock) + 1;
|
||||
ulong doneSectors = 0;
|
||||
|
||||
InitProgress2();
|
||||
@@ -861,10 +858,10 @@ namespace Aaru.Core
|
||||
{
|
||||
scpImage.Open(scpFilter);
|
||||
}
|
||||
catch(NotImplementedException) { }
|
||||
catch(NotImplementedException) {}
|
||||
|
||||
if(image.Info.Heads == 2 && scpImage.Header.heads == 0 ||
|
||||
image.Info.Heads == 1 && (scpImage.Header.heads == 1 || scpImage.Header.heads == 2))
|
||||
if((image.Info.Heads == 2 && scpImage.Header.heads == 0) ||
|
||||
(image.Info.Heads == 1 && (scpImage.Header.heads == 1 || scpImage.Header.heads == 2)))
|
||||
if(scpImage.Header.end + 1 >= image.Info.Cylinders)
|
||||
{
|
||||
List<BlockTrackType> scpBlockTrackTypes = new List<BlockTrackType>();
|
||||
@@ -899,8 +896,9 @@ namespace Aaru.Core
|
||||
if(scpImage.ScpTracks.TryGetValue(t, out SuperCardPro.TrackHeader scpTrack))
|
||||
{
|
||||
byte[] trackContents =
|
||||
new byte[scpTrack.Entries.Last().dataOffset +
|
||||
scpTrack.Entries.Last().trackLength - scpImage.Header.offsets[t] + 1];
|
||||
new byte[((scpTrack.Entries.Last().dataOffset +
|
||||
scpTrack.Entries.Last().trackLength) - scpImage.Header.offsets[t]) +
|
||||
1];
|
||||
|
||||
scpStream.Position = scpImage.Header.offsets[t];
|
||||
scpStream.Read(trackContents, 0, trackContents.Length);
|
||||
@@ -967,7 +965,7 @@ namespace Aaru.Core
|
||||
{
|
||||
kfImage.Open(kfFilter);
|
||||
}
|
||||
catch(NotImplementedException) { }
|
||||
catch(NotImplementedException) {}
|
||||
|
||||
if(kfImage.Info.Heads == image.Info.Heads)
|
||||
if(kfImage.Info.Cylinders >= image.Info.Cylinders)
|
||||
@@ -1051,7 +1049,7 @@ namespace Aaru.Core
|
||||
{
|
||||
dfiImage.Open(dfiFilter);
|
||||
}
|
||||
catch(NotImplementedException) { }
|
||||
catch(NotImplementedException) {}
|
||||
|
||||
UpdateStatus("Hashing DiscFerret image...");
|
||||
|
||||
|
||||
@@ -38,9 +38,7 @@ namespace Aaru.Core
|
||||
{
|
||||
public partial class Sidecar
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a metadata sidecar for a block tape (e.g. scsi streaming)
|
||||
/// </summary>
|
||||
/// <summary>Creates a metadata sidecar for a block tape (e.g. scsi streaming)</summary>
|
||||
/// <param name="files">List of files</param>
|
||||
/// <param name="folderName">Dump path</param>
|
||||
/// <param name="blockSize">Expected block size in bytes</param>
|
||||
@@ -52,24 +50,21 @@ namespace Aaru.Core
|
||||
{
|
||||
new BlockMediaType
|
||||
{
|
||||
Image =
|
||||
new ImageType
|
||||
{
|
||||
format = "Directory", offsetSpecified = false, Value = folderName
|
||||
},
|
||||
Sequence =
|
||||
new SequenceType {MediaTitle = folderName, MediaSequence = 1, TotalMedia = 1},
|
||||
PhysicalBlockSize = blockSize,
|
||||
LogicalBlockSize = blockSize,
|
||||
TapeInformation = new[]
|
||||
Image = new ImageType
|
||||
{
|
||||
format = "Directory", offsetSpecified = false, Value = folderName
|
||||
},
|
||||
Sequence = new SequenceType
|
||||
{
|
||||
MediaTitle = folderName, MediaSequence = 1, TotalMedia = 1
|
||||
},
|
||||
PhysicalBlockSize = blockSize, LogicalBlockSize = blockSize, TapeInformation = new[]
|
||||
{
|
||||
new TapePartitionType
|
||||
{
|
||||
Image = new ImageType
|
||||
{
|
||||
format = "Directory",
|
||||
offsetSpecified = false,
|
||||
Value = folderName
|
||||
format = "Directory", offsetSpecified = false, Value = folderName
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -77,32 +72,32 @@ namespace Aaru.Core
|
||||
}
|
||||
};
|
||||
|
||||
if(aborted) return sidecar;
|
||||
if(aborted)
|
||||
return sidecar;
|
||||
|
||||
ulong currentBlock = 0;
|
||||
ulong totalSize = 0;
|
||||
Checksum tapeWorker = new Checksum();
|
||||
var tapeWorker = new Checksum();
|
||||
List<TapeFileType> tapeFiles = new List<TapeFileType>();
|
||||
|
||||
UpdateStatus("Hashing files...");
|
||||
|
||||
for(int i = 0; i < files.Count; i++)
|
||||
{
|
||||
if(aborted) return sidecar;
|
||||
if(aborted)
|
||||
return sidecar;
|
||||
|
||||
fs = new FileStream(files[i], FileMode.Open, FileAccess.Read);
|
||||
Checksum fileWorker = new Checksum();
|
||||
TapeFileType tapeFile = new TapeFileType
|
||||
var fileWorker = new Checksum();
|
||||
|
||||
var tapeFile = new TapeFileType
|
||||
{
|
||||
Image = new ImageType
|
||||
{
|
||||
format = "Raw disk image (sector by sector copy)",
|
||||
offset = 0,
|
||||
format = "Raw disk image (sector by sector copy)", offset = 0,
|
||||
Value = Path.GetFileName(files[i])
|
||||
},
|
||||
Size = (ulong)fs.Length,
|
||||
BlockSize = blockSize,
|
||||
StartBlock = currentBlock,
|
||||
Sequence = (ulong)i
|
||||
Size = (ulong)fs.Length, BlockSize = blockSize, StartBlock = currentBlock, Sequence = (ulong)i
|
||||
};
|
||||
|
||||
const uint SECTORS_TO_READ = 512;
|
||||
@@ -110,11 +105,13 @@ namespace Aaru.Core
|
||||
ulong doneSectors = 0;
|
||||
|
||||
InitProgress2();
|
||||
|
||||
while(doneSectors < sectors)
|
||||
{
|
||||
if(aborted)
|
||||
{
|
||||
EndProgress2();
|
||||
|
||||
return sidecar;
|
||||
}
|
||||
|
||||
@@ -124,16 +121,20 @@ namespace Aaru.Core
|
||||
{
|
||||
sector = new byte[SECTORS_TO_READ * blockSize];
|
||||
fs.Read(sector, 0, sector.Length);
|
||||
|
||||
UpdateProgress2($"Hashing block {doneSectors} of {sectors} on file {i + 1} of {files.Count}",
|
||||
(long)doneSectors, (long)sectors);
|
||||
|
||||
doneSectors += SECTORS_TO_READ;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = new byte[(uint)(sectors - doneSectors) * blockSize];
|
||||
fs.Read(sector, 0, sector.Length);
|
||||
|
||||
UpdateProgress2($"Hashing block {doneSectors} of {sectors} on file {i + 1} of {files.Count}",
|
||||
(long)doneSectors, (long)sectors);
|
||||
|
||||
doneSectors += sectors - doneSectors;
|
||||
}
|
||||
|
||||
@@ -141,7 +142,7 @@ namespace Aaru.Core
|
||||
tapeWorker.Update(sector);
|
||||
}
|
||||
|
||||
tapeFile.EndBlock = tapeFile.StartBlock + sectors - 1;
|
||||
tapeFile.EndBlock = (tapeFile.StartBlock + sectors) - 1;
|
||||
currentBlock += sectors;
|
||||
totalSize += (ulong)fs.Length;
|
||||
tapeFile.Checksums = fileWorker.End().ToArray();
|
||||
@@ -165,19 +166,32 @@ namespace Aaru.Core
|
||||
{
|
||||
sidecar.BlockMedia[0].DiskType = "Quarter-inch cartridge";
|
||||
|
||||
if(totalSize <= 20 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-11";
|
||||
else if(totalSize <= 40 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-40";
|
||||
else if(totalSize <= 60 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-24";
|
||||
else if(totalSize <= 80 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-80";
|
||||
else if(totalSize <= 120 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-120";
|
||||
else if(totalSize <= 150 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-150";
|
||||
else if(totalSize <= 320 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-320";
|
||||
else if(totalSize <= 340 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-3010";
|
||||
else if(totalSize <= 525 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-525";
|
||||
else if(totalSize <= 670 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-3020";
|
||||
else if(totalSize <= 1200 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-3080";
|
||||
else if(totalSize <= 1350 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-1350";
|
||||
else if(totalSize <= (long)4000 * 1048576) sidecar.BlockMedia[0].DiskSubType = "QIC-3095";
|
||||
if(totalSize <= 20 * 1048576)
|
||||
sidecar.BlockMedia[0].DiskSubType = "QIC-11";
|
||||
else if(totalSize <= 40 * 1048576)
|
||||
sidecar.BlockMedia[0].DiskSubType = "QIC-40";
|
||||
else if(totalSize <= 60 * 1048576)
|
||||
sidecar.BlockMedia[0].DiskSubType = "QIC-24";
|
||||
else if(totalSize <= 80 * 1048576)
|
||||
sidecar.BlockMedia[0].DiskSubType = "QIC-80";
|
||||
else if(totalSize <= 120 * 1048576)
|
||||
sidecar.BlockMedia[0].DiskSubType = "QIC-120";
|
||||
else if(totalSize <= 150 * 1048576)
|
||||
sidecar.BlockMedia[0].DiskSubType = "QIC-150";
|
||||
else if(totalSize <= 320 * 1048576)
|
||||
sidecar.BlockMedia[0].DiskSubType = "QIC-320";
|
||||
else if(totalSize <= 340 * 1048576)
|
||||
sidecar.BlockMedia[0].DiskSubType = "QIC-3010";
|
||||
else if(totalSize <= 525 * 1048576)
|
||||
sidecar.BlockMedia[0].DiskSubType = "QIC-525";
|
||||
else if(totalSize <= 670 * 1048576)
|
||||
sidecar.BlockMedia[0].DiskSubType = "QIC-3020";
|
||||
else if(totalSize <= 1200 * 1048576)
|
||||
sidecar.BlockMedia[0].DiskSubType = "QIC-3080";
|
||||
else if(totalSize <= 1350 * 1048576)
|
||||
sidecar.BlockMedia[0].DiskSubType = "QIC-1350";
|
||||
else if(totalSize <= (long)4000 * 1048576)
|
||||
sidecar.BlockMedia[0].DiskSubType = "QIC-3095";
|
||||
else
|
||||
{
|
||||
sidecar.BlockMedia[0].DiskType = "Unknown tape";
|
||||
|
||||
@@ -42,39 +42,21 @@ namespace Aaru.Core
|
||||
public event EndProgressHandler2 EndProgressEvent2;
|
||||
public event UpdateStatusHandler UpdateStatusEvent;
|
||||
|
||||
public void InitProgress()
|
||||
{
|
||||
InitProgressEvent?.Invoke();
|
||||
}
|
||||
public void InitProgress() => InitProgressEvent?.Invoke();
|
||||
|
||||
public void UpdateProgress(string text, long current, long maximum)
|
||||
{
|
||||
public void UpdateProgress(string text, long current, long maximum) =>
|
||||
UpdateProgressEvent?.Invoke(string.Format(text, current, maximum), current, maximum);
|
||||
}
|
||||
|
||||
public void EndProgress()
|
||||
{
|
||||
EndProgressEvent?.Invoke();
|
||||
}
|
||||
public void EndProgress() => EndProgressEvent?.Invoke();
|
||||
|
||||
public void InitProgress2()
|
||||
{
|
||||
InitProgressEvent2?.Invoke();
|
||||
}
|
||||
public void InitProgress2() => InitProgressEvent2?.Invoke();
|
||||
|
||||
public void UpdateProgress2(string text, long current, long maximum)
|
||||
{
|
||||
public void UpdateProgress2(string text, long current, long maximum) =>
|
||||
UpdateProgressEvent2?.Invoke(string.Format(text, current, maximum), current, maximum);
|
||||
}
|
||||
|
||||
public void EndProgress2()
|
||||
{
|
||||
EndProgressEvent2?.Invoke();
|
||||
}
|
||||
public void EndProgress2() => EndProgressEvent2?.Invoke();
|
||||
|
||||
public void UpdateStatus(string text, params object[] args)
|
||||
{
|
||||
public void UpdateStatus(string text, params object[] args) =>
|
||||
UpdateStatusEvent?.Invoke(string.Format(text, args));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,11 +11,12 @@ namespace Aaru.Core
|
||||
{
|
||||
FilesystemContentsType Files(IReadOnlyFilesystem filesystem)
|
||||
{
|
||||
FilesystemContentsType contents = new FilesystemContentsType();
|
||||
var contents = new FilesystemContentsType();
|
||||
|
||||
Errno ret = filesystem.ReadDir("/", out List<string> dirents);
|
||||
|
||||
if(ret != Errno.NoError) return null;
|
||||
if(ret != Errno.NoError)
|
||||
return null;
|
||||
|
||||
List<DirectoryType> directories = new List<DirectoryType>();
|
||||
List<ContentsFileType> files = new List<ContentsFileType>();
|
||||
@@ -27,27 +28,32 @@ namespace Aaru.Core
|
||||
if(ret != Errno.NoError)
|
||||
{
|
||||
AaruConsole.DebugWriteLine("Create-Sidecar command", "Cannot stat {0}", dirent);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if(stat.Attributes.HasFlag(FileAttributes.Directory))
|
||||
{
|
||||
directories.Add(SidecarDirectory(filesystem, "", dirent, stat));
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
files.Add(SidecarFile(filesystem, "", dirent, stat));
|
||||
}
|
||||
|
||||
if(files.Count > 0) contents.File = files.OrderBy(f => f.name).ToArray();
|
||||
if(directories.Count > 0) contents.Directory = directories.OrderBy(d => d.name).ToArray();
|
||||
if(files.Count > 0)
|
||||
contents.File = files.OrderBy(f => f.name).ToArray();
|
||||
|
||||
if(directories.Count > 0)
|
||||
contents.Directory = directories.OrderBy(d => d.name).ToArray();
|
||||
|
||||
return contents;
|
||||
}
|
||||
|
||||
DirectoryType SidecarDirectory(IReadOnlyFilesystem filesystem, string path, string filename, FileEntryInfo stat)
|
||||
{
|
||||
DirectoryType directory = new DirectoryType();
|
||||
var directory = new DirectoryType();
|
||||
|
||||
if(stat.AccessTimeUtc.HasValue)
|
||||
{
|
||||
@@ -112,7 +118,8 @@ namespace Aaru.Core
|
||||
|
||||
Errno ret = filesystem.ReadDir(path + "/" + filename, out List<string> dirents);
|
||||
|
||||
if(ret != Errno.NoError) return null;
|
||||
if(ret != Errno.NoError)
|
||||
return null;
|
||||
|
||||
List<DirectoryType> directories = new List<DirectoryType>();
|
||||
List<ContentsFileType> files = new List<ContentsFileType>();
|
||||
@@ -124,28 +131,33 @@ namespace Aaru.Core
|
||||
if(ret != Errno.NoError)
|
||||
{
|
||||
AaruConsole.DebugWriteLine("Create-Sidecar command", "Cannot stat {0}", dirent);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if(entryStat.Attributes.HasFlag(FileAttributes.Directory))
|
||||
{
|
||||
directories.Add(SidecarDirectory(filesystem, path + "/" + filename, dirent, entryStat));
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
files.Add(SidecarFile(filesystem, path + "/" + filename, dirent, entryStat));
|
||||
}
|
||||
|
||||
if(files.Count > 0) directory.File = files.OrderBy(f => f.name).ToArray();
|
||||
if(directories.Count > 0) directory.Directory = directories.OrderBy(d => d.name).ToArray();
|
||||
if(files.Count > 0)
|
||||
directory.File = files.OrderBy(f => f.name).ToArray();
|
||||
|
||||
if(directories.Count > 0)
|
||||
directory.Directory = directories.OrderBy(d => d.name).ToArray();
|
||||
|
||||
return directory;
|
||||
}
|
||||
|
||||
ContentsFileType SidecarFile(IReadOnlyFilesystem filesystem, string path, string filename, FileEntryInfo stat)
|
||||
{
|
||||
ContentsFileType file = new ContentsFileType();
|
||||
Checksum fileChkWorker = new Checksum();
|
||||
var file = new ContentsFileType();
|
||||
var fileChkWorker = new Checksum();
|
||||
|
||||
if(stat.AccessTimeUtc.HasValue)
|
||||
{
|
||||
@@ -210,14 +222,17 @@ namespace Aaru.Core
|
||||
}
|
||||
|
||||
byte[] data = new byte[0];
|
||||
|
||||
if(stat.Length > 0)
|
||||
{
|
||||
long position = 0;
|
||||
UpdateStatus($"Hashing file {path}/{filename}...");
|
||||
InitProgress2();
|
||||
|
||||
while(position < stat.Length - 1048576)
|
||||
{
|
||||
if(aborted) return file;
|
||||
if(aborted)
|
||||
return file;
|
||||
|
||||
data = new byte[1048576];
|
||||
filesystem.Read(path + "/" + filename, position, 1048576, ref data);
|
||||
@@ -240,11 +255,13 @@ namespace Aaru.Core
|
||||
|
||||
file.Checksums = fileChkWorker.End().ToArray();
|
||||
}
|
||||
else file.Checksums = emptyChecksums;
|
||||
else
|
||||
file.Checksums = emptyChecksums;
|
||||
|
||||
Errno ret = filesystem.ListXAttr(path + "/" + filename, out List<string> xattrs);
|
||||
|
||||
if(ret != Errno.NoError) return file;
|
||||
if(ret != Errno.NoError)
|
||||
return file;
|
||||
|
||||
List<ExtendedAttributeType> xattrTypes = new List<ExtendedAttributeType>();
|
||||
|
||||
@@ -252,20 +269,20 @@ namespace Aaru.Core
|
||||
{
|
||||
ret = filesystem.GetXattr(path + "/" + filename, xattr, ref data);
|
||||
|
||||
if(ret != Errno.NoError) continue;
|
||||
if(ret != Errno.NoError)
|
||||
continue;
|
||||
|
||||
Checksum xattrChkWorker = new Checksum();
|
||||
var xattrChkWorker = new Checksum();
|
||||
xattrChkWorker.Update(data);
|
||||
|
||||
xattrTypes.Add(new ExtendedAttributeType
|
||||
{
|
||||
Checksums = xattrChkWorker.End().ToArray(),
|
||||
length = (ulong)data.Length,
|
||||
name = xattr
|
||||
Checksums = xattrChkWorker.End().ToArray(), length = (ulong)data.Length, name = xattr
|
||||
});
|
||||
}
|
||||
|
||||
if(xattrTypes.Count > 0) file.ExtendedAttributes = xattrTypes.OrderBy(x => x.name).ToArray();
|
||||
if(xattrTypes.Count > 0)
|
||||
file.ExtendedAttributes = xattrTypes.OrderBy(x => x.name).ToArray();
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
@@ -34,14 +34,13 @@ namespace Aaru.Core
|
||||
{
|
||||
public partial class Sidecar
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts a LBA to MM:SS:FF string for CDs
|
||||
/// </summary>
|
||||
/// <summary>Converts a LBA to MM:SS:FF string for CDs</summary>
|
||||
/// <param name="lba">LBA</param>
|
||||
/// <returns>MM:SS:FF</returns>
|
||||
static string LbaToMsf(long lba)
|
||||
{
|
||||
long m, s, f;
|
||||
|
||||
if(lba >= -150)
|
||||
{
|
||||
m = (lba + 150) / (75 * 60);
|
||||
@@ -62,14 +61,13 @@ namespace Aaru.Core
|
||||
return $"{m}:{s:D2}:{f:D2}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a LBA to MM:SS:FF string for DDCDs
|
||||
/// </summary>
|
||||
/// <summary>Converts a LBA to MM:SS:FF string for DDCDs</summary>
|
||||
/// <param name="lba">LBA</param>
|
||||
/// <returns>MM:SS:FF</returns>
|
||||
static string DdcdLbaToMsf(long lba)
|
||||
{
|
||||
long h, m, s, f;
|
||||
|
||||
if(lba >= -150)
|
||||
{
|
||||
h = (lba + 150) / (75 * 60 * 60);
|
||||
@@ -82,13 +80,13 @@ namespace Aaru.Core
|
||||
}
|
||||
else
|
||||
{
|
||||
h = (lba + 450150 * 2) / (75 * 60 * 60);
|
||||
lba -= h * (75 * 60 * 60);
|
||||
m = (lba + 450150 * 2) / (75 * 60);
|
||||
lba -= m * (75 * 60);
|
||||
s = (lba + 450150 * 2) / 75;
|
||||
lba -= s * 75;
|
||||
f = lba + 450150 * 2;
|
||||
h = (lba + (450150 * 2)) / (75 * 60 * 60);
|
||||
lba -= h * (75 * 60 * 60);
|
||||
m = (lba + (450150 * 2)) / (75 * 60);
|
||||
lba -= m * (75 * 60);
|
||||
s = (lba + (450150 * 2)) / 75;
|
||||
lba -= s * 75;
|
||||
f = lba + (450150 * 2);
|
||||
}
|
||||
|
||||
return string.Format("{3}:{0:D2}:{1:D2}:{2:D2}", m, s, f, h);
|
||||
|
||||
@@ -43,9 +43,7 @@ namespace Aaru.Core
|
||||
public partial class Sidecar
|
||||
{
|
||||
// TODO: Complete it
|
||||
/// <summary>
|
||||
/// Creates a metadata sidecar for linear media (e.g. ROM chip)
|
||||
/// </summary>
|
||||
/// <summary>Creates a metadata sidecar for linear media (e.g. ROM chip)</summary>
|
||||
/// <param name="image">Image</param>
|
||||
/// <param name="filterId">Filter uuid</param>
|
||||
/// <param name="imagePath">Image path</param>
|
||||
@@ -53,25 +51,18 @@ namespace Aaru.Core
|
||||
/// <param name="plugins">Image plugins</param>
|
||||
/// <param name="imgChecksums">List of image checksums</param>
|
||||
/// <param name="sidecar">Metadata sidecar</param>
|
||||
void LinearMedia(IMediaImage image, Guid filterId, string imagePath,
|
||||
FileInfo fi, PluginBase plugins,
|
||||
List<ChecksumType> imgChecksums, ref CICMMetadataType sidecar, Encoding encoding)
|
||||
{
|
||||
void LinearMedia(IMediaImage image, Guid filterId, string imagePath, FileInfo fi, PluginBase plugins,
|
||||
List<ChecksumType> imgChecksums, ref CICMMetadataType sidecar, Encoding encoding) =>
|
||||
sidecar.LinearMedia = new[]
|
||||
{
|
||||
new LinearMediaType
|
||||
{
|
||||
Checksums = imgChecksums.ToArray(),
|
||||
Image = new ImageType
|
||||
Checksums = imgChecksums.ToArray(), Image = new ImageType
|
||||
{
|
||||
format = image.Format,
|
||||
offset = 0,
|
||||
offsetSpecified = true,
|
||||
Value = Path.GetFileName(imagePath)
|
||||
format = image.Format, offset = 0, offsetSpecified = true, Value = Path.GetFileName(imagePath)
|
||||
},
|
||||
Size = (ulong)fi.Length
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -476,19 +476,19 @@ namespace Aaru.Core
|
||||
case CommonTypes.Enums.TrackType.Data:
|
||||
switch(sidecar.OpticalDisc[0].DiscType)
|
||||
{
|
||||
case"BD":
|
||||
case "BD":
|
||||
xmlTrk.TrackType1 = TrackTypeTrackType.bluray;
|
||||
|
||||
break;
|
||||
case"DDCD":
|
||||
case "DDCD":
|
||||
xmlTrk.TrackType1 = TrackTypeTrackType.ddcd;
|
||||
|
||||
break;
|
||||
case"DVD":
|
||||
case "DVD":
|
||||
xmlTrk.TrackType1 = TrackTypeTrackType.dvd;
|
||||
|
||||
break;
|
||||
case"HD DVD":
|
||||
case "HD DVD":
|
||||
xmlTrk.TrackType1 = TrackTypeTrackType.hddvd;
|
||||
|
||||
break;
|
||||
@@ -516,13 +516,13 @@ namespace Aaru.Core
|
||||
|
||||
switch(sidecar.OpticalDisc[0].DiscType)
|
||||
{
|
||||
case"CD":
|
||||
case"GD":
|
||||
case "CD":
|
||||
case "GD":
|
||||
xmlTrk.StartMSF = LbaToMsf((long)xmlTrk.StartSector);
|
||||
xmlTrk.EndMSF = LbaToMsf((long)xmlTrk.EndSector);
|
||||
|
||||
break;
|
||||
case"DDCD":
|
||||
case "DDCD":
|
||||
xmlTrk.StartMSF = DdcdLbaToMsf((long)xmlTrk.StartSector);
|
||||
xmlTrk.EndMSF = DdcdLbaToMsf((long)xmlTrk.EndSector);
|
||||
|
||||
@@ -540,11 +540,12 @@ namespace Aaru.Core
|
||||
xmlTrk.Image.offsetSpecified = true;
|
||||
}
|
||||
|
||||
xmlTrk.Size = (xmlTrk.EndSector - xmlTrk.StartSector + 1) * (ulong)trk.TrackRawBytesPerSector;
|
||||
xmlTrk.Size = ((xmlTrk.EndSector - xmlTrk.StartSector) + 1) * (ulong)trk.TrackRawBytesPerSector;
|
||||
|
||||
xmlTrk.BytesPerSector = (uint)trk.TrackBytesPerSector;
|
||||
|
||||
uint sectorsToRead = 512;
|
||||
ulong sectors = xmlTrk.EndSector - xmlTrk.StartSector + 1;
|
||||
ulong sectors = (xmlTrk.EndSector - xmlTrk.StartSector) + 1;
|
||||
ulong doneSectors = 0;
|
||||
|
||||
// If there is only one track, and it's the same as the image file (e.g. ".iso" files), don't re-checksum.
|
||||
@@ -584,7 +585,7 @@ namespace Aaru.Core
|
||||
sector = image.ReadSectorsLong(doneSectors, sectorsToRead, xmlTrk.Sequence.TrackNumber);
|
||||
|
||||
UpdateProgress2("Hashings sector {0} of {1}", (long)doneSectors,
|
||||
(long)(trk.TrackEndSector - trk.TrackStartSector + 1));
|
||||
(long)((trk.TrackEndSector - trk.TrackStartSector) + 1));
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
}
|
||||
@@ -594,7 +595,7 @@ namespace Aaru.Core
|
||||
xmlTrk.Sequence.TrackNumber);
|
||||
|
||||
UpdateProgress2("Hashings sector {0} of {1}", (long)doneSectors,
|
||||
(long)(trk.TrackEndSector - trk.TrackStartSector + 1));
|
||||
(long)((trk.TrackEndSector - trk.TrackStartSector) + 1));
|
||||
|
||||
doneSectors += sectors - doneSectors;
|
||||
}
|
||||
@@ -619,7 +620,7 @@ namespace Aaru.Core
|
||||
},
|
||||
|
||||
// TODO: Packed subchannel has different size?
|
||||
Size = (xmlTrk.EndSector - xmlTrk.StartSector + 1) * 96
|
||||
Size = ((xmlTrk.EndSector - xmlTrk.StartSector) + 1) * 96
|
||||
};
|
||||
|
||||
switch(trk.TrackSubchannelType)
|
||||
@@ -649,7 +650,7 @@ namespace Aaru.Core
|
||||
|
||||
var subChkWorker = new Checksum();
|
||||
|
||||
sectors = xmlTrk.EndSector - xmlTrk.StartSector + 1;
|
||||
sectors = (xmlTrk.EndSector - xmlTrk.StartSector) + 1;
|
||||
doneSectors = 0;
|
||||
|
||||
InitProgress2();
|
||||
@@ -672,7 +673,7 @@ namespace Aaru.Core
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
|
||||
UpdateProgress2("Hashings subchannel sector {0} of {1}", (long)doneSectors,
|
||||
(long)(trk.TrackEndSector - trk.TrackStartSector + 1));
|
||||
(long)((trk.TrackEndSector - trk.TrackStartSector) + 1));
|
||||
|
||||
doneSectors += sectorsToRead;
|
||||
}
|
||||
@@ -683,7 +684,7 @@ namespace Aaru.Core
|
||||
SectorTagType.CdSectorSubchannel);
|
||||
|
||||
UpdateProgress2("Hashings subchannel sector {0} of {1}", (long)doneSectors,
|
||||
(long)(trk.TrackEndSector - trk.TrackStartSector + 1));
|
||||
(long)((trk.TrackEndSector - trk.TrackStartSector) + 1));
|
||||
|
||||
doneSectors += sectors - doneSectors;
|
||||
}
|
||||
@@ -741,19 +742,19 @@ namespace Aaru.Core
|
||||
|
||||
switch(plugin.XmlFsType.Type)
|
||||
{
|
||||
case"Opera":
|
||||
case "Opera":
|
||||
dskType = MediaType.ThreeDO;
|
||||
|
||||
break;
|
||||
case"PC Engine filesystem":
|
||||
case "PC Engine filesystem":
|
||||
dskType = MediaType.SuperCDROM2;
|
||||
|
||||
break;
|
||||
case"Nintendo Wii filesystem":
|
||||
case "Nintendo Wii filesystem":
|
||||
dskType = MediaType.WOD;
|
||||
|
||||
break;
|
||||
case"Nintendo Gamecube filesystem":
|
||||
case "Nintendo Gamecube filesystem":
|
||||
dskType = MediaType.GOD;
|
||||
|
||||
break;
|
||||
@@ -781,7 +782,7 @@ namespace Aaru.Core
|
||||
|
||||
var xmlPart = new Partition
|
||||
{
|
||||
Start = xmlTrk.StartSector, Length = xmlTrk.EndSector - xmlTrk.StartSector + 1,
|
||||
Start = xmlTrk.StartSector, Length = (xmlTrk.EndSector - xmlTrk.StartSector) + 1,
|
||||
Type = xmlTrk.TrackType1.ToString(), Size = xmlTrk.Size, Sequence = xmlTrk.Sequence.TrackNumber
|
||||
};
|
||||
|
||||
@@ -804,19 +805,19 @@ namespace Aaru.Core
|
||||
|
||||
switch(plugin.XmlFsType.Type)
|
||||
{
|
||||
case"Opera":
|
||||
case "Opera":
|
||||
dskType = MediaType.ThreeDO;
|
||||
|
||||
break;
|
||||
case"PC Engine filesystem":
|
||||
case "PC Engine filesystem":
|
||||
dskType = MediaType.SuperCDROM2;
|
||||
|
||||
break;
|
||||
case"Nintendo Wii filesystem":
|
||||
case "Nintendo Wii filesystem":
|
||||
dskType = MediaType.WOD;
|
||||
|
||||
break;
|
||||
case"Nintendo Gamecube filesystem":
|
||||
case "Nintendo Gamecube filesystem":
|
||||
dskType = MediaType.GOD;
|
||||
|
||||
break;
|
||||
@@ -845,8 +846,8 @@ namespace Aaru.Core
|
||||
if(dskType == MediaType.XGD2 &&
|
||||
sidecar.OpticalDisc[0].Track.Length == 1)
|
||||
{
|
||||
ulong blocks = sidecar.OpticalDisc[0].Track[0].EndSector - sidecar.OpticalDisc[0].Track[0].StartSector +
|
||||
1;
|
||||
ulong blocks =
|
||||
(sidecar.OpticalDisc[0].Track[0].EndSector - sidecar.OpticalDisc[0].Track[0].StartSector) + 1;
|
||||
|
||||
if(blocks == 25063 || // Locked (or non compatible drive)
|
||||
blocks == 4229664 || // Xtreme unlock
|
||||
|
||||
@@ -44,6 +44,7 @@ namespace Aaru.Core
|
||||
{
|
||||
public partial class Sidecar
|
||||
{
|
||||
readonly ChecksumType[] emptyChecksums;
|
||||
readonly Encoding encoding;
|
||||
readonly FileInfo fi;
|
||||
readonly Guid filterId;
|
||||
@@ -52,7 +53,6 @@ namespace Aaru.Core
|
||||
readonly Checksum imgChkWorker;
|
||||
readonly PluginBase plugins;
|
||||
bool aborted;
|
||||
readonly ChecksumType[] emptyChecksums;
|
||||
FileStream fs;
|
||||
CICMMetadataType sidecar;
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace Aaru.Core
|
||||
imgChkWorker = new Checksum();
|
||||
aborted = false;
|
||||
|
||||
Checksum emptyChkWorker = new Checksum();
|
||||
var emptyChkWorker = new Checksum();
|
||||
emptyChkWorker.Update(new byte[0]);
|
||||
emptyChecksums = emptyChkWorker.End().ToArray();
|
||||
}
|
||||
@@ -88,9 +88,7 @@ namespace Aaru.Core
|
||||
aborted = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implements creating a metadata sidecar
|
||||
/// </summary>
|
||||
/// <summary>Implements creating a metadata sidecar</summary>
|
||||
/// <returns>The metadata sidecar</returns>
|
||||
public CICMMetadataType Create()
|
||||
{
|
||||
@@ -101,9 +99,11 @@ namespace Aaru.Core
|
||||
long position = 0;
|
||||
UpdateStatus("Hashing image file...");
|
||||
InitProgress();
|
||||
|
||||
while(position < fi.Length - 1048576)
|
||||
{
|
||||
if(aborted) return sidecar;
|
||||
if(aborted)
|
||||
return sidecar;
|
||||
|
||||
data = new byte[1048576];
|
||||
fs.Read(data, 0, 1048576);
|
||||
@@ -135,7 +135,8 @@ namespace Aaru.Core
|
||||
sidecar.AudioMedia = null;
|
||||
sidecar.LinearMedia = null;
|
||||
|
||||
if(aborted) return sidecar;
|
||||
if(aborted)
|
||||
return sidecar;
|
||||
|
||||
switch(image.Info.XmlMediaType)
|
||||
{
|
||||
@@ -145,20 +146,24 @@ namespace Aaru.Core
|
||||
encoding);
|
||||
else
|
||||
{
|
||||
AaruConsole
|
||||
.ErrorWriteLine("The specified image says it contains an optical media but at the same time says it does not support them.");
|
||||
AaruConsole.
|
||||
ErrorWriteLine("The specified image says it contains an optical media but at the same time says it does not support them.");
|
||||
|
||||
AaruConsole.ErrorWriteLine("Please open an issue at Github.");
|
||||
}
|
||||
|
||||
break;
|
||||
case XmlMediaType.BlockMedia:
|
||||
BlockMedia(image, filterId, imagePath, fi, plugins, imgChecksums, ref sidecar, encoding);
|
||||
|
||||
break;
|
||||
case XmlMediaType.LinearMedia:
|
||||
LinearMedia(image, filterId, imagePath, fi, plugins, imgChecksums, ref sidecar, encoding);
|
||||
|
||||
break;
|
||||
case XmlMediaType.AudioMedia:
|
||||
AudioMedia(image, filterId, imagePath, fi, plugins, imgChecksums, ref sidecar, encoding);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -61,14 +61,14 @@ namespace Aaru.Core
|
||||
/// <summary>Loads saved statistics from disk</summary>
|
||||
public static void LoadStats()
|
||||
{
|
||||
var ctx = AaruContext.Create(Aaru.Settings.Settings.LocalDbPath);
|
||||
var ctx = AaruContext.Create(Settings.Settings.LocalDbPath);
|
||||
|
||||
if(File.Exists(Path.Combine(Aaru.Settings.Settings.StatsPath, "Statistics.xml")))
|
||||
if(File.Exists(Path.Combine(Settings.Settings.StatsPath, "Statistics.xml")))
|
||||
try
|
||||
{
|
||||
var allStats = new Stats();
|
||||
var xs = new XmlSerializer(allStats.GetType());
|
||||
var sr = new StreamReader(Path.Combine(Aaru.Settings.Settings.StatsPath, "Statistics.xml"));
|
||||
var sr = new StreamReader(Path.Combine(Settings.Settings.StatsPath, "Statistics.xml"));
|
||||
allStats = (Stats)xs.Deserialize(sr);
|
||||
sr.Close();
|
||||
|
||||
@@ -467,9 +467,9 @@ namespace Aaru.Core
|
||||
if(string.IsNullOrWhiteSpace(media.type))
|
||||
continue;
|
||||
|
||||
Aaru.Database.Models.Media existing =
|
||||
Database.Models.Media existing =
|
||||
ctx.Medias.FirstOrDefault(c => c.Type == media.type && c.Real == media.real &&
|
||||
c.Synchronized) ?? new Aaru.Database.Models.Media
|
||||
c.Synchronized) ?? new Database.Models.Media
|
||||
{
|
||||
Type = media.type, Real = media.real, Synchronized = true
|
||||
};
|
||||
@@ -479,14 +479,14 @@ namespace Aaru.Core
|
||||
}
|
||||
|
||||
ctx.SaveChanges();
|
||||
File.Delete(Path.Combine(Aaru.Settings.Settings.StatsPath, "Statistics.xml"));
|
||||
File.Delete(Path.Combine(Settings.Settings.StatsPath, "Statistics.xml"));
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Do not care about it
|
||||
}
|
||||
|
||||
if(Aaru.Settings.Settings.Current.Stats == null)
|
||||
if(Settings.Settings.Current.Stats == null)
|
||||
return;
|
||||
|
||||
ctx.OperatingSystems.Add(new OperatingSystem
|
||||
@@ -506,11 +506,11 @@ namespace Aaru.Core
|
||||
/// <summary>Saves statistics to disk</summary>
|
||||
public static void SaveStats()
|
||||
{
|
||||
var ctx = AaruContext.Create(Aaru.Settings.Settings.LocalDbPath);
|
||||
var ctx = AaruContext.Create(Settings.Settings.LocalDbPath);
|
||||
ctx.SaveChanges();
|
||||
|
||||
if(Aaru.Settings.Settings.Current.Stats != null &&
|
||||
Aaru.Settings.Settings.Current.Stats.ShareStats)
|
||||
if(Settings.Settings.Current.Stats != null &&
|
||||
Settings.Settings.Current.Stats.ShareStats)
|
||||
SubmitStats();
|
||||
}
|
||||
|
||||
@@ -519,7 +519,7 @@ namespace Aaru.Core
|
||||
{
|
||||
var submitThread = new Thread(() =>
|
||||
{
|
||||
var ctx = AaruContext.Create(Aaru.Settings.Settings.LocalDbPath);
|
||||
var ctx = AaruContext.Create(Settings.Settings.LocalDbPath);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -746,8 +746,7 @@ namespace Aaru.Core
|
||||
byte[] jsonBytes = Encoding.UTF8.GetBytes(json);
|
||||
var request = WebRequest.Create("https://www.aaru.app/api/uploadstatsv2");
|
||||
|
||||
((HttpWebRequest)request).UserAgent =
|
||||
$"Aaru {typeof(Version).Assembly.GetName().Version}";
|
||||
((HttpWebRequest)request).UserAgent = $"Aaru {typeof(Version).Assembly.GetName().Version}";
|
||||
|
||||
request.Method = "POST";
|
||||
request.ContentLength = jsonBytes.Length;
|
||||
@@ -880,9 +879,9 @@ namespace Aaru.Core
|
||||
{
|
||||
if(ctx.Medias.Any(c => !c.Synchronized && c.Type == media && c.Real))
|
||||
{
|
||||
Aaru.Database.Models.Media existing =
|
||||
Database.Models.Media existing =
|
||||
ctx.Medias.FirstOrDefault(c => c.Synchronized && c.Type == media && c.Real) ??
|
||||
new Aaru.Database.Models.Media
|
||||
new Database.Models.Media
|
||||
{
|
||||
Synchronized = true, Type = media, Real = true
|
||||
};
|
||||
@@ -900,9 +899,9 @@ namespace Aaru.Core
|
||||
continue;
|
||||
|
||||
{
|
||||
Aaru.Database.Models.Media existing =
|
||||
Database.Models.Media existing =
|
||||
ctx.Medias.FirstOrDefault(c => c.Synchronized && c.Type == media && !c.Real) ??
|
||||
new Aaru.Database.Models.Media
|
||||
new Database.Models.Media
|
||||
{
|
||||
Synchronized = true, Type = media, Real = false
|
||||
};
|
||||
@@ -1073,7 +1072,7 @@ namespace Aaru.Core
|
||||
}
|
||||
|
||||
IEnumerable<string> statsFiles =
|
||||
Directory.EnumerateFiles(Aaru.Settings.Settings.StatsPath, "PartialStats_*.xml",
|
||||
Directory.EnumerateFiles(Settings.Settings.StatsPath, "PartialStats_*.xml",
|
||||
SearchOption.TopDirectoryOnly);
|
||||
|
||||
foreach(string statsFile in statsFiles)
|
||||
@@ -1153,11 +1152,11 @@ namespace Aaru.Core
|
||||
if(string.IsNullOrWhiteSpace(command))
|
||||
return;
|
||||
|
||||
if(Aaru.Settings.Settings.Current.Stats == null ||
|
||||
!Aaru.Settings.Settings.Current.Stats.DeviceStats)
|
||||
if(Settings.Settings.Current.Stats == null ||
|
||||
!Settings.Settings.Current.Stats.DeviceStats)
|
||||
return;
|
||||
|
||||
var ctx = AaruContext.Create(Aaru.Settings.Settings.LocalDbPath);
|
||||
var ctx = AaruContext.Create(Settings.Settings.LocalDbPath);
|
||||
|
||||
ctx.Commands.Add(new Command
|
||||
{
|
||||
@@ -1174,11 +1173,11 @@ namespace Aaru.Core
|
||||
if(string.IsNullOrWhiteSpace(filesystem))
|
||||
return;
|
||||
|
||||
if(Aaru.Settings.Settings.Current.Stats == null ||
|
||||
!Aaru.Settings.Settings.Current.Stats.FilesystemStats)
|
||||
if(Settings.Settings.Current.Stats == null ||
|
||||
!Settings.Settings.Current.Stats.FilesystemStats)
|
||||
return;
|
||||
|
||||
var ctx = AaruContext.Create(Aaru.Settings.Settings.LocalDbPath);
|
||||
var ctx = AaruContext.Create(Settings.Settings.LocalDbPath);
|
||||
|
||||
ctx.Filesystems.Add(new Filesystem
|
||||
{
|
||||
@@ -1195,11 +1194,11 @@ namespace Aaru.Core
|
||||
if(string.IsNullOrWhiteSpace(partition))
|
||||
return;
|
||||
|
||||
if(Aaru.Settings.Settings.Current.Stats == null ||
|
||||
!Aaru.Settings.Settings.Current.Stats.PartitionStats)
|
||||
if(Settings.Settings.Current.Stats == null ||
|
||||
!Settings.Settings.Current.Stats.PartitionStats)
|
||||
return;
|
||||
|
||||
var ctx = AaruContext.Create(Aaru.Settings.Settings.LocalDbPath);
|
||||
var ctx = AaruContext.Create(Settings.Settings.LocalDbPath);
|
||||
|
||||
ctx.Partitions.Add(new Partition
|
||||
{
|
||||
@@ -1216,11 +1215,11 @@ namespace Aaru.Core
|
||||
if(string.IsNullOrWhiteSpace(filter))
|
||||
return;
|
||||
|
||||
if(Aaru.Settings.Settings.Current.Stats == null ||
|
||||
!Aaru.Settings.Settings.Current.Stats.FilterStats)
|
||||
if(Settings.Settings.Current.Stats == null ||
|
||||
!Settings.Settings.Current.Stats.FilterStats)
|
||||
return;
|
||||
|
||||
var ctx = AaruContext.Create(Aaru.Settings.Settings.LocalDbPath);
|
||||
var ctx = AaruContext.Create(Settings.Settings.LocalDbPath);
|
||||
|
||||
ctx.Filters.Add(new Filter
|
||||
{
|
||||
@@ -1237,11 +1236,11 @@ namespace Aaru.Core
|
||||
if(string.IsNullOrWhiteSpace(format))
|
||||
return;
|
||||
|
||||
if(Aaru.Settings.Settings.Current.Stats == null ||
|
||||
!Aaru.Settings.Settings.Current.Stats.MediaImageStats)
|
||||
if(Settings.Settings.Current.Stats == null ||
|
||||
!Settings.Settings.Current.Stats.MediaImageStats)
|
||||
return;
|
||||
|
||||
var ctx = AaruContext.Create(Aaru.Settings.Settings.LocalDbPath);
|
||||
var ctx = AaruContext.Create(Settings.Settings.LocalDbPath);
|
||||
|
||||
ctx.MediaFormats.Add(new MediaFormat
|
||||
{
|
||||
@@ -1255,8 +1254,8 @@ namespace Aaru.Core
|
||||
/// <param name="dev">Device</param>
|
||||
public static void AddDevice(Device dev)
|
||||
{
|
||||
if(Aaru.Settings.Settings.Current.Stats == null ||
|
||||
!Aaru.Settings.Settings.Current.Stats.DeviceStats)
|
||||
if(Settings.Settings.Current.Stats == null ||
|
||||
!Settings.Settings.Current.Stats.DeviceStats)
|
||||
return;
|
||||
|
||||
string deviceBus;
|
||||
@@ -1268,7 +1267,7 @@ namespace Aaru.Core
|
||||
else
|
||||
deviceBus = dev.Type.ToString();
|
||||
|
||||
var ctx = AaruContext.Create(Aaru.Settings.Settings.LocalDbPath);
|
||||
var ctx = AaruContext.Create(Settings.Settings.LocalDbPath);
|
||||
|
||||
ctx.SeenDevices.Add(new DeviceStat
|
||||
{
|
||||
@@ -1285,13 +1284,13 @@ namespace Aaru.Core
|
||||
/// <param name="real">Set if media was found on a real device, otherwise found on a media image</param>
|
||||
public static void AddMedia(MediaType type, bool real)
|
||||
{
|
||||
if(Aaru.Settings.Settings.Current.Stats == null ||
|
||||
!Aaru.Settings.Settings.Current.Stats.MediaStats)
|
||||
if(Settings.Settings.Current.Stats == null ||
|
||||
!Settings.Settings.Current.Stats.MediaStats)
|
||||
return;
|
||||
|
||||
var ctx = AaruContext.Create(Aaru.Settings.Settings.LocalDbPath);
|
||||
var ctx = AaruContext.Create(Settings.Settings.LocalDbPath);
|
||||
|
||||
ctx.Medias.Add(new Aaru.Database.Models.Media
|
||||
ctx.Medias.Add(new Database.Models.Media
|
||||
{
|
||||
Real = real, Synchronized = false, Type = type.ToString(), Count = 1
|
||||
});
|
||||
@@ -1303,11 +1302,11 @@ namespace Aaru.Core
|
||||
public static void AddRemote(string serverApplication, string serverVersion, string serverOperatingSystem,
|
||||
string serverOperatingSystemVersion, string serverArchitecture)
|
||||
{
|
||||
if(Aaru.Settings.Settings.Current.Stats == null ||
|
||||
!Aaru.Settings.Settings.Current.Stats.MediaStats)
|
||||
if(Settings.Settings.Current.Stats == null ||
|
||||
!Settings.Settings.Current.Stats.MediaStats)
|
||||
return;
|
||||
|
||||
var ctx = AaruContext.Create(Aaru.Settings.Settings.LocalDbPath);
|
||||
var ctx = AaruContext.Create(Settings.Settings.LocalDbPath);
|
||||
|
||||
ctx.RemoteApplications.Add(new RemoteApplication
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user