Code cleanup.

This commit is contained in:
2018-06-22 08:08:38 +01:00
parent 82f474c7e3
commit 88da8fc019
581 changed files with 22423 additions and 20839 deletions

View File

@@ -43,9 +43,9 @@ namespace DiscImageChef.Filesystems
public class SolarFS : IFilesystem
{
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "Solar_OS filesystem";
public Guid Id => new Guid("EA3101C1-E777-4B4F-B5A3-8C57F50F6E65");
public Encoding Encoding { get; private set; }
public string Name => "Solar_OS filesystem";
public Guid Id => new Guid("EA3101C1-E777-4B4F-B5A3-8C57F50F6E65");
public bool Identify(IMediaImage imagePlugin, Partition partition)
{
@@ -63,32 +63,32 @@ namespace DiscImageChef.Filesystems
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
Encoding encoding)
{
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
information = "";
StringBuilder sb = new StringBuilder();
byte[] bpbSector = imagePlugin.ReadSector(0 + partition.Start);
StringBuilder sb = new StringBuilder();
byte[] bpbSector = imagePlugin.ReadSector(0 + partition.Start);
SolarOSParameterBlock bpb = new SolarOSParameterBlock
{
bps = BitConverter.ToUInt16(bpbSector, 0x0B),
root_ent = BitConverter.ToUInt16(bpbSector, 0x10),
sectors = BitConverter.ToUInt16(bpbSector, 0x12),
media = bpbSector[0x14],
spfat = BitConverter.ToUInt16(bpbSector, 0x15),
sptrk = BitConverter.ToUInt16(bpbSector, 0x17),
heads = BitConverter.ToUInt16(bpbSector, 0x19),
bps = BitConverter.ToUInt16(bpbSector, 0x0B),
root_ent = BitConverter.ToUInt16(bpbSector, 0x10),
sectors = BitConverter.ToUInt16(bpbSector, 0x12),
media = bpbSector[0x14],
spfat = BitConverter.ToUInt16(bpbSector, 0x15),
sptrk = BitConverter.ToUInt16(bpbSector, 0x17),
heads = BitConverter.ToUInt16(bpbSector, 0x19),
signature = bpbSector[0x25]
};
byte[] bpbStrings = new byte[8];
Array.Copy(bpbSector, 0x03, bpbStrings, 0, 8);
bpb.OEMName = StringHandlers.CToString(bpbStrings);
bpbStrings = new byte[8];
bpbStrings = new byte[8];
Array.Copy(bpbSector, 0x2A, bpbStrings, 0, 11);
bpb.vol_name = StringHandlers.CToString(bpbStrings, Encoding);
bpbStrings = new byte[8];
bpbStrings = new byte[8];
Array.Copy(bpbSector, 0x35, bpbStrings, 0, 8);
bpb.fs_type = StringHandlers.CToString(bpbStrings, Encoding);
@@ -103,23 +103,23 @@ namespace DiscImageChef.Filesystems
DicConsole.DebugWriteLine("SolarFS plugin", "BPB.x86_jump: 0x{0:X2}{1:X2}{2:X2}", bpb.x86_jump[0],
bpb.x86_jump[1], bpb.x86_jump[2]);
DicConsole.DebugWriteLine("SolarFS plugin", "BPB.OEMName: \"{0}\"", bpb.OEMName);
DicConsole.DebugWriteLine("SolarFS plugin", "BPB.bps: {0}", bpb.bps);
DicConsole.DebugWriteLine("SolarFS plugin", "BPB.unk1: 0x{0:X2}", bpb.unk1);
DicConsole.DebugWriteLine("SolarFS plugin", "BPB.unk2: 0x{0:X4}", bpb.unk2);
DicConsole.DebugWriteLine("SolarFS plugin", "BPB.root_ent: {0}", bpb.root_ent);
DicConsole.DebugWriteLine("SolarFS plugin", "BPB.sectors: {0}", bpb.sectors);
DicConsole.DebugWriteLine("SolarFS plugin", "BPB.media: 0x{0:X2}", bpb.media);
DicConsole.DebugWriteLine("SolarFS plugin", "BPB.spfat: {0}", bpb.spfat);
DicConsole.DebugWriteLine("SolarFS plugin", "BPB.sptrk: {0}", bpb.sptrk);
DicConsole.DebugWriteLine("SolarFS plugin", "BPB.heads: {0}", bpb.heads);
DicConsole.DebugWriteLine("SolarFS plugin", "BPB.bps: {0}", bpb.bps);
DicConsole.DebugWriteLine("SolarFS plugin", "BPB.unk1: 0x{0:X2}", bpb.unk1);
DicConsole.DebugWriteLine("SolarFS plugin", "BPB.unk2: 0x{0:X4}", bpb.unk2);
DicConsole.DebugWriteLine("SolarFS plugin", "BPB.root_ent: {0}", bpb.root_ent);
DicConsole.DebugWriteLine("SolarFS plugin", "BPB.sectors: {0}", bpb.sectors);
DicConsole.DebugWriteLine("SolarFS plugin", "BPB.media: 0x{0:X2}", bpb.media);
DicConsole.DebugWriteLine("SolarFS plugin", "BPB.spfat: {0}", bpb.spfat);
DicConsole.DebugWriteLine("SolarFS plugin", "BPB.sptrk: {0}", bpb.sptrk);
DicConsole.DebugWriteLine("SolarFS plugin", "BPB.heads: {0}", bpb.heads);
DicConsole.DebugWriteLine("SolarFS plugin",
"BPB.unk3: 0x{0:X2}{1:X2}{2:X2}{3:X2}{4:X2}{5:X2}{6:X2}{7:X2}{8:X2}{9:X2}",
bpb.unk3[0], bpb.unk3[1], bpb.unk3[2], bpb.unk3[3], bpb.unk3[4], bpb.unk3[5],
bpb.unk3[6], bpb.unk3[7], bpb.unk3[8], bpb.unk3[9]);
DicConsole.DebugWriteLine("SolarFS plugin", "BPB.signature: 0x{0:X2}", bpb.signature);
DicConsole.DebugWriteLine("SolarFS plugin", "BPB.unk4: 0x{0:X8}", bpb.unk4);
DicConsole.DebugWriteLine("SolarFS plugin", "BPB.vol_name: \"{0}\"", bpb.vol_name);
DicConsole.DebugWriteLine("SolarFS plugin", "BPB.fs_type: \"{0}\"", bpb.fs_type);
DicConsole.DebugWriteLine("SolarFS plugin", "BPB.unk4: 0x{0:X8}", bpb.unk4);
DicConsole.DebugWriteLine("SolarFS plugin", "BPB.vol_name: \"{0}\"", bpb.vol_name);
DicConsole.DebugWriteLine("SolarFS plugin", "BPB.fs_type: \"{0}\"", bpb.fs_type);
sb.AppendLine("Solar_OS filesystem");
sb.AppendFormat("Media descriptor: 0x{0:X2}", bpb.media).AppendLine();
@@ -129,13 +129,14 @@ namespace DiscImageChef.Filesystems
{
if(bpb.bps != imagePlugin.Info.SectorSize)
sb
.AppendFormat("WARNING: Filesystem describes a {0} bytes/sector, while device describes a {1} bytes/sector",
bpb.bps, 2048).AppendLine();
.AppendFormat("WARNING: Filesystem describes a {0} bytes/sector, while device describes a {1} bytes/sector",
bpb.bps, 2048).AppendLine();
}
else if(bpb.bps != imagePlugin.Info.SectorSize)
sb
.AppendFormat("WARNING: Filesystem describes a {0} bytes/sector, while device describes a {1} bytes/sector",
bpb.bps, imagePlugin.Info.SectorSize).AppendLine();
.AppendFormat("WARNING: Filesystem describes a {0} bytes/sector, while device describes a {1} bytes/sector",
bpb.bps, imagePlugin.Info.SectorSize).AppendLine();
sb.AppendFormat("{0} sectors on volume ({1} bytes)", bpb.sectors, bpb.sectors * bpb.bps).AppendLine();
if(bpb.sectors > imagePlugin.Info.Sectors)
sb.AppendFormat("WARNING: Filesystem describes a {0} sectors volume, bigger than device ({1} sectors)",
@@ -146,10 +147,10 @@ namespace DiscImageChef.Filesystems
XmlFsType = new FileSystemType
{
Type = "SolarFS",
Clusters = bpb.sectors,
Type = "SolarFS",
Clusters = bpb.sectors,
ClusterSize = bpb.bps,
VolumeName = bpb.vol_name
VolumeName = bpb.vol_name
};
information = sb.ToString();