mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
General cleanup and refactor.
This commit is contained in:
@@ -30,14 +30,14 @@
|
||||
// Copyright © 2011-2022 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
namespace Aaru.Filesystems.LisaFS;
|
||||
|
||||
using System;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.Console;
|
||||
using Aaru.Decoders;
|
||||
using Aaru.Helpers;
|
||||
|
||||
namespace Aaru.Filesystems.LisaFS;
|
||||
|
||||
public sealed partial class LisaFS
|
||||
{
|
||||
/// <inheritdoc />
|
||||
@@ -62,7 +62,7 @@ public sealed partial class LisaFS
|
||||
return ErrorNumber.AccessDenied;
|
||||
|
||||
if(fileId < 4 ||
|
||||
(fileId == 4 && _mddf.fsversion != LISA_V2 && _mddf.fsversion != LISA_V1))
|
||||
fileId == 4 && _mddf.fsversion != LISA_V2 && _mddf.fsversion != LISA_V1)
|
||||
return ErrorNumber.InvalidArgument;
|
||||
|
||||
if(_extentCache.TryGetValue(fileId, out file))
|
||||
@@ -90,7 +90,7 @@ public sealed partial class LisaFS
|
||||
// This code just allow to ignore that corruption by searching the Extents File using sector tags
|
||||
if(ptr >= _device.Info.Sectors)
|
||||
{
|
||||
bool found = false;
|
||||
var found = false;
|
||||
|
||||
for(ulong i = 0; i < _device.Info.Sectors; i++)
|
||||
{
|
||||
@@ -178,7 +178,7 @@ public sealed partial class LisaFS
|
||||
file.LisaInfo = new byte[128];
|
||||
Array.Copy(sector, 0x180, file.LisaInfo, 0, 128);
|
||||
|
||||
int extentsCount = 0;
|
||||
var extentsCount = 0;
|
||||
int extentsOffset;
|
||||
|
||||
if(_mddf.fsversion == LISA_V1)
|
||||
@@ -194,9 +194,9 @@ public sealed partial class LisaFS
|
||||
extentsOffset = 0x88;
|
||||
}
|
||||
|
||||
for(int j = 0; j < 41; j++)
|
||||
for(var j = 0; j < 41; j++)
|
||||
{
|
||||
if(BigEndianBitConverter.ToInt16(sector, extentsOffset + (j * 6) + 4) == 0)
|
||||
if(BigEndianBitConverter.ToInt16(sector, extentsOffset + j * 6 + 4) == 0)
|
||||
break;
|
||||
|
||||
extentsCount++;
|
||||
@@ -204,11 +204,11 @@ public sealed partial class LisaFS
|
||||
|
||||
file.extents = new Extent[extentsCount];
|
||||
|
||||
for(int j = 0; j < extentsCount; j++)
|
||||
for(var j = 0; j < extentsCount; j++)
|
||||
file.extents[j] = new Extent
|
||||
{
|
||||
start = BigEndianBitConverter.ToInt32(sector, extentsOffset + (j * 6)),
|
||||
length = BigEndianBitConverter.ToInt16(sector, extentsOffset + (j * 6) + 4)
|
||||
start = BigEndianBitConverter.ToInt32(sector, extentsOffset + j * 6),
|
||||
length = BigEndianBitConverter.ToInt16(sector, extentsOffset + j * 6 + 4)
|
||||
};
|
||||
|
||||
_extentCache.Add(fileId, file);
|
||||
@@ -253,8 +253,7 @@ public sealed partial class LisaFS
|
||||
AaruConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].release = {1}", fileId, file.release);
|
||||
AaruConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].build = {1}", fileId, file.build);
|
||||
|
||||
AaruConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].compatibility = {1}", fileId,
|
||||
file.compatibility);
|
||||
AaruConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].compatibility = {1}", fileId, file.compatibility);
|
||||
|
||||
AaruConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].revision = {1}", fileId, file.revision);
|
||||
AaruConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown6 = 0x{1:X4}", fileId, file.unknown6);
|
||||
@@ -281,7 +280,7 @@ public sealed partial class LisaFS
|
||||
AaruConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].length = {1}", fileId, file.length);
|
||||
AaruConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown9 = 0x{1:X8}", fileId, file.unknown9);
|
||||
|
||||
for(int ext = 0; ext < file.extents.Length; ext++)
|
||||
for(var ext = 0; ext < file.extents.Length; ext++)
|
||||
{
|
||||
AaruConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].extents[{1}].start = {2}", fileId, ext,
|
||||
file.extents[ext].start);
|
||||
@@ -313,13 +312,13 @@ public sealed partial class LisaFS
|
||||
// Each entry takes 14 bytes
|
||||
_srecords = new SRecord[sectors.Length / 14];
|
||||
|
||||
for(int s = 0; s < _srecords.Length; s++)
|
||||
for(var s = 0; s < _srecords.Length; s++)
|
||||
_srecords[s] = new SRecord
|
||||
{
|
||||
extent_ptr = BigEndianBitConverter.ToUInt32(sectors, 0x00 + (14 * s)),
|
||||
unknown = BigEndianBitConverter.ToUInt32(sectors, 0x04 + (14 * s)),
|
||||
filesize = BigEndianBitConverter.ToUInt32(sectors, 0x08 + (14 * s)),
|
||||
flags = BigEndianBitConverter.ToUInt16(sectors, 0x0C + (14 * s))
|
||||
extent_ptr = BigEndianBitConverter.ToUInt32(sectors, 0x00 + 14 * s),
|
||||
unknown = BigEndianBitConverter.ToUInt32(sectors, 0x04 + 14 * s),
|
||||
filesize = BigEndianBitConverter.ToUInt32(sectors, 0x08 + 14 * s),
|
||||
flags = BigEndianBitConverter.ToUInt16(sectors, 0x0C + 14 * s)
|
||||
};
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
|
||||
Reference in New Issue
Block a user