Beispiel #1
0
        public FileWatcher(IFilesystemProvider filesystem, FileWatcherMode mode, string directory, TimeSpan existenceCheckingInterval, string filter = "*.*")
        {
            this.filesystem = filesystem;
            this.mode       = mode;
            this.filter     = filter;
            this.Directory  = directory.TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar;

            this.watcher = this.TryToCreateWatcher(this.Directory);

            this.existenceCheckingTimer = new Timer()
            {
                AutoReset = true,
                Interval  = existenceCheckingInterval.TotalMilliseconds,
                Enabled   = true,
            };
            this.existenceCheckingTimer.Elapsed += (o, e) => this.CheckExistence();
        }
Beispiel #2
0
        public FileWatcher(IFilesystemProvider filesystem, FileWatcherMode mode, string directory, TimeSpan existenceCheckingInterval, string filter = "*.*")
        {
            this.filesystem = filesystem;
            this.mode = mode;
            this.filter = filter;
            this.Directory = directory.TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar;

            this.watcher = this.TryToCreateWatcher(this.Directory);

            this.existenceCheckingTimer = new Timer()
            {
                AutoReset = true,
                Interval = existenceCheckingInterval.TotalMilliseconds,
                Enabled = true,
            };
            this.existenceCheckingTimer.Elapsed += (o, e) => this.CheckExistence();
        }
Beispiel #3
0
 public FileWatcher Create(FileWatcherMode mode, string directory, TimeSpan existenceCheckingInterval, string filter = "*.*")
 {
     return(new FileWatcher(this.filesystem, mode, directory, existenceCheckingInterval, filter));
 }
Beispiel #4
0
 public FileWatcher Create(FileWatcherMode mode, string directory, TimeSpan existenceCheckingInterval, string filter = "*.*")
 {
     return new FileWatcher(this.filesystem, mode, directory, existenceCheckingInterval, filter);
 }