2018-07-23 23:25:43 +01:00
|
|
|
|
// /***************************************************************************
|
2016-08-17 01:32:20 +01:00
|
|
|
|
// The Disc Image Chef
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
//
|
2018-07-23 23:25:43 +01:00
|
|
|
|
// Filename : Read.cs
|
2016-08-17 01:32:20 +01:00
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
|
|
|
|
//
|
2018-07-23 23:25:43 +01:00
|
|
|
|
// Component : Disk image plugins.
|
2016-08-17 01:32:20 +01:00
|
|
|
|
//
|
|
|
|
|
|
// --[ Description ] ----------------------------------------------------------
|
|
|
|
|
|
//
|
2018-07-23 23:25:43 +01:00
|
|
|
|
// Reads BlindWrite 4 disc images.
|
2016-08-17 01:32:20 +01:00
|
|
|
|
//
|
|
|
|
|
|
// --[ License ] --------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// This library is free software; you can redistribute it and/or modify
|
|
|
|
|
|
// it under the terms of the GNU Lesser General Public License as
|
|
|
|
|
|
// published by the Free Software Foundation; either version 2.1 of the
|
|
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
|
|
//
|
|
|
|
|
|
// This library is distributed in the hope that it will be useful, but
|
|
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
|
|
//
|
|
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
|
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
//
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2018-12-29 17:34:38 +00:00
|
|
|
|
// Copyright © 2011-2019 Natalia Portillo
|
2016-08-17 01:32:20 +01:00
|
|
|
|
// ****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
2017-12-19 19:33:46 +00:00
|
|
|
|
using System.Globalization;
|
2016-08-17 01:32:20 +01:00
|
|
|
|
using System.IO;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
2017-12-19 19:33:46 +00:00
|
|
|
|
using DiscImageChef.CommonTypes;
|
2018-06-25 19:08:16 +01:00
|
|
|
|
using DiscImageChef.CommonTypes.Enums;
|
|
|
|
|
|
using DiscImageChef.CommonTypes.Exceptions;
|
|
|
|
|
|
using DiscImageChef.CommonTypes.Interfaces;
|
|
|
|
|
|
using DiscImageChef.CommonTypes.Structs;
|
2016-08-17 01:32:20 +01:00
|
|
|
|
using DiscImageChef.Console;
|
|
|
|
|
|
|
2017-12-20 17:15:26 +00:00
|
|
|
|
namespace DiscImageChef.DiscImages
|
2016-08-17 01:32:20 +01:00
|
|
|
|
{
|
2018-07-23 23:25:43 +01:00
|
|
|
|
public partial class BlindWrite4
|
2016-08-17 01:32:20 +01:00
|
|
|
|
{
|
2017-12-28 19:56:36 +00:00
|
|
|
|
public bool Open(IFilter imageFilter)
|
2016-08-17 01:32:20 +01:00
|
|
|
|
{
|
2016-09-05 17:37:31 +01:00
|
|
|
|
Stream stream = imageFilter.GetDataForkStream();
|
2016-08-17 01:32:20 +01:00
|
|
|
|
stream.Seek(0, SeekOrigin.Begin);
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(stream.Length < 19) return false;
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2018-01-28 17:46:06 +00:00
|
|
|
|
byte[] tmpArray = new byte[19];
|
2016-08-17 01:32:20 +01:00
|
|
|
|
byte[] tmpUShort = new byte[2];
|
2018-01-28 17:46:06 +00:00
|
|
|
|
byte[] tmpUInt = new byte[4];
|
|
|
|
|
|
byte[] tmpULong = new byte[8];
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
stream.Read(tmpArray, 0, 19);
|
|
|
|
|
|
|
2017-12-20 17:15:26 +00:00
|
|
|
|
if(!bw4Signature.SequenceEqual(tmpArray)) return false;
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2017-12-22 06:55:04 +00:00
|
|
|
|
header = new Bw4Header {Signature = tmpArray};
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
// Seems to always be 2
|
|
|
|
|
|
stream.Read(tmpUInt, 0, 4);
|
2017-12-20 17:15:26 +00:00
|
|
|
|
header.Unknown1 = BitConverter.ToUInt32(tmpUInt, 0);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
// Seems to be a timetamp
|
|
|
|
|
|
stream.Read(tmpULong, 0, 8);
|
2017-12-20 17:15:26 +00:00
|
|
|
|
header.Timestamp = BitConverter.ToUInt64(tmpULong, 0);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
stream.Read(tmpUInt, 0, 4);
|
2017-12-20 17:15:26 +00:00
|
|
|
|
header.VolumeIdLength = BitConverter.ToUInt32(tmpUInt, 0);
|
2018-01-28 17:46:06 +00:00
|
|
|
|
tmpArray = new byte[header.VolumeIdLength];
|
2016-08-17 01:32:20 +01:00
|
|
|
|
stream.Read(tmpArray, 0, tmpArray.Length);
|
2018-01-28 17:46:06 +00:00
|
|
|
|
header.VolumeIdBytes = tmpArray;
|
2017-12-20 17:15:26 +00:00
|
|
|
|
header.VolumeIdentifier = StringHandlers.CToString(header.VolumeIdBytes, Encoding.Default);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
stream.Read(tmpUInt, 0, 4);
|
2017-12-20 17:15:26 +00:00
|
|
|
|
header.SysIdLength = BitConverter.ToUInt32(tmpUInt, 0);
|
2018-01-28 17:46:06 +00:00
|
|
|
|
tmpArray = new byte[header.SysIdLength];
|
2016-08-17 01:32:20 +01:00
|
|
|
|
stream.Read(tmpArray, 0, tmpArray.Length);
|
2018-01-28 17:46:06 +00:00
|
|
|
|
header.SysIdBytes = tmpArray;
|
2017-12-20 17:15:26 +00:00
|
|
|
|
header.SystemIdentifier = StringHandlers.CToString(header.SysIdBytes, Encoding.Default);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
stream.Read(tmpUInt, 0, 4);
|
2017-12-20 17:15:26 +00:00
|
|
|
|
header.CommentsLength = BitConverter.ToUInt32(tmpUInt, 0);
|
2018-01-28 17:46:06 +00:00
|
|
|
|
tmpArray = new byte[header.CommentsLength];
|
2016-08-17 01:32:20 +01:00
|
|
|
|
stream.Read(tmpArray, 0, tmpArray.Length);
|
2017-12-20 17:15:26 +00:00
|
|
|
|
header.CommentsBytes = tmpArray;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
header.Comments = StringHandlers.CToString(header.CommentsBytes, Encoding.Default);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
stream.Read(tmpUInt, 0, 4);
|
2017-12-20 17:15:26 +00:00
|
|
|
|
header.TrackDescriptors = BitConverter.ToUInt32(tmpUInt, 0);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
stream.Read(tmpUInt, 0, 4);
|
2017-12-20 17:15:26 +00:00
|
|
|
|
header.DataFileLength = BitConverter.ToUInt32(tmpUInt, 0);
|
2018-01-28 17:46:06 +00:00
|
|
|
|
tmpArray = new byte[header.DataFileLength];
|
2016-08-17 01:32:20 +01:00
|
|
|
|
stream.Read(tmpArray, 0, tmpArray.Length);
|
2017-12-20 17:15:26 +00:00
|
|
|
|
header.DataFileBytes = tmpArray;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
header.DataFile = StringHandlers.CToString(header.DataFileBytes, Encoding.Default);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
stream.Read(tmpUInt, 0, 4);
|
2017-12-20 17:15:26 +00:00
|
|
|
|
header.SubchannelFileLength = BitConverter.ToUInt32(tmpUInt, 0);
|
2018-01-28 17:46:06 +00:00
|
|
|
|
tmpArray = new byte[header.SubchannelFileLength];
|
2016-08-17 01:32:20 +01:00
|
|
|
|
stream.Read(tmpArray, 0, tmpArray.Length);
|
2017-12-20 17:15:26 +00:00
|
|
|
|
header.SubchannelFileBytes = tmpArray;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
header.SubchannelFile = StringHandlers.CToString(header.SubchannelFileBytes, Encoding.Default);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
stream.Read(tmpUInt, 0, 4);
|
2017-12-20 17:15:26 +00:00
|
|
|
|
header.Unknown2 = BitConverter.ToUInt32(tmpUInt, 0);
|
|
|
|
|
|
header.Unknown3 = (byte)stream.ReadByte();
|
2018-01-28 17:46:06 +00:00
|
|
|
|
tmpArray = new byte[header.Unknown3];
|
2017-12-20 17:15:26 +00:00
|
|
|
|
stream.Read(tmpArray, 0, header.Unknown3);
|
|
|
|
|
|
header.Unknown4 = tmpArray;
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "header.signature = {0}",
|
2017-12-20 17:15:26 +00:00
|
|
|
|
StringHandlers.CToString(header.Signature));
|
2018-01-28 17:46:06 +00:00
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "header.unknown1 = {0}", header.Unknown1);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "header.timestamp = {0}", header.Timestamp);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "header.volumeIdLength = {0}", header.VolumeIdLength);
|
2017-12-20 17:15:26 +00:00
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "header.volumeIdentifier = {0}", header.VolumeIdentifier);
|
2018-01-28 17:46:06 +00:00
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "header.sysIdLength = {0}", header.SysIdLength);
|
2017-12-20 17:15:26 +00:00
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "header.systemIdentifier = {0}", header.SystemIdentifier);
|
2018-01-28 17:46:06 +00:00
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "header.commentsLength = {0}", header.CommentsLength);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "header.comments = {0}", header.Comments);
|
2017-12-20 17:15:26 +00:00
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "header.trackDescriptors = {0}", header.TrackDescriptors);
|
2018-01-28 17:46:06 +00:00
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "header.dataFileLength = {0}", header.DataFileLength);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "header.dataFilter = {0}", header.DataFilter);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "header.dataFile = {0}", header.DataFile);
|
2017-12-19 20:33:03 +00:00
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "header.subchannelFileLength = {0}",
|
2017-12-20 17:15:26 +00:00
|
|
|
|
header.SubchannelFileLength);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "header.subchannelFilter = {0}", header.SubchannelFilter);
|
2018-01-28 17:46:06 +00:00
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "header.subchannelFile = {0}", header.SubchannelFile);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "header.unknown2 = {0}", header.Unknown2);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "header.unknown3 = {0}", header.Unknown3);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "header.unknown4.Length = {0}", header.Unknown4.Length);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2017-12-20 17:15:26 +00:00
|
|
|
|
bwTracks = new List<Bw4TrackDescriptor>();
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2017-12-20 17:15:26 +00:00
|
|
|
|
for(int i = 0; i < header.TrackDescriptors; i++)
|
2016-08-17 01:32:20 +01:00
|
|
|
|
{
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "stream.Position = {0}", stream.Position);
|
|
|
|
|
|
|
2017-12-20 17:15:26 +00:00
|
|
|
|
Bw4TrackDescriptor track = new Bw4TrackDescriptor();
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
stream.Read(tmpUInt, 0, 4);
|
|
|
|
|
|
track.filenameLen = BitConverter.ToUInt32(tmpUInt, 0);
|
2018-01-28 17:46:06 +00:00
|
|
|
|
tmpArray = new byte[track.filenameLen];
|
2016-08-17 01:32:20 +01:00
|
|
|
|
stream.Read(tmpArray, 0, tmpArray.Length);
|
|
|
|
|
|
track.filenameBytes = tmpArray;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
track.filename = StringHandlers.CToString(track.filenameBytes, Encoding.Default);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
stream.Read(tmpUInt, 0, 4);
|
2018-01-28 17:46:06 +00:00
|
|
|
|
track.offset = BitConverter.ToUInt32(tmpUInt, 0);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
track.subchannel = (byte)stream.ReadByte();
|
|
|
|
|
|
|
|
|
|
|
|
tmpArray = new byte[3];
|
|
|
|
|
|
stream.Read(tmpArray, 0, 3);
|
|
|
|
|
|
track.unknown1 = tmpArray;
|
|
|
|
|
|
|
|
|
|
|
|
stream.Read(tmpUInt, 0, 4);
|
|
|
|
|
|
track.unknown2 = BitConverter.ToUInt32(tmpUInt, 0);
|
|
|
|
|
|
track.unknown3 = (byte)stream.ReadByte();
|
2018-01-28 17:46:06 +00:00
|
|
|
|
track.session = (byte)stream.ReadByte();
|
2016-08-17 01:32:20 +01:00
|
|
|
|
track.unknown4 = (byte)stream.ReadByte();
|
2018-01-28 17:46:06 +00:00
|
|
|
|
track.adrCtl = (byte)stream.ReadByte();
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2018-01-28 17:46:06 +00:00
|
|
|
|
track.unknown5 = (byte)stream.ReadByte();
|
2017-12-20 17:15:26 +00:00
|
|
|
|
track.trackMode = (Bw4TrackType)stream.ReadByte();
|
2018-01-28 17:46:06 +00:00
|
|
|
|
track.unknown6 = (byte)stream.ReadByte();
|
|
|
|
|
|
track.point = (byte)stream.ReadByte();
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
stream.Read(tmpUInt, 0, 4);
|
|
|
|
|
|
track.unknown7 = BitConverter.ToUInt32(tmpUInt, 0);
|
|
|
|
|
|
stream.Read(tmpUInt, 0, 4);
|
|
|
|
|
|
track.unknown8 = BitConverter.ToUInt32(tmpUInt, 0);
|
|
|
|
|
|
stream.Read(tmpUInt, 0, 4);
|
|
|
|
|
|
track.unknown9 = BitConverter.ToUInt32(tmpUInt, 0);
|
|
|
|
|
|
stream.Read(tmpUInt, 0, 4);
|
|
|
|
|
|
track.unknown10 = BitConverter.ToUInt32(tmpUInt, 0);
|
|
|
|
|
|
stream.Read(tmpUShort, 0, 2);
|
|
|
|
|
|
track.unknown11 = BitConverter.ToUInt16(tmpUShort, 0);
|
|
|
|
|
|
stream.Read(tmpUInt, 0, 4);
|
|
|
|
|
|
track.lastSector = BitConverter.ToUInt32(tmpUInt, 0);
|
2018-01-28 17:46:06 +00:00
|
|
|
|
track.unknown12 = (byte)stream.ReadByte();
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
stream.Read(tmpUInt, 0, 4);
|
|
|
|
|
|
track.pregap = BitConverter.ToInt32(tmpUInt, 0);
|
|
|
|
|
|
stream.Read(tmpUInt, 0, 4);
|
|
|
|
|
|
track.startSector = BitConverter.ToInt32(tmpUInt, 0);
|
|
|
|
|
|
|
|
|
|
|
|
track.unknown13 = new uint[2];
|
|
|
|
|
|
for(int j = 0; j < track.unknown13.Length; j++)
|
|
|
|
|
|
{
|
|
|
|
|
|
stream.Read(tmpUInt, 0, 4);
|
|
|
|
|
|
track.unknown13[j] = BitConverter.ToUInt32(tmpUInt, 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
stream.Read(tmpUInt, 0, 4);
|
|
|
|
|
|
track.titleLen = BitConverter.ToUInt32(tmpUInt, 0);
|
2018-01-28 17:46:06 +00:00
|
|
|
|
tmpArray = new byte[track.titleLen];
|
2016-08-17 01:32:20 +01:00
|
|
|
|
stream.Read(tmpArray, 0, tmpArray.Length);
|
|
|
|
|
|
track.titleBytes = tmpArray;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
track.title = StringHandlers.CToString(track.titleBytes, Encoding.Default);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
stream.Read(tmpUInt, 0, 4);
|
|
|
|
|
|
track.performerLen = BitConverter.ToUInt32(tmpUInt, 0);
|
2018-01-28 17:46:06 +00:00
|
|
|
|
tmpArray = new byte[track.performerLen];
|
2016-08-17 01:32:20 +01:00
|
|
|
|
stream.Read(tmpArray, 0, tmpArray.Length);
|
|
|
|
|
|
track.performerBytes = tmpArray;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
track.performer = StringHandlers.CToString(track.performerBytes, Encoding.Default);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
stream.Read(tmpUInt, 0, 4);
|
|
|
|
|
|
track.unkStrLen1 = BitConverter.ToUInt32(tmpUInt, 0);
|
2018-01-28 17:46:06 +00:00
|
|
|
|
tmpArray = new byte[track.unkStrLen1];
|
2016-08-17 01:32:20 +01:00
|
|
|
|
stream.Read(tmpArray, 0, tmpArray.Length);
|
|
|
|
|
|
track.unkStrBytes1 = tmpArray;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
track.unkString1 = StringHandlers.CToString(track.unkStrBytes1, Encoding.Default);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
stream.Read(tmpUInt, 0, 4);
|
|
|
|
|
|
track.unkStrLen2 = BitConverter.ToUInt32(tmpUInt, 0);
|
2018-01-28 17:46:06 +00:00
|
|
|
|
tmpArray = new byte[track.unkStrLen2];
|
2016-08-17 01:32:20 +01:00
|
|
|
|
stream.Read(tmpArray, 0, tmpArray.Length);
|
|
|
|
|
|
track.unkStrBytes2 = tmpArray;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
track.unkString2 = StringHandlers.CToString(track.unkStrBytes2, Encoding.Default);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
stream.Read(tmpUInt, 0, 4);
|
|
|
|
|
|
track.unkStrLen3 = BitConverter.ToUInt32(tmpUInt, 0);
|
2018-01-28 17:46:06 +00:00
|
|
|
|
tmpArray = new byte[track.unkStrLen3];
|
2016-08-17 01:32:20 +01:00
|
|
|
|
stream.Read(tmpArray, 0, tmpArray.Length);
|
|
|
|
|
|
track.unkStrBytes3 = tmpArray;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
track.unkString3 = StringHandlers.CToString(track.unkStrBytes3, Encoding.Default);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
stream.Read(tmpUInt, 0, 4);
|
|
|
|
|
|
track.unkStrLen4 = BitConverter.ToUInt32(tmpUInt, 0);
|
2018-01-28 17:46:06 +00:00
|
|
|
|
tmpArray = new byte[track.unkStrLen4];
|
2016-08-17 01:32:20 +01:00
|
|
|
|
stream.Read(tmpArray, 0, tmpArray.Length);
|
|
|
|
|
|
track.unkStrBytes4 = tmpArray;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
track.unkString4 = StringHandlers.CToString(track.unkStrBytes4, Encoding.Default);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
stream.Read(tmpUInt, 0, 4);
|
|
|
|
|
|
track.discIdLen = BitConverter.ToUInt32(tmpUInt, 0);
|
2018-01-28 17:46:06 +00:00
|
|
|
|
tmpArray = new byte[track.discIdLen];
|
2016-08-17 01:32:20 +01:00
|
|
|
|
stream.Read(tmpArray, 0, tmpArray.Length);
|
|
|
|
|
|
track.discIdBytes = tmpArray;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
track.discId = StringHandlers.CToString(track.discIdBytes, Encoding.Default);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
stream.Read(tmpUInt, 0, 4);
|
|
|
|
|
|
track.unkStrLen5 = BitConverter.ToUInt32(tmpUInt, 0);
|
2018-01-28 17:46:06 +00:00
|
|
|
|
tmpArray = new byte[track.unkStrLen5];
|
2016-08-17 01:32:20 +01:00
|
|
|
|
stream.Read(tmpArray, 0, tmpArray.Length);
|
|
|
|
|
|
track.unkStrBytes5 = tmpArray;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
track.unkString5 = StringHandlers.CToString(track.unkStrBytes5, Encoding.Default);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
stream.Read(tmpUInt, 0, 4);
|
|
|
|
|
|
track.unkStrLen6 = BitConverter.ToUInt32(tmpUInt, 0);
|
2018-01-28 17:46:06 +00:00
|
|
|
|
tmpArray = new byte[track.unkStrLen6];
|
2016-08-17 01:32:20 +01:00
|
|
|
|
stream.Read(tmpArray, 0, tmpArray.Length);
|
|
|
|
|
|
track.unkStrBytes6 = tmpArray;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
track.unkString6 = StringHandlers.CToString(track.unkStrBytes6, Encoding.Default);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
stream.Read(tmpUInt, 0, 4);
|
|
|
|
|
|
track.unkStrLen7 = BitConverter.ToUInt32(tmpUInt, 0);
|
2018-01-28 17:46:06 +00:00
|
|
|
|
tmpArray = new byte[track.unkStrLen7];
|
2016-08-17 01:32:20 +01:00
|
|
|
|
stream.Read(tmpArray, 0, tmpArray.Length);
|
|
|
|
|
|
track.unkStrBytes7 = tmpArray;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
track.unkString7 = StringHandlers.CToString(track.unkStrBytes7, Encoding.Default);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
stream.Read(tmpUInt, 0, 4);
|
|
|
|
|
|
track.unkStrLen8 = BitConverter.ToUInt32(tmpUInt, 0);
|
2018-01-28 17:46:06 +00:00
|
|
|
|
tmpArray = new byte[track.unkStrLen8];
|
2016-08-17 01:32:20 +01:00
|
|
|
|
stream.Read(tmpArray, 0, tmpArray.Length);
|
|
|
|
|
|
track.unkStrBytes8 = tmpArray;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
track.unkString8 = StringHandlers.CToString(track.unkStrBytes8, Encoding.Default);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
stream.Read(tmpUInt, 0, 4);
|
|
|
|
|
|
track.unkStrLen9 = BitConverter.ToUInt32(tmpUInt, 0);
|
2018-01-28 17:46:06 +00:00
|
|
|
|
tmpArray = new byte[track.unkStrLen9];
|
2016-08-17 01:32:20 +01:00
|
|
|
|
stream.Read(tmpArray, 0, tmpArray.Length);
|
|
|
|
|
|
track.unkStrBytes9 = tmpArray;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
track.unkString9 = StringHandlers.CToString(track.unkStrBytes9, Encoding.Default);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
stream.Read(tmpUInt, 0, 4);
|
|
|
|
|
|
track.unkStrLen10 = BitConverter.ToUInt32(tmpUInt, 0);
|
2018-01-28 17:46:06 +00:00
|
|
|
|
tmpArray = new byte[track.unkStrLen10];
|
2016-08-17 01:32:20 +01:00
|
|
|
|
stream.Read(tmpArray, 0, tmpArray.Length);
|
|
|
|
|
|
track.unkStrBytes10 = tmpArray;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
track.unkString10 = StringHandlers.CToString(track.unkStrBytes10, Encoding.Default);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
stream.Read(tmpUInt, 0, 4);
|
|
|
|
|
|
track.unkStrLen11 = BitConverter.ToUInt32(tmpUInt, 0);
|
2018-01-28 17:46:06 +00:00
|
|
|
|
tmpArray = new byte[track.unkStrLen11];
|
2016-08-17 01:32:20 +01:00
|
|
|
|
stream.Read(tmpArray, 0, tmpArray.Length);
|
|
|
|
|
|
track.unkStrBytes11 = tmpArray;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
track.unkString11 = StringHandlers.CToString(track.unkStrBytes11, Encoding.Default);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
stream.Read(tmpUInt, 0, 4);
|
|
|
|
|
|
track.isrcLen = BitConverter.ToUInt32(tmpUInt, 0);
|
2018-01-28 17:46:06 +00:00
|
|
|
|
tmpArray = new byte[track.isrcLen];
|
2016-08-17 01:32:20 +01:00
|
|
|
|
stream.Read(tmpArray, 0, tmpArray.Length);
|
|
|
|
|
|
track.isrcBytes = tmpArray;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
track.isrcUpc = StringHandlers.CToString(track.isrcBytes, Encoding.Default);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.filenameLen = {0}", track.filenameLen);
|
2018-01-28 17:46:06 +00:00
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.filename = {0}", track.filename);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.offset = {0}", track.offset);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.subchannel = {0}", track.subchannel);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
for(int j = 0; j < track.unknown1.Length; j++)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unknown1[{1}] = 0x{0:X8}", track.unknown1[j],
|
|
|
|
|
|
j);
|
|
|
|
|
|
|
2018-01-28 17:46:06 +00:00
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unknown2 = {0}", track.unknown2);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unknown3 = {0}", track.unknown3);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.session = {0}", track.session);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unknown4 = {0}", track.unknown4);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.adrCtl = {0}", track.adrCtl);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unknown5 = {0}", track.unknown5);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.trackMode = {0}", track.trackMode);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unknown6 = {0}", track.unknown6);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.point = {0}", track.point);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unknown7 = {0}", track.unknown7);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unknown8 = {0}", track.unknown8);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unknown9 = {0}", track.unknown9);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unknown10 = {0}", track.unknown10);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unknown11 = {0}", track.unknown11);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.lastSector = {0}", track.lastSector);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unknown12 = {0}", track.unknown12);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.pregap = {0}", track.pregap);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.startSector = {0}", track.startSector);
|
|
|
|
|
|
for(int j = 0; j < track.unknown13.Length; j++)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unknown13[{1}] = 0x{0:X8}",
|
|
|
|
|
|
track.unknown13[j], j);
|
|
|
|
|
|
|
2018-01-28 17:46:06 +00:00
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.titleLen = {0}", track.titleLen);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.title = {0}", track.title);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.performerLen = {0}", track.performerLen);
|
2018-01-28 17:46:06 +00:00
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.performer = {0}", track.performer);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unkStrLen1 = {0}", track.unkStrLen1);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unkString1 = {0}", track.unkString1);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unkStrLen2 = {0}", track.unkStrLen2);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unkString2 = {0}", track.unkString2);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unkStrLen3 = {0}", track.unkStrLen3);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unkString3 = {0}", track.unkString3);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unkStrLen4 = {0}", track.unkStrLen4);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unkString4 = {0}", track.unkString4);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.discIdLen = {0}", track.discIdLen);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.discId = {0}", track.discId);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unkStrLen5 = {0}", track.unkStrLen5);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unkString5 = {0}", track.unkString5);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unkStrLen6 = {0}", track.unkStrLen6);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unkString6 = {0}", track.unkString6);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unkStrLen7 = {0}", track.unkStrLen7);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unkString7 = {0}", track.unkString7);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unkStrLen8 = {0}", track.unkStrLen8);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unkString8 = {0}", track.unkString8);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unkStrLen9 = {0}", track.unkStrLen9);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unkString9 = {0}", track.unkString9);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unkStrLen10 = {0}", track.unkStrLen10);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unkString10 = {0}", track.unkString10);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unkStrLen11 = {0}", track.unkStrLen11);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.unkString11 = {0}", track.unkString11);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.isrcLen = {0}", track.isrcLen);
|
|
|
|
|
|
DicConsole.DebugWriteLine("BlindWrite4 plugin", "track.isrcUpc = {0}", track.isrcUpc);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
bwTracks.Add(track);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2016-09-05 17:37:31 +01:00
|
|
|
|
FiltersList filtersList = new FiltersList();
|
|
|
|
|
|
|
2017-12-20 17:15:26 +00:00
|
|
|
|
if(!string.IsNullOrEmpty(header.DataFile))
|
2016-08-17 01:32:20 +01:00
|
|
|
|
while(true)
|
|
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
dataFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), header.DataFile));
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(dataFilter != null) break;
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2016-09-05 17:37:31 +01:00
|
|
|
|
dataFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(),
|
2017-12-20 17:15:26 +00:00
|
|
|
|
header.DataFile.ToLower(CultureInfo
|
2018-01-28 17:46:06 +00:00
|
|
|
|
.CurrentCulture)));
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(dataFilter != null) break;
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2016-09-05 17:37:31 +01:00
|
|
|
|
dataFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(),
|
2017-12-20 17:15:26 +00:00
|
|
|
|
header.DataFile.ToUpper(CultureInfo
|
2018-01-28 17:46:06 +00:00
|
|
|
|
.CurrentCulture)));
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(dataFilter != null) break;
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2016-09-05 17:37:31 +01:00
|
|
|
|
dataFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(),
|
2017-12-21 14:30:38 +00:00
|
|
|
|
header.DataFile.Split(new[] {'\\'},
|
2017-12-19 20:33:03 +00:00
|
|
|
|
StringSplitOptions
|
2018-01-28 17:46:06 +00:00
|
|
|
|
.RemoveEmptyEntries)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
.Last()));
|
|
|
|
|
|
if(dataFilter != null) break;
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2016-09-05 17:37:31 +01:00
|
|
|
|
dataFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(),
|
2017-12-21 14:30:38 +00:00
|
|
|
|
header.DataFile.Split(new[] {'\\'},
|
2017-12-19 20:33:03 +00:00
|
|
|
|
StringSplitOptions
|
2018-01-28 17:46:06 +00:00
|
|
|
|
.RemoveEmptyEntries).Last()
|
2017-12-19 20:33:03 +00:00
|
|
|
|
.ToLower(CultureInfo.CurrentCulture)));
|
|
|
|
|
|
if(dataFilter != null) break;
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2016-09-05 17:37:31 +01:00
|
|
|
|
dataFilter = filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(),
|
2017-12-21 14:30:38 +00:00
|
|
|
|
header.DataFile.Split(new[] {'\\'},
|
2017-12-19 20:33:03 +00:00
|
|
|
|
StringSplitOptions
|
2018-01-28 17:46:06 +00:00
|
|
|
|
.RemoveEmptyEntries).Last()
|
2017-12-19 20:33:03 +00:00
|
|
|
|
.ToUpper(CultureInfo.CurrentCulture)));
|
|
|
|
|
|
if(dataFilter != null) break;
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2017-12-21 17:58:51 +00:00
|
|
|
|
throw new ArgumentException($"Data file {header.DataFile} not found");
|
2016-08-17 01:32:20 +01:00
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
else throw new ArgumentException("Unable to find data file");
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2017-12-20 17:15:26 +00:00
|
|
|
|
if(!string.IsNullOrEmpty(header.SubchannelFile))
|
2016-08-17 01:32:20 +01:00
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
|
filtersList = new FiltersList();
|
2017-09-11 21:17:47 +01:00
|
|
|
|
|
2017-12-22 06:55:04 +00:00
|
|
|
|
subFilter =
|
|
|
|
|
|
((((filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), header.SubchannelFile)) ??
|
|
|
|
|
|
filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(),
|
|
|
|
|
|
header.SubchannelFile.ToLower(CultureInfo.CurrentCulture)))
|
|
|
|
|
|
) ??
|
|
|
|
|
|
filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(),
|
|
|
|
|
|
header.SubchannelFile.ToUpper(CultureInfo.CurrentCulture)))
|
|
|
|
|
|
) ??
|
|
|
|
|
|
filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(),
|
|
|
|
|
|
header.SubchannelFile.Split(new[] {'\\'},
|
|
|
|
|
|
StringSplitOptions
|
2018-01-28 17:46:06 +00:00
|
|
|
|
.RemoveEmptyEntries).Last()))
|
2017-12-22 06:55:04 +00:00
|
|
|
|
) ?? filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(),
|
|
|
|
|
|
header.SubchannelFile.Split(new[] {'\\'},
|
|
|
|
|
|
StringSplitOptions
|
2018-01-28 17:46:06 +00:00
|
|
|
|
.RemoveEmptyEntries).Last()
|
2017-12-22 06:55:04 +00:00
|
|
|
|
.ToLower(CultureInfo.CurrentCulture)))) ??
|
|
|
|
|
|
filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(),
|
|
|
|
|
|
header.SubchannelFile.Split(new[] {'\\'},
|
|
|
|
|
|
StringSplitOptions
|
2018-01-28 17:46:06 +00:00
|
|
|
|
.RemoveEmptyEntries).Last()
|
2017-12-22 06:55:04 +00:00
|
|
|
|
.ToUpper(CultureInfo.CurrentCulture)));
|
2016-08-17 01:32:20 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2018-06-22 08:08:38 +01:00
|
|
|
|
Tracks = new List<Track>();
|
|
|
|
|
|
Partitions = new List<Partition>();
|
|
|
|
|
|
offsetmap = new Dictionary<uint, ulong>();
|
|
|
|
|
|
trackFlags = new Dictionary<uint, byte>();
|
2016-08-17 01:32:20 +01:00
|
|
|
|
ushort maxSession = 0;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
ulong currentPos = 0;
|
2017-12-20 17:15:26 +00:00
|
|
|
|
foreach(Bw4TrackDescriptor bwTrack in bwTracks)
|
2016-08-17 01:32:20 +01:00
|
|
|
|
if(bwTrack.point < 0xA0)
|
|
|
|
|
|
{
|
2017-12-22 06:55:04 +00:00
|
|
|
|
Track track = new Track {TrackDescription = bwTrack.title, TrackEndSector = bwTrack.lastSector};
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
if(!string.IsNullOrEmpty(bwTrack.filename))
|
|
|
|
|
|
do
|
|
|
|
|
|
{
|
2017-12-19 20:33:03 +00:00
|
|
|
|
track.TrackFilter =
|
|
|
|
|
|
filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(), bwTrack.filename));
|
|
|
|
|
|
if(track.TrackFilter != null) break;
|
|
|
|
|
|
|
|
|
|
|
|
track.TrackFilter =
|
|
|
|
|
|
filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(),
|
|
|
|
|
|
bwTrack.filename.ToLower(CultureInfo
|
2018-01-28 17:46:06 +00:00
|
|
|
|
.CurrentCulture)));
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(track.TrackFilter != null) break;
|
|
|
|
|
|
|
|
|
|
|
|
track.TrackFilter =
|
|
|
|
|
|
filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(),
|
|
|
|
|
|
bwTrack.filename.ToUpper(CultureInfo
|
2018-01-28 17:46:06 +00:00
|
|
|
|
.CurrentCulture)));
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(track.TrackFilter != null) break;
|
|
|
|
|
|
|
|
|
|
|
|
track.TrackFilter =
|
|
|
|
|
|
filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(),
|
2017-12-21 14:30:38 +00:00
|
|
|
|
bwTrack.filename.Split(new[] {'\\'},
|
2017-12-19 20:33:03 +00:00
|
|
|
|
StringSplitOptions
|
2018-01-28 17:46:06 +00:00
|
|
|
|
.RemoveEmptyEntries)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
.Last()));
|
|
|
|
|
|
if(track.TrackFilter != null) break;
|
|
|
|
|
|
|
|
|
|
|
|
track.TrackFilter =
|
|
|
|
|
|
filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(),
|
2017-12-21 14:30:38 +00:00
|
|
|
|
bwTrack.filename.Split(new[] {'\\'},
|
2017-12-19 20:33:03 +00:00
|
|
|
|
StringSplitOptions
|
2018-01-28 17:46:06 +00:00
|
|
|
|
.RemoveEmptyEntries).Last()
|
2017-12-19 20:33:03 +00:00
|
|
|
|
.ToLower(CultureInfo.CurrentCulture)));
|
|
|
|
|
|
if(track.TrackFilter != null) break;
|
|
|
|
|
|
|
|
|
|
|
|
track.TrackFilter =
|
|
|
|
|
|
filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(),
|
2017-12-21 14:30:38 +00:00
|
|
|
|
bwTrack.filename.Split(new[] {'\\'},
|
2017-12-19 20:33:03 +00:00
|
|
|
|
StringSplitOptions
|
2018-01-28 17:46:06 +00:00
|
|
|
|
.RemoveEmptyEntries).Last()
|
2017-12-19 20:33:03 +00:00
|
|
|
|
.ToUpper(CultureInfo.CurrentCulture)));
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2016-09-05 17:37:31 +01:00
|
|
|
|
track.TrackFilter = dataFilter;
|
2016-08-17 01:32:20 +01:00
|
|
|
|
}
|
|
|
|
|
|
while(true);
|
2017-12-19 20:33:03 +00:00
|
|
|
|
else track.TrackFilter = dataFilter;
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2016-09-05 17:37:31 +01:00
|
|
|
|
track.TrackFile = dataFilter.GetFilename();
|
2018-01-28 17:46:06 +00:00
|
|
|
|
if(bwTrack.pregap != 0)
|
2018-06-22 08:08:38 +01:00
|
|
|
|
track.TrackFileOffset += (ulong)(bwTrack.startSector - bwTrack.pregap) * 2352;
|
|
|
|
|
|
track.TrackFileType = "BINARY";
|
|
|
|
|
|
track.TrackPregap = (ulong)(bwTrack.startSector - bwTrack.pregap);
|
|
|
|
|
|
track.TrackRawBytesPerSector = 2352;
|
|
|
|
|
|
track.TrackSequence = bwTrack.point;
|
|
|
|
|
|
track.TrackSession = bwTrack.session;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(track.TrackSession > maxSession) maxSession = track.TrackSession;
|
2018-06-22 08:08:38 +01:00
|
|
|
|
track.TrackStartSector = (ulong)bwTrack.startSector;
|
|
|
|
|
|
track.TrackSubchannelFilter = subFilter;
|
|
|
|
|
|
track.TrackSubchannelFile = subFilter.GetFilename();
|
|
|
|
|
|
track.TrackSubchannelOffset = track.TrackStartSector * 96 + track.TrackPregap * 96;
|
2016-09-05 17:37:31 +01:00
|
|
|
|
if(subFilter != null && bwTrack.subchannel > 0)
|
2016-08-17 01:32:20 +01:00
|
|
|
|
{
|
|
|
|
|
|
track.TrackSubchannelType = TrackSubchannelType.Packed;
|
2017-12-26 06:05:12 +00:00
|
|
|
|
if(!imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorSubchannel))
|
|
|
|
|
|
imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorSubchannel);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
else track.TrackSubchannelType = TrackSubchannelType.None;
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
switch(bwTrack.trackMode)
|
|
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
case Bw4TrackType.Audio:
|
2018-01-28 17:46:06 +00:00
|
|
|
|
track.TrackType = TrackType.Audio;
|
|
|
|
|
|
imageInfo.SectorSize = 2352;
|
2016-08-17 01:32:20 +01:00
|
|
|
|
track.TrackBytesPerSector = 2352;
|
|
|
|
|
|
break;
|
2017-12-20 17:15:26 +00:00
|
|
|
|
case Bw4TrackType.Mode1:
|
|
|
|
|
|
track.TrackType = TrackType.CdMode1;
|
2017-12-26 06:05:12 +00:00
|
|
|
|
if(!imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorSync))
|
|
|
|
|
|
imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorSync);
|
|
|
|
|
|
if(!imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorHeader))
|
|
|
|
|
|
imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorHeader);
|
|
|
|
|
|
if(!imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorSubHeader))
|
|
|
|
|
|
imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorSubHeader);
|
|
|
|
|
|
if(!imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorEcc))
|
|
|
|
|
|
imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorEcc);
|
|
|
|
|
|
if(!imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorEccP))
|
|
|
|
|
|
imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorEccP);
|
|
|
|
|
|
if(!imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorEccQ))
|
|
|
|
|
|
imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorEccQ);
|
|
|
|
|
|
if(!imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorEdc))
|
|
|
|
|
|
imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorEdc);
|
|
|
|
|
|
if(imageInfo.SectorSize < 2048) imageInfo.SectorSize = 2048;
|
2018-06-22 08:08:38 +01:00
|
|
|
|
track.TrackBytesPerSector = 2048;
|
2016-08-17 01:32:20 +01:00
|
|
|
|
break;
|
2017-12-20 17:15:26 +00:00
|
|
|
|
case Bw4TrackType.Mode2:
|
|
|
|
|
|
track.TrackType = TrackType.CdMode2Formless;
|
2017-12-26 06:05:12 +00:00
|
|
|
|
if(!imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorSync))
|
|
|
|
|
|
imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorSync);
|
|
|
|
|
|
if(!imageInfo.ReadableSectorTags.Contains(SectorTagType.CdSectorHeader))
|
|
|
|
|
|
imageInfo.ReadableSectorTags.Add(SectorTagType.CdSectorHeader);
|
|
|
|
|
|
if(imageInfo.SectorSize < 2336) imageInfo.SectorSize = 2336;
|
2018-06-22 08:08:38 +01:00
|
|
|
|
track.TrackBytesPerSector = 2336;
|
2016-08-17 01:32:20 +01:00
|
|
|
|
break;
|
|
|
|
|
|
default:
|
2018-01-28 17:46:06 +00:00
|
|
|
|
track.TrackType = TrackType.Data;
|
2016-08-17 01:32:20 +01:00
|
|
|
|
track.TrackRawBytesPerSector = 2048;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
imageInfo.SectorSize = 2048;
|
|
|
|
|
|
track.TrackBytesPerSector = 2048;
|
2016-08-17 01:32:20 +01:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
track.Indexes = new Dictionary<int, ulong>();
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(bwTrack.pregap > 0) track.Indexes.Add(0, (ulong)bwTrack.pregap);
|
2018-06-22 08:08:38 +01:00
|
|
|
|
track.Indexes.Add(1, (ulong)bwTrack.startSector);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2018-01-28 17:46:06 +00:00
|
|
|
|
Partition partition = new Partition();
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(bwTrack.pregap > 0) currentPos += (ulong)(bwTrack.startSector - bwTrack.pregap) * 2352;
|
2018-06-22 08:08:38 +01:00
|
|
|
|
partition.Description = track.TrackDescription;
|
|
|
|
|
|
partition.Size = (track.TrackEndSector - track.TrackStartSector + 1) * 2352;
|
|
|
|
|
|
partition.Length = track.TrackEndSector - track.TrackStartSector;
|
|
|
|
|
|
partition.Sequence = track.TrackSequence;
|
|
|
|
|
|
partition.Offset = currentPos;
|
|
|
|
|
|
partition.Start = track.TrackStartSector;
|
|
|
|
|
|
partition.Type = track.TrackType.ToString();
|
2018-01-28 17:46:06 +00:00
|
|
|
|
|
|
|
|
|
|
Partitions.Add(partition);
|
|
|
|
|
|
Tracks.Add(track);
|
2017-07-19 16:37:11 +01:00
|
|
|
|
currentPos += partition.Size;
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
if(!offsetmap.ContainsKey(track.TrackSequence))
|
|
|
|
|
|
offsetmap.Add(track.TrackSequence, track.TrackStartSector);
|
|
|
|
|
|
|
|
|
|
|
|
if(!trackFlags.ContainsKey(track.TrackSequence))
|
|
|
|
|
|
trackFlags.Add(track.TrackSequence, (byte)(bwTrack.adrCtl & 0x0F));
|
|
|
|
|
|
|
2017-12-26 06:05:12 +00:00
|
|
|
|
imageInfo.Sectors += (ulong)(bwTrack.lastSector - bwTrack.startSector + 1);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2018-01-28 17:46:06 +00:00
|
|
|
|
imageInfo.MediaBarcode = bwTrack.isrcUpc;
|
2017-12-26 06:05:12 +00:00
|
|
|
|
imageInfo.MediaSerialNumber = bwTrack.discId;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
imageInfo.MediaTitle = bwTrack.title;
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(!string.IsNullOrEmpty(bwTrack.isrcUpc) &&
|
2017-12-26 06:05:12 +00:00
|
|
|
|
!imageInfo.ReadableMediaTags.Contains(MediaTagType.CD_MCN))
|
|
|
|
|
|
imageInfo.ReadableMediaTags.Add(MediaTagType.CD_MCN);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2018-01-28 17:46:06 +00:00
|
|
|
|
Sessions = new List<Session>();
|
2016-08-17 01:32:20 +01:00
|
|
|
|
for(ushort i = 1; i <= maxSession; i++)
|
|
|
|
|
|
{
|
2017-12-22 06:55:04 +00:00
|
|
|
|
Session session = new Session
|
|
|
|
|
|
{
|
2018-12-31 13:17:27 +00:00
|
|
|
|
SessionSequence = i, StartTrack = uint.MaxValue, StartSector = uint.MaxValue
|
2017-12-22 06:55:04 +00:00
|
|
|
|
};
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2018-01-28 17:46:06 +00:00
|
|
|
|
foreach(Track track in Tracks.Where(track => track.TrackSession == i))
|
2017-12-21 16:33:16 +00:00
|
|
|
|
{
|
2018-01-28 17:46:06 +00:00
|
|
|
|
if(track.TrackSequence < session.StartTrack) session.StartTrack = track.TrackSequence;
|
|
|
|
|
|
if(track.TrackSequence > session.EndTrack) session.StartTrack = track.TrackSequence;
|
2017-12-21 07:08:26 +00:00
|
|
|
|
if(track.TrackStartSector < session.StartSector) session.StartSector = track.TrackStartSector;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
if(track.TrackEndSector > session.EndSector) session.EndSector = track.TrackEndSector;
|
2017-12-21 07:08:26 +00:00
|
|
|
|
}
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2018-01-28 17:46:06 +00:00
|
|
|
|
Sessions.Add(session);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-26 06:05:12 +00:00
|
|
|
|
imageInfo.MediaType = MediaType.CD;
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2018-01-28 17:46:06 +00:00
|
|
|
|
imageInfo.Application = "BlindWrite";
|
2017-12-26 06:05:12 +00:00
|
|
|
|
imageInfo.ApplicationVersion = "4";
|
2018-01-28 17:46:06 +00:00
|
|
|
|
imageInfo.Version = "4";
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2018-01-28 17:46:06 +00:00
|
|
|
|
imageInfo.ImageSize = (ulong)dataFilter.GetDataForkLength();
|
|
|
|
|
|
imageInfo.CreationTime = dataFilter.GetCreationTime();
|
2017-12-26 06:05:12 +00:00
|
|
|
|
imageInfo.LastModificationTime = dataFilter.GetLastWriteTime();
|
2018-01-28 17:46:06 +00:00
|
|
|
|
imageInfo.XmlMediaType = XmlMediaType.OpticalDisc;
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2018-01-28 17:46:06 +00:00
|
|
|
|
bool data = false;
|
|
|
|
|
|
bool mode2 = false;
|
2016-08-17 01:32:20 +01:00
|
|
|
|
bool firstaudio = false;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
bool firstdata = false;
|
|
|
|
|
|
bool audio = false;
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2018-01-28 17:46:06 +00:00
|
|
|
|
foreach(Track bwTrack in Tracks)
|
2016-08-17 01:32:20 +01:00
|
|
|
|
{
|
|
|
|
|
|
// First track is audio
|
2017-12-22 06:55:04 +00:00
|
|
|
|
firstaudio |= bwTrack.TrackSequence == 1 && bwTrack.TrackType == TrackType.Audio;
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
// First track is data
|
2017-12-22 06:55:04 +00:00
|
|
|
|
firstdata |= bwTrack.TrackSequence == 1 && bwTrack.TrackType != TrackType.Audio;
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
// Any non first track is data
|
2017-12-22 06:55:04 +00:00
|
|
|
|
data |= bwTrack.TrackSequence != 1 && bwTrack.TrackType != TrackType.Audio;
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
// Any non first track is audio
|
2017-12-22 06:55:04 +00:00
|
|
|
|
audio |= bwTrack.TrackSequence != 1 && bwTrack.TrackType == TrackType.Audio;
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2017-12-22 06:55:04 +00:00
|
|
|
|
switch(bwTrack.TrackType)
|
2016-08-17 01:32:20 +01:00
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
case TrackType.CdMode2Formless:
|
2016-08-17 01:32:20 +01:00
|
|
|
|
mode2 = true;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-06-22 08:08:38 +01:00
|
|
|
|
if(!data && !firstdata) imageInfo.MediaType = MediaType.CDDA;
|
|
|
|
|
|
else if(firstaudio && data && Sessions.Count > 1 && mode2) imageInfo.MediaType = MediaType.CDPLUS;
|
|
|
|
|
|
else if(firstdata && audio || mode2) imageInfo.MediaType = MediaType.CDROMXA;
|
|
|
|
|
|
else if(!audio) imageInfo.MediaType = MediaType.CDROM;
|
|
|
|
|
|
else imageInfo.MediaType = MediaType.CD;
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2017-12-26 06:05:12 +00:00
|
|
|
|
imageInfo.Comments = header.Comments;
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2017-12-26 06:05:12 +00:00
|
|
|
|
DicConsole.VerboseWriteLine("BlindWrite image describes a disc of type {0}", imageInfo.MediaType);
|
|
|
|
|
|
if(!string.IsNullOrEmpty(imageInfo.Comments))
|
|
|
|
|
|
DicConsole.VerboseWriteLine("BlindrWrite comments: {0}", imageInfo.Comments);
|
2016-08-21 17:35:35 +01:00
|
|
|
|
|
2016-08-17 01:32:20 +01:00
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public byte[] ReadDiskTag(MediaTagType tag)
|
2016-08-17 01:32:20 +01:00
|
|
|
|
{
|
|
|
|
|
|
switch(tag)
|
|
|
|
|
|
{
|
|
|
|
|
|
case MediaTagType.CD_MCN:
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
2017-12-26 06:05:12 +00:00
|
|
|
|
if(imageInfo.MediaSerialNumber != null) return Encoding.ASCII.GetBytes(imageInfo.MediaSerialNumber);
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
|
|
|
|
|
throw new FeatureNotPresentImageException("Image does not contain MCN information.");
|
|
|
|
|
|
}
|
2016-08-17 01:32:20 +01:00
|
|
|
|
default:
|
|
|
|
|
|
throw new FeatureSupportedButNotImplementedImageException("Feature not supported by image format");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-12-31 13:17:27 +00:00
|
|
|
|
public byte[] ReadSector(ulong sectorAddress) => ReadSectors(sectorAddress, 1);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2018-12-31 13:17:27 +00:00
|
|
|
|
public byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) => ReadSectorsTag(sectorAddress, 1, tag);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2018-12-31 13:17:27 +00:00
|
|
|
|
public byte[] ReadSector(ulong sectorAddress, uint track) => ReadSectors(sectorAddress, 1, track);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2018-12-31 13:17:27 +00:00
|
|
|
|
public byte[] ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag) =>
|
|
|
|
|
|
ReadSectorsTag(sectorAddress, 1, track, tag);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public byte[] ReadSectors(ulong sectorAddress, uint length)
|
2016-08-17 01:32:20 +01:00
|
|
|
|
{
|
2017-12-21 16:33:16 +00:00
|
|
|
|
foreach(KeyValuePair<uint, ulong> kvp in from kvp in offsetmap
|
|
|
|
|
|
where sectorAddress >= kvp.Value
|
2018-01-28 17:46:06 +00:00
|
|
|
|
from track in Tracks
|
2018-06-22 08:08:38 +01:00
|
|
|
|
where track.TrackSequence == kvp.Key
|
|
|
|
|
|
where sectorAddress - kvp.Value <
|
2017-12-21 16:33:16 +00:00
|
|
|
|
track.TrackEndSector - track.TrackStartSector + 1
|
|
|
|
|
|
select kvp)
|
|
|
|
|
|
return ReadSectors(sectorAddress - kvp.Value, length, kvp.Key);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public byte[] ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag)
|
2016-08-17 01:32:20 +01:00
|
|
|
|
{
|
2017-12-21 16:33:16 +00:00
|
|
|
|
foreach(KeyValuePair<uint, ulong> kvp in from kvp in offsetmap
|
|
|
|
|
|
where sectorAddress >= kvp.Value
|
2018-01-28 17:46:06 +00:00
|
|
|
|
from track in Tracks
|
2018-06-22 08:08:38 +01:00
|
|
|
|
where track.TrackSequence == kvp.Key
|
|
|
|
|
|
where sectorAddress - kvp.Value <
|
2017-12-21 16:33:16 +00:00
|
|
|
|
track.TrackEndSector - track.TrackStartSector + 1
|
|
|
|
|
|
select kvp)
|
|
|
|
|
|
return ReadSectorsTag(sectorAddress - kvp.Value, length, kvp.Key, tag);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public byte[] ReadSectors(ulong sectorAddress, uint length, uint track)
|
2016-08-17 01:32:20 +01:00
|
|
|
|
{
|
2017-12-22 06:55:04 +00:00
|
|
|
|
Track dicTrack = new Track {TrackSequence = 0};
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2018-01-28 17:46:06 +00:00
|
|
|
|
foreach(Track bwTrack in Tracks.Where(bwTrack => bwTrack.TrackSequence == track))
|
2017-12-21 16:33:16 +00:00
|
|
|
|
{
|
2017-12-22 06:55:04 +00:00
|
|
|
|
dicTrack = bwTrack;
|
2017-12-21 07:08:26 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2017-12-22 06:55:04 +00:00
|
|
|
|
if(dicTrack.TrackSequence == 0)
|
2016-08-17 01:32:20 +01:00
|
|
|
|
throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image");
|
|
|
|
|
|
|
2017-12-22 06:55:04 +00:00
|
|
|
|
if(length + sectorAddress > dicTrack.TrackEndSector - dicTrack.TrackStartSector + 1)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
throw new ArgumentOutOfRangeException(nameof(length),
|
2017-12-22 06:55:04 +00:00
|
|
|
|
$"Requested more sectors ({length + sectorAddress}) than present in track ({dicTrack.TrackEndSector - dicTrack.TrackStartSector + 1}), won't cross tracks");
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2017-12-20 17:15:26 +00:00
|
|
|
|
uint sectorOffset;
|
|
|
|
|
|
uint sectorSize;
|
|
|
|
|
|
uint sectorSkip;
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2017-12-22 06:55:04 +00:00
|
|
|
|
switch(dicTrack.TrackType)
|
2016-08-17 01:32:20 +01:00
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
case TrackType.CdMode1:
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
sectorOffset = 16;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
sectorSize = 2048;
|
|
|
|
|
|
sectorSkip = 288;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
2017-12-20 17:15:26 +00:00
|
|
|
|
case TrackType.CdMode2Formless:
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
sectorOffset = 16;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
sectorSize = 2336;
|
|
|
|
|
|
sectorSkip = 0;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
2016-08-17 01:32:20 +01:00
|
|
|
|
case TrackType.Audio:
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
sectorOffset = 0;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
sectorSize = 2352;
|
|
|
|
|
|
sectorSkip = 0;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
2016-08-17 01:32:20 +01:00
|
|
|
|
case TrackType.Data:
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
sectorOffset = 0;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
sectorSize = 2048;
|
|
|
|
|
|
sectorSkip = 0;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type");
|
2016-08-17 01:32:20 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-20 17:15:26 +00:00
|
|
|
|
byte[] buffer = new byte[sectorSize * length];
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2018-06-22 08:08:38 +01:00
|
|
|
|
imageStream = dicTrack.TrackFilter.GetDataForkStream();
|
2016-09-05 17:37:31 +01:00
|
|
|
|
BinaryReader br = new BinaryReader(imageStream);
|
2017-12-19 20:33:03 +00:00
|
|
|
|
br.BaseStream
|
2017-12-22 06:55:04 +00:00
|
|
|
|
.Seek((long)dicTrack.TrackFileOffset + (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip)),
|
2017-12-19 20:33:03 +00:00
|
|
|
|
SeekOrigin.Begin);
|
2017-12-20 17:15:26 +00:00
|
|
|
|
if(sectorOffset == 0 && sectorSkip == 0) buffer = br.ReadBytes((int)(sectorSize * length));
|
2016-09-05 17:37:31 +01:00
|
|
|
|
else
|
|
|
|
|
|
for(int i = 0; i < length; i++)
|
2016-08-17 01:32:20 +01:00
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
br.BaseStream.Seek(sectorOffset, SeekOrigin.Current);
|
2017-12-22 06:55:04 +00:00
|
|
|
|
byte[] sector = br.ReadBytes((int)sectorSize);
|
2017-12-20 17:15:26 +00:00
|
|
|
|
br.BaseStream.Seek(sectorSkip, SeekOrigin.Current);
|
|
|
|
|
|
Array.Copy(sector, 0, buffer, i * sectorSize, sectorSize);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return buffer;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag)
|
2016-08-17 01:32:20 +01:00
|
|
|
|
{
|
2017-12-22 06:55:04 +00:00
|
|
|
|
Track dicTrack = new Track {TrackSequence = 0};
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2018-01-28 17:46:06 +00:00
|
|
|
|
foreach(Track bwTrack in Tracks.Where(bwTrack => bwTrack.TrackSequence == track))
|
2017-12-21 16:33:16 +00:00
|
|
|
|
{
|
2017-12-22 06:55:04 +00:00
|
|
|
|
dicTrack = bwTrack;
|
2017-12-21 07:08:26 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2017-12-22 06:55:04 +00:00
|
|
|
|
if(dicTrack.TrackSequence == 0)
|
2016-08-17 01:32:20 +01:00
|
|
|
|
throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image");
|
|
|
|
|
|
|
2017-12-22 06:55:04 +00:00
|
|
|
|
if(length + sectorAddress > dicTrack.TrackEndSector - dicTrack.TrackStartSector + 1)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
throw new ArgumentOutOfRangeException(nameof(length),
|
2017-12-22 06:55:04 +00:00
|
|
|
|
$"Requested more sectors ({length + sectorAddress}) than present in track ({dicTrack.TrackEndSector - dicTrack.TrackStartSector + 1}), won't cross tracks");
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2017-12-20 17:15:26 +00:00
|
|
|
|
uint sectorOffset;
|
|
|
|
|
|
uint sectorSize;
|
|
|
|
|
|
uint sectorSkip;
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2017-12-22 06:55:04 +00:00
|
|
|
|
if(dicTrack.TrackType == TrackType.Data)
|
2016-08-17 01:32:20 +01:00
|
|
|
|
throw new ArgumentException("Unsupported tag requested", nameof(tag));
|
|
|
|
|
|
|
|
|
|
|
|
switch(tag)
|
|
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
case SectorTagType.CdSectorEcc:
|
|
|
|
|
|
case SectorTagType.CdSectorEccP:
|
|
|
|
|
|
case SectorTagType.CdSectorEccQ:
|
|
|
|
|
|
case SectorTagType.CdSectorEdc:
|
|
|
|
|
|
case SectorTagType.CdSectorHeader:
|
|
|
|
|
|
case SectorTagType.CdSectorSubchannel:
|
|
|
|
|
|
case SectorTagType.CdSectorSubHeader:
|
|
|
|
|
|
case SectorTagType.CdSectorSync: break;
|
|
|
|
|
|
case SectorTagType.CdTrackFlags:
|
2017-12-22 06:55:04 +00:00
|
|
|
|
if(trackFlags.TryGetValue(track, out byte flag)) return new[] {flag};
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
2018-06-22 08:08:38 +01:00
|
|
|
|
throw new ArgumentException("Unsupported tag requested", nameof(tag));
|
2017-12-19 20:33:03 +00:00
|
|
|
|
default: throw new ArgumentException("Unsupported tag requested", nameof(tag));
|
2016-08-17 01:32:20 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-22 06:55:04 +00:00
|
|
|
|
switch(dicTrack.TrackType)
|
2016-08-17 01:32:20 +01:00
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
case TrackType.CdMode1:
|
2016-08-17 01:32:20 +01:00
|
|
|
|
switch(tag)
|
|
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
case SectorTagType.CdSectorSync:
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
sectorOffset = 0;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
sectorSize = 12;
|
|
|
|
|
|
sectorSkip = 2340;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
2017-12-20 17:15:26 +00:00
|
|
|
|
case SectorTagType.CdSectorHeader:
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
sectorOffset = 12;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
sectorSize = 4;
|
|
|
|
|
|
sectorSkip = 2336;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
2017-12-20 17:15:26 +00:00
|
|
|
|
case SectorTagType.CdSectorSubHeader:
|
2016-08-17 01:32:20 +01:00
|
|
|
|
throw new ArgumentException("Unsupported tag requested for this track", nameof(tag));
|
2017-12-20 17:15:26 +00:00
|
|
|
|
case SectorTagType.CdSectorEcc:
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
sectorOffset = 2076;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
sectorSize = 276;
|
|
|
|
|
|
sectorSkip = 0;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
2017-12-20 17:15:26 +00:00
|
|
|
|
case SectorTagType.CdSectorEccP:
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
sectorOffset = 2076;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
sectorSize = 172;
|
|
|
|
|
|
sectorSkip = 104;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
2017-12-20 17:15:26 +00:00
|
|
|
|
case SectorTagType.CdSectorEccQ:
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
sectorOffset = 2248;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
sectorSize = 104;
|
|
|
|
|
|
sectorSkip = 0;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
2017-12-20 17:15:26 +00:00
|
|
|
|
case SectorTagType.CdSectorEdc:
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
sectorOffset = 2064;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
sectorSize = 4;
|
|
|
|
|
|
sectorSkip = 284;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
2017-12-20 17:15:26 +00:00
|
|
|
|
case SectorTagType.CdSectorSubchannel:
|
2016-08-18 00:05:24 +01:00
|
|
|
|
throw new NotImplementedException("Packed subchannel not yet supported");
|
2017-12-19 20:33:03 +00:00
|
|
|
|
default: throw new ArgumentException("Unsupported tag requested", nameof(tag));
|
2016-08-17 01:32:20 +01:00
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
2016-08-17 01:32:20 +01:00
|
|
|
|
break;
|
2017-12-20 17:15:26 +00:00
|
|
|
|
case TrackType.CdMode2Formless:
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
|
|
|
|
|
switch(tag)
|
2016-08-17 01:32:20 +01:00
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
case SectorTagType.CdSectorSync:
|
|
|
|
|
|
case SectorTagType.CdSectorHeader:
|
|
|
|
|
|
case SectorTagType.CdSectorEcc:
|
|
|
|
|
|
case SectorTagType.CdSectorEccP:
|
|
|
|
|
|
case SectorTagType.CdSectorEccQ:
|
2017-12-19 20:33:03 +00:00
|
|
|
|
throw new ArgumentException("Unsupported tag requested for this track", nameof(tag));
|
2017-12-20 17:15:26 +00:00
|
|
|
|
case SectorTagType.CdSectorSubHeader:
|
2016-08-17 01:32:20 +01:00
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
sectorOffset = 0;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
sectorSize = 8;
|
|
|
|
|
|
sectorSkip = 2328;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
break;
|
2016-08-17 01:32:20 +01:00
|
|
|
|
}
|
2017-12-20 17:15:26 +00:00
|
|
|
|
case SectorTagType.CdSectorEdc:
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
sectorOffset = 2332;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
sectorSize = 4;
|
|
|
|
|
|
sectorSkip = 0;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
2017-12-20 17:15:26 +00:00
|
|
|
|
case SectorTagType.CdSectorSubchannel:
|
2017-12-19 20:33:03 +00:00
|
|
|
|
throw new NotImplementedException("Packed subchannel not yet supported");
|
|
|
|
|
|
default: throw new ArgumentException("Unsupported tag requested", nameof(tag));
|
2016-08-17 01:32:20 +01:00
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2016-08-17 01:32:20 +01:00
|
|
|
|
case TrackType.Audio:
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
|
|
|
|
|
switch(tag)
|
2016-08-17 01:32:20 +01:00
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
case SectorTagType.CdSectorSubchannel:
|
2017-12-19 20:33:03 +00:00
|
|
|
|
throw new NotImplementedException("Packed subchannel not yet supported");
|
|
|
|
|
|
default: throw new ArgumentException("Unsupported tag requested", nameof(tag));
|
2016-08-17 01:32:20 +01:00
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type");
|
2016-08-17 01:32:20 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-20 17:15:26 +00:00
|
|
|
|
byte[] buffer = new byte[sectorSize * length];
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2018-06-22 08:08:38 +01:00
|
|
|
|
imageStream = dicTrack.TrackFilter.GetDataForkStream();
|
2016-09-05 17:37:31 +01:00
|
|
|
|
BinaryReader br = new BinaryReader(imageStream);
|
2017-12-19 20:33:03 +00:00
|
|
|
|
br.BaseStream
|
2017-12-22 06:55:04 +00:00
|
|
|
|
.Seek((long)dicTrack.TrackFileOffset + (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip)),
|
2017-12-19 20:33:03 +00:00
|
|
|
|
SeekOrigin.Begin);
|
2017-12-20 17:15:26 +00:00
|
|
|
|
if(sectorOffset == 0 && sectorSkip == 0) buffer = br.ReadBytes((int)(sectorSize * length));
|
2016-09-05 17:37:31 +01:00
|
|
|
|
else
|
|
|
|
|
|
for(int i = 0; i < length; i++)
|
2016-08-17 01:32:20 +01:00
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
br.BaseStream.Seek(sectorOffset, SeekOrigin.Current);
|
2017-12-22 06:55:04 +00:00
|
|
|
|
byte[] sector = br.ReadBytes((int)sectorSize);
|
2017-12-20 17:15:26 +00:00
|
|
|
|
br.BaseStream.Seek(sectorSkip, SeekOrigin.Current);
|
|
|
|
|
|
Array.Copy(sector, 0, buffer, i * sectorSize, sectorSize);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return buffer;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-12-31 13:17:27 +00:00
|
|
|
|
public byte[] ReadSectorLong(ulong sectorAddress) => ReadSectorsLong(sectorAddress, 1);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2018-12-31 13:17:27 +00:00
|
|
|
|
public byte[] ReadSectorLong(ulong sectorAddress, uint track) => ReadSectorsLong(sectorAddress, 1, track);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public byte[] ReadSectorsLong(ulong sectorAddress, uint length)
|
2016-08-17 01:32:20 +01:00
|
|
|
|
{
|
2017-12-21 16:33:16 +00:00
|
|
|
|
foreach(KeyValuePair<uint, ulong> kvp in from kvp in offsetmap
|
|
|
|
|
|
where sectorAddress >= kvp.Value
|
2018-01-28 17:46:06 +00:00
|
|
|
|
from track in Tracks
|
2018-06-22 08:08:38 +01:00
|
|
|
|
where track.TrackSequence == kvp.Key
|
|
|
|
|
|
where sectorAddress - kvp.Value <
|
2017-12-21 16:33:16 +00:00
|
|
|
|
track.TrackEndSector - track.TrackStartSector + 1
|
|
|
|
|
|
select kvp)
|
|
|
|
|
|
return ReadSectorsLong(sectorAddress - kvp.Value, length, kvp.Key);
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track)
|
2016-08-17 01:32:20 +01:00
|
|
|
|
{
|
2017-12-22 06:55:04 +00:00
|
|
|
|
Track dicTrack = new Track {TrackSequence = 0};
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2018-01-28 17:46:06 +00:00
|
|
|
|
foreach(Track bwTrack in Tracks.Where(bwTrack => bwTrack.TrackSequence == track))
|
2017-12-21 16:33:16 +00:00
|
|
|
|
{
|
2017-12-22 06:55:04 +00:00
|
|
|
|
dicTrack = bwTrack;
|
2017-12-21 07:08:26 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2017-12-22 06:55:04 +00:00
|
|
|
|
if(dicTrack.TrackSequence == 0)
|
2016-08-17 01:32:20 +01:00
|
|
|
|
throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image");
|
|
|
|
|
|
|
2017-12-22 06:55:04 +00:00
|
|
|
|
if(length + sectorAddress > dicTrack.TrackEndSector - dicTrack.TrackStartSector + 1)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
throw new ArgumentOutOfRangeException(nameof(length),
|
2017-12-22 06:55:04 +00:00
|
|
|
|
$"Requested more sectors ({length + sectorAddress}) than present in track ({dicTrack.TrackEndSector - dicTrack.TrackStartSector + 1}), won't cross tracks");
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2017-12-20 17:15:26 +00:00
|
|
|
|
uint sectorOffset;
|
|
|
|
|
|
uint sectorSize;
|
|
|
|
|
|
uint sectorSkip;
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
2017-12-22 06:55:04 +00:00
|
|
|
|
switch(dicTrack.TrackType)
|
2016-08-17 01:32:20 +01:00
|
|
|
|
{
|
|
|
|
|
|
case TrackType.Audio:
|
2017-12-20 17:15:26 +00:00
|
|
|
|
case TrackType.CdMode1:
|
|
|
|
|
|
case TrackType.CdMode2Formless:
|
2016-08-17 01:32:20 +01:00
|
|
|
|
case TrackType.Data:
|
2017-12-19 20:33:03 +00:00
|
|
|
|
{
|
2017-12-20 17:15:26 +00:00
|
|
|
|
sectorOffset = 0;
|
2018-01-28 17:46:06 +00:00
|
|
|
|
sectorSize = (uint)dicTrack.TrackRawBytesPerSector;
|
|
|
|
|
|
sectorSkip = 0;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type");
|
2016-08-17 01:32:20 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2018-06-22 08:08:38 +01:00
|
|
|
|
imageStream = dicTrack.TrackFilter.GetDataForkStream();
|
2016-09-05 17:37:31 +01:00
|
|
|
|
BinaryReader br = new BinaryReader(imageStream);
|
2017-12-19 20:33:03 +00:00
|
|
|
|
br.BaseStream
|
2017-12-22 06:55:04 +00:00
|
|
|
|
.Seek((long)dicTrack.TrackFileOffset + (long)(sectorAddress * (sectorOffset + sectorSize + sectorSkip)),
|
2017-12-19 20:33:03 +00:00
|
|
|
|
SeekOrigin.Begin);
|
2017-12-22 06:55:04 +00:00
|
|
|
|
byte[] buffer = br.ReadBytes((int)(sectorSize * length));
|
2016-08-17 01:32:20 +01:00
|
|
|
|
|
|
|
|
|
|
return buffer;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public List<Track> GetSessionTracks(Session session)
|
2016-08-17 01:32:20 +01:00
|
|
|
|
{
|
2018-01-28 17:46:06 +00:00
|
|
|
|
if(Sessions.Contains(session)) return GetSessionTracks(session.SessionSequence);
|
2017-12-19 20:33:03 +00:00
|
|
|
|
|
2016-08-17 01:32:20 +01:00
|
|
|
|
throw new ImageNotSupportedException("Session does not exist in disc image");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public List<Track> GetSessionTracks(ushort session)
|
2016-08-17 01:32:20 +01:00
|
|
|
|
{
|
2018-01-28 17:46:06 +00:00
|
|
|
|
return Tracks.Where(track => track.TrackSession == session).ToList();
|
2016-08-17 01:32:20 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|