PIC model cleanup

This commit is contained in:
Matt Nadareski
2025-10-30 22:58:02 -04:00
parent d65edadbbb
commit 069dab7fba
6 changed files with 19 additions and 34 deletions

View File

@@ -29,6 +29,6 @@
/// <summary>
/// Disc information and emergency brake units
/// </summary>
public DiscInformationUnit[]? Units { get; set; }
public DiscInformationUnit[] Units { get; set; }
}
}

View File

@@ -7,12 +7,12 @@
/// <summary>
/// Unit header
/// </summary>
public DiscInformationUnitHeader? Header { get; set; }
public DiscInformationUnitHeader Header { get; set; }
/// <summary>
/// Unit body
/// </summary>
public DiscInformationUnitBody? Body { get; set; }
public DiscInformationUnitBody Body { get; set; }
/// <summary>
/// Unit trailer (BD-R/RE only)

View File

@@ -8,7 +8,7 @@ namespace SabreTools.Data.Models.PIC
/// <summary>
/// Disc Type Identifier
/// </summary>
public string? DiscTypeIdentifier { get; set; }
public string DiscTypeIdentifier { get; set; }
/// <summary>
/// Disc Size/Class/Version

View File

@@ -12,7 +12,7 @@ namespace SabreTools.Data.Models.PIC
/// Emergency Brake Identifier "EB"
/// </summary>
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 2)]
public string? DiscInformationIdentifier;
public string DiscInformationIdentifier;
/// <summary>
/// Disc Information Format

View File

@@ -24,11 +24,11 @@ namespace SabreTools.Serialization.Wrappers
Print(builder, Model.Units);
}
private static void Print(StringBuilder builder, DiscInformationUnit[]? entries)
private static void Print(StringBuilder builder, DiscInformationUnit[] entries)
{
builder.AppendLine(" Disc Information Units:");
builder.AppendLine(" -------------------------");
if (entries == null || entries.Length == 0)
if (entries.Length == 0)
{
builder.AppendLine(" No disc information units");
builder.AppendLine();
@@ -40,34 +40,19 @@ namespace SabreTools.Serialization.Wrappers
var entry = entries[i];
builder.AppendLine($" Disc Information Unit {i}");
if (entry.Header == null)
{
builder.AppendLine(" No header");
}
else
{
var header = entry.Header;
builder.AppendLine(header.DiscInformationIdentifier, " Disc information identifier");
builder.AppendLine(header.DiscInformationFormat, " Disc information format");
builder.AppendLine(header.Reserved0, " Reserved");
builder.AppendLine(header.SequenceNumber, " Sequence number");
builder.AppendLine(header.BytesInUse, " Bytes in use");
builder.AppendLine(header.Reserved1, " Reserved");
}
var header = entry.Header;
builder.AppendLine(header.DiscInformationIdentifier, " Disc information identifier");
builder.AppendLine(header.DiscInformationFormat, " Disc information format");
builder.AppendLine(header.Reserved0, " Reserved");
builder.AppendLine(header.SequenceNumber, " Sequence number");
builder.AppendLine(header.BytesInUse, " Bytes in use");
builder.AppendLine(header.Reserved1, " Reserved");
if (entry.Body == null)
{
builder.AppendLine(" No body");
}
else
{
var body = entry.Body;
builder.AppendLine(body.DiscTypeIdentifier, " Disc type identifer");
builder.AppendLine(body.DiscSizeClassVersion, " Disc size class version");
builder.AppendLine(body.FormatDependentContents, " Format-dependent contents");
}
var body = entry.Body;
builder.AppendLine(body.DiscTypeIdentifier, " Disc type identifer");
builder.AppendLine(body.DiscSizeClassVersion, " Disc size class version");
builder.AppendLine(body.FormatDependentContents, " Format-dependent contents");
if (entry.Trailer == null)
{

View File

@@ -15,7 +15,7 @@ namespace SabreTools.Serialization.Wrappers
#region Extension Properties
/// <inheritdoc cref="DiscInformation.Units"/>
public DiscInformationUnit[] Units => Model.Units ?? [];
public DiscInformationUnit[] Units => Model.Units;
#endregion