mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Refactor, pass whole partition structure to filesystems.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// /***************************************************************************
|
||||
// /***************************************************************************
|
||||
// The Disc Image Chef
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
@@ -31,8 +31,9 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using DiscImageChef.CommonTypes;
|
||||
|
||||
namespace DiscImageChef.Filesystems
|
||||
{
|
||||
@@ -68,7 +69,7 @@ namespace DiscImageChef.Filesystems
|
||||
CurrentEncoding = Encoding.GetEncoding("iso-8859-15");
|
||||
}
|
||||
|
||||
public MinixFS(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
|
||||
public MinixFS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
|
||||
{
|
||||
Name = "Minix Filesystem";
|
||||
PluginUUID = new Guid("FE248C3B-B727-4AE5-A39F-79EA9A07D4B3");
|
||||
@@ -76,13 +77,13 @@ namespace DiscImageChef.Filesystems
|
||||
CurrentEncoding = Encoding.GetEncoding("iso-8859-15");
|
||||
}
|
||||
|
||||
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
|
||||
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition)
|
||||
{
|
||||
if((2 + partitionStart) >= partitionEnd)
|
||||
if((2 + partition.PartitionStartSector) >= partition.PartitionEndSector)
|
||||
return false;
|
||||
|
||||
ushort magic;
|
||||
byte[] minix_sb_sector = imagePlugin.ReadSector(2 + partitionStart);
|
||||
byte[] minix_sb_sector = imagePlugin.ReadSector(2 + partition.PartitionStartSector);
|
||||
|
||||
magic = BitConverter.ToUInt16(minix_sb_sector, 0x010); // Here should reside magic number on Minix V1 & V2
|
||||
|
||||
@@ -96,7 +97,7 @@ namespace DiscImageChef.Filesystems
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, out string information)
|
||||
public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information)
|
||||
{
|
||||
information = "";
|
||||
|
||||
@@ -106,7 +107,7 @@ namespace DiscImageChef.Filesystems
|
||||
int filenamesize;
|
||||
string minixVersion;
|
||||
ushort magic;
|
||||
byte[] minix_sb_sector = imagePlugin.ReadSector(2 + partitionStart);
|
||||
byte[] minix_sb_sector = imagePlugin.ReadSector(2 + partition.PartitionStartSector);
|
||||
|
||||
magic = BigEndianBitConverter.ToUInt16(minix_sb_sector, 0x018);
|
||||
|
||||
@@ -212,7 +213,7 @@ namespace DiscImageChef.Filesystems
|
||||
sb.AppendFormat("On-disk filesystem version: {0}", mnx_sb.s_disk_version).AppendLine();
|
||||
|
||||
xmlFSType.ClusterSize = mnx_sb.s_blocksize;
|
||||
xmlFSType.Clusters = (long)((partitionEnd - partitionStart + 1) * imagePlugin.GetSectorSize() / mnx_sb.s_blocksize);
|
||||
xmlFSType.Clusters = (long)((partition.PartitionEndSector - partition.PartitionStartSector + 1) * imagePlugin.GetSectorSize() / mnx_sb.s_blocksize);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -243,7 +244,7 @@ namespace DiscImageChef.Filesystems
|
||||
sb.AppendFormat("{0} bytes maximum per file", mnx_sb.s_max_size).AppendLine();
|
||||
sb.AppendFormat("Filesystem state: {0:X4}", mnx_sb.s_state).AppendLine();
|
||||
xmlFSType.ClusterSize = 1024;
|
||||
xmlFSType.Clusters = (long)((partitionEnd - partitionStart + 1) * imagePlugin.GetSectorSize() / 1024);
|
||||
xmlFSType.Clusters = (long)((partition.PartitionEndSector - partition.PartitionStartSector + 1) * imagePlugin.GetSectorSize() / 1024);
|
||||
}
|
||||
information = sb.ToString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user