mirror of
https://github.com/aaru-dps/Aaru.Decoders.git
synced 2025-12-16 19:24:32 +00:00
Added specific console handling for standard, verbose, debug
and error outputs.
This commit is contained in:
9
ATA.cs
9
ATA.cs
@@ -38,6 +38,7 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using DiscImageChef.Console;
|
||||
|
||||
namespace DiscImageChef.Decoders
|
||||
{
|
||||
@@ -1852,8 +1853,14 @@ namespace DiscImageChef.Decoders
|
||||
|
||||
public static IdentifyDevice? DecodeIdentifyDevice(byte[] IdentifyDeviceResponse)
|
||||
{
|
||||
if (IdentifyDeviceResponse.Length != 512)
|
||||
if (IdentifyDeviceResponse != null)
|
||||
return null;
|
||||
|
||||
if (IdentifyDeviceResponse.Length != 512)
|
||||
{
|
||||
DicConsole.DebugWriteLine("ATA/ATAPI IDENTIFY decoder", "IDENTIFY response is different than 512 bytes, not decoding.");
|
||||
return null;
|
||||
}
|
||||
|
||||
//IdentifyDevice ATAID = new IdentifyDevice();
|
||||
|
||||
|
||||
119
BD.cs
119
BD.cs
@@ -38,6 +38,7 @@ Copyright (C) 2011-2014 Claunia.com
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using DiscImageChef.Console;
|
||||
|
||||
namespace DiscImageChef.Decoders
|
||||
{
|
||||
@@ -81,8 +82,7 @@ namespace DiscImageChef.Decoders
|
||||
|
||||
if (DIResponse.Length != 4100)
|
||||
{
|
||||
//if (MainClass.isDebug)
|
||||
Console.WriteLine("DEBUG (BD Disc Information): Found incorrect Blu-ray Disc Information size ({0} bytes)", DIResponse.Length);
|
||||
DicConsole.DebugWriteLine("BD Disc Information decoder", "Found incorrect Blu-ray Disc Information size ({0} bytes)", DIResponse.Length);
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -141,8 +141,7 @@ namespace DiscImageChef.Decoders
|
||||
}
|
||||
default:
|
||||
{
|
||||
//if (MainClass.isDebug)
|
||||
Console.WriteLine("DEBUG (BD Disc Information): Found unknown disc type identifier \"{0}\"", Encoding.ASCII.GetString(unit.DiscTypeIdentifier));
|
||||
DicConsole.DebugWriteLine("BD Disc Information decoder", "Found unknown disc type identifier \"{0}\"", Encoding.ASCII.GetString(unit.DiscTypeIdentifier));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -210,8 +209,7 @@ namespace DiscImageChef.Decoders
|
||||
|
||||
if (BCAResponse.Length != 68)
|
||||
{
|
||||
//if (MainClass.isDebug)
|
||||
Console.WriteLine("DEBUG (BD BCA): Found incorrect Blu-ray BCA size ({0} bytes)", BCAResponse.Length);
|
||||
DicConsole.DebugWriteLine("BD BCA decoder", "Found incorrect Blu-ray BCA size ({0} bytes)", BCAResponse.Length);
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -238,11 +236,13 @@ namespace DiscImageChef.Decoders
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
//if (MainClass.isDebug)
|
||||
{
|
||||
sb.AppendFormat("DEBUG (BD BCA): Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
sb.AppendFormat("DEBUG (BD BCA): Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
}
|
||||
#if DEBUG
|
||||
if(response.Reserved1 != 0)
|
||||
sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
if(response.Reserved2 != 0)
|
||||
sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
#endif
|
||||
|
||||
sb.AppendFormat("Blu-ray Burst Cutting Area in hex follows:");
|
||||
sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.BCA, 80));
|
||||
|
||||
@@ -270,8 +270,7 @@ namespace DiscImageChef.Decoders
|
||||
decoded.Signature = BigEndianBitConverter.ToUInt16(DDSResponse, 4);
|
||||
if (decoded.Signature != DDSIdentifier)
|
||||
{
|
||||
//if (MainClass.isDebug)
|
||||
Console.WriteLine("DEBUG (BD DDS): Found incorrect DDS signature (0x{0:X4})", decoded.Signature);
|
||||
DicConsole.DebugWriteLine("BD DDS decoder", "Found incorrect DDS signature (0x{0:X4})", decoded.Signature);
|
||||
|
||||
return null;
|
||||
|
||||
@@ -312,19 +311,6 @@ namespace DiscImageChef.Decoders
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
//if (MainClass.isDebug)
|
||||
{
|
||||
sb.AppendFormat("DEBUG (BD Disc Definition Structure): Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
sb.AppendFormat("DEBUG (BD Disc Definition Structure): Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
sb.AppendFormat("DEBUG (BD Disc Definition Structure): Reserved3 = 0x{0:X2}", response.Reserved3).AppendLine();
|
||||
sb.AppendFormat("DEBUG (BD Disc Definition Structure): Reserved4 = 0x{0:X16}", response.Reserved4).AppendLine();
|
||||
sb.AppendFormat("DEBUG (BD Disc Definition Structure): Reserved5 = 0x{0:X8}", response.Reserved5).AppendLine();
|
||||
sb.AppendFormat("DEBUG (BD Disc Definition Structure): Reserved6 = 0x{0:X8}", response.Reserved6).AppendLine();
|
||||
sb.AppendFormat("DEBUG (BD Disc Definition Structure): Reserved7 = 0x{0:X2}", response.Reserved7).AppendLine();
|
||||
sb.AppendFormat("DEBUG (BD Disc Definition Structure): Reserved8 = 0x{0:X2}", response.Reserved8).AppendLine();
|
||||
sb.AppendFormat("DEBUG (BD Disc Definition Structure): Reserved9 = 0x{0:X8}", response.Reserved9).AppendLine();
|
||||
}
|
||||
|
||||
sb.AppendFormat("DDS Format: 0x{0:X2}", response.Format).AppendLine();
|
||||
sb.AppendFormat("DDS has ben updated {0} times", response.UpdateCount).AppendLine();
|
||||
sb.AppendFormat("First PSN of Drive Area: 0x{0:X8}", response.DriveAreaPSN).AppendLine();
|
||||
@@ -342,6 +328,27 @@ namespace DiscImageChef.Decoders
|
||||
sb.AppendFormat("Blu-ray DDS Disc Type Specific Data in hex follows:");
|
||||
sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.DiscTypeSpecificData, 80));
|
||||
|
||||
#if DEBUG
|
||||
if(response.Reserved1 != 0)
|
||||
sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
if(response.Reserved2 != 0)
|
||||
sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
if(response.Reserved3 != 0)
|
||||
sb.AppendFormat("Reserved3 = 0x{0:X2}", response.Reserved3).AppendLine();
|
||||
if(response.Reserved4 != 0)
|
||||
sb.AppendFormat("Reserved4 = 0x{0:X16}", response.Reserved4).AppendLine();
|
||||
if(response.Reserved5 != 0)
|
||||
sb.AppendFormat("Reserved5 = 0x{0:X8}", response.Reserved5).AppendLine();
|
||||
if(response.Reserved6 != 0)
|
||||
sb.AppendFormat("Reserved6 = 0x{0:X8}", response.Reserved6).AppendLine();
|
||||
if(response.Reserved7 != 0)
|
||||
sb.AppendFormat("Reserved7 = 0x{0:X2}", response.Reserved7).AppendLine();
|
||||
if(response.Reserved8 != 0)
|
||||
sb.AppendFormat("Reserved8 = 0x{0:X2}", response.Reserved8).AppendLine();
|
||||
if(response.Reserved9 != 0)
|
||||
sb.AppendFormat("Reserved9 = 0x{0:X8}", response.Reserved9).AppendLine();
|
||||
#endif
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
@@ -358,8 +365,7 @@ namespace DiscImageChef.Decoders
|
||||
|
||||
if (CSResponse.Length != 8)
|
||||
{
|
||||
//if (MainClass.isDebug)
|
||||
Console.WriteLine("DEBUG (BD Cartridge Status): Found incorrect Blu-ray Spare Area Information size ({0} bytes)", CSResponse.Length);
|
||||
DicConsole.DebugWriteLine("BD Cartridge Status decoder", "Found incorrect Blu-ray Cartridge Status size ({0} bytes)", CSResponse.Length);
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -392,16 +398,22 @@ namespace DiscImageChef.Decoders
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
//if (MainClass.isDebug)
|
||||
{
|
||||
sb.AppendFormat("DEBUG (BD Cartridge Status): Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
sb.AppendFormat("DEBUG (BD Cartridge Status): Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
sb.AppendFormat("DEBUG (BD Cartridge Status): Reserved3 = 0x{0:X8}", response.Reserved3).AppendLine();
|
||||
sb.AppendFormat("DEBUG (BD Cartridge Status): Reserved4 = 0x{0:X8}", response.Reserved4).AppendLine();
|
||||
sb.AppendFormat("DEBUG (BD Cartridge Status): Reserved5 = 0x{0:X8}", response.Reserved5).AppendLine();
|
||||
sb.AppendFormat("DEBUG (BD Cartridge Status): Reserved6 = 0x{0:X8}", response.Reserved6).AppendLine();
|
||||
sb.AppendFormat("DEBUG (BD Cartridge Status): Reserved7 = 0x{0:X8}", response.Reserved7).AppendLine();
|
||||
}
|
||||
#if DEBUG
|
||||
if(response.Reserved1 != 0)
|
||||
sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
if(response.Reserved2 != 0)
|
||||
sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
if(response.Reserved3 != 0)
|
||||
sb.AppendFormat("Reserved3 = 0x{0:X8}", response.Reserved3).AppendLine();
|
||||
if(response.Reserved4 != 0)
|
||||
sb.AppendFormat("Reserved4 = 0x{0:X8}", response.Reserved4).AppendLine();
|
||||
if(response.Reserved5 != 0)
|
||||
sb.AppendFormat("Reserved5 = 0x{0:X8}", response.Reserved5).AppendLine();
|
||||
if(response.Reserved6 != 0)
|
||||
sb.AppendFormat("Reserved6 = 0x{0:X8}", response.Reserved6).AppendLine();
|
||||
if(response.Reserved7 != 0)
|
||||
sb.AppendFormat("Reserved7 = 0x{0:X8}", response.Reserved7).AppendLine();
|
||||
#endif
|
||||
|
||||
if (response.Cartridge)
|
||||
{
|
||||
@@ -414,13 +426,13 @@ namespace DiscImageChef.Decoders
|
||||
else
|
||||
{
|
||||
sb.AppendLine("Media is not in a cartridge");
|
||||
//if (MainClass.isDebug)
|
||||
{
|
||||
if (response.OUT)
|
||||
sb.AppendLine("Media has out bit marked, shouldn't");
|
||||
if (response.CWP)
|
||||
sb.AppendLine("Media has write protection bit marked, shouldn't");
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
if (response.OUT)
|
||||
sb.AppendLine("Media has out bit marked, shouldn't");
|
||||
if (response.CWP)
|
||||
sb.AppendLine("Media has write protection bit marked, shouldn't");
|
||||
#endif
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
@@ -438,8 +450,7 @@ namespace DiscImageChef.Decoders
|
||||
|
||||
if (SAIResponse.Length != 16)
|
||||
{
|
||||
//if (MainClass.isDebug)
|
||||
Console.WriteLine("DEBUG (BD Spare Area Information): Found incorrect Blu-ray Spare Area Information size ({0} bytes)", SAIResponse.Length);
|
||||
DicConsole.DebugWriteLine("BD Spare Area Information decoder", "Found incorrect Blu-ray Spare Area Information size ({0} bytes)", SAIResponse.Length);
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -467,12 +478,14 @@ namespace DiscImageChef.Decoders
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
//if (MainClass.isDebug)
|
||||
{
|
||||
sb.AppendFormat("DEBUG (BD Spare Area Information): Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
sb.AppendFormat("DEBUG (BD Spare Area Information): Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
sb.AppendFormat("DEBUG (BD Spare Area Information): Reserved3 = 0x{0:X8}", response.Reserved3).AppendLine();
|
||||
}
|
||||
#if DEBUG
|
||||
if(response.Reserved1 != 0)
|
||||
sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
if(response.Reserved2 != 0)
|
||||
sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
if(response.Reserved3 != 0)
|
||||
sb.AppendFormat("Reserved3 = 0x{0:X8}", response.Reserved3).AppendLine();
|
||||
#endif
|
||||
sb.AppendFormat("{0} free spare blocks", response.FreeSpareBlocks).AppendLine();
|
||||
sb.AppendFormat("{0} allocated spare blocks", response.AllocatedSpareBlocks).AppendLine();
|
||||
|
||||
|
||||
88
CD.cs
88
CD.cs
@@ -37,6 +37,7 @@ Copyright (C) 2011-2014 Claunia.com
|
||||
//$Id$
|
||||
using System;
|
||||
using System.Text;
|
||||
using DiscImageChef.Console;
|
||||
|
||||
namespace DiscImageChef.Decoders
|
||||
{
|
||||
@@ -203,8 +204,7 @@ namespace DiscImageChef.Decoders
|
||||
|
||||
if (decoded.DataLength + 2 != CDTOCResponse.Length)
|
||||
{
|
||||
//if (MainClass.isDebug)
|
||||
Console.WriteLine("DEBUG (CDTOC Decoder): Expected CDTOC size ({0} bytes) is not received size ({1} bytes), not decoding", decoded.DataLength + 2, CDTOCResponse.Length);
|
||||
DicConsole.DebugWriteLine("CD TOC decoder", "Expected CDTOC size ({0} bytes) is not received size ({1} bytes), not decoding", decoded.DataLength + 2, CDTOCResponse.Length);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -287,11 +287,12 @@ namespace DiscImageChef.Decoders
|
||||
else
|
||||
sb.AppendLine("Digital copy of track is prohibited");
|
||||
|
||||
//if (MainClass.isDebug)
|
||||
{
|
||||
sb.AppendFormat("Reserved1: {0:X2}", descriptor.Reserved1).AppendLine();
|
||||
sb.AppendFormat("Reserved2: {0:X2}", descriptor.Reserved2).AppendLine();
|
||||
}
|
||||
#if DEBUG
|
||||
if(descriptor.Reserved1 != 0)
|
||||
sb.AppendFormat("Reserved1 = 0x{0:X2}", descriptor.Reserved1).AppendLine();
|
||||
if(descriptor.Reserved2 != 0)
|
||||
sb.AppendFormat("Reserved2 = 0x{0:X2}", descriptor.Reserved2).AppendLine();
|
||||
#endif
|
||||
|
||||
sb.AppendLine();
|
||||
}
|
||||
@@ -322,8 +323,7 @@ namespace DiscImageChef.Decoders
|
||||
|
||||
if (decoded.DataLength + 2 != CDSessionInfoResponse.Length)
|
||||
{
|
||||
//if (MainClass.isDebug)
|
||||
Console.WriteLine("DEBUG (CDSessionInfo Decoder): Expected CDSessionInfo size ({0} bytes) is not received size ({1} bytes), not decoding", decoded.DataLength + 2, CDSessionInfoResponse.Length);
|
||||
DicConsole.DebugWriteLine("CD Session Info decoder", "Expected CDSessionInfo size ({0} bytes) is not received size ({1} bytes), not decoding", decoded.DataLength + 2, CDSessionInfoResponse.Length);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -406,11 +406,12 @@ namespace DiscImageChef.Decoders
|
||||
else
|
||||
sb.AppendLine("Digital copy of track is prohibited");
|
||||
|
||||
//if (MainClass.isDebug)
|
||||
{
|
||||
sb.AppendFormat("Reserved1: {0:X2}", descriptor.Reserved1).AppendLine();
|
||||
sb.AppendFormat("Reserved2: {0:X2}", descriptor.Reserved2).AppendLine();
|
||||
}
|
||||
#if DEBUG
|
||||
if(descriptor.Reserved1 != 0)
|
||||
sb.AppendFormat("Reserved1 = 0x{0:X2}", descriptor.Reserved1).AppendLine();
|
||||
if(descriptor.Reserved2 != 0)
|
||||
sb.AppendFormat("Reserved2 = 0x{0:X2}", descriptor.Reserved2).AppendLine();
|
||||
#endif
|
||||
|
||||
sb.AppendLine();
|
||||
}
|
||||
@@ -441,8 +442,7 @@ namespace DiscImageChef.Decoders
|
||||
|
||||
if (decoded.DataLength + 2 != CDFullTOCResponse.Length)
|
||||
{
|
||||
//if (MainClass.isDebug)
|
||||
Console.WriteLine("DEBUG (CDFullTOC Decoder): Expected CDFullTOC size ({0} bytes) is not received size ({1} bytes), not decoding", decoded.DataLength + 2, CDFullTOCResponse.Length);
|
||||
DicConsole.DebugWriteLine("CD full TOC decoder", "Expected CDFullTOC size ({0} bytes) is not received size ({1} bytes), not decoding", decoded.DataLength + 2, CDFullTOCResponse.Length);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -600,16 +600,13 @@ namespace DiscImageChef.Decoders
|
||||
case 0xC1:
|
||||
{
|
||||
sb.AppendFormat("Copy of information of A1 from ATIP found");
|
||||
//if (MainClass.isDebug)
|
||||
{
|
||||
sb.AppendFormat("Min = {0}", descriptor.Min).AppendLine();
|
||||
sb.AppendFormat("Sec = {0}", descriptor.Sec).AppendLine();
|
||||
sb.AppendFormat("Frame = {0}", descriptor.Frame).AppendLine();
|
||||
sb.AppendFormat("Zero = {0}", descriptor.Zero).AppendLine();
|
||||
sb.AppendFormat("PMIN = {0}", descriptor.PMIN).AppendLine();
|
||||
sb.AppendFormat("PSEC = {0}", descriptor.PSEC).AppendLine();
|
||||
sb.AppendFormat("PFRAME = {0}", descriptor.PFRAME).AppendLine();
|
||||
}
|
||||
sb.AppendFormat("Min = {0}", descriptor.Min).AppendLine();
|
||||
sb.AppendFormat("Sec = {0}", descriptor.Sec).AppendLine();
|
||||
sb.AppendFormat("Frame = {0}", descriptor.Frame).AppendLine();
|
||||
sb.AppendFormat("Zero = {0}", descriptor.Zero).AppendLine();
|
||||
sb.AppendFormat("PMIN = {0}", descriptor.PMIN).AppendLine();
|
||||
sb.AppendFormat("PSEC = {0}", descriptor.PSEC).AppendLine();
|
||||
sb.AppendFormat("PFRAME = {0}", descriptor.PFRAME).AppendLine();
|
||||
break;
|
||||
}
|
||||
case 0xCF:
|
||||
@@ -674,8 +671,7 @@ namespace DiscImageChef.Decoders
|
||||
|
||||
if (decoded.DataLength + 2 != CDPMAResponse.Length)
|
||||
{
|
||||
//if (MainClass.isDebug)
|
||||
Console.WriteLine("DEBUG (CDPMA Decoder): Expected CDPMA size ({0} bytes) is not received size ({1} bytes), not decoding", decoded.DataLength + 2, CDPMAResponse.Length);
|
||||
DicConsole.DebugWriteLine("CD PMA decoder", "Expected CDPMA size ({0} bytes) is not received size ({1} bytes), not decoding", decoded.DataLength + 2, CDPMAResponse.Length);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -708,15 +704,20 @@ namespace DiscImageChef.Decoders
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
//if (MainClass.isDebug)
|
||||
{
|
||||
sb.AppendFormat("Reserved1: 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
sb.AppendFormat("Reserved2: 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
}
|
||||
#if DEBUG
|
||||
if(response.Reserved1 != 0)
|
||||
sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
if(response.Reserved2 != 0)
|
||||
sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
#endif
|
||||
|
||||
foreach (CDPMADescriptors descriptor in response.PMADescriptors)
|
||||
{
|
||||
//if (MainClass.isDebug)
|
||||
sb.AppendFormat("Reserved1: 0x{0:X2}", descriptor.Reserved).AppendLine();
|
||||
#if DEBUG
|
||||
if(descriptor.Reserved != 0)
|
||||
sb.AppendFormat("Reserved = 0x{0:X2}", descriptor.Reserved).AppendLine();
|
||||
#endif
|
||||
|
||||
sb.AppendFormat("ADR = {0}", descriptor.ADR).AppendLine();
|
||||
sb.AppendFormat("CONTROL = {0}", descriptor.CONTROL).AppendLine();
|
||||
sb.AppendFormat("TNO = {0}", descriptor.TNO).AppendLine();
|
||||
@@ -751,8 +752,7 @@ namespace DiscImageChef.Decoders
|
||||
|
||||
if (CDATIPResponse.Length != 32)
|
||||
{
|
||||
//if (MainClass.isDebug)
|
||||
Console.WriteLine("DEBUG (CDATIP Decoder): Expected CDATIP size (32 bytes) is not received size ({0} bytes), not decoding", CDATIPResponse.Length);
|
||||
DicConsole.DebugWriteLine("CD ATIP decoder", "Expected CD ATIP size (32 bytes) is not received size ({0} bytes), not decoding", CDATIPResponse.Length);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -912,8 +912,7 @@ namespace DiscImageChef.Decoders
|
||||
|
||||
if (decoded.DataLength + 2 != CDTextResponse.Length)
|
||||
{
|
||||
//if (MainClass.isDebug)
|
||||
Console.WriteLine("DEBUG (CD-TEXT Decoder): Expected CD-TEXT size ({0} bytes) is not received size ({1} bytes), not decoding", decoded.DataLength + 2, CDTextResponse.Length);
|
||||
DicConsole.DebugWriteLine("CD-TEXT decoder", "Expected CD-TEXT size ({0} bytes) is not received size ({1} bytes), not decoding", decoded.DataLength + 2, CDTextResponse.Length);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -942,11 +941,12 @@ namespace DiscImageChef.Decoders
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
//if (MainClass.isDebug)
|
||||
{
|
||||
sb.AppendFormat("Reserved1: 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
sb.AppendFormat("Reserved2: 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
}
|
||||
#if DEBUG
|
||||
if(response.Reserved1 != 0)
|
||||
sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
if(response.Reserved2 != 0)
|
||||
sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
#endif
|
||||
foreach (CDTextPack descriptor in response.DataPacks)
|
||||
{
|
||||
if ((descriptor.HeaderID1 & 0x80) != 0x80)
|
||||
|
||||
11
ChangeLog
11
ChangeLog
@@ -1,3 +1,14 @@
|
||||
2015-10-18 Natalia Portillo <claunia@claunia.com>
|
||||
|
||||
* BD.cs:
|
||||
* CD.cs:
|
||||
* ATA.cs:
|
||||
* MMC.cs:
|
||||
* SCSI.cs:
|
||||
* DiscImageChef.Decoders.csproj:
|
||||
Added specific console handling for standard, verbose, debug
|
||||
and error outputs.
|
||||
|
||||
2015-10-17 Natalia Portillo <claunia@claunia.com>
|
||||
|
||||
* SCSI.cs:
|
||||
|
||||
@@ -48,5 +48,9 @@
|
||||
<Project>{F8BDF57B-1571-4CD0-84B3-B422088D359A}</Project>
|
||||
<Name>DiscImageChef.Helpers</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\DiscImageChef.Console\DiscImageChef.Console.csproj">
|
||||
<Project>{CCAA7AFE-C094-4D82-A66D-630DE8A3F545}</Project>
|
||||
<Name>DiscImageChef.Console</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
85
MMC.cs
85
MMC.cs
@@ -131,11 +131,12 @@ namespace DiscImageChef.Decoders
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
//if (MainClass.isDebug)
|
||||
{
|
||||
sb.AppendFormat("DEBUG (AACS Volume Identifier): Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
sb.AppendFormat("DEBUG (AACS Volume Identifier): Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
}
|
||||
#if DEBUG
|
||||
if(response.Reserved1 != 0)
|
||||
sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
if(response.Reserved2 != 0)
|
||||
sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
#endif
|
||||
sb.AppendFormat("AACS Volume Identifier in hex follows:");
|
||||
sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.VolumeIdentifier, 80));
|
||||
|
||||
@@ -176,11 +177,12 @@ namespace DiscImageChef.Decoders
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
//if (MainClass.isDebug)
|
||||
{
|
||||
sb.AppendFormat("DEBUG (AACS Media Serial Number): Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
sb.AppendFormat("DEBUG (AACS Media Serial Number): Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
}
|
||||
#if DEBUG
|
||||
if(response.Reserved1 != 0)
|
||||
sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
if(response.Reserved2 != 0)
|
||||
sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
#endif
|
||||
sb.AppendFormat("AACS Media Serial Number in hex follows:");
|
||||
sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.MediaSerialNumber, 80));
|
||||
|
||||
@@ -221,11 +223,12 @@ namespace DiscImageChef.Decoders
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
//if (MainClass.isDebug)
|
||||
{
|
||||
sb.AppendFormat("DEBUG (AACS Media Identifier): Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
sb.AppendFormat("DEBUG (AACS Media Identifier): Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
}
|
||||
#if DEBUG
|
||||
if(response.Reserved1 != 0)
|
||||
sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
if(response.Reserved2 != 0)
|
||||
sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
#endif
|
||||
sb.AppendFormat("AACS Media Identifier in hex follows:");
|
||||
sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.MediaIdentifier, 80));
|
||||
|
||||
@@ -266,10 +269,10 @@ namespace DiscImageChef.Decoders
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
//if (MainClass.isDebug)
|
||||
{
|
||||
sb.AppendFormat("DEBUG (AACS Media Key Block): Reserved = 0x{0:X2}", response.Reserved).AppendLine();
|
||||
}
|
||||
#if DEBUG
|
||||
if(response.Reserved != 0)
|
||||
sb.AppendFormat("Reserved = 0x{0:X2}", response.Reserved).AppendLine();
|
||||
#endif
|
||||
sb.AppendFormat("Total number of media key blocks available to transfer {0}", response.TotalPacks).AppendLine();
|
||||
sb.AppendFormat("AACS Media Key Blocks in hex follows:");
|
||||
sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.MediaKeyBlockPacks, 80));
|
||||
@@ -311,11 +314,12 @@ namespace DiscImageChef.Decoders
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
//if (MainClass.isDebug)
|
||||
{
|
||||
sb.AppendFormat("DEBUG (AACS Data Keys): Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
sb.AppendFormat("DEBUG (AACS Data Keys): Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
}
|
||||
#if DEBUG
|
||||
if(response.Reserved1 != 0)
|
||||
sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
if(response.Reserved2 != 0)
|
||||
sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
#endif
|
||||
sb.AppendFormat("AACS Data Keys in hex follows:");
|
||||
sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.DataKeys, 80));
|
||||
|
||||
@@ -416,10 +420,10 @@ namespace DiscImageChef.Decoders
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
//if (MainClass.isDebug)
|
||||
{
|
||||
sb.AppendFormat("DEBUG (CPRM Media Key Block): Reserved1 = 0x{0:X2}", response.Reserved).AppendLine();
|
||||
}
|
||||
#if DEBUG
|
||||
if(response.Reserved != 0)
|
||||
sb.AppendFormat("Reserved = 0x{0:X2}", response.Reserved).AppendLine();
|
||||
#endif
|
||||
sb.AppendFormat("Total number of CPRM Media Key Blocks available to transfer: {0}", response.TotalPacks).AppendLine();
|
||||
sb.AppendFormat("CPRM Media Key Blocks in hex follows:");
|
||||
sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.MKBPackData, 80));
|
||||
@@ -466,7 +470,7 @@ namespace DiscImageChef.Decoders
|
||||
|
||||
public static string PrettifyFormatLayers(RecognizedFormatLayers? FormatLayersResponse)
|
||||
{
|
||||
if (FormatLayersResponse == null)
|
||||
if (FormatLayersResponse == null)
|
||||
return null;
|
||||
|
||||
RecognizedFormatLayers response = FormatLayersResponse.Value;
|
||||
@@ -578,15 +582,20 @@ namespace DiscImageChef.Decoders
|
||||
if (response.SWPP)
|
||||
sb.AppendLine("Software write protection is set until power down");
|
||||
|
||||
//if (MainClass.isDebug)
|
||||
{
|
||||
sb.AppendFormat("DEBUG (Write Protection Status): Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
sb.AppendFormat("DEBUG (Write Protection Status): Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
sb.AppendFormat("DEBUG (Write Protection Status): Reserved3 = 0x{0:X2}", response.Reserved3).AppendLine();
|
||||
sb.AppendFormat("DEBUG (Write Protection Status): Reserved4 = 0x{0:X2}", response.Reserved4).AppendLine();
|
||||
sb.AppendFormat("DEBUG (Write Protection Status): Reserved5 = 0x{0:X2}", response.Reserved5).AppendLine();
|
||||
sb.AppendFormat("DEBUG (Write Protection Status): Reserved6 = 0x{0:X2}", response.Reserved6).AppendLine();
|
||||
}
|
||||
#if DEBUG
|
||||
if(response.Reserved1 != 0)
|
||||
sb.AppendFormat("Reserved1 = 0x{0:X2}", response.Reserved1).AppendLine();
|
||||
if(response.Reserved2 != 0)
|
||||
sb.AppendFormat("Reserved2 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
if(response.Reserved3 != 0)
|
||||
sb.AppendFormat("Reserved3 = 0x{0:X2}", response.Reserved3).AppendLine();
|
||||
if(response.Reserved4 != 0)
|
||||
sb.AppendFormat("Reserved4 = 0x{0:X2}", response.Reserved4).AppendLine();
|
||||
if(response.Reserved5 != 0)
|
||||
sb.AppendFormat("Reserved5 = 0x{0:X2}", response.Reserved5).AppendLine();
|
||||
if(response.Reserved6 != 0)
|
||||
sb.AppendFormat("Reserved6 = 0x{0:X2}", response.Reserved6).AppendLine();
|
||||
#endif
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
83
SCSI.cs
83
SCSI.cs
@@ -37,6 +37,7 @@ Copyright (C) 2011-2014 Claunia.com
|
||||
//$Id$
|
||||
using System;
|
||||
using System.Text;
|
||||
using DiscImageChef.Console;
|
||||
|
||||
namespace DiscImageChef.Decoders
|
||||
{
|
||||
@@ -1890,18 +1891,14 @@ namespace DiscImageChef.Decoders
|
||||
|
||||
if (SCSIInquiryResponse.Length < 36)
|
||||
{
|
||||
//if (MainClass.isDebug)
|
||||
Console.WriteLine("DEBUG (SCSI INQUIRY Decoder): INQUIRY response is less than minimum of 36 bytes, decoded data can be incorrect, proceeding anyway.");
|
||||
//else
|
||||
return null;
|
||||
DicConsole.DebugWriteLine("SCSI INQUIRY decoder", "INQUIRY response is less than minimum of 36 bytes, decoded data can be incorrect, not decoding.");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (SCSIInquiryResponse.Length != SCSIInquiryResponse[4] + 5)
|
||||
{
|
||||
//if (MainClass.isDebug)
|
||||
Console.WriteLine("DEBUG (SCSI INQUIRY Decoder): INQUIRY response length ({0} bytes) is different than specified in length field ({1} bytes), decoded data can be incorrect, proceeding anyway.", SCSIInquiryResponse.Length, SCSIInquiryResponse[4] + 4);
|
||||
//else
|
||||
return null;
|
||||
DicConsole.DebugWriteLine("SCSI INQUIRY decoder", "INQUIRY response length ({0} bytes) is different than specified in length field ({1} bytes), decoded data can be incorrect, not decoding.", SCSIInquiryResponse.Length, SCSIInquiryResponse[4] + 4);
|
||||
return null;
|
||||
}
|
||||
|
||||
SCSIInquiry decoded = new SCSIInquiry();
|
||||
@@ -2233,11 +2230,10 @@ namespace DiscImageChef.Decoders
|
||||
sb.AppendLine("Device supports information unit transfers");
|
||||
if (response.SftRe)
|
||||
sb.AppendLine("Device implements RESET as a soft reset");
|
||||
//if (MainClass.isDebug)
|
||||
{
|
||||
if (response.VS1)
|
||||
sb.AppendLine("Vendor specific bit 5 on byte 6 of INQUIRY response is set");
|
||||
}
|
||||
#if DEBUG
|
||||
if (response.VS1)
|
||||
sb.AppendLine("Vendor specific bit 5 on byte 6 of INQUIRY response is set");
|
||||
#endif
|
||||
|
||||
switch ((SCSITGPSValues)response.TPGS)
|
||||
{
|
||||
@@ -3694,38 +3690,41 @@ namespace DiscImageChef.Decoders
|
||||
}
|
||||
}
|
||||
|
||||
//if (MainClass.isDebug)
|
||||
#if DEBUG
|
||||
if(response.DeviceTypeModifier != 0)
|
||||
sb.AppendFormat("Vendor's device type modifier = 0x{0:X2}", response.DeviceTypeModifier).AppendLine();
|
||||
if(response.Reserved2 != 0)
|
||||
sb.AppendFormat("Reserved byte 5, bits 2 to 1 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
if(response.Reserved3 != 0)
|
||||
sb.AppendFormat("Reserved byte 56, bits 7 to 4 = 0x{0:X2}", response.Reserved3).AppendLine();
|
||||
if(response.Reserved4 != 0)
|
||||
sb.AppendFormat("Reserved byte 57 = 0x{0:X2}", response.Reserved4).AppendLine();
|
||||
|
||||
if (response.Reserved5 != null)
|
||||
{
|
||||
sb.AppendFormat("DEBUG (SCSIInquiry Decoder): Vendor's device type modifier = 0x{0:X2}", response.DeviceTypeModifier).AppendLine();
|
||||
sb.AppendFormat("DEBUG (SCSIInquiry Decoder): Reserved byte 5, bits 2 to 1 = 0x{0:X2}", response.Reserved2).AppendLine();
|
||||
sb.AppendFormat("DEBUG (SCSIInquiry Decoder): Reserved byte 56, bits 7 to 4 = 0x{0:X2}", response.Reserved3).AppendLine();
|
||||
sb.AppendFormat("DEBUG (SCSIInquiry Decoder): Reserved byte 57 = 0x{0:X2}", response.Reserved4).AppendLine();
|
||||
|
||||
if (response.Reserved5 != null)
|
||||
{
|
||||
sb.AppendLine("DEBUG (SCSIInquiry Decoder): Reserved bytes 74 to 95");
|
||||
sb.AppendLine("============================================================");
|
||||
sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.Reserved5, 60));
|
||||
sb.AppendLine("============================================================");
|
||||
}
|
||||
|
||||
if (response.VendorSpecific != null)
|
||||
{
|
||||
sb.AppendLine("DEBUG (SCSIInquiry Decoder): Vendor-specific bytes 36 to 55");
|
||||
sb.AppendLine("============================================================");
|
||||
sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.VendorSpecific, 60));
|
||||
sb.AppendLine("============================================================");
|
||||
}
|
||||
|
||||
if (response.VendorSpecific2 != null)
|
||||
{
|
||||
sb.AppendFormat("DEBUG (SCSIInquiry Decoder): Vendor-specific bytes 96 to {0}", response.AdditionalLength+4).AppendLine();
|
||||
sb.AppendLine("============================================================");
|
||||
sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.VendorSpecific2, 60));
|
||||
sb.AppendLine("============================================================");
|
||||
}
|
||||
sb.AppendLine("Reserved bytes 74 to 95");
|
||||
sb.AppendLine("============================================================");
|
||||
sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.Reserved5, 60));
|
||||
sb.AppendLine("============================================================");
|
||||
}
|
||||
|
||||
if (response.VendorSpecific != null)
|
||||
{
|
||||
sb.AppendLine("Vendor-specific bytes 36 to 55");
|
||||
sb.AppendLine("============================================================");
|
||||
sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.VendorSpecific, 60));
|
||||
sb.AppendLine("============================================================");
|
||||
}
|
||||
|
||||
if (response.VendorSpecific2 != null)
|
||||
{
|
||||
sb.AppendFormat("Vendor-specific bytes 96 to {0}", response.AdditionalLength+4).AppendLine();
|
||||
sb.AppendLine("============================================================");
|
||||
sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.VendorSpecific2, 60));
|
||||
sb.AppendLine("============================================================");
|
||||
}
|
||||
#endif
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user