mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
REFACTOR: Reformat code.
This commit is contained in:
@@ -80,7 +80,7 @@ namespace DiscImageChef.Tests.Devices.SCSI
|
||||
string strDev;
|
||||
int item;
|
||||
|
||||
parameters:
|
||||
parameters:
|
||||
while(true)
|
||||
{
|
||||
System.Console.Clear();
|
||||
@@ -114,7 +114,10 @@ namespace DiscImageChef.Tests.Devices.SCSI
|
||||
return;
|
||||
case 1:
|
||||
DicConsole.WriteLine("Attribute action");
|
||||
DicConsole.WriteLine("Available values: {0} {1} {2} {3} {4}", ScsiAttributeAction.Values, ScsiAttributeAction.List, ScsiAttributeAction.VolumeList, ScsiAttributeAction.PartitionList, ScsiAttributeAction.ElementList, ScsiAttributeAction.Supported);
|
||||
DicConsole.WriteLine("Available values: {0} {1} {2} {3} {4}", ScsiAttributeAction.Values,
|
||||
ScsiAttributeAction.List, ScsiAttributeAction.VolumeList,
|
||||
ScsiAttributeAction.PartitionList, ScsiAttributeAction.ElementList,
|
||||
ScsiAttributeAction.Supported);
|
||||
DicConsole.Write("Choose?: ");
|
||||
strDev = System.Console.ReadLine();
|
||||
if(!System.Enum.TryParse(strDev, true, out action))
|
||||
@@ -124,6 +127,7 @@ namespace DiscImageChef.Tests.Devices.SCSI
|
||||
System.Console.ReadKey();
|
||||
continue;
|
||||
}
|
||||
|
||||
DicConsole.Write("Element?: ");
|
||||
strDev = System.Console.ReadLine();
|
||||
if(!ushort.TryParse(strDev, out element))
|
||||
@@ -133,6 +137,7 @@ namespace DiscImageChef.Tests.Devices.SCSI
|
||||
System.Console.ReadKey();
|
||||
continue;
|
||||
}
|
||||
|
||||
DicConsole.Write("Element type?: ");
|
||||
strDev = System.Console.ReadLine();
|
||||
if(!byte.TryParse(strDev, out elementType))
|
||||
@@ -142,6 +147,7 @@ namespace DiscImageChef.Tests.Devices.SCSI
|
||||
System.Console.ReadKey();
|
||||
continue;
|
||||
}
|
||||
|
||||
DicConsole.Write("Volume?: ");
|
||||
strDev = System.Console.ReadLine();
|
||||
if(!byte.TryParse(strDev, out volume))
|
||||
@@ -151,6 +157,7 @@ namespace DiscImageChef.Tests.Devices.SCSI
|
||||
System.Console.ReadKey();
|
||||
continue;
|
||||
}
|
||||
|
||||
DicConsole.Write("Partition?: ");
|
||||
strDev = System.Console.ReadLine();
|
||||
if(!byte.TryParse(strDev, out partition))
|
||||
@@ -160,6 +167,7 @@ namespace DiscImageChef.Tests.Devices.SCSI
|
||||
System.Console.ReadKey();
|
||||
continue;
|
||||
}
|
||||
|
||||
DicConsole.Write("First attribute?: ");
|
||||
strDev = System.Console.ReadLine();
|
||||
if(!ushort.TryParse(strDev, out firstAttribute))
|
||||
@@ -169,6 +177,7 @@ namespace DiscImageChef.Tests.Devices.SCSI
|
||||
System.Console.ReadKey();
|
||||
continue;
|
||||
}
|
||||
|
||||
DicConsole.Write("Use cache?: ");
|
||||
strDev = System.Console.ReadLine();
|
||||
if(!bool.TryParse(strDev, out cache))
|
||||
@@ -178,24 +187,26 @@ namespace DiscImageChef.Tests.Devices.SCSI
|
||||
System.Console.ReadKey();
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
case 2:
|
||||
goto start;
|
||||
case 2: goto start;
|
||||
}
|
||||
}
|
||||
|
||||
start:
|
||||
start:
|
||||
System.Console.Clear();
|
||||
bool sense = dev.ReadAttribute(out byte[] buffer, out byte[] senseBuffer, action, element, elementType, volume, partition, firstAttribute, cache, dev.Timeout, out double duration);
|
||||
bool sense = dev.ReadAttribute(out byte[] buffer, out byte[] senseBuffer, action, element, elementType,
|
||||
volume, partition, firstAttribute, cache, dev.Timeout, out double duration);
|
||||
|
||||
menu:
|
||||
menu:
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("Sending READ ATTRIBUTE to the device:");
|
||||
DicConsole.WriteLine("Command took {0} ms.", duration);
|
||||
DicConsole.WriteLine("Sense is {0}.", sense);
|
||||
DicConsole.WriteLine("Buffer is {0} bytes.", buffer == null ? "null" : buffer.Length.ToString());
|
||||
DicConsole.WriteLine("Buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(buffer));
|
||||
DicConsole.WriteLine("Sense buffer is {0} bytes.", senseBuffer == null ? "null" : senseBuffer.Length.ToString());
|
||||
DicConsole.WriteLine("Sense buffer is {0} bytes.",
|
||||
senseBuffer == null ? "null" : senseBuffer.Length.ToString());
|
||||
DicConsole.WriteLine("Sense buffer is null or empty? {0}", ArrayHelpers.ArrayIsNullOrEmpty(senseBuffer));
|
||||
DicConsole.WriteLine();
|
||||
DicConsole.WriteLine("Choose what to do:");
|
||||
@@ -225,8 +236,7 @@ namespace DiscImageChef.Tests.Devices.SCSI
|
||||
System.Console.Clear();
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("READ ATTRIBUTE response:");
|
||||
if(buffer != null)
|
||||
PrintHex.PrintHexArray(buffer, 64);
|
||||
if(buffer != null) PrintHex.PrintHexArray(buffer, 64);
|
||||
DicConsole.WriteLine("Press any key to continue...");
|
||||
System.Console.ReadKey();
|
||||
System.Console.Clear();
|
||||
@@ -236,8 +246,7 @@ namespace DiscImageChef.Tests.Devices.SCSI
|
||||
System.Console.Clear();
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
DicConsole.WriteLine("READ ATTRIBUTE sense:");
|
||||
if(senseBuffer != null)
|
||||
PrintHex.PrintHexArray(senseBuffer, 64);
|
||||
if(senseBuffer != null) PrintHex.PrintHexArray(senseBuffer, 64);
|
||||
DicConsole.WriteLine("Press any key to continue...");
|
||||
System.Console.ReadKey();
|
||||
System.Console.Clear();
|
||||
@@ -253,10 +262,8 @@ namespace DiscImageChef.Tests.Devices.SCSI
|
||||
System.Console.Clear();
|
||||
DicConsole.WriteLine("Device: {0}", devPath);
|
||||
goto menu;
|
||||
case 4:
|
||||
goto start;
|
||||
case 5:
|
||||
goto parameters;
|
||||
case 4: goto start;
|
||||
case 5: goto parameters;
|
||||
default:
|
||||
DicConsole.WriteLine("Incorrect option. Press any key to continue...");
|
||||
System.Console.ReadKey();
|
||||
@@ -265,4 +272,4 @@ namespace DiscImageChef.Tests.Devices.SCSI
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user