Move to file scoped namespaces.

This commit is contained in:
2022-03-06 13:29:37 +00:00
parent c7178d94c6
commit 3b6091c02c
119 changed files with 38048 additions and 38172 deletions

View File

@@ -35,82 +35,81 @@ using System.Diagnostics.CodeAnalysis;
using System.Text;
using Aaru.Helpers;
namespace Aaru.Decoders.SCSI.MMC
namespace Aaru.Decoders.SCSI.MMC;
// Information from the following standards:
// ANSI X3.304-1997
// T10/1048-D revision 9.0
// T10/1048-D revision 10a
// T10/1228-D revision 7.0c
// T10/1228-D revision 11a
// T10/1363-D revision 10g
// T10/1545-D revision 1d
// T10/1545-D revision 5
// T10/1545-D revision 5a
// T10/1675-D revision 2c
// T10/1675-D revision 4
// T10/1836-D revision 2g
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
SuppressMessage("ReSharper", "MemberCanBePrivate.Global"), SuppressMessage("ReSharper", "NotAccessedField.Global")]
public static class CPRM
{
// Information from the following standards:
// ANSI X3.304-1997
// T10/1048-D revision 9.0
// T10/1048-D revision 10a
// T10/1228-D revision 7.0c
// T10/1228-D revision 11a
// T10/1363-D revision 10g
// T10/1545-D revision 1d
// T10/1545-D revision 5
// T10/1545-D revision 5a
// T10/1675-D revision 2c
// T10/1675-D revision 4
// T10/1836-D revision 2g
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "MemberCanBeInternal"),
SuppressMessage("ReSharper", "MemberCanBePrivate.Global"), SuppressMessage("ReSharper", "NotAccessedField.Global")]
public static class CPRM
public static CPRMMediaKeyBlock? DecodeCPRMMediaKeyBlock(byte[] CPRMMKBResponse)
{
public static CPRMMediaKeyBlock? DecodeCPRMMediaKeyBlock(byte[] CPRMMKBResponse)
if(CPRMMKBResponse == null)
return null;
var decoded = new CPRMMediaKeyBlock
{
if(CPRMMKBResponse == null)
return null;
MKBPackData = new byte[CPRMMKBResponse.Length - 4],
DataLength = BigEndianBitConverter.ToUInt16(CPRMMKBResponse, 0),
Reserved = CPRMMKBResponse[2],
TotalPacks = CPRMMKBResponse[3]
};
var decoded = new CPRMMediaKeyBlock
{
MKBPackData = new byte[CPRMMKBResponse.Length - 4],
DataLength = BigEndianBitConverter.ToUInt16(CPRMMKBResponse, 0),
Reserved = CPRMMKBResponse[2],
TotalPacks = CPRMMKBResponse[3]
};
Array.Copy(CPRMMKBResponse, 4, decoded.MKBPackData, 0, CPRMMKBResponse.Length - 4);
Array.Copy(CPRMMKBResponse, 4, decoded.MKBPackData, 0, CPRMMKBResponse.Length - 4);
return decoded;
}
return decoded;
}
public static string PrettifyCPRMMediaKeyBlock(CPRMMediaKeyBlock? CPRMMKBResponse)
{
if(CPRMMKBResponse == null)
return null;
public static string PrettifyCPRMMediaKeyBlock(CPRMMediaKeyBlock? CPRMMKBResponse)
{
if(CPRMMKBResponse == null)
return null;
CPRMMediaKeyBlock response = CPRMMKBResponse.Value;
CPRMMediaKeyBlock response = CPRMMKBResponse.Value;
var sb = new StringBuilder();
var sb = new StringBuilder();
#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();
#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));
sb.AppendFormat("CPRM Media Key Blocks in hex follows:");
sb.AppendLine(PrintHex.ByteArrayToHexArrayString(response.MKBPackData, 80));
return sb.ToString();
}
return sb.ToString();
}
public static string PrettifyCPRMMediaKeyBlock(byte[] CPRMMKBResponse)
{
CPRMMediaKeyBlock? decoded = DecodeCPRMMediaKeyBlock(CPRMMKBResponse);
public static string PrettifyCPRMMediaKeyBlock(byte[] CPRMMKBResponse)
{
CPRMMediaKeyBlock? decoded = DecodeCPRMMediaKeyBlock(CPRMMKBResponse);
return PrettifyCPRMMediaKeyBlock(decoded);
}
return PrettifyCPRMMediaKeyBlock(decoded);
}
public struct CPRMMediaKeyBlock
{
/// <summary>Bytes 0 to 1 Data Length</summary>
public ushort DataLength;
/// <summary>Byte 2 Reserved</summary>
public byte Reserved;
/// <summary>Byte 3 Number of MKB packs available to transfer</summary>
public byte TotalPacks;
/// <summary>Byte 4 MKB Packs</summary>
public byte[] MKBPackData;
}
public struct CPRMMediaKeyBlock
{
/// <summary>Bytes 0 to 1 Data Length</summary>
public ushort DataLength;
/// <summary>Byte 2 Reserved</summary>
public byte Reserved;
/// <summary>Byte 3 Number of MKB packs available to transfer</summary>
public byte TotalPacks;
/// <summary>Byte 4 MKB Packs</summary>
public byte[] MKBPackData;
}
}