4 Commits
1.1.1 ... 1.1.2

Author SHA1 Message Date
Matt Nadareski
9a5d681ad2 Bump version 2023-09-13 13:55:46 -04:00
Matt Nadareski
afb20e00be Add PIC models from MPF 2023-09-13 12:20:01 -04:00
Matt Nadareski
5a055a98c7 Add XMID and XeMID models from MPF 2023-09-13 12:11:56 -04:00
Matt Nadareski
793a4e2fdd Add cuesheet models from MPF 2023-09-13 11:34:58 -04:00
16 changed files with 750 additions and 1 deletions

38
CueSheets/CueFile.cs Normal file
View File

@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.IO;
/// <remarks>
/// Information sourced from http://web.archive.org/web/20070221154246/http://www.goldenhawk.com/download/cdrwin.pdf
/// </remarks>
namespace SabreTools.Models.CueSheets
{
/// <summary>
/// Represents a single FILE in a cuesheet
/// </summary>
public class CueFile
{
/// <summary>
/// filename
/// </summary>
#if NET48
public string FileName { get; set; }
#else
public string? FileName { get; set; }
#endif
/// <summary>
/// filetype
/// </summary>
public CueFileType FileType { get; set; }
/// <summary>
/// List of TRACK in FILE
/// </summary>
#if NET48
public CueTrack[] Tracks { get; set; }
#else
public CueTrack?[]? Tracks { get; set; }
#endif
}
}

33
CueSheets/CueIndex.cs Normal file
View File

@@ -0,0 +1,33 @@
/// <remarks>
/// Information sourced from http://web.archive.org/web/20070221154246/http://www.goldenhawk.com/download/cdrwin.pdf
/// </remarks>
namespace SabreTools.Models.CueSheets
{
/// <summary>
/// Represents a single INDEX in a TRACK
/// </summary>
public class CueIndex
{
/// <summary>
/// INDEX number, between 0 and 99
/// </summary>
public int Index { get; set; }
/// <summary>
/// Starting time of INDEX in minutes
/// </summary>
public int Minutes { get; set; }
/// <summary>
/// Starting time of INDEX in seconds
/// </summary>
/// <remarks>There are 60 seconds in a minute</remarks>
public int Seconds { get; set; }
/// <summary>
/// Starting time of INDEX in frames.
/// </summary>
/// <remarks>There are 75 frames per second</remarks>
public int Frames { get; set; }
}
}

65
CueSheets/CueSheet.cs Normal file
View File

@@ -0,0 +1,65 @@
/// <remarks>
/// Information sourced from http://web.archive.org/web/20070221154246/http://www.goldenhawk.com/download/cdrwin.pdf
/// </remarks>
namespace SabreTools.Models.CueSheets
{
/// <summary>
/// Represents a single cuesheet
/// </summary>
public class CueSheet
{
/// <summary>
/// CATALOG
/// </summary>
#if NET48
public string Catalog { get; set; }
#else
public string? Catalog { get; set; }
#endif
/// <summary>
/// CDTEXTFILE
/// </summary>
#if NET48
public string CdTextFile { get; set; }
#else
public string? CdTextFile { get; set; }
#endif
/// <summary>
/// PERFORMER
/// </summary>
#if NET48
public string Performer { get; set; }
#else
public string? Performer { get; set; }
#endif
/// <summary>
/// SONGWRITER
/// </summary>
#if NET48
public string Songwriter { get; set; }
#else
public string? Songwriter { get; set; }
#endif
/// <summary>
/// TITLE
/// </summary>
#if NET48
public string Title { get; set; }
#else
public string? Title { get; set; }
#endif
/// <summary>
/// List of FILE in cuesheet
/// </summary>
#if NET48
public CueFile[] Files { get; set; }
#else
public CueFile?[]? Files { get; set; }
#endif
}
}

91
CueSheets/CueTrack.cs Normal file
View File

@@ -0,0 +1,91 @@
/// <remarks>
/// Information sourced from http://web.archive.org/web/20070221154246/http://www.goldenhawk.com/download/cdrwin.pdf
/// </remarks>
namespace SabreTools.Models.CueSheets
{
/// <summary>
/// Represents a single TRACK in a FILE
/// </summary>
public class CueTrack
{
/// <summary>
/// Track number. The range is 1 to 99.
/// </summary>
public int Number { get; set; }
/// <summary>
/// Track datatype
/// </summary>
public CueTrackDataType DataType { get; set; }
/// <summary>
/// FLAGS
/// </summary>
public CueTrackFlag Flags { get; set; }
/// <summary>
/// ISRC
/// </summary>
/// <remarks>12 characters in length</remarks>
#if NET48
public string ISRC { get; set; }
#else
public string? ISRC { get; set; }
#endif
/// <summary>
/// PERFORMER
/// </summary>
#if NET48
public string Performer { get; set; }
#else
public string? Performer { get; set; }
#endif
/// <summary>
/// SONGWRITER
/// </summary>
#if NET48
public string Songwriter { get; set; }
#else
public string? Songwriter { get; set; }
#endif
/// <summary>
/// TITLE
/// </summary>
#if NET48
public string Title { get; set; }
#else
public string? Title { get; set; }
#endif
/// <summary>
/// PREGAP
/// </summary>
#if NET48
public PreGap PreGap { get; set; }
#else
public PreGap? PreGap { get; set; }
#endif
/// <summary>
/// List of INDEX in TRACK
/// </summary>
/// <remarks>Must start with 0 or 1 and then sequential</remarks>
#if NET48
public CueIndex[] Indices { get; set; }
#else
public CueIndex?[]? Indices { get; set; }
#endif
/// <summary>
/// POSTGAP
/// </summary>
#if NET48
public PostGap PostGap { get; set; }
#else
public PostGap? PostGap { get; set; }
#endif
}
}

116
CueSheets/Enums.cs Normal file
View File

@@ -0,0 +1,116 @@
using System;
/// <remarks>
/// Information sourced from http://web.archive.org/web/20070221154246/http://www.goldenhawk.com/download/cdrwin.pdf
/// </remarks>
namespace SabreTools.Models.CueSheets
{
/// <summary>
/// The audio or data files filetype
/// </summary>
public enum CueFileType
{
/// <summary>
/// Intel binary file (least significant byte first). Use for data files.
/// </summary>
BINARY,
/// <summary>
/// Motorola binary file (most significant byte first). Use for data files.
/// </summary>
MOTOROLA,
/// <summary>
/// Audio AIFF file (44.1KHz 16-bit stereo)
/// </summary>
AIFF,
/// <summary>
/// Audio WAVE file (44.1KHz 16-bit stereo)
/// </summary>
WAVE,
/// <summary>
/// Audio MP3 file (44.1KHz 16-bit stereo)
/// </summary>
MP3,
}
/// <summary>
/// Track datatype
/// </summary>
public enum CueTrackDataType
{
/// <summary>
/// AUDIO, Audio/Music (2352)
/// </summary>
AUDIO,
/// <summary>
/// CDG, Karaoke CD+G (2448)
/// </summary>
CDG,
/// <summary>
/// MODE1/2048, CD-ROM Mode1 Data (cooked)
/// </summary>
MODE1_2048,
/// <summary>
/// MODE1/2352 CD-ROM Mode1 Data (raw)
/// </summary>
MODE1_2352,
/// <summary>
/// MODE2/2336, CD-ROM XA Mode2 Data
/// </summary>
MODE2_2336,
/// <summary>
/// MODE2/2352, CD-ROM XA Mode2 Data
/// </summary>
MODE2_2352,
/// <summary>
/// CDI/2336, CD-I Mode2 Data
/// </summary>
CDI_2336,
/// <summary>
/// CDI/2352, CD-I Mode2 Data
/// </summary>
CDI_2352,
}
/// <summary>
/// Special subcode flags within a track
/// </summary>
[Flags]
public enum CueTrackFlag
{
/// <summary>
/// DCP, Digital copy permitted
/// </summary>
DCP = 1 << 0,
/// <summary>
/// 4CH, Four channel audio
/// </summary>
FourCH = 1 << 1,
/// <summary>
/// PRE, Pre-emphasis enabled (audio tracks only)
/// </summary>
PRE = 1 << 2,
/// <summary>
/// SCMS, Serial Copy Management System (not supported by all recorders)
/// </summary>
SCMS = 1 << 3,
/// <summary>
/// DATA, set for data files. This flag is set automatically based on the tracks filetype
/// </summary>
DATA = 1 << 4,
}
}

28
CueSheets/PostGap.cs Normal file
View File

@@ -0,0 +1,28 @@
/// <remarks>
/// Information sourced from http://web.archive.org/web/20070221154246/http://www.goldenhawk.com/download/cdrwin.pdf
/// </remarks>
namespace SabreTools.Models.CueSheets
{
/// <summary>
/// Represents POSTGAP information of a track
/// </summary>
public class PostGap
{
/// <summary>
/// Length of POSTGAP in minutes
/// </summary>
public int Minutes { get; set; }
/// <summary>
/// Length of POSTGAP in seconds
/// </summary>
/// <remarks>There are 60 seconds in a minute</remarks>
public int Seconds { get; set; }
/// <summary>
/// Length of POSTGAP in frames.
/// </summary>
/// <remarks>There are 75 frames per second</remarks>
public int Frames { get; set; }
}
}

28
CueSheets/PreGap.cs Normal file
View File

@@ -0,0 +1,28 @@
/// <remarks>
/// Information sourced from http://web.archive.org/web/20070221154246/http://www.goldenhawk.com/download/cdrwin.pdf
/// </remarks>
namespace SabreTools.Models.CueSheets
{
/// <summary>
/// Represents PREGAP information of a track
/// </summary>
public class PreGap
{
/// <summary>
/// Length of PREGAP in minutes
/// </summary>
public int Minutes { get; set; }
/// <summary>
/// Length of PREGAP in seconds
/// </summary>
/// <remarks>There are 60 seconds in a minute</remarks>
public int Seconds { get; set; }
/// <summary>
/// Length of PREGAP in frames.
/// </summary>
/// <remarks>There are 75 frames per second</remarks>
public int Frames { get; set; }
}
}

15
PIC/Constants.cs Normal file
View File

@@ -0,0 +1,15 @@
namespace SabreTools.Models.PIC
{
/// <see href="https://www.t10.org/ftp/t10/document.05/05-206r0.pdf"/>
/// <see href="https://github.com/aaru-dps/Aaru.Decoders/blob/devel/Bluray/DI.cs"/>
public class Constants
{
public const string DiscTypeIdentifierROM = "BDO";
public const string DiscTypeIdentifierROMUltra = "BDU";
public const string DiscTypeIdentifierReWritable = "BDW";
public const string DiscTypeIdentifierRecordable = "BDR";
}
}

38
PIC/DiscInformation.cs Normal file
View File

@@ -0,0 +1,38 @@
namespace SabreTools.Models.PIC
{
/// <summary>
/// Disc Information and Emergency Brake data shall be read from the PIC zone. DI units that
/// contain physical information shall be returned.Emergency Brake data shall be returned.The
/// information shall be collected from the layer specified in the Layer field of the CDB. If any data
/// can be returned, 4 100 bytes shall be returned.
/// </summary>
/// <see href="https://www.t10.org/ftp/t10/document.05/05-206r0.pdf"/>
/// <see href="https://github.com/aaru-dps/Aaru.Decoders/blob/devel/Bluray/DI.cs"/>
public class DiscInformation
{
/// <summary>
/// 2048 bytes for BD-ROM, 3584 bytes for BD-R/RE
/// </summary>
/// <remarks>Big-endian format</remarks>
public ushort DataStructureLength { get; set; }
/// <summary>
/// Should be 0x00
/// </summary>
public byte Reserved0 { get; set; }
/// <summary>
/// Should be 0x00
/// </summary>
public byte Reserved1 { get; set; }
/// <summary>
/// Disc information and emergency brake units
/// </summary>
#if NET48
public DiscInformationUnit[] Units { get; set; }
#else
public DiscInformationUnit?[]? Units { get; set; }
#endif
}
}

View File

@@ -0,0 +1,34 @@
namespace SabreTools.Models.PIC
{
/// <see href="https://www.t10.org/ftp/t10/document.05/05-206r0.pdf"/>
/// <see href="https://github.com/aaru-dps/Aaru.Decoders/blob/devel/Bluray/DI.cs"/>
public class DiscInformationUnit
{
/// <summary>
/// Unit header
/// </summary>
#if NET48
public DiscInformationUnitHeader Header { get; set; }
#else
public DiscInformationUnitHeader? Header { get; set; }
#endif
/// <summary>
/// Unit body
/// </summary>
#if NET48
public DiscInformationUnitBody Body { get; set; }
#else
public DiscInformationUnitBody? Body { get; set; }
#endif
/// <summary>
/// Unit trailer (BD-R/RE only)
/// </summary>
#if NET48
public DiscInformationUnitTrailer Trailer { get; set; }
#else
public DiscInformationUnitTrailer? Trailer { get; set; }
#endif
}
}

View File

@@ -0,0 +1,36 @@
namespace SabreTools.Models.PIC
{
/// <see href="https://www.t10.org/ftp/t10/document.05/05-206r0.pdf"/>
/// <see href="https://github.com/aaru-dps/Aaru.Decoders/blob/devel/Bluray/DI.cs"/>
/// TODO: Write models for the dependent contents, if possible
public class DiscInformationUnitBody
{
/// <summary>
/// Disc Type Identifier
/// = "BDO" for BD-ROM
/// = "BDU" for BD-ROM Ultra
/// = "BDW" for BD-RE
/// = "BDR" for BD-R
/// </summary>
#if NET48
public string DiscTypeIdentifier { get; set; }
#else
public string? DiscTypeIdentifier { get; set; }
#endif
/// <summary>
/// Disc Size/Class/Version
/// </summary>
public byte DiscSizeClassVersion { get; set; }
/// <summary>
/// DI Unit Format dependent contents
/// </summary>
/// <remarks>52 bytes for BD-ROM, 100 bytes for BD-R/RE</remarks>
#if NET48
public byte[] FormatDependentContents { get; set; }
#else
public byte[]? FormatDependentContents { get; set; }
#endif
}
}

View File

@@ -0,0 +1,47 @@
namespace SabreTools.Models.PIC
{
/// <see href="https://www.t10.org/ftp/t10/document.05/05-206r0.pdf"/>
/// <see href="https://github.com/aaru-dps/Aaru.Decoders/blob/devel/Bluray/DI.cs"/>
public class DiscInformationUnitHeader
{
/// <summary>
/// Disc Information Identifier "DI"
/// Emergency Brake Identifier "EB"
/// </summary>
#if NET48
public string DiscInformationIdentifier { get; set; }
#else
public string? DiscInformationIdentifier { get; set; }
#endif
/// <summary>
/// Disc Information Format
/// </summary>
public byte DiscInformationFormat { get; set; }
/// <summary>
/// Number of DI units in each DI block
/// </summary>
public byte NumberOfUnitsInBlock { get; set; }
/// <summary>
/// Should be 0x00
/// </summary>
public byte Reserved0 { get; set; }
/// <summary>
/// DI unit Sequence Number
/// </summary>
public byte SequenceNumber { get; set; }
/// <summary>
/// Number of bytes in use in this DI unit
/// </summary>
public byte BytesInUse { get; set; }
/// <summary>
/// Should be 0x00
/// </summary>
public byte Reserved1 { get; set; }
}
}

View File

@@ -0,0 +1,40 @@
namespace SabreTools.Models.PIC
{
/// <summary>
/// BD-R/RE only
/// </summary>
/// <see href="https://www.t10.org/ftp/t10/document.05/05-206r0.pdf"/>
/// <see href="https://github.com/aaru-dps/Aaru.Decoders/blob/devel/Bluray/DI.cs"/>
public class DiscInformationUnitTrailer
{
/// <summary>
/// Disc Manufacturer ID
/// </summary>
/// <remarks>6 bytes</remarks>
#if NET48
public byte[] DiscManufacturerID { get; set; } = new byte[6];
#else
public byte[]? DiscManufacturerID { get; set; } = new byte[6];
#endif
/// <summary>
/// Media Type ID
/// </summary>
/// <remarks>3 bytes</remarks>
#if NET48
public byte[] MediaTypeID { get; set; } = new byte[3];
#else
public byte[]? MediaTypeID { get; set; } = new byte[3];
#endif
/// <summary>
/// Time Stamp
/// </summary>
public ushort TimeStamp { get; set; }
/// <summary>
/// Product Revision Number
/// </summary>
public byte ProductRevisionNumber { get; set; }
}
}

View File

@@ -4,7 +4,7 @@
<!-- Assembly Properties -->
<TargetFrameworks>net48;net6.0;net7.0;net8.0</TargetFrameworks>
<RuntimeIdentifiers>win-x86;win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
<Version>1.1.1</Version>
<Version>1.1.2</Version>
<!-- Package Properties -->
<Authors>Matt Nadareski</Authors>

49
Xbox/XMID.cs Normal file
View File

@@ -0,0 +1,49 @@
namespace SabreTools.Models.Xbox
{
/// <summary>
/// Contains information specific to an XGD disc
/// </summary>
/// <remarks>
/// XGD1 XMID Format Information:
///
/// AABBBCCD
/// - AA => The two-ASCII-character publisher identifier (see GetPublisher for details)
/// - BBB => Game ID
/// - CC => Version number
/// - D => Region identifier (see GetRegion for details)
/// </remarks>
public class XMID
{
/// <summary>
/// 2-character publisher identifier
/// </summary>
#if NET48
public string PublisherIdentifier { get; set; }
#else
public string? PublisherIdentifier { get; set; }
#endif
/// <summary>
/// 3-character Game ID
/// </summary>
#if NET48
public string GameID { get; set; }
#else
public string? GameID { get; set; }
#endif
/// <summary>
/// 2-character Internal version number
/// </summary>
#if NET48
public string VersionNumber { get; set; }
#else
public string? VersionNumber { get; set; }
#endif
/// <summary>
/// 1-character Region identifier character
/// </summary
public char RegionIdentifier { get; set; }
}
}

91
Xbox/XeMID.cs Normal file
View File

@@ -0,0 +1,91 @@
namespace SabreTools.Models.Xbox
{
/// <summary>
/// Contains information specific to an XGD disc
/// </summary>
/// <remarks>
/// XGD2/3 XeMID Format Information:
///
/// AABCCCDDEFFGHH(IIIIIIII)
/// - AA => The two-ASCII-character publisher identifier (see GetPublisher for details)
/// - B => Platform identifier; 2 indicates Xbox 360.
/// - CCC => Game ID
/// - DD => SKU number (unique per SKU of a title)
/// - E => Region identifier (see GetRegion for details)
/// - FF => Base version; usually starts at 01 (can be 1 or 2 characters)
/// - G => Media type identifier (see GetMediaSubtype for details)
/// - HH => Disc number stored in [disc number][total discs] format
/// - IIIIIIII => 8-hex-digit certification submission identifier; usually on test discs only
/// </remarks>
public class XeMID
{
/// <summary>
/// 2-character publisher identifier
/// </summary>
#if NET48
public string PublisherIdentifier { get; set; }
#else
public string? PublisherIdentifier { get; set; }
#endif
/// <summary>
/// 1-character Platform disc is made for, 2 indicates Xbox 360
/// </summary>
public char PlatformIdentifier { get; set; }
/// <summary>
/// 3-character Game ID
/// </summary>
#if NET48
public string GameID { get; set; }
#else
public string? GameID { get; set; }
#endif
/// <summary>
/// 2-character Title-specific SKU
/// </summary>
#if NET48
public string SKU { get; set; }
#else
public string? SKU { get; set; }
#endif
/// <summary>
/// 1-character Region identifier character
/// </summary>
public char RegionIdentifier { get; set; }
/// <summary>
/// 2-character Base version of executables, usually starts at 01
/// </summary>
#if NET48
public string BaseVersion { get; set; }
#else
public string? BaseVersion { get; set; }
#endif
/// <summary>
/// 1-character Media subtype identifier
/// </summary>
public char MediaSubtypeIdentifier { get; set; }
/// <summary>
/// 2-character Disc number stored in [disc number][total discs] format
/// </summary>
#if NET48
public string DiscNumberIdentifier { get; set; }
#else
public string? DiscNumberIdentifier { get; set; }
#endif
/// <summary>
/// 8-hex-digit certification submission identifier; usually on test discs only
/// </summary>
#if NET48
public string CertificationSubmissionIdentifier { get; set; }
#else
public string? CertificationSubmissionIdentifier { get; set; }
#endif
}
}