mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
Reformatted.
This commit is contained in:
@@ -45,47 +45,47 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
{
|
||||
byte[] hdr;
|
||||
|
||||
if (header.BlockDescriptors != null)
|
||||
if(header.BlockDescriptors != null)
|
||||
hdr = new byte[4 + header.BlockDescriptors.Length * 8];
|
||||
else
|
||||
hdr = new byte[4];
|
||||
|
||||
hdr[1] = (byte)header.MediumType;
|
||||
|
||||
if (deviceType == PeripheralDeviceTypes.DirectAccess || deviceType == PeripheralDeviceTypes.MultiMediaDevice)
|
||||
if(deviceType == PeripheralDeviceTypes.DirectAccess || deviceType == PeripheralDeviceTypes.MultiMediaDevice)
|
||||
{
|
||||
if (header.WriteProtected)
|
||||
if(header.WriteProtected)
|
||||
hdr[2] += 0x80;
|
||||
if (header.DPOFUA)
|
||||
if(header.DPOFUA)
|
||||
hdr[2] += 0x10;
|
||||
}
|
||||
|
||||
if (deviceType == PeripheralDeviceTypes.SequentialAccess)
|
||||
if(deviceType == PeripheralDeviceTypes.SequentialAccess)
|
||||
{
|
||||
if (header.WriteProtected)
|
||||
if(header.WriteProtected)
|
||||
hdr[2] += 0x80;
|
||||
hdr[2] += (byte)(header.Speed & 0x0F);
|
||||
hdr[2] += (byte)((header.BufferedMode << 4) & 0x70);
|
||||
}
|
||||
|
||||
if (deviceType == PeripheralDeviceTypes.PrinterDevice)
|
||||
if(deviceType == PeripheralDeviceTypes.PrinterDevice)
|
||||
hdr[2] += (byte)((header.BufferedMode << 4) & 0x70);
|
||||
|
||||
if (deviceType == PeripheralDeviceTypes.OpticalDevice)
|
||||
if(deviceType == PeripheralDeviceTypes.OpticalDevice)
|
||||
{
|
||||
if (header.WriteProtected)
|
||||
if(header.WriteProtected)
|
||||
hdr[2] += 0x80;
|
||||
if (header.EBC)
|
||||
if(header.EBC)
|
||||
hdr[2] += 0x01;
|
||||
if (header.DPOFUA)
|
||||
if(header.DPOFUA)
|
||||
hdr[2] += 0x10;
|
||||
}
|
||||
|
||||
if (header.BlockDescriptors != null)
|
||||
if(header.BlockDescriptors != null)
|
||||
{
|
||||
hdr[3] = (byte)(header.BlockDescriptors.Length * 8);
|
||||
|
||||
for (int i = 0; i < header.BlockDescriptors.Length; i++)
|
||||
for(int i = 0; i < header.BlockDescriptors.Length; i++)
|
||||
{
|
||||
hdr[0 + i * 8 + 4] = (byte)header.BlockDescriptors[i].Density;
|
||||
hdr[1 + i * 8 + 4] = (byte)((header.BlockDescriptors[i].Blocks & 0xFF0000) >> 16);
|
||||
@@ -103,9 +103,9 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
public static byte[] EncodeMode6(DecodedMode mode, PeripheralDeviceTypes deviceType)
|
||||
{
|
||||
int modeSize = 0;
|
||||
if (mode.Pages != null)
|
||||
if(mode.Pages != null)
|
||||
{
|
||||
foreach (ModePage page in mode.Pages)
|
||||
foreach(ModePage page in mode.Pages)
|
||||
modeSize += page.PageResponse.Length;
|
||||
}
|
||||
|
||||
@@ -115,10 +115,10 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
|
||||
Array.Copy(hdr, 0, md, 0, hdr.Length);
|
||||
|
||||
if (mode.Pages != null)
|
||||
if(mode.Pages != null)
|
||||
{
|
||||
int offset = hdr.Length;
|
||||
foreach (ModePage page in mode.Pages)
|
||||
foreach(ModePage page in mode.Pages)
|
||||
{
|
||||
Array.Copy(page.PageResponse, 0, md, offset, page.PageResponse.Length);
|
||||
offset += page.PageResponse.Length;
|
||||
@@ -132,9 +132,9 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
public static byte[] EncodeMode10(DecodedMode mode, PeripheralDeviceTypes deviceType)
|
||||
{
|
||||
int modeSize = 0;
|
||||
if (mode.Pages != null)
|
||||
if(mode.Pages != null)
|
||||
{
|
||||
foreach (ModePage page in mode.Pages)
|
||||
foreach(ModePage page in mode.Pages)
|
||||
modeSize += page.PageResponse.Length;
|
||||
}
|
||||
|
||||
@@ -144,10 +144,10 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
|
||||
Array.Copy(hdr, 0, md, 0, hdr.Length);
|
||||
|
||||
if (mode.Pages != null)
|
||||
if(mode.Pages != null)
|
||||
{
|
||||
int offset = hdr.Length;
|
||||
foreach (ModePage page in mode.Pages)
|
||||
foreach(ModePage page in mode.Pages)
|
||||
{
|
||||
Array.Copy(page.PageResponse, 0, md, offset, page.PageResponse.Length);
|
||||
offset += page.PageResponse.Length;
|
||||
@@ -166,9 +166,9 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
{
|
||||
byte[] hdr;
|
||||
|
||||
if (header.BlockDescriptors != null)
|
||||
if(header.BlockDescriptors != null)
|
||||
{
|
||||
if (longLBA)
|
||||
if(longLBA)
|
||||
hdr = new byte[8 + header.BlockDescriptors.Length * 16];
|
||||
else
|
||||
hdr = new byte[8 + header.BlockDescriptors.Length * 8];
|
||||
@@ -178,43 +178,43 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
|
||||
hdr[2] = (byte)header.MediumType;
|
||||
|
||||
if (deviceType == PeripheralDeviceTypes.DirectAccess || deviceType == PeripheralDeviceTypes.MultiMediaDevice)
|
||||
if(deviceType == PeripheralDeviceTypes.DirectAccess || deviceType == PeripheralDeviceTypes.MultiMediaDevice)
|
||||
{
|
||||
if (header.WriteProtected)
|
||||
if(header.WriteProtected)
|
||||
hdr[3] += 0x80;
|
||||
if (header.DPOFUA)
|
||||
if(header.DPOFUA)
|
||||
hdr[3] += 0x10;
|
||||
}
|
||||
|
||||
if (deviceType == PeripheralDeviceTypes.SequentialAccess)
|
||||
if(deviceType == PeripheralDeviceTypes.SequentialAccess)
|
||||
{
|
||||
if (header.WriteProtected)
|
||||
if(header.WriteProtected)
|
||||
hdr[3] += 0x80;
|
||||
hdr[3] += (byte)(header.Speed & 0x0F);
|
||||
hdr[3] += (byte)((header.BufferedMode << 4) & 0x70);
|
||||
}
|
||||
|
||||
if (deviceType == PeripheralDeviceTypes.PrinterDevice)
|
||||
if(deviceType == PeripheralDeviceTypes.PrinterDevice)
|
||||
hdr[3] += (byte)((header.BufferedMode << 4) & 0x70);
|
||||
|
||||
if (deviceType == PeripheralDeviceTypes.OpticalDevice)
|
||||
if(deviceType == PeripheralDeviceTypes.OpticalDevice)
|
||||
{
|
||||
if (header.WriteProtected)
|
||||
if(header.WriteProtected)
|
||||
hdr[3] += 0x80;
|
||||
if (header.EBC)
|
||||
if(header.EBC)
|
||||
hdr[3] += 0x01;
|
||||
if (header.DPOFUA)
|
||||
if(header.DPOFUA)
|
||||
hdr[3] += 0x10;
|
||||
}
|
||||
|
||||
if (longLBA)
|
||||
if(longLBA)
|
||||
hdr[4] += 0x01;
|
||||
|
||||
if (header.BlockDescriptors != null)
|
||||
if(header.BlockDescriptors != null)
|
||||
{
|
||||
if (longLBA)
|
||||
if(longLBA)
|
||||
{
|
||||
for (int i = 0; i < header.BlockDescriptors.Length; i++)
|
||||
for(int i = 0; i < header.BlockDescriptors.Length; i++)
|
||||
{
|
||||
byte[] temp = BitConverter.GetBytes(header.BlockDescriptors[i].Blocks);
|
||||
hdr[7 + i * 16 + 8] = temp[0];
|
||||
@@ -233,9 +233,9 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < header.BlockDescriptors.Length; i++)
|
||||
for(int i = 0; i < header.BlockDescriptors.Length; i++)
|
||||
{
|
||||
if (deviceType != PeripheralDeviceTypes.DirectAccess)
|
||||
if(deviceType != PeripheralDeviceTypes.DirectAccess)
|
||||
hdr[0 + i * 8 + 8] = (byte)header.BlockDescriptors[i].Density;
|
||||
else
|
||||
hdr[0 + i * 8 + 8] = (byte)((header.BlockDescriptors[i].Blocks & 0xFF000000) >> 24);
|
||||
@@ -259,23 +259,23 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
pg[0] = 0x01;
|
||||
pg[1] = 6;
|
||||
|
||||
if (page.PS)
|
||||
if(page.PS)
|
||||
pg[0] += 0x80;
|
||||
if (page.AWRE)
|
||||
if(page.AWRE)
|
||||
pg[2] += 0x80;
|
||||
if (page.ARRE)
|
||||
if(page.ARRE)
|
||||
pg[2] += 0x40;
|
||||
if (page.TB)
|
||||
if(page.TB)
|
||||
pg[2] += 0x20;
|
||||
if (page.RC)
|
||||
if(page.RC)
|
||||
pg[2] += 0x10;
|
||||
if (page.EER)
|
||||
if(page.EER)
|
||||
pg[2] += 0x08;
|
||||
if (page.PER)
|
||||
if(page.PER)
|
||||
pg[2] += 0x04;
|
||||
if (page.DTE)
|
||||
if(page.DTE)
|
||||
pg[2] += 0x02;
|
||||
if (page.DCR)
|
||||
if(page.DCR)
|
||||
pg[2] += 0x01;
|
||||
|
||||
pg[3] = page.ReadRetryCount;
|
||||
@@ -301,7 +301,7 @@ namespace DiscImageChef.Decoders.SCSI
|
||||
pg[0] = 0x01;
|
||||
pg[1] = 10;
|
||||
|
||||
if (page.PS)
|
||||
if(page.PS)
|
||||
pg[0] += 0x80;
|
||||
pg[2] = page.Parameter;
|
||||
pg[3] = page.ReadRetryCount;
|
||||
|
||||
Reference in New Issue
Block a user