mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
🎨Converted all plugin types to interfaces.
This commit is contained in:
@@ -41,7 +41,7 @@ using Schemas;
|
||||
|
||||
namespace DiscImageChef.Filesystems
|
||||
{
|
||||
public class F2FS : Filesystem
|
||||
public class F2FS : IFilesystem
|
||||
{
|
||||
const uint F2FS_MAGIC = 0xF2F52010;
|
||||
const uint F2FS_SUPER_OFFSET = 1024;
|
||||
@@ -49,39 +49,26 @@ namespace DiscImageChef.Filesystems
|
||||
const uint F2FS_MAX_SECTOR = 4096;
|
||||
const uint F2FS_BLOCK_SIZE = 4096;
|
||||
|
||||
public F2FS()
|
||||
{
|
||||
Name = "F2FS Plugin";
|
||||
PluginUuid = new Guid("82B0920F-5F0D-4063-9F57-ADE0AE02ECE5");
|
||||
CurrentEncoding = Encoding.Unicode;
|
||||
}
|
||||
Encoding currentEncoding;
|
||||
FileSystemType xmlFsType;
|
||||
public virtual FileSystemType XmlFsType => xmlFsType;
|
||||
|
||||
public F2FS(Encoding encoding)
|
||||
{
|
||||
Name = "F2FS Plugin";
|
||||
PluginUuid = new Guid("82B0920F-5F0D-4063-9F57-ADE0AE02ECE5");
|
||||
CurrentEncoding = Encoding.Unicode;
|
||||
}
|
||||
public virtual Encoding Encoding => currentEncoding;
|
||||
public virtual string Name => "F2FS Plugin";
|
||||
public virtual Guid Id => new Guid("82B0920F-5F0D-4063-9F57-ADE0AE02ECE5");
|
||||
|
||||
public F2FS(ImagePlugin imagePlugin, Partition partition, Encoding encoding)
|
||||
public virtual bool Identify(IMediaImage imagePlugin, Partition partition)
|
||||
{
|
||||
Name = "F2FS Plugin";
|
||||
PluginUuid = new Guid("82B0920F-5F0D-4063-9F57-ADE0AE02ECE5");
|
||||
CurrentEncoding = Encoding.Unicode;
|
||||
}
|
||||
if(imagePlugin.Info.SectorSize < F2FS_MIN_SECTOR || imagePlugin.Info.SectorSize > F2FS_MAX_SECTOR)
|
||||
return false;
|
||||
|
||||
public override bool Identify(ImagePlugin imagePlugin, Partition partition)
|
||||
{
|
||||
if(imagePlugin.ImageInfo.SectorSize < F2FS_MIN_SECTOR ||
|
||||
imagePlugin.ImageInfo.SectorSize > F2FS_MAX_SECTOR) return false;
|
||||
|
||||
uint sbAddr = F2FS_SUPER_OFFSET / imagePlugin.ImageInfo.SectorSize;
|
||||
uint sbAddr = F2FS_SUPER_OFFSET / imagePlugin.Info.SectorSize;
|
||||
if(sbAddr == 0) sbAddr = 1;
|
||||
|
||||
F2FS_Superblock f2fsSb = new F2FS_Superblock();
|
||||
|
||||
uint sbSize = (uint)(Marshal.SizeOf(f2fsSb) / imagePlugin.ImageInfo.SectorSize);
|
||||
if(Marshal.SizeOf(f2fsSb) % imagePlugin.ImageInfo.SectorSize != 0) sbSize++;
|
||||
uint sbSize = (uint)(Marshal.SizeOf(f2fsSb) / imagePlugin.Info.SectorSize);
|
||||
if(Marshal.SizeOf(f2fsSb) % imagePlugin.Info.SectorSize != 0) sbSize++;
|
||||
|
||||
if(partition.Start + sbAddr >= partition.End) return false;
|
||||
|
||||
@@ -96,19 +83,20 @@ namespace DiscImageChef.Filesystems
|
||||
return f2fsSb.magic == F2FS_MAGIC;
|
||||
}
|
||||
|
||||
public override void GetInformation(ImagePlugin imagePlugin, Partition partition, out string information)
|
||||
public virtual void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
|
||||
Encoding encoding)
|
||||
{
|
||||
currentEncoding = Encoding.Unicode;
|
||||
information = "";
|
||||
if(imagePlugin.ImageInfo.SectorSize < F2FS_MIN_SECTOR ||
|
||||
imagePlugin.ImageInfo.SectorSize > F2FS_MAX_SECTOR) return;
|
||||
if(imagePlugin.Info.SectorSize < F2FS_MIN_SECTOR || imagePlugin.Info.SectorSize > F2FS_MAX_SECTOR) return;
|
||||
|
||||
uint sbAddr = F2FS_SUPER_OFFSET / imagePlugin.ImageInfo.SectorSize;
|
||||
uint sbAddr = F2FS_SUPER_OFFSET / imagePlugin.Info.SectorSize;
|
||||
if(sbAddr == 0) sbAddr = 1;
|
||||
|
||||
F2FS_Superblock f2fsSb = new F2FS_Superblock();
|
||||
|
||||
uint sbSize = (uint)(Marshal.SizeOf(f2fsSb) / imagePlugin.ImageInfo.SectorSize);
|
||||
if(Marshal.SizeOf(f2fsSb) % imagePlugin.ImageInfo.SectorSize != 0) sbSize++;
|
||||
uint sbSize = (uint)(Marshal.SizeOf(f2fsSb) / imagePlugin.Info.SectorSize);
|
||||
if(Marshal.SizeOf(f2fsSb) % imagePlugin.Info.SectorSize != 0) sbSize++;
|
||||
|
||||
byte[] sector = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize);
|
||||
if(sector.Length < Marshal.SizeOf(f2fsSb)) return;
|
||||
@@ -144,7 +132,7 @@ namespace DiscImageChef.Filesystems
|
||||
|
||||
information = sb.ToString();
|
||||
|
||||
XmlFsType = new FileSystemType
|
||||
xmlFsType = new FileSystemType
|
||||
{
|
||||
Type = "F2FS filesystem",
|
||||
SystemIdentifier = Encoding.ASCII.GetString(f2fsSb.version),
|
||||
@@ -156,62 +144,57 @@ namespace DiscImageChef.Filesystems
|
||||
};
|
||||
}
|
||||
|
||||
public override Errno Mount()
|
||||
public virtual Errno Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding, bool debug)
|
||||
{
|
||||
return Errno.NotImplemented;
|
||||
}
|
||||
|
||||
public override Errno Mount(bool debug)
|
||||
public virtual Errno Unmount()
|
||||
{
|
||||
return Errno.NotImplemented;
|
||||
}
|
||||
|
||||
public override Errno Unmount()
|
||||
public virtual Errno MapBlock(string path, long fileBlock, ref long deviceBlock)
|
||||
{
|
||||
return Errno.NotImplemented;
|
||||
}
|
||||
|
||||
public override Errno MapBlock(string path, long fileBlock, ref long deviceBlock)
|
||||
public virtual Errno GetAttributes(string path, ref FileAttributes attributes)
|
||||
{
|
||||
return Errno.NotImplemented;
|
||||
}
|
||||
|
||||
public override Errno GetAttributes(string path, ref FileAttributes attributes)
|
||||
public virtual Errno ListXAttr(string path, ref List<string> xattrs)
|
||||
{
|
||||
return Errno.NotImplemented;
|
||||
}
|
||||
|
||||
public override Errno ListXAttr(string path, ref List<string> xattrs)
|
||||
public virtual Errno GetXattr(string path, string xattr, ref byte[] buf)
|
||||
{
|
||||
return Errno.NotImplemented;
|
||||
}
|
||||
|
||||
public override Errno GetXattr(string path, string xattr, ref byte[] buf)
|
||||
public virtual Errno Read(string path, long offset, long size, ref byte[] buf)
|
||||
{
|
||||
return Errno.NotImplemented;
|
||||
}
|
||||
|
||||
public override Errno Read(string path, long offset, long size, ref byte[] buf)
|
||||
public virtual Errno ReadDir(string path, ref List<string> contents)
|
||||
{
|
||||
return Errno.NotImplemented;
|
||||
}
|
||||
|
||||
public override Errno ReadDir(string path, ref List<string> contents)
|
||||
public virtual Errno StatFs(ref FileSystemInfo stat)
|
||||
{
|
||||
return Errno.NotImplemented;
|
||||
}
|
||||
|
||||
public override Errno StatFs(ref FileSystemInfo stat)
|
||||
public virtual Errno Stat(string path, ref FileEntryInfo stat)
|
||||
{
|
||||
return Errno.NotImplemented;
|
||||
}
|
||||
|
||||
public override Errno Stat(string path, ref FileEntryInfo stat)
|
||||
{
|
||||
return Errno.NotImplemented;
|
||||
}
|
||||
|
||||
public override Errno ReadLink(string path, ref string dest)
|
||||
public virtual Errno ReadLink(string path, ref string dest)
|
||||
{
|
||||
return Errno.NotImplemented;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user