[Refactor] Fix indentation issues.

This commit is contained in:
2025-11-24 19:38:40 +00:00
parent 5774885431
commit 8331fba1e4
43 changed files with 1700 additions and 1751 deletions

View File

@@ -46,7 +46,7 @@ public sealed partial class DeviceReport
/// <returns>Media report</returns>
public TestedMedia ReportAtaMedia()
{
bool sense = true;
var sense = true;
AtaErrorRegistersChs errorChs = new();
AtaErrorRegistersLba28 errorLba = new();
AtaErrorRegistersLba48 errorLba48 = new();
@@ -181,7 +181,7 @@ public sealed partial class DeviceReport
mediaTest.Manufacturer = ataId.MediaManufacturer;
}
ulong checkCorrectRead = BitConverter.ToUInt64(buffer, 0);
var checkCorrectRead = BitConverter.ToUInt64(buffer, 0);
Spectre.ProgressSingleSpinner(ctx =>
{
@@ -193,11 +193,11 @@ public sealed partial class DeviceReport
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0;
AaruLogging.Debug(ATA_MODULE_NAME,
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
mediaTest.ReadSectorsData = readBuf;
@@ -211,11 +211,11 @@ public sealed partial class DeviceReport
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0;
AaruLogging.Debug(ATA_MODULE_NAME,
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
mediaTest.ReadSectorsRetryData = readBuf;
@@ -229,11 +229,11 @@ public sealed partial class DeviceReport
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0;
AaruLogging.Debug(ATA_MODULE_NAME,
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
mediaTest.ReadDmaData = readBuf;
@@ -247,11 +247,11 @@ public sealed partial class DeviceReport
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0;
AaruLogging.Debug(ATA_MODULE_NAME,
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
mediaTest.ReadDmaRetryData = readBuf;
@@ -264,10 +264,10 @@ public sealed partial class DeviceReport
mediaTest.SupportsSeek = !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0;
AaruLogging.Debug(ATA_MODULE_NAME,
Localization.Core.Sense_0_Status_1_Error_2,
sense,
errorChs.Status,
errorChs.Error);
Localization.Core.Sense_0_Status_1_Error_2,
sense,
errorChs.Status,
errorChs.Error);
Spectre.ProgressSingleSpinner(ctx =>
{
@@ -279,11 +279,11 @@ public sealed partial class DeviceReport
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0;
AaruLogging.Debug(ATA_MODULE_NAME,
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
mediaTest.ReadLbaData = readBuf;
@@ -297,11 +297,11 @@ public sealed partial class DeviceReport
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0;
AaruLogging.Debug(ATA_MODULE_NAME,
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
mediaTest.ReadRetryLbaData = readBuf;
@@ -315,11 +315,11 @@ public sealed partial class DeviceReport
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0;
AaruLogging.Debug(ATA_MODULE_NAME,
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
mediaTest.ReadDmaLbaData = readBuf;
@@ -333,11 +333,11 @@ public sealed partial class DeviceReport
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0;
AaruLogging.Debug(ATA_MODULE_NAME,
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
mediaTest.ReadDmaRetryLbaData = readBuf;
@@ -350,10 +350,10 @@ public sealed partial class DeviceReport
mediaTest.SupportsSeekLba = !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0;
AaruLogging.Debug(ATA_MODULE_NAME,
Localization.Core.Sense_0_Status_1_Error_2,
sense,
errorChs.Status,
errorChs.Error);
Localization.Core.Sense_0_Status_1_Error_2,
sense,
errorChs.Status,
errorChs.Error);
Spectre.ProgressSingleSpinner(ctx =>
{
@@ -365,11 +365,11 @@ public sealed partial class DeviceReport
!sense && (errorLba48.Status & 0x01) != 0x01 && errorLba48.Error == 0 && readBuf.Length > 0;
AaruLogging.Debug(ATA_MODULE_NAME,
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
mediaTest.ReadLba48Data = readBuf;
@@ -383,11 +383,11 @@ public sealed partial class DeviceReport
!sense && (errorLba48.Status & 0x01) != 0x01 && errorLba48.Error == 0 && readBuf.Length > 0;
AaruLogging.Debug(ATA_MODULE_NAME,
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
mediaTest.ReadDmaLba48Data = readBuf;
@@ -432,11 +432,11 @@ public sealed partial class DeviceReport
BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
AaruLogging.Debug(ATA_MODULE_NAME,
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
mediaTest.ReadLongData = readBuf;
@@ -462,11 +462,11 @@ public sealed partial class DeviceReport
BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
AaruLogging.Debug(ATA_MODULE_NAME,
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
mediaTest.ReadLongRetryData = readBuf;
@@ -490,11 +490,11 @@ public sealed partial class DeviceReport
BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
AaruLogging.Debug(ATA_MODULE_NAME,
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
mediaTest.ReadLongLbaData = readBuf;
@@ -518,11 +518,11 @@ public sealed partial class DeviceReport
BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
AaruLogging.Debug(ATA_MODULE_NAME,
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
mediaTest.ReadLongRetryLbaData = readBuf;
}
@@ -535,7 +535,7 @@ public sealed partial class DeviceReport
/// <summary>Creates a report of an ATA device</summary>
public TestedMedia ReportAta(Identify.IdentifyDevice ataId)
{
bool sense = true;
var sense = true;
byte[] readBuf = [];
AtaErrorRegistersChs errorChs = new();
AtaErrorRegistersLba28 errorLba = new();
@@ -657,11 +657,11 @@ public sealed partial class DeviceReport
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0;
AaruLogging.Debug(ATA_MODULE_NAME,
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
capabilities.ReadSectorsData = readBuf;
@@ -675,11 +675,11 @@ public sealed partial class DeviceReport
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0;
AaruLogging.Debug(ATA_MODULE_NAME,
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
capabilities.ReadSectorsRetryData = readBuf;
@@ -693,11 +693,11 @@ public sealed partial class DeviceReport
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0;
AaruLogging.Debug(ATA_MODULE_NAME,
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
capabilities.ReadDmaData = readBuf;
@@ -711,11 +711,11 @@ public sealed partial class DeviceReport
!sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0 && readBuf.Length > 0;
AaruLogging.Debug(ATA_MODULE_NAME,
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
capabilities.ReadDmaRetryData = readBuf;
@@ -728,10 +728,10 @@ public sealed partial class DeviceReport
capabilities.SupportsSeek = !sense && (errorChs.Status & 0x01) != 0x01 && errorChs.Error == 0;
AaruLogging.Debug(ATA_MODULE_NAME,
Localization.Core.Sense_0_Status_1_Error_2,
sense,
errorChs.Status,
errorChs.Error);
Localization.Core.Sense_0_Status_1_Error_2,
sense,
errorChs.Status,
errorChs.Error);
Spectre.ProgressSingleSpinner(ctx =>
{
@@ -743,11 +743,11 @@ public sealed partial class DeviceReport
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0;
AaruLogging.Debug(ATA_MODULE_NAME,
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorLba.Status,
errorLba.Error,
readBuf.Length);
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorLba.Status,
errorLba.Error,
readBuf.Length);
capabilities.ReadLbaData = readBuf;
@@ -761,11 +761,11 @@ public sealed partial class DeviceReport
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0;
AaruLogging.Debug(ATA_MODULE_NAME,
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorLba.Status,
errorLba.Error,
readBuf.Length);
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorLba.Status,
errorLba.Error,
readBuf.Length);
capabilities.ReadRetryLbaData = readBuf;
@@ -779,11 +779,11 @@ public sealed partial class DeviceReport
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0;
AaruLogging.Debug(ATA_MODULE_NAME,
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorLba.Status,
errorLba.Error,
readBuf.Length);
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorLba.Status,
errorLba.Error,
readBuf.Length);
capabilities.ReadDmaLbaData = readBuf;
@@ -797,11 +797,11 @@ public sealed partial class DeviceReport
!sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0 && readBuf.Length > 0;
AaruLogging.Debug(ATA_MODULE_NAME,
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorLba.Status,
errorLba.Error,
readBuf.Length);
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorLba.Status,
errorLba.Error,
readBuf.Length);
capabilities.ReadDmaRetryLbaData = readBuf;
@@ -814,10 +814,10 @@ public sealed partial class DeviceReport
capabilities.SupportsSeekLba = !sense && (errorLba.Status & 0x01) != 0x01 && errorLba.Error == 0;
AaruLogging.Debug(ATA_MODULE_NAME,
Localization.Core.Sense_0_Status_1_Error_2,
sense,
errorLba.Status,
errorLba.Error);
Localization.Core.Sense_0_Status_1_Error_2,
sense,
errorLba.Status,
errorLba.Error);
Spectre.ProgressSingleSpinner(ctx =>
{
@@ -829,11 +829,11 @@ public sealed partial class DeviceReport
!sense && (errorLba48.Status & 0x01) != 0x01 && errorLba48.Error == 0 && readBuf.Length > 0;
AaruLogging.Debug(ATA_MODULE_NAME,
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorLba48.Status,
errorLba48.Error,
readBuf.Length);
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorLba48.Status,
errorLba48.Error,
readBuf.Length);
capabilities.ReadLba48Data = readBuf;
@@ -847,11 +847,11 @@ public sealed partial class DeviceReport
!sense && (errorLba48.Status & 0x01) != 0x01 && errorLba48.Error == 0 && readBuf.Length > 0;
AaruLogging.Debug(ATA_MODULE_NAME,
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorLba48.Status,
errorLba48.Error,
readBuf.Length);
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorLba48.Status,
errorLba48.Error,
readBuf.Length);
capabilities.ReadDmaLba48Data = readBuf;
@@ -896,11 +896,11 @@ public sealed partial class DeviceReport
BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
AaruLogging.Debug(ATA_MODULE_NAME,
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
capabilities.ReadLongData = readBuf;
@@ -926,11 +926,11 @@ public sealed partial class DeviceReport
BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
AaruLogging.Debug(ATA_MODULE_NAME,
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorChs.Status,
errorChs.Error,
readBuf.Length);
capabilities.ReadLongRetryData = readBuf;
@@ -954,11 +954,11 @@ public sealed partial class DeviceReport
BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
AaruLogging.Debug(ATA_MODULE_NAME,
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorLba.Status,
errorLba.Error,
readBuf.Length);
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorLba.Status,
errorLba.Error,
readBuf.Length);
capabilities.ReadLongLbaData = readBuf;
@@ -982,11 +982,11 @@ public sealed partial class DeviceReport
BitConverter.ToUInt64(readBuf, 0) != checkCorrectRead;
AaruLogging.Debug(ATA_MODULE_NAME,
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorLba.Status,
errorLba.Error,
readBuf.Length);
Localization.Core.Sense_0_Status_1_Error_2_Length_3,
sense,
errorLba.Status,
errorLba.Error,
readBuf.Length);
capabilities.ReadLongRetryLbaData = readBuf;
@@ -998,7 +998,7 @@ public sealed partial class DeviceReport
/// <returns>IDENTIFY ATA DEVICE response without the private fields</returns>
public static byte[] ClearIdentify(byte[] buffer)
{
byte[] empty = new byte[512];
var empty = new byte[512];
Array.Copy(empty, 0, buffer, 20, 20);
Array.Copy(empty, 0, buffer, 216, 8);

View File

@@ -624,7 +624,8 @@ public sealed partial class MediaScan
}
if(accumulatedSpeedMs < 100) continue;
currentSpeed = accumulatedSpeedSectors * blockSize / (1048576 * (accumulatedSpeedMs / 1000.0));
currentSpeed = accumulatedSpeedSectors * blockSize / (1048576 * (accumulatedSpeedMs / 1000.0));
ScanSpeed?.Invoke(i, currentSpeed * 1024);
accumulatedSpeedMs = 0;
accumulatedSpeedSectors = 0;

View File

@@ -66,14 +66,11 @@ public static class MMC
const string PS2_JAPANESE_HASH = "b82bffb809070d61fe050b7e1545df53d8f3cc648257cdff7502bc0ba6b38870";
const string MODULE_NAME = "Media detection";
static readonly byte[] _ps3Id =
"PlayStation3\0\0\0\0"u8.ToArray();
static readonly byte[] _ps3Id = "PlayStation3\0\0\0\0"u8.ToArray();
static readonly byte[] _ps4Id =
"PlayStation4\0\0\0\0"u8.ToArray();
static readonly byte[] _ps4Id = "PlayStation4\0\0\0\0"u8.ToArray();
static readonly byte[] _ps5Id =
"PlayStation5\0\0\0\0"u8.ToArray();
static readonly byte[] _ps5Id = "PlayStation5\0\0\0\0"u8.ToArray();
static readonly byte[] _operaId = [0x01, 0x5A, 0x5A, 0x5A, 0x5A, 0x5A, 0x01];

View File

@@ -57,17 +57,17 @@ public sealed partial class Sidecar
static void LinearMedia(IByteAddressableImage image, Guid filterId, string imagePath, FileInfo fi,
PluginRegister plugins, List<CommonTypes.AaruMetadata.Checksum> imgChecksums,
ref Metadata sidecar, Encoding encoding) => sidecar.LinearMedias =
[
new LinearMedia
{
Checksums = imgChecksums,
Image = new Image
{
Format = image.Format,
Offset = 0,
Value = Path.GetFileName(imagePath)
},
Size = image.Info.Sectors
}
];
[
new LinearMedia
{
Checksums = imgChecksums,
Image = new Image
{
Format = image.Format,
Offset = 0,
Value = Path.GetFileName(imagePath)
},
Size = image.Info.Sectors
}
];
}

View File

@@ -148,7 +148,7 @@ public sealed partial class Sidecar
else
{
AaruLogging.Error(Localization.Core
.The_specified_image_says_it_contains_an_optical_media_but_at_the_same_time_says_it_does_not_support_them);
.The_specified_image_says_it_contains_an_optical_media_but_at_the_same_time_says_it_does_not_support_them);
AaruLogging.Error(Localization.Core.Please_open_an_issue_at_Github);
}
@@ -160,7 +160,7 @@ public sealed partial class Sidecar
else
{
AaruLogging.Error(Localization.Core
.The_specified_image_says_it_contains_a_block_addressable_media_but_at_the_same_time_says_it_does_not_support_them);
.The_specified_image_says_it_contains_a_block_addressable_media_but_at_the_same_time_says_it_does_not_support_them);
AaruLogging.Error(Localization.Core.Please_open_an_issue_at_Github);
}
@@ -181,7 +181,7 @@ public sealed partial class Sidecar
else
{
AaruLogging.Error(Localization.Core
.The_specified_image_says_it_contains_a_byte_addressable_media_but_at_the_same_time_says_it_does_not_support_them);
.The_specified_image_says_it_contains_a_byte_addressable_media_but_at_the_same_time_says_it_does_not_support_them);
AaruLogging.Error(Localization.Core.Please_open_an_issue_at_Github);
}

View File

@@ -9,8 +9,8 @@ public static class Spectre
/// <summary>Initializes a progress bar with a single spinner</summary>
/// <param name="action">Action to execute in the progress bar</param>
public static void ProgressSingleSpinner(Action<ProgressContext> action) => AnsiConsole.Progress()
.AutoClear(true)
.HideCompleted(true)
.Columns(new TaskDescriptionColumn(), new SpinnerColumn())
.Start(action);
.AutoClear(true)
.HideCompleted(true)
.Columns(new TaskDescriptionColumn(), new SpinnerColumn())
.Start(action);
}