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,32 +26,33 @@
|
||||
// Copyright © 2011-2022 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
namespace Aaru.Tests.Devices.ATA;
|
||||
|
||||
using System;
|
||||
using Aaru.Console;
|
||||
using Aaru.Decoders.ATA;
|
||||
using Aaru.Devices;
|
||||
using Aaru.Helpers;
|
||||
|
||||
namespace Aaru.Tests.Devices.ATA;
|
||||
|
||||
internal static class Atapi
|
||||
static class Atapi
|
||||
{
|
||||
internal static void Menu(string devPath, Device dev)
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
System.Console.Clear();
|
||||
Console.Clear();
|
||||
AaruConsole.WriteLine("Device: {0}", devPath);
|
||||
AaruConsole.WriteLine("Send an ATAPI command to the device:");
|
||||
AaruConsole.WriteLine("1.- Send IDENTIFY PACKET DEVICE command.");
|
||||
AaruConsole.WriteLine("0.- Return to ATA 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;
|
||||
}
|
||||
@@ -68,7 +69,7 @@ internal static class Atapi
|
||||
continue;
|
||||
default:
|
||||
AaruConsole.WriteLine("Incorrect option. Press any key to continue...");
|
||||
System.Console.ReadKey();
|
||||
Console.ReadKey();
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -77,13 +78,12 @@ internal static class Atapi
|
||||
|
||||
static void Identify(string devPath, Device dev)
|
||||
{
|
||||
start:
|
||||
System.Console.Clear();
|
||||
start:
|
||||
Console.Clear();
|
||||
|
||||
bool sense = dev.AtapiIdentify(out byte[] buffer, out AtaErrorRegistersChs errorRegisters,
|
||||
out double duration);
|
||||
bool sense = dev.AtapiIdentify(out byte[] buffer, out AtaErrorRegistersChs errorRegisters, out double duration);
|
||||
|
||||
menu:
|
||||
menu:
|
||||
AaruConsole.WriteLine("Device: {0}", devPath);
|
||||
AaruConsole.WriteLine("Sending IDENTIFY PACKET DEVICE to the device:");
|
||||
AaruConsole.WriteLine("Command took {0} ms.", duration);
|
||||
@@ -99,13 +99,13 @@ internal static class Atapi
|
||||
AaruConsole.WriteLine("0.- Return to ATAPI 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;
|
||||
}
|
||||
@@ -117,7 +117,7 @@ internal static class Atapi
|
||||
|
||||
return;
|
||||
case 1:
|
||||
System.Console.Clear();
|
||||
Console.Clear();
|
||||
AaruConsole.WriteLine("Device: {0}", devPath);
|
||||
AaruConsole.WriteLine("IDENTIFY PACKET DEVICE response:");
|
||||
|
||||
@@ -125,13 +125,13 @@ internal static class Atapi
|
||||
PrintHex.PrintHexArray(buffer, 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:
|
||||
System.Console.Clear();
|
||||
Console.Clear();
|
||||
AaruConsole.WriteLine("Device: {0}", devPath);
|
||||
AaruConsole.WriteLine("IDENTIFY PACKET DEVICE decoded response:");
|
||||
|
||||
@@ -139,27 +139,27 @@ internal static class Atapi
|
||||
AaruConsole.WriteLine("{0}", Decoders.ATA.Identify.Prettify(buffer));
|
||||
|
||||
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 3:
|
||||
System.Console.Clear();
|
||||
Console.Clear();
|
||||
AaruConsole.WriteLine("Device: {0}", devPath);
|
||||
AaruConsole.WriteLine("IDENTIFY PACKET DEVICE status registers:");
|
||||
AaruConsole.Write("{0}", MainClass.DecodeAtaRegisters(errorRegisters));
|
||||
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 4: 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