System.IO.FileSystemWatcher.RunningInstance.RunningInstance C# (CSharp) Méthode

RunningInstance() private méthode

Initializes the instance with all state necessary to operate a watch.
private RunningInstance ( FileSystemWatcher watcher, SafeFileHandle inotifyHandle, string directoryPath, bool includeSubdirectories, Interop notifyFilters, CancellationToken cancellationToken ) : Microsoft.Win32.SafeHandles
watcher FileSystemWatcher
inotifyHandle SafeFileHandle
directoryPath string
includeSubdirectories bool
notifyFilters Interop
cancellationToken System.Threading.CancellationToken
Résultat Microsoft.Win32.SafeHandles
            internal RunningInstance(
                FileSystemWatcher watcher, SafeFileHandle inotifyHandle, string directoryPath,
                bool includeSubdirectories, Interop.Sys.NotifyEvents notifyFilters, CancellationToken cancellationToken)
            {
                Debug.Assert(watcher != null);
                Debug.Assert(inotifyHandle != null && !inotifyHandle.IsInvalid && !inotifyHandle.IsClosed);
                Debug.Assert(directoryPath != null);

                _weakWatcher = new WeakReference<FileSystemWatcher>(watcher);
                _inotifyHandle = inotifyHandle;
                _directoryPath = directoryPath;
                _buffer = watcher.AllocateBuffer();
                Debug.Assert(_buffer != null && _buffer.Length > (c_INotifyEventSize + NAME_MAX + 1));
                _includeSubdirectories = includeSubdirectories;
                _notifyFilters = notifyFilters;
                _cancellationToken = cancellationToken;

                // Add a watch for this starting directory.  We keep track of the watch descriptor => directory information
                // mapping in a dictionary; this is needed in order to be able to determine the containing directory
                // for all notifications so that we can reconstruct the full path.
                AddDirectoryWatchUnlocked(null, directoryPath);
            }