private FileNotificationService CreateWatcher(IWatchConfiguration configuration) { var info = new FileInfo(configuration.Path); FileNotificationService watcher = null; if (info.Attributes.HasFlag(FileAttributes.Directory)) { DirectoryInfo directory = new DirectoryInfo(configuration.Path); if (directory.Exists) { watcher = new FileNotificationService( directory, true, configuration.Filter ?? "*", configuration.BufferTime, configuration.IntervalTime, configuration.MaxDaysInactive); } } else if (info.Exists) { watcher = new FileNotificationService(info, true, configuration.BufferTime, configuration.IntervalTime); } return(watcher); }
private FileNotificationService CreateWatcher(IWatchConfiguration configuration) { var info = new FileInfo(configuration.Path); FileNotificationService watcher = null; if (info.Attributes.HasFlag(FileAttributes.Directory)) { DirectoryInfo directory = new DirectoryInfo(configuration.Path); if (directory.Exists) { watcher = new FileNotificationService( directory, true, configuration.Filter ?? "*", configuration.BufferTime, configuration.IntervalTime, configuration.MaxDaysInactive); } } else if (info.Exists) { watcher = new FileNotificationService(info, true, configuration.BufferTime, configuration.IntervalTime); } return watcher; }