<PackageReference Include="Relativity.Server.Import.SDK" Version="2.9.2" />

CaseSensitiveFilePathHelper

using Microsoft.VisualBasic.CompilerServices; using Relativity.DataExchange.Io; using System; namespace kCura.WinEDDS.Helpers { public class CaseSensitiveFilePathHelper : IFilePathHelper { private readonly IFileSystem _fileSystem; public CaseSensitiveFilePathHelper(IFileSystem fileSystem) { _fileSystem = fileSystem; } public string GetExistingFilePath(string path) { if (!string.IsNullOrEmpty(path)) { if (!_fileSystem.File.Exists(path)) try { return TryToSearchInCaseSensitivePaths(path); } catch (Exception ex) { ProjectData.SetProjectError(ex); Exception ex2 = ex; string result = null; ProjectData.ClearProjectError(); return result; } return path; } return null; } string IFilePathHelper.GetExistingFilePath(string path) { return this.GetExistingFilePath(path); } protected virtual string TryToSearchInCaseSensitivePaths(string path) { string extension = _fileSystem.Path.GetExtension(path); if (!string.IsNullOrEmpty(extension)) { string updatedPath = null; if (!IsExtensionLowercase(extension) && FileExistsWithNewExtension(path, extension.ToLower(), out updatedPath)) return updatedPath; if (!IsExtensionUppercase(extension) && FileExistsWithNewExtension(path, extension.ToUpper(), out updatedPath)) return updatedPath; return null; } return null; } private bool FileExistsWithNewExtension(string path, string extension, out string updatedPath) { string text = _fileSystem.Path.ChangeExtension(path, extension); bool flag = _fileSystem.File.Exists(text); updatedPath = (flag ? text : null); return flag; } private bool IsExtensionLowercase(string extension) { return extension.Equals(extension.ToLower()); } private bool IsExtensionUppercase(string extension) { return extension.Equals(extension.ToUpper()); } } }