/// <summary> /// Runs the dup finder. /// </summary> /// <exception cref="FileNotFoundException">The program dupfinder.exe was not found.</exception> /// <exception cref="DirectoryNotFoundException">The DupFinder path '{_settingsData.DupFinderPath}' does not exist.</exception> private void RunDupFinder() { if (_fileSystemService.DirectoryExists(_settingsData.DupFinderPath)) { var dupFinder = _fileSystemService.CombinePaths(_settingsData.DupFinderPath, "dupfinder.exe"); if (_fileSystemService.FileExists(dupFinder)) { var proc = new Process { StartInfo = new ProcessStartInfo { CreateNoWindow = true, RedirectStandardOutput = true, RedirectStandardError = true, UseShellExecute = false, RedirectStandardInput = true, FileName = dupFinder, Arguments = $"--show-text --config-create=config.xml --output={_settingsData.OutputFile} {_settingsData.SourceFolder}" } }; proc.ErrorDataReceived += (sender, args) => OnDataReceived($"[ERROR]: {args?.Data}"); proc.OutputDataReceived += (sender, args) => OnDataReceived($"[INFO] : {args?.Data}"); proc.Start(); proc.BeginErrorReadLine(); proc.BeginOutputReadLine(); proc.WaitForExit(); } else { throw new FileNotFoundException("The program dupfinder.exe was not found.", dupFinder); } } else { throw new DirectoryNotFoundException($"The DupFinder path '{_settingsData.DupFinderPath}' does not exist."); } }