mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
REFACTOR: Remove unneeded code.
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using DiscImageChef.Console;
|
||||
|
||||
namespace DiscImageChef.Devices
|
||||
@@ -51,12 +52,12 @@ namespace DiscImageChef.Devices
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(firstHalf))
|
||||
{
|
||||
tmp = System.Text.Encoding.ASCII.GetBytes(firstHalf);
|
||||
tmp = Encoding.ASCII.GetBytes(firstHalf);
|
||||
Array.Copy(tmp, 0, firstHalfBytes, 0, 8);
|
||||
}
|
||||
if(!string.IsNullOrWhiteSpace(secondHalf))
|
||||
{
|
||||
tmp = System.Text.Encoding.ASCII.GetBytes(secondHalf);
|
||||
tmp = Encoding.ASCII.GetBytes(secondHalf);
|
||||
Array.Copy(tmp, 0, secondHalfBytes, 0, 8);
|
||||
}
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace DiscImageChef.Devices
|
||||
if(sense) return true;
|
||||
|
||||
#pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||
ushort confLength = (ushort)(((int)buffer[2] << 8) + buffer[3] + 4);
|
||||
ushort confLength = (ushort)((buffer[2] << 8) + buffer[3] + 4);
|
||||
#pragma warning restore IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||
buffer = new byte[confLength];
|
||||
cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8);
|
||||
@@ -157,7 +157,7 @@ namespace DiscImageChef.Devices
|
||||
if(sense) return true;
|
||||
|
||||
#pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||
ushort strctLength = (ushort)(((int)buffer[0] << 8) + buffer[1] + 2);
|
||||
ushort strctLength = (ushort)((buffer[0] << 8) + buffer[1] + 2);
|
||||
#pragma warning restore IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||
buffer = new byte[strctLength];
|
||||
cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8);
|
||||
@@ -319,7 +319,7 @@ namespace DiscImageChef.Devices
|
||||
Error = LastError != 0;
|
||||
|
||||
#pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||
uint strctLength = (uint)(((int)tmpBuffer[0] << 8) + tmpBuffer[1] + 2);
|
||||
uint strctLength = (uint)((tmpBuffer[0] << 8) + tmpBuffer[1] + 2);
|
||||
#pragma warning restore IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||
buffer = new byte[strctLength];
|
||||
|
||||
@@ -382,7 +382,7 @@ namespace DiscImageChef.Devices
|
||||
Error = LastError != 0;
|
||||
|
||||
#pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||
uint strctLength = (uint)(((int)tmpBuffer[0] << 8) + tmpBuffer[1] + 2);
|
||||
uint strctLength = (uint)((tmpBuffer[0] << 8) + tmpBuffer[1] + 2);
|
||||
#pragma warning restore IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||
buffer = new byte[strctLength];
|
||||
Array.Copy(tmpBuffer, 0, buffer, 0, buffer.Length);
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace DiscImageChef.Devices
|
||||
if(sense) return true;
|
||||
|
||||
#pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||
uint attrLen = (uint)(((int)buffer[0] << 24) + ((int)buffer[1] << 16) + ((int)buffer[2] << 8) + buffer[3] +
|
||||
uint attrLen = (uint)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3] +
|
||||
4);
|
||||
#pragma warning restore IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||
buffer = new byte[attrLen];
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
using System;
|
||||
using DiscImageChef.Console;
|
||||
using PlatformID = DiscImageChef.Interop.PlatformID;
|
||||
|
||||
namespace DiscImageChef.Devices
|
||||
{
|
||||
@@ -367,7 +368,7 @@ namespace DiscImageChef.Devices
|
||||
if(sense) return true;
|
||||
|
||||
#pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||
ushort modeLength = (ushort)(((int)buffer[0] << 8) + buffer[1] + 2);
|
||||
ushort modeLength = (ushort)((buffer[0] << 8) + buffer[1] + 2);
|
||||
#pragma warning restore IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||
buffer = new byte[modeLength];
|
||||
cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8);
|
||||
@@ -598,7 +599,7 @@ namespace DiscImageChef.Devices
|
||||
if(sense) return true;
|
||||
|
||||
#pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||
uint strctLength = (uint)(((int)buffer[0] << 24) + ((int)buffer[1] << 16) + ((int)buffer[2] << 8) +
|
||||
uint strctLength = (uint)((buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) +
|
||||
buffer[3] + 4);
|
||||
#pragma warning restore IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||
buffer = new byte[strctLength];
|
||||
@@ -738,10 +739,10 @@ namespace DiscImageChef.Devices
|
||||
// Prevent overflows
|
||||
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) LastError = 75;
|
||||
if(PlatformId != PlatformID.Win32NT && PlatformId != PlatformID.Win32S &&
|
||||
PlatformId != PlatformID.Win32Windows && PlatformId != PlatformID.WinCE &&
|
||||
PlatformId != PlatformID.WindowsPhone &&
|
||||
PlatformId != PlatformID.Xbox) LastError = 75;
|
||||
else LastError = 111;
|
||||
Error = true;
|
||||
duration = 0;
|
||||
@@ -781,10 +782,10 @@ namespace DiscImageChef.Devices
|
||||
// Prevent overflows
|
||||
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) LastError = 75;
|
||||
if(PlatformId != PlatformID.Win32NT && PlatformId != PlatformID.Win32S &&
|
||||
PlatformId != PlatformID.Win32Windows && PlatformId != PlatformID.WinCE &&
|
||||
PlatformId != PlatformID.WindowsPhone &&
|
||||
PlatformId != PlatformID.Xbox) LastError = 75;
|
||||
else LastError = 111;
|
||||
Error = true;
|
||||
duration = 0;
|
||||
|
||||
@@ -918,7 +918,7 @@ namespace DiscImageChef.Devices
|
||||
if(sense) return true;
|
||||
|
||||
#pragma warning disable IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||
ushort availableLength = (ushort)(((int)buffer[0] << 8) + buffer[1] + 2);
|
||||
ushort availableLength = (ushort)((buffer[0] << 8) + buffer[1] + 2);
|
||||
#pragma warning restore IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||
buffer = new byte[availableLength];
|
||||
cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8);
|
||||
|
||||
Reference in New Issue
Block a user