General refactor and cleanup.

This commit is contained in:
2024-05-01 04:05:22 +01:00
parent 185a8c3fd5
commit e46d21bde6
922 changed files with 36437 additions and 29485 deletions

View File

@@ -59,17 +59,13 @@ public static partial class Modes
public static ModePage_00_SFF? DecodeModePage_00_SFF(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
return null;
if((pageResponse?[0] & 0x40) == 0x40) return null;
if((pageResponse?[0] & 0x3F) != 0x00)
return null;
if((pageResponse?[0] & 0x3F) != 0x00) return null;
if(pageResponse[1] + 2 != pageResponse.Length)
return null;
if(pageResponse[1] + 2 != pageResponse.Length) return null;
if(pageResponse.Length < 4)
return null;
if(pageResponse.Length < 4) return null;
var decoded = new ModePage_00_SFF();
@@ -89,25 +85,20 @@ public static partial class Modes
public static string PrettifyModePage_00_SFF(ModePage_00_SFF? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
ModePage_00_SFF page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.SCSI_Drive_Operation_Mode_page);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.DVW)
sb.AppendLine("\t" + Localization.Verifying_after_writing_is_disabled);
if(page.DVW) sb.AppendLine("\t" + Localization.Verifying_after_writing_is_disabled);
if(page.DDE)
sb.AppendLine("\t" + Localization.Drive_will_abort_when_a_writing_error_is_detected);
if(page.DDE) sb.AppendLine("\t" + Localization.Drive_will_abort_when_a_writing_error_is_detected);
if(!page.SLM)
return sb.ToString();
if(!page.SLM) return sb.ToString();
sb.Append("\t" + Localization.Drive_has_two_LUNs_with_rewritable_being);
sb.AppendLine(page.SLR ? "LUN 1" : "LUN 0");

View File

@@ -47,32 +47,23 @@ public static partial class Modes
pg[0] = 0x01;
pg[1] = 6;
if(page.PS)
pg[0] += 0x80;
if(page.PS) pg[0] += 0x80;
if(page.AWRE)
pg[2] += 0x80;
if(page.AWRE) pg[2] += 0x80;
if(page.ARRE)
pg[2] += 0x40;
if(page.ARRE) pg[2] += 0x40;
if(page.TB)
pg[2] += 0x20;
if(page.TB) pg[2] += 0x20;
if(page.RC)
pg[2] += 0x10;
if(page.RC) pg[2] += 0x10;
if(page.EER)
pg[2] += 0x08;
if(page.EER) pg[2] += 0x08;
if(page.PER)
pg[2] += 0x04;
if(page.PER) pg[2] += 0x04;
if(page.DTE)
pg[2] += 0x02;
if(page.DTE) pg[2] += 0x02;
if(page.DCR)
pg[2] += 0x01;
if(page.DCR) pg[2] += 0x01;
pg[3] = page.ReadRetryCount;
pg[4] = page.CorrectionSpan;
@@ -132,17 +123,13 @@ public static partial class Modes
public static ModePage_01? DecodeModePage_01(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
return null;
if((pageResponse?[0] & 0x40) == 0x40) return null;
if((pageResponse?[0] & 0x3F) != 0x01)
return null;
if((pageResponse?[0] & 0x3F) != 0x01) return null;
if(pageResponse[1] + 2 != pageResponse.Length)
return null;
if(pageResponse[1] + 2 != pageResponse.Length) return null;
if(pageResponse.Length < 8)
return null;
if(pageResponse.Length < 8) return null;
var decoded = new ModePage_01();
@@ -161,8 +148,7 @@ public static partial class Modes
decoded.HeadOffsetCount = (sbyte)pageResponse[5];
decoded.DataStrobeOffsetCount = (sbyte)pageResponse[6];
if(pageResponse.Length < 12)
return decoded;
if(pageResponse.Length < 12) return decoded;
decoded.WriteRetryCount = pageResponse[8];
decoded.RecoveryTimeLimit = (ushort)((pageResponse[10] << 8) + pageResponse[11]);
@@ -176,70 +162,61 @@ public static partial class Modes
public static string PrettifyModePage_01(ModePage_01? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
ModePage_01 page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.SCSI_Read_write_error_recovery_page);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.AWRE)
sb.AppendLine("\t" + Localization.Automatic_write_reallocation_is_enabled);
if(page.AWRE) sb.AppendLine("\t" + Localization.Automatic_write_reallocation_is_enabled);
if(page.ARRE)
sb.AppendLine("\t" + Localization.Automatic_read_reallocation_is_enabled);
if(page.ARRE) sb.AppendLine("\t" + Localization.Automatic_read_reallocation_is_enabled);
if(page.TB)
{
sb.AppendLine("\t" +
Localization.
Data_not_recovered_within_limits_shall_be_transferred_back_before_a_CHECK_CONDITION);
Localization
.Data_not_recovered_within_limits_shall_be_transferred_back_before_a_CHECK_CONDITION);
}
if(page.RC)
{
sb.AppendLine("\t" +
Localization.
Drive_will_transfer_the_entire_requested_length_without_delaying_to_perform_error_recovery);
Localization
.Drive_will_transfer_the_entire_requested_length_without_delaying_to_perform_error_recovery);
}
if(page.EER)
sb.AppendLine("\t" + Localization.Drive_will_use_the_most_expedient_form_of_error_recovery_first);
if(page.EER) sb.AppendLine("\t" + Localization.Drive_will_use_the_most_expedient_form_of_error_recovery_first);
if(page.PER)
sb.AppendLine("\t" + Localization.Drive_shall_report_recovered_errors);
if(page.PER) sb.AppendLine("\t" + Localization.Drive_shall_report_recovered_errors);
if(page.DTE)
sb.AppendLine("\t" + Localization.Transfer_will_be_terminated_upon_error_detection);
if(page.DTE) sb.AppendLine("\t" + Localization.Transfer_will_be_terminated_upon_error_detection);
if(page.DCR)
sb.AppendLine("\t" + Localization.Error_correction_is_disabled);
if(page.DCR) sb.AppendLine("\t" + Localization.Error_correction_is_disabled);
if(page.ReadRetryCount > 0)
{
sb.AppendFormat("\t" + Localization.Drive_will_repeat_read_operations_0_times, page.ReadRetryCount).
AppendLine();
sb.AppendFormat("\t" + Localization.Drive_will_repeat_read_operations_0_times, page.ReadRetryCount)
.AppendLine();
}
if(page.WriteRetryCount > 0)
{
sb.AppendFormat("\t" + Localization.Drive_will_repeat_write_operations_0_times, page.WriteRetryCount).
AppendLine();
sb.AppendFormat("\t" + Localization.Drive_will_repeat_write_operations_0_times, page.WriteRetryCount)
.AppendLine();
}
if(page.RecoveryTimeLimit > 0)
{
sb.AppendFormat("\t" + Localization.Drive_will_employ_a_maximum_of_0_ms_to_recover_data,
page.RecoveryTimeLimit).
AppendLine();
page.RecoveryTimeLimit)
.AppendLine();
}
if(page.LBPERE)
sb.AppendLine(Localization.Logical_block_provisioning_error_reporting_is_enabled);
if(page.LBPERE) sb.AppendLine(Localization.Logical_block_provisioning_error_reporting_is_enabled);
return sb.ToString();
}

View File

@@ -47,8 +47,7 @@ public static partial class Modes
pg[0] = 0x01;
pg[1] = 10;
if(page.PS)
pg[0] += 0x80;
if(page.PS) pg[0] += 0x80;
pg[2] = page.Parameter;
pg[3] = page.ReadRetryCount;
@@ -84,17 +83,13 @@ public static partial class Modes
public static ModePage_01_MMC? DecodeModePage_01_MMC(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
return null;
if((pageResponse?[0] & 0x40) == 0x40) return null;
if((pageResponse?[0] & 0x3F) != 0x01)
return null;
if((pageResponse?[0] & 0x3F) != 0x01) return null;
if(pageResponse[1] + 2 != pageResponse.Length)
return null;
if(pageResponse[1] + 2 != pageResponse.Length) return null;
if(pageResponse.Length < 8)
return null;
if(pageResponse.Length < 8) return null;
var decoded = new ModePage_01_MMC();
@@ -102,8 +97,7 @@ public static partial class Modes
decoded.Parameter = pageResponse[2];
decoded.ReadRetryCount = pageResponse[3];
if(pageResponse.Length < 12)
return decoded;
if(pageResponse.Length < 12) return decoded;
decoded.WriteRetryCount = pageResponse[8];
decoded.RecoveryTimeLimit = (ushort)((pageResponse[10] << 8) + pageResponse[11]);
@@ -116,21 +110,19 @@ public static partial class Modes
public static string PrettifyModePage_01_MMC(ModePage_01_MMC? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
ModePage_01_MMC page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.SCSI_Read_error_recovery_page_for_MultiMedia_Devices);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.ReadRetryCount > 0)
{
sb.AppendFormat("\t" + Localization.Drive_will_repeat_read_operations_0_times, page.ReadRetryCount).
AppendLine();
sb.AppendFormat("\t" + Localization.Drive_will_repeat_read_operations_0_times, page.ReadRetryCount)
.AppendLine();
}
string AllUsed = "\t" + Localization.All_available_recovery_procedures_will_be_used + "\n";
@@ -235,15 +227,15 @@ public static partial class Modes
if(page.WriteRetryCount > 0)
{
sb.AppendFormat("\t" + Localization.Drive_will_repeat_write_operations_0_times, page.WriteRetryCount).
AppendLine();
sb.AppendFormat("\t" + Localization.Drive_will_repeat_write_operations_0_times, page.WriteRetryCount)
.AppendLine();
}
if(page.RecoveryTimeLimit > 0)
{
sb.AppendFormat("\t" + Localization.Drive_will_employ_a_maximum_of_0_ms_to_recover_data,
page.RecoveryTimeLimit).
AppendLine();
page.RecoveryTimeLimit)
.AppendLine();
}
return sb.ToString();

View File

@@ -77,17 +77,13 @@ public static partial class Modes
public static ModePage_02? DecodeModePage_02(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
return null;
if((pageResponse?[0] & 0x40) == 0x40) return null;
if((pageResponse?[0] & 0x3F) != 0x02)
return null;
if((pageResponse?[0] & 0x3F) != 0x02) return null;
if(pageResponse[1] + 2 != pageResponse.Length)
return null;
if(pageResponse[1] + 2 != pageResponse.Length) return null;
if(pageResponse.Length < 12)
return null;
if(pageResponse.Length < 12) return null;
var decoded = new ModePage_02();
@@ -107,8 +103,7 @@ public static partial class Modes
decoded.DTDC = (byte)(pageResponse[12] & 0x07);
}
if(pageResponse.Length >= 16)
decoded.FirstBurstSize = (ushort)((pageResponse[14] << 8) + pageResponse[15]);
if(pageResponse.Length >= 16) decoded.FirstBurstSize = (ushort)((pageResponse[14] << 8) + pageResponse[15]);
return decoded;
}
@@ -118,79 +113,79 @@ public static partial class Modes
public static string PrettifyModePage_02(ModePage_02? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
ModePage_02 page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.SCSI_Disconnect_Reconnect_mode_page);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.BufferFullRatio > 0)
{
sb.AppendFormat("\t" + Localization._0_ratio_of_buffer_that_shall_be_full_prior_to_attempting_a_reselection,
page.BufferFullRatio).
AppendLine();
page.BufferFullRatio)
.AppendLine();
}
if(page.BufferEmptyRatio > 0)
{
sb.
AppendFormat("\t" + Localization._0_ratio_of_buffer_that_shall_be_empty_prior_to_attempting_a_reselection,
page.BufferEmptyRatio).
AppendLine();
sb.AppendFormat("\t" +
Localization._0_ratio_of_buffer_that_shall_be_empty_prior_to_attempting_a_reselection,
page.BufferEmptyRatio)
.AppendLine();
}
if(page.BusInactivityLimit > 0)
{
sb.AppendFormat("\t" + Localization._0_µs_maximum_permitted_to_assert_BSY_without_a_REQ_ACK_handshake,
page.BusInactivityLimit * 100).
AppendLine();
page.BusInactivityLimit * 100)
.AppendLine();
}
if(page.DisconnectTimeLimit > 0)
{
sb.
AppendFormat("\t" + Localization._0_µs_maximum_permitted_wait_after_releasing_the_bus_before_attempting_reselection,
page.DisconnectTimeLimit * 100).
AppendLine();
sb.AppendFormat("\t" +
Localization
._0_µs_maximum_permitted_wait_after_releasing_the_bus_before_attempting_reselection,
page.DisconnectTimeLimit * 100)
.AppendLine();
}
if(page.ConnectTimeLimit > 0)
{
sb.
AppendFormat("\t" + Localization._0_µs_allowed_to_use_the_bus_before_disconnecting_if_granted_the_privilege_and_not_restricted,
page.ConnectTimeLimit * 100).
AppendLine();
sb.AppendFormat("\t" +
Localization
._0_µs_allowed_to_use_the_bus_before_disconnecting_if_granted_the_privilege_and_not_restricted,
page.ConnectTimeLimit * 100)
.AppendLine();
}
if(page.MaxBurstSize > 0)
{
sb.AppendFormat("\t" + Localization._0_bytes_maximum_can_be_transferred_before_disconnecting,
page.MaxBurstSize * 512).
AppendLine();
page.MaxBurstSize * 512)
.AppendLine();
}
if(page.FirstBurstSize > 0)
{
sb.
AppendFormat("\t" + Localization._0_bytes_maximum_can_be_transferred_for_a_command_along_with_the_disconnect_command,
page.FirstBurstSize * 512).
AppendLine();
sb.AppendFormat("\t" +
Localization
._0_bytes_maximum_can_be_transferred_for_a_command_along_with_the_disconnect_command,
page.FirstBurstSize * 512)
.AppendLine();
}
if(page.DIMM)
{
sb.AppendLine("\t" +
Localization.
Target_shall_not_transfer_data_for_a_command_during_the_same_interconnect_tenancy);
Localization
.Target_shall_not_transfer_data_for_a_command_during_the_same_interconnect_tenancy);
}
if(page.EMDP)
sb.AppendLine("\t" + Localization.Target_is_allowed_to_reorder_the_data_transfer);
if(page.EMDP) sb.AppendLine("\t" + Localization.Target_is_allowed_to_reorder_the_data_transfer);
switch(page.DTDC)
{
@@ -200,19 +195,19 @@ public static partial class Modes
break;
case 1:
sb.AppendLine("\t" +
Localization.
All_data_for_a_command_shall_be_transferred_within_a_single_interconnect_tenancy);
Localization
.All_data_for_a_command_shall_be_transferred_within_a_single_interconnect_tenancy);
break;
case 3:
sb.AppendLine("\t" +
Localization.
All_data_and_the_response_for_a_command_shall_be_transferred_within_a_single_interconnect_tenancy);
Localization
.All_data_and_the_response_for_a_command_shall_be_transferred_within_a_single_interconnect_tenancy);
break;
default:
sb.AppendFormat("\t" + Localization.Reserved_data_transfer_disconnect_control_value_0, page.DTDC).
AppendLine();
sb.AppendFormat("\t" + Localization.Reserved_data_transfer_disconnect_control_value_0, page.DTDC)
.AppendLine();
break;
}

View File

@@ -80,17 +80,13 @@ public static partial class Modes
public static ModePage_03? DecodeModePage_03(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
return null;
if((pageResponse?[0] & 0x40) == 0x40) return null;
if((pageResponse?[0] & 0x3F) != 0x03)
return null;
if((pageResponse?[0] & 0x3F) != 0x03) return null;
if(pageResponse[1] + 2 != pageResponse.Length)
return null;
if(pageResponse[1] + 2 != pageResponse.Length) return null;
if(pageResponse.Length < 24)
return null;
if(pageResponse.Length < 24) return null;
var decoded = new ModePage_03();
@@ -117,62 +113,58 @@ public static partial class Modes
public static string PrettifyModePage_03(ModePage_03? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
ModePage_03 page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.SCSI_Format_device_page);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
sb.
AppendFormat("\t" + Localization._0_tracks_per_zone_to_use_in_dividing_the_capacity_for_the_purpose_of_allocating_alternate_sectors,
page.TracksPerZone).
AppendLine();
sb.AppendFormat("\t" +
Localization
._0_tracks_per_zone_to_use_in_dividing_the_capacity_for_the_purpose_of_allocating_alternate_sectors,
page.TracksPerZone)
.AppendLine();
sb.AppendFormat("\t" + Localization._0_sectors_per_zone_that_shall_be_reserved_for_defect_handling,
page.AltSectorsPerZone).
AppendLine();
page.AltSectorsPerZone)
.AppendLine();
sb.AppendFormat("\t" + Localization._0_tracks_per_zone_that_shall_be_reserved_for_defect_handling,
page.AltTracksPerZone).
AppendLine();
page.AltTracksPerZone)
.AppendLine();
sb.AppendFormat("\t" + Localization._0_tracks_per_LUN_that_shall_be_reserved_for_defect_handling,
page.AltTracksPerLun).
AppendLine();
page.AltTracksPerLun)
.AppendLine();
sb.AppendFormat("\t" + Localization._0_physical_sectors_per_track, page.SectorsPerTrack).AppendLine();
sb.AppendFormat("\t" + Localization._0_Bytes_per_physical_sector, page.BytesPerSector).AppendLine();
sb.AppendFormat("\t" + Localization.Target_dependent_interleave_value_is_0, page.Interleave).AppendLine();
sb.AppendFormat("\t" + Localization._0_sectors_between_last_block_of_one_track_and_first_block_of_the_next,
page.TrackSkew).
AppendLine();
page.TrackSkew)
.AppendLine();
sb.AppendFormat("\t" + Localization._0_sectors_between_last_block_of_a_cylinder_and_first_block_of_the_next_one,
page.CylinderSkew).
AppendLine();
page.CylinderSkew)
.AppendLine();
if(page.SSEC)
sb.AppendLine("\t" + Localization.Drive_supports_soft_sectoring_format);
if(page.SSEC) sb.AppendLine("\t" + Localization.Drive_supports_soft_sectoring_format);
if(page.HSEC)
sb.AppendLine("\t" + Localization.Drive_supports_hard_sectoring_format);
if(page.HSEC) sb.AppendLine("\t" + Localization.Drive_supports_hard_sectoring_format);
if(page.RMB)
sb.AppendLine("\t" + Localization.Drive_media_is_removable);
if(page.RMB) sb.AppendLine("\t" + Localization.Drive_media_is_removable);
sb.AppendLine(page.SURF
? "\t" +
Localization.
Sector_addressing_is_progressively_incremented_in_one_surface_before_going_to_the_next
Localization
.Sector_addressing_is_progressively_incremented_in_one_surface_before_going_to_the_next
: "\t" +
Localization.
Sector_addressing_is_progressively_incremented_in_one_cylinder_before_going_to_the_next);
Localization
.Sector_addressing_is_progressively_incremented_in_one_cylinder_before_going_to_the_next);
return sb.ToString();
}

View File

@@ -69,17 +69,13 @@ public static partial class Modes
public static ModePage_04? DecodeModePage_04(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
return null;
if((pageResponse?[0] & 0x40) == 0x40) return null;
if((pageResponse?[0] & 0x3F) != 0x04)
return null;
if((pageResponse?[0] & 0x3F) != 0x04) return null;
if(pageResponse[1] + 2 != pageResponse.Length)
return null;
if(pageResponse[1] + 2 != pageResponse.Length) return null;
if(pageResponse.Length < 20)
return null;
if(pageResponse.Length < 20) return null;
var decoded = new ModePage_04();
@@ -96,8 +92,7 @@ public static partial class Modes
decoded.RPL = (byte)(pageResponse[17] & 0x03);
decoded.RotationalOffset = pageResponse[18];
if(pageResponse.Length >= 22)
decoded.MediumRotationRate = (ushort)((pageResponse[20] << 8) + pageResponse[21]);
if(pageResponse.Length >= 22) decoded.MediumRotationRate = (ushort)((pageResponse[20] << 8) + pageResponse[21]);
return decoded;
}
@@ -107,30 +102,28 @@ public static partial class Modes
public static string PrettifyModePage_04(ModePage_04? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
ModePage_04 page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.SCSI_Rigid_disk_drive_geometry_page);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
sb.AppendFormat("\t" + Localization._0_heads, page.Heads).AppendLine();
sb.AppendFormat("\t" + Localization._0_cylinders, page.Cylinders).AppendLine();
if(page.WritePrecompCylinder < page.Cylinders)
{
sb.AppendFormat("\t" + Localization.Write_pre_compensation_starts_at_cylinder_0, page.WritePrecompCylinder).
AppendLine();
sb.AppendFormat("\t" + Localization.Write_pre_compensation_starts_at_cylinder_0, page.WritePrecompCylinder)
.AppendLine();
}
if(page.WriteReduceCylinder < page.Cylinders)
{
sb.AppendFormat("\t" + Localization.Write_current_reduction_starts_at_cylinder_0, page.WriteReduceCylinder).
AppendLine();
sb.AppendFormat("\t" + Localization.Write_current_reduction_starts_at_cylinder_0, page.WriteReduceCylinder)
.AppendLine();
}
if(page.DriveStepRate > 0)

View File

@@ -105,17 +105,13 @@ public static partial class Modes
public static ModePage_05? DecodeModePage_05(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
return null;
if((pageResponse?[0] & 0x40) == 0x40) return null;
if((pageResponse?[0] & 0x3F) != 0x05)
return null;
if((pageResponse?[0] & 0x3F) != 0x05) return null;
if(pageResponse[1] + 2 != pageResponse.Length)
return null;
if(pageResponse[1] + 2 != pageResponse.Length) return null;
if(pageResponse.Length < 32)
return null;
if(pageResponse.Length < 32) return null;
var decoded = new ModePage_05();
@@ -153,16 +149,14 @@ public static partial class Modes
public static string PrettifyModePage_05(ModePage_05? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
ModePage_05 page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.SCSI_Flexible_disk_page);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
sb.AppendFormat("\t" + Localization.Transfer_rate_0_kbits, page.TransferRate).AppendLine();
sb.AppendFormat("\t" + Localization._0_heads, page.Heads).AppendLine();
@@ -172,14 +166,14 @@ public static partial class Modes
if(page.WritePrecompCylinder < page.Cylinders)
{
sb.AppendFormat("\t" + Localization.Write_pre_compensation_starts_at_cylinder_0, page.WritePrecompCylinder).
AppendLine();
sb.AppendFormat("\t" + Localization.Write_pre_compensation_starts_at_cylinder_0, page.WritePrecompCylinder)
.AppendLine();
}
if(page.WriteReduceCylinder < page.Cylinders)
{
sb.AppendFormat("\t" + Localization.Write_current_reduction_starts_at_cylinder_0, page.WriteReduceCylinder).
AppendLine();
sb.AppendFormat("\t" + Localization.Write_current_reduction_starts_at_cylinder_0, page.WriteReduceCylinder)
.AppendLine();
}
if(page.DriveStepRate > 0)
@@ -193,37 +187,37 @@ public static partial class Modes
if(!page.TRDY)
{
sb.
AppendFormat("\t" + Localization.Target_shall_wait_0_seconds_before_attempting_to_access_the_medium_after_motor_on_is_asserted,
(double)page.MotorOnDelay * 10).
AppendLine();
sb.AppendFormat("\t" +
Localization
.Target_shall_wait_0_seconds_before_attempting_to_access_the_medium_after_motor_on_is_asserted,
(double)page.MotorOnDelay * 10)
.AppendLine();
}
else
{
sb.
AppendFormat("\t" + Localization.Target_shall_wait_0_seconds_after_drive_is_ready_before_aborting_medium_access_attempts,
(double)page.MotorOnDelay * 10).
AppendLine();
sb.AppendFormat("\t" +
Localization
.Target_shall_wait_0_seconds_after_drive_is_ready_before_aborting_medium_access_attempts,
(double)page.MotorOnDelay * 10)
.AppendLine();
}
if(page.MotorOffDelay != 0xFF)
{
sb.
AppendFormat("\t" + Localization.Target_shall_wait_0_seconds_before_releasing_the_motor_on_signal_after_becoming_idle,
(double)page.MotorOffDelay * 10).
AppendLine();
sb.AppendFormat("\t" +
Localization
.Target_shall_wait_0_seconds_before_releasing_the_motor_on_signal_after_becoming_idle,
(double)page.MotorOffDelay * 10)
.AppendLine();
}
else
sb.AppendLine("\t" + Localization.Target_shall_never_release_the_motor_on_signal);
if(page.TRDY)
sb.AppendLine("\t" + Localization.There_is_a_drive_ready_signal);
if(page.TRDY) sb.AppendLine("\t" + Localization.There_is_a_drive_ready_signal);
if(page.SSN)
sb.AppendLine("\t" + Localization.Sectors_start_at_1);
if(page.SSN) sb.AppendLine("\t" + Localization.Sectors_start_at_1);
if(page.MO)
sb.AppendLine("\t" + Localization.The_motor_on_signal_shall_remain_released);
if(page.MO) sb.AppendLine("\t" + Localization.The_motor_on_signal_shall_remain_released);
sb.AppendFormat("\t" + Localization.Drive_needs_to_do_0_step_pulses_per_cylinder, page.SPC + 1).AppendLine();
@@ -260,7 +254,10 @@ public static partial class Modes
break;
default:
sb.AppendFormat("\t" + ((page.Pin34 & 0x08) == 0x08 ? Localization.Pin_34_indicates_unknown_function_0_when_active_high : Localization.Pin_34_indicates_unknown_function_0_when_active_low),
sb.AppendFormat("\t" +
((page.Pin34 & 0x08) == 0x08
? Localization.Pin_34_indicates_unknown_function_0_when_active_high
: Localization.Pin_34_indicates_unknown_function_0_when_active_low),
page.Pin34 & 0x07);
break;
@@ -294,7 +291,10 @@ public static partial class Modes
break;
default:
sb.AppendFormat("\t" + ((page.Pin4 & 0x08) == 0x08 ? Localization.Pin_4_indicates_unknown_function_0_when_active_high : Localization.Pin_4_indicates_unknown_function_0_when_active_low),
sb.AppendFormat("\t" +
((page.Pin4 & 0x08) == 0x08
? Localization.Pin_4_indicates_unknown_function_0_when_active_high
: Localization.Pin_4_indicates_unknown_function_0_when_active_low),
page.Pin4 & 0x07);
break;
@@ -307,7 +307,10 @@ public static partial class Modes
break;
default:
sb.AppendFormat("\t" + ((page.Pin2 & 0x08) == 0x08 ? Localization.Pin_2_indicates_unknown_function_0_when_active_high : Localization.Pin_2_indicates_unknown_function_0_when_active_low),
sb.AppendFormat("\t" +
((page.Pin2 & 0x08) == 0x08
? Localization.Pin_2_indicates_unknown_function_0_when_active_high
: Localization.Pin_2_indicates_unknown_function_0_when_active_low),
page.Pin2 & 0x07);
break;
@@ -327,7 +330,10 @@ public static partial class Modes
break;
default:
sb.AppendFormat("\t" + ((page.Pin1 & 0x08) == 0x08 ? Localization.Pin_1_indicates_unknown_function_0_when_active_high : Localization.Pin_1_indicates_unknown_function_0_when_active_low),
sb.AppendFormat("\t" +
((page.Pin1 & 0x08) == 0x08
? Localization.Pin_1_indicates_unknown_function_0_when_active_high
: Localization.Pin_1_indicates_unknown_function_0_when_active_low),
page.Pin1 & 0x07);
break;

View File

@@ -53,17 +53,13 @@ public static partial class Modes
public static ModePage_06? DecodeModePage_06(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
return null;
if((pageResponse?[0] & 0x40) == 0x40) return null;
if((pageResponse?[0] & 0x3F) != 0x06)
return null;
if((pageResponse?[0] & 0x3F) != 0x06) return null;
if(pageResponse[1] + 2 != pageResponse.Length)
return null;
if(pageResponse[1] + 2 != pageResponse.Length) return null;
if(pageResponse.Length < 4)
return null;
if(pageResponse.Length < 4) return null;
var decoded = new ModePage_06();
@@ -78,19 +74,16 @@ public static partial class Modes
public static string PrettifyModePage_06(ModePage_06? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
ModePage_06 page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.SCSI_optical_memory);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.RUBR)
sb.AppendLine("\t" + Localization.On_reading_an_updated_block_drive_will_return_RECOVERED_ERROR);
if(page.RUBR) sb.AppendLine("\t" + Localization.On_reading_an_updated_block_drive_will_return_RECOVERED_ERROR);
return sb.ToString();
}

View File

@@ -66,17 +66,13 @@ public static partial class Modes
public static ModePage_07? DecodeModePage_07(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
return null;
if((pageResponse?[0] & 0x40) == 0x40) return null;
if((pageResponse?[0] & 0x3F) != 0x07)
return null;
if((pageResponse?[0] & 0x3F) != 0x07) return null;
if(pageResponse[1] + 2 != pageResponse.Length)
return null;
if(pageResponse[1] + 2 != pageResponse.Length) return null;
if(pageResponse.Length < 12)
return null;
if(pageResponse.Length < 12) return null;
var decoded = new ModePage_07();
@@ -98,40 +94,34 @@ public static partial class Modes
public static string PrettifyModePage_07(ModePage_07? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
ModePage_07 page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.SCSI_Verify_error_recovery_page);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.EER)
sb.AppendLine("\t" + Localization.Drive_will_use_the_most_expedient_form_of_error_recovery_first);
if(page.EER) sb.AppendLine("\t" + Localization.Drive_will_use_the_most_expedient_form_of_error_recovery_first);
if(page.PER)
sb.AppendLine("\t" + Localization.Drive_shall_report_recovered_errors);
if(page.PER) sb.AppendLine("\t" + Localization.Drive_shall_report_recovered_errors);
if(page.DTE)
sb.AppendLine("\t" + Localization.Transfer_will_be_terminated_upon_error_detection);
if(page.DTE) sb.AppendLine("\t" + Localization.Transfer_will_be_terminated_upon_error_detection);
if(page.DCR)
sb.AppendLine("\t" + Localization.Error_correction_is_disabled);
if(page.DCR) sb.AppendLine("\t" + Localization.Error_correction_is_disabled);
if(page.VerifyRetryCount > 0)
{
sb.AppendFormat("\t" + Localization.Drive_will_repeat_verify_operations_0_times, page.VerifyRetryCount).
AppendLine();
sb.AppendFormat("\t" + Localization.Drive_will_repeat_verify_operations_0_times, page.VerifyRetryCount)
.AppendLine();
}
if(page.RecoveryTimeLimit > 0)
{
sb.AppendFormat("\t" + Localization.Drive_will_employ_a_maximum_of_0_ms_to_recover_data,
page.RecoveryTimeLimit).
AppendLine();
page.RecoveryTimeLimit)
.AppendLine();
}
return sb.ToString();

View File

@@ -55,17 +55,13 @@ public static partial class Modes
public static ModePage_07_MMC? DecodeModePage_07_MMC(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
return null;
if((pageResponse?[0] & 0x40) == 0x40) return null;
if((pageResponse?[0] & 0x3F) != 0x07)
return null;
if((pageResponse?[0] & 0x3F) != 0x07) return null;
if(pageResponse[1] + 2 != pageResponse.Length)
return null;
if(pageResponse[1] + 2 != pageResponse.Length) return null;
if(pageResponse.Length < 8)
return null;
if(pageResponse.Length < 8) return null;
var decoded = new ModePage_07_MMC();
@@ -81,21 +77,19 @@ public static partial class Modes
public static string PrettifyModePage_07_MMC(ModePage_07_MMC? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
ModePage_07_MMC page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.SCSI_Verify_error_recovery_page_for_MultiMedia_Devices);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.VerifyRetryCount > 0)
{
sb.AppendFormat("\t" + Localization.Drive_will_repeat_verify_operations_0_times, page.VerifyRetryCount).
AppendLine();
sb.AppendFormat("\t" + Localization.Drive_will_repeat_verify_operations_0_times, page.VerifyRetryCount)
.AppendLine();
}
string AllUsed = "\t" + Localization.All_available_recovery_procedures_will_be_used + "\n";

View File

@@ -94,17 +94,13 @@ public static partial class Modes
public static ModePage_08? DecodeModePage_08(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
return null;
if((pageResponse?[0] & 0x40) == 0x40) return null;
if((pageResponse?[0] & 0x3F) != 0x08)
return null;
if((pageResponse?[0] & 0x3F) != 0x08) return null;
if(pageResponse[1] + 2 != pageResponse.Length)
return null;
if(pageResponse[1] + 2 != pageResponse.Length) return null;
if(pageResponse.Length < 12)
return null;
if(pageResponse.Length < 12) return null;
var decoded = new ModePage_08();
@@ -120,8 +116,7 @@ public static partial class Modes
decoded.MaximumPreFetch = (ushort)((pageResponse[8] << 8) + pageResponse[9]);
decoded.MaximumPreFetchCeiling = (ushort)((pageResponse[10] << 8) + pageResponse[11]);
if(pageResponse.Length < 20)
return decoded;
if(pageResponse.Length < 20) return decoded;
decoded.IC |= (pageResponse[2] & 0x80) == 0x80;
decoded.ABPF |= (pageResponse[2] & 0x40) == 0x40;
@@ -147,22 +142,18 @@ public static partial class Modes
public static string PrettifyModePage_08(ModePage_08? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
ModePage_08 page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.SCSI_Caching_mode_page);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.RCD)
sb.AppendLine("\t" + Localization.Read_cache_is_enabled);
if(page.RCD) sb.AppendLine("\t" + Localization.Read_cache_is_enabled);
if(page.WCE)
sb.AppendLine("\t" + Localization.Write_cache_is_enabled);
if(page.WCE) sb.AppendLine("\t" + Localization.Write_cache_is_enabled);
switch(page.DemandReadRetentionPrio)
{
@@ -172,20 +163,20 @@ public static partial class Modes
break;
case 1:
sb.AppendLine("\t" +
Localization.
Data_put_by_READ_commands_should_be_evicted_from_cache_sooner_than_data_put_in_read_cache_by_other_means);
Localization
.Data_put_by_READ_commands_should_be_evicted_from_cache_sooner_than_data_put_in_read_cache_by_other_means);
break;
case 0xF:
sb.AppendLine("\t" +
Localization.
Data_put_by_READ_commands_should_not_be_evicted_if_there_is_data_cached_by_other_means_that_can_be_evicted);
Localization
.Data_put_by_READ_commands_should_not_be_evicted_if_there_is_data_cached_by_other_means_that_can_be_evicted);
break;
default:
sb.AppendFormat("\t" + Localization.Unknown_demand_read_retention_priority_value_0,
page.DemandReadRetentionPrio).
AppendLine();
page.DemandReadRetentionPrio)
.AppendLine();
break;
}
@@ -198,20 +189,20 @@ public static partial class Modes
break;
case 1:
sb.AppendLine("\t" +
Localization.
Data_put_by_WRITE_commands_should_be_evicted_from_cache_sooner_than_data_put_in_write_cache_by_other_means);
Localization
.Data_put_by_WRITE_commands_should_be_evicted_from_cache_sooner_than_data_put_in_write_cache_by_other_means);
break;
case 0xF:
sb.AppendLine("\t" +
Localization.
Data_put_by_WRITE_commands_should_not_be_evicted_if_there_is_data_cached_by_other_means_that_can_be_evicted);
Localization
.Data_put_by_WRITE_commands_should_not_be_evicted_if_there_is_data_cached_by_other_means_that_can_be_evicted);
break;
default:
sb.AppendFormat("\t" + Localization.Unknown_demand_write_retention_priority_value_0,
page.DemandReadRetentionPrio).
AppendLine();
page.DemandReadRetentionPrio)
.AppendLine();
break;
}
@@ -220,56 +211,54 @@ public static partial class Modes
sb.AppendLine("\t" + Localization.Read_ahead_is_disabled);
else
{
if(page.MF)
sb.AppendLine("\t" + Localization.Pre_fetch_values_indicate_a_block_multiplier);
if(page.MF) sb.AppendLine("\t" + Localization.Pre_fetch_values_indicate_a_block_multiplier);
if(page.DisablePreFetch == 0)
sb.AppendLine("\t" + Localization.No_pre_fetch_will_be_done);
else
{
sb.AppendFormat("\t" + Localization.Pre_fetch_will_be_done_for_READ_commands_of_0_blocks_or_less,
page.DisablePreFetch).
AppendLine();
page.DisablePreFetch)
.AppendLine();
if(page.MinimumPreFetch > 0)
{
sb.AppendFormat(Localization.At_least_0_blocks_will_be_always_pre_fetched, page.MinimumPreFetch).
AppendLine();
sb.AppendFormat(Localization.At_least_0_blocks_will_be_always_pre_fetched, page.MinimumPreFetch)
.AppendLine();
}
if(page.MaximumPreFetch > 0)
{
sb.AppendFormat("\t" + Localization.A_maximum_of_0_blocks_will_be_pre_fetched,
page.MaximumPreFetch).
AppendLine();
sb.AppendFormat("\t" + Localization.A_maximum_of_0_blocks_will_be_pre_fetched, page.MaximumPreFetch)
.AppendLine();
}
if(page.MaximumPreFetchCeiling > 0)
{
sb.
AppendFormat("\t" + Localization.A_maximum_of_0_blocks_will_be_pre_fetched_even_if_it_is_commanded_to_pre_fetch_more,
page.MaximumPreFetchCeiling).
AppendLine();
sb.AppendFormat("\t" +
Localization
.A_maximum_of_0_blocks_will_be_pre_fetched_even_if_it_is_commanded_to_pre_fetch_more,
page.MaximumPreFetchCeiling)
.AppendLine();
}
if(page.IC)
{
sb.AppendLine("\t" +
Localization.
Device_should_use_number_of_cache_segments_or_cache_segment_size_for_caching);
Localization
.Device_should_use_number_of_cache_segments_or_cache_segment_size_for_caching);
}
if(page.ABPF)
sb.AppendLine("\t" + Localization.Pre_fetch_should_be_aborted_upon_receiving_a_new_command);
if(page.CAP)
sb.AppendLine("\t" + Localization.Caching_analysis_is_permitted);
if(page.CAP) sb.AppendLine("\t" + Localization.Caching_analysis_is_permitted);
if(page.Disc)
{
sb.AppendLine("\t" +
Localization.
Pre_fetch_can_continue_across_discontinuities_such_as_cylinders_or_tracks);
Localization
.Pre_fetch_can_continue_across_discontinuities_such_as_cylinders_or_tracks);
}
}
}
@@ -284,14 +273,14 @@ public static partial class Modes
if(page.LBCSS)
{
sb.AppendFormat("\t" + Localization.Drive_cache_segments_should_be_0_blocks_long,
page.CacheSegmentSize).
AppendLine();
page.CacheSegmentSize)
.AppendLine();
}
else
{
sb.AppendFormat("\t" + Localization.Drive_cache_segments_should_be_0_bytes_long,
page.CacheSegmentSize).
AppendLine();
page.CacheSegmentSize)
.AppendLine();
}
}
}
@@ -299,21 +288,21 @@ public static partial class Modes
{
if(page.CacheSegments > 0)
{
sb.AppendFormat("\t" + Localization.Drive_should_have_0_cache_segments, page.CacheSegments).
AppendLine();
sb.AppendFormat("\t" + Localization.Drive_should_have_0_cache_segments, page.CacheSegments)
.AppendLine();
}
}
if(page.NonCacheSegmentSize > 0)
{
sb.
AppendFormat("\t" + Localization.Drive_shall_allocate_0_bytes_to_buffer_even_when_all_cached_data_cannot_be_evicted,
page.NonCacheSegmentSize).
AppendLine();
sb.AppendFormat("\t" +
Localization
.Drive_shall_allocate_0_bytes_to_buffer_even_when_all_cached_data_cannot_be_evicted,
page.NonCacheSegmentSize)
.AppendLine();
}
if(page.NV_DIS)
sb.AppendLine("\t" + Localization.Non_Volatile_cache_is_disabled);
if(page.NV_DIS) sb.AppendLine("\t" + Localization.Non_Volatile_cache_is_disabled);
return sb.ToString();
}

View File

@@ -113,17 +113,13 @@ public static partial class Modes
public static ModePage_0A? DecodeModePage_0A(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
return null;
if((pageResponse?[0] & 0x40) == 0x40) return null;
if((pageResponse?[0] & 0x3F) != 0x0A)
return null;
if((pageResponse?[0] & 0x3F) != 0x0A) return null;
if(pageResponse[1] + 2 != pageResponse.Length)
return null;
if(pageResponse[1] + 2 != pageResponse.Length) return null;
if(pageResponse.Length < 8)
return null;
if(pageResponse.Length < 8) return null;
var decoded = new ModePage_0A();
@@ -141,8 +137,7 @@ public static partial class Modes
decoded.ReadyAENHoldOffPeriod = (ushort)((pageResponse[6] << 8) + pageResponse[7]);
if(pageResponse.Length < 10)
return decoded;
if(pageResponse.Length < 10) return decoded;
// SPC-1
decoded.GLTSD |= (pageResponse[2] & 0x02) == 0x02;
@@ -179,38 +174,33 @@ public static partial class Modes
public static string PrettifyModePage_0A(ModePage_0A? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
ModePage_0A page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.SCSI_Control_mode_page);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.RLEC)
sb.AppendLine("\t" + Localization.If_set_target_shall_report_log_exception_conditions);
if(page.RLEC) sb.AppendLine("\t" + Localization.If_set_target_shall_report_log_exception_conditions);
if(page.DQue)
sb.AppendLine("\t" + Localization.Tagged_queuing_is_disabled);
if(page.DQue) sb.AppendLine("\t" + Localization.Tagged_queuing_is_disabled);
if(page.EECA)
sb.AppendLine("\t" + Localization.Extended_Contingent_Allegiance_is_enabled);
if(page.EECA) sb.AppendLine("\t" + Localization.Extended_Contingent_Allegiance_is_enabled);
if(page.RAENP)
{
sb.AppendLine("\t" +
Localization.
Target_may_issue_an_asynchronous_event_notification_upon_completing_its_initialization);
Localization
.Target_may_issue_an_asynchronous_event_notification_upon_completing_its_initialization);
}
if(page.UAAENP)
{
sb.AppendLine("\t" +
Localization.
Target_may_issue_an_asynchronous_event_notification_instead_of_a_unit_attention_condition);
Localization
.Target_may_issue_an_asynchronous_event_notification_instead_of_a_unit_attention_condition);
}
if(page.EAENP)
@@ -219,53 +209,45 @@ public static partial class Modes
Localization.Target_may_issue_an_asynchronous_event_notification_instead_of_a_deferred_error);
}
if(page.GLTSD)
sb.AppendLine("\t" + Localization.Global_logging_target_save_disabled);
if(page.GLTSD) sb.AppendLine("\t" + Localization.Global_logging_target_save_disabled);
if(page.RAC)
sb.AppendLine("\t" + Localization.CHECK_CONDITION_should_be_reported_rather_than_a_long_busy_condition);
if(page.SWP)
sb.AppendLine("\t" + Localization.Software_write_protect_is_enabled);
if(page.SWP) sb.AppendLine("\t" + Localization.Software_write_protect_is_enabled);
if(page.TAS)
{
sb.AppendLine("\t" +
Localization.
Tasks_aborted_by_other_initiator_s_actions_should_be_terminated_with_TASK_ABORTED);
Localization
.Tasks_aborted_by_other_initiator_s_actions_should_be_terminated_with_TASK_ABORTED);
}
if(page.TMF_ONLY)
{
sb.AppendLine("\t" +
Localization.
All_tasks_received_in_nexus_with_ACA_ACTIVE_is_set_and_an_ACA_condition_is_established_shall_terminate);
Localization
.All_tasks_received_in_nexus_with_ACA_ACTIVE_is_set_and_an_ACA_condition_is_established_shall_terminate);
}
if(page.D_SENSE)
{
sb.AppendLine("\t" +
Localization.
Device_shall_return_descriptor_format_sense_data_when_returning_sense_data_in_the_same_transactions_as_a_CHECK_CONDITION);
Localization
.Device_shall_return_descriptor_format_sense_data_when_returning_sense_data_in_the_same_transactions_as_a_CHECK_CONDITION);
}
if(page.ATO)
sb.AppendLine("\t" + Localization.LOGICAL_BLOCK_APPLICATION_TAG_should_not_be_modified);
if(page.ATO) sb.AppendLine("\t" + Localization.LOGICAL_BLOCK_APPLICATION_TAG_should_not_be_modified);
if(page.DPICZ)
sb.AppendLine("\t" + Localization.Protector_information_checking_is_disabled);
if(page.DPICZ) sb.AppendLine("\t" + Localization.Protector_information_checking_is_disabled);
if(page.NUAR)
sb.AppendLine("\t" + Localization.No_unit_attention_on_release);
if(page.NUAR) sb.AppendLine("\t" + Localization.No_unit_attention_on_release);
if(page.ATMPE)
sb.AppendLine("\t" + Localization.Application_Tag_mode_page_is_enabled);
if(page.ATMPE) sb.AppendLine("\t" + Localization.Application_Tag_mode_page_is_enabled);
if(page.RWWP)
sb.AppendLine("\t" + Localization.Abort_any_write_command_without_protection_information);
if(page.RWWP) sb.AppendLine("\t" + Localization.Abort_any_write_command_without_protection_information);
if(page.SBLP)
sb.AppendLine("\t" + Localization.Supports_block_lengths_and_protection_information);
if(page.SBLP) sb.AppendLine("\t" + Localization.Supports_block_lengths_and_protection_information);
switch(page.TST)
{
@@ -294,8 +276,8 @@ public static partial class Modes
break;
default:
sb.AppendFormat("\t" + Localization.Unknown_Queue_Algorithm_Modifier_0, page.QueueAlgorithm).
AppendLine();
sb.AppendFormat("\t" + Localization.Unknown_Queue_Algorithm_Modifier_0, page.QueueAlgorithm)
.AppendLine();
break;
}
@@ -304,20 +286,20 @@ public static partial class Modes
{
case 0:
sb.AppendLine("\t" +
Localization.
If_ACA_is_established_the_task_set_commands_shall_resume_after_it_is_cleared_otherwise_they_shall_terminate_with_CHECK_CONDITION);
Localization
.If_ACA_is_established_the_task_set_commands_shall_resume_after_it_is_cleared_otherwise_they_shall_terminate_with_CHECK_CONDITION);
break;
case 1:
sb.AppendLine("\t" +
Localization.
All_the_affected_commands_in_the_task_set_shall_be_aborted_when_CHECK_CONDITION_is_returned);
Localization
.All_the_affected_commands_in_the_task_set_shall_be_aborted_when_CHECK_CONDITION_is_returned);
break;
case 3:
sb.AppendLine("\t" +
Localization.
Affected_commands_in_the_task_set_belonging_with_the_CHECK_CONDITION_nexus_shall_be_aborted);
Localization
.Affected_commands_in_the_task_set_belonging_with_the_CHECK_CONDITION_nexus_shall_be_aborted);
break;
default:
@@ -339,8 +321,8 @@ public static partial class Modes
break;
case 3:
sb.AppendLine("\t" +
Localization.
LUN_shall_not_clear_unit_attention_condition_reported_in_the_same_nexus_and_shall_establish_a_unit_attention_condition_for_the_initiator);
Localization
.LUN_shall_not_clear_unit_attention_condition_reported_in_the_same_nexus_and_shall_establish_a_unit_attention_condition_for_the_initiator);
break;
default:
@@ -372,10 +354,10 @@ public static partial class Modes
if(page.ReadyAENHoldOffPeriod > 0)
{
sb.
AppendFormat("\t" + Localization._0_ms_before_attempting_asynchronous_event_notifications_after_initialization,
page.ReadyAENHoldOffPeriod).
AppendLine();
sb.AppendFormat("\t" +
Localization._0_ms_before_attempting_asynchronous_event_notifications_after_initialization,
page.ReadyAENHoldOffPeriod)
.AppendLine();
}
if(page.BusyTimeoutPeriod > 0)
@@ -385,8 +367,8 @@ public static partial class Modes
else
{
sb.AppendFormat("\t" + Localization.A_maximum_of_0_ms_are_allowed_to_remain_busy,
page.BusyTimeoutPeriod * 100).
AppendLine();
page.BusyTimeoutPeriod * 100)
.AppendLine();
}
}
@@ -425,20 +407,15 @@ public static partial class Modes
public static ModePage_0A_S01? DecodeModePage_0A_S01(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) != 0x40)
return null;
if((pageResponse?[0] & 0x40) != 0x40) return null;
if((pageResponse[0] & 0x3F) != 0x0A)
return null;
if((pageResponse[0] & 0x3F) != 0x0A) return null;
if(pageResponse[1] != 0x01)
return null;
if(pageResponse[1] != 0x01) return null;
if((pageResponse[2] << 8) + pageResponse[3] + 4 != pageResponse.Length)
return null;
if((pageResponse[2] << 8) + pageResponse[3] + 4 != pageResponse.Length) return null;
if(pageResponse.Length < 32)
return null;
if(pageResponse.Length < 32) return null;
var decoded = new ModePage_0A_S01();
@@ -458,24 +435,22 @@ public static partial class Modes
public static string PrettifyModePage_0A_S01(ModePage_0A_S01? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
ModePage_0A_S01 page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.SCSI_Control_extension_page);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.TCMOS)
{
if(page.SCSIP)
{
sb.AppendLine("\t" +
Localization.
S01_Timestamp_can_be_initialized_by_methods_outside_of_the_SCSI_standards_but_SCSI_SET_TIMESTAMP_shall_take_precedence_over_them);
Localization
.S01_Timestamp_can_be_initialized_by_methods_outside_of_the_SCSI_standards_but_SCSI_SET_TIMESTAMP_shall_take_precedence_over_them);
}
else
{
@@ -484,18 +459,16 @@ public static partial class Modes
}
}
if(page.IALUAE)
sb.AppendLine("\t" + Localization.Implicit_Asymmetric_Logical_Unit_Access_is_enabled);
if(page.IALUAE) sb.AppendLine("\t" + Localization.Implicit_Asymmetric_Logical_Unit_Access_is_enabled);
sb.AppendFormat("\t" + Localization.Initial_priority_is_0, page.InitialPriority).AppendLine();
if(page.DLC)
sb.AppendLine("\t" + Localization.Device_will_not_degrade_performance_to_extend_its_life);
if(page.DLC) sb.AppendLine("\t" + Localization.Device_will_not_degrade_performance_to_extend_its_life);
if(page.MaximumSenseLength > 0)
{
sb.AppendFormat("\t" + Localization.Maximum_sense_data_would_be_0_bytes, page.MaximumSenseLength).
AppendLine();
sb.AppendFormat("\t" + Localization.Maximum_sense_data_would_be_0_bytes, page.MaximumSenseLength)
.AppendLine();
}
return sb.ToString();

View File

@@ -55,17 +55,13 @@ public static partial class Modes
public static ModePage_0B? DecodeModePage_0B(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
return null;
if((pageResponse?[0] & 0x40) == 0x40) return null;
if((pageResponse?[0] & 0x3F) != 0x0B)
return null;
if((pageResponse?[0] & 0x3F) != 0x0B) return null;
if(pageResponse[1] + 2 != pageResponse.Length)
return null;
if(pageResponse[1] + 2 != pageResponse.Length) return null;
if(pageResponse.Length < 8)
return null;
if(pageResponse.Length < 8) return null;
var decoded = new ModePage_0B();
@@ -83,39 +79,37 @@ public static partial class Modes
public static string PrettifyModePage_0B(ModePage_0B? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
ModePage_0B page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.SCSI_Medium_types_supported_page);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.MediumType1 != MediumTypes.Default)
{
sb.AppendFormat(Localization.Supported_medium_type_one_0, GetMediumTypeDescription(page.MediumType1)).
AppendLine();
sb.AppendFormat(Localization.Supported_medium_type_one_0, GetMediumTypeDescription(page.MediumType1))
.AppendLine();
}
if(page.MediumType2 != MediumTypes.Default)
{
sb.AppendFormat(Localization.Supported_medium_type_two_0, GetMediumTypeDescription(page.MediumType2)).
AppendLine();
sb.AppendFormat(Localization.Supported_medium_type_two_0, GetMediumTypeDescription(page.MediumType2))
.AppendLine();
}
if(page.MediumType3 != MediumTypes.Default)
{
sb.AppendFormat(Localization.Supported_medium_type_three_0, GetMediumTypeDescription(page.MediumType3)).
AppendLine();
sb.AppendFormat(Localization.Supported_medium_type_three_0, GetMediumTypeDescription(page.MediumType3))
.AppendLine();
}
if(page.MediumType4 != MediumTypes.Default)
{
sb.AppendFormat(Localization.Supported_medium_type_four_0, GetMediumTypeDescription(page.MediumType4)).
AppendLine();
sb.AppendFormat(Localization.Supported_medium_type_four_0, GetMediumTypeDescription(page.MediumType4))
.AppendLine();
}
return sb.ToString();

View File

@@ -57,17 +57,13 @@ public static partial class Modes
public static ModePage_0D? DecodeModePage_0D(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
return null;
if((pageResponse?[0] & 0x40) == 0x40) return null;
if((pageResponse?[0] & 0x3F) != 0x0D)
return null;
if((pageResponse?[0] & 0x3F) != 0x0D) return null;
if(pageResponse[1] + 2 != pageResponse.Length)
return null;
if(pageResponse[1] + 2 != pageResponse.Length) return null;
if(pageResponse.Length < 8)
return null;
if(pageResponse.Length < 8) return null;
var decoded = new ModePage_0D();
@@ -84,23 +80,21 @@ public static partial class Modes
public static string PrettifyModePage_0D(ModePage_0D? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
ModePage_0D page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.SCSI_CD_ROM_parameters_page);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
switch(page.InactivityTimerMultiplier)
{
case 0:
sb.AppendLine("\t" +
Localization.
Drive_will_remain_in_track_hold_state_a_vendor_specified_time_after_a_seek_or_read);
Localization
.Drive_will_remain_in_track_hold_state_a_vendor_specified_time_after_a_seek_or_read);
break;
case 1:

View File

@@ -77,17 +77,13 @@ public static partial class Modes
public static ModePage_0E? DecodeModePage_0E(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
return null;
if((pageResponse?[0] & 0x40) == 0x40) return null;
if((pageResponse?[0] & 0x3F) != 0x0E)
return null;
if((pageResponse?[0] & 0x3F) != 0x0E) return null;
if(pageResponse[1] + 2 != pageResponse.Length)
return null;
if(pageResponse[1] + 2 != pageResponse.Length) return null;
if(pageResponse.Length < 16)
return null;
if(pageResponse.Length < 16) return null;
var decoded = new ModePage_0E();
@@ -114,23 +110,20 @@ public static partial class Modes
public static string PrettifyModePage_0E(ModePage_0E? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
ModePage_0E page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.SCSI_CD_ROM_audio_control_parameters_page);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
sb.AppendLine(page.Immed
? "\t" + Localization.Drive_will_return_from_playback_command_immediately
: "\t" + Localization.Drive_will_return_from_playback_command_when_playback_ends);
if(page.SOTC)
sb.AppendLine("\t" + Localization.Drive_will_stop_playback_on_track_end);
if(page.SOTC) sb.AppendLine("\t" + Localization.Drive_will_stop_playback_on_track_end);
if(page.APRVal)
{
@@ -148,17 +141,13 @@ public static partial class Modes
{
sb.Append("\t" + Localization.Output_port_0_has_channels);
if((page.OutputPort0ChannelSelection & 0x01) == 0x01)
sb.Append("0 ");
if((page.OutputPort0ChannelSelection & 0x01) == 0x01) sb.Append("0 ");
if((page.OutputPort0ChannelSelection & 0x02) == 0x02)
sb.Append("1 ");
if((page.OutputPort0ChannelSelection & 0x02) == 0x02) sb.Append("1 ");
if((page.OutputPort0ChannelSelection & 0x04) == 0x04)
sb.Append("2 ");
if((page.OutputPort0ChannelSelection & 0x04) == 0x04) sb.Append("2 ");
if((page.OutputPort0ChannelSelection & 0x08) == 0x08)
sb.Append("3 ");
if((page.OutputPort0ChannelSelection & 0x08) == 0x08) sb.Append("3 ");
switch(page.OutputPort0Volume)
{
@@ -181,17 +170,13 @@ public static partial class Modes
{
sb.Append("\t" + Localization.Output_port_1_has_channels);
if((page.OutputPort1ChannelSelection & 0x01) == 0x01)
sb.Append("0 ");
if((page.OutputPort1ChannelSelection & 0x01) == 0x01) sb.Append("0 ");
if((page.OutputPort1ChannelSelection & 0x02) == 0x02)
sb.Append("1 ");
if((page.OutputPort1ChannelSelection & 0x02) == 0x02) sb.Append("1 ");
if((page.OutputPort1ChannelSelection & 0x04) == 0x04)
sb.Append("2 ");
if((page.OutputPort1ChannelSelection & 0x04) == 0x04) sb.Append("2 ");
if((page.OutputPort1ChannelSelection & 0x08) == 0x08)
sb.Append("3 ");
if((page.OutputPort1ChannelSelection & 0x08) == 0x08) sb.Append("3 ");
switch(page.OutputPort1Volume)
{
@@ -214,17 +199,13 @@ public static partial class Modes
{
sb.Append("\t" + Localization.Output_port_2_has_channels);
if((page.OutputPort2ChannelSelection & 0x01) == 0x01)
sb.Append("0 ");
if((page.OutputPort2ChannelSelection & 0x01) == 0x01) sb.Append("0 ");
if((page.OutputPort2ChannelSelection & 0x02) == 0x02)
sb.Append("1 ");
if((page.OutputPort2ChannelSelection & 0x02) == 0x02) sb.Append("1 ");
if((page.OutputPort2ChannelSelection & 0x04) == 0x04)
sb.Append("2 ");
if((page.OutputPort2ChannelSelection & 0x04) == 0x04) sb.Append("2 ");
if((page.OutputPort2ChannelSelection & 0x08) == 0x08)
sb.Append("3 ");
if((page.OutputPort2ChannelSelection & 0x08) == 0x08) sb.Append("3 ");
switch(page.OutputPort2Volume)
{
@@ -243,22 +224,17 @@ public static partial class Modes
}
}
if(page.OutputPort3ChannelSelection <= 0)
return sb.ToString();
if(page.OutputPort3ChannelSelection <= 0) return sb.ToString();
sb.Append("\t" + Localization.Output_port_3_has_channels);
if((page.OutputPort3ChannelSelection & 0x01) == 0x01)
sb.Append("0 ");
if((page.OutputPort3ChannelSelection & 0x01) == 0x01) sb.Append("0 ");
if((page.OutputPort3ChannelSelection & 0x02) == 0x02)
sb.Append("1 ");
if((page.OutputPort3ChannelSelection & 0x02) == 0x02) sb.Append("1 ");
if((page.OutputPort3ChannelSelection & 0x04) == 0x04)
sb.Append("2 ");
if((page.OutputPort3ChannelSelection & 0x04) == 0x04) sb.Append("2 ");
if((page.OutputPort3ChannelSelection & 0x08) == 0x08)
sb.Append("3 ");
if((page.OutputPort3ChannelSelection & 0x08) == 0x08) sb.Append("3 ");
switch(page.OutputPort3Volume)
{

View File

@@ -63,17 +63,13 @@ public static partial class Modes
public static ModePage_0F? DecodeModePage_0F(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
return null;
if((pageResponse?[0] & 0x40) == 0x40) return null;
if((pageResponse?[0] & 0x3F) != 0x0F)
return null;
if((pageResponse?[0] & 0x3F) != 0x0F) return null;
if(pageResponse[1] + 2 != pageResponse.Length)
return null;
if(pageResponse[1] + 2 != pageResponse.Length) return null;
if(pageResponse.Length < 16)
return null;
if(pageResponse.Length < 16) return null;
var decoded = new ModePage_0F();
@@ -100,16 +96,14 @@ public static partial class Modes
public static string PrettifyModePage_0F(ModePage_0F? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
ModePage_0F page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.SCSI_Data_compression_page);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.DCC)
{
@@ -189,8 +183,8 @@ public static partial class Modes
break;
default:
sb.AppendFormat(Localization.an_unknown_algorithm_coded_0, page.CompressionAlgo).
AppendLine();
sb.AppendFormat(Localization.an_unknown_algorithm_coded_0, page.CompressionAlgo)
.AppendLine();
break;
}

View File

@@ -61,17 +61,13 @@ public static partial class Modes
public static ModePage_10? DecodeModePage_10(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
return null;
if((pageResponse?[0] & 0x40) == 0x40) return null;
if((pageResponse?[0] & 0x3F) != 0x10)
return null;
if((pageResponse?[0] & 0x3F) != 0x10) return null;
if(pageResponse[1] + 2 != pageResponse.Length)
return null;
if(pageResponse[1] + 2 != pageResponse.Length) return null;
if(pageResponse.Length < 24)
return null;
if(pageResponse.Length < 24) return null;
var decoded = new ModePage_10();
@@ -102,16 +98,14 @@ public static partial class Modes
public static string PrettifyModePage_10(ModePage_10? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
ModePage_10 page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.SCSI_XOR_control_mode_page);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.XORDIS)
sb.AppendLine("\t" + Localization.XOR_operations_are_disabled);
@@ -120,30 +114,30 @@ public static partial class Modes
if(page.MaxXorWrite > 0)
{
sb.AppendFormat("\t" + Localization.Drive_accepts_a_maximum_of_0_blocks_in_a_single_XOR_WRITE_command,
page.MaxXorWrite).
AppendLine();
page.MaxXorWrite)
.AppendLine();
}
if(page.MaxRegenSize > 0)
{
sb.AppendFormat("\t" + Localization.Drive_accepts_a_maximum_of_0_blocks_in_a_REGENERATE_command,
page.MaxRegenSize).
AppendLine();
page.MaxRegenSize)
.AppendLine();
}
if(page.MaxRebuildRead > 0)
{
sb.
AppendFormat("\t" + Localization.Drive_accepts_a_maximum_of_0_blocks_in_a_READ_command_during_rebuild,
page.MaxRebuildRead).
AppendLine();
sb.AppendFormat("\t" +
Localization.Drive_accepts_a_maximum_of_0_blocks_in_a_READ_command_during_rebuild,
page.MaxRebuildRead)
.AppendLine();
}
if(page.RebuildDelay > 0)
{
sb.AppendFormat("\t" + Localization.Drive_needs_a_minimum_of_0_ms_between_READ_commands_during_rebuild,
page.RebuildDelay).
AppendLine();
page.RebuildDelay)
.AppendLine();
}
}

View File

@@ -110,17 +110,13 @@ public static partial class Modes
public static ModePage_10_SSC? DecodeModePage_10_SSC(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
return null;
if((pageResponse?[0] & 0x40) == 0x40) return null;
if((pageResponse?[0] & 0x3F) != 0x10)
return null;
if((pageResponse?[0] & 0x3F) != 0x10) return null;
if(pageResponse[1] + 2 != pageResponse.Length)
return null;
if(pageResponse[1] + 2 != pageResponse.Length) return null;
if(pageResponse.Length < 16)
return null;
if(pageResponse.Length < 16) return null;
var decoded = new ModePage_10_SSC();
@@ -167,33 +163,32 @@ public static partial class Modes
public static string PrettifyModePage_10_SSC(ModePage_10_SSC? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
ModePage_10_SSC page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.SCSI_Device_configuration_page);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
sb.AppendFormat("\t" + Localization.Active_format_0, page.ActiveFormat).AppendLine();
sb.AppendFormat("\t" + Localization.Active_partition_0, page.ActivePartition).AppendLine();
sb.AppendFormat("\t" + Localization.Write_buffer_shall_have_a_full_ratio_of_0_before_being_flushed_to_medium,
page.WriteBufferFullRatio).
AppendLine();
page.WriteBufferFullRatio)
.AppendLine();
sb.
AppendFormat("\t" + Localization.Read_buffer_shall_have_an_empty_ratio_of_0_before_more_data_is_read_from_medium,
page.ReadBufferEmptyRatio).
AppendLine();
sb.AppendFormat("\t" +
Localization.Read_buffer_shall_have_an_empty_ratio_of_0_before_more_data_is_read_from_medium,
page.ReadBufferEmptyRatio)
.AppendLine();
sb.
AppendFormat("\t" + Localization.Drive_will_delay_0_ms_before_buffered_data_is_forcefully_written_to_the_medium_even_before_buffer_is_full,
page.WriteDelayTime * 100).
AppendLine();
sb.AppendFormat("\t" +
Localization
.Drive_will_delay_0_ms_before_buffered_data_is_forcefully_written_to_the_medium_even_before_buffer_is_full,
page.WriteDelayTime * 100)
.AppendLine();
if(page.DBR)
{
@@ -204,11 +199,9 @@ public static partial class Modes
: "\t" + Localization.Recovered_buffer_data_comes_in_FIFO_order);
}
if(page.BIS)
sb.AppendLine("\t" + Localization.Medium_supports_block_IDs);
if(page.BIS) sb.AppendLine("\t" + Localization.Medium_supports_block_IDs);
if(page.RSmk)
sb.AppendLine("\t" + Localization.Drive_reports_setmarks);
if(page.RSmk) sb.AppendLine("\t" + Localization.Drive_reports_setmarks);
switch(page.SOCF)
{
@@ -234,8 +227,7 @@ public static partial class Modes
{
sb.AppendLine("\t" + Localization.Drive_reports_early_warnings);
if(page.SEW)
sb.AppendLine("\t" + Localization.Drive_will_synchronize_buffer_to_medium_on_early_warnings);
if(page.SEW) sb.AppendLine("\t" + Localization.Drive_will_synchronize_buffer_to_medium_on_early_warnings);
}
switch(page.GapSize)
@@ -261,8 +253,8 @@ public static partial class Modes
case 14:
case 15:
sb.AppendFormat("\t" + Localization.Inter_block_gap_is_0_times_the_device_defined_gap_size,
page.GapSize).
AppendLine();
page.GapSize)
.AppendLine();
break;
default:
@@ -271,8 +263,7 @@ public static partial class Modes
break;
}
if(page.EEG)
sb.AppendLine("\t" + Localization.Drive_generates_end_of_data);
if(page.EEG) sb.AppendLine("\t" + Localization.Drive_generates_end_of_data);
switch(page.SelectedCompression)
{
@@ -285,23 +276,19 @@ public static partial class Modes
break;
default:
sb.AppendFormat("\t" + Localization.Drive_uses_unknown_compression_0, page.SelectedCompression).
AppendLine();
sb.AppendFormat("\t" + Localization.Drive_uses_unknown_compression_0, page.SelectedCompression)
.AppendLine();
break;
}
if(page.SWP)
sb.AppendLine("\t" + Localization.Software_write_protect_is_enabled);
if(page.SWP) sb.AppendLine("\t" + Localization.Software_write_protect_is_enabled);
if(page.ASOCWP)
sb.AppendLine("\t" + Localization.Associated_write_protect_is_enabled);
if(page.ASOCWP) sb.AppendLine("\t" + Localization.Associated_write_protect_is_enabled);
if(page.PERSWP)
sb.AppendLine("\t" + Localization.Persistent_write_protect_is_enabled);
if(page.PERSWP) sb.AppendLine("\t" + Localization.Persistent_write_protect_is_enabled);
if(page.PRMWP)
sb.AppendLine("\t" + Localization.Permanent_write_protect_is_enabled);
if(page.PRMWP) sb.AppendLine("\t" + Localization.Permanent_write_protect_is_enabled);
if(page.BAML)
{

View File

@@ -96,17 +96,13 @@ public static partial class Modes
public static ModePage_11? DecodeModePage_11(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
return null;
if((pageResponse?[0] & 0x40) == 0x40) return null;
if((pageResponse?[0] & 0x3F) != 0x11)
return null;
if((pageResponse?[0] & 0x3F) != 0x11) return null;
if(pageResponse[1] + 2 != pageResponse.Length)
return null;
if(pageResponse[1] + 2 != pageResponse.Length) return null;
if(pageResponse.Length < 8)
return null;
if(pageResponse.Length < 8) return null;
var decoded = new ModePage_11();
@@ -139,25 +135,22 @@ public static partial class Modes
public static string PrettifyModePage_11(ModePage_11? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
ModePage_11 page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.SCSI_medium_partition_page);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
sb.AppendFormat("\t" + Localization._0_maximum_additional_partitions, page.MaxAdditionalPartitions).
AppendLine();
sb.AppendFormat("\t" + Localization._0_maximum_additional_partitions, page.MaxAdditionalPartitions)
.AppendLine();
sb.AppendFormat("\t" + Localization._0_additional_partitions_defined, page.AdditionalPartitionsDefined).
AppendLine();
sb.AppendFormat("\t" + Localization._0_additional_partitions_defined, page.AdditionalPartitionsDefined)
.AppendLine();
if(page.FDP)
sb.AppendLine("\t" + Localization.Partitions_are_fixed_under_device_definitions);
if(page.FDP) sb.AppendLine("\t" + Localization.Partitions_are_fixed_under_device_definitions);
if(page.SDP)
{
@@ -165,14 +158,13 @@ public static partial class Modes
Localization.Number_of_partitions_can_be_defined_but_their_size_is_defined_by_the_device);
}
if(page.IDP)
sb.AppendLine("\t" + Localization.Number_and_size_of_partitions_can_be_manually_defined);
if(page.IDP) sb.AppendLine("\t" + Localization.Number_and_size_of_partitions_can_be_manually_defined);
if(page.POFM)
{
sb.AppendLine("\t" +
Localization.
Partition_parameters_will_not_be_applied_until_a_FORMAT_MEDIUM_command_is_received);
Localization
.Partition_parameters_will_not_be_applied_until_a_FORMAT_MEDIUM_command_is_received);
}
switch(page.CLEAR)
@@ -192,8 +184,8 @@ public static partial class Modes
break;
default:
sb.AppendLine("\t" +
Localization.
Device_shall_erase_all_partitions_differing_on_size_on_MODE_SELECT_for_partitioning);
Localization
.Device_shall_erase_all_partitions_differing_on_size_on_MODE_SELECT_for_partitioning);
break;
}
@@ -219,8 +211,8 @@ public static partial class Modes
break;
case PartitionSizeUnitOfMeasures.Exponential:
sb.AppendFormat("\t" + Localization.Partitions_are_defined_in_units_of_0_bytes,
Math.Pow(10, page.PartitionUnits)).
AppendLine();
Math.Pow(10, page.PartitionUnits))
.AppendLine();
measure = string.Format(Localization.units_of_0_bytes, Math.Pow(10, page.PartitionUnits));
@@ -253,8 +245,8 @@ public static partial class Modes
break;
default:
sb.AppendFormat("\t" + Localization.Unknown_medium_recognition_code_0,
(byte)page.MediumFormatRecognition).
AppendLine();
(byte)page.MediumFormatRecognition)
.AppendLine();
break;
}
@@ -272,8 +264,8 @@ public static partial class Modes
}
else
{
sb.AppendFormat("\t" + Localization.Partition_0_is_1_2_long, i, page.PartitionSizes[i], measure).
AppendLine();
sb.AppendFormat("\t" + Localization.Partition_0_is_1_2_long, i, page.PartitionSizes[i], measure)
.AppendLine();
}
}

View File

@@ -53,20 +53,16 @@ public static partial class Modes
public static ModePage_12_13_14? DecodeModePage_12_13_14(byte[] pageResponse)
{
if(pageResponse == null)
return null;
if(pageResponse == null) return null;
if((pageResponse[0] & 0x40) == 0x40)
return null;
if((pageResponse[0] & 0x40) == 0x40) return null;
if((pageResponse[0] & 0x3F) != 0x12 && (pageResponse[0] & 0x3F) != 0x13 && (pageResponse[0] & 0x3F) != 0x14)
return null;
if(pageResponse[1] + 2 != pageResponse.Length)
return null;
if(pageResponse[1] + 2 != pageResponse.Length) return null;
if(pageResponse.Length < 2)
return null;
if(pageResponse.Length < 2) return null;
var decoded = new ModePage_12_13_14();
@@ -88,16 +84,14 @@ public static partial class Modes
public static string PrettifyModePage_12_13_14(ModePage_12_13_14? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
ModePage_12_13_14 page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.SCSI_medium_partition_page_extra);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
sb.AppendFormat("\t" + Localization.Medium_has_defined_0_partitions, page.PartitionSizes.Length).AppendLine();

View File

@@ -77,17 +77,13 @@ public static partial class Modes
public static ModePage_1A? DecodeModePage_1A(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
return null;
if((pageResponse?[0] & 0x40) == 0x40) return null;
if((pageResponse?[0] & 0x3F) != 0x1A)
return null;
if((pageResponse?[0] & 0x3F) != 0x1A) return null;
if(pageResponse[1] + 2 != pageResponse.Length)
return null;
if(pageResponse[1] + 2 != pageResponse.Length) return null;
if(pageResponse.Length < 12)
return null;
if(pageResponse.Length < 12) return null;
var decoded = new ModePage_1A();
@@ -106,8 +102,7 @@ public static partial class Modes
(pageResponse[10] << 8) +
pageResponse[11]);
if(pageResponse.Length < 40)
return decoded;
if(pageResponse.Length < 40) return decoded;
decoded.PM_BG_Precedence = (byte)((pageResponse[2] & 0xC0) >> 6);
decoded.Standby_Y |= (pageResponse[2] & 0x01) == 0x01;
@@ -141,16 +136,14 @@ public static partial class Modes
public static string PrettifyModePage_1A(ModePage_1A? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
ModePage_1A page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine("SCSI Power condition page:");
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page is { Standby: true, StandbyTimer: > 0 } or { Standby_Y: true, StandbyTimer_Y: > 0 })
{
@@ -163,7 +156,9 @@ public static partial class Modes
else
sb.AppendLine("\t" + "Drive will not enter standby mode");
if(page is { Idle: true, IdleTimer: > 0 } or { Idle_B: true, IdleTimer_B: > 0 } or { Idle_C: true, IdleTimer_C: > 0 })
if(page is { Idle : true, IdleTimer : > 0 }
or { Idle_B: true, IdleTimer_B: > 0 }
or { Idle_C: true, IdleTimer_C: > 0 })
{
if(page is { Idle: true, IdleTimer: > 0 })
sb.AppendFormat("\t" + "Idle timer A is set to {0} ms", page.IdleTimer * 100).AppendLine();
@@ -213,20 +208,15 @@ public static partial class Modes
public static ModePage_1A_S01? DecodeModePage_1A_S01(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) != 0x40)
return null;
if((pageResponse?[0] & 0x40) != 0x40) return null;
if((pageResponse[0] & 0x3F) != 0x1A)
return null;
if((pageResponse[0] & 0x3F) != 0x1A) return null;
if(pageResponse[1] != 0x01)
return null;
if(pageResponse[1] != 0x01) return null;
if((pageResponse[2] << 8) + pageResponse[3] + 4 != pageResponse.Length)
return null;
if((pageResponse[2] << 8) + pageResponse[3] + 4 != pageResponse.Length) return null;
if(pageResponse.Length < 16)
return null;
if(pageResponse.Length < 16) return null;
var decoded = new ModePage_1A_S01();
@@ -242,24 +232,23 @@ public static partial class Modes
public static string PrettifyModePage_1A_S01(ModePage_1A_S01? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
ModePage_1A_S01 page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.SCSI_Power_Consumption_page);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
switch(page.ActiveLevel)
{
case 0:
sb.
AppendFormat("\t" + Localization.Device_power_consumption_is_dictated_by_identifier_0_of_Power_Consumption_VPD,
page.PowerConsumptionIdentifier).
AppendLine();
sb.AppendFormat("\t" +
Localization
.Device_power_consumption_is_dictated_by_identifier_0_of_Power_Consumption_VPD,
page.PowerConsumptionIdentifier)
.AppendLine();
break;
case 1:

View File

@@ -61,17 +61,13 @@ public static partial class Modes
public static ModePage_1B? DecodeModePage_1B(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
return null;
if((pageResponse?[0] & 0x40) == 0x40) return null;
if((pageResponse?[0] & 0x3F) != 0x1B)
return null;
if((pageResponse?[0] & 0x3F) != 0x1B) return null;
if(pageResponse[1] + 2 != pageResponse.Length)
return null;
if(pageResponse[1] + 2 != pageResponse.Length) return null;
if(pageResponse.Length < 12)
return null;
if(pageResponse.Length < 12) return null;
var decoded = new ModePage_1B();
@@ -91,31 +87,24 @@ public static partial class Modes
public static string PrettifyModePage_1B(ModePage_1B? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
ModePage_1B page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.SCSI_Removable_Block_Access_Capabilities_page);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.SFLP)
sb.AppendLine("\t" + Localization.Drive_can_be_used_as_a_system_floppy_device);
if(page.SFLP) sb.AppendLine("\t" + Localization.Drive_can_be_used_as_a_system_floppy_device);
if(page.SRFP)
sb.AppendLine("\t" + Localization.Drive_supports_reporting_progress_of_format);
if(page.SRFP) sb.AppendLine("\t" + Localization.Drive_supports_reporting_progress_of_format);
if(page.NCD)
sb.AppendLine("\t" + Localization.Drive_is_a_Non_CD_Optical_Device);
if(page.NCD) sb.AppendLine("\t" + Localization.Drive_is_a_Non_CD_Optical_Device);
if(page.SML)
sb.AppendLine("\t" + Localization.Device_is_a_dual_device_supporting_CD_and_Non_CD_Optical);
if(page.SML) sb.AppendLine("\t" + Localization.Device_is_a_dual_device_supporting_CD_and_Non_CD_Optical);
if(page.TLUN > 0)
sb.AppendFormat("\t" + Localization.Drive_supports_0_LUNs, page.TLUN).AppendLine();
if(page.TLUN > 0) sb.AppendFormat("\t" + Localization.Drive_supports_0_LUNs, page.TLUN).AppendLine();
return sb.ToString();
}

View File

@@ -73,17 +73,13 @@ public static partial class Modes
public static ModePage_1C? DecodeModePage_1C(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
return null;
if((pageResponse?[0] & 0x40) == 0x40) return null;
if((pageResponse?[0] & 0x3F) != 0x1C)
return null;
if((pageResponse?[0] & 0x3F) != 0x1C) return null;
if(pageResponse[1] + 2 != pageResponse.Length)
return null;
if(pageResponse[1] + 2 != pageResponse.Length) return null;
if(pageResponse.Length < 8)
return null;
if(pageResponse.Length < 8) return null;
var decoded = new ModePage_1C();
@@ -120,16 +116,14 @@ public static partial class Modes
public static string PrettifyModePage_1C(ModePage_1C? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
ModePage_1C page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.SCSI_Informational_exceptions_control_page);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.DExcpt)
sb.AppendLine("\t" + Localization.Informational_exceptions_are_disabled);
@@ -181,11 +175,9 @@ public static partial class Modes
Localization.Informational_exceptions_reporting_should_not_affect_drive_performance);
}
if(page.Test)
sb.AppendLine("\t" + Localization.A_test_informational_exception_will_raise_on_next_timer);
if(page.Test) sb.AppendLine("\t" + Localization.A_test_informational_exception_will_raise_on_next_timer);
if(page.LogErr)
sb.AppendLine("\t" + Localization.Drive_shall_log_informational_exception_conditions);
if(page.LogErr) sb.AppendLine("\t" + Localization.Drive_shall_log_informational_exception_conditions);
if(page.IntervalTimer > 0)
{
@@ -197,19 +189,17 @@ public static partial class Modes
if(page.ReportCount > 0)
{
sb.AppendFormat("\t" + Localization.Informational_exception_conditions_will_be_reported_a_maximum_of_0_times,
sb.AppendFormat("\t" +
Localization.Informational_exception_conditions_will_be_reported_a_maximum_of_0_times,
page.ReportCount);
}
}
if(page.EWasc)
sb.AppendLine("\t" + Localization.Warning_reporting_is_enabled);
if(page.EWasc) sb.AppendLine("\t" + Localization.Warning_reporting_is_enabled);
if(page.EBF)
sb.AppendLine("\t" + Localization.Background_functions_are_enabled);
if(page.EBF) sb.AppendLine("\t" + Localization.Background_functions_are_enabled);
if(page.EBACKERR)
sb.AppendLine("\t" + Localization.Drive_will_report_background_self_test_errors);
if(page.EBACKERR) sb.AppendLine("\t" + Localization.Drive_will_report_background_self_test_errors);
return sb.ToString();
}
@@ -243,20 +233,15 @@ public static partial class Modes
public static ModePage_1C_S01? DecodeModePage_1C_S01(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) != 0x40)
return null;
if((pageResponse?[0] & 0x40) != 0x40) return null;
if((pageResponse[0] & 0x3F) != 0x1C)
return null;
if((pageResponse[0] & 0x3F) != 0x1C) return null;
if(pageResponse[1] != 0x01)
return null;
if(pageResponse[1] != 0x01) return null;
if((pageResponse[2] << 8) + pageResponse[3] + 4 != pageResponse.Length)
return null;
if((pageResponse[2] << 8) + pageResponse[3] + 4 != pageResponse.Length) return null;
if(pageResponse.Length < 16)
return null;
if(pageResponse.Length < 16) return null;
var decoded = new ModePage_1C_S01();
@@ -280,58 +265,56 @@ public static partial class Modes
public static string PrettifyModePage_1C_S01(ModePage_1C_S01? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
ModePage_1C_S01 page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.SCSI_Background_Control_page);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.S_L_Full)
sb.AppendLine("\t" + Localization.Background_scans_will_be_halted_if_log_is_full);
if(page.S_L_Full) sb.AppendLine("\t" + Localization.Background_scans_will_be_halted_if_log_is_full);
if(page.LOWIR)
sb.AppendLine("\t" + Localization.Background_scans_will_only_be_logged_if_they_require_intervention);
if(page.En_Bms)
sb.AppendLine("\t" + Localization.Background_medium_scans_are_enabled);
if(page.En_Bms) sb.AppendLine("\t" + Localization.Background_medium_scans_are_enabled);
if(page.En_Ps)
sb.AppendLine("\t" + Localization.Background_pre_scans_are_enabled);
if(page.En_Ps) sb.AppendLine("\t" + Localization.Background_pre_scans_are_enabled);
if(page.BackgroundScanInterval > 0)
{
sb.
AppendFormat("\t" + Localization._0__hours_shall_be_between_the_start_of_a_background_scan_operation_and_the_next,
page.BackgroundScanInterval).
AppendLine();
sb.AppendFormat("\t" +
Localization
._0__hours_shall_be_between_the_start_of_a_background_scan_operation_and_the_next,
page.BackgroundScanInterval)
.AppendLine();
}
if(page.BackgroundPrescanTimeLimit > 0)
{
sb.AppendFormat("\t" + Localization.Background_pre_scan_operations_can_take_a_maximum_of_0_hours,
page.BackgroundPrescanTimeLimit).
AppendLine();
page.BackgroundPrescanTimeLimit)
.AppendLine();
}
if(page.MinIdleBeforeBgScan > 0)
{
sb.
AppendFormat("\t" + Localization.At_least_0_ms_must_be_idle_before_resuming_a_suspended_background_scan_operation,
page.MinIdleBeforeBgScan).
AppendLine();
sb.AppendFormat("\t" +
Localization
.At_least_0_ms_must_be_idle_before_resuming_a_suspended_background_scan_operation,
page.MinIdleBeforeBgScan)
.AppendLine();
}
if(page.MaxTimeSuspendBgScan > 0)
{
sb.
AppendFormat("\t" + Localization.At_most_0_ms_must_be_before_suspending_a_background_scan_operation_and_processing_received_commands,
page.MaxTimeSuspendBgScan).
AppendLine();
sb.AppendFormat("\t" +
Localization
.At_most_0_ms_must_be_before_suspending_a_background_scan_operation_and_processing_received_commands,
page.MaxTimeSuspendBgScan)
.AppendLine();
}
return sb.ToString();

View File

@@ -57,17 +57,13 @@ public static partial class Modes
public static ModePage_1C_SFF? DecodeModePage_1C_SFF(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
return null;
if((pageResponse?[0] & 0x40) == 0x40) return null;
if((pageResponse?[0] & 0x3F) != 0x1C)
return null;
if((pageResponse?[0] & 0x3F) != 0x1C) return null;
if(pageResponse[1] + 2 != pageResponse.Length)
return null;
if(pageResponse[1] + 2 != pageResponse.Length) return null;
if(pageResponse.Length < 8)
return null;
if(pageResponse.Length < 8) return null;
var decoded = new ModePage_1C_SFF();
@@ -85,119 +81,115 @@ public static partial class Modes
public static string PrettifyModePage_1C_SFF(ModePage_1C_SFF? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
ModePage_1C_SFF page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.SCSI_Timer_Protect_page);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.DISP)
sb.AppendLine("\t" + Localization.Drive_is_disabled_until_power_is_cycled);
if(page.DISP) sb.AppendLine("\t" + Localization.Drive_is_disabled_until_power_is_cycled);
if(page.SWPP)
sb.AppendLine("\t" + Localization.Drive_is_software_write_protected_until_powered_down);
if(page.SWPP) sb.AppendLine("\t" + Localization.Drive_is_software_write_protected_until_powered_down);
switch(page.InactivityTimeMultiplier)
{
case 0:
sb.AppendLine("\t" +
Localization.
Drive_will_remain_in_same_status_a_vendor_specified_time_after_a_seek_read_or_write_operation);
Localization
.Drive_will_remain_in_same_status_a_vendor_specified_time_after_a_seek_read_or_write_operation);
break;
case 1:
sb.AppendLine("\t" +
Localization.
Drive_will_remain_in_same_status_125_ms_after_a_seek_read_or_write_operation);
Localization
.Drive_will_remain_in_same_status_125_ms_after_a_seek_read_or_write_operation);
break;
case 2:
sb.AppendLine("\t" +
Localization.
Drive_will_remain_in_same_status_250_ms_after_a_seek_read_or_write_operation);
Localization
.Drive_will_remain_in_same_status_250_ms_after_a_seek_read_or_write_operation);
break;
case 3:
sb.AppendLine("\t" +
Localization.
Drive_will_remain_in_same_status_500_ms_after_a_seek_read_or_write_operation);
Localization
.Drive_will_remain_in_same_status_500_ms_after_a_seek_read_or_write_operation);
break;
case 4:
sb.AppendLine("\t" +
Localization.
Drive_will_remain_in_same_status_1_second_after_a_seek_read_or_write_operation);
Localization
.Drive_will_remain_in_same_status_1_second_after_a_seek_read_or_write_operation);
break;
case 5:
sb.AppendLine("\t" +
Localization.
Drive_will_remain_in_same_status_2_seconds_after_a_seek_read_or_write_operation);
Localization
.Drive_will_remain_in_same_status_2_seconds_after_a_seek_read_or_write_operation);
break;
case 6:
sb.AppendLine("\t" +
Localization.
Drive_will_remain_in_same_status_4_seconds_after_a_seek_read_or_write_operation);
Localization
.Drive_will_remain_in_same_status_4_seconds_after_a_seek_read_or_write_operation);
break;
case 7:
sb.AppendLine("\t" +
Localization.
Drive_will_remain_in_same_status_8_seconds_after_a_seek_read_or_write_operation);
Localization
.Drive_will_remain_in_same_status_8_seconds_after_a_seek_read_or_write_operation);
break;
case 8:
sb.AppendLine("\t" +
Localization.
Drive_will_remain_in_same_status_16_seconds_after_a_seek_read_or_write_operation);
Localization
.Drive_will_remain_in_same_status_16_seconds_after_a_seek_read_or_write_operation);
break;
case 9:
sb.AppendLine("\t" +
Localization.
Drive_will_remain_in_same_status_32_seconds_after_a_seek_read_or_write_operation);
Localization
.Drive_will_remain_in_same_status_32_seconds_after_a_seek_read_or_write_operation);
break;
case 10:
sb.AppendLine("\t" +
Localization.
Drive_will_remain_in_same_status_1_minute_after_a_seek_read_or_write_operation);
Localization
.Drive_will_remain_in_same_status_1_minute_after_a_seek_read_or_write_operation);
break;
case 11:
sb.AppendLine("\t" +
Localization.
Drive_will_remain_in_same_status_2_minutes_after_a_seek_read_or_write_operation);
Localization
.Drive_will_remain_in_same_status_2_minutes_after_a_seek_read_or_write_operation);
break;
case 12:
sb.AppendLine("\t" +
Localization.
Drive_will_remain_in_same_status_4_minutes_after_a_seek_read_or_write_operation);
Localization
.Drive_will_remain_in_same_status_4_minutes_after_a_seek_read_or_write_operation);
break;
case 13:
sb.AppendLine("\t" +
Localization.
Drive_will_remain_in_same_status_8_minutes_after_a_seek_read_or_write_operation);
Localization
.Drive_will_remain_in_same_status_8_minutes_after_a_seek_read_or_write_operation);
break;
case 14:
sb.AppendLine("\t" +
Localization.
Drive_will_remain_in_same_status_16_minutes_after_a_seek_read_or_write_operation);
Localization
.Drive_will_remain_in_same_status_16_minutes_after_a_seek_read_or_write_operation);
break;
case 15:
sb.AppendLine("\t" +
Localization.
Drive_will_remain_in_same_status_32_minutes_after_a_seek_read_or_write_operation);
Localization
.Drive_will_remain_in_same_status_32_minutes_after_a_seek_read_or_write_operation);
break;
}

View File

@@ -53,17 +53,13 @@ public static partial class Modes
public static ModePage_1D? DecodeModePage_1D(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
return null;
if((pageResponse?[0] & 0x40) == 0x40) return null;
if((pageResponse?[0] & 0x3F) != 0x1D)
return null;
if((pageResponse?[0] & 0x3F) != 0x1D) return null;
if(pageResponse[1] + 2 != pageResponse.Length)
return null;
if(pageResponse[1] + 2 != pageResponse.Length) return null;
if(pageResponse.Length < 32)
return null;
if(pageResponse.Length < 32) return null;
var decoded = new ModePage_1D();
@@ -80,19 +76,16 @@ public static partial class Modes
public static string PrettifyModePage_1D(ModePage_1D? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
ModePage_1D page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.SCSI_Medium_Configuration_Mode_Page);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.WORMM)
sb.AppendLine("\t" + Localization.Drive_is_operating_in_WORM_mode);
if(page.WORMM) sb.AppendLine("\t" + Localization.Drive_is_operating_in_WORM_mode);
switch(page.WormModeLabelRestrictions)
{
@@ -110,8 +103,8 @@ public static partial class Modes
break;
default:
sb.AppendFormat("\t" + Localization.Unknown_WORM_mode_label_restrictions_code_0,
page.WormModeLabelRestrictions).
AppendLine();
page.WormModeLabelRestrictions)
.AppendLine();
break;
}
@@ -130,8 +123,8 @@ public static partial class Modes
break;
default:
sb.AppendFormat("\t" + "Unknown WORM mode filemark restrictions code {0}",
page.WormModeLabelRestrictions).
AppendLine();
page.WormModeLabelRestrictions)
.AppendLine();
break;
}

View File

@@ -58,17 +58,13 @@ public static partial class Modes
public static Certance_ModePage_21? DecodeCertanceModePage_21(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
return null;
if((pageResponse?[0] & 0x40) == 0x40) return null;
if((pageResponse?[0] & 0x3F) != 0x21)
return null;
if((pageResponse?[0] & 0x3F) != 0x21) return null;
if(pageResponse[1] + 2 != pageResponse.Length)
return null;
if(pageResponse[1] + 2 != pageResponse.Length) return null;
if(pageResponse.Length != 9)
return null;
if(pageResponse.Length != 9) return null;
var decoded = new Certance_ModePage_21();
@@ -90,16 +86,14 @@ public static partial class Modes
public static string PrettifyCertanceModePage_21(Certance_ModePage_21? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
Certance_ModePage_21 page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.Certance_Drive_Capabilities_Control_Mode_Page);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
switch(page.OperatingSystemsSupport)
{
@@ -109,8 +103,8 @@ public static partial class Modes
break;
default:
sb.AppendFormat("\t" + Localization.Operating_systems_support_is_unknown_code_0,
page.OperatingSystemsSupport).
AppendLine();
page.OperatingSystemsSupport)
.AppendLine();
break;
}
@@ -132,8 +126,8 @@ public static partial class Modes
break;
default:
sb.AppendFormat("\t" + Localization.Unknown_factory_test_code_0, page.FirmwareTestControl).
AppendLine();
sb.AppendFormat("\t" + Localization.Unknown_factory_test_code_0, page.FirmwareTestControl)
.AppendLine();
break;
}
@@ -150,8 +144,8 @@ public static partial class Modes
break;
default:
sb.AppendFormat("\t" + Localization.Unknown_Power_On_Self_Test_code_0, page.ExtendedPOSTMode).
AppendLine();
sb.AppendFormat("\t" + Localization.Unknown_Power_On_Self_Test_code_0, page.ExtendedPOSTMode)
.AppendLine();
break;
}
@@ -171,18 +165,17 @@ public static partial class Modes
break;
default:
sb.AppendFormat("\t" + Localization.Unknown_compression_control_code_0, page.DataCompressionControl).
AppendLine();
sb.AppendFormat("\t" + Localization.Unknown_compression_control_code_0, page.DataCompressionControl)
.AppendLine();
break;
}
if(page.HostUnloadOverride)
sb.AppendLine("\t" + Localization.SCSI_UNLOAD_command_will_not_eject_the_cartridge);
if(page.HostUnloadOverride) sb.AppendLine("\t" + Localization.SCSI_UNLOAD_command_will_not_eject_the_cartridge);
sb.Append("\t" +
Localization.
How_should_tapes_be_unloaded_in_a_power_cycle_tape_incompatibility_firmware_download_or_cleaning_end);
Localization
.How_should_tapes_be_unloaded_in_a_power_cycle_tape_incompatibility_firmware_download_or_cleaning_end);
switch(page.AutoUnloadMode)
{

View File

@@ -63,17 +63,13 @@ public static partial class Modes
public static Certance_ModePage_22? DecodeCertanceModePage_22(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
return null;
if((pageResponse?[0] & 0x40) == 0x40) return null;
if((pageResponse?[0] & 0x3F) != 0x22)
return null;
if((pageResponse?[0] & 0x3F) != 0x22) return null;
if(pageResponse[1] + 2 != pageResponse.Length)
return null;
if(pageResponse[1] + 2 != pageResponse.Length) return null;
if(pageResponse.Length != 16)
return null;
if(pageResponse.Length != 16) return null;
var decoded = new Certance_ModePage_22();
@@ -98,16 +94,14 @@ public static partial class Modes
public static string PrettifyCertanceModePage_22(Certance_ModePage_22? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
Certance_ModePage_22 page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.Certance_Interface_Control_Mode_Page);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
switch(page.BaudRate)
{
@@ -134,8 +128,8 @@ public static partial class Modes
break;
default:
sb.AppendFormat("\t" + Localization.Unknown_library_interface_baud_rate_code_0, page.BaudRate).
AppendLine();
sb.AppendFormat("\t" + Localization.Unknown_library_interface_baud_rate_code_0, page.BaudRate)
.AppendLine();
break;
}
@@ -171,8 +165,8 @@ public static partial class Modes
break;
default:
sb.AppendFormat("\t" + Localization.Unknown_port_A_transport_type_code_0, page.PortATransportType).
AppendLine();
sb.AppendFormat("\t" + Localization.Unknown_port_A_transport_type_code_0, page.PortATransportType)
.AppendLine();
break;
}
@@ -180,8 +174,8 @@ public static partial class Modes
if(page.PortATransportType > 0)
sb.AppendFormat("\t" + Localization.Drive_responds_to_SCSI_ID_0, page.PortAPresentSelectionID).AppendLine();
sb.AppendFormat("\t" + Localization.Drive_will_respond_to_SCSI_ID_0_on_Port_A_enabling, page.NextSelectionID).
AppendLine();
sb.AppendFormat("\t" + Localization.Drive_will_respond_to_SCSI_ID_0_on_Port_A_enabling, page.NextSelectionID)
.AppendLine();
sb.AppendFormat("\t" + Localization.Drive_jumpers_choose_SCSI_ID_0, page.JumperedSelectionID).AppendLine();

View File

@@ -54,17 +54,13 @@ public static partial class Modes
public static IBM_ModePage_24? DecodeIBMModePage_24(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
return null;
if((pageResponse?[0] & 0x40) == 0x40) return null;
if((pageResponse?[0] & 0x3F) != 0x24)
return null;
if((pageResponse?[0] & 0x3F) != 0x24) return null;
if(pageResponse[1] + 2 != pageResponse.Length)
return null;
if(pageResponse[1] + 2 != pageResponse.Length) return null;
if(pageResponse.Length != 8)
return null;
if(pageResponse.Length != 8) return null;
var decoded = new IBM_ModePage_24();
@@ -82,27 +78,23 @@ public static partial class Modes
public static string PrettifyIBMModePage_24(IBM_ModePage_24? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
IBM_ModePage_24 page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.IBM_Vendor_Specific_Control_Mode_Page);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
sb.AppendFormat("\t" + Localization.Vendor_specific_mode_control_0, page.ModeControl);
sb.AppendFormat("\t" + Localization.Vendor_specific_velocity_setting_0, page.VelocitySetting);
if(!page.EncryptionCapable)
return sb.ToString();
if(!page.EncryptionCapable) return sb.ToString();
sb.AppendLine("\t" + Localization.Drive_supports_encryption);
if(page.EncryptionEnabled)
sb.AppendLine("\t" + Localization.Drive_has_encryption_enabled);
if(page.EncryptionEnabled) sb.AppendLine("\t" + Localization.Drive_has_encryption_enabled);
return sb.ToString();
}

View File

@@ -50,33 +50,25 @@ public static partial class Modes
public static string PrettifyModePage_2A(ModePage_2A modePage)
{
if(modePage is null)
return null;
if(modePage is null) return null;
var sb = new StringBuilder();
sb.AppendLine(Localization.SCSI_CD_ROM_capabilities_page);
if(modePage.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(modePage.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(modePage.AudioPlay)
sb.AppendLine("\t" + Localization.Drive_can_play_audio);
if(modePage.AudioPlay) sb.AppendLine("\t" + Localization.Drive_can_play_audio);
if(modePage.Mode2Form1)
sb.AppendLine("\t" + Localization.Drive_can_read_sectors_in_Mode_2_Form_1_format);
if(modePage.Mode2Form1) sb.AppendLine("\t" + Localization.Drive_can_read_sectors_in_Mode_2_Form_1_format);
if(modePage.Mode2Form2)
sb.AppendLine("\t" + Localization.Drive_can_read_sectors_in_Mode_2_Form_2_format);
if(modePage.Mode2Form2) sb.AppendLine("\t" + Localization.Drive_can_read_sectors_in_Mode_2_Form_2_format);
if(modePage.MultiSession)
sb.AppendLine("\t" + Localization.Drive_supports_multi_session_discs_and_or_Photo_CD);
if(modePage.MultiSession) sb.AppendLine("\t" + Localization.Drive_supports_multi_session_discs_and_or_Photo_CD);
if(modePage.CDDACommand)
sb.AppendLine("\t" + Localization.Drive_can_read_digital_audio);
if(modePage.CDDACommand) sb.AppendLine("\t" + Localization.Drive_can_read_digital_audio);
if(modePage.AccurateCDDA)
sb.AppendLine("\t" + Localization.Drive_can_continue_from_streaming_loss);
if(modePage.AccurateCDDA) sb.AppendLine("\t" + Localization.Drive_can_continue_from_streaming_loss);
if(modePage.Subchannel)
sb.AppendLine("\t" + Localization.Drive_can_read_uncorrected_and_interleaved_R_W_subchannels);
@@ -84,14 +76,11 @@ public static partial class Modes
if(modePage.DeinterlaveSubchannel)
sb.AppendLine("\t" + Localization.Drive_can_read__deinterleave_and_correct_R_W_subchannels);
if(modePage.C2Pointer)
sb.AppendLine("\t" + Localization.Drive_supports_C2_pointers);
if(modePage.C2Pointer) sb.AppendLine("\t" + Localization.Drive_supports_C2_pointers);
if(modePage.UPC)
sb.AppendLine("\t" + Localization.Drive_can_read_Media_Catalogue_Number);
if(modePage.UPC) sb.AppendLine("\t" + Localization.Drive_can_read_Media_Catalogue_Number);
if(modePage.ISRC)
sb.AppendLine("\t" + Localization.Drive_can_read_ISRC);
if(modePage.ISRC) sb.AppendLine("\t" + Localization.Drive_can_read_ISRC);
switch(modePage.LoadingMechanism)
{
@@ -117,14 +106,13 @@ public static partial class Modes
break;
default:
sb.AppendFormat("\t" + Localization.Drive_uses_unknown_loading_mechanism_type__0_,
modePage.LoadingMechanism).
AppendLine();
modePage.LoadingMechanism)
.AppendLine();
break;
}
if(modePage.Lock)
sb.AppendLine("\t" + Localization.Drive_can_lock_media);
if(modePage.Lock) sb.AppendLine("\t" + Localization.Drive_can_lock_media);
if(modePage.PreventJumper)
{
@@ -142,19 +130,17 @@ public static partial class Modes
: "\t" + Localization.Drive_is_not_locked__media_can_be_ejected_and_inserted);
}
if(modePage.Eject)
sb.AppendLine("\t" + Localization.Drive_can_eject_media);
if(modePage.Eject) sb.AppendLine("\t" + Localization.Drive_can_eject_media);
if(modePage.SeparateChannelMute)
sb.AppendLine("\t" + Localization.Each_channel_can_be_muted_independently);
if(modePage.SeparateChannelMute) sb.AppendLine("\t" + Localization.Each_channel_can_be_muted_independently);
if(modePage.SeparateChannelVolume)
sb.AppendLine("\t" + Localization.Each_channel_s_volume_can_be_controlled_independently);
if(modePage.SupportedVolumeLevels > 0)
{
sb.AppendFormat("\t" + Localization.Drive_supports_0_volume_levels, modePage.SupportedVolumeLevels).
AppendLine();
sb.AppendFormat("\t" + Localization.Drive_supports_0_volume_levels, modePage.SupportedVolumeLevels)
.AppendLine();
}
if(modePage.BufferSize > 0)
@@ -162,14 +148,14 @@ public static partial class Modes
if(modePage.MaximumSpeed > 0)
{
sb.AppendFormat("\t" + Localization.Drive_maximum_reading_speed_is_0_Kbyte_sec, modePage.MaximumSpeed).
AppendLine();
sb.AppendFormat("\t" + Localization.Drive_maximum_reading_speed_is_0_Kbyte_sec, modePage.MaximumSpeed)
.AppendLine();
}
if(modePage.CurrentSpeed > 0)
{
sb.AppendFormat("\t" + Localization.Drive_current_reading_speed_is_0_Kbyte_sec, modePage.CurrentSpeed).
AppendLine();
sb.AppendFormat("\t" + Localization.Drive_current_reading_speed_is_0_Kbyte_sec, modePage.CurrentSpeed)
.AppendLine();
}
if(modePage.ReadCDR)
@@ -178,8 +164,7 @@ public static partial class Modes
? "\t" + Localization.Drive_can_read_and_write_CD_R
: "\t" + Localization.Drive_can_read_CD_R);
if(modePage.Method2)
sb.AppendLine("\t" + Localization.Drive_supports_reading_CD_R_packet_media);
if(modePage.Method2) sb.AppendLine("\t" + Localization.Drive_supports_reading_CD_R_packet_media);
}
if(modePage.ReadCDRW)
@@ -189,8 +174,7 @@ public static partial class Modes
: "\t" + Localization.Drive_can_read_CD_RW);
}
if(modePage.ReadDVDROM)
sb.AppendLine("\t" + Localization.Drive_can_read_DVD_ROM);
if(modePage.ReadDVDROM) sb.AppendLine("\t" + Localization.Drive_can_read_DVD_ROM);
if(modePage.ReadDVDR)
{
@@ -209,11 +193,9 @@ public static partial class Modes
if(modePage.Composite)
sb.AppendLine("\t" + Localization.Drive_can_deliver_a_composite_audio_and_video_data_stream);
if(modePage.DigitalPort1)
sb.AppendLine("\t" + Localization.Drive_supports_IEC_958_digital_output_on_port_1);
if(modePage.DigitalPort1) sb.AppendLine("\t" + Localization.Drive_supports_IEC_958_digital_output_on_port_1);
if(modePage.DigitalPort2)
sb.AppendLine("\t" + Localization.Drive_supports_IEC_958_digital_output_on_port_2);
if(modePage.DigitalPort2) sb.AppendLine("\t" + Localization.Drive_supports_IEC_958_digital_output_on_port_2);
if(modePage.SDP)
sb.AppendLine("\t" + Localization.Drive_contains_a_changer_that_can_report_the_exact_contents_of_the_slots);
@@ -224,14 +206,14 @@ public static partial class Modes
{
case 0:
sb.AppendFormat("\t" + Localization.Drive_current_writing_speed_is_0_Kbyte_sec_in_CLV_mode,
modePage.CurrentWriteSpeedSelected).
AppendLine();
modePage.CurrentWriteSpeedSelected)
.AppendLine();
break;
case 1:
sb.AppendFormat("\t" + Localization.Drive_current_writing_speed_is_0_Kbyte_sec_in_pure_CAV_mode,
modePage.CurrentWriteSpeedSelected).
AppendLine();
modePage.CurrentWriteSpeedSelected)
.AppendLine();
break;
}
@@ -240,58 +222,52 @@ public static partial class Modes
{
if(modePage.MaxWriteSpeed > 0)
{
sb.AppendFormat("\t" + Localization.Drive_maximum_writing_speed_is_0_Kbyte_sec, modePage.MaxWriteSpeed).
AppendLine();
sb.AppendFormat("\t" + Localization.Drive_maximum_writing_speed_is_0_Kbyte_sec, modePage.MaxWriteSpeed)
.AppendLine();
}
if(modePage.CurrentWriteSpeed > 0)
{
sb.AppendFormat("\t" + Localization.Drive_current_writing_speed_is_0_Kbyte_sec,
modePage.CurrentWriteSpeed).
AppendLine();
modePage.CurrentWriteSpeed)
.AppendLine();
}
}
if(modePage.WriteSpeedPerformanceDescriptors != null)
{
foreach(ModePage_2A_WriteDescriptor descriptor in
modePage.WriteSpeedPerformanceDescriptors.Where(descriptor => descriptor.WriteSpeed > 0))
modePage.WriteSpeedPerformanceDescriptors.Where(descriptor => descriptor.WriteSpeed > 0))
{
switch(descriptor.RotationControl)
{
case 0:
sb.AppendFormat("\t" + Localization.Drive_supports_writing_at_0_Kbyte_sec_in_CLV_mode,
descriptor.WriteSpeed).
AppendLine();
descriptor.WriteSpeed)
.AppendLine();
break;
case 1:
sb.AppendFormat("\t" + Localization.Drive_supports_writing_at_is_0_Kbyte_sec_in_pure_CAV_mode,
descriptor.WriteSpeed).
AppendLine();
descriptor.WriteSpeed)
.AppendLine();
break;
}
}
}
if(modePage.TestWrite)
sb.AppendLine("\t" + Localization.Drive_supports_test_writing);
if(modePage.TestWrite) sb.AppendLine("\t" + Localization.Drive_supports_test_writing);
if(modePage.ReadBarcode)
sb.AppendLine("\t" + Localization.Drive_can_read_barcode);
if(modePage.ReadBarcode) sb.AppendLine("\t" + Localization.Drive_can_read_barcode);
if(modePage.SCC)
sb.AppendLine("\t" + Localization.Drive_can_read_both_sides_of_a_disc);
if(modePage.SCC) sb.AppendLine("\t" + Localization.Drive_can_read_both_sides_of_a_disc);
if(modePage.LeadInPW)
sb.AppendLine("\t" + Localization.Drive_an_read_raw_R_W_subchannel_from_the_Lead_In);
if(modePage.LeadInPW) sb.AppendLine("\t" + Localization.Drive_an_read_raw_R_W_subchannel_from_the_Lead_In);
if(modePage.CMRSupported == 1)
sb.AppendLine("\t" + Localization.Drive_supports_DVD_CSS_and_or_DVD_CPPM);
if(modePage.CMRSupported == 1) sb.AppendLine("\t" + Localization.Drive_supports_DVD_CSS_and_or_DVD_CPPM);
if(modePage.BUF)
sb.AppendLine("\t" + Localization.Drive_supports_buffer_under_run_free_recording);
if(modePage.BUF) sb.AppendLine("\t" + Localization.Drive_supports_buffer_under_run_free_recording);
return sb.ToString();
}

View File

@@ -62,17 +62,13 @@ public static partial class Modes
public static IBM_ModePage_2F? DecodeIBMModePage_2F(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
return null;
if((pageResponse?[0] & 0x40) == 0x40) return null;
if((pageResponse?[0] & 0x3F) != 0x2F)
return null;
if((pageResponse?[0] & 0x3F) != 0x2F) return null;
if(pageResponse[1] + 2 != pageResponse.Length)
return null;
if(pageResponse[1] + 2 != pageResponse.Length) return null;
if(pageResponse.Length < 8)
return null;
if(pageResponse.Length < 8) return null;
return new IBM_ModePage_2F
{
@@ -95,16 +91,14 @@ public static partial class Modes
public static string PrettifyIBMModePage_2F(IBM_ModePage_2F? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
IBM_ModePage_2F page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.IBM_Behaviour_Configuration_Mode_Page);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
switch(page.FenceBehaviour)
{
@@ -133,8 +127,8 @@ public static partial class Modes
break;
default:
sb.AppendFormat("\t" + Localization.Unknown_cleaning_behaviour_code_0, page.CleanBehaviour).
AppendLine();
sb.AppendFormat("\t" + Localization.Unknown_cleaning_behaviour_code_0, page.CleanBehaviour)
.AppendLine();
break;
}
@@ -166,17 +160,15 @@ public static partial class Modes
break;
default:
sb.AppendFormat("\t" + Localization.Unknown_sense_data_behaviour_code_0, page.WORMEmulation).
AppendLine();
sb.AppendFormat("\t" + Localization.Unknown_sense_data_behaviour_code_0, page.WORMEmulation)
.AppendLine();
break;
}
if(page.CLNCHK)
sb.AppendLine("\t" + Localization.Drive_will_set_Check_Condition_when_cleaning_is_needed);
if(page.CLNCHK) sb.AppendLine("\t" + Localization.Drive_will_set_Check_Condition_when_cleaning_is_needed);
if(page.DDEOR)
sb.AppendLine("\t" + Localization.No_deferred_error_will_be_reported_to_a_rewind_command);
if(page.DDEOR) sb.AppendLine("\t" + Localization.No_deferred_error_will_be_reported_to_a_rewind_command);
if(page.CCDM)
sb.AppendLine("\t" + Localization.Drive_will_set_Check_Condition_when_the_criteria_for_Dead_Media_is_met);
@@ -184,14 +176,11 @@ public static partial class Modes
if(page.FirmwareUpdateBehaviour > 0)
sb.AppendLine("\t" + Localization.Drive_will_not_accept_downlevel_firmware_via_an_FMR_tape);
if(page.UOE_C == 1)
sb.AppendLine("\t" + Localization.Drive_will_eject_cleaning_cartridges_on_error);
if(page.UOE_C == 1) sb.AppendLine("\t" + Localization.Drive_will_eject_cleaning_cartridges_on_error);
if(page.UOE_F == 1)
sb.AppendLine("\t" + Localization.Drive_will_eject_firmware_cartridges_on_error);
if(page.UOE_F == 1) sb.AppendLine("\t" + Localization.Drive_will_eject_firmware_cartridges_on_error);
if(page.UOE_D == 1)
sb.AppendLine("\t" + Localization.Drive_will_eject_data_cartridges_on_error);
if(page.UOE_D == 1) sb.AppendLine("\t" + Localization.Drive_will_eject_data_cartridges_on_error);
return sb.ToString();
}

View File

@@ -47,17 +47,13 @@ public static partial class Modes
public static bool IsAppleModePage_30(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
return false;
if((pageResponse?[0] & 0x40) == 0x40) return false;
if((pageResponse?[0] & 0x3F) != 0x30)
return false;
if((pageResponse?[0] & 0x3F) != 0x30) return false;
if(pageResponse[1] + 2 != pageResponse.Length)
return false;
if(pageResponse[1] + 2 != pageResponse.Length) return false;
if(pageResponse.Length != 30)
return false;
if(pageResponse.Length != 30) return false;
var str = new byte[20];
Array.Copy(pageResponse, 10, str, 0, 20);

View File

@@ -54,17 +54,13 @@ public static partial class Modes
public static HP_ModePage_3B? DecodeHPModePage_3B(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
return null;
if((pageResponse?[0] & 0x40) == 0x40) return null;
if((pageResponse?[0] & 0x3F) != 0x3B)
return null;
if((pageResponse?[0] & 0x3F) != 0x3B) return null;
if(pageResponse[1] + 2 != pageResponse.Length)
return null;
if(pageResponse[1] + 2 != pageResponse.Length) return null;
if(pageResponse.Length != 16)
return null;
if(pageResponse.Length != 16) return null;
var decoded = new HP_ModePage_3B();
@@ -81,16 +77,14 @@ public static partial class Modes
public static string PrettifyHPModePage_3B(HP_ModePage_3B? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
HP_ModePage_3B page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.HP_Serial_Number_Override_Mode_Page);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
switch(page.MSN)
{

View File

@@ -64,17 +64,13 @@ public static partial class Modes
public static HP_ModePage_3C? DecodeHPModePage_3C(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
return null;
if((pageResponse?[0] & 0x40) == 0x40) return null;
if((pageResponse?[0] & 0x3F) != 0x3C)
return null;
if((pageResponse?[0] & 0x3F) != 0x3C) return null;
if(pageResponse[1] + 2 != pageResponse.Length)
return null;
if(pageResponse[1] + 2 != pageResponse.Length) return null;
if(pageResponse.Length != 36)
return null;
if(pageResponse.Length != 36) return null;
var decoded = new HP_ModePage_3C();
@@ -114,49 +110,49 @@ public static partial class Modes
public static string PrettifyHPModePage_3C(HP_ModePage_3C? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
HP_ModePage_3C page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.HP_Device_Time_Mode_Page);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PT)
{
sb.AppendFormat("\t" + Localization.Drive_has_been_powered_up_0_times, page.CurrentPowerOn);
sb.AppendFormat("\t" + Localization.Drive_has_been_powered_up_since_0_seconds_ago_this_time,
TimeSpan.FromSeconds(page.PowerOnTime)).
AppendLine();
TimeSpan.FromSeconds(page.PowerOnTime))
.AppendLine();
sb.AppendFormat("\t" + Localization.Drive_has_been_powered_up_a_total_of_0_seconds,
TimeSpan.FromSeconds(page.CumulativePowerOn)).
AppendLine();
TimeSpan.FromSeconds(page.CumulativePowerOn))
.AppendLine();
}
if(page.WT)
{
sb.AppendFormat("\t" + Localization.Drive_date_time_is_0,
DateHandlers.UnixUnsignedToDateTime(page.WorldTime)).
AppendLine();
DateHandlers.UnixUnsignedToDateTime(page.WorldTime))
.AppendLine();
if(page.UTC)
sb.AppendLine("\t" + Localization.Drive_time_is_UTC);
if(page.UTC) sb.AppendLine("\t" + Localization.Drive_time_is_UTC);
if(page.NTP)
sb.AppendLine("\t" + Localization.Drive_time_is_synchronized_with_a_NTP_source);
if(page.NTP) sb.AppendLine("\t" + Localization.Drive_time_is_synchronized_with_a_NTP_source);
}
if(page.LT)
{
sb.AppendFormat("\t" + Localization.Library_time_is_0,
new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, page.LibraryHours,
page.LibraryMinutes, page.LibrarySeconds)).
AppendLine();
new DateTime(DateTime.Now.Year,
DateTime.Now.Month,
DateTime.Now.Day,
page.LibraryHours,
page.LibraryMinutes,
page.LibrarySeconds))
.AppendLine();
}
return sb.ToString();

View File

@@ -51,17 +51,13 @@ public static partial class Modes
public static HP_ModePage_3D? DecodeHPModePage_3D(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
return null;
if((pageResponse?[0] & 0x40) == 0x40) return null;
if((pageResponse?[0] & 0x3F) != 0x3D)
return null;
if((pageResponse?[0] & 0x3F) != 0x3D) return null;
if(pageResponse[1] + 2 != pageResponse.Length)
return null;
if(pageResponse[1] + 2 != pageResponse.Length) return null;
if(pageResponse.Length != 4)
return null;
if(pageResponse.Length != 4) return null;
var decoded = new HP_ModePage_3D();
@@ -76,16 +72,14 @@ public static partial class Modes
public static string PrettifyHPModePage_3D(HP_ModePage_3D? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
HP_ModePage_3D page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.HP_Extended_Reset_Mode_Page);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
switch(page.ResetBehaviour)
{

View File

@@ -51,17 +51,13 @@ public static partial class Modes
public static IBM_ModePage_3D? DecodeIBMModePage_3D(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
return null;
if((pageResponse?[0] & 0x40) == 0x40) return null;
if((pageResponse?[0] & 0x3F) != 0x3D)
return null;
if((pageResponse?[0] & 0x3F) != 0x3D) return null;
if(pageResponse[1] + 2 != pageResponse.Length)
return null;
if(pageResponse[1] + 2 != pageResponse.Length) return null;
if(pageResponse.Length != 5)
return null;
if(pageResponse.Length != 5) return null;
var decoded = new IBM_ModePage_3D();
@@ -76,16 +72,14 @@ public static partial class Modes
public static string PrettifyIBMModePage_3D(IBM_ModePage_3D? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
IBM_ModePage_3D page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.IBM_LEOT_Mode_Page);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
sb.AppendFormat("\t" + Localization._0_wraps, page.NumberOfWraps).AppendLine();

View File

@@ -76,17 +76,13 @@ public static partial class Modes
public static Fujitsu_ModePage_3E? DecodeFujitsuModePage_3E(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
return null;
if((pageResponse?[0] & 0x40) == 0x40) return null;
if((pageResponse?[0] & 0x3F) != 0x3E)
return null;
if((pageResponse?[0] & 0x3F) != 0x3E) return null;
if(pageResponse[1] + 2 != pageResponse.Length)
return null;
if(pageResponse[1] + 2 != pageResponse.Length) return null;
if(pageResponse.Length != 8)
return null;
if(pageResponse.Length != 8) return null;
var decoded = new Fujitsu_ModePage_3E();
@@ -111,19 +107,16 @@ public static partial class Modes
public static string PrettifyFujitsuModePage_3E(Fujitsu_ModePage_3E? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
Fujitsu_ModePage_3E page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.Fujitsu_Verify_Control_Page);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.audioVisualMode)
sb.AppendLine("\t" + Localization.Audio_Visual_data_support_mode_is_applied);
if(page.audioVisualMode) sb.AppendLine("\t" + Localization.Audio_Visual_data_support_mode_is_applied);
if(page.streamingMode)
sb.AppendLine("\t" + Localization.Test_write_operation_is_restricted_during_read_or_write_operations);
@@ -145,8 +138,8 @@ public static partial class Modes
}
sb.AppendFormat("\t" + Localization.The_device_type_that_would_be_provided_in_the_INQUIRY_response_is_0,
page.devType).
AppendLine();
page.devType)
.AppendLine();
return sb.ToString();
}

View File

@@ -52,17 +52,13 @@ public static partial class Modes
public static HP_ModePage_3E? DecodeHPModePage_3E(byte[] pageResponse)
{
if((pageResponse?[0] & 0x40) == 0x40)
return null;
if((pageResponse?[0] & 0x40) == 0x40) return null;
if((pageResponse?[0] & 0x3F) != 0x3E)
return null;
if((pageResponse?[0] & 0x3F) != 0x3E) return null;
if(pageResponse[1] + 2 != pageResponse.Length)
return null;
if(pageResponse[1] + 2 != pageResponse.Length) return null;
if(pageResponse.Length != 4)
return null;
if(pageResponse.Length != 4) return null;
var decoded = new HP_ModePage_3E();
@@ -78,23 +74,20 @@ public static partial class Modes
public static string PrettifyHPModePage_3E(HP_ModePage_3E? modePage)
{
if(!modePage.HasValue)
return null;
if(!modePage.HasValue) return null;
HP_ModePage_3E page = modePage.Value;
var sb = new StringBuilder();
sb.AppendLine(Localization.HP_CD_ROM_Emulation_Disaster_Recovery_Mode_Page);
if(page.PS)
sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
if(page.PS) sb.AppendLine("\t" + Localization.Parameters_can_be_saved);
sb.AppendLine(page.CDmode
? "\t" + Localization.Drive_is_emulating_a_CD_ROM_drive
: "\t" + Localization.Drive_is_not_emulating_a_CD_ROM_drive);
if(page.NonAuto)
sb.AppendLine("\t" + Localization.Drive_will_not_exit_emulation_automatically);
if(page.NonAuto) sb.AppendLine("\t" + Localization.Drive_will_not_exit_emulation_automatically);
return sb.ToString();
}

View File

@@ -43,22 +43,22 @@ public static partial class Modes
{
public static string GetMediumTypeDescription(MediumTypes type) => type switch
{
MediumTypes.ECMA54 => Localization.
GetMediumTypeDescription_ECMA_54,
MediumTypes.ECMA59 => Localization.
GetMediumTypeDescription_ECMA_59,
MediumTypes.ECMA69 => Localization.
GetMediumTypeDescription_ECMA_69,
MediumTypes.ECMA66 => Localization.
GetMediumTypeDescription_ECMA_66,
MediumTypes.ECMA70 => Localization.
GetMediumTypeDescription_ECMA_70,
MediumTypes.ECMA78 => Localization.
GetMediumTypeDescription_ECMA_78,
MediumTypes.ECMA99 => Localization.
GetMediumTypeDescription_ECMA_99,
MediumTypes.ECMA100 => Localization.
GetMediumTypeDescription_ECMA_100,
MediumTypes.ECMA54 => Localization
.GetMediumTypeDescription_ECMA_54,
MediumTypes.ECMA59 => Localization
.GetMediumTypeDescription_ECMA_59,
MediumTypes.ECMA69 => Localization
.GetMediumTypeDescription_ECMA_69,
MediumTypes.ECMA66 => Localization
.GetMediumTypeDescription_ECMA_66,
MediumTypes.ECMA70 => Localization
.GetMediumTypeDescription_ECMA_70,
MediumTypes.ECMA78 => Localization
.GetMediumTypeDescription_ECMA_78,
MediumTypes.ECMA99 => Localization
.GetMediumTypeDescription_ECMA_99,
MediumTypes.ECMA100 => Localization
.GetMediumTypeDescription_ECMA_100,
// Most probably they will never appear, but magneto-opticals use these codes
/*
@@ -67,24 +67,24 @@ public static partial class Modes
case MediumTypes.Unspecified_DS:
return "Unspecified double sided flexible disk";
*/
MediumTypes.X3_73 => Localization.
GetMediumTypeDescription_X3_73,
MediumTypes.X3_73_DS => Localization.
GetMediumTypeDescription_X3_73_DS,
MediumTypes.X3_82 => Localization.
GetMediumTypeDescription_X3_82,
MediumTypes.Type3Floppy => Localization.
GetMediumTypeDescription_Type3Floppy,
MediumTypes.HDFloppy => Localization.
GetMediumTypeDescription_HDFloppy,
MediumTypes.ReadOnly => Localization.
GetMediumTypeDescription_ReadOnly,
MediumTypes.WORM => Localization.
GetMediumTypeDescription_WORM,
MediumTypes.Erasable => Localization.
GetMediumTypeDescription_Erasable,
MediumTypes.RO_WORM => Localization.
GetMediumTypeDescription_RO_WORM,
MediumTypes.X3_73 => Localization
.GetMediumTypeDescription_X3_73,
MediumTypes.X3_73_DS => Localization
.GetMediumTypeDescription_X3_73_DS,
MediumTypes.X3_82 => Localization
.GetMediumTypeDescription_X3_82,
MediumTypes.Type3Floppy => Localization
.GetMediumTypeDescription_Type3Floppy,
MediumTypes.HDFloppy => Localization
.GetMediumTypeDescription_HDFloppy,
MediumTypes.ReadOnly => Localization
.GetMediumTypeDescription_ReadOnly,
MediumTypes.WORM => Localization
.GetMediumTypeDescription_WORM,
MediumTypes.Erasable => Localization
.GetMediumTypeDescription_Erasable,
MediumTypes.RO_WORM => Localization
.GetMediumTypeDescription_RO_WORM,
// These magneto-opticals were never manufactured
/*
@@ -94,19 +94,18 @@ public static partial class Modes
case MediumTypes.WORM_RW:
return "a combination of write-once and erasable optical";
*/
MediumTypes.DOW => Localization.
GetMediumTypeDescription_DOW,
MediumTypes.HiMD => Localization.
GetMediumTypeDescription_HiMD,
_ => string.
Format(Localization.Unknown_medium_type_0,
(byte)type)
MediumTypes.DOW => Localization
.GetMediumTypeDescription_DOW,
MediumTypes.HiMD => Localization
.GetMediumTypeDescription_HiMD,
_ => string.Format(Localization
.Unknown_medium_type_0,
(byte)type)
};
public static string PrettifyModeHeader(ModeHeader? header, PeripheralDeviceTypes deviceType)
{
if(!header.HasValue)
return null;
if(!header.HasValue) return null;
var sb = new StringBuilder();
@@ -114,21 +113,19 @@ public static partial class Modes
switch(deviceType)
{
#region Direct access device mode header
#region Direct access device mode header
case PeripheralDeviceTypes.DirectAccess:
{
if(header.Value.MediumType != MediumTypes.Default)
{
sb.AppendFormat("\t" + Localization.Medium_is_0, GetMediumTypeDescription(header.Value.MediumType)).
AppendLine();
sb.AppendFormat("\t" + Localization.Medium_is_0, GetMediumTypeDescription(header.Value.MediumType))
.AppendLine();
}
if(header.Value.WriteProtected)
sb.AppendLine("\t" + Localization.Medium_is_write_protected);
if(header.Value.WriteProtected) sb.AppendLine("\t" + Localization.Medium_is_write_protected);
if(header.Value.DPOFUA)
sb.AppendLine("\t" + Localization.Drive_supports_DPO_and_FUA_bits);
if(header.Value.DPOFUA) sb.AppendLine("\t" + Localization.Drive_supports_DPO_and_FUA_bits);
if(header.Value.BlockDescriptors != null)
{
@@ -164,27 +161,31 @@ public static partial class Modes
if(descriptor.Blocks == 0)
{
sb.AppendFormat("\t" + Localization.All_remaining_blocks_have_0_and_are_1_bytes_each,
density, descriptor.BlockLength).
AppendLine();
density,
descriptor.BlockLength)
.AppendLine();
}
else
{
sb.AppendFormat("\t" + Localization._0_blocks_have_1_and_are_2_bytes_each,
descriptor.Blocks, density, descriptor.BlockLength).
AppendLine();
descriptor.Blocks,
density,
descriptor.BlockLength)
.AppendLine();
}
}
else if(descriptor.Blocks == 0)
{
sb.AppendFormat("\t" + Localization.All_remaining_blocks_are_0_bytes_each,
descriptor.BlockLength).
AppendLine();
descriptor.BlockLength)
.AppendLine();
}
else
{
sb.AppendFormat("\t" + Localization._0_blocks_are_1_bytes_each, descriptor.Blocks,
descriptor.BlockLength).
AppendLine();
sb.AppendFormat("\t" + Localization._0_blocks_are_1_bytes_each,
descriptor.Blocks,
descriptor.BlockLength)
.AppendLine();
}
}
}
@@ -192,9 +193,9 @@ public static partial class Modes
break;
}
#endregion Direct access device mode header
#endregion Direct access device mode header
#region Sequential access device mode header
#region Sequential access device mode header
case PeripheralDeviceTypes.SequentialAccess:
{
@@ -214,8 +215,8 @@ public static partial class Modes
break;
default:
sb.AppendFormat("\t" + Localization.Unknown_buffered_mode_code_0, header.Value.BufferedMode).
AppendLine();
sb.AppendFormat("\t" + Localization.Unknown_buffered_mode_code_0, header.Value.BufferedMode)
.AppendLine();
break;
}
@@ -225,8 +226,7 @@ public static partial class Modes
else
sb.AppendFormat("\t" + Localization.Device_uses_speed_0, header.Value.Speed).AppendLine();
if(header.Value.WriteProtected)
sb.AppendLine("\t" + Localization.Medium_is_write_protected);
if(header.Value.WriteProtected) sb.AppendLine("\t" + Localization.Medium_is_write_protected);
string medium = header.Value.MediumType switch
{
@@ -1224,56 +1224,62 @@ public static partial class Modes
{
if(descriptor.BlockLength == 0)
{
sb.
AppendFormat("\t" + Localization.All_remaining_blocks_conform_to_0_and_have_a_variable_length,
density).
AppendLine();
sb.AppendFormat("\t" +
Localization
.All_remaining_blocks_conform_to_0_and_have_a_variable_length,
density)
.AppendLine();
}
else
{
sb.
AppendFormat("\t" + Localization.All_remaining_blocks_conform_to_0_and_are_1_bytes_each,
density, descriptor.BlockLength).
AppendLine();
sb.AppendFormat("\t" +
Localization.All_remaining_blocks_conform_to_0_and_are_1_bytes_each,
density,
descriptor.BlockLength)
.AppendLine();
}
}
else if(descriptor.BlockLength == 0)
{
sb.AppendFormat("\t" + Localization._0_blocks_conform_to_1_and_have_a_variable_length,
descriptor.Blocks, density).
AppendLine();
descriptor.Blocks,
density)
.AppendLine();
}
else
{
sb.AppendFormat("\t" + Localization._0_blocks_conform_to_1_and_are_2_bytes_each,
descriptor.Blocks, density, descriptor.BlockLength).
AppendLine();
descriptor.Blocks,
density,
descriptor.BlockLength)
.AppendLine();
}
}
else if(descriptor.Blocks == 0)
{
if(descriptor.BlockLength == 0)
{
sb.AppendFormat("\t" + Localization.All_remaining_blocks_have_a_variable_length).
AppendLine();
sb.AppendFormat("\t" + Localization.All_remaining_blocks_have_a_variable_length)
.AppendLine();
}
else
{
sb.AppendFormat("\t" + Localization.All_remaining_blocks_are_0_bytes_each,
descriptor.BlockLength).
AppendLine();
descriptor.BlockLength)
.AppendLine();
}
}
else if(descriptor.BlockLength == 0)
{
sb.AppendFormat("\t" + Localization._0_blocks_have_a_variable_length, descriptor.Blocks).
AppendLine();
sb.AppendFormat("\t" + Localization._0_blocks_have_a_variable_length, descriptor.Blocks)
.AppendLine();
}
else
{
sb.AppendFormat("\t" + Localization._0_blocks_are_1_bytes_each, descriptor.Blocks,
descriptor.BlockLength).
AppendLine();
sb.AppendFormat("\t" + Localization._0_blocks_are_1_bytes_each,
descriptor.Blocks,
descriptor.BlockLength)
.AppendLine();
}
}
}
@@ -1281,9 +1287,9 @@ public static partial class Modes
break;
}
#endregion Sequential access device mode header
#endregion Sequential access device mode header
#region Printer device mode header
#region Printer device mode header
case PeripheralDeviceTypes.PrinterDevice:
{
@@ -1298,8 +1304,8 @@ public static partial class Modes
break;
default:
sb.AppendFormat("\t" + Localization.Unknown_buffered_mode_code_0, header.Value.BufferedMode).
AppendLine();
sb.AppendFormat("\t" + Localization.Unknown_buffered_mode_code_0, header.Value.BufferedMode)
.AppendLine();
break;
}
@@ -1307,9 +1313,9 @@ public static partial class Modes
break;
}
#endregion Printer device mode header
#endregion Printer device mode header
#region Optical device mode header
#region Optical device mode header
case PeripheralDeviceTypes.OpticalDevice:
{
@@ -1348,21 +1354,18 @@ public static partial class Modes
break;
default:
sb.AppendFormat(Localization.an_unknown_medium_type_0, (byte)header.Value.MediumType).
AppendLine();
sb.AppendFormat(Localization.an_unknown_medium_type_0, (byte)header.Value.MediumType)
.AppendLine();
break;
}
}
if(header.Value.WriteProtected)
sb.AppendLine("\t" + Localization.Medium_is_write_protected);
if(header.Value.WriteProtected) sb.AppendLine("\t" + Localization.Medium_is_write_protected);
if(header.Value.EBC)
sb.AppendLine("\t" + Localization.Blank_checking_during_write_is_enabled);
if(header.Value.EBC) sb.AppendLine("\t" + Localization.Blank_checking_during_write_is_enabled);
if(header.Value.DPOFUA)
sb.AppendLine("\t" + Localization.Drive_supports_DPO_and_FUA_bits);
if(header.Value.DPOFUA) sb.AppendLine("\t" + Localization.Drive_supports_DPO_and_FUA_bits);
if(header.Value.BlockDescriptors != null)
{
@@ -1422,55 +1425,60 @@ public static partial class Modes
{
if(descriptor.BlockLength == 0)
{
sb.
AppendFormat("\t" + Localization.All_remaining_blocks_are_0_and_have_a_variable_length,
density).
AppendLine();
sb.AppendFormat("\t" +
Localization.All_remaining_blocks_are_0_and_have_a_variable_length,
density)
.AppendLine();
}
else
{
sb.AppendFormat("\t" + Localization.All_remaining_blocks_are_0_and_are_1_bytes_each,
density, descriptor.BlockLength).
AppendLine();
density,
descriptor.BlockLength)
.AppendLine();
}
}
else if(descriptor.BlockLength == 0)
{
sb.AppendFormat("\t" + Localization._0_blocks_are_1_and_have_a_variable_length,
descriptor.Blocks, density).
AppendLine();
descriptor.Blocks,
density)
.AppendLine();
}
else
{
sb.AppendFormat("\t" + Localization._0_blocks_are_1_and_are_2_bytes_each,
descriptor.Blocks, density, descriptor.BlockLength).
AppendLine();
descriptor.Blocks,
density,
descriptor.BlockLength)
.AppendLine();
}
}
else if(descriptor.Blocks == 0)
{
if(descriptor.BlockLength == 0)
{
sb.AppendFormat("\t" + Localization.All_remaining_blocks_have_a_variable_length).
AppendLine();
sb.AppendFormat("\t" + Localization.All_remaining_blocks_have_a_variable_length)
.AppendLine();
}
else
{
sb.AppendFormat("\t" + Localization.All_remaining_blocks_are_0_bytes_each,
descriptor.BlockLength).
AppendLine();
descriptor.BlockLength)
.AppendLine();
}
}
else if(descriptor.BlockLength == 0)
{
sb.AppendFormat("\t" + Localization._0_blocks_have_a_variable_length, descriptor.Blocks).
AppendLine();
sb.AppendFormat("\t" + Localization._0_blocks_have_a_variable_length, descriptor.Blocks)
.AppendLine();
}
else
{
sb.AppendFormat("\t" + Localization._0_blocks_are_1_bytes_each, descriptor.Blocks,
descriptor.BlockLength).
AppendLine();
sb.AppendFormat("\t" + Localization._0_blocks_are_1_bytes_each,
descriptor.Blocks,
descriptor.BlockLength)
.AppendLine();
}
}
}
@@ -1478,9 +1486,9 @@ public static partial class Modes
break;
}
#endregion Optical device mode header
#endregion Optical device mode header
#region Multimedia device mode header
#region Multimedia device mode header
case PeripheralDeviceTypes.MultiMediaDevice:
{
@@ -1638,11 +1646,9 @@ public static partial class Modes
break;
}
if(header.Value.WriteProtected)
sb.AppendLine("\t" + Localization.Medium_is_write_protected);
if(header.Value.WriteProtected) sb.AppendLine("\t" + Localization.Medium_is_write_protected);
if(header.Value.DPOFUA)
sb.AppendLine("\t" + Localization.Drive_supports_DPO_and_FUA_bits);
if(header.Value.DPOFUA) sb.AppendLine("\t" + Localization.Drive_supports_DPO_and_FUA_bits);
if(header.Value.BlockDescriptors != null)
{
@@ -1698,27 +1704,31 @@ public static partial class Modes
if(descriptor.Blocks == 0)
{
sb.AppendFormat("\t" + Localization.All_remaining_blocks_have_0_and_are_1_bytes_each,
density, descriptor.BlockLength).
AppendLine();
density,
descriptor.BlockLength)
.AppendLine();
}
else
{
sb.AppendFormat("\t" + Localization._0_blocks_have_1_and_are_2_bytes_each,
descriptor.Blocks, density, descriptor.BlockLength).
AppendLine();
descriptor.Blocks,
density,
descriptor.BlockLength)
.AppendLine();
}
}
else if(descriptor.Blocks == 0)
{
sb.AppendFormat("\t" + Localization.All_remaining_blocks_are_0_bytes_each,
descriptor.BlockLength).
AppendLine();
descriptor.BlockLength)
.AppendLine();
}
else
{
sb.AppendFormat("\t" + Localization._0_blocks_are_1_bytes_each, descriptor.Blocks,
descriptor.BlockLength).
AppendLine();
sb.AppendFormat("\t" + Localization._0_blocks_are_1_bytes_each,
descriptor.Blocks,
descriptor.BlockLength)
.AppendLine();
}
}
}
@@ -1726,7 +1736,7 @@ public static partial class Modes
break;
}
#endregion Multimedia device mode header
#endregion Multimedia device mode header
}
return sb.ToString();

View File

@@ -45,14 +45,12 @@ public static partial class Modes
{
public static ModeHeader? DecodeModeHeader10(byte[] modeResponse, PeripheralDeviceTypes deviceType)
{
if(modeResponse == null || modeResponse.Length < 8)
return null;
if(modeResponse == null || modeResponse.Length < 8) return null;
var modeLength = (ushort)((modeResponse[0] << 8) + modeResponse[1]);
var blockDescLength = (ushort)((modeResponse[6] << 8) + modeResponse[7]);
if(modeResponse.Length < modeLength)
return null;
if(modeResponse.Length < modeLength) return null;
var header = new ModeHeader
{
@@ -69,8 +67,7 @@ public static partial class Modes
for(var i = 0; i < header.BlockDescriptors.Length; i++)
{
if(12 + i * 16 + 8 >= modeResponse.Length)
break;
if(12 + i * 16 + 8 >= modeResponse.Length) break;
header.BlockDescriptors[i] = new BlockDescriptor
{
@@ -99,8 +96,7 @@ public static partial class Modes
for(var i = 0; i < header.BlockDescriptors.Length; i++)
{
if(7 + i * 8 + 8 >= modeResponse.Length)
break;
if(7 + i * 8 + 8 >= modeResponse.Length) break;
header.BlockDescriptors[i] = new BlockDescriptor();
@@ -158,8 +154,7 @@ public static partial class Modes
{
ModeHeader? hdr = DecodeModeHeader10(modeResponse, deviceType);
if(!hdr.HasValue)
return null;
if(!hdr.HasValue) return null;
var decoded = new DecodedMode
{
@@ -170,8 +165,7 @@ public static partial class Modes
int offset;
var blkDrLength = 0;
if(decoded.Header.BlockDescriptors != null)
blkDrLength = decoded.Header.BlockDescriptors.Length;
if(decoded.Header.BlockDescriptors != null) blkDrLength = decoded.Header.BlockDescriptors.Length;
if(longlba)
offset = 8 + blkDrLength * 16;
@@ -182,8 +176,7 @@ public static partial class Modes
length += modeResponse[1];
length += 2;
if(length != modeResponse.Length)
return decoded;
if(length != modeResponse.Length) return decoded;
List<ModePage> listpages = new();
@@ -269,16 +262,13 @@ public static partial class Modes
{
case PeripheralDeviceTypes.DirectAccess:
case PeripheralDeviceTypes.MultiMediaDevice:
if(header.WriteProtected)
hdr[3] += 0x80;
if(header.WriteProtected) hdr[3] += 0x80;
if(header.DPOFUA)
hdr[3] += 0x10;
if(header.DPOFUA) hdr[3] += 0x10;
break;
case PeripheralDeviceTypes.SequentialAccess:
if(header.WriteProtected)
hdr[3] += 0x80;
if(header.WriteProtected) hdr[3] += 0x80;
hdr[3] += (byte)(header.Speed & 0x0F);
hdr[3] += (byte)(header.BufferedMode << 4 & 0x70);
@@ -289,23 +279,18 @@ public static partial class Modes
break;
case PeripheralDeviceTypes.OpticalDevice:
if(header.WriteProtected)
hdr[3] += 0x80;
if(header.WriteProtected) hdr[3] += 0x80;
if(header.EBC)
hdr[3] += 0x01;
if(header.EBC) hdr[3] += 0x01;
if(header.DPOFUA)
hdr[3] += 0x10;
if(header.DPOFUA) hdr[3] += 0x10;
break;
}
if(longLBA)
hdr[4] += 0x01;
if(longLBA) hdr[4] += 0x01;
if(header.BlockDescriptors == null)
return hdr;
if(header.BlockDescriptors == null) return hdr;
if(longLBA)
{
@@ -351,8 +336,7 @@ public static partial class Modes
{
var modeSize = 0;
if(mode.Pages != null)
modeSize += mode.Pages.Sum(page => page.PageResponse.Length);
if(mode.Pages != null) modeSize += mode.Pages.Sum(page => page.PageResponse.Length);
byte[] hdr = EncodeModeHeader10(mode.Header, deviceType);
modeSize += hdr.Length;
@@ -360,8 +344,7 @@ public static partial class Modes
Array.Copy(hdr, 0, md, 0, hdr.Length);
if(mode.Pages == null)
return md;
if(mode.Pages == null) return md;
{
int offset = hdr.Length;

View File

@@ -45,8 +45,7 @@ public static partial class Modes
{
public static ModeHeader? DecodeModeHeader6(byte[] modeResponse, PeripheralDeviceTypes deviceType)
{
if(modeResponse == null || modeResponse.Length < 4 || modeResponse.Length < modeResponse[0] + 1)
return null;
if(modeResponse == null || modeResponse.Length < 4 || modeResponse.Length < modeResponse[0] + 1) return null;
var header = new ModeHeader
{
@@ -57,8 +56,7 @@ public static partial class Modes
{
// An incorrect size field, we cannot know if the following bytes are really the pages (probably not),
// so consider the MODE SENSE(6) response as invalid
if(modeResponse[3] + 4 > modeResponse.Length)
return null;
if(modeResponse[3] + 4 > modeResponse.Length) return null;
header.BlockDescriptors = new BlockDescriptor[modeResponse[3] / 8];
@@ -110,8 +108,7 @@ public static partial class Modes
{
ModeHeader? hdr = DecodeModeHeader6(modeResponse, deviceType);
if(!hdr.HasValue)
return null;
if(!hdr.HasValue) return null;
var decoded = new DecodedMode
{
@@ -120,14 +117,12 @@ public static partial class Modes
var blkDrLength = 0;
if(decoded.Header.BlockDescriptors != null)
blkDrLength = decoded.Header.BlockDescriptors.Length;
if(decoded.Header.BlockDescriptors != null) blkDrLength = decoded.Header.BlockDescriptors.Length;
int offset = 4 + blkDrLength * 8;
int length = modeResponse[0] + 1;
if(length != modeResponse.Length)
return decoded;
if(length != modeResponse.Length) return decoded;
List<ModePage> listpages = new();
@@ -149,14 +144,12 @@ public static partial class Modes
{
if(isSubpage)
{
if(offset + 3 >= modeResponse.Length)
break;
if(offset + 3 >= modeResponse.Length) break;
pg.PageResponse = new byte[(modeResponse[offset + 2] << 8) + modeResponse[offset + 3] + 4];
int copyLen = pg.PageResponse.Length;
if(pg.PageResponse.Length + offset > modeResponse.Length)
copyLen = modeResponse.Length - offset;
if(pg.PageResponse.Length + offset > modeResponse.Length) copyLen = modeResponse.Length - offset;
Array.Copy(modeResponse, offset, pg.PageResponse, 0, copyLen);
pg.Page = (byte)(modeResponse[offset] & 0x3F);
@@ -165,14 +158,12 @@ public static partial class Modes
}
else
{
if(offset + 1 >= modeResponse.Length)
break;
if(offset + 1 >= modeResponse.Length) break;
pg.PageResponse = new byte[modeResponse[offset + 1] + 2];
int copyLen = pg.PageResponse.Length;
if(pg.PageResponse.Length + offset > modeResponse.Length)
copyLen = modeResponse.Length - offset;
if(pg.PageResponse.Length + offset > modeResponse.Length) copyLen = modeResponse.Length - offset;
Array.Copy(modeResponse, offset, pg.PageResponse, 0, copyLen);
pg.Page = (byte)(modeResponse[offset] & 0x3F);
@@ -199,16 +190,13 @@ public static partial class Modes
{
case PeripheralDeviceTypes.DirectAccess:
case PeripheralDeviceTypes.MultiMediaDevice:
if(header.WriteProtected)
hdr[2] += 0x80;
if(header.WriteProtected) hdr[2] += 0x80;
if(header.DPOFUA)
hdr[2] += 0x10;
if(header.DPOFUA) hdr[2] += 0x10;
break;
case PeripheralDeviceTypes.SequentialAccess:
if(header.WriteProtected)
hdr[2] += 0x80;
if(header.WriteProtected) hdr[2] += 0x80;
hdr[2] += (byte)(header.Speed & 0x0F);
hdr[2] += (byte)(header.BufferedMode << 4 & 0x70);
@@ -219,20 +207,16 @@ public static partial class Modes
break;
case PeripheralDeviceTypes.OpticalDevice:
if(header.WriteProtected)
hdr[2] += 0x80;
if(header.WriteProtected) hdr[2] += 0x80;
if(header.EBC)
hdr[2] += 0x01;
if(header.EBC) hdr[2] += 0x01;
if(header.DPOFUA)
hdr[2] += 0x10;
if(header.DPOFUA) hdr[2] += 0x10;
break;
}
if(header.BlockDescriptors == null)
return hdr;
if(header.BlockDescriptors == null) return hdr;
hdr[3] = (byte)(header.BlockDescriptors.Length * 8);
@@ -254,8 +238,7 @@ public static partial class Modes
{
var modeSize = 0;
if(mode.Pages != null)
modeSize += mode.Pages.Sum(page => page.PageResponse.Length);
if(mode.Pages != null) modeSize += mode.Pages.Sum(page => page.PageResponse.Length);
byte[] hdr = EncodeModeHeader6(mode.Header, deviceType);
modeSize += hdr.Length;
@@ -263,8 +246,7 @@ public static partial class Modes
Array.Copy(hdr, 0, md, 0, hdr.Length);
if(mode.Pages == null)
return md;
if(mode.Pages == null) return md;
{
int offset = hdr.Length;