Code restyling.

This commit is contained in:
2020-02-29 18:03:35 +00:00
parent 4ea327f0c6
commit f7e173710e
855 changed files with 43605 additions and 38045 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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