General code style and feature fixes.

This commit is contained in:
2022-11-15 01:35:06 +00:00
parent 47965f0584
commit bd3fe7bd4e
94 changed files with 460 additions and 478 deletions

View File

@@ -267,7 +267,7 @@ partial class Dump
desiredSubchannel, sub, i + r, 1, subLog, isrcs, 1, ref mcn, tracks,
subchannelExtents, _fixSubchannelPosition, outputOptical, _fixSubchannel,
_fixSubchannelCrc, _dumpLog, UpdateStatus, smallestPregapLbaPerTrack, true,
out List<ulong> newPregapSectors);
out List<ulong> _);
// Set tracks and go back
if(indexesChanged)
@@ -347,10 +347,10 @@ partial class Dump
outputOptical.WriteSectorsLong(data, i, blocksToRead);
bool indexesChanged = Media.CompactDisc.WriteSubchannelToImage(supportedSubchannel,
desiredSubchannel, sub, i, blocksToRead, subLog, isrcs, 1, ref mcn, tracks,
subchannelExtents, _fixSubchannelPosition, outputOptical, _fixSubchannel,
_fixSubchannelCrc, _dumpLog, UpdateStatus, smallestPregapLbaPerTrack, true,
out List<ulong> newPregapSectors);
desiredSubchannel, sub, i, blocksToRead, subLog, isrcs, 1, ref mcn, tracks,
subchannelExtents, _fixSubchannelPosition, outputOptical, _fixSubchannel,
_fixSubchannelCrc, _dumpLog, UpdateStatus, smallestPregapLbaPerTrack, true,
out List<ulong> newPregapSectors);
// Set tracks and go back
if(indexesChanged)

View File

@@ -322,7 +322,6 @@ sealed partial class Dump
UpdateStatus?.Invoke("Full raw subchannel reading supported...");
subType = TrackSubchannelType.Raw;
subSize = 96;
readcd = true;
break;
case MmcSubchannel.Q16:
@@ -335,7 +334,6 @@ sealed partial class Dump
subType = TrackSubchannelType.Q16;
subSize = 16;
readcd = true;
break;
}

View File

@@ -38,6 +38,7 @@ namespace Aaru.Core.Devices.Dumping;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Extents;
@@ -75,6 +76,9 @@ partial class Dump
/// <param name="mcn">Disc media catalogue number</param>
/// <param name="subchannelExtents">List of subchannels not yet dumped correctly</param>
/// <param name="smallestPregapLbaPerTrack">List of smallest pregap relative address per track</param>
// TODO: Use it
[SuppressMessage("ReSharper", "UnusedMember.Local")]
void DumpCdLeadOuts(uint blockSize, ref double currentSpeed, DumpHardwareType currentTry, ExtentsULong extents,
IbgLog ibgLog, ref double imageWriteDuration, ExtentsULong leadOutExtents, ref double maxSpeed,
MhddLog mhddLog, ref double minSpeed, bool read6, bool read10, bool read12, bool read16,
@@ -244,6 +248,9 @@ partial class Dump
/// <param name="mcn">Disc media catalogue number</param>
/// <param name="subchannelExtents">List of subchannels not yet dumped correctly</param>
/// <param name="smallestPregapLbaPerTrack">List of smallest pregap relative address per track</param>
// TODO: Use it
[SuppressMessage("ReSharper", "UnusedMember.Local")]
void RetryCdLeadOuts(uint blockSize, ref double currentSpeed, DumpHardwareType currentTry, ExtentsULong extents,
IbgLog ibgLog, ref double imageWriteDuration, ExtentsULong leadOutExtents, ref double maxSpeed,
MhddLog mhddLog, ref double minSpeed, bool read6, bool read10, bool read12, bool read16,

View File

@@ -175,11 +175,12 @@ partial class Dump
break;
}
AaruConsole.DebugWriteLine("Pregap calculator", bcd == true
? "Subchannel is BCD"
: bcd == false
? "Subchannel is not BCD"
: "Could not detect drive subchannel BCD");
AaruConsole.DebugWriteLine("Pregap calculator", bcd switch
{
true => "Subchannel is BCD",
false => "Subchannel is not BCD",
_ => "Could not detect drive subchannel BCD"
});
if(bcd is null)
{

View File

@@ -322,7 +322,9 @@ partial class Dump
var forward = true;
bool sense;
byte[] buffer;
var outputFormat = _outputPlugin as IWritableImage;
if(_outputPlugin is not IWritableImage outputFormat)
return;
InitProgress?.Invoke();

View File

@@ -125,10 +125,12 @@ public partial class Dump
blocks = ecsdDecoded.SectorCount;
blockSize = (uint)(ecsdDecoded.SectorSize == 1 ? 4096 : 512);
if(ecsdDecoded.NativeSectorSize == 0)
physicalBlockSize = 512;
else if(ecsdDecoded.NativeSectorSize == 1)
physicalBlockSize = 4096;
physicalBlockSize = ecsdDecoded.NativeSectorSize switch
{
0 => 512,
1 => 4096,
_ => physicalBlockSize
};
blocksToRead = (ushort)(ecsdDecoded.OptimalReadSize * 4096 / blockSize);
@@ -758,7 +760,6 @@ public partial class Dump
{
var pass = 1;
var forward = true;
const bool runningPersistent = false;
InitProgress?.Invoke();
repeatRetryLba:
@@ -775,9 +776,7 @@ public partial class Dump
break;
}
PulseProgress?.Invoke(string.Format("Retrying sector {0}, pass {1}, {3}{2}", badSector, pass,
forward ? "forward" : "reverse",
runningPersistent ? "recovering partial data, " : ""));
PulseProgress?.Invoke($"Retrying sector {badSector}, pass {pass}, {(forward ? "forward" : "reverse")}");
error = _dev.ReadSingleBlock(out cmdBuf, out response, (uint)badSector, blockSize, byteAddressed,
timeout, out duration);
@@ -785,18 +784,17 @@ public partial class Dump
totalDuration += duration;
if(error)
{
_errorLog?.WriteLine(badSector, _dev.Error, _dev.LastError, byteAddressed, response);
if(!error)
{
_resume.BadBlocks.Remove(badSector);
extents.Add(badSector);
outputFormat.WriteSector(cmdBuf, badSector);
UpdateStatus?.Invoke($"Correctly retried block {badSector} in pass {pass}.");
_dumpLog.WriteLine("Correctly retried block {0} in pass {1}.", badSector, pass);
continue;
}
else if(runningPersistent)
outputFormat.WriteSector(cmdBuf, badSector);
_resume.BadBlocks.Remove(badSector);
extents.Add(badSector);
outputFormat.WriteSector(cmdBuf, badSector);
UpdateStatus?.Invoke($"Correctly retried block {badSector} in pass {pass}.");
_dumpLog.WriteLine("Correctly retried block {0} in pass {1}.", badSector, pass);
}
if(pass < _retryPasses &&

View File

@@ -154,7 +154,7 @@ public sealed partial class DeviceReport
tocIsNotBcd = true;
break;
case >= 0xA0 when !tocIsNotBcd:
case >= 0xA0:
min += 90;
leadOutTrack.PMIN -= 0x90;

View File

@@ -183,7 +183,7 @@ public sealed partial class DeviceReport
return evpds.Count > 0 ? evpds : null;
}
byte[] ClearPage83(byte[] pageResponse)
static byte[] ClearPage83(byte[] pageResponse)
{
if(pageResponse?[1] != 0x83)
return null;