Table of Contents

Class FileWriteTimes

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

The last write time and the size of the files a listener of a DirectoryWatcher follows, to find which of them changed while the watcher missed changes (ChangesMissed).

public sealed class FileWriteTimes
Inheritance
object
FileWriteTimes
Extension Methods

Remarks

A listener records each file it follows, then each file its events are about, and replays the events Reconcile(string, IEnumerable<string>?) finds as if the watcher had sent them. A file that does not exist is recorded too, so that it is found when it comes back. The methods can be called from several threads.

Methods

Add(string)

Starts following a file: records its current state, unless it is followed already.

public bool Add(string path)

Parameters

path string

The path of the file.

Returns

bool

true if the file was not followed yet.

Contains(string)

Whether a file is followed.

public bool Contains(string path)

Parameters

path string

The path of the file.

Returns

bool

IsUnder(string, string)

Whether a path is a directory or is in it, with the case of the paths of the file system of the platform.

public static bool IsUnder(string path, string directory)

Parameters

path string

The full path of a file or a directory.

directory string

The full path of the directory.

Returns

bool

Reconcile(string, IEnumerable<string>?)

Finds the files of a directory that changed since they were recorded, and records their current state.

public List<FileEvent> Reconcile(string directory, IEnumerable<string>? currentFiles = null)

Parameters

directory string

The directory whose changes were missed, with its subdirectories.

currentFiles IEnumerable<string>

Files there that may not be followed yet, such as the files of the directory a listener lists: a file that is not followed yet is created.

Returns

List<FileEvent>

The event of each file that was created, changed or deleted.

Update(string)

Records the current state of a file, after an event of the watcher about it.

public void Update(string path)

Parameters

path string

The path of the file.