mirror of
https://github.com/aaru-dps/Aaru.CommonTypes.git
synced 2025-12-16 19:24:30 +00:00
General cleanup and refactor.
This commit is contained in:
@@ -32,10 +32,10 @@
|
||||
// Copyright © 2011-2022 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using Aaru.Console;
|
||||
|
||||
namespace Aaru.CommonTypes;
|
||||
|
||||
using Aaru.Console;
|
||||
|
||||
public static partial class MediaTypeFromDevice
|
||||
{
|
||||
/// <summary>Gets the media type from an ATA (not ATAPI) device</summary>
|
||||
|
||||
@@ -32,11 +32,11 @@
|
||||
// Copyright © 2011-2022 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
namespace Aaru.CommonTypes;
|
||||
|
||||
using System;
|
||||
using Aaru.Console;
|
||||
|
||||
namespace Aaru.CommonTypes;
|
||||
|
||||
/// <summary>Gets the media type from a real device</summary>
|
||||
public static partial class MediaTypeFromDevice
|
||||
{
|
||||
@@ -83,8 +83,7 @@ public static partial class MediaTypeFromDevice
|
||||
case 0x01:
|
||||
case 0x05:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, setting media type to CD-ROM.",
|
||||
mediumType);
|
||||
"SCSI medium type is {0:X2}h, setting media type to CD-ROM.", mediumType);
|
||||
|
||||
return MediaType.CDROM;
|
||||
case 0x02:
|
||||
@@ -96,14 +95,13 @@ public static partial class MediaTypeFromDevice
|
||||
return MediaType.CDDA;
|
||||
case 0x03:
|
||||
case 0x07:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, setting media type to CD+.", mediumType);
|
||||
AaruConsole.DebugWriteLine("Media detection", "SCSI medium type is {0:X2}h, setting media type to CD+.",
|
||||
mediumType);
|
||||
|
||||
return MediaType.CDPLUS;
|
||||
case 0x04:
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"SCSI medium type is {0:X2}h, setting media type to Photo CD.",
|
||||
mediumType);
|
||||
"SCSI medium type is {0:X2}h, setting media type to Photo CD.", mediumType);
|
||||
|
||||
return MediaType.PCD;
|
||||
case 0x10:
|
||||
|
||||
@@ -32,10 +32,10 @@
|
||||
// Copyright © 2011-2022 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using Aaru.Console;
|
||||
|
||||
namespace Aaru.CommonTypes;
|
||||
|
||||
using Aaru.Console;
|
||||
|
||||
public static partial class MediaTypeFromDevice
|
||||
{
|
||||
/// <summary>Gets the device type from a SCSI Optical Device</summary>
|
||||
|
||||
@@ -32,11 +32,11 @@
|
||||
// Copyright © 2011-2022 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
namespace Aaru.CommonTypes;
|
||||
|
||||
using System;
|
||||
using Aaru.Console;
|
||||
|
||||
namespace Aaru.CommonTypes;
|
||||
|
||||
public static partial class MediaTypeFromDevice
|
||||
{
|
||||
/// <summary>Gets the media type from a SCSI Block Commands compliant device</summary>
|
||||
@@ -650,8 +650,7 @@ public static partial class MediaTypeFromDevice
|
||||
mediumType, blocks, blockSize);
|
||||
|
||||
return MediaType.PD650;
|
||||
case 1470500
|
||||
when model.ToLowerInvariant().StartsWith("zip", StringComparison.OrdinalIgnoreCase):
|
||||
case 1470500 when model.ToLowerInvariant().StartsWith("zip", StringComparison.OrdinalIgnoreCase):
|
||||
AaruConsole.DebugWriteLine("Media detection",
|
||||
"Drive manufacturer is IOMEGA, drive model is ZIP, media has 489532 blocks of 512 bytes, setting media type to 250Mb ZIP.");
|
||||
|
||||
|
||||
@@ -32,11 +32,11 @@
|
||||
// Copyright © 2011-2022 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
namespace Aaru.CommonTypes;
|
||||
|
||||
using System;
|
||||
using Aaru.Console;
|
||||
|
||||
namespace Aaru.CommonTypes;
|
||||
|
||||
public static partial class MediaTypeFromDevice
|
||||
{
|
||||
/// <summary>Tries to guess, from SCSI information, the media type of a device and/or its inserted media</summary>
|
||||
@@ -51,8 +51,7 @@ public static partial class MediaTypeFromDevice
|
||||
/// <param name="opticalDisc">Is media an optical disc?</param>
|
||||
/// <returns>The media type</returns>
|
||||
public static MediaType GetFromScsi(byte scsiPeripheralType, string vendor, string model, byte mediumType,
|
||||
byte densityCode, ulong blocks, uint blockSize, bool isUsb,
|
||||
bool opticalDisc)
|
||||
byte densityCode, ulong blocks, uint blockSize, bool isUsb, bool opticalDisc)
|
||||
{
|
||||
switch(scsiPeripheralType)
|
||||
{
|
||||
@@ -68,8 +67,7 @@ public static partial class MediaTypeFromDevice
|
||||
return GetFromSbc(vendor, model, mediumType, blocks, blockSize);
|
||||
|
||||
// Sequential access device
|
||||
case 0x01:
|
||||
return GetFromSsc(scsiPeripheralType, vendor, model, mediumType, densityCode, blocks, blockSize);
|
||||
case 0x01: return GetFromSsc(scsiPeripheralType, vendor, model, mediumType, densityCode, blocks, blockSize);
|
||||
|
||||
// Write-once device
|
||||
case 0x04:
|
||||
|
||||
@@ -32,11 +32,11 @@
|
||||
// Copyright © 2011-2022 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
namespace Aaru.CommonTypes;
|
||||
|
||||
using System;
|
||||
using Aaru.Console;
|
||||
|
||||
namespace Aaru.CommonTypes;
|
||||
|
||||
public static partial class MediaTypeFromDevice
|
||||
{
|
||||
/// <summary>Gets the media type from an SCSI Streaming Commands compliant device</summary>
|
||||
|
||||
Reference in New Issue
Block a user