Esempio n. 1
0
        /// <summary>
        /// Creates a <see cref="FileSystemWatcher"/>.
        /// </summary>
        /// <param name="path">The path to watch.</param>
        /// <param name="mode">The watch mode.</param>
        /// <param name="filter">The file search filter to use.</param>
        /// <returns>The created <see cref="FileSystemWatcher"/>.</returns>
        private BlueCollar.FileSystemWatcher CreateWatcher(string path, FileSystemWatcherMode mode, string filter)
        {
            BlueCollar.FileSystemWatcher watcher = null;

            try
            {
                watcher                     = new BlueCollar.FileSystemWatcher(path);
                watcher.Operation          += new FileSystemEventHandler(this.WatcherOperation);
                watcher.Mode                = mode;
                watcher.Filter              = filter;
                watcher.Threshold           = this.Threshold;
                watcher.EnableRaisingEvents = true;
            }
            catch
            {
                if (watcher != null)
                {
                    watcher.Dispose();
                }

                throw;
            }

            return(watcher);
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a <see cref="FileSystemWatcher"/>.
        /// </summary>
        /// <param name="path">The path to watch.</param>
        /// <param name="mode">The watch mode.</param>
        /// <param name="filter">The file search filter to use.</param>
        /// <returns>The created <see cref="FileSystemWatcher"/>.</returns>
        private BlueCollar.FileSystemWatcher CreateWatcher(string path, FileSystemWatcherMode mode, string filter)
        {
            BlueCollar.FileSystemWatcher watcher = null;

            try
            {
                watcher = new BlueCollar.FileSystemWatcher(path);
                watcher.Operation += new FileSystemEventHandler(this.WatcherOperation);
                watcher.Mode = mode;
                watcher.Filter = filter;
                watcher.Threshold = this.Threshold;
                watcher.EnableRaisingEvents = true;
            }
            catch
            {
                if (watcher != null)
                {
                    watcher.Dispose();
                }

                throw;
            }

            return watcher;
        }
 /// <summary>
 /// Creates a <see cref="FileSystemWatcher"/>.
 /// </summary>
 /// <param name="path">The path to watch.</param>
 /// <param name="mode">The watch mode.</param>
 /// <param name="filter">The file search filter to use.</param>
 /// <returns>The created <see cref="FileSystemWatcher"/>.</returns>
 private FileSystemWatcher CreateWatcher(string path, FileSystemWatcherMode mode, string filter)
 {
     FileSystemWatcher watcher = new FileSystemWatcher(path);
     watcher.Operation += new FileSystemEventHandler(this.WatcherOperation);
     watcher.Mode = mode;
     watcher.Filter = filter;
     watcher.EnableRaisingEvents = true;
     watcher.Threshold = this.FileSystemWatcherThreshold;
     return watcher;
 }