public FilterResult Filter( IFileResource sourceResource, IEnumerable <IFileResource> targetResources, ITargetHistoryRepository targetHistoryRepository, IFileSystem source, IFileSystem target) { var primaryAncestor = FindPrimaryAncestorFolder( sourceResource.RelativePath ); var shouldRecordOnly = ResourceExistsAtTarget(targetResources, sourceResource) || ResourceExistsInHistory(targetHistoryRepository, sourceResource); if (shouldRecordOnly) { return(FilterResult.RecordOnly); } var shouldInclude = target.IsDirectory(primaryAncestor) || RelativeBaseExistsInHistory(targetHistoryRepository, primaryAncestor); return(shouldInclude ? FilterResult.Include : FilterResult.Exclude); }
public FilterResult Filter( IFileResource sourceResource, IEnumerable <IFileResource> targetResources, ITargetHistoryRepository targetHistoryRepository, IFileSystem source, IFileSystem target) { return(HaveMatchingTargetResource() || HaveMatchingHistoryItem() ? FilterResult.Ambivalent : FilterResult.Include); bool HaveMatchingTargetResource() { var existing = targetResources.FirstOrDefault( r => r.RelativePath == sourceResource.RelativePath ); return(existing?.Size == sourceResource.Size); } bool HaveMatchingHistoryItem() { var historyItem = targetHistoryRepository.Find( sourceResource.RelativePath ); return(historyItem?.Size == sourceResource.Size); } }
private static bool RelativeBaseExistsInHistory( ITargetHistoryRepository targetHistoryRepository, string relativeBase) { return(targetHistoryRepository.FindAll( $"{relativeBase}/*" ) .Any()); }
public FilterResult Filter(IFileResource sourceResource, IEnumerable <IFileResource> targetResources, ITargetHistoryRepository targetHistoryRepository, IFileSystem source, IFileSystem target) { return(sourceResource.Name.StartsWith(".") ? FilterResult.Exclude : FilterResult.Ambivalent); }
private static bool ResourceExistsInHistory( ITargetHistoryRepository targetHistoryRepository, IFileResource sourceResource) { return(targetHistoryRepository.Find( sourceResource.RelativePath ) ?.Size == sourceResource.Size); }
private bool HistoryFileExists( ITargetHistoryRepository targetHistoryRepository, IFileResource sourceResource) { var existing = targetHistoryRepository.Find( sourceResource.RelativePath ); return(existing?.Size == sourceResource.Size); }
public FilterResult Filter( IFileResource sourceResource, IEnumerable <IFileResource> targetResources, ITargetHistoryRepository targetHistoryRepository, IFileSystem source, IFileSystem target) { return(_archiveFiles.Contains(sourceResource.RelativePath) ? FilterResult.Include : FilterResult.Exclude); }
public FilterResult Filter( IFileResource sourceResource, IEnumerable <IFileResource> targetResources, ITargetHistoryRepository targetHistoryRepository, IFileSystem source, IFileSystem target) { return(_filter( sourceResource, targetResources, targetHistoryRepository, source, target)); }
public FilterResult Filter(IFileResource sourceResource, IEnumerable <IFileResource> targetResources, ITargetHistoryRepository targetHistoryRepository, IFileSystem source, IFileSystem target) { var shouldExclude = TargetFileExists(targetResources, sourceResource) || HistoryFileExists(targetHistoryRepository, sourceResource); return(shouldExclude ? FilterResult.Exclude : FilterResult.Ambivalent); }
public Synchronizer( ITargetHistoryRepository targetHistoryRepository, IResumeStrategy resumeStrategy, IPassThrough[] intermediatePipes, IFilter[] filters, IProgressReporter progressReporter, IOptions options) { ValidateIntermediatePipes(intermediatePipes); _targetHistoryRepository = targetHistoryRepository; _resumeStrategy = resumeStrategy; _intermediatePipes = intermediatePipes; _notifiables = intermediatePipes .OfType <ISyncQueueNotifiable>() .ToArray(); _filters = filters; _progressReporter = progressReporter; _options = options; }
public TestArena() { _folder = new AutoTempFolder(); _dbDatabase = new SqLiteDatabase(_folder.Path); SUT = Create(_folder); }
public SiteSettingsServices(IPasswordHistoryRepository passwordHistoryRepository, ITargetHistoryRepository targetHistoryRepository, UserServices userServices) { _passwordHistoryRepository = passwordHistoryRepository; _targetHistoryRepository = targetHistoryRepository; _userServices = userServices; }