Read session information.

This commit is contained in:
2019-12-14 20:30:35 +00:00
parent 005cafce93
commit 255040431a

View File

@@ -96,6 +96,8 @@ namespace DiscImageChef.Core.Devices.Dumping
Dictionary<byte, byte> trackFlags = new Dictionary<byte, byte>(); Dictionary<byte, byte> trackFlags = new Dictionary<byte, byte>();
TrackType firstTrackType = TrackType.Audio; TrackType firstTrackType = TrackType.Audio;
Dictionary<int, long> leadOutStarts = new Dictionary<int, long>(); Dictionary<int, long> leadOutStarts = new Dictionary<int, long>();
int sessions = 1;
int firstTrackLastSession = 0;
Dictionary<MediaTagType, byte[]> mediaTags = new Dictionary<MediaTagType, byte[]>(); // Media tags Dictionary<MediaTagType, byte[]> mediaTags = new Dictionary<MediaTagType, byte[]>(); // Media tags
@@ -582,6 +584,21 @@ namespace DiscImageChef.Core.Devices.Dumping
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4); Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
mediaTags.Add(MediaTagType.CD_PMA, tmpBuf); mediaTags.Add(MediaTagType.CD_PMA, tmpBuf);
} }
dumpLog.WriteLine("Reading Session Information");
UpdateStatus?.Invoke("Reading Session Information");
sense = dev.ReadSessionInfo(out cmdBuf, out senseBuf, dev.Timeout, out _);
if(!sense)
{
Session.CDSessionInfo? session = Session.Decode(cmdBuf);
if(session.HasValue)
{
sessions = session.Value.LastCompleteSession;
firstTrackLastSession = session.Value.TrackDescriptors[0].TrackNumber;
}
}
} }
/// <summary>Dumps a compact disc</summary> /// <summary>Dumps a compact disc</summary>
@@ -617,21 +634,6 @@ namespace DiscImageChef.Core.Devices.Dumping
int sessions = 1; int sessions = 1;
int firstTrackLastSession = 0; int firstTrackLastSession = 0;
dumpLog.WriteLine("Reading Session Information");
UpdateStatus?.Invoke("Reading Session Information");
sense = dev.ReadSessionInfo(out cmdBuf, out senseBuf, dev.Timeout, out _);
if(!sense)
{
Session.CDSessionInfo? session = Session.Decode(cmdBuf);
if(session.HasValue)
{
sessions = session.Value.LastCompleteSession;
firstTrackLastSession = session.Value.TrackDescriptors[0].TrackNumber;
}
}
if(dskType == MediaType.CD || if(dskType == MediaType.CD ||
dskType == MediaType.CDROMXA) dskType == MediaType.CDROMXA)
{ {