Convert track pregap warning into a single LINQ query.

This commit is contained in:
2020-04-22 00:28:49 +01:00
parent 5042b7f1e8
commit dd75b8aa5e

View File

@@ -339,27 +339,13 @@ namespace Aaru.Core.Devices.Dumping
}
if(!(_outputPlugin as IWritableOpticalImage).OpticalCapabilities.HasFlag(OpticalImageCapabilities.
CanStorePregaps))
CanStorePregaps) &&
tracks.Where(track => track.TrackSequence !=
tracks.First(t => t.TrackSession == track.TrackSession).TrackSequence).
Any(track => track.TrackPregap > 0))
{
foreach(Track track in tracks)
if(!_force)
{
if(track.TrackSequence == tracks.First(t => t.TrackSession == track.TrackSession).TrackSequence)
continue;
if(track.TrackPregap <= 0)
continue;
if(_force)
{
_dumpLog.
WriteLine("Output format does not support pregaps, this may end in a loss of data, continuing...");
ErrorMessage?.
Invoke("Output format does not support pregaps, this may end in a loss of data, continuing...");
break;
}
_dumpLog.WriteLine("Output format does not support pregaps, this may end in a loss of data, not continuing...");
StoppingErrorMessage?.
@@ -367,6 +353,11 @@ namespace Aaru.Core.Devices.Dumping
return;
}
_dumpLog.WriteLine("Output format does not support pregaps, this may end in a loss of data, continuing...");
ErrorMessage?.
Invoke("Output format does not support pregaps, this may end in a loss of data, continuing...");
}
for(int t = 1; t < tracks.Length; t++)