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

@@ -174,21 +174,22 @@ namespace DiscImageChef.Decoders.DVD
break;
}
if(decoded.MSWI)
switch(decoded.RAMSWI)
{
case 0: break;
case 1:
sb.AppendLine("Disc is write inhibited because it has been extracted from the cartridge");
break;
case 0xFF:
sb.AppendLine("Disc is write inhibited for an unspecified reason");
break;
default:
sb.AppendFormat("Disc has unknown reason {0} for write inhibition", decoded.RAMSWI)
.AppendLine();
break;
}
if(!decoded.MSWI) return sb.ToString();
switch(decoded.RAMSWI)
{
case 0: break;
case 1:
sb.AppendLine("Disc is write inhibited because it has been extracted from the cartridge");
break;
case 0xFF:
sb.AppendLine("Disc is write inhibited for an unspecified reason");
break;
default:
sb.AppendFormat("Disc has unknown reason {0} for write inhibition", decoded.RAMSWI)
.AppendLine();
break;
}
return sb.ToString();
}