FindMyFiles

FindMyFiles.Engine

FfiEngineClient Class

In-proc engine client over fmf_engine.dll. Events arrive on engine threads; consumers marshal to the UI thread themselves.

public sealed class FfiEngineClient : FindMyFiles.Engine.IEngineClient, System.IDisposable

Inheritance System.Object → FfiEngineClient

Implements IEngineClient, System.IDisposable

Constructors

FfiEngineClient() Constructor

Creates the in-proc engine over the default machine index at %ProgramData%\find-my-files\index.

public FfiEngineClient();

Properties

FfiEngineClient.Connection Property

In-proc: no transport, no state transitions.

public FindMyFiles.Engine.EngineConnectionState Connection { get; }

Implements Connection

Property Value

EngineConnectionState

FfiEngineClient.IsScopeMode Property

True when this client runs in scope mode (ADR-0024: folder-walk over FindMyFiles.Engine.FfiEngineClient._scopeRoots) rather than whole-volume mode. Lets the ViewModel pick the scope-vs-privileged UI without reaching past IEngineClient.

public bool IsScopeMode { get; }

Property Value

System.Boolean

Methods

FfiEngineClient.CreateScope(IReadOnlyList<string>, IReadOnlyList<string>) Method

Creates a non-elevated **scope-mode** engine (ADR-0024) indexing only roots by folder-walk — no admin, no service. The index and the engine log both live under the portable data root (AppPaths): <exe>\data\{index,logs} by default, so scope mode pollutes nothing outside the app's own folder.

public static FindMyFiles.Engine.FfiEngineClient CreateScope(System.Collections.Generic.IReadOnlyList<string> roots, System.Collections.Generic.IReadOnlyList<string> excludes);

Parameters

roots System.Collections.Generic.IReadOnlyList<System.String>

Absolute folder roots to folder-walk and index.

excludes System.Collections.Generic.IReadOnlyList<System.String>

Absolute subfolders to prune from the walk (ADR-0025).

Returns

FfiEngineClient
A scope-mode client over the portable data root.

FfiEngineClient.Dispose() Method

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose();

Implements Dispose()

FfiEngineClient.GetStatsAsync(CancellationToken) Method

Observability snapshot for the performance panel.

public System.Threading.Tasks.Task<FindMyFiles.Engine.EngineStatsData?> GetStatsAsync(System.Threading.CancellationToken ct=default(System.Threading.CancellationToken));

Parameters

ct System.Threading.CancellationToken

Cooperative cancellation token.

Implements GetStatsAsync(CancellationToken)

Returns

System.Threading.Tasks.Task<EngineStatsData>
The current engine stats, or null if unavailable.

FfiEngineClient.GetStatusAsync(CancellationToken) Method

Returns a snapshot of the current state (VolumeStatus) of every volume. Used for the initial display at startup and for the setup screen's decisions.

public System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<FindMyFiles.Engine.VolumeStatus>> GetStatusAsync(System.Threading.CancellationToken ct=default(System.Threading.CancellationToken));

Parameters

ct System.Threading.CancellationToken

Cooperative cancellation token.

Implements GetStatusAsync(CancellationToken)

Returns

System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<VolumeStatus>>
A snapshot of the current status of every known volume.

Exceptions

EngineUnavailableException
service unreachable

FfiEngineClient.ListVolumesAsync(CancellationToken) Method

Returns the labels of the indexed volumes (those the engine currently recognizes).

public System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<string>> ListVolumesAsync(System.Threading.CancellationToken ct=default(System.Threading.CancellationToken));

Parameters

ct System.Threading.CancellationToken

Cooperative cancellation token.

Implements ListVolumesAsync(CancellationToken)

Returns

System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<System.String>>
The labels of the volumes the engine currently knows about.

Exceptions

EngineUnavailableException
service unreachable

FfiEngineClient.SearchAsync(string, SearchOptions, CancellationToken) Method

Executes the query and returns a sort-settled result handle (Result) plus an optional timing trace. Pages are read lazily through the returned ISearchResult.

public System.Threading.Tasks.Task<FindMyFiles.Engine.SearchOutcome> SearchAsync(string query, FindMyFiles.Engine.SearchOptions options, System.Threading.CancellationToken ct=default(System.Threading.CancellationToken));

Parameters

query System.String

The query text to execute.

options SearchOptions

Search options (sort order, flags).

ct System.Threading.CancellationToken

Cooperative cancellation token.

Implements SearchAsync(string, SearchOptions, CancellationToken)

Returns

System.Threading.Tasks.Task<SearchOutcome>
The sort-ordered result handle plus an optional timing trace.

Exceptions

QuerySyntaxException
malformed query text

EngineUnavailableException
service unreachable

FfiEngineClient.StartIndexingAsync(IReadOnlyList<string>, CancellationToken) Method

Requests that indexing/re-indexing start for the given volumes (fire-and-trigger: progress arrives via VolumeUpdated / IndexChanged). MFT reads require elevation, so the work runs on the service side.

public System.Threading.Tasks.Task StartIndexingAsync(System.Collections.Generic.IReadOnlyList<string> volumes, System.Threading.CancellationToken ct=default(System.Threading.CancellationToken));

Parameters

volumes System.Collections.Generic.IReadOnlyList<System.String>

Labels of the volumes to (re)index.

ct System.Threading.CancellationToken

Cooperative cancellation token.

Implements StartIndexingAsync(IReadOnlyList<string>, CancellationToken)

Returns

System.Threading.Tasks.Task
A task that completes once the indexing request is accepted.

Exceptions

EngineUnavailableException
service unreachable

Events

FfiEngineClient.ConnectionChanged Event

Fires when the current Connection transitions. In-proc implementations never fire (always InProc). Fires from the pipe client's supervisor thread → marshal.

public event Action<EngineConnectionState>? ConnectionChanged;

Implements ConnectionChanged

Event Type

System.Action<EngineConnectionState>

FfiEngineClient.EngineErrorOccurred Event

The engine recorded a diagnostic (1=warn 2=error 3=panic). Details live in RecentErrors — pull on demand.

public event Action<int>? EngineErrorOccurred;

Implements EngineErrorOccurred

Event Type

System.Action<System.Int32>

FfiEngineClient.IndexChanged Event

New index content was published (USN apply or scan progress). The payload is the triggering volume label. The signal to re-evaluate the displayed query. Fires from an engine thread, so marshal to the UI thread (EngineEventMarshaler is the only crossing point).

public event Action<string>? IndexChanged;

Implements IndexChanged

Event Type

System.Action<System.String>

FfiEngineClient.VolumeUpdated Event

One volume's state transitioned (`Scanning`→`Ready` etc.). Emits the latest VolumeStatus. Fires from an engine thread → marshal.

public event Action<VolumeStatus>? VolumeUpdated;

Implements VolumeUpdated

Event Type

System.Action<VolumeStatus>