Remove the ability to support little endian from BigEndianBitConverter.

This commit is contained in:
2019-05-11 20:49:32 +01:00
parent 6401e1b3a1
commit b6c7e84762
62 changed files with 502 additions and 560 deletions

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.IO;
using System.Text;
using DiscImageChef.CommonTypes.Interfaces;
@@ -83,7 +82,6 @@ namespace DiscImageChef.Checksums
public byte[] Final()
{
uint finalSum = (uint)((sum2 << 16) | sum1);
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
return BigEndianBitConverter.GetBytes(finalSum);
}
@@ -95,7 +93,6 @@ namespace DiscImageChef.Checksums
uint finalSum = (uint)((sum2 << 16) | sum1);
StringBuilder adlerOutput = new StringBuilder();
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
for(int i = 0; i < BigEndianBitConverter.GetBytes(finalSum).Length; i++)
adlerOutput.Append(BigEndianBitConverter.GetBytes(finalSum)[i].ToString("x2"));
@@ -132,8 +129,7 @@ namespace DiscImageChef.Checksums
uint finalSum = (uint)((localSum2 << 16) | localSum1);
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
hash = BigEndianBitConverter.GetBytes(finalSum);
hash = BigEndianBitConverter.GetBytes(finalSum);
StringBuilder adlerOutput = new StringBuilder();
@@ -163,8 +159,7 @@ namespace DiscImageChef.Checksums
uint finalSum = (uint)((localSum2 << 16) | localSum1);
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
hash = BigEndianBitConverter.GetBytes(finalSum);
hash = BigEndianBitConverter.GetBytes(finalSum);
StringBuilder adlerOutput = new StringBuilder();

View File

@@ -100,6 +100,7 @@ namespace DiscImageChef.Checksums
return status;
}
case 2352: return CheckCdSectorChannel(buffer);
default: return null;
}
@@ -429,8 +430,6 @@ namespace DiscImageChef.Checksums
break;
}
BigEndianBitConverter.IsLittleEndian = true;
ushort qSubChannelCrc = BigEndianBitConverter.ToUInt16(qSubChannel, 10);
byte[] qSubChannelForCrc = new byte[10];
Array.Copy(qSubChannel, 0, qSubChannelForCrc, 0, 10);

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.IO;
using System.Text;
using DiscImageChef.CommonTypes.Interfaces;
@@ -64,10 +63,8 @@ namespace DiscImageChef.Checksums
{
ushort entry = (ushort)i;
for(int j = 0; j < 8; j++)
if((entry & 1) == 1)
entry = (ushort)((entry >> 1) ^ CRC16_IBM_POLY);
else
entry = (ushort)(entry >> 1);
if((entry & 1) == 1) entry = (ushort)((entry >> 1) ^ CRC16_IBM_POLY);
else entry = (ushort)(entry >> 1);
table[i] = entry;
}
@@ -86,10 +83,8 @@ namespace DiscImageChef.Checksums
{
ushort entry = (ushort)i;
for(int j = 0; j < 8; j++)
if((entry & 1) == 1)
entry = (ushort)((entry >> 1) ^ polynomial);
else
entry = (ushort)(entry >> 1);
if((entry & 1) == 1) entry = (ushort)((entry >> 1) ^ polynomial);
else entry = (ushort)(entry >> 1);
table[i] = entry;
}
@@ -117,11 +112,7 @@ namespace DiscImageChef.Checksums
/// <summary>
/// Returns a byte array of the hash value.
/// </summary>
public byte[] Final()
{
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
return BigEndianBitConverter.GetBytes((ushort)(hashInt ^ finalSeed));
}
public byte[] Final() => BigEndianBitConverter.GetBytes((ushort)(hashInt ^ finalSeed));
/// <summary>
/// Returns a hexadecimal representation of the hash value.
@@ -130,7 +121,6 @@ namespace DiscImageChef.Checksums
{
StringBuilder crc16Output = new StringBuilder();
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
for(int i = 0; i < BigEndianBitConverter.GetBytes((ushort)(hashInt ^ finalSeed)).Length; i++)
crc16Output.Append(BigEndianBitConverter.GetBytes((ushort)(hashInt ^ finalSeed))[i].ToString("x2"));
@@ -171,10 +161,8 @@ namespace DiscImageChef.Checksums
{
ushort entry = (ushort)i;
for(int j = 0; j < 8; j++)
if((entry & 1) == 1)
entry = (ushort)((entry >> 1) ^ polynomial);
else
entry = (ushort)(entry >> 1);
if((entry & 1) == 1) entry = (ushort)((entry >> 1) ^ polynomial);
else entry = (ushort)(entry >> 1);
localTable[i] = entry;
}
@@ -183,9 +171,8 @@ namespace DiscImageChef.Checksums
localhashInt =
(ushort)((localhashInt >> 8) ^ localTable[fileStream.ReadByte() ^ (localhashInt & 0xff)]);
localhashInt ^= seed;
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
hash = BigEndianBitConverter.GetBytes(localhashInt);
localhashInt ^= seed;
hash = BigEndianBitConverter.GetBytes(localhashInt);
StringBuilder crc16Output = new StringBuilder();
@@ -222,10 +209,8 @@ namespace DiscImageChef.Checksums
{
ushort entry = (ushort)i;
for(int j = 0; j < 8; j++)
if((entry & 1) == 1)
entry = (ushort)((entry >> 1) ^ polynomial);
else
entry = (ushort)(entry >> 1);
if((entry & 1) == 1) entry = (ushort)((entry >> 1) ^ polynomial);
else entry = (ushort)(entry >> 1);
localTable[i] = entry;
}
@@ -233,9 +218,8 @@ namespace DiscImageChef.Checksums
for(int i = 0; i < len; i++)
localhashInt = (ushort)((localhashInt >> 8) ^ localTable[data[i] ^ (localhashInt & 0xff)]);
localhashInt ^= seed;
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
hash = BigEndianBitConverter.GetBytes(localhashInt);
localhashInt ^= seed;
hash = BigEndianBitConverter.GetBytes(localhashInt);
StringBuilder crc16Output = new StringBuilder();

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.IO;
using System.Text;
using DiscImageChef.CommonTypes.Interfaces;
@@ -64,10 +63,8 @@ namespace DiscImageChef.Checksums
{
uint entry = (uint)i;
for(int j = 0; j < 8; j++)
if((entry & 1) == 1)
entry = (entry >> 1) ^ CRC32_ISO_POLY;
else
entry = entry >> 1;
if((entry & 1) == 1) entry = (entry >> 1) ^ CRC32_ISO_POLY;
else entry = entry >> 1;
table[i] = entry;
}
@@ -86,10 +83,8 @@ namespace DiscImageChef.Checksums
{
uint entry = (uint)i;
for(int j = 0; j < 8; j++)
if((entry & 1) == 1)
entry = (entry >> 1) ^ polynomial;
else
entry = entry >> 1;
if((entry & 1) == 1) entry = (entry >> 1) ^ polynomial;
else entry = entry >> 1;
table[i] = entry;
}
@@ -117,11 +112,7 @@ namespace DiscImageChef.Checksums
/// <summary>
/// Returns a byte array of the hash value.
/// </summary>
public byte[] Final()
{
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
return BigEndianBitConverter.GetBytes(hashInt ^ finalSeed);
}
public byte[] Final() => BigEndianBitConverter.GetBytes(hashInt ^ finalSeed);
/// <summary>
/// Returns a hexadecimal representation of the hash value.
@@ -130,7 +121,6 @@ namespace DiscImageChef.Checksums
{
StringBuilder crc32Output = new StringBuilder();
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
for(int i = 0; i < BigEndianBitConverter.GetBytes(hashInt ^ finalSeed).Length; i++)
crc32Output.Append(BigEndianBitConverter.GetBytes(hashInt ^ finalSeed)[i].ToString("x2"));
@@ -171,10 +161,8 @@ namespace DiscImageChef.Checksums
{
uint entry = (uint)i;
for(int j = 0; j < 8; j++)
if((entry & 1) == 1)
entry = (entry >> 1) ^ polynomial;
else
entry = entry >> 1;
if((entry & 1) == 1) entry = (entry >> 1) ^ polynomial;
else entry = entry >> 1;
localTable[i] = entry;
}
@@ -182,9 +170,8 @@ namespace DiscImageChef.Checksums
for(int i = 0; i < fileStream.Length; i++)
localhashInt = (localhashInt >> 8) ^ localTable[fileStream.ReadByte() ^ (localhashInt & 0xff)];
localhashInt ^= seed;
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
hash = BigEndianBitConverter.GetBytes(localhashInt);
localhashInt ^= seed;
hash = BigEndianBitConverter.GetBytes(localhashInt);
StringBuilder crc32Output = new StringBuilder();
@@ -221,10 +208,8 @@ namespace DiscImageChef.Checksums
{
uint entry = (uint)i;
for(int j = 0; j < 8; j++)
if((entry & 1) == 1)
entry = (entry >> 1) ^ polynomial;
else
entry = entry >> 1;
if((entry & 1) == 1) entry = (entry >> 1) ^ polynomial;
else entry = entry >> 1;
localTable[i] = entry;
}
@@ -232,9 +217,8 @@ namespace DiscImageChef.Checksums
for(int i = 0; i < len; i++)
localhashInt = (localhashInt >> 8) ^ localTable[data[i] ^ (localhashInt & 0xff)];
localhashInt ^= seed;
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
hash = BigEndianBitConverter.GetBytes(localhashInt);
localhashInt ^= seed;
hash = BigEndianBitConverter.GetBytes(localhashInt);
StringBuilder crc32Output = new StringBuilder();

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.IO;
using System.Text;
using DiscImageChef.CommonTypes.Interfaces;
@@ -61,10 +60,8 @@ namespace DiscImageChef.Checksums
{
ulong entry = (ulong)i;
for(int j = 0; j < 8; j++)
if((entry & 1) == 1)
entry = (entry >> 1) ^ CRC64_ECMA_POLY;
else
entry = entry >> 1;
if((entry & 1) == 1) entry = (entry >> 1) ^ CRC64_ECMA_POLY;
else entry = entry >> 1;
table[i] = entry;
}
@@ -84,10 +81,8 @@ namespace DiscImageChef.Checksums
{
ulong entry = (ulong)i;
for(int j = 0; j < 8; j++)
if((entry & 1) == 1)
entry = (entry >> 1) ^ polynomial;
else
entry = entry >> 1;
if((entry & 1) == 1) entry = (entry >> 1) ^ polynomial;
else entry = entry >> 1;
table[i] = entry;
}
@@ -117,11 +112,7 @@ namespace DiscImageChef.Checksums
/// <summary>
/// Returns a byte array of the hash value.
/// </summary>
public byte[] Final()
{
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
return BigEndianBitConverter.GetBytes(hashInt ^= finalSeed);
}
public byte[] Final() => BigEndianBitConverter.GetBytes(hashInt ^= finalSeed);
/// <summary>
/// Returns a hexadecimal representation of the hash value.
@@ -130,7 +121,6 @@ namespace DiscImageChef.Checksums
{
StringBuilder crc64Output = new StringBuilder();
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
for(int i = 0; i < BigEndianBitConverter.GetBytes(hashInt ^= finalSeed).Length; i++)
crc64Output.Append(BigEndianBitConverter.GetBytes(hashInt ^= finalSeed)[i].ToString("x2"));
@@ -171,10 +161,8 @@ namespace DiscImageChef.Checksums
{
ulong entry = (ulong)i;
for(int j = 0; j < 8; j++)
if((entry & 1) == 1)
entry = (entry >> 1) ^ polynomial;
else
entry = entry >> 1;
if((entry & 1) == 1) entry = (entry >> 1) ^ polynomial;
else entry = entry >> 1;
localTable[i] = entry;
}
@@ -182,9 +170,8 @@ namespace DiscImageChef.Checksums
for(int i = 0; i < fileStream.Length; i++)
localhashInt = (localhashInt >> 8) ^ localTable[(ulong)fileStream.ReadByte() ^ (localhashInt & 0xffL)];
localhashInt ^= seed;
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
hash = BigEndianBitConverter.GetBytes(localhashInt);
localhashInt ^= seed;
hash = BigEndianBitConverter.GetBytes(localhashInt);
StringBuilder crc64Output = new StringBuilder();
@@ -221,10 +208,8 @@ namespace DiscImageChef.Checksums
{
ulong entry = (ulong)i;
for(int j = 0; j < 8; j++)
if((entry & 1) == 1)
entry = (entry >> 1) ^ polynomial;
else
entry = entry >> 1;
if((entry & 1) == 1) entry = (entry >> 1) ^ polynomial;
else entry = entry >> 1;
localTable[i] = entry;
}
@@ -232,9 +217,8 @@ namespace DiscImageChef.Checksums
for(int i = 0; i < len; i++)
localhashInt = (localhashInt >> 8) ^ localTable[data[i] ^ (localhashInt & 0xff)];
localhashInt ^= seed;
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
hash = BigEndianBitConverter.GetBytes(localhashInt);
localhashInt ^= seed;
hash = BigEndianBitConverter.GetBytes(localhashInt);
StringBuilder crc64Output = new StringBuilder();

View File

@@ -32,7 +32,6 @@
// Disabled because the speed is abnormally slow
using System;
using System.IO;
using System.Text;
using DiscImageChef.CommonTypes.Interfaces;
@@ -85,7 +84,6 @@ namespace DiscImageChef.Checksums
public byte[] Final()
{
uint finalSum = (uint)((sum2 << 16) | sum1);
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
return BigEndianBitConverter.GetBytes(finalSum);
}
@@ -97,7 +95,6 @@ namespace DiscImageChef.Checksums
uint finalSum = (uint)((sum2 << 16) | sum1);
StringBuilder fletcherOutput = new StringBuilder();
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
for(int i = 0; i < BigEndianBitConverter.GetBytes(finalSum).Length; i++)
fletcherOutput.Append(BigEndianBitConverter.GetBytes(finalSum)[i].ToString("x2"));
@@ -134,8 +131,7 @@ namespace DiscImageChef.Checksums
uint finalSum = (uint)((localSum2 << 16) | localSum1);
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
hash = BigEndianBitConverter.GetBytes(finalSum);
hash = BigEndianBitConverter.GetBytes(finalSum);
StringBuilder fletcherOutput = new StringBuilder();
@@ -165,8 +161,7 @@ namespace DiscImageChef.Checksums
uint finalSum = (uint)((localSum2 << 16) | localSum1);
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
hash = BigEndianBitConverter.GetBytes(finalSum);
hash = BigEndianBitConverter.GetBytes(finalSum);
StringBuilder adlerOutput = new StringBuilder();
@@ -229,7 +224,6 @@ namespace DiscImageChef.Checksums
public byte[] Final()
{
ushort finalSum = (ushort)((sum2 << 8) | sum1);
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
return BigEndianBitConverter.GetBytes(finalSum);
}
@@ -241,7 +235,6 @@ namespace DiscImageChef.Checksums
ushort finalSum = (ushort)((sum2 << 8) | sum1);
StringBuilder fletcherOutput = new StringBuilder();
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
for(int i = 0; i < BigEndianBitConverter.GetBytes(finalSum).Length; i++)
fletcherOutput.Append(BigEndianBitConverter.GetBytes(finalSum)[i].ToString("x2"));
@@ -278,8 +271,7 @@ namespace DiscImageChef.Checksums
ushort finalSum = (ushort)((localSum2 << 8) | localSum1);
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
hash = BigEndianBitConverter.GetBytes(finalSum);
hash = BigEndianBitConverter.GetBytes(finalSum);
StringBuilder fletcherOutput = new StringBuilder();
@@ -309,8 +301,7 @@ namespace DiscImageChef.Checksums
ushort finalSum = (ushort)((localSum2 << 8) | localSum1);
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
hash = BigEndianBitConverter.GetBytes(finalSum);
hash = BigEndianBitConverter.GetBytes(finalSum);
StringBuilder adlerOutput = new StringBuilder();

View File

@@ -106,6 +106,7 @@ namespace DiscImageChef.Core.Devices.Info
break;
}
case DeviceType.ATAPI:
{
bool sense = dev.AtapiIdentify(out byte[] ataBuf, out AtaErrorRegistersChs errorRegisters);
@@ -133,6 +134,7 @@ namespace DiscImageChef.Core.Devices.Info
// ATAPI devices are also SCSI devices
goto case DeviceType.SCSI;
}
case DeviceType.SCSI:
{
bool sense = dev.ScsiInquiry(out byte[] inqBuf, out byte[] senseBuf);
@@ -292,6 +294,7 @@ namespace DiscImageChef.Core.Devices.Info
plxtDvd = true;
break;
}
default:
{
if(dev.Model.StartsWith("CD-R ", StringComparison.Ordinal))
@@ -307,7 +310,6 @@ namespace DiscImageChef.Core.Devices.Info
{
PlextorFeatures.Eeprom = plxtBuf;
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
if(plxtDvd)
{
PlextorFeatures.Discs = BigEndianBitConverter.ToUInt16(plxtBuf, 0x0120);
@@ -420,6 +422,7 @@ namespace DiscImageChef.Core.Devices.Info
KreonFeatures = krFeatures;
break;
}
case PeripheralDeviceTypes.SequentialAccess:
{
sense = dev.ReadBlockLimits(out byte[] seqBuf, out senseBuf, dev.Timeout, out _);
@@ -453,6 +456,7 @@ namespace DiscImageChef.Core.Devices.Info
break;
}
case DeviceType.MMC:
{
bool sense = dev.ReadCid(out byte[] mmcBuf, out _, dev.Timeout, out _);

View File

@@ -70,14 +70,14 @@ namespace DiscImageChef.Decoders.Bluray
return null;
}
BurstCuttingArea decoded = new BurstCuttingArea();
BurstCuttingArea decoded = new BurstCuttingArea
{
DataLength = BigEndianBitConverter.ToUInt16(BCAResponse, 0),
Reserved1 = BCAResponse[2],
Reserved2 = BCAResponse[3],
BCA = new byte[64]
};
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
decoded.DataLength = BigEndianBitConverter.ToUInt16(BCAResponse, 0);
decoded.Reserved1 = BCAResponse[2];
decoded.Reserved2 = BCAResponse[3];
decoded.BCA = new byte[64];
Array.Copy(BCAResponse, 4, decoded.BCA, 0, 64);
return decoded;

View File

@@ -72,21 +72,20 @@ namespace DiscImageChef.Decoders.Bluray
return null;
}
CartridgeStatus decoded = new CartridgeStatus();
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
decoded.DataLength = BigEndianBitConverter.ToUInt16(CSResponse, 0);
decoded.Reserved1 = CSResponse[2];
decoded.Reserved2 = CSResponse[3];
decoded.Cartridge = Convert.ToBoolean(CSResponse[4] & 0x80);
decoded.OUT = Convert.ToBoolean(CSResponse[4] & 0x40);
decoded.Reserved3 = (byte)((CSResponse[4] & 0x38) >> 3);
decoded.OUT = Convert.ToBoolean(CSResponse[4] & 0x04);
decoded.Reserved4 = (byte)(CSResponse[4] & 0x03);
decoded.Reserved5 = CSResponse[5];
decoded.Reserved6 = CSResponse[6];
decoded.Reserved7 = CSResponse[7];
CartridgeStatus decoded = new CartridgeStatus
{
DataLength = BigEndianBitConverter.ToUInt16(CSResponse, 0),
Reserved1 = CSResponse[2],
Reserved2 = CSResponse[3],
Cartridge = Convert.ToBoolean(CSResponse[4] & 0x80),
OUT = Convert.ToBoolean(CSResponse[4] & 0x40),
Reserved3 = (byte)((CSResponse[4] & 0x38) >> 3),
CWP = Convert.ToBoolean(CSResponse[4] & 0x04),
Reserved4 = (byte)(CSResponse[4] & 0x03),
Reserved5 = CSResponse[5],
Reserved6 = CSResponse[6],
Reserved7 = CSResponse[7]
};
return decoded;
}

View File

@@ -70,14 +70,14 @@ namespace DiscImageChef.Decoders.Bluray
{
if(DDSResponse == null) return null;
DiscDefinitionStructure decoded = new DiscDefinitionStructure();
DiscDefinitionStructure decoded = new DiscDefinitionStructure
{
DataLength = BigEndianBitConverter.ToUInt16(DDSResponse, 0),
Reserved1 = DDSResponse[2],
Reserved2 = DDSResponse[3],
Signature = BigEndianBitConverter.ToUInt16(DDSResponse, 4)
};
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
decoded.DataLength = BigEndianBitConverter.ToUInt16(DDSResponse, 0);
decoded.Reserved1 = DDSResponse[2];
decoded.Reserved2 = DDSResponse[3];
decoded.Signature = BigEndianBitConverter.ToUInt16(DDSResponse, 4);
if(decoded.Signature != DDSIdentifier)
{
DicConsole.DebugWriteLine("BD DDS decoder", "Found incorrect DDS signature (0x{0:X4})",

View File

@@ -83,13 +83,12 @@ namespace DiscImageChef.Decoders.Bluray
return null;
}
DiscInformation decoded = new DiscInformation();
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
decoded.DataLength = BigEndianBitConverter.ToUInt16(DIResponse, 0);
decoded.Reserved1 = DIResponse[2];
decoded.Reserved2 = DIResponse[3];
DiscInformation decoded = new DiscInformation
{
DataLength = BigEndianBitConverter.ToUInt16(DIResponse, 0),
Reserved1 = DIResponse[2],
Reserved2 = DIResponse[3]
};
int offset = 4;
List<DiscInformationUnits> units = new List<DiscInformationUnits>();
@@ -141,6 +140,7 @@ namespace DiscImageChef.Decoders.Bluray
Array.Copy(DIResponse, 32 + offset, unit.FormatDependentContents, 0, 32);
break;
}
case DiscTypeBDRE:
case DiscTypeBDR:
{
@@ -156,6 +156,7 @@ namespace DiscImageChef.Decoders.Bluray
offset += 14;
break;
}
default:
{
DicConsole.DebugWriteLine("BD Disc Information decoder",

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using DiscImageChef.Console;
@@ -71,16 +70,15 @@ namespace DiscImageChef.Decoders.Bluray
return null;
}
SpareAreaInformation decoded = new SpareAreaInformation();
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
decoded.DataLength = BigEndianBitConverter.ToUInt16(SAIResponse, 0);
decoded.Reserved1 = SAIResponse[2];
decoded.Reserved2 = SAIResponse[3];
decoded.Reserved3 = BigEndianBitConverter.ToUInt32(SAIResponse, 4);
decoded.FreeSpareBlocks = BigEndianBitConverter.ToUInt32(SAIResponse, 8);
decoded.AllocatedSpareBlocks = BigEndianBitConverter.ToUInt32(SAIResponse, 12);
SpareAreaInformation decoded = new SpareAreaInformation
{
DataLength = BigEndianBitConverter.ToUInt16(SAIResponse, 0),
Reserved1 = SAIResponse[2],
Reserved2 = SAIResponse[3],
Reserved3 = BigEndianBitConverter.ToUInt32(SAIResponse, 4),
FreeSpareBlocks = BigEndianBitConverter.ToUInt32(SAIResponse, 8),
AllocatedSpareBlocks = BigEndianBitConverter.ToUInt32(SAIResponse, 12)
};
return decoded;
}

View File

@@ -228,8 +228,6 @@ namespace DiscImageChef.Decoders.CD
CDATIP decoded = new CDATIP();
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
if(CDATIPResponse.Length != 32 && CDATIPResponse.Length != 28)
{
DicConsole.DebugWriteLine("CD ATIP decoder",

View File

@@ -194,14 +194,14 @@ namespace DiscImageChef.Decoders.CD
{
if(CDTextResponse == null) return null;
CDText decoded = new CDText();
CDText decoded = new CDText
{
DataLength = BigEndianBitConverter.ToUInt16(CDTextResponse, 0),
Reserved1 = CDTextResponse[2],
Reserved2 = CDTextResponse[3]
};
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
decoded.DataLength = BigEndianBitConverter.ToUInt16(CDTextResponse, 0);
decoded.Reserved1 = CDTextResponse[2];
decoded.Reserved2 = CDTextResponse[3];
decoded.DataPacks = new CDTextPack[(decoded.DataLength - 2) / 18];
decoded.DataPacks = new CDTextPack[(decoded.DataLength - 2) / 18];
if(decoded.DataLength == 2) return null;
@@ -260,6 +260,7 @@ namespace DiscImageChef.Decoders.CD
else sb.AppendFormat("track {0}", descriptor.HeaderID2).AppendLine();
break;
}
case 0x81:
{
sb.Append("CD-Text pack contains performer for ");
@@ -267,6 +268,7 @@ namespace DiscImageChef.Decoders.CD
else sb.AppendFormat("track {0}", descriptor.HeaderID2).AppendLine();
break;
}
case 0x82:
{
sb.Append("CD-Text pack contains songwriter for ");
@@ -274,12 +276,14 @@ namespace DiscImageChef.Decoders.CD
else sb.AppendFormat("track {0}", descriptor.HeaderID2).AppendLine();
break;
}
case 0x83:
{
if(descriptor.HeaderID2 == 0x00) sb.AppendLine("album");
else sb.AppendFormat("track {0}", descriptor.HeaderID2).AppendLine();
break;
}
case 0x84:
{
sb.Append("CD-Text pack contains arranger for ");
@@ -287,6 +291,7 @@ namespace DiscImageChef.Decoders.CD
else sb.AppendFormat("track {0}", descriptor.HeaderID2).AppendLine();
break;
}
case 0x85:
{
sb.Append("CD-Text pack contains content provider's message for ");
@@ -294,26 +299,31 @@ namespace DiscImageChef.Decoders.CD
else sb.AppendFormat("track {0}", descriptor.HeaderID2).AppendLine();
break;
}
case 0x86:
{
sb.AppendLine("CD-Text pack contains disc identification information");
break;
}
case 0x87:
{
sb.AppendLine("CD-Text pack contains genre identification information");
break;
}
case 0x88:
{
sb.AppendLine("CD-Text pack contains table of contents information");
break;
}
case 0x89:
{
sb.AppendLine("CD-Text pack contains second table of contents information");
break;
}
case 0x8A:
case 0x8B:
case 0x8C:
@@ -321,17 +331,20 @@ namespace DiscImageChef.Decoders.CD
sb.AppendLine("CD-Text pack contains reserved data");
break;
}
case 0x8D:
{
sb.AppendLine("CD-Text pack contains data reserved for content provider only");
break;
}
case 0x8E:
{
if(descriptor.HeaderID2 == 0x00) sb.AppendLine("CD-Text pack contains UPC");
else sb.AppendFormat("track {0}", descriptor.HeaderID2).AppendLine();
break;
}
case 0x8F:
{
sb.AppendLine("CD-Text pack contains size block information");
@@ -359,6 +372,7 @@ namespace DiscImageChef.Decoders.CD
Encoding.GetEncoding("iso-8859-1"))).AppendLine();
break;
}
default:
{
sb.AppendFormat("Binary contents: {0}",

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using DiscImageChef.Console;
@@ -153,14 +152,14 @@ namespace DiscImageChef.Decoders.CD
{
if(CDFullTOCResponse == null) return null;
CDFullTOC decoded = new CDFullTOC();
CDFullTOC decoded = new CDFullTOC
{
DataLength = BigEndianBitConverter.ToUInt16(CDFullTOCResponse, 0),
FirstCompleteSession = CDFullTOCResponse[2],
LastCompleteSession = CDFullTOCResponse[3]
};
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
decoded.DataLength = BigEndianBitConverter.ToUInt16(CDFullTOCResponse, 0);
decoded.FirstCompleteSession = CDFullTOCResponse[2];
decoded.LastCompleteSession = CDFullTOCResponse[3];
decoded.TrackDescriptors = new TrackDataDescriptor[(decoded.DataLength - 2) / 11];
decoded.TrackDescriptors = new TrackDataDescriptor[(decoded.DataLength - 2) / 11];
if(decoded.DataLength + 2 != CDFullTOCResponse.Length)
{
@@ -271,6 +270,7 @@ namespace DiscImageChef.Decoders.CD
break;
}
case 0xA0 when descriptor.ADR == 1:
{
sb.AppendFormat("First track number: {0} (", descriptor.PMIN);
@@ -301,6 +301,7 @@ namespace DiscImageChef.Decoders.CD
//sb.AppendFormat("Absolute time: {3:D2}:{0:D2}:{1:D2}:{2:D2}", descriptor.Min, descriptor.Sec, descriptor.Frame, descriptor.HOUR).AppendLine();
break;
}
case 0xA1 when descriptor.ADR == 4:
sb.AppendFormat("Last video track number: {0}", descriptor.PMIN).AppendLine();
break;
@@ -333,6 +334,7 @@ namespace DiscImageChef.Decoders.CD
//sb.AppendFormat("Absolute time: {3:D2}:{0:D2}:{1:D2}:{2:D2}", descriptor.Min, descriptor.Sec, descriptor.Frame, descriptor.HOUR).AppendLine();
break;
}
case 0xA2:
{
if(descriptor.PHOUR > 0)
@@ -361,6 +363,7 @@ namespace DiscImageChef.Decoders.CD
break;
}
case 0xF0:
{
sb.AppendFormat("Book type: 0x{0:X2}", descriptor.PMIN);
@@ -374,6 +377,7 @@ namespace DiscImageChef.Decoders.CD
descriptor.Sec, descriptor.Frame).AppendLine();
break;
}
default:
{
if(descriptor.POINT >= 0x01 && descriptor.POINT <= 0x63)
@@ -444,6 +448,7 @@ namespace DiscImageChef.Decoders.CD
break;
}
case 5:
{
switch(descriptor.POINT)
@@ -474,6 +479,7 @@ namespace DiscImageChef.Decoders.CD
break;
}
case 0xB1:
{
sb.AppendFormat("Number of skip interval pointers: {0}", descriptor.PMIN)
@@ -481,6 +487,7 @@ namespace DiscImageChef.Decoders.CD
sb.AppendFormat("Number of skip track pointers: {0}", descriptor.PSEC).AppendLine();
break;
}
case 0xB2:
case 0xB3:
case 0xB4:
@@ -494,6 +501,7 @@ namespace DiscImageChef.Decoders.CD
sb.AppendFormat("Skip track {0}", descriptor.PFRAME).AppendLine();
break;
}
case 0xC0:
{
sb.AppendFormat("Optimum recording power: 0x{0:X2}", descriptor.Min).AppendLine();
@@ -509,6 +517,7 @@ namespace DiscImageChef.Decoders.CD
.AppendLine();
break;
}
case 0xC1:
{
sb.AppendFormat("Copy of information of A1 from ATIP found");
@@ -521,6 +530,7 @@ namespace DiscImageChef.Decoders.CD
sb.AppendFormat("PFRAME = {0}", descriptor.PFRAME).AppendLine();
break;
}
case 0xCF:
{
if(descriptor.PHOUR > 0)
@@ -547,6 +557,7 @@ namespace DiscImageChef.Decoders.CD
break;
}
default:
{
if(descriptor.POINT >= 0x01 && descriptor.POINT <= 0x40)
@@ -581,6 +592,7 @@ namespace DiscImageChef.Decoders.CD
break;
}
case 6:
{
uint id = (uint)((descriptor.Min << 16) + (descriptor.Sec << 8) + descriptor.Frame);

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using DiscImageChef.Console;
@@ -140,13 +139,13 @@ namespace DiscImageChef.Decoders.CD
{
if(CDPMAResponse == null) return null;
CDPMA decoded = new CDPMA();
CDPMA decoded = new CDPMA
{
DataLength = BigEndianBitConverter.ToUInt16(CDPMAResponse, 0),
Reserved1 = CDPMAResponse[2],
Reserved2 = CDPMAResponse[3]
};
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
decoded.DataLength = BigEndianBitConverter.ToUInt16(CDPMAResponse, 0);
decoded.Reserved1 = CDPMAResponse[2];
decoded.Reserved2 = CDPMAResponse[3];
decoded.PMADescriptors = new CDPMADescriptors[(decoded.DataLength - 2) / 11];
if(decoded.DataLength + 2 != CDPMAResponse.Length)

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using DiscImageChef.Console;
@@ -115,14 +114,14 @@ namespace DiscImageChef.Decoders.CD
{
if(CDSessionInfoResponse == null) return null;
CDSessionInfo decoded = new CDSessionInfo();
CDSessionInfo decoded = new CDSessionInfo
{
DataLength = BigEndianBitConverter.ToUInt16(CDSessionInfoResponse, 0),
FirstCompleteSession = CDSessionInfoResponse[2],
LastCompleteSession = CDSessionInfoResponse[3]
};
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
decoded.DataLength = BigEndianBitConverter.ToUInt16(CDSessionInfoResponse, 0);
decoded.FirstCompleteSession = CDSessionInfoResponse[2];
decoded.LastCompleteSession = CDSessionInfoResponse[3];
decoded.TrackDescriptors = new TrackDataDescriptor[(decoded.DataLength - 2) / 8];
decoded.TrackDescriptors = new TrackDataDescriptor[(decoded.DataLength - 2) / 8];
if(decoded.DataLength + 2 != CDSessionInfoResponse.Length)
{

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using DiscImageChef.Console;
@@ -117,13 +116,13 @@ namespace DiscImageChef.Decoders.CD
{
if(CDTOCResponse == null) return null;
CDTOC decoded = new CDTOC();
CDTOC decoded = new CDTOC
{
DataLength = BigEndianBitConverter.ToUInt16(CDTOCResponse, 0),
FirstTrack = CDTOCResponse[2],
LastTrack = CDTOCResponse[3]
};
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
decoded.DataLength = BigEndianBitConverter.ToUInt16(CDTOCResponse, 0);
decoded.FirstTrack = CDTOCResponse[2];
decoded.LastTrack = CDTOCResponse[3];
decoded.TrackDescriptors = new CDTOCTrackDataDescriptor[(decoded.DataLength - 2) / 8];
if(decoded.DataLength + 2 != CDTOCResponse.Length)

View File

@@ -134,8 +134,6 @@ namespace DiscImageChef.Decoders
{
byte[] tagBytes = new byte[20];
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
byte[] tmp = BigEndianBitConverter.GetBytes(Version);
Array.Copy(tmp, 0, tagBytes, 0, 2);
tagBytes[2] = (byte)(Kind << 6);
@@ -257,8 +255,6 @@ namespace DiscImageChef.Decoders
{
byte[] tagBytes = new byte[24];
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
byte[] tmp = BigEndianBitConverter.GetBytes(Version);
Array.Copy(tmp, 0, tagBytes, 0, 2);
tagBytes[2] = (byte)(Kind << 6);
@@ -358,8 +354,6 @@ namespace DiscImageChef.Decoders
{
byte[] tagBytes = new byte[12];
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
byte[] tmp = BigEndianBitConverter.GetBytes(Version);
Array.Copy(tmp, 0, tagBytes, 0, 2);
tagBytes[2] = (byte)(Kind << 6);
@@ -381,18 +375,17 @@ namespace DiscImageChef.Decoders
{
if(tag == null || tag.Length != 12) return null;
SonyTag snTag = new SonyTag();
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
snTag.Version = BigEndianBitConverter.ToUInt16(tag, 0);
snTag.Kind = (byte)((tag[2] & 0xC0) >> 6);
snTag.Reserved = (byte)(tag[2] & 0x3F);
snTag.Volume = tag[3];
snTag.FileId = BigEndianBitConverter.ToInt16(tag, 4);
snTag.RelPage = BigEndianBitConverter.ToUInt16(tag, 6);
snTag.NextBlock = (ushort)(BigEndianBitConverter.ToUInt16(tag, 8) & 0x7FF);
snTag.PrevBlock = (ushort)(BigEndianBitConverter.ToUInt16(tag, 10) & 0x7FF);
SonyTag snTag = new SonyTag
{
Version = BigEndianBitConverter.ToUInt16(tag, 0),
Kind = (byte)((tag[2] & 0xC0) >> 6),
Reserved = (byte)(tag[2] & 0x3F),
Volume = tag[3],
FileId = BigEndianBitConverter.ToInt16(tag, 4),
RelPage = BigEndianBitConverter.ToUInt16(tag, 6),
NextBlock = (ushort)(BigEndianBitConverter.ToUInt16(tag, 8) & 0x7FF),
PrevBlock = (ushort)(BigEndianBitConverter.ToUInt16(tag, 10) & 0x7FF)
};
snTag.IsLast = snTag.NextBlock == 0x7FF;
snTag.IsFirst = snTag.PrevBlock == 0x7FF;
@@ -406,8 +399,6 @@ namespace DiscImageChef.Decoders
ProfileTag phTag = new ProfileTag();
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
byte[] tmp = new byte[4];
phTag.Version = BigEndianBitConverter.ToUInt16(tag, 0);
@@ -451,8 +442,6 @@ namespace DiscImageChef.Decoders
PriamTag pmTag = new PriamTag();
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
byte[] tmp = new byte[4];
pmTag.Version = BigEndianBitConverter.ToUInt16(tag, 0);

View File

@@ -227,8 +227,6 @@ namespace DiscImageChef.Decoders.SCSI.MMC
AACSVolumeIdentifier decoded = new AACSVolumeIdentifier();
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
decoded.VolumeIdentifier = new byte[AACSVIResponse.Length - 4];
decoded.DataLength = BigEndianBitConverter.ToUInt16(AACSVIResponse, 0);
@@ -269,8 +267,6 @@ namespace DiscImageChef.Decoders.SCSI.MMC
AACSMediaSerialNumber decoded = new AACSMediaSerialNumber();
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
decoded.MediaSerialNumber = new byte[AACSMSNResponse.Length - 4];
decoded.DataLength = BigEndianBitConverter.ToUInt16(AACSMSNResponse, 0);
@@ -311,8 +307,6 @@ namespace DiscImageChef.Decoders.SCSI.MMC
AACSMediaIdentifier decoded = new AACSMediaIdentifier();
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
decoded.MediaIdentifier = new byte[AACSMIResponse.Length - 4];
decoded.DataLength = BigEndianBitConverter.ToUInt16(AACSMIResponse, 0);
@@ -353,8 +347,6 @@ namespace DiscImageChef.Decoders.SCSI.MMC
AACSMediaKeyBlock decoded = new AACSMediaKeyBlock();
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
decoded.MediaKeyBlockPacks = new byte[AACSMKBResponse.Length - 4];
decoded.DataLength = BigEndianBitConverter.ToUInt16(AACSMKBResponse, 0);
@@ -396,8 +388,6 @@ namespace DiscImageChef.Decoders.SCSI.MMC
AACSDataKeys decoded = new AACSDataKeys();
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
decoded.DataKeys = new byte[AACSDKResponse.Length - 4];
decoded.DataLength = BigEndianBitConverter.ToUInt16(AACSDKResponse, 0);
@@ -436,13 +426,12 @@ namespace DiscImageChef.Decoders.SCSI.MMC
{
if(AACSLBAExtsResponse == null) return null;
AACSLBAExtentsResponse decoded = new AACSLBAExtentsResponse();
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
decoded.DataLength = BigEndianBitConverter.ToUInt16(AACSLBAExtsResponse, 0);
decoded.Reserved = AACSLBAExtsResponse[2];
decoded.MaxLBAExtents = AACSLBAExtsResponse[3];
AACSLBAExtentsResponse decoded = new AACSLBAExtentsResponse
{
DataLength = BigEndianBitConverter.ToUInt16(AACSLBAExtsResponse, 0),
Reserved = AACSLBAExtsResponse[2],
MaxLBAExtents = AACSLBAExtsResponse[3]
};
if((AACSLBAExtsResponse.Length - 4) % 16 != 0) return decoded;

View File

@@ -85,15 +85,14 @@ namespace DiscImageChef.Decoders.SCSI.MMC
{
if(CPRMMKBResponse == null) return null;
CPRMMediaKeyBlock decoded = new CPRMMediaKeyBlock();
CPRMMediaKeyBlock decoded = new CPRMMediaKeyBlock
{
MKBPackData = new byte[CPRMMKBResponse.Length - 4],
DataLength = BigEndianBitConverter.ToUInt16(CPRMMKBResponse, 0),
Reserved = CPRMMKBResponse[2],
TotalPacks = CPRMMKBResponse[3]
};
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
decoded.MKBPackData = new byte[CPRMMKBResponse.Length - 4];
decoded.DataLength = BigEndianBitConverter.ToUInt16(CPRMMKBResponse, 0);
decoded.Reserved = CPRMMKBResponse[2];
decoded.TotalPacks = CPRMMKBResponse[3];
Array.Copy(CPRMMKBResponse, 4, decoded.MKBPackData, 0, CPRMMKBResponse.Length - 4);
return decoded;

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.Diagnostics.CodeAnalysis;
using System.Text;
@@ -112,20 +111,18 @@ namespace DiscImageChef.Decoders.SCSI.MMC
if(FormatLayersResponse.Length < 8) return null;
RecognizedFormatLayers decoded = new RecognizedFormatLayers();
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
decoded.DataLength = BigEndianBitConverter.ToUInt16(FormatLayersResponse, 0);
decoded.Reserved1 = FormatLayersResponse[2];
decoded.Reserved2 = FormatLayersResponse[3];
decoded.NumberOfLayers = FormatLayersResponse[4];
decoded.Reserved3 = (byte)((FormatLayersResponse[5] & 0xC0) >> 6);
decoded.DefaultFormatLayer = (byte)((FormatLayersResponse[5] & 0x30) >> 4);
decoded.Reserved4 = (byte)((FormatLayersResponse[5] & 0x0C) >> 2);
decoded.OnlineFormatLayer = (byte)(FormatLayersResponse[5] & 0x03);
decoded.FormatLayers = new ushort[(FormatLayersResponse.Length - 6) / 2];
RecognizedFormatLayers decoded = new RecognizedFormatLayers
{
DataLength = BigEndianBitConverter.ToUInt16(FormatLayersResponse, 0),
Reserved1 = FormatLayersResponse[2],
Reserved2 = FormatLayersResponse[3],
NumberOfLayers = FormatLayersResponse[4],
Reserved3 = (byte)((FormatLayersResponse[5] & 0xC0) >> 6),
DefaultFormatLayer = (byte)((FormatLayersResponse[5] & 0x30) >> 4),
Reserved4 = (byte)((FormatLayersResponse[5] & 0x0C) >> 2),
OnlineFormatLayer = (byte)(FormatLayersResponse[5] & 0x03),
FormatLayers = new ushort[(FormatLayersResponse.Length - 6) / 2]
};
for(int i = 0; i < (FormatLayersResponse.Length - 6) / 2; i++)
decoded.FormatLayers[i] = BigEndianBitConverter.ToUInt16(FormatLayersResponse, i * 2 + 6);
@@ -153,6 +150,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC
if(response.OnlineFormatLayer == i) sb.AppendLine("This is the layer actually in use.");
break;
}
case (ushort)FormatLayerTypeCodes.CDLayer:
{
sb.AppendFormat("Layer {0} is of type CD", i).AppendLine();
@@ -160,6 +158,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC
if(response.OnlineFormatLayer == i) sb.AppendLine("This is the layer actually in use.");
break;
}
case (ushort)FormatLayerTypeCodes.DVDLayer:
{
sb.AppendFormat("Layer {0} is of type DVD", i).AppendLine();
@@ -167,6 +166,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC
if(response.OnlineFormatLayer == i) sb.AppendLine("This is the layer actually in use.");
break;
}
case (ushort)FormatLayerTypeCodes.HDDVDLayer:
{
sb.AppendFormat("Layer {0} is of type HD DVD", i).AppendLine();
@@ -174,6 +174,7 @@ namespace DiscImageChef.Decoders.SCSI.MMC
if(response.OnlineFormatLayer == i) sb.AppendLine("This is the layer actually in use.");
break;
}
default:
{
sb.AppendFormat("Layer {0} is of unknown type 0x{1:X4}", i, response.FormatLayers[i])

View File

@@ -120,21 +120,20 @@ namespace DiscImageChef.Decoders.SCSI.MMC
{
if(WPSResponse == null) return null;
WriteProtectionStatus decoded = new WriteProtectionStatus();
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
decoded.DataLength = BigEndianBitConverter.ToUInt16(WPSResponse, 0);
decoded.Reserved1 = WPSResponse[2];
decoded.Reserved2 = WPSResponse[3];
decoded.Reserved3 = (byte)((WPSResponse[4] & 0xF0) >> 4);
decoded.MSWI = Convert.ToBoolean(WPSResponse[4] & 0x08);
decoded.CWP = Convert.ToBoolean(WPSResponse[4] & 0x04);
decoded.PWP = Convert.ToBoolean(WPSResponse[4] & 0x02);
decoded.SWPP = Convert.ToBoolean(WPSResponse[4] & 0x01);
decoded.Reserved4 = WPSResponse[5];
decoded.Reserved5 = WPSResponse[6];
decoded.Reserved6 = WPSResponse[7];
WriteProtectionStatus decoded = new WriteProtectionStatus
{
DataLength = BigEndianBitConverter.ToUInt16(WPSResponse, 0),
Reserved1 = WPSResponse[2],
Reserved2 = WPSResponse[3],
Reserved3 = (byte)((WPSResponse[4] & 0xF0) >> 4),
MSWI = Convert.ToBoolean(WPSResponse[4] & 0x08),
CWP = Convert.ToBoolean(WPSResponse[4] & 0x04),
PWP = Convert.ToBoolean(WPSResponse[4] & 0x02),
SWPP = Convert.ToBoolean(WPSResponse[4] & 0x01),
Reserved4 = WPSResponse[5],
Reserved5 = WPSResponse[6],
Reserved6 = WPSResponse[7]
};
return decoded;
}

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using DiscImageChef.Console;
namespace DiscImageChef.Devices
@@ -229,10 +228,9 @@ namespace DiscImageChef.Devices
if(sense || Error) return sense;
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
selected = BigEndianBitConverter.ToUInt16(buf, 4);
max = BigEndianBitConverter.ToUInt16(buf, 6);
last = BigEndianBitConverter.ToUInt16(buf, 8);
selected = BigEndianBitConverter.ToUInt16(buf, 4);
max = BigEndianBitConverter.ToUInt16(buf, 6);
last = BigEndianBitConverter.ToUInt16(buf, 8);
return false;
}
@@ -268,9 +266,8 @@ namespace DiscImageChef.Devices
if(sense || Error) return sense;
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
enabled = buf[2] != 0;
speed = BigEndianBitConverter.ToUInt16(buf, 4);
enabled = buf[2] != 0;
speed = BigEndianBitConverter.ToUInt16(buf, 4);
return false;
}

View File

@@ -553,8 +553,7 @@ namespace DiscImageChef.DiscImages
}
}
fullToc = tocMs.ToArray();
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
fullToc = tocMs.ToArray();
byte[] fullTocSize = BigEndianBitConverter.GetBytes((short)(fullToc.Length - 2));
fullToc[0] = fullTocSize[0];
fullToc[1] = fullTocSize[1];
@@ -597,24 +596,28 @@ namespace DiscImageChef.DiscImages
throw new FeatureNotPresentImageException("Image does not contain BCA information.");
}
case MediaTagType.DVD_PFI:
{
if(pfi != null) return (byte[])pfi.Clone();
throw new FeatureNotPresentImageException("Image does not contain PFI.");
}
case MediaTagType.DVD_DMI:
{
if(dmi != null) return (byte[])dmi.Clone();
throw new FeatureNotPresentImageException("Image does not contain DMI.");
}
case MediaTagType.CD_FullTOC:
{
if(fullToc != null) return (byte[])fullToc.Clone();
throw new FeatureNotPresentImageException("Image does not contain TOC information.");
}
default:
throw new FeatureSupportedButNotImplementedImageException("Feature not supported by image format");
}
@@ -684,6 +687,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 288;
break;
}
case AlcoholTrackMode.Mode2:
{
sectorOffset = 16;
@@ -691,6 +695,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 0;
break;
}
case AlcoholTrackMode.Mode2F1:
case AlcoholTrackMode.Mode2F1Alt:
{
@@ -699,6 +704,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 280;
break;
}
case AlcoholTrackMode.Mode2F2:
case AlcoholTrackMode.Mode2F2Alt:
{
@@ -707,6 +713,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 4;
break;
}
case AlcoholTrackMode.Audio:
{
sectorOffset = 0;
@@ -714,6 +721,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 0;
break;
}
case AlcoholTrackMode.DVD:
{
sectorOffset = 0;
@@ -721,6 +729,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 0;
break;
}
default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type");
}
@@ -798,6 +807,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 2340;
break;
}
case SectorTagType.CdSectorHeader:
{
sectorOffset = 12;
@@ -805,6 +815,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 2336;
break;
}
case SectorTagType.CdSectorSubHeader:
throw new ArgumentException("Unsupported tag requested for this track", nameof(tag));
case SectorTagType.CdSectorEcc:
@@ -814,6 +825,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 0;
break;
}
case SectorTagType.CdSectorEccP:
{
sectorOffset = 2076;
@@ -821,6 +833,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 104;
break;
}
case SectorTagType.CdSectorEccQ:
{
sectorOffset = 2248;
@@ -828,6 +841,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 0;
break;
}
case SectorTagType.CdSectorEdc:
{
sectorOffset = 2064;
@@ -835,6 +849,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 284;
break;
}
case SectorTagType.CdSectorSubchannel:
{
switch(alcTrack.subMode)
@@ -850,6 +865,7 @@ namespace DiscImageChef.DiscImages
break;
}
default: throw new ArgumentException("Unsupported tag requested", nameof(tag));
}
@@ -871,6 +887,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 2328;
break;
}
case SectorTagType.CdSectorEdc:
{
sectorOffset = 2332;
@@ -878,6 +895,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 0;
break;
}
case SectorTagType.CdSectorSubchannel:
{
switch(alcTrack.subMode)
@@ -893,11 +911,13 @@ namespace DiscImageChef.DiscImages
break;
}
default: throw new ArgumentException("Unsupported tag requested", nameof(tag));
}
break;
}
case AlcoholTrackMode.Mode2F1:
case AlcoholTrackMode.Mode2F1Alt:
switch(tag)
@@ -909,6 +929,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 2340;
break;
}
case SectorTagType.CdSectorHeader:
{
sectorOffset = 12;
@@ -916,6 +937,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 2336;
break;
}
case SectorTagType.CdSectorSubHeader:
{
sectorOffset = 16;
@@ -923,6 +945,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 2328;
break;
}
case SectorTagType.CdSectorEcc:
{
sectorOffset = 2076;
@@ -930,6 +953,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 0;
break;
}
case SectorTagType.CdSectorEccP:
{
sectorOffset = 2076;
@@ -937,6 +961,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 104;
break;
}
case SectorTagType.CdSectorEccQ:
{
sectorOffset = 2248;
@@ -944,6 +969,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 0;
break;
}
case SectorTagType.CdSectorEdc:
{
sectorOffset = 2072;
@@ -951,6 +977,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 276;
break;
}
case SectorTagType.CdSectorSubchannel:
{
switch(alcTrack.subMode)
@@ -966,6 +993,7 @@ namespace DiscImageChef.DiscImages
break;
}
default: throw new ArgumentException("Unsupported tag requested", nameof(tag));
}
@@ -981,6 +1009,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 2340;
break;
}
case SectorTagType.CdSectorHeader:
{
sectorOffset = 12;
@@ -988,6 +1017,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 2336;
break;
}
case SectorTagType.CdSectorSubHeader:
{
sectorOffset = 16;
@@ -995,6 +1025,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 2328;
break;
}
case SectorTagType.CdSectorEdc:
{
sectorOffset = 2348;
@@ -1002,6 +1033,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 0;
break;
}
case SectorTagType.CdSectorSubchannel:
{
switch(alcTrack.subMode)
@@ -1017,6 +1049,7 @@ namespace DiscImageChef.DiscImages
break;
}
default: throw new ArgumentException("Unsupported tag requested", nameof(tag));
}
@@ -1040,11 +1073,13 @@ namespace DiscImageChef.DiscImages
break;
}
default: throw new ArgumentException("Unsupported tag requested", nameof(tag));
}
break;
}
default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type");
}
@@ -1129,6 +1164,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 0;
break;
}
default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type");
}

View File

@@ -49,7 +49,6 @@ namespace DiscImageChef.DiscImages
stream.Read(header, 0, 0x17);
BluHeader tmpHdr = new BluHeader {DeviceName = new byte[0x0D]};
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
Array.Copy(header, 0, tmpHdr.DeviceName, 0, 0x0D);
tmpHdr.DeviceType = BigEndianBitConverter.ToUInt32(header, 0x0C) & 0x00FFFFFF;

View File

@@ -47,8 +47,7 @@ namespace DiscImageChef.DiscImages
Stream stream = imageFilter.GetDataForkStream();
stream.Seek(0, SeekOrigin.Begin);
imageHeader = new BluHeader {DeviceName = new byte[0x0D]};
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
imageHeader = new BluHeader {DeviceName = new byte[0x0D]};
byte[] header = new byte[0x17];
stream.Read(header, 0, 0x17);

View File

@@ -314,7 +314,6 @@ namespace DiscImageChef.DiscImages
return false;
}
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
byte[] markerTag = Encoding.UTF8.GetBytes("DiscImageChef " + Version.GetVersion());
byte[] driveName;
byte[] driveType = new byte[3];

View File

@@ -141,6 +141,7 @@ namespace DiscImageChef.DiscImages
break;
}
case 2:
{
ChdHeaderV2 hdrV2 = Marshal.ByteArrayToStructureBigEndian<ChdHeaderV2>(buffer);
@@ -211,6 +212,7 @@ namespace DiscImageChef.DiscImages
break;
}
case 3:
{
ChdHeaderV3 hdrV3 = Marshal.ByteArrayToStructureBigEndian<ChdHeaderV3>(buffer);
@@ -260,6 +262,7 @@ namespace DiscImageChef.DiscImages
break;
}
case 4:
{
ChdHeaderV4 hdrV4 = Marshal.ByteArrayToStructureBigEndian<ChdHeaderV4>(buffer);
@@ -305,6 +308,7 @@ namespace DiscImageChef.DiscImages
break;
}
case 5:
{
ChdHeaderV5 hdrV5 = Marshal.ByteArrayToStructureBigEndian<ChdHeaderV5>(buffer);
@@ -389,6 +393,7 @@ namespace DiscImageChef.DiscImages
break;
}
default: throw new ImageNotSupportedException($"Unsupported CHD version {version}");
}
@@ -450,11 +455,7 @@ namespace DiscImageChef.DiscImages
uint chdTracksNumber = BigEndianBitConverter.ToUInt32(meta, 0);
// Byteswapped
if(chdTracksNumber > 99)
{
BigEndianBitConverter.IsLittleEndian = !BitConverter.IsLittleEndian;
chdTracksNumber = BigEndianBitConverter.ToUInt32(meta, 0);
}
if(chdTracksNumber > 99) chdTracksNumber = BigEndianBitConverter.ToUInt32(meta, 0);
currentSector = 0;
@@ -546,8 +547,7 @@ namespace DiscImageChef.DiscImages
tracks.Add(dicTrack.TrackSequence, dicTrack);
}
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
isCdrom = true;
isCdrom = true;
break;
// "CHTR"
@@ -1111,6 +1111,7 @@ namespace DiscImageChef.DiscImages
break;
}
case TrackType.CdMode2Form2:
{
if(track.TrackRawBytesPerSector == 2352)
@@ -1126,6 +1127,7 @@ namespace DiscImageChef.DiscImages
break;
}
case TrackType.CdMode2Formless:
{
if(track.TrackRawBytesPerSector == 2352)
@@ -1141,12 +1143,14 @@ namespace DiscImageChef.DiscImages
break;
}
case TrackType.Audio:
{
sectorOffset = 0;
sectorSize = 2352;
break;
}
default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type");
}
@@ -1225,12 +1229,14 @@ namespace DiscImageChef.DiscImages
sectorSize = 12;
break;
}
case SectorTagType.CdSectorHeader:
{
sectorOffset = 12;
sectorSize = 4;
break;
}
case SectorTagType.CdSectorSubHeader:
throw new ArgumentException("Unsupported tag requested for this track",
nameof(tag));
@@ -1240,30 +1246,35 @@ namespace DiscImageChef.DiscImages
sectorSize = 276;
break;
}
case SectorTagType.CdSectorEccP:
{
sectorOffset = 2076;
sectorSize = 172;
break;
}
case SectorTagType.CdSectorEccQ:
{
sectorOffset = 2248;
sectorSize = 104;
break;
}
case SectorTagType.CdSectorEdc:
{
sectorOffset = 2064;
sectorSize = 4;
break;
}
default: throw new ArgumentException("Unsupported tag requested", nameof(tag));
}
else throw new FeatureNotPresentImageException("Requested sector does not contain tags");
break;
}
case TrackType.CdMode2Form2:
{
if(track.TrackRawBytesPerSector == 2352)
@@ -1275,24 +1286,28 @@ namespace DiscImageChef.DiscImages
sectorSize = 12;
break;
}
case SectorTagType.CdSectorHeader:
{
sectorOffset = 12;
sectorSize = 4;
break;
}
case SectorTagType.CdSectorSubHeader:
{
sectorOffset = 16;
sectorSize = 8;
break;
}
case SectorTagType.CdSectorEdc:
{
sectorOffset = 2348;
sectorSize = 4;
break;
}
default: throw new ArgumentException("Unsupported tag requested", nameof(tag));
}
else
@@ -1312,17 +1327,20 @@ namespace DiscImageChef.DiscImages
sectorSize = 8;
break;
}
case SectorTagType.CdSectorEdc:
{
sectorOffset = 2332;
sectorSize = 4;
break;
}
default: throw new ArgumentException("Unsupported tag requested", nameof(tag));
}
break;
}
case TrackType.CdMode2Formless:
{
if(track.TrackRawBytesPerSector == 2352)
@@ -1341,18 +1359,21 @@ namespace DiscImageChef.DiscImages
sectorSize = 8;
break;
}
case SectorTagType.CdSectorEdc:
{
sectorOffset = 2332;
sectorSize = 4;
break;
}
default: throw new ArgumentException("Unsupported tag requested", nameof(tag));
}
else throw new FeatureNotPresentImageException("Requested sector does not contain tags");
break;
}
case TrackType.Audio:
throw new FeatureNotPresentImageException("Requested sector does not contain tags");
default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type");

View File

@@ -103,8 +103,6 @@ namespace DiscImageChef.DiscImages
bLength = new short[BLOCK_ARRAY_LEN_HIGH];
else bLength = new short[BLOCK_ARRAY_LEN_LOW];
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
for(int i = 0; i < bLength.Length; i++)
{
byte[] tmpShort = new byte[2];

View File

@@ -55,8 +55,6 @@ namespace DiscImageChef.DiscImages
Array.Copy(buffer, 0, pString, 0, 64);
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
tmpHeader.DiskName = StringHandlers.PascalToString(pString, Encoding.GetEncoding("macintosh"));
tmpHeader.DataSize = BigEndianBitConverter.ToUInt32(buffer, 0x40);
tmpHeader.TagSize = BigEndianBitConverter.ToUInt32(buffer, 0x44);

View File

@@ -58,8 +58,7 @@ namespace DiscImageChef.DiscImages
// Incorrect pascal string length, not DC42
if(buffer[0] > 63) return false;
header = new Dc42Header();
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
header = new Dc42Header();
Array.Copy(buffer, 0, pString, 0, 64);
header.DiskName = StringHandlers.PascalToString(pString, Encoding.GetEncoding("macintosh"));

View File

@@ -102,8 +102,6 @@ namespace DiscImageChef.DiscImages
// Block chunks and headers
chunks = new Dictionary<ulong, BlockChunk>();
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
for(int i = 0; i < header.chunks; i++)
{
// Obsolete read-only NDIF only prepended the header and then put the image without any kind of block references.
@@ -318,6 +316,7 @@ namespace DiscImageChef.DiscImages
Array.Copy(tmpBuffer, 0, buffer, 0, realSize);
break;
}
case CHUNK_TYPE_RLE:
{
byte[] tmpBuffer = new byte[buffersize];
@@ -336,6 +335,7 @@ namespace DiscImageChef.DiscImages
Array.Copy(tmpBuffer, 0, buffer, 0, realSize);
break;
}
default:
throw new
ImageNotSupportedException($"Unsupported chunk type 0x{currentChunk.type:X8} found");

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.IO;
using DiscImageChef.CommonTypes.Interfaces;
using DiscImageChef.Console;
@@ -41,9 +40,7 @@ namespace DiscImageChef.DiscImages
{
public bool Identify(IFilter imageFilter)
{
imageStream = imageFilter.GetDataForkStream();
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
imageStream = imageFilter.GetDataForkStream();
NeroV1Footer footerV1 = new NeroV1Footer();
NeroV2Footer footerV2 = new NeroV2Footer();

View File

@@ -50,9 +50,7 @@ namespace DiscImageChef.DiscImages
{
try
{
imageStream = imageFilter.GetDataForkStream();
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
imageStream = imageFilter.GetDataForkStream();
NeroV1Footer footerV1 = new NeroV1Footer();
NeroV2Footer footerV2 = new NeroV2Footer();
@@ -158,6 +156,7 @@ namespace DiscImageChef.DiscImages
break;
}
case NERO_CUE_V2:
{
DicConsole.DebugWriteLine("Nero plugin", "Found \"CUEX\" chunk, parsing {0} bytes",
@@ -196,6 +195,7 @@ namespace DiscImageChef.DiscImages
break;
}
case NERO_DAO_V1:
{
DicConsole.DebugWriteLine("Nero plugin", "Found \"DAOI\" chunk, parsing {0} bytes",
@@ -290,6 +290,7 @@ namespace DiscImageChef.DiscImages
break;
}
case NERO_DAO_V2:
{
DicConsole.DebugWriteLine("Nero plugin", "Found \"DAOX\" chunk, parsing {0} bytes",
@@ -385,6 +386,7 @@ namespace DiscImageChef.DiscImages
break;
}
case NERO_CDTEXT:
{
DicConsole.DebugWriteLine("Nero plugin", "Found \"CDTX\" chunk, parsing {0} bytes",
@@ -428,6 +430,7 @@ namespace DiscImageChef.DiscImages
break;
}
case NERO_TAO_V1:
{
DicConsole.DebugWriteLine("Nero plugin", "Found \"ETNF\" chunk, parsing {0} bytes",
@@ -491,6 +494,7 @@ namespace DiscImageChef.DiscImages
break;
}
case NERO_TAO_V2:
{
DicConsole.DebugWriteLine("Nero plugin", "Found \"ETN2\" chunk, parsing {0} bytes",
@@ -557,6 +561,7 @@ namespace DiscImageChef.DiscImages
break;
}
case NERO_SESSION:
{
DicConsole.DebugWriteLine("Nero plugin", "Found \"SINF\" chunk, parsing {0} bytes",
@@ -573,6 +578,7 @@ namespace DiscImageChef.DiscImages
currentsession++;
break;
}
case NERO_DISC_TYPE:
{
DicConsole.DebugWriteLine("Nero plugin", "Found \"MTYP\" chunk, parsing {0} bytes",
@@ -591,6 +597,7 @@ namespace DiscImageChef.DiscImages
break;
}
case NERO_DISC_INFO:
{
DicConsole.DebugWriteLine("Nero plugin", "Found \"DINF\" chunk, parsing {0} bytes",
@@ -606,6 +613,7 @@ namespace DiscImageChef.DiscImages
break;
}
case NERO_RELOCATION:
{
DicConsole.DebugWriteLine("Nero plugin", "Found \"RELO\" chunk, parsing {0} bytes",
@@ -621,6 +629,7 @@ namespace DiscImageChef.DiscImages
break;
}
case NERO_TOC:
{
DicConsole.DebugWriteLine("Nero plugin", "Found \"TOCT\" chunk, parsing {0} bytes",
@@ -636,12 +645,14 @@ namespace DiscImageChef.DiscImages
break;
}
case NERO_END:
{
DicConsole.DebugWriteLine("Nero plugin", "Found \"END!\" chunk, finishing parse");
parsing = false;
break;
}
default:
{
DicConsole.DebugWriteLine("Nero plugin", "Unknown chunk ID \"{0}\", skipping...",
@@ -980,6 +991,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 0;
break;
}
case DaoMode.DataM2F2:
{
sectorOffset = 8;
@@ -987,6 +999,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 4;
break;
}
case DaoMode.Audio:
{
sectorOffset = 0;
@@ -994,6 +1007,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 0;
break;
}
case DaoMode.DataRaw:
{
sectorOffset = 16;
@@ -1001,6 +1015,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 288;
break;
}
case DaoMode.DataM2Raw:
{
sectorOffset = 16;
@@ -1008,6 +1023,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 0;
break;
}
// TODO: Supposing Nero suffixes the subchannel to the channel
case DaoMode.DataRawSub:
{
@@ -1016,6 +1032,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 288 + 96;
break;
}
case DaoMode.DataM2RawSub:
{
sectorOffset = 16;
@@ -1023,6 +1040,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 96;
break;
}
case DaoMode.AudioSub:
{
sectorOffset = 0;
@@ -1030,6 +1048,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 96;
break;
}
default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type");
}
@@ -1085,6 +1104,7 @@ namespace DiscImageChef.DiscImages
return flags;
}
case SectorTagType.CdTrackIsrc: return dicTrack.Isrc;
case SectorTagType.CdTrackText:
throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
@@ -1113,6 +1133,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 2328;
break;
}
case SectorTagType.CdSectorEdc:
{
sectorOffset = 2332;
@@ -1120,11 +1141,13 @@ namespace DiscImageChef.DiscImages
sectorSkip = 0;
break;
}
default: throw new ArgumentException("Unsupported tag requested", nameof(tag));
}
break;
}
case DaoMode.Audio: throw new ArgumentException("There are no tags on audio tracks", nameof(tag));
case DaoMode.DataRaw:
{
@@ -1137,6 +1160,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 2340;
break;
}
case SectorTagType.CdSectorHeader:
{
sectorOffset = 12;
@@ -1144,6 +1168,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 2336;
break;
}
case SectorTagType.CdSectorSubchannel:
case SectorTagType.CdSectorSubHeader:
throw new ArgumentException("Unsupported tag requested for this track", nameof(tag));
@@ -1154,6 +1179,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 0;
break;
}
case SectorTagType.CdSectorEccP:
{
sectorOffset = 2076;
@@ -1161,6 +1187,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 104;
break;
}
case SectorTagType.CdSectorEccQ:
{
sectorOffset = 2248;
@@ -1168,6 +1195,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 0;
break;
}
case SectorTagType.CdSectorEdc:
{
sectorOffset = 2064;
@@ -1175,11 +1203,13 @@ namespace DiscImageChef.DiscImages
sectorSkip = 284;
break;
}
default: throw new ArgumentException("Unsupported tag requested", nameof(tag));
}
break;
}
// TODO
case DaoMode.DataM2RawSub:
throw new FeatureSupportedButNotImplementedImageException("Feature not yet implemented");
@@ -1194,6 +1224,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 2340 + 96;
break;
}
case SectorTagType.CdSectorHeader:
{
sectorOffset = 12;
@@ -1201,6 +1232,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 2336 + 96;
break;
}
case SectorTagType.CdSectorSubchannel:
{
sectorOffset = 2352;
@@ -1208,6 +1240,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 0;
break;
}
case SectorTagType.CdSectorSubHeader:
throw new ArgumentException("Unsupported tag requested for this track", nameof(tag));
case SectorTagType.CdSectorEcc:
@@ -1217,6 +1250,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 0 + 96;
break;
}
case SectorTagType.CdSectorEccP:
{
sectorOffset = 2076;
@@ -1224,6 +1258,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 104 + 96;
break;
}
case SectorTagType.CdSectorEccQ:
{
sectorOffset = 2248;
@@ -1231,6 +1266,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 0 + 96;
break;
}
case SectorTagType.CdSectorEdc:
{
sectorOffset = 2064;
@@ -1238,11 +1274,13 @@ namespace DiscImageChef.DiscImages
sectorSkip = 284 + 96;
break;
}
default: throw new ArgumentException("Unsupported tag requested", nameof(tag));
}
break;
}
case DaoMode.AudioSub:
{
if(tag != SectorTagType.CdSectorSubchannel)
@@ -1253,6 +1291,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 0;
break;
}
default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type");
}
@@ -1316,6 +1355,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 0;
break;
}
case DaoMode.DataM2F2:
{
sectorOffset = 0;
@@ -1323,6 +1363,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 0;
break;
}
case DaoMode.DataRaw:
case DaoMode.DataM2Raw:
case DaoMode.Audio:
@@ -1332,6 +1373,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 0;
break;
}
case DaoMode.DataRawSub:
case DaoMode.DataM2RawSub:
case DaoMode.AudioSub:
@@ -1341,6 +1383,7 @@ namespace DiscImageChef.DiscImages
sectorSkip = 0;
break;
}
default: throw new FeatureSupportedButNotImplementedImageException("Unsupported track type");
}

View File

@@ -104,8 +104,6 @@ namespace DiscImageChef.DiscImages
DicConsole.DebugWriteLine("QCOW plugin", "qHdr.l2Size = {0}", l2Size);
DicConsole.DebugWriteLine("QCOW plugin", "qHdr.sectors = {0}", imageInfo.Sectors);
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
byte[] l1TableB = new byte[l1Size * 8];
stream.Seek((long)qHdr.l1_table_offset, SeekOrigin.Begin);
stream.Read(l1TableB, 0, (int)l1Size * 8);

View File

@@ -176,8 +176,6 @@ namespace DiscImageChef.DiscImages
writingStream.Seek((long)(l1Table[l1Off] + l2Off * 8), SeekOrigin.Begin);
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
byte[] entry = new byte[8];
writingStream.Read(entry, 0, 8);
ulong offset = BigEndianBitConverter.ToUInt64(entry, 0);
@@ -257,7 +255,6 @@ namespace DiscImageChef.DiscImages
qHdr.mtime = (uint)(DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds;
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
writingStream.Seek(0, SeekOrigin.Begin);
writingStream.Write(BigEndianBitConverter.GetBytes(qHdr.magic), 0, 4);
writingStream.Write(BigEndianBitConverter.GetBytes(qHdr.version), 0, 4);

View File

@@ -112,8 +112,6 @@ namespace DiscImageChef.DiscImages
DicConsole.DebugWriteLine("QCOW plugin", "qHdr.l2Size = {0}", l2Size);
DicConsole.DebugWriteLine("QCOW plugin", "qHdr.sectors = {0}", imageInfo.Sectors);
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
byte[] l1TableB = new byte[qHdr.l1_size * 8];
stream.Seek((long)qHdr.l1_table_offset, SeekOrigin.Begin);
stream.Read(l1TableB, 0, (int)qHdr.l1_size * 8);

View File

@@ -192,8 +192,6 @@ namespace DiscImageChef.DiscImages
writingStream.Seek((long)(l1Table[l1Off] + l2Off * 8), SeekOrigin.Begin);
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
byte[] entry = new byte[8];
writingStream.Read(entry, 0, 8);
ulong offset = BigEndianBitConverter.ToUInt64(entry, 0);
@@ -289,7 +287,6 @@ namespace DiscImageChef.DiscImages
return false;
}
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
writingStream.Seek(0, SeekOrigin.Begin);
writingStream.Write(BigEndianBitConverter.GetBytes(qHdr.magic), 0, 4);
writingStream.Write(BigEndianBitConverter.GetBytes(qHdr.version), 0, 4);

View File

@@ -233,7 +233,6 @@ namespace DiscImageChef.DiscImages
chunks = (uint)chunks.Count
};
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
MemoryStream chunkMs = new MemoryStream();
chunkMs.Write(BigEndianBitConverter.GetBytes(bHdr.signature), 0, 4);
chunkMs.Write(BigEndianBitConverter.GetBytes(bHdr.version), 0, 4);

View File

@@ -30,7 +30,6 @@
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.IO;
using DiscImageChef.CommonTypes.Interfaces;
@@ -52,7 +51,6 @@ namespace DiscImageChef.DiscImages
imageStream.Seek(0, SeekOrigin.Begin);
imageStream.Read(headerCookieBytes, 0, 8);
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
ulong headerCookie = BigEndianBitConverter.ToUInt64(headerCookieBytes, 0);
ulong footerCookie = BigEndianBitConverter.ToUInt64(footerCookieBytes, 0);

View File

@@ -67,8 +67,6 @@ namespace DiscImageChef.DiscImages
imageStream.Read(footer, 0, 511);
}
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
uint headerChecksum = BigEndianBitConverter.ToUInt32(header, 0x40);
uint footerChecksum = BigEndianBitConverter.ToUInt32(footer, 0x40);
ulong headerCookie = BigEndianBitConverter.ToUInt64(header, 0);
@@ -178,6 +176,7 @@ namespace DiscImageChef.DiscImages
break;
}
case CREATOR_VIRTUAL_BOX:
{
imageInfo.ApplicationVersion =
@@ -200,6 +199,7 @@ namespace DiscImageChef.DiscImages
break;
}
case CREATOR_VIRTUAL_SERVER:
{
imageInfo.Application = "Microsoft Virtual Server";
@@ -215,6 +215,7 @@ namespace DiscImageChef.DiscImages
break;
}
case CREATOR_VIRTUAL_PC:
{
switch(thisFooter.CreatorHostOs)
@@ -263,6 +264,7 @@ namespace DiscImageChef.DiscImages
break;
}
case CREATOR_DISCIMAGECHEF:
{
imageInfo.Application = "DiscImageChef";
@@ -434,6 +436,7 @@ namespace DiscImageChef.DiscImages
// Nothing to do here, really.
return true;
}
case TYPE_DIFFERENCING:
{
locatorEntriesData = new byte[8][];
@@ -553,6 +556,7 @@ namespace DiscImageChef.DiscImages
return true;
}
case TYPE_DEPRECATED1:
case TYPE_DEPRECATED2:
case TYPE_DEPRECATED3:
@@ -560,6 +564,7 @@ namespace DiscImageChef.DiscImages
throw new
ImageNotSupportedException("(VirtualPC plugin): Deprecated image type found. Please submit a bug with an example image.");
}
default:
{
throw new
@@ -631,6 +636,7 @@ namespace DiscImageChef.DiscImages
// Read sector from parent image
}
default: return ReadSectors(sectorAddress, 1);
}
}
@@ -649,6 +655,7 @@ namespace DiscImageChef.DiscImages
return data;
}
// Contrary to Microsoft's specifications that tell us to check the bitmap
// and in case of unused sector just return zeros, as blocks are allocated
// as a whole, this would waste time and miss cache, so we read any sector
@@ -699,6 +706,7 @@ namespace DiscImageChef.DiscImages
Array.Copy(suffix, 0, data, prefix.Length, suffix.Length);
return data;
}
case TYPE_DIFFERENCING:
{
// As on differencing images, each independent sector can be read from child or parent
@@ -712,6 +720,7 @@ namespace DiscImageChef.DiscImages
return fullData;
}
case TYPE_DEPRECATED1:
case TYPE_DEPRECATED2:
case TYPE_DEPRECATED3:
@@ -719,6 +728,7 @@ namespace DiscImageChef.DiscImages
throw new
ImageNotSupportedException("(VirtualPC plugin): Deprecated image type found. Please submit a bug with an example image.");
}
default:
{
throw new

View File

@@ -203,7 +203,6 @@ namespace DiscImageChef.DiscImages
};
footer.Offset = footer.DiskType == TYPE_FIXED ? ulong.MaxValue : 512;
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
byte[] footerBytes = new byte[512];
Array.Copy(BigEndianBitConverter.GetBytes(footer.Cookie), 0, footerBytes, 0x00, 8);
Array.Copy(BigEndianBitConverter.GetBytes(footer.Features), 0, footerBytes, 0x08, 4);

View File

@@ -61,8 +61,6 @@ namespace DiscImageChef.Filesystems
{
if(partition.Start >= partition.End) return false;
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
// Boot block is unless defined otherwise, 2 blocks
// Funny, you may need boot block to find root block if it's not in standard place just to know size of
// block size and then read the whole boot block.
@@ -159,10 +157,8 @@ namespace DiscImageChef.Filesystems
{
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-1");
StringBuilder sbInformation = new StringBuilder();
XmlFsType = new FileSystemType();
information = null;
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
XmlFsType = new FileSystemType();
information = null;
byte[] bootBlockSectors = imagePlugin.ReadSectors(0 + partition.Start, 2);
BootBlock bootBlk = Marshal.ByteArrayToStructureBigEndian<BootBlock>(bootBlockSectors);
@@ -341,8 +337,7 @@ namespace DiscImageChef.Filesystems
Array.Copy(block, 0, tmp, 0, 24);
Array.Copy(block, block.Length - 200, tmp, 28, 200);
RootBlock root = Marshal.ByteArrayToStructureBigEndian<RootBlock>(tmp);
root.hashTable = new uint[(block.Length - 224) / 4];
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
root.hashTable = new uint[(block.Length - 224) / 4];
for(int i = 0; i < root.hashTable.Length; i++)
root.hashTable[i] = BigEndianBitConverter.ToUInt32(block, 24 + i * 4);

View File

@@ -49,8 +49,6 @@ namespace DiscImageChef.Filesystems.AppleMFS
byte[] mdbSector = imagePlugin.ReadSector(2 + partition.Start);
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
ushort drSigWord = BigEndianBitConverter.ToUInt16(mdbSector, 0x000);
return drSigWord == MFS_MAGIC;
@@ -72,8 +70,6 @@ namespace DiscImageChef.Filesystems.AppleMFS
byte[] mdbSector = imagePlugin.ReadSector(2 + partition.Start);
byte[] bbSector = imagePlugin.ReadSector(0 + partition.Start);
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
mdb.drSigWord = BigEndianBitConverter.ToUInt16(mdbSector, 0x000);
if(mdb.drSigWord != MFS_MAGIC) return;

View File

@@ -57,8 +57,6 @@ namespace DiscImageChef.Filesystems.AppleMFS
mdbBlocks = device.ReadSector(2 + partitionStart);
bootBlocks = device.ReadSector(0 + partitionStart);
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
volMDB.drSigWord = BigEndianBitConverter.ToUInt16(mdbBlocks, 0x000);
if(volMDB.drSigWord != MFS_MAGIC) return Errno.InvalidArgument;

View File

@@ -514,8 +514,7 @@ namespace DiscImageChef.Filesystems.FAT
// Some fields could overflow fake BPB, those will be handled below
case BpbKind.Atari:
{
ushort sum = 0;
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
ushort sum = 0;
for(int i = 0; i < bpbSector.Length; i += 2) sum += BigEndianBitConverter.ToUInt16(bpbSector, i);
// TODO: Check this

View File

@@ -216,8 +216,7 @@ namespace DiscImageChef.Filesystems.FAT
// Some fields could overflow fake BPB, those will be handled below
case BpbKind.Atari:
{
ushort sum = 0;
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
ushort sum = 0;
for(int i = 0; i < bpbSector.Length; i += 2) sum += BigEndianBitConverter.ToUInt16(bpbSector, i);
// TODO: Check this

View File

@@ -162,6 +162,7 @@ namespace DiscImageChef.Filesystems.ISO9660
break;
}
case 1:
{
if(highSierra)
@@ -173,6 +174,7 @@ namespace DiscImageChef.Filesystems.ISO9660
break;
}
case 2:
{
PrimaryVolumeDescriptor svd =
@@ -181,8 +183,7 @@ namespace DiscImageChef.Filesystems.ISO9660
// Check if this is Joliet
if(svd.escape_sequences[0] == '%' && svd.escape_sequences[1] == '/')
if(svd.escape_sequences[2] == '@' || svd.escape_sequences[2] == 'C' ||
svd.escape_sequences[2] == 'E')
jolietvd = svd;
svd.escape_sequences[2] == 'E') jolietvd = svd;
else
DicConsole.WriteLine("ISO9660 plugin", "Found unknown supplementary volume descriptor");
@@ -248,8 +249,6 @@ namespace DiscImageChef.Filesystems.ISO9660
if(rootLocation + rootSize < imagePlugin.Info.Sectors)
rootDir = imagePlugin.ReadSectors(rootLocation, rootSize);
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
// Walk thru root directory to see system area extensions in use
while(rootOff + Marshal.SizeOf<DirectoryRecord>() < rootDir.Length && !cdi)
{

View File

@@ -53,9 +53,6 @@ namespace DiscImageChef.Filesystems.LisaFS
if(!imagePlugin.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag)) return false;
// LisaOS is big-endian
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
// Minimal LisaOS disk is 3.5" single sided double density, 800 sectors
if(imagePlugin.Info.Sectors < 800) return false;
@@ -134,9 +131,6 @@ namespace DiscImageChef.Filesystems.LisaFS
if(!imagePlugin.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag)) return;
// LisaOS is big-endian
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
// Minimal LisaOS disk is 3.5" single sided double density, 800 sectors
if(imagePlugin.Info.Sectors < 800) return;

View File

@@ -67,9 +67,6 @@ namespace DiscImageChef.Filesystems.LisaFS
return Errno.InOutError;
}
// LisaOS is big-endian
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
// Minimal LisaOS disk is 3.5" single sided double density, 800 sectors
if(device.Info.Sectors < 800)
{

View File

@@ -53,8 +53,6 @@ namespace DiscImageChef.Filesystems
if(imagePlugin.Info.Sectors * imagePlugin.Info.SectorSize < 0x50000) return false;
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
byte[] header = imagePlugin.ReadSectors(0, 0x50000 / imagePlugin.Info.SectorSize);
uint magicGc = BigEndianBitConverter.ToUInt32(header, 0x1C);
@@ -72,7 +70,6 @@ namespace DiscImageChef.Filesystems
XmlFsType = new FileSystemType();
NintendoFields fields = new NintendoFields();
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
byte[] header = imagePlugin.ReadSectors(0, 0x50000 / imagePlugin.Info.SectorSize);

View File

@@ -73,8 +73,6 @@ namespace DiscImageChef.Filesystems
{
if(partition.Length < 3) return false;
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
byte[] sector = imagePlugin.ReadSector(2 + partition.Start);
uint magic = BigEndianBitConverter.ToUInt32(sector, 0x00);

View File

@@ -57,8 +57,6 @@ namespace DiscImageChef.Filesystems
{
if(partition.Start >= partition.End) return false;
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
byte[] sector = imagePlugin.ReadSector(partition.Start);
uint magic = BigEndianBitConverter.ToUInt32(sector, 0x00);

View File

@@ -40,6 +40,7 @@ using Schemas;
namespace DiscImageChef.Filesystems
{
// TODO: Fix little endian
// Information from the Linux kernel
[SuppressMessage("ReSharper", "InconsistentNaming")]
public class SysVfs : IFilesystem
@@ -157,18 +158,16 @@ namespace DiscImageChef.Filesystems
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
information = "";
StringBuilder sb = new StringBuilder();
BigEndianBitConverter.IsLittleEndian =
true; // Start in little endian until we know what are we handling here
int start = 0;
bool xenix = false;
bool sysv = false;
bool sys7th = false;
bool coherent = false;
bool xenix3 = false;
byte[] sb_sector;
byte sb_size_in_sectors;
int offset = 0;
StringBuilder sb = new StringBuilder();
int start = 0;
bool xenix = false;
bool sysv = false;
bool sys7th = false;
bool coherent = false;
bool xenix3 = false;
byte[] sb_sector;
byte sb_size_in_sectors;
int offset = 0;
if(imagePlugin.Info.SectorSize <= 0x400
) // Check if underlying device sector size is smaller than SuperBlock size
@@ -192,7 +191,6 @@ namespace DiscImageChef.Filesystems
if(magic == XENIX_MAGIC || magic == SYSV_MAGIC)
{
BigEndianBitConverter.IsLittleEndian = true; // Little endian
if(magic == SYSV_MAGIC)
{
sysv = true;
@@ -206,7 +204,6 @@ namespace DiscImageChef.Filesystems
if(magic == XENIX_CIGAM || magic == SYSV_CIGAM)
{
BigEndianBitConverter.IsLittleEndian = false; // Big endian
if(magic == SYSV_CIGAM)
{
sysv = true;
@@ -222,17 +219,15 @@ namespace DiscImageChef.Filesystems
if(magic == XENIX_MAGIC)
{
BigEndianBitConverter.IsLittleEndian = true; // Little endian
xenix3 = true;
start = i;
xenix3 = true;
start = i;
break;
}
if(magic == XENIX_CIGAM)
{
BigEndianBitConverter.IsLittleEndian = false; // Big endian
xenix3 = true;
start = i;
xenix3 = true;
start = i;
break;
}
@@ -240,17 +235,15 @@ namespace DiscImageChef.Filesystems
if(magic == SYSV_MAGIC)
{
BigEndianBitConverter.IsLittleEndian = true; // Little endian
sysv = true;
start = i;
sysv = true;
start = i;
break;
}
if(magic == SYSV_CIGAM)
{
BigEndianBitConverter.IsLittleEndian = false; // Big endian
sysv = true;
start = i;
sysv = true;
start = i;
break;
}
@@ -263,9 +256,8 @@ namespace DiscImageChef.Filesystems
if(s_fname == COH_FNAME && s_fpack == COH_FPACK || s_fname == COH_XXXXX && s_fpack == COH_XXXXX ||
s_fname == COH_XXXXS && s_fpack == COH_XXXXN)
{
BigEndianBitConverter.IsLittleEndian = true; // Coherent is in PDP endianness, use helper for that
coherent = true;
start = i;
coherent = true;
start = i;
break;
}
@@ -294,9 +286,8 @@ namespace DiscImageChef.Filesystems
if(s_fsize * 1024 != (partition.End - partition.Start) * imagePlugin.Info.SectorSize &&
s_fsize * 512 != (partition.End - partition.Start) * imagePlugin.Info.SectorSize) continue;
sys7th = true;
BigEndianBitConverter.IsLittleEndian = true;
start = i;
sys7th = true;
start = i;
break;
}
@@ -673,8 +664,6 @@ namespace DiscImageChef.Filesystems
}
information = sb.ToString();
BigEndianBitConverter.IsLittleEndian = false; // Return to default (bigendian)
}
// Old XENIX use different offsets

View File

@@ -53,22 +53,24 @@ namespace DiscImageChef.Filesystems.UCSDPascal
// Blocks 0 and 1 are boot code
byte[] volBlock = imagePlugin.ReadSectors(multiplier * 2 + partition.Start, multiplier);
PascalVolumeEntry volEntry = new PascalVolumeEntry();
// On Apple II, it's little endian
BigEndianBitConverter.IsLittleEndian =
multiplier == 2 ? !BitConverter.IsLittleEndian : BitConverter.IsLittleEndian;
// TODO: Fix
/*BigEndianBitConverter.IsLittleEndian =
multiplier == 2 ? !BitConverter.IsLittleEndian : BitConverter.IsLittleEndian;*/
volEntry.FirstBlock = BigEndianBitConverter.ToInt16(volBlock, 0x00);
volEntry.LastBlock = BigEndianBitConverter.ToInt16(volBlock, 0x02);
volEntry.EntryType = (PascalFileKind)BigEndianBitConverter.ToInt16(volBlock, 0x04);
volEntry.VolumeName = new byte[8];
PascalVolumeEntry volEntry = new PascalVolumeEntry
{
FirstBlock = BigEndianBitConverter.ToInt16(volBlock, 0x00),
LastBlock = BigEndianBitConverter.ToInt16(volBlock, 0x02),
EntryType = (PascalFileKind)BigEndianBitConverter.ToInt16(volBlock, 0x04),
VolumeName = new byte[8],
Blocks = BigEndianBitConverter.ToInt16(volBlock, 0x0E),
Files = BigEndianBitConverter.ToInt16(volBlock, 0x10),
Dummy = BigEndianBitConverter.ToInt16(volBlock, 0x12),
LastBoot = BigEndianBitConverter.ToInt16(volBlock, 0x14),
Tail = BigEndianBitConverter.ToInt32(volBlock, 0x16)
};
Array.Copy(volBlock, 0x06, volEntry.VolumeName, 0, 8);
volEntry.Blocks = BigEndianBitConverter.ToInt16(volBlock, 0x0E);
volEntry.Files = BigEndianBitConverter.ToInt16(volBlock, 0x10);
volEntry.Dummy = BigEndianBitConverter.ToInt16(volBlock, 0x12);
volEntry.LastBoot = BigEndianBitConverter.ToInt16(volBlock, 0x14);
volEntry.Tail = BigEndianBitConverter.ToInt32(volBlock, 0x16);
DicConsole.DebugWriteLine("UCSD Pascal Plugin", "volEntry.firstBlock = {0}", volEntry.FirstBlock);
DicConsole.DebugWriteLine("UCSD Pascal Plugin", "volEntry.lastBlock = {0}", volEntry.LastBlock);
@@ -113,22 +115,25 @@ namespace DiscImageChef.Filesystems.UCSDPascal
// Blocks 0 and 1 are boot code
byte[] volBlock = imagePlugin.ReadSectors(multiplier * 2 + partition.Start, multiplier);
PascalVolumeEntry volEntry = new PascalVolumeEntry();
// On Apple //, it's little endian
BigEndianBitConverter.IsLittleEndian =
multiplier == 2 ? !BitConverter.IsLittleEndian : BitConverter.IsLittleEndian;
// TODO: Fix
//BigEndianBitConverter.IsLittleEndian =
// multiplier == 2 ? !BitConverter.IsLittleEndian : BitConverter.IsLittleEndian;
PascalVolumeEntry volEntry = new PascalVolumeEntry
{
FirstBlock = BigEndianBitConverter.ToInt16(volBlock, 0x00),
LastBlock = BigEndianBitConverter.ToInt16(volBlock, 0x02),
EntryType = (PascalFileKind)BigEndianBitConverter.ToInt16(volBlock, 0x04),
VolumeName = new byte[8],
Blocks = BigEndianBitConverter.ToInt16(volBlock, 0x0E),
Files = BigEndianBitConverter.ToInt16(volBlock, 0x10),
Dummy = BigEndianBitConverter.ToInt16(volBlock, 0x12),
LastBoot = BigEndianBitConverter.ToInt16(volBlock, 0x14),
Tail = BigEndianBitConverter.ToInt32(volBlock, 0x16)
};
volEntry.FirstBlock = BigEndianBitConverter.ToInt16(volBlock, 0x00);
volEntry.LastBlock = BigEndianBitConverter.ToInt16(volBlock, 0x02);
volEntry.EntryType = (PascalFileKind)BigEndianBitConverter.ToInt16(volBlock, 0x04);
volEntry.VolumeName = new byte[8];
Array.Copy(volBlock, 0x06, volEntry.VolumeName, 0, 8);
volEntry.Blocks = BigEndianBitConverter.ToInt16(volBlock, 0x0E);
volEntry.Files = BigEndianBitConverter.ToInt16(volBlock, 0x10);
volEntry.Dummy = BigEndianBitConverter.ToInt16(volBlock, 0x12);
volEntry.LastBoot = BigEndianBitConverter.ToInt16(volBlock, 0x14);
volEntry.Tail = BigEndianBitConverter.ToInt32(volBlock, 0x16);
// First block is always 0 (even is it's sector 2)
if(volEntry.FirstBlock != 0) return;

View File

@@ -59,8 +59,9 @@ namespace DiscImageChef.Filesystems.UCSDPascal
catalogBlocks = device.ReadSectors(multiplier * 2, multiplier);
// On Apple //, it's little endian
BigEndianBitConverter.IsLittleEndian =
multiplier == 2 ? !BitConverter.IsLittleEndian : BitConverter.IsLittleEndian;
// TODO: Fix
//BigEndianBitConverter.IsLittleEndian =
// multiplier == 2 ? !BitConverter.IsLittleEndian : BitConverter.IsLittleEndian;
mountedVolEntry.FirstBlock = BigEndianBitConverter.ToInt16(catalogBlocks, 0x00);
mountedVolEntry.LastBlock = BigEndianBitConverter.ToInt16(catalogBlocks, 0x02);

View File

@@ -169,8 +169,6 @@ namespace DiscImageChef.Filesystems
if(!xdr) return false;
BigEndianBitConverter.IsLittleEndian = littleEndian;
int offset = 8;
while(offset < nvlist.Length)
{
@@ -637,9 +635,9 @@ namespace DiscImageChef.Filesystems
struct ZIO_Empty
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 472)]
public byte[] empty;
public ulong magic;
public ZIO_Checksum checksum;
public readonly byte[] empty;
public readonly ulong magic;
public readonly ZIO_Checksum checksum;
}
/// <summary>
@@ -648,10 +646,10 @@ namespace DiscImageChef.Filesystems
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct NVS_Method
{
public byte encoding;
public byte endian;
public byte reserved1;
public byte reserved2;
public readonly byte encoding;
public readonly byte endian;
public readonly byte reserved1;
public readonly byte reserved2;
}
/// <summary>
@@ -660,9 +658,9 @@ namespace DiscImageChef.Filesystems
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct NVS_XDR_Header
{
public NVS_Method encodingAndEndian;
public uint version;
public uint flags;
public readonly NVS_Method encodingAndEndian;
public readonly uint version;
public readonly uint flags;
}
enum NVS_DataTypes : uint
@@ -732,7 +730,7 @@ namespace DiscImageChef.Filesystems
struct DVA
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public ulong[] word;
public readonly ulong[] word;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
@@ -742,40 +740,40 @@ namespace DiscImageChef.Filesystems
/// Data virtual address
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public DVA[] dataVirtualAddress;
public readonly DVA[] dataVirtualAddress;
/// <summary>
/// Block properties
/// </summary>
public ulong properties;
public readonly ulong properties;
/// <summary>
/// Reserved for future expansion
/// </summary>
public ulong[] padding;
public readonly ulong[] padding;
/// <summary>
/// TXG when block was allocated
/// </summary>
public ulong birthTxg;
public readonly ulong birthTxg;
/// <summary>
/// Transaction group at birth
/// </summary>
public ulong birth;
public readonly ulong birth;
/// <summary>
/// Fill count
/// </summary>
public ulong fill;
public ZIO_Checksum checksum;
public readonly ulong fill;
public readonly ZIO_Checksum checksum;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct ZFS_Uberblock
{
public ulong magic;
public ulong spaVersion;
public ulong lastTxg;
public ulong guidSum;
public ulong timestamp;
public SPA_BlockPointer mosPtr;
public ulong softwareVersion;
public readonly ulong magic;
public readonly ulong spaVersion;
public readonly ulong lastTxg;
public readonly ulong guidSum;
public readonly ulong timestamp;
public readonly SPA_BlockPointer mosPtr;
public readonly ulong softwareVersion;
}
}
}

View File

@@ -43,12 +43,6 @@ namespace DiscImageChef
/// </summary>
public static class BigEndianBitConverter
{
/// <summary>
/// Indicates the byte order ("endianess") in which data is stored in this computer
/// architecture.
/// </summary>
public static bool IsLittleEndian { get; set; }
/// <summary>
/// Converts the specified double-precision floating point number to a 64-bit signed integer.
/// </summary>
@@ -62,80 +56,70 @@ namespace DiscImageChef
/// </summary>
/// <param name="value">A Boolean value.</param>
/// <returns>An array of bytes with length 1.</returns>
public static byte[] GetBytes(bool value) =>
!IsLittleEndian ? BitConverter.GetBytes(value) : BitConverter.GetBytes(value).Reverse().ToArray();
public static byte[] GetBytes(bool value) => BitConverter.GetBytes(value).Reverse().ToArray();
/// <summary>
/// Returns the specified Unicode character value as an array of bytes.
/// </summary>
/// <param name="value">A character to convert.</param>
/// <returns>An array of bytes with length 2.</returns>
public static byte[] GetBytes(char value) =>
!IsLittleEndian ? BitConverter.GetBytes(value) : BitConverter.GetBytes(value).Reverse().ToArray();
public static byte[] GetBytes(char value) => BitConverter.GetBytes(value).Reverse().ToArray();
/// <summary>
/// Returns the specified double-precision floating point value as an array of bytes.
/// </summary>
/// <param name="value">The number to convert.</param>
/// <returns>An array of bytes with length 8.</returns>
public static byte[] GetBytes(double value) =>
!IsLittleEndian ? BitConverter.GetBytes(value) : BitConverter.GetBytes(value).Reverse().ToArray();
public static byte[] GetBytes(double value) => BitConverter.GetBytes(value).Reverse().ToArray();
/// <summary>
/// Returns the specified single-precision floating point value as an array of bytes.
/// </summary>
/// <param name="value">The number to convert.</param>
/// <returns>An array of bytes with length 4.</returns>
public static byte[] GetBytes(float value) =>
!IsLittleEndian ? BitConverter.GetBytes(value) : BitConverter.GetBytes(value).Reverse().ToArray();
public static byte[] GetBytes(float value) => BitConverter.GetBytes(value).Reverse().ToArray();
/// <summary>
/// Returns the specified 32-bit signed integer value as an array of bytes.
/// </summary>
/// <param name="value">The number to convert.</param>
/// <returns>An array of bytes with length 4.</returns>
public static byte[] GetBytes(int value) =>
!IsLittleEndian ? BitConverter.GetBytes(value) : BitConverter.GetBytes(value).Reverse().ToArray();
public static byte[] GetBytes(int value) => BitConverter.GetBytes(value).Reverse().ToArray();
/// <summary>
/// Returns the specified 64-bit signed integer value as an array of bytes.
/// </summary>
/// <param name="value">The number to convert.</param>
/// <returns>An array of bytes with length 8.</returns>
public static byte[] GetBytes(long value) =>
!IsLittleEndian ? BitConverter.GetBytes(value) : BitConverter.GetBytes(value).Reverse().ToArray();
public static byte[] GetBytes(long value) => BitConverter.GetBytes(value).Reverse().ToArray();
/// <summary>
/// Returns the specified 16-bit signed integer value as an array of bytes.
/// </summary>
/// <param name="value">The number to convert.</param>
/// <returns>An array of bytes with length 2.</returns>
public static byte[] GetBytes(short value) =>
!IsLittleEndian ? BitConverter.GetBytes(value) : BitConverter.GetBytes(value).Reverse().ToArray();
public static byte[] GetBytes(short value) => BitConverter.GetBytes(value).Reverse().ToArray();
/// <summary>
/// Returns the specified 32-bit unsigned integer value as an array of bytes.
/// </summary>
/// <param name="value">The number to convert.</param>
/// <returns>An array of bytes with length 4.</returns>
public static byte[] GetBytes(uint value) =>
!IsLittleEndian ? BitConverter.GetBytes(value) : BitConverter.GetBytes(value).Reverse().ToArray();
public static byte[] GetBytes(uint value) => BitConverter.GetBytes(value).Reverse().ToArray();
/// <summary>
/// Returns the specified 64-bit unsigned integer value as an array of bytes.
/// </summary>
/// <param name="value">The number to convert.</param>
/// <returns>An array of bytes with length 8.</returns>
public static byte[] GetBytes(ulong value) =>
!IsLittleEndian ? BitConverter.GetBytes(value) : BitConverter.GetBytes(value).Reverse().ToArray();
public static byte[] GetBytes(ulong value) => BitConverter.GetBytes(value).Reverse().ToArray();
/// <summary>
/// Returns the specified 16-bit unsigned integer value as an array of bytes.
/// </summary>
/// <param name="value">The number to convert.</param>
/// <returns>An array of bytes with length 2.</returns>
public static byte[] GetBytes(ushort value) =>
!IsLittleEndian ? BitConverter.GetBytes(value) : BitConverter.GetBytes(value).Reverse().ToArray();
public static byte[] GetBytes(ushort value) => BitConverter.GetBytes(value).Reverse().ToArray();
/// <summary>
/// Converts the specified 64-bit signed integer to a double-precision floating point number.
@@ -202,9 +186,7 @@ namespace DiscImageChef
/// minus 1.
/// </exception>
public static short ToInt16(byte[] value, int startIndex) =>
!IsLittleEndian
? BitConverter.ToInt16(value, startIndex)
: BitConverter.ToInt16(value.Reverse().ToArray(), value.Length - sizeof(short) - startIndex);
BitConverter.ToInt16(value.Reverse().ToArray(), value.Length - sizeof(short) - startIndex);
/// <summary>
/// Returns a 32-bit signed integer converted from four bytes at a specified position in a byte array.
@@ -222,9 +204,7 @@ namespace DiscImageChef
/// minus 1.
/// </exception>
public static int ToInt32(byte[] value, int startIndex) =>
!IsLittleEndian
? BitConverter.ToInt32(value, startIndex)
: BitConverter.ToInt32(value.Reverse().ToArray(), value.Length - sizeof(int) - startIndex);
BitConverter.ToInt32(value.Reverse().ToArray(), value.Length - sizeof(int) - startIndex);
/// <summary>
/// Returns a 64-bit signed integer converted from eight bytes at a specified position in a byte array.
@@ -242,9 +222,7 @@ namespace DiscImageChef
/// length of value minus 1.
/// </exception>
public static long ToInt64(byte[] value, int startIndex) =>
!IsLittleEndian
? BitConverter.ToInt64(value, startIndex)
: BitConverter.ToInt64(value.Reverse().ToArray(), value.Length - sizeof(long) - startIndex);
BitConverter.ToInt64(value.Reverse().ToArray(), value.Length - sizeof(long) - startIndex);
/// <summary>
/// Returns a single-precision floating point number converted from four bytes at a specified position in a byte
@@ -263,9 +241,7 @@ namespace DiscImageChef
/// length of value minus 1.
/// </exception>
public static float ToSingle(byte[] value, int startIndex) =>
!IsLittleEndian
? BitConverter.ToSingle(value, startIndex)
: BitConverter.ToSingle(value.Reverse().ToArray(), value.Length - sizeof(float) - startIndex);
BitConverter.ToSingle(value.Reverse().ToArray(), value.Length - sizeof(float) - startIndex);
/// <summary>
/// Converts the numeric value of each element of a specified array of bytes to its equivalent hexadecimal string
@@ -277,8 +253,7 @@ namespace DiscImageChef
/// element in value; for example, "7F-2C-4A".
/// </returns>
/// <exception cref="System.ArgumentNullException">value is null.</exception>
public static string ToString(byte[] value) =>
!IsLittleEndian ? BitConverter.ToString(value) : BitConverter.ToString(value.Reverse().ToArray());
public static string ToString(byte[] value) => BitConverter.ToString(value.Reverse().ToArray());
/// <summary>
/// Converts the numeric value of each element of a specified subarray of bytes to its equivalent hexadecimal string
@@ -296,9 +271,7 @@ namespace DiscImageChef
/// minus 1.
/// </exception>
public static string ToString(byte[] value, int startIndex) =>
!IsLittleEndian
? BitConverter.ToString(value, startIndex)
: BitConverter.ToString(value.Reverse().ToArray(), startIndex);
BitConverter.ToString(value.Reverse().ToArray(), startIndex);
/// <summary>
/// Converts the numeric value of each element of a specified subarray of bytes to its equivalent hexadecimal string
@@ -321,9 +294,7 @@ namespace DiscImageChef
/// value; that is, the startIndex parameter is greater than the length of value minus the length parameter.
/// </exception>
public static string ToString(byte[] value, int startIndex, int length) =>
!IsLittleEndian
? BitConverter.ToString(value, startIndex, length)
: BitConverter.ToString(value.Reverse().ToArray(), startIndex, length);
BitConverter.ToString(value.Reverse().ToArray(), startIndex, length);
/// <summary>
/// Returns a 16-bit unsigned integer converted from two bytes at a specified position in a byte array.
@@ -338,9 +309,7 @@ namespace DiscImageChef
/// minus 1.
/// </exception>
public static ushort ToUInt16(byte[] value, int startIndex) =>
!IsLittleEndian
? BitConverter.ToUInt16(value, startIndex)
: BitConverter.ToUInt16(value.Reverse().ToArray(), value.Length - sizeof(ushort) - startIndex);
BitConverter.ToUInt16(value.Reverse().ToArray(), value.Length - sizeof(ushort) - startIndex);
/// <summary>
/// Returns a 32-bit unsigned integer converted from four bytes at a specified position in a byte array.
@@ -358,9 +327,7 @@ namespace DiscImageChef
/// minus 1.
/// </exception>
public static uint ToUInt32(byte[] value, int startIndex) =>
!IsLittleEndian
? BitConverter.ToUInt32(value, startIndex)
: BitConverter.ToUInt32(value.Reverse().ToArray(), value.Length - sizeof(uint) - startIndex);
BitConverter.ToUInt32(value.Reverse().ToArray(), value.Length - sizeof(uint) - startIndex);
/// <summary>
/// Returns a 64-bit unsigned integer converted from eight bytes at a specified position in a byte array.
@@ -378,9 +345,7 @@ namespace DiscImageChef
/// minus 1.
/// </exception>
public static ulong ToUInt64(byte[] value, int startIndex) =>
!IsLittleEndian
? BitConverter.ToUInt64(value, startIndex)
: BitConverter.ToUInt64(value.Reverse().ToArray(), value.Length - sizeof(ulong) - startIndex);
BitConverter.ToUInt64(value.Reverse().ToArray(), value.Length - sizeof(ulong) - startIndex);
public static Guid ToGuid(byte[] value, int startIndex) =>
new Guid(ToUInt32(value, 0 + startIndex), ToUInt16(value, 4 + startIndex),

View File

@@ -63,8 +63,6 @@ namespace DiscImageChef.Partitions
{
partitions = new List<Partition>();
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
byte[] sector = imagePlugin.ReadSector(sectorOffset);
if(sector.Length < 512) return false;

View File

@@ -74,8 +74,6 @@ namespace DiscImageChef.Partitions
partitions = new List<Partition>();
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
ulong labelPosition = 0;
foreach(ulong i in new ulong[] {0, 4, 15, 16}.TakeWhile(i => i + sectorOffset < imagePlugin.Info.Sectors))
@@ -221,22 +219,22 @@ namespace DiscImageChef.Partitions
struct NeXTLabel
{
/// <summary>Signature</summary>
public uint dl_version;
public readonly uint dl_version;
/// <summary>Block on which this label resides</summary>
public int dl_label_blkno;
public readonly int dl_label_blkno;
/// <summary>Device size in blocks</summary>
public int dl_size;
public readonly int dl_size;
/// <summary>Device name</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)]
public byte[] dl_label;
public readonly byte[] dl_label;
/// <summary>Device flags</summary>
public uint dl_flags;
public readonly uint dl_flags;
/// <summary>Device tag</summary>
public uint dl_tag;
public readonly uint dl_tag;
/// <summary>Device info and partitions</summary>
public NeXTDiskTab dl_dt;
/// <summary>Checksum</summary>
public ushort dl_v3_checksum;
public readonly ushort dl_v3_checksum;
}
/// <summary>
@@ -246,25 +244,25 @@ namespace DiscImageChef.Partitions
struct NeXTLabelOld
{
/// <summary>Signature</summary>
public uint dl_version;
public readonly uint dl_version;
/// <summary>Block on which this label resides</summary>
public int dl_label_blkno;
public readonly int dl_label_blkno;
/// <summary>Device size in blocks</summary>
public int dl_size;
public readonly int dl_size;
/// <summary>Device name</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)]
public byte[] dl_label;
public readonly byte[] dl_label;
/// <summary>Device flags</summary>
public uint dl_flags;
public readonly uint dl_flags;
/// <summary>Device tag</summary>
public uint dl_tag;
public readonly uint dl_tag;
/// <summary>Device info and partitions</summary>
public NeXTDiskTab dl_dt;
public readonly NeXTDiskTab dl_dt;
/// <summary>Bad sector table</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1670)]
public int[] dl_bad;
public readonly int[] dl_bad;
/// <summary>Checksum</summary>
public ushort dl_checksum;
public readonly ushort dl_checksum;
}
/// <summary>
@@ -275,45 +273,45 @@ namespace DiscImageChef.Partitions
{
/// <summary>Drive name</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)]
public byte[] d_name;
public readonly byte[] d_name;
/// <summary>Drive type</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)]
public byte[] d_type;
public readonly byte[] d_type;
/// <summary>Sector size</summary>
public int d_secsize;
public readonly int d_secsize;
/// <summary>tracks/cylinder</summary>
public int d_ntracks;
public readonly int d_ntracks;
/// <summary>sectors/track</summary>
public int d_nsectors;
public readonly int d_nsectors;
/// <summary>cylinders</summary>
public int d_ncylinders;
public readonly int d_ncylinders;
/// <summary>revolutions/minute</summary>
public int d_rpm;
public readonly int d_rpm;
/// <summary>size of front porch in sectors</summary>
public short d_front;
public readonly short d_front;
/// <summary>size of back porch in sectors</summary>
public short d_back;
public readonly short d_back;
/// <summary>number of alt groups</summary>
public short d_ngroups;
public readonly short d_ngroups;
/// <summary>alt group size in sectors</summary>
public short d_ag_size;
public readonly short d_ag_size;
/// <summary>alternate sectors per alt group</summary>
public short d_ag_alts;
public readonly short d_ag_alts;
/// <summary>sector offset to first alternate</summary>
public short d_ag_off;
public readonly short d_ag_off;
/// <summary>"blk 0" boot locations</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public int[] d_boot0_blkno;
public readonly int[] d_boot0_blkno;
/// <summary>default bootfile</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)]
public byte[] d_bootfile;
public readonly byte[] d_bootfile;
/// <summary>host name</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[] d_hostname;
public readonly byte[] d_hostname;
/// <summary>root partition</summary>
public byte d_rootpartition;
public readonly byte d_rootpartition;
/// <summary>r/w partition</summary>
public byte d_rwpartition;
public readonly byte d_rwpartition;
/// <summary>partitions</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public NeXTEntry[] d_partitions;
@@ -326,31 +324,31 @@ namespace DiscImageChef.Partitions
struct NeXTEntry
{
/// <summary>Sector of start, counting from front porch</summary>
public int p_base;
public readonly int p_base;
/// <summary>Length in sectors</summary>
public int p_size;
public readonly int p_size;
/// <summary>Filesystem's block size</summary>
public short p_bsize;
public readonly short p_bsize;
/// <summary>Filesystem's fragment size</summary>
public short p_fsize;
public readonly short p_fsize;
/// <summary>'s'pace or 't'ime</summary>
public byte p_opt;
public readonly byte p_opt;
/// <summary>Cylinders per group</summary>
public short p_cpg;
public readonly short p_cpg;
/// <summary>Bytes per inode</summary>
public short p_density;
public readonly short p_density;
/// <summary>% of minimum free space</summary>
public byte p_minfree;
public readonly byte p_minfree;
/// <summary>Should newfs be run on first start?</summary>
public byte p_newfs;
public readonly byte p_newfs;
/// <summary>Mount point or empty if mount where you want</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public byte[] p_mountpt;
public readonly byte[] p_mountpt;
/// <summary>Should automount</summary>
public byte p_automnt;
public readonly byte p_automnt;
/// <summary>Filesystem type, always "4.3BSD"?</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public byte[] p_type;
public readonly byte[] p_type;
}
}
}

View File

@@ -281,8 +281,7 @@ namespace DiscImageChef.Partitions
public bool GetInformation(IMediaImage imagePlugin, out List<Partition> partitions, ulong sectorOffset)
{
partitions = new List<Partition>();
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
partitions = new List<Partition>();
ulong rdbBlock = 0;
bool foundRdb = false;
@@ -625,7 +624,7 @@ namespace DiscImageChef.Partitions
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.bootPriority = {0}",
partEntry.DosEnvVec.BootPriority);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.dosType = {0}",
AmigaDosTypeToString(partEntry.DosEnvVec.DosType, true));
AmigaDosTypeToString(partEntry.DosEnvVec.DosType));
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.baud = {0}",
partEntry.DosEnvVec.Baud);
DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.dosEnvVec.control = 0x{0:X8}",