REFACTOR: Removed else statements.

This commit is contained in:
2017-12-21 02:57:32 +00:00
parent f0e80721ed
commit ff5540ff5d
13 changed files with 183 additions and 200 deletions

View File

@@ -142,7 +142,8 @@ namespace DiscImageChef.Checksums
return true;
}
else if(channel[0x00F] == 0x01) // mode (1 byte)
if(channel[0x00F] == 0x01) // mode (1 byte)
{
DicConsole.DebugWriteLine("CD checksums", "Mode 1 sector at address {0:X2}:{1:X2}:{2:X2}",
channel[0x00C], channel[0x00D], channel[0x00E]);
@@ -200,7 +201,8 @@ namespace DiscImageChef.Checksums
return true;
}
else if(channel[0x00F] == 0x02) // mode (1 byte)
if(channel[0x00F] == 0x02) // mode (1 byte)
{
DicConsole.DebugWriteLine("CD checksums", "Mode 2 sector at address {0:X2}:{1:X2}:{2:X2}",
channel[0x00C], channel[0x00D], channel[0x00E]);
@@ -281,14 +283,12 @@ namespace DiscImageChef.Checksums
return true;
}
else
{
DicConsole.DebugWriteLine("CD checksums",
"Unknown mode {0} sector at address: {1:X2}:{2:X2}:{3:X2}",
channel[0x00F], channel[0x00C], channel[0x00D], channel[0x00E]);
return null;
}
}
return null;
}

View File

@@ -71,7 +71,7 @@ namespace DiscImageChef.CommonTypes
public override bool Equals(object obj)
{
if(obj == null || !(obj is Partition)) return false;
else return Equals((Partition)obj);
return Equals((Partition)obj);
}
public override int GetHashCode()

View File

@@ -365,15 +365,12 @@ namespace DiscImageChef.Core.Devices.Dumping
}
if(dumpRaw) throw new NotImplementedException("Raw CD dumping not yet implemented");
else
{
// TODO: Check subchannel capabilities
readcd = !dev.ReadCd(out readBuffer, out senseBuf, 0, blockSize, 1, MmcSectorTypes.AllTypes, false,
false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None,
MmcSubchannel.Raw, dev.Timeout, out duration);
if(readcd) DicConsole.WriteLine("Using MMC READ CD command.");
}
DumpHardwareType currentTry = null;
ExtentsULong extents = null;

View File

@@ -421,7 +421,7 @@ namespace DiscImageChef.Devices
if(prevent)
return SpcPreventAllowMediumRemoval(out senseBuffer, ScsiPreventAllowMode.Prevent, timeout,
out duration);
else
return SpcPreventAllowMediumRemoval(out senseBuffer, ScsiPreventAllowMode.Allow, timeout, out duration);
}

View File

@@ -727,8 +727,7 @@ namespace DiscImageChef.DiscImages
throw new
FeatureUnsupportedImageException(string.Format("Found INDEX before a track {0}",
line));
else
{
int index = int.Parse(matchIndex.Groups[1].Value);
ulong offset = CdrWinMsftoLba(matchIndex.Groups[2].Value);
@@ -768,7 +767,6 @@ namespace DiscImageChef.DiscImages
currentfileoffsetsector = offset;
currenttrack.Indexes.Add(index, offset);
}
}
else if(matchIsrc.Success)
{
DicConsole.DebugWriteLine("CDRWin plugin", "Found ISRC at line {0}", line);

View File

@@ -1153,7 +1153,8 @@ namespace DiscImageChef.DiscImages
throw new FeatureNotPresentImageException("Lead-out not present in disk image");
}
else throw new FeatureUnsupportedImageException("Feature not supported by image format");
throw new FeatureUnsupportedImageException("Feature not supported by image format");
}
#endregion
@@ -1442,7 +1443,8 @@ namespace DiscImageChef.DiscImages
getbuf <<= 1;
getlen--;
if(i < 0) return 1;
else return 0;
return 0;
}
int GetByte() /* get a byte */

View File

@@ -921,7 +921,7 @@ namespace DiscImageChef.DiscImages
if(!locatorFound || parentPath == null)
throw new
FileNotFoundException("(VirtualPC plugin): Cannot find parent file for differencing disk image");
else
{
parentImage = new Vhd();
Filter parentFilter =

View File

@@ -672,8 +672,7 @@ namespace DiscImageChef.DiscImages
public override byte[] ReadSectors(ulong sectorAddress, uint length)
{
if(differentTrackZeroSize) throw new NotImplementedException("Not yet implemented");
else
{
if(sectorAddress > ImageInfo.Sectors - 1)
throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found");
@@ -690,7 +689,6 @@ namespace DiscImageChef.DiscImages
return buffer;
}
}
public override string GetImageFormat()
{
@@ -915,7 +913,7 @@ namespace DiscImageChef.DiscImages
return MediaType.Unknown;
}
else
switch(ImageInfo.ImageSize)
{
case 80384: return MediaType.ECMA_66;

View File

@@ -94,13 +94,11 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Image format not identified, not proceeding with analysis.");
return;
}
else
{
if(options.Verbose)
DicConsole.VerboseWriteLine("Image format identified by {0} ({1}).", imageFormat.Name,
imageFormat.PluginUuid);
else DicConsole.WriteLine("Image format identified by {0}.", imageFormat.Name);
}
try
{

View File

@@ -74,26 +74,22 @@ namespace DiscImageChef.Commands
DicConsole.ErrorWriteLine("Input file 1 format not identified, not proceeding with comparison.");
return;
}
else
{
if(options.Verbose)
DicConsole.VerboseWriteLine("Input file 1 format identified by {0} ({1}).", input1Format.Name,
input1Format.PluginUuid);
else DicConsole.WriteLine("Input file 1 format identified by {0}.", input1Format.Name);
}
if(input2Format == null)
{
DicConsole.ErrorWriteLine("Input file 2 format not identified, not proceeding with comparison.");
return;
}
else
{
if(options.Verbose)
DicConsole.VerboseWriteLine("Input file 2 format identified by {0} ({1}).", input2Format.Name,
input2Format.PluginUuid);
else DicConsole.WriteLine("Input file 2 format identified by {0}.", input2Format.Name);
}
input1Format.OpenImage(inputFilter1);
input2Format.OpenImage(inputFilter2);

View File

@@ -97,13 +97,11 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Image format not identified, not proceeding with analysis.");
return;
}
else
{
if(options.Verbose)
DicConsole.VerboseWriteLine("Image format identified by {0} ({1}).", imageFormat.Name,
imageFormat.PluginUuid);
else DicConsole.WriteLine("Image format identified by {0}.", imageFormat.Name);
}
try
{

View File

@@ -95,13 +95,11 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Image format not identified, not proceeding with analysis.");
return;
}
else
{
if(options.Verbose)
DicConsole.VerboseWriteLine("Image format identified by {0} ({1}).", imageFormat.Name,
imageFormat.PluginUuid);
else DicConsole.WriteLine("Image format identified by {0}.", imageFormat.Name);
}
if(Directory.Exists(options.OutputDir) || File.Exists(options.OutputDir))
{

View File

@@ -91,13 +91,11 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Image format not identified, not proceeding with analysis.");
return;
}
else
{
if(options.Verbose)
DicConsole.VerboseWriteLine("Image format identified by {0} ({1}).", imageFormat.Name,
imageFormat.PluginUuid);
else DicConsole.WriteLine("Image format identified by {0}.", imageFormat.Name);
}
try
{