Enhance image processing performance and flexibility by introducing atomic counters, improving file pattern matching, and refining logo positioning logic.
This commit is contained in:
parent
ba965e8266
commit
68c1106f65
8 changed files with 134 additions and 68 deletions
|
|
@ -142,13 +142,17 @@ namespace MaddoShared
|
|||
|
||||
private List<FileData> GetFilesToProcess(Options options)
|
||||
{
|
||||
// Support multiple common JPEG patterns so files named .jpeg, .jpe, etc. are included
|
||||
var jpgPatterns = new[] { "*.jpg", "*.jpeg", "*.jpe", "*.jfif", "*.pjpeg", "*.pjp" };
|
||||
|
||||
if (options.AggiornaSottodirectory && options.CreaSottocartelle)
|
||||
{
|
||||
var helper = new FileHelperSharp();
|
||||
// Pass patterns joined by ';' - FileHelperSharp will split and handle multiple patterns
|
||||
return helper.GetFilesRecursive(
|
||||
new DirectoryInfo(options.SourcePath),
|
||||
new DirectoryInfo(options.DestinationPath),
|
||||
"*.jpg",
|
||||
string.Join(";", jpgPatterns),
|
||||
new FileHelperOptions
|
||||
{
|
||||
FilesPerFolder = options.FilePerCartella,
|
||||
|
|
@ -158,10 +162,13 @@ namespace MaddoShared
|
|||
});
|
||||
}
|
||||
|
||||
var files = Directory.EnumerateFiles(
|
||||
options.SourcePath,
|
||||
"*.jpg",
|
||||
options.AggiornaSottodirectory ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly);
|
||||
// For non-recursive or recursive enumeration without using the helper, enumerate for each pattern
|
||||
var searchOption = options.AggiornaSottodirectory ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly;
|
||||
|
||||
var files = jpgPatterns
|
||||
.SelectMany(p => Directory.EnumerateFiles(options.SourcePath, p, searchOption))
|
||||
.Distinct()
|
||||
.ToList();
|
||||
|
||||
return files.Select(x =>
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue