public static void getExampleDTO(out MyDupFinderProjectDTO myDupFinderProjectDTO) { //project myDupFinderProjectDTO = new MyDupFinderProjectDTO(); //scan var myDupFinderScanJobDTO = new MyDupFinderScanJobDTO(); myDupFinderScanJobDTO.JobName = "Example scanjob name"; myDupFinderScanJobDTO.OriginComputer = "E6600"; myDupFinderScanJobDTO.BasePath = @"m:\Test"; myDupFinderScanJobDTO.ScanName = "Backup of old computer"; myDupFinderScanJobDTO.DatabaseFile = @"m:\finddupdb\base.db"; myDupFinderScanJobDTO.ReportPath = @"m:\finddupdb\"; myDupFinderProjectDTO.MyDupFinderScanJobDTOs.Add(myDupFinderScanJobDTO); //check var myDupFinderCheckJobDTO = new MyDupFinderCheckJobDTO(); myDupFinderCheckJobDTO.ScanJobDTO = myDupFinderScanJobDTO; myDupFinderCheckJobDTO.ScanJobDTO.JobName = "Example checkjob name"; myDupFinderCheckJobDTO.IgnoreBasePath = false; myDupFinderCheckJobDTO.SkipHashCheck = true; myDupFinderProjectDTO.MyDupFinderCheckJobDTOs.Add(myDupFinderCheckJobDTO); //FindDups var myDupFinderFindDupsJobDTO = new MyDupFinderFindDupsJobDTO(); myDupFinderFindDupsJobDTO.JobName = "Example FindDupsJob name"; myDupFinderFindDupsJobDTO.FindDupsMode = MyDupFinderFindDupsJobDTO.EFindDupsMode.FindOnlyDups; myDupFinderFindDupsJobDTO.DatabaseFileBase = @"m:\finddupdb\base.db"; myDupFinderFindDupsJobDTO.DatabaseFile = @"m:\finddupdb\newdb.db"; myDupFinderFindDupsJobDTO.ReportPath = @"m:\finddupdb\"; myDupFinderProjectDTO.MyDupFinderFindDupsJobDTOs.Add(myDupFinderFindDupsJobDTO); }
public static void FixDto(MyDupFinderScanJobDTO dto) { // Rule: Make sure the base path has a delimiter at the end dto.BasePath = FileHelper.AddDirectoryDelimiter(dto.BasePath); // Rule: Make sure the ReportPath path has a delimiter at the end dto.ReportPath = FileHelper.AddDirectoryDelimiter(dto.ReportPath); }
public EnumerateFilesFromDiscToIndex(MyDupFinderScanJobDTO scanJobDto, ILogger <EnumerateFilesFromDiscToIndex>?logger) { _scanJobDto = scanJobDto; _logger = logger ?? NullLoggerFactory.Instance.CreateLogger <EnumerateFilesFromDiscToIndex>(); ScanItemCollection = new ConcurrentQueue <ScanItemDto>(); _files = Directory.EnumerateFiles(_scanJobDto.BasePath, "*", SearchOption.AllDirectories).GetEnumerator(); HasMore = true; }
public void StartScan(MyDupFinderScanJobDTO scanJobDTO) { //TODO check if runner for base path exits... if not, create and add to queue if (ServiceState == IService.EServiceState.idle) { var sr = new ScanRunnerSingleThread(scanJobDTO, _serviceProvider.GetService <ILogger <ScanRunnerSingleThread> >(), _serviceProvider); base.Start(sr); } }
public static void CheckSanity(MyDupFinderScanJobDTO dto) { //Rule: BasePath, DatabaseFile, scanName, OriginComputer and JobName may not be null if (string.IsNullOrWhiteSpace(dto.JobName)) { throw new ParameterException("Param JobName may not be null or empty"); } if (string.IsNullOrWhiteSpace(dto.OriginComputer)) { throw new ParameterException("Param OriginComputer may not be null or empty"); } if (string.IsNullOrWhiteSpace(dto.ScanName)) { throw new ParameterException("Param ScanName may not be null or empty"); } if (string.IsNullOrWhiteSpace(dto.BasePath)) { throw new ParameterException("Param BasePath may not be null or empty"); } if (string.IsNullOrWhiteSpace(dto.DatabaseFile)) { throw new ParameterException("Param DatabaseFile may not be null or empty"); } //Rule: BasePath must exist if (!System.IO.Directory.Exists(dto.BasePath)) { throw new ParameterException($"BasePath must exist! {dto.BasePath}"); } //Rule: DatabaseFile and ReportPath are not allowed below the BasePath string basePath = FileHelper.AddDirectoryDelimiter(dto.BasePath); if (dto.DatabaseFile.StartsWith(basePath)) { throw new ParameterException("Param DatabaseFile may not be a subdirectory of BasePath!"); } if (dto.ReportPath.StartsWith(basePath)) { throw new ParameterException("Param ReportPath may not be a subdirectory of BasePath!"); } }
public ScanRunnerSingleThread(MyDupFinderScanJobDTO scanJobDTO, ILogger <ScanRunnerSingleThread>?logger, IServiceProvider serviceProvider) : base(logger, serviceProvider) { ScanJobDTO = scanJobDTO; ScanJobDBInserts = new ScanJobDBInserts(_serviceProvider.GetService <ILogger <ScanJobDBInserts> >()); }
public MyDupFinderCheckJobDTO() { ScanJobDTO = new MyDupFinderScanJobDTO(); }