ConfigurableFilePathHelper
using kCura.WinEDDS.Importers;
using Relativity.DataExchange.Io;
using System;
namespace kCura.WinEDDS.Helpers
{
public class ConfigurableFilePathHelper : IFilePathHelper
{
private readonly IImportConfig _importConfig;
private readonly IFileSystem _fileSystem;
private readonly Lazy<IFilePathHelper> _internalFilePathHelperLazy;
public ConfigurableFilePathHelper()
: this(new ImportConfig(), FileSystem.Instance)
{
}
public ConfigurableFilePathHelper(IImportConfig importConfig, IFileSystem fileSystem)
{
_internalFilePathHelperLazy = new Lazy<IFilePathHelper>(FilePathHelperFactory);
_importConfig = importConfig;
_fileSystem = fileSystem;
}
private IFilePathHelper FilePathHelperFactory()
{
if (!_importConfig.EnableCaseSensitiveSearchOnImport)
return new CaseInsensitiveFilePathHelper(_fileSystem);
return new CaseSensitiveFilePathHelper(_fileSystem);
}
public string GetExistingFilePath(string path)
{
return _internalFilePathHelperLazy.Value.GetExistingFilePath(path);
}
string IFilePathHelper.GetExistingFilePath(string path)
{
return this.GetExistingFilePath(path);
}
}
}