mirror of
https://github.com/aaru-dps/Aaru.Decoders.git
synced 2025-12-16 19:24:32 +00:00
General cleanup and refactor.
This commit is contained in:
@@ -30,14 +30,14 @@
|
||||
// Copyright © 2011-2022 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
namespace Aaru.Decoders.CD;
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text;
|
||||
using Aaru.Console;
|
||||
using Aaru.Helpers;
|
||||
|
||||
namespace Aaru.Decoders.CD;
|
||||
|
||||
// Information from the following standards:
|
||||
// ANSI X3.304-1997
|
||||
// T10/1048-D revision 9.0
|
||||
@@ -118,17 +118,17 @@ public static class CDTextOnLeadIn
|
||||
return null;
|
||||
}
|
||||
|
||||
for(int i = 0; i < (decoded.DataLength - 2) / 18; i++)
|
||||
for(var i = 0; i < (decoded.DataLength - 2) / 18; i++)
|
||||
{
|
||||
decoded.DataPacks[i].HeaderID1 = CDTextResponse[0 + (i * 18) + 4];
|
||||
decoded.DataPacks[i].HeaderID2 = CDTextResponse[1 + (i * 18) + 4];
|
||||
decoded.DataPacks[i].HeaderID3 = CDTextResponse[2 + (i * 18) + 4];
|
||||
decoded.DataPacks[i].DBCC = Convert.ToBoolean(CDTextResponse[3 + (i * 18) + 4] & 0x80);
|
||||
decoded.DataPacks[i].BlockNumber = (byte)((CDTextResponse[3 + (i * 18) + 4] & 0x70) >> 4);
|
||||
decoded.DataPacks[i].CharacterPosition = (byte)(CDTextResponse[3 + (i * 18) + 4] & 0x0F);
|
||||
decoded.DataPacks[i].HeaderID1 = CDTextResponse[0 + i * 18 + 4];
|
||||
decoded.DataPacks[i].HeaderID2 = CDTextResponse[1 + i * 18 + 4];
|
||||
decoded.DataPacks[i].HeaderID3 = CDTextResponse[2 + i * 18 + 4];
|
||||
decoded.DataPacks[i].DBCC = Convert.ToBoolean(CDTextResponse[3 + i * 18 + 4] & 0x80);
|
||||
decoded.DataPacks[i].BlockNumber = (byte)((CDTextResponse[3 + i * 18 + 4] & 0x70) >> 4);
|
||||
decoded.DataPacks[i].CharacterPosition = (byte)(CDTextResponse[3 + i * 18 + 4] & 0x0F);
|
||||
decoded.DataPacks[i].TextDataField = new byte[12];
|
||||
Array.Copy(CDTextResponse, 4 + (i * 18) + 4, decoded.DataPacks[i].TextDataField, 0, 12);
|
||||
decoded.DataPacks[i].CRC = BigEndianBitConverter.ToUInt16(CDTextResponse, 16 + (i * 18) + 4);
|
||||
Array.Copy(CDTextResponse, 4 + i * 18 + 4, decoded.DataPacks[i].TextDataField, 0, 12);
|
||||
decoded.DataPacks[i].CRC = BigEndianBitConverter.ToUInt16(CDTextResponse, 16 + i * 18 + 4);
|
||||
}
|
||||
|
||||
return decoded;
|
||||
@@ -155,8 +155,7 @@ public static class CDTextOnLeadIn
|
||||
{
|
||||
// Ignore NOPs
|
||||
if((descriptor.HeaderID1 & 0x80) != 0)
|
||||
sb.AppendFormat("Incorrect CD-Text pack type {0}, not decoding", descriptor.HeaderID1).
|
||||
AppendLine();
|
||||
sb.AppendFormat("Incorrect CD-Text pack type {0}, not decoding", descriptor.HeaderID1).AppendLine();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -322,8 +321,7 @@ public static class CDTextOnLeadIn
|
||||
default:
|
||||
{
|
||||
sb.AppendFormat("Binary contents: {0}",
|
||||
PrintHex.ByteArrayToHexArrayString(descriptor.TextDataField, 28)).
|
||||
AppendLine();
|
||||
PrintHex.ByteArrayToHexArrayString(descriptor.TextDataField, 28)).AppendLine();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user