modernized picsettings
This commit is contained in:
parent
4ceb46d65c
commit
63aac7f911
5 changed files with 243 additions and 915 deletions
|
|
@ -13,7 +13,7 @@ using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace MaddoShared
|
namespace MaddoShared
|
||||||
{
|
{
|
||||||
public class ImageCreationStuff(ILogger<ImageCreationStuff> logger)
|
public class ImageCreationStuff(ILogger<ImageCreationStuff> logger, PicSettings picSettings)
|
||||||
{
|
{
|
||||||
public class Options
|
public class Options
|
||||||
{
|
{
|
||||||
|
|
@ -62,9 +62,9 @@ namespace MaddoShared
|
||||||
|
|
||||||
Bitmap logoBmp = null;
|
Bitmap logoBmp = null;
|
||||||
// Load Logo
|
// Load Logo
|
||||||
if (PicSettings.LogoAggiungi & File.Exists(PicSettings.LogoNomeFile))
|
if (picSettings.LogoAggiungi & File.Exists(picSettings.LogoNomeFile))
|
||||||
{
|
{
|
||||||
logoBmp = new Bitmap(PicSettings.LogoNomeFile);
|
logoBmp = new Bitmap(picSettings.LogoNomeFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
Func<FileData, Task> processFile = async fileData =>
|
Func<FileData, Task> processFile = async fileData =>
|
||||||
|
|
@ -72,7 +72,7 @@ namespace MaddoShared
|
||||||
using var logoCopy = logoBmp.Clone(new Rectangle(0, 0, logoBmp.Width, logoBmp.Height),
|
using var logoCopy = logoBmp.Clone(new Rectangle(0, 0, logoBmp.Width, logoBmp.Height),
|
||||||
logoBmp.PixelFormat);
|
logoBmp.PixelFormat);
|
||||||
|
|
||||||
using var imgCreator = new ImageCreatorSharp(fileData.File, fileData.Directory);
|
using var imgCreator = new ImageCreatorSharp(fileData.File, fileData.Directory, picSettings);
|
||||||
await imgCreator.CreaImmagineThread(fileData.File.Name, logoCopy);
|
await imgCreator.CreaImmagineThread(fileData.File.Name, logoCopy);
|
||||||
|
|
||||||
results.Add(fileData.File.Name);
|
results.Add(fileData.File.Name);
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,8 @@ public class ImageCreatorSharp : IDisposable
|
||||||
private Orientations _orientation;
|
private Orientations _orientation;
|
||||||
private DateTime? _creationDate;
|
private DateTime? _creationDate;
|
||||||
|
|
||||||
|
private readonly PicSettings _picSettings;
|
||||||
|
|
||||||
public ImageCreatorSharp()
|
public ImageCreatorSharp()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -77,8 +79,9 @@ public class ImageCreatorSharp : IDisposable
|
||||||
this.DestDir = destDir;
|
this.DestDir = destDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImageCreatorSharp(FileInfo file, DirectoryInfo destination)
|
public ImageCreatorSharp(FileInfo file, DirectoryInfo destination, PicSettings picSettings)
|
||||||
{
|
{
|
||||||
|
_picSettings = picSettings;
|
||||||
this.WorkFile = file;
|
this.WorkFile = file;
|
||||||
this.DestDir = destination;
|
this.DestDir = destination;
|
||||||
}
|
}
|
||||||
|
|
@ -104,7 +107,7 @@ public class ImageCreatorSharp : IDisposable
|
||||||
|
|
||||||
// Forza jpeg se è selezionata l'opzione
|
// Forza jpeg se è selezionata l'opzione
|
||||||
System.Drawing.Imaging.ImageFormat thisFormat = g.RawFormat;
|
System.Drawing.Imaging.ImageFormat thisFormat = g.RawFormat;
|
||||||
if (PicSettings.UsaForzaJpg == true)
|
if (_picSettings.UsaForzaJpg == true)
|
||||||
thisFormat = System.Drawing.Imaging.ImageFormat.Jpeg;
|
thisFormat = System.Drawing.Imaging.ImageFormat.Jpeg;
|
||||||
|
|
||||||
prepareThumbnailSize(g);
|
prepareThumbnailSize(g);
|
||||||
|
|
@ -128,7 +131,7 @@ public class ImageCreatorSharp : IDisposable
|
||||||
//GC.Collect();
|
//GC.Collect();
|
||||||
}
|
}
|
||||||
|
|
||||||
// PicSettings.mainForm.stepProgressBar()
|
// _picSettings.mainForm.stepProgressBar()
|
||||||
|
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
@ -179,7 +182,7 @@ public class ImageCreatorSharp : IDisposable
|
||||||
FotoRuotaADestra = false;
|
FotoRuotaADestra = false;
|
||||||
FotoRuotaASinistra = false;
|
FotoRuotaASinistra = false;
|
||||||
|
|
||||||
if (PicSettings.UsaRotazioneAutomatica == true)
|
if (_picSettings.UsaRotazioneAutomatica == true)
|
||||||
{
|
{
|
||||||
if (g.PropertyIdList.Length > 0)
|
if (g.PropertyIdList.Length > 0)
|
||||||
{
|
{
|
||||||
|
|
@ -215,24 +218,24 @@ public class ImageCreatorSharp : IDisposable
|
||||||
/// ''' <remarks></remarks>
|
/// ''' <remarks></remarks>
|
||||||
private void impostaTestoExtra(Image g)
|
private void impostaTestoExtra(Image g)
|
||||||
{
|
{
|
||||||
if (PicSettings.UsaOrarioTestoApplicare | PicSettings.UsaTempoGaraTestoApplicare | PicSettings.UsaOrarioMiniatura | PicSettings.TestoMin | PicSettings.AggTempoGaraMin | PicSettings.AggNumTempMin)
|
if (_picSettings.UsaOrarioTestoApplicare | _picSettings.UsaTempoGaraTestoApplicare | _picSettings.UsaOrarioMiniatura | _picSettings.TestoMin | _picSettings.AggTempoGaraMin | _picSettings.AggNumTempMin)
|
||||||
{
|
{
|
||||||
if (g.PropertyIdList.Length > 0)
|
if (g.PropertyIdList.Length > 0)
|
||||||
{
|
{
|
||||||
//ExifReader DatiExif = new ExifReader((Bitmap)g);
|
//ExifReader DatiExif = new ExifReader((Bitmap)g);
|
||||||
dataFoto = _creationDate ?? DateTime.Now; //DatiExif.DateTimeOriginal;
|
dataFoto = _creationDate ?? DateTime.Now; //DatiExif.DateTimeOriginal;
|
||||||
testoFirma = PicSettings.TestoFirmaStart;
|
testoFirma = _picSettings.TestoFirmaStart;
|
||||||
testoFirmaV = PicSettings.TestoFirmaStartV;
|
testoFirmaV = _picSettings.TestoFirmaStartV;
|
||||||
|
|
||||||
if (dataFoto.Year != 1)
|
if (dataFoto.Year != 1)
|
||||||
{
|
{
|
||||||
testoFirmaPiccola = dataFoto.ToShortTimeString();
|
testoFirmaPiccola = dataFoto.ToShortTimeString();
|
||||||
if (PicSettings.UsaOrarioTestoApplicare == true)
|
if (_picSettings.UsaOrarioTestoApplicare == true)
|
||||||
{
|
{
|
||||||
testoFirma += " " + dataFoto.ToShortDateString() + " " + dataFoto.ToLongTimeString();
|
testoFirma += " " + dataFoto.ToShortDateString() + " " + dataFoto.ToLongTimeString();
|
||||||
testoFirmaV += " " + dataFoto.ToShortDateString() + " " + dataFoto.ToLongTimeString();
|
testoFirmaV += " " + dataFoto.ToShortDateString() + " " + dataFoto.ToLongTimeString();
|
||||||
}
|
}
|
||||||
if (PicSettings.UsaTempoGaraTestoApplicare == true)
|
if (_picSettings.UsaTempoGaraTestoApplicare == true)
|
||||||
{
|
{
|
||||||
|
|
||||||
var diff = dataPartenzaI - dataFoto;
|
var diff = dataPartenzaI - dataFoto;
|
||||||
|
|
@ -247,8 +250,8 @@ public class ImageCreatorSharp : IDisposable
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
testoFirma = PicSettings.TestoFirmaStart;
|
testoFirma = _picSettings.TestoFirmaStart;
|
||||||
testoFirmaV = PicSettings.TestoFirmaStartV;
|
testoFirmaV = _picSettings.TestoFirmaStartV;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -258,11 +261,11 @@ public class ImageCreatorSharp : IDisposable
|
||||||
/// ''' <remarks></remarks>
|
/// ''' <remarks></remarks>
|
||||||
private void preparaVariabili()
|
private void preparaVariabili()
|
||||||
{
|
{
|
||||||
alphaScelta = System.Convert.ToInt32((255 * (100 - PicSettings.Trasparenza) / (double)100));
|
alphaScelta = System.Convert.ToInt32((255 * (100 - _picSettings.Trasparenza) / (double)100));
|
||||||
testoFirma = "";
|
testoFirma = "";
|
||||||
testoFirmaV = "";
|
testoFirmaV = "";
|
||||||
dataPartenzaI = PicSettings.DataPartenza;
|
dataPartenzaI = _picSettings.DataPartenza;
|
||||||
testoOrario = PicSettings.TestoOrario;
|
testoOrario = _picSettings.TestoOrario;
|
||||||
if (testoOrario.Length > 0)
|
if (testoOrario.Length > 0)
|
||||||
testoOrario += " ";
|
testoOrario += " ";
|
||||||
testoFirmaPiccola = "";
|
testoFirmaPiccola = "";
|
||||||
|
|
@ -271,11 +274,11 @@ public class ImageCreatorSharp : IDisposable
|
||||||
nomeFileSmall = "";
|
nomeFileSmall = "";
|
||||||
nomeFileBig2 = "";
|
nomeFileBig2 = "";
|
||||||
nomeFileBig = "";
|
nomeFileBig = "";
|
||||||
DimensioneStandard = PicSettings.DimStandard;
|
DimensioneStandard = _picSettings.DimStandard;
|
||||||
DimensioneStandardMiniatura = PicSettings.DimStandardMiniatura;
|
DimensioneStandardMiniatura = _picSettings.DimStandardMiniatura;
|
||||||
// nomeFileSmall = Suffisso & NomeFileChild
|
// nomeFileSmall = Suffisso & NomeFileChild
|
||||||
// nomeFileBig = NomeFileChild
|
// nomeFileBig = NomeFileChild
|
||||||
nomeFileSmall = PicSettings.Suffisso + WorkFile.Name;
|
nomeFileSmall = _picSettings.Suffisso + WorkFile.Name;
|
||||||
nomeFileBig = WorkFile.Name;
|
nomeFileBig = WorkFile.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -283,13 +286,13 @@ public class ImageCreatorSharp : IDisposable
|
||||||
{
|
{
|
||||||
if (g.Width > g.Height)
|
if (g.Width > g.Height)
|
||||||
{
|
{
|
||||||
thumbSizeSmall = NewthumbSize(g.Width, g.Height, PicSettings.LarghezzaSmall, "Larghezza");
|
thumbSizeSmall = NewthumbSize(g.Width, g.Height, _picSettings.LarghezzaSmall, "Larghezza");
|
||||||
Size SizeOrig = new Size(g.Width, g.Height);
|
Size SizeOrig = new Size(g.Width, g.Height);
|
||||||
thumbSizeBig = SizeOrig;
|
thumbSizeBig = SizeOrig;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
thumbSizeSmall = NewthumbSize(g.Width, g.Height, PicSettings.AltezzaSmall, "Altezza");
|
thumbSizeSmall = NewthumbSize(g.Width, g.Height, _picSettings.AltezzaSmall, "Altezza");
|
||||||
Size SizeOrig = new Size(g.Width, g.Height);
|
Size SizeOrig = new Size(g.Width, g.Height);
|
||||||
thumbSizeBig = SizeOrig;
|
thumbSizeBig = SizeOrig;
|
||||||
}
|
}
|
||||||
|
|
@ -297,9 +300,9 @@ public class ImageCreatorSharp : IDisposable
|
||||||
|
|
||||||
private void creaMiniature(Image g, Bitmap imgOutputBig, ImageFormat thisFormat)
|
private void creaMiniature(Image g, Bitmap imgOutputBig, ImageFormat thisFormat)
|
||||||
{
|
{
|
||||||
if (PicSettings.TestoMin)
|
if (_picSettings.TestoMin)
|
||||||
testoFirmaPiccola = nomeFileBig;
|
testoFirmaPiccola = nomeFileBig;
|
||||||
else if (PicSettings.AggNumTempMin)
|
else if (_picSettings.AggNumTempMin)
|
||||||
testoFirmaPiccola = nomeFileBig + " ";
|
testoFirmaPiccola = nomeFileBig + " ";
|
||||||
// Dim yPosFromBottom4 As Single
|
// Dim yPosFromBottom4 As Single
|
||||||
|
|
||||||
|
|
@ -308,13 +311,13 @@ public class ImageCreatorSharp : IDisposable
|
||||||
SizeF crSize1 = new SizeF();
|
SizeF crSize1 = new SizeF();
|
||||||
SizeF crSize2 = new SizeF();
|
SizeF crSize2 = new SizeF();
|
||||||
|
|
||||||
if (PicSettings.CreaMiniature == true)
|
if (_picSettings.CreaMiniature == true)
|
||||||
{
|
{
|
||||||
if (PicSettings.AggiungiScritteMiniature == false)
|
if (_picSettings.AggiungiScritteMiniature == false)
|
||||||
{
|
{
|
||||||
if (string.Equals(PicSettings.DirectorySorgente, PicSettings.DirectoryDestinazione, StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(_picSettings.DirectorySorgente, _picSettings.DirectoryDestinazione, StringComparison.OrdinalIgnoreCase))
|
||||||
nomeFileSmall = nomeFileSmall.Substring(0, nomeFileSmall.Length - 4) + PicSettings.Codice + nomeFileSmall.Substring(nomeFileSmall.Length - 4);
|
nomeFileSmall = nomeFileSmall.Substring(0, nomeFileSmall.Length - 4) + _picSettings.Codice + nomeFileSmall.Substring(nomeFileSmall.Length - 4);
|
||||||
if (PicSettings.UsaOrarioMiniatura | PicSettings.TestoMin | PicSettings.AggTempoGaraMin | PicSettings.AggNumTempMin)
|
if (_picSettings.UsaOrarioMiniatura | _picSettings.TestoMin | _picSettings.AggTempoGaraMin | _picSettings.AggNumTempMin)
|
||||||
{
|
{
|
||||||
if (testoFirmaPiccola.Length > 0)
|
if (testoFirmaPiccola.Length > 0)
|
||||||
{
|
{
|
||||||
|
|
@ -327,15 +330,15 @@ public class ImageCreatorSharp : IDisposable
|
||||||
int LarghezzaStandard1;
|
int LarghezzaStandard1;
|
||||||
// quick fix
|
// quick fix
|
||||||
DimensioneStandardMiniatura = 50;
|
DimensioneStandardMiniatura = 50;
|
||||||
if (PicSettings.Grassetto == true)
|
if (_picSettings.Grassetto == true)
|
||||||
{
|
{
|
||||||
crFont1 = new Font(PicSettings.IlFont, DimensioneStandardMiniatura, FontStyle.Bold);
|
crFont1 = new Font(_picSettings.IlFont, DimensioneStandardMiniatura, FontStyle.Bold);
|
||||||
crFont2 = new Font(PicSettings.IlFont, DimensioneStandard, FontStyle.Bold);
|
crFont2 = new Font(_picSettings.IlFont, DimensioneStandard, FontStyle.Bold);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
crFont1 = new Font(PicSettings.IlFont, DimensioneStandardMiniatura);
|
crFont1 = new Font(_picSettings.IlFont, DimensioneStandardMiniatura);
|
||||||
crFont2 = new Font(PicSettings.IlFont, DimensioneStandard);
|
crFont2 = new Font(_picSettings.IlFont, DimensioneStandard);
|
||||||
}
|
}
|
||||||
|
|
||||||
crSize1 = grPhoto1.MeasureString(testoFirmaPiccola, crFont1);
|
crSize1 = grPhoto1.MeasureString(testoFirmaPiccola, crFont1);
|
||||||
|
|
@ -351,10 +354,10 @@ public class ImageCreatorSharp : IDisposable
|
||||||
Conta -= 5;
|
Conta -= 5;
|
||||||
else
|
else
|
||||||
Conta -= 1;
|
Conta -= 1;
|
||||||
if (PicSettings.Grassetto == true)
|
if (_picSettings.Grassetto == true)
|
||||||
crFont1 = new Font(PicSettings.IlFont, Conta, FontStyle.Bold);
|
crFont1 = new Font(_picSettings.IlFont, Conta, FontStyle.Bold);
|
||||||
else
|
else
|
||||||
crFont1 = new Font(PicSettings.IlFont, Conta);
|
crFont1 = new Font(_picSettings.IlFont, Conta);
|
||||||
crSize1 = grPhoto1.MeasureString(testoFirmaPiccola, crFont1);
|
crSize1 = grPhoto1.MeasureString(testoFirmaPiccola, crFont1);
|
||||||
if (crSize1.Width < System.Convert.ToSingle(g.Width))
|
if (crSize1.Width < System.Convert.ToSingle(g.Width))
|
||||||
{
|
{
|
||||||
|
|
@ -369,19 +372,19 @@ public class ImageCreatorSharp : IDisposable
|
||||||
DimensioneStandardMiniatura = Conta;
|
DimensioneStandardMiniatura = Conta;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (PicSettings.Posizione.ToUpper())
|
switch (_picSettings.Posizione.ToUpper())
|
||||||
{
|
{
|
||||||
case "ALTO":
|
case "ALTO":
|
||||||
{
|
{
|
||||||
yPosFromBottom1 = (PicSettings.Margine);
|
yPosFromBottom1 = (_picSettings.Margine);
|
||||||
yPosFromBottom4 = (PicSettings.MargVert);
|
yPosFromBottom4 = (_picSettings.MargVert);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case "BASSO":
|
case "BASSO":
|
||||||
{
|
{
|
||||||
yPosFromBottom1 = System.Convert.ToSingle((g.Height - crSize1.Height - (g.Height * PicSettings.Margine / (double)100)));
|
yPosFromBottom1 = System.Convert.ToSingle((g.Height - crSize1.Height - (g.Height * _picSettings.Margine / (double)100)));
|
||||||
yPosFromBottom4 = System.Convert.ToSingle((g.Height - crSize1.Height - (g.Height * PicSettings.MargVert / (double)100)));
|
yPosFromBottom4 = System.Convert.ToSingle((g.Height - crSize1.Height - (g.Height * _picSettings.MargVert / (double)100)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -389,13 +392,13 @@ public class ImageCreatorSharp : IDisposable
|
||||||
float xCenterOfImg1 = 0;
|
float xCenterOfImg1 = 0;
|
||||||
|
|
||||||
StringFormat StrFormat1 = new StringFormat();
|
StringFormat StrFormat1 = new StringFormat();
|
||||||
switch (PicSettings.Allineamento.ToUpper())
|
switch (_picSettings.Allineamento.ToUpper())
|
||||||
{
|
{
|
||||||
case "SINISTRA":
|
case "SINISTRA":
|
||||||
{
|
{
|
||||||
xCenterOfImg1 = System.Convert.ToSingle((PicSettings.Margine + (LarghezzaStandard1 / (double)2)));
|
xCenterOfImg1 = System.Convert.ToSingle((_picSettings.Margine + (LarghezzaStandard1 / (double)2)));
|
||||||
|
|
||||||
if ((LarghezzaStandard1 / (double)2) > (g.Width / (double)2) - PicSettings.Margine)
|
if ((LarghezzaStandard1 / (double)2) > (g.Width / (double)2) - _picSettings.Margine)
|
||||||
xCenterOfImg1 = System.Convert.ToSingle((g.Width / (double)2));
|
xCenterOfImg1 = System.Convert.ToSingle((g.Width / (double)2));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -408,9 +411,9 @@ public class ImageCreatorSharp : IDisposable
|
||||||
|
|
||||||
case "DESTRA":
|
case "DESTRA":
|
||||||
{
|
{
|
||||||
xCenterOfImg1 = System.Convert.ToSingle((g.Width - PicSettings.Margine - (LarghezzaStandard1 / (double)2)));
|
xCenterOfImg1 = System.Convert.ToSingle((g.Width - _picSettings.Margine - (LarghezzaStandard1 / (double)2)));
|
||||||
|
|
||||||
if ((LarghezzaStandard1 / (double)2) > (g.Width / (double)2) - PicSettings.Margine)
|
if ((LarghezzaStandard1 / (double)2) > (g.Width / (double)2) - _picSettings.Margine)
|
||||||
xCenterOfImg1 = System.Convert.ToSingle((g.Width / (double)2));
|
xCenterOfImg1 = System.Convert.ToSingle((g.Width / (double)2));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -418,22 +421,22 @@ public class ImageCreatorSharp : IDisposable
|
||||||
StrFormat1.Alignment = StringAlignment.Center;
|
StrFormat1.Alignment = StringAlignment.Center;
|
||||||
|
|
||||||
SolidBrush semiTransBrush21 = new SolidBrush(Color.FromArgb(alphaScelta, 0, 0, 0));
|
SolidBrush semiTransBrush21 = new SolidBrush(Color.FromArgb(alphaScelta, 0, 0, 0));
|
||||||
SolidBrush semiTransBrush1 = new SolidBrush(Color.FromArgb(alphaScelta, PicSettings.FontColoreRGB));
|
SolidBrush semiTransBrush1 = new SolidBrush(Color.FromArgb(alphaScelta, _picSettings.FontColoreRGB));
|
||||||
|
|
||||||
// quick fix
|
// quick fix
|
||||||
DimensioneStandardMiniatura = PicSettings.DimMin;
|
DimensioneStandardMiniatura = _picSettings.DimMin;
|
||||||
|
|
||||||
if (PicSettings.Grassetto == true)
|
if (_picSettings.Grassetto == true)
|
||||||
crFont1 = new Font(PicSettings.IlFont, DimensioneStandardMiniatura, FontStyle.Bold);
|
crFont1 = new Font(_picSettings.IlFont, DimensioneStandardMiniatura, FontStyle.Bold);
|
||||||
else
|
else
|
||||||
crFont1 = new Font(PicSettings.IlFont, DimensioneStandardMiniatura);
|
crFont1 = new Font(_picSettings.IlFont, DimensioneStandardMiniatura);
|
||||||
// asdgadfhdfhjgfsjgfjygfdhsdafa
|
// asdgadfhdfhjgfsjgfjygfdhsdafa
|
||||||
if (PicSettings.TestoMin)
|
if (_picSettings.TestoMin)
|
||||||
{
|
{
|
||||||
grPhoto1.DrawString(nomeFileBig, crFont1, semiTransBrush21, new PointF(xCenterOfImg1 + 1, yPosFromBottom1 + 1), StrFormat1);
|
grPhoto1.DrawString(nomeFileBig, crFont1, semiTransBrush21, new PointF(xCenterOfImg1 + 1, yPosFromBottom1 + 1), StrFormat1);
|
||||||
grPhoto1.DrawString(nomeFileBig, crFont1, semiTransBrush1, new PointF(xCenterOfImg1, yPosFromBottom1), StrFormat1);
|
grPhoto1.DrawString(nomeFileBig, crFont1, semiTransBrush1, new PointF(xCenterOfImg1, yPosFromBottom1), StrFormat1);
|
||||||
}
|
}
|
||||||
else if (PicSettings.AggTempoGaraMin & PicSettings.UsaTempoGaraTestoApplicare)
|
else if (_picSettings.AggTempoGaraMin & _picSettings.UsaTempoGaraTestoApplicare)
|
||||||
{
|
{
|
||||||
var diff = dataPartenzaI - dataFoto;
|
var diff = dataPartenzaI - dataFoto;
|
||||||
var diffA = diff.TotalSeconds * 10000000;
|
var diffA = diff.TotalSeconds * 10000000;
|
||||||
|
|
@ -448,7 +451,7 @@ public class ImageCreatorSharp : IDisposable
|
||||||
grPhoto1.DrawString(tempstr, crFont1, semiTransBrush21, new PointF(xCenterOfImg1 + 1, yPosFromBottom1 + 1), StrFormat1);
|
grPhoto1.DrawString(tempstr, crFont1, semiTransBrush21, new PointF(xCenterOfImg1 + 1, yPosFromBottom1 + 1), StrFormat1);
|
||||||
grPhoto1.DrawString(tempstr, crFont1, semiTransBrush1, new PointF(xCenterOfImg1, yPosFromBottom1), StrFormat1);
|
grPhoto1.DrawString(tempstr, crFont1, semiTransBrush1, new PointF(xCenterOfImg1, yPosFromBottom1), StrFormat1);
|
||||||
}
|
}
|
||||||
else if (PicSettings.AggNumTempMin)
|
else if (_picSettings.AggNumTempMin)
|
||||||
{
|
{
|
||||||
var diff = dataPartenzaI - dataFoto;
|
var diff = dataPartenzaI - dataFoto;
|
||||||
var diffA = diff.TotalSeconds * 10000000;
|
var diffA = diff.TotalSeconds * 10000000;
|
||||||
|
|
@ -515,10 +518,10 @@ public class ImageCreatorSharp : IDisposable
|
||||||
SizeF crSize = new SizeF();
|
SizeF crSize = new SizeF();
|
||||||
int LarghezzaStandard;
|
int LarghezzaStandard;
|
||||||
|
|
||||||
if (PicSettings.Grassetto == true)
|
if (_picSettings.Grassetto == true)
|
||||||
crFont = new Font(PicSettings.IlFont, DimensioneStandard, FontStyle.Bold);
|
crFont = new Font(_picSettings.IlFont, DimensioneStandard, FontStyle.Bold);
|
||||||
else
|
else
|
||||||
crFont = new Font(PicSettings.IlFont, DimensioneStandard);
|
crFont = new Font(_picSettings.IlFont, DimensioneStandard);
|
||||||
crSize = grPhoto.MeasureString(testoFirma, crFont);
|
crSize = grPhoto.MeasureString(testoFirma, crFont);
|
||||||
LarghezzaStandard = System.Convert.ToInt32(crSize.Width);
|
LarghezzaStandard = System.Convert.ToInt32(crSize.Width);
|
||||||
|
|
||||||
|
|
@ -531,10 +534,10 @@ public class ImageCreatorSharp : IDisposable
|
||||||
Conta -= 5;
|
Conta -= 5;
|
||||||
else
|
else
|
||||||
Conta -= 1;
|
Conta -= 1;
|
||||||
if (PicSettings.Grassetto == true)
|
if (_picSettings.Grassetto == true)
|
||||||
crFont = new Font(PicSettings.IlFont, Conta, FontStyle.Bold);
|
crFont = new Font(_picSettings.IlFont, Conta, FontStyle.Bold);
|
||||||
else
|
else
|
||||||
crFont = new Font(PicSettings.IlFont, Conta);
|
crFont = new Font(_picSettings.IlFont, Conta);
|
||||||
crSize = grPhoto.MeasureString(testoFirma, crFont);
|
crSize = grPhoto.MeasureString(testoFirma, crFont);
|
||||||
if (crSize.Width < System.Convert.ToSingle(g.Width))
|
if (crSize.Width < System.Convert.ToSingle(g.Width))
|
||||||
{
|
{
|
||||||
|
|
@ -550,19 +553,19 @@ public class ImageCreatorSharp : IDisposable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
switch (PicSettings.Posizione.ToUpper())
|
switch (_picSettings.Posizione.ToUpper())
|
||||||
{
|
{
|
||||||
case "ALTO":
|
case "ALTO":
|
||||||
{
|
{
|
||||||
yPosFromBottom = (PicSettings.Margine);
|
yPosFromBottom = (_picSettings.Margine);
|
||||||
yPosFromBottom3 = (PicSettings.MargVert);
|
yPosFromBottom3 = (_picSettings.MargVert);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case "BASSO":
|
case "BASSO":
|
||||||
{
|
{
|
||||||
yPosFromBottom = System.Convert.ToSingle((g.Height - crSize.Height - (g.Height * PicSettings.Margine / (double)100)));
|
yPosFromBottom = System.Convert.ToSingle((g.Height - crSize.Height - (g.Height * _picSettings.Margine / (double)100)));
|
||||||
yPosFromBottom3 = System.Convert.ToSingle((g.Height - crSize.Height - (g.Height * PicSettings.MargVert / (double)100)));
|
yPosFromBottom3 = System.Convert.ToSingle((g.Height - crSize.Height - (g.Height * _picSettings.MargVert / (double)100)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -570,15 +573,15 @@ public class ImageCreatorSharp : IDisposable
|
||||||
float xCenterOfImg = 0;
|
float xCenterOfImg = 0;
|
||||||
float xCenterOfImg3 = 0;
|
float xCenterOfImg3 = 0;
|
||||||
StringFormat StrFormat = new StringFormat();
|
StringFormat StrFormat = new StringFormat();
|
||||||
switch (PicSettings.Allineamento.ToUpper())
|
switch (_picSettings.Allineamento.ToUpper())
|
||||||
{
|
{
|
||||||
case "SINISTRA":
|
case "SINISTRA":
|
||||||
{
|
{
|
||||||
xCenterOfImg = System.Convert.ToSingle((PicSettings.Margine + (LarghezzaStandard / (double)2)));
|
xCenterOfImg = System.Convert.ToSingle((_picSettings.Margine + (LarghezzaStandard / (double)2)));
|
||||||
xCenterOfImg3 = System.Convert.ToSingle((PicSettings.MargVert + (LarghezzaStandard / (double)2)));
|
xCenterOfImg3 = System.Convert.ToSingle((_picSettings.MargVert + (LarghezzaStandard / (double)2)));
|
||||||
if ((LarghezzaStandard / (double)2) > (g.Width / (double)2) - PicSettings.Margine)
|
if ((LarghezzaStandard / (double)2) > (g.Width / (double)2) - _picSettings.Margine)
|
||||||
xCenterOfImg = System.Convert.ToSingle((g.Width / (double)2));
|
xCenterOfImg = System.Convert.ToSingle((g.Width / (double)2));
|
||||||
if ((LarghezzaStandard / (double)2) > (g.Width / (double)2) - PicSettings.MargVert)
|
if ((LarghezzaStandard / (double)2) > (g.Width / (double)2) - _picSettings.MargVert)
|
||||||
xCenterOfImg3 = System.Convert.ToSingle((g.Width / (double)2));
|
xCenterOfImg3 = System.Convert.ToSingle((g.Width / (double)2));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -591,11 +594,11 @@ public class ImageCreatorSharp : IDisposable
|
||||||
|
|
||||||
case "DESTRA":
|
case "DESTRA":
|
||||||
{
|
{
|
||||||
xCenterOfImg = System.Convert.ToSingle((g.Width - PicSettings.Margine - (LarghezzaStandard / (double)2)));
|
xCenterOfImg = System.Convert.ToSingle((g.Width - _picSettings.Margine - (LarghezzaStandard / (double)2)));
|
||||||
xCenterOfImg3 = System.Convert.ToSingle((g.Width - PicSettings.MargVert - (LarghezzaStandard / (double)2)));
|
xCenterOfImg3 = System.Convert.ToSingle((g.Width - _picSettings.MargVert - (LarghezzaStandard / (double)2)));
|
||||||
if ((LarghezzaStandard / (double)2) > (g.Width / (double)2) - PicSettings.Margine)
|
if ((LarghezzaStandard / (double)2) > (g.Width / (double)2) - _picSettings.Margine)
|
||||||
xCenterOfImg = System.Convert.ToSingle((g.Width / (double)2));
|
xCenterOfImg = System.Convert.ToSingle((g.Width / (double)2));
|
||||||
if ((LarghezzaStandard / (double)2) > (g.Width / (double)2) - PicSettings.MargVert)
|
if ((LarghezzaStandard / (double)2) > (g.Width / (double)2) - _picSettings.MargVert)
|
||||||
xCenterOfImg3 = System.Convert.ToSingle((g.Width / (double)2));
|
xCenterOfImg3 = System.Convert.ToSingle((g.Width / (double)2));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -604,25 +607,25 @@ public class ImageCreatorSharp : IDisposable
|
||||||
|
|
||||||
SolidBrush semiTransBrush2 = new SolidBrush(Color.FromArgb(alphaScelta, 0, 0, 0));
|
SolidBrush semiTransBrush2 = new SolidBrush(Color.FromArgb(alphaScelta, 0, 0, 0));
|
||||||
// Dim semiTransBrush As SolidBrush = New SolidBrush(Color.FromArgb(AlphaScelta, _FontColoreR, _FontColoreG, _FontColoreB))
|
// Dim semiTransBrush As SolidBrush = New SolidBrush(Color.FromArgb(AlphaScelta, _FontColoreR, _FontColoreG, _FontColoreB))
|
||||||
SolidBrush semiTransBrush = new SolidBrush(Color.FromArgb(alphaScelta, PicSettings.FontColoreRGB));
|
SolidBrush semiTransBrush = new SolidBrush(Color.FromArgb(alphaScelta, _picSettings.FontColoreRGB));
|
||||||
|
|
||||||
if (FotoRuotaADestra | FotoRuotaASinistra)
|
if (FotoRuotaADestra | FotoRuotaASinistra)
|
||||||
{
|
{
|
||||||
if (PicSettings.Grassetto == true)
|
if (_picSettings.Grassetto == true)
|
||||||
crFont = new Font(PicSettings.IlFont, PicSettings.DimVert, FontStyle.Bold);
|
crFont = new Font(_picSettings.IlFont, _picSettings.DimVert, FontStyle.Bold);
|
||||||
else
|
else
|
||||||
crFont = new Font(PicSettings.IlFont, PicSettings.DimVert);
|
crFont = new Font(_picSettings.IlFont, _picSettings.DimVert);
|
||||||
}
|
}
|
||||||
else if (PicSettings.Grassetto == true)
|
else if (_picSettings.Grassetto == true)
|
||||||
crFont = new Font(PicSettings.IlFont, DimensioneStandard, FontStyle.Bold);
|
crFont = new Font(_picSettings.IlFont, DimensioneStandard, FontStyle.Bold);
|
||||||
else
|
else
|
||||||
crFont = new Font(PicSettings.IlFont, DimensioneStandard);
|
crFont = new Font(_picSettings.IlFont, DimensioneStandard);
|
||||||
|
|
||||||
|
|
||||||
// qui scrive il testo (nomefilebig)
|
// qui scrive il testo (nomefilebig)
|
||||||
if (PicSettings.TestoNome)
|
if (_picSettings.TestoNome)
|
||||||
{
|
{
|
||||||
if (PicSettings.NomeData & g.PropertyIdList.Length > 0)
|
if (_picSettings.NomeData & g.PropertyIdList.Length > 0)
|
||||||
{
|
{
|
||||||
//ExifReader DatiExif = new ExifReader((Bitmap)g);
|
//ExifReader DatiExif = new ExifReader((Bitmap)g);
|
||||||
dataFoto = _creationDate ?? DateTime.Now; //DatiExif.DateTimeOriginal;
|
dataFoto = _creationDate ?? DateTime.Now; //DatiExif.DateTimeOriginal;
|
||||||
|
|
@ -637,16 +640,16 @@ public class ImageCreatorSharp : IDisposable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PicSettings.TestoNome == false)
|
if (_picSettings.TestoNome == false)
|
||||||
{
|
{
|
||||||
if (FotoRuotaADestra | FotoRuotaASinistra)
|
if (FotoRuotaADestra | FotoRuotaASinistra)
|
||||||
{
|
{
|
||||||
if (PicSettings.TestoMin == false)
|
if (_picSettings.TestoMin == false)
|
||||||
{
|
{
|
||||||
grPhoto.DrawString(testoFirmaV, crFont, semiTransBrush2, new PointF(xCenterOfImg + 1, yPosFromBottom3 + 1), StrFormat);
|
grPhoto.DrawString(testoFirmaV, crFont, semiTransBrush2, new PointF(xCenterOfImg + 1, yPosFromBottom3 + 1), StrFormat);
|
||||||
grPhoto.DrawString(testoFirmaV, crFont, semiTransBrush, new PointF(xCenterOfImg, yPosFromBottom3), StrFormat);
|
grPhoto.DrawString(testoFirmaV, crFont, semiTransBrush, new PointF(xCenterOfImg, yPosFromBottom3), StrFormat);
|
||||||
}
|
}
|
||||||
if (PicSettings.TestoMin == true)
|
if (_picSettings.TestoMin == true)
|
||||||
{
|
{
|
||||||
grPhoto.DrawString(testoFirmaV, crFont, semiTransBrush2, new PointF(xCenterOfImg + 1, yPosFromBottom4 + 1), StrFormat);
|
grPhoto.DrawString(testoFirmaV, crFont, semiTransBrush2, new PointF(xCenterOfImg + 1, yPosFromBottom4 + 1), StrFormat);
|
||||||
grPhoto.DrawString(testoFirmaV, crFont, semiTransBrush, new PointF(xCenterOfImg, yPosFromBottom4), StrFormat);
|
grPhoto.DrawString(testoFirmaV, crFont, semiTransBrush, new PointF(xCenterOfImg, yPosFromBottom4), StrFormat);
|
||||||
|
|
@ -659,10 +662,10 @@ public class ImageCreatorSharp : IDisposable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.Equals(PicSettings.DirectorySorgente, PicSettings.DirectoryDestinazione, StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(_picSettings.DirectorySorgente, _picSettings.DirectoryDestinazione, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
nomeFileBig2 = nomeFileBig;
|
nomeFileBig2 = nomeFileBig;
|
||||||
nomeFileBig = nomeFileBig.Substring(0, nomeFileBig.Length - 4) + PicSettings.Codice + nomeFileBig.Substring(nomeFileBig.Length - 4);
|
nomeFileBig = nomeFileBig.Substring(0, nomeFileBig.Length - 4) + _picSettings.Codice + nomeFileBig.Substring(nomeFileBig.Length - 4);
|
||||||
}
|
}
|
||||||
//grPhoto.Dispose();
|
//grPhoto.Dispose();
|
||||||
|
|
||||||
|
|
@ -675,9 +678,9 @@ public class ImageCreatorSharp : IDisposable
|
||||||
private void aggiungiLogo(Bitmap imgOutputBig, Image logo)
|
private void aggiungiLogo(Bitmap imgOutputBig, Image logo)
|
||||||
{
|
{
|
||||||
// imgOutputBig
|
// imgOutputBig
|
||||||
if (PicSettings.LogoAggiungi == true & File.Exists(PicSettings.LogoNomeFile))
|
if (_picSettings.LogoAggiungi == true & File.Exists(_picSettings.LogoNomeFile))
|
||||||
{
|
{
|
||||||
// using var ImmagineLogo = Image.FromFile(PicSettings.LogoNomeFile);
|
// using var ImmagineLogo = Image.FromFile(_picSettings.LogoNomeFile);
|
||||||
|
|
||||||
Color LogoColoreTrasparente = Color.White;
|
Color LogoColoreTrasparente = Color.White;
|
||||||
|
|
||||||
|
|
@ -696,12 +699,12 @@ public class ImageCreatorSharp : IDisposable
|
||||||
imageAttributes.SetRemapTable(remapTable, ColorAdjustType.Bitmap);
|
imageAttributes.SetRemapTable(remapTable, ColorAdjustType.Bitmap);
|
||||||
|
|
||||||
// * The second color manipulation is used to change the opacity by setting the 3rd row and 3rd column to 0.3f
|
// * The second color manipulation is used to change the opacity by setting the 3rd row and 3rd column to 0.3f
|
||||||
float[][] colorMatrixElements = new[] { new float[] { 1.0F, 0.0F, 0.0F, 0.0F, 0.0F }, new float[] { 0.0F, 1.0F, 0.0F, 0.0F, 0.0F }, new float[] { 0.0F, 0.0F, 1.0F, 0.0F, 0.0F }, new float[] { 0.0F, 0.0F, 0.0F, System.Convert.ToSingle(PicSettings.LogoTrasparenza) / 100F, 0.0F }, new float[] { 0.0F, 0.0F, 0.0F, 0.0F, 1.0F } };
|
float[][] colorMatrixElements = new[] { new float[] { 1.0F, 0.0F, 0.0F, 0.0F, 0.0F }, new float[] { 0.0F, 1.0F, 0.0F, 0.0F, 0.0F }, new float[] { 0.0F, 0.0F, 1.0F, 0.0F, 0.0F }, new float[] { 0.0F, 0.0F, 0.0F, System.Convert.ToSingle(_picSettings.LogoTrasparenza) / 100F, 0.0F }, new float[] { 0.0F, 0.0F, 0.0F, 0.0F, 1.0F } };
|
||||||
ColorMatrix wmColorMatrix = new ColorMatrix(colorMatrixElements);
|
ColorMatrix wmColorMatrix = new ColorMatrix(colorMatrixElements);
|
||||||
imageAttributes.SetColorMatrix(wmColorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
|
imageAttributes.SetColorMatrix(wmColorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
|
||||||
|
|
||||||
int FotoLogoH = PicSettings.LogoAltezza;
|
int FotoLogoH = _picSettings.LogoAltezza;
|
||||||
int FotoLogoW = PicSettings.LogoLarghezza;
|
int FotoLogoW = _picSettings.LogoLarghezza;
|
||||||
double FattoreAlt = logo.Height / (double)FotoLogoH;
|
double FattoreAlt = logo.Height / (double)FotoLogoH;
|
||||||
double FattoreLarg = logo.Width / (double)FotoLogoW;
|
double FattoreLarg = logo.Width / (double)FotoLogoW;
|
||||||
Size NuovaSize;
|
Size NuovaSize;
|
||||||
|
|
@ -713,11 +716,11 @@ public class ImageCreatorSharp : IDisposable
|
||||||
int MargineUsato;
|
int MargineUsato;
|
||||||
int MargineL;
|
int MargineL;
|
||||||
bool InPercentualeL;
|
bool InPercentualeL;
|
||||||
if (PicSettings.LogoMargine.EndsWith("%") == true)
|
if (_picSettings.LogoMargine.EndsWith("%") == true)
|
||||||
InPercentualeL = true;
|
InPercentualeL = true;
|
||||||
else
|
else
|
||||||
InPercentualeL = false;
|
InPercentualeL = false;
|
||||||
MargineL = System.Convert.ToInt32(PicSettings.LogoMargine);
|
MargineL = System.Convert.ToInt32(_picSettings.LogoMargine);
|
||||||
if (InPercentualeL == true)
|
if (InPercentualeL == true)
|
||||||
MargineUsato = System.Convert.ToInt32(imgOutputBig.Height * MargineL / (double)100);
|
MargineUsato = System.Convert.ToInt32(imgOutputBig.Height * MargineL / (double)100);
|
||||||
else
|
else
|
||||||
|
|
@ -725,7 +728,7 @@ public class ImageCreatorSharp : IDisposable
|
||||||
|
|
||||||
int xPosOfWm = 0;
|
int xPosOfWm = 0;
|
||||||
int yPosOfWm = 0;
|
int yPosOfWm = 0;
|
||||||
switch (PicSettings.LogoPosizioneH.ToUpper())
|
switch (_picSettings.LogoPosizioneH.ToUpper())
|
||||||
{
|
{
|
||||||
case "SINISTRA":
|
case "SINISTRA":
|
||||||
case "NESSUNA":
|
case "NESSUNA":
|
||||||
|
|
@ -746,7 +749,7 @@ public class ImageCreatorSharp : IDisposable
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch (PicSettings.LogoPosizioneV.ToUpper())
|
switch (_picSettings.LogoPosizioneV.ToUpper())
|
||||||
{
|
{
|
||||||
case "ALTO":
|
case "ALTO":
|
||||||
case "NESSUNA":
|
case "NESSUNA":
|
||||||
|
|
@ -777,7 +780,7 @@ public class ImageCreatorSharp : IDisposable
|
||||||
private void SalvaFoto(Bitmap imgOutputBig, Size thumbSizeBig, string NomeFileBig, string NomeFileSmall, Size thumbSizeSmall, ImageFormat thisFormat)
|
private void SalvaFoto(Bitmap imgOutputBig, Size thumbSizeBig, string NomeFileBig, string NomeFileSmall, Size thumbSizeSmall, ImageFormat thisFormat)
|
||||||
{
|
{
|
||||||
using var image1Stream = new MemoryStream();
|
using var image1Stream = new MemoryStream();
|
||||||
if (PicSettings.FotoGrandeDimOrigina == false)
|
if (_picSettings.FotoGrandeDimOrigina == false)
|
||||||
{
|
{
|
||||||
// attenzione non controlla se è png
|
// attenzione non controlla se è png
|
||||||
// imgOutputBig.Save(Path.Combine(_DestDir.FullName, "Temp_" & NomeFileBig), thisFormat)
|
// imgOutputBig.Save(Path.Combine(_DestDir.FullName, "Temp_" & NomeFileBig), thisFormat)
|
||||||
|
|
@ -785,7 +788,7 @@ public class ImageCreatorSharp : IDisposable
|
||||||
{
|
{
|
||||||
MakeImageCustomQuality(imgOutputBig, image1Stream);
|
MakeImageCustomQuality(imgOutputBig, image1Stream);
|
||||||
}
|
}
|
||||||
//SalvaImmagineCustomQuality(imgOutputBig, Path.Combine(DestDir.FullName, "Temp_" + NomeFileBig), PicSettings.jpegQuality);
|
//SalvaImmagineCustomQuality(imgOutputBig, Path.Combine(DestDir.FullName, "Temp_" + NomeFileBig), _picSettings.jpegQuality);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
imgOutputBig.Save(image1Stream, thisFormat);
|
imgOutputBig.Save(image1Stream, thisFormat);
|
||||||
|
|
@ -793,10 +796,10 @@ public class ImageCreatorSharp : IDisposable
|
||||||
//imgOutputBig.Save(Path.Combine(DestDir.FullName, "Temp_" + NomeFileBig), thisFormat);
|
//imgOutputBig.Save(Path.Combine(DestDir.FullName, "Temp_" + NomeFileBig), thisFormat);
|
||||||
image1Stream.Seek(0, SeekOrigin.Begin);
|
image1Stream.Seek(0, SeekOrigin.Begin);
|
||||||
using var g2 = Image.FromStream(image1Stream);
|
using var g2 = Image.FromStream(image1Stream);
|
||||||
thumbSizeBig = g2.Width > g2.Height ? NewthumbSize(g2.Width, g2.Height, PicSettings.LarghezzaBig, "Larghezza") : NewthumbSize(g2.Width, g2.Height, PicSettings.AltezzaBig, "Altezza");
|
thumbSizeBig = g2.Width > g2.Height ? NewthumbSize(g2.Width, g2.Height, _picSettings.LarghezzaBig, "Larghezza") : NewthumbSize(g2.Width, g2.Height, _picSettings.AltezzaBig, "Altezza");
|
||||||
using Bitmap imgOutputBig2 = new Bitmap(g2, thumbSizeBig.Width, thumbSizeBig.Height);
|
using Bitmap imgOutputBig2 = new Bitmap(g2, thumbSizeBig.Width, thumbSizeBig.Height);
|
||||||
if (thisFormat.Equals(ImageFormat.Jpeg))
|
if (thisFormat.Equals(ImageFormat.Jpeg))
|
||||||
SalvaImmagineCustomQuality(imgOutputBig2, Path.Combine(DestDir.FullName, NomeFileBig), PicSettings.JpegQuality);
|
SalvaImmagineCustomQuality(imgOutputBig2, Path.Combine(DestDir.FullName, NomeFileBig), _picSettings.JpegQuality);
|
||||||
else
|
else
|
||||||
imgOutputBig2.Save(Path.Combine(DestDir.FullName, NomeFileBig), thisFormat);
|
imgOutputBig2.Save(Path.Combine(DestDir.FullName, NomeFileBig), thisFormat);
|
||||||
|
|
||||||
|
|
@ -809,7 +812,7 @@ public class ImageCreatorSharp : IDisposable
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
if (thisFormat.Equals(ImageFormat.Jpeg))
|
if (thisFormat.Equals(ImageFormat.Jpeg))
|
||||||
SalvaImmagineCustomQuality(imgOutputBig, Path.Combine(DestDir.FullName, NomeFileBig), PicSettings.JpegQuality);
|
SalvaImmagineCustomQuality(imgOutputBig, Path.Combine(DestDir.FullName, NomeFileBig), _picSettings.JpegQuality);
|
||||||
else
|
else
|
||||||
imgOutputBig.Save(Path.Combine(DestDir.FullName, NomeFileBig), thisFormat);
|
imgOutputBig.Save(Path.Combine(DestDir.FullName, NomeFileBig), thisFormat);
|
||||||
|
|
||||||
|
|
@ -817,23 +820,23 @@ public class ImageCreatorSharp : IDisposable
|
||||||
}
|
}
|
||||||
image1Stream.Seek(0, SeekOrigin.Begin);
|
image1Stream.Seek(0, SeekOrigin.Begin);
|
||||||
|
|
||||||
if (PicSettings.CreaMiniature)
|
if (_picSettings.CreaMiniature)
|
||||||
{
|
{
|
||||||
if (PicSettings.AggiungiScritteMiniature)
|
if (_picSettings.AggiungiScritteMiniature)
|
||||||
{
|
{
|
||||||
using System.Drawing.Image g1 = PicSettings.FotoGrandeDimOrigina ? (Image)imgOutputBig.Clone() : Image.FromStream(image1Stream);
|
using System.Drawing.Image g1 = _picSettings.FotoGrandeDimOrigina ? (Image)imgOutputBig.Clone() : Image.FromStream(image1Stream);
|
||||||
//if (PicSettings.FotoGrandeDimOrigina == false)
|
//if (_picSettings.FotoGrandeDimOrigina == false)
|
||||||
// g1 = Image.FromStream(image1Stream);
|
// g1 = Image.FromStream(image1Stream);
|
||||||
////g1 = System.Drawing.Image.FromFile(Path.Combine(DestDir.FullName, "Temp_" + NomeFileBig));
|
////g1 = System.Drawing.Image.FromFile(Path.Combine(DestDir.FullName, "Temp_" + NomeFileBig));
|
||||||
//else
|
//else
|
||||||
// g1 = (Image)imgOutputBig.Clone();
|
// g1 = (Image)imgOutputBig.Clone();
|
||||||
//g1 = System.Drawing.Image.FromFile(Path.Combine(DestDir.FullName, NomeFileBig));
|
//g1 = System.Drawing.Image.FromFile(Path.Combine(DestDir.FullName, NomeFileBig));
|
||||||
using Bitmap imgOutputSmall = new Bitmap(g1, thumbSizeSmall.Width, thumbSizeSmall.Height);
|
using Bitmap imgOutputSmall = new Bitmap(g1, thumbSizeSmall.Width, thumbSizeSmall.Height);
|
||||||
if (string.Equals(PicSettings.DirectorySorgente, PicSettings.DirectoryDestinazione, StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(_picSettings.DirectorySorgente, _picSettings.DirectoryDestinazione, StringComparison.OrdinalIgnoreCase))
|
||||||
NomeFileSmall = NomeFileSmall.Substring(0, NomeFileSmall.Length - 4) + PicSettings.Codice + NomeFileSmall.Substring(NomeFileSmall.Length - 4);
|
NomeFileSmall = NomeFileSmall.Substring(0, NomeFileSmall.Length - 4) + _picSettings.Codice + NomeFileSmall.Substring(NomeFileSmall.Length - 4);
|
||||||
//
|
//
|
||||||
if (thisFormat.Equals(ImageFormat.Jpeg))
|
if (thisFormat.Equals(ImageFormat.Jpeg))
|
||||||
SalvaImmagineCustomQuality(imgOutputSmall, Path.Combine(DestDir.FullName, NomeFileSmall), PicSettings.JpegQualityMin);
|
SalvaImmagineCustomQuality(imgOutputSmall, Path.Combine(DestDir.FullName, NomeFileSmall), _picSettings.JpegQualityMin);
|
||||||
else
|
else
|
||||||
imgOutputSmall.Save(Path.Combine(_DestDir.FullName, NomeFileSmall), thisFormat);
|
imgOutputSmall.Save(Path.Combine(_DestDir.FullName, NomeFileSmall), thisFormat);
|
||||||
|
|
||||||
|
|
@ -854,7 +857,7 @@ public class ImageCreatorSharp : IDisposable
|
||||||
|
|
||||||
EncoderParameters MyEncoderParameters = new EncoderParameters(1);
|
EncoderParameters MyEncoderParameters = new EncoderParameters(1);
|
||||||
|
|
||||||
EncoderParameter MyEncoderParameter = new EncoderParameter(MyEncoder, PicSettings.JpegQuality);
|
EncoderParameter MyEncoderParameter = new EncoderParameter(MyEncoder, _picSettings.JpegQuality);
|
||||||
MyEncoderParameters.Param[0] = MyEncoderParameter;
|
MyEncoderParameters.Param[0] = MyEncoderParameter;
|
||||||
imageToSave.Save(nomeFileFinale, JgpEncoder, MyEncoderParameters);
|
imageToSave.Save(nomeFileFinale, JgpEncoder, MyEncoderParameters);
|
||||||
//imageToSave.Dispose();
|
//imageToSave.Dispose();
|
||||||
|
|
@ -867,7 +870,7 @@ public class ImageCreatorSharp : IDisposable
|
||||||
|
|
||||||
EncoderParameters MyEncoderParameters = new EncoderParameters(1);
|
EncoderParameters MyEncoderParameters = new EncoderParameters(1);
|
||||||
|
|
||||||
EncoderParameter MyEncoderParameter = new EncoderParameter(MyEncoder, PicSettings.JpegQuality);
|
EncoderParameter MyEncoderParameter = new EncoderParameter(MyEncoder, _picSettings.JpegQuality);
|
||||||
MyEncoderParameters.Param[0] = MyEncoderParameter;
|
MyEncoderParameters.Param[0] = MyEncoderParameter;
|
||||||
destinationStream.Seek(0, SeekOrigin.Begin);
|
destinationStream.Seek(0, SeekOrigin.Begin);
|
||||||
imageToSave.Save(destinationStream, JgpEncoder, MyEncoderParameters);
|
imageToSave.Save(destinationStream, JgpEncoder, MyEncoderParameters);
|
||||||
|
|
|
||||||
|
|
@ -5,63 +5,63 @@ using System.Windows.Forms;
|
||||||
|
|
||||||
namespace MaddoShared;
|
namespace MaddoShared;
|
||||||
|
|
||||||
public static class PicSettings
|
public class PicSettings
|
||||||
{
|
{
|
||||||
public static string DirectorySorgente { get; set; }
|
public string DirectorySorgente { get; set; }
|
||||||
public static string DirectoryDestinazione { get; set; }
|
public string DirectoryDestinazione { get; set; }
|
||||||
public static string TestoFirmaStart { get; set; }
|
public string TestoFirmaStart { get; set; }
|
||||||
public static string TestoFirmaStartV { get; set; }
|
public string TestoFirmaStartV { get; set; }
|
||||||
public static DateTime DataPartenza { get; set; }
|
public DateTime DataPartenza { get; set; }
|
||||||
public static string TestoOrario { get; set; }
|
public string TestoOrario { get; set; }
|
||||||
public static int DimStandard { get; set; }
|
public int DimStandard { get; set; }
|
||||||
public static int DimStandardMiniatura { get; set; }
|
public int DimStandardMiniatura { get; set; }
|
||||||
public static bool NomeData { get; set; }
|
public bool NomeData { get; set; }
|
||||||
public static bool TestoNome { get; set; }
|
public bool TestoNome { get; set; }
|
||||||
public static bool UsaOrarioMiniatura { get; set; }
|
public bool UsaOrarioMiniatura { get; set; }
|
||||||
public static bool UsaOrarioTestoApplicare { get; set; }
|
public bool UsaOrarioTestoApplicare { get; set; }
|
||||||
public static bool UsaTempoGaraTestoApplicare { get; set; }
|
public bool UsaTempoGaraTestoApplicare { get; set; }
|
||||||
public static bool UsaRotazioneAutomatica { get; set; }
|
public bool UsaRotazioneAutomatica { get; set; }
|
||||||
public static bool UsaForzaJpg { get; set; }
|
public bool UsaForzaJpg { get; set; }
|
||||||
public static int LarghezzaSmall { get; set; }
|
public int LarghezzaSmall { get; set; }
|
||||||
public static int AltezzaSmall { get; set; }
|
public int AltezzaSmall { get; set; }
|
||||||
public static bool CreaMiniature { get; set; }
|
public bool CreaMiniature { get; set; }
|
||||||
public static bool AggiungiScritteMiniature { get; set; }
|
public bool AggiungiScritteMiniature { get; set; }
|
||||||
public static string Suffisso { get; set; }
|
public string Suffisso { get; set; }
|
||||||
public static string Codice { get; set; }
|
public string Codice { get; set; }
|
||||||
public static int Trasparenza { get; set; }
|
public int Trasparenza { get; set; }
|
||||||
public static string IlFont { get; set; }
|
public string IlFont { get; set; }
|
||||||
public static bool Grassetto { get; set; }
|
public bool Grassetto { get; set; }
|
||||||
public static string Posizione { get; set; }
|
public string Posizione { get; set; }
|
||||||
public static string Allineamento { get; set; }
|
public string Allineamento { get; set; }
|
||||||
public static int Margine { get; set; }
|
public int Margine { get; set; }
|
||||||
public static int LogoAltezza { get; set; }
|
public int LogoAltezza { get; set; }
|
||||||
public static int LogoLarghezza { get; set; }
|
public int LogoLarghezza { get; set; }
|
||||||
public static Color FontColoreRGB { get; set; }
|
public Color FontColoreRGB { get; set; }
|
||||||
public static bool LogoAggiungi { get; set; }
|
public bool LogoAggiungi { get; set; }
|
||||||
public static string LogoNomeFile { get; set; }
|
public string LogoNomeFile { get; set; }
|
||||||
public static string LogoTrasparenza { get; set; }
|
public string LogoTrasparenza { get; set; }
|
||||||
public static string LogoMargine { get; set; }
|
public string LogoMargine { get; set; }
|
||||||
public static string LogoPosizioneH { get; set; }
|
public string LogoPosizioneH { get; set; }
|
||||||
public static string LogoPosizioneV { get; set; }
|
public string LogoPosizioneV { get; set; }
|
||||||
public static bool FotoGrandeDimOrigina { get; set; }
|
public bool FotoGrandeDimOrigina { get; set; }
|
||||||
public static int AltezzaBig { get; set; }
|
public int AltezzaBig { get; set; }
|
||||||
public static int LarghezzaBig { get; set; }
|
public int LarghezzaBig { get; set; }
|
||||||
public static DirectoryInfo DestDir { get; set; }
|
public DirectoryInfo DestDir { get; set; }
|
||||||
public static int DimVert { get; set; }
|
public int DimVert { get; set; }
|
||||||
public static int MargVert { get; set; }
|
public int MargVert { get; set; }
|
||||||
public static bool TestoMin { get; set; }
|
public bool TestoMin { get; set; }
|
||||||
public static int DimMin { get; set; }
|
public int DimMin { get; set; }
|
||||||
public static bool SecretDefault { get; set; }
|
public bool SecretDefault { get; set; }
|
||||||
public static bool SecretBig { get; set; }
|
public bool SecretBig { get; set; }
|
||||||
public static bool SecretSmall { get; set; }
|
public bool SecretSmall { get; set; }
|
||||||
public static string SecretPathSmall { get; set; }
|
public string SecretPathSmall { get; set; }
|
||||||
public static string SecretPathBig { get; set; }
|
public string SecretPathBig { get; set; }
|
||||||
public static bool AggTempoGaraMin { get; set; }
|
public bool AggTempoGaraMin { get; set; }
|
||||||
public static bool AggNumTempMin { get; set; }
|
public bool AggNumTempMin { get; set; }
|
||||||
public static long JpegQuality { get; set; }
|
public long JpegQuality { get; set; }
|
||||||
public static long JpegQualityMin { get; set; }
|
public long JpegQualityMin { get; set; }
|
||||||
|
|
||||||
public static bool FotoRuotaADestra { get; set; } = false;
|
public bool FotoRuotaADestra { get; set; } = false;
|
||||||
public static bool FotoRuotaASinistra { get; set; } = false;
|
public bool FotoRuotaASinistra { get; set; } = false;
|
||||||
public static string TempMinText { get; set; } = string.Empty;
|
public string TempMinText { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
@ -30,12 +30,15 @@ public partial class MainForm
|
||||||
private readonly ImageCreationStuff _imageCreationService;
|
private readonly ImageCreationStuff _imageCreationService;
|
||||||
|
|
||||||
private readonly ParametriSetup _parametriSetup;
|
private readonly ParametriSetup _parametriSetup;
|
||||||
|
private readonly PicSettings _picSettings;
|
||||||
|
|
||||||
public MainForm(DataModel model, ImageCreationStuff imageCreationStuff, ParametriSetup parametriSetup, ILogger<MainForm> logger)
|
public MainForm(DataModel model, ImageCreationStuff imageCreationStuff, PicSettings picSettings, ParametriSetup parametriSetup, ILogger<MainForm> logger)
|
||||||
{
|
{
|
||||||
Model = model;
|
Model = model;
|
||||||
_imageCreationService = imageCreationStuff;
|
_imageCreationService = imageCreationStuff;
|
||||||
_parametriSetup = parametriSetup;
|
_parametriSetup = parametriSetup;
|
||||||
|
_picSettings = picSettings;
|
||||||
|
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
|
||||||
_logger.LogDebug("Start");
|
_logger.LogDebug("Start");
|
||||||
|
|
@ -255,47 +258,6 @@ public partial class MainForm
|
||||||
//btnCreaCatalogoAsync.Enabled = true;
|
//btnCreaCatalogoAsync.Enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void creaCatalogoThread()
|
|
||||||
{
|
|
||||||
var timeStart = DateTime.Now;
|
|
||||||
MyPool.StopThreadPool();
|
|
||||||
MyPool.StartThreadPool(minThreads, maxThreads);
|
|
||||||
ContaImmaginiThread = 0;
|
|
||||||
|
|
||||||
// creaImmaginiWithThreadMod(txtSorgente.Text, txtDestinazione.Text)
|
|
||||||
CreaimmaginiWithThreadDict(Model.SourcePath, Model.DestinationPath);
|
|
||||||
ThreadPoolWorkItem ThAttivo = null;
|
|
||||||
int i = 0;
|
|
||||||
/* TODO ERROR: Skipped DefineDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
|
|
||||||
while (i != ContaImmaginiThread)
|
|
||||||
{
|
|
||||||
Thread.Sleep(100);
|
|
||||||
ThAttivo = MyPool.ExtractWorkItem();
|
|
||||||
if (ThAttivo is object)
|
|
||||||
{
|
|
||||||
i += 1;
|
|
||||||
// stepProgressBar()
|
|
||||||
int threads = MyPool.GetThreadCount();
|
|
||||||
setLabel10Text("File: " + ThAttivo.m_sName + " Threads: " + threads.ToString());
|
|
||||||
|
|
||||||
// setLabel18Text(ContaImmaginiThread.ToString)
|
|
||||||
// setLabel18Text(i.ToString)
|
|
||||||
|
|
||||||
|
|
||||||
// Label10.Text = "File: " & ThAttivo.m_sName
|
|
||||||
// Label18.Text = ContaImmaginiThread.ToString
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MyPool.StopThreadPool();
|
|
||||||
var timeStop = DateTime.Now;
|
|
||||||
setLabel10Text("Finito");
|
|
||||||
setLabel43Text(CalcTime(timeStart, timeStop, ContaImmaginiThread));
|
|
||||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
}
|
|
||||||
|
|
||||||
private string CalcTime(DateTime timeStart, DateTime timeStop, int numFoto)
|
private string CalcTime(DateTime timeStart, DateTime timeStop, int numFoto)
|
||||||
{
|
{
|
||||||
long timediffH, timediffS;
|
long timediffH, timediffS;
|
||||||
|
|
@ -326,19 +288,8 @@ public partial class MainForm
|
||||||
dialog.InitialDirectory = startingFolder;
|
dialog.InitialDirectory = startingFolder;
|
||||||
if (dialog.ShowDialog() != DialogResult.OK) return string.Empty;
|
if (dialog.ShowDialog() != DialogResult.OK) return string.Empty;
|
||||||
|
|
||||||
// CommonOpenFileDialog dialog = new CommonOpenFileDialog
|
|
||||||
// {
|
|
||||||
// InitialDirectory = startingFolder,
|
|
||||||
// IsFolderPicker = true
|
|
||||||
// };
|
|
||||||
// if (dialog.ShowDialog() != CommonFileDialogResult.Ok) return null;
|
|
||||||
var directoryScelta = FixPath(dialog.SelectedPath); // dialog.FileName;
|
var directoryScelta = FixPath(dialog.SelectedPath); // dialog.FileName;
|
||||||
|
|
||||||
// if (directoryScelta.EndsWith(@"\") == false)
|
|
||||||
// {
|
|
||||||
// directoryScelta += @"\";
|
|
||||||
// }
|
|
||||||
|
|
||||||
return directoryScelta;
|
return directoryScelta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -349,33 +300,6 @@ public partial class MainForm
|
||||||
{
|
{
|
||||||
Model.SourcePath = dialogResult;
|
Model.SourcePath = dialogResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
//CommonOpenFileDialog dialog = new CommonOpenFileDialog();
|
|
||||||
//dialog.InitialDirectory = txtSorgente.Text;
|
|
||||||
//dialog.IsFolderPicker = true;
|
|
||||||
//if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
|
|
||||||
//{
|
|
||||||
// string directoryScelta = dialog.FileName;
|
|
||||||
// if (directoryScelta.EndsWith(@"\") == false)
|
|
||||||
// {
|
|
||||||
// directoryScelta += @"\";
|
|
||||||
// }
|
|
||||||
|
|
||||||
// txtSorgente.Text = directoryScelta;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//var DirSearch = new FolderBrowserDialog();
|
|
||||||
//DirSearch.SelectedPath = txtSorgente.Text;
|
|
||||||
//if (DialogResult.OK == DirSearch.ShowDialog())
|
|
||||||
//{
|
|
||||||
// string DirectoryScelta = DirSearch.SelectedPath;
|
|
||||||
// if (DirectoryScelta.EndsWith(@"\") == false)
|
|
||||||
// {
|
|
||||||
// DirectoryScelta += @"\";
|
|
||||||
// }
|
|
||||||
|
|
||||||
// txtSorgente.Text = DirectoryScelta;
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Button3_Click(object sender, EventArgs e)
|
private void Button3_Click(object sender, EventArgs e)
|
||||||
|
|
@ -573,124 +497,82 @@ public partial class MainForm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setPicSettings(string SourcePath, string DestPath)
|
private void SetPicSettings(string SourcePath, string DestPath)
|
||||||
{
|
{
|
||||||
var SourceDir = new DirectoryInfo(SourcePath);
|
var SourceDir = new DirectoryInfo(SourcePath);
|
||||||
var DestDirStart = new DirectoryInfo(DestPath);
|
var DestDirStart = new DirectoryInfo(DestPath);
|
||||||
DirectoryInfo DestDir = null;
|
DirectoryInfo DestDir = null;
|
||||||
PicSettings.DirectorySorgente = SourcePath;
|
_picSettings.DirectorySorgente = SourcePath;
|
||||||
PicSettings.DirectoryDestinazione = Model.DestinationPath;
|
_picSettings.DirectoryDestinazione = Model.DestinationPath;
|
||||||
|
|
||||||
// PicSettings.DestDir = DestDir
|
// _picSettings.DestDir = DestDir
|
||||||
// PicSettings.SourceDir = SourceDir
|
// _picSettings.SourceDir = SourceDir
|
||||||
// PicSettings.DestDirStart = DestDirStart
|
// _picSettings.DestDirStart = DestDirStart
|
||||||
|
|
||||||
PicSettings.DimStandard = int.Parse(TextBox11.Text);
|
_picSettings.DimStandard = int.Parse(TextBox11.Text);
|
||||||
PicSettings.DimStandardMiniatura = int.Parse(TextBox25.Text);
|
_picSettings.DimStandardMiniatura = int.Parse(TextBox25.Text);
|
||||||
PicSettings.UsaOrarioMiniatura = CheckBox12.Checked;
|
_picSettings.UsaOrarioMiniatura = CheckBox12.Checked;
|
||||||
PicSettings.UsaOrarioTestoApplicare = CheckBox8.Checked;
|
_picSettings.UsaOrarioTestoApplicare = CheckBox8.Checked;
|
||||||
PicSettings.UsaTempoGaraTestoApplicare = CheckBox7.Checked;
|
_picSettings.UsaTempoGaraTestoApplicare = CheckBox7.Checked;
|
||||||
PicSettings.UsaRotazioneAutomatica = chkRotazioneAutomatica.Checked;
|
_picSettings.UsaRotazioneAutomatica = chkRotazioneAutomatica.Checked;
|
||||||
PicSettings.UsaForzaJpg = chkForzaJpg.Checked;
|
_picSettings.UsaForzaJpg = chkForzaJpg.Checked;
|
||||||
if (CheckBox17.Checked)
|
if (CheckBox17.Checked)
|
||||||
{
|
{
|
||||||
PicSettings.TestoNome = true;
|
_picSettings.TestoNome = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PicSettings.TestoNome = false;
|
_picSettings.TestoNome = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CheckBox16.Checked)
|
if (CheckBox16.Checked)
|
||||||
{
|
{
|
||||||
PicSettings.NomeData = true;
|
_picSettings.NomeData = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PicSettings.NomeData = false;
|
_picSettings.NomeData = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
PicSettings.TestoFirmaStart = Model.HorizontalText;
|
_picSettings.TestoFirmaStart = Model.HorizontalText;
|
||||||
PicSettings.TestoFirmaStartV = TextBox29.Text;
|
_picSettings.TestoFirmaStartV = TextBox29.Text;
|
||||||
PicSettings.DataPartenza = DateTimePicker1.Value;
|
_picSettings.DataPartenza = DateTimePicker1.Value;
|
||||||
PicSettings.TestoOrario = TextBox18.Text;
|
_picSettings.TestoOrario = TextBox18.Text;
|
||||||
PicSettings.AltezzaSmall = int.Parse(TextBox6.Text);
|
_picSettings.AltezzaSmall = int.Parse(TextBox6.Text);
|
||||||
PicSettings.LarghezzaSmall = int.Parse(TextBox5.Text);
|
_picSettings.LarghezzaSmall = int.Parse(TextBox5.Text);
|
||||||
PicSettings.CreaMiniature = CheckBox1.Checked;
|
_picSettings.CreaMiniature = CheckBox1.Checked;
|
||||||
PicSettings.AggiungiScritteMiniature = RadioButton3.Checked;
|
_picSettings.AggiungiScritteMiniature = RadioButton3.Checked;
|
||||||
PicSettings.AggTempoGaraMin = RadioButton5.Checked;
|
_picSettings.AggTempoGaraMin = RadioButton5.Checked;
|
||||||
PicSettings.AggNumTempMin = RadioButton7.Checked;
|
_picSettings.AggNumTempMin = RadioButton7.Checked;
|
||||||
PicSettings.DimVert = int.Parse(TextBox30.Text);
|
_picSettings.DimVert = int.Parse(TextBox30.Text);
|
||||||
PicSettings.MargVert = int.Parse(TextBox31.Text);
|
_picSettings.MargVert = int.Parse(TextBox31.Text);
|
||||||
|
|
||||||
// PicSettings.NomeFileChild = childFile.Name
|
// _picSettings.NomeFileChild = childFile.Name
|
||||||
PicSettings.Suffisso = TextBox3.Text;
|
_picSettings.Suffisso = TextBox3.Text;
|
||||||
// PicSettings.Codice = TextBox13.Text
|
// _picSettings.Codice = TextBox13.Text
|
||||||
|
|
||||||
PicSettings.Trasparenza = int.Parse(TextBox9.Text);
|
_picSettings.Trasparenza = int.Parse(TextBox9.Text);
|
||||||
PicSettings.IlFont = ComboBox3.SelectedItem.ToString();
|
_picSettings.IlFont = ComboBox3.SelectedItem.ToString();
|
||||||
PicSettings.Grassetto = CheckBox3.Checked;
|
_picSettings.Grassetto = CheckBox3.Checked;
|
||||||
PicSettings.Posizione = ComboBox1.SelectedItem.ToString();
|
_picSettings.Posizione = ComboBox1.SelectedItem.ToString();
|
||||||
PicSettings.Allineamento = ComboBox2.SelectedItem.ToString();
|
_picSettings.Allineamento = ComboBox2.SelectedItem.ToString();
|
||||||
PicSettings.Margine = int.Parse(TextBox12.Text);
|
_picSettings.Margine = int.Parse(TextBox12.Text);
|
||||||
PicSettings.LogoAltezza = int.Parse(TextBox14.Text);
|
_picSettings.LogoAltezza = int.Parse(TextBox14.Text);
|
||||||
PicSettings.LogoLarghezza = int.Parse(TextBox15.Text);
|
_picSettings.LogoLarghezza = int.Parse(TextBox15.Text);
|
||||||
PicSettings.FontColoreRGB = ColorTranslator.FromHtml(TextBox34.Text);
|
_picSettings.FontColoreRGB = ColorTranslator.FromHtml(TextBox34.Text);
|
||||||
PicSettings.LogoAggiungi = CheckBox5.Checked;
|
_picSettings.LogoAggiungi = CheckBox5.Checked;
|
||||||
PicSettings.LogoNomeFile = TextBox10.Text;
|
_picSettings.LogoNomeFile = TextBox10.Text;
|
||||||
PicSettings.LogoTrasparenza = TextBox19.Text;
|
_picSettings.LogoTrasparenza = TextBox19.Text;
|
||||||
PicSettings.LogoMargine = TextBox16.Text;
|
_picSettings.LogoMargine = TextBox16.Text;
|
||||||
PicSettings.LogoPosizioneH = ComboBox4.Text;
|
_picSettings.LogoPosizioneH = ComboBox4.Text;
|
||||||
PicSettings.LogoPosizioneV = ComboBox5.Text;
|
_picSettings.LogoPosizioneV = ComboBox5.Text;
|
||||||
PicSettings.FotoGrandeDimOrigina = CheckBox15.Checked;
|
_picSettings.FotoGrandeDimOrigina = CheckBox15.Checked;
|
||||||
PicSettings.AltezzaBig = int.Parse(TextBox27.Text);
|
_picSettings.AltezzaBig = int.Parse(TextBox27.Text);
|
||||||
PicSettings.LarghezzaBig = int.Parse(TextBox28.Text);
|
_picSettings.LarghezzaBig = int.Parse(TextBox28.Text);
|
||||||
PicSettings.DimMin = int.Parse(TextBox25.Text);
|
_picSettings.DimMin = int.Parse(TextBox25.Text);
|
||||||
PicSettings.TestoMin = RadioButton6.Checked;
|
_picSettings.TestoMin = RadioButton6.Checked;
|
||||||
PicSettings.JpegQuality = int.Parse(TextBox32.Text);
|
_picSettings.JpegQuality = int.Parse(TextBox32.Text);
|
||||||
PicSettings.JpegQualityMin = int.Parse(TextBox33.Text);
|
_picSettings.JpegQualityMin = int.Parse(TextBox33.Text);
|
||||||
}
|
|
||||||
|
|
||||||
private List<List<FileInfo>> makeFilesList(string SourcePath)
|
|
||||||
{
|
|
||||||
var SourceDir = new DirectoryInfo(SourcePath);
|
|
||||||
DirectoryInfo DestDir = null;
|
|
||||||
int NumFileXDir = int.Parse(txtFilePerCartella.Text);
|
|
||||||
string SuffixDir = txtSuffissoCartelle.Text;
|
|
||||||
int NumCifreDir = int.Parse(txtCifreContatore.Text);
|
|
||||||
bool DividiFile = false;
|
|
||||||
StopAttivo = false;
|
|
||||||
int FileConta = 0;
|
|
||||||
int ContaFileXDir = 0;
|
|
||||||
int ContaDirXDir = 0;
|
|
||||||
string TestoTemp = "";
|
|
||||||
int ContaTemp = 0;
|
|
||||||
var picList = new List<FileInfo>();
|
|
||||||
var dirList = new List<List<FileInfo>>();
|
|
||||||
|
|
||||||
|
|
||||||
// controlla directory principale
|
|
||||||
// Dim childFile As FileInfo
|
|
||||||
// For Each childFile In SourceDir.GetFiles("*.jpg")
|
|
||||||
// picList.Add(childFile)
|
|
||||||
// Next
|
|
||||||
|
|
||||||
// picList = getFiles(SourceDir, SearchOption.AllDirectories)
|
|
||||||
|
|
||||||
// dirList.Add(picList)
|
|
||||||
|
|
||||||
// controlla sottodirectory
|
|
||||||
if (chkAggiornaSottodirectory.Checked == true)
|
|
||||||
{
|
|
||||||
foreach (var subDir in SourceDir.GetDirectories())
|
|
||||||
{
|
|
||||||
var filesList = new List<FileInfo>();
|
|
||||||
filesList = getFiles(subDir);
|
|
||||||
dirList.Add(filesList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return dirList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<FileInfo> getFiles(DirectoryInfo sourceDir)
|
private List<FileInfo> getFiles(DirectoryInfo sourceDir)
|
||||||
|
|
@ -701,114 +583,6 @@ public partial class MainForm
|
||||||
return picList;
|
return picList;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Dictionary<FileInfo, DirectoryInfo> getDirsDict(string SourcePath, string DestPath)
|
|
||||||
{
|
|
||||||
var SourceDir = new DirectoryInfo(SourcePath);
|
|
||||||
var DestDirStart = new DirectoryInfo(DestPath);
|
|
||||||
DirectoryInfo DestDir = null;
|
|
||||||
int NumFileXDir = int.Parse(txtFilePerCartella.Text);
|
|
||||||
string SuffixDir = txtSuffissoCartelle.Text;
|
|
||||||
int NumCifreDir = int.Parse(txtCifreContatore.Text);
|
|
||||||
bool DividiFile = false;
|
|
||||||
StopAttivo = false;
|
|
||||||
int FileConta = 0;
|
|
||||||
int ContaFileXDir = 0;
|
|
||||||
int ContaDirXDir = 0;
|
|
||||||
// Dim TestoTemp As String = ""
|
|
||||||
// Dim ContaTemp As Integer = 0
|
|
||||||
var dirSourceDest = new Dictionary<FileInfo, DirectoryInfo>();
|
|
||||||
if (SourceDir.Exists)
|
|
||||||
{
|
|
||||||
if (chkAggiornaSottodirectory.Checked)
|
|
||||||
{
|
|
||||||
FileConta = SourceDir.GetFiles("*.jpg", SearchOption.AllDirectories).GetLength(0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FileConta = SourceDir.GetFiles("*.jpg", SearchOption.TopDirectoryOnly).GetLength(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
var a = (int.Parse(lblFotoTotaliNum.Text) + FileConta);
|
|
||||||
setLabel17Text(a.ToString());
|
|
||||||
setProgressBarMaximum(a);
|
|
||||||
if (chkAggiornaSottodirectory.Checked)
|
|
||||||
{
|
|
||||||
foreach (DirectoryInfo directory in SourceDir.GetDirectories())
|
|
||||||
{
|
|
||||||
foreach (FileInfo file in directory.GetFiles(".jpg"))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (FileInfo file in SourceDir.GetFiles("*.jpg", SearchOption.AllDirectories))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
if (NumFileXDir > 0 & chkCreaSottocartelle.Checked == true & FileConta > NumFileXDir)
|
|
||||||
{
|
|
||||||
DividiFile = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DestDir = DestDirStart;
|
|
||||||
if (!DestDir.Exists)
|
|
||||||
{
|
|
||||||
DestDir.Create();
|
|
||||||
}
|
|
||||||
|
|
||||||
DividiFile = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var filesList = new List<FileInfo>();
|
|
||||||
if (chkAggiornaSottodirectory.Checked)
|
|
||||||
{
|
|
||||||
filesList.AddRange(SourceDir.GetFiles("*.jpg", SearchOption.AllDirectories));
|
|
||||||
filesList.AddRange(SourceDir.GetFiles("*.png", SearchOption.AllDirectories));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
filesList.AddRange(SourceDir.GetFiles("*.jpg", SearchOption.TopDirectoryOnly));
|
|
||||||
filesList.AddRange(SourceDir.GetFiles("*.png", SearchOption.TopDirectoryOnly));
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (FileInfo file in filesList)
|
|
||||||
{
|
|
||||||
ContaFileXDir += 1;
|
|
||||||
if (DividiFile == true)
|
|
||||||
{
|
|
||||||
if (ContaFileXDir == ContaDirXDir * NumFileXDir + 1)
|
|
||||||
{
|
|
||||||
ContaDirXDir += 1;
|
|
||||||
string TestoTemp;
|
|
||||||
if (rdbNumProgressiva.Checked == true)
|
|
||||||
{
|
|
||||||
TestoTemp = ContaDirXDir.ToString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TestoTemp = (ContaDirXDir * NumFileXDir).ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int ContaTemp = 1, loopTo = NumCifreDir - TestoTemp.Length;
|
|
||||||
ContaTemp <= loopTo;
|
|
||||||
ContaTemp++)
|
|
||||||
TestoTemp = "0" + TestoTemp;
|
|
||||||
DestDir = new DirectoryInfo(Path.Combine(DestDirStart.FullName, SuffixDir, TestoTemp));
|
|
||||||
// DestDir = New DirectoryInfo(DestDirStart.FullName & IIf(Not DestDirStart.FullName.EndsWith("\"), "\", String.Empty).ToString & SuffixDir & TestoTemp)
|
|
||||||
dirSourceDest.Add(file, DestDir);
|
|
||||||
if (!DestDir.Exists)
|
|
||||||
{
|
|
||||||
DestDir.Create();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return dirSourceDest;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setLabel17Text(string text)
|
private void setLabel17Text(string text)
|
||||||
{
|
{
|
||||||
if (lblFotoTotaliNum.InvokeRequired)
|
if (lblFotoTotaliNum.InvokeRequired)
|
||||||
|
|
@ -895,127 +669,6 @@ public partial class MainForm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void creaImmaginiWithThreadMod(string SourcePath, string DestPath)
|
|
||||||
{
|
|
||||||
var SourceDir = new DirectoryInfo(SourcePath);
|
|
||||||
var DestDirStart = new DirectoryInfo(DestPath);
|
|
||||||
DirectoryInfo DestDir = null;
|
|
||||||
int NumFileXDir = int.Parse(txtFilePerCartella.Text);
|
|
||||||
string SuffixDir = txtSuffissoCartelle.Text;
|
|
||||||
int NumCifreDir = int.Parse(txtCifreContatore.Text);
|
|
||||||
bool DividiFile = false;
|
|
||||||
StopAttivo = false;
|
|
||||||
int FileConta = 0;
|
|
||||||
int ContaFileXDir = 0;
|
|
||||||
int ContaDirXDir = 0;
|
|
||||||
string TestoTemp = "";
|
|
||||||
int ContaTemp = 0;
|
|
||||||
if (SourceDir.Exists)
|
|
||||||
{
|
|
||||||
FileConta = SourceDir.GetFiles("*.jpg").GetLength(0);
|
|
||||||
// Label17.Text = (CType(Label17.Text, Integer) + FileConta).ToString
|
|
||||||
var a = (int.Parse(lblFotoTotaliNum.Text) + FileConta);
|
|
||||||
setLabel17Text(a.ToString());
|
|
||||||
setProgressBarMaximum(a);
|
|
||||||
if (NumFileXDir > 0 & chkCreaSottocartelle.Checked == true)
|
|
||||||
{
|
|
||||||
if (FileConta > NumFileXDir)
|
|
||||||
{
|
|
||||||
DividiFile = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DestDir = DestDirStart;
|
|
||||||
if (!DestDir.Exists)
|
|
||||||
{
|
|
||||||
DestDir.Create();
|
|
||||||
}
|
|
||||||
|
|
||||||
DividiFile = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DestDir = DestDirStart;
|
|
||||||
if (!DestDir.Exists)
|
|
||||||
{
|
|
||||||
DestDir.Create();
|
|
||||||
}
|
|
||||||
|
|
||||||
DividiFile = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var childFile in SourceDir.GetFiles("*.jpg"))
|
|
||||||
{
|
|
||||||
if (StopAttivo == true)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
setLabel10Text("File: " + childFile.Name);
|
|
||||||
string b = (int.Parse(Label18.Text) + 1).ToString();
|
|
||||||
// setLabel18Text(b)
|
|
||||||
// setProgressBarValue(CInt(b))
|
|
||||||
// Label10.Text = "File: " & childFile.Name
|
|
||||||
// Label18.Text = (CType(Label18.Text, Integer) + 1).ToString
|
|
||||||
// Application.DoEvents()
|
|
||||||
|
|
||||||
ContaFileXDir += 1;
|
|
||||||
if (DividiFile == true)
|
|
||||||
{
|
|
||||||
if (ContaFileXDir == ContaDirXDir * NumFileXDir + 1)
|
|
||||||
{
|
|
||||||
ContaDirXDir += 1;
|
|
||||||
if (rdbNumProgressiva.Checked == true)
|
|
||||||
{
|
|
||||||
TestoTemp = ContaDirXDir.ToString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TestoTemp = (ContaDirXDir * NumFileXDir).ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
var loopTo = NumCifreDir - TestoTemp.Length;
|
|
||||||
for (ContaTemp = 1; ContaTemp <= loopTo; ContaTemp++)
|
|
||||||
TestoTemp = "0" + TestoTemp;
|
|
||||||
if (DestDirStart.FullName.EndsWith(@"\"))
|
|
||||||
{
|
|
||||||
DestDir = new DirectoryInfo(DestDirStart.FullName + SuffixDir + TestoTemp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DestDir = new DirectoryInfo(DestDirStart.FullName + @"\" + SuffixDir + TestoTemp);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!DestDir.Exists)
|
|
||||||
{
|
|
||||||
DestDir.Create();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Application.DoEvents()
|
|
||||||
|
|
||||||
|
|
||||||
var ClsCreaImmagine = new ImageCreatorSharp(childFile.Name, SourceDir, DestDir, DestDirStart);
|
|
||||||
// ClsCreaImmagine.NomeFileChild = childFile.Name
|
|
||||||
// ClsCreaImmagine.DestDir = DestDir
|
|
||||||
// ClsCreaImmagine.SourceDir = SourceDir
|
|
||||||
// ClsCreaImmagine.DestDirStart = DestDirStart
|
|
||||||
|
|
||||||
ContaImmaginiThread += 1;
|
|
||||||
//MyPool.InsertWorkItem(childFile.Name, new XyThreadAdd((_) => ClsCreaImmagine.CreaImmagineThread()), new object[1] { childFile.Name }, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// copy all the sub-directories by recursively calling this same routine
|
|
||||||
if (chkAggiornaSottodirectory.Checked == true)
|
|
||||||
{
|
|
||||||
foreach (var subDir in SourceDir.GetDirectories())
|
|
||||||
creaImmaginiWithThreadMod(subDir.FullName, Path.Combine(DestDir.FullName, subDir.Name));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private int getNumerazione()
|
private int getNumerazione()
|
||||||
{
|
{
|
||||||
int numerazione;
|
int numerazione;
|
||||||
|
|
@ -1046,211 +699,6 @@ public partial class MainForm
|
||||||
return numerazioneType;
|
return numerazioneType;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CreaimmaginiWithThreadDict(string SourcePath, string DestPath)
|
|
||||||
{
|
|
||||||
var dirSourceDest = new Dictionary<FileInfo, DirectoryInfo>();
|
|
||||||
if (chkAggiornaSottodirectory.Checked & chkCreaSottocartelle.Checked)
|
|
||||||
{
|
|
||||||
var helper = new FileHelper(int.Parse(txtFilePerCartella.Text), txtSuffissoCartelle.Text,
|
|
||||||
int.Parse(txtCifreContatore.Text), getNumerazione());
|
|
||||||
// getfilesrecursive
|
|
||||||
dirSourceDest =
|
|
||||||
helper.GetFilesRecursive(new DirectoryInfo(SourcePath), new DirectoryInfo(DestPath), "*.jpg");
|
|
||||||
}
|
|
||||||
else if (chkAggiornaSottodirectory.Checked & !chkCreaSottocartelle.Checked)
|
|
||||||
{
|
|
||||||
// = getDirsDict(SourcePath, DestPath)
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var pair in dirSourceDest)
|
|
||||||
{
|
|
||||||
setLabel10Text("File: " + pair.Key.Name);
|
|
||||||
string b = (int.Parse(Label18.Text) + 1).ToString();
|
|
||||||
var ClsCreaImmagine = new ImageCreatorSharp(pair.Key, pair.Value);
|
|
||||||
ContaImmaginiThread += 1;
|
|
||||||
//MyPool.InsertWorkItem(pair.Key.Name, new XyThreadAdd((_) => ClsCreaImmagine.CreaImmagineThread()), new object[1] { pair.Key.Name }, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// il posto giusto dove fare modifiche
|
|
||||||
private void CreaImmaginiWithThread(string SourcePath, string DestPath)
|
|
||||||
{
|
|
||||||
var SourceDir = new DirectoryInfo(SourcePath);
|
|
||||||
var DestDirStart = new DirectoryInfo(DestPath);
|
|
||||||
DirectoryInfo DestDir = null;
|
|
||||||
int NumFileXDir = int.Parse(txtFilePerCartella.Text);
|
|
||||||
string SuffixDir = txtSuffissoCartelle.Text;
|
|
||||||
int NumCifreDir = int.Parse(txtCifreContatore.Text);
|
|
||||||
bool DividiFile = false;
|
|
||||||
StopAttivo = false;
|
|
||||||
int FileConta = 0;
|
|
||||||
int ContaFileXDir = 0;
|
|
||||||
int ContaDirXDir = 0;
|
|
||||||
string TestoTemp = "";
|
|
||||||
int ContaTemp = 0;
|
|
||||||
if (SourceDir.Exists)
|
|
||||||
{
|
|
||||||
FileConta = SourceDir.GetFiles("*.jpg").GetLength(0);
|
|
||||||
lblFotoTotaliNum.Text = (int.Parse(lblFotoTotaliNum.Text) + FileConta).ToString();
|
|
||||||
if (NumFileXDir > 0 & chkCreaSottocartelle.Checked == true)
|
|
||||||
{
|
|
||||||
if (FileConta > NumFileXDir)
|
|
||||||
{
|
|
||||||
DividiFile = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DestDir = DestDirStart;
|
|
||||||
if (!DestDir.Exists)
|
|
||||||
{
|
|
||||||
DestDir.Create();
|
|
||||||
}
|
|
||||||
|
|
||||||
DividiFile = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DestDir = DestDirStart;
|
|
||||||
if (!DestDir.Exists)
|
|
||||||
{
|
|
||||||
DestDir.Create();
|
|
||||||
}
|
|
||||||
|
|
||||||
DividiFile = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var childFile in SourceDir.GetFiles("*.jpg"))
|
|
||||||
{
|
|
||||||
if (StopAttivo == true)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// Label10.Text = "File: " & childFile.Name
|
|
||||||
// Label18.Text = (CType(Label18.Text, Integer) + 1).ToString
|
|
||||||
// Application.DoEvents()
|
|
||||||
|
|
||||||
ContaFileXDir += 1;
|
|
||||||
if (DividiFile == true)
|
|
||||||
{
|
|
||||||
if (ContaFileXDir == ContaDirXDir * NumFileXDir + 1)
|
|
||||||
{
|
|
||||||
ContaDirXDir += 1;
|
|
||||||
if (rdbNumProgressiva.Checked == true)
|
|
||||||
{
|
|
||||||
TestoTemp = ContaDirXDir.ToString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TestoTemp = (ContaDirXDir * NumFileXDir).ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
var loopTo = NumCifreDir - TestoTemp.Length;
|
|
||||||
for (ContaTemp = 1; ContaTemp <= loopTo; ContaTemp++)
|
|
||||||
TestoTemp = "0" + TestoTemp;
|
|
||||||
if (DestDirStart.FullName.EndsWith(@"\"))
|
|
||||||
{
|
|
||||||
DestDir = new DirectoryInfo(DestDirStart.FullName + SuffixDir + TestoTemp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DestDir = new DirectoryInfo(DestDirStart.FullName + @"\" + SuffixDir + TestoTemp);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!DestDir.Exists)
|
|
||||||
{
|
|
||||||
DestDir.Create();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Application.DoEvents();
|
|
||||||
var ClsCreaImmagine = new CreaImmagineSeparateThread();
|
|
||||||
ClsCreaImmagine.DirectorySorgente = SourcePath;
|
|
||||||
ClsCreaImmagine.DirectoryDestinazione = Model.DestinationPath;
|
|
||||||
ClsCreaImmagine.DestDir = DestDir;
|
|
||||||
ClsCreaImmagine.SourceDir = SourceDir;
|
|
||||||
ClsCreaImmagine.DestDirStart = DestDirStart;
|
|
||||||
ClsCreaImmagine.DimStandard = int.Parse(TextBox11.Text);
|
|
||||||
ClsCreaImmagine.DimStandardMiniatura = int.Parse(TextBox25.Text);
|
|
||||||
ClsCreaImmagine.UsaOrarioMiniatura = CheckBox12.Checked;
|
|
||||||
ClsCreaImmagine.UsaOrarioTestoApplicare = CheckBox8.Checked;
|
|
||||||
ClsCreaImmagine.UsaTempoGaraTestoApplicare = CheckBox7.Checked;
|
|
||||||
ClsCreaImmagine.UsaRotazioneAutomatica = chkRotazioneAutomatica.Checked;
|
|
||||||
ClsCreaImmagine.UsaForzaJpg = chkForzaJpg.Checked;
|
|
||||||
if (CheckBox17.Checked)
|
|
||||||
{
|
|
||||||
ClsCreaImmagine.TestoNome = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ClsCreaImmagine.TestoNome = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CheckBox16.Checked)
|
|
||||||
{
|
|
||||||
ClsCreaImmagine.NomeData = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ClsCreaImmagine.NomeData = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ClsCreaImmagine.TestoFirmaStart = Model.HorizontalText;
|
|
||||||
ClsCreaImmagine.TestoFirmaStartV = TextBox29.Text;
|
|
||||||
ClsCreaImmagine.DataPartenza = DateTimePicker1.Value;
|
|
||||||
ClsCreaImmagine.TestoOrario = TextBox18.Text;
|
|
||||||
ClsCreaImmagine.AltezzaSmall = int.Parse(TextBox5.Text);
|
|
||||||
ClsCreaImmagine.LarghezzaSmall = int.Parse(TextBox5.Text);
|
|
||||||
ClsCreaImmagine.CreaMiniature = CheckBox1.Checked;
|
|
||||||
ClsCreaImmagine.AggiungiScritteMiniature = RadioButton3.Checked;
|
|
||||||
ClsCreaImmagine.AggTempoGaraMin = RadioButton5.Checked;
|
|
||||||
ClsCreaImmagine.AggNumTempMin = RadioButton7.Checked;
|
|
||||||
ClsCreaImmagine.DimVert = int.Parse(TextBox30.Text);
|
|
||||||
ClsCreaImmagine.MargVert = int.Parse(TextBox31.Text);
|
|
||||||
ClsCreaImmagine.NomeFileChild = childFile.Name;
|
|
||||||
ClsCreaImmagine.Suffisso = TextBox3.Text;
|
|
||||||
// ClsCreaImmagine.Codice = TextBox13.Text
|
|
||||||
|
|
||||||
ClsCreaImmagine.Trasparenza = int.Parse(TextBox9.Text);
|
|
||||||
ClsCreaImmagine.IlFont = ComboBox3.SelectedItem.ToString();
|
|
||||||
ClsCreaImmagine.Grassetto = CheckBox3.Checked;
|
|
||||||
ClsCreaImmagine.Posizione = ComboBox1.SelectedItem.ToString();
|
|
||||||
ClsCreaImmagine.Allineamento = ComboBox2.SelectedItem.ToString();
|
|
||||||
ClsCreaImmagine.Margine = int.Parse(TextBox12.Text);
|
|
||||||
ClsCreaImmagine.LogoAltezza = int.Parse(TextBox14.Text);
|
|
||||||
ClsCreaImmagine.LogoLarghezza = int.Parse(TextBox15.Text);
|
|
||||||
|
|
||||||
// ClsCreaImmagine.FontColoreR = CType(TextBox22.Text, Integer)
|
|
||||||
// ClsCreaImmagine.FontColoreG = CType(TextBox23.Text, Integer)
|
|
||||||
// ClsCreaImmagine.FontColoreB = CType(TextBox24.Text, Integer)
|
|
||||||
ClsCreaImmagine.fontColoreRGB = ColorTranslator.FromHtml(TextBox34.Text);
|
|
||||||
ClsCreaImmagine.LogoAggiungi = CheckBox5.Checked;
|
|
||||||
ClsCreaImmagine.LogoNomeFile = TextBox10.Text;
|
|
||||||
ClsCreaImmagine.LogoTrasparenza = TextBox19.Text;
|
|
||||||
ClsCreaImmagine.LogoMargine = TextBox16.Text;
|
|
||||||
ClsCreaImmagine.LogoPosizioneH = ComboBox4.Text;
|
|
||||||
ClsCreaImmagine.LogoPosizioneV = ComboBox5.Text;
|
|
||||||
ClsCreaImmagine.FotoGrandeDimOrigina = CheckBox15.Checked;
|
|
||||||
ClsCreaImmagine.AltezzaBig = int.Parse(TextBox27.Text);
|
|
||||||
ClsCreaImmagine.LarghezzaBig = int.Parse(TextBox28.Text);
|
|
||||||
ClsCreaImmagine.DimMin = int.Parse(TextBox25.Text);
|
|
||||||
ClsCreaImmagine.TestoMin = RadioButton6.Checked;
|
|
||||||
ClsCreaImmagine.jpegQuality = int.Parse(TextBox32.Text);
|
|
||||||
ClsCreaImmagine.jpegQualityMin = int.Parse(TextBox33.Text);
|
|
||||||
ContaImmaginiThread += 1;
|
|
||||||
MyPool.InsertWorkItem(childFile.Name, new XyThreadAdd(ClsCreaImmagine.CreaImmagineThread),
|
|
||||||
new object[1] { childFile.Name }, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// copy all the sub-directories by recursively calling this same routine
|
|
||||||
if (chkAggiornaSottodirectory.Checked == true)
|
|
||||||
{
|
|
||||||
foreach (var subDir in SourceDir.GetDirectories())
|
|
||||||
CreaImmaginiWithThread(subDir.FullName, Path.Combine(DestDir.FullName, subDir.Name));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CopyDirectoryFile(string SourcePath, string DestPath, bool OverWrite = false)
|
private void CopyDirectoryFile(string SourcePath, string DestPath, bool OverWrite = false)
|
||||||
{
|
{
|
||||||
|
|
@ -1395,31 +843,6 @@ public partial class MainForm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Private Declare Function CreateDC Lib "gdi32.dll" (ByVal strDriver As String, ByVal strDevice As String, ByVal strOutput As String, ByVal pData As IntPtr) As IntPtr
|
|
||||||
// Private Declare Function DeleteDC Lib "gdi32.dll" (ByVal hdc As IntPtr) As Boolean
|
|
||||||
// Private Declare Function GetPixel Lib "gdi32.dll" (ByVal hdc As IntPtr, ByVal x As Integer, ByVal y As Integer) As Integer
|
|
||||||
// Private Declare Function GetCursorPos Lib "user32.dll" (ByRef lpPoint As Point) As Boolean
|
|
||||||
|
|
||||||
|
|
||||||
// ''' <summary>
|
|
||||||
// ''' Get the color relative to mouse position
|
|
||||||
// ''' </summary>
|
|
||||||
// Private Sub GetColor()
|
|
||||||
// Dim hdcScreen As IntPtr = CreateDC("Display", Nothing, Nothing, IntPtr.Zero)
|
|
||||||
// Dim pt As Point = New Point
|
|
||||||
// GetCursorPos(pt)
|
|
||||||
// Dim cr As Integer = GetPixel(hdcScreen, pt.X, pt.Y)
|
|
||||||
// DeleteDC(hdcScreen)
|
|
||||||
// Dim clr As Color = Color.FromArgb((cr And &HFF), (cr And &HFF00) >> 8, (cr And &HFF0000) >> 16)
|
|
||||||
// PictureBox3.BackColor = clr
|
|
||||||
// If WaterSelectColor = True Then
|
|
||||||
// PictureBox2.BackColor = clr
|
|
||||||
// End If
|
|
||||||
// WaterSelectColor = False
|
|
||||||
// End Sub
|
|
||||||
|
|
||||||
|
|
||||||
private Color[] GetPixelColor(Point screenLocation)
|
private Color[] GetPixelColor(Point screenLocation)
|
||||||
{
|
{
|
||||||
// Dim bm As New Bitmap(1, 1, Imaging.PixelFormat.Format24bppRgb)
|
// Dim bm As New Bitmap(1, 1, Imaging.PixelFormat.Format24bppRgb)
|
||||||
|
|
@ -1494,13 +917,13 @@ public partial class MainForm
|
||||||
lblFotoTotaliNum.Text = "0";
|
lblFotoTotaliNum.Text = "0";
|
||||||
Label18.Text = "0";
|
Label18.Text = "0";
|
||||||
Label43.Text = "-s";
|
Label43.Text = "-s";
|
||||||
setPicSettings(Model.SourcePath, Model.DestinationPath);
|
SetPicSettings(Model.SourcePath, Model.DestinationPath);
|
||||||
ProgressBar1.Minimum = 0;
|
ProgressBar1.Minimum = 0;
|
||||||
ProgressBar1.Step = 1;
|
ProgressBar1.Step = 1;
|
||||||
ProgressBar1.Value = 0;
|
ProgressBar1.Value = 0;
|
||||||
|
|
||||||
// Await CreaCatalogoParallel()
|
// Await CreaCatalogoParallel()
|
||||||
var imgStf = _imageCreationService; //new ImageCreationStuff();
|
|
||||||
var imageCreationOptions = new ImageCreationStuff.Options
|
var imageCreationOptions = new ImageCreationStuff.Options
|
||||||
{
|
{
|
||||||
AggiornaSottodirectory = chkAggiornaSottodirectory.Checked,
|
AggiornaSottodirectory = chkAggiornaSottodirectory.Checked,
|
||||||
|
|
@ -1526,7 +949,7 @@ public partial class MainForm
|
||||||
timer1.Interval = 1000 * 60;
|
timer1.Interval = 1000 * 60;
|
||||||
timer1.Enabled = true;
|
timer1.Enabled = true;
|
||||||
|
|
||||||
string time = await imgStf.CreaCatalogoParallel(imageCreationOptions, _results, UiUpdateEvent, token);
|
string time = await _imageCreationService.CreaCatalogoParallel(imageCreationOptions, _results, UiUpdateEvent, token);
|
||||||
Label43.Text = time;
|
Label43.Text = time;
|
||||||
timer1.Enabled = false;
|
timer1.Enabled = false;
|
||||||
}
|
}
|
||||||
|
|
@ -1562,105 +985,6 @@ public partial class MainForm
|
||||||
{
|
{
|
||||||
Label10.Invoke(new Action(() => Label10.Text = text));
|
Label10.Invoke(new Action(() => Label10.Text = text));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private async Task CreaCatalogoParallel()
|
|
||||||
{
|
|
||||||
var timeStart = DateTime.Now;
|
|
||||||
ContaImmaginiThread = 0;
|
|
||||||
setLabel10Text("Elaborazione in corso...");
|
|
||||||
var imgStf = _imageCreationService;
|
|
||||||
var imageCreationOptions = new ImageCreationStuff.Options();
|
|
||||||
imageCreationOptions.AggiornaSottodirectory = chkAggiornaSottodirectory.Checked;
|
|
||||||
imageCreationOptions.CreaSottocartelle = chkCreaSottocartelle.Checked;
|
|
||||||
imageCreationOptions.FilePerCartella = int.Parse(txtFilePerCartella.Text);
|
|
||||||
imageCreationOptions.SuffissoCartelle = txtSuffissoCartelle.Text;
|
|
||||||
imageCreationOptions.CifreContatore = int.Parse(txtCifreContatore.Text);
|
|
||||||
imageCreationOptions.NumerazioneType = GetNumerazioneEnum();
|
|
||||||
imageCreationOptions.SourcePath = Model.SourcePath;
|
|
||||||
imageCreationOptions.DestinationPath = Model.DestinationPath;
|
|
||||||
await imgStf.ProcessImagesParallel(imageCreationOptions, _results, UiUpdateEvent);
|
|
||||||
|
|
||||||
// Await CreaImmaginiParallel(txtSorgente.Text, txtDestinazione.Text)
|
|
||||||
|
|
||||||
setLabel10Text("Finito");
|
|
||||||
var timeStop = DateTime.Now;
|
|
||||||
setLabel43Text(CalcTime(timeStart, timeStop, ContaImmaginiThread));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Private Async Function CreaImmaginiParallel(ByVal SourcePath As String, ByVal DestPath As String) As Task
|
|
||||||
// Dim dataToProcess As List(Of FileData) = New List(Of FileData)
|
|
||||||
|
|
||||||
// 'Dim dirSourceDest As Dictionary(Of FileInfo, DirectoryInfo) = New Dictionary(Of FileInfo, DirectoryInfo)
|
|
||||||
// If chkAggiornaSottodirectory.Checked And chkCreaSottocartelle.Checked Then
|
|
||||||
|
|
||||||
// Dim helperSharp As New FileHelperSharp()
|
|
||||||
|
|
||||||
// 'Dim helper As New FileHelper(CInt(txtFilePerCartella.Text), txtSuffissoCartelle.Text, CInt(txtCifreContatore.Text), getNumerazione())
|
|
||||||
// 'getfilesrecursive
|
|
||||||
|
|
||||||
// Dim fileHelperOptions As FileHelperOptions = New FileHelperOptions()
|
|
||||||
// fileHelperOptions.FilesPerFolder = CInt(txtFilePerCartella.Text)
|
|
||||||
// fileHelperOptions.Suffix = txtSuffissoCartelle.Text
|
|
||||||
// fileHelperOptions.CounterSize = CInt(txtCifreContatore.Text)
|
|
||||||
// fileHelperOptions.NumerationType = GetNumerazioneEnum()
|
|
||||||
|
|
||||||
// dataToProcess = helperSharp.GetFilesRecursive(New DirectoryInfo(SourcePath), New DirectoryInfo(DestPath), "*.jpg", fileHelperOptions)
|
|
||||||
|
|
||||||
// 'dataToProcess = helper.GetFilesRecursiveParallel(New DirectoryInfo(SourcePath), New DirectoryInfo(DestPath), "*.jpg")
|
|
||||||
// ElseIf chkAggiornaSottodirectory.Checked And Not chkCreaSottocartelle.Checked Then
|
|
||||||
// ' TODO manca tutto?!?!?!?
|
|
||||||
// End If
|
|
||||||
|
|
||||||
// Dim scheduler As TaskScheduler = New ConcurrentExclusiveSchedulerPair(TaskScheduler.Default, Environment.ProcessorCount * 2).ConcurrentScheduler
|
|
||||||
|
|
||||||
// Dim test As IEnumerable(Of Task) = From d In dataToProcess Select Task.Factory.StartNew(Sub()
|
|
||||||
// 'setLabel10Text("File: " & p.File.Name)
|
|
||||||
|
|
||||||
// Dim b As String = (CType(Label18.Text, Integer) + 1).ToString
|
|
||||||
|
|
||||||
// Dim clsCreaImmagine As New ImageCreator(d.File, d.Directory)
|
|
||||||
|
|
||||||
// clsCreaImmagine.CreaImmagineThread(d.File.Name)
|
|
||||||
|
|
||||||
// ContaImmaginiThread += 1
|
|
||||||
// UpdateCounter(ContaImmaginiThread & " " & d.File.Name)
|
|
||||||
// End Sub, CancellationToken.None, TaskCreationOptions.LongRunning, scheduler) 'TODO Cancellation Token
|
|
||||||
|
|
||||||
// 'ThreadingHelper.StartAndWaitAllThrottled(test, CType(TextBox7.Text, Integer))
|
|
||||||
|
|
||||||
// Await Task.WhenAll(test)
|
|
||||||
|
|
||||||
// '= getDirsDict(SourcePath, DestPath)
|
|
||||||
// 'Parallel.ForEach(dataToProcess,
|
|
||||||
// ' Sub(p, state)
|
|
||||||
// ' 'setLabel10Text("File: " & p.File.Name)
|
|
||||||
|
|
||||||
// ' Dim b As String = (CType(Label18.Text, Integer) + 1).ToString
|
|
||||||
|
|
||||||
// ' Dim clsCreaImmagine As New ImageCreator(p.File, p.Directory)
|
|
||||||
|
|
||||||
// ' clsCreaImmagine.CreaImmagineThread(p.File.Name)
|
|
||||||
|
|
||||||
// ' ContaImmaginiThread += 1
|
|
||||||
// ' UpdateCounter(ContaImmaginiThread & " " & p.File.Name)
|
|
||||||
// ' 'MyPool.InsertWorkItem(p.File.Name, New XyThreadAdd(AddressOf ClsCreaImmagine.CreaImmagineThread), New Object(0) {p.File.Name}, True)
|
|
||||||
// ' ' TODO: BREAK ON STOP state.stop()
|
|
||||||
|
|
||||||
// ' End Sub)
|
|
||||||
|
|
||||||
// 'Dim pair As KeyValuePair(Of FileInfo, DirectoryInfo)
|
|
||||||
// 'For Each pair In dirSourceDest
|
|
||||||
|
|
||||||
// ' setLabel10Text("File: " & pair.Key.Name)
|
|
||||||
// ' Dim b As String = (CType(Label18.Text, Integer) + 1).ToString
|
|
||||||
|
|
||||||
// ' Dim ClsCreaImmagine As New ImageCreator(pair.Key, pair.Value)
|
|
||||||
// ' ContaImmaginiThread += 1
|
|
||||||
// ' MyPool.InsertWorkItem(pair.Key.Name, New XyThreadAdd(AddressOf ClsCreaImmagine.CreaImmagineThread), New Object(0) {pair.Key.Name}, True)
|
|
||||||
|
|
||||||
// 'Next
|
|
||||||
// End Function
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PicInfo
|
public class PicInfo
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,7 @@ namespace ImageCatalog_2
|
||||||
services.AddTransient<ImageCreationStuff>();
|
services.AddTransient<ImageCreationStuff>();
|
||||||
|
|
||||||
services.AddSingleton<ParametriSetup>();
|
services.AddSingleton<ParametriSetup>();
|
||||||
|
services.AddSingleton<PicSettings>();
|
||||||
|
|
||||||
// Register your forms
|
// Register your forms
|
||||||
services.AddTransient<MainForm>();
|
services.AddTransient<MainForm>();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue