mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
Refactor and code cleanup.
This commit is contained in:
@@ -1,3 +1,33 @@
|
||||
2016-07-28 Natalia Portillo <claunia@claunia.com>
|
||||
|
||||
* Command.cs:
|
||||
* Enums.cs:
|
||||
* Command.cs:
|
||||
* Enums.cs:
|
||||
* Enums.cs:
|
||||
* Structs.cs:
|
||||
* Command.cs:
|
||||
* Commands.cs:
|
||||
* Variables.cs:
|
||||
* Destructor.cs:
|
||||
* Constructor.cs:
|
||||
* Cfa.cs:
|
||||
* SSC.cs:
|
||||
* SPC.cs:
|
||||
* SMC.cs:
|
||||
* NEC.cs:
|
||||
* MCPT.cs:
|
||||
* MMC.cs:
|
||||
* Atapi.cs:
|
||||
* Ata48.cs:
|
||||
* Smart.cs:
|
||||
* Ata28.cs:
|
||||
* AtaCHS.cs:
|
||||
* Pioneer.cs:
|
||||
* HL-DT-ST.cs:
|
||||
* Certance.cs:
|
||||
* ArchiveCorp.cs: Refactor and code cleanup.
|
||||
|
||||
2016-02-10 Natalia Portillo <claunia@claunia.com>
|
||||
|
||||
* Device/AtaCommands/Ata28.cs:
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace DiscImageChef.Devices
|
||||
return Linux.Command.SendScsiCommand((int)fd, cdb, ref buffer, out senseBuffer, timeout, dir, out duration, out sense);
|
||||
}
|
||||
default:
|
||||
throw new InvalidOperationException(String.Format("Platform {0} not yet supported.", ptID));
|
||||
throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", ptID));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace DiscImageChef.Devices
|
||||
transferRegister, ref buffer, timeout, transferBlocks, out duration, out sense);
|
||||
}
|
||||
default:
|
||||
throw new InvalidOperationException(String.Format("Platform {0} not yet supported.", ptID));
|
||||
throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", ptID));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ namespace DiscImageChef.Devices
|
||||
transferRegister, ref buffer, timeout, transferBlocks, out duration, out sense);
|
||||
}
|
||||
default:
|
||||
throw new InvalidOperationException(String.Format("Platform {0} not yet supported.", ptID));
|
||||
throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", ptID));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ namespace DiscImageChef.Devices
|
||||
transferRegister, ref buffer, timeout, transferBlocks, out duration, out sense);
|
||||
}
|
||||
default:
|
||||
throw new InvalidOperationException(String.Format("Platform {0} not yet supported.", ptID));
|
||||
throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", ptID));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,44 +30,6 @@
|
||||
// Copyright © 2011-2016 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
// /***************************************************************************
|
||||
// The Disc Image Chef
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : Ata28.cs
|
||||
// Version : 1.0
|
||||
// Author(s) : Natalia Portillo
|
||||
//
|
||||
// Component : Component
|
||||
//
|
||||
// Revision : $Revision$
|
||||
// Last change by : $Author$
|
||||
// Date : $Date$
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
// Description
|
||||
//
|
||||
// --[ License ] --------------------------------------------------------------
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright (C) 2011-2015 Claunia.com
|
||||
// ****************************************************************************/
|
||||
// //$Id$
|
||||
using System;
|
||||
using DiscImageChef.Console;
|
||||
using DiscImageChef.Decoders.ATA;
|
||||
|
||||
|
||||
@@ -30,44 +30,6 @@
|
||||
// Copyright © 2011-2016 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
// /***************************************************************************
|
||||
// The Disc Image Chef
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : Ata48.cs
|
||||
// Version : 1.0
|
||||
// Author(s) : Natalia Portillo
|
||||
//
|
||||
// Component : Component
|
||||
//
|
||||
// Revision : $Revision$
|
||||
// Last change by : $Author$
|
||||
// Date : $Date$
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
// Description
|
||||
//
|
||||
// --[ License ] --------------------------------------------------------------
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright (C) 2011-2015 Claunia.com
|
||||
// ****************************************************************************/
|
||||
// //$Id$
|
||||
using System;
|
||||
using DiscImageChef.Console;
|
||||
using DiscImageChef.Decoders.ATA;
|
||||
|
||||
|
||||
@@ -30,44 +30,6 @@
|
||||
// Copyright © 2011-2016 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
// /***************************************************************************
|
||||
// The Disc Image Chef
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : AtaCommands.cs
|
||||
// Version : 1.0
|
||||
// Author(s) : Natalia Portillo
|
||||
//
|
||||
// Component : Direct device access
|
||||
//
|
||||
// Revision : $Revision$
|
||||
// Last change by : $Author$
|
||||
// Date : $Date$
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
// Contains ATA commands
|
||||
//
|
||||
// --[ License ] --------------------------------------------------------------
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright (C) 2011-2015 Claunia.com
|
||||
// ****************************************************************************/
|
||||
// //$Id$
|
||||
using System;
|
||||
using DiscImageChef.Console;
|
||||
using DiscImageChef.Decoders.ATA;
|
||||
|
||||
|
||||
@@ -30,44 +30,6 @@
|
||||
// Copyright © 2011-2016 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
// /***************************************************************************
|
||||
// The Disc Image Chef
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : AtapiCommands.cs
|
||||
// Version : 1.0
|
||||
// Author(s) : Natalia Portillo
|
||||
//
|
||||
// Component : Direct device access
|
||||
//
|
||||
// Revision : $Revision$
|
||||
// Last change by : $Author$
|
||||
// Date : $Date$
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
// Contains ATAPI commands
|
||||
//
|
||||
// --[ License ] --------------------------------------------------------------
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright (C) 2011-2015 Claunia.com
|
||||
// ****************************************************************************/
|
||||
// //$Id$
|
||||
using System;
|
||||
using DiscImageChef.Console;
|
||||
using DiscImageChef.Decoders.ATA;
|
||||
|
||||
|
||||
@@ -30,44 +30,6 @@
|
||||
// Copyright © 2011-2016 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
// /***************************************************************************
|
||||
// The Disc Image Chef
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : Cfa.cs
|
||||
// Version : 1.0
|
||||
// Author(s) : Natalia Portillo
|
||||
//
|
||||
// Component : Component
|
||||
//
|
||||
// Revision : $Revision$
|
||||
// Last change by : $Author$
|
||||
// Date : $Date$
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
// Description
|
||||
//
|
||||
// --[ License ] --------------------------------------------------------------
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright (C) 2011-2015 Claunia.com
|
||||
// ****************************************************************************/
|
||||
// //$Id$
|
||||
using System;
|
||||
using DiscImageChef.Console;
|
||||
using DiscImageChef.Decoders.ATA;
|
||||
|
||||
|
||||
@@ -30,44 +30,6 @@
|
||||
// Copyright © 2011-2016 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
// /***************************************************************************
|
||||
// The Disc Image Chef
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : MCPT.cs
|
||||
// Version : 1.0
|
||||
// Author(s) : Natalia Portillo
|
||||
//
|
||||
// Component : Component
|
||||
//
|
||||
// Revision : $Revision$
|
||||
// Last change by : $Author$
|
||||
// Date : $Date$
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
// Description
|
||||
//
|
||||
// --[ License ] --------------------------------------------------------------
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright (C) 2011-2015 Claunia.com
|
||||
// ****************************************************************************/
|
||||
// //$Id$
|
||||
using System;
|
||||
using DiscImageChef.Console;
|
||||
using DiscImageChef.Decoders.ATA;
|
||||
|
||||
|
||||
@@ -30,44 +30,6 @@
|
||||
// Copyright © 2011-2016 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
// /***************************************************************************
|
||||
// The Disc Image Chef
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : Smart.cs
|
||||
// Version : 1.0
|
||||
// Author(s) : Natalia Portillo
|
||||
//
|
||||
// Component : Component
|
||||
//
|
||||
// Revision : $Revision$
|
||||
// Last change by : $Author$
|
||||
// Date : $Date$
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
// Description
|
||||
//
|
||||
// --[ License ] --------------------------------------------------------------
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright (C) 2011-2015 Claunia.com
|
||||
// ****************************************************************************/
|
||||
// //$Id$
|
||||
using System;
|
||||
using DiscImageChef.Console;
|
||||
using DiscImageChef.Decoders.ATA;
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
// Copyright © 2011-2016 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using DiscImageChef.Decoders.ATA;
|
||||
|
||||
namespace DiscImageChef.Devices
|
||||
|
||||
@@ -66,7 +66,6 @@ namespace DiscImageChef.Devices
|
||||
lastError = Marshal.GetLastWin32Error();
|
||||
}
|
||||
|
||||
//throw new NotImplementedException();
|
||||
break;
|
||||
}
|
||||
case Interop.PlatformID.Linux:
|
||||
@@ -79,15 +78,14 @@ namespace DiscImageChef.Devices
|
||||
lastError = Marshal.GetLastWin32Error();
|
||||
}
|
||||
|
||||
//throw new NotImplementedException();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new InvalidOperationException(String.Format("Platform {0} not yet supported.", platformID));
|
||||
throw new InvalidOperationException(string.Format("Platform {0} not yet supported.", platformID));
|
||||
}
|
||||
|
||||
if(error)
|
||||
throw new SystemException(String.Format("Error {0} opening device.", lastError));
|
||||
throw new SystemException(string.Format("Error {0} opening device.", lastError));
|
||||
|
||||
type = DeviceType.Unknown;
|
||||
scsiType = Decoders.SCSI.PeripheralDeviceTypes.UnknownDevice;
|
||||
@@ -101,12 +99,12 @@ namespace DiscImageChef.Devices
|
||||
bool scsiSense = ScsiInquiry(out inqBuf, out senseBuf);
|
||||
|
||||
if(error)
|
||||
throw new SystemException(String.Format("Error {0} trying device.", lastError));
|
||||
throw new SystemException(string.Format("Error {0} trying device.", lastError));
|
||||
|
||||
#region USB
|
||||
if(platformID == DiscImageChef.Interop.PlatformID.Linux)
|
||||
if(platformID == Interop.PlatformID.Linux)
|
||||
{
|
||||
if(devicePath.StartsWith("/dev/sd") || devicePath.StartsWith("/dev/sr") || devicePath.StartsWith("/dev/st"))
|
||||
if(devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) || devicePath.StartsWith("/dev/sr", StringComparison.Ordinal) || devicePath.StartsWith("/dev/st", StringComparison.Ordinal))
|
||||
{
|
||||
string devPath = devicePath.Substring(5);
|
||||
if(System.IO.Directory.Exists("/sys/block/" + devPath))
|
||||
@@ -178,9 +176,9 @@ namespace DiscImageChef.Devices
|
||||
#endregion USB
|
||||
|
||||
#region FireWire
|
||||
if(platformID == DiscImageChef.Interop.PlatformID.Linux)
|
||||
if(platformID == Interop.PlatformID.Linux)
|
||||
{
|
||||
if(devicePath.StartsWith("/dev/sd") || devicePath.StartsWith("/dev/sr") || devicePath.StartsWith("/dev/st"))
|
||||
if(devicePath.StartsWith("/dev/sd", StringComparison.Ordinal) || devicePath.StartsWith("/dev/sr", StringComparison.Ordinal) || devicePath.StartsWith("/dev/st", StringComparison.Ordinal))
|
||||
{
|
||||
string devPath = devicePath.Substring(5);
|
||||
if(System.IO.Directory.Exists("/sys/block/" + devPath))
|
||||
@@ -331,7 +329,7 @@ namespace DiscImageChef.Devices
|
||||
{
|
||||
foreach(char c in serial)
|
||||
{
|
||||
if(Char.IsControl(c))
|
||||
if(char.IsControl(c))
|
||||
serial = usbSerialString;
|
||||
}
|
||||
}
|
||||
@@ -344,13 +342,13 @@ namespace DiscImageChef.Devices
|
||||
if(string.IsNullOrEmpty(model))
|
||||
model = firewireModelName;
|
||||
if(string.IsNullOrEmpty(serial))
|
||||
serial = String.Format("{0:X16}", firewireGuid);
|
||||
serial = string.Format("{0:X16}", firewireGuid);
|
||||
else
|
||||
{
|
||||
foreach(char c in serial)
|
||||
{
|
||||
if(Char.IsControl(c))
|
||||
serial = String.Format("{0:X16}", firewireGuid);
|
||||
if(char.IsControl(c))
|
||||
serial = string.Format("{0:X16}", firewireGuid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
// Copyright © 2011-2016 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
|
||||
namespace DiscImageChef.Devices
|
||||
@@ -39,7 +38,7 @@ namespace DiscImageChef.Devices
|
||||
{
|
||||
/// <summary>
|
||||
/// Releases unmanaged resources and performs other cleanup operations before the
|
||||
/// <see cref="DiscImageChef.Devices.Device"/> is reclaimed by garbage collection.
|
||||
/// <see cref="Device"/> is reclaimed by garbage collection.
|
||||
/// </summary>
|
||||
~Device()
|
||||
{
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
// Copyright © 2011-2016 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using DiscImageChef.Console;
|
||||
|
||||
namespace DiscImageChef.Devices
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
// Copyright © 2011-2016 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using DiscImageChef.Console;
|
||||
|
||||
namespace DiscImageChef.Devices
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
// Copyright © 2011-2016 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using DiscImageChef.Console;
|
||||
|
||||
namespace DiscImageChef.Devices
|
||||
|
||||
@@ -95,7 +95,9 @@ 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);
|
||||
#pragma warning restore IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||
buffer = new byte[confLength];
|
||||
cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8);
|
||||
cdb[8] = (byte)(buffer.Length & 0xFF);
|
||||
@@ -147,7 +149,9 @@ 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);
|
||||
#pragma warning restore IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||
buffer = new byte[strctLength];
|
||||
cdb[8] = (byte)((buffer.Length & 0xFF00) >> 8);
|
||||
cdb[9] = (byte)(buffer.Length & 0xFF);
|
||||
@@ -304,7 +308,9 @@ namespace DiscImageChef.Devices
|
||||
lastError = SendScsiCommand(cdb, ref tmpBuffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
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);
|
||||
#pragma warning restore IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||
buffer = new byte[strctLength];
|
||||
|
||||
if(buffer.Length <= tmpBuffer.Length)
|
||||
@@ -361,7 +367,9 @@ namespace DiscImageChef.Devices
|
||||
lastError = SendScsiCommand(cdb, ref tmpBuffer, out senseBuffer, timeout, ScsiDirection.In, out duration, out sense);
|
||||
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);
|
||||
#pragma warning restore IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||
buffer = new byte[strctLength];
|
||||
Array.Copy(tmpBuffer, 0, buffer, 0, buffer.Length);
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
// Copyright © 2011-2016 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using DiscImageChef.Console;
|
||||
|
||||
namespace DiscImageChef.Devices
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
// Copyright © 2011-2016 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using DiscImageChef.Console;
|
||||
|
||||
namespace DiscImageChef.Devices
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
// Copyright © 2011-2016 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using DiscImageChef.Console;
|
||||
|
||||
namespace DiscImageChef.Devices
|
||||
@@ -80,7 +79,9 @@ 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] + 4);
|
||||
#pragma warning restore IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||
buffer = new byte[attrLen];
|
||||
cdb[10] = (byte)((buffer.Length & 0xFF000000) >> 24);
|
||||
cdb[11] = (byte)((buffer.Length & 0xFF0000) >> 16);
|
||||
|
||||
@@ -356,7 +356,9 @@ 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);
|
||||
#pragma warning restore IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||
buffer = new byte[modeLength];
|
||||
cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8);
|
||||
cdb[8] = (byte)(buffer.Length & 0xFF);
|
||||
@@ -577,7 +579,9 @@ 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) + buffer[3] + 4);
|
||||
#pragma warning restore IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||
buffer = new byte[strctLength];
|
||||
cdb[6] = (byte)((buffer.Length & 0xFF000000) >> 24);
|
||||
cdb[7] = (byte)((buffer.Length & 0xFF0000) >> 16);
|
||||
|
||||
@@ -900,7 +900,9 @@ 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);
|
||||
#pragma warning restore IDE0004 // Cast is necessary or an invalid bitshift happens
|
||||
buffer = new byte[availableLength];
|
||||
cdb[7] = (byte)((buffer.Length & 0xFF00) >> 8);
|
||||
cdb[8] = (byte)(buffer.Length & 0xFF);
|
||||
|
||||
@@ -30,9 +30,6 @@
|
||||
// Copyright © 2011-2016 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
|
||||
namespace DiscImageChef.Devices
|
||||
{
|
||||
public partial class Device
|
||||
@@ -97,7 +94,7 @@ namespace DiscImageChef.Devices
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this <see cref="DiscImageChef.Devices.Device"/> is in error.
|
||||
/// Gets a value indicating whether this <see cref="Device"/> is in error.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if error; otherwise, <c>false</c>.</value>
|
||||
public bool Error
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
// Copyright © 2011-2016 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
namespace DiscImageChef.Devices.FreeBSD
|
||||
{
|
||||
public class Command
|
||||
|
||||
@@ -35,7 +35,7 @@ using System;
|
||||
namespace DiscImageChef.Devices.FreeBSD
|
||||
{
|
||||
[Flags]
|
||||
enum FileFlags : int
|
||||
enum FileFlags
|
||||
{
|
||||
/// <summary>
|
||||
/// O_RDONLY
|
||||
|
||||
@@ -72,8 +72,8 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
|
||||
struct cam_pinfo
|
||||
{
|
||||
public UInt32 priority;
|
||||
public UInt32 generation;
|
||||
public uint priority;
|
||||
public uint generation;
|
||||
public int index;
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
|
||||
struct timeval
|
||||
{
|
||||
public Int64 tv_sec;
|
||||
public long tv_sec;
|
||||
/// <summary>long</summary>
|
||||
public IntPtr tv_usec;
|
||||
}
|
||||
@@ -125,22 +125,22 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
public camq_entry xpt_links;
|
||||
public camq_entry sim_links;
|
||||
public camq_entry periph_links;
|
||||
public UInt32 retry_count;
|
||||
public uint retry_count;
|
||||
public IntPtr cbfcnp;
|
||||
public xpt_opcode func_code;
|
||||
public UInt32 status;
|
||||
public uint status;
|
||||
public IntPtr path;
|
||||
public uint path_id;
|
||||
public uint target_id;
|
||||
public UInt64 target_lun;
|
||||
public UInt32 flags;
|
||||
public UInt32 xflags;
|
||||
public ulong target_lun;
|
||||
public uint flags;
|
||||
public uint xflags;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
|
||||
public IntPtr[] periph_priv;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
|
||||
public IntPtr[] sim_priv;
|
||||
public ccb_qos_area qos;
|
||||
public UInt32 timeout;
|
||||
public uint timeout;
|
||||
public timeval softtimeout;
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
/// <summary>Ptr to the data buf/SG list</summary>
|
||||
public IntPtr data_ptr;
|
||||
/// <summary>Data transfer length</summary>
|
||||
public UInt32 dxfer_len;
|
||||
public uint dxfer_len;
|
||||
/// <summary>Autosense storage</summary>
|
||||
public scsi_sense_data sense_data;
|
||||
/// <summary>Number of bytes to autosense</summary>
|
||||
@@ -172,25 +172,25 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
/// <summary>Number of bytes for the CDB</summary>
|
||||
public byte cdb_len;
|
||||
/// <summary>Number of SG list entries</summary>
|
||||
public UInt16 sglist_cnt;
|
||||
public short sglist_cnt;
|
||||
/// <summary>Returned SCSI status</summary>
|
||||
public byte scsi_status;
|
||||
/// <summary>Autosense resid length: 2's comp</summary>
|
||||
public sbyte sense_resid;
|
||||
/// <summary>Transfer residual length: 2's comp</summary>
|
||||
public Int32 resid;
|
||||
public int resid;
|
||||
/// <summary>Union for CDB bytes/pointer</summary>
|
||||
public IntPtr cdb_io;
|
||||
/// <summary>Pointer to the message buffer</summary>
|
||||
public IntPtr msg_ptr;
|
||||
/// <summary>Number of bytes for the Message</summary>
|
||||
public UInt16 msg_len;
|
||||
public short msg_len;
|
||||
/// <summary>What to do for tag queueing. The tag action should be either the define below (to send a non-tagged transaction) or one of the defined scsi tag messages from scsi_message.h.</summary>
|
||||
public byte tag_action;
|
||||
/// <summary>tag id from initator (target mode)</summary>
|
||||
public UInt32 tag_id;
|
||||
public uint tag_id;
|
||||
/// <summary>initiator id of who selected</summary>
|
||||
public UInt32 init_id;
|
||||
public uint init_id;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -208,15 +208,15 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
/// <summary>Ptr to the data buf/SG list</summary>
|
||||
public IntPtr data_ptr;
|
||||
/// <summary>Data transfer length</summary>
|
||||
public UInt32 dxfer_len;
|
||||
public uint dxfer_len;
|
||||
/// <summary>Transfer residual length: 2's comp</summary>
|
||||
public Int32 resid;
|
||||
public int resid;
|
||||
/// <summary>What to do for tag queueing. The tag action should be either the define below (to send a non-tagged transaction) or one of the defined scsi tag messages from scsi_message.h.</summary>
|
||||
public byte tag_action;
|
||||
/// <summary>tag id from initator (target mode)</summary>
|
||||
public UInt32 tag_id;
|
||||
public uint tag_id;
|
||||
/// <summary>initiator id of who selected</summary>
|
||||
public UInt32 init_id;
|
||||
public uint init_id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace DiscImageChef.Devices.Linux
|
||||
sense |= (io_hdr.info & SgInfo.OkMask) != SgInfo.Ok;
|
||||
|
||||
if(io_hdr.duration > 0)
|
||||
duration = (double)io_hdr.duration;
|
||||
duration = io_hdr.duration;
|
||||
else
|
||||
duration = (end - start).TotalMilliseconds;
|
||||
|
||||
@@ -335,7 +335,7 @@ namespace DiscImageChef.Devices.Linux
|
||||
|
||||
if(Interop.DetectOS.Is64Bit())
|
||||
{
|
||||
long result64 = Extern.readlink64(path, buf, (long)4096);
|
||||
long result64 = Extern.readlink64(path, buf, 4096);
|
||||
if(result64 <= 0)
|
||||
return null;
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ using System;
|
||||
namespace DiscImageChef.Devices.Linux
|
||||
{
|
||||
[Flags]
|
||||
enum FileFlags : int
|
||||
enum FileFlags
|
||||
{
|
||||
/// <summary>
|
||||
/// O_RDONLY
|
||||
@@ -111,7 +111,7 @@ namespace DiscImageChef.Devices.Linux
|
||||
/// <summary>
|
||||
/// Direction of SCSI transfer
|
||||
/// </summary>
|
||||
enum ScsiIoctlDirection : int
|
||||
enum ScsiIoctlDirection
|
||||
{
|
||||
/// <summary>
|
||||
/// No data transfer happens
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace DiscImageChef.Devices.Windows
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user