Rename Aaru.Console project to Aaru.Logging.

This commit is contained in:
2025-08-17 05:50:25 +01:00
parent 1a6f7a02c6
commit 02ec8a05d8
365 changed files with 5465 additions and 5347 deletions

View File

@@ -45,7 +45,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Aaru.CommonTypes\Aaru.CommonTypes.csproj"/>
<ProjectReference Include="..\Aaru.Console\Aaru.Console.csproj"/>
<ProjectReference Include="..\Aaru.Logging\Aaru.Logging.csproj"/>
<ProjectReference Include="..\Aaru.Filters\Aaru.Filters.csproj"/>
<ProjectReference Include="..\Aaru.Helpers\Aaru.Helpers.csproj"/>
</ItemGroup>

View File

@@ -37,8 +37,8 @@ using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Helpers;
using Aaru.Logging;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.Archives;
@@ -54,7 +54,7 @@ public sealed partial class Symbian
Stream stream = filter.GetDataForkStream();
var hdr = new byte[Marshal.SizeOf<SymbianHeader>()];
byte[] hdr = new byte[Marshal.SizeOf<SymbianHeader>()];
stream.EnsureRead(hdr, 0, hdr.Length);
@@ -77,7 +77,7 @@ public sealed partial class Symbian
if(stream.Length < Marshal.SizeOf<SymbianHeader>()) return;
var buffer = new byte[Marshal.SizeOf<SymbianHeader>()];
byte[] buffer = new byte[Marshal.SizeOf<SymbianHeader>()];
stream.Seek(0, SeekOrigin.Begin);
stream.EnsureRead(buffer, 0, buffer.Length);
@@ -163,7 +163,7 @@ public sealed partial class Symbian
// Go to enumerate languages
br.BaseStream.Seek(sh.lang_ptr, SeekOrigin.Begin);
for(var i = 0; i < sh.languages; i++) languages.Add(((LanguageCodes)br.ReadUInt16()).ToString("G"));
for(int i = 0; i < sh.languages; i++) languages.Add(((LanguageCodes)br.ReadUInt16()).ToString("G"));
// Go to component record
br.BaseStream.Seek(sh.comp_ptr, SeekOrigin.Begin);
@@ -185,7 +185,7 @@ public sealed partial class Symbian
span = buffer;
componentRecord.namesPointers = MemoryMarshal.Cast<byte, uint>(span)[..languages.Count].ToArray();
for(var i = 0; i < sh.languages; i++)
for(int i = 0; i < sh.languages; i++)
{
AaruConsole.DebugWriteLine(MODULE_NAME,
"Found component name for language {0} at {1} with a length of {2} bytes",
@@ -201,7 +201,7 @@ public sealed partial class Symbian
// Go to capabilities (???)
br.BaseStream.Seek(sh.caps_ptr, SeekOrigin.Begin);
for(var i = 0; i < sh.capabilities; i++)
for(int i = 0; i < sh.capabilities; i++)
{
uint cap_Key = br.ReadUInt32();
uint cap_Value = br.ReadUInt32();
@@ -227,7 +227,7 @@ public sealed partial class Symbian
description.AppendFormat(Localization.File_contains_0_languages, sh.languages).AppendLine();
for(var i = 0; i < languages.Count; i++)
for(int i = 0; i < languages.Count; i++)
{
if(i > 0) description.Append(", ");
description.Append($"{languages[i]}");
@@ -236,7 +236,7 @@ public sealed partial class Symbian
description.AppendLine();
description.AppendLine();
for(var i = 0; i < languages.Count; i++)
for(int i = 0; i < languages.Count; i++)
{
description.AppendFormat(Localization.Component_name_for_language_with_code_0_1,
languages[i],
@@ -253,7 +253,7 @@ public sealed partial class Symbian
if(sh.requisites > 0)
{
for(var r = 0; r < sh.requisites; r++)
for(int r = 0; r < sh.requisites; r++)
{
br.BaseStream.Seek(offset, SeekOrigin.Begin);
@@ -285,7 +285,7 @@ public sealed partial class Symbian
offset = (uint)br.BaseStream.Position;
for(var i = 0; i < languages.Count; i++)
for(int i = 0; i < languages.Count; i++)
{
br.BaseStream.Seek(requisiteRecord.namesPointers[i], SeekOrigin.Begin);
buffer = br.ReadBytes((int)requisiteRecord.namesLengths[i]);
@@ -310,7 +310,7 @@ public sealed partial class Symbian
uint currentFile = 0;
offset = sh.files_ptr;
var conditionLevel = 0;
int conditionLevel = 0;
_options = [];
// Get only the options records
@@ -361,7 +361,7 @@ public sealed partial class Symbian
if(_options.Count > 0)
{
for(var i = 0; i < _options.Count; i++)
for(int i = 0; i < _options.Count; i++)
{
OptionRecord option = _options[i];

View File

@@ -36,8 +36,8 @@ using System.Linq;
using System.Text;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Helpers;
using Aaru.Logging;
namespace Aaru.Archives;
@@ -56,7 +56,7 @@ public sealed partial class Symbian
if(_stream.Length < Marshal.SizeOf<SymbianHeader>()) return ErrorNumber.InvalidArgument;
var buffer = new byte[Marshal.SizeOf<SymbianHeader>()];
byte[] buffer = new byte[Marshal.SizeOf<SymbianHeader>()];
_stream.Seek(0, SeekOrigin.Begin);
_stream.EnsureRead(buffer, 0, buffer.Length);
@@ -123,7 +123,7 @@ public sealed partial class Symbian
// Go to enumerate languages
br.BaseStream.Seek(sh.lang_ptr, SeekOrigin.Begin);
for(var i = 0; i < sh.languages; i++) languages.Add(((LanguageCodes)br.ReadUInt16()).ToString("G"));
for(int i = 0; i < sh.languages; i++) languages.Add(((LanguageCodes)br.ReadUInt16()).ToString("G"));
_files = [];
_conditions = [];
@@ -131,7 +131,7 @@ public sealed partial class Symbian
uint currentFile = 0;
uint offset = sh.files_ptr;
var conditionLevel = 0;
int conditionLevel = 0;
// Get only the options records
do

View File

@@ -36,7 +36,7 @@ using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using Aaru.Console;
using Aaru.Logging;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.Archives;
@@ -51,8 +51,8 @@ public sealed partial class Symbian
if(currentFile > maxFiles) return;
var tabulationChars = new char[conditionLevel];
for(var i = 0; i < conditionLevel; i++) tabulationChars[i] = '\t';
char[] tabulationChars = new char[conditionLevel];
for(int i = 0; i < conditionLevel; i++) tabulationChars[i] = '\t';
string tabulation = new(tabulationChars);
AaruConsole.DebugWriteLine(MODULE_NAME,
@@ -323,7 +323,7 @@ public sealed partial class Symbian
var decodedFileRecords = new DecodedFileRecord[languages.Count];
for(var i = 0; i < languages.Count; i++)
for(int i = 0; i < languages.Count; i++)
{
decodedFileRecords[i].type = multipleFileRecord.record.type;
decodedFileRecords[i].details = multipleFileRecord.record.details;
@@ -488,7 +488,7 @@ public sealed partial class Symbian
optionsLineRecord.options = new OptionRecord[(int)optionsLineRecord.numberOfOptions];
for(var i = 0; i < optionsLineRecord.numberOfOptions; i++)
for(int i = 0; i < optionsLineRecord.numberOfOptions; i++)
{
optionsLineRecord.options[i] = new OptionRecord();
@@ -508,7 +508,7 @@ public sealed partial class Symbian
offset = (uint)br.BaseStream.Position;
for(var j = 0; j < languages.Count; j++)
for(int j = 0; j < languages.Count; j++)
{
br.BaseStream.Seek(optionsLineRecord.options[i].pointers[j], SeekOrigin.Begin);
buffer = br.ReadBytes((int)optionsLineRecord.options[i].lengths[j]);
@@ -527,7 +527,7 @@ public sealed partial class Symbian
conditionLevel--;
tabulationChars = new char[conditionLevel];
for(var i = 0; i < conditionLevel; i++) tabulationChars[i] = '\t';
for(int i = 0; i < conditionLevel; i++) tabulationChars[i] = '\t';
tabulation = new string(tabulationChars);
conditionalRecord = new ConditionalRecord
@@ -552,7 +552,7 @@ public sealed partial class Symbian
break;
case FileRecordType.ElseIf:
tabulationChars = new char[conditionLevel - 1];
for(var i = 0; i < conditionLevel - 1; i++) tabulationChars[i] = '\t';
for(int i = 0; i < conditionLevel - 1; i++) tabulationChars[i] = '\t';
tabulation = new string(tabulationChars);
conditionalRecord = new ConditionalRecord
@@ -577,7 +577,7 @@ public sealed partial class Symbian
break;
case FileRecordType.Else:
tabulationChars = new char[conditionLevel - 1];
for(var i = 0; i < conditionLevel - 1; i++) tabulationChars[i] = '\t';
for(int i = 0; i < conditionLevel - 1; i++) tabulationChars[i] = '\t';
tabulation = new string(tabulationChars);
offset = (uint)(br.BaseStream.Position + Marshal.SizeOf<ConditionalEndRecord>());

View File

@@ -33,7 +33,7 @@
<ItemGroup>
<ProjectReference Include="..\Aaru.CommonTypes\Aaru.CommonTypes.csproj"/>
<ProjectReference Include="..\Aaru.Helpers\Aaru.Helpers.csproj"/>
<ProjectReference Include="..\Aaru.Console\Aaru.Console.csproj"/>
<ProjectReference Include="..\Aaru.Logging\Aaru.Logging.csproj"/>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\LICENSE.LGPL">

View File

@@ -33,8 +33,8 @@
using System;
using System.Collections.Generic;
using Aaru.Console;
using Aaru.Helpers;
using Aaru.Logging;
namespace Aaru.Checksums;
@@ -82,8 +82,8 @@ public static class CdChecksums
{
case 2448:
{
var subchannel = new byte[96];
var channel = new byte[2352];
byte[] subchannel = new byte[96];
byte[] channel = new byte[2352];
Array.Copy(buffer, 0, channel, 0, 2352);
Array.Copy(buffer, 2352, subchannel, 0, 96);
@@ -121,7 +121,7 @@ public static class CdChecksums
for(uint i = 0; i < 256; i++)
{
uint edc = i;
var j = (uint)(i << 1 ^ ((i & 0x80) == 0x80 ? 0x11D : 0));
uint j = (uint)(i << 1 ^ ((i & 0x80) == 0x80 ? 0x11D : 0));
_eccFTable[i] = (byte)j;
_eccBTable[i ^ j] = (byte)i;
@@ -197,7 +197,7 @@ public static class CdChecksums
{
//AaruConsole.DebugWriteLine(MODULE_NAME, "Mode 0 sector at address {0:X2}:{1:X2}:{2:X2}",
// channel[0x00C], channel[0x00D], channel[0x00E]);
for(var i = 0x010; i < 0x930; i++)
for(int i = 0x010; i < 0x930; i++)
{
if(channel[i] == 0x00) continue;
@@ -233,11 +233,11 @@ public static class CdChecksums
return false;
case 0x01:
{
var address = new byte[4];
var data = new byte[2060];
var data2 = new byte[2232];
var eccP = new byte[172];
var eccQ = new byte[104];
byte[] address = new byte[4];
byte[] data = new byte[2060];
byte[] data2 = new byte[2232];
byte[] eccP = new byte[172];
byte[] eccQ = new byte[104];
Array.Copy(channel, 0x0C, address, 0, 4);
Array.Copy(channel, 0x10, data, 0, 2060);
@@ -269,7 +269,7 @@ public static class CdChecksums
channel[0x00E]);
}
var storedEdc = BitConverter.ToUInt32(channel, 0x810);
uint storedEdc = BitConverter.ToUInt32(channel, 0x810);
uint calculatedEdc = ComputeEdc(0, channel, 0x810);
correctEdc = calculatedEdc == storedEdc;
@@ -292,7 +292,7 @@ public static class CdChecksums
{
//AaruConsole.DebugWriteLine(MODULE_NAME, "Mode 2 sector at address {0:X2}:{1:X2}:{2:X2}",
// channel[0x00C], channel[0x00D], channel[0x00E]);
var mode2Sector = new byte[channel.Length - 0x10];
byte[] mode2Sector = new byte[channel.Length - 0x10];
Array.Copy(channel, 0x10, mode2Sector, 0, mode2Sector.Length);
if((channel[0x012] & 0x20) == 0x20) // mode 2 form 2
@@ -309,7 +309,7 @@ public static class CdChecksums
channel[0x00E]);
}
var storedEdc = BitConverter.ToUInt32(mode2Sector, 0x91C);
uint storedEdc = BitConverter.ToUInt32(mode2Sector, 0x91C);
// No CRC stored!
if(storedEdc == 0x00000000) return true;
@@ -344,9 +344,9 @@ public static class CdChecksums
channel[0x00E]);
}
var address = new byte[4];
var eccP = new byte[172];
var eccQ = new byte[104];
byte[] address = new byte[4];
byte[] eccP = new byte[172];
byte[] eccQ = new byte[104];
Array.Copy(mode2Sector, 0x80C, eccP, 0, 172);
Array.Copy(mode2Sector, 0x8B8, eccQ, 0, 104);
@@ -375,7 +375,7 @@ public static class CdChecksums
channel[0x00E]);
}
var storedEdc = BitConverter.ToUInt32(mode2Sector, 0x808);
uint storedEdc = BitConverter.ToUInt32(mode2Sector, 0x808);
uint calculatedEdc = ComputeEdc(0, mode2Sector, 0x808);
correctEdc = calculatedEdc == storedEdc;
@@ -407,7 +407,7 @@ public static class CdChecksums
static uint ComputeEdc(uint edc, IReadOnlyList<byte> src, int size)
{
var pos = 0;
int pos = 0;
for(; size > 0; size--) edc = edc >> 8 ^ _edcTable[(edc ^ src[pos++]) & 0xFF];
@@ -416,22 +416,22 @@ public static class CdChecksums
static bool? CheckCdSectorSubChannel(IReadOnlyList<byte> subchannel)
{
bool? status = true;
var qSubChannel = new byte[12];
var cdTextPack1 = new byte[18];
var cdTextPack2 = new byte[18];
var cdTextPack3 = new byte[18];
var cdTextPack4 = new byte[18];
var cdSubRwPack1 = new byte[24];
var cdSubRwPack2 = new byte[24];
var cdSubRwPack3 = new byte[24];
var cdSubRwPack4 = new byte[24];
bool? status = true;
byte[] qSubChannel = new byte[12];
byte[] cdTextPack1 = new byte[18];
byte[] cdTextPack2 = new byte[18];
byte[] cdTextPack3 = new byte[18];
byte[] cdTextPack4 = new byte[18];
byte[] cdSubRwPack1 = new byte[24];
byte[] cdSubRwPack2 = new byte[24];
byte[] cdSubRwPack3 = new byte[24];
byte[] cdSubRwPack4 = new byte[24];
var i = 0;
int i = 0;
for(var j = 0; j < 12; j++) qSubChannel[j] = 0;
for(int j = 0; j < 12; j++) qSubChannel[j] = 0;
for(var j = 0; j < 18; j++)
for(int j = 0; j < 18; j++)
{
cdTextPack1[j] = 0;
cdTextPack2[j] = 0;
@@ -439,7 +439,7 @@ public static class CdChecksums
cdTextPack4[j] = 0;
}
for(var j = 0; j < 24; j++)
for(int j = 0; j < 24; j++)
{
cdSubRwPack1[j] = 0;
cdSubRwPack2[j] = 0;
@@ -447,7 +447,7 @@ public static class CdChecksums
cdSubRwPack4[j] = 0;
}
for(var j = 0; j < 12; j++)
for(int j = 0; j < 12; j++)
{
qSubChannel[j] = (byte)(qSubChannel[j] | (subchannel[i++] & 0x40) << 1);
qSubChannel[j] = (byte)(qSubChannel[j] | subchannel[i++] & 0x40);
@@ -461,7 +461,7 @@ public static class CdChecksums
i = 0;
for(var j = 0; j < 18; j++)
for(int j = 0; j < 18; j++)
{
cdTextPack1[j] = (byte)(cdTextPack1[j] | (subchannel[i++] & 0x3F) << 2);
@@ -476,7 +476,7 @@ public static class CdChecksums
cdTextPack1[j] = (byte)(cdTextPack1[j] | subchannel[i++] & 0x3F);
}
for(var j = 0; j < 18; j++)
for(int j = 0; j < 18; j++)
{
cdTextPack2[j] = (byte)(cdTextPack2[j] | (subchannel[i++] & 0x3F) << 2);
@@ -491,7 +491,7 @@ public static class CdChecksums
cdTextPack2[j] = (byte)(cdTextPack2[j] | subchannel[i++] & 0x3F);
}
for(var j = 0; j < 18; j++)
for(int j = 0; j < 18; j++)
{
cdTextPack3[j] = (byte)(cdTextPack3[j] | (subchannel[i++] & 0x3F) << 2);
@@ -506,7 +506,7 @@ public static class CdChecksums
cdTextPack3[j] = (byte)(cdTextPack3[j] | subchannel[i++] & 0x3F);
}
for(var j = 0; j < 18; j++)
for(int j = 0; j < 18; j++)
{
cdTextPack4[j] = (byte)(cdTextPack4[j] | (subchannel[i++] & 0x3F) << 2);
@@ -523,13 +523,13 @@ public static class CdChecksums
i = 0;
for(var j = 0; j < 24; j++) cdSubRwPack1[j] = (byte)(subchannel[i++] & 0x3F);
for(int j = 0; j < 24; j++) cdSubRwPack1[j] = (byte)(subchannel[i++] & 0x3F);
for(var j = 0; j < 24; j++) cdSubRwPack2[j] = (byte)(subchannel[i++] & 0x3F);
for(int j = 0; j < 24; j++) cdSubRwPack2[j] = (byte)(subchannel[i++] & 0x3F);
for(var j = 0; j < 24; j++) cdSubRwPack3[j] = (byte)(subchannel[i++] & 0x3F);
for(int j = 0; j < 24; j++) cdSubRwPack3[j] = (byte)(subchannel[i++] & 0x3F);
for(var j = 0; j < 24; j++) cdSubRwPack4[j] = (byte)(subchannel[i++] & 0x3F);
for(int j = 0; j < 24; j++) cdSubRwPack4[j] = (byte)(subchannel[i++] & 0x3F);
switch(cdSubRwPack1[0])
{
@@ -570,8 +570,8 @@ public static class CdChecksums
break;
}
var qSubChannelCrc = BigEndianBitConverter.ToUInt16(qSubChannel, 10);
var qSubChannelForCrc = new byte[10];
ushort qSubChannelCrc = BigEndianBitConverter.ToUInt16(qSubChannel, 10);
byte[] qSubChannelForCrc = new byte[10];
Array.Copy(qSubChannel, 0, qSubChannelForCrc, 0, 10);
ushort calculatedQcrc = CRC16CcittContext.Calculate(qSubChannelForCrc);
@@ -587,8 +587,8 @@ public static class CdChecksums
if((cdTextPack1[0] & 0x80) == 0x80)
{
var cdTextPack1Crc = BigEndianBitConverter.ToUInt16(cdTextPack1, 16);
var cdTextPack1ForCrc = new byte[16];
ushort cdTextPack1Crc = BigEndianBitConverter.ToUInt16(cdTextPack1, 16);
byte[] cdTextPack1ForCrc = new byte[16];
Array.Copy(cdTextPack1, 0, cdTextPack1ForCrc, 0, 16);
ushort calculatedCdtp1Crc = CRC16CcittContext.Calculate(cdTextPack1ForCrc);
@@ -605,8 +605,8 @@ public static class CdChecksums
if((cdTextPack2[0] & 0x80) == 0x80)
{
var cdTextPack2Crc = BigEndianBitConverter.ToUInt16(cdTextPack2, 16);
var cdTextPack2ForCrc = new byte[16];
ushort cdTextPack2Crc = BigEndianBitConverter.ToUInt16(cdTextPack2, 16);
byte[] cdTextPack2ForCrc = new byte[16];
Array.Copy(cdTextPack2, 0, cdTextPack2ForCrc, 0, 16);
ushort calculatedCdtp2Crc = CRC16CcittContext.Calculate(cdTextPack2ForCrc);
@@ -628,8 +628,8 @@ public static class CdChecksums
if((cdTextPack3[0] & 0x80) == 0x80)
{
var cdTextPack3Crc = BigEndianBitConverter.ToUInt16(cdTextPack3, 16);
var cdTextPack3ForCrc = new byte[16];
ushort cdTextPack3Crc = BigEndianBitConverter.ToUInt16(cdTextPack3, 16);
byte[] cdTextPack3ForCrc = new byte[16];
Array.Copy(cdTextPack3, 0, cdTextPack3ForCrc, 0, 16);
ushort calculatedCdtp3Crc = CRC16CcittContext.Calculate(cdTextPack3ForCrc);
@@ -651,8 +651,8 @@ public static class CdChecksums
if((cdTextPack4[0] & 0x80) != 0x80) return status;
var cdTextPack4Crc = BigEndianBitConverter.ToUInt16(cdTextPack4, 16);
var cdTextPack4ForCrc = new byte[16];
ushort cdTextPack4Crc = BigEndianBitConverter.ToUInt16(cdTextPack4, 16);
byte[] cdTextPack4ForCrc = new byte[16];
Array.Copy(cdTextPack4, 0, cdTextPack4ForCrc, 0, 16);
ushort calculatedCdtp4Crc = CRC16CcittContext.Calculate(cdTextPack4ForCrc);

View File

@@ -59,7 +59,7 @@
using System;
using System.Diagnostics.CodeAnalysis;
using Aaru.Console;
using Aaru.Logging;
namespace Aaru.Checksums;
@@ -194,7 +194,7 @@ public class ReedSolomon
{
int i;
var mask = 1;
int mask = 1;
_alphaTo[_mm] = 0;
for(i = 0; i < _mm; i++)
@@ -299,8 +299,9 @@ public class ReedSolomon
for(i = _kk - 1; i >= 0; i--)
{
if(_mm != 8)
if(data[i] > _nn)
return -1; /* Illegal symbol */
{
if(data[i] > _nn) return -1; /* Illegal symbol */
}
int feedback = _indexOf[data[i] ^ bb[_nn - _kk - 1]];
@@ -354,25 +355,26 @@ public class ReedSolomon
throw new UnauthorizedAccessException(Localization.Trying_to_calculate_RS_without_initializing);
erasPos = new int[_nn - _kk];
int i, j;
int q, tmp;
var recd = new int[_nn];
var lambda = new int[_nn - _kk + 1]; /* Err+Eras Locator poly */
var s = new int[_nn - _kk + 1]; /* syndrome poly */
var b = new int[_nn - _kk + 1];
var t = new int[_nn - _kk + 1];
var omega = new int[_nn - _kk + 1];
var root = new int[_nn - _kk];
var reg = new int[_nn - _kk + 1];
var loc = new int[_nn - _kk];
int count;
int i, j;
int q, tmp;
int[] recd = new int[_nn];
int[] lambda = new int[_nn - _kk + 1]; /* Err+Eras Locator poly */
int[] s = new int[_nn - _kk + 1]; /* syndrome poly */
int[] b = new int[_nn - _kk + 1];
int[] t = new int[_nn - _kk + 1];
int[] omega = new int[_nn - _kk + 1];
int[] root = new int[_nn - _kk];
int[] reg = new int[_nn - _kk + 1];
int[] loc = new int[_nn - _kk];
int count;
/* data[] is in polynomial form, copy and convert to index form */
for(i = _nn - 1; i >= 0; i--)
{
if(_mm != 8)
if(data[i] > _nn)
return -1; /* Illegal symbol */
{
if(data[i] > _nn) return -1; /* Illegal symbol */
}
recd[i] = _indexOf[data[i]];
}
@@ -380,15 +382,16 @@ public class ReedSolomon
/* first form the syndromes; i.e., evaluate recd(x) at roots of g(x)
* namely @**(B0+i), i = 0, ... ,(NN-KK-1)
*/
var synError = 0;
int synError = 0;
for(i = 1; i <= _nn - _kk; i++)
{
tmp = 0;
for(j = 0; j < _nn; j++)
if(recd[j] != _a0) /* recd[j] in index form */
tmp ^= _alphaTo[Modnn(recd[j] + (B0 + i - 1) * j)];
{
if(recd[j] != _a0) /* recd[j] in index form */ tmp ^= _alphaTo[Modnn(recd[j] + (B0 + i - 1) * j)];
}
synError |= tmp; /* set flag if non-zero syndrome =>
* error */
@@ -476,11 +479,12 @@ public class ReedSolomon
{
/* r is the step number */
/* Compute discrepancy at the r-th step in poly-form */
var discrR = 0;
int discrR = 0;
for(i = 0; i < r; i++)
if(lambda[i] != 0 && s[r - i] != _a0)
discrR ^= _alphaTo[Modnn(_indexOf[lambda[i]] + s[r - i])];
{
if(lambda[i] != 0 && s[r - i] != _a0) discrR ^= _alphaTo[Modnn(_indexOf[lambda[i]] + s[r - i])];
}
discrR = _indexOf[discrR]; /* Index form */
@@ -526,7 +530,7 @@ public class ReedSolomon
}
/* Convert lambda to index form and compute deg(lambda(x)) */
var degLambda = 0;
int degLambda = 0;
for(i = 0; i < _nn - _kk + 1; i++)
{
@@ -578,7 +582,7 @@ public class ReedSolomon
* Compute err+eras evaluator poly omega(x) = s(x)*lambda(x) (modulo
* x**(NN-KK)). in index form. Also find deg(omega).
*/
var degOmega = 0;
int degOmega = 0;
for(i = 0; i < _nn - _kk; i++)
{
@@ -586,8 +590,9 @@ public class ReedSolomon
j = degLambda < i ? degLambda : i;
for(; j >= 0; j--)
if(s[i + 1 - j] != _a0 && lambda[j] != _a0)
tmp ^= _alphaTo[Modnn(s[i + 1 - j] + lambda[j])];
{
if(s[i + 1 - j] != _a0 && lambda[j] != _a0) tmp ^= _alphaTo[Modnn(s[i + 1 - j] + lambda[j])];
}
if(tmp != 0) degOmega = i;
@@ -602,19 +607,21 @@ public class ReedSolomon
*/
for(j = count - 1; j >= 0; j--)
{
var num1 = 0;
int num1 = 0;
for(i = degOmega; i >= 0; i--)
if(omega[i] != _a0)
num1 ^= _alphaTo[Modnn(omega[i] + i * root[j])];
{
if(omega[i] != _a0) num1 ^= _alphaTo[Modnn(omega[i] + i * root[j])];
}
int num2 = _alphaTo[Modnn(root[j] * (B0 - 1) + _nn)];
var den = 0;
int den = 0;
/* lambda[i+1] for i even is the formal derivative lambda_pr of lambda[i] */
for(i = Min(degLambda, _nn - _kk - 1) & ~1; i >= 0; i -= 2)
if(lambda[i + 1] != _a0)
den ^= _alphaTo[Modnn(lambda[i + 1] + i * root[j])];
{
if(lambda[i + 1] != _a0) den ^= _alphaTo[Modnn(lambda[i + 1] + i * root[j])];
}
if(den == 0)
{

View File

@@ -45,7 +45,7 @@
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Aaru.Console\Aaru.Console.csproj"/>
<ProjectReference Include="..\Aaru.Logging\Aaru.Logging.csproj"/>
<ProjectReference Include="..\Aaru.Helpers\Aaru.Helpers.csproj"/>
<ProjectReference Include="..\Aaru.Localization\Aaru.Localization.csproj"/>
</ItemGroup>

View File

@@ -33,7 +33,7 @@
// ****************************************************************************/
using System;
using Aaru.Console;
using Aaru.Logging;
namespace Aaru.CommonTypes;

View File

@@ -33,7 +33,7 @@
// ****************************************************************************/
using System;
using Aaru.Console;
using Aaru.Logging;
namespace Aaru.CommonTypes;

View File

@@ -32,7 +32,7 @@
// Copyright © 2011-2025 Natalia Portillo
// ****************************************************************************/
using Aaru.Console;
using Aaru.Logging;
namespace Aaru.CommonTypes;

View File

@@ -33,7 +33,7 @@
// ****************************************************************************/
using System;
using Aaru.Console;
using Aaru.Logging;
namespace Aaru.CommonTypes;

View File

@@ -33,7 +33,7 @@
// ****************************************************************************/
using System;
using Aaru.Console;
using Aaru.Logging;
namespace Aaru.CommonTypes;

View File

@@ -33,7 +33,7 @@
// ****************************************************************************/
using System;
using Aaru.Console;
using Aaru.Logging;
namespace Aaru.CommonTypes;

View File

@@ -43,8 +43,8 @@ using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Text;
using Aaru.Console;
using Aaru.Helpers;
using Aaru.Logging;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.CommonTypes.Structs.Devices.ATA;
@@ -833,8 +833,8 @@ public static class Identify
ataId.WWN = DescrambleWWN(ataId.WWN);
ataId.WWNExtension = DescrambleWWN(ataId.WWNExtension);
var buf = new byte[512];
nint ptr = System.Runtime.InteropServices.Marshal.AllocHGlobal(512);
byte[] buf = new byte[512];
nint ptr = System.Runtime.InteropServices.Marshal.AllocHGlobal(512);
System.Runtime.InteropServices.Marshal.StructureToPtr(ataId, ptr, false);
System.Runtime.InteropServices.Marshal.Copy(ptr, buf, 0, 512);
System.Runtime.InteropServices.Marshal.FreeHGlobal(ptr);
@@ -858,7 +858,7 @@ public static class Identify
static ulong DescrambleWWN(ulong WWN)
{
byte[] qwb = BitConverter.GetBytes(WWN);
var qword = new byte[8];
byte[] qword = new byte[8];
qword[7] = qwb[1];
qword[6] = qwb[0];
@@ -876,7 +876,7 @@ public static class Identify
{
byte[] outbuf = buffer[offset + length - 1] != 0x00 ? new byte[length + 1] : new byte[length];
for(var i = 0; i < length; i += 2)
for(int i = 0; i < length; i += 2)
{
outbuf[i] = buffer[offset + i + 1];
outbuf[i + 1] = buffer[offset + i];
@@ -889,9 +889,9 @@ public static class Identify
static byte[] ScrambleATAString(string str, int length)
{
var buf = new byte[length];
byte[] buf = new byte[length];
for(var i = 0; i < length; i++) buf[i] = 0x20;
for(int i = 0; i < length; i++) buf[i] = 0x20;
if(str is null) return buf;
@@ -899,13 +899,13 @@ public static class Identify
if(bytes.Length % 2 != 0)
{
var tmp = new byte[bytes.Length + 1];
byte[] tmp = new byte[bytes.Length + 1];
tmp[^1] = 0x20;
Array.Copy(bytes, 0, tmp, 0, bytes.Length);
bytes = tmp;
}
for(var i = 0; i < bytes.Length; i += 2)
for(int i = 0; i < bytes.Length; i += 2)
{
buf[i] = bytes[i + 1];
buf[i + 1] = bytes[i];

View File

@@ -39,7 +39,7 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Aaru.Console;
using Aaru.Logging;
namespace Aaru.CommonTypes.Structs.Devices.SCSI;
@@ -477,7 +477,7 @@ public struct Inquiry
decoded.VersionDescriptors = new ushort[descriptorsNo];
for(var i = 0; i < descriptorsNo; i++)
for(int i = 0; i < descriptorsNo; i++)
decoded.VersionDescriptors[i] = BitConverter.ToUInt16(SCSIInquiryResponse, 58 + i * 2);
}
@@ -528,8 +528,8 @@ public struct Inquiry
Inquiry decoded = inq.Value;
var buffer = new byte[512];
byte length = 0;
byte[] buffer = new byte[512];
byte length = 0;
buffer[0] = (byte)(decoded.PeripheralQualifier << 5);
buffer[0] += decoded.PeripheralDeviceType;
@@ -729,7 +729,7 @@ public struct Inquiry
{
length = (byte)(58 + decoded.VersionDescriptors.Length * 2);
for(var i = 0; i < decoded.VersionDescriptors.Length; i++)
for(int i = 0; i < decoded.VersionDescriptors.Length; i++)
Array.Copy(BitConverter.GetBytes(decoded.VersionDescriptors[i]), 0, buffer, 56 + i * 2, 2);
}
@@ -758,7 +758,7 @@ public struct Inquiry
}
buffer[4] = length;
var dest = new byte[length];
byte[] dest = new byte[length];
Array.Copy(buffer, 0, dest, 0, length);
return dest;

View File

@@ -32,7 +32,7 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Aaru.Archives\Aaru.Archives.csproj"/>
<ProjectReference Include="..\Aaru.Console\Aaru.Console.csproj"/>
<ProjectReference Include="..\Aaru.Logging\Aaru.Logging.csproj"/>
<ProjectReference Include="..\Aaru.Database\Aaru.Database.csproj"/>
<ProjectReference Include="..\Aaru.Decryption\Aaru.Decryption.csproj"/>
<ProjectReference Include="..\Aaru.Dto\Aaru.Dto.csproj"/>

View File

@@ -32,7 +32,7 @@
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Logging;
namespace Aaru.Core;

View File

@@ -32,7 +32,7 @@
using System.Text;
using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Logging;
using Spectre.Console;
namespace Aaru.Core;

View File

@@ -32,8 +32,8 @@
using System.Diagnostics.CodeAnalysis;
using System.IO;
using Aaru.Console;
using Aaru.Helpers;
using Aaru.Logging;
namespace Aaru.Core;

View File

@@ -43,11 +43,11 @@ using Aaru.CommonTypes.AaruMetadata;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Extents;
using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Core.Logging;
using Aaru.Decoders.CD;
using Aaru.Decoders.SCSI;
using Aaru.Devices;
using Aaru.Logging;
using Humanizer;
using Humanizer.Bytes;
using Track = Aaru.CommonTypes.Structs.Track;
@@ -103,7 +103,7 @@ partial class Dump
{
ulong sectorSpeedStart = 0; // Used to calculate correct speed
uint blocksToRead; // How many sectors to read at once
var sense = true; // Sense indicator
bool sense = true; // Sense indicator
byte[] cmdBuf = null; // Data buffer
byte[] senseBuf = null; // Sense buffer
double cmdDuration = 0; // Command execution time
@@ -122,10 +122,10 @@ partial class Dump
InitProgress?.Invoke();
int currentReadSpeed = _speed;
var crossingLeadOut = false;
var failedCrossingLeadOut = false;
var skippingLead = false;
int currentReadSpeed = _speed;
bool crossingLeadOut = false;
bool failedCrossingLeadOut = false;
bool skippingLead = false;
for(ulong i = _resume.NextBlock; (long)i <= lastSector; i += blocksToRead)
{
@@ -146,7 +146,7 @@ partial class Dump
if((long)i > lastSector) break;
var firstSectorToRead = (uint)i;
uint firstSectorToRead = (uint)i;
Track track = tracks.OrderBy(t => t.StartSector).LastOrDefault(t => i >= t.StartSector);
@@ -317,10 +317,10 @@ partial class Dump
// Try to workaround firmware
if(decSense?.ASC == 0x64)
{
var goBackTrackTypeChange = false;
bool goBackTrackTypeChange = false;
// Go one for one as the drive does not tell us which one failed
for(var bi = 0; bi < blocksToRead; bi++)
for(int bi = 0; bi < blocksToRead; bi++)
{
_speedStopwatch.Start();
@@ -591,7 +591,7 @@ partial class Dump
if(_supportsPlextorD8)
{
var adjustment = 0;
int adjustment = 0;
if(offsetBytes < 0) adjustment = -sectorsForOffset;
@@ -611,7 +611,7 @@ partial class Dump
if(!sense)
{
var sectorsForFix = (uint)(1 + sectorsForOffset);
uint sectorsForFix = (uint)(1 + sectorsForOffset);
FixOffsetData(offsetBytes,
sectorSize,
@@ -637,7 +637,7 @@ partial class Dump
{
case 0:
for(var c = 16; c < 2352; c++)
for(int c = 16; c < 2352; c++)
{
if(cmdBuf[c] == 0x00) continue;
@@ -775,8 +775,8 @@ partial class Dump
if(supportedSubchannel != MmcSubchannel.None)
{
var data = new byte[sectorSize];
var sub = new byte[subSize];
byte[] data = new byte[sectorSize];
byte[] sub = new byte[subSize];
Array.Copy(cmdBuf, 0, data, 0, sectorSize);
@@ -786,10 +786,10 @@ partial class Dump
outputFormat.WriteSectorsLong(data, i + r, 1);
else
{
var cooked = new MemoryStream();
var sector = new byte[sectorSize];
var cooked = new MemoryStream();
byte[] sector = new byte[sectorSize];
for(var b = 0; b < blocksToRead; b++)
for(int b = 0; b < blocksToRead; b++)
{
Array.Copy(cmdBuf, (int)(0 + b * blockSize), sector, 0, sectorSize);
byte[] cookedSector = Sector.GetUserData(sector);
@@ -847,10 +847,10 @@ partial class Dump
outputFormat.WriteSectorsLong(cmdBuf, i + r, 1);
else
{
var cooked = new MemoryStream();
var sector = new byte[sectorSize];
var cooked = new MemoryStream();
byte[] sector = new byte[sectorSize];
for(var b = 0; b < blocksToRead; b++)
for(int b = 0; b < blocksToRead; b++)
{
Array.Copy(cmdBuf, (int)(b * sectorSize), sector, 0, sectorSize);
byte[] cookedSector = Sector.GetUserData(sector);
@@ -936,7 +936,7 @@ partial class Dump
{
if(crossingLeadOut && failedCrossingLeadOut)
{
var tmp = new byte[cmdBuf.Length + blockSize];
byte[] tmp = new byte[cmdBuf.Length + blockSize];
Array.Copy(cmdBuf, 0, tmp, 0, cmdBuf.Length);
}
@@ -961,10 +961,10 @@ partial class Dump
if(supportedSubchannel != MmcSubchannel.None)
{
var data = new byte[sectorSize * blocksToRead];
var sub = new byte[subSize * blocksToRead];
byte[] data = new byte[sectorSize * blocksToRead];
byte[] sub = new byte[subSize * blocksToRead];
for(var b = 0; b < blocksToRead; b++)
for(int b = 0; b < blocksToRead; b++)
{
Array.Copy(cmdBuf, (int)(0 + b * blockSize), data, sectorSize * b, sectorSize);
@@ -975,10 +975,10 @@ partial class Dump
outputFormat.WriteSectorsLong(data, i, blocksToRead);
else
{
var cooked = new MemoryStream();
var sector = new byte[sectorSize];
var cooked = new MemoryStream();
byte[] sector = new byte[sectorSize];
for(var b = 0; b < blocksToRead; b++)
for(int b = 0; b < blocksToRead; b++)
{
Array.Copy(cmdBuf, (int)(0 + b * blockSize), sector, 0, sectorSize);
byte[] cookedSector = Sector.GetUserData(sector);
@@ -1035,10 +1035,10 @@ partial class Dump
outputFormat.WriteSectorsLong(cmdBuf, i, blocksToRead);
else
{
var cooked = new MemoryStream();
var sector = new byte[sectorSize];
var cooked = new MemoryStream();
byte[] sector = new byte[sectorSize];
for(var b = 0; b < blocksToRead; b++)
for(int b = 0; b < blocksToRead; b++)
{
Array.Copy(cmdBuf, (int)(b * sectorSize), sector, 0, sectorSize);
byte[] cookedSector = Sector.GetUserData(sector);

View File

@@ -43,13 +43,13 @@ using Aaru.CommonTypes.AaruMetadata;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Extents;
using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Core.Graphics;
using Aaru.Core.Logging;
using Aaru.Core.Media.Detection;
using Aaru.Database.Models;
using Aaru.Decoders.CD;
using Aaru.Devices;
using Aaru.Logging;
using Humanizer;
using Humanizer.Bytes;
using Humanizer.Localisation;
@@ -86,21 +86,21 @@ sealed partial class Dump
MhddLog mhddLog; // MHDD log
double minSpeed = double.MaxValue; // Minimum speed
bool newTrim; // Is trim a new one?
var offsetBytes = 0; // Read offset
var read6 = false; // Device supports READ(6)
var read10 = false; // Device supports READ(10)
var read12 = false; // Device supports READ(12)
var read16 = false; // Device supports READ(16)
var readcd = true; // Device supports READ CD
int offsetBytes = 0; // Read offset
bool read6 = false; // Device supports READ(6)
bool read10 = false; // Device supports READ(10)
bool read12 = false; // Device supports READ(12)
bool read16 = false; // Device supports READ(16)
bool readcd = true; // Device supports READ CD
bool ret; // Image writing return status
const uint sectorSize = 2352; // Full sector size
var sectorsForOffset = 0; // Sectors needed to fix offset
var sense = true; // Sense indicator
int sectorsForOffset = 0; // Sectors needed to fix offset
bool sense = true; // Sense indicator
int sessions; // Number of sessions in disc
SubchannelLog subLog = null; // Subchannel log
uint subSize = 0; // Subchannel size in bytes
TrackSubchannelType subType; // Track subchannel type
var supportsLongSectors = true; // Supports reading EDC and ECC
bool supportsLongSectors = true; // Supports reading EDC and ECC
bool supportsPqSubchannel; // Supports reading PQ subchannel
bool supportsRwSubchannel; // Supports reading RW subchannel
byte[] tmpBuf; // Temporary buffer
@@ -112,11 +112,11 @@ sealed partial class Dump
bool hiddenTrack; // Disc has a hidden track before track 1
MmcSubchannel supportedSubchannel; // Drive's maximum supported subchannel
MmcSubchannel desiredSubchannel; // User requested subchannel
var bcdSubchannel = false; // Subchannel positioning is in BCD
bool bcdSubchannel = false; // Subchannel positioning is in BCD
Dictionary<byte, string> isrcs = new();
string mcn = null;
HashSet<int> subchannelExtents = [];
var cdiReadyReadAsAudio = false;
bool cdiReadyReadAsAudio = false;
uint firstLba;
var outputOptical = _outputPlugin as IWritableOpticalImage;
@@ -152,11 +152,12 @@ sealed partial class Dump
return;
}
firstLba = (uint) tracks.Min(t => t.StartSector);
firstLba = (uint)tracks.Min(t => t.StartSector);
// Check subchannels support
supportsPqSubchannel = SupportsPqSubchannel(_dev, _dumpLog, UpdateStatus, firstLba) ||
SupportsPqSubchannel(_dev, _dumpLog, UpdateStatus, firstLba + 5);
supportsRwSubchannel = SupportsRwSubchannel(_dev, _dumpLog, UpdateStatus, firstLba) ||
SupportsRwSubchannel(_dev, _dumpLog, UpdateStatus, firstLba + 5);
@@ -279,9 +280,22 @@ sealed partial class Dump
supportedSubchannel,
_dev.Timeout,
out _) ||
!_dev.ReadCd(out cmdBuf, out _, firstLba + 5, sectorSize, 1, MmcSectorTypes.AllTypes, false,
false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None,
supportedSubchannel, _dev.Timeout, out _);
!_dev.ReadCd(out cmdBuf,
out _,
firstLba + 5,
sectorSize,
1,
MmcSectorTypes.AllTypes,
false,
false,
true,
MmcHeaderCodes.AllHeaders,
true,
true,
MmcErrorField.None,
supportedSubchannel,
_dev.Timeout,
out _);
if(!readcd)
{
@@ -291,32 +305,103 @@ sealed partial class Dump
_dumpLog.WriteLine(Localization.Core.Checking_if_drive_supports_READ_6);
UpdateStatus?.Invoke(Localization.Core.Checking_if_drive_supports_READ_6);
read6 = !_dev.Read6(out cmdBuf, out _, firstLba, 2048, 1, _dev.Timeout, out _) ||
read6 = !_dev.Read6(out cmdBuf, out _, firstLba, 2048, 1, _dev.Timeout, out _) ||
!_dev.Read6(out cmdBuf, out _, firstLba + 5, 2048, 1, _dev.Timeout, out _);
_dumpLog.WriteLine(Localization.Core.Checking_if_drive_supports_READ_10);
UpdateStatus?.Invoke(Localization.Core.Checking_if_drive_supports_READ_10);
read10 = !_dev.Read10(out cmdBuf, out _, 0, false, true, false, false, firstLba, 2048, 0, 1,
_dev.Timeout, out _) ||
!_dev.Read10(out cmdBuf, out _, 0, false, true, false, false, firstLba + 5, 2048, 0, 1,
_dev.Timeout, out _);
read10 =
!_dev.Read10(out cmdBuf,
out _,
0,
false,
true,
false,
false,
firstLba,
2048,
0,
1,
_dev.Timeout,
out _) ||
!_dev.Read10(out cmdBuf,
out _,
0,
false,
true,
false,
false,
firstLba + 5,
2048,
0,
1,
_dev.Timeout,
out _);
_dumpLog.WriteLine(Localization.Core.Checking_if_drive_supports_READ_12);
UpdateStatus?.Invoke(Localization.Core.Checking_if_drive_supports_READ_12);
read12 = !_dev.Read12(out cmdBuf, out _, 0, false, true, false, false, firstLba, 2048, 0, 1, false,
_dev.Timeout, out _) ||
!_dev.Read12(out cmdBuf, out _, 0, false, true, false, false, firstLba + 5, 2048, 0, 1,
false, _dev.Timeout, out _);
read12 =
!_dev.Read12(out cmdBuf,
out _,
0,
false,
true,
false,
false,
firstLba,
2048,
0,
1,
false,
_dev.Timeout,
out _) ||
!_dev.Read12(out cmdBuf,
out _,
0,
false,
true,
false,
false,
firstLba + 5,
2048,
0,
1,
false,
_dev.Timeout,
out _);
_dumpLog.WriteLine(Localization.Core.Checking_if_drive_supports_READ_16);
UpdateStatus?.Invoke(Localization.Core.Checking_if_drive_supports_READ_16);
read16 = !_dev.Read16(out cmdBuf, out _, 0, false, true, false, firstLba, 2048, 0, 1, false,
_dev.Timeout, out _) ||
!_dev.Read16(out cmdBuf, out _, 0, false, true, false, firstLba + 5, 2048, 0, 1, false,
_dev.Timeout, out _);
read16 =
!_dev.Read16(out cmdBuf,
out _,
0,
false,
true,
false,
firstLba,
2048,
0,
1,
false,
_dev.Timeout,
out _) ||
!_dev.Read16(out cmdBuf,
out _,
0,
false,
true,
false,
firstLba + 5,
2048,
0,
1,
false,
_dev.Timeout,
out _);
switch(read6)
{
@@ -498,10 +583,10 @@ sealed partial class Dump
ErrorMessage?.Invoke(Localization.Core.Output_format_does_not_support_pregaps_continuing);
}
for(var t = 1; t < tracks.Length; t++) tracks[t - 1].EndSector = tracks[t].StartSector - 1;
for(int t = 1; t < tracks.Length; t++) tracks[t - 1].EndSector = tracks[t].StartSector - 1;
tracks[^1].EndSector = (ulong) lastSector;
blocks = (ulong) (lastSector + 1);
tracks[^1].EndSector = (ulong)lastSector;
blocks = (ulong)(lastSector + 1);
if(blocks == 0)
{
@@ -589,7 +674,7 @@ sealed partial class Dump
Tuple<ulong, ulong>[] dataExtentsArray = dataExtents.ToArray();
for(var i = 0; i < dataExtentsArray.Length - 1; i++)
for(int i = 0; i < dataExtentsArray.Length - 1; i++)
leadOutExtents.Add(dataExtentsArray[i].Item2 + 1, dataExtentsArray[i + 1].Item1 - 1);
}
@@ -624,14 +709,14 @@ sealed partial class Dump
List<Track> trkList =
[
new Track
new()
{
Sequence = (uint) (tracks.Any(t => t.Sequence == 1) ? 0 : 1),
Sequence = (uint)(tracks.Any(t => t.Sequence == 1) ? 0 : 1),
Session = 1,
Type = hiddenData ? TrackType.Data : TrackType.Audio,
StartSector = 0,
BytesPerSector = (int) sectorSize,
RawBytesPerSector = (int) sectorSize,
BytesPerSector = (int)sectorSize,
RawBytesPerSector = (int)sectorSize,
SubchannelType = subType,
EndSector = tracks.First(t => t.Sequence >= 1).StartSector - 1
}
@@ -688,7 +773,7 @@ sealed partial class Dump
continue;
}
var bufOffset = 0;
int bufOffset = 0;
while(cmdBuf[0 + bufOffset] != 0x00 ||
cmdBuf[1 + bufOffset] != 0xFF ||
@@ -900,8 +985,7 @@ sealed partial class Dump
}
else if(read6)
{
sense = _dev.Read6(out cmdBuf, out _, firstLba, blockSize, (byte) _maximumReadable, _dev.Timeout,
out _);
sense = _dev.Read6(out cmdBuf, out _, firstLba, blockSize, (byte)_maximumReadable, _dev.Timeout, out _);
if(_dev.Error || sense) _maximumReadable /= 2;
}
@@ -918,7 +1002,7 @@ sealed partial class Dump
_dev.LastError));
}
var cdiWithHiddenTrack1 = false;
bool cdiWithHiddenTrack1 = false;
if(dskType is MediaType.CDIREADY && tracks.Min(t => t.Sequence) == 1)
{
@@ -1066,11 +1150,11 @@ sealed partial class Dump
{
foreach(Track trk in tracks)
{
sense = _dev.ReadIsrc((byte) trk.Sequence, out string isrc, out _, out _, _dev.Timeout, out _);
sense = _dev.ReadIsrc((byte)trk.Sequence, out string isrc, out _, out _, _dev.Timeout, out _);
if(sense || isrc is null or "000000000000") continue;
isrcs[(byte) trk.Sequence] = isrc;
isrcs[(byte)trk.Sequence] = isrc;
UpdateStatus?.Invoke(string.Format(Localization.Core.Found_ISRC_for_track_0_1, trk.Sequence, isrc));
_dumpLog.WriteLine(string.Format(Localization.Core.Found_ISRC_for_track_0_1, trk.Sequence, isrc));
@@ -1086,8 +1170,9 @@ sealed partial class Dump
foreach(int sub in _resume.BadSubchannels) subchannelExtents.Add(sub);
if(_resume.NextBlock < blocks)
for(ulong i = _resume.NextBlock; i < blocks; i++)
subchannelExtents.Add((int) i);
{
for(ulong i = _resume.NextBlock; i < blocks; i++) subchannelExtents.Add((int)i);
}
}
if(_resume.NextBlock > 0)
@@ -1191,7 +1276,7 @@ sealed partial class Dump
offsetBytes = driveOffset.Value;
sectorsForOffset = offsetBytes / (int) sectorSize;
sectorsForOffset = offsetBytes / (int)sectorSize;
if(sectorsForOffset < 0) sectorsForOffset *= -1;
@@ -1201,7 +1286,7 @@ sealed partial class Dump
else
{
offsetBytes = combinedOffset.Value;
sectorsForOffset = offsetBytes / (int) sectorSize;
sectorsForOffset = offsetBytes / (int)sectorSize;
if(sectorsForOffset < 0) sectorsForOffset *= -1;
@@ -1291,7 +1376,7 @@ sealed partial class Dump
if(_speed is 0 or > 0xFFFF) _speed = 0xFFFF;
_dev.SetCdSpeed(out _, RotationalControl.ClvAndImpureCav, (ushort) _speed, 0, _dev.Timeout, out _);
_dev.SetCdSpeed(out _, RotationalControl.ClvAndImpureCav, (ushort)_speed, 0, _dev.Timeout, out _);
}
// Start reading
@@ -1351,7 +1436,7 @@ sealed partial class Dump
if(cdiReadyReadAsAudio)
{
offsetBytes = combinedOffset.Value;
sectorsForOffset = offsetBytes / (int) sectorSize;
sectorsForOffset = offsetBytes / (int)sectorSize;
if(sectorsForOffset < 0) sectorsForOffset *= -1;
@@ -1576,8 +1661,9 @@ sealed partial class Dump
supportsLongSectors);
foreach(Tuple<ulong, ulong> leadoutExtent in leadOutExtents.ToArray())
for(ulong e = leadoutExtent.Item1; e <= leadoutExtent.Item2; e++)
subchannelExtents.Remove((int) e);
{
for(ulong e = leadoutExtent.Item1; e <= leadoutExtent.Item2; e++) subchannelExtents.Remove((int)e);
}
if(subchannelExtents.Count > 0 && _retryPasses > 0 && _retrySubchannel)
{
@@ -1686,7 +1772,7 @@ sealed partial class Dump
if(trk.Sequence == 1) continue;
trk.StartSector -= trk.Pregap;
trk.Indexes[0] = (int) trk.StartSector;
trk.Indexes[0] = (int)trk.StartSector;
continue;
}

View File

@@ -42,11 +42,11 @@ using Aaru.CommonTypes.AaruMetadata;
using Aaru.CommonTypes.Extents;
using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs.Devices.SCSI;
using Aaru.Console;
using Aaru.Core.Logging;
using Aaru.Decoders.CD;
using Aaru.Decoders.SCSI;
using Aaru.Devices;
using Aaru.Logging;
using Track = Aaru.CommonTypes.Structs.Track;
using TrackType = Aaru.CommonTypes.Enums.TrackType;
@@ -80,7 +80,7 @@ partial class Dump
ref string mcn, HashSet<int> subchannelExtents,
Dictionary<byte, int> smallestPregapLbaPerTrack, bool supportsLongSectors)
{
var sense = true; // Sense indicator
bool sense = true; // Sense indicator
byte[] cmdBuf = null; // Data buffer
double cmdDuration; // Command execution time
const uint sectorSize = 2352; // Full sector size
@@ -98,9 +98,9 @@ partial class Dump
if(_resume.BadBlocks.Count <= 0 || _aborted || _retryPasses <= 0) return;
var pass = 1;
var forward = true;
var runningPersistent = false;
int pass = 1;
bool forward = true;
bool runningPersistent = false;
Modes.ModePage? currentModePage = null;
byte[] md6;
@@ -221,7 +221,7 @@ partial class Dump
ulong[] tmpArray = _resume.BadBlocks.ToArray();
List<ulong> sectorsNotEvenPartial = [];
for(var i = 0; i < tmpArray.Length; i++)
for(int i = 0; i < tmpArray.Length; i++)
{
ulong badSector = tmpArray[i];
@@ -259,7 +259,7 @@ partial class Dump
Track track = tracks.OrderBy(t => t.StartSector).LastOrDefault(t => badSector >= t.StartSector);
byte sectorsToReRead = 1;
var badSectorToReRead = (uint)badSector;
uint badSectorToReRead = (uint)badSector;
if(_fixOffset && audioExtents.Contains(badSector) && offsetBytes != 0)
{
@@ -425,7 +425,7 @@ partial class Dump
{
case 0:
for(var c = 16; c < 2352; c++)
for(int c = 16; c < 2352; c++)
{
if(cmdBuf[c] == 0x00) continue;
@@ -469,9 +469,8 @@ partial class Dump
// MEDIUM ERROR, retry with ignore error below
if(decSense is { ASC: 0x11 })
{
if(!sectorsNotEvenPartial.Contains(badSector)) sectorsNotEvenPartial.Add(badSector);
}
if(!sectorsNotEvenPartial.Contains(badSector))
sectorsNotEvenPartial.Add(badSector);
}
// Because one block has been partially used to fix the offset
@@ -508,8 +507,8 @@ partial class Dump
if(supportedSubchannel != MmcSubchannel.None)
{
var data = new byte[sectorSize];
var sub = new byte[subSize];
byte[] data = new byte[sectorSize];
byte[] sub = new byte[subSize];
Array.Copy(cmdBuf, 0, data, 0, sectorSize);
Array.Copy(cmdBuf, sectorSize, sub, 0, subSize);
@@ -612,7 +611,7 @@ partial class Dump
InitProgress?.Invoke();
for(var i = 0; i < sectorsNotEvenPartial.Count; i++)
for(int i = 0; i < sectorsNotEvenPartial.Count; i++)
{
ulong badSector = sectorsNotEvenPartial[i];
@@ -662,8 +661,8 @@ partial class Dump
if(supportedSubchannel != MmcSubchannel.None)
{
var data = new byte[sectorSize];
var sub = new byte[subSize];
byte[] data = new byte[sectorSize];
byte[] sub = new byte[subSize];
Array.Copy(cmdBuf, 0, data, 0, sectorSize);
Array.Copy(cmdBuf, sectorSize, sub, 0, subSize);
@@ -749,7 +748,7 @@ partial class Dump
Dictionary<byte, string> isrcs, ref string mcn, HashSet<int> subchannelExtents,
Dictionary<byte, int> smallestPregapLbaPerTrack)
{
var sense = true; // Sense indicator
bool sense = true; // Sense indicator
byte[] cmdBuf = null; // Data buffer
double cmdDuration; // Command execution time
byte[] senseBuf = null; // Sense buffer
@@ -768,8 +767,8 @@ partial class Dump
if(_aborted) return;
var pass = 1;
var forward = true;
int pass = 1;
bool forward = true;
InitProgress?.Invoke();
@@ -785,7 +784,7 @@ partial class Dump
foreach(int bs in tmpArray)
{
var badSector = (uint)bs;
uint badSector = (uint)bs;
Track track = tracks.OrderBy(t => t.StartSector).LastOrDefault(t => badSector >= t.StartSector);

View File

@@ -42,9 +42,9 @@ using Aaru.Checksums;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Structs;
using Aaru.Console;
using Aaru.Core.Logging;
using Aaru.Devices;
using Aaru.Logging;
using Humanizer;
using Humanizer.Bytes;
@@ -66,8 +66,8 @@ partial class Dump
byte[] cmdBuf; // Data buffer
double cmdDuration; // Command execution time
ulong sectorSpeedStart = 0; // Used to calculate correct speed
var gotFirstTrackPregap = false;
var firstTrackPregapSectorsGood = 0;
bool gotFirstTrackPregap = false;
int firstTrackPregapSectorsGood = 0;
var firstTrackPregapMs = new MemoryStream();
_dumpLog.WriteLine(Localization.Core.Reading_first_track_pregap);
@@ -164,7 +164,7 @@ partial class Dump
bool supportsPqSubchannel, bool supportsRwSubchannel,
Database.Models.Device dbDev, out bool inexactPositioning, bool dumping)
{
var sense = true; // Sense indicator
bool sense = true; // Sense indicator
byte[] subBuf = null;
int posQ;
uint retries;
@@ -211,10 +211,10 @@ partial class Dump
// Initialize the dictionary
foreach(Track t in tracks) pregaps[t.Sequence] = 0;
for(var t = 0; t < tracks.Length; t++)
for(int t = 0; t < tracks.Length; t++)
{
Track track = tracks[t];
var trackRetries = 0;
int trackRetries = 0;
// First track of each session has at least 150 sectors of pregap and is not always readable
if(tracks.Where(trk => trk.Session == track.Session).MinBy(trk => trk.Sequence).Sequence == track.Sequence)
@@ -245,14 +245,14 @@ partial class Dump
AaruConsole.DebugWriteLine(PREGAP_MODULE_NAME, Localization.Core.Track_0, track.Sequence);
int lba = (int)track.StartSector - 1;
var pregapFound = false;
bool pregapFound = false;
Track previousTrack = tracks.FirstOrDefault(trk => trk.Sequence == track.Sequence - 1);
var goneBack = false;
var goFront = false;
var forward = false;
var crcOk = false;
var previousPregapIsPreviousTrack = false;
bool goneBack = false;
bool goFront = false;
bool forward = false;
bool crcOk = false;
bool previousPregapIsPreviousTrack = false;
// Check if pregap is 0
for(retries = 0; retries < 10 && !pregapFound; retries++)
@@ -315,7 +315,7 @@ partial class Dump
subBuf[6] = 0;
// Fix BCD numbering
for(var i = 1; i < 10; i++)
for(int i = 1; i < 10; i++)
{
if((subBuf[i] & 0xF0) > 0xA0) subBuf[i] &= 0x7F;
@@ -442,7 +442,7 @@ partial class Dump
subBuf[6] = 0;
// Fix BCD numbering
for(var i = 1; i < 10; i++)
for(int i = 1; i < 10; i++)
{
if((subBuf[i] & 0xF0) > 0xA0) subBuf[i] &= 0x7F;
@@ -668,7 +668,7 @@ partial class Dump
if(dumping)
{
// Minus five, to ensure dumping will fix if there is a pregap LBA 0
var red = 5;
int red = 5;
while(trk.Pregap > 0 && red > 0)
{
@@ -784,7 +784,7 @@ partial class Dump
if(!sense)
{
var tmpBuf = new byte[96];
byte[] tmpBuf = new byte[96];
Array.Copy(cmdBuf, 2352, tmpBuf, 0, 96);
subBuf = DeinterleaveQ(tmpBuf);
}
@@ -988,10 +988,10 @@ partial class Dump
/// <returns>De-interleaved Q subchannel</returns>
static byte[] DeinterleaveQ(byte[] subchannel)
{
var q = new int[subchannel.Length / 8];
int[] q = new int[subchannel.Length / 8];
// De-interlace Q subchannel
for(var iq = 0; iq < subchannel.Length; iq += 8)
for(int iq = 0; iq < subchannel.Length; iq += 8)
{
q[iq / 8] = (subchannel[iq] & 0x40) << 1;
q[iq / 8] += subchannel[iq + 1] & 0x40;
@@ -1003,9 +1003,9 @@ partial class Dump
q[iq / 8] += (subchannel[iq + 7] & 0x40) >> 6;
}
var deQ = new byte[q.Length];
byte[] deQ = new byte[q.Length];
for(var iq = 0; iq < q.Length; iq++) deQ[iq] = (byte)q[iq];
for(int iq = 0; iq < q.Length; iq++) deQ[iq] = (byte)q[iq];
return deQ;
}

View File

@@ -42,11 +42,11 @@ using Aaru.CommonTypes.AaruMetadata;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Extents;
using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Core.Graphics;
using Aaru.Core.Logging;
using Aaru.Decoders.SCSI;
using Aaru.Devices;
using Aaru.Logging;
using Humanizer;
using Humanizer.Bytes;
using Humanizer.Localisation;
@@ -250,7 +250,7 @@ partial class Dump
if(decMode?.Pages != null)
{
var setGeometry = false;
bool setGeometry = false;
foreach(Modes.ModePage page in decMode.Value.Pages)
{
@@ -362,7 +362,7 @@ partial class Dump
_mediaGraph?.PaintSectorsBad(_resume.BadBlocks);
}
var newTrim = false;
bool newTrim = false;
_speedStopwatch.Reset();
ulong sectorSpeedStart = 0;
InitProgress?.Invoke();
@@ -541,9 +541,9 @@ partial class Dump
if(_resume.BadBlocks.Count > 0 && !_aborted && _retryPasses > 0)
{
var pass = 1;
var forward = true;
var runningPersistent = false;
int pass = 1;
bool forward = true;
bool runningPersistent = false;
Modes.ModePage? currentModePage = null;
byte[] md6;

View File

@@ -42,11 +42,11 @@ using Aaru.CommonTypes.AaruMetadata;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Extents;
using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Core.Graphics;
using Aaru.Core.Logging;
using Aaru.Decoders.SCSI;
using Aaru.Devices;
using Aaru.Logging;
using Humanizer;
using Humanizer.Bytes;
using Humanizer.Localisation;
@@ -87,7 +87,7 @@ public partial class Dump
return;
}
var blocks = (uint)((readBuffer[0] << 24) + (readBuffer[1] << 16) + (readBuffer[2] << 8) + readBuffer[3]);
uint blocks = (uint)((readBuffer[0] << 24) + (readBuffer[1] << 16) + (readBuffer[2] << 8) + readBuffer[3]);
blocks++;
@@ -198,7 +198,7 @@ public partial class Dump
_mediaGraph?.PaintSectorsBad(_resume.BadBlocks);
}
var newTrim = false;
bool newTrim = false;
_speedStopwatch.Restart();
ulong sectorSpeedStart = 0;
@@ -402,9 +402,9 @@ public partial class Dump
if(_resume.BadBlocks.Count > 0 && !_aborted && _retryPasses > 0)
{
var pass = 1;
var forward = true;
var runningPersistent = false;
int pass = 1;
bool forward = true;
bool runningPersistent = false;
Modes.ModePage? currentModePage = null;
byte[] md6;

View File

@@ -39,11 +39,11 @@ using Aaru.CommonTypes.AaruMetadata;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Extents;
using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Core.Graphics;
using Aaru.Core.Logging;
using Aaru.Decoders.SCSI;
using Aaru.Devices;
using Aaru.Logging;
using Humanizer;
using Humanizer.Bytes;
using Humanizer.Localisation;
@@ -97,11 +97,11 @@ public partial class Dump
return;
}
var fatStart = (ushort)((readBuffer[0x0F] << 8) + readBuffer[0x0E]);
var sectorsPerFat = (ushort)((readBuffer[0x17] << 8) + readBuffer[0x16]);
var rootStart = (ushort)(sectorsPerFat * 2 + fatStart);
var rootSize = (ushort)(((readBuffer[0x12] << 8) + readBuffer[0x11]) * 32 / 512);
var umdStart = (ushort)(rootStart + rootSize);
ushort fatStart = (ushort)((readBuffer[0x0F] << 8) + readBuffer[0x0E]);
ushort sectorsPerFat = (ushort)((readBuffer[0x17] << 8) + readBuffer[0x16]);
ushort rootStart = (ushort)(sectorsPerFat * 2 + fatStart);
ushort rootSize = (ushort)(((readBuffer[0x12] << 8) + readBuffer[0x11]) * 32 / 512);
ushort umdStart = (ushort)(rootStart + rootSize);
UpdateStatus?.Invoke(string.Format(Localization.Core.Reading_root_directory_in_sector_0, rootStart));
_dumpLog.WriteLine(Localization.Core.Reading_root_directory_in_sector_0, rootStart);
@@ -129,7 +129,7 @@ public partial class Dump
return;
}
var umdSizeInBytes = BitConverter.ToUInt32(readBuffer, 0x3C);
uint umdSizeInBytes = BitConverter.ToUInt32(readBuffer, 0x3C);
ulong blocks = umdSizeInBytes / blockSize;
string mediaPartNumber = Encoding.ASCII.GetString(readBuffer, 0, 11).Trim();
@@ -242,7 +242,7 @@ public partial class Dump
_mediaGraph?.PaintSectorsBad(_resume.BadBlocks);
}
var newTrim = false;
bool newTrim = false;
_speedStopwatch.Reset();
ulong sectorSpeedStart = 0;
@@ -443,9 +443,9 @@ public partial class Dump
if(_resume.BadBlocks.Count > 0 && !_aborted && _retryPasses > 0)
{
var pass = 1;
var forward = true;
var runningPersistent = false;
int pass = 1;
bool forward = true;
bool runningPersistent = false;
Modes.ModePage? currentModePage = null;
byte[] md6;

View File

@@ -42,7 +42,6 @@ using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Extents;
using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs.Devices.SCSI;
using Aaru.Console;
using Aaru.Core.Devices.Report;
using Aaru.Core.Graphics;
using Aaru.Core.Logging;
@@ -52,6 +51,7 @@ using Aaru.Decoders.DVD;
using Aaru.Decoders.SCSI;
using Aaru.Decoders.SCSI.MMC;
using Aaru.Devices;
using Aaru.Logging;
using Humanizer;
using Humanizer.Bytes;
using Humanizer.Localisation;
@@ -59,7 +59,6 @@ using DVDDecryption = Aaru.Decryption.DVD.Dump;
using Track = Aaru.CommonTypes.Structs.Track;
using TrackType = Aaru.CommonTypes.Enums.TrackType;
using Version = Aaru.CommonTypes.Interop.Version;
using Aaru.Decoders.DVD;
// ReSharper disable JoinDeclarationAndInitializer
@@ -79,7 +78,7 @@ partial class Dump
bool sense;
byte scsiMediumType = 0;
byte scsiDensityCode = 0;
var containsFloppyPage = false;
bool containsFloppyPage = false;
const ushort sbcProfile = 0x0001;
double totalDuration = 0;
double currentSpeed = 0;
@@ -388,8 +387,8 @@ partial class Dump
_private,
_dimensions);
var ibgLog = new IbgLog(_outputPrefix + ".ibg", sbcProfile);
var imageCreated = false;
var ibgLog = new IbgLog(_outputPrefix + ".ibg", sbcProfile);
bool imageCreated = false;
if(!opticalDisc)
{
@@ -413,7 +412,7 @@ partial class Dump
_dumpStopwatch.Restart();
double imageWriteDuration = 0;
var writeSingleOpticalTrack = true;
bool writeSingleOpticalTrack = true;
if(opticalDisc)
{
@@ -630,7 +629,7 @@ partial class Dump
}
else if(decMode?.Pages != null)
{
var setGeometry = false;
bool setGeometry = false;
foreach(Modes.ModePage page in decMode.Value.Pages)
{
@@ -810,7 +809,7 @@ partial class Dump
if(_resume?.BlankExtents != null) blankExtents = ExtentsConverter.FromMetadata(_resume.BlankExtents);
var newTrim = false;
bool newTrim = false;
if(mediaTags.TryGetValue(MediaTagType.DVD_CMI, out byte[] cmi) &&
Settings.Settings.Current.EnableDecryption &&

View File

@@ -31,12 +31,12 @@ using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Extents;
using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs.Devices.SCSI;
using Aaru.Console;
using Aaru.Decoders.DVD;
using Aaru.Decoders.SCSI;
using Aaru.Decryption;
using Aaru.Decryption.DVD;
using Aaru.Devices;
using Aaru.Logging;
using DVDDecryption = Aaru.Decryption.DVD.Dump;
// ReSharper disable JoinDeclarationAndInitializer
@@ -56,9 +56,9 @@ partial class Dump
void RetrySbcData(Reader scsiReader, DumpHardware currentTry, ExtentsULong extents, ref double totalDuration,
ExtentsULong blankExtents, byte[] discKey)
{
var pass = 1;
var forward = true;
var runningPersistent = false;
int pass = 1;
bool forward = true;
bool runningPersistent = false;
bool sense;
byte[] buffer;
bool recoveredError;
@@ -66,7 +66,7 @@ partial class Dump
byte[] md6;
byte[] md10;
bool blankCheck;
var newBlank = false;
bool newBlank = false;
var outputFormat = _outputPlugin as IWritableImage;
if(_persistent)
@@ -344,7 +344,8 @@ partial class Dump
if(errno != ErrorNumber.NoError)
{
ErrorMessage?.Invoke(string.Format(Localization.Core.Error_retrieving_title_key_for_sector_0,
ErrorMessage?.Invoke(string.Format(Localization.Core
.Error_retrieving_title_key_for_sector_0,
badSector));
}
else
@@ -404,8 +405,8 @@ partial class Dump
void RetryTitleKeys(DVDDecryption dvdDecrypt, byte[] discKey, ref double totalDuration)
{
var pass = 1;
var forward = true;
int pass = 1;
bool forward = true;
bool sense;
byte[] buffer;

View File

@@ -7,10 +7,10 @@ using System.Linq;
using Aaru.CommonTypes.AaruMetadata;
using Aaru.CommonTypes.Extents;
using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Core.Logging;
using Aaru.Decoders.SCSI;
using Aaru.Helpers;
using Aaru.Logging;
using Humanizer;
using Humanizer.Bytes;
@@ -53,7 +53,7 @@ partial class Dump
bool sense;
byte[] buffer;
ulong sectorSpeedStart = 0;
var canMediumScan = true;
bool canMediumScan = true;
var outputFormat = _outputPlugin as IWritableImage;
InitProgress?.Invoke();
@@ -182,8 +182,9 @@ partial class Dump
writtenExtents.Add(0, blocks - 1);
foreach(Tuple<ulong, ulong> blank in blankExtents.ToArray())
for(ulong b = blank.Item1; b <= blank.Item2; b++)
writtenExtents.Remove(b);
{
for(ulong b = blank.Item1; b <= blank.Item2; b++) writtenExtents.Remove(b);
}
}
if(writtenExtents.Count == 0)

View File

@@ -42,13 +42,13 @@ using Aaru.CommonTypes.Extents;
using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Interop;
using Aaru.CommonTypes.Structs.Devices.SCSI;
using Aaru.Console;
using Aaru.Core.Graphics;
using Aaru.Core.Logging;
using Aaru.Decoders.DVD;
using Aaru.Decoders.SCSI;
using Aaru.Decoders.Xbox;
using Aaru.Devices;
using Aaru.Logging;
using Humanizer;
using Humanizer.Bytes;
using Humanizer.Localisation;
@@ -157,7 +157,7 @@ partial class Dump
return;
}
var tmpBuf = new byte[ssBuf.Length - 4];
byte[] tmpBuf = new byte[ssBuf.Length - 4];
Array.Copy(ssBuf, 4, tmpBuf, 0, ssBuf.Length - 4);
mediaTags.Add(MediaTagType.Xbox_SecuritySector, tmpBuf);
@@ -528,7 +528,7 @@ partial class Dump
if(_skip < blocksToRead) _skip = blocksToRead;
var ret = true;
bool ret = true;
foreach(MediaTagType tag in mediaTags.Keys.Where(tag => !outputFormat.SupportedMediaTags.Contains(tag)))
{
@@ -644,7 +644,7 @@ partial class Dump
_dumpLog.WriteLine(Localization.Core.Resuming_from_block_0, _resume.NextBlock);
}
var newTrim = false;
bool newTrim = false;
_dumpLog.WriteLine(Localization.Core.Reading_game_partition);
UpdateStatus?.Invoke(Localization.Core.Reading_game_partition);
@@ -652,7 +652,7 @@ partial class Dump
ulong sectorSpeedStart = 0;
InitProgress?.Invoke();
for(var e = 0; e <= 16; e++)
for(int e = 0; e <= 16; e++)
{
if(_aborted)
{
@@ -1146,14 +1146,15 @@ partial class Dump
List<ulong> tmpList = [];
foreach(ulong ur in _resume.BadBlocks)
for(ulong i = ur; i < ur + blocksToRead; i++)
tmpList.Add(i);
{
for(ulong i = ur; i < ur + blocksToRead; i++) tmpList.Add(i);
}
tmpList.Sort();
var pass = 1;
var forward = true;
var runningPersistent = false;
int pass = 1;
bool forward = true;
bool runningPersistent = false;
_resume.BadBlocks = tmpList;
Modes.ModePage? currentModePage = null;

View File

@@ -35,13 +35,13 @@ using System;
using System.Collections.Generic;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Structs.Devices.SCSI;
using Aaru.Console;
using Aaru.Decoders.ATA;
using Aaru.Decoders.DVD;
using Aaru.Decoders.SCSI;
using Aaru.Decryption;
using Aaru.Devices;
using Aaru.Helpers;
using Aaru.Logging;
using DVDDecryption = Aaru.Decryption.DVD.Dump;
using Inquiry = Aaru.CommonTypes.Structs.Devices.SCSI.Inquiry;
@@ -330,8 +330,8 @@ public partial class DeviceInfo
if(dev.Manufacturer == "PLEXTOR")
{
var plxtSense = true;
var plxtDvd = false;
bool plxtSense = true;
bool plxtDvd = false;
byte[] plxtBuf = null;
switch(dev.Model)

View File

@@ -32,8 +32,8 @@
using System;
using Aaru.CommonTypes.Enums;
using Aaru.Console;
using Aaru.Decoders.ATA;
using Aaru.Logging;
using Identify = Aaru.CommonTypes.Structs.Devices.ATA.Identify;
namespace Aaru.Core.Devices;
@@ -106,7 +106,7 @@ sealed partial class Reader
if(Blocks == 0) GetDeviceBlocks();
bool sense;
var tries = 0;
int tries = 0;
uint lba = 0;
ushort cyl = 0;
byte head = 0;
@@ -264,7 +264,7 @@ sealed partial class Reader
return false;
}
var error = true;
bool error = true;
while(IsLba)
{
@@ -325,7 +325,7 @@ sealed partial class Reader
bool AtaReadBlocks(out byte[] buffer, ulong block, uint count, out double duration, out bool recoveredError)
{
var error = true;
bool error = true;
bool sense;
AtaErrorRegistersLba28 errorLba;
AtaErrorRegistersLba48 errorLba48;
@@ -403,7 +403,7 @@ sealed partial class Reader
bool AtaReadChs(out byte[] buffer, ushort cylinder, byte head, byte sector, out double duration,
out bool recoveredError)
{
var error = true;
bool error = true;
bool sense;
AtaErrorRegistersChs errorChs;
byte status = 0, errorByte = 0;

View File

@@ -32,8 +32,8 @@
using System;
using Aaru.CommonTypes.Structs.Devices.SCSI;
using Aaru.Console;
using Aaru.Decoders.SCSI;
using Aaru.Logging;
namespace Aaru.Core.Devices;
@@ -54,8 +54,8 @@ sealed partial class Reader
// TODO: Raw reading
public bool HldtstReadRaw;
public bool LiteOnReadRaw;
public uint layerbreak;
public bool LiteOnReadRaw;
public bool otp;
ulong ScsiGetBlocks() => ScsiGetBlockSize() ? 0 : Blocks;
@@ -67,9 +67,9 @@ sealed partial class Reader
if(Blocks == 0) return true;
byte[] senseBuf;
var tries = 0;
int tries = 0;
uint lba = 0;
var mediumScan = false;
bool mediumScan = false;
if(_dev.ScsiType == PeripheralDeviceTypes.OpticalDevice)
{
@@ -661,7 +661,7 @@ sealed partial class Reader
return true;
case false:
{
var temp = new byte[8];
byte[] temp = new byte[8];
Array.Copy(cmdBuf, 0, temp, 0, 8);
Array.Reverse(temp);
@@ -927,7 +927,7 @@ sealed partial class Reader
bool ScsiSeek(ulong block, out double duration)
{
var sense = true;
bool sense = true;
duration = 0;
if(_seek6)

View File

@@ -32,9 +32,9 @@
using System;
using Aaru.CommonTypes.Metadata;
using Aaru.Console;
using Aaru.Decoders.ATA;
using Aaru.Devices;
using Aaru.Logging;
using Spectre.Console;
using Identify = Aaru.CommonTypes.Structs.Devices.ATA.Identify;
@@ -46,7 +46,7 @@ public sealed partial class DeviceReport
/// <returns>Media report</returns>
public TestedMedia ReportAtaMedia()
{
var sense = true;
bool sense = true;
AtaErrorRegistersChs errorChs = new();
AtaErrorRegistersLba28 errorLba = new();
AtaErrorRegistersLba48 errorLba48 = new();
@@ -181,7 +181,7 @@ public sealed partial class DeviceReport
mediaTest.Manufacturer = ataId.MediaManufacturer;
}
var checkCorrectRead = BitConverter.ToUInt64(buffer, 0);
ulong checkCorrectRead = BitConverter.ToUInt64(buffer, 0);
Spectre.ProgressSingleSpinner(ctx =>
{
@@ -535,7 +535,7 @@ public sealed partial class DeviceReport
/// <summary>Creates a report of an ATA device</summary>
public TestedMedia ReportAta(Identify.IdentifyDevice ataId)
{
var sense = true;
bool sense = true;
byte[] readBuf = [];
AtaErrorRegistersChs errorChs = new();
AtaErrorRegistersLba28 errorLba = new();
@@ -998,7 +998,7 @@ public sealed partial class DeviceReport
/// <returns>IDENTIFY ATA DEVICE response without the private fields</returns>
public static byte[] ClearIdentify(byte[] buffer)
{
var empty = new byte[512];
byte[] empty = new byte[512];
Array.Copy(empty, 0, buffer, 20, 20);
Array.Copy(empty, 0, buffer, 216, 8);

View File

@@ -36,10 +36,10 @@ using System;
using System.Linq;
using System.Threading;
using Aaru.CommonTypes.Metadata;
using Aaru.Console;
using Aaru.Decoders.CD;
using Aaru.Decoders.SCSI;
using Aaru.Devices;
using Aaru.Logging;
namespace Aaru.Core.Devices.Report;
@@ -58,7 +58,7 @@ public sealed partial class DeviceReport
AaruConsole.Write(Localization.Core
.Have_you_previously_tried_with_a_GD_ROM_disc_and_did_the_computer_hang_or_crash_Q);
pressedKey = System.Console.ReadKey();
pressedKey = Console.ReadKey();
AaruConsole.WriteLine();
}
@@ -76,11 +76,11 @@ public sealed partial class DeviceReport
AaruConsole.WriteLine(Localization.Core.Please_insert_trap_disc_inside);
AaruConsole.WriteLine(Localization.Core.Press_any_key_to_continue);
System.Console.ReadLine();
Console.ReadLine();
AaruConsole.WriteLine(Localization.Core.Sending_READ_FULL_TOC_to_the_device);
var retries = 0;
int retries = 0;
bool sense;
byte[] buffer;
byte[] senseBuffer;
@@ -139,8 +139,8 @@ public sealed partial class DeviceReport
return;
}
int min = 0, sec, frame;
var tocIsNotBcd = false;
int min = 0, sec, frame;
bool tocIsNotBcd = false;
report.GdRomSwapDiscCapabilities.SwapDiscLeadOutPMIN = leadOutTrack.PMIN;
report.GdRomSwapDiscCapabilities.SwapDiscLeadOutPSEC = leadOutTrack.PSEC;
@@ -194,7 +194,7 @@ public sealed partial class DeviceReport
AaruConsole.WriteLine(Localization.Core.Please_MANUALLY_get_the_trap_disc_out_and_put_the_GD_ROM_disc_inside);
AaruConsole.WriteLine(Localization.Core.Press_any_key_to_continue);
System.Console.ReadLine();
Console.ReadLine();
AaruConsole.WriteLine(Localization.Core.Waiting_5_seconds);
Thread.Sleep(5000);
@@ -1743,16 +1743,16 @@ public sealed partial class DeviceReport
? Localization.Core.Success
: Localization.Core.FAIL);
if(report.GdRomSwapDiscCapabilities.Lba45000Readable == false &&
report.GdRomSwapDiscCapabilities.Lba50000Readable == false &&
report.GdRomSwapDiscCapabilities.Lba100000Readable == false &&
report.GdRomSwapDiscCapabilities.Lba400000Readable == false &&
report.GdRomSwapDiscCapabilities.Lba450000Readable == false &&
report.GdRomSwapDiscCapabilities.Lba45000AudioReadable == false &&
report.GdRomSwapDiscCapabilities.Lba50000AudioReadable == false &&
report.GdRomSwapDiscCapabilities.Lba100000AudioReadable == false &&
report.GdRomSwapDiscCapabilities.Lba400000AudioReadable == false &&
report.GdRomSwapDiscCapabilities.Lba450000AudioReadable == false)
if(!report.GdRomSwapDiscCapabilities.Lba45000Readable &&
!report.GdRomSwapDiscCapabilities.Lba50000Readable &&
!report.GdRomSwapDiscCapabilities.Lba100000Readable &&
!report.GdRomSwapDiscCapabilities.Lba400000Readable &&
!report.GdRomSwapDiscCapabilities.Lba450000Readable &&
!report.GdRomSwapDiscCapabilities.Lba45000AudioReadable &&
!report.GdRomSwapDiscCapabilities.Lba50000AudioReadable &&
!report.GdRomSwapDiscCapabilities.Lba100000AudioReadable &&
!report.GdRomSwapDiscCapabilities.Lba400000AudioReadable &&
!report.GdRomSwapDiscCapabilities.Lba450000AudioReadable)
return;
pressedKey = new ConsoleKeyInfo();
@@ -1761,19 +1761,19 @@ public sealed partial class DeviceReport
{
AaruConsole.Write(Localization.Core.Test_read_whole_high_density_area_proceed_Q);
pressedKey = System.Console.ReadKey();
pressedKey = Console.ReadKey();
AaruConsole.WriteLine();
}
if(pressedKey.Key == ConsoleKey.N) return;
uint startingSector = 45000;
var readAsAudio = false;
var aborted = false;
bool readAsAudio = false;
bool aborted = false;
MmcSubchannel subchannel = MmcSubchannel.None;
uint blockSize = 2352;
if(report.GdRomSwapDiscCapabilities.Lba45000Readable == false)
if(!report.GdRomSwapDiscCapabilities.Lba45000Readable)
{
startingSector = 45000;
readAsAudio = false;
@@ -1783,7 +1783,7 @@ public sealed partial class DeviceReport
subchannel = MmcSubchannel.Raw;
else if(report.GdRomSwapDiscCapabilities.Lba45000PqReadable) subchannel = MmcSubchannel.Q16;
}
else if(report.GdRomSwapDiscCapabilities.Lba50000Readable == false)
else if(!report.GdRomSwapDiscCapabilities.Lba50000Readable)
{
startingSector = 50000;
readAsAudio = false;
@@ -1793,7 +1793,7 @@ public sealed partial class DeviceReport
subchannel = MmcSubchannel.Raw;
else if(report.GdRomSwapDiscCapabilities.Lba50000PqReadable) subchannel = MmcSubchannel.Q16;
}
else if(report.GdRomSwapDiscCapabilities.Lba100000Readable == false)
else if(!report.GdRomSwapDiscCapabilities.Lba100000Readable)
{
startingSector = 100000;
readAsAudio = false;
@@ -1803,7 +1803,7 @@ public sealed partial class DeviceReport
subchannel = MmcSubchannel.Raw;
else if(report.GdRomSwapDiscCapabilities.Lba100000PqReadable) subchannel = MmcSubchannel.Q16;
}
else if(report.GdRomSwapDiscCapabilities.Lba400000Readable == false)
else if(!report.GdRomSwapDiscCapabilities.Lba400000Readable)
{
startingSector = 400000;
readAsAudio = false;
@@ -1813,7 +1813,7 @@ public sealed partial class DeviceReport
subchannel = MmcSubchannel.Raw;
else if(report.GdRomSwapDiscCapabilities.Lba400000PqReadable) subchannel = MmcSubchannel.Q16;
}
else if(report.GdRomSwapDiscCapabilities.Lba450000Readable == false)
else if(!report.GdRomSwapDiscCapabilities.Lba450000Readable)
{
startingSector = 450000;
readAsAudio = false;
@@ -1823,7 +1823,7 @@ public sealed partial class DeviceReport
subchannel = MmcSubchannel.Raw;
else if(report.GdRomSwapDiscCapabilities.Lba450000PqReadable) subchannel = MmcSubchannel.Q16;
}
else if(report.GdRomSwapDiscCapabilities.Lba45000AudioReadable == false)
else if(!report.GdRomSwapDiscCapabilities.Lba45000AudioReadable)
{
startingSector = 45000;
readAsAudio = true;
@@ -1833,7 +1833,7 @@ public sealed partial class DeviceReport
subchannel = MmcSubchannel.Raw;
else if(report.GdRomSwapDiscCapabilities.Lba45000AudioPqReadable) subchannel = MmcSubchannel.Q16;
}
else if(report.GdRomSwapDiscCapabilities.Lba50000AudioReadable == false)
else if(!report.GdRomSwapDiscCapabilities.Lba50000AudioReadable)
{
startingSector = 50000;
readAsAudio = true;
@@ -1843,7 +1843,7 @@ public sealed partial class DeviceReport
subchannel = MmcSubchannel.Raw;
else if(report.GdRomSwapDiscCapabilities.Lba50000AudioPqReadable) subchannel = MmcSubchannel.Q16;
}
else if(report.GdRomSwapDiscCapabilities.Lba100000AudioReadable == false)
else if(!report.GdRomSwapDiscCapabilities.Lba100000AudioReadable)
{
startingSector = 100000;
readAsAudio = true;
@@ -1853,7 +1853,7 @@ public sealed partial class DeviceReport
subchannel = MmcSubchannel.Raw;
else if(report.GdRomSwapDiscCapabilities.Lba100000AudioPqReadable) subchannel = MmcSubchannel.Q16;
}
else if(report.GdRomSwapDiscCapabilities.Lba400000AudioReadable == false)
else if(!report.GdRomSwapDiscCapabilities.Lba400000AudioReadable)
{
startingSector = 400000;
readAsAudio = true;
@@ -1863,7 +1863,7 @@ public sealed partial class DeviceReport
subchannel = MmcSubchannel.Raw;
else if(report.GdRomSwapDiscCapabilities.Lba400000AudioPqReadable) subchannel = MmcSubchannel.Q16;
}
else if(report.GdRomSwapDiscCapabilities.Lba450000AudioReadable == false)
else if(!report.GdRomSwapDiscCapabilities.Lba450000AudioReadable)
{
startingSector = 450000;
readAsAudio = true;
@@ -1874,7 +1874,7 @@ public sealed partial class DeviceReport
else if(report.GdRomSwapDiscCapabilities.Lba450000AudioPqReadable) subchannel = MmcSubchannel.Q16;
}
System.Console.CancelKeyPress += (_, e) =>
Console.CancelKeyPress += (_, e) =>
{
e.Cancel = true;
aborted = true;
@@ -1896,7 +1896,7 @@ public sealed partial class DeviceReport
byte[] lastSuccessfulPq = null;
byte[] lastSuccessfulRw = null;
var trackModeChange = false;
bool trackModeChange = false;
AaruConsole.WriteLine();

View File

@@ -34,12 +34,12 @@ using System;
using System.Linq;
using System.Text;
using Aaru.CommonTypes.Metadata;
using Aaru.Console;
using Aaru.Decoders.CD;
using Aaru.Decoders.SCSI;
using Aaru.Decoders.SCSI.MMC;
using Aaru.Devices;
using Aaru.Helpers;
using Aaru.Logging;
using Spectre.Console;
namespace Aaru.Core.Devices.Report;
@@ -52,8 +52,8 @@ public sealed partial class DeviceReport
while(offset + 4 < response.Length)
{
var code = (ushort)((response[offset + 0] << 8) + response[offset + 1]);
var data = new byte[response[offset + 3] + 4];
ushort code = (ushort)((response[offset + 0] << 8) + response[offset + 1]);
byte[] data = new byte[response[offset + 3] + 4];
if(code != 0x0108)
{
@@ -75,7 +75,7 @@ public sealed partial class DeviceReport
/// <returns>MMC features report</returns>
public MmcFeatures ReportMmcFeatures()
{
var sense = true;
bool sense = true;
byte[] buffer = [];
Spectre.ProgressSingleSpinner(ctx =>
@@ -477,7 +477,7 @@ public sealed partial class DeviceReport
if(ftr010C.HasValue)
{
var temp = new byte[4];
byte[] temp = new byte[4];
temp[0] = (byte)((ftr010C.Value.Century & 0xFF00) >> 8);
temp[1] = (byte)(ftr010C.Value.Century & 0xFF);
temp[2] = (byte)((ftr010C.Value.Year & 0xFF00) >> 8);
@@ -579,7 +579,7 @@ public sealed partial class DeviceReport
public TestedMedia ReportMmcMedia(string mediaType, bool tryPlextor, bool tryPioneer, bool tryNec, bool tryHldtst,
bool tryMediaTekF106, bool tryLiteOn)
{
var sense = true;
bool sense = true;
byte[] buffer = [];
byte[] senseBuffer = [];
var mediaTest = new TestedMedia();
@@ -610,7 +610,7 @@ public sealed partial class DeviceReport
if(!sense && !_dev.Error)
{
mediaTest.SupportsReadCapacity16 = true;
var temp = new byte[8];
byte[] temp = new byte[8];
Array.Copy(buffer, 0, temp, 0, 8);
Array.Reverse(temp);
mediaTest.Blocks = BitConverter.ToUInt64(temp, 0) + 1;
@@ -2779,8 +2779,8 @@ public sealed partial class DeviceReport
if(tryMediaTekF106)
{
var triedLba0 = false;
var triedLeadOut = false;
bool triedLba0 = false;
bool triedLeadOut = false;
Spectre.ProgressSingleSpinner(ctx =>
{
@@ -3099,16 +3099,16 @@ public sealed partial class DeviceReport
secondSessionFirstTrack.PFRAME);
// Skip Lead-Out pre-gap
var firstSessionLeadOutLba = (uint)(firstSessionLeadOutTrack.PMIN * 60 * 75 +
firstSessionLeadOutTrack.PSEC * 75 +
firstSessionLeadOutTrack.PFRAME +
150);
uint firstSessionLeadOutLba = (uint)(firstSessionLeadOutTrack.PMIN * 60 * 75 +
firstSessionLeadOutTrack.PSEC * 75 +
firstSessionLeadOutTrack.PFRAME +
150);
// Skip second session track pre-gap
var secondSessionLeadInLba = (uint)(secondSessionFirstTrack.PMIN * 60 * 75 +
secondSessionFirstTrack.PSEC * 75 +
secondSessionFirstTrack.PFRAME -
300);
uint secondSessionLeadInLba = (uint)(secondSessionFirstTrack.PMIN * 60 * 75 +
secondSessionFirstTrack.PSEC * 75 +
secondSessionFirstTrack.PFRAME -
300);
Spectre.ProgressSingleSpinner(ctx =>
{

View File

@@ -35,10 +35,10 @@ using System.Collections.Generic;
using System.Linq;
using Aaru.CommonTypes.Metadata;
using Aaru.CommonTypes.Structs.Devices.SCSI;
using Aaru.Console;
using Aaru.Decoders.SCSI;
using Aaru.Devices;
using Aaru.Helpers;
using Aaru.Logging;
using Spectre.Console;
using Inquiry = Aaru.CommonTypes.Structs.Devices.SCSI.Inquiry;
@@ -50,7 +50,7 @@ public sealed partial class DeviceReport
/// <returns>SCSI report</returns>
public Scsi ReportScsiInquiry()
{
var sense = true;
bool sense = true;
byte[] buffer = [];
Spectre.ProgressSingleSpinner(ctx =>
@@ -85,7 +85,7 @@ public sealed partial class DeviceReport
return inquiry;
// Clear Seagate serial number
for(var i = 36; i <= 43; i++) inquiry[i] = 0;
for(int i = 36; i <= 43; i++) inquiry[i] = 0;
return inquiry;
}
@@ -95,7 +95,7 @@ public sealed partial class DeviceReport
/// <returns>List of decoded SCSI EVPD pages</returns>
public List<ScsiPage> ReportEvpdPages(string vendor)
{
var sense = false;
bool sense = false;
byte[] buffer = [];
Spectre.ProgressSingleSpinner(ctx =>
@@ -135,7 +135,7 @@ public sealed partial class DeviceReport
break;
case 0x80:
var identify = new byte[512];
byte[] identify = new byte[512];
Array.Copy(buffer, 60, identify, 0, 512);
identify = ClearIdentify(identify);
Array.Copy(identify, 0, buffer, 60, 512);
@@ -184,7 +184,7 @@ public sealed partial class DeviceReport
if(pageResponse.Length < 6) return null;
var position = 4;
int position = 4;
while(position < pageResponse.Length)
{
@@ -192,7 +192,7 @@ public sealed partial class DeviceReport
if(length + position + 4 >= pageResponse.Length) length = (byte)(pageResponse.Length - position - 4);
var empty = new byte[length];
byte[] empty = new byte[length];
Array.Copy(empty, 0, pageResponse, position + 4, length);
position += 4 + length;
@@ -226,7 +226,7 @@ public sealed partial class DeviceReport
ScsiModeSensePageControl.Changeable
})
{
var saveBuffer = false;
bool saveBuffer = false;
sense = _dev.ModeSense10(out byte[] mode10Buffer,
out _,
@@ -335,7 +335,7 @@ public sealed partial class DeviceReport
ScsiModeSensePageControl.Changeable
})
{
var saveBuffer = false;
bool saveBuffer = false;
sense = _dev.ModeSense6(out byte[] mode6Buffer,
out _,
@@ -511,7 +511,7 @@ public sealed partial class DeviceReport
public TestedMedia ReportScsiMedia()
{
var mediaTest = new TestedMedia();
var sense = true;
bool sense = true;
byte[] buffer = [];
byte[] senseBuffer = [];
@@ -541,7 +541,7 @@ public sealed partial class DeviceReport
if(!sense && !_dev.Error)
{
mediaTest.SupportsReadCapacity16 = true;
var temp = new byte[8];
byte[] temp = new byte[8];
Array.Copy(buffer, 0, temp, 0, 8);
Array.Reverse(temp);
mediaTest.Blocks = BitConverter.ToUInt64(temp, 0) + 1;
@@ -883,7 +883,7 @@ public sealed partial class DeviceReport
/// <returns>Media report</returns>
public TestedMedia ReportScsi()
{
var sense = true;
bool sense = true;
byte[] buffer = [];
byte[] senseBuffer = [];
@@ -918,7 +918,7 @@ public sealed partial class DeviceReport
if(!sense && !_dev.Error)
{
capabilities.SupportsReadCapacity16 = true;
var temp = new byte[8];
byte[] temp = new byte[8];
Array.Copy(buffer, 0, temp, 0, 8);
Array.Reverse(temp);
capabilities.Blocks = BitConverter.ToUInt64(temp, 0) + 1;

View File

@@ -32,7 +32,7 @@
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Metadata;
using Aaru.Console;
using Aaru.Logging;
using Spectre.Console;
namespace Aaru.Core.Devices.Report;
@@ -44,7 +44,7 @@ public sealed partial class DeviceReport
public MmcSd MmcSdReport()
{
var report = new MmcSd();
var sense = true;
bool sense = true;
byte[] cid = [];
byte[] csd = [];
byte[] ecsd = [];

View File

@@ -33,12 +33,12 @@
using System;
using System.Threading;
using Aaru.CommonTypes.Structs.Devices.SCSI;
using Aaru.Console;
using Aaru.Core.Logging;
using Aaru.Decoders.CD;
using Aaru.Decoders.SCSI;
using Aaru.Decoders.SCSI.MMC;
using Aaru.Devices;
using Aaru.Logging;
using Humanizer;
using Humanizer.Bytes;
@@ -56,8 +56,8 @@ public sealed partial class MediaScan
bool sense;
uint blockSize = 0;
ushort currentProfile = 0x0001;
var foundReadCommand = false;
var readcd = false;
bool foundReadCommand = false;
bool readcd = false;
results.Blocks = 0;
@@ -76,7 +76,7 @@ public sealed partial class MediaScan
{
case 0x3A:
{
var leftRetries = 5;
int leftRetries = 5;
while(leftRetries > 0)
{
@@ -100,7 +100,7 @@ public sealed partial class MediaScan
}
case 0x04 when decSense.Value.ASCQ == 0x01:
{
var leftRetries = 10;
int leftRetries = 10;
while(leftRetries > 0)
{
@@ -128,7 +128,7 @@ public sealed partial class MediaScan
// These should be trapped by the OS but seems in some cases they're not
case 0x28:
{
var leftRetries = 10;
int leftRetries = 10;
while(leftRetries > 0)
{
@@ -219,7 +219,7 @@ public sealed partial class MediaScan
return results;
}
var compactDisc = true;
bool compactDisc = true;
FullTOC.CDFullTOC? toc = null;
if(_dev.ScsiType == PeripheralDeviceTypes.MultiMediaDevice)
@@ -646,11 +646,11 @@ public sealed partial class MediaScan
InitProgress?.Invoke();
for(var i = 0; i < seekTimes; i++)
for(int i = 0; i < seekTimes; i++)
{
if(_aborted || !_seekTest) break;
var seekPos = (uint)rnd.Next((int)results.Blocks);
uint seekPos = (uint)rnd.Next((int)results.Blocks);
PulseProgress?.Invoke(string.Format(Localization.Core.Seeking_to_sector_0, seekPos));

View File

@@ -38,7 +38,7 @@ using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs;
using Aaru.Console;
using Aaru.Logging;
namespace Aaru.Core;
@@ -109,7 +109,7 @@ public sealed class Entropy
currentTrack.Sequence,
inputTracks.Max(t => t.Sequence));
var entTable = new ulong[256];
ulong[] entTable = new ulong[256];
ulong trackSize = 0;
List<string> uniqueSectorsPerTrack = [];
@@ -195,7 +195,7 @@ public sealed class Entropy
if(_inputFormat is not IMediaImage mediaImage) return entropy;
var entTable = new ulong[256];
ulong[] entTable = new ulong[256];
ulong diskSize = 0;
List<string> uniqueSectors = [];
@@ -254,8 +254,8 @@ public sealed class Entropy
if(_inputFormat is not IByteAddressableImage byteAddressableImage) return entropy;
var entTable = new ulong[256];
var data = new byte[byteAddressableImage.Info.Sectors];
ulong[] entTable = new ulong[256];
byte[] data = new byte[byteAddressableImage.Info.Sectors];
entropy.Sectors = _inputFormat.Info.Sectors;
AaruConsole.WriteLine(Localization.Core._0_bytes, entropy.Sectors);
@@ -273,7 +273,7 @@ public sealed class Entropy
if(bytesRead != data.Length)
{
var tmp = new byte[bytesRead];
byte[] tmp = new byte[bytesRead];
Array.Copy(data, 0, tmp, 0, bytesRead);
data = tmp;
}

View File

@@ -35,7 +35,7 @@ using System.Collections.Generic;
using System.Linq;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Logging;
namespace Aaru.Core;

View File

@@ -33,7 +33,7 @@
using System;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Logging;
namespace Aaru.Core;

View File

@@ -41,7 +41,6 @@ using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs;
using Aaru.CommonTypes.Structs.Devices.SCSI;
using Aaru.Console;
using Aaru.Decoders.ATA;
using Aaru.Decoders.Bluray;
using Aaru.Decoders.CD;
@@ -50,6 +49,7 @@ using Aaru.Decoders.PCMCIA;
using Aaru.Decoders.SCSI;
using Aaru.Decoders.Xbox;
using Aaru.Helpers;
using Aaru.Logging;
using Humanizer;
using Humanizer.Bytes;
using Spectre.Console;
@@ -427,7 +427,7 @@ public static class ImageInfo
if(dataLen + 2 != toc.Length)
{
var tmp = new byte[toc.Length + 2];
byte[] tmp = new byte[toc.Length + 2];
Array.Copy(toc, 0, tmp, 2, toc.Length);
tmp[0] = (byte)((toc.Length & 0xFF00) >> 8);
tmp[1] = (byte)(toc.Length & 0xFF);
@@ -450,7 +450,7 @@ public static class ImageInfo
if(dataLen + 2 != pma.Length)
{
var tmp = new byte[pma.Length + 2];
byte[] tmp = new byte[pma.Length + 2];
Array.Copy(pma, 0, tmp, 2, pma.Length);
tmp[0] = (byte)((pma.Length & 0xFF00) >> 8);
tmp[1] = (byte)(pma.Length & 0xFF);
@@ -475,7 +475,7 @@ public static class ImageInfo
if(dataLen + 4 != atip.Length)
{
var tmp = new byte[atip.Length + 4];
byte[] tmp = new byte[atip.Length + 4];
Array.Copy(atip, 0, tmp, 4, atip.Length);
tmp[0] = (byte)((atip.Length & 0xFF000000) >> 24);
tmp[1] = (byte)((atip.Length & 0xFF0000) >> 16);
@@ -502,7 +502,7 @@ public static class ImageInfo
if(dataLen + 4 != cdtext.Length)
{
var tmp = new byte[cdtext.Length + 4];
byte[] tmp = new byte[cdtext.Length + 4];
Array.Copy(cdtext, 0, tmp, 4, cdtext.Length);
tmp[0] = (byte)((cdtext.Length & 0xFF000000) >> 24);
tmp[1] = (byte)((cdtext.Length & 0xFF0000) >> 16);

View File

@@ -39,7 +39,6 @@ using System.Linq;
using System.Text;
using Aaru.Checksums;
using Aaru.CommonTypes;
using Aaru.Console;
using Aaru.Decoders.Bluray;
using Aaru.Decoders.CD;
using Aaru.Decoders.DVD;
@@ -47,6 +46,7 @@ using Aaru.Decoders.SCSI.MMC;
using Aaru.Decoders.Sega;
using Aaru.Devices;
using Aaru.Helpers;
using Aaru.Logging;
using DMI = Aaru.Decoders.Xbox.DMI;
using Sector = Aaru.Decoders.CD.Sector;
@@ -126,7 +126,7 @@ public static class MMC
byte[] syncMark = [0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00];
var testMark = new byte[12];
byte[] testMark = new byte[12];
Array.Copy(sector, 0, testMark, 0, 12);
return syncMark.SequenceEqual(testMark) && (sector[0xF] == 0 || sector[0xF] == 1 || sector[0xF] == 2);
@@ -140,9 +140,9 @@ public static class MMC
byte[] syncMark = [0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00];
var testMark = new byte[12];
byte[] testMark = new byte[12];
for(var i = 0; i <= 2336; i++)
for(int i = 0; i <= 2336; i++)
{
Array.Copy(sector, i, testMark, 0, 12);
@@ -176,7 +176,7 @@ public static class MMC
static byte[] DescrambleAndFixOffset(byte[] sector, int offsetBytes, int sectorsForOffset)
{
var descrambled = new byte[2352];
byte[] descrambled = new byte[2352];
int offsetFix = offsetBytes < 0 ? 2352 * sectorsForOffset + offsetBytes : offsetBytes;
@@ -199,7 +199,7 @@ public static class MMC
if(!isData || sector0[0xF] != 2 && sector0[0xF] != 1) return false;
var testMark = new byte[4];
byte[] testMark = new byte[4];
Array.Copy(sector16, 24, testMark, 0, 4);
return cdiMark.SequenceEqual(testMark);
@@ -209,13 +209,13 @@ public static class MMC
{
if(videoFrame is null || videoFrame.Length < _videoNowColorFrameMarker.Length) return false;
var buffer = new byte[_videoNowColorFrameMarker.Length];
byte[] buffer = new byte[_videoNowColorFrameMarker.Length];
for(var framePosition = 0; framePosition + buffer.Length < videoFrame.Length; framePosition++)
for(int framePosition = 0; framePosition + buffer.Length < videoFrame.Length; framePosition++)
{
Array.Copy(videoFrame, framePosition, buffer, 0, buffer.Length);
for(var ab = 9; ab < buffer.Length; ab += 10) buffer[ab] = 0;
for(int ab = 9; ab < buffer.Length; ab += 10) buffer[ab] = 0;
if(!_videoNowColorFrameMarker.SequenceEqual(buffer)) continue;
@@ -227,13 +227,13 @@ public static class MMC
internal static int GetVideoNowColorOffset(byte[] data)
{
var buffer = new byte[_videoNowColorFrameMarker.Length];
byte[] buffer = new byte[_videoNowColorFrameMarker.Length];
for(var framePosition = 0; framePosition + buffer.Length < data.Length; framePosition++)
for(int framePosition = 0; framePosition + buffer.Length < data.Length; framePosition++)
{
Array.Copy(data, framePosition, buffer, 0, buffer.Length);
for(var ab = 9; ab < buffer.Length; ab += 10) buffer[ab] = 0;
for(int ab = 9; ab < buffer.Length; ab += 10) buffer[ab] = 0;
if(!_videoNowColorFrameMarker.SequenceEqual(buffer)) continue;
@@ -331,10 +331,10 @@ public static class MMC
if(mediaType is MediaType.CD or MediaType.CDROMXA)
{
var hasDataTrack = false;
var hasAudioTrack = false;
var allFirstSessionTracksAreAudio = true;
var hasVideoTrack = false;
bool hasDataTrack = false;
bool hasAudioTrack = false;
bool allFirstSessionTracksAreAudio = true;
bool hasVideoTrack = false;
if(decodedToc.HasValue)
{
@@ -370,11 +370,11 @@ public static class MMC
if((TocControl)(track.CONTROL & 0x0D) == TocControl.DataTrack ||
(TocControl)(track.CONTROL & 0x0D) == TocControl.DataTrackIncremental)
{
var startAddress = (uint)(track.PHOUR * 3600 * 75 +
track.PMIN * 60 * 75 +
track.PSEC * 75 +
track.PFRAME -
150);
uint startAddress = (uint)(track.PHOUR * 3600 * 75 +
track.PMIN * 60 * 75 +
track.PSEC * 75 +
track.PFRAME -
150);
if(startAddress < startOfFirstDataTrack) startOfFirstDataTrack = startAddress;
@@ -488,11 +488,11 @@ public static class MMC
FullTOC.TrackDataDescriptor secondSessionFirstTrackTrack =
decodedToc.Value.TrackDescriptors.First(t => t.POINT == secondSessionFirstTrack);
var firstSectorSecondSessionFirstTrack = (uint)(secondSessionFirstTrackTrack.PHOUR * 3600 * 75 +
secondSessionFirstTrackTrack.PMIN * 60 * 75 +
secondSessionFirstTrackTrack.PSEC * 75 +
secondSessionFirstTrackTrack.PFRAME -
150);
uint firstSectorSecondSessionFirstTrack = (uint)(secondSessionFirstTrackTrack.PHOUR * 3600 * 75 +
secondSessionFirstTrackTrack.PMIN * 60 * 75 +
secondSessionFirstTrackTrack.PSEC * 75 +
secondSessionFirstTrackTrack.PFRAME -
150);
sense = dev.ReadCd(out cmdBuf,
out _,
@@ -579,7 +579,7 @@ public static class MMC
videoNowColorFrame = new byte[9 * 2352];
for(var i = 0; i < 9; i++)
for(int i = 0; i < 9; i++)
{
sense = dev.ReadCd(out cmdBuf,
out _,
@@ -634,11 +634,11 @@ public static class MMC
if(firstTrack?.POINT is >= 1 and < 0xA0)
{
var firstTrackSector = (uint)(firstTrack.Value.PHOUR * 3600 * 75 +
firstTrack.Value.PMIN * 60 * 75 +
firstTrack.Value.PSEC * 75 +
firstTrack.Value.PFRAME -
150);
uint firstTrackSector = (uint)(firstTrack.Value.PHOUR * 3600 * 75 +
firstTrack.Value.PMIN * 60 * 75 +
firstTrack.Value.PSEC * 75 +
firstTrack.Value.PFRAME -
150);
// Check for hidden data before start of track 1
if(firstTrackSector > 0)
@@ -707,8 +707,8 @@ public static class MMC
if(combinedOffset % 2352 != 0) sectorsForOffset++;
var lba0 = 0;
var lba16 = 16;
int lba0 = 0;
int lba16 = 16;
if(combinedOffset < 0)
{
@@ -1602,8 +1602,8 @@ public static class MMC
isoSector[5] != 0x31)
return;
var rootStart = BitConverter.ToUInt32(isoSector, 158);
var rootLength = BitConverter.ToUInt32(isoSector, 166);
uint rootStart = BitConverter.ToUInt32(isoSector, 158);
uint rootLength = BitConverter.ToUInt32(isoSector, 166);
if(rootStart == 0 || rootLength == 0) return;
@@ -1644,7 +1644,7 @@ public static class MMC
if(isoSector.Length < 2048) return;
var rootPos = 0;
int rootPos = 0;
uint pcdStart = 0;
uint pcdLength = 0;
@@ -1652,8 +1652,8 @@ public static class MMC
rootPos < isoSector.Length &&
rootPos + isoSector[rootPos] <= isoSector.Length)
{
int nameLen = isoSector[rootPos + 32];
var tmpName = new byte[nameLen];
int nameLen = isoSector[rootPos + 32];
byte[] tmpName = new byte[nameLen];
Array.Copy(isoSector, rootPos + 33, tmpName, 0, nameLen);
string name = StringHandlers.CToString(tmpName).ToUpperInvariant();
@@ -1705,7 +1705,7 @@ public static class MMC
if(isoSector.Length < 2048) return;
for(var pi = 0; pi < pcdLength; pi++)
for(int pi = 0; pi < pcdLength; pi++)
{
int pcdPos = pi * 2048;
uint infoPos = 0;
@@ -1714,8 +1714,8 @@ public static class MMC
pcdPos < isoSector.Length &&
pcdPos + isoSector[pcdPos] <= isoSector.Length)
{
int nameLen = isoSector[pcdPos + 32];
var tmpName = new byte[nameLen];
int nameLen = isoSector[pcdPos + 32];
byte[] tmpName = new byte[nameLen];
Array.Copy(isoSector, pcdPos + 33, tmpName, 0, nameLen);
string name = StringHandlers.CToString(tmpName).ToUpperInvariant();
@@ -1750,7 +1750,7 @@ public static class MMC
if(sense) break;
var systemId = new byte[8];
byte[] systemId = new byte[8];
Array.Copy(isoSector, 0, systemId, 0, 8);
string id = StringHandlers.CToString(systemId).TrimEnd();
@@ -1842,7 +1842,7 @@ public static class MMC
// The decryption key is applied as XOR. As first byte is originally always NULL, it gives us the key :)
byte decryptByte = ps2BootSectors[0];
for(var i = 0; i < 0x6000; i++) ps2BootSectors[i] ^= decryptByte;
for(int i = 0; i < 0x6000; i++) ps2BootSectors[i] ^= decryptByte;
string ps2BootSectorsHash = Sha256Context.Data(ps2BootSectors, out _);
@@ -1863,7 +1863,7 @@ public static class MMC
if(sector0 != null)
{
var syncBytes = new byte[7];
byte[] syncBytes = new byte[7];
Array.Copy(sector0, 0, syncBytes, 0, 7);
if(_operaId.SequenceEqual(syncBytes))
@@ -1887,8 +1887,8 @@ public static class MMC
if(playdia1 != null && playdia2 != null)
{
var pd1 = new byte[_playdiaCopyright.Length];
var pd2 = new byte[_playdiaCopyright.Length];
byte[] pd1 = new byte[_playdiaCopyright.Length];
byte[] pd2 = new byte[_playdiaCopyright.Length];
Array.Copy(playdia1, 38, pd1, 0, pd1.Length);
Array.Copy(playdia2, 0, pd2, 0, pd1.Length);
@@ -1905,7 +1905,7 @@ public static class MMC
if(secondDataSectorNotZero != null)
{
var pce = new byte[_pcEngineSignature.Length];
byte[] pce = new byte[_pcEngineSignature.Length];
Array.Copy(secondDataSectorNotZero, 32, pce, 0, pce.Length);
if(_pcEngineSignature.SequenceEqual(pce))
@@ -1920,7 +1920,7 @@ public static class MMC
if(firstDataSectorNotZero != null)
{
var pcfx = new byte[_pcFxSignature.Length];
byte[] pcfx = new byte[_pcFxSignature.Length];
Array.Copy(firstDataSectorNotZero, 0, pcfx, 0, pcfx.Length);
if(_pcFxSignature.SequenceEqual(pcfx))
@@ -1935,9 +1935,9 @@ public static class MMC
if(firstTrackSecondSessionAudio != null)
{
var jaguar = new byte[_atariSignature.Length];
byte[] jaguar = new byte[_atariSignature.Length];
for(var i = 0; i + jaguar.Length <= firstTrackSecondSessionAudio.Length; i += 2)
for(int i = 0; i + jaguar.Length <= firstTrackSecondSessionAudio.Length; i += 2)
{
Array.Copy(firstTrackSecondSessionAudio, i, jaguar, 0, jaguar.Length);
@@ -1953,7 +1953,7 @@ public static class MMC
if(firstTrackSecondSession?.Length >= 2336)
{
var milcd = new byte[2048];
byte[] milcd = new byte[2048];
Array.Copy(firstTrackSecondSession, 24, milcd, 0, 2048);
if(Dreamcast.DecodeIPBin(milcd).HasValue)
@@ -2000,13 +2000,13 @@ public static class MMC
if(!sense)
{
var cdg = false;
var cdeg = false;
var cdmidi = false;
bool cdg = false;
bool cdeg = false;
bool cdmidi = false;
for(var i = 0; i < 8; i++)
for(int i = 0; i < 8; i++)
{
var tmpSub = new byte[96];
byte[] tmpSub = new byte[96];
Array.Copy(subBuf, i * 96, tmpSub, 0, 96);
DetectRwPackets(tmpSub, out bool cdgPacket, out bool cdegPacket, out bool cdmidiPacket);
@@ -2121,8 +2121,8 @@ public static class MMC
isoSector[5] != 0x31)
return;
var rootStart = BitConverter.ToUInt32(isoSector, 158);
var rootLength = BitConverter.ToUInt32(isoSector, 166);
uint rootStart = BitConverter.ToUInt32(isoSector, 158);
uint rootLength = BitConverter.ToUInt32(isoSector, 166);
if(rootStart == 0 || rootLength == 0) return;
@@ -2173,7 +2173,7 @@ public static class MMC
uint ps1Start = 0;
uint ps1Length = 0;
for(var ri = 0; ri < rootLength; ri++)
for(int ri = 0; ri < rootLength; ri++)
{
int rootPos = ri * 2048;
@@ -2181,8 +2181,8 @@ public static class MMC
isoSector[rootPos] > 0 &&
rootPos + isoSector[rootPos] <= isoSector.Length)
{
int nameLen = isoSector[rootPos + 32];
var tmpName = new byte[nameLen];
int nameLen = isoSector[rootPos + 32];
byte[] tmpName = new byte[nameLen];
Array.Copy(isoSector, rootPos + 33, tmpName, 0, nameLen);
string name = StringHandlers.CToString(tmpName).ToUpperInvariant();
@@ -2290,8 +2290,8 @@ public static class MMC
{
using var sr = new StringReader(iplTxt);
var correctNeoGeoCd = true;
var lineNumber = 0;
bool correctNeoGeoCd = true;
int lineNumber = 0;
while(sr.Peek() > 0)
{
@@ -2429,7 +2429,7 @@ public static class MMC
uint infoPos = 0;
for(var vi = 0; vi < vcdLength; vi++)
for(int vi = 0; vi < vcdLength; vi++)
{
int vcdPos = vi * 2048;
@@ -2437,8 +2437,8 @@ public static class MMC
isoSector[vcdPos] > 0 &&
vcdPos + isoSector[vcdPos] <= isoSector.Length)
{
int nameLen = isoSector[vcdPos + 32];
var tmpName = new byte[nameLen];
int nameLen = isoSector[vcdPos + 32];
byte[] tmpName = new byte[nameLen];
Array.Copy(isoSector, vcdPos + 33, tmpName, 0, nameLen);
string name = StringHandlers.CToString(tmpName).ToUpperInvariant();
@@ -2474,7 +2474,7 @@ public static class MMC
if(sense) break;
var systemId = new byte[8];
byte[] systemId = new byte[8];
Array.Copy(isoSector, 0, systemId, 0, 8);
string id = StringHandlers.CToString(systemId).TrimEnd();
@@ -2545,7 +2545,7 @@ public static class MMC
uint infoPos = 0;
for(var pi = 0; pi < pcdLength; pi++)
for(int pi = 0; pi < pcdLength; pi++)
{
int pcdPos = pi * 2048;
@@ -2553,8 +2553,8 @@ public static class MMC
isoSector[pcdPos] > 0 &&
pcdPos + isoSector[pcdPos] <= isoSector.Length)
{
int nameLen = isoSector[pcdPos + 32];
var tmpName = new byte[nameLen];
int nameLen = isoSector[pcdPos + 32];
byte[] tmpName = new byte[nameLen];
Array.Copy(isoSector, pcdPos + 33, tmpName, 0, nameLen);
string name = StringHandlers.CToString(tmpName).ToUpperInvariant();
@@ -2590,7 +2590,7 @@ public static class MMC
if(sense) break;
var systemId = new byte[8];
byte[] systemId = new byte[8];
Array.Copy(isoSector, 0, systemId, 0, 8);
string id = StringHandlers.CToString(systemId).TrimEnd();
@@ -2728,7 +2728,7 @@ public static class MMC
// The decryption key is applied as XOR. As first byte is originally always NULL, it gives us the key :)
byte decryptByte = ps2BootSectors[0];
for(var i = 0; i < 0x6000; i++) ps2BootSectors[i] ^= decryptByte;
for(int i = 0; i < 0x6000; i++) ps2BootSectors[i] ^= decryptByte;
string ps2BootSectorsHash = Sha256Context.Data(ps2BootSectors, out _);
@@ -2747,7 +2747,7 @@ public static class MMC
if(sector1 != null)
{
var tmp = new byte[_ps3Id.Length];
byte[] tmp = new byte[_ps3Id.Length];
Array.Copy(sector1, 0, tmp, 0, tmp.Length);
if(tmp.SequenceEqual(_ps3Id))
@@ -2801,7 +2801,7 @@ public static class MMC
case "BDU":
if(sector1 != null)
{
var tmp = new byte[_ps5Id.Length];
byte[] tmp = new byte[_ps5Id.Length];
Array.Copy(sector1, 1024, tmp, 0, tmp.Length);
if(tmp.SequenceEqual(_ps5Id))
@@ -2834,20 +2834,20 @@ public static class MMC
cdegPacket = false;
cdmidiPacket = false;
var cdSubRwPack1 = new byte[24];
var cdSubRwPack2 = new byte[24];
var cdSubRwPack3 = new byte[24];
var cdSubRwPack4 = new byte[24];
byte[] cdSubRwPack1 = new byte[24];
byte[] cdSubRwPack2 = new byte[24];
byte[] cdSubRwPack3 = new byte[24];
byte[] cdSubRwPack4 = new byte[24];
var i = 0;
int i = 0;
for(var j = 0; j < 24; j++) cdSubRwPack1[j] = (byte)(subchannel[i++] & 0x3F);
for(int j = 0; j < 24; j++) cdSubRwPack1[j] = (byte)(subchannel[i++] & 0x3F);
for(var j = 0; j < 24; j++) cdSubRwPack2[j] = (byte)(subchannel[i++] & 0x3F);
for(int j = 0; j < 24; j++) cdSubRwPack2[j] = (byte)(subchannel[i++] & 0x3F);
for(var j = 0; j < 24; j++) cdSubRwPack3[j] = (byte)(subchannel[i++] & 0x3F);
for(int j = 0; j < 24; j++) cdSubRwPack3[j] = (byte)(subchannel[i++] & 0x3F);
for(var j = 0; j < 24; j++) cdSubRwPack4[j] = (byte)(subchannel[i++] & 0x3F);
for(int j = 0; j < 24; j++) cdSubRwPack4[j] = (byte)(subchannel[i++] & 0x3F);
switch(cdSubRwPack1[0])
{

View File

@@ -37,7 +37,6 @@ using System.Threading;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Structs.Devices.SCSI;
using Aaru.Console;
using Aaru.Core.Media.Detection;
using Aaru.Decoders.CD;
using Aaru.Decoders.DVD;
@@ -46,6 +45,7 @@ using Aaru.Decoders.SCSI.MMC;
using Aaru.Decoders.SCSI.SSC;
using Aaru.Decoders.Xbox;
using Aaru.Devices;
using Aaru.Logging;
using DeviceInfo = Aaru.Core.Devices.Info.DeviceInfo;
using DMI = Aaru.Decoders.Xbox.DMI;
using DVDDecryption = Aaru.Decryption.DVD.Dump;
@@ -66,13 +66,13 @@ public sealed class ScsiInfo
MediaType = MediaType.Unknown;
MediaInserted = false;
var resets = 0;
int resets = 0;
bool sense;
byte[] cmdBuf;
byte[] senseBuf;
var containsFloppyPage = false;
var sessions = 1;
var firstTrackLastSession = 1;
bool containsFloppyPage = false;
int sessions = 1;
int firstTrackLastSession = 1;
if(dev.IsRemovable)
{
@@ -97,7 +97,7 @@ public sealed class ScsiInfo
{
case 0x3A:
{
var leftRetries = 5;
int leftRetries = 5;
while(leftRetries > 0)
{
@@ -121,7 +121,7 @@ public sealed class ScsiInfo
}
case 0x04 when decSense?.ASCQ == 0x01:
{
var leftRetries = 10;
int leftRetries = 10;
while(leftRetries > 0)
{
@@ -217,7 +217,7 @@ public sealed class ScsiInfo
if(ReadCapacity16 != null)
{
var temp = new byte[8];
byte[] temp = new byte[8];
Array.Copy(cmdBuf, 0, temp, 0, 8);
Array.Reverse(temp);

View File

@@ -35,7 +35,7 @@ using System.Linq;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs;
using Aaru.Console;
using Aaru.Logging;
namespace Aaru.Core;

View File

@@ -31,9 +31,9 @@
// ****************************************************************************/
using Aaru.CommonTypes.Structs.Devices.SCSI;
using Aaru.Console;
using Aaru.Decoders.SCSI;
using Aaru.Helpers;
using Aaru.Logging;
namespace Aaru.Core;

View File

@@ -41,10 +41,10 @@ using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using Aaru.CommonTypes.Metadata;
using Aaru.Console;
using Aaru.Database;
using Aaru.Database.Models;
using Aaru.Dto;
using Aaru.Logging;
using Microsoft.EntityFrameworkCore;
using Spectre.Console;
using CdOffset = Aaru.Database.Models.CdOffset;

View File

@@ -40,11 +40,11 @@ using Aaru.CommonTypes.AaruMetadata;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs.Devices.ATA;
using Aaru.Console;
using Aaru.Decoders.PCMCIA;
using Aaru.Filters;
using Aaru.Helpers;
using Aaru.Images;
using Aaru.Logging;
using Directory = System.IO.Directory;
using File = System.IO.File;
using MediaType = Aaru.CommonTypes.Metadata.MediaType;
@@ -1026,7 +1026,7 @@ public sealed partial class Sidecar
if(scpImage.ScpTracks.TryGetValue(t, out SuperCardPro.TrackHeader scpTrack))
{
var trackContents =
byte[] trackContents =
new byte[scpTrack.Entries.Last().dataOffset +
scpTrack.Entries.Last().trackLength -
scpImage.Header.offsets[t] +
@@ -1070,7 +1070,7 @@ public sealed partial class Sidecar
string basename = Path.Combine(Path.GetDirectoryName(imagePath), Path.GetFileNameWithoutExtension(imagePath));
var kfDir = false;
bool kfDir = false;
if(_aborted) return;
@@ -1143,7 +1143,7 @@ public sealed partial class Sidecar
}
Stream kfStream = kvp.Value.GetDataForkStream();
var trackContents = new byte[kfStream.Length];
byte[] trackContents = new byte[kfStream.Length];
kfStream.Position = 0;
kfStream.EnsureRead(trackContents, 0, trackContents.Length);
kfBlockTrackType.Size = (ulong)trackContents.Length;
@@ -1235,7 +1235,7 @@ public sealed partial class Sidecar
dfiImage.TrackLengths.TryGetValue(t, out long length))
{
dfiBlockTrackType.Image.Offset = (ulong)offset;
var trackContents = new byte[length];
byte[] trackContents = new byte[length];
dfiStream.Position = offset;
dfiStream.EnsureRead(trackContents, 0, trackContents.Length);
dfiBlockTrackType.Size = (ulong)trackContents.Length;

View File

@@ -37,7 +37,7 @@ using Aaru.CommonTypes.AaruMetadata;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs;
using Aaru.Console;
using Aaru.Logging;
using Directory = Aaru.CommonTypes.AaruMetadata.Directory;
using FileAttributes = Aaru.CommonTypes.Structs.FileAttributes;

View File

@@ -38,8 +38,8 @@ using Aaru.CommonTypes;
using Aaru.CommonTypes.AaruMetadata;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Helpers;
using Aaru.Logging;
namespace Aaru.Core;

View File

@@ -41,9 +41,9 @@ using System.Text.Json;
using System.Threading.Tasks;
using Aaru.CommonTypes.Interop;
using Aaru.CommonTypes.Metadata;
using Aaru.Console;
using Aaru.Database;
using Aaru.Database.Models;
using Aaru.Logging;
using Microsoft.Data.Sqlite;
using Microsoft.EntityFrameworkCore;
using Device = Aaru.Devices.Device;
@@ -211,9 +211,9 @@ public static class Statistics
dto.RemoteOperatingSystems = [];
#if DEBUG
System.Console.WriteLine(Localization.Core.Uploading_statistics);
Console.WriteLine(Localization.Core.Uploading_statistics);
#else
Aaru.Console.AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Uploading_statistics);
Aaru.Logging.AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Uploading_statistics);
#endif
using StringContent jsonContent =
new(JsonSerializer.Serialize(dto, typeof(StatsDto), StatsDtoContext.Default),

View File

@@ -34,7 +34,7 @@
<ProjectReference Include="..\Aaru.Checksums\Aaru.Checksums.csproj"/>
<ProjectReference Include="..\Aaru.CommonTypes\Aaru.CommonTypes.csproj"/>
<ProjectReference Include="..\Aaru.Helpers\Aaru.Helpers.csproj"/>
<ProjectReference Include="..\Aaru.Console\Aaru.Console.csproj"/>
<ProjectReference Include="..\Aaru.Logging\Aaru.Logging.csproj"/>
</ItemGroup>
<ItemGroup>
<Folder Include="Bluray"/>

View File

@@ -33,8 +33,8 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using Aaru.Console;
using Aaru.Helpers;
using Aaru.Logging;
namespace Aaru.Decoders.Bluray;

View File

@@ -33,8 +33,8 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using Aaru.Console;
using Aaru.Helpers;
using Aaru.Logging;
namespace Aaru.Decoders.Bluray;

View File

@@ -33,8 +33,8 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using Aaru.Console;
using Aaru.Helpers;
using Aaru.Logging;
namespace Aaru.Decoders.Bluray;

View File

@@ -34,8 +34,8 @@ using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using Aaru.Console;
using Aaru.Helpers;
using Aaru.Logging;
namespace Aaru.Decoders.Bluray;
@@ -133,7 +133,7 @@ public static class DI
Reserved2 = DIResponse[3]
};
var offset = 4;
int offset = 4;
List<DiscInformationUnits> units = [];
while(true)
@@ -231,7 +231,7 @@ public static class DI
decoded.Units = new DiscInformationUnits[units.Count];
for(var i = 0; i < units.Count; i++) decoded.Units[i] = units[i];
for(int i = 0; i < units.Count; i++) decoded.Units[i] = units[i];
return decoded;
}

View File

@@ -32,8 +32,8 @@
using System.Diagnostics.CodeAnalysis;
using System.Text;
using Aaru.Console;
using Aaru.Helpers;
using Aaru.Logging;
namespace Aaru.Decoders.Bluray;

View File

@@ -33,8 +33,8 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using Aaru.Console;
using Aaru.Helpers;
using Aaru.Logging;
namespace Aaru.Decoders.CD;

View File

@@ -33,8 +33,8 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using Aaru.Console;
using Aaru.Helpers;
using Aaru.Logging;
namespace Aaru.Decoders.CD;
@@ -127,7 +127,7 @@ public static class CDTextOnLeadIn
return null;
}
for(var i = 0; i < (decoded.DataLength - 2) / 18; i++)
for(int i = 0; i < (decoded.DataLength - 2) / 18; i++)
{
decoded.DataPacks[i].HeaderID1 = CDTextResponse[0 + i * 18 + 4];
decoded.DataPacks[i].HeaderID2 = CDTextResponse[1 + i * 18 + 4];

View File

@@ -36,8 +36,8 @@ using System.Linq;
using System.Text;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Structs;
using Aaru.Console;
using Aaru.Helpers;
using Aaru.Logging;
namespace Aaru.Decoders.CD;
@@ -87,7 +87,7 @@ public static class FullTOC
return null;
}
for(var i = 0; i < (decoded.DataLength - 2) / 11; i++)
for(int i = 0; i < (decoded.DataLength - 2) / 11; i++)
{
decoded.TrackDescriptors[i].SessionNumber = CDFullTOCResponse[0 + i * 11 + 4];
decoded.TrackDescriptors[i].ADR = (byte)((CDFullTOCResponse[1 + i * 11 + 4] & 0xF0) >> 4);
@@ -116,7 +116,7 @@ public static class FullTOC
var sb = new StringBuilder();
var lastSession = 0;
int lastSession = 0;
sb.AppendFormat(Localization.First_complete_session_number_0, response.FirstCompleteSession).AppendLine();
sb.AppendFormat(Localization.Last_complete_session_number_0, response.LastCompleteSession).AppendLine();
@@ -642,7 +642,7 @@ public static class FullTOC
case 6:
{
var id = (uint)((descriptor.Min << 16) + (descriptor.Sec << 8) + descriptor.Frame);
uint id = (uint)((descriptor.Min << 16) + (descriptor.Sec << 8) + descriptor.Frame);
sb.AppendFormat(Localization.Disc_ID_0_X6, id & 0x00FFFFFF).AppendLine();
break;

View File

@@ -33,8 +33,8 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using Aaru.Console;
using Aaru.Helpers;
using Aaru.Logging;
namespace Aaru.Decoders.CD;
@@ -84,7 +84,7 @@ public static class PMA
return null;
}
for(var i = 0; i < (decoded.DataLength - 2) / 11; i++)
for(int i = 0; i < (decoded.DataLength - 2) / 11; i++)
{
decoded.PMADescriptors[i].Reserved = CDPMAResponse[0 + i * 11 + 4];
decoded.PMADescriptors[i].ADR = (byte)((CDPMAResponse[1 + i * 11 + 4] & 0xF0) >> 4);
@@ -319,7 +319,7 @@ public static class PMA
break;
case 2:
var id = (uint)((descriptor.Min << 16) + (descriptor.Sec << 8) + descriptor.Frame);
uint id = (uint)((descriptor.Min << 16) + (descriptor.Sec << 8) + descriptor.Frame);
sb.AppendFormat(Localization.Disc_ID_0_X6, id & 0x00FFFFFF).AppendLine();
break;

View File

@@ -32,8 +32,8 @@
using System.Diagnostics.CodeAnalysis;
using System.Text;
using Aaru.Console;
using Aaru.Helpers;
using Aaru.Logging;
namespace Aaru.Decoders.CD;
@@ -80,7 +80,7 @@ public static class Session
return null;
}
for(var i = 0; i < (decoded.DataLength - 2) / 8; i++)
for(int i = 0; i < (decoded.DataLength - 2) / 8; i++)
{
decoded.TrackDescriptors[i].Reserved1 = CDSessionInfoResponse[0 + i * 8 + 4];
decoded.TrackDescriptors[i].ADR = (byte)((CDSessionInfoResponse[1 + i * 8 + 4] & 0xF0) >> 4);

View File

@@ -32,8 +32,8 @@
using System.Diagnostics.CodeAnalysis;
using System.Text;
using Aaru.Console;
using Aaru.Helpers;
using Aaru.Logging;
namespace Aaru.Decoders.CD;
@@ -83,7 +83,7 @@ public static class TOC
return null;
}
for(var i = 0; i < (decoded.DataLength - 2) / 8; i++)
for(int i = 0; i < (decoded.DataLength - 2) / 8; i++)
{
decoded.TrackDescriptors[i].Reserved1 = CDTOCResponse[0 + i * 8 + 4];
decoded.TrackDescriptors[i].ADR = (byte)((CDTOCResponse[1 + i * 8 + 4] & 0xF0) >> 4);

View File

@@ -36,8 +36,8 @@ using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using Aaru.Console;
using Aaru.Localization;
using Aaru.Logging;
namespace Aaru.Decoders.Floppy;
@@ -158,24 +158,24 @@ public static class Apple2
{
if(data is not { Length: 410 }) return null;
var buffer = new byte[data.Length];
byte carry = 0;
byte[] buffer = new byte[data.Length];
byte carry = 0;
for(var i = 0; i < data.Length; i++)
for(int i = 0; i < data.Length; i++)
{
carry ^= ReadTable5and3[data[i]];
buffer[i] = carry;
}
var output = new byte[256];
byte[] output = new byte[256];
for(var i = 0; i < 51; i++)
for(int i = 0; i < 51; i++)
{
byte b1 = buffer[51 * 3 - i];
byte b2 = buffer[51 * 2 - i];
byte b3 = buffer[51 - i];
var b4 = (byte)(((b1 & 2) << 1 | b2 & 2 | (b3 & 2) >> 1) & 0xFF);
var b5 = (byte)(((b1 & 1) << 2 | (b2 & 1) << 1 | b3 & 1) & 0xFF);
byte b4 = (byte)(((b1 & 2) << 1 | b2 & 2 | (b3 & 2) >> 1) & 0xFF);
byte b5 = (byte)(((b1 & 1) << 2 | (b2 & 1) << 1 | b3 & 1) & 0xFF);
output[250 - 5 * i] = (byte)((buffer[i + 51 * 3 + 1] << 3 | b1 >> 2 & 0x7) & 0xFF);
output[251 - 5 * i] = (byte)((buffer[i + 51 * 4 + 1] << 3 | b2 >> 2 & 0x7) & 0xFF);
output[252 - 5 * i] = (byte)((buffer[i + 51 * 5 + 1] << 3 | b3 >> 2 & 0x7) & 0xFF);
@@ -194,16 +194,16 @@ public static class Apple2
{
if(data is not { Length: 342 }) return null;
var buffer = new byte[data.Length];
byte carry = 0;
byte[] buffer = new byte[data.Length];
byte carry = 0;
for(var i = 0; i < data.Length; i++)
for(int i = 0; i < data.Length; i++)
{
carry ^= ReadTable6and2[data[i]];
buffer[i] = carry;
}
var output = new byte[256];
byte[] output = new byte[256];
for(uint i = 0; i < 256; i++)
{
@@ -314,9 +314,9 @@ public static class Apple2
sector.addressField.epilogue[2]);
position += 14;
var syncCount = 0;
var onSync = false;
var gaps = new MemoryStream();
int syncCount = 0;
bool onSync = false;
var gaps = new MemoryStream();
while(data[position] == 0xFF)
{
@@ -454,12 +454,12 @@ public static class Apple2
public static RawTrack MarshalTrack(byte[] data, out int endOffset, int offset = 0)
{
int position = offset;
var firstSector = true;
var onSync = false;
bool firstSector = true;
bool onSync = false;
var gaps = new MemoryStream();
var count = 0;
int count = 0;
List<RawSector> sectors = [];
var trackNumber = new byte[2];
byte[] trackNumber = new byte[2];
endOffset = offset;
while(position < data.Length && data[position] == 0xFF)

View File

@@ -35,8 +35,8 @@ using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Text;
using Aaru.Console;
using Aaru.Localization;
using Aaru.Logging;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.Decoders.Sega;

View File

@@ -35,7 +35,7 @@ using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Text;
using Aaru.Console;
using Aaru.Logging;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.Decoders.Sega;
@@ -199,7 +199,7 @@ public static class Dreamcast
}
}
var iPeripherals = int.Parse(Encoding.ASCII.GetString(ipbin.peripherals), NumberStyles.HexNumber);
int iPeripherals = int.Parse(Encoding.ASCII.GetString(ipbin.peripherals), NumberStyles.HexNumber);
if((iPeripherals & 0x00000001) == 0x00000001) IPBinInformation.AppendLine(Localization.Game_uses_Windows_CE);

View File

@@ -35,7 +35,7 @@ using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Text;
using Aaru.Console;
using Aaru.Logging;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.Decoders.Sega;

View File

@@ -36,9 +36,9 @@
using System;
using System.Linq;
using Aaru.Console;
using Aaru.Decoders.DVD;
using Aaru.Devices;
using Aaru.Logging;
namespace Aaru.Decryption.DVD;
@@ -62,7 +62,7 @@ public sealed class Dump(Device dev)
out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[12];
byte[] cdb = new byte[12];
buffer = new byte[8];
cdb[0] = (byte)ScsiCommands.ReportKey;
@@ -94,7 +94,7 @@ public sealed class Dump(Device dev)
out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[12];
byte[] cdb = new byte[12];
buffer = new byte[8];
cdb[0] = (byte)ScsiCommands.ReportKey;
@@ -126,7 +126,7 @@ public sealed class Dump(Device dev)
out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[12];
byte[] cdb = new byte[12];
buffer = [];
cdb[0] = (byte)ScsiCommands.ReportKey;
@@ -158,7 +158,7 @@ public sealed class Dump(Device dev)
out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[12];
byte[] cdb = new byte[12];
buffer = new byte[8];
cdb[0] = (byte)ScsiCommands.ReportKey;
@@ -190,7 +190,7 @@ public sealed class Dump(Device dev)
out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[12];
byte[] cdb = new byte[12];
buffer = new byte[12];
cdb[0] = (byte)ScsiCommands.ReportKey;
@@ -222,7 +222,7 @@ public sealed class Dump(Device dev)
out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[12];
byte[] cdb = new byte[12];
buffer = new byte[16];
cdb[0] = (byte)ScsiCommands.ReportKey;
@@ -255,7 +255,7 @@ public sealed class Dump(Device dev)
uint timeout, out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[12];
byte[] cdb = new byte[12];
buffer = new byte[16];
cdb[0] = (byte)ScsiCommands.SendKey;
@@ -301,7 +301,7 @@ public sealed class Dump(Device dev)
out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[12];
byte[] cdb = new byte[12];
buffer = new byte[12];
cdb[0] = (byte)ScsiCommands.SendKey;
@@ -339,7 +339,7 @@ public sealed class Dump(Device dev)
public bool ReadDiscKey(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[12];
byte[] cdb = new byte[12];
buffer = new byte[2052];
cdb[0] = (byte)ScsiCommands.ReadDiscStructure;
@@ -369,10 +369,10 @@ public sealed class Dump(Device dev)
buffer = [];
senseBuffer = new byte[64];
var sense = false;
var challenge = new byte[CHALLENGE_SIZE];
var key1 = new byte[KEY_SIZE];
byte variant = 0;
bool sense = false;
byte[] challenge = new byte[CHALLENGE_SIZE];
byte[] key1 = new byte[KEY_SIZE];
byte variant = 0;
for(byte i = 0; i < 4; i++)
{
@@ -478,7 +478,7 @@ public sealed class Dump(Device dev)
BusKey = buffer;
senseBuffer = new byte[64];
var cdb = new byte[12];
byte[] cdb = new byte[12];
buffer = new byte[12];
cdb[0] = (byte)ScsiCommands.ReportKey;

View File

@@ -36,7 +36,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Aaru.CommonTypes\Aaru.CommonTypes.csproj"/>
<ProjectReference Include="..\Aaru.Console\Aaru.Console.csproj"/>
<ProjectReference Include="..\Aaru.Logging\Aaru.Logging.csproj"/>
<ProjectReference Include="..\Aaru.Decoders\Aaru.Decoders.csproj"/>
<ProjectReference Include="..\Aaru.Helpers\Aaru.Helpers.csproj"/>
</ItemGroup>

View File

@@ -30,8 +30,8 @@
// Copyright © 2011-2025 Natalia Portillo
// ****************************************************************************/
using Aaru.Console;
using Aaru.Decoders.ATA;
using Aaru.Logging;
// ReSharper disable UnusedMember.Global

View File

@@ -30,8 +30,8 @@
// Copyright © 2011-2025 Natalia Portillo
// ****************************************************************************/
using Aaru.Console;
using Aaru.Decoders.ATA;
using Aaru.Logging;
namespace Aaru.Devices;

View File

@@ -31,8 +31,8 @@
// ****************************************************************************/
using System.Diagnostics.CodeAnalysis;
using Aaru.Console;
using Aaru.Decoders.ATA;
using Aaru.Logging;
// ReSharper disable UnusedMember.Global

View File

@@ -30,8 +30,8 @@
// Copyright © 2011-2025 Natalia Portillo
// ****************************************************************************/
using Aaru.Console;
using Aaru.Decoders.ATA;
using Aaru.Logging;
namespace Aaru.Devices;

View File

@@ -30,8 +30,8 @@
// Copyright © 2011-2025 Natalia Portillo
// ****************************************************************************/
using Aaru.Console;
using Aaru.Decoders.ATA;
using Aaru.Logging;
namespace Aaru.Devices;

View File

@@ -31,8 +31,8 @@
// ****************************************************************************/
using System.Diagnostics.CodeAnalysis;
using Aaru.Console;
using Aaru.Decoders.ATA;
using Aaru.Logging;
// ReSharper disable UnusedMember.Global

View File

@@ -30,8 +30,8 @@
// Copyright © 2011-2025 Natalia Portillo
// ****************************************************************************/
using Aaru.Console;
using Aaru.Decoders.ATA;
using Aaru.Logging;
namespace Aaru.Devices;

View File

@@ -33,7 +33,7 @@
using System;
using System.Runtime.InteropServices;
using Aaru.CommonTypes.Interop;
using Aaru.Console;
using Aaru.Logging;
namespace Aaru.Devices;

View File

@@ -31,7 +31,7 @@
// ****************************************************************************/
using System;
using Aaru.Console;
using Aaru.Logging;
// ReSharper disable UnusedMember.Global
@@ -206,7 +206,7 @@ public partial class Device
public bool Read(out byte[] buffer, out uint[] response, uint lba, uint blockSize, ushort transferLength,
bool byteAddressed, uint timeout, out double duration)
{
var sense = true;
bool sense = true;
buffer = null;
response = null;
duration = -1;
@@ -342,9 +342,9 @@ public partial class Device
ushort transferLength, bool byteAddressed, uint timeout, out double duration)
{
buffer = new byte[transferLength * blockSize];
var blockBuffer = new byte[blockSize];
byte[] blockBuffer = new byte[blockSize];
duration = 0;
var sense = true;
bool sense = true;
response = null;
for(uint i = 0; i < transferLength; i++)

View File

@@ -30,7 +30,7 @@
// Copyright © 2011-2025 Natalia Portillo
// ****************************************************************************/
using Aaru.Console;
using Aaru.Logging;
namespace Aaru.Devices;

View File

@@ -32,7 +32,7 @@
// ****************************************************************************/
using System;
using Aaru.Console;
using Aaru.Logging;
// ReSharper disable UnusedMember.Global
@@ -61,7 +61,7 @@ public partial class Device
out double duration)
{
buffer = new byte[8];
var cdb = new byte[6];
byte[] cdb = new byte[6];
senseBuffer = new byte[64];
cdb[0] = (byte)ScsiCommands.AdaptecTranslate;
@@ -105,9 +105,9 @@ public partial class Device
public bool AdaptecSetErrorThreshold(byte threshold, out byte[] senseBuffer, bool drive1, uint timeout,
out double duration)
{
var buffer = new byte[1];
byte[] buffer = new byte[1];
buffer[0] = threshold;
var cdb = new byte[6];
byte[] cdb = new byte[6];
senseBuffer = new byte[64];
cdb[0] = (byte)ScsiCommands.AdaptecSetErrorThreshold;
@@ -149,7 +149,7 @@ public partial class Device
out double duration)
{
buffer = new byte[9];
var cdb = new byte[6];
byte[] cdb = new byte[6];
senseBuffer = new byte[64];
cdb[0] = (byte)ScsiCommands.AdaptecTranslate;
@@ -180,10 +180,10 @@ public partial class Device
/// <param name="duration">Duration.</param>
public bool AdaptecWriteBuffer(byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration)
{
var oneKBuffer = new byte[1024];
byte[] oneKBuffer = new byte[1024];
Array.Copy(buffer, 0, oneKBuffer, 0, buffer.Length < 1024 ? buffer.Length : 1024);
var cdb = new byte[6];
byte[] cdb = new byte[6];
senseBuffer = new byte[64];
cdb[0] = (byte)ScsiCommands.AdaptecWriteBuffer;
@@ -211,7 +211,7 @@ public partial class Device
public bool AdaptecReadBuffer(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration)
{
buffer = new byte[1024];
var cdb = new byte[6];
byte[] cdb = new byte[6];
senseBuffer = new byte[64];
cdb[0] = (byte)ScsiCommands.AdaptecReadBuffer;

View File

@@ -30,7 +30,7 @@
// Copyright © 2011-2025 Natalia Portillo
// ****************************************************************************/
using Aaru.Console;
using Aaru.Logging;
// ReSharper disable UnusedMember.Global
@@ -48,7 +48,7 @@ public partial class Device
out double duration)
{
buffer = new byte[3];
var cdb = new byte[6];
byte[] cdb = new byte[6];
senseBuffer = new byte[64];
cdb[0] = (byte)ScsiCommands.ArchiveRequestBlockAddress;
@@ -92,7 +92,7 @@ public partial class Device
out double duration)
{
byte[] buffer = [];
var cdb = new byte[6];
byte[] cdb = new byte[6];
senseBuffer = new byte[64];
cdb[0] = (byte)ScsiCommands.ArchiveSeekBlock;

View File

@@ -31,7 +31,7 @@
// ****************************************************************************/
using System.Diagnostics.CodeAnalysis;
using Aaru.Console;
using Aaru.Logging;
namespace Aaru.Devices;
@@ -60,7 +60,7 @@ public partial class Device
public bool CertanceParkUnpark(out byte[] senseBuffer, bool park, uint timeout, out double duration)
{
byte[] buffer = [];
var cdb = new byte[6];
byte[] cdb = new byte[6];
senseBuffer = new byte[64];
cdb[0] = (byte)ScsiCommands.CertanceParkUnpark;

View File

@@ -32,8 +32,8 @@
using System;
using System.Text;
using Aaru.Console;
using Aaru.Helpers;
using Aaru.Logging;
namespace Aaru.Devices;
@@ -52,12 +52,12 @@ public partial class Device
string secondHalf, uint timeout, out double duration)
{
byte[] tmp;
var firstHalfBytes = new byte[8];
var secondHalfBytes = new byte[8];
var buffer = new byte[17];
var displayLen = false;
var halfMsg = false;
var cdb = new byte[10];
byte[] firstHalfBytes = new byte[8];
byte[] secondHalfBytes = new byte[8];
byte[] buffer = new byte[17];
bool displayLen = false;
bool halfMsg = false;
byte[] cdb = new byte[10];
if(!string.IsNullOrWhiteSpace(firstHalf))
{

View File

@@ -32,9 +32,9 @@
using System.Collections.Generic;
using Aaru.CommonTypes.Enums;
using Aaru.Console;
using Aaru.Decoders.DVD;
using Aaru.Helpers;
using Aaru.Logging;
namespace Aaru.Devices;
@@ -60,7 +60,7 @@ public partial class Device
Read12(out _, out _, 0, false, false, false, false, lba, 2048, 0, 16, false, timeout, out duration);
senseBuffer = new byte[64];
var cdb = new byte[12];
byte[] cdb = new byte[12];
buffer = new byte[2064 * transferLength];
uint cacheDataOffset = 0x80000000 + lba % 96 * 2064;
@@ -110,12 +110,12 @@ public partial class Device
static bool CheckSectorNumber(IReadOnlyList<byte> buffer, uint firstLba, uint transferLength, uint layerbreak,
bool otp)
{
for(var i = 0; i < transferLength; i++)
for(int i = 0; i < transferLength; i++)
{
byte layer = (byte)(buffer[0 + 2064 * i] & 0x1);
byte[] sectorBuffer = [0x0, buffer[1 + 2064 * i], buffer[2 + 2064 * i], buffer[3 + 2064 * i]];
var sectorNumber = BigEndianBitConverter.ToUInt32(sectorBuffer, 0);
uint sectorNumber = BigEndianBitConverter.ToUInt32(sectorBuffer, 0);
if(otp)
@@ -149,7 +149,7 @@ public partial class Device
{
if(layer != 1) return IsCorrectSlPsn(sectorNumber, lba);
return sectorNumber == (lba - layerbreak) + 0x30000;
return sectorNumber == lba - layerbreak + 0x30000;
}
/// <summary>

View File

@@ -30,7 +30,7 @@
// Copyright © 2011-2025 Natalia Portillo
// ****************************************************************************/
using Aaru.Console;
using Aaru.Logging;
// ReSharper disable UnusedMember.Global
@@ -71,7 +71,7 @@ public partial class Device
ushort blockBytes, bool pba, bool sectorCount, uint timeout, out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[10];
byte[] cdb = new byte[10];
cdb[0] = (byte)ScsiCommands.ReadLong;

View File

@@ -31,7 +31,7 @@
// ****************************************************************************/
using System;
using Aaru.Console;
using Aaru.Logging;
namespace Aaru.Devices;
@@ -45,7 +45,7 @@ public partial class Device
public bool KreonDeprecatedUnlock(out byte[] senseBuffer, uint timeout, out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[10];
byte[] cdb = new byte[10];
byte[] buffer = [];
cdb[0] = (byte)ScsiCommands.KreonCommand;
@@ -101,7 +101,7 @@ public partial class Device
public bool KreonSetLockState(out byte[] senseBuffer, KreonLockStates state, uint timeout, out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[10];
byte[] cdb = new byte[10];
byte[] buffer = [];
cdb[0] = (byte)ScsiCommands.KreonCommand;
@@ -135,8 +135,8 @@ public partial class Device
out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[10];
var buffer = new byte[26];
byte[] cdb = new byte[10];
byte[] buffer = new byte[26];
features = 0;
cdb[0] = (byte)ScsiCommands.KreonCommand;
@@ -160,9 +160,9 @@ public partial class Device
if(buffer[0] != 0xA5 || buffer[1] != 0x5A || buffer[2] != 0x5A || buffer[3] != 0xA5) return true;
for(var i = 4; i < 26; i += 2)
for(int i = 4; i < 26; i += 2)
{
var feature = BitConverter.ToUInt16(buffer, i);
ushort feature = BitConverter.ToUInt16(buffer, i);
if(feature == 0x0000) break;
@@ -225,7 +225,7 @@ public partial class Device
byte requestNumber = 0x00)
{
buffer = new byte[2048];
var cdb = new byte[12];
byte[] cdb = new byte[12];
senseBuffer = new byte[64];
cdb[0] = (byte)ScsiCommands.KreonSsCommand;

View File

@@ -32,13 +32,13 @@
using System;
using Aaru.CommonTypes.Enums;
using Aaru.Console;
using Aaru.Logging;
namespace Aaru.Devices;
public partial class Device
{
private uint _bufferOffset = 0;
private uint _bufferOffset;
/// <summary>Reads a "raw" sector from DVD on Lite-On drives.</summary>
/// <returns><c>true</c> if the command failed and <paramref name="senseBuffer" /> contains the sense buffer.</returns>
@@ -115,7 +115,7 @@ public partial class Device
Read12(out _, out _, 0, false, false, false, false, lba, 2048, 0, 16, false, timeout, out duration);
senseBuffer = new byte[64];
var cdb = new byte[10];
byte[] cdb = new byte[10];
buffer = new byte[transferLength];
@@ -268,10 +268,7 @@ public partial class Device
{
LiteOnReadBuffer(out byte[] buffer, out byte[] _, i * 2384, 2384, timeout, out double _, lba);
if(CheckSectorNumber(buffer, lba, 1, layerbreak, otp))
{
return (int)i;
}
if(CheckSectorNumber(buffer, lba, 1, layerbreak, otp)) return (int)i;
}
return -1;
@@ -288,14 +285,11 @@ public partial class Device
{
// TODO: Save ECC instead of just throwing it away
var deinterleaved = new byte[2064 * transferLength];
byte[] deinterleaved = new byte[2064 * transferLength];
for(var j = 0; j < transferLength; j++)
for(int j = 0; j < transferLength; j++)
{
for(var i = 0; i < 12; i++)
{
Array.Copy(buffer, (j * 2384) + (i * 182), deinterleaved, (j * 2064) + (i * 172), 172);
}
for(int i = 0; i < 12; i++) Array.Copy(buffer, j * 2384 + i * 182, deinterleaved, j * 2064 + i * 172, 172);
}
return deinterleaved;

View File

@@ -33,7 +33,7 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using Aaru.Console;
using Aaru.Logging;
// ReSharper disable UnusedMember.Global
@@ -79,7 +79,7 @@ public partial class Device
MmcGetConfigurationRt rt, uint timeout, out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[10];
byte[] cdb = new byte[10];
buffer = new byte[8];
cdb[0] = (byte)ScsiCommands.GetConfiguration;
@@ -102,7 +102,7 @@ public partial class Device
if(sense) return true;
var confLength = (ushort)((buffer[2] << 8) + buffer[3] + 4);
ushort confLength = (ushort)((buffer[2] << 8) + buffer[3] + 4);
buffer = new byte[confLength];
cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8);
cdb[8] = (byte)(buffer.Length & 0xFF);
@@ -146,7 +146,7 @@ public partial class Device
uint timeout, out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[12];
byte[] cdb = new byte[12];
buffer = new byte[8];
cdb[0] = (byte)ScsiCommands.ReadDiscStructure;
@@ -173,7 +173,7 @@ public partial class Device
if(sense) return true;
var strctLength = (ushort)((buffer[0] << 8) + buffer[1] + 2);
ushort strctLength = (ushort)((buffer[0] << 8) + buffer[1] + 2);
// WORKAROUND: Some drives return incorrect length information. As these structures are fixed length just apply known length.
if(mediaType == MmcDiscStructureMediaType.Bd)
@@ -313,7 +313,7 @@ public partial class Device
byte trackSessionNumber, uint timeout, out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[10];
byte[] cdb = new byte[10];
byte[] tmpBuffer = (format & 0x0F) == 5 ? new byte[32768] : new byte[1536];
@@ -336,7 +336,7 @@ public partial class Device
Error = LastError != 0;
var strctLength = (uint)((tmpBuffer[0] << 8) + tmpBuffer[1] + 2);
uint strctLength = (uint)((tmpBuffer[0] << 8) + tmpBuffer[1] + 2);
buffer = new byte[strctLength];
if(buffer.Length <= tmpBuffer.Length)
@@ -407,8 +407,8 @@ public partial class Device
uint timeout, out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[10];
var tmpBuffer = new byte[804];
byte[] cdb = new byte[10];
byte[] tmpBuffer = new byte[804];
cdb[0] = (byte)ScsiCommands.ReadDiscInformation;
cdb[1] = (byte)dataType;
@@ -425,7 +425,7 @@ public partial class Device
Error = LastError != 0;
var strctLength = (uint)((tmpBuffer[0] << 8) + tmpBuffer[1] + 2);
uint strctLength = (uint)((tmpBuffer[0] << 8) + tmpBuffer[1] + 2);
if(strctLength > tmpBuffer.Length) strctLength = (uint)tmpBuffer.Length;
@@ -466,7 +466,7 @@ public partial class Device
out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[12];
byte[] cdb = new byte[12];
cdb[0] = (byte)ScsiCommands.ReadCd;
cdb[1] = (byte)((byte)expectedSectorType << 2);
@@ -550,7 +550,7 @@ public partial class Device
out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[12];
byte[] cdb = new byte[12];
cdb[0] = (byte)ScsiCommands.ReadCdMsf;
cdb[1] = (byte)((byte)expectedSectorType << 2);
@@ -574,7 +574,7 @@ public partial class Device
cdb[10] = (byte)subchannel;
var transferLength = (uint)((cdb[6] - cdb[3]) * 60 * 75 + (cdb[7] - cdb[4]) * 75 + (cdb[8] - cdb[5]));
uint transferLength = (uint)((cdb[6] - cdb[3]) * 60 * 75 + (cdb[7] - cdb[4]) * 75 + (cdb[8] - cdb[5]));
buffer = new byte[blockSize * transferLength];
@@ -636,7 +636,7 @@ public partial class Device
out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[6];
byte[] cdb = new byte[6];
byte[] buffer = [];
cdb[0] = (byte)ScsiCommands.PreventAllowMediumRemoval;
@@ -714,7 +714,7 @@ public partial class Device
bool changeFormatLayer, bool loadEject, bool start, uint timeout, out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[6];
byte[] cdb = new byte[6];
byte[] buffer = [];
cdb[0] = (byte)ScsiCommands.StartStopUnit;
@@ -772,7 +772,7 @@ public partial class Device
public bool ReadMcn(out string mcn, out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[10];
byte[] cdb = new byte[10];
mcn = null;
cdb[0] = (byte)ScsiCommands.ReadSubChannel;
@@ -818,7 +818,7 @@ public partial class Device
out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[10];
byte[] cdb = new byte[10];
isrc = null;
cdb[0] = (byte)ScsiCommands.ReadSubChannel;
@@ -866,7 +866,7 @@ public partial class Device
ushort writeSpeed, uint timeout, out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[12];
byte[] cdb = new byte[12];
byte[] buffer = [];
cdb[0] = (byte)ScsiCommands.SetCdRomSpeed;
@@ -912,7 +912,7 @@ public partial class Device
uint address, uint timeout, out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[10];
byte[] cdb = new byte[10];
buffer = new byte[48];
cdb[0] = (byte)ScsiCommands.ReadTrackInformation;

View File

@@ -30,7 +30,7 @@
// Copyright © 2011-2025 Natalia Portillo
// ****************************************************************************/
using Aaru.Console;
using Aaru.Logging;
namespace Aaru.Devices;
@@ -48,7 +48,7 @@ public partial class Device
out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[10];
byte[] cdb = new byte[10];
buffer = new byte[length];
cdb[0] = (byte)ScsiCommands.MediaTekVendorCommand;

View File

@@ -32,7 +32,7 @@
// ReSharper disable InconsistentNaming
using Aaru.Console;
using Aaru.Logging;
// ReSharper disable UnusedMember.Global
@@ -50,7 +50,7 @@ public partial class Device
{
const ushort transferLength = 2336;
senseBuffer = new byte[64];
var cdb = new byte[10];
byte[] cdb = new byte[10];
cdb[0] = (byte)ScsiCommands.MiniDiscReadDTOC;
@@ -86,7 +86,7 @@ public partial class Device
{
const ushort transferLength = 2336;
senseBuffer = new byte[64];
var cdb = new byte[10];
byte[] cdb = new byte[10];
cdb[0] = (byte)ScsiCommands.MiniDiscReadUTOC;
@@ -124,7 +124,7 @@ public partial class Device
{
const ushort transferLength = 4;
senseBuffer = new byte[64];
var cdb = new byte[10];
byte[] cdb = new byte[10];
cdb[0] = (byte)ScsiCommands.MiniDiscD5;
@@ -157,7 +157,7 @@ public partial class Device
public bool MiniDiscStopPlaying(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[10];
byte[] cdb = new byte[10];
cdb[0] = (byte)ScsiCommands.MiniDiscStopPlay;
@@ -188,7 +188,7 @@ public partial class Device
{
const ushort transferLength = 4;
senseBuffer = new byte[64];
var cdb = new byte[10];
byte[] cdb = new byte[10];
cdb[0] = (byte)ScsiCommands.MiniDiscReadPosition;
@@ -222,7 +222,7 @@ public partial class Device
{
const ushort transferLength = 8;
senseBuffer = new byte[64];
var cdb = new byte[10];
byte[] cdb = new byte[10];
cdb[0] = (byte)ScsiCommands.MiniDiscGetType;

View File

@@ -30,7 +30,7 @@
// Copyright © 2011-2025 Natalia Portillo
// ****************************************************************************/
using Aaru.Console;
using Aaru.Logging;
namespace Aaru.Devices;
@@ -48,7 +48,7 @@ public partial class Device
out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[10];
byte[] cdb = new byte[10];
cdb[0] = (byte)ScsiCommands.NecReadCdDa;
cdb[2] = (byte)((lba & 0xFF000000) >> 24);

View File

@@ -30,8 +30,8 @@
// Copyright © 2011-2025 Natalia Portillo
// ****************************************************************************/
using Aaru.Console;
using Aaru.Decoders.SCSI;
using Aaru.Logging;
namespace Aaru.Devices;
@@ -62,7 +62,7 @@ public partial class Device
out uint foundBlocks, uint timeout, out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[10];
byte[] cdb = new byte[10];
byte[] buffer = [];
foundLba = 0;
foundBlocks = 0;

View File

@@ -30,7 +30,7 @@
// Copyright © 2011-2025 Natalia Portillo
// ****************************************************************************/
using Aaru.Console;
using Aaru.Logging;
namespace Aaru.Devices;
@@ -50,7 +50,7 @@ public partial class Device
uint transferLength, PioneerSubchannel subchannel, uint timeout, out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[12];
byte[] cdb = new byte[12];
cdb[0] = (byte)ScsiCommands.ReadCdDa;
cdb[2] = (byte)((lba & 0xFF000000) >> 24);
@@ -93,7 +93,7 @@ public partial class Device
uint blockSize, PioneerSubchannel subchannel, uint timeout, out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[12];
byte[] cdb = new byte[12];
cdb[0] = (byte)ScsiCommands.ReadCdDaMsf;
cdb[3] = (byte)((startMsf & 0xFF0000) >> 16);
@@ -104,7 +104,7 @@ public partial class Device
cdb[9] = (byte)(endMsf & 0xFF);
cdb[10] = (byte)subchannel;
var transferLength = (uint)((cdb[7] - cdb[3]) * 60 * 75 + (cdb[8] - cdb[4]) * 75 + (cdb[9] - cdb[5]));
uint transferLength = (uint)((cdb[7] - cdb[3]) * 60 * 75 + (cdb[8] - cdb[4]) * 75 + (cdb[9] - cdb[5]));
buffer = new byte[blockSize * transferLength];
LastError = SendScsiCommand(cdb,
@@ -139,7 +139,7 @@ public partial class Device
bool errorFlags, bool wholeSector, uint timeout, out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[12];
byte[] cdb = new byte[12];
cdb[0] = (byte)ScsiCommands.ReadCdXa;
cdb[2] = (byte)((lba & 0xFF000000) >> 24);

View File

@@ -30,7 +30,7 @@
// Copyright © 2011-2025 Natalia Portillo
// ****************************************************************************/
using Aaru.Console;
using Aaru.Logging;
// ReSharper disable UnusedMember.Global
@@ -92,7 +92,7 @@ public partial class Device
uint timeout, out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[10];
byte[] cdb = new byte[10];
cdb[0] = (byte)ScsiCommands.PlasmonReadSectorLocation;
cdb[2] = (byte)((address & 0xFF000000) >> 24);

View File

@@ -30,8 +30,8 @@
// Copyright © 2011-2025 Natalia Portillo
// ****************************************************************************/
using Aaru.Console;
using Aaru.Helpers;
using Aaru.Logging;
namespace Aaru.Devices;
@@ -51,7 +51,7 @@ public partial class Device
uint transferLength, PlextorSubchannel subchannel, uint timeout, out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[12];
byte[] cdb = new byte[12];
cdb[0] = (byte)ScsiCommands.ReadCdDa;
cdb[2] = (byte)((lba & 0xFF000000) >> 24);
@@ -102,7 +102,7 @@ public partial class Device
uint timeout, out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[10];
byte[] cdb = new byte[10];
buffer = new byte[2064 * transferLength];
cdb[0] = (byte)ScsiCommands.ReadBuffer;
@@ -139,7 +139,7 @@ public partial class Device
{
buffer = new byte[256];
senseBuffer = new byte[64];
var cdb = new byte[12];
byte[] cdb = new byte[12];
cdb[0] = (byte)ScsiCommands.PlextorReadEeprom;
cdb[8] = 1;
@@ -169,7 +169,7 @@ public partial class Device
{
buffer = new byte[512];
senseBuffer = new byte[64];
var cdb = new byte[12];
byte[] cdb = new byte[12];
cdb[0] = (byte)ScsiCommands.PlextorReadEeprom;
cdb[8] = 2;
@@ -202,7 +202,7 @@ public partial class Device
{
buffer = new byte[blockSize];
senseBuffer = new byte[64];
var cdb = new byte[12];
byte[] cdb = new byte[12];
cdb[0] = (byte)ScsiCommands.PlextorReadEeprom;
cdb[1] = 1;
@@ -236,9 +236,9 @@ public partial class Device
public bool PlextorGetSpeeds(out byte[] senseBuffer, out ushort selected, out ushort max, out ushort last,
uint timeout, out double duration)
{
var buf = new byte[10];
byte[] buf = new byte[10];
senseBuffer = new byte[64];
var cdb = new byte[12];
byte[] cdb = new byte[12];
selected = 0;
max = 0;
@@ -278,9 +278,9 @@ public partial class Device
public bool PlextorGetPoweRec(out byte[] senseBuffer, out bool enabled, out ushort speed, uint timeout,
out double duration)
{
var buf = new byte[8];
byte[] buf = new byte[8];
senseBuffer = new byte[64];
var cdb = new byte[12];
byte[] cdb = new byte[12];
enabled = false;
speed = 0;
@@ -319,7 +319,7 @@ public partial class Device
{
buffer = new byte[8];
senseBuffer = new byte[64];
var cdb = new byte[12];
byte[] cdb = new byte[12];
cdb[0] = (byte)ScsiCommands.PlextorExtend;
cdb[1] = (byte)PlextorSubCommands.GetMode;
@@ -352,7 +352,7 @@ public partial class Device
{
buffer = new byte[8];
senseBuffer = new byte[64];
var cdb = new byte[12];
byte[] cdb = new byte[12];
cdb[0] = (byte)ScsiCommands.PlextorExtend;
cdb[1] = (byte)PlextorSubCommands.GetMode;
@@ -386,7 +386,7 @@ public partial class Device
{
buffer = new byte[8];
senseBuffer = new byte[64];
var cdb = new byte[12];
byte[] cdb = new byte[12];
cdb[0] = (byte)ScsiCommands.PlextorExtend;
cdb[1] = (byte)PlextorSubCommands.GetMode;
@@ -423,7 +423,7 @@ public partial class Device
{
buffer = new byte[8];
senseBuffer = new byte[64];
var cdb = new byte[12];
byte[] cdb = new byte[12];
cdb[0] = (byte)ScsiCommands.PlextorExtend;
cdb[2] = (byte)PlextorSubCommands.SecuRec;
@@ -454,7 +454,7 @@ public partial class Device
{
buffer = new byte[8];
senseBuffer = new byte[64];
var cdb = new byte[12];
byte[] cdb = new byte[12];
cdb[0] = (byte)ScsiCommands.PlextorExtend;
cdb[1] = (byte)PlextorSubCommands.GetMode;
@@ -486,7 +486,7 @@ public partial class Device
{
buffer = new byte[8];
senseBuffer = new byte[64];
var cdb = new byte[12];
byte[] cdb = new byte[12];
cdb[0] = (byte)ScsiCommands.PlextorExtend;
cdb[1] = (byte)PlextorSubCommands.GetMode;
@@ -522,7 +522,7 @@ public partial class Device
{
buffer = new byte[8];
senseBuffer = new byte[64];
var cdb = new byte[12];
byte[] cdb = new byte[12];
cdb[0] = (byte)ScsiCommands.PlextorExtend;
cdb[1] = (byte)PlextorSubCommands.GetMode;
@@ -559,7 +559,7 @@ public partial class Device
{
buffer = new byte[8];
senseBuffer = new byte[64];
var cdb = new byte[12];
byte[] cdb = new byte[12];
cdb[0] = (byte)ScsiCommands.PlextorExtend;
cdb[1] = (byte)PlextorSubCommands.GetMode;

View File

@@ -31,7 +31,7 @@
// ****************************************************************************/
using System;
using Aaru.Console;
using Aaru.Logging;
namespace Aaru.Devices;
@@ -62,7 +62,7 @@ public partial class Device
uint timeout, out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[6];
byte[] cdb = new byte[6];
cdb[0] = (byte)ScsiCommands.Read6;
cdb[1] = (byte)((lba & 0x1F0000) >> 16);
@@ -113,7 +113,7 @@ public partial class Device
out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[10];
byte[] cdb = new byte[10];
cdb[0] = (byte)ScsiCommands.Read10;
cdb[1] = (byte)((rdprotect & 0x07) << 5);
@@ -178,7 +178,7 @@ public partial class Device
uint timeout, out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[12];
byte[] cdb = new byte[12];
cdb[0] = (byte)ScsiCommands.Read12;
cdb[1] = (byte)((rdprotect & 0x07) << 5);
@@ -246,7 +246,7 @@ public partial class Device
out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[16];
byte[] cdb = new byte[16];
byte[] lbaBytes = BitConverter.GetBytes(lba);
cdb[0] = (byte)ScsiCommands.Read16;
@@ -308,7 +308,7 @@ public partial class Device
ushort transferBytes, uint timeout, out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[10];
byte[] cdb = new byte[10];
cdb[0] = (byte)ScsiCommands.ReadLong;
@@ -356,7 +356,7 @@ public partial class Device
uint timeout, out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[16];
byte[] cdb = new byte[16];
byte[] lbaBytes = BitConverter.GetBytes(lba);
cdb[0] = (byte)ScsiCommands.ServiceActionIn;
@@ -399,7 +399,7 @@ public partial class Device
public bool Seek6(out byte[] senseBuffer, uint lba, uint timeout, out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[6];
byte[] cdb = new byte[6];
byte[] buffer = [];
cdb[0] = (byte)ScsiCommands.Seek6;
@@ -430,7 +430,7 @@ public partial class Device
public bool Seek10(out byte[] senseBuffer, uint lba, uint timeout, out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[10];
byte[] cdb = new byte[10];
byte[] buffer = [];
cdb[0] = (byte)ScsiCommands.Seek10;

View File

@@ -30,7 +30,7 @@
// Copyright © 2011-2025 Natalia Portillo
// ****************************************************************************/
using Aaru.Console;
using Aaru.Logging;
namespace Aaru.Devices;
@@ -53,7 +53,7 @@ public partial class Device
uint timeout, out double duration)
{
buffer = new byte[256];
var cdb = new byte[16];
byte[] cdb = new byte[16];
senseBuffer = new byte[64];
cdb[0] = (byte)ScsiCommands.ReadAttribute;
@@ -84,7 +84,7 @@ public partial class Device
if(sense) return true;
var attrLen = (uint)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3] + 4);
uint attrLen = (uint)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3] + 4);
buffer = new byte[attrLen];
cdb[10] = (byte)((buffer.Length & 0xFF000000) >> 24);
cdb[11] = (byte)((buffer.Length & 0xFF0000) >> 16);

View File

@@ -32,7 +32,7 @@
using System;
using System.Diagnostics.CodeAnalysis;
using Aaru.Console;
using Aaru.Logging;
using PlatformID = Aaru.CommonTypes.Interop.PlatformID;
// ReSharper disable UnusedMember.Global
@@ -91,7 +91,7 @@ public partial class Device
if(sense) return true;
var pagesLength = (byte)(buffer[4] + 5);
byte pagesLength = (byte)(buffer[4] + 5);
cdb = [(byte)ScsiCommands.Inquiry, 0, 0, 0, pagesLength, 0];
@@ -174,7 +174,7 @@ public partial class Device
// This is because INQ was returned instead of EVPD
if(buffer[1] != page) return true;
var pagesLength = (byte)(buffer[3] + 4);
byte pagesLength = (byte)(buffer[3] + 4);
cdb = [(byte)ScsiCommands.Inquiry, 1, page, 0, pagesLength, 0];
@@ -260,7 +260,7 @@ public partial class Device
byte pageCode, byte subPageCode, uint timeout, out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[6];
byte[] cdb = new byte[6];
buffer = new byte[254];
cdb[0] = (byte)ScsiCommands.ModeSense;
@@ -285,7 +285,7 @@ public partial class Device
if(sense) return true;
var modeLength = (byte)(buffer[0] + 1);
byte modeLength = (byte)(buffer[0] + 1);
if(modeLength % 2 != 0) modeLength++;
buffer = new byte[modeLength];
@@ -350,7 +350,7 @@ public partial class Device
out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[10];
byte[] cdb = new byte[10];
buffer = new byte[4096];
cdb[0] = (byte)ScsiCommands.ModeSense10;
@@ -378,7 +378,7 @@ public partial class Device
if(sense) return true;
var modeLength = (ushort)((buffer[0] << 8) + buffer[1] + 2);
ushort modeLength = (ushort)((buffer[0] << 8) + buffer[1] + 2);
if(modeLength % 2 != 0) modeLength++;
buffer = new byte[modeLength];
@@ -438,7 +438,7 @@ public partial class Device
out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[6];
byte[] cdb = new byte[6];
byte[] buffer = [];
cdb[0] = (byte)ScsiCommands.PreventAllowMediumRemoval;
@@ -481,7 +481,7 @@ public partial class Device
uint timeout, out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[10];
byte[] cdb = new byte[10];
buffer = new byte[8];
cdb[0] = (byte)ScsiCommands.ReadCapacity;
@@ -534,7 +534,7 @@ public partial class Device
out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[16];
byte[] cdb = new byte[16];
buffer = new byte[32];
cdb[0] = (byte)ScsiCommands.ServiceActionIn;
@@ -583,7 +583,7 @@ public partial class Device
public bool ReadMediaSerialNumber(out byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration)
{
senseBuffer = new byte[64];
var cdb = new byte[12];
byte[] cdb = new byte[12];
buffer = new byte[4];
cdb[0] = (byte)ScsiCommands.ReadSerialNumber;
@@ -605,7 +605,7 @@ public partial class Device
if(sense) return true;
var strctLength = (uint)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3] + 4);
uint strctLength = (uint)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3] + 4);
buffer = new byte[strctLength];
cdb[6] = (byte)((buffer.Length & 0xFF000000) >> 24);
cdb[7] = (byte)((buffer.Length & 0xFF0000) >> 16);
@@ -775,7 +775,7 @@ public partial class Device
return true;
}
var cdb = new byte[6];
byte[] cdb = new byte[6];
cdb[0] = (byte)ScsiCommands.ModeSelect;
@@ -832,7 +832,7 @@ public partial class Device
return true;
}
var cdb = new byte[10];
byte[] cdb = new byte[10];
cdb[0] = (byte)ScsiCommands.ModeSelect10;
@@ -874,7 +874,7 @@ public partial class Device
/// <returns><c>true</c> if the command failed.</returns>
public bool RequestSense(bool descriptor, out byte[] buffer, uint timeout, out double duration)
{
var cdb = new byte[6];
byte[] cdb = new byte[6];
buffer = new byte[252];
cdb[0] = (byte)ScsiCommands.RequestSense;

Some files were not shown because too many files have changed in this diff Show More