DirectoryWatcher Class
Namespace: Stride.Core.IOAssembly: Stride.Core.IO.dll
Track file system events from several directories.
public class DirectoryWatcher : IDisposable
Name | Description | |
---|---|---|
Constructors | ||
DirectoryWatcher(String) | Initializes a new instance of the DirectoryWatcher class. |
|
Properties | ||
FileFilter | Gets the file filter used by this instance. |
|
Methods | ||
CreateFileSystemWatcher(String) | ||
Dispose() | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. |
|
GetTrackedDirectories() | Gets a list of current directories being tracked. |
|
OnModified(Object, FileEvent) | Called when a file event occurred. |
|
Track(String) | Tracks the specified path. |
|
UnTrack(String) | UnTracks the specified path. |
|
Events | ||
Modified | Occurs when a file/directory change occurred. |
Constructors
DirectoryWatcher(String)
Initializes a new instance of the DirectoryWatcher class.
public DirectoryWatcher(string fileFilter = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileFilter | The file filter By default null default to . |
Properties
FileFilter
Gets the file filter used by this instance.
public string FileFilter { get; }
Property Value
Type | Description |
---|---|
System.String | The file filter. |
Methods
CreateFileSystemWatcher(String)
protected FileSystemWatcher CreateFileSystemWatcher(string directory)
Parameters
Type | Name | Description |
---|---|---|
System.String | directory |
Returns
Type | Description |
---|---|
System.IO.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
Type | Description |
---|---|
System.Collections.Generic.List<System.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
Type | Name | Description |
---|---|---|
System.Object | sender | The sender. |
FileEvent | e | The file event. |
Track(String)
Tracks the specified path.
public void Track(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | 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
Type | Name | Description |
---|---|---|
System.String | 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.
Events
Modified
Occurs when a file/directory change occurred.
public event EventHandler<FileEvent> Modified
Event Type
Type | Description |
---|---|
System.EventHandler<FileEvent> |