Class ZipArchiveService
- Namespace
- Archiver.Core.Services
- Assembly
- Archiver.Core.dll
ZIP archive service using System.IO.Compression. Never throws to callers — all errors are captured in ArchiveResult.Errors.
public sealed class ZipArchiveService : IArchiveService
- Inheritance
-
ZipArchiveService
- Implements
- Inherited Members
Constructors
ZipArchiveService(GroupPolicyOptions)
Creates the service under the given Group Policy (T-F261: required, never defaulted).
public ZipArchiveService(GroupPolicyOptions policy)
Parameters
policyGroupPolicyOptions
Methods
ArchiveAsync(ArchiveOptions, IProgress<ProgressReport>?, CancellationToken)
Creates one or more ZIP archives from the provided options. Never throws — errors are captured in ArchiveResult.Errors. The one exception (T-F260): cancellation throws OperationCanceledException after cleanup, whether it lands inside one source or between two.
public Task<ArchiveResult> ArchiveAsync(ArchiveOptions options, IProgress<ProgressReport>? progress = null, CancellationToken cancellationToken = default)
Parameters
optionsArchiveOptionsprogressIProgress<ProgressReport>cancellationTokenCancellationToken
Returns
ExtractAsync(ExtractOptions, IProgress<ProgressReport>?, CancellationToken)
Extracts one or more ZIP archives. Never throws — errors are captured in ArchiveResult.Errors. The one exception (T-F260): cancellation throws OperationCanceledException after cleanup, whether it lands inside one archive or between two.
public Task<ArchiveResult> ExtractAsync(ExtractOptions options, IProgress<ProgressReport>? progress = null, CancellationToken cancellationToken = default)
Parameters
optionsExtractOptionsprogressIProgress<ProgressReport>cancellationTokenCancellationToken
Returns
ListEntriesAsync(string, CancellationToken)
Lists an archive's entries as a flat list, without extracting. Never throws — a failure (corrupted archive, IO error) is reported via ArchiveListResult.Success/ErrorMessage.
public Task<ArchiveListResult> ListEntriesAsync(string archivePath, CancellationToken cancellationToken = default)
Parameters
archivePathstringcancellationTokenCancellationToken
Returns
TestAsync(IReadOnlyList<string>, IProgress<ProgressReport>?, Func<PasswordPromptInfo, Task<PasswordDecision>>?, CancellationToken)
Verifies every entry's CRC-32 against its declared value without writing any files to disk. Never throws — errors are captured in ArchiveResult.Errors. The one exception (T-F260, T-F268): cancellation throws OperationCanceledException, whether it lands inside one archive or between two.
public Task<ArchiveResult> TestAsync(IReadOnlyList<string> archivePaths, IProgress<ProgressReport>? progress = null, Func<PasswordPromptInfo, Task<PasswordDecision>>? resolvePasswordAsync = null, CancellationToken cancellationToken = default)
Parameters
archivePathsIReadOnlyList<string>The ZIP archives to verify.
progressIProgress<ProgressReport>Optional overall-progress reporter.
resolvePasswordAsyncFunc<PasswordPromptInfo, Task<PasswordDecision>>T-F189: invoked once per encrypted archive, mirroring ResolvePasswordAsync. Null (the default — every existing caller until T-F191/T-F192 wire this) preserves the pre-T-F189 behavior exactly: "password-protected and cannot be tested." Not folded into an options record since TestAsync takes a flat path list rather than an Options type; placed before
cancellationToken(CA1068 — CancellationToken must be last).cancellationTokenCancellationTokenCancels the operation.