* DiscImageChef.Decoders/CD/TOC.cs:

* DiscImageChef.Decoders/CD/PMA.cs:
	* DiscImageChef.Decoders/CD/ATIP.cs:
	* DiscImageChef.Decoders/CD/Session.cs:
	* DiscImageChef.Decoders/CD/FullTOC.cs:
	* DiscImageChef.Decoders/CD/CDTextOnLeadIn.cs:
	  Rename fields, methods and structs to more adequate names.

	* DiscImageChef/Commands/Decode.cs:
	  Rename CD decoders fields, methods and structs to more
	  adequate names.
This commit is contained in:
2015-10-19 02:46:04 +01:00
parent bd0d0c0806
commit bf38b4cc3d
7 changed files with 51 additions and 41 deletions

View File

@@ -222,7 +222,7 @@ namespace DiscImageChef.Decoders.CD
public byte Reserved10; public byte Reserved10;
} }
public static CDATIP? DecodeCDATIP(byte[] CDATIPResponse) public static CDATIP? Decode(byte[] CDATIPResponse)
{ {
if (CDATIPResponse == null) if (CDATIPResponse == null)
return null; return null;
@@ -282,7 +282,7 @@ namespace DiscImageChef.Decoders.CD
return decoded; return decoded;
} }
public static string PrettifyCDATIP(CDATIP? CDATIPResponse) public static string Prettify(CDATIP? CDATIPResponse)
{ {
if (CDATIPResponse == null) if (CDATIPResponse == null)
return null; return null;
@@ -371,10 +371,10 @@ namespace DiscImageChef.Decoders.CD
return sb.ToString(); return sb.ToString();
} }
public static string PrettifyCDATIP(byte[] CDATIPResponse) public static string Prettify(byte[] CDATIPResponse)
{ {
CDATIP? decoded = DecodeCDATIP(CDATIPResponse); CDATIP? decoded = Decode(CDATIPResponse);
return PrettifyCDATIP(decoded); return Prettify(decoded);
} }
} }
} }

View File

@@ -126,7 +126,7 @@ namespace DiscImageChef.Decoders.CD
BlockSizeInformation = 0x8F BlockSizeInformation = 0x8F
} }
public struct CDTextLeadIn public struct CDText
{ {
/// <summary> /// <summary>
/// Total size of returned CD-Text information minus this field /// Total size of returned CD-Text information minus this field
@@ -190,12 +190,12 @@ namespace DiscImageChef.Decoders.CD
public UInt16 CRC; public UInt16 CRC;
} }
public static CDTextLeadIn? DecodeCDTextLeadIn(byte[] CDTextResponse) public static CDText? Decode(byte[] CDTextResponse)
{ {
if (CDTextResponse == null) if (CDTextResponse == null)
return null; return null;
CDTextLeadIn decoded = new CDTextLeadIn(); CDText decoded = new CDText();
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
@@ -226,12 +226,12 @@ namespace DiscImageChef.Decoders.CD
return decoded; return decoded;
} }
public static string PrettifyCDTextLeadIn(CDTextLeadIn? CDTextResponse) public static string Prettify(CDText? CDTextResponse)
{ {
if (CDTextResponse == null) if (CDTextResponse == null)
return null; return null;
CDTextLeadIn response = CDTextResponse.Value; CDText response = CDTextResponse.Value;
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
@@ -383,10 +383,10 @@ namespace DiscImageChef.Decoders.CD
return sb.ToString(); return sb.ToString();
} }
public static string PrettifyCDTextLeadIn(byte[] CDTextResponse) public static string Prettify(byte[] CDTextResponse)
{ {
CDTextLeadIn? decoded = DecodeCDTextLeadIn(CDTextResponse); CDText? decoded = Decode(CDTextResponse);
return PrettifyCDTextLeadIn(decoded); return Prettify(decoded);
} }
} }
} }

View File

@@ -75,10 +75,10 @@ namespace DiscImageChef.Decoders.CD
/// <summary> /// <summary>
/// Track descriptors /// Track descriptors
/// </summary> /// </summary>
public CDFullTOCInfoTrackDataDescriptor[] TrackDescriptors; public TrackDataDescriptor[] TrackDescriptors;
} }
public struct CDFullTOCInfoTrackDataDescriptor public struct TrackDataDescriptor
{ {
/// <summary> /// <summary>
/// Byte 0 /// Byte 0
@@ -141,7 +141,7 @@ namespace DiscImageChef.Decoders.CD
public byte PFRAME; public byte PFRAME;
} }
public static CDFullTOC? DecodeCDFullTOC(byte[] CDFullTOCResponse) public static CDFullTOC? Decode(byte[] CDFullTOCResponse)
{ {
if (CDFullTOCResponse == null) if (CDFullTOCResponse == null)
return null; return null;
@@ -153,7 +153,7 @@ namespace DiscImageChef.Decoders.CD
decoded.DataLength = BigEndianBitConverter.ToUInt16(CDFullTOCResponse, 0); decoded.DataLength = BigEndianBitConverter.ToUInt16(CDFullTOCResponse, 0);
decoded.FirstCompleteSession = CDFullTOCResponse[2]; decoded.FirstCompleteSession = CDFullTOCResponse[2];
decoded.LastCompleteSession = CDFullTOCResponse[3]; decoded.LastCompleteSession = CDFullTOCResponse[3];
decoded.TrackDescriptors = new CDFullTOCInfoTrackDataDescriptor[(decoded.DataLength - 2) / 11]; decoded.TrackDescriptors = new TrackDataDescriptor[(decoded.DataLength - 2) / 11];
if (decoded.DataLength + 2 != CDFullTOCResponse.Length) if (decoded.DataLength + 2 != CDFullTOCResponse.Length)
{ {
@@ -182,7 +182,7 @@ namespace DiscImageChef.Decoders.CD
return decoded; return decoded;
} }
public static string PrettifyCDFullTOC(CDFullTOC? CDFullTOCResponse) public static string Prettify(CDFullTOC? CDFullTOCResponse)
{ {
if (CDFullTOCResponse == null) if (CDFullTOCResponse == null)
return null; return null;
@@ -193,7 +193,7 @@ namespace DiscImageChef.Decoders.CD
sb.AppendFormat("First complete session number: {0}", response.FirstCompleteSession).AppendLine(); sb.AppendFormat("First complete session number: {0}", response.FirstCompleteSession).AppendLine();
sb.AppendFormat("Last complete session number: {0}", response.LastCompleteSession).AppendLine(); sb.AppendFormat("Last complete session number: {0}", response.LastCompleteSession).AppendLine();
foreach (CDFullTOCInfoTrackDataDescriptor descriptor in response.TrackDescriptors) foreach (TrackDataDescriptor descriptor in response.TrackDescriptors)
{ {
if ((descriptor.CONTROL != 4 && descriptor.CONTROL != 6) || if ((descriptor.CONTROL != 4 && descriptor.CONTROL != 6) ||
(descriptor.ADR != 1 && descriptor.ADR != 5) || (descriptor.ADR != 1 && descriptor.ADR != 5) ||
@@ -364,10 +364,10 @@ namespace DiscImageChef.Decoders.CD
return sb.ToString(); return sb.ToString();
} }
public static string PrettifyCDFullTOC(byte[] CDFullTOCResponse) public static string Prettify(byte[] CDFullTOCResponse)
{ {
CDFullTOC? decoded = DecodeCDFullTOC(CDFullTOCResponse); CDFullTOC? decoded = Decode(CDFullTOCResponse);
return PrettifyCDFullTOC(decoded); return Prettify(decoded);
} }
} }
} }

View File

@@ -137,7 +137,7 @@ namespace DiscImageChef.Decoders.CD
public byte PFRAME; public byte PFRAME;
} }
public static CDPMA? DecodeCDPMA(byte[] CDPMAResponse) public static CDPMA? Decode(byte[] CDPMAResponse)
{ {
if (CDPMAResponse == null) if (CDPMAResponse == null)
return null; return null;
@@ -177,7 +177,7 @@ namespace DiscImageChef.Decoders.CD
return decoded; return decoded;
} }
public static string PrettifyCDPMA(CDPMA? CDPMAResponse) public static string Prettify(CDPMA? CDPMAResponse)
{ {
if (CDPMAResponse == null) if (CDPMAResponse == null)
return null; return null;
@@ -217,10 +217,10 @@ namespace DiscImageChef.Decoders.CD
return sb.ToString(); return sb.ToString();
} }
public static string PrettifyCDPMA(byte[] CDPMAResponse) public static string Prettify(byte[] CDPMAResponse)
{ {
CDPMA? decoded = DecodeCDPMA(CDPMAResponse); CDPMA? decoded = Decode(CDPMAResponse);
return PrettifyCDPMA(decoded); return Prettify(decoded);
} }
} }
} }

View File

@@ -75,10 +75,10 @@ namespace DiscImageChef.Decoders.CD
/// <summary> /// <summary>
/// Track descriptors /// Track descriptors
/// </summary> /// </summary>
public CDSessionInfoTrackDataDescriptor[] TrackDescriptors; public TrackDataDescriptor[] TrackDescriptors;
} }
public struct CDSessionInfoTrackDataDescriptor public struct TrackDataDescriptor
{ {
/// <summary> /// <summary>
/// Byte 0 /// Byte 0
@@ -112,7 +112,7 @@ namespace DiscImageChef.Decoders.CD
public UInt32 TrackStartAddress; public UInt32 TrackStartAddress;
} }
public static CDSessionInfo? DecodeCDSessionInfo(byte[] CDSessionInfoResponse) public static CDSessionInfo? Decode(byte[] CDSessionInfoResponse)
{ {
if (CDSessionInfoResponse == null) if (CDSessionInfoResponse == null)
return null; return null;
@@ -124,7 +124,7 @@ namespace DiscImageChef.Decoders.CD
decoded.DataLength = BigEndianBitConverter.ToUInt16(CDSessionInfoResponse, 0); decoded.DataLength = BigEndianBitConverter.ToUInt16(CDSessionInfoResponse, 0);
decoded.FirstCompleteSession = CDSessionInfoResponse[2]; decoded.FirstCompleteSession = CDSessionInfoResponse[2];
decoded.LastCompleteSession = CDSessionInfoResponse[3]; decoded.LastCompleteSession = CDSessionInfoResponse[3];
decoded.TrackDescriptors = new CDSessionInfoTrackDataDescriptor[(decoded.DataLength - 2) / 8]; decoded.TrackDescriptors = new TrackDataDescriptor[(decoded.DataLength - 2) / 8];
if (decoded.DataLength + 2 != CDSessionInfoResponse.Length) if (decoded.DataLength + 2 != CDSessionInfoResponse.Length)
{ {
@@ -145,7 +145,7 @@ namespace DiscImageChef.Decoders.CD
return decoded; return decoded;
} }
public static string PrettifyCDSessionInfo(CDSessionInfo? CDSessionInfoResponse) public static string Prettify(CDSessionInfo? CDSessionInfoResponse)
{ {
if (CDSessionInfoResponse == null) if (CDSessionInfoResponse == null)
return null; return null;
@@ -156,7 +156,7 @@ namespace DiscImageChef.Decoders.CD
sb.AppendFormat("First complete session number: {0}", response.FirstCompleteSession).AppendLine(); sb.AppendFormat("First complete session number: {0}", response.FirstCompleteSession).AppendLine();
sb.AppendFormat("Last complete session number: {0}", response.LastCompleteSession).AppendLine(); sb.AppendFormat("Last complete session number: {0}", response.LastCompleteSession).AppendLine();
foreach (CDSessionInfoTrackDataDescriptor descriptor in response.TrackDescriptors) foreach (TrackDataDescriptor descriptor in response.TrackDescriptors)
{ {
sb.AppendFormat("First track number in last complete session: {0}", descriptor.TrackNumber); sb.AppendFormat("First track number in last complete session: {0}", descriptor.TrackNumber);
sb.AppendFormat("Track starts at LBA {0}, or MSF {1:X2}:{2:X2}:{3:X2}", descriptor.TrackStartAddress, sb.AppendFormat("Track starts at LBA {0}, or MSF {1:X2}:{2:X2}:{3:X2}", descriptor.TrackStartAddress,
@@ -225,10 +225,10 @@ namespace DiscImageChef.Decoders.CD
return sb.ToString(); return sb.ToString();
} }
public static string PrettifyCDSessionInfo(byte[] CDSessionInfoResponse) public static string Prettify(byte[] CDSessionInfoResponse)
{ {
CDSessionInfo? decoded = DecodeCDSessionInfo(CDSessionInfoResponse); CDSessionInfo? decoded = Decode(CDSessionInfoResponse);
return PrettifyCDSessionInfo(decoded); return Prettify(decoded);
} }
} }
} }

View File

@@ -112,7 +112,7 @@ namespace DiscImageChef.Decoders.CD
public UInt32 TrackStartAddress; public UInt32 TrackStartAddress;
} }
public static CDTOC? DecodeCDTOC(byte[] CDTOCResponse) public static CDTOC? Decode(byte[] CDTOCResponse)
{ {
if (CDTOCResponse == null) if (CDTOCResponse == null)
return null; return null;
@@ -145,7 +145,7 @@ namespace DiscImageChef.Decoders.CD
return decoded; return decoded;
} }
public static string PrettifyCDTOC(CDTOC? CDTOCResponse) public static string Prettify(CDTOC? CDTOCResponse)
{ {
if (CDTOCResponse == null) if (CDTOCResponse == null)
return null; return null;
@@ -225,10 +225,10 @@ namespace DiscImageChef.Decoders.CD
return sb.ToString(); return sb.ToString();
} }
public static string PrettifyCDTOC(byte[] CDTOCResponse) public static string Prettify(byte[] CDTOCResponse)
{ {
CDTOC? decoded = DecodeCDTOC(CDTOCResponse); CDTOC? decoded = Decode(CDTOCResponse);
return PrettifyCDTOC(decoded); return Prettify(decoded);
} }
} }
} }

View File

@@ -1,3 +1,13 @@
2015-10-19 Natalia Portillo <claunia@claunia.com>
* CD/TOC.cs:
* CD/PMA.cs:
* CD/ATIP.cs:
* CD/Session.cs:
* CD/FullTOC.cs:
* CD/CDTextOnLeadIn.cs:
Rename fields, methods and structs to more adequate names.
2015-10-19 Natalia Portillo <claunia@claunia.com> 2015-10-19 Natalia Portillo <claunia@claunia.com>
* CD/CD.cs: * CD/CD.cs: