General refactor.

This commit is contained in:
2018-06-20 22:22:21 +01:00
parent dc1884f5d8
commit ec8b309670
93 changed files with 850 additions and 1015 deletions

View File

@@ -153,8 +153,6 @@ namespace DiscImageChef.Decoders.Floppy
if(sector.addressField.prologue[0] != 0xD5 || sector.addressField.prologue[1] != 0xAA ||
sector.addressField.prologue[2] != 0x96) return null;
uint ck1, ck2, ck3;
byte w3;
byte[] bf1 = new byte[175];
byte[] bf2 = new byte[175];
byte[] bf3 = new byte[175];
@@ -162,7 +160,7 @@ namespace DiscImageChef.Decoders.Floppy
MemoryStream ms = new MemoryStream();
int j = 0;
w3 = 0;
byte w3 = 0;
for(int i = 0; i <= 174; i++)
{
byte w4 = nib_data[j++];
@@ -177,9 +175,9 @@ namespace DiscImageChef.Decoders.Floppy
}
j = 0;
ck1 = 0;
ck2 = 0;
ck3 = 0;
uint ck1 = 0;
uint ck2 = 0;
uint ck3 = 0;
while(true)
{
ck1 = (ck1 & 0xFF) << 1;

View File

@@ -148,7 +148,6 @@ namespace DiscImageChef.Decoders.MMC
double unitFactor = 0;
double multiplier = 0;
double result;
string unit = "";
StringBuilder sb = new StringBuilder();
@@ -257,7 +256,7 @@ namespace DiscImageChef.Decoders.MMC
break;
}
result = unitFactor * multiplier;
double result = unitFactor * multiplier;
sb.AppendFormat("\tAsynchronous data access time is {0}{1}", result, unit).AppendLine();
sb.AppendFormat("\tClock dependent part of data access is {0} clock cycles", csd.NSAC * 100).AppendLine();

View File

@@ -213,9 +213,8 @@ namespace DiscImageChef.Decoders.MMC
if(response.Length != 512) return null;
ExtendedCSD csd;
GCHandle handle = GCHandle.Alloc(response, GCHandleType.Pinned);
csd = (ExtendedCSD)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(ExtendedCSD));
ExtendedCSD csd = (ExtendedCSD)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(ExtendedCSD));
handle.Free();
return csd;
@@ -231,8 +230,9 @@ namespace DiscImageChef.Decoders.MMC
double unit;
if((csd.HPIFeatures & 0x01) == 0x01)
if((csd.HPIFeatures & 0x02) == 0x02) sb.AppendLine("\tDevice implements HPI using CMD12");
else sb.AppendLine("\tDevice implements HPI using CMD13");
sb.AppendLine((csd.HPIFeatures & 0x02) == 0x02
? "\tDevice implements HPI using CMD12"
: "\tDevice implements HPI using CMD13");
if((csd.BackgroundOperationsSupport & 0x01) == 0x01)
sb.AppendLine("\tDevice supports background operations");
@@ -574,9 +574,9 @@ namespace DiscImageChef.Decoders.MMC
if((csd.StrobeSupport & 0x01) == 0x01)
{
sb.AppendLine("\tDevice supports enhanced strobe mode");
if((csd.BusWidth & 0x80) == 0x80)
sb.AppendLine("\tDevice uses strobe during Data Out, CRC and CMD responses");
else sb.AppendLine("\tDevice uses strobe during Data Out and CRC responses");
sb.AppendLine((csd.BusWidth & 0x80) == 0x80
? "\tDevice uses strobe during Data Out, CRC and CMD responses"
: "\tDevice uses strobe during Data Out and CRC responses");
}
switch(csd.BusWidth & 0x0F)

View File

@@ -172,10 +172,9 @@ namespace DiscImageChef.Decoders.SCSI
if(page.SSEC) sb.AppendLine("\tDrive supports soft-sectoring format");
if(page.HSEC) sb.AppendLine("\tDrive supports hard-sectoring format");
if(page.RMB) sb.AppendLine("\tDrive media is removable");
if(page.SURF)
sb.AppendLine("\tSector addressing is progressively incremented in one surface before going to the next");
else
sb.AppendLine("\tSector addressing is progressively incremented in one cylinder before going to the next");
sb.AppendLine(page.SURF
? "\tSector addressing is progressively incremented in one surface before going to the next"
: "\tSector addressing is progressively incremented in one cylinder before going to the next");
return sb.ToString();
}

View File

@@ -46,11 +46,8 @@ namespace DiscImageChef.Decoders.SCSI
{
if(modeResponse == null || modeResponse.Length < 8) return null;
ushort modeLength;
ushort blockDescLength;
modeLength = (ushort)((modeResponse[0] << 8) + modeResponse[1]);
blockDescLength = (ushort)((modeResponse[6] << 8) + modeResponse[7]);
ushort modeLength = (ushort)((modeResponse[0] << 8) + modeResponse[1]);
ushort blockDescLength = (ushort)((modeResponse[6] << 8) + modeResponse[7]);
if(modeResponse.Length < modeLength) return null;

View File

@@ -145,7 +145,6 @@ namespace DiscImageChef.Decoders.SecureDigital
double unitFactor = 0;
double multiplier = 0;
double result;
string unit = "";
StringBuilder sb = new StringBuilder();
@@ -248,7 +247,7 @@ namespace DiscImageChef.Decoders.SecureDigital
break;
}
result = unitFactor * multiplier;
double result = unitFactor * multiplier;
sb.AppendFormat("\tAsynchronous data access time is {0}{1}", result, unit).AppendLine();
sb.AppendFormat("\tClock dependent part of data access is {0} clock cycles", csd.NSAC * 100).AppendLine();