mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Add option to pass an arbitrary list of options to IReadOnlyFilesystem.Mount()
This commit is contained in:
@@ -57,6 +57,11 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
|||||||
public string Name => "Apple DOS File System";
|
public string Name => "Apple DOS File System";
|
||||||
public Guid Id => new Guid("8658A1E9-B2E7-4BCC-9638-157A31B0A700\n");
|
public Guid Id => new Guid("8658A1E9-B2E7-4BCC-9638-157A31B0A700\n");
|
||||||
|
|
||||||
|
static Dictionary<string, string> GetDefaultOptions()
|
||||||
|
{
|
||||||
|
return new Dictionary<string, string> {{"debug", false.ToString()}};
|
||||||
|
}
|
||||||
|
|
||||||
#region Caches
|
#region Caches
|
||||||
/// <summary>Caches track/sector lists</summary>
|
/// <summary>Caches track/sector lists</summary>
|
||||||
Dictionary<string, byte[]> extentCache;
|
Dictionary<string, byte[]> extentCache;
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using Claunia.Encoding;
|
using Claunia.Encoding;
|
||||||
using DiscImageChef.CommonTypes;
|
using DiscImageChef.CommonTypes;
|
||||||
@@ -46,7 +47,8 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Mounts an Apple DOS filesystem
|
/// Mounts an Apple DOS filesystem
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Errno Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding, bool debug)
|
public Errno Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding,
|
||||||
|
Dictionary<string, string> options)
|
||||||
{
|
{
|
||||||
device = imagePlugin;
|
device = imagePlugin;
|
||||||
start = partition.Start;
|
start = partition.Start;
|
||||||
@@ -111,7 +113,8 @@ namespace DiscImageChef.Filesystems.AppleDOS
|
|||||||
};
|
};
|
||||||
XmlFsType.FreeClusters = XmlFsType.Clusters - usedSectors;
|
XmlFsType.FreeClusters = XmlFsType.Clusters - usedSectors;
|
||||||
|
|
||||||
this.debug = debug;
|
if(options == null) options = GetDefaultOptions();
|
||||||
|
if(options.TryGetValue("debug", out string debugString)) bool.TryParse(debugString, out debug);
|
||||||
mounted = true;
|
mounted = true;
|
||||||
return Errno.NoError;
|
return Errno.NoError;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using DiscImageChef.CommonTypes;
|
|
||||||
using DiscImageChef.DiscImages;
|
using DiscImageChef.DiscImages;
|
||||||
using Schemas;
|
using Schemas;
|
||||||
|
|
||||||
@@ -68,21 +67,9 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
|||||||
public Guid Id => new Guid("36405F8D-0D26-4066-6538-5DBF5D065C3A");
|
public Guid Id => new Guid("36405F8D-0D26-4066-6538-5DBF5D065C3A");
|
||||||
public Encoding Encoding { get; private set; }
|
public Encoding Encoding { get; private set; }
|
||||||
|
|
||||||
public AppleMFS()
|
static Dictionary<string, string> GetDefaultOptions()
|
||||||
{
|
{
|
||||||
Encoding = Encoding.GetEncoding("macintosh");
|
return new Dictionary<string, string> {{"debug", false.ToString()}};
|
||||||
}
|
|
||||||
|
|
||||||
public AppleMFS(Encoding encoding)
|
|
||||||
{
|
|
||||||
Encoding = encoding ?? Encoding.GetEncoding("macintosh");
|
|
||||||
}
|
|
||||||
|
|
||||||
public AppleMFS(IMediaImage imagePlugin, Partition partition, Encoding encoding)
|
|
||||||
{
|
|
||||||
device = imagePlugin;
|
|
||||||
partitionStart = partition.Start;
|
|
||||||
Encoding = encoding ?? Encoding.GetEncoding("macintosh");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -31,6 +31,7 @@
|
|||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using DiscImageChef.CommonTypes;
|
using DiscImageChef.CommonTypes;
|
||||||
using DiscImageChef.DiscImages;
|
using DiscImageChef.DiscImages;
|
||||||
@@ -41,12 +42,14 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
|||||||
// Information from Inside Macintosh Volume II
|
// Information from Inside Macintosh Volume II
|
||||||
public partial class AppleMFS
|
public partial class AppleMFS
|
||||||
{
|
{
|
||||||
public Errno Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding, bool debug)
|
public Errno Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding,
|
||||||
|
Dictionary<string, string> options)
|
||||||
{
|
{
|
||||||
device = imagePlugin;
|
device = imagePlugin;
|
||||||
partitionStart = partition.Start;
|
partitionStart = partition.Start;
|
||||||
Encoding = encoding ?? Encoding.GetEncoding("macintosh");
|
Encoding = encoding ?? Encoding.GetEncoding("macintosh");
|
||||||
this.debug = debug;
|
if(options == null) options = GetDefaultOptions();
|
||||||
|
if(options.TryGetValue("debug", out string debugString)) bool.TryParse(debugString, out debug);
|
||||||
volMDB = new MFS_MasterDirectoryBlock();
|
volMDB = new MFS_MasterDirectoryBlock();
|
||||||
|
|
||||||
mdbBlocks = device.ReadSector(2 + partitionStart);
|
mdbBlocks = device.ReadSector(2 + partitionStart);
|
||||||
@@ -92,7 +95,8 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
|||||||
uint tmp2 = 0;
|
uint tmp2 = 0;
|
||||||
uint tmp3 = 0;
|
uint tmp3 = 0;
|
||||||
|
|
||||||
if(offset + 4 <= blockMapBytes.Length) tmp1 = BigEndianBitConverter.ToUInt32(blockMapBytes, offset);
|
if(offset + 4 <= blockMapBytes.Length)
|
||||||
|
tmp1 = BigEndianBitConverter.ToUInt32(blockMapBytes, offset);
|
||||||
if(offset + 4 + 4 <= blockMapBytes.Length)
|
if(offset + 4 + 4 <= blockMapBytes.Length)
|
||||||
tmp2 = BigEndianBitConverter.ToUInt32(blockMapBytes, offset + 4);
|
tmp2 = BigEndianBitConverter.ToUInt32(blockMapBytes, offset + 4);
|
||||||
if(offset + 8 + 4 <= blockMapBytes.Length)
|
if(offset + 8 + 4 <= blockMapBytes.Length)
|
||||||
@@ -136,6 +140,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
|||||||
XmlFsType.BackupDate = DateHandlers.MacToDateTime(volMDB.drLsBkUp);
|
XmlFsType.BackupDate = DateHandlers.MacToDateTime(volMDB.drLsBkUp);
|
||||||
XmlFsType.BackupDateSpecified = true;
|
XmlFsType.BackupDateSpecified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
XmlFsType.Bootable = bbSig == MFSBB_MAGIC;
|
XmlFsType.Bootable = bbSig == MFSBB_MAGIC;
|
||||||
XmlFsType.Clusters = volMDB.drNmAlBlks;
|
XmlFsType.Clusters = volMDB.drNmAlBlks;
|
||||||
XmlFsType.ClusterSize = (int)volMDB.drAlBlkSiz;
|
XmlFsType.ClusterSize = (int)volMDB.drAlBlkSiz;
|
||||||
@@ -144,6 +149,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
|
|||||||
XmlFsType.CreationDate = DateHandlers.MacToDateTime(volMDB.drCrDate);
|
XmlFsType.CreationDate = DateHandlers.MacToDateTime(volMDB.drCrDate);
|
||||||
XmlFsType.CreationDateSpecified = true;
|
XmlFsType.CreationDateSpecified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
XmlFsType.Files = volMDB.drNmFls;
|
XmlFsType.Files = volMDB.drNmFls;
|
||||||
XmlFsType.FilesSpecified = true;
|
XmlFsType.FilesSpecified = true;
|
||||||
XmlFsType.FreeClusters = volMDB.drFreeBks;
|
XmlFsType.FreeClusters = volMDB.drFreeBks;
|
||||||
|
|||||||
@@ -116,5 +116,10 @@ namespace DiscImageChef.Filesystems.CPM
|
|||||||
public Encoding Encoding { get; private set; }
|
public Encoding Encoding { get; private set; }
|
||||||
public string Name => "CP/M File System";
|
public string Name => "CP/M File System";
|
||||||
public Guid Id => new Guid("AA2B8585-41DF-4E3B-8A35-D1A935E2F8A1");
|
public Guid Id => new Guid("AA2B8585-41DF-4E3B-8A35-D1A935E2F8A1");
|
||||||
|
|
||||||
|
static Dictionary<string, string> GetDefaultOptions()
|
||||||
|
{
|
||||||
|
return new Dictionary<string, string> {{"debug", false.ToString()}};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -47,10 +47,11 @@ namespace DiscImageChef.Filesystems.CPM
|
|||||||
{
|
{
|
||||||
partial class CPM
|
partial class CPM
|
||||||
{
|
{
|
||||||
public Errno Mount(IMediaImage imagePlugin, Partition partition1, Encoding encoding, bool debug)
|
public Errno Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding,
|
||||||
|
Dictionary<string, string> options)
|
||||||
{
|
{
|
||||||
device = imagePlugin;
|
device = imagePlugin;
|
||||||
partition = partition;
|
this.partition = partition;
|
||||||
Encoding = encoding ?? Encoding.GetEncoding("IBM437");
|
Encoding = encoding ?? Encoding.GetEncoding("IBM437");
|
||||||
|
|
||||||
// As the identification is so complex, just call Identify() and relay on its findings
|
// As the identification is so complex, just call Identify() and relay on its findings
|
||||||
@@ -96,9 +97,8 @@ namespace DiscImageChef.Filesystems.CPM
|
|||||||
return Errno.NotImplemented;
|
return Errno.NotImplemented;
|
||||||
}
|
}
|
||||||
// TODO: Implement COLUMBIA ordering
|
// TODO: Implement COLUMBIA ordering
|
||||||
else if(
|
else if(string.Compare(workingDefinition.order, "COLUMBIA",
|
||||||
string.Compare(workingDefinition.order, "COLUMBIA", StringComparison.InvariantCultureIgnoreCase) ==
|
StringComparison.InvariantCultureIgnoreCase) == 0)
|
||||||
0)
|
|
||||||
{
|
{
|
||||||
DicConsole.DebugWriteLine("CP/M Plugin",
|
DicConsole.DebugWriteLine("CP/M Plugin",
|
||||||
"Don't know how to handle COLUMBIA ordering, not proceeding with this definition.");
|
"Don't know how to handle COLUMBIA ordering, not proceeding with this definition.");
|
||||||
@@ -134,7 +134,8 @@ namespace DiscImageChef.Filesystems.CPM
|
|||||||
device.ReadSector((ulong)((int)partition.Start + p / sectorMask.Length * sectorMask.Length +
|
device.ReadSector((ulong)((int)partition.Start + p / sectorMask.Length * sectorMask.Length +
|
||||||
sectorMask[p % sectorMask.Length]));
|
sectorMask[p % sectorMask.Length]));
|
||||||
if(workingDefinition.complement)
|
if(workingDefinition.complement)
|
||||||
for(int b = 0; b < readSector.Length; b++) readSector[b] = (byte)(~readSector[b] & 0xFF);
|
for(int b = 0; b < readSector.Length; b++)
|
||||||
|
readSector[b] = (byte)(~readSector[b] & 0xFF);
|
||||||
|
|
||||||
deinterleavedSectors.Add((ulong)p, readSector);
|
deinterleavedSectors.Add((ulong)p, readSector);
|
||||||
}
|
}
|
||||||
@@ -174,7 +175,8 @@ namespace DiscImageChef.Filesystems.CPM
|
|||||||
blockMs = new MemoryStream();
|
blockMs = new MemoryStream();
|
||||||
}
|
}
|
||||||
// CP/M blocks are same size than physical sectors
|
// CP/M blocks are same size than physical sectors
|
||||||
else allocationBlocks.Add(blockNo++, sector);
|
else
|
||||||
|
allocationBlocks.Add(blockNo++, sector);
|
||||||
}
|
}
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("CP/M Plugin", "Reading directory.");
|
DicConsole.DebugWriteLine("CP/M Plugin", "Reading directory.");
|
||||||
@@ -238,6 +240,7 @@ namespace DiscImageChef.Filesystems.CPM
|
|||||||
entry.filename[i] &= 0x7F;
|
entry.filename[i] &= 0x7F;
|
||||||
validEntry &= entry.filename[i] >= 0x20;
|
validEntry &= entry.filename[i] >= 0x20;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < 3; i++)
|
for(int i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
entry.extension[i] &= 0x7F;
|
entry.extension[i] &= 0x7F;
|
||||||
@@ -273,11 +276,11 @@ namespace DiscImageChef.Filesystems.CPM
|
|||||||
if(rdOnly) fInfo.Attributes |= FileAttributes.ReadOnly;
|
if(rdOnly) fInfo.Attributes |= FileAttributes.ReadOnly;
|
||||||
if(system) fInfo.Attributes |= FileAttributes.System;
|
if(system) fInfo.Attributes |= FileAttributes.System;
|
||||||
|
|
||||||
// Supposedly there is a value in the directory entry telling how many blocks are designated in this entry
|
// Supposedly there is a value in the directory entry telling how many blocks are designated in
|
||||||
// However some implementations tend to do whatever they wish, but none will ever allocate block 0 for a file
|
// this entry. However some implementations tend to do whatever they wish, but none will ever
|
||||||
// because that's where the directory resides.
|
// allocate block 0 for a file because that's where the directory resides.
|
||||||
// There is also a field telling how many bytes are used in the last block, but its meaning is non-standard so
|
// There is also a field telling how many bytes are used in the last block, but its meaning is
|
||||||
// we must ignore it.
|
// non-standard so we must ignore it.
|
||||||
foreach(ushort blk in entry.allocations.Where(blk => !blocks.Contains(blk) && blk != 0))
|
foreach(ushort blk in entry.allocations.Where(blk => !blocks.Contains(blk) && blk != 0))
|
||||||
blocks.Add(blk);
|
blocks.Add(blk);
|
||||||
|
|
||||||
@@ -326,6 +329,7 @@ namespace DiscImageChef.Filesystems.CPM
|
|||||||
entry.filename[i] &= 0x7F;
|
entry.filename[i] &= 0x7F;
|
||||||
validEntry &= entry.filename[i] >= 0x20;
|
validEntry &= entry.filename[i] >= 0x20;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < 3; i++)
|
for(int i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
entry.extension[i] &= 0x7F;
|
entry.extension[i] &= 0x7F;
|
||||||
@@ -361,11 +365,11 @@ namespace DiscImageChef.Filesystems.CPM
|
|||||||
if(rdOnly) fInfo.Attributes |= FileAttributes.ReadOnly;
|
if(rdOnly) fInfo.Attributes |= FileAttributes.ReadOnly;
|
||||||
if(system) fInfo.Attributes |= FileAttributes.System;
|
if(system) fInfo.Attributes |= FileAttributes.System;
|
||||||
|
|
||||||
// Supposedly there is a value in the directory entry telling how many blocks are designated in this entry
|
// Supposedly there is a value in the directory entry telling how many blocks are designated in
|
||||||
// However some implementations tend to do whatever they wish, but none will ever allocate block 0 for a file
|
// this entry. However some implementations tend to do whatever they wish, but none will ever
|
||||||
// because that's where the directory resides.
|
// allocate block 0 for a file because that's where the directory resides.
|
||||||
// There is also a field telling how many bytes are used in the last block, but its meaning is non-standard so
|
// There is also a field telling how many bytes are used in the last block, but its meaning is
|
||||||
// we must ignore it.
|
// non-standard so we must ignore it.
|
||||||
foreach(ushort blk in entry.allocations.Cast<ushort>()
|
foreach(ushort blk in entry.allocations.Cast<ushort>()
|
||||||
.Where(blk => !blocks.Contains(blk) && blk != 0)) blocks.Add(blk);
|
.Where(blk => !blocks.Contains(blk) && blk != 0)) blocks.Add(blk);
|
||||||
|
|
||||||
@@ -449,7 +453,8 @@ namespace DiscImageChef.Filesystems.CPM
|
|||||||
labelEntry = (LabelEntry)Marshal.PtrToStructure(dirPtr, typeof(LabelEntry));
|
labelEntry = (LabelEntry)Marshal.PtrToStructure(dirPtr, typeof(LabelEntry));
|
||||||
Marshal.FreeHGlobal(dirPtr);
|
Marshal.FreeHGlobal(dirPtr);
|
||||||
|
|
||||||
// The volume label defines if one of the fields in CP/M 3 timestamp is a creation or an access time
|
// The volume label defines if one of the fields in CP/M 3 timestamp is a creation or an
|
||||||
|
// access time
|
||||||
atime |= (labelEntry.flags & 0x40) == 0x40;
|
atime |= (labelEntry.flags & 0x40) == 0x40;
|
||||||
|
|
||||||
label = Encoding.ASCII.GetString(directory, dOff + 1, 11).Trim();
|
label = Encoding.ASCII.GetString(directory, dOff + 1, 11).Trim();
|
||||||
@@ -595,6 +600,7 @@ namespace DiscImageChef.Filesystems.CPM
|
|||||||
file3 = null;
|
file3 = null;
|
||||||
dirCnt = 0;
|
dirCnt = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -671,11 +677,13 @@ namespace DiscImageChef.Filesystems.CPM
|
|||||||
XmlFsType.CreationDate = DateHandlers.CpmToDateTime(labelCreationDate);
|
XmlFsType.CreationDate = DateHandlers.CpmToDateTime(labelCreationDate);
|
||||||
XmlFsType.CreationDateSpecified = true;
|
XmlFsType.CreationDateSpecified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(labelUpdateDate != null)
|
if(labelUpdateDate != null)
|
||||||
{
|
{
|
||||||
XmlFsType.ModificationDate = DateHandlers.CpmToDateTime(labelUpdateDate);
|
XmlFsType.ModificationDate = DateHandlers.CpmToDateTime(labelUpdateDate);
|
||||||
XmlFsType.ModificationDateSpecified = true;
|
XmlFsType.ModificationDateSpecified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!string.IsNullOrEmpty(label)) XmlFsType.VolumeName = label;
|
if(!string.IsNullOrEmpty(label)) XmlFsType.VolumeName = label;
|
||||||
|
|
||||||
mounted = true;
|
mounted = true;
|
||||||
|
|||||||
@@ -31,12 +31,10 @@
|
|||||||
// Copyright © 2011-2018 Natalia Portillo
|
// Copyright © 2011-2018 Natalia Portillo
|
||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using DiscImageChef.CommonTypes;
|
using DiscImageChef.CommonTypes;
|
||||||
using DiscImageChef.DiscImages;
|
using DiscImageChef.DiscImages;
|
||||||
using Schemas;
|
|
||||||
|
|
||||||
namespace DiscImageChef.Filesystems
|
namespace DiscImageChef.Filesystems
|
||||||
{
|
{
|
||||||
@@ -52,13 +50,13 @@ namespace DiscImageChef.Filesystems
|
|||||||
/// <param name="imagePlugin"></param>
|
/// <param name="imagePlugin"></param>
|
||||||
/// <param name="partition"></param>
|
/// <param name="partition"></param>
|
||||||
/// <param name="encoding">Which encoding to use for this filesystem.</param>
|
/// <param name="encoding">Which encoding to use for this filesystem.</param>
|
||||||
/// <param name="debug">If <c>true</c> enable debug.</param>
|
/// <param name="options">Dictionary of key=value pairs containing options to pass to the filesystem</param>
|
||||||
Errno Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding, bool debug);
|
Errno Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding,
|
||||||
|
Dictionary<string, string> options);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Frees all internal structures created by
|
/// Frees all internal structures created by
|
||||||
/// <see
|
/// <see cref="Mount" />
|
||||||
/// cref="M:DiscImageChef.Filesystems.Filesystem.Mount(DiscImageChef.DiscImages.IMediaImage,DiscImageChef.CommonTypes.Partition,System.Text.Encoding,System.Boolean)" />
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Errno Unmount();
|
Errno Unmount();
|
||||||
|
|
||||||
|
|||||||
@@ -56,6 +56,11 @@ namespace DiscImageChef.Filesystems.LisaFS
|
|||||||
public Encoding Encoding { get; private set; }
|
public Encoding Encoding { get; private set; }
|
||||||
public FileSystemType XmlFsType { get; private set; }
|
public FileSystemType XmlFsType { get; private set; }
|
||||||
|
|
||||||
|
static Dictionary<string, string> GetDefaultOptions()
|
||||||
|
{
|
||||||
|
return new Dictionary<string, string> {{"debug", false.ToString()}};
|
||||||
|
}
|
||||||
|
|
||||||
#region Caches
|
#region Caches
|
||||||
/// <summary>Caches Extents Files</summary>
|
/// <summary>Caches Extents Files</summary>
|
||||||
Dictionary<short, ExtentFile> extentCache;
|
Dictionary<short, ExtentFile> extentCache;
|
||||||
|
|||||||
@@ -47,7 +47,8 @@ namespace DiscImageChef.Filesystems.LisaFS
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Mounts an Apple Lisa filesystem
|
/// Mounts an Apple Lisa filesystem
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Errno Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding, bool debug)
|
public Errno Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding,
|
||||||
|
Dictionary<string, string> options)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -104,7 +105,8 @@ namespace DiscImageChef.Filesystems.LisaFS
|
|||||||
mddf.unknown1 = sector[0x2D];
|
mddf.unknown1 = sector[0x2D];
|
||||||
Array.Copy(sector, 0x2E, pString, 0, 33);
|
Array.Copy(sector, 0x2E, pString, 0, 33);
|
||||||
// Prevent garbage
|
// Prevent garbage
|
||||||
mddf.password = pString[0] <= 32 ? StringHandlers.PascalToString(pString, Encoding) : "";
|
mddf.password =
|
||||||
|
pString[0] <= 32 ? StringHandlers.PascalToString(pString, Encoding) : "";
|
||||||
mddf.unknown2 = sector[0x4F];
|
mddf.unknown2 = sector[0x4F];
|
||||||
mddf.machine_id = BigEndianBitConverter.ToUInt32(sector, 0x50);
|
mddf.machine_id = BigEndianBitConverter.ToUInt32(sector, 0x50);
|
||||||
mddf.master_copy_id = BigEndianBitConverter.ToUInt32(sector, 0x54);
|
mddf.master_copy_id = BigEndianBitConverter.ToUInt32(sector, 0x54);
|
||||||
@@ -176,10 +178,14 @@ namespace DiscImageChef.Filesystems.LisaFS
|
|||||||
mddf.vol_left_mounted = sector[0x138];
|
mddf.vol_left_mounted = sector[0x138];
|
||||||
|
|
||||||
// Check that the MDDF is correct
|
// Check that the MDDF is correct
|
||||||
if(mddf.mddf_block != i - volumePrefix || mddf.vol_size > device.Info.Sectors ||
|
if(mddf.mddf_block != i - volumePrefix ||
|
||||||
mddf.vol_size - 1 != mddf.volsize_minus_one ||
|
mddf.vol_size > device.Info.Sectors ||
|
||||||
mddf.vol_size - i - 1 != mddf.volsize_minus_mddf_minus_one - volumePrefix ||
|
mddf.vol_size - 1 !=
|
||||||
mddf.datasize > mddf.blocksize || mddf.blocksize < device.Info.SectorSize ||
|
mddf.volsize_minus_one ||
|
||||||
|
mddf.vol_size - i - 1 !=
|
||||||
|
mddf.volsize_minus_mddf_minus_one - volumePrefix ||
|
||||||
|
mddf.datasize >
|
||||||
|
mddf.blocksize || mddf.blocksize < device.Info.SectorSize ||
|
||||||
mddf.datasize != device.Info.SectorSize)
|
mddf.datasize != device.Info.SectorSize)
|
||||||
{
|
{
|
||||||
DicConsole.DebugWriteLine("LisaFS plugin", "Incorrect MDDF found");
|
DicConsole.DebugWriteLine("LisaFS plugin", "Incorrect MDDF found");
|
||||||
@@ -211,7 +217,8 @@ namespace DiscImageChef.Filesystems.LisaFS
|
|||||||
fileSizeCache = new Dictionary<short, int>();
|
fileSizeCache = new Dictionary<short, int>();
|
||||||
|
|
||||||
mounted = true;
|
mounted = true;
|
||||||
this.debug = debug;
|
if(options == null) options = GetDefaultOptions();
|
||||||
|
if(options.TryGetValue("debug", out string debugString)) bool.TryParse(debugString, out debug);
|
||||||
|
|
||||||
if(debug) printedExtents = new List<short>();
|
if(debug) printedExtents = new List<short>();
|
||||||
|
|
||||||
@@ -287,6 +294,7 @@ namespace DiscImageChef.Filesystems.LisaFS
|
|||||||
XmlFsType.BackupDate = mddf.dtvb;
|
XmlFsType.BackupDate = mddf.dtvb;
|
||||||
XmlFsType.BackupDateSpecified = true;
|
XmlFsType.BackupDateSpecified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
XmlFsType.Clusters = mddf.vol_size;
|
XmlFsType.Clusters = mddf.vol_size;
|
||||||
XmlFsType.ClusterSize = mddf.clustersize * mddf.datasize;
|
XmlFsType.ClusterSize = mddf.clustersize * mddf.datasize;
|
||||||
if(DateTime.Compare(mddf.dtvc, DateHandlers.LisaToDateTime(0)) > 0)
|
if(DateTime.Compare(mddf.dtvc, DateHandlers.LisaToDateTime(0)) > 0)
|
||||||
@@ -294,6 +302,7 @@ namespace DiscImageChef.Filesystems.LisaFS
|
|||||||
XmlFsType.CreationDate = mddf.dtvc;
|
XmlFsType.CreationDate = mddf.dtvc;
|
||||||
XmlFsType.CreationDateSpecified = true;
|
XmlFsType.CreationDateSpecified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
XmlFsType.Dirty = mddf.vol_left_mounted != 0;
|
XmlFsType.Dirty = mddf.vol_left_mounted != 0;
|
||||||
XmlFsType.Files = mddf.filecount;
|
XmlFsType.Files = mddf.filecount;
|
||||||
XmlFsType.FilesSpecified = true;
|
XmlFsType.FilesSpecified = true;
|
||||||
|
|||||||
@@ -43,11 +43,13 @@ namespace DiscImageChef.Filesystems.UCSDPascal
|
|||||||
// Information from Call-A.P.P.L.E. Pascal Disk Directory Structure
|
// Information from Call-A.P.P.L.E. Pascal Disk Directory Structure
|
||||||
public partial class PascalPlugin
|
public partial class PascalPlugin
|
||||||
{
|
{
|
||||||
public Errno Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding, bool debug)
|
public Errno Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding,
|
||||||
|
Dictionary<string, string> options)
|
||||||
{
|
{
|
||||||
device = imagePlugin;
|
device = imagePlugin;
|
||||||
Encoding = encoding ?? new Apple2();
|
Encoding = encoding ?? new Apple2();
|
||||||
this.debug = debug;
|
if(options == null) options = GetDefaultOptions();
|
||||||
|
if(options.TryGetValue("debug", out string debugString)) bool.TryParse(debugString, out debug);
|
||||||
if(device.Info.Sectors < 3) return Errno.InvalidArgument;
|
if(device.Info.Sectors < 3) return Errno.InvalidArgument;
|
||||||
|
|
||||||
// Blocks 0 and 1 are boot code
|
// Blocks 0 and 1 are boot code
|
||||||
@@ -66,11 +68,14 @@ namespace DiscImageChef.Filesystems.UCSDPascal
|
|||||||
mountedVolEntry.lastBoot = BigEndianBitConverter.ToInt16(catalogBlocks, 0x14);
|
mountedVolEntry.lastBoot = BigEndianBitConverter.ToInt16(catalogBlocks, 0x14);
|
||||||
mountedVolEntry.tail = BigEndianBitConverter.ToInt32(catalogBlocks, 0x16);
|
mountedVolEntry.tail = BigEndianBitConverter.ToInt32(catalogBlocks, 0x16);
|
||||||
|
|
||||||
if(mountedVolEntry.firstBlock != 0 || mountedVolEntry.lastBlock <= mountedVolEntry.firstBlock ||
|
if(mountedVolEntry.firstBlock != 0 ||
|
||||||
|
mountedVolEntry.lastBlock <= mountedVolEntry.firstBlock ||
|
||||||
(ulong)mountedVolEntry.lastBlock > device.Info.Sectors - 2 ||
|
(ulong)mountedVolEntry.lastBlock > device.Info.Sectors - 2 ||
|
||||||
mountedVolEntry.entryType != PascalFileKind.Volume &&
|
mountedVolEntry.entryType != PascalFileKind.Volume &&
|
||||||
mountedVolEntry.entryType != PascalFileKind.Secure || mountedVolEntry.volumeName[0] > 7 ||
|
mountedVolEntry.entryType != PascalFileKind.Secure ||
|
||||||
mountedVolEntry.blocks < 0 || (ulong)mountedVolEntry.blocks != device.Info.Sectors ||
|
mountedVolEntry.volumeName[0] > 7 ||
|
||||||
|
mountedVolEntry.blocks < 0 ||
|
||||||
|
(ulong)mountedVolEntry.blocks != device.Info.Sectors ||
|
||||||
mountedVolEntry.files < 0) return Errno.InvalidArgument;
|
mountedVolEntry.files < 0) return Errno.InvalidArgument;
|
||||||
|
|
||||||
catalogBlocks = device.ReadSectors(2, (uint)(mountedVolEntry.lastBlock - mountedVolEntry.firstBlock - 2));
|
catalogBlocks = device.ReadSectors(2, (uint)(mountedVolEntry.lastBlock - mountedVolEntry.firstBlock - 2));
|
||||||
@@ -133,6 +138,7 @@ namespace DiscImageChef.Filesystems.UCSDPascal
|
|||||||
};
|
};
|
||||||
|
|
||||||
stat.FreeBlocks = mountedVolEntry.blocks - (mountedVolEntry.lastBlock - mountedVolEntry.firstBlock);
|
stat.FreeBlocks = mountedVolEntry.blocks - (mountedVolEntry.lastBlock - mountedVolEntry.firstBlock);
|
||||||
|
|
||||||
foreach(PascalFileEntry entry in fileEntries) stat.FreeBlocks -= entry.lastBlock - entry.firstBlock;
|
foreach(PascalFileEntry entry in fileEntries) stat.FreeBlocks -= entry.lastBlock - entry.firstBlock;
|
||||||
|
|
||||||
return Errno.NotImplemented;
|
return Errno.NotImplemented;
|
||||||
|
|||||||
@@ -72,5 +72,10 @@ namespace DiscImageChef.Filesystems.UCSDPascal
|
|||||||
dest = null;
|
dest = null;
|
||||||
return Errno.NotSupported;
|
return Errno.NotSupported;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Dictionary<string, string> GetDefaultOptions()
|
||||||
|
{
|
||||||
|
return new Dictionary<string, string> {{"debug", false.ToString()}};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user