REFACTOR: Removed unneeded value sets.

This commit is contained in:
2017-12-21 16:07:20 +00:00
parent 9883b567ff
commit bcbda18e4d
110 changed files with 203 additions and 280 deletions

View File

@@ -62,10 +62,10 @@ namespace DiscImageChef.Core.Devices.Dumping
MhddLog mhddLog;
IbgLog ibgLog;
bool sense = false;
ulong blocks = 0;
ulong blocks;
// TODO: Check subchannel support
uint blockSize = 0;
uint subSize = 0;
uint blockSize;
uint subSize;
byte[] tmpBuf;
FullTOC.CDFullTOC? toc = null;
DateTime start;
@@ -76,11 +76,11 @@ namespace DiscImageChef.Core.Devices.Dumping
double maxSpeed = double.MinValue;
double minSpeed = double.MaxValue;
Checksum dataChk;
bool readcd = false;
bool readcd;
byte[] readBuffer;
uint blocksToRead = 64;
ulong errored = 0;
DataFile dumpFile = null;
DataFile dumpFile;
bool aborted = false;
System.Console.CancelKeyPress += (sender, e) => { e.Cancel = aborted = true; };
@@ -387,8 +387,6 @@ namespace DiscImageChef.Core.Devices.Dumping
dumpFile = new DataFile(outputPrefix + ".leadin.bin");
dataChk = new Checksum();
start = DateTime.UtcNow;
readBuffer = null;
dumpLog.WriteLine("Reading Lead-in");
@@ -700,7 +698,7 @@ namespace DiscImageChef.Core.Devices.Dumping
break;
}
double cmdDuration = 0;
double cmdDuration;
DicConsole.Write("\rRetrying sector {0}, pass {1}, {3}{2}", badSector, pass + 1,
forward ? "forward" : "reverse",
@@ -742,8 +740,8 @@ namespace DiscImageChef.Core.Devices.Dumping
Modes.DecodedMode? currentMode = null;
Modes.ModePage? currentModePage = null;
byte[] md6 = null;
byte[] md10 = null;
byte[] md6;
byte[] md10;
if(!runningPersistent && persistent)
{

View File

@@ -55,14 +55,13 @@ namespace DiscImageChef.Core.Devices.Dumping
ref MediaType dskType, bool separateSubchannel, ref Resume resume,
ref DumpLog dumpLog, bool dumpLeadIn, Encoding encoding)
{
byte[] cmdBuf = null;
byte[] senseBuf = null;
bool sense = false;
byte[] cmdBuf;
byte[] senseBuf;
bool sense;
double duration;
ulong blocks = 0;
byte[] tmpBuf;
bool compactDisc = true;
ushort currentProfile = 0x0001;
bool isXbox = false;
Alcohol120 alcohol = new Alcohol120(outputPrefix);
@@ -76,7 +75,6 @@ namespace DiscImageChef.Core.Devices.Dumping
if(!sense)
{
Features.SeparatedFeatures ftr = Features.Separate(cmdBuf);
currentProfile = ftr.CurrentProfile;
dumpLog.WriteLine("Device reports current profile is 0x{0:X4}", ftr.CurrentProfile);
switch(ftr.CurrentProfile)

View File

@@ -62,14 +62,14 @@ namespace DiscImageChef.Core.Devices.Dumping
{
MhddLog mhddLog;
IbgLog ibgLog;
byte[] cmdBuf = null;
byte[] senseBuf = null;
bool sense = false;
byte[] cmdBuf;
byte[] senseBuf;
bool sense;
double duration;
ulong blocks = 0;
uint blockSize = 0;
uint logicalBlockSize = 0;
uint physicalBlockSize = 0;
ulong blocks;
uint blockSize;
uint logicalBlockSize;
uint physicalBlockSize;
byte scsiMediumType = 0;
byte scsiDensityCode = 0;
bool containsFloppyPage = false;
@@ -85,7 +85,7 @@ namespace DiscImageChef.Core.Devices.Dumping
byte[] readBuffer;
uint blocksToRead = 64;
ulong errored = 0;
DataFile dumpFile = null;
DataFile dumpFile;
bool aborted = false;
System.Console.CancelKeyPress += (sender, e) => { e.Cancel = aborted = true; };
@@ -331,8 +331,6 @@ namespace DiscImageChef.Core.Devices.Dumping
start = DateTime.UtcNow;
readBuffer = null;
if(alcohol != null && !dumpRaw)
{
alcohol.AddSessions(new[] {new Session {StartTrack = 1, EndTrack = 1, SessionSequence = 1}});
@@ -461,8 +459,8 @@ namespace DiscImageChef.Core.Devices.Dumping
Modes.DecodedMode? currentMode = null;
Modes.ModePage? currentModePage = null;
byte[] md6 = null;
byte[] md10 = null;
byte[] md6;
byte[] md10;
if(!runningPersistent && persistent)
{

View File

@@ -50,8 +50,8 @@ namespace DiscImageChef.Core.Devices.Dumping
bool dumpRaw, bool persistent, bool stopOnError, bool separateSubchannel,
ref Resume resume, ref DumpLog dumpLog, bool dumpLeadIn, Encoding encoding)
{
byte[] senseBuf = null;
bool sense = false;
byte[] senseBuf;
bool sense;
MediaType dskType = MediaType.Unknown;
int resets = 0;

View File

@@ -55,9 +55,9 @@ namespace DiscImageChef.Core.Devices.Dumping
bool aborted;
MhddLog mhddLog;
IbgLog ibgLog;
bool sense = false;
bool sense;
ulong blocks = 0;
uint blockSize = 0;
uint blockSize;
MediaType dskType = MediaType.Unknown;
DateTime start;
DateTime end;
@@ -66,7 +66,6 @@ namespace DiscImageChef.Core.Devices.Dumping
double currentSpeed = 0;
double maxSpeed = double.MinValue;
double minSpeed = double.MaxValue;
List<ulong> unreadableSectors = new List<ulong>();
Checksum dataChk;
dev.RequestSense(out byte[] senseBuf, dev.Timeout, out double duration);
@@ -372,8 +371,8 @@ namespace DiscImageChef.Core.Devices.Dumping
Checksum fileChk;
List<TapePartitionType> partitions = new List<TapePartitionType>();
List<TapeFileType> files = new List<TapeFileType>();
TapeFileType currentTapeFile = new TapeFileType();
TapePartitionType currentTapePartition = new TapePartitionType();
TapeFileType currentTapeFile;
TapePartitionType currentTapePartition;
DicConsole.WriteLine();
DataFile dumpFile = new DataFile(outputPrefix + ".bin");

View File

@@ -83,7 +83,7 @@ namespace DiscImageChef.Core.Devices.Dumping
uint blocksToRead = 128;
uint blockSize = 512;
ulong blocks = 0;
byte[] cid = null;
byte[] cid;
byte[] csd = null;
byte[] ocr = null;
byte[] ecsd = null;

View File

@@ -62,8 +62,8 @@ namespace DiscImageChef.Core.Devices.Dumping
{
MhddLog mhddLog;
IbgLog ibgLog;
bool sense = false;
ulong blocks = 0;
bool sense;
ulong blocks;
uint blockSize = 2048;
uint blocksToRead = 64;
ulong errored = 0;
@@ -75,7 +75,7 @@ namespace DiscImageChef.Core.Devices.Dumping
double maxSpeed = double.MinValue;
double minSpeed = double.MaxValue;
Checksum dataChk;
DataFile dumpFile = null;
DataFile dumpFile;
bool aborted = false;
System.Console.CancelKeyPress += (sender, e) => { e.Cancel = aborted = true; };
@@ -332,8 +332,6 @@ namespace DiscImageChef.Core.Devices.Dumping
start = DateTime.UtcNow;
readBuffer = null;
double cmdDuration = 0;
uint saveBlocksToRead = blocksToRead;
DumpHardwareType currentTry = null;
@@ -630,8 +628,6 @@ namespace DiscImageChef.Core.Devices.Dumping
break;
}
cmdDuration = 0;
DicConsole.Write("\rRetrying sector {0}, pass {1}, {3}{2}", badSector, pass + 1,
forward ? "forward" : "reverse",
runningPersistent ? "recovering partial data, " : "");
@@ -661,8 +657,8 @@ namespace DiscImageChef.Core.Devices.Dumping
Modes.DecodedMode? currentMode = null;
Modes.ModePage? currentModePage = null;
byte[] md6 = null;
byte[] md10 = null;
byte[] md6;
byte[] md10;
if(!runningPersistent && persistent)
{

View File

@@ -441,25 +441,25 @@ namespace DiscImageChef.Core.Devices
{
if(read16)
{
sense = dev.Read16(out readBuffer, out senseBuf, 0, false, true, false, 0, LogicalBlockSize, 0,
dev.Read16(out readBuffer, out senseBuf, 0, false, true, false, 0, LogicalBlockSize, 0,
BlocksToRead, false, timeout, out duration);
if(dev.Error) BlocksToRead /= 2;
}
else if(read12)
{
sense = dev.Read12(out readBuffer, out senseBuf, 0, false, false, false, false, 0, LogicalBlockSize, 0,
dev.Read12(out readBuffer, out senseBuf, 0, false, false, false, false, 0, LogicalBlockSize, 0,
BlocksToRead, false, timeout, out duration);
if(dev.Error) BlocksToRead /= 2;
}
else if(read10)
{
sense = dev.Read10(out readBuffer, out senseBuf, 0, false, true, false, false, 0, LogicalBlockSize, 0,
dev.Read10(out readBuffer, out senseBuf, 0, false, true, false, false, 0, LogicalBlockSize, 0,
(ushort)BlocksToRead, timeout, out duration);
if(dev.Error) BlocksToRead /= 2;
}
else if(read6)
{
sense = dev.Read6(out readBuffer, out senseBuf, 0, LogicalBlockSize, (byte)BlocksToRead, timeout,
dev.Read6(out readBuffer, out senseBuf, 0, LogicalBlockSize, (byte)BlocksToRead, timeout,
out duration);
if(dev.Error) BlocksToRead /= 2;
}
@@ -522,7 +522,7 @@ namespace DiscImageChef.Core.Devices
DicConsole.DebugWriteLine("SCSI Reader", "READ error:\n{0}",
Sense.PrettifySense(senseBuf));
return true;
return sense;
}
bool ScsiSeek(ulong block, out double duration)

View File

@@ -590,7 +590,7 @@ namespace DiscImageChef.Core.Devices.Report
mediaTest.NominalRotationRateSpecified = true;
}
uint logicalsectorsize = 0;
uint logicalsectorsize;
uint physicalsectorsize;
if((ataId.PhysLogSectorSize & 0x8000) == 0x0000 &&
(ataId.PhysLogSectorSize & 0x4000) == 0x4000)
@@ -682,7 +682,7 @@ namespace DiscImageChef.Core.Devices.Report
byte[] readBuf;
ulong checkCorrectRead = BitConverter.ToUInt64(buffer, 0);
bool sense = true;
bool sense;
DicConsole.WriteLine("Trying READ SECTOR(S) in CHS mode...");
sense = dev.Read(out readBuf, out errorChs, false, 0, 0, 1, 1, timeout, out duration);
@@ -961,7 +961,7 @@ namespace DiscImageChef.Core.Devices.Report
report.ATA.ReadCapabilities.NominalRotationRateSpecified = true;
}
uint logicalsectorsize = 0;
uint logicalsectorsize;
uint physicalsectorsize;
if((ataId.PhysLogSectorSize & 0x8000) == 0x0000 && (ataId.PhysLogSectorSize & 0x4000) == 0x4000)
{
@@ -1052,7 +1052,7 @@ namespace DiscImageChef.Core.Devices.Report
byte[] readBuf;
ulong checkCorrectRead = BitConverter.ToUInt64(buffer, 0);
bool sense = true;
bool sense;
DicConsole.WriteLine("Trying READ SECTOR(S) in CHS mode...");
sense = dev.Read(out readBuf, out errorChs, false, 0, 0, 1, 1, timeout, out duration);

View File

@@ -56,7 +56,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
bool sense;
uint timeout = 5;
ConsoleKeyInfo pressedKey;
Modes.DecodedMode? decMode = null;
Modes.DecodedMode? decMode;
report.SCSI.MultiMediaDevice = new mmcType();

View File

@@ -53,7 +53,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
bool sense;
uint timeout = 5;
ConsoleKeyInfo pressedKey;
Modes.DecodedMode? decMode = null;
Modes.DecodedMode? decMode;
report.SCSI.SequentialDevice = new sscType();
DicConsole.WriteLine("Querying SCSI READ BLOCK LIMITS...");
@@ -175,7 +175,7 @@ namespace DiscImageChef.Core.Devices.Report.SCSI
seqTest.MediaIsRecognized = true;
sense = dev.Load(out senseBuffer, timeout, out duration);
dev.Load(out senseBuffer, timeout, out duration);
sense = dev.ScsiTestUnitReady(out senseBuffer, timeout, out duration);
if(sense)
{

View File

@@ -53,7 +53,7 @@ namespace DiscImageChef.Core.Devices.Scanning
ushort currentProfile = 0x0001;
AtaErrorRegistersCHS errorChs;
uint timeout = 5;
double duration = 0;
double duration;
sense = dev.AtaIdentify(out cmdBuf, out errorChs);
if(!sense && Identify.Decode(cmdBuf).HasValue)
@@ -108,14 +108,14 @@ namespace DiscImageChef.Core.Devices.Scanning
results.SeekTotal = 0;
const int SEEK_TIMES = 1000;
double seekCur = 0;
double seekCur;
Random rnd = new Random();
uint seekPos = (uint)rnd.Next((int)results.Blocks);
ushort seekCy = (ushort)rnd.Next(cylinders);
byte seekHd = (byte)rnd.Next(heads);
byte seekSc = (byte)rnd.Next(sectors);
uint seekPos;
ushort seekCy;
byte seekHd;
byte seekSc;
aborted = false;
System.Console.CancelKeyPress += (sender, e) => { e.Cancel = aborted = true; };

View File

@@ -192,7 +192,7 @@ namespace DiscImageChef.Core
FileStream fs = new FileStream(statsFile, FileMode.Open, FileAccess.Read);
XmlSerializer xs = new XmlSerializer(stats.GetType());
stats = (Stats)xs.Deserialize(fs);
xs.Deserialize(fs); // Just to test validity of stats file
fs.Seek(0, SeekOrigin.Begin);
WebRequest request = WebRequest.Create("http://discimagechef.claunia.com/api/uploadstats");