예제 #1
0
        public void CreateFileDirectoryWatcher()
        {
            Mock <IFileSystemWatcher> watcher = new Mock <IFileSystemWatcher>();
            var settings = new FileDirectoryWatcherSettings();

            _ = new FileDirectoryWatcher(settings);
            _ = new FileDirectoryWatcher(settings, watcher.Object);
        }
예제 #2
0
 public WatcherFileList(FileDirectoryWatcherSettings settings = null, IFileSystemWatcher watcherInterface = null, int updateRatioInMilliseconds = 0)
 {
     _fileDirectoryWatcherSettings = settings ?? new FileDirectoryWatcherSettings {
         UseManualScan = true
     };
     _watcherInterface          = watcherInterface;
     _updateRatioInMilliseconds = updateRatioInMilliseconds;
 }
예제 #3
0
        public AutoCurrentFileList(IOptions <FileDirectoryWatcherSettings> settingsFileWatcher, IOptions <AutoCurrentFileListSettings> settings = null, IGetFile openFile = null)
        {
            Debug.Assert(settingsFileWatcher != null); // Due to scan base directory this is not allowed
            _getFile             = openFile ?? new GetFileWrapper();
            _settings            = settings?.Value ?? new AutoCurrentFileListSettings();
            _settingsFileWatcher = settingsFileWatcher?.Value ?? new FileDirectoryWatcherSettings();

            if (String.IsNullOrEmpty(_settingsFileWatcher.ScanDirectory))
            {
                Trace.TraceError("AutoCurrentFileList settings files watcher is not set - no base directory available - use temp path");
                _settingsFileWatcher.ScanDirectory = Path.GetTempPath();
            }
        }