Catalog/imagecatalog/Models/SettingsDto.cs
MaddoScientisto c261557a29 feat: Add Face Matcher functionality and related settings
- Implemented FilePathToBitmapConverter for image loading.
- Enhanced DataModel with commands and properties for Face Matcher.
- Created FaceMatcherResultItem model to store results.
- Updated SettingsDto to include Face Matcher paths and tolerance.
- Introduced PickerPreferenceService for managing folder paths.
- Expanded AiSettingsViewModel to manage Face Matcher settings and results.
2026-05-09 20:27:44 +02:00

378 lines
13 KiB
C#

using System;
using System.Text.Json.Serialization;
using System.Xml.Serialization;
namespace ImageCatalog_2.Models
{
/// <summary>
/// Data Transfer Object for application settings.
/// Uses attributes to control serialization behavior for both XML (legacy) and JSON (future).
/// </summary>
public class SettingsDto
{
// New enum to represent thumbnail mode in a single property.
public enum ThumbnailOptionDto
{
None = 0,
Text = 1,
FileName = 2,
Time = 3,
FileNameAndTime = 4,
RaceTime = 5
}
[JsonPropertyName("ThumbnailOption")]
[XmlElement("MiniatureModalita")]
public ThumbnailOptionDto ThumbnailOption { get; set; } = ThumbnailOptionDto.None;
// Paths
[JsonPropertyName("SourcePath")]
[XmlElement("DirSorgente")]
public string SourcePath { get; set; }
[JsonPropertyName("DestinationPath")]
[XmlElement("DirDestinazione")]
public string DestinationPath { get; set; }
// Thumbnails
[JsonPropertyName("CreateThumbnails")]
[XmlElement("MiniatureCrea")]
public bool CreateThumbnails { get; set; } = true;
[JsonPropertyName("ThumbnailPrefix")]
[XmlElement("MiniatureSuffisso")]
public string ThumbnailPrefix { get; set; } = "tn_";
[JsonPropertyName("ThumbnailHeight")]
[XmlElement("MiniatureAltezza")]
public int ThumbnailHeight { get; set; } = 350;
[JsonPropertyName("ThumbnailWidth")]
[XmlElement("MiniatureLarghezza")]
public int ThumbnailWidth { get; set; } = 350;
[JsonPropertyName("FontSizeThumbnail")]
[XmlElement("FontDimensioneMiniatura")]
public int FontSizeThumbnail { get; set; } = 50;
[JsonPropertyName("JpegQualityThumbnail")]
[XmlElement("CompressioneJpegMiniatura")]
public int JpegQualityThumbnail { get; set; } = 30;
[JsonPropertyName("AddTimeToThumbnails")]
[XmlElement("MiniatureAddOrario")]
public bool AddTimeToThumbnails { get; set; }
[JsonPropertyName("ShowFileNameOnThumbnails")]
[XmlElement("NomeMiniatura")]
public bool ShowFileNameOnThumbnails { get; set; }
[JsonPropertyName("AddTextToThumbnails")]
[XmlElement("MiniatureAddScritta")]
public bool AddTextToThumbnails { get; set; }
[JsonPropertyName("AddRaceTimeToThumbnails")]
[XmlElement("TempoSmall")]
public bool AddRaceTimeToThumbnails { get; set; }
[JsonPropertyName("AddNumberAndTimeToThumbnails")]
[XmlElement("NumTempoSmall")]
public bool AddNumberAndTimeToThumbnails { get; set; }
// Big photo
[JsonPropertyName("BigPhotoSuffix")]
[XmlElement("FotoCodice")]
public string BigPhotoSuffix { get; set; } = "";
[JsonPropertyName("PhotoBigHeight")]
[XmlElement("FotoAltezza")]
public int PhotoBigHeight { get; set; } = 2240;
[JsonPropertyName("PhotoBigWidth")]
[XmlElement("FotoLarghezza")]
public int PhotoBigWidth { get; set; } = 2240;
[JsonPropertyName("KeepOriginalDimensions")]
[XmlElement("FotoDimOriginali")]
public bool KeepOriginalDimensions { get; set; }
[JsonPropertyName("JpegQuality")]
[XmlElement("CompressioneJpeg")]
public int JpegQuality { get; set; } = 85;
// Font
[JsonPropertyName("FontSize")]
[XmlElement("FontDimensione")]
public int FontSize { get; set; } = 20;
[JsonPropertyName("FontName")]
[XmlElement("FontNome")]
public string FontName { get; set; } = "Arial";
[JsonPropertyName("FontBold")]
[XmlElement("FontBold")]
public bool FontBold { get; set; }
[JsonPropertyName("TextColorRGB")]
[XmlElement("ColoreTestoRGB")]
public string TextColorRGB { get; set; } = "Yellow";
// Text
[JsonPropertyName("HorizontalText")]
[XmlElement("TestoTesto")]
public string HorizontalText { get; set; }
[JsonPropertyName("VerticalText")]
[XmlElement("TestoVerticale")]
public string VerticalText { get; set; }
[JsonPropertyName("TextTransparency")]
[XmlElement("TestoTrasparente")]
public int TextTransparency { get; set; }
[JsonPropertyName("TextMargin")]
[XmlElement("TestoMargine")]
public int TextMargin { get; set; } = 8;
[JsonPropertyName("VerticalPosition")]
[XmlElement("TestoPosizione")]
public string VerticalPosition { get; set; } = "Basso";
[JsonPropertyName("HorizontalAlignment")]
[XmlElement("TestoAllineamento")]
public string HorizontalAlignment { get; set; } = "Centro";
[JsonPropertyName("VerticalTextSize")]
[XmlElement("GrandezzaVerticale")]
public int VerticalTextSize { get; set; } = 20;
[JsonPropertyName("VerticalTextMargin")]
[XmlElement("MargineVerticale")]
public int VerticalTextMargin { get; set; } = 6;
// Logo/Watermark
[JsonPropertyName("LogoFile")]
[XmlElement("MarchioFile")]
public string LogoFile { get; set; } = "";
[JsonPropertyName("LogoHeight")]
[XmlElement("MarchioAltezza")]
public int LogoHeight { get; set; } = 430;
[JsonPropertyName("LogoWidth")]
[XmlElement("MarchioLarghezza")]
public int LogoWidth { get; set; } = 430;
[JsonPropertyName("LogoMargin")]
[XmlElement("MarchioMargine")]
public int LogoMargin { get; set; } = 290;
[JsonPropertyName("LogoHorizontalPosition")]
[XmlElement("MarchioAllOrizzontale")]
public string LogoHorizontalPosition { get; set; } = "Destra";
[JsonPropertyName("LogoVerticalPosition")]
[XmlElement("MarchioAllVerticale")]
public string LogoVerticalPosition { get; set; } = "Basso";
[JsonPropertyName("LogoTransparency")]
[XmlElement("MarchioTrasparenza")]
public int LogoTransparency { get; set; } = 100;
[JsonPropertyName("AddLogo")]
[XmlElement("MarchioAggiungi")]
public bool AddLogo { get; set; }
// Color-key transparency settings
[JsonPropertyName("TransparentColor")]
[XmlElement("ColoreTrasparente")]
public string TransparentColor { get; set; } = "#FFFFFF";
[JsonPropertyName("UseTransparentColor")]
[XmlElement("UsaColoreTrasparente")]
public bool UseTransparentColor { get; set; } = false;
// Selected image processing library (e.g., "System.Graphics" or "ImageSharp")
[JsonPropertyName("ImageLibrary")]
[XmlElement("ImageLibrary")]
public string ImageLibrary { get; set; } = "ImageSharp";
// Options
[JsonPropertyName("ForceJpeg")]
[XmlElement("GeneraleForzaJpg")]
public bool ForceJpeg { get; set; }
[JsonPropertyName("AutomaticRotation")]
[XmlElement("GeneraleRotazioneAutomatica")]
public bool AutomaticRotation { get; set; }
[JsonPropertyName("UpdateSubdirectories")]
[XmlElement("DirSottoDirectory")]
public bool UpdateSubdirectories { get; set; }
[JsonPropertyName("AddRaceTime")]
[XmlElement("TempoGara")]
public bool AddRaceTime { get; set; }
[JsonPropertyName("AddTime")]
[XmlElement("Orario")]
public bool AddTime { get; set; }
[JsonPropertyName("TimeLabel")]
[XmlElement("EtichettaOrario")]
public string TimeLabel { get; set; } = "";
[JsonPropertyName("ShowDate")]
[XmlElement("DataFoto")]
public bool ShowDate { get; set; }
[JsonPropertyName("ShowPhotoNumber")]
[XmlElement("NumeroFoto")]
public bool ShowPhotoNumber { get; set; }
[JsonPropertyName("OverwriteImages")]
[XmlElement("GeneraleSovrascriviFile")]
public bool OverwriteImages { get; set; }
// Folder division
[JsonPropertyName("FilesPerFolder")]
[XmlElement("DirDividiNumFile")]
public int FilesPerFolder { get; set; } = 99;
[JsonPropertyName("FolderSuffix")]
[XmlElement("DirDividiSuffisso")]
public string FolderSuffix { get; set; } = "";
[JsonPropertyName("CounterDigits")]
[XmlElement("DirDividiNumCifre")]
public int CounterDigits { get; set; } = 2;
// Processing
[JsonPropertyName("ChunkSize")]
[XmlElement("ChunkSize")]
public int ChunkSize { get; set; }
[JsonPropertyName("ThreadsCount")]
[XmlElement("ThreadsCount")]
public int ThreadsCount { get; set; }
// Race date
[JsonPropertyName("RaceStartDate")]
[XmlElement("DataPartenza")]
public DateTime RaceStartDate { get; set; } = DateTime.Now;
// AI / OCR settings
[JsonPropertyName("ExtractNumbers")]
[XmlElement("AI_EstraiNumeri")]
public bool ExtractNumbers { get; set; }
[JsonPropertyName("ModelsFolderPath")]
[XmlElement("AI_CartellaModelli")]
public string ModelsFolderPath { get; set; }
[JsonPropertyName("CsvOutputPath")]
[XmlElement("AI_PercorsoCsv")]
public string CsvOutputPath { get; set; }
[JsonPropertyName("UseNumberAiGpu")]
[XmlElement("AI_UsaGpuNumeri")]
public bool UseNumberAiGpu { get; set; }
[JsonPropertyName("IncludeNumberAiThumbnails")]
[XmlElement("AI_IncludiThumbnailNumeri")]
public bool IncludeNumberAiThumbnails { get; set; }
[JsonPropertyName("NumberAiWorkloadLevel")]
[XmlElement("AI_LivelloCaricoNumeri")]
public int NumberAiWorkloadLevel { get; set; } = 3;
[JsonPropertyName("FaceExecutablePath")]
[XmlElement("AI_FaceExecutablePath")]
public string FaceExecutablePath { get; set; } = string.Empty;
[JsonPropertyName("FaceOutputFolderPath")]
[XmlElement("AI_FaceOutputFolderPath")]
public string FaceOutputFolderPath { get; set; } = string.Empty;
[JsonPropertyName("FaceRecursive")]
[XmlElement("AI_FaceRecursive")]
public bool FaceRecursive { get; set; }
[JsonPropertyName("FaceIncludeThumbnails")]
[XmlElement("AI_FaceIncludeThumbnails")]
public bool FaceIncludeThumbnails { get; set; }
[JsonPropertyName("FaceParallelism")]
[XmlElement("AI_FaceParallelism")]
public int FaceParallelism { get; set; } = 3;
[JsonPropertyName("FaceMinSize")]
[XmlElement("AI_FaceMinSize")]
public int FaceMinSize { get; set; } = 35;
[JsonPropertyName("FaceUpsample")]
[XmlElement("AI_FaceUpsample")]
public bool FaceUpsample { get; set; } = true;
[JsonPropertyName("FaceMatcherExecutablePath")]
[XmlElement("AI_FaceMatcherExecutablePath")]
public string FaceMatcherExecutablePath { get; set; } = string.Empty;
[JsonPropertyName("FaceMatcherTolerance")]
[XmlElement("AI_FaceMatcherTolerance")]
public double FaceMatcherTolerance { get; set; } = 0.5;
// Race upload settings
[JsonPropertyName("ApiLogin")]
[XmlElement("RaceUpload_Login")]
public string ApiLogin { get; set; } = string.Empty;
[JsonPropertyName("ApiPassword")]
[XmlElement("RaceUpload_Password")]
public string ApiPassword { get; set; } = string.Empty;
[JsonPropertyName("ApiRaceDescription")]
[XmlElement("RaceUpload_Description")]
public string ApiRaceDescription { get; set; } = string.Empty;
[JsonPropertyName("ApiRaceTypeId")]
[XmlElement("RaceUpload_TipoGaraId")]
public string ApiRaceTypeId { get; set; } = "1";
[JsonPropertyName("ApiRaceStartDate")]
[XmlElement("RaceUpload_StartDate")]
public DateTime ApiRaceStartDate { get; set; } = DateTime.Today;
[JsonPropertyName("ApiRaceEndDate")]
[XmlElement("RaceUpload_EndDate")]
public DateTime ApiRaceEndDate { get; set; } = DateTime.Today;
[JsonPropertyName("ApiPathBase")]
[XmlElement("RaceUpload_PathBase")]
public string ApiPathBase { get; set; } = string.Empty;
[JsonPropertyName("ApiLocalita")]
[XmlElement("RaceUpload_Localita")]
public string ApiLocalita { get; set; } = string.Empty;
[JsonPropertyName("ApiEventoInLineaIndex")]
[XmlElement("RaceUpload_EventoInLinea")]
public int ApiEventoInLineaIndex { get; set; } = 0;
[JsonPropertyName("ApiTipoIndexValue")]
[XmlElement("RaceUpload_TipoIndex")]
public int ApiTipoIndexValue { get; set; } = 1;
[JsonPropertyName("ApiFreeEventIndex")]
[XmlElement("RaceUpload_FreeEvent")]
public int ApiFreeEventIndex { get; set; } = 0;
[JsonPropertyName("ApiRaceId")]
[XmlElement("RaceUpload_LastRaceId")]
public string ApiRaceId { get; set; } = string.Empty;
[JsonPropertyName("ApiRemoteProcessedBasePath")]
[XmlElement("RaceUpload_RemoteProcessedBasePath")]
public string ApiRemoteProcessedBasePath { get; set; } = string.Empty;
}
}