mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Cache FAT16.
This commit is contained in:
@@ -192,17 +192,7 @@ namespace DiscImageChef.Filesystems.FAT
|
|||||||
while(nextCluster > 0 && nextCluster <= FAT16_FORMATTED)
|
while(nextCluster > 0 && nextCluster <= FAT16_FORMATTED)
|
||||||
{
|
{
|
||||||
clusters.Add(nextCluster);
|
clusters.Add(nextCluster);
|
||||||
|
nextCluster = fatEntries[nextCluster];
|
||||||
if(currentSector != nextSector)
|
|
||||||
{
|
|
||||||
fatData = image.ReadSector(nextSector);
|
|
||||||
currentSector = nextSector;
|
|
||||||
}
|
|
||||||
|
|
||||||
nextCluster = BitConverter.ToUInt16(fatData, nextEntry * 2);
|
|
||||||
nextSector = nextCluster / fatEntriesPerSector + fatFirstSector +
|
|
||||||
(useFirstFat ? 0 : sectorsPerFat);
|
|
||||||
nextEntry = (int)(nextCluster % fatEntriesPerSector);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
while(nextCluster > 0 && nextCluster <= FAT12_FORMATTED)
|
while(nextCluster > 0 && nextCluster <= FAT12_FORMATTED)
|
||||||
|
|||||||
@@ -35,15 +35,16 @@ using System.Collections.Generic;
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using DiscImageChef.CommonTypes;
|
using DiscImageChef.CommonTypes;
|
||||||
using DiscImageChef.CommonTypes.Enums;
|
using DiscImageChef.CommonTypes.Enums;
|
||||||
using DiscImageChef.CommonTypes.Interfaces;
|
using DiscImageChef.CommonTypes.Interfaces;
|
||||||
using DiscImageChef.CommonTypes.Structs;
|
using DiscImageChef.CommonTypes.Structs;
|
||||||
using DiscImageChef.Console;
|
using DiscImageChef.Console;
|
||||||
using DiscImageChef.Helpers;
|
|
||||||
using Schemas;
|
using Schemas;
|
||||||
using FileSystemInfo = DiscImageChef.CommonTypes.Structs.FileSystemInfo;
|
using FileSystemInfo = DiscImageChef.CommonTypes.Structs.FileSystemInfo;
|
||||||
|
using Marshal = DiscImageChef.Helpers.Marshal;
|
||||||
|
|
||||||
namespace DiscImageChef.Filesystems.FAT
|
namespace DiscImageChef.Filesystems.FAT
|
||||||
{
|
{
|
||||||
@@ -505,6 +506,16 @@ namespace DiscImageChef.Filesystems.FAT
|
|||||||
fatEntries[pos++] = (ushort)(((fatBytes[i + 1] & 0xF0) >> 4) + (fatBytes[i + 2] << 4));
|
fatEntries[pos++] = (ushort)(((fatBytes[i + 1] & 0xF0) >> 4) + (fatBytes[i + 2] << 4));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(fat16)
|
||||||
|
{
|
||||||
|
DicConsole.DebugWriteLine("FAT plugin", "Reading FAT16");
|
||||||
|
|
||||||
|
byte[] fatBytes =
|
||||||
|
imagePlugin.ReadSectors(fatFirstSector + (useFirstFat ? 0 : sectorsPerFat), sectorsPerFat);
|
||||||
|
|
||||||
|
DicConsole.DebugWriteLine("FAT plugin", "Casting FAT");
|
||||||
|
fatEntries = MemoryMarshal.Cast<byte, ushort>(fatBytes).ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Check how this affects international filenames
|
// TODO: Check how this affects international filenames
|
||||||
cultureInfo = new CultureInfo("en-US", false);
|
cultureInfo = new CultureInfo("en-US", false);
|
||||||
|
|||||||
Reference in New Issue
Block a user