Check to not dump blank media.

This commit is contained in:
2019-12-14 20:39:15 +00:00
parent 255040431a
commit 29cedae01f

View File

@@ -98,6 +98,8 @@ namespace DiscImageChef.Core.Devices.Dumping
Dictionary<int, long> leadOutStarts = new Dictionary<int, long>(); Dictionary<int, long> leadOutStarts = new Dictionary<int, long>();
int sessions = 1; int sessions = 1;
int firstTrackLastSession = 0; int firstTrackLastSession = 0;
ulong blocks;
Track[] tracks;
Dictionary<MediaTagType, byte[]> mediaTags = new Dictionary<MediaTagType, byte[]>(); // Media tags Dictionary<MediaTagType, byte[]> mediaTags = new Dictionary<MediaTagType, byte[]>(); // Media tags
@@ -528,6 +530,21 @@ namespace DiscImageChef.Core.Devices.Dumping
} }
} }
tracks = trackList.ToArray();
for(int t = 1; t < tracks.Length; t++)
tracks[t - 1].TrackEndSector = tracks[t].TrackStartSector - 1;
tracks[tracks.Length - 1].TrackEndSector = (ulong)lastSector;
blocks = (ulong)(lastSector + 1);
if(blocks == 0)
{
StoppingErrorMessage?.Invoke("Cannot dump blank media.");
return;
}
// ATIP exists on blank CDs // ATIP exists on blank CDs
dumpLog.WriteLine("Reading ATIP"); dumpLog.WriteLine("Reading ATIP");
UpdateStatus?.Invoke("Reading ATIP"); UpdateStatus?.Invoke("Reading ATIP");
@@ -605,6 +622,8 @@ namespace DiscImageChef.Core.Devices.Dumping
/// <param name="dskType">Disc type as detected in MMC layer</param> /// <param name="dskType">Disc type as detected in MMC layer</param>
internal void CompactDiscOld(ref MediaType dskType) internal void CompactDiscOld(ref MediaType dskType)
{ {
ulong blocks = 0;
Track[] tracks = new Track[0];
List<Track> trackList = new List<Track>(); List<Track> trackList = new List<Track>();
long lastSector = 0; long lastSector = 0;
Dictionary<byte, byte> trackFlags = new Dictionary<byte, byte>(); Dictionary<byte, byte> trackFlags = new Dictionary<byte, byte>();
@@ -728,21 +747,6 @@ namespace DiscImageChef.Core.Devices.Dumping
if(MMC.IsVideoNowColor(videoNowColorFrame)) if(MMC.IsVideoNowColor(videoNowColorFrame))
dskType = MediaType.VideoNowColor; dskType = MediaType.VideoNowColor;
Track[] tracks = trackList.ToArray();
for(int t = 1; t < tracks.Length; t++)
tracks[t - 1].TrackEndSector = tracks[t].TrackStartSector - 1;
tracks[tracks.Length - 1].TrackEndSector = (ulong)lastSector;
ulong blocks = (ulong)(lastSector + 1);
if(blocks == 0)
{
StoppingErrorMessage?.Invoke("Cannot dump blank media.");
return;
}
var leadOutExtents = new ExtentsULong(); var leadOutExtents = new ExtentsULong();
if(leadOutStarts.Any()) if(leadOutStarts.Any())