REFACTOR: Convert variables to auto setters.

This commit is contained in:
2017-12-21 07:19:46 +00:00
parent 5592f147ac
commit e1d0544c3c
36 changed files with 625 additions and 790 deletions

View File

@@ -46,10 +46,10 @@ namespace DiscImageChef.Devices
registers.command = (byte)AtaCommands.ReadBuffer;
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
out sense);
error = lastError != 0;
Error = LastError != 0;
DicConsole.DebugWriteLine("ATA Device", "READ BUFFER took {0} ms.", duration);
@@ -65,9 +65,9 @@ namespace DiscImageChef.Devices
registers.command = (byte)AtaCommands.ReadBufferDma;
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.NoTransfer,
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.NoTransfer,
ref buffer, timeout, false, out duration, out sense);
error = lastError != 0;
Error = LastError != 0;
DicConsole.DebugWriteLine("ATA Device", "READ BUFFER DMA took {0} ms.", duration);
@@ -97,9 +97,9 @@ namespace DiscImageChef.Devices
registers.lbaLow = (byte)((lba & 0xFF) / 0x1);
registers.deviceHead += 0x40;
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.SectorCount,
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.SectorCount,
ref buffer, timeout, true, out duration, out sense);
error = lastError != 0;
Error = LastError != 0;
DicConsole.DebugWriteLine("ATA Device", "READ DMA took {0} ms.", duration);
@@ -122,10 +122,10 @@ namespace DiscImageChef.Devices
registers.lbaLow = (byte)((lba & 0xFF) / 0x1);
registers.deviceHead += 0x40;
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
out sense);
error = lastError != 0;
Error = LastError != 0;
DicConsole.DebugWriteLine("ATA Device", "READ MULTIPLE took {0} ms.", duration);
@@ -143,10 +143,10 @@ namespace DiscImageChef.Devices
registers.command = (byte)AtaCommands.ReadNativeMaxAddress;
registers.deviceHead += 0x40;
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
out sense);
error = lastError != 0;
Error = LastError != 0;
if((statusRegisters.status & 0x23) == 0)
{
@@ -185,10 +185,10 @@ namespace DiscImageChef.Devices
registers.lbaLow = (byte)((lba & 0xFF) / 0x1);
registers.deviceHead += 0x40;
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
out sense);
error = lastError != 0;
Error = LastError != 0;
DicConsole.DebugWriteLine("ATA Device", "READ SECTORS took {0} ms.", duration);
@@ -217,10 +217,10 @@ namespace DiscImageChef.Devices
registers.lbaLow = (byte)((lba & 0xFF) / 0x1);
registers.deviceHead += 0x40;
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
out sense);
error = lastError != 0;
Error = LastError != 0;
DicConsole.DebugWriteLine("ATA Device", "READ LONG took {0} ms.", duration);
@@ -240,10 +240,10 @@ namespace DiscImageChef.Devices
registers.lbaLow = (byte)((lba & 0xFF) / 0x1);
registers.deviceHead += 0x40;
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
out sense);
error = lastError != 0;
Error = LastError != 0;
DicConsole.DebugWriteLine("ATA Device", "SEEK took {0} ms.", duration);

View File

@@ -48,10 +48,10 @@ namespace DiscImageChef.Devices
registers.command = (byte)AtaCommands.NativeMaxAddress;
registers.feature = 0x0000;
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
out sense);
error = lastError != 0;
Error = LastError != 0;
if((statusRegisters.status & 0x23) == 0)
{
@@ -81,9 +81,9 @@ namespace DiscImageChef.Devices
registers.lbaLow = (ushort)((lba & 0xFFFF) / 0x1);
registers.deviceHead += 0x40;
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.SectorCount,
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.SectorCount,
ref buffer, timeout, true, out duration, out sense);
error = lastError != 0;
Error = LastError != 0;
DicConsole.DebugWriteLine("ATA Device", "READ DMA EXT took {0} ms.", duration);
@@ -103,10 +103,10 @@ namespace DiscImageChef.Devices
registers.lbaLow += logAddress;
registers.lbaHigh = (ushort)((pageNumber & 0xFF00) / 0x100);
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
out sense);
error = lastError != 0;
Error = LastError != 0;
DicConsole.DebugWriteLine("ATA Device", "READ LOG EXT took {0} ms.", duration);
@@ -126,9 +126,9 @@ namespace DiscImageChef.Devices
registers.lbaLow += logAddress;
registers.lbaHigh = (ushort)((pageNumber & 0xFF00) / 0x100);
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.SectorCount,
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.SectorCount,
ref buffer, timeout, true, out duration, out sense);
error = lastError != 0;
Error = LastError != 0;
DicConsole.DebugWriteLine("ATA Device", "READ LOG DMA EXT took {0} ms.", duration);
@@ -150,10 +150,10 @@ namespace DiscImageChef.Devices
registers.lbaLow = (ushort)((lba & 0xFFFF) / 0x1);
registers.deviceHead += 0x40;
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
out sense);
error = lastError != 0;
Error = LastError != 0;
DicConsole.DebugWriteLine("ATA Device", "READ MULTIPLE EXT took {0} ms.", duration);
@@ -171,10 +171,10 @@ namespace DiscImageChef.Devices
registers.command = (byte)AtaCommands.ReadNativeMaxAddressExt;
registers.deviceHead += 0x40;
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
out sense);
error = lastError != 0;
Error = LastError != 0;
if((statusRegisters.status & 0x23) == 0)
{
@@ -204,10 +204,10 @@ namespace DiscImageChef.Devices
registers.lbaLow = (ushort)((lba & 0xFFFF) / 0x1);
registers.deviceHead += 0x40;
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
out sense);
error = lastError != 0;
Error = LastError != 0;
DicConsole.DebugWriteLine("ATA Device", "READ SECTORS EXT took {0} ms.", duration);

View File

@@ -90,10 +90,10 @@ namespace DiscImageChef.Devices
registers.command = (byte)AtaCommands.IdentifyDevice;
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
out sense);
error = lastError != 0;
Error = LastError != 0;
DicConsole.DebugWriteLine("ATA Device", "IDENTIFY DEVICE took {0} ms.", duration);
@@ -122,9 +122,9 @@ namespace DiscImageChef.Devices
registers.deviceHead = (byte)(head & 0x0F);
registers.sector = sector;
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.SectorCount,
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.Dma, AtaTransferRegister.SectorCount,
ref buffer, timeout, true, out duration, out sense);
error = lastError != 0;
Error = LastError != 0;
DicConsole.DebugWriteLine("ATA Device", "READ DMA took {0} ms.", duration);
@@ -146,10 +146,10 @@ namespace DiscImageChef.Devices
registers.deviceHead = (byte)(head & 0x0F);
registers.sector = sector;
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
out sense);
error = lastError != 0;
Error = LastError != 0;
DicConsole.DebugWriteLine("ATA Device", "READ MULTIPLE took {0} ms.", duration);
@@ -178,10 +178,10 @@ namespace DiscImageChef.Devices
registers.deviceHead = (byte)(head & 0x0F);
registers.sector = sector;
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
out sense);
error = lastError != 0;
Error = LastError != 0;
DicConsole.DebugWriteLine("ATA Device", "READ SECTORS took {0} ms.", duration);
@@ -210,10 +210,10 @@ namespace DiscImageChef.Devices
registers.deviceHead = (byte)(head & 0x0F);
registers.sector = sector;
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
AtaTransferRegister.SectorCount, ref buffer, timeout, true, out duration,
out sense);
error = lastError != 0;
Error = LastError != 0;
DicConsole.DebugWriteLine("ATA Device", "READ LONG took {0} ms.", duration);
@@ -233,10 +233,10 @@ namespace DiscImageChef.Devices
registers.deviceHead = (byte)(head & 0x0F);
registers.sector = sector;
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
AtaTransferRegister.NoTransfer, ref buffer, timeout, true, out duration,
out sense);
error = lastError != 0;
Error = LastError != 0;
DicConsole.DebugWriteLine("ATA Device", "SEEK took {0} ms.", duration);

View File

@@ -90,10 +90,10 @@ namespace DiscImageChef.Devices
registers.command = (byte)AtaCommands.IdentifyPacketDevice;
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
out sense);
error = lastError != 0;
Error = LastError != 0;
DicConsole.DebugWriteLine("ATA Device", "IDENTIFY PACKET DEVICE took {0} ms.", duration);

View File

@@ -51,10 +51,10 @@ namespace DiscImageChef.Devices
registers.lbaLow = (byte)((lba & 0xFF) / 0x1);
registers.deviceHead += 0x40;
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
out sense);
error = lastError != 0;
Error = LastError != 0;
DicConsole.DebugWriteLine("ATA Device", "CFA TRANSLATE SECTOR took {0} ms.", duration);
@@ -74,10 +74,10 @@ namespace DiscImageChef.Devices
registers.sector = sector;
registers.deviceHead = (byte)(head & 0x0F);
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
out sense);
error = lastError != 0;
Error = LastError != 0;
DicConsole.DebugWriteLine("ATA Device", "CFA TRANSLATE SECTOR took {0} ms.", duration);
@@ -93,10 +93,10 @@ namespace DiscImageChef.Devices
registers.command = (byte)AtaCommands.RequestSense;
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
out sense);
error = lastError != 0;
Error = LastError != 0;
errorCode = statusRegisters.error;

View File

@@ -59,10 +59,10 @@ namespace DiscImageChef.Devices
registers.command = (byte)AtaCommands.CheckMediaCardType;
registers.feature = feature;
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
out sense);
error = lastError != 0;
Error = LastError != 0;
DicConsole.DebugWriteLine("ATA Device", "CHECK MEDIA CARD TYPE took {0} ms.", duration);

View File

@@ -48,10 +48,10 @@ namespace DiscImageChef.Devices
registers.lbaHigh = 0xC2;
registers.lbaMid = 0x4F;
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
out sense);
error = lastError != 0;
Error = LastError != 0;
DicConsole.DebugWriteLine("ATA Device", "SMART DISABLE OPERATIONS took {0} ms.", duration);
@@ -71,10 +71,10 @@ namespace DiscImageChef.Devices
registers.lbaMid = 0x4F;
registers.sectorCount = 0xF1;
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
out sense);
error = lastError != 0;
Error = LastError != 0;
DicConsole.DebugWriteLine("ATA Device", "SMART ENABLE ATTRIBUTE AUTOSAVE took {0} ms.", duration);
@@ -93,10 +93,10 @@ namespace DiscImageChef.Devices
registers.lbaHigh = 0xC2;
registers.lbaMid = 0x4F;
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
out sense);
error = lastError != 0;
Error = LastError != 0;
DicConsole.DebugWriteLine("ATA Device", "SMART DISABLE ATTRIBUTE AUTOSAVE took {0} ms.", duration);
@@ -114,10 +114,10 @@ namespace DiscImageChef.Devices
registers.lbaHigh = 0xC2;
registers.lbaMid = 0x4F;
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
out sense);
error = lastError != 0;
Error = LastError != 0;
DicConsole.DebugWriteLine("ATA Device", "SMART ENABLE OPERATIONS took {0} ms.", duration);
@@ -137,10 +137,10 @@ namespace DiscImageChef.Devices
registers.lbaMid = 0x4F;
registers.lbaLow = subcommand;
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
out sense);
error = lastError != 0;
Error = LastError != 0;
DicConsole.DebugWriteLine("ATA Device", "SMART EXECUTE OFF-LINE IMMEDIATE took {0} ms.", duration);
@@ -159,10 +159,10 @@ namespace DiscImageChef.Devices
registers.lbaHigh = 0xC2;
registers.lbaMid = 0x4F;
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
out sense);
error = lastError != 0;
Error = LastError != 0;
DicConsole.DebugWriteLine("ATA Device", "SMART READ DATA took {0} ms.", duration);
@@ -182,10 +182,10 @@ namespace DiscImageChef.Devices
registers.lbaMid = 0x4F;
registers.lbaLow = logAddress;
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.PioIn,
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
out sense);
error = lastError != 0;
Error = LastError != 0;
DicConsole.DebugWriteLine("ATA Device", "SMART READ LOG took {0} ms.", duration);
@@ -203,10 +203,10 @@ namespace DiscImageChef.Devices
registers.lbaHigh = 0xC2;
registers.lbaMid = 0x4F;
lastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
LastError = SendAtaCommand(registers, out statusRegisters, AtaProtocol.NonData,
AtaTransferRegister.NoTransfer, ref buffer, timeout, false, out duration,
out sense);
error = lastError != 0;
Error = LastError != 0;
DicConsole.DebugWriteLine("ATA Device", "SMART RETURN STATUS took {0} ms.", duration);