Table of Contents

Interface IRecoveryService

Namespace
Archiver.Core.Interfaces
Assembly
Archiver.Core.dll

PAR2 recovery data next to an archive: what is there, and repair from it (T-F275 step 4). The checks themselves are TestAsync(IReadOnlyList<string>, IProgress<ProgressReport>?, Func<PasswordPromptInfo, Task<PasswordDecision>>?, bool, CancellationToken).

public interface IRecoveryService

Methods

FindArchive(string, CancellationToken)

The file the set of par2Path protects, chosen as the test chooses it: by the hashes in the set, never by a name alone. A file that is gone is still named when the set names it. Reads the set, so a UI calls it off its thread. Never throws except OperationCanceledException.

RecoveryTarget FindArchive(string par2Path, CancellationToken cancellationToken = default)

Parameters

par2Path string
cancellationToken CancellationToken

Returns

RecoveryTarget

HasFilesFor(string)

Whether PAR2 files lie next to archivePath under either name the test looks for (a.zip.par2, a.par2, their volumes). Says nothing about whether they are usable or meant for this archive. Reads a folder listing, so a UI calls it off its thread. False under DisableRecoveryData and for a path or folder that cannot be read; never throws.

bool HasFilesFor(string archivePath)

Parameters

archivePath string

Returns

bool

RepairAsync(RepairOptions, IProgress<ProgressReport>?, CancellationToken)

Rebuilds each damaged archive into a new file, <name>.repaired<extension>, next to it or in OutputDirectory. The archive and its PAR2 files are only read. An archive is rebuilt exactly when TestAsync(IReadOnlyList<string>, IProgress<ProgressReport>?, Func<PasswordPromptInfo, Task<PasswordDecision>>?, bool, CancellationToken) with verifyRecoveryData would call it damaged and repairable; a copy is kept only after it matches the set's hashes.

CreatedFiles lists the repaired copies and RecoveryChecks what was found for each archive. An archive with no usable recovery data is an error here, since repair was asked for. Under DisableRecoveryData every path is refused. Never throws except OperationCanceledException.

Task<ArchiveResult> RepairAsync(RepairOptions options, IProgress<ProgressReport>? progress = null, CancellationToken cancellationToken = default)

Parameters

options RepairOptions
progress IProgress<ProgressReport>
cancellationToken CancellationToken

Returns

Task<ArchiveResult>