public SyncFileSystemWatcher(string DirectoryToMonitor) { _DirectoryToMonitor = DirectoryToMonitor; #if __MonoCS__ _FSWatcher = (IDiskWatcher) new KS2.EasySync.Mac.MacDiskWatcher(); #else _FSWatcher = (IDiskWatcher) new KS2.EasySync.Windows.WindowsDiskWatcher(); #endif _FSWatcher.FileCreated += FS_FileCreated; _FSWatcher.FileRenamed += FS_FileRenamed; _FSWatcher.FileChanged += FS_FileChanged; _FSWatcher.FileDeleted += FS_FileDeleted; _FSWatcher.DirCreated += FS_DirCreated; _FSWatcher.DirRenamed += FS_DirRenamed; _FSWatcher.DirDeleted += FS_DirDeleted; _FSWatcher.Error += FS_Error; _FSWatcher.Init(DirectoryToMonitor); //File event processing timer FSEventListAnalysisTimer = new System.Timers.Timer(5 * 1000); FSEventListAnalysisTimer.AutoReset = false; FSEventListAnalysisTimer.Elapsed += FSEventListAnalysisTimer_Elapsed; FSIgnoreEventList = new List <SyncEventIgnoreItem>(); FSEventList = new List <FSSyncEvent>(); }
public DiskWatcherBackgroundService(IDiskWatcher diskWatcher, AppSettings appSettings, IWebLogger logger) { _diskWatcher = diskWatcher; _appSettings = appSettings; _logger = logger; }