Table of Contents

Class PollingFileObserver

Namespace
RisingV.Shared.Files
Assembly
RisingV.Shared.dll

Periodically scans a directory tree and reports file-level changes

public sealed class PollingFileObserver : IAsyncDisposable
Inheritance
PollingFileObserver
Implements
Inherited Members
Extension Methods

Constructors

PollingFileObserver(string, TimeSpan?, bool)

Initializes a new instance of the PollingFileObserver class.

public PollingFileObserver(string rootPath, TimeSpan? pollInterval = null, bool includeSubdirectories = true)

Parameters

rootPath string

The root path to observe for file changes.

pollInterval TimeSpan?

The interval at which to poll for changes. Defaults to 5 seconds.

includeSubdirectories bool

If true, includes subdirectories in the observation. Defaults to true.

Exceptions

DirectoryNotFoundException

Thrown if the specified root path does not exist.

Properties

IncludeSubdirs

public bool IncludeSubdirs { get; }

Property Value

bool

PollInterval

public TimeSpan PollInterval { get; }

Property Value

TimeSpan

RootPath

public string RootPath { get; }

Property Value

string

Methods

DisposeAsync()

Stops the file observer and releases resources.

public ValueTask DisposeAsync()

Returns

ValueTask

Start()

Starts the file observer.

public void Start()

Events

FilesChanged

Raised after each scan that detects ≥ 1 changes

public event EventHandler<FilesChangedEventArgs>? FilesChanged

Event Type

EventHandler<FilesChangedEventArgs>