class

ScanState

Namespace
RefSafe.Pro
Assembly
RefSafe.Pro.Core
public sealed class ScanState : IDisposable

Tracks Pro scan state with progress reporting, cancel support, and statistics.

Remarks

Owns a CancellationTokenSource for cooperative cancellation through async runners and future Task-based callers. Implements IDisposable; callers (e.g. MainWindow.OnDisable) dispose to release the token source.

The pre-FSM boolean accessors (IsScanning, HasScanned, IsCancelled) are preserved as Phase-derived shims for one phase to keep the diff focused. Phase 5 / cleanup commit will remove them once git grep shows no remaining callers.

Properties

Phase
public ScanPhase Phase { get; private set; } = ScanPhase.Idle

No description available.

Exception
public Exception Exception { get; private set; }

The exception captured by Fault. Null unless Phase is Faulted.

Token
public CancellationToken Token { get; }

Cooperative cancellation token. Always non-default and not yet cancelled until Cancel is called or the state is disposed.

IsScanning
public bool IsScanning { get; }

No description available.

HasScanned
public bool HasScanned { get; }

No description available.

IsCancelled
public bool IsCancelled { get; }

No description available.

Progress
public float Progress { get; set; }

No description available.

ProgressMessage
public string ProgressMessage { get; set; }

No description available.

ScanDurationSeconds
public float ScanDurationSeconds { get; private set; }

No description available.

ScenesScanned
public int ScenesScanned { get; set; }

No description available.

PrefabsScanned
public int PrefabsScanned { get; set; }

No description available.

ScriptableObjectsScanned
public int ScriptableObjectsScanned { get; set; }

No description available.

TotalAssetsScanned
public int TotalAssetsScanned { get; set; }

No description available.

CurrentScope
public ScanScope CurrentScope { get; private set; }

No description available.

Methods

BeginScan
public void BeginScan(ScanScope scope)

Transitions Phase from Idle (or any terminal phase — restart) into Running and resets counters. Allocates a fresh CancellationTokenSource so a previously-cancelled token does not pre-cancel the new run.

EndScan
public void EndScan(float durationSeconds)

Marks a successfully-completed scan. <em>No-op</em> if the state is already in a terminal phase &mdash; this is the safety net that fixes the legacy bug where AsyncScanRunner.Cancel() would overwrite Cancelled with Completed via its Finish() path.

Cancel
public void Cancel()

Requests cancellation. Cooperative: callers (runners, controllers) check Token and bail. The transition to Cancelled happens immediately; EndScan calls afterwards are absorbed.

Fault
public void Fault(Exception exception)

Marks a faulted scan and stores the exception. Terminal &mdash; subsequent EndScan calls are absorbed.

MarkExternalScan
public void MarkExternalScan(string title)

Marks the state as having completed via external results (e.g. context menu).

Reset
public void Reset()

No description available.

Dispose
public void Dispose()

No description available.

Generated from Core/Scanning/ScanState.cs in RefSafe Pro 2.2.0.