REFACTOR: Invert 'if' statement to reduce nesting.

This commit is contained in:
2017-12-21 06:06:19 +00:00
parent 9cd1869d1d
commit 4d886dae25
138 changed files with 9447 additions and 9806 deletions

View File

@@ -40,8 +40,8 @@ namespace DiscImageChef.Partitions
{
public class RioKarma : PartitionPlugin
{
const ushort KarmaMagic = 0xAB56;
const byte EntryMagic = 0x4D;
const ushort KARMA_MAGIC = 0xAB56;
const byte ENTRY_MAGIC = 0x4D;
public RioKarma()
{
@@ -62,7 +62,7 @@ namespace DiscImageChef.Partitions
table = (RioKarmaTable)Marshal.PtrToStructure(tablePtr, typeof(RioKarmaTable));
Marshal.FreeHGlobal(tablePtr);
if(table.magic != KarmaMagic) return false;
if(table.magic != KARMA_MAGIC) return false;
ulong counter = 0;
@@ -78,11 +78,10 @@ namespace DiscImageChef.Partitions
Sequence = counter,
Scheme = Name
};
if(entry.type == EntryMagic)
{
partitions.Add(part);
counter++;
}
if(entry.type != ENTRY_MAGIC) continue;
partitions.Add(part);
counter++;
}
return true;