Table of Contents

Class StickyCallback<TInfo, TDecision>

Namespace
Archiver.Core.Services
Assembly
Archiver.Core.dll

Widens an "apply to all/remaining" answer beyond the single Core call that asked for it. Core's own ConflictResolver/PasswordResolver already remember such an answer, but only for the lifetime of ONE ExtractAsync/TestAsync call. A frontend that makes several calls for one user action — Archiver.Shell's per-archive loop (T-F155/T-F192), Archiver.CLI's zip/tar split through ExtractionRouter (T-F160) — wraps its prompt in one instance of this, created once per user action, so the answer spans every call. Replaced two hand-written copies of this pattern.

public sealed class StickyCallback<TInfo, TDecision> where TDecision : class

Type Parameters

TInfo

What the prompt is asked about (e.g. a conflict or a password prompt).

TDecision

The prompt's answer.

Inheritance
StickyCallback<TInfo, TDecision>
Inherited Members

Constructors

StickyCallback(Func<TInfo, Task<TDecision>>, Func<TDecision, bool>, Func<TDecision, TDecision>?)

Widens an "apply to all/remaining" answer beyond the single Core call that asked for it. Core's own ConflictResolver/PasswordResolver already remember such an answer, but only for the lifetime of ONE ExtractAsync/TestAsync call. A frontend that makes several calls for one user action — Archiver.Shell's per-archive loop (T-F155/T-F192), Archiver.CLI's zip/tar split through ExtractionRouter (T-F160) — wraps its prompt in one instance of this, created once per user action, so the answer spans every call. Replaced two hand-written copies of this pattern.

public StickyCallback(Func<TInfo, Task<TDecision>> inner, Func<TDecision, bool> isSticky, Func<TDecision, TDecision>? whenReused = null)

Parameters

inner Func<TInfo, Task<TDecision>>

Asks the user.

isSticky Func<TDecision, bool>

Whether an answer is remembered for the later calls.

whenReused Func<TDecision, TDecision>

Applied to a remembered answer each time it is handed out again, so the receiver can tell it from one given for this call (T-F301); null hands it out unchanged.

Methods

ResolveAsync(TInfo)

Returns the remembered sticky answer, or asks inner and remembers its answer when isSticky says so. Pass this method as the Core callback.

public Task<TDecision> ResolveAsync(TInfo info)

Parameters

info TInfo

Returns

Task<TDecision>