Skip to content

Commit

Permalink
* Fixed that files were always shown in lower case
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Behring <alex@behrings.eu>
  • Loading branch information
Urmel committed Jan 20, 2023
1 parent 9972786 commit 427cc36
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions Model/DirectoryElementCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,24 +207,23 @@ public void ParseFolderToDEs(string folder, Action<string> statusMethod)
// Check, if it is a side car file. If so,
// add it to the list to attach to image files later
if (allowedSideCarExt.Contains(Path.GetExtension(path: filename).ToLower().Replace(".", "")))
sidecarFiles.Add(filename.ToLower());
sidecarFiles.Add(filename);

// Image file
else if (allowedImageExtensions.Contains(Path.GetExtension(path: filename).ToLower().Replace(".", "")))
imageFiles.Add(filename.ToLower());
imageFiles.Add(filename);
}
Logger.Trace(message: "Files: Listing Files - OK");

// ******************************
// Map side car files to image file
// All filenames are in lower...
IDictionary<string,string> image2sidecar = new Dictionary<string,string>();
foreach (string sidecarFile in sidecarFiles)
{
// Get (by comparing w/o extension) list of matching image files
string scFilenameWOExt = Path.GetFileNameWithoutExtension(sidecarFile);
// Get (by comparing w/o extension) list of matching image files in lower case
string scFilenameWOExt = Path.GetFileNameWithoutExtension(sidecarFile).ToLower();
List<string> matchingImageFiles = imageFiles
.Where(predicate: imgFile => Path.GetFileNameWithoutExtension(imgFile) == scFilenameWOExt)
.Where(predicate: imgFile => Path.GetFileNameWithoutExtension(imgFile).ToLower() == scFilenameWOExt)
.ToList();
if (matchingImageFiles.Count>1)
Logger.Warn(message: $"Sidecar file '{sidecarFile}' matches multiple image files!");
Expand Down Expand Up @@ -257,9 +256,9 @@ public void ParseFolderToDEs(string folder, Action<string> statusMethod)
InitiateEXIFParsing(fileNameWithPath, props);

// Add sidecar file and data if available
if (image2sidecar.ContainsKey(fileNameWithPath.ToLower()))
if (image2sidecar.ContainsKey(fileNameWithPath))
{
string scFile = image2sidecar[fileNameWithPath.ToLower()];
string scFile = image2sidecar[fileNameWithPath];
Logger.Trace(message: $"Files: Extracting File Data - adding side car file '{scFile}'");
de.SidecarFile = scFile;
InitiateEXIFParsing(scFile, props);
Expand Down

0 comments on commit 427cc36

Please sign in to comment.