예제 #1
0
        public void RemoveAndStop(PipelineMapping mapping)
        {
            var monitor = monitors.Where(m => m.Mapping == mapping).SingleOrDefault();

            if (monitor == null)
            {
                throw new InvalidOperationException("Monitor with mapping not found");
            }
            monitor.Stop();
            monitors.Remove(monitor);
        }
예제 #2
0
        public PipelineMonitor(FileNotificationQueue queue, PipelineMapping mapping)
        {
            this.queue   = queue;
            this.Mapping = mapping;

            watcher = new FileSystemWatcher(mapping.InputDirectory);
            watcher.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.Size | NotifyFilters.FileName | NotifyFilters.DirectoryName;
            watcher.Changed     += new FileSystemEventHandler(CreatedOrChanged);
            watcher.Renamed     += new RenamedEventHandler(Renamed);
            watcher.Created     += new FileSystemEventHandler(CreatedOrChanged);
        }