Files
Aaru/Aaru.Tests.Devices/Command.cs

101 lines
3.5 KiB
C#
Raw Normal View History

// /***************************************************************************
2020-07-25 02:01:36 +01:00
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Command.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
2020-07-25 02:01:36 +01:00
// Component : Aaru device testing.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
2024-12-19 10:45:18 +00:00
// Copyright © 2011-2025 Natalia Portillo
// ****************************************************************************/
using System;
using Aaru.CommonTypes.Structs.Devices.SCSI;
2020-02-27 00:33:26 +00:00
using Aaru.Devices;
using Aaru.Logging;
namespace Aaru.Tests.Devices;
2022-03-07 07:36:44 +00:00
static partial class MainClass
{
2022-03-06 13:29:38 +00:00
public static void Command(string devPath, Device dev)
{
2022-03-06 13:29:38 +00:00
while(true)
{
Console.Clear();
2025-08-17 06:11:22 +01:00
AaruLogging.WriteLine(Localization.Device_0, devPath);
AaruLogging.WriteLine(Localization.Send_a_command_to_the_device);
AaruLogging.WriteLine(Localization.Send_a_SCSI_command);
AaruLogging.WriteLine(Localization.Send_an_ATA_command);
AaruLogging.WriteLine(Localization.Send_a_SecureDigital_MultiMediaCard_command);
AaruLogging.WriteLine(Localization.Send_a_NVMe_command);
2022-03-06 13:29:38 +00:00
if(dev.ScsiType == PeripheralDeviceTypes.MultiMediaDevice)
2025-08-17 06:11:22 +01:00
AaruLogging.WriteLine(Localization.Send_a_special_sequence_of_commands_for_SCSI_Multimedia_devices);
2025-08-17 06:11:22 +01:00
AaruLogging.WriteLine(Localization.Return_to_device_menu);
AaruLogging.Write(Localization.Choose);
string strDev = Console.ReadLine();
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
if(!int.TryParse(strDev, out int item))
{
2025-08-17 06:11:22 +01:00
AaruLogging.WriteLine(Localization.Not_a_number_Press_any_key_to_continue);
Console.ReadKey();
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
continue;
}
2022-03-06 13:29:38 +00:00
switch(item)
{
case 0:
2025-08-17 06:11:22 +01:00
AaruLogging.WriteLine(Localization.Returning_to_device_menu);
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
return;
case 1:
Scsi(devPath, dev);
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
continue;
case 2:
Ata(devPath, dev);
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
continue;
case 3:
SecureDigital(devPath, dev);
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
continue;
case 4:
NVMe(devPath, dev);
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
continue;
case 5 when dev.ScsiType == PeripheralDeviceTypes.MultiMediaDevice:
ScsiMmc.Menu(devPath, dev);
2022-03-06 13:29:38 +00:00
continue;
2022-03-06 13:29:38 +00:00
default:
2025-08-17 06:11:22 +01:00
AaruLogging.WriteLine(Localization.Incorrect_option_Press_any_key_to_continue);
Console.ReadKey();
2020-02-29 18:03:35 +00:00
2022-03-06 13:29:38 +00:00
continue;
}
}
}
2017-12-19 20:33:03 +00:00
}