Refactor, pass whole partition structure to filesystems.

This commit is contained in:
2017-07-19 16:31:08 +01:00
parent 68537136d8
commit 711d19fd04
154 changed files with 980 additions and 760 deletions

View File

@@ -53,6 +53,8 @@ namespace DiscImageChef.CommonTypes
public ulong PartitionSectors;
/// <summary>Information that does not find space in this struct</summary>
public string PartitionDescription;
/// <summary>LBA of last partition sector</summary>
public ulong PartitionEndSector { get { return PartitionStartSector + PartitionSectors - 1; }}
}
}

View File

@@ -484,9 +484,9 @@ namespace DiscImageChef.Core.Devices.Dumping
{
try
{
if(_plugin.Identify(_imageFormat, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector + partitions[i].PartitionSectors - 1))
if(_plugin.Identify(_imageFormat, partitions[i]))
{
_plugin.GetInformation(_imageFormat, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector + partitions[i].PartitionSectors - 1, out string foo);
_plugin.GetInformation(_imageFormat, partitions[i], out string foo);
lstFs.Add(_plugin.XmlFSType);
Statistics.AddFilesystem(_plugin.XmlFSType.Type);
}
@@ -513,13 +513,20 @@ namespace DiscImageChef.Core.Devices.Dumping
};
List<FileSystemType> lstFs = new List<FileSystemType>();
Partition wholePart = new Partition
{
PartitionName = "Whole device",
PartitionSectors = blocks,
PartitionLength = blocks * blockSize
};
foreach(Filesystem _plugin in plugins.PluginsList.Values)
{
try
{
if(_plugin.Identify(_imageFormat, (blocks - 1), 0))
if(_plugin.Identify(_imageFormat, wholePart))
{
_plugin.GetInformation(_imageFormat, (blocks - 1), 0, out string foo);
_plugin.GetInformation(_imageFormat, wholePart, out string foo);
lstFs.Add(_plugin.XmlFSType);
Statistics.AddFilesystem(_plugin.XmlFSType.Type);
}

View File

@@ -636,9 +636,9 @@ namespace DiscImageChef.Core.Devices.Dumping
{
try
{
if(_plugin.Identify(_imageFormat, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector + partitions[i].PartitionSectors - 1))
if(_plugin.Identify(_imageFormat, partitions[i]))
{
_plugin.GetInformation(_imageFormat, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector + partitions[i].PartitionSectors - 1, out string foo);
_plugin.GetInformation(_imageFormat, partitions[i], out string foo);
lstFs.Add(_plugin.XmlFSType);
Statistics.AddFilesystem(_plugin.XmlFSType.Type);
@@ -674,13 +674,20 @@ namespace DiscImageChef.Core.Devices.Dumping
};
List<FileSystemType> lstFs = new List<FileSystemType>();
Partition wholePart = new Partition
{
PartitionName = "Whole device",
PartitionSectors = blocks,
PartitionLength = blocks * blockSize
};
foreach(Filesystem _plugin in plugins.PluginsList.Values)
{
try
{
if(_plugin.Identify(_imageFormat, (blocks - 1), 0))
if(_plugin.Identify(_imageFormat, wholePart))
{
_plugin.GetInformation(_imageFormat, (blocks - 1), 0, out string foo);
_plugin.GetInformation(_imageFormat, wholePart, out string foo);
lstFs.Add(_plugin.XmlFSType);
Statistics.AddFilesystem(_plugin.XmlFSType.Type);

View File

@@ -792,9 +792,9 @@ namespace DiscImageChef.Core.Devices.Dumping
{
try
{
if(_plugin.Identify(_imageFormat, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector + partitions[i].PartitionSectors - 1))
if(_plugin.Identify(_imageFormat, partitions[i]))
{
_plugin.GetInformation(_imageFormat, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector + partitions[i].PartitionSectors - 1, out string foo);
_plugin.GetInformation(_imageFormat, partitions[i], out string foo);
lstFs.Add(_plugin.XmlFSType);
Statistics.AddFilesystem(_plugin.XmlFSType.Type);
@@ -830,13 +830,20 @@ namespace DiscImageChef.Core.Devices.Dumping
};
List<FileSystemType> lstFs = new List<FileSystemType>();
Partition wholePart = new Partition
{
PartitionName = "Whole device",
PartitionSectors = blocks,
PartitionLength = blocks * blockSize
};
foreach(Filesystem _plugin in plugins.PluginsList.Values)
{
try
{
if(_plugin.Identify(_imageFormat, (blocks - 1), 0))
if(_plugin.Identify(_imageFormat, wholePart))
{
_plugin.GetInformation(_imageFormat, (blocks - 1), 0, out string foo);
_plugin.GetInformation(_imageFormat, wholePart, out string foo);
lstFs.Add(_plugin.XmlFSType);
Statistics.AddFilesystem(_plugin.XmlFSType.Type);

View File

@@ -35,8 +35,8 @@
// Copyright (C) 2011-2015 Claunia.com
// ****************************************************************************/
// //$Id$
using System;
using System.Collections.Generic;
using DiscImageChef.CommonTypes;
using DiscImageChef.Filesystems;
using DiscImageChef.ImagePlugins;
@@ -44,7 +44,7 @@ namespace DiscImageChef.Core
{
public static class Filesystems
{
public static void Identify(ImagePlugin imagePlugin, out List<string> id_plugins, ulong partitionStart, ulong partitionEnd)
public static void Identify(ImagePlugin imagePlugin, out List<string> id_plugins, Partition partition)
{
id_plugins = new List<string>();
PluginBase plugins = new PluginBase();
@@ -52,7 +52,7 @@ namespace DiscImageChef.Core
foreach(Filesystem _plugin in plugins.PluginsList.Values)
{
if(_plugin.Identify(imagePlugin, partitionStart, partitionEnd))
if(_plugin.Identify(imagePlugin, partition))
id_plugins.Add(_plugin.Name.ToLower());
}
}

View File

@@ -38,7 +38,6 @@
using System.Collections.Generic;
using System.IO;
using DiscImageChef.CommonTypes;
using DiscImageChef.Console;
using DiscImageChef.Decoders.PCMCIA;
using DiscImageChef.Filesystems;
using DiscImageChef.ImagePlugins;
@@ -556,7 +555,7 @@ namespace DiscImageChef.Core
{
xmlTrk.FileSystemInformation[i] = new PartitionType();
xmlTrk.FileSystemInformation[i].Description = partitions[i].PartitionDescription;
xmlTrk.FileSystemInformation[i].EndSector = (int)(partitions[i].PartitionStartSector + partitions[i].PartitionSectors - 1);
xmlTrk.FileSystemInformation[i].EndSector = (int)(partitions[i].PartitionEndSector);
xmlTrk.FileSystemInformation[i].Name = partitions[i].PartitionName;
xmlTrk.FileSystemInformation[i].Sequence = (int)partitions[i].PartitionSequence;
xmlTrk.FileSystemInformation[i].StartSector = (int)partitions[i].PartitionStartSector;
@@ -568,10 +567,9 @@ namespace DiscImageChef.Core
{
try
{
if(_plugin.Identify(image, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector + partitions[i].PartitionSectors - 1))
if(_plugin.Identify(image, partitions[i]))
{
string foo;
_plugin.GetInformation(image, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector + partitions[i].PartitionSectors - 1, out foo);
_plugin.GetInformation(image, partitions[i], out string foo);
lstFs.Add(_plugin.XmlFSType);
Statistics.AddFilesystem(_plugin.XmlFSType.Type);
@@ -605,14 +603,21 @@ namespace DiscImageChef.Core
List<FileSystemType> lstFs = new List<FileSystemType>();
Partition xmlPart = new Partition
{
PartitionStartSector = (ulong)xmlTrk.StartSector,
PartitionSectors = (ulong)((xmlTrk.EndSector - xmlTrk.StartSector) + 1),
PartitionType = xmlTrk.TrackType1.ToString(),
PartitionLength = (ulong)xmlTrk.Size,
PartitionSequence = (ulong)xmlTrk.Sequence.TrackNumber
};
foreach(Filesystem _plugin in plugins.PluginsList.Values)
{
try
{
if(_plugin.Identify(image, (ulong)xmlTrk.StartSector, (ulong)xmlTrk.EndSector))
if(_plugin.Identify(image, xmlPart))
{
string foo;
_plugin.GetInformation(image, (ulong)xmlTrk.StartSector, (ulong)xmlTrk.EndSector, out foo);
_plugin.GetInformation(image, xmlPart, out string foo);
lstFs.Add(_plugin.XmlFSType);
Statistics.AddFilesystem(_plugin.XmlFSType.Type);
@@ -869,7 +874,7 @@ namespace DiscImageChef.Core
{
sidecar.BlockMedia[0].FileSystemInformation[i] = new PartitionType();
sidecar.BlockMedia[0].FileSystemInformation[i].Description = partitions[i].PartitionDescription;
sidecar.BlockMedia[0].FileSystemInformation[i].EndSector = (int)(partitions[i].PartitionStartSector + partitions[i].PartitionSectors - 1);
sidecar.BlockMedia[0].FileSystemInformation[i].EndSector = (int)(partitions[i].PartitionEndSector);
sidecar.BlockMedia[0].FileSystemInformation[i].Name = partitions[i].PartitionName;
sidecar.BlockMedia[0].FileSystemInformation[i].Sequence = (int)partitions[i].PartitionSequence;
sidecar.BlockMedia[0].FileSystemInformation[i].StartSector = (int)partitions[i].PartitionStartSector;
@@ -881,10 +886,10 @@ namespace DiscImageChef.Core
{
try
{
if(_plugin.Identify(image, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector + partitions[i].PartitionSectors - 1))
if(_plugin.Identify(image, partitions[i]))
{
string foo;
_plugin.GetInformation(image, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector + partitions[i].PartitionSectors - 1, out foo);
_plugin.GetInformation(image, partitions[i], out foo);
lstFs.Add(_plugin.XmlFSType);
Statistics.AddFilesystem(_plugin.XmlFSType.Type);
}
@@ -907,16 +912,22 @@ namespace DiscImageChef.Core
sidecar.BlockMedia[0].FileSystemInformation[0].StartSector = 0;
sidecar.BlockMedia[0].FileSystemInformation[0].EndSector = (int)(image.GetSectors() - 1);
Partition wholePart = new Partition
{
PartitionName = "Whole device",
PartitionSectors = image.GetSectors(),
PartitionLength = image.GetSectors() * image.GetSectorSize()
};
List<FileSystemType> lstFs = new List<FileSystemType>();
foreach(Filesystem _plugin in plugins.PluginsList.Values)
{
try
{
if(_plugin.Identify(image, 0, image.GetSectors() - 1))
if(_plugin.Identify(image, wholePart))
{
string foo;
_plugin.GetInformation(image, 0, image.GetSectors() - 1, out foo);
_plugin.GetInformation(image, wholePart, out string foo);
lstFs.Add(_plugin.XmlFSType);
Statistics.AddFilesystem(_plugin.XmlFSType.Type);
}

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -31,9 +31,10 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using System.Collections.Generic;
using DiscImageChef.CommonTypes;
namespace DiscImageChef.Filesystems
{
@@ -49,7 +50,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.UTF8;
}
public APFS(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public APFS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "Apple File System";
PluginUUID = new Guid("A4060F9D-2909-42E2-9D95-DB31FA7EA797");
@@ -69,12 +70,12 @@ namespace DiscImageChef.Filesystems
public ulong containerBlocks;
}
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition)
{
if(partitionStart >= partitionEnd)
if(partition.PartitionStartSector >= partition.PartitionEndSector)
return false;
byte[] sector = imagePlugin.ReadSector(partitionStart);
byte[] sector = imagePlugin.ReadSector(partition.PartitionStartSector);
ApfsContainerSuperBlock nxSb;
try
@@ -94,16 +95,16 @@ 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)
{
StringBuilder sbInformation = new StringBuilder();
xmlFSType = new Schemas.FileSystemType();
information = "";
if(partitionStart >= partitionEnd)
if(partition.PartitionStartSector >= partition.PartitionEndSector)
return;
byte[] sector = imagePlugin.ReadSector(partitionStart);
byte[] sector = imagePlugin.ReadSector(partition.PartitionStartSector);
ApfsContainerSuperBlock nxSb;
try

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -34,8 +34,8 @@ using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
using DiscImageChef.Console;
using System.Security.Policy;
namespace DiscImageChef.Filesystems
{
@@ -73,7 +73,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.GetEncoding("iso-8859-1");
}
public AcornADFS(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public AcornADFS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "Acorn Advanced Disc Filing System";
PluginUUID = new Guid("BAFC1E50-9C64-4CD3-8400-80628CC27AFA");
@@ -270,9 +270,9 @@ namespace DiscImageChef.Filesystems
}
// TODO: BBC Master hard disks are untested...
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition)
{
if(partitionStart >= partitionEnd)
if(partition.PartitionStartSector >= partition.PartitionEndSector)
return false;
ulong sbSector;
@@ -285,7 +285,7 @@ namespace DiscImageChef.Filesystems
GCHandle ptr;
// ADFS-S, ADFS-M, ADFS-L, ADFS-D without partitions
if(partitionStart == 0)
if(partition.PartitionStartSector == 0)
{
OldMapSector0 oldMap0;
OldMapSector1 oldMap1;
@@ -381,7 +381,7 @@ namespace DiscImageChef.Filesystems
// Partitioning or not, new formats follow:
DiscRecord drSb;
sector = imagePlugin.ReadSector(partitionStart);
sector = imagePlugin.ReadSector(partition.PartitionStartSector);
byte newChk = NewMapChecksum(sector);
DicConsole.DebugWriteLine("ADFS Plugin", "newChk = {0}", newChk);
DicConsole.DebugWriteLine("ADFS Plugin", "map.zoneChecksum = {0}", sector[0]);
@@ -391,7 +391,7 @@ namespace DiscImageChef.Filesystems
if(bootBlockSize % imagePlugin.ImageInfo.sectorSize > 0)
sectorsToRead++;
byte[] bootSector = imagePlugin.ReadSectors(sbSector + partitionStart, sectorsToRead);
byte[] bootSector = imagePlugin.ReadSectors(sbSector + partition.PartitionStartSector, sectorsToRead);
int bootChk = 0;
for(int i = 0; i < 0x1FF; i++)
bootChk = ((bootChk & 0xFF) + (bootChk >> 8) + bootSector[i]);
@@ -446,7 +446,7 @@ namespace DiscImageChef.Filesystems
// TODO: Find root directory on volumes with DiscRecord
// TODO: Support big directories (ADFS-G?)
// TODO: Find the real freemap on volumes with DiscRecord, as DiscRecord's discid may be empty but this one isn't
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)
{
StringBuilder sbInformation = new StringBuilder();
xmlFSType = new Schemas.FileSystemType();
@@ -460,7 +460,7 @@ namespace DiscImageChef.Filesystems
string discname;
// ADFS-S, ADFS-M, ADFS-L, ADFS-D without partitions
if(partitionStart == 0)
if(partition.PartitionStartSector == 0)
{
OldMapSector0 oldMap0;
OldMapSector1 oldMap1;
@@ -595,7 +595,7 @@ namespace DiscImageChef.Filesystems
// Partitioning or not, new formats follow:
DiscRecord drSb;
sector = imagePlugin.ReadSector(partitionStart);
sector = imagePlugin.ReadSector(partition.PartitionStartSector);
byte newChk = NewMapChecksum(sector);
DicConsole.DebugWriteLine("ADFS Plugin", "newChk = {0}", newChk);
DicConsole.DebugWriteLine("ADFS Plugin", "map.zoneChecksum = {0}", sector[0]);
@@ -605,7 +605,7 @@ namespace DiscImageChef.Filesystems
if(bootBlockSize % imagePlugin.ImageInfo.sectorSize > 0)
sectorsToRead++;
byte[] bootSector = imagePlugin.ReadSectors(sbSector + partitionStart, sectorsToRead);
byte[] bootSector = imagePlugin.ReadSectors(sbSector + partition.PartitionStartSector, sectorsToRead);
int bootChk = 0;
for(int i = 0; i < 0x1FF; i++)
bootChk = ((bootChk & 0xFF) + (bootChk >> 8) + bootSector[i]);

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -31,10 +31,11 @@
// ****************************************************************************/
using System;
using System.Text;
using System.Collections.Generic;
using DiscImageChef.Console;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
using DiscImageChef.Console;
namespace DiscImageChef.Filesystems
{
@@ -47,7 +48,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.GetEncoding("iso-8859-1");
}
public AmigaDOSPlugin(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public AmigaDOSPlugin(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "Amiga DOS filesystem";
PluginUUID = new Guid("3c882400-208c-427d-a086-9119852a1bc7");
@@ -203,9 +204,9 @@ namespace DiscImageChef.Filesystems
public const uint TypeHeader = 2;
public const uint SubTypeRoot = 1;
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition)
{
if(partitionStart >= partitionEnd)
if(partition.PartitionStartSector >= partition.PartitionEndSector)
return false;
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
@@ -216,14 +217,14 @@ namespace DiscImageChef.Filesystems
// However while you can set a block size different from the sector size on formatting, the bootblock block
// size for floppies is the sector size, and for RDB is usually is the hard disk sector size,
// so this is not entirely wrong...
byte[] sector = imagePlugin.ReadSectors(0 + partitionStart, 2);
byte[] sector = imagePlugin.ReadSectors(0 + partition.PartitionStartSector, 2);
BootBlock bblk = BigEndianMarshal.ByteArrayToStructureBigEndian<BootBlock>(sector);
// AROS boot floppies...
if(sector.Length >= 512 && sector[510] == 0x55 && sector[511] == 0xAA &&
(bblk.diskType & FFS_Mask) != FFS_Mask && (bblk.diskType & MuFS_Mask) != MuFS_Mask)
{
sector = imagePlugin.ReadSectors(1 + partitionStart, 2);
sector = imagePlugin.ReadSectors(1 + partition.PartitionStartSector, 2);
bblk = BigEndianMarshal.ByteArrayToStructureBigEndian<BootBlock>(sector);
}
@@ -244,19 +245,19 @@ namespace DiscImageChef.Filesystems
// If bootblock is correct, let's take its rootblock pointer
if(bsum == bblk.checksum)
{
b_root_ptr = bblk.root_ptr + partitionStart;
b_root_ptr = bblk.root_ptr + partition.PartitionStartSector;
DicConsole.DebugWriteLine("AmigaDOS plugin", "Bootblock points to {0} as Rootblock", b_root_ptr);
}
ulong[] root_ptrs = { b_root_ptr + partitionStart, ((partitionEnd - partitionStart) + 1) / 2 + partitionStart - 2,
((partitionEnd - partitionStart) + 1) / 2 + partitionStart - 1, ((partitionEnd - partitionStart) + 1) / 2 + partitionStart};
ulong[] root_ptrs = { b_root_ptr + partition.PartitionStartSector, ((partition.PartitionEndSector - partition.PartitionStartSector) + 1) / 2 + partition.PartitionStartSector - 2,
((partition.PartitionEndSector - partition.PartitionStartSector) + 1) / 2 + partition.PartitionStartSector - 1, ((partition.PartitionEndSector - partition.PartitionStartSector) + 1) / 2 + partition.PartitionStartSector};
RootBlock rblk = new RootBlock();
// So to handle even number of sectors
foreach(ulong root_ptr in root_ptrs)
{
if(root_ptr >= partitionEnd || root_ptr < partitionStart)
if(root_ptr >= partition.PartitionEndSector || root_ptr < partition.PartitionStartSector)
continue;
DicConsole.DebugWriteLine("AmigaDOS plugin", "Searching for Rootblock in sector {0}", root_ptr);
@@ -281,7 +282,7 @@ namespace DiscImageChef.Filesystems
if(blockSize % sector.Length > 0)
sectorsPerBlock++;
if(root_ptr + sectorsPerBlock >= partitionEnd)
if(root_ptr + sectorsPerBlock >= partition.PartitionEndSector)
continue;
sector = imagePlugin.ReadSectors(root_ptr, sectorsPerBlock);
@@ -304,14 +305,14 @@ 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)
{
StringBuilder sbInformation = new StringBuilder();
xmlFSType = new Schemas.FileSystemType();
information = null;
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
byte[] BootBlockSectors = imagePlugin.ReadSectors(0 + partitionStart, 2);
byte[] BootBlockSectors = imagePlugin.ReadSectors(0 + partition.PartitionStartSector, 2);
BootBlock bootBlk = BigEndianMarshal.ByteArrayToStructureBigEndian<BootBlock>(BootBlockSectors);
bootBlk.bootCode = new byte[BootBlockSectors.Length - 12];
@@ -324,12 +325,12 @@ namespace DiscImageChef.Filesystems
// If bootblock is correct, let's take its rootblock pointer
if(bsum == bootBlk.checksum)
{
b_root_ptr = bootBlk.root_ptr + partitionStart;
b_root_ptr = bootBlk.root_ptr + partition.PartitionStartSector;
DicConsole.DebugWriteLine("AmigaDOS plugin", "Bootblock points to {0} as Rootblock", b_root_ptr);
}
ulong[] root_ptrs = { b_root_ptr + partitionStart, ((partitionEnd - partitionStart) + 1) / 2 + partitionStart - 2,
((partitionEnd - partitionStart) + 1) / 2 + partitionStart - 1, ((partitionEnd - partitionStart) + 1) / 2 + partitionStart};
ulong[] root_ptrs = { b_root_ptr + partition.PartitionStartSector, ((partition.PartitionEndSector - partition.PartitionStartSector) + 1) / 2 + partition.PartitionStartSector - 2,
((partition.PartitionEndSector - partition.PartitionStartSector) + 1) / 2 + partition.PartitionStartSector - 1, ((partition.PartitionEndSector - partition.PartitionStartSector) + 1) / 2 + partition.PartitionStartSector};
RootBlock rootBlk = new RootBlock();
byte[] RootBlockSector = null;
@@ -340,7 +341,7 @@ namespace DiscImageChef.Filesystems
// So to handle even number of sectors
foreach(ulong root_ptr in root_ptrs)
{
if(root_ptr >= partitionEnd || root_ptr < partitionStart)
if(root_ptr >= partition.PartitionEndSector || root_ptr < partition.PartitionStartSector)
continue;
DicConsole.DebugWriteLine("AmigaDOS plugin", "Searching for Rootblock in sector {0}", root_ptr);
@@ -365,7 +366,7 @@ namespace DiscImageChef.Filesystems
if(blockSize % RootBlockSector.Length > 0)
sectorsPerBlock++;
if(root_ptr + sectorsPerBlock >= partitionEnd)
if(root_ptr + sectorsPerBlock >= partition.PartitionEndSector)
continue;
RootBlockSector = imagePlugin.ReadSectors(root_ptr, sectorsPerBlock);
@@ -457,7 +458,7 @@ namespace DiscImageChef.Filesystems
if((bootBlk.diskType & 0xFF) == 4 || (bootBlk.diskType & 0xFF) == 5)
sbInformation.AppendFormat("Directory cache starts at block {0}", rootBlk.extension).AppendLine();
long blocks = (long)((((partitionEnd - partitionStart) + 1) * imagePlugin.ImageInfo.sectorSize) / blockSize);
long blocks = (long)((((partition.PartitionEndSector - partition.PartitionStartSector) + 1) * imagePlugin.ImageInfo.sectorSize) / blockSize);
sbInformation.AppendFormat("Volume block size is {0} bytes", blockSize).AppendLine();
sbInformation.AppendFormat("Volume has {0} blocks", blocks).AppendLine();

View File

@@ -33,6 +33,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using DiscImageChef.CommonTypes;
using DiscImageChef.ImagePlugins;
namespace DiscImageChef.Filesystems.AppleDOS
@@ -79,10 +80,10 @@ namespace DiscImageChef.Filesystems.AppleDOS
CurrentEncoding = new Claunia.Encoding.LisaRoman();
}
public AppleDOS(ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public AppleDOS(ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
device = imagePlugin;
start = partitionStart;
start = partition.PartitionStartSector;
Name = "Apple DOS File System";
PluginUUID = new Guid("8658A1E9-B2E7-4BCC-9638-157A31B0A700\n");
if(encoding == null) // TODO: Until Apple ][ encoding is implemented

View File

@@ -33,18 +33,19 @@
using System;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
using DiscImageChef.ImagePlugins;
namespace DiscImageChef.Filesystems.AppleDOS
{
public partial class AppleDOS : Filesystem
{
public override bool Identify(ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
public override bool Identify(ImagePlugin imagePlugin, Partition partition)
{
if(imagePlugin.ImageInfo.sectors != 455 && imagePlugin.ImageInfo.sectors != 560)
return false;
if(partitionStart > 0 || imagePlugin.ImageInfo.sectorSize != 256)
if(partition.PartitionStartSector > 0 || imagePlugin.ImageInfo.sectorSize != 256)
return false;
int spt = 0;
@@ -63,7 +64,7 @@ namespace DiscImageChef.Filesystems.AppleDOS
return vtoc.catalogSector < spt && vtoc.maxTrackSectorPairsPerSector <= 122 && vtoc.sectorsPerTrack == spt && vtoc.bytesPerSector == 256;
}
public override void GetInformation(ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, out string information)
public override void GetInformation(ImagePlugin imagePlugin, Partition partition, out string information)
{
information = "";
StringBuilder sb = new StringBuilder();

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -34,6 +34,7 @@ using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
using DiscImageChef.Console;
namespace DiscImageChef.Filesystems
@@ -62,7 +63,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.GetEncoding("macintosh");
}
public AppleHFS(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public AppleHFS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "Apple Hierarchical File System";
PluginUUID = new Guid("36405F8D-0D26-6ECC-0BBB-1D5225FF404F");
@@ -70,9 +71,9 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.GetEncoding("macintosh");
}
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;
byte[] mdb_sector;
@@ -80,7 +81,7 @@ namespace DiscImageChef.Filesystems
if(imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448 || imagePlugin.GetSectorSize() == 2048)
{
mdb_sector = imagePlugin.ReadSector(2 + partitionStart);
mdb_sector = imagePlugin.ReadSector(2 + partition.PartitionStartSector);
drSigWord = BigEndianBitConverter.ToUInt16(mdb_sector, 0);
if(drSigWord == HFS_MAGIC)
@@ -89,7 +90,7 @@ namespace DiscImageChef.Filesystems
return drSigWord != HFSP_MAGIC;
}
mdb_sector = Read2048SectorAs512(imagePlugin, 2 + partitionStart * 4);
mdb_sector = Read2048SectorAs512(imagePlugin, 2 + partition.PartitionStartSector * 4);
drSigWord = BigEndianBitConverter.ToUInt16(mdb_sector, 0);
if(drSigWord == HFS_MAGIC)
@@ -103,7 +104,7 @@ namespace DiscImageChef.Filesystems
}
else
{
mdb_sector = imagePlugin.ReadSector(2 + partitionStart);
mdb_sector = imagePlugin.ReadSector(2 + partition.PartitionStartSector);
drSigWord = BigEndianBitConverter.ToUInt16(mdb_sector, 0);
if(drSigWord == HFS_MAGIC)
@@ -116,7 +117,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 = "";
@@ -135,21 +136,21 @@ namespace DiscImageChef.Filesystems
if(imagePlugin.GetSectorSize() == 2352 || imagePlugin.GetSectorSize() == 2448 || imagePlugin.GetSectorSize() == 2048)
{
mdb_sector = imagePlugin.ReadSector(2 + partitionStart);
mdb_sector = imagePlugin.ReadSector(2 + partition.PartitionStartSector);
drSigWord = BigEndianBitConverter.ToUInt16(mdb_sector, 0);
if(drSigWord == HFS_MAGIC)
{
bb_sector = imagePlugin.ReadSector(partitionStart);
bb_sector = imagePlugin.ReadSector(partition.PartitionStartSector);
}
else
{
mdb_sector = Read2048SectorAs512(imagePlugin, 2 + partitionStart * 4);
mdb_sector = Read2048SectorAs512(imagePlugin, 2 + partition.PartitionStartSector * 4);
drSigWord = BigEndianBitConverter.ToUInt16(mdb_sector, 0);
if(drSigWord == HFS_MAGIC)
{
bb_sector = Read2048SectorAs512(imagePlugin, partitionStart * 4);
bb_sector = Read2048SectorAs512(imagePlugin, partition.PartitionStartSector * 4);
APMFromHDDOnCD = true;
}
else
@@ -158,11 +159,11 @@ namespace DiscImageChef.Filesystems
}
else
{
mdb_sector = imagePlugin.ReadSector(2 + partitionStart);
mdb_sector = imagePlugin.ReadSector(2 + partition.PartitionStartSector);
drSigWord = BigEndianBitConverter.ToUInt16(mdb_sector, 0);
if(drSigWord == HFS_MAGIC)
bb_sector = imagePlugin.ReadSector(partitionStart);
bb_sector = imagePlugin.ReadSector(partition.PartitionStartSector);
else
return;
}

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -31,9 +31,10 @@
// ****************************************************************************/
using System;
using System.Text;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
namespace DiscImageChef.Filesystems
{
@@ -60,7 +61,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.UTF8;
}
public AppleHFSPlus(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public AppleHFSPlus(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "Apple HFS+ filesystem";
PluginUUID = new Guid("36405F8D-0D26-6EBE-436F-62F0586B4F08");
@@ -68,9 +69,9 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.UTF8;
}
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 drSigWord;
@@ -81,7 +82,7 @@ namespace DiscImageChef.Filesystems
byte[] vh_sector;
ulong hfsp_offset;
vh_sector = imagePlugin.ReadSector(2 + partitionStart); // Read volume header, of HFS Wrapper MDB
vh_sector = imagePlugin.ReadSector(2 + partition.PartitionStartSector); // Read volume header, of HFS Wrapper MDB
drSigWord = BigEndianBitConverter.ToUInt16(vh_sector, 0); // Check for HFS Wrapper MDB
@@ -109,7 +110,7 @@ namespace DiscImageChef.Filesystems
hfsp_offset = 0;
}
vh_sector = imagePlugin.ReadSector(2 + partitionStart + hfsp_offset); // Read volume header
vh_sector = imagePlugin.ReadSector(2 + partition.PartitionStartSector + hfsp_offset); // Read volume header
drSigWord = BigEndianBitConverter.ToUInt16(vh_sector, 0);
if(drSigWord == HFSP_MAGIC || drSigWord == HFSX_MAGIC)
@@ -117,7 +118,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 = "";
@@ -131,7 +132,7 @@ namespace DiscImageChef.Filesystems
bool wrapped;
byte[] vh_sector;
vh_sector = imagePlugin.ReadSector(2 + partitionStart); // Read volume header, of HFS Wrapper MDB
vh_sector = imagePlugin.ReadSector(2 + partition.PartitionStartSector); // Read volume header, of HFS Wrapper MDB
drSigWord = BigEndianBitConverter.ToUInt16(vh_sector, 0); // Check for HFS Wrapper MDB
@@ -162,7 +163,7 @@ namespace DiscImageChef.Filesystems
wrapped = false;
}
vh_sector = imagePlugin.ReadSector(2 + partitionStart + hfsp_offset); // Read volume header
vh_sector = imagePlugin.ReadSector(2 + partition.PartitionStartSector + hfsp_offset); // Read volume header
HPVH.signature = BigEndianBitConverter.ToUInt16(vh_sector, 0x000);
if(HPVH.signature == HFSP_MAGIC || HPVH.signature == HFSX_MAGIC)

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -32,8 +32,9 @@
using System;
using System.Collections.Generic;
using DiscImageChef.ImagePlugins;
using System.Text;
using DiscImageChef.CommonTypes;
using DiscImageChef.ImagePlugins;
namespace DiscImageChef.Filesystems.AppleMFS
{
@@ -68,12 +69,12 @@ namespace DiscImageChef.Filesystems.AppleMFS
CurrentEncoding = Encoding.GetEncoding("macintosh");
}
public AppleMFS(ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public AppleMFS(ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "Apple Macintosh File System";
PluginUUID = new Guid("36405F8D-0D26-4066-6538-5DBF5D065C3A");
device = imagePlugin;
this.partitionStart = partitionStart;
partitionStart = partition.PartitionStartSector;
if(encoding == null)
CurrentEncoding = Encoding.GetEncoding("macintosh");
}

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -32,20 +32,21 @@
using System;
using System.Text;
using DiscImageChef.CommonTypes;
namespace DiscImageChef.Filesystems.AppleMFS
{
// Information from Inside Macintosh Volume II
public partial class AppleMFS : Filesystem
{
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition)
{
ushort drSigWord;
if((2 + partitionStart) >= partitionEnd)
if((2 + partition.PartitionStartSector) >= partition.PartitionEndSector)
return false;
byte[] mdb_sector = imagePlugin.ReadSector(2 + partitionStart);
byte[] mdb_sector = imagePlugin.ReadSector(2 + partition.PartitionStartSector);
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
@@ -54,7 +55,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
return drSigWord == MFS_MAGIC;
}
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 = "";
@@ -66,8 +67,8 @@ namespace DiscImageChef.Filesystems.AppleMFS
byte[] pString = new byte[16];
byte[] variable_size;
byte[] mdb_sector = imagePlugin.ReadSector(2 + partitionStart);
byte[] bb_sector = imagePlugin.ReadSector(0 + partitionStart);
byte[] mdb_sector = imagePlugin.ReadSector(2 + partition.PartitionStartSector);
byte[] bb_sector = imagePlugin.ReadSector(0 + partition.PartitionStartSector);
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;

View File

@@ -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
{
@@ -58,7 +59,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.GetEncoding("iso-8859-15");
}
public BeFS(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public BeFS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "Be Filesystem";
PluginUUID = new Guid("dc8572b3-b6ad-46e4-8de9-cbe123ff6672");
@@ -66,15 +67,15 @@ 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;
uint magic;
uint magic_be;
byte[] sb_sector = imagePlugin.ReadSector(0 + partitionStart);
byte[] sb_sector = imagePlugin.ReadSector(0 + partition.PartitionStartSector);
magic = BitConverter.ToUInt32(sb_sector, 0x20);
magic_be = BigEndianBitConverter.ToUInt32(sb_sector, 0x20);
@@ -91,7 +92,7 @@ namespace DiscImageChef.Filesystems
if(magic == BEFS_MAGIC1 || magic_be == BEFS_MAGIC1)
return true;
sb_sector = imagePlugin.ReadSector(1 + partitionStart);
sb_sector = imagePlugin.ReadSector(1 + partition.PartitionStartSector);
magic = BitConverter.ToUInt32(sb_sector, 0x20);
magic_be = BigEndianBitConverter.ToUInt32(sb_sector, 0x20);
@@ -101,7 +102,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 = "";
byte[] name_bytes = new byte[32];
@@ -110,7 +111,7 @@ namespace DiscImageChef.Filesystems
BeSuperBlock besb = new BeSuperBlock();
byte[] sb_sector = imagePlugin.ReadSector(0 + partitionStart);
byte[] sb_sector = imagePlugin.ReadSector(0 + partition.PartitionStartSector);
BigEndianBitConverter.IsLittleEndian = true; // Default for little-endian
@@ -121,7 +122,7 @@ namespace DiscImageChef.Filesystems
}
else
{
sb_sector = imagePlugin.ReadSector(1 + partitionStart);
sb_sector = imagePlugin.ReadSector(1 + partition.PartitionStartSector);
besb.magic1 = BigEndianBitConverter.ToUInt32(sb_sector, 0x20);
if(besb.magic1 == BEFS_MAGIC1 || besb.magic1 == BEFS_CIGAM1) // There is a boot sector
@@ -130,7 +131,7 @@ namespace DiscImageChef.Filesystems
}
else if(sb_sector.Length >= 0x400)
{
byte[] temp = imagePlugin.ReadSector(0 + partitionStart);
byte[] temp = imagePlugin.ReadSector(0 + partition.PartitionStartSector);
besb.magic1 = BigEndianBitConverter.ToUInt32(temp, 0x220);
if(besb.magic1 == BEFS_MAGIC1 || besb.magic1 == BEFS_CIGAM1) // There is a boot sector

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -31,10 +31,11 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
using DiscImageChef.Console;
using System.Collections.Generic;
namespace DiscImageChef.Filesystems
{
@@ -52,7 +53,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.GetEncoding("iso-8859-15");
}
public BTRFS(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public BTRFS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "B-tree file system";
PluginUUID = new Guid("C904CF15-5222-446B-B7DB-02EAC5D781B3");
@@ -121,18 +122,18 @@ namespace DiscImageChef.Filesystems
public Guid uuid;
}
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition)
{
if(partitionStart >= partitionEnd)
if(partition.PartitionStartSector >= partition.PartitionEndSector)
return false;
ulong sbSectorOff = 0x10000 / imagePlugin.GetSectorSize();
uint sbSectorSize = 0x1000 / imagePlugin.GetSectorSize();
if((sbSectorOff + sbSectorSize) >= partitionEnd)
if((sbSectorOff + sbSectorSize) >= partition.PartitionEndSector)
return false;
byte[] sector = imagePlugin.ReadSectors(sbSectorOff + partitionStart, sbSectorSize);
byte[] sector = imagePlugin.ReadSectors(sbSectorOff + partition.PartitionStartSector, sbSectorSize);
SuperBlock btrfsSb;
try
@@ -149,13 +150,13 @@ namespace DiscImageChef.Filesystems
DicConsole.DebugWriteLine("BTRFS Plugin", "sbSectorOff = {0}", sbSectorOff);
DicConsole.DebugWriteLine("BTRFS Plugin", "sbSectorSize = {0}", sbSectorSize);
DicConsole.DebugWriteLine("BTRFS Plugin", "partitionStart = {0}", partitionStart);
DicConsole.DebugWriteLine("BTRFS Plugin", "partition.PartitionStartSector = {0}", partition.PartitionStartSector);
DicConsole.DebugWriteLine("BTRFS Plugin", "btrfsSb.magic = 0x{0:X16}", btrfsSb.magic);
return btrfsSb.magic == btrfsMagic;
}
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)
{
StringBuilder sbInformation = new StringBuilder();
xmlFSType = new Schemas.FileSystemType();
@@ -164,7 +165,7 @@ namespace DiscImageChef.Filesystems
ulong sbSectorOff = 0x10000 / imagePlugin.GetSectorSize();
uint sbSectorSize = 0x1000 / imagePlugin.GetSectorSize();
byte[] sector = imagePlugin.ReadSectors(sbSectorOff + partitionStart, sbSectorSize);
byte[] sector = imagePlugin.ReadSectors(sbSectorOff + partition.PartitionStartSector, sbSectorSize);
SuperBlock btrfsSb;
GCHandle handle = GCHandle.Alloc(sector, GCHandleType.Pinned);

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -34,6 +34,7 @@ using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
namespace DiscImageChef.Filesystems
{
@@ -46,7 +47,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = new Claunia.Encoding.PETSCII();
}
public CBM(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public CBM(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "Commodore file system";
PluginUUID = new Guid("D104744E-A376-450C-BAC0-1347C93F983B");
@@ -179,9 +180,9 @@ namespace DiscImageChef.Filesystems
public short fill3;
}
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition)
{
if(partitionStart > 0)
if(partition.PartitionStartSector > 0)
return false;
if(imagePlugin.ImageInfo.sectorSize != 256)
@@ -221,7 +222,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)
{
byte[] sector;

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -33,6 +33,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using DiscImageChef.CommonTypes;
using DiscImageChef.ImagePlugins;
namespace DiscImageChef.Filesystems.CPM
@@ -41,8 +42,7 @@ namespace DiscImageChef.Filesystems.CPM
{
bool mounted;
readonly ImagePlugin device;
ulong partStart;
ulong partEnd;
Partition partition;
/// <summary>
/// Stores all known CP/M disk definitions
@@ -117,11 +117,10 @@ namespace DiscImageChef.Filesystems.CPM
CurrentEncoding = Encoding.GetEncoding("IBM437");
}
public CPM(ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public CPM(ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
device = imagePlugin;
partStart = partitionStart;
partEnd = partitionEnd;
this.partition = partition;
Name = "CP/M File System";
PluginUUID = new Guid("AA2B8585-41DF-4E3B-8A35-D1A935E2F8A1");
if(encoding == null)

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -34,6 +34,7 @@ using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
using DiscImageChef.Console;
using DiscImageChef.ImagePlugins;
@@ -41,7 +42,7 @@ namespace DiscImageChef.Filesystems.CPM
{
partial class CPM : Filesystem
{
public override bool Identify(ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
public override bool Identify(ImagePlugin imagePlugin, Partition partition)
{
// This will try to identify a CP/M filesystem
// However as it contains no identification marks whatsoever it's more something of trial-and-error
@@ -61,7 +62,7 @@ namespace DiscImageChef.Filesystems.CPM
if(!cpmFound)
{
// Read CHS = {0,0,1}
sector = imagePlugin.ReadSector(0 + partitionStart);
sector = imagePlugin.ReadSector(0 + partition.PartitionStartSector);
int amsSbOffset = 0;
uint sig1, sig2, sig3;
@@ -122,7 +123,7 @@ namespace DiscImageChef.Filesystems.CPM
dpb.phm += (byte)Math.Pow(2, i);
dpb.spt = (ushort)(amsSb.spt * (sectorSize / 128));
uint directoryLength = (uint)((((ulong)dpb.drm + 1) * 32) / sectorSize);
directory = imagePlugin.ReadSector(firstDirectorySector + partitionStart, directoryLength);
directory = imagePlugin.ReadSector(firstDirectorySector + partition.PartitionStartSector, directoryLength);
// Build a CP/M disk definition
workingDefinition = new CpmDefinition();
@@ -179,7 +180,7 @@ namespace DiscImageChef.Filesystems.CPM
if(!cpmFound)
{
// Read CHS = {0,0,4}
sector = imagePlugin.ReadSector(3 + partitionStart);
sector = imagePlugin.ReadSector(3 + partition.PartitionStartSector);
ushort sum = 0;
// Sum of all 16-bit words that make this sector must be 0
@@ -204,8 +205,8 @@ namespace DiscImageChef.Filesystems.CPM
// If volume size corresponds with working partition (this variant will be inside MBR partitioning)
if(sectorSize == imagePlugin.GetSectorSize() &&
startingSector == partitionStart &&
sectorsInPartition + partitionStart <= partitionEnd)
startingSector == partition.PartitionStartSector &&
sectorsInPartition + partition.PartitionStartSector <= partition.PartitionEndSector)
{
cpmFound = true;
firstDirectorySector = (ulong)((hddSb.off * hddSb.sectorsPerTrack));
@@ -225,7 +226,7 @@ namespace DiscImageChef.Filesystems.CPM
dpb.psh = 0; // Needed?
dpb.spt = hddSb.spt;
uint directoryLength = (uint)((((ulong)dpb.drm + 1) * 32) / sectorSize);
directory = imagePlugin.ReadSector(firstDirectorySector + partitionStart, directoryLength);
directory = imagePlugin.ReadSector(firstDirectorySector + partition.PartitionStartSector, directoryLength);
DicConsole.DebugWriteLine("CP/M Plugin", "Found CP/M-86 hard disk superblock.");
// Build a CP/M disk definition
@@ -267,7 +268,7 @@ namespace DiscImageChef.Filesystems.CPM
if(!cpmFound)
{
// Read CHS = {0,0,1}
sector = imagePlugin.ReadSector(0 + partitionStart);
sector = imagePlugin.ReadSector(0 + partition.PartitionStartSector);
byte formatByte;
// Check for alternate location of format ID
@@ -649,7 +650,7 @@ namespace DiscImageChef.Filesystems.CPM
if(cpmFound)
{
uint directoryLength = (uint)((((ulong)dpb.drm + 1) * 32) / imagePlugin.GetSectorSize());
directory = imagePlugin.ReadSector(firstDirectorySector86 + partitionStart, directoryLength);
directory = imagePlugin.ReadSector(firstDirectorySector86 + partition.PartitionStartSector, directoryLength);
DicConsole.DebugWriteLine("CP/M Plugin", "Found CP/M-86 floppy identifier.");
}
}
@@ -740,7 +741,7 @@ namespace DiscImageChef.Filesystems.CPM
MemoryStream ms = new MemoryStream();
for(int p = 0; p < dirLen; p++)
{
byte[] dirSector = imagePlugin.ReadSector((ulong)((int)offset + (int)partitionStart + (p / sectorMask.Length) * sectorMask.Length + sectorMask[p % sectorMask.Length]));
byte[] dirSector = imagePlugin.ReadSector((ulong)((int)offset + (int)partition.PartitionStartSector + (p / sectorMask.Length) * sectorMask.Length + sectorMask[p % sectorMask.Length]));
ms.Write(dirSector, 0, dirSector.Length);
}
directory = ms.ToArray();
@@ -842,11 +843,11 @@ namespace DiscImageChef.Filesystems.CPM
}
}
public override void GetInformation(ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, out string information)
public override void GetInformation(ImagePlugin imagePlugin, Partition partition, out string information)
{
information = "";
// As the identification is so complex, just call Identify() and relay on its findings
if(!Identify(imagePlugin, partitionStart, partitionEnd) || !cpmFound || workingDefinition == null || dpb == null)
if(!Identify(imagePlugin, partition) || !cpmFound || workingDefinition == null || dpb == null)
return;
StringBuilder sb = new StringBuilder();
@@ -922,7 +923,7 @@ namespace DiscImageChef.Filesystems.CPM
if(dpb.dsm > 0)
xmlFSType.Clusters = ((dpb.dsm + 1) * 128) / (128 << dpb.bsh);
else
xmlFSType.Clusters = (long)(partitionEnd - partitionStart);
xmlFSType.Clusters = (long)(partition.PartitionEndSector - partition.PartitionStartSector);
if(labelCreationDate != null)
{
xmlFSType.CreationDate = DateHandlers.CPMToDateTime(labelCreationDate);

View File

@@ -51,7 +51,7 @@ namespace DiscImageChef.Filesystems.CPM
public override Errno Mount(bool debug)
{
// As the identification is so complex, just call Identify() and relay on its findings
if(!Identify(device, partStart, partEnd) || !cpmFound || workingDefinition == null || dpb == null)
if(!Identify(device, partition) || !cpmFound || workingDefinition == null || dpb == null)
return Errno.InvalidArgument;
// Build the software interleaving sector mask
@@ -111,9 +111,9 @@ namespace DiscImageChef.Filesystems.CPM
{
DicConsole.DebugWriteLine("CP/M Plugin", "Deinterleaving whole volume.");
for(int p = 0; p <= (int)(partEnd - partStart); p++)
for(int p = 0; p <= (int)(partition.PartitionEndSector - partition.PartitionStartSector); p++)
{
byte[] readSector = device.ReadSector((ulong)((int)partStart + (p / sectorMask.Length) * sectorMask.Length + sectorMask[p % sectorMask.Length]));
byte[] readSector = device.ReadSector((ulong)((int)partition.PartitionStartSector + (p / sectorMask.Length) * sectorMask.Length + sectorMask[p % sectorMask.Length]));
if(workingDefinition.complement)
{
for(int b = 0; b < readSector.Length; b++)

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -34,7 +34,7 @@ using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using System.Security.Policy;
using DiscImageChef.CommonTypes;
namespace DiscImageChef.Filesystems
{
@@ -47,7 +47,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.GetEncoding("iso-8859-15");
}
public Cram(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public Cram(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "Cram filesystem";
PluginUUID = new Guid("F8F6E46F-7A2A-48E3-9C0A-46AF4DC29E09");
@@ -87,21 +87,21 @@ namespace DiscImageChef.Filesystems
const uint Cram_MAGIC = 0x28CD3D45;
const uint Cram_CIGAM = 0x453DCD28;
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition)
{
if(partitionStart >= partitionEnd)
if(partition.PartitionStartSector >= partition.PartitionEndSector)
return false;
byte[] sector = imagePlugin.ReadSector(partitionStart);
byte[] sector = imagePlugin.ReadSector(partition.PartitionStartSector);
uint magic = BitConverter.ToUInt32(sector, 0x00);
return magic == Cram_MAGIC || magic == Cram_CIGAM;
}
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)
{
byte[] sector = imagePlugin.ReadSector(partitionStart);
byte[] sector = imagePlugin.ReadSector(partition.PartitionStartSector);
uint magic = BitConverter.ToUInt32(sector, 0x00);
CramSuperBlock crSb = new CramSuperBlock();

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -35,6 +35,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
using DiscImageChef.ImagePlugins;
namespace DiscImageChef.Filesystems
@@ -48,7 +49,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.GetEncoding("iso-8859-1");
}
public ECMA67(ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public ECMA67(ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "ECMA-67";
PluginUUID = new Guid("62A2D44A-CBC1-4377-B4B6-28C5C92034A1");
@@ -85,12 +86,12 @@ namespace DiscImageChef.Filesystems
public byte[] reserved5;
}
public override bool Identify(ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
public override bool Identify(ImagePlugin imagePlugin, Partition partition)
{
if(partitionStart > 0)
if(partition.PartitionStartSector > 0)
return false;
if(partitionEnd < 8)
if(partition.PartitionEndSector < 8)
return false;
byte[] sector = imagePlugin.ReadSector(6);
@@ -107,7 +108,7 @@ namespace DiscImageChef.Filesystems
return ECMA67_Magic.SequenceEqual(vol.labelIdentifier) && vol.labelNumber == 1 && vol.recordLength == 0x31;
}
public override void GetInformation(ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, out string information)
public override void GetInformation(ImagePlugin imagePlugin, Partition partition, out string information)
{
byte[] sector = imagePlugin.ReadSector(6);
@@ -127,7 +128,7 @@ namespace DiscImageChef.Filesystems
xmlFSType = new Schemas.FileSystemType();
xmlFSType.Type = "ECMA-67";
xmlFSType.ClusterSize = 256;
xmlFSType.Clusters = (long)(partitionEnd - partitionStart + 1);
xmlFSType.Clusters = (long)(partition.PartitionEndSector - partition.PartitionStartSector + 1);
xmlFSType.VolumeName = Encoding.ASCII.GetString(vol.volumeIdentifier);
information = sbInformation.ToString();

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -34,6 +34,7 @@ using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
namespace DiscImageChef.Filesystems
{
@@ -115,7 +116,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.Unicode;
}
public F2FS(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public F2FS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "F2FS Plugin";
PluginUUID = new Guid("82B0920F-5F0D-4063-9F57-ADE0AE02ECE5");
@@ -123,7 +124,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.Unicode;
}
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition)
{
if(imagePlugin.GetSectorSize() < F2FS_MinSector || imagePlugin.GetSectorSize() > F2FS_MaxSector)
return false;
@@ -138,7 +139,7 @@ namespace DiscImageChef.Filesystems
if(Marshal.SizeOf(f2fsSb) % imagePlugin.GetSectorSize() != 0)
sbSize++;
byte[] sector = imagePlugin.ReadSectors(partitionStart + sbAddr, sbSize);
byte[] sector = imagePlugin.ReadSectors(partition.PartitionStartSector + sbAddr, sbSize);
if(sector.Length < Marshal.SizeOf(f2fsSb))
return false;
@@ -150,7 +151,7 @@ namespace DiscImageChef.Filesystems
return f2fsSb.magic == F2FS_Magic;
}
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 = "";
if(imagePlugin.GetSectorSize() < F2FS_MinSector || imagePlugin.GetSectorSize() > F2FS_MaxSector)
@@ -166,7 +167,7 @@ namespace DiscImageChef.Filesystems
if(Marshal.SizeOf(f2fsSb) % imagePlugin.GetSectorSize() != 0)
sbSize++;
byte[] sector = imagePlugin.ReadSectors(partitionStart + sbAddr, sbSize);
byte[] sector = imagePlugin.ReadSectors(partition.PartitionStartSector + sbAddr, sbSize);
if(sector.Length < Marshal.SizeOf(f2fsSb))
return;

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -31,15 +31,15 @@
// ****************************************************************************/
using System;
using System.Text;
using System.Collections.Generic;
using DiscImageChef.Console;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
using DiscImageChef.Console;
namespace DiscImageChef.Filesystems
{
// TODO: Implement detecting DOS bootable disks
// TODO: Implement detecting Atari TOS bootable disks and printing corresponding fields
// TODO: Differentiate between Atari and X68k FAT, as this one uses a standard BPB.
public class FAT : Filesystem
{
public FAT()
@@ -49,7 +49,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.GetEncoding("IBM437");
}
public FAT(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public FAT(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "Microsoft File Allocation Table";
PluginUUID = new Guid("33513B2C-0D26-0D2D-32C3-79D8611158E0");
@@ -57,9 +57,9 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.GetEncoding("IBM437");
}
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 bps;
@@ -81,8 +81,8 @@ namespace DiscImageChef.Filesystems
byte[] atari_oem = new byte[6];
ushort bootable = 0;
byte[] bpb_sector = imagePlugin.ReadSector(0 + partitionStart);
byte[] fat_sector = imagePlugin.ReadSector(1 + partitionStart);
byte[] bpb_sector = imagePlugin.ReadSector(0 + partition.PartitionStartSector);
byte[] fat_sector = imagePlugin.ReadSector(1 + partition.PartitionStartSector);
Array.Copy(bpb_sector, 0x02, atari_oem, 0, 6);
Array.Copy(bpb_sector, 0x03, dos_oem, 0, 8);
@@ -145,7 +145,7 @@ namespace DiscImageChef.Filesystems
// HPFS
uint hpfs_magic1, hpfs_magic2;
byte[] hpfs_sb_sector = imagePlugin.ReadSector(16 + partitionStart); // Seek to superblock, on logical sector 16
byte[] hpfs_sb_sector = imagePlugin.ReadSector(16 + partition.PartitionStartSector); // Seek to superblock, on logical sector 16
hpfs_magic1 = BitConverter.ToUInt32(hpfs_sb_sector, 0x000);
hpfs_magic2 = BitConverter.ToUInt32(hpfs_sb_sector, 0x004);
@@ -157,20 +157,20 @@ namespace DiscImageChef.Filesystems
return true;
// short FAT32
if(bits_in_bps == 1 && correct_spc && fats_no <= 2 && sectors == 0 && fat_sectors == 0 && fat32_signature == 0x28)
return big_sectors == 0 ? huge_sectors <= (partitionEnd - partitionStart) + 1 : big_sectors <= (partitionEnd - partitionStart) + 1;
return big_sectors == 0 ? huge_sectors <= (partition.PartitionEndSector - partition.PartitionStartSector) + 1 : big_sectors <= (partition.PartitionEndSector - partition.PartitionStartSector) + 1;
// MSX-DOS FAT12
if(bits_in_bps == 1 && correct_spc && fats_no <= 2 && root_entries > 0 && sectors <= (partitionEnd - partitionStart) + 1 && fat_sectors > 0 && msx_string == "VOL_ID")
if(bits_in_bps == 1 && correct_spc && fats_no <= 2 && root_entries > 0 && sectors <= (partition.PartitionEndSector - partition.PartitionStartSector) + 1 && fat_sectors > 0 && msx_string == "VOL_ID")
return true;
// EBPB
if(bits_in_bps == 1 && correct_spc && fats_no <= 2 && root_entries > 0 && fat_sectors > 0 && (bpb_signature == 0x28 || bpb_signature == 0x29))
return sectors == 0 ? big_sectors <= (partitionEnd - partitionStart) + 1 : sectors <= (partitionEnd - partitionStart) + 1;
return sectors == 0 ? big_sectors <= (partition.PartitionEndSector - partition.PartitionStartSector) + 1 : sectors <= (partition.PartitionEndSector - partition.PartitionStartSector) + 1;
// BPB
if(bits_in_bps == 1 && correct_spc && reserved_secs < (partitionEnd - partitionStart) && fats_no <= 2 && root_entries > 0 && fat_sectors > 0)
return sectors == 0 ? big_sectors <= (partitionEnd - partitionStart) + 1 : sectors <= (partitionEnd - partitionStart) + 1;
if(bits_in_bps == 1 && correct_spc && reserved_secs < (partition.PartitionEndSector - partition.PartitionStartSector) && fats_no <= 2 && root_entries > 0 && fat_sectors > 0)
return sectors == 0 ? big_sectors <= (partition.PartitionEndSector - partition.PartitionStartSector) + 1 : sectors <= (partition.PartitionEndSector - partition.PartitionStartSector) + 1;
// All FAT12 without BPB can only be used on floppies, without partitions.
if(partitionStart != 0)
if(partition.PartitionStartSector != 0)
return false;
byte fat2 = fat_sector[1];
@@ -218,7 +218,7 @@ namespace DiscImageChef.Filesystems
break;
}
if(fat2_sector_no > partitionEnd)
if(fat2_sector_no > partition.PartitionEndSector)
return false;
DicConsole.DebugWriteLine("FAT plugin", "2nd fat starts at = {0}", fat2_sector_no);
@@ -234,7 +234,7 @@ namespace DiscImageChef.Filesystems
return fat_id == fat2_sector[0];
}
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 = "";
@@ -263,7 +263,7 @@ namespace DiscImageChef.Filesystems
FAT32ParameterBlockShort shortFat32BPB = new FAT32ParameterBlockShort();
FAT32ParameterBlock Fat32BPB = new FAT32ParameterBlock();
byte[] bpb_sector = imagePlugin.ReadSector(partitionStart);
byte[] bpb_sector = imagePlugin.ReadSector(partition.PartitionStartSector);
if(imagePlugin.ImageInfo.sectorSize >= 512)
{
@@ -313,9 +313,9 @@ namespace DiscImageChef.Filesystems
else if(bits_in_bps_fat32_short == 1 && correct_spc_fat32_short && shortFat32BPB.fats_no <= 2 && shortFat32BPB.sectors == 0 && shortFat32BPB.spfat == 0 && shortFat32BPB.signature == 0x28)
{
DicConsole.DebugWriteLine("FAT plugin", "Using short FAT32 BPB");
useShortFAT32 = shortFat32BPB.big_sectors == 0 ? shortFat32BPB.huge_sectors <= (partitionEnd - partitionStart) + 1 : shortFat32BPB.big_sectors <= (partitionEnd - partitionStart) + 1;
useShortFAT32 = shortFat32BPB.big_sectors == 0 ? shortFat32BPB.huge_sectors <= (partition.PartitionEndSector - partition.PartitionStartSector) + 1 : shortFat32BPB.big_sectors <= (partition.PartitionEndSector - partition.PartitionStartSector) + 1;
}
else if(bits_in_bps_msx == 1 && correct_spc_msx && msxBPB.fats_no <= 2 && msxBPB.root_ent > 0 && msxBPB.sectors <= (partitionEnd - partitionStart) + 1 && msxBPB.spfat > 0 && Encoding.ASCII.GetString(msxBPB.vol_id) == "VOL_ID")
else if(bits_in_bps_msx == 1 && correct_spc_msx && msxBPB.fats_no <= 2 && msxBPB.root_ent > 0 && msxBPB.sectors <= (partition.PartitionEndSector - partition.PartitionStartSector) + 1 && msxBPB.spfat > 0 && Encoding.ASCII.GetString(msxBPB.vol_id) == "VOL_ID")
{
DicConsole.DebugWriteLine("FAT plugin", "Using MSX BPB");
useMSXBPB = true;
@@ -324,7 +324,7 @@ namespace DiscImageChef.Filesystems
{
if(EBPB.sectors == 0)
{
if(EBPB.big_sectors <= (partitionEnd - partitionStart) + 1)
if(EBPB.big_sectors <= (partition.PartitionEndSector - partition.PartitionStartSector) + 1)
{
if(EBPB.signature == 0x29)
{
@@ -338,7 +338,7 @@ namespace DiscImageChef.Filesystems
}
}
}
else if(EBPB.sectors <= (partitionEnd - partitionStart) + 1)
else if(EBPB.sectors <= (partition.PartitionEndSector - partition.PartitionStartSector) + 1)
{
if(EBPB.signature == 0x29)
{
@@ -352,14 +352,14 @@ namespace DiscImageChef.Filesystems
}
}
}
else if(bits_in_bps_dos33 == 1 && correct_spc_dos33 && dos33BPB.rsectors < (partitionEnd - partitionStart) && dos33BPB.fats_no <= 2 && dos33BPB.root_ent > 0 && dos33BPB.spfat > 0)
else if(bits_in_bps_dos33 == 1 && correct_spc_dos33 && dos33BPB.rsectors < (partition.PartitionEndSector - partition.PartitionStartSector) && dos33BPB.fats_no <= 2 && dos33BPB.root_ent > 0 && dos33BPB.spfat > 0)
{
if(dos33BPB.sectors == 0 && dos33BPB.hsectors <= partitionStart && dos33BPB.big_sectors > 0 && dos33BPB.big_sectors <= (partitionEnd - partitionStart) + 1)
if(dos33BPB.sectors == 0 && dos33BPB.hsectors <= partition.PartitionStartSector && dos33BPB.big_sectors > 0 && dos33BPB.big_sectors <= (partition.PartitionEndSector - partition.PartitionStartSector) + 1)
{
DicConsole.DebugWriteLine("FAT plugin", "Using DOS 3.3 BPB");
useDOS33BPB = true;
}
else if(dos33BPB.big_sectors == 0 && dos33BPB.hsectors <= partitionStart && dos33BPB.sectors > 0 && dos33BPB.sectors <= (partitionEnd - partitionStart) + 1)
else if(dos33BPB.big_sectors == 0 && dos33BPB.hsectors <= partition.PartitionStartSector && dos33BPB.sectors > 0 && dos33BPB.sectors <= (partition.PartitionEndSector - partition.PartitionStartSector) + 1)
{
if(atariBPB.jump[0] == 0x60 || (atariBPB.jump[0] == 0xE9 && atariBPB.jump[1] == 0x00) && Encoding.ASCII.GetString(dos33BPB.oem_name) != "NEXT ")
{
@@ -374,7 +374,7 @@ namespace DiscImageChef.Filesystems
}
else
{
if(dos32BPB.hsectors <= partitionStart && dos32BPB.hsectors + dos32BPB.sectors == dos32BPB.total_sectors)
if(dos32BPB.hsectors <= partition.PartitionStartSector && dos32BPB.hsectors + dos32BPB.sectors == dos32BPB.total_sectors)
{
DicConsole.DebugWriteLine("FAT plugin", "Using DOS 3.2 BPB");
useDOS32BPB = true;
@@ -429,7 +429,7 @@ namespace DiscImageChef.Filesystems
if(!useAtariBPB && !useMSXBPB && !useDOS2BPB && !useDOS3BPB && !useDOS32BPB && !useDOS33BPB && !useShortEBPB && !useEBPB && !useShortFAT32 && !useLongFAT32)
{
isFAT12 = true;
fat_sector = imagePlugin.ReadSector(1 + partitionStart);
fat_sector = imagePlugin.ReadSector(1 + partition.PartitionStartSector);
switch(fat_sector[0])
{
case 0xE5:
@@ -671,9 +671,9 @@ namespace DiscImageChef.Filesystems
root_directory_sector = (ulong)((Fat32BPB.root_cluster - 2) * Fat32BPB.spc + Fat32BPB.big_spfat * Fat32BPB.fats_no + Fat32BPB.rsectors) * sectors_per_real_sector;
sectors_for_root_directory = 1;
if(Fat32BPB.fsinfo_sector + partitionStart <= partitionEnd)
if(Fat32BPB.fsinfo_sector + partition.PartitionStartSector <= partition.PartitionEndSector)
{
byte[] fsinfo_sector = imagePlugin.ReadSector(Fat32BPB.fsinfo_sector + partitionStart);
byte[] fsinfo_sector = imagePlugin.ReadSector(Fat32BPB.fsinfo_sector + partition.PartitionStartSector);
IntPtr fsinfo_ptr = Marshal.AllocHGlobal(512);
Marshal.Copy(fsinfo_sector, 0, fsinfo_ptr, 512);
FSInfoSector fs_info = (FSInfoSector)Marshal.PtrToStructure(fsinfo_ptr, typeof(FSInfoSector));
@@ -874,7 +874,7 @@ namespace DiscImageChef.Filesystems
if(!isFAT12 && !isFAT16)
{
sectors_per_real_sector = fakeBPB.bps / imagePlugin.ImageInfo.sectorSize;
fat_sector = imagePlugin.ReadSector((fakeBPB.rsectors + partitionStart) * sectors_per_real_sector);
fat_sector = imagePlugin.ReadSector((fakeBPB.rsectors + partition.PartitionStartSector) * sectors_per_real_sector);
ulong clusters;
if(fakeBPB.sectors == 0)
@@ -971,7 +971,7 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("{0} heads.", fakeBPB.heads).AppendLine();
}
if(fakeBPB.hsectors <= partitionStart)
if(fakeBPB.hsectors <= partition.PartitionStartSector)
sb.AppendFormat("{0} hidden sectors before BPB.", fakeBPB.hsectors).AppendLine();
if(fakeBPB.signature == 0x28 || fakeBPB.signature == 0x29)
@@ -1017,9 +1017,9 @@ namespace DiscImageChef.Filesystems
if(extraInfo != null)
sb.Append(extraInfo);
if(root_directory_sector + partitionStart < partitionEnd)
if(root_directory_sector + partition.PartitionStartSector < partition.PartitionEndSector)
{
byte[] root_directory = imagePlugin.ReadSectors(root_directory_sector + partitionStart, sectors_for_root_directory);
byte[] root_directory = imagePlugin.ReadSectors(root_directory_sector + partition.PartitionStartSector, sectors_for_root_directory);
for(int i = 0; i < root_directory.Length; i += 32)
{
// Not a correct entry

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -34,6 +34,7 @@ using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
namespace DiscImageChef.Filesystems
{
@@ -57,7 +58,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.UTF8;
}
public FATX(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public FATX(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "FATX Filesystem Plugin";
PluginUUID = new Guid("ED27A721-4A17-4649-89FD-33633B46E228");
@@ -65,20 +66,20 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.UTF8;
}
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition)
{
if(imagePlugin.GetSectorSize() < 512)
return false;
FATX_Superblock fatxSb = new FATX_Superblock();
byte[] sector = imagePlugin.ReadSector(partitionStart);
byte[] sector = imagePlugin.ReadSector(partition.PartitionStartSector);
fatxSb = BigEndianMarshal.ByteArrayToStructureBigEndian<FATX_Superblock>(sector);
return fatxSb.magic == FATX_Magic;
}
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 = "";
if(imagePlugin.GetSectorSize() < 512)
@@ -86,7 +87,7 @@ namespace DiscImageChef.Filesystems
FATX_Superblock fatxSb = new FATX_Superblock();
byte[] sector = imagePlugin.ReadSector(partitionStart);
byte[] sector = imagePlugin.ReadSector(partition.PartitionStartSector);
fatxSb = BigEndianMarshal.ByteArrayToStructureBigEndian<FATX_Superblock>(sector);
@@ -105,7 +106,7 @@ namespace DiscImageChef.Filesystems
xmlFSType = new Schemas.FileSystemType();
xmlFSType.Type = "FATX filesystem";
xmlFSType.ClusterSize = (int)(fatxSb.sectorsPerCluster * imagePlugin.ImageInfo.sectorSize);
xmlFSType.Clusters = (long)((partitionEnd - partitionStart + 1) * imagePlugin.ImageInfo.sectorSize / (ulong)xmlFSType.ClusterSize);
xmlFSType.Clusters = (long)((partition.PartitionEndSector - partition.PartitionStartSector + 1) * imagePlugin.ImageInfo.sectorSize / (ulong)xmlFSType.ClusterSize);
}
public override Errno Mount()

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -31,12 +31,13 @@
// ****************************************************************************/
using System;
using System.Text;
using System.Collections.Generic;
using DiscImageChef.Console;
using ufs_daddr_t = System.Int32;
using time_t = System.Int32;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
using DiscImageChef.Console;
using time_t = System.Int32;
using ufs_daddr_t = System.Int32;
namespace DiscImageChef.Filesystems
{
@@ -50,7 +51,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.GetEncoding("iso-8859-15");
}
public FFSPlugin(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public FFSPlugin(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "BSD Fast File System (aka UNIX File System, UFS)";
PluginUUID = new Guid("CC90D342-05DB-48A8-988C-C1FE000034A3");
@@ -58,9 +59,9 @@ 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;
uint magic;
@@ -72,45 +73,45 @@ namespace DiscImageChef.Filesystems
else
sb_size_in_sectors = block_size / imagePlugin.GetSectorSize();
if(partitionEnd > (partitionStart + sb_start_floppy * sb_size_in_sectors + sb_size_in_sectors))
if(partition.PartitionEndSector > (partition.PartitionStartSector + sb_start_floppy * sb_size_in_sectors + sb_size_in_sectors))
{
ufs_sb_sectors = imagePlugin.ReadSectors(partitionStart + sb_start_floppy * sb_size_in_sectors, sb_size_in_sectors);
ufs_sb_sectors = imagePlugin.ReadSectors(partition.PartitionStartSector + sb_start_floppy * sb_size_in_sectors, sb_size_in_sectors);
magic = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x055C);
if(magic == UFS_MAGIC || magic == UFS_MAGIC_BW || magic == UFS2_MAGIC || magic == UFS_CIGAM || magic == UFS_BAD_MAGIC)
return true;
}
if(partitionEnd > (partitionStart + sb_start_ufs1 * sb_size_in_sectors + sb_size_in_sectors))
if(partition.PartitionEndSector > (partition.PartitionStartSector + sb_start_ufs1 * sb_size_in_sectors + sb_size_in_sectors))
{
ufs_sb_sectors = imagePlugin.ReadSectors(partitionStart + sb_start_ufs1 * sb_size_in_sectors, sb_size_in_sectors);
ufs_sb_sectors = imagePlugin.ReadSectors(partition.PartitionStartSector + sb_start_ufs1 * sb_size_in_sectors, sb_size_in_sectors);
magic = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x055C);
if(magic == UFS_MAGIC || magic == UFS_MAGIC_BW || magic == UFS2_MAGIC || magic == UFS_CIGAM || magic == UFS_BAD_MAGIC)
return true;
}
if(partitionEnd > (partitionStart + sb_start_ufs2 * sb_size_in_sectors + sb_size_in_sectors))
if(partition.PartitionEndSector > (partition.PartitionStartSector + sb_start_ufs2 * sb_size_in_sectors + sb_size_in_sectors))
{
ufs_sb_sectors = imagePlugin.ReadSectors(partitionStart + sb_start_ufs2 * sb_size_in_sectors, sb_size_in_sectors);
ufs_sb_sectors = imagePlugin.ReadSectors(partition.PartitionStartSector + sb_start_ufs2 * sb_size_in_sectors, sb_size_in_sectors);
magic = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x055C);
if(magic == UFS_MAGIC || magic == UFS_MAGIC_BW || magic == UFS2_MAGIC || magic == UFS_CIGAM || magic == UFS_BAD_MAGIC)
return true;
}
if(partitionEnd > (partitionStart + sb_start_piggy * sb_size_in_sectors + sb_size_in_sectors))
if(partition.PartitionEndSector > (partition.PartitionStartSector + sb_start_piggy * sb_size_in_sectors + sb_size_in_sectors))
{
ufs_sb_sectors = imagePlugin.ReadSectors(partitionStart + sb_start_piggy * sb_size_in_sectors, sb_size_in_sectors);
ufs_sb_sectors = imagePlugin.ReadSectors(partition.PartitionStartSector + sb_start_piggy * sb_size_in_sectors, sb_size_in_sectors);
magic = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x055C);
if(magic == UFS_MAGIC || magic == UFS_MAGIC_BW || magic == UFS2_MAGIC || magic == UFS_CIGAM || magic == UFS_BAD_MAGIC)
return true;
}
if(partitionEnd > (partitionStart + sb_start_atari / imagePlugin.GetSectorSize() + sb_size_in_sectors))
if(partition.PartitionEndSector > (partition.PartitionStartSector + sb_start_atari / imagePlugin.GetSectorSize() + sb_size_in_sectors))
{
ufs_sb_sectors = imagePlugin.ReadSectors(partitionStart + (sb_start_atari / imagePlugin.GetSectorSize()), sb_size_in_sectors);
ufs_sb_sectors = imagePlugin.ReadSectors(partition.PartitionStartSector + (sb_start_atari / imagePlugin.GetSectorSize()), sb_size_in_sectors);
magic = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x055C);
if(magic == UFS_MAGIC || magic == UFS_MAGIC_BW || magic == UFS2_MAGIC || magic == UFS_CIGAM || magic == UFS_BAD_MAGIC)
@@ -120,7 +121,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 = "";
StringBuilder sbInformation = new StringBuilder();
@@ -128,7 +129,7 @@ namespace DiscImageChef.Filesystems
uint magic = 0;
uint sb_size_in_sectors;
byte[] ufs_sb_sectors;
ulong sb_offset = partitionStart;
ulong sb_offset = partition.PartitionStartSector;
bool fs_type_42bsd = false;
bool fs_type_43bsd = false;
bool fs_type_44bsd = false;
@@ -142,57 +143,57 @@ namespace DiscImageChef.Filesystems
else
sb_size_in_sectors = block_size / imagePlugin.GetSectorSize();
if(partitionEnd > (partitionStart + sb_start_floppy * sb_size_in_sectors + sb_size_in_sectors) && magic == 0)
if(partition.PartitionEndSector > (partition.PartitionStartSector + sb_start_floppy * sb_size_in_sectors + sb_size_in_sectors) && magic == 0)
{
ufs_sb_sectors = imagePlugin.ReadSectors(partitionStart + sb_start_floppy * sb_size_in_sectors, sb_size_in_sectors);
ufs_sb_sectors = imagePlugin.ReadSectors(partition.PartitionStartSector + sb_start_floppy * sb_size_in_sectors, sb_size_in_sectors);
magic = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x055C);
if(magic == UFS_MAGIC || magic == UFS_MAGIC_BW || magic == UFS2_MAGIC || magic == UFS_CIGAM || magic == UFS_BAD_MAGIC)
sb_offset = partitionStart + sb_start_floppy * sb_size_in_sectors;
sb_offset = partition.PartitionStartSector + sb_start_floppy * sb_size_in_sectors;
else
magic = 0;
}
if(partitionEnd > (partitionStart + sb_start_ufs1 * sb_size_in_sectors + sb_size_in_sectors) && magic == 0)
if(partition.PartitionEndSector > (partition.PartitionStartSector + sb_start_ufs1 * sb_size_in_sectors + sb_size_in_sectors) && magic == 0)
{
ufs_sb_sectors = imagePlugin.ReadSectors(partitionStart + sb_start_ufs1 * sb_size_in_sectors, sb_size_in_sectors);
ufs_sb_sectors = imagePlugin.ReadSectors(partition.PartitionStartSector + sb_start_ufs1 * sb_size_in_sectors, sb_size_in_sectors);
magic = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x055C);
if(magic == UFS_MAGIC || magic == UFS_MAGIC_BW || magic == UFS2_MAGIC || magic == UFS_CIGAM || magic == UFS_BAD_MAGIC)
sb_offset = partitionStart + sb_start_ufs1 * sb_size_in_sectors;
sb_offset = partition.PartitionStartSector + sb_start_ufs1 * sb_size_in_sectors;
else
magic = 0;
}
if(partitionEnd > (partitionStart + sb_start_ufs2 * sb_size_in_sectors + sb_size_in_sectors) && magic == 0)
if(partition.PartitionEndSector > (partition.PartitionStartSector + sb_start_ufs2 * sb_size_in_sectors + sb_size_in_sectors) && magic == 0)
{
ufs_sb_sectors = imagePlugin.ReadSectors(partitionStart + sb_start_ufs2 * sb_size_in_sectors, sb_size_in_sectors);
ufs_sb_sectors = imagePlugin.ReadSectors(partition.PartitionStartSector + sb_start_ufs2 * sb_size_in_sectors, sb_size_in_sectors);
magic = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x055C);
if(magic == UFS_MAGIC || magic == UFS_MAGIC_BW || magic == UFS2_MAGIC || magic == UFS_CIGAM || magic == UFS_BAD_MAGIC)
sb_offset = partitionStart + sb_start_ufs2 * sb_size_in_sectors;
sb_offset = partition.PartitionStartSector + sb_start_ufs2 * sb_size_in_sectors;
else
magic = 0;
}
if(partitionEnd > (partitionStart + sb_start_piggy * sb_size_in_sectors + sb_size_in_sectors) && magic == 0)
if(partition.PartitionEndSector > (partition.PartitionStartSector + sb_start_piggy * sb_size_in_sectors + sb_size_in_sectors) && magic == 0)
{
ufs_sb_sectors = imagePlugin.ReadSectors(partitionStart + sb_start_piggy * sb_size_in_sectors, sb_size_in_sectors);
ufs_sb_sectors = imagePlugin.ReadSectors(partition.PartitionStartSector + sb_start_piggy * sb_size_in_sectors, sb_size_in_sectors);
magic = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x055C);
if(magic == UFS_MAGIC || magic == UFS_MAGIC_BW || magic == UFS2_MAGIC || magic == UFS_CIGAM || magic == UFS_BAD_MAGIC)
sb_offset = partitionStart + sb_start_piggy * sb_size_in_sectors;
sb_offset = partition.PartitionStartSector + sb_start_piggy * sb_size_in_sectors;
else
magic = 0;
}
if(partitionEnd > (partitionStart + sb_start_atari / imagePlugin.GetSectorSize() + sb_size_in_sectors) && magic == 0)
if(partition.PartitionEndSector > (partition.PartitionStartSector + sb_start_atari / imagePlugin.GetSectorSize() + sb_size_in_sectors) && magic == 0)
{
ufs_sb_sectors = imagePlugin.ReadSectors(partitionStart + sb_start_atari / imagePlugin.GetSectorSize(), sb_size_in_sectors);
ufs_sb_sectors = imagePlugin.ReadSectors(partition.PartitionStartSector + sb_start_atari / imagePlugin.GetSectorSize(), sb_size_in_sectors);
magic = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x055C);
if(magic == UFS_MAGIC || magic == UFS_MAGIC_BW || magic == UFS2_MAGIC || magic == UFS_CIGAM || magic == UFS_BAD_MAGIC)
sb_offset = partitionStart + sb_start_atari / imagePlugin.GetSectorSize();
sb_offset = partition.PartitionStartSector + sb_start_atari / imagePlugin.GetSectorSize();
else
magic = 0;
}

View File

@@ -33,6 +33,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using DiscImageChef.CommonTypes;
namespace DiscImageChef.Filesystems
{
@@ -68,10 +69,9 @@ namespace DiscImageChef.Filesystems
/// Initializes a filesystem instance prepared for reading contents
/// </summary>
/// <param name="imagePlugin">Image plugin.</param>
/// <param name="partitionStart">Partition start.</param>
/// <param name="partitionEnd">Partition end.</param>
/// <param name="partition">Partition.</param>
/// <param name="encoding">Which encoding to use for this filesystem.</param>
protected Filesystem(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
protected Filesystem(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
}
@@ -79,19 +79,17 @@ namespace DiscImageChef.Filesystems
/// Identifies the filesystem in the specified LBA
/// </summary>
/// <param name="imagePlugin">Disk image.</param>
/// <param name="partitionStart">Partition start sector (LBA).</param>
/// <param name="partitionEnd">Partition end sector (LBA).</param>
/// <param name="partition">Partition.</param>
/// <returns><c>true</c>, if the filesystem is recognized, <c>false</c> otherwise.</returns>
public abstract bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd);
public abstract bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition);
/// <summary>
/// Gets information about the identified filesystem.
/// </summary>
/// <param name="imagePlugin">Disk image.</param>
/// <param name="partitionStart">Partition start sector (LBA).</param>
/// <param name="partitionEnd">Partition end sector (LBA).</param>
/// <param name="partition">Partition.</param>
/// <param name="information">Filesystem information.</param>
public abstract void GetInformation(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, out string information);
public abstract void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information);
/// <summary>
/// Initializates whatever internal structures the filesystem plugin needs to be able to read files and directories from the filesystem.

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -31,10 +31,11 @@
// ****************************************************************************/
using System;
using System.Text;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.Checksums;
using DiscImageChef.CommonTypes;
namespace DiscImageChef.Filesystems
{
@@ -48,7 +49,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.GetEncoding("ibm850");
}
public HPFS(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public HPFS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "OS/2 High Performance File System";
PluginUUID = new Guid("33513B2C-f590-4acb-8bf2-0b1d5e19dec5");
@@ -56,9 +57,9 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.GetEncoding("ibm850");
}
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;
if(imagePlugin.ImageInfo.sectors <= 16)
@@ -66,7 +67,7 @@ namespace DiscImageChef.Filesystems
uint magic1, magic2;
byte[] hpfs_sb_sector = imagePlugin.ReadSector(16 + partitionStart); // Seek to superblock, on logical sector 16
byte[] hpfs_sb_sector = imagePlugin.ReadSector(16 + partition.PartitionStartSector); // Seek to superblock, on logical sector 16
magic1 = BitConverter.ToUInt32(hpfs_sb_sector, 0x000);
magic2 = BitConverter.ToUInt32(hpfs_sb_sector, 0x004);
@@ -75,7 +76,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 = "";
@@ -88,9 +89,9 @@ namespace DiscImageChef.Filesystems
byte[] oem_name = new byte[8];
byte[] volume_name = new byte[11];
byte[] hpfs_bpb_sector = imagePlugin.ReadSector(0 + partitionStart); // Seek to BIOS parameter block, on logical sector 0
byte[] hpfs_sb_sector = imagePlugin.ReadSector(16 + partitionStart); // Seek to superblock, on logical sector 16
byte[] hpfs_sp_sector = imagePlugin.ReadSector(17 + partitionStart); // Seek to spareblock, on logical sector 17
byte[] hpfs_bpb_sector = imagePlugin.ReadSector(0 + partition.PartitionStartSector); // Seek to BIOS parameter block, on logical sector 0
byte[] hpfs_sb_sector = imagePlugin.ReadSector(16 + partition.PartitionStartSector); // Seek to superblock, on logical sector 16
byte[] hpfs_sp_sector = imagePlugin.ReadSector(17 + partition.PartitionStartSector); // Seek to spareblock, on logical sector 17
IntPtr bpbPtr = Marshal.AllocHGlobal(512);
Marshal.Copy(hpfs_bpb_sector, 0, bpbPtr, 512);

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -31,12 +31,12 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Collections.Generic;
using DiscImageChef.CommonTypes;
using DiscImageChef.Console;
namespace DiscImageChef.Filesystems
{
// This is coded following ECMA-119.
@@ -54,7 +54,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.ASCII;
}
public ISO9660Plugin(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public ISO9660Plugin(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "ISO9660 Filesystem";
PluginUUID = new Guid("d812f4d3-c357-400d-90fd-3b22ef786aa8");
@@ -79,7 +79,7 @@ namespace DiscImageChef.Filesystems
public DateTime EffectiveTime;
}
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition)
{
/* if (alreadyLaunched)
return false;
@@ -92,11 +92,11 @@ namespace DiscImageChef.Filesystems
return false;
// ISO9660 Primary Volume Descriptor starts at sector 16, so that's minimal size.
if(partitionEnd <= (16 + partitionStart))
if(partition.PartitionEndSector <= (16 + partition.PartitionStartSector))
return false;
// Read to Volume Descriptor
byte[] vd_sector = imagePlugin.ReadSector(16 + partitionStart);
byte[] vd_sector = imagePlugin.ReadSector(16 + partition.PartitionStartSector);
int xa_off = 0;
if(vd_sector.Length == 2336)
@@ -116,7 +116,7 @@ namespace DiscImageChef.Filesystems
return CurrentEncoding.GetString(VDMagic) == "CD001";
}
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 = "";
StringBuilder ISOMetadata = new StringBuilder();
@@ -159,7 +159,7 @@ namespace DiscImageChef.Filesystems
return;
// ISO9660 Primary Volume Descriptor starts at sector 16, so that's minimal size.
if(partitionEnd < 16)
if(partition.PartitionEndSector < 16)
return;
ulong counter = 0;
@@ -168,8 +168,8 @@ namespace DiscImageChef.Filesystems
{
DicConsole.DebugWriteLine("ISO9660 plugin", "Processing VD loop no. {0}", counter);
// Seek to Volume Descriptor
DicConsole.DebugWriteLine("ISO9660 plugin", "Reading sector {0}", 16 + counter + partitionStart);
byte[] vd_sector_tmp = imagePlugin.ReadSector(16 + counter + partitionStart);
DicConsole.DebugWriteLine("ISO9660 plugin", "Reading sector {0}", 16 + counter + partition.PartitionStartSector);
byte[] vd_sector_tmp = imagePlugin.ReadSector(16 + counter + partition.PartitionStartSector);
byte[] vd_sector;
if(vd_sector_tmp.Length == 2336)
{
@@ -286,16 +286,16 @@ namespace DiscImageChef.Filesystems
ulong i = (ulong)BitConverter.ToInt32(VDPathTableStart, 0);
DicConsole.DebugWriteLine("ISO9660 plugin", "VDPathTableStart = {0} + {1} = {2}", i, partitionStart, i + partitionStart);
DicConsole.DebugWriteLine("ISO9660 plugin", "VDPathTableStart = {0} + {1} = {2}", i, partition.PartitionStartSector, i + partition.PartitionStartSector);
// TODO: Check this
if((i + partitionStart) < partitionEnd)
if((i + partition.PartitionStartSector) < partition.PartitionEndSector)
{
byte[] path_table = imagePlugin.ReadSector(i + partitionStart);
byte[] path_table = imagePlugin.ReadSector(i + partition.PartitionStartSector);
Array.Copy(path_table, 2, RootDirectoryLocation, 0, 4);
// Check for Rock Ridge
byte[] root_dir = imagePlugin.ReadSector((ulong)BitConverter.ToInt32(RootDirectoryLocation, 0) + partitionStart);
byte[] root_dir = imagePlugin.ReadSector((ulong)BitConverter.ToInt32(RootDirectoryLocation, 0) + partition.PartitionStartSector);
byte[] SUSPMagic = new byte[2];
byte[] RRMagic = new byte[2];
@@ -316,7 +316,7 @@ namespace DiscImageChef.Filesystems
StringBuilder IPBinInformation = new StringBuilder();
byte[] SegaHardwareID = new byte[16];
byte[] ipbin_sector = imagePlugin.ReadSector(0 + partitionStart);
byte[] ipbin_sector = imagePlugin.ReadSector(0 + partition.PartitionStartSector);
Array.Copy(ipbin_sector, 0x000, SegaHardwareID, 0, 16);
DicConsole.DebugWriteLine("ISO9660 plugin", "SegaHardwareID = \"{0}\"", CurrentEncoding.GetString(SegaHardwareID));
@@ -984,7 +984,7 @@ namespace DiscImageChef.Filesystems
}
xmlFSType.Bootable |= Bootable || SegaCD || Saturn || Dreamcast;
xmlFSType.Clusters = (long)(partitionEnd - partitionStart + 1);
xmlFSType.Clusters = (long)(partition.PartitionEndSector - partition.PartitionStartSector + 1);
xmlFSType.ClusterSize = 2048;
information = ISOMetadata.ToString();

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -34,6 +34,7 @@ using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
namespace DiscImageChef.Filesystems
{
@@ -140,7 +141,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.GetEncoding("iso-8859-15");
}
public JFS(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public JFS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "JFS Plugin";
PluginUUID = new Guid("D3BE2A41-8F28-4055-94DC-BB6C72A0E9C4");
@@ -148,10 +149,10 @@ 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)
{
uint bootSectors = JFS_BootBlocksSize / imagePlugin.GetSectorSize();
byte[] sector = imagePlugin.ReadSector(partitionStart + bootSectors);
byte[] sector = imagePlugin.ReadSector(partition.PartitionStartSector + bootSectors);
if(sector.Length < 512)
return false;
@@ -164,12 +165,12 @@ namespace DiscImageChef.Filesystems
return jfsSb.s_magic == JFS_Magic;
}
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 = "";
StringBuilder sb = new StringBuilder();
uint bootSectors = JFS_BootBlocksSize / imagePlugin.GetSectorSize();
byte[] sector = imagePlugin.ReadSector(partitionStart + bootSectors);
byte[] sector = imagePlugin.ReadSector(partition.PartitionStartSector + bootSectors);
if(sector.Length < 512)
return;

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -32,6 +32,7 @@
using System;
using System.Text;
using DiscImageChef.CommonTypes;
using DiscImageChef.Console;
using DiscImageChef.Decoders;
using DiscImageChef.ImagePlugins;
@@ -40,7 +41,7 @@ namespace DiscImageChef.Filesystems.LisaFS
{
public partial class LisaFS : Filesystem
{
public override bool Identify(ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
public override bool Identify(ImagePlugin imagePlugin, Partition partition)
{
try
{
@@ -126,7 +127,7 @@ namespace DiscImageChef.Filesystems.LisaFS
}
}
public override void GetInformation(ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, out string information)
public override void GetInformation(ImagePlugin imagePlugin, Partition partition, out string information)
{
information = "";
StringBuilder sb = new StringBuilder();

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -31,9 +31,9 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Text;
using DiscImageChef.CommonTypes;
using DiscImageChef.ImagePlugins;
namespace DiscImageChef.Filesystems.LisaFS
@@ -75,7 +75,7 @@ namespace DiscImageChef.Filesystems.LisaFS
CurrentEncoding = new Claunia.Encoding.LisaRoman();
}
public LisaFS(ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public LisaFS(ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
device = imagePlugin;
Name = "Apple Lisa File System";

View File

@@ -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();
}

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -34,6 +34,7 @@ using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
namespace DiscImageChef.Filesystems
{
@@ -103,7 +104,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.UTF8;
}
public NILFS2(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public NILFS2(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "NILFS2 Plugin";
PluginUUID = new Guid("35224226-C5CC-48B5-8FFD-3781E91E86B6");
@@ -111,7 +112,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.UTF8;
}
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition)
{
if(imagePlugin.GetSectorSize() < 512)
return false;
@@ -126,7 +127,7 @@ namespace DiscImageChef.Filesystems
if(Marshal.SizeOf(nilfsSb) % imagePlugin.GetSectorSize() != 0)
sbSize++;
byte[] sector = imagePlugin.ReadSectors(partitionStart + sbAddr, sbSize);
byte[] sector = imagePlugin.ReadSectors(partition.PartitionStartSector + sbAddr, sbSize);
if(sector.Length < Marshal.SizeOf(nilfsSb))
return false;
@@ -138,7 +139,7 @@ namespace DiscImageChef.Filesystems
return nilfsSb.magic == NILFS2_Magic;
}
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 = "";
if(imagePlugin.GetSectorSize() < 512)
@@ -154,7 +155,7 @@ namespace DiscImageChef.Filesystems
if(Marshal.SizeOf(nilfsSb) % imagePlugin.GetSectorSize() != 0)
sbSize++;
byte[] sector = imagePlugin.ReadSectors(partitionStart + sbAddr, sbSize);
byte[] sector = imagePlugin.ReadSectors(partition.PartitionStartSector + sbAddr, sbSize);
if(sector.Length < Marshal.SizeOf(nilfsSb))
return;

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -31,15 +31,15 @@
// ****************************************************************************/
using System;
using System.Text;
using DiscImageChef;
using System.Collections.Generic;
using System.Runtime.InteropServices;
// Information from Inside Windows NT
using System.Text;
using DiscImageChef.Checksums;
using DiscImageChef.CommonTypes;
namespace DiscImageChef.Filesystems
{
// Information from Inside Windows NT
public class NTFS : Filesystem
{
public NTFS()
@@ -49,16 +49,16 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.Unicode;
}
public NTFS(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public NTFS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "New Technology File System (NTFS)";
PluginUUID = new Guid("33513B2C-1e6d-4d21-a660-0bbc789c3871");
CurrentEncoding = Encoding.Unicode;
}
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;
byte[] eigth_bytes = new byte[8];
@@ -66,7 +66,7 @@ namespace DiscImageChef.Filesystems
ushort spfat, signature;
string oem_name;
byte[] ntfs_bpb = imagePlugin.ReadSector(0 + partitionStart);
byte[] ntfs_bpb = imagePlugin.ReadSector(0 + partition.PartitionStartSector);
Array.Copy(ntfs_bpb, 0x003, eigth_bytes, 0, 8);
oem_name = StringHandlers.CToString(eigth_bytes);
@@ -89,13 +89,13 @@ namespace DiscImageChef.Filesystems
return signature == 0xAA55;
}
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 = "";
StringBuilder sb = new StringBuilder();
byte[] ntfs_bpb = imagePlugin.ReadSector(0 + partitionStart);
byte[] ntfs_bpb = imagePlugin.ReadSector(0 + partition.PartitionStartSector);
NTFS_BootBlock ntfs_bb = new NTFS_BootBlock();
IntPtr bpbPtr = Marshal.AllocHGlobal(512);

View File

@@ -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;
using DiscImageChef.Console;
namespace DiscImageChef.Filesystems
@@ -46,7 +47,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.GetEncoding("shift_jis");
}
public NintendoPlugin(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public NintendoPlugin(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "Nintendo optical filesystems";
PluginUUID = new Guid("4675fcb4-4418-4288-9e4a-33d6a4ac1126");
@@ -54,9 +55,9 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.GetEncoding("shift_jis");
}
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition)
{
if(partitionStart != 0)
if(partition.PartitionStartSector != 0)
return false;
if((imagePlugin.GetSectors() * imagePlugin.GetSectorSize()) < 0x50000)
@@ -75,7 +76,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)
{
StringBuilder sbInformation = new StringBuilder();
information = "";

View File

@@ -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
{
@@ -54,7 +55,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.GetEncoding("iso-8859-1");
}
public ODS(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public ODS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "Files-11 On-Disk Structure";
PluginUUID = new Guid("de20633c-8021-4384-aeb0-83b0df14491f");
@@ -62,9 +63,9 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.GetEncoding("iso-8859-1");
}
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;
if(imagePlugin.GetSectorSize() < 512)
@@ -72,7 +73,7 @@ namespace DiscImageChef.Filesystems
byte[] magic_b = new byte[12];
string magic;
byte[] hb_sector = imagePlugin.ReadSector(1 + partitionStart);
byte[] hb_sector = imagePlugin.ReadSector(1 + partition.PartitionStartSector);
Array.Copy(hb_sector, 0x1F0, magic_b, 0, 12);
magic = Encoding.ASCII.GetString(magic_b);
@@ -80,7 +81,7 @@ namespace DiscImageChef.Filesystems
return magic == "DECFILE11A " || magic == "DECFILE11B ";
}
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 = "";
@@ -90,7 +91,7 @@ namespace DiscImageChef.Filesystems
homeblock.min_class = new byte[20];
homeblock.max_class = new byte[20];
byte[] hb_sector = imagePlugin.ReadSector(1 + partitionStart);
byte[] hb_sector = imagePlugin.ReadSector(1 + partition.PartitionStartSector);
homeblock.homelbn = BitConverter.ToUInt32(hb_sector, 0x000);
homeblock.alhomelbn = BitConverter.ToUInt32(hb_sector, 0x004);

View File

@@ -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
{
@@ -45,7 +46,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.ASCII;
}
public OperaFS(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public OperaFS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "Opera Filesystem Plugin";
PluginUUID = new Guid("0ec84ec7-eae6-4196-83fe-943b3fe46dbd");
@@ -53,12 +54,12 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.ASCII;
}
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;
byte[] sb_sector = imagePlugin.ReadSector(0 + partitionStart);
byte[] sb_sector = imagePlugin.ReadSector(0 + partition.PartitionStartSector);
byte record_type;
byte[] sync_bytes = new byte[5];
@@ -74,12 +75,12 @@ namespace DiscImageChef.Filesystems
}
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 = "";
StringBuilder SuperBlockMetadata = new StringBuilder();
byte[] sb_sector = imagePlugin.ReadSector(0 + partitionStart);
byte[] sb_sector = imagePlugin.ReadSector(0 + partition.PartitionStartSector);
OperaSuperBlock sb = new OperaSuperBlock();
byte[] cString = new byte[32];

View File

@@ -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
{
@@ -45,7 +46,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.GetEncoding("shift_jis");
}
public PCEnginePlugin(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public PCEnginePlugin(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "PC Engine CD Plugin";
PluginUUID = new Guid("e5ee6d7c-90fa-49bd-ac89-14ef750b8af3");
@@ -53,25 +54,25 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.GetEncoding("shift_jis");
}
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;
byte[] system_descriptor = new byte[23];
byte[] sector = imagePlugin.ReadSector(1 + partitionStart);
byte[] sector = imagePlugin.ReadSector(1 + partition.PartitionStartSector);
Array.Copy(sector, 0x20, system_descriptor, 0, 23);
return Encoding.ASCII.GetString(system_descriptor) == "PC Engine CD-ROM SYSTEM";
}
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 = "";
xmlFSType = new Schemas.FileSystemType();
xmlFSType.Type = "PC Engine filesystem";
xmlFSType.Clusters = (long)((partitionEnd - partitionStart + 1) / imagePlugin.GetSectorSize() * 2048);
xmlFSType.Clusters = (long)((partition.PartitionEndSector - partition.PartitionStartSector + 1) / imagePlugin.GetSectorSize() * 2048);
xmlFSType.ClusterSize = 2048;
}

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -31,9 +31,10 @@
// ****************************************************************************/
using System;
using System.Text;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
namespace DiscImageChef.Filesystems
{
@@ -46,7 +47,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.GetEncoding("iso-8859-1");
}
public PFS(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public PFS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "Professional File System";
PluginUUID = new Guid("68DE769E-D957-406A-8AE4-3781CA8CDA77");
@@ -177,23 +178,23 @@ namespace DiscImageChef.Filesystems
/// </summary>
const uint MUPFS_DISK = 0x6D755046;
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition)
{
if(partitionStart >= partitionEnd)
if(partition.PartitionStartSector >= partition.PartitionEndSector)
return false;
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
byte[] sector = imagePlugin.ReadSector(2 + partitionStart);
byte[] sector = imagePlugin.ReadSector(2 + partition.PartitionStartSector);
uint magic = BigEndianBitConverter.ToUInt32(sector, 0x00);
return magic == AFS_DISK || magic == PFS2_DISK || magic == PFS_DISK || magic == MUAF_DISK || magic == MUPFS_DISK;
}
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)
{
byte[] RootBlockSector = imagePlugin.ReadSector(2 + partitionStart);
byte[] RootBlockSector = imagePlugin.ReadSector(2 + partition.PartitionStartSector);
RootBlock rootBlock = new RootBlock();
rootBlock = BigEndianMarshal.ByteArrayToStructureBigEndian<RootBlock>(RootBlockSector);

View File

@@ -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;
using DiscImageChef.Console;
namespace DiscImageChef.Filesystems
@@ -85,7 +86,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = new Claunia.Encoding.LisaRoman();
}
public ProDOSPlugin(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public ProDOSPlugin(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "Apple ProDOS filesystem";
PluginUUID = new Guid("43874265-7B8A-4739-BCF7-07F80D5932BF");
@@ -93,13 +94,13 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = new Claunia.Encoding.LisaRoman();
}
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition)
{
if(partitionEnd < 3)
if(partition.PartitionEndSector < 3)
return false;
// Blocks 0 and 1 are boot code
byte[] rootDirectoryKeyBlock = imagePlugin.ReadSector(2 + partitionStart);
byte[] rootDirectoryKeyBlock = imagePlugin.ReadSector(2 + partition.PartitionStartSector);
ushort prePointer = BitConverter.ToUInt16(rootDirectoryKeyBlock, 0);
DicConsole.DebugWriteLine("ProDOS plugin", "prePointer = {0}", prePointer);
@@ -123,20 +124,20 @@ namespace DiscImageChef.Filesystems
ushort bit_map_pointer = BitConverter.ToUInt16(rootDirectoryKeyBlock, 0x27);
DicConsole.DebugWriteLine("ProDOS plugin", "bit_map_pointer = {0}", bit_map_pointer);
if(bit_map_pointer > partitionEnd)
if(bit_map_pointer > partition.PartitionEndSector)
return false;
ushort total_blocks = BitConverter.ToUInt16(rootDirectoryKeyBlock, 0x29);
DicConsole.DebugWriteLine("ProDOS plugin", "{0} <= ({1} - {2} + 1)? {3}", total_blocks, partitionEnd, partitionStart, total_blocks <= (partitionEnd - partitionStart + 1));
return total_blocks <= (partitionEnd - partitionStart + 1);
DicConsole.DebugWriteLine("ProDOS plugin", "{0} <= ({1} - {2} + 1)? {3}", total_blocks, partition.PartitionEndSector, partition.PartitionStartSector, total_blocks <= (partition.PartitionEndSector - partition.PartitionStartSector + 1));
return total_blocks <= (partition.PartitionEndSector - partition.PartitionStartSector + 1);
}
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)
{
StringBuilder sbInformation = new StringBuilder();
// Blocks 0 and 1 are boot code
byte[] rootDirectoryKeyBlockBytes = imagePlugin.ReadSector(2 + partitionStart);
byte[] rootDirectoryKeyBlockBytes = imagePlugin.ReadSector(2 + partition.PartitionStartSector);
ProDOSRootDirectoryKeyBlock rootDirectoryKeyBlock = new ProDOSRootDirectoryKeyBlock();
rootDirectoryKeyBlock.header = new ProDOSRootDirectoryHeader();
@@ -234,7 +235,7 @@ namespace DiscImageChef.Filesystems
xmlFSType.Files = rootDirectoryKeyBlock.header.file_count;
xmlFSType.FilesSpecified = true;
xmlFSType.Clusters = rootDirectoryKeyBlock.header.total_blocks;
xmlFSType.ClusterSize = (int)(((partitionEnd - partitionStart) + 1) * imagePlugin.ImageInfo.sectorSize / (ulong)xmlFSType.Clusters);
xmlFSType.ClusterSize = (int)(((partition.PartitionEndSector - partition.PartitionStartSector) + 1) * imagePlugin.ImageInfo.sectorSize / (ulong)xmlFSType.Clusters);
xmlFSType.Type = "ProDOS";
return;

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -35,6 +35,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
namespace DiscImageChef.Filesystems
{
@@ -114,7 +115,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.GetEncoding("iso-8859-15");
}
public QNX4(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public QNX4(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "QNX4 Plugin";
PluginUUID = new Guid("E73A63FA-B5B0-48BF-BF82-DA5F0A8170D2");
@@ -122,9 +123,9 @@ 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)
{
byte[] sector = imagePlugin.ReadSector(partitionStart + 1);
byte[] sector = imagePlugin.ReadSector(partition.PartitionStartSector + 1);
if(sector.Length < 512)
return false;
@@ -146,10 +147,10 @@ namespace DiscImageChef.Filesystems
return false;
// Check extents are not past device
if(qnxSb.rootDir.di_first_xtnt.block + partitionStart >= partitionEnd ||
qnxSb.inode.di_first_xtnt.block + partitionStart >= partitionEnd ||
qnxSb.boot.di_first_xtnt.block + partitionStart >= partitionEnd ||
qnxSb.altBoot.di_first_xtnt.block + partitionStart >= partitionEnd)
if(qnxSb.rootDir.di_first_xtnt.block + partition.PartitionStartSector >= partition.PartitionEndSector ||
qnxSb.inode.di_first_xtnt.block + partition.PartitionStartSector >= partition.PartitionEndSector ||
qnxSb.boot.di_first_xtnt.block + partition.PartitionStartSector >= partition.PartitionEndSector ||
qnxSb.altBoot.di_first_xtnt.block + partition.PartitionStartSector >= partition.PartitionEndSector)
return false;
// Check inodes are in use
@@ -162,10 +163,10 @@ namespace DiscImageChef.Filesystems
return true;
}
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 = "";
byte[] sector = imagePlugin.ReadSector(partitionStart + 1);
byte[] sector = imagePlugin.ReadSector(partition.PartitionStartSector + 1);
if(sector.Length < 512)
return;
@@ -254,7 +255,7 @@ namespace DiscImageChef.Filesystems
xmlFSType = new Schemas.FileSystemType();
xmlFSType.Type = "QNX4 filesystem";
xmlFSType.Clusters = (long)((partitionEnd - partitionStart + 1) / imagePlugin.GetSectorSize() * 512);
xmlFSType.Clusters = (long)((partition.PartitionEndSector - partition.PartitionStartSector + 1) / imagePlugin.GetSectorSize() * 512);
xmlFSType.ClusterSize = 512;
xmlFSType.Bootable |= (qnxSb.boot.di_size != 0 || qnxSb.altBoot.di_size != 0);
xmlFSType.CreationDate = DateHandlers.UNIXUnsignedToDateTime(qnxSb.rootDir.di_ftime);

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -34,6 +34,7 @@ using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
namespace DiscImageChef.Filesystems
{
@@ -109,7 +110,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.GetEncoding("iso-8859-15");
}
public QNX6(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public QNX6(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "QNX6 Plugin";
PluginUUID = new Guid("3E610EA2-4D08-4D70-8947-830CD4C74FC0");
@@ -117,13 +118,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)
{
uint sectors = QNX6_SuperBlockSize / imagePlugin.GetSectorSize();
uint bootSectors = QNX6_BootBlocksSize / imagePlugin.GetSectorSize();
byte[] audiSector = imagePlugin.ReadSectors(partitionStart, sectors);
byte[] sector = imagePlugin.ReadSectors(partitionStart + bootSectors, sectors);
byte[] audiSector = imagePlugin.ReadSectors(partition.PartitionStartSector, sectors);
byte[] sector = imagePlugin.ReadSectors(partition.PartitionStartSector + bootSectors, sectors);
if(sector.Length < QNX6_SuperBlockSize)
return false;
@@ -142,15 +143,15 @@ namespace DiscImageChef.Filesystems
return qnxSb.magic == QNX6_Magic || audiSb.magic == QNX6_Magic;
}
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 = "";
StringBuilder sb = new StringBuilder();
uint sectors = QNX6_SuperBlockSize / imagePlugin.GetSectorSize();
uint bootSectors = QNX6_BootBlocksSize / imagePlugin.GetSectorSize();
byte[] audiSector = imagePlugin.ReadSectors(partitionStart, sectors);
byte[] sector = imagePlugin.ReadSectors(partitionStart + bootSectors, sectors);
byte[] audiSector = imagePlugin.ReadSectors(partition.PartitionStartSector, sectors);
byte[] sector = imagePlugin.ReadSectors(partition.PartitionStartSector + bootSectors, sectors);
if(sector.Length < QNX6_SuperBlockSize)
return;

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -35,6 +35,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
namespace DiscImageChef.Filesystems
{
@@ -97,7 +98,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.GetEncoding("iso-8859-15");
}
public Reiser(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public Reiser(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "Reiser Filesystem Plugin";
PluginUUID = new Guid("1D8CD8B8-27E6-410F-9973-D16409225FBA");
@@ -105,7 +106,7 @@ 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(imagePlugin.GetSectorSize() < 512)
return false;
@@ -120,7 +121,7 @@ namespace DiscImageChef.Filesystems
if(Marshal.SizeOf(reiserSb) % imagePlugin.GetSectorSize() != 0)
sbSize++;
byte[] sector = imagePlugin.ReadSectors(partitionStart + sbAddr, sbSize);
byte[] sector = imagePlugin.ReadSectors(partition.PartitionStartSector + sbAddr, sbSize);
if(sector.Length < Marshal.SizeOf(reiserSb))
return false;
@@ -134,7 +135,7 @@ namespace DiscImageChef.Filesystems
ReiserJr_Magic.SequenceEqual(reiserSb.magic);
}
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 = "";
if(imagePlugin.GetSectorSize() < 512)
@@ -150,7 +151,7 @@ namespace DiscImageChef.Filesystems
if(Marshal.SizeOf(reiserSb) % imagePlugin.GetSectorSize() != 0)
sbSize++;
byte[] sector = imagePlugin.ReadSectors(partitionStart + sbAddr, sbSize);
byte[] sector = imagePlugin.ReadSectors(partition.PartitionStartSector + sbAddr, sbSize);
if(sector.Length < Marshal.SizeOf(reiserSb))
return;

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -32,9 +32,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Linq;
using DiscImageChef.CommonTypes;
namespace DiscImageChef.Filesystems
{
@@ -62,7 +63,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.GetEncoding("iso-8859-15");
}
public Reiser4(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public Reiser4(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "Reiser4 Filesystem Plugin";
PluginUUID = new Guid("301F2D00-E8D5-4F04-934E-81DFB21D15BA");
@@ -70,7 +71,7 @@ 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(imagePlugin.GetSectorSize() < 512)
return false;
@@ -85,7 +86,7 @@ namespace DiscImageChef.Filesystems
if(Marshal.SizeOf(reiserSb) % imagePlugin.GetSectorSize() != 0)
sbSize++;
byte[] sector = imagePlugin.ReadSectors(partitionStart + sbAddr, sbSize);
byte[] sector = imagePlugin.ReadSectors(partition.PartitionStartSector + sbAddr, sbSize);
if(sector.Length < Marshal.SizeOf(reiserSb))
return false;
@@ -97,7 +98,7 @@ namespace DiscImageChef.Filesystems
return Reiser4_Magic.SequenceEqual(reiserSb.magic);
}
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 = "";
if(imagePlugin.GetSectorSize() < 512)
@@ -113,7 +114,7 @@ namespace DiscImageChef.Filesystems
if(Marshal.SizeOf(reiserSb) % imagePlugin.GetSectorSize() != 0)
sbSize++;
byte[] sector = imagePlugin.ReadSectors(partitionStart + sbAddr, sbSize);
byte[] sector = imagePlugin.ReadSectors(partition.PartitionStartSector + sbAddr, sbSize);
if(sector.Length < Marshal.SizeOf(reiserSb))
return;
@@ -138,7 +139,7 @@ namespace DiscImageChef.Filesystems
xmlFSType = new Schemas.FileSystemType();
xmlFSType.Type = "Reiser 4 filesystem";
xmlFSType.ClusterSize = reiserSb.blocksize;
xmlFSType.Clusters = (long)(((partitionEnd - partitionStart) * imagePlugin.GetSectorSize()) / reiserSb.blocksize);
xmlFSType.Clusters = (long)(((partition.PartitionEndSector - partition.PartitionStartSector) * imagePlugin.GetSectorSize()) / reiserSb.blocksize);
xmlFSType.VolumeName = StringHandlers.CToString(reiserSb.label, CurrentEncoding);
xmlFSType.VolumeSerial = reiserSb.uuid.ToString();
}

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -34,6 +34,7 @@ using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
namespace DiscImageChef.Filesystems
{
@@ -46,7 +47,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.GetEncoding("iso-8859-1");
}
public SFS(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public SFS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "SmartFileSystem";
PluginUUID = new Guid("26550C19-3671-4A2D-BC2F-F20CEB7F48DC");
@@ -97,23 +98,23 @@ namespace DiscImageChef.Filesystems
/// </summary>
const uint SFS_MAGIC = 0x53465300;
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition)
{
if(partitionStart >= partitionEnd)
if(partition.PartitionStartSector >= partition.PartitionEndSector)
return false;
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
byte[] sector = imagePlugin.ReadSector(partitionStart);
byte[] sector = imagePlugin.ReadSector(partition.PartitionStartSector);
uint magic = BigEndianBitConverter.ToUInt32(sector, 0x00);
return magic == SFS_MAGIC;
}
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)
{
byte[] RootBlockSector = imagePlugin.ReadSector(partitionStart);
byte[] RootBlockSector = imagePlugin.ReadSector(partition.PartitionStartSector);
RootBlock rootBlock = new RootBlock();
rootBlock = BigEndianMarshal.ByteArrayToStructureBigEndian<RootBlock>(RootBlockSector);

View File

@@ -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;
using DiscImageChef.Console;
namespace DiscImageChef.Filesystems
@@ -47,7 +48,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.GetEncoding("iso-8859-15");
}
public SolarFS(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public SolarFS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "Solar_OS filesystem";
PluginUUID = new Guid("EA3101C1-E777-4B4F-B5A3-8C57F50F6E65");
@@ -55,15 +56,15 @@ 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;
byte signature; /// <summary>0x29
string fs_type; // "SOL_FS "
byte[] bpb = imagePlugin.ReadSector(0 + partitionStart);
byte[] bpb = imagePlugin.ReadSector(0 + partition.PartitionStartSector);
byte[] fs_type_b = new byte[8];
@@ -76,12 +77,12 @@ 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 = "";
StringBuilder sb = new StringBuilder();
byte[] bpb_sector = imagePlugin.ReadSector(0 + partitionStart);
byte[] bpb_sector = imagePlugin.ReadSector(0 + partition.PartitionStartSector);
byte[] bpb_strings;
SolarOSParameterBlock BPB = new SolarOSParameterBlock();

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -34,6 +34,7 @@ using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
namespace DiscImageChef.Filesystems
{
@@ -46,7 +47,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.UTF8;
}
public Squash(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public Squash(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "Squash filesystem";
PluginUUID = new Guid("F8F6E46F-7A2A-48E3-9C0A-46AF4DC29E09");
@@ -93,21 +94,21 @@ namespace DiscImageChef.Filesystems
const uint Squash_MAGIC = 0x73717368;
const uint Squash_CIGAM = 0x68737173;
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition)
{
if(partitionStart >= partitionEnd)
if(partition.PartitionStartSector >= partition.PartitionEndSector)
return false;
byte[] sector = imagePlugin.ReadSector(partitionStart);
byte[] sector = imagePlugin.ReadSector(partition.PartitionStartSector);
uint magic = BitConverter.ToUInt32(sector, 0x00);
return magic == Squash_MAGIC || magic == Squash_CIGAM;
}
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)
{
byte[] sector = imagePlugin.ReadSector(partitionStart);
byte[] sector = imagePlugin.ReadSector(partition.PartitionStartSector);
uint magic = BitConverter.ToUInt32(sector, 0x00);
SquashSuperBlock sqSb = new SquashSuperBlock();
@@ -166,7 +167,7 @@ namespace DiscImageChef.Filesystems
xmlFSType.Type = "Squash file system";
xmlFSType.CreationDate = DateHandlers.UNIXUnsignedToDateTime(sqSb.mkfs_time);
xmlFSType.CreationDateSpecified = true;
xmlFSType.Clusters = (long)(((partitionEnd - partitionStart + 1) * imagePlugin.ImageInfo.sectorSize) / sqSb.block_size);
xmlFSType.Clusters = (long)(((partition.PartitionEndSector - partition.PartitionStartSector + 1) * imagePlugin.ImageInfo.sectorSize) / sqSb.block_size);
xmlFSType.ClusterSize = (int)sqSb.block_size;
xmlFSType.Files = sqSb.inodes;
xmlFSType.FilesSpecified = true;

View File

@@ -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
{
@@ -61,7 +62,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.GetEncoding("iso-8859-15");
}
public SysVfs(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public SysVfs(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "UNIX System V filesystem";
PluginUUID = new Guid("9B8D016A-8561-400E-A12A-A198283C211D");
@@ -69,9 +70,9 @@ 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;
uint magic;
@@ -106,7 +107,7 @@ namespace DiscImageChef.Filesystems
else
sb_size_in_sectors = 1; // If not a single sector can store it
if(partitionEnd <= (partitionStart + 4 * (ulong)sb_size_in_sectors + sb_size_in_sectors)) // Device must be bigger than SB location + SB size + offset
if(partition.PartitionEndSector <= (partition.PartitionStartSector + 4 * (ulong)sb_size_in_sectors + sb_size_in_sectors)) // Device must be bigger than SB location + SB size + offset
return false;
// Superblock can start on 0x000, 0x200, 0x600 and 0x800, not aligned, so we assume 16 (128 bytes/sector) sectors as a safe value
@@ -115,7 +116,7 @@ namespace DiscImageChef.Filesystems
if(i + sb_size_in_sectors >= (int)imagePlugin.ImageInfo.sectors)
break;
byte[] sb_sector = imagePlugin.ReadSectors((ulong)i + partitionStart, sb_size_in_sectors);
byte[] sb_sector = imagePlugin.ReadSectors((ulong)i + partition.PartitionStartSector, sb_size_in_sectors);
magic = BitConverter.ToUInt32(sb_sector, 0x3F8); // XENIX magic location
@@ -160,7 +161,7 @@ namespace DiscImageChef.Filesystems
{
if(s_fsize < V7_MAXSIZE && s_nfree < V7_NICFREE && s_ninode < V7_NICINOD)
{
if((s_fsize * 1024) == ((partitionEnd - partitionStart) * imagePlugin.GetSectorSize()) || (s_fsize * 512) == ((partitionEnd - partitionStart) * imagePlugin.GetSectorSize()))
if((s_fsize * 1024) == ((partition.PartitionEndSector - partition.PartitionStartSector) * imagePlugin.GetSectorSize()) || (s_fsize * 512) == ((partition.PartitionEndSector - partition.PartitionStartSector) * imagePlugin.GetSectorSize()))
return true;
}
}
@@ -170,7 +171,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 = "";
@@ -198,7 +199,7 @@ namespace DiscImageChef.Filesystems
// Superblock can start on 0x000, 0x200, 0x600 and 0x800, not aligned, so we assume 16 (128 bytes/sector) sectors as a safe value
for(start = 0; start <= 16; start++)
{
sb_sector = imagePlugin.ReadSectors((ulong)start + partitionStart, sb_size_in_sectors);
sb_sector = imagePlugin.ReadSectors((ulong)start + partition.PartitionStartSector, sb_size_in_sectors);
magic = BigEndianBitConverter.ToUInt32(sb_sector, 0x3F8); // XENIX magic location
if(magic == XENIX_MAGIC)
@@ -276,7 +277,7 @@ namespace DiscImageChef.Filesystems
{
if(s_fsize < V7_MAXSIZE && s_nfree < V7_NICFREE && s_ninode < V7_NICINOD)
{
if((s_fsize * 1024) == ((partitionEnd - partitionStart) * imagePlugin.GetSectorSize()) || (s_fsize * 512) == ((partitionEnd - partitionStart) * imagePlugin.GetSectorSize()))
if((s_fsize * 1024) == ((partition.PartitionEndSector - partition.PartitionStartSector) * imagePlugin.GetSectorSize()) || (s_fsize * 512) == ((partition.PartitionEndSector - partition.PartitionStartSector) * imagePlugin.GetSectorSize()))
{
sys7th = true;
BigEndianBitConverter.IsLittleEndian = true;
@@ -295,7 +296,7 @@ namespace DiscImageChef.Filesystems
{
byte[] xenix_strings = new byte[6];
XenixSuperBlock xnx_sb = new XenixSuperBlock();
sb_sector = imagePlugin.ReadSectors((ulong)start + partitionStart, sb_size_in_sectors);
sb_sector = imagePlugin.ReadSectors((ulong)start + partition.PartitionStartSector, sb_size_in_sectors);
if(xenix3)
{
@@ -417,7 +418,7 @@ namespace DiscImageChef.Filesystems
if(sysv)
{
sb_sector = imagePlugin.ReadSectors((ulong)start + partitionStart, sb_size_in_sectors);
sb_sector = imagePlugin.ReadSectors((ulong)start + partition.PartitionStartSector, sb_size_in_sectors);
ushort pad0, pad1, pad2;
byte[] sysv_strings = new byte[6];
@@ -556,7 +557,7 @@ namespace DiscImageChef.Filesystems
if(coherent)
{
sb_sector = imagePlugin.ReadSectors((ulong)start + partitionStart, sb_size_in_sectors);
sb_sector = imagePlugin.ReadSectors((ulong)start + partition.PartitionStartSector, sb_size_in_sectors);
CoherentSuperBlock coh_sb = new CoherentSuperBlock();
byte[] coh_strings = new byte[6];
@@ -611,7 +612,7 @@ namespace DiscImageChef.Filesystems
if(sys7th)
{
sb_sector = imagePlugin.ReadSectors((ulong)start + partitionStart, sb_size_in_sectors);
sb_sector = imagePlugin.ReadSectors((ulong)start + partition.PartitionStartSector, sb_size_in_sectors);
UNIX7thEditionSuperBlock v7_sb = new UNIX7thEditionSuperBlock();
byte[] sys7_strings = new byte[6];

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -32,19 +32,20 @@
using System;
using System.Text;
using DiscImageChef.CommonTypes;
namespace DiscImageChef.Filesystems.UCSDPascal
{
// Information from Call-A.P.P.L.E. Pascal Disk Directory Structure
public partial class PascalPlugin : Filesystem
{
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition)
{
if(imagePlugin.GetSectors() < 3)
return false;
// Blocks 0 and 1 are boot code
byte[] volBlock = imagePlugin.ReadSector(2 + partitionStart);
byte[] volBlock = imagePlugin.ReadSector(2 + partition.PartitionStartSector);
PascalVolumeEntry volEntry = new PascalVolumeEntry();
@@ -88,7 +89,7 @@ namespace DiscImageChef.Filesystems.UCSDPascal
return true;
}
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)
{
StringBuilder sbInformation = new StringBuilder();
information = "";
@@ -97,7 +98,7 @@ namespace DiscImageChef.Filesystems.UCSDPascal
return;
// Blocks 0 and 1 are boot code
byte[] volBlock = imagePlugin.ReadSector(2 + partitionStart);
byte[] volBlock = imagePlugin.ReadSector(2 + partition.PartitionStartSector);
PascalVolumeEntry volEntry = new PascalVolumeEntry();
@@ -147,7 +148,7 @@ namespace DiscImageChef.Filesystems.UCSDPascal
information = sbInformation.ToString();
xmlFSType = new Schemas.FileSystemType();
xmlFSType.Bootable = !ArrayHelpers.ArrayIsNullOrEmpty(imagePlugin.ReadSectors(partitionStart, 2));
xmlFSType.Bootable = !ArrayHelpers.ArrayIsNullOrEmpty(imagePlugin.ReadSectors(partition.PartitionStartSector, 2));
xmlFSType.Clusters = volEntry.blocks;
xmlFSType.ClusterSize = (int)imagePlugin.GetSectorSize();
xmlFSType.Files = volEntry.files;

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -33,6 +33,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using DiscImageChef.CommonTypes;
using DiscImageChef.ImagePlugins;
namespace DiscImageChef.Filesystems.UCSDPascal
@@ -56,7 +57,7 @@ namespace DiscImageChef.Filesystems.UCSDPascal
CurrentEncoding = new Claunia.Encoding.LisaRoman();
}
public PascalPlugin(ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public PascalPlugin(ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
device = imagePlugin;
Name = "U.C.S.D. Pascal filesystem";

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -32,10 +32,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
using DiscImageChef.Console;
using System.Linq;
using DiscImageChef.ImagePlugins;
namespace DiscImageChef.Filesystems
@@ -50,7 +51,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.UTF8;
}
public UDF(ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public UDF(ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "Universal Disk Format";
PluginUUID = new Guid("83976FEC-A91B-464B-9293-56C719461BAB");
@@ -230,10 +231,10 @@ namespace DiscImageChef.Filesystems
public ushort maximumWriteUDF;
}
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition)
{
// UDF needs at least that
if(partitionEnd - partitionStart < 256)
if(partition.PartitionEndSector - partition.PartitionStartSector < 256)
return false;
// UDF needs at least that
@@ -243,12 +244,12 @@ namespace DiscImageChef.Filesystems
byte[] sector;
AnchorVolumeDescriptorPointer anchor = new AnchorVolumeDescriptorPointer();
// All positions where anchor may reside
ulong[] positions = { 256, 512, partitionEnd - 256, partitionEnd };
ulong[] positions = { 256, 512, partition.PartitionEndSector - 256, partition.PartitionEndSector };
bool anchorFound = false;
foreach(ulong position in positions)
{
if(position + partitionStart >= partitionEnd)
if(position + partition.PartitionStartSector >= partition.PartitionEndSector)
continue;
sector = imagePlugin.ReadSector(position);
@@ -273,7 +274,7 @@ namespace DiscImageChef.Filesystems
if(anchor.tag.tagIdentifier == TagIdentifier.AnchorVolumeDescriptorPointer &&
anchor.tag.tagLocation == position &&
(anchor.mainVolumeDescriptorSequenceExtent.location + partitionStart) < partitionEnd)
(anchor.mainVolumeDescriptorSequenceExtent.location + partition.PartitionStartSector) < partition.PartitionEndSector)
{
anchorFound = true;
break;
@@ -287,11 +288,11 @@ namespace DiscImageChef.Filesystems
while(count < 256)
{
sector = imagePlugin.ReadSector(partitionStart + anchor.mainVolumeDescriptorSequenceExtent.location + count);
sector = imagePlugin.ReadSector(partition.PartitionStartSector + anchor.mainVolumeDescriptorSequenceExtent.location + count);
TagIdentifier tagId = (TagIdentifier)BitConverter.ToUInt16(sector, 0);
uint location = BitConverter.ToUInt32(sector, 0x0C);
if(location == partitionStart + anchor.mainVolumeDescriptorSequenceExtent.location + count)
if(location == partition.PartitionStartSector + anchor.mainVolumeDescriptorSequenceExtent.location + count)
{
if(tagId == TagIdentifier.TerminatingDescriptor)
break;
@@ -316,7 +317,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)
{
byte[] sector;
@@ -326,7 +327,7 @@ namespace DiscImageChef.Filesystems
AnchorVolumeDescriptorPointer anchor = new AnchorVolumeDescriptorPointer();
// All positions where anchor may reside
ulong[] positions = { 256, 512, partitionEnd - 256, partitionEnd };
ulong[] positions = { 256, 512, partition.PartitionEndSector - 256, partition.PartitionEndSector };
foreach(ulong position in positions)
{
@@ -339,7 +340,7 @@ namespace DiscImageChef.Filesystems
if(anchor.tag.tagIdentifier == TagIdentifier.AnchorVolumeDescriptorPointer &&
anchor.tag.tagLocation == position &&
(anchor.mainVolumeDescriptorSequenceExtent.location + partitionStart) < partitionEnd)
(anchor.mainVolumeDescriptorSequenceExtent.location + partition.PartitionStartSector) < partition.PartitionEndSector)
break;
}
@@ -352,11 +353,11 @@ namespace DiscImageChef.Filesystems
while(count < 256)
{
sector = imagePlugin.ReadSector(partitionStart + anchor.mainVolumeDescriptorSequenceExtent.location + count);
sector = imagePlugin.ReadSector(partition.PartitionStartSector + anchor.mainVolumeDescriptorSequenceExtent.location + count);
TagIdentifier tagId = (TagIdentifier)BitConverter.ToUInt16(sector, 0);
uint location = BitConverter.ToUInt32(sector, 0x0C);
if(location == partitionStart + anchor.mainVolumeDescriptorSequenceExtent.location + count)
if(location == partition.PartitionStartSector + anchor.mainVolumeDescriptorSequenceExtent.location + count)
{
if(tagId == TagIdentifier.TerminatingDescriptor)
break;
@@ -420,7 +421,7 @@ namespace DiscImageChef.Filesystems
Convert.ToInt32(string.Format("{0}", lvidiu.maximumWriteUDF & 0xFF), 10));
xmlFSType.ApplicationIdentifier = CurrentEncoding.GetString(pvd.implementationIdentifier.identifier).TrimEnd(new char[] { '\u0000' });
xmlFSType.ClusterSize = (int)lvd.logicalBlockSize;
xmlFSType.Clusters = (long)(((partitionEnd - partitionStart + 1) * imagePlugin.ImageInfo.sectorSize) / (ulong)xmlFSType.ClusterSize);
xmlFSType.Clusters = (long)(((partition.PartitionEndSector - partition.PartitionStartSector + 1) * imagePlugin.ImageInfo.sectorSize) / (ulong)xmlFSType.ClusterSize);
xmlFSType.ModificationDate = ECMAToDateTime(lvid.recordingDateTime);
xmlFSType.ModificationDateSpecified = true;
xmlFSType.Files = lvidiu.files;

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -33,6 +33,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using DiscImageChef.CommonTypes;
using DiscImageChef.Console;
namespace DiscImageChef.Filesystems
@@ -49,7 +50,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.GetEncoding("iso-8859-15");
}
public BFS(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public BFS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "UNIX Boot filesystem";
PluginUUID = new Guid("1E6E0DA6-F7E4-494C-80C6-CB5929E96155");
@@ -57,24 +58,24 @@ 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;
uint magic;
magic = BitConverter.ToUInt32(imagePlugin.ReadSector(0 + partitionStart), 0);
magic = BitConverter.ToUInt32(imagePlugin.ReadSector(0 + partition.PartitionStartSector), 0);
return magic == BFS_MAGIC;
}
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 = "";
StringBuilder sb = new StringBuilder();
byte[] bfs_sb_sector = imagePlugin.ReadSector(0 + partitionStart);
byte[] bfs_sb_sector = imagePlugin.ReadSector(0 + partition.PartitionStartSector);
byte[] sb_strings = new byte[6];
BFSSuperBlock bfs_sb = new BFSSuperBlock();
@@ -110,7 +111,7 @@ namespace DiscImageChef.Filesystems
xmlFSType.Type = "BFS";
xmlFSType.VolumeName = bfs_sb.s_volume;
xmlFSType.ClusterSize = (int)imagePlugin.GetSectorSize();
xmlFSType.Clusters = (long)(partitionEnd - partitionStart + 1);
xmlFSType.Clusters = (long)(partition.PartitionEndSector - partition.PartitionStartSector + 1);
information = sb.ToString();
}

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -34,6 +34,7 @@ using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
namespace DiscImageChef.Filesystems
{
@@ -46,7 +47,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.UTF8;
}
public VMfs(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public VMfs(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "VMware filesystem";
PluginUUID = new Guid("EE52BDB8-B49C-4122-A3DA-AD21CBE79843");
@@ -89,27 +90,27 @@ namespace DiscImageChef.Filesystems
const uint VMfs_MAGIC = 0xC001D00D;
const uint VMfs_Base = 0x00100000;
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition)
{
if(partitionStart >= partitionEnd)
if(partition.PartitionStartSector >= partition.PartitionEndSector)
return false;
ulong vmfsSuperOff = VMfs_Base / imagePlugin.ImageInfo.sectorSize;
if(partitionStart + vmfsSuperOff > partitionEnd)
if(partition.PartitionStartSector + vmfsSuperOff > partition.PartitionEndSector)
return false;
byte[] sector = imagePlugin.ReadSector(partitionStart + vmfsSuperOff);
byte[] sector = imagePlugin.ReadSector(partition.PartitionStartSector + vmfsSuperOff);
uint magic = BitConverter.ToUInt32(sector, 0x00);
return magic == VMfs_MAGIC;
}
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)
{
ulong vmfsSuperOff = VMfs_Base / imagePlugin.ImageInfo.sectorSize;
byte[] sector = imagePlugin.ReadSector(partitionStart + vmfsSuperOff);
byte[] sector = imagePlugin.ReadSector(partition.PartitionStartSector + vmfsSuperOff);
VolumeInfo volInfo = new VolumeInfo();
IntPtr volInfoPtr = Marshal.AllocHGlobal(Marshal.SizeOf(volInfo));

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -34,6 +34,7 @@ using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
namespace DiscImageChef.Filesystems
{
@@ -46,7 +47,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.UTF8;
}
public VxFS(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public VxFS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "Veritas filesystem";
PluginUUID = new Guid("EC372605-7687-453C-8BEA-7E0DFF79CB03");
@@ -207,23 +208,23 @@ namespace DiscImageChef.Filesystems
const uint VxFS_MAGIC = 0xA501FCF5;
const uint VxFS_Base = 0x400;
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition)
{
if(partitionStart >= partitionEnd)
if(partition.PartitionStartSector >= partition.PartitionEndSector)
return false;
ulong vmfsSuperOff = VxFS_Base / imagePlugin.ImageInfo.sectorSize;
byte[] sector = imagePlugin.ReadSector(partitionStart + vmfsSuperOff);
byte[] sector = imagePlugin.ReadSector(partition.PartitionStartSector + vmfsSuperOff);
uint magic = BitConverter.ToUInt32(sector, 0x00);
return magic == VxFS_MAGIC;
}
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)
{
ulong vmfsSuperOff = VxFS_Base / imagePlugin.ImageInfo.sectorSize;
byte[] sector = imagePlugin.ReadSector(partitionStart + vmfsSuperOff);
byte[] sector = imagePlugin.ReadSector(partition.PartitionStartSector + vmfsSuperOff);
VxSuperBlock vxSb = new VxSuperBlock();
IntPtr vxSbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(vxSb));

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -34,6 +34,7 @@ using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
namespace DiscImageChef.Filesystems
{
@@ -110,7 +111,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.GetEncoding("iso-8859-15");
}
public XFS(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public XFS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "XFS Filesystem Plugin";
PluginUUID = new Guid("1D8CD8B8-27E6-410F-9973-D16409225FBA");
@@ -118,7 +119,7 @@ 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(imagePlugin.GetSectorSize() < 512)
return false;
@@ -129,7 +130,7 @@ namespace DiscImageChef.Filesystems
if(Marshal.SizeOf(xfsSb) % imagePlugin.GetSectorSize() != 0)
sbSize++;
byte[] sector = imagePlugin.ReadSectors(partitionStart, sbSize);
byte[] sector = imagePlugin.ReadSectors(partition.PartitionStartSector, sbSize);
if(sector.Length < Marshal.SizeOf(xfsSb))
return false;
@@ -138,7 +139,7 @@ namespace DiscImageChef.Filesystems
return xfsSb.magicnum == XFS_Magic;
}
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 = "";
if(imagePlugin.GetSectorSize() < 512)
@@ -150,7 +151,7 @@ namespace DiscImageChef.Filesystems
if(Marshal.SizeOf(xfsSb) % imagePlugin.GetSectorSize() != 0)
sbSize++;
byte[] sector = imagePlugin.ReadSectors(partitionStart, sbSize);
byte[] sector = imagePlugin.ReadSectors(partition.PartitionStartSector, sbSize);
if(sector.Length < Marshal.SizeOf(xfsSb))
return;

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -34,6 +34,7 @@ using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
namespace DiscImageChef.Filesystems
{
@@ -232,7 +233,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.UTF8;
}
public ZFS(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public ZFS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "ZFS Filesystem Plugin";
PluginUUID = new Guid("0750014F-A714-4692-A369-E23F6EC3659C");
@@ -240,7 +241,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.UTF8;
}
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition)
{
if(imagePlugin.GetSectorSize() < 512)
return false;
@@ -248,17 +249,17 @@ namespace DiscImageChef.Filesystems
byte[] sector;
ulong magic;
if(partitionStart + 31 < partitionEnd)
if(partition.PartitionStartSector + 31 < partition.PartitionEndSector)
{
sector = imagePlugin.ReadSector(partitionStart + 31);
sector = imagePlugin.ReadSector(partition.PartitionStartSector + 31);
magic = BitConverter.ToUInt64(sector, 0x1D8);
if(magic == ZEC_Magic || magic == ZEC_Cigam)
return true;
}
if(partitionStart + 16 < partitionEnd)
if(partition.PartitionStartSector + 16 < partition.PartitionEndSector)
{
sector = imagePlugin.ReadSector(partitionStart + 16);
sector = imagePlugin.ReadSector(partition.PartitionStartSector + 16);
magic = BitConverter.ToUInt64(sector, 0x1D8);
if(magic == ZEC_Magic || magic == ZEC_Cigam)
return true;
@@ -267,7 +268,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 = "";
if(imagePlugin.GetSectorSize() < 512)
@@ -280,17 +281,17 @@ namespace DiscImageChef.Filesystems
uint nvlistLen = 114688 / imagePlugin.ImageInfo.sectorSize;
byte[] nvlist;
if(partitionStart + 31 < partitionEnd)
if(partition.PartitionStartSector + 31 < partition.PartitionEndSector)
{
sector = imagePlugin.ReadSector(partitionStart + 31);
sector = imagePlugin.ReadSector(partition.PartitionStartSector + 31);
magic = BitConverter.ToUInt64(sector, 0x1D8);
if(magic == ZEC_Magic || magic == ZEC_Cigam)
nvlistOff = 32;
}
if(partitionStart + 16 < partitionEnd)
if(partition.PartitionStartSector + 16 < partition.PartitionEndSector)
{
sector = imagePlugin.ReadSector(partitionStart + 16);
sector = imagePlugin.ReadSector(partition.PartitionStartSector + 16);
magic = BitConverter.ToUInt64(sector, 0x1D8);
if(magic == ZEC_Magic || magic == ZEC_Cigam)
nvlistOff = 17;
@@ -299,7 +300,7 @@ namespace DiscImageChef.Filesystems
StringBuilder sb = new StringBuilder();
sb.AppendLine("ZFS filesystem");
nvlist = imagePlugin.ReadSectors(partitionStart + nvlistOff, nvlistLen);
nvlist = imagePlugin.ReadSectors(partition.PartitionStartSector + nvlistOff, nvlistLen);
Dictionary<string, NVS_Item> decodedNvList;
if(!DecodeNvList(nvlist, out decodedNvList))

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -35,6 +35,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
using DiscImageChef.ImagePlugins;
namespace DiscImageChef.Filesystems
@@ -49,7 +50,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.GetEncoding("iso-8859-15");
}
public exFAT(ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public exFAT(ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "Microsoft Extended File Allocation Table";
PluginUUID = new Guid("8271D088-1533-4CB3-AC28-D802B68BB95C");
@@ -57,12 +58,12 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.GetEncoding("iso-8859-15");
}
public override bool Identify(ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
public override bool Identify(ImagePlugin imagePlugin, Partition partition)
{
if((12 + partitionStart) >= partitionEnd)
if((12 + partition.PartitionStartSector) >= partition.PartitionEndSector)
return false;
byte[] vbrSector = imagePlugin.ReadSector(0 + partitionStart);
byte[] vbrSector = imagePlugin.ReadSector(0 + partition.PartitionStartSector);
if(vbrSector.Length < 512)
return false;
@@ -75,28 +76,28 @@ namespace DiscImageChef.Filesystems
return Signature.SequenceEqual(vbr.signature);
}
public override void GetInformation(ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, out string information)
public override void GetInformation(ImagePlugin imagePlugin, Partition partition, out string information)
{
information = "";
StringBuilder sb = new StringBuilder();
xmlFSType = new Schemas.FileSystemType();
byte[] vbrSector = imagePlugin.ReadSector(0 + partitionStart);
byte[] vbrSector = imagePlugin.ReadSector(0 + partition.PartitionStartSector);
VolumeBootRecord vbr = new VolumeBootRecord();
IntPtr vbrPtr = Marshal.AllocHGlobal(512);
Marshal.Copy(vbrSector, 0, vbrPtr, 512);
vbr = (VolumeBootRecord)Marshal.PtrToStructure(vbrPtr, typeof(VolumeBootRecord));
Marshal.FreeHGlobal(vbrPtr);
byte[] parametersSector = imagePlugin.ReadSector(9 + partitionStart);
byte[] parametersSector = imagePlugin.ReadSector(9 + partition.PartitionStartSector);
OemParameterTable parametersTable = new OemParameterTable();
IntPtr parametersPtr = Marshal.AllocHGlobal(512);
Marshal.Copy(parametersSector, 0, parametersPtr, 512);
parametersTable = (OemParameterTable)Marshal.PtrToStructure(parametersPtr, typeof(OemParameterTable));
Marshal.FreeHGlobal(parametersPtr);
byte[] chkSector = imagePlugin.ReadSector(11 + partitionStart);
byte[] chkSector = imagePlugin.ReadSector(11 + partition.PartitionStartSector);
ChecksumSector chksector = new ChecksumSector();
IntPtr chkPtr = Marshal.AllocHGlobal(512);
Marshal.Copy(chkSector, 0, chkPtr, 512);

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -31,9 +31,10 @@
// ****************************************************************************/
using System;
using System.Text;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
namespace DiscImageChef.Filesystems
{
@@ -47,7 +48,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.GetEncoding("iso-8859-15");
}
public ext2FS(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public ext2FS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "Linux extended Filesystem 2, 3 and 4";
PluginUUID = new Guid("6AA91B88-150B-4A7B-AD56-F84FB2DF4184");
@@ -55,12 +56,12 @@ 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;
byte[] sb_sector = imagePlugin.ReadSector(2 + partitionStart);
byte[] sb_sector = imagePlugin.ReadSector(2 + partition.PartitionStartSector);
ushort magic = BitConverter.ToUInt16(sb_sector, 0x038);
@@ -69,7 +70,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 = "";
@@ -97,7 +98,7 @@ namespace DiscImageChef.Filesystems
return;
}
byte[] sb_sector = imagePlugin.ReadSectors(2 + partitionStart, sb_size_in_sectors);
byte[] sb_sector = imagePlugin.ReadSectors(2 + partition.PartitionStartSector, sb_size_in_sectors);
IntPtr sbPtr = Marshal.AllocHGlobal(512);
Marshal.Copy(sb_sector, 0, sbPtr, 512);
supblk = (ext2FSSuperBlock)Marshal.PtrToStructure(sbPtr, typeof(ext2FSSuperBlock));

View File

@@ -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
{
@@ -46,7 +47,7 @@ namespace DiscImageChef.Filesystems
CurrentEncoding = Encoding.GetEncoding("iso-8859-15");
}
public extFS(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
public extFS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "Linux extended Filesystem";
PluginUUID = new Guid("076CB3A2-08C2-4D69-BC8A-FCAA2E502BE2");
@@ -54,25 +55,25 @@ 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;
byte[] sb_sector = imagePlugin.ReadSector(2 + partitionStart); // Superblock resides at 0x400
byte[] sb_sector = imagePlugin.ReadSector(2 + partition.PartitionStartSector); // Superblock resides at 0x400
ushort magic = BitConverter.ToUInt16(sb_sector, 0x038); // Here should reside magic number
return magic == extFSMagic;
}
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 = "";
StringBuilder sb = new StringBuilder();
byte[] sb_sector = imagePlugin.ReadSector(2 + partitionStart); // Superblock resides at 0x400
byte[] sb_sector = imagePlugin.ReadSector(2 + partition.PartitionStartSector); // Superblock resides at 0x400
extFSSuperBlock ext_sb = new extFSSuperBlock();
ext_sb.inodes = BitConverter.ToUInt32(sb_sector, 0x000);
@@ -100,7 +101,7 @@ namespace DiscImageChef.Filesystems
xmlFSType.FreeClusters = ext_sb.freecountblk;
xmlFSType.FreeClustersSpecified = true;
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();
}

View File

@@ -102,8 +102,14 @@ namespace DiscImageChef.Tests.Filesystems
Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]);
Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]);
Filesystem fs = new AcornADFS();
Assert.AreEqual(true, fs.Identify(image, 0, image.ImageInfo.sectors - 1), testfiles[i]);
fs.GetInformation(image, 0, image.ImageInfo.sectors - 1, out string information);
Partition wholePart = new Partition
{
PartitionName = "Whole device",
PartitionSectors = image.ImageInfo.sectors,
PartitionLength = image.ImageInfo.sectors * image.ImageInfo.sectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]);
fs.GetInformation(image, wholePart, out string information);
Assert.AreEqual(bootable[i], fs.XmlFSType.Bootable, testfiles[i]);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);

View File

@@ -93,8 +93,14 @@ namespace DiscImageChef.Tests.Filesystems
Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]);
Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]);
Filesystem fs = new AmigaDOSPlugin();
Assert.AreEqual(true, fs.Identify(image, 0, image.ImageInfo.sectors - 1), testfiles[i]);
fs.GetInformation(image, 0, image.ImageInfo.sectors - 1, out string information);
Partition wholePart = new Partition
{
PartitionName = "Whole device",
PartitionSectors = image.ImageInfo.sectors,
PartitionLength = image.ImageInfo.sectors * image.ImageInfo.sectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]);
fs.GetInformation(image, wholePart, out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("Amiga FFS", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -103,8 +103,8 @@ namespace DiscImageChef.Tests.Filesystems
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
fs.GetInformation(image, partitions[part], out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("Amiga FFS2", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -103,8 +103,8 @@ namespace DiscImageChef.Tests.Filesystems
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
fs.GetInformation(image, partitions[part], out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("Amiga FFS", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -105,8 +105,8 @@ namespace DiscImageChef.Tests.Filesystems
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
fs.GetInformation(image, partitions[part], out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("Amiga FFS", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -110,8 +110,8 @@ namespace DiscImageChef.Tests.Filesystems
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
fs.GetInformation(image, partitions[part], out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("Amiga FFS", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -93,8 +93,14 @@ namespace DiscImageChef.Tests.Filesystems
Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]);
Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]);
Filesystem fs = new AmigaDOSPlugin();
Assert.AreEqual(true, fs.Identify(image, 0, image.ImageInfo.sectors - 1), testfiles[i]);
fs.GetInformation(image, 0, image.ImageInfo.sectors - 1, out string information);
Partition wholePart = new Partition
{
PartitionName = "Whole device",
PartitionSectors = image.ImageInfo.sectors,
PartitionLength = image.ImageInfo.sectors * image.ImageInfo.sectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]);
fs.GetInformation(image, wholePart, out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("Amiga OFS", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -103,8 +103,8 @@ namespace DiscImageChef.Tests.Filesystems
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
fs.GetInformation(image, partitions[part], out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("Amiga OFS", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -105,8 +105,8 @@ namespace DiscImageChef.Tests.Filesystems
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
fs.GetInformation(image, partitions[part], out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("Amiga OFS", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -103,8 +103,8 @@ namespace DiscImageChef.Tests.Filesystems
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
fs.GetInformation(image, partitions[part], out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("Amiga OFS", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -105,8 +105,8 @@ namespace DiscImageChef.Tests.Filesystems
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
fs.GetInformation(image, partitions[part], out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("Atheros", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -97,8 +97,14 @@ namespace DiscImageChef.Tests.Filesystems
Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]);
Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]);
Filesystem fs = new DiscImageChef.Filesystems.BeFS();
Assert.AreEqual(true, fs.Identify(image, 0, image.ImageInfo.sectors - 1), testfiles[i]);
fs.GetInformation(image, 0, image.ImageInfo.sectors - 1, out string information);
Partition wholePart = new Partition
{
PartitionName = "Whole device",
PartitionSectors = image.ImageInfo.sectors,
PartitionLength = image.ImageInfo.sectors * image.ImageInfo.sectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]);
fs.GetInformation(image, wholePart, out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("BeFS", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -107,8 +107,8 @@ namespace DiscImageChef.Tests.Filesystems
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
fs.GetInformation(image, partitions[part], out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("BeFS", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -103,8 +103,8 @@ namespace DiscImageChef.Tests.Filesystems
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
fs.GetInformation(image, partitions[part], out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("BeFS", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -103,8 +103,8 @@ namespace DiscImageChef.Tests.Filesystems
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
fs.GetInformation(image, partitions[part], out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("BeFS", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -103,8 +103,8 @@ namespace DiscImageChef.Tests.Filesystems
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
fs.GetInformation(image, partitions[part], out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("F2FS filesystem", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -1643,8 +1643,14 @@ namespace DiscImageChef.Tests.Filesystems
Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]);
Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]);
Filesystem fs = new FAT();
Assert.AreEqual(true, fs.Identify(image, 0, image.ImageInfo.sectors - 1), testfiles[i]);
fs.GetInformation(image, 0, image.ImageInfo.sectors - 1, out string information);
Partition wholePart = new Partition
{
PartitionName = "Whole device",
PartitionSectors = image.ImageInfo.sectors,
PartitionLength = image.ImageInfo.sectors * image.ImageInfo.sectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]);
fs.GetInformation(image, wholePart, out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("FAT12", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -107,8 +107,8 @@ namespace DiscImageChef.Tests.Filesystems
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
fs.GetInformation(image, partitions[part], out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("FAT12", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -107,8 +107,8 @@ namespace DiscImageChef.Tests.Filesystems
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
fs.GetInformation(image, partitions[part], out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("FAT12", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
@@ -217,8 +217,8 @@ namespace DiscImageChef.Tests.Filesystems
PartPlugin parts = new MBR();
Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]);
Filesystem fs = new FAT();
Assert.AreEqual(true, fs.Identify(image, partitions[0].PartitionStartSector, partitions[0].PartitionStartSector + partitions[0].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[0].PartitionStartSector, partitions[0].PartitionStartSector + partitions[0].PartitionSectors - 1, out string information);
Assert.AreEqual(true, fs.Identify(image, partitions[0]), testfiles[i]);
fs.GetInformation(image, partitions[0], out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("FAT12", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -124,8 +124,14 @@ namespace DiscImageChef.Tests.Filesystems
Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]);
Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]);
Filesystem fs = new FAT();
Assert.AreEqual(true, fs.Identify(image, 0, image.ImageInfo.sectors - 1), testfiles[i]);
fs.GetInformation(image, 0, image.ImageInfo.sectors - 1, out string information);
Partition wholePart = new Partition
{
PartitionName = "Whole device",
PartitionSectors = image.ImageInfo.sectors,
PartitionLength = image.ImageInfo.sectors * image.ImageInfo.sectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]);
fs.GetInformation(image, wholePart, out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("FAT16", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -107,8 +107,8 @@ namespace DiscImageChef.Tests.Filesystems
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
fs.GetInformation(image, partitions[part], out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("FAT16", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -107,8 +107,8 @@ namespace DiscImageChef.Tests.Filesystems
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
fs.GetInformation(image, partitions[part], out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("FAT16", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -107,8 +107,8 @@ namespace DiscImageChef.Tests.Filesystems
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
fs.GetInformation(image, partitions[part], out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("FAT16", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -217,8 +217,8 @@ namespace DiscImageChef.Tests.Filesystems
PartPlugin parts = new MBR();
Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]);
Filesystem fs = new FAT();
Assert.AreEqual(true, fs.Identify(image, partitions[0].PartitionStartSector, partitions[0].PartitionStartSector + partitions[0].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[0].PartitionStartSector, partitions[0].PartitionStartSector + partitions[0].PartitionSectors - 1, out string information);
Assert.AreEqual(true, fs.Identify(image, partitions[0]), testfiles[i]);
fs.GetInformation(image, partitions[0], out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("FAT16", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -110,8 +110,8 @@ namespace DiscImageChef.Tests.Filesystems
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
fs.GetInformation(image, partitions[part], out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("Amiga FFS", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -107,8 +107,8 @@ namespace DiscImageChef.Tests.Filesystems
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
fs.GetInformation(image, partitions[part], out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("FAT32", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -107,8 +107,8 @@ namespace DiscImageChef.Tests.Filesystems
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
fs.GetInformation(image, partitions[part], out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("FAT32", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -129,8 +129,8 @@ namespace DiscImageChef.Tests.Filesystems
PartPlugin parts = new MBR();
Assert.AreEqual(true, parts.GetInformation(image, out List<Partition> partitions), testfiles[i]);
Filesystem fs = new FAT();
Assert.AreEqual(true, fs.Identify(image, partitions[0].PartitionStartSector, partitions[0].PartitionStartSector + partitions[0].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[0].PartitionStartSector, partitions[0].PartitionStartSector + partitions[0].PartitionSectors - 1, out string information);
Assert.AreEqual(true, fs.Identify(image, partitions[0]), testfiles[i]);
fs.GetInformation(image, partitions[0], out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("FAT32", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -106,8 +106,8 @@ namespace DiscImageChef.Tests.Filesystems
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
fs.GetInformation(image, partitions[part], out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("HAMMER", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -101,8 +101,14 @@ namespace DiscImageChef.Tests.Filesystems
Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]);
Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]);
Filesystem fs = new AppleHFS();
Assert.AreEqual(true, fs.Identify(image, 0, image.ImageInfo.sectors - 1), testfiles[i]);
fs.GetInformation(image, 0, image.ImageInfo.sectors - 1, out string information);
Partition wholePart = new Partition
{
PartitionName = "Whole device",
PartitionSectors = image.ImageInfo.sectors,
PartitionLength = image.ImageInfo.sectors * image.ImageInfo.sectorSize
};
Assert.AreEqual(true, fs.Identify(image, wholePart), testfiles[i]);
fs.GetInformation(image, wholePart, out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("HFS", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -148,8 +148,8 @@ namespace DiscImageChef.Tests.Filesystems
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
fs.GetInformation(image, partitions[part], out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("HFS+", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -107,8 +107,8 @@ namespace DiscImageChef.Tests.Filesystems
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
fs.GetInformation(image, partitions[part], out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("HFS+", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -132,8 +132,8 @@ namespace DiscImageChef.Tests.Filesystems
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
fs.GetInformation(image, partitions[part], out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("HFS+", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -115,8 +115,8 @@ namespace DiscImageChef.Tests.Filesystems
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
fs.GetInformation(image, partitions[part], out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("HFSX", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -107,8 +107,8 @@ namespace DiscImageChef.Tests.Filesystems
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
fs.GetInformation(image, partitions[part], out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("HFSX", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -115,8 +115,8 @@ namespace DiscImageChef.Tests.Filesystems
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
fs.GetInformation(image, partitions[part], out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("HFSX", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -166,8 +166,8 @@ namespace DiscImageChef.Tests.Filesystems
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
fs.GetInformation(image, partitions[part], out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("HFS", fs.XmlFSType.Type, testfiles[i]);

View File

@@ -116,8 +116,8 @@ namespace DiscImageChef.Tests.Filesystems
}
}
Assert.AreNotEqual(-1, part, "Partition not found");
Assert.AreEqual(true, fs.Identify(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1), testfiles[i]);
fs.GetInformation(image, partitions[part].PartitionStartSector, partitions[part].PartitionStartSector + partitions[part].PartitionSectors - 1, out string information);
Assert.AreEqual(true, fs.Identify(image, partitions[part]), testfiles[i]);
fs.GetInformation(image, partitions[part], out string information);
Assert.AreEqual(clusters[i], fs.XmlFSType.Clusters, testfiles[i]);
Assert.AreEqual(clustersize[i], fs.XmlFSType.ClusterSize, testfiles[i]);
Assert.AreEqual("HFS", fs.XmlFSType.Type, testfiles[i]);

Some files were not shown because too many files have changed in this diff Show More