Add image processing benchmarks and UI folder open buttons

- Added MaddoShared.Benchmarks project with BenchmarkDotNet for comprehensive image processing performance tests (parallel, chunk, size, stress).
- Included helper for generating test images and custom configs to ensure InProcess toolchain for .NET Windows compatibility.
- Added cross-platform scripts to run benchmarks easily.
- Updated .gitignore for benchmark artifacts and temp files.
- Exposed GetFilesToProcessPublic in ImageCreationStuff for testability.
- Added file name sanitization in ImageCreatorSharp to prevent IO errors.
- Enhanced WinForms UI: added "Open" buttons for source/destination folders, handled folder opening in Explorer, and improved user messaging and layout.
- Updated solution file to include new benchmark project.
This commit is contained in:
MaddoScientisto 2026-02-14 19:20:25 +01:00
commit c2fd4bf780
17 changed files with 1608 additions and 301 deletions

View file

@ -194,6 +194,21 @@ public class ImageCreatorSharp(PicSettings picSettings, ILogger<ImageCreatorShar
// nomeFileBig = NomeFileChild
imgState.NomeFileSmall = picSettings.Suffisso + imgState.WorkFile.Name;
imgState.NomeFileBig = imgState.WorkFile.Name;
// Sanitize file names to avoid invalid characters causing IO errors
imgState.NomeFileSmall = SanitizeFileName(imgState.NomeFileSmall);
imgState.NomeFileBig = SanitizeFileName(imgState.NomeFileBig);
}
private static string SanitizeFileName(string fileName)
{
if (string.IsNullOrEmpty(fileName)) return fileName;
var invalid = Path.GetInvalidFileNameChars();
var sb = new System.Text.StringBuilder(fileName.Length);
foreach (var ch in fileName)
{
sb.Append(Array.IndexOf(invalid, ch) >= 0 ? '_' : ch);
}
return sb.ToString();
}
private void PrepareThumbnailSize(Image g, ImageState imgState)