mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
General cleanup and refactor.
This commit is contained in:
@@ -26,20 +26,21 @@
|
||||
// Copyright © 2011-2022 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
namespace Aaru.Tests.Devices.SCSI;
|
||||
|
||||
using System;
|
||||
using Aaru.Console;
|
||||
using Aaru.Decoders.SCSI;
|
||||
using Aaru.Devices;
|
||||
using Aaru.Helpers;
|
||||
|
||||
namespace Aaru.Tests.Devices.SCSI;
|
||||
|
||||
internal static class Certance
|
||||
static class Certance
|
||||
{
|
||||
internal static void Menu(string devPath, Device dev)
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
System.Console.Clear();
|
||||
Console.Clear();
|
||||
AaruConsole.WriteLine("Device: {0}", devPath);
|
||||
AaruConsole.WriteLine("Send a Certance vendor command to the device:");
|
||||
AaruConsole.WriteLine("1.- Send PARK command.");
|
||||
@@ -47,12 +48,12 @@ internal static class Certance
|
||||
AaruConsole.WriteLine("0.- Return to SCSI commands menu.");
|
||||
AaruConsole.Write("Choose: ");
|
||||
|
||||
string strDev = System.Console.ReadLine();
|
||||
string strDev = Console.ReadLine();
|
||||
|
||||
if(!int.TryParse(strDev, out int item))
|
||||
{
|
||||
AaruConsole.WriteLine("Not a number. Press any key to continue...");
|
||||
System.Console.ReadKey();
|
||||
Console.ReadKey();
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -73,7 +74,7 @@ internal static class Certance
|
||||
continue;
|
||||
default:
|
||||
AaruConsole.WriteLine("Incorrect option. Press any key to continue...");
|
||||
System.Console.ReadKey();
|
||||
Console.ReadKey();
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -82,11 +83,11 @@ internal static class Certance
|
||||
|
||||
static void Park(string devPath, Device dev)
|
||||
{
|
||||
start:
|
||||
System.Console.Clear();
|
||||
start:
|
||||
Console.Clear();
|
||||
bool sense = dev.CertancePark(out byte[] senseBuffer, dev.Timeout, out double duration);
|
||||
|
||||
menu:
|
||||
menu:
|
||||
AaruConsole.WriteLine("Device: {0}", devPath);
|
||||
AaruConsole.WriteLine("Sending PARK to the device:");
|
||||
AaruConsole.WriteLine("Command took {0} ms.", duration);
|
||||
@@ -102,13 +103,13 @@ internal static class Certance
|
||||
AaruConsole.WriteLine("0.- Return to Certance vendor commands menu.");
|
||||
AaruConsole.Write("Choose: ");
|
||||
|
||||
string strDev = System.Console.ReadLine();
|
||||
string strDev = Console.ReadLine();
|
||||
|
||||
if(!int.TryParse(strDev, out int item))
|
||||
{
|
||||
AaruConsole.WriteLine("Not a number. Press any key to continue...");
|
||||
System.Console.ReadKey();
|
||||
System.Console.Clear();
|
||||
Console.ReadKey();
|
||||
Console.Clear();
|
||||
|
||||
goto menu;
|
||||
}
|
||||
@@ -120,7 +121,7 @@ internal static class Certance
|
||||
|
||||
return;
|
||||
case 1:
|
||||
System.Console.Clear();
|
||||
Console.Clear();
|
||||
AaruConsole.WriteLine("Device: {0}", devPath);
|
||||
AaruConsole.WriteLine("PARK sense:");
|
||||
|
||||
@@ -128,16 +129,16 @@ internal static class Certance
|
||||
PrintHex.PrintHexArray(senseBuffer, 64);
|
||||
|
||||
AaruConsole.WriteLine("Press any key to continue...");
|
||||
System.Console.ReadKey();
|
||||
System.Console.Clear();
|
||||
Console.ReadKey();
|
||||
Console.Clear();
|
||||
AaruConsole.WriteLine("Device: {0}", devPath);
|
||||
|
||||
goto menu;
|
||||
case 2: goto start;
|
||||
default:
|
||||
AaruConsole.WriteLine("Incorrect option. Press any key to continue...");
|
||||
System.Console.ReadKey();
|
||||
System.Console.Clear();
|
||||
Console.ReadKey();
|
||||
Console.Clear();
|
||||
|
||||
goto menu;
|
||||
}
|
||||
@@ -145,11 +146,11 @@ internal static class Certance
|
||||
|
||||
static void Unpark(string devPath, Device dev)
|
||||
{
|
||||
start:
|
||||
System.Console.Clear();
|
||||
start:
|
||||
Console.Clear();
|
||||
bool sense = dev.CertanceUnpark(out byte[] senseBuffer, dev.Timeout, out double duration);
|
||||
|
||||
menu:
|
||||
menu:
|
||||
AaruConsole.WriteLine("Device: {0}", devPath);
|
||||
AaruConsole.WriteLine("Sending UNPARK to the device:");
|
||||
AaruConsole.WriteLine("Command took {0} ms.", duration);
|
||||
@@ -165,13 +166,13 @@ internal static class Certance
|
||||
AaruConsole.WriteLine("0.- Return to Certance vendor commands menu.");
|
||||
AaruConsole.Write("Choose: ");
|
||||
|
||||
string strDev = System.Console.ReadLine();
|
||||
string strDev = Console.ReadLine();
|
||||
|
||||
if(!int.TryParse(strDev, out int item))
|
||||
{
|
||||
AaruConsole.WriteLine("Not a number. Press any key to continue...");
|
||||
System.Console.ReadKey();
|
||||
System.Console.Clear();
|
||||
Console.ReadKey();
|
||||
Console.Clear();
|
||||
|
||||
goto menu;
|
||||
}
|
||||
@@ -183,7 +184,7 @@ internal static class Certance
|
||||
|
||||
return;
|
||||
case 1:
|
||||
System.Console.Clear();
|
||||
Console.Clear();
|
||||
AaruConsole.WriteLine("Device: {0}", devPath);
|
||||
AaruConsole.WriteLine("UNPARK sense:");
|
||||
|
||||
@@ -191,16 +192,16 @@ internal static class Certance
|
||||
PrintHex.PrintHexArray(senseBuffer, 64);
|
||||
|
||||
AaruConsole.WriteLine("Press any key to continue...");
|
||||
System.Console.ReadKey();
|
||||
System.Console.Clear();
|
||||
Console.ReadKey();
|
||||
Console.Clear();
|
||||
AaruConsole.WriteLine("Device: {0}", devPath);
|
||||
|
||||
goto menu;
|
||||
case 2: goto start;
|
||||
default:
|
||||
AaruConsole.WriteLine("Incorrect option. Press any key to continue...");
|
||||
System.Console.ReadKey();
|
||||
System.Console.Clear();
|
||||
Console.ReadKey();
|
||||
Console.Clear();
|
||||
|
||||
goto menu;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user