REFACTOR: Remove redundant parentheses.

This commit is contained in:
2017-12-20 17:26:28 +00:00
parent a4650c61aa
commit b0936d51c5
160 changed files with 1096 additions and 1106 deletions

View File

@@ -334,8 +334,8 @@ namespace DiscImageChef.Filesystems
oldRoot.tail.checkByte);
DicConsole.DebugWriteLine("ADFS Plugin", "dirChk at 0x200 = {0}", dirChk);
if((oldRoot.header.magic == oldDirMagic && oldRoot.tail.magic == oldDirMagic) ||
(oldRoot.header.magic == newDirMagic && oldRoot.tail.magic == newDirMagic)) return true;
if(oldRoot.header.magic == oldDirMagic && oldRoot.tail.magic == oldDirMagic ||
oldRoot.header.magic == newDirMagic && oldRoot.tail.magic == newDirMagic) return true;
// RISC OS says the old directory can't be in the new location, hard disks created by RISC OS 3.10 do that...
sbSector = newDirectoryLocation / imagePlugin.ImageInfo.SectorSize;
@@ -361,8 +361,8 @@ namespace DiscImageChef.Filesystems
oldRoot.tail.checkByte);
DicConsole.DebugWriteLine("ADFS Plugin", "dirChk at 0x400 = {0}", dirChk);
if((oldRoot.header.magic == oldDirMagic && oldRoot.tail.magic == oldDirMagic) ||
(oldRoot.header.magic == newDirMagic && oldRoot.tail.magic == newDirMagic)) return true;
if(oldRoot.header.magic == oldDirMagic && oldRoot.tail.magic == oldDirMagic ||
oldRoot.header.magic == newDirMagic && oldRoot.tail.magic == newDirMagic) return true;
}
}
@@ -382,7 +382,7 @@ namespace DiscImageChef.Filesystems
byte[] bootSector = imagePlugin.ReadSectors(sbSector + partition.Start, sectorsToRead);
int bootChk = 0;
for(int i = 0; i < 0x1FF; i++) bootChk = ((bootChk & 0xFF) + (bootChk >> 8) + bootSector[i]);
for(int i = 0; i < 0x1FF; i++) bootChk = (bootChk & 0xFF) + (bootChk >> 8) + bootSector[i];
DicConsole.DebugWriteLine("ADFS Plugin", "bootChk = {0}", bootChk);
DicConsole.DebugWriteLine("ADFS Plugin", "bBlock.checksum = {0}", bootSector[0x1FF]);
@@ -412,9 +412,9 @@ namespace DiscImageChef.Filesystems
if(drSb.log2secsize < 8 || drSb.log2secsize > 10) return false;
if(drSb.idlen < (drSb.log2secsize + 3) || drSb.idlen > 19) return false;
if(drSb.idlen < drSb.log2secsize + 3 || drSb.idlen > 19) return false;
if((drSb.disc_size_high >> drSb.log2secsize) != 0) return false;
if(drSb.disc_size_high >> drSb.log2secsize != 0) return false;
if(!ArrayHelpers.ArrayIsNullOrEmpty(drSb.reserved)) return false;
@@ -422,7 +422,7 @@ namespace DiscImageChef.Filesystems
bytes *= 0x100000000;
bytes += drSb.disc_size;
if(bytes > (imagePlugin.GetSectors() * imagePlugin.GetSectorSize())) return false;
if(bytes > imagePlugin.GetSectors() * imagePlugin.GetSectorSize()) return false;
return true;
}
@@ -593,7 +593,7 @@ namespace DiscImageChef.Filesystems
byte[] bootSector = imagePlugin.ReadSectors(sbSector + partition.Start, sectorsToRead);
int bootChk = 0;
for(int i = 0; i < 0x1FF; i++) bootChk = ((bootChk & 0xFF) + (bootChk >> 8) + bootSector[i]);
for(int i = 0; i < 0x1FF; i++) bootChk = (bootChk & 0xFF) + (bootChk >> 8) + bootSector[i];
DicConsole.DebugWriteLine("ADFS Plugin", "bootChk = {0}", bootChk);
DicConsole.DebugWriteLine("ADFS Plugin", "bBlock.checksum = {0}", bootSector[0x1FF]);
@@ -639,9 +639,9 @@ namespace DiscImageChef.Filesystems
if(drSb.log2secsize < 8 || drSb.log2secsize > 10) return;
if(drSb.idlen < (drSb.log2secsize + 3) || drSb.idlen > 19) return;
if(drSb.idlen < drSb.log2secsize + 3 || drSb.idlen > 19) return;
if((drSb.disc_size_high >> drSb.log2secsize) != 0) return;
if(drSb.disc_size_high >> drSb.log2secsize != 0) return;
if(!ArrayHelpers.ArrayIsNullOrEmpty(drSb.reserved)) return;
@@ -653,7 +653,7 @@ namespace DiscImageChef.Filesystems
zones *= 0x100000000;
zones += drSb.nzones;
if(bytes > (imagePlugin.GetSectors() * imagePlugin.GetSectorSize())) return;
if(bytes > imagePlugin.GetSectors() * imagePlugin.GetSectorSize()) return;
xmlFSType = new Schemas.FileSystemType();
@@ -687,7 +687,7 @@ namespace DiscImageChef.Filesystems
xmlFSType.Bootable |= drSb.bootoption != 0; // Or not?
xmlFSType.Clusters = (long)(bytes / (ulong)(1 << drSb.log2secsize));
xmlFSType.ClusterSize = (1 << drSb.log2secsize);
xmlFSType.ClusterSize = 1 << drSb.log2secsize;
xmlFSType.Type = "Acorn Advanced Disc Filing System";
}
@@ -803,7 +803,7 @@ namespace DiscImageChef.Filesystems
/*
Don't add the check byte when calculating its value
*/
sum_vector0 += (sum_vector3 >> 8);
sum_vector0 += sum_vector3 >> 8;
sum_vector1 += map_base[rover + 1] + (sum_vector0 >> 8);
sum_vector2 += map_base[rover + 2] + (sum_vector1 >> 8);
sum_vector3 += map_base[rover + 3] + (sum_vector2 >> 8);
@@ -824,7 +824,7 @@ namespace DiscImageChef.Filesystems
uint carry = sum & 0x1FFF;
sum >>= 13;
sum ^= data[i];
sum += (carry << 19);
sum += carry << 19;
}
return (byte)(((sum & 0xFF000000) >> 24) ^ ((sum & 0xFF0000) >> 16) ^ ((sum & 0xFF00) >> 8) ^ (sum & 0xFF));

View File

@@ -252,10 +252,10 @@ namespace DiscImageChef.Filesystems
ulong[] root_ptrs =
{
b_root_ptr + partition.Start, ((partition.End - partition.Start) + 1) / 2 + partition.Start - 2,
((partition.End - partition.Start) + 1) / 2 + partition.Start - 1,
((partition.End - partition.Start) + 1) / 2 + partition.Start,
((partition.End - partition.Start) + 1) / 2 + partition.Start + 4
b_root_ptr + partition.Start, (partition.End - partition.Start + 1) / 2 + partition.Start - 2,
(partition.End - partition.Start + 1) / 2 + partition.Start - 1,
(partition.End - partition.Start + 1) / 2 + partition.Start,
(partition.End - partition.Start + 1) / 2 + partition.Start + 4
};
RootBlock rblk = new RootBlock();
@@ -333,10 +333,10 @@ namespace DiscImageChef.Filesystems
ulong[] root_ptrs =
{
b_root_ptr + partition.Start, ((partition.End - partition.Start) + 1) / 2 + partition.Start - 2,
((partition.End - partition.Start) + 1) / 2 + partition.Start - 1,
((partition.End - partition.Start) + 1) / 2 + partition.Start,
((partition.End - partition.Start) + 1) / 2 + partition.Start + 4
b_root_ptr + partition.Start, (partition.End - partition.Start + 1) / 2 + partition.Start - 2,
(partition.End - partition.Start + 1) / 2 + partition.Start - 1,
(partition.End - partition.Start + 1) / 2 + partition.Start,
(partition.End - partition.Start + 1) / 2 + partition.Start + 4
};
RootBlock rootBlk = new RootBlock();
@@ -458,7 +458,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.ImageInfo.SectorSize) /
long blocks = (long)((partition.End - partition.Start + 1) * imagePlugin.ImageInfo.SectorSize /
blockSize);
sbInformation.AppendFormat("Volume block size is {0} bytes", blockSize).AppendLine();

View File

@@ -80,7 +80,7 @@ namespace DiscImageChef.Filesystems.AppleDOS
Errno ReadCatalog()
{
MemoryStream catalogMs = new MemoryStream();
ulong lba = (ulong)((vtoc.catalogTrack * sectorsPerTrack) + vtoc.catalogSector);
ulong lba = (ulong)(vtoc.catalogTrack * sectorsPerTrack + vtoc.catalogSector);
totalFileEntries = 0;
catalogCache = new Dictionary<string, ushort>();
fileTypeCache = new Dictionary<string, byte>();
@@ -131,7 +131,7 @@ namespace DiscImageChef.Filesystems.AppleDOS
}
}
lba = (ulong)((catSector.trackOfNext * sectorsPerTrack) + catSector.sectorOfNext);
lba = (ulong)(catSector.trackOfNext * sectorsPerTrack + catSector.sectorOfNext);
if(lba > device.ImageInfo.Sectors) break;
}

View File

@@ -173,7 +173,7 @@ namespace DiscImageChef.Filesystems.AppleDOS
if(!catalogCache.TryGetValue(filename, out ts)) return Errno.NoSuchFile;
ulong lba = (ulong)((((ts & 0xFF00) >> 8) * sectorsPerTrack) + (ts & 0xFF));
ulong lba = (ulong)(((ts & 0xFF00) >> 8) * sectorsPerTrack + (ts & 0xFF));
MemoryStream fileMs = new MemoryStream();
MemoryStream tsListMs = new MemoryStream();
ushort expectedBlock = 0;
@@ -204,7 +204,7 @@ namespace DiscImageChef.Filesystems.AppleDOS
track2UsedByFiles |= entry.track == 2;
usedSectors++;
ulong blockLba = (ulong)((entry.track * sectorsPerTrack) + entry.sector);
ulong blockLba = (ulong)(entry.track * sectorsPerTrack + entry.sector);
if(blockLba == 0) break;
byte[] fileBlock = device.ReadSector(blockLba);
@@ -212,7 +212,7 @@ namespace DiscImageChef.Filesystems.AppleDOS
expectedBlock++;
}
lba = (ulong)((tsSector.nextListTrack * sectorsPerTrack) + tsSector.nextListSector);
lba = (ulong)(tsSector.nextListTrack * sectorsPerTrack + tsSector.nextListSector);
}
if(fileCache.ContainsKey(filename)) fileCache.Remove(filename);

View File

@@ -80,7 +80,7 @@ namespace DiscImageChef.Filesystems
public override bool Identify(DiscImages.ImagePlugin imagePlugin, Partition partition)
{
if((2 + partition.Start) >= partition.End) return false;
if(2 + partition.Start >= partition.End) return false;
byte[] mdb_sector;
ushort drSigWord;
@@ -282,8 +282,7 @@ namespace DiscImageChef.Filesystems
xmlFSType.BackupDate = DateHandlers.MacToDateTime(MDB.drVolBkUp);
xmlFSType.BackupDateSpecified = true;
}
xmlFSType.Bootable = BB.signature == HFSBB_MAGIC ||
(MDB.drFndrInfo0 != 0 || MDB.drFndrInfo3 != 0 || MDB.drFndrInfo5 != 0);
xmlFSType.Bootable = BB.signature == HFSBB_MAGIC || MDB.drFndrInfo0 != 0 || MDB.drFndrInfo3 != 0 || MDB.drFndrInfo5 != 0;
xmlFSType.Clusters = MDB.drNmAlBlks;
xmlFSType.ClusterSize = (int)MDB.drAlBlkSiz;
if(MDB.drCrDate > 0)

View File

@@ -77,7 +77,7 @@ namespace DiscImageChef.Filesystems
public override bool Identify(DiscImages.ImagePlugin imagePlugin, Partition partition)
{
if((2 + partition.Start) >= partition.End) return false;
if(2 + partition.Start >= partition.End) return false;
ushort drSigWord;
ushort xdrStABNt;
@@ -109,7 +109,7 @@ namespace DiscImageChef.Filesystems
drAlBlSt = BigEndianBitConverter
.ToUInt16(vh_sector, 0x41C); // Start of allocated blocks (in 512-byte/block)
hfsp_offset = (ulong)(((drAlBlSt * 512) + (xdrStABNt * drAlBlkSiz)) / imagePlugin.GetSectorSize());
hfsp_offset = (ulong)((drAlBlSt * 512 + xdrStABNt * drAlBlkSiz) / imagePlugin.GetSectorSize());
}
else { hfsp_offset = 0; }
}
@@ -160,7 +160,7 @@ namespace DiscImageChef.Filesystems
drAlBlSt = BigEndianBitConverter
.ToUInt16(vh_sector, 0x41C); // Start of allocated blocks (in 512-byte/block)
hfsp_offset = (ulong)(((drAlBlSt * 512) + (xdrStABNt * drAlBlkSiz)) / imagePlugin.GetSectorSize());
hfsp_offset = (ulong)((drAlBlSt * 512 + xdrStABNt * drAlBlkSiz) / imagePlugin.GetSectorSize());
wrapped = true;
}
else
@@ -251,7 +251,7 @@ namespace DiscImageChef.Filesystems
xmlFSType.BackupDate = DateHandlers.MacToDateTime(HPVH.backupDate);
xmlFSType.BackupDateSpecified = true;
}
xmlFSType.Bootable |= (HPVH.drFndrInfo0 != 0 || HPVH.drFndrInfo3 != 0 || HPVH.drFndrInfo5 != 0);
xmlFSType.Bootable |= HPVH.drFndrInfo0 != 0 || HPVH.drFndrInfo3 != 0 || HPVH.drFndrInfo5 != 0;
xmlFSType.Clusters = HPVH.totalBlocks;
xmlFSType.ClusterSize = (int)HPVH.blockSize;
if(HPVH.createDate > 0)

View File

@@ -119,10 +119,10 @@ namespace DiscImageChef.Filesystems.AppleMFS
StringHandlers.PascalToString(entry.flNam, CurrentEncoding));
}
offset += (50 + entry.flNam.Length);
offset += 50 + entry.flNam.Length;
// "Entries are always an integral number of words"
if((offset % 2) != 0) offset++;
if(offset % 2 != 0) offset++;
// TODO: "Entries don't cross logical block boundaries"
}

View File

@@ -55,7 +55,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
if(!idToEntry.TryGetValue(fileID, out entry)) return Errno.NoSuchFile;
if(fileBlock > (entry.flPyLen / volMDB.drAlBlkSiz)) return Errno.InvalidArgument;
if(fileBlock > entry.flPyLen / volMDB.drAlBlkSiz) return Errno.InvalidArgument;
uint nextBlock = entry.flStBlk;
long relBlock = 0;
@@ -64,7 +64,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
{
if(relBlock == fileBlock)
{
deviceBlock = ((nextBlock - 2) * sectorsPerBlock) + volMDB.drAlBlSt + (long)partitionStart;
deviceBlock = (nextBlock - 2) * sectorsPerBlock + volMDB.drAlBlSt + (long)partitionStart;
return Errno.NoError;
}
@@ -174,23 +174,23 @@ namespace DiscImageChef.Filesystems.AppleMFS
if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0)
{
stat.Blocks = (directoryBlocks.Length / stat.BlockSize) +
(directoryBlocks.Length % stat.BlockSize);
stat.Blocks = directoryBlocks.Length / stat.BlockSize +
directoryBlocks.Length % stat.BlockSize;
stat.Length = directoryBlocks.Length;
}
else if(string.Compare(path, "$Bitmap", StringComparison.InvariantCulture) == 0)
{
stat.Blocks = (blockMapBytes.Length / stat.BlockSize) + (blockMapBytes.Length % stat.BlockSize);
stat.Blocks = blockMapBytes.Length / stat.BlockSize + blockMapBytes.Length % stat.BlockSize;
stat.Length = blockMapBytes.Length;
}
else if(string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 && bootBlocks != null)
{
stat.Blocks = (bootBlocks.Length / stat.BlockSize) + (bootBlocks.Length % stat.BlockSize);
stat.Blocks = bootBlocks.Length / stat.BlockSize + bootBlocks.Length % stat.BlockSize;
stat.Length = bootBlocks.Length;
}
else if(string.Compare(path, "$MDB", StringComparison.InvariantCulture) == 0)
{
stat.Blocks = (mdbBlocks.Length / stat.BlockSize) + (mdbBlocks.Length % stat.BlockSize);
stat.Blocks = mdbBlocks.Length / stat.BlockSize + mdbBlocks.Length % stat.BlockSize;
stat.Length = mdbBlocks.Length;
}
else return Errno.InvalidArgument;

View File

@@ -43,7 +43,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
{
ushort drSigWord;
if((2 + partition.Start) >= partition.End) return false;
if(2 + partition.Start >= partition.End) return false;
byte[] mdb_sector = imagePlugin.ReadSector(2 + partition.Start);

View File

@@ -70,11 +70,11 @@ namespace DiscImageChef.Filesystems.AppleMFS
volMDB.drVN = StringHandlers.PascalToString(variable_size, CurrentEncoding);
directoryBlocks = device.ReadSectors(volMDB.drDirSt + partitionStart, volMDB.drBlLen);
int bytesInBlockMap = ((volMDB.drNmAlBlks * 12) / 8) + ((volMDB.drNmAlBlks * 12) % 8);
int bytesInBlockMap = volMDB.drNmAlBlks * 12 / 8 + volMDB.drNmAlBlks * 12 % 8;
int bytesBeforeBlockMap = 64;
int bytesInWholeMDB = bytesInBlockMap + bytesBeforeBlockMap;
int sectorsInWholeMDB = (bytesInWholeMDB / (int)device.ImageInfo.SectorSize) +
(bytesInWholeMDB % (int)device.ImageInfo.SectorSize);
int sectorsInWholeMDB = bytesInWholeMDB / (int)device.ImageInfo.SectorSize +
bytesInWholeMDB % (int)device.ImageInfo.SectorSize;
byte[] wholeMDB = device.ReadSectors(partitionStart + 2, (uint)sectorsInWholeMDB);
blockMapBytes = new byte[bytesInBlockMap];
Array.Copy(wholeMDB, bytesBeforeBlockMap, blockMapBytes, 0, blockMapBytes.Length);
@@ -100,7 +100,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
if(i + 5 < blockMap.Length) blockMap[i + 4] = (tmp2 & 0xFFF0) >> 4;
if(i + 6 < blockMap.Length) blockMap[i + 5] = ((tmp2 & 0xF) << 8) + ((tmp3 & 0xFF000000) >> 24);
if(i + 7 < blockMap.Length) blockMap[i + 6] = (tmp3 & 0xFFF000) >> 12;
if(i + 8 < blockMap.Length) blockMap[i + 7] = (tmp3 & 0xFFF);
if(i + 8 < blockMap.Length) blockMap[i + 7] = tmp3 & 0xFFF;
offset += 12;
}

View File

@@ -80,7 +80,7 @@ namespace DiscImageChef.Filesystems
if(imagePlugin.GetSectorSize() < AFS_SUPERBLOCK_SIZE)
run = AFS_SUPERBLOCK_SIZE / imagePlugin.GetSectorSize();
if((sector + partition.Start) >= partition.End) return false;
if(sector + partition.Start >= partition.End) return false;
uint magic;

View File

@@ -78,7 +78,7 @@ namespace DiscImageChef.Filesystems
public override bool Identify(DiscImages.ImagePlugin imagePlugin, Partition partition)
{
if((2 + partition.Start) >= partition.End) return false;
if(2 + partition.Start >= partition.End) return false;
uint magic;
uint magic_be;
@@ -166,7 +166,7 @@ namespace DiscImageChef.Filesystems
if(besb.magic1 != BEFS_MAGIC1 || besb.fs_byte_order != BEFS_ENDIAN || besb.magic2 != BEFS_MAGIC2 ||
besb.magic3 != BEFS_MAGIC3 || besb.root_dir_len != 1 || besb.indices_len != 1 ||
(1 << (int)besb.block_shift) != besb.block_size)
1 << (int)besb.block_shift != besb.block_size)
{
sb.AppendLine("Superblock seems corrupt, following information may be incorrect");
sb.AppendFormat("Magic 1: 0x{0:X8} (Should be 0x42465331)", besb.magic1).AppendLine();

View File

@@ -132,7 +132,7 @@ namespace DiscImageChef.Filesystems
ulong sbSectorOff = 0x10000 / imagePlugin.GetSectorSize();
uint sbSectorSize = 0x1000 / imagePlugin.GetSectorSize();
if((sbSectorOff + partition.Start) >= partition.End) return false;
if(sbSectorOff + partition.Start >= partition.End) return false;
byte[] sector = imagePlugin.ReadSectors(sbSectorOff + partition.Start, sbSectorSize);
SuperBlock btrfsSb;

View File

@@ -110,7 +110,7 @@ namespace DiscImageChef.Filesystems.CPM
else if(entry.statusUser == 0x21)
{
if(directory[off + 1] == 0x00) { thirdPartyTimestamps = true; }
else standardTimestamps |= (directory[off + 21] == 0x00 && directory[off + 31] == 0x00);
else standardTimestamps |= directory[off + 21] == 0x00 && directory[off + 31] == 0x00;
}
}

View File

@@ -194,9 +194,9 @@ namespace DiscImageChef.Filesystems.CPM
Marshal.FreeHGlobal(amsPtr);
// Check that format byte and sidedness indicate the same number of sizes
if((amsSb.format == 0 && (amsSb.sidedness & 0x02) == 0) ||
(amsSb.format == 2 && (amsSb.sidedness & 0x02) == 1) ||
(amsSb.format == 2 && (amsSb.sidedness & 0x02) == 2))
if(amsSb.format == 0 && (amsSb.sidedness & 0x02) == 0 ||
amsSb.format == 2 && (amsSb.sidedness & 0x02) == 1 ||
amsSb.format == 2 && (amsSb.sidedness & 0x02) == 2)
{
// Calculate device limits
sides = (ulong)(amsSb.format == 0 ? 1 : 2);
@@ -207,7 +207,7 @@ namespace DiscImageChef.Filesystems.CPM
if(sectorSize == imagePlugin.GetSectorSize() && sectorCount == imagePlugin.GetSectors())
{
cpmFound = true;
firstDirectorySector = (ulong)((amsSb.off * amsSb.spt));
firstDirectorySector = (ulong)(amsSb.off * amsSb.spt);
// Build a DiscParameterBlock
dpb = new DiscParameterBlock();
@@ -233,7 +233,7 @@ namespace DiscImageChef.Filesystems.CPM
for(int i = 0; i < dpb.psh; i++) dpb.phm += (byte)Math.Pow(2, i);
dpb.spt = (ushort)(amsSb.spt * (sectorSize / 128));
uint directoryLength = (uint)((((ulong)dpb.drm + 1) * 32) / sectorSize);
uint directoryLength = (uint)(((ulong)dpb.drm + 1) * 32 / sectorSize);
directory = imagePlugin.ReadSectors(firstDirectorySector + partition.Start,
directoryLength);
@@ -314,7 +314,7 @@ namespace DiscImageChef.Filesystems.CPM
sectorsInPartition + partition.Start <= partition.End)
{
cpmFound = true;
firstDirectorySector = (ulong)((hddSb.off * hddSb.sectorsPerTrack));
firstDirectorySector = (ulong)(hddSb.off * hddSb.sectorsPerTrack);
// Build a DiscParameterBlock
dpb = new DiscParameterBlock();
@@ -330,7 +330,7 @@ namespace DiscImageChef.Filesystems.CPM
dpb.phm = 0; // Needed?
dpb.psh = 0; // Needed?
dpb.spt = hddSb.spt;
uint directoryLength = (uint)((((ulong)dpb.drm + 1) * 32) / sectorSize);
uint directoryLength = (uint)(((ulong)dpb.drm + 1) * 32 / sectorSize);
directory = imagePlugin.ReadSectors(firstDirectorySector + partition.Start,
directoryLength);
DicConsole.DebugWriteLine("CP/M Plugin", "Found CP/M-86 hard disk superblock.");
@@ -760,7 +760,7 @@ namespace DiscImageChef.Filesystems.CPM
if(cpmFound)
{
uint directoryLength = (uint)((((ulong)dpb.drm + 1) * 32) / imagePlugin.GetSectorSize());
uint directoryLength = (uint)(((ulong)dpb.drm + 1) * 32 / imagePlugin.GetSectorSize());
directory = imagePlugin.ReadSectors(firstDirectorySector86 + partition.Start, directoryLength);
DicConsole.DebugWriteLine("CP/M Plugin", "Found CP/M-86 floppy identifier.");
}
@@ -799,7 +799,7 @@ namespace DiscImageChef.Filesystems.CPM
if(def.sofs != 0) offset = (ulong)def.sofs;
else offset = (ulong)(def.ofs * def.sectorsPerTrack);
int dirLen = ((def.drm + 1) * 32) / def.bytesPerSector;
int dirLen = (def.drm + 1) * 32 / def.bytesPerSector;
if(def.sides == 1)
{
@@ -819,7 +819,7 @@ namespace DiscImageChef.Filesystems.CPM
// Skip first track (first side)
for(int m = 0; m < def.side2.sectorIds.Length; m++)
sectorMask[m + def.side1.sectorIds.Length] =
(def.side2.sectorIds[m] - def.side2.sectorIds[0]) +
def.side2.sectorIds[m] - def.side2.sectorIds[0] +
def.side1.sectorIds.Length;
}
// Head changes after whole side
@@ -831,7 +831,7 @@ namespace DiscImageChef.Filesystems.CPM
// Skip first track (first side) and first track (second side)
for(int m = 0; m < def.side1.sectorIds.Length; m++)
sectorMask[m + def.side1.sectorIds.Length] =
(def.side1.sectorIds[m] - def.side1.sectorIds[0]) +
def.side1.sectorIds[m] - def.side1.sectorIds[0] +
def.side1.sectorIds.Length + def.side2.sectorIds.Length;
}
// TODO: Implement COLUMBIA ordering
@@ -865,7 +865,7 @@ namespace DiscImageChef.Filesystems.CPM
{
byte[] dirSector =
imagePlugin.ReadSector((ulong)((int)offset + (int)partition.Start +
(p / sectorMask.Length) * sectorMask.Length +
p / sectorMask.Length * sectorMask.Length +
sectorMask[p % sectorMask.Length]));
ms.Write(dirSector, 0, dirSector.Length);
}
@@ -942,7 +942,7 @@ namespace DiscImageChef.Filesystems.CPM
break;
}
dpb.spt = (ushort)((def.sectorsPerTrack * def.bytesPerSector) / 128);
dpb.spt = (ushort)(def.sectorsPerTrack * def.bytesPerSector / 128);
cpmFound = true;
workingDefinition = def;
@@ -985,7 +985,7 @@ namespace DiscImageChef.Filesystems.CPM
sb.AppendFormat("Identified as {0}", workingDefinition.comment).AppendLine();
sb.AppendFormat("Volume block is {0} bytes", 128 << dpb.bsh).AppendLine();
if(dpb.dsm > 0)
sb.AppendFormat("Volume contains {0} blocks ({1} bytes)", dpb.dsm, (dpb.dsm) * (128 << dpb.bsh))
sb.AppendFormat("Volume contains {0} blocks ({1} bytes)", dpb.dsm, dpb.dsm * (128 << dpb.bsh))
.AppendLine();
sb.AppendFormat("Volume contains {0} directory entries", dpb.drm + 1).AppendLine();
if(workingDefinition.sofs > 0)
@@ -1051,7 +1051,7 @@ namespace DiscImageChef.Filesystems.CPM
sb.AppendFormat("Volume updated on {0}", DateHandlers.CPMToDateTime(labelUpdateDate)).AppendLine();
xmlFSType = new Schemas.FileSystemType();
xmlFSType.Bootable |= (workingDefinition.sofs > 0 || workingDefinition.ofs > 0);
xmlFSType.Bootable |= workingDefinition.sofs > 0 || workingDefinition.ofs > 0;
xmlFSType.ClusterSize = 128 << dpb.bsh;
if(dpb.dsm > 0) xmlFSType.Clusters = dpb.dsm;
else xmlFSType.Clusters = (long)(partition.End - partition.Start);

View File

@@ -73,7 +73,7 @@ namespace DiscImageChef.Filesystems.CPM
// Skip first track (first side)
for(int m = 0; m < workingDefinition.side2.sectorIds.Length; m++)
sectorMask[m + workingDefinition.side1.sectorIds.Length] =
(workingDefinition.side2.sectorIds[m] - workingDefinition.side2.sectorIds[0]) +
workingDefinition.side2.sectorIds[m] - workingDefinition.side2.sectorIds[0] +
workingDefinition.side1.sectorIds.Length;
}
// Head changes after whole side
@@ -85,7 +85,7 @@ namespace DiscImageChef.Filesystems.CPM
// Skip first track (first side) and first track (second side)
for(int m = 0; m < workingDefinition.side1.sectorIds.Length; m++)
sectorMask[m + workingDefinition.side1.sectorIds.Length] =
(workingDefinition.side1.sectorIds[m] - workingDefinition.side1.sectorIds[0]) +
workingDefinition.side1.sectorIds[m] - workingDefinition.side1.sectorIds[0] +
workingDefinition.side1.sectorIds.Length + workingDefinition.side2.sectorIds.Length;
// TODO: Implement CYLINDERS ordering
@@ -128,7 +128,7 @@ namespace DiscImageChef.Filesystems.CPM
for(int p = 0; p <= (int)(partition.End - partition.Start); p++)
{
byte[] readSector =
device.ReadSector((ulong)((int)partition.Start + (p / sectorMask.Length) * sectorMask.Length +
device.ReadSector((ulong)((int)partition.Start + p / sectorMask.Length * sectorMask.Length +
sectorMask[p % sectorMask.Length]));
if(workingDefinition.complement)
{
@@ -156,7 +156,7 @@ namespace DiscImageChef.Filesystems.CPM
// May it happen? Just in case, CP/M blocks are smaller than physical sectors
if(sector.Length > blockSize)
{
for(int i = 0; i < (sector.Length / blockSize); i++)
for(int i = 0; i < sector.Length / blockSize; i++)
{
byte[] tmp = new byte[blockSize];
Array.Copy(sector, blockSize * i, tmp, 0, blockSize);
@@ -183,7 +183,7 @@ namespace DiscImageChef.Filesystems.CPM
DicConsole.DebugWriteLine("CP/M Plugin", "Reading directory.");
int dirOff;
int dirSectors = ((dpb.drm + 1) * 32) / workingDefinition.bytesPerSector;
int dirSectors = (dpb.drm + 1) * 32 / workingDefinition.bytesPerSector;
if(workingDefinition.sofs > 0) dirOff = workingDefinition.sofs;
else dirOff = workingDefinition.ofs * workingDefinition.sectorsPerTrack;
@@ -235,7 +235,7 @@ namespace DiscImageChef.Filesystems.CPM
bool rdOnly = (entry.filename[0] & 0x80) == 0x80 || (entry.extension[0] & 0x80) == 0x80;
bool system = (entry.filename[1] & 0x80) == 0x80 || (entry.extension[2] & 0x80) == 0x80;
//bool backed = (entry.filename[3] & 0x80) == 0x80 || (entry.extension[3] & 0x80) == 0x80;
int user = (entry.statusUser & 0x0F);
int user = entry.statusUser & 0x0F;
bool validEntry = true;
@@ -259,7 +259,7 @@ namespace DiscImageChef.Filesystems.CPM
if(user > 0) filename = string.Format("{0:X1}:{1}", user, filename);
if(!string.IsNullOrEmpty(extension)) filename = filename + "." + extension;
int entryNo = ((32 * entry.extentCounter) + entry.extentCounterHigh) / (dpb.exm + 1);
int entryNo = (32 * entry.extentCounter + entry.extentCounterHigh) / (dpb.exm + 1);
List<ushort> blocks;
Dictionary<int, List<ushort>> extentBlocks;
FileEntryInfo fInfo;
@@ -332,7 +332,7 @@ namespace DiscImageChef.Filesystems.CPM
bool rdOnly = (entry.filename[0] & 0x80) == 0x80 || (entry.extension[0] & 0x80) == 0x80;
bool system = (entry.filename[1] & 0x80) == 0x80 || (entry.extension[2] & 0x80) == 0x80;
//bool backed = (entry.filename[3] & 0x80) == 0x80 || (entry.extension[3] & 0x80) == 0x80;
int user = (entry.statusUser & 0x0F);
int user = entry.statusUser & 0x0F;
bool validEntry = true;
@@ -356,7 +356,7 @@ namespace DiscImageChef.Filesystems.CPM
if(user > 0) filename = string.Format("{0:X1}:{1}", user, filename);
if(!string.IsNullOrEmpty(extension)) filename = filename + "." + extension;
int entryNo = ((32 * entry.extentCounterHigh) + entry.extentCounter) / (dpb.exm + 1);
int entryNo = (32 * entry.extentCounterHigh + entry.extentCounter) / (dpb.exm + 1);
List<ushort> blocks;
Dictionary<int, List<ushort>> extentBlocks;
FileEntryInfo fInfo;
@@ -427,7 +427,7 @@ namespace DiscImageChef.Filesystems.CPM
entry = (PasswordEntry)Marshal.PtrToStructure(dirPtr, typeof(PasswordEntry));
Marshal.FreeHGlobal(dirPtr);
int user = (entry.userNumber & 0x0F);
int user = entry.userNumber & 0x0F;
for(int i = 0; i < 8; i++) entry.filename[i] &= 0x7F;
for(int i = 0; i < 3; i++) entry.extension[i] &= 0x7F;

View File

@@ -69,7 +69,7 @@ namespace DiscImageChef.Filesystems
public override bool Identify(DiscImages.ImagePlugin imagePlugin, Partition partition)
{
if((2 + partition.Start) >= partition.End) return false;
if(2 + partition.Start >= partition.End) return false;
ushort bps;
byte spc;
@@ -202,31 +202,31 @@ namespace DiscImageChef.Filesystems
if(bits_in_bps == 1 && correct_spc && fats_no <= 2 && sectors == 0 && fat_sectors == 0 &&
fat32_signature == 0x28)
return big_sectors == 0
? huge_sectors <= (partition.End - partition.Start) + 1
: big_sectors <= (partition.End - partition.Start) + 1;
? huge_sectors <= partition.End - partition.Start + 1
: big_sectors <= partition.End - partition.Start + 1;
// MSX-DOS FAT12
if(bits_in_bps == 1 && correct_spc && fats_no <= 2 && root_entries > 0 &&
sectors <= (partition.End - partition.Start) + 1 && fat_sectors > 0 &&
sectors <= partition.End - partition.Start + 1 && fat_sectors > 0 &&
msx_string == "VOL_ID") return true;
// EBPB
if(bits_in_bps == 1 && correct_spc && fats_no <= 2 && root_entries > 0 && fat_sectors > 0 &&
(bpb_signature == 0x28 || bpb_signature == 0x29))
return sectors == 0
? big_sectors <= (partition.End - partition.Start) + 1
: sectors <= (partition.End - partition.Start) + 1;
? big_sectors <= partition.End - partition.Start + 1
: sectors <= partition.End - partition.Start + 1;
// BPB
if(bits_in_bps == 1 && correct_spc && reserved_secs < (partition.End - partition.Start) && fats_no <= 2 &&
if(bits_in_bps == 1 && correct_spc && reserved_secs < partition.End - partition.Start && fats_no <= 2 &&
root_entries > 0 && fat_sectors > 0)
return sectors == 0
? big_sectors <= (partition.End - partition.Start) + 1
: sectors <= (partition.End - partition.Start) + 1;
? big_sectors <= partition.End - partition.Start + 1
: sectors <= partition.End - partition.Start + 1;
// Apricot BPB
if(bits_in_apricot_bps == 1 && apricot_correct_spc &&
apricot_reserved_secs < (partition.End - partition.Start) && apricot_fats_no <= 2 &&
apricot_reserved_secs < partition.End - partition.Start && apricot_fats_no <= 2 &&
apricot_root_entries > 0 && apricot_fat_sectors > 0 &&
apricot_sectors <= (partition.End - partition.Start) + 1 && apricot_partitions == 0) return true;
apricot_sectors <= partition.End - partition.Start + 1 && apricot_partitions == 0) return true;
// All FAT12 without BPB can only be used on floppies, without partitions.
if(partition.Start != 0) return false;
@@ -258,7 +258,7 @@ namespace DiscImageChef.Filesystems
{
for(int c = 0; c < 11; c++)
{
if((root_dir[c + e] < 0x20 && root_dir[c + e] != 0x00 && root_dir[c + e] != 0x05) ||
if(root_dir[c + e] < 0x20 && root_dir[c + e] != 0x00 && root_dir[c + e] != 0x05 ||
root_dir[c + e] == 0xFF || root_dir[c + e] == 0x2E)
{
valid_root_dir = false;
@@ -474,11 +474,11 @@ namespace DiscImageChef.Filesystems
{
DicConsole.DebugWriteLine("FAT plugin", "Using short FAT32 BPB");
useShortFAT32 = shortFat32BPB.big_sectors == 0
? shortFat32BPB.huge_sectors <= (partition.End - partition.Start) + 1
: shortFat32BPB.big_sectors <= (partition.End - partition.Start) + 1;
? shortFat32BPB.huge_sectors <= partition.End - partition.Start + 1
: shortFat32BPB.big_sectors <= partition.End - partition.Start + 1;
}
else if(bits_in_bps_msx == 1 && correct_spc_msx && msxBPB.fats_no <= 2 && msxBPB.root_ent > 0 &&
msxBPB.sectors <= (partition.End - partition.Start) + 1 && msxBPB.spfat > 0 &&
msxBPB.sectors <= partition.End - partition.Start + 1 && msxBPB.spfat > 0 &&
Encoding.ASCII.GetString(msxBPB.vol_id) == "VOL_ID")
{
DicConsole.DebugWriteLine("FAT plugin", "Using MSX BPB");
@@ -486,7 +486,7 @@ namespace DiscImageChef.Filesystems
}
else if(bits_in_bps_apricot == 1 && correct_spc_apricot && ApricotBPB.mainBPB.fats_no <= 2 &&
ApricotBPB.mainBPB.root_ent > 0 &&
ApricotBPB.mainBPB.sectors <= (partition.End - partition.Start) + 1 &&
ApricotBPB.mainBPB.sectors <= partition.End - partition.Start + 1 &&
ApricotBPB.mainBPB.spfat > 0 && ApricotBPB.partitionCount == 0)
{
DicConsole.DebugWriteLine("FAT plugin", "Using Apricot BPB");
@@ -497,7 +497,7 @@ namespace DiscImageChef.Filesystems
{
if(EBPB.sectors == 0)
{
if(EBPB.big_sectors <= (partition.End - partition.Start) + 1)
if(EBPB.big_sectors <= partition.End - partition.Start + 1)
{
if(EBPB.signature == 0x29 || andos_oem_correct)
{
@@ -511,7 +511,7 @@ namespace DiscImageChef.Filesystems
}
}
}
else if(EBPB.sectors <= (partition.End - partition.Start) + 1)
else if(EBPB.sectors <= partition.End - partition.Start + 1)
{
if(EBPB.signature == 0x29 || andos_oem_correct)
{
@@ -526,19 +526,19 @@ namespace DiscImageChef.Filesystems
}
}
else if(bits_in_bps_dos33 == 1 && correct_spc_dos33 &&
dos33BPB.rsectors < (partition.End - partition.Start) && dos33BPB.fats_no <= 2 &&
dos33BPB.rsectors < partition.End - partition.Start && dos33BPB.fats_no <= 2 &&
dos33BPB.root_ent > 0 && dos33BPB.spfat > 0)
{
if(dos33BPB.sectors == 0 && dos33BPB.hsectors <= partition.Start && dos33BPB.big_sectors > 0 &&
dos33BPB.big_sectors <= (partition.End - partition.Start) + 1)
dos33BPB.big_sectors <= partition.End - partition.Start + 1)
{
DicConsole.DebugWriteLine("FAT plugin", "Using DOS 3.3 BPB");
useDOS33BPB = true;
}
else if(dos33BPB.big_sectors == 0 && dos33BPB.hsectors <= partition.Start && dos33BPB.sectors > 0 &&
dos33BPB.sectors <= (partition.End - partition.Start) + 1)
dos33BPB.sectors <= partition.End - partition.Start + 1)
{
if(atariBPB.jump[0] == 0x60 || (atariBPB.jump[0] == 0xE9 && atariBPB.jump[1] == 0x00) &&
if(atariBPB.jump[0] == 0x60 || atariBPB.jump[0] == 0xE9 && atariBPB.jump[1] == 0x00 &&
Encoding.ASCII.GetString(dos33BPB.oem_name) != "NEXT ")
{
DicConsole.DebugWriteLine("FAT plugin", "Using Atari BPB");
@@ -560,7 +560,7 @@ namespace DiscImageChef.Filesystems
}
else if(dos30BPB.sptrk > 0 && dos30BPB.sptrk < 64 && dos30BPB.heads > 0 && dos30BPB.heads < 256)
{
if(atariBPB.jump[0] == 0x60 || (atariBPB.jump[0] == 0xE9 && atariBPB.jump[1] == 0x00) &&
if(atariBPB.jump[0] == 0x60 || atariBPB.jump[0] == 0xE9 && atariBPB.jump[1] == 0x00 &&
Encoding.ASCII.GetString(dos33BPB.oem_name) != "NEXT ")
{
DicConsole.DebugWriteLine("FAT plugin", "Using Atari BPB");
@@ -574,7 +574,7 @@ namespace DiscImageChef.Filesystems
}
else
{
if(atariBPB.jump[0] == 0x60 || (atariBPB.jump[0] == 0xE9 && atariBPB.jump[1] == 0x00) &&
if(atariBPB.jump[0] == 0x60 || atariBPB.jump[0] == 0xE9 && atariBPB.jump[1] == 0x00 &&
Encoding.ASCII.GetString(dos33BPB.oem_name) != "NEXT ")
{
DicConsole.DebugWriteLine("FAT plugin", "Using Atari BPB");
@@ -636,7 +636,7 @@ namespace DiscImageChef.Filesystems
{
for(int c = 0; c < 11; c++)
{
if((root_dir[c + e] < 0x20 && root_dir[c + e] != 0x00 && root_dir[c + e] != 0x05) ||
if(root_dir[c + e] < 0x20 && root_dir[c + e] != 0x00 && root_dir[c + e] != 0x05 ||
root_dir[c + e] == 0xFF || root_dir[c + e] == 0x2E)
{
valid_root_dir = false;
@@ -836,7 +836,7 @@ namespace DiscImageChef.Filesystems
}
// This assumes a bootable sector will jump somewhere or disable interrupts in x86 code
xmlFSType.Bootable |= (bpb_sector[0] == 0xFA || (bpb_sector[0] == 0xEB && bpb_sector[1] <= 0x7F));
xmlFSType.Bootable |= bpb_sector[0] == 0xFA || bpb_sector[0] == 0xEB && bpb_sector[1] <= 0x7F;
fakeBPB.boot_code = bpb_sector;
}
else if(useShortFAT32 || useLongFAT32)
@@ -931,8 +931,8 @@ namespace DiscImageChef.Filesystems
// Check that jumps to a correct boot code position and has boot signature set.
// This will mean that the volume will boot, even if just to say "this is not bootable change disk"......
xmlFSType.Bootable |= (Fat32BPB.jump[0] == 0xEB && Fat32BPB.jump[1] > 0x58 && Fat32BPB.jump[1] < 0x80 &&
Fat32BPB.boot_signature == 0xAA55);
xmlFSType.Bootable |= Fat32BPB.jump[0] == 0xEB && Fat32BPB.jump[1] > 0x58 && Fat32BPB.jump[1] < 0x80 &&
Fat32BPB.boot_signature == 0xAA55;
sectors_per_real_sector = Fat32BPB.bps / imagePlugin.ImageInfo.SectorSize;
// First root directory sector
@@ -1308,14 +1308,14 @@ namespace DiscImageChef.Filesystems
// Check that jumps to a correct boot code position and has boot signature set.
// This will mean that the volume will boot, even if just to say "this is not bootable change disk"......
if(xmlFSType.Bootable == false && fakeBPB.jump != null)
xmlFSType.Bootable |= (fakeBPB.jump[0] == 0xEB && fakeBPB.jump[1] > 0x58 &&
fakeBPB.jump[1] < 0x80 && fakeBPB.boot_signature == 0xAA55);
xmlFSType.Bootable |= fakeBPB.jump[0] == 0xEB && fakeBPB.jump[1] > 0x58 &&
fakeBPB.jump[1] < 0x80 && fakeBPB.boot_signature == 0xAA55;
sectors_per_real_sector = fakeBPB.bps / imagePlugin.ImageInfo.SectorSize;
// First root directory sector
root_directory_sector =
(ulong)(fakeBPB.spfat * fakeBPB.fats_no + fakeBPB.rsectors) * sectors_per_real_sector;
sectors_for_root_directory = (uint)((fakeBPB.root_ent * 32) / imagePlugin.ImageInfo.SectorSize);
sectors_for_root_directory = (uint)(fakeBPB.root_ent * 32 / imagePlugin.ImageInfo.SectorSize);
}
if(extraInfo != null) sb.Append(extraInfo);

View File

@@ -69,7 +69,7 @@ namespace DiscImageChef.Filesystems
public override bool Identify(DiscImages.ImagePlugin imagePlugin, Partition partition)
{
if((2 + partition.Start) >= partition.End) return false;
if(2 + partition.Start >= partition.End) return false;
uint magic;
uint sb_size_in_sectors;
@@ -88,7 +88,7 @@ namespace DiscImageChef.Filesystems
foreach(ulong loc in locations)
{
if(partition.End > (partition.Start + loc + sb_size_in_sectors))
if(partition.End > partition.Start + loc + sb_size_in_sectors)
{
ufs_sb_sectors = imagePlugin.ReadSectors(partition.Start + loc, sb_size_in_sectors);
magic = BitConverter.ToUInt32(ufs_sb_sectors, 0x055C);
@@ -133,7 +133,7 @@ namespace DiscImageChef.Filesystems
foreach(ulong loc in locations)
{
if(partition.End > (partition.Start + loc + sb_size_in_sectors))
if(partition.End > partition.Start + loc + sb_size_in_sectors)
{
ufs_sb_sectors = imagePlugin.ReadSectors(partition.Start + loc, sb_size_in_sectors);
magic = BitConverter.ToUInt32(ufs_sb_sectors, 0x055C);
@@ -204,10 +204,10 @@ namespace DiscImageChef.Filesystems
Marshal.FreeHGlobal(sbPtr);
UFSSuperBlock bs_sfu = BigEndianMarshal.ByteArrayToStructureBigEndian<UFSSuperBlock>(ufs_sb_sectors);
if((bs_sfu.fs_magic == UFS_MAGIC && ufs_sb.fs_magic == UFS_CIGAM) ||
(bs_sfu.fs_magic == UFS_MAGIC_BW && ufs_sb.fs_magic == UFS_CIGAM_BW) ||
(bs_sfu.fs_magic == UFS2_MAGIC && ufs_sb.fs_magic == UFS2_CIGAM) ||
(bs_sfu.fs_magic == UFS_BAD_MAGIC && ufs_sb.fs_magic == UFS_BAD_CIGAM))
if(bs_sfu.fs_magic == UFS_MAGIC && ufs_sb.fs_magic == UFS_CIGAM ||
bs_sfu.fs_magic == UFS_MAGIC_BW && ufs_sb.fs_magic == UFS_CIGAM_BW ||
bs_sfu.fs_magic == UFS2_MAGIC && ufs_sb.fs_magic == UFS2_CIGAM ||
bs_sfu.fs_magic == UFS_BAD_MAGIC && ufs_sb.fs_magic == UFS_BAD_CIGAM)
{
ufs_sb = bs_sfu;
ufs_sb.fs_old_cstotal.cs_nbfree = Swapping.Swap(ufs_sb.fs_old_cstotal.cs_nbfree);

View File

@@ -190,7 +190,7 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("Data starts at block {0}", hdr.data).AppendLine();
sb.AppendFormat("Volume has {0} blocks", hdr.end).AppendLine();
ulong sbLocation = (hdr.super * (hdr.blockSize / imagePlugin.GetSectorSize())) + partition.Start;
ulong sbLocation = hdr.super * (hdr.blockSize / imagePlugin.GetSectorSize()) + partition.Start;
xmlFSType = new Schemas.FileSystemType
{

View File

@@ -77,7 +77,7 @@ namespace DiscImageChef.Filesystems
if(HAMMER_VOLHDR_SIZE % imagePlugin.GetSectorSize() > 0) run++;
if((run + partition.Start) >= partition.End) return false;
if(run + partition.Start >= partition.End) return false;
ulong magic;

View File

@@ -67,7 +67,7 @@ namespace DiscImageChef.Filesystems
public override bool Identify(DiscImages.ImagePlugin imagePlugin, Partition partition)
{
if((16 + partition.Start) >= partition.End) return false;
if(16 + partition.Start >= partition.End) return false;
uint magic1, magic2;

View File

@@ -49,7 +49,7 @@ namespace DiscImageChef.Filesystems.ISO9660
if(imagePlugin.GetSectorSize() < 2048) return false;
// ISO9660 Primary Volume Descriptor starts at sector 16, so that's minimal size.
if(partition.End <= (16 + partition.Start)) return false;
if(partition.End <= 16 + partition.Start) return false;
// Read to Volume Descriptor
byte[] vd_sector = imagePlugin.ReadSector(16 + partition.Start);
@@ -389,7 +389,7 @@ namespace DiscImageChef.Filesystems.ISO9660
ziso |= nextSignature == ziso_Magic;
Amiga |= nextSignature == Amiga_Magic;
AAIP |= nextSignature == AAIP_Magic ||
(nextSignature == AAIP_OldMagic && sa[sa_off + 3] == 1 && sa[sa_off + 2] >= 9);
nextSignature == AAIP_OldMagic && sa[sa_off + 3] == 1 && sa[sa_off + 2] >= 9;
sa_off += sa[sa_off + 2];
@@ -446,7 +446,7 @@ namespace DiscImageChef.Filesystems.ISO9660
ziso |= nextSignature == ziso_Magic;
Amiga |= nextSignature == Amiga_Magic;
AAIP |= nextSignature == AAIP_Magic ||
(nextSignature == AAIP_OldMagic && ca_data[ca_off + 3] == 1 && ca_data[ca_off + 2] >= 9);
nextSignature == AAIP_OldMagic && ca_data[ca_off + 3] == 1 && ca_data[ca_off + 2] >= 9;
ca_off += ca_data[ca_off + 2];
}

View File

@@ -227,7 +227,7 @@ namespace DiscImageChef.Filesystems.LisaFS
int offset = 0;
// Traverse all entries
while((offset + 64) <= buf.Length)
while(offset + 64 <= buf.Length)
{
// Catalog block header
if(buf[offset + 0x24] == 0x08) offset += 78;

View File

@@ -57,7 +57,7 @@ namespace DiscImageChef.Filesystems.LisaFS
if(!mounted) return Errno.AccessDenied;
if(fileId < 4 || (fileId == 4 && (mddf.fsversion != LisaFSv2 && mddf.fsversion != LisaFSv1)))
if(fileId < 4 || fileId == 4 && mddf.fsversion != LisaFSv2 && mddf.fsversion != LisaFSv1)
return Errno.InvalidArgument;
if(extentCache.TryGetValue(fileId, out file)) return Errno.NoError;
@@ -98,7 +98,7 @@ namespace DiscImageChef.Filesystems.LisaFS
// Checks that the sector tag indicates its the Extents File we are searching for
DecodeTag(device.ReadSectorTag(ptr, SectorTagType.AppleSectorTag), out extTag);
if(extTag.fileID == ((short)(-1 * fileId)))
if(extTag.fileID == (short)(-1 * fileId))
{
byte[] sector;

View File

@@ -348,7 +348,7 @@ namespace DiscImageChef.Filesystems.LisaFS
tags &= debug;
if(fileId < 4 || (fileId == 4 && (mddf.fsversion != LisaFSv2 && mddf.fsversion != LisaFSv1)))
if(fileId < 4 || fileId == 4 && mddf.fsversion != LisaFSv2 && mddf.fsversion != LisaFSv1)
return Errno.InvalidArgument;
if(!tags && fileCache.TryGetValue(fileId, out buf)) return Errno.NoError;
@@ -371,10 +371,10 @@ namespace DiscImageChef.Filesystems.LisaFS
byte[] sector;
if(!tags)
sector = device.ReadSectors(((ulong)file.extents[i].start + mddf.mddf_block + volumePrefix),
sector = device.ReadSectors((ulong)file.extents[i].start + mddf.mddf_block + volumePrefix,
(uint)file.extents[i].length);
else
sector = device.ReadSectorsTag(((ulong)file.extents[i].start + mddf.mddf_block + volumePrefix),
sector = device.ReadSectorsTag((ulong)file.extents[i].start + mddf.mddf_block + volumePrefix,
(uint)file.extents[i].length, SectorTagType.AppleSectorTag);
Array.Copy(sector, 0, temp, offset, sector.Length);

View File

@@ -221,8 +221,8 @@ namespace DiscImageChef.Filesystems
{
Locus_Superblock LocusSb = new Locus_Superblock();
uint sbSize = (uint)((Marshal.SizeOf(LocusSb)) / imagePlugin.GetSectorSize());
if((Marshal.SizeOf(LocusSb)) % imagePlugin.GetSectorSize() != 0) sbSize++;
uint sbSize = (uint)(Marshal.SizeOf(LocusSb) / imagePlugin.GetSectorSize());
if(Marshal.SizeOf(LocusSb) % imagePlugin.GetSectorSize() != 0) sbSize++;
if(partition.Start + location + sbSize >= imagePlugin.GetSectors()) break;
@@ -254,8 +254,8 @@ namespace DiscImageChef.Filesystems
for(ulong location = 0; location <= 8; location++)
{
uint sbSize = (uint)((Marshal.SizeOf(LocusSb)) / imagePlugin.GetSectorSize());
if((Marshal.SizeOf(LocusSb)) % imagePlugin.GetSectorSize() != 0) sbSize++;
uint sbSize = (uint)(Marshal.SizeOf(LocusSb) / imagePlugin.GetSectorSize());
if(Marshal.SizeOf(LocusSb) % imagePlugin.GetSectorSize() != 0) sbSize++;
sector = imagePlugin.ReadSectors(partition.Start + location, sbSize);
if(sector.Length < Marshal.SizeOf(LocusSb)) return;

View File

@@ -70,7 +70,7 @@ namespace DiscImageChef.Filesystems
public override bool Identify(DiscImages.ImagePlugin imagePlugin, Partition partition)
{
if((1 + partition.Start) >= partition.End) return false;
if(1 + partition.Start >= partition.End) return false;
if(imagePlugin.GetSectorSize() < 512) return false;

View File

@@ -97,7 +97,7 @@ namespace DiscImageChef.Filesystems
offset = 0x400;
}
if((sector + partition.Start) >= partition.End) return false;
if(sector + partition.Start >= partition.End) return false;
ushort magic;
byte[] minix_sb_sector = imagePlugin.ReadSector(sector + partition.Start);
@@ -164,7 +164,7 @@ namespace DiscImageChef.Filesystems
magic == MINIX_MAGIC || magic == MINIX_CIGAM)
{
filenamesize = 60;
littleEndian = (magic != MINIX3_CIGAM || magic == MINIX2_CIGAM || magic == MINIX_CIGAM);
littleEndian = magic != MINIX3_CIGAM || magic == MINIX2_CIGAM || magic == MINIX_CIGAM;
if(magic == MINIX3_MAGIC || magic == MINIX3_CIGAM)
{

View File

@@ -65,7 +65,7 @@ namespace DiscImageChef.Filesystems
public override bool Identify(DiscImages.ImagePlugin imagePlugin, Partition partition)
{
if((2 + partition.Start) >= partition.End) return false;
if(2 + partition.Start >= partition.End) return false;
byte[] eigth_bytes = new byte[8];
byte fats_no;

View File

@@ -67,11 +67,11 @@ namespace DiscImageChef.Filesystems
{
if(partition.Start != 0) return false;
if((imagePlugin.GetSectors() * imagePlugin.GetSectorSize()) < 0x50000) return false;
if(imagePlugin.GetSectors() * imagePlugin.GetSectorSize() < 0x50000) return false;
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
byte[] header = imagePlugin.ReadSectors(0, (0x50000 / imagePlugin.GetSectorSize()));
byte[] header = imagePlugin.ReadSectors(0, 0x50000 / imagePlugin.GetSectorSize());
uint magicGC = BigEndianBitConverter.ToUInt32(header, 0x1C);
uint magicWii = BigEndianBitConverter.ToUInt32(header, 0x18);
@@ -91,7 +91,7 @@ namespace DiscImageChef.Filesystems
NintendoFields fields = new NintendoFields();
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
byte[] header = imagePlugin.ReadSectors(0, (0x50000 / imagePlugin.GetSectorSize()));
byte[] header = imagePlugin.ReadSectors(0, 0x50000 / imagePlugin.GetSectorSize());
bool wii = false;
@@ -140,7 +140,7 @@ namespace DiscImageChef.Filesystems
for(int i = 0; i < fields.firstPartitions.Length; i++)
{
if((offset1 + i * 8 + 8) < 0x50000)
if(offset1 + i * 8 + 8 < 0x50000)
{
fields.firstPartitions[i].offset =
BigEndianBitConverter.ToUInt32(header, (int)(offset1 + i * 8 + 0)) << 2;
@@ -151,7 +151,7 @@ namespace DiscImageChef.Filesystems
for(int i = 0; i < fields.secondPartitions.Length; i++)
{
if((offset1 + i * 8 + 8) < 0x50000)
if(offset1 + i * 8 + 8 < 0x50000)
{
fields.firstPartitions[i].offset =
BigEndianBitConverter.ToUInt32(header, (int)(offset2 + i * 8 + 0)) << 2;
@@ -162,7 +162,7 @@ namespace DiscImageChef.Filesystems
for(int i = 0; i < fields.thirdPartitions.Length; i++)
{
if((offset1 + i * 8 + 8) < 0x50000)
if(offset1 + i * 8 + 8 < 0x50000)
{
fields.firstPartitions[i].offset =
BigEndianBitConverter.ToUInt32(header, (int)(offset3 + i * 8 + 0)) << 2;
@@ -173,7 +173,7 @@ namespace DiscImageChef.Filesystems
for(int i = 0; i < fields.fourthPartitions.Length; i++)
{
if((offset1 + i * 8 + 8) < 0x50000)
if(offset1 + i * 8 + 8 < 0x50000)
{
fields.firstPartitions[i].offset =
BigEndianBitConverter.ToUInt32(header, (int)(offset4 + i * 8 + 0)) << 2;
@@ -317,7 +317,7 @@ namespace DiscImageChef.Filesystems
information = sbInformation.ToString();
xmlFSType.Bootable = true;
xmlFSType.Clusters = (long)((imagePlugin.GetSectors() * imagePlugin.GetSectorSize()) / 2048);
xmlFSType.Clusters = (long)(imagePlugin.GetSectors() * imagePlugin.GetSectorSize() / 2048);
xmlFSType.ClusterSize = 2048;
if(wii) xmlFSType.Type = "Nintendo Wii filesystem";
else xmlFSType.Type = "Nintendo Gamecube filesystem";

View File

@@ -75,7 +75,7 @@ namespace DiscImageChef.Filesystems
public override bool Identify(DiscImages.ImagePlugin imagePlugin, Partition partition)
{
if((2 + partition.Start) >= partition.End) return false;
if(2 + partition.Start >= partition.End) return false;
if(imagePlugin.GetSectorSize() < 512) return false;
@@ -247,7 +247,7 @@ namespace DiscImageChef.Filesystems
{
Type = "FILES-11",
ClusterSize = homeblock.cluster * 512,
Clusters = (long)(partition.Size) / (homeblock.cluster * 512),
Clusters = (long)partition.Size / (homeblock.cluster * 512),
VolumeName = StringHandlers.SpacePaddedToString(homeblock.volname, CurrentEncoding),
VolumeSerial = string.Format("{0:X8}", homeblock.serialnum)
};

View File

@@ -65,7 +65,7 @@ namespace DiscImageChef.Filesystems
public override bool Identify(DiscImages.ImagePlugin imagePlugin, Partition partition)
{
if((2 + partition.Start) >= partition.End) return false;
if(2 + partition.Start >= partition.End) return false;
byte[] sb_sector = imagePlugin.ReadSector(0 + partition.Start);

View File

@@ -64,7 +64,7 @@ namespace DiscImageChef.Filesystems
public override bool Identify(DiscImages.ImagePlugin imagePlugin, Partition partition)
{
if((2 + partition.Start) >= partition.End) return false;
if(2 + partition.Start >= partition.End) return false;
byte[] system_descriptor = new byte[23];
byte[] sector = imagePlugin.ReadSector(1 + partition.Start);

View File

@@ -152,8 +152,8 @@ namespace DiscImageChef.Filesystems
if(APMFromHDDOnCD) total_blocks /= 4;
DicConsole.DebugWriteLine("ProDOS plugin", "{0} <= ({1} - {2} + 1)? {3}", total_blocks, partition.End,
partition.Start, total_blocks <= (partition.End - partition.Start + 1));
return total_blocks <= (partition.End - partition.Start + 1);
partition.Start, total_blocks <= partition.End - partition.Start + 1);
return total_blocks <= partition.End - partition.Start + 1;
}
public override void GetInformation(DiscImages.ImagePlugin imagePlugin, Partition partition,
@@ -305,7 +305,7 @@ namespace DiscImageChef.Filesystems
xmlFSType.Files = rootDirectoryKeyBlock.header.file_count;
xmlFSType.FilesSpecified = true;
xmlFSType.Clusters = rootDirectoryKeyBlock.header.total_blocks;
xmlFSType.ClusterSize = (int)(((partition.End - partition.Start) + 1) * imagePlugin.ImageInfo.SectorSize /
xmlFSType.ClusterSize = (int)((partition.End - partition.Start + 1) * imagePlugin.ImageInfo.SectorSize /
(ulong)xmlFSType.Clusters);
xmlFSType.Type = "ProDOS";

View File

@@ -261,7 +261,7 @@ namespace DiscImageChef.Filesystems
ModificationDate = DateHandlers.UNIXUnsignedToDateTime(qnxSb.rootDir.di_mtime),
ModificationDateSpecified = true
};
xmlFSType.Bootable |= (qnxSb.boot.di_size != 0 || qnxSb.altBoot.di_size != 0);
xmlFSType.Bootable |= qnxSb.boot.di_size != 0 || qnxSb.altBoot.di_size != 0;
}
public override Errno Mount()

View File

@@ -67,7 +67,7 @@ namespace DiscImageChef.Filesystems
public override bool Identify(DiscImages.ImagePlugin imagePlugin, Partition partition)
{
if((1 + partition.Start) >= partition.End) return false;
if(1 + partition.Start >= partition.End) return false;
if(imagePlugin.GetSectorSize() < 512) return false;

View File

@@ -141,7 +141,7 @@ namespace DiscImageChef.Filesystems
xmlFSType.Type = "Reiser 4 filesystem";
xmlFSType.ClusterSize = reiserSb.blocksize;
xmlFSType.Clusters =
(long)(((partition.End - partition.Start) * imagePlugin.GetSectorSize()) / reiserSb.blocksize);
(long)((partition.End - partition.Start) * imagePlugin.GetSectorSize() / reiserSb.blocksize);
xmlFSType.VolumeName = StringHandlers.CToString(reiserSb.label, CurrentEncoding);
xmlFSType.VolumeSerial = reiserSb.uuid.ToString();
}

View File

@@ -66,7 +66,7 @@ namespace DiscImageChef.Filesystems
public override bool Identify(DiscImages.ImagePlugin imagePlugin, Partition partition)
{
if((2 + partition.Start) >= partition.End) return false;
if(2 + partition.Start >= partition.End) return false;
byte signature; /// <summary>0x29
string fs_type; // "SOL_FS "

View File

@@ -179,7 +179,7 @@ namespace DiscImageChef.Filesystems
xmlFSType.Type = "Squash file system";
xmlFSType.CreationDate = DateHandlers.UNIXUnsignedToDateTime(sqSb.mkfs_time);
xmlFSType.CreationDateSpecified = true;
xmlFSType.Clusters = (long)(((partition.End - partition.Start + 1) * imagePlugin.ImageInfo.SectorSize) /
xmlFSType.Clusters = (long)((partition.End - partition.Start + 1) * imagePlugin.ImageInfo.SectorSize /
sqSb.block_size);
xmlFSType.ClusterSize = (int)sqSb.block_size;
xmlFSType.Files = sqSb.inodes;

View File

@@ -83,7 +83,7 @@ namespace DiscImageChef.Filesystems
public override bool Identify(DiscImages.ImagePlugin imagePlugin, Partition partition)
{
if((2 + partition.Start) >= partition.End) return false;
if(2 + partition.Start >= partition.End) return false;
uint magic;
string s_fname, s_fpack;
@@ -117,7 +117,7 @@ namespace DiscImageChef.Filesystems
sb_size_in_sectors = (byte)(0x400 / imagePlugin.GetSectorSize());
else sb_size_in_sectors = 1; // If not a single sector can store it
if(partition.End <= (partition.Start + 4 * (ulong)sb_size_in_sectors + sb_size_in_sectors)
if(partition.End <= partition.Start + 4 * (ulong)sb_size_in_sectors + sb_size_in_sectors
) // Device must be bigger than SB location + SB size + offset
return false;
@@ -157,8 +157,8 @@ namespace DiscImageChef.Filesystems
Array.Copy(sb_sector, 0x1EA, coherent_string, 0, 6); // Coherent UNIX s_fpack location
s_fpack = StringHandlers.CToString(coherent_string, CurrentEncoding);
if((s_fname == COH_FNAME && s_fpack == COH_FPACK) || (s_fname == COH_XXXXX && s_fpack == COH_XXXXX) ||
(s_fname == COH_XXXXS && s_fpack == COH_XXXXN)) return true;
if(s_fname == COH_FNAME && s_fpack == COH_FPACK || s_fname == COH_XXXXX && s_fpack == COH_XXXXX ||
s_fname == COH_XXXXS && s_fpack == COH_XXXXN) return true;
// Now try to identify 7th edition
s_fsize = BitConverter.ToUInt32(sb_sector, 0x002); // 7th edition's s_fsize
@@ -181,8 +181,8 @@ namespace DiscImageChef.Filesystems
{
if(s_fsize < V7_MAXSIZE && s_nfree < V7_NICFREE && s_ninode < V7_NICINOD)
{
if((s_fsize * 1024) == ((partition.End - partition.Start) * imagePlugin.GetSectorSize()) ||
(s_fsize * 512) == ((partition.End - partition.Start) * imagePlugin.GetSectorSize()))
if(s_fsize * 1024 == (partition.End - partition.Start) * imagePlugin.GetSectorSize() ||
s_fsize * 512 == (partition.End - partition.Start) * imagePlugin.GetSectorSize())
return true;
}
}
@@ -303,8 +303,8 @@ namespace DiscImageChef.Filesystems
Array.Copy(sb_sector, 0x1EA, coherent_string, 0, 6); // Coherent UNIX s_fpack location
s_fpack = StringHandlers.CToString(coherent_string, CurrentEncoding);
if((s_fname == COH_FNAME && s_fpack == COH_FPACK) || (s_fname == COH_XXXXX && s_fpack == COH_XXXXX) ||
(s_fname == COH_XXXXS && s_fpack == COH_XXXXN))
if(s_fname == COH_FNAME && s_fpack == COH_FPACK || s_fname == COH_XXXXX && s_fpack == COH_XXXXX ||
s_fname == COH_XXXXS && s_fpack == COH_XXXXN)
{
BigEndianBitConverter.IsLittleEndian = true; // Coherent is in PDP endianness, use helper for that
coherent = true;
@@ -333,8 +333,8 @@ namespace DiscImageChef.Filesystems
{
if(s_fsize < V7_MAXSIZE && s_nfree < V7_NICFREE && s_ninode < V7_NICINOD)
{
if((s_fsize * 1024) == ((partition.End - partition.Start) * imagePlugin.GetSectorSize()) ||
(s_fsize * 512) == ((partition.End - partition.Start) * imagePlugin.GetSectorSize()))
if(s_fsize * 1024 == (partition.End - partition.Start) * imagePlugin.GetSectorSize() ||
s_fsize * 512 == (partition.End - partition.Start) * imagePlugin.GetSectorSize())
{
sys7th = true;
BigEndianBitConverter.IsLittleEndian = true;
@@ -591,7 +591,7 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("Volume name: {0}", sysv_sb.s_fname).AppendLine();
xmlFSType.VolumeName = sysv_sb.s_fname;
sb.AppendFormat("Pack name: {0}", sysv_sb.s_fpack).AppendLine();
if(sysv_sb.s_state == (0x7C269D38 - sysv_sb.s_time)) sb.AppendLine("Volume is clean");
if(sysv_sb.s_state == 0x7C269D38 - sysv_sb.s_time) sb.AppendLine("Volume is clean");
else
{
sb.AppendLine("Volume is dirty");

View File

@@ -129,12 +129,12 @@ namespace DiscImageChef.Filesystems.UCSDPascal
if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0)
{
stat.Blocks = (catalogBlocks.Length / stat.BlockSize) + (catalogBlocks.Length % stat.BlockSize);
stat.Blocks = catalogBlocks.Length / stat.BlockSize + catalogBlocks.Length % stat.BlockSize;
stat.Length = catalogBlocks.Length;
}
else
{
stat.Blocks = (bootBlocks.Length / stat.BlockSize) + (catalogBlocks.Length % stat.BlockSize);
stat.Blocks = bootBlocks.Length / stat.BlockSize + catalogBlocks.Length % stat.BlockSize;
stat.Length = bootBlocks.Length;
}

View File

@@ -66,8 +66,8 @@ namespace DiscImageChef.Filesystems.UCSDPascal
if(mountedVolEntry.firstBlock != 0 || mountedVolEntry.lastBlock <= mountedVolEntry.firstBlock ||
(ulong)mountedVolEntry.lastBlock > device.GetSectors() - 2 ||
(mountedVolEntry.entryType != PascalFileKind.Volume &&
mountedVolEntry.entryType != PascalFileKind.Secure) || mountedVolEntry.volumeName[0] > 7 ||
mountedVolEntry.entryType != PascalFileKind.Volume &&
mountedVolEntry.entryType != PascalFileKind.Secure || mountedVolEntry.volumeName[0] > 7 ||
mountedVolEntry.blocks < 0 || (ulong)mountedVolEntry.blocks != device.GetSectors() ||
mountedVolEntry.files < 0) return Errno.InvalidArgument;
@@ -125,7 +125,7 @@ namespace DiscImageChef.Filesystems.UCSDPascal
stat.Type = "UCSD Pascal";
stat.FreeBlocks = mountedVolEntry.blocks - (mountedVolEntry.lastBlock - mountedVolEntry.firstBlock);
foreach(PascalFileEntry entry in fileEntries) stat.FreeBlocks -= (entry.lastBlock - entry.firstBlock);
foreach(PascalFileEntry entry in fileEntries) stat.FreeBlocks -= entry.lastBlock - entry.firstBlock;
return Errno.NotImplemented;
}

View File

@@ -280,7 +280,7 @@ namespace DiscImageChef.Filesystems
if(anchor.tag.tagIdentifier == TagIdentifier.AnchorVolumeDescriptorPointer &&
anchor.tag.tagLocation == position &&
(anchor.mainVolumeDescriptorSequenceExtent.location + partition.Start) < partition.End)
anchor.mainVolumeDescriptorSequenceExtent.location + partition.Start < partition.End)
{
anchorFound = true;
break;
@@ -347,7 +347,7 @@ namespace DiscImageChef.Filesystems
if(anchor.tag.tagIdentifier == TagIdentifier.AnchorVolumeDescriptorPointer &&
anchor.tag.tagLocation == position &&
(anchor.mainVolumeDescriptorSequenceExtent.location + partition.Start) < partition.End) break;
anchor.mainVolumeDescriptorSequenceExtent.location + partition.Start < partition.End) break;
}
ulong count = 0;
@@ -457,7 +457,7 @@ namespace DiscImageChef.Filesystems
xmlFSType.ApplicationIdentifier = CurrentEncoding
.GetString(pvd.implementationIdentifier.identifier).TrimEnd(new char[] {'\u0000'});
xmlFSType.ClusterSize = (int)lvd.logicalBlockSize;
xmlFSType.Clusters = (long)(((partition.End - partition.Start + 1) * imagePlugin.ImageInfo.SectorSize) /
xmlFSType.Clusters = (long)((partition.End - partition.Start + 1) * imagePlugin.ImageInfo.SectorSize /
(ulong)xmlFSType.ClusterSize);
xmlFSType.ModificationDate = ECMAToDateTime(lvid.recordingDateTime);
xmlFSType.ModificationDateSpecified = true;

View File

@@ -161,8 +161,8 @@ namespace DiscImageChef.Filesystems
UNICOS_Superblock unicosSb = new UNICOS_Superblock();
uint sbSize = (uint)((Marshal.SizeOf(unicosSb)) / imagePlugin.GetSectorSize());
if((Marshal.SizeOf(unicosSb)) % imagePlugin.GetSectorSize() != 0) sbSize++;
uint sbSize = (uint)(Marshal.SizeOf(unicosSb) / imagePlugin.GetSectorSize());
if(Marshal.SizeOf(unicosSb) % imagePlugin.GetSectorSize() != 0) sbSize++;
byte[] sector = imagePlugin.ReadSectors(partition.Start, sbSize);
if(sector.Length < Marshal.SizeOf(unicosSb)) return false;
@@ -183,8 +183,8 @@ namespace DiscImageChef.Filesystems
UNICOS_Superblock unicosSb = new UNICOS_Superblock();
uint sbSize = (uint)((Marshal.SizeOf(unicosSb)) / imagePlugin.GetSectorSize());
if((Marshal.SizeOf(unicosSb)) % imagePlugin.GetSectorSize() != 0) sbSize++;
uint sbSize = (uint)(Marshal.SizeOf(unicosSb) / imagePlugin.GetSectorSize());
if(Marshal.SizeOf(unicosSb) % imagePlugin.GetSectorSize() != 0) sbSize++;
byte[] sector = imagePlugin.ReadSectors(partition.Start, sbSize);
if(sector.Length < Marshal.SizeOf(unicosSb)) return;

View File

@@ -68,7 +68,7 @@ namespace DiscImageChef.Filesystems
public override bool Identify(DiscImages.ImagePlugin imagePlugin, Partition partition)
{
if((2 + partition.Start) >= partition.End) return false;
if(2 + partition.Start >= partition.End) return false;
uint magic;

View File

@@ -359,7 +359,7 @@ namespace DiscImageChef.Filesystems
offset += 4;
nameLength = BigEndianBitConverter.ToUInt32(nvlist, offset);
offset += 4;
if(nameLength % 4 > 0) nameLength += 4 - (nameLength % 4);
if(nameLength % 4 > 0) nameLength += 4 - nameLength % 4;
nameBytes = new byte[nameLength];
Array.Copy(nvlist, offset, nameBytes, 0, nameLength);
item.name = StringHandlers.CToString(nameBytes);
@@ -395,7 +395,7 @@ namespace DiscImageChef.Filesystems
else
{
uint temp = BigEndianBitConverter.ToUInt32(nvlist, offset);
item.value = (temp > 0);
item.value = temp > 0;
offset += 4;
}

View File

@@ -240,8 +240,8 @@ namespace DiscImageChef.Filesystems
spcl_aix aixHdr = new spcl_aix();
s_spcl newHdr = new s_spcl();
uint sbSize = (uint)((Marshal.SizeOf(newHdr)) / imagePlugin.GetSectorSize());
if((Marshal.SizeOf(newHdr)) % imagePlugin.GetSectorSize() != 0) sbSize++;
uint sbSize = (uint)(Marshal.SizeOf(newHdr) / imagePlugin.GetSectorSize());
if(Marshal.SizeOf(newHdr) % imagePlugin.GetSectorSize() != 0) sbSize++;
byte[] sector = imagePlugin.ReadSectors(partition.Start, sbSize);
if(sector.Length < Marshal.SizeOf(newHdr)) return false;
@@ -282,8 +282,8 @@ namespace DiscImageChef.Filesystems
spcl_aix aixHdr = new spcl_aix();
s_spcl newHdr = new s_spcl();
uint sbSize = (uint)((Marshal.SizeOf(newHdr)) / imagePlugin.GetSectorSize());
if((Marshal.SizeOf(newHdr)) % imagePlugin.GetSectorSize() != 0) sbSize++;
uint sbSize = (uint)(Marshal.SizeOf(newHdr) / imagePlugin.GetSectorSize());
if(Marshal.SizeOf(newHdr) % imagePlugin.GetSectorSize() != 0) sbSize++;
byte[] sector = imagePlugin.ReadSectors(partition.Start, sbSize);
if(sector.Length < Marshal.SizeOf(newHdr)) return;

View File

@@ -68,7 +68,7 @@ namespace DiscImageChef.Filesystems
public override bool Identify(ImagePlugin imagePlugin, Partition partition)
{
if((12 + partition.Start) >= partition.End) return false;
if(12 + partition.Start >= partition.End) return false;
byte[] vbrSector = imagePlugin.ReadSector(0 + partition.Start);
if(vbrSector.Length < 512) return false;
@@ -122,7 +122,7 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("Cluster heap starts at sector {0}, contains {1} clusters and is {2}% used",
vbr.clusterHeapOffset, vbr.clusterHeapLength, vbr.heapUsage).AppendLine();
sb.AppendFormat("Root directory starts at cluster {0}", vbr.rootDirectoryCluster).AppendLine();
sb.AppendFormat("Filesystem revision is {0}.{1:D2}", (vbr.revision & 0xFF00) >> 8, (vbr.revision & 0xFF))
sb.AppendFormat("Filesystem revision is {0}.{1:D2}", (vbr.revision & 0xFF00) >> 8, vbr.revision & 0xFF)
.AppendLine();
sb.AppendFormat("Volume serial number: {0:X8}", vbr.volumeSerial).AppendLine();
sb.AppendFormat("BIOS drive is {0:X2}h", vbr.drive).AppendLine();

View File

@@ -71,7 +71,7 @@ namespace DiscImageChef.Filesystems
ulong sbSector = sbPos / imagePlugin.GetSectorSize();
uint sbOff = sbPos % imagePlugin.GetSectorSize();
if((sbSector + partition.Start) >= partition.End) return false;
if(sbSector + partition.Start >= partition.End) return false;
int sb_size_in_bytes = Marshal.SizeOf(typeof(ext2FSSuperBlock));
uint sb_size_in_sectors = (uint)(sb_size_in_bytes / imagePlugin.GetSectorSize());

View File

@@ -72,7 +72,7 @@ namespace DiscImageChef.Filesystems
ulong sbSector = sbPos / imagePlugin.GetSectorSize();
uint sbOff = sbPos % imagePlugin.GetSectorSize();
if((sbSector + partition.Start) >= partition.End) return false;
if(sbSector + partition.Start >= partition.End) return false;
byte[] sb_sector = imagePlugin.ReadSector(sbSector + partition.Start);
byte[] sb = new byte[512];
@@ -95,7 +95,7 @@ namespace DiscImageChef.Filesystems
ulong sbSector = sbPos / imagePlugin.GetSectorSize();
uint sbOff = sbPos % imagePlugin.GetSectorSize();
if((sbSector + partition.Start) >= partition.End) return;
if(sbSector + partition.Start >= partition.End) return;
byte[] sblock = imagePlugin.ReadSector(sbSector + partition.Start);
byte[] sb_sector = new byte[512];