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

@@ -228,26 +228,25 @@ namespace DiscImageChef.Decoders.SCSI
}
}
if(page.OutputPort3ChannelSelection > 0)
{
sb.Append("\tOutput port 3 has channels ");
if((page.OutputPort3ChannelSelection & 0x01) == 0x01) sb.Append("0 ");
if((page.OutputPort3ChannelSelection & 0x02) == 0x02) sb.Append("1 ");
if((page.OutputPort3ChannelSelection & 0x04) == 0x04) sb.Append("2 ");
if((page.OutputPort3ChannelSelection & 0x08) == 0x08) sb.Append("3 ");
if(page.OutputPort3ChannelSelection <= 0) return sb.ToString();
switch(page.OutputPort3Volume)
{
case 0:
sb.AppendLine("muted");
break;
case 0xFF:
sb.AppendLine("at maximum volume");
break;
default:
sb.AppendFormat("at volume {0}", page.OutputPort3Volume).AppendLine();
break;
}
sb.Append("\tOutput port 3 has channels ");
if((page.OutputPort3ChannelSelection & 0x01) == 0x01) sb.Append("0 ");
if((page.OutputPort3ChannelSelection & 0x02) == 0x02) sb.Append("1 ");
if((page.OutputPort3ChannelSelection & 0x04) == 0x04) sb.Append("2 ");
if((page.OutputPort3ChannelSelection & 0x08) == 0x08) sb.Append("3 ");
switch(page.OutputPort3Volume)
{
case 0:
sb.AppendLine("muted");
break;
case 0xFF:
sb.AppendLine("at maximum volume");
break;
default:
sb.AppendFormat("at volume {0}", page.OutputPort3Volume).AppendLine();
break;
}
return sb.ToString();