mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Code cleanup.
This commit is contained in:
@@ -76,19 +76,19 @@ namespace DiscImageChef.Devices
|
||||
/// </param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool LoadUnload(out byte[] senseBuffer, bool immediate, bool load, bool retense, bool endOfTape,
|
||||
bool hold, uint timeout, out double duration)
|
||||
public bool LoadUnload(out byte[] senseBuffer, bool immediate, bool load, bool retense, bool endOfTape,
|
||||
bool hold, uint timeout, out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[6];
|
||||
byte[] cdb = new byte[6];
|
||||
byte[] buffer = new byte[0];
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.LoadUnload;
|
||||
if(immediate) cdb[1] = 0x01;
|
||||
if(load) cdb[4] += 0x01;
|
||||
if(retense) cdb[4] += 0x02;
|
||||
if(immediate) cdb[1] = 0x01;
|
||||
if(load) cdb[4] += 0x01;
|
||||
if(retense) cdb[4] += 0x02;
|
||||
if(endOfTape) cdb[4] += 0x04;
|
||||
if(hold) cdb[4] += 0x08;
|
||||
if(hold) cdb[4] += 0x08;
|
||||
|
||||
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.None, out duration,
|
||||
out bool sense);
|
||||
@@ -163,20 +163,21 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="objectId">Object identifier.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool Locate(out byte[] senseBuffer, bool immediate, bool blockType, bool changePartition, byte partition,
|
||||
uint objectId, uint timeout, out double duration)
|
||||
public bool Locate(out byte[] senseBuffer, bool immediate, bool blockType, bool changePartition,
|
||||
byte partition,
|
||||
uint objectId, uint timeout, out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[10];
|
||||
byte[] cdb = new byte[10];
|
||||
byte[] buffer = new byte[0];
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Locate;
|
||||
if(immediate) cdb[1] += 0x01;
|
||||
if(immediate) cdb[1] += 0x01;
|
||||
if(changePartition) cdb[1] += 0x02;
|
||||
if(blockType) cdb[1] += 0x04;
|
||||
if(blockType) cdb[1] += 0x04;
|
||||
cdb[3] = (byte)((objectId & 0xFF000000) >> 24);
|
||||
cdb[4] = (byte)((objectId & 0xFF0000) >> 16);
|
||||
cdb[5] = (byte)((objectId & 0xFF00) >> 8);
|
||||
cdb[4] = (byte)((objectId & 0xFF0000) >> 16);
|
||||
cdb[5] = (byte)((objectId & 0xFF00) >> 8);
|
||||
cdb[6] = (byte)(objectId & 0xFF);
|
||||
cdb[8] = partition;
|
||||
|
||||
@@ -243,7 +244,7 @@ namespace DiscImageChef.Devices
|
||||
out double duration)
|
||||
{
|
||||
return Locate16(out senseBuffer, immediate, true, SscLogicalIdTypes.ObjectId, false, partition, lba,
|
||||
timeout, out duration);
|
||||
timeout, out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -258,27 +259,28 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="identifier">Destination identifier.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool Locate16(out byte[] senseBuffer, bool immediate, bool changePartition, SscLogicalIdTypes destType,
|
||||
bool bam, byte partition, ulong identifier, uint timeout, out double duration)
|
||||
public bool Locate16(out byte[] senseBuffer, bool immediate, bool changePartition, SscLogicalIdTypes destType,
|
||||
bool bam, byte partition, ulong identifier, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[16];
|
||||
byte[] buffer = new byte[0];
|
||||
byte[] cdb = new byte[16];
|
||||
byte[] buffer = new byte[0];
|
||||
byte[] idBytes = BitConverter.GetBytes(identifier);
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Locate16;
|
||||
cdb[1] = (byte)((byte)destType << 3);
|
||||
if(immediate) cdb[1] += 0x01;
|
||||
if(immediate) cdb[1] += 0x01;
|
||||
if(changePartition) cdb[1] += 0x02;
|
||||
if(bam) cdb[2] = 0x01;
|
||||
if(bam) cdb[2] = 0x01;
|
||||
cdb[3] = partition;
|
||||
|
||||
cdb[4] = idBytes[7];
|
||||
cdb[5] = idBytes[6];
|
||||
cdb[6] = idBytes[5];
|
||||
cdb[7] = idBytes[4];
|
||||
cdb[8] = idBytes[3];
|
||||
cdb[9] = idBytes[2];
|
||||
cdb[4] = idBytes[7];
|
||||
cdb[5] = idBytes[6];
|
||||
cdb[6] = idBytes[5];
|
||||
cdb[7] = idBytes[4];
|
||||
cdb[8] = idBytes[3];
|
||||
cdb[9] = idBytes[2];
|
||||
cdb[10] = idBytes[1];
|
||||
cdb[11] = idBytes[0];
|
||||
|
||||
@@ -315,8 +317,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="blockSize">Block size in bytes.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool Read6(out byte[] buffer, out byte[] senseBuffer, bool sili, uint transferLen, uint blockSize,
|
||||
uint timeout, out double duration)
|
||||
public bool Read6(out byte[] buffer, out byte[] senseBuffer, bool sili, uint transferLen, uint blockSize,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
return Read6(out buffer, out senseBuffer, sili, false, transferLen, blockSize, timeout, out duration);
|
||||
}
|
||||
@@ -338,8 +340,9 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="blockSize">Block size in bytes.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <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)
|
||||
public bool Read6(out byte[] buffer, out byte[] senseBuffer, bool sili, bool fixedLen,
|
||||
uint transferLen,
|
||||
uint blockSize, uint timeout, out double duration)
|
||||
{
|
||||
buffer = fixedLen ? new byte[blockSize * transferLen] : new byte[transferLen];
|
||||
byte[] cdb = new byte[6];
|
||||
@@ -347,9 +350,9 @@ namespace DiscImageChef.Devices
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Read6;
|
||||
if(fixedLen) cdb[1] += 0x01;
|
||||
if(sili) cdb[1] += 0x02;
|
||||
if(sili) cdb[1] += 0x02;
|
||||
cdb[2] = (byte)((transferLen & 0xFF0000) >> 16);
|
||||
cdb[3] = (byte)((transferLen & 0xFF00) >> 8);
|
||||
cdb[3] = (byte)((transferLen & 0xFF00) >> 8);
|
||||
cdb[4] = (byte)(transferLen & 0xFF);
|
||||
|
||||
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
@@ -372,8 +375,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="blockSize">Object size in bytes.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool Read16(out byte[] buffer, out byte[] senseBuffer, bool sili, ulong objectId, uint blocks,
|
||||
uint blockSize, uint timeout, out double duration)
|
||||
public bool Read16(out byte[] buffer, out byte[] senseBuffer, bool sili, ulong objectId, uint blocks,
|
||||
uint blockSize, uint timeout, out double duration)
|
||||
{
|
||||
return Read16(out buffer, out senseBuffer, sili, false, 0, objectId, blocks, blockSize, timeout,
|
||||
out duration);
|
||||
@@ -391,8 +394,9 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="blockSize">Object size in bytes.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool Read16(out byte[] buffer, out byte[] senseBuffer, bool sili, byte partition, ulong objectId,
|
||||
uint blocks, uint blockSize, uint timeout, out double duration)
|
||||
public bool Read16(out byte[] buffer, out byte[] senseBuffer, bool sili, byte partition,
|
||||
ulong objectId,
|
||||
uint blocks, uint blockSize, uint timeout, out double duration)
|
||||
{
|
||||
return Read16(out buffer, out senseBuffer, sili, false, partition, objectId, blocks, blockSize, timeout,
|
||||
out duration);
|
||||
@@ -408,8 +412,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="blockSize">Object size in bytes.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool Read16(out byte[] buffer, out byte[] senseBuffer, ulong objectId, uint blocks, uint blockSize,
|
||||
uint timeout, out double duration)
|
||||
public bool Read16(out byte[] buffer, out byte[] senseBuffer, ulong objectId, uint blocks, uint blockSize,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
return Read16(out buffer, out senseBuffer, false, true, 0, objectId, blocks, blockSize, timeout,
|
||||
out duration);
|
||||
@@ -426,8 +430,9 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="blockSize">Object size in bytes.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool Read16(out byte[] buffer, out byte[] senseBuffer, byte partition, ulong objectId, uint blocks,
|
||||
uint blockSize, uint timeout, out double duration)
|
||||
public bool Read16(out byte[] buffer, out byte[] senseBuffer, byte partition, ulong objectId,
|
||||
uint blocks,
|
||||
uint blockSize, uint timeout, out double duration)
|
||||
{
|
||||
return Read16(out buffer, out senseBuffer, false, true, partition, objectId, blocks, blockSize, timeout,
|
||||
out duration);
|
||||
@@ -452,8 +457,10 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="objectSize">Object size in bytes.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <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)
|
||||
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)
|
||||
{
|
||||
buffer = fixedLen ? new byte[objectSize * transferLen] : new byte[transferLen];
|
||||
byte[] cdb = new byte[6];
|
||||
@@ -462,18 +469,18 @@ namespace DiscImageChef.Devices
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Read16;
|
||||
if(fixedLen) cdb[1] += 0x01;
|
||||
if(sili) cdb[1] += 0x02;
|
||||
cdb[3] = partition;
|
||||
cdb[4] = idBytes[7];
|
||||
cdb[5] = idBytes[6];
|
||||
cdb[6] = idBytes[5];
|
||||
cdb[7] = idBytes[4];
|
||||
cdb[8] = idBytes[3];
|
||||
cdb[9] = idBytes[2];
|
||||
if(sili) cdb[1] += 0x02;
|
||||
cdb[3] = partition;
|
||||
cdb[4] = idBytes[7];
|
||||
cdb[5] = idBytes[6];
|
||||
cdb[6] = idBytes[5];
|
||||
cdb[7] = idBytes[4];
|
||||
cdb[8] = idBytes[3];
|
||||
cdb[9] = idBytes[2];
|
||||
cdb[10] = idBytes[1];
|
||||
cdb[11] = idBytes[0];
|
||||
cdb[12] = (byte)((transferLen & 0xFF0000) >> 16);
|
||||
cdb[13] = (byte)((transferLen & 0xFF00) >> 8);
|
||||
cdb[13] = (byte)((transferLen & 0xFF00) >> 8);
|
||||
cdb[14] = (byte)(transferLen & 0xFF);
|
||||
|
||||
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
@@ -543,12 +550,12 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="totalPosition">Requests current logical position.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool ReadPosition(out byte[] buffer, out byte[] senseBuffer, bool vendorType, bool longForm,
|
||||
bool totalPosition, uint timeout, out double duration)
|
||||
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) responseForm += 0x01;
|
||||
if(longForm) responseForm += 0x02;
|
||||
byte responseForm = 0;
|
||||
if(vendorType) responseForm += 0x01;
|
||||
if(longForm) responseForm += 0x02;
|
||||
if(totalPosition) responseForm += 0x04;
|
||||
|
||||
return ReadPosition(out buffer, out senseBuffer, (SscPositionForms)responseForm, timeout, out duration);
|
||||
@@ -631,8 +638,9 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="blockSize">Block size in bytes.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool ReadReverse6(out byte[] buffer, out byte[] senseBuffer, bool sili, uint transferLen, uint blockSize,
|
||||
uint timeout, out double duration)
|
||||
public bool ReadReverse6(out byte[] buffer, out byte[] senseBuffer, bool sili, uint transferLen,
|
||||
uint blockSize,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
return ReadReverse6(out buffer, out senseBuffer, false, sili, false, transferLen, blockSize, timeout,
|
||||
out duration);
|
||||
@@ -656,19 +664,20 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="blockSize">Block size in bytes.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <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)
|
||||
public bool ReadReverse6(out byte[] buffer, out byte[] senseBuffer, bool byteOrder, bool sili,
|
||||
bool fixedLen,
|
||||
uint transferLen, uint blockSize, uint timeout, out double duration)
|
||||
{
|
||||
buffer = fixedLen ? new byte[blockSize * transferLen] : new byte[transferLen];
|
||||
byte[] cdb = new byte[6];
|
||||
senseBuffer = new byte[32];
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.ReadReverse;
|
||||
if(fixedLen) cdb[1] += 0x01;
|
||||
if(sili) cdb[1] += 0x02;
|
||||
if(fixedLen) cdb[1] += 0x01;
|
||||
if(sili) cdb[1] += 0x02;
|
||||
if(byteOrder) cdb[1] += 0x04;
|
||||
cdb[2] = (byte)((transferLen & 0xFF0000) >> 16);
|
||||
cdb[3] = (byte)((transferLen & 0xFF00) >> 8);
|
||||
cdb[3] = (byte)((transferLen & 0xFF00) >> 8);
|
||||
cdb[4] = (byte)(transferLen & 0xFF);
|
||||
|
||||
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
@@ -691,11 +700,12 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="blockSize">Object size in bytes.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, bool sili, ulong objectId, uint blocks,
|
||||
uint blockSize, uint timeout, out double duration)
|
||||
public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, bool sili, ulong objectId,
|
||||
uint blocks,
|
||||
uint blockSize, uint timeout, out double duration)
|
||||
{
|
||||
return ReadReverse16(out buffer, out senseBuffer, false, sili, false, 0, objectId, blocks, blockSize,
|
||||
timeout, out duration);
|
||||
timeout, out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -710,11 +720,12 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="blockSize">Object size in bytes.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, bool sili, byte partition, ulong objectId,
|
||||
uint blocks, uint blockSize, uint timeout, out double duration)
|
||||
public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, bool sili, byte partition,
|
||||
ulong objectId,
|
||||
uint blocks, uint blockSize, uint timeout, out double duration)
|
||||
{
|
||||
return ReadReverse16(out buffer, out senseBuffer, false, sili, false, partition, objectId, blocks,
|
||||
blockSize, timeout, out duration);
|
||||
blockSize, timeout, out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -727,11 +738,11 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="blockSize">Object size in bytes.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, ulong objectId, uint blocks,
|
||||
uint blockSize, uint timeout, out double duration)
|
||||
public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, ulong objectId, uint blocks,
|
||||
uint blockSize, uint timeout, out double duration)
|
||||
{
|
||||
return ReadReverse16(out buffer, out senseBuffer, false, false, true, 0, objectId, blocks, blockSize,
|
||||
timeout, out duration);
|
||||
timeout, out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -745,11 +756,11 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="blockSize">Object size in bytes.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, byte partition, ulong objectId,
|
||||
uint blocks, uint blockSize, uint timeout, out double duration)
|
||||
public bool ReadReverse16(out byte[] buffer, out byte[] senseBuffer, byte partition, ulong objectId,
|
||||
uint blocks, uint blockSize, uint timeout, out double duration)
|
||||
{
|
||||
return ReadReverse16(out buffer, out senseBuffer, false, false, true, partition, objectId, blocks,
|
||||
blockSize, timeout, out duration);
|
||||
blockSize, timeout, out duration);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -772,8 +783,10 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="objectSize">Object size in bytes.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <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,
|
||||
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)
|
||||
{
|
||||
buffer = fixedLen ? new byte[objectSize * transferLen] : new byte[transferLen];
|
||||
@@ -782,20 +795,20 @@ namespace DiscImageChef.Devices
|
||||
byte[] idBytes = BitConverter.GetBytes(objectId);
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Read16;
|
||||
if(fixedLen) cdb[1] += 0x01;
|
||||
if(sili) cdb[1] += 0x02;
|
||||
if(fixedLen) cdb[1] += 0x01;
|
||||
if(sili) cdb[1] += 0x02;
|
||||
if(byteOrder) cdb[1] += 0x04;
|
||||
cdb[3] = partition;
|
||||
cdb[4] = idBytes[7];
|
||||
cdb[5] = idBytes[6];
|
||||
cdb[6] = idBytes[5];
|
||||
cdb[7] = idBytes[4];
|
||||
cdb[8] = idBytes[3];
|
||||
cdb[9] = idBytes[2];
|
||||
cdb[3] = partition;
|
||||
cdb[4] = idBytes[7];
|
||||
cdb[5] = idBytes[6];
|
||||
cdb[6] = idBytes[5];
|
||||
cdb[7] = idBytes[4];
|
||||
cdb[8] = idBytes[3];
|
||||
cdb[9] = idBytes[2];
|
||||
cdb[10] = idBytes[1];
|
||||
cdb[11] = idBytes[0];
|
||||
cdb[12] = (byte)((transferLen & 0xFF0000) >> 16);
|
||||
cdb[13] = (byte)((transferLen & 0xFF00) >> 8);
|
||||
cdb[13] = (byte)((transferLen & 0xFF00) >> 8);
|
||||
cdb[14] = (byte)(transferLen & 0xFF);
|
||||
|
||||
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
@@ -816,8 +829,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="blockSize">Block size in bytes.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool RecoverBufferedData(out byte[] buffer, out byte[] senseBuffer, uint blocks, uint blockSize,
|
||||
uint timeout, out double duration)
|
||||
public bool RecoverBufferedData(out byte[] buffer, out byte[] senseBuffer, uint blocks, uint blockSize,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
return RecoverBufferedData(out buffer, out senseBuffer, false, true, blocks, blockSize, timeout,
|
||||
out duration);
|
||||
@@ -833,8 +846,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="blockSize">Block size in bytes.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool RecoverBufferedData(out byte[] buffer, out byte[] senseBuffer, bool sili, uint transferLen,
|
||||
uint blockSize, uint timeout, out double duration)
|
||||
public bool RecoverBufferedData(out byte[] buffer, out byte[] senseBuffer, bool sili, uint transferLen,
|
||||
uint blockSize, uint timeout, out double duration)
|
||||
{
|
||||
return RecoverBufferedData(out buffer, out senseBuffer, sili, false, transferLen, blockSize, timeout,
|
||||
out duration);
|
||||
@@ -857,8 +870,10 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="blockSize">Block size in bytes.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <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)
|
||||
public bool RecoverBufferedData(out byte[] buffer, out byte[] senseBuffer, bool sili,
|
||||
bool fixedLen,
|
||||
uint transferLen, uint blockSize, uint timeout,
|
||||
out double duration)
|
||||
{
|
||||
buffer = fixedLen ? new byte[blockSize * transferLen] : new byte[transferLen];
|
||||
byte[] cdb = new byte[6];
|
||||
@@ -866,9 +881,9 @@ namespace DiscImageChef.Devices
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.RecoverBufferedData;
|
||||
if(fixedLen) cdb[1] += 0x01;
|
||||
if(sili) cdb[1] += 0x02;
|
||||
if(sili) cdb[1] += 0x02;
|
||||
cdb[2] = (byte)((transferLen & 0xFF0000) >> 16);
|
||||
cdb[3] = (byte)((transferLen & 0xFF00) >> 8);
|
||||
cdb[3] = (byte)((transferLen & 0xFF00) >> 8);
|
||||
cdb[4] = (byte)(transferLen & 0xFF);
|
||||
|
||||
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
@@ -915,8 +930,8 @@ namespace DiscImageChef.Devices
|
||||
/// <param name="currentMedia">If set to <c>true</c> descriptors should apply to currently inserted media.</param>
|
||||
/// <param name="timeout">Timeout.</param>
|
||||
/// <param name="duration">Duration.</param>
|
||||
public bool ReportDensitySupport(out byte[] buffer, out byte[] senseBuffer, bool mediumType, bool currentMedia,
|
||||
uint timeout, out double duration)
|
||||
public bool ReportDensitySupport(out byte[] buffer, out byte[] senseBuffer, bool mediumType, bool currentMedia,
|
||||
uint timeout, out double duration)
|
||||
{
|
||||
buffer = new byte[256];
|
||||
byte[] cdb = new byte[10];
|
||||
@@ -924,7 +939,7 @@ namespace DiscImageChef.Devices
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.ReportDensitySupport;
|
||||
if(currentMedia) cdb[1] += 0x01;
|
||||
if(mediumType) cdb[1] += 0x02;
|
||||
if(mediumType) cdb[1] += 0x02;
|
||||
cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8);
|
||||
cdb[8] = (byte)(buffer.Length & 0xFF);
|
||||
|
||||
@@ -935,9 +950,9 @@ namespace DiscImageChef.Devices
|
||||
if(sense) return true;
|
||||
|
||||
ushort availableLength = (ushort)((buffer[0] << 8) + buffer[1] + 2);
|
||||
buffer = new byte[availableLength];
|
||||
cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8);
|
||||
cdb[8] = (byte)(buffer.Length & 0xFF);
|
||||
buffer = new byte[availableLength];
|
||||
cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8);
|
||||
cdb[8] = (byte)(buffer.Length & 0xFF);
|
||||
senseBuffer = new byte[32];
|
||||
|
||||
LastError = SendScsiCommand(cdb, ref buffer, out senseBuffer, timeout, ScsiDirection.In, out duration,
|
||||
@@ -970,7 +985,7 @@ namespace DiscImageChef.Devices
|
||||
public bool Rewind(out byte[] senseBuffer, bool immediate, uint timeout, out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[6];
|
||||
byte[] cdb = new byte[6];
|
||||
byte[] buffer = new byte[0];
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.Rewind;
|
||||
@@ -996,7 +1011,7 @@ namespace DiscImageChef.Devices
|
||||
public bool TrackSelect(out byte[] senseBuffer, byte track, uint timeout, out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[6];
|
||||
byte[] cdb = new byte[6];
|
||||
byte[] buffer = new byte[0];
|
||||
|
||||
cdb[0] = (byte)ScsiCommands.TrackSelect;
|
||||
@@ -1014,7 +1029,7 @@ namespace DiscImageChef.Devices
|
||||
public bool Space(out byte[] senseBuffer, SscSpaceCodes code, int count, uint timeout, out double duration)
|
||||
{
|
||||
senseBuffer = new byte[32];
|
||||
byte[] cdb = new byte[6];
|
||||
byte[] cdb = new byte[6];
|
||||
byte[] buffer = new byte[0];
|
||||
byte[] countB = BitConverter.GetBytes(count);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user