Esempio n. 1
0
        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 void Start(MyDupFinderFindDupsJobDTO findDupsJobDTO)
        {
            //TODO check if runner for base path exits... if not, create and add to queue

            if (ServiceState == IService.EServiceState.idle)
            {
                var fdr = new FindDupsInSameDB(findDupsJobDTO, _serviceProvider.GetService <ILogger <FindDupsInSameDB> >(), _serviceProvider);
                base.Start(fdr);
            }
        }
Esempio n. 3
0
 public void createDuplicateReport(string reportPathAndName, List<ScanItemDto> dupList, MyDupFinderFindDupsJobDTO findDupsJobDTO)
 {
     using (var fs = new StreamWriter(reportPathAndName))
     {
         string lastHash = "";
         
         foreach (ScanItemDto si in dupList)
         {
             if (si.FileSha512Hash != lastHash)
             {
                 //Hash is not the same... so start another group
                 fs.WriteLine("");
             }
             fs.WriteLine("\"" + si.FilenameAndPath + "\";" + si.FileSize);
             lastHash = si.FileSha512Hash;
         }
     }
     _logger.LogInformation($"Duplicate report successfully created: {reportPathAndName}");
 }
Esempio n. 4
0
 public FindDupsInSameDB(MyDupFinderFindDupsJobDTO findDupsJobDTO, ILogger<FindDupsInSameDB>? logger, IServiceProvider serviceProvider) : base(logger, serviceProvider)
 {
     FindDupsJobDTO = findDupsJobDTO;
     DubFinderDB = new DubFinderDB(_serviceProvider.GetService<ILogger<DubFinderDB>>());
 }