public void Init(AutoQcConfig config) { _configName = config.Name; var mainSettings = config.MainSettings; _dataFiles = new ConcurrentQueue <string>(); _retryFiles = new Queue <RawFile>(); _fileStatusChecker = GetFileStatusChecker(mainSettings); _fileWatcher.EnableRaisingEvents = false; if (mainSettings.IncludeSubfolders) { _fileWatcher.IncludeSubdirectories = true; _includeSubfolders = true; } _fileWatcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.DirectoryName | NotifyFilters.CreationTime; _instrument = mainSettings.InstrumentType; _dataInDirectories = IsDataInDirectories(_instrument); _fileWatcher.Filter = GetFileFilter(mainSettings.InstrumentType); _fileWatcher.Path = mainSettings.FolderToWatch; _fileFilter = mainSettings.QcFileFilter; _acquisitionTimeSetting = mainSettings.AcquisitionTime; _driveInfo = new DriveInfo { DriveLetter = NetworkDriveUtil.GetDriveLetter(_fileWatcher.Path) }; if (_driveInfo.DriveLetter == null) { throw new FileWatcherException(string.Format("Unable to get drive letter for path {0}", _fileWatcher.Path)); } try { _driveInfo.NetworkDrivePath = NetworkDriveUtil.ReadNetworkDrivePath(_driveInfo.DriveLetter); } catch (FileWatcherException) { throw; } catch (Exception e) { throw new FileWatcherException(string.Format("Unable to read network drive properties for {0}", _driveInfo.DriveLetter), e); } }
public DriveInfo(string path) { Path = path; DriveLetter = NetworkDriveUtil.GetDriveLetter(path); if (DriveLetter != null) { try { NetworkPath = NetworkDriveUtil.GetNetworkPath(DriveLetter); } catch (FileWatcherException) { throw; } catch (Exception e) { throw new FileWatcherException(string.Format("Unable to read network drive properties for {0}", DriveLetter), e); } } else if (path.StartsWith(@"\\")) { NetworkPath = path; } }