Move all localizable strings from Aaru.Core project to resources.

This commit is contained in:
2022-11-23 16:06:46 +00:00
parent 81195f8630
commit 938b40f774
94 changed files with 16438 additions and 3011 deletions

View File

@@ -122,7 +122,7 @@ public sealed partial class MediaScan
if(ataReader.IsLba)
{
UpdateStatus?.Invoke($"Reading {blocksToRead} sectors at a time.");
UpdateStatus?.Invoke(string.Format(Localization.Core.Reading_0_sectors_at_a_time, blocksToRead));
InitBlockMap?.Invoke(results.Blocks, blockSize, blocksToRead, ataProfile);
mhddLog = new MhddLog(_mhddLogPath, _dev, results.Blocks, blockSize, blocksToRead, false);
@@ -149,8 +149,9 @@ public sealed partial class MediaScan
currentSpeed > 0)
results.MinSpeed = currentSpeed;
UpdateProgress?.Invoke($"Reading sector {i} of {results.Blocks} ({currentSpeed:F3} MiB/sec.)",
(long)i, (long)results.Blocks);
UpdateProgress?.
Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2_MiB_sec, i, results.Blocks, currentSpeed),
(long)i, (long)results.Blocks);
bool error = ataReader.ReadBlocks(out cmdBuf, i, blocksToRead, out duration, out _, out _);
@@ -232,7 +233,7 @@ public sealed partial class MediaScan
uint seekPos = (uint)rnd.Next((int)results.Blocks);
PulseProgress?.Invoke($"Seeking to sector {seekPos}...\t\t");
PulseProgress?.Invoke(string.Format(Localization.Core.Seeking_to_sector_0, seekPos));
ataReader.Seek(seekPos, out seekCur);
@@ -280,8 +281,9 @@ public sealed partial class MediaScan
currentSpeed > 0)
results.MinSpeed = currentSpeed;
PulseProgress?.Invoke($"Reading cylinder {cy} head {hd} sector {sc} ({currentSpeed
:F3} MiB/sec.)");
PulseProgress?.
Invoke(string.Format(Localization.Core.Reading_cylinder_0_head_1_sector_2_3_MiB_sec, cy,
hd, sc, currentSpeed));
bool error = ataReader.ReadChs(out cmdBuf, cy, hd, sc, out duration, out _);
@@ -365,7 +367,8 @@ public sealed partial class MediaScan
byte seekHd = (byte)rnd.Next(heads);
byte seekSc = (byte)rnd.Next(sectors);
PulseProgress?.Invoke($"\rSeeking to cylinder {seekCy}, head {seekHd}, sector {seekSc}...\t\t");
PulseProgress?.Invoke(string.Format(Localization.Core.Seeking_to_cylinder_0_head_1_sector_2,
seekCy, seekHd, seekSc));
ataReader.SeekChs(seekCy, seekHd, seekSc, out seekCur);
@@ -392,7 +395,7 @@ public sealed partial class MediaScan
return results;
}
StoppingErrorMessage?.Invoke("Unable to communicate with ATA device.");
StoppingErrorMessage?.Invoke(Localization.Core.Unable_to_communicate_with_ATA_device);
return results;
}

View File

@@ -81,7 +81,7 @@ public sealed partial class MediaScan
case DeviceType.NVMe: return Nvme();
case DeviceType.ATAPI:
case DeviceType.SCSI: return Scsi();
default: throw new NotSupportedException("Unknown device type.");
default: throw new NotSupportedException(Localization.Core.Unknown_device_type);
}
}

View File

@@ -36,7 +36,7 @@ public sealed partial class MediaScan
{
ScanResults Nvme()
{
StoppingErrorMessage?.Invoke("NVMe devices not yet supported.");
StoppingErrorMessage?.Invoke(Localization.Core.NVMe_devices_not_yet_supported);
return default;
}

View File

@@ -78,7 +78,7 @@ public sealed partial class MediaScan
while(leftRetries > 0)
{
PulseProgress?.Invoke("Waiting for drive to become ready");
PulseProgress?.Invoke(Localization.Core.Waiting_for_drive_to_become_ready);
Thread.Sleep(2000);
sense = _dev.ScsiTestUnitReady(out senseBuf, _dev.Timeout, out _);
@@ -90,7 +90,7 @@ public sealed partial class MediaScan
if(sense)
{
StoppingErrorMessage?.Invoke("Please insert media in drive");
StoppingErrorMessage?.Invoke(Localization.Core.Please_insert_media_in_drive);
return results;
}
@@ -103,7 +103,7 @@ public sealed partial class MediaScan
while(leftRetries > 0)
{
PulseProgress?.Invoke("Waiting for drive to become ready");
PulseProgress?.Invoke(Localization.Core.Waiting_for_drive_to_become_ready);
Thread.Sleep(2000);
sense = _dev.ScsiTestUnitReady(out senseBuf, _dev.Timeout, out _);
@@ -115,8 +115,9 @@ public sealed partial class MediaScan
if(sense)
{
StoppingErrorMessage?.Invoke($"Error testing unit was ready:\n{
Sense.PrettifySense(senseBuf)}");
StoppingErrorMessage?.
Invoke(string.Format(Localization.Core.Error_testing_unit_was_ready_0,
Sense.PrettifySense(senseBuf)));
return results;
}
@@ -131,7 +132,7 @@ public sealed partial class MediaScan
while(leftRetries > 0)
{
PulseProgress?.Invoke("Waiting for drive to become ready");
PulseProgress?.Invoke(Localization.Core.Waiting_for_drive_to_become_ready);
Thread.Sleep(2000);
sense = _dev.ScsiTestUnitReady(out senseBuf, _dev.Timeout, out _);
@@ -143,8 +144,9 @@ public sealed partial class MediaScan
if(sense)
{
StoppingErrorMessage?.Invoke($"Error testing unit was ready:\n{
Sense.PrettifySense(senseBuf)}");
StoppingErrorMessage?.
Invoke(string.Format(Localization.Core.Error_testing_unit_was_ready_0,
Sense.PrettifySense(senseBuf)));
return results;
}
@@ -152,14 +154,14 @@ public sealed partial class MediaScan
break;
}
default:
StoppingErrorMessage?.Invoke($"Error testing unit was ready:\n{Sense.PrettifySense(senseBuf)
}");
StoppingErrorMessage?.Invoke(string.Format(Localization.Core.Error_testing_unit_was_ready_0,
Sense.PrettifySense(senseBuf)));
return results;
}
else
{
StoppingErrorMessage?.Invoke("Unknown testing unit was ready.");
StoppingErrorMessage?.Invoke(Localization.Core.Unknown_testing_unit_was_ready);
return results;
}
@@ -185,7 +187,7 @@ public sealed partial class MediaScan
if(!foundReadCommand &&
_dev.ScsiType != PeripheralDeviceTypes.MultiMediaDevice)
{
StoppingErrorMessage?.Invoke("Unable to read medium.");
StoppingErrorMessage?.Invoke(Localization.Core.Unable_to_read_medium);
return results;
}
@@ -202,28 +204,38 @@ public sealed partial class MediaScan
switch(totalSize)
{
case > 1099511627776:
UpdateStatus?.Invoke($"Media has {results.Blocks} blocks of {blockSize
} bytes/each. (for a total of {totalSize / 1099511627776d:F3} TiB)");
UpdateStatus?.
Invoke(string.
Format(Localization.Core.Media_has_0_blocks_of_1_bytes_each_for_a_total_of_2_TiB,
results.Blocks, blockSize, totalSize / 1099511627776d));
break;
case > 1073741824:
UpdateStatus?.Invoke($"Media has {results.Blocks} blocks of {blockSize
} bytes/each. (for a total of {totalSize / 1073741824d:F3} GiB)");
UpdateStatus?.
Invoke(string.
Format(Localization.Core.Media_has_0_blocks_of_1_bytes_each_for_a_total_of_2_GiB,
results.Blocks, blockSize, totalSize / 1073741824d));
break;
case > 1048576:
UpdateStatus?.Invoke($"Media has {results.Blocks} blocks of {blockSize
} bytes/each. (for a total of {totalSize / 1048576d:F3} MiB)");
UpdateStatus?.
Invoke(string.
Format(Localization.Core.Media_has_0_blocks_of_1_bytes_each_for_a_total_of_2_MiB,
results.Blocks, blockSize, totalSize / 1048576d));
break;
case > 1024:
UpdateStatus?.Invoke($"Media has {results.Blocks} blocks of {blockSize
} bytes/each. (for a total of {totalSize / 1024d:F3} KiB)");
UpdateStatus?.
Invoke(string.
Format(Localization.Core.Media_has_0_blocks_of_1_bytes_each_for_a_total_of_2_KiB,
results.Blocks, blockSize, totalSize / 1024d));
break;
default:
UpdateStatus?.Invoke($"Media has {results.Blocks} blocks of {blockSize
} bytes/each. (for a total of {totalSize} bytes)");
UpdateStatus?.
Invoke(string.
Format(Localization.Core.Media_has_0_blocks_of_1_bytes_each_for_a_total_of_2_bytes,
results.Blocks, blockSize, totalSize));
break;
}
@@ -231,16 +243,14 @@ public sealed partial class MediaScan
break;
case PeripheralDeviceTypes.SequentialAccess:
StoppingErrorMessage?.Invoke("Scanning will never be supported on SCSI Streaming Devices." +
Environment.NewLine +
"It has no sense to do it, and it will put too much strain on the tape.");
StoppingErrorMessage?.Invoke(Localization.Core.Scanning_never_supported_in_SSC);
return results;
}
if(results.Blocks == 0)
{
StoppingErrorMessage?.Invoke("Unable to read medium or empty medium present...");
StoppingErrorMessage?.Invoke(Localization.Core.Unable_to_read_medium_or_empty_medium_present);
return results;
}
@@ -315,7 +325,7 @@ public sealed partial class MediaScan
if(toc == null)
{
StoppingErrorMessage?.Invoke("Error trying to decode TOC...");
StoppingErrorMessage?.Invoke(Localization.Core.Error_trying_to_decode_TOC);
return results;
}
@@ -325,10 +335,10 @@ public sealed partial class MediaScan
_dev.Timeout, out _);
if(readcd)
UpdateStatus?.Invoke("Using MMC READ CD command.");
UpdateStatus?.Invoke(Localization.Core.Using_MMC_READ_CD_command);
else if(!foundReadCommand)
{
StoppingErrorMessage?.Invoke("Unable to read medium.");
StoppingErrorMessage?.Invoke(Localization.Core.Unable_to_read_medium);
return results;
}
@@ -352,12 +362,14 @@ public sealed partial class MediaScan
if(_dev.Error)
{
StoppingErrorMessage?.Invoke($"Device error {_dev.LastError} trying to guess ideal transfer length.");
StoppingErrorMessage?.
Invoke(string.Format(Localization.Core.Device_error_0_trying_to_guess_ideal_transfer_length,
_dev.LastError));
return results;
}
UpdateStatus?.Invoke($"Reading {blocksToRead} sectors at a time.");
UpdateStatus?.Invoke(string.Format(Localization.Core.Reading_0_sectors_at_a_time, blocksToRead));
InitBlockMap?.Invoke(results.Blocks, blockSize, blocksToRead, currentProfile);
mhddLog = new MhddLog(_mhddLogPath, _dev, results.Blocks, blockSize, blocksToRead, false);
@@ -385,8 +397,9 @@ public sealed partial class MediaScan
currentSpeed > 0)
results.MinSpeed = currentSpeed;
UpdateProgress?.Invoke($"Reading sector {i} of {results.Blocks} ({currentSpeed:F3} MiB/sec.)", (long)i,
(long)results.Blocks);
UpdateProgress?.
Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2_MiB_sec, i, results.Blocks, currentSpeed),
(long)i, (long)results.Blocks);
if(readcd)
sense = _dev.ReadCd(out _, out senseBuf, (uint)i, 2352, blocksToRead, MmcSectorTypes.AllTypes,
@@ -437,7 +450,8 @@ public sealed partial class MediaScan
if(readcd)
{
AaruConsole.DebugWriteLine("Media-Scan", "READ CD error:\n{0}", Sense.PrettifySense(senseBuf));
AaruConsole.DebugWriteLine("Media-Scan", Localization.Core.READ_CD_error_0,
Sense.PrettifySense(senseBuf));
senseDecoded = Sense.Decode(senseBuf);
@@ -512,7 +526,7 @@ public sealed partial class MediaScan
{
start = DateTime.UtcNow;
UpdateStatus?.Invoke($"Reading {scsiReader.BlocksToRead} sectors at a time.");
UpdateStatus?.Invoke(string.Format(Localization.Core.Reading_0_sectors_at_a_time, scsiReader.BlocksToRead));
InitBlockMap?.Invoke(results.Blocks, blockSize, scsiReader.BlocksToRead, currentProfile);
mhddLog = new MhddLog(_mhddLogPath, _dev, results.Blocks, blockSize, scsiReader.BlocksToRead, false);
@@ -540,8 +554,9 @@ public sealed partial class MediaScan
currentSpeed > 0)
results.MinSpeed = currentSpeed;
UpdateProgress?.Invoke($"Reading sector {i} of {results.Blocks} ({currentSpeed:F3} MiB/sec.)", (long)i,
(long)results.Blocks);
UpdateProgress?.
Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2_MiB_sec, i, results.Blocks, currentSpeed),
(long)i, (long)results.Blocks);
sense = scsiReader.ReadBlocks(out _, i, blocksToRead, out double cmdDuration, out _, out _);
results.ProcessingTime += cmdDuration;
@@ -633,7 +648,7 @@ public sealed partial class MediaScan
uint seekPos = (uint)rnd.Next((int)results.Blocks);
PulseProgress?.Invoke($"Seeking to sector {seekPos}...\t\t");
PulseProgress?.Invoke(string.Format(Localization.Core.Seeking_to_sector_0, seekPos));
double seekCur;

View File

@@ -134,7 +134,7 @@ public sealed partial class MediaScan
if(results.Blocks == 0)
{
StoppingErrorMessage?.Invoke("Unable to get device size.");
StoppingErrorMessage?.Invoke(Localization.Core.Unable_to_get_device_size);
return results;
}
@@ -145,7 +145,8 @@ public sealed partial class MediaScan
if(sense || _dev.Error)
{
UpdateStatus?.Invoke("Environment does not support setting block count, downgrading to OS reading.");
UpdateStatus?.Invoke(Localization.Core.
Environment_does_not_support_setting_block_count_downgrading_to_OS_reading);
supportsCmd23 = false;
}
@@ -155,7 +156,7 @@ public sealed partial class MediaScan
if(sense)
{
StoppingErrorMessage?.Invoke($"Error {_dev.LastError} reopening device.");
StoppingErrorMessage?.Invoke(string.Format(Localization.Core.Error_0_reopening_device, _dev.LastError));
return results;
}
@@ -178,7 +179,9 @@ public sealed partial class MediaScan
if(sense)
{
StoppingErrorMessage?.Invoke($"Device error {_dev.LastError} trying to guess ideal transfer length.");
StoppingErrorMessage?.
Invoke(string.Format(Localization.Core.Device_error_0_trying_to_guess_ideal_transfer_length,
_dev.LastError));
return results;
}
@@ -206,11 +209,13 @@ public sealed partial class MediaScan
var rnd = new Random();
if(supportsCmd23 || blocksToRead == 1)
UpdateStatus?.Invoke($"Reading {blocksToRead} sectors at a time.");
UpdateStatus?.Invoke(string.Format(Localization.Core.Reading_0_sectors_at_a_time, blocksToRead));
else if(_useBufferedReads)
UpdateStatus?.Invoke($"Reading {blocksToRead} sectors at a time using OS buffered reads.");
UpdateStatus?.Invoke(string.Format(Localization.Core.Reading_0_sectors_at_a_time_using_OS_buffered_reads,
blocksToRead));
else
UpdateStatus?.Invoke($"Reading {blocksToRead} sectors using sequential single commands.");
UpdateStatus?.Invoke(string.Format(Localization.Core.Reading_0_sectors_using_sequential_single_commands,
blocksToRead));
InitBlockMap?.Invoke(results.Blocks, blockSize, blocksToRead, sdProfile);
var mhddLog = new MhddLog(_mhddLogPath, _dev, results.Blocks, blockSize, blocksToRead, false);
@@ -237,8 +242,9 @@ public sealed partial class MediaScan
currentSpeed > 0)
results.MinSpeed = currentSpeed;
UpdateProgress?.Invoke($"Reading sector {i} of {results.Blocks} ({currentSpeed:F3} MiB/sec.)", (long)i,
(long)results.Blocks);
UpdateProgress?.
Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2_MiB_sec, i, results.Blocks, currentSpeed),
(long)i, (long)results.Blocks);
bool error;
@@ -330,7 +336,7 @@ public sealed partial class MediaScan
uint seekPos = (uint)rnd.Next((int)results.Blocks);
PulseProgress?.Invoke($"Seeking to sector {seekPos}...\t\t");
PulseProgress?.Invoke(string.Format(Localization.Core.Seeking_to_sector_0, seekPos));
_dev.ReadSingleBlock(out cmdBuf, out _, seekPos, blockSize, byteAddressed, timeout, out double seekCur);