mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Change how pregap starting with 0 is calculated dumping vs converting. Fixes #375
This commit is contained in:
@@ -261,16 +261,9 @@ namespace Aaru.Core.Devices.Dumping
|
||||
_outputPlugin.WriteSectorsLong(data, i + r, 1);
|
||||
|
||||
bool indexesChanged = Media.CompactDisc.WriteSubchannelToImage(supportedSubchannel,
|
||||
desiredSubchannel, sub,
|
||||
i + r, 1, subLog, isrcs,
|
||||
1, ref mcn, tracks,
|
||||
subchannelExtents,
|
||||
_fixSubchannelPosition,
|
||||
_outputPlugin,
|
||||
_fixSubchannel,
|
||||
_fixSubchannelCrc,
|
||||
_dumpLog, UpdateStatus,
|
||||
smallestPregapLbaPerTrack);
|
||||
desiredSubchannel, sub, i + r, 1, subLog, isrcs, 1, ref mcn, tracks,
|
||||
subchannelExtents, _fixSubchannelPosition, _outputPlugin, _fixSubchannel,
|
||||
_fixSubchannelCrc, _dumpLog, UpdateStatus, smallestPregapLbaPerTrack, true);
|
||||
|
||||
// Set tracks and go back
|
||||
if(indexesChanged)
|
||||
@@ -353,15 +346,9 @@ namespace Aaru.Core.Devices.Dumping
|
||||
_outputPlugin.WriteSectorsLong(data, i, blocksToRead);
|
||||
|
||||
bool indexesChanged = Media.CompactDisc.WriteSubchannelToImage(supportedSubchannel,
|
||||
desiredSubchannel, sub, i,
|
||||
blocksToRead, subLog, isrcs, 1,
|
||||
ref mcn, tracks,
|
||||
subchannelExtents,
|
||||
_fixSubchannelPosition,
|
||||
_outputPlugin, _fixSubchannel,
|
||||
_fixSubchannelCrc, _dumpLog,
|
||||
UpdateStatus,
|
||||
smallestPregapLbaPerTrack);
|
||||
desiredSubchannel, sub, i, blocksToRead, subLog, isrcs, 1, ref mcn, tracks,
|
||||
subchannelExtents, _fixSubchannelPosition, _outputPlugin, _fixSubchannel,
|
||||
_fixSubchannelCrc, _dumpLog, UpdateStatus, smallestPregapLbaPerTrack, true);
|
||||
|
||||
// Set tracks and go back
|
||||
if(indexesChanged)
|
||||
|
||||
@@ -417,7 +417,7 @@ namespace Aaru.Core.Devices.Dumping
|
||||
desiredSubchannel, sub, i + r, 1, subLog, isrcs, (byte)track.TrackSequence,
|
||||
ref mcn, tracks, subchannelExtents, _fixSubchannelPosition, _outputPlugin,
|
||||
_fixSubchannel, _fixSubchannelCrc, _dumpLog, UpdateStatus,
|
||||
smallestPregapLbaPerTrack);
|
||||
smallestPregapLbaPerTrack, true);
|
||||
|
||||
// Set tracks and go back
|
||||
if(indexesChanged)
|
||||
@@ -560,7 +560,8 @@ namespace Aaru.Core.Devices.Dumping
|
||||
bool indexesChanged = Media.CompactDisc.WriteSubchannelToImage(supportedSubchannel,
|
||||
desiredSubchannel, sub, i, blocksToRead, subLog, isrcs, (byte)track.TrackSequence,
|
||||
ref mcn, tracks, subchannelExtents, _fixSubchannelPosition, _outputPlugin,
|
||||
_fixSubchannel, _fixSubchannelCrc, _dumpLog, UpdateStatus, smallestPregapLbaPerTrack);
|
||||
_fixSubchannel, _fixSubchannelCrc, _dumpLog, UpdateStatus, smallestPregapLbaPerTrack,
|
||||
true);
|
||||
|
||||
// Set tracks and go back
|
||||
if(indexesChanged)
|
||||
|
||||
@@ -308,7 +308,7 @@ namespace Aaru.Core.Devices.Dumping
|
||||
bool indexesChanged = Media.CompactDisc.WriteSubchannelToImage(supportedSubchannel,
|
||||
desiredSubchannel, sub, badSector, 1, subLog, isrcs, (byte)track.TrackSequence, ref mcn,
|
||||
tracks, subchannelExtents, _fixSubchannelPosition, _outputPlugin, _fixSubchannel,
|
||||
_fixSubchannelCrc, _dumpLog, UpdateStatus, smallestPregapLbaPerTrack);
|
||||
_fixSubchannelCrc, _dumpLog, UpdateStatus, smallestPregapLbaPerTrack, true);
|
||||
|
||||
// Set tracks and go back
|
||||
if(indexesChanged)
|
||||
@@ -440,7 +440,7 @@ namespace Aaru.Core.Devices.Dumping
|
||||
desiredSubchannel, sub, badSector, 1, subLog, isrcs, (byte)track.TrackSequence,
|
||||
ref mcn, tracks, subchannelExtents, _fixSubchannelPosition, _outputPlugin,
|
||||
_fixSubchannel, _fixSubchannelCrc, _dumpLog, UpdateStatus,
|
||||
smallestPregapLbaPerTrack);
|
||||
smallestPregapLbaPerTrack, true);
|
||||
|
||||
// Set tracks and go back
|
||||
if(indexesChanged)
|
||||
@@ -590,7 +590,7 @@ namespace Aaru.Core.Devices.Dumping
|
||||
subLog, isrcs, (byte)track.TrackSequence, ref mcn, tracks,
|
||||
subchannelExtents, _fixSubchannelPosition, _outputPlugin,
|
||||
_fixSubchannel, _fixSubchannelCrc, _dumpLog, UpdateStatus,
|
||||
smallestPregapLbaPerTrack);
|
||||
smallestPregapLbaPerTrack, true);
|
||||
|
||||
if(subchannelExtents.Contains(bs))
|
||||
continue;
|
||||
|
||||
@@ -161,16 +161,9 @@ namespace Aaru.Core.Devices.Dumping
|
||||
_outputPlugin.WriteSectorsLong(data, i, _maximumReadable);
|
||||
|
||||
bool indexesChanged = Media.CompactDisc.WriteSubchannelToImage(supportedSubchannel,
|
||||
desiredSubchannel, sub, i,
|
||||
_maximumReadable, subLog,
|
||||
isrcs, 0xAA, ref mcn, tracks,
|
||||
subchannelExtents,
|
||||
_fixSubchannelPosition,
|
||||
_outputPlugin,
|
||||
_fixSubchannel,
|
||||
_fixSubchannelCrc, _dumpLog,
|
||||
UpdateStatus,
|
||||
smallestPregapLbaPerTrack);
|
||||
desiredSubchannel, sub, i, _maximumReadable, subLog, isrcs, 0xAA, ref mcn, tracks,
|
||||
subchannelExtents, _fixSubchannelPosition, _outputPlugin, _fixSubchannel,
|
||||
_fixSubchannelCrc, _dumpLog, UpdateStatus, smallestPregapLbaPerTrack, true);
|
||||
|
||||
// Set tracks and go back
|
||||
if(indexesChanged)
|
||||
@@ -336,16 +329,9 @@ namespace Aaru.Core.Devices.Dumping
|
||||
_outputPlugin.WriteSectorsLong(data, i, _maximumReadable);
|
||||
|
||||
bool indexesChanged = Media.CompactDisc.WriteSubchannelToImage(supportedSubchannel,
|
||||
desiredSubchannel, sub, i,
|
||||
_maximumReadable, subLog,
|
||||
isrcs, 0xAA, ref mcn, tracks,
|
||||
subchannelExtents,
|
||||
_fixSubchannelPosition,
|
||||
_outputPlugin,
|
||||
_fixSubchannel,
|
||||
_fixSubchannelCrc, _dumpLog,
|
||||
UpdateStatus,
|
||||
smallestPregapLbaPerTrack);
|
||||
desiredSubchannel, sub, i, _maximumReadable, subLog, isrcs, 0xAA, ref mcn, tracks,
|
||||
subchannelExtents, _fixSubchannelPosition, _outputPlugin, _fixSubchannel,
|
||||
_fixSubchannelCrc, _dumpLog, UpdateStatus, smallestPregapLbaPerTrack, true);
|
||||
|
||||
// Set tracks and go back
|
||||
if(indexesChanged)
|
||||
|
||||
@@ -202,7 +202,7 @@ namespace Aaru.Core.Devices.Dumping
|
||||
bool indexesChanged = Media.CompactDisc.WriteSubchannelToImage(supportedSubchannel,
|
||||
desiredSubchannel, sub, badSector, 1, subLog, isrcs, (byte)track.TrackSequence, ref mcn,
|
||||
tracks, subchannelExtents, _fixSubchannelPosition, _outputPlugin, _fixSubchannel,
|
||||
_fixSubchannelCrc, _dumpLog, UpdateStatus, smallestPregapLbaPerTrack);
|
||||
_fixSubchannelCrc, _dumpLog, UpdateStatus, smallestPregapLbaPerTrack, true);
|
||||
|
||||
// Set tracks and go back
|
||||
if(!indexesChanged)
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Aaru.Core.Media
|
||||
bool fixSubchannelPosition, IWritableImage outputPlugin,
|
||||
bool fixSubchannel, bool fixSubchannelCrc, DumpLog dumpLog,
|
||||
UpdateStatusHandler updateStatus,
|
||||
Dictionary<byte, int> smallestPregapLbaPerTrack)
|
||||
Dictionary<byte, int> smallestPregapLbaPerTrack, bool dumping)
|
||||
{
|
||||
if(supportedSubchannel == MmcSubchannel.Q16)
|
||||
sub = Subchannel.ConvertQToRaw(sub);
|
||||
@@ -65,7 +65,7 @@ namespace Aaru.Core.Media
|
||||
byte[] deSub = Subchannel.Deinterleave(sub);
|
||||
|
||||
bool indexesChanged = CheckIndexesFromSubchannel(deSub, isrcs, currentTrack, ref mcn, tracks, dumpLog,
|
||||
updateStatus, smallestPregapLbaPerTrack);
|
||||
updateStatus, smallestPregapLbaPerTrack, dumping);
|
||||
|
||||
if(!fixSubchannelPosition ||
|
||||
desiredSubchannel == MmcSubchannel.None)
|
||||
@@ -100,9 +100,9 @@ namespace Aaru.Core.Media
|
||||
pWeight++;
|
||||
}
|
||||
|
||||
if(!deSub.Skip(subPos + 24).Take(96 - 24).All(rw => (rw == 0)) &&
|
||||
!deSub.Skip(subPos + 24).Take(96 - 24).All(rw => (rw == 0xFF)))
|
||||
rwOk = false;
|
||||
if(!deSub.Skip(subPos + 24).Take(96 - 24).All(rw => rw == 0) &&
|
||||
!deSub.Skip(subPos + 24).Take(96 - 24).All(rw => rw == 0xFF))
|
||||
rwOk = false;
|
||||
|
||||
bool rwPacket = false;
|
||||
bool cdtextPacket = false;
|
||||
@@ -212,16 +212,16 @@ namespace Aaru.Core.Media
|
||||
|
||||
if((q[0] & 0x3) == 1)
|
||||
{
|
||||
amin = (byte)(((q[7] / 16) * 10) + (q[7] & 0x0F));
|
||||
asec = (byte)(((q[8] / 16) * 10) + (q[8] & 0x0F));
|
||||
aPos = ((amin * 60 * 75) + (asec * 75) + aframe) - 150;
|
||||
amin = (byte)(((q[7] / 16) * 10) + (q[7] & 0x0F));
|
||||
asec = (byte)(((q[8] / 16) * 10) + (q[8] & 0x0F));
|
||||
aPos = ((amin * 60 * 75) + (asec * 75) + aframe) - 150;
|
||||
}
|
||||
else
|
||||
{
|
||||
ulong expectedSectorAddress = sectorAddress + (ulong)(subPos / 96) + 150;
|
||||
smin = (byte)(expectedSectorAddress / 60 / 75);
|
||||
expectedSectorAddress -= (ulong)(smin * 60 * 75);
|
||||
ssec = (byte)(expectedSectorAddress / 75);
|
||||
expectedSectorAddress -= (ulong)(smin * 60 * 75);
|
||||
ssec = (byte)(expectedSectorAddress / 75);
|
||||
|
||||
aPos = ((smin * 60 * 75) + (ssec * 75) + aframe) - 150;
|
||||
|
||||
@@ -253,7 +253,7 @@ namespace Aaru.Core.Media
|
||||
static bool CheckIndexesFromSubchannel(byte[] deSub, Dictionary<byte, string> isrcs, byte currentTrack,
|
||||
ref string mcn, Track[] tracks, DumpLog dumpLog,
|
||||
UpdateStatusHandler updateStatus,
|
||||
Dictionary<byte, int> smallestPregapLbaPerTrack)
|
||||
Dictionary<byte, int> smallestPregapLbaPerTrack, bool dumping)
|
||||
{
|
||||
bool status = false;
|
||||
|
||||
@@ -339,8 +339,10 @@ namespace Aaru.Core.Media
|
||||
byte pframe = (byte)(((q[5] / 16) * 10) + (q[5] & 0x0F));
|
||||
int qPos = (pmin * 60 * 75) + (psec * 75) + pframe;
|
||||
|
||||
// When we are dumping we calculate the pregap in reverse from index 1 back.
|
||||
// When we are not, we go from index 0.
|
||||
if(!smallestPregapLbaPerTrack.ContainsKey(trackNo))
|
||||
smallestPregapLbaPerTrack[trackNo] = 1;
|
||||
smallestPregapLbaPerTrack[trackNo] = dumping ? 1 : 0;
|
||||
|
||||
if(qPos < smallestPregapLbaPerTrack[trackNo])
|
||||
{
|
||||
@@ -383,10 +385,10 @@ namespace Aaru.Core.Media
|
||||
if(q[2] == 0)
|
||||
continue;
|
||||
|
||||
byte amin = (byte)(((q[7] / 16) * 10) + (q[7] & 0x0F));
|
||||
byte asec = (byte)(((q[8] / 16) * 10) + (q[8] & 0x0F));
|
||||
byte aframe = (byte)(((q[9] / 16) * 10) + (q[9] & 0x0F));
|
||||
int aPos = ((amin * 60 * 75) + (asec * 75) + aframe) - 150;
|
||||
byte amin = (byte)(((q[7] / 16) * 10) + (q[7] & 0x0F));
|
||||
byte asec = (byte)(((q[8] / 16) * 10) + (q[8] & 0x0F));
|
||||
byte aframe = (byte)(((q[9] / 16) * 10) + (q[9] & 0x0F));
|
||||
int aPos = ((amin * 60 * 75) + (asec * 75) + aframe) - 150;
|
||||
|
||||
if(tracks[i].Indexes.ContainsKey(q[2]) &&
|
||||
aPos >= tracks[i].Indexes[q[2]])
|
||||
@@ -764,7 +766,7 @@ namespace Aaru.Core.Media
|
||||
byte[] preQ = new byte[12];
|
||||
byte[] nextQ = new byte[12];
|
||||
Array.Copy(deSub, (subPos + 12) - 96, preQ, 0, 12);
|
||||
Array.Copy(deSub, subPos + 12 + 96, nextQ, 0, 12);
|
||||
Array.Copy(deSub, subPos + 12 + 96, nextQ, 0, 12);
|
||||
bool status;
|
||||
|
||||
CRC16CCITTContext.Data(preQ, 10, out byte[] preCrc);
|
||||
@@ -923,10 +925,10 @@ namespace Aaru.Core.Media
|
||||
}
|
||||
}
|
||||
|
||||
amin = (byte)(((q[7] / 16) * 10) + (q[7] & 0x0F));
|
||||
asec = (byte)(((q[8] / 16) * 10) + (q[8] & 0x0F));
|
||||
aframe = (byte)(((q[9] / 16) * 10) + (q[9] & 0x0F));
|
||||
aPos = ((amin * 60 * 75) + (asec * 75) + aframe) - 150;
|
||||
amin = (byte)(((q[7] / 16) * 10) + (q[7] & 0x0F));
|
||||
asec = (byte)(((q[8] / 16) * 10) + (q[8] & 0x0F));
|
||||
aframe = (byte)(((q[9] / 16) * 10) + (q[9] & 0x0F));
|
||||
aPos = ((amin * 60 * 75) + (asec * 75) + aframe) - 150;
|
||||
|
||||
pmin = (byte)(((q[3] / 16) * 10) + (q[3] & 0x0F));
|
||||
psec = (byte)(((q[4] / 16) * 10) + (q[4] & 0x0F));
|
||||
@@ -1056,10 +1058,10 @@ namespace Aaru.Core.Media
|
||||
|
||||
if(preCrcOk)
|
||||
{
|
||||
rmin = (byte)(((preQ[7] / 16) * 10) + (preQ[7] & 0x0F));
|
||||
rsec = (byte)(((preQ[8] / 16) * 10) + (preQ[8] & 0x0F));
|
||||
rframe = (byte)(((preQ[9] / 16) * 10) + (preQ[9] & 0x0F));
|
||||
rPos = ((rmin * 60 * 75) + (rsec * 75) + rframe) - 150;
|
||||
rmin = (byte)(((preQ[7] / 16) * 10) + (preQ[7] & 0x0F));
|
||||
rsec = (byte)(((preQ[8] / 16) * 10) + (preQ[8] & 0x0F));
|
||||
rframe = (byte)(((preQ[9] / 16) * 10) + (preQ[9] & 0x0F));
|
||||
rPos = ((rmin * 60 * 75) + (rsec * 75) + rframe) - 150;
|
||||
|
||||
dPos = aPos - rPos;
|
||||
|
||||
@@ -1113,10 +1115,10 @@ namespace Aaru.Core.Media
|
||||
nextCrcOk &&
|
||||
!fixedAbsPos)
|
||||
{
|
||||
rmin = (byte)(((nextQ[7] / 16) * 10) + (nextQ[7] & 0x0F));
|
||||
rsec = (byte)(((nextQ[8] / 16) * 10) + (nextQ[8] & 0x0F));
|
||||
rframe = (byte)(((nextQ[9] / 16) * 10) + (nextQ[9] & 0x0F));
|
||||
rPos = ((rmin * 60 * 75) + (rsec * 75) + rframe) - 150;
|
||||
rmin = (byte)(((nextQ[7] / 16) * 10) + (nextQ[7] & 0x0F));
|
||||
rsec = (byte)(((nextQ[8] / 16) * 10) + (nextQ[8] & 0x0F));
|
||||
rframe = (byte)(((nextQ[9] / 16) * 10) + (nextQ[9] & 0x0F));
|
||||
rPos = ((rmin * 60 * 75) + (rsec * 75) + rframe) - 150;
|
||||
|
||||
dPos = rPos - pPos;
|
||||
|
||||
@@ -1178,10 +1180,10 @@ namespace Aaru.Core.Media
|
||||
|
||||
if(preCrcOk)
|
||||
{
|
||||
rmin = (byte)(((preQ[7] / 16) * 10) + (preQ[7] & 0x0F));
|
||||
rsec = (byte)(((preQ[8] / 16) * 10) + (preQ[8] & 0x0F));
|
||||
rframe = (byte)(((preQ[9] / 16) * 10) + (preQ[9] & 0x0F));
|
||||
rPos = ((rmin * 60 * 75) + (rsec * 75) + rframe) - 150;
|
||||
rmin = (byte)(((preQ[7] / 16) * 10) + (preQ[7] & 0x0F));
|
||||
rsec = (byte)(((preQ[8] / 16) * 10) + (preQ[8] & 0x0F));
|
||||
rframe = (byte)(((preQ[9] / 16) * 10) + (preQ[9] & 0x0F));
|
||||
rPos = ((rmin * 60 * 75) + (rsec * 75) + rframe) - 150;
|
||||
|
||||
dPos = aPos - rPos;
|
||||
|
||||
@@ -1215,10 +1217,10 @@ namespace Aaru.Core.Media
|
||||
|
||||
if(nextCrcOk)
|
||||
{
|
||||
rmin = (byte)(((nextQ[7] / 16) * 10) + (nextQ[7] & 0x0F));
|
||||
rsec = (byte)(((nextQ[8] / 16) * 10) + (nextQ[8] & 0x0F));
|
||||
rframe = (byte)(((nextQ[9] / 16) * 10) + (nextQ[9] & 0x0F));
|
||||
rPos = ((rmin * 60 * 75) + (rsec * 75) + rframe) - 150;
|
||||
rmin = (byte)(((nextQ[7] / 16) * 10) + (nextQ[7] & 0x0F));
|
||||
rsec = (byte)(((nextQ[8] / 16) * 10) + (nextQ[8] & 0x0F));
|
||||
rframe = (byte)(((nextQ[9] / 16) * 10) + (nextQ[9] & 0x0F));
|
||||
rPos = ((rmin * 60 * 75) + (rsec * 75) + rframe) - 150;
|
||||
|
||||
dPos = rPos - aPos;
|
||||
|
||||
@@ -1495,4 +1497,4 @@ namespace Aaru.Core.Media
|
||||
endProgress?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -676,17 +676,13 @@ namespace Aaru.Gui.ViewModels.Windows
|
||||
});
|
||||
|
||||
foreach(MediaTagType mediaTag in _inputFormat.Info.ReadableMediaTags.Where(mediaTag =>
|
||||
!outputFormat.
|
||||
SupportedMediaTags.
|
||||
Contains(mediaTag) &&
|
||||
!ForceChecked))
|
||||
!outputFormat.SupportedMediaTags.Contains(mediaTag) && !ForceChecked))
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager.
|
||||
GetMessageBoxStandardWindow("Error",
|
||||
$"Converting image will lose media tag {mediaTag}, not continuing...",
|
||||
icon: Icon.
|
||||
Error).
|
||||
ShowDialog(_view));
|
||||
GetMessageBoxStandardWindow("Error",
|
||||
$"Converting image will lose media tag {mediaTag}, not continuing...",
|
||||
icon: Icon.Error).
|
||||
ShowDialog(_view));
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -694,9 +690,7 @@ namespace Aaru.Gui.ViewModels.Windows
|
||||
bool useLong = _inputFormat.Info.ReadableSectorTags.Count != 0;
|
||||
|
||||
foreach(SectorTagType sectorTag in _inputFormat.Info.ReadableSectorTags.Where(sectorTag =>
|
||||
!outputFormat.
|
||||
SupportedSectorTags.
|
||||
Contains(sectorTag)))
|
||||
!outputFormat.SupportedSectorTags.Contains(sectorTag)))
|
||||
{
|
||||
if(ForceChecked)
|
||||
{
|
||||
@@ -709,11 +703,10 @@ namespace Aaru.Gui.ViewModels.Windows
|
||||
}
|
||||
|
||||
await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager.
|
||||
GetMessageBoxStandardWindow("Error",
|
||||
$"Converting image will lose sector tag {sectorTag}, not continuing...",
|
||||
icon: Icon.
|
||||
Error).
|
||||
ShowDialog(_view));
|
||||
GetMessageBoxStandardWindow("Error",
|
||||
$"Converting image will lose sector tag {sectorTag}, not continuing...",
|
||||
icon: Icon.Error).
|
||||
ShowDialog(_view));
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -763,11 +756,10 @@ namespace Aaru.Gui.ViewModels.Windows
|
||||
_inputFormat.Info.Sectors, _inputFormat.Info.SectorSize))
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager.
|
||||
GetMessageBoxStandardWindow("Error",
|
||||
$"Error {outputFormat.ErrorMessage} creating output image.",
|
||||
icon: Icon.
|
||||
Error).
|
||||
ShowDialog(_view));
|
||||
GetMessageBoxStandardWindow("Error",
|
||||
$"Error {outputFormat.ErrorMessage} creating output image.",
|
||||
icon: Icon.Error).
|
||||
ShowDialog(_view));
|
||||
|
||||
AaruConsole.ErrorWriteLine("Error {0} creating output image.", outputFormat.ErrorMessage);
|
||||
|
||||
@@ -810,12 +802,9 @@ namespace Aaru.Gui.ViewModels.Windows
|
||||
if(ForceChecked != true)
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager.
|
||||
GetMessageBoxStandardWindow("Error",
|
||||
$"Error {outputFormat.ErrorMessage} setting metadata, not continuing...",
|
||||
icon
|
||||
: Icon.
|
||||
Error).
|
||||
ShowDialog(_view));
|
||||
GetMessageBoxStandardWindow("Error",
|
||||
$"Error {outputFormat.ErrorMessage} setting metadata, not continuing...",
|
||||
icon: Icon.Error).ShowDialog(_view));
|
||||
|
||||
AaruConsole.ErrorWriteLine("not continuing...");
|
||||
|
||||
@@ -841,12 +830,10 @@ namespace Aaru.Gui.ViewModels.Windows
|
||||
if(!outputOptical.SetTracks(tracks))
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager.
|
||||
GetMessageBoxStandardWindow("Error",
|
||||
$"Error {outputFormat.ErrorMessage} sending tracks list to output image.",
|
||||
icon:
|
||||
Icon.
|
||||
Error).
|
||||
ShowDialog(_view));
|
||||
GetMessageBoxStandardWindow("Error",
|
||||
$"Error {outputFormat.ErrorMessage} sending tracks list to output image.",
|
||||
icon: Icon.Error).
|
||||
ShowDialog(_view));
|
||||
|
||||
AaruConsole.ErrorWriteLine("Error {0} sending tracks list to output image.",
|
||||
outputFormat.ErrorMessage);
|
||||
@@ -881,12 +868,10 @@ namespace Aaru.Gui.ViewModels.Windows
|
||||
else
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager.
|
||||
GetMessageBoxStandardWindow("Error",
|
||||
$"Error {outputFormat.ErrorMessage} writing media tag, not continuing...",
|
||||
icon:
|
||||
Icon.
|
||||
Error).
|
||||
ShowDialog(_view));
|
||||
GetMessageBoxStandardWindow("Error",
|
||||
$"Error {outputFormat.ErrorMessage} writing media tag, not continuing...",
|
||||
icon: Icon.Error).
|
||||
ShowDialog(_view));
|
||||
|
||||
AaruConsole.ErrorWriteLine("Error {0} writing media tag, not continuing...",
|
||||
outputFormat.ErrorMessage);
|
||||
@@ -990,12 +975,9 @@ namespace Aaru.Gui.ViewModels.Windows
|
||||
else
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager.
|
||||
GetMessageBoxStandardWindow("Error",
|
||||
$"Error {outputFormat.ErrorMessage} writing sector {doneSectors}, not continuing...",
|
||||
icon
|
||||
: Icon.
|
||||
Error).
|
||||
ShowDialog(_view));
|
||||
GetMessageBoxStandardWindow("Error",
|
||||
$"Error {outputFormat.ErrorMessage} writing sector {doneSectors}, not continuing...",
|
||||
icon: Icon.Error).ShowDialog(_view));
|
||||
|
||||
AaruConsole.ErrorWriteLine("Error {0} writing sector {1}, not continuing...",
|
||||
outputFormat.ErrorMessage, doneSectors);
|
||||
@@ -1121,14 +1103,9 @@ namespace Aaru.Gui.ViewModels.Windows
|
||||
track != null)
|
||||
{
|
||||
bool indexesChanged = CompactDisc.WriteSubchannelToImage(MmcSubchannel.Raw,
|
||||
MmcSubchannel.Raw, sector,
|
||||
doneSectors, 1, null, isrcs,
|
||||
(byte)track.TrackSequence,
|
||||
ref mcn, tracks.ToArray(),
|
||||
subchannelExtents, false,
|
||||
outputFormat, false, false,
|
||||
null, null,
|
||||
smallestPregapLbaPerTrack);
|
||||
MmcSubchannel.Raw, sector, doneSectors, 1, null, isrcs,
|
||||
(byte)track.TrackSequence, ref mcn, tracks.ToArray(), subchannelExtents, false,
|
||||
outputFormat, false, false, null, null, smallestPregapLbaPerTrack, false);
|
||||
|
||||
if(indexesChanged)
|
||||
outputOptical.SetTracks(tracks.ToList());
|
||||
@@ -1148,15 +1125,9 @@ namespace Aaru.Gui.ViewModels.Windows
|
||||
|
||||
{
|
||||
bool indexesChanged = CompactDisc.WriteSubchannelToImage(MmcSubchannel.Raw,
|
||||
MmcSubchannel.Raw, sector,
|
||||
doneSectors, sectorsToDo, null,
|
||||
isrcs,
|
||||
(byte)track.TrackSequence,
|
||||
ref mcn, tracks.ToArray(),
|
||||
subchannelExtents, false,
|
||||
outputFormat, false, false,
|
||||
null, null,
|
||||
smallestPregapLbaPerTrack);
|
||||
MmcSubchannel.Raw, sector, doneSectors, sectorsToDo, null, isrcs,
|
||||
(byte)track.TrackSequence, ref mcn, tracks.ToArray(), subchannelExtents, false,
|
||||
outputFormat, false, false, null, null, smallestPregapLbaPerTrack, false);
|
||||
|
||||
if(indexesChanged)
|
||||
outputOptical.SetTracks(tracks.ToList());
|
||||
@@ -1178,12 +1149,10 @@ namespace Aaru.Gui.ViewModels.Windows
|
||||
else
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager.
|
||||
GetMessageBoxStandardWindow("Error",
|
||||
$"Error {outputFormat.ErrorMessage} writing sector {doneSectors}, not continuing...",
|
||||
icon
|
||||
: Icon.
|
||||
Error).
|
||||
ShowDialog(_view));
|
||||
GetMessageBoxStandardWindow("Error",
|
||||
$"Error {outputFormat.ErrorMessage} writing sector {doneSectors}, not continuing...",
|
||||
icon: Icon.Error).
|
||||
ShowDialog(_view));
|
||||
|
||||
AaruConsole.ErrorWriteLine("Error {0} writing sector {1}, not continuing...",
|
||||
outputFormat.ErrorMessage, doneSectors);
|
||||
@@ -1301,12 +1270,10 @@ namespace Aaru.Gui.ViewModels.Windows
|
||||
else
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager.
|
||||
GetMessageBoxStandardWindow("Error",
|
||||
$"Error {outputFormat.ErrorMessage} writing sector {doneSectors}, not continuing...",
|
||||
icon
|
||||
: Icon.
|
||||
Error).
|
||||
ShowDialog(_view));
|
||||
GetMessageBoxStandardWindow("Error",
|
||||
$"Error {outputFormat.ErrorMessage} writing sector {doneSectors}, not continuing...",
|
||||
icon: Icon.Error).
|
||||
ShowDialog(_view));
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -1323,9 +1290,8 @@ namespace Aaru.Gui.ViewModels.Windows
|
||||
Progress2Value = Progress2MaxValue;
|
||||
});
|
||||
|
||||
foreach(SectorTagType tag in _inputFormat.
|
||||
Info.ReadableSectorTags.OrderBy(t => t).
|
||||
TakeWhile(tag => useLong && !_cancel))
|
||||
foreach(SectorTagType tag in _inputFormat.Info.ReadableSectorTags.OrderBy(t => t).
|
||||
TakeWhile(tag => useLong && !_cancel))
|
||||
{
|
||||
switch(tag)
|
||||
{
|
||||
@@ -1380,12 +1346,10 @@ namespace Aaru.Gui.ViewModels.Windows
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(action: async () =>
|
||||
await MessageBoxManager.
|
||||
GetMessageBoxStandardWindow("Error",
|
||||
$"Error {outputFormat.ErrorMessage} writing tag, not continuing...",
|
||||
icon
|
||||
: Icon.
|
||||
Error).
|
||||
ShowDialog(_view));
|
||||
GetMessageBoxStandardWindow("Error",
|
||||
$"Error {outputFormat.ErrorMessage} writing tag, not continuing...",
|
||||
icon: Icon.Error).
|
||||
ShowDialog(_view));
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -1440,12 +1404,10 @@ namespace Aaru.Gui.ViewModels.Windows
|
||||
else
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager.
|
||||
GetMessageBoxStandardWindow("Error",
|
||||
$"Error {outputFormat.ErrorMessage} writing tag for sector {doneSectors}, not continuing...",
|
||||
icon
|
||||
: Icon.
|
||||
Error).
|
||||
ShowDialog(_view));
|
||||
GetMessageBoxStandardWindow("Error",
|
||||
$"Error {outputFormat.ErrorMessage} writing tag for sector {doneSectors}, not continuing...",
|
||||
icon: Icon.Error).
|
||||
ShowDialog(_view));
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -1523,11 +1485,10 @@ namespace Aaru.Gui.ViewModels.Windows
|
||||
if(!outputFormat.Close())
|
||||
{
|
||||
await Dispatcher.UIThread.InvokeAsync(action: async () => await MessageBoxManager.
|
||||
GetMessageBoxStandardWindow("Error",
|
||||
$"Error {outputFormat.ErrorMessage} closing output image... Contents are not correct.",
|
||||
icon: Icon.
|
||||
Error).
|
||||
ShowDialog(_view));
|
||||
GetMessageBoxStandardWindow("Error",
|
||||
$"Error {outputFormat.ErrorMessage} closing output image... Contents are not correct.",
|
||||
icon: Icon.Error).
|
||||
ShowDialog(_view));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -525,8 +525,8 @@ namespace Aaru.Commands.Image
|
||||
// Try name
|
||||
else
|
||||
candidates.AddRange(plugins.WritableImages.Values.Where(t => string.Equals(t.Name, format,
|
||||
StringComparison.
|
||||
InvariantCultureIgnoreCase)));
|
||||
StringComparison.
|
||||
InvariantCultureIgnoreCase)));
|
||||
|
||||
if(candidates.Count == 0)
|
||||
{
|
||||
@@ -557,10 +557,7 @@ namespace Aaru.Commands.Image
|
||||
}
|
||||
|
||||
foreach(MediaTagType mediaTag in inputFormat.Info.ReadableMediaTags.Where(mediaTag =>
|
||||
!outputFormat.
|
||||
SupportedMediaTags.
|
||||
Contains(mediaTag) &&
|
||||
!force))
|
||||
!outputFormat.SupportedMediaTags.Contains(mediaTag) && !force))
|
||||
{
|
||||
AaruConsole.ErrorWriteLine("Converting image will lose media tag {0}, not continuing...", mediaTag);
|
||||
AaruConsole.ErrorWriteLine("If you don't care, use force option.");
|
||||
@@ -571,9 +568,7 @@ namespace Aaru.Commands.Image
|
||||
bool useLong = inputFormat.Info.ReadableSectorTags.Count != 0;
|
||||
|
||||
foreach(SectorTagType sectorTag in inputFormat.Info.ReadableSectorTags.Where(sectorTag =>
|
||||
!outputFormat.
|
||||
SupportedSectorTags.
|
||||
Contains(sectorTag)))
|
||||
!outputFormat.SupportedSectorTags.Contains(sectorTag)))
|
||||
{
|
||||
if(force)
|
||||
{
|
||||
@@ -639,9 +634,7 @@ namespace Aaru.Commands.Image
|
||||
List<DumpHardwareType> dumpHardware = inputFormat.DumpHardware;
|
||||
|
||||
foreach(MediaTagType mediaTag in inputFormat.Info.ReadableMediaTags.Where(mediaTag =>
|
||||
!force || outputFormat.
|
||||
SupportedMediaTags.
|
||||
Contains(mediaTag)))
|
||||
!force || outputFormat.SupportedMediaTags.Contains(mediaTag)))
|
||||
{
|
||||
AaruConsole.WriteLine("Converting media tag {0}", mediaTag);
|
||||
byte[] tag = inputFormat.ReadDiskTag(mediaTag);
|
||||
@@ -692,7 +685,7 @@ namespace Aaru.Commands.Image
|
||||
sectorsToDo = (uint)(trackSectors - doneSectors);
|
||||
|
||||
AaruConsole.Write("\rConverting sectors {0} to {1} in track {3} ({2:P2} done)",
|
||||
doneSectors + track.TrackStartSector,
|
||||
doneSectors + track.TrackStartSector,
|
||||
doneSectors + sectorsToDo + track.TrackStartSector,
|
||||
(doneSectors + track.TrackStartSector) / (double)inputFormat.Info.Sectors,
|
||||
track.TrackSequence);
|
||||
@@ -833,8 +826,8 @@ namespace Aaru.Commands.Image
|
||||
subchannelExtents.Add((int)s);
|
||||
}
|
||||
|
||||
foreach(SectorTagType tag in inputFormat.
|
||||
Info.ReadableSectorTags.OrderBy(t => t).TakeWhile(tag => useLong))
|
||||
foreach(SectorTagType tag in inputFormat.Info.ReadableSectorTags.OrderBy(t => t).
|
||||
TakeWhile(tag => useLong))
|
||||
{
|
||||
switch(tag)
|
||||
{
|
||||
@@ -896,7 +889,7 @@ namespace Aaru.Commands.Image
|
||||
sectorsToDo = (uint)(trackSectors - doneSectors);
|
||||
|
||||
AaruConsole.Write("\rConverting tag {4} for sectors {0} to {1} in track {3} ({2:P2} done)",
|
||||
doneSectors + track.TrackStartSector,
|
||||
doneSectors + track.TrackStartSector,
|
||||
doneSectors + sectorsToDo + track.TrackStartSector,
|
||||
(doneSectors + track.TrackStartSector) / (double)inputFormat.Info.Sectors,
|
||||
track.TrackSequence, tag);
|
||||
@@ -908,19 +901,10 @@ namespace Aaru.Commands.Image
|
||||
if(tag == SectorTagType.CdSectorSubchannel)
|
||||
{
|
||||
bool indexesChanged = CompactDisc.WriteSubchannelToImage(MmcSubchannel.Raw,
|
||||
MmcSubchannel.Raw, sector,
|
||||
doneSectors +
|
||||
track.TrackStartSector, 1,
|
||||
null, isrcs,
|
||||
(byte)track.TrackSequence,
|
||||
ref mcn, tracks,
|
||||
subchannelExtents,
|
||||
fixSubchannelPosition,
|
||||
outputFormat,
|
||||
fixSubchannel,
|
||||
fixSubchannelCrc, null,
|
||||
null,
|
||||
smallestPregapLbaPerTrack);
|
||||
MmcSubchannel.Raw, sector, doneSectors + track.TrackStartSector, 1, null,
|
||||
isrcs, (byte)track.TrackSequence, ref mcn, tracks, subchannelExtents,
|
||||
fixSubchannelPosition, outputFormat, fixSubchannel, fixSubchannelCrc, null,
|
||||
null, smallestPregapLbaPerTrack, false);
|
||||
|
||||
if(indexesChanged)
|
||||
outputOptical.SetTracks(tracks.ToList());
|
||||
@@ -939,19 +923,10 @@ namespace Aaru.Commands.Image
|
||||
if(tag == SectorTagType.CdSectorSubchannel)
|
||||
{
|
||||
bool indexesChanged = CompactDisc.WriteSubchannelToImage(MmcSubchannel.Raw,
|
||||
MmcSubchannel.Raw, sector,
|
||||
doneSectors +
|
||||
track.TrackStartSector,
|
||||
sectorsToDo, null, isrcs,
|
||||
(byte)track.TrackSequence,
|
||||
ref mcn, tracks,
|
||||
subchannelExtents,
|
||||
fixSubchannelPosition,
|
||||
outputFormat,
|
||||
fixSubchannel,
|
||||
fixSubchannelCrc, null,
|
||||
null,
|
||||
smallestPregapLbaPerTrack);
|
||||
MmcSubchannel.Raw, sector, doneSectors + track.TrackStartSector,
|
||||
sectorsToDo, null, isrcs, (byte)track.TrackSequence, ref mcn, tracks,
|
||||
subchannelExtents, fixSubchannelPosition, outputFormat, fixSubchannel,
|
||||
fixSubchannelCrc, null, null, smallestPregapLbaPerTrack, false);
|
||||
|
||||
if(indexesChanged)
|
||||
outputOptical.SetTracks(tracks.ToList());
|
||||
|
||||
Reference in New Issue
Block a user