Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    DirectoryWatcher Class

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

    Track file system events from several directories.

    System.Object → DirectoryWatcher
    Derived from DirectoryWatcher:

    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.

    | Improve this Doc View Source

    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 .

    | Improve this Doc View Source

    Properties


    FileFilter

    Gets the file filter used by this instance.

    public string FileFilter { get; }
    Property Value
    Type Description
    System.String

    The file filter.

    | Improve this Doc View Source

    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.

    | Improve this Doc View Source

    Events


    Modified

    Occurs when a file/directory change occurred.

    public event EventHandler<FileEvent> Modified
    Event Type
    Type Description
    System.EventHandler<FileEvent>

    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation