mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
🎨Converted all plugin types to interfaces.
This commit is contained in:
@@ -45,7 +45,7 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
/// </summary>
|
||||
/// <param name="path">Link path.</param>
|
||||
/// <param name="dest">Link destination.</param>
|
||||
public override Errno ReadLink(string path, ref string dest)
|
||||
public virtual Errno ReadLink(string path, ref string dest)
|
||||
{
|
||||
// LisaFS does not support symbolic links (afaik)
|
||||
return Errno.NotSupported;
|
||||
@@ -56,7 +56,7 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
/// </summary>
|
||||
/// <param name="path">Directory path.</param>
|
||||
/// <param name="contents">Directory contents.</param>
|
||||
public override Errno ReadDir(string path, ref List<string> contents)
|
||||
public virtual Errno ReadDir(string path, ref List<string> contents)
|
||||
{
|
||||
Errno error = LookupFileId(path, out short fileId, out bool isDir);
|
||||
if(error != Errno.NoError) return error;
|
||||
@@ -92,7 +92,7 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
// as '-' is the path separator in Lisa OS
|
||||
contents = (from entry in catalogCache
|
||||
where entry.parentID == dirId
|
||||
select StringHandlers.CToString(entry.filename, CurrentEncoding).Replace('/', '-')).ToList();
|
||||
select StringHandlers.CToString(entry.filename, currentEncoding).Replace('/', '-')).ToList();
|
||||
|
||||
return Errno.NoError;
|
||||
}
|
||||
@@ -164,7 +164,7 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
// Search for the first sector describing the catalog
|
||||
// While root catalog is not stored in S-Records, probably rest are? (unchecked)
|
||||
// If root catalog is not pointed in MDDF (unchecked) maybe it's always following S-Records File?
|
||||
for(ulong i = 0; i < device.ImageInfo.Sectors; i++)
|
||||
for(ulong i = 0; i < device.Info.Sectors; i++)
|
||||
{
|
||||
DecodeTag(device.ReadSectorTag(i, SectorTagType.AppleSectorTag), out LisaTag.PriamTag catTag);
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
{
|
||||
public partial class LisaFS
|
||||
{
|
||||
public override Errno MapBlock(string path, long fileBlock, ref long deviceBlock)
|
||||
public virtual Errno MapBlock(string path, long fileBlock, ref long deviceBlock)
|
||||
{
|
||||
// TODO: Not really important.
|
||||
return Errno.NotImplemented;
|
||||
@@ -78,11 +78,11 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
// This happens on some disks.
|
||||
// This is a filesystem corruption that makes LisaOS crash on scavenge.
|
||||
// This code just allow to ignore that corruption by searching the Extents File using sector tags
|
||||
if(ptr >= device.ImageInfo.Sectors)
|
||||
if(ptr >= device.Info.Sectors)
|
||||
{
|
||||
bool found = false;
|
||||
|
||||
for(ulong i = 0; i < device.ImageInfo.Sectors; i++)
|
||||
for(ulong i = 0; i < device.Info.Sectors; i++)
|
||||
{
|
||||
DecodeTag(device.ReadSectorTag(i, SectorTagType.AppleSectorTag), out extTag);
|
||||
if(extTag.FileId != fileId * -1) continue;
|
||||
@@ -185,7 +185,7 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].filenameLen = {1}", fileId, file.filenameLen);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].filename = {1}", fileId,
|
||||
StringHandlers.CToString(file.filename, CurrentEncoding));
|
||||
StringHandlers.CToString(file.filename, currentEncoding));
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown1 = 0x{1:X4}", fileId, file.unknown1);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].file_uid = 0x{1:X16}", fileId, file.file_uid);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown2 = 0x{1:X2}", fileId, file.unknown2);
|
||||
@@ -219,7 +219,7 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].password_valid = {1}", fileId,
|
||||
file.password_valid > 0);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].password = {1}", fileId,
|
||||
CurrentEncoding.GetString(file.password));
|
||||
currentEncoding.GetString(file.password));
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown7 = 0x{1:X2}{2:X2}{3:X2}", fileId,
|
||||
file.unknown7[0], file.unknown7[1], file.unknown7[2]);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].overhead = {1}", fileId, file.overhead);
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
{
|
||||
public partial class LisaFS
|
||||
{
|
||||
public override Errno GetAttributes(string path, ref FileAttributes attributes)
|
||||
public virtual Errno GetAttributes(string path, ref FileAttributes attributes)
|
||||
{
|
||||
Errno error = LookupFileId(path, out short fileId, out bool isDir);
|
||||
if(error != Errno.NoError) return error;
|
||||
@@ -52,7 +52,7 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
return Errno.NoError;
|
||||
}
|
||||
|
||||
public override Errno Read(string path, long offset, long size, ref byte[] buf)
|
||||
public virtual Errno Read(string path, long offset, long size, ref byte[] buf)
|
||||
{
|
||||
if(size == 0)
|
||||
{
|
||||
@@ -94,7 +94,7 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
return Errno.NoError;
|
||||
}
|
||||
|
||||
public override Errno Stat(string path, ref FileEntryInfo stat)
|
||||
public virtual Errno Stat(string path, ref FileEntryInfo stat)
|
||||
{
|
||||
Errno error = LookupFileId(path, out short fileId, out bool isDir);
|
||||
if(error != Errno.NoError) return error;
|
||||
@@ -194,7 +194,7 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
|
||||
if(count == 0) return Errno.NoSuchFile;
|
||||
|
||||
buf = !tags ? new byte[count * device.ImageInfo.SectorSize] : new byte[count * devTagSize];
|
||||
buf = !tags ? new byte[count * device.Info.SectorSize] : new byte[count * devTagSize];
|
||||
|
||||
// Should be enough to check 100 sectors?
|
||||
for(ulong i = 0; i < 100; i++)
|
||||
@@ -325,7 +325,7 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
|
||||
int sectorSize;
|
||||
if(tags) sectorSize = devTagSize;
|
||||
else sectorSize = (int)device.ImageInfo.SectorSize;
|
||||
else sectorSize = (int)device.Info.SectorSize;
|
||||
|
||||
byte[] temp = new byte[file.length * sectorSize];
|
||||
|
||||
@@ -423,7 +423,7 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
|
||||
foreach(CatalogEntry entry in catalogCache)
|
||||
{
|
||||
string filename = StringHandlers.CToString(entry.filename, CurrentEncoding);
|
||||
string filename = StringHandlers.CToString(entry.filename, currentEncoding);
|
||||
|
||||
// LisaOS is case insensitive
|
||||
if(string.Compare(wantedFilename, filename, StringComparison.InvariantCultureIgnoreCase) != 0 ||
|
||||
|
||||
@@ -42,19 +42,19 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
{
|
||||
public partial class LisaFS
|
||||
{
|
||||
public override bool Identify(ImagePlugin imagePlugin, Partition partition)
|
||||
public virtual bool Identify(IMediaImage imagePlugin, Partition partition)
|
||||
{
|
||||
try
|
||||
{
|
||||
if(imagePlugin.ImageInfo.ReadableSectorTags == null) return false;
|
||||
if(imagePlugin.Info.ReadableSectorTags == null) return false;
|
||||
|
||||
if(!imagePlugin.ImageInfo.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag)) return false;
|
||||
if(!imagePlugin.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag)) return false;
|
||||
|
||||
// LisaOS is big-endian
|
||||
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
||||
|
||||
// Minimal LisaOS disk is 3.5" single sided double density, 800 sectors
|
||||
if(imagePlugin.ImageInfo.Sectors < 800) return false;
|
||||
if(imagePlugin.Info.Sectors < 800) return false;
|
||||
|
||||
int beforeMddf = -1;
|
||||
|
||||
@@ -84,19 +84,19 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "Current sector = {0}", i);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.mddf_block = {0}", infoMddf.mddf_block);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "Disk size = {0} sectors",
|
||||
imagePlugin.ImageInfo.Sectors);
|
||||
imagePlugin.Info.Sectors);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.vol_size = {0} sectors", infoMddf.vol_size);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.vol_size - 1 = {0}", infoMddf.volsize_minus_one);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.vol_size - mddf.mddf_block -1 = {0}",
|
||||
infoMddf.volsize_minus_mddf_minus_one);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "Disk sector = {0} bytes",
|
||||
imagePlugin.ImageInfo.SectorSize);
|
||||
imagePlugin.Info.SectorSize);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.blocksize = {0} bytes", infoMddf.blocksize);
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.datasize = {0} bytes", infoMddf.datasize);
|
||||
|
||||
if(infoMddf.mddf_block != i - beforeMddf) return false;
|
||||
|
||||
if(infoMddf.vol_size > imagePlugin.ImageInfo.Sectors) return false;
|
||||
if(infoMddf.vol_size > imagePlugin.Info.Sectors) return false;
|
||||
|
||||
if(infoMddf.vol_size - 1 != infoMddf.volsize_minus_one) return false;
|
||||
|
||||
@@ -104,9 +104,9 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
|
||||
if(infoMddf.datasize > infoMddf.blocksize) return false;
|
||||
|
||||
if(infoMddf.blocksize < imagePlugin.ImageInfo.SectorSize) return false;
|
||||
if(infoMddf.blocksize < imagePlugin.Info.SectorSize) return false;
|
||||
|
||||
return infoMddf.datasize == imagePlugin.ImageInfo.SectorSize;
|
||||
return infoMddf.datasize == imagePlugin.Info.SectorSize;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -118,22 +118,22 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetInformation(ImagePlugin imagePlugin, Partition partition, out string information)
|
||||
public virtual void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
|
||||
{
|
||||
information = "";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
try
|
||||
{
|
||||
if(imagePlugin.ImageInfo.ReadableSectorTags == null) return;
|
||||
if(imagePlugin.Info.ReadableSectorTags == null) return;
|
||||
|
||||
if(!imagePlugin.ImageInfo.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag)) return;
|
||||
if(!imagePlugin.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag)) return;
|
||||
|
||||
// LisaOS is big-endian
|
||||
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
||||
|
||||
// Minimal LisaOS disk is 3.5" single sided double density, 800 sectors
|
||||
if(imagePlugin.ImageInfo.Sectors < 800) return;
|
||||
if(imagePlugin.Info.Sectors < 800) return;
|
||||
|
||||
int beforeMddf = -1;
|
||||
|
||||
@@ -158,11 +158,11 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
infoMddf.volid = BigEndianBitConverter.ToUInt64(sector, 0x02);
|
||||
infoMddf.volnum = BigEndianBitConverter.ToUInt16(sector, 0x0A);
|
||||
Array.Copy(sector, 0x0C, pString, 0, 33);
|
||||
infoMddf.volname = StringHandlers.PascalToString(pString, CurrentEncoding);
|
||||
infoMddf.volname = StringHandlers.PascalToString(pString, currentEncoding);
|
||||
infoMddf.unknown1 = sector[0x2D];
|
||||
Array.Copy(sector, 0x2E, pString, 0, 33);
|
||||
// Prevent garbage
|
||||
infoMddf.password = pString[0] <= 32 ? StringHandlers.PascalToString(pString, CurrentEncoding) : "";
|
||||
infoMddf.password = pString[0] <= 32 ? StringHandlers.PascalToString(pString, currentEncoding) : "";
|
||||
infoMddf.unknown2 = sector[0x4F];
|
||||
infoMddf.machine_id = BigEndianBitConverter.ToUInt32(sector, 0x50);
|
||||
infoMddf.master_copy_id = BigEndianBitConverter.ToUInt32(sector, 0x54);
|
||||
@@ -276,7 +276,7 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
|
||||
if(infoMddf.mddf_block != i - beforeMddf) return;
|
||||
|
||||
if(infoMddf.vol_size > imagePlugin.ImageInfo.Sectors) return;
|
||||
if(infoMddf.vol_size > imagePlugin.Info.Sectors) return;
|
||||
|
||||
if(infoMddf.vol_size - 1 != infoMddf.volsize_minus_one) return;
|
||||
|
||||
@@ -284,9 +284,9 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
|
||||
if(infoMddf.datasize > infoMddf.blocksize) return;
|
||||
|
||||
if(infoMddf.blocksize < imagePlugin.ImageInfo.SectorSize) return;
|
||||
if(infoMddf.blocksize < imagePlugin.Info.SectorSize) return;
|
||||
|
||||
if(infoMddf.datasize != imagePlugin.ImageInfo.SectorSize) return;
|
||||
if(infoMddf.datasize != imagePlugin.Info.SectorSize) return;
|
||||
|
||||
switch(infoMddf.fsversion)
|
||||
{
|
||||
@@ -348,27 +348,27 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
|
||||
information = sb.ToString();
|
||||
|
||||
XmlFsType = new FileSystemType();
|
||||
xmlFsType = new FileSystemType();
|
||||
if(DateTime.Compare(infoMddf.dtvb, DateHandlers.LisaToDateTime(0)) > 0)
|
||||
{
|
||||
XmlFsType.BackupDate = infoMddf.dtvb;
|
||||
XmlFsType.BackupDateSpecified = true;
|
||||
xmlFsType.BackupDate = infoMddf.dtvb;
|
||||
xmlFsType.BackupDateSpecified = true;
|
||||
}
|
||||
XmlFsType.Clusters = infoMddf.vol_size;
|
||||
XmlFsType.ClusterSize = infoMddf.clustersize * infoMddf.datasize;
|
||||
xmlFsType.Clusters = infoMddf.vol_size;
|
||||
xmlFsType.ClusterSize = infoMddf.clustersize * infoMddf.datasize;
|
||||
if(DateTime.Compare(infoMddf.dtvc, DateHandlers.LisaToDateTime(0)) > 0)
|
||||
{
|
||||
XmlFsType.CreationDate = infoMddf.dtvc;
|
||||
XmlFsType.CreationDateSpecified = true;
|
||||
xmlFsType.CreationDate = infoMddf.dtvc;
|
||||
xmlFsType.CreationDateSpecified = true;
|
||||
}
|
||||
XmlFsType.Dirty = infoMddf.vol_left_mounted != 0;
|
||||
XmlFsType.Files = infoMddf.filecount;
|
||||
XmlFsType.FilesSpecified = true;
|
||||
XmlFsType.FreeClusters = infoMddf.freecount;
|
||||
XmlFsType.FreeClustersSpecified = true;
|
||||
XmlFsType.Type = "LisaFS";
|
||||
XmlFsType.VolumeName = infoMddf.volname;
|
||||
XmlFsType.VolumeSerial = $"{infoMddf.volid:X16}";
|
||||
xmlFsType.Dirty = infoMddf.vol_left_mounted != 0;
|
||||
xmlFsType.Files = infoMddf.filecount;
|
||||
xmlFsType.FilesSpecified = true;
|
||||
xmlFsType.FreeClusters = infoMddf.freecount;
|
||||
xmlFsType.FreeClustersSpecified = true;
|
||||
xmlFsType.Type = "LisaFS";
|
||||
xmlFsType.VolumeName = infoMddf.volname;
|
||||
xmlFsType.VolumeSerial = $"{infoMddf.volid:X16}";
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -35,15 +35,17 @@ using System.Collections.Generic;
|
||||
using Claunia.Encoding;
|
||||
using DiscImageChef.CommonTypes;
|
||||
using DiscImageChef.DiscImages;
|
||||
using Schemas;
|
||||
using Encoding = System.Text.Encoding;
|
||||
|
||||
namespace DiscImageChef.Filesystems.LisaFS
|
||||
{
|
||||
// All information by Natalia Portillo
|
||||
// Variable names from Lisa API
|
||||
public partial class LisaFS : Filesystem
|
||||
public partial class LisaFS : IFilesystem
|
||||
{
|
||||
readonly ImagePlugin device;
|
||||
IMediaImage device;
|
||||
Encoding currentEncoding;
|
||||
bool debug;
|
||||
int devTagSize;
|
||||
|
||||
@@ -52,27 +54,11 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
SRecord[] srecords;
|
||||
ulong volumePrefix;
|
||||
|
||||
public LisaFS()
|
||||
{
|
||||
Name = "Apple Lisa File System";
|
||||
PluginUuid = new Guid("7E6034D1-D823-4248-A54D-239742B28391");
|
||||
CurrentEncoding = new LisaRoman();
|
||||
}
|
||||
|
||||
public LisaFS(Encoding encoding)
|
||||
{
|
||||
Name = "Apple Lisa File System";
|
||||
PluginUuid = new Guid("7E6034D1-D823-4248-A54D-239742B28391");
|
||||
CurrentEncoding = new LisaRoman();
|
||||
}
|
||||
|
||||
public LisaFS(ImagePlugin imagePlugin, Partition partition, Encoding encoding)
|
||||
{
|
||||
device = imagePlugin;
|
||||
Name = "Apple Lisa File System";
|
||||
PluginUuid = new Guid("7E6034D1-D823-4248-A54D-239742B28391");
|
||||
CurrentEncoding = new LisaRoman();
|
||||
}
|
||||
public virtual string Name => "Apple Lisa File System";
|
||||
public virtual Guid Id => new Guid("7E6034D1-D823-4248-A54D-239742B28391");
|
||||
public virtual Encoding Encoding => currentEncoding;
|
||||
FileSystemType xmlFsType;
|
||||
public virtual FileSystemType XmlFsType => xmlFsType;
|
||||
|
||||
#region Caches
|
||||
/// <summary>Caches Extents Files</summary>
|
||||
|
||||
@@ -32,10 +32,13 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Claunia.Encoding;
|
||||
using DiscImageChef.CommonTypes;
|
||||
using DiscImageChef.Console;
|
||||
using DiscImageChef.Decoders;
|
||||
using DiscImageChef.DiscImages;
|
||||
using Schemas;
|
||||
using Encoding = System.Text.Encoding;
|
||||
|
||||
namespace DiscImageChef.Filesystems.LisaFS
|
||||
{
|
||||
@@ -44,23 +47,18 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
/// <summary>
|
||||
/// Mounts an Apple Lisa filesystem
|
||||
/// </summary>
|
||||
public override Errno Mount()
|
||||
{
|
||||
return Mount(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Mounts an Apple Lisa filesystem
|
||||
/// </summary>
|
||||
public override Errno Mount(bool debug)
|
||||
public virtual Errno Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding, bool debug)
|
||||
{
|
||||
try
|
||||
{
|
||||
device = imagePlugin;
|
||||
currentEncoding = new LisaRoman();
|
||||
|
||||
// Lisa OS is unable to work on disks without tags.
|
||||
// This code is designed like that.
|
||||
// However with some effort the code may be modified to ignore them.
|
||||
if(device.ImageInfo.ReadableSectorTags == null ||
|
||||
!device.ImageInfo.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag))
|
||||
if(device.Info.ReadableSectorTags == null ||
|
||||
!device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag))
|
||||
{
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "Underlying device does not support Lisa tags");
|
||||
return Errno.InOutError;
|
||||
@@ -70,14 +68,14 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
||||
|
||||
// Minimal LisaOS disk is 3.5" single sided double density, 800 sectors
|
||||
if(device.ImageInfo.Sectors < 800)
|
||||
if(device.Info.Sectors < 800)
|
||||
{
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "Device is too small");
|
||||
return Errno.InOutError;
|
||||
}
|
||||
|
||||
// MDDF cannot be at end of device, of course
|
||||
volumePrefix = device.ImageInfo.Sectors;
|
||||
volumePrefix = device.Info.Sectors;
|
||||
|
||||
// LisaOS searches sectors until tag tells MDDF resides there, so we'll search 100 sectors
|
||||
for(ulong i = 0; i < 100; i++)
|
||||
@@ -86,7 +84,7 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "Sector {0}, file ID 0x{1:X4}", i, searchTag.FileId);
|
||||
|
||||
if(volumePrefix == device.ImageInfo.Sectors && searchTag.FileId == FILEID_LOADER_SIGNED)
|
||||
if(volumePrefix == device.Info.Sectors && searchTag.FileId == FILEID_LOADER_SIGNED)
|
||||
volumePrefix = i - 1;
|
||||
|
||||
if(searchTag.FileId != FILEID_MDDF) continue;
|
||||
@@ -102,11 +100,11 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
mddf.volid = BigEndianBitConverter.ToUInt64(sector, 0x02);
|
||||
mddf.volnum = BigEndianBitConverter.ToUInt16(sector, 0x0A);
|
||||
Array.Copy(sector, 0x0C, pString, 0, 33);
|
||||
mddf.volname = StringHandlers.PascalToString(pString, CurrentEncoding);
|
||||
mddf.volname = StringHandlers.PascalToString(pString, currentEncoding);
|
||||
mddf.unknown1 = sector[0x2D];
|
||||
Array.Copy(sector, 0x2E, pString, 0, 33);
|
||||
// Prevent garbage
|
||||
mddf.password = pString[0] <= 32 ? StringHandlers.PascalToString(pString, CurrentEncoding) : "";
|
||||
mddf.password = pString[0] <= 32 ? StringHandlers.PascalToString(pString, currentEncoding) : "";
|
||||
mddf.unknown2 = sector[0x4F];
|
||||
mddf.machine_id = BigEndianBitConverter.ToUInt32(sector, 0x50);
|
||||
mddf.master_copy_id = BigEndianBitConverter.ToUInt32(sector, 0x54);
|
||||
@@ -178,11 +176,11 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
mddf.vol_left_mounted = sector[0x138];
|
||||
|
||||
// Check that the MDDF is correct
|
||||
if(mddf.mddf_block != i - volumePrefix || mddf.vol_size > device.ImageInfo.Sectors ||
|
||||
if(mddf.mddf_block != i - volumePrefix || mddf.vol_size > device.Info.Sectors ||
|
||||
mddf.vol_size - 1 != mddf.volsize_minus_one ||
|
||||
mddf.vol_size - i - 1 != mddf.volsize_minus_mddf_minus_one - volumePrefix ||
|
||||
mddf.datasize > mddf.blocksize || mddf.blocksize < device.ImageInfo.SectorSize ||
|
||||
mddf.datasize != device.ImageInfo.SectorSize)
|
||||
mddf.datasize > mddf.blocksize || mddf.blocksize < device.Info.SectorSize ||
|
||||
mddf.datasize != device.Info.SectorSize)
|
||||
{
|
||||
DicConsole.DebugWriteLine("LisaFS plugin", "Incorrect MDDF found");
|
||||
return Errno.InvalidArgument;
|
||||
@@ -283,27 +281,27 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
}
|
||||
|
||||
// Create XML metadata for mounted filesystem
|
||||
XmlFsType = new FileSystemType();
|
||||
xmlFsType = new FileSystemType();
|
||||
if(DateTime.Compare(mddf.dtvb, DateHandlers.LisaToDateTime(0)) > 0)
|
||||
{
|
||||
XmlFsType.BackupDate = mddf.dtvb;
|
||||
XmlFsType.BackupDateSpecified = true;
|
||||
xmlFsType.BackupDate = mddf.dtvb;
|
||||
xmlFsType.BackupDateSpecified = true;
|
||||
}
|
||||
XmlFsType.Clusters = mddf.vol_size;
|
||||
XmlFsType.ClusterSize = mddf.clustersize * mddf.datasize;
|
||||
xmlFsType.Clusters = mddf.vol_size;
|
||||
xmlFsType.ClusterSize = mddf.clustersize * mddf.datasize;
|
||||
if(DateTime.Compare(mddf.dtvc, DateHandlers.LisaToDateTime(0)) > 0)
|
||||
{
|
||||
XmlFsType.CreationDate = mddf.dtvc;
|
||||
XmlFsType.CreationDateSpecified = true;
|
||||
xmlFsType.CreationDate = mddf.dtvc;
|
||||
xmlFsType.CreationDateSpecified = true;
|
||||
}
|
||||
XmlFsType.Dirty = mddf.vol_left_mounted != 0;
|
||||
XmlFsType.Files = mddf.filecount;
|
||||
XmlFsType.FilesSpecified = true;
|
||||
XmlFsType.FreeClusters = mddf.freecount;
|
||||
XmlFsType.FreeClustersSpecified = true;
|
||||
XmlFsType.Type = "LisaFS";
|
||||
XmlFsType.VolumeName = mddf.volname;
|
||||
XmlFsType.VolumeSerial = $"{mddf.volid:X16}";
|
||||
xmlFsType.Dirty = mddf.vol_left_mounted != 0;
|
||||
xmlFsType.Files = mddf.filecount;
|
||||
xmlFsType.FilesSpecified = true;
|
||||
xmlFsType.FreeClusters = mddf.freecount;
|
||||
xmlFsType.FreeClustersSpecified = true;
|
||||
xmlFsType.Type = "LisaFS";
|
||||
xmlFsType.VolumeName = mddf.volname;
|
||||
xmlFsType.VolumeSerial = $"{mddf.volid:X16}";
|
||||
|
||||
return Errno.NoError;
|
||||
}
|
||||
@@ -321,7 +319,7 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
/// <summary>
|
||||
/// Umounts this Lisa filesystem
|
||||
/// </summary>
|
||||
public override Errno Unmount()
|
||||
public virtual Errno Unmount()
|
||||
{
|
||||
mounted = false;
|
||||
extentCache = null;
|
||||
@@ -342,7 +340,7 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
/// Gets information about the mounted volume.
|
||||
/// </summary>
|
||||
/// <param name="stat">Information about the mounted volume.</param>
|
||||
public override Errno StatFs(ref FileSystemInfo stat)
|
||||
public virtual Errno StatFs(ref FileSystemInfo stat)
|
||||
{
|
||||
if(!mounted) return Errno.AccessDenied;
|
||||
|
||||
@@ -353,7 +351,7 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
Files = mddf.filecount,
|
||||
FreeBlocks = mddf.freecount,
|
||||
Id = {Serial64 = mddf.volid, IsLong = true},
|
||||
PluginId = PluginUuid
|
||||
PluginId = Id
|
||||
};
|
||||
stat.FreeFiles = FILEID_MAX - stat.Files;
|
||||
switch(mddf.fsversion)
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
/// <returns>Error number.</returns>
|
||||
/// <param name="path">Path.</param>
|
||||
/// <param name="xattrs">List of extended attributes, alternate data streams and forks.</param>
|
||||
public override Errno ListXAttr(string path, ref List<string> xattrs)
|
||||
public virtual Errno ListXAttr(string path, ref List<string> xattrs)
|
||||
{
|
||||
Errno error = LookupFileId(path, out short fileId, out bool isDir);
|
||||
if(error != Errno.NoError) return error;
|
||||
@@ -61,7 +61,7 @@ namespace DiscImageChef.Filesystems.LisaFS
|
||||
/// <param name="path">File path.</param>
|
||||
/// <param name="xattr">Extendad attribute, alternate data stream or fork name.</param>
|
||||
/// <param name="buf">Buffer.</param>
|
||||
public override Errno GetXattr(string path, string xattr, ref byte[] buf)
|
||||
public virtual Errno GetXattr(string path, string xattr, ref byte[] buf)
|
||||
{
|
||||
Errno error = LookupFileId(path, out short fileId, out bool isDir);
|
||||
if(error != Errno.NoError) return error;
|
||||
|
||||
Reference in New Issue
Block a user