Removed visual basic lib dependency
This commit is contained in:
parent
65aeabdfee
commit
ab33d4558f
11 changed files with 102 additions and 2084 deletions
|
|
@ -8,7 +8,6 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using CatalogVbLib;
|
||||
using Dasync.Collections;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
|
|
|
|||
|
|
@ -10,12 +10,10 @@ using System.Runtime.CompilerServices;
|
|||
using System.Security;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.VisualBasic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Windows.Forms;
|
||||
using CatalogVbLib;
|
||||
using MaddoShared;
|
||||
using SixLabors.ImageSharp.Metadata.Profiles.Exif;
|
||||
|
||||
// Imports System.Threading
|
||||
|
|
@ -57,7 +55,7 @@ public class ImageCreatorSharp : IDisposable
|
|||
private float yPosFromBottom3;
|
||||
private float yPosFromBottom4;
|
||||
|
||||
private ExifReader.Orientations _orientation;
|
||||
private Orientations _orientation;
|
||||
private DateTime? _creationDate;
|
||||
|
||||
public ImageCreatorSharp()
|
||||
|
|
@ -144,7 +142,7 @@ public class ImageCreatorSharp : IDisposable
|
|||
private void ExtractExif()
|
||||
{
|
||||
using var img = SixLabors.ImageSharp.Image.Load(_workFile.FullName);
|
||||
_orientation = ExifReader.Orientations.TopLeft;
|
||||
_orientation = Orientations.TopLeft;
|
||||
|
||||
IExifValue<ushort> rotation = null;
|
||||
|
||||
|
|
@ -153,7 +151,7 @@ public class ImageCreatorSharp : IDisposable
|
|||
if (found )
|
||||
{
|
||||
var intOrientation = rotation.Value.ToInt32();
|
||||
_orientation = (ExifReader.Orientations)intOrientation;
|
||||
_orientation = (Orientations)intOrientation;
|
||||
}
|
||||
|
||||
IExifValue<string> date = null;
|
||||
|
|
@ -191,16 +189,16 @@ public class ImageCreatorSharp : IDisposable
|
|||
|
||||
switch (_orientation /*DatiExif.Orientation*/)
|
||||
{
|
||||
case ExifReader.Orientations.BottomLeft:
|
||||
case ExifReader.Orientations.BottomRight:
|
||||
case ExifReader.Orientations.LeftTop:
|
||||
case ExifReader.Orientations.LftBottom:
|
||||
case Orientations.BottomLeft:
|
||||
case Orientations.BottomRight:
|
||||
case Orientations.LeftTop:
|
||||
case Orientations.LftBottom:
|
||||
FotoRuotaASinistra = true;
|
||||
break;
|
||||
case ExifReader.Orientations.RightBottom:
|
||||
case ExifReader.Orientations.RightTop:
|
||||
case ExifReader.Orientations.TopLeft:
|
||||
case ExifReader.Orientations.TopRight:
|
||||
case Orientations.RightBottom:
|
||||
case Orientations.RightTop:
|
||||
case Orientations.TopLeft:
|
||||
case Orientations.TopRight:
|
||||
break;
|
||||
|
||||
}
|
||||
|
|
@ -422,7 +420,7 @@ public class ImageCreatorSharp : IDisposable
|
|||
StrFormat1.Alignment = StringAlignment.Center;
|
||||
|
||||
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
|
||||
DimensioneStandardMiniatura = PicSettings.DimMin;
|
||||
|
|
@ -608,7 +606,7 @@ public class ImageCreatorSharp : IDisposable
|
|||
|
||||
SolidBrush semiTransBrush2 = new SolidBrush(Color.FromArgb(alphaScelta, 0, 0, 0));
|
||||
// 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)
|
||||
{
|
||||
|
|
@ -800,7 +798,7 @@ public class ImageCreatorSharp : IDisposable
|
|||
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);
|
||||
if (thisFormat.Equals(ImageFormat.Jpeg))
|
||||
SalvaImmagineCustomQuality(imgOutputBig2, Path.Combine(DestDir.FullName, NomeFileBig), PicSettings.jpegQuality);
|
||||
SalvaImmagineCustomQuality(imgOutputBig2, Path.Combine(DestDir.FullName, NomeFileBig), PicSettings.JpegQuality);
|
||||
else
|
||||
imgOutputBig2.Save(Path.Combine(DestDir.FullName, NomeFileBig), thisFormat);
|
||||
|
||||
|
|
@ -813,7 +811,7 @@ public class ImageCreatorSharp : IDisposable
|
|||
{
|
||||
//
|
||||
if (thisFormat.Equals(ImageFormat.Jpeg))
|
||||
SalvaImmagineCustomQuality(imgOutputBig, Path.Combine(DestDir.FullName, NomeFileBig), PicSettings.jpegQuality);
|
||||
SalvaImmagineCustomQuality(imgOutputBig, Path.Combine(DestDir.FullName, NomeFileBig), PicSettings.JpegQuality);
|
||||
else
|
||||
imgOutputBig.Save(Path.Combine(DestDir.FullName, NomeFileBig), thisFormat);
|
||||
|
||||
|
|
@ -837,7 +835,7 @@ public class ImageCreatorSharp : IDisposable
|
|||
NomeFileSmall = NomeFileSmall.Substring(0, NomeFileSmall.Length - 4) + PicSettings.Codice + NomeFileSmall.Substring(NomeFileSmall.Length - 4);
|
||||
//
|
||||
if (thisFormat.Equals(ImageFormat.Jpeg))
|
||||
SalvaImmagineCustomQuality(imgOutputSmall, Path.Combine(DestDir.FullName, NomeFileSmall), PicSettings.jpegQualityMin);
|
||||
SalvaImmagineCustomQuality(imgOutputSmall, Path.Combine(DestDir.FullName, NomeFileSmall), PicSettings.JpegQualityMin);
|
||||
else
|
||||
imgOutputSmall.Save(Path.Combine(_DestDir.FullName, NomeFileSmall), thisFormat);
|
||||
|
||||
|
|
@ -858,7 +856,7 @@ public class ImageCreatorSharp : IDisposable
|
|||
|
||||
EncoderParameters MyEncoderParameters = new EncoderParameters(1);
|
||||
|
||||
EncoderParameter MyEncoderParameter = new EncoderParameter(MyEncoder, PicSettings.jpegQuality);
|
||||
EncoderParameter MyEncoderParameter = new EncoderParameter(MyEncoder, PicSettings.JpegQuality);
|
||||
MyEncoderParameters.Param[0] = MyEncoderParameter;
|
||||
imageToSave.Save(nomeFileFinale, JgpEncoder, MyEncoderParameters);
|
||||
//imageToSave.Dispose();
|
||||
|
|
@ -871,7 +869,7 @@ public class ImageCreatorSharp : IDisposable
|
|||
|
||||
EncoderParameters MyEncoderParameters = new EncoderParameters(1);
|
||||
|
||||
EncoderParameter MyEncoderParameter = new EncoderParameter(MyEncoder, PicSettings.jpegQuality);
|
||||
EncoderParameter MyEncoderParameter = new EncoderParameter(MyEncoder, PicSettings.JpegQuality);
|
||||
MyEncoderParameters.Param[0] = MyEncoderParameter;
|
||||
destinationStream.Seek(0, SeekOrigin.Begin);
|
||||
imageToSave.Save(destinationStream, JgpEncoder, MyEncoderParameters);
|
||||
|
|
|
|||
|
|
@ -7,9 +7,6 @@
|
|||
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CatalogVbLib\CatalogVbLib.vbproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AsyncEnumerator" Version="4.0.2" />
|
||||
<PackageReference Include="Ben.Demystifier" Version="0.4.1" />
|
||||
|
|
|
|||
13
MaddoShared/Orientations.cs
Normal file
13
MaddoShared/Orientations.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
namespace MaddoShared;
|
||||
|
||||
public enum Orientations
|
||||
{
|
||||
TopLeft = 1,
|
||||
TopRight = 2,
|
||||
BottomRight = 3,
|
||||
BottomLeft = 4,
|
||||
LeftTop = 5,
|
||||
RightTop = 6,
|
||||
RightBottom = 7,
|
||||
LftBottom = 8,
|
||||
}
|
||||
67
MaddoShared/PicSettings.cs
Normal file
67
MaddoShared/PicSettings.cs
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MaddoShared;
|
||||
|
||||
public static class PicSettings
|
||||
{
|
||||
public static string DirectorySorgente { get; set; }
|
||||
public static string DirectoryDestinazione { get; set; }
|
||||
public static string TestoFirmaStart { get; set; }
|
||||
public static string TestoFirmaStartV { get; set; }
|
||||
public static DateTime DataPartenza { get; set; }
|
||||
public static string TestoOrario { get; set; }
|
||||
public static int DimStandard { get; set; }
|
||||
public static int DimStandardMiniatura { get; set; }
|
||||
public static bool NomeData { get; set; }
|
||||
public static bool TestoNome { get; set; }
|
||||
public static bool UsaOrarioMiniatura { get; set; }
|
||||
public static bool UsaOrarioTestoApplicare { get; set; }
|
||||
public static bool UsaTempoGaraTestoApplicare { get; set; }
|
||||
public static bool UsaRotazioneAutomatica { get; set; }
|
||||
public static bool UsaForzaJpg { get; set; }
|
||||
public static int LarghezzaSmall { get; set; }
|
||||
public static int AltezzaSmall { get; set; }
|
||||
public static bool CreaMiniature { get; set; }
|
||||
public static bool AggiungiScritteMiniature { get; set; }
|
||||
public static string Suffisso { get; set; }
|
||||
public static string Codice { get; set; }
|
||||
public static int Trasparenza { get; set; }
|
||||
public static string IlFont { get; set; }
|
||||
public static bool Grassetto { get; set; }
|
||||
public static string Posizione { get; set; }
|
||||
public static string Allineamento { get; set; }
|
||||
public static int Margine { get; set; }
|
||||
public static int LogoAltezza { get; set; }
|
||||
public static int LogoLarghezza { get; set; }
|
||||
public static Color FontColoreRGB { get; set; }
|
||||
public static bool LogoAggiungi { get; set; }
|
||||
public static string LogoNomeFile { get; set; }
|
||||
public static string LogoTrasparenza { get; set; }
|
||||
public static string LogoMargine { get; set; }
|
||||
public static string LogoPosizioneH { get; set; }
|
||||
public static string LogoPosizioneV { get; set; }
|
||||
public static bool FotoGrandeDimOrigina { get; set; }
|
||||
public static int AltezzaBig { get; set; }
|
||||
public static int LarghezzaBig { get; set; }
|
||||
public static DirectoryInfo DestDir { get; set; }
|
||||
public static int DimVert { get; set; }
|
||||
public static int MargVert { get; set; }
|
||||
public static bool TestoMin { get; set; }
|
||||
public static int DimMin { get; set; }
|
||||
public static bool SecretDefault { get; set; }
|
||||
public static bool SecretBig { get; set; }
|
||||
public static bool SecretSmall { get; set; }
|
||||
public static string SecretPathSmall { get; set; }
|
||||
public static string SecretPathBig { get; set; }
|
||||
public static bool AggTempoGaraMin { get; set; }
|
||||
public static bool AggNumTempMin { get; set; }
|
||||
public static long JpegQuality { get; set; }
|
||||
public static long JpegQualityMin { get; set; }
|
||||
|
||||
public static bool FotoRuotaADestra { get; set; } = false;
|
||||
public static bool FotoRuotaASinistra { get; set; } = false;
|
||||
public static string TempMinText { get; set; } = string.Empty;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue