Fix ambiguity

This commit is contained in:
2025-08-14 15:51:32 +01:00
parent 34dd0fd2d1
commit e18f912e96
29 changed files with 111 additions and 141 deletions

View File

@@ -32,6 +32,7 @@
using Aaru.CommonTypes.Metadata;
using Aaru.Decoders.PCMCIA;
using Tuple = Aaru.Decoders.PCMCIA.Tuple;
namespace Aaru.Core.Devices.Report;

View File

@@ -31,6 +31,7 @@
// ****************************************************************************/
using Aaru.CommonTypes.Interop;
using PlatformID = Aaru.CommonTypes.Interop.PlatformID;
namespace Aaru.Core;

View File

@@ -38,6 +38,8 @@ using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs;
using Aaru.Console;
using Directory = Aaru.CommonTypes.AaruMetadata.Directory;
using FileAttributes = Aaru.CommonTypes.Structs.FileAttributes;
namespace Aaru.Core;

View File

@@ -32,6 +32,8 @@
using Aaru.Database.Models;
using Microsoft.EntityFrameworkCore;
using OperatingSystem = Aaru.Database.Models.OperatingSystem;
using Version = Aaru.Database.Models.Version;
namespace Aaru.Database;

View File

@@ -51,6 +51,7 @@ using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs;
using Aaru.Decoders.DVD;
using FileAttributes = Aaru.CommonTypes.Structs.FileAttributes;
namespace Aaru.Decryption.DVD;
@@ -431,36 +432,36 @@ public class CSS
/// <returns>The encrypted key.</returns>
public static void EncryptKey(DvdCssKeyType keyType, uint variant, byte[] challenge, out byte[] key)
{
var bits = new byte[30];
var scratch = new byte[10];
byte index = sizeof(byte) * 30;
var temp1 = new byte[5];
var temp2 = new byte[5];
byte carry = 0;
byte[] bits = new byte[30];
byte[] scratch = new byte[10];
byte index = sizeof(byte) * 30;
byte[] temp1 = new byte[5];
byte[] temp2 = new byte[5];
byte carry = 0;
key = new byte[5];
for(var i = 9; i >= 0; --i) scratch[i] = challenge[_permutationChallenge[(uint)keyType, i]];
for(int i = 9; i >= 0; --i) scratch[i] = challenge[_permutationChallenge[(uint)keyType, i]];
var cssVariant = (byte)(keyType == 0 ? variant : _permutationVariant[(uint)keyType - 1, variant]);
byte cssVariant = (byte)(keyType == 0 ? variant : _permutationVariant[(uint)keyType - 1, variant]);
for(var i = 5; --i >= 0;) temp1[i] = (byte)(scratch[5 + i] ^ _secret[i] ^ _encryptTable2[i]);
for(int i = 5; --i >= 0;) temp1[i] = (byte)(scratch[5 + i] ^ _secret[i] ^ _encryptTable2[i]);
var lfsr0 = (uint)(temp1[0] << 17 | temp1[1] << 9 | (temp1[2] & ~7) << 1 | 8 | temp1[2] & 7);
var lfsr1 = (uint)(temp1[3] << 9 | 0x100 | temp1[4]);
uint lfsr0 = (uint)(temp1[0] << 17 | temp1[1] << 9 | (temp1[2] & ~7) << 1 | 8 | temp1[2] & 7);
uint lfsr1 = (uint)(temp1[3] << 9 | 0x100 | temp1[4]);
do
{
byte val = 0;
for(var bit = 0; bit < 8; ++bit)
for(int bit = 0; bit < 8; ++bit)
{
var oLfsr0 = (byte)((lfsr0 >> 24 ^ lfsr0 >> 21 ^ lfsr0 >> 20 ^ lfsr0 >> 12) & 1);
byte oLfsr0 = (byte)((lfsr0 >> 24 ^ lfsr0 >> 21 ^ lfsr0 >> 20 ^ lfsr0 >> 12) & 1);
lfsr0 = lfsr0 << 1 | oLfsr0;
var oLfsr1 = (byte)((lfsr1 >> 16 ^ lfsr1 >> 2) & 1);
byte oLfsr1 = (byte)((lfsr1 >> 16 ^ lfsr1 >> 2) & 1);
lfsr1 = lfsr1 << 1 | oLfsr1;
var combined = (byte)(Convert.ToByte(oLfsr1 == 0) + carry + Convert.ToByte(oLfsr0 == 0));
byte combined = (byte)(Convert.ToByte(oLfsr1 == 0) + carry + Convert.ToByte(oLfsr0 == 0));
carry = (byte)(combined >> 1 & 1);
val |= (byte)((combined & 1) << bit);
}
@@ -468,10 +469,10 @@ public class CSS
bits[--index] = val;
} while(index > 0);
var cse = (byte)(_variants[cssVariant] ^ _encryptTable2[cssVariant]);
var term = 0;
byte cse = (byte)(_variants[cssVariant] ^ _encryptTable2[cssVariant]);
int term = 0;
for(var i = 5; --i >= 0; term = scratch[i])
for(int i = 5; --i >= 0; term = scratch[i])
{
index = (byte)(bits[25 + i] ^ scratch[i]);
index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse);
@@ -482,7 +483,7 @@ public class CSS
temp1[4] ^= temp1[0];
term = 0;
for(var i = 5; --i >= 0; term = temp1[i])
for(int i = 5; --i >= 0; term = temp1[i])
{
index = (byte)(bits[20 + i] ^ temp1[i]);
index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse);
@@ -493,7 +494,7 @@ public class CSS
temp2[4] ^= temp2[0];
term = 0;
for(var i = 5; --i >= 0; term = temp2[i])
for(int i = 5; --i >= 0; term = temp2[i])
{
index = (byte)(bits[15 + i] ^ temp2[i]);
index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse);
@@ -505,7 +506,7 @@ public class CSS
temp1[4] ^= temp1[0];
term = 0;
for(var i = 5; --i >= 0; term = temp1[i])
for(int i = 5; --i >= 0; term = temp1[i])
{
index = (byte)(bits[10 + i] ^ temp1[i]);
index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse);
@@ -517,7 +518,7 @@ public class CSS
temp2[4] ^= temp2[0];
term = 0;
for(var i = 5; --i >= 0; term = temp2[i])
for(int i = 5; --i >= 0; term = temp2[i])
{
index = (byte)(bits[5 + i] ^ temp2[i]);
index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse);
@@ -528,7 +529,7 @@ public class CSS
temp1[4] ^= temp1[0];
term = 0;
for(var i = 5; --i >= 0; term = temp1[i])
for(int i = 5; --i >= 0; term = temp1[i])
{
index = (byte)(bits[i] ^ temp1[i]);
index = (byte)(_encryptTable1[index] ^ ~_encryptTable2[index] ^ cse);
@@ -545,12 +546,12 @@ public class CSS
static void DecryptKey(byte invert, byte[] cryptoKey, byte[] encryptedKey, out byte[] decryptedKey)
{
decryptedKey = new byte[5];
var k = new byte[5];
byte[] k = new byte[5];
var lfsr1Lo = (uint)(cryptoKey[0] | 0x100);
uint lfsr1Lo = (uint)(cryptoKey[0] | 0x100);
uint lfsr1Hi = cryptoKey[1];
var lfsr0 = (uint)((cryptoKey[4] << 17 | cryptoKey[3] << 9 | cryptoKey[2] << 1) + 8 - (cryptoKey[2] & 7));
uint lfsr0 = (uint)((cryptoKey[4] << 17 | cryptoKey[3] << 9 | cryptoKey[2] << 1) + 8 - (cryptoKey[2] & 7));
lfsr0 = (uint)(_cssTable4[lfsr0 & 0xff] << 24 |
_cssTable4[lfsr0 >> 8 & 0xff] << 16 |
@@ -561,11 +562,11 @@ public class CSS
for(uint i = 0; i < 5; i++)
{
var oLfsr1 = (byte)(_cssTable2[lfsr1Hi] ^ _cssTable3[lfsr1Lo]);
byte oLfsr1 = (byte)(_cssTable2[lfsr1Hi] ^ _cssTable3[lfsr1Lo]);
lfsr1Hi = lfsr1Lo >> 1;
lfsr1Lo = (lfsr1Lo & 1) << 8 ^ oLfsr1;
oLfsr1 = _cssTable4[oLfsr1];
var oLfsr0 = (byte)((((lfsr0 >> 8 ^ lfsr0) >> 1 ^ lfsr0) >> 3 ^ lfsr0) >> 7);
byte oLfsr0 = (byte)((((lfsr0 >> 8 ^ lfsr0) >> 1 ^ lfsr0) >> 3 ^ lfsr0) >> 7);
lfsr0 = lfsr0 >> 8 | (uint)oLfsr0 << 24;
combined += (uint)((oLfsr0 ^ invert) + oLfsr1);
k[i] = (byte)(combined & 0xff);
@@ -631,7 +632,7 @@ public class CSS
if(cmiData != null && cmiData.All(static cmi => (cmi & 0x80) >> 7 == 0) || keyData.All(static k => k == 0))
return sectorData;
var decryptedBuffer = new byte[sectorData.Length];
byte[] decryptedBuffer = new byte[sectorData.Length];
for(uint i = 0; i < blocks; i++)
{
@@ -669,7 +670,7 @@ public class CSS
if(cmiData != null && cmiData.All(static cmi => (cmi & 0x80) >> 7 == 0) || keyData.All(static k => k == 0))
return sectorData;
var decryptedBuffer = new byte[sectorData.Length];
byte[] decryptedBuffer = new byte[sectorData.Length];
for(uint i = 0; i < blocks; i++)
{
@@ -824,7 +825,7 @@ public class CSS
// If we found an adequate pattern.
if(bestPattern <= 0 || bestPatternLength <= 3 || bestPatternLength / bestPattern < 2) return false;
var offset = (int)(0x80 - bestPatternLength / bestPattern * bestPattern);
int offset = (int)(0x80 - bestPatternLength / bestPattern * bestPattern);
int result = RecoverTitleKey(0,
sector.Skip(0x80).Take(sector.Length - 0x80).ToArray(),
@@ -848,10 +849,10 @@ public class CSS
static int RecoverTitleKey(uint start, byte[] encryptedBytes, byte[] decryptedBytes, byte[] sectorSeed,
out byte[] key)
{
var buffer = new byte[10];
long iTry;
uint i;
int exit = -1;
byte[] buffer = new byte[10];
long iTry;
uint i;
int exit = -1;
key = new byte[5];
for(i = 0; i < 10; i++) buffer[i] = (byte)(_cssTable1[encryptedBytes[i]] ^ decryptedBytes[i]);
@@ -959,7 +960,7 @@ public class CSS
/// <returns>The title key.</returns>
static byte[] FindTitleKey(IOpticalMediaImage input, ulong startSector, ulong sectorsToSearch = 20000)
{
var titleKey = new byte[5];
byte[] titleKey = new byte[5];
for(ulong i = 0; i < sectorsToSearch; i++)
{
@@ -984,7 +985,7 @@ public class CSS
public static byte[] GenerateTitleKeys(IOpticalMediaImage input, List<Partition> partitions, ulong trackSectors,
IReadOnlyFilesystem fs)
{
var keys = new byte[trackSectors * 5];
byte[] keys = new byte[trackSectors * 5];
foreach(Partition partition in partitions)
{

View File

@@ -31,8 +31,8 @@
// ****************************************************************************/
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interop;
using Aaru.CommonTypes.Structs.Devices.SCSI;
using PlatformID = Aaru.CommonTypes.Interop.PlatformID;
namespace Aaru.Devices;

View File

@@ -6,16 +6,7 @@
<OutputType>Library</OutputType>
<RootNamespace>Aaru.Dto</RootNamespace>
<AssemblyName>Aaru.Dto</AssemblyName>
<ReleaseVersion>$(Version)</ReleaseVersion>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<Version>6.0.0-alpha10</Version>
<Company>Claunia.com</Company>
<Copyright>Copyright © 2011-2025 Natalia Portillo</Copyright>
<Product>Aaru Data Preservation Suite</Product>
<Title>Aaru.Dto</Title>
<ApplicationVersion>$(Version)</ApplicationVersion>
<TargetFramework>net10.0</TargetFramework>
<LangVersion>latest</LangVersion>
<Description>Data transfer objects used to interchange data between Aaru and Aaru.Server.</Description>
<PackageProjectUrl>https://github.com/aaru-dps/</PackageProjectUrl>
<PackageLicenseExpression>LGPL-2.1-only</PackageLicenseExpression>
@@ -26,8 +17,6 @@
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<Authors>Natalia Portillo &lt;claunia@claunia.com&gt;</Authors>
<DisableImplicitNamespaceImports>true</DisableImplicitNamespaceImports>
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<NoWarn>CS1591;CS1574</NoWarn>
@@ -46,46 +35,6 @@
<Link>LICENSE.LGPL</Link>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<PackageReference Include="AsyncFixer" Version="1.6.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="ErrorProne.NET.CoreAnalyzers" Version="0.1.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="ErrorProne.NET.Structs" Version="0.1.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.10.48">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Philips.CodeAnalysis.MaintainabilityAnalyzers" Version="1.5.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Roslynator.Analyzers" Version="4.12.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Roslynator.CodeAnalysis.Analyzers" Version="4.12.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Roslynator.Formatting.Analyzers" Version="4.12.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31"/>
<PackageReference Include="Text.Analyzers" Version="3.3.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.4.3" PrivateAssets="all"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Aaru.CommonTypes\Aaru.CommonTypes.csproj"/>
</ItemGroup>

View File

@@ -30,11 +30,11 @@ using System.Collections.Generic;
using Aaru.CommonTypes.AaruMetadata;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs;
using Aaru.Console;
using Aaru.Helpers;
using Claunia.Encoding;
using Encoding = System.Text.Encoding;
using FileSystemInfo = Aaru.CommonTypes.Structs.FileSystemInfo;
using Partition = Aaru.CommonTypes.Partition;
namespace Aaru.Filesystems;

View File

@@ -32,8 +32,8 @@ using System.Text;
using Aaru.CommonTypes.AaruMetadata;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs;
using Aaru.Helpers;
using FileSystemInfo = Aaru.CommonTypes.Structs.FileSystemInfo;
using Partition = Aaru.CommonTypes.Partition;
namespace Aaru.Filesystems;
@@ -84,7 +84,7 @@ public sealed partial class AppleMFS
_volMdb.drNxtFNum = BigEndianBitConverter.ToUInt32(_mdbBlocks, 0x01E);
_volMdb.drFreeBks = BigEndianBitConverter.ToUInt16(_mdbBlocks, 0x022);
_volMdb.drVNSiz = _mdbBlocks[0x024];
var variableSize = new byte[_volMdb.drVNSiz + 1];
byte[] variableSize = new byte[_volMdb.drVNSiz + 1];
Array.Copy(_mdbBlocks, 0x024, variableSize, 0, _volMdb.drVNSiz + 1);
_volMdb.drVN = StringHandlers.PascalToString(variableSize, _encoding);
@@ -105,10 +105,10 @@ public sealed partial class AppleMFS
_blockMapBytes = new byte[bytesInBlockMap];
Array.Copy(wholeMdb, BYTES_BEFORE_BLOCK_MAP, _blockMapBytes, 0, _blockMapBytes.Length);
var offset = 0;
int offset = 0;
_blockMap = new uint[_volMdb.drNmAlBlks + 2 + 1];
for(var i = 2; i < _volMdb.drNmAlBlks + 2; i += 8)
for(int i = 2; i < _volMdb.drNmAlBlks + 2; i += 8)
{
uint tmp1 = 0;
uint tmp2 = 0;
@@ -163,7 +163,7 @@ public sealed partial class AppleMFS
_mounted = true;
var bbSig = BigEndianBitConverter.ToUInt16(_bootBlocks, 0x000);
ushort bbSig = BigEndianBitConverter.ToUInt16(_bootBlocks, 0x000);
if(bbSig != AppleCommon.BB_MAGIC) _bootBlocks = null;

View File

@@ -31,7 +31,7 @@ using System.Collections.Generic;
using Aaru.CommonTypes.AaruMetadata;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs;
using FileSystemInfo = Aaru.CommonTypes.Structs.FileSystemInfo;
namespace Aaru.Filesystems;

View File

@@ -30,6 +30,7 @@ using System;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs;
using FileAttributes = Aaru.CommonTypes.Structs.FileAttributes;
namespace Aaru.Filesystems;

View File

@@ -28,7 +28,7 @@
using System.Runtime.InteropServices;
using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs;
using FileAttributes = Aaru.CommonTypes.Structs.FileAttributes;
namespace Aaru.Filesystems;

View File

@@ -36,6 +36,7 @@ using System.Text;
using Aaru.CommonTypes.AaruMetadata;
using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs;
using FileSystemInfo = Aaru.CommonTypes.Structs.FileSystemInfo;
namespace Aaru.Filesystems;

View File

@@ -31,6 +31,7 @@ using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs;
using Aaru.Helpers;
using FileAttributes = Aaru.CommonTypes.Structs.FileAttributes;
namespace Aaru.Filesystems;

View File

@@ -32,7 +32,7 @@ using System.Globalization;
using System.Text;
using Aaru.CommonTypes.AaruMetadata;
using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs;
using FileSystemInfo = Aaru.CommonTypes.Structs.FileSystemInfo;
namespace Aaru.Filesystems;

View File

@@ -33,7 +33,7 @@ using System.Text;
using Aaru.CommonTypes.AaruMetadata;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs;
using FileSystemInfo = Aaru.CommonTypes.Structs.FileSystemInfo;
namespace Aaru.Filesystems;

View File

@@ -34,9 +34,9 @@ using System.Text;
using Aaru.CommonTypes.AaruMetadata;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs;
using Aaru.Console;
using Aaru.Helpers;
using FileSystemInfo = Aaru.CommonTypes.Structs.FileSystemInfo;
using Marshal = Aaru.Helpers.Marshal;
using Partition = Aaru.CommonTypes.Partition;
@@ -156,8 +156,9 @@ public sealed partial class XboxFatPlugin
_fat32 = MemoryMarshal.Cast<byte, uint>(buffer).ToArray();
if(!_littleEndian)
for(var i = 0; i < _fat32.Length; i++)
_fat32[i] = Swapping.Swap(_fat32[i]);
{
for(int i = 0; i < _fat32.Length; i++) _fat32[i] = Swapping.Swap(_fat32[i]);
}
AaruConsole.DebugWriteLine(MODULE_NAME, "fat32[0] == FATX32_ID = {0}", _fat32[0] == FATX32_ID);
@@ -187,8 +188,9 @@ public sealed partial class XboxFatPlugin
_fat16 = MemoryMarshal.Cast<byte, ushort>(buffer).ToArray();
if(!_littleEndian)
for(var i = 0; i < _fat16.Length; i++)
_fat16[i] = Swapping.Swap(_fat16[i]);
{
for(int i = 0; i < _fat16.Length; i++) _fat16[i] = Swapping.Swap(_fat16[i]);
}
AaruConsole.DebugWriteLine(MODULE_NAME, "fat16[0] == FATX16_ID = {0}", _fat16[0] == FATX16_ID);
@@ -208,11 +210,11 @@ public sealed partial class XboxFatPlugin
if(rootDirectoryClusters is null) return ErrorNumber.InvalidArgument;
var rootDirectoryBuffer = new byte[_bytesPerCluster * rootDirectoryClusters.Length];
byte[] rootDirectoryBuffer = new byte[_bytesPerCluster * rootDirectoryClusters.Length];
AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Reading_root_directory);
for(var i = 0; i < rootDirectoryClusters.Length; i++)
for(int i = 0; i < rootDirectoryClusters.Length; i++)
{
errno = imagePlugin.ReadSectors(_firstClusterSector + (rootDirectoryClusters[i] - 1) * _sectorsPerCluster,
_sectorsPerCluster,
@@ -225,7 +227,7 @@ public sealed partial class XboxFatPlugin
_rootDirectory = new Dictionary<string, DirectoryEntry>();
var pos = 0;
int pos = 0;
while(pos < rootDirectoryBuffer.Length)
{

View File

@@ -33,7 +33,7 @@ using System.Diagnostics.CodeAnalysis;
using System.Text;
using Aaru.CommonTypes.AaruMetadata;
using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs;
using FileSystemInfo = Aaru.CommonTypes.Structs.FileSystemInfo;
namespace Aaru.Filesystems;

View File

@@ -37,10 +37,10 @@ using System.Text;
using Aaru.CommonTypes.AaruMetadata;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs;
using Aaru.Console;
using Aaru.Decoders.Sega;
using Aaru.Helpers;
using FileSystemInfo = Aaru.CommonTypes.Structs.FileSystemInfo;
using Partition = Aaru.CommonTypes.Partition;
namespace Aaru.Filesystems;
@@ -54,8 +54,8 @@ public sealed partial class ISO9660
Dictionary<string, string> options, string @namespace)
{
_encoding = encoding ?? Encoding.GetEncoding(1252);
var vdMagic = new byte[5]; // Volume Descriptor magic "CD001"
var hsMagic = new byte[5]; // Volume Descriptor magic "CDROM"
byte[] vdMagic = new byte[5]; // Volume Descriptor magic "CD001"
byte[] hsMagic = new byte[5]; // Volume Descriptor magic "CDROM"
options ??= GetDefaultOptions();
@@ -119,7 +119,7 @@ public sealed partial class ISO9660
int xaOff = vdSector.Length == 2336 ? 8 : 0;
Array.Copy(vdSector, 0x009 + xaOff, hsMagic, 0, 5);
_highSierra = _encoding.GetString(hsMagic) == HIGH_SIERRA_MAGIC;
var hsOff = 0;
int hsOff = 0;
if(_highSierra) hsOff = 8;
@@ -359,7 +359,7 @@ public sealed partial class ISO9660
if(errno != ErrorNumber.NoError) return errno;
var pvdWrongRoot = false;
bool pvdWrongRoot = false;
if(_highSierra)
{
@@ -382,7 +382,7 @@ public sealed partial class ISO9660
Localization
.PVD_does_not_point_to_correct_root_directory_checking_path_table);
var pathTableWrongRoot = false;
bool pathTableWrongRoot = false;
rootLocation = _pathTable[0].Extent;
@@ -617,7 +617,7 @@ public sealed partial class ISO9660
Timestamp = decodedVd.CreationTime
});
for(var i = 0; i < bvdSectors.Count; i++)
for(int i = 0; i < bvdSectors.Count; i++)
{
_rootDirectoryCache.Add(i == 0 ? "$BOOT" : $"$BOOT_{i}",
new DecodedDirectoryEntry
@@ -629,7 +629,7 @@ public sealed partial class ISO9660
});
}
for(var i = 0; i < pvdSectors.Count; i++)
for(int i = 0; i < pvdSectors.Count; i++)
{
_rootDirectoryCache.Add(i == 0 ? "$PVD" : $"$PVD{i}",
new DecodedDirectoryEntry
@@ -641,7 +641,7 @@ public sealed partial class ISO9660
});
}
for(var i = 0; i < svdSectors.Count; i++)
for(int i = 0; i < svdSectors.Count; i++)
{
_rootDirectoryCache.Add(i == 0 ? "$SVD" : $"$SVD_{i}",
new DecodedDirectoryEntry
@@ -653,7 +653,7 @@ public sealed partial class ISO9660
});
}
for(var i = 0; i < evdSectors.Count; i++)
for(int i = 0; i < evdSectors.Count; i++)
{
_rootDirectoryCache.Add(i == 0 ? "$EVD" : $"$EVD_{i}",
new DecodedDirectoryEntry
@@ -665,7 +665,7 @@ public sealed partial class ISO9660
});
}
for(var i = 0; i < vpdSectors.Count; i++)
for(int i = 0; i < vpdSectors.Count; i++)
{
_rootDirectoryCache.Add(i == 0 ? "$VPD" : $"$VPD_{i}",
new DecodedDirectoryEntry

View File

@@ -38,6 +38,7 @@ using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs;
using Aaru.Decoders;
using Aaru.Helpers;
using FileAttributes = Aaru.CommonTypes.Structs.FileAttributes;
namespace Aaru.Filesystems;
@@ -150,7 +151,7 @@ public sealed partial class LisaFS
if(error != ErrorNumber.NoError) return error;
var offset = 0;
int offset = 0;
List<CatalogEntryV2> catalogV2 = [];
// For each entry on the catalog
@@ -281,7 +282,7 @@ public sealed partial class LisaFS
// Foreach catalog block
foreach(byte[] buf in catalogBlocks)
{
var offset = 0;
int offset = 0;
// Traverse all entries
while(offset + 64 <= buf.Length)

View File

@@ -33,6 +33,7 @@ using Aaru.CommonTypes.Structs;
using Aaru.Console;
using Aaru.Decoders;
using Aaru.Helpers;
using FileAttributes = Aaru.CommonTypes.Structs.FileAttributes;
namespace Aaru.Filesystems;
@@ -219,12 +220,13 @@ public sealed partial class LisaFS
if(!_mounted || !_debug) return ErrorNumber.AccessDenied;
if(fileId is > 4 or <= 0)
if(fileId != FILEID_BOOT_SIGNED && fileId != FILEID_LOADER_SIGNED)
return ErrorNumber.InvalidArgument;
{
if(fileId != FILEID_BOOT_SIGNED && fileId != FILEID_LOADER_SIGNED) return ErrorNumber.InvalidArgument;
}
if(_systemFileCache.TryGetValue(fileId, out buf) && !tags) return ErrorNumber.NoError;
var count = 0;
int count = 0;
if(fileId == FILEID_SRECORD)
{
@@ -407,11 +409,11 @@ public sealed partial class LisaFS
else
sectorSize = (int)_device.Info.SectorSize;
var temp = new byte[file.length * sectorSize];
byte[] temp = new byte[file.length * sectorSize];
var offset = 0;
int offset = 0;
for(var i = 0; i < file.extents.Length; i++)
for(int i = 0; i < file.extents.Length; i++)
{
ErrorNumber errno = !tags
? _device.ReadSectors((ulong)file.extents[i].start +
@@ -435,8 +437,9 @@ public sealed partial class LisaFS
if(!tags)
{
if(_fileSizeCache.TryGetValue(fileId, out int realSize))
if(realSize > temp.Length)
AaruConsole.ErrorWriteLine(Localization.File_0_gets_truncated, fileId);
{
if(realSize > temp.Length) AaruConsole.ErrorWriteLine(Localization.File_0_gets_truncated, fileId);
}
buf = temp;
@@ -520,7 +523,7 @@ public sealed partial class LisaFS
}
}
for(var lvl = 0; lvl < pathElements.Length; lvl++)
for(int lvl = 0; lvl < pathElements.Length; lvl++)
{
string wantedFilename = pathElements[0].Replace('-', '/');

View File

@@ -31,12 +31,12 @@ using System.Collections.Generic;
using Aaru.CommonTypes.AaruMetadata;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs;
using Aaru.Console;
using Aaru.Decoders;
using Aaru.Helpers;
using Claunia.Encoding;
using Encoding = System.Text.Encoding;
using FileSystemInfo = Aaru.CommonTypes.Structs.FileSystemInfo;
using Partition = Aaru.CommonTypes.Partition;
namespace Aaru.Filesystems;
@@ -97,7 +97,7 @@ public sealed partial class LisaFS
if(errno != ErrorNumber.NoError) return errno;
_mddf = new MDDF();
var pString = new byte[33];
byte[] pString = new byte[33];
_mddf.fsversion = BigEndianBitConverter.ToUInt16(sector, 0x00);
_mddf.volid = BigEndianBitConverter.ToUInt64(sector, 0x02);
@@ -112,7 +112,7 @@ public sealed partial class LisaFS
_mddf.unknown2 = sector[0x4F];
_mddf.machine_id = BigEndianBitConverter.ToUInt32(sector, 0x50);
_mddf.master_copy_id = BigEndianBitConverter.ToUInt32(sector, 0x54);
var lisaTime = BigEndianBitConverter.ToUInt32(sector, 0x58);
uint lisaTime = BigEndianBitConverter.ToUInt32(sector, 0x58);
_mddf.dtvc = DateHandlers.LisaToDateTime(lisaTime);
lisaTime = BigEndianBitConverter.ToUInt32(sector, 0x5C);
_mddf.dtcc = DateHandlers.LisaToDateTime(lisaTime);

View File

@@ -33,6 +33,7 @@ using System.Linq;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs;
using FileAttributes = Aaru.CommonTypes.Structs.FileAttributes;
namespace Aaru.Filesystems;
@@ -194,7 +195,7 @@ public sealed partial class OperaFS
if(pieces.Length == 0) return ErrorNumber.InvalidArgument;
var parentPath = string.Join("/", pieces, 0, pieces.Length - 1);
string parentPath = string.Join("/", pieces, 0, pieces.Length - 1);
if(!_directoryCache.TryGetValue(parentPath, out _))
{

View File

@@ -32,7 +32,7 @@ using System.Text;
using Aaru.CommonTypes.AaruMetadata;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs;
using FileSystemInfo = Aaru.CommonTypes.Structs.FileSystemInfo;
namespace Aaru.Filesystems;

View File

@@ -33,6 +33,7 @@ using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs;
using Aaru.Helpers;
using FileSystemInfo = Aaru.CommonTypes.Structs.FileSystemInfo;
using Partition = Aaru.CommonTypes.Partition;
namespace Aaru.Filesystems;
@@ -92,7 +93,7 @@ public sealed partial class OperaFS
};
_image = imagePlugin;
var firstRootBlock = BigEndianBitConverter.ToInt32(sbSector, Marshal.SizeOf<SuperBlock>());
int firstRootBlock = BigEndianBitConverter.ToInt32(sbSector, Marshal.SizeOf<SuperBlock>());
_rootDirectoryCache = DecodeDirectory(firstRootBlock);
_directoryCache = new Dictionary<string, Dictionary<string, DirectoryEntryWithPointers>>();
_mounted = true;

View File

@@ -32,6 +32,7 @@ using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs;
using Aaru.Helpers;
using FileAttributes = Aaru.CommonTypes.Structs.FileAttributes;
namespace Aaru.Filesystems;

View File

@@ -35,10 +35,10 @@ using System.Collections.Generic;
using Aaru.CommonTypes.AaruMetadata;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs;
using Aaru.Helpers;
using Claunia.Encoding;
using Encoding = System.Text.Encoding;
using FileSystemInfo = Aaru.CommonTypes.Structs.FileSystemInfo;
using Partition = Aaru.CommonTypes.Partition;
namespace Aaru.Filesystems;
@@ -100,7 +100,7 @@ public sealed partial class PascalPlugin
if(errno != ErrorNumber.NoError) return errno;
var offset = 26;
int offset = 26;
_fileEntries = [];

View File

@@ -43,6 +43,7 @@ using Avalonia.Controls;
using Avalonia.Platform.Storage;
using JetBrains.Annotations;
using ReactiveUI;
using Tuple = Aaru.Decoders.PCMCIA.Tuple;
namespace Aaru.Gui.ViewModels.Tabs;

View File

@@ -7,6 +7,7 @@ using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs;
using Aaru.Core;
using NUnit.Framework;
using FileAttributes = Aaru.CommonTypes.Structs.FileAttributes;
namespace Aaru.Tests.Issues;
@@ -68,9 +69,9 @@ public abstract class FsExtractIssueTest
});
}
var filesystemFound = false;
bool filesystemFound = false;
for(var i = 0; i < partitions.Count; i++)
for(int i = 0; i < partitions.Count; i++)
{
Core.Filesystems.Identify(imageFormat, out List<string> idPlugins, partitions[i]);
@@ -171,7 +172,7 @@ public abstract class FsExtractIssueTest
}
}
var buffer = new byte[stat.Length];
byte[] buffer = new byte[stat.Length];
ErrorNumber ret = fs.OpenFile(path + "/" + entry, out IFileNode fileNode);
Assert.That(ret,