public PruneHistoryCommand(IOutput output,
     IDuplicateFinder duplicateFinder,
     IRememberHashCodes history)
 {
     DuplicateFinder = duplicateFinder;
       _output = output;
       History = history;
 }
Example #2
0
        private static void RunPerformance(IDuplicateFinder finder, int[] arr, string message)
        {
            var sw = new Stopwatch();

            sw.Start();
            var result = finder.IsDuplicate(arr);

            sw.Stop();
            Console.WriteLine(message + " result: {1}", sw.Elapsed, result);
        }
 public FindDuplicatesCommand(IOutput output,
     IDuplicateFinder duplicateFinder,
     ISelectFilesToDelete deletionSelector,
     IFileDeleter fileDeleter)
 {
     DuplicateFinder = duplicateFinder;
     FileDeleter = fileDeleter;
     _output = output;
     _select = deletionSelector;
 }
Example #4
0
    public DuplicateFinderTests()
    {
        _fileWalker        = Substitute.For <IFileWalker>();
        _compareService    = Substitute.For <ICompareService>();
        _fileSystemService = Substitute.For <IFileSystemService>();
        _fileDetailService = Substitute.For <IFileDetailService>();
        _configService     = Substitute.For <IConfigService>();

        _duplicateFinder =
            new DuplicateFinder.DuplicateFinder(_compareService, _fileWalker, _fileSystemService, _configService);
    }
        public MainWindowViewModel(IPreviewWindow previewWindow,
                                   ISettingsWindow settingsWindow,
                                   IDuplicateFinder queryService,
                                   IAboutBox aboutWindow,
                                   ISettingsService settingsService,
                                   IMainWindow mainWindow)
        {
            Duplicates         = new ObservableCollection <SingleFileEntry>();
            SelectedDuplicates = new ObservableCollection <SingleFileEntry>();
            CollectionView           view             = (CollectionView)CollectionViewSource.GetDefaultView(Duplicates);
            PropertyGroupDescription groupDescription = new PropertyGroupDescription("Checksum");

            view.GroupDescriptions.Add(groupDescription);
            browseCommand       = new CommandHandler(() => HandleBrowse(), () => CanExecuteBrowse);
            startCommand        = new CommandHandler(() => HandleStart(), () => CanExecuteStart);
            ExportCommand       = new CommandHandler(() => HandleExport(), () => CanExecuteExport);
            ImportCommand       = new CommandHandler(() => HandleImport(), () => true);
            ShowPreviewCommand  = new CommandHandler(() => HandleShowPreview(), () => CanExecuteShowPreview);
            ShowSettingsCommand = new CommandHandler(() => HandleShowSettings(), () => CanExecuteShowSettings);
            ShowAboutCommand    = new CommandHandler(() => HandleAbout(), () => true);
            CancelCommand       = new CommandHandler(() => HandleCancel(), () => CanExecuteCancel);
            RemoveItemCommand   = new RelayCommand <SingleFileEntry>(HandleRemove, CanExecuteRemove);
            bgw                            = new BackgroundWorker();
            bgw.DoWork                    += DoWorkEvent;
            bgw.ProgressChanged           += ProgressChangedEvent;
            bgw.WorkerReportsProgress      = true;
            bgw.WorkerSupportsCancellation = true;
            progressBar                    = new ProgressBar();
            progressBar.Minimum            = 0;
            progressBar.Maximum            = 100;
            progressBar.Step               = 1;
            progressBar.Visible            = false;
            IsIdle                         = true;
            this.previewWindow             = previewWindow;
            this.settingsWindow            = settingsWindow;
            this.queryService              = queryService;
            this.aboutWindow               = aboutWindow;
            settingsService.SettingsSavedObservable.Subscribe(HandleFilterSaved);
            Filter = settingsService.QuerySettings().Filter;
            mainWindow.DataContext = this;
        }
Example #6
0
 public void Setup()
 {
     _duplicateFinder = new SortAndFind();
 }