develop #1

Open
maddo wants to merge 126 commits from develop into master
5 changed files with 482 additions and 585 deletions
Showing only changes of commit fa889a5cd3 - Show all commits

Refactored image creator code

Marco 2025-07-28 11:25:46 +02:00

View file

@ -13,7 +13,7 @@ using Microsoft.Extensions.Logging;
namespace MaddoShared
{
public class ImageCreationStuff(ILogger<ImageCreationStuff> logger, PicSettings picSettings)
public class ImageCreationStuff(ILogger<ImageCreationStuff> logger, PicSettings picSettings, ImageCreatorSharp imageCreatorService)
{
public class Options
{
@ -72,8 +72,16 @@ namespace MaddoShared
using var logoCopy = logoBmp.Clone(new Rectangle(0, 0, logoBmp.Width, logoBmp.Height),
logoBmp.PixelFormat);
using var imgCreator = new ImageCreatorSharp(fileData.File, fileData.Directory, picSettings);
await imgCreator.CreaImmagineThread(fileData.File.Name, logoCopy);
var imgState = new ImageState
{
WorkFile = fileData.File,
DestDir = fileData.Directory,
};
await imageCreatorService.CreaImmagineThread(imgState, logoCopy);
// using var imgCreator = new ImageCreatorSharp(fileData.File, fileData.Directory, picSettings);
// await imgCreator.CreaImmagineThread(fileData.File.Name, logoCopy);
results.Add(fileData.File.Name);

File diff suppressed because it is too large Load diff

45
MaddoShared/ImageState.cs Normal file
View file

@ -0,0 +1,45 @@
using System;
using System.Drawing;
using System.IO;
namespace MaddoShared;
public class ImageState
{
public bool FotoRuotaADestra { get; set; } = false;
public bool FotoRuotaASinistra { get; set; } = false;
public string TempMinText { get; set; } = "";
// public crFont1 As Font
public string NomeFileChild { get; set; }
public DirectoryInfo SourceDir { get; set; }
public DirectoryInfo DestDirStart { get; set; }
public DirectoryInfo DestDir { get; set; }
public FileInfo WorkFile { get; set; }
public string TestoFirma { get; set; }
public string TestoFirmaV { get; set; }
public int AlphaScelta { get; set; }
public int DimensioneStandard { get; set; }
public int DimensioneStandardMiniatura { get; set; }
public DateTime DataFoto { get; set; }
public DateTime DataPartenzaI { get; set; }
public string TestoOrario { get; set; }
public string TestoFirmaPiccola { get; set; }
public Size ThumbSizeSmall { get; set; }
public Size ThumbSizeBig { get; set; }
public string NomeFileSmall{ get; set; }
public string NomeFileBig{ get; set; }
public string NomeFileBig2{ get; set; }
public float YPosFromBottom{ get; set; }
public float YPosFromBottom1{ get; set; }
public float YPosFromBottom2{ get; set; }
public float YPosFromBottom3{ get; set; }
public float YPosFromBottom4{ get; set; }
public Orientations Orientation{ get; set; }
public DateTime? CreationDate{ get; set; }
}

View file

@ -10,6 +10,10 @@
<ItemGroup>
<PackageReference Include="AsyncEnumerator" Version="4.0.2" />
<PackageReference Include="Ben.Demystifier" Version="0.4.1" />
<PackageReference Include="IDisposableAnalyzers" Version="4.0.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="9.0.7" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.7" />

View file

@ -82,6 +82,7 @@ namespace ImageCatalog_2
services.AddTransient<DataModel>();
services.AddTransient<ImageCreationStuff>();
services.AddTransient<ImageCreatorSharp>();
services.AddSingleton<ParametriSetup>();
services.AddSingleton<PicSettings>();