mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Reformatted.
This commit is contained in:
@@ -75,7 +75,7 @@ namespace DiscImageChef.Devices
|
||||
cdb[1] = (byte)((lba & 0x1F0000) >> 16);
|
||||
cdb[2] = (byte)((lba & 0xFF00) >> 8);
|
||||
cdb[3] = (byte)(lba & 0xFF);
|
||||
if (drive1)
|
||||
if(drive1)
|
||||
cdb[1] += 0x20;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
@@ -117,7 +117,7 @@ namespace DiscImageChef.Devices
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Adaptec_SetErrorThreshold;
|
||||
if (drive1)
|
||||
if(drive1)
|
||||
cdb[1] += 0x20;
|
||||
cdb[4] = 1;
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace DiscImageChef.Devices
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Adaptec_Translate;
|
||||
if (drive1)
|
||||
if(drive1)
|
||||
cdb[1] += 0x20;
|
||||
cdb[4] = (byte)buffer.Length;
|
||||
|
||||
@@ -179,7 +179,7 @@ namespace DiscImageChef.Devices
|
||||
public bool AdaptecWriteBuffer(byte[] buffer, out byte[] senseBuffer, uint timeout, out double duration)
|
||||
{
|
||||
byte[] oneKBuffer = new byte[1024];
|
||||
if (buffer.Length < 1024)
|
||||
if(buffer.Length < 1024)
|
||||
Array.Copy(buffer, 0, oneKBuffer, 0, buffer.Length);
|
||||
else
|
||||
Array.Copy(buffer, 0, oneKBuffer, 0, 1024);
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace DiscImageChef.Devices
|
||||
cdb[1] = (byte)((lba & 0x1F0000) >> 16);
|
||||
cdb[2] = (byte)((lba & 0xFF00) >> 8);
|
||||
cdb[3] = (byte)(lba & 0xFF);
|
||||
if (immediate)
|
||||
if(immediate)
|
||||
cdb[1] += 0x01;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense);
|
||||
|
||||
@@ -64,21 +64,21 @@ namespace DiscImageChef.Devices
|
||||
Array.Copy(tmp, 0, secondHalfBytes, 0, 8);
|
||||
}
|
||||
|
||||
if (mode != FujitsuDisplayModes.Half)
|
||||
if(mode != FujitsuDisplayModes.Half)
|
||||
{
|
||||
if (!ArrayHelpers.ArrayIsNullOrWhiteSpace(firstHalfBytes) &&
|
||||
if(!ArrayHelpers.ArrayIsNullOrWhiteSpace(firstHalfBytes) &&
|
||||
!ArrayHelpers.ArrayIsNullOrWhiteSpace(secondHalfBytes))
|
||||
{
|
||||
displayLen = true;
|
||||
halfMsg = false;
|
||||
}
|
||||
else if (ArrayHelpers.ArrayIsNullOrWhiteSpace(firstHalfBytes) &&
|
||||
else if(ArrayHelpers.ArrayIsNullOrWhiteSpace(firstHalfBytes) &&
|
||||
!ArrayHelpers.ArrayIsNullOrWhiteSpace(secondHalfBytes))
|
||||
{
|
||||
displayLen = false;
|
||||
halfMsg = false;
|
||||
}
|
||||
else if (!ArrayHelpers.ArrayIsNullOrWhiteSpace(firstHalfBytes) &&
|
||||
else if(!ArrayHelpers.ArrayIsNullOrWhiteSpace(firstHalfBytes) &&
|
||||
ArrayHelpers.ArrayIsNullOrWhiteSpace(secondHalfBytes))
|
||||
{
|
||||
displayLen = false;
|
||||
@@ -92,11 +92,11 @@ namespace DiscImageChef.Devices
|
||||
}
|
||||
|
||||
buffer[0] = (byte)((byte)mode << 5);
|
||||
if (displayLen)
|
||||
if(displayLen)
|
||||
buffer[0] += 0x10;
|
||||
if (flash)
|
||||
if(flash)
|
||||
buffer[0] += 0x08;
|
||||
if (halfMsg)
|
||||
if(halfMsg)
|
||||
buffer[0] += 0x04;
|
||||
buffer[0] += 0x01; // Always ASCII
|
||||
|
||||
|
||||
@@ -87,9 +87,9 @@ namespace DiscImageChef.Devices
|
||||
cdb[5] = (byte)(address & 0xFF);
|
||||
cdb[7] = (byte)((transferLen & 0xFF00) >> 8);
|
||||
cdb[8] = (byte)(transferLen & 0xFF);
|
||||
if (pba)
|
||||
if(pba)
|
||||
cdb[9] += 0x80;
|
||||
if (sectorCount)
|
||||
if(sectorCount)
|
||||
cdb[9] += 0x40;
|
||||
|
||||
if(sectorCount)
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace DiscImageChef.Devices
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
if (sense)
|
||||
if(sense)
|
||||
return true;
|
||||
|
||||
ushort confLength = (ushort)(((int)buffer[2] << 8) + buffer[3] + 4);
|
||||
@@ -149,7 +149,7 @@ namespace DiscImageChef.Devices
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
if (sense)
|
||||
if(sense)
|
||||
return true;
|
||||
|
||||
ushort strctLength = (ushort)(((int)buffer[0] << 8) + buffer[1] + 2);
|
||||
@@ -299,7 +299,7 @@ namespace DiscImageChef.Devices
|
||||
tmpBuffer = new byte[1024];
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.ReadTocPmaAtip;
|
||||
if (MSF)
|
||||
if(MSF)
|
||||
cdb[1] = 0x02;
|
||||
cdb[2] = (byte)(format & 0x0F);
|
||||
cdb[6] = trackSessionNumber;
|
||||
@@ -312,7 +312,7 @@ namespace DiscImageChef.Devices
|
||||
uint strctLength = (uint)(((int)tmpBuffer[0] << 8) + tmpBuffer[1] + 2);
|
||||
buffer = new byte[strctLength];
|
||||
|
||||
if (buffer.Length <= tmpBuffer.Length)
|
||||
if(buffer.Length <= tmpBuffer.Length)
|
||||
{
|
||||
Array.Copy(tmpBuffer, 0, buffer, 0, buffer.Length);
|
||||
DicConsole.DebugWriteLine("SCSI Device", "READ TOC/PMA/ATIP took {0} ms.", duration);
|
||||
@@ -511,9 +511,9 @@ namespace DiscImageChef.Devices
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.PreventAllowMediumRemoval;
|
||||
if (prevent)
|
||||
if(prevent)
|
||||
cdb[4] += 0x01;
|
||||
if (persistent)
|
||||
if(persistent)
|
||||
cdb[4] += 0x02;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense);
|
||||
@@ -552,9 +552,9 @@ namespace DiscImageChef.Devices
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.StartStopUnit;
|
||||
if (immediate)
|
||||
if(immediate)
|
||||
cdb[1] += 0x01;
|
||||
if (changeFormatLayer)
|
||||
if(changeFormatLayer)
|
||||
{
|
||||
cdb[3] = (byte)(formatLayer & 0x03);
|
||||
cdb[4] += 0x04;
|
||||
|
||||
@@ -145,12 +145,12 @@ namespace DiscImageChef.Devices
|
||||
cdb[8] = (byte)((transferLength & 0xFF00) >> 8);
|
||||
cdb[9] = (byte)(transferLength & 0xFF);
|
||||
|
||||
if (errorFlags)
|
||||
if(errorFlags)
|
||||
{
|
||||
buffer = new byte[2646 * transferLength];
|
||||
cdb[6] = 0x1F;
|
||||
}
|
||||
else if (wholeSector)
|
||||
else if(wholeSector)
|
||||
{
|
||||
buffer = new byte[2352 * transferLength];
|
||||
cdb[6] = 0x0F;
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace DiscImageChef.Devices
|
||||
cdb[3] = (byte)((address & 0xFF0000) >> 16);
|
||||
cdb[4] = (byte)((address & 0xFF00) >> 8);
|
||||
cdb[5] = (byte)(address & 0xFF);
|
||||
if (pba)
|
||||
if(pba)
|
||||
cdb[9] += 0x80;
|
||||
|
||||
buffer = new byte[8];
|
||||
|
||||
@@ -227,7 +227,7 @@ namespace DiscImageChef.Devices
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR POWEREC GET SPEEDS took {0} ms.", duration);
|
||||
|
||||
if (!sense && !error)
|
||||
if(!sense && !error)
|
||||
{
|
||||
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
||||
selected = BigEndianBitConverter.ToUInt16(buf, 4);
|
||||
@@ -266,7 +266,7 @@ namespace DiscImageChef.Devices
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "PLEXTOR POWEREC GET SPEEDS took {0} ms.", duration);
|
||||
|
||||
if (!sense && !error)
|
||||
if(!sense && !error)
|
||||
{
|
||||
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
||||
enabled = buf[2] != 0;
|
||||
|
||||
@@ -76,13 +76,13 @@ namespace DiscImageChef.Devices
|
||||
cdb[11] = (byte)((buffer.Length & 0xFF0000) >> 16);
|
||||
cdb[12] = (byte)((buffer.Length & 0xFF00) >> 8);
|
||||
cdb[13] = (byte)(buffer.Length & 0xFF);
|
||||
if (cache)
|
||||
if(cache)
|
||||
cdb[14] += 0x01;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
if (sense)
|
||||
if(sense)
|
||||
return true;
|
||||
|
||||
uint attrLen = (uint)(((int)buffer[0] << 24) + ((int)buffer[1] << 16) + ((int)buffer[2] << 8) + buffer[3] + 4);
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace DiscImageChef.Devices
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
if (sense)
|
||||
if(sense)
|
||||
return true;
|
||||
|
||||
byte pagesLength = (byte)(buffer[4] + 5);
|
||||
@@ -171,11 +171,11 @@ namespace DiscImageChef.Devices
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
if (sense)
|
||||
if(sense)
|
||||
return true;
|
||||
|
||||
// This is because INQ was returned instead of EVPD
|
||||
if (buffer[1] != page)
|
||||
if(buffer[1] != page)
|
||||
return true;
|
||||
|
||||
byte pagesLength = (byte)(buffer[3] + 4);
|
||||
@@ -263,7 +263,7 @@ namespace DiscImageChef.Devices
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.ModeSense;
|
||||
if (DBD)
|
||||
if(DBD)
|
||||
cdb[1] = 0x08;
|
||||
cdb[2] |= (byte)pageControl;
|
||||
cdb[2] |= (byte)(pageCode & 0x3F);
|
||||
@@ -274,7 +274,7 @@ namespace DiscImageChef.Devices
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
if (sense)
|
||||
if(sense)
|
||||
return true;
|
||||
|
||||
byte modeLength = (byte)(buffer[0] + 1);
|
||||
@@ -344,9 +344,9 @@ namespace DiscImageChef.Devices
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.ModeSense10;
|
||||
if (LLBAA)
|
||||
if(LLBAA)
|
||||
cdb[1] |= 0x10;
|
||||
if (DBD)
|
||||
if(DBD)
|
||||
cdb[1] |= 0x08;
|
||||
cdb[2] |= (byte)pageControl;
|
||||
cdb[2] |= (byte)(pageCode & 0x3F);
|
||||
@@ -358,7 +358,7 @@ namespace DiscImageChef.Devices
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
if (sense)
|
||||
if(sense)
|
||||
return true;
|
||||
|
||||
ushort modeLength = (ushort)(((int)buffer[0] << 8) + buffer[1] + 2);
|
||||
@@ -409,7 +409,7 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="prevent"><c>true</c> to prevent medium removal, <c>false</c> to allow it.</param>
|
||||
public bool SpcPreventAllowMediumRemoval(out byte[] senseBuffer, bool prevent, uint timeout, out double duration)
|
||||
{
|
||||
if (prevent)
|
||||
if(prevent)
|
||||
return SpcPreventAllowMediumRemoval(out senseBuffer, ScsiPreventAllowMode.Prevent, timeout, out duration);
|
||||
else
|
||||
return SpcPreventAllowMediumRemoval(out senseBuffer, ScsiPreventAllowMode.Allow, timeout, out duration);
|
||||
@@ -474,10 +474,10 @@ namespace DiscImageChef.Devices
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.ReadCapacity;
|
||||
|
||||
if (PMI)
|
||||
if(PMI)
|
||||
{
|
||||
cdb[8] = 0x01;
|
||||
if (RelAddr)
|
||||
if(RelAddr)
|
||||
cdb[1] = 0x01;
|
||||
|
||||
cdb[2] = (byte)((address & 0xFF000000) >> 24);
|
||||
@@ -527,7 +527,7 @@ namespace DiscImageChef.Devices
|
||||
cdb[0] = (byte)ScsiCommands.ServiceActionIn;
|
||||
cdb[1] = (byte)ScsiServiceActions.ReadCapacity16;
|
||||
|
||||
if (PMI)
|
||||
if(PMI)
|
||||
{
|
||||
cdb[14] = 0x01;
|
||||
byte[] temp = BitConverter.GetBytes(address);
|
||||
@@ -579,7 +579,7 @@ namespace DiscImageChef.Devices
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
if (sense)
|
||||
if(sense)
|
||||
return true;
|
||||
|
||||
uint strctLength = (uint)(((int)buffer[0] << 24) + ((int)buffer[1] << 16) + ((int)buffer[2] << 8) + buffer[3] + 4);
|
||||
@@ -704,9 +704,9 @@ namespace DiscImageChef.Devices
|
||||
senseBuffer = new byte[32];
|
||||
|
||||
// Prevent overflows
|
||||
if (buffer.Length > 255)
|
||||
if(buffer.Length > 255)
|
||||
{
|
||||
if (platformID != Interop.PlatformID.Win32NT && platformID != Interop.PlatformID.Win32S && platformID != Interop.PlatformID.Win32Windows && platformID != Interop.PlatformID.WinCE && platformID != Interop.PlatformID.WindowsPhone && platformID != Interop.PlatformID.Xbox)
|
||||
if(platformID != Interop.PlatformID.Win32NT && platformID != Interop.PlatformID.Win32S && platformID != Interop.PlatformID.Win32Windows && platformID != Interop.PlatformID.WinCE && platformID != Interop.PlatformID.WindowsPhone && platformID != Interop.PlatformID.Xbox)
|
||||
lastError = 75;
|
||||
else
|
||||
lastError = 111;
|
||||
@@ -719,9 +719,9 @@ namespace DiscImageChef.Devices
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.ModeSelect;
|
||||
if (pageFormat)
|
||||
if(pageFormat)
|
||||
cdb[1] += 0x10;
|
||||
if (savePages)
|
||||
if(savePages)
|
||||
cdb[1] += 0x01;
|
||||
cdb[4] = (byte)buffer.Length;
|
||||
|
||||
@@ -746,9 +746,9 @@ namespace DiscImageChef.Devices
|
||||
senseBuffer = new byte[32];
|
||||
|
||||
// Prevent overflows
|
||||
if (buffer.Length > 65535)
|
||||
if(buffer.Length > 65535)
|
||||
{
|
||||
if (platformID != Interop.PlatformID.Win32NT && platformID != Interop.PlatformID.Win32S && platformID != Interop.PlatformID.Win32Windows && platformID != Interop.PlatformID.WinCE && platformID != Interop.PlatformID.WindowsPhone && platformID != Interop.PlatformID.Xbox)
|
||||
if(platformID != Interop.PlatformID.Win32NT && platformID != Interop.PlatformID.Win32S && platformID != Interop.PlatformID.Win32Windows && platformID != Interop.PlatformID.WinCE && platformID != Interop.PlatformID.WindowsPhone && platformID != Interop.PlatformID.Xbox)
|
||||
lastError = 75;
|
||||
else
|
||||
lastError = 111;
|
||||
@@ -761,9 +761,9 @@ namespace DiscImageChef.Devices
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.ModeSelect10;
|
||||
if (pageFormat)
|
||||
if(pageFormat)
|
||||
cdb[1] += 0x10;
|
||||
if (savePages)
|
||||
if(savePages)
|
||||
cdb[1] += 0x01;
|
||||
cdb[7] = (byte)((buffer.Length & 0xFF00) << 8);
|
||||
cdb[8] = (byte)(buffer.Length & 0xFF);
|
||||
|
||||
@@ -86,15 +86,15 @@ namespace DiscImageChef.Devices
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.LoadUnload;
|
||||
if (immediate)
|
||||
if(immediate)
|
||||
cdb[1] = 0x01;
|
||||
if (load)
|
||||
if(load)
|
||||
cdb[4] += 0x01;
|
||||
if (retense)
|
||||
if(retense)
|
||||
cdb[4] += 0x02;
|
||||
if (endOfTape)
|
||||
if(endOfTape)
|
||||
cdb[4] += 0x04;
|
||||
if (hold)
|
||||
if(hold)
|
||||
cdb[4] += 0x08;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense);
|
||||
@@ -176,11 +176,11 @@ namespace DiscImageChef.Devices
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Locate;
|
||||
if (immediate)
|
||||
if(immediate)
|
||||
cdb[1] += 0x01;
|
||||
if (changePartition)
|
||||
if(changePartition)
|
||||
cdb[1] += 0x02;
|
||||
if (blockType)
|
||||
if(blockType)
|
||||
cdb[1] += 0x04;
|
||||
cdb[3] = (byte)((objectId & 0xFF000000) >> 24);
|
||||
cdb[4] = (byte)((objectId & 0xFF0000) >> 16);
|
||||
@@ -270,11 +270,11 @@ namespace DiscImageChef.Devices
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Locate16;
|
||||
cdb[1] = (byte)((byte)destType << 3);
|
||||
if (immediate)
|
||||
if(immediate)
|
||||
cdb[1] += 0x01;
|
||||
if (changePartition)
|
||||
if(changePartition)
|
||||
cdb[1] += 0x02;
|
||||
if (bam)
|
||||
if(bam)
|
||||
cdb[2] = 0x01;
|
||||
cdb[3] = partition;
|
||||
|
||||
@@ -337,7 +337,7 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool Read6(out byte[] buffer, out byte[] senseBuffer, bool sili, bool fixedLen, uint transferLen, uint blockSize, uint timeout, out double duration)
|
||||
{
|
||||
if (fixedLen)
|
||||
if(fixedLen)
|
||||
buffer = new byte[blockSize * transferLen];
|
||||
else
|
||||
buffer = new byte[transferLen];
|
||||
@@ -346,9 +346,9 @@ namespace DiscImageChef.Devices
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Read6;
|
||||
if (fixedLen)
|
||||
if(fixedLen)
|
||||
cdb[1] += 0x01;
|
||||
if (sili)
|
||||
if(sili)
|
||||
cdb[1] += 0x02;
|
||||
cdb[2] = (byte)((transferLen & 0xFF0000) >> 16);
|
||||
cdb[3] = (byte)((transferLen & 0xFF00) >> 8);
|
||||
@@ -441,7 +441,7 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool Read16(out byte[] buffer, out byte[] senseBuffer, bool sili, bool fixedLen, byte partition, ulong objectId, uint transferLen, uint objectSize, uint timeout, out double duration)
|
||||
{
|
||||
if (fixedLen)
|
||||
if(fixedLen)
|
||||
buffer = new byte[objectSize * transferLen];
|
||||
else
|
||||
buffer = new byte[transferLen];
|
||||
@@ -451,9 +451,9 @@ namespace DiscImageChef.Devices
|
||||
byte[] idBytes = BitConverter.GetBytes(objectId);
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Read16;
|
||||
if (fixedLen)
|
||||
if(fixedLen)
|
||||
cdb[1] += 0x01;
|
||||
if (sili)
|
||||
if(sili)
|
||||
cdb[1] += 0x02;
|
||||
cdb[3] = partition;
|
||||
cdb[4] = idBytes[7];
|
||||
@@ -537,11 +537,11 @@ namespace DiscImageChef.Devices
|
||||
public bool ReadPosition(out byte[] buffer, out byte[] senseBuffer, bool vendorType, bool longForm, bool totalPosition, uint timeout, out double duration)
|
||||
{
|
||||
byte responseForm = 0;
|
||||
if (vendorType)
|
||||
if(vendorType)
|
||||
responseForm += 0x01;
|
||||
if (longForm)
|
||||
if(longForm)
|
||||
responseForm += 0x02;
|
||||
if (totalPosition)
|
||||
if(totalPosition)
|
||||
responseForm += 0x04;
|
||||
|
||||
return ReadPosition(out buffer, out senseBuffer, (SscPositionForms)responseForm, timeout, out duration);
|
||||
@@ -557,7 +557,7 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool ReadPosition(out byte[] buffer, out byte[] senseBuffer, SscPositionForms responseForm, uint timeout, out double duration)
|
||||
{
|
||||
switch (responseForm)
|
||||
switch(responseForm)
|
||||
{
|
||||
case SscPositionForms.Long:
|
||||
case SscPositionForms.OldLong:
|
||||
@@ -639,7 +639,7 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool ReadReverse6(out byte[] buffer, out byte[] senseBuffer, bool byteOrder, bool sili, bool fixedLen, uint transferLen, uint blockSize, uint timeout, out double duration)
|
||||
{
|
||||
if (fixedLen)
|
||||
if(fixedLen)
|
||||
buffer = new byte[blockSize * transferLen];
|
||||
else
|
||||
buffer = new byte[transferLen];
|
||||
@@ -648,11 +648,11 @@ namespace DiscImageChef.Devices
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.ReadReverse;
|
||||
if (fixedLen)
|
||||
if(fixedLen)
|
||||
cdb[1] += 0x01;
|
||||
if (sili)
|
||||
if(sili)
|
||||
cdb[1] += 0x02;
|
||||
if (byteOrder)
|
||||
if(byteOrder)
|
||||
cdb[1] += 0x04;
|
||||
cdb[2] = (byte)((transferLen & 0xFF0000) >> 16);
|
||||
cdb[3] = (byte)((transferLen & 0xFF00) >> 8);
|
||||
@@ -746,7 +746,7 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, bool byteOrder, bool sili, bool fixedLen, byte partition, ulong objectId, uint transferLen, uint objectSize, uint timeout, out double duration)
|
||||
{
|
||||
if (fixedLen)
|
||||
if(fixedLen)
|
||||
buffer = new byte[objectSize * transferLen];
|
||||
else
|
||||
buffer = new byte[transferLen];
|
||||
@@ -756,11 +756,11 @@ namespace DiscImageChef.Devices
|
||||
byte[] idBytes = BitConverter.GetBytes(objectId);
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Read16;
|
||||
if (fixedLen)
|
||||
if(fixedLen)
|
||||
cdb[1] += 0x01;
|
||||
if (sili)
|
||||
if(sili)
|
||||
cdb[1] += 0x02;
|
||||
if (byteOrder)
|
||||
if(byteOrder)
|
||||
cdb[1] += 0x04;
|
||||
cdb[3] = partition;
|
||||
cdb[4] = idBytes[7];
|
||||
@@ -825,7 +825,7 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool RecoverBufferedData(out byte[] buffer, out byte[] senseBuffer, bool sili, bool fixedLen, uint transferLen, uint blockSize, uint timeout, out double duration)
|
||||
{
|
||||
if (fixedLen)
|
||||
if(fixedLen)
|
||||
buffer = new byte[blockSize * transferLen];
|
||||
else
|
||||
buffer = new byte[transferLen];
|
||||
@@ -834,9 +834,9 @@ namespace DiscImageChef.Devices
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.RecoverBufferedData;
|
||||
if (fixedLen)
|
||||
if(fixedLen)
|
||||
cdb[1] += 0x01;
|
||||
if (sili)
|
||||
if(sili)
|
||||
cdb[1] += 0x02;
|
||||
cdb[2] = (byte)((transferLen & 0xFF0000) >> 16);
|
||||
cdb[3] = (byte)((transferLen & 0xFF00) >> 8);
|
||||
@@ -892,9 +892,9 @@ namespace DiscImageChef.Devices
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.ReportDensitySupport;
|
||||
if (currentMedia)
|
||||
if(currentMedia)
|
||||
cdb[1] += 0x01;
|
||||
if (mediumType)
|
||||
if(mediumType)
|
||||
cdb[1] += 0x02;
|
||||
cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8);
|
||||
cdb[8] = (byte)(buffer.Length & 0xFF);
|
||||
@@ -902,7 +902,7 @@ namespace DiscImageChef.Devices
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
error = lastError != 0;
|
||||
|
||||
if (sense)
|
||||
if(sense)
|
||||
return true;
|
||||
|
||||
ushort availableLength = (ushort)(((int)buffer[0] << 8) + buffer[1] + 2);
|
||||
@@ -945,7 +945,7 @@ namespace DiscImageChef.Devices
|
||||
bool sense;
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Rewind;
|
||||
if (immediate)
|
||||
if(immediate)
|
||||
cdb[1] += 0x01;
|
||||
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense);
|
||||
|
||||
@@ -95,14 +95,14 @@ namespace DiscImageChef.Devices
|
||||
cdb[2] = (byte)((lba & 0xFF00) >> 8);
|
||||
cdb[3] = (byte)(lba & 0xFF);
|
||||
cdb[4] = transferLength;
|
||||
if (inhibitDma)
|
||||
if(inhibitDma)
|
||||
cdb[5] += 0x80;
|
||||
if (readLong)
|
||||
if(readLong)
|
||||
cdb[5] += 0x40;
|
||||
|
||||
if (!inhibitDma && !readLong)
|
||||
if(!inhibitDma && !readLong)
|
||||
{
|
||||
if (transferLength == 0)
|
||||
if(transferLength == 0)
|
||||
buffer = new byte[256 * blockSize];
|
||||
else
|
||||
buffer = new byte[transferLength * blockSize];
|
||||
@@ -115,11 +115,11 @@ namespace DiscImageChef.Devices
|
||||
else
|
||||
buffer = new byte[0];
|
||||
|
||||
if (!inhibitDma)
|
||||
if(!inhibitDma)
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
else
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense);
|
||||
|
||||
|
||||
error = lastError != 0;
|
||||
|
||||
DicConsole.DebugWriteLine("SCSI Device", "SYQUEST READ (6) took {0} ms.", duration);
|
||||
@@ -180,12 +180,12 @@ namespace DiscImageChef.Devices
|
||||
cdb[5] = (byte)(lba & 0xFF);
|
||||
cdb[7] = (byte)((transferLength & 0xFF00) >> 8);
|
||||
cdb[8] = (byte)(transferLength & 0xFF);
|
||||
if (inhibitDma)
|
||||
if(inhibitDma)
|
||||
cdb[9] += 0x80;
|
||||
if (readLong)
|
||||
if(readLong)
|
||||
cdb[9] += 0x40;
|
||||
|
||||
if (!inhibitDma && !readLong)
|
||||
if(!inhibitDma && !readLong)
|
||||
{
|
||||
buffer = new byte[transferLength * blockSize];
|
||||
}
|
||||
@@ -197,7 +197,7 @@ namespace DiscImageChef.Devices
|
||||
else
|
||||
buffer = new byte[0];
|
||||
|
||||
if (!inhibitDma)
|
||||
if(!inhibitDma)
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
else
|
||||
lastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration, out sense);
|
||||
|
||||
Reference in New Issue
Block a user