mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[Dumping] Add option to fix sectors that didn't pass integrity checks.
This commit is contained in:
@@ -254,7 +254,7 @@ partial class Dump
|
||||
pass));
|
||||
}
|
||||
|
||||
Track track = tracks.OrderBy(t => t.StartSector).LastOrDefault(t => badSector >= t.StartSector);
|
||||
Track track = tracks.OrderBy(static t => t.StartSector).LastOrDefault(t => badSector >= t.StartSector);
|
||||
|
||||
byte sectorsToReRead = 1;
|
||||
var badSectorToReRead = (uint)badSector;
|
||||
@@ -506,17 +506,38 @@ partial class Dump
|
||||
|
||||
if(correctEdc != true || correctEccP != true || correctEccQ != true)
|
||||
{
|
||||
sectorStatus = SectorStatus.Errored;
|
||||
_mediaGraph?.PaintSectorBad(badSector);
|
||||
if(_cureParanoia && correctEdc == true && correctEccP == true)
|
||||
{
|
||||
Track trk = tracks.FirstOrDefault(t => t.StartSector <= badSector &&
|
||||
t.EndSector >= badSector);
|
||||
|
||||
if(correctEdc != true)
|
||||
UpdateStatus?.Invoke(string.Format(UI.Incorrect_EDC_in_sector_0, badSector));
|
||||
SectorBuilder sb = new();
|
||||
sb.ReconstructEcc(ref sector, track.Type);
|
||||
Array.Copy(sector, 0, cmdBuf, 0, sectorSize);
|
||||
|
||||
if(correctEccP != true)
|
||||
UpdateStatus?.Invoke(string.Format(UI.Incorrect_ECC_P_in_sector_0, badSector));
|
||||
_resume.BadBlocks.Remove(badSector);
|
||||
extents.Add(badSector);
|
||||
_mediaGraph?.PaintSectorGood(badSector);
|
||||
|
||||
if(correctEccQ != true)
|
||||
UpdateStatus?.Invoke(string.Format(UI.Incorrect_ECC_Q_in_sector_0, badSector));
|
||||
UpdateStatus?.Invoke(string.Format(UI.Fixed_ECC_Q_for_sector_0,
|
||||
badSector));
|
||||
|
||||
sectorsNotEvenPartial.Remove(badSector);
|
||||
}
|
||||
else
|
||||
{
|
||||
sectorStatus = SectorStatus.Errored;
|
||||
_mediaGraph?.PaintSectorBad(badSector);
|
||||
|
||||
if(correctEdc != true)
|
||||
UpdateStatus?.Invoke(string.Format(UI.Incorrect_EDC_in_sector_0, badSector));
|
||||
|
||||
if(correctEccP != true)
|
||||
UpdateStatus?.Invoke(string.Format(UI.Incorrect_ECC_P_in_sector_0, badSector));
|
||||
|
||||
if(correctEccQ != true)
|
||||
UpdateStatus?.Invoke(string.Format(UI.Incorrect_ECC_Q_in_sector_0, badSector));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -72,6 +72,7 @@ public partial class Dump
|
||||
const string MODULE_NAME = "Media dumping";
|
||||
static readonly TimeSpan _oneSecond = 1.Seconds();
|
||||
readonly bool _createGraph;
|
||||
readonly bool _cureParanoia;
|
||||
readonly bool _debug;
|
||||
readonly Device _dev;
|
||||
readonly string _devicePath;
|
||||
@@ -167,6 +168,7 @@ public partial class Dump
|
||||
/// <param name="createGraph">If set to <c>true</c> creates a graph of the dump.</param>
|
||||
/// <param name="dimensions">Dimensions of graph in pixels for a square</param>
|
||||
/// <param name="paranoia">Check sectors integrity before writing to image</param>
|
||||
/// <param name="cureParanoia">Try to fix sectors integrity</param>
|
||||
public Dump(bool doResume, Device dev, string devicePath, IBaseWritableImage outputPlugin, ushort retryPasses,
|
||||
bool force, bool dumpRaw, bool persistent, bool stopOnError, Resume resume, Encoding encoding,
|
||||
string outputPrefix, string outputPath, Dictionary<string, string> formatOptions, Metadata preSidecar,
|
||||
@@ -174,7 +176,8 @@ public partial class Dump
|
||||
DumpSubchannel subchannel, int speed, bool @private, bool fixSubchannelPosition, bool retrySubchannel,
|
||||
bool fixSubchannel, bool fixSubchannelCrc, bool skipCdireadyHole, ErrorLog errorLog,
|
||||
bool generateSubchannels, uint maximumReadable, bool useBufferedReads, bool storeEncrypted,
|
||||
bool titleKeys, uint ignoreCdrRunOuts, bool createGraph, uint dimensions, bool paranoia)
|
||||
bool titleKeys, uint ignoreCdrRunOuts, bool createGraph, uint dimensions, bool paranoia,
|
||||
bool cureParanoia)
|
||||
{
|
||||
_doResume = doResume;
|
||||
_dev = dev;
|
||||
@@ -217,6 +220,7 @@ public partial class Dump
|
||||
_createGraph = createGraph;
|
||||
_dimensions = dimensions;
|
||||
_paranoia = paranoia;
|
||||
_cureParanoia = cureParanoia;
|
||||
_dumpStopwatch = new Stopwatch();
|
||||
_sidecarStopwatch = new Stopwatch();
|
||||
_speedStopwatch = new Stopwatch();
|
||||
|
||||
@@ -723,6 +723,7 @@ public sealed partial class MediaDumpViewModel : ViewModelBase
|
||||
10,
|
||||
true,
|
||||
1080,
|
||||
false,
|
||||
false);
|
||||
|
||||
new Thread(DoWork).Start();
|
||||
|
||||
12
Aaru.Localization/UI.Designer.cs
generated
12
Aaru.Localization/UI.Designer.cs
generated
@@ -6645,5 +6645,17 @@ namespace Aaru.Localization {
|
||||
return ResourceManager.GetString("Paranoia_help", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
public static string Cure_paranoia_help {
|
||||
get {
|
||||
return ResourceManager.GetString("Cure_paranoia_help", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
public static string Fixed_ECC_Q_for_sector_0 {
|
||||
get {
|
||||
return ResourceManager.GetString("Fixed_ECC_Q_for_sector_0", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3323,4 +3323,10 @@ Probadores:
|
||||
<data name="Paranoia_help" xml:space="preserve">
|
||||
<value>No confiar en la unidad, comprobar la integridad de los sectores antes de escribirlos en la imagen. Válido sólo para CD/GD.</value>
|
||||
</data>
|
||||
<data name="Cure_paranoia_help" xml:space="preserve">
|
||||
<value>Intentar arreglar sectores que no pasaron las pruebas de integridad.</value>
|
||||
</data>
|
||||
<data name="Fixed_ECC_Q_for_sector_0" xml:space="preserve">
|
||||
<value>[yellow]Corregido ECC Q para el sector [violet]{0}[/][/]</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -3398,4 +3398,10 @@ Do you want to continue?</value>
|
||||
<data name="Paranoia_help" xml:space="preserve">
|
||||
<value>Do not trust the drive, check the sectors integrity before writing them to the image. Valid only for CD/GD.</value>
|
||||
</data>
|
||||
<data name="Cure_paranoia_help" xml:space="preserve">
|
||||
<value>Try to fix sectors that do not pass the integrity checks.</value>
|
||||
</data>
|
||||
<data name="Fixed_ECC_Q_for_sector_0" xml:space="preserve">
|
||||
<value>[yellow]Fixed ECC Q for sector [violet]{0}[/][/]</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -122,6 +122,7 @@ sealed class DumpMediaCommand : Command<DumpMediaCommand.Settings>
|
||||
AaruLogging.Debug(MODULE_NAME, "--dimensions={0}", settings.Dimensions);
|
||||
AaruLogging.Debug(MODULE_NAME, "--aaru-metadata={0}", Markup.Escape(settings.AaruMetadata ?? ""));
|
||||
AaruLogging.Debug(MODULE_NAME, "--paranoia={0}", settings.Paranoia);
|
||||
AaruLogging.Debug(MODULE_NAME, "--cure-paranoia={0}", settings.CureParanoia);
|
||||
|
||||
// TODO: Disabled temporarily
|
||||
//AaruLogging.DebugWriteLine(MODULE_NAME, "--raw={0}", Markup.Escape(raw ?? ""));
|
||||
@@ -526,7 +527,8 @@ sealed class DumpMediaCommand : Command<DumpMediaCommand.Settings>
|
||||
(uint)settings.IgnoreCdrRunOuts,
|
||||
settings.CreateGraph,
|
||||
(uint)settings.Dimensions,
|
||||
settings.Paranoia);
|
||||
settings.Paranoia,
|
||||
settings.CureParanoia);
|
||||
|
||||
AnsiConsole.Progress()
|
||||
.AutoClear(true)
|
||||
@@ -778,6 +780,10 @@ sealed class DumpMediaCommand : Command<DumpMediaCommand.Settings>
|
||||
[CommandOption("--paranoia")]
|
||||
[DefaultValue(false)]
|
||||
public bool Paranoia { get; init; }
|
||||
[LocalizedDescription(nameof(UI.Cure_paranoia_help))]
|
||||
[CommandOption("--cure-paranoia")]
|
||||
[DefaultValue(false)]
|
||||
public bool CureParanoia { get; init; }
|
||||
[LocalizedDescription(nameof(UI.Device_path))]
|
||||
[CommandArgument(0, "<device-path>")]
|
||||
public string DevicePath { get; init; }
|
||||
|
||||
Reference in New Issue
Block a user