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:
@@ -41,8 +41,7 @@ namespace DiscImageChef.Filesystems.UCSDPascal
|
||||
{
|
||||
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition)
|
||||
{
|
||||
if(partition.Length < 3)
|
||||
return false;
|
||||
if(partition.Length < 3) return false;
|
||||
|
||||
// Blocks 0 and 1 are boot code
|
||||
byte[] volBlock = imagePlugin.ReadSector(2 + partition.Start);
|
||||
@@ -63,39 +62,34 @@ namespace DiscImageChef.Filesystems.UCSDPascal
|
||||
volEntry.tail = BigEndianBitConverter.ToInt32(volBlock, 0x16);
|
||||
|
||||
// First block is always 0 (even is it's sector 2)
|
||||
if(volEntry.firstBlock != 0)
|
||||
return false;
|
||||
if(volEntry.firstBlock != 0) return false;
|
||||
|
||||
// Last volume record block must be after first block, and before end of device
|
||||
if(volEntry.lastBlock <= volEntry.firstBlock || (ulong)volEntry.lastBlock > imagePlugin.GetSectors() - 2)
|
||||
return false;
|
||||
if(volEntry.lastBlock <= volEntry.firstBlock ||
|
||||
(ulong)volEntry.lastBlock > imagePlugin.GetSectors() - 2) return false;
|
||||
|
||||
// Volume record entry type must be volume or secure
|
||||
if(volEntry.entryType != PascalFileKind.Volume && volEntry.entryType != PascalFileKind.Secure)
|
||||
return false;
|
||||
if(volEntry.entryType != PascalFileKind.Volume && volEntry.entryType != PascalFileKind.Secure) return false;
|
||||
|
||||
// Volume name is max 7 characters
|
||||
if(volEntry.volumeName[0] > 7)
|
||||
return false;
|
||||
if(volEntry.volumeName[0] > 7) return false;
|
||||
|
||||
// Volume blocks is equal to volume sectors
|
||||
if(volEntry.blocks < 0 || (ulong)volEntry.blocks != imagePlugin.GetSectors())
|
||||
return false;
|
||||
if(volEntry.blocks < 0 || (ulong)volEntry.blocks != imagePlugin.GetSectors()) return false;
|
||||
|
||||
// There can be not less than zero files
|
||||
if(volEntry.files < 0)
|
||||
return false;
|
||||
if(volEntry.files < 0) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information)
|
||||
public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition,
|
||||
out string information)
|
||||
{
|
||||
StringBuilder sbInformation = new StringBuilder();
|
||||
information = "";
|
||||
|
||||
if(imagePlugin.GetSectors() < 3)
|
||||
return;
|
||||
if(imagePlugin.GetSectors() < 3) return;
|
||||
|
||||
// Blocks 0 and 1 are boot code
|
||||
byte[] volBlock = imagePlugin.ReadSector(2 + partition.Start);
|
||||
@@ -116,34 +110,34 @@ namespace DiscImageChef.Filesystems.UCSDPascal
|
||||
volEntry.tail = BigEndianBitConverter.ToInt32(volBlock, 0x16);
|
||||
|
||||
// First block is always 0 (even is it's sector 2)
|
||||
if(volEntry.firstBlock != 0)
|
||||
return;
|
||||
if(volEntry.firstBlock != 0) return;
|
||||
|
||||
// Last volume record block must be after first block, and before end of device
|
||||
if(volEntry.lastBlock <= volEntry.firstBlock || (ulong)volEntry.lastBlock > imagePlugin.GetSectors() - 2)
|
||||
return;
|
||||
if(volEntry.lastBlock <= volEntry.firstBlock ||
|
||||
(ulong)volEntry.lastBlock > imagePlugin.GetSectors() - 2) return;
|
||||
|
||||
// Volume record entry type must be volume or secure
|
||||
if(volEntry.entryType != PascalFileKind.Volume && volEntry.entryType != PascalFileKind.Secure)
|
||||
return;
|
||||
if(volEntry.entryType != PascalFileKind.Volume && volEntry.entryType != PascalFileKind.Secure) return;
|
||||
|
||||
// Volume name is max 7 characters
|
||||
if(volEntry.volumeName[0] > 7)
|
||||
return;
|
||||
if(volEntry.volumeName[0] > 7) return;
|
||||
|
||||
// Volume blocks is equal to volume sectors
|
||||
if(volEntry.blocks < 0 || (ulong)volEntry.blocks != imagePlugin.GetSectors())
|
||||
return;
|
||||
if(volEntry.blocks < 0 || (ulong)volEntry.blocks != imagePlugin.GetSectors()) return;
|
||||
|
||||
// There can be not less than zero files
|
||||
if(volEntry.files < 0)
|
||||
return;
|
||||
if(volEntry.files < 0) return;
|
||||
|
||||
sbInformation.AppendFormat("Volume record spans from block {0} to block {1}", volEntry.firstBlock, volEntry.lastBlock).AppendLine();
|
||||
sbInformation.AppendFormat("Volume name: {0}", StringHandlers.PascalToString(volEntry.volumeName, CurrentEncoding)).AppendLine();
|
||||
sbInformation.AppendFormat("Volume record spans from block {0} to block {1}", volEntry.firstBlock,
|
||||
volEntry.lastBlock).AppendLine();
|
||||
sbInformation.AppendFormat("Volume name: {0}",
|
||||
StringHandlers.PascalToString(volEntry.volumeName, CurrentEncoding))
|
||||
.AppendLine();
|
||||
sbInformation.AppendFormat("Volume has {0} blocks", volEntry.blocks).AppendLine();
|
||||
sbInformation.AppendFormat("Volume has {0} files", volEntry.files).AppendLine();
|
||||
sbInformation.AppendFormat("Volume last booted at {0}", DateHandlers.UCSDPascalToDateTime(volEntry.lastBoot)).AppendLine();
|
||||
sbInformation
|
||||
.AppendFormat("Volume last booted at {0}", DateHandlers.UCSDPascalToDateTime(volEntry.lastBoot))
|
||||
.AppendLine();
|
||||
|
||||
information = sbInformation.ToString();
|
||||
|
||||
@@ -159,5 +153,4 @@ namespace DiscImageChef.Filesystems.UCSDPascal
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user