mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
REFACTOR: Reformat code.
This commit is contained in:
@@ -61,29 +61,23 @@ namespace DiscImageChef.Filesystems
|
||||
{
|
||||
Name = "Files-11 On-Disk Structure";
|
||||
PluginUUID = new Guid("de20633c-8021-4384-aeb0-83b0df14491f");
|
||||
if(encoding == null)
|
||||
CurrentEncoding = Encoding.GetEncoding("iso-8859-1");
|
||||
else
|
||||
CurrentEncoding = encoding;
|
||||
if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-1");
|
||||
else CurrentEncoding = encoding;
|
||||
}
|
||||
|
||||
public ODS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
|
||||
{
|
||||
Name = "Files-11 On-Disk Structure";
|
||||
PluginUUID = new Guid("de20633c-8021-4384-aeb0-83b0df14491f");
|
||||
if(encoding == null)
|
||||
CurrentEncoding = Encoding.GetEncoding("iso-8859-1");
|
||||
else
|
||||
CurrentEncoding = encoding;
|
||||
if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-1");
|
||||
else CurrentEncoding = encoding;
|
||||
}
|
||||
|
||||
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition)
|
||||
{
|
||||
if((2 + partition.Start) >= partition.End)
|
||||
return false;
|
||||
if((2 + partition.Start) >= partition.End) return false;
|
||||
|
||||
if(imagePlugin.GetSectorSize() < 512)
|
||||
return false;
|
||||
if(imagePlugin.GetSectorSize() < 512) return false;
|
||||
|
||||
byte[] magic_b = new byte[12];
|
||||
string magic;
|
||||
@@ -94,14 +88,12 @@ namespace DiscImageChef.Filesystems
|
||||
|
||||
DicConsole.DebugWriteLine("Files-11 plugin", "magic: \"{0}\"", magic);
|
||||
|
||||
if(magic == "DECFILE11A " || magic == "DECFILE11B ")
|
||||
return true;
|
||||
if(magic == "DECFILE11A " || magic == "DECFILE11B ") return true;
|
||||
|
||||
// Optical disc
|
||||
if(imagePlugin.ImageInfo.xmlMediaType == ImagePlugins.XmlMediaType.OpticalDisc)
|
||||
{
|
||||
if(hb_sector.Length < 0x400)
|
||||
return false;
|
||||
if(hb_sector.Length < 0x400) return false;
|
||||
|
||||
hb_sector = imagePlugin.ReadSector(partition.Start);
|
||||
|
||||
@@ -110,14 +102,14 @@ namespace DiscImageChef.Filesystems
|
||||
|
||||
DicConsole.DebugWriteLine("Files-11 plugin", "unaligned magic: \"{0}\"", magic);
|
||||
|
||||
if(magic == "DECFILE11A " || magic == "DECFILE11B ")
|
||||
return true;
|
||||
if(magic == "DECFILE11A " || magic == "DECFILE11B ") return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information)
|
||||
public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition,
|
||||
out string information)
|
||||
{
|
||||
information = "";
|
||||
|
||||
@@ -135,11 +127,10 @@ namespace DiscImageChef.Filesystems
|
||||
|
||||
// Optical disc
|
||||
if(imagePlugin.ImageInfo.xmlMediaType == ImagePlugins.XmlMediaType.OpticalDisc &&
|
||||
StringHandlers.CToString(homeblock.format) != "DECFILE11A " &&
|
||||
StringHandlers.CToString(homeblock.format) != "DECFILE11B ")
|
||||
StringHandlers.CToString(homeblock.format) != "DECFILE11A " &&
|
||||
StringHandlers.CToString(homeblock.format) != "DECFILE11B ")
|
||||
{
|
||||
if(hb_sector.Length < 0x400)
|
||||
return;
|
||||
if(hb_sector.Length < 0x400) return;
|
||||
|
||||
byte[] tmp = imagePlugin.ReadSector(partition.Start);
|
||||
hb_sector = new byte[0x200];
|
||||
@@ -149,35 +140,51 @@ namespace DiscImageChef.Filesystems
|
||||
homeblock = (ODSHomeBlock)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(ODSHomeBlock));
|
||||
handle.Free();
|
||||
|
||||
if(StringHandlers.CToString(homeblock.format) != "DECFILE11A " && StringHandlers.CToString(homeblock.format) != "DECFILE11B ")
|
||||
return;
|
||||
if(StringHandlers.CToString(homeblock.format) != "DECFILE11A " &&
|
||||
StringHandlers.CToString(homeblock.format) != "DECFILE11B ") return;
|
||||
}
|
||||
|
||||
if((homeblock.struclev & 0xFF00) != 0x0200 || (homeblock.struclev & 0xFF) != 1 || StringHandlers.CToString(homeblock.format) != "DECFILE11B ")
|
||||
if((homeblock.struclev & 0xFF00) != 0x0200 || (homeblock.struclev & 0xFF) != 1 ||
|
||||
StringHandlers.CToString(homeblock.format) != "DECFILE11B ")
|
||||
sb.AppendLine("The following information may be incorrect for this volume.");
|
||||
if(homeblock.resfiles < 5 || homeblock.devtype != 0)
|
||||
sb.AppendLine("This volume may be corrupted.");
|
||||
if(homeblock.resfiles < 5 || homeblock.devtype != 0) sb.AppendLine("This volume may be corrupted.");
|
||||
|
||||
sb.AppendFormat("Volume format is {0}", StringHandlers.SpacePaddedToString(homeblock.format, CurrentEncoding)).AppendLine();
|
||||
sb.AppendFormat("Volume is Level {0} revision {1}", (homeblock.struclev & 0xFF00) >> 8, homeblock.struclev & 0xFF).AppendLine();
|
||||
sb.AppendFormat("Lowest structure in the volume is Level {0}, revision {1}", (homeblock.lowstruclev & 0xFF00) >> 8, homeblock.lowstruclev & 0xFF).AppendLine();
|
||||
sb.AppendFormat("Highest structure in the volume is Level {0}, revision {1}", (homeblock.highstruclev & 0xFF00) >> 8, homeblock.highstruclev & 0xFF).AppendLine();
|
||||
sb.AppendFormat("{0} sectors per cluster ({1} bytes)", homeblock.cluster, homeblock.cluster * 512).AppendLine();
|
||||
sb.AppendFormat("This home block is on sector {0} (VBN {1})", homeblock.homelbn, homeblock.homevbn).AppendLine();
|
||||
sb.AppendFormat("Secondary home block is on sector {0} (VBN {1})", homeblock.alhomelbn, homeblock.alhomevbn).AppendLine();
|
||||
sb.AppendFormat("Volume bitmap starts in sector {0} (VBN {1})", homeblock.ibmaplbn, homeblock.ibmapvbn).AppendLine();
|
||||
sb.AppendFormat("Volume bitmap runs for {0} sectors ({1} bytes)", homeblock.ibmapsize, homeblock.ibmapsize * 512).AppendLine();
|
||||
sb.AppendFormat("Backup INDEXF.SYS;1 is in sector {0} (VBN {1})", homeblock.altidxlbn, homeblock.altidxvbn).AppendLine();
|
||||
sb.AppendFormat("Volume format is {0}",
|
||||
StringHandlers.SpacePaddedToString(homeblock.format, CurrentEncoding)).AppendLine();
|
||||
sb.AppendFormat("Volume is Level {0} revision {1}", (homeblock.struclev & 0xFF00) >> 8,
|
||||
homeblock.struclev & 0xFF).AppendLine();
|
||||
sb.AppendFormat("Lowest structure in the volume is Level {0}, revision {1}",
|
||||
(homeblock.lowstruclev & 0xFF00) >> 8, homeblock.lowstruclev & 0xFF).AppendLine();
|
||||
sb.AppendFormat("Highest structure in the volume is Level {0}, revision {1}",
|
||||
(homeblock.highstruclev & 0xFF00) >> 8, homeblock.highstruclev & 0xFF).AppendLine();
|
||||
sb.AppendFormat("{0} sectors per cluster ({1} bytes)", homeblock.cluster, homeblock.cluster * 512)
|
||||
.AppendLine();
|
||||
sb.AppendFormat("This home block is on sector {0} (VBN {1})", homeblock.homelbn, homeblock.homevbn)
|
||||
.AppendLine();
|
||||
sb.AppendFormat("Secondary home block is on sector {0} (VBN {1})", homeblock.alhomelbn, homeblock.alhomevbn)
|
||||
.AppendLine();
|
||||
sb.AppendFormat("Volume bitmap starts in sector {0} (VBN {1})", homeblock.ibmaplbn, homeblock.ibmapvbn)
|
||||
.AppendLine();
|
||||
sb.AppendFormat("Volume bitmap runs for {0} sectors ({1} bytes)", homeblock.ibmapsize,
|
||||
homeblock.ibmapsize * 512).AppendLine();
|
||||
sb.AppendFormat("Backup INDEXF.SYS;1 is in sector {0} (VBN {1})", homeblock.altidxlbn, homeblock.altidxvbn)
|
||||
.AppendLine();
|
||||
sb.AppendFormat("{0} maximum files on the volume", homeblock.maxfiles).AppendLine();
|
||||
sb.AppendFormat("{0} reserved files", homeblock.resfiles).AppendLine();
|
||||
if(homeblock.rvn > 0 && homeblock.setcount > 0 && StringHandlers.CToString(homeblock.strucname) != " ")
|
||||
sb.AppendFormat("Volume is {0} of {1} in set \"{2}\".", homeblock.rvn, homeblock.setcount, StringHandlers.SpacePaddedToString(homeblock.strucname, CurrentEncoding)).AppendLine();
|
||||
sb.AppendFormat("Volume owner is \"{0}\" (ID 0x{1:X8})", StringHandlers.SpacePaddedToString(homeblock.ownername, CurrentEncoding), homeblock.volowner).AppendLine();
|
||||
sb.AppendFormat("Volume label: \"{0}\"", StringHandlers.SpacePaddedToString(homeblock.volname, CurrentEncoding)).AppendLine();
|
||||
if(homeblock.rvn > 0 && homeblock.setcount > 0 &&
|
||||
StringHandlers.CToString(homeblock.strucname) != " ")
|
||||
sb.AppendFormat("Volume is {0} of {1} in set \"{2}\".", homeblock.rvn, homeblock.setcount,
|
||||
StringHandlers.SpacePaddedToString(homeblock.strucname, CurrentEncoding)).AppendLine();
|
||||
sb.AppendFormat("Volume owner is \"{0}\" (ID 0x{1:X8})",
|
||||
StringHandlers.SpacePaddedToString(homeblock.ownername, CurrentEncoding),
|
||||
homeblock.volowner).AppendLine();
|
||||
sb.AppendFormat("Volume label: \"{0}\"",
|
||||
StringHandlers.SpacePaddedToString(homeblock.volname, CurrentEncoding)).AppendLine();
|
||||
sb.AppendFormat("Drive serial number: 0x{0:X8}", homeblock.serialnum).AppendLine();
|
||||
sb.AppendFormat("Volume was created on {0}", DateHandlers.VMSToDateTime(homeblock.credate)).AppendLine();
|
||||
if(homeblock.revdate > 0)
|
||||
sb.AppendFormat("Volume was last modified on {0}", DateHandlers.VMSToDateTime(homeblock.revdate)).AppendLine();
|
||||
sb.AppendFormat("Volume was last modified on {0}", DateHandlers.VMSToDateTime(homeblock.revdate))
|
||||
.AppendLine();
|
||||
if(homeblock.copydate > 0)
|
||||
sb.AppendFormat("Volume copied on {0}", DateHandlers.VMSToDateTime(homeblock.copydate)).AppendLine();
|
||||
sb.AppendFormat("Checksums: 0x{0:X4} and 0x{1:X4}", homeblock.checksum1, homeblock.checksum2).AppendLine();
|
||||
@@ -185,86 +192,49 @@ namespace DiscImageChef.Filesystems
|
||||
sb.AppendFormat("Window: {0}", homeblock.window).AppendLine();
|
||||
sb.AppendFormat("Cached directores: {0}", homeblock.lru_lim).AppendLine();
|
||||
sb.AppendFormat("Default allocation: {0} blocks", homeblock.extend).AppendLine();
|
||||
if((homeblock.volchar & 0x01) == 0x01)
|
||||
sb.AppendLine("Readings should be verified");
|
||||
if((homeblock.volchar & 0x02) == 0x02)
|
||||
sb.AppendLine("Writings should be verified");
|
||||
if((homeblock.volchar & 0x04) == 0x04)
|
||||
sb.AppendLine("Files should be erased or overwritten when deleted");
|
||||
if((homeblock.volchar & 0x08) == 0x08)
|
||||
sb.AppendLine("Highwater mark is to be disabled");
|
||||
if((homeblock.volchar & 0x10) == 0x10)
|
||||
sb.AppendLine("Classification checks are enabled");
|
||||
if((homeblock.volchar & 0x01) == 0x01) sb.AppendLine("Readings should be verified");
|
||||
if((homeblock.volchar & 0x02) == 0x02) sb.AppendLine("Writings should be verified");
|
||||
if((homeblock.volchar & 0x04) == 0x04) sb.AppendLine("Files should be erased or overwritten when deleted");
|
||||
if((homeblock.volchar & 0x08) == 0x08) sb.AppendLine("Highwater mark is to be disabled");
|
||||
if((homeblock.volchar & 0x10) == 0x10) sb.AppendLine("Classification checks are enabled");
|
||||
sb.AppendLine("Volume permissions (r = read, w = write, c = create, d = delete)");
|
||||
sb.AppendLine("System, owner, group, world");
|
||||
// System
|
||||
if((homeblock.protect & 0x1000) == 0x1000)
|
||||
sb.Append("-");
|
||||
else
|
||||
sb.Append("r");
|
||||
if((homeblock.protect & 0x2000) == 0x2000)
|
||||
sb.Append("-");
|
||||
else
|
||||
sb.Append("w");
|
||||
if((homeblock.protect & 0x4000) == 0x4000)
|
||||
sb.Append("-");
|
||||
else
|
||||
sb.Append("c");
|
||||
if((homeblock.protect & 0x8000) == 0x8000)
|
||||
sb.Append("-");
|
||||
else
|
||||
sb.Append("d");
|
||||
if((homeblock.protect & 0x1000) == 0x1000) sb.Append("-");
|
||||
else sb.Append("r");
|
||||
if((homeblock.protect & 0x2000) == 0x2000) sb.Append("-");
|
||||
else sb.Append("w");
|
||||
if((homeblock.protect & 0x4000) == 0x4000) sb.Append("-");
|
||||
else sb.Append("c");
|
||||
if((homeblock.protect & 0x8000) == 0x8000) sb.Append("-");
|
||||
else sb.Append("d");
|
||||
// Owner
|
||||
if((homeblock.protect & 0x100) == 0x100)
|
||||
sb.Append("-");
|
||||
else
|
||||
sb.Append("r");
|
||||
if((homeblock.protect & 0x200) == 0x200)
|
||||
sb.Append("-");
|
||||
else
|
||||
sb.Append("w");
|
||||
if((homeblock.protect & 0x400) == 0x400)
|
||||
sb.Append("-");
|
||||
else
|
||||
sb.Append("c");
|
||||
if((homeblock.protect & 0x800) == 0x800)
|
||||
sb.Append("-");
|
||||
else
|
||||
sb.Append("d");
|
||||
if((homeblock.protect & 0x100) == 0x100) sb.Append("-");
|
||||
else sb.Append("r");
|
||||
if((homeblock.protect & 0x200) == 0x200) sb.Append("-");
|
||||
else sb.Append("w");
|
||||
if((homeblock.protect & 0x400) == 0x400) sb.Append("-");
|
||||
else sb.Append("c");
|
||||
if((homeblock.protect & 0x800) == 0x800) sb.Append("-");
|
||||
else sb.Append("d");
|
||||
// Group
|
||||
if((homeblock.protect & 0x10) == 0x10)
|
||||
sb.Append("-");
|
||||
else
|
||||
sb.Append("r");
|
||||
if((homeblock.protect & 0x20) == 0x20)
|
||||
sb.Append("-");
|
||||
else
|
||||
sb.Append("w");
|
||||
if((homeblock.protect & 0x40) == 0x40)
|
||||
sb.Append("-");
|
||||
else
|
||||
sb.Append("c");
|
||||
if((homeblock.protect & 0x80) == 0x80)
|
||||
sb.Append("-");
|
||||
else
|
||||
sb.Append("d");
|
||||
if((homeblock.protect & 0x10) == 0x10) sb.Append("-");
|
||||
else sb.Append("r");
|
||||
if((homeblock.protect & 0x20) == 0x20) sb.Append("-");
|
||||
else sb.Append("w");
|
||||
if((homeblock.protect & 0x40) == 0x40) sb.Append("-");
|
||||
else sb.Append("c");
|
||||
if((homeblock.protect & 0x80) == 0x80) sb.Append("-");
|
||||
else sb.Append("d");
|
||||
// World (other)
|
||||
if((homeblock.protect & 0x1) == 0x1)
|
||||
sb.Append("-");
|
||||
else
|
||||
sb.Append("r");
|
||||
if((homeblock.protect & 0x2) == 0x2)
|
||||
sb.Append("-");
|
||||
else
|
||||
sb.Append("w");
|
||||
if((homeblock.protect & 0x4) == 0x4)
|
||||
sb.Append("-");
|
||||
else
|
||||
sb.Append("c");
|
||||
if((homeblock.protect & 0x8) == 0x8)
|
||||
sb.Append("-");
|
||||
else
|
||||
sb.Append("d");
|
||||
if((homeblock.protect & 0x1) == 0x1) sb.Append("-");
|
||||
else sb.Append("r");
|
||||
if((homeblock.protect & 0x2) == 0x2) sb.Append("-");
|
||||
else sb.Append("w");
|
||||
if((homeblock.protect & 0x4) == 0x4) sb.Append("-");
|
||||
else sb.Append("c");
|
||||
if((homeblock.protect & 0x8) == 0x8) sb.Append("-");
|
||||
else sb.Append("d");
|
||||
|
||||
sb.AppendLine();
|
||||
|
||||
@@ -359,11 +329,9 @@ namespace DiscImageChef.Filesystems
|
||||
/// <summary>0x058, Last modification date</summary>
|
||||
public ulong revdate;
|
||||
/// <summary>0x060, Minimum security class, 20 bytes</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
|
||||
public byte[] min_class;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] min_class;
|
||||
/// <summary>0x074, Maximum security class, 20 bytes</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
|
||||
public byte[] max_class;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public byte[] max_class;
|
||||
/// <summary>0x088, File lookup table FID</summary>
|
||||
public ushort filetab_fid1;
|
||||
/// <summary>0x08A, File lookup table FID</summary>
|
||||
@@ -377,22 +345,17 @@ namespace DiscImageChef.Filesystems
|
||||
/// <summary>0x092, Volume copy date (??)</summary>
|
||||
public ulong copydate;
|
||||
/// <summary>0x09A, 302 bytes</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 302)]
|
||||
public byte[] reserved1;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 302)] public byte[] reserved1;
|
||||
/// <summary>0x1C8, Physical drive serial number</summary>
|
||||
public uint serialnum;
|
||||
/// <summary>0x1CC, Name of the volume set, 12 bytes</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
|
||||
public byte[] strucname;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] strucname;
|
||||
/// <summary>0x1D8, Volume label, 12 bytes</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
|
||||
public byte[] volname;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] volname;
|
||||
/// <summary>0x1E4, Name of the volume owner, 12 bytes</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
|
||||
public byte[] ownername;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] ownername;
|
||||
/// <summary>0x1F0, ODS-2 defines it as "DECFILE11B", 12 bytes</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
|
||||
public byte[] format;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] format;
|
||||
/// <summary>0x1FC, Reserved</summary>
|
||||
public ushort reserved2;
|
||||
/// <summary>0x1FE, Checksum of preceding 255 words (16 bit units)</summary>
|
||||
|
||||
Reference in New Issue
Block a user