REFACTOR: Reformat code.

This commit is contained in:
2017-12-19 20:33:03 +00:00
parent 77edc7c91c
commit e6f6ace80b
704 changed files with 82627 additions and 83641 deletions

View File

@@ -54,17 +54,17 @@ namespace DiscImageChef.Filesystems
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct nc1ireg_sb
{
public ushort i_unused; /* reserved */
public ushort i_nblk; /* number of blocks */
public uint i_sblk; /* start block number */
public ushort i_unused; /* reserved */
public ushort i_nblk; /* number of blocks */
public uint i_sblk; /* start block number */
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct nc1fdev_sb
{
public long fd_name; /* Physical device name */
public uint fd_sblk; /* Start block number */
public uint fd_nblk; /* Number of blocks */
public long fd_name; /* Physical device name */
public uint fd_sblk; /* Start block number */
public uint fd_nblk; /* Number of blocks */
[MarshalAs(UnmanagedType.ByValArray, SizeConst = NC1MAXIREG)]
public nc1ireg_sb[] fd_ireg; /* Inode regions */
}
@@ -72,64 +72,61 @@ namespace DiscImageChef.Filesystems
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct UNICOS_Superblock
{
public ulong s_magic; /* magic number to indicate file system type */
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public byte[] s_fname; /* file system name */
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public byte[] s_fpack; /* file system pack name */
public dev_t s_dev; /* major/minor device, for verification */
public ulong s_magic; /* magic number to indicate file system type */
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] s_fname; /* file system name */
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] s_fpack; /* file system pack name */
public dev_t s_dev; /* major/minor device, for verification */
public daddr_t s_fsize; /* size in blocks of entire volume */
public long s_isize; /* Number of total inodes */
public long s_bigfile; /* number of bytes at which a file is big */
public long s_bigunit; /* minimum number of blocks allocated for big files */
public ulong s_secure; /* security: secure FS label */
public long s_maxlvl; /* security: maximum security level */
public long s_minlvl; /* security: minimum security level */
public long s_valcmp; /* security: valid security compartments */
public time_t s_time; /* last super block update */
public blkno_t s_dboff; /* Dynamic block number */
public ino_t s_root; /* root inode */
public long s_error; /* Type of file system error detected */
public blkno_t s_mapoff; /* Start map block number */
public long s_mapblks; /* Last map block number */
public long s_nscpys; /* Number of copies of s.b per partition */
public long s_npart; /* Number of partitions */
public long s_ifract; /* Ratio of inodes to blocks */
public extent_t s_sfs; /* SFS only blocks */
public long s_flag; /* Flag word */
public daddr_t s_fsize; /* size in blocks of entire volume */
public long s_isize; /* Number of total inodes */
public long s_bigfile; /* number of bytes at which a file is big */
public long s_bigunit; /* minimum number of blocks allocated for big files */
public ulong s_secure; /* security: secure FS label */
public long s_maxlvl; /* security: maximum security level */
public long s_minlvl; /* security: minimum security level */
public long s_valcmp; /* security: valid security compartments */
public time_t s_time; /* last super block update */
public blkno_t s_dboff; /* Dynamic block number */
public ino_t s_root; /* root inode */
public long s_error; /* Type of file system error detected */
public blkno_t s_mapoff; /* Start map block number */
public long s_mapblks; /* Last map block number */
public long s_nscpys; /* Number of copies of s.b per partition */
public long s_npart; /* Number of partitions */
public long s_ifract; /* Ratio of inodes to blocks */
public extent_t s_sfs; /* SFS only blocks */
public long s_flag; /* Flag word */
[MarshalAs(UnmanagedType.ByValArray, SizeConst = NC1MAXPART)]
public nc1fdev_sb[] s_part; /* Partition descriptors */
public long s_iounit; /* Physical block size */
public long s_numiresblks; /* number of inode reservation blocks */
/* per region (currently 1) */
/* 0 = 1*(AU) words, n = (n+1)*(AU) words */
public nc1fdev_sb[] s_part; /* Partition descriptors */
public long s_iounit; /* Physical block size */
public long s_numiresblks; /* number of inode reservation blocks */
/* per region (currently 1) */
/* 0 = 1*(AU) words, n = (n+1)*(AU) words */
public long s_priparts; /* bitmap of primary partitions */
public long s_priblock; /* block size of primary partition(s) */
/* 0 = 1*512 words, n = (n+1)*512 words */
/* 0 = 1*512 words, n = (n+1)*512 words */
public long s_prinblks; /* number of 512 wds blocks in primary */
public long s_secparts; /* bitmap of secondary partitions */
public long s_secblock; /* block size of secondary partition(s) */
/* 0 = 1*512 words, n = (n+1)*512 words */
/* 0 = 1*512 words, n = (n+1)*512 words */
public long s_secnblks; /* number of 512 wds blocks in secondary */
public long s_sbdbparts; /* bitmap of partitions with file system data */
/* including super blocks, dynamic block */
/* and free block bitmaps (only primary */
/* partitions may contain these) */
public long s_rootdparts; /* bitmap of partitions with root directory */
/* (only primary partitions) */
public long s_sbdbparts; /* bitmap of partitions with file system data */
/* including super blocks, dynamic block */
/* and free block bitmaps (only primary */
/* partitions may contain these) */
public long s_rootdparts; /* bitmap of partitions with root directory */
/* (only primary partitions) */
public long s_nudparts; /* bitmap of no-user-data partitions */
/* (only primary partitions) */
public long s_nsema; /* SFS: # fs semaphores to allocate */
public long s_priactive; /* bitmap of primary partitions which contain */
/* active (up to date) dynamic blocks and */
/* free block bitmaps. All bits set indicate */
/* that all primary partitions are active, */
/* and no kernel manipulation of active flag */
/* is allowed. */
public long s_sfs_arbiterid;/* SFS Arbiter ID */
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 91)]
public long[] s_fill; /* reserved */
/* (only primary partitions) */
public long s_nsema; /* SFS: # fs semaphores to allocate */
public long s_priactive; /* bitmap of primary partitions which contain */
/* active (up to date) dynamic blocks and */
/* free block bitmaps. All bits set indicate */
/* that all primary partitions are active, */
/* and no kernel manipulation of active flag */
/* is allowed. */
public long s_sfs_arbiterid; /* SFS Arbiter ID */
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 91)] public long[] s_fill; /* reserved */
}
const ulong UNICOS_Magic = 0x6e6331667331636e;
@@ -146,71 +143,60 @@ namespace DiscImageChef.Filesystems
{
Name = "UNICOS Filesystem Plugin";
PluginUUID = new Guid("61712F04-066C-44D5-A2A0-1E44C66B33F0");
if(encoding == null)
CurrentEncoding = Encoding.GetEncoding("iso-8859-15");
else
CurrentEncoding = encoding;
if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15");
else CurrentEncoding = encoding;
}
public UNICOS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "UNICOS Filesystem Plugin";
PluginUUID = new Guid("61712F04-066C-44D5-A2A0-1E44C66B33F0");
if(encoding == null)
CurrentEncoding = Encoding.GetEncoding("iso-8859-15");
else
CurrentEncoding = encoding;
if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15");
else CurrentEncoding = encoding;
}
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition)
{
if(imagePlugin.GetSectorSize() < 512)
return false;
if(imagePlugin.GetSectorSize() < 512) return false;
UNICOS_Superblock unicosSb = new UNICOS_Superblock();
uint sbSize = (uint)((Marshal.SizeOf(unicosSb)) / imagePlugin.GetSectorSize());
if((Marshal.SizeOf(unicosSb)) % imagePlugin.GetSectorSize() != 0)
sbSize++;
if((Marshal.SizeOf(unicosSb)) % imagePlugin.GetSectorSize() != 0) sbSize++;
byte[] sector = imagePlugin.ReadSectors(partition.Start, sbSize);
if(sector.Length < Marshal.SizeOf(unicosSb))
return false;
if(sector.Length < Marshal.SizeOf(unicosSb)) return false;
unicosSb = BigEndianMarshal.ByteArrayToStructureBigEndian<UNICOS_Superblock>(sector);
DicConsole.DebugWriteLine("UNICOS plugin", "magic = 0x{0:X16} (expected 0x{1:X16})", unicosSb.s_magic, UNICOS_Magic);
DicConsole.DebugWriteLine("UNICOS plugin", "magic = 0x{0:X16} (expected 0x{1:X16})", unicosSb.s_magic,
UNICOS_Magic);
return unicosSb.s_magic == UNICOS_Magic;
}
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 = "";
if(imagePlugin.GetSectorSize() < 512)
return;
if(imagePlugin.GetSectorSize() < 512) return;
UNICOS_Superblock unicosSb = new UNICOS_Superblock();
uint sbSize = (uint)((Marshal.SizeOf(unicosSb)) / imagePlugin.GetSectorSize());
if((Marshal.SizeOf(unicosSb)) % imagePlugin.GetSectorSize() != 0)
sbSize++;
if((Marshal.SizeOf(unicosSb)) % imagePlugin.GetSectorSize() != 0) sbSize++;
byte[] sector = imagePlugin.ReadSectors(partition.Start, sbSize);
if(sector.Length < Marshal.SizeOf(unicosSb))
return;
if(sector.Length < Marshal.SizeOf(unicosSb)) return;
unicosSb = BigEndianMarshal.ByteArrayToStructureBigEndian<UNICOS_Superblock>(sector);
if(unicosSb.s_magic != UNICOS_Magic)
return;
if(unicosSb.s_magic != UNICOS_Magic) return;
StringBuilder sb = new StringBuilder();
sb.AppendLine("UNICOS filesystem");
if(unicosSb.s_secure == UNICOS_Secure)
sb.AppendLine("Volume is secure");
if(unicosSb.s_secure == UNICOS_Secure) sb.AppendLine("Volume is secure");
sb.AppendFormat("Volume contains {0} partitions", unicosSb.s_npart).AppendLine();
sb.AppendFormat("{0} bytes per sector", unicosSb.s_iounit).AppendLine();
sb.AppendLine("4096 bytes per block");
@@ -220,7 +206,8 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("Volume last updated on {0}", DateHandlers.UNIXToDateTime(unicosSb.s_time)).AppendLine();
if(unicosSb.s_error > 0)
sb.AppendFormat("Volume is dirty, error code = 0x{0:X16}", unicosSb.s_error).AppendLine();
sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(unicosSb.s_fname, CurrentEncoding)).AppendLine();
sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(unicosSb.s_fname, CurrentEncoding))
.AppendLine();
information = sb.ToString();