diff --git a/DiscImageChef.Core/Devices/Dumping/ATA.cs b/DiscImageChef.Core/Devices/Dumping/ATA.cs index 02f3b3b0..ee421a41 100644 --- a/DiscImageChef.Core/Devices/Dumping/ATA.cs +++ b/DiscImageChef.Core/Devices/Dumping/ATA.cs @@ -452,17 +452,8 @@ namespace DiscImageChef.Core.Devices.Dumping if(_imageFormat != null) { - List partitions = new List(); - - foreach(PartPlugin _partplugin in plugins.PartPluginsList.Values) - { - - if(_partplugin.GetInformation(_imageFormat, out List _partitions)) - { - partitions.AddRange(_partitions); - Statistics.AddPartition(_partplugin.Name); - } - } + List partitions = Partitions.GetAll(_imageFormat); + Partitions.AddSchemesToStats(partitions); if(partitions.Count > 0) { diff --git a/DiscImageChef.Core/Devices/Dumping/SBC.cs b/DiscImageChef.Core/Devices/Dumping/SBC.cs index e87d220f..601ec9da 100644 --- a/DiscImageChef.Core/Devices/Dumping/SBC.cs +++ b/DiscImageChef.Core/Devices/Dumping/SBC.cs @@ -604,17 +604,8 @@ namespace DiscImageChef.Core.Devices.Dumping if(_imageFormat != null) { - List partitions = new List(); - - foreach(PartPlugin _partplugin in plugins.PartPluginsList.Values) - { - - if(_partplugin.GetInformation(_imageFormat, out List _partitions)) - { - partitions.AddRange(_partitions); - Statistics.AddPartition(_partplugin.Name); - } - } + List partitions = Partitions.GetAll(_imageFormat); + Partitions.AddSchemesToStats(partitions); if(partitions.Count > 0) { diff --git a/DiscImageChef.Core/Devices/Dumping/XGD.cs b/DiscImageChef.Core/Devices/Dumping/XGD.cs index 60e8c390..91271215 100644 --- a/DiscImageChef.Core/Devices/Dumping/XGD.cs +++ b/DiscImageChef.Core/Devices/Dumping/XGD.cs @@ -760,17 +760,8 @@ namespace DiscImageChef.Core.Devices.Dumping if(_imageFormat != null) { - List partitions = new List(); - - foreach(PartPlugin _partplugin in plugins.PartPluginsList.Values) - { - - if(_partplugin.GetInformation(_imageFormat, out List _partitions)) - { - partitions.AddRange(_partitions); - Statistics.AddPartition(_partplugin.Name); - } - } + List partitions = Partitions.GetAll(_imageFormat); + Partitions.AddSchemesToStats(partitions); if(partitions.Count > 0) { diff --git a/DiscImageChef.Core/DiscImageChef.Core.csproj b/DiscImageChef.Core/DiscImageChef.Core.csproj index f373b6c8..5f5f9deb 100644 --- a/DiscImageChef.Core/DiscImageChef.Core.csproj +++ b/DiscImageChef.Core/DiscImageChef.Core.csproj @@ -79,6 +79,7 @@ + @@ -155,7 +156,7 @@ - + diff --git a/DiscImageChef.Core/Partitions.cs b/DiscImageChef.Core/Partitions.cs new file mode 100644 index 00000000..0d87f1ea --- /dev/null +++ b/DiscImageChef.Core/Partitions.cs @@ -0,0 +1,145 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : Partitions.cs +// Version : 1.0 +// Author(s) : Natalia Portillo +// +// Component : Component +// +// Revision : $Revision$ +// Last change by : $Author$ +// Date : $Date$ +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ License ] -------------------------------------------------------------- +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// ---------------------------------------------------------------------------- +// Copyright (C) 2011-2015 Claunia.com +// ****************************************************************************/ +// //$Id$ +using System; +using System.Collections.Generic; +using DiscImageChef.CommonTypes; +using DiscImageChef.ImagePlugins; +using DiscImageChef.PartPlugins; +using System.Linq; +using System.Net; +using DiscImageChef.Console; + +namespace DiscImageChef.Core +{ + public static class Partitions + { + public static List GetAll(ImagePlugin image) + { + PluginBase plugins = new PluginBase(); + plugins.RegisterAllPlugins(); + List partitions = new List(); + List childPartitions = new List(); + + // Getting all partitions from device (e.g. tracks) + if(image.ImageInfo.imageHasPartitions) + { + foreach(Partition imagePartition in image.GetPartitions()) + { + foreach(PartPlugin _partplugin in plugins.PartPluginsList.Values) + { + if(_partplugin.GetInformation(image, out List _partitions, imagePartition.Start)) + partitions.AddRange(_partitions); + } + } + } + // Getting all partitions at start of device + else + { + foreach(PartPlugin _partplugin in plugins.PartPluginsList.Values) + { + if(_partplugin.GetInformation(image, out List _partitions, 0)) + partitions.AddRange(_partitions); + } + } + + while(partitions.Count > 0) + { + List childs = new List(); + + foreach(PartPlugin _partplugin in plugins.PartPluginsList.Values) + { + DicConsole.DebugWriteLine("Partitions", "Trying {0} @ {1}", _partplugin.Name, partitions[0].Start); + if(_partplugin.GetInformation(image, out List _partitions, partitions[0].Start)) + childs.AddRange(_partitions); + } + + DicConsole.DebugWriteLine("Partitions", "Got {0} childs", childs.Count); + + if(childs.Count > 0) + { + Partition father = partitions[0]; + + partitions.RemoveAt(0); + + foreach(Partition child in childs) + { + if(child.Start == father.Start) + childPartitions.Add(father); + else + { + if(!partitions.Contains(child)) + partitions.Add(child); + } + } + } + else + { + childPartitions.Add(partitions[0]); + partitions.RemoveAt(0); + } + + DicConsole.DebugWriteLine("Partitions", "Got {0} parents", partitions.Count); + DicConsole.DebugWriteLine("Partitions", "Got {0} partitions", childPartitions.Count); + } + + Partition[] childArray = childPartitions.OrderBy(part => part.Start).ThenBy(part => part.Length).ThenBy(part => part.Scheme).ToArray(); + + for(long i = 0; i < childArray.LongLength; i++) + childArray[i].Sequence = (ulong)i; + + return childArray.ToList(); + } + + public static void AddSchemesToStats(List partitions) + { + if(partitions == null || partitions.Count == 0) + return; + + List schemes = new List(); + + foreach(Partition part in partitions) + { + if(!schemes.Contains(part.Scheme)) + schemes.Add(part.Scheme); + } + + foreach(string scheme in schemes) + Statistics.AddPartition(scheme); + } + } +} diff --git a/DiscImageChef.Core/Sidecar.cs b/DiscImageChef.Core/Sidecar.cs index 7b522f22..dd38b637 100644 --- a/DiscImageChef.Core/Sidecar.cs +++ b/DiscImageChef.Core/Sidecar.cs @@ -533,18 +533,8 @@ namespace DiscImageChef.Core UpdateStatus("Checking filesystems on track {0} from sector {1} to {2}", xmlTrk.Sequence.TrackNumber, xmlTrk.StartSector, xmlTrk.EndSector); - List partitions = new List(); - - foreach(PartPlugin _partplugin in plugins.PartPluginsList.Values) - { - List _partitions; - - if(_partplugin.GetInformation(image, out _partitions)) - { - partitions.AddRange(_partitions); - Statistics.AddPartition(_partplugin.Name); - } - } + List partitions = Partitions.GetAll(image); + Partitions.AddSchemesToStats(partitions); xmlTrk.FileSystemInformation = new PartitionType[1]; if(partitions.Count > 0) @@ -855,19 +845,8 @@ namespace DiscImageChef.Core UpdateStatus("Checking filesystems..."); - List partitions = new List(); - - foreach(PartPlugin _partplugin in plugins.PartPluginsList.Values) - { - List _partitions; - - if(_partplugin.GetInformation(image, out _partitions)) - { - partitions = _partitions; - Statistics.AddPartition(_partplugin.Name); - break; - } - } + List partitions = Partitions.GetAll(image); + Partitions.AddSchemesToStats(partitions); sidecar.BlockMedia[0].FileSystemInformation = new PartitionType[1]; if(partitions.Count > 0) diff --git a/DiscImageChef.Partitions/Acorn.cs b/DiscImageChef.Partitions/Acorn.cs index 14773ceb..8fbf572b 100644 --- a/DiscImageChef.Partitions/Acorn.cs +++ b/DiscImageChef.Partitions/Acorn.cs @@ -56,12 +56,16 @@ namespace DiscImageChef.PartPlugins PluginUUID = new Guid("A7C8FEBE-8D00-4933-B9F3-42184C8BA808"); } - public override bool GetInformation(ImagePlugin imagePlugin, out List partitions) + public override bool GetInformation(ImagePlugin imagePlugin, out List partitions, ulong sectorOffset) { partitions = new List(); ulong sbSector; + // RISC OS always checks for the partition on 0. Afaik no emulator chains it. + if(sectorOffset != 0) + return false; + if(imagePlugin.GetSectorSize() > ADFS_SB_POS) sbSector = 0; else diff --git a/DiscImageChef.Partitions/AppleMap.cs b/DiscImageChef.Partitions/AppleMap.cs index a7dc7476..742ce9b3 100644 --- a/DiscImageChef.Partitions/AppleMap.cs +++ b/DiscImageChef.Partitions/AppleMap.cs @@ -57,7 +57,7 @@ namespace DiscImageChef.PartPlugins PluginUUID = new Guid("36405F8D-4F1A-07F5-209C-223D735D6D22"); } - public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List partitions) + public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List partitions, ulong sectorOffset) { uint sector_size; @@ -68,7 +68,7 @@ namespace DiscImageChef.PartPlugins partitions = new List(); - byte[] ddm_sector = imagePlugin.ReadSector(0); + byte[] ddm_sector = imagePlugin.ReadSector(sectorOffset); AppleDriverDescriptorMap ddm; ushort max_drivers = 61; @@ -132,7 +132,7 @@ namespace DiscImageChef.PartPlugins } } - byte[] part_sector = imagePlugin.ReadSector(1); + byte[] part_sector = imagePlugin.ReadSector(1 + sectorOffset); AppleOldDevicePartitionMap old_map = BigEndianMarshal.ByteArrayToStructureBigEndian(part_sector); // This is the easy one, no sector size mixing @@ -228,7 +228,7 @@ namespace DiscImageChef.PartPlugins return partitions.Count > 0; } - byte[] entries = imagePlugin.ReadSectors(0, sectors_to_read); + byte[] entries = imagePlugin.ReadSectors(sectorOffset, sectors_to_read); DicConsole.DebugWriteLine("AppleMap Plugin", "entry_size = {0}", entry_size); DicConsole.DebugWriteLine("AppleMap Plugin", "entry_count = {0}", entry_count); DicConsole.DebugWriteLine("AppleMap Plugin", "skip_ddm = {0}", skip_ddm); diff --git a/DiscImageChef.Partitions/Atari.cs b/DiscImageChef.Partitions/Atari.cs index 7383c064..364dcff3 100644 --- a/DiscImageChef.Partitions/Atari.cs +++ b/DiscImageChef.Partitions/Atari.cs @@ -58,7 +58,7 @@ namespace DiscImageChef.PartPlugins PluginUUID = new Guid("d1dd0f24-ec39-4c4d-9072-be31919a3b5e"); } - public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List partitions) + public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List partitions, ulong sectorOffset) { partitions = new List(); @@ -67,7 +67,7 @@ namespace DiscImageChef.PartPlugins BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; - byte[] sector = imagePlugin.ReadSector(0); + byte[] sector = imagePlugin.ReadSector(sectorOffset); AtariTable table = new AtariTable(); table.boot = new byte[342]; diff --git a/DiscImageChef.Partitions/BSD.cs b/DiscImageChef.Partitions/BSD.cs index 39389d52..f8a31c71 100644 --- a/DiscImageChef.Partitions/BSD.cs +++ b/DiscImageChef.Partitions/BSD.cs @@ -48,11 +48,11 @@ namespace DiscImageChef.PartPlugins PluginUUID = new Guid("246A6D93-4F1A-1F8A-344D-50187A5513A9"); } - public override bool GetInformation(ImagePlugin imagePlugin, out List partitions) + public override bool GetInformation(ImagePlugin imagePlugin, out List partitions, ulong sectorOffset) { partitions = new List(); - byte[] sector = imagePlugin.ReadSector(0); + byte[] sector = imagePlugin.ReadSector(sectorOffset); if(sector.Length < 512) return false; bool found = false; @@ -63,7 +63,7 @@ namespace DiscImageChef.PartPlugins found = true; else { - sector = imagePlugin.ReadSector(1); + sector = imagePlugin.ReadSector(1 + sectorOffset); dl = GetDiskLabel(sector); diff --git a/DiscImageChef.Partitions/DEC.cs b/DiscImageChef.Partitions/DEC.cs index 1515868a..83b9ae94 100644 --- a/DiscImageChef.Partitions/DEC.cs +++ b/DiscImageChef.Partitions/DEC.cs @@ -49,11 +49,14 @@ namespace DiscImageChef.PartPlugins PluginUUID = new Guid("58CEC3B7-3B93-4D47-86EE-D6DADE9D444F"); } - public override bool GetInformation(ImagePlugin imagePlugin, out List partitions) + public override bool GetInformation(ImagePlugin imagePlugin, out List partitions, ulong sectorOffset) { partitions = new List(); - byte[] sector = imagePlugin.ReadSector(31); + if(31 + sectorOffset >= imagePlugin.GetSectors()) + return false; + + byte[] sector = imagePlugin.ReadSector(31 + sectorOffset); if(sector.Length < 512) return false; diff --git a/DiscImageChef.Partitions/DragonFlyBSD.cs b/DiscImageChef.Partitions/DragonFlyBSD.cs index 7f0cb951..0ac7b40d 100644 --- a/DiscImageChef.Partitions/DragonFlyBSD.cs +++ b/DiscImageChef.Partitions/DragonFlyBSD.cs @@ -48,12 +48,15 @@ namespace DiscImageChef.PartPlugins PluginUUID = new Guid("D49E41A6-D952-4760-9D94-03DAE2450C5F"); } - public override bool GetInformation(ImagePlugin imagePlugin, out List partitions) + public override bool GetInformation(ImagePlugin imagePlugin, out List partitions, ulong sectorOffset) { partitions = new List(); uint nSectors = 2048 / imagePlugin.GetSectorSize(); - byte[] sectors = imagePlugin.ReadSectors(0, nSectors); + if(sectorOffset + nSectors >= imagePlugin.GetSectors()) + return false; + + byte[] sectors = imagePlugin.ReadSectors(sectorOffset, nSectors); if(sectors.Length < 2048) return false; diff --git a/DiscImageChef.Partitions/GPT.cs b/DiscImageChef.Partitions/GPT.cs index 6fcb1cfe..97f9ccee 100644 --- a/DiscImageChef.Partitions/GPT.cs +++ b/DiscImageChef.Partitions/GPT.cs @@ -48,11 +48,11 @@ namespace DiscImageChef.PartPlugins PluginUUID = new Guid("CBC9D281-C1D0-44E8-9038-4D66FD2678AB"); } - public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List partitions) + public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List partitions, ulong sectorOffset) { partitions = new List(); - byte[] hdrBytes = imagePlugin.ReadSector(1); + byte[] hdrBytes = imagePlugin.ReadSector(1 + sectorOffset); GptHeader hdr; try diff --git a/DiscImageChef.Partitions/Human68k.cs b/DiscImageChef.Partitions/Human68k.cs index 1692b993..9c95d1cf 100644 --- a/DiscImageChef.Partitions/Human68k.cs +++ b/DiscImageChef.Partitions/Human68k.cs @@ -50,7 +50,7 @@ namespace DiscImageChef.PartPlugins PluginUUID = new Guid("246A6D93-4F1A-1F8A-344D-50187A5513A9"); } - public override bool GetInformation(ImagePlugin imagePlugin, out List partitions) + public override bool GetInformation(ImagePlugin imagePlugin, out List partitions, ulong sectorOffset) { partitions = new List(); @@ -59,18 +59,21 @@ namespace DiscImageChef.PartPlugins DicConsole.DebugWriteLine("Human68k plugin", "sectorSize = {0}", imagePlugin.GetSectorSize()); + if(sectorOffset + 4 >= imagePlugin.GetSectors()) + return false; + switch(imagePlugin.GetSectorSize()) { case 256: - sector = imagePlugin.ReadSector(4); + sector = imagePlugin.ReadSector(4 + sectorOffset); sectsPerUnit = 1; break; case 512: - sector = imagePlugin.ReadSector(4); + sector = imagePlugin.ReadSector(4 + sectorOffset); sectsPerUnit = 2; break; case 1024: - sector = imagePlugin.ReadSector(2); + sector = imagePlugin.ReadSector(2 + sectorOffset); sectsPerUnit = 1; break; default: @@ -79,13 +82,14 @@ namespace DiscImageChef.PartPlugins X68kTable table = BigEndianMarshal.ByteArrayToStructureBigEndian(sector); + DicConsole.DebugWriteLine("Human68k plugin", "table.magic = {0:X4}", table.magic); + if(table.magic != X68kMagic) return false; for(int i = 0; i < table.entries.Length; i++) table.entries[i] = BigEndianMarshal.SwapStructureMembersEndian(table.entries[i]); - DicConsole.DebugWriteLine("Human68k plugin", "table.signature = {0:X4}", table.magic); DicConsole.DebugWriteLine("Human68k plugin", "table.size = {0:X4}", table.size); DicConsole.DebugWriteLine("Human68k plugin", "table.size2 = {0:X4}", table.size2); DicConsole.DebugWriteLine("Human68k plugin", "table.unknown = {0:X4}", table.unknown); diff --git a/DiscImageChef.Partitions/MBR.cs b/DiscImageChef.Partitions/MBR.cs index 0b8807e1..5d70593b 100644 --- a/DiscImageChef.Partitions/MBR.cs +++ b/DiscImageChef.Partitions/MBR.cs @@ -46,7 +46,7 @@ namespace DiscImageChef.PartPlugins PluginUUID = new Guid("5E8A34E8-4F1A-59E6-4BF7-7EA647063A76"); } - public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List partitions) + public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List partitions, ulong sectorOffset) { ulong counter = 0; @@ -65,7 +65,7 @@ namespace DiscImageChef.PartPlugins divider = 4; } - byte[] sector = imagePlugin.ReadSector(0); + byte[] sector = imagePlugin.ReadSector(sectorOffset); GCHandle handle = GCHandle.Alloc(sector, GCHandleType.Pinned); MasterBootRecord mbr = (MasterBootRecord)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(MasterBootRecord)); @@ -76,6 +76,8 @@ namespace DiscImageChef.PartPlugins DiskManagerMasterBootRecord mbr_ontrack = (DiskManagerMasterBootRecord)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(DiskManagerMasterBootRecord)); handle.Free(); + DicConsole.DebugWriteLine("MBR plugin", "mbr.magic = {0:X4}", mbr.magic); + if(mbr.magic != MBR_Magic) return false; // Not MBR @@ -152,7 +154,7 @@ namespace DiscImageChef.PartPlugins CommonTypes.Partition part = new CommonTypes.Partition(); if(lba_start > 0 && lba_sectors > 0) { - part.Start = entry.lba_start; + part.Start = entry.lba_start + sectorOffset; part.Length = entry.lba_sectors; part.Offset = part.Start * sectorSize; part.Size = part.Length * sectorSize; @@ -251,7 +253,7 @@ namespace DiscImageChef.PartPlugins CommonTypes.Partition part = new CommonTypes.Partition(); if(ext_start > 0 && ext_sectors > 0) { - part.Start = ext_start; + part.Start = ext_start + sectorOffset; part.Length = ext_sectors; part.Offset = part.Start * sectorSize; part.Size = part.Length * sectorSize; diff --git a/DiscImageChef.Partitions/NeXT.cs b/DiscImageChef.Partitions/NeXT.cs index 678e6421..98eaa8d5 100644 --- a/DiscImageChef.Partitions/NeXT.cs +++ b/DiscImageChef.Partitions/NeXT.cs @@ -57,7 +57,7 @@ namespace DiscImageChef.PartPlugins PluginUUID = new Guid("246A6D93-4F1A-1F8A-344D-50187A5513A9"); } - public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List partitions) + public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List partitions, ulong sectorOffset) { bool magic_found = false; byte[] label_sector; @@ -74,18 +74,19 @@ namespace DiscImageChef.PartPlugins BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; - label_sector = imagePlugin.ReadSector(0); // Starts on sector 0 on NeXT machines, CDs and floppies - magic = BigEndianBitConverter.ToUInt32(label_sector, 0x00); ulong label_position = 0; foreach(ulong i in new ulong[]{0, 4, 15, 16}) { - label_sector = imagePlugin.ReadSector(i); + if(i + sectorOffset >= imagePlugin.GetSectors()) + break; + + label_sector = imagePlugin.ReadSector(i + sectorOffset); magic = BigEndianBitConverter.ToUInt32(label_sector, 0x00); if(magic == NEXT_MAGIC1 || magic == NEXT_MAGIC2 || magic == NEXT_MAGIC3) { magic_found = true; - label_position = i; + label_position = i + sectorOffset; break; } } diff --git a/DiscImageChef.Partitions/PC98.cs b/DiscImageChef.Partitions/PC98.cs index d4f4a995..9a1d8262 100644 --- a/DiscImageChef.Partitions/PC98.cs +++ b/DiscImageChef.Partitions/PC98.cs @@ -49,12 +49,12 @@ namespace DiscImageChef.PartPlugins PluginUUID = new Guid("27333401-C7C2-447D-961C-22AD0641A09A\n"); } - public override bool GetInformation(ImagePlugin imagePlugin, out List partitions) + public override bool GetInformation(ImagePlugin imagePlugin, out List partitions, ulong sectorOffset) { partitions = new List(); - byte[] bootSector = imagePlugin.ReadSector(0); - byte[] sector = imagePlugin.ReadSector(1); + byte[] bootSector = imagePlugin.ReadSector(sectorOffset); + byte[] sector = imagePlugin.ReadSector(1 + sectorOffset); if(sector.Length < 512) return false; if(bootSector[0x1FE] != 0x55 || bootSector[0x1FF] != 0xAA) diff --git a/DiscImageChef.Partitions/PartPlugin.cs b/DiscImageChef.Partitions/PartPlugin.cs index adfbf3e1..5d5e47a8 100644 --- a/DiscImageChef.Partitions/PartPlugin.cs +++ b/DiscImageChef.Partitions/PartPlugin.cs @@ -56,6 +56,7 @@ namespace DiscImageChef.PartPlugins /// true, if partitioning scheme is recognized, false otherwise. /// Disk image. /// Returns list of partitions. - public abstract bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List partitions); + /// At which sector to start searching for the partition scheme. + public abstract bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List partitions, ulong sectorOffset); } } \ No newline at end of file diff --git a/DiscImageChef.Partitions/RDB.cs b/DiscImageChef.Partitions/RDB.cs index 1dcb648c..bca402e7 100644 --- a/DiscImageChef.Partitions/RDB.cs +++ b/DiscImageChef.Partitions/RDB.cs @@ -889,7 +889,7 @@ namespace DiscImageChef.PartPlugins public byte[] loadData; } - public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List partitions) + public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List partitions, ulong sectorOffset) { partitions = new List(); BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; @@ -901,7 +901,10 @@ namespace DiscImageChef.PartPlugins if(imagePlugin.GetSectors() <= RDBBlock) return false; - byte[] tmpSector = imagePlugin.ReadSector(RDBBlock); + if(RDBBlock + sectorOffset >= imagePlugin.GetSectors()) + break; + + byte[] tmpSector = imagePlugin.ReadSector(RDBBlock + sectorOffset); uint magic = BigEndianBitConverter.ToUInt32(tmpSector, 0); DicConsole.DebugWriteLine("Amiga RDB plugin", "Possible magic at block {0} is 0x{1:X8}", RDBBlock, magic); @@ -920,6 +923,8 @@ namespace DiscImageChef.PartPlugins if(!foundRDB) return false; + RDBBlock += sectorOffset; + byte[] sector; byte[] tmpString; @@ -1109,9 +1114,9 @@ namespace DiscImageChef.PartPlugins nextBlock = RDB.partition_ptr; while(nextBlock != 0xFFFFFFFF) { - DicConsole.DebugWriteLine("Amiga RDB plugin", "Going to block {0} in search of a PartitionEntry block", nextBlock); + DicConsole.DebugWriteLine("Amiga RDB plugin", "Going to block {0} in search of a PartitionEntry block", nextBlock + sectorOffset); - sector = imagePlugin.ReadSector(nextBlock); + sector = imagePlugin.ReadSector(nextBlock + sectorOffset); uint magic = BigEndianBitConverter.ToUInt32(sector, 0); if(magic != PartitionBlockMagic) @@ -1349,7 +1354,7 @@ namespace DiscImageChef.PartPlugins Name = RDBEntry.driveName, Sequence = sequence, Length = (RDBEntry.dosEnvVec.highCylinder + 1 - RDBEntry.dosEnvVec.lowCylinder) * RDBEntry.dosEnvVec.surfaces * RDBEntry.dosEnvVec.bpt, - Start = RDBEntry.dosEnvVec.lowCylinder * RDBEntry.dosEnvVec.surfaces * RDBEntry.dosEnvVec.bpt, + Start = RDBEntry.dosEnvVec.lowCylinder * RDBEntry.dosEnvVec.surfaces * RDBEntry.dosEnvVec.bpt + sectorOffset, Type = AmigaDOSTypeToString(RDBEntry.dosEnvVec.dosType), Scheme = Name }; diff --git a/DiscImageChef.Partitions/RioKarma.cs b/DiscImageChef.Partitions/RioKarma.cs index 4a8d2c00..794192a0 100644 --- a/DiscImageChef.Partitions/RioKarma.cs +++ b/DiscImageChef.Partitions/RioKarma.cs @@ -49,11 +49,11 @@ namespace DiscImageChef.PartPlugins PluginUUID = new Guid("246A6D93-4F1A-1F8A-344D-50187A5513A9"); } - public override bool GetInformation(ImagePlugin imagePlugin, out List partitions) + public override bool GetInformation(ImagePlugin imagePlugin, out List partitions, ulong sectorOffset) { partitions = new List(); - byte[] sector = imagePlugin.ReadSector(0); + byte[] sector = imagePlugin.ReadSector(sectorOffset); if(sector.Length < 512) return false; diff --git a/DiscImageChef.Partitions/SGI.cs b/DiscImageChef.Partitions/SGI.cs index a8b90f43..04b8c6de 100644 --- a/DiscImageChef.Partitions/SGI.cs +++ b/DiscImageChef.Partitions/SGI.cs @@ -48,11 +48,14 @@ namespace DiscImageChef.PartPlugins PluginUUID = new Guid("AEF5AB45-4880-4CE8-8735-F0A402E2E5F2"); } - public override bool GetInformation(ImagePlugin imagePlugin, out List partitions) + public override bool GetInformation(ImagePlugin imagePlugin, out List partitions, ulong sectorOffset) { partitions = new List(); - byte[] sector = imagePlugin.ReadSector(0); + // TODO: This is not working + return false; + + byte[] sector = imagePlugin.ReadSector(sectorOffset); if(sector.Length < 512) return false; diff --git a/DiscImageChef.Partitions/Sun.cs b/DiscImageChef.Partitions/Sun.cs index 2a82f31f..ca3f4ac3 100644 --- a/DiscImageChef.Partitions/Sun.cs +++ b/DiscImageChef.Partitions/Sun.cs @@ -82,14 +82,14 @@ namespace DiscImageChef.PartPlugins PluginUUID = new Guid("50F35CC4-8375-4445-8DCB-1BA550C931A3"); } - public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List partitions) + public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List partitions, ulong sectorOffset) { partitions = new List(); if(imagePlugin.GetSectorSize() < 512) return false; - byte[] sunSector = imagePlugin.ReadSector(0); + byte[] sunSector = imagePlugin.ReadSector(sectorOffset); byte[] tmpString; SunDiskLabel sdl = new SunDiskLabel { diff --git a/DiscImageChef.Partitions/UNIX.cs b/DiscImageChef.Partitions/UNIX.cs index d1658469..937837a5 100644 --- a/DiscImageChef.Partitions/UNIX.cs +++ b/DiscImageChef.Partitions/UNIX.cs @@ -49,35 +49,31 @@ namespace DiscImageChef.PartPlugins PluginUUID = new Guid("6D35A66F-8D77-426F-A562-D88F6A1F1702"); } - public override bool GetInformation(ImagePlugin imagePlugin, out List partitions) + public override bool GetInformation(ImagePlugin imagePlugin, out List partitions, ulong sectorOffset) { partitions = new List(); uint magic; - byte[] unix_dl_sector; + byte[] unix_dl_sector = null; + bool magic_found = false; - unix_dl_sector = imagePlugin.ReadSector(0); - magic = BitConverter.ToUInt32(unix_dl_sector, 4); - if(magic != UNIXDiskLabel_MAGIC) + foreach(ulong i in new ulong[] {0, 1, 8, 29}) { - unix_dl_sector = imagePlugin.ReadSector(1); + if(i + sectorOffset >= imagePlugin.GetSectors()) + break; + + unix_dl_sector = imagePlugin.ReadSector(i + sectorOffset); magic = BitConverter.ToUInt32(unix_dl_sector, 4); - if(magic != UNIXDiskLabel_MAGIC) + if(magic == UNIXDiskLabel_MAGIC) { - unix_dl_sector = imagePlugin.ReadSector(8); - magic = BitConverter.ToUInt32(unix_dl_sector, 4); - - if(magic != UNIXDiskLabel_MAGIC) - { - unix_dl_sector = imagePlugin.ReadSector(29); - magic = BitConverter.ToUInt32(unix_dl_sector, 4); - - if(magic != UNIXDiskLabel_MAGIC) - return false; - } + magic_found = true; + break; } } + if(!magic_found) + return false; + UNIXDiskLabel dl = new UNIXDiskLabel(); UNIXVTOC vtoc = new UNIXVTOC(); // old/new bool isNewDL = false; diff --git a/DiscImageChef.Partitions/Xbox.cs b/DiscImageChef.Partitions/Xbox.cs index 4316a698..90f8f92c 100644 --- a/DiscImageChef.Partitions/Xbox.cs +++ b/DiscImageChef.Partitions/Xbox.cs @@ -77,10 +77,14 @@ namespace DiscImageChef.PartPlugins PluginUUID = new Guid("E3F6FB91-D358-4F22-A550-81E92D50EB78"); } - public override bool GetInformation(ImagePlugin imagePlugin, out List partitions) + public override bool GetInformation(ImagePlugin imagePlugin, out List partitions, ulong sectorOffset) { partitions = new List(); + // Xbox partitions always start on 0 + if(sectorOffset != 0) + return false; + byte[] sector = imagePlugin.ReadSector(0); if(sector.Length < 512) return false; diff --git a/DiscImageChef.Tests/DiscImageChef.Tests.csproj b/DiscImageChef.Tests/DiscImageChef.Tests.csproj index 638a32be..168bcafe 100644 --- a/DiscImageChef.Tests/DiscImageChef.Tests.csproj +++ b/DiscImageChef.Tests/DiscImageChef.Tests.csproj @@ -203,6 +203,10 @@ {DA7AB65D-B5BA-4003-8893-A51BB071BA2F} DiscImageChef.Partitions + + {679659B8-25D0-4279-B632-56EF8F94ADC0} + DiscImageChef.Core + @@ -213,7 +217,7 @@ - + diff --git a/DiscImageChef.Tests/Filesystems/AFFS2_RDB.cs b/DiscImageChef.Tests/Filesystems/AFFS2_RDB.cs index 713279ac..ee8580fc 100644 --- a/DiscImageChef.Tests/Filesystems/AFFS2_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/AFFS2_RDB.cs @@ -90,8 +90,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new AmigaRigidDiskBlock(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.AmigaDOSPlugin(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -102,7 +101,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/AFFS_MBR.cs b/DiscImageChef.Tests/Filesystems/AFFS_MBR.cs index 5814e204..2c769b42 100644 --- a/DiscImageChef.Tests/Filesystems/AFFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/AFFS_MBR.cs @@ -90,8 +90,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.AmigaDOSPlugin(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -102,7 +101,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/AFFS_MBR_RDB.cs b/DiscImageChef.Tests/Filesystems/AFFS_MBR_RDB.cs index 30a33a61..27e9622a 100644 --- a/DiscImageChef.Tests/Filesystems/AFFS_MBR_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/AFFS_MBR_RDB.cs @@ -1,4 +1,4 @@ -// /*************************************************************************** +// /*************************************************************************** // The Disc Image Chef // ---------------------------------------------------------------------------- // @@ -64,7 +64,7 @@ namespace DiscImageChef.Tests.Filesystems }; readonly long[] clusters = { - 408240,408240, + 406224,406224, }; readonly int[] clustersize = { @@ -76,14 +76,13 @@ namespace DiscImageChef.Tests.Filesystems }; readonly string[] volumeserial = { - null,null, + "A58348CE","A5833CD0", }; [Test] public void Test() { - throw new NotImplementedException("Partition schemes inside partitions are not yet implemented, and should be tested here."); -/* for(int i = 0; i < testfiles.Length; i++) + for(int i = 0; i < testfiles.Length; i++) { string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "affs_mbr_rdb", testfiles[i]); Filter filter = new LZip(); @@ -92,19 +91,18 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.AmigaDOSPlugin(); int part = -1; for(int j = 0; j < partitions.Count; j++) { - if(partitions[j].PartitionType == "0x2D") + if(partitions[j].Type == "\"DOS\\1\"" || partitions[j].Type == "\"DOS\\3\"") { part = j; break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); @@ -112,7 +110,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual("Amiga FFS", fs.XmlFSType.Type, testfiles[i]); Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]); - }*/ + } } } } diff --git a/DiscImageChef.Tests/Filesystems/AFFS_RDB.cs b/DiscImageChef.Tests/Filesystems/AFFS_RDB.cs index 92dbbd63..707ea0f3 100644 --- a/DiscImageChef.Tests/Filesystems/AFFS_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/AFFS_RDB.cs @@ -97,8 +97,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new AmigaRigidDiskBlock(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.AmigaDOSPlugin(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -109,7 +108,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/AOFS_MBR.cs b/DiscImageChef.Tests/Filesystems/AOFS_MBR.cs index 7e5edaf0..8bdb8d21 100644 --- a/DiscImageChef.Tests/Filesystems/AOFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/AOFS_MBR.cs @@ -90,8 +90,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.AmigaDOSPlugin(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -102,7 +101,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/AOFS_MBR_RDB.cs b/DiscImageChef.Tests/Filesystems/AOFS_MBR_RDB.cs index 5a7000d4..18f2ee65 100644 --- a/DiscImageChef.Tests/Filesystems/AOFS_MBR_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/AOFS_MBR_RDB.cs @@ -64,7 +64,7 @@ namespace DiscImageChef.Tests.Filesystems }; readonly long[] clusters = { - 408240,408240, + 406224,406224, }; readonly int[] clustersize = { @@ -76,35 +76,33 @@ namespace DiscImageChef.Tests.Filesystems }; readonly string[] volumeserial = { - null,null, + "A5833C5B","A5833085", }; [Test] public void Test() { - throw new NotImplementedException("Partition schemes inside partitions are not yet implemented, and should be tested here."); -/* for(int i = 0; i < testfiles.Length; i++) + for(int i = 0; i < testfiles.Length; i++) { - string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "aofs_mbr", testfiles[i]); + string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "aofs_mbr_rdb", testfiles[i]); Filter filter = new LZip(); filter.Open(location); ImagePlugin image = new VDI(); Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.AmigaDOSPlugin(); int part = -1; for(int j = 0; j < partitions.Count; j++) { - if(partitions[j].PartitionType == "0x2C") + if(partitions[j].Type == "\"DOS\\0\"") { part = j; break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); @@ -112,7 +110,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual("Amiga OFS", fs.XmlFSType.Type, testfiles[i]); Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]); - }*/ + } } } } diff --git a/DiscImageChef.Tests/Filesystems/AOFS_RDB.cs b/DiscImageChef.Tests/Filesystems/AOFS_RDB.cs index 0882fe45..05c0d5aa 100644 --- a/DiscImageChef.Tests/Filesystems/AOFS_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/AOFS_RDB.cs @@ -90,8 +90,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new AmigaRigidDiskBlock(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.AmigaDOSPlugin(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -102,7 +101,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/Atheos_MBR.cs b/DiscImageChef.Tests/Filesystems/Atheos_MBR.cs index b3c0ae1d..18f21a86 100644 --- a/DiscImageChef.Tests/Filesystems/Atheos_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/Atheos_MBR.cs @@ -92,8 +92,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.Atheros(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -104,7 +103,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/BeFS_APM.cs b/DiscImageChef.Tests/Filesystems/BeFS_APM.cs index 01e151f0..d9cca789 100644 --- a/DiscImageChef.Tests/Filesystems/BeFS_APM.cs +++ b/DiscImageChef.Tests/Filesystems/BeFS_APM.cs @@ -94,8 +94,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new DiscImageChef.PartPlugins.AppleMap(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.BeFS(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -106,7 +105,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/BeFS_GPT.cs b/DiscImageChef.Tests/Filesystems/BeFS_GPT.cs index 5f911fe7..afbd970e 100644 --- a/DiscImageChef.Tests/Filesystems/BeFS_GPT.cs +++ b/DiscImageChef.Tests/Filesystems/BeFS_GPT.cs @@ -90,8 +90,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new GuidPartitionTable(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.BeFS(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -102,7 +101,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/BeFS_MBR.cs b/DiscImageChef.Tests/Filesystems/BeFS_MBR.cs index 9647d7d6..49bc2a5a 100644 --- a/DiscImageChef.Tests/Filesystems/BeFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/BeFS_MBR.cs @@ -90,8 +90,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.BeFS(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -102,7 +101,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/F2FS.cs b/DiscImageChef.Tests/Filesystems/F2FS.cs index 53b581ac..a5f26055 100644 --- a/DiscImageChef.Tests/Filesystems/F2FS.cs +++ b/DiscImageChef.Tests/Filesystems/F2FS.cs @@ -91,7 +91,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + Assert.AreEqual(true, parts.GetInformation(image, out List partitions, 0), testfiles[i]); Filesystem fs = new DiscImageChef.Filesystems.F2FS(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -102,7 +102,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/FAT12_APM.cs b/DiscImageChef.Tests/Filesystems/FAT12_APM.cs index ba7b5ea7..3bfcaf2b 100644 --- a/DiscImageChef.Tests/Filesystems/FAT12_APM.cs +++ b/DiscImageChef.Tests/Filesystems/FAT12_APM.cs @@ -94,8 +94,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new DiscImageChef.PartPlugins.AppleMap(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.FAT(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -106,7 +105,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/FAT12_GPT.cs b/DiscImageChef.Tests/Filesystems/FAT12_GPT.cs index b66bb76b..408f8b50 100644 --- a/DiscImageChef.Tests/Filesystems/FAT12_GPT.cs +++ b/DiscImageChef.Tests/Filesystems/FAT12_GPT.cs @@ -94,8 +94,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new GuidPartitionTable(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.FAT(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -106,7 +105,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/FAT12_MBR.cs b/DiscImageChef.Tests/Filesystems/FAT12_MBR.cs index 6a6eaed2..cf887c30 100644 --- a/DiscImageChef.Tests/Filesystems/FAT12_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/FAT12_MBR.cs @@ -214,8 +214,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new FAT(); Assert.AreEqual(true, fs.Identify(image, partitions[0]), testfiles[i]); fs.GetInformation(image, partitions[0], out string information); diff --git a/DiscImageChef.Tests/Filesystems/FAT16_APM.cs b/DiscImageChef.Tests/Filesystems/FAT16_APM.cs index 53cfe71b..bf460548 100644 --- a/DiscImageChef.Tests/Filesystems/FAT16_APM.cs +++ b/DiscImageChef.Tests/Filesystems/FAT16_APM.cs @@ -94,8 +94,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new DiscImageChef.PartPlugins.AppleMap(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.FAT(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -106,7 +105,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/FAT16_Atari.cs b/DiscImageChef.Tests/Filesystems/FAT16_Atari.cs index 624fa3e4..45c87494 100644 --- a/DiscImageChef.Tests/Filesystems/FAT16_Atari.cs +++ b/DiscImageChef.Tests/Filesystems/FAT16_Atari.cs @@ -94,8 +94,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new AtariPartitions(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.FAT(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -106,7 +105,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/FAT16_GPT.cs b/DiscImageChef.Tests/Filesystems/FAT16_GPT.cs index 7e57c2d0..c723b3fb 100644 --- a/DiscImageChef.Tests/Filesystems/FAT16_GPT.cs +++ b/DiscImageChef.Tests/Filesystems/FAT16_GPT.cs @@ -94,8 +94,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new GuidPartitionTable(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.FAT(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -106,7 +105,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/FAT16_MBR.cs b/DiscImageChef.Tests/Filesystems/FAT16_MBR.cs index 9d29b652..e1e4928b 100644 --- a/DiscImageChef.Tests/Filesystems/FAT16_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/FAT16_MBR.cs @@ -214,8 +214,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new FAT(); Assert.AreEqual(true, fs.Identify(image, partitions[0]), testfiles[i]); fs.GetInformation(image, partitions[0], out string information); diff --git a/DiscImageChef.Tests/Filesystems/FAT16_RDB.cs b/DiscImageChef.Tests/Filesystems/FAT16_RDB.cs index 6f21a70f..3ddfa678 100644 --- a/DiscImageChef.Tests/Filesystems/FAT16_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/FAT16_RDB.cs @@ -64,11 +64,11 @@ namespace DiscImageChef.Tests.Filesystems }; readonly long[] clusters = { - 1020064 + 63689 }; readonly int[] clustersize = { - 512, + 8192, }; readonly string[] volumename = { @@ -76,7 +76,7 @@ namespace DiscImageChef.Tests.Filesystems }; readonly string[] volumeserial = { - "UNKNOWN ", + "374D40D1", }; readonly string[] oemid = { @@ -86,8 +86,6 @@ namespace DiscImageChef.Tests.Filesystems [Test] public void Test() { - throw new NotImplementedException("Partition schemes inside partitions are not yet implemented, and should be tested here."); - /* for(int i = 0; i < testfiles.Length; i++) { string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "fat16_rdb", testfiles[i]); @@ -97,28 +95,27 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new AmigaRigidDiskBlock(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.FAT(); int part = -1; for(int j = 0; j < partitions.Count; j++) { - if(partitions[j].PartitionType == "\"RES\\86\"") + if(partitions[j].Type == "0x06") { part = j; break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); + Assert.AreEqual("FAT16", fs.XmlFSType.Type, testfiles[i]); Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]); Assert.AreEqual(oemid[i], fs.XmlFSType.SystemIdentifier, testfiles[i]); - }*/ + } } } } diff --git a/DiscImageChef.Tests/Filesystems/FAT32_APM.cs b/DiscImageChef.Tests/Filesystems/FAT32_APM.cs index 91ce6aa2..d1202ff4 100644 --- a/DiscImageChef.Tests/Filesystems/FAT32_APM.cs +++ b/DiscImageChef.Tests/Filesystems/FAT32_APM.cs @@ -94,8 +94,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new DiscImageChef.PartPlugins.AppleMap(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.FAT(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -106,7 +105,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/FAT32_GPT.cs b/DiscImageChef.Tests/Filesystems/FAT32_GPT.cs index 7068607f..57ab8daa 100644 --- a/DiscImageChef.Tests/Filesystems/FAT32_GPT.cs +++ b/DiscImageChef.Tests/Filesystems/FAT32_GPT.cs @@ -94,8 +94,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new GuidPartitionTable(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.FAT(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -106,7 +105,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/FAT32_MBR.cs b/DiscImageChef.Tests/Filesystems/FAT32_MBR.cs index b427aa26..e6fdcf5e 100644 --- a/DiscImageChef.Tests/Filesystems/FAT32_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/FAT32_MBR.cs @@ -126,8 +126,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new FAT(); Assert.AreEqual(true, fs.Identify(image, partitions[0]), testfiles[i]); fs.GetInformation(image, partitions[0], out string information); diff --git a/DiscImageChef.Tests/Filesystems/HAMMER_MBR.cs b/DiscImageChef.Tests/Filesystems/HAMMER_MBR.cs index 4dca6d42..e9297641 100644 --- a/DiscImageChef.Tests/Filesystems/HAMMER_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/HAMMER_MBR.cs @@ -93,8 +93,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.HAMMER(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -105,7 +104,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/HFSPlus_APM.cs b/DiscImageChef.Tests/Filesystems/HFSPlus_APM.cs index fa154adc..78e27aaa 100644 --- a/DiscImageChef.Tests/Filesystems/HFSPlus_APM.cs +++ b/DiscImageChef.Tests/Filesystems/HFSPlus_APM.cs @@ -135,8 +135,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new DiscImageChef.PartPlugins.AppleMap(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.AppleHFSPlus(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -147,7 +146,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/HFSPlus_GPT.cs b/DiscImageChef.Tests/Filesystems/HFSPlus_GPT.cs index 507f3a14..bd756ad1 100644 --- a/DiscImageChef.Tests/Filesystems/HFSPlus_GPT.cs +++ b/DiscImageChef.Tests/Filesystems/HFSPlus_GPT.cs @@ -94,8 +94,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new GuidPartitionTable(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.AppleHFSPlus(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -106,7 +105,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/HFSPlus_MBR.cs b/DiscImageChef.Tests/Filesystems/HFSPlus_MBR.cs index 9e3f9584..489e10e8 100644 --- a/DiscImageChef.Tests/Filesystems/HFSPlus_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/HFSPlus_MBR.cs @@ -119,8 +119,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.AppleHFSPlus(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -131,7 +130,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/HFSX_APM.cs b/DiscImageChef.Tests/Filesystems/HFSX_APM.cs index 174daab7..d902f2c9 100644 --- a/DiscImageChef.Tests/Filesystems/HFSX_APM.cs +++ b/DiscImageChef.Tests/Filesystems/HFSX_APM.cs @@ -102,8 +102,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new DiscImageChef.PartPlugins.AppleMap(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.AppleHFSPlus(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -114,7 +113,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/HFSX_GPT.cs b/DiscImageChef.Tests/Filesystems/HFSX_GPT.cs index 7b55bdca..01b2f5a7 100644 --- a/DiscImageChef.Tests/Filesystems/HFSX_GPT.cs +++ b/DiscImageChef.Tests/Filesystems/HFSX_GPT.cs @@ -94,8 +94,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new GuidPartitionTable(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.AppleHFSPlus(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -106,7 +105,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/HFSX_MBR.cs b/DiscImageChef.Tests/Filesystems/HFSX_MBR.cs index 27c1e0df..99dc2049 100644 --- a/DiscImageChef.Tests/Filesystems/HFSX_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/HFSX_MBR.cs @@ -102,8 +102,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.AppleHFSPlus(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -114,7 +113,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/HFS_APM.cs b/DiscImageChef.Tests/Filesystems/HFS_APM.cs index 07a27795..d1d28c2b 100644 --- a/DiscImageChef.Tests/Filesystems/HFS_APM.cs +++ b/DiscImageChef.Tests/Filesystems/HFS_APM.cs @@ -153,8 +153,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new DiscImageChef.PartPlugins.AppleMap(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.AppleHFS(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -165,7 +164,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/HFS_CDROM.cs b/DiscImageChef.Tests/Filesystems/HFS_CDROM.cs index 03bea1e9..658dda47 100644 --- a/DiscImageChef.Tests/Filesystems/HFS_CDROM.cs +++ b/DiscImageChef.Tests/Filesystems/HFS_CDROM.cs @@ -102,8 +102,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new DiscImageChef.PartPlugins.AppleMap(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.AppleHFS(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -114,7 +113,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/HFS_MBR.cs b/DiscImageChef.Tests/Filesystems/HFS_MBR.cs index d57867cd..83eff493 100644 --- a/DiscImageChef.Tests/Filesystems/HFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/HFS_MBR.cs @@ -97,8 +97,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.AppleHFS(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -109,7 +108,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/HFS_RDB.cs b/DiscImageChef.Tests/Filesystems/HFS_RDB.cs index 593ad8ba..7c538533 100644 --- a/DiscImageChef.Tests/Filesystems/HFS_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/HFS_RDB.cs @@ -64,11 +64,11 @@ namespace DiscImageChef.Tests.Filesystems }; readonly long[] clusters = { - 1020064 + 63752, }; readonly int[] clustersize = { - 512, + 8192, }; readonly string[] volumename = { @@ -82,8 +82,6 @@ namespace DiscImageChef.Tests.Filesystems [Test] public void Test() { - throw new NotImplementedException("Partition schemes inside partitions are not yet implemented, and should be tested here."); - /* for(int i = 0; i < testfiles.Length; i++) { string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "hfs_rdb", testfiles[i]); @@ -93,28 +91,26 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new AmigaRigidDiskBlock(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); - Filesystem fs = new DiscImageChef.Filesystems.FAT(); + List partitions = Core.Partitions.GetAll(image); + Filesystem fs = new DiscImageChef.Filesystems.AppleHFS(); int part = -1; for(int j = 0; j < partitions.Count; j++) { - if(partitions[j].PartitionType == "\"RES\\86\"") + if(partitions[j].Type == "\"RES\\86\"") { part = j; break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); + Assert.AreEqual("HFS", fs.XmlFSType.Type, testfiles[i]); Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]); - Assert.AreEqual(oemid[i], fs.XmlFSType.SystemIdentifier, testfiles[i]); - }*/ + } } } } diff --git a/DiscImageChef.Tests/Filesystems/HPFS.cs b/DiscImageChef.Tests/Filesystems/HPFS.cs index 6f0161ca..ac483310 100644 --- a/DiscImageChef.Tests/Filesystems/HPFS.cs +++ b/DiscImageChef.Tests/Filesystems/HPFS.cs @@ -110,8 +110,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.HPFS(); Assert.AreEqual(true, fs.Identify(image, partitions[0]), testfiles[i]); fs.GetInformation(image, partitions[0], out string information); diff --git a/DiscImageChef.Tests/Filesystems/JFS2.cs b/DiscImageChef.Tests/Filesystems/JFS2.cs index 238964e2..dea3c025 100644 --- a/DiscImageChef.Tests/Filesystems/JFS2.cs +++ b/DiscImageChef.Tests/Filesystems/JFS2.cs @@ -90,8 +90,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.JFS(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -102,7 +101,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/LFS_MBR.cs b/DiscImageChef.Tests/Filesystems/LFS_MBR.cs index 062f0d4e..e2942839 100644 --- a/DiscImageChef.Tests/Filesystems/LFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/LFS_MBR.cs @@ -93,8 +93,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.LFS(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -105,7 +104,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/MINIXv1_MBR.cs b/DiscImageChef.Tests/Filesystems/MINIXv1_MBR.cs index 71bd09bb..6f16cecf 100644 --- a/DiscImageChef.Tests/Filesystems/MINIXv1_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/MINIXv1_MBR.cs @@ -55,7 +55,7 @@ namespace DiscImageChef.Tests.Filesystems }; readonly ulong[] sectors = { - 262144,262144, + 262144,102400, }; readonly uint[] sectorsize = { @@ -82,8 +82,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.MinixFS(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -94,7 +93,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/MINIXv2_MBR.cs b/DiscImageChef.Tests/Filesystems/MINIXv2_MBR.cs index e17dae8b..2efccc8f 100644 --- a/DiscImageChef.Tests/Filesystems/MINIXv2_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/MINIXv2_MBR.cs @@ -82,8 +82,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.MinixFS(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -94,7 +93,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/MINIXv3_MBR.cs b/DiscImageChef.Tests/Filesystems/MINIXv3_MBR.cs index 0579907d..95aaacb9 100644 --- a/DiscImageChef.Tests/Filesystems/MINIXv3_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/MINIXv3_MBR.cs @@ -82,8 +82,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.MinixFS(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -94,7 +93,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/NILFS2.cs b/DiscImageChef.Tests/Filesystems/NILFS2.cs index c252349a..325c4e52 100644 --- a/DiscImageChef.Tests/Filesystems/NILFS2.cs +++ b/DiscImageChef.Tests/Filesystems/NILFS2.cs @@ -90,8 +90,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.NILFS2(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -102,7 +101,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/NTFS_GPT.cs b/DiscImageChef.Tests/Filesystems/NTFS_GPT.cs index ff9258c0..b4032f25 100644 --- a/DiscImageChef.Tests/Filesystems/NTFS_GPT.cs +++ b/DiscImageChef.Tests/Filesystems/NTFS_GPT.cs @@ -96,8 +96,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new GuidPartitionTable(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.NTFS(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -108,7 +107,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/NTFS_MBR.cs b/DiscImageChef.Tests/Filesystems/NTFS_MBR.cs index 0e75d9af..c4b7dc92 100644 --- a/DiscImageChef.Tests/Filesystems/NTFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/NTFS_MBR.cs @@ -110,8 +110,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.NTFS(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -124,7 +123,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/NWFS386.cs b/DiscImageChef.Tests/Filesystems/NWFS386.cs index e7dc2bdd..babee3c4 100644 --- a/DiscImageChef.Tests/Filesystems/NWFS386.cs +++ b/DiscImageChef.Tests/Filesystems/NWFS386.cs @@ -93,8 +93,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.NetWare(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -105,7 +104,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/OCFS2.cs b/DiscImageChef.Tests/Filesystems/OCFS2.cs index fc4da296..b6c66d21 100644 --- a/DiscImageChef.Tests/Filesystems/OCFS2.cs +++ b/DiscImageChef.Tests/Filesystems/OCFS2.cs @@ -93,8 +93,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.OCFS2(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -105,7 +104,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/PFS3_RDB.cs b/DiscImageChef.Tests/Filesystems/PFS3_RDB.cs index 3f9a2743..adc475b4 100644 --- a/DiscImageChef.Tests/Filesystems/PFS3_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/PFS3_RDB.cs @@ -94,8 +94,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new AmigaRigidDiskBlock(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.PFS(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -106,7 +105,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/ProDOS_APM.cs b/DiscImageChef.Tests/Filesystems/ProDOS_APM.cs index 214b8b00..b4a96255 100644 --- a/DiscImageChef.Tests/Filesystems/ProDOS_APM.cs +++ b/DiscImageChef.Tests/Filesystems/ProDOS_APM.cs @@ -97,8 +97,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new DiscImageChef.PartPlugins.AppleMap(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.ProDOSPlugin(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -109,7 +108,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/QNX4_MBR.cs b/DiscImageChef.Tests/Filesystems/QNX4_MBR.cs index 14a6000a..a8fcbf69 100644 --- a/DiscImageChef.Tests/Filesystems/QNX4_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/QNX4_MBR.cs @@ -82,8 +82,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.QNX4(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -94,7 +93,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/ReFS_MBR.cs b/DiscImageChef.Tests/Filesystems/ReFS_MBR.cs index 478af6cd..7ac0e958 100644 --- a/DiscImageChef.Tests/Filesystems/ReFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/ReFS_MBR.cs @@ -96,8 +96,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); int part = -1; for(int j = 0; j < partitions.Count; j++) { @@ -107,7 +106,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); throw new NotImplementedException("ReFS is not yet implemented"); /* Filesystem fs = new DiscImageChef.Filesystems.ReFS(); diff --git a/DiscImageChef.Tests/Filesystems/Reiser3.cs b/DiscImageChef.Tests/Filesystems/Reiser3.cs index 98e9d45a..26f363c0 100644 --- a/DiscImageChef.Tests/Filesystems/Reiser3.cs +++ b/DiscImageChef.Tests/Filesystems/Reiser3.cs @@ -86,8 +86,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.Reiser(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -98,7 +97,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/Reiser4.cs b/DiscImageChef.Tests/Filesystems/Reiser4.cs index a65a635f..472da921 100644 --- a/DiscImageChef.Tests/Filesystems/Reiser4.cs +++ b/DiscImageChef.Tests/Filesystems/Reiser4.cs @@ -90,8 +90,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.Reiser4(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -102,7 +101,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/SFS_MBR.cs b/DiscImageChef.Tests/Filesystems/SFS_MBR.cs index 9257091c..52b043ee 100644 --- a/DiscImageChef.Tests/Filesystems/SFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/SFS_MBR.cs @@ -90,8 +90,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.SFS(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -102,7 +101,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/SFS_MBR_RDB.cs b/DiscImageChef.Tests/Filesystems/SFS_MBR_RDB.cs index 382652c3..4c9eb3c7 100644 --- a/DiscImageChef.Tests/Filesystems/SFS_MBR_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/SFS_MBR_RDB.cs @@ -64,7 +64,7 @@ namespace DiscImageChef.Tests.Filesystems }; readonly long[] clusters = { - 408240, + 406224, }; readonly int[] clustersize = { @@ -82,8 +82,7 @@ namespace DiscImageChef.Tests.Filesystems [Test] public void Test() { - throw new NotImplementedException("Partition schemes inside partitions are not yet implemented, and should be tested here."); -/* for(int i = 0; i < testfiles.Length; i++) + for(int i = 0; i < testfiles.Length; i++) { string location = Path.Combine(Consts.TestFilesRoot, "filesystems", "sfs_mbr_rdb", testfiles[i]); Filter filter = new LZip(); @@ -92,19 +91,18 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); - Filesystem fs = new DiscImageChef.Filesystems.AmigaDOSPlugin(); + List partitions = Core.Partitions.GetAll(image); + Filesystem fs = new DiscImageChef.Filesystems.SFS(); int part = -1; for(int j = 0; j < partitions.Count; j++) { - if(partitions[j].PartitionType == "SFS") + if(partitions[j].Type == "\"SFS\\0\"") { part = j; break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); @@ -112,7 +110,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual("SmartFileSystem", fs.XmlFSType.Type, testfiles[i]); Assert.AreEqual(volumename[i], fs.XmlFSType.VolumeName, testfiles[i]); Assert.AreEqual(volumeserial[i], fs.XmlFSType.VolumeSerial, testfiles[i]); - }*/ + } } } } diff --git a/DiscImageChef.Tests/Filesystems/SFS_RDB.cs b/DiscImageChef.Tests/Filesystems/SFS_RDB.cs index 7b356850..a17e728c 100644 --- a/DiscImageChef.Tests/Filesystems/SFS_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/SFS_RDB.cs @@ -90,8 +90,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new AmigaRigidDiskBlock(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.SFS(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -102,7 +101,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/SysV_MBR.cs b/DiscImageChef.Tests/Filesystems/SysV_MBR.cs index 667555a5..7fb8a3cb 100644 --- a/DiscImageChef.Tests/Filesystems/SysV_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/SysV_MBR.cs @@ -94,8 +94,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.SysVfs(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -106,7 +105,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/SysV_RDB.cs b/DiscImageChef.Tests/Filesystems/SysV_RDB.cs index 92b94902..72f17da6 100644 --- a/DiscImageChef.Tests/Filesystems/SysV_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/SysV_RDB.cs @@ -94,8 +94,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new AmigaRigidDiskBlock(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.SysVfs(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -106,7 +105,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/UFS_APM.cs b/DiscImageChef.Tests/Filesystems/UFS_APM.cs index c761e8b1..f9248661 100644 --- a/DiscImageChef.Tests/Filesystems/UFS_APM.cs +++ b/DiscImageChef.Tests/Filesystems/UFS_APM.cs @@ -110,8 +110,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new DiscImageChef.PartPlugins.AppleMap(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.FFSPlugin(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -122,7 +121,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/UFS_MBR.cs b/DiscImageChef.Tests/Filesystems/UFS_MBR.cs index 0ab2ef13..2ca35b25 100644 --- a/DiscImageChef.Tests/Filesystems/UFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/UFS_MBR.cs @@ -150,19 +150,19 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.FFSPlugin(); int part = -1; for(int j = 0; j < partitions.Count; j++) { - if(partitions[j].Type == "0x63" || partitions[j].Type == "0xA8" || partitions[j].Type == "0xA5" || partitions[j].Type == "0xA9") + if(partitions[j].Type == "0x63" || partitions[j].Type == "0xA8" || partitions[j].Type == "0xA5" || partitions[j].Type == "0xA9" || + partitions[j].Type == "0x83") { part = j; break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/UFS_NeXT.cs b/DiscImageChef.Tests/Filesystems/UFS_NeXT.cs index 1720e6ad..4b4ec7c1 100644 --- a/DiscImageChef.Tests/Filesystems/UFS_NeXT.cs +++ b/DiscImageChef.Tests/Filesystems/UFS_NeXT.cs @@ -102,8 +102,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new NeXTDisklabel(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.FFSPlugin(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -114,7 +113,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/UFS_NeXT_Floppy.cs b/DiscImageChef.Tests/Filesystems/UFS_NeXT_Floppy.cs index c8e41a82..0b1047f8 100644 --- a/DiscImageChef.Tests/Filesystems/UFS_NeXT_Floppy.cs +++ b/DiscImageChef.Tests/Filesystems/UFS_NeXT_Floppy.cs @@ -126,8 +126,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new NeXTDisklabel(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.FFSPlugin(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -138,7 +137,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/UFS_RDB.cs b/DiscImageChef.Tests/Filesystems/UFS_RDB.cs index 758a0673..5e58f12d 100644 --- a/DiscImageChef.Tests/Filesystems/UFS_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/UFS_RDB.cs @@ -94,8 +94,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new AmigaRigidDiskBlock(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.FFSPlugin(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -106,7 +105,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/UFS_Suni86.cs b/DiscImageChef.Tests/Filesystems/UFS_Suni86.cs index a9225738..141208c2 100644 --- a/DiscImageChef.Tests/Filesystems/UFS_Suni86.cs +++ b/DiscImageChef.Tests/Filesystems/UFS_Suni86.cs @@ -94,8 +94,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new SunDisklabel(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.FFSPlugin(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -106,7 +105,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/UNIXBFS_MBR.cs b/DiscImageChef.Tests/Filesystems/UNIXBFS_MBR.cs index 2bd3a34c..5e83d747 100644 --- a/DiscImageChef.Tests/Filesystems/UNIXBFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/UNIXBFS_MBR.cs @@ -86,8 +86,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.BFS(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -98,7 +97,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/UNIXBFS_RDB.cs b/DiscImageChef.Tests/Filesystems/UNIXBFS_RDB.cs index be6c66b9..07b6057c 100644 --- a/DiscImageChef.Tests/Filesystems/UNIXBFS_RDB.cs +++ b/DiscImageChef.Tests/Filesystems/UNIXBFS_RDB.cs @@ -94,8 +94,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new AmigaRigidDiskBlock(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.BFS(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -106,7 +105,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/XFS_MBR.cs b/DiscImageChef.Tests/Filesystems/XFS_MBR.cs index e1be7fa5..3c6bd68b 100644 --- a/DiscImageChef.Tests/Filesystems/XFS_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/XFS_MBR.cs @@ -90,8 +90,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.XFS(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -102,7 +101,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/btrfs.cs b/DiscImageChef.Tests/Filesystems/btrfs.cs index 62355135..ad464873 100644 --- a/DiscImageChef.Tests/Filesystems/btrfs.cs +++ b/DiscImageChef.Tests/Filesystems/btrfs.cs @@ -91,7 +91,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + Assert.AreEqual(true, parts.GetInformation(image, out List partitions, 0), testfiles[i]); Filesystem fs = new DiscImageChef.Filesystems.BTRFS(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -102,7 +102,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/exFAT_APM.cs b/DiscImageChef.Tests/Filesystems/exFAT_APM.cs index 00d6a30c..745ec065 100644 --- a/DiscImageChef.Tests/Filesystems/exFAT_APM.cs +++ b/DiscImageChef.Tests/Filesystems/exFAT_APM.cs @@ -90,8 +90,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new DiscImageChef.PartPlugins.AppleMap(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.exFAT(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -102,7 +101,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/exFAT_GPT.cs b/DiscImageChef.Tests/Filesystems/exFAT_GPT.cs index e2c7969b..2e0972bb 100644 --- a/DiscImageChef.Tests/Filesystems/exFAT_GPT.cs +++ b/DiscImageChef.Tests/Filesystems/exFAT_GPT.cs @@ -90,8 +90,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new GuidPartitionTable(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.exFAT(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -102,7 +101,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/exFAT_MBR.cs b/DiscImageChef.Tests/Filesystems/exFAT_MBR.cs index d1e9833d..a8a68d92 100644 --- a/DiscImageChef.Tests/Filesystems/exFAT_MBR.cs +++ b/DiscImageChef.Tests/Filesystems/exFAT_MBR.cs @@ -90,8 +90,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); - PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Filesystem fs = new DiscImageChef.Filesystems.exFAT(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -102,7 +101,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Filesystems/ext2.cs b/DiscImageChef.Tests/Filesystems/ext2.cs index 6ef6b2fb..54f34d56 100644 --- a/DiscImageChef.Tests/Filesystems/ext2.cs +++ b/DiscImageChef.Tests/Filesystems/ext2.cs @@ -103,7 +103,7 @@ namespace DiscImageChef.Tests.Filesystems Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]); Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]); PartPlugin parts = new MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + Assert.AreEqual(true, parts.GetInformation(image, out List partitions, 0), testfiles[i]); Filesystem fs = new DiscImageChef.Filesystems.ext2FS(); int part = -1; for(int j = 0; j < partitions.Count; j++) @@ -114,7 +114,7 @@ namespace DiscImageChef.Tests.Filesystems break; } } - Assert.AreNotEqual(-1, part, "Partition not found"); + Assert.AreNotEqual(-1, part, string.Format("Partition not found on {0}", testfiles[i])); 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]); diff --git a/DiscImageChef.Tests/Partitions/Acorn.cs b/DiscImageChef.Tests/Partitions/Acorn.cs index a55d43f3..0d42ae7a 100644 --- a/DiscImageChef.Tests/Partitions/Acorn.cs +++ b/DiscImageChef.Tests/Partitions/Acorn.cs @@ -79,8 +79,7 @@ namespace DiscImageChef.Tests.Partitions filter.Open(location); ImagePlugin image = new VDI(); Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - PartPlugin parts = new DiscImageChef.PartPlugins.Acorn(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Assert.AreEqual(wanted[i].Length, partitions.Count, testfiles[i]); for(int j = 0; j < partitions.Count; j++) { diff --git a/DiscImageChef.Tests/Partitions/AppleMap.cs b/DiscImageChef.Tests/Partitions/AppleMap.cs index 10808b7b..b5db06fe 100644 --- a/DiscImageChef.Tests/Partitions/AppleMap.cs +++ b/DiscImageChef.Tests/Partitions/AppleMap.cs @@ -44,6 +44,7 @@ using DiscImageChef.Filters; using DiscImageChef.ImagePlugins; using DiscImageChef.PartPlugins; using NUnit.Framework; +using DiscImageChef.Core; namespace DiscImageChef.Tests.Partitions { @@ -207,10 +208,10 @@ namespace DiscImageChef.Tests.Partitions Sequence = 8, Start = 35542 }, new Partition{ Description = null, Size = 1766400, Name = "Usr file system", Type = "Apple_UNIX_SVR2", Offset = 24734720, Length = 3450, Sequence = 9, Start = 48310 }, - new Partition{ Description = null, Size = 1558528, Name = "Random A/UX fs", Type = "Apple_UNIX_SVR2", Offset = 26519552, Length = 3044, - Sequence = 10, Start = 51796 }, new Partition{ Description = null, Size = 18432, Name = "Extra", Type = "Apple_Free", Offset = 26501120, Length = 36, - Sequence = 11, Start = 51760 }, + Sequence = 10, Start = 51760 }, + new Partition{ Description = null, Size = 1558528, Name = "Random A/UX fs", Type = "Apple_UNIX_SVR2", Offset = 26519552, Length = 3044, + Sequence = 11, Start = 51796 }, }, // Mac OS 6.0.4 new []{ @@ -276,10 +277,10 @@ namespace DiscImageChef.Tests.Partitions new []{ new Partition{ Description = null, Size = 5120, Name = null, Type = "Apple_Driver", Offset = 32768, Length = 10, Sequence = 0, Start = 64 }, - new Partition{ Description = null, Size = 14013952, Name = "MacOS", Type = "Apple_HFS", Offset = 49152, Length = 27371, - Sequence = 1, Start = 96 }, new Partition{ Description = null, Size = 16384, Name = "Macintosh", Type = "Apple_Driver", Offset = 32768, Length = 32, - Sequence = 2, Start = 64 }, + Sequence = 1, Start = 64 }, + new Partition{ Description = null, Size = 14013952, Name = "MacOS", Type = "Apple_HFS", Offset = 49152, Length = 27371, + Sequence = 2, Start = 96 }, new Partition{ Description = null, Size = 1492992, Name = "Eschatology 1", Type = "Apple_UNIX_SVR2", Offset = 14063104, Length = 2916, Sequence = 3, Start = 27467 }, new Partition{ Description = null, Size = 919040, Name = "A/UX Root", Type = "Apple_UNIX_SVR2", Offset = 15556096, Length = 1795, @@ -298,10 +299,10 @@ namespace DiscImageChef.Tests.Partitions Sequence = 10, Start = 47321 }, new Partition{ Description = null, Size = 798208, Name = "Unreserved 3", Type = "Apple_UNIX_SVR2", Offset = 24883712, Length = 1559, Sequence = 11, Start = 48601 }, - new Partition{ Description = null, Size = 2252800, Name = "Unreserved 4", Type = "Apple_UNIX_SVR2", Offset = 25825280, Length = 4400, - Sequence = 12, Start = 50440 }, new Partition{ Description = null, Size = 143360, Name = "Extra", Type = "Apple_Free", Offset = 25681920, Length = 280, - Sequence = 13, Start = 50160 }, + Sequence = 12, Start = 50160 }, + new Partition{ Description = null, Size = 2252800, Name = "Unreserved 4", Type = "Apple_UNIX_SVR2", Offset = 25825280, Length = 4400, + Sequence = 13, Start = 50440 }, }, // Mac OS 6.0.8 new []{ @@ -315,26 +316,26 @@ namespace DiscImageChef.Tests.Partitions Sequence = 3, Start = 9033 }, new Partition{ Description = null, Size = 3020800, Name = "Eschatology 1", Type = "Apple_UNIX_SVR2", Offset = 5768704, Length = 5900, Sequence = 4, Start = 11267 }, - new Partition{ Description = null, Size = 2091520, Name = "A/UX Root", Type = "Apple_UNIX_SVR2", Offset = 25986560, Length = 4085, - Sequence = 5, Start = 50755 }, - new Partition{ Description = null, Size = 3693056, Name = "Swap", Type = "Apple_UNIX_SVR2", Offset = 22293504, Length = 7213, - Sequence = 6, Start = 43542 }, - new Partition{ Description = null, Size = 2308096, Name = "Root file system", Type = "Apple_UNIX_SVR2", Offset = 19985408, Length = 4508, - Sequence = 7, Start = 39034 }, - new Partition{ Description = null, Size = 2885120, Name = "Usr file system", Type = "Apple_UNIX_SVR2", Offset = 17100288, Length = 5635, - Sequence = 8, Start = 33399 }, new Partition{ Description = null, Size = 1615872, Name = "Unreserved 1", Type = "Apple_UNIX_SVR2", Offset = 8789504, Length = 3156, - Sequence = 9, Start = 17167 }, + Sequence = 5, Start = 17167 }, + new Partition{ Description = null, Size = 1384960, Name = "Unreserved 3", Type = "Apple_UNIX_SVR2", Offset = 10405376, Length = 2705, + Sequence = 6, Start = 20323 }, + new Partition{ Description = null, Size = 952832, Name = "Unreserved 4", Type = "Apple_UNIX_SVR2", Offset = 11790336, Length = 1861, + Sequence = 7, Start = 23028 }, + new Partition{ Description = null, Size = 1246208, Name = "Extra", Type = "Apple_Free", Offset = 12743168, Length = 2434, + Sequence = 8, Start = 24889 }, + new Partition{ Description = null, Size = 1495040, Name = "Random A/UX fs", Type = "Apple_UNIX_SVR2", Offset = 13989376, Length = 2920, + Sequence = 9, Start = 27323 }, new Partition{ Description = null, Size = 1615872, Name = "Unreserved 2", Type = "Apple_UNIX_SVR2", Offset = 15484416, Length = 3156, Sequence = 10, Start = 30243 }, - new Partition{ Description = null, Size = 1384960, Name = "Unreserved 3", Type = "Apple_UNIX_SVR2", Offset = 10405376, Length = 2705, - Sequence = 11, Start = 20323 }, - new Partition{ Description = null, Size = 952832, Name = "Unreserved 4", Type = "Apple_UNIX_SVR2", Offset = 11790336, Length = 1861, - Sequence = 12, Start = 23028 }, - new Partition{ Description = null, Size = 1495040, Name = "Random A/UX fs", Type = "Apple_UNIX_SVR2", Offset = 13989376, Length = 2920, - Sequence = 13, Start = 27323 }, - new Partition{ Description = null, Size = 1246208, Name = "Extra", Type = "Apple_Free", Offset = 12743168, Length = 2434, - Sequence = 14, Start = 24889 }, + new Partition{ Description = null, Size = 2885120, Name = "Usr file system", Type = "Apple_UNIX_SVR2", Offset = 17100288, Length = 5635, + Sequence = 11, Start = 33399 }, + new Partition{ Description = null, Size = 2308096, Name = "Root file system", Type = "Apple_UNIX_SVR2", Offset = 19985408, Length = 4508, + Sequence = 12, Start = 39034 }, + new Partition{ Description = null, Size = 3693056, Name = "Swap", Type = "Apple_UNIX_SVR2", Offset = 22293504, Length = 7213, + Sequence = 13, Start = 43542 }, + new Partition{ Description = null, Size = 2091520, Name = "A/UX Root", Type = "Apple_UNIX_SVR2", Offset = 25986560, Length = 4085, + Sequence = 14, Start = 50755 }, }, // Mac OS 6.0 new []{ @@ -369,22 +370,22 @@ namespace DiscImageChef.Tests.Partitions Sequence = 0, Start = 64 }, new Partition{ Description = null, Size = 16384, Name = "Macintosh", Type = "Apple_Driver", Offset = 32768, Length = 32, Sequence = 1, Start = 64 }, - new Partition{ Description = null, Size = 5262336, Name = "MacOS", Type = "Apple_HFS", Offset = 15845888, Length = 10278, - Sequence = 2, Start = 30949 }, new Partition{ Description = null, Size = 3073024, Name = "Scratch", Type = "Apple_Scratch", Offset = 49152, Length = 6002, - Sequence = 3, Start = 96 }, - new Partition{ Description = null, Size = 1707520, Name = "Eschatology 1", Type = "Apple_UNIX_SVR2", Offset = 21108224, Length = 3335, - Sequence = 4, Start = 41227 }, - new Partition{ Description = null, Size = 5262336, Name = "Extra", Type = "Apple_Free", Offset = 22815744, Length = 10278, - Sequence = 5, Start = 44562 }, + Sequence = 2, Start = 96 }, new Partition{ Description = null, Size = 2726400, Name = "Root file system", Type = "Apple_UNIX_SVR2", Offset = 3122176, Length = 5325, - Sequence = 6, Start = 6098 }, + Sequence = 3, Start = 6098 }, new Partition{ Description = null, Size = 3180544, Name = "Extra", Type = "Apple_Free", Offset = 5848576, Length = 6212, - Sequence = 7, Start = 11423 }, + Sequence = 4, Start = 11423 }, new Partition{ Description = null, Size = 4203520, Name = "Random A/UX fs", Type = "Apple_UNIX_SVR2", Offset = 9029120, Length = 8210, - Sequence = 8, Start = 17635 }, + Sequence = 5, Start = 17635 }, new Partition{ Description = null, Size = 2613248, Name = "Extra", Type = "Apple_Free", Offset = 13232640, Length = 5104, - Sequence = 9, Start = 25845 }, + Sequence = 6, Start = 25845 }, + new Partition{ Description = null, Size = 5262336, Name = "MacOS", Type = "Apple_HFS", Offset = 15845888, Length = 10278, + Sequence = 7, Start = 30949 }, + new Partition{ Description = null, Size = 1707520, Name = "Eschatology 1", Type = "Apple_UNIX_SVR2", Offset = 21108224, Length = 3335, + Sequence = 8, Start = 41227 }, + new Partition{ Description = null, Size = 5262336, Name = "Extra", Type = "Apple_Free", Offset = 22815744, Length = 10278, + Sequence = 9, Start = 44562 }, }, // Mac OS 7.1.1 new []{ @@ -392,24 +393,24 @@ namespace DiscImageChef.Tests.Partitions Sequence = 0, Start = 64 }, new Partition{ Description = null, Size = 16384, Name = "Macintosh", Type = "Apple_Driver43", Offset = 32768, Length = 32, Sequence = 1, Start = 64 }, - new Partition{ Description = null, Size = 5148160, Name = "MacOS", Type = "Apple_HFS", Offset = 7294464, Length = 10055, - Sequence = 2, Start = 14247 }, - new Partition{ Description = null, Size = 2097152, Name = "ProDOS", Type = "Apple_PRODOS", Offset = 5197312, Length = 4096, - Sequence = 3, Start = 10151 }, - new Partition{ Description = null, Size = 3996672, Name = "A/UX Root", Type = "Apple_UNIX_SVR2", Offset = 24081408, Length = 7806, - Sequence = 4, Start = 47034 }, new Partition{ Description = null, Size = 1486848, Name = "Random A/UX fs", Type = "Apple_UNIX_SVR2", Offset = 49152, Length = 2904, - Sequence = 5, Start = 96 }, - new Partition{ Description = null, Size = 4406784, Name = "Extra", Type = "Apple_Free", Offset = 12442624, Length = 8607, - Sequence = 6, Start = 24302 }, - new Partition{ Description = null, Size = 2485760, Name = "Random A/UX fs", Type = "Apple_UNIX_SVR2", Offset = 16849408, Length = 4855, - Sequence = 7, Start = 32909 }, - new Partition{ Description = null, Size = 4746240, Name = "Extra", Type = "Apple_Free", Offset = 19335168, Length = 9270, - Sequence = 8, Start = 37764 }, + Sequence = 2, Start = 96 }, new Partition{ Description = null, Size = 2097152, Name = "ProDOS", Type = "Apple_PRODOS", Offset = 1536000, Length = 4096, - Sequence = 9, Start = 3000 }, + Sequence = 3, Start = 3000 }, new Partition{ Description = null, Size = 1564160, Name = "Extra", Type = "Apple_Free", Offset = 3633152, Length = 3055, - Sequence = 10, Start = 7096 }, + Sequence = 4, Start = 7096 }, + new Partition{ Description = null, Size = 2097152, Name = "ProDOS", Type = "Apple_PRODOS", Offset = 5197312, Length = 4096, + Sequence = 5, Start = 10151 }, + new Partition{ Description = null, Size = 5148160, Name = "MacOS", Type = "Apple_HFS", Offset = 7294464, Length = 10055, + Sequence = 6, Start = 14247 }, + new Partition{ Description = null, Size = 4406784, Name = "Extra", Type = "Apple_Free", Offset = 12442624, Length = 8607, + Sequence = 7, Start = 24302 }, + new Partition{ Description = null, Size = 2485760, Name = "Random A/UX fs", Type = "Apple_UNIX_SVR2", Offset = 16849408, Length = 4855, + Sequence = 8, Start = 32909 }, + new Partition{ Description = null, Size = 4746240, Name = "Extra", Type = "Apple_Free", Offset = 19335168, Length = 9270, + Sequence = 9, Start = 37764 }, + new Partition{ Description = null, Size = 3996672, Name = "A/UX Root", Type = "Apple_UNIX_SVR2", Offset = 24081408, Length = 7806, + Sequence = 10, Start = 47034 }, }, // Mac OS 7.5 new []{ @@ -422,21 +423,21 @@ namespace DiscImageChef.Tests.Partitions }, // GNU Parted new []{ - new Partition{ Description = null, Size = 47185920, Name = "untitled", Type = "Apple_HFS", Offset = 2097152, Length = 92160, - Sequence = 0, Start = 4096 }, - new Partition{ Description = null, Size = 84934656, Name = "untitled", Type = "Apple_UNIX_SVR2", Offset = 49283072, Length = 165888, - Sequence = 1, Start = 96256 }, new Partition{ Description = null, Size = 2064384, Name = "Extra", Type = "Apple_Free", Offset = 32768, Length = 4032, - Sequence = 2, Start = 64 }, + Sequence = 0, Start = 64 }, + new Partition{ Description = null, Size = 47185920, Name = "untitled", Type = "Apple_HFS", Offset = 2097152, Length = 92160, + Sequence = 1, Start = 4096 }, + new Partition{ Description = null, Size = 84934656, Name = "untitled", Type = "Apple_UNIX_SVR2", Offset = 49283072, Length = 165888, + Sequence = 2, Start = 96256 }, }, // Silverlining 2.2.1 new []{ new Partition{ Description = null, Size = 3072, Name = null, Type = "Apple_Driver", Offset = 32768, Length = 6, Sequence = 0, Start = 64 }, - new Partition{ Description = null, Size = 25088, Name = null, Type = "Apple_Driver", Offset = 98304, Length = 49, - Sequence = 1, Start = 192 }, new Partition{ Description = null, Size = 65536, Name = "Macintosh_SL", Type = "Apple_Driver43", Offset = 32768, Length = 128, - Sequence = 2, Start = 64 }, + Sequence = 1, Start = 64 }, + new Partition{ Description = null, Size = 25088, Name = null, Type = "Apple_Driver", Offset = 98304, Length = 49, + Sequence = 2, Start = 192 }, new Partition{ Description = null, Size = 65536, Name = "Macintosh_SL", Type = "Apple_Driver_ATA", Offset = 98304, Length = 128, Sequence = 3, Start = 192 }, new Partition{ Description = null, Size = 25804800, Name = "Untitled #1", Type = "Apple_HFS", Offset = 163840, Length = 50400, @@ -481,8 +482,7 @@ namespace DiscImageChef.Tests.Partitions filter.Open(location); ImagePlugin image = new VDI(); Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - PartPlugin parts = new DiscImageChef.PartPlugins.AppleMap(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Assert.AreEqual(wanted[i].Length, partitions.Count, testfiles[i]); for(int j = 0; j < partitions.Count; j++) { diff --git a/DiscImageChef.Tests/Partitions/Atari.cs b/DiscImageChef.Tests/Partitions/Atari.cs index dbb7af2c..40034923 100644 --- a/DiscImageChef.Tests/Partitions/Atari.cs +++ b/DiscImageChef.Tests/Partitions/Atari.cs @@ -122,8 +122,7 @@ namespace DiscImageChef.Tests.Partitions filter.Open(location); ImagePlugin image = new VDI(); Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - PartPlugin parts = new DiscImageChef.PartPlugins.AtariPartitions(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Assert.AreEqual(wanted[i].Length, partitions.Count, testfiles[i]); for(int j = 0; j < partitions.Count; j++) { diff --git a/DiscImageChef.Tests/Partitions/BSD.cs b/DiscImageChef.Tests/Partitions/BSD.cs index 494841b9..5daf44a1 100644 --- a/DiscImageChef.Tests/Partitions/BSD.cs +++ b/DiscImageChef.Tests/Partitions/BSD.cs @@ -77,8 +77,7 @@ namespace DiscImageChef.Tests.Partitions filter.Open(location); ImagePlugin image = new VDI(); Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - PartPlugin parts = new DiscImageChef.PartPlugins.BSD(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Assert.AreEqual(wanted[i].Length, partitions.Count, testfiles[i]); for(int j = 0; j < partitions.Count; j++) { diff --git a/DiscImageChef.Tests/Partitions/GPT.cs b/DiscImageChef.Tests/Partitions/GPT.cs index 3e65b4ae..28699d8b 100644 --- a/DiscImageChef.Tests/Partitions/GPT.cs +++ b/DiscImageChef.Tests/Partitions/GPT.cs @@ -91,8 +91,7 @@ namespace DiscImageChef.Tests.Partitions filter.Open(location); ImagePlugin image = new VDI(); Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - PartPlugin parts = new DiscImageChef.PartPlugins.GuidPartitionTable(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Assert.AreEqual(wanted[i].Length, partitions.Count, testfiles[i]); for(int j = 0; j < partitions.Count; j++) { diff --git a/DiscImageChef.Tests/Partitions/MBR.cs b/DiscImageChef.Tests/Partitions/MBR.cs index 21834440..5029bb27 100644 --- a/DiscImageChef.Tests/Partitions/MBR.cs +++ b/DiscImageChef.Tests/Partitions/MBR.cs @@ -573,8 +573,7 @@ namespace DiscImageChef.Tests.Partitions filter.Open(location); ImagePlugin image = new VDI(); Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - PartPlugin parts = new DiscImageChef.PartPlugins.MBR(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Assert.AreEqual(wanted[i].Length, partitions.Count, testfiles[i]); for(int j = 0; j < partitions.Count; j++) { diff --git a/DiscImageChef.Tests/Partitions/MINIX.cs b/DiscImageChef.Tests/Partitions/MINIX.cs index cadf47f0..78527659 100644 --- a/DiscImageChef.Tests/Partitions/MINIX.cs +++ b/DiscImageChef.Tests/Partitions/MINIX.cs @@ -70,8 +70,6 @@ namespace DiscImageChef.Tests.Partitions [Test] public void Test() { - throw new System.NotImplementedException("Partition schemes inside partitions are not yet implemented, and should be tested here."); - /* for(int i = 0; i < testfiles.Length; i++) { string location = Path.Combine(Consts.TestFilesRoot, "partitions", "minix", testfiles[i]); @@ -79,22 +77,21 @@ namespace DiscImageChef.Tests.Partitions filter.Open(location); ImagePlugin image = new VDI(); Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - PartPlugin parts = new DiscImageChef.PartPlugins.BSD(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Assert.AreEqual(wanted[i].Length, partitions.Count, testfiles[i]); for(int j = 0; j < partitions.Count; j++) { // Too chatty //Assert.AreEqual(wanted[i][j].PartitionDescription, partitions[j].PartitionDescription, testfiles[i]); - Assert.AreEqual(wanted[i][j].PartitionLength, partitions[j].PartitionLength, testfiles[i]); - Assert.AreEqual(wanted[i][j].PartitionName, partitions[j].PartitionName, testfiles[i]); - Assert.AreEqual(wanted[i][j].PartitionType, partitions[j].PartitionType, testfiles[i]); - Assert.AreEqual(wanted[i][j].PartitionStart, partitions[j].PartitionStart, testfiles[i]); - Assert.AreEqual(wanted[i][j].PartitionSectors, partitions[j].PartitionSectors, testfiles[i]); - Assert.AreEqual(wanted[i][j].PartitionSequence, partitions[j].PartitionSequence, testfiles[i]); - Assert.AreEqual(wanted[i][j].PartitionStartSector, partitions[j].PartitionStartSector, testfiles[i]); + Assert.AreEqual(wanted[i][j].Size, partitions[j].Size, testfiles[i]); + Assert.AreEqual(wanted[i][j].Name, partitions[j].Name, testfiles[i]); + Assert.AreEqual(wanted[i][j].Type, partitions[j].Type, testfiles[i]); + Assert.AreEqual(wanted[i][j].Offset, partitions[j].Offset, testfiles[i]); + Assert.AreEqual(wanted[i][j].Length, partitions[j].Length, testfiles[i]); + Assert.AreEqual(wanted[i][j].Sequence, partitions[j].Sequence, testfiles[i]); + Assert.AreEqual(wanted[i][j].Start, partitions[j].Start, testfiles[i]); } - }*/ + } } } } diff --git a/DiscImageChef.Tests/Partitions/PC98.cs b/DiscImageChef.Tests/Partitions/PC98.cs index 9cf959aa..c24b0a0c 100644 --- a/DiscImageChef.Tests/Partitions/PC98.cs +++ b/DiscImageChef.Tests/Partitions/PC98.cs @@ -76,8 +76,7 @@ namespace DiscImageChef.Tests.Partitions filter.Open(location); ImagePlugin image = new VDI(); Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - PartPlugin parts = new DiscImageChef.PartPlugins.PC98(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Assert.AreEqual(wanted[i].Length, partitions.Count, testfiles[i]); for(int j = 0; j < partitions.Count; j++) { diff --git a/DiscImageChef.Tests/Partitions/RDB.cs b/DiscImageChef.Tests/Partitions/RDB.cs index 6c06ee6e..d41e1244 100644 --- a/DiscImageChef.Tests/Partitions/RDB.cs +++ b/DiscImageChef.Tests/Partitions/RDB.cs @@ -65,8 +65,8 @@ namespace DiscImageChef.Tests.Partitions Sequence = 2, Start = 345440 }, new Partition{ Description = null, Size = 87392256, Name = "UDH3", Type = "\"DOS\\3\"", Offset = 264257536, Length = 170688, Sequence = 3, Start = 516128 }, - new Partition{ Description = null, Size = 87392256, Name = "UDH4", Type = "\"RES\\86\"", Offset = 351649792, Length = 170688, - Sequence = 4, Start = 686816 }, + new Partition{ Description = null, Size = 87300096, Name = "FAT16", Type = "0x06", Offset = 351663104, Length = 170508, + Sequence = 4, Start = 686842 }, new Partition{ Description = null, Size = 85311488, Name = "UDH5", Type = "\"RES\\86\"", Offset = 439042048, Length = 166624, Sequence = 5, Start = 857504 }, }, @@ -106,8 +106,7 @@ namespace DiscImageChef.Tests.Partitions filter.Open(location); ImagePlugin image = new VDI(); Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); - PartPlugin parts = new DiscImageChef.PartPlugins.AmigaRigidDiskBlock(); - Assert.AreEqual(true, parts.GetInformation(image, out List partitions), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); Assert.AreEqual(wanted[i].Length, partitions.Count, testfiles[i]); for(int j = 0; j < partitions.Count; j++) { diff --git a/DiscImageChef/ChangeLog b/DiscImageChef/ChangeLog index a2693012..7d4d6a19 100644 --- a/DiscImageChef/ChangeLog +++ b/DiscImageChef/ChangeLog @@ -1,3 +1,10 @@ +* Commands/Ls.cs: +* Commands/Analyze.cs: +* Commands/ExtractFiles.cs: + Use generic method to search for partitions, supporting partitions + inside partitions. At the same time SGI DVH is disabled because it + is not working correctly. Fixes #60 + * Commands/Ls.cs: * Commands/ExtractFiles.cs: Adjusted to new API. diff --git a/DiscImageChef/Commands/Analyze.cs b/DiscImageChef/Commands/Analyze.cs index 51f6cdb1..8630ab4f 100644 --- a/DiscImageChef/Commands/Analyze.cs +++ b/DiscImageChef/Commands/Analyze.cs @@ -114,27 +114,10 @@ namespace DiscImageChef.Commands if(options.SearchForPartitions) { - List partitions = new List(); - string partition_scheme = ""; + List partitions = Partitions.GetAll(_imageFormat); + Partitions.AddSchemesToStats(partitions); - // TODO: Solve possibility of multiple partition schemes (CUE + MBR, MBR + RDB, CUE + APM, etc) - foreach(PartPlugin _partplugin in plugins.PartPluginsList.Values) - { - if(_partplugin.GetInformation(_imageFormat, out List _partitions)) - { - partition_scheme = _partplugin.Name; - partitions.AddRange(_partitions); - Core.Statistics.AddPartition(_partplugin.Name); - } - } - - if(_imageFormat.ImageHasPartitions()) - { - partition_scheme = _imageFormat.GetImageFormat(); - partitions.AddRange(_imageFormat.GetPartitions()); - } - - if(partition_scheme == "") + if(partitions.Count == 0) { DicConsole.DebugWriteLine("Analyze command", "No partitions found"); if(!options.SearchForFilesystems) @@ -146,7 +129,6 @@ namespace DiscImageChef.Commands } else { - DicConsole.WriteLine("Partition scheme identified as {0}", partition_scheme); DicConsole.WriteLine("{0} partitions found.", partitions.Count); for(int i = 0; i < partitions.Count; i++) @@ -157,6 +139,7 @@ namespace DiscImageChef.Commands DicConsole.WriteLine("Partition type: {0}", partitions[i].Type); DicConsole.WriteLine("Partition start: sector {0}, byte {1}", partitions[i].Start, partitions[i].Offset); DicConsole.WriteLine("Partition length: {0} sectors, {1} bytes", partitions[i].Length, partitions[i].Size); + DicConsole.WriteLine("Partition scheme: {0}", partitions[i].Scheme); DicConsole.WriteLine("Partition description:"); DicConsole.WriteLine(partitions[i].Description); diff --git a/DiscImageChef/Commands/ExtractFiles.cs b/DiscImageChef/Commands/ExtractFiles.cs index 70ba442f..a38dbd4f 100644 --- a/DiscImageChef/Commands/ExtractFiles.cs +++ b/DiscImageChef/Commands/ExtractFiles.cs @@ -120,32 +120,13 @@ namespace DiscImageChef.Commands return; } - List partitions = new List(); - string partition_scheme = ""; + List partitions = Partitions.GetAll(_imageFormat); + Partitions.AddSchemesToStats(partitions); - // TODO: Solve possibility of multiple partition schemes (CUE + MBR, MBR + RDB, CUE + APM, etc) - foreach(PartPlugin _partplugin in plugins.PartPluginsList.Values) - { - List _partitions; - if(_partplugin.GetInformation(_imageFormat, out _partitions)) - { - partition_scheme = _partplugin.Name; - partitions.AddRange(_partitions); - Core.Statistics.AddPartition(_partplugin.Name); - } - } - - if(_imageFormat.ImageHasPartitions()) - { - partition_scheme = _imageFormat.GetImageFormat(); - partitions.AddRange(_imageFormat.GetPartitions()); - } - - if(partition_scheme == "") + if(partitions.Count == 0) DicConsole.DebugWriteLine("Extract-Files command", "No partitions found"); else { - DicConsole.WriteLine("Partition scheme identified as {0}", partition_scheme); DicConsole.WriteLine("{0} partitions found.", partitions.Count); for(int i = 0; i < partitions.Count; i++) diff --git a/DiscImageChef/Commands/Ls.cs b/DiscImageChef/Commands/Ls.cs index 587726c4..bcfeb620 100644 --- a/DiscImageChef/Commands/Ls.cs +++ b/DiscImageChef/Commands/Ls.cs @@ -109,32 +109,13 @@ namespace DiscImageChef.Commands return; } - List partitions = new List(); - string partition_scheme = ""; + List partitions = Partitions.GetAll(_imageFormat); + Partitions.AddSchemesToStats(partitions); - // TODO: Solve possibility of multiple partition schemes (CUE + MBR, MBR + RDB, CUE + APM, etc) - foreach(PartPlugin _partplugin in plugins.PartPluginsList.Values) - { - List _partitions; - if(_partplugin.GetInformation(_imageFormat, out _partitions)) - { - partition_scheme = _partplugin.Name; - partitions.AddRange(_partitions); - Core.Statistics.AddPartition(_partplugin.Name); - } - } - - if(_imageFormat.ImageHasPartitions()) - { - partition_scheme = _imageFormat.GetImageFormat(); - partitions.AddRange(_imageFormat.GetPartitions()); - } - - if(partition_scheme == "") + if(partitions.Count == 0) DicConsole.DebugWriteLine("Ls command", "No partitions found"); else { - DicConsole.WriteLine("Partition scheme identified as {0}", partition_scheme); DicConsole.WriteLine("{0} partitions found.", partitions.Count); for(int i = 0; i < partitions.Count; i++)