Table of Contents

Class DirectoryWatcher

Namespace
Stride.Core.IO
Assembly
Stride.Core.IO.dll

Track file system events from several directories.

public class DirectoryWatcher : IDisposable
Inheritance
DirectoryWatcher
Implements
Extension Methods

Constructors

DirectoryWatcher(string)

Initializes a new instance of the DirectoryWatcher class.

public DirectoryWatcher(string fileFilter = null)

Parameters

fileFilter string

The file filter By default null default to .

Properties

FileFilter

Gets the file filter used by this instance.

public string FileFilter { get; }

Property Value

string

The file filter.

Methods

CreateFileSystemWatcher(string)

protected FileSystemWatcher CreateFileSystemWatcher(string directory)

Parameters

directory string

Returns

FileSystemWatcher

Dispose()

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

public virtual void Dispose()

GetTrackedDirectories()

Gets a list of current directories being tracked.

public List<string> GetTrackedDirectories()

Returns

List<string>

A list of current directories being tracked

OnModified(object, FileEvent)

Called when a file event occurred.

protected virtual void OnModified(object sender, FileEvent e)

Parameters

sender object

The sender.

e FileEvent

The file event.

Track(string)

Tracks the specified path.

public void Track(string path)

Parameters

path string

The path.

Remarks

If path is a file, this will used the parent directory. If the path is invalid, it will not fail but just skip it.

UnTrack(string)

UnTracks the specified path.

public void UnTrack(string path)

Parameters

path string

Remarks

If path is a file, this will used the parent directory. If the path is invalid, it will not fail but just skip it.

Events

Modified

Occurs when a file/directory change occurred.

public event EventHandler<FileEvent> Modified

Event Type

EventHandler<FileEvent>