コード例 #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);
        }
コード例 #2
0
ファイル: Service.cs プロジェクト: jangocheng/blue-collar
 /// <summary>
 /// Destroys the <see cref="Diagnostics.FileSystemWatcher"/>.
 /// </summary>
 private void DestroyWatcher()
 {
     if (this.watcher != null)
     {
         this.watcher.Dispose();
         this.watcher = null;
     }
 }
コード例 #3
0
ファイル: Service.cs プロジェクト: jangocheng/blue-collar
        /// <summary>
        /// Creates the <see cref="Diagnostics.FileSystemWatcher"/> to watch for configuration changes.
        /// </summary>
        private void CreateWatcher()
        {
            this.DestroyWatcher();

            this.watcher                     = new BlueCollar.FileSystemWatcher(Path.GetDirectoryName(BlueCollarServiceSection.Section.ElementInformation.Source), Path.GetFileName(BlueCollarServiceSection.Section.ElementInformation.Source));
            this.watcher.Operation          += new FileSystemEventHandler(this.WatcherOperation);
            this.watcher.Mode                = FileSystemWatcherMode.IndividualFiles;
            this.watcher.Threshold           = 1000;
            this.watcher.EnableRaisingEvents = true;
        }
コード例 #4
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;
        }
コード例 #5
0
ファイル: Service.cs プロジェクト: ChadBurggraf/blue-collar
 /// <summary>
 /// Destroys the <see cref="Diagnostics.FileSystemWatcher"/>.
 /// </summary>
 private void DestroyWatcher()
 {
     if (this.watcher != null)
     {
         this.watcher.Dispose();
         this.watcher = null;
     }
 }
コード例 #6
0
ファイル: Service.cs プロジェクト: ChadBurggraf/blue-collar
        /// <summary>
        /// Creates the <see cref="Diagnostics.FileSystemWatcher"/> to watch for configuration changes.
        /// </summary>
        private void CreateWatcher()
        {
            this.DestroyWatcher();

            this.watcher = new BlueCollar.FileSystemWatcher(Path.GetDirectoryName(BlueCollarServiceSection.Section.ElementInformation.Source), Path.GetFileName(BlueCollarServiceSection.Section.ElementInformation.Source));
            this.watcher.Operation += new FileSystemEventHandler(this.WatcherOperation);
            this.watcher.Mode = FileSystemWatcherMode.IndividualFiles;
            this.watcher.Threshold = 1000;
            this.watcher.EnableRaisingEvents = true;
        }