Skip to content

Commit

Permalink
Code style fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
claunia committed Jul 22, 2020
1 parent 6220425 commit 2376b65
Show file tree
Hide file tree
Showing 972 changed files with 5,585 additions and 5,769 deletions.
5 changes: 2 additions & 3 deletions Aaru.Compression/AppleRle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ public class AppleRle
readonly Stream _inStream;
int _count;
bool _nextA; // true if A, false if B

byte _repeatedByteA, _repeatedByteB;
bool _repeatMode; // true if we're repeating, false if we're just copying
byte _repeatedByteA, _repeatedByteB;
bool _repeatMode; // true if we're repeating, false if we're just copying

public AppleRle(Stream stream)
{
Expand Down
2 changes: 1 addition & 1 deletion Aaru.Core/Checksum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public enum EnableChecksum
}

/// <summary>Checksums and hashes data, with different algorithms multithreaded</summary>
public class Checksum
public sealed class Checksum
{
readonly IChecksum _adler32Ctx;
readonly IChecksum _crc16Ctx;
Expand Down
5 changes: 3 additions & 2 deletions Aaru.Core/DataFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@
namespace Aaru.Core
{
/// <summary>Abstracts a datafile with a block based interface</summary>
[SuppressMessage("ReSharper", "UnusedMethodReturnValue.Global")]
public class DataFile
[SuppressMessage("ReSharper", "UnusedMethodReturnValue.Global"),
SuppressMessage("ReSharper", "UnusedMember.Global")]
public sealed class DataFile
{
readonly FileStream _dataFs;

Expand Down
12 changes: 6 additions & 6 deletions Aaru.Core/Delegates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

namespace Aaru.Core
{
/// <summary>Initializates a progress indicator (e.g. makes a progress bar visible)</summary>
/// <summary>Initializes a progress indicator (e.g. makes a progress bar visible)</summary>
public delegate void InitProgressHandler();

/// <summary>Updates a progress indicator with text</summary>
Expand All @@ -41,10 +41,10 @@ namespace Aaru.Core
/// <summary>Pulses a progress indicator with indeterminate boundaries</summary>
public delegate void PulseProgressHandler(string text);

/// <summary>Uninitializates a progress indicator (e.g. adds a newline to the console)</summary>
/// <summary>Uninitializes a progress indicator (e.g. adds a newline to the console)</summary>
public delegate void EndProgressHandler();

/// <summary>Initializates a secondary progress indicator (e.g. makes a progress bar visible)</summary>
/// <summary>Initializes a secondary progress indicator (e.g. makes a progress bar visible)</summary>
public delegate void InitProgressHandler2();

/// <summary>Updates a secondary progress indicator with text</summary>
Expand All @@ -53,10 +53,10 @@ namespace Aaru.Core
/// <summary>Pulses a secondary progress indicator with indeterminate boundaries</summary>
public delegate void PulseProgressHandler2(string text);

/// <summary>Uninitializates a secondary progress indicator (e.g. adds a newline to the console)</summary>
/// <summary>Uninitializes a secondary progress indicator (e.g. adds a newline to the console)</summary>
public delegate void EndProgressHandler2();

/// <summary>Initializates two progress indicators (e.g. makes a progress bar visible)</summary>
/// <summary>Initializes two progress indicators (e.g. makes a progress bar visible)</summary>
public delegate void InitTwoProgressHandler();

/// <summary>Updates two progress indicators with text</summary>
Expand All @@ -66,7 +66,7 @@ public delegate void UpdateTwoProgressHandler(string text, long current, long ma
/// <summary>Pulses a progress indicator with indeterminate boundaries</summary>
public delegate void PulseTwoProgressHandler(string text, string text2);

/// <summary>Uninitializates a progress indicator (e.g. adds a newline to the console)</summary>
/// <summary>Uninitializes a progress indicator (e.g. adds a newline to the console)</summary>
public delegate void EndTwoProgressHandler();

/// <summary>Updates a status indicator</summary>
Expand Down
51 changes: 24 additions & 27 deletions Aaru.Core/Devices/Dumping/ATA.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ namespace Aaru.Core.Devices.Dumping
public partial class Dump
{
/// <summary>Dumps an ATA device</summary>
public void Ata()
void Ata()
{
if(_dumpRaw)
{
Expand Down Expand Up @@ -96,7 +96,7 @@ public void Ata()
double maxSpeed = double.MinValue;
double minSpeed = double.MaxValue;

// Initializate reader
// Initialize reader
UpdateStatus?.Invoke("Initializing reader.");
_dumpLog.WriteLine("Initializing reader.");
var ataReader = new Reader(_dev, timeout, ataIdentify, _errorLog);
Expand All @@ -114,7 +114,7 @@ public void Ata()
}

uint blockSize = ataReader.LogicalBlockSize;
uint physicalsectorsize = ataReader.PhysicalBlockSize;
uint physicalSectorSize = ataReader.PhysicalBlockSize;

if(ataReader.FindReadCommand())
{
Expand Down Expand Up @@ -145,15 +145,15 @@ public void Ata()

UpdateStatus?.Invoke($"Device can read {blocksToRead} blocks at a time.");
UpdateStatus?.Invoke($"Device reports {blockSize} bytes per logical block.");
UpdateStatus?.Invoke($"Device reports {physicalsectorsize} bytes per physical block.");
UpdateStatus?.Invoke($"Device reports {physicalSectorSize} bytes per physical block.");
_dumpLog.WriteLine("Device reports {0} blocks ({1} bytes).", blocks, blocks * blockSize);

_dumpLog.WriteLine("Device reports {0} cylinders {1} heads {2} sectors per track.", cylinders,
heads, sectors);

_dumpLog.WriteLine("Device can read {0} blocks at a time.", blocksToRead);
_dumpLog.WriteLine("Device reports {0} bytes per logical block.", blockSize);
_dumpLog.WriteLine("Device reports {0} bytes per physical block.", physicalsectorsize);
_dumpLog.WriteLine("Device reports {0} bytes per physical block.", physicalSectorSize);

bool removable = !_dev.IsCompactFlash &&
ataId.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.Removable);
Expand Down Expand Up @@ -277,15 +277,13 @@ public void Ata()
if(blocks - i < blocksToRead)
blocksToRead = (byte)(blocks - i);

#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
if(currentSpeed > maxSpeed &&
currentSpeed != 0)
currentSpeed > 0)
maxSpeed = currentSpeed;

if(currentSpeed < minSpeed &&
currentSpeed != 0)
currentSpeed > 0)
minSpeed = currentSpeed;
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator

UpdateProgress?.Invoke($"Reading sector {i} of {blocks} ({currentSpeed:F3} MiB/sec.)",
(long)i, (long)blocks);
Expand Down Expand Up @@ -396,8 +394,8 @@ public void Ata()

EndProgress?.Invoke();
end = DateTime.UtcNow;
UpdateStatus?.Invoke($"Trimmming finished in {(end - start).TotalSeconds} seconds.");
_dumpLog.WriteLine("Trimmming finished in {0} seconds.", (end - start).TotalSeconds);
UpdateStatus?.Invoke($"Trimming finished in {(end - start).TotalSeconds} seconds.");
_dumpLog.WriteLine("Trimming finished in {0} seconds.", (end - start).TotalSeconds);
}
#endregion Trimming

Expand Down Expand Up @@ -493,15 +491,13 @@ public void Ata()
break;
}

#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
if(currentSpeed > maxSpeed &&
currentSpeed != 0)
currentSpeed > 0)
maxSpeed = currentSpeed;

if(currentSpeed < minSpeed &&
currentSpeed != 0)
currentSpeed > 0)
minSpeed = currentSpeed;
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator

PulseProgress?.
Invoke($"Reading cylinder {cy} head {hd} sector {sc} ({currentSpeed:F3} MiB/sec.)");
Expand Down Expand Up @@ -698,32 +694,33 @@ public void Ata()
switch(tuple.Code)
{
case TupleCodes.CISTPL_MANFID:
ManufacturerIdentificationTuple manfid =
ManufacturerIdentificationTuple manufacturerId =
CIS.DecodeManufacturerIdentificationTuple(tuple);

if(manfid != null)
if(manufacturerId != null)
{
sidecar.BlockMedia[0].PCMCIA.ManufacturerCode = manfid.ManufacturerID;
sidecar.BlockMedia[0].PCMCIA.ManufacturerCode =
manufacturerId.ManufacturerID;

sidecar.BlockMedia[0].PCMCIA.CardCode = manfid.CardID;
sidecar.BlockMedia[0].PCMCIA.CardCode = manufacturerId.CardID;
sidecar.BlockMedia[0].PCMCIA.ManufacturerCodeSpecified = true;
sidecar.BlockMedia[0].PCMCIA.CardCodeSpecified = true;
sidecar.BlockMedia[0].PCMCIA.CardCodeSpecified = true;
}

break;
case TupleCodes.CISTPL_VERS_1:
Level1VersionTuple vers = CIS.DecodeLevel1VersionTuple(tuple);
Level1VersionTuple version = CIS.DecodeLevel1VersionTuple(tuple);

if(vers != null)
if(version != null)
{
sidecar.BlockMedia[0].PCMCIA.Manufacturer = vers.Manufacturer;
sidecar.BlockMedia[0].PCMCIA.ProductName = vers.Product;
sidecar.BlockMedia[0].PCMCIA.Manufacturer = version.Manufacturer;
sidecar.BlockMedia[0].PCMCIA.ProductName = version.Product;

sidecar.BlockMedia[0].PCMCIA.Compliance =
$"{vers.MajorVersion}.{vers.MinorVersion}";
$"{version.MajorVersion}.{version.MinorVersion}";

sidecar.BlockMedia[0].PCMCIA.AdditionalInformation =
vers.AdditionalInformation;
version.AdditionalInformation;
}

break;
Expand Down Expand Up @@ -788,7 +785,7 @@ from fileSystem in partition.FileSystems
sidecar.BlockMedia[0].DiskSubType = subType;
sidecar.BlockMedia[0].Interface = "ATA";
sidecar.BlockMedia[0].LogicalBlocks = blocks;
sidecar.BlockMedia[0].PhysicalBlockSize = physicalsectorsize;
sidecar.BlockMedia[0].PhysicalBlockSize = physicalSectorSize;
sidecar.BlockMedia[0].LogicalBlockSize = blockSize;
sidecar.BlockMedia[0].Manufacturer = _dev.Manufacturer;
sidecar.BlockMedia[0].Model = _dev.Model;
Expand Down
25 changes: 9 additions & 16 deletions Aaru.Core/Devices/Dumping/CompactDisc/CdiReady.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,13 @@ void ReadCdiReady(uint blockSize, ref double currentSpeed, DumpHardwareType curr
{
ulong sectorSpeedStart = 0; // Used to calculate correct speed
DateTime timeSpeedStart = DateTime.UtcNow; // Time of start for speed calculation
bool sense = true; // Sense indicator
byte[] cmdBuf = null; // Data buffer
byte[] senseBuf = null; // Sense buffer
double cmdDuration = 0; // Command execution time
const uint sectorSize = 2352; // Full sector size
Track firstTrack = tracks.FirstOrDefault(t => t.TrackSequence == 1);
uint blocksToRead = 0; // How many sectors to read at once
bool sense; // Sense indicator
byte[] cmdBuf; // Data buffer
byte[] senseBuf; // Sense buffer
double cmdDuration; // Command execution time
const uint sectorSize = 2352; // Full sector size
Track firstTrack = tracks.FirstOrDefault(t => t.TrackSequence == 1);
uint blocksToRead; // How many sectors to read at once

if(firstTrack is null)
return;
Expand Down Expand Up @@ -200,21 +200,14 @@ void ReadCdiReady(uint blockSize, ref double currentSpeed, DumpHardwareType curr
}
}

#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator

// ReSharper disable CompareOfFloatsByEqualityOperator
if(currentSpeed > maxSpeed &&
currentSpeed != 0)
currentSpeed > 0)
maxSpeed = currentSpeed;

if(currentSpeed < minSpeed &&
currentSpeed != 0)
currentSpeed > 0)
minSpeed = currentSpeed;

// ReSharper restore CompareOfFloatsByEqualityOperator

#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator

UpdateProgress?.Invoke($"Reading sector {i} of {blocks} ({currentSpeed:F3} MiB/sec.)", (long)i,
(long)blocks);

Expand Down
23 changes: 8 additions & 15 deletions Aaru.Core/Devices/Dumping/CompactDisc/Data.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ void ReadCdData(ExtentsULong audioExtents, ulong blocks, uint blockSize, ref dou
{
ulong sectorSpeedStart = 0; // Used to calculate correct speed
DateTime timeSpeedStart = DateTime.UtcNow; // Time of start for speed calculation
uint blocksToRead = 0; // How many sectors to read at once
bool sense = true; // Sense indicator
byte[] cmdBuf = null; // Data buffer
byte[] senseBuf = null; // Sense buffer
double cmdDuration = 0; // Command execution time
const uint sectorSize = 2352; // Full sector size
uint blocksToRead; // How many sectors to read at once
bool sense = true; // Sense indicator
byte[] cmdBuf = null; // Data buffer
byte[] senseBuf = null; // Sense buffer
double cmdDuration = 0; // Command execution time
const uint sectorSize = 2352; // Full sector size
newTrim = false;
PlextorSubchannel supportedPlextorSubchannel;

Expand Down Expand Up @@ -259,21 +259,14 @@ void ReadCdData(ExtentsULong audioExtents, ulong blocks, uint blockSize, ref dou
crossingLeadOut = false;
}

#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator

// ReSharper disable CompareOfFloatsByEqualityOperator
if(currentSpeed > maxSpeed &&
currentSpeed != 0)
currentSpeed > 0)
maxSpeed = currentSpeed;

if(currentSpeed < minSpeed &&
currentSpeed != 0)
currentSpeed > 0)
minSpeed = currentSpeed;

// ReSharper restore CompareOfFloatsByEqualityOperator

#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator

UpdateProgress?.Invoke($"Reading sector {i} of {blocks} ({currentSpeed:F3} MiB/sec.)", (long)i,
(long)blocks);

Expand Down
Loading

0 comments on commit 2376b65

Please sign in to comment.