Formatting
This commit is contained in:
parent
80fcaa6fd0
commit
a466efbb27
3 changed files with 22 additions and 21 deletions
|
|
@ -15,7 +15,10 @@ using Microsoft.Extensions.Logging;
|
|||
namespace MaddoShared
|
||||
{
|
||||
[SuppressMessage("Interoperability", "CA1416:Validate platform compatibility")]
|
||||
public class ImageCreationStuff(ILogger<ImageCreationStuff> logger, PicSettings picSettings, ImageCreatorSharp imageCreatorService)
|
||||
public class ImageCreationStuff(
|
||||
ILogger<ImageCreationStuff> logger,
|
||||
PicSettings picSettings,
|
||||
ImageCreatorSharp imageCreatorService)
|
||||
{
|
||||
public class Options
|
||||
{
|
||||
|
|
@ -59,19 +62,19 @@ namespace MaddoShared
|
|||
|
||||
// int threads = options.MaxThreads == 0 ? Environment.ProcessorCount * 2 : options.MaxThreads;
|
||||
int threads = options.MaxThreads;
|
||||
|
||||
|
||||
Bitmap logoBmp = null;
|
||||
// Load Logo
|
||||
if (picSettings.LogoAggiungi & File.Exists(picSettings.LogoNomeFile))
|
||||
{
|
||||
logoBmp = new Bitmap(picSettings.LogoNomeFile);
|
||||
}
|
||||
|
||||
|
||||
Func<FileData, Task> processFile = async fileData =>
|
||||
{
|
||||
using var logoCopy = logoBmp.Clone(new Rectangle(0, 0, logoBmp.Width, logoBmp.Height),
|
||||
logoBmp.PixelFormat);
|
||||
|
||||
|
||||
var imgState = new ImageState
|
||||
{
|
||||
WorkFile = fileData.File,
|
||||
|
|
@ -79,10 +82,10 @@ namespace MaddoShared
|
|||
};
|
||||
|
||||
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);
|
||||
|
||||
try
|
||||
|
|
@ -118,7 +121,7 @@ namespace MaddoShared
|
|||
maxDegreeOfParallelism: threads,
|
||||
false,
|
||||
cancellationToken);
|
||||
|
||||
|
||||
chunk.Clear();
|
||||
GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced, blocking: false, compacting: false);
|
||||
}
|
||||
|
|
@ -132,7 +135,6 @@ namespace MaddoShared
|
|||
{
|
||||
logger.LogError(e, "Error in disposing the logo");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private List<FileData> GetFilesToProcess(Options options)
|
||||
|
|
@ -171,7 +173,7 @@ namespace MaddoShared
|
|||
destFolderInfo.EnsureDirectoryExists();
|
||||
|
||||
return new FileData(fInfo, new DirectoryInfo(new FileInfo(newFilePath).DirectoryName));
|
||||
|
||||
|
||||
// var destDir = new FileInfo(newFilePath).Directory!;
|
||||
// destDir.Create(); // Ensure exists
|
||||
//
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue