mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
REFACTOR: Fixed MOST name inconsistencies.
This commit is contained in:
@@ -34,7 +34,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using DiscImageChef.CommonTypes;
|
||||
using DiscImageChef.ImagePlugins;
|
||||
using DiscImageChef.DiscImages;
|
||||
|
||||
namespace DiscImageChef.Filesystems.AppleDOS
|
||||
{
|
||||
@@ -65,7 +65,7 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
||||
List<string> lockedFiles;
|
||||
#endregion Caches
|
||||
|
||||
VTOC vtoc;
|
||||
Vtoc vtoc;
|
||||
ulong start;
|
||||
int sectorsPerTrack;
|
||||
ulong totalFileEntries;
|
||||
|
||||
@@ -87,19 +87,19 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
||||
fileSizeCache = new Dictionary<string, int>();
|
||||
lockedFiles = new List<string>();
|
||||
|
||||
if(lba == 0 || lba > device.ImageInfo.sectors) return Errno.InvalidArgument;
|
||||
if(lba == 0 || lba > device.ImageInfo.Sectors) return Errno.InvalidArgument;
|
||||
|
||||
while(lba != 0)
|
||||
{
|
||||
usedSectors++;
|
||||
byte[] catSector_b = device.ReadSector(lba);
|
||||
byte[] catSectorB = device.ReadSector(lba);
|
||||
totalFileEntries += 7;
|
||||
if(debug) catalogMs.Write(catSector_b, 0, catSector_b.Length);
|
||||
if(debug) catalogMs.Write(catSectorB, 0, catSectorB.Length);
|
||||
|
||||
// Read the catalog sector
|
||||
CatalogSector catSector = new CatalogSector();
|
||||
IntPtr catPtr = Marshal.AllocHGlobal(256);
|
||||
Marshal.Copy(catSector_b, 0, catPtr, 256);
|
||||
Marshal.Copy(catSectorB, 0, catPtr, 256);
|
||||
catSector = (CatalogSector)Marshal.PtrToStructure(catPtr, typeof(CatalogSector));
|
||||
Marshal.FreeHGlobal(catPtr);
|
||||
|
||||
@@ -110,13 +110,13 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
||||
track1UsedByFiles |= entry.extentTrack == 1;
|
||||
track2UsedByFiles |= entry.extentTrack == 2;
|
||||
|
||||
byte[] filename_b = new byte[30];
|
||||
byte[] filenameB = new byte[30];
|
||||
ushort ts = (ushort)((entry.extentTrack << 8) | entry.extentSector);
|
||||
|
||||
// Apple DOS has high byte set over ASCII.
|
||||
for(int i = 0; i < 30; i++) filename_b[i] = (byte)(entry.filename[i] & 0x7F);
|
||||
for(int i = 0; i < 30; i++) filenameB[i] = (byte)(entry.filename[i] & 0x7F);
|
||||
|
||||
string filename = StringHandlers.SpacePaddedToString(filename_b, CurrentEncoding);
|
||||
string filename = StringHandlers.SpacePaddedToString(filenameB, CurrentEncoding);
|
||||
|
||||
if(!catalogCache.ContainsKey(filename)) catalogCache.Add(filename, ts);
|
||||
|
||||
@@ -133,7 +133,7 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
||||
|
||||
lba = (ulong)((catSector.trackOfNext * sectorsPerTrack) + catSector.sectorOfNext);
|
||||
|
||||
if(lba > device.ImageInfo.sectors) break;
|
||||
if(lba > device.ImageInfo.Sectors) break;
|
||||
}
|
||||
|
||||
if(debug) catalogBlocks = catalogMs.ToArray();
|
||||
|
||||
@@ -181,13 +181,13 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
||||
while(lba != 0)
|
||||
{
|
||||
usedSectors++;
|
||||
byte[] tsSector_b = device.ReadSector(lba);
|
||||
if(debug) tsListMs.Write(tsSector_b, 0, tsSector_b.Length);
|
||||
byte[] tsSectorB = device.ReadSector(lba);
|
||||
if(debug) tsListMs.Write(tsSectorB, 0, tsSectorB.Length);
|
||||
|
||||
// Read the track/sector list sector
|
||||
TrackSectorList tsSector = new TrackSectorList();
|
||||
IntPtr tsPtr = Marshal.AllocHGlobal(256);
|
||||
Marshal.Copy(tsSector_b, 0, tsPtr, 256);
|
||||
Marshal.Copy(tsSectorB, 0, tsPtr, 256);
|
||||
tsSector = (TrackSectorList)Marshal.PtrToStructure(tsPtr, typeof(TrackSectorList));
|
||||
Marshal.FreeHGlobal(tsPtr);
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using DiscImageChef.CommonTypes;
|
||||
using DiscImageChef.ImagePlugins;
|
||||
using DiscImageChef.DiscImages;
|
||||
|
||||
namespace DiscImageChef.Filesystems.AppleDOS
|
||||
{
|
||||
@@ -42,19 +42,19 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
||||
{
|
||||
public override bool Identify(ImagePlugin imagePlugin, Partition partition)
|
||||
{
|
||||
if(imagePlugin.ImageInfo.sectors != 455 && imagePlugin.ImageInfo.sectors != 560) return false;
|
||||
if(imagePlugin.ImageInfo.Sectors != 455 && imagePlugin.ImageInfo.Sectors != 560) return false;
|
||||
|
||||
if(partition.Start > 0 || imagePlugin.ImageInfo.sectorSize != 256) return false;
|
||||
if(partition.Start > 0 || imagePlugin.ImageInfo.SectorSize != 256) return false;
|
||||
|
||||
int spt = 0;
|
||||
if(imagePlugin.ImageInfo.sectors == 455) spt = 13;
|
||||
if(imagePlugin.ImageInfo.Sectors == 455) spt = 13;
|
||||
else spt = 16;
|
||||
|
||||
byte[] vtoc_b = imagePlugin.ReadSector((ulong)(17 * spt));
|
||||
vtoc = new VTOC();
|
||||
byte[] vtocB = imagePlugin.ReadSector((ulong)(17 * spt));
|
||||
vtoc = new Vtoc();
|
||||
IntPtr vtocPtr = Marshal.AllocHGlobal(256);
|
||||
Marshal.Copy(vtoc_b, 0, vtocPtr, 256);
|
||||
vtoc = (VTOC)Marshal.PtrToStructure(vtocPtr, typeof(VTOC));
|
||||
Marshal.Copy(vtocB, 0, vtocPtr, 256);
|
||||
vtoc = (Vtoc)Marshal.PtrToStructure(vtocPtr, typeof(Vtoc));
|
||||
Marshal.FreeHGlobal(vtocPtr);
|
||||
|
||||
return vtoc.catalogSector < spt && vtoc.maxTrackSectorPairsPerSector <= 122 &&
|
||||
@@ -67,14 +67,14 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
int spt = 0;
|
||||
if(imagePlugin.ImageInfo.sectors == 455) spt = 13;
|
||||
if(imagePlugin.ImageInfo.Sectors == 455) spt = 13;
|
||||
else spt = 16;
|
||||
|
||||
byte[] vtoc_b = imagePlugin.ReadSector((ulong)(17 * spt));
|
||||
vtoc = new VTOC();
|
||||
byte[] vtocB = imagePlugin.ReadSector((ulong)(17 * spt));
|
||||
vtoc = new Vtoc();
|
||||
IntPtr vtocPtr = Marshal.AllocHGlobal(256);
|
||||
Marshal.Copy(vtoc_b, 0, vtocPtr, 256);
|
||||
vtoc = (VTOC)Marshal.PtrToStructure(vtocPtr, typeof(VTOC));
|
||||
Marshal.Copy(vtocB, 0, vtocPtr, 256);
|
||||
vtoc = (Vtoc)Marshal.PtrToStructure(vtocPtr, typeof(Vtoc));
|
||||
Marshal.FreeHGlobal(vtocPtr);
|
||||
|
||||
sb.AppendLine("Apple DOS File System");
|
||||
@@ -94,8 +94,8 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
||||
|
||||
xmlFSType = new Schemas.FileSystemType();
|
||||
xmlFSType.Bootable = true;
|
||||
xmlFSType.Clusters = (long)imagePlugin.ImageInfo.sectors;
|
||||
xmlFSType.ClusterSize = (int)imagePlugin.ImageInfo.sectorSize;
|
||||
xmlFSType.Clusters = (long)imagePlugin.ImageInfo.Sectors;
|
||||
xmlFSType.ClusterSize = (int)imagePlugin.ImageInfo.SectorSize;
|
||||
xmlFSType.Type = "Apple DOS";
|
||||
|
||||
return;
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
||||
public partial class AppleDOS : Filesystem
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct VTOC
|
||||
struct Vtoc
|
||||
{
|
||||
public byte unused1;
|
||||
public byte catalogTrack;
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
||||
/// </summary>
|
||||
public override Errno Mount(bool debug)
|
||||
{
|
||||
if(device.ImageInfo.sectors != 455 && device.ImageInfo.sectors != 560)
|
||||
if(device.ImageInfo.Sectors != 455 && device.ImageInfo.Sectors != 560)
|
||||
{
|
||||
DicConsole.DebugWriteLine("Apple DOS plugin", "Incorrect device size.");
|
||||
return Errno.InOutError;
|
||||
@@ -63,21 +63,21 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
||||
return Errno.InOutError;
|
||||
}
|
||||
|
||||
if(device.ImageInfo.sectorSize != 256)
|
||||
if(device.ImageInfo.SectorSize != 256)
|
||||
{
|
||||
DicConsole.DebugWriteLine("Apple DOS plugin", "Incorrect sector size.");
|
||||
return Errno.InOutError;
|
||||
}
|
||||
|
||||
if(device.ImageInfo.sectors == 455) sectorsPerTrack = 13;
|
||||
if(device.ImageInfo.Sectors == 455) sectorsPerTrack = 13;
|
||||
else sectorsPerTrack = 16;
|
||||
|
||||
// Read the VTOC
|
||||
byte[] vtoc_b = device.ReadSector((ulong)(17 * sectorsPerTrack));
|
||||
vtoc = new VTOC();
|
||||
byte[] vtocB = device.ReadSector((ulong)(17 * sectorsPerTrack));
|
||||
vtoc = new Vtoc();
|
||||
IntPtr vtocPtr = Marshal.AllocHGlobal(256);
|
||||
Marshal.Copy(vtoc_b, 0, vtocPtr, 256);
|
||||
vtoc = (VTOC)Marshal.PtrToStructure(vtocPtr, typeof(VTOC));
|
||||
Marshal.Copy(vtocB, 0, vtocPtr, 256);
|
||||
vtoc = (Vtoc)Marshal.PtrToStructure(vtocPtr, typeof(Vtoc));
|
||||
Marshal.FreeHGlobal(vtocPtr);
|
||||
|
||||
track1UsedByFiles = false;
|
||||
@@ -103,7 +103,7 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
||||
// Create XML metadata for mounted filesystem
|
||||
xmlFSType = new Schemas.FileSystemType();
|
||||
xmlFSType.Bootable = true;
|
||||
xmlFSType.Clusters = (long)device.ImageInfo.sectors;
|
||||
xmlFSType.Clusters = (long)device.ImageInfo.Sectors;
|
||||
xmlFSType.ClusterSize = vtoc.bytesPerSector;
|
||||
xmlFSType.Files = catalogCache.Count;
|
||||
xmlFSType.FilesSpecified = true;
|
||||
@@ -137,7 +137,7 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
||||
public override Errno StatFs(ref FileSystemInfo stat)
|
||||
{
|
||||
stat = new FileSystemInfo();
|
||||
stat.Blocks = (long)device.ImageInfo.sectors;
|
||||
stat.Blocks = (long)device.ImageInfo.Sectors;
|
||||
stat.FilenameLength = 30;
|
||||
stat.Files = (ulong)catalogCache.Count;
|
||||
stat.FreeBlocks = stat.Blocks - usedSectors;
|
||||
|
||||
Reference in New Issue
Block a user