diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/LeadOuts.cs b/Aaru.Core/Devices/Dumping/CompactDisc/LeadOuts.cs
index 8abe4297a..51a6d9c56 100644
--- a/Aaru.Core/Devices/Dumping/CompactDisc/LeadOuts.cs
+++ b/Aaru.Core/Devices/Dumping/CompactDisc/LeadOuts.cs
@@ -79,9 +79,6 @@ partial class Dump
/// Disc media catalogue number
/// List of subchannels not yet dumped correctly
/// List of smallest pregap relative address per track
-
- // TODO: Use it
- [SuppressMessage("ReSharper", "UnusedMember.Local")]
void DumpCdLeadOuts(uint blockSize, ref double currentSpeed, DumpHardware 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,
@@ -351,304 +348,4 @@ partial class Dump
EndProgress?.Invoke();
}
-
- /// Retries inter-session lead-outs
- /// Size of the read sector in bytes
- /// Current read speed
- /// Current dump hardware try
- /// Extents
- /// IMGBurn log
- /// Duration of image write
- /// Lead-out extents
- /// Maximum speed
- /// MHDD log
- /// Minimum speed
- /// Device supports READ(6)
- /// Device supports READ(10)
- /// Device supports READ(12)
- /// Device supports READ(16)
- /// Device supports READ CD
- /// Drive's maximum supported subchannel
- /// Subchannel size in bytes
- /// Total commands duration
- /// Disc tracks
- /// Subchannel log
- /// Subchannel desired to save
- /// List of disc ISRCs
- /// Disc media catalogue number
- /// List of subchannels not yet dumped correctly
- /// List of smallest pregap relative address per track
-
- // TODO: Use it
- [SuppressMessage("ReSharper", "UnusedMember.Local")]
- void RetryCdLeadOuts(uint blockSize, ref double currentSpeed, DumpHardware 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,
- bool readcd, MmcSubchannel supportedSubchannel, uint subSize, ref double totalDuration,
- SubchannelLog subLog, MmcSubchannel desiredSubchannel, Dictionary isrcs,
- ref string mcn, Track[] tracks, HashSet subchannelExtents,
- Dictionary smallestPregapLbaPerTrack, int offsetBytes, int sectorsForOffset)
- {
- byte[] cmdBuf = null; // Data buffer
- const uint sectorSize = 2352; // Full sector size
- var sense = true; // Sense indicator
- ReadOnlySpan senseBuf = null;
- var outputOptical = _outputPlugin as IWritableOpticalImage;
-
- AaruLogging.WriteLine("Retrying lead-outs");
-
- InitProgress?.Invoke();
-
- foreach((ulong item1, ulong item2) in leadOutExtents.ToArray())
- {
- Track t = tracks.FirstOrDefault(t => item1 == t.EndSector + 1);
-
- bool isAudio = t.Type == TrackType.Audio;
- bool needsOffsetCorrection = _fixOffset && isAudio && offsetBytes != 0;
-
- for(ulong i = item1; i <= item2; i++)
- {
- if(_aborted)
- {
- currentTry.Extents = ExtentsConverter.ToMetadata(extents);
- AaruLogging.WriteLine(Localization.Core.Aborted);
-
- break;
- }
-
- double cmdDuration = 0;
-
- if(currentSpeed > maxSpeed && currentSpeed > 0) maxSpeed = currentSpeed;
-
- if(currentSpeed < minSpeed && currentSpeed > 0) minSpeed = currentSpeed;
-
- PulseProgress?.Invoke(string.Format(Localization.Core.Reading_sector_0_at_lead_out_1,
- i,
- ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()));
-
- uint blocksToRead = 1;
- var firstSectorToRead = (uint)i;
- var failedCrossingLeadOut = false;
-
- if(needsOffsetCorrection)
- {
- if(offsetBytes < 0)
- {
- firstSectorToRead =
- i >= (ulong)sectorsForOffset ? (uint)(i - (ulong)sectorsForOffset) : (uint)i;
-
- blocksToRead += (uint)sectorsForOffset;
- }
- else
- {
- blocksToRead += (uint)sectorsForOffset;
-
- if(i + blocksToRead > item2 + 1) failedCrossingLeadOut = true;
- }
- }
-
- if(readcd)
- {
- sense = _dev.ReadCd(out cmdBuf,
- out senseBuf,
- firstSectorToRead,
- blockSize,
- blocksToRead,
- MmcSectorTypes.AllTypes,
- false,
- false,
- true,
- MmcHeaderCodes.AllHeaders,
- true,
- true,
- MmcErrorField.None,
- supportedSubchannel,
- _dev.Timeout,
- out cmdDuration);
-
- totalDuration += cmdDuration;
- }
- else if(read16)
- {
- sense = _dev.Read16(out cmdBuf,
- out senseBuf,
- 0,
- false,
- true,
- false,
- firstSectorToRead,
- blockSize,
- 0,
- blocksToRead,
- false,
- _dev.Timeout,
- out cmdDuration);
- }
- else if(read12)
- {
- sense = _dev.Read12(out cmdBuf,
- out senseBuf,
- 0,
- false,
- true,
- false,
- false,
- firstSectorToRead,
- blockSize,
- 0,
- blocksToRead,
- false,
- _dev.Timeout,
- out cmdDuration);
- }
- else if(read10)
- {
- sense = _dev.Read10(out cmdBuf,
- out senseBuf,
- 0,
- false,
- true,
- false,
- false,
- firstSectorToRead,
- blockSize,
- 0,
- (ushort)blocksToRead,
- _dev.Timeout,
- out cmdDuration);
- }
- else if(read6)
- {
- sense = _dev.Read6(out cmdBuf,
- out senseBuf,
- firstSectorToRead,
- blockSize,
- (byte)blocksToRead,
- _dev.Timeout,
- out cmdDuration);
- }
-
- if(!sense && !_dev.Error)
- {
- if(needsOffsetCorrection)
- {
- FixOffsetData(offsetBytes,
- sectorSize,
- sectorsForOffset,
- supportedSubchannel,
- ref blocksToRead,
- subSize,
- ref cmdBuf,
- blockSize,
- failedCrossingLeadOut);
- }
-
- mhddLog.Write(i, cmdDuration, _maximumReadable);
- ibgLog.Write(i, currentSpeed * 1024);
- extents.Add(i, _maximumReadable, true);
- leadOutExtents.Remove(i);
- _writeStopwatch.Restart();
-
- if(supportedSubchannel != MmcSubchannel.None)
- {
- var data = new byte[sectorSize * _maximumReadable];
- var sub = new byte[subSize * _maximumReadable];
-
- for(var b = 0; b < _maximumReadable; b++)
- {
- Array.Copy(cmdBuf, (int)(0 + b * blockSize), data, sectorSize * b, sectorSize);
-
- Array.Copy(cmdBuf, (int)(sectorSize + b * blockSize), sub, subSize * b, subSize);
- }
-
- outputOptical.WriteSectorsLong(data,
- i,
- false,
- _maximumReadable,
- Enumerable.Repeat(SectorStatus.Dumped, (int)_maximumReadable)
- .ToArray());
-
- bool indexesChanged = Media.CompactDisc.WriteSubchannelToImage(supportedSubchannel,
- desiredSubchannel,
- sub,
- i,
- _maximumReadable,
- subLog,
- isrcs,
- 0xAA,
- ref mcn,
- tracks,
- subchannelExtents,
- _fixSubchannelPosition,
- outputOptical,
- _fixSubchannel,
- _fixSubchannelCrc,
- UpdateStatus,
- smallestPregapLbaPerTrack,
- true,
- out _);
-
- // Set tracks and go back
- if(indexesChanged)
- {
- outputOptical.SetTracks(tracks.ToList());
- i--;
-
- continue;
- }
- }
- else
- {
- outputOptical.WriteSectors(cmdBuf,
- i,
- false,
- _maximumReadable,
- Enumerable.Repeat(SectorStatus.Dumped, (int)_maximumReadable)
- .ToArray());
- }
-
- imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
- }
- else
- {
- _errorLog?.WriteLine(i, _dev.Error, _dev.LastError, senseBuf.ToArray());
-
- // TODO: Reset device after X errors
- if(_stopOnError) return; // TODO: Return more cleanly
-
- // Write empty data
- _writeStopwatch.Restart();
-
- if(supportedSubchannel != MmcSubchannel.None)
- {
- outputOptical.WriteSectorsLong(new byte[sectorSize * _skip], i, false, 1, new SectorStatus[1]);
-
- if(desiredSubchannel != MmcSubchannel.None)
- {
- outputOptical.WriteSectorsTag(new byte[subSize * _skip],
- i,
- false,
- 1,
- SectorTagType.CdSectorSubchannel);
- }
- }
- else
- outputOptical.WriteSectors(new byte[blockSize * _skip], i, false, 1, new SectorStatus[1]);
-
- imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
-
- mhddLog.Write(i, cmdDuration < 500 ? 65535 : cmdDuration);
-
- ibgLog.Write(i, 0);
- }
-
- _writeStopwatch.Stop();
- double newSpeed = (double)blockSize * _maximumReadable / 1048576 / (cmdDuration / 1000);
-
- if(!double.IsInfinity(newSpeed)) currentSpeed = newSpeed;
- }
- }
-
- EndProgress?.Invoke();
- }
}
\ No newline at end of file