/// <summary> /// Registers a new mapper object for altering mappings at runtime. /// </summary> /// <param name="key">Identifier for the mapper</param> /// <param name="mapper">The optional mapper to register otherwise a new instance is created.</param> /// <exception cref="ArgumentNullException">Throw if <paramref name="key"/> is null</exception> public IDirectoryMapper ChangeMapper(string key, IDirectoryMapper mapper = null) { if (key == null) { throw new ArgumentNullException(nameof(key)); } if (mapper != null) { #if (NET35 || NET40) _mappers.AddOrUpdate(key, mapper); #else _mappers.AddOrUpdate(key, mapper, (k, old) => mapper); #endif } else { mapper = _mappers.GetOrAdd(key, k => new DirectoryMapper()); } lock (_mapperLock) { _mapper = mapper; } return(_mapper); }
/// <summary> /// Creates a new instance of the <see cref="DuplicateFinder"/>. /// The search will be performed with the <see cref="DuplicationSearchWay.NameAndSizeComparison"/> way /// and with the minimun size for analysis set as 0. /// </summary> /// <param name="directoryPath">The path where the duplications search will be performed.</param> public DuplicateFinder(string directoryPath, IDirectoryMapper directoryMapper) { DirectoryMapper = directoryMapper; SelectedDirectory = new WindowsDirectoryMapped(DirectoryMapper) { DirectoryInfo = new DirectoryInfo(directoryPath) }; Progress = new Progress <DuplicationSearchProgressReport>(); CancelTokenSource = new CancellationTokenSource(); }
/// <summary> /// Constructs an instance of this class and initializes <see cref="Mapper"/>. /// </summary> public LdapConfiguration() { _mapper = new DirectoryMapper(); _mappers.TryAdd(string.Empty, Mapper); }
/// <summary> /// Creates a new instance of <see cref="WindowsDirectoryMapped"/>. /// </summary> /// <param name="directoryMapper">The <see cref="IDirectoryMapper"/> instance used for map the subdirectories.</param> public WindowsDirectoryMapped(IDirectoryMapper directoryMapper) { DirectoryMapper = directoryMapper; }
/// <summary> /// Creates a new instance of the <see cref="DuplicateFinder"/>. /// The search will be performed with the <see cref="DuplicationSearchWay.NameAndSizeComparison"/> way /// and with the minimun size for analysis provided. /// </summary> /// <param name="directoryPath">The path where the duplications search will be performed.</param> /// <param name="minimunSizeForAnalysis">The minimun size needed for the file to be analysed.</param> public DuplicateFinder(string directoryPath, IDirectoryMapper directoryMapper, long minimunSizeForAnalysis) : this(directoryPath, directoryMapper) => MinimunSizeForAnalysis = minimunSizeForAnalysis;
/// <summary> /// Creates a new instance of the <see cref="DuplicateFinder"/>. /// The search will be performed with the specified way /// and with the minimun size for analysis set as 0. /// </summary> /// <param name="directoryPath">The path where the duplications search will be performed.</param> /// <param name="searchWay">The way used for the duplication search.</param> public DuplicateFinder(string directoryPath, IDirectoryMapper directoryMapper, DuplicationSearchWay searchWay) : this(directoryPath, directoryMapper) { SearchWay = searchWay; }