From ffd1cd65645eac5e7ad242e7bcab6f2e5583b2b1 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Tue, 23 Apr 2019 01:38:33 +0100 Subject: [PATCH] Update CICMMetadata version. --- CICMMetadata | 2 +- .../Structs/Filesystems.cs | 4 +- DiscImageChef.Core/Devices/Dumping/ATA.cs | 16 +- DiscImageChef.Core/Devices/Dumping/MMC.cs | 51 +- DiscImageChef.Core/Devices/Dumping/SBC.cs | 22 +- DiscImageChef.Core/Devices/Dumping/SSC.cs | 42 +- .../Devices/Dumping/SecureDigital.cs | 30 +- DiscImageChef.Core/Devices/Dumping/XGD.cs | 4 +- DiscImageChef.Core/Sidecar/AudioMedia.cs | 6 +- DiscImageChef.Core/Sidecar/BlockMedia.cs | 83 +-- DiscImageChef.Core/Sidecar/BlockTape.cs | 20 +- DiscImageChef.Core/Sidecar/LinearMedia.cs | 2 +- DiscImageChef.Core/Sidecar/OpticalDisc.cs | 107 ++-- DiscImageChef.Filesystems/AODOS.cs | 20 +- DiscImageChef.Filesystems/APFS.cs | 18 +- DiscImageChef.Filesystems/Acorn.cs | 152 ++--- DiscImageChef.Filesystems/AmigaDOS.cs | 54 +- .../AppleDOS/AppleDOS.cs | 2 +- DiscImageChef.Filesystems/AppleDOS/File.cs | 5 +- DiscImageChef.Filesystems/AppleDOS/Info.cs | 4 +- DiscImageChef.Filesystems/AppleDOS/Super.cs | 6 +- DiscImageChef.Filesystems/AppleHFS.cs | 116 ++-- DiscImageChef.Filesystems/AppleHFSPlus.cs | 246 ++++---- DiscImageChef.Filesystems/AppleMFS/Info.cs | 2 +- DiscImageChef.Filesystems/AppleMFS/Super.cs | 2 +- DiscImageChef.Filesystems/AtheOS.cs | 66 +- DiscImageChef.Filesystems/BFS.cs | 54 +- DiscImageChef.Filesystems/BTRFS.cs | 98 +-- DiscImageChef.Filesystems/CBM.cs | 56 +- DiscImageChef.Filesystems/CPM/Info.cs | 10 +- DiscImageChef.Filesystems/CPM/Super.cs | 8 +- DiscImageChef.Filesystems/ECMA67.cs | 30 +- DiscImageChef.Filesystems/EFS.cs | 46 +- DiscImageChef.Filesystems/F2FS.cs | 94 +-- DiscImageChef.Filesystems/FAT.cs | 596 +++++++++--------- DiscImageChef.Filesystems/FATX/Info.cs | 8 +- DiscImageChef.Filesystems/FATX/Super.cs | 8 +- DiscImageChef.Filesystems/FFS.cs | 204 +++--- DiscImageChef.Filesystems/HAMMER.cs | 60 +- DiscImageChef.Filesystems/HPOFS.cs | 112 ++-- DiscImageChef.Filesystems/JFS.cs | 70 +- DiscImageChef.Filesystems/LIF.cs | 26 +- DiscImageChef.Filesystems/LisaFS/Info.cs | 2 +- DiscImageChef.Filesystems/LisaFS/Super.cs | 2 +- DiscImageChef.Filesystems/Locus.cs | 114 ++-- DiscImageChef.Filesystems/MicroDOS.cs | 36 +- DiscImageChef.Filesystems/NILFS2.cs | 86 +-- DiscImageChef.Filesystems/NTFS.cs | 64 +- DiscImageChef.Filesystems/Nintendo.cs | 2 +- DiscImageChef.Filesystems/ODS.cs | 96 +-- DiscImageChef.Filesystems/Opera.cs | 28 +- DiscImageChef.Filesystems/PCEngine.cs | 2 +- DiscImageChef.Filesystems/PCFX.cs | 32 +- DiscImageChef.Filesystems/PFS.cs | 46 +- DiscImageChef.Filesystems/ProDOS.cs | 4 +- DiscImageChef.Filesystems/QNX4.cs | 68 +- DiscImageChef.Filesystems/QNX6.cs | 82 +-- DiscImageChef.Filesystems/RBF.cs | 90 +-- DiscImageChef.Filesystems/RT11.cs | 34 +- DiscImageChef.Filesystems/ReFS.cs | 32 +- DiscImageChef.Filesystems/Reiser4.cs | 17 +- DiscImageChef.Filesystems/SFS.cs | 46 +- DiscImageChef.Filesystems/Squash.cs | 42 +- DiscImageChef.Filesystems/UCSDPascal/Info.cs | 6 +- DiscImageChef.Filesystems/UCSDPascal/Super.cs | 14 +- DiscImageChef.Filesystems/UDF.cs | 158 ++--- DiscImageChef.Filesystems/UNICOS.cs | 94 +-- DiscImageChef.Filesystems/UNIXBFS.cs | 4 +- DiscImageChef.Filesystems/VMfs.cs | 26 +- DiscImageChef.Filesystems/VxFS.cs | 144 ++--- DiscImageChef.Filesystems/XFS.cs | 118 ++-- DiscImageChef.Filesystems/Xia.cs | 62 +- DiscImageChef.Filesystems/dump.cs | 112 ++-- DiscImageChef.Filesystems/exFAT.cs | 68 +- DiscImageChef.Filesystems/ext2FS.cs | 194 +++--- DiscImageChef.Filesystems/extFS.cs | 2 +- DiscImageChef/Commands/CreateSidecar.cs | 4 +- 77 files changed, 2263 insertions(+), 2230 deletions(-) diff --git a/CICMMetadata b/CICMMetadata index ebde6d67e..5debf2c35 160000 --- a/CICMMetadata +++ b/CICMMetadata @@ -1 +1 @@ -Subproject commit ebde6d67e1c91e981222516a9e25d98bf3d9bb05 +Subproject commit 5debf2c35979da8d11f82df4c8f31734714f7f4c diff --git a/DiscImageChef.CommonTypes/Structs/Filesystems.cs b/DiscImageChef.CommonTypes/Structs/Filesystems.cs index e7e6e176a..66b2cefd5 100644 --- a/DiscImageChef.CommonTypes/Structs/Filesystems.cs +++ b/DiscImageChef.CommonTypes/Structs/Filesystems.cs @@ -221,13 +221,13 @@ namespace DiscImageChef.CommonTypes.Structs public class FileSystemInfo { /// Blocks for this filesystem - public long Blocks; + public ulong Blocks; /// Maximum length of filenames on this filesystem public ushort FilenameLength; /// Files on this filesystem public ulong Files; /// Blocks free on this filesystem - public long FreeBlocks; + public ulong FreeBlocks; /// Free inodes on this filesystem public ulong FreeFiles; /// Filesystem ID diff --git a/DiscImageChef.Core/Devices/Dumping/ATA.cs b/DiscImageChef.Core/Devices/Dumping/ATA.cs index 254b5c07d..82d4b4071 100644 --- a/DiscImageChef.Core/Devices/Dumping/ATA.cs +++ b/DiscImageChef.Core/Devices/Dumping/ATA.cs @@ -553,7 +553,7 @@ namespace DiscImageChef.Core.Devices.Dumping Descriptors = new DumpType { Image = outputPath, - Size = dev.UsbDescriptors.Length, + Size = (ulong)dev.UsbDescriptors.Length, Checksums = Checksum.GetChecksums(dev.UsbDescriptors).ToArray() } }; @@ -571,7 +571,7 @@ namespace DiscImageChef.Core.Devices.Dumping CIS = new DumpType { Image = outputPath, - Size = dev.Cis.Length, + Size = (ulong)dev.Cis.Length, Checksums = Checksum.GetChecksums(dev.Cis).ToArray() } }; @@ -622,7 +622,7 @@ namespace DiscImageChef.Core.Devices.Dumping Identify = new DumpType { Image = outputPath, - Size = cmdBuf.Length, + Size = (ulong)cmdBuf.Length, Checksums = Checksum.GetChecksums(cmdBuf).ToArray() } }; @@ -642,7 +642,7 @@ namespace DiscImageChef.Core.Devices.Dumping filesystems.AddRange(from partition in sidecar.BlockMedia[0].FileSystemInformation where partition.FileSystems != null from fileSystem in partition.FileSystems - select ((ulong)partition.StartSector, fileSystem.Type)); + select (partition.StartSector, fileSystem.Type)); if(filesystems.Count > 0) foreach(var filesystem in filesystems.Select(o => new {o.start, o.type}).Distinct()) @@ -666,13 +666,13 @@ namespace DiscImageChef.Core.Devices.Dumping sidecar.BlockMedia[0].DiskType = xmlDskTyp; sidecar.BlockMedia[0].DiskSubType = xmlDskSubTyp; sidecar.BlockMedia[0].Interface = "ATA"; - sidecar.BlockMedia[0].LogicalBlocks = (long)blocks; - sidecar.BlockMedia[0].PhysicalBlockSize = (int)physicalsectorsize; - sidecar.BlockMedia[0].LogicalBlockSize = (int)blockSize; + sidecar.BlockMedia[0].LogicalBlocks = blocks; + sidecar.BlockMedia[0].PhysicalBlockSize = physicalsectorsize; + sidecar.BlockMedia[0].LogicalBlockSize = blockSize; sidecar.BlockMedia[0].Manufacturer = dev.Manufacturer; sidecar.BlockMedia[0].Model = dev.Model; sidecar.BlockMedia[0].Serial = dev.Serial; - sidecar.BlockMedia[0].Size = (long)(blocks * blockSize); + sidecar.BlockMedia[0].Size = blocks * blockSize; if(cylinders > 0 && heads > 0 && sectors > 0) { sidecar.BlockMedia[0].Cylinders = cylinders; diff --git a/DiscImageChef.Core/Devices/Dumping/MMC.cs b/DiscImageChef.Core/Devices/Dumping/MMC.cs index 2d00f40bc..0e2873924 100644 --- a/DiscImageChef.Core/Devices/Dumping/MMC.cs +++ b/DiscImageChef.Core/Devices/Dumping/MMC.cs @@ -585,7 +585,7 @@ namespace DiscImageChef.Core.Devices.Dumping sidecar.OpticalDisc[0].PFI = new DumpType { Image = outputPath, - Size = tag.Value.Length, + Size = (ulong)tag.Value.Length, Checksums = Checksum.GetChecksums(tag.Value).ToArray() }; break; @@ -593,7 +593,7 @@ namespace DiscImageChef.Core.Devices.Dumping sidecar.OpticalDisc[0].DMI = new DumpType { Image = outputPath, - Size = tag.Value.Length, + Size = (ulong)tag.Value.Length, Checksums = Checksum.GetChecksums(tag.Value).ToArray() }; break; @@ -602,7 +602,7 @@ namespace DiscImageChef.Core.Devices.Dumping sidecar.OpticalDisc[0].CMI = new DumpType { Image = outputPath, - Size = tag.Value.Length, + Size = (ulong)tag.Value.Length, Checksums = Checksum.GetChecksums(tag.Value).ToArray() }; @@ -621,7 +621,7 @@ namespace DiscImageChef.Core.Devices.Dumping sidecar.OpticalDisc[0].BCA = new DumpType { Image = outputPath, - Size = tag.Value.Length, + Size = (ulong)tag.Value.Length, Checksums = Checksum.GetChecksums(tag.Value).ToArray() }; break; @@ -630,7 +630,7 @@ namespace DiscImageChef.Core.Devices.Dumping sidecar.OpticalDisc[0].DDS = new DumpType { Image = outputPath, - Size = tag.Value.Length, + Size = (ulong)tag.Value.Length, Checksums = Checksum.GetChecksums(tag.Value).ToArray() }; break; @@ -639,7 +639,7 @@ namespace DiscImageChef.Core.Devices.Dumping sidecar.OpticalDisc[0].SAI = new DumpType { Image = outputPath, - Size = tag.Value.Length, + Size = (ulong)tag.Value.Length, Checksums = Checksum.GetChecksums(tag.Value).ToArray() }; break; @@ -647,7 +647,7 @@ namespace DiscImageChef.Core.Devices.Dumping sidecar.OpticalDisc[0].PRI = new DumpType { Image = outputPath, - Size = tag.Value.Length, + Size = (ulong)tag.Value.Length, Checksums = Checksum.GetChecksums(tag.Value).ToArray() }; break; @@ -655,7 +655,7 @@ namespace DiscImageChef.Core.Devices.Dumping sidecar.OpticalDisc[0].MediaID = new DumpType { Image = outputPath, - Size = tag.Value.Length, + Size = (ulong)tag.Value.Length, Checksums = Checksum.GetChecksums(tag.Value).ToArray() }; break; @@ -663,7 +663,7 @@ namespace DiscImageChef.Core.Devices.Dumping sidecar.OpticalDisc[0].PFIR = new DumpType { Image = outputPath, - Size = tag.Value.Length, + Size = (ulong)tag.Value.Length, Checksums = Checksum.GetChecksums(tag.Value).ToArray() }; break; @@ -671,7 +671,7 @@ namespace DiscImageChef.Core.Devices.Dumping sidecar.OpticalDisc[0].ADIP = new DumpType { Image = outputPath, - Size = tag.Value.Length, + Size = (ulong)tag.Value.Length, Checksums = Checksum.GetChecksums(tag.Value).ToArray() }; break; @@ -679,7 +679,7 @@ namespace DiscImageChef.Core.Devices.Dumping sidecar.OpticalDisc[0].DCB = new DumpType { Image = outputPath, - Size = tag.Value.Length, + Size = (ulong)tag.Value.Length, Checksums = Checksum.GetChecksums(tag.Value).ToArray() }; break; @@ -687,7 +687,7 @@ namespace DiscImageChef.Core.Devices.Dumping sidecar.OpticalDisc[0].DI = new DumpType { Image = outputPath, - Size = tag.Value.Length, + Size = (ulong)tag.Value.Length, Checksums = Checksum.GetChecksums(tag.Value).ToArray() }; break; @@ -703,7 +703,7 @@ namespace DiscImageChef.Core.Devices.Dumping SecuritySectors = new DumpType { Image = outputPath, - Size = tag.Value.Length, + Size = (ulong)tag.Value.Length, Checksums = Checksum.GetChecksums(tag.Value).ToArray() } } @@ -716,7 +716,7 @@ namespace DiscImageChef.Core.Devices.Dumping sidecar.OpticalDisc[0].Xbox.PFI = new DumpType { Image = outputPath, - Size = tag.Value.Length, + Size = (ulong)tag.Value.Length, Checksums = Checksum.GetChecksums(tag.Value).ToArray() }; break; @@ -726,7 +726,7 @@ namespace DiscImageChef.Core.Devices.Dumping sidecar.OpticalDisc[0].Xbox.DMI = new DumpType { Image = outputPath, - Size = tag.Value.Length, + Size = (ulong)tag.Value.Length, Checksums = Checksum.GetChecksums(tag.Value).ToArray() }; break; @@ -734,7 +734,7 @@ namespace DiscImageChef.Core.Devices.Dumping sidecar.OpticalDisc[0].TOC = new DumpType { Image = outputPath, - Size = tag.Value.Length, + Size = (ulong)tag.Value.Length, Checksums = Checksum.GetChecksums(tag.Value).ToArray() }; break; @@ -742,7 +742,7 @@ namespace DiscImageChef.Core.Devices.Dumping sidecar.OpticalDisc[0].ATIP = new DumpType { Image = outputPath, - Size = tag.Value.Length, + Size = (ulong)tag.Value.Length, Checksums = Checksum.GetChecksums(tag.Value).ToArray() }; break; @@ -750,7 +750,7 @@ namespace DiscImageChef.Core.Devices.Dumping sidecar.OpticalDisc[0].PMA = new DumpType { Image = outputPath, - Size = tag.Value.Length, + Size = (ulong)tag.Value.Length, Checksums = Checksum.GetChecksums(tag.Value).ToArray() }; break; @@ -758,17 +758,28 @@ namespace DiscImageChef.Core.Devices.Dumping sidecar.OpticalDisc[0].LeadInCdText = new DumpType { Image = outputPath, - Size = tag.Value.Length, + Size = (ulong)tag.Value.Length, Checksums = Checksum.GetChecksums(tag.Value).ToArray() }; break; case MediaTagType.CD_FirstTrackPregap: + sidecar.OpticalDisc[0].FirstTrackPregrap = new[] + { + new BorderType + { + Image = outputPath, + Size = (ulong)tag.Value.Length, + Checksums = Checksum.GetChecksums(tag.Value).ToArray() + } + }; + break; + case MediaTagType.CD_LeadIn: sidecar.OpticalDisc[0].LeadIn = new[] { new BorderType { Image = outputPath, - Size = tag.Value.Length, + Size = (ulong)tag.Value.Length, Checksums = Checksum.GetChecksums(tag.Value).ToArray() } }; diff --git a/DiscImageChef.Core/Devices/Dumping/SBC.cs b/DiscImageChef.Core/Devices/Dumping/SBC.cs index 40ffb35fe..0f21af908 100644 --- a/DiscImageChef.Core/Devices/Dumping/SBC.cs +++ b/DiscImageChef.Core/Devices/Dumping/SBC.cs @@ -863,7 +863,7 @@ namespace DiscImageChef.Core.Devices.Dumping from partition in xmlTrack.FileSystemInformation where partition.FileSystems != null from fileSystem in partition.FileSystems - select ((ulong)partition.StartSector, fileSystem.Type)); + select (partition.StartSector, fileSystem.Type)); if(filesystems.Count > 0) foreach(var filesystem in filesystems.Select(o => new {o.start, o.type}).Distinct()) @@ -904,7 +904,7 @@ namespace DiscImageChef.Core.Devices.Dumping Descriptors = new DumpType { Image = outputPath, - Size = dev.UsbDescriptors.Length, + Size = (ulong)dev.UsbDescriptors.Length, Checksums = Checksum.GetChecksums(dev.UsbDescriptors).ToArray() } }; @@ -920,7 +920,7 @@ namespace DiscImageChef.Core.Devices.Dumping Identify = new DumpType { Image = outputPath, - Size = cmdBuf.Length, + Size = (ulong)cmdBuf.Length, Checksums = Checksum.GetChecksums(cmdBuf).ToArray() } }; @@ -935,7 +935,7 @@ namespace DiscImageChef.Core.Devices.Dumping Inquiry = new DumpType { Image = outputPath, - Size = cmdBuf.Length, + Size = (ulong)cmdBuf.Length, Checksums = Checksum.GetChecksums(cmdBuf).ToArray() } }; @@ -990,7 +990,7 @@ namespace DiscImageChef.Core.Devices.Dumping sidecar.BlockMedia[0].SCSI.ModeSense10 = new DumpType { Image = outputPath, - Size = cmdBuf.Length, + Size = (ulong)cmdBuf.Length, Checksums = Checksum.GetChecksums(cmdBuf).ToArray() }; @@ -1009,7 +1009,7 @@ namespace DiscImageChef.Core.Devices.Dumping sidecar.BlockMedia[0].SCSI.ModeSense = new DumpType { Image = outputPath, - Size = cmdBuf.Length, + Size = (ulong)cmdBuf.Length, Checksums = Checksum.GetChecksums(cmdBuf).ToArray() }; } @@ -1020,7 +1020,7 @@ namespace DiscImageChef.Core.Devices.Dumping filesystems.AddRange(from partition in sidecar.BlockMedia[0].FileSystemInformation where partition.FileSystems != null from fileSystem in partition.FileSystems - select ((ulong)partition.StartSector, fileSystem.Type)); + select (partition.StartSector, fileSystem.Type)); if(filesystems.Count > 0) foreach(var filesystem in filesystems.Select(o => new {o.start, o.type}).Distinct()) @@ -1040,13 +1040,13 @@ namespace DiscImageChef.Core.Devices.Dumping else if(dev.IsUsb) sidecar.BlockMedia[0].Interface = "USB"; else if(dev.IsFireWire) sidecar.BlockMedia[0].Interface = "FireWire"; else sidecar.BlockMedia[0].Interface = "SCSI"; - sidecar.BlockMedia[0].LogicalBlocks = (long)blocks; - sidecar.BlockMedia[0].PhysicalBlockSize = (int)physicalBlockSize; - sidecar.BlockMedia[0].LogicalBlockSize = (int)logicalBlockSize; + sidecar.BlockMedia[0].LogicalBlocks = blocks; + sidecar.BlockMedia[0].PhysicalBlockSize = physicalBlockSize; + sidecar.BlockMedia[0].LogicalBlockSize = logicalBlockSize; sidecar.BlockMedia[0].Manufacturer = dev.Manufacturer; sidecar.BlockMedia[0].Model = dev.Model; sidecar.BlockMedia[0].Serial = dev.Serial; - sidecar.BlockMedia[0].Size = (long)(blocks * blockSize); + sidecar.BlockMedia[0].Size = blocks * blockSize; if(dev.IsRemovable) sidecar.BlockMedia[0].DumpHardwareArray = resume.Tries.ToArray(); } diff --git a/DiscImageChef.Core/Devices/Dumping/SSC.cs b/DiscImageChef.Core/Devices/Dumping/SSC.cs index d39e4f8c2..f3f1edd09 100644 --- a/DiscImageChef.Core/Devices/Dumping/SSC.cs +++ b/DiscImageChef.Core/Devices/Dumping/SSC.cs @@ -231,7 +231,7 @@ namespace DiscImageChef.Core.Devices.Dumping sidecar.BlockMedia[0].SCSI.ModeSense10 = new DumpType { Image = outputPrefix + ".modesense10.bin", - Size = cmdBuf.Length, + Size = (ulong)cmdBuf.Length, Checksums = Checksum.GetChecksums(cmdBuf).ToArray() }; DataFile.WriteTo("SCSI Dump", sidecar.BlockMedia[0].SCSI.ModeSense10.Image, cmdBuf); @@ -252,7 +252,7 @@ namespace DiscImageChef.Core.Devices.Dumping sidecar.BlockMedia[0].SCSI.ModeSense = new DumpType { Image = outputPrefix + ".modesense.bin", - Size = cmdBuf.Length, + Size = (ulong)cmdBuf.Length, Checksums = Checksum.GetChecksums(cmdBuf).ToArray() }; DataFile.WriteTo("SCSI Dump", sidecar.BlockMedia[0].SCSI.ModeSense.Image, cmdBuf); @@ -379,12 +379,12 @@ namespace DiscImageChef.Core.Devices.Dumping Image = new ImageType { format = "BINARY", - offset = (long)currentSize, + offset = currentSize, offsetSpecified = true, Value = outputPrefix + ".bin" }, - Sequence = (long)currentFile, - StartBlock = (long)currentBlock, + Sequence = currentFile, + StartBlock = currentBlock, BlockSize = blockSize }; Checksum fileChk = new Checksum(); @@ -393,12 +393,12 @@ namespace DiscImageChef.Core.Devices.Dumping Image = new ImageType { format = "BINARY", - offset = (long)currentSize, + offset = currentSize, offsetSpecified = true, Value = outputPrefix + ".bin" }, Sequence = currentPartition, - StartBlock = (long)currentBlock + StartBlock = currentBlock }; Checksum partitionChk = new Checksum(); @@ -421,8 +421,8 @@ namespace DiscImageChef.Core.Devices.Dumping dumpLog.WriteLine("Finished partition {0}", currentPartition); currentTapePartition.File = files.ToArray(); currentTapePartition.Checksums = partitionChk.End().ToArray(); - currentTapePartition.EndBlock = (long)(currentBlock - 1); - currentTapePartition.Size = (long)currentPartitionSize; + currentTapePartition.EndBlock = currentBlock - 1; + currentTapePartition.Size = currentPartitionSize; partitions.Add(currentTapePartition); currentPartition++; @@ -435,12 +435,12 @@ namespace DiscImageChef.Core.Devices.Dumping Image = new ImageType { format = "BINARY", - offset = (long)currentSize, + offset = currentSize, offsetSpecified = true, Value = outputPrefix + ".bin" }, - Sequence = (long)currentFile, - StartBlock = (long)currentBlock, + Sequence = currentFile, + StartBlock = currentBlock, BlockSize = blockSize }; currentFileSize = 0; @@ -451,12 +451,12 @@ namespace DiscImageChef.Core.Devices.Dumping Image = new ImageType { format = "BINARY", - offset = (long)currentSize, + offset = currentSize, offsetSpecified = true, Value = outputPrefix + ".bin" }, Sequence = currentPartition, - StartBlock = (long)currentBlock + StartBlock = currentBlock }; currentPartitionSize = 0; partitionChk = new Checksum(); @@ -551,8 +551,8 @@ namespace DiscImageChef.Core.Devices.Dumping (fxSense.Value.ASCQ == 0x01 || fxSense.Value.Filemark)) { currentTapeFile.Checksums = fileChk.End().ToArray(); - currentTapeFile.EndBlock = (long)(currentBlock - 1); - currentTapeFile.Size = (long)currentFileSize; + currentTapeFile.EndBlock = currentBlock - 1; + currentTapeFile.Size = currentFileSize; files.Add(currentTapeFile); currentFile++; @@ -561,12 +561,12 @@ namespace DiscImageChef.Core.Devices.Dumping Image = new ImageType { format = "BINARY", - offset = (long)currentSize, + offset = currentSize, offsetSpecified = true, Value = outputPrefix + ".bin" }, - Sequence = (long)currentFile, - StartBlock = (long)currentBlock, + Sequence = currentFile, + StartBlock = currentBlock, BlockSize = blockSize }; currentFileSize = 0; @@ -644,8 +644,8 @@ namespace DiscImageChef.Core.Devices.Dumping { format = "Raw disk image (sector by sector copy)", Value = outputPrefix + ".bin" }; - sidecar.BlockMedia[0].LogicalBlocks = (long)blocks; - sidecar.BlockMedia[0].Size = (long)currentSize; + sidecar.BlockMedia[0].LogicalBlocks = blocks; + sidecar.BlockMedia[0].Size = currentSize; sidecar.BlockMedia[0].DumpHardwareArray = new DumpHardwareType[1]; sidecar.BlockMedia[0].DumpHardwareArray[0] = new DumpHardwareType {Extents = new ExtentType[1]}; diff --git a/DiscImageChef.Core/Devices/Dumping/SecureDigital.cs b/DiscImageChef.Core/Devices/Dumping/SecureDigital.cs index 8ed082080..3cf1471c0 100644 --- a/DiscImageChef.Core/Devices/Dumping/SecureDigital.cs +++ b/DiscImageChef.Core/Devices/Dumping/SecureDigital.cs @@ -82,7 +82,7 @@ namespace DiscImageChef.Core.Devices.Dumping byte[] ocr = null; byte[] ecsd = null; byte[] scr = null; - int physicalBlockSize = 0; + uint physicalBlockSize = 0; bool byteAddressed = true; Dictionary mediaTags = new Dictionary(); @@ -513,7 +513,9 @@ namespace DiscImageChef.Core.Devices.Dumping { cidDump = new DumpType { - Image = outputPath, Size = cid.Length, Checksums = Checksum.GetChecksums(cid).ToArray() + Image = outputPath, + Size = (ulong)cid.Length, + Checksums = Checksum.GetChecksums(cid).ToArray() }; ret = @@ -536,7 +538,9 @@ namespace DiscImageChef.Core.Devices.Dumping { csdDump = new DumpType { - Image = outputPath, Size = csd.Length, Checksums = Checksum.GetChecksums(csd).ToArray() + Image = outputPath, + Size = (ulong)csd.Length, + Checksums = Checksum.GetChecksums(csd).ToArray() }; ret = @@ -559,7 +563,9 @@ namespace DiscImageChef.Core.Devices.Dumping { sidecar.BlockMedia[0].MultiMediaCard.ExtendedCSD = new DumpType { - Image = outputPath, Size = ecsd.Length, Checksums = Checksum.GetChecksums(ecsd).ToArray() + Image = outputPath, + Size = (ulong)ecsd.Length, + Checksums = Checksum.GetChecksums(ecsd).ToArray() }; ret = outputPlugin.WriteMediaTag(ecsd, MediaTagType.MMC_ExtendedCSD); @@ -579,7 +585,9 @@ namespace DiscImageChef.Core.Devices.Dumping { ocrDump = new DumpType { - Image = outputPath, Size = ocr.Length, Checksums = Checksum.GetChecksums(ocr).ToArray() + Image = outputPath, + Size = (ulong)ocr.Length, + Checksums = Checksum.GetChecksums(ocr).ToArray() }; ret = @@ -602,7 +610,9 @@ namespace DiscImageChef.Core.Devices.Dumping { sidecar.BlockMedia[0].SecureDigital.SCR = new DumpType { - Image = outputPath, Size = scr.Length, Checksums = Checksum.GetChecksums(scr).ToArray() + Image = outputPath, + Size = (ulong)scr.Length, + Checksums = Checksum.GetChecksums(scr).ToArray() }; ret = outputPlugin.WriteMediaTag(scr, MediaTagType.SD_SCR); @@ -659,13 +669,13 @@ namespace DiscImageChef.Core.Devices.Dumping sidecar.BlockMedia[0].DiskType = xmlDskTyp; sidecar.BlockMedia[0].DiskSubType = xmlDskSubTyp; // TODO: Implement device firmware revision - sidecar.BlockMedia[0].LogicalBlocks = (long)blocks; - sidecar.BlockMedia[0].PhysicalBlockSize = physicalBlockSize > 0 ? physicalBlockSize : (int)blockSize; - sidecar.BlockMedia[0].LogicalBlockSize = (int)blockSize; + sidecar.BlockMedia[0].LogicalBlocks = blocks; + sidecar.BlockMedia[0].PhysicalBlockSize = physicalBlockSize > 0 ? physicalBlockSize : blockSize; + sidecar.BlockMedia[0].LogicalBlockSize = blockSize; sidecar.BlockMedia[0].Manufacturer = dev.Manufacturer; sidecar.BlockMedia[0].Model = dev.Model; sidecar.BlockMedia[0].Serial = dev.Serial; - sidecar.BlockMedia[0].Size = (long)(blocks * blockSize); + sidecar.BlockMedia[0].Size = blocks * blockSize; UpdateStatus?.Invoke("Writing metadata sidecar"); diff --git a/DiscImageChef.Core/Devices/Dumping/XGD.cs b/DiscImageChef.Core/Devices/Dumping/XGD.cs index 26447628e..848e63b56 100644 --- a/DiscImageChef.Core/Devices/Dumping/XGD.cs +++ b/DiscImageChef.Core/Devices/Dumping/XGD.cs @@ -964,7 +964,7 @@ namespace DiscImageChef.Core.Devices.Dumping from partition in xmlTrack.FileSystemInformation where partition.FileSystems != null from fileSystem in partition.FileSystems - select ((ulong)partition.StartSector, fileSystem.Type)); + select (partition.StartSector, fileSystem.Type)); if(filesystems.Count > 0) foreach(var filesystem in filesystems.Select(o => new {o.start, o.type}).Distinct()) @@ -977,7 +977,7 @@ namespace DiscImageChef.Core.Devices.Dumping { type = LayersTypeType.OTP, typeSpecified = true, Sectors = new SectorsType[1] }; - sidecar.OpticalDisc[0].Layers.Sectors[0] = new SectorsType {Value = (long)layerBreak}; + sidecar.OpticalDisc[0].Layers.Sectors[0] = new SectorsType {Value = layerBreak}; sidecar.OpticalDisc[0].Sessions = 1; sidecar.OpticalDisc[0].Dimensions = Dimensions.DimensionsFromMediaType(dskType); CommonTypes.Metadata.MediaType.MediaTypeToString(dskType, out string xmlDskTyp, diff --git a/DiscImageChef.Core/Sidecar/AudioMedia.cs b/DiscImageChef.Core/Sidecar/AudioMedia.cs index 48cf5b72a..bea24937d 100644 --- a/DiscImageChef.Core/Sidecar/AudioMedia.cs +++ b/DiscImageChef.Core/Sidecar/AudioMedia.cs @@ -69,15 +69,15 @@ namespace DiscImageChef.Core offsetSpecified = true, Value = Path.GetFileName(imagePath) }, - Size = fi.Length, + Size = (ulong)fi.Length, Sequence = new SequenceType {MediaTitle = image.Info.MediaTitle} } }; if(image.Info.MediaSequence != 0 && image.Info.LastMediaSequence != 0) { - sidecar.AudioMedia[0].Sequence.MediaSequence = image.Info.MediaSequence; - sidecar.AudioMedia[0].Sequence.TotalMedia = image.Info.LastMediaSequence; + sidecar.AudioMedia[0].Sequence.MediaSequence = (uint)image.Info.MediaSequence; + sidecar.AudioMedia[0].Sequence.TotalMedia = (uint)image.Info.LastMediaSequence; } else { diff --git a/DiscImageChef.Core/Sidecar/BlockMedia.cs b/DiscImageChef.Core/Sidecar/BlockMedia.cs index b01a9ef06..314ad6109 100644 --- a/DiscImageChef.Core/Sidecar/BlockMedia.cs +++ b/DiscImageChef.Core/Sidecar/BlockMedia.cs @@ -80,15 +80,15 @@ namespace DiscImageChef.Core offsetSpecified = true, Value = Path.GetFileName(imagePath) }, - Size = fi.Length, + Size = (ulong)fi.Length, Sequence = new SequenceType {MediaTitle = image.Info.MediaTitle} } }; if(image.Info.MediaSequence != 0 && image.Info.LastMediaSequence != 0) { - sidecar.BlockMedia[0].Sequence.MediaSequence = image.Info.MediaSequence; - sidecar.BlockMedia[0].Sequence.TotalMedia = image.Info.LastMediaSequence; + sidecar.BlockMedia[0].Sequence.MediaSequence = (uint)image.Info.MediaSequence; + sidecar.BlockMedia[0].Sequence.TotalMedia = (uint)image.Info.LastMediaSequence; } else { @@ -111,7 +111,7 @@ namespace DiscImageChef.Core Checksums = Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.ATAPI_IDENTIFY)) .ToArray(), - Size = image.ReadDiskTag(MediaTagType.ATAPI_IDENTIFY).Length + Size = (ulong)image.ReadDiskTag(MediaTagType.ATAPI_IDENTIFY).Length } }; break; @@ -123,7 +123,7 @@ namespace DiscImageChef.Core Checksums = Checksum .GetChecksums(image.ReadDiskTag(MediaTagType.ATA_IDENTIFY)) .ToArray(), - Size = image.ReadDiskTag(MediaTagType.ATA_IDENTIFY).Length + Size = (ulong)image.ReadDiskTag(MediaTagType.ATA_IDENTIFY).Length } }; break; @@ -131,7 +131,10 @@ namespace DiscImageChef.Core byte[] cis = image.ReadDiskTag(MediaTagType.PCMCIA_CIS); sidecar.BlockMedia[0].PCMCIA = new PCMCIAType { - CIS = new DumpType {Checksums = Checksum.GetChecksums(cis).ToArray(), Size = cis.Length} + CIS = new DumpType + { + Checksums = Checksum.GetChecksums(cis).ToArray(), Size = (ulong)cis.Length + } }; Tuple[] tuples = CIS.GetTuples(cis); if(tuples != null) @@ -177,7 +180,7 @@ namespace DiscImageChef.Core Checksums = Checksum .GetChecksums(image.ReadDiskTag(MediaTagType.SCSI_INQUIRY)) .ToArray(), - Size = image.ReadDiskTag(MediaTagType.SCSI_INQUIRY).Length + Size = (ulong)image.ReadDiskTag(MediaTagType.SCSI_INQUIRY).Length } }; break; @@ -187,7 +190,7 @@ namespace DiscImageChef.Core sidecar.BlockMedia[0].SecureDigital.CID = new DumpType { Checksums = Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.SD_CID)).ToArray(), - Size = image.ReadDiskTag(MediaTagType.SD_CID).Length + Size = (ulong)image.ReadDiskTag(MediaTagType.SD_CID).Length }; break; case MediaTagType.SD_CSD: @@ -196,7 +199,7 @@ namespace DiscImageChef.Core sidecar.BlockMedia[0].SecureDigital.CSD = new DumpType { Checksums = Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.SD_CSD)).ToArray(), - Size = image.ReadDiskTag(MediaTagType.SD_CSD).Length + Size = (ulong)image.ReadDiskTag(MediaTagType.SD_CSD).Length }; break; case MediaTagType.SD_SCR: @@ -205,7 +208,7 @@ namespace DiscImageChef.Core sidecar.BlockMedia[0].SecureDigital.SCR = new DumpType { Checksums = Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.SD_SCR)).ToArray(), - Size = image.ReadDiskTag(MediaTagType.SD_SCR).Length + Size = (ulong)image.ReadDiskTag(MediaTagType.SD_SCR).Length }; break; case MediaTagType.SD_OCR: @@ -214,7 +217,7 @@ namespace DiscImageChef.Core sidecar.BlockMedia[0].SecureDigital.OCR = new DumpType { Checksums = Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.SD_OCR)).ToArray(), - Size = image.ReadDiskTag(MediaTagType.SD_OCR).Length + Size = (ulong)image.ReadDiskTag(MediaTagType.SD_OCR).Length }; break; case MediaTagType.MMC_CID: @@ -223,7 +226,7 @@ namespace DiscImageChef.Core sidecar.BlockMedia[0].MultiMediaCard.CID = new DumpType { Checksums = Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.SD_CID)).ToArray(), - Size = image.ReadDiskTag(MediaTagType.SD_CID).Length + Size = (ulong)image.ReadDiskTag(MediaTagType.SD_CID).Length }; break; case MediaTagType.MMC_CSD: @@ -232,7 +235,7 @@ namespace DiscImageChef.Core sidecar.BlockMedia[0].MultiMediaCard.CSD = new DumpType { Checksums = Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.SD_CSD)).ToArray(), - Size = image.ReadDiskTag(MediaTagType.SD_CSD).Length + Size = (ulong)image.ReadDiskTag(MediaTagType.SD_CSD).Length }; break; case MediaTagType.MMC_OCR: @@ -241,7 +244,7 @@ namespace DiscImageChef.Core sidecar.BlockMedia[0].MultiMediaCard.OCR = new DumpType { Checksums = Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.SD_OCR)).ToArray(), - Size = image.ReadDiskTag(MediaTagType.SD_OCR).Length + Size = (ulong)image.ReadDiskTag(MediaTagType.SD_OCR).Length }; break; case MediaTagType.MMC_ExtendedCSD: @@ -251,7 +254,7 @@ namespace DiscImageChef.Core { Checksums = Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.MMC_ExtendedCSD)) .ToArray(), - Size = image.ReadDiskTag(MediaTagType.MMC_ExtendedCSD).Length + Size = (ulong)image.ReadDiskTag(MediaTagType.MMC_ExtendedCSD).Length }; break; case MediaTagType.USB_Descriptors: @@ -260,7 +263,7 @@ namespace DiscImageChef.Core { Checksums = Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.USB_Descriptors)) .ToArray(), - Size = image.ReadDiskTag(MediaTagType.USB_Descriptors).Length + Size = (ulong)image.ReadDiskTag(MediaTagType.USB_Descriptors).Length }; break; case MediaTagType.SCSI_MODESENSE_6: @@ -269,7 +272,7 @@ namespace DiscImageChef.Core { Checksums = Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.SCSI_MODESENSE_6)).ToArray(), - Size = image.ReadDiskTag(MediaTagType.SCSI_MODESENSE_6).Length + Size = (ulong)image.ReadDiskTag(MediaTagType.SCSI_MODESENSE_6).Length }; break; case MediaTagType.SCSI_MODESENSE_10: @@ -278,7 +281,7 @@ namespace DiscImageChef.Core { Checksums = Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.SCSI_MODESENSE_10)).ToArray(), - Size = image.ReadDiskTag(MediaTagType.SCSI_MODESENSE_10).Length + Size = (ulong)image.ReadDiskTag(MediaTagType.SCSI_MODESENSE_10).Length }; break; } @@ -345,10 +348,10 @@ namespace DiscImageChef.Core sidecar.BlockMedia[0].Dimensions = Dimensions.DimensionsFromMediaType(image.Info.MediaType); - sidecar.BlockMedia[0].LogicalBlocks = (long)image.Info.Sectors; - sidecar.BlockMedia[0].LogicalBlockSize = (int)image.Info.SectorSize; + sidecar.BlockMedia[0].LogicalBlocks = image.Info.Sectors; + sidecar.BlockMedia[0].LogicalBlockSize = image.Info.SectorSize; // TODO: Detect it - sidecar.BlockMedia[0].PhysicalBlockSize = (int)image.Info.SectorSize; + sidecar.BlockMedia[0].PhysicalBlockSize = image.Info.SectorSize; UpdateStatus("Checking filesystems..."); @@ -368,10 +371,10 @@ namespace DiscImageChef.Core sidecar.BlockMedia[0].FileSystemInformation[i] = new PartitionType { Description = partitions[i].Description, - EndSector = (int)partitions[i].End, + EndSector = partitions[i].End, Name = partitions[i].Name, - Sequence = (int)partitions[i].Sequence, - StartSector = (int)partitions[i].Start, + Sequence = (uint)partitions[i].Sequence, + StartSector = partitions[i].Start, Type = partitions[i].Type }; List lstFs = new List(); @@ -402,7 +405,7 @@ namespace DiscImageChef.Core if(aborted) return; sidecar.BlockMedia[0].FileSystemInformation[0] = - new PartitionType {StartSector = 0, EndSector = (int)(image.Info.Sectors - 1)}; + new PartitionType {StartSector = 0, EndSector = image.Info.Sectors - 1}; Partition wholePart = new Partition { @@ -442,7 +445,7 @@ namespace DiscImageChef.Core sidecar.BlockMedia[0].HeadsSpecified = true; sidecar.BlockMedia[0].SectorsPerTrackSpecified = true; sidecar.BlockMedia[0].Cylinders = image.Info.Cylinders; - sidecar.BlockMedia[0].Heads = image.Info.Heads; + sidecar.BlockMedia[0].Heads = (ushort)image.Info.Heads; sidecar.BlockMedia[0].SectorsPerTrack = image.Info.SectorsPerTrack; } @@ -611,7 +614,7 @@ namespace DiscImageChef.Core if(scpImage.Header.end + 1 >= image.Info.Cylinders) { List scpBlockTrackTypes = new List(); - long currentSector = 0; + ulong currentSector = 0; Stream scpStream = scpFilter.GetDataForkStream(); for(byte t = scpImage.Header.start; t <= scpImage.Header.end; t++) @@ -621,7 +624,7 @@ namespace DiscImageChef.Core BlockTrackType scpBlockTrackType = new BlockTrackType { Cylinder = t / image.Info.Heads, - Head = t % image.Info.Heads, + Head = (ushort)(t % image.Info.Heads), Image = new ImageType { format = scpImage.Format, @@ -636,7 +639,7 @@ namespace DiscImageChef.Core currentSector += image.Info.SectorsPerTrack; scpBlockTrackType.EndSector = currentSector - 1; scpBlockTrackType.Sectors = image.Info.SectorsPerTrack; - scpBlockTrackType.BytesPerSector = (int)image.Info.SectorSize; + scpBlockTrackType.BytesPerSector = image.Info.SectorSize; scpBlockTrackType.Format = trkFormat; } @@ -647,7 +650,7 @@ namespace DiscImageChef.Core scpTrack.Entries.Last().trackLength - scpImage.Header.offsets[t] + 1]; scpStream.Position = scpImage.Header.offsets[t]; scpStream.Read(trackContents, 0, trackContents.Length); - scpBlockTrackType.Size = trackContents.Length; + scpBlockTrackType.Size = (ulong)trackContents.Length; scpBlockTrackType.Checksums = Checksum.GetChecksums(trackContents).ToArray(); } @@ -705,7 +708,7 @@ namespace DiscImageChef.Core { List kfBlockTrackTypes = new List(); - long currentSector = 0; + ulong currentSector = 0; foreach(KeyValuePair kvp in kfImage.tracks) { @@ -714,7 +717,7 @@ namespace DiscImageChef.Core BlockTrackType kfBlockTrackType = new BlockTrackType { Cylinder = kvp.Key / image.Info.Heads, - Head = kvp.Key % image.Info.Heads, + Head = (ushort)(kvp.Key % image.Info.Heads), Image = new ImageType { format = kfImage.Format, @@ -733,7 +736,7 @@ namespace DiscImageChef.Core currentSector += image.Info.SectorsPerTrack; kfBlockTrackType.EndSector = currentSector - 1; kfBlockTrackType.Sectors = image.Info.SectorsPerTrack; - kfBlockTrackType.BytesPerSector = (int)image.Info.SectorSize; + kfBlockTrackType.BytesPerSector = image.Info.SectorSize; kfBlockTrackType.Format = trkFormat; } @@ -741,7 +744,7 @@ namespace DiscImageChef.Core byte[] trackContents = new byte[kfStream.Length]; kfStream.Position = 0; kfStream.Read(trackContents, 0, trackContents.Length); - kfBlockTrackType.Size = trackContents.Length; + kfBlockTrackType.Size = (ulong)trackContents.Length; kfBlockTrackType.Checksums = Checksum.GetChecksums(trackContents).ToArray(); kfBlockTrackTypes.Add(kfBlockTrackType); @@ -784,7 +787,7 @@ namespace DiscImageChef.Core if(dfiImage.Info.Cylinders >= image.Info.Cylinders) { List dfiBlockTrackTypes = new List(); - long currentSector = 0; + ulong currentSector = 0; Stream dfiStream = dfiFilter.GetDataForkStream(); foreach(int t in dfiImage.TrackOffsets.Keys) @@ -793,8 +796,8 @@ namespace DiscImageChef.Core BlockTrackType dfiBlockTrackType = new BlockTrackType { - Cylinder = t / image.Info.Heads, - Head = t % image.Info.Heads, + Cylinder = (uint)(t / image.Info.Heads), + Head = (ushort)(t % image.Info.Heads), Image = new ImageType {format = dfiImage.Format, Value = Path.GetFileName(dfiFilePath)} }; @@ -804,18 +807,18 @@ namespace DiscImageChef.Core currentSector += image.Info.SectorsPerTrack; dfiBlockTrackType.EndSector = currentSector - 1; dfiBlockTrackType.Sectors = image.Info.SectorsPerTrack; - dfiBlockTrackType.BytesPerSector = (int)image.Info.SectorSize; + dfiBlockTrackType.BytesPerSector = image.Info.SectorSize; dfiBlockTrackType.Format = trkFormat; } if(dfiImage.TrackOffsets.TryGetValue(t, out long offset) && dfiImage.TrackLengths.TryGetValue(t, out long length)) { - dfiBlockTrackType.Image.offset = offset; + dfiBlockTrackType.Image.offset = (ulong)offset; byte[] trackContents = new byte[length]; dfiStream.Position = offset; dfiStream.Read(trackContents, 0, trackContents.Length); - dfiBlockTrackType.Size = trackContents.Length; + dfiBlockTrackType.Size = (ulong)trackContents.Length; dfiBlockTrackType.Checksums = Checksum.GetChecksums(trackContents).ToArray(); } diff --git a/DiscImageChef.Core/Sidecar/BlockTape.cs b/DiscImageChef.Core/Sidecar/BlockTape.cs index 586fea1f6..2f703e04d 100644 --- a/DiscImageChef.Core/Sidecar/BlockTape.cs +++ b/DiscImageChef.Core/Sidecar/BlockTape.cs @@ -44,7 +44,7 @@ namespace DiscImageChef.Core /// List of files /// Dump path /// Expected block size in bytes - public CICMMetadataType BlockTape(string folderName, List files, int blockSize) + public CICMMetadataType BlockTape(string folderName, List files, uint blockSize) { sidecar = new CICMMetadataType { @@ -79,8 +79,8 @@ namespace DiscImageChef.Core if(aborted) return sidecar; - long currentBlock = 0; - long totalSize = 0; + ulong currentBlock = 0; + ulong totalSize = 0; Checksum tapeWorker = new Checksum(); List tapeFiles = new List(); @@ -99,15 +99,15 @@ namespace DiscImageChef.Core offset = 0, Value = Path.GetFileName(files[i]) }, - Size = fs.Length, + Size = (ulong)fs.Length, BlockSize = blockSize, StartBlock = currentBlock, - Sequence = i + Sequence = (ulong)i }; const uint SECTORS_TO_READ = 512; - long sectors = fs.Length / blockSize; - long doneSectors = 0; + ulong sectors = (ulong)fs.Length / blockSize; + ulong doneSectors = 0; InitProgress2(); while(doneSectors < sectors) @@ -125,7 +125,7 @@ namespace DiscImageChef.Core sector = new byte[SECTORS_TO_READ * blockSize]; fs.Read(sector, 0, sector.Length); UpdateProgress2($"Hashing block {doneSectors} of {sectors} on file {i + 1} of {files.Count}", - doneSectors, sectors); + (long)doneSectors, (long)sectors); doneSectors += SECTORS_TO_READ; } else @@ -133,7 +133,7 @@ namespace DiscImageChef.Core sector = new byte[(uint)(sectors - doneSectors) * blockSize]; fs.Read(sector, 0, sector.Length); UpdateProgress2($"Hashing block {doneSectors} of {sectors} on file {i + 1} of {files.Count}", - doneSectors, sectors); + (long)doneSectors, (long)sectors); doneSectors += sectors - doneSectors; } @@ -143,7 +143,7 @@ namespace DiscImageChef.Core tapeFile.EndBlock = tapeFile.StartBlock + sectors - 1; currentBlock += sectors; - totalSize += fs.Length; + totalSize += (ulong)fs.Length; tapeFile.Checksums = fileWorker.End().ToArray(); tapeFiles.Add(tapeFile); diff --git a/DiscImageChef.Core/Sidecar/LinearMedia.cs b/DiscImageChef.Core/Sidecar/LinearMedia.cs index cf36b8926..aa393bc63 100644 --- a/DiscImageChef.Core/Sidecar/LinearMedia.cs +++ b/DiscImageChef.Core/Sidecar/LinearMedia.cs @@ -69,7 +69,7 @@ namespace DiscImageChef.Core offsetSpecified = true, Value = Path.GetFileName(imagePath) }, - Size = fi.Length + Size = (ulong)fi.Length } }; } diff --git a/DiscImageChef.Core/Sidecar/OpticalDisc.cs b/DiscImageChef.Core/Sidecar/OpticalDisc.cs index 1aa2fecd2..42a0f58a3 100644 --- a/DiscImageChef.Core/Sidecar/OpticalDisc.cs +++ b/DiscImageChef.Core/Sidecar/OpticalDisc.cs @@ -80,15 +80,15 @@ namespace DiscImageChef.Core offsetSpecified = true, Value = Path.GetFileName(imagePath) }, - Size = fi.Length, + Size = (ulong)fi.Length, Sequence = new SequenceType {MediaTitle = image.Info.MediaTitle} } }; if(image.Info.MediaSequence != 0 && image.Info.LastMediaSequence != 0) { - sidecar.OpticalDisc[0].Sequence.MediaSequence = image.Info.MediaSequence; - sidecar.OpticalDisc[0].Sequence.TotalMedia = image.Info.LastMediaSequence; + sidecar.OpticalDisc[0].Sequence.MediaSequence = (uint)image.Info.MediaSequence; + sidecar.OpticalDisc[0].Sequence.TotalMedia = (uint)image.Info.LastMediaSequence; } else { @@ -110,7 +110,7 @@ namespace DiscImageChef.Core { Image = Path.GetFileName(imagePath), Checksums = Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.CD_ATIP)).ToArray(), - Size = image.ReadDiskTag(MediaTagType.CD_ATIP).Length + Size = (ulong)image.ReadDiskTag(MediaTagType.CD_ATIP).Length }; ATIP.CDATIP? atip = ATIP.Decode(image.ReadDiskTag(MediaTagType.CD_ATIP)); if(atip.HasValue) @@ -122,7 +122,7 @@ namespace DiscImageChef.Core { Image = Path.GetFileName(imagePath), Checksums = Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.DVD_BCA)).ToArray(), - Size = image.ReadDiskTag(MediaTagType.DVD_BCA).Length + Size = (ulong)image.ReadDiskTag(MediaTagType.DVD_BCA).Length }; break; case MediaTagType.BD_BCA: @@ -130,7 +130,7 @@ namespace DiscImageChef.Core { Image = Path.GetFileName(imagePath), Checksums = Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.BD_BCA)).ToArray(), - Size = image.ReadDiskTag(MediaTagType.BD_BCA).Length + Size = (ulong)image.ReadDiskTag(MediaTagType.BD_BCA).Length }; break; case MediaTagType.DVD_CMI: @@ -138,7 +138,7 @@ namespace DiscImageChef.Core { Image = Path.GetFileName(imagePath), Checksums = Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.DVD_CMI)).ToArray(), - Size = image.ReadDiskTag(MediaTagType.DVD_CMI).Length + Size = (ulong)image.ReadDiskTag(MediaTagType.DVD_CMI).Length }; CSS_CPRM.LeadInCopyright? cmi = CSS_CPRM.DecodeLeadInCopyright(image.ReadDiskTag(MediaTagType.DVD_CMI)); @@ -162,7 +162,7 @@ namespace DiscImageChef.Core { Image = Path.GetFileName(imagePath), Checksums = Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.DVD_DMI)).ToArray(), - Size = image.ReadDiskTag(MediaTagType.DVD_DMI).Length + Size = (ulong)image.ReadDiskTag(MediaTagType.DVD_DMI).Length }; if(DMI.IsXbox(image.ReadDiskTag(MediaTagType.DVD_DMI))) { @@ -181,7 +181,7 @@ namespace DiscImageChef.Core { Image = Path.GetFileName(imagePath), Checksums = Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.DVD_PFI)).ToArray(), - Size = image.ReadDiskTag(MediaTagType.DVD_PFI).Length + Size = (ulong)image.ReadDiskTag(MediaTagType.DVD_PFI).Length }; PFI.PhysicalFormatInformation? pfi = PFI.Decode(image.ReadDiskTag(MediaTagType.DVD_PFI)); if(pfi.HasValue) @@ -270,7 +270,7 @@ namespace DiscImageChef.Core { Image = Path.GetFileName(imagePath), Checksums = Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.CD_PMA)).ToArray(), - Size = image.ReadDiskTag(MediaTagType.CD_PMA).Length + Size = (ulong)image.ReadDiskTag(MediaTagType.CD_PMA).Length }; break; case MediaTagType.CD_FullTOC: @@ -278,11 +278,11 @@ namespace DiscImageChef.Core { Image = Path.GetFileName(imagePath), Checksums = Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.CD_FullTOC)).ToArray(), - Size = image.ReadDiskTag(MediaTagType.CD_FullTOC).Length + Size = (ulong)image.ReadDiskTag(MediaTagType.CD_FullTOC).Length }; break; case MediaTagType.CD_FirstTrackPregap: - sidecar.OpticalDisc[0].LeadIn = new[] + sidecar.OpticalDisc[0].FirstTrackPregrap = new[] { new BorderType { @@ -290,7 +290,19 @@ namespace DiscImageChef.Core Checksums = Checksum .GetChecksums(image.ReadDiskTag(MediaTagType.CD_FirstTrackPregap)) .ToArray(), - Size = image.ReadDiskTag(MediaTagType.CD_FirstTrackPregap).Length + Size = (ulong)image.ReadDiskTag(MediaTagType.CD_FirstTrackPregap).Length + } + }; + break; + case MediaTagType.CD_LeadIn: + sidecar.OpticalDisc[0].LeadIn = new[] + { + new BorderType + { + Image = Path.GetFileName(imagePath), + Checksums = Checksum + .GetChecksums(image.ReadDiskTag(MediaTagType.CD_LeadIn)).ToArray(), + Size = (ulong)image.ReadDiskTag(MediaTagType.CD_LeadIn).Length } }; break; @@ -311,7 +323,7 @@ namespace DiscImageChef.Core .GetChecksums(image.ReadDiskTag(MediaTagType .Xbox_SecuritySector)) .ToArray(), - Size = image.ReadDiskTag(MediaTagType.Xbox_SecuritySector).Length + Size = (ulong)image.ReadDiskTag(MediaTagType.Xbox_SecuritySector).Length } } }; @@ -324,7 +336,7 @@ namespace DiscImageChef.Core { Image = Path.GetFileName(imagePath), Checksums = Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.Xbox_PFI)).ToArray(), - Size = image.ReadDiskTag(MediaTagType.Xbox_PFI).Length + Size = (ulong)image.ReadDiskTag(MediaTagType.Xbox_PFI).Length }; break; case MediaTagType.Xbox_DMI: @@ -334,7 +346,7 @@ namespace DiscImageChef.Core { Image = Path.GetFileName(imagePath), Checksums = Checksum.GetChecksums(image.ReadDiskTag(MediaTagType.Xbox_DMI)).ToArray(), - Size = image.ReadDiskTag(MediaTagType.Xbox_DMI).Length + Size = (ulong)image.ReadDiskTag(MediaTagType.Xbox_DMI).Length }; break; } @@ -343,7 +355,7 @@ namespace DiscImageChef.Core try { List sessions = image.Sessions; - sidecar.OpticalDisc[0].Sessions = sessions?.Count ?? 1; + sidecar.OpticalDisc[0].Sessions = (uint)(sessions?.Count ?? 1); } catch { sidecar.OpticalDisc[0].Sessions = 1; } @@ -351,8 +363,8 @@ namespace DiscImageChef.Core List trksLst = null; if(tracks != null) { - sidecar.OpticalDisc[0].Tracks = new int[1]; - sidecar.OpticalDisc[0].Tracks[0] = tracks.Count; + sidecar.OpticalDisc[0].Tracks = new uint[1]; + sidecar.OpticalDisc[0].Tracks[0] = (uint)tracks.Count; trksLst = new List(); } @@ -418,24 +430,24 @@ namespace DiscImageChef.Core } xmlTrk.Sequence = - new TrackSequenceType {Session = trk.TrackSession, TrackNumber = (int)trk.TrackSequence}; - xmlTrk.StartSector = (long)trk.TrackStartSector; - xmlTrk.EndSector = (long)trk.TrackEndSector; + new TrackSequenceType {Session = trk.TrackSession, TrackNumber = trk.TrackSequence}; + xmlTrk.StartSector = trk.TrackStartSector; + xmlTrk.EndSector = trk.TrackEndSector; if(trk.Indexes != null && trk.Indexes.ContainsKey(0)) if(trk.Indexes.TryGetValue(0, out ulong idx0)) - xmlTrk.StartSector = (long)idx0; + xmlTrk.StartSector = idx0; switch(sidecar.OpticalDisc[0].DiscType) { case "CD": case "GD": - xmlTrk.StartMSF = LbaToMsf(xmlTrk.StartSector); - xmlTrk.EndMSF = LbaToMsf(xmlTrk.EndSector); + xmlTrk.StartMSF = LbaToMsf((long)xmlTrk.StartSector); + xmlTrk.EndMSF = LbaToMsf((long)xmlTrk.EndSector); break; case "DDCD": - xmlTrk.StartMSF = DdcdLbaToMsf(xmlTrk.StartSector); - xmlTrk.EndMSF = DdcdLbaToMsf(xmlTrk.EndSector); + xmlTrk.StartMSF = DdcdLbaToMsf((long)xmlTrk.StartSector); + xmlTrk.EndMSF = DdcdLbaToMsf((long)xmlTrk.EndSector); break; } @@ -443,15 +455,15 @@ namespace DiscImageChef.Core if(trk.TrackFileOffset > 0) { - xmlTrk.Image.offset = (long)trk.TrackFileOffset; + xmlTrk.Image.offset = trk.TrackFileOffset; xmlTrk.Image.offsetSpecified = true; } - xmlTrk.Size = (xmlTrk.EndSector - xmlTrk.StartSector + 1) * trk.TrackRawBytesPerSector; - xmlTrk.BytesPerSector = trk.TrackBytesPerSector; + xmlTrk.Size = (xmlTrk.EndSector - xmlTrk.StartSector + 1) * (ulong)trk.TrackRawBytesPerSector; + xmlTrk.BytesPerSector = (uint)trk.TrackBytesPerSector; uint sectorsToRead = 512; - ulong sectors = (ulong)(xmlTrk.EndSector - xmlTrk.StartSector + 1); + ulong sectors = xmlTrk.EndSector - xmlTrk.StartSector + 1; ulong doneSectors = 0; // If there is only one track, and it's the same as the image file (e.g. ".iso" files), don't re-checksum. @@ -484,8 +496,7 @@ namespace DiscImageChef.Core if(sectors - doneSectors >= sectorsToRead) { - sector = image.ReadSectorsLong(doneSectors, sectorsToRead, - (uint)xmlTrk.Sequence.TrackNumber); + sector = image.ReadSectorsLong(doneSectors, sectorsToRead, xmlTrk.Sequence.TrackNumber); UpdateProgress2("Hashings sector {0} of {1}", (long)doneSectors, (long)(trk.TrackEndSector - trk.TrackStartSector + 1)); doneSectors += sectorsToRead; @@ -493,7 +504,7 @@ namespace DiscImageChef.Core else { sector = image.ReadSectorsLong(doneSectors, (uint)(sectors - doneSectors), - (uint)xmlTrk.Sequence.TrackNumber); + xmlTrk.Sequence.TrackNumber); UpdateProgress2("Hashings sector {0} of {1}", (long)doneSectors, (long)(trk.TrackEndSector - trk.TrackStartSector + 1)); doneSectors += sectors - doneSectors; @@ -536,13 +547,13 @@ namespace DiscImageChef.Core if(trk.TrackFileOffset > 0) { - xmlTrk.SubChannel.Image.offset = (long)trk.TrackSubchannelOffset; + xmlTrk.SubChannel.Image.offset = trk.TrackSubchannelOffset; xmlTrk.SubChannel.Image.offsetSpecified = true; } Checksum subChkWorker = new Checksum(); - sectors = (ulong)(xmlTrk.EndSector - xmlTrk.StartSector + 1); + sectors = xmlTrk.EndSector - xmlTrk.StartSector + 1; doneSectors = 0; InitProgress2(); @@ -559,7 +570,7 @@ namespace DiscImageChef.Core if(sectors - doneSectors >= sectorsToRead) { - sector = image.ReadSectorsTag(doneSectors, sectorsToRead, (uint)xmlTrk.Sequence.TrackNumber, + sector = image.ReadSectorsTag(doneSectors, sectorsToRead, xmlTrk.Sequence.TrackNumber, SectorTagType.CdSectorSubchannel); UpdateProgress2("Hashings subchannel sector {0} of {1}", (long)doneSectors, (long)(trk.TrackEndSector - trk.TrackStartSector + 1)); @@ -568,7 +579,7 @@ namespace DiscImageChef.Core else { sector = image.ReadSectorsTag(doneSectors, (uint)(sectors - doneSectors), - (uint)xmlTrk.Sequence.TrackNumber, + xmlTrk.Sequence.TrackNumber, SectorTagType.CdSectorSubchannel); UpdateProgress2("Hashings subchannel sector {0} of {1}", (long)doneSectors, (long)(trk.TrackEndSector - trk.TrackStartSector + 1)); @@ -601,10 +612,10 @@ namespace DiscImageChef.Core xmlTrk.FileSystemInformation[i] = new PartitionType { Description = trkPartitions[i].Description, - EndSector = (int)trkPartitions[i].End, + EndSector = trkPartitions[i].End, Name = trkPartitions[i].Name, - Sequence = (int)trkPartitions[i].Sequence, - StartSector = (int)trkPartitions[i].Start, + Sequence = (uint)trkPartitions[i].Sequence, + StartSector = trkPartitions[i].Start, Type = trkPartitions[i].Type }; List lstFs = new List(); @@ -654,17 +665,17 @@ namespace DiscImageChef.Core { xmlTrk.FileSystemInformation[0] = new PartitionType { - EndSector = (int)xmlTrk.EndSector, StartSector = (int)xmlTrk.StartSector + EndSector = xmlTrk.EndSector, StartSector = xmlTrk.StartSector }; List lstFs = new List(); Partition xmlPart = new Partition { - Start = (ulong)xmlTrk.StartSector, - Length = (ulong)(xmlTrk.EndSector - xmlTrk.StartSector + 1), + Start = xmlTrk.StartSector, + Length = xmlTrk.EndSector - xmlTrk.StartSector + 1, Type = xmlTrk.TrackType1.ToString(), - Size = (ulong)xmlTrk.Size, - Sequence = (ulong)xmlTrk.Sequence.TrackNumber + Size = xmlTrk.Size, + Sequence = xmlTrk.Sequence.TrackNumber }; foreach(IFilesystem plugin in plugins.PluginsList.Values) try @@ -717,8 +728,8 @@ namespace DiscImageChef.Core // All XGD3 all have the same number of blocks if(dskType == MediaType.XGD2 && sidecar.OpticalDisc[0].Track.Length == 1) { - ulong blocks = (ulong)(sidecar.OpticalDisc[0].Track[0].EndSector - - sidecar.OpticalDisc[0].Track[0].StartSector + 1); + ulong blocks = sidecar.OpticalDisc[0].Track[0].EndSector - sidecar.OpticalDisc[0].Track[0].StartSector + + 1; if(blocks == 25063 || // Locked (or non compatible drive) blocks == 4229664 || // Xtreme unlock blocks == 4246304) // Wxripper unlock diff --git a/DiscImageChef.Filesystems/AODOS.cs b/DiscImageChef.Filesystems/AODOS.cs index b7b6e53a3..4de807435 100644 --- a/DiscImageChef.Filesystems/AODOS.cs +++ b/DiscImageChef.Filesystems/AODOS.cs @@ -83,11 +83,11 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { Type = "Alexander Osipov DOS file system", - Clusters = (long)imagePlugin.Info.Sectors, - ClusterSize = (int)imagePlugin.Info.SectorSize, + Clusters = imagePlugin.Info.Sectors, + ClusterSize = imagePlugin.Info.SectorSize, Files = bb.files, FilesSpecified = true, - FreeClusters = (long)(imagePlugin.Info.Sectors - bb.usedSectors), + FreeClusters = imagePlugin.Info.Sectors - bb.usedSectors, FreeClustersSpecified = true, VolumeName = StringHandlers.SpacePaddedToString(bb.volumeLabel, Encoding), Bootable = true @@ -107,33 +107,33 @@ namespace DiscImageChef.Filesystems /// /// A NOP opcode /// - public byte nop; + public readonly byte nop; /// /// A branch to real bootloader /// - public ushort branch; + public readonly ushort branch; /// /// Unused /// - public byte unused; + public readonly byte unused; /// /// " AO-DOS " /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] identifier; + public readonly byte[] identifier; /// /// Volume label /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] volumeLabel; + public readonly byte[] volumeLabel; /// /// How many files are present in disk /// - public ushort files; + public readonly ushort files; /// /// How many sectors are used /// - public ushort usedSectors; + public readonly ushort usedSectors; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/APFS.cs b/DiscImageChef.Filesystems/APFS.cs index 23351bee7..21f593bb9 100644 --- a/DiscImageChef.Filesystems/APFS.cs +++ b/DiscImageChef.Filesystems/APFS.cs @@ -93,8 +93,8 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { Bootable = false, - Clusters = (long)nxSb.containerBlocks, - ClusterSize = (int)nxSb.blockSize, + Clusters = nxSb.containerBlocks, + ClusterSize = nxSb.blockSize, Type = "Apple File System" }; } @@ -102,13 +102,13 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ApfsContainerSuperBlock { - public ulong unknown1; // Varies between copies of the superblock - public ulong unknown2; - public ulong unknown3; // Varies by 1 between copies of the superblock - public ulong unknown4; - public uint magic; - public uint blockSize; - public ulong containerBlocks; + public readonly ulong unknown1; // Varies between copies of the superblock + public readonly ulong unknown2; + public readonly ulong unknown3; // Varies by 1 between copies of the superblock + public readonly ulong unknown4; + public readonly uint magic; + public readonly uint blockSize; + public readonly ulong containerBlocks; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/Acorn.cs b/DiscImageChef.Filesystems/Acorn.cs index 28ed885b6..78c183a03 100644 --- a/DiscImageChef.Filesystems/Acorn.cs +++ b/DiscImageChef.Filesystems/Acorn.cs @@ -287,8 +287,8 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { Bootable = oldMap1.boot != 0, // Or not? - Clusters = (long)(bytes / imagePlugin.Info.SectorSize), - ClusterSize = (int)imagePlugin.Info.SectorSize, + Clusters = bytes / imagePlugin.Info.SectorSize, + ClusterSize = imagePlugin.Info.SectorSize, Type = "Acorn Advanced Disc Filing System" }; @@ -476,8 +476,8 @@ namespace DiscImageChef.Filesystems information = sbInformation.ToString(); XmlFsType.Bootable |= drSb.bootoption != 0; // Or not? - XmlFsType.Clusters = (long)(bytes / (ulong)(1 << drSb.log2secsize)); - XmlFsType.ClusterSize = 1 << drSb.log2secsize; + XmlFsType.Clusters = bytes / (ulong)(1 << drSb.log2secsize); + XmlFsType.ClusterSize = (uint)(1 << drSb.log2secsize); XmlFsType.Type = "Acorn Advanced Disc Filing System"; } @@ -562,11 +562,11 @@ namespace DiscImageChef.Filesystems struct BootBlock { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x1C0)] - public byte[] spare; - public DiscRecord discRecord; - public byte flags; - public ushort startCylinder; - public byte checksum; + public readonly byte[] spare; + public readonly DiscRecord discRecord; + public readonly byte flags; + public readonly ushort startCylinder; + public readonly byte checksum; } /// @@ -575,30 +575,30 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct DiscRecord { - public byte log2secsize; - public byte spt; - public byte heads; - public byte density; - public byte idlen; - public byte log2bpmb; - public byte skew; - public byte bootoption; - public byte lowsector; - public byte nzones; - public ushort zone_spare; - public uint root; - public uint disc_size; - public ushort disc_id; + public readonly byte log2secsize; + public readonly byte spt; + public readonly byte heads; + public readonly byte density; + public readonly byte idlen; + public readonly byte log2bpmb; + public readonly byte skew; + public readonly byte bootoption; + public readonly byte lowsector; + public readonly byte nzones; + public readonly ushort zone_spare; + public readonly uint root; + public readonly uint disc_size; + public readonly ushort disc_id; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] - public byte[] disc_name; - public uint disc_type; - public uint disc_size_high; - public byte flags; - public byte nzones_high; - public uint format_version; - public uint root_size; + public readonly byte[] disc_name; + public readonly uint disc_type; + public readonly uint disc_size_high; + public readonly byte flags; + public readonly byte nzones_high; + public readonly uint format_version; + public readonly uint root_size; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] reserved; + public readonly byte[] reserved; } /// @@ -608,13 +608,13 @@ namespace DiscImageChef.Filesystems struct OldMapSector0 { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 82 * 3)] - public byte[] freeStart; - public byte reserved; + public readonly byte[] freeStart; + public readonly byte reserved; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public byte[] name; + public readonly byte[] name; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] size; - public byte checksum; + public readonly byte[] size; + public readonly byte checksum; } /// @@ -624,13 +624,13 @@ namespace DiscImageChef.Filesystems struct OldMapSector1 { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 82 * 3)] - public byte[] freeStart; + public readonly byte[] freeStart; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public byte[] name; - public ushort discId; - public byte boot; - public byte freeEnd; - public byte checksum; + public readonly byte[] name; + public readonly ushort discId; + public readonly byte boot; + public readonly byte freeEnd; + public readonly byte checksum; } /// @@ -639,10 +639,10 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct NewMap { - public byte zoneChecksum; - public ushort freeLink; - public byte crossChecksum; - public DiscRecord discRecord; + public readonly byte zoneChecksum; + public readonly ushort freeLink; + public readonly byte crossChecksum; + public readonly DiscRecord discRecord; } /// @@ -651,8 +651,8 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct DirectoryHeader { - public byte masterSequence; - public uint magic; + public readonly byte masterSequence; + public readonly uint magic; } /// @@ -662,13 +662,13 @@ namespace DiscImageChef.Filesystems struct DirectoryEntry { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] - public byte[] name; - public uint load; - public uint exec; - public uint length; + public readonly byte[] name; + public readonly uint load; + public readonly uint exec; + public readonly uint length; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] address; - public byte atts; + public readonly byte[] address; + public readonly byte atts; } /// @@ -677,17 +677,17 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct NewDirectoryTail { - public byte lastMark; - public ushort reserved; + public readonly byte lastMark; + public readonly ushort reserved; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] parent; + public readonly byte[] parent; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 19)] - public byte[] title; + public readonly byte[] title; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] - public byte[] name; - public byte endMasSeq; - public uint magic; - public byte checkByte; + public readonly byte[] name; + public readonly byte endMasSeq; + public readonly uint magic; + public readonly byte checkByte; } /// @@ -696,18 +696,18 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct OldDirectoryTail { - public byte lastMark; + public readonly byte lastMark; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] - public byte[] name; + public readonly byte[] name; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] parent; + public readonly byte[] parent; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 19)] - public byte[] title; + public readonly byte[] title; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] - public byte[] reserved; - public byte endMasSeq; - public uint magic; - public byte checkByte; + public readonly byte[] reserved; + public readonly byte endMasSeq; + public readonly uint magic; + public readonly byte checkByte; } /// @@ -716,10 +716,10 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct OldDirectory { - public DirectoryHeader header; + public readonly DirectoryHeader header; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 47)] - public DirectoryEntry[] entries; - public OldDirectoryTail tail; + public readonly DirectoryEntry[] entries; + public readonly OldDirectoryTail tail; } /// @@ -728,10 +728,10 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct NewDirectory { - public DirectoryHeader header; + public readonly DirectoryHeader header; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 77)] - public DirectoryEntry[] entries; - public NewDirectoryTail tail; + public readonly DirectoryEntry[] entries; + public readonly NewDirectoryTail tail; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/AmigaDOS.cs b/DiscImageChef.Filesystems/AmigaDOS.cs index f9e4dee30..0d11cdea9 100644 --- a/DiscImageChef.Filesystems/AmigaDOS.cs +++ b/DiscImageChef.Filesystems/AmigaDOS.cs @@ -304,7 +304,7 @@ namespace DiscImageChef.Filesystems if((bootBlk.diskType & 0xFF) == 4 || (bootBlk.diskType & 0xFF) == 5) sbInformation.AppendFormat("Directory cache starts at block {0}", rootBlk.extension).AppendLine(); - long blocks = (long)((partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / blockSize); + ulong blocks = (partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / blockSize; sbInformation.AppendFormat("Volume block size is {0} bytes", blockSize).AppendLine(); sbInformation.AppendFormat("Volume has {0} blocks", blocks).AppendLine(); @@ -328,7 +328,7 @@ namespace DiscImageChef.Filesystems XmlFsType.ModificationDateSpecified = true; XmlFsType.Dirty = rootBlk.bitmapFlag != 0xFFFFFFFF; XmlFsType.Clusters = blocks; - XmlFsType.ClusterSize = (int)blockSize; + XmlFsType.ClusterSize = blockSize; XmlFsType.VolumeName = diskName; XmlFsType.Bootable = bsum == bootBlk.checksum; // Useful as a serial @@ -381,15 +381,15 @@ namespace DiscImageChef.Filesystems /// /// Offset 0x00, "DOSx" disk type /// - public uint diskType; + public readonly uint diskType; /// /// Offset 0x04, Checksum /// - public uint checksum; + public readonly uint checksum; /// /// Offset 0x08, Pointer to root block, mostly invalid /// - public uint root_ptr; + public readonly uint root_ptr; /// /// Offset 0x0C, Boot code, til completion. Size is intentionally incorrect to allow marshaling to work. /// @@ -407,11 +407,11 @@ namespace DiscImageChef.Filesystems /// /// Offset 0x04, unused /// - public uint headerKey; + public readonly uint headerKey; /// /// Offset 0x08, unused /// - public uint highSeq; + public readonly uint highSeq; /// /// Offset 0x0C, longs used by hash table /// @@ -419,7 +419,7 @@ namespace DiscImageChef.Filesystems /// /// Offset 0x10, unused /// - public uint firstData; + public readonly uint firstData; /// /// Offset 0x14, Rootblock checksum /// @@ -433,81 +433,81 @@ namespace DiscImageChef.Filesystems /// /// Offset 0x18+hashTableSize*4+0, bitmap flag, 0xFFFFFFFF if valid /// - public uint bitmapFlag; + public readonly uint bitmapFlag; /// /// Offset 0x18+hashTableSize*4+4, bitmap pages, 25 entries /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 25)] - public uint[] bitmapPages; + public readonly uint[] bitmapPages; /// /// Offset 0x18+hashTableSize*4+104, pointer to bitmap extension block /// - public uint bitmapExtensionBlock; + public readonly uint bitmapExtensionBlock; /// /// Offset 0x18+hashTableSize*4+108, last root alteration days since 1978/01/01 /// - public uint rDays; + public readonly uint rDays; /// /// Offset 0x18+hashTableSize*4+112, last root alteration minutes past midnight /// - public uint rMins; + public readonly uint rMins; /// /// Offset 0x18+hashTableSize*4+116, last root alteration ticks (1/50 secs) /// - public uint rTicks; + public readonly uint rTicks; /// /// Offset 0x18+hashTableSize*4+120, disk name, pascal string, 31 bytes /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 31)] - public byte[] diskName; + public readonly byte[] diskName; /// /// Offset 0x18+hashTableSize*4+151, unused /// - public byte padding; + public readonly byte padding; /// /// Offset 0x18+hashTableSize*4+152, unused /// - public uint reserved1; + public readonly uint reserved1; /// /// Offset 0x18+hashTableSize*4+156, unused /// - public uint reserved2; + public readonly uint reserved2; /// /// Offset 0x18+hashTableSize*4+160, last disk alteration days since 1978/01/01 /// - public uint vDays; + public readonly uint vDays; /// /// Offset 0x18+hashTableSize*4+164, last disk alteration minutes past midnight /// - public uint vMins; + public readonly uint vMins; /// /// Offset 0x18+hashTableSize*4+168, last disk alteration ticks (1/50 secs) /// - public uint vTicks; + public readonly uint vTicks; /// /// Offset 0x18+hashTableSize*4+172, filesystem creation days since 1978/01/01 /// - public uint cDays; + public readonly uint cDays; /// /// Offset 0x18+hashTableSize*4+176, filesystem creation minutes since 1978/01/01 /// - public uint cMins; + public readonly uint cMins; /// /// Offset 0x18+hashTableSize*4+180, filesystem creation ticks since 1978/01/01 /// - public uint cTicks; + public readonly uint cTicks; /// /// Offset 0x18+hashTableSize*4+184, unused /// - public uint nextHash; + public readonly uint nextHash; /// /// Offset 0x18+hashTableSize*4+188, unused /// - public uint parentDir; + public readonly uint parentDir; /// /// Offset 0x18+hashTableSize*4+192, first directory cache block /// - public uint extension; + public readonly uint extension; /// /// Offset 0x18+hashTableSize*4+196, block secondary type = ST_ROOT (1) /// diff --git a/DiscImageChef.Filesystems/AppleDOS/AppleDOS.cs b/DiscImageChef.Filesystems/AppleDOS/AppleDOS.cs index e47f8a2d2..aff6ae91d 100644 --- a/DiscImageChef.Filesystems/AppleDOS/AppleDOS.cs +++ b/DiscImageChef.Filesystems/AppleDOS/AppleDOS.cs @@ -48,7 +48,7 @@ namespace DiscImageChef.Filesystems.AppleDOS ulong totalFileEntries; bool track1UsedByFiles; bool track2UsedByFiles; - int usedSectors; + uint usedSectors; Vtoc vtoc; diff --git a/DiscImageChef.Filesystems/AppleDOS/File.cs b/DiscImageChef.Filesystems/AppleDOS/File.cs index 78a020782..e58cf292c 100644 --- a/DiscImageChef.Filesystems/AppleDOS/File.cs +++ b/DiscImageChef.Filesystems/AppleDOS/File.cs @@ -80,8 +80,7 @@ namespace DiscImageChef.Filesystems.AppleDOS if(debug && (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 || string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 || string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0)) - if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0) - file = catalogBlocks; + if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0) file = catalogBlocks; else if(string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0) file = vtocBlocks; else file = bootBlocks; else @@ -227,7 +226,7 @@ namespace DiscImageChef.Filesystems.AppleDOS if(!track2UsedByFiles) tracksOnBoot++; bootBlocks = device.ReadSectors(0, (uint)(tracksOnBoot * sectorsPerTrack)); - usedSectors += bootBlocks.Length / vtoc.bytesPerSector; + usedSectors += (uint)(bootBlocks.Length / vtoc.bytesPerSector); return Errno.NoError; } diff --git a/DiscImageChef.Filesystems/AppleDOS/Info.cs b/DiscImageChef.Filesystems/AppleDOS/Info.cs index 399545be9..59ee281fe 100644 --- a/DiscImageChef.Filesystems/AppleDOS/Info.cs +++ b/DiscImageChef.Filesystems/AppleDOS/Info.cs @@ -88,8 +88,8 @@ namespace DiscImageChef.Filesystems.AppleDOS XmlFsType = new FileSystemType { Bootable = true, - Clusters = (long)imagePlugin.Info.Sectors, - ClusterSize = (int)imagePlugin.Info.SectorSize, + Clusters = imagePlugin.Info.Sectors, + ClusterSize = imagePlugin.Info.SectorSize, Type = "Apple DOS" }; } diff --git a/DiscImageChef.Filesystems/AppleDOS/Super.cs b/DiscImageChef.Filesystems/AppleDOS/Super.cs index 9f5d1b4fb..4a9b7eced 100644 --- a/DiscImageChef.Filesystems/AppleDOS/Super.cs +++ b/DiscImageChef.Filesystems/AppleDOS/Super.cs @@ -100,9 +100,9 @@ namespace DiscImageChef.Filesystems.AppleDOS XmlFsType = new FileSystemType { Bootable = true, - Clusters = (long)device.Info.Sectors, + Clusters = device.Info.Sectors, ClusterSize = vtoc.bytesPerSector, - Files = catalogCache.Count, + Files = (ulong)catalogCache.Count, FilesSpecified = true, FreeClustersSpecified = true, Type = "Apple DOS" @@ -137,7 +137,7 @@ namespace DiscImageChef.Filesystems.AppleDOS { stat = new FileSystemInfo { - Blocks = (long)device.Info.Sectors, + Blocks = device.Info.Sectors, FilenameLength = 30, Files = (ulong)catalogCache.Count, PluginId = Id, diff --git a/DiscImageChef.Filesystems/AppleHFS.cs b/DiscImageChef.Filesystems/AppleHFS.cs index bac4c1b59..58718189f 100644 --- a/DiscImageChef.Filesystems/AppleHFS.cs +++ b/DiscImageChef.Filesystems/AppleHFS.cs @@ -264,7 +264,7 @@ namespace DiscImageChef.Filesystems XmlFsType.Bootable = bb.signature == HFSBB_MAGIC || mdb.drFndrInfo0 != 0 || mdb.drFndrInfo3 != 0 || mdb.drFndrInfo5 != 0; XmlFsType.Clusters = mdb.drNmAlBlks; - XmlFsType.ClusterSize = (int)mdb.drAlBlkSiz; + XmlFsType.ClusterSize = mdb.drAlBlkSiz; if(mdb.drCrDate > 0) { XmlFsType.CreationDate = DateHandlers.MacToDateTime(mdb.drCrDate); @@ -308,91 +308,91 @@ namespace DiscImageChef.Filesystems struct HfsMasterDirectoryBlock // Should be sector 2 in volume { /// 0x000, Signature, 0x4244 - public ushort drSigWord; + public readonly ushort drSigWord; /// 0x002, Volume creation date - public uint drCrDate; + public readonly uint drCrDate; /// 0x006, Volume last modification date - public uint drLsMod; + public readonly uint drLsMod; /// 0x00A, Volume attributes - public ushort drAtrb; + public readonly ushort drAtrb; /// 0x00C, Files in root directory - public ushort drNmFls; + public readonly ushort drNmFls; /// 0x00E, Start 512-byte sector of volume bitmap - public ushort drVBMSt; + public readonly ushort drVBMSt; /// 0x010, Allocation block to begin next allocation - public ushort drAllocPtr; + public readonly ushort drAllocPtr; /// 0x012, Allocation blocks - public ushort drNmAlBlks; + public readonly ushort drNmAlBlks; /// 0x014, Bytes per allocation block - public uint drAlBlkSiz; + public readonly uint drAlBlkSiz; /// 0x018, Bytes to allocate when extending a file - public uint drClpSiz; + public readonly uint drClpSiz; /// 0x01C, Start 512-byte sector of first allocation block - public ushort drAlBlSt; + public readonly ushort drAlBlSt; /// 0x01E, CNID for next file - public uint drNxtCNID; + public readonly uint drNxtCNID; /// 0x022, Free allocation blocks - public ushort drFreeBks; + public readonly ushort drFreeBks; /// 0x024, Volume name (28 bytes) [MarshalAs(UnmanagedType.ByValArray, SizeConst = 28)] - public byte[] drVN; + public readonly byte[] drVN; /// 0x040, Volume last backup time - public uint drVolBkUp; + public readonly uint drVolBkUp; /// 0x044, Volume backup sequence number - public ushort drVSeqNum; + public readonly ushort drVSeqNum; /// 0x046, Filesystem write count - public uint drWrCnt; + public readonly uint drWrCnt; /// 0x04A, Bytes to allocate when extending the extents B-Tree - public uint drXTClpSiz; + public readonly uint drXTClpSiz; /// 0x04E, Bytes to allocate when extending the catalog B-Tree - public uint drCTClpSiz; + public readonly uint drCTClpSiz; /// 0x052, Number of directories in root directory - public ushort drNmRtDirs; + public readonly ushort drNmRtDirs; /// 0x054, Number of files in the volume - public uint drFilCnt; + public readonly uint drFilCnt; /// 0x058, Number of directories in the volume - public uint drDirCnt; + public readonly uint drDirCnt; /// 0x05C, finderInfo[0], CNID for bootable system's directory - public uint drFndrInfo0; + public readonly uint drFndrInfo0; /// 0x060, finderInfo[1], CNID of the directory containing the boot application - public uint drFndrInfo1; + public readonly uint drFndrInfo1; /// 0x064, finderInfo[2], CNID of the directory that should be opened on boot - public uint drFndrInfo2; + public readonly uint drFndrInfo2; /// 0x068, finderInfo[3], CNID for Mac OS 8 or 9 directory - public uint drFndrInfo3; + public readonly uint drFndrInfo3; /// 0x06C, finderInfo[4], Reserved - public uint drFndrInfo4; + public readonly uint drFndrInfo4; /// 0x070, finderInfo[5], CNID for Mac OS X directory - public uint drFndrInfo5; + public readonly uint drFndrInfo5; /// 0x074, finderInfo[6], first part of Mac OS X volume ID - public uint drFndrInfo6; + public readonly uint drFndrInfo6; /// 0x078, finderInfo[7], second part of Mac OS X volume ID - public uint drFndrInfo7; + public readonly uint drFndrInfo7; // If wrapping HFS+ /// 0x07C, Embedded volume signature, "H+" if HFS+ is embedded ignore following two fields if not - public ushort drEmbedSigWord; + public readonly ushort drEmbedSigWord; /// 0x07E, Starting block number of embedded HFS+ volume - public ushort xdrStABNt; + public readonly ushort xdrStABNt; /// 0x080, Allocation blocks used by embedded volume - public ushort xdrNumABlks; + public readonly ushort xdrNumABlks; // If not /// 0x07C, Size in blocks of volume cache - public ushort drVCSize; + public readonly ushort drVCSize; /// 0x07E, Size in blocks of volume bitmap cache - public ushort drVBMCSize; + public readonly ushort drVBMCSize; /// 0x080, Size in blocks of volume common cache - public ushort drCtlCSize; + public readonly ushort drCtlCSize; // End of variable variables :D /// /// 0x082, Bytes in the extents B-Tree /// 3 HFS extents following, 32 bits each /// - public uint drXTFlSize; + public readonly uint drXTFlSize; /// /// 0x092, Bytes in the catalog B-Tree /// 3 HFS extents following, 32 bits each /// - public uint drCTFlSize; + public readonly uint drCTFlSize; } /// @@ -402,50 +402,50 @@ namespace DiscImageChef.Filesystems struct HfsBootBlock // Should be sectors 0 and 1 in volume { /// 0x000, Signature, 0x4C4B if bootable - public ushort signature; + public readonly ushort signature; /// 0x002, Branch - public uint branch; + public readonly uint branch; /// 0x007, Boot block version - public ushort boot_version; + public readonly ushort boot_version; /// 0x006, Boot block flags - public short boot_flags; + public readonly short boot_flags; /// 0x00A, System file name (16 bytes) [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] system_name; + public readonly byte[] system_name; /// 0x01A, Finder file name (16 bytes) [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] finder_name; + public readonly byte[] finder_name; /// 0x02A, Debugger file name (16 bytes) [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] debug_name; + public readonly byte[] debug_name; /// 0x03A, Disassembler file name (16 bytes) [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] disasm_name; + public readonly byte[] disasm_name; /// 0x04A, Startup screen file name (16 bytes) [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] stupscr_name; + public readonly byte[] stupscr_name; /// 0x05A, First program to execute on boot (16 bytes) [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] bootup_name; + public readonly byte[] bootup_name; /// 0x06A, Clipboard file name (16 bytes) [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] clipbrd_name; + public readonly byte[] clipbrd_name; /// 0x07A, 1/4 of maximum opened at a time files - public ushort max_files; + public readonly ushort max_files; /// 0x07C, Event queue size - public ushort queue_size; + public readonly ushort queue_size; /// 0x07E, Heap size on a Mac with 128KiB of RAM - public uint heap_128k; + public readonly uint heap_128k; /// 0x082, Heap size on a Mac with 256KiB of RAM - public uint heap_256k; + public readonly uint heap_256k; /// 0x086, Heap size on a Mac with 512KiB of RAM or more - public uint heap_512k; + public readonly uint heap_512k; /// Padding - public ushort padding; + public readonly ushort padding; /// Additional system heap space - public uint heap_extra; + public readonly uint heap_extra; /// Fraction of RAM for system heap - public uint heap_fract; + public readonly uint heap_fract; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/AppleHFSPlus.cs b/DiscImageChef.Filesystems/AppleHFSPlus.cs index f2a89667d..413b2d362 100644 --- a/DiscImageChef.Filesystems/AppleHFSPlus.cs +++ b/DiscImageChef.Filesystems/AppleHFSPlus.cs @@ -220,7 +220,7 @@ namespace DiscImageChef.Filesystems XmlFsType.Bootable |= vh.drFndrInfo0 != 0 || vh.drFndrInfo3 != 0 || vh.drFndrInfo5 != 0; XmlFsType.Clusters = vh.totalBlocks; - XmlFsType.ClusterSize = (int)vh.blockSize; + XmlFsType.ClusterSize = vh.blockSize; if(vh.createDate > 0) { XmlFsType.CreationDate = DateHandlers.MacToDateTime(vh.createDate); @@ -262,9 +262,9 @@ namespace DiscImageChef.Filesystems /// 0x000, "H+" for HFS+, "HX" for HFSX public ushort signature; /// 0x002, 4 for HFS+, 5 for HFSX - public ushort version; + public readonly ushort version; /// 0x004, Volume attributes - public uint attributes; + public readonly uint attributes; /// /// 0x008, Implementation that last mounted the volume. /// Reserved by Apple: @@ -274,250 +274,250 @@ namespace DiscImageChef.Filesystems /// "fsck" /sbin/fsck /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public byte[] lastMountedVersion; + public readonly byte[] lastMountedVersion; /// 0x00C, Allocation block number containing the journal - public uint journalInfoBlock; + public readonly uint journalInfoBlock; /// 0x010, Date of volume creation - public uint createDate; + public readonly uint createDate; /// 0x014, Date of last volume modification - public uint modifyDate; + public readonly uint modifyDate; /// 0x018, Date of last backup - public uint backupDate; + public readonly uint backupDate; /// 0x01C, Date of last consistency check - public uint checkedDate; + public readonly uint checkedDate; /// 0x020, File on the volume - public uint fileCount; + public readonly uint fileCount; /// 0x024, Folders on the volume - public uint folderCount; + public readonly uint folderCount; /// 0x028, Bytes per allocation block - public uint blockSize; + public readonly uint blockSize; /// 0x02C, Allocation blocks on the volume - public uint totalBlocks; + public readonly uint totalBlocks; /// 0x030, Free allocation blocks - public uint freeBlocks; + public readonly uint freeBlocks; /// 0x034, Hint for next allocation block - public uint nextAllocation; + public readonly uint nextAllocation; /// 0x038, Resource fork clump size - public uint rsrcClumpSize; + public readonly uint rsrcClumpSize; /// 0x03C, Data fork clump size - public uint dataClumpSize; + public readonly uint dataClumpSize; /// 0x040, Next unused CNID - public uint nextCatalogID; + public readonly uint nextCatalogID; /// 0x044, Times that the volume has been mounted writable - public uint writeCount; + public readonly uint writeCount; /// 0x048, Used text encoding hints - public ulong encodingsBitmap; + public readonly ulong encodingsBitmap; /// 0x050, finderInfo[0], CNID for bootable system's directory - public uint drFndrInfo0; + public readonly uint drFndrInfo0; /// 0x054, finderInfo[1], CNID of the directory containing the boot application - public uint drFndrInfo1; + public readonly uint drFndrInfo1; /// 0x058, finderInfo[2], CNID of the directory that should be opened on boot - public uint drFndrInfo2; + public readonly uint drFndrInfo2; /// 0x05C, finderInfo[3], CNID for Mac OS 8 or 9 directory - public uint drFndrInfo3; + public readonly uint drFndrInfo3; /// 0x060, finderInfo[4], Reserved - public uint drFndrInfo4; + public readonly uint drFndrInfo4; /// 0x064, finderInfo[5], CNID for Mac OS X directory - public uint drFndrInfo5; + public readonly uint drFndrInfo5; /// 0x068, finderInfo[6], first part of Mac OS X volume ID - public uint drFndrInfo6; + public readonly uint drFndrInfo6; /// 0x06C, finderInfo[7], second part of Mac OS X volume ID - public uint drFndrInfo7; + public readonly uint drFndrInfo7; // HFSPlusForkData allocationFile; /// 0x070 - public ulong allocationFile_logicalSize; + public readonly ulong allocationFile_logicalSize; /// 0x078 - public uint allocationFile_clumpSize; + public readonly uint allocationFile_clumpSize; /// 0x07C - public uint allocationFile_totalBlocks; + public readonly uint allocationFile_totalBlocks; /// 0x080 - public uint allocationFile_extents_startBlock0; + public readonly uint allocationFile_extents_startBlock0; /// 0x084 - public uint allocationFile_extents_blockCount0; + public readonly uint allocationFile_extents_blockCount0; /// 0x088 - public uint allocationFile_extents_startBlock1; + public readonly uint allocationFile_extents_startBlock1; /// 0x08C - public uint allocationFile_extents_blockCount1; + public readonly uint allocationFile_extents_blockCount1; /// 0x090 - public uint allocationFile_extents_startBlock2; + public readonly uint allocationFile_extents_startBlock2; /// 0x094 - public uint allocationFile_extents_blockCount2; + public readonly uint allocationFile_extents_blockCount2; /// 0x098 - public uint allocationFile_extents_startBlock3; + public readonly uint allocationFile_extents_startBlock3; /// 0x09C - public uint allocationFile_extents_blockCount3; + public readonly uint allocationFile_extents_blockCount3; /// 0x0A0 - public uint allocationFile_extents_startBlock4; + public readonly uint allocationFile_extents_startBlock4; /// 0x0A4 - public uint allocationFile_extents_blockCount4; + public readonly uint allocationFile_extents_blockCount4; /// 0x0A8 - public uint allocationFile_extents_startBlock5; + public readonly uint allocationFile_extents_startBlock5; /// 0x0AC - public uint allocationFile_extents_blockCount5; + public readonly uint allocationFile_extents_blockCount5; /// 0x0B0 - public uint allocationFile_extents_startBlock6; + public readonly uint allocationFile_extents_startBlock6; /// 0x0B4 - public uint allocationFile_extents_blockCount6; + public readonly uint allocationFile_extents_blockCount6; /// 0x0B8 - public uint allocationFile_extents_startBlock7; + public readonly uint allocationFile_extents_startBlock7; /// 0x0BC - public uint allocationFile_extents_blockCount7; + public readonly uint allocationFile_extents_blockCount7; // HFSPlusForkData extentsFile; /// 0x0C0 - public ulong extentsFile_logicalSize; + public readonly ulong extentsFile_logicalSize; /// 0x0C8 - public uint extentsFile_clumpSize; + public readonly uint extentsFile_clumpSize; /// 0x0CC - public uint extentsFile_totalBlocks; + public readonly uint extentsFile_totalBlocks; /// 0x0D0 - public uint extentsFile_extents_startBlock0; + public readonly uint extentsFile_extents_startBlock0; /// 0x0D4 - public uint extentsFile_extents_blockCount0; + public readonly uint extentsFile_extents_blockCount0; /// 0x0D8 - public uint extentsFile_extents_startBlock1; + public readonly uint extentsFile_extents_startBlock1; /// 0x0DC - public uint extentsFile_extents_blockCount1; + public readonly uint extentsFile_extents_blockCount1; /// 0x0E0 - public uint extentsFile_extents_startBlock2; + public readonly uint extentsFile_extents_startBlock2; /// 0x0E4 - public uint extentsFile_extents_blockCount2; + public readonly uint extentsFile_extents_blockCount2; /// 0x0E8 - public uint extentsFile_extents_startBlock3; + public readonly uint extentsFile_extents_startBlock3; /// 0x0EC - public uint extentsFile_extents_blockCount3; + public readonly uint extentsFile_extents_blockCount3; /// 0x0F0 - public uint extentsFile_extents_startBlock4; + public readonly uint extentsFile_extents_startBlock4; /// 0x0F4 - public uint extentsFile_extents_blockCount4; + public readonly uint extentsFile_extents_blockCount4; /// 0x0F8 - public uint extentsFile_extents_startBlock5; + public readonly uint extentsFile_extents_startBlock5; /// 0x0FC - public uint extentsFile_extents_blockCount5; + public readonly uint extentsFile_extents_blockCount5; /// 0x100 - public uint extentsFile_extents_startBlock6; + public readonly uint extentsFile_extents_startBlock6; /// 0x104 - public uint extentsFile_extents_blockCount6; + public readonly uint extentsFile_extents_blockCount6; /// 0x108 - public uint extentsFile_extents_startBlock7; + public readonly uint extentsFile_extents_startBlock7; /// 0x10C - public uint extentsFile_extents_blockCount7; + public readonly uint extentsFile_extents_blockCount7; // HFSPlusForkData catalogFile; /// 0x110 - public ulong catalogFile_logicalSize; + public readonly ulong catalogFile_logicalSize; /// 0x118 - public uint catalogFile_clumpSize; + public readonly uint catalogFile_clumpSize; /// 0x11C - public uint catalogFile_totalBlocks; + public readonly uint catalogFile_totalBlocks; /// 0x120 - public uint catalogFile_extents_startBlock0; + public readonly uint catalogFile_extents_startBlock0; /// 0x124 - public uint catalogFile_extents_blockCount0; + public readonly uint catalogFile_extents_blockCount0; /// 0x128 - public uint catalogFile_extents_startBlock1; + public readonly uint catalogFile_extents_startBlock1; /// 0x12C - public uint catalogFile_extents_blockCount1; + public readonly uint catalogFile_extents_blockCount1; /// 0x130 - public uint catalogFile_extents_startBlock2; + public readonly uint catalogFile_extents_startBlock2; /// 0x134 - public uint catalogFile_extents_blockCount2; + public readonly uint catalogFile_extents_blockCount2; /// 0x138 - public uint catalogFile_extents_startBlock3; + public readonly uint catalogFile_extents_startBlock3; /// 0x13C - public uint catalogFile_extents_blockCount3; + public readonly uint catalogFile_extents_blockCount3; /// 0x140 - public uint catalogFile_extents_startBlock4; + public readonly uint catalogFile_extents_startBlock4; /// 0x144 - public uint catalogFile_extents_blockCount4; + public readonly uint catalogFile_extents_blockCount4; /// 0x148 - public uint catalogFile_extents_startBlock5; + public readonly uint catalogFile_extents_startBlock5; /// 0x14C - public uint catalogFile_extents_blockCount5; + public readonly uint catalogFile_extents_blockCount5; /// 0x150 - public uint catalogFile_extents_startBlock6; + public readonly uint catalogFile_extents_startBlock6; /// 0x154 - public uint catalogFile_extents_blockCount6; + public readonly uint catalogFile_extents_blockCount6; /// 0x158 - public uint catalogFile_extents_startBlock7; + public readonly uint catalogFile_extents_startBlock7; /// 0x15C - public uint catalogFile_extents_blockCount7; + public readonly uint catalogFile_extents_blockCount7; // HFSPlusForkData attributesFile; /// 0x160 - public ulong attributesFile_logicalSize; + public readonly ulong attributesFile_logicalSize; /// 0x168 - public uint attributesFile_clumpSize; + public readonly uint attributesFile_clumpSize; /// 0x16C - public uint attributesFile_totalBlocks; + public readonly uint attributesFile_totalBlocks; /// 0x170 - public uint attributesFile_extents_startBlock0; + public readonly uint attributesFile_extents_startBlock0; /// 0x174 - public uint attributesFile_extents_blockCount0; + public readonly uint attributesFile_extents_blockCount0; /// 0x178 - public uint attributesFile_extents_startBlock1; + public readonly uint attributesFile_extents_startBlock1; /// 0x17C - public uint attributesFile_extents_blockCount1; + public readonly uint attributesFile_extents_blockCount1; /// 0x180 - public uint attributesFile_extents_startBlock2; + public readonly uint attributesFile_extents_startBlock2; /// 0x184 - public uint attributesFile_extents_blockCount2; + public readonly uint attributesFile_extents_blockCount2; /// 0x188 - public uint attributesFile_extents_startBlock3; + public readonly uint attributesFile_extents_startBlock3; /// 0x18C - public uint attributesFile_extents_blockCount3; + public readonly uint attributesFile_extents_blockCount3; /// 0x190 - public uint attributesFile_extents_startBlock4; + public readonly uint attributesFile_extents_startBlock4; /// 0x194 - public uint attributesFile_extents_blockCount4; + public readonly uint attributesFile_extents_blockCount4; /// 0x198 - public uint attributesFile_extents_startBlock5; + public readonly uint attributesFile_extents_startBlock5; /// 0x19C - public uint attributesFile_extents_blockCount5; + public readonly uint attributesFile_extents_blockCount5; /// 0x1A0 - public uint attributesFile_extents_startBlock6; + public readonly uint attributesFile_extents_startBlock6; /// 0x1A4 - public uint attributesFile_extents_blockCount6; + public readonly uint attributesFile_extents_blockCount6; /// 0x1A8 - public uint attributesFile_extents_startBlock7; + public readonly uint attributesFile_extents_startBlock7; /// 0x1AC - public uint attributesFile_extents_blockCount7; + public readonly uint attributesFile_extents_blockCount7; // HFSPlusForkData startupFile; /// 0x1B0 - public ulong startupFile_logicalSize; + public readonly ulong startupFile_logicalSize; /// 0x1B8 - public uint startupFile_clumpSize; + public readonly uint startupFile_clumpSize; /// 0x1BC - public uint startupFile_totalBlocks; + public readonly uint startupFile_totalBlocks; /// 0x1C0 - public uint startupFile_extents_startBlock0; + public readonly uint startupFile_extents_startBlock0; /// 0x1C4 - public uint startupFile_extents_blockCount0; + public readonly uint startupFile_extents_blockCount0; /// 0x1C8 - public uint startupFile_extents_startBlock1; + public readonly uint startupFile_extents_startBlock1; /// 0x1D0 - public uint startupFile_extents_blockCount1; + public readonly uint startupFile_extents_blockCount1; /// 0x1D4 - public uint startupFile_extents_startBlock2; + public readonly uint startupFile_extents_startBlock2; /// 0x1D8 - public uint startupFile_extents_blockCount2; + public readonly uint startupFile_extents_blockCount2; /// 0x1DC - public uint startupFile_extents_startBlock3; + public readonly uint startupFile_extents_startBlock3; /// 0x1E0 - public uint startupFile_extents_blockCount3; + public readonly uint startupFile_extents_blockCount3; /// 0x1E4 - public uint startupFile_extents_startBlock4; + public readonly uint startupFile_extents_startBlock4; /// 0x1E8 - public uint startupFile_extents_blockCount4; + public readonly uint startupFile_extents_blockCount4; /// 0x1EC - public uint startupFile_extents_startBlock5; + public readonly uint startupFile_extents_startBlock5; /// 0x1F0 - public uint startupFile_extents_blockCount5; + public readonly uint startupFile_extents_blockCount5; /// 0x1F4 - public uint startupFile_extents_startBlock6; + public readonly uint startupFile_extents_startBlock6; /// 0x1F8 - public uint startupFile_extents_blockCount6; + public readonly uint startupFile_extents_blockCount6; /// 0x1FC - public uint startupFile_extents_startBlock7; + public readonly uint startupFile_extents_startBlock7; /// 0x200 - public uint startupFile_extents_blockCount7; + public readonly uint startupFile_extents_blockCount7; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/AppleMFS/Info.cs b/DiscImageChef.Filesystems/AppleMFS/Info.cs index d8c22dd4a..250b31f1a 100644 --- a/DiscImageChef.Filesystems/AppleMFS/Info.cs +++ b/DiscImageChef.Filesystems/AppleMFS/Info.cs @@ -184,7 +184,7 @@ namespace DiscImageChef.Filesystems.AppleMFS XmlFsType.Bootable = bb.signature == MFSBB_MAGIC; XmlFsType.Clusters = mdb.drNmAlBlks; - XmlFsType.ClusterSize = (int)mdb.drAlBlkSiz; + XmlFsType.ClusterSize = mdb.drAlBlkSiz; if(mdb.drCrDate > 0) { XmlFsType.CreationDate = DateHandlers.MacToDateTime(mdb.drCrDate); diff --git a/DiscImageChef.Filesystems/AppleMFS/Super.cs b/DiscImageChef.Filesystems/AppleMFS/Super.cs index 02bb3e382..9cad7106a 100644 --- a/DiscImageChef.Filesystems/AppleMFS/Super.cs +++ b/DiscImageChef.Filesystems/AppleMFS/Super.cs @@ -144,7 +144,7 @@ namespace DiscImageChef.Filesystems.AppleMFS XmlFsType.Bootable = bbSig == MFSBB_MAGIC; XmlFsType.Clusters = volMDB.drNmAlBlks; - XmlFsType.ClusterSize = (int)volMDB.drAlBlkSiz; + XmlFsType.ClusterSize = volMDB.drAlBlkSiz; if(volMDB.drCrDate > 0) { XmlFsType.CreationDate = DateHandlers.MacToDateTime(volMDB.drCrDate); diff --git a/DiscImageChef.Filesystems/AtheOS.cs b/DiscImageChef.Filesystems/AtheOS.cs index 040a05932..5b622f496 100644 --- a/DiscImageChef.Filesystems/AtheOS.cs +++ b/DiscImageChef.Filesystems/AtheOS.cs @@ -135,10 +135,10 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Clusters = afsSb.num_blocks, - ClusterSize = (int)afsSb.block_size, + Clusters = (ulong)afsSb.num_blocks, + ClusterSize = afsSb.block_size, Dirty = false, - FreeClusters = afsSb.num_blocks - afsSb.used_blocks, + FreeClusters = (ulong)(afsSb.num_blocks - afsSb.used_blocks), FreeClustersSpecified = true, Type = "AtheOS filesystem", VolumeName = StringHandlers.CToString(afsSb.name, Encoding) @@ -153,65 +153,65 @@ namespace DiscImageChef.Filesystems { /// 0x000, Volume name, 32 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] name; + public readonly byte[] name; /// 0x020, "AFS1", 0x41465331 - public uint magic1; + public readonly uint magic1; /// 0x024, "BIGE", 0x42494745 - public uint fs_byte_order; + public readonly uint fs_byte_order; /// 0x028, Bytes per block - public uint block_size; + public readonly uint block_size; /// 0x02C, 1 << block_shift == block_size - public uint block_shift; + public readonly uint block_shift; /// 0x030, Blocks in volume - public long num_blocks; + public readonly long num_blocks; /// 0x038, Used blocks in volume - public long used_blocks; + public readonly long used_blocks; /// 0x040, Bytes per inode - public int inode_size; + public readonly int inode_size; /// 0x044, 0xDD121031 - public uint magic2; + public readonly uint magic2; /// 0x048, Blocks per allocation group - public int blocks_per_ag; + public readonly int blocks_per_ag; /// 0x04C, 1 << ag_shift == blocks_per_ag - public int ag_shift; + public readonly int ag_shift; /// 0x050, Allocation groups in volume - public int num_ags; + public readonly int num_ags; /// 0x054, 0x434c454e if clean, 0x44495254 if dirty - public uint flags; + public readonly uint flags; /// 0x058, Allocation group of journal - public int log_blocks_ag; + public readonly int log_blocks_ag; /// 0x05C, Start block of journal, inside ag - public ushort log_blocks_start; + public readonly ushort log_blocks_start; /// 0x05E, Length in blocks of journal, inside ag - public ushort log_blocks_len; + public readonly ushort log_blocks_len; /// 0x060, Start of journal - public long log_start; + public readonly long log_start; /// 0x068, Valid block logs - public int log_valid_blocks; + public readonly int log_valid_blocks; /// 0x06C, Log size - public int log_size; + public readonly int log_size; /// 0x070, 0x15B6830E - public uint magic3; + public readonly uint magic3; /// 0x074, Allocation group where root folder's i-node resides - public int root_dir_ag; + public readonly int root_dir_ag; /// 0x078, Start in ag of root folder's i-node - public ushort root_dir_start; + public readonly ushort root_dir_start; /// 0x07A, As this is part of inode_addr, this is 1 - public ushort root_dir_len; + public readonly ushort root_dir_len; /// 0x07C, Allocation group where pending-delete-files' i-node resides - public int deleted_ag; + public readonly int deleted_ag; /// 0x080, Start in ag of pending-delete-files' i-node - public ushort deleted_start; + public readonly ushort deleted_start; /// 0x082, As this is part of inode_addr, this is 1 - public ushort deleted_len; + public readonly ushort deleted_len; /// 0x084, Allocation group where indices' i-node resides - public int indices_ag; + public readonly int indices_ag; /// 0x088, Start in ag of indices' i-node - public ushort indices_start; + public readonly ushort indices_start; /// 0x08A, As this is part of inode_addr, this is 1 - public ushort indices_len; + public readonly ushort indices_len; /// 0x08C, Size of bootloader - public int boot_size; + public readonly int boot_size; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/BFS.cs b/DiscImageChef.Filesystems/BFS.cs index 48381a3fc..a6639a1fc 100644 --- a/DiscImageChef.Filesystems/BFS.cs +++ b/DiscImageChef.Filesystems/BFS.cs @@ -192,10 +192,10 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Clusters = besb.num_blocks, - ClusterSize = (int)besb.block_size, + Clusters = (ulong)besb.num_blocks, + ClusterSize = besb.block_size, Dirty = besb.flags == BEFS_DIRTY, - FreeClusters = besb.num_blocks - besb.used_blocks, + FreeClusters = (ulong)(besb.num_blocks - besb.used_blocks), FreeClustersSpecified = true, Type = "BeFS", VolumeName = StringHandlers.CToString(besb.name, Encoding) @@ -210,55 +210,55 @@ namespace DiscImageChef.Filesystems { /// 0x000, Volume name, 32 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] name; + public readonly byte[] name; /// 0x020, "BFS1", 0x42465331 public uint magic1; /// 0x024, "BIGE", 0x42494745 - public uint fs_byte_order; + public readonly uint fs_byte_order; /// 0x028, Bytes per block - public uint block_size; + public readonly uint block_size; /// 0x02C, 1 << block_shift == block_size - public uint block_shift; + public readonly uint block_shift; /// 0x030, Blocks in volume - public long num_blocks; + public readonly long num_blocks; /// 0x038, Used blocks in volume - public long used_blocks; + public readonly long used_blocks; /// 0x040, Bytes per inode - public int inode_size; + public readonly int inode_size; /// 0x044, 0xDD121031 - public uint magic2; + public readonly uint magic2; /// 0x048, Blocks per allocation group - public int blocks_per_ag; + public readonly int blocks_per_ag; /// 0x04C, 1 << ag_shift == blocks_per_ag - public int ag_shift; + public readonly int ag_shift; /// 0x050, Allocation groups in volume - public int num_ags; + public readonly int num_ags; /// 0x054, 0x434c454e if clean, 0x44495254 if dirty - public uint flags; + public readonly uint flags; /// 0x058, Allocation group of journal - public int log_blocks_ag; + public readonly int log_blocks_ag; /// 0x05C, Start block of journal, inside ag - public ushort log_blocks_start; + public readonly ushort log_blocks_start; /// 0x05E, Length in blocks of journal, inside ag - public ushort log_blocks_len; + public readonly ushort log_blocks_len; /// 0x060, Start of journal - public long log_start; + public readonly long log_start; /// 0x068, End of journal - public long log_end; + public readonly long log_end; /// 0x070, 0x15B6830E - public uint magic3; + public readonly uint magic3; /// 0x074, Allocation group where root folder's i-node resides - public int root_dir_ag; + public readonly int root_dir_ag; /// 0x078, Start in ag of root folder's i-node - public ushort root_dir_start; + public readonly ushort root_dir_start; /// 0x07A, As this is part of inode_addr, this is 1 - public ushort root_dir_len; + public readonly ushort root_dir_len; /// 0x07C, Allocation group where indices' i-node resides - public int indices_ag; + public readonly int indices_ag; /// 0x080, Start in ag of indices' i-node - public ushort indices_start; + public readonly ushort indices_start; /// 0x082, As this is part of inode_addr, this is 1 - public ushort indices_len; + public readonly ushort indices_len; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/BTRFS.cs b/DiscImageChef.Filesystems/BTRFS.cs index 8e7d36f28..87bcbd744 100644 --- a/DiscImageChef.Filesystems/BTRFS.cs +++ b/DiscImageChef.Filesystems/BTRFS.cs @@ -165,76 +165,76 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Clusters = (long)(btrfsSb.total_bytes / btrfsSb.sectorsize), - ClusterSize = (int)btrfsSb.sectorsize, + Clusters = btrfsSb.total_bytes / btrfsSb.sectorsize, + ClusterSize = btrfsSb.sectorsize, FreeClustersSpecified = true, VolumeName = btrfsSb.label, VolumeSerial = $"{btrfsSb.uuid}", VolumeSetIdentifier = $"{btrfsSb.dev_item.device_uuid}", Type = Name }; - XmlFsType.FreeClusters = XmlFsType.Clusters - (long)(btrfsSb.bytes_used / btrfsSb.sectorsize); + XmlFsType.FreeClusters = XmlFsType.Clusters - btrfsSb.bytes_used / btrfsSb.sectorsize; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct SuperBlock { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x20)] - public byte[] checksum; - public Guid uuid; - public ulong pba; - public ulong flags; - public ulong magic; - public ulong generation; - public ulong root_lba; - public ulong chunk_lba; - public ulong log_lba; - public ulong log_root_transid; - public ulong total_bytes; - public ulong bytes_used; - public ulong root_dir_objectid; - public ulong num_devices; - public uint sectorsize; - public uint nodesize; - public uint leafsize; - public uint stripesize; - public uint n; - public ulong chunk_root_generation; - public ulong compat_flags; - public ulong compat_ro_flags; - public ulong incompat_flags; - public ushort csum_type; - public byte root_level; - public byte chunk_root_level; - public byte log_root_level; - public DevItem dev_item; + public readonly byte[] checksum; + public readonly Guid uuid; + public readonly ulong pba; + public readonly ulong flags; + public readonly ulong magic; + public readonly ulong generation; + public readonly ulong root_lba; + public readonly ulong chunk_lba; + public readonly ulong log_lba; + public readonly ulong log_root_transid; + public readonly ulong total_bytes; + public readonly ulong bytes_used; + public readonly ulong root_dir_objectid; + public readonly ulong num_devices; + public readonly uint sectorsize; + public readonly uint nodesize; + public readonly uint leafsize; + public readonly uint stripesize; + public readonly uint n; + public readonly ulong chunk_root_generation; + public readonly ulong compat_flags; + public readonly ulong compat_ro_flags; + public readonly ulong incompat_flags; + public readonly ushort csum_type; + public readonly byte root_level; + public readonly byte chunk_root_level; + public readonly byte log_root_level; + public readonly DevItem dev_item; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x100)] - public string label; + public readonly string label; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x100)] - public byte[] reserved; + public readonly byte[] reserved; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x800)] - public byte[] chunkpairs; + public readonly byte[] chunkpairs; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x4D5)] - public byte[] unused; + public readonly byte[] unused; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct DevItem { - public ulong id; - public ulong bytes; - public ulong used; - public uint optimal_align; - public uint optimal_width; - public uint minimal_size; - public ulong type; - public ulong generation; - public ulong start_offset; - public uint dev_group; - public byte seek_speed; - public byte bandwitdh; - public Guid device_uuid; - public Guid uuid; + public readonly ulong id; + public readonly ulong bytes; + public readonly ulong used; + public readonly uint optimal_align; + public readonly uint optimal_width; + public readonly uint minimal_size; + public readonly ulong type; + public readonly ulong generation; + public readonly ulong start_offset; + public readonly uint dev_group; + public readonly byte seek_speed; + public readonly byte bandwitdh; + public readonly Guid device_uuid; + public readonly Guid uuid; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/CBM.cs b/DiscImageChef.Filesystems/CBM.cs index 138ce5f23..f54ccf375 100644 --- a/DiscImageChef.Filesystems/CBM.cs +++ b/DiscImageChef.Filesystems/CBM.cs @@ -93,7 +93,7 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Type = "Commodore file system", Clusters = (long)imagePlugin.Info.Sectors, ClusterSize = 256 + Type = "Commodore file system", Clusters = imagePlugin.Info.Sectors, ClusterSize = 256 }; if(imagePlugin.Info.Sectors == 3200) @@ -146,73 +146,73 @@ namespace DiscImageChef.Filesystems /// /// Track where directory starts /// - public byte directoryTrack; + public readonly byte directoryTrack; /// /// Sector where directory starts /// - public byte directorySector; + public readonly byte directorySector; /// /// Disk DOS version, 0x41 /// - public byte dosVersion; + public readonly byte dosVersion; /// /// Set to 0x80 if 1571, 0x00 if not /// - public byte doubleSided; + public readonly byte doubleSided; /// /// Block allocation map /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 140)] - public byte[] bam; + public readonly byte[] bam; /// /// Disk name /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] name; + public readonly byte[] name; /// /// Filled with 0xA0 /// - public ushort fill1; + public readonly ushort fill1; /// /// Disk ID /// - public ushort diskId; + public readonly ushort diskId; /// /// Filled with 0xA0 /// - public byte fill2; + public readonly byte fill2; /// /// DOS type /// - public ushort dosType; + public readonly ushort dosType; /// /// Filled with 0xA0 /// - public uint fill3; + public readonly uint fill3; /// /// Unused /// - public byte unused1; + public readonly byte unused1; /// /// Block allocation map for Dolphin DOS extended tracks /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] - public byte[] dolphinBam; + public readonly byte[] dolphinBam; /// /// Block allocation map for Speed DOS extended tracks /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] - public byte[] speedBam; + public readonly byte[] speedBam; /// /// Unused /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 9)] - public byte[] unused2; + public readonly byte[] unused2; /// /// Free sector count for second side in 1571 /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 9)] - public byte[] freeCount; + public readonly byte[] freeCount; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -221,48 +221,48 @@ namespace DiscImageChef.Filesystems /// /// Track where directory starts /// - public byte directoryTrack; + public readonly byte directoryTrack; /// /// Sector where directory starts /// - public byte directorySector; + public readonly byte directorySector; /// /// Disk DOS version, 0x44 /// - public byte diskDosVersion; + public readonly byte diskDosVersion; /// /// Unusued /// - public byte unused1; + public readonly byte unused1; /// /// Disk name /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] name; + public readonly byte[] name; /// /// Filled with 0xA0 /// - public ushort fill1; + public readonly ushort fill1; /// /// Disk ID /// - public ushort diskId; + public readonly ushort diskId; /// /// Filled with 0xA0 /// - public byte fill2; + public readonly byte fill2; /// /// DOS version ('3') /// - public byte dosVersion; + public readonly byte dosVersion; /// /// Disk version ('D') /// - public byte diskVersion; + public readonly byte diskVersion; /// /// Filled with 0xA0 /// - public short fill3; + public readonly short fill3; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/CPM/Info.cs b/DiscImageChef.Filesystems/CPM/Info.cs index 3ce90c899..56973fa7f 100644 --- a/DiscImageChef.Filesystems/CPM/Info.cs +++ b/DiscImageChef.Filesystems/CPM/Info.cs @@ -379,10 +379,8 @@ namespace DiscImageChef.Filesystems.CPM // Check for alternate location of format ID if(sector.Last() == 0x00 || sector.Last() == 0xFF) - if(sector[0x40] == 0x94 || sector[0x40] == 0x26) - formatByte = sector[0x40]; - else - formatByte = sector.Last(); + if(sector[0x40] == 0x94 || sector[0x40] == 0x26) formatByte = sector[0x40]; + else formatByte = sector.Last(); else formatByte = sector.Last(); uint firstDirectorySector86 = 0; @@ -1047,9 +1045,9 @@ namespace DiscImageChef.Filesystems.CPM XmlFsType = new FileSystemType(); XmlFsType.Bootable |= workingDefinition.sofs > 0 || workingDefinition.ofs > 0; - XmlFsType.ClusterSize = 128 << dpb.bsh; + XmlFsType.ClusterSize = (uint)(128 << dpb.bsh); if(dpb.dsm > 0) XmlFsType.Clusters = dpb.dsm; - else XmlFsType.Clusters = (long)(partition.End - partition.Start); + else XmlFsType.Clusters = partition.End - partition.Start; if(labelCreationDate != null) { XmlFsType.CreationDate = DateHandlers.CpmToDateTime(labelCreationDate); diff --git a/DiscImageChef.Filesystems/CPM/Super.cs b/DiscImageChef.Filesystems/CPM/Super.cs index aadb1cbcf..88a3c5242 100644 --- a/DiscImageChef.Filesystems/CPM/Super.cs +++ b/DiscImageChef.Filesystems/CPM/Super.cs @@ -640,10 +640,10 @@ namespace DiscImageChef.Filesystems.CPM } // Generate statfs. - cpmStat.Blocks = dpb.dsm + 1; + cpmStat.Blocks = (ulong)(dpb.dsm + 1); cpmStat.FilenameLength = 11; cpmStat.Files = (ulong)fileCache.Count; - cpmStat.FreeBlocks = cpmStat.Blocks - usedBlocks; + cpmStat.FreeBlocks = cpmStat.Blocks - (ulong)usedBlocks; cpmStat.PluginId = Id; cpmStat.Type = "CP/M filesystem"; @@ -651,8 +651,8 @@ namespace DiscImageChef.Filesystems.CPM XmlFsType = new FileSystemType { Clusters = cpmStat.Blocks, - ClusterSize = blockSize, - Files = fileCache.Count, + ClusterSize = (uint)blockSize, + Files = (ulong)fileCache.Count, FilesSpecified = true, FreeClusters = cpmStat.FreeBlocks, FreeClustersSpecified = true, diff --git a/DiscImageChef.Filesystems/ECMA67.cs b/DiscImageChef.Filesystems/ECMA67.cs index 00d860189..ffcefe0fa 100644 --- a/DiscImageChef.Filesystems/ECMA67.cs +++ b/DiscImageChef.Filesystems/ECMA67.cs @@ -85,7 +85,7 @@ namespace DiscImageChef.Filesystems { Type = "ECMA-67", ClusterSize = 256, - Clusters = (long)(partition.End - partition.Start + 1), + Clusters = partition.End - partition.Start + 1, VolumeName = Encoding.ASCII.GetString(vol.volumeIdentifier) }; @@ -96,27 +96,27 @@ namespace DiscImageChef.Filesystems struct VolumeLabel { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] labelIdentifier; - public byte labelNumber; + public readonly byte[] labelIdentifier; + public readonly byte labelNumber; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public byte[] volumeIdentifier; - public byte volumeAccessibility; + public readonly byte[] volumeIdentifier; + public readonly byte volumeAccessibility; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 26)] - public byte[] reserved1; + public readonly byte[] reserved1; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] - public byte[] owner; + public readonly byte[] owner; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] - public byte[] reserved2; - public byte surface; + public readonly byte[] reserved2; + public readonly byte surface; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] reserved3; - public byte recordLength; + public readonly byte[] reserved3; + public readonly byte recordLength; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public byte[] reserved4; - public byte fileLabelAllocation; - public byte labelStandardVersion; + public readonly byte[] reserved4; + public readonly byte fileLabelAllocation; + public readonly byte labelStandardVersion; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 48)] - public byte[] reserved5; + public readonly byte[] reserved5; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/EFS.cs b/DiscImageChef.Filesystems/EFS.cs index 7912dd656..1e8e677a3 100644 --- a/DiscImageChef.Filesystems/EFS.cs +++ b/DiscImageChef.Filesystems/EFS.cs @@ -170,8 +170,8 @@ namespace DiscImageChef.Filesystems { Type = "Extent File System", ClusterSize = 512, - Clusters = efsSb.sb_size, - FreeClusters = efsSb.sb_tfree, + Clusters = (ulong)efsSb.sb_size, + FreeClusters = (ulong)efsSb.sb_tfree, FreeClustersSpecified = true, Dirty = efsSb.sb_dirty > 0, VolumeName = StringHandlers.CToString(efsSb.sb_fname, Encoding), @@ -186,50 +186,50 @@ namespace DiscImageChef.Filesystems struct EFS_Superblock { /* 0: fs size incl. bb 0 (in bb) */ - public int sb_size; + public readonly int sb_size; /* 4: first cg offset (in bb) */ - public int sb_firstcg; + public readonly int sb_firstcg; /* 8: cg size (in bb) */ - public int sb_cgfsize; + public readonly int sb_cgfsize; /* 12: inodes/cg (in bb) */ - public short sb_cgisize; + public readonly short sb_cgisize; /* 14: geom: sectors/track */ - public short sb_sectors; + public readonly short sb_sectors; /* 16: geom: heads/cylinder (unused) */ - public short sb_heads; + public readonly short sb_heads; /* 18: num of cg's in the filesystem */ - public short sb_ncg; + public readonly short sb_ncg; /* 20: non-0 indicates fsck required */ - public short sb_dirty; + public readonly short sb_dirty; /* 22: */ - public short sb_pad0; + public readonly short sb_pad0; /* 24: superblock ctime */ - public int sb_time; + public readonly int sb_time; /* 28: magic [0] */ - public uint sb_magic; + public readonly uint sb_magic; /* 32: name of filesystem */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public byte[] sb_fname; + public readonly byte[] sb_fname; /* 38: name of filesystem pack */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public byte[] sb_fpack; + public readonly byte[] sb_fpack; /* 44: bitmap size (in bytes) */ - public int sb_bmsize; + public readonly int sb_bmsize; /* 48: total free data blocks */ - public int sb_tfree; + public readonly int sb_tfree; /* 52: total free inodes */ - public int sb_tinode; + public readonly int sb_tinode; /* 56: bitmap offset (grown fs) */ - public int sb_bmblock; + public readonly int sb_bmblock; /* 62: repl. superblock offset */ - public int sb_replsb; + public readonly int sb_replsb; /* 64: last allocated inode */ - public int sb_lastinode; + public readonly int sb_lastinode; /* 68: unused */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] - public byte[] sb_spare; + public readonly byte[] sb_spare; /* 88: checksum (all above) */ - public uint sb_checksum; + public readonly uint sb_checksum; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/F2FS.cs b/DiscImageChef.Filesystems/F2FS.cs index 40b3ee381..bd21f88d9 100644 --- a/DiscImageChef.Filesystems/F2FS.cs +++ b/DiscImageChef.Filesystems/F2FS.cs @@ -124,8 +124,8 @@ namespace DiscImageChef.Filesystems { Type = "F2FS filesystem", SystemIdentifier = Encoding.ASCII.GetString(f2fsSb.version), - Clusters = (long)f2fsSb.block_count, - ClusterSize = 1 << (int)f2fsSb.log_blocksize, + Clusters = f2fsSb.block_count, + ClusterSize = (uint)(1 << (int)f2fsSb.log_blocksize), DataPreparerIdentifier = Encoding.ASCII.GetString(f2fsSb.init_version), VolumeName = StringHandlers.CToString(f2fsSb.volume_name, Encoding.Unicode, true), VolumeSerial = f2fsSb.uuid.ToString() @@ -136,64 +136,64 @@ namespace DiscImageChef.Filesystems [SuppressMessage("ReSharper", "InconsistentNaming")] struct F2FS_Superblock { - public uint magic; - public ushort major_ver; - public ushort minor_ver; - public uint log_sectorsize; - public uint log_sectors_per_block; - public uint log_blocksize; - public uint log_blocks_per_seg; - public uint segs_per_sec; - public uint secs_per_zone; - public uint checksum_offset; - public ulong block_count; - public uint section_count; - public uint segment_count; - public uint segment_count_ckpt; - public uint segment_count_sit; - public uint segment_count_nat; - public uint segment_count_ssa; - public uint segment_count_main; - public uint segment0_blkaddr; - public uint cp_blkaddr; - public uint sit_blkaddr; - public uint nat_blkaddr; - public uint ssa_blkaddr; - public uint main_blkaddr; - public uint root_ino; - public uint node_ino; - public uint meta_ino; - public Guid uuid; + public readonly uint magic; + public readonly ushort major_ver; + public readonly ushort minor_ver; + public readonly uint log_sectorsize; + public readonly uint log_sectors_per_block; + public readonly uint log_blocksize; + public readonly uint log_blocks_per_seg; + public readonly uint segs_per_sec; + public readonly uint secs_per_zone; + public readonly uint checksum_offset; + public readonly ulong block_count; + public readonly uint section_count; + public readonly uint segment_count; + public readonly uint segment_count_ckpt; + public readonly uint segment_count_sit; + public readonly uint segment_count_nat; + public readonly uint segment_count_ssa; + public readonly uint segment_count_main; + public readonly uint segment0_blkaddr; + public readonly uint cp_blkaddr; + public readonly uint sit_blkaddr; + public readonly uint nat_blkaddr; + public readonly uint ssa_blkaddr; + public readonly uint main_blkaddr; + public readonly uint root_ino; + public readonly uint node_ino; + public readonly uint meta_ino; + public readonly Guid uuid; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1024)] - public byte[] volume_name; - public uint extension_count; + public readonly byte[] volume_name; + public readonly uint extension_count; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] - public byte[] extension_list1; + public readonly byte[] extension_list1; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] - public byte[] extension_list2; + public readonly byte[] extension_list2; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] - public byte[] extension_list3; + public readonly byte[] extension_list3; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] - public byte[] extension_list4; + public readonly byte[] extension_list4; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] - public byte[] extension_list5; + public readonly byte[] extension_list5; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] - public byte[] extension_list6; + public readonly byte[] extension_list6; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] - public byte[] extension_list7; + public readonly byte[] extension_list7; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] - public byte[] extension_list8; - public uint cp_payload; + public readonly byte[] extension_list8; + public readonly uint cp_payload; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] - public byte[] version; + public readonly byte[] version; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] - public byte[] init_version; - public uint feature; - public byte encryption_level; + public readonly byte[] init_version; + public readonly uint feature; + public readonly byte encryption_level; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] encrypt_pw_salt; + public readonly byte[] encrypt_pw_salt; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 871)] - public byte[] reserved; + public readonly byte[] reserved; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/FAT.cs b/DiscImageChef.Filesystems/FAT.cs index d496cfc30..14590ae0e 100644 --- a/DiscImageChef.Filesystems/FAT.cs +++ b/DiscImageChef.Filesystems/FAT.cs @@ -54,7 +54,7 @@ namespace DiscImageChef.Filesystems const uint FSINFO_SIGNATURE2 = 0x61417272; const uint FSINFO_SIGNATURE3 = 0xAA550000; - (string hash, string name)[] knownBootHashes = + readonly (string hash, string name)[] knownBootHashes = { ("b639b4d5b25f63560e3b34a3a0feb732aa65486f", "Amstrad MS-DOS 3.20 (8-sector floppy)"), ("9311151f13f7611b1431593da05ddd3153370574", "Amstrad MS-DOS 3.20 (Spanish)"), @@ -1014,20 +1014,19 @@ namespace DiscImageChef.Filesystems if(fat32Bpb.oem_name != null) if(fat32Bpb.oem_name[5] == 0x49 && fat32Bpb.oem_name[6] == 0x48 && fat32Bpb.oem_name[7] == 0x43) sb.AppendLine("Volume has been modified by Windows 9x/Me Volume Tracker."); - else - XmlFsType.SystemIdentifier = StringHandlers.CToString(fat32Bpb.oem_name); + else XmlFsType.SystemIdentifier = StringHandlers.CToString(fat32Bpb.oem_name); if(!string.IsNullOrEmpty(XmlFsType.SystemIdentifier)) sb.AppendFormat("OEM Name: {0}", XmlFsType.SystemIdentifier.Trim()).AppendLine(); sb.AppendFormat("{0} bytes per sector.", fat32Bpb.bps).AppendLine(); sb.AppendFormat("{0} sectors per cluster.", fat32Bpb.spc).AppendLine(); - XmlFsType.ClusterSize = fat32Bpb.bps * fat32Bpb.spc; + XmlFsType.ClusterSize = (uint)(fat32Bpb.bps * fat32Bpb.spc); sb.AppendFormat("{0} sectors reserved between BPB and FAT.", fat32Bpb.rsectors).AppendLine(); if(fat32Bpb.big_sectors == 0 && fat32Bpb.signature == 0x28) { sb.AppendFormat("{0} sectors on volume ({1} bytes).", shortFat32Bpb.huge_sectors, shortFat32Bpb.huge_sectors * shortFat32Bpb.bps).AppendLine(); - XmlFsType.Clusters = (long)(shortFat32Bpb.huge_sectors / shortFat32Bpb.spc); + XmlFsType.Clusters = shortFat32Bpb.huge_sectors / shortFat32Bpb.spc; } else { @@ -1423,7 +1422,8 @@ namespace DiscImageChef.Filesystems { sb.AppendFormat("{0} sectors on volume ({1} bytes).", fakeBpb.sectors, fakeBpb.sectors * fakeBpb.bps).AppendLine(); - XmlFsType.Clusters = fakeBpb.spc == 0 ? fakeBpb.sectors : fakeBpb.sectors / fakeBpb.spc; + XmlFsType.Clusters = + (ulong)(fakeBpb.spc == 0 ? fakeBpb.sectors : fakeBpb.sectors / fakeBpb.spc); } else { @@ -1435,7 +1435,7 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("{0} sectors per cluster.", fakeBpb.spc).AppendLine(); sb.AppendFormat("{0} clusters on volume.", XmlFsType.Clusters).AppendLine(); - XmlFsType.ClusterSize = fakeBpb.bps * fakeBpb.spc; + XmlFsType.ClusterSize = (uint)(fakeBpb.bps * fakeBpb.spc); sb.AppendFormat("{0} sectors reserved between BPB and FAT.", fakeBpb.rsectors).AppendLine(); sb.AppendFormat("{0} FATs.", fakeBpb.fats_no).AppendLine(); sb.AppendFormat("{0} entries on root directory.", fakeBpb.root_ent).AppendLine(); @@ -1602,64 +1602,64 @@ namespace DiscImageChef.Filesystems { /// 68000 BRA.S jump or x86 loop [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public byte[] jump; + public readonly byte[] jump; /// OEM Name, 6 bytes, space-padded, "Loader" for Atari ST boot loader [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public byte[] oem_name; + public readonly byte[] oem_name; /// Volume serial number [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] serial_no; + public readonly byte[] serial_no; /// Bytes per sector - public ushort bps; + public readonly ushort bps; /// Sectors per cluster - public byte spc; + public readonly byte spc; /// Reserved sectors between BPB and FAT (inclusive) - public ushort rsectors; + public readonly ushort rsectors; /// Number of FATs - public byte fats_no; + public readonly byte fats_no; /// Number of entries on root directory - public ushort root_ent; + public readonly ushort root_ent; /// Sectors in volume public ushort sectors; /// Media descriptor, unused by GEMDOS - public byte media; + public readonly byte media; /// Sectors per FAT - public ushort spfat; + public readonly ushort spfat; /// Sectors per track - public ushort sptrk; + public readonly ushort sptrk; /// Heads - public ushort heads; + public readonly ushort heads; /// Hidden sectors before BPB, unused by GEMDOS - public ushort hsectors; + public readonly ushort hsectors; /// Word to be loaded in the cmdload system variable. Big-endian. - public ushort execflag; + public readonly ushort execflag; /// /// Word indicating load mode. If zero, file named is located and loaded. It not, sectors /// specified in and are loaded. Big endian. /// - public ushort ldmode; + public readonly ushort ldmode; /// Starting sector of boot code. - public ushort ssect; + public readonly ushort ssect; /// Count of sectors of boot code. - public ushort sectcnt; + public readonly ushort sectcnt; /// Address where boot code should be loaded. - public ushort ldaaddr; + public readonly ushort ldaaddr; /// Padding. - public ushort padding; + public readonly ushort padding; /// Address where FAT and root directory sectors must be loaded. - public ushort fatbuf; + public readonly ushort fatbuf; /// Unknown. - public ushort unknown; + public readonly ushort unknown; /// Filename to be loaded for booting. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] - public byte[] fname; + public readonly byte[] fname; /// Reserved - public ushort reserved; + public readonly ushort reserved; /// Boot code. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 455)] - public byte[] boot_code; + public readonly byte[] boot_code; /// Big endian word to make big endian sum of all sector words be equal to 0x1234 if disk is bootable. - public ushort checksum; + public readonly ushort checksum; } /// @@ -1670,51 +1670,51 @@ namespace DiscImageChef.Filesystems { /// x86 loop [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] jump; + public readonly byte[] jump; /// OEM Name, 8 bytes, space-padded [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] oem_name; + public readonly byte[] oem_name; /// Bytes per sector - public ushort bps; + public readonly ushort bps; /// Sectors per cluster - public byte spc; + public readonly byte spc; /// Reserved sectors between BPB and FAT (inclusive) - public ushort rsectors; + public readonly ushort rsectors; /// Number of FATs - public byte fats_no; + public readonly byte fats_no; /// Number of entries on root directory - public ushort root_ent; + public readonly ushort root_ent; /// Sectors in volume public ushort sectors; /// Media descriptor - public byte media; + public readonly byte media; /// Sectors per FAT - public ushort spfat; + public readonly ushort spfat; /// Sectors per track - public ushort sptrk; + public readonly ushort sptrk; /// Heads - public ushort heads; + public readonly ushort heads; /// Hidden sectors before BPB - public ushort hsectors; + public readonly ushort hsectors; /// Jump for MSX-DOS 1 boot code - public ushort msxdos_jmp; + public readonly ushort msxdos_jmp; /// Set to "VOL_ID" by MSX-DOS 2 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] - public byte[] vol_id; + public readonly byte[] vol_id; /// Bigger than 0 if there are deleted files (MSX-DOS 2) - public byte undelete_flag; + public readonly byte undelete_flag; /// Volume serial number (MSX-DOS 2) - public uint serial_no; + public readonly uint serial_no; /// Reserved (MSX-DOS 2) [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public byte[] reserved; + public readonly byte[] reserved; /// Jump for MSX-DOS 2 boot code (MSX-DOS 2) - public ushort msxdos2_jmp; + public readonly ushort msxdos2_jmp; /// Boot code. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 460)] - public byte[] boot_code; + public readonly byte[] boot_code; /// Always 0x55 0xAA. - public ushort boot_signature; + public readonly ushort boot_signature; } /// DOS 2.0 BIOS Parameter Block. @@ -1723,31 +1723,31 @@ namespace DiscImageChef.Filesystems { /// x86 jump [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] jump; + public readonly byte[] jump; /// OEM Name, 8 bytes, space-padded [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] oem_name; + public readonly byte[] oem_name; /// Bytes per sector - public ushort bps; + public readonly ushort bps; /// Sectors per cluster - public byte spc; + public readonly byte spc; /// Reserved sectors between BPB and FAT - public ushort rsectors; + public readonly ushort rsectors; /// Number of FATs - public byte fats_no; + public readonly byte fats_no; /// Number of entries on root directory - public ushort root_ent; + public readonly ushort root_ent; /// Sectors in volume public ushort sectors; /// Media descriptor - public byte media; + public readonly byte media; /// Sectors per FAT - public ushort spfat; + public readonly ushort spfat; /// Boot code. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 486)] - public byte[] boot_code; + public readonly byte[] boot_code; /// 0x55 0xAA if bootable. - public ushort boot_signature; + public readonly ushort boot_signature; } /// DOS 3.0 BIOS Parameter Block. @@ -1756,37 +1756,37 @@ namespace DiscImageChef.Filesystems { /// x86 jump [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] jump; + public readonly byte[] jump; /// OEM Name, 8 bytes, space-padded [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] oem_name; + public readonly byte[] oem_name; /// Bytes per sector - public ushort bps; + public readonly ushort bps; /// Sectors per cluster - public byte spc; + public readonly byte spc; /// Reserved sectors between BPB and FAT - public ushort rsectors; + public readonly ushort rsectors; /// Number of FATs - public byte fats_no; + public readonly byte fats_no; /// Number of entries on root directory - public ushort root_ent; + public readonly ushort root_ent; /// Sectors in volume public ushort sectors; /// Media descriptor - public byte media; + public readonly byte media; /// Sectors per FAT - public ushort spfat; + public readonly ushort spfat; /// Sectors per track - public ushort sptrk; + public readonly ushort sptrk; /// Heads - public ushort heads; + public readonly ushort heads; /// Hidden sectors before BPB - public ushort hsectors; + public readonly ushort hsectors; /// Boot code. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 480)] - public byte[] boot_code; + public readonly byte[] boot_code; /// Always 0x55 0xAA. - public ushort boot_signature; + public readonly ushort boot_signature; } /// DOS 3.2 BIOS Parameter Block. @@ -1795,39 +1795,39 @@ namespace DiscImageChef.Filesystems { /// x86 jump [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] jump; + public readonly byte[] jump; /// OEM Name, 8 bytes, space-padded [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] oem_name; + public readonly byte[] oem_name; /// Bytes per sector - public ushort bps; + public readonly ushort bps; /// Sectors per cluster - public byte spc; + public readonly byte spc; /// Reserved sectors between BPB and FAT - public ushort rsectors; + public readonly ushort rsectors; /// Number of FATs - public byte fats_no; + public readonly byte fats_no; /// Number of entries on root directory - public ushort root_ent; + public readonly ushort root_ent; /// Sectors in volume public ushort sectors; /// Media descriptor - public byte media; + public readonly byte media; /// Sectors per FAT - public ushort spfat; + public readonly ushort spfat; /// Sectors per track - public ushort sptrk; + public readonly ushort sptrk; /// Heads - public ushort heads; + public readonly ushort heads; /// Hidden sectors before BPB - public ushort hsectors; + public readonly ushort hsectors; /// Total sectors including hidden ones - public ushort total_sectors; + public readonly ushort total_sectors; /// Boot code. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 478)] - public byte[] boot_code; + public readonly byte[] boot_code; /// Always 0x55 0xAA. - public ushort boot_signature; + public readonly ushort boot_signature; } /// DOS 3.31 BIOS Parameter Block. @@ -1836,39 +1836,39 @@ namespace DiscImageChef.Filesystems { /// x86 jump [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] jump; + public readonly byte[] jump; /// OEM Name, 8 bytes, space-padded [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] oem_name; + public readonly byte[] oem_name; /// Bytes per sector - public ushort bps; + public readonly ushort bps; /// Sectors per cluster - public byte spc; + public readonly byte spc; /// Reserved sectors between BPB and FAT - public ushort rsectors; + public readonly ushort rsectors; /// Number of FATs - public byte fats_no; + public readonly byte fats_no; /// Number of entries on root directory - public ushort root_ent; + public readonly ushort root_ent; /// Sectors in volume public ushort sectors; /// Media descriptor - public byte media; + public readonly byte media; /// Sectors per FAT - public ushort spfat; + public readonly ushort spfat; /// Sectors per track - public ushort sptrk; + public readonly ushort sptrk; /// Heads - public ushort heads; + public readonly ushort heads; /// Hidden sectors before BPB - public uint hsectors; + public readonly uint hsectors; /// Sectors in volume if > 65535 public uint big_sectors; /// Boot code. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 474)] - public byte[] boot_code; + public readonly byte[] boot_code; /// Always 0x55 0xAA. - public ushort boot_signature; + public readonly ushort boot_signature; } /// DOS 3.4 BIOS Parameter Block. @@ -1877,47 +1877,47 @@ namespace DiscImageChef.Filesystems { /// x86 jump [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] jump; + public readonly byte[] jump; /// OEM Name, 8 bytes, space-padded [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] oem_name; + public readonly byte[] oem_name; /// Bytes per sector - public ushort bps; + public readonly ushort bps; /// Sectors per cluster - public byte spc; + public readonly byte spc; /// Reserved sectors between BPB and FAT - public ushort rsectors; + public readonly ushort rsectors; /// Number of FATs - public byte fats_no; + public readonly byte fats_no; /// Number of entries on root directory - public ushort root_ent; + public readonly ushort root_ent; /// Sectors in volume public ushort sectors; /// Media descriptor - public byte media; + public readonly byte media; /// Sectors per FAT - public ushort spfat; + public readonly ushort spfat; /// Sectors per track - public ushort sptrk; + public readonly ushort sptrk; /// Heads - public ushort heads; + public readonly ushort heads; /// Hidden sectors before BPB - public uint hsectors; + public readonly uint hsectors; /// Sectors in volume if > 65535 public uint big_sectors; /// Drive number - public byte drive_no; + public readonly byte drive_no; /// Volume flags - public byte flags; + public readonly byte flags; /// EPB signature, 0x28 - public byte signature; + public readonly byte signature; /// Volume serial number - public uint serial_no; + public readonly uint serial_no; /// Boot code. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 467)] - public byte[] boot_code; + public readonly byte[] boot_code; /// Always 0x55 0xAA. - public ushort boot_signature; + public readonly ushort boot_signature; } /// DOS 4.0 or higher BIOS Parameter Block. @@ -1964,10 +1964,10 @@ namespace DiscImageChef.Filesystems public uint serial_no; /// Volume label, 11 bytes, space-padded [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] - public byte[] volume_label; + public readonly byte[] volume_label; /// Filesystem type, 8 bytes, space-padded [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] fs_type; + public readonly byte[] fs_type; /// Boot code. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 448)] public byte[] boot_code; @@ -1981,67 +1981,67 @@ namespace DiscImageChef.Filesystems { /// x86 jump [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] jump; + public readonly byte[] jump; /// OEM Name, 8 bytes, space-padded [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] oem_name; + public readonly byte[] oem_name; /// Bytes per sector - public ushort bps; + public readonly ushort bps; /// Sectors per cluster - public byte spc; + public readonly byte spc; /// Reserved sectors between BPB and FAT - public ushort rsectors; + public readonly ushort rsectors; /// Number of FATs - public byte fats_no; + public readonly byte fats_no; /// Number of entries on root directory, set to 0 - public ushort root_ent; + public readonly ushort root_ent; /// Sectors in volume, set to 0 public ushort sectors; /// Media descriptor - public byte media; + public readonly byte media; /// Sectors per FAT, set to 0 - public ushort spfat; + public readonly ushort spfat; /// Sectors per track - public ushort sptrk; + public readonly ushort sptrk; /// Heads - public ushort heads; + public readonly ushort heads; /// Hidden sectors before BPB - public uint hsectors; + public readonly uint hsectors; /// Sectors in volume public uint big_sectors; /// Sectors per FAT - public uint big_spfat; + public readonly uint big_spfat; /// FAT flags - public ushort mirror_flags; + public readonly ushort mirror_flags; /// FAT32 version - public ushort version; + public readonly ushort version; /// Cluster of root directory - public uint root_cluster; + public readonly uint root_cluster; /// Sector of FSINFO structure - public ushort fsinfo_sector; + public readonly ushort fsinfo_sector; /// Sector of FAT32PB backup - public ushort backup_sector; + public readonly ushort backup_sector; /// Reserved [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] reserved; + public readonly byte[] reserved; /// Drive number - public byte drive_no; + public readonly byte drive_no; /// Volume flags - public byte flags; + public readonly byte flags; /// Signature, should be 0x28 - public byte signature; + public readonly byte signature; /// Volume serial number - public uint serial_no; + public readonly uint serial_no; /// Volume label, 11 bytes, space-padded [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] - public byte[] reserved2; + public readonly byte[] reserved2; /// Sectors in volume if equals 0 public ulong huge_sectors; /// Boot code. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 420)] - public byte[] boot_code; + public readonly byte[] boot_code; /// Always 0x55 0xAA. - public ushort boot_signature; + public readonly ushort boot_signature; } /// FAT32 Parameter Block @@ -2050,30 +2050,30 @@ namespace DiscImageChef.Filesystems { /// x86 jump [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] jump; + public readonly byte[] jump; /// OEM Name, 8 bytes, space-padded [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] oem_name; + public readonly byte[] oem_name; /// Bytes per sector public ushort bps; /// Sectors per cluster public byte spc; /// Reserved sectors between BPB and FAT - public ushort rsectors; + public readonly ushort rsectors; /// Number of FATs - public byte fats_no; + public readonly byte fats_no; /// Number of entries on root directory, set to 0 - public ushort root_ent; + public readonly ushort root_ent; /// Sectors in volume, set to 0 public ushort sectors; /// Media descriptor - public byte media; + public readonly byte media; /// Sectors per FAT, set to 0 - public ushort spfat; + public readonly ushort spfat; /// Sectors per track public ushort sptrk; /// Heads - public ushort heads; + public readonly ushort heads; /// Hidden sectors before BPB public uint hsectors; /// Sectors in volume @@ -2081,37 +2081,37 @@ namespace DiscImageChef.Filesystems /// Sectors per FAT public uint big_spfat; /// FAT flags - public ushort mirror_flags; + public readonly ushort mirror_flags; /// FAT32 version - public ushort version; + public readonly ushort version; /// Cluster of root directory - public uint root_cluster; + public readonly uint root_cluster; /// Sector of FSINFO structure - public ushort fsinfo_sector; + public readonly ushort fsinfo_sector; /// Sector of FAT32PB backup - public ushort backup_sector; + public readonly ushort backup_sector; /// Reserved [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] reserved; + public readonly byte[] reserved; /// Drive number - public byte drive_no; + public readonly byte drive_no; /// Volume flags - public byte flags; + public readonly byte flags; /// Signature, should be 0x29 - public byte signature; + public readonly byte signature; /// Volume serial number - public uint serial_no; + public readonly uint serial_no; /// Volume label, 11 bytes, space-padded [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] - public byte[] volume_label; + public readonly byte[] volume_label; /// Filesystem type, 8 bytes, space-padded, must be "FAT32 " [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] fs_type; + public readonly byte[] fs_type; /// Boot code. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 419)] - public byte[] boot_code; + public readonly byte[] boot_code; /// Always 0x55 0xAA. - public ushort boot_signature; + public readonly ushort boot_signature; } /// Apricot Label. @@ -2120,234 +2120,234 @@ namespace DiscImageChef.Filesystems { /// Version of format which created disk [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] version; + public readonly byte[] version; /// Operating system. - public byte operatingSystem; + public readonly byte operatingSystem; /// Software write protection. [MarshalAs(UnmanagedType.U1)] - public bool writeProtected; + public readonly bool writeProtected; /// Copy protected. [MarshalAs(UnmanagedType.U1)] - public bool copyProtected; + public readonly bool copyProtected; /// Boot type. - public byte bootType; + public readonly byte bootType; /// Partitions. - public byte partitionCount; + public readonly byte partitionCount; /// Is hard disk?. [MarshalAs(UnmanagedType.U1)] - public bool winchester; + public readonly bool winchester; /// Sector size. - public ushort sectorSize; + public readonly ushort sectorSize; /// Sectors per track. - public ushort spt; + public readonly ushort spt; /// Tracks per side. - public uint cylinders; + public readonly uint cylinders; /// Sides. - public byte heads; + public readonly byte heads; /// Interleave factor. - public byte interleave; + public readonly byte interleave; /// Skew factor. - public ushort skew; + public readonly ushort skew; /// Sector where boot code starts. - public uint bootLocation; + public readonly uint bootLocation; /// Size in sectors of boot code. - public ushort bootSize; + public readonly ushort bootSize; /// Address at which to load boot code. - public uint bootAddress; + public readonly uint bootAddress; /// Offset where to jump to boot. - public ushort bootOffset; + public readonly ushort bootOffset; /// Segment where to jump to boot. - public ushort bootSegment; + public readonly ushort bootSegment; /// First data sector. - public uint firstDataBlock; + public readonly uint firstDataBlock; /// Generation. - public ushort generation; + public readonly ushort generation; /// Copy count. - public ushort copyCount; + public readonly ushort copyCount; /// Maximum number of copies. - public ushort maxCopies; + public readonly ushort maxCopies; /// Serial number. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] serialNumber; + public readonly byte[] serialNumber; /// Part number. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] partNumber; + public readonly byte[] partNumber; /// Copyright. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] - public byte[] copyright; + public readonly byte[] copyright; /// BPB for whole disk. public ApricotParameterBlock mainBPB; /// Name of FONT file. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] fontName; + public readonly byte[] fontName; /// Name of KEYBOARD file. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] keyboardName; + public readonly byte[] keyboardName; /// Minor BIOS version. - public byte biosMinorVersion; + public readonly byte biosMinorVersion; /// Major BIOS version. - public byte biosMajorVersion; + public readonly byte biosMajorVersion; /// Diagnostics enabled?. [MarshalAs(UnmanagedType.U1)] - public bool diagnosticsFlag; + public readonly bool diagnosticsFlag; /// Printer device. - public byte prnDevice; + public readonly byte prnDevice; /// Bell volume. - public byte bellVolume; + public readonly byte bellVolume; /// Cache enabled?. [MarshalAs(UnmanagedType.U1)] - public bool enableCache; + public readonly bool enableCache; /// Graphics enabled?. [MarshalAs(UnmanagedType.U1)] - public bool enableGraphics; + public readonly bool enableGraphics; /// Length in sectors of DOS. - public byte dosLength; + public readonly byte dosLength; /// Length in sectors of FONT file. - public byte fontLength; + public readonly byte fontLength; /// Length in sectors of KEYBOARD file. - public byte keyboardLength; + public readonly byte keyboardLength; /// Starting sector of DOS. - public ushort dosStart; + public readonly ushort dosStart; /// Starting sector of FONT file. - public ushort fontStart; + public readonly ushort fontStart; /// Starting sector of KEYBOARD file. - public ushort keyboardStart; + public readonly ushort keyboardStart; /// Keyboard click volume. - public byte keyboardVolume; + public readonly byte keyboardVolume; /// Auto-repeat enabled?. [MarshalAs(UnmanagedType.U1)] - public bool autorepeat; + public readonly bool autorepeat; /// Auto-repeat lead-in. - public byte autorepeatLeadIn; + public readonly byte autorepeatLeadIn; /// Auto-repeat interval. - public byte autorepeatInterval; + public readonly byte autorepeatInterval; /// Microscreen mode. - public byte microscreenMode; + public readonly byte microscreenMode; /// Spare area for keyboard values expansion. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] - public byte[] spareKeyboard; + public readonly byte[] spareKeyboard; /// Screen line mode. - public byte lineMode; + public readonly byte lineMode; /// Screen line width. - public byte lineWidth; + public readonly byte lineWidth; /// Screen disabled?. [MarshalAs(UnmanagedType.U1)] - public bool imageOff; + public readonly bool imageOff; /// Spare area for screen values expansion. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 13)] - public byte[] spareScreen; + public readonly byte[] spareScreen; /// TX baud rate. - public byte txBaudRate; + public readonly byte txBaudRate; /// RX baud rate. - public byte rxBaudRate; + public readonly byte rxBaudRate; /// TX bits. - public byte txBits; + public readonly byte txBits; /// RX bits. - public byte rxBits; + public readonly byte rxBits; /// Stop bits. - public byte stopBits; + public readonly byte stopBits; /// Parity enabled?. [MarshalAs(UnmanagedType.U1)] - public bool parityCheck; + public readonly bool parityCheck; /// Parity type. - public byte parityType; + public readonly byte parityType; /// Xon/Xoff enabled on TX. [MarshalAs(UnmanagedType.U1)] - public bool txXonXoff; + public readonly bool txXonXoff; /// Xon/Xoff enabled on RX. [MarshalAs(UnmanagedType.U1)] - public bool rxXonXoff; + public readonly bool rxXonXoff; /// Xon character. - public byte xonCharacter; + public readonly byte xonCharacter; /// Xoff character. - public byte xoffCharacter; + public readonly byte xoffCharacter; /// Xon/Xoff buffer on RX. - public ushort rxXonXoffBuffer; + public readonly ushort rxXonXoffBuffer; /// DTR/DSR enabled?. [MarshalAs(UnmanagedType.U1)] - public bool dtrDsr; + public readonly bool dtrDsr; /// CTS/RTS enabled?. [MarshalAs(UnmanagedType.U1)] - public bool ctsRts; + public readonly bool ctsRts; /// NULLs after CR. - public byte nullsAfterCr; + public readonly byte nullsAfterCr; /// NULLs after 0xFF. - public byte nullsAfterFF; + public readonly byte nullsAfterFF; /// Send LF after CR in serial port. [MarshalAs(UnmanagedType.U1)] - public bool lfAfterCRSerial; + public readonly bool lfAfterCRSerial; /// BIOS error report in serial port. [MarshalAs(UnmanagedType.U1)] - public bool biosErrorReportSerial; + public readonly bool biosErrorReportSerial; /// Spare area for serial port values expansion. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 13)] - public byte[] spareSerial; + public readonly byte[] spareSerial; /// Send LF after CR in parallel port. [MarshalAs(UnmanagedType.U1)] - public bool lfAfterCrParallel; + public readonly bool lfAfterCrParallel; /// Select line supported?. [MarshalAs(UnmanagedType.U1)] - public bool selectLine; + public readonly bool selectLine; /// Paper empty supported?. [MarshalAs(UnmanagedType.U1)] - public bool paperEmpty; + public readonly bool paperEmpty; /// Fault line supported?. [MarshalAs(UnmanagedType.U1)] - public bool faultLine; + public readonly bool faultLine; /// BIOS error report in parallel port. [MarshalAs(UnmanagedType.U1)] - public bool biosErrorReportParallel; + public readonly bool biosErrorReportParallel; /// Spare area for parallel port values expansion. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] - public byte[] spareParallel; + public readonly byte[] spareParallel; /// Spare area for Winchester values expansion. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] - public byte[] spareWinchester; + public readonly byte[] spareWinchester; /// Parking enabled?. [MarshalAs(UnmanagedType.U1)] - public bool parkingEnabled; + public readonly bool parkingEnabled; /// Format protection?. [MarshalAs(UnmanagedType.U1)] - public bool formatProtection; + public readonly bool formatProtection; /// Spare area for RAM disk values expansion. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] spareRamDisk; + public readonly byte[] spareRamDisk; /// List of bad blocks. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public ushort[] badBlocks; + public readonly ushort[] badBlocks; /// Array of partition BPBs. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public ApricotParameterBlock[] partitions; + public readonly ApricotParameterBlock[] partitions; /// Spare area. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 63)] - public byte[] spare; + public readonly byte[] spare; /// CP/M double side indicator?. - public bool cpmDoubleSided; + public readonly bool cpmDoubleSided; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ApricotParameterBlock { /// Bytes per sector - public ushort bps; + public readonly ushort bps; /// Sectors per cluster - public byte spc; + public readonly byte spc; /// Reserved sectors between BPB and FAT - public ushort rsectors; + public readonly ushort rsectors; /// Number of FATs - public byte fats_no; + public readonly byte fats_no; /// Number of entries on root directory - public ushort root_ent; + public readonly ushort root_ent; /// Sectors in volume public ushort sectors; /// Media descriptor - public byte media; + public readonly byte media; /// Sectors per FAT - public ushort spfat; + public readonly ushort spfat; /// Disk type - public byte diskType; + public readonly byte diskType; /// Volume starting sector - public ushort startSector; + public readonly ushort startSector; } /// FAT32 FS Information Sector @@ -2355,21 +2355,21 @@ namespace DiscImageChef.Filesystems struct FsInfoSector { /// Signature must be - public uint signature1; + public readonly uint signature1; /// Reserved [MarshalAs(UnmanagedType.ByValArray, SizeConst = 480)] - public byte[] reserved1; + public readonly byte[] reserved1; /// Signature must be - public uint signature2; + public readonly uint signature2; /// Free clusters - public uint free_clusters; + public readonly uint free_clusters; /// cated cluster - public uint last_cluster; + public readonly uint last_cluster; /// Reserved [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] reserved2; + public readonly byte[] reserved2; /// Signature must be - public uint signature3; + public readonly uint signature3; } /// Human68k Parameter Block, big endian, 512 bytes even on 256 bytes/sector. @@ -2378,31 +2378,31 @@ namespace DiscImageChef.Filesystems { /// 68k bra.S [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public byte[] jump; + public readonly byte[] jump; /// OEM Name, 16 bytes, space-padded [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] oem_name; + public readonly byte[] oem_name; /// Bytes per cluster - public ushort bpc; + public readonly ushort bpc; /// Unknown, seen 1, 2 and 16 - public byte unknown1; + public readonly byte unknown1; /// Unknown, always 512? - public ushort unknown2; + public readonly ushort unknown2; /// Unknown, always 1? - public byte unknown3; + public readonly byte unknown3; /// Number of entries on root directory - public ushort root_ent; + public readonly ushort root_ent; /// Clusters, set to 0 if more than 65536 - public ushort clusters; + public readonly ushort clusters; /// Media descriptor - public byte media; + public readonly byte media; /// Clusters per FAT, set to 0 - public byte cpfat; + public readonly byte cpfat; /// Clustersin volume - public uint big_clusters; + public readonly uint big_clusters; /// Boot code. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 478)] - public byte[] boot_code; + public readonly byte[] boot_code; } [Flags] @@ -2423,20 +2423,20 @@ namespace DiscImageChef.Filesystems struct DirectoryEntry { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] filename; + public readonly byte[] filename; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] extension; - public FatAttributes attributes; - public byte caseinfo; - public byte ctime_ms; - public ushort ctime; - public ushort cdate; - public ushort adate; - public ushort ea_handle; - public ushort mtime; - public ushort mdate; - public ushort start_cluster; - public uint size; + public readonly byte[] extension; + public readonly FatAttributes attributes; + public readonly byte caseinfo; + public readonly byte ctime_ms; + public readonly ushort ctime; + public readonly ushort cdate; + public readonly ushort adate; + public readonly ushort ea_handle; + public readonly ushort mtime; + public readonly ushort mdate; + public readonly ushort start_cluster; + public readonly uint size; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/FATX/Info.cs b/DiscImageChef.Filesystems/FATX/Info.cs index 51692303c..792e31ead 100644 --- a/DiscImageChef.Filesystems/FATX/Info.cs +++ b/DiscImageChef.Filesystems/FATX/Info.cs @@ -97,13 +97,13 @@ namespace DiscImageChef.Filesystems.FATX { Type = "FATX filesystem", ClusterSize = - (int)(fatxSb.sectorsPerCluster * logicalSectorsPerPhysicalSectors * - imagePlugin.Info.SectorSize), + (uint)(fatxSb.sectorsPerCluster * logicalSectorsPerPhysicalSectors * + imagePlugin.Info.SectorSize), VolumeName = volumeLabel, VolumeSerial = $"{fatxSb.id:X8}" }; - XmlFsType.Clusters = (long)((partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / - (ulong)XmlFsType.ClusterSize); + XmlFsType.Clusters = (partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / + XmlFsType.ClusterSize; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/FATX/Super.cs b/DiscImageChef.Filesystems/FATX/Super.cs index e76971867..c0bb3ba06 100644 --- a/DiscImageChef.Filesystems/FATX/Super.cs +++ b/DiscImageChef.Filesystems/FATX/Super.cs @@ -85,13 +85,13 @@ namespace DiscImageChef.Filesystems.FATX { Type = "FATX filesystem", ClusterSize = - (int)(superblock.sectorsPerCluster * logicalSectorsPerPhysicalSectors * - imagePlugin.Info.SectorSize), + (uint)(superblock.sectorsPerCluster * logicalSectorsPerPhysicalSectors * + imagePlugin.Info.SectorSize), VolumeName = volumeLabel, VolumeSerial = $"{superblock.id:X8}" }; - XmlFsType.Clusters = (long)((partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / - (ulong)XmlFsType.ClusterSize); + XmlFsType.Clusters = (partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / + XmlFsType.ClusterSize; statfs = new FileSystemInfo { diff --git a/DiscImageChef.Filesystems/FFS.cs b/DiscImageChef.Filesystems/FFS.cs index 1830d7696..42099f632 100644 --- a/DiscImageChef.Filesystems/FFS.cs +++ b/DiscImageChef.Filesystems/FFS.cs @@ -346,8 +346,8 @@ namespace DiscImageChef.Filesystems XmlFsType.ModificationDateSpecified = true; sbInformation.AppendFormat("{0} blocks in volume ({1} bytes)", ufs_sb.fs_old_size, (long)ufs_sb.fs_old_size * ufs_sb.fs_fsize).AppendLine(); - XmlFsType.Clusters = ufs_sb.fs_old_size; - XmlFsType.ClusterSize = ufs_sb.fs_fsize; + XmlFsType.Clusters = (ulong)ufs_sb.fs_old_size; + XmlFsType.ClusterSize = (uint)ufs_sb.fs_fsize; sbInformation.AppendFormat("{0} data blocks in volume ({1} bytes)", ufs_sb.fs_old_dsize, (long)ufs_sb.fs_old_dsize * ufs_sb.fs_fsize).AppendLine(); sbInformation.AppendFormat("{0} cylinder groups in volume", ufs_sb.fs_ncg).AppendLine(); @@ -408,7 +408,7 @@ namespace DiscImageChef.Filesystems sbInformation.AppendFormat("{0} directories", ufs_sb.fs_old_cstotal.cs_ndir).AppendLine(); sbInformation.AppendFormat("{0} free blocks ({1} bytes)", ufs_sb.fs_old_cstotal.cs_nbfree, (long)ufs_sb.fs_old_cstotal.cs_nbfree * ufs_sb.fs_fsize).AppendLine(); - XmlFsType.FreeClusters = ufs_sb.fs_old_cstotal.cs_nbfree; + XmlFsType.FreeClusters = (ulong)ufs_sb.fs_old_cstotal.cs_nbfree; XmlFsType.FreeClustersSpecified = true; sbInformation.AppendFormat("{0} free inodes", ufs_sb.fs_old_cstotal.cs_nifree).AppendLine(); sbInformation.AppendFormat("{0} free frags", ufs_sb.fs_old_cstotal.cs_nffree).AppendLine(); @@ -439,7 +439,7 @@ namespace DiscImageChef.Filesystems sbInformation.AppendFormat("{0} directories", ufs_sb.fs_cstotal.cs_ndir).AppendLine(); sbInformation.AppendFormat("{0} free blocks ({1} bytes)", ufs_sb.fs_cstotal.cs_nbfree, ufs_sb.fs_cstotal.cs_nbfree * ufs_sb.fs_fsize).AppendLine(); - XmlFsType.FreeClusters = ufs_sb.fs_cstotal.cs_nbfree; + XmlFsType.FreeClusters = (ulong)ufs_sb.fs_cstotal.cs_nbfree; XmlFsType.FreeClustersSpecified = true; sbInformation.AppendFormat("{0} free inodes", ufs_sb.fs_cstotal.cs_nifree).AppendLine(); sbInformation.AppendFormat("{0} free frags", ufs_sb.fs_cstotal.cs_nffree).AppendLine(); @@ -450,7 +450,7 @@ namespace DiscImageChef.Filesystems XmlFsType.ModificationDateSpecified = true; sbInformation.AppendFormat("{0} blocks ({1} bytes)", ufs_sb.fs_size, ufs_sb.fs_size * ufs_sb.fs_fsize) .AppendLine(); - XmlFsType.Clusters = ufs_sb.fs_size; + XmlFsType.Clusters = (ulong)ufs_sb.fs_size; sbInformation .AppendFormat("{0} data blocks ({1} bytes)", ufs_sb.fs_dsize, ufs_sb.fs_dsize * ufs_sb.fs_fsize) .AppendLine(); @@ -509,242 +509,242 @@ namespace DiscImageChef.Filesystems public long cs_numclusters; /// future expansion [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public long[] cs_spare; + public readonly long[] cs_spare; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct UFSSuperBlock { /// linked list of file systems - public uint fs_link; + public readonly uint fs_link; /// /// used for incore super blocks /// on Sun: uint fs_rolled; // logging only: fs fully rolled /// - public uint fs_rlink; + public readonly uint fs_rlink; /// addr of super-block in filesys - public int fs_sblkno; + public readonly int fs_sblkno; /// offset of cyl-block in filesys - public int fs_cblkno; + public readonly int fs_cblkno; /// offset of inode-blocks in filesys - public int fs_iblkno; + public readonly int fs_iblkno; /// offset of first data after cg - public int fs_dblkno; + public readonly int fs_dblkno; /// cylinder group offset in cylinder - public int fs_old_cgoffset; + public readonly int fs_old_cgoffset; /// used to calc mod fs_ntrak - public int fs_old_cgmask; + public readonly int fs_old_cgmask; /// last time written - public int fs_old_time; + public readonly int fs_old_time; /// number of blocks in fs - public int fs_old_size; + public readonly int fs_old_size; /// number of data blocks in fs - public int fs_old_dsize; + public readonly int fs_old_dsize; /// number of cylinder groups - public int fs_ncg; + public readonly int fs_ncg; /// size of basic blocks in fs - public int fs_bsize; + public readonly int fs_bsize; /// size of frag blocks in fs - public int fs_fsize; + public readonly int fs_fsize; /// number of frags in a block in fs - public int fs_frag; + public readonly int fs_frag; /* these are configuration parameters */ /// minimum percentage of free blocks - public int fs_minfree; + public readonly int fs_minfree; /// num of ms for optimal next block - public int fs_old_rotdelay; + public readonly int fs_old_rotdelay; /// disk revolutions per second - public int fs_old_rps; + public readonly int fs_old_rps; /* these fields can be computed from the others */ /// ``blkoff'' calc of blk offsets - public int fs_bmask; + public readonly int fs_bmask; /// ``fragoff'' calc of frag offsets - public int fs_fmask; + public readonly int fs_fmask; /// ``lblkno'' calc of logical blkno - public int fs_bshift; + public readonly int fs_bshift; /// ``numfrags'' calc number of frags - public int fs_fshift; + public readonly int fs_fshift; /* these are configuration parameters */ /// max number of contiguous blks - public int fs_maxcontig; + public readonly int fs_maxcontig; /// max number of blks per cyl group - public int fs_maxbpg; + public readonly int fs_maxbpg; /* these fields can be computed from the others */ /// block to frag shift - public int fs_fragshift; + public readonly int fs_fragshift; /// fsbtodb and dbtofsb shift constant - public int fs_fsbtodb; + public readonly int fs_fsbtodb; /// actual size of super block - public int fs_sbsize; + public readonly int fs_sbsize; /// csum block offset - public int fs_csmask; + public readonly int fs_csmask; /// csum block number - public int fs_csshift; + public readonly int fs_csshift; /// value of NINDIR - public int fs_nindir; + public readonly int fs_nindir; /// value of INOPB - public uint fs_inopb; + public readonly uint fs_inopb; /// value of NSPF - public int fs_old_nspf; + public readonly int fs_old_nspf; /* yet another configuration parameter */ /// /// optimization preference, see below /// On SVR: int fs_state; // file system state /// - public int fs_optim; + public readonly int fs_optim; /// # sectors/track including spares - public int fs_old_npsect; + public readonly int fs_old_npsect; /// hardware sector interleave - public int fs_old_interleave; + public readonly int fs_old_interleave; /// /// sector 0 skew, per track /// On A/UX: int fs_state; // file system state /// - public int fs_old_trackskew; + public readonly int fs_old_trackskew; /// /// unique filesystem id /// On old: int fs_headswitch; // head switch time, usec /// - public int fs_id_1; + public readonly int fs_id_1; /// /// unique filesystem id /// On old: int fs_trkseek; // track-to-track seek, usec /// - public int fs_id_2; + public readonly int fs_id_2; /* sizes determined by number of cylinder groups and their sizes */ /// blk addr of cyl grp summary area - public int fs_old_csaddr; + public readonly int fs_old_csaddr; /// size of cyl grp summary area - public int fs_cssize; + public readonly int fs_cssize; /// cylinder group size - public int fs_cgsize; + public readonly int fs_cgsize; /* these fields are derived from the hardware */ /// tracks per cylinder - public int fs_old_ntrak; + public readonly int fs_old_ntrak; /// sectors per track - public int fs_old_nsect; + public readonly int fs_old_nsect; /// sectors per cylinder - public int fs_old_spc; + public readonly int fs_old_spc; /* this comes from the disk driver partitioning */ /// cylinders in filesystem - public int fs_old_ncyl; + public readonly int fs_old_ncyl; /* these fields can be computed from the others */ /// cylinders per group - public int fs_old_cpg; + public readonly int fs_old_cpg; /// inodes per group - public int fs_ipg; + public readonly int fs_ipg; /// blocks per group * fs_frag - public int fs_fpg; + public readonly int fs_fpg; /* this data must be re-computed after crashes */ /// cylinder summary information public csum fs_old_cstotal; /* these fields are cleared at mount time */ /// super block modified flag - public sbyte fs_fmod; + public readonly sbyte fs_fmod; /// filesystem is clean flag - public sbyte fs_clean; + public readonly sbyte fs_clean; /// mounted read-only flag - public sbyte fs_ronly; + public readonly sbyte fs_ronly; /// old FS_ flags - public sbyte fs_old_flags; + public readonly sbyte fs_old_flags; /// name mounted on [MarshalAs(UnmanagedType.ByValArray, SizeConst = 468)] - public byte[] fs_fsmnt; + public readonly byte[] fs_fsmnt; /// volume name [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] fs_volname; + public readonly byte[] fs_volname; /// system-wide uid - public ulong fs_swuid; + public readonly ulong fs_swuid; /// due to alignment of fs_swuid - public int fs_pad; + public readonly int fs_pad; /* these fields retain the current block allocation info */ /// last cg searched - public int fs_cgrotor; + public readonly int fs_cgrotor; /// padding; was list of fs_cs buffers [MarshalAs(UnmanagedType.ByValArray, SizeConst = 28)] - public uint[] fs_ocsp; + public readonly uint[] fs_ocsp; /// (u) # of contig. allocated dirs - public uint fs_contigdirs; + public readonly uint fs_contigdirs; /// (u) cg summary info buffer - public uint fs_csp; + public readonly uint fs_csp; /// (u) max cluster in each cyl group - public uint fs_maxcluster; + public readonly uint fs_maxcluster; /// (u) used by snapshots to track fs - public uint fs_active; + public readonly uint fs_active; /// cyl per cycle in postbl - public int fs_old_cpc; + public readonly int fs_old_cpc; /// maximum blocking factor permitted - public int fs_maxbsize; + public readonly int fs_maxbsize; /// number of unreferenced inodes - public long fs_unrefs; + public readonly long fs_unrefs; /// size of underlying GEOM provider - public long fs_providersize; + public readonly long fs_providersize; /// size of area reserved for metadata - public long fs_metaspace; + public readonly long fs_metaspace; /// old rotation block list head [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] - public long[] fs_sparecon64; + public readonly long[] fs_sparecon64; /// byte offset of standard superblock - public long fs_sblockloc; + public readonly long fs_sblockloc; /// (u) cylinder summary information public csum_total fs_cstotal; /// last time written - public long fs_time; + public readonly long fs_time; /// number of blocks in fs - public long fs_size; + public readonly long fs_size; /// number of data blocks in fs - public long fs_dsize; + public readonly long fs_dsize; /// blk addr of cyl grp summary area - public long fs_csaddr; + public readonly long fs_csaddr; /// (u) blocks being freed - public long fs_pendingblocks; + public readonly long fs_pendingblocks; /// (u) inodes being freed - public uint fs_pendinginodes; + public readonly uint fs_pendinginodes; /// list of snapshot inode numbers [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] - public uint[] fs_snapinum; + public readonly uint[] fs_snapinum; /// expected average file size - public uint fs_avgfilesize; + public readonly uint fs_avgfilesize; /// expected # of files per directory - public uint fs_avgfpdir; + public readonly uint fs_avgfpdir; /// save real cg size to use fs_bsize - public int fs_save_cgsize; + public readonly int fs_save_cgsize; /// Last mount or fsck time. - public long fs_mtime; + public readonly long fs_mtime; /// SUJ free list - public int fs_sujfree; + public readonly int fs_sujfree; /// reserved for future constants [MarshalAs(UnmanagedType.ByValArray, SizeConst = 23)] - public int[] fs_sparecon32; + public readonly int[] fs_sparecon32; /// see FS_ flags below - public int fs_flags; + public readonly int fs_flags; /// size of cluster summary array - public int fs_contigsumsize; + public readonly int fs_contigsumsize; /// max length of an internal symlink - public int fs_maxsymlinklen; + public readonly int fs_maxsymlinklen; /// format of on-disk inodes - public int fs_old_inodefmt; + public readonly int fs_old_inodefmt; /// maximum representable file size - public ulong fs_maxfilesize; + public readonly ulong fs_maxfilesize; /// ~fs_bmask for use with 64-bit size - public long fs_qbmask; + public readonly long fs_qbmask; /// ~fs_fmask for use with 64-bit size - public long fs_qfmask; + public readonly long fs_qfmask; /// validate fs_clean field - public int fs_state; + public readonly int fs_state; /// format of positional layout tables - public int fs_old_postblformat; + public readonly int fs_old_postblformat; /// number of rotational positions - public int fs_old_nrpos; + public readonly int fs_old_nrpos; /// (short) rotation block list head - public int fs_old_postbloff; + public readonly int fs_old_postbloff; /// (uchar_t) blocks for each rotation - public int fs_old_rotbloff; + public readonly int fs_old_rotbloff; /// magic number - public uint fs_magic; + public readonly uint fs_magic; /// list of blocks for each rotation [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] - public byte[] fs_rotbl; + public readonly byte[] fs_rotbl; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/HAMMER.cs b/DiscImageChef.Filesystems/HAMMER.cs index 3d23299f1..2ed1e827d 100644 --- a/DiscImageChef.Filesystems/HAMMER.cs +++ b/DiscImageChef.Filesystems/HAMMER.cs @@ -111,7 +111,7 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Clusters = (long)(partition.Size / HAMMER_BIGBLOCK_SIZE), + Clusters = partition.Size / HAMMER_BIGBLOCK_SIZE, ClusterSize = HAMMER_BIGBLOCK_SIZE, Dirty = false, Type = "HAMMER", @@ -127,10 +127,10 @@ namespace DiscImageChef.Filesystems hammerSb.vol0_stat_freebigblocks * HAMMER_BIGBLOCK_SIZE).AppendLine(); sb.AppendFormat("Filesystem has {0} inode used", hammerSb.vol0_stat_inodes).AppendLine(); - XmlFsType.Clusters = hammerSb.vol0_stat_bigblocks; - XmlFsType.FreeClusters = hammerSb.vol0_stat_freebigblocks; + XmlFsType.Clusters = (ulong)hammerSb.vol0_stat_bigblocks; + XmlFsType.FreeClusters = (ulong)hammerSb.vol0_stat_freebigblocks; XmlFsType.FreeClustersSpecified = true; - XmlFsType.Files = hammerSb.vol0_stat_inodes; + XmlFsType.Files = (ulong)hammerSb.vol0_stat_inodes; XmlFsType.FilesSpecified = true; } // 0 ? @@ -147,43 +147,43 @@ namespace DiscImageChef.Filesystems struct HammerSuperBlock { /// for a valid header - public ulong vol_signature; + public readonly ulong vol_signature; /* These are relative to block device offset, not zone offsets. */ /// offset of boot area - public long vol_bot_beg; + public readonly long vol_bot_beg; /// offset of memory log - public long vol_mem_beg; + public readonly long vol_mem_beg; /// offset of the first buffer in volume - public long vol_buf_beg; + public readonly long vol_buf_beg; /// offset of volume EOF (on buffer boundary) - public long vol_buf_end; - public long vol_reserved01; + public readonly long vol_buf_end; + public readonly long vol_reserved01; /// identify filesystem - public Guid vol_fsid; + public readonly Guid vol_fsid; /// identify filesystem type - public Guid vol_fstype; + public readonly Guid vol_fstype; /// filesystem label [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] - public byte[] vol_label; + public readonly byte[] vol_label; /// volume number within filesystem - public int vol_no; + public readonly int vol_no; /// number of volumes making up filesystem - public int vol_count; + public readonly int vol_count; /// version control information - public uint vol_version; + public readonly uint vol_version; /// header crc - public hammer_crc_t vol_crc; + public readonly hammer_crc_t vol_crc; /// volume flags - public uint vol_flags; + public readonly uint vol_flags; /// the root volume number (must be 0) - public uint vol_rootvol; + public readonly uint vol_rootvol; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public uint[] vol_reserved; + public readonly uint[] vol_reserved; /* * These fields are initialized and space is reserved in every @@ -193,29 +193,29 @@ namespace DiscImageChef.Filesystems * by newfs_hammer(8). */ /// total big-blocks when fs is empty - public long vol0_stat_bigblocks; + public readonly long vol0_stat_bigblocks; /// number of free big-blocks - public long vol0_stat_freebigblocks; - public long vol0_reserved01; + public readonly long vol0_stat_freebigblocks; + public readonly long vol0_reserved01; /// for statfs only - public long vol0_stat_inodes; - public long vol0_reserved02; + public readonly long vol0_stat_inodes; + public readonly long vol0_reserved02; /// B-Tree root offset in zone-8 - public hammer_off_t vol0_btree_root; + public readonly hammer_off_t vol0_btree_root; /// highest partially synchronized TID - public hammer_tid_t vol0_next_tid; - public hammer_off_t vol0_reserved03; + public readonly hammer_tid_t vol0_next_tid; + public readonly hammer_off_t vol0_reserved03; /// /// Blockmaps for zones. Not all zones use a blockmap. Note that the entire root blockmap is cached in the /// hammer_mount structure. /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public HammerBlockMap[] vol0_blockmap; + public readonly HammerBlockMap[] vol0_blockmap; /// Array of zone-2 addresses for undo FIFO. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public hammer_off_t[] vol0_undo_array; + public readonly hammer_off_t[] vol0_undo_array; } [SuppressMessage("ReSharper", "InconsistentNaming")] diff --git a/DiscImageChef.Filesystems/HPOFS.cs b/DiscImageChef.Filesystems/HPOFS.cs index 971ddcf2e..f59fb8162 100644 --- a/DiscImageChef.Filesystems/HPOFS.cs +++ b/DiscImageChef.Filesystems/HPOFS.cs @@ -186,7 +186,7 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { Clusters = mib.sectors / bpb.spc, - ClusterSize = bpb.bps * bpb.spc, + ClusterSize = (uint)(bpb.bps * bpb.spc), CreationDate = DateHandlers.DosToDateTime(mib.creationDate, mib.creationTime), CreationDateSpecified = true, DataPreparerIdentifier = StringHandlers.SpacePaddedToString(vib.owner, Encoding), @@ -207,57 +207,57 @@ namespace DiscImageChef.Filesystems { /// 0x000, Jump to boot code [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] jump; + public readonly byte[] jump; /// 0x003, OEM Name, 8 bytes, space-padded [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] oem_name; + public readonly byte[] oem_name; /// 0x00B, Bytes per sector - public ushort bps; + public readonly ushort bps; /// 0x00D, Sectors per cluster - public byte spc; + public readonly byte spc; /// 0x00E, Reserved sectors between BPB and... does it have sense in HPFS? - public ushort rsectors; + public readonly ushort rsectors; /// 0x010, Number of FATs... seriously? - public byte fats_no; + public readonly byte fats_no; /// 0x011, Number of entries on root directory... ok - public ushort root_ent; + public readonly ushort root_ent; /// 0x013, Sectors in volume... doubt it - public ushort sectors; + public readonly ushort sectors; /// 0x015, Media descriptor - public byte media; + public readonly byte media; /// 0x016, Sectors per FAT... again - public ushort spfat; + public readonly ushort spfat; /// 0x018, Sectors per track... you're kidding - public ushort sptrk; + public readonly ushort sptrk; /// 0x01A, Heads... stop! - public ushort heads; + public readonly ushort heads; /// 0x01C, Hidden sectors before BPB - public uint hsectors; + public readonly uint hsectors; /// 0x024, Sectors in volume if > 65535... - public uint big_sectors; + public readonly uint big_sectors; /// 0x028, Drive number - public byte drive_no; + public readonly byte drive_no; /// 0x029, Volume flags? - public byte nt_flags; + public readonly byte nt_flags; /// 0x02A, EPB signature, 0x29 - public byte signature; + public readonly byte signature; /// 0x02B, Volume serial number - public uint serial_no; + public readonly uint serial_no; /// 0x02F, Volume label, 11 bytes, space-padded [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] - public byte[] volume_label; + public readonly byte[] volume_label; /// 0x03A, Filesystem type, 8 bytes, space-padded ("HPFS ") [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] fs_type; + public readonly byte[] fs_type; /// Boot code. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 442)] - public byte[] boot_code; + public readonly byte[] boot_code; /// 0x1F8, Unknown - public uint unknown; + public readonly uint unknown; /// 0x1FC, Unknown - public ushort unknown2; + public readonly ushort unknown2; /// 0x1FE, 0xAA55 - public ushort signature2; + public readonly ushort signature2; } /// @@ -268,50 +268,50 @@ namespace DiscImageChef.Filesystems { /// Block identifier "MEDINFO " [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] blockId; + public readonly byte[] blockId; /// Volume label [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] volumeLabel; + public readonly byte[] volumeLabel; /// Volume comment [MarshalAs(UnmanagedType.ByValArray, SizeConst = 160)] - public byte[] comment; + public readonly byte[] comment; /// Volume serial number - public uint serial; + public readonly uint serial; /// Volume creation date, DOS format - public ushort creationDate; + public readonly ushort creationDate; /// Volume creation time, DOS format - public ushort creationTime; + public readonly ushort creationTime; /// /// Codepage type: 1 ASCII, 2 EBCDIC /// - public ushort codepageType; + public readonly ushort codepageType; /// Codepage - public ushort codepage; + public readonly ushort codepage; /// RPS level - public uint rps; + public readonly uint rps; /// Coincides with bytes per sector, and bytes per cluster, need more media - public ushort bps; + public readonly ushort bps; /// Coincides with bytes per sector, and bytes per cluster, need more media - public ushort bpc; + public readonly ushort bpc; /// Unknown, empty - public uint unknown2; + public readonly uint unknown2; /// Sectors (or clusters) - public uint sectors; + public readonly uint sectors; /// Unknown, coincides with bps but changing it makes nothing - public uint unknown3; + public readonly uint unknown3; /// Empty? - public ulong unknown4; + public readonly ulong unknown4; /// Format major version - public ushort major; + public readonly ushort major; /// Format minor version - public ushort minor; + public readonly ushort minor; /// Empty? - public uint unknown5; + public readonly uint unknown5; /// Unknown, non-empty - public uint unknown6; + public readonly uint unknown6; /// Empty [MarshalAs(UnmanagedType.ByValArray, SizeConst = 260)] - public byte[] filler; + public readonly byte[] filler; } /// @@ -322,32 +322,32 @@ namespace DiscImageChef.Filesystems { /// Block identifier "VOLINFO " [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] blockId; + public readonly byte[] blockId; /// Unknown - public uint unknown; + public readonly uint unknown; /// Unknown - public uint unknown2; + public readonly uint unknown2; /// Unknown [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] - public byte[] unknown3; + public readonly byte[] unknown3; /// Unknown, space-padded string [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] unknown4; + public readonly byte[] unknown4; /// Owner, space-padded string [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] owner; + public readonly byte[] owner; /// Unknown, space-padded string [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] unknown5; + public readonly byte[] unknown5; /// Unknown, empty? - public uint unknown6; + public readonly uint unknown6; /// Maximum percent full - public ushort percentFull; + public readonly ushort percentFull; /// Unknown, empty? - public ushort unknown7; + public readonly ushort unknown7; /// Empty [MarshalAs(UnmanagedType.ByValArray, SizeConst = 384)] - public byte[] filler; + public readonly byte[] filler; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/JFS.cs b/DiscImageChef.Filesystems/JFS.cs index 5b5c47747..d887c1f35 100644 --- a/DiscImageChef.Filesystems/JFS.cs +++ b/DiscImageChef.Filesystems/JFS.cs @@ -118,8 +118,8 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { Type = "JFS filesystem", - Clusters = (long)jfsSb.s_size, - ClusterSize = (int)jfsSb.s_bsize, + Clusters = jfsSb.s_size, + ClusterSize = jfsSb.s_bsize, Bootable = true, VolumeName = Encoding.GetString(jfsSb.s_version == 1 ? jfsSb.s_fpack : jfsSb.s_label), VolumeSerial = $"{jfsSb.s_uuid}", @@ -176,51 +176,51 @@ namespace DiscImageChef.Filesystems /// /// Leftmost 24 bits are extent length, rest 8 bits are most significant for /// - public uint len_addr; - public uint addr2; + public readonly uint len_addr; + public readonly uint addr2; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct JfsTimeStruct { - public uint tv_sec; - public uint tv_nsec; + public readonly uint tv_sec; + public readonly uint tv_nsec; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct JfsSuperBlock { - public uint s_magic; - public uint s_version; - public ulong s_size; - public uint s_bsize; - public ushort s_l2bsize; - public ushort s_l2bfactor; - public uint s_pbsize; - public ushort s_l1pbsize; - public ushort pad; - public uint s_agsize; - public JfsFlags s_flags; - public JfsState s_state; - public uint s_compress; - public JfsExtent s_ait2; - public JfsExtent s_aim2; - public uint s_logdev; - public uint s_logserial; - public JfsExtent s_logpxd; - public JfsExtent s_fsckpxd; - public JfsTimeStruct s_time; - public uint s_fsckloglen; - public sbyte s_fscklog; + public readonly uint s_magic; + public readonly uint s_version; + public readonly ulong s_size; + public readonly uint s_bsize; + public readonly ushort s_l2bsize; + public readonly ushort s_l2bfactor; + public readonly uint s_pbsize; + public readonly ushort s_l1pbsize; + public readonly ushort pad; + public readonly uint s_agsize; + public readonly JfsFlags s_flags; + public readonly JfsState s_state; + public readonly uint s_compress; + public readonly JfsExtent s_ait2; + public readonly JfsExtent s_aim2; + public readonly uint s_logdev; + public readonly uint s_logserial; + public readonly JfsExtent s_logpxd; + public readonly JfsExtent s_fsckpxd; + public readonly JfsTimeStruct s_time; + public readonly uint s_fsckloglen; + public readonly sbyte s_fscklog; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] - public byte[] s_fpack; - public ulong s_xsize; - public JfsExtent s_xfsckpxd; - public JfsExtent s_xlogpxd; - public Guid s_uuid; + public readonly byte[] s_fpack; + public readonly ulong s_xsize; + public readonly JfsExtent s_xfsckpxd; + public readonly JfsExtent s_xlogpxd; + public readonly Guid s_uuid; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] s_label; - public Guid s_loguuid; + public readonly byte[] s_label; + public readonly Guid s_loguuid; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/LIF.cs b/DiscImageChef.Filesystems/LIF.cs index d3abfe668..f25f1452e 100644 --- a/DiscImageChef.Filesystems/LIF.cs +++ b/DiscImageChef.Filesystems/LIF.cs @@ -96,7 +96,7 @@ namespace DiscImageChef.Filesystems { Type = "HP Logical Interchange Format", ClusterSize = 256, - Clusters = (long)(partition.Size / 256), + Clusters = partition.Size / 256, CreationDate = DateHandlers.LifToDateTime(lifSb.creationDate), CreationDateSpecified = true, VolumeName = StringHandlers.CToString(lifSb.volumeLabel, Encoding) @@ -106,20 +106,20 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct LifSystemBlock { - public ushort magic; + public readonly ushort magic; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public byte[] volumeLabel; - public uint directoryStart; - public ushort lifId; - public ushort unused; - public uint directorySize; - public ushort lifVersion; - public ushort unused2; - public uint tracks; - public uint heads; - public uint sectors; + public readonly byte[] volumeLabel; + public readonly uint directoryStart; + public readonly ushort lifId; + public readonly ushort unused; + public readonly uint directorySize; + public readonly ushort lifVersion; + public readonly ushort unused2; + public readonly uint tracks; + public readonly uint heads; + public readonly uint sectors; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public byte[] creationDate; + public readonly byte[] creationDate; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/LisaFS/Info.cs b/DiscImageChef.Filesystems/LisaFS/Info.cs index b33a8f8fe..08fc74517 100644 --- a/DiscImageChef.Filesystems/LisaFS/Info.cs +++ b/DiscImageChef.Filesystems/LisaFS/Info.cs @@ -360,7 +360,7 @@ namespace DiscImageChef.Filesystems.LisaFS } XmlFsType.Clusters = infoMddf.vol_size; - XmlFsType.ClusterSize = infoMddf.clustersize * infoMddf.datasize; + XmlFsType.ClusterSize = (uint)(infoMddf.clustersize * infoMddf.datasize); if(DateTime.Compare(infoMddf.dtvc, DateHandlers.LisaToDateTime(0)) > 0) { XmlFsType.CreationDate = infoMddf.dtvc; diff --git a/DiscImageChef.Filesystems/LisaFS/Super.cs b/DiscImageChef.Filesystems/LisaFS/Super.cs index 3a86304d1..861ea14da 100644 --- a/DiscImageChef.Filesystems/LisaFS/Super.cs +++ b/DiscImageChef.Filesystems/LisaFS/Super.cs @@ -296,7 +296,7 @@ namespace DiscImageChef.Filesystems.LisaFS } XmlFsType.Clusters = mddf.vol_size; - XmlFsType.ClusterSize = mddf.clustersize * mddf.datasize; + XmlFsType.ClusterSize = (uint)(mddf.clustersize * mddf.datasize); if(DateTime.Compare(mddf.dtvc, DateHandlers.LisaToDateTime(0)) > 0) { XmlFsType.CreationDate = mddf.dtvc; diff --git a/DiscImageChef.Filesystems/Locus.cs b/DiscImageChef.Filesystems/Locus.cs index 929560478..896644165 100644 --- a/DiscImageChef.Filesystems/Locus.cs +++ b/DiscImageChef.Filesystems/Locus.cs @@ -197,15 +197,15 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { Type = "Locus filesystem", - ClusterSize = blockSize, - Clusters = locusSb.s_fsize, + ClusterSize = (uint)blockSize, + Clusters = (ulong)locusSb.s_fsize, // Sometimes it uses one, or the other. Use the bigger VolumeName = string.IsNullOrEmpty(s_fsmnt) ? s_fpack : s_fsmnt, ModificationDate = DateHandlers.UnixToDateTime(locusSb.s_time), ModificationDateSpecified = true, Dirty = !locusSb.s_flags.HasFlag(LocusFlags.SB_CLEAN) || locusSb.s_flags.HasFlag(LocusFlags.SB_DIRTY), - FreeClusters = locusSb.s_tfree, + FreeClusters = (ulong)locusSb.s_tfree, FreeClustersSpecified = true }; } @@ -215,54 +215,54 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct Locus_Superblock { - public uint s_magic; /* identifies this as a locus filesystem */ + public readonly uint s_magic; /* identifies this as a locus filesystem */ /* defined as a constant below */ - public gfs_t s_gfs; /* global filesystem number */ - public daddr_t s_fsize; /* size in blocks of entire volume */ + public readonly gfs_t s_gfs; /* global filesystem number */ + public readonly daddr_t s_fsize; /* size in blocks of entire volume */ /* several ints for replicated filsystems */ - public commitcnt_t s_lwm; /* all prior commits propagated */ - public commitcnt_t s_hwm; /* highest commit propagated */ + public readonly commitcnt_t s_lwm; /* all prior commits propagated */ + public readonly commitcnt_t s_hwm; /* highest commit propagated */ /* oldest committed version in the list. * llst mod NCMTLST is the offset of commit #llst in the list, * which wraps around from there. */ - public commitcnt_t s_llst; - public fstore_t s_fstore; /* filesystem storage bit mask; if the + public readonly commitcnt_t s_llst; + public readonly fstore_t s_fstore; /* filesystem storage bit mask; if the filsys is replicated and this is not a primary or backbone copy, this bit mask determines which files are stored */ - public time_t s_time; /* last super block update */ - public daddr_t s_tfree; /* total free blocks*/ + public readonly time_t s_time; /* last super block update */ + public readonly daddr_t s_tfree; /* total free blocks*/ - public ino_t s_isize; /* size in blocks of i-list */ - public short s_nfree; /* number of addresses in s_free */ - public LocusFlags s_flags; /* filsys flags, defined below */ - public ino_t s_tinode; /* total free inodes */ - public ino_t s_lasti; /* start place for circular search */ - public ino_t s_nbehind; /* est # free inodes before s_lasti */ - public pckno_t s_gfspack; /* global filesystem pack number */ - public short s_ninode; /* number of i-nodes in s_inode */ + public readonly ino_t s_isize; /* size in blocks of i-list */ + public readonly short s_nfree; /* number of addresses in s_free */ + public LocusFlags s_flags; /* filsys flags, defined below */ + public readonly ino_t s_tinode; /* total free inodes */ + public readonly ino_t s_lasti; /* start place for circular search */ + public readonly ino_t s_nbehind; /* est # free inodes before s_lasti */ + public readonly pckno_t s_gfspack; /* global filesystem pack number */ + public readonly short s_ninode; /* number of i-nodes in s_inode */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public short[] s_dinfo; /* interleave stuff */ + public readonly short[] s_dinfo; /* interleave stuff */ //#define s_m s_dinfo[0] //#define s_skip s_dinfo[0] /* AIX defines */ //#define s_n s_dinfo[1] //#define s_cyl s_dinfo[1] /* AIX defines */ - public byte s_flock; /* lock during free list manipulation */ - public byte s_ilock; /* lock during i-list manipulation */ - public byte s_fmod; /* super block modified flag */ - public LocusVersion s_version; /* version of the data format in fs. */ + public readonly byte s_flock; /* lock during free list manipulation */ + public readonly byte s_ilock; /* lock during i-list manipulation */ + public readonly byte s_fmod; /* super block modified flag */ + public readonly LocusVersion s_version; /* version of the data format in fs. */ /* defined below. */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] s_fsmnt; /* name of this file system */ + public readonly byte[] s_fsmnt; /* name of this file system */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] s_fpack; /* name of this physical volume */ + public readonly byte[] s_fpack; /* name of this physical volume */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = NICINOD)] - public ino_t[] s_inode; /* free i-node list */ + public readonly ino_t[] s_inode; /* free i-node list */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = NICFREE)] - public daddr_t[] su_free; /* free block list for non-replicated filsys */ - public byte s_byteorder; /* byte order of integers */ + public readonly daddr_t[] su_free; /* free block list for non-replicated filsys */ + public readonly byte s_byteorder; /* byte order of integers */ } [SuppressMessage("ReSharper", "InconsistentNaming")] @@ -270,54 +270,54 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct Locus_OldSuperblock { - public uint s_magic; /* identifies this as a locus filesystem */ + public readonly uint s_magic; /* identifies this as a locus filesystem */ /* defined as a constant below */ - public gfs_t s_gfs; /* global filesystem number */ - public daddr_t s_fsize; /* size in blocks of entire volume */ + public readonly gfs_t s_gfs; /* global filesystem number */ + public readonly daddr_t s_fsize; /* size in blocks of entire volume */ /* several ints for replicated filsystems */ - public commitcnt_t s_lwm; /* all prior commits propagated */ - public commitcnt_t s_hwm; /* highest commit propagated */ + public readonly commitcnt_t s_lwm; /* all prior commits propagated */ + public readonly commitcnt_t s_hwm; /* highest commit propagated */ /* oldest committed version in the list. * llst mod NCMTLST is the offset of commit #llst in the list, * which wraps around from there. */ - public commitcnt_t s_llst; - public fstore_t s_fstore; /* filesystem storage bit mask; if the + public readonly commitcnt_t s_llst; + public readonly fstore_t s_fstore; /* filesystem storage bit mask; if the filsys is replicated and this is not a primary or backbone copy, this bit mask determines which files are stored */ - public time_t s_time; /* last super block update */ - public daddr_t s_tfree; /* total free blocks*/ + public readonly time_t s_time; /* last super block update */ + public readonly daddr_t s_tfree; /* total free blocks*/ - public ino_t s_isize; /* size in blocks of i-list */ - public short s_nfree; /* number of addresses in s_free */ - public LocusFlags s_flags; /* filsys flags, defined below */ - public ino_t s_tinode; /* total free inodes */ - public ino_t s_lasti; /* start place for circular search */ - public ino_t s_nbehind; /* est # free inodes before s_lasti */ - public pckno_t s_gfspack; /* global filesystem pack number */ - public short s_ninode; /* number of i-nodes in s_inode */ + public readonly ino_t s_isize; /* size in blocks of i-list */ + public readonly short s_nfree; /* number of addresses in s_free */ + public readonly LocusFlags s_flags; /* filsys flags, defined below */ + public readonly ino_t s_tinode; /* total free inodes */ + public readonly ino_t s_lasti; /* start place for circular search */ + public readonly ino_t s_nbehind; /* est # free inodes before s_lasti */ + public readonly pckno_t s_gfspack; /* global filesystem pack number */ + public readonly short s_ninode; /* number of i-nodes in s_inode */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public short[] s_dinfo; /* interleave stuff */ + public readonly short[] s_dinfo; /* interleave stuff */ //#define s_m s_dinfo[0] //#define s_skip s_dinfo[0] /* AIX defines */ //#define s_n s_dinfo[1] //#define s_cyl s_dinfo[1] /* AIX defines */ - public byte s_flock; /* lock during free list manipulation */ - public byte s_ilock; /* lock during i-list manipulation */ - public byte s_fmod; /* super block modified flag */ - public LocusVersion s_version; /* version of the data format in fs. */ + public readonly byte s_flock; /* lock during free list manipulation */ + public readonly byte s_ilock; /* lock during i-list manipulation */ + public readonly byte s_fmod; /* super block modified flag */ + public readonly LocusVersion s_version; /* version of the data format in fs. */ /* defined below. */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] s_fsmnt; /* name of this file system */ + public readonly byte[] s_fsmnt; /* name of this file system */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] s_fpack; /* name of this physical volume */ + public readonly byte[] s_fpack; /* name of this physical volume */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = OLDNICINOD)] - public ino_t[] s_inode; /* free i-node list */ + public readonly ino_t[] s_inode; /* free i-node list */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = OLDNICFREE)] - public daddr_t[] su_free; /* free block list for non-replicated filsys */ - public byte s_byteorder; /* byte order of integers */ + public readonly daddr_t[] su_free; /* free block list for non-replicated filsys */ + public readonly byte s_byteorder; /* byte order of integers */ } [SuppressMessage("ReSharper", "InconsistentNaming")] diff --git a/DiscImageChef.Filesystems/MicroDOS.cs b/DiscImageChef.Filesystems/MicroDOS.cs index d0739de16..20f7b301c 100644 --- a/DiscImageChef.Filesystems/MicroDOS.cs +++ b/DiscImageChef.Filesystems/MicroDOS.cs @@ -92,7 +92,7 @@ namespace DiscImageChef.Filesystems Clusters = block0.blocks, Files = block0.files, FilesSpecified = true, - FreeClusters = block0.blocks - block0.usedBlocks, + FreeClusters = (ulong)(block0.blocks - block0.usedBlocks), FreeClustersSpecified = true }; @@ -105,52 +105,52 @@ namespace DiscImageChef.Filesystems { /// BK starts booting here [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)] - public byte[] bootCode; + public readonly byte[] bootCode; /// Number of files in directory - public ushort files; + public readonly ushort files; /// Total number of blocks in files of the directory - public ushort usedBlocks; + public readonly ushort usedBlocks; /// Unknown [MarshalAs(UnmanagedType.ByValArray, SizeConst = 228)] - public byte[] unknown; + public readonly byte[] unknown; /// Ownership label (label that shows it belongs to Micro DOS format) - public ushort label; + public readonly ushort label; /// MK-DOS directory format label - public ushort mklabel; + public readonly ushort mklabel; /// Unknown [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50)] - public byte[] unknown2; + public readonly byte[] unknown2; /// /// Disk size in blocks (absolute value for the system unlike NORD, NORTON etc.) that /// doesn't use two fixed values 40 or 80 tracks, but i.e. if you drive works with 76 tracks /// this field will contain an appropriate number of blocks /// - public ushort blocks; + public readonly ushort blocks; /// Number of the first file's block. Value is changable - public ushort firstUsedBlock; + public readonly ushort firstUsedBlock; /// Unknown [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public byte[] unknown3; + public readonly byte[] unknown3; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct DirectoryEntry { /// File status - public byte status; + public readonly byte status; /// Directory number (0 - root) - public byte directory; + public readonly byte directory; /// File name 14. symbols in ASCII KOI8 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] filename; + public readonly byte[] filename; /// Block number - public ushort blockNo; + public readonly ushort blockNo; /// Length in blocks - public ushort blocks; + public readonly ushort blocks; /// Address - public ushort address; + public readonly ushort address; /// Length - public ushort length; + public readonly ushort length; } enum FileStatus : byte diff --git a/DiscImageChef.Filesystems/NILFS2.cs b/DiscImageChef.Filesystems/NILFS2.cs index cf210b7e3..1bd61618c 100644 --- a/DiscImageChef.Filesystems/NILFS2.cs +++ b/DiscImageChef.Filesystems/NILFS2.cs @@ -115,7 +115,7 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { Type = "NILFS2 filesystem", - ClusterSize = 1 << (int)(nilfsSb.log_block_size + 10), + ClusterSize = (uint)(1 << (int)(nilfsSb.log_block_size + 10)), VolumeName = StringHandlers.CToString(nilfsSb.volume_name, Encoding), VolumeSerial = nilfsSb.uuid.ToString(), CreationDate = DateHandlers.UnixUnsignedToDateTime(nilfsSb.ctime), @@ -124,7 +124,7 @@ namespace DiscImageChef.Filesystems ModificationDateSpecified = true }; if(nilfsSb.creator_os == 0) XmlFsType.SystemIdentifier = "Linux"; - XmlFsType.Clusters = (long)nilfsSb.dev_size / XmlFsType.ClusterSize; + XmlFsType.Clusters = nilfsSb.dev_size / XmlFsType.ClusterSize; } enum NILFS2_State : ushort @@ -137,48 +137,48 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct NILFS2_Superblock { - public uint rev_level; - public ushort minor_rev_level; - public ushort magic; - public ushort bytes; - public ushort flags; - public uint crc_seed; - public uint sum; - public uint log_block_size; - public ulong nsegments; - public ulong dev_size; - public ulong first_data_block; - public uint blocks_per_segment; - public uint r_segments_percentage; - public ulong last_cno; - public ulong last_pseg; - public ulong last_seq; - public ulong free_blocks_count; - public ulong ctime; - public ulong mtime; - public ulong wtime; - public ushort mnt_count; - public ushort max_mnt_count; - public NILFS2_State state; - public ushort errors; - public ulong lastcheck; - public uint checkinterval; - public uint creator_os; - public ushort def_resuid; - public ushort def_resgid; - public uint first_ino; - public ushort inode_size; - public ushort dat_entry_size; - public ushort checkpoint_size; - public ushort segment_usage_size; - public Guid uuid; + public readonly uint rev_level; + public readonly ushort minor_rev_level; + public readonly ushort magic; + public readonly ushort bytes; + public readonly ushort flags; + public readonly uint crc_seed; + public readonly uint sum; + public readonly uint log_block_size; + public readonly ulong nsegments; + public readonly ulong dev_size; + public readonly ulong first_data_block; + public readonly uint blocks_per_segment; + public readonly uint r_segments_percentage; + public readonly ulong last_cno; + public readonly ulong last_pseg; + public readonly ulong last_seq; + public readonly ulong free_blocks_count; + public readonly ulong ctime; + public readonly ulong mtime; + public readonly ulong wtime; + public readonly ushort mnt_count; + public readonly ushort max_mnt_count; + public readonly NILFS2_State state; + public readonly ushort errors; + public readonly ulong lastcheck; + public readonly uint checkinterval; + public readonly uint creator_os; + public readonly ushort def_resuid; + public readonly ushort def_resgid; + public readonly uint first_ino; + public readonly ushort inode_size; + public readonly ushort dat_entry_size; + public readonly ushort checkpoint_size; + public readonly ushort segment_usage_size; + public readonly Guid uuid; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 80)] - public byte[] volume_name; - public uint c_interval; - public uint c_block_max; - public ulong feature_compat; - public ulong feature_compat_ro; - public ulong feature_incompat; + public readonly byte[] volume_name; + public readonly uint c_interval; + public readonly uint c_block_max; + public readonly ulong feature_compat; + public readonly ulong feature_compat_ro; + public readonly ulong feature_incompat; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/NTFS.cs b/DiscImageChef.Filesystems/NTFS.cs index d0815c012..e20aead6a 100644 --- a/DiscImageChef.Filesystems/NTFS.cs +++ b/DiscImageChef.Filesystems/NTFS.cs @@ -127,8 +127,8 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("Boot code's SHA1: {0}", bootChk).AppendLine(); } - XmlFsType.ClusterSize = ntfsBb.spc * ntfsBb.bps; - XmlFsType.Clusters = ntfsBb.sectors / ntfsBb.spc; + XmlFsType.ClusterSize = (uint)(ntfsBb.spc * ntfsBb.bps); + XmlFsType.Clusters = (ulong)(ntfsBb.sectors / ntfsBb.spc); XmlFsType.VolumeSerial = $"{ntfsBb.serial_no:X16}"; XmlFsType.Type = "NTFS"; @@ -144,70 +144,70 @@ namespace DiscImageChef.Filesystems // Start of BIOS Parameter Block /// 0x000, Jump to boot code [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] jump; + public readonly byte[] jump; /// 0x003, OEM Name, 8 bytes, space-padded, must be "NTFS " [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] oem_name; + public readonly byte[] oem_name; /// 0x00B, Bytes per sector - public ushort bps; + public readonly ushort bps; /// 0x00D, Sectors per cluster - public byte spc; + public readonly byte spc; /// 0x00E, Reserved sectors, seems 0 - public ushort rsectors; + public readonly ushort rsectors; /// 0x010, Number of FATs... obviously, 0 - public byte fats_no; + public readonly byte fats_no; /// 0x011, Number of entries on root directory... 0 - public ushort root_ent; + public readonly ushort root_ent; /// 0x013, Sectors in volume... 0 - public ushort sml_sectors; + public readonly ushort sml_sectors; /// 0x015, Media descriptor - public byte media; + public readonly byte media; /// 0x016, Sectors per FAT... 0 - public ushort spfat; + public readonly ushort spfat; /// 0x018, Sectors per track, required to boot - public ushort sptrk; + public readonly ushort sptrk; /// 0x01A, Heads... required to boot - public ushort heads; + public readonly ushort heads; /// 0x01C, Hidden sectors before BPB - public uint hsectors; + public readonly uint hsectors; /// 0x020, Sectors in volume if > 65535... 0 - public uint big_sectors; + public readonly uint big_sectors; /// 0x024, Drive number - public byte drive_no; + public readonly byte drive_no; /// 0x025, 0 - public byte nt_flags; + public readonly byte nt_flags; /// 0x026, EPB signature, 0x80 - public byte signature1; + public readonly byte signature1; /// 0x027, Alignment - public byte dummy; + public readonly byte dummy; // End of BIOS Parameter Block // Start of NTFS real superblock /// 0x028, Sectors on volume - public long sectors; + public readonly long sectors; /// 0x030, LSN of $MFT - public long mft_lsn; + public readonly long mft_lsn; /// 0x038, LSN of $MFTMirror - public long mftmirror_lsn; + public readonly long mftmirror_lsn; /// 0x040, Clusters per MFT record - public sbyte mft_rc_clusters; + public readonly sbyte mft_rc_clusters; /// 0x041, Alignment - public byte dummy2; + public readonly byte dummy2; /// 0x042, Alignment - public ushort dummy3; + public readonly ushort dummy3; /// 0x044, Clusters per index block - public sbyte index_blk_cts; + public readonly sbyte index_blk_cts; /// 0x045, Alignment - public byte dummy4; + public readonly byte dummy4; /// 0x046, Alignment - public ushort dummy5; + public readonly ushort dummy5; /// 0x048, Volume serial number - public ulong serial_no; + public readonly ulong serial_no; /// Boot code. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 430)] - public byte[] boot_code; + public readonly byte[] boot_code; /// 0x1FE, 0xAA55 - public ushort signature2; + public readonly ushort signature2; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/Nintendo.cs b/DiscImageChef.Filesystems/Nintendo.cs index b23a2123f..ee0387b7e 100644 --- a/DiscImageChef.Filesystems/Nintendo.cs +++ b/DiscImageChef.Filesystems/Nintendo.cs @@ -292,7 +292,7 @@ namespace DiscImageChef.Filesystems information = sbInformation.ToString(); XmlFsType.Bootable = true; - XmlFsType.Clusters = (long)(imagePlugin.Info.Sectors * imagePlugin.Info.SectorSize / 2048); + XmlFsType.Clusters = imagePlugin.Info.Sectors * imagePlugin.Info.SectorSize / 2048; XmlFsType.ClusterSize = 2048; XmlFsType.Type = wii ? "Nintendo Wii filesystem" : "Nintendo Gamecube filesystem"; XmlFsType.VolumeName = fields.Title; diff --git a/DiscImageChef.Filesystems/ODS.cs b/DiscImageChef.Filesystems/ODS.cs index b668567b5..e0c2385b8 100644 --- a/DiscImageChef.Filesystems/ODS.cs +++ b/DiscImageChef.Filesystems/ODS.cs @@ -205,8 +205,8 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { Type = "FILES-11", - ClusterSize = homeblock.cluster * 512, - Clusters = (long)partition.Size / (homeblock.cluster * 512), + ClusterSize = (uint)(homeblock.cluster * 512), + Clusters = partition.Size / (ulong)(homeblock.cluster * 512), VolumeName = StringHandlers.SpacePaddedToString(homeblock.volname, Encoding), VolumeSerial = $"{homeblock.serialnum:X8}" }; @@ -229,104 +229,104 @@ namespace DiscImageChef.Filesystems struct OdsHomeBlock { /// 0x000, LBN of THIS home block - public uint homelbn; + public readonly uint homelbn; /// 0x004, LBN of the secondary home block - public uint alhomelbn; + public readonly uint alhomelbn; /// 0x008, LBN of backup INDEXF.SYS;1 - public uint altidxlbn; + public readonly uint altidxlbn; /// 0x00C, High byte contains filesystem version (1, 2 or 5), low byte contains revision (1) - public ushort struclev; + public readonly ushort struclev; /// 0x00E, Number of blocks each bit of the volume bitmap represents - public ushort cluster; + public readonly ushort cluster; /// 0x010, VBN of THIS home block - public ushort homevbn; + public readonly ushort homevbn; /// 0x012, VBN of the secondary home block - public ushort alhomevbn; + public readonly ushort alhomevbn; /// 0x014, VBN of backup INDEXF.SYS;1 - public ushort altidxvbn; + public readonly ushort altidxvbn; /// 0x016, VBN of the bitmap - public ushort ibmapvbn; + public readonly ushort ibmapvbn; /// 0x018, LBN of the bitmap - public uint ibmaplbn; + public readonly uint ibmaplbn; /// 0x01C, Max files on volume - public uint maxfiles; + public readonly uint maxfiles; /// 0x020, Bitmap size in sectors - public ushort ibmapsize; + public readonly ushort ibmapsize; /// 0x022, Reserved files, 5 at minimum - public ushort resfiles; + public readonly ushort resfiles; /// 0x024, Device type, ODS-2 defines it as always 0 - public ushort devtype; + public readonly ushort devtype; /// 0x026, Relative volume number (number of the volume in a set) - public ushort rvn; + public readonly ushort rvn; /// 0x028, Total number of volumes in the set this volume is - public ushort setcount; + public readonly ushort setcount; /// 0x02A, Flags - public ushort volchar; + public readonly ushort volchar; /// 0x02C, User ID of the volume owner - public uint volowner; + public readonly uint volowner; /// 0x030, Security mask (??) - public uint sec_mask; + public readonly uint sec_mask; /// 0x034, Volume permissions (system, owner, group and other) - public ushort protect; + public readonly ushort protect; /// 0x036, Default file protection, unsupported in ODS-2 - public ushort fileprot; + public readonly ushort fileprot; /// 0x038, Default file record protection - public ushort recprot; + public readonly ushort recprot; /// 0x03A, Checksum of all preceding entries - public ushort checksum1; + public readonly ushort checksum1; /// 0x03C, Creation date - public ulong credate; + public readonly ulong credate; /// 0x044, Window size (pointers for the window) - public byte window; + public readonly byte window; /// 0x045, Directories to be stored in cache - public byte lru_lim; + public readonly byte lru_lim; /// 0x046, Default allocation size in blocks - public ushort extend; + public readonly ushort extend; /// 0x048, Minimum file retention period - public ulong retainmin; + public readonly ulong retainmin; /// 0x050, Maximum file retention period - public ulong retainmax; + public readonly ulong retainmax; /// 0x058, Last modification date - public ulong revdate; + public readonly ulong revdate; /// 0x060, Minimum security class, 20 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] - public byte[] min_class; + public readonly byte[] min_class; /// 0x074, Maximum security class, 20 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] - public byte[] max_class; + public readonly byte[] max_class; /// 0x088, File lookup table FID - public ushort filetab_fid1; + public readonly ushort filetab_fid1; /// 0x08A, File lookup table FID - public ushort filetab_fid2; + public readonly ushort filetab_fid2; /// 0x08C, File lookup table FID - public ushort filetab_fid3; + public readonly ushort filetab_fid3; /// 0x08E, Lowest structure level on the volume - public ushort lowstruclev; + public readonly ushort lowstruclev; /// 0x090, Highest structure level on the volume - public ushort highstruclev; + public readonly ushort highstruclev; /// 0x092, Volume copy date (??) - public ulong copydate; + public readonly ulong copydate; /// 0x09A, 302 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 302)] - public byte[] reserved1; + public readonly byte[] reserved1; /// 0x1C8, Physical drive serial number - public uint serialnum; + public readonly uint serialnum; /// 0x1CC, Name of the volume set, 12 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] strucname; + public readonly byte[] strucname; /// 0x1D8, Volume label, 12 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] volname; + public readonly byte[] volname; /// 0x1E4, Name of the volume owner, 12 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] ownername; + public readonly byte[] ownername; /// 0x1F0, ODS-2 defines it as "DECFILE11B", 12 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] format; + public readonly byte[] format; /// 0x1FC, Reserved - public ushort reserved2; + public readonly ushort reserved2; /// 0x1FE, Checksum of preceding 255 words (16 bit units) - public ushort checksum2; + public readonly ushort checksum2; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/Opera.cs b/DiscImageChef.Filesystems/Opera.cs index 89afe9861..66840e2c0 100644 --- a/DiscImageChef.Filesystems/Opera.cs +++ b/DiscImageChef.Filesystems/Opera.cs @@ -123,8 +123,8 @@ namespace DiscImageChef.Filesystems { Type = "Opera", VolumeName = StringHandlers.CToString(sb.volume_label, Encoding), - ClusterSize = sb.block_size, - Clusters = sb.block_count + ClusterSize = (uint)sb.block_size, + Clusters = (ulong)sb.block_count }; } @@ -132,34 +132,34 @@ namespace DiscImageChef.Filesystems struct OperaSuperBlock { /// 0x000, Record type, must be 1 - public byte record_type; + public readonly byte record_type; /// 0x001, 5 bytes, "ZZZZZ" [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public byte[] sync_bytes; /// 0x006, Record version, must be 1 - public byte record_version; + public readonly byte record_version; /// 0x007, Volume flags - public byte volume_flags; + public readonly byte volume_flags; /// 0x008, 32 bytes, volume comment [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] volume_comment; + public readonly byte[] volume_comment; /// 0x028, 32 bytes, volume label [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] volume_label; + public readonly byte[] volume_label; /// 0x048, Volume ID - public int volume_id; + public readonly int volume_id; /// 0x04C, Block size in bytes - public int block_size; + public readonly int block_size; /// 0x050, Blocks in volume - public int block_count; + public readonly int block_count; /// 0x054, Root directory ID - public int root_dirid; + public readonly int root_dirid; /// 0x058, Root directory blocks - public int rootdir_blocks; + public readonly int rootdir_blocks; /// 0x05C, Root directory block size - public int rootdir_bsize; + public readonly int rootdir_bsize; /// 0x060, Last root directory copy - public int last_root_copy; + public readonly int last_root_copy; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/PCEngine.cs b/DiscImageChef.Filesystems/PCEngine.cs index 28b543fc8..cb72ea5e2 100644 --- a/DiscImageChef.Filesystems/PCEngine.cs +++ b/DiscImageChef.Filesystems/PCEngine.cs @@ -66,7 +66,7 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { Type = "PC Engine filesystem", - Clusters = (long)((partition.End - partition.Start + 1) / imagePlugin.Info.SectorSize * 2048), + Clusters = (partition.End - partition.Start + 1) / imagePlugin.Info.SectorSize * 2048, ClusterSize = 2048 }; } diff --git a/DiscImageChef.Filesystems/PCFX.cs b/DiscImageChef.Filesystems/PCFX.cs index b6dac484d..dd3d89ee7 100644 --- a/DiscImageChef.Filesystems/PCFX.cs +++ b/DiscImageChef.Filesystems/PCFX.cs @@ -106,7 +106,7 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { Type = "PC-FX", - Clusters = (long)partition.Length, + Clusters = partition.Length, ClusterSize = 2048, Bootable = true, CreationDate = dateTime, @@ -121,27 +121,27 @@ namespace DiscImageChef.Filesystems struct PcfxHeader { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] signature; + public readonly byte[] signature; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0xE0)] - public byte[] copyright; + public readonly byte[] copyright; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x710)] - public byte[] unknown; + public readonly byte[] unknown; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] title; - public uint loadOffset; - public uint loadCount; - public uint loadAddress; - public uint entryPoint; + public readonly byte[] title; + public readonly uint loadOffset; + public readonly uint loadCount; + public readonly uint loadAddress; + public readonly uint entryPoint; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public byte[] makerId; + public readonly byte[] makerId; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 60)] - public byte[] makerName; - public uint volumeNumber; - public byte majorVersion; - public byte minorVersion; - public ushort country; + public readonly byte[] makerName; + public readonly uint volumeNumber; + public readonly byte majorVersion; + public readonly byte minorVersion; + public readonly ushort country; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] date; + public readonly byte[] date; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/PFS.cs b/DiscImageChef.Filesystems/PFS.cs index a99518e1a..2844109ab 100644 --- a/DiscImageChef.Filesystems/PFS.cs +++ b/DiscImageChef.Filesystems/PFS.cs @@ -135,7 +135,7 @@ namespace DiscImageChef.Filesystems XmlFsType.FreeClusters = rootBlock.blocksfree; XmlFsType.FreeClustersSpecified = true; XmlFsType.Clusters = rootBlock.diskSize; - XmlFsType.ClusterSize = (int)imagePlugin.Info.SectorSize; + XmlFsType.ClusterSize = imagePlugin.Info.SectorSize; XmlFsType.VolumeName = StringHandlers.PascalToString(rootBlock.diskname, Encoding); } @@ -148,11 +148,11 @@ namespace DiscImageChef.Filesystems /// /// "PFS\1" disk type /// - public uint diskType; + public readonly uint diskType; /// /// Boot code, til completion /// - public byte[] bootCode; + public readonly byte[] bootCode; } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -161,84 +161,84 @@ namespace DiscImageChef.Filesystems /// /// Disk type /// - public uint diskType; + public readonly uint diskType; /// /// Options /// - public uint options; + public readonly uint options; /// /// Current datestamp /// - public uint datestamp; + public readonly uint datestamp; /// /// Volume creation day /// - public ushort creationday; + public readonly ushort creationday; /// /// Volume creation minute /// - public ushort creationminute; + public readonly ushort creationminute; /// /// Volume creation tick /// - public ushort creationtick; + public readonly ushort creationtick; /// /// AmigaDOS protection bits /// - public ushort protection; + public readonly ushort protection; /// /// Volume label (Pascal string) /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] diskname; + public readonly byte[] diskname; /// /// Last reserved block /// - public uint lastreserved; + public readonly uint lastreserved; /// /// First reserved block /// - public uint firstreserved; + public readonly uint firstreserved; /// /// Free reserved blocks /// - public uint reservedfree; + public readonly uint reservedfree; /// /// Size of reserved blocks in bytes /// - public ushort reservedblocksize; + public readonly ushort reservedblocksize; /// /// Blocks in rootblock, including bitmap /// - public ushort rootblockclusters; + public readonly ushort rootblockclusters; /// /// Free blocks /// - public uint blocksfree; + public readonly uint blocksfree; /// /// Blocks that must be always free /// - public uint alwaysfree; + public readonly uint alwaysfree; /// /// Current bitmapfield number for allocation /// - public uint rovingPointer; + public readonly uint rovingPointer; /// /// Pointer to deldir /// - public uint delDirPtr; + public readonly uint delDirPtr; /// /// Disk size in sectors /// - public uint diskSize; + public readonly uint diskSize; /// /// Rootblock extension /// - public uint extension; + public readonly uint extension; /// /// Unused /// - public uint unused; + public readonly uint unused; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ProDOS.cs b/DiscImageChef.Filesystems/ProDOS.cs index e9aa632fe..5fefedce3 100644 --- a/DiscImageChef.Filesystems/ProDOS.cs +++ b/DiscImageChef.Filesystems/ProDOS.cs @@ -307,8 +307,8 @@ namespace DiscImageChef.Filesystems Type = "ProDOS" }; - XmlFsType.ClusterSize = (int)((partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / - (ulong)XmlFsType.Clusters); + XmlFsType.ClusterSize = (uint)((partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / + XmlFsType.Clusters); if(!dateCorrect) return; XmlFsType.CreationDate = rootDirectoryKeyBlock.header.creation_time; diff --git a/DiscImageChef.Filesystems/QNX4.cs b/DiscImageChef.Filesystems/QNX4.cs index 52aa1a6d9..cded272d8 100644 --- a/DiscImageChef.Filesystems/QNX4.cs +++ b/DiscImageChef.Filesystems/QNX4.cs @@ -175,7 +175,7 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { Type = "QNX4 filesystem", - Clusters = (long)partition.Length, + Clusters = partition.Length, ClusterSize = 512, CreationDate = DateHandlers.UnixUnsignedToDateTime(qnxSb.rootDir.di_ftime), CreationDateSpecified = true, @@ -195,59 +195,59 @@ namespace DiscImageChef.Filesystems struct QNX4_Inode { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] di_fname; - public uint di_size; - public QNX4_Extent di_first_xtnt; - public uint di_xblk; - public uint di_ftime; - public uint di_mtime; - public uint di_atime; - public uint di_ctime; - public ushort di_num_xtnts; - public ushort di_mode; - public ushort di_uid; - public ushort di_gid; - public ushort di_nlink; - public uint di_zero; - public byte di_type; - public byte di_status; + public readonly byte[] di_fname; + public readonly uint di_size; + public readonly QNX4_Extent di_first_xtnt; + public readonly uint di_xblk; + public readonly uint di_ftime; + public readonly uint di_mtime; + public readonly uint di_atime; + public readonly uint di_ctime; + public readonly ushort di_num_xtnts; + public readonly ushort di_mode; + public readonly ushort di_uid; + public readonly ushort di_gid; + public readonly ushort di_nlink; + public readonly uint di_zero; + public readonly byte di_type; + public readonly byte di_status; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct QNX4_LinkInfo { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 48)] - public byte[] dl_fname; - public uint dl_inode_blk; - public byte dl_inode_ndx; + public readonly byte[] dl_fname; + public readonly uint dl_inode_blk; + public readonly byte dl_inode_ndx; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] - public byte[] dl_spare; - public byte dl_status; + public readonly byte[] dl_spare; + public readonly byte dl_status; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct QNX4_ExtentBlock { - public uint next_xblk; - public uint prev_xblk; - public byte num_xtnts; + public readonly uint next_xblk; + public readonly uint prev_xblk; + public readonly byte num_xtnts; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] spare; - public uint num_blocks; + public readonly byte[] spare; + public readonly uint num_blocks; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 60)] - public QNX4_Extent[] xtnts; + public readonly QNX4_Extent[] xtnts; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] signature; - public QNX4_Extent first_xtnt; + public readonly byte[] signature; + public readonly QNX4_Extent first_xtnt; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct QNX4_Superblock { - public QNX4_Inode rootDir; - public QNX4_Inode inode; - public QNX4_Inode boot; - public QNX4_Inode altBoot; + public readonly QNX4_Inode rootDir; + public readonly QNX4_Inode inode; + public readonly QNX4_Inode boot; + public readonly QNX4_Inode altBoot; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/QNX6.cs b/DiscImageChef.Filesystems/QNX6.cs index aed928102..eae3aede3 100644 --- a/DiscImageChef.Filesystems/QNX6.cs +++ b/DiscImageChef.Filesystems/QNX6.cs @@ -104,7 +104,7 @@ namespace DiscImageChef.Filesystems { Type = "QNX6 (Audi) filesystem", Clusters = audiSb.numBlocks, - ClusterSize = (int)audiSb.blockSize, + ClusterSize = audiSb.blockSize, Bootable = true, Files = audiSb.numInodes - audiSb.freeInodes, FilesSpecified = true, @@ -137,7 +137,7 @@ namespace DiscImageChef.Filesystems { Type = "QNX6 filesystem", Clusters = qnxSb.numBlocks, - ClusterSize = (int)qnxSb.blockSize, + ClusterSize = qnxSb.blockSize, Bootable = true, Files = qnxSb.numInodes - qnxSb.freeInodes, FilesSpecified = true, @@ -157,60 +157,60 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct QNX6_RootNode { - public ulong size; + public readonly ulong size; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public uint[] pointers; - public byte levels; - public byte mode; + public readonly uint[] pointers; + public readonly byte levels; + public readonly byte mode; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public byte[] spare; + public readonly byte[] spare; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct QNX6_SuperBlock { - public uint magic; - public uint checksum; - public ulong serial; - public uint ctime; - public uint atime; - public uint flags; - public ushort version1; - public ushort version2; + public readonly uint magic; + public readonly uint checksum; + public readonly ulong serial; + public readonly uint ctime; + public readonly uint atime; + public readonly uint flags; + public readonly ushort version1; + public readonly ushort version2; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] volumeid; - public uint blockSize; - public uint numInodes; - public uint freeInodes; - public uint numBlocks; - public uint freeBlocks; - public uint allocationGroup; - public QNX6_RootNode inode; - public QNX6_RootNode bitmap; - public QNX6_RootNode longfile; - public QNX6_RootNode unknown; + public readonly byte[] volumeid; + public readonly uint blockSize; + public readonly uint numInodes; + public readonly uint freeInodes; + public readonly uint numBlocks; + public readonly uint freeBlocks; + public readonly uint allocationGroup; + public readonly QNX6_RootNode inode; + public readonly QNX6_RootNode bitmap; + public readonly QNX6_RootNode longfile; + public readonly QNX6_RootNode unknown; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct QNX6_AudiSuperBlock { - public uint magic; - public uint checksum; - public ulong serial; + public readonly uint magic; + public readonly uint checksum; + public readonly ulong serial; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] spare1; + public readonly byte[] spare1; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] id; - public uint blockSize; - public uint numInodes; - public uint freeInodes; - public uint numBlocks; - public uint freeBlocks; - public uint spare2; - public QNX6_RootNode inode; - public QNX6_RootNode bitmap; - public QNX6_RootNode longfile; - public QNX6_RootNode unknown; + public readonly byte[] id; + public readonly uint blockSize; + public readonly uint numInodes; + public readonly uint freeInodes; + public readonly uint numBlocks; + public readonly uint freeBlocks; + public readonly uint spare2; + public readonly QNX6_RootNode inode; + public readonly QNX6_RootNode bitmap; + public readonly QNX6_RootNode longfile; + public readonly QNX6_RootNode unknown; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/RBF.cs b/DiscImageChef.Filesystems/RBF.cs index a6b42e010..e1692bfad 100644 --- a/DiscImageChef.Filesystems/RBF.cs +++ b/DiscImageChef.Filesystems/RBF.cs @@ -207,7 +207,7 @@ namespace DiscImageChef.Filesystems { Type = "OS-9 Random Block File", Bootable = LSNToUInt32(rbfSb.dd_bt) > 0 && rbfSb.dd_bsz > 0, - ClusterSize = rbfSb.dd_bit * (256 << rbfSb.dd_lsnsize), + ClusterSize = (uint)(rbfSb.dd_bit * (256 << rbfSb.dd_lsnsize)), Clusters = LSNToUInt32(rbfSb.dd_tot), CreationDate = DateHandlers.Os9ToDateTime(rbfSb.dd_dat), CreationDateSpecified = true, @@ -234,52 +234,52 @@ namespace DiscImageChef.Filesystems { /// Sectors on disk [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] dd_tot; + public readonly byte[] dd_tot; /// Tracks - public byte dd_tks; + public readonly byte dd_tks; /// Bytes in allocation map - public ushort dd_map; + public readonly ushort dd_map; /// Sectors per cluster - public ushort dd_bit; + public readonly ushort dd_bit; /// LSN of root directory [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] dd_dir; + public readonly byte[] dd_dir; /// Owner ID - public ushort dd_own; + public readonly ushort dd_own; /// Attributes - public byte dd_att; + public readonly byte dd_att; /// Disk ID - public ushort dd_dsk; + public readonly ushort dd_dsk; /// Format byte - public byte dd_fmt; + public readonly byte dd_fmt; /// Sectors per track - public ushort dd_spt; + public readonly ushort dd_spt; /// Reserved - public ushort dd_res; + public readonly ushort dd_res; /// LSN of boot file [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] dd_bt; + public readonly byte[] dd_bt; /// Size of boot file - public ushort dd_bsz; + public readonly ushort dd_bsz; /// Creation date [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public byte[] dd_dat; + public readonly byte[] dd_dat; /// Volume name [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] dd_nam; + public readonly byte[] dd_nam; /// Path options [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] dd_opt; + public readonly byte[] dd_opt; /// Reserved - public byte reserved; + public readonly byte reserved; /// Magic number - public uint dd_sync; + public readonly uint dd_sync; /// LSN of allocation map - public uint dd_maplsn; + public readonly uint dd_maplsn; /// Size of an LSN - public ushort dd_lsnsize; + public readonly ushort dd_lsnsize; /// Version ID - public ushort dd_versid; + public readonly ushort dd_versid; } /// @@ -290,53 +290,53 @@ namespace DiscImageChef.Filesystems struct RBF_NewIdSector { /// Magic number - public uint rid_sync; + public readonly uint rid_sync; /// Disk ID - public uint rid_diskid; + public readonly uint rid_diskid; /// Sectors on disk - public uint rid_totblocks; + public readonly uint rid_totblocks; /// Cylinders - public ushort rid_cylinders; + public readonly ushort rid_cylinders; /// Sectors in cylinder 0 - public ushort rid_cyl0size; + public readonly ushort rid_cyl0size; /// Sectors per cylinder - public ushort rid_cylsize; + public readonly ushort rid_cylsize; /// Heads - public ushort rid_heads; + public readonly ushort rid_heads; /// Bytes per sector - public ushort rid_blocksize; + public readonly ushort rid_blocksize; /// Disk format - public ushort rid_format; + public readonly ushort rid_format; /// Flags - public ushort rid_flags; + public readonly ushort rid_flags; /// Padding - public ushort rid_unused1; + public readonly ushort rid_unused1; /// Sector of allocation bitmap - public uint rid_bitmap; + public readonly uint rid_bitmap; /// Sector of debugger FD - public uint rid_firstboot; + public readonly uint rid_firstboot; /// Sector of bootfile FD - public uint rid_bootfile; + public readonly uint rid_bootfile; /// Sector of root directory FD - public uint rid_rootdir; + public readonly uint rid_rootdir; /// Group owner of media - public ushort rid_group; + public readonly ushort rid_group; /// Owner of media - public ushort rid_owner; + public readonly ushort rid_owner; /// Creation time - public uint rid_ctime; + public readonly uint rid_ctime; /// Last write time for this structure - public uint rid_mtime; + public readonly uint rid_mtime; /// Volume name [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] rid_name; + public readonly byte[] rid_name; /// Endian flag - public byte rid_endflag; + public readonly byte rid_endflag; /// Padding [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] rid_unused2; + public readonly byte[] rid_unused2; /// Parity - public uint rid_parity; + public readonly uint rid_parity; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/RT11.cs b/DiscImageChef.Filesystems/RT11.cs index b667798e3..68ccf460f 100644 --- a/DiscImageChef.Filesystems/RT11.cs +++ b/DiscImageChef.Filesystems/RT11.cs @@ -105,7 +105,7 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { Type = "RT-11", - ClusterSize = homeblock.cluster * 512, + ClusterSize = (uint)(homeblock.cluster * 512), Clusters = homeblock.cluster, VolumeName = StringHandlers.SpacePaddedToString(homeblock.volname, Encoding), Bootable = !ArrayHelpers.ArrayIsNullOrEmpty(bootBlock) @@ -119,47 +119,47 @@ namespace DiscImageChef.Filesystems { /// Bad block replacement table [MarshalAs(UnmanagedType.ByValArray, SizeConst = 130)] - public byte[] badBlockTable; + public readonly byte[] badBlockTable; /// Unused [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public byte[] unused; + public readonly byte[] unused; /// INITIALIZE/RESTORE data area [MarshalAs(UnmanagedType.ByValArray, SizeConst = 38)] - public byte[] initArea; + public readonly byte[] initArea; /// BUP information area [MarshalAs(UnmanagedType.ByValArray, SizeConst = 18)] - public byte[] bupInformation; + public readonly byte[] bupInformation; /// Empty [MarshalAs(UnmanagedType.ByValArray, SizeConst = 260)] - public byte[] empty; + public readonly byte[] empty; /// Reserved [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public byte[] reserved1; + public readonly byte[] reserved1; /// Reserved [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public byte[] reserved2; + public readonly byte[] reserved2; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)] - public byte[] empty2; + public readonly byte[] empty2; /// Cluster size - public ushort cluster; + public readonly ushort cluster; /// Block of the first directory segment - public ushort rootBlock; + public readonly ushort rootBlock; /// "V3A" in Radix-50 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public byte[] systemVersion; + public readonly byte[] systemVersion; /// Name of the volume, 12 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] volname; + public readonly byte[] volname; /// Name of the volume owner, 12 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] ownername; + public readonly byte[] ownername; /// RT11 defines it as "DECRT11A ", 12 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] format; + public readonly byte[] format; /// Unused - public ushort unused2; + public readonly ushort unused2; /// Checksum of preceding 255 words (16 bit units) - public ushort checksum; + public readonly ushort checksum; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ReFS.cs b/DiscImageChef.Filesystems/ReFS.cs index eb88c272a..3180d85ad 100644 --- a/DiscImageChef.Filesystems/ReFS.cs +++ b/DiscImageChef.Filesystems/ReFS.cs @@ -122,8 +122,8 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { Type = "Resilient File System", - ClusterSize = (int)(refsVhdr.bytesPerSector * refsVhdr.sectorsPerCluster), - Clusters = (long)(refsVhdr.sectors / refsVhdr.sectorsPerCluster) + ClusterSize = refsVhdr.bytesPerSector * refsVhdr.sectorsPerCluster, + Clusters = refsVhdr.sectors / refsVhdr.sectorsPerCluster }; } @@ -131,23 +131,23 @@ namespace DiscImageChef.Filesystems struct RefsVolumeHeader { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] jump; + public readonly byte[] jump; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] signature; + public readonly byte[] signature; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] - public byte[] mustBeZero; - public uint identifier; - public ushort length; - public ushort checksum; - public ulong sectors; - public uint bytesPerSector; - public uint sectorsPerCluster; - public uint unknown1; - public uint unknown2; - public ulong unknown3; - public ulong unknown4; + public readonly byte[] mustBeZero; + public readonly uint identifier; + public readonly ushort length; + public readonly ushort checksum; + public readonly ulong sectors; + public readonly uint bytesPerSector; + public readonly uint sectorsPerCluster; + public readonly uint unknown1; + public readonly uint unknown2; + public readonly ulong unknown3; + public readonly ulong unknown4; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 15872)] - public byte[] unknown5; + public readonly byte[] unknown5; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/Reiser4.cs b/DiscImageChef.Filesystems/Reiser4.cs index 7951dc075..e8032da76 100644 --- a/DiscImageChef.Filesystems/Reiser4.cs +++ b/DiscImageChef.Filesystems/Reiser4.cs @@ -108,10 +108,9 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { - Type = "Reiser 4 filesystem", - ClusterSize = reiserSb.blocksize, - Clusters = - (long)((partition.End - partition.Start) * imagePlugin.Info.SectorSize / reiserSb.blocksize), + Type = "Reiser 4 filesystem", + ClusterSize = reiserSb.blocksize, + Clusters = (partition.End - partition.Start) * imagePlugin.Info.SectorSize / reiserSb.blocksize, VolumeName = StringHandlers.CToString(reiserSb.label, Encoding), VolumeSerial = reiserSb.uuid.ToString() }; @@ -121,12 +120,12 @@ namespace DiscImageChef.Filesystems struct Reiser4_Superblock { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] magic; - public ushort diskformat; - public ushort blocksize; - public Guid uuid; + public readonly byte[] magic; + public readonly ushort diskformat; + public readonly ushort blocksize; + public readonly Guid uuid; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] label; + public readonly byte[] label; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/SFS.cs b/DiscImageChef.Filesystems/SFS.cs index 3040035f5..efc377ce0 100644 --- a/DiscImageChef.Filesystems/SFS.cs +++ b/DiscImageChef.Filesystems/SFS.cs @@ -105,7 +105,7 @@ namespace DiscImageChef.Filesystems CreationDate = DateHandlers.UnixUnsignedToDateTime(rootBlock.datecreated).AddYears(8), CreationDateSpecified = true, Clusters = rootBlock.totalblocks, - ClusterSize = (int)rootBlock.blocksize, + ClusterSize = rootBlock.blocksize, Type = "SmartFileSystem" }; } @@ -120,32 +120,32 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct RootBlock { - public uint blockId; - public uint blockChecksum; - public uint blockSelfPointer; - public ushort version; - public ushort sequence; - public uint datecreated; - public SFSFlags bits; - public byte padding1; - public ushort padding2; + public readonly uint blockId; + public readonly uint blockChecksum; + public readonly uint blockSelfPointer; + public readonly ushort version; + public readonly ushort sequence; + public readonly uint datecreated; + public readonly SFSFlags bits; + public readonly byte padding1; + public readonly ushort padding2; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public uint[] reserved1; - public ulong firstbyte; - public ulong lastbyte; - public uint totalblocks; - public uint blocksize; + public readonly uint[] reserved1; + public readonly ulong firstbyte; + public readonly ulong lastbyte; + public readonly uint totalblocks; + public readonly uint blocksize; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public uint[] reserved2; + public readonly uint[] reserved2; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public uint[] reserved3; - public uint bitmapbase; - public uint adminspacecontainer; - public uint rootobjectcontainer; - public uint extentbnoderoot; - public uint objectnoderoot; + public readonly uint[] reserved3; + public readonly uint bitmapbase; + public readonly uint adminspacecontainer; + public readonly uint rootobjectcontainer; + public readonly uint extentbnoderoot; + public readonly uint objectnoderoot; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public uint[] reserved4; + public readonly uint[] reserved4; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/Squash.cs b/DiscImageChef.Filesystems/Squash.cs index 6f2a3f573..b287d8376 100644 --- a/DiscImageChef.Filesystems/Squash.cs +++ b/DiscImageChef.Filesystems/Squash.cs @@ -130,8 +130,8 @@ namespace DiscImageChef.Filesystems CreationDate = DateHandlers.UnixUnsignedToDateTime(sqSb.mkfs_time), CreationDateSpecified = true, Clusters = - (long)((partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / sqSb.block_size), - ClusterSize = (int)sqSb.block_size, + (partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / sqSb.block_size, + ClusterSize = sqSb.block_size, Files = sqSb.inodes, FilesSpecified = true, FreeClusters = 0, @@ -152,25 +152,25 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct SquashSuperBlock { - public uint magic; - public uint inodes; - public uint mkfs_time; - public uint block_size; - public uint fragments; - public ushort compression; - public ushort block_log; - public ushort flags; - public ushort no_ids; - public ushort s_major; - public ushort s_minor; - public ulong root_inode; - public ulong bytes_used; - public ulong id_table_start; - public ulong xattr_id_table_start; - public ulong inode_table_start; - public ulong directory_table_start; - public ulong fragment_table_start; - public ulong lookup_table_start; + public readonly uint magic; + public readonly uint inodes; + public readonly uint mkfs_time; + public readonly uint block_size; + public readonly uint fragments; + public readonly ushort compression; + public readonly ushort block_log; + public readonly ushort flags; + public readonly ushort no_ids; + public readonly ushort s_major; + public readonly ushort s_minor; + public readonly ulong root_inode; + public readonly ulong bytes_used; + public readonly ulong id_table_start; + public readonly ulong xattr_id_table_start; + public readonly ulong inode_table_start; + public readonly ulong directory_table_start; + public readonly ulong fragment_table_start; + public readonly ulong lookup_table_start; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/UCSDPascal/Info.cs b/DiscImageChef.Filesystems/UCSDPascal/Info.cs index 28e0aa36b..0ac7fe08e 100644 --- a/DiscImageChef.Filesystems/UCSDPascal/Info.cs +++ b/DiscImageChef.Filesystems/UCSDPascal/Info.cs @@ -165,9 +165,9 @@ namespace DiscImageChef.Filesystems.UCSDPascal { Bootable = !ArrayHelpers.ArrayIsNullOrEmpty(imagePlugin.ReadSectors(partition.Start, multiplier * 2)), - Clusters = volEntry.Blocks, - ClusterSize = (int)imagePlugin.Info.SectorSize, - Files = volEntry.Files, + Clusters = (ulong)volEntry.Blocks, + ClusterSize = imagePlugin.Info.SectorSize, + Files = (ulong)volEntry.Files, FilesSpecified = true, Type = "UCSD Pascal", VolumeName = StringHandlers.PascalToString(volEntry.VolumeName, Encoding) diff --git a/DiscImageChef.Filesystems/UCSDPascal/Super.cs b/DiscImageChef.Filesystems/UCSDPascal/Super.cs index 946a38671..dca3baa11 100644 --- a/DiscImageChef.Filesystems/UCSDPascal/Super.cs +++ b/DiscImageChef.Filesystems/UCSDPascal/Super.cs @@ -112,9 +112,9 @@ namespace DiscImageChef.Filesystems.UCSDPascal XmlFsType = new FileSystemType { Bootable = !ArrayHelpers.ArrayIsNullOrEmpty(bootBlocks), - Clusters = mountedVolEntry.Blocks, - ClusterSize = (int)device.Info.SectorSize, - Files = mountedVolEntry.Files, + Clusters = (ulong)mountedVolEntry.Blocks, + ClusterSize = device.Info.SectorSize, + Files = (ulong)mountedVolEntry.Files, FilesSpecified = true, Type = "UCSD Pascal", VolumeName = StringHandlers.PascalToString(mountedVolEntry.VolumeName, Encoding) @@ -136,7 +136,7 @@ namespace DiscImageChef.Filesystems.UCSDPascal { stat = new FileSystemInfo { - Blocks = mountedVolEntry.Blocks, + Blocks = (ulong)mountedVolEntry.Blocks, FilenameLength = 16, Files = (ulong)mountedVolEntry.Files, FreeBlocks = 0, @@ -144,9 +144,11 @@ namespace DiscImageChef.Filesystems.UCSDPascal Type = "UCSD Pascal" }; - stat.FreeBlocks = mountedVolEntry.Blocks - (mountedVolEntry.LastBlock - mountedVolEntry.FirstBlock); + stat.FreeBlocks = + (ulong)(mountedVolEntry.Blocks - (mountedVolEntry.LastBlock - mountedVolEntry.FirstBlock)); - foreach(PascalFileEntry entry in fileEntries) stat.FreeBlocks -= entry.LastBlock - entry.FirstBlock; + foreach(PascalFileEntry entry in fileEntries) + stat.FreeBlocks -= (ulong)(entry.LastBlock - entry.FirstBlock); return Errno.NotImplemented; } diff --git a/DiscImageChef.Filesystems/UDF.cs b/DiscImageChef.Filesystems/UDF.cs index 6f0c848ff..58446dd62 100644 --- a/DiscImageChef.Filesystems/UDF.cs +++ b/DiscImageChef.Filesystems/UDF.cs @@ -254,7 +254,7 @@ namespace DiscImageChef.Filesystems $"UDF v{Convert.ToInt32($"{(lvidiu.maximumWriteUDF & 0xFF00) >> 8}", 10)}.{Convert.ToInt32($"{lvidiu.maximumWriteUDF & 0xFF}", 10):X2}", ApplicationIdentifier = Encoding.GetString(pvd.implementationIdentifier.identifier).TrimEnd('\u0000'), - ClusterSize = (int)lvd.logicalBlockSize, + ClusterSize = lvd.logicalBlockSize, ModificationDate = EcmaToDateTime(lvid.recordingDateTime), ModificationDateSpecified = true, Files = lvidiu.files, @@ -264,8 +264,8 @@ namespace DiscImageChef.Filesystems SystemIdentifier = Encoding.GetString(pvd.implementationIdentifier.identifier).TrimEnd('\u0000') }; - XmlFsType.Clusters = (long)((partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / - (ulong)XmlFsType.ClusterSize); + XmlFsType.Clusters = (partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / + XmlFsType.ClusterSize; information = sbInformation.ToString(); } @@ -288,32 +288,32 @@ namespace DiscImageChef.Filesystems /// /// Entity flags /// - public EntityFlags flags; + public readonly EntityFlags flags; /// /// Structure identifier /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 23)] - public byte[] identifier; + public readonly byte[] identifier; /// /// Structure data /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] identifierSuffix; + public readonly byte[] identifierSuffix; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct Timestamp { - public ushort typeAndZone; - public short year; - public byte month; - public byte day; - public byte hour; - public byte minute; - public byte second; - public byte centiseconds; - public byte hundredsMicroseconds; - public byte microseconds; + public readonly ushort typeAndZone; + public readonly short year; + public readonly byte month; + public readonly byte day; + public readonly byte hour; + public readonly byte minute; + public readonly byte second; + public readonly byte centiseconds; + public readonly byte hundredsMicroseconds; + public readonly byte microseconds; } enum TagIdentifier : ushort @@ -332,103 +332,103 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct DescriptorTag { - public TagIdentifier tagIdentifier; - public ushort descriptorVersion; - public byte tagChecksum; - public byte reserved; - public ushort tagSerialNumber; - public ushort descriptorCrc; - public ushort descriptorCrcLength; - public uint tagLocation; + public readonly TagIdentifier tagIdentifier; + public readonly ushort descriptorVersion; + public readonly byte tagChecksum; + public readonly byte reserved; + public readonly ushort tagSerialNumber; + public readonly ushort descriptorCrc; + public readonly ushort descriptorCrcLength; + public readonly uint tagLocation; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ExtentDescriptor { - public uint length; - public uint location; + public readonly uint length; + public readonly uint location; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct CharacterSpecification { - public byte type; + public readonly byte type; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 63)] - public byte[] information; + public readonly byte[] information; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct AnchorVolumeDescriptorPointer { - public DescriptorTag tag; - public ExtentDescriptor mainVolumeDescriptorSequenceExtent; - public ExtentDescriptor reserveVolumeDescriptorSequenceExtent; + public readonly DescriptorTag tag; + public readonly ExtentDescriptor mainVolumeDescriptorSequenceExtent; + public readonly ExtentDescriptor reserveVolumeDescriptorSequenceExtent; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 480)] - public byte[] reserved; + public readonly byte[] reserved; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct PrimaryVolumeDescriptor { - public DescriptorTag tag; - public uint volumeDescriptorSequenceNumber; - public uint primaryVolumeDescriptorNumber; + public readonly DescriptorTag tag; + public readonly uint volumeDescriptorSequenceNumber; + public readonly uint primaryVolumeDescriptorNumber; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] volumeIdentifier; - public ushort volumeSequenceNumber; - public ushort maximumVolumeSequenceNumber; - public ushort interchangeLevel; - public ushort maximumInterchangeLevel; - public uint characterSetList; - public uint maximumCharacterSetList; + public readonly byte[] volumeIdentifier; + public readonly ushort volumeSequenceNumber; + public readonly ushort maximumVolumeSequenceNumber; + public readonly ushort interchangeLevel; + public readonly ushort maximumInterchangeLevel; + public readonly uint characterSetList; + public readonly uint maximumCharacterSetList; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public byte[] volumeSetIdentifier; - public CharacterSpecification descriptorCharacterSet; - public CharacterSpecification explanatoryCharacterSet; - public ExtentDescriptor volumeAbstract; - public ExtentDescriptor volumeCopyright; - public EntityIdentifier applicationIdentifier; - public Timestamp recordingDateTime; - public EntityIdentifier implementationIdentifier; + public readonly byte[] volumeSetIdentifier; + public readonly CharacterSpecification descriptorCharacterSet; + public readonly CharacterSpecification explanatoryCharacterSet; + public readonly ExtentDescriptor volumeAbstract; + public readonly ExtentDescriptor volumeCopyright; + public readonly EntityIdentifier applicationIdentifier; + public readonly Timestamp recordingDateTime; + public readonly EntityIdentifier implementationIdentifier; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] - public byte[] implementationUse; - public uint predecessorVolumeDescriptorSequenceLocation; - public ushort flags; + public readonly byte[] implementationUse; + public readonly uint predecessorVolumeDescriptorSequenceLocation; + public readonly ushort flags; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 22)] - public byte[] reserved; + public readonly byte[] reserved; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct LogicalVolumeDescriptor { - public DescriptorTag tag; - public uint volumeDescriptorSequenceNumber; - public CharacterSpecification descriptorCharacterSet; + public readonly DescriptorTag tag; + public readonly uint volumeDescriptorSequenceNumber; + public readonly CharacterSpecification descriptorCharacterSet; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public byte[] logicalVolumeIdentifier; - public uint logicalBlockSize; - public EntityIdentifier domainIdentifier; + public readonly byte[] logicalVolumeIdentifier; + public readonly uint logicalBlockSize; + public readonly EntityIdentifier domainIdentifier; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] logicalVolumeContentsUse; - public uint mapTableLength; - public uint numberOfPartitionMaps; - public EntityIdentifier implementationIdentifier; + public readonly byte[] logicalVolumeContentsUse; + public readonly uint mapTableLength; + public readonly uint numberOfPartitionMaps; + public readonly EntityIdentifier implementationIdentifier; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public byte[] implementationUse; - public ExtentDescriptor integritySequenceExtent; + public readonly byte[] implementationUse; + public readonly ExtentDescriptor integritySequenceExtent; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct LogicalVolumeIntegrityDescriptor { - public DescriptorTag tag; - public Timestamp recordingDateTime; - public uint integrityType; - public ExtentDescriptor nextIntegrityExtent; + public readonly DescriptorTag tag; + public readonly Timestamp recordingDateTime; + public readonly uint integrityType; + public readonly ExtentDescriptor nextIntegrityExtent; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] logicalVolumeContentsUse; - public uint numberOfPartitions; - public uint lengthOfImplementationUse; + public readonly byte[] logicalVolumeContentsUse; + public readonly uint numberOfPartitions; + public readonly uint lengthOfImplementationUse; // Follows uint[numberOfPartitions] freeSpaceTable; // Follows uint[numberOfPartitions] sizeTable; // Follows byte[lengthOfImplementationUse] implementationUse; @@ -437,12 +437,12 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct LogicalVolumeIntegrityDescriptorImplementationUse { - public EntityIdentifier implementationId; - public uint files; - public uint directories; - public ushort minimumReadUDF; - public ushort minimumWriteUDF; - public ushort maximumWriteUDF; + public readonly EntityIdentifier implementationId; + public readonly uint files; + public readonly uint directories; + public readonly ushort minimumReadUDF; + public readonly ushort minimumWriteUDF; + public readonly ushort maximumWriteUDF; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/UNICOS.cs b/DiscImageChef.Filesystems/UNICOS.cs index ffefbd17b..962ae9b11 100644 --- a/DiscImageChef.Filesystems/UNICOS.cs +++ b/DiscImageChef.Filesystems/UNICOS.cs @@ -119,7 +119,7 @@ namespace DiscImageChef.Filesystems { Type = "UNICOS filesystem", ClusterSize = 4096, - Clusters = unicosSb.s_fsize, + Clusters = (ulong)unicosSb.s_fsize, VolumeName = StringHandlers.CToString(unicosSb.s_fname, Encoding), ModificationDate = DateHandlers.UnixToDateTime(unicosSb.s_time), ModificationDateSpecified = true @@ -131,20 +131,20 @@ namespace DiscImageChef.Filesystems [SuppressMessage("ReSharper", "InconsistentNaming")] struct nc1ireg_sb { - public ushort i_unused; /* reserved */ - public ushort i_nblk; /* number of blocks */ - public uint i_sblk; /* start block number */ + public readonly ushort i_unused; /* reserved */ + public readonly ushort i_nblk; /* number of blocks */ + public readonly uint i_sblk; /* start block number */ } [StructLayout(LayoutKind.Sequential, Pack = 1)] [SuppressMessage("ReSharper", "InconsistentNaming")] 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 readonly long fd_name; /* Physical device name */ + public readonly uint fd_sblk; /* Start block number */ + public readonly uint fd_nblk; /* Number of blocks */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = NC1_MAXIREG)] - public nc1ireg_sb[] fd_ireg; /* Inode regions */ + public readonly nc1ireg_sb[] fd_ireg; /* Inode regions */ } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -152,64 +152,64 @@ namespace DiscImageChef.Filesystems [SuppressMessage("ReSharper", "BuiltInTypeReferenceStyle")] struct UNICOS_Superblock { - public ulong s_magic; /* magic number to indicate file system type */ + public readonly ulong s_magic; /* magic number to indicate file system type */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] s_fname; /* file system name */ + public readonly 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 readonly byte[] s_fpack; /* file system pack name */ + public readonly 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 readonly daddr_t s_fsize; /* size in blocks of entire volume */ + public readonly long s_isize; /* Number of total inodes */ + public readonly long s_bigfile; /* number of bytes at which a file is big */ + public readonly long s_bigunit; /* minimum number of blocks allocated for big files */ + public readonly ulong s_secure; /* security: secure FS label */ + public readonly long s_maxlvl; /* security: maximum security level */ + public readonly long s_minlvl; /* security: minimum security level */ + public readonly long s_valcmp; /* security: valid security compartments */ + public readonly time_t s_time; /* last super block update */ + public readonly blkno_t s_dboff; /* Dynamic block number */ + public readonly ino_t s_root; /* root inode */ + public readonly long s_error; /* Type of file system error detected */ + public readonly blkno_t s_mapoff; /* Start map block number */ + public readonly long s_mapblks; /* Last map block number */ + public readonly long s_nscpys; /* Number of copies of s.b per partition */ + public readonly long s_npart; /* Number of partitions */ + public readonly long s_ifract; /* Ratio of inodes to blocks */ + public readonly extent_t s_sfs; /* SFS only blocks */ + public readonly long s_flag; /* Flag word */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = NC1_MAXPART)] - public nc1fdev_sb[] s_part; /* Partition descriptors */ - public long s_iounit; /* Physical block size */ - public long s_numiresblks; /* number of inode reservation blocks */ + public readonly nc1fdev_sb[] s_part; /* Partition descriptors */ + public readonly long s_iounit; /* Physical block size */ + public readonly 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) */ + public readonly long s_priparts; /* bitmap of primary partitions */ + public readonly long s_priblock; /* block size of primary partition(s) */ /* 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) */ + public readonly long s_prinblks; /* number of 512 wds blocks in primary */ + public readonly long s_secparts; /* bitmap of secondary partitions */ + public readonly long s_secblock; /* block size of secondary partition(s) */ /* 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 */ + public readonly long s_secnblks; /* number of 512 wds blocks in secondary */ + public readonly 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 */ + public readonly long s_rootdparts; /* bitmap of partitions with root directory */ /* (only primary partitions) */ - public long s_nudparts; /* bitmap of no-user-data partitions */ + public readonly 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 */ + public readonly long s_nsema; /* SFS: # fs semaphores to allocate */ + public readonly 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 */ + public readonly long s_sfs_arbiterid; /* SFS Arbiter ID */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 91)] - public long[] s_fill; /* reserved */ + public readonly long[] s_fill; /* reserved */ } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/UNIXBFS.cs b/DiscImageChef.Filesystems/UNIXBFS.cs index 1d23c8252..c9e10d231 100644 --- a/DiscImageChef.Filesystems/UNIXBFS.cs +++ b/DiscImageChef.Filesystems/UNIXBFS.cs @@ -105,8 +105,8 @@ namespace DiscImageChef.Filesystems { Type = "BFS", VolumeName = bfsSb.s_volume, - ClusterSize = (int)imagePlugin.Info.SectorSize, - Clusters = (long)(partition.End - partition.Start + 1) + ClusterSize = imagePlugin.Info.SectorSize, + Clusters = partition.End - partition.Start + 1 }; information = sb.ToString(); diff --git a/DiscImageChef.Filesystems/VMfs.cs b/DiscImageChef.Filesystems/VMfs.cs index f9cc9e773..031c04575 100644 --- a/DiscImageChef.Filesystems/VMfs.cs +++ b/DiscImageChef.Filesystems/VMfs.cs @@ -108,7 +108,7 @@ namespace DiscImageChef.Filesystems ModificationDate = DateHandlers.UnixUnsignedToDateTime(mtimeSecs, mtimeNanoSecs), ModificationDateSpecified = true, Clusters = volInfo.size * 256 / imagePlugin.Info.SectorSize, - ClusterSize = (int)imagePlugin.Info.SectorSize, + ClusterSize = imagePlugin.Info.SectorSize, VolumeSerial = volInfo.uuid.ToString() }; } @@ -123,23 +123,23 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct VolumeInfo { - public uint magic; - public uint version; + public readonly uint magic; + public readonly uint version; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public byte[] unknown1; - public byte lun; + public readonly byte[] unknown1; + public readonly byte lun; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] unknown2; + public readonly byte[] unknown2; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 28)] - public byte[] name; + public readonly byte[] name; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 49)] - public byte[] unknown3; - public uint size; + public readonly byte[] unknown3; + public readonly uint size; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 31)] - public byte[] unknown4; - public Guid uuid; - public ulong ctime; - public ulong mtime; + public readonly byte[] unknown4; + public readonly Guid uuid; + public readonly ulong ctime; + public readonly ulong mtime; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/VxFS.cs b/DiscImageChef.Filesystems/VxFS.cs index 131e7d457..dcb967bd2 100644 --- a/DiscImageChef.Filesystems/VxFS.cs +++ b/DiscImageChef.Filesystems/VxFS.cs @@ -103,10 +103,10 @@ namespace DiscImageChef.Filesystems CreationDateSpecified = true, ModificationDate = DateHandlers.UnixUnsignedToDateTime(vxSb.vs_wtime, vxSb.vs_wutime), ModificationDateSpecified = true, - Clusters = vxSb.vs_size, - ClusterSize = vxSb.vs_bsize, + Clusters = (ulong)vxSb.vs_size, + ClusterSize = (uint)vxSb.vs_bsize, Dirty = vxSb.vs_clean != 0, - FreeClusters = vxSb.vs_free, + FreeClusters = (ulong)vxSb.vs_free, FreeClustersSpecified = true }; } @@ -115,147 +115,147 @@ namespace DiscImageChef.Filesystems struct VxSuperBlock { /// Magic number - public uint vs_magic; + public readonly uint vs_magic; /// VxFS version - public int vs_version; + public readonly int vs_version; /// create time - secs - public uint vs_ctime; + public readonly uint vs_ctime; /// create time - usecs - public uint vs_cutime; + public readonly uint vs_cutime; /// unused - public int __unused1; + public readonly int __unused1; /// unused - public int __unused2; + public readonly int __unused2; /// obsolete - public int vs_old_logstart; + public readonly int vs_old_logstart; /// obsolete - public int vs_old_logend; + public readonly int vs_old_logend; /// block size - public int vs_bsize; + public readonly int vs_bsize; /// number of blocks - public int vs_size; + public readonly int vs_size; /// number of data blocks - public int vs_dsize; + public readonly int vs_dsize; /// obsolete - public uint vs_old_ninode; + public readonly uint vs_old_ninode; /// obsolete - public int vs_old_nau; + public readonly int vs_old_nau; /// unused - public int __unused3; + public readonly int __unused3; /// obsolete - public int vs_old_defiextsize; + public readonly int vs_old_defiextsize; /// obsolete - public int vs_old_ilbsize; + public readonly int vs_old_ilbsize; /// size of immediate data area - public int vs_immedlen; + public readonly int vs_immedlen; /// number of direct extentes - public int vs_ndaddr; + public readonly int vs_ndaddr; /// address of first AU - public int vs_firstau; + public readonly int vs_firstau; /// offset of extent map in AU - public int vs_emap; + public readonly int vs_emap; /// offset of inode map in AU - public int vs_imap; + public readonly int vs_imap; /// offset of ExtOp. map in AU - public int vs_iextop; + public readonly int vs_iextop; /// offset of inode list in AU - public int vs_istart; + public readonly int vs_istart; /// offset of fdblock in AU - public int vs_bstart; + public readonly int vs_bstart; /// aufirst + emap - public int vs_femap; + public readonly int vs_femap; /// aufirst + imap - public int vs_fimap; + public readonly int vs_fimap; /// aufirst + iextop - public int vs_fiextop; + public readonly int vs_fiextop; /// aufirst + istart - public int vs_fistart; + public readonly int vs_fistart; /// aufirst + bstart - public int vs_fbstart; + public readonly int vs_fbstart; /// number of entries in indir - public int vs_nindir; + public readonly int vs_nindir; /// length of AU in blocks - public int vs_aulen; + public readonly int vs_aulen; /// length of imap in blocks - public int vs_auimlen; + public readonly int vs_auimlen; /// length of emap in blocks - public int vs_auemlen; + public readonly int vs_auemlen; /// length of ilist in blocks - public int vs_auilen; + public readonly int vs_auilen; /// length of pad in blocks - public int vs_aupad; + public readonly int vs_aupad; /// data blocks in AU - public int vs_aublocks; + public readonly int vs_aublocks; /// log base 2 of aublocks - public int vs_maxtier; + public readonly int vs_maxtier; /// number of inodes per blk - public int vs_inopb; + public readonly int vs_inopb; /// obsolete - public int vs_old_inopau; + public readonly int vs_old_inopau; /// obsolete - public int vs_old_inopilb; + public readonly int vs_old_inopilb; /// obsolete - public int vs_old_ndiripau; + public readonly int vs_old_ndiripau; /// size of indirect addr ext. - public int vs_iaddrlen; + public readonly int vs_iaddrlen; /// log base 2 of bsize - public int vs_bshift; + public readonly int vs_bshift; /// log base 2 of inobp - public int vs_inoshift; + public readonly int vs_inoshift; /// ~( bsize - 1 ) - public int vs_bmask; + public readonly int vs_bmask; /// bsize - 1 - public int vs_boffmask; + public readonly int vs_boffmask; /// old_inopilb - 1 - public int vs_old_inomask; + public readonly int vs_old_inomask; /// checksum of V1 data - public int vs_checksum; + public readonly int vs_checksum; /// number of free blocks - public int vs_free; + public readonly int vs_free; /// number of free inodes - public int vs_ifree; + public readonly int vs_ifree; /// number of free extents by size [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public int[] vs_efree; + public readonly int[] vs_efree; /// flags ?!? - public int vs_flags; + public readonly int vs_flags; /// filesystem has been changed - public byte vs_mod; + public readonly byte vs_mod; /// clean FS - public byte vs_clean; + public readonly byte vs_clean; /// unused - public ushort __unused4; + public readonly ushort __unused4; /// mount time log ID - public uint vs_firstlogid; + public readonly uint vs_firstlogid; /// last time written - sec - public uint vs_wtime; + public readonly uint vs_wtime; /// last time written - usec - public uint vs_wutime; + public readonly uint vs_wutime; /// FS name [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public byte[] vs_fname; + public readonly byte[] vs_fname; /// FS pack name [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public byte[] vs_fpack; + public readonly byte[] vs_fpack; /// log format version - public int vs_logversion; + public readonly int vs_logversion; /// unused - public int __unused5; + public readonly int __unused5; /// OLT extent and replica [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public int[] vs_oltext; + public readonly int[] vs_oltext; /// OLT extent size - public int vs_oltsize; + public readonly int vs_oltsize; /// size of inode map - public int vs_iauimlen; + public readonly int vs_iauimlen; /// size of IAU in blocks - public int vs_iausize; + public readonly int vs_iausize; /// size of inode in bytes - public int vs_dinosize; + public readonly int vs_dinosize; /// indir levels per inode - public int vs_old_dniaddr; + public readonly int vs_old_dniaddr; /// checksum of V2 RO - public int vs_checksum2; + public readonly int vs_checksum2; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/XFS.cs b/DiscImageChef.Filesystems/XFS.cs index 3f457db2f..6db15874a 100644 --- a/DiscImageChef.Filesystems/XFS.cs +++ b/DiscImageChef.Filesystems/XFS.cs @@ -173,11 +173,11 @@ namespace DiscImageChef.Filesystems XmlFsType = new FileSystemType { Type = "XFS filesystem", - ClusterSize = (int)xfsSb.blocksize, - Clusters = (long)xfsSb.dblocks, - FreeClusters = (long)xfsSb.fdblocks, + ClusterSize = xfsSb.blocksize, + Clusters = xfsSb.dblocks, + FreeClusters = xfsSb.fdblocks, FreeClustersSpecified = true, - Files = (long)(xfsSb.icount - xfsSb.ifree), + Files = xfsSb.icount - xfsSb.ifree, FilesSpecified = true, Dirty = xfsSb.inprogress > 0, VolumeName = StringHandlers.CToString(xfsSb.fname, Encoding), @@ -188,63 +188,63 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct XFS_Superblock { - public uint magicnum; - public uint blocksize; - public ulong dblocks; - public ulong rblocks; - public ulong rextents; - public Guid uuid; - public ulong logstat; - public ulong rootino; - public ulong rbmino; - public ulong rsumino; - public uint rextsize; - public uint agblocks; - public uint agcount; - public uint rbmblocks; - public uint logblocks; - public ushort version; - public ushort sectsize; - public ushort inodesize; - public ushort inopblock; + public readonly uint magicnum; + public readonly uint blocksize; + public readonly ulong dblocks; + public readonly ulong rblocks; + public readonly ulong rextents; + public readonly Guid uuid; + public readonly ulong logstat; + public readonly ulong rootino; + public readonly ulong rbmino; + public readonly ulong rsumino; + public readonly uint rextsize; + public readonly uint agblocks; + public readonly uint agcount; + public readonly uint rbmblocks; + public readonly uint logblocks; + public readonly ushort version; + public readonly ushort sectsize; + public readonly ushort inodesize; + public readonly ushort inopblock; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] - public byte[] fname; - public byte blocklog; - public byte sectlog; - public byte inodelog; - public byte inopblog; - public byte agblklog; - public byte rextslog; - public byte inprogress; - public byte imax_pct; - public ulong icount; - public ulong ifree; - public ulong fdblocks; - public ulong frextents; - public ulong uquotino; - public ulong gquotino; - public ushort qflags; - public byte flags; - public byte shared_vn; - public ulong inoalignmt; - public ulong unit; - public ulong width; - public byte dirblklog; - public byte logsectlog; - public ushort logsectsize; - public uint logsunit; - public uint features2; - public uint bad_features2; - public uint features_compat; - public uint features_ro_compat; - public uint features_incompat; - public uint features_log_incompat; + public readonly byte[] fname; + public readonly byte blocklog; + public readonly byte sectlog; + public readonly byte inodelog; + public readonly byte inopblog; + public readonly byte agblklog; + public readonly byte rextslog; + public readonly byte inprogress; + public readonly byte imax_pct; + public readonly ulong icount; + public readonly ulong ifree; + public readonly ulong fdblocks; + public readonly ulong frextents; + public readonly ulong uquotino; + public readonly ulong gquotino; + public readonly ushort qflags; + public readonly byte flags; + public readonly byte shared_vn; + public readonly ulong inoalignmt; + public readonly ulong unit; + public readonly ulong width; + public readonly byte dirblklog; + public readonly byte logsectlog; + public readonly ushort logsectsize; + public readonly uint logsunit; + public readonly uint features2; + public readonly uint bad_features2; + public readonly uint features_compat; + public readonly uint features_ro_compat; + public readonly uint features_incompat; + public readonly uint features_log_incompat; // This field is little-endian while rest of superblock is big-endian - public uint crc; - public uint spino_align; - public ulong pquotino; - public ulong lsn; - public Guid meta_uuid; + public readonly uint crc; + public readonly uint spino_align; + public readonly ulong pquotino; + public readonly ulong lsn; + public readonly Guid meta_uuid; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/Xia.cs b/DiscImageChef.Filesystems/Xia.cs index dcc1945df..34b8a342c 100644 --- a/DiscImageChef.Filesystems/Xia.cs +++ b/DiscImageChef.Filesystems/Xia.cs @@ -106,7 +106,7 @@ namespace DiscImageChef.Filesystems { Bootable = !ArrayHelpers.ArrayIsNullOrEmpty(supblk.s_boot_segment), Clusters = supblk.s_nzones, - ClusterSize = (int)supblk.s_zone_size, + ClusterSize = supblk.s_zone_size, Type = "Xia filesystem" }; @@ -121,39 +121,39 @@ namespace DiscImageChef.Filesystems { /// 1st sector reserved for boot [MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] - public byte[] s_boot_segment; + public readonly byte[] s_boot_segment; /// the name says it - public uint s_zone_size; + public readonly uint s_zone_size; /// volume size, zone aligned - public uint s_nzones; + public readonly uint s_nzones; /// # of inodes - public uint s_ninodes; + public readonly uint s_ninodes; /// # of data zones - public uint s_ndatazones; + public readonly uint s_ndatazones; /// # of imap zones - public uint s_imap_zones; + public readonly uint s_imap_zones; /// # of zmap zones - public uint s_zmap_zones; + public readonly uint s_zmap_zones; /// first data zone - public uint s_firstdatazone; + public readonly uint s_firstdatazone; /// z size = 1KB << z shift - public uint s_zone_shift; + public readonly uint s_zone_shift; /// max size of a single file - public uint s_max_size; + public readonly uint s_max_size; /// reserved - public uint s_reserved0; + public readonly uint s_reserved0; /// reserved - public uint s_reserved1; + public readonly uint s_reserved1; /// reserved - public uint s_reserved2; + public readonly uint s_reserved2; /// reserved - public uint s_reserved3; + public readonly uint s_reserved3; /// first kernel zone - public uint s_firstkernzone; + public readonly uint s_firstkernzone; /// kernel size in zones - public uint s_kernzones; + public readonly uint s_kernzones; /// magic number for xiafs - public uint s_magic; + public readonly uint s_magic; } /// @@ -162,11 +162,11 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct XiaDirect { - public uint d_ino; - public ushort d_rec_len; - public byte d_name_len; + public readonly uint d_ino; + public readonly ushort d_rec_len; + public readonly byte d_name_len; [MarshalAs(UnmanagedType.ByValArray, SizeConst = XIAFS_NAME_LEN + 1)] - public byte[] d_name; + public readonly byte[] d_name; } /// @@ -175,16 +175,16 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct XiaInode { - public ushort i_mode; - public ushort i_nlinks; - public ushort i_uid; - public ushort i_gid; - public uint i_size; - public uint i_ctime; - public uint i_atime; - public uint i_mtime; + public readonly ushort i_mode; + public readonly ushort i_nlinks; + public readonly ushort i_uid; + public readonly ushort i_gid; + public readonly uint i_size; + public readonly uint i_ctime; + public readonly uint i_atime; + public readonly uint i_mtime; [MarshalAs(UnmanagedType.ByValArray, SizeConst = XIAFS_NUM_BLOCK_POINTERS)] - public uint[] i_zone; + public readonly uint[] i_zone; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/dump.cs b/DiscImageChef.Filesystems/dump.cs index ef9b163e1..c5f67da46 100644 --- a/DiscImageChef.Filesystems/dump.cs +++ b/DiscImageChef.Filesystems/dump.cs @@ -181,7 +181,7 @@ namespace DiscImageChef.Filesystems StringBuilder sb = new StringBuilder(); - XmlFsType = new FileSystemType {ClusterSize = 1024, Clusters = (long)(partition.Size / 1024)}; + XmlFsType = new FileSystemType {ClusterSize = 1024, Clusters = partition.Size / 1024}; if(useOld) { @@ -278,21 +278,21 @@ namespace DiscImageChef.Filesystems struct spcl16 { /// Record type - public short c_type; + public readonly short c_type; /// Dump date public int c_date; /// Previous dump date public int c_ddate; /// Dump volume number - public short c_volume; + public readonly short c_volume; /// Logical block of this record - public int c_tapea; + public readonly int c_tapea; /// Inode number - public ushort c_inumber; + public readonly ushort c_inumber; /// Magic number - public ushort c_magic; + public readonly ushort c_magic; /// Record checksum - public int c_checksum; + public readonly int c_checksum; // Unneeded for now /* struct dinode c_dinode; @@ -306,18 +306,18 @@ namespace DiscImageChef.Filesystems struct spcl_aix { /// Record type - public int c_type; + public readonly int c_type; /// Dump date - public int c_date; + public readonly int c_date; /// Previous dump date - public int c_ddate; + public readonly int c_ddate; /// Dump volume number - public int c_volume; + public readonly int c_volume; /// Logical block of this record - public int c_tapea; - public uint c_inumber; - public uint c_magic; - public int c_checksum; + public readonly int c_tapea; + public readonly uint c_inumber; + public readonly uint c_magic; + public readonly int c_checksum; // Unneeded for now /* public bsd_dinode bsd_c_dinode; @@ -331,61 +331,61 @@ namespace DiscImageChef.Filesystems [StructLayout(LayoutKind.Sequential, Pack = 1)] struct s_spcl { - public int c_type; /* record type (see below) */ - public int c_date; /* date of this dump */ - public int c_ddate; /* date of previous dump */ - public int c_volume; /* dump volume number */ - public int c_tapea; /* logical block of this record */ - public uint c_inumber; /* number of inode */ - public int c_magic; /* magic number (see above) */ - public int c_checksum; /* record checksum */ - public dinode c_dinode; /* ownership and mode of inode */ - public int c_count; /* number of valid c_addr entries */ + public readonly int c_type; /* record type (see below) */ + public readonly int c_date; /* date of this dump */ + public readonly int c_ddate; /* date of previous dump */ + public readonly int c_volume; /* dump volume number */ + public readonly int c_tapea; /* logical block of this record */ + public readonly uint c_inumber; /* number of inode */ + public readonly int c_magic; /* magic number (see above) */ + public readonly int c_checksum; /* record checksum */ + public readonly dinode c_dinode; /* ownership and mode of inode */ + public readonly int c_count; /* number of valid c_addr entries */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = TP_NINDIR)] - public byte[] c_addr; /* 1 => data; 0 => hole in inode */ + public readonly byte[] c_addr; /* 1 => data; 0 => hole in inode */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = LBLSIZE)] - public byte[] c_label; /* dump label */ - public int c_level; /* level of this dump */ + public readonly byte[] c_label; /* dump label */ + public readonly int c_level; /* level of this dump */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = NAMELEN)] - public byte[] c_filesys; /* name of dumpped file system */ + public readonly byte[] c_filesys; /* name of dumpped file system */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = NAMELEN)] - public byte[] c_dev; /* name of dumpped device */ + public readonly byte[] c_dev; /* name of dumpped device */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = NAMELEN)] - public byte[] c_host; /* name of dumpped host */ - public int c_flags; /* additional information */ - public int c_firstrec; /* first record on volume */ - public long c_ndate; /* date of this dump */ - public long c_nddate; /* date of previous dump */ - public long c_ntapea; /* logical block of this record */ - public long c_nfirstrec; /* first record on volume */ + public readonly byte[] c_host; /* name of dumpped host */ + public readonly int c_flags; /* additional information */ + public readonly int c_firstrec; /* first record on volume */ + public readonly long c_ndate; /* date of this dump */ + public readonly long c_nddate; /* date of previous dump */ + public readonly long c_ntapea; /* logical block of this record */ + public readonly long c_nfirstrec; /* first record on volume */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public int[] c_spare; /* reserved for future uses */ + public readonly int[] c_spare; /* reserved for future uses */ } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct dinode { - public ushort di_mode; /* 0: IFMT, permissions; see below. */ - public short di_nlink; /* 2: File link count. */ - public int inumber; /* 4: Lfs: inode number. */ - public ulong di_size; /* 8: File byte count. */ - public int di_atime; /* 16: Last access time. */ - public int di_atimensec; /* 20: Last access time. */ - public int di_mtime; /* 24: Last modified time. */ - public int di_mtimensec; /* 28: Last modified time. */ - public int di_ctime; /* 32: Last inode change time. */ - public int di_ctimensec; /* 36: Last inode change time. */ + public readonly ushort di_mode; /* 0: IFMT, permissions; see below. */ + public readonly short di_nlink; /* 2: File link count. */ + public readonly int inumber; /* 4: Lfs: inode number. */ + public readonly ulong di_size; /* 8: File byte count. */ + public readonly int di_atime; /* 16: Last access time. */ + public readonly int di_atimensec; /* 20: Last access time. */ + public readonly int di_mtime; /* 24: Last modified time. */ + public readonly int di_mtimensec; /* 28: Last modified time. */ + public readonly int di_ctime; /* 32: Last inode change time. */ + public readonly int di_ctimensec; /* 36: Last inode change time. */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = NDADDR)] - public int[] di_db; /* 40: Direct disk blocks. */ + public readonly int[] di_db; /* 40: Direct disk blocks. */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = NIADDR)] - public int[] di_ib; /* 88: Indirect disk blocks. */ - public uint di_flags; /* 100: Status flags (chflags). */ - public uint di_blocks; /* 104: Blocks actually held. */ - public int di_gen; /* 108: Generation number. */ - public uint di_uid; /* 112: File owner. */ - public uint di_gid; /* 116: File group. */ + public readonly int[] di_ib; /* 88: Indirect disk blocks. */ + public readonly uint di_flags; /* 100: Status flags (chflags). */ + public readonly uint di_blocks; /* 104: Blocks actually held. */ + public readonly int di_gen; /* 108: Generation number. */ + public readonly uint di_uid; /* 112: File owner. */ + public readonly uint di_gid; /* 116: File group. */ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public int[] di_spare; /* 120: Reserved; currently unused */ + public readonly int[] di_spare; /* 120: Reserved; currently unused */ } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/exFAT.cs b/DiscImageChef.Filesystems/exFAT.cs index caa08ec8c..926c8688d 100644 --- a/DiscImageChef.Filesystems/exFAT.cs +++ b/DiscImageChef.Filesystems/exFAT.cs @@ -127,7 +127,7 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("Checksum 0x{0:X8}", chksector.checksum[0]).AppendLine(); - XmlFsType.ClusterSize = (1 << vbr.sectorShift) * (1 << vbr.clusterShift); + XmlFsType.ClusterSize = (uint)((1 << vbr.sectorShift) * (1 << vbr.clusterShift)); XmlFsType.Clusters = vbr.clusterHeapLength; XmlFsType.Dirty = vbr.flags.HasFlag(VolumeFlags.VolumeDirty); XmlFsType.Type = "exFAT"; @@ -149,62 +149,62 @@ namespace DiscImageChef.Filesystems struct VolumeBootRecord { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] - public byte[] jump; + public readonly byte[] jump; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] - public byte[] signature; + public readonly byte[] signature; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 53)] - public byte[] zero; - public ulong offset; - public ulong sectors; - public uint fatOffset; - public uint fatLength; - public uint clusterHeapOffset; - public uint clusterHeapLength; - public uint rootDirectoryCluster; - public uint volumeSerial; - public ushort revision; - public VolumeFlags flags; - public byte sectorShift; - public byte clusterShift; - public byte fats; - public byte drive; - public byte heapUsage; + public readonly byte[] zero; + public readonly ulong offset; + public readonly ulong sectors; + public readonly uint fatOffset; + public readonly uint fatLength; + public readonly uint clusterHeapOffset; + public readonly uint clusterHeapLength; + public readonly uint rootDirectoryCluster; + public readonly uint volumeSerial; + public readonly ushort revision; + public readonly VolumeFlags flags; + public readonly byte sectorShift; + public readonly byte clusterShift; + public readonly byte fats; + public readonly byte drive; + public readonly byte heapUsage; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 53)] - public byte[] reserved; + public readonly byte[] reserved; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 53)] - public byte[] bootCode; - public ushort bootSignature; + public readonly byte[] bootCode; + public readonly ushort bootSignature; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct OemParameter { - public Guid OemParameterType; - public uint eraseBlockSize; - public uint pageSize; - public uint spareBlocks; - public uint randomAccessTime; - public uint programTime; - public uint readCycleTime; - public uint writeCycleTime; + public readonly Guid OemParameterType; + public readonly uint eraseBlockSize; + public readonly uint pageSize; + public readonly uint spareBlocks; + public readonly uint randomAccessTime; + public readonly uint programTime; + public readonly uint readCycleTime; + public readonly uint writeCycleTime; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public byte[] reserved; + public readonly byte[] reserved; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct OemParameterTable { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] - public OemParameter[] parameters; + public readonly OemParameter[] parameters; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] padding; + public readonly byte[] padding; } [StructLayout(LayoutKind.Sequential, Pack = 1)] struct ChecksumSector { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] - public uint[] checksum; + public readonly uint[] checksum; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ext2FS.cs b/DiscImageChef.Filesystems/ext2FS.cs index 41e56e287..1ac901716 100644 --- a/DiscImageChef.Filesystems/ext2FS.cs +++ b/DiscImageChef.Filesystems/ext2FS.cs @@ -356,8 +356,8 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("Volume has {0} blocks of {1} bytes, for a total of {2} bytes", blocks, 1024 << (int)supblk.block_size, blocks * (ulong)(1024 << (int)supblk.block_size)) .AppendLine(); - XmlFsType.Clusters = (long)blocks; - XmlFsType.ClusterSize = 1024 << (int)supblk.block_size; + XmlFsType.Clusters = blocks; + XmlFsType.ClusterSize = (uint)(1024 << (int)supblk.block_size); if(supblk.mount_t > 0 || supblk.mount_c > 0) { if(supblk.mount_t > 0) @@ -463,7 +463,7 @@ namespace DiscImageChef.Filesystems sb.AppendFormat("{0} KiB has been written on volume", supblk.kbytes_written).AppendLine(); sb.AppendFormat("{0} reserved and {1} free blocks", reserved, free).AppendLine(); - XmlFsType.FreeClusters = (long)free; + XmlFsType.FreeClusters = free; XmlFsType.FreeClustersSpecified = true; sb.AppendFormat("{0} inodes with {1} free inodes ({2}%)", supblk.inodes, supblk.free_inodes, supblk.free_inodes * 100 / supblk.inodes).AppendLine(); @@ -640,227 +640,227 @@ namespace DiscImageChef.Filesystems struct ext2FSSuperBlock { /// 0x000, inodes on volume - public uint inodes; + public readonly uint inodes; /// 0x004, blocks on volume - public uint blocks; + public readonly uint blocks; /// 0x008, reserved blocks - public uint reserved_blocks; + public readonly uint reserved_blocks; /// 0x00C, free blocks count - public uint free_blocks; + public readonly uint free_blocks; /// 0x010, free inodes count - public uint free_inodes; + public readonly uint free_inodes; /// 0x014, first data block - public uint first_block; + public readonly uint first_block; /// 0x018, block size public uint block_size; /// 0x01C, fragment size - public int frag_size; + public readonly int frag_size; /// 0x020, blocks per group - public uint blocks_per_grp; + public readonly uint blocks_per_grp; /// 0x024, fragments per group - public uint flags_per_grp; + public readonly uint flags_per_grp; /// 0x028, inodes per group - public uint inodes_per_grp; + public readonly uint inodes_per_grp; /// 0x02C, last mount time - public uint mount_t; + public readonly uint mount_t; /// 0x030, last write time - public uint write_t; + public readonly uint write_t; /// 0x034, mounts count - public ushort mount_c; + public readonly ushort mount_c; /// 0x036, max mounts - public short max_mount_c; + public readonly short max_mount_c; /// 0x038, (little endian) - public ushort magic; + public readonly ushort magic; /// 0x03A, filesystem state - public ushort state; + public readonly ushort state; /// 0x03C, behaviour on errors - public ushort err_behaviour; + public readonly ushort err_behaviour; /// 0x03E, From 0.5b onward - public ushort minor_revision; + public readonly ushort minor_revision; /// 0x040, last check time - public uint check_t; + public readonly uint check_t; /// 0x044, max time between checks - public uint check_inv; + public readonly uint check_inv; // From 0.5a onward /// 0x048, Creation OS - public uint creator_os; + public readonly uint creator_os; /// 0x04C, Revison level - public uint revision; + public readonly uint revision; /// 0x050, Default UID for reserved blocks - public ushort default_uid; + public readonly ushort default_uid; /// 0x052, Default GID for reserved blocks - public ushort default_gid; + public readonly ushort default_gid; // From 0.5b onward /// 0x054, First unreserved inode - public uint first_inode; + public readonly uint first_inode; /// 0x058, inode size - public ushort inode_size; + public readonly ushort inode_size; /// 0x05A, Block group number of THIS superblock - public ushort block_group_no; + public readonly ushort block_group_no; /// 0x05C, Compatible features set - public uint ftr_compat; + public readonly uint ftr_compat; /// 0x060, Incompatible features set - public uint ftr_incompat; + public readonly uint ftr_incompat; // Found on Linux 2.0.40 /// 0x064, Read-only compatible features set - public uint ftr_ro_compat; + public readonly uint ftr_ro_compat; // Found on Linux 2.1.132 /// 0x068, 16 bytes, UUID - public Guid uuid; + public readonly Guid uuid; /// 0x078, 16 bytes, volume name [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] volume_name; + public readonly byte[] volume_name; /// 0x088, 64 bytes, where last mounted [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] - public byte[] last_mount_dir; + public readonly byte[] last_mount_dir; /// 0x0C8, Usage bitmap algorithm, for compression - public uint algo_usage_bmp; + public readonly uint algo_usage_bmp; /// 0x0CC, Block to try to preallocate - public byte prealloc_blks; + public readonly byte prealloc_blks; /// 0x0CD, Blocks to try to preallocate for directories - public byte prealloc_dir_blks; + public readonly byte prealloc_dir_blks; /// 0x0CE, Per-group desc for online growth - public ushort rsrvd_gdt_blocks; + public readonly ushort rsrvd_gdt_blocks; // Found on Linux 2.4 // ext3 /// 0x0D0, 16 bytes, UUID of journal superblock - public Guid journal_uuid; + public readonly Guid journal_uuid; /// 0x0E0, inode no. of journal file - public uint journal_inode; + public readonly uint journal_inode; /// 0x0E4, device no. of journal file - public uint journal_dev; + public readonly uint journal_dev; /// 0x0E8, Start of list of inodes to delete - public uint last_orphan; + public readonly uint last_orphan; /// 0x0EC, First byte of 128bit HTREE hash seed - public uint hash_seed_1; + public readonly uint hash_seed_1; /// 0x0F0, Second byte of 128bit HTREE hash seed - public uint hash_seed_2; + public readonly uint hash_seed_2; /// 0x0F4, Third byte of 128bit HTREE hash seed - public uint hash_seed_3; + public readonly uint hash_seed_3; /// 0x0F8, Fourth byte of 128bit HTREE hash seed - public uint hash_seed_4; + public readonly uint hash_seed_4; /// 0x0FC, Hash version - public byte hash_version; + public readonly byte hash_version; /// 0x0FD, Journal backup type - public byte jnl_backup_type; + public readonly byte jnl_backup_type; /// 0x0FE, Size of group descriptor - public ushort desc_grp_size; + public readonly ushort desc_grp_size; /// 0x100, Default mount options - public uint default_mnt_opts; + public readonly uint default_mnt_opts; /// 0x104, First metablock block group - public uint first_meta_bg; + public readonly uint first_meta_bg; // Introduced with ext4, some can be ext3 /// 0x108, Filesystem creation time - public uint mkfs_t; + public readonly uint mkfs_t; /// Backup of the journal inode [MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)] - public uint[] jnl_blocks; + public readonly uint[] jnl_blocks; // Following 3 fields are valid if EXT4_FEATURE_COMPAT_64BIT is set /// 0x14C, High 32bits of blocks no. - public uint blocks_hi; + public readonly uint blocks_hi; /// 0x150, High 32bits of reserved blocks no. - public uint reserved_blocks_hi; + public readonly uint reserved_blocks_hi; /// 0x154, High 32bits of free blocks no. - public uint free_blocks_hi; + public readonly uint free_blocks_hi; /// 0x158, inodes minimal size in bytes - public ushort min_inode_size; + public readonly ushort min_inode_size; /// 0x15A, Bytes reserved by new inodes - public ushort rsv_inode_size; + public readonly ushort rsv_inode_size; /// 0x15C, Flags - public uint flags; + public readonly uint flags; /// 0x160, RAID stride - public ushort raid_stride; + public readonly ushort raid_stride; /// 0x162, Waiting seconds in MMP check - public ushort mmp_interval; + public readonly ushort mmp_interval; /// 0x164, Block for multi-mount protection - public ulong mmp_block; + public readonly ulong mmp_block; /// 0x16C, Blocks on all data disks (N*stride) - public uint raid_stripe_width; + public readonly uint raid_stripe_width; /// 0x170, FLEX_BG group size - public byte flex_bg_grp_size; + public readonly byte flex_bg_grp_size; /// 0x171 Metadata checksum algorithm - public byte checksum_type; + public readonly byte checksum_type; /// 0x172 Versioning level for encryption - public byte encryption_level; + public readonly byte encryption_level; /// 0x173 Padding - public ushort padding; + public readonly ushort padding; // Following are introduced with ext4 /// 0x174, Kibibytes written in volume lifetime - public ulong kbytes_written; + public readonly ulong kbytes_written; /// 0x17C, Active snapshot inode number - public uint snapshot_inum; + public readonly uint snapshot_inum; /// 0x180, Active snapshot sequential ID - public uint snapshot_id; + public readonly uint snapshot_id; /// 0x184, Reserved blocks for active snapshot's future use - public ulong snapshot_blocks; + public readonly ulong snapshot_blocks; /// 0x18C, inode number of the on-disk start of the snapshot list - public uint snapshot_list; + public readonly uint snapshot_list; // Optional ext4 error-handling features /// 0x190, total registered filesystem errors - public uint error_count; + public readonly uint error_count; /// 0x194, time on first error - public uint first_error_t; + public readonly uint first_error_t; /// 0x198, inode involved in first error - public uint first_error_inode; + public readonly uint first_error_inode; /// 0x19C, block involved of first error - public ulong first_error_block; + public readonly ulong first_error_block; /// 0x1A0, 32 bytes, function where the error happened [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] first_error_func; + public readonly byte[] first_error_func; /// 0x1B0, line number where error happened - public uint first_error_line; + public readonly uint first_error_line; /// 0x1B4, time of most recent error - public uint last_error_t; + public readonly uint last_error_t; /// 0x1B8, inode involved in last error - public uint last_error_inode; + public readonly uint last_error_inode; /// 0x1BC, line number where error happened - public uint last_error_line; + public readonly uint last_error_line; /// 0x1C0, block involved of last error - public ulong last_error_block; + public readonly ulong last_error_block; /// 0x1C8, 32 bytes, function where the error happened [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] - public byte[] last_error_func; + public readonly byte[] last_error_func; // End of optional error-handling features // 0x1D8, 64 bytes, last used mount options [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] - public byte[] mount_options; + public readonly byte[] mount_options; /// Inode for user quota - public uint usr_quota_inum; + public readonly uint usr_quota_inum; /// Inode for group quota - public uint grp_quota_inum; + public readonly uint grp_quota_inum; /// Overhead clusters in volume - public uint overhead_clusters; + public readonly uint overhead_clusters; /// Groups with sparse_super2 SBs [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] - public uint[] backup_bgs; + public readonly uint[] backup_bgs; /// Encryption algorithms in use [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] - public byte[] encrypt_algos; + public readonly byte[] encrypt_algos; /// Salt used for string2key algorithm [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] - public byte[] encrypt_pw_salt; + public readonly byte[] encrypt_pw_salt; /// Inode number of lost+found - public uint lpf_inum; + public readonly uint lpf_inum; /// Inode number for tracking project quota - public uint prj_quota_inum; + public readonly uint prj_quota_inum; /// crc32c(uuid) if csum_seed is set - public uint checksum_seed; + public readonly uint checksum_seed; /// Reserved [MarshalAs(UnmanagedType.ByValArray, SizeConst = 98)] - public byte[] reserved; + public readonly byte[] reserved; /// crc32c(superblock) - public uint checksum; + public readonly uint checksum; } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/extFS.cs b/DiscImageChef.Filesystems/extFS.cs index 5f957a45e..5c9a70615 100644 --- a/DiscImageChef.Filesystems/extFS.cs +++ b/DiscImageChef.Filesystems/extFS.cs @@ -122,7 +122,7 @@ namespace DiscImageChef.Filesystems FreeClusters = extSb.freecountblk, FreeClustersSpecified = true, ClusterSize = 1024, - Clusters = (long)((partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / 1024) + Clusters = (partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / 1024 }; information = sb.ToString(); diff --git a/DiscImageChef/Commands/CreateSidecar.cs b/DiscImageChef/Commands/CreateSidecar.cs index 76d5dc7ee..a3b5936aa 100644 --- a/DiscImageChef/Commands/CreateSidecar.cs +++ b/DiscImageChef/Commands/CreateSidecar.cs @@ -48,7 +48,7 @@ namespace DiscImageChef.Commands { class CreateSidecarCommand : Command { - int blockSize; + uint blockSize; string encodingName; string inputFile; bool showHelp; @@ -67,7 +67,7 @@ namespace DiscImageChef.Commands { "block-size|b=", "Only used for tapes, indicates block size. Files in the folder whose size is not a multiple of this value will simply be ignored.", - (int i) => blockSize = i + (uint i) => blockSize = i }, {"encoding|e=", "Name of character encoding to use.", s => encodingName = s}, {