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

@@ -1885,21 +1885,12 @@ namespace DiscImageChef.Decoders.ATA
IdentifyDevice ATAID = IdentifyDeviceResponse.Value;
if(ATAID.GeneralConfiguration.HasFlag(GeneralConfigurationBit.NonMagnetic))
if((ushort)ATAID.GeneralConfiguration != 0x848A)
{
//if (ATAID.CommandSet.HasFlag(CommandSetBit.Packet))
//{
atapi = true;
cfa = false;
//}
}
else
{
atapi = false;
cfa = true;
}
if(atapi && !cfa) sb.AppendLine("ATAPI device");
else if(!atapi && cfa) sb.AppendLine("CompactFlash device");
if(atapi) sb.AppendLine("ATAPI device");
else if(cfa) sb.AppendLine("CompactFlash device");
else sb.AppendLine("ATA device");
if(ATAID.Model != "") sb.AppendFormat("Model: {0}", ATAID.Model).AppendLine();

View File

@@ -428,7 +428,7 @@ namespace DiscImageChef.Decoders.CD
int type = response.LeadInStartFrame % 10;
int frm = response.LeadInStartFrame - type;
string manufacturer = "";
string manufacturer;
if(response.DiscType) sb.AppendLine("Disc uses phase change");
else

View File

@@ -612,7 +612,7 @@ namespace DiscImageChef.Decoders.Floppy
public static bool IsApple2GCR(byte[] data)
{
int position = 0;
int position;
RawSector sector = MarshalSector(data, out position, 0);
return sector != null && position != 0;

View File

@@ -495,7 +495,7 @@ namespace DiscImageChef.Decoders.Floppy
public static bool IsAppleSonyGCR(byte[] data)
{
int position = 0;
int position;
RawSector sector = MarshalSector(data, out position, 0);
return sector != null && position != 0;

View File

@@ -293,7 +293,7 @@ namespace DiscImageChef.Decoders
{
if(tag == null) return null;
PriamTag pmTag = new PriamTag();
PriamTag pmTag;
switch(tag.Length)
{

View File

@@ -56,7 +56,7 @@ namespace DiscImageChef.Decoders.MMC
if(response.Length != 4) return null;
byte[] data = new byte[16];
byte[] tmp = new byte[4];
byte[] tmp;
tmp = BitConverter.GetBytes(response[0]);
Array.Copy(tmp, 0, data, 0, 4);
@@ -85,7 +85,6 @@ namespace DiscImageChef.Decoders.MMC
Array.Copy(response, 3, tmp, 0, 6);
cid.ProductName = StringHandlers.CToString(tmp);
cid.ProductRevision = response[9];
tmp = new byte[4];
cid.ProductSerialNumber = BitConverter.ToUInt32(response, 10);
cid.ManufacturingDate = response[14];
cid.CRC = (byte)((response[15] & 0xFE) >> 1);

View File

@@ -81,7 +81,7 @@ namespace DiscImageChef.Decoders.MMC
if(response.Length != 4) return null;
byte[] data = new byte[16];
byte[] tmp = new byte[4];
byte[] tmp;
tmp = BitConverter.GetBytes(response[0]);
Array.Copy(tmp, 0, data, 0, 4);
@@ -146,7 +146,7 @@ namespace DiscImageChef.Decoders.MMC
double unitFactor = 0;
double multiplier = 0;
double result = 0;
double result;
string unit = "";
StringBuilder sb = new StringBuilder();
@@ -483,6 +483,7 @@ namespace DiscImageChef.Decoders.MMC
if(csd.WriteProtectGroupEnable)
{
sb.AppendLine("\tDevice can write protect regions");
// TODO: Check specification
unitFactor = Convert.ToDouble(csd.WriteProtectGroupSize);
sb.AppendFormat("\tDevice can write protect a minimum of {0} blocks at a time", (int)(result + 1))
.AppendLine();

View File

@@ -205,7 +205,7 @@ namespace DiscImageChef.Decoders.MMC
if(response.Length != 512) return null;
ExtendedCSD csd = new ExtendedCSD();
ExtendedCSD csd;
GCHandle handle = GCHandle.Alloc(response, GCHandleType.Pinned);
csd = (ExtendedCSD)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(ExtendedCSD));
handle.Free();

View File

@@ -237,6 +237,7 @@ namespace DiscImageChef.Decoders.PCMCIA
continue;
}
// TODO: Check this
if(!secondString)
{
tuple.Product = StringHandlers.CToString(buffer.ToArray());

View File

@@ -467,7 +467,7 @@ namespace DiscImageChef.Decoders.SCSI
if(descriptor.PIV)
{
string protocol = "";
string protocol;
switch(descriptor.ProtocolIdentifier)
{
case ProtocolIdentifiers.ADT:

View File

@@ -197,7 +197,7 @@ namespace DiscImageChef.Decoders.SCSI
else if(page.CLEAR && page.ADDP)
sb.AppendLine("\tDevice shall erase all partitions differing on size on MODE SELECT for partitioning");
string measure = "";
string measure;
switch(page.PSUM)
{

View File

@@ -181,7 +181,7 @@ namespace DiscImageChef.Decoders.SCSI
if(header.Value.WriteProtected) sb.AppendLine("\tMedium is write protected");
string medium = "";
string medium;
switch(header.Value.MediumType)
{

View File

@@ -55,7 +55,7 @@ namespace DiscImageChef.Decoders.SecureDigital
if(response.Length != 4) return null;
byte[] data = new byte[16];
byte[] tmp = new byte[4];
byte[] tmp;
tmp = BitConverter.GetBytes(response[0]);
Array.Copy(tmp, 0, data, 0, 4);

View File

@@ -77,7 +77,7 @@ namespace DiscImageChef.Decoders.SecureDigital
if(response.Length != 4) return null;
byte[] data = new byte[16];
byte[] tmp = new byte[4];
byte[] tmp;
tmp = BitConverter.GetBytes(response[0]);
Array.Copy(tmp, 0, data, 0, 4);
@@ -142,7 +142,7 @@ namespace DiscImageChef.Decoders.SecureDigital
double unitFactor = 0;
double multiplier = 0;
double result = 0;
double result;
string unit = "";
StringBuilder sb = new StringBuilder();

View File

@@ -59,7 +59,7 @@ namespace DiscImageChef.Decoders.SecureDigital
if(response.Length != 2) return null;
byte[] data = new byte[8];
byte[] tmp = new byte[4];
byte[] tmp;
tmp = BitConverter.GetBytes(response[0]);
Array.Copy(tmp, 0, data, 0, 4);

View File

@@ -114,7 +114,7 @@ namespace DiscImageChef.Decoders.Sega
if(ipbin_sector.Length < 512) return null;
IPBin ipbin = new IPBin();
IPBin ipbin;
IntPtr ptr = Marshal.AllocHGlobal(512);
Marshal.Copy(ipbin_sector, 0, ptr, 512);
ipbin = (IPBin)Marshal.PtrToStructure(ptr, typeof(IPBin));

View File

@@ -91,7 +91,7 @@ namespace DiscImageChef.Decoders.Sega
if(ipbin_sector.Length < 512) return null;
IPBin ipbin = new IPBin();
IPBin ipbin;
IntPtr ptr = Marshal.AllocHGlobal(512);
Marshal.Copy(ipbin_sector, 0, ptr, 512);
ipbin = (IPBin)Marshal.PtrToStructure(ptr, typeof(IPBin));

View File

@@ -77,7 +77,7 @@ namespace DiscImageChef.Decoders.Sega
if(ipbin_sector.Length < 512) return null;
IPBin ipbin = new IPBin();
IPBin ipbin;
IntPtr ptr = Marshal.AllocHGlobal(512);
Marshal.Copy(ipbin_sector, 0, ptr, 512);
ipbin = (IPBin)Marshal.PtrToStructure(ptr, typeof(IPBin));