diff --git a/DiscImageChef.CommonTypes/Partition.cs b/DiscImageChef.CommonTypes/Partition.cs index 930b20d9..3a0dfc69 100644 --- a/DiscImageChef.CommonTypes/Partition.cs +++ b/DiscImageChef.CommonTypes/Partition.cs @@ -55,6 +55,8 @@ namespace DiscImageChef.CommonTypes public string Description; /// LBA of last partition sector public ulong End { get { return Start + Length - 1; }} + /// Name of partition scheme that contains this partition + public string Scheme; } } diff --git a/DiscImageChef.Partitions/Acorn.cs b/DiscImageChef.Partitions/Acorn.cs index 8dad9c5d..14773ceb 100644 --- a/DiscImageChef.Partitions/Acorn.cs +++ b/DiscImageChef.Partitions/Acorn.cs @@ -119,12 +119,15 @@ namespace DiscImageChef.PartPlugins foreach(LinuxEntry entry in table.entries) { - Partition part = new Partition(); - part.Start = (ulong)(mapSector + entry.start); + Partition part = new Partition + { + Start = (ulong)(mapSector + entry.start), + Size = entry.size, + Length = (ulong)(entry.size * sector.Length), + Sequence = counter, + Scheme = Name + }; part.Offset = part.Start * (ulong)sector.Length; - part.Size = entry.size; - part.Length = (ulong)(entry.size * sector.Length); - part.Sequence = counter; if(entry.magic == LINUX_MAGIC || entry.magic == SWAP_MAGIC) { partitions.Add(part); @@ -145,13 +148,16 @@ namespace DiscImageChef.PartPlugins { foreach(RiscIxEntry entry in table.partitions) { - Partition part = new Partition(); - part.Start = (ulong)(mapSector + entry.start); + Partition part = new Partition + { + Start = (ulong)(mapSector + entry.start), + Size = entry.length, + Length = (ulong)(entry.length * sector.Length), + Name = StringHandlers.CToString(entry.name, Encoding.GetEncoding("iso-8859-1")), + Sequence = counter, + Scheme = Name + }; part.Offset = part.Start * (ulong)sector.Length; - part.Size = entry.length; - part.Length = (ulong)(entry.length * sector.Length); - part.Name = StringHandlers.CToString(entry.name, Encoding.GetEncoding("iso-8859-1")); - part.Sequence = counter; if(entry.length > 0) { partitions.Add(part); diff --git a/DiscImageChef.Partitions/AppleMap.cs b/DiscImageChef.Partitions/AppleMap.cs index d368fa3d..a7dc7476 100644 --- a/DiscImageChef.Partitions/AppleMap.cs +++ b/DiscImageChef.Partitions/AppleMap.cs @@ -161,6 +161,7 @@ namespace DiscImageChef.PartPlugins Sequence = sequence, Offset = old_entry.pdSize * ddm.sbBlockSize, Start = (old_entry.pdSize * ddm.sbBlockSize) / sector_size, + Scheme = Name }; if(old_entry.pdFSID == HFS_MAGIC_OLD) @@ -279,7 +280,8 @@ namespace DiscImageChef.PartPlugins Offset = entry.start * entry_size, Size = entry.sectors * entry_size, Start = (entry.start * entry_size) / sector_size, - Length = (entry.sectors * entry_size) / sector_size + Length = (entry.sectors * entry_size) / sector_size, + Scheme = Name }; sb.AppendLine("Partition flags:"); if(flags.HasFlag(AppleMapFlags.Valid)) diff --git a/DiscImageChef.Partitions/Atari.cs b/DiscImageChef.Partitions/Atari.cs index af169922..7383c064 100644 --- a/DiscImageChef.Partitions/Atari.cs +++ b/DiscImageChef.Partitions/Atari.cs @@ -148,20 +148,22 @@ namespace DiscImageChef.PartPlugins if(sectorSize == 2448 || sectorSize == 2352) sectorSize = 2048; - CommonTypes.Partition part = new CommonTypes.Partition(); - part.Size = table.entries[i].length * sectorSize; - part.Length = table.entries[i].length; - part.Sequence = partitionSequence; - part.Name = ""; - part.Offset = table.entries[i].start * sectorSize; - part.Start = table.entries[i].start; - byte[] partType = new byte[3]; partType[0] = (byte)((type & 0xFF0000) >> 16); partType[1] = (byte)((type & 0x00FF00) >> 8); partType[2] = (byte)(type & 0x0000FF); - part.Type = Encoding.ASCII.GetString(partType); + CommonTypes.Partition part = new CommonTypes.Partition + { + Size = table.entries[i].length * sectorSize, + Length = table.entries[i].length, + Sequence = partitionSequence, + Name = "", + Offset = table.entries[i].start * sectorSize, + Start = table.entries[i].start, + Type = Encoding.ASCII.GetString(partType), + Scheme = Name + }; switch(type) { case TypeGEMDOS: @@ -237,20 +239,22 @@ namespace DiscImageChef.PartPlugins if(sectorSize == 2448 || sectorSize == 2352) sectorSize = 2048; - CommonTypes.Partition part = new CommonTypes.Partition(); - part.Size = extendedTable.entries[j].length * sectorSize; - part.Length = extendedTable.entries[j].length; - part.Sequence = partitionSequence; - part.Name = ""; - part.Offset = extendedTable.entries[j].start * sectorSize; - part.Start = extendedTable.entries[j].start; - byte[] partType = new byte[3]; partType[0] = (byte)((extendedType & 0xFF0000) >> 16); partType[1] = (byte)((extendedType & 0x00FF00) >> 8); partType[2] = (byte)(extendedType & 0x0000FF); - part.Type = Encoding.ASCII.GetString(partType); + CommonTypes.Partition part = new CommonTypes.Partition + { + Size = extendedTable.entries[j].length * sectorSize, + Length = extendedTable.entries[j].length, + Sequence = partitionSequence, + Name = "", + Offset = extendedTable.entries[j].start * sectorSize, + Start = extendedTable.entries[j].start, + Type = Encoding.ASCII.GetString(partType), + Scheme = Name + }; switch(extendedType) { case TypeGEMDOS: @@ -317,20 +321,22 @@ namespace DiscImageChef.PartPlugins if(sectorSize == 2448 || sectorSize == 2352) sectorSize = 2048; - CommonTypes.Partition part = new CommonTypes.Partition(); - part.Size = table.icdEntries[i].length * sectorSize; - part.Length = table.icdEntries[i].length; - part.Sequence = partitionSequence; - part.Name = ""; - part.Offset = table.icdEntries[i].start * sectorSize; - part.Start = table.icdEntries[i].start; - byte[] partType = new byte[3]; partType[0] = (byte)((type & 0xFF0000) >> 16); partType[1] = (byte)((type & 0x00FF00) >> 8); partType[2] = (byte)(type & 0x0000FF); - part.Type = Encoding.ASCII.GetString(partType); + CommonTypes.Partition part = new CommonTypes.Partition + { + Size = table.icdEntries[i].length * sectorSize, + Length = table.icdEntries[i].length, + Sequence = partitionSequence, + Name = "", + Offset = table.icdEntries[i].start * sectorSize, + Start = table.icdEntries[i].start, + Type = Encoding.ASCII.GetString(partType), + Scheme = Name + }; switch(type) { case TypeGEMDOS: diff --git a/DiscImageChef.Partitions/BSD.cs b/DiscImageChef.Partitions/BSD.cs index cf8e1add..39389d52 100644 --- a/DiscImageChef.Partitions/BSD.cs +++ b/DiscImageChef.Partitions/BSD.cs @@ -76,13 +76,16 @@ namespace DiscImageChef.PartPlugins foreach(BSDPartition entry in dl.d_partitions) { - Partition part = new Partition(); - part.Start = entry.p_offset; - part.Offset = (entry.p_offset * dl.d_secsize); - part.Size = entry.p_size; - part.Length = (entry.p_size * dl.d_secsize); - part.Type = fsTypeToString(entry.p_fstype); - part.Sequence = counter; + Partition part = new Partition + { + Start = entry.p_offset, + Offset = (entry.p_offset * dl.d_secsize), + Size = entry.p_size, + Length = (entry.p_size * dl.d_secsize), + Type = fsTypeToString(entry.p_fstype), + Sequence = counter, + Scheme = Name + }; if(entry.p_fstype != fsType.Unused) { partitions.Add(part); diff --git a/DiscImageChef.Partitions/DEC.cs b/DiscImageChef.Partitions/DEC.cs index 69c08f80..1515868a 100644 --- a/DiscImageChef.Partitions/DEC.cs +++ b/DiscImageChef.Partitions/DEC.cs @@ -70,12 +70,15 @@ namespace DiscImageChef.PartPlugins foreach(DECPartition entry in table.pt_part) { - Partition part = new Partition(); - part.Start = entry.pi_blkoff; - part.Offset = (ulong)(entry.pi_blkoff * sector.Length); - part.Size = (ulong)entry.pi_nblocks; - part.Length = (ulong)(entry.pi_nblocks * sector.Length); - part.Sequence = counter; + Partition part = new Partition + { + Start = entry.pi_blkoff, + Offset = (ulong)(entry.pi_blkoff * sector.Length), + Size = (ulong)entry.pi_nblocks, + Length = (ulong)(entry.pi_nblocks * sector.Length), + Sequence = counter, + Scheme = Name + }; if(part.Size > 0) { partitions.Add(part); diff --git a/DiscImageChef.Partitions/DragonFlyBSD.cs b/DiscImageChef.Partitions/DragonFlyBSD.cs index 9cd7bcd7..7f0cb951 100644 --- a/DiscImageChef.Partitions/DragonFlyBSD.cs +++ b/DiscImageChef.Partitions/DragonFlyBSD.cs @@ -70,17 +70,20 @@ namespace DiscImageChef.PartPlugins foreach(Partition64 entry in disklabel.d_partitions) { - Partition part = new Partition(); - part.Start = entry.p_boffset; - part.Offset = entry.p_boffset; - part.Size = entry.p_bsize; - part.Length = entry.p_bsize; + Partition part = new Partition + { + Start = entry.p_boffset, + Offset = entry.p_boffset, + Size = entry.p_bsize, + Length = entry.p_bsize, + Name = entry.p_stor_uuid.ToString(), + Sequence = counter, + Scheme = Name + }; if((BSD.fsType)entry.p_fstype == BSD.fsType.Other) part.Type = entry.p_type_uuid.ToString(); else part.Type = BSD.fsTypeToString((BSD.fsType)entry.p_fstype); - part.Name = entry.p_stor_uuid.ToString(); - part.Sequence = counter; if(entry.p_bsize > 0 && entry.p_boffset > 0) { partitions.Add(part); diff --git a/DiscImageChef.Partitions/GPT.cs b/DiscImageChef.Partitions/GPT.cs index 14809762..6fcb1cfe 100644 --- a/DiscImageChef.Partitions/GPT.cs +++ b/DiscImageChef.Partitions/GPT.cs @@ -129,15 +129,18 @@ namespace DiscImageChef.PartPlugins if(entry.startLBA > imagePlugin.GetSectors() || entry.endLBA > imagePlugin.GetSectors()) return false; - CommonTypes.Partition part = new CommonTypes.Partition(); - part.Description = string.Format("ID: {0}", entry.partitionId); - part.Size = (entry.endLBA - entry.startLBA + 1) * imagePlugin.GetSectorSize(); - part.Name = entry.name; - part.Length = (entry.endLBA - entry.startLBA + 1); - part.Sequence = pseq++; - part.Offset = entry.startLBA * imagePlugin.GetSectorSize(); - part.Start = entry.startLBA; - part.Type = GetGuidTypeName(entry.partitionType); + CommonTypes.Partition part = new CommonTypes.Partition + { + Description = string.Format("ID: {0}", entry.partitionId), + Size = (entry.endLBA - entry.startLBA + 1) * imagePlugin.GetSectorSize(), + Name = entry.name, + Length = (entry.endLBA - entry.startLBA + 1), + Sequence = pseq++, + Offset = entry.startLBA * imagePlugin.GetSectorSize(), + Start = entry.startLBA, + Type = GetGuidTypeName(entry.partitionType), + Scheme = Name + }; DicConsole.DebugWriteLine("GPT Plugin", "part.PartitionType = {0}", part.Type); partitions.Add(part); } diff --git a/DiscImageChef.Partitions/Human68k.cs b/DiscImageChef.Partitions/Human68k.cs index eda90d63..1713357d 100644 --- a/DiscImageChef.Partitions/Human68k.cs +++ b/DiscImageChef.Partitions/Human68k.cs @@ -98,13 +98,16 @@ namespace DiscImageChef.PartPlugins DicConsole.DebugWriteLine("Human68k plugin", "entry.length = {0}", entry.length); DicConsole.DebugWriteLine("Human68k plugin", "sectsPerUnit = {0} {1}", sectsPerUnit, imagePlugin.GetSectorSize()); - Partition part = new Partition(); - part.Start = (entry.stateStart & 0xFFFFFF) * sectsPerUnit; + Partition part = new Partition + { + Start = (entry.stateStart & 0xFFFFFF) * sectsPerUnit, + Length = entry.length * sectsPerUnit, + Type = StringHandlers.CToString(entry.name, Encoding.GetEncoding(932)), + Sequence = counter, + Scheme = Name + }; part.Offset = part.Start * (ulong)sector.Length; - part.Length = entry.length * sectsPerUnit; part.Size = part.Length * (ulong)sector.Length; - part.Type = StringHandlers.CToString(entry.name, Encoding.GetEncoding(932)); - part.Sequence = counter; if(entry.length > 0) { partitions.Add(part); diff --git a/DiscImageChef.Partitions/MBR.cs b/DiscImageChef.Partitions/MBR.cs index db803712..c62ec3c4 100644 --- a/DiscImageChef.Partitions/MBR.cs +++ b/DiscImageChef.Partitions/MBR.cs @@ -145,19 +145,20 @@ namespace DiscImageChef.PartPlugins foreach(BSD.BSDPartition bsdPartition in bsdDisklabel.d_partitions) { - CommonTypes.Partition part = new CommonTypes.Partition(); + CommonTypes.Partition part = new CommonTypes.Partition + { + Length = bsdPartition.p_size, + Start = bsdPartition.p_offset, + Size = bsdPartition.p_size * bsdDisklabel.d_secsize, + Offset = bsdPartition.p_offset * bsdDisklabel.d_secsize, - part.Length = bsdPartition.p_size; - part.Start = bsdPartition.p_offset; - part.Size = bsdPartition.p_size * bsdDisklabel.d_secsize; - part.Offset = bsdPartition.p_offset * bsdDisklabel.d_secsize; - - part.Type = string.Format("BSD: {0}", bsdPartition.p_fstype); - part.Name = BSD.fsTypeToString(bsdPartition.p_fstype); - - part.Sequence = counter; - part.Description = "Partition inside a BSD disklabel."; + Type = string.Format("BSD: {0}", bsdPartition.p_fstype), + Name = BSD.fsTypeToString(bsdPartition.p_fstype), + Sequence = counter, + Description = "Partition inside a BSD disklabel.", + Scheme = Name + }; if(bsdPartition.p_fstype != BSD.fsType.Unused) { partitions.Add(part); @@ -235,24 +236,26 @@ namespace DiscImageChef.PartPlugins // TODO: What if number of slices overlaps sector (>23)? for(int j = 0; j < vtoc.slices; j++) { - UNIX.UNIXVTOCEntry vtoc_ent = new UNIX.UNIXVTOCEntry(); - - vtoc_ent.tag = (DiscImageChef.PartPlugins.UNIX.UNIX_TAG)BitConverter.ToUInt16(unix_dl_sector, 160 + vtocoffset + j * 12 + 0); // 160/232 + j*12 - vtoc_ent.flags = BitConverter.ToUInt16(unix_dl_sector, 160 + vtocoffset + j * 12 + 2); // 162/234 + j*12 - vtoc_ent.start = BitConverter.ToUInt32(unix_dl_sector, 160 + vtocoffset + j * 12 + 6); // 166/238 + j*12 - vtoc_ent.length = BitConverter.ToUInt32(unix_dl_sector, 160 + vtocoffset + j * 12 + 10); // 170/242 + j*12 - + UNIX.UNIXVTOCEntry vtoc_ent = new UNIX.UNIXVTOCEntry + { + tag = (UNIX.UNIX_TAG)BitConverter.ToUInt16(unix_dl_sector, 160 + vtocoffset + j * 12 + 0), // 160/232 + j*12 + flags = BitConverter.ToUInt16(unix_dl_sector, 160 + vtocoffset + j * 12 + 2), // 162/234 + j*12 + start = BitConverter.ToUInt32(unix_dl_sector, 160 + vtocoffset + j * 12 + 6), // 166/238 + j*12 + length = BitConverter.ToUInt32(unix_dl_sector, 160 + vtocoffset + j * 12 + 10) // 170/242 + j*12 + }; if((vtoc_ent.flags & 0x200) == 0x200 && vtoc_ent.tag != UNIX.UNIX_TAG.EMPTY && vtoc_ent.tag != UNIX.UNIX_TAG.WHOLE) { - CommonTypes.Partition part = new CommonTypes.Partition(); - // TODO: Check if device bps == disklabel bps - part.Start = vtoc_ent.start; - part.Length = vtoc_ent.length; - part.Offset = vtoc_ent.start * dl.bps; - part.Size = vtoc_ent.length * dl.bps; - part.Sequence = counter; - part.Type = string.Format("UNIX: {0}", UNIX.decodeUNIXTAG(vtoc_ent.tag, isNewDL)); - + CommonTypes.Partition part = new CommonTypes.Partition + { + // TODO: Check if device bps == disklabel bps + Start = vtoc_ent.start, + Length = vtoc_ent.length, + Offset = vtoc_ent.start * dl.bps, + Size = vtoc_ent.length * dl.bps, + Sequence = counter, + Type = string.Format("UNIX: {0}", UNIX.decodeUNIXTAG(vtoc_ent.tag, isNewDL)), + Scheme = Name + }; string info = ""; if((vtoc_ent.flags & 0x01) == 0x01) @@ -282,14 +285,16 @@ namespace DiscImageChef.PartPlugins { for(int j = 0; j < 16; j++) { - CommonTypes.Partition part = new CommonTypes.Partition(); - part.Start = BitConverter.ToUInt32(disklabel_sector, 68 + j * 12 + 4); - part.Length = BitConverter.ToUInt32(disklabel_sector, 68 + j * 12 + 8); + CommonTypes.Partition part = new CommonTypes.Partition + { + Start = BitConverter.ToUInt32(disklabel_sector, 68 + j * 12 + 4), + Length = BitConverter.ToUInt32(disklabel_sector, 68 + j * 12 + 8), + Description = "Solaris slice.", + Scheme = Name, + Sequence = counter + }; part.Offset = part.Start * imagePlugin.GetSectorSize(); // 68+4+j*12 part.Size = part.Length * imagePlugin.GetSectorSize(); // 68+8+j*12 - part.Description = "Solaris slice."; - - part.Sequence = counter; if(part.Size > 0) { @@ -313,15 +318,18 @@ namespace DiscImageChef.PartPlugins if(type == 0x81) { - CommonTypes.Partition part = new CommonTypes.Partition(); minix_subs = true; - part.Description = "Minix subpartition"; - part.Type = "Minix"; - part.Start = BitConverter.ToUInt32(disklabel_sector, 0x1BE + j * 16 + 8); - part.Length = BitConverter.ToUInt32(disklabel_sector, 0x1BE + j * 16 + 12); + CommonTypes.Partition part = new CommonTypes.Partition + { + Description = "Minix subpartition", + Type = "Minix", + Start = BitConverter.ToUInt32(disklabel_sector, 0x1BE + j * 16 + 8), + Length = BitConverter.ToUInt32(disklabel_sector, 0x1BE + j * 16 + 12), + Sequence = counter, + Scheme = Name + }; part.Offset = part.Start * imagePlugin.GetSectorSize(); part.Size = part.Length * imagePlugin.GetSectorSize(); - part.Sequence = counter; partitions.Add(part); counter++; } @@ -362,6 +370,7 @@ namespace DiscImageChef.PartPlugins part.Name = decodeMBRType(entry.type); part.Sequence = counter; part.Description = entry.status == 0x80 ? "Partition is bootable." : ""; + part.Scheme = Name; counter++; @@ -444,18 +453,18 @@ namespace DiscImageChef.PartPlugins foreach(BSD.BSDPartition bsdPartition in bsdDisklabel.d_partitions) { - CommonTypes.Partition part = new CommonTypes.Partition(); - - part.Length = bsdPartition.p_size; - part.Start = bsdPartition.p_offset; - part.Size = bsdPartition.p_size * bsdDisklabel.d_secsize; - part.Offset = bsdPartition.p_offset * bsdDisklabel.d_secsize; - - part.Type = string.Format("BSD: {0}", bsdPartition.p_fstype); - part.Name = BSD.fsTypeToString(bsdPartition.p_fstype); - - part.Sequence = counter; - part.Description = "Partition inside a BSD disklabel."; + CommonTypes.Partition part = new CommonTypes.Partition + { + Length = bsdPartition.p_size, + Start = bsdPartition.p_offset, + Size = bsdPartition.p_size * bsdDisklabel.d_secsize, + Offset = bsdPartition.p_offset * bsdDisklabel.d_secsize, + Type = string.Format("BSD: {0}", bsdPartition.p_fstype), + Name = BSD.fsTypeToString(bsdPartition.p_fstype), + Sequence = counter, + Description = "Partition inside a BSD disklabel.", + Scheme = Name + }; if(bsdPartition.p_fstype != BSD.fsType.Unused) { @@ -534,24 +543,26 @@ namespace DiscImageChef.PartPlugins // TODO: What if number of slices overlaps sector (>23)? for(int j = 0; j < vtoc.slices; j++) { - UNIX.UNIXVTOCEntry vtoc_ent = new UNIX.UNIXVTOCEntry(); - - vtoc_ent.tag = (DiscImageChef.PartPlugins.UNIX.UNIX_TAG)BitConverter.ToUInt16(unix_dl_sector, 160 + vtocoffset + j * 12 + 0); // 160/232 + j*12 - vtoc_ent.flags = BitConverter.ToUInt16(unix_dl_sector, 160 + vtocoffset + j * 12 + 2); // 162/234 + j*12 - vtoc_ent.start = BitConverter.ToUInt32(unix_dl_sector, 160 + vtocoffset + j * 12 + 6); // 166/238 + j*12 - vtoc_ent.length = BitConverter.ToUInt32(unix_dl_sector, 160 + vtocoffset + j * 12 + 10); // 170/242 + j*12 - + UNIX.UNIXVTOCEntry vtoc_ent = new UNIX.UNIXVTOCEntry + { + tag = (UNIX.UNIX_TAG)BitConverter.ToUInt16(unix_dl_sector, 160 + vtocoffset + j * 12 + 0), // 160/232 + j*12 + flags = BitConverter.ToUInt16(unix_dl_sector, 160 + vtocoffset + j * 12 + 2), // 162/234 + j*12 + start = BitConverter.ToUInt32(unix_dl_sector, 160 + vtocoffset + j * 12 + 6), // 166/238 + j*12 + length = BitConverter.ToUInt32(unix_dl_sector, 160 + vtocoffset + j * 12 + 10) // 170/242 + j*12 + }; if((vtoc_ent.flags & 0x200) == 0x200 && vtoc_ent.tag != UNIX.UNIX_TAG.EMPTY && vtoc_ent.tag != UNIX.UNIX_TAG.WHOLE) { - CommonTypes.Partition part = new CommonTypes.Partition(); - // TODO: Check if device bps == disklabel bps - part.Start = vtoc_ent.start; - part.Length = vtoc_ent.length; - part.Offset = vtoc_ent.start * dl.bps; - part.Size = vtoc_ent.length * dl.bps; - part.Sequence = counter; - part.Type = string.Format("UNIX: {0}", UNIX.decodeUNIXTAG(vtoc_ent.tag, isNewDL)); - + CommonTypes.Partition part = new CommonTypes.Partition + { + // TODO: Check if device bps == disklabel bps + Start = vtoc_ent.start, + Length = vtoc_ent.length, + Offset = vtoc_ent.start * dl.bps, + Size = vtoc_ent.length * dl.bps, + Sequence = counter, + Type = string.Format("UNIX: {0}", UNIX.decodeUNIXTAG(vtoc_ent.tag, isNewDL)), + Scheme = Name + }; string info = ""; if((vtoc_ent.flags & 0x01) == 0x01) @@ -581,14 +592,16 @@ namespace DiscImageChef.PartPlugins { for(int j = 0; j < 16; j++) { - CommonTypes.Partition part = new CommonTypes.Partition(); - part.Start = BitConverter.ToUInt32(disklabel_sector, 68 + j * 12 + 4); - part.Length = BitConverter.ToUInt32(disklabel_sector, 68 + j * 12 + 8); + CommonTypes.Partition part = new CommonTypes.Partition + { + Start = BitConverter.ToUInt32(disklabel_sector, 68 + j * 12 + 4), + Length = BitConverter.ToUInt32(disklabel_sector, 68 + j * 12 + 8), + Description = "Solaris slice.", + Scheme = Name, + Sequence = counter + }; part.Offset = part.Start * imagePlugin.GetSectorSize(); // 68+4+j*12 part.Size = part.Length * imagePlugin.GetSectorSize(); // 68+8+j*12 - part.Description = "Solaris slice."; - - part.Sequence = counter; if(part.Size > 0) { @@ -612,15 +625,18 @@ namespace DiscImageChef.PartPlugins if(type == 0x81) { - CommonTypes.Partition part = new CommonTypes.Partition(); + CommonTypes.Partition part = new CommonTypes.Partition + { + Description = "Minix subpartition", + Type = "Minix", + Start = BitConverter.ToUInt32(disklabel_sector, 0x1BE + j * 16 + 8), + Length = BitConverter.ToUInt32(disklabel_sector, 0x1BE + j * 16 + 12), + Sequence = counter, + Scheme = Name + }; minix_subs = true; - part.Description = "Minix subpartition"; - part.Type = "Minix"; - part.Start = BitConverter.ToUInt32(disklabel_sector, 0x1BE + j * 16 + 8); - part.Length = BitConverter.ToUInt32(disklabel_sector, 0x1BE + j * 16 + 12); part.Offset = part.Start * imagePlugin.GetSectorSize(); part.Size = part.Length * imagePlugin.GetSectorSize(); - part.Sequence = counter; partitions.Add(part); counter++; } @@ -662,6 +678,7 @@ namespace DiscImageChef.PartPlugins part.Name = decodeMBRType(entry2.type); part.Sequence = counter; part.Description = entry2.status == 0x80 ? "Partition is bootable." : ""; + part.Scheme = Name; counter++; diff --git a/DiscImageChef.Partitions/NeXT.cs b/DiscImageChef.Partitions/NeXT.cs index e2f36bd5..678e6421 100644 --- a/DiscImageChef.Partitions/NeXT.cs +++ b/DiscImageChef.Partitions/NeXT.cs @@ -161,7 +161,8 @@ namespace DiscImageChef.PartPlugins Sequence = (ulong)i, Name = StringHandlers.CToString(label.dl_dt.d_partitions[i].p_mountpt), Length = (ulong)((label.dl_dt.d_partitions[i].p_size * label.dl_dt.d_secsize) / sector_size), - Start = (ulong)(((label.dl_dt.d_partitions[i].p_base + label.dl_dt.d_front) * label.dl_dt.d_secsize) / sector_size) + Start = (ulong)(((label.dl_dt.d_partitions[i].p_base + label.dl_dt.d_front) * label.dl_dt.d_secsize) / sector_size), + Scheme = Name }; if(part.Start + part.Length > imagePlugin.ImageInfo.sectors) diff --git a/DiscImageChef.Partitions/PC98.cs b/DiscImageChef.Partitions/PC98.cs index ab6c0bbe..d4f4a995 100644 --- a/DiscImageChef.Partitions/PC98.cs +++ b/DiscImageChef.Partitions/PC98.cs @@ -76,14 +76,17 @@ namespace DiscImageChef.PartPlugins entry.dp_ecyl > 0) { - Partition part = new Partition(); - part.Start = CHStoLBA(entry.dp_scyl, entry.dp_shd, entry.dp_ssect); + Partition part = new Partition + { + Start = CHStoLBA(entry.dp_scyl, entry.dp_shd, entry.dp_ssect), + Type = string.Format("{0}", (entry.dp_sid << 8) | entry.dp_mid), + Name = StringHandlers.CToString(entry.dp_name, Encoding.GetEncoding(932)), + Sequence = counter, + Scheme = Name + }; part.Offset = part.Start * imagePlugin.GetSectorSize(); part.Length = CHStoLBA(entry.dp_ecyl, entry.dp_ehd, entry.dp_esect) - part.Start; part.Size = part.Length * imagePlugin.GetSectorSize(); - part.Type = string.Format("{0}", (entry.dp_sid << 8) | entry.dp_mid); - part.Name = StringHandlers.CToString(entry.dp_name, Encoding.GetEncoding(932)); - part.Sequence = counter; if((entry.dp_sid & 0x7F) == 0x44 && (entry.dp_mid & 0x7F) == 0x14 && diff --git a/DiscImageChef.Partitions/RDB.cs b/DiscImageChef.Partitions/RDB.cs index ebd1c490..1dcb648c 100644 --- a/DiscImageChef.Partitions/RDB.cs +++ b/DiscImageChef.Partitions/RDB.cs @@ -1072,14 +1072,15 @@ namespace DiscImageChef.PartPlugins DicConsole.DebugWriteLine("Amiga RDB plugin", "Found BadBlock block"); - BadBlockList chainEntry = new BadBlockList(); - chainEntry.magic = BigEndianBitConverter.ToUInt32(sector, 0x00); - chainEntry.size = BigEndianBitConverter.ToUInt32(sector, 0x04); - chainEntry.checksum = BigEndianBitConverter.ToInt32(sector, 0x08); - chainEntry.targetID = BigEndianBitConverter.ToUInt32(sector, 0x0C); - chainEntry.next_ptr = BigEndianBitConverter.ToUInt32(sector, 0x10); - chainEntry.reserved = BigEndianBitConverter.ToUInt32(sector, 0x14); - + BadBlockList chainEntry = new BadBlockList + { + magic = BigEndianBitConverter.ToUInt32(sector, 0x00), + size = BigEndianBitConverter.ToUInt32(sector, 0x04), + checksum = BigEndianBitConverter.ToInt32(sector, 0x08), + targetID = BigEndianBitConverter.ToUInt32(sector, 0x0C), + next_ptr = BigEndianBitConverter.ToUInt32(sector, 0x10), + reserved = BigEndianBitConverter.ToUInt32(sector, 0x14) + }; ulong entries = (chainEntry.size - 6) / 2; chainEntry.blockPairs = new BadBlockEntry[entries]; @@ -1118,57 +1119,62 @@ namespace DiscImageChef.PartPlugins DicConsole.DebugWriteLine("Amiga RDB plugin", "Found PartitionEntry block"); - PartitionEntry partEntry = new PartitionEntry(); - partEntry.dosEnvVec = new DOSEnvironmentVector(); + PartitionEntry partEntry = new PartitionEntry + { + magic = BigEndianBitConverter.ToUInt32(sector, 0x00), + size = BigEndianBitConverter.ToUInt32(sector, 0x04), + checksum = BigEndianBitConverter.ToInt32(sector, 0x08), + targetID = BigEndianBitConverter.ToUInt32(sector, 0x0C), + next_ptr = BigEndianBitConverter.ToUInt32(sector, 0x10), + flags = BigEndianBitConverter.ToUInt32(sector, 0x14), + reserved1 = BigEndianBitConverter.ToUInt32(sector, 0x18), + reserved2 = BigEndianBitConverter.ToUInt32(sector, 0x1C), + devFlags = BigEndianBitConverter.ToUInt32(sector, 0x20), + driveNameLen = sector[0x24], + reserved3 = BigEndianBitConverter.ToUInt32(sector, 0x44), + reserved4 = BigEndianBitConverter.ToUInt32(sector, 0x48), + reserved5 = BigEndianBitConverter.ToUInt32(sector, 0x4C), + reserved6 = BigEndianBitConverter.ToUInt32(sector, 0x50), + reserved7 = BigEndianBitConverter.ToUInt32(sector, 0x54), + reserved8 = BigEndianBitConverter.ToUInt32(sector, 0x58), + reserved9 = BigEndianBitConverter.ToUInt32(sector, 0x5C), + reserved10 = BigEndianBitConverter.ToUInt32(sector, 0x60), + reserved11 = BigEndianBitConverter.ToUInt32(sector, 0x64), + reserved12 = BigEndianBitConverter.ToUInt32(sector, 0x68), + reserved13 = BigEndianBitConverter.ToUInt32(sector, 0x6C), + reserved14 = BigEndianBitConverter.ToUInt32(sector, 0x70), + reserved15 = BigEndianBitConverter.ToUInt32(sector, 0x74), + reserved16 = BigEndianBitConverter.ToUInt32(sector, 0x78), + reserved17 = BigEndianBitConverter.ToUInt32(sector, 0x7C), + + dosEnvVec = new DOSEnvironmentVector + { + size = BigEndianBitConverter.ToUInt32(sector, 0x80), + block_size = BigEndianBitConverter.ToUInt32(sector, 0x84), + sec_org = BigEndianBitConverter.ToUInt32(sector, 0x88), + surfaces = BigEndianBitConverter.ToUInt32(sector, 0x8C), + spb = BigEndianBitConverter.ToUInt32(sector, 0x90), + bpt = BigEndianBitConverter.ToUInt32(sector, 0x94), + reservedblocks = BigEndianBitConverter.ToUInt32(sector, 0x98), + prealloc = BigEndianBitConverter.ToUInt32(sector, 0x9C), + interleave = BigEndianBitConverter.ToUInt32(sector, 0xA0), + lowCylinder = BigEndianBitConverter.ToUInt32(sector, 0xA4), + highCylinder = BigEndianBitConverter.ToUInt32(sector, 0xA8), + numBuffer = BigEndianBitConverter.ToUInt32(sector, 0xAC), + bufMemType = BigEndianBitConverter.ToUInt32(sector, 0xB0), + maxTransfer = BigEndianBitConverter.ToUInt32(sector, 0xB4), + Mask = BigEndianBitConverter.ToUInt32(sector, 0xB8), + bootPriority = BigEndianBitConverter.ToUInt32(sector, 0xBC), + dosType = BigEndianBitConverter.ToUInt32(sector, 0xC0), + baud = BigEndianBitConverter.ToUInt32(sector, 0xC4), + control = BigEndianBitConverter.ToUInt32(sector, 0xC8), + bootBlocks = BigEndianBitConverter.ToUInt32(sector, 0xCC) + } + }; + byte[] driveName = new byte[32]; - partEntry.magic = BigEndianBitConverter.ToUInt32(sector, 0x00); - partEntry.size = BigEndianBitConverter.ToUInt32(sector, 0x04); - partEntry.checksum = BigEndianBitConverter.ToInt32(sector, 0x08); - partEntry.targetID = BigEndianBitConverter.ToUInt32(sector, 0x0C); - partEntry.next_ptr = BigEndianBitConverter.ToUInt32(sector, 0x10); - partEntry.flags = BigEndianBitConverter.ToUInt32(sector, 0x14); - partEntry.reserved1 = BigEndianBitConverter.ToUInt32(sector, 0x18); - partEntry.reserved2 = BigEndianBitConverter.ToUInt32(sector, 0x1C); - partEntry.devFlags = BigEndianBitConverter.ToUInt32(sector, 0x20); - partEntry.driveNameLen = sector[0x24]; Array.Copy(sector, 0x24, driveName, 0, 32); partEntry.driveName = StringHandlers.PascalToString(driveName, Encoding.GetEncoding("iso-8859-1")); - partEntry.reserved3 = BigEndianBitConverter.ToUInt32(sector, 0x44); - partEntry.reserved4 = BigEndianBitConverter.ToUInt32(sector, 0x48); - partEntry.reserved5 = BigEndianBitConverter.ToUInt32(sector, 0x4C); - partEntry.reserved6 = BigEndianBitConverter.ToUInt32(sector, 0x50); - partEntry.reserved7 = BigEndianBitConverter.ToUInt32(sector, 0x54); - partEntry.reserved8 = BigEndianBitConverter.ToUInt32(sector, 0x58); - partEntry.reserved9 = BigEndianBitConverter.ToUInt32(sector, 0x5C); - partEntry.reserved10 = BigEndianBitConverter.ToUInt32(sector, 0x60); - partEntry.reserved11 = BigEndianBitConverter.ToUInt32(sector, 0x64); - partEntry.reserved12 = BigEndianBitConverter.ToUInt32(sector, 0x68); - partEntry.reserved13 = BigEndianBitConverter.ToUInt32(sector, 0x6C); - partEntry.reserved14 = BigEndianBitConverter.ToUInt32(sector, 0x70); - partEntry.reserved15 = BigEndianBitConverter.ToUInt32(sector, 0x74); - partEntry.reserved16 = BigEndianBitConverter.ToUInt32(sector, 0x78); - partEntry.reserved17 = BigEndianBitConverter.ToUInt32(sector, 0x7C); - - partEntry.dosEnvVec.size = BigEndianBitConverter.ToUInt32(sector, 0x80); - partEntry.dosEnvVec.block_size = BigEndianBitConverter.ToUInt32(sector, 0x84); - partEntry.dosEnvVec.sec_org = BigEndianBitConverter.ToUInt32(sector, 0x88); - partEntry.dosEnvVec.surfaces = BigEndianBitConverter.ToUInt32(sector, 0x8C); - partEntry.dosEnvVec.spb = BigEndianBitConverter.ToUInt32(sector, 0x90); - partEntry.dosEnvVec.bpt = BigEndianBitConverter.ToUInt32(sector, 0x94); - partEntry.dosEnvVec.reservedblocks = BigEndianBitConverter.ToUInt32(sector, 0x98); - partEntry.dosEnvVec.prealloc = BigEndianBitConverter.ToUInt32(sector, 0x9C); - partEntry.dosEnvVec.interleave = BigEndianBitConverter.ToUInt32(sector, 0xA0); - partEntry.dosEnvVec.lowCylinder = BigEndianBitConverter.ToUInt32(sector, 0xA4); - partEntry.dosEnvVec.highCylinder = BigEndianBitConverter.ToUInt32(sector, 0xA8); - partEntry.dosEnvVec.numBuffer = BigEndianBitConverter.ToUInt32(sector, 0xAC); - partEntry.dosEnvVec.bufMemType = BigEndianBitConverter.ToUInt32(sector, 0xB0); - partEntry.dosEnvVec.maxTransfer = BigEndianBitConverter.ToUInt32(sector, 0xB4); - partEntry.dosEnvVec.Mask = BigEndianBitConverter.ToUInt32(sector, 0xB8); - partEntry.dosEnvVec.bootPriority = BigEndianBitConverter.ToUInt32(sector, 0xBC); - partEntry.dosEnvVec.dosType = BigEndianBitConverter.ToUInt32(sector, 0xC0); - partEntry.dosEnvVec.baud = BigEndianBitConverter.ToUInt32(sector, 0xC4); - partEntry.dosEnvVec.control = BigEndianBitConverter.ToUInt32(sector, 0xC8); - partEntry.dosEnvVec.bootBlocks = BigEndianBitConverter.ToUInt32(sector, 0xCC); DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.magic = 0x{0:X8}", partEntry.magic); DicConsole.DebugWriteLine("Amiga RDB plugin", "partEntry.size = {0} longs, {1} bytes", partEntry.size, partEntry.size * 4); @@ -1238,30 +1244,32 @@ namespace DiscImageChef.PartPlugins DicConsole.DebugWriteLine("Amiga RDB plugin", "Found FileSystemHeader block"); - FileSystemHeader FSHD = new FileSystemHeader(); - FSHD.dnode = new DeviceNode(); - - FSHD.magic = BigEndianBitConverter.ToUInt32(sector, 0x00); - FSHD.size = BigEndianBitConverter.ToUInt32(sector, 0x04); - FSHD.checksum = BigEndianBitConverter.ToInt32(sector, 0x08); - FSHD.targetID = BigEndianBitConverter.ToUInt32(sector, 0x0C); - FSHD.next_ptr = BigEndianBitConverter.ToUInt32(sector, 0x10); - FSHD.flags = BigEndianBitConverter.ToUInt32(sector, 0x14); - FSHD.reserved1 = BigEndianBitConverter.ToUInt32(sector, 0x18); - FSHD.reserved2 = BigEndianBitConverter.ToUInt32(sector, 0x1C); - FSHD.dosType = BigEndianBitConverter.ToUInt32(sector, 0x20); - FSHD.version = BigEndianBitConverter.ToUInt32(sector, 0x24); - FSHD.patchFlags = BigEndianBitConverter.ToUInt32(sector, 0x28); - - FSHD.dnode.type = BigEndianBitConverter.ToUInt32(sector, 0x2C); - FSHD.dnode.task = BigEndianBitConverter.ToUInt32(sector, 0x30); - FSHD.dnode.locked = BigEndianBitConverter.ToUInt32(sector, 0x34); - FSHD.dnode.handler = BigEndianBitConverter.ToUInt32(sector, 0x38); - FSHD.dnode.stackSize = BigEndianBitConverter.ToUInt32(sector, 0x3C); - FSHD.dnode.priority = BigEndianBitConverter.ToUInt32(sector, 0x40); - FSHD.dnode.startup = BigEndianBitConverter.ToUInt32(sector, 0x44); - FSHD.dnode.seglist_ptr = BigEndianBitConverter.ToUInt32(sector, 0x48); - FSHD.dnode.global_vec = BigEndianBitConverter.ToUInt32(sector, 0x4C); + FileSystemHeader FSHD = new FileSystemHeader + { + magic = BigEndianBitConverter.ToUInt32(sector, 0x00), + size = BigEndianBitConverter.ToUInt32(sector, 0x04), + checksum = BigEndianBitConverter.ToInt32(sector, 0x08), + targetID = BigEndianBitConverter.ToUInt32(sector, 0x0C), + next_ptr = BigEndianBitConverter.ToUInt32(sector, 0x10), + flags = BigEndianBitConverter.ToUInt32(sector, 0x14), + reserved1 = BigEndianBitConverter.ToUInt32(sector, 0x18), + reserved2 = BigEndianBitConverter.ToUInt32(sector, 0x1C), + dosType = BigEndianBitConverter.ToUInt32(sector, 0x20), + version = BigEndianBitConverter.ToUInt32(sector, 0x24), + patchFlags = BigEndianBitConverter.ToUInt32(sector, 0x28), + dnode = new DeviceNode + { + type = BigEndianBitConverter.ToUInt32(sector, 0x2C), + task = BigEndianBitConverter.ToUInt32(sector, 0x30), + locked = BigEndianBitConverter.ToUInt32(sector, 0x34), + handler = BigEndianBitConverter.ToUInt32(sector, 0x38), + stackSize = BigEndianBitConverter.ToUInt32(sector, 0x3C), + priority = BigEndianBitConverter.ToUInt32(sector, 0x40), + startup = BigEndianBitConverter.ToUInt32(sector, 0x44), + seglist_ptr = BigEndianBitConverter.ToUInt32(sector, 0x48), + global_vec = BigEndianBitConverter.ToUInt32(sector, 0x4C) + } + }; DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.magic = 0x{0:X8}", FSHD.magic); DicConsole.DebugWriteLine("Amiga RDB plugin", "FSHD.size = {0} longs, {1} bytes", FSHD.size, FSHD.size * 4); @@ -1335,16 +1343,18 @@ namespace DiscImageChef.PartPlugins ulong sequence = 0; foreach(PartitionEntry RDBEntry in PartitionEntries) { - CommonTypes.Partition entry = new CommonTypes.Partition(); - - entry.Description = AmigaDOSTypeToDescriptionString(RDBEntry.dosEnvVec.dosType); - entry.Name = RDBEntry.driveName; - entry.Sequence = sequence; - entry.Length = (RDBEntry.dosEnvVec.highCylinder + 1 - RDBEntry.dosEnvVec.lowCylinder) * RDBEntry.dosEnvVec.surfaces * RDBEntry.dosEnvVec.bpt; - entry.Start = RDBEntry.dosEnvVec.lowCylinder * RDBEntry.dosEnvVec.surfaces * RDBEntry.dosEnvVec.bpt; + CommonTypes.Partition entry = new CommonTypes.Partition + { + Description = AmigaDOSTypeToDescriptionString(RDBEntry.dosEnvVec.dosType), + 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, + Type = AmigaDOSTypeToString(RDBEntry.dosEnvVec.dosType), + Scheme = Name + }; entry.Offset = entry.Start * RDB.block_size; entry.Size = entry.Length * RDB.block_size; - entry.Type = AmigaDOSTypeToString(RDBEntry.dosEnvVec.dosType); partitions.Add(entry); sequence++; diff --git a/DiscImageChef.Partitions/RioKarma.cs b/DiscImageChef.Partitions/RioKarma.cs index e2ae6b99..4a8d2c00 100644 --- a/DiscImageChef.Partitions/RioKarma.cs +++ b/DiscImageChef.Partitions/RioKarma.cs @@ -70,13 +70,16 @@ namespace DiscImageChef.PartPlugins foreach(RioKarmaEntry entry in table.entries) { - Partition part = new Partition(); - part.Start = entry.offset; - part.Offset = (ulong)(entry.offset * sector.Length); - part.Size = entry.size; - part.Length = (ulong)(entry.size * sector.Length); - part.Type = "Rio Karma"; - part.Sequence = counter; + Partition part = new Partition + { + Start = entry.offset, + Offset = (ulong)(entry.offset * sector.Length), + Size = entry.size, + Length = (ulong)(entry.size * sector.Length), + Type = "Rio Karma", + Sequence = counter, + Scheme = Name + }; if(entry.type == EntryMagic) { partitions.Add(part); diff --git a/DiscImageChef.Partitions/SGI.cs b/DiscImageChef.Partitions/SGI.cs index c3acc53a..a8b90f43 100644 --- a/DiscImageChef.Partitions/SGI.cs +++ b/DiscImageChef.Partitions/SGI.cs @@ -69,13 +69,16 @@ namespace DiscImageChef.PartPlugins foreach(SGIPartition entry in disklabel.partitions) { - Partition part = new Partition(); - part.Start = entry.first_block; - part.Offset = (entry.first_block * 512); - part.Size = entry.num_blocks; - part.Length = (entry.num_blocks * 512); - part.Type = string.Format("{0}", entry.type); - part.Sequence = counter; + Partition part = new Partition() + { + Start = entry.first_block, + Offset = (entry.first_block * 512), + Size = entry.num_blocks, + Length = (entry.num_blocks * 512), + Type = string.Format("{0}", entry.type), + Sequence = counter, + Scheme = Name + }; if(part.Size > 0) { partitions.Add(part); diff --git a/DiscImageChef.Partitions/Sun.cs b/DiscImageChef.Partitions/Sun.cs index 01e760cc..2a82f31f 100644 --- a/DiscImageChef.Partitions/Sun.cs +++ b/DiscImageChef.Partitions/Sun.cs @@ -91,15 +91,18 @@ namespace DiscImageChef.PartPlugins byte[] sunSector = imagePlugin.ReadSector(0); byte[] tmpString; - SunDiskLabel sdl = new SunDiskLabel(); - sdl.vtoc = new SunVTOC(); - sdl.spare = new byte[148]; - sdl.vtoc.infos = new SunInfo[8]; - sdl.vtoc.bootinfo = new uint[3]; - sdl.vtoc.reserved = new byte[40]; - sdl.vtoc.timestamp = new uint[8]; - sdl.partitions = new SunPartition[8]; - + SunDiskLabel sdl = new SunDiskLabel + { + spare = new byte[148], + vtoc = new SunVTOC + { + infos = new SunInfo[8], + bootinfo = new uint[3], + reserved = new byte[40], + timestamp = new uint[8] + }, + partitions = new SunPartition[8] + }; BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian; tmpString = new byte[128]; @@ -113,9 +116,11 @@ namespace DiscImageChef.PartPlugins sdl.vtoc.nparts = BigEndianBitConverter.ToUInt16(sunSector, 0x80 + 0x0C); for(int i = 0; i < 8; i++) { - sdl.vtoc.infos[i] = new SunInfo(); - sdl.vtoc.infos[i].id = BigEndianBitConverter.ToUInt16(sunSector, 0x80 + 0x0E + i * 4 + 0x00); - sdl.vtoc.infos[i].flags = BigEndianBitConverter.ToUInt16(sunSector, 0x80 + 0x0E + i * 4 + 0x02); + sdl.vtoc.infos[i] = new SunInfo + { + id = BigEndianBitConverter.ToUInt16(sunSector, 0x80 + 0x0E + i * 4 + 0x00), + flags = BigEndianBitConverter.ToUInt16(sunSector, 0x80 + 0x0E + i * 4 + 0x02) + }; } sdl.vtoc.padding = BigEndianBitConverter.ToUInt16(sunSector, 0x80 + 0x2E); for(int i = 0; i < 3; i++) @@ -143,9 +148,11 @@ namespace DiscImageChef.PartPlugins for(int i = 0; i < 8; i++) { - sdl.partitions[i] = new SunPartition(); - sdl.partitions[i].start_cylinder = BigEndianBitConverter.ToUInt32(sunSector, 0x1BC + i * 8 + 0x00); - sdl.partitions[i].num_sectors = BigEndianBitConverter.ToUInt32(sunSector, 0x1BC + i * 8 + 0x04); + sdl.partitions[i] = new SunPartition + { + start_cylinder = BigEndianBitConverter.ToUInt32(sunSector, 0x1BC + i * 8 + 0x00), + num_sectors = BigEndianBitConverter.ToUInt32(sunSector, 0x1BC + i * 8 + 0x04) + }; } sdl.magic = BigEndianBitConverter.ToUInt16(sunSector, 0x1FC); @@ -200,20 +207,22 @@ namespace DiscImageChef.PartPlugins { if((SunTypes)sdl.vtoc.infos[i].id != SunTypes.SunWholeDisk && sdl.partitions[i].num_sectors > 0) { - CommonTypes.Partition part = new CommonTypes.Partition(); - part.Description = SunFlagsToString((SunFlags)sdl.vtoc.infos[i].flags); + CommonTypes.Partition part = new CommonTypes.Partition + { + Description = SunFlagsToString((SunFlags)sdl.vtoc.infos[i].flags), #pragma warning disable IDE0004 // Remove Unnecessary Cast - part.Size = (ulong)sdl.partitions[i].num_sectors * (ulong)imagePlugin.GetSectorSize(); + Size = (ulong)sdl.partitions[i].num_sectors * (ulong)imagePlugin.GetSectorSize(), #pragma warning restore IDE0004 // Remove Unnecessary Cast - part.Name = ""; - part.Length = sdl.partitions[i].num_sectors; - part.Sequence = (ulong)i; + Name = "", + Length = sdl.partitions[i].num_sectors, + Sequence = (ulong)i, #pragma warning disable IDE0004 // Remove Unnecessary Cast - part.Offset = (ulong)sdl.partitions[i].start_cylinder * (ulong)sectorsPerCylinder * (ulong)imagePlugin.GetSectorSize(); + Offset = (ulong)sdl.partitions[i].start_cylinder * (ulong)sectorsPerCylinder * (ulong)imagePlugin.GetSectorSize(), #pragma warning restore IDE0004 // Remove Unnecessary Cast - part.Start = sdl.partitions[i].start_cylinder * sectorsPerCylinder; - part.Type = SunIdToString((SunTypes)sdl.vtoc.infos[i].id); - + Start = sdl.partitions[i].start_cylinder * sectorsPerCylinder, + Type = SunIdToString((SunTypes)sdl.vtoc.infos[i].id), + Scheme = Name + }; if(part.Start > imagePlugin.GetSectors() || (part.Start + part.Length) > imagePlugin.GetSectors()) return false; diff --git a/DiscImageChef.Partitions/UNIX.cs b/DiscImageChef.Partitions/UNIX.cs index 45b39ef6..d1658469 100644 --- a/DiscImageChef.Partitions/UNIX.cs +++ b/DiscImageChef.Partitions/UNIX.cs @@ -133,23 +133,25 @@ namespace DiscImageChef.PartPlugins // TODO: What if number of slices overlaps sector (>23)? for(int j = 0; j < vtoc.slices; j++) { - UNIXVTOCEntry vtoc_ent = new UNIXVTOCEntry(); - - vtoc_ent.tag = (UNIX_TAG)BitConverter.ToUInt16(unix_dl_sector, 160 + vtocoffset + j * 12 + 0); // 160/232 + j*12 - vtoc_ent.flags = BitConverter.ToUInt16(unix_dl_sector, 160 + vtocoffset + j * 12 + 2); // 162/234 + j*12 - vtoc_ent.start = BitConverter.ToUInt32(unix_dl_sector, 160 + vtocoffset + j * 12 + 6); // 166/238 + j*12 - vtoc_ent.length = BitConverter.ToUInt32(unix_dl_sector, 160 + vtocoffset + j * 12 + 10); // 170/242 + j*12 - + UNIXVTOCEntry vtoc_ent = new UNIXVTOCEntry + { + tag = (UNIX_TAG)BitConverter.ToUInt16(unix_dl_sector, 160 + vtocoffset + j * 12 + 0), // 160/232 + j*12 + flags = BitConverter.ToUInt16(unix_dl_sector, 160 + vtocoffset + j * 12 + 2), // 162/234 + j*12 + start = BitConverter.ToUInt32(unix_dl_sector, 160 + vtocoffset + j * 12 + 6), // 166/238 + j*12 + length = BitConverter.ToUInt32(unix_dl_sector, 160 + vtocoffset + j * 12 + 10) // 170/242 + j*12 + }; if((vtoc_ent.flags & 0x200) == 0x200 && vtoc_ent.tag != UNIX_TAG.EMPTY && vtoc_ent.tag != UNIX_TAG.WHOLE) { - Partition part = new Partition(); - part.Start = vtoc_ent.start; - part.Length = vtoc_ent.length; - part.Offset = vtoc_ent.start * dl.bps; - part.Size = vtoc_ent.length * dl.bps; - part.Sequence = counter; - part.Type = string.Format("UNIX: {0}", decodeUNIXTAG(vtoc_ent.tag, isNewDL)); - + Partition part = new Partition + { + Start = vtoc_ent.start, + Length = vtoc_ent.length, + Offset = vtoc_ent.start * dl.bps, + Size = vtoc_ent.length * dl.bps, + Sequence = counter, + Type = string.Format("UNIX: {0}", decodeUNIXTAG(vtoc_ent.tag, isNewDL)), + Scheme = Name + }; string info = ""; if((vtoc_ent.flags & 0x01) == 0x01) diff --git a/DiscImageChef.Partitions/Xbox.cs b/DiscImageChef.Partitions/Xbox.cs index 28ebdf0c..4316a698 100644 --- a/DiscImageChef.Partitions/Xbox.cs +++ b/DiscImageChef.Partitions/Xbox.cs @@ -90,21 +90,27 @@ namespace DiscImageChef.PartPlugins if(table.magic == Xbox360DevKitMagic && table.contentOff + table.contentLen <= imagePlugin.ImageInfo.sectors && table.dashboardOff + table.dashboardLen <= imagePlugin.ImageInfo.sectors) { - Partition contentPart = new Partition(); - contentPart.Description = "Content volume"; - contentPart.Size = (ulong)table.contentLen * (ulong)imagePlugin.ImageInfo.sectorSize; - contentPart.Length = table.contentLen; - contentPart.Sequence = 1; - contentPart.Offset = (ulong)table.contentOff * (ulong)imagePlugin.ImageInfo.sectorSize; - contentPart.Start = table.contentOff; + Partition contentPart = new Partition + { + Description = "Content volume", + Size = (ulong)table.contentLen * imagePlugin.ImageInfo.sectorSize, + Length = table.contentLen, + Sequence = 1, + Offset = (ulong)table.contentOff * imagePlugin.ImageInfo.sectorSize, + Start = table.contentOff, + Scheme = Name + }; - Partition dashboardPart = new Partition(); - dashboardPart.Description = "Dashboard volume"; - dashboardPart.Size = (ulong)table.dashboardLen * (ulong)imagePlugin.ImageInfo.sectorSize; - dashboardPart.Length = table.dashboardLen; - dashboardPart.Sequence = 2; - dashboardPart.Offset = (ulong)table.dashboardOff * (ulong)imagePlugin.ImageInfo.sectorSize; - dashboardPart.Start = table.dashboardOff; + Partition dashboardPart = new Partition + { + Description = "Dashboard volume", + Size = (ulong)table.dashboardLen * imagePlugin.ImageInfo.sectorSize, + Length = table.dashboardLen, + Sequence = 2, + Offset = (ulong)table.dashboardOff * imagePlugin.ImageInfo.sectorSize, + Start = table.dashboardOff, + Scheme = Name + }; partitions.Add(contentPart); partitions.Add(dashboardPart); @@ -121,21 +127,27 @@ namespace DiscImageChef.PartPlugins if(temp == XboxCigam) { - Partition sysCachePart = new Partition(); - sysCachePart.Description = "System cache"; - sysCachePart.Size = MemoryUnitDataOff; - sysCachePart.Length = (ulong)(MemoryUnitDataOff / imagePlugin.ImageInfo.sectorSize); - sysCachePart.Sequence = 1; - sysCachePart.Offset = 0; - sysCachePart.Start = 0; + Partition sysCachePart = new Partition + { + Description = "System cache", + Size = MemoryUnitDataOff, + Length = (ulong)(MemoryUnitDataOff / imagePlugin.ImageInfo.sectorSize), + Sequence = 1, + Offset = 0, + Start = 0, + Scheme = Name + }; - Partition dataPart = new Partition(); - dataPart.Description = "Data volume"; - dataPart.Size = (ulong)imagePlugin.ImageInfo.sectors * (ulong)imagePlugin.ImageInfo.sectorSize - MemoryUnitDataOff; - dataPart.Length = imagePlugin.ImageInfo.sectors - sysCachePart.Length; - dataPart.Sequence = 2; - dataPart.Offset = MemoryUnitDataOff; - dataPart.Start = sysCachePart.Length; + Partition dataPart = new Partition + { + Description = "Data volume", + Size = (ulong)imagePlugin.ImageInfo.sectors * imagePlugin.ImageInfo.sectorSize - MemoryUnitDataOff, + Length = imagePlugin.ImageInfo.sectors - sysCachePart.Length, + Sequence = 2, + Offset = MemoryUnitDataOff, + Start = sysCachePart.Length, + Scheme = Name + }; partitions.Add(sysCachePart); partitions.Add(dataPart); @@ -151,61 +163,82 @@ namespace DiscImageChef.PartPlugins if(temp == XboxCigam) { - Partition securityPart = new Partition(); - securityPart.Description = "Security sectors"; - securityPart.Size = Xbox360SecuritySectorLen; - securityPart.Length = (ulong)(Xbox360SecuritySectorLen / imagePlugin.ImageInfo.sectorSize); - securityPart.Sequence = 1; - securityPart.Offset = Xbox360SecuritySectorOff; - securityPart.Start = (ulong)(Xbox360SecuritySectorOff / imagePlugin.ImageInfo.sectorSize); + Partition securityPart = new Partition + { + Description = "Security sectors", + Size = Xbox360SecuritySectorLen, + Length = (ulong)(Xbox360SecuritySectorLen / imagePlugin.ImageInfo.sectorSize), + Sequence = 1, + Offset = Xbox360SecuritySectorOff, + Start = (ulong)(Xbox360SecuritySectorOff / imagePlugin.ImageInfo.sectorSize), + Scheme = Name + }; - Partition sysCachePart = new Partition(); - sysCachePart.Description = "System cache"; - sysCachePart.Size = Xbox360SystemCacheLen; - sysCachePart.Length = (ulong)(Xbox360SystemCacheLen / imagePlugin.ImageInfo.sectorSize); - sysCachePart.Sequence = 2; - sysCachePart.Offset = Xbox360SystemCacheOff; - sysCachePart.Start = (ulong)(Xbox360SystemCacheOff / imagePlugin.ImageInfo.sectorSize); + Partition sysCachePart = new Partition + { + Description = "System cache", + Size = Xbox360SystemCacheLen, + Length = (ulong)(Xbox360SystemCacheLen / imagePlugin.ImageInfo.sectorSize), + Sequence = 2, + Offset = Xbox360SystemCacheOff, + Start = (ulong)(Xbox360SystemCacheOff / imagePlugin.ImageInfo.sectorSize), + Scheme = Name + }; - Partition gameCachePart = new Partition(); - gameCachePart.Description = "Game cache"; - gameCachePart.Size = Xbox360GameCacheLen; - gameCachePart.Length = (ulong)(Xbox360GameCacheLen / imagePlugin.ImageInfo.sectorSize); - gameCachePart.Sequence = 3; - gameCachePart.Offset = Xbox360GameCacheOff; - gameCachePart.Start = (ulong)(Xbox360GameCacheOff / imagePlugin.ImageInfo.sectorSize); + Partition gameCachePart = new Partition + { + Description = "Game cache", + Size = Xbox360GameCacheLen, + Length = (ulong)(Xbox360GameCacheLen / imagePlugin.ImageInfo.sectorSize), + Sequence = 3, + Offset = Xbox360GameCacheOff, + Start = (ulong)(Xbox360GameCacheOff / imagePlugin.ImageInfo.sectorSize), + Scheme = Name + }; - Partition sysExtPart = new Partition(); - sysExtPart.Description = "System volume"; - sysExtPart.Size = Xbox368SysExtLen; - sysExtPart.Length = (ulong)(Xbox368SysExtLen / imagePlugin.ImageInfo.sectorSize); - sysExtPart.Sequence = 4; - sysExtPart.Offset = Xbox368SysExtOff; - sysExtPart.Start = (ulong)(Xbox368SysExtOff / imagePlugin.ImageInfo.sectorSize); + Partition sysExtPart = new Partition + { + Description = "System volume", + Size = Xbox368SysExtLen, + Length = (ulong)(Xbox368SysExtLen / imagePlugin.ImageInfo.sectorSize), + Sequence = 4, + Offset = Xbox368SysExtOff, + Start = (ulong)(Xbox368SysExtOff / imagePlugin.ImageInfo.sectorSize), + Scheme = Name + }; - Partition sysExt2Part = new Partition(); - sysExt2Part.Description = "System volume 2"; - sysExt2Part.Size = Xbox360SysExt2Len; - sysExt2Part.Length = (ulong)(Xbox360SysExt2Len / imagePlugin.ImageInfo.sectorSize); - sysExt2Part.Sequence = 5; - sysExt2Part.Offset = Xbox360SysExt2Off; - sysExt2Part.Start = (ulong)(Xbox360SysExt2Off / imagePlugin.ImageInfo.sectorSize); + Partition sysExt2Part = new Partition + { + Description = "System volume 2", + Size = Xbox360SysExt2Len, + Length = (ulong)(Xbox360SysExt2Len / imagePlugin.ImageInfo.sectorSize), + Sequence = 5, + Offset = Xbox360SysExt2Off, + Start = (ulong)(Xbox360SysExt2Off / imagePlugin.ImageInfo.sectorSize), + Scheme = Name + }; - Partition xbox1Part = new Partition(); - xbox1Part.Description = "Xbox backwards compatibility"; - xbox1Part.Size = Xbox360CompatLen; - xbox1Part.Length = (ulong)(Xbox360CompatLen / imagePlugin.ImageInfo.sectorSize); - xbox1Part.Sequence = 6; - xbox1Part.Offset = Xbox360CompatOff; - xbox1Part.Start = (ulong)(Xbox360CompatOff / imagePlugin.ImageInfo.sectorSize); + Partition xbox1Part = new Partition + { + Description = "Xbox backwards compatibility", + Size = Xbox360CompatLen, + Length = (ulong)(Xbox360CompatLen / imagePlugin.ImageInfo.sectorSize), + Sequence = 6, + Offset = Xbox360CompatOff, + Start = (ulong)(Xbox360CompatOff / imagePlugin.ImageInfo.sectorSize), + Scheme = Name + }; - Partition dataPart = new Partition(); - dataPart.Description = "Data volume"; - dataPart.Sequence = 7; - dataPart.Offset = Xbox360DataOff; - dataPart.Start = (ulong)(Xbox360DataOff / imagePlugin.ImageInfo.sectorSize); + Partition dataPart = new Partition + { + Description = "Data volume", + Sequence = 7, + Offset = Xbox360DataOff, + Start = (ulong)(Xbox360DataOff / imagePlugin.ImageInfo.sectorSize), + Scheme = Name + }; dataPart.Length = imagePlugin.ImageInfo.sectors - dataPart.Start; - dataPart.Size = (ulong)dataPart.Length * (ulong)imagePlugin.ImageInfo.sectorSize; + dataPart.Size = dataPart.Length * imagePlugin.ImageInfo.sectorSize; partitions.Add(securityPart); partitions.Add(sysCachePart);