From 058b573d48abb886eb21339abe4b837464c3216b Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Mon, 14 Oct 2024 21:27:12 +0200 Subject: [PATCH 001/127] Added gitversion --- GitVersion.yml | 7 +++++++ imagecatalog/ImageCatalog 2.csproj | 33 +++++++++++++++--------------- imagecatalog/MainForm.cs | 2 +- 3 files changed, 25 insertions(+), 17 deletions(-) create mode 100644 GitVersion.yml diff --git a/GitVersion.yml b/GitVersion.yml new file mode 100644 index 0000000..23ce4fc --- /dev/null +++ b/GitVersion.yml @@ -0,0 +1,7 @@ +assembly-versioning-scheme: MajorMinorPatch +mode: ContinuousDelivery +branches: {} +ignore: + sha: [] +merge-message-formats: {} +next-version: 3.0 \ No newline at end of file diff --git a/imagecatalog/ImageCatalog 2.csproj b/imagecatalog/ImageCatalog 2.csproj index ed82cd2..9920d68 100644 --- a/imagecatalog/ImageCatalog 2.csproj +++ b/imagecatalog/ImageCatalog 2.csproj @@ -1,21 +1,22 @@  - - WinExe - net8.0-windows - enable - enable - true - - False - - - - embedded + + WinExe + net8.0-windows + enable + enable + true + False + 3.0.0.0 + 3.0.0.0 + 3.0.0-alpha.58+Branch.develop.Sha.e701ca7f36678380b6354f2e112b7dbdda5f5865 + 3.0.0-alpha0058 + + + embedded + + + embedded - - embedded - - MyApplicationCodeGenerator diff --git a/imagecatalog/MainForm.cs b/imagecatalog/MainForm.cs index 5c71725..52b720c 100644 --- a/imagecatalog/MainForm.cs +++ b/imagecatalog/MainForm.cs @@ -41,7 +41,7 @@ namespace ImageCatalog _btnCreaCatalogoAsync.Name = "btnCreaCatalogoAsync"; var version = Assembly.GetExecutingAssembly().GetName().Version; - _Label27.Text = $"Version: {version.Major}.{version.Minor}.{version.Build}"; + _Label27.Text = $"Version: {version.Major}.{version.Minor}.{version.Build}.{version.Revision}"; _results = new ConcurrentBag(); UiUpdateEvent += OnUiUpdateEvent; -- 2.52.0 From 388b9acf3220368b25e9a4d774323c73078ec17a Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Mon, 14 Oct 2024 21:29:50 +0200 Subject: [PATCH 002/127] Added gitversion msbuild task --- imagecatalog/ImageCatalog 2.csproj | 3 +++ 1 file changed, 3 insertions(+) diff --git a/imagecatalog/ImageCatalog 2.csproj b/imagecatalog/ImageCatalog 2.csproj index 9920d68..a1d0050 100644 --- a/imagecatalog/ImageCatalog 2.csproj +++ b/imagecatalog/ImageCatalog 2.csproj @@ -41,6 +41,9 @@ all + + All + -- 2.52.0 From 328d7da303ddd44d7fdae46c8d8b2ad82ad2a494 Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Mon, 14 Oct 2024 21:56:05 +0200 Subject: [PATCH 003/127] Reupdated projects --- Catalog.sln | 18 +------ imagecatalog/ImageCatalog 2 - Backup.csproj | 59 +++++++++++++++++++++ imagecatalog/ImageCatalog 2.csproj | 11 ++-- 3 files changed, 64 insertions(+), 24 deletions(-) create mode 100644 imagecatalog/ImageCatalog 2 - Backup.csproj diff --git a/Catalog.sln b/Catalog.sln index 237b063..61fc80b 100644 --- a/Catalog.sln +++ b/Catalog.sln @@ -9,9 +9,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageCatalog 3", "ImageCata EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CatalogLib", "CatalogLib\CatalogLib.csproj", "{D27ACCF2-80FC-4DE8-AEB8-351FF076E6D5}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WPFCatalog", "WPFCatalog\WPFCatalog.csproj", "{638DE501-CECA-4744-B293-7AE93CAEEB01}" -EndProject -Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "CatalogVbLib", "CatalogVbLib\CatalogVbLib.vbproj", "{44465926-240D-473F-90B8-786BA4384406}" +Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "CatalogVbLib", "CatalogVbLib\CatalogVbLib.vbproj", "{44465926-240D-473F-90B8-786BA4384406}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{A3D50937-74F6-4DC8-8D89-B534B484C0F9}" EndProject @@ -19,10 +17,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MaddoShared", "MaddoShared\ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageCatalogParallel", "ImageCatalogParallel\ImageCatalogParallel.csproj", "{0F42DA5C-2788-48BD-BACA-01625C3CFFBB}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MaddoLibrary.Base.NET46", "MaddoLibrary\MaddoLibrary.Base.NET46\MaddoLibrary.Base.NET46.csproj", "{E93DAAE6-4AA9-4A45-AFB6-58209B3AD3C9}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MaddoLibrary.WPF.NET46", "MaddoLibrary\MaddoLibrary.WPF.NET46\MaddoLibrary.WPF.NET46.csproj", "{73DA19D7-196D-4B16-B610-93250978A607}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -65,16 +59,6 @@ Global {D27ACCF2-80FC-4DE8-AEB8-351FF076E6D5}.Release|x64.ActiveCfg = Release|x64 {D27ACCF2-80FC-4DE8-AEB8-351FF076E6D5}.Release|x64.Build.0 = Release|x64 {D27ACCF2-80FC-4DE8-AEB8-351FF076E6D5}.Release|x86.ActiveCfg = Release|Any CPU - {638DE501-CECA-4744-B293-7AE93CAEEB01}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {638DE501-CECA-4744-B293-7AE93CAEEB01}.Debug|Any CPU.Build.0 = Debug|Any CPU - {638DE501-CECA-4744-B293-7AE93CAEEB01}.Debug|x64.ActiveCfg = Debug|x64 - {638DE501-CECA-4744-B293-7AE93CAEEB01}.Debug|x64.Build.0 = Debug|x64 - {638DE501-CECA-4744-B293-7AE93CAEEB01}.Debug|x86.ActiveCfg = Debug|Any CPU - {638DE501-CECA-4744-B293-7AE93CAEEB01}.Release|Any CPU.ActiveCfg = Release|Any CPU - {638DE501-CECA-4744-B293-7AE93CAEEB01}.Release|Any CPU.Build.0 = Release|Any CPU - {638DE501-CECA-4744-B293-7AE93CAEEB01}.Release|x64.ActiveCfg = Release|x64 - {638DE501-CECA-4744-B293-7AE93CAEEB01}.Release|x64.Build.0 = Release|x64 - {638DE501-CECA-4744-B293-7AE93CAEEB01}.Release|x86.ActiveCfg = Release|Any CPU {44465926-240D-473F-90B8-786BA4384406}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {44465926-240D-473F-90B8-786BA4384406}.Debug|Any CPU.Build.0 = Debug|Any CPU {44465926-240D-473F-90B8-786BA4384406}.Debug|x64.ActiveCfg = Debug|x64 diff --git a/imagecatalog/ImageCatalog 2 - Backup.csproj b/imagecatalog/ImageCatalog 2 - Backup.csproj new file mode 100644 index 0000000..59e797c --- /dev/null +++ b/imagecatalog/ImageCatalog 2 - Backup.csproj @@ -0,0 +1,59 @@ + + + WinExe + net8.0-windows + enable + enable + true + False + 3.0.0.0 + 3.0.0.0 + 3.0.0-alpha.60+Branch.develop.Sha.388b9acf3220368b25e9a4d774323c73078ec17a + 3.0.0-alpha0060 + + + true + + + embedded + + + embedded + + + + MyApplicationCodeGenerator + Application.Designer.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + + + + + + + + all + + + All + + + + + True + True + Settings.settings + + + + \ No newline at end of file diff --git a/imagecatalog/ImageCatalog 2.csproj b/imagecatalog/ImageCatalog 2.csproj index a1d0050..0bc9428 100644 --- a/imagecatalog/ImageCatalog 2.csproj +++ b/imagecatalog/ImageCatalog 2.csproj @@ -6,11 +6,11 @@ enable true False - 3.0.0.0 - 3.0.0.0 - 3.0.0-alpha.58+Branch.develop.Sha.e701ca7f36678380b6354f2e112b7dbdda5f5865 - 3.0.0-alpha0058 + + true + + embedded @@ -41,9 +41,6 @@ all - - All - -- 2.52.0 From 2293c4f9e11e3421790cc20e73cf82245b61809c Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Mon, 14 Oct 2024 21:56:40 +0200 Subject: [PATCH 004/127] Updated project versions --- imagecatalog/ImageCatalog 2 - Backup.csproj | 4 ++-- imagecatalog/ImageCatalog 2.csproj | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/imagecatalog/ImageCatalog 2 - Backup.csproj b/imagecatalog/ImageCatalog 2 - Backup.csproj index 59e797c..cc78263 100644 --- a/imagecatalog/ImageCatalog 2 - Backup.csproj +++ b/imagecatalog/ImageCatalog 2 - Backup.csproj @@ -8,8 +8,8 @@ False 3.0.0.0 3.0.0.0 - 3.0.0-alpha.60+Branch.develop.Sha.388b9acf3220368b25e9a4d774323c73078ec17a - 3.0.0-alpha0060 + 3.0.0-alpha.61+Branch.develop.Sha.328d7da303ddd44d7fdae46c8d8b2ad82ad2a494 + 3.0.0-alpha0061 true diff --git a/imagecatalog/ImageCatalog 2.csproj b/imagecatalog/ImageCatalog 2.csproj index 0bc9428..1c26623 100644 --- a/imagecatalog/ImageCatalog 2.csproj +++ b/imagecatalog/ImageCatalog 2.csproj @@ -6,11 +6,14 @@ enable true False + 3.0.0.0 + 3.0.0.0 + 3.0.0-alpha.61+Branch.develop.Sha.328d7da303ddd44d7fdae46c8d8b2ad82ad2a494 + 3.0.0-alpha0061 + + + true - - true - - embedded -- 2.52.0 From 39a9baf5c618d8d79c75b89e2d5c4020939697f2 Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Mon, 14 Oct 2024 22:18:03 +0200 Subject: [PATCH 005/127] Added dependency injection --- imagecatalog/ImageCatalog 2.csproj | 5 +- imagecatalog/MainForm.cs | 7 +- .../My Project/Application.Designer.cs | 38 --- .../My Project/Application.Designer.vb | 38 --- imagecatalog/My Project/Application.myapp | 10 - .../MyNamespace.Dynamic.Designer.cs | 58 ---- .../MyNamespace.Static.1.Designer.cs | 305 ------------------ imagecatalog/My Project/Settings.Designer.cs | 26 -- imagecatalog/My Project/Settings.Designer.vb | 73 ----- imagecatalog/My Project/Settings.settings | 6 - imagecatalog/My Project/app.manifest | 22 -- imagecatalog/Program.cs | 34 ++ imagecatalog/Services/TestService.cs | 18 ++ 13 files changed, 59 insertions(+), 581 deletions(-) delete mode 100644 imagecatalog/My Project/Application.Designer.cs delete mode 100644 imagecatalog/My Project/Application.Designer.vb delete mode 100644 imagecatalog/My Project/Application.myapp delete mode 100644 imagecatalog/My Project/MyNamespace.Dynamic.Designer.cs delete mode 100644 imagecatalog/My Project/MyNamespace.Static.1.Designer.cs delete mode 100644 imagecatalog/My Project/Settings.Designer.cs delete mode 100644 imagecatalog/My Project/Settings.Designer.vb delete mode 100644 imagecatalog/My Project/Settings.settings delete mode 100644 imagecatalog/My Project/app.manifest create mode 100644 imagecatalog/Program.cs create mode 100644 imagecatalog/Services/TestService.cs diff --git a/imagecatalog/ImageCatalog 2.csproj b/imagecatalog/ImageCatalog 2.csproj index 1c26623..b782331 100644 --- a/imagecatalog/ImageCatalog 2.csproj +++ b/imagecatalog/ImageCatalog 2.csproj @@ -21,10 +21,6 @@ embedded - - MyApplicationCodeGenerator - Application.Designer.cs - SettingsSingleFileGenerator Settings.Designer.cs @@ -38,6 +34,7 @@ + diff --git a/imagecatalog/MainForm.cs b/imagecatalog/MainForm.cs index 52b720c..e074f8c 100644 --- a/imagecatalog/MainForm.cs +++ b/imagecatalog/MainForm.cs @@ -11,6 +11,7 @@ using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; using CatalogVbLib; +using ImageCatalog_2.Services; using MaddoShared; using Microsoft.VisualBasic; using Microsoft.VisualBasic.CompilerServices; @@ -22,8 +23,12 @@ namespace ImageCatalog public partial class MainForm { - public MainForm() + private readonly ITestService _service; + + public MainForm(ITestService testService) { + _service = testService; + InitializeComponent(); _Button3.Name = "Button3"; _Button2.Name = "Button2"; diff --git a/imagecatalog/My Project/Application.Designer.cs b/imagecatalog/My Project/Application.Designer.cs deleted file mode 100644 index 1c924b5..0000000 --- a/imagecatalog/My Project/Application.Designer.cs +++ /dev/null @@ -1,38 +0,0 @@ -// ------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -// ------------------------------------------------------------------------------ - -using System.Diagnostics; - -namespace ImageCatalog.My -{ - - // NOTE: This file is auto-generated; do not modify it directly. To make changes, - // or if you encounter build errors in this file, go to the Project Designer - // (go to Project Properties or double-click the My Project node in - // Solution Explorer), and make changes on the Application tab. - // - internal partial class MyApplication - { - [DebuggerStepThrough()] - public MyApplication() : base(Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows) - { - IsSingleInstance = false; - EnableVisualStyles = true; - SaveMySettingsOnExit = true; - ShutdownStyle = Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses; - } - - [DebuggerStepThrough()] - protected override void OnCreateMainForm() - { - MainForm = MyProject.Forms.MainForm; - } - } -} \ No newline at end of file diff --git a/imagecatalog/My Project/Application.Designer.vb b/imagecatalog/My Project/Application.Designer.vb deleted file mode 100644 index 24fc37f..0000000 --- a/imagecatalog/My Project/Application.Designer.vb +++ /dev/null @@ -1,38 +0,0 @@ -'------------------------------------------------------------------------------ -' -' This code was generated by a tool. -' Runtime Version:4.0.30319.42000 -' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. -' -'------------------------------------------------------------------------------ - -Option Strict Off -Option Explicit On - - -Namespace My - - 'NOTE: This file is auto-generated; do not modify it directly. To make changes, - ' or if you encounter build errors in this file, go to the Project Designer - ' (go to Project Properties or double-click the My Project node in - ' Solution Explorer), and make changes on the Application tab. - ' - Partial Friend Class MyApplication - - _ - Public Sub New() - MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows) - Me.IsSingleInstance = false - Me.EnableVisualStyles = true - Me.SaveMySettingsOnExit = true - Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses - End Sub - - _ - Protected Overrides Sub OnCreateMainForm() - Me.MainForm = Global.ImageCatalog.MainForm - End Sub - End Class -End Namespace diff --git a/imagecatalog/My Project/Application.myapp b/imagecatalog/My Project/Application.myapp deleted file mode 100644 index c9098c2..0000000 --- a/imagecatalog/My Project/Application.myapp +++ /dev/null @@ -1,10 +0,0 @@ - - - true - MainForm - false - 0 - true - 0 - true - \ No newline at end of file diff --git a/imagecatalog/My Project/MyNamespace.Dynamic.Designer.cs b/imagecatalog/My Project/MyNamespace.Dynamic.Designer.cs deleted file mode 100644 index 5f1eb17..0000000 --- a/imagecatalog/My Project/MyNamespace.Dynamic.Designer.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.ComponentModel; -using System.Diagnostics; - -namespace ImageCatalog.My -{ - internal static partial class MyProject - { - internal partial class MyForms - { - [EditorBrowsable(EditorBrowsableState.Never)] - public Form1 m_Form1; - - public Form1 Form1 - { - [DebuggerHidden] - get - { - m_Form1 = Create__Instance__(m_Form1); - return m_Form1; - } - - [DebuggerHidden] - set - { - if (ReferenceEquals(value, m_Form1)) - return; - if (value is object) - throw new ArgumentException("Property can only be set to Nothing"); - Dispose__Instance__(ref m_Form1); - } - } - - [EditorBrowsable(EditorBrowsableState.Never)] - public MainForm m_MainForm; - - public MainForm MainForm - { - [DebuggerHidden] - get - { - m_MainForm = Create__Instance__(m_MainForm); - return m_MainForm; - } - - [DebuggerHidden] - set - { - if (ReferenceEquals(value, m_MainForm)) - return; - if (value is object) - throw new ArgumentException("Property can only be set to Nothing"); - Dispose__Instance__(ref m_MainForm); - } - } - } - } -} \ No newline at end of file diff --git a/imagecatalog/My Project/MyNamespace.Static.1.Designer.cs b/imagecatalog/My Project/MyNamespace.Static.1.Designer.cs deleted file mode 100644 index 5212c44..0000000 --- a/imagecatalog/My Project/MyNamespace.Static.1.Designer.cs +++ /dev/null @@ -1,305 +0,0 @@ -// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections; -using System.Diagnostics; -using System.Windows.Forms; -using Microsoft.VisualBasic; - -/* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */ -/* TODO ERROR: Skipped IfDirectiveTrivia */ -/* TODO ERROR: Skipped DefineDirectiveTrivia *//* TODO ERROR: Skipped DefineDirectiveTrivia *//* TODO ERROR: Skipped DefineDirectiveTrivia *//* TODO ERROR: Skipped DefineDirectiveTrivia *//* TODO ERROR: Skipped DefineDirectiveTrivia */ -/* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */ -/* TODO ERROR: Skipped IfDirectiveTrivia */ -namespace ImageCatalog.My -{ - - /* TODO ERROR: Skipped IfDirectiveTrivia */ - [System.CodeDom.Compiler.GeneratedCode("MyTemplate", "11.0.0.0")] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - - /* TODO ERROR: Skipped IfDirectiveTrivia */ - internal partial class MyApplication : Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase - { - /* TODO ERROR: Skipped IfDirectiveTrivia */ - [STAThread()] - [DebuggerHidden()] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)] - internal static void Main(string[] Args) - { - try - { - Application.SetCompatibleTextRenderingDefault(UseCompatibleTextRendering); - } - finally - { - } - - MyProject.Application.Run(Args); - } - /* TODO ERROR: Skipped EndIfDirectiveTrivia */ - /* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */ - } - - /* TODO ERROR: Skipped EndIfDirectiveTrivia */ - /* TODO ERROR: Skipped IfDirectiveTrivia */ - [System.CodeDom.Compiler.GeneratedCode("MyTemplate", "11.0.0.0")] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - - /* TODO ERROR: Skipped IfDirectiveTrivia */ - internal partial class MyComputer : Microsoft.VisualBasic.Devices.Computer - { - /* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */ - [DebuggerHidden()] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public MyComputer() : base() - { - } - } - /* TODO ERROR: Skipped EndIfDirectiveTrivia */ - [HideModuleName()] - [System.CodeDom.Compiler.GeneratedCode("MyTemplate", "11.0.0.0")] - internal static partial class MyProject - { - - /* TODO ERROR: Skipped IfDirectiveTrivia */ - [System.ComponentModel.Design.HelpKeyword("My.Computer")] - internal static MyComputer Computer - { - [DebuggerHidden()] - get - { - return m_ComputerObjectProvider.GetInstance; - } - } - - private readonly static ThreadSafeObjectProvider m_ComputerObjectProvider = new ThreadSafeObjectProvider(); - /* TODO ERROR: Skipped EndIfDirectiveTrivia */ - /* TODO ERROR: Skipped IfDirectiveTrivia */ - [System.ComponentModel.Design.HelpKeyword("My.Application")] - internal static MyApplication Application - { - [DebuggerHidden()] - get - { - return m_AppObjectProvider.GetInstance; - } - } - - private readonly static ThreadSafeObjectProvider m_AppObjectProvider = new ThreadSafeObjectProvider(); - /* TODO ERROR: Skipped EndIfDirectiveTrivia */ - /* TODO ERROR: Skipped IfDirectiveTrivia */ - [System.ComponentModel.Design.HelpKeyword("My.User")] - internal static Microsoft.VisualBasic.ApplicationServices.User User - { - [DebuggerHidden()] - get - { - return m_UserObjectProvider.GetInstance; - } - } - - private readonly static ThreadSafeObjectProvider m_UserObjectProvider = new ThreadSafeObjectProvider(); - /* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */ - /* TODO ERROR: Skipped IfDirectiveTrivia */ - /* TODO ERROR: Skipped DefineDirectiveTrivia */ - [System.ComponentModel.Design.HelpKeyword("My.Forms")] - internal static MyForms Forms - { - [DebuggerHidden()] - get - { - return m_MyFormsObjectProvider.GetInstance; - } - } - - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - [MyGroupCollection("System.Windows.Forms.Form", "Create__Instance__", "Dispose__Instance__", "My.MyProject.Forms")] - internal sealed partial class MyForms - { - [DebuggerHidden()] - private static T Create__Instance__(T Instance) where T : Form, new() - { - if (Instance is null || Instance.IsDisposed) - { - if (m_FormBeingCreated is object) - { - if (m_FormBeingCreated.ContainsKey(typeof(T)) == true) - { - throw new InvalidOperationException(Microsoft.VisualBasic.CompilerServices.Utils.GetResourceString("WinForms_RecursiveFormCreate")); - } - } - else - { - m_FormBeingCreated = new Hashtable(); - } - - m_FormBeingCreated.Add(typeof(T), null); - try - { - return new T(); - } - catch (System.Reflection.TargetInvocationException ex) when (ex.InnerException is object) - { - string BetterMessage = Microsoft.VisualBasic.CompilerServices.Utils.GetResourceString("WinForms_SeeInnerException", ex.InnerException.Message); - throw new InvalidOperationException(BetterMessage, ex.InnerException); - } - finally - { - m_FormBeingCreated.Remove(typeof(T)); - } - } - else - { - return Instance; - } - } - - [DebuggerHidden()] - private void Dispose__Instance__(ref T instance) where T : Form - { - instance.Dispose(); - instance = null; - } - - [DebuggerHidden()] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public MyForms() : base() - { - } - - [ThreadStatic()] - private static Hashtable m_FormBeingCreated; - - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override bool Equals(object o) - { - return base.Equals(o); - } - - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override int GetHashCode() - { - return base.GetHashCode(); - } - - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - internal new Type GetType() - { - return typeof(MyForms); - } - - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public override string ToString() - { - return base.ToString(); - } - } - - private static ThreadSafeObjectProvider m_MyFormsObjectProvider = new ThreadSafeObjectProvider(); - - /* TODO ERROR: Skipped EndIfDirectiveTrivia */ - /* TODO ERROR: Skipped IfDirectiveTrivia */ - [System.ComponentModel.Design.HelpKeyword("My.WebServices")] - internal static MyWebServices WebServices - { - [DebuggerHidden()] - get - { - return m_MyWebServicesObjectProvider.GetInstance; - } - } - - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - [MyGroupCollection("System.Web.Services.Protocols.SoapHttpClientProtocol", "Create__Instance__", "Dispose__Instance__", "")] - internal sealed class MyWebServices - { - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - [DebuggerHidden()] - public override bool Equals(object o) - { - return base.Equals(o); - } - - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - [DebuggerHidden()] - public override int GetHashCode() - { - return base.GetHashCode(); - } - - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - [DebuggerHidden()] - internal new Type GetType() - { - return typeof(MyWebServices); - } - - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - [DebuggerHidden()] - public override string ToString() - { - return base.ToString(); - } - - [DebuggerHidden()] - private static T Create__Instance__(T instance) where T : new() - { - if (instance is null) - { - return new T(); - } - else - { - return instance; - } - } - - [DebuggerHidden()] - private void Dispose__Instance__(ref T instance) - { - instance = default; - } - - [DebuggerHidden()] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public MyWebServices() : base() - { - } - } - - private readonly static ThreadSafeObjectProvider m_MyWebServicesObjectProvider = new ThreadSafeObjectProvider(); - /* TODO ERROR: Skipped EndIfDirectiveTrivia */ - /* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */ - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - [System.Runtime.InteropServices.ComVisible(false)] - internal sealed class ThreadSafeObjectProvider where T : new() - { - internal T GetInstance - { - /* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElseDirectiveTrivia */ - [DebuggerHidden()] - get - { - if (m_ThreadStaticValue is null) - m_ThreadStaticValue = new T(); - return m_ThreadStaticValue; - } - /* TODO ERROR: Skipped EndIfDirectiveTrivia */ - } - - [DebuggerHidden()] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public ThreadSafeObjectProvider() : base() - { - } - - /* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElseDirectiveTrivia */ - [System.Runtime.CompilerServices.CompilerGenerated()] - [ThreadStatic()] - private static T m_ThreadStaticValue; - /* TODO ERROR: Skipped EndIfDirectiveTrivia */ - } - } -} -/* TODO ERROR: Skipped EndIfDirectiveTrivia */ \ No newline at end of file diff --git a/imagecatalog/My Project/Settings.Designer.cs b/imagecatalog/My Project/Settings.Designer.cs deleted file mode 100644 index 21716e7..0000000 --- a/imagecatalog/My Project/Settings.Designer.cs +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace ImageCatalog.My { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} diff --git a/imagecatalog/My Project/Settings.Designer.vb b/imagecatalog/My Project/Settings.Designer.vb deleted file mode 100644 index 75ffa5f..0000000 --- a/imagecatalog/My Project/Settings.Designer.vb +++ /dev/null @@ -1,73 +0,0 @@ -'------------------------------------------------------------------------------ -' -' This code was generated by a tool. -' Runtime Version:4.0.30319.42000 -' -' Changes to this file may cause incorrect behavior and will be lost if -' the code is regenerated. -' -'------------------------------------------------------------------------------ - -Option Strict Off -Option Explicit On - - -Namespace My - - _ - Partial Friend NotInheritable Class MySettings - Inherits Global.System.Configuration.ApplicationSettingsBase - - Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings) - -#Region "My.Settings Auto-Save Functionality" -#If _MyType = "WindowsForms" Then - Private Shared addedHandler As Boolean - - Private Shared addedHandlerLockObject As New Object - - _ - Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs) - If My.Application.SaveMySettingsOnExit Then - My.Settings.Save() - End If - End Sub -#End If -#End Region - - Public Shared ReadOnly Property [Default]() As MySettings - Get - -#If _MyType = "WindowsForms" Then - If Not addedHandler Then - SyncLock addedHandlerLockObject - If Not addedHandler Then - AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings - addedHandler = True - End If - End SyncLock - End If -#End If - Return defaultInstance - End Get - End Property - End Class -End Namespace - -Namespace My - - _ - Friend Module MySettingsProperty - - _ - Friend ReadOnly Property Settings() As Global.ImageCatalog.My.MySettings - Get - Return Global.ImageCatalog.My.MySettings.Default - End Get - End Property - End Module -End Namespace diff --git a/imagecatalog/My Project/Settings.settings b/imagecatalog/My Project/Settings.settings deleted file mode 100644 index 392df0a..0000000 --- a/imagecatalog/My Project/Settings.settings +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/imagecatalog/My Project/app.manifest b/imagecatalog/My Project/app.manifest deleted file mode 100644 index 4c249cd..0000000 --- a/imagecatalog/My Project/app.manifest +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - diff --git a/imagecatalog/Program.cs b/imagecatalog/Program.cs new file mode 100644 index 0000000..9d7da28 --- /dev/null +++ b/imagecatalog/Program.cs @@ -0,0 +1,34 @@ +using ImageCatalog; +using ImageCatalog_2.Services; +using Microsoft.Extensions.DependencyInjection; + +namespace ImageCatalog_2 +{ + static class Program + { + public static IServiceProvider ServiceProvider { get; private set; } + [STAThread] + static void Main() + { + Application.SetHighDpiMode(HighDpiMode.SystemAware); + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + + var serviceCollection = new ServiceCollection(); + ConfigureServices(serviceCollection); + + ServiceProvider = serviceCollection.BuildServiceProvider(); + + Application.Run(ServiceProvider.GetRequiredService()); + } + + private static void ConfigureServices(ServiceCollection services) + { + // Register your services here + services.AddTransient(); + + // Register your forms + services.AddTransient(); + } + } +} diff --git a/imagecatalog/Services/TestService.cs b/imagecatalog/Services/TestService.cs new file mode 100644 index 0000000..c7bcd1d --- /dev/null +++ b/imagecatalog/Services/TestService.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ImageCatalog_2.Services +{ + public interface ITestService + { + + } + + public class TestService : ITestService + { + + } +} -- 2.52.0 From a1c950734adb39017d1e1d8d7041e28cf6c0a527 Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Mon, 14 Oct 2024 22:18:26 +0200 Subject: [PATCH 006/127] Updated version --- imagecatalog/ImageCatalog 2 - Backup.csproj | 4 ++-- imagecatalog/ImageCatalog 2.csproj | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/imagecatalog/ImageCatalog 2 - Backup.csproj b/imagecatalog/ImageCatalog 2 - Backup.csproj index cc78263..c77aca9 100644 --- a/imagecatalog/ImageCatalog 2 - Backup.csproj +++ b/imagecatalog/ImageCatalog 2 - Backup.csproj @@ -8,8 +8,8 @@ False 3.0.0.0 3.0.0.0 - 3.0.0-alpha.61+Branch.develop.Sha.328d7da303ddd44d7fdae46c8d8b2ad82ad2a494 - 3.0.0-alpha0061 + 3.0.0-alpha.63+Branch.develop.Sha.39a9baf5c618d8d79c75b89e2d5c4020939697f2 + 3.0.0-alpha0063 true diff --git a/imagecatalog/ImageCatalog 2.csproj b/imagecatalog/ImageCatalog 2.csproj index b782331..021f879 100644 --- a/imagecatalog/ImageCatalog 2.csproj +++ b/imagecatalog/ImageCatalog 2.csproj @@ -8,8 +8,8 @@ False 3.0.0.0 3.0.0.0 - 3.0.0-alpha.61+Branch.develop.Sha.328d7da303ddd44d7fdae46c8d8b2ad82ad2a494 - 3.0.0-alpha0061 + 3.0.0-alpha.63+Branch.develop.Sha.39a9baf5c618d8d79c75b89e2d5c4020939697f2 + 3.0.0-alpha0063 true -- 2.52.0 From efbc9f91dbadab60c1184a72294aa8f78998ee0a Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Mon, 14 Oct 2024 22:55:52 +0200 Subject: [PATCH 007/127] Added viewmodel --- imagecatalog/DataModel.cs | 37 + imagecatalog/MainForm.Designer.cs | 2600 +++++++++-------- imagecatalog/MainForm.cs | 72 +- imagecatalog/MainForm.resx | 63 +- .../DataSources/DataModel.datasource | 10 + imagecatalog/ViewModelBase.cs | 26 + 6 files changed, 1541 insertions(+), 1267 deletions(-) create mode 100644 imagecatalog/DataModel.cs create mode 100644 imagecatalog/Properties/DataSources/DataModel.datasource create mode 100644 imagecatalog/ViewModelBase.cs diff --git a/imagecatalog/DataModel.cs b/imagecatalog/DataModel.cs new file mode 100644 index 0000000..99d7dfd --- /dev/null +++ b/imagecatalog/DataModel.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ImageCatalog_2 +{ + public class DataModel : ViewModelBase + { + + private string _sourcePath; + + public string SourcePath + { + get => _sourcePath; + set + { + _sourcePath = value; + NotifyPropertyChanged(); + } + } + + private string _destinationPath; + public string DestinationPath + { + get => _destinationPath; + set + { + _destinationPath = value; + NotifyPropertyChanged(); + } + } + + } +} diff --git a/imagecatalog/MainForm.Designer.cs b/imagecatalog/MainForm.Designer.cs index ee6590c..a98ad26 100644 --- a/imagecatalog/MainForm.Designer.cs +++ b/imagecatalog/MainForm.Designer.cs @@ -37,1633 +37,1804 @@ namespace ImageCatalog [DebuggerStepThrough()] private void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - this.ProgressBar1 = new System.Windows.Forms.ProgressBar(); - this.CheckBox22 = new System.Windows.Forms.CheckBox(); - this.Label43 = new System.Windows.Forms.Label(); - this.TabControl1 = new System.Windows.Forms.TabControl(); - this.TabPage5 = new System.Windows.Forms.TabPage(); - this.GroupBox11 = new System.Windows.Forms.GroupBox(); - this.Panel3 = new System.Windows.Forms.Panel(); - this.rdbNuovoMetodo = new System.Windows.Forms.RadioButton(); - this.rdbVecchioMetodo = new System.Windows.Forms.RadioButton(); - this.Label8 = new System.Windows.Forms.Label(); - this.TextBox8 = new System.Windows.Forms.TextBox(); - this.Label7 = new System.Windows.Forms.Label(); - this.TextBox7 = new System.Windows.Forms.TextBox(); - this.GroupBox3 = new System.Windows.Forms.GroupBox(); - this.chkAggiornaSottodirectory = new System.Windows.Forms.CheckBox(); - this._Button3 = new System.Windows.Forms.Button(); - this._Button2 = new System.Windows.Forms.Button(); - this.Label1 = new System.Windows.Forms.Label(); - this.Label2 = new System.Windows.Forms.Label(); - this.txtSorgente = new System.Windows.Forms.TextBox(); - this.txtDestinazione = new System.Windows.Forms.TextBox(); - this.GroupBox8 = new System.Windows.Forms.GroupBox(); - this.rdbNumFiles = new System.Windows.Forms.RadioButton(); - this.rdbNumProgressiva = new System.Windows.Forms.RadioButton(); - this.txtCifreContatore = new System.Windows.Forms.TextBox(); - this.Label34 = new System.Windows.Forms.Label(); - this.txtSuffissoCartelle = new System.Windows.Forms.TextBox(); - this.Label33 = new System.Windows.Forms.Label(); - this.Label31 = new System.Windows.Forms.Label(); - this.chkCreaSottocartelle = new System.Windows.Forms.CheckBox(); - this.txtFilePerCartella = new System.Windows.Forms.TextBox(); - this.Label32 = new System.Windows.Forms.Label(); - this.GroupBox7 = new System.Windows.Forms.GroupBox(); - this.chkSovrascriviFile = new System.Windows.Forms.CheckBox(); - this.chkRotazioneAutomatica = new System.Windows.Forms.CheckBox(); - this.chkForzaJpg = new System.Windows.Forms.CheckBox(); - this.TabPage3 = new System.Windows.Forms.TabPage(); - this.GroupBox10 = new System.Windows.Forms.GroupBox(); - this.Label42 = new System.Windows.Forms.Label(); - this.Label41 = new System.Windows.Forms.Label(); - this.TextBox31 = new System.Windows.Forms.TextBox(); - this.TextBox30 = new System.Windows.Forms.TextBox(); - this.GroupBox9 = new System.Windows.Forms.GroupBox(); - this.CheckBox17 = new System.Windows.Forms.CheckBox(); - this.CheckBox16 = new System.Windows.Forms.CheckBox(); - this.GroupBox5 = new System.Windows.Forms.GroupBox(); - this.TextBox34 = new System.Windows.Forms.TextBox(); - this._Button8 = new System.Windows.Forms.Button(); - this.Label36 = new System.Windows.Forms.Label(); - this.TextBox25 = new System.Windows.Forms.TextBox(); - this.Label35 = new System.Windows.Forms.Label(); - this.ComboBox3 = new System.Windows.Forms.ComboBox(); - this.TextBox11 = new System.Windows.Forms.TextBox(); - this.Label12 = new System.Windows.Forms.Label(); - this.Label11 = new System.Windows.Forms.Label(); - this.CheckBox3 = new System.Windows.Forms.CheckBox(); - this.GroupBox4 = new System.Windows.Forms.GroupBox(); - this.Label40 = new System.Windows.Forms.Label(); - this.TextBox29 = new System.Windows.Forms.TextBox(); - this.TextBox18 = new System.Windows.Forms.TextBox(); - this.Label26 = new System.Windows.Forms.Label(); - this.DateTimePicker1 = new System.Windows.Forms.DateTimePicker(); - this.CheckBox8 = new System.Windows.Forms.CheckBox(); - this.TextBox9 = new System.Windows.Forms.TextBox(); - this.CheckBox7 = new System.Windows.Forms.CheckBox(); - this.Label4 = new System.Windows.Forms.Label(); - this.TextBox4 = new System.Windows.Forms.TextBox(); - this.Label9 = new System.Windows.Forms.Label(); - this.Label13 = new System.Windows.Forms.Label(); - this.ComboBox1 = new System.Windows.Forms.ComboBox(); - this.ComboBox2 = new System.Windows.Forms.ComboBox(); - this.Label14 = new System.Windows.Forms.Label(); - this.TextBox12 = new System.Windows.Forms.TextBox(); - this.Label15 = new System.Windows.Forms.Label(); - this.TabPage2 = new System.Windows.Forms.TabPage(); - this.GroupBox2 = new System.Windows.Forms.GroupBox(); - this.Label45 = new System.Windows.Forms.Label(); - this.TextBox32 = new System.Windows.Forms.TextBox(); - this.TextBox26 = new System.Windows.Forms.TextBox(); - this.Label37 = new System.Windows.Forms.Label(); - this.Label38 = new System.Windows.Forms.Label(); - this.TextBox27 = new System.Windows.Forms.TextBox(); - this.Label39 = new System.Windows.Forms.Label(); - this.TextBox28 = new System.Windows.Forms.TextBox(); - this.CheckBox15 = new System.Windows.Forms.CheckBox(); - this.TabPage1 = new System.Windows.Forms.TabPage(); - this.Panel1 = new System.Windows.Forms.Panel(); - this._CheckBox18 = new System.Windows.Forms.CheckBox(); - this._CheckBox4 = new System.Windows.Forms.CheckBox(); - this._CheckBox12 = new System.Windows.Forms.CheckBox(); - this.GroupBox1 = new System.Windows.Forms.GroupBox(); - this.Label46 = new System.Windows.Forms.Label(); - this.TextBox33 = new System.Windows.Forms.TextBox(); - this.Panel2 = new System.Windows.Forms.Panel(); - this.RadioButton3 = new System.Windows.Forms.RadioButton(); - this.RadioButton7 = new System.Windows.Forms.RadioButton(); - this.RadioButton4 = new System.Windows.Forms.RadioButton(); - this.RadioButton6 = new System.Windows.Forms.RadioButton(); - this.RadioButton5 = new System.Windows.Forms.RadioButton(); - this.Label5 = new System.Windows.Forms.Label(); - this.TextBox5 = new System.Windows.Forms.TextBox(); - this.Label6 = new System.Windows.Forms.Label(); - this.TextBox6 = new System.Windows.Forms.TextBox(); - this.Label3 = new System.Windows.Forms.Label(); - this.TextBox3 = new System.Windows.Forms.TextBox(); - this.CheckBox1 = new System.Windows.Forms.CheckBox(); - this.TabPage4 = new System.Windows.Forms.TabPage(); - this.GroupBox6 = new System.Windows.Forms.GroupBox(); - this.PictureBox2 = new System.Windows.Forms.PictureBox(); - this._PictureBox1 = new System.Windows.Forms.PictureBox(); - this.ComboBox5 = new System.Windows.Forms.ComboBox(); - this.ComboBox4 = new System.Windows.Forms.ComboBox(); - this.TextBox19 = new System.Windows.Forms.TextBox(); - this.Label28 = new System.Windows.Forms.Label(); - this.CheckBox5 = new System.Windows.Forms.CheckBox(); - this.TextBox15 = new System.Windows.Forms.TextBox(); - this.TextBox14 = new System.Windows.Forms.TextBox(); - this.Label25 = new System.Windows.Forms.Label(); - this.TextBox16 = new System.Windows.Forms.TextBox(); - this.Label24 = new System.Windows.Forms.Label(); - this.Label22 = new System.Windows.Forms.Label(); - this.Label23 = new System.Windows.Forms.Label(); - this._Button4 = new System.Windows.Forms.Button(); - this.TextBox10 = new System.Windows.Forms.TextBox(); - this.Label29 = new System.Windows.Forms.Label(); - this.Label30 = new System.Windows.Forms.Label(); - this.PictureBox3 = new System.Windows.Forms.PictureBox(); - this._Label27 = new System.Windows.Forms.Label(); - this._Button7 = new System.Windows.Forms.Button(); - this._Button5 = new System.Windows.Forms.Button(); - this.Label20 = new System.Windows.Forms.Label(); - this.Label19 = new System.Windows.Forms.Label(); - this.Label18 = new System.Windows.Forms.Label(); - this.lblFotoTotaliNum = new System.Windows.Forms.Label(); - this.Label10 = new System.Windows.Forms.Label(); - this._Button6 = new System.Windows.Forms.Button(); - this._btnCreaCatalogoAsync = new System.Windows.Forms.Button(); - this.timer1 = new System.Windows.Forms.Timer(this.components); - this.TabControl1.SuspendLayout(); - this.TabPage5.SuspendLayout(); - this.GroupBox11.SuspendLayout(); - this.Panel3.SuspendLayout(); - this.GroupBox3.SuspendLayout(); - this.GroupBox8.SuspendLayout(); - this.GroupBox7.SuspendLayout(); - this.TabPage3.SuspendLayout(); - this.GroupBox10.SuspendLayout(); - this.GroupBox9.SuspendLayout(); - this.GroupBox5.SuspendLayout(); - this.GroupBox4.SuspendLayout(); - this.TabPage2.SuspendLayout(); - this.GroupBox2.SuspendLayout(); - this.TabPage1.SuspendLayout(); - this.Panel1.SuspendLayout(); - this.GroupBox1.SuspendLayout(); - this.Panel2.SuspendLayout(); - this.TabPage4.SuspendLayout(); - this.GroupBox6.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.PictureBox2)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this._PictureBox1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.PictureBox3)).BeginInit(); - this.SuspendLayout(); + components = new System.ComponentModel.Container(); + ProgressBar1 = new ProgressBar(); + CheckBox22 = new CheckBox(); + Label43 = new Label(); + TabControl1 = new TabControl(); + TabPage5 = new TabPage(); + GroupBox11 = new GroupBox(); + Panel3 = new Panel(); + rdbNuovoMetodo = new RadioButton(); + rdbVecchioMetodo = new RadioButton(); + Label8 = new Label(); + TextBox8 = new TextBox(); + Label7 = new Label(); + TextBox7 = new TextBox(); + GroupBox3 = new GroupBox(); + chkAggiornaSottodirectory = new CheckBox(); + _Button3 = new Button(); + _Button2 = new Button(); + Label1 = new Label(); + Label2 = new Label(); + txtSorgente = new TextBox(); + bindingSource1 = new BindingSource(components); + dataModelBindingSource = new BindingSource(components); + txtDestinazione = new TextBox(); + GroupBox8 = new GroupBox(); + rdbNumFiles = new RadioButton(); + rdbNumProgressiva = new RadioButton(); + txtCifreContatore = new TextBox(); + Label34 = new Label(); + txtSuffissoCartelle = new TextBox(); + Label33 = new Label(); + Label31 = new Label(); + chkCreaSottocartelle = new CheckBox(); + txtFilePerCartella = new TextBox(); + Label32 = new Label(); + GroupBox7 = new GroupBox(); + chkSovrascriviFile = new CheckBox(); + chkRotazioneAutomatica = new CheckBox(); + chkForzaJpg = new CheckBox(); + TabPage3 = new TabPage(); + GroupBox10 = new GroupBox(); + Label42 = new Label(); + Label41 = new Label(); + TextBox31 = new TextBox(); + TextBox30 = new TextBox(); + GroupBox9 = new GroupBox(); + CheckBox17 = new CheckBox(); + CheckBox16 = new CheckBox(); + GroupBox5 = new GroupBox(); + TextBox34 = new TextBox(); + _Button8 = new Button(); + Label36 = new Label(); + TextBox25 = new TextBox(); + Label35 = new Label(); + ComboBox3 = new ComboBox(); + TextBox11 = new TextBox(); + Label12 = new Label(); + Label11 = new Label(); + CheckBox3 = new CheckBox(); + GroupBox4 = new GroupBox(); + Label40 = new Label(); + TextBox29 = new TextBox(); + TextBox18 = new TextBox(); + Label26 = new Label(); + DateTimePicker1 = new DateTimePicker(); + CheckBox8 = new CheckBox(); + TextBox9 = new TextBox(); + CheckBox7 = new CheckBox(); + Label4 = new Label(); + TextBox4 = new TextBox(); + Label9 = new Label(); + Label13 = new Label(); + ComboBox1 = new ComboBox(); + ComboBox2 = new ComboBox(); + Label14 = new Label(); + TextBox12 = new TextBox(); + Label15 = new Label(); + TabPage2 = new TabPage(); + GroupBox2 = new GroupBox(); + Label45 = new Label(); + TextBox32 = new TextBox(); + TextBox26 = new TextBox(); + Label37 = new Label(); + Label38 = new Label(); + TextBox27 = new TextBox(); + Label39 = new Label(); + TextBox28 = new TextBox(); + CheckBox15 = new CheckBox(); + TabPage1 = new TabPage(); + Panel1 = new Panel(); + _CheckBox18 = new CheckBox(); + _CheckBox4 = new CheckBox(); + _CheckBox12 = new CheckBox(); + GroupBox1 = new GroupBox(); + Label46 = new Label(); + TextBox33 = new TextBox(); + Panel2 = new Panel(); + RadioButton3 = new RadioButton(); + RadioButton7 = new RadioButton(); + RadioButton4 = new RadioButton(); + RadioButton6 = new RadioButton(); + RadioButton5 = new RadioButton(); + Label5 = new Label(); + TextBox5 = new TextBox(); + Label6 = new Label(); + TextBox6 = new TextBox(); + Label3 = new Label(); + TextBox3 = new TextBox(); + CheckBox1 = new CheckBox(); + TabPage4 = new TabPage(); + GroupBox6 = new GroupBox(); + PictureBox2 = new PictureBox(); + _PictureBox1 = new PictureBox(); + ComboBox5 = new ComboBox(); + ComboBox4 = new ComboBox(); + TextBox19 = new TextBox(); + Label28 = new Label(); + CheckBox5 = new CheckBox(); + TextBox15 = new TextBox(); + TextBox14 = new TextBox(); + Label25 = new Label(); + TextBox16 = new TextBox(); + Label24 = new Label(); + Label22 = new Label(); + Label23 = new Label(); + _Button4 = new Button(); + TextBox10 = new TextBox(); + Label29 = new Label(); + Label30 = new Label(); + PictureBox3 = new PictureBox(); + _Label27 = new Label(); + _Button7 = new Button(); + _Button5 = new Button(); + Label20 = new Label(); + Label19 = new Label(); + Label18 = new Label(); + lblFotoTotaliNum = new Label(); + Label10 = new Label(); + _Button6 = new Button(); + _btnCreaCatalogoAsync = new Button(); + timer1 = new System.Windows.Forms.Timer(components); + dataModelBindingSource1 = new BindingSource(components); + TabControl1.SuspendLayout(); + TabPage5.SuspendLayout(); + GroupBox11.SuspendLayout(); + Panel3.SuspendLayout(); + GroupBox3.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)bindingSource1).BeginInit(); + ((System.ComponentModel.ISupportInitialize)dataModelBindingSource).BeginInit(); + GroupBox8.SuspendLayout(); + GroupBox7.SuspendLayout(); + TabPage3.SuspendLayout(); + GroupBox10.SuspendLayout(); + GroupBox9.SuspendLayout(); + GroupBox5.SuspendLayout(); + GroupBox4.SuspendLayout(); + TabPage2.SuspendLayout(); + GroupBox2.SuspendLayout(); + TabPage1.SuspendLayout(); + Panel1.SuspendLayout(); + GroupBox1.SuspendLayout(); + Panel2.SuspendLayout(); + TabPage4.SuspendLayout(); + GroupBox6.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)PictureBox2).BeginInit(); + ((System.ComponentModel.ISupportInitialize)_PictureBox1).BeginInit(); + ((System.ComponentModel.ISupportInitialize)PictureBox3).BeginInit(); + ((System.ComponentModel.ISupportInitialize)dataModelBindingSource1).BeginInit(); + SuspendLayout(); // // ProgressBar1 // - this.ProgressBar1.Location = new System.Drawing.Point(539, 243); - this.ProgressBar1.Name = "ProgressBar1"; - this.ProgressBar1.Size = new System.Drawing.Size(192, 23); - this.ProgressBar1.TabIndex = 67; + ProgressBar1.Location = new Point(719, 374); + ProgressBar1.Margin = new Padding(4, 5, 4, 5); + ProgressBar1.Name = "ProgressBar1"; + ProgressBar1.Size = new Size(256, 35); + ProgressBar1.TabIndex = 67; // // CheckBox22 // - this.CheckBox22.AutoSize = true; - this.CheckBox22.Location = new System.Drawing.Point(539, 358); - this.CheckBox22.Name = "CheckBox22"; - this.CheckBox22.Size = new System.Drawing.Size(104, 17); - this.CheckBox22.TabIndex = 65; - this.CheckBox22.Text = "Arresta il sistema"; - this.CheckBox22.UseVisualStyleBackColor = true; + CheckBox22.AutoSize = true; + CheckBox22.Location = new Point(719, 551); + CheckBox22.Margin = new Padding(4, 5, 4, 5); + CheckBox22.Name = "CheckBox22"; + CheckBox22.Size = new Size(144, 24); + CheckBox22.TabIndex = 65; + CheckBox22.Text = "Arresta il sistema"; + CheckBox22.UseVisualStyleBackColor = true; // // Label43 // - this.Label43.AutoSize = true; - this.Label43.Location = new System.Drawing.Point(536, 342); - this.Label43.Name = "Label43"; - this.Label43.Size = new System.Drawing.Size(25, 13); - this.Label43.TabIndex = 64; - this.Label43.Text = "000"; - this.Label43.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + Label43.AutoSize = true; + Label43.Location = new Point(715, 526); + Label43.Margin = new Padding(4, 0, 4, 0); + Label43.Name = "Label43"; + Label43.Size = new Size(33, 20); + Label43.TabIndex = 64; + Label43.Text = "000"; + Label43.TextAlign = ContentAlignment.MiddleLeft; // // TabControl1 // - this.TabControl1.Controls.Add(this.TabPage5); - this.TabControl1.Controls.Add(this.TabPage3); - this.TabControl1.Controls.Add(this.TabPage2); - this.TabControl1.Controls.Add(this.TabPage1); - this.TabControl1.Controls.Add(this.TabPage4); - this.TabControl1.Location = new System.Drawing.Point(12, 12); - this.TabControl1.Name = "TabControl1"; - this.TabControl1.SelectedIndex = 0; - this.TabControl1.Size = new System.Drawing.Size(521, 377); - this.TabControl1.TabIndex = 63; + TabControl1.Controls.Add(TabPage5); + TabControl1.Controls.Add(TabPage3); + TabControl1.Controls.Add(TabPage2); + TabControl1.Controls.Add(TabPage1); + TabControl1.Controls.Add(TabPage4); + TabControl1.Location = new Point(16, 18); + TabControl1.Margin = new Padding(4, 5, 4, 5); + TabControl1.Name = "TabControl1"; + TabControl1.SelectedIndex = 0; + TabControl1.Size = new Size(695, 580); + TabControl1.TabIndex = 63; // // TabPage5 // - this.TabPage5.Controls.Add(this.GroupBox11); - this.TabPage5.Controls.Add(this.GroupBox3); - this.TabPage5.Controls.Add(this.GroupBox8); - this.TabPage5.Controls.Add(this.GroupBox7); - this.TabPage5.Location = new System.Drawing.Point(4, 22); - this.TabPage5.Name = "TabPage5"; - this.TabPage5.Padding = new System.Windows.Forms.Padding(3); - this.TabPage5.Size = new System.Drawing.Size(513, 351); - this.TabPage5.TabIndex = 4; - this.TabPage5.Text = "Generale"; - this.TabPage5.UseVisualStyleBackColor = true; + TabPage5.Controls.Add(GroupBox11); + TabPage5.Controls.Add(GroupBox3); + TabPage5.Controls.Add(GroupBox8); + TabPage5.Controls.Add(GroupBox7); + TabPage5.Location = new Point(4, 29); + TabPage5.Margin = new Padding(4, 5, 4, 5); + TabPage5.Name = "TabPage5"; + TabPage5.Padding = new Padding(4, 5, 4, 5); + TabPage5.Size = new Size(687, 547); + TabPage5.TabIndex = 4; + TabPage5.Text = "Generale"; + TabPage5.UseVisualStyleBackColor = true; // // GroupBox11 // - this.GroupBox11.Controls.Add(this.Panel3); - this.GroupBox11.Controls.Add(this.Label8); - this.GroupBox11.Controls.Add(this.TextBox8); - this.GroupBox11.Controls.Add(this.Label7); - this.GroupBox11.Controls.Add(this.TextBox7); - this.GroupBox11.Location = new System.Drawing.Point(7, 209); - this.GroupBox11.Name = "GroupBox11"; - this.GroupBox11.Size = new System.Drawing.Size(191, 132); - this.GroupBox11.TabIndex = 48; - this.GroupBox11.TabStop = false; - this.GroupBox11.Text = "Avanzate (ATTENZIONE)"; + GroupBox11.Controls.Add(Panel3); + GroupBox11.Controls.Add(Label8); + GroupBox11.Controls.Add(TextBox8); + GroupBox11.Controls.Add(Label7); + GroupBox11.Controls.Add(TextBox7); + GroupBox11.Location = new Point(9, 322); + GroupBox11.Margin = new Padding(4, 5, 4, 5); + GroupBox11.Name = "GroupBox11"; + GroupBox11.Padding = new Padding(4, 5, 4, 5); + GroupBox11.Size = new Size(255, 203); + GroupBox11.TabIndex = 48; + GroupBox11.TabStop = false; + GroupBox11.Text = "Avanzate (ATTENZIONE)"; // // Panel3 // - this.Panel3.Controls.Add(this.rdbNuovoMetodo); - this.Panel3.Controls.Add(this.rdbVecchioMetodo); - this.Panel3.Location = new System.Drawing.Point(7, 73); - this.Panel3.Name = "Panel3"; - this.Panel3.Size = new System.Drawing.Size(178, 53); - this.Panel3.TabIndex = 4; + Panel3.Controls.Add(rdbNuovoMetodo); + Panel3.Controls.Add(rdbVecchioMetodo); + Panel3.Location = new Point(9, 112); + Panel3.Margin = new Padding(4, 5, 4, 5); + Panel3.Name = "Panel3"; + Panel3.Size = new Size(237, 82); + Panel3.TabIndex = 4; // // rdbNuovoMetodo // - this.rdbNuovoMetodo.AutoSize = true; - this.rdbNuovoMetodo.Checked = true; - this.rdbNuovoMetodo.Location = new System.Drawing.Point(8, 28); - this.rdbNuovoMetodo.Name = "rdbNuovoMetodo"; - this.rdbNuovoMetodo.Size = new System.Drawing.Size(65, 17); - this.rdbNuovoMetodo.TabIndex = 1; - this.rdbNuovoMetodo.TabStop = true; - this.rdbNuovoMetodo.Text = "Parallelo"; - this.rdbNuovoMetodo.UseVisualStyleBackColor = true; + rdbNuovoMetodo.AutoSize = true; + rdbNuovoMetodo.Checked = true; + rdbNuovoMetodo.Location = new Point(11, 43); + rdbNuovoMetodo.Margin = new Padding(4, 5, 4, 5); + rdbNuovoMetodo.Name = "rdbNuovoMetodo"; + rdbNuovoMetodo.Size = new Size(87, 24); + rdbNuovoMetodo.TabIndex = 1; + rdbNuovoMetodo.TabStop = true; + rdbNuovoMetodo.Text = "Parallelo"; + rdbNuovoMetodo.UseVisualStyleBackColor = true; // // rdbVecchioMetodo // - this.rdbVecchioMetodo.AutoSize = true; - this.rdbVecchioMetodo.Location = new System.Drawing.Point(8, 4); - this.rdbVecchioMetodo.Name = "rdbVecchioMetodo"; - this.rdbVecchioMetodo.Size = new System.Drawing.Size(60, 17); - this.rdbVecchioMetodo.TabIndex = 0; - this.rdbVecchioMetodo.Text = "Lineare"; - this.rdbVecchioMetodo.UseVisualStyleBackColor = true; + rdbVecchioMetodo.AutoSize = true; + rdbVecchioMetodo.Location = new Point(11, 6); + rdbVecchioMetodo.Margin = new Padding(4, 5, 4, 5); + rdbVecchioMetodo.Name = "rdbVecchioMetodo"; + rdbVecchioMetodo.Size = new Size(78, 24); + rdbVecchioMetodo.TabIndex = 0; + rdbVecchioMetodo.Text = "Lineare"; + rdbVecchioMetodo.UseVisualStyleBackColor = true; // // Label8 // - this.Label8.AutoSize = true; - this.Label8.Location = new System.Drawing.Point(64, 26); - this.Label8.Name = "Label8"; - this.Label8.Size = new System.Drawing.Size(111, 13); - this.Label8.TabIndex = 3; - this.Label8.Text = "Chunk Size (0 = MAX)"; + Label8.AutoSize = true; + Label8.Location = new Point(85, 40); + Label8.Margin = new Padding(4, 0, 4, 0); + Label8.Name = "Label8"; + Label8.Size = new Size(152, 20); + Label8.TabIndex = 3; + Label8.Text = "Chunk Size (0 = MAX)"; // // TextBox8 // - this.TextBox8.Location = new System.Drawing.Point(7, 20); - this.TextBox8.Name = "TextBox8"; - this.TextBox8.Size = new System.Drawing.Size(47, 20); - this.TextBox8.TabIndex = 2; - this.TextBox8.Text = "0"; + TextBox8.Location = new Point(9, 31); + TextBox8.Margin = new Padding(4, 5, 4, 5); + TextBox8.Name = "TextBox8"; + TextBox8.Size = new Size(61, 27); + TextBox8.TabIndex = 2; + TextBox8.Text = "0"; // // Label7 // - this.Label7.AutoSize = true; - this.Label7.Location = new System.Drawing.Point(61, 48); - this.Label7.Name = "Label7"; - this.Label7.Size = new System.Drawing.Size(108, 13); - this.Label7.TabIndex = 1; - this.Label7.Text = "Threads (0 = CPU *2)"; + Label7.AutoSize = true; + Label7.Location = new Point(81, 74); + Label7.Margin = new Padding(4, 0, 4, 0); + Label7.Name = "Label7"; + Label7.Size = new Size(146, 20); + Label7.TabIndex = 1; + Label7.Text = "Threads (0 = CPU *2)"; // // TextBox7 // - this.TextBox7.Location = new System.Drawing.Point(7, 46); - this.TextBox7.Name = "TextBox7"; - this.TextBox7.Size = new System.Drawing.Size(47, 20); - this.TextBox7.TabIndex = 0; - this.TextBox7.Text = "0"; + TextBox7.Location = new Point(9, 71); + TextBox7.Margin = new Padding(4, 5, 4, 5); + TextBox7.Name = "TextBox7"; + TextBox7.Size = new Size(61, 27); + TextBox7.TabIndex = 0; + TextBox7.Text = "0"; // // GroupBox3 // - this.GroupBox3.Controls.Add(this.chkAggiornaSottodirectory); - this.GroupBox3.Controls.Add(this._Button3); - this.GroupBox3.Controls.Add(this._Button2); - this.GroupBox3.Controls.Add(this.Label1); - this.GroupBox3.Controls.Add(this.Label2); - this.GroupBox3.Controls.Add(this.txtSorgente); - this.GroupBox3.Controls.Add(this.txtDestinazione); - this.GroupBox3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192))))); - this.GroupBox3.Location = new System.Drawing.Point(6, 6); - this.GroupBox3.Name = "GroupBox3"; - this.GroupBox3.Size = new System.Drawing.Size(496, 101); - this.GroupBox3.TabIndex = 35; - this.GroupBox3.TabStop = false; - this.GroupBox3.Text = "Directory"; + GroupBox3.Controls.Add(chkAggiornaSottodirectory); + GroupBox3.Controls.Add(_Button3); + GroupBox3.Controls.Add(_Button2); + GroupBox3.Controls.Add(Label1); + GroupBox3.Controls.Add(Label2); + GroupBox3.Controls.Add(txtSorgente); + GroupBox3.Controls.Add(txtDestinazione); + GroupBox3.ForeColor = Color.FromArgb(0, 0, 192); + GroupBox3.Location = new Point(8, 9); + GroupBox3.Margin = new Padding(4, 5, 4, 5); + GroupBox3.Name = "GroupBox3"; + GroupBox3.Padding = new Padding(4, 5, 4, 5); + GroupBox3.Size = new Size(661, 155); + GroupBox3.TabIndex = 35; + GroupBox3.TabStop = false; + GroupBox3.Text = "Directory"; // // chkAggiornaSottodirectory // - this.chkAggiornaSottodirectory.ForeColor = System.Drawing.Color.Black; - this.chkAggiornaSottodirectory.Location = new System.Drawing.Point(80, 64); - this.chkAggiornaSottodirectory.Name = "chkAggiornaSottodirectory"; - this.chkAggiornaSottodirectory.Size = new System.Drawing.Size(152, 24); - this.chkAggiornaSottodirectory.TabIndex = 25; - this.chkAggiornaSottodirectory.Text = "aggiorna le sottodirectory"; + chkAggiornaSottodirectory.ForeColor = Color.Black; + chkAggiornaSottodirectory.Location = new Point(107, 98); + chkAggiornaSottodirectory.Margin = new Padding(4, 5, 4, 5); + chkAggiornaSottodirectory.Name = "chkAggiornaSottodirectory"; + chkAggiornaSottodirectory.Size = new Size(203, 37); + chkAggiornaSottodirectory.TabIndex = 25; + chkAggiornaSottodirectory.Text = "aggiorna le sottodirectory"; // // _Button3 // - this._Button3.Location = new System.Drawing.Point(462, 40); - this._Button3.Name = "_Button3"; - this._Button3.Size = new System.Drawing.Size(24, 20); - this._Button3.TabIndex = 6; - this._Button3.Text = "..."; - this._Button3.Click += new System.EventHandler(this.Button3_Click); + _Button3.Location = new Point(616, 62); + _Button3.Margin = new Padding(4, 5, 4, 5); + _Button3.Name = "_Button3"; + _Button3.Size = new Size(32, 31); + _Button3.TabIndex = 6; + _Button3.Text = "..."; + _Button3.Click += Button3_Click; // // _Button2 // - this._Button2.Location = new System.Drawing.Point(462, 16); - this._Button2.Name = "_Button2"; - this._Button2.Size = new System.Drawing.Size(24, 20); - this._Button2.TabIndex = 5; - this._Button2.Text = "..."; - this._Button2.Click += new System.EventHandler(this.Button2_Click); + _Button2.Location = new Point(616, 25); + _Button2.Margin = new Padding(4, 5, 4, 5); + _Button2.Name = "_Button2"; + _Button2.Size = new Size(32, 31); + _Button2.TabIndex = 5; + _Button2.Text = "..."; + _Button2.Click += Button2_Click; // // Label1 // - this.Label1.AutoSize = true; - this.Label1.ForeColor = System.Drawing.Color.Black; - this.Label1.Location = new System.Drawing.Point(6, 19); - this.Label1.Name = "Label1"; - this.Label1.Size = new System.Drawing.Size(50, 13); - this.Label1.TabIndex = 3; - this.Label1.Text = "Sorgente"; + Label1.AutoSize = true; + Label1.ForeColor = Color.Black; + Label1.Location = new Point(8, 29); + Label1.Margin = new Padding(4, 0, 4, 0); + Label1.Name = "Label1"; + Label1.Size = new Size(69, 20); + Label1.TabIndex = 3; + Label1.Text = "Sorgente"; // // Label2 // - this.Label2.AutoSize = true; - this.Label2.ForeColor = System.Drawing.Color.Black; - this.Label2.Location = new System.Drawing.Point(6, 43); - this.Label2.Name = "Label2"; - this.Label2.Size = new System.Drawing.Size(68, 13); - this.Label2.TabIndex = 4; - this.Label2.Text = "Destinazione"; + Label2.AutoSize = true; + Label2.ForeColor = Color.Black; + Label2.Location = new Point(8, 66); + Label2.Margin = new Padding(4, 0, 4, 0); + Label2.Name = "Label2"; + Label2.Size = new Size(95, 20); + Label2.TabIndex = 4; + Label2.Text = "Destinazione"; // // txtSorgente // - this.txtSorgente.Location = new System.Drawing.Point(80, 16); - this.txtSorgente.Name = "txtSorgente"; - this.txtSorgente.Size = new System.Drawing.Size(376, 20); - this.txtSorgente.TabIndex = 0; - this.txtSorgente.Text = "TextBox1"; + txtSorgente.DataBindings.Add(new Binding("Text", bindingSource1, "SourcePath", true, DataSourceUpdateMode.OnPropertyChanged)); + txtSorgente.Location = new Point(107, 25); + txtSorgente.Margin = new Padding(4, 5, 4, 5); + txtSorgente.Name = "txtSorgente"; + txtSorgente.Size = new Size(500, 27); + txtSorgente.TabIndex = 0; + txtSorgente.Text = "TextBox1"; + // + // bindingSource1 + // + bindingSource1.DataSource = dataModelBindingSource; + // + // dataModelBindingSource + // + dataModelBindingSource.DataSource = typeof(ImageCatalog_2.DataModel); // // txtDestinazione // - this.txtDestinazione.Location = new System.Drawing.Point(80, 40); - this.txtDestinazione.Name = "txtDestinazione"; - this.txtDestinazione.Size = new System.Drawing.Size(376, 20); - this.txtDestinazione.TabIndex = 1; - this.txtDestinazione.Text = "TextBox2"; + txtDestinazione.DataBindings.Add(new Binding("Text", bindingSource1, "DestinationPath", true, DataSourceUpdateMode.OnPropertyChanged)); + txtDestinazione.Location = new Point(107, 62); + txtDestinazione.Margin = new Padding(4, 5, 4, 5); + txtDestinazione.Name = "txtDestinazione"; + txtDestinazione.Size = new Size(500, 27); + txtDestinazione.TabIndex = 1; + txtDestinazione.Text = "TextBox2"; // // GroupBox8 // - this.GroupBox8.Controls.Add(this.rdbNumFiles); - this.GroupBox8.Controls.Add(this.rdbNumProgressiva); - this.GroupBox8.Controls.Add(this.txtCifreContatore); - this.GroupBox8.Controls.Add(this.Label34); - this.GroupBox8.Controls.Add(this.txtSuffissoCartelle); - this.GroupBox8.Controls.Add(this.Label33); - this.GroupBox8.Controls.Add(this.Label31); - this.GroupBox8.Controls.Add(this.chkCreaSottocartelle); - this.GroupBox8.Controls.Add(this.txtFilePerCartella); - this.GroupBox8.Controls.Add(this.Label32); - this.GroupBox8.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192))))); - this.GroupBox8.Location = new System.Drawing.Point(204, 113); - this.GroupBox8.Name = "GroupBox8"; - this.GroupBox8.Size = new System.Drawing.Size(192, 152); - this.GroupBox8.TabIndex = 47; - this.GroupBox8.TabStop = false; - this.GroupBox8.Text = "Sottocartelle"; + GroupBox8.Controls.Add(rdbNumFiles); + GroupBox8.Controls.Add(rdbNumProgressiva); + GroupBox8.Controls.Add(txtCifreContatore); + GroupBox8.Controls.Add(Label34); + GroupBox8.Controls.Add(txtSuffissoCartelle); + GroupBox8.Controls.Add(Label33); + GroupBox8.Controls.Add(Label31); + GroupBox8.Controls.Add(chkCreaSottocartelle); + GroupBox8.Controls.Add(txtFilePerCartella); + GroupBox8.Controls.Add(Label32); + GroupBox8.ForeColor = Color.FromArgb(0, 0, 192); + GroupBox8.Location = new Point(272, 174); + GroupBox8.Margin = new Padding(4, 5, 4, 5); + GroupBox8.Name = "GroupBox8"; + GroupBox8.Padding = new Padding(4, 5, 4, 5); + GroupBox8.Size = new Size(256, 234); + GroupBox8.TabIndex = 47; + GroupBox8.TabStop = false; + GroupBox8.Text = "Sottocartelle"; // // rdbNumFiles // - this.rdbNumFiles.ForeColor = System.Drawing.Color.Black; - this.rdbNumFiles.Location = new System.Drawing.Point(32, 128); - this.rdbNumFiles.Name = "rdbNumFiles"; - this.rdbNumFiles.Size = new System.Drawing.Size(136, 16); - this.rdbNumFiles.TabIndex = 38; - this.rdbNumFiles.Text = "Numerazione files"; + rdbNumFiles.ForeColor = Color.Black; + rdbNumFiles.Location = new Point(43, 197); + rdbNumFiles.Margin = new Padding(4, 5, 4, 5); + rdbNumFiles.Name = "rdbNumFiles"; + rdbNumFiles.Size = new Size(181, 25); + rdbNumFiles.TabIndex = 38; + rdbNumFiles.Text = "Numerazione files"; // // rdbNumProgressiva // - this.rdbNumProgressiva.Checked = true; - this.rdbNumProgressiva.ForeColor = System.Drawing.Color.Black; - this.rdbNumProgressiva.Location = new System.Drawing.Point(32, 112); - this.rdbNumProgressiva.Name = "rdbNumProgressiva"; - this.rdbNumProgressiva.Size = new System.Drawing.Size(152, 16); - this.rdbNumProgressiva.TabIndex = 37; - this.rdbNumProgressiva.TabStop = true; - this.rdbNumProgressiva.Text = "Numerazione progressiva"; + rdbNumProgressiva.Checked = true; + rdbNumProgressiva.ForeColor = Color.Black; + rdbNumProgressiva.Location = new Point(43, 172); + rdbNumProgressiva.Margin = new Padding(4, 5, 4, 5); + rdbNumProgressiva.Name = "rdbNumProgressiva"; + rdbNumProgressiva.Size = new Size(203, 25); + rdbNumProgressiva.TabIndex = 37; + rdbNumProgressiva.TabStop = true; + rdbNumProgressiva.Text = "Numerazione progressiva"; // // txtCifreContatore // - this.txtCifreContatore.Location = new System.Drawing.Point(128, 88); - this.txtCifreContatore.Name = "txtCifreContatore"; - this.txtCifreContatore.Size = new System.Drawing.Size(56, 20); - this.txtCifreContatore.TabIndex = 34; - this.txtCifreContatore.Text = "4"; + txtCifreContatore.Location = new Point(171, 135); + txtCifreContatore.Margin = new Padding(4, 5, 4, 5); + txtCifreContatore.Name = "txtCifreContatore"; + txtCifreContatore.Size = new Size(73, 27); + txtCifreContatore.TabIndex = 34; + txtCifreContatore.Text = "4"; // // Label34 // - this.Label34.ForeColor = System.Drawing.Color.Black; - this.Label34.Location = new System.Drawing.Point(8, 88); - this.Label34.Name = "Label34"; - this.Label34.Size = new System.Drawing.Size(112, 16); - this.Label34.TabIndex = 33; - this.Label34.Text = "Num. cifre contatore"; - this.Label34.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + Label34.ForeColor = Color.Black; + Label34.Location = new Point(11, 135); + Label34.Margin = new Padding(4, 0, 4, 0); + Label34.Name = "Label34"; + Label34.Size = new Size(149, 25); + Label34.TabIndex = 33; + Label34.Text = "Num. cifre contatore"; + Label34.TextAlign = ContentAlignment.MiddleRight; // // txtSuffissoCartelle // - this.txtSuffissoCartelle.Location = new System.Drawing.Point(56, 64); - this.txtSuffissoCartelle.Name = "txtSuffissoCartelle"; - this.txtSuffissoCartelle.Size = new System.Drawing.Size(128, 20); - this.txtSuffissoCartelle.TabIndex = 32; - this.txtSuffissoCartelle.Text = "TextBox20"; + txtSuffissoCartelle.Location = new Point(75, 98); + txtSuffissoCartelle.Margin = new Padding(4, 5, 4, 5); + txtSuffissoCartelle.Name = "txtSuffissoCartelle"; + txtSuffissoCartelle.Size = new Size(169, 27); + txtSuffissoCartelle.TabIndex = 32; + txtSuffissoCartelle.Text = "TextBox20"; // // Label33 // - this.Label33.ForeColor = System.Drawing.Color.Black; - this.Label33.Location = new System.Drawing.Point(6, 67); - this.Label33.Name = "Label33"; - this.Label33.Size = new System.Drawing.Size(48, 16); - this.Label33.TabIndex = 31; - this.Label33.Text = "Suffisso"; + Label33.ForeColor = Color.Black; + Label33.Location = new Point(8, 103); + Label33.Margin = new Padding(4, 0, 4, 0); + Label33.Name = "Label33"; + Label33.Size = new Size(64, 25); + Label33.TabIndex = 31; + Label33.Text = "Suffisso"; // // Label31 // - this.Label31.ForeColor = System.Drawing.Color.Black; - this.Label31.Location = new System.Drawing.Point(24, 40); - this.Label31.Name = "Label31"; - this.Label31.Size = new System.Drawing.Size(32, 16); - this.Label31.TabIndex = 30; - this.Label31.Text = "ogni"; + Label31.ForeColor = Color.Black; + Label31.Location = new Point(32, 62); + Label31.Margin = new Padding(4, 0, 4, 0); + Label31.Name = "Label31"; + Label31.Size = new Size(43, 25); + Label31.TabIndex = 30; + Label31.Text = "ogni"; // // chkCreaSottocartelle // - this.chkCreaSottocartelle.ForeColor = System.Drawing.Color.Black; - this.chkCreaSottocartelle.Location = new System.Drawing.Point(56, 16); - this.chkCreaSottocartelle.Name = "chkCreaSottocartelle"; - this.chkCreaSottocartelle.Size = new System.Drawing.Size(112, 16); - this.chkCreaSottocartelle.TabIndex = 29; - this.chkCreaSottocartelle.Text = "crea sottocartelle"; + chkCreaSottocartelle.ForeColor = Color.Black; + chkCreaSottocartelle.Location = new Point(75, 25); + chkCreaSottocartelle.Margin = new Padding(4, 5, 4, 5); + chkCreaSottocartelle.Name = "chkCreaSottocartelle"; + chkCreaSottocartelle.Size = new Size(149, 25); + chkCreaSottocartelle.TabIndex = 29; + chkCreaSottocartelle.Text = "crea sottocartelle"; // // txtFilePerCartella // - this.txtFilePerCartella.Location = new System.Drawing.Point(56, 40); - this.txtFilePerCartella.Name = "txtFilePerCartella"; - this.txtFilePerCartella.Size = new System.Drawing.Size(64, 20); - this.txtFilePerCartella.TabIndex = 27; - this.txtFilePerCartella.Text = "99"; + txtFilePerCartella.Location = new Point(75, 62); + txtFilePerCartella.Margin = new Padding(4, 5, 4, 5); + txtFilePerCartella.Name = "txtFilePerCartella"; + txtFilePerCartella.Size = new Size(84, 27); + txtFilePerCartella.TabIndex = 27; + txtFilePerCartella.Text = "99"; // // Label32 // - this.Label32.ForeColor = System.Drawing.Color.Black; - this.Label32.Location = new System.Drawing.Point(128, 40); - this.Label32.Name = "Label32"; - this.Label32.Size = new System.Drawing.Size(24, 16); - this.Label32.TabIndex = 28; - this.Label32.Text = "file"; + Label32.ForeColor = Color.Black; + Label32.Location = new Point(171, 62); + Label32.Margin = new Padding(4, 0, 4, 0); + Label32.Name = "Label32"; + Label32.Size = new Size(32, 25); + Label32.TabIndex = 28; + Label32.Text = "file"; // // GroupBox7 // - this.GroupBox7.Controls.Add(this.chkSovrascriviFile); - this.GroupBox7.Controls.Add(this.chkRotazioneAutomatica); - this.GroupBox7.Controls.Add(this.chkForzaJpg); - this.GroupBox7.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192))))); - this.GroupBox7.Location = new System.Drawing.Point(6, 113); - this.GroupBox7.Name = "GroupBox7"; - this.GroupBox7.Size = new System.Drawing.Size(192, 88); - this.GroupBox7.TabIndex = 45; - this.GroupBox7.TabStop = false; - this.GroupBox7.Text = "Generale"; + GroupBox7.Controls.Add(chkSovrascriviFile); + GroupBox7.Controls.Add(chkRotazioneAutomatica); + GroupBox7.Controls.Add(chkForzaJpg); + GroupBox7.ForeColor = Color.FromArgb(0, 0, 192); + GroupBox7.Location = new Point(8, 174); + GroupBox7.Margin = new Padding(4, 5, 4, 5); + GroupBox7.Name = "GroupBox7"; + GroupBox7.Padding = new Padding(4, 5, 4, 5); + GroupBox7.Size = new Size(256, 135); + GroupBox7.TabIndex = 45; + GroupBox7.TabStop = false; + GroupBox7.Text = "Generale"; // // chkSovrascriviFile // - this.chkSovrascriviFile.AutoSize = true; - this.chkSovrascriviFile.Location = new System.Drawing.Point(16, 61); - this.chkSovrascriviFile.Name = "chkSovrascriviFile"; - this.chkSovrascriviFile.Size = new System.Drawing.Size(94, 17); - this.chkSovrascriviFile.TabIndex = 2; - this.chkSovrascriviFile.Text = "Sovrascrivi file"; - this.chkSovrascriviFile.UseVisualStyleBackColor = true; + chkSovrascriviFile.AutoSize = true; + chkSovrascriviFile.Location = new Point(21, 94); + chkSovrascriviFile.Margin = new Padding(4, 5, 4, 5); + chkSovrascriviFile.Name = "chkSovrascriviFile"; + chkSovrascriviFile.Size = new Size(126, 24); + chkSovrascriviFile.TabIndex = 2; + chkSovrascriviFile.Text = "Sovrascrivi file"; + chkSovrascriviFile.UseVisualStyleBackColor = true; // // chkRotazioneAutomatica // - this.chkRotazioneAutomatica.ForeColor = System.Drawing.Color.Black; - this.chkRotazioneAutomatica.Location = new System.Drawing.Point(16, 39); - this.chkRotazioneAutomatica.Name = "chkRotazioneAutomatica"; - this.chkRotazioneAutomatica.Size = new System.Drawing.Size(136, 16); - this.chkRotazioneAutomatica.TabIndex = 1; - this.chkRotazioneAutomatica.Text = "Rotazione automatica"; + chkRotazioneAutomatica.ForeColor = Color.Black; + chkRotazioneAutomatica.Location = new Point(21, 60); + chkRotazioneAutomatica.Margin = new Padding(4, 5, 4, 5); + chkRotazioneAutomatica.Name = "chkRotazioneAutomatica"; + chkRotazioneAutomatica.Size = new Size(181, 25); + chkRotazioneAutomatica.TabIndex = 1; + chkRotazioneAutomatica.Text = "Rotazione automatica"; // // chkForzaJpg // - this.chkForzaJpg.Checked = true; - this.chkForzaJpg.CheckState = System.Windows.Forms.CheckState.Checked; - this.chkForzaJpg.ForeColor = System.Drawing.Color.Black; - this.chkForzaJpg.Location = new System.Drawing.Point(16, 18); - this.chkForzaJpg.Name = "chkForzaJpg"; - this.chkForzaJpg.Size = new System.Drawing.Size(80, 16); - this.chkForzaJpg.TabIndex = 0; - this.chkForzaJpg.Text = "Forza Jpg"; + chkForzaJpg.Checked = true; + chkForzaJpg.CheckState = CheckState.Checked; + chkForzaJpg.ForeColor = Color.Black; + chkForzaJpg.Location = new Point(21, 28); + chkForzaJpg.Margin = new Padding(4, 5, 4, 5); + chkForzaJpg.Name = "chkForzaJpg"; + chkForzaJpg.Size = new Size(107, 25); + chkForzaJpg.TabIndex = 0; + chkForzaJpg.Text = "Forza Jpg"; // // TabPage3 // - this.TabPage3.Controls.Add(this.GroupBox10); - this.TabPage3.Controls.Add(this.GroupBox9); - this.TabPage3.Controls.Add(this.GroupBox5); - this.TabPage3.Controls.Add(this.GroupBox4); - this.TabPage3.Location = new System.Drawing.Point(4, 22); - this.TabPage3.Name = "TabPage3"; - this.TabPage3.Padding = new System.Windows.Forms.Padding(3); - this.TabPage3.Size = new System.Drawing.Size(513, 351); - this.TabPage3.TabIndex = 2; - this.TabPage3.Text = "Testo"; - this.TabPage3.UseVisualStyleBackColor = true; + TabPage3.Controls.Add(GroupBox10); + TabPage3.Controls.Add(GroupBox9); + TabPage3.Controls.Add(GroupBox5); + TabPage3.Controls.Add(GroupBox4); + TabPage3.Location = new Point(4, 29); + TabPage3.Margin = new Padding(4, 5, 4, 5); + TabPage3.Name = "TabPage3"; + TabPage3.Padding = new Padding(4, 5, 4, 5); + TabPage3.Size = new Size(687, 547); + TabPage3.TabIndex = 2; + TabPage3.Text = "Testo"; + TabPage3.UseVisualStyleBackColor = true; // // GroupBox10 // - this.GroupBox10.Controls.Add(this.Label42); - this.GroupBox10.Controls.Add(this.Label41); - this.GroupBox10.Controls.Add(this.TextBox31); - this.GroupBox10.Controls.Add(this.TextBox30); - this.GroupBox10.Location = new System.Drawing.Point(316, 78); - this.GroupBox10.Name = "GroupBox10"; - this.GroupBox10.Size = new System.Drawing.Size(186, 73); - this.GroupBox10.TabIndex = 39; - this.GroupBox10.TabStop = false; - this.GroupBox10.Text = "Testo foto verticali"; + GroupBox10.Controls.Add(Label42); + GroupBox10.Controls.Add(Label41); + GroupBox10.Controls.Add(TextBox31); + GroupBox10.Controls.Add(TextBox30); + GroupBox10.Location = new Point(421, 120); + GroupBox10.Margin = new Padding(4, 5, 4, 5); + GroupBox10.Name = "GroupBox10"; + GroupBox10.Padding = new Padding(4, 5, 4, 5); + GroupBox10.Size = new Size(248, 112); + GroupBox10.TabIndex = 39; + GroupBox10.TabStop = false; + GroupBox10.Text = "Testo foto verticali"; // // Label42 // - this.Label42.AutoSize = true; - this.Label42.Location = new System.Drawing.Point(7, 46); - this.Label42.Name = "Label42"; - this.Label42.Size = new System.Drawing.Size(45, 13); - this.Label42.TabIndex = 3; - this.Label42.Text = "Margine"; + Label42.AutoSize = true; + Label42.Location = new Point(9, 71); + Label42.Margin = new Padding(4, 0, 4, 0); + Label42.Name = "Label42"; + Label42.Size = new Size(64, 20); + Label42.TabIndex = 3; + Label42.Text = "Margine"; // // Label41 // - this.Label41.AutoSize = true; - this.Label41.Location = new System.Drawing.Point(7, 25); - this.Label41.Name = "Label41"; - this.Label41.Size = new System.Drawing.Size(108, 13); - this.Label41.TabIndex = 2; - this.Label41.Text = "Dimensione Carattere"; + Label41.AutoSize = true; + Label41.Location = new Point(9, 38); + Label41.Margin = new Padding(4, 0, 4, 0); + Label41.Name = "Label41"; + Label41.Size = new Size(153, 20); + Label41.TabIndex = 2; + Label41.Text = "Dimensione Carattere"; // // TextBox31 // - this.TextBox31.Location = new System.Drawing.Point(131, 46); - this.TextBox31.Name = "TextBox31"; - this.TextBox31.Size = new System.Drawing.Size(39, 20); - this.TextBox31.TabIndex = 1; + TextBox31.Location = new Point(175, 71); + TextBox31.Margin = new Padding(4, 5, 4, 5); + TextBox31.Name = "TextBox31"; + TextBox31.Size = new Size(51, 27); + TextBox31.TabIndex = 1; // // TextBox30 // - this.TextBox30.Location = new System.Drawing.Point(131, 22); - this.TextBox30.Name = "TextBox30"; - this.TextBox30.Size = new System.Drawing.Size(39, 20); - this.TextBox30.TabIndex = 0; + TextBox30.Location = new Point(175, 34); + TextBox30.Margin = new Padding(4, 5, 4, 5); + TextBox30.Name = "TextBox30"; + TextBox30.Size = new Size(51, 27); + TextBox30.TabIndex = 0; // // GroupBox9 // - this.GroupBox9.Controls.Add(this.CheckBox17); - this.GroupBox9.Controls.Add(this.CheckBox16); - this.GroupBox9.Location = new System.Drawing.Point(316, 31); - this.GroupBox9.Name = "GroupBox9"; - this.GroupBox9.Size = new System.Drawing.Size(186, 45); - this.GroupBox9.TabIndex = 38; - this.GroupBox9.TabStop = false; - this.GroupBox9.Text = "Slide show"; + GroupBox9.Controls.Add(CheckBox17); + GroupBox9.Controls.Add(CheckBox16); + GroupBox9.Location = new Point(421, 48); + GroupBox9.Margin = new Padding(4, 5, 4, 5); + GroupBox9.Name = "GroupBox9"; + GroupBox9.Padding = new Padding(4, 5, 4, 5); + GroupBox9.Size = new Size(248, 69); + GroupBox9.TabIndex = 38; + GroupBox9.TabStop = false; + GroupBox9.Text = "Slide show"; // // CheckBox17 // - this.CheckBox17.AutoSize = true; - this.CheckBox17.Location = new System.Drawing.Point(96, 18); - this.CheckBox17.Name = "CheckBox17"; - this.CheckBox17.Size = new System.Drawing.Size(84, 17); - this.CheckBox17.TabIndex = 1; - this.CheckBox17.Text = "Numero foto"; - this.CheckBox17.UseVisualStyleBackColor = true; + CheckBox17.AutoSize = true; + CheckBox17.Location = new Point(128, 28); + CheckBox17.Margin = new Padding(4, 5, 4, 5); + CheckBox17.Name = "CheckBox17"; + CheckBox17.Size = new Size(117, 24); + CheckBox17.TabIndex = 1; + CheckBox17.Text = "Numero foto"; + CheckBox17.UseVisualStyleBackColor = true; // // CheckBox16 // - this.CheckBox16.AutoSize = true; - this.CheckBox16.Location = new System.Drawing.Point(6, 19); - this.CheckBox16.Name = "CheckBox16"; - this.CheckBox16.Size = new System.Drawing.Size(49, 17); - this.CheckBox16.TabIndex = 0; - this.CheckBox16.Text = "Data"; - this.CheckBox16.UseVisualStyleBackColor = true; + CheckBox16.AutoSize = true; + CheckBox16.Location = new Point(8, 29); + CheckBox16.Margin = new Padding(4, 5, 4, 5); + CheckBox16.Name = "CheckBox16"; + CheckBox16.Size = new Size(63, 24); + CheckBox16.TabIndex = 0; + CheckBox16.Text = "Data"; + CheckBox16.UseVisualStyleBackColor = true; // // GroupBox5 // - this.GroupBox5.Controls.Add(this.TextBox34); - this.GroupBox5.Controls.Add(this._Button8); - this.GroupBox5.Controls.Add(this.Label36); - this.GroupBox5.Controls.Add(this.TextBox25); - this.GroupBox5.Controls.Add(this.Label35); - this.GroupBox5.Controls.Add(this.ComboBox3); - this.GroupBox5.Controls.Add(this.TextBox11); - this.GroupBox5.Controls.Add(this.Label12); - this.GroupBox5.Controls.Add(this.Label11); - this.GroupBox5.Controls.Add(this.CheckBox3); - this.GroupBox5.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192))))); - this.GroupBox5.Location = new System.Drawing.Point(6, 31); - this.GroupBox5.Name = "GroupBox5"; - this.GroupBox5.Size = new System.Drawing.Size(304, 120); - this.GroupBox5.TabIndex = 37; - this.GroupBox5.TabStop = false; - this.GroupBox5.Text = "Carattere"; + GroupBox5.Controls.Add(TextBox34); + GroupBox5.Controls.Add(_Button8); + GroupBox5.Controls.Add(Label36); + GroupBox5.Controls.Add(TextBox25); + GroupBox5.Controls.Add(Label35); + GroupBox5.Controls.Add(ComboBox3); + GroupBox5.Controls.Add(TextBox11); + GroupBox5.Controls.Add(Label12); + GroupBox5.Controls.Add(Label11); + GroupBox5.Controls.Add(CheckBox3); + GroupBox5.ForeColor = Color.FromArgb(0, 0, 192); + GroupBox5.Location = new Point(8, 48); + GroupBox5.Margin = new Padding(4, 5, 4, 5); + GroupBox5.Name = "GroupBox5"; + GroupBox5.Padding = new Padding(4, 5, 4, 5); + GroupBox5.Size = new Size(405, 185); + GroupBox5.TabIndex = 37; + GroupBox5.TabStop = false; + GroupBox5.Text = "Carattere"; // // TextBox34 // - this.TextBox34.Location = new System.Drawing.Point(160, 91); - this.TextBox34.Name = "TextBox34"; - this.TextBox34.Size = new System.Drawing.Size(56, 20); - this.TextBox34.TabIndex = 36; - this.TextBox34.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; + TextBox34.Location = new Point(213, 140); + TextBox34.Margin = new Padding(4, 5, 4, 5); + TextBox34.Name = "TextBox34"; + TextBox34.Size = new Size(73, 27); + TextBox34.TabIndex = 36; + TextBox34.TextAlign = HorizontalAlignment.Right; // // _Button8 // - this._Button8.ForeColor = System.Drawing.Color.Black; - this._Button8.Location = new System.Drawing.Point(222, 89); - this._Button8.Name = "_Button8"; - this._Button8.Size = new System.Drawing.Size(74, 24); - this._Button8.TabIndex = 35; - this._Button8.Text = "Scegli..."; - this._Button8.Click += new System.EventHandler(this.Button8_Click); + _Button8.ForeColor = Color.Black; + _Button8.Location = new Point(296, 137); + _Button8.Margin = new Padding(4, 5, 4, 5); + _Button8.Name = "_Button8"; + _Button8.Size = new Size(99, 37); + _Button8.TabIndex = 35; + _Button8.Text = "Scegli..."; + _Button8.Click += Button8_Click; // // Label36 // - this.Label36.ForeColor = System.Drawing.Color.Black; - this.Label36.Location = new System.Drawing.Point(8, 60); - this.Label36.Name = "Label36"; - this.Label36.Size = new System.Drawing.Size(120, 19); - this.Label36.TabIndex = 34; - this.Label36.Text = "Dimensione miniatura"; - this.Label36.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + Label36.ForeColor = Color.Black; + Label36.Location = new Point(11, 92); + Label36.Margin = new Padding(4, 0, 4, 0); + Label36.Name = "Label36"; + Label36.Size = new Size(160, 29); + Label36.TabIndex = 34; + Label36.Text = "Dimensione miniatura"; + Label36.TextAlign = ContentAlignment.MiddleLeft; // // TextBox25 // - this.TextBox25.Location = new System.Drawing.Point(160, 59); - this.TextBox25.Name = "TextBox25"; - this.TextBox25.Size = new System.Drawing.Size(56, 20); - this.TextBox25.TabIndex = 33; - this.TextBox25.Text = "TextBox25"; + TextBox25.Location = new Point(213, 91); + TextBox25.Margin = new Padding(4, 5, 4, 5); + TextBox25.Name = "TextBox25"; + TextBox25.Size = new Size(73, 27); + TextBox25.TabIndex = 33; + TextBox25.Text = "TextBox25"; // // Label35 // - this.Label35.ForeColor = System.Drawing.Color.Black; - this.Label35.Location = new System.Drawing.Point(8, 93); - this.Label35.Name = "Label35"; - this.Label35.Size = new System.Drawing.Size(72, 16); - this.Label35.TabIndex = 32; - this.Label35.Text = "Colore RGB"; - this.Label35.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + Label35.ForeColor = Color.Black; + Label35.Location = new Point(11, 143); + Label35.Margin = new Padding(4, 0, 4, 0); + Label35.Name = "Label35"; + Label35.Size = new Size(96, 25); + Label35.TabIndex = 32; + Label35.Text = "Colore RGB"; + Label35.TextAlign = ContentAlignment.MiddleLeft; // // ComboBox3 // - this.ComboBox3.Location = new System.Drawing.Point(96, 8); - this.ComboBox3.Name = "ComboBox3"; - this.ComboBox3.Size = new System.Drawing.Size(120, 21); - this.ComboBox3.TabIndex = 28; - this.ComboBox3.Text = "ComboBox3"; + ComboBox3.Location = new Point(128, 12); + ComboBox3.Margin = new Padding(4, 5, 4, 5); + ComboBox3.Name = "ComboBox3"; + ComboBox3.Size = new Size(159, 28); + ComboBox3.TabIndex = 28; + ComboBox3.Text = "ComboBox3"; // // TextBox11 // - this.TextBox11.Location = new System.Drawing.Point(160, 35); - this.TextBox11.Name = "TextBox11"; - this.TextBox11.Size = new System.Drawing.Size(56, 20); - this.TextBox11.TabIndex = 27; - this.TextBox11.Text = "TextBox11"; + TextBox11.Location = new Point(213, 54); + TextBox11.Margin = new Padding(4, 5, 4, 5); + TextBox11.Name = "TextBox11"; + TextBox11.Size = new Size(73, 27); + TextBox11.TabIndex = 27; + TextBox11.Text = "TextBox11"; // // Label12 // - this.Label12.AutoSize = true; - this.Label12.ForeColor = System.Drawing.Color.Black; - this.Label12.Location = new System.Drawing.Point(8, 38); - this.Label12.Name = "Label12"; - this.Label12.Size = new System.Drawing.Size(62, 13); - this.Label12.TabIndex = 26; - this.Label12.Text = "Dimensione"; - this.Label12.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + Label12.AutoSize = true; + Label12.ForeColor = Color.Black; + Label12.Location = new Point(11, 58); + Label12.Margin = new Padding(4, 0, 4, 0); + Label12.Name = "Label12"; + Label12.Size = new Size(88, 20); + Label12.TabIndex = 26; + Label12.Text = "Dimensione"; + Label12.TextAlign = ContentAlignment.MiddleLeft; // // Label11 // - this.Label11.AutoSize = true; - this.Label11.ForeColor = System.Drawing.Color.Black; - this.Label11.Location = new System.Drawing.Point(56, 8); - this.Label11.Name = "Label11"; - this.Label11.Size = new System.Drawing.Size(28, 13); - this.Label11.TabIndex = 22; - this.Label11.Text = "Font"; + Label11.AutoSize = true; + Label11.ForeColor = Color.Black; + Label11.Location = new Point(75, 12); + Label11.Margin = new Padding(4, 0, 4, 0); + Label11.Name = "Label11"; + Label11.Size = new Size(38, 20); + Label11.TabIndex = 22; + Label11.Text = "Font"; // // CheckBox3 // - this.CheckBox3.ForeColor = System.Drawing.Color.Black; - this.CheckBox3.Location = new System.Drawing.Point(224, 8); - this.CheckBox3.Name = "CheckBox3"; - this.CheckBox3.Size = new System.Drawing.Size(72, 24); - this.CheckBox3.TabIndex = 24; - this.CheckBox3.Text = "Grassetto"; + CheckBox3.ForeColor = Color.Black; + CheckBox3.Location = new Point(299, 12); + CheckBox3.Margin = new Padding(4, 5, 4, 5); + CheckBox3.Name = "CheckBox3"; + CheckBox3.Size = new Size(96, 37); + CheckBox3.TabIndex = 24; + CheckBox3.Text = "Grassetto"; // // GroupBox4 // - this.GroupBox4.Controls.Add(this.Label40); - this.GroupBox4.Controls.Add(this.TextBox29); - this.GroupBox4.Controls.Add(this.TextBox18); - this.GroupBox4.Controls.Add(this.Label26); - this.GroupBox4.Controls.Add(this.DateTimePicker1); - this.GroupBox4.Controls.Add(this.CheckBox8); - this.GroupBox4.Controls.Add(this.TextBox9); - this.GroupBox4.Controls.Add(this.CheckBox7); - this.GroupBox4.Controls.Add(this.Label4); - this.GroupBox4.Controls.Add(this.TextBox4); - this.GroupBox4.Controls.Add(this.Label9); - this.GroupBox4.Controls.Add(this.Label13); - this.GroupBox4.Controls.Add(this.ComboBox1); - this.GroupBox4.Controls.Add(this.ComboBox2); - this.GroupBox4.Controls.Add(this.Label14); - this.GroupBox4.Controls.Add(this.TextBox12); - this.GroupBox4.Controls.Add(this.Label15); - this.GroupBox4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192))))); - this.GroupBox4.Location = new System.Drawing.Point(6, 157); - this.GroupBox4.Name = "GroupBox4"; - this.GroupBox4.Size = new System.Drawing.Size(496, 186); - this.GroupBox4.TabIndex = 36; - this.GroupBox4.TabStop = false; - this.GroupBox4.Text = "Testo da applicare"; + GroupBox4.Controls.Add(Label40); + GroupBox4.Controls.Add(TextBox29); + GroupBox4.Controls.Add(TextBox18); + GroupBox4.Controls.Add(Label26); + GroupBox4.Controls.Add(DateTimePicker1); + GroupBox4.Controls.Add(CheckBox8); + GroupBox4.Controls.Add(TextBox9); + GroupBox4.Controls.Add(CheckBox7); + GroupBox4.Controls.Add(Label4); + GroupBox4.Controls.Add(TextBox4); + GroupBox4.Controls.Add(Label9); + GroupBox4.Controls.Add(Label13); + GroupBox4.Controls.Add(ComboBox1); + GroupBox4.Controls.Add(ComboBox2); + GroupBox4.Controls.Add(Label14); + GroupBox4.Controls.Add(TextBox12); + GroupBox4.Controls.Add(Label15); + GroupBox4.ForeColor = Color.FromArgb(0, 0, 192); + GroupBox4.Location = new Point(8, 242); + GroupBox4.Margin = new Padding(4, 5, 4, 5); + GroupBox4.Name = "GroupBox4"; + GroupBox4.Padding = new Padding(4, 5, 4, 5); + GroupBox4.Size = new Size(661, 286); + GroupBox4.TabIndex = 36; + GroupBox4.TabStop = false; + GroupBox4.Text = "Testo da applicare"; // // Label40 // - this.Label40.AutoSize = true; - this.Label40.Location = new System.Drawing.Point(8, 52); - this.Label40.Name = "Label40"; - this.Label40.Size = new System.Drawing.Size(48, 13); - this.Label40.TabIndex = 40; - this.Label40.Text = "Verticale"; + Label40.AutoSize = true; + Label40.Location = new Point(11, 80); + Label40.Margin = new Padding(4, 0, 4, 0); + Label40.Name = "Label40"; + Label40.Size = new Size(66, 20); + Label40.TabIndex = 40; + Label40.Text = "Verticale"; // // TextBox29 // - this.TextBox29.Location = new System.Drawing.Point(72, 49); - this.TextBox29.Multiline = true; - this.TextBox29.Name = "TextBox29"; - this.TextBox29.Size = new System.Drawing.Size(408, 44); - this.TextBox29.TabIndex = 39; + TextBox29.Location = new Point(96, 75); + TextBox29.Margin = new Padding(4, 5, 4, 5); + TextBox29.Multiline = true; + TextBox29.Name = "TextBox29"; + TextBox29.Size = new Size(543, 66); + TextBox29.TabIndex = 39; // // TextBox18 // - this.TextBox18.Location = new System.Drawing.Point(232, 156); - this.TextBox18.Name = "TextBox18"; - this.TextBox18.Size = new System.Drawing.Size(100, 20); - this.TextBox18.TabIndex = 38; + TextBox18.Location = new Point(309, 240); + TextBox18.Margin = new Padding(4, 5, 4, 5); + TextBox18.Name = "TextBox18"; + TextBox18.Size = new Size(132, 27); + TextBox18.TabIndex = 38; // // Label26 // - this.Label26.AutoSize = true; - this.Label26.ForeColor = System.Drawing.Color.Black; - this.Label26.Location = new System.Drawing.Point(344, 156); - this.Label26.Name = "Label26"; - this.Label26.Size = new System.Drawing.Size(48, 13); - this.Label26.TabIndex = 37; - this.Label26.Text = "partenza"; + Label26.AutoSize = true; + Label26.ForeColor = Color.Black; + Label26.Location = new Point(459, 240); + Label26.Margin = new Padding(4, 0, 4, 0); + Label26.Name = "Label26"; + Label26.Size = new Size(67, 20); + Label26.TabIndex = 37; + Label26.Text = "partenza"; // // DateTimePicker1 // - this.DateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.Time; - this.DateTimePicker1.Location = new System.Drawing.Point(392, 156); - this.DateTimePicker1.Name = "DateTimePicker1"; - this.DateTimePicker1.Size = new System.Drawing.Size(88, 20); - this.DateTimePicker1.TabIndex = 36; + DateTimePicker1.Format = DateTimePickerFormat.Time; + DateTimePicker1.Location = new Point(523, 240); + DateTimePicker1.Margin = new Padding(4, 5, 4, 5); + DateTimePicker1.Name = "DateTimePicker1"; + DateTimePicker1.Size = new Size(116, 27); + DateTimePicker1.TabIndex = 36; // // CheckBox8 // - this.CheckBox8.ForeColor = System.Drawing.Color.Black; - this.CheckBox8.Location = new System.Drawing.Point(72, 156); - this.CheckBox8.Name = "CheckBox8"; - this.CheckBox8.Size = new System.Drawing.Size(56, 16); - this.CheckBox8.TabIndex = 35; - this.CheckBox8.Text = "Orario"; + CheckBox8.ForeColor = Color.Black; + CheckBox8.Location = new Point(96, 240); + CheckBox8.Margin = new Padding(4, 5, 4, 5); + CheckBox8.Name = "CheckBox8"; + CheckBox8.Size = new Size(75, 25); + CheckBox8.TabIndex = 35; + CheckBox8.Text = "Orario"; // // TextBox9 // - this.TextBox9.Location = new System.Drawing.Point(120, 108); - this.TextBox9.Name = "TextBox9"; - this.TextBox9.Size = new System.Drawing.Size(56, 20); - this.TextBox9.TabIndex = 20; - this.TextBox9.Text = "TextBox9"; + TextBox9.Location = new Point(160, 166); + TextBox9.Margin = new Padding(4, 5, 4, 5); + TextBox9.Name = "TextBox9"; + TextBox9.Size = new Size(73, 27); + TextBox9.TabIndex = 20; + TextBox9.Text = "TextBox9"; // // CheckBox7 // - this.CheckBox7.ForeColor = System.Drawing.Color.Black; - this.CheckBox7.Location = new System.Drawing.Point(136, 156); - this.CheckBox7.Name = "CheckBox7"; - this.CheckBox7.Size = new System.Drawing.Size(88, 16); - this.CheckBox7.TabIndex = 34; - this.CheckBox7.Text = "Tempo gara"; + CheckBox7.ForeColor = Color.Black; + CheckBox7.Location = new Point(181, 240); + CheckBox7.Margin = new Padding(4, 5, 4, 5); + CheckBox7.Name = "CheckBox7"; + CheckBox7.Size = new Size(117, 25); + CheckBox7.TabIndex = 34; + CheckBox7.Text = "Tempo gara"; // // Label4 // - this.Label4.AutoSize = true; - this.Label4.ForeColor = System.Drawing.Color.Black; - this.Label4.Location = new System.Drawing.Point(8, 24); - this.Label4.Name = "Label4"; - this.Label4.Size = new System.Drawing.Size(59, 13); - this.Label4.TabIndex = 9; - this.Label4.Text = "Orizzontale"; + Label4.AutoSize = true; + Label4.ForeColor = Color.Black; + Label4.Location = new Point(11, 37); + Label4.Margin = new Padding(4, 0, 4, 0); + Label4.Name = "Label4"; + Label4.Size = new Size(85, 20); + Label4.TabIndex = 9; + Label4.Text = "Orizzontale"; // // TextBox4 // - this.TextBox4.Location = new System.Drawing.Point(72, 24); - this.TextBox4.Name = "TextBox4"; - this.TextBox4.Size = new System.Drawing.Size(408, 20); - this.TextBox4.TabIndex = 8; - this.TextBox4.Text = "TextBox4"; + TextBox4.Location = new Point(96, 37); + TextBox4.Margin = new Padding(4, 5, 4, 5); + TextBox4.Name = "TextBox4"; + TextBox4.Size = new Size(543, 27); + TextBox4.TabIndex = 8; + TextBox4.Text = "TextBox4"; // // Label9 // - this.Label9.AutoSize = true; - this.Label9.ForeColor = System.Drawing.Color.Black; - this.Label9.Location = new System.Drawing.Point(8, 108); - this.Label9.Name = "Label9"; - this.Label9.Size = new System.Drawing.Size(110, 13); - this.Label9.TabIndex = 19; - this.Label9.Text = "Trasparenza (0-100%)"; + Label9.AutoSize = true; + Label9.ForeColor = Color.Black; + Label9.Location = new Point(11, 166); + Label9.Margin = new Padding(4, 0, 4, 0); + Label9.Name = "Label9"; + Label9.Size = new Size(152, 20); + Label9.TabIndex = 19; + Label9.Text = "Trasparenza (0-100%)"; // // Label13 // - this.Label13.AutoSize = true; - this.Label13.ForeColor = System.Drawing.Color.Black; - this.Label13.Location = new System.Drawing.Point(16, 132); - this.Label13.Name = "Label13"; - this.Label13.Size = new System.Drawing.Size(52, 13); - this.Label13.TabIndex = 29; - this.Label13.Text = "Posizione"; + Label13.AutoSize = true; + Label13.ForeColor = Color.Black; + Label13.Location = new Point(21, 203); + Label13.Margin = new Padding(4, 0, 4, 0); + Label13.Name = "Label13"; + Label13.Size = new Size(71, 20); + Label13.TabIndex = 29; + Label13.Text = "Posizione"; // // ComboBox1 // - this.ComboBox1.Location = new System.Drawing.Point(72, 132); - this.ComboBox1.Name = "ComboBox1"; - this.ComboBox1.Size = new System.Drawing.Size(104, 21); - this.ComboBox1.TabIndex = 28; - this.ComboBox1.Text = "ComboBox1"; + ComboBox1.Location = new Point(96, 203); + ComboBox1.Margin = new Padding(4, 5, 4, 5); + ComboBox1.Name = "ComboBox1"; + ComboBox1.Size = new Size(137, 28); + ComboBox1.TabIndex = 28; + ComboBox1.Text = "ComboBox1"; // // ComboBox2 // - this.ComboBox2.Location = new System.Drawing.Point(376, 132); - this.ComboBox2.Name = "ComboBox2"; - this.ComboBox2.Size = new System.Drawing.Size(104, 21); - this.ComboBox2.TabIndex = 31; - this.ComboBox2.Text = "ComboBox2"; + ComboBox2.Location = new Point(501, 203); + ComboBox2.Margin = new Padding(4, 5, 4, 5); + ComboBox2.Name = "ComboBox2"; + ComboBox2.Size = new Size(137, 28); + ComboBox2.TabIndex = 31; + ComboBox2.Text = "ComboBox2"; // // Label14 // - this.Label14.AutoSize = true; - this.Label14.ForeColor = System.Drawing.Color.Black; - this.Label14.Location = new System.Drawing.Point(304, 132); - this.Label14.Name = "Label14"; - this.Label14.Size = new System.Drawing.Size(67, 13); - this.Label14.TabIndex = 30; - this.Label14.Text = "Allineamento"; + Label14.AutoSize = true; + Label14.ForeColor = Color.Black; + Label14.Location = new Point(405, 203); + Label14.Margin = new Padding(4, 0, 4, 0); + Label14.Name = "Label14"; + Label14.Size = new Size(98, 20); + Label14.TabIndex = 30; + Label14.Text = "Allineamento"; // // TextBox12 // - this.TextBox12.Location = new System.Drawing.Point(376, 108); - this.TextBox12.Name = "TextBox12"; - this.TextBox12.Size = new System.Drawing.Size(104, 20); - this.TextBox12.TabIndex = 33; - this.TextBox12.Text = "TextBox12"; + TextBox12.Location = new Point(501, 166); + TextBox12.Margin = new Padding(4, 5, 4, 5); + TextBox12.Name = "TextBox12"; + TextBox12.Size = new Size(137, 27); + TextBox12.TabIndex = 33; + TextBox12.Text = "TextBox12"; // // Label15 // - this.Label15.AutoSize = true; - this.Label15.ForeColor = System.Drawing.Color.Black; - this.Label15.Location = new System.Drawing.Point(296, 108); - this.Label15.Name = "Label15"; - this.Label15.Size = new System.Drawing.Size(75, 13); - this.Label15.TabIndex = 32; - this.Label15.Text = "Margine (pixel)"; + Label15.AutoSize = true; + Label15.ForeColor = Color.Black; + Label15.Location = new Point(395, 166); + Label15.Margin = new Padding(4, 0, 4, 0); + Label15.Name = "Label15"; + Label15.Size = new Size(110, 20); + Label15.TabIndex = 32; + Label15.Text = "Margine (pixel)"; // // TabPage2 // - this.TabPage2.Controls.Add(this.GroupBox2); - this.TabPage2.Location = new System.Drawing.Point(4, 22); - this.TabPage2.Name = "TabPage2"; - this.TabPage2.Padding = new System.Windows.Forms.Padding(3); - this.TabPage2.Size = new System.Drawing.Size(513, 351); - this.TabPage2.TabIndex = 5; - this.TabPage2.Text = "Foto"; - this.TabPage2.UseVisualStyleBackColor = true; + TabPage2.Controls.Add(GroupBox2); + TabPage2.Location = new Point(4, 29); + TabPage2.Margin = new Padding(4, 5, 4, 5); + TabPage2.Name = "TabPage2"; + TabPage2.Padding = new Padding(4, 5, 4, 5); + TabPage2.Size = new Size(687, 547); + TabPage2.TabIndex = 5; + TabPage2.Text = "Foto"; + TabPage2.UseVisualStyleBackColor = true; // // GroupBox2 // - this.GroupBox2.Controls.Add(this.Label45); - this.GroupBox2.Controls.Add(this.TextBox32); - this.GroupBox2.Controls.Add(this.TextBox26); - this.GroupBox2.Controls.Add(this.Label37); - this.GroupBox2.Controls.Add(this.Label38); - this.GroupBox2.Controls.Add(this.TextBox27); - this.GroupBox2.Controls.Add(this.Label39); - this.GroupBox2.Controls.Add(this.TextBox28); - this.GroupBox2.Controls.Add(this.CheckBox15); - this.GroupBox2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192))))); - this.GroupBox2.Location = new System.Drawing.Point(3, 6); - this.GroupBox2.Name = "GroupBox2"; - this.GroupBox2.Size = new System.Drawing.Size(304, 156); - this.GroupBox2.TabIndex = 36; - this.GroupBox2.TabStop = false; - this.GroupBox2.Text = "Foto grande"; + GroupBox2.Controls.Add(Label45); + GroupBox2.Controls.Add(TextBox32); + GroupBox2.Controls.Add(TextBox26); + GroupBox2.Controls.Add(Label37); + GroupBox2.Controls.Add(Label38); + GroupBox2.Controls.Add(TextBox27); + GroupBox2.Controls.Add(Label39); + GroupBox2.Controls.Add(TextBox28); + GroupBox2.Controls.Add(CheckBox15); + GroupBox2.ForeColor = Color.FromArgb(0, 0, 192); + GroupBox2.Location = new Point(4, 9); + GroupBox2.Margin = new Padding(4, 5, 4, 5); + GroupBox2.Name = "GroupBox2"; + GroupBox2.Padding = new Padding(4, 5, 4, 5); + GroupBox2.Size = new Size(405, 240); + GroupBox2.TabIndex = 36; + GroupBox2.TabStop = false; + GroupBox2.Text = "Foto grande"; // // Label45 // - this.Label45.AutoSize = true; - this.Label45.Location = new System.Drawing.Point(11, 86); - this.Label45.Name = "Label45"; - this.Label45.Size = new System.Drawing.Size(40, 13); - this.Label45.TabIndex = 22; - this.Label45.Text = "Qualità"; + Label45.AutoSize = true; + Label45.Location = new Point(15, 132); + Label45.Margin = new Padding(4, 0, 4, 0); + Label45.Name = "Label45"; + Label45.Size = new Size(57, 20); + Label45.TabIndex = 22; + Label45.Text = "Qualità"; // // TextBox32 // - this.TextBox32.Location = new System.Drawing.Point(72, 80); - this.TextBox32.Name = "TextBox32"; - this.TextBox32.Size = new System.Drawing.Size(72, 20); - this.TextBox32.TabIndex = 21; - this.TextBox32.Text = "100"; + TextBox32.Location = new Point(96, 123); + TextBox32.Margin = new Padding(4, 5, 4, 5); + TextBox32.Name = "TextBox32"; + TextBox32.Size = new Size(95, 27); + TextBox32.TabIndex = 21; + TextBox32.Text = "100"; // // TextBox26 // - this.TextBox26.Location = new System.Drawing.Point(224, 48); - this.TextBox26.Name = "TextBox26"; - this.TextBox26.Size = new System.Drawing.Size(56, 20); - this.TextBox26.TabIndex = 20; - this.TextBox26.Text = "TextBox26"; + TextBox26.Location = new Point(299, 74); + TextBox26.Margin = new Padding(4, 5, 4, 5); + TextBox26.Name = "TextBox26"; + TextBox26.Size = new Size(73, 27); + TextBox26.TabIndex = 20; + TextBox26.Text = "TextBox26"; // // Label37 // - this.Label37.ForeColor = System.Drawing.Color.Black; - this.Label37.Location = new System.Drawing.Point(168, 48); - this.Label37.Name = "Label37"; - this.Label37.Size = new System.Drawing.Size(48, 16); - this.Label37.TabIndex = 19; - this.Label37.Text = "Suffisso"; - this.Label37.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + Label37.ForeColor = Color.Black; + Label37.Location = new Point(224, 74); + Label37.Margin = new Padding(4, 0, 4, 0); + Label37.Name = "Label37"; + Label37.Size = new Size(64, 25); + Label37.TabIndex = 19; + Label37.Text = "Suffisso"; + Label37.TextAlign = ContentAlignment.MiddleRight; // // Label38 // - this.Label38.AutoSize = true; - this.Label38.ForeColor = System.Drawing.Color.Black; - this.Label38.Location = new System.Drawing.Point(24, 24); - this.Label38.Name = "Label38"; - this.Label38.Size = new System.Drawing.Size(41, 13); - this.Label38.TabIndex = 16; - this.Label38.Text = "Altezza"; + Label38.AutoSize = true; + Label38.ForeColor = Color.Black; + Label38.Location = new Point(32, 37); + Label38.Margin = new Padding(4, 0, 4, 0); + Label38.Name = "Label38"; + Label38.Size = new Size(58, 20); + Label38.TabIndex = 16; + Label38.Text = "Altezza"; // // TextBox27 // - this.TextBox27.Location = new System.Drawing.Point(72, 24); - this.TextBox27.Name = "TextBox27"; - this.TextBox27.Size = new System.Drawing.Size(72, 20); - this.TextBox27.TabIndex = 14; - this.TextBox27.Text = "TextBox27"; + TextBox27.Location = new Point(96, 37); + TextBox27.Margin = new Padding(4, 5, 4, 5); + TextBox27.Name = "TextBox27"; + TextBox27.Size = new Size(95, 27); + TextBox27.TabIndex = 14; + TextBox27.Text = "TextBox27"; // // Label39 // - this.Label39.AutoSize = true; - this.Label39.ForeColor = System.Drawing.Color.Black; - this.Label39.Location = new System.Drawing.Point(8, 48); - this.Label39.Name = "Label39"; - this.Label39.Size = new System.Drawing.Size(56, 13); - this.Label39.TabIndex = 17; - this.Label39.Text = "Larghezza"; + Label39.AutoSize = true; + Label39.ForeColor = Color.Black; + Label39.Location = new Point(11, 74); + Label39.Margin = new Padding(4, 0, 4, 0); + Label39.Name = "Label39"; + Label39.Size = new Size(76, 20); + Label39.TabIndex = 17; + Label39.Text = "Larghezza"; // // TextBox28 // - this.TextBox28.Location = new System.Drawing.Point(72, 48); - this.TextBox28.Name = "TextBox28"; - this.TextBox28.Size = new System.Drawing.Size(72, 20); - this.TextBox28.TabIndex = 15; - this.TextBox28.Text = "TextBox28"; + TextBox28.Location = new Point(96, 74); + TextBox28.Margin = new Padding(4, 5, 4, 5); + TextBox28.Name = "TextBox28"; + TextBox28.Size = new Size(95, 27); + TextBox28.TabIndex = 15; + TextBox28.Text = "TextBox28"; // // CheckBox15 // - this.CheckBox15.Checked = true; - this.CheckBox15.CheckState = System.Windows.Forms.CheckState.Checked; - this.CheckBox15.ForeColor = System.Drawing.Color.Black; - this.CheckBox15.Location = new System.Drawing.Point(168, 16); - this.CheckBox15.Name = "CheckBox15"; - this.CheckBox15.Size = new System.Drawing.Size(120, 32); - this.CheckBox15.TabIndex = 18; - this.CheckBox15.Text = "Mantieni dimensioni originali"; + CheckBox15.Checked = true; + CheckBox15.CheckState = CheckState.Checked; + CheckBox15.ForeColor = Color.Black; + CheckBox15.Location = new Point(224, 25); + CheckBox15.Margin = new Padding(4, 5, 4, 5); + CheckBox15.Name = "CheckBox15"; + CheckBox15.Size = new Size(160, 49); + CheckBox15.TabIndex = 18; + CheckBox15.Text = "Mantieni dimensioni originali"; // // TabPage1 // - this.TabPage1.Controls.Add(this.Panel1); - this.TabPage1.Controls.Add(this.GroupBox1); - this.TabPage1.Location = new System.Drawing.Point(4, 22); - this.TabPage1.Name = "TabPage1"; - this.TabPage1.Padding = new System.Windows.Forms.Padding(3); - this.TabPage1.Size = new System.Drawing.Size(513, 351); - this.TabPage1.TabIndex = 0; - this.TabPage1.Text = "Miniature"; - this.TabPage1.UseVisualStyleBackColor = true; + TabPage1.Controls.Add(Panel1); + TabPage1.Controls.Add(GroupBox1); + TabPage1.Location = new Point(4, 29); + TabPage1.Margin = new Padding(4, 5, 4, 5); + TabPage1.Name = "TabPage1"; + TabPage1.Padding = new Padding(4, 5, 4, 5); + TabPage1.Size = new Size(687, 547); + TabPage1.TabIndex = 0; + TabPage1.Text = "Miniature"; + TabPage1.UseVisualStyleBackColor = true; // // Panel1 // - this.Panel1.Controls.Add(this._CheckBox18); - this.Panel1.Controls.Add(this._CheckBox4); - this.Panel1.Controls.Add(this._CheckBox12); - this.Panel1.Location = new System.Drawing.Point(52, 236); - this.Panel1.Name = "Panel1"; - this.Panel1.Size = new System.Drawing.Size(304, 73); - this.Panel1.TabIndex = 26; - this.Panel1.Visible = false; + Panel1.Controls.Add(_CheckBox18); + Panel1.Controls.Add(_CheckBox4); + Panel1.Controls.Add(_CheckBox12); + Panel1.Location = new Point(69, 363); + Panel1.Margin = new Padding(4, 5, 4, 5); + Panel1.Name = "Panel1"; + Panel1.Size = new Size(405, 112); + Panel1.TabIndex = 26; + Panel1.Visible = false; // // _CheckBox18 // - this._CheckBox18.AutoSize = true; - this._CheckBox18.Location = new System.Drawing.Point(140, 3); - this._CheckBox18.Name = "_CheckBox18"; - this._CheckBox18.Size = new System.Drawing.Size(84, 17); - this._CheckBox18.TabIndex = 36; - this._CheckBox18.Text = "Numero foto"; - this._CheckBox18.UseVisualStyleBackColor = true; - this._CheckBox18.CheckedChanged += new System.EventHandler(this.CheckBox18_CheckedChanged); + _CheckBox18.AutoSize = true; + _CheckBox18.Location = new Point(187, 5); + _CheckBox18.Margin = new Padding(4, 5, 4, 5); + _CheckBox18.Name = "_CheckBox18"; + _CheckBox18.Size = new Size(117, 24); + _CheckBox18.TabIndex = 36; + _CheckBox18.Text = "Numero foto"; + _CheckBox18.UseVisualStyleBackColor = true; + _CheckBox18.CheckedChanged += CheckBox18_CheckedChanged; // // _CheckBox4 // - this._CheckBox4.ForeColor = System.Drawing.Color.Black; - this._CheckBox4.Location = new System.Drawing.Point(10, 3); - this._CheckBox4.Name = "_CheckBox4"; - this._CheckBox4.Size = new System.Drawing.Size(104, 17); - this._CheckBox4.TabIndex = 34; - this._CheckBox4.Text = "Aggiungi scritta"; - this._CheckBox4.CheckedChanged += new System.EventHandler(this.CheckBox4_CheckedChanged); + _CheckBox4.ForeColor = Color.Black; + _CheckBox4.Location = new Point(13, 5); + _CheckBox4.Margin = new Padding(4, 5, 4, 5); + _CheckBox4.Name = "_CheckBox4"; + _CheckBox4.Size = new Size(139, 26); + _CheckBox4.TabIndex = 34; + _CheckBox4.Text = "Aggiungi scritta"; + _CheckBox4.CheckedChanged += CheckBox4_CheckedChanged; // // _CheckBox12 // - this._CheckBox12.ForeColor = System.Drawing.Color.Black; - this._CheckBox12.Location = new System.Drawing.Point(10, 19); - this._CheckBox12.Name = "_CheckBox12"; - this._CheckBox12.Size = new System.Drawing.Size(104, 21); - this._CheckBox12.TabIndex = 35; - this._CheckBox12.Text = "Aggiungi orario"; - this._CheckBox12.CheckedChanged += new System.EventHandler(this.CheckBox12_CheckedChanged); + _CheckBox12.ForeColor = Color.Black; + _CheckBox12.Location = new Point(13, 29); + _CheckBox12.Margin = new Padding(4, 5, 4, 5); + _CheckBox12.Name = "_CheckBox12"; + _CheckBox12.Size = new Size(139, 32); + _CheckBox12.TabIndex = 35; + _CheckBox12.Text = "Aggiungi orario"; + _CheckBox12.CheckedChanged += CheckBox12_CheckedChanged; // // GroupBox1 // - this.GroupBox1.Controls.Add(this.Label46); - this.GroupBox1.Controls.Add(this.TextBox33); - this.GroupBox1.Controls.Add(this.Panel2); - this.GroupBox1.Controls.Add(this.Label5); - this.GroupBox1.Controls.Add(this.TextBox5); - this.GroupBox1.Controls.Add(this.Label6); - this.GroupBox1.Controls.Add(this.TextBox6); - this.GroupBox1.Controls.Add(this.Label3); - this.GroupBox1.Controls.Add(this.TextBox3); - this.GroupBox1.Controls.Add(this.CheckBox1); - this.GroupBox1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192))))); - this.GroupBox1.Location = new System.Drawing.Point(6, 5); - this.GroupBox1.Name = "GroupBox1"; - this.GroupBox1.Size = new System.Drawing.Size(350, 210); - this.GroupBox1.TabIndex = 25; - this.GroupBox1.TabStop = false; - this.GroupBox1.Text = "Miniature"; + GroupBox1.Controls.Add(Label46); + GroupBox1.Controls.Add(TextBox33); + GroupBox1.Controls.Add(Panel2); + GroupBox1.Controls.Add(Label5); + GroupBox1.Controls.Add(TextBox5); + GroupBox1.Controls.Add(Label6); + GroupBox1.Controls.Add(TextBox6); + GroupBox1.Controls.Add(Label3); + GroupBox1.Controls.Add(TextBox3); + GroupBox1.Controls.Add(CheckBox1); + GroupBox1.ForeColor = Color.FromArgb(0, 0, 192); + GroupBox1.Location = new Point(8, 8); + GroupBox1.Margin = new Padding(4, 5, 4, 5); + GroupBox1.Name = "GroupBox1"; + GroupBox1.Padding = new Padding(4, 5, 4, 5); + GroupBox1.Size = new Size(467, 323); + GroupBox1.TabIndex = 25; + GroupBox1.TabStop = false; + GroupBox1.Text = "Miniature"; // // Label46 // - this.Label46.AutoSize = true; - this.Label46.Location = new System.Drawing.Point(198, 43); - this.Label46.Name = "Label46"; - this.Label46.Size = new System.Drawing.Size(40, 13); - this.Label46.TabIndex = 21; - this.Label46.Text = "Qualità"; + Label46.AutoSize = true; + Label46.Location = new Point(264, 66); + Label46.Margin = new Padding(4, 0, 4, 0); + Label46.Name = "Label46"; + Label46.Size = new Size(57, 20); + Label46.TabIndex = 21; + Label46.Text = "Qualità"; // // TextBox33 // - this.TextBox33.Location = new System.Drawing.Point(244, 40); - this.TextBox33.Name = "TextBox33"; - this.TextBox33.Size = new System.Drawing.Size(100, 20); - this.TextBox33.TabIndex = 20; + TextBox33.Location = new Point(325, 62); + TextBox33.Margin = new Padding(4, 5, 4, 5); + TextBox33.Name = "TextBox33"; + TextBox33.Size = new Size(132, 27); + TextBox33.TabIndex = 20; // // Panel2 // - this.Panel2.Controls.Add(this.RadioButton3); - this.Panel2.Controls.Add(this.RadioButton7); - this.Panel2.Controls.Add(this.RadioButton4); - this.Panel2.Controls.Add(this.RadioButton6); - this.Panel2.Controls.Add(this.RadioButton5); - this.Panel2.Location = new System.Drawing.Point(56, 114); - this.Panel2.Name = "Panel2"; - this.Panel2.Size = new System.Drawing.Size(235, 90); - this.Panel2.TabIndex = 19; + Panel2.Controls.Add(RadioButton3); + Panel2.Controls.Add(RadioButton7); + Panel2.Controls.Add(RadioButton4); + Panel2.Controls.Add(RadioButton6); + Panel2.Controls.Add(RadioButton5); + Panel2.Location = new Point(75, 175); + Panel2.Margin = new Padding(4, 5, 4, 5); + Panel2.Name = "Panel2"; + Panel2.Size = new Size(313, 138); + Panel2.TabIndex = 19; // // RadioButton3 // - this.RadioButton3.AutoSize = true; - this.RadioButton3.Location = new System.Drawing.Point(15, 16); - this.RadioButton3.Name = "RadioButton3"; - this.RadioButton3.Size = new System.Drawing.Size(99, 17); - this.RadioButton3.TabIndex = 14; - this.RadioButton3.TabStop = true; - this.RadioButton3.Text = "Aggiungi Scritta"; - this.RadioButton3.UseVisualStyleBackColor = true; + RadioButton3.AutoSize = true; + RadioButton3.Location = new Point(20, 25); + RadioButton3.Margin = new Padding(4, 5, 4, 5); + RadioButton3.Name = "RadioButton3"; + RadioButton3.Size = new Size(137, 24); + RadioButton3.TabIndex = 14; + RadioButton3.TabStop = true; + RadioButton3.Text = "Aggiungi Scritta"; + RadioButton3.UseVisualStyleBackColor = true; // // RadioButton7 // - this.RadioButton7.AutoSize = true; - this.RadioButton7.Location = new System.Drawing.Point(129, 40); - this.RadioButton7.Name = "RadioButton7"; - this.RadioButton7.Size = new System.Drawing.Size(95, 17); - this.RadioButton7.TabIndex = 18; - this.RadioButton7.TabStop = true; - this.RadioButton7.Text = "numero+tempo"; - this.RadioButton7.UseVisualStyleBackColor = true; + RadioButton7.AutoSize = true; + RadioButton7.Location = new Point(172, 62); + RadioButton7.Margin = new Padding(4, 5, 4, 5); + RadioButton7.Name = "RadioButton7"; + RadioButton7.Size = new Size(135, 24); + RadioButton7.TabIndex = 18; + RadioButton7.TabStop = true; + RadioButton7.Text = "numero+tempo"; + RadioButton7.UseVisualStyleBackColor = true; // // RadioButton4 // - this.RadioButton4.AutoSize = true; - this.RadioButton4.Location = new System.Drawing.Point(15, 40); - this.RadioButton4.Name = "RadioButton4"; - this.RadioButton4.Size = new System.Drawing.Size(95, 17); - this.RadioButton4.TabIndex = 15; - this.RadioButton4.TabStop = true; - this.RadioButton4.Text = "Aggiungi orario"; - this.RadioButton4.UseVisualStyleBackColor = true; + RadioButton4.AutoSize = true; + RadioButton4.Location = new Point(20, 62); + RadioButton4.Margin = new Padding(4, 5, 4, 5); + RadioButton4.Name = "RadioButton4"; + RadioButton4.Size = new Size(135, 24); + RadioButton4.TabIndex = 15; + RadioButton4.TabStop = true; + RadioButton4.Text = "Aggiungi orario"; + RadioButton4.UseVisualStyleBackColor = true; // // RadioButton6 // - this.RadioButton6.AutoSize = true; - this.RadioButton6.Location = new System.Drawing.Point(129, 16); - this.RadioButton6.Name = "RadioButton6"; - this.RadioButton6.Size = new System.Drawing.Size(83, 17); - this.RadioButton6.TabIndex = 17; - this.RadioButton6.TabStop = true; - this.RadioButton6.Text = "Numero foto"; - this.RadioButton6.UseVisualStyleBackColor = true; + RadioButton6.AutoSize = true; + RadioButton6.Location = new Point(172, 25); + RadioButton6.Margin = new Padding(4, 5, 4, 5); + RadioButton6.Name = "RadioButton6"; + RadioButton6.Size = new Size(116, 24); + RadioButton6.TabIndex = 17; + RadioButton6.TabStop = true; + RadioButton6.Text = "Numero foto"; + RadioButton6.UseVisualStyleBackColor = true; // // RadioButton5 // - this.RadioButton5.AutoSize = true; - this.RadioButton5.Location = new System.Drawing.Point(15, 65); - this.RadioButton5.Name = "RadioButton5"; - this.RadioButton5.Size = new System.Drawing.Size(84, 17); - this.RadioButton5.TabIndex = 16; - this.RadioButton5.TabStop = true; - this.RadioButton5.Text = "Tempo Gara"; - this.RadioButton5.UseVisualStyleBackColor = true; + RadioButton5.AutoSize = true; + RadioButton5.Location = new Point(20, 100); + RadioButton5.Margin = new Padding(4, 5, 4, 5); + RadioButton5.Name = "RadioButton5"; + RadioButton5.Size = new Size(111, 24); + RadioButton5.TabIndex = 16; + RadioButton5.TabStop = true; + RadioButton5.Text = "Tempo Gara"; + RadioButton5.UseVisualStyleBackColor = true; // // Label5 // - this.Label5.AutoSize = true; - this.Label5.ForeColor = System.Drawing.Color.Black; - this.Label5.Location = new System.Drawing.Point(24, 88); - this.Label5.Name = "Label5"; - this.Label5.Size = new System.Drawing.Size(41, 13); - this.Label5.TabIndex = 12; - this.Label5.Text = "Altezza"; + Label5.AutoSize = true; + Label5.ForeColor = Color.Black; + Label5.Location = new Point(32, 135); + Label5.Margin = new Padding(4, 0, 4, 0); + Label5.Name = "Label5"; + Label5.Size = new Size(58, 20); + Label5.TabIndex = 12; + Label5.Text = "Altezza"; // // TextBox5 // - this.TextBox5.Location = new System.Drawing.Point(72, 64); - this.TextBox5.Name = "TextBox5"; - this.TextBox5.Size = new System.Drawing.Size(88, 20); - this.TextBox5.TabIndex = 10; - this.TextBox5.Text = "TextBox5"; + TextBox5.Location = new Point(96, 98); + TextBox5.Margin = new Padding(4, 5, 4, 5); + TextBox5.Name = "TextBox5"; + TextBox5.Size = new Size(116, 27); + TextBox5.TabIndex = 10; + TextBox5.Text = "TextBox5"; // // Label6 // - this.Label6.AutoSize = true; - this.Label6.ForeColor = System.Drawing.Color.Black; - this.Label6.Location = new System.Drawing.Point(8, 64); - this.Label6.Name = "Label6"; - this.Label6.Size = new System.Drawing.Size(56, 13); - this.Label6.TabIndex = 13; - this.Label6.Text = "Larghezza"; + Label6.AutoSize = true; + Label6.ForeColor = Color.Black; + Label6.Location = new Point(11, 98); + Label6.Margin = new Padding(4, 0, 4, 0); + Label6.Name = "Label6"; + Label6.Size = new Size(76, 20); + Label6.TabIndex = 13; + Label6.Text = "Larghezza"; // // TextBox6 // - this.TextBox6.Location = new System.Drawing.Point(72, 88); - this.TextBox6.Name = "TextBox6"; - this.TextBox6.Size = new System.Drawing.Size(88, 20); - this.TextBox6.TabIndex = 11; - this.TextBox6.Text = "TextBox6"; + TextBox6.Location = new Point(96, 135); + TextBox6.Margin = new Padding(4, 5, 4, 5); + TextBox6.Name = "TextBox6"; + TextBox6.Size = new Size(116, 27); + TextBox6.TabIndex = 11; + TextBox6.Text = "TextBox6"; // // Label3 // - this.Label3.AutoSize = true; - this.Label3.ForeColor = System.Drawing.Color.Black; - this.Label3.Location = new System.Drawing.Point(24, 40); - this.Label3.Name = "Label3"; - this.Label3.Size = new System.Drawing.Size(44, 13); - this.Label3.TabIndex = 7; - this.Label3.Text = "Suffisso"; + Label3.AutoSize = true; + Label3.ForeColor = Color.Black; + Label3.Location = new Point(32, 62); + Label3.Margin = new Padding(4, 0, 4, 0); + Label3.Name = "Label3"; + Label3.Size = new Size(60, 20); + Label3.TabIndex = 7; + Label3.Text = "Suffisso"; // // TextBox3 // - this.TextBox3.Location = new System.Drawing.Point(72, 40); - this.TextBox3.Name = "TextBox3"; - this.TextBox3.Size = new System.Drawing.Size(88, 20); - this.TextBox3.TabIndex = 6; - this.TextBox3.Text = "TextBox3"; + TextBox3.Location = new Point(96, 62); + TextBox3.Margin = new Padding(4, 5, 4, 5); + TextBox3.Name = "TextBox3"; + TextBox3.Size = new Size(116, 27); + TextBox3.TabIndex = 6; + TextBox3.Text = "TextBox3"; // // CheckBox1 // - this.CheckBox1.ForeColor = System.Drawing.Color.Black; - this.CheckBox1.Location = new System.Drawing.Point(72, 16); - this.CheckBox1.Name = "CheckBox1"; - this.CheckBox1.Size = new System.Drawing.Size(104, 24); - this.CheckBox1.TabIndex = 5; - this.CheckBox1.Text = "Crea miniature"; + CheckBox1.ForeColor = Color.Black; + CheckBox1.Location = new Point(96, 25); + CheckBox1.Margin = new Padding(4, 5, 4, 5); + CheckBox1.Name = "CheckBox1"; + CheckBox1.Size = new Size(139, 37); + CheckBox1.TabIndex = 5; + CheckBox1.Text = "Crea miniature"; // // TabPage4 // - this.TabPage4.Controls.Add(this.GroupBox6); - this.TabPage4.Location = new System.Drawing.Point(4, 22); - this.TabPage4.Name = "TabPage4"; - this.TabPage4.Padding = new System.Windows.Forms.Padding(3); - this.TabPage4.Size = new System.Drawing.Size(513, 351); - this.TabPage4.TabIndex = 3; - this.TabPage4.Text = "Logo"; - this.TabPage4.UseVisualStyleBackColor = true; + TabPage4.Controls.Add(GroupBox6); + TabPage4.Location = new Point(4, 29); + TabPage4.Margin = new Padding(4, 5, 4, 5); + TabPage4.Name = "TabPage4"; + TabPage4.Padding = new Padding(4, 5, 4, 5); + TabPage4.Size = new Size(687, 547); + TabPage4.TabIndex = 3; + TabPage4.Text = "Logo"; + TabPage4.UseVisualStyleBackColor = true; // // GroupBox6 // - this.GroupBox6.Controls.Add(this.PictureBox2); - this.GroupBox6.Controls.Add(this._PictureBox1); - this.GroupBox6.Controls.Add(this.ComboBox5); - this.GroupBox6.Controls.Add(this.ComboBox4); - this.GroupBox6.Controls.Add(this.TextBox19); - this.GroupBox6.Controls.Add(this.Label28); - this.GroupBox6.Controls.Add(this.CheckBox5); - this.GroupBox6.Controls.Add(this.TextBox15); - this.GroupBox6.Controls.Add(this.TextBox14); - this.GroupBox6.Controls.Add(this.Label25); - this.GroupBox6.Controls.Add(this.TextBox16); - this.GroupBox6.Controls.Add(this.Label24); - this.GroupBox6.Controls.Add(this.Label22); - this.GroupBox6.Controls.Add(this.Label23); - this.GroupBox6.Controls.Add(this._Button4); - this.GroupBox6.Controls.Add(this.TextBox10); - this.GroupBox6.Controls.Add(this.Label29); - this.GroupBox6.Controls.Add(this.Label30); - this.GroupBox6.Controls.Add(this.PictureBox3); - this.GroupBox6.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192))))); - this.GroupBox6.Location = new System.Drawing.Point(6, 6); - this.GroupBox6.Name = "GroupBox6"; - this.GroupBox6.Size = new System.Drawing.Size(496, 224); - this.GroupBox6.TabIndex = 42; - this.GroupBox6.TabStop = false; - this.GroupBox6.Text = "Logo"; + GroupBox6.Controls.Add(PictureBox2); + GroupBox6.Controls.Add(_PictureBox1); + GroupBox6.Controls.Add(ComboBox5); + GroupBox6.Controls.Add(ComboBox4); + GroupBox6.Controls.Add(TextBox19); + GroupBox6.Controls.Add(Label28); + GroupBox6.Controls.Add(CheckBox5); + GroupBox6.Controls.Add(TextBox15); + GroupBox6.Controls.Add(TextBox14); + GroupBox6.Controls.Add(Label25); + GroupBox6.Controls.Add(TextBox16); + GroupBox6.Controls.Add(Label24); + GroupBox6.Controls.Add(Label22); + GroupBox6.Controls.Add(Label23); + GroupBox6.Controls.Add(_Button4); + GroupBox6.Controls.Add(TextBox10); + GroupBox6.Controls.Add(Label29); + GroupBox6.Controls.Add(Label30); + GroupBox6.Controls.Add(PictureBox3); + GroupBox6.ForeColor = Color.FromArgb(0, 0, 192); + GroupBox6.Location = new Point(8, 9); + GroupBox6.Margin = new Padding(4, 5, 4, 5); + GroupBox6.Name = "GroupBox6"; + GroupBox6.Padding = new Padding(4, 5, 4, 5); + GroupBox6.Size = new Size(661, 345); + GroupBox6.TabIndex = 42; + GroupBox6.TabStop = false; + GroupBox6.Text = "Logo"; // // PictureBox2 // - this.PictureBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.PictureBox2.Location = new System.Drawing.Point(144, 192); - this.PictureBox2.Name = "PictureBox2"; - this.PictureBox2.Size = new System.Drawing.Size(24, 24); - this.PictureBox2.TabIndex = 44; - this.PictureBox2.TabStop = false; - this.PictureBox2.Visible = false; + PictureBox2.BorderStyle = BorderStyle.FixedSingle; + PictureBox2.Location = new Point(192, 295); + PictureBox2.Margin = new Padding(4, 5, 4, 5); + PictureBox2.Name = "PictureBox2"; + PictureBox2.Size = new Size(31, 36); + PictureBox2.TabIndex = 44; + PictureBox2.TabStop = false; + PictureBox2.Visible = false; // // _PictureBox1 // - this._PictureBox1.Cursor = System.Windows.Forms.Cursors.Cross; - this._PictureBox1.Location = new System.Drawing.Point(256, 56); - this._PictureBox1.Name = "_PictureBox1"; - this._PictureBox1.Size = new System.Drawing.Size(224, 160); - this._PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this._PictureBox1.TabIndex = 43; - this._PictureBox1.TabStop = false; - this._PictureBox1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.PictureBox1_MouseMove); - this._PictureBox1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.PictureBox1_MouseUp); + _PictureBox1.Cursor = Cursors.Cross; + _PictureBox1.Location = new Point(341, 86); + _PictureBox1.Margin = new Padding(4, 5, 4, 5); + _PictureBox1.Name = "_PictureBox1"; + _PictureBox1.Size = new Size(299, 246); + _PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; + _PictureBox1.TabIndex = 43; + _PictureBox1.TabStop = false; + _PictureBox1.MouseMove += PictureBox1_MouseMove; + _PictureBox1.MouseUp += PictureBox1_MouseUp; // // ComboBox5 // - this.ComboBox5.Location = new System.Drawing.Point(144, 168); - this.ComboBox5.Name = "ComboBox5"; - this.ComboBox5.Size = new System.Drawing.Size(96, 21); - this.ComboBox5.TabIndex = 42; - this.ComboBox5.Text = "ComboBox5"; + ComboBox5.Location = new Point(192, 258); + ComboBox5.Margin = new Padding(4, 5, 4, 5); + ComboBox5.Name = "ComboBox5"; + ComboBox5.Size = new Size(127, 28); + ComboBox5.TabIndex = 42; + ComboBox5.Text = "ComboBox5"; // // ComboBox4 // - this.ComboBox4.Location = new System.Drawing.Point(144, 144); - this.ComboBox4.Name = "ComboBox4"; - this.ComboBox4.Size = new System.Drawing.Size(96, 21); - this.ComboBox4.TabIndex = 41; - this.ComboBox4.Text = "ComboBox4"; + ComboBox4.Location = new Point(192, 222); + ComboBox4.Margin = new Padding(4, 5, 4, 5); + ComboBox4.Name = "ComboBox4"; + ComboBox4.Size = new Size(127, 28); + ComboBox4.TabIndex = 41; + ComboBox4.Text = "ComboBox4"; // // TextBox19 // - this.TextBox19.Location = new System.Drawing.Point(144, 96); - this.TextBox19.Name = "TextBox19"; - this.TextBox19.Size = new System.Drawing.Size(96, 20); - this.TextBox19.TabIndex = 40; - this.TextBox19.Text = "TextBox19"; + TextBox19.Location = new Point(192, 148); + TextBox19.Margin = new Padding(4, 5, 4, 5); + TextBox19.Name = "TextBox19"; + TextBox19.Size = new Size(127, 27); + TextBox19.TabIndex = 40; + TextBox19.Text = "TextBox19"; // // Label28 // - this.Label28.ForeColor = System.Drawing.Color.Black; - this.Label28.Location = new System.Drawing.Point(17, 97); - this.Label28.Name = "Label28"; - this.Label28.Size = new System.Drawing.Size(120, 16); - this.Label28.TabIndex = 39; - this.Label28.Text = "Trasparenza (0-100%)"; - this.Label28.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + Label28.ForeColor = Color.Black; + Label28.Location = new Point(23, 149); + Label28.Margin = new Padding(4, 0, 4, 0); + Label28.Name = "Label28"; + Label28.Size = new Size(160, 25); + Label28.TabIndex = 39; + Label28.Text = "Trasparenza (0-100%)"; + Label28.TextAlign = ContentAlignment.MiddleLeft; // // CheckBox5 // - this.CheckBox5.ForeColor = System.Drawing.Color.Black; - this.CheckBox5.Location = new System.Drawing.Point(0, 26); - this.CheckBox5.Name = "CheckBox5"; - this.CheckBox5.Size = new System.Drawing.Size(72, 20); - this.CheckBox5.TabIndex = 38; - this.CheckBox5.Text = "Aggiungi"; + CheckBox5.ForeColor = Color.Black; + CheckBox5.Location = new Point(0, 40); + CheckBox5.Margin = new Padding(4, 5, 4, 5); + CheckBox5.Name = "CheckBox5"; + CheckBox5.Size = new Size(96, 31); + CheckBox5.TabIndex = 38; + CheckBox5.Text = "Aggiungi"; // // TextBox15 // - this.TextBox15.Location = new System.Drawing.Point(144, 72); - this.TextBox15.Name = "TextBox15"; - this.TextBox15.Size = new System.Drawing.Size(96, 20); - this.TextBox15.TabIndex = 19; - this.TextBox15.Text = "TextBox15"; + TextBox15.Location = new Point(192, 111); + TextBox15.Margin = new Padding(4, 5, 4, 5); + TextBox15.Name = "TextBox15"; + TextBox15.Size = new Size(127, 27); + TextBox15.TabIndex = 19; + TextBox15.Text = "TextBox15"; // // TextBox14 // - this.TextBox14.Location = new System.Drawing.Point(144, 48); - this.TextBox14.Name = "TextBox14"; - this.TextBox14.Size = new System.Drawing.Size(96, 20); - this.TextBox14.TabIndex = 18; - this.TextBox14.Text = "TextBox14"; + TextBox14.Location = new Point(192, 74); + TextBox14.Margin = new Padding(4, 5, 4, 5); + TextBox14.Name = "TextBox14"; + TextBox14.Size = new Size(127, 27); + TextBox14.TabIndex = 18; + TextBox14.Text = "TextBox14"; // // Label25 // - this.Label25.AutoSize = true; - this.Label25.ForeColor = System.Drawing.Color.Black; - this.Label25.Location = new System.Drawing.Point(17, 168); - this.Label25.Name = "Label25"; - this.Label25.Size = new System.Drawing.Size(95, 13); - this.Label25.TabIndex = 36; - this.Label25.Text = "Posizione verticale"; - this.Label25.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + Label25.AutoSize = true; + Label25.ForeColor = Color.Black; + Label25.Location = new Point(23, 258); + Label25.Margin = new Padding(4, 0, 4, 0); + Label25.Name = "Label25"; + Label25.Size = new Size(131, 20); + Label25.TabIndex = 36; + Label25.Text = "Posizione verticale"; + Label25.TextAlign = ContentAlignment.MiddleLeft; // // TextBox16 // - this.TextBox16.Location = new System.Drawing.Point(144, 120); - this.TextBox16.Name = "TextBox16"; - this.TextBox16.Size = new System.Drawing.Size(96, 20); - this.TextBox16.TabIndex = 35; - this.TextBox16.Text = "TextBox16"; + TextBox16.Location = new Point(192, 185); + TextBox16.Margin = new Padding(4, 5, 4, 5); + TextBox16.Name = "TextBox16"; + TextBox16.Size = new Size(127, 27); + TextBox16.TabIndex = 35; + TextBox16.Text = "TextBox16"; // // Label24 // - this.Label24.AutoSize = true; - this.Label24.ForeColor = System.Drawing.Color.Black; - this.Label24.Location = new System.Drawing.Point(19, 123); - this.Label24.Name = "Label24"; - this.Label24.Size = new System.Drawing.Size(88, 13); - this.Label24.TabIndex = 34; - this.Label24.Text = "Margine (pixel/%)"; - this.Label24.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + Label24.AutoSize = true; + Label24.ForeColor = Color.Black; + Label24.Location = new Point(25, 189); + Label24.Margin = new Padding(4, 0, 4, 0); + Label24.Name = "Label24"; + Label24.Size = new Size(128, 20); + Label24.TabIndex = 34; + Label24.Text = "Margine (pixel/%)"; + Label24.TextAlign = ContentAlignment.MiddleLeft; // // Label22 // - this.Label22.AutoSize = true; - this.Label22.ForeColor = System.Drawing.Color.Black; - this.Label22.Location = new System.Drawing.Point(19, 51); - this.Label22.Name = "Label22"; - this.Label22.Size = new System.Drawing.Size(41, 13); - this.Label22.TabIndex = 20; - this.Label22.Text = "Altezza"; - this.Label22.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + Label22.AutoSize = true; + Label22.ForeColor = Color.Black; + Label22.Location = new Point(25, 78); + Label22.Margin = new Padding(4, 0, 4, 0); + Label22.Name = "Label22"; + Label22.Size = new Size(58, 20); + Label22.TabIndex = 20; + Label22.Text = "Altezza"; + Label22.TextAlign = ContentAlignment.MiddleLeft; // // Label23 // - this.Label23.AutoSize = true; - this.Label23.ForeColor = System.Drawing.Color.Black; - this.Label23.Location = new System.Drawing.Point(19, 75); - this.Label23.Name = "Label23"; - this.Label23.Size = new System.Drawing.Size(56, 13); - this.Label23.TabIndex = 21; - this.Label23.Text = "Larghezza"; - this.Label23.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + Label23.AutoSize = true; + Label23.ForeColor = Color.Black; + Label23.Location = new Point(25, 115); + Label23.Margin = new Padding(4, 0, 4, 0); + Label23.Name = "Label23"; + Label23.Size = new Size(76, 20); + Label23.TabIndex = 21; + Label23.Text = "Larghezza"; + Label23.TextAlign = ContentAlignment.MiddleLeft; // // _Button4 // - this._Button4.Location = new System.Drawing.Point(464, 24); - this._Button4.Name = "_Button4"; - this._Button4.Size = new System.Drawing.Size(24, 20); - this._Button4.TabIndex = 8; - this._Button4.Text = "..."; - this._Button4.Click += new System.EventHandler(this.Button4_Click); + _Button4.Location = new Point(619, 37); + _Button4.Margin = new Padding(4, 5, 4, 5); + _Button4.Name = "_Button4"; + _Button4.Size = new Size(32, 31); + _Button4.TabIndex = 8; + _Button4.Text = "..."; + _Button4.Click += Button4_Click; // // TextBox10 // - this.TextBox10.Location = new System.Drawing.Point(144, 24); - this.TextBox10.Name = "TextBox10"; - this.TextBox10.Size = new System.Drawing.Size(312, 20); - this.TextBox10.TabIndex = 6; - this.TextBox10.Text = "TextBox10"; + TextBox10.Location = new Point(192, 37); + TextBox10.Margin = new Padding(4, 5, 4, 5); + TextBox10.Name = "TextBox10"; + TextBox10.Size = new Size(415, 27); + TextBox10.TabIndex = 6; + TextBox10.Text = "TextBox10"; // // Label29 // - this.Label29.AutoSize = true; - this.Label29.ForeColor = System.Drawing.Color.Black; - this.Label29.Location = new System.Drawing.Point(17, 147); - this.Label29.Name = "Label29"; - this.Label29.Size = new System.Drawing.Size(105, 13); - this.Label29.TabIndex = 36; - this.Label29.Text = "Posizione orizzontale"; - this.Label29.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + Label29.AutoSize = true; + Label29.ForeColor = Color.Black; + Label29.Location = new Point(23, 226); + Label29.Margin = new Padding(4, 0, 4, 0); + Label29.Name = "Label29"; + Label29.Size = new Size(149, 20); + Label29.TabIndex = 36; + Label29.Text = "Posizione orizzontale"; + Label29.TextAlign = ContentAlignment.MiddleLeft; // // Label30 // - this.Label30.AutoSize = true; - this.Label30.ForeColor = System.Drawing.Color.Black; - this.Label30.Location = new System.Drawing.Point(19, 203); - this.Label30.Name = "Label30"; - this.Label30.Size = new System.Drawing.Size(93, 13); - this.Label30.TabIndex = 36; - this.Label30.Text = "Colore trasparente"; - this.Label30.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.Label30.Visible = false; + Label30.AutoSize = true; + Label30.ForeColor = Color.Black; + Label30.Location = new Point(25, 312); + Label30.Margin = new Padding(4, 0, 4, 0); + Label30.Name = "Label30"; + Label30.Size = new Size(132, 20); + Label30.TabIndex = 36; + Label30.Text = "Colore trasparente"; + Label30.TextAlign = ContentAlignment.MiddleLeft; + Label30.Visible = false; // // PictureBox3 // - this.PictureBox3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.PictureBox3.Location = new System.Drawing.Point(216, 192); - this.PictureBox3.Name = "PictureBox3"; - this.PictureBox3.Size = new System.Drawing.Size(24, 24); - this.PictureBox3.TabIndex = 44; - this.PictureBox3.TabStop = false; - this.PictureBox3.Visible = false; + PictureBox3.BorderStyle = BorderStyle.FixedSingle; + PictureBox3.Location = new Point(288, 295); + PictureBox3.Margin = new Padding(4, 5, 4, 5); + PictureBox3.Name = "PictureBox3"; + PictureBox3.Size = new Size(31, 36); + PictureBox3.TabIndex = 44; + PictureBox3.TabStop = false; + PictureBox3.Visible = false; // // _Label27 // - this._Label27.Location = new System.Drawing.Point(591, 378); - this._Label27.Name = "_Label27"; - this._Label27.Size = new System.Drawing.Size(140, 20); - this._Label27.TabIndex = 62; - this._Label27.Text = "Versione 2.2 2021"; - this._Label27.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - this._Label27.Click += new System.EventHandler(this.Label27_Click); + _Label27.Location = new Point(788, 582); + _Label27.Margin = new Padding(4, 0, 4, 0); + _Label27.Name = "_Label27"; + _Label27.Size = new Size(187, 31); + _Label27.TabIndex = 62; + _Label27.Text = "Versione 2.2 2021"; + _Label27.TextAlign = ContentAlignment.MiddleRight; + _Label27.Click += Label27_Click; // // _Button7 // - this._Button7.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this._Button7.Location = new System.Drawing.Point(539, 120); - this._Button7.Name = "_Button7"; - this._Button7.Size = new System.Drawing.Size(192, 40); - this._Button7.TabIndex = 61; - this._Button7.Text = "stop creazione"; - this._Button7.Click += new System.EventHandler(this.Button7_Click); + _Button7.Font = new Font("Microsoft Sans Serif", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 0); + _Button7.Location = new Point(719, 185); + _Button7.Margin = new Padding(4, 5, 4, 5); + _Button7.Name = "_Button7"; + _Button7.Size = new Size(256, 62); + _Button7.TabIndex = 61; + _Button7.Text = "stop creazione"; + _Button7.Click += Button7_Click; // // _Button5 // - this._Button5.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this._Button5.Location = new System.Drawing.Point(539, 43); - this._Button5.Name = "_Button5"; - this._Button5.Size = new System.Drawing.Size(192, 32); - this._Button5.TabIndex = 60; - this._Button5.Text = "Salva impostazioni"; - this._Button5.Click += new System.EventHandler(this.Button5_Click); + _Button5.Font = new Font("Microsoft Sans Serif", 11F, FontStyle.Bold, GraphicsUnit.Point, 0); + _Button5.Location = new Point(719, 66); + _Button5.Margin = new Padding(4, 5, 4, 5); + _Button5.Name = "_Button5"; + _Button5.Size = new Size(256, 49); + _Button5.TabIndex = 60; + _Button5.Text = "Salva impostazioni"; + _Button5.Click += Button5_Click; // // Label20 // - this.Label20.AutoSize = true; - this.Label20.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label20.Location = new System.Drawing.Point(539, 294); - this.Label20.Name = "Label20"; - this.Label20.Size = new System.Drawing.Size(104, 16); - this.Label20.TabIndex = 59; - this.Label20.Text = "foto generate:"; + Label20.AutoSize = true; + Label20.Font = new Font("Microsoft Sans Serif", 9.75F, FontStyle.Bold, GraphicsUnit.Point, 0); + Label20.Location = new Point(719, 452); + Label20.Margin = new Padding(4, 0, 4, 0); + Label20.Name = "Label20"; + Label20.Size = new Size(126, 20); + Label20.TabIndex = 59; + Label20.Text = "foto generate:"; // // Label19 // - this.Label19.AutoSize = true; - this.Label19.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label19.Location = new System.Drawing.Point(539, 275); - this.Label19.Name = "Label19"; - this.Label19.Size = new System.Drawing.Size(80, 16); - this.Label19.TabIndex = 58; - this.Label19.Text = "foto totali: "; + Label19.AutoSize = true; + Label19.Font = new Font("Microsoft Sans Serif", 9.75F, FontStyle.Bold, GraphicsUnit.Point, 0); + Label19.Location = new Point(719, 423); + Label19.Margin = new Padding(4, 0, 4, 0); + Label19.Name = "Label19"; + Label19.Size = new Size(101, 20); + Label19.TabIndex = 58; + Label19.Text = "foto totali: "; // // Label18 // - this.Label18.AutoSize = true; - this.Label18.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label18.Location = new System.Drawing.Point(643, 294); - this.Label18.Name = "Label18"; - this.Label18.Size = new System.Drawing.Size(19, 20); - this.Label18.TabIndex = 57; - this.Label18.Text = "0"; + Label18.AutoSize = true; + Label18.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Bold, GraphicsUnit.Point, 0); + Label18.Location = new Point(857, 452); + Label18.Margin = new Padding(4, 0, 4, 0); + Label18.Name = "Label18"; + Label18.Size = new Size(24, 25); + Label18.TabIndex = 57; + Label18.Text = "0"; // // lblFotoTotaliNum // - this.lblFotoTotaliNum.AutoSize = true; - this.lblFotoTotaliNum.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblFotoTotaliNum.Location = new System.Drawing.Point(643, 275); - this.lblFotoTotaliNum.Name = "lblFotoTotaliNum"; - this.lblFotoTotaliNum.Size = new System.Drawing.Size(19, 20); - this.lblFotoTotaliNum.TabIndex = 56; - this.lblFotoTotaliNum.Text = "0"; + lblFotoTotaliNum.AutoSize = true; + lblFotoTotaliNum.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Bold, GraphicsUnit.Point, 0); + lblFotoTotaliNum.Location = new Point(857, 423); + lblFotoTotaliNum.Margin = new Padding(4, 0, 4, 0); + lblFotoTotaliNum.Name = "lblFotoTotaliNum"; + lblFotoTotaliNum.Size = new Size(24, 25); + lblFotoTotaliNum.TabIndex = 56; + lblFotoTotaliNum.Text = "0"; // // Label10 // - this.Label10.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label10.Location = new System.Drawing.Point(539, 163); - this.Label10.Name = "Label10"; - this.Label10.Size = new System.Drawing.Size(192, 72); - this.Label10.TabIndex = 55; - this.Label10.Text = "file"; + Label10.Font = new Font("Microsoft Sans Serif", 14.25F, FontStyle.Bold, GraphicsUnit.Point, 0); + Label10.Location = new Point(719, 251); + Label10.Margin = new Padding(4, 0, 4, 0); + Label10.Name = "Label10"; + Label10.Size = new Size(256, 111); + Label10.TabIndex = 55; + Label10.Text = "file"; // // _Button6 // - this._Button6.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this._Button6.Location = new System.Drawing.Point(539, 12); - this._Button6.Name = "_Button6"; - this._Button6.Size = new System.Drawing.Size(192, 32); - this._Button6.TabIndex = 54; - this._Button6.Text = "Carica impostazioni"; - this._Button6.Click += new System.EventHandler(this.Button6_Click); + _Button6.Font = new Font("Microsoft Sans Serif", 11F, FontStyle.Bold, GraphicsUnit.Point, 0); + _Button6.Location = new Point(719, 18); + _Button6.Margin = new Padding(4, 5, 4, 5); + _Button6.Name = "_Button6"; + _Button6.Size = new Size(256, 49); + _Button6.TabIndex = 54; + _Button6.Text = "Carica impostazioni"; + _Button6.Click += Button6_Click; // // _btnCreaCatalogoAsync // - this._btnCreaCatalogoAsync.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this._btnCreaCatalogoAsync.Location = new System.Drawing.Point(539, 78); - this._btnCreaCatalogoAsync.Name = "_btnCreaCatalogoAsync"; - this._btnCreaCatalogoAsync.Size = new System.Drawing.Size(192, 38); - this._btnCreaCatalogoAsync.TabIndex = 68; - this._btnCreaCatalogoAsync.Text = "CREA"; - this._btnCreaCatalogoAsync.UseVisualStyleBackColor = true; - this._btnCreaCatalogoAsync.Click += new System.EventHandler(this.Button1_Click); + _btnCreaCatalogoAsync.Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Bold, GraphicsUnit.Point, 0); + _btnCreaCatalogoAsync.Location = new Point(719, 120); + _btnCreaCatalogoAsync.Margin = new Padding(4, 5, 4, 5); + _btnCreaCatalogoAsync.Name = "_btnCreaCatalogoAsync"; + _btnCreaCatalogoAsync.Size = new Size(256, 58); + _btnCreaCatalogoAsync.TabIndex = 68; + _btnCreaCatalogoAsync.Text = "CREA"; + _btnCreaCatalogoAsync.UseVisualStyleBackColor = true; + _btnCreaCatalogoAsync.Click += Button1_Click; + // + // dataModelBindingSource1 + // + dataModelBindingSource1.DataSource = typeof(ImageCatalog_2.DataModel); // // MainForm // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(739, 401); - this.Controls.Add(this._btnCreaCatalogoAsync); - this.Controls.Add(this.ProgressBar1); - this.Controls.Add(this.CheckBox22); - this.Controls.Add(this.Label43); - this.Controls.Add(this.TabControl1); - this.Controls.Add(this._Label27); - this.Controls.Add(this._Button7); - this.Controls.Add(this._Button5); - this.Controls.Add(this.Label20); - this.Controls.Add(this.Label19); - this.Controls.Add(this.Label18); - this.Controls.Add(this.lblFotoTotaliNum); - this.Controls.Add(this.Label10); - this.Controls.Add(this._Button6); - this.MaximizeBox = false; - this.Name = "MainForm"; - this.Text = "Image Catalog"; - this.Load += new System.EventHandler(this.Form1_Load); - this.TabControl1.ResumeLayout(false); - this.TabPage5.ResumeLayout(false); - this.GroupBox11.ResumeLayout(false); - this.GroupBox11.PerformLayout(); - this.Panel3.ResumeLayout(false); - this.Panel3.PerformLayout(); - this.GroupBox3.ResumeLayout(false); - this.GroupBox3.PerformLayout(); - this.GroupBox8.ResumeLayout(false); - this.GroupBox8.PerformLayout(); - this.GroupBox7.ResumeLayout(false); - this.GroupBox7.PerformLayout(); - this.TabPage3.ResumeLayout(false); - this.GroupBox10.ResumeLayout(false); - this.GroupBox10.PerformLayout(); - this.GroupBox9.ResumeLayout(false); - this.GroupBox9.PerformLayout(); - this.GroupBox5.ResumeLayout(false); - this.GroupBox5.PerformLayout(); - this.GroupBox4.ResumeLayout(false); - this.GroupBox4.PerformLayout(); - this.TabPage2.ResumeLayout(false); - this.GroupBox2.ResumeLayout(false); - this.GroupBox2.PerformLayout(); - this.TabPage1.ResumeLayout(false); - this.Panel1.ResumeLayout(false); - this.Panel1.PerformLayout(); - this.GroupBox1.ResumeLayout(false); - this.GroupBox1.PerformLayout(); - this.Panel2.ResumeLayout(false); - this.Panel2.PerformLayout(); - this.TabPage4.ResumeLayout(false); - this.GroupBox6.ResumeLayout(false); - this.GroupBox6.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.PictureBox2)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this._PictureBox1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.PictureBox3)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(985, 617); + Controls.Add(_btnCreaCatalogoAsync); + Controls.Add(ProgressBar1); + Controls.Add(CheckBox22); + Controls.Add(Label43); + Controls.Add(TabControl1); + Controls.Add(_Label27); + Controls.Add(_Button7); + Controls.Add(_Button5); + Controls.Add(Label20); + Controls.Add(Label19); + Controls.Add(Label18); + Controls.Add(lblFotoTotaliNum); + Controls.Add(Label10); + Controls.Add(_Button6); + Margin = new Padding(4, 5, 4, 5); + MaximizeBox = false; + Name = "MainForm"; + Text = "Image Catalog"; + Load += Form1_Load; + TabControl1.ResumeLayout(false); + TabPage5.ResumeLayout(false); + GroupBox11.ResumeLayout(false); + GroupBox11.PerformLayout(); + Panel3.ResumeLayout(false); + Panel3.PerformLayout(); + GroupBox3.ResumeLayout(false); + GroupBox3.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)bindingSource1).EndInit(); + ((System.ComponentModel.ISupportInitialize)dataModelBindingSource).EndInit(); + GroupBox8.ResumeLayout(false); + GroupBox8.PerformLayout(); + GroupBox7.ResumeLayout(false); + GroupBox7.PerformLayout(); + TabPage3.ResumeLayout(false); + GroupBox10.ResumeLayout(false); + GroupBox10.PerformLayout(); + GroupBox9.ResumeLayout(false); + GroupBox9.PerformLayout(); + GroupBox5.ResumeLayout(false); + GroupBox5.PerformLayout(); + GroupBox4.ResumeLayout(false); + GroupBox4.PerformLayout(); + TabPage2.ResumeLayout(false); + GroupBox2.ResumeLayout(false); + GroupBox2.PerformLayout(); + TabPage1.ResumeLayout(false); + Panel1.ResumeLayout(false); + Panel1.PerformLayout(); + GroupBox1.ResumeLayout(false); + GroupBox1.PerformLayout(); + Panel2.ResumeLayout(false); + Panel2.PerformLayout(); + TabPage4.ResumeLayout(false); + GroupBox6.ResumeLayout(false); + GroupBox6.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)PictureBox2).EndInit(); + ((System.ComponentModel.ISupportInitialize)_PictureBox1).EndInit(); + ((System.ComponentModel.ISupportInitialize)PictureBox3).EndInit(); + ((System.ComponentModel.ISupportInitialize)dataModelBindingSource1).EndInit(); + ResumeLayout(false); + PerformLayout(); } internal ProgressBar ProgressBar1; @@ -2131,6 +2302,9 @@ namespace ImageCatalog internal CheckBox chkSovrascriviFile; private Button _btnCreaCatalogoAsync; private System.Windows.Forms.Timer timer1; + private BindingSource dataModelBindingSource; + private BindingSource dataModelBindingSource1; + private BindingSource bindingSource1; internal Button btnCreaCatalogoAsync { diff --git a/imagecatalog/MainForm.cs b/imagecatalog/MainForm.cs index e074f8c..80b9eb5 100644 --- a/imagecatalog/MainForm.cs +++ b/imagecatalog/MainForm.cs @@ -11,6 +11,7 @@ using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; using CatalogVbLib; +using ImageCatalog_2; using ImageCatalog_2.Services; using MaddoShared; using Microsoft.VisualBasic; @@ -23,13 +24,23 @@ namespace ImageCatalog public partial class MainForm { + + public DataModel Model { get; set; } + private readonly ITestService _service; public MainForm(ITestService testService) { _service = testService; - + + Model = new DataModel(); + InitializeComponent(); + + bindingSource1.DataSource = Model; + + BindControls(); + _Button3.Name = "Button3"; _Button2.Name = "Button2"; _Button8.Name = "Button8"; @@ -52,6 +63,12 @@ namespace ImageCatalog UiUpdateEvent += OnUiUpdateEvent; } + + protected void BindControls() + { + //txtSorgente.DataBindings.Add(new Binding("Text", SourcePath, "")); + } + private event EventHandler> UiUpdateEvent; delegate void SetTextCallback(Label target, string text); @@ -107,8 +124,9 @@ namespace ImageCatalog private void setDefaults() { - txtSorgente.Text = ""; - txtDestinazione.Text = ""; + //txtSorgente.Text = ""; + Model.SourcePath = string.Empty; + Model.DestinationPath = string.Empty; TextBox3.Text = "tn_"; TextBox4.Text = ""; TextBox5.Text = "350"; @@ -191,14 +209,14 @@ namespace ImageCatalog private void FixPaths() { - if (txtSorgente.Text.EndsWith(@"\") == false) + if (Model.SourcePath.EndsWith(@"\") == false) { - txtSorgente.Text += @"\"; + Model.SourcePath += @"\"; } - if (txtDestinazione.Text.EndsWith(@"\") == false) + if (Model.DestinationPath.EndsWith(@"\") == false) { - txtDestinazione.Text += @"\"; + Model.DestinationPath += @"\"; } } @@ -233,7 +251,7 @@ namespace ImageCatalog minThreads = Conversions.ToInteger(TextBox8.Text); if (rdbNuovoMetodo.Checked) { - setPicSettings(txtSorgente.Text, txtDestinazione.Text); + setPicSettings(Model.SourcePath, Model.DestinationPath); ProgressBar1.Minimum = 0; ProgressBar1.Step = 1; ProgressBar1.Value = 0; @@ -256,7 +274,7 @@ namespace ImageCatalog ContaImmaginiThread = 0; // creaImmaginiWithThreadMod(txtSorgente.Text, txtDestinazione.Text) - creaimmaginiWithThreadDict(txtSorgente.Text, txtDestinazione.Text); + creaimmaginiWithThreadDict(Model.SourcePath, Model.DestinationPath); ThreadPoolWorkItem ThAttivo = null; int i = 0; /* TODO ERROR: Skipped DefineDirectiveTrivia */ @@ -295,7 +313,7 @@ namespace ImageCatalog MyPool.StopThreadPool(); MyPool.StartThreadPool(minThreads, maxThreads); ContaImmaginiThread = 0; - CreaImmaginiWithThread(txtSorgente.Text, txtDestinazione.Text); + CreaImmaginiWithThread(Model.SourcePath, Model.DestinationPath); ThreadPoolWorkItem ThAttivo = null; int i = 0; while (i != ContaImmaginiThread) @@ -357,10 +375,10 @@ namespace ImageCatalog private void Button2_Click(object sender, EventArgs e) { - var dialogResult = SelectFolder(txtSorgente.Text); + var dialogResult = SelectFolder(Model.SourcePath); if (!string.IsNullOrWhiteSpace(dialogResult)) { - txtSorgente.Text = dialogResult; + Model.SourcePath = dialogResult; } //CommonOpenFileDialog dialog = new CommonOpenFileDialog(); @@ -393,10 +411,10 @@ namespace ImageCatalog private void Button3_Click(object sender, EventArgs e) { - var dialogResult = SelectFolder(txtDestinazione.Text); + var dialogResult = SelectFolder(Model.DestinationPath); if (!string.IsNullOrWhiteSpace(dialogResult)) { - txtDestinazione.Text = dialogResult; + Model.DestinationPath = dialogResult; } //var DirSearch = new FolderBrowserDialog(); @@ -448,8 +466,8 @@ namespace ImageCatalog { string IlNome = SaveFileDlg.FileName; Module1.SetupIni.NomeFileSetup = IlNome; - Module1.SetupIni.AggiornaParametro("DirSorgente", txtSorgente.Text); - Module1.SetupIni.AggiornaParametro("DirDestinazione", txtDestinazione.Text); + Module1.SetupIni.AggiornaParametro("DirSorgente", Model.SourcePath); + Module1.SetupIni.AggiornaParametro("DirDestinazione", Model.DestinationPath); Module1.SetupIni.AggiornaParametro("DirSottoDirectory", chkAggiornaSottodirectory.Checked); Module1.SetupIni.AggiornaParametro("DirDividiDestinazione", chkCreaSottocartelle.Checked); Module1.SetupIni.AggiornaParametro("DirDividiNumFile", txtFilePerCartella.Text); @@ -530,8 +548,8 @@ namespace ImageCatalog string IlNome = openFileDialog.FileName; Module1.SetupIni.NomeFileSetup = IlNome; Module1.SetupIni.CaricaParametriSetup(); - txtSorgente.Text = Module1.SetupIni.LeggiParametroString("DirSorgente"); - txtDestinazione.Text = Module1.SetupIni.LeggiParametroString("DirDestinazione"); + Model.SourcePath = Module1.SetupIni.LeggiParametroString("DirSorgente"); + Model.DestinationPath = Module1.SetupIni.LeggiParametroString("DirDestinazione"); chkAggiornaSottodirectory.Checked = Module1.SetupIni.LeggiParametroBoolean("DirSottoDirectory"); chkCreaSottocartelle.Checked = Module1.SetupIni.LeggiParametroBoolean("DirDividiDestinazione"); txtFilePerCartella.Text = Module1.SetupIni.LeggiParametroString("DirDividiNumFile"); @@ -626,8 +644,8 @@ namespace ImageCatalog var SourceDir = new DirectoryInfo(SourcePath); var DestDirStart = new DirectoryInfo(DestPath); DirectoryInfo DestDir = null; - PicSettings.DirectorySorgente = txtSorgente.Text; - PicSettings.DirectoryDestinazione = txtDestinazione.Text; + PicSettings.DirectorySorgente = SourcePath; + PicSettings.DirectoryDestinazione = Model.DestinationPath; // PicSettings.DestDir = DestDir // PicSettings.SourceDir = SourceDir @@ -1213,8 +1231,8 @@ namespace ImageCatalog Application.DoEvents(); var ClsCreaImmagine = new CreaImmagineSeparateThread(); - ClsCreaImmagine.DirectorySorgente = txtSorgente.Text; - ClsCreaImmagine.DirectoryDestinazione = txtDestinazione.Text; + ClsCreaImmagine.DirectorySorgente = SourcePath; + ClsCreaImmagine.DirectoryDestinazione = Model.DestinationPath; ClsCreaImmagine.DestDir = DestDir; ClsCreaImmagine.SourceDir = SourceDir; ClsCreaImmagine.DestDirStart = DestDirStart; @@ -1531,7 +1549,7 @@ namespace ImageCatalog lblFotoTotaliNum.Text = "0"; Label18.Text = "0"; Label43.Text = "-s"; - setPicSettings(txtSorgente.Text, txtDestinazione.Text); + setPicSettings(Model.SourcePath, Model.DestinationPath); ProgressBar1.Minimum = 0; ProgressBar1.Step = 1; ProgressBar1.Value = 0; @@ -1545,8 +1563,8 @@ namespace ImageCatalog imageCreationOptions.SuffissoCartelle = txtSuffissoCartelle.Text; imageCreationOptions.CifreContatore = Conversions.ToInteger(txtCifreContatore.Text); imageCreationOptions.NumerazioneType = GetNumerazioneEnum(); - imageCreationOptions.SourcePath = txtSorgente.Text; - imageCreationOptions.DestinationPath = txtDestinazione.Text; + imageCreationOptions.SourcePath = Model.SourcePath; + imageCreationOptions.DestinationPath = Model.DestinationPath; imageCreationOptions.MaxThreads = Conversions.ToInteger(TextBox7.Text); imageCreationOptions.ChunksSize = Conversions.ToInteger(TextBox8.Text); imageCreationOptions.LinearExecution = rdbVecchioMetodo.Checked; @@ -1611,8 +1629,8 @@ namespace ImageCatalog imageCreationOptions.SuffissoCartelle = txtSuffissoCartelle.Text; imageCreationOptions.CifreContatore = Conversions.ToInteger(txtCifreContatore.Text); imageCreationOptions.NumerazioneType = GetNumerazioneEnum(); - imageCreationOptions.SourcePath = txtSorgente.Text; - imageCreationOptions.DestinationPath = txtDestinazione.Text; + imageCreationOptions.SourcePath = Model.SourcePath; + imageCreationOptions.DestinationPath = Model.DestinationPath; await imgStf.CreaImmaginiParallel(imageCreationOptions, _results, UiUpdateEvent); // Await CreaImmaginiParallel(txtSorgente.Text, txtDestinazione.Text) diff --git a/imagecatalog/MainForm.resx b/imagecatalog/MainForm.resx index 1f666f2..a4e857a 100644 --- a/imagecatalog/MainForm.resx +++ b/imagecatalog/MainForm.resx @@ -1,17 +1,17 @@  - @@ -117,7 +117,16 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 586, 17 + + + 120, 17 + 17, 17 + + 349, 17 + \ No newline at end of file diff --git a/imagecatalog/Properties/DataSources/DataModel.datasource b/imagecatalog/Properties/DataSources/DataModel.datasource new file mode 100644 index 0000000..e6b82be --- /dev/null +++ b/imagecatalog/Properties/DataSources/DataModel.datasource @@ -0,0 +1,10 @@ + + + + ImageCatalog_2.DataModel, ImageCatalog 2, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null + \ No newline at end of file diff --git a/imagecatalog/ViewModelBase.cs b/imagecatalog/ViewModelBase.cs new file mode 100644 index 0000000..bedbb78 --- /dev/null +++ b/imagecatalog/ViewModelBase.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading.Tasks; + +namespace ImageCatalog_2 +{ + public class ViewModelBase : INotifyPropertyChanged + { + public event PropertyChangedEventHandler? PropertyChanged; + // This method is called by the Set accessor of each property. + // The CallerMemberName attribute that is applied to the optional propertyName + // parameter causes the property name of the caller to be substituted as an argument. + protected void NotifyPropertyChanged([CallerMemberName] String propertyName = "") + { + if (PropertyChanged != null) + { + PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + } +} -- 2.52.0 From d3327089ffa1ded911656093a7fd166b567e9215 Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Mon, 14 Oct 2024 23:05:18 +0200 Subject: [PATCH 008/127] Initialized ViewModel --- imagecatalog/DataModel.cs | 8 +++++++- imagecatalog/MainForm.cs | 5 ++--- imagecatalog/Program.cs | 9 ++++++++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/imagecatalog/DataModel.cs b/imagecatalog/DataModel.cs index 99d7dfd..1a6c349 100644 --- a/imagecatalog/DataModel.cs +++ b/imagecatalog/DataModel.cs @@ -1,4 +1,5 @@ -using System; +using ImageCatalog_2.Services; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; @@ -9,6 +10,11 @@ namespace ImageCatalog_2 { public class DataModel : ViewModelBase { + private readonly ITestService _service; + public DataModel(ITestService testService) + { + _service = testService; + } private string _sourcePath; diff --git a/imagecatalog/MainForm.cs b/imagecatalog/MainForm.cs index 80b9eb5..320d0a6 100644 --- a/imagecatalog/MainForm.cs +++ b/imagecatalog/MainForm.cs @@ -33,11 +33,9 @@ namespace ImageCatalog { _service = testService; - Model = new DataModel(); - InitializeComponent(); - bindingSource1.DataSource = Model; + BindControls(); @@ -199,6 +197,7 @@ namespace ImageCatalog private void Form1_Load(object sender, EventArgs e) { + bindingSource1.DataSource = Model; Application.EnableVisualStyles(); setDefaults(); /* TODO ERROR: Skipped IfDirectiveTrivia */ diff --git a/imagecatalog/Program.cs b/imagecatalog/Program.cs index 9d7da28..7cd5ffb 100644 --- a/imagecatalog/Program.cs +++ b/imagecatalog/Program.cs @@ -19,7 +19,12 @@ namespace ImageCatalog_2 ServiceProvider = serviceCollection.BuildServiceProvider(); - Application.Run(ServiceProvider.GetRequiredService()); + var mainForm = ServiceProvider.GetRequiredService(); + var mainViewModel = ServiceProvider.GetRequiredService(); + + mainForm.Model = mainViewModel; + + Application.Run(mainForm); } private static void ConfigureServices(ServiceCollection services) @@ -27,6 +32,8 @@ namespace ImageCatalog_2 // Register your services here services.AddTransient(); + services.AddTransient(); + // Register your forms services.AddTransient(); } -- 2.52.0 From 22f7143d6e3c3ad93ed30ab1abe82e1ee650243f Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Mon, 14 Oct 2024 23:25:35 +0200 Subject: [PATCH 009/127] Binding Commands --- imagecatalog/Commands/AsyncCommand.cs | 52 +++++++++++++++++++++++++ imagecatalog/Commands/RelayCommand.cs | 41 ++++++++++++++++++++ imagecatalog/DataModel.cs | 23 ++++++++++- imagecatalog/MainForm.Designer.cs | 56 ++++++++++++++++++++------- 4 files changed, 156 insertions(+), 16 deletions(-) create mode 100644 imagecatalog/Commands/AsyncCommand.cs create mode 100644 imagecatalog/Commands/RelayCommand.cs diff --git a/imagecatalog/Commands/AsyncCommand.cs b/imagecatalog/Commands/AsyncCommand.cs new file mode 100644 index 0000000..62334d0 --- /dev/null +++ b/imagecatalog/Commands/AsyncCommand.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Input; + +namespace ImageCatalog_2.Commands +{ + public class AsyncCommand : ICommand + { + private readonly Func _execute; + private readonly Func _canExecute; + private bool _isExecuting; + + public event EventHandler CanExecuteChanged; + + public AsyncCommand(Func execute, Func canExecute = null) + { + _execute = execute ?? throw new ArgumentNullException(nameof(execute)); + _canExecute = canExecute; + } + + public bool CanExecute(object parameter) + { + return (_canExecute?.Invoke() ?? true) && !_isExecuting; + } + + public async void Execute(object parameter) + { + if (CanExecute(parameter)) + { + try + { + _isExecuting = true; + RaiseCanExecuteChanged(); + await _execute(); + } + finally + { + _isExecuting = false; + RaiseCanExecuteChanged(); + } + } + } + + public void RaiseCanExecuteChanged() + { + CanExecuteChanged?.Invoke(this, EventArgs.Empty); + } + } +} diff --git a/imagecatalog/Commands/RelayCommand.cs b/imagecatalog/Commands/RelayCommand.cs new file mode 100644 index 0000000..81e92e4 --- /dev/null +++ b/imagecatalog/Commands/RelayCommand.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Input; + +namespace ImageCatalog_2.Commands; + +public class RelayCommand : System.Windows.Input.ICommand +{ + private readonly Action _execute; + private readonly Predicate _canExecute; + + public RelayCommand(Action execute) : this(execute, null) { } + + public RelayCommand(Action execute, Predicate canExecute) + { + _execute = execute ?? throw new ArgumentNullException(nameof(execute)); + _canExecute = canExecute; + } + + // Manually raise this event in WinForms as CommandManager is unavailable + public event EventHandler CanExecuteChanged; + + public bool CanExecute(object parameter) + { + return _canExecute == null || _canExecute(parameter); + } + + public void Execute(object parameter) + { + _execute(parameter); + } + + // Method to manually raise CanExecuteChanged event + public void RaiseCanExecuteChanged() + { + CanExecuteChanged?.Invoke(this, EventArgs.Empty); + } +} \ No newline at end of file diff --git a/imagecatalog/DataModel.cs b/imagecatalog/DataModel.cs index 1a6c349..700e05f 100644 --- a/imagecatalog/DataModel.cs +++ b/imagecatalog/DataModel.cs @@ -1,19 +1,30 @@ -using ImageCatalog_2.Services; +using ImageCatalog_2.Commands; +using ImageCatalog_2.Services; using System; using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Input; namespace ImageCatalog_2 { public class DataModel : ViewModelBase { + + public ICommand TestCommand { get; } + + public ICommand AsyncTestCommand { get; } + private readonly ITestService _service; public DataModel(ITestService testService) { _service = testService; + + TestCommand = new RelayCommand(Test); + AsyncTestCommand = new AsyncCommand(TestAsync); } private string _sourcePath; @@ -39,5 +50,15 @@ namespace ImageCatalog_2 } } + private void Test(object parameter) + { + Debug.WriteLine("Yep"); + } + + private async Task TestAsync() + { + Debug.WriteLine("Yep c"); + } + } } diff --git a/imagecatalog/MainForm.Designer.cs b/imagecatalog/MainForm.Designer.cs index a98ad26..8b069f7 100644 --- a/imagecatalog/MainForm.Designer.cs +++ b/imagecatalog/MainForm.Designer.cs @@ -43,6 +43,10 @@ namespace ImageCatalog Label43 = new Label(); TabControl1 = new TabControl(); TabPage5 = new TabPage(); + button1 = new Button(); + btnTest = new Button(); + bindingSource1 = new BindingSource(components); + dataModelBindingSource = new BindingSource(components); GroupBox11 = new GroupBox(); Panel3 = new Panel(); rdbNuovoMetodo = new RadioButton(); @@ -58,8 +62,6 @@ namespace ImageCatalog Label1 = new Label(); Label2 = new Label(); txtSorgente = new TextBox(); - bindingSource1 = new BindingSource(components); - dataModelBindingSource = new BindingSource(components); txtDestinazione = new TextBox(); GroupBox8 = new GroupBox(); rdbNumFiles = new RadioButton(); @@ -181,11 +183,11 @@ namespace ImageCatalog dataModelBindingSource1 = new BindingSource(components); TabControl1.SuspendLayout(); TabPage5.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)bindingSource1).BeginInit(); + ((System.ComponentModel.ISupportInitialize)dataModelBindingSource).BeginInit(); GroupBox11.SuspendLayout(); Panel3.SuspendLayout(); GroupBox3.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)bindingSource1).BeginInit(); - ((System.ComponentModel.ISupportInitialize)dataModelBindingSource).BeginInit(); GroupBox8.SuspendLayout(); GroupBox7.SuspendLayout(); TabPage3.SuspendLayout(); @@ -253,6 +255,8 @@ namespace ImageCatalog // // TabPage5 // + TabPage5.Controls.Add(button1); + TabPage5.Controls.Add(btnTest); TabPage5.Controls.Add(GroupBox11); TabPage5.Controls.Add(GroupBox3); TabPage5.Controls.Add(GroupBox8); @@ -266,6 +270,34 @@ namespace ImageCatalog TabPage5.Text = "Generale"; TabPage5.UseVisualStyleBackColor = true; // + // button1 + // + button1.DataBindings.Add(new Binding("Command", bindingSource1, "AsyncTestCommand", true)); + button1.Location = new Point(501, 480); + button1.Name = "button1"; + button1.Size = new Size(94, 29); + button1.TabIndex = 50; + button1.Text = "Test Async"; + button1.UseVisualStyleBackColor = true; + // + // btnTest + // + btnTest.DataBindings.Add(new Binding("Command", bindingSource1, "TestCommand", true)); + btnTest.Location = new Point(325, 472); + btnTest.Name = "btnTest"; + btnTest.Size = new Size(94, 29); + btnTest.TabIndex = 49; + btnTest.Text = "Test"; + btnTest.UseVisualStyleBackColor = true; + // + // bindingSource1 + // + bindingSource1.DataSource = dataModelBindingSource; + // + // dataModelBindingSource + // + dataModelBindingSource.DataSource = typeof(ImageCatalog_2.DataModel); + // // GroupBox11 // GroupBox11.Controls.Add(Panel3); @@ -379,7 +411,7 @@ namespace ImageCatalog chkAggiornaSottodirectory.Location = new Point(107, 98); chkAggiornaSottodirectory.Margin = new Padding(4, 5, 4, 5); chkAggiornaSottodirectory.Name = "chkAggiornaSottodirectory"; - chkAggiornaSottodirectory.Size = new Size(203, 37); + chkAggiornaSottodirectory.Size = new Size(317, 37); chkAggiornaSottodirectory.TabIndex = 25; chkAggiornaSottodirectory.Text = "aggiorna le sottodirectory"; // @@ -435,14 +467,6 @@ namespace ImageCatalog txtSorgente.TabIndex = 0; txtSorgente.Text = "TextBox1"; // - // bindingSource1 - // - bindingSource1.DataSource = dataModelBindingSource; - // - // dataModelBindingSource - // - dataModelBindingSource.DataSource = typeof(ImageCatalog_2.DataModel); - // // txtDestinazione // txtDestinazione.DataBindings.Add(new Binding("Text", bindingSource1, "DestinationPath", true, DataSourceUpdateMode.OnPropertyChanged)); @@ -1795,14 +1819,14 @@ namespace ImageCatalog Load += Form1_Load; TabControl1.ResumeLayout(false); TabPage5.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)bindingSource1).EndInit(); + ((System.ComponentModel.ISupportInitialize)dataModelBindingSource).EndInit(); GroupBox11.ResumeLayout(false); GroupBox11.PerformLayout(); Panel3.ResumeLayout(false); Panel3.PerformLayout(); GroupBox3.ResumeLayout(false); GroupBox3.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)bindingSource1).EndInit(); - ((System.ComponentModel.ISupportInitialize)dataModelBindingSource).EndInit(); GroupBox8.ResumeLayout(false); GroupBox8.PerformLayout(); GroupBox7.ResumeLayout(false); @@ -2305,6 +2329,8 @@ namespace ImageCatalog private BindingSource dataModelBindingSource; private BindingSource dataModelBindingSource1; private BindingSource bindingSource1; + private Button btnTest; + private Button button1; internal Button btnCreaCatalogoAsync { -- 2.52.0 From 4e4a59b0b23492b750db440aa36f16a9b8d79cf0 Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Mon, 14 Oct 2024 23:48:21 +0200 Subject: [PATCH 010/127] Bound UI Enabled --- imagecatalog/DataModel.cs | 13 +++++++++++++ imagecatalog/MainForm.Designer.cs | 22 +++++++++++++--------- imagecatalog/MainForm.cs | 18 ++++++++++-------- 3 files changed, 36 insertions(+), 17 deletions(-) diff --git a/imagecatalog/DataModel.cs b/imagecatalog/DataModel.cs index 700e05f..4725554 100644 --- a/imagecatalog/DataModel.cs +++ b/imagecatalog/DataModel.cs @@ -50,9 +50,22 @@ namespace ImageCatalog_2 } } + private bool _uiEnabled = true; + + public bool UiEnabled + { + get { return _uiEnabled; } + set + { + _uiEnabled = value; + NotifyPropertyChanged(); + } + } + private void Test(object parameter) { Debug.WriteLine("Yep"); + this.UiEnabled = !this.UiEnabled; } private async Task TestAsync() diff --git a/imagecatalog/MainForm.Designer.cs b/imagecatalog/MainForm.Designer.cs index 8b069f7..1b57b5b 100644 --- a/imagecatalog/MainForm.Designer.cs +++ b/imagecatalog/MainForm.Designer.cs @@ -44,9 +44,9 @@ namespace ImageCatalog TabControl1 = new TabControl(); TabPage5 = new TabPage(); button1 = new Button(); - btnTest = new Button(); bindingSource1 = new BindingSource(components); dataModelBindingSource = new BindingSource(components); + btnTest = new Button(); GroupBox11 = new GroupBox(); Panel3 = new Panel(); rdbNuovoMetodo = new RadioButton(); @@ -246,6 +246,7 @@ namespace ImageCatalog TabControl1.Controls.Add(TabPage2); TabControl1.Controls.Add(TabPage1); TabControl1.Controls.Add(TabPage4); + TabControl1.DataBindings.Add(new Binding("Enabled", bindingSource1, "UiEnabled", true)); TabControl1.Location = new Point(16, 18); TabControl1.Margin = new Padding(4, 5, 4, 5); TabControl1.Name = "TabControl1"; @@ -280,6 +281,14 @@ namespace ImageCatalog button1.Text = "Test Async"; button1.UseVisualStyleBackColor = true; // + // bindingSource1 + // + bindingSource1.DataSource = dataModelBindingSource; + // + // dataModelBindingSource + // + dataModelBindingSource.DataSource = typeof(ImageCatalog_2.DataModel); + // // btnTest // btnTest.DataBindings.Add(new Binding("Command", bindingSource1, "TestCommand", true)); @@ -290,14 +299,6 @@ namespace ImageCatalog btnTest.Text = "Test"; btnTest.UseVisualStyleBackColor = true; // - // bindingSource1 - // - bindingSource1.DataSource = dataModelBindingSource; - // - // dataModelBindingSource - // - dataModelBindingSource.DataSource = typeof(ImageCatalog_2.DataModel); - // // GroupBox11 // GroupBox11.Controls.Add(Panel3); @@ -1703,6 +1704,7 @@ namespace ImageCatalog // // _Button5 // + _Button5.DataBindings.Add(new Binding("Enabled", bindingSource1, "UiEnabled", true)); _Button5.Font = new Font("Microsoft Sans Serif", 11F, FontStyle.Bold, GraphicsUnit.Point, 0); _Button5.Location = new Point(719, 66); _Button5.Margin = new Padding(4, 5, 4, 5); @@ -1768,6 +1770,7 @@ namespace ImageCatalog // // _Button6 // + _Button6.DataBindings.Add(new Binding("Enabled", bindingSource1, "UiEnabled", true)); _Button6.Font = new Font("Microsoft Sans Serif", 11F, FontStyle.Bold, GraphicsUnit.Point, 0); _Button6.Location = new Point(719, 18); _Button6.Margin = new Padding(4, 5, 4, 5); @@ -1779,6 +1782,7 @@ namespace ImageCatalog // // _btnCreaCatalogoAsync // + _btnCreaCatalogoAsync.DataBindings.Add(new Binding("Enabled", bindingSource1, "UiEnabled", true)); _btnCreaCatalogoAsync.Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Bold, GraphicsUnit.Point, 0); _btnCreaCatalogoAsync.Location = new Point(719, 120); _btnCreaCatalogoAsync.Margin = new Padding(4, 5, 4, 5); diff --git a/imagecatalog/MainForm.cs b/imagecatalog/MainForm.cs index 320d0a6..a350e46 100644 --- a/imagecatalog/MainForm.cs +++ b/imagecatalog/MainForm.cs @@ -221,18 +221,20 @@ namespace ImageCatalog private void lockUI() { - TabControl1.Enabled = false; - Button5.Enabled = false; - Button6.Enabled = false; - btnCreaCatalogoAsync.Enabled = false; + Model.UiEnabled = false; + //TabControl1.Enabled = false; + //Button5.Enabled = false; + //Button6.Enabled = false; + //btnCreaCatalogoAsync.Enabled = false; } private void unlockUI() { - TabControl1.Enabled = true; - Button5.Enabled = true; - Button6.Enabled = true; - btnCreaCatalogoAsync.Enabled = true; + Model.UiEnabled = true; + //TabControl1.Enabled = true; + //Button5.Enabled = true; + //Button6.Enabled = true; + //btnCreaCatalogoAsync.Enabled = true; } private void btnCreaCatalogo_Click(object sender, EventArgs e) -- 2.52.0 From 8048c41cd0cb90f00b4a7c1239b1c2b75e27b0f6 Mon Sep 17 00:00:00 2001 From: Marco Date: Tue, 8 Jul 2025 14:35:27 +0200 Subject: [PATCH 011/127] Upgraded to .NET 9 --- CatalogVbLib/CatalogVbLib.vbproj | 8 ++++---- MaddoShared/MaddoShared.csproj | 18 +++++++++--------- imagecatalog/Form1.cs | 13 +++++++++++++ imagecatalog/ImageCatalog 2.csproj | 2 +- imagecatalog/MainForm.cs | 2 ++ 5 files changed, 29 insertions(+), 14 deletions(-) diff --git a/CatalogVbLib/CatalogVbLib.vbproj b/CatalogVbLib/CatalogVbLib.vbproj index dbed032..e042d2f 100644 --- a/CatalogVbLib/CatalogVbLib.vbproj +++ b/CatalogVbLib/CatalogVbLib.vbproj @@ -1,6 +1,6 @@  - net8.0-windows + net9.0-windows Library false true @@ -36,9 +36,9 @@ - + - - + + \ No newline at end of file diff --git a/MaddoShared/MaddoShared.csproj b/MaddoShared/MaddoShared.csproj index ca1c727..25053f8 100644 --- a/MaddoShared/MaddoShared.csproj +++ b/MaddoShared/MaddoShared.csproj @@ -1,6 +1,6 @@  - net8.0-windows7.0 + net9.0-windows Library false true @@ -13,18 +13,18 @@ - + - - - - - - + + + + + + all - + \ No newline at end of file diff --git a/imagecatalog/Form1.cs b/imagecatalog/Form1.cs index 1f86a2d..aedf2aa 100644 --- a/imagecatalog/Form1.cs +++ b/imagecatalog/Form1.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Diagnostics; using System.Drawing; using System.IO; @@ -51,6 +52,7 @@ namespace ImageCatalog // Do not modify it using the code editor. private Button _Button1; + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] internal Button Button1 { [MethodImpl(MethodImplOptions.Synchronized)] @@ -82,6 +84,7 @@ namespace ImageCatalog internal Label Label20; private Button _Button6; + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] internal Button Button6 { [MethodImpl(MethodImplOptions.Synchronized)] @@ -108,6 +111,7 @@ namespace ImageCatalog private Button _Button5; + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] internal Button Button5 { [MethodImpl(MethodImplOptions.Synchronized)] @@ -134,6 +138,7 @@ namespace ImageCatalog private Button _Button7; + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] internal Button Button7 { [MethodImpl(MethodImplOptions.Synchronized)] @@ -173,6 +178,7 @@ namespace ImageCatalog internal PictureBox PictureBox2; private PictureBox _PictureBox1; + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] internal PictureBox PictureBox1 { [MethodImpl(MethodImplOptions.Synchronized)] @@ -213,6 +219,7 @@ namespace ImageCatalog internal Label Label23; private Button _Button4; + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] internal Button Button4 { [MethodImpl(MethodImplOptions.Synchronized)] @@ -277,6 +284,7 @@ namespace ImageCatalog internal GroupBox GroupBox5; private Button _Button8; + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] internal Button Button8 { [MethodImpl(MethodImplOptions.Synchronized)] @@ -332,6 +340,7 @@ namespace ImageCatalog internal CheckBox CheckBox6; private Button _Button3; + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] internal Button Button3 { [MethodImpl(MethodImplOptions.Synchronized)] @@ -358,6 +367,7 @@ namespace ImageCatalog private Button _Button2; + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] internal Button Button2 { [MethodImpl(MethodImplOptions.Synchronized)] @@ -410,6 +420,7 @@ namespace ImageCatalog internal Panel Panel1; private CheckBox _CheckBox18; + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] internal CheckBox CheckBox18 { [MethodImpl(MethodImplOptions.Synchronized)] @@ -436,6 +447,7 @@ namespace ImageCatalog private CheckBox _CheckBox4; + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] internal CheckBox CheckBox4 { [MethodImpl(MethodImplOptions.Synchronized)] @@ -462,6 +474,7 @@ namespace ImageCatalog private CheckBox _CheckBox12; + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] internal CheckBox CheckBox12 { [MethodImpl(MethodImplOptions.Synchronized)] diff --git a/imagecatalog/ImageCatalog 2.csproj b/imagecatalog/ImageCatalog 2.csproj index 021f879..2e9cd55 100644 --- a/imagecatalog/ImageCatalog 2.csproj +++ b/imagecatalog/ImageCatalog 2.csproj @@ -1,7 +1,7 @@  WinExe - net8.0-windows + net9.0-windows enable enable true diff --git a/imagecatalog/MainForm.cs b/imagecatalog/MainForm.cs index a350e46..371c014 100644 --- a/imagecatalog/MainForm.cs +++ b/imagecatalog/MainForm.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; +using System.ComponentModel; using System.Drawing; using System.Drawing.Text; using System.IO; @@ -25,6 +26,7 @@ namespace ImageCatalog public partial class MainForm { + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public DataModel Model { get; set; } private readonly ITestService _service; -- 2.52.0 From d8d8b152bdb34a9ff153ae250f20511489493009 Mon Sep 17 00:00:00 2001 From: Marco Date: Wed, 23 Jul 2025 15:08:25 +0200 Subject: [PATCH 012/127] Errors fix, removed old library, Added logging --- MaddoShared/ImageCreatorSharp.cs | 47 ++++----- imagecatalog/Icon.png | Bin 0 -> 317 bytes imagecatalog/ImageCatalog 2.csproj | 9 +- imagecatalog/Logo.ico | Bin 0 -> 894 bytes imagecatalog/MainForm.cs | 162 ++++++++++++++++++----------- imagecatalog/Program.cs | 54 +++++++++- 6 files changed, 181 insertions(+), 91 deletions(-) create mode 100644 imagecatalog/Icon.png create mode 100644 imagecatalog/Logo.ico diff --git a/MaddoShared/ImageCreatorSharp.cs b/MaddoShared/ImageCreatorSharp.cs index 84a4c21..849d8c6 100644 --- a/MaddoShared/ImageCreatorSharp.cs +++ b/MaddoShared/ImageCreatorSharp.cs @@ -148,39 +148,36 @@ public class ImageCreatorSharp private void ExtractExif() { - using (var img = SixLabors.ImageSharp.Image.Load(_workFile.FullName)) + using var img = SixLabors.ImageSharp.Image.Load(_workFile.FullName); + _orientation = ExifReader.Orientations.TopLeft; + + IExifValue rotation = null; + + var found = img.Metadata?.ExifProfile?.TryGetValue(ExifTag.Orientation, out rotation) ?? false; + + if (found ) { - _orientation = ExifReader.Orientations.TopLeft; + var intOrientation = rotation.Value.ToInt32(); + _orientation = (ExifReader.Orientations)intOrientation; + } - IExifValue rotation = null; - - var found = img.Metadata?.ExifProfile?.TryGetValue(ExifTag.Orientation, out rotation) ?? false; - - if (found) + IExifValue date = null; + var creationFound = img.Metadata?.ExifProfile?.TryGetValue(ExifTag.DateTime, out date) ?? false; + if (creationFound) + { + var succ = DateTime.TryParse(date.ToString(), out var crDate); + if (succ) { - _orientation = (ExifReader.Orientations)rotation.ToInt32(); - } - - IExifValue date = null; - var creationFound = img.Metadata?.ExifProfile?.TryGetValue(ExifTag.DateTime, out date) ?? false; - if (creationFound) - { - var succ = DateTime.TryParse(date.ToString(), out var crDate); - if (succ) - { - _creationDate = crDate; - } - else - { - _creationDate = null; - } + _creationDate = crDate; } else { _creationDate = null; } - - + } + else + { + _creationDate = null; } } diff --git a/imagecatalog/Icon.png b/imagecatalog/Icon.png new file mode 100644 index 0000000000000000000000000000000000000000..849b093e8a89ad92d3546ec2edc2dbc6299bbd0b GIT binary patch literal 317 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|zI(bjhFJ6_ zryO9qal_(YvT%E2{Qf$FLpOAGh@3pTr!DkP;4ZPe$v1&=j}L2oe*f3KT(*t-!_7Z$ z%b40MxX+~3_#H{r=;H3!IP>+fc%DkNIc~|uIj1ApfS~Pvxa>o{Ht7$Ih7Av67YiR| zKgPf|ZSQ%Bd!|;2H~v(vGdO(y^Ryqa2go+uS}R)TGVSKi!Pg#doDB>D22WQ% Jmvv4FO#tBnf_ne} literal 0 HcmV?d00001 diff --git a/imagecatalog/ImageCatalog 2.csproj b/imagecatalog/ImageCatalog 2.csproj index 2e9cd55..572f666 100644 --- a/imagecatalog/ImageCatalog 2.csproj +++ b/imagecatalog/ImageCatalog 2.csproj @@ -10,6 +10,9 @@ 3.0.0.0 3.0.0-alpha.63+Branch.develop.Sha.39a9baf5c618d8d79c75b89e2d5c4020939697f2 3.0.0-alpha0063 + ImageCatalog2025 + default + Logo.ico true @@ -34,10 +37,10 @@ - + + + - - all diff --git a/imagecatalog/Logo.ico b/imagecatalog/Logo.ico new file mode 100644 index 0000000000000000000000000000000000000000..e614e0606ce139b70981e95a524919d4cbc6c934 GIT binary patch literal 894 zcmb`GF$%&!5Jg9XC^iNW5iLxSB9#{q6t7_I0mLKN=uH&7h=o_Ml^jED;#)?Bu*TKG z&HT;m?Emw#3lXXD#IZ2a4M@D^DrXK$ zTI+{JK+=q&%J?LKoFtveBAspqnvhfEIF%B%#)mFU _logger; - public MainForm(ITestService testService) + public MainForm(ITestService testService, ILogger logger) { _service = testService; - + _logger = logger; + + _logger.LogDebug("Start"); + InitializeComponent(); - - BindControls(); - + _Button3.Name = "Button3"; _Button2.Name = "Button2"; _Button8.Name = "Button8"; @@ -57,11 +59,10 @@ namespace ImageCatalog _btnCreaCatalogoAsync.Name = "btnCreaCatalogoAsync"; var version = Assembly.GetExecutingAssembly().GetName().Version; - _Label27.Text = $"Version: {version.Major}.{version.Minor}.{version.Build}.{version.Revision}"; + _Label27.Text = $"Version: {version.Major}.{version.Minor}.{version.Build}.{version.Revision}"; _results = new ConcurrentBag(); UiUpdateEvent += OnUiUpdateEvent; - } protected void BindControls() @@ -75,7 +76,6 @@ namespace ImageCatalog private void SetText(Label target, string text) { - if (InvokeRequired) { SetTextCallback d = new SetTextCallback(SetText); @@ -86,7 +86,9 @@ namespace ImageCatalog target.Text = text; } } + delegate void SetProgressCallback(ProgressBar target, int amount, int maximum); + private void SetProgress(ProgressBar target, int amount, int maximum) { if (InvokeRequired) @@ -100,6 +102,7 @@ namespace ImageCatalog target.Value = amount; } } + private void OnUiUpdateEvent(object sender, Tuple args) { SetProgress(ProgressBar1, _results.Count, args.Item2); @@ -194,31 +197,43 @@ namespace ImageCatalog ComboBox5.SelectedIndex = 2; } - [DllImport("kernel32.dll", SetLastError = true)] - private static extern bool AllocConsole(); private void Form1_Load(object sender, EventArgs e) { bindingSource1.DataSource = Model; Application.EnableVisualStyles(); setDefaults(); - /* TODO ERROR: Skipped IfDirectiveTrivia */ - AllocConsole(); - /* TODO ERROR: Skipped EndIfDirectiveTrivia */ - Console.WriteLine("Programma avviato"); + // /* TODO ERROR: Skipped IfDirectiveTrivia */ + // AllocConsole(); + // /* TODO ERROR: Skipped EndIfDirectiveTrivia */ + _logger.LogInformation("Programma Avviato"); + //Console.WriteLine("Programma avviato"); } private void FixPaths() { - if (Model.SourcePath.EndsWith(@"\") == false) + Model.SourcePath = FixPath(Model.SourcePath); + Model.DestinationPath = FixPath(Model.DestinationPath); + } + + private string FixPath(string path) + { + if (string.IsNullOrWhiteSpace(path)) { - Model.SourcePath += @"\"; + return string.Empty; } - if (Model.DestinationPath.EndsWith(@"\") == false) - { - Model.DestinationPath += @"\"; - } + // Trim leading/trailing quotes + path = path.Trim().Trim('"'); + + // Normalize directory separators + path = path.Replace('/', Path.DirectorySeparatorChar) + .Replace('\\', Path.DirectorySeparatorChar); + + // Remove trailing separators then add one back + path = path.TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar; + + return path; } private void lockUI() @@ -241,6 +256,7 @@ namespace ImageCatalog private void btnCreaCatalogo_Click(object sender, EventArgs e) { + _logger.LogInformation("Avvio elaborazione..."); lockUI(); DateTime timeStart; var timeStop = default(DateTime); @@ -277,7 +293,7 @@ namespace ImageCatalog ContaImmaginiThread = 0; // creaImmaginiWithThreadMod(txtSorgente.Text, txtDestinazione.Text) - creaimmaginiWithThreadDict(Model.SourcePath, Model.DestinationPath); + CreaimmaginiWithThreadDict(Model.SourcePath, Model.DestinationPath); ThreadPoolWorkItem ThAttivo = null; int i = 0; /* TODO ERROR: Skipped DefineDirectiveTrivia */ @@ -354,26 +370,32 @@ namespace ImageCatalog double fotoSec = numFoto / (double)timediffS; double fotoMin = numFoto / (double)timediffM; double fotoOra = numFoto / (double)timediffH; - string s = "S: " + timediffS.ToString() + "; F/s: " + fotoSec.ToString("0.000"); // + " F/m: " + fotoMin.ToString("0.00") + " F/h: " + fotoOra.ToString("0.00") + string s = "S: " + timediffS.ToString() + "; F/s: " + + fotoSec.ToString( + "0.000"); // + " F/m: " + fotoMin.ToString("0.00") + " F/h: " + fotoOra.ToString("0.00") return s; } private string SelectFolder(string startingFolder) { - CommonOpenFileDialog dialog = new CommonOpenFileDialog - { - InitialDirectory = startingFolder, - IsFolderPicker = true - }; - if (dialog.ShowDialog() != CommonFileDialogResult.Ok) return null; - var directoryScelta = dialog.FileName; - if (directoryScelta.EndsWith(@"\") == false) - { - directoryScelta += @"\"; - } + var dialog = new FolderBrowserDialog(); + dialog.InitialDirectory = startingFolder; + 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; + + // if (directoryScelta.EndsWith(@"\") == false) + // { + // directoryScelta += @"\"; + // } return directoryScelta; - } private void Button2_Click(object sender, EventArgs e) @@ -624,12 +646,14 @@ namespace ImageCatalog if (PictureBox1.Image.Height >= PictureBox1.Image.Width) { PictureBox1.Height = 160; - PictureBox1.Width = Conversions.ToInteger(160 * PictureBox1.Image.Width / (double)PictureBox1.Image.Height); + PictureBox1.Width = + Conversions.ToInteger(160 * PictureBox1.Image.Width / (double)PictureBox1.Image.Height); } else { PictureBox1.Width = 224; - PictureBox1.Height = Conversions.ToInteger(224 * PictureBox1.Image.Height / (double)PictureBox1.Image.Width); + PictureBox1.Height = + Conversions.ToInteger(224 * PictureBox1.Image.Height / (double)PictureBox1.Image.Width); } } @@ -638,7 +662,6 @@ namespace ImageCatalog // 2021 TextBox8.Text = Module1.SetupIni.LeggiParametroString("ChunkSize"); TextBox7.Text = Module1.SetupIni.LeggiParametroString("ThreadsCount"); - } } @@ -860,7 +883,9 @@ namespace ImageCatalog TestoTemp = (ContaDirXDir * NumFileXDir).ToString(); } - for (int ContaTemp = 1, loopTo = NumCifreDir - TestoTemp.Length; ContaTemp <= loopTo; ContaTemp++) + 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) @@ -1065,7 +1090,6 @@ namespace ImageCatalog // Application.DoEvents() - var ClsCreaImmagine = new ImageCreatorSharp(childFile.Name, SourceDir, DestDir, DestDirStart); // ClsCreaImmagine.NomeFileChild = childFile.Name // ClsCreaImmagine.DestDir = DestDir @@ -1075,6 +1099,7 @@ namespace ImageCatalog 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) { @@ -1114,20 +1139,20 @@ namespace ImageCatalog return numerazioneType; } - private void creaimmaginiWithThreadDict(string SourcePath, string DestPath) + private void CreaimmaginiWithThreadDict(string SourcePath, string DestPath) { var dirSourceDest = new Dictionary(); if (chkAggiornaSottodirectory.Checked & chkCreaSottocartelle.Checked) { - var helper = new FileHelper(Conversions.ToInteger(txtFilePerCartella.Text), txtSuffissoCartelle.Text, Conversions.ToInteger(txtCifreContatore.Text), getNumerazione()); + var helper = new FileHelper(Conversions.ToInteger(txtFilePerCartella.Text), txtSuffissoCartelle.Text, + Conversions.ToInteger(txtCifreContatore.Text), getNumerazione()); // getfilesrecursive - dirSourceDest = helper.GetFilesRecursive(new DirectoryInfo(SourcePath), new DirectoryInfo(DestPath), "*.jpg"); + dirSourceDest = + helper.GetFilesRecursive(new DirectoryInfo(SourcePath), new DirectoryInfo(DestPath), "*.jpg"); } else if (chkAggiornaSottodirectory.Checked & !chkCreaSottocartelle.Checked) { - // = getDirsDict(SourcePath, DestPath) - } foreach (var pair in dirSourceDest) @@ -1307,8 +1332,10 @@ namespace ImageCatalog ClsCreaImmagine.jpegQuality = Conversions.ToLong(TextBox32.Text); ClsCreaImmagine.jpegQualityMin = Conversions.ToLong(TextBox33.Text); ContaImmaginiThread += 1; - MyPool.InsertWorkItem(childFile.Name, new XyThreadAdd(ClsCreaImmagine.CreaImmagineThread), new object[1] { childFile.Name }, true); + 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) { @@ -1374,7 +1401,8 @@ namespace ImageCatalog tempMultiplier = MaxPixel / (double)currentwidth; } - var NewSize = new Size((int)Math.Round(currentwidth * tempMultiplier), (int)Math.Round(currentheight * tempMultiplier)); + var NewSize = new Size((int)Math.Round(currentwidth * tempMultiplier), + (int)Math.Round(currentheight * tempMultiplier)); return NewSize; } @@ -1382,10 +1410,16 @@ namespace ImageCatalog { StopAttivo = true; //MyPool.StopThreadPool(); - - if (_mainToken != null) + try { - _mainToken.Cancel(); + _mainToken?.Cancel(); + } + catch (Exception exception) + { + _logger.LogError(exception.Message); + _logger.LogInformation("Ignora questo errore"); + // Console.WriteLine(exception); + // Console.WriteLine("Ignora questo errore"); } unlockUI(); @@ -1411,12 +1445,14 @@ namespace ImageCatalog if (PictureBox1.Image.Height >= PictureBox1.Image.Width) { PictureBox1.Height = 160; - PictureBox1.Width = Conversions.ToInteger(160 * PictureBox1.Image.Width / (double)PictureBox1.Image.Height); + PictureBox1.Width = + Conversions.ToInteger(160 * PictureBox1.Image.Width / (double)PictureBox1.Image.Height); } else { PictureBox1.Width = 224; - PictureBox1.Height = Conversions.ToInteger(224 * PictureBox1.Image.Height / (double)PictureBox1.Image.Width); + PictureBox1.Height = + Conversions.ToInteger(224 * PictureBox1.Image.Height / (double)PictureBox1.Image.Width); } } } @@ -1438,7 +1474,6 @@ namespace ImageCatalog { // GetColor() // GetPixelColor(PictureBox1.PointToScreen(e.Location)).ToArgb.ToString("X8") - } private void PictureBox1_MouseUp(object sender, MouseEventArgs e) @@ -1534,14 +1569,14 @@ namespace ImageCatalog { } - private CancellationTokenSource _mainToken; + private CancellationTokenSource? _mainToken; private async void Button1_Click(object sender, EventArgs e) { lockUI(); // Dim timeStart As Date // Dim timeStop As Date - + _mainToken?.Dispose(); _mainToken = new CancellationTokenSource(); var token = _mainToken.Token; @@ -1572,7 +1607,6 @@ namespace ImageCatalog imageCreationOptions.ChunksSize = Conversions.ToInteger(TextBox8.Text); imageCreationOptions.LinearExecution = rdbVecchioMetodo.Checked; - try { @@ -1590,20 +1624,24 @@ namespace ImageCatalog } catch (OperationCanceledException operationCanceledException) { - Console.WriteLine("Operazione cancellata"); + _logger.LogInformation("Operazione Cancellata"); + //Console.WriteLine("Operazione cancellata"); } finally { - _mainToken.Dispose(); - + _mainToken?.Dispose(); + _mainToken = null; + timer1.Tick -= Timer1OnTick; } + Label10.Text = "Finito"; unlockUI(); } private int _currentAmount = 0; private int _previousAmount = 0; + private void Timer1OnTick(object sender, EventArgs e) { _previousAmount = _currentAmount; @@ -1618,7 +1656,6 @@ namespace ImageCatalog } - private async Task CreaCatalogoParallel() { var timeStart = DateAndTime.TimeOfDay; @@ -1723,7 +1760,8 @@ namespace ImageCatalog public DirectoryInfo DirSource, DirDest, DirDestStart; public string NomeImmagine; - public PicInfo(DirectoryInfo Dir_Source, DirectoryInfo Dir_Dest, DirectoryInfo Dir_DestStart, string Nome_Immagine) + public PicInfo(DirectoryInfo Dir_Source, DirectoryInfo Dir_Dest, DirectoryInfo Dir_DestStart, + string Nome_Immagine) { DirSource = Dir_Source; DirDest = Dir_Dest; diff --git a/imagecatalog/Program.cs b/imagecatalog/Program.cs index 7cd5ffb..08949f6 100644 --- a/imagecatalog/Program.cs +++ b/imagecatalog/Program.cs @@ -1,11 +1,54 @@ -using ImageCatalog; +using System.Runtime.InteropServices; +using ImageCatalog; using ImageCatalog_2.Services; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; namespace ImageCatalog_2 { static class Program { + [DllImport("kernel32.dll", SetLastError = true)] + private static extern bool AllocConsole(); + + [DllImport("kernel32.dll", SetLastError = true)] + static extern IntPtr GetStdHandle(int nStdHandle); + + private const int STD_OUTPUT_HANDLE = -11; + private const int STD_ERROR_HANDLE = -12; + + [DllImport("kernel32.dll", SetLastError = true)] + static extern bool SetStdHandle(int nStdHandle, IntPtr handle); + + [DllImport("kernel32.dll", SetLastError = true)] + static extern IntPtr GetConsoleWindow(); + + [DllImport("kernel32.dll", SetLastError = true)] + static extern bool AttachConsole(int dwProcessId); + + [DllImport("kernel32.dll", SetLastError = true)] + static extern IntPtr CreateFile( + string lpFileName, + uint dwDesiredAccess, + uint dwShareMode, + IntPtr lpSecurityAttributes, + uint dwCreationDisposition, + uint dwFlagsAndAttributes, + IntPtr hTemplateFile); + + private const uint GENERIC_WRITE = 0x40000000; + private const uint OPEN_EXISTING = 3; + + private static void RedirectConsoleOutput() + { + var stdOutHandle = CreateFile("CONOUT$", GENERIC_WRITE, 0, IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero); + var safeFileHandle = new Microsoft.Win32.SafeHandles.SafeFileHandle(stdOutHandle, true); + var fileStream = new FileStream(safeFileHandle, FileAccess.Write); + var standardOutput = new StreamWriter(fileStream) { AutoFlush = true }; + Console.SetOut(standardOutput); + Console.SetError(standardOutput); + } + public static IServiceProvider ServiceProvider { get; private set; } [STAThread] static void Main() @@ -14,6 +57,9 @@ namespace ImageCatalog_2 Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); + AllocConsole(); + RedirectConsoleOutput(); + var serviceCollection = new ServiceCollection(); ConfigureServices(serviceCollection); @@ -36,6 +82,12 @@ namespace ImageCatalog_2 // Register your forms services.AddTransient(); + + services.AddLogging(configure => + { + configure.AddConsole(); + configure.SetMinimumLevel(LogLevel.Debug); + }); } } } -- 2.52.0 From 1b78b245d1ab31a6fd9bda62cda5e8562ed2bb50 Mon Sep 17 00:00:00 2001 From: Marco Date: Wed, 23 Jul 2025 15:24:36 +0200 Subject: [PATCH 013/127] Added configuration file --- imagecatalog/ImageCatalog 2.csproj | 3 +++ 1 file changed, 3 insertions(+) diff --git a/imagecatalog/ImageCatalog 2.csproj b/imagecatalog/ImageCatalog 2.csproj index 572f666..ebb99ac 100644 --- a/imagecatalog/ImageCatalog 2.csproj +++ b/imagecatalog/ImageCatalog 2.csproj @@ -14,6 +14,9 @@ default Logo.ico + + win-x64 + true -- 2.52.0 From b98623f0922c09125e6b42f85b7809d2327c91e9 Mon Sep 17 00:00:00 2001 From: Marco Date: Wed, 23 Jul 2025 17:16:06 +0200 Subject: [PATCH 014/127] optimizations --- MaddoShared/ImageCreationStuff.cs | 103 +++++++++++++++++------------- MaddoShared/MaddoShared.csproj | 1 + imagecatalog/DataModel.cs | 9 +++ imagecatalog/MainForm.cs | 43 +++++++------ imagecatalog/Program.cs | 3 + 5 files changed, 97 insertions(+), 62 deletions(-) diff --git a/MaddoShared/ImageCreationStuff.cs b/MaddoShared/ImageCreationStuff.cs index 439f3dc..e8a8a3e 100644 --- a/MaddoShared/ImageCreationStuff.cs +++ b/MaddoShared/ImageCreationStuff.cs @@ -9,10 +9,11 @@ using System.Threading; using System.Threading.Tasks; using CatalogVbLib; using Dasync.Collections; +using Microsoft.Extensions.Logging; namespace MaddoShared { - public class ImageCreationStuff + public class ImageCreationStuff(ILogger logger) { public class Options { @@ -31,7 +32,9 @@ namespace MaddoShared public bool LinearExecution { get; set; } } - public async Task CreaCatalogoParallel(Options options, ConcurrentBag results, EventHandler> updateEvent, CancellationToken cancellationToken = default(CancellationToken)) + public async Task CreaCatalogoParallel(Options options, ConcurrentBag results, + EventHandler> updateEvent, + CancellationToken cancellationToken = default(CancellationToken)) { var stopwatch = new Stopwatch(); stopwatch.Start(); @@ -42,18 +45,20 @@ namespace MaddoShared // todo set finito label stopwatch.Stop(); - return $"{stopwatch.Elapsed.Hours}h {stopwatch.Elapsed.Minutes}m ${stopwatch.Elapsed.Seconds}s ({stopwatch.Elapsed.TotalSeconds}s)"; - - + return + $"{stopwatch.Elapsed.Hours}h {stopwatch.Elapsed.Minutes}m ${stopwatch.Elapsed.Seconds}s ({stopwatch.Elapsed.TotalSeconds}s)"; } - public async Task CreaImmaginiParallel(Options options, ConcurrentBag results, EventHandler> updateEvent, CancellationToken cancellationToken = default(CancellationToken)) + public async Task CreaImmaginiParallel(Options options, ConcurrentBag results, + EventHandler> updateEvent, + CancellationToken cancellationToken = default(CancellationToken)) { var dataToProcess = new List(); if (options.AggiornaSottodirectory && options.CreaSottocartelle) { var helper = new FileHelperSharp(); - dataToProcess = helper.GetFilesRecursive(new DirectoryInfo(options.SourcePath), new DirectoryInfo(options.DestinationPath), + dataToProcess = helper.GetFilesRecursive(new DirectoryInfo(options.SourcePath), + new DirectoryInfo(options.DestinationPath), "*.jpg", new FileHelperOptions() { FilesPerFolder = options.FilePerCartella, @@ -106,14 +111,19 @@ namespace MaddoShared //var allTasks = new List(); var test = from d in dataToProcess - select Task.Factory.StartNew(async () => - { - await new ImageCreatorSharp(d.File, d.Directory).CreaImmagineThread(d.File.Name); + select Task.Factory.StartNew(async () => + { + var imgCreator = new ImageCreatorSharp(d.File, d.Directory); + await imgCreator.CreaImmagineThread(d.File.Name); + + //await new ImageCreatorSharp(d.File, d.Directory).CreaImmagineThread(d.File.Name); - //var imgC = new ImageCreatorSharp(d.File, d.Directory); - //imgC.CreaImmagineThread(d.File.Name); - //imgC = null; - }, CancellationToken.None, TaskCreationOptions.None, scheduler); + imgCreator = null; + + //var imgC = new ImageCreatorSharp(d.File, d.Directory); + //imgC.CreaImmagineThread(d.File.Name); + //imgC = null; + }, CancellationToken.None, TaskCreationOptions.None, scheduler); //int count = 0; @@ -128,59 +138,66 @@ namespace MaddoShared { if (options.ChunksSize == 0) { - - //var opts = new ParallelOptions() { MaxDegreeOfParallelism = threads, CancellationToken = cancellationToken, TaskScheduler = scheduler}; await dataToProcess.ParallelForEachAsync(async fileData => - { - await new ImageCreatorSharp(fileData.File, fileData.Directory).CreaImmagineThread(fileData.File.Name); - results.Add(fileData.File.Name); - //count = Interlocked.Increment(ref count); - try - { - updateEvent?.Invoke(this, new Tuple(fileData.File.Name, dataToProcess.Count) ); - } - catch (Exception e) - { - Console.WriteLine(e); - throw; - } - - }, maxDegreeOfParallelism: threads, false, cancellationToken); - + { + var imgCreator = new ImageCreatorSharp(fileData.File, fileData.Directory); + await imgCreator.CreaImmagineThread(fileData.File.Name); + // await new ImageCreatorSharp(fileData.File, fileData.Directory).CreaImmagineThread(fileData.File.Name); + results.Add(fileData.File.Name); + //count = Interlocked.Increment(ref count); + try + { + updateEvent?.Invoke(this, new Tuple(fileData.File.Name, dataToProcess.Count)); + } + catch (Exception e) + { + logger.LogError(e, "Error in reporting update"); + //Console.WriteLine(e); + throw; + } + finally + { + // Disposing of the creator + imgCreator = null; + } + }, maxDegreeOfParallelism: threads, false, cancellationToken); } else { - var asdf = SplitList(dataToProcess.ToList(), options.ChunksSize).ToList(); - + foreach (var sdaf in asdf) { await sdaf.ParallelForEachAsync(async fileData => { - await new ImageCreatorSharp(fileData.File, fileData.Directory).CreaImmagineThread(fileData.File.Name); + var imgCreator = new ImageCreatorSharp(fileData.File, fileData.Directory); + await imgCreator.CreaImmagineThread(fileData.File.Name); + // await new ImageCreatorSharp(fileData.File, fileData.Directory).CreaImmagineThread( + // fileData.File.Name); results.Add(fileData.File.Name); //count = Interlocked.Increment(ref count); try { - updateEvent?.Invoke(this, new Tuple(fileData.File.Name, dataToProcess.Count)); + updateEvent?.Invoke(this, + new Tuple(fileData.File.Name, dataToProcess.Count)); } catch (Exception e) { - Console.WriteLine(e); + logger.LogError("Error in reporting update"); + //Console.WriteLine(e); throw; } + finally + { + imgCreator = null; + } }, maxDegreeOfParallelism: threads, false, cancellationToken); } - - - } } - - } public static IEnumerable> SplitList(List bigList, int nSize = 3) @@ -191,4 +208,4 @@ namespace MaddoShared } } } -} +} \ No newline at end of file diff --git a/MaddoShared/MaddoShared.csproj b/MaddoShared/MaddoShared.csproj index 25053f8..4ba12c1 100644 --- a/MaddoShared/MaddoShared.csproj +++ b/MaddoShared/MaddoShared.csproj @@ -15,6 +15,7 @@ + diff --git a/imagecatalog/DataModel.cs b/imagecatalog/DataModel.cs index 4725554..da345bf 100644 --- a/imagecatalog/DataModel.cs +++ b/imagecatalog/DataModel.cs @@ -17,6 +17,8 @@ namespace ImageCatalog_2 public ICommand TestCommand { get; } public ICommand AsyncTestCommand { get; } + + public ICommand ProcessImagesCommand { get; } private readonly ITestService _service; public DataModel(ITestService testService) @@ -25,6 +27,8 @@ namespace ImageCatalog_2 TestCommand = new RelayCommand(Test); AsyncTestCommand = new AsyncCommand(TestAsync); + + ProcessImagesCommand = new AsyncCommand(ProcessImages); } private string _sourcePath; @@ -73,5 +77,10 @@ namespace ImageCatalog_2 Debug.WriteLine("Yep c"); } + private async Task ProcessImages() + { + + } + } } diff --git a/imagecatalog/MainForm.cs b/imagecatalog/MainForm.cs index f856f2a..d3e5e3c 100644 --- a/imagecatalog/MainForm.cs +++ b/imagecatalog/MainForm.cs @@ -32,9 +32,12 @@ namespace ImageCatalog private readonly ITestService _service; private readonly ILogger _logger; - public MainForm(ITestService testService, ILogger logger) + private readonly ImageCreationStuff _imageCreationService; + + public MainForm(ITestService testService, ImageCreationStuff imageCreationStuff, ILogger logger) { _service = testService; + _imageCreationService = imageCreationStuff; _logger = logger; _logger.LogDebug("Start"); @@ -254,6 +257,7 @@ namespace ImageCatalog //btnCreaCatalogoAsync.Enabled = true; } + // Vecchio, non usato private void btnCreaCatalogo_Click(object sender, EventArgs e) { _logger.LogInformation("Avvio elaborazione..."); @@ -1573,14 +1577,14 @@ namespace ImageCatalog private async void Button1_Click(object sender, EventArgs e) { + _logger.LogInformation("Avvio elaborazione..."); lockUI(); // Dim timeStart As Date // Dim timeStop As Date _mainToken?.Dispose(); _mainToken = new CancellationTokenSource(); var token = _mainToken.Token; - - + // timeStart = TimeOfDay FixPaths(); Label10.Text = "Elaborazione in corso..."; @@ -1593,24 +1597,25 @@ namespace ImageCatalog ProgressBar1.Value = 0; // Await CreaCatalogoParallel() - var imgStf = new ImageCreationStuff(); - var imageCreationOptions = new ImageCreationStuff.Options(); - imageCreationOptions.AggiornaSottodirectory = chkAggiornaSottodirectory.Checked; - imageCreationOptions.CreaSottocartelle = chkCreaSottocartelle.Checked; - imageCreationOptions.FilePerCartella = Conversions.ToInteger(txtFilePerCartella.Text); - imageCreationOptions.SuffissoCartelle = txtSuffissoCartelle.Text; - imageCreationOptions.CifreContatore = Conversions.ToInteger(txtCifreContatore.Text); - imageCreationOptions.NumerazioneType = GetNumerazioneEnum(); - imageCreationOptions.SourcePath = Model.SourcePath; - imageCreationOptions.DestinationPath = Model.DestinationPath; - imageCreationOptions.MaxThreads = Conversions.ToInteger(TextBox7.Text); - imageCreationOptions.ChunksSize = Conversions.ToInteger(TextBox8.Text); - imageCreationOptions.LinearExecution = rdbVecchioMetodo.Checked; - + var imgStf = _imageCreationService; //new ImageCreationStuff(); + var imageCreationOptions = new ImageCreationStuff.Options + { + AggiornaSottodirectory = chkAggiornaSottodirectory.Checked, + CreaSottocartelle = chkCreaSottocartelle.Checked, + FilePerCartella = Conversions.ToInteger(txtFilePerCartella.Text), + SuffissoCartelle = txtSuffissoCartelle.Text, + CifreContatore = Conversions.ToInteger(txtCifreContatore.Text), + NumerazioneType = GetNumerazioneEnum(), + SourcePath = Model.SourcePath, + DestinationPath = Model.DestinationPath, + MaxThreads = Conversions.ToInteger(TextBox7.Text), + ChunksSize = Conversions.ToInteger(TextBox8.Text), + LinearExecution = rdbVecchioMetodo.Checked + }; try { - _results = new ConcurrentBag(); + _results = []; _currentAmount = 0; _previousAmount = 0; timer1.Tick += Timer1OnTick; @@ -1661,7 +1666,7 @@ namespace ImageCatalog var timeStart = DateAndTime.TimeOfDay; ContaImmaginiThread = 0; setLabel10Text("Elaborazione in corso..."); - var imgStf = new ImageCreationStuff(); + var imgStf = _imageCreationService; var imageCreationOptions = new ImageCreationStuff.Options(); imageCreationOptions.AggiornaSottodirectory = chkAggiornaSottodirectory.Checked; imageCreationOptions.CreaSottocartelle = chkCreaSottocartelle.Checked; diff --git a/imagecatalog/Program.cs b/imagecatalog/Program.cs index 08949f6..0fe5fba 100644 --- a/imagecatalog/Program.cs +++ b/imagecatalog/Program.cs @@ -1,6 +1,7 @@ using System.Runtime.InteropServices; using ImageCatalog; using ImageCatalog_2.Services; +using MaddoShared; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -80,6 +81,8 @@ namespace ImageCatalog_2 services.AddTransient(); + services.AddTransient(); + // Register your forms services.AddTransient(); -- 2.52.0 From 55713c340bba7f07e7b6617515afabd91d9ede0f Mon Sep 17 00:00:00 2001 From: Marco Date: Thu, 24 Jul 2025 14:33:48 +0200 Subject: [PATCH 015/127] Dispose images --- MaddoShared/ImageCreationStuff.cs | 105 ++++- MaddoShared/ImageCreatorSharp.cs | 679 ++++++++++++++---------------- imagecatalog/MainForm.cs | 2 +- 3 files changed, 429 insertions(+), 357 deletions(-) diff --git a/MaddoShared/ImageCreationStuff.cs b/MaddoShared/ImageCreationStuff.cs index e8a8a3e..9df3308 100644 --- a/MaddoShared/ImageCreationStuff.cs +++ b/MaddoShared/ImageCreationStuff.cs @@ -40,7 +40,7 @@ namespace MaddoShared stopwatch.Start(); // todo immagini counter //todo set label - await CreaImmaginiParallel(options, results, updateEvent, cancellationToken); + await ProcessImagesParallel(options, results, updateEvent, cancellationToken); // todo set finito label stopwatch.Stop(); @@ -49,6 +49,107 @@ namespace MaddoShared $"{stopwatch.Elapsed.Hours}h {stopwatch.Elapsed.Minutes}m ${stopwatch.Elapsed.Seconds}s ({stopwatch.Elapsed.TotalSeconds}s)"; } + public async Task ProcessImagesParallel( + Options options, + ConcurrentBag results, + EventHandler> updateEvent, + CancellationToken cancellationToken = default) + { + List dataToProcess = GetFilesToProcess(options); + + int threads = options.MaxThreads == 0 ? Environment.ProcessorCount * 2 : options.MaxThreads; + + Func processFile = async fileData => + { + using var imgCreator = new ImageCreatorSharp(fileData.File, fileData.Directory); + await imgCreator.CreaImmagineThread(fileData.File.Name); + + results.Add(fileData.File.Name); + + try + { + updateEvent?.Invoke(this, new Tuple(fileData.File.Name, dataToProcess.Count)); + } + catch (Exception e) + { + logger.LogError(e, "Error in reporting update"); + throw; + } + // finally + // { + // imgCreator = null; + // } + }; + + if (options.LinearExecution) + { + foreach (var fileData in dataToProcess) + await processFile(fileData); + } + else + { + var chunks = options.ChunksSize > 0 + ? SplitList(dataToProcess, options.ChunksSize) + : new List> { dataToProcess }; + + foreach (var chunk in chunks) + { + await chunk.ParallelForEachAsync( + processFile, + maxDegreeOfParallelism: threads, + false, + cancellationToken); + + chunk.Clear(); + GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced, blocking: false, compacting: false); + } + } + } + + private List GetFilesToProcess(Options options) + { + if (options.AggiornaSottodirectory && options.CreaSottocartelle) + { + var helper = new FileHelperSharp(); + return helper.GetFilesRecursive( + new DirectoryInfo(options.SourcePath), + new DirectoryInfo(options.DestinationPath), + "*.jpg", + new FileHelperOptions + { + FilesPerFolder = options.FilePerCartella, + Suffix = options.SuffissoCartelle, + CounterSize = options.CifreContatore, + NumerationType = options.NumerazioneType + }); + } + + var files = Directory.EnumerateFiles( + options.SourcePath, + "*.jpg", + options.AggiornaSottodirectory ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly); + + return files.Select(x => + { + var fInfo = new FileInfo(x); + var filePath = fInfo.DirectoryName; + var trimmedSourcePath = options.SourcePath.TrimEnd('\\'); + var newFilePath = fInfo.FullName.Replace(trimmedSourcePath, "").TrimStart('\\'); + newFilePath = Path.Combine(options.DestinationPath, newFilePath); + + var destFolderPath = new FileInfo(newFilePath).DirectoryName; + var destFolderInfo = new DirectoryInfo(destFolderPath); + destFolderInfo.EnsureDirectoryExists(); + + return new FileData(fInfo, new DirectoryInfo(new FileInfo(newFilePath).DirectoryName)); + + // var destDir = new FileInfo(newFilePath).Directory!; + // destDir.Create(); // Ensure exists + // + // return new FileData(fInfo, destDir); + }).ToList(); + } + public async Task CreaImmaginiParallel(Options options, ConcurrentBag results, EventHandler> updateEvent, CancellationToken cancellationToken = default(CancellationToken)) @@ -115,7 +216,7 @@ namespace MaddoShared { var imgCreator = new ImageCreatorSharp(d.File, d.Directory); await imgCreator.CreaImmagineThread(d.File.Name); - + //await new ImageCreatorSharp(d.File, d.Directory).CreaImmagineThread(d.File.Name); imgCreator = null; diff --git a/MaddoShared/ImageCreatorSharp.cs b/MaddoShared/ImageCreatorSharp.cs index 849d8c6..d177ceb 100644 --- a/MaddoShared/ImageCreatorSharp.cs +++ b/MaddoShared/ImageCreatorSharp.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.Linq; @@ -19,7 +20,8 @@ using SixLabors.ImageSharp.Metadata.Profiles.Exif; // Imports System.Threading -public class ImageCreatorSharp +[SuppressMessage("Interoperability", "CA1416:Validate platform compatibility")] +public class ImageCreatorSharp : IDisposable { private bool FotoRuotaADestra = false; private bool FotoRuotaASinistra = false; @@ -93,41 +95,34 @@ public class ImageCreatorSharp preparaVariabili(); ExtractExif(); // Dim g As System.Drawing.Image = System.Drawing.Image.FromFile(Path.Combine(SourceDir.FullName, NomeFileChild)) - using (Image g = Image.FromFile(WorkFile.FullName)) - { + using Image g = Image.FromFile(WorkFile.FullName); + // Dim g As System.Drawing.Image = System.Drawing.Image.FromFile(WorkFile.FullName) - // Dim g As System.Drawing.Image = System.Drawing.Image.FromFile(WorkFile.FullName) + // Imposta testo extra + impostaTestoExtra(g); - // Imposta testo extra - impostaTestoExtra(g); + // Ruota l'immagine in base ai dati EXIF + Rotation(g); - // Ruota l'immagine in base ai dati EXIF - Rotation(g); + // Forza jpeg se è selezionata l'opzione + System.Drawing.Imaging.ImageFormat thisFormat = g.RawFormat; + if (PicSettings.UsaForzaJpg == true) + thisFormat = System.Drawing.Imaging.ImageFormat.Jpeg; - // Forza jpeg se è selezionata l'opzione - System.Drawing.Imaging.ImageFormat thisFormat = g.RawFormat; - if (PicSettings.UsaForzaJpg == true) - thisFormat = System.Drawing.Imaging.ImageFormat.Jpeg; + prepareThumbnailSize(g); - prepareThumbnailSize(g); + using Bitmap imgOutputBig = new Bitmap(g, thumbSizeBig.Width, thumbSizeBig.Height); + //Bitmap imgOutputBig = new Bitmap(g, thumbSizeBig.Width, thumbSizeBig.Height); + imgOutputBig.SetResolution(g.HorizontalResolution, g.VerticalResolution); - using (Bitmap imgOutputBig = new Bitmap(g, thumbSizeBig.Width, thumbSizeBig.Height)) - { - //Bitmap imgOutputBig = new Bitmap(g, thumbSizeBig.Width, thumbSizeBig.Height); - imgOutputBig.SetResolution(g.HorizontalResolution, g.VerticalResolution); + // Crea le miniature + creaMiniature(g, imgOutputBig, thisFormat); - // Crea le miniature - creaMiniature(g, imgOutputBig, thisFormat); + AggiungiTesto(g, imgOutputBig); - AggiungiTesto(g, imgOutputBig); + aggiungiLogo(imgOutputBig); - aggiungiLogo(imgOutputBig); - - SalvaFoto(imgOutputBig, thumbSizeBig, nomeFileBig, nomeFileSmall, thumbSizeSmall, thisFormat); - } - - - } + SalvaFoto(imgOutputBig, thumbSizeBig, nomeFileBig, nomeFileSmall, thumbSizeSmall, thisFormat); }); // g.Dispose() @@ -497,20 +492,16 @@ public class ImageCreatorSharp } else { - using (Bitmap imgOutputSmall = new Bitmap(g, thumbSizeSmall.Width, thumbSizeSmall.Height)) - { - imgOutputSmall.Save(Path.Combine(DestDir.FullName, nomeFileSmall), thisFormat); - //imgOutputSmall.Dispose(); - } + using var imgOutputSmall = new Bitmap(g, thumbSizeSmall.Width, thumbSizeSmall.Height); + imgOutputSmall.Save(Path.Combine(DestDir.FullName, nomeFileSmall), thisFormat); + //imgOutputSmall.Dispose(); } } else { - using (Bitmap imgOutputSmall = new Bitmap(g, thumbSizeSmall.Width, thumbSizeSmall.Height)) - { - imgOutputSmall.Save(Path.Combine(DestDir.FullName, nomeFileSmall), thisFormat); - //imgOutputSmall.Dispose(); - } + using Bitmap imgOutputSmall = new Bitmap(g, thumbSizeSmall.Width, thumbSizeSmall.Height); + imgOutputSmall.Save(Path.Combine(DestDir.FullName, nomeFileSmall), thisFormat); + //imgOutputSmall.Dispose(); } } } @@ -521,169 +512,165 @@ public class ImageCreatorSharp private void AggiungiTesto(Image g, Bitmap imgOutputBig) { - using (var grPhoto = Graphics.FromImage(imgOutputBig)) + using var grPhoto = Graphics.FromImage(imgOutputBig); + grPhoto.SmoothingMode = SmoothingMode.AntiAlias; + + Font crFont = null/* TODO Change to default(_) if this is not a reference type */; + SizeF crSize = new SizeF(); + int LarghezzaStandard; + + if (PicSettings.Grassetto == true) + crFont = new Font(PicSettings.IlFont, DimensioneStandard, FontStyle.Bold); + else + crFont = new Font(PicSettings.IlFont, DimensioneStandard); + crSize = grPhoto.MeasureString(testoFirma, crFont); + LarghezzaStandard = System.Convert.ToInt32(crSize.Width); + + if (crSize.Width > System.Convert.ToSingle(g.Width)) { - grPhoto.SmoothingMode = SmoothingMode.AntiAlias; - - Font crFont = null/* TODO Change to default(_) if this is not a reference type */; - SizeF crSize = new SizeF(); - int LarghezzaStandard; - - if (PicSettings.Grassetto == true) - crFont = new Font(PicSettings.IlFont, DimensioneStandard, FontStyle.Bold); - else - crFont = new Font(PicSettings.IlFont, DimensioneStandard); - crSize = grPhoto.MeasureString(testoFirma, crFont); - LarghezzaStandard = System.Convert.ToInt32(crSize.Width); - - if (crSize.Width > System.Convert.ToSingle(g.Width)) - { - int Conta = DimensioneStandard; - do - { - if (Conta > 20) - Conta -= 5; - else - Conta -= 1; - if (PicSettings.Grassetto == true) - crFont = new Font(PicSettings.IlFont, Conta, FontStyle.Bold); - else - crFont = new Font(PicSettings.IlFont, Conta); - crSize = grPhoto.MeasureString(testoFirma, crFont); - if (crSize.Width < System.Convert.ToSingle(g.Width)) - { - LarghezzaStandard = System.Convert.ToInt32(crSize.Width); - break; - } - - if (Conta <= 5) - break; - } - while (true); - DimensioneStandard = Conta; - } - - - switch (PicSettings.Posizione.ToUpper()) - { - case "ALTO": - { - yPosFromBottom = (PicSettings.Margine); - yPosFromBottom3 = (PicSettings.MargVert); - break; - } - - case "BASSO": - { - 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))); - break; - } - } - - float xCenterOfImg = 0; - float xCenterOfImg3 = 0; - StringFormat StrFormat = new StringFormat(); - switch (PicSettings.Allineamento.ToUpper()) - { - case "SINISTRA": - { - xCenterOfImg = System.Convert.ToSingle((PicSettings.Margine + (LarghezzaStandard / (double)2))); - xCenterOfImg3 = System.Convert.ToSingle((PicSettings.MargVert + (LarghezzaStandard / (double)2))); - if ((LarghezzaStandard / (double)2) > (g.Width / (double)2) - PicSettings.Margine) - xCenterOfImg = System.Convert.ToSingle((g.Width / (double)2)); - if ((LarghezzaStandard / (double)2) > (g.Width / (double)2) - PicSettings.MargVert) - xCenterOfImg3 = System.Convert.ToSingle((g.Width / (double)2)); - break; - } - - case "CENTRO": - { - xCenterOfImg = System.Convert.ToSingle((g.Width / (double)2)); - break; - } - - case "DESTRA": - { - xCenterOfImg = System.Convert.ToSingle((g.Width - PicSettings.Margine - (LarghezzaStandard / (double)2))); - xCenterOfImg3 = System.Convert.ToSingle((g.Width - PicSettings.MargVert - (LarghezzaStandard / (double)2))); - if ((LarghezzaStandard / (double)2) > (g.Width / (double)2) - PicSettings.Margine) - xCenterOfImg = System.Convert.ToSingle((g.Width / (double)2)); - if ((LarghezzaStandard / (double)2) > (g.Width / (double)2) - PicSettings.MargVert) - xCenterOfImg3 = System.Convert.ToSingle((g.Width / (double)2)); - break; - } - } - StrFormat.Alignment = StringAlignment.Center; - - 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)); - - if (FotoRuotaADestra | FotoRuotaASinistra) + int Conta = DimensioneStandard; + do { + if (Conta > 20) + Conta -= 5; + else + Conta -= 1; if (PicSettings.Grassetto == true) - crFont = new Font(PicSettings.IlFont, PicSettings.DimVert, FontStyle.Bold); + crFont = new Font(PicSettings.IlFont, Conta, FontStyle.Bold); else - crFont = new Font(PicSettings.IlFont, PicSettings.DimVert); - } - else if (PicSettings.Grassetto == true) - crFont = new Font(PicSettings.IlFont, DimensioneStandard, FontStyle.Bold); - else - crFont = new Font(PicSettings.IlFont, DimensioneStandard); - - - // qui scrive il testo (nomefilebig) - if (PicSettings.TestoNome) - { - if (PicSettings.NomeData & g.PropertyIdList.Length > 0) + crFont = new Font(PicSettings.IlFont, Conta); + crSize = grPhoto.MeasureString(testoFirma, crFont); + if (crSize.Width < System.Convert.ToSingle(g.Width)) { - //ExifReader DatiExif = new ExifReader((Bitmap)g); - dataFoto = _creationDate ?? DateTime.Now; //DatiExif.DateTimeOriginal; + LarghezzaStandard = System.Convert.ToInt32(crSize.Width); + break; + } - grPhoto.DrawString((nomeFileBig + " " + dataFoto.ToShortDateString()), crFont, semiTransBrush2, new PointF(xCenterOfImg + 1, yPosFromBottom + 1), StrFormat); - grPhoto.DrawString((nomeFileBig + " " + dataFoto.ToShortDateString()), crFont, semiTransBrush, new PointF(xCenterOfImg, yPosFromBottom), StrFormat); - } - else - { - grPhoto.DrawString(nomeFileBig, crFont, semiTransBrush2, new PointF(xCenterOfImg + 1, yPosFromBottom + 1), StrFormat); - grPhoto.DrawString(nomeFileBig, crFont, semiTransBrush, new PointF(xCenterOfImg, yPosFromBottom), StrFormat); - } + if (Conta <= 5) + break; } - - if (PicSettings.TestoNome == false) - { - if (FotoRuotaADestra | FotoRuotaASinistra) - { - if (PicSettings.TestoMin == false) - { - grPhoto.DrawString(testoFirmaV, crFont, semiTransBrush2, new PointF(xCenterOfImg + 1, yPosFromBottom3 + 1), StrFormat); - grPhoto.DrawString(testoFirmaV, crFont, semiTransBrush, new PointF(xCenterOfImg, yPosFromBottom3), StrFormat); - } - if (PicSettings.TestoMin == true) - { - grPhoto.DrawString(testoFirmaV, crFont, semiTransBrush2, new PointF(xCenterOfImg + 1, yPosFromBottom4 + 1), StrFormat); - grPhoto.DrawString(testoFirmaV, crFont, semiTransBrush, new PointF(xCenterOfImg, yPosFromBottom4), StrFormat); - } - } - else - { - grPhoto.DrawString(testoFirma, crFont, semiTransBrush2, new PointF(xCenterOfImg + 1, yPosFromBottom + 1), StrFormat); - grPhoto.DrawString(testoFirma, crFont, semiTransBrush, new PointF(xCenterOfImg, yPosFromBottom), StrFormat); - } - } - - if (string.Equals(PicSettings.DirectorySorgente, PicSettings.DirectoryDestinazione, StringComparison.OrdinalIgnoreCase)) - { - nomeFileBig2 = nomeFileBig; - nomeFileBig = nomeFileBig.Substring(0, nomeFileBig.Length - 4) + PicSettings.Codice + nomeFileBig.Substring(nomeFileBig.Length - 4); - } - //grPhoto.Dispose(); - - crFont?.Dispose(); + while (true); + DimensioneStandard = Conta; } + switch (PicSettings.Posizione.ToUpper()) + { + case "ALTO": + { + yPosFromBottom = (PicSettings.Margine); + yPosFromBottom3 = (PicSettings.MargVert); + break; + } + + case "BASSO": + { + 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))); + break; + } + } + + float xCenterOfImg = 0; + float xCenterOfImg3 = 0; + StringFormat StrFormat = new StringFormat(); + switch (PicSettings.Allineamento.ToUpper()) + { + case "SINISTRA": + { + xCenterOfImg = System.Convert.ToSingle((PicSettings.Margine + (LarghezzaStandard / (double)2))); + xCenterOfImg3 = System.Convert.ToSingle((PicSettings.MargVert + (LarghezzaStandard / (double)2))); + if ((LarghezzaStandard / (double)2) > (g.Width / (double)2) - PicSettings.Margine) + xCenterOfImg = System.Convert.ToSingle((g.Width / (double)2)); + if ((LarghezzaStandard / (double)2) > (g.Width / (double)2) - PicSettings.MargVert) + xCenterOfImg3 = System.Convert.ToSingle((g.Width / (double)2)); + break; + } + + case "CENTRO": + { + xCenterOfImg = System.Convert.ToSingle((g.Width / (double)2)); + break; + } + + case "DESTRA": + { + xCenterOfImg = System.Convert.ToSingle((g.Width - PicSettings.Margine - (LarghezzaStandard / (double)2))); + xCenterOfImg3 = System.Convert.ToSingle((g.Width - PicSettings.MargVert - (LarghezzaStandard / (double)2))); + if ((LarghezzaStandard / (double)2) > (g.Width / (double)2) - PicSettings.Margine) + xCenterOfImg = System.Convert.ToSingle((g.Width / (double)2)); + if ((LarghezzaStandard / (double)2) > (g.Width / (double)2) - PicSettings.MargVert) + xCenterOfImg3 = System.Convert.ToSingle((g.Width / (double)2)); + break; + } + } + StrFormat.Alignment = StringAlignment.Center; + + 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)); + + if (FotoRuotaADestra | FotoRuotaASinistra) + { + if (PicSettings.Grassetto == true) + crFont = new Font(PicSettings.IlFont, PicSettings.DimVert, FontStyle.Bold); + else + crFont = new Font(PicSettings.IlFont, PicSettings.DimVert); + } + else if (PicSettings.Grassetto == true) + crFont = new Font(PicSettings.IlFont, DimensioneStandard, FontStyle.Bold); + else + crFont = new Font(PicSettings.IlFont, DimensioneStandard); + + + // qui scrive il testo (nomefilebig) + if (PicSettings.TestoNome) + { + if (PicSettings.NomeData & g.PropertyIdList.Length > 0) + { + //ExifReader DatiExif = new ExifReader((Bitmap)g); + dataFoto = _creationDate ?? DateTime.Now; //DatiExif.DateTimeOriginal; + + grPhoto.DrawString((nomeFileBig + " " + dataFoto.ToShortDateString()), crFont, semiTransBrush2, new PointF(xCenterOfImg + 1, yPosFromBottom + 1), StrFormat); + grPhoto.DrawString((nomeFileBig + " " + dataFoto.ToShortDateString()), crFont, semiTransBrush, new PointF(xCenterOfImg, yPosFromBottom), StrFormat); + } + else + { + grPhoto.DrawString(nomeFileBig, crFont, semiTransBrush2, new PointF(xCenterOfImg + 1, yPosFromBottom + 1), StrFormat); + grPhoto.DrawString(nomeFileBig, crFont, semiTransBrush, new PointF(xCenterOfImg, yPosFromBottom), StrFormat); + } + } + + if (PicSettings.TestoNome == false) + { + if (FotoRuotaADestra | FotoRuotaASinistra) + { + if (PicSettings.TestoMin == false) + { + grPhoto.DrawString(testoFirmaV, crFont, semiTransBrush2, new PointF(xCenterOfImg + 1, yPosFromBottom3 + 1), StrFormat); + grPhoto.DrawString(testoFirmaV, crFont, semiTransBrush, new PointF(xCenterOfImg, yPosFromBottom3), StrFormat); + } + if (PicSettings.TestoMin == true) + { + grPhoto.DrawString(testoFirmaV, crFont, semiTransBrush2, new PointF(xCenterOfImg + 1, yPosFromBottom4 + 1), StrFormat); + grPhoto.DrawString(testoFirmaV, crFont, semiTransBrush, new PointF(xCenterOfImg, yPosFromBottom4), StrFormat); + } + } + else + { + grPhoto.DrawString(testoFirma, crFont, semiTransBrush2, new PointF(xCenterOfImg + 1, yPosFromBottom + 1), StrFormat); + grPhoto.DrawString(testoFirma, crFont, semiTransBrush, new PointF(xCenterOfImg, yPosFromBottom), StrFormat); + } + } + + if (string.Equals(PicSettings.DirectorySorgente, PicSettings.DirectoryDestinazione, StringComparison.OrdinalIgnoreCase)) + { + nomeFileBig2 = nomeFileBig; + nomeFileBig = nomeFileBig.Substring(0, nomeFileBig.Length - 4) + PicSettings.Codice + nomeFileBig.Substring(nomeFileBig.Length - 4); + } + //grPhoto.Dispose(); + + crFont?.Dispose(); } @@ -694,7 +681,7 @@ public class ImageCreatorSharp // imgOutputBig if (PicSettings.LogoAggiungi == true & File.Exists(PicSettings.LogoNomeFile)) { - Image ImmagineLogo = Image.FromFile(PicSettings.LogoNomeFile); + using var ImmagineLogo = Image.FromFile(PicSettings.LogoNomeFile); Color LogoColoreTrasparente = Color.White; // Dim bmWatermark As Bitmap @@ -704,185 +691,169 @@ public class ImageCreatorSharp // bmWatermark.SetResolution(imgOutputBig.HorizontalResolution, imgOutputBig.VerticalResolution) // * Load this Bitmap into a new Graphic Object - using (Graphics grWatermark = Graphics.FromImage(imgOutputBig)) + using Graphics grWatermark = Graphics.FromImage(imgOutputBig); + ImageAttributes imageAttributes = new ImageAttributes(); + + // * The first step replace the background color with one that is transparent (Alpha=0, R=0, G=0, B=0) + ColorMap colorMap = new ColorMap(); + + // * background this will be the color we search for and replace with transparency + colorMap.OldColor = LogoColoreTrasparente; + colorMap.NewColor = Color.FromArgb(0, 0, 0, 0); + + ColorMap[] remapTable = new[] { colorMap }; + 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 + 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); + imageAttributes.SetColorMatrix(wmColorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap); + + int FotoLogoH = PicSettings.LogoAltezza; + int FotoLogoW = PicSettings.LogoLarghezza; + double FattoreAlt = ImmagineLogo.Height / (double)FotoLogoH; + double FattoreLarg = ImmagineLogo.Width / (double)FotoLogoW; + Size NuovaSize; + if (FattoreLarg > FattoreAlt) + NuovaSize = NewthumbSize(ImmagineLogo.Width, ImmagineLogo.Height, FotoLogoW, "Larghezza"); + else + NuovaSize = NewthumbSize(ImmagineLogo.Width, ImmagineLogo.Height, FotoLogoH, "Altezza"); + + int MargineUsato; + int MargineL; + bool InPercentualeL; + if (PicSettings.LogoMargine.EndsWith("%") == true) + InPercentualeL = true; + else + InPercentualeL = false; + MargineL = System.Convert.ToInt32(PicSettings.LogoMargine); + if (InPercentualeL == true) + MargineUsato = System.Convert.ToInt32(imgOutputBig.Height * MargineL / (double)100); + else + MargineUsato = MargineL; + + int xPosOfWm = 0; + int yPosOfWm = 0; + switch (PicSettings.LogoPosizioneH.ToUpper()) { - ImageAttributes imageAttributes = new ImageAttributes(); - - // * The first step replace the background color with one that is transparent (Alpha=0, R=0, G=0, B=0) - ColorMap colorMap = new ColorMap(); - - // * background this will be the color we search for and replace with transparency - colorMap.OldColor = LogoColoreTrasparente; - colorMap.NewColor = Color.FromArgb(0, 0, 0, 0); - - ColorMap[] remapTable = new[] { colorMap }; - 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 - 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); - imageAttributes.SetColorMatrix(wmColorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap); - - int FotoLogoH = PicSettings.LogoAltezza; - int FotoLogoW = PicSettings.LogoLarghezza; - double FattoreAlt = ImmagineLogo.Height / (double)FotoLogoH; - double FattoreLarg = ImmagineLogo.Width / (double)FotoLogoW; - Size NuovaSize; - if (FattoreLarg > FattoreAlt) - NuovaSize = NewthumbSize(ImmagineLogo.Width, ImmagineLogo.Height, FotoLogoW, "Larghezza"); - else - NuovaSize = NewthumbSize(ImmagineLogo.Width, ImmagineLogo.Height, FotoLogoH, "Altezza"); - - int MargineUsato; - int MargineL; - bool InPercentualeL; - if (PicSettings.LogoMargine.EndsWith("%") == true) - InPercentualeL = true; - else - InPercentualeL = false; - MargineL = System.Convert.ToInt32(PicSettings.LogoMargine); - if (InPercentualeL == true) - MargineUsato = System.Convert.ToInt32(imgOutputBig.Height * MargineL / (double)100); - else - MargineUsato = MargineL; - - int xPosOfWm = 0; - int yPosOfWm = 0; - switch (PicSettings.LogoPosizioneH.ToUpper()) + case "SINISTRA": + case "NESSUNA": { - case "SINISTRA": - case "NESSUNA": - { - xPosOfWm = MargineUsato; - break; - } - - case "CENTRO": - { - xPosOfWm = System.Convert.ToInt32((imgOutputBig.Width - NuovaSize.Width) / (double)2); - break; - } - - case "DESTRA": - { - xPosOfWm = ((imgOutputBig.Width - NuovaSize.Width) - MargineUsato); - break; - } - } - switch (PicSettings.LogoPosizioneV.ToUpper()) - { - case "ALTO": - case "NESSUNA": - { - yPosOfWm = MargineUsato; - break; - } - - case "CENTRO": - { - yPosOfWm = System.Convert.ToInt32((imgOutputBig.Height - NuovaSize.Height) / (double)2); - break; - } - - case "BASSO": - { - yPosOfWm = ((imgOutputBig.Height - NuovaSize.Height) - MargineUsato); - break; - } + xPosOfWm = MargineUsato; + break; } - grWatermark.DrawImage(ImmagineLogo, new Rectangle(xPosOfWm, yPosOfWm, NuovaSize.Width, NuovaSize.Height), 0, 0, ImmagineLogo.Width, ImmagineLogo.Height, GraphicsUnit.Pixel, imageAttributes); - //grWatermark.Dispose(); + case "CENTRO": + { + xPosOfWm = System.Convert.ToInt32((imgOutputBig.Width - NuovaSize.Width) / (double)2); + break; + } + + case "DESTRA": + { + xPosOfWm = ((imgOutputBig.Width - NuovaSize.Width) - MargineUsato); + break; + } } + switch (PicSettings.LogoPosizioneV.ToUpper()) + { + case "ALTO": + case "NESSUNA": + { + yPosOfWm = MargineUsato; + break; + } + + case "CENTRO": + { + yPosOfWm = System.Convert.ToInt32((imgOutputBig.Height - NuovaSize.Height) / (double)2); + break; + } + + case "BASSO": + { + yPosOfWm = ((imgOutputBig.Height - NuovaSize.Height) - MargineUsato); + break; + } + } + + grWatermark.DrawImage(ImmagineLogo, new Rectangle(xPosOfWm, yPosOfWm, NuovaSize.Width, NuovaSize.Height), 0, 0, ImmagineLogo.Width, ImmagineLogo.Height, GraphicsUnit.Pixel, imageAttributes); + //grWatermark.Dispose(); } } 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 + // imgOutputBig.Save(Path.Combine(_DestDir.FullName, "Temp_" & NomeFileBig), thisFormat) + if (thisFormat.Equals(ImageFormat.Jpeg)) { - // attenzione non controlla se è png - // imgOutputBig.Save(Path.Combine(_DestDir.FullName, "Temp_" & NomeFileBig), thisFormat) - if (thisFormat.Equals(ImageFormat.Jpeg)) - { - MakeImageCustomQuality(imgOutputBig, image1Stream); - } - //SalvaImmagineCustomQuality(imgOutputBig, Path.Combine(DestDir.FullName, "Temp_" + NomeFileBig), PicSettings.jpegQuality); - else - { - imgOutputBig.Save(image1Stream, thisFormat); - } - //imgOutputBig.Save(Path.Combine(DestDir.FullName, "Temp_" + NomeFileBig), thisFormat); - image1Stream.Seek(0, SeekOrigin.Begin); - 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"); - using (Bitmap imgOutputBig2 = new Bitmap(g2, thumbSizeBig.Width, thumbSizeBig.Height)) - { - if (thisFormat.Equals(ImageFormat.Jpeg)) - SalvaImmagineCustomQuality(imgOutputBig2, Path.Combine(DestDir.FullName, NomeFileBig), PicSettings.jpegQuality); - else - imgOutputBig2.Save(Path.Combine(DestDir.FullName, NomeFileBig), thisFormat); - - //imgOutputBig2.Dispose(); - } - } - - //imgOutputBig.Dispose(); - //g2.Dispose(); + MakeImageCustomQuality(imgOutputBig, image1Stream); } + //SalvaImmagineCustomQuality(imgOutputBig, Path.Combine(DestDir.FullName, "Temp_" + NomeFileBig), PicSettings.jpegQuality); else { + imgOutputBig.Save(image1Stream, thisFormat); + } + //imgOutputBig.Save(Path.Combine(DestDir.FullName, "Temp_" + NomeFileBig), thisFormat); + image1Stream.Seek(0, SeekOrigin.Begin); + 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"); + using Bitmap imgOutputBig2 = new Bitmap(g2, thumbSizeBig.Width, thumbSizeBig.Height); + if (thisFormat.Equals(ImageFormat.Jpeg)) + SalvaImmagineCustomQuality(imgOutputBig2, Path.Combine(DestDir.FullName, NomeFileBig), PicSettings.jpegQuality); + else + imgOutputBig2.Save(Path.Combine(DestDir.FullName, NomeFileBig), thisFormat); + + //imgOutputBig2.Dispose(); + + //imgOutputBig.Dispose(); + //g2.Dispose(); + } + else + { + // + if (thisFormat.Equals(ImageFormat.Jpeg)) + SalvaImmagineCustomQuality(imgOutputBig, Path.Combine(DestDir.FullName, NomeFileBig), PicSettings.jpegQuality); + else + imgOutputBig.Save(Path.Combine(DestDir.FullName, NomeFileBig), thisFormat); + + //imgOutputBig.Dispose(); + } + image1Stream.Seek(0, SeekOrigin.Begin); + + if (PicSettings.CreaMiniature) + { + if (PicSettings.AggiungiScritteMiniature) + { + using System.Drawing.Image g1 = PicSettings.FotoGrandeDimOrigina ? (Image)imgOutputBig.Clone() : Image.FromStream(image1Stream); + //if (PicSettings.FotoGrandeDimOrigina == false) + // g1 = Image.FromStream(image1Stream); + ////g1 = System.Drawing.Image.FromFile(Path.Combine(DestDir.FullName, "Temp_" + NomeFileBig)); + //else + // g1 = (Image)imgOutputBig.Clone(); + //g1 = System.Drawing.Image.FromFile(Path.Combine(DestDir.FullName, NomeFileBig)); + using Bitmap imgOutputSmall = new Bitmap(g1, thumbSizeSmall.Width, thumbSizeSmall.Height); + if (string.Equals(PicSettings.DirectorySorgente, PicSettings.DirectoryDestinazione, StringComparison.OrdinalIgnoreCase)) + NomeFileSmall = NomeFileSmall.Substring(0, NomeFileSmall.Length - 4) + PicSettings.Codice + NomeFileSmall.Substring(NomeFileSmall.Length - 4); // if (thisFormat.Equals(ImageFormat.Jpeg)) - SalvaImmagineCustomQuality(imgOutputBig, Path.Combine(DestDir.FullName, NomeFileBig), PicSettings.jpegQuality); + SalvaImmagineCustomQuality(imgOutputSmall, Path.Combine(DestDir.FullName, NomeFileSmall), PicSettings.jpegQualityMin); else - imgOutputBig.Save(Path.Combine(DestDir.FullName, NomeFileBig), thisFormat); + imgOutputSmall.Save(Path.Combine(_DestDir.FullName, NomeFileSmall), thisFormat); - //imgOutputBig.Dispose(); + //imgOutputSmall.Dispose(); + + //g1.Dispose(); } - image1Stream.Seek(0, SeekOrigin.Begin); - - if (PicSettings.CreaMiniature) - { - if (PicSettings.AggiungiScritteMiniature) - { - using (System.Drawing.Image g1 = PicSettings.FotoGrandeDimOrigina ? (Image)imgOutputBig.Clone() : Image.FromStream(image1Stream)) - { - //if (PicSettings.FotoGrandeDimOrigina == false) - // g1 = Image.FromStream(image1Stream); - ////g1 = System.Drawing.Image.FromFile(Path.Combine(DestDir.FullName, "Temp_" + NomeFileBig)); - //else - // g1 = (Image)imgOutputBig.Clone(); - //g1 = System.Drawing.Image.FromFile(Path.Combine(DestDir.FullName, NomeFileBig)); - using (Bitmap imgOutputSmall = new Bitmap(g1, thumbSizeSmall.Width, thumbSizeSmall.Height)) - { - if (string.Equals(PicSettings.DirectorySorgente, PicSettings.DirectoryDestinazione, StringComparison.OrdinalIgnoreCase)) - 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); - else - imgOutputSmall.Save(Path.Combine(_DestDir.FullName, NomeFileSmall), thisFormat); - - //imgOutputSmall.Dispose(); - } - - //g1.Dispose(); - } - } - } - - //if (File.Exists(Path.Combine(DestDir.FullName, "Temp_" + NomeFileBig))) - // File.Delete(Path.Combine(DestDir.FullName, "Temp_" + NomeFileBig)); - } + + //if (File.Exists(Path.Combine(DestDir.FullName, "Temp_" + NomeFileBig))) + // File.Delete(Path.Combine(DestDir.FullName, "Temp_" + NomeFileBig)); } private void SalvaImmagineCustomQuality(Bitmap imageToSave, string nomeFileFinale, long quality) @@ -925,12 +896,7 @@ public class ImageCreatorSharp } return null/* TODO Change to default(_) if this is not a reference type */; } - - - - - - + /// /// ''' Calculate the Size of the New image /// ''' @@ -1014,4 +980,9 @@ public class ImageCreatorSharp _NomeFileChild = value; } } + + public void Dispose() + { + + } } diff --git a/imagecatalog/MainForm.cs b/imagecatalog/MainForm.cs index d3e5e3c..4cb8fb6 100644 --- a/imagecatalog/MainForm.cs +++ b/imagecatalog/MainForm.cs @@ -1676,7 +1676,7 @@ namespace ImageCatalog imageCreationOptions.NumerazioneType = GetNumerazioneEnum(); imageCreationOptions.SourcePath = Model.SourcePath; imageCreationOptions.DestinationPath = Model.DestinationPath; - await imgStf.CreaImmaginiParallel(imageCreationOptions, _results, UiUpdateEvent); + await imgStf.ProcessImagesParallel(imageCreationOptions, _results, UiUpdateEvent); // Await CreaImmaginiParallel(txtSorgente.Text, txtDestinazione.Text) -- 2.52.0 From 22cf884d4dcc0db3cce07f0420c50750eea86db1 Mon Sep 17 00:00:00 2001 From: Marco Date: Thu, 24 Jul 2025 16:31:39 +0200 Subject: [PATCH 016/127] Version number --- imagecatalog/ImageCatalog 2.csproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/imagecatalog/ImageCatalog 2.csproj b/imagecatalog/ImageCatalog 2.csproj index ebb99ac..d1a6ed8 100644 --- a/imagecatalog/ImageCatalog 2.csproj +++ b/imagecatalog/ImageCatalog 2.csproj @@ -6,10 +6,10 @@ enable true False - 3.0.0.0 - 3.0.0.0 + 3.0.1.0 + 3.0.1.0 3.0.0-alpha.63+Branch.develop.Sha.39a9baf5c618d8d79c75b89e2d5c4020939697f2 - 3.0.0-alpha0063 + 3.0.1-alpha0063 ImageCatalog2025 default Logo.ico -- 2.52.0 From ce347a7095b0021744b7095e66ae5b242f5e7f0e Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 25 Jul 2025 10:34:54 +0200 Subject: [PATCH 017/127] Preload logo --- MaddoShared/ImageCreationStuff.cs | 328 ++++++++++++++++-------------- MaddoShared/ImageCreatorSharp.cs | 23 +-- 2 files changed, 184 insertions(+), 167 deletions(-) diff --git a/MaddoShared/ImageCreationStuff.cs b/MaddoShared/ImageCreationStuff.cs index 9df3308..9ab89cc 100644 --- a/MaddoShared/ImageCreationStuff.cs +++ b/MaddoShared/ImageCreationStuff.cs @@ -2,6 +2,7 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; +using System.Drawing; using System.IO; using System.Linq; using System.Text; @@ -57,12 +58,23 @@ namespace MaddoShared { List dataToProcess = GetFilesToProcess(options); - int threads = options.MaxThreads == 0 ? Environment.ProcessorCount * 2 : options.MaxThreads; - + // int threads = options.MaxThreads == 0 ? Environment.ProcessorCount * 2 : options.MaxThreads; + int threads = options.MaxThreads; + + Bitmap logoBmp = null; + // Load Logo + if (PicSettings.LogoAggiungi & File.Exists(PicSettings.LogoNomeFile)) + { + logoBmp = new Bitmap(PicSettings.LogoNomeFile); + } + Func processFile = async fileData => { + using var logoCopy = logoBmp.Clone(new Rectangle(0, 0, logoBmp.Width, logoBmp.Height), + logoBmp.PixelFormat); + using var imgCreator = new ImageCreatorSharp(fileData.File, fileData.Directory); - await imgCreator.CreaImmagineThread(fileData.File.Name); + await imgCreator.CreaImmagineThread(fileData.File.Name, logoCopy); results.Add(fileData.File.Name); @@ -104,6 +116,16 @@ namespace MaddoShared GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced, blocking: false, compacting: false); } } + + try + { + logoBmp?.Dispose(); + } + catch (Exception e) + { + logger.LogError(e, "Error in disposing the logo"); + } + } private List GetFilesToProcess(Options options) @@ -150,156 +172,156 @@ namespace MaddoShared }).ToList(); } - public async Task CreaImmaginiParallel(Options options, ConcurrentBag results, - EventHandler> updateEvent, - CancellationToken cancellationToken = default(CancellationToken)) - { - var dataToProcess = new List(); - if (options.AggiornaSottodirectory && options.CreaSottocartelle) - { - var helper = new FileHelperSharp(); - dataToProcess = helper.GetFilesRecursive(new DirectoryInfo(options.SourcePath), - new DirectoryInfo(options.DestinationPath), - "*.jpg", new FileHelperOptions() - { - FilesPerFolder = options.FilePerCartella, - Suffix = options.SuffissoCartelle, - CounterSize = options.CifreContatore, - NumerationType = options.NumerazioneType - }); - } - else if (!options.CreaSottocartelle) - { - var files = Directory.EnumerateFiles(options.SourcePath, "*.jpg", - options.AggiornaSottodirectory - ? SearchOption.AllDirectories - : SearchOption.TopDirectoryOnly); - - dataToProcess = files.Select(x => - { - var fInfo = new FileInfo(x); - var filePath = fInfo.DirectoryName; - var trimmedSourcePath = options.SourcePath.TrimEnd('\\'); - var newFilePath = fInfo.FullName.Replace(trimmedSourcePath, "").TrimStart('\\'); - newFilePath = Path.Combine(options.DestinationPath, newFilePath); - - var destFolderPath = new FileInfo(newFilePath).DirectoryName; - var destFolderInfo = new DirectoryInfo(destFolderPath); - destFolderInfo.EnsureDirectoryExists(); - - return new FileData(fInfo, new DirectoryInfo(new FileInfo(newFilePath).DirectoryName)); - }).ToList(); - - //// TODO - //dataToProcess = - // (from f in Directory.EnumerateFiles(options.SourcePath, "*.jpg", - // options.AggiornaSottodirectory - // ? SearchOption.AllDirectories - // : SearchOption.TopDirectoryOnly) - // select new FileData(new FileInfo(f), - // new DirectoryInfo(options.DestinationPath.PathCombine( - // new FileInfo(f).DirectoryName.Replace(options.SourcePath.TrimEnd(new char[] {'\\'}), "") - // ) - // ) - // ) - // ) - // .ToList(); - } - - var threads = options.MaxThreads == 0 ? Environment.ProcessorCount * 2 : options.MaxThreads; - var scheduler = new ConcurrentExclusiveSchedulerPair(TaskScheduler.Default, threads) - .ConcurrentScheduler; - - //var allTasks = new List(); - var test = from d in dataToProcess - select Task.Factory.StartNew(async () => - { - var imgCreator = new ImageCreatorSharp(d.File, d.Directory); - await imgCreator.CreaImmagineThread(d.File.Name); - - //await new ImageCreatorSharp(d.File, d.Directory).CreaImmagineThread(d.File.Name); - - imgCreator = null; - - //var imgC = new ImageCreatorSharp(d.File, d.Directory); - //imgC.CreaImmagineThread(d.File.Name); - //imgC = null; - }, CancellationToken.None, TaskCreationOptions.None, scheduler); - - //int count = 0; - - if (options.LinearExecution) - { - foreach (var task in test) - { - await task; - } - } - else - { - if (options.ChunksSize == 0) - { - //var opts = new ParallelOptions() { MaxDegreeOfParallelism = threads, CancellationToken = cancellationToken, TaskScheduler = scheduler}; - await dataToProcess.ParallelForEachAsync(async fileData => - { - var imgCreator = new ImageCreatorSharp(fileData.File, fileData.Directory); - await imgCreator.CreaImmagineThread(fileData.File.Name); - // await new ImageCreatorSharp(fileData.File, fileData.Directory).CreaImmagineThread(fileData.File.Name); - results.Add(fileData.File.Name); - //count = Interlocked.Increment(ref count); - - try - { - updateEvent?.Invoke(this, new Tuple(fileData.File.Name, dataToProcess.Count)); - } - catch (Exception e) - { - logger.LogError(e, "Error in reporting update"); - //Console.WriteLine(e); - throw; - } - finally - { - // Disposing of the creator - imgCreator = null; - } - }, maxDegreeOfParallelism: threads, false, cancellationToken); - } - else - { - var asdf = SplitList(dataToProcess.ToList(), options.ChunksSize).ToList(); - - - foreach (var sdaf in asdf) - { - await sdaf.ParallelForEachAsync(async fileData => - { - var imgCreator = new ImageCreatorSharp(fileData.File, fileData.Directory); - await imgCreator.CreaImmagineThread(fileData.File.Name); - // await new ImageCreatorSharp(fileData.File, fileData.Directory).CreaImmagineThread( - // fileData.File.Name); - results.Add(fileData.File.Name); - //count = Interlocked.Increment(ref count); - try - { - updateEvent?.Invoke(this, - new Tuple(fileData.File.Name, dataToProcess.Count)); - } - catch (Exception e) - { - logger.LogError("Error in reporting update"); - //Console.WriteLine(e); - throw; - } - finally - { - imgCreator = null; - } - }, maxDegreeOfParallelism: threads, false, cancellationToken); - } - } - } - } + // public async Task CreaImmaginiParallel(Options options, ConcurrentBag results, + // EventHandler> updateEvent, + // CancellationToken cancellationToken = default(CancellationToken)) + // { + // var dataToProcess = new List(); + // if (options.AggiornaSottodirectory && options.CreaSottocartelle) + // { + // var helper = new FileHelperSharp(); + // dataToProcess = helper.GetFilesRecursive(new DirectoryInfo(options.SourcePath), + // new DirectoryInfo(options.DestinationPath), + // "*.jpg", new FileHelperOptions() + // { + // FilesPerFolder = options.FilePerCartella, + // Suffix = options.SuffissoCartelle, + // CounterSize = options.CifreContatore, + // NumerationType = options.NumerazioneType + // }); + // } + // else if (!options.CreaSottocartelle) + // { + // var files = Directory.EnumerateFiles(options.SourcePath, "*.jpg", + // options.AggiornaSottodirectory + // ? SearchOption.AllDirectories + // : SearchOption.TopDirectoryOnly); + // + // dataToProcess = files.Select(x => + // { + // var fInfo = new FileInfo(x); + // var filePath = fInfo.DirectoryName; + // var trimmedSourcePath = options.SourcePath.TrimEnd('\\'); + // var newFilePath = fInfo.FullName.Replace(trimmedSourcePath, "").TrimStart('\\'); + // newFilePath = Path.Combine(options.DestinationPath, newFilePath); + // + // var destFolderPath = new FileInfo(newFilePath).DirectoryName; + // var destFolderInfo = new DirectoryInfo(destFolderPath); + // destFolderInfo.EnsureDirectoryExists(); + // + // return new FileData(fInfo, new DirectoryInfo(new FileInfo(newFilePath).DirectoryName)); + // }).ToList(); + // + // //// TODO + // //dataToProcess = + // // (from f in Directory.EnumerateFiles(options.SourcePath, "*.jpg", + // // options.AggiornaSottodirectory + // // ? SearchOption.AllDirectories + // // : SearchOption.TopDirectoryOnly) + // // select new FileData(new FileInfo(f), + // // new DirectoryInfo(options.DestinationPath.PathCombine( + // // new FileInfo(f).DirectoryName.Replace(options.SourcePath.TrimEnd(new char[] {'\\'}), "") + // // ) + // // ) + // // ) + // // ) + // // .ToList(); + // } + // + // var threads = options.MaxThreads == 0 ? Environment.ProcessorCount * 2 : options.MaxThreads; + // var scheduler = new ConcurrentExclusiveSchedulerPair(TaskScheduler.Default, threads) + // .ConcurrentScheduler; + // + // //var allTasks = new List(); + // var test = from d in dataToProcess + // select Task.Factory.StartNew(async () => + // { + // var imgCreator = new ImageCreatorSharp(d.File, d.Directory); + // await imgCreator.CreaImmagineThread(d.File.Name); + // + // //await new ImageCreatorSharp(d.File, d.Directory).CreaImmagineThread(d.File.Name); + // + // imgCreator = null; + // + // //var imgC = new ImageCreatorSharp(d.File, d.Directory); + // //imgC.CreaImmagineThread(d.File.Name); + // //imgC = null; + // }, CancellationToken.None, TaskCreationOptions.None, scheduler); + // + // //int count = 0; + // + // if (options.LinearExecution) + // { + // foreach (var task in test) + // { + // await task; + // } + // } + // else + // { + // if (options.ChunksSize == 0) + // { + // //var opts = new ParallelOptions() { MaxDegreeOfParallelism = threads, CancellationToken = cancellationToken, TaskScheduler = scheduler}; + // await dataToProcess.ParallelForEachAsync(async fileData => + // { + // var imgCreator = new ImageCreatorSharp(fileData.File, fileData.Directory); + // await imgCreator.CreaImmagineThread(fileData.File.Name); + // // await new ImageCreatorSharp(fileData.File, fileData.Directory).CreaImmagineThread(fileData.File.Name); + // results.Add(fileData.File.Name); + // //count = Interlocked.Increment(ref count); + // + // try + // { + // updateEvent?.Invoke(this, new Tuple(fileData.File.Name, dataToProcess.Count)); + // } + // catch (Exception e) + // { + // logger.LogError(e, "Error in reporting update"); + // //Console.WriteLine(e); + // throw; + // } + // finally + // { + // // Disposing of the creator + // imgCreator = null; + // } + // }, maxDegreeOfParallelism: threads, false, cancellationToken); + // } + // else + // { + // var asdf = SplitList(dataToProcess.ToList(), options.ChunksSize).ToList(); + // + // + // foreach (var sdaf in asdf) + // { + // await sdaf.ParallelForEachAsync(async fileData => + // { + // var imgCreator = new ImageCreatorSharp(fileData.File, fileData.Directory); + // await imgCreator.CreaImmagineThread(fileData.File.Name); + // // await new ImageCreatorSharp(fileData.File, fileData.Directory).CreaImmagineThread( + // // fileData.File.Name); + // results.Add(fileData.File.Name); + // //count = Interlocked.Increment(ref count); + // try + // { + // updateEvent?.Invoke(this, + // new Tuple(fileData.File.Name, dataToProcess.Count)); + // } + // catch (Exception e) + // { + // logger.LogError("Error in reporting update"); + // //Console.WriteLine(e); + // throw; + // } + // finally + // { + // imgCreator = null; + // } + // }, maxDegreeOfParallelism: threads, false, cancellationToken); + // } + // } + // } + // } public static IEnumerable> SplitList(List bigList, int nSize = 3) { diff --git a/MaddoShared/ImageCreatorSharp.cs b/MaddoShared/ImageCreatorSharp.cs index d177ceb..acf7f1a 100644 --- a/MaddoShared/ImageCreatorSharp.cs +++ b/MaddoShared/ImageCreatorSharp.cs @@ -85,7 +85,7 @@ public class ImageCreatorSharp : IDisposable this.DestDir = destination; } - public async Task CreaImmagineThread(string Info) + public async Task CreaImmagineThread(string Info, Image logo) { try { @@ -120,7 +120,7 @@ public class ImageCreatorSharp : IDisposable AggiungiTesto(g, imgOutputBig); - aggiungiLogo(imgOutputBig); + aggiungiLogo(imgOutputBig, logo); SalvaFoto(imgOutputBig, thumbSizeBig, nomeFileBig, nomeFileSmall, thumbSizeSmall, thisFormat); }); @@ -676,19 +676,14 @@ public class ImageCreatorSharp : IDisposable - private void aggiungiLogo(Bitmap imgOutputBig) + private void aggiungiLogo(Bitmap imgOutputBig, Image logo) { // imgOutputBig 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; - // Dim bmWatermark As Bitmap - - // * Create a Bitmap based on the previously modified photograph Bitmap - // bmWatermark = New Bitmap(imgOutputBig) - // bmWatermark.SetResolution(imgOutputBig.HorizontalResolution, imgOutputBig.VerticalResolution) // * Load this Bitmap into a new Graphic Object using Graphics grWatermark = Graphics.FromImage(imgOutputBig); @@ -711,13 +706,13 @@ public class ImageCreatorSharp : IDisposable int FotoLogoH = PicSettings.LogoAltezza; int FotoLogoW = PicSettings.LogoLarghezza; - double FattoreAlt = ImmagineLogo.Height / (double)FotoLogoH; - double FattoreLarg = ImmagineLogo.Width / (double)FotoLogoW; + double FattoreAlt = logo.Height / (double)FotoLogoH; + double FattoreLarg = logo.Width / (double)FotoLogoW; Size NuovaSize; if (FattoreLarg > FattoreAlt) - NuovaSize = NewthumbSize(ImmagineLogo.Width, ImmagineLogo.Height, FotoLogoW, "Larghezza"); + NuovaSize = NewthumbSize(logo.Width, logo.Height, FotoLogoW, "Larghezza"); else - NuovaSize = NewthumbSize(ImmagineLogo.Width, ImmagineLogo.Height, FotoLogoH, "Altezza"); + NuovaSize = NewthumbSize(logo.Width, logo.Height, FotoLogoH, "Altezza"); int MargineUsato; int MargineL; @@ -777,7 +772,7 @@ public class ImageCreatorSharp : IDisposable } } - grWatermark.DrawImage(ImmagineLogo, new Rectangle(xPosOfWm, yPosOfWm, NuovaSize.Width, NuovaSize.Height), 0, 0, ImmagineLogo.Width, ImmagineLogo.Height, GraphicsUnit.Pixel, imageAttributes); + grWatermark.DrawImage(logo, new Rectangle(xPosOfWm, yPosOfWm, NuovaSize.Width, NuovaSize.Height), 0, 0, logo.Width, logo.Height, GraphicsUnit.Pixel, imageAttributes); //grWatermark.Dispose(); } } -- 2.52.0 From 33d397d67a1ece4582cf0b90f02785aec19985e6 Mon Sep 17 00:00:00 2001 From: Marco Date: Mon, 28 Jul 2025 09:00:07 +0200 Subject: [PATCH 018/127] Removed visual basic from main form --- imagecatalog/MainForm.cs | 3201 +++++++++++++++++++------------------- 1 file changed, 1569 insertions(+), 1632 deletions(-) diff --git a/imagecatalog/MainForm.cs b/imagecatalog/MainForm.cs index 4cb8fb6..541f383 100644 --- a/imagecatalog/MainForm.cs +++ b/imagecatalog/MainForm.cs @@ -17,832 +17,944 @@ using ImageCatalog_2; using ImageCatalog_2.Services; using MaddoShared; using Microsoft.Extensions.Logging; -using Microsoft.VisualBasic; -using Microsoft.VisualBasic.CompilerServices; -namespace ImageCatalog +namespace ImageCatalog; + +public delegate void XyThreadAdd(string Info); + +public partial class MainForm { - public delegate void XyThreadAdd(string Info); + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] + public DataModel Model { get; set; } + + private readonly ILogger _logger; - public partial class MainForm + private readonly ImageCreationStuff _imageCreationService; + + public MainForm( ImageCreationStuff imageCreationStuff, ILogger logger) { - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public DataModel Model { get; set; } + _imageCreationService = imageCreationStuff; + _logger = logger; - private readonly ITestService _service; - private readonly ILogger _logger; + _logger.LogDebug("Start"); - private readonly ImageCreationStuff _imageCreationService; + InitializeComponent(); - public MainForm(ITestService testService, ImageCreationStuff imageCreationStuff, ILogger logger) + BindControls(); + + _Button3.Name = "Button3"; + _Button2.Name = "Button2"; + _Button8.Name = "Button8"; + _CheckBox18.Name = "CheckBox18"; + _CheckBox4.Name = "CheckBox4"; + _CheckBox12.Name = "CheckBox12"; + _PictureBox1.Name = "PictureBox1"; + _Button4.Name = "Button4"; + _Label27.Name = "Label27"; + _Button7.Name = "Button7"; + _Button5.Name = "Button5"; + //_btnCreaCatalogo.Name = "btnCreaCatalogo"; + _Button6.Name = "Button6"; + _btnCreaCatalogoAsync.Name = "btnCreaCatalogoAsync"; + + var version = Assembly.GetExecutingAssembly().GetName().Version; + _Label27.Text = $"Version: {version.Major}.{version.Minor}.{version.Build}.{version.Revision}"; + + _results = new ConcurrentBag(); + UiUpdateEvent += OnUiUpdateEvent; + } + + protected void BindControls() + { + //txtSorgente.DataBindings.Add(new Binding("Text", SourcePath, "")); + } + + private event EventHandler> UiUpdateEvent; + + delegate void SetTextCallback(Label target, string text); + + private void SetText(Label target, string text) + { + if (InvokeRequired) { - _service = testService; - _imageCreationService = imageCreationStuff; - _logger = logger; + SetTextCallback d = new SetTextCallback(SetText); + this.Invoke(d, new object[] { target, text }); + } + else + { + target.Text = text; + } + } - _logger.LogDebug("Start"); + delegate void SetProgressCallback(ProgressBar target, int amount, int maximum); - InitializeComponent(); + private void SetProgress(ProgressBar target, int amount, int maximum) + { + if (InvokeRequired) + { + SetProgressCallback d = new SetProgressCallback(SetProgress); + this.Invoke(d, new object[] { target, amount, maximum }); + } + else + { + target.Maximum = maximum; + target.Value = amount; + } + } - BindControls(); + private void OnUiUpdateEvent(object sender, Tuple args) + { + SetProgress(ProgressBar1, _results.Count, args.Item2); + SetText(Label18, _results.Count.ToString()); + SetText(Label10, args.Item1); + SetText(lblFotoTotaliNum, args.Item2.ToString()); + } - _Button3.Name = "Button3"; - _Button2.Name = "Button2"; - _Button8.Name = "Button8"; - _CheckBox18.Name = "CheckBox18"; - _CheckBox4.Name = "CheckBox4"; - _CheckBox12.Name = "CheckBox12"; - _PictureBox1.Name = "PictureBox1"; - _Button4.Name = "Button4"; - _Label27.Name = "Label27"; - _Button7.Name = "Button7"; - _Button5.Name = "Button5"; - //_btnCreaCatalogo.Name = "btnCreaCatalogo"; - _Button6.Name = "Button6"; - _btnCreaCatalogoAsync.Name = "btnCreaCatalogoAsync"; + /* TODO ERROR: Skipped DefineDirectiveTrivia */ + private bool StopAttivo; + private bool WaterSelectColor = false; - var version = Assembly.GetExecutingAssembly().GetName().Version; - _Label27.Text = $"Version: {version.Major}.{version.Minor}.{version.Build}.{version.Revision}"; + // Private ContaFotoCuori As Integer + // Private TaskCuori() As PicInfo - _results = new ConcurrentBag(); - UiUpdateEvent += OnUiUpdateEvent; + private XYThreadPool MyPool = new XYThreadPool(); + private int ContaImmaginiThread; + private int maxThreads = 15; + private int minThreads = 5; + + private ConcurrentBag _results; + + private void setDefaults() + { + //txtSorgente.Text = ""; + Model.SourcePath = string.Empty; + Model.DestinationPath = string.Empty; + TextBox3.Text = "tn_"; + TextBox4.Text = ""; + TextBox5.Text = "350"; + TextBox6.Text = "350"; + TextBox27.Text = "2240"; + TextBox28.Text = "2240"; + TextBox9.Text = "0"; + TextBox11.Text = "20"; + TextBox12.Text = "8"; + // TextBox13.Text = "" + TextBox10.Text = ""; + TextBox14.Text = "430"; + TextBox15.Text = "430"; + TextBox16.Text = "290"; + txtFilePerCartella.Text = "99"; + TextBox19.Text = "100"; + txtSuffissoCartelle.Text = ""; + txtCifreContatore.Text = "2"; + TextBox25.Text = "50"; + TextBox26.Text = ""; + TextBox7.Text = 4.ToString(); + TextBox8.Text = 4.ToString(); + TextBox34.Text = "Yellow"; + TextBox30.Text = "20"; + TextBox31.Text = "6"; + TextBox32.Text = "85"; + TextBox33.Text = "30"; + ComboBox1.Items.Add("Alto"); + ComboBox1.Items.Add("Basso"); + ComboBox1.SelectedIndex = 1; + ComboBox2.Items.Add("Sinistra"); + ComboBox2.Items.Add("Centro"); + ComboBox2.Items.Add("Destra"); + ComboBox2.SelectedIndex = 1; + + // Create a obejct of InstalledFontCollection + var InstalledFonts = new InstalledFontCollection(); + // Gets the array of FontFamily objects associated with this FontCollection. + var fontfamilies = InstalledFonts.Families; + + // Populates font combobox with the font name + + foreach (FontFamily fontFamily in fontfamilies) + ComboBox3.Items.Add(fontFamily.Name); + ComboBox3.Text = ComboBox3.Items[0].ToString(); + + // ComboBox3.Items.Add("Arial") + // ComboBox3.Items.Add("Arial Black") + // ComboBox3.Items.Add("Arial Narrow") + // ComboBox3.Items.Add("Comic Sans MS") + // ComboBox3.Items.Add("Courier New") + // ComboBox3.Items.Add("System") + // ComboBox3.Items.Add("Times New Roman") + // ComboBox3.Items.Add("Verdana") + // ComboBox3.Items.Add("Wingdings") + // ComboBox3.SelectedIndex = 7 + + ComboBox4.Items.Add("Sinistra"); + ComboBox4.Items.Add("Centro"); + ComboBox4.Items.Add("Destra"); + ComboBox4.SelectedIndex = 2; + ComboBox5.Items.Add("Alto"); + ComboBox5.Items.Add("Centro"); + ComboBox5.Items.Add("Basso"); + ComboBox5.SelectedIndex = 2; + } + + + private void Form1_Load(object sender, EventArgs e) + { + bindingSource1.DataSource = Model; + Application.EnableVisualStyles(); + setDefaults(); + // /* TODO ERROR: Skipped IfDirectiveTrivia */ + // AllocConsole(); + // /* TODO ERROR: Skipped EndIfDirectiveTrivia */ + _logger.LogInformation("Programma Avviato"); + //Console.WriteLine("Programma avviato"); + } + + private void FixPaths() + { + Model.SourcePath = FixPath(Model.SourcePath); + Model.DestinationPath = FixPath(Model.DestinationPath); + } + + private string FixPath(string path) + { + if (string.IsNullOrWhiteSpace(path)) + { + return string.Empty; } - protected void BindControls() - { - //txtSorgente.DataBindings.Add(new Binding("Text", SourcePath, "")); - } + // Trim leading/trailing quotes + path = path.Trim().Trim('"'); - private event EventHandler> UiUpdateEvent; + // Normalize directory separators + path = path.Replace('/', Path.DirectorySeparatorChar) + .Replace('\\', Path.DirectorySeparatorChar); - delegate void SetTextCallback(Label target, string text); + // Remove trailing separators then add one back + path = path.TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar; - private void SetText(Label target, string text) - { - if (InvokeRequired) - { - SetTextCallback d = new SetTextCallback(SetText); - this.Invoke(d, new object[] { target, text }); - } - else - { - target.Text = text; - } - } + return path; + } - delegate void SetProgressCallback(ProgressBar target, int amount, int maximum); + private void lockUI() + { + Model.UiEnabled = false; + //TabControl1.Enabled = false; + //Button5.Enabled = false; + //Button6.Enabled = false; + //btnCreaCatalogoAsync.Enabled = false; + } - private void SetProgress(ProgressBar target, int amount, int maximum) - { - if (InvokeRequired) - { - SetProgressCallback d = new SetProgressCallback(SetProgress); - this.Invoke(d, new object[] { target, amount, maximum }); - } - else - { - target.Maximum = maximum; - target.Value = amount; - } - } - - private void OnUiUpdateEvent(object sender, Tuple args) - { - SetProgress(ProgressBar1, _results.Count, args.Item2); - SetText(Label18, _results.Count.ToString()); - SetText(Label10, args.Item1); - SetText(lblFotoTotaliNum, args.Item2.ToString()); - } + private void unlockUI() + { + Model.UiEnabled = true; + //TabControl1.Enabled = true; + //Button5.Enabled = true; + //Button6.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 */ - private bool StopAttivo; - private bool WaterSelectColor = false; + /* TODO ERROR: Skipped IfDirectiveTrivia */ - // Private ContaFotoCuori As Integer - // Private TaskCuori() As PicInfo - - private XYThreadPool MyPool = new XYThreadPool(); - private int ContaImmaginiThread; - private int maxThreads = 15; - private int minThreads = 5; - - private ConcurrentBag _results; - - private void setDefaults() + while (i != ContaImmaginiThread) { - //txtSorgente.Text = ""; - Model.SourcePath = string.Empty; - Model.DestinationPath = string.Empty; - TextBox3.Text = "tn_"; - TextBox4.Text = ""; - TextBox5.Text = "350"; - TextBox6.Text = "350"; - TextBox27.Text = "2240"; - TextBox28.Text = "2240"; - TextBox9.Text = "0"; - TextBox11.Text = "20"; - TextBox12.Text = "8"; - // TextBox13.Text = "" - TextBox10.Text = ""; - TextBox14.Text = "430"; - TextBox15.Text = "430"; - TextBox16.Text = "290"; - txtFilePerCartella.Text = "99"; - TextBox19.Text = "100"; - txtSuffissoCartelle.Text = ""; - txtCifreContatore.Text = "2"; - TextBox25.Text = "50"; - TextBox26.Text = ""; - TextBox7.Text = 4.ToString(); - TextBox8.Text = 4.ToString(); - TextBox34.Text = "Yellow"; - TextBox30.Text = "20"; - TextBox31.Text = "6"; - TextBox32.Text = "85"; - TextBox33.Text = "30"; - ComboBox1.Items.Add("Alto"); - ComboBox1.Items.Add("Basso"); - ComboBox1.SelectedIndex = 1; - ComboBox2.Items.Add("Sinistra"); - ComboBox2.Items.Add("Centro"); - ComboBox2.Items.Add("Destra"); - ComboBox2.SelectedIndex = 1; - - // Create a obejct of InstalledFontCollection - var InstalledFonts = new InstalledFontCollection(); - // Gets the array of FontFamily objects associated with this FontCollection. - var fontfamilies = InstalledFonts.Families; - - // Populates font combobox with the font name - - foreach (FontFamily fontFamily in fontfamilies) - ComboBox3.Items.Add(fontFamily.Name); - ComboBox3.Text = ComboBox3.Items[0].ToString(); - - // ComboBox3.Items.Add("Arial") - // ComboBox3.Items.Add("Arial Black") - // ComboBox3.Items.Add("Arial Narrow") - // ComboBox3.Items.Add("Comic Sans MS") - // ComboBox3.Items.Add("Courier New") - // ComboBox3.Items.Add("System") - // ComboBox3.Items.Add("Times New Roman") - // ComboBox3.Items.Add("Verdana") - // ComboBox3.Items.Add("Wingdings") - // ComboBox3.SelectedIndex = 7 - - ComboBox4.Items.Add("Sinistra"); - ComboBox4.Items.Add("Centro"); - ComboBox4.Items.Add("Destra"); - ComboBox4.SelectedIndex = 2; - ComboBox5.Items.Add("Alto"); - ComboBox5.Items.Add("Centro"); - ComboBox5.Items.Add("Basso"); - ComboBox5.SelectedIndex = 2; - } - - - private void Form1_Load(object sender, EventArgs e) - { - bindingSource1.DataSource = Model; - Application.EnableVisualStyles(); - setDefaults(); - // /* TODO ERROR: Skipped IfDirectiveTrivia */ - // AllocConsole(); - // /* TODO ERROR: Skipped EndIfDirectiveTrivia */ - _logger.LogInformation("Programma Avviato"); - //Console.WriteLine("Programma avviato"); - } - - private void FixPaths() - { - Model.SourcePath = FixPath(Model.SourcePath); - Model.DestinationPath = FixPath(Model.DestinationPath); - } - - private string FixPath(string path) - { - if (string.IsNullOrWhiteSpace(path)) + Thread.Sleep(100); + ThAttivo = MyPool.ExtractWorkItem(); + if (ThAttivo is object) { - return string.Empty; - } + i += 1; + // stepProgressBar() + int threads = MyPool.GetThreadCount(); + setLabel10Text("File: " + ThAttivo.m_sName + " Threads: " + threads.ToString()); - // Trim leading/trailing quotes - path = path.Trim().Trim('"'); + // setLabel18Text(ContaImmaginiThread.ToString) + // setLabel18Text(i.ToString) - // Normalize directory separators - path = path.Replace('/', Path.DirectorySeparatorChar) - .Replace('\\', Path.DirectorySeparatorChar); - // Remove trailing separators then add one back - path = path.TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar; - - return path; - } - - private void lockUI() - { - Model.UiEnabled = false; - //TabControl1.Enabled = false; - //Button5.Enabled = false; - //Button6.Enabled = false; - //btnCreaCatalogoAsync.Enabled = false; - } - - private void unlockUI() - { - Model.UiEnabled = true; - //TabControl1.Enabled = true; - //Button5.Enabled = true; - //Button6.Enabled = true; - //btnCreaCatalogoAsync.Enabled = true; - } - - // Vecchio, non usato - private void btnCreaCatalogo_Click(object sender, EventArgs e) - { - _logger.LogInformation("Avvio elaborazione..."); - lockUI(); - DateTime timeStart; - var timeStop = default(DateTime); - timeStart = DateAndTime.TimeOfDay; - FixPaths(); - Label10.Text = ""; - lblFotoTotaliNum.Text = "0"; - Label18.Text = "0"; - Label43.Text = "-s"; - maxThreads = Conversions.ToInteger(TextBox7.Text); - minThreads = Conversions.ToInteger(TextBox8.Text); - if (rdbNuovoMetodo.Checked) - { - setPicSettings(Model.SourcePath, Model.DestinationPath); - ProgressBar1.Minimum = 0; - ProgressBar1.Step = 1; - ProgressBar1.Value = 0; - var t1 = new Thread(creaCatalogoThread); - t1.IsBackground = false; - t1.Start(); - } - else if (rdbVecchioMetodo.Checked) - { - creaCatalogo(timeStart, timeStop); - unlockUI(); + // Label10.Text = "File: " & ThAttivo.m_sName + // Label18.Text = ContaImmaginiThread.ToString } } - private void creaCatalogoThread() + 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) + { + long timediffH, timediffS; + long timediffM; + + TimeSpan timeDiff = timeStop - timeStart; + + timediffM = (int)timeDiff.TotalMinutes; + timediffS = (int)timeDiff.TotalSeconds; + timediffH = (int)timeDiff.TotalHours; + + // timediffM = DateAndTime.DateDiff(DateInterval.Minute, timeStart, timeStop); + // timediffS = DateAndTime.DateDiff(DateInterval.Second, timeStart, timeStop); + // timediffH = DateAndTime.DateDiff(DateInterval.Hour, timeStart, timeStop); + + double fotoSec = numFoto / (double)timediffS; + double fotoMin = numFoto / (double)timediffM; + double fotoOra = numFoto / (double)timediffH; + string s = "S: " + timediffS.ToString() + "; F/s: " + + fotoSec.ToString( + "0.000"); // + " F/m: " + fotoMin.ToString("0.00") + " F/h: " + fotoOra.ToString("0.00") + return s; + } + + private string SelectFolder(string startingFolder) + { + var dialog = new FolderBrowserDialog(); + dialog.InitialDirectory = startingFolder; + 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; + + // if (directoryScelta.EndsWith(@"\") == false) + // { + // directoryScelta += @"\"; + // } + + return directoryScelta; + } + + private void Button2_Click(object sender, EventArgs e) + { + var dialogResult = SelectFolder(Model.SourcePath); + if (!string.IsNullOrWhiteSpace(dialogResult)) { - var timeStart = DateAndTime.TimeOfDay; - 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 = DateAndTime.TimeOfDay; - setLabel10Text("Finito"); - setLabel43Text(CalcTime(timeStart, timeStop, ContaImmaginiThread)); - /* TODO ERROR: Skipped EndIfDirectiveTrivia */ + Model.SourcePath = dialogResult; } - private void creaCatalogo(DateTime timeStart, DateTime timeStop) - { - // asdfg - MyPool.StopThreadPool(); - MyPool.StartThreadPool(minThreads, maxThreads); - ContaImmaginiThread = 0; - CreaImmaginiWithThread(Model.SourcePath, Model.DestinationPath); - ThreadPoolWorkItem ThAttivo = null; - int i = 0; - while (i != ContaImmaginiThread) - { - Thread.Sleep(100); - ThAttivo = MyPool.ExtractWorkItem(); - if (ThAttivo is object) - { - i += 1; - Label10.Text = "File: " + ThAttivo.m_sName; - Label18.Text = ContaImmaginiThread.ToString(); - } - } + //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 += @"\"; + // } - MyPool.StopThreadPool(); - timeStop = DateAndTime.TimeOfDay; - CalcTime(timeStart, timeStop, ContaImmaginiThread); - Label10.Text = "Finito"; - if (CheckBox22.Checked == true) - { - Interaction.Shell(@"%windir%\System32\shutdown.exe"); - } + // 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) + { + var dialogResult = SelectFolder(Model.DestinationPath); + if (!string.IsNullOrWhiteSpace(dialogResult)) + { + Model.DestinationPath = dialogResult; } - private string CalcTime(DateTime timeStart, DateTime timeStop, int numFoto) + //var DirSearch = new FolderBrowserDialog(); + //DirSearch.SelectedPath = txtDestinazione.Text; + //if (DialogResult.OK == DirSearch.ShowDialog()) + //{ + // string DirectoryScelta = DirSearch.SelectedPath; + // if (DirectoryScelta.EndsWith(@"\") == false) + // { + // DirectoryScelta += @"\"; + // } + + // txtDestinazione.Text = DirectoryScelta; + //} + + // Dim openFileDialog As OpenFileDialog = New OpenFileDialog + + // Dim openFileDialog As OpenFileDialog = New OpenFileDialog + + // openFileDialog.InitialDirectory = TextBox1.Text + // openFileDialog.Filter = "Bitmap files (*.bmp)|*.bmp|Jpeg files (*.jpg)|*.jpg|All valid files (*.*)|*.*" + // openFileDialog.FilterIndex = 2 + // openFileDialog.RestoreDirectory = True + + // If DialogResult.OK = openFileDialog.ShowDialog() Then + // Dim IlNome As String = openFileDialog.FileName + // Dim NomeFine As String = "" + // Dim i As Integer + + // Dim Elenco As String() + // Elenco = IlNome.Split(New Char() {"\"c}) + // For i = 0 To Elenco.Length - 1 + // NomeFine &= Elenco(i) & "\" + // Next + + // TextBox1.Text = NomeFine + // End If + } + + private void Button5_Click(object sender, EventArgs e) + { + var SaveFileDlg = new SaveFileDialog(); + + // SaveFileDlg.InitialDirectory = "c:\" + SaveFileDlg.Filter = "Setup (*.xml)|*.xml|All valid files (*.*)|*.*"; + SaveFileDlg.FilterIndex = 0; + SaveFileDlg.RestoreDirectory = true; + if (DialogResult.OK == SaveFileDlg.ShowDialog()) { - long timediffH, timediffS; - long timediffM; - timediffM = DateAndTime.DateDiff(DateInterval.Minute, timeStart, timeStop); - timediffS = DateAndTime.DateDiff(DateInterval.Second, timeStart, timeStop); - timediffH = DateAndTime.DateDiff(DateInterval.Hour, timeStart, timeStop); - // dim s As String = "H:" + timediffH.ToString + " M:" + timediffM.ToString + " S:" + timediffS.ToString - - // Label43.Text = "H:" + timediffH.ToString + " M:" + timediffM.ToString + " S:" + timediffS.ToString - double fotoSec = numFoto / (double)timediffS; - double fotoMin = numFoto / (double)timediffM; - double fotoOra = numFoto / (double)timediffH; - string s = "S: " + timediffS.ToString() + "; F/s: " + - fotoSec.ToString( - "0.000"); // + " F/m: " + fotoMin.ToString("0.00") + " F/h: " + fotoOra.ToString("0.00") - return s; - } - - private string SelectFolder(string startingFolder) - { - var dialog = new FolderBrowserDialog(); - dialog.InitialDirectory = startingFolder; - 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; - - // if (directoryScelta.EndsWith(@"\") == false) - // { - // directoryScelta += @"\"; - // } - - return directoryScelta; - } - - private void Button2_Click(object sender, EventArgs e) - { - var dialogResult = SelectFolder(Model.SourcePath); - if (!string.IsNullOrWhiteSpace(dialogResult)) + string IlNome = SaveFileDlg.FileName; + Module1.SetupIni.NomeFileSetup = IlNome; + Module1.SetupIni.AggiornaParametro("DirSorgente", Model.SourcePath); + Module1.SetupIni.AggiornaParametro("DirDestinazione", Model.DestinationPath); + Module1.SetupIni.AggiornaParametro("DirSottoDirectory", chkAggiornaSottodirectory.Checked); + Module1.SetupIni.AggiornaParametro("DirDividiDestinazione", chkCreaSottocartelle.Checked); + Module1.SetupIni.AggiornaParametro("DirDividiNumFile", txtFilePerCartella.Text); + Module1.SetupIni.AggiornaParametro("DirDividiSuffisso", txtSuffissoCartelle.Text); + Module1.SetupIni.AggiornaParametro("DirDividiNumCifre", txtCifreContatore.Text); + if (rdbNumProgressiva.Checked == true) { - 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) - { - var dialogResult = SelectFolder(Model.DestinationPath); - if (!string.IsNullOrWhiteSpace(dialogResult)) - { - Model.DestinationPath = dialogResult; - } - - //var DirSearch = new FolderBrowserDialog(); - //DirSearch.SelectedPath = txtDestinazione.Text; - //if (DialogResult.OK == DirSearch.ShowDialog()) - //{ - // string DirectoryScelta = DirSearch.SelectedPath; - // if (DirectoryScelta.EndsWith(@"\") == false) - // { - // DirectoryScelta += @"\"; - // } - - // txtDestinazione.Text = DirectoryScelta; - //} - - // Dim openFileDialog As OpenFileDialog = New OpenFileDialog - - // Dim openFileDialog As OpenFileDialog = New OpenFileDialog - - // openFileDialog.InitialDirectory = TextBox1.Text - // openFileDialog.Filter = "Bitmap files (*.bmp)|*.bmp|Jpeg files (*.jpg)|*.jpg|All valid files (*.*)|*.*" - // openFileDialog.FilterIndex = 2 - // openFileDialog.RestoreDirectory = True - - // If DialogResult.OK = openFileDialog.ShowDialog() Then - // Dim IlNome As String = openFileDialog.FileName - // Dim NomeFine As String = "" - // Dim i As Integer - - // Dim Elenco As String() - // Elenco = IlNome.Split(New Char() {"\"c}) - // For i = 0 To Elenco.Length - 1 - // NomeFine &= Elenco(i) & "\" - // Next - - // TextBox1.Text = NomeFine - // End If - } - - private void Button5_Click(object sender, EventArgs e) - { - var SaveFileDlg = new SaveFileDialog(); - - // SaveFileDlg.InitialDirectory = "c:\" - SaveFileDlg.Filter = "Setup (*.xml)|*.xml|All valid files (*.*)|*.*"; - SaveFileDlg.FilterIndex = 0; - SaveFileDlg.RestoreDirectory = true; - if (DialogResult.OK == SaveFileDlg.ShowDialog()) - { - string IlNome = SaveFileDlg.FileName; - Module1.SetupIni.NomeFileSetup = IlNome; - Module1.SetupIni.AggiornaParametro("DirSorgente", Model.SourcePath); - Module1.SetupIni.AggiornaParametro("DirDestinazione", Model.DestinationPath); - Module1.SetupIni.AggiornaParametro("DirSottoDirectory", chkAggiornaSottodirectory.Checked); - Module1.SetupIni.AggiornaParametro("DirDividiDestinazione", chkCreaSottocartelle.Checked); - Module1.SetupIni.AggiornaParametro("DirDividiNumFile", txtFilePerCartella.Text); - Module1.SetupIni.AggiornaParametro("DirDividiSuffisso", txtSuffissoCartelle.Text); - Module1.SetupIni.AggiornaParametro("DirDividiNumCifre", txtCifreContatore.Text); - if (rdbNumProgressiva.Checked == true) - { - Module1.SetupIni.AggiornaParametro("DirDividiTipoNumerazione", "Progressiva"); - } - else - { - Module1.SetupIni.AggiornaParametro("DirDividiTipoNumerazione", "Files"); - } - - Module1.SetupIni.AggiornaParametro("MiniatureCrea", CheckBox1.Checked); - Module1.SetupIni.AggiornaParametro("MiniatureSuffisso", TextBox3.Text); - Module1.SetupIni.AggiornaParametro("MiniatureAltezza", TextBox5.Text); - Module1.SetupIni.AggiornaParametro("MiniatureLarghezza", TextBox6.Text); - Module1.SetupIni.AggiornaParametro("MiniatureAddScritta", RadioButton3.Checked); - Module1.SetupIni.AggiornaParametro("MiniatureAddOrario", RadioButton4.Checked); - Module1.SetupIni.AggiornaParametro("FotoAltezza", TextBox27.Text); - Module1.SetupIni.AggiornaParametro("FotoLarghezza", TextBox28.Text); - // SetupIni.AggiornaParametro("FotoCodice", TextBox13.Text) - // SetupIni.AggiornaParametro("FotoDimOriginali", CheckBox2.Checked) - - Module1.SetupIni.AggiornaParametro("FontDimensione", TextBox11.Text); - Module1.SetupIni.AggiornaParametro("FontDimensioneMiniatura", TextBox25.Text); - Module1.SetupIni.AggiornaParametro("FontBold", CheckBox3.Checked); - Module1.SetupIni.AggiornaParametro("FontNome", ComboBox3.Text); - Module1.SetupIni.AggiornaParametro("TestoTesto", TextBox4.Text); - Module1.SetupIni.AggiornaParametro("TestoTrasparente", TextBox9.Text); - Module1.SetupIni.AggiornaParametro("TestoMargine", TextBox12.Text); - Module1.SetupIni.AggiornaParametro("TestoPosizione", ComboBox1.Text); - Module1.SetupIni.AggiornaParametro("TestoAllineamento", ComboBox2.Text); - Module1.SetupIni.AggiornaParametro("MarchioFile", TextBox10.Text); - Module1.SetupIni.AggiornaParametro("MarchioAltezza", TextBox14.Text); - Module1.SetupIni.AggiornaParametro("MarchioLarghezza", TextBox15.Text); - Module1.SetupIni.AggiornaParametro("MarchioMargine", TextBox16.Text); - Module1.SetupIni.AggiornaParametro("MarchioAllOrizzontale", ComboBox4.Text); - Module1.SetupIni.AggiornaParametro("MarchioAllVerticale", ComboBox5.Text); - Module1.SetupIni.AggiornaParametro("MarchioTrasparenza", TextBox19.Text); - Module1.SetupIni.AggiornaParametro("MarchioAggiungi", CheckBox5.Checked); - Module1.SetupIni.AggiornaParametro("TempoGara", CheckBox7.Checked); - Module1.SetupIni.AggiornaParametro("Orario", CheckBox8.Checked); - Module1.SetupIni.AggiornaParametro("EtichettaOrario", TextBox18.Text); - Module1.SetupIni.AggiornaParametro("GeneraleForzaJpg", chkForzaJpg.Checked); - Module1.SetupIni.AggiornaParametro("GeneraleRotazioneAutomatica", chkRotazioneAutomatica.Checked); - Module1.SetupIni.AggiornaParametro("GrandezzaVerticale", TextBox30.Text); - Module1.SetupIni.AggiornaParametro("MargineVerticale", TextBox31.Text); - Module1.SetupIni.AggiornaParametro("DimensioniOriginali", CheckBox15.Checked); - Module1.SetupIni.AggiornaParametro("TestoVerticale", TextBox29.Text); - Module1.SetupIni.AggiornaParametro("NomeMiniatura", RadioButton6.Checked); - Module1.SetupIni.AggiornaParametro("DataFoto", CheckBox16.Checked); - Module1.SetupIni.AggiornaParametro("NumeroFoto", CheckBox17.Checked); - Module1.SetupIni.AggiornaParametro("ColoreTestoRGB", TextBox34.Text); - Module1.SetupIni.AggiornaParametro("TempoSmall", RadioButton5.Checked); - Module1.SetupIni.AggiornaParametro("NumTempoSmall", RadioButton7.Checked); - Module1.SetupIni.AggiornaParametro("CompressioneJpeg", TextBox32.Text); - Module1.SetupIni.AggiornaParametro("CompressioneJpegMiniatura", TextBox33.Text); - // 2021 - Module1.SetupIni.AggiornaParametro("ChunkSize", TextBox8.Text); - Module1.SetupIni.AggiornaParametro("ThreadsCount", TextBox7.Text); - Module1.SetupIni.SalvaParametriSetup(); - Text = "Image Catalog - " + LeggiSoloNomeFile(IlNome); - } - } - - private void Button6_Click(object sender, EventArgs e) - { - var openFileDialog = new OpenFileDialog(); - - // openFileDialog.InitialDirectory = TextBox1.Text - openFileDialog.Filter = "Setup (*.xml)|*.xml|All valid files (*.*)|*.*"; - openFileDialog.FilterIndex = 0; - openFileDialog.RestoreDirectory = true; - if (DialogResult.OK == openFileDialog.ShowDialog()) - { - string IlNome = openFileDialog.FileName; - Module1.SetupIni.NomeFileSetup = IlNome; - Module1.SetupIni.CaricaParametriSetup(); - Model.SourcePath = Module1.SetupIni.LeggiParametroString("DirSorgente"); - Model.DestinationPath = Module1.SetupIni.LeggiParametroString("DirDestinazione"); - chkAggiornaSottodirectory.Checked = Module1.SetupIni.LeggiParametroBoolean("DirSottoDirectory"); - chkCreaSottocartelle.Checked = Module1.SetupIni.LeggiParametroBoolean("DirDividiDestinazione"); - txtFilePerCartella.Text = Module1.SetupIni.LeggiParametroString("DirDividiNumFile"); - txtSuffissoCartelle.Text = Module1.SetupIni.LeggiParametroString("DirDividiSuffisso"); - txtCifreContatore.Text = Module1.SetupIni.LeggiParametroString("DirDividiNumCifre"); - string TestoTemp = Module1.SetupIni.LeggiParametroString("DirDividiTipoNumerazione"); - if (TestoTemp.ToUpper() == "PROGRESSIVA") - { - rdbNumProgressiva.Checked = true; - } - else - { - rdbNumFiles.Checked = true; - } - - CheckBox1.Checked = Module1.SetupIni.LeggiParametroBoolean("MiniatureCrea"); - TextBox3.Text = Module1.SetupIni.LeggiParametroString("MiniatureSuffisso"); - TextBox5.Text = Module1.SetupIni.LeggiParametroString("MiniatureAltezza"); - TextBox6.Text = Module1.SetupIni.LeggiParametroString("MiniatureLarghezza"); - RadioButton3.Checked = Module1.SetupIni.LeggiParametroBoolean("MiniatureAddScritta"); - RadioButton4.Checked = Module1.SetupIni.LeggiParametroBoolean("MiniatureAddOrario"); - TextBox27.Text = Module1.SetupIni.LeggiParametroString("FotoAltezza"); - TextBox28.Text = Module1.SetupIni.LeggiParametroString("FotoLarghezza"); - // TextBox13.Text = SetupIni.LeggiParametroString("FotoCodice") - // CheckBox2.Checked = SetupIni.LeggiParametroBoolean("FotoDimOriginali") - - TextBox11.Text = Module1.SetupIni.LeggiParametroString("FontDimensione"); - TextBox25.Text = Module1.SetupIni.LeggiParametroString("FontDimensioneMiniatura"); - CheckBox3.Checked = Module1.SetupIni.LeggiParametroBoolean("FontBold"); - ComboBox3.Text = Module1.SetupIni.LeggiParametroString("FontNome"); - if (string.IsNullOrEmpty(TextBox25.Text)) - { - TextBox25.Text = "0"; - } - - TextBox4.Text = Module1.SetupIni.LeggiParametroString("TestoTesto"); - TextBox9.Text = Module1.SetupIni.LeggiParametroString("TestoTrasparente"); - TextBox12.Text = Module1.SetupIni.LeggiParametroString("TestoMargine"); - ComboBox1.Text = Module1.SetupIni.LeggiParametroString("TestoPosizione"); - ComboBox2.Text = Module1.SetupIni.LeggiParametroString("TestoAllineamento"); - TextBox10.Text = Module1.SetupIni.LeggiParametroString("MarchioFile"); - TextBox14.Text = Module1.SetupIni.LeggiParametroString("MarchioAltezza"); - TextBox15.Text = Module1.SetupIni.LeggiParametroString("MarchioLarghezza"); - TextBox16.Text = Module1.SetupIni.LeggiParametroString("MarchioMargine"); - ComboBox4.Text = Module1.SetupIni.LeggiParametroString("MarchioAllOrizzontale"); - ComboBox5.Text = Module1.SetupIni.LeggiParametroString("MarchioAllVerticale"); - TextBox19.Text = Module1.SetupIni.LeggiParametroString("MarchioTrasparenza"); - CheckBox5.Checked = Module1.SetupIni.LeggiParametroBoolean("MarchioAggiungi"); - CheckBox7.Checked = Module1.SetupIni.LeggiParametroBoolean("TempoGara"); - CheckBox8.Checked = Module1.SetupIni.LeggiParametroBoolean("Orario"); - TextBox18.Text = Module1.SetupIni.LeggiParametroString("EtichettaOrario"); - chkForzaJpg.Checked = Module1.SetupIni.LeggiParametroBoolean("GeneraleForzaJpg"); - chkRotazioneAutomatica.Checked = Module1.SetupIni.LeggiParametroBoolean("GeneraleRotazioneAutomatica"); - TextBox30.Text = Module1.SetupIni.LeggiParametroString("GrandezzaVerticale"); - TextBox31.Text = Module1.SetupIni.LeggiParametroString("MargineVerticale"); - CheckBox15.Checked = Module1.SetupIni.LeggiParametroBoolean("DimensioniOriginali"); - TextBox29.Text = Module1.SetupIni.LeggiParametroString("TestoVerticale"); - RadioButton6.Checked = Module1.SetupIni.LeggiParametroBoolean("NomeMiniatura"); - CheckBox16.Checked = Module1.SetupIni.LeggiParametroBoolean("DataFoto"); - CheckBox17.Checked = Module1.SetupIni.LeggiParametroBoolean("NumeroFoto"); - RadioButton5.Checked = Module1.SetupIni.LeggiParametroBoolean("TempoSmall"); - RadioButton7.Checked = Module1.SetupIni.LeggiParametroBoolean("NumTempoSmall"); - TextBox32.Text = Module1.SetupIni.LeggiParametroString("CompressioneJpeg"); - TextBox33.Text = Module1.SetupIni.LeggiParametroString("CompressioneJpegMiniatura"); - TextBox34.Text = Module1.SetupIni.LeggiParametroString("ColoreTestoRGB"); - if (File.Exists(TextBox10.Text)) - { - PictureBox1.Image = Image.FromFile(TextBox10.Text); - if (PictureBox1.Image.Height >= PictureBox1.Image.Width) - { - PictureBox1.Height = 160; - PictureBox1.Width = - Conversions.ToInteger(160 * PictureBox1.Image.Width / (double)PictureBox1.Image.Height); - } - else - { - PictureBox1.Width = 224; - PictureBox1.Height = - Conversions.ToInteger(224 * PictureBox1.Image.Height / (double)PictureBox1.Image.Width); - } - } - - Text = "Image Catalog - " + LeggiSoloNomeFile(IlNome); - - // 2021 - TextBox8.Text = Module1.SetupIni.LeggiParametroString("ChunkSize"); - TextBox7.Text = Module1.SetupIni.LeggiParametroString("ThreadsCount"); - } - } - - private void setPicSettings(string SourcePath, string DestPath) - { - var SourceDir = new DirectoryInfo(SourcePath); - var DestDirStart = new DirectoryInfo(DestPath); - DirectoryInfo DestDir = null; - PicSettings.DirectorySorgente = SourcePath; - PicSettings.DirectoryDestinazione = Model.DestinationPath; - - // PicSettings.DestDir = DestDir - // PicSettings.SourceDir = SourceDir - // PicSettings.DestDirStart = DestDirStart - - PicSettings.DimStandard = Conversions.ToInteger(TextBox11.Text); - PicSettings.DimStandardMiniatura = Conversions.ToInteger(TextBox25.Text); - PicSettings.UsaOrarioMiniatura = CheckBox12.Checked; - PicSettings.UsaOrarioTestoApplicare = CheckBox8.Checked; - PicSettings.UsaTempoGaraTestoApplicare = CheckBox7.Checked; - PicSettings.UsaRotazioneAutomatica = chkRotazioneAutomatica.Checked; - PicSettings.UsaForzaJpg = chkForzaJpg.Checked; - if (CheckBox17.Checked) - { - PicSettings.TestoNome = true; + Module1.SetupIni.AggiornaParametro("DirDividiTipoNumerazione", "Progressiva"); } else { - PicSettings.TestoNome = false; + Module1.SetupIni.AggiornaParametro("DirDividiTipoNumerazione", "Files"); } - if (CheckBox16.Checked) + Module1.SetupIni.AggiornaParametro("MiniatureCrea", CheckBox1.Checked); + Module1.SetupIni.AggiornaParametro("MiniatureSuffisso", TextBox3.Text); + Module1.SetupIni.AggiornaParametro("MiniatureAltezza", TextBox5.Text); + Module1.SetupIni.AggiornaParametro("MiniatureLarghezza", TextBox6.Text); + Module1.SetupIni.AggiornaParametro("MiniatureAddScritta", RadioButton3.Checked); + Module1.SetupIni.AggiornaParametro("MiniatureAddOrario", RadioButton4.Checked); + Module1.SetupIni.AggiornaParametro("FotoAltezza", TextBox27.Text); + Module1.SetupIni.AggiornaParametro("FotoLarghezza", TextBox28.Text); + // SetupIni.AggiornaParametro("FotoCodice", TextBox13.Text) + // SetupIni.AggiornaParametro("FotoDimOriginali", CheckBox2.Checked) + + Module1.SetupIni.AggiornaParametro("FontDimensione", TextBox11.Text); + Module1.SetupIni.AggiornaParametro("FontDimensioneMiniatura", TextBox25.Text); + Module1.SetupIni.AggiornaParametro("FontBold", CheckBox3.Checked); + Module1.SetupIni.AggiornaParametro("FontNome", ComboBox3.Text); + Module1.SetupIni.AggiornaParametro("TestoTesto", TextBox4.Text); + Module1.SetupIni.AggiornaParametro("TestoTrasparente", TextBox9.Text); + Module1.SetupIni.AggiornaParametro("TestoMargine", TextBox12.Text); + Module1.SetupIni.AggiornaParametro("TestoPosizione", ComboBox1.Text); + Module1.SetupIni.AggiornaParametro("TestoAllineamento", ComboBox2.Text); + Module1.SetupIni.AggiornaParametro("MarchioFile", TextBox10.Text); + Module1.SetupIni.AggiornaParametro("MarchioAltezza", TextBox14.Text); + Module1.SetupIni.AggiornaParametro("MarchioLarghezza", TextBox15.Text); + Module1.SetupIni.AggiornaParametro("MarchioMargine", TextBox16.Text); + Module1.SetupIni.AggiornaParametro("MarchioAllOrizzontale", ComboBox4.Text); + Module1.SetupIni.AggiornaParametro("MarchioAllVerticale", ComboBox5.Text); + Module1.SetupIni.AggiornaParametro("MarchioTrasparenza", TextBox19.Text); + Module1.SetupIni.AggiornaParametro("MarchioAggiungi", CheckBox5.Checked); + Module1.SetupIni.AggiornaParametro("TempoGara", CheckBox7.Checked); + Module1.SetupIni.AggiornaParametro("Orario", CheckBox8.Checked); + Module1.SetupIni.AggiornaParametro("EtichettaOrario", TextBox18.Text); + Module1.SetupIni.AggiornaParametro("GeneraleForzaJpg", chkForzaJpg.Checked); + Module1.SetupIni.AggiornaParametro("GeneraleRotazioneAutomatica", chkRotazioneAutomatica.Checked); + Module1.SetupIni.AggiornaParametro("GrandezzaVerticale", TextBox30.Text); + Module1.SetupIni.AggiornaParametro("MargineVerticale", TextBox31.Text); + Module1.SetupIni.AggiornaParametro("DimensioniOriginali", CheckBox15.Checked); + Module1.SetupIni.AggiornaParametro("TestoVerticale", TextBox29.Text); + Module1.SetupIni.AggiornaParametro("NomeMiniatura", RadioButton6.Checked); + Module1.SetupIni.AggiornaParametro("DataFoto", CheckBox16.Checked); + Module1.SetupIni.AggiornaParametro("NumeroFoto", CheckBox17.Checked); + Module1.SetupIni.AggiornaParametro("ColoreTestoRGB", TextBox34.Text); + Module1.SetupIni.AggiornaParametro("TempoSmall", RadioButton5.Checked); + Module1.SetupIni.AggiornaParametro("NumTempoSmall", RadioButton7.Checked); + Module1.SetupIni.AggiornaParametro("CompressioneJpeg", TextBox32.Text); + Module1.SetupIni.AggiornaParametro("CompressioneJpegMiniatura", TextBox33.Text); + // 2021 + Module1.SetupIni.AggiornaParametro("ChunkSize", TextBox8.Text); + Module1.SetupIni.AggiornaParametro("ThreadsCount", TextBox7.Text); + Module1.SetupIni.SalvaParametriSetup(); + Text = "Image Catalog - " + LeggiSoloNomeFile(IlNome); + } + } + + private void Button6_Click(object sender, EventArgs e) + { + var openFileDialog = new OpenFileDialog(); + + // openFileDialog.InitialDirectory = TextBox1.Text + openFileDialog.Filter = "Setup (*.xml)|*.xml|All valid files (*.*)|*.*"; + openFileDialog.FilterIndex = 0; + openFileDialog.RestoreDirectory = true; + if (DialogResult.OK == openFileDialog.ShowDialog()) + { + string IlNome = openFileDialog.FileName; + Module1.SetupIni.NomeFileSetup = IlNome; + Module1.SetupIni.CaricaParametriSetup(); + Model.SourcePath = Module1.SetupIni.LeggiParametroString("DirSorgente"); + Model.DestinationPath = Module1.SetupIni.LeggiParametroString("DirDestinazione"); + chkAggiornaSottodirectory.Checked = Module1.SetupIni.LeggiParametroBoolean("DirSottoDirectory"); + chkCreaSottocartelle.Checked = Module1.SetupIni.LeggiParametroBoolean("DirDividiDestinazione"); + txtFilePerCartella.Text = Module1.SetupIni.LeggiParametroString("DirDividiNumFile"); + txtSuffissoCartelle.Text = Module1.SetupIni.LeggiParametroString("DirDividiSuffisso"); + txtCifreContatore.Text = Module1.SetupIni.LeggiParametroString("DirDividiNumCifre"); + string TestoTemp = Module1.SetupIni.LeggiParametroString("DirDividiTipoNumerazione"); + if (TestoTemp.ToUpper() == "PROGRESSIVA") { - PicSettings.NomeData = true; + rdbNumProgressiva.Checked = true; } else { - PicSettings.NomeData = false; + rdbNumFiles.Checked = true; } - PicSettings.TestoFirmaStart = TextBox4.Text; - PicSettings.TestoFirmaStartV = TextBox29.Text; - PicSettings.DataPartenza = DateTimePicker1.Value; - PicSettings.TestoOrario = TextBox18.Text; - PicSettings.AltezzaSmall = Conversions.ToInteger(TextBox6.Text); - PicSettings.LarghezzaSmall = Conversions.ToInteger(TextBox5.Text); - PicSettings.CreaMiniature = CheckBox1.Checked; - PicSettings.AggiungiScritteMiniature = RadioButton3.Checked; - PicSettings.AggTempoGaraMin = RadioButton5.Checked; - PicSettings.AggNumTempMin = RadioButton7.Checked; - PicSettings.DimVert = Conversions.ToInteger(TextBox30.Text); - PicSettings.MargVert = Conversions.ToInteger(TextBox31.Text); + CheckBox1.Checked = Module1.SetupIni.LeggiParametroBoolean("MiniatureCrea"); + TextBox3.Text = Module1.SetupIni.LeggiParametroString("MiniatureSuffisso"); + TextBox5.Text = Module1.SetupIni.LeggiParametroString("MiniatureAltezza"); + TextBox6.Text = Module1.SetupIni.LeggiParametroString("MiniatureLarghezza"); + RadioButton3.Checked = Module1.SetupIni.LeggiParametroBoolean("MiniatureAddScritta"); + RadioButton4.Checked = Module1.SetupIni.LeggiParametroBoolean("MiniatureAddOrario"); + TextBox27.Text = Module1.SetupIni.LeggiParametroString("FotoAltezza"); + TextBox28.Text = Module1.SetupIni.LeggiParametroString("FotoLarghezza"); + // TextBox13.Text = SetupIni.LeggiParametroString("FotoCodice") + // CheckBox2.Checked = SetupIni.LeggiParametroBoolean("FotoDimOriginali") - // PicSettings.NomeFileChild = childFile.Name - PicSettings.Suffisso = TextBox3.Text; - // PicSettings.Codice = TextBox13.Text - - PicSettings.Trasparenza = Conversions.ToInteger(TextBox9.Text); - PicSettings.IlFont = ComboBox3.SelectedItem.ToString(); - PicSettings.Grassetto = CheckBox3.Checked; - PicSettings.Posizione = ComboBox1.SelectedItem.ToString(); - PicSettings.Allineamento = ComboBox2.SelectedItem.ToString(); - PicSettings.Margine = Conversions.ToInteger(TextBox12.Text); - PicSettings.LogoAltezza = Conversions.ToInteger(TextBox14.Text); - PicSettings.LogoLarghezza = Conversions.ToInteger(TextBox15.Text); - PicSettings.fontColoreRGB = ColorTranslator.FromHtml(TextBox34.Text); - PicSettings.LogoAggiungi = CheckBox5.Checked; - PicSettings.LogoNomeFile = TextBox10.Text; - PicSettings.LogoTrasparenza = TextBox19.Text; - PicSettings.LogoMargine = TextBox16.Text; - PicSettings.LogoPosizioneH = ComboBox4.Text; - PicSettings.LogoPosizioneV = ComboBox5.Text; - PicSettings.FotoGrandeDimOrigina = CheckBox15.Checked; - PicSettings.AltezzaBig = Conversions.ToInteger(TextBox27.Text); - PicSettings.LarghezzaBig = Conversions.ToInteger(TextBox28.Text); - PicSettings.DimMin = Conversions.ToInteger(TextBox25.Text); - PicSettings.TestoMin = RadioButton6.Checked; - PicSettings.jpegQuality = Conversions.ToLong(TextBox32.Text); - PicSettings.jpegQualityMin = Conversions.ToLong(TextBox33.Text); - PicSettings.mainForm = this; - } - - private List> makeFilesList(string SourcePath) - { - var SourceDir = new DirectoryInfo(SourcePath); - DirectoryInfo DestDir = null; - int NumFileXDir = Conversions.ToInteger(txtFilePerCartella.Text); - string SuffixDir = txtSuffissoCartelle.Text; - int NumCifreDir = Conversions.ToInteger(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(); - var dirList = new List>(); - - - // 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) + TextBox11.Text = Module1.SetupIni.LeggiParametroString("FontDimensione"); + TextBox25.Text = Module1.SetupIni.LeggiParametroString("FontDimensioneMiniatura"); + CheckBox3.Checked = Module1.SetupIni.LeggiParametroBoolean("FontBold"); + ComboBox3.Text = Module1.SetupIni.LeggiParametroString("FontNome"); + if (string.IsNullOrEmpty(TextBox25.Text)) { - foreach (var subDir in SourceDir.GetDirectories()) - { - var filesList = new List(); - filesList = getFiles(subDir); - dirList.Add(filesList); - } + TextBox25.Text = "0"; } - return dirList; - } - - private List getFiles(DirectoryInfo sourceDir) - { - var picList = new List(); - foreach (var childFile in sourceDir.GetFiles("*.jpg")) - picList.Add(childFile); - return picList; - } - - private Dictionary getDirsDict(string SourcePath, string DestPath) - { - var SourceDir = new DirectoryInfo(SourcePath); - var DestDirStart = new DirectoryInfo(DestPath); - DirectoryInfo DestDir = null; - int NumFileXDir = Conversions.ToInteger(txtFilePerCartella.Text); - string SuffixDir = txtSuffissoCartelle.Text; - int NumCifreDir = Conversions.ToInteger(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(); - if (SourceDir.Exists) + TextBox4.Text = Module1.SetupIni.LeggiParametroString("TestoTesto"); + TextBox9.Text = Module1.SetupIni.LeggiParametroString("TestoTrasparente"); + TextBox12.Text = Module1.SetupIni.LeggiParametroString("TestoMargine"); + ComboBox1.Text = Module1.SetupIni.LeggiParametroString("TestoPosizione"); + ComboBox2.Text = Module1.SetupIni.LeggiParametroString("TestoAllineamento"); + TextBox10.Text = Module1.SetupIni.LeggiParametroString("MarchioFile"); + TextBox14.Text = Module1.SetupIni.LeggiParametroString("MarchioAltezza"); + TextBox15.Text = Module1.SetupIni.LeggiParametroString("MarchioLarghezza"); + TextBox16.Text = Module1.SetupIni.LeggiParametroString("MarchioMargine"); + ComboBox4.Text = Module1.SetupIni.LeggiParametroString("MarchioAllOrizzontale"); + ComboBox5.Text = Module1.SetupIni.LeggiParametroString("MarchioAllVerticale"); + TextBox19.Text = Module1.SetupIni.LeggiParametroString("MarchioTrasparenza"); + CheckBox5.Checked = Module1.SetupIni.LeggiParametroBoolean("MarchioAggiungi"); + CheckBox7.Checked = Module1.SetupIni.LeggiParametroBoolean("TempoGara"); + CheckBox8.Checked = Module1.SetupIni.LeggiParametroBoolean("Orario"); + TextBox18.Text = Module1.SetupIni.LeggiParametroString("EtichettaOrario"); + chkForzaJpg.Checked = Module1.SetupIni.LeggiParametroBoolean("GeneraleForzaJpg"); + chkRotazioneAutomatica.Checked = Module1.SetupIni.LeggiParametroBoolean("GeneraleRotazioneAutomatica"); + TextBox30.Text = Module1.SetupIni.LeggiParametroString("GrandezzaVerticale"); + TextBox31.Text = Module1.SetupIni.LeggiParametroString("MargineVerticale"); + CheckBox15.Checked = Module1.SetupIni.LeggiParametroBoolean("DimensioniOriginali"); + TextBox29.Text = Module1.SetupIni.LeggiParametroString("TestoVerticale"); + RadioButton6.Checked = Module1.SetupIni.LeggiParametroBoolean("NomeMiniatura"); + CheckBox16.Checked = Module1.SetupIni.LeggiParametroBoolean("DataFoto"); + CheckBox17.Checked = Module1.SetupIni.LeggiParametroBoolean("NumeroFoto"); + RadioButton5.Checked = Module1.SetupIni.LeggiParametroBoolean("TempoSmall"); + RadioButton7.Checked = Module1.SetupIni.LeggiParametroBoolean("NumTempoSmall"); + TextBox32.Text = Module1.SetupIni.LeggiParametroString("CompressioneJpeg"); + TextBox33.Text = Module1.SetupIni.LeggiParametroString("CompressioneJpegMiniatura"); + TextBox34.Text = Module1.SetupIni.LeggiParametroString("ColoreTestoRGB"); + if (File.Exists(TextBox10.Text)) { - if (chkAggiornaSottodirectory.Checked) + PictureBox1.Image = Image.FromFile(TextBox10.Text); + if (PictureBox1.Image.Height >= PictureBox1.Image.Width) { - FileConta = SourceDir.GetFiles("*.jpg", SearchOption.AllDirectories).GetLength(0); + PictureBox1.Height = 160; + PictureBox1.Width = + (int)(160 * PictureBox1.Image.Width / (double)PictureBox1.Image.Height); } else { - FileConta = SourceDir.GetFiles("*.jpg", SearchOption.TopDirectoryOnly).GetLength(0); + PictureBox1.Width = 224; + PictureBox1.Height = + (int)(224 * PictureBox1.Image.Height / (double)PictureBox1.Image.Width); + } + } + + Text = "Image Catalog - " + LeggiSoloNomeFile(IlNome); + + // 2021 + TextBox8.Text = Module1.SetupIni.LeggiParametroString("ChunkSize"); + TextBox7.Text = Module1.SetupIni.LeggiParametroString("ThreadsCount"); + } + } + + private void setPicSettings(string SourcePath, string DestPath) + { + var SourceDir = new DirectoryInfo(SourcePath); + var DestDirStart = new DirectoryInfo(DestPath); + DirectoryInfo DestDir = null; + PicSettings.DirectorySorgente = SourcePath; + PicSettings.DirectoryDestinazione = Model.DestinationPath; + + // PicSettings.DestDir = DestDir + // PicSettings.SourceDir = SourceDir + // PicSettings.DestDirStart = DestDirStart + + PicSettings.DimStandard = int.Parse(TextBox11.Text); + PicSettings.DimStandardMiniatura = int.Parse(TextBox25.Text); + PicSettings.UsaOrarioMiniatura = CheckBox12.Checked; + PicSettings.UsaOrarioTestoApplicare = CheckBox8.Checked; + PicSettings.UsaTempoGaraTestoApplicare = CheckBox7.Checked; + PicSettings.UsaRotazioneAutomatica = chkRotazioneAutomatica.Checked; + PicSettings.UsaForzaJpg = chkForzaJpg.Checked; + if (CheckBox17.Checked) + { + PicSettings.TestoNome = true; + } + else + { + PicSettings.TestoNome = false; + } + + if (CheckBox16.Checked) + { + PicSettings.NomeData = true; + } + else + { + PicSettings.NomeData = false; + } + + PicSettings.TestoFirmaStart = TextBox4.Text; + PicSettings.TestoFirmaStartV = TextBox29.Text; + PicSettings.DataPartenza = DateTimePicker1.Value; + PicSettings.TestoOrario = TextBox18.Text; + PicSettings.AltezzaSmall = int.Parse(TextBox6.Text); + PicSettings.LarghezzaSmall = int.Parse(TextBox5.Text); + PicSettings.CreaMiniature = CheckBox1.Checked; + PicSettings.AggiungiScritteMiniature = RadioButton3.Checked; + PicSettings.AggTempoGaraMin = RadioButton5.Checked; + PicSettings.AggNumTempMin = RadioButton7.Checked; + PicSettings.DimVert = int.Parse(TextBox30.Text); + PicSettings.MargVert = int.Parse(TextBox31.Text); + + // PicSettings.NomeFileChild = childFile.Name + PicSettings.Suffisso = TextBox3.Text; + // PicSettings.Codice = TextBox13.Text + + PicSettings.Trasparenza = int.Parse(TextBox9.Text); + PicSettings.IlFont = ComboBox3.SelectedItem.ToString(); + PicSettings.Grassetto = CheckBox3.Checked; + PicSettings.Posizione = ComboBox1.SelectedItem.ToString(); + PicSettings.Allineamento = ComboBox2.SelectedItem.ToString(); + PicSettings.Margine = int.Parse(TextBox12.Text); + PicSettings.LogoAltezza = int.Parse(TextBox14.Text); + PicSettings.LogoLarghezza = int.Parse(TextBox15.Text); + PicSettings.fontColoreRGB = ColorTranslator.FromHtml(TextBox34.Text); + PicSettings.LogoAggiungi = CheckBox5.Checked; + PicSettings.LogoNomeFile = TextBox10.Text; + PicSettings.LogoTrasparenza = TextBox19.Text; + PicSettings.LogoMargine = TextBox16.Text; + PicSettings.LogoPosizioneH = ComboBox4.Text; + PicSettings.LogoPosizioneV = ComboBox5.Text; + PicSettings.FotoGrandeDimOrigina = CheckBox15.Checked; + PicSettings.AltezzaBig = int.Parse(TextBox27.Text); + PicSettings.LarghezzaBig = int.Parse(TextBox28.Text); + PicSettings.DimMin = int.Parse(TextBox25.Text); + PicSettings.TestoMin = RadioButton6.Checked; + PicSettings.jpegQuality = int.Parse(TextBox32.Text); + PicSettings.jpegQualityMin = int.Parse(TextBox33.Text); + PicSettings.mainForm = this; + } + + private List> 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(); + var dirList = new List>(); + + + // 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(); + filesList = getFiles(subDir); + dirList.Add(filesList); + } + } + + return dirList; + } + + private List getFiles(DirectoryInfo sourceDir) + { + var picList = new List(); + foreach (var childFile in sourceDir.GetFiles("*.jpg")) + picList.Add(childFile); + return picList; + } + + private Dictionary 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(); + 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(); } - string a = (Conversions.ToInteger(lblFotoTotaliNum.Text) + FileConta).ToString(); - setLabel17Text(a); - setProgressBarMaximum(Conversions.ToInteger(a)); - if (chkAggiornaSottodirectory.Checked) + DividiFile = false; + } + + var filesList = new List(); + 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) { - foreach (DirectoryInfo directory in SourceDir.GetDirectories()) + if (ContaFileXDir == ContaDirXDir * NumFileXDir + 1) { - foreach (FileInfo file in directory.GetFiles(".jpg")) + 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(); } } } + } + } - foreach (FileInfo file in SourceDir.GetFiles("*.jpg", SearchOption.AllDirectories)) - { - } + return dirSourceDest; + } - if (NumFileXDir > 0 & chkCreaSottocartelle.Checked == true & FileConta > NumFileXDir) + private void setLabel17Text(string text) + { + if (lblFotoTotaliNum.InvokeRequired) + { + lblFotoTotaliNum.Invoke(new Action(setLabel17Text), text); + } + else + { + lblFotoTotaliNum.Text = text; + } + } + + private void setLabel10Text(string text) + { + if (Label10.InvokeRequired) + { + Label10.Invoke(new Action(setLabel10Text), text); + } + else + { + Label10.Text = text; + } + } + + public void stepProgressBar() + { + if (ProgressBar1.InvokeRequired) + { + ProgressBar1.Invoke(new System.Windows.Forms.MethodInvoker(ProgressBar1.PerformStep)); + } + else + { + ProgressBar1.PerformStep(); + } + + setLabel18Text(ProgressBar1.Value.ToString()); + } + + private void setProgressBarMaximum(int value) + { + if (ProgressBar1.InvokeRequired) + { + ProgressBar1.Invoke(new Action(setProgressBarMaximum), (object)value); + } + else + { + ProgressBar1.Maximum = value; + } + } + + private void setProgressBarValue(int value) + { + if (ProgressBar1.InvokeRequired) + { + ProgressBar1.Invoke(new Action(setProgressBarValue), (object)value); + } + else + { + ProgressBar1.Value = value; + } + } + + private void setLabel18Text(string text) + { + if (Label18.InvokeRequired) + { + Label18.Invoke(new Action(setLabel18Text), text); + } + else + { + Label18.Text = text; + } + } + + private void setLabel43Text(string text) + { + if (Label43.InvokeRequired) + { + Label43.Invoke(new Action(setLabel43Text), text); + } + else + { + Label43.Text = text; + } + } + + 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; } @@ -856,922 +968,747 @@ namespace ImageCatalog DividiFile = false; } - - var filesList = new List(); - 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) - { - if (lblFotoTotaliNum.InvokeRequired) - { - lblFotoTotaliNum.Invoke(new Action(setLabel17Text), text); } else { - lblFotoTotaliNum.Text = text; - } - } - - private void setLabel10Text(string text) - { - if (Label10.InvokeRequired) - { - Label10.Invoke(new Action(setLabel10Text), text); - } - else - { - Label10.Text = text; - } - } - - public void stepProgressBar() - { - if (ProgressBar1.InvokeRequired) - { - ProgressBar1.Invoke(new System.Windows.Forms.MethodInvoker(ProgressBar1.PerformStep)); - } - else - { - ProgressBar1.PerformStep(); - } - - setLabel18Text(ProgressBar1.Value.ToString()); - } - - private void setProgressBarMaximum(int value) - { - if (ProgressBar1.InvokeRequired) - { - ProgressBar1.Invoke(new Action(setProgressBarMaximum), (object)value); - } - else - { - ProgressBar1.Maximum = value; - } - } - - private void setProgressBarValue(int value) - { - if (ProgressBar1.InvokeRequired) - { - ProgressBar1.Invoke(new Action(setProgressBarValue), (object)value); - } - else - { - ProgressBar1.Value = value; - } - } - - private void setLabel18Text(string text) - { - if (Label18.InvokeRequired) - { - Label18.Invoke(new Action(setLabel18Text), text); - } - else - { - Label18.Text = text; - } - } - - private void setLabel43Text(string text) - { - if (Label43.InvokeRequired) - { - Label43.Invoke(new Action(setLabel43Text), text); - } - else - { - Label43.Text = text; - } - } - - private void creaImmaginiWithThreadMod(string SourcePath, string DestPath) - { - var SourceDir = new DirectoryInfo(SourcePath); - var DestDirStart = new DirectoryInfo(DestPath); - DirectoryInfo DestDir = null; - int NumFileXDir = Conversions.ToInteger(txtFilePerCartella.Text); - string SuffixDir = txtSuffissoCartelle.Text; - int NumCifreDir = Conversions.ToInteger(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 - string a = (Conversions.ToInteger(lblFotoTotaliNum.Text) + FileConta).ToString(); - setLabel17Text(a); - setProgressBarMaximum(Conversions.ToInteger(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 = (Conversions.ToInteger(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() - { - int numerazione; - if (rdbNumProgressiva.Checked) - { - numerazione = (int)FileHelper.numerazione.Progressiva; - } - else - { - numerazione = (int)FileHelper.numerazione.Files; - } - - return numerazione; - } - - private NumerazioneType GetNumerazioneEnum() - { - NumerazioneType numerazioneType; - if (rdbNumProgressiva.Checked) - { - numerazioneType = NumerazioneType.Progressiva; // FileHelper.numerazione.Progressiva - } - else - { - numerazioneType = NumerazioneType.Files; - } // FileHelper.numerazione.Files - - return numerazioneType; - } - - private void CreaimmaginiWithThreadDict(string SourcePath, string DestPath) - { - var dirSourceDest = new Dictionary(); - if (chkAggiornaSottodirectory.Checked & chkCreaSottocartelle.Checked) - { - var helper = new FileHelper(Conversions.ToInteger(txtFilePerCartella.Text), txtSuffissoCartelle.Text, - Conversions.ToInteger(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 = (Conversions.ToInteger(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 = Conversions.ToInteger(txtFilePerCartella.Text); - string SuffixDir = txtSuffissoCartelle.Text; - int NumCifreDir = Conversions.ToInteger(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 = (Conversions.ToInteger(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 = Conversions.ToInteger(TextBox11.Text); - ClsCreaImmagine.DimStandardMiniatura = Conversions.ToInteger(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 = TextBox4.Text; - ClsCreaImmagine.TestoFirmaStartV = TextBox29.Text; - ClsCreaImmagine.DataPartenza = DateTimePicker1.Value; - ClsCreaImmagine.TestoOrario = TextBox18.Text; - ClsCreaImmagine.AltezzaSmall = Conversions.ToInteger(TextBox5.Text); - ClsCreaImmagine.LarghezzaSmall = Conversions.ToInteger(TextBox5.Text); - ClsCreaImmagine.CreaMiniature = CheckBox1.Checked; - ClsCreaImmagine.AggiungiScritteMiniature = RadioButton3.Checked; - ClsCreaImmagine.AggTempoGaraMin = RadioButton5.Checked; - ClsCreaImmagine.AggNumTempMin = RadioButton7.Checked; - ClsCreaImmagine.DimVert = Conversions.ToInteger(TextBox30.Text); - ClsCreaImmagine.MargVert = Conversions.ToInteger(TextBox31.Text); - ClsCreaImmagine.NomeFileChild = childFile.Name; - ClsCreaImmagine.Suffisso = TextBox3.Text; - // ClsCreaImmagine.Codice = TextBox13.Text - - ClsCreaImmagine.Trasparenza = Conversions.ToInteger(TextBox9.Text); - ClsCreaImmagine.IlFont = ComboBox3.SelectedItem.ToString(); - ClsCreaImmagine.Grassetto = CheckBox3.Checked; - ClsCreaImmagine.Posizione = ComboBox1.SelectedItem.ToString(); - ClsCreaImmagine.Allineamento = ComboBox2.SelectedItem.ToString(); - ClsCreaImmagine.Margine = Conversions.ToInteger(TextBox12.Text); - ClsCreaImmagine.LogoAltezza = Conversions.ToInteger(TextBox14.Text); - ClsCreaImmagine.LogoLarghezza = Conversions.ToInteger(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 = Conversions.ToInteger(TextBox27.Text); - ClsCreaImmagine.LarghezzaBig = Conversions.ToInteger(TextBox28.Text); - ClsCreaImmagine.DimMin = Conversions.ToInteger(TextBox25.Text); - ClsCreaImmagine.TestoMin = RadioButton6.Checked; - ClsCreaImmagine.jpegQuality = Conversions.ToLong(TextBox32.Text); - ClsCreaImmagine.jpegQualityMin = Conversions.ToLong(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) - { - var SourceDir = new DirectoryInfo(SourcePath); - var DestDir = new DirectoryInfo(DestPath); - if (SourceDir.Exists) - { + DestDir = DestDirStart; if (!DestDir.Exists) { DestDir.Create(); - // copy all the files of the current directory } - foreach (var childFile in SourceDir.GetFiles()) + DividiFile = false; + } + + foreach (var childFile in SourceDir.GetFiles("*.jpg")) + { + if (StopAttivo == true) { - if (OverWrite) - { - childFile.CopyTo(Path.Combine(DestDir.FullName, childFile.Name), true); - } - // if overwrite = false, copy the file only if it does not exist - // this is done to avoid an IOException if a file already exists - // this way the other files can be copied anyway... - else if (!File.Exists(Path.Combine(DestDir.FullName, childFile.Name))) - { - childFile.CopyTo(Path.Combine(DestDir.FullName, childFile.Name), false); - } - // copy all the sub-directories by recursively calling this same routine + 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()) - CopyDirectoryFile(subDir.FullName, Path.Combine(DestDir.FullName, subDir.Name), OverWrite); + creaImmaginiWithThreadMod(subDir.FullName, Path.Combine(DestDir.FullName, subDir.Name)); } } + } - public Size NewthumbSize(int currentwidth, int currentheight, int MaxPixel, string TipoSize) + private int getNumerazione() + { + int numerazione; + if (rdbNumProgressiva.Checked) { - // Calculate the Size of the New image - // *** Larghezza, Altezza, Auto - - double tempMultiplier; - if ((TipoSize.ToUpper() ?? "") == ("Larghezza".ToUpper() ?? "")) - { - tempMultiplier = MaxPixel / (double)currentwidth; - } - else if ((TipoSize.ToUpper() ?? "") == ("Altezza".ToUpper() ?? "")) - { - tempMultiplier = MaxPixel / (double)currentheight; - } - else if (currentheight > currentwidth) // portrait - { - tempMultiplier = MaxPixel / (double)currentheight; - } - else - { - tempMultiplier = MaxPixel / (double)currentwidth; - } - - var NewSize = new Size((int)Math.Round(currentwidth * tempMultiplier), - (int)Math.Round(currentheight * tempMultiplier)); - return NewSize; + numerazione = (int)FileHelper.numerazione.Progressiva; + } + else + { + numerazione = (int)FileHelper.numerazione.Files; } - private void Button7_Click(object sender, EventArgs e) - { - StopAttivo = true; - //MyPool.StopThreadPool(); - try - { - _mainToken?.Cancel(); - } - catch (Exception exception) - { - _logger.LogError(exception.Message); - _logger.LogInformation("Ignora questo errore"); - // Console.WriteLine(exception); - // Console.WriteLine("Ignora questo errore"); - } + return numerazione; + } - unlockUI(); + private NumerazioneType GetNumerazioneEnum() + { + NumerazioneType numerazioneType; + if (rdbNumProgressiva.Checked) + { + numerazioneType = NumerazioneType.Progressiva; // FileHelper.numerazione.Progressiva + } + else + { + numerazioneType = NumerazioneType.Files; + } // FileHelper.numerazione.Files + + return numerazioneType; + } + + private void CreaimmaginiWithThreadDict(string SourcePath, string DestPath) + { + var dirSourceDest = new Dictionary(); + 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) } - private void Button4_Click(object sender, EventArgs e) + foreach (var pair in dirSourceDest) { - var openFileDialog = new OpenFileDialog(); + 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); + } + } - // openFileDialog.InitialDirectory = TextBox1.Text - openFileDialog.Filter = "Immagini jpg (*.jpg)|*.jpg|Immagini gif (*.gif)|*.gif|Tutti i file (*.*)|*.*"; - if (TextBox10.Text.Length > 0) + // 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) { - openFileDialog.FileName = TextBox10.Text; - } - - openFileDialog.FilterIndex = 0; - openFileDialog.RestoreDirectory = true; - if (DialogResult.OK == openFileDialog.ShowDialog()) - { - TextBox10.Text = openFileDialog.FileName; - PictureBox1.Image = Image.FromFile(TextBox10.Text); - if (PictureBox1.Image.Height >= PictureBox1.Image.Width) + if (FileConta > NumFileXDir) { - PictureBox1.Height = 160; - PictureBox1.Width = - Conversions.ToInteger(160 * PictureBox1.Image.Width / (double)PictureBox1.Image.Height); + DividiFile = true; } else { - PictureBox1.Width = 224; - PictureBox1.Height = - Conversions.ToInteger(224 * PictureBox1.Image.Height / (double)PictureBox1.Image.Width); + DestDir = DestDirStart; + if (!DestDir.Exists) + { + DestDir.Create(); + } + + DividiFile = false; } } - } - - private string LeggiSoloNomeFile(string FileName) - { - string Testo = FileName; - string Risposta = ""; - var Nomi = Testo.Split(new char[] { '\\' }); - if (Nomi.Length > 1) - { - Risposta = Nomi[Nomi.Length - 1]; - } - - return Risposta; - } - - private void PictureBox1_MouseMove(object sender, MouseEventArgs e) - { - // GetColor() - // GetPixelColor(PictureBox1.PointToScreen(e.Location)).ToArgb.ToString("X8") - } - - private void PictureBox1_MouseUp(object sender, MouseEventArgs e) - { - if (e.Button == MouseButtons.Left) - { - WaterSelectColor = true; - } else { - WaterSelectColor = false; - } - } + DestDir = DestDirStart; + if (!DestDir.Exists) + { + DestDir.Create(); + } - - // 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 - - - // ''' - // ''' Get the color relative to mouse position - // ''' - // 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) - { - // Dim bm As New Bitmap(1, 1, Imaging.PixelFormat.Format24bppRgb) - // Dim g As Graphics = Graphics.FromImage(bm) - // g.CopyFromScreen(screenLocation, New Point(0, 0), New Size(1, 1)) - // Dim result As Color = bm.GetPixel(0, 0) - // g.Dispose() - // bm.Dispose() - // Return result - return null; - } - - private void Button8_Click(object sender, EventArgs e) - { - var MyDialog = new ColorDialog(); - MyDialog.AllowFullOpen = true; - // If TextBox22.Text.Length > 0 And TextBox23.Text.Length > 0 And TextBox24.Text.Length > 0 Then - // If CType(TextBox22.Text, Integer) >= 0 And CType(TextBox23.Text, Integer) >= 0 And CType(TextBox24.Text, Integer) >= 0 Then - // MyDialog.Color = Color.FromArgb(0, CType(TextBox22.Text, Integer), CType(TextBox23.Text, Integer), CType(TextBox24.Text, Integer)) - // End If - // End If - - if (MyDialog.ShowDialog() == DialogResult.OK) - { - // TextBox22.Text = MyDialog.Color.R.ToString - // TextBox23.Text = MyDialog.Color.G.ToString - // TextBox24.Text = MyDialog.Color.B.ToString - TextBox34.Text = ColorTranslator.ToHtml(MyDialog.Color); - TextBox34.BackColor = MyDialog.Color; - } - } - - private void TextBox27_TextChanged(object sender, EventArgs e) - { - } - - private void CheckBox18_CheckedChanged(object sender, EventArgs e) - { - CheckBox4.Checked = false; - CheckBox12.Checked = false; - } - - private void CheckBox4_CheckedChanged(object sender, EventArgs e) - { - CheckBox18.Checked = false; - } - - private void CheckBox12_CheckedChanged(object sender, EventArgs e) - { - CheckBox18.Checked = false; - } - - private void Label27_Click(object sender, EventArgs e) - { - } - - private CancellationTokenSource? _mainToken; - - private async void Button1_Click(object sender, EventArgs e) - { - _logger.LogInformation("Avvio elaborazione..."); - lockUI(); - // Dim timeStart As Date - // Dim timeStop As Date - _mainToken?.Dispose(); - _mainToken = new CancellationTokenSource(); - var token = _mainToken.Token; - - // timeStart = TimeOfDay - FixPaths(); - Label10.Text = "Elaborazione in corso..."; - lblFotoTotaliNum.Text = "0"; - Label18.Text = "0"; - Label43.Text = "-s"; - setPicSettings(Model.SourcePath, Model.DestinationPath); - ProgressBar1.Minimum = 0; - ProgressBar1.Step = 1; - ProgressBar1.Value = 0; - - // Await CreaCatalogoParallel() - var imgStf = _imageCreationService; //new ImageCreationStuff(); - var imageCreationOptions = new ImageCreationStuff.Options - { - AggiornaSottodirectory = chkAggiornaSottodirectory.Checked, - CreaSottocartelle = chkCreaSottocartelle.Checked, - FilePerCartella = Conversions.ToInteger(txtFilePerCartella.Text), - SuffissoCartelle = txtSuffissoCartelle.Text, - CifreContatore = Conversions.ToInteger(txtCifreContatore.Text), - NumerazioneType = GetNumerazioneEnum(), - SourcePath = Model.SourcePath, - DestinationPath = Model.DestinationPath, - MaxThreads = Conversions.ToInteger(TextBox7.Text), - ChunksSize = Conversions.ToInteger(TextBox8.Text), - LinearExecution = rdbVecchioMetodo.Checked - }; - - try - { - _results = []; - _currentAmount = 0; - _previousAmount = 0; - timer1.Tick += Timer1OnTick; - - timer1.Interval = 1000 * 60; - timer1.Enabled = true; - - string time = await imgStf.CreaCatalogoParallel(imageCreationOptions, _results, UiUpdateEvent, token); - Label43.Text = time; - timer1.Enabled = false; - } - catch (OperationCanceledException operationCanceledException) - { - _logger.LogInformation("Operazione Cancellata"); - //Console.WriteLine("Operazione cancellata"); - } - finally - { - _mainToken?.Dispose(); - _mainToken = null; - - timer1.Tick -= Timer1OnTick; + DividiFile = false; } - Label10.Text = "Finito"; - unlockUI(); + 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 = TextBox4.Text; + 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 int _currentAmount = 0; - private int _previousAmount = 0; - - private void Timer1OnTick(object sender, EventArgs e) - { - _previousAmount = _currentAmount; - _currentAmount = _results.Count; - int diff = _currentAmount - _previousAmount; - SetText(Label43, $"{diff} f/m"); - } - - private void UpdateCounter(string text) - { - Label10.Invoke(new Action(() => Label10.Text = text)); - } - - - private async Task CreaCatalogoParallel() - { - var timeStart = DateAndTime.TimeOfDay; - ContaImmaginiThread = 0; - setLabel10Text("Elaborazione in corso..."); - var imgStf = _imageCreationService; - var imageCreationOptions = new ImageCreationStuff.Options(); - imageCreationOptions.AggiornaSottodirectory = chkAggiornaSottodirectory.Checked; - imageCreationOptions.CreaSottocartelle = chkCreaSottocartelle.Checked; - imageCreationOptions.FilePerCartella = Conversions.ToInteger(txtFilePerCartella.Text); - imageCreationOptions.SuffissoCartelle = txtSuffissoCartelle.Text; - imageCreationOptions.CifreContatore = Conversions.ToInteger(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 = DateAndTime.TimeOfDay; - 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 + private void CopyDirectoryFile(string SourcePath, string DestPath, bool OverWrite = false) { - public DirectoryInfo DirSource, DirDest, DirDestStart; - public string NomeImmagine; - - public PicInfo(DirectoryInfo Dir_Source, DirectoryInfo Dir_Dest, DirectoryInfo Dir_DestStart, - string Nome_Immagine) + var SourceDir = new DirectoryInfo(SourcePath); + var DestDir = new DirectoryInfo(DestPath); + if (SourceDir.Exists) { - DirSource = Dir_Source; - DirDest = Dir_Dest; - DirDestStart = Dir_DestStart; - NomeImmagine = Nome_Immagine; + if (!DestDir.Exists) + { + DestDir.Create(); + // copy all the files of the current directory + } + + foreach (var childFile in SourceDir.GetFiles()) + { + if (OverWrite) + { + childFile.CopyTo(Path.Combine(DestDir.FullName, childFile.Name), true); + } + // if overwrite = false, copy the file only if it does not exist + // this is done to avoid an IOException if a file already exists + // this way the other files can be copied anyway... + else if (!File.Exists(Path.Combine(DestDir.FullName, childFile.Name))) + { + childFile.CopyTo(Path.Combine(DestDir.FullName, childFile.Name), false); + } + // copy all the sub-directories by recursively calling this same routine + } + + foreach (var subDir in SourceDir.GetDirectories()) + CopyDirectoryFile(subDir.FullName, Path.Combine(DestDir.FullName, subDir.Name), OverWrite); } } + + public Size NewthumbSize(int currentwidth, int currentheight, int MaxPixel, string TipoSize) + { + // Calculate the Size of the New image + // *** Larghezza, Altezza, Auto + + double tempMultiplier; + if ((TipoSize.ToUpper() ?? "") == ("Larghezza".ToUpper() ?? "")) + { + tempMultiplier = MaxPixel / (double)currentwidth; + } + else if ((TipoSize.ToUpper() ?? "") == ("Altezza".ToUpper() ?? "")) + { + tempMultiplier = MaxPixel / (double)currentheight; + } + else if (currentheight > currentwidth) // portrait + { + tempMultiplier = MaxPixel / (double)currentheight; + } + else + { + tempMultiplier = MaxPixel / (double)currentwidth; + } + + var NewSize = new Size((int)Math.Round(currentwidth * tempMultiplier), + (int)Math.Round(currentheight * tempMultiplier)); + return NewSize; + } + + private void Button7_Click(object sender, EventArgs e) + { + StopAttivo = true; + //MyPool.StopThreadPool(); + try + { + _mainToken?.Cancel(); + } + catch (Exception exception) + { + _logger.LogError(exception.Message); + _logger.LogInformation("Ignora questo errore"); + // Console.WriteLine(exception); + // Console.WriteLine("Ignora questo errore"); + } + + unlockUI(); + } + + private void Button4_Click(object sender, EventArgs e) + { + var openFileDialog = new OpenFileDialog(); + + // openFileDialog.InitialDirectory = TextBox1.Text + openFileDialog.Filter = "Immagini jpg (*.jpg)|*.jpg|Immagini gif (*.gif)|*.gif|Tutti i file (*.*)|*.*"; + if (TextBox10.Text.Length > 0) + { + openFileDialog.FileName = TextBox10.Text; + } + + openFileDialog.FilterIndex = 0; + openFileDialog.RestoreDirectory = true; + if (DialogResult.OK == openFileDialog.ShowDialog()) + { + TextBox10.Text = openFileDialog.FileName; + PictureBox1.Image = Image.FromFile(TextBox10.Text); + if (PictureBox1.Image.Height >= PictureBox1.Image.Width) + { + PictureBox1.Height = 160; + PictureBox1.Width = + (int)(160 * PictureBox1.Image.Width / (double)PictureBox1.Image.Height); + } + else + { + PictureBox1.Width = 224; + PictureBox1.Height = + (int)(224 * PictureBox1.Image.Height / (double)PictureBox1.Image.Width); + } + } + } + + private string LeggiSoloNomeFile(string FileName) + { + string Testo = FileName; + string Risposta = ""; + var Nomi = Testo.Split(new char[] { '\\' }); + if (Nomi.Length > 1) + { + Risposta = Nomi[Nomi.Length - 1]; + } + + return Risposta; + } + + private void PictureBox1_MouseMove(object sender, MouseEventArgs e) + { + // GetColor() + // GetPixelColor(PictureBox1.PointToScreen(e.Location)).ToArgb.ToString("X8") + } + + private void PictureBox1_MouseUp(object sender, MouseEventArgs e) + { + if (e.Button == MouseButtons.Left) + { + WaterSelectColor = true; + } + else + { + WaterSelectColor = false; + } + } + + + // 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 + + + // ''' + // ''' Get the color relative to mouse position + // ''' + // 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) + { + // Dim bm As New Bitmap(1, 1, Imaging.PixelFormat.Format24bppRgb) + // Dim g As Graphics = Graphics.FromImage(bm) + // g.CopyFromScreen(screenLocation, New Point(0, 0), New Size(1, 1)) + // Dim result As Color = bm.GetPixel(0, 0) + // g.Dispose() + // bm.Dispose() + // Return result + return null; + } + + private void Button8_Click(object sender, EventArgs e) + { + var MyDialog = new ColorDialog(); + MyDialog.AllowFullOpen = true; + // If TextBox22.Text.Length > 0 And TextBox23.Text.Length > 0 And TextBox24.Text.Length > 0 Then + // If CType(TextBox22.Text, Integer) >= 0 And CType(TextBox23.Text, Integer) >= 0 And CType(TextBox24.Text, Integer) >= 0 Then + // MyDialog.Color = Color.FromArgb(0, CType(TextBox22.Text, Integer), CType(TextBox23.Text, Integer), CType(TextBox24.Text, Integer)) + // End If + // End If + + if (MyDialog.ShowDialog() == DialogResult.OK) + { + // TextBox22.Text = MyDialog.Color.R.ToString + // TextBox23.Text = MyDialog.Color.G.ToString + // TextBox24.Text = MyDialog.Color.B.ToString + TextBox34.Text = ColorTranslator.ToHtml(MyDialog.Color); + TextBox34.BackColor = MyDialog.Color; + } + } + + private void TextBox27_TextChanged(object sender, EventArgs e) + { + } + + private void CheckBox18_CheckedChanged(object sender, EventArgs e) + { + CheckBox4.Checked = false; + CheckBox12.Checked = false; + } + + private void CheckBox4_CheckedChanged(object sender, EventArgs e) + { + CheckBox18.Checked = false; + } + + private void CheckBox12_CheckedChanged(object sender, EventArgs e) + { + CheckBox18.Checked = false; + } + + private void Label27_Click(object sender, EventArgs e) + { + } + + private CancellationTokenSource? _mainToken; + + private async void Button1_Click(object sender, EventArgs e) + { + _logger.LogInformation("Avvio elaborazione..."); + lockUI(); + // Dim timeStart As Date + // Dim timeStop As Date + _mainToken?.Dispose(); + _mainToken = new CancellationTokenSource(); + var token = _mainToken.Token; + + // timeStart = TimeOfDay + FixPaths(); + Label10.Text = "Elaborazione in corso..."; + lblFotoTotaliNum.Text = "0"; + Label18.Text = "0"; + Label43.Text = "-s"; + setPicSettings(Model.SourcePath, Model.DestinationPath); + ProgressBar1.Minimum = 0; + ProgressBar1.Step = 1; + ProgressBar1.Value = 0; + + // Await CreaCatalogoParallel() + var imgStf = _imageCreationService; //new ImageCreationStuff(); + var imageCreationOptions = new ImageCreationStuff.Options + { + AggiornaSottodirectory = chkAggiornaSottodirectory.Checked, + CreaSottocartelle = chkCreaSottocartelle.Checked, + FilePerCartella = int.Parse(txtFilePerCartella.Text), + SuffissoCartelle = txtSuffissoCartelle.Text, + CifreContatore = int.Parse(txtCifreContatore.Text), + NumerazioneType = GetNumerazioneEnum(), + SourcePath = Model.SourcePath, + DestinationPath = Model.DestinationPath, + MaxThreads = int.Parse(TextBox7.Text), + ChunksSize = int.Parse(TextBox8.Text), + LinearExecution = rdbVecchioMetodo.Checked + }; + + try + { + _results = []; + _currentAmount = 0; + _previousAmount = 0; + timer1.Tick += Timer1OnTick; + + timer1.Interval = 1000 * 60; + timer1.Enabled = true; + + string time = await imgStf.CreaCatalogoParallel(imageCreationOptions, _results, UiUpdateEvent, token); + Label43.Text = time; + timer1.Enabled = false; + } + catch (OperationCanceledException operationCanceledException) + { + _logger.LogInformation("Operazione Cancellata"); + //Console.WriteLine("Operazione cancellata"); + } + finally + { + _mainToken?.Dispose(); + _mainToken = null; + + timer1.Tick -= Timer1OnTick; + } + + Label10.Text = "Finito"; + unlockUI(); + } + + private int _currentAmount = 0; + private int _previousAmount = 0; + + private void Timer1OnTick(object sender, EventArgs e) + { + _previousAmount = _currentAmount; + _currentAmount = _results.Count; + int diff = _currentAmount - _previousAmount; + SetText(Label43, $"{diff} f/m"); + } + + private void UpdateCounter(string 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 DirectoryInfo DirSource, DirDest, DirDestStart; + public string NomeImmagine; + + public PicInfo(DirectoryInfo Dir_Source, DirectoryInfo Dir_Dest, DirectoryInfo Dir_DestStart, + string Nome_Immagine) + { + DirSource = Dir_Source; + DirDest = Dir_Dest; + DirDestStart = Dir_DestStart; + NomeImmagine = Nome_Immagine; + } } \ No newline at end of file -- 2.52.0 From af987f840d3b47a0d904163c5a460b156f1fe668 Mon Sep 17 00:00:00 2001 From: Marco Date: Mon, 28 Jul 2025 09:15:45 +0200 Subject: [PATCH 019/127] Removed old code --- imagecatalog/Form1.cs | 3294 ---------------------------- imagecatalog/Form1.resx | 120 - imagecatalog/Form1.vb | 2946 ------------------------- imagecatalog/ImageCatalog 2.csproj | 5 + imagecatalog/MainForm.Designer.vb | 1956 ----------------- imagecatalog/MainForm.cs | 259 +-- imagecatalog/MainForm.vb | 1502 ------------- imagecatalog/Module1.cs | 158 -- imagecatalog/Module1.vb | 155 -- imagecatalog/Module2.cs | 7 - imagecatalog/Module2.vb | 3 - imagecatalog/Program.cs | 2 + 12 files changed, 120 insertions(+), 10287 deletions(-) delete mode 100644 imagecatalog/Form1.cs delete mode 100644 imagecatalog/Form1.resx delete mode 100644 imagecatalog/Form1.vb delete mode 100644 imagecatalog/MainForm.Designer.vb delete mode 100644 imagecatalog/MainForm.vb delete mode 100644 imagecatalog/Module1.cs delete mode 100644 imagecatalog/Module1.vb delete mode 100644 imagecatalog/Module2.cs delete mode 100644 imagecatalog/Module2.vb diff --git a/imagecatalog/Form1.cs b/imagecatalog/Form1.cs deleted file mode 100644 index aedf2aa..0000000 --- a/imagecatalog/Form1.cs +++ /dev/null @@ -1,3294 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Diagnostics; -using System.Drawing; -using System.IO; -using System.Runtime.CompilerServices; -using System.Threading; -using System.Windows.Forms; -using CatalogVbLib; -using Microsoft.VisualBasic; -using Microsoft.VisualBasic.CompilerServices; - -namespace ImageCatalog -{ - public delegate void XyThreadAddold(string Info); - - public class Form1 : Form - { - - /* TODO ERROR: Skipped RegionDirectiveTrivia */ - public Form1() : base() - { - base.Load += Form1_Load; - - // This call is required by the Windows Form Designer. - InitializeComponent(); - - // Add any initialization after the InitializeComponent() call - - } - - // Form overrides dispose to clean up the component list. - protected override void Dispose(bool disposing) - { - if (disposing) - { - if (components is object) - { - components.Dispose(); - } - } - - base.Dispose(disposing); - } - - // Required by the Windows Form Designer - private System.ComponentModel.IContainer components; - - // NOTE: The following procedure is required by the Windows Form Designer - // It can be modified using the Windows Form Designer. - // Do not modify it using the code editor. - private Button _Button1; - - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - internal Button Button1 - { - [MethodImpl(MethodImplOptions.Synchronized)] - get - { - return _Button1; - } - - [MethodImpl(MethodImplOptions.Synchronized)] - set - { - if (_Button1 != null) - { - _Button1.Click -= btnCreaCatalogo_Click; - } - - _Button1 = value; - if (_Button1 != null) - { - _Button1.Click += btnCreaCatalogo_Click; - } - } - } - - internal Label Label10; - internal Label Label17; - internal Label Label18; - internal Label Label19; - internal Label Label20; - private Button _Button6; - - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - internal Button Button6 - { - [MethodImpl(MethodImplOptions.Synchronized)] - get - { - return _Button6; - } - - [MethodImpl(MethodImplOptions.Synchronized)] - set - { - if (_Button6 != null) - { - _Button6.Click -= Button6_Click; - } - - _Button6 = value; - if (_Button6 != null) - { - _Button6.Click += Button6_Click; - } - } - } - - private Button _Button5; - - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - internal Button Button5 - { - [MethodImpl(MethodImplOptions.Synchronized)] - get - { - return _Button5; - } - - [MethodImpl(MethodImplOptions.Synchronized)] - set - { - if (_Button5 != null) - { - _Button5.Click -= Button5_Click; - } - - _Button5 = value; - if (_Button5 != null) - { - _Button5.Click += Button5_Click; - } - } - } - - private Button _Button7; - - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - internal Button Button7 - { - [MethodImpl(MethodImplOptions.Synchronized)] - get - { - return _Button7; - } - - [MethodImpl(MethodImplOptions.Synchronized)] - set - { - if (_Button7 != null) - { - _Button7.Click -= Button7_Click; - } - - _Button7 = value; - if (_Button7 != null) - { - _Button7.Click += Button7_Click; - } - } - } - - internal Label Label27; - internal TextBox TextBox13; - internal Label Label16; - internal Label Label7; - internal TextBox TextBox7; - internal Label Label8; - internal TextBox TextBox8; - internal CheckBox CheckBox2; - internal Label Label43; - internal CheckBox CheckBox22; - internal TabPage TabPage4; - internal GroupBox GroupBox6; - internal PictureBox PictureBox2; - private PictureBox _PictureBox1; - - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - internal PictureBox PictureBox1 - { - [MethodImpl(MethodImplOptions.Synchronized)] - get - { - return _PictureBox1; - } - - [MethodImpl(MethodImplOptions.Synchronized)] - set - { - if (_PictureBox1 != null) - { - _PictureBox1.MouseMove -= PictureBox1_MouseMove; - _PictureBox1.MouseUp -= PictureBox1_MouseUp; - } - - _PictureBox1 = value; - if (_PictureBox1 != null) - { - _PictureBox1.MouseMove += PictureBox1_MouseMove; - _PictureBox1.MouseUp += PictureBox1_MouseUp; - } - } - } - - internal ComboBox ComboBox5; - internal ComboBox ComboBox4; - internal TextBox TextBox19; - internal Label Label28; - internal CheckBox CheckBox5; - internal TextBox TextBox15; - internal TextBox TextBox14; - internal Label Label25; - internal TextBox TextBox16; - internal Label Label24; - internal Label Label22; - internal Label Label23; - private Button _Button4; - - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - internal Button Button4 - { - [MethodImpl(MethodImplOptions.Synchronized)] - get - { - return _Button4; - } - - [MethodImpl(MethodImplOptions.Synchronized)] - set - { - if (_Button4 != null) - { - _Button4.Click -= Button4_Click; - } - - _Button4 = value; - if (_Button4 != null) - { - _Button4.Click += Button4_Click; - } - } - } - - internal TextBox TextBox10; - internal Label Label29; - internal Label Label30; - internal PictureBox PictureBox3; - internal TabPage TabPage1; - internal GroupBox GroupBox1; - internal Panel Panel2; - internal RadioButton RadioButton3; - internal RadioButton RadioButton7; - internal RadioButton RadioButton4; - internal RadioButton RadioButton6; - internal RadioButton RadioButton5; - internal Label Label5; - internal TextBox TextBox5; - internal Label Label6; - internal TextBox TextBox6; - internal Label Label3; - internal TextBox TextBox3; - internal CheckBox CheckBox1; - internal TabPage TabPage2; - internal GroupBox GroupBox2; - internal TextBox TextBox26; - internal Label Label37; - internal Label Label38; - internal TextBox TextBox27; - internal Label Label39; - internal TextBox TextBox28; - internal CheckBox CheckBox15; - internal TabPage TabPage3; - internal GroupBox GroupBox10; - internal Label Label42; - internal Label Label41; - internal TextBox TextBox31; - internal TextBox TextBox30; - internal GroupBox GroupBox9; - internal CheckBox CheckBox17; - internal CheckBox CheckBox16; - internal GroupBox GroupBox5; - private Button _Button8; - - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - internal Button Button8 - { - [MethodImpl(MethodImplOptions.Synchronized)] - get - { - return _Button8; - } - - [MethodImpl(MethodImplOptions.Synchronized)] - set - { - if (_Button8 != null) - { - _Button8.Click -= Button8_Click; - } - - _Button8 = value; - if (_Button8 != null) - { - _Button8.Click += Button8_Click; - } - } - } - - internal Label Label36; - internal TextBox TextBox25; - internal Label Label35; - internal ComboBox ComboBox3; - internal TextBox TextBox11; - internal Label Label12; - internal Label Label11; - internal CheckBox CheckBox3; - internal GroupBox GroupBox4; - internal Label Label40; - internal TextBox TextBox29; - internal TextBox TextBox18; - internal Label Label26; - internal DateTimePicker DateTimePicker1; - internal CheckBox CheckBox8; - internal TextBox TextBox9; - internal CheckBox CheckBox7; - internal Label Label4; - internal TextBox TextBox4; - internal Label Label9; - internal Label Label13; - internal ComboBox ComboBox1; - internal ComboBox ComboBox2; - internal Label Label14; - internal TextBox TextBox12; - internal Label Label15; - internal TabPage TabPage5; - internal GroupBox GroupBox3; - internal CheckBox CheckBox6; - private Button _Button3; - - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - internal Button Button3 - { - [MethodImpl(MethodImplOptions.Synchronized)] - get - { - return _Button3; - } - - [MethodImpl(MethodImplOptions.Synchronized)] - set - { - if (_Button3 != null) - { - _Button3.Click -= Button3_Click; - } - - _Button3 = value; - if (_Button3 != null) - { - _Button3.Click += Button3_Click; - } - } - } - - private Button _Button2; - - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - internal Button Button2 - { - [MethodImpl(MethodImplOptions.Synchronized)] - get - { - return _Button2; - } - - [MethodImpl(MethodImplOptions.Synchronized)] - set - { - if (_Button2 != null) - { - _Button2.Click -= Button2_Click; - } - - _Button2 = value; - if (_Button2 != null) - { - _Button2.Click += Button2_Click; - } - } - } - - internal Label Label1; - internal Label Label2; - internal TextBox TextBox1; - internal TextBox TextBox2; - internal GroupBox GroupBox8; - internal RadioButton RadioButton2; - internal RadioButton RadioButton1; - internal TextBox TextBox21; - internal Label Label34; - internal TextBox TextBox20; - internal Label Label33; - internal Label Label31; - internal CheckBox CheckBox11; - internal TextBox TextBox17; - internal Label Label32; - internal GroupBox GroupBox7; - internal CheckBox CheckBox10; - internal CheckBox CheckBox9; - internal TabControl TabControl1; - internal Label Label45; - internal TextBox TextBox32; - internal TextBox TextBox33; - internal TextBox TextBox34; - internal Label Label46; - internal ProgressBar ProgressBar1; - internal Panel Panel1; - private CheckBox _CheckBox18; - - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - internal CheckBox CheckBox18 - { - [MethodImpl(MethodImplOptions.Synchronized)] - get - { - return _CheckBox18; - } - - [MethodImpl(MethodImplOptions.Synchronized)] - set - { - if (_CheckBox18 != null) - { - _CheckBox18.CheckedChanged -= CheckBox18_CheckedChanged; - } - - _CheckBox18 = value; - if (_CheckBox18 != null) - { - _CheckBox18.CheckedChanged += CheckBox18_CheckedChanged; - } - } - } - - private CheckBox _CheckBox4; - - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - internal CheckBox CheckBox4 - { - [MethodImpl(MethodImplOptions.Synchronized)] - get - { - return _CheckBox4; - } - - [MethodImpl(MethodImplOptions.Synchronized)] - set - { - if (_CheckBox4 != null) - { - _CheckBox4.CheckedChanged -= CheckBox4_CheckedChanged; - } - - _CheckBox4 = value; - if (_CheckBox4 != null) - { - _CheckBox4.CheckedChanged += CheckBox4_CheckedChanged; - } - } - } - - private CheckBox _CheckBox12; - - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - internal CheckBox CheckBox12 - { - [MethodImpl(MethodImplOptions.Synchronized)] - get - { - return _CheckBox12; - } - - [MethodImpl(MethodImplOptions.Synchronized)] - set - { - if (_CheckBox12 != null) - { - _CheckBox12.CheckedChanged -= CheckBox12_CheckedChanged; - } - - _CheckBox12 = value; - if (_CheckBox12 != null) - { - _CheckBox12.CheckedChanged += CheckBox12_CheckedChanged; - } - } - } - - internal Label Label44; - - [DebuggerStepThrough()] - private void InitializeComponent() - { - _Button1 = new Button(); - _Button1.Click += new EventHandler(btnCreaCatalogo_Click); - Label10 = new Label(); - Label17 = new Label(); - Label18 = new Label(); - Label19 = new Label(); - Label20 = new Label(); - _Button6 = new Button(); - _Button6.Click += new EventHandler(Button6_Click); - _Button5 = new Button(); - _Button5.Click += new EventHandler(Button5_Click); - _Button7 = new Button(); - _Button7.Click += new EventHandler(Button7_Click); - Label27 = new Label(); - TextBox13 = new TextBox(); - Label16 = new Label(); - Label7 = new Label(); - TextBox7 = new TextBox(); - Label8 = new Label(); - TextBox8 = new TextBox(); - CheckBox2 = new CheckBox(); - Label43 = new Label(); - CheckBox22 = new CheckBox(); - Label44 = new Label(); - TabPage4 = new TabPage(); - GroupBox6 = new GroupBox(); - PictureBox2 = new PictureBox(); - _PictureBox1 = new PictureBox(); - _PictureBox1.MouseMove += new MouseEventHandler(PictureBox1_MouseMove); - _PictureBox1.MouseUp += new MouseEventHandler(PictureBox1_MouseUp); - ComboBox5 = new ComboBox(); - ComboBox4 = new ComboBox(); - TextBox19 = new TextBox(); - Label28 = new Label(); - CheckBox5 = new CheckBox(); - TextBox15 = new TextBox(); - TextBox14 = new TextBox(); - Label25 = new Label(); - TextBox16 = new TextBox(); - Label24 = new Label(); - Label22 = new Label(); - Label23 = new Label(); - _Button4 = new Button(); - _Button4.Click += new EventHandler(Button4_Click); - TextBox10 = new TextBox(); - Label29 = new Label(); - Label30 = new Label(); - PictureBox3 = new PictureBox(); - TabPage1 = new TabPage(); - GroupBox1 = new GroupBox(); - Label46 = new Label(); - TextBox33 = new TextBox(); - Panel2 = new Panel(); - RadioButton3 = new RadioButton(); - RadioButton7 = new RadioButton(); - RadioButton4 = new RadioButton(); - RadioButton6 = new RadioButton(); - RadioButton5 = new RadioButton(); - Label5 = new Label(); - TextBox5 = new TextBox(); - Label6 = new Label(); - TextBox6 = new TextBox(); - Label3 = new Label(); - TextBox3 = new TextBox(); - CheckBox1 = new CheckBox(); - TabPage2 = new TabPage(); - GroupBox2 = new GroupBox(); - Label45 = new Label(); - TextBox32 = new TextBox(); - TextBox26 = new TextBox(); - Label37 = new Label(); - Label38 = new Label(); - TextBox27 = new TextBox(); - Label39 = new Label(); - TextBox28 = new TextBox(); - CheckBox15 = new CheckBox(); - TabPage3 = new TabPage(); - GroupBox10 = new GroupBox(); - Label42 = new Label(); - Label41 = new Label(); - TextBox31 = new TextBox(); - TextBox30 = new TextBox(); - GroupBox9 = new GroupBox(); - CheckBox17 = new CheckBox(); - CheckBox16 = new CheckBox(); - GroupBox5 = new GroupBox(); - TextBox34 = new TextBox(); - _Button8 = new Button(); - _Button8.Click += new EventHandler(Button8_Click); - Label36 = new Label(); - TextBox25 = new TextBox(); - Label35 = new Label(); - ComboBox3 = new ComboBox(); - TextBox11 = new TextBox(); - Label12 = new Label(); - Label11 = new Label(); - CheckBox3 = new CheckBox(); - GroupBox4 = new GroupBox(); - Label40 = new Label(); - TextBox29 = new TextBox(); - TextBox18 = new TextBox(); - Label26 = new Label(); - DateTimePicker1 = new DateTimePicker(); - CheckBox8 = new CheckBox(); - TextBox9 = new TextBox(); - CheckBox7 = new CheckBox(); - Label4 = new Label(); - TextBox4 = new TextBox(); - Label9 = new Label(); - Label13 = new Label(); - ComboBox1 = new ComboBox(); - ComboBox2 = new ComboBox(); - Label14 = new Label(); - TextBox12 = new TextBox(); - Label15 = new Label(); - TabPage5 = new TabPage(); - GroupBox3 = new GroupBox(); - CheckBox6 = new CheckBox(); - _Button3 = new Button(); - _Button3.Click += new EventHandler(Button3_Click); - _Button2 = new Button(); - _Button2.Click += new EventHandler(Button2_Click); - Label1 = new Label(); - Label2 = new Label(); - TextBox1 = new TextBox(); - TextBox2 = new TextBox(); - GroupBox8 = new GroupBox(); - RadioButton2 = new RadioButton(); - RadioButton1 = new RadioButton(); - TextBox21 = new TextBox(); - Label34 = new Label(); - TextBox20 = new TextBox(); - Label33 = new Label(); - Label31 = new Label(); - CheckBox11 = new CheckBox(); - TextBox17 = new TextBox(); - Label32 = new Label(); - GroupBox7 = new GroupBox(); - CheckBox10 = new CheckBox(); - CheckBox9 = new CheckBox(); - TabControl1 = new TabControl(); - ProgressBar1 = new ProgressBar(); - _CheckBox12 = new CheckBox(); - _CheckBox12.CheckedChanged += new EventHandler(CheckBox12_CheckedChanged); - _CheckBox4 = new CheckBox(); - _CheckBox4.CheckedChanged += new EventHandler(CheckBox4_CheckedChanged); - _CheckBox18 = new CheckBox(); - _CheckBox18.CheckedChanged += new EventHandler(CheckBox18_CheckedChanged); - Panel1 = new Panel(); - TabPage4.SuspendLayout(); - GroupBox6.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)PictureBox2).BeginInit(); - ((System.ComponentModel.ISupportInitialize)_PictureBox1).BeginInit(); - ((System.ComponentModel.ISupportInitialize)PictureBox3).BeginInit(); - TabPage1.SuspendLayout(); - GroupBox1.SuspendLayout(); - Panel2.SuspendLayout(); - TabPage2.SuspendLayout(); - GroupBox2.SuspendLayout(); - TabPage3.SuspendLayout(); - GroupBox10.SuspendLayout(); - GroupBox9.SuspendLayout(); - GroupBox5.SuspendLayout(); - GroupBox4.SuspendLayout(); - TabPage5.SuspendLayout(); - GroupBox3.SuspendLayout(); - GroupBox8.SuspendLayout(); - GroupBox7.SuspendLayout(); - TabControl1.SuspendLayout(); - Panel1.SuspendLayout(); - SuspendLayout(); - // - // Button1 - // - _Button1.Font = new Font("Microsoft Sans Serif", 12.0f, FontStyle.Bold, GraphicsUnit.Point, Conversions.ToByte(0)); - _Button1.Location = new Point(539, 77); - _Button1.Name = "_Button1"; - _Button1.Size = new Size(192, 39); - _Button1.TabIndex = 2; - _Button1.Text = "crea catalogo"; - // - // Label10 - // - Label10.Font = new Font("Microsoft Sans Serif", 14.25f, FontStyle.Bold, GraphicsUnit.Point, Conversions.ToByte(0)); - Label10.Location = new Point(539, 163); - Label10.Name = "Label10"; - Label10.Size = new Size(192, 72); - Label10.TabIndex = 21; - Label10.Text = "file"; - // - // Label17 - // - Label17.AutoSize = true; - Label17.Font = new Font("Microsoft Sans Serif", 12.0f, FontStyle.Bold, GraphicsUnit.Point, Conversions.ToByte(0)); - Label17.Location = new Point(643, 243); - Label17.Name = "Label17"; - Label17.Size = new Size(19, 20); - Label17.TabIndex = 38; - Label17.Text = "0"; - // - // Label18 - // - Label18.AutoSize = true; - Label18.Font = new Font("Microsoft Sans Serif", 12.0f, FontStyle.Bold, GraphicsUnit.Point, Conversions.ToByte(0)); - Label18.Location = new Point(643, 262); - Label18.Name = "Label18"; - Label18.Size = new Size(19, 20); - Label18.TabIndex = 39; - Label18.Text = "0"; - // - // Label19 - // - Label19.AutoSize = true; - Label19.Font = new Font("Microsoft Sans Serif", 9.75f, FontStyle.Bold, GraphicsUnit.Point, Conversions.ToByte(0)); - Label19.Location = new Point(539, 243); - Label19.Name = "Label19"; - Label19.Size = new Size(80, 16); - Label19.TabIndex = 40; - Label19.Text = "foto totali: "; - // - // Label20 - // - Label20.AutoSize = true; - Label20.Font = new Font("Microsoft Sans Serif", 9.75f, FontStyle.Bold, GraphicsUnit.Point, Conversions.ToByte(0)); - Label20.Location = new Point(539, 262); - Label20.Name = "Label20"; - Label20.Size = new Size(104, 16); - Label20.TabIndex = 41; - Label20.Text = "foto generate:"; - // - // Button6 - // - _Button6.Font = new Font("Microsoft Sans Serif", 11.0f, FontStyle.Bold, GraphicsUnit.Point, Conversions.ToByte(0)); - _Button6.Location = new Point(539, 12); - _Button6.Name = "_Button6"; - _Button6.Size = new Size(192, 32); - _Button6.TabIndex = 12; - _Button6.Text = "Carica impostazioni"; - // - // Button5 - // - _Button5.Font = new Font("Microsoft Sans Serif", 11.0f, FontStyle.Bold, GraphicsUnit.Point, Conversions.ToByte(0)); - _Button5.Location = new Point(539, 43); - _Button5.Name = "_Button5"; - _Button5.Size = new Size(192, 32); - _Button5.TabIndex = 43; - _Button5.Text = "Salva impostazioni"; - // - // Button7 - // - _Button7.Font = new Font("Microsoft Sans Serif", 14.25f, FontStyle.Regular, GraphicsUnit.Point, Conversions.ToByte(0)); - _Button7.Location = new Point(539, 120); - _Button7.Name = "_Button7"; - _Button7.Size = new Size(192, 40); - _Button7.TabIndex = 44; - _Button7.Text = "stop creazione"; - // - // Label27 - // - Label27.Location = new Point(591, 346); - Label27.Name = "Label27"; - Label27.Size = new Size(140, 20); - Label27.TabIndex = 46; - Label27.Text = "Versione 2.0 BETA 1"; - Label27.TextAlign = ContentAlignment.MiddleRight; - // - // TextBox13 - // - TextBox13.Location = new Point(224, 48); - TextBox13.Name = "TextBox13"; - TextBox13.Size = new Size(56, 20); - TextBox13.TabIndex = 20; - TextBox13.Text = "TextBox13"; - // - // Label16 - // - Label16.ForeColor = Color.Black; - Label16.Location = new Point(168, 48); - Label16.Name = "Label16"; - Label16.Size = new Size(48, 16); - Label16.TabIndex = 19; - Label16.Text = "Suffisso"; - Label16.TextAlign = ContentAlignment.MiddleRight; - // - // Label7 - // - Label7.AutoSize = true; - Label7.ForeColor = Color.Black; - Label7.Location = new Point(24, 24); - Label7.Name = "Label7"; - Label7.Size = new Size(41, 13); - Label7.TabIndex = 16; - Label7.Text = "Altezza"; - // - // TextBox7 - // - TextBox7.Location = new Point(72, 24); - TextBox7.Name = "TextBox7"; - TextBox7.Size = new Size(72, 20); - TextBox7.TabIndex = 14; - TextBox7.Text = "TextBox7"; - // - // Label8 - // - Label8.AutoSize = true; - Label8.ForeColor = Color.Black; - Label8.Location = new Point(8, 48); - Label8.Name = "Label8"; - Label8.Size = new Size(56, 13); - Label8.TabIndex = 17; - Label8.Text = "Larghezza"; - // - // TextBox8 - // - TextBox8.Location = new Point(72, 48); - TextBox8.Name = "TextBox8"; - TextBox8.Size = new Size(72, 20); - TextBox8.TabIndex = 15; - TextBox8.Text = "TextBox8"; - // - // CheckBox2 - // - CheckBox2.Checked = true; - CheckBox2.CheckState = CheckState.Checked; - CheckBox2.ForeColor = Color.Black; - CheckBox2.Location = new Point(168, 16); - CheckBox2.Name = "CheckBox2"; - CheckBox2.Size = new Size(120, 32); - CheckBox2.TabIndex = 18; - CheckBox2.Text = "Mantieni dimensioni originali"; - // - // Label43 - // - Label43.AutoSize = true; - Label43.Location = new Point(651, 303); - Label43.Name = "Label43"; - Label43.Size = new Size(25, 13); - Label43.TabIndex = 49; - Label43.Text = "000"; - // - // CheckBox22 - // - CheckBox22.AutoSize = true; - CheckBox22.Location = new Point(539, 326); - CheckBox22.Name = "CheckBox22"; - CheckBox22.Size = new Size(104, 17); - CheckBox22.TabIndex = 50; - CheckBox22.Text = "Arresta il sistema"; - CheckBox22.UseVisualStyleBackColor = true; - // - // Label44 - // - Label44.AutoSize = true; - Label44.Location = new Point(539, 303); - Label44.Name = "Label44"; - Label44.Size = new Size(106, 13); - Label44.TabIndex = 51; - Label44.Text = "Tempo elaborazione:"; - // - // TabPage4 - // - TabPage4.Controls.Add(GroupBox6); - TabPage4.Location = new Point(4, 22); - TabPage4.Name = "TabPage4"; - TabPage4.Padding = new Padding(3); - TabPage4.Size = new Size(513, 326); - TabPage4.TabIndex = 3; - TabPage4.Text = "Logo"; - TabPage4.UseVisualStyleBackColor = true; - // - // GroupBox6 - // - GroupBox6.Controls.Add(PictureBox2); - GroupBox6.Controls.Add(_PictureBox1); - GroupBox6.Controls.Add(ComboBox5); - GroupBox6.Controls.Add(ComboBox4); - GroupBox6.Controls.Add(TextBox19); - GroupBox6.Controls.Add(Label28); - GroupBox6.Controls.Add(CheckBox5); - GroupBox6.Controls.Add(TextBox15); - GroupBox6.Controls.Add(TextBox14); - GroupBox6.Controls.Add(Label25); - GroupBox6.Controls.Add(TextBox16); - GroupBox6.Controls.Add(Label24); - GroupBox6.Controls.Add(Label22); - GroupBox6.Controls.Add(Label23); - GroupBox6.Controls.Add(_Button4); - GroupBox6.Controls.Add(TextBox10); - GroupBox6.Controls.Add(Label29); - GroupBox6.Controls.Add(Label30); - GroupBox6.Controls.Add(PictureBox3); - GroupBox6.ForeColor = Color.FromArgb(Conversions.ToInteger(Conversions.ToByte(0)), Conversions.ToInteger(Conversions.ToByte(0)), Conversions.ToInteger(Conversions.ToByte(192))); - GroupBox6.Location = new Point(6, 6); - GroupBox6.Name = "GroupBox6"; - GroupBox6.Size = new Size(496, 224); - GroupBox6.TabIndex = 42; - GroupBox6.TabStop = false; - GroupBox6.Text = "Logo"; - // - // PictureBox2 - // - PictureBox2.BorderStyle = BorderStyle.FixedSingle; - PictureBox2.Location = new Point(144, 192); - PictureBox2.Name = "PictureBox2"; - PictureBox2.Size = new Size(24, 24); - PictureBox2.TabIndex = 44; - PictureBox2.TabStop = false; - PictureBox2.Visible = false; - // - // PictureBox1 - // - _PictureBox1.Cursor = Cursors.Cross; - _PictureBox1.Location = new Point(256, 56); - _PictureBox1.Name = "_PictureBox1"; - _PictureBox1.Size = new Size(224, 160); - _PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; - _PictureBox1.TabIndex = 43; - _PictureBox1.TabStop = false; - // - // ComboBox5 - // - ComboBox5.Location = new Point(144, 168); - ComboBox5.Name = "ComboBox5"; - ComboBox5.Size = new Size(96, 21); - ComboBox5.TabIndex = 42; - ComboBox5.Text = "ComboBox5"; - // - // ComboBox4 - // - ComboBox4.Location = new Point(144, 144); - ComboBox4.Name = "ComboBox4"; - ComboBox4.Size = new Size(96, 21); - ComboBox4.TabIndex = 41; - ComboBox4.Text = "ComboBox4"; - // - // TextBox19 - // - TextBox19.Location = new Point(144, 96); - TextBox19.Name = "TextBox19"; - TextBox19.Size = new Size(96, 20); - TextBox19.TabIndex = 40; - TextBox19.Text = "TextBox19"; - // - // Label28 - // - Label28.ForeColor = Color.Black; - Label28.Location = new Point(17, 97); - Label28.Name = "Label28"; - Label28.Size = new Size(120, 16); - Label28.TabIndex = 39; - Label28.Text = "Trasparenza (0-100%)"; - Label28.TextAlign = ContentAlignment.MiddleLeft; - // - // CheckBox5 - // - CheckBox5.ForeColor = Color.Black; - CheckBox5.Location = new Point(0, 26); - CheckBox5.Name = "CheckBox5"; - CheckBox5.Size = new Size(72, 20); - CheckBox5.TabIndex = 38; - CheckBox5.Text = "Aggiungi"; - // - // TextBox15 - // - TextBox15.Location = new Point(144, 72); - TextBox15.Name = "TextBox15"; - TextBox15.Size = new Size(96, 20); - TextBox15.TabIndex = 19; - TextBox15.Text = "TextBox15"; - // - // TextBox14 - // - TextBox14.Location = new Point(144, 48); - TextBox14.Name = "TextBox14"; - TextBox14.Size = new Size(96, 20); - TextBox14.TabIndex = 18; - TextBox14.Text = "TextBox14"; - // - // Label25 - // - Label25.AutoSize = true; - Label25.ForeColor = Color.Black; - Label25.Location = new Point(17, 168); - Label25.Name = "Label25"; - Label25.Size = new Size(95, 13); - Label25.TabIndex = 36; - Label25.Text = "Posizione verticale"; - Label25.TextAlign = ContentAlignment.MiddleLeft; - // - // TextBox16 - // - TextBox16.Location = new Point(144, 120); - TextBox16.Name = "TextBox16"; - TextBox16.Size = new Size(96, 20); - TextBox16.TabIndex = 35; - TextBox16.Text = "TextBox16"; - // - // Label24 - // - Label24.AutoSize = true; - Label24.ForeColor = Color.Black; - Label24.Location = new Point(19, 123); - Label24.Name = "Label24"; - Label24.Size = new Size(88, 13); - Label24.TabIndex = 34; - Label24.Text = "Margine (pixel/%)"; - Label24.TextAlign = ContentAlignment.MiddleLeft; - // - // Label22 - // - Label22.AutoSize = true; - Label22.ForeColor = Color.Black; - Label22.Location = new Point(19, 51); - Label22.Name = "Label22"; - Label22.Size = new Size(41, 13); - Label22.TabIndex = 20; - Label22.Text = "Altezza"; - Label22.TextAlign = ContentAlignment.MiddleLeft; - // - // Label23 - // - Label23.AutoSize = true; - Label23.ForeColor = Color.Black; - Label23.Location = new Point(19, 75); - Label23.Name = "Label23"; - Label23.Size = new Size(56, 13); - Label23.TabIndex = 21; - Label23.Text = "Larghezza"; - Label23.TextAlign = ContentAlignment.MiddleLeft; - // - // Button4 - // - _Button4.Location = new Point(464, 24); - _Button4.Name = "_Button4"; - _Button4.Size = new Size(24, 20); - _Button4.TabIndex = 8; - _Button4.Text = "..."; - // - // TextBox10 - // - TextBox10.Location = new Point(144, 24); - TextBox10.Name = "TextBox10"; - TextBox10.Size = new Size(312, 20); - TextBox10.TabIndex = 6; - TextBox10.Text = "TextBox10"; - // - // Label29 - // - Label29.AutoSize = true; - Label29.ForeColor = Color.Black; - Label29.Location = new Point(17, 147); - Label29.Name = "Label29"; - Label29.Size = new Size(105, 13); - Label29.TabIndex = 36; - Label29.Text = "Posizione orizzontale"; - Label29.TextAlign = ContentAlignment.MiddleLeft; - // - // Label30 - // - Label30.AutoSize = true; - Label30.ForeColor = Color.Black; - Label30.Location = new Point(19, 203); - Label30.Name = "Label30"; - Label30.Size = new Size(93, 13); - Label30.TabIndex = 36; - Label30.Text = "Colore trasparente"; - Label30.TextAlign = ContentAlignment.MiddleLeft; - Label30.Visible = false; - // - // PictureBox3 - // - PictureBox3.BorderStyle = BorderStyle.FixedSingle; - PictureBox3.Location = new Point(216, 192); - PictureBox3.Name = "PictureBox3"; - PictureBox3.Size = new Size(24, 24); - PictureBox3.TabIndex = 44; - PictureBox3.TabStop = false; - PictureBox3.Visible = false; - // - // TabPage1 - // - TabPage1.Controls.Add(Panel1); - TabPage1.Controls.Add(GroupBox1); - TabPage1.Location = new Point(4, 22); - TabPage1.Name = "TabPage1"; - TabPage1.Padding = new Padding(3); - TabPage1.Size = new Size(513, 326); - TabPage1.TabIndex = 0; - TabPage1.Text = "Miniature"; - TabPage1.UseVisualStyleBackColor = true; - // - // GroupBox1 - // - GroupBox1.Controls.Add(Label46); - GroupBox1.Controls.Add(TextBox33); - GroupBox1.Controls.Add(Panel2); - GroupBox1.Controls.Add(Label5); - GroupBox1.Controls.Add(TextBox5); - GroupBox1.Controls.Add(Label6); - GroupBox1.Controls.Add(TextBox6); - GroupBox1.Controls.Add(Label3); - GroupBox1.Controls.Add(TextBox3); - GroupBox1.Controls.Add(CheckBox1); - GroupBox1.ForeColor = Color.FromArgb(Conversions.ToInteger(Conversions.ToByte(0)), Conversions.ToInteger(Conversions.ToByte(0)), Conversions.ToInteger(Conversions.ToByte(192))); - GroupBox1.Location = new Point(6, 5); - GroupBox1.Name = "GroupBox1"; - GroupBox1.Size = new Size(350, 210); - GroupBox1.TabIndex = 25; - GroupBox1.TabStop = false; - GroupBox1.Text = "Miniature"; - // - // Label46 - // - Label46.AutoSize = true; - Label46.Location = new Point(198, 43); - Label46.Name = "Label46"; - Label46.Size = new Size(40, 13); - Label46.TabIndex = 21; - Label46.Text = "Qualità"; - // - // TextBox33 - // - TextBox33.Location = new Point(244, 40); - TextBox33.Name = "TextBox33"; - TextBox33.Size = new Size(100, 20); - TextBox33.TabIndex = 20; - // - // Panel2 - // - Panel2.Controls.Add(RadioButton3); - Panel2.Controls.Add(RadioButton7); - Panel2.Controls.Add(RadioButton4); - Panel2.Controls.Add(RadioButton6); - Panel2.Controls.Add(RadioButton5); - Panel2.Location = new Point(56, 114); - Panel2.Name = "Panel2"; - Panel2.Size = new Size(235, 90); - Panel2.TabIndex = 19; - // - // RadioButton3 - // - RadioButton3.AutoSize = true; - RadioButton3.Location = new Point(15, 16); - RadioButton3.Name = "RadioButton3"; - RadioButton3.Size = new Size(99, 17); - RadioButton3.TabIndex = 14; - RadioButton3.TabStop = true; - RadioButton3.Text = "Aggiungi Scritta"; - RadioButton3.UseVisualStyleBackColor = true; - // - // RadioButton7 - // - RadioButton7.AutoSize = true; - RadioButton7.Location = new Point(129, 40); - RadioButton7.Name = "RadioButton7"; - RadioButton7.Size = new Size(95, 17); - RadioButton7.TabIndex = 18; - RadioButton7.TabStop = true; - RadioButton7.Text = "numero+tempo"; - RadioButton7.UseVisualStyleBackColor = true; - // - // RadioButton4 - // - RadioButton4.AutoSize = true; - RadioButton4.Location = new Point(15, 40); - RadioButton4.Name = "RadioButton4"; - RadioButton4.Size = new Size(95, 17); - RadioButton4.TabIndex = 15; - RadioButton4.TabStop = true; - RadioButton4.Text = "Aggiungi orario"; - RadioButton4.UseVisualStyleBackColor = true; - // - // RadioButton6 - // - RadioButton6.AutoSize = true; - RadioButton6.Location = new Point(129, 16); - RadioButton6.Name = "RadioButton6"; - RadioButton6.Size = new Size(83, 17); - RadioButton6.TabIndex = 17; - RadioButton6.TabStop = true; - RadioButton6.Text = "Numero foto"; - RadioButton6.UseVisualStyleBackColor = true; - // - // RadioButton5 - // - RadioButton5.AutoSize = true; - RadioButton5.Location = new Point(15, 65); - RadioButton5.Name = "RadioButton5"; - RadioButton5.Size = new Size(84, 17); - RadioButton5.TabIndex = 16; - RadioButton5.TabStop = true; - RadioButton5.Text = "Tempo Gara"; - RadioButton5.UseVisualStyleBackColor = true; - // - // Label5 - // - Label5.AutoSize = true; - Label5.ForeColor = Color.Black; - Label5.Location = new Point(24, 88); - Label5.Name = "Label5"; - Label5.Size = new Size(41, 13); - Label5.TabIndex = 12; - Label5.Text = "Altezza"; - // - // TextBox5 - // - TextBox5.Location = new Point(72, 64); - TextBox5.Name = "TextBox5"; - TextBox5.Size = new Size(88, 20); - TextBox5.TabIndex = 10; - TextBox5.Text = "TextBox5"; - // - // Label6 - // - Label6.AutoSize = true; - Label6.ForeColor = Color.Black; - Label6.Location = new Point(8, 64); - Label6.Name = "Label6"; - Label6.Size = new Size(56, 13); - Label6.TabIndex = 13; - Label6.Text = "Larghezza"; - // - // TextBox6 - // - TextBox6.Location = new Point(72, 88); - TextBox6.Name = "TextBox6"; - TextBox6.Size = new Size(88, 20); - TextBox6.TabIndex = 11; - TextBox6.Text = "TextBox6"; - // - // Label3 - // - Label3.AutoSize = true; - Label3.ForeColor = Color.Black; - Label3.Location = new Point(24, 40); - Label3.Name = "Label3"; - Label3.Size = new Size(44, 13); - Label3.TabIndex = 7; - Label3.Text = "Suffisso"; - // - // TextBox3 - // - TextBox3.Location = new Point(72, 40); - TextBox3.Name = "TextBox3"; - TextBox3.Size = new Size(88, 20); - TextBox3.TabIndex = 6; - TextBox3.Text = "TextBox3"; - // - // CheckBox1 - // - CheckBox1.ForeColor = Color.Black; - CheckBox1.Location = new Point(72, 16); - CheckBox1.Name = "CheckBox1"; - CheckBox1.Size = new Size(104, 24); - CheckBox1.TabIndex = 5; - CheckBox1.Text = "Crea miniature"; - // - // TabPage2 - // - TabPage2.Controls.Add(GroupBox2); - TabPage2.Location = new Point(4, 22); - TabPage2.Name = "TabPage2"; - TabPage2.Padding = new Padding(3); - TabPage2.Size = new Size(513, 326); - TabPage2.TabIndex = 5; - TabPage2.Text = "Foto"; - TabPage2.UseVisualStyleBackColor = true; - // - // GroupBox2 - // - GroupBox2.Controls.Add(Label45); - GroupBox2.Controls.Add(TextBox32); - GroupBox2.Controls.Add(TextBox26); - GroupBox2.Controls.Add(Label37); - GroupBox2.Controls.Add(Label38); - GroupBox2.Controls.Add(TextBox27); - GroupBox2.Controls.Add(Label39); - GroupBox2.Controls.Add(TextBox28); - GroupBox2.Controls.Add(CheckBox15); - GroupBox2.ForeColor = Color.FromArgb(Conversions.ToInteger(Conversions.ToByte(0)), Conversions.ToInteger(Conversions.ToByte(0)), Conversions.ToInteger(Conversions.ToByte(192))); - GroupBox2.Location = new Point(3, 6); - GroupBox2.Name = "GroupBox2"; - GroupBox2.Size = new Size(304, 156); - GroupBox2.TabIndex = 36; - GroupBox2.TabStop = false; - GroupBox2.Text = "Foto grande"; - // - // Label45 - // - Label45.AutoSize = true; - Label45.Location = new Point(11, 86); - Label45.Name = "Label45"; - Label45.Size = new Size(40, 13); - Label45.TabIndex = 22; - Label45.Text = "Qualità"; - // - // TextBox32 - // - TextBox32.Location = new Point(72, 80); - TextBox32.Name = "TextBox32"; - TextBox32.Size = new Size(72, 20); - TextBox32.TabIndex = 21; - TextBox32.Text = "100"; - // - // TextBox26 - // - TextBox26.Location = new Point(224, 48); - TextBox26.Name = "TextBox26"; - TextBox26.Size = new Size(56, 20); - TextBox26.TabIndex = 20; - TextBox26.Text = "TextBox26"; - // - // Label37 - // - Label37.ForeColor = Color.Black; - Label37.Location = new Point(168, 48); - Label37.Name = "Label37"; - Label37.Size = new Size(48, 16); - Label37.TabIndex = 19; - Label37.Text = "Suffisso"; - Label37.TextAlign = ContentAlignment.MiddleRight; - // - // Label38 - // - Label38.AutoSize = true; - Label38.ForeColor = Color.Black; - Label38.Location = new Point(24, 24); - Label38.Name = "Label38"; - Label38.Size = new Size(41, 13); - Label38.TabIndex = 16; - Label38.Text = "Altezza"; - // - // TextBox27 - // - TextBox27.Location = new Point(72, 24); - TextBox27.Name = "TextBox27"; - TextBox27.Size = new Size(72, 20); - TextBox27.TabIndex = 14; - TextBox27.Text = "TextBox27"; - // - // Label39 - // - Label39.AutoSize = true; - Label39.ForeColor = Color.Black; - Label39.Location = new Point(8, 48); - Label39.Name = "Label39"; - Label39.Size = new Size(56, 13); - Label39.TabIndex = 17; - Label39.Text = "Larghezza"; - // - // TextBox28 - // - TextBox28.Location = new Point(72, 48); - TextBox28.Name = "TextBox28"; - TextBox28.Size = new Size(72, 20); - TextBox28.TabIndex = 15; - TextBox28.Text = "TextBox28"; - // - // CheckBox15 - // - CheckBox15.Checked = true; - CheckBox15.CheckState = CheckState.Checked; - CheckBox15.ForeColor = Color.Black; - CheckBox15.Location = new Point(168, 16); - CheckBox15.Name = "CheckBox15"; - CheckBox15.Size = new Size(120, 32); - CheckBox15.TabIndex = 18; - CheckBox15.Text = "Mantieni dimensioni originali"; - // - // TabPage3 - // - TabPage3.Controls.Add(GroupBox10); - TabPage3.Controls.Add(GroupBox9); - TabPage3.Controls.Add(GroupBox5); - TabPage3.Controls.Add(GroupBox4); - TabPage3.Location = new Point(4, 22); - TabPage3.Name = "TabPage3"; - TabPage3.Padding = new Padding(3); - TabPage3.Size = new Size(513, 326); - TabPage3.TabIndex = 2; - TabPage3.Text = "Testo"; - TabPage3.UseVisualStyleBackColor = true; - // - // GroupBox10 - // - GroupBox10.Controls.Add(Label42); - GroupBox10.Controls.Add(Label41); - GroupBox10.Controls.Add(TextBox31); - GroupBox10.Controls.Add(TextBox30); - GroupBox10.Location = new Point(316, 53); - GroupBox10.Name = "GroupBox10"; - GroupBox10.Size = new Size(186, 73); - GroupBox10.TabIndex = 39; - GroupBox10.TabStop = false; - GroupBox10.Text = "Testo foto verticali"; - // - // Label42 - // - Label42.AutoSize = true; - Label42.Location = new Point(7, 46); - Label42.Name = "Label42"; - Label42.Size = new Size(45, 13); - Label42.TabIndex = 3; - Label42.Text = "Margine"; - // - // Label41 - // - Label41.AutoSize = true; - Label41.Location = new Point(7, 25); - Label41.Name = "Label41"; - Label41.Size = new Size(108, 13); - Label41.TabIndex = 2; - Label41.Text = "Dimensione Carattere"; - // - // TextBox31 - // - TextBox31.Location = new Point(131, 46); - TextBox31.Name = "TextBox31"; - TextBox31.Size = new Size(39, 20); - TextBox31.TabIndex = 1; - // - // TextBox30 - // - TextBox30.Location = new Point(131, 22); - TextBox30.Name = "TextBox30"; - TextBox30.Size = new Size(39, 20); - TextBox30.TabIndex = 0; - // - // GroupBox9 - // - GroupBox9.Controls.Add(CheckBox17); - GroupBox9.Controls.Add(CheckBox16); - GroupBox9.Location = new Point(316, 6); - GroupBox9.Name = "GroupBox9"; - GroupBox9.Size = new Size(186, 45); - GroupBox9.TabIndex = 38; - GroupBox9.TabStop = false; - GroupBox9.Text = "Slide show"; - // - // CheckBox17 - // - CheckBox17.AutoSize = true; - CheckBox17.Location = new Point(96, 18); - CheckBox17.Name = "CheckBox17"; - CheckBox17.Size = new Size(84, 17); - CheckBox17.TabIndex = 1; - CheckBox17.Text = "Numero foto"; - CheckBox17.UseVisualStyleBackColor = true; - // - // CheckBox16 - // - CheckBox16.AutoSize = true; - CheckBox16.Location = new Point(6, 19); - CheckBox16.Name = "CheckBox16"; - CheckBox16.Size = new Size(49, 17); - CheckBox16.TabIndex = 0; - CheckBox16.Text = "Data"; - CheckBox16.UseVisualStyleBackColor = true; - // - // GroupBox5 - // - GroupBox5.Controls.Add(TextBox34); - GroupBox5.Controls.Add(_Button8); - GroupBox5.Controls.Add(Label36); - GroupBox5.Controls.Add(TextBox25); - GroupBox5.Controls.Add(Label35); - GroupBox5.Controls.Add(ComboBox3); - GroupBox5.Controls.Add(TextBox11); - GroupBox5.Controls.Add(Label12); - GroupBox5.Controls.Add(Label11); - GroupBox5.Controls.Add(CheckBox3); - GroupBox5.ForeColor = Color.FromArgb(Conversions.ToInteger(Conversions.ToByte(0)), Conversions.ToInteger(Conversions.ToByte(0)), Conversions.ToInteger(Conversions.ToByte(192))); - GroupBox5.Location = new Point(6, 6); - GroupBox5.Name = "GroupBox5"; - GroupBox5.Size = new Size(304, 120); - GroupBox5.TabIndex = 37; - GroupBox5.TabStop = false; - GroupBox5.Text = "Carattere"; - // - // TextBox34 - // - TextBox34.Location = new Point(160, 91); - TextBox34.Name = "TextBox34"; - TextBox34.Size = new Size(56, 20); - TextBox34.TabIndex = 36; - TextBox34.TextAlign = HorizontalAlignment.Right; - // - // Button8 - // - _Button8.ForeColor = Color.Black; - _Button8.Location = new Point(222, 89); - _Button8.Name = "_Button8"; - _Button8.Size = new Size(74, 24); - _Button8.TabIndex = 35; - _Button8.Text = "Scegli..."; - // - // Label36 - // - Label36.ForeColor = Color.Black; - Label36.Location = new Point(8, 60); - Label36.Name = "Label36"; - Label36.Size = new Size(120, 19); - Label36.TabIndex = 34; - Label36.Text = "Dimensione miniatura"; - Label36.TextAlign = ContentAlignment.MiddleLeft; - // - // TextBox25 - // - TextBox25.Location = new Point(160, 59); - TextBox25.Name = "TextBox25"; - TextBox25.Size = new Size(56, 20); - TextBox25.TabIndex = 33; - TextBox25.Text = "TextBox25"; - // - // Label35 - // - Label35.ForeColor = Color.Black; - Label35.Location = new Point(8, 93); - Label35.Name = "Label35"; - Label35.Size = new Size(72, 16); - Label35.TabIndex = 32; - Label35.Text = "Colore RGB"; - Label35.TextAlign = ContentAlignment.MiddleLeft; - // - // ComboBox3 - // - ComboBox3.Location = new Point(96, 8); - ComboBox3.Name = "ComboBox3"; - ComboBox3.Size = new Size(120, 21); - ComboBox3.TabIndex = 28; - ComboBox3.Text = "ComboBox3"; - // - // TextBox11 - // - TextBox11.Location = new Point(160, 35); - TextBox11.Name = "TextBox11"; - TextBox11.Size = new Size(56, 20); - TextBox11.TabIndex = 27; - TextBox11.Text = "TextBox11"; - // - // Label12 - // - Label12.AutoSize = true; - Label12.ForeColor = Color.Black; - Label12.Location = new Point(8, 38); - Label12.Name = "Label12"; - Label12.Size = new Size(62, 13); - Label12.TabIndex = 26; - Label12.Text = "Dimensione"; - Label12.TextAlign = ContentAlignment.MiddleLeft; - // - // Label11 - // - Label11.AutoSize = true; - Label11.ForeColor = Color.Black; - Label11.Location = new Point(56, 8); - Label11.Name = "Label11"; - Label11.Size = new Size(28, 13); - Label11.TabIndex = 22; - Label11.Text = "Font"; - // - // CheckBox3 - // - CheckBox3.ForeColor = Color.Black; - CheckBox3.Location = new Point(224, 8); - CheckBox3.Name = "CheckBox3"; - CheckBox3.Size = new Size(72, 24); - CheckBox3.TabIndex = 24; - CheckBox3.Text = "Grassetto"; - // - // GroupBox4 - // - GroupBox4.Controls.Add(Label40); - GroupBox4.Controls.Add(TextBox29); - GroupBox4.Controls.Add(TextBox18); - GroupBox4.Controls.Add(Label26); - GroupBox4.Controls.Add(DateTimePicker1); - GroupBox4.Controls.Add(CheckBox8); - GroupBox4.Controls.Add(TextBox9); - GroupBox4.Controls.Add(CheckBox7); - GroupBox4.Controls.Add(Label4); - GroupBox4.Controls.Add(TextBox4); - GroupBox4.Controls.Add(Label9); - GroupBox4.Controls.Add(Label13); - GroupBox4.Controls.Add(ComboBox1); - GroupBox4.Controls.Add(ComboBox2); - GroupBox4.Controls.Add(Label14); - GroupBox4.Controls.Add(TextBox12); - GroupBox4.Controls.Add(Label15); - GroupBox4.ForeColor = Color.FromArgb(Conversions.ToInteger(Conversions.ToByte(0)), Conversions.ToInteger(Conversions.ToByte(0)), Conversions.ToInteger(Conversions.ToByte(192))); - GroupBox4.Location = new Point(6, 132); - GroupBox4.Name = "GroupBox4"; - GroupBox4.Size = new Size(496, 186); - GroupBox4.TabIndex = 36; - GroupBox4.TabStop = false; - GroupBox4.Text = "Testo da applicare"; - // - // Label40 - // - Label40.AutoSize = true; - Label40.Location = new Point(8, 52); - Label40.Name = "Label40"; - Label40.Size = new Size(48, 13); - Label40.TabIndex = 40; - Label40.Text = "Verticale"; - // - // TextBox29 - // - TextBox29.Location = new Point(72, 49); - TextBox29.Multiline = true; - TextBox29.Name = "TextBox29"; - TextBox29.Size = new Size(408, 44); - TextBox29.TabIndex = 39; - // - // TextBox18 - // - TextBox18.Location = new Point(232, 156); - TextBox18.Name = "TextBox18"; - TextBox18.Size = new Size(100, 20); - TextBox18.TabIndex = 38; - // - // Label26 - // - Label26.AutoSize = true; - Label26.ForeColor = Color.Black; - Label26.Location = new Point(344, 156); - Label26.Name = "Label26"; - Label26.Size = new Size(48, 13); - Label26.TabIndex = 37; - Label26.Text = "partenza"; - // - // DateTimePicker1 - // - DateTimePicker1.Format = DateTimePickerFormat.Time; - DateTimePicker1.Location = new Point(392, 156); - DateTimePicker1.Name = "DateTimePicker1"; - DateTimePicker1.Size = new Size(88, 20); - DateTimePicker1.TabIndex = 36; - // - // CheckBox8 - // - CheckBox8.ForeColor = Color.Black; - CheckBox8.Location = new Point(72, 156); - CheckBox8.Name = "CheckBox8"; - CheckBox8.Size = new Size(56, 16); - CheckBox8.TabIndex = 35; - CheckBox8.Text = "Orario"; - // - // TextBox9 - // - TextBox9.Location = new Point(120, 108); - TextBox9.Name = "TextBox9"; - TextBox9.Size = new Size(56, 20); - TextBox9.TabIndex = 20; - TextBox9.Text = "TextBox9"; - // - // CheckBox7 - // - CheckBox7.ForeColor = Color.Black; - CheckBox7.Location = new Point(136, 156); - CheckBox7.Name = "CheckBox7"; - CheckBox7.Size = new Size(88, 16); - CheckBox7.TabIndex = 34; - CheckBox7.Text = "Tempo gara"; - // - // Label4 - // - Label4.AutoSize = true; - Label4.ForeColor = Color.Black; - Label4.Location = new Point(8, 24); - Label4.Name = "Label4"; - Label4.Size = new Size(59, 13); - Label4.TabIndex = 9; - Label4.Text = "Orizzontale"; - // - // TextBox4 - // - TextBox4.Location = new Point(72, 24); - TextBox4.Name = "TextBox4"; - TextBox4.Size = new Size(408, 20); - TextBox4.TabIndex = 8; - TextBox4.Text = "TextBox4"; - // - // Label9 - // - Label9.AutoSize = true; - Label9.ForeColor = Color.Black; - Label9.Location = new Point(8, 108); - Label9.Name = "Label9"; - Label9.Size = new Size(110, 13); - Label9.TabIndex = 19; - Label9.Text = "Trasparenza (0-100%)"; - // - // Label13 - // - Label13.AutoSize = true; - Label13.ForeColor = Color.Black; - Label13.Location = new Point(16, 132); - Label13.Name = "Label13"; - Label13.Size = new Size(52, 13); - Label13.TabIndex = 29; - Label13.Text = "Posizione"; - // - // ComboBox1 - // - ComboBox1.Location = new Point(72, 132); - ComboBox1.Name = "ComboBox1"; - ComboBox1.Size = new Size(104, 21); - ComboBox1.TabIndex = 28; - ComboBox1.Text = "ComboBox1"; - // - // ComboBox2 - // - ComboBox2.Location = new Point(376, 132); - ComboBox2.Name = "ComboBox2"; - ComboBox2.Size = new Size(104, 21); - ComboBox2.TabIndex = 31; - ComboBox2.Text = "ComboBox2"; - // - // Label14 - // - Label14.AutoSize = true; - Label14.ForeColor = Color.Black; - Label14.Location = new Point(304, 132); - Label14.Name = "Label14"; - Label14.Size = new Size(67, 13); - Label14.TabIndex = 30; - Label14.Text = "Allineamento"; - // - // TextBox12 - // - TextBox12.Location = new Point(376, 108); - TextBox12.Name = "TextBox12"; - TextBox12.Size = new Size(104, 20); - TextBox12.TabIndex = 33; - TextBox12.Text = "TextBox12"; - // - // Label15 - // - Label15.AutoSize = true; - Label15.ForeColor = Color.Black; - Label15.Location = new Point(296, 108); - Label15.Name = "Label15"; - Label15.Size = new Size(75, 13); - Label15.TabIndex = 32; - Label15.Text = "Margine (pixel)"; - // - // TabPage5 - // - TabPage5.Controls.Add(GroupBox3); - TabPage5.Controls.Add(GroupBox8); - TabPage5.Controls.Add(GroupBox7); - TabPage5.Location = new Point(4, 22); - TabPage5.Name = "TabPage5"; - TabPage5.Padding = new Padding(3); - TabPage5.Size = new Size(513, 326); - TabPage5.TabIndex = 4; - TabPage5.Text = "Generale"; - TabPage5.UseVisualStyleBackColor = true; - // - // GroupBox3 - // - GroupBox3.Controls.Add(CheckBox6); - GroupBox3.Controls.Add(_Button3); - GroupBox3.Controls.Add(_Button2); - GroupBox3.Controls.Add(Label1); - GroupBox3.Controls.Add(Label2); - GroupBox3.Controls.Add(TextBox1); - GroupBox3.Controls.Add(TextBox2); - GroupBox3.ForeColor = Color.FromArgb(Conversions.ToInteger(Conversions.ToByte(0)), Conversions.ToInteger(Conversions.ToByte(0)), Conversions.ToInteger(Conversions.ToByte(192))); - GroupBox3.Location = new Point(6, 6); - GroupBox3.Name = "GroupBox3"; - GroupBox3.Size = new Size(496, 101); - GroupBox3.TabIndex = 35; - GroupBox3.TabStop = false; - GroupBox3.Text = "Directory"; - // - // CheckBox6 - // - CheckBox6.ForeColor = Color.Black; - CheckBox6.Location = new Point(80, 64); - CheckBox6.Name = "CheckBox6"; - CheckBox6.Size = new Size(152, 24); - CheckBox6.TabIndex = 25; - CheckBox6.Text = "aggiorna le sottodirectory"; - // - // Button3 - // - _Button3.Location = new Point(462, 40); - _Button3.Name = "_Button3"; - _Button3.Size = new Size(24, 20); - _Button3.TabIndex = 6; - _Button3.Text = "..."; - // - // Button2 - // - _Button2.Location = new Point(462, 16); - _Button2.Name = "_Button2"; - _Button2.Size = new Size(24, 20); - _Button2.TabIndex = 5; - _Button2.Text = "..."; - // - // Label1 - // - Label1.AutoSize = true; - Label1.ForeColor = Color.Black; - Label1.Location = new Point(6, 19); - Label1.Name = "Label1"; - Label1.Size = new Size(50, 13); - Label1.TabIndex = 3; - Label1.Text = "Sorgente"; - // - // Label2 - // - Label2.AutoSize = true; - Label2.ForeColor = Color.Black; - Label2.Location = new Point(6, 43); - Label2.Name = "Label2"; - Label2.Size = new Size(68, 13); - Label2.TabIndex = 4; - Label2.Text = "Destinazione"; - // - // TextBox1 - // - TextBox1.Location = new Point(80, 16); - TextBox1.Name = "TextBox1"; - TextBox1.Size = new Size(376, 20); - TextBox1.TabIndex = 0; - TextBox1.Text = "TextBox1"; - // - // TextBox2 - // - TextBox2.Location = new Point(80, 40); - TextBox2.Name = "TextBox2"; - TextBox2.Size = new Size(376, 20); - TextBox2.TabIndex = 1; - TextBox2.Text = "TextBox2"; - // - // GroupBox8 - // - GroupBox8.Controls.Add(RadioButton2); - GroupBox8.Controls.Add(RadioButton1); - GroupBox8.Controls.Add(TextBox21); - GroupBox8.Controls.Add(Label34); - GroupBox8.Controls.Add(TextBox20); - GroupBox8.Controls.Add(Label33); - GroupBox8.Controls.Add(Label31); - GroupBox8.Controls.Add(CheckBox11); - GroupBox8.Controls.Add(TextBox17); - GroupBox8.Controls.Add(Label32); - GroupBox8.ForeColor = Color.FromArgb(Conversions.ToInteger(Conversions.ToByte(0)), Conversions.ToInteger(Conversions.ToByte(0)), Conversions.ToInteger(Conversions.ToByte(192))); - GroupBox8.Location = new Point(204, 113); - GroupBox8.Name = "GroupBox8"; - GroupBox8.Size = new Size(192, 152); - GroupBox8.TabIndex = 47; - GroupBox8.TabStop = false; - GroupBox8.Text = "Sottocartelle"; - // - // RadioButton2 - // - RadioButton2.ForeColor = Color.Black; - RadioButton2.Location = new Point(32, 128); - RadioButton2.Name = "RadioButton2"; - RadioButton2.Size = new Size(136, 16); - RadioButton2.TabIndex = 38; - RadioButton2.Text = "Numerazione files"; - // - // RadioButton1 - // - RadioButton1.Checked = true; - RadioButton1.ForeColor = Color.Black; - RadioButton1.Location = new Point(32, 112); - RadioButton1.Name = "RadioButton1"; - RadioButton1.Size = new Size(152, 16); - RadioButton1.TabIndex = 37; - RadioButton1.TabStop = true; - RadioButton1.Text = "Numerazione progressiva"; - // - // TextBox21 - // - TextBox21.Location = new Point(128, 88); - TextBox21.Name = "TextBox21"; - TextBox21.Size = new Size(56, 20); - TextBox21.TabIndex = 34; - TextBox21.Text = "4"; - // - // Label34 - // - Label34.ForeColor = Color.Black; - Label34.Location = new Point(8, 88); - Label34.Name = "Label34"; - Label34.Size = new Size(112, 16); - Label34.TabIndex = 33; - Label34.Text = "Num. cifre contatore"; - Label34.TextAlign = ContentAlignment.MiddleRight; - // - // TextBox20 - // - TextBox20.Location = new Point(56, 64); - TextBox20.Name = "TextBox20"; - TextBox20.Size = new Size(128, 20); - TextBox20.TabIndex = 32; - TextBox20.Text = "TextBox20"; - // - // Label33 - // - Label33.ForeColor = Color.Black; - Label33.Location = new Point(6, 67); - Label33.Name = "Label33"; - Label33.Size = new Size(48, 16); - Label33.TabIndex = 31; - Label33.Text = "Suffisso"; - // - // Label31 - // - Label31.ForeColor = Color.Black; - Label31.Location = new Point(24, 40); - Label31.Name = "Label31"; - Label31.Size = new Size(32, 16); - Label31.TabIndex = 30; - Label31.Text = "ogni"; - // - // CheckBox11 - // - CheckBox11.ForeColor = Color.Black; - CheckBox11.Location = new Point(56, 16); - CheckBox11.Name = "CheckBox11"; - CheckBox11.Size = new Size(112, 16); - CheckBox11.TabIndex = 29; - CheckBox11.Text = "crea sottocartelle"; - // - // TextBox17 - // - TextBox17.Location = new Point(56, 40); - TextBox17.Name = "TextBox17"; - TextBox17.Size = new Size(64, 20); - TextBox17.TabIndex = 27; - TextBox17.Text = "99"; - // - // Label32 - // - Label32.ForeColor = Color.Black; - Label32.Location = new Point(128, 40); - Label32.Name = "Label32"; - Label32.Size = new Size(24, 16); - Label32.TabIndex = 28; - Label32.Text = "file"; - // - // GroupBox7 - // - GroupBox7.Controls.Add(CheckBox10); - GroupBox7.Controls.Add(CheckBox9); - GroupBox7.ForeColor = Color.FromArgb(Conversions.ToInteger(Conversions.ToByte(0)), Conversions.ToInteger(Conversions.ToByte(0)), Conversions.ToInteger(Conversions.ToByte(192))); - GroupBox7.Location = new Point(6, 113); - GroupBox7.Name = "GroupBox7"; - GroupBox7.Size = new Size(192, 88); - GroupBox7.TabIndex = 45; - GroupBox7.TabStop = false; - GroupBox7.Text = "Generale"; - // - // CheckBox10 - // - CheckBox10.ForeColor = Color.Black; - CheckBox10.Location = new Point(16, 37); - CheckBox10.Name = "CheckBox10"; - CheckBox10.Size = new Size(136, 16); - CheckBox10.TabIndex = 1; - CheckBox10.Text = "Rotazione automatica"; - // - // CheckBox9 - // - CheckBox9.Checked = true; - CheckBox9.CheckState = CheckState.Checked; - CheckBox9.ForeColor = Color.Black; - CheckBox9.Location = new Point(16, 18); - CheckBox9.Name = "CheckBox9"; - CheckBox9.Size = new Size(80, 16); - CheckBox9.TabIndex = 0; - CheckBox9.Text = "Forza Jpg"; - // - // TabControl1 - // - TabControl1.Controls.Add(TabPage5); - TabControl1.Controls.Add(TabPage3); - TabControl1.Controls.Add(TabPage2); - TabControl1.Controls.Add(TabPage1); - TabControl1.Controls.Add(TabPage4); - TabControl1.Location = new Point(12, 12); - TabControl1.Name = "TabControl1"; - TabControl1.SelectedIndex = 0; - TabControl1.Size = new Size(521, 352); - TabControl1.TabIndex = 48; - // - // ProgressBar1 - // - ProgressBar1.Location = new Point(539, 211); - ProgressBar1.Name = "ProgressBar1"; - ProgressBar1.Size = new Size(192, 23); - ProgressBar1.TabIndex = 52; - // - // CheckBox12 - // - _CheckBox12.ForeColor = Color.Black; - _CheckBox12.Location = new Point(10, 19); - _CheckBox12.Name = "_CheckBox12"; - _CheckBox12.Size = new Size(104, 21); - _CheckBox12.TabIndex = 35; - _CheckBox12.Text = "Aggiungi orario"; - // - // CheckBox4 - // - _CheckBox4.ForeColor = Color.Black; - _CheckBox4.Location = new Point(10, 3); - _CheckBox4.Name = "_CheckBox4"; - _CheckBox4.Size = new Size(104, 17); - _CheckBox4.TabIndex = 34; - _CheckBox4.Text = "Aggiungi scritta"; - // - // CheckBox18 - // - _CheckBox18.AutoSize = true; - _CheckBox18.Location = new Point(140, 3); - _CheckBox18.Name = "_CheckBox18"; - _CheckBox18.Size = new Size(84, 17); - _CheckBox18.TabIndex = 36; - _CheckBox18.Text = "Numero foto"; - _CheckBox18.UseVisualStyleBackColor = true; - // - // Panel1 - // - Panel1.Controls.Add(_CheckBox18); - Panel1.Controls.Add(_CheckBox4); - Panel1.Controls.Add(_CheckBox12); - Panel1.Location = new Point(52, 236); - Panel1.Name = "Panel1"; - Panel1.Size = new Size(304, 73); - Panel1.TabIndex = 26; - Panel1.Visible = false; - // - // Form1 - // - AutoScaleBaseSize = new Size(5, 13); - ClientSize = new Size(740, 375); - Controls.Add(ProgressBar1); - Controls.Add(Label44); - Controls.Add(CheckBox22); - Controls.Add(Label43); - Controls.Add(TabControl1); - Controls.Add(Label27); - Controls.Add(_Button7); - Controls.Add(_Button5); - Controls.Add(Label20); - Controls.Add(Label19); - Controls.Add(Label18); - Controls.Add(Label17); - Controls.Add(Label10); - Controls.Add(_Button1); - Controls.Add(_Button6); - MaximizeBox = false; - MaximumSize = new Size(756, 414); - MinimumSize = new Size(756, 414); - Name = "Form1"; - Text = "Image Catalog"; - TabPage4.ResumeLayout(false); - GroupBox6.ResumeLayout(false); - GroupBox6.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)PictureBox2).EndInit(); - ((System.ComponentModel.ISupportInitialize)_PictureBox1).EndInit(); - ((System.ComponentModel.ISupportInitialize)PictureBox3).EndInit(); - TabPage1.ResumeLayout(false); - GroupBox1.ResumeLayout(false); - GroupBox1.PerformLayout(); - Panel2.ResumeLayout(false); - Panel2.PerformLayout(); - TabPage2.ResumeLayout(false); - GroupBox2.ResumeLayout(false); - GroupBox2.PerformLayout(); - TabPage3.ResumeLayout(false); - GroupBox10.ResumeLayout(false); - GroupBox10.PerformLayout(); - GroupBox9.ResumeLayout(false); - GroupBox9.PerformLayout(); - GroupBox5.ResumeLayout(false); - GroupBox5.PerformLayout(); - GroupBox4.ResumeLayout(false); - GroupBox4.PerformLayout(); - TabPage5.ResumeLayout(false); - GroupBox3.ResumeLayout(false); - GroupBox3.PerformLayout(); - GroupBox8.ResumeLayout(false); - GroupBox8.PerformLayout(); - GroupBox7.ResumeLayout(false); - TabControl1.ResumeLayout(false); - Panel1.ResumeLayout(false); - Panel1.PerformLayout(); - ResumeLayout(false); - PerformLayout(); - } - - /* TODO ERROR: Skipped EndRegionDirectiveTrivia */ - /* TODO ERROR: Skipped DefineDirectiveTrivia */ - private bool StopAttivo; - private bool WaterSelectColor = false; - private int ContaFotoCuori; - private PicInfo[] TaskCuori; - private XYThreadPool MyPool = new XYThreadPool(); - private int ContaImmaginiThread; - private const int maxThreads = 15; - - private void setDefaults() - { - TextBox1.Text = ""; - TextBox2.Text = ""; - TextBox3.Text = ""; - TextBox4.Text = ""; - TextBox5.Text = ""; - TextBox6.Text = ""; - TextBox27.Text = ""; - TextBox28.Text = ""; - TextBox9.Text = ""; - TextBox11.Text = ""; - TextBox12.Text = ""; - TextBox13.Text = ""; - TextBox10.Text = ""; - TextBox14.Text = ""; - TextBox15.Text = ""; - TextBox16.Text = ""; - TextBox17.Text = ""; - TextBox19.Text = ""; - TextBox20.Text = ""; - TextBox21.Text = ""; - TextBox25.Text = ""; - TextBox26.Text = ""; - ComboBox1.Items.Add("Alto"); - ComboBox1.Items.Add("Basso"); - ComboBox1.SelectedIndex = 1; - ComboBox2.Items.Add("Sinistra"); - ComboBox2.Items.Add("Centro"); - ComboBox2.Items.Add("Destra"); - ComboBox2.SelectedIndex = 1; - ComboBox3.Items.Add("Arial"); - ComboBox3.Items.Add("Arial Black"); - ComboBox3.Items.Add("Arial Narrow"); - ComboBox3.Items.Add("Comic Sans MS"); - ComboBox3.Items.Add("Courier New"); - ComboBox3.Items.Add("System"); - ComboBox3.Items.Add("Times New Roman"); - ComboBox3.Items.Add("Verdana"); - ComboBox3.Items.Add("Wingdings"); - ComboBox3.SelectedIndex = 7; - ComboBox4.Items.Add("Sinistra"); - ComboBox4.Items.Add("Centro"); - ComboBox4.Items.Add("Destra"); - ComboBox4.SelectedIndex = 2; - ComboBox5.Items.Add("Alto"); - ComboBox5.Items.Add("Centro"); - ComboBox5.Items.Add("Basso"); - ComboBox5.SelectedIndex = 2; - } - - private void Form1_Load(object sender, EventArgs e) - { - Application.EnableVisualStyles(); - setDefaults(); - } - - private void FixPaths() - { - if (TextBox1.Text.EndsWith(@"\") == false) - { - TextBox1.Text += @"\"; - } - - if (TextBox2.Text.EndsWith(@"\") == false) - { - TextBox2.Text += @"\"; - } - } - - private void lockUI() - { - TabControl1.Enabled = false; - Button5.Enabled = false; - Button6.Enabled = false; - Button1.Enabled = false; - } - - private void unlockUI() - { - TabControl1.Enabled = true; - Button5.Enabled = true; - Button6.Enabled = true; - Button1.Enabled = true; - } - - private void btnCreaCatalogo_Click(object sender, EventArgs e) - { - lockUI(); - DateTime timeStart; - DateTime timeStop; - timeStart = DateAndTime.TimeOfDay; - FixPaths(); - Label10.Text = ""; - Label17.Text = "0"; - Label18.Text = "0"; - setPicSettings(TextBox1.Text, TextBox2.Text); - /* TODO ERROR: Skipped IfDirectiveTrivia */ - ProgressBar1.Minimum = 0; - ProgressBar1.Step = 1; - ProgressBar1.Value = 0; - var t1 = new Thread(creaCatalogoThread); - t1.IsBackground = true; - t1.Start(); - - /* TODO ERROR: Skipped ElseDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */ - - - - } - - private void creaCatalogoThread() - { - var timeStart = DateAndTime.TimeOfDay; - MyPool.StopThreadPool(); - MyPool.StartThreadPool(0, maxThreads); - ContaImmaginiThread = 0; - creaImmaginiWithThreadMod(TextBox1.Text, TextBox2.Text); - ThreadPoolWorkItem ThAttivo = null; - int i = 0; - while (i != ContaImmaginiThread) - { - Thread.Sleep(100); - ThAttivo = MyPool.ExtractWorkItem(); - if (ThAttivo is object) - { - i += 1; - // stepProgressBar() - setLabel10Text("File: " + ThAttivo.m_sName); - - // setLabel18Text(ContaImmaginiThread.ToString) - // setLabel18Text(i.ToString) - - - // Label10.Text = "File: " & ThAttivo.m_sName - // Label18.Text = ContaImmaginiThread.ToString - } - } - - MyPool.StopThreadPool(); - var timeStop = DateAndTime.TimeOfDay; - setLabel10Text("Finito"); - setLabel43Text(CalcTime(timeStart, timeStop)); - } - - private void creaCatalogo(DateTime timeStart, DateTime timeStop) - { - // asdfg - MyPool.StopThreadPool(); - MyPool.StartThreadPool(0, maxThreads); - ContaImmaginiThread = 0; - creaImmaginiWithThreadMod(TextBox1.Text, TextBox2.Text); - ThreadPoolWorkItem ThAttivo = null; - int i = 0; - while (i != ContaImmaginiThread) - { - Thread.Sleep(100); - ThAttivo = MyPool.ExtractWorkItem(); - if (ThAttivo is object) - { - i += 1; - Label10.Text = "File: " + ThAttivo.m_sName; - Label18.Text = ContaImmaginiThread.ToString(); - } - } - - MyPool.StopThreadPool(); - timeStop = DateAndTime.TimeOfDay; - CalcTime(timeStart, timeStop); - Label10.Text = "Finito"; - if (CheckBox22.Checked == true) - { - Interaction.Shell(@"%windir%\System32\shutdown.exe"); - } - } - - private string CalcTime(DateTime timeStart, DateTime timeStop) - { - long timediffH, timediffS; - long timediffM; - timediffM = DateAndTime.DateDiff(DateInterval.Minute, timeStart, timeStop); - timediffS = DateAndTime.DateDiff(DateInterval.Second, timeStart, timeStop); - timediffH = DateAndTime.DateDiff(DateInterval.Hour, timeStart, timeStop); - // dim s As String = "H:" + timediffH.ToString + " M:" + timediffM.ToString + " S:" + timediffS.ToString - string s = "S:" + timediffS.ToString(); - // Label43.Text = "H:" + timediffH.ToString + " M:" + timediffM.ToString + " S:" + timediffS.ToString - return s; - } - - private void Button2_Click(object sender, EventArgs e) - { - var DirSearch = new FolderBrowserDialog(); - DirSearch.SelectedPath = TextBox1.Text; - if (DialogResult.OK == DirSearch.ShowDialog()) - { - string DirectoryScelta = DirSearch.SelectedPath; - if (DirectoryScelta.EndsWith(@"\") == false) - { - DirectoryScelta += @"\"; - } - - TextBox1.Text = DirectoryScelta; - } - } - - private void Button3_Click(object sender, EventArgs e) - { - var DirSearch = new FolderBrowserDialog(); - DirSearch.SelectedPath = TextBox2.Text; - if (DialogResult.OK == DirSearch.ShowDialog()) - { - string DirectoryScelta = DirSearch.SelectedPath; - if (DirectoryScelta.EndsWith(@"\") == false) - { - DirectoryScelta += @"\"; - } - - TextBox2.Text = DirectoryScelta; - } - - // Dim openFileDialog As OpenFileDialog = New OpenFileDialog - - // Dim openFileDialog As OpenFileDialog = New OpenFileDialog - - // openFileDialog.InitialDirectory = TextBox1.Text - // openFileDialog.Filter = "Bitmap files (*.bmp)|*.bmp|Jpeg files (*.jpg)|*.jpg|All valid files (*.*)|*.*" - // openFileDialog.FilterIndex = 2 - // openFileDialog.RestoreDirectory = True - - // If DialogResult.OK = openFileDialog.ShowDialog() Then - // Dim IlNome As String = openFileDialog.FileName - // Dim NomeFine As String = "" - // Dim i As Integer - - // Dim Elenco As String() - // Elenco = IlNome.Split(New Char() {"\"c}) - // For i = 0 To Elenco.Length - 1 - // NomeFine &= Elenco(i) & "\" - // Next - - // TextBox1.Text = NomeFine - // End If - } - - private void Button5_Click(object sender, EventArgs e) - { - var SaveFileDlg = new SaveFileDialog(); - - // SaveFileDlg.InitialDirectory = "c:\" - SaveFileDlg.Filter = "Setup (*.xml)|*.xml|All valid files (*.*)|*.*"; - SaveFileDlg.FilterIndex = 0; - SaveFileDlg.RestoreDirectory = true; - if (DialogResult.OK == SaveFileDlg.ShowDialog()) - { - string IlNome = SaveFileDlg.FileName; - Module1.SetupIni.NomeFileSetup = IlNome; - Module1.SetupIni.AggiornaParametro("DirSorgente", TextBox1.Text); - Module1.SetupIni.AggiornaParametro("DirDestinazione", TextBox2.Text); - Module1.SetupIni.AggiornaParametro("DirSottoDirectory", CheckBox6.Checked); - Module1.SetupIni.AggiornaParametro("DirDividiDestinazione", CheckBox11.Checked); - Module1.SetupIni.AggiornaParametro("DirDividiNumFile", TextBox17.Text); - Module1.SetupIni.AggiornaParametro("DirDividiSuffisso", TextBox20.Text); - Module1.SetupIni.AggiornaParametro("DirDividiNumCifre", TextBox21.Text); - if (RadioButton1.Checked == true) - { - Module1.SetupIni.AggiornaParametro("DirDividiTipoNumerazione", "Progressiva"); - } - else - { - Module1.SetupIni.AggiornaParametro("DirDividiTipoNumerazione", "Files"); - } - - Module1.SetupIni.AggiornaParametro("MiniatureCrea", CheckBox1.Checked); - Module1.SetupIni.AggiornaParametro("MiniatureSuffisso", TextBox3.Text); - Module1.SetupIni.AggiornaParametro("MiniatureAltezza", TextBox5.Text); - Module1.SetupIni.AggiornaParametro("MiniatureLarghezza", TextBox6.Text); - Module1.SetupIni.AggiornaParametro("MiniatureAddScritta", RadioButton3.Checked); - Module1.SetupIni.AggiornaParametro("MiniatureAddOrario", RadioButton4.Checked); - Module1.SetupIni.AggiornaParametro("FotoAltezza", TextBox27.Text); - Module1.SetupIni.AggiornaParametro("FotoLarghezza", TextBox28.Text); - Module1.SetupIni.AggiornaParametro("FotoCodice", TextBox13.Text); - Module1.SetupIni.AggiornaParametro("FotoDimOriginali", CheckBox2.Checked); - Module1.SetupIni.AggiornaParametro("FontDimensione", TextBox11.Text); - Module1.SetupIni.AggiornaParametro("FontDimensioneMiniatura", TextBox25.Text); - Module1.SetupIni.AggiornaParametro("FontBold", CheckBox3.Checked); - Module1.SetupIni.AggiornaParametro("FontNome", ComboBox3.Text); - Module1.SetupIni.AggiornaParametro("TestoTesto", TextBox4.Text); - Module1.SetupIni.AggiornaParametro("TestoTrasparente", TextBox9.Text); - Module1.SetupIni.AggiornaParametro("TestoMargine", TextBox12.Text); - Module1.SetupIni.AggiornaParametro("TestoPosizione", ComboBox1.Text); - Module1.SetupIni.AggiornaParametro("TestoAllineamento", ComboBox2.Text); - Module1.SetupIni.AggiornaParametro("MarchioFile", TextBox10.Text); - Module1.SetupIni.AggiornaParametro("MarchioAltezza", TextBox14.Text); - Module1.SetupIni.AggiornaParametro("MarchioLarghezza", TextBox15.Text); - Module1.SetupIni.AggiornaParametro("MarchioMargine", TextBox16.Text); - Module1.SetupIni.AggiornaParametro("MarchioAllOrizzontale", ComboBox4.Text); - Module1.SetupIni.AggiornaParametro("MarchioAllVerticale", ComboBox5.Text); - Module1.SetupIni.AggiornaParametro("MarchioTrasparenza", TextBox19.Text); - Module1.SetupIni.AggiornaParametro("MarchioAggiungi", CheckBox5.Checked); - Module1.SetupIni.AggiornaParametro("TempoGara", CheckBox7.Checked); - Module1.SetupIni.AggiornaParametro("Orario", CheckBox8.Checked); - Module1.SetupIni.AggiornaParametro("EtichettaOrario", TextBox18.Text); - Module1.SetupIni.AggiornaParametro("GeneraleForzaJpg", CheckBox9.Checked); - Module1.SetupIni.AggiornaParametro("GeneraleRotazioneAutomatica", CheckBox10.Checked); - Module1.SetupIni.AggiornaParametro("GrandezzaVerticale", TextBox30.Text); - Module1.SetupIni.AggiornaParametro("MargineVerticale", TextBox31.Text); - Module1.SetupIni.AggiornaParametro("DimensioniOriginali", CheckBox15.Checked); - Module1.SetupIni.AggiornaParametro("TestoVerticale", TextBox29.Text); - Module1.SetupIni.AggiornaParametro("NomeMiniatura", RadioButton6.Checked); - Module1.SetupIni.AggiornaParametro("DataFoto", CheckBox16.Checked); - Module1.SetupIni.AggiornaParametro("NumeroFoto", CheckBox17.Checked); - Module1.SetupIni.AggiornaParametro("ColoreTestoRGB", TextBox34.Text); - Module1.SetupIni.AggiornaParametro("TempoSmall", RadioButton5.Checked); - Module1.SetupIni.AggiornaParametro("NumTempoSmall", RadioButton7.Checked); - Module1.SetupIni.AggiornaParametro("CompressioneJpeg", TextBox32.Text); - Module1.SetupIni.AggiornaParametro("CompressioneJpegMiniatura", TextBox33.Text); - Module1.SetupIni.SalvaParametriSetup(); - Text = "Image Catalog - " + LeggiSoloNomeFile(IlNome); - } - } - - private void Button6_Click(object sender, EventArgs e) - { - var openFileDialog = new OpenFileDialog(); - - // openFileDialog.InitialDirectory = TextBox1.Text - openFileDialog.Filter = "Setup (*.xml)|*.xml|All valid files (*.*)|*.*"; - openFileDialog.FilterIndex = 0; - openFileDialog.RestoreDirectory = true; - if (DialogResult.OK == openFileDialog.ShowDialog()) - { - string IlNome = openFileDialog.FileName; - Module1.SetupIni.NomeFileSetup = IlNome; - Module1.SetupIni.CaricaParametriSetup(); - TextBox1.Text = Module1.SetupIni.LeggiParametroString("DirSorgente"); - TextBox2.Text = Module1.SetupIni.LeggiParametroString("DirDestinazione"); - CheckBox6.Checked = Module1.SetupIni.LeggiParametroBoolean("DirSottoDirectory"); - CheckBox11.Checked = Module1.SetupIni.LeggiParametroBoolean("DirDividiDestinazione"); - TextBox17.Text = Module1.SetupIni.LeggiParametroString("DirDividiNumFile"); - TextBox20.Text = Module1.SetupIni.LeggiParametroString("DirDividiSuffisso"); - TextBox21.Text = Module1.SetupIni.LeggiParametroString("DirDividiNumCifre"); - string TestoTemp = Module1.SetupIni.LeggiParametroString("DirDividiTipoNumerazione"); - if (TestoTemp.ToUpper() == "PROGRESSIVA") - { - RadioButton1.Checked = true; - } - else - { - RadioButton2.Checked = true; - } - - CheckBox1.Checked = Module1.SetupIni.LeggiParametroBoolean("MiniatureCrea"); - TextBox3.Text = Module1.SetupIni.LeggiParametroString("MiniatureSuffisso"); - TextBox5.Text = Module1.SetupIni.LeggiParametroString("MiniatureAltezza"); - TextBox6.Text = Module1.SetupIni.LeggiParametroString("MiniatureLarghezza"); - RadioButton3.Checked = Module1.SetupIni.LeggiParametroBoolean("MiniatureAddScritta"); - RadioButton4.Checked = Module1.SetupIni.LeggiParametroBoolean("MiniatureAddOrario"); - TextBox27.Text = Module1.SetupIni.LeggiParametroString("FotoAltezza"); - TextBox28.Text = Module1.SetupIni.LeggiParametroString("FotoLarghezza"); - TextBox13.Text = Module1.SetupIni.LeggiParametroString("FotoCodice"); - CheckBox2.Checked = Module1.SetupIni.LeggiParametroBoolean("FotoDimOriginali"); - TextBox11.Text = Module1.SetupIni.LeggiParametroString("FontDimensione"); - TextBox25.Text = Module1.SetupIni.LeggiParametroString("FontDimensioneMiniatura"); - CheckBox3.Checked = Module1.SetupIni.LeggiParametroBoolean("FontBold"); - ComboBox3.Text = Module1.SetupIni.LeggiParametroString("FontNome"); - if (string.IsNullOrEmpty(TextBox25.Text)) - { - TextBox25.Text = "0"; - } - - TextBox4.Text = Module1.SetupIni.LeggiParametroString("TestoTesto"); - TextBox9.Text = Module1.SetupIni.LeggiParametroString("TestoTrasparente"); - TextBox12.Text = Module1.SetupIni.LeggiParametroString("TestoMargine"); - ComboBox1.Text = Module1.SetupIni.LeggiParametroString("TestoPosizione"); - ComboBox2.Text = Module1.SetupIni.LeggiParametroString("TestoAllineamento"); - TextBox10.Text = Module1.SetupIni.LeggiParametroString("MarchioFile"); - TextBox14.Text = Module1.SetupIni.LeggiParametroString("MarchioAltezza"); - TextBox15.Text = Module1.SetupIni.LeggiParametroString("MarchioLarghezza"); - TextBox16.Text = Module1.SetupIni.LeggiParametroString("MarchioMargine"); - ComboBox4.Text = Module1.SetupIni.LeggiParametroString("MarchioAllOrizzontale"); - ComboBox5.Text = Module1.SetupIni.LeggiParametroString("MarchioAllVerticale"); - TextBox19.Text = Module1.SetupIni.LeggiParametroString("MarchioTrasparenza"); - CheckBox5.Checked = Module1.SetupIni.LeggiParametroBoolean("MarchioAggiungi"); - CheckBox7.Checked = Module1.SetupIni.LeggiParametroBoolean("TempoGara"); - CheckBox8.Checked = Module1.SetupIni.LeggiParametroBoolean("Orario"); - TextBox18.Text = Module1.SetupIni.LeggiParametroString("EtichettaOrario"); - CheckBox9.Checked = Module1.SetupIni.LeggiParametroBoolean("GeneraleForzaJpg"); - CheckBox10.Checked = Module1.SetupIni.LeggiParametroBoolean("GeneraleRotazioneAutomatica"); - TextBox30.Text = Module1.SetupIni.LeggiParametroString("GrandezzaVerticale"); - TextBox31.Text = Module1.SetupIni.LeggiParametroString("MargineVerticale"); - CheckBox15.Checked = Module1.SetupIni.LeggiParametroBoolean("DimensioniOriginali"); - TextBox29.Text = Module1.SetupIni.LeggiParametroString("TestoVerticale"); - RadioButton6.Checked = Module1.SetupIni.LeggiParametroBoolean("NomeMiniatura"); - CheckBox16.Checked = Module1.SetupIni.LeggiParametroBoolean("DataFoto"); - CheckBox17.Checked = Module1.SetupIni.LeggiParametroBoolean("NumeroFoto"); - RadioButton5.Checked = Module1.SetupIni.LeggiParametroBoolean("TempoSmall"); - RadioButton7.Checked = Module1.SetupIni.LeggiParametroBoolean("NumTempoSmall"); - TextBox32.Text = Module1.SetupIni.LeggiParametroString("CompressioneJpeg"); - TextBox33.Text = Module1.SetupIni.LeggiParametroString("CompressioneJpegMiniatura"); - TextBox34.Text = Module1.SetupIni.LeggiParametroString("ColoreTestoRGB"); - if (File.Exists(TextBox10.Text)) - { - PictureBox1.Image = Image.FromFile(TextBox10.Text); - if (PictureBox1.Image.Height >= PictureBox1.Image.Width) - { - PictureBox1.Height = 160; - PictureBox1.Width = Conversions.ToInteger(160 * PictureBox1.Image.Width / (double)PictureBox1.Image.Height); - } - else - { - PictureBox1.Width = 224; - PictureBox1.Height = Conversions.ToInteger(224 * PictureBox1.Image.Height / (double)PictureBox1.Image.Width); - } - } - - Text = "Image Catalog - " + LeggiSoloNomeFile(IlNome); - } - } - - private void setPicSettings(string SourcePath, string DestPath) - { - var SourceDir = new DirectoryInfo(SourcePath); - var DestDirStart = new DirectoryInfo(DestPath); - DirectoryInfo DestDir = null; - PicSettings.DirectorySorgente = TextBox1.Text; - PicSettings.DirectoryDestinazione = TextBox2.Text; - - // PicSettings.DestDir = DestDir - // PicSettings.SourceDir = SourceDir - // PicSettings.DestDirStart = DestDirStart - - PicSettings.DimStandard = Conversions.ToInteger(TextBox11.Text); - PicSettings.DimStandardMiniatura = Conversions.ToInteger(TextBox25.Text); - PicSettings.UsaOrarioMiniatura = CheckBox12.Checked; - PicSettings.UsaOrarioTestoApplicare = CheckBox8.Checked; - PicSettings.UsaTempoGaraTestoApplicare = CheckBox7.Checked; - PicSettings.UsaRotazioneAutomatica = CheckBox10.Checked; - PicSettings.UsaForzaJpg = CheckBox9.Checked; - if (CheckBox17.Checked) - { - PicSettings.TestoNome = true; - } - else - { - PicSettings.TestoNome = false; - } - - if (CheckBox16.Checked) - { - PicSettings.NomeData = true; - } - else - { - PicSettings.NomeData = false; - } - - PicSettings.TestoFirmaStart = TextBox4.Text; - PicSettings.TestoFirmaStartV = TextBox29.Text; - PicSettings.DataPartenza = DateTimePicker1.Value; - PicSettings.TestoOrario = TextBox18.Text; - PicSettings.AltezzaSmall = Conversions.ToInteger(TextBox5.Text); - PicSettings.LarghezzaSmall = Conversions.ToInteger(TextBox5.Text); - PicSettings.CreaMiniature = CheckBox1.Checked; - PicSettings.AggiungiScritteMiniature = RadioButton3.Checked; - PicSettings.AggTempoGaraMin = RadioButton5.Checked; - PicSettings.AggNumTempMin = RadioButton7.Checked; - PicSettings.DimVert = Conversions.ToInteger(TextBox30.Text); - PicSettings.MargVert = Conversions.ToInteger(TextBox31.Text); - - // PicSettings.NomeFileChild = childFile.Name - PicSettings.Suffisso = TextBox3.Text; - PicSettings.Codice = TextBox13.Text; - PicSettings.Trasparenza = Conversions.ToInteger(TextBox9.Text); - PicSettings.IlFont = ComboBox3.SelectedItem.ToString(); - PicSettings.Grassetto = CheckBox3.Checked; - PicSettings.Posizione = ComboBox1.SelectedItem.ToString(); - PicSettings.Allineamento = ComboBox2.SelectedItem.ToString(); - PicSettings.Margine = Conversions.ToInteger(TextBox12.Text); - PicSettings.LogoAltezza = Conversions.ToInteger(TextBox14.Text); - PicSettings.LogoLarghezza = Conversions.ToInteger(TextBox15.Text); - PicSettings.fontColoreRGB = ColorTranslator.FromHtml(TextBox34.Text); - PicSettings.LogoAggiungi = CheckBox5.Checked; - PicSettings.LogoNomeFile = TextBox10.Text; - PicSettings.LogoTrasparenza = TextBox19.Text; - PicSettings.LogoMargine = TextBox16.Text; - PicSettings.LogoPosizioneH = ComboBox4.Text; - PicSettings.LogoPosizioneV = ComboBox5.Text; - PicSettings.FotoGrandeDimOrigina = CheckBox15.Checked; - PicSettings.AltezzaBig = Conversions.ToInteger(TextBox27.Text); - PicSettings.LarghezzaBig = Conversions.ToInteger(TextBox28.Text); - PicSettings.DimMin = Conversions.ToInteger(TextBox25.Text); - PicSettings.TestoMin = RadioButton6.Checked; - PicSettings.jpegQuality = Conversions.ToLong(TextBox32.Text); - PicSettings.jpegQualityMin = Conversions.ToLong(TextBox33.Text); - - // PicSettings.mainForm = Me - - - } - - private List> makeFilesList(string SourcePath) - { - var SourceDir = new DirectoryInfo(SourcePath); - DirectoryInfo DestDir = null; - int NumFileXDir = Conversions.ToInteger(TextBox17.Text); - string SuffixDir = TextBox20.Text; - int NumCifreDir = Conversions.ToInteger(TextBox21.Text); - bool DividiFile = false; - StopAttivo = false; - int FileConta = 0; - int ContaFileXDir = 0; - int ContaDirXDir = 0; - string TestoTemp = ""; - int ContaTemp = 0; - var picList = new List(); - var dirList = new List>(); - - - // controlla directory principale - // Dim childFile As FileInfo - // For Each childFile In SourceDir.GetFiles("*.jpg") - // picList.Add(childFile) - // Next - - picList = getFiles(SourceDir); - dirList.Add(picList); - - // controlla sottodirectory - if (CheckBox6.Checked == true) - { - foreach (var subDir in SourceDir.GetDirectories()) - { - var filesList = new List(); - filesList = getFiles(subDir); - dirList.Add(filesList); - } - } - - return dirList; - } - - private List getFiles(DirectoryInfo sourceDir) - { - var picList = new List(); - foreach (var childFile in sourceDir.GetFiles("*.jpg")) - picList.Add(childFile); - return picList; - } - - private List> dividiLista(string SourcePath, List> lista) - { - var SourceDir = new DirectoryInfo(SourcePath); - int NumFileXDir = Conversions.ToInteger(TextBox17.Text); - string SuffixDir = TextBox20.Text; - int NumCifreDir = Conversions.ToInteger(TextBox21.Text); - bool DividiFile = false; - int FileConta = 0; - int ContaFileXDir = 0; - int ContaDirXDir = 0; - string TestoTemp = ""; - int ContaTemp = 0; - if (NumFileXDir > 0 & CheckBox11.Checked == true) - { - if (FileConta > NumFileXDir) - { - DividiFile = true; - } - else - { - } - } - - return default; - } - - private void setLabel17Text(string text) - { - if (Label17.InvokeRequired) - { - Label17.Invoke(new Action(setLabel17Text), text); - } - else - { - Label17.Text = text; - } - } - - public void stepProgressBar() - { - if (ProgressBar1.InvokeRequired) - { - ProgressBar1.Invoke(new MethodInvoker(ProgressBar1.PerformStep)); - } - else - { - ProgressBar1.PerformStep(); - } - - setLabel18Text(ProgressBar1.Value.ToString()); - } - - private void setLabel10Text(string text) - { - if (Label10.InvokeRequired) - { - Label10.Invoke(new Action(setLabel10Text), text); - } - else - { - Label10.Text = text; - } - } - - private void setProgressBarMaximum(int value) - { - if (ProgressBar1.InvokeRequired) - { - ProgressBar1.Invoke(new Action(setProgressBarMaximum), (object)value); - } - else - { - ProgressBar1.Maximum = value; - } - } - - private void setProgressBarValue(int value) - { - if (ProgressBar1.InvokeRequired) - { - ProgressBar1.Invoke(new Action(setProgressBarValue), (object)value); - } - else - { - ProgressBar1.Value = value; - } - } - - private void setLabel18Text(string text) - { - if (Label18.InvokeRequired) - { - Label18.Invoke(new Action(setLabel18Text), text); - } - else - { - Label18.Text = text; - } - } - - private void setLabel43Text(string text) - { - if (Label43.InvokeRequired) - { - Label43.Invoke(new Action(setLabel43Text), text); - } - else - { - Label43.Text = text; - } - } - - private void creaImmaginiWithThreadMod(string SourcePath, string DestPath) - { - var SourceDir = new DirectoryInfo(SourcePath); - var DestDirStart = new DirectoryInfo(DestPath); - DirectoryInfo DestDir = null; - int NumFileXDir = Conversions.ToInteger(TextBox17.Text); - string SuffixDir = TextBox20.Text; - int NumCifreDir = Conversions.ToInteger(TextBox21.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 - string a = (Conversions.ToInteger(Label17.Text) + FileConta).ToString(); - setLabel17Text(a); - setProgressBarMaximum(Conversions.ToInteger(a)); - if (NumFileXDir > 0 & CheckBox11.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 = (Conversions.ToInteger(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 (RadioButton1.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 ImageCreator(); - 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 (CheckBox6.Checked == true) - { - foreach (var subDir in SourceDir.GetDirectories()) - creaImmaginiWithThreadMod(subDir.FullName, Path.Combine(DestDir.FullName, subDir.Name)); - } - } - } - - // 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 = Conversions.ToInteger(TextBox17.Text); - string SuffixDir = TextBox20.Text; - int NumCifreDir = Conversions.ToInteger(TextBox21.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 = (Conversions.ToInteger(Label17.Text) + FileConta).ToString(); - if (NumFileXDir > 0 & CheckBox11.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 (RadioButton1.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 = TextBox1.Text; - ClsCreaImmagine.DirectoryDestinazione = TextBox2.Text; - ClsCreaImmagine.DestDir = DestDir; - ClsCreaImmagine.SourceDir = SourceDir; - ClsCreaImmagine.DestDirStart = DestDirStart; - ClsCreaImmagine.DimStandard = Conversions.ToInteger(TextBox11.Text); - ClsCreaImmagine.DimStandardMiniatura = Conversions.ToInteger(TextBox25.Text); - ClsCreaImmagine.UsaOrarioMiniatura = CheckBox12.Checked; - ClsCreaImmagine.UsaOrarioTestoApplicare = CheckBox8.Checked; - ClsCreaImmagine.UsaTempoGaraTestoApplicare = CheckBox7.Checked; - ClsCreaImmagine.UsaRotazioneAutomatica = CheckBox10.Checked; - ClsCreaImmagine.UsaForzaJpg = CheckBox9.Checked; - if (CheckBox17.Checked) - { - ClsCreaImmagine.TestoNome = true; - } - else - { - ClsCreaImmagine.TestoNome = false; - } - - if (CheckBox16.Checked) - { - ClsCreaImmagine.NomeData = true; - } - else - { - ClsCreaImmagine.NomeData = false; - } - - ClsCreaImmagine.TestoFirmaStart = TextBox4.Text; - ClsCreaImmagine.TestoFirmaStartV = TextBox29.Text; - ClsCreaImmagine.DataPartenza = DateTimePicker1.Value; - ClsCreaImmagine.TestoOrario = TextBox18.Text; - ClsCreaImmagine.AltezzaSmall = Conversions.ToInteger(TextBox5.Text); - ClsCreaImmagine.LarghezzaSmall = Conversions.ToInteger(TextBox5.Text); - ClsCreaImmagine.CreaMiniature = CheckBox1.Checked; - ClsCreaImmagine.AggiungiScritteMiniature = RadioButton3.Checked; - ClsCreaImmagine.AggTempoGaraMin = RadioButton5.Checked; - ClsCreaImmagine.AggNumTempMin = RadioButton7.Checked; - ClsCreaImmagine.DimVert = Conversions.ToInteger(TextBox30.Text); - ClsCreaImmagine.MargVert = Conversions.ToInteger(TextBox31.Text); - ClsCreaImmagine.NomeFileChild = childFile.Name; - ClsCreaImmagine.Suffisso = TextBox3.Text; - ClsCreaImmagine.Codice = TextBox13.Text; - ClsCreaImmagine.Trasparenza = Conversions.ToInteger(TextBox9.Text); - ClsCreaImmagine.IlFont = ComboBox3.SelectedItem.ToString(); - ClsCreaImmagine.Grassetto = CheckBox3.Checked; - ClsCreaImmagine.Posizione = ComboBox1.SelectedItem.ToString(); - ClsCreaImmagine.Allineamento = ComboBox2.SelectedItem.ToString(); - ClsCreaImmagine.Margine = Conversions.ToInteger(TextBox12.Text); - ClsCreaImmagine.LogoAltezza = Conversions.ToInteger(TextBox14.Text); - ClsCreaImmagine.LogoLarghezza = Conversions.ToInteger(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 = Conversions.ToInteger(TextBox27.Text); - ClsCreaImmagine.LarghezzaBig = Conversions.ToInteger(TextBox28.Text); - ClsCreaImmagine.DimMin = Conversions.ToInteger(TextBox25.Text); - ClsCreaImmagine.TestoMin = RadioButton6.Checked; - ClsCreaImmagine.jpegQuality = Conversions.ToLong(TextBox32.Text); - ClsCreaImmagine.jpegQuality = Conversions.ToLong(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 (CheckBox6.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) - { - var SourceDir = new DirectoryInfo(SourcePath); - var DestDir = new DirectoryInfo(DestPath); - if (SourceDir.Exists) - { - if (!DestDir.Exists) - { - DestDir.Create(); - // copy all the files of the current directory - } - - foreach (var childFile in SourceDir.GetFiles()) - { - if (OverWrite) - { - childFile.CopyTo(Path.Combine(DestDir.FullName, childFile.Name), true); - } - // if overwrite = false, copy the file only if it does not exist - // this is done to avoid an IOException if a file already exists - // this way the other files can be copied anyway... - else if (!File.Exists(Path.Combine(DestDir.FullName, childFile.Name))) - { - childFile.CopyTo(Path.Combine(DestDir.FullName, childFile.Name), false); - } - // copy all the sub-directories by recursively calling this same routine - } - - foreach (var subDir in SourceDir.GetDirectories()) - CopyDirectoryFile(subDir.FullName, Path.Combine(DestDir.FullName, subDir.Name), OverWrite); - } - } - - public Size NewthumbSize(int currentwidth, int currentheight, int MaxPixel, string TipoSize) - { - // Calculate the Size of the New image - // *** Larghezza, Altezza, Auto - - double tempMultiplier; - if ((TipoSize.ToUpper() ?? "") == ("Larghezza".ToUpper() ?? "")) - { - tempMultiplier = MaxPixel / (double)currentwidth; - } - else if ((TipoSize.ToUpper() ?? "") == ("Altezza".ToUpper() ?? "")) - { - tempMultiplier = MaxPixel / (double)currentheight; - } - else if (currentheight > currentwidth) // portrait - { - tempMultiplier = MaxPixel / (double)currentheight; - } - else - { - tempMultiplier = MaxPixel / (double)currentwidth; - } - - var NewSize = new Size((int)Math.Round(currentwidth * tempMultiplier), (int)Math.Round(currentheight * tempMultiplier)); - return NewSize; - } - - private void Button7_Click(object sender, EventArgs e) - { - StopAttivo = true; - MyPool.StopThreadPool(); - unlockUI(); - } - - private void Button4_Click(object sender, EventArgs e) - { - var openFileDialog = new OpenFileDialog(); - - // openFileDialog.InitialDirectory = TextBox1.Text - openFileDialog.Filter = "Immagini jpg (*.jpg)|*.jpg|Immagini gif (*.gif)|*.gif|Tutti i file (*.*)|*.*"; - if (TextBox10.Text.Length > 0) - { - openFileDialog.FileName = TextBox10.Text; - } - - openFileDialog.FilterIndex = 0; - openFileDialog.RestoreDirectory = true; - if (DialogResult.OK == openFileDialog.ShowDialog()) - { - TextBox10.Text = openFileDialog.FileName; - PictureBox1.Image = Image.FromFile(TextBox10.Text); - if (PictureBox1.Image.Height >= PictureBox1.Image.Width) - { - PictureBox1.Height = 160; - PictureBox1.Width = Conversions.ToInteger(160 * PictureBox1.Image.Width / (double)PictureBox1.Image.Height); - } - else - { - PictureBox1.Width = 224; - PictureBox1.Height = Conversions.ToInteger(224 * PictureBox1.Image.Height / (double)PictureBox1.Image.Width); - } - } - } - - private string LeggiSoloNomeFile(string FileName) - { - string Testo = FileName; - string Risposta = ""; - var Nomi = Testo.Split(new char[] { '\\' }); - if (Nomi.Length > 1) - { - Risposta = Nomi[Nomi.Length - 1]; - } - - return Risposta; - } - - private void PictureBox1_MouseMove(object sender, MouseEventArgs e) - { - // GetColor() - // GetPixelColor(PictureBox1.PointToScreen(e.Location)).ToArgb.ToString("X8") - - } - - private void PictureBox1_MouseUp(object sender, MouseEventArgs e) - { - if (e.Button == MouseButtons.Left) - { - WaterSelectColor = true; - } - else - { - WaterSelectColor = false; - } - } - - - // 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 - - - // ''' - // ''' Get the color relative to mouse position - // ''' - // 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) - { - // Dim bm As New Bitmap(1, 1, Imaging.PixelFormat.Format24bppRgb) - // Dim g As Graphics = Graphics.FromImage(bm) - // g.CopyFromScreen(screenLocation, New Point(0, 0), New Size(1, 1)) - // Dim result As Color = bm.GetPixel(0, 0) - // g.Dispose() - // bm.Dispose() - // Return result - return null; - } - - private void Button8_Click(object sender, EventArgs e) - { - var MyDialog = new ColorDialog(); - MyDialog.AllowFullOpen = true; - // If TextBox22.Text.Length > 0 And TextBox23.Text.Length > 0 And TextBox24.Text.Length > 0 Then - // If CType(TextBox22.Text, Integer) >= 0 And CType(TextBox23.Text, Integer) >= 0 And CType(TextBox24.Text, Integer) >= 0 Then - // MyDialog.Color = Color.FromArgb(0, CType(TextBox22.Text, Integer), CType(TextBox23.Text, Integer), CType(TextBox24.Text, Integer)) - // End If - // End If - - if (MyDialog.ShowDialog() == DialogResult.OK) - { - // TextBox22.Text = MyDialog.Color.R.ToString - // TextBox23.Text = MyDialog.Color.G.ToString - // TextBox24.Text = MyDialog.Color.B.ToString - TextBox34.Text = ColorTranslator.ToHtml(MyDialog.Color); - TextBox34.BackColor = MyDialog.Color; - } - } - - private void TextBox27_TextChanged(object sender, EventArgs e) - { - } - - private void CheckBox18_CheckedChanged(object sender, EventArgs e) - { - CheckBox4.Checked = false; - CheckBox12.Checked = false; - } - - private void CheckBox4_CheckedChanged(object sender, EventArgs e) - { - CheckBox18.Checked = false; - } - - private void CheckBox12_CheckedChanged(object sender, EventArgs e) - { - CheckBox18.Checked = false; - } - } - - public class PicInfoold - { - public DirectoryInfo DirSource, DirDest, DirDestStart; - public string NomeImmagine; - - public PicInfoold(DirectoryInfo Dir_Source, DirectoryInfo Dir_Dest, DirectoryInfo Dir_DestStart, string Nome_Immagine) - { - DirSource = Dir_Source; - DirDest = Dir_Dest; - DirDestStart = Dir_DestStart; - NomeImmagine = Nome_Immagine; - } - } -} \ No newline at end of file diff --git a/imagecatalog/Form1.resx b/imagecatalog/Form1.resx deleted file mode 100644 index d58980a..0000000 --- a/imagecatalog/Form1.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/imagecatalog/Form1.vb b/imagecatalog/Form1.vb deleted file mode 100644 index 5c4aae6..0000000 --- a/imagecatalog/Form1.vb +++ /dev/null @@ -1,2946 +0,0 @@ -Imports System.IO -Imports System.Drawing.Drawing2D -Imports System.Drawing.Imaging -Imports System.Threading -Imports System.Collections.Generic -Imports CatalogVbLib - -Public Delegate Sub XyThreadAddold(ByVal Info As String) - -Public Class Form1 - Inherits System.Windows.Forms.Form - -#Region " Windows Form Designer generated code " - - Public Sub New() - MyBase.New() - - 'This call is required by the Windows Form Designer. - InitializeComponent() - - 'Add any initialization after the InitializeComponent() call - - End Sub - - 'Form overrides dispose to clean up the component list. - Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) - If disposing Then - If Not (components Is Nothing) Then - components.Dispose() - End If - End If - MyBase.Dispose(disposing) - End Sub - - 'Required by the Windows Form Designer - Private components As System.ComponentModel.IContainer - - 'NOTE: The following procedure is required by the Windows Form Designer - 'It can be modified using the Windows Form Designer. - 'Do not modify it using the code editor. - Friend WithEvents Button1 As System.Windows.Forms.Button - Friend WithEvents Label10 As System.Windows.Forms.Label - Friend WithEvents Label17 As System.Windows.Forms.Label - Friend WithEvents Label18 As System.Windows.Forms.Label - Friend WithEvents Label19 As System.Windows.Forms.Label - Friend WithEvents Label20 As System.Windows.Forms.Label - Friend WithEvents Button6 As System.Windows.Forms.Button - Friend WithEvents Button5 As System.Windows.Forms.Button - Friend WithEvents Button7 As System.Windows.Forms.Button - Friend WithEvents Label27 As System.Windows.Forms.Label - Friend WithEvents TextBox13 As System.Windows.Forms.TextBox - Friend WithEvents Label16 As System.Windows.Forms.Label - Friend WithEvents Label7 As System.Windows.Forms.Label - Friend WithEvents TextBox7 As System.Windows.Forms.TextBox - Friend WithEvents Label8 As System.Windows.Forms.Label - Friend WithEvents TextBox8 As System.Windows.Forms.TextBox - Friend WithEvents CheckBox2 As System.Windows.Forms.CheckBox - Friend WithEvents Label43 As System.Windows.Forms.Label - Friend WithEvents CheckBox22 As System.Windows.Forms.CheckBox - Friend WithEvents TabPage4 As System.Windows.Forms.TabPage - Friend WithEvents GroupBox6 As System.Windows.Forms.GroupBox - Friend WithEvents PictureBox2 As System.Windows.Forms.PictureBox - Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox - Friend WithEvents ComboBox5 As System.Windows.Forms.ComboBox - Friend WithEvents ComboBox4 As System.Windows.Forms.ComboBox - Friend WithEvents TextBox19 As System.Windows.Forms.TextBox - Friend WithEvents Label28 As System.Windows.Forms.Label - Friend WithEvents CheckBox5 As System.Windows.Forms.CheckBox - Friend WithEvents TextBox15 As System.Windows.Forms.TextBox - Friend WithEvents TextBox14 As System.Windows.Forms.TextBox - Friend WithEvents Label25 As System.Windows.Forms.Label - Friend WithEvents TextBox16 As System.Windows.Forms.TextBox - Friend WithEvents Label24 As System.Windows.Forms.Label - Friend WithEvents Label22 As System.Windows.Forms.Label - Friend WithEvents Label23 As System.Windows.Forms.Label - Friend WithEvents Button4 As System.Windows.Forms.Button - Friend WithEvents TextBox10 As System.Windows.Forms.TextBox - Friend WithEvents Label29 As System.Windows.Forms.Label - Friend WithEvents Label30 As System.Windows.Forms.Label - Friend WithEvents PictureBox3 As System.Windows.Forms.PictureBox - Friend WithEvents TabPage1 As System.Windows.Forms.TabPage - Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox - Friend WithEvents Panel2 As System.Windows.Forms.Panel - Friend WithEvents RadioButton3 As System.Windows.Forms.RadioButton - Friend WithEvents RadioButton7 As System.Windows.Forms.RadioButton - Friend WithEvents RadioButton4 As System.Windows.Forms.RadioButton - Friend WithEvents RadioButton6 As System.Windows.Forms.RadioButton - Friend WithEvents RadioButton5 As System.Windows.Forms.RadioButton - Friend WithEvents Label5 As System.Windows.Forms.Label - Friend WithEvents TextBox5 As System.Windows.Forms.TextBox - Friend WithEvents Label6 As System.Windows.Forms.Label - Friend WithEvents TextBox6 As System.Windows.Forms.TextBox - Friend WithEvents Label3 As System.Windows.Forms.Label - Friend WithEvents TextBox3 As System.Windows.Forms.TextBox - Friend WithEvents CheckBox1 As System.Windows.Forms.CheckBox - Friend WithEvents TabPage2 As System.Windows.Forms.TabPage - Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox - Friend WithEvents TextBox26 As System.Windows.Forms.TextBox - Friend WithEvents Label37 As System.Windows.Forms.Label - Friend WithEvents Label38 As System.Windows.Forms.Label - Friend WithEvents TextBox27 As System.Windows.Forms.TextBox - Friend WithEvents Label39 As System.Windows.Forms.Label - Friend WithEvents TextBox28 As System.Windows.Forms.TextBox - Friend WithEvents CheckBox15 As System.Windows.Forms.CheckBox - Friend WithEvents TabPage3 As System.Windows.Forms.TabPage - Friend WithEvents GroupBox10 As System.Windows.Forms.GroupBox - Friend WithEvents Label42 As System.Windows.Forms.Label - Friend WithEvents Label41 As System.Windows.Forms.Label - Friend WithEvents TextBox31 As System.Windows.Forms.TextBox - Friend WithEvents TextBox30 As System.Windows.Forms.TextBox - Friend WithEvents GroupBox9 As System.Windows.Forms.GroupBox - Friend WithEvents CheckBox17 As System.Windows.Forms.CheckBox - Friend WithEvents CheckBox16 As System.Windows.Forms.CheckBox - Friend WithEvents GroupBox5 As System.Windows.Forms.GroupBox - Friend WithEvents Button8 As System.Windows.Forms.Button - Friend WithEvents Label36 As System.Windows.Forms.Label - Friend WithEvents TextBox25 As System.Windows.Forms.TextBox - Friend WithEvents Label35 As System.Windows.Forms.Label - Friend WithEvents ComboBox3 As System.Windows.Forms.ComboBox - Friend WithEvents TextBox11 As System.Windows.Forms.TextBox - Friend WithEvents Label12 As System.Windows.Forms.Label - Friend WithEvents Label11 As System.Windows.Forms.Label - Friend WithEvents CheckBox3 As System.Windows.Forms.CheckBox - Friend WithEvents GroupBox4 As System.Windows.Forms.GroupBox - Friend WithEvents Label40 As System.Windows.Forms.Label - Friend WithEvents TextBox29 As System.Windows.Forms.TextBox - Friend WithEvents TextBox18 As System.Windows.Forms.TextBox - Friend WithEvents Label26 As System.Windows.Forms.Label - Friend WithEvents DateTimePicker1 As System.Windows.Forms.DateTimePicker - Friend WithEvents CheckBox8 As System.Windows.Forms.CheckBox - Friend WithEvents TextBox9 As System.Windows.Forms.TextBox - Friend WithEvents CheckBox7 As System.Windows.Forms.CheckBox - Friend WithEvents Label4 As System.Windows.Forms.Label - Friend WithEvents TextBox4 As System.Windows.Forms.TextBox - Friend WithEvents Label9 As System.Windows.Forms.Label - Friend WithEvents Label13 As System.Windows.Forms.Label - Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox - Friend WithEvents ComboBox2 As System.Windows.Forms.ComboBox - Friend WithEvents Label14 As System.Windows.Forms.Label - Friend WithEvents TextBox12 As System.Windows.Forms.TextBox - Friend WithEvents Label15 As System.Windows.Forms.Label - Friend WithEvents TabPage5 As System.Windows.Forms.TabPage - Friend WithEvents GroupBox3 As System.Windows.Forms.GroupBox - Friend WithEvents CheckBox6 As System.Windows.Forms.CheckBox - Friend WithEvents Button3 As System.Windows.Forms.Button - Friend WithEvents Button2 As System.Windows.Forms.Button - Friend WithEvents Label1 As System.Windows.Forms.Label - Friend WithEvents Label2 As System.Windows.Forms.Label - Friend WithEvents TextBox1 As System.Windows.Forms.TextBox - Friend WithEvents TextBox2 As System.Windows.Forms.TextBox - Friend WithEvents GroupBox8 As System.Windows.Forms.GroupBox - Friend WithEvents RadioButton2 As System.Windows.Forms.RadioButton - Friend WithEvents RadioButton1 As System.Windows.Forms.RadioButton - Friend WithEvents TextBox21 As System.Windows.Forms.TextBox - Friend WithEvents Label34 As System.Windows.Forms.Label - Friend WithEvents TextBox20 As System.Windows.Forms.TextBox - Friend WithEvents Label33 As System.Windows.Forms.Label - Friend WithEvents Label31 As System.Windows.Forms.Label - Friend WithEvents CheckBox11 As System.Windows.Forms.CheckBox - Friend WithEvents TextBox17 As System.Windows.Forms.TextBox - Friend WithEvents Label32 As System.Windows.Forms.Label - Friend WithEvents GroupBox7 As System.Windows.Forms.GroupBox - Friend WithEvents CheckBox10 As System.Windows.Forms.CheckBox - Friend WithEvents CheckBox9 As System.Windows.Forms.CheckBox - Friend WithEvents TabControl1 As System.Windows.Forms.TabControl - Friend WithEvents Label45 As System.Windows.Forms.Label - Friend WithEvents TextBox32 As System.Windows.Forms.TextBox - Friend WithEvents TextBox33 As System.Windows.Forms.TextBox - Friend WithEvents TextBox34 As System.Windows.Forms.TextBox - Friend WithEvents Label46 As System.Windows.Forms.Label - Friend WithEvents ProgressBar1 As System.Windows.Forms.ProgressBar - Friend WithEvents Panel1 As System.Windows.Forms.Panel - Friend WithEvents CheckBox18 As System.Windows.Forms.CheckBox - Friend WithEvents CheckBox4 As System.Windows.Forms.CheckBox - Friend WithEvents CheckBox12 As System.Windows.Forms.CheckBox - Friend WithEvents Label44 As System.Windows.Forms.Label - Private Sub InitializeComponent() - Me.Button1 = New System.Windows.Forms.Button() - Me.Label10 = New System.Windows.Forms.Label() - Me.Label17 = New System.Windows.Forms.Label() - Me.Label18 = New System.Windows.Forms.Label() - Me.Label19 = New System.Windows.Forms.Label() - Me.Label20 = New System.Windows.Forms.Label() - Me.Button6 = New System.Windows.Forms.Button() - Me.Button5 = New System.Windows.Forms.Button() - Me.Button7 = New System.Windows.Forms.Button() - Me.Label27 = New System.Windows.Forms.Label() - Me.TextBox13 = New System.Windows.Forms.TextBox() - Me.Label16 = New System.Windows.Forms.Label() - Me.Label7 = New System.Windows.Forms.Label() - Me.TextBox7 = New System.Windows.Forms.TextBox() - Me.Label8 = New System.Windows.Forms.Label() - Me.TextBox8 = New System.Windows.Forms.TextBox() - Me.CheckBox2 = New System.Windows.Forms.CheckBox() - Me.Label43 = New System.Windows.Forms.Label() - Me.CheckBox22 = New System.Windows.Forms.CheckBox() - Me.Label44 = New System.Windows.Forms.Label() - Me.TabPage4 = New System.Windows.Forms.TabPage() - Me.GroupBox6 = New System.Windows.Forms.GroupBox() - Me.PictureBox2 = New System.Windows.Forms.PictureBox() - Me.PictureBox1 = New System.Windows.Forms.PictureBox() - Me.ComboBox5 = New System.Windows.Forms.ComboBox() - Me.ComboBox4 = New System.Windows.Forms.ComboBox() - Me.TextBox19 = New System.Windows.Forms.TextBox() - Me.Label28 = New System.Windows.Forms.Label() - Me.CheckBox5 = New System.Windows.Forms.CheckBox() - Me.TextBox15 = New System.Windows.Forms.TextBox() - Me.TextBox14 = New System.Windows.Forms.TextBox() - Me.Label25 = New System.Windows.Forms.Label() - Me.TextBox16 = New System.Windows.Forms.TextBox() - Me.Label24 = New System.Windows.Forms.Label() - Me.Label22 = New System.Windows.Forms.Label() - Me.Label23 = New System.Windows.Forms.Label() - Me.Button4 = New System.Windows.Forms.Button() - Me.TextBox10 = New System.Windows.Forms.TextBox() - Me.Label29 = New System.Windows.Forms.Label() - Me.Label30 = New System.Windows.Forms.Label() - Me.PictureBox3 = New System.Windows.Forms.PictureBox() - Me.TabPage1 = New System.Windows.Forms.TabPage() - Me.GroupBox1 = New System.Windows.Forms.GroupBox() - Me.Label46 = New System.Windows.Forms.Label() - Me.TextBox33 = New System.Windows.Forms.TextBox() - Me.Panel2 = New System.Windows.Forms.Panel() - Me.RadioButton3 = New System.Windows.Forms.RadioButton() - Me.RadioButton7 = New System.Windows.Forms.RadioButton() - Me.RadioButton4 = New System.Windows.Forms.RadioButton() - Me.RadioButton6 = New System.Windows.Forms.RadioButton() - Me.RadioButton5 = New System.Windows.Forms.RadioButton() - Me.Label5 = New System.Windows.Forms.Label() - Me.TextBox5 = New System.Windows.Forms.TextBox() - Me.Label6 = New System.Windows.Forms.Label() - Me.TextBox6 = New System.Windows.Forms.TextBox() - Me.Label3 = New System.Windows.Forms.Label() - Me.TextBox3 = New System.Windows.Forms.TextBox() - Me.CheckBox1 = New System.Windows.Forms.CheckBox() - Me.TabPage2 = New System.Windows.Forms.TabPage() - Me.GroupBox2 = New System.Windows.Forms.GroupBox() - Me.Label45 = New System.Windows.Forms.Label() - Me.TextBox32 = New System.Windows.Forms.TextBox() - Me.TextBox26 = New System.Windows.Forms.TextBox() - Me.Label37 = New System.Windows.Forms.Label() - Me.Label38 = New System.Windows.Forms.Label() - Me.TextBox27 = New System.Windows.Forms.TextBox() - Me.Label39 = New System.Windows.Forms.Label() - Me.TextBox28 = New System.Windows.Forms.TextBox() - Me.CheckBox15 = New System.Windows.Forms.CheckBox() - Me.TabPage3 = New System.Windows.Forms.TabPage() - Me.GroupBox10 = New System.Windows.Forms.GroupBox() - Me.Label42 = New System.Windows.Forms.Label() - Me.Label41 = New System.Windows.Forms.Label() - Me.TextBox31 = New System.Windows.Forms.TextBox() - Me.TextBox30 = New System.Windows.Forms.TextBox() - Me.GroupBox9 = New System.Windows.Forms.GroupBox() - Me.CheckBox17 = New System.Windows.Forms.CheckBox() - Me.CheckBox16 = New System.Windows.Forms.CheckBox() - Me.GroupBox5 = New System.Windows.Forms.GroupBox() - Me.TextBox34 = New System.Windows.Forms.TextBox() - Me.Button8 = New System.Windows.Forms.Button() - Me.Label36 = New System.Windows.Forms.Label() - Me.TextBox25 = New System.Windows.Forms.TextBox() - Me.Label35 = New System.Windows.Forms.Label() - Me.ComboBox3 = New System.Windows.Forms.ComboBox() - Me.TextBox11 = New System.Windows.Forms.TextBox() - Me.Label12 = New System.Windows.Forms.Label() - Me.Label11 = New System.Windows.Forms.Label() - Me.CheckBox3 = New System.Windows.Forms.CheckBox() - Me.GroupBox4 = New System.Windows.Forms.GroupBox() - Me.Label40 = New System.Windows.Forms.Label() - Me.TextBox29 = New System.Windows.Forms.TextBox() - Me.TextBox18 = New System.Windows.Forms.TextBox() - Me.Label26 = New System.Windows.Forms.Label() - Me.DateTimePicker1 = New System.Windows.Forms.DateTimePicker() - Me.CheckBox8 = New System.Windows.Forms.CheckBox() - Me.TextBox9 = New System.Windows.Forms.TextBox() - Me.CheckBox7 = New System.Windows.Forms.CheckBox() - Me.Label4 = New System.Windows.Forms.Label() - Me.TextBox4 = New System.Windows.Forms.TextBox() - Me.Label9 = New System.Windows.Forms.Label() - Me.Label13 = New System.Windows.Forms.Label() - Me.ComboBox1 = New System.Windows.Forms.ComboBox() - Me.ComboBox2 = New System.Windows.Forms.ComboBox() - Me.Label14 = New System.Windows.Forms.Label() - Me.TextBox12 = New System.Windows.Forms.TextBox() - Me.Label15 = New System.Windows.Forms.Label() - Me.TabPage5 = New System.Windows.Forms.TabPage() - Me.GroupBox3 = New System.Windows.Forms.GroupBox() - Me.CheckBox6 = New System.Windows.Forms.CheckBox() - Me.Button3 = New System.Windows.Forms.Button() - Me.Button2 = New System.Windows.Forms.Button() - Me.Label1 = New System.Windows.Forms.Label() - Me.Label2 = New System.Windows.Forms.Label() - Me.TextBox1 = New System.Windows.Forms.TextBox() - Me.TextBox2 = New System.Windows.Forms.TextBox() - Me.GroupBox8 = New System.Windows.Forms.GroupBox() - Me.RadioButton2 = New System.Windows.Forms.RadioButton() - Me.RadioButton1 = New System.Windows.Forms.RadioButton() - Me.TextBox21 = New System.Windows.Forms.TextBox() - Me.Label34 = New System.Windows.Forms.Label() - Me.TextBox20 = New System.Windows.Forms.TextBox() - Me.Label33 = New System.Windows.Forms.Label() - Me.Label31 = New System.Windows.Forms.Label() - Me.CheckBox11 = New System.Windows.Forms.CheckBox() - Me.TextBox17 = New System.Windows.Forms.TextBox() - Me.Label32 = New System.Windows.Forms.Label() - Me.GroupBox7 = New System.Windows.Forms.GroupBox() - Me.CheckBox10 = New System.Windows.Forms.CheckBox() - Me.CheckBox9 = New System.Windows.Forms.CheckBox() - Me.TabControl1 = New System.Windows.Forms.TabControl() - Me.ProgressBar1 = New System.Windows.Forms.ProgressBar() - Me.CheckBox12 = New System.Windows.Forms.CheckBox() - Me.CheckBox4 = New System.Windows.Forms.CheckBox() - Me.CheckBox18 = New System.Windows.Forms.CheckBox() - Me.Panel1 = New System.Windows.Forms.Panel() - Me.TabPage4.SuspendLayout() - Me.GroupBox6.SuspendLayout() - CType(Me.PictureBox2, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.PictureBox3, System.ComponentModel.ISupportInitialize).BeginInit() - Me.TabPage1.SuspendLayout() - Me.GroupBox1.SuspendLayout() - Me.Panel2.SuspendLayout() - Me.TabPage2.SuspendLayout() - Me.GroupBox2.SuspendLayout() - Me.TabPage3.SuspendLayout() - Me.GroupBox10.SuspendLayout() - Me.GroupBox9.SuspendLayout() - Me.GroupBox5.SuspendLayout() - Me.GroupBox4.SuspendLayout() - Me.TabPage5.SuspendLayout() - Me.GroupBox3.SuspendLayout() - Me.GroupBox8.SuspendLayout() - Me.GroupBox7.SuspendLayout() - Me.TabControl1.SuspendLayout() - Me.Panel1.SuspendLayout() - Me.SuspendLayout() - ' - 'Button1 - ' - Me.Button1.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Button1.Location = New System.Drawing.Point(539, 77) - Me.Button1.Name = "Button1" - Me.Button1.Size = New System.Drawing.Size(192, 39) - Me.Button1.TabIndex = 2 - Me.Button1.Text = "crea catalogo" - ' - 'Label10 - ' - Me.Label10.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Label10.Location = New System.Drawing.Point(539, 163) - Me.Label10.Name = "Label10" - Me.Label10.Size = New System.Drawing.Size(192, 72) - Me.Label10.TabIndex = 21 - Me.Label10.Text = "file" - ' - 'Label17 - ' - Me.Label17.AutoSize = True - Me.Label17.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Label17.Location = New System.Drawing.Point(643, 243) - Me.Label17.Name = "Label17" - Me.Label17.Size = New System.Drawing.Size(19, 20) - Me.Label17.TabIndex = 38 - Me.Label17.Text = "0" - ' - 'Label18 - ' - Me.Label18.AutoSize = True - Me.Label18.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Label18.Location = New System.Drawing.Point(643, 262) - Me.Label18.Name = "Label18" - Me.Label18.Size = New System.Drawing.Size(19, 20) - Me.Label18.TabIndex = 39 - Me.Label18.Text = "0" - ' - 'Label19 - ' - Me.Label19.AutoSize = True - Me.Label19.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Label19.Location = New System.Drawing.Point(539, 243) - Me.Label19.Name = "Label19" - Me.Label19.Size = New System.Drawing.Size(80, 16) - Me.Label19.TabIndex = 40 - Me.Label19.Text = "foto totali: " - ' - 'Label20 - ' - Me.Label20.AutoSize = True - Me.Label20.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Label20.Location = New System.Drawing.Point(539, 262) - Me.Label20.Name = "Label20" - Me.Label20.Size = New System.Drawing.Size(104, 16) - Me.Label20.TabIndex = 41 - Me.Label20.Text = "foto generate:" - ' - 'Button6 - ' - Me.Button6.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Button6.Location = New System.Drawing.Point(539, 12) - Me.Button6.Name = "Button6" - Me.Button6.Size = New System.Drawing.Size(192, 32) - Me.Button6.TabIndex = 12 - Me.Button6.Text = "Carica impostazioni" - ' - 'Button5 - ' - Me.Button5.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Button5.Location = New System.Drawing.Point(539, 43) - Me.Button5.Name = "Button5" - Me.Button5.Size = New System.Drawing.Size(192, 32) - Me.Button5.TabIndex = 43 - Me.Button5.Text = "Salva impostazioni" - ' - 'Button7 - ' - Me.Button7.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Button7.Location = New System.Drawing.Point(539, 120) - Me.Button7.Name = "Button7" - Me.Button7.Size = New System.Drawing.Size(192, 40) - Me.Button7.TabIndex = 44 - Me.Button7.Text = "stop creazione" - ' - 'Label27 - ' - Me.Label27.Location = New System.Drawing.Point(591, 346) - Me.Label27.Name = "Label27" - Me.Label27.Size = New System.Drawing.Size(140, 20) - Me.Label27.TabIndex = 46 - Me.Label27.Text = "Versione 2.0 BETA 1" - Me.Label27.TextAlign = System.Drawing.ContentAlignment.MiddleRight - ' - 'TextBox13 - ' - Me.TextBox13.Location = New System.Drawing.Point(224, 48) - Me.TextBox13.Name = "TextBox13" - Me.TextBox13.Size = New System.Drawing.Size(56, 20) - Me.TextBox13.TabIndex = 20 - Me.TextBox13.Text = "TextBox13" - ' - 'Label16 - ' - Me.Label16.ForeColor = System.Drawing.Color.Black - Me.Label16.Location = New System.Drawing.Point(168, 48) - Me.Label16.Name = "Label16" - Me.Label16.Size = New System.Drawing.Size(48, 16) - Me.Label16.TabIndex = 19 - Me.Label16.Text = "Suffisso" - Me.Label16.TextAlign = System.Drawing.ContentAlignment.MiddleRight - ' - 'Label7 - ' - Me.Label7.AutoSize = True - Me.Label7.ForeColor = System.Drawing.Color.Black - Me.Label7.Location = New System.Drawing.Point(24, 24) - Me.Label7.Name = "Label7" - Me.Label7.Size = New System.Drawing.Size(41, 13) - Me.Label7.TabIndex = 16 - Me.Label7.Text = "Altezza" - ' - 'TextBox7 - ' - Me.TextBox7.Location = New System.Drawing.Point(72, 24) - Me.TextBox7.Name = "TextBox7" - Me.TextBox7.Size = New System.Drawing.Size(72, 20) - Me.TextBox7.TabIndex = 14 - Me.TextBox7.Text = "TextBox7" - ' - 'Label8 - ' - Me.Label8.AutoSize = True - Me.Label8.ForeColor = System.Drawing.Color.Black - Me.Label8.Location = New System.Drawing.Point(8, 48) - Me.Label8.Name = "Label8" - Me.Label8.Size = New System.Drawing.Size(56, 13) - Me.Label8.TabIndex = 17 - Me.Label8.Text = "Larghezza" - ' - 'TextBox8 - ' - Me.TextBox8.Location = New System.Drawing.Point(72, 48) - Me.TextBox8.Name = "TextBox8" - Me.TextBox8.Size = New System.Drawing.Size(72, 20) - Me.TextBox8.TabIndex = 15 - Me.TextBox8.Text = "TextBox8" - ' - 'CheckBox2 - ' - Me.CheckBox2.Checked = True - Me.CheckBox2.CheckState = System.Windows.Forms.CheckState.Checked - Me.CheckBox2.ForeColor = System.Drawing.Color.Black - Me.CheckBox2.Location = New System.Drawing.Point(168, 16) - Me.CheckBox2.Name = "CheckBox2" - Me.CheckBox2.Size = New System.Drawing.Size(120, 32) - Me.CheckBox2.TabIndex = 18 - Me.CheckBox2.Text = "Mantieni dimensioni originali" - ' - 'Label43 - ' - Me.Label43.AutoSize = True - Me.Label43.Location = New System.Drawing.Point(651, 303) - Me.Label43.Name = "Label43" - Me.Label43.Size = New System.Drawing.Size(25, 13) - Me.Label43.TabIndex = 49 - Me.Label43.Text = "000" - ' - 'CheckBox22 - ' - Me.CheckBox22.AutoSize = True - Me.CheckBox22.Location = New System.Drawing.Point(539, 326) - Me.CheckBox22.Name = "CheckBox22" - Me.CheckBox22.Size = New System.Drawing.Size(104, 17) - Me.CheckBox22.TabIndex = 50 - Me.CheckBox22.Text = "Arresta il sistema" - Me.CheckBox22.UseVisualStyleBackColor = True - ' - 'Label44 - ' - Me.Label44.AutoSize = True - Me.Label44.Location = New System.Drawing.Point(539, 303) - Me.Label44.Name = "Label44" - Me.Label44.Size = New System.Drawing.Size(106, 13) - Me.Label44.TabIndex = 51 - Me.Label44.Text = "Tempo elaborazione:" - ' - 'TabPage4 - ' - Me.TabPage4.Controls.Add(Me.GroupBox6) - Me.TabPage4.Location = New System.Drawing.Point(4, 22) - Me.TabPage4.Name = "TabPage4" - Me.TabPage4.Padding = New System.Windows.Forms.Padding(3) - Me.TabPage4.Size = New System.Drawing.Size(513, 326) - Me.TabPage4.TabIndex = 3 - Me.TabPage4.Text = "Logo" - Me.TabPage4.UseVisualStyleBackColor = True - ' - 'GroupBox6 - ' - Me.GroupBox6.Controls.Add(Me.PictureBox2) - Me.GroupBox6.Controls.Add(Me.PictureBox1) - Me.GroupBox6.Controls.Add(Me.ComboBox5) - Me.GroupBox6.Controls.Add(Me.ComboBox4) - Me.GroupBox6.Controls.Add(Me.TextBox19) - Me.GroupBox6.Controls.Add(Me.Label28) - Me.GroupBox6.Controls.Add(Me.CheckBox5) - Me.GroupBox6.Controls.Add(Me.TextBox15) - Me.GroupBox6.Controls.Add(Me.TextBox14) - Me.GroupBox6.Controls.Add(Me.Label25) - Me.GroupBox6.Controls.Add(Me.TextBox16) - Me.GroupBox6.Controls.Add(Me.Label24) - Me.GroupBox6.Controls.Add(Me.Label22) - Me.GroupBox6.Controls.Add(Me.Label23) - Me.GroupBox6.Controls.Add(Me.Button4) - Me.GroupBox6.Controls.Add(Me.TextBox10) - Me.GroupBox6.Controls.Add(Me.Label29) - Me.GroupBox6.Controls.Add(Me.Label30) - Me.GroupBox6.Controls.Add(Me.PictureBox3) - Me.GroupBox6.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer)) - Me.GroupBox6.Location = New System.Drawing.Point(6, 6) - Me.GroupBox6.Name = "GroupBox6" - Me.GroupBox6.Size = New System.Drawing.Size(496, 224) - Me.GroupBox6.TabIndex = 42 - Me.GroupBox6.TabStop = False - Me.GroupBox6.Text = "Logo" - ' - 'PictureBox2 - ' - Me.PictureBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle - Me.PictureBox2.Location = New System.Drawing.Point(144, 192) - Me.PictureBox2.Name = "PictureBox2" - Me.PictureBox2.Size = New System.Drawing.Size(24, 24) - Me.PictureBox2.TabIndex = 44 - Me.PictureBox2.TabStop = False - Me.PictureBox2.Visible = False - ' - 'PictureBox1 - ' - Me.PictureBox1.Cursor = System.Windows.Forms.Cursors.Cross - Me.PictureBox1.Location = New System.Drawing.Point(256, 56) - Me.PictureBox1.Name = "PictureBox1" - Me.PictureBox1.Size = New System.Drawing.Size(224, 160) - Me.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage - Me.PictureBox1.TabIndex = 43 - Me.PictureBox1.TabStop = False - ' - 'ComboBox5 - ' - Me.ComboBox5.Location = New System.Drawing.Point(144, 168) - Me.ComboBox5.Name = "ComboBox5" - Me.ComboBox5.Size = New System.Drawing.Size(96, 21) - Me.ComboBox5.TabIndex = 42 - Me.ComboBox5.Text = "ComboBox5" - ' - 'ComboBox4 - ' - Me.ComboBox4.Location = New System.Drawing.Point(144, 144) - Me.ComboBox4.Name = "ComboBox4" - Me.ComboBox4.Size = New System.Drawing.Size(96, 21) - Me.ComboBox4.TabIndex = 41 - Me.ComboBox4.Text = "ComboBox4" - ' - 'TextBox19 - ' - Me.TextBox19.Location = New System.Drawing.Point(144, 96) - Me.TextBox19.Name = "TextBox19" - Me.TextBox19.Size = New System.Drawing.Size(96, 20) - Me.TextBox19.TabIndex = 40 - Me.TextBox19.Text = "TextBox19" - ' - 'Label28 - ' - Me.Label28.ForeColor = System.Drawing.Color.Black - Me.Label28.Location = New System.Drawing.Point(17, 97) - Me.Label28.Name = "Label28" - Me.Label28.Size = New System.Drawing.Size(120, 16) - Me.Label28.TabIndex = 39 - Me.Label28.Text = "Trasparenza (0-100%)" - Me.Label28.TextAlign = System.Drawing.ContentAlignment.MiddleLeft - ' - 'CheckBox5 - ' - Me.CheckBox5.ForeColor = System.Drawing.Color.Black - Me.CheckBox5.Location = New System.Drawing.Point(0, 26) - Me.CheckBox5.Name = "CheckBox5" - Me.CheckBox5.Size = New System.Drawing.Size(72, 20) - Me.CheckBox5.TabIndex = 38 - Me.CheckBox5.Text = "Aggiungi" - ' - 'TextBox15 - ' - Me.TextBox15.Location = New System.Drawing.Point(144, 72) - Me.TextBox15.Name = "TextBox15" - Me.TextBox15.Size = New System.Drawing.Size(96, 20) - Me.TextBox15.TabIndex = 19 - Me.TextBox15.Text = "TextBox15" - ' - 'TextBox14 - ' - Me.TextBox14.Location = New System.Drawing.Point(144, 48) - Me.TextBox14.Name = "TextBox14" - Me.TextBox14.Size = New System.Drawing.Size(96, 20) - Me.TextBox14.TabIndex = 18 - Me.TextBox14.Text = "TextBox14" - ' - 'Label25 - ' - Me.Label25.AutoSize = True - Me.Label25.ForeColor = System.Drawing.Color.Black - Me.Label25.Location = New System.Drawing.Point(17, 168) - Me.Label25.Name = "Label25" - Me.Label25.Size = New System.Drawing.Size(95, 13) - Me.Label25.TabIndex = 36 - Me.Label25.Text = "Posizione verticale" - Me.Label25.TextAlign = System.Drawing.ContentAlignment.MiddleLeft - ' - 'TextBox16 - ' - Me.TextBox16.Location = New System.Drawing.Point(144, 120) - Me.TextBox16.Name = "TextBox16" - Me.TextBox16.Size = New System.Drawing.Size(96, 20) - Me.TextBox16.TabIndex = 35 - Me.TextBox16.Text = "TextBox16" - ' - 'Label24 - ' - Me.Label24.AutoSize = True - Me.Label24.ForeColor = System.Drawing.Color.Black - Me.Label24.Location = New System.Drawing.Point(19, 123) - Me.Label24.Name = "Label24" - Me.Label24.Size = New System.Drawing.Size(88, 13) - Me.Label24.TabIndex = 34 - Me.Label24.Text = "Margine (pixel/%)" - Me.Label24.TextAlign = System.Drawing.ContentAlignment.MiddleLeft - ' - 'Label22 - ' - Me.Label22.AutoSize = True - Me.Label22.ForeColor = System.Drawing.Color.Black - Me.Label22.Location = New System.Drawing.Point(19, 51) - Me.Label22.Name = "Label22" - Me.Label22.Size = New System.Drawing.Size(41, 13) - Me.Label22.TabIndex = 20 - Me.Label22.Text = "Altezza" - Me.Label22.TextAlign = System.Drawing.ContentAlignment.MiddleLeft - ' - 'Label23 - ' - Me.Label23.AutoSize = True - Me.Label23.ForeColor = System.Drawing.Color.Black - Me.Label23.Location = New System.Drawing.Point(19, 75) - Me.Label23.Name = "Label23" - Me.Label23.Size = New System.Drawing.Size(56, 13) - Me.Label23.TabIndex = 21 - Me.Label23.Text = "Larghezza" - Me.Label23.TextAlign = System.Drawing.ContentAlignment.MiddleLeft - ' - 'Button4 - ' - Me.Button4.Location = New System.Drawing.Point(464, 24) - Me.Button4.Name = "Button4" - Me.Button4.Size = New System.Drawing.Size(24, 20) - Me.Button4.TabIndex = 8 - Me.Button4.Text = "..." - ' - 'TextBox10 - ' - Me.TextBox10.Location = New System.Drawing.Point(144, 24) - Me.TextBox10.Name = "TextBox10" - Me.TextBox10.Size = New System.Drawing.Size(312, 20) - Me.TextBox10.TabIndex = 6 - Me.TextBox10.Text = "TextBox10" - ' - 'Label29 - ' - Me.Label29.AutoSize = True - Me.Label29.ForeColor = System.Drawing.Color.Black - Me.Label29.Location = New System.Drawing.Point(17, 147) - Me.Label29.Name = "Label29" - Me.Label29.Size = New System.Drawing.Size(105, 13) - Me.Label29.TabIndex = 36 - Me.Label29.Text = "Posizione orizzontale" - Me.Label29.TextAlign = System.Drawing.ContentAlignment.MiddleLeft - ' - 'Label30 - ' - Me.Label30.AutoSize = True - Me.Label30.ForeColor = System.Drawing.Color.Black - Me.Label30.Location = New System.Drawing.Point(19, 203) - Me.Label30.Name = "Label30" - Me.Label30.Size = New System.Drawing.Size(93, 13) - Me.Label30.TabIndex = 36 - Me.Label30.Text = "Colore trasparente" - Me.Label30.TextAlign = System.Drawing.ContentAlignment.MiddleLeft - Me.Label30.Visible = False - ' - 'PictureBox3 - ' - Me.PictureBox3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle - Me.PictureBox3.Location = New System.Drawing.Point(216, 192) - Me.PictureBox3.Name = "PictureBox3" - Me.PictureBox3.Size = New System.Drawing.Size(24, 24) - Me.PictureBox3.TabIndex = 44 - Me.PictureBox3.TabStop = False - Me.PictureBox3.Visible = False - ' - 'TabPage1 - ' - Me.TabPage1.Controls.Add(Me.Panel1) - Me.TabPage1.Controls.Add(Me.GroupBox1) - Me.TabPage1.Location = New System.Drawing.Point(4, 22) - Me.TabPage1.Name = "TabPage1" - Me.TabPage1.Padding = New System.Windows.Forms.Padding(3) - Me.TabPage1.Size = New System.Drawing.Size(513, 326) - Me.TabPage1.TabIndex = 0 - Me.TabPage1.Text = "Miniature" - Me.TabPage1.UseVisualStyleBackColor = True - ' - 'GroupBox1 - ' - Me.GroupBox1.Controls.Add(Me.Label46) - Me.GroupBox1.Controls.Add(Me.TextBox33) - Me.GroupBox1.Controls.Add(Me.Panel2) - Me.GroupBox1.Controls.Add(Me.Label5) - Me.GroupBox1.Controls.Add(Me.TextBox5) - Me.GroupBox1.Controls.Add(Me.Label6) - Me.GroupBox1.Controls.Add(Me.TextBox6) - Me.GroupBox1.Controls.Add(Me.Label3) - Me.GroupBox1.Controls.Add(Me.TextBox3) - Me.GroupBox1.Controls.Add(Me.CheckBox1) - Me.GroupBox1.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer)) - Me.GroupBox1.Location = New System.Drawing.Point(6, 5) - Me.GroupBox1.Name = "GroupBox1" - Me.GroupBox1.Size = New System.Drawing.Size(350, 210) - Me.GroupBox1.TabIndex = 25 - Me.GroupBox1.TabStop = False - Me.GroupBox1.Text = "Miniature" - ' - 'Label46 - ' - Me.Label46.AutoSize = True - Me.Label46.Location = New System.Drawing.Point(198, 43) - Me.Label46.Name = "Label46" - Me.Label46.Size = New System.Drawing.Size(40, 13) - Me.Label46.TabIndex = 21 - Me.Label46.Text = "Qualità" - ' - 'TextBox33 - ' - Me.TextBox33.Location = New System.Drawing.Point(244, 40) - Me.TextBox33.Name = "TextBox33" - Me.TextBox33.Size = New System.Drawing.Size(100, 20) - Me.TextBox33.TabIndex = 20 - ' - 'Panel2 - ' - Me.Panel2.Controls.Add(Me.RadioButton3) - Me.Panel2.Controls.Add(Me.RadioButton7) - Me.Panel2.Controls.Add(Me.RadioButton4) - Me.Panel2.Controls.Add(Me.RadioButton6) - Me.Panel2.Controls.Add(Me.RadioButton5) - Me.Panel2.Location = New System.Drawing.Point(56, 114) - Me.Panel2.Name = "Panel2" - Me.Panel2.Size = New System.Drawing.Size(235, 90) - Me.Panel2.TabIndex = 19 - ' - 'RadioButton3 - ' - Me.RadioButton3.AutoSize = True - Me.RadioButton3.Location = New System.Drawing.Point(15, 16) - Me.RadioButton3.Name = "RadioButton3" - Me.RadioButton3.Size = New System.Drawing.Size(99, 17) - Me.RadioButton3.TabIndex = 14 - Me.RadioButton3.TabStop = True - Me.RadioButton3.Text = "Aggiungi Scritta" - Me.RadioButton3.UseVisualStyleBackColor = True - ' - 'RadioButton7 - ' - Me.RadioButton7.AutoSize = True - Me.RadioButton7.Location = New System.Drawing.Point(129, 40) - Me.RadioButton7.Name = "RadioButton7" - Me.RadioButton7.Size = New System.Drawing.Size(95, 17) - Me.RadioButton7.TabIndex = 18 - Me.RadioButton7.TabStop = True - Me.RadioButton7.Text = "numero+tempo" - Me.RadioButton7.UseVisualStyleBackColor = True - ' - 'RadioButton4 - ' - Me.RadioButton4.AutoSize = True - Me.RadioButton4.Location = New System.Drawing.Point(15, 40) - Me.RadioButton4.Name = "RadioButton4" - Me.RadioButton4.Size = New System.Drawing.Size(95, 17) - Me.RadioButton4.TabIndex = 15 - Me.RadioButton4.TabStop = True - Me.RadioButton4.Text = "Aggiungi orario" - Me.RadioButton4.UseVisualStyleBackColor = True - ' - 'RadioButton6 - ' - Me.RadioButton6.AutoSize = True - Me.RadioButton6.Location = New System.Drawing.Point(129, 16) - Me.RadioButton6.Name = "RadioButton6" - Me.RadioButton6.Size = New System.Drawing.Size(83, 17) - Me.RadioButton6.TabIndex = 17 - Me.RadioButton6.TabStop = True - Me.RadioButton6.Text = "Numero foto" - Me.RadioButton6.UseVisualStyleBackColor = True - ' - 'RadioButton5 - ' - Me.RadioButton5.AutoSize = True - Me.RadioButton5.Location = New System.Drawing.Point(15, 65) - Me.RadioButton5.Name = "RadioButton5" - Me.RadioButton5.Size = New System.Drawing.Size(84, 17) - Me.RadioButton5.TabIndex = 16 - Me.RadioButton5.TabStop = True - Me.RadioButton5.Text = "Tempo Gara" - Me.RadioButton5.UseVisualStyleBackColor = True - ' - 'Label5 - ' - Me.Label5.AutoSize = True - Me.Label5.ForeColor = System.Drawing.Color.Black - Me.Label5.Location = New System.Drawing.Point(24, 88) - Me.Label5.Name = "Label5" - Me.Label5.Size = New System.Drawing.Size(41, 13) - Me.Label5.TabIndex = 12 - Me.Label5.Text = "Altezza" - ' - 'TextBox5 - ' - Me.TextBox5.Location = New System.Drawing.Point(72, 64) - Me.TextBox5.Name = "TextBox5" - Me.TextBox5.Size = New System.Drawing.Size(88, 20) - Me.TextBox5.TabIndex = 10 - Me.TextBox5.Text = "TextBox5" - ' - 'Label6 - ' - Me.Label6.AutoSize = True - Me.Label6.ForeColor = System.Drawing.Color.Black - Me.Label6.Location = New System.Drawing.Point(8, 64) - Me.Label6.Name = "Label6" - Me.Label6.Size = New System.Drawing.Size(56, 13) - Me.Label6.TabIndex = 13 - Me.Label6.Text = "Larghezza" - ' - 'TextBox6 - ' - Me.TextBox6.Location = New System.Drawing.Point(72, 88) - Me.TextBox6.Name = "TextBox6" - Me.TextBox6.Size = New System.Drawing.Size(88, 20) - Me.TextBox6.TabIndex = 11 - Me.TextBox6.Text = "TextBox6" - ' - 'Label3 - ' - Me.Label3.AutoSize = True - Me.Label3.ForeColor = System.Drawing.Color.Black - Me.Label3.Location = New System.Drawing.Point(24, 40) - Me.Label3.Name = "Label3" - Me.Label3.Size = New System.Drawing.Size(44, 13) - Me.Label3.TabIndex = 7 - Me.Label3.Text = "Suffisso" - ' - 'TextBox3 - ' - Me.TextBox3.Location = New System.Drawing.Point(72, 40) - Me.TextBox3.Name = "TextBox3" - Me.TextBox3.Size = New System.Drawing.Size(88, 20) - Me.TextBox3.TabIndex = 6 - Me.TextBox3.Text = "TextBox3" - ' - 'CheckBox1 - ' - Me.CheckBox1.ForeColor = System.Drawing.Color.Black - Me.CheckBox1.Location = New System.Drawing.Point(72, 16) - Me.CheckBox1.Name = "CheckBox1" - Me.CheckBox1.Size = New System.Drawing.Size(104, 24) - Me.CheckBox1.TabIndex = 5 - Me.CheckBox1.Text = "Crea miniature" - ' - 'TabPage2 - ' - Me.TabPage2.Controls.Add(Me.GroupBox2) - Me.TabPage2.Location = New System.Drawing.Point(4, 22) - Me.TabPage2.Name = "TabPage2" - Me.TabPage2.Padding = New System.Windows.Forms.Padding(3) - Me.TabPage2.Size = New System.Drawing.Size(513, 326) - Me.TabPage2.TabIndex = 5 - Me.TabPage2.Text = "Foto" - Me.TabPage2.UseVisualStyleBackColor = True - ' - 'GroupBox2 - ' - Me.GroupBox2.Controls.Add(Me.Label45) - Me.GroupBox2.Controls.Add(Me.TextBox32) - Me.GroupBox2.Controls.Add(Me.TextBox26) - Me.GroupBox2.Controls.Add(Me.Label37) - Me.GroupBox2.Controls.Add(Me.Label38) - Me.GroupBox2.Controls.Add(Me.TextBox27) - Me.GroupBox2.Controls.Add(Me.Label39) - Me.GroupBox2.Controls.Add(Me.TextBox28) - Me.GroupBox2.Controls.Add(Me.CheckBox15) - Me.GroupBox2.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer)) - Me.GroupBox2.Location = New System.Drawing.Point(3, 6) - Me.GroupBox2.Name = "GroupBox2" - Me.GroupBox2.Size = New System.Drawing.Size(304, 156) - Me.GroupBox2.TabIndex = 36 - Me.GroupBox2.TabStop = False - Me.GroupBox2.Text = "Foto grande" - ' - 'Label45 - ' - Me.Label45.AutoSize = True - Me.Label45.Location = New System.Drawing.Point(11, 86) - Me.Label45.Name = "Label45" - Me.Label45.Size = New System.Drawing.Size(40, 13) - Me.Label45.TabIndex = 22 - Me.Label45.Text = "Qualità" - ' - 'TextBox32 - ' - Me.TextBox32.Location = New System.Drawing.Point(72, 80) - Me.TextBox32.Name = "TextBox32" - Me.TextBox32.Size = New System.Drawing.Size(72, 20) - Me.TextBox32.TabIndex = 21 - Me.TextBox32.Text = "100" - ' - 'TextBox26 - ' - Me.TextBox26.Location = New System.Drawing.Point(224, 48) - Me.TextBox26.Name = "TextBox26" - Me.TextBox26.Size = New System.Drawing.Size(56, 20) - Me.TextBox26.TabIndex = 20 - Me.TextBox26.Text = "TextBox26" - ' - 'Label37 - ' - Me.Label37.ForeColor = System.Drawing.Color.Black - Me.Label37.Location = New System.Drawing.Point(168, 48) - Me.Label37.Name = "Label37" - Me.Label37.Size = New System.Drawing.Size(48, 16) - Me.Label37.TabIndex = 19 - Me.Label37.Text = "Suffisso" - Me.Label37.TextAlign = System.Drawing.ContentAlignment.MiddleRight - ' - 'Label38 - ' - Me.Label38.AutoSize = True - Me.Label38.ForeColor = System.Drawing.Color.Black - Me.Label38.Location = New System.Drawing.Point(24, 24) - Me.Label38.Name = "Label38" - Me.Label38.Size = New System.Drawing.Size(41, 13) - Me.Label38.TabIndex = 16 - Me.Label38.Text = "Altezza" - ' - 'TextBox27 - ' - Me.TextBox27.Location = New System.Drawing.Point(72, 24) - Me.TextBox27.Name = "TextBox27" - Me.TextBox27.Size = New System.Drawing.Size(72, 20) - Me.TextBox27.TabIndex = 14 - Me.TextBox27.Text = "TextBox27" - ' - 'Label39 - ' - Me.Label39.AutoSize = True - Me.Label39.ForeColor = System.Drawing.Color.Black - Me.Label39.Location = New System.Drawing.Point(8, 48) - Me.Label39.Name = "Label39" - Me.Label39.Size = New System.Drawing.Size(56, 13) - Me.Label39.TabIndex = 17 - Me.Label39.Text = "Larghezza" - ' - 'TextBox28 - ' - Me.TextBox28.Location = New System.Drawing.Point(72, 48) - Me.TextBox28.Name = "TextBox28" - Me.TextBox28.Size = New System.Drawing.Size(72, 20) - Me.TextBox28.TabIndex = 15 - Me.TextBox28.Text = "TextBox28" - ' - 'CheckBox15 - ' - Me.CheckBox15.Checked = True - Me.CheckBox15.CheckState = System.Windows.Forms.CheckState.Checked - Me.CheckBox15.ForeColor = System.Drawing.Color.Black - Me.CheckBox15.Location = New System.Drawing.Point(168, 16) - Me.CheckBox15.Name = "CheckBox15" - Me.CheckBox15.Size = New System.Drawing.Size(120, 32) - Me.CheckBox15.TabIndex = 18 - Me.CheckBox15.Text = "Mantieni dimensioni originali" - ' - 'TabPage3 - ' - Me.TabPage3.Controls.Add(Me.GroupBox10) - Me.TabPage3.Controls.Add(Me.GroupBox9) - Me.TabPage3.Controls.Add(Me.GroupBox5) - Me.TabPage3.Controls.Add(Me.GroupBox4) - Me.TabPage3.Location = New System.Drawing.Point(4, 22) - Me.TabPage3.Name = "TabPage3" - Me.TabPage3.Padding = New System.Windows.Forms.Padding(3) - Me.TabPage3.Size = New System.Drawing.Size(513, 326) - Me.TabPage3.TabIndex = 2 - Me.TabPage3.Text = "Testo" - Me.TabPage3.UseVisualStyleBackColor = True - ' - 'GroupBox10 - ' - Me.GroupBox10.Controls.Add(Me.Label42) - Me.GroupBox10.Controls.Add(Me.Label41) - Me.GroupBox10.Controls.Add(Me.TextBox31) - Me.GroupBox10.Controls.Add(Me.TextBox30) - Me.GroupBox10.Location = New System.Drawing.Point(316, 53) - Me.GroupBox10.Name = "GroupBox10" - Me.GroupBox10.Size = New System.Drawing.Size(186, 73) - Me.GroupBox10.TabIndex = 39 - Me.GroupBox10.TabStop = False - Me.GroupBox10.Text = "Testo foto verticali" - ' - 'Label42 - ' - Me.Label42.AutoSize = True - Me.Label42.Location = New System.Drawing.Point(7, 46) - Me.Label42.Name = "Label42" - Me.Label42.Size = New System.Drawing.Size(45, 13) - Me.Label42.TabIndex = 3 - Me.Label42.Text = "Margine" - ' - 'Label41 - ' - Me.Label41.AutoSize = True - Me.Label41.Location = New System.Drawing.Point(7, 25) - Me.Label41.Name = "Label41" - Me.Label41.Size = New System.Drawing.Size(108, 13) - Me.Label41.TabIndex = 2 - Me.Label41.Text = "Dimensione Carattere" - ' - 'TextBox31 - ' - Me.TextBox31.Location = New System.Drawing.Point(131, 46) - Me.TextBox31.Name = "TextBox31" - Me.TextBox31.Size = New System.Drawing.Size(39, 20) - Me.TextBox31.TabIndex = 1 - ' - 'TextBox30 - ' - Me.TextBox30.Location = New System.Drawing.Point(131, 22) - Me.TextBox30.Name = "TextBox30" - Me.TextBox30.Size = New System.Drawing.Size(39, 20) - Me.TextBox30.TabIndex = 0 - ' - 'GroupBox9 - ' - Me.GroupBox9.Controls.Add(Me.CheckBox17) - Me.GroupBox9.Controls.Add(Me.CheckBox16) - Me.GroupBox9.Location = New System.Drawing.Point(316, 6) - Me.GroupBox9.Name = "GroupBox9" - Me.GroupBox9.Size = New System.Drawing.Size(186, 45) - Me.GroupBox9.TabIndex = 38 - Me.GroupBox9.TabStop = False - Me.GroupBox9.Text = "Slide show" - ' - 'CheckBox17 - ' - Me.CheckBox17.AutoSize = True - Me.CheckBox17.Location = New System.Drawing.Point(96, 18) - Me.CheckBox17.Name = "CheckBox17" - Me.CheckBox17.Size = New System.Drawing.Size(84, 17) - Me.CheckBox17.TabIndex = 1 - Me.CheckBox17.Text = "Numero foto" - Me.CheckBox17.UseVisualStyleBackColor = True - ' - 'CheckBox16 - ' - Me.CheckBox16.AutoSize = True - Me.CheckBox16.Location = New System.Drawing.Point(6, 19) - Me.CheckBox16.Name = "CheckBox16" - Me.CheckBox16.Size = New System.Drawing.Size(49, 17) - Me.CheckBox16.TabIndex = 0 - Me.CheckBox16.Text = "Data" - Me.CheckBox16.UseVisualStyleBackColor = True - ' - 'GroupBox5 - ' - Me.GroupBox5.Controls.Add(Me.TextBox34) - Me.GroupBox5.Controls.Add(Me.Button8) - Me.GroupBox5.Controls.Add(Me.Label36) - Me.GroupBox5.Controls.Add(Me.TextBox25) - Me.GroupBox5.Controls.Add(Me.Label35) - Me.GroupBox5.Controls.Add(Me.ComboBox3) - Me.GroupBox5.Controls.Add(Me.TextBox11) - Me.GroupBox5.Controls.Add(Me.Label12) - Me.GroupBox5.Controls.Add(Me.Label11) - Me.GroupBox5.Controls.Add(Me.CheckBox3) - Me.GroupBox5.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer)) - Me.GroupBox5.Location = New System.Drawing.Point(6, 6) - Me.GroupBox5.Name = "GroupBox5" - Me.GroupBox5.Size = New System.Drawing.Size(304, 120) - Me.GroupBox5.TabIndex = 37 - Me.GroupBox5.TabStop = False - Me.GroupBox5.Text = "Carattere" - ' - 'TextBox34 - ' - Me.TextBox34.Location = New System.Drawing.Point(160, 91) - Me.TextBox34.Name = "TextBox34" - Me.TextBox34.Size = New System.Drawing.Size(56, 20) - Me.TextBox34.TabIndex = 36 - Me.TextBox34.TextAlign = System.Windows.Forms.HorizontalAlignment.Right - ' - 'Button8 - ' - Me.Button8.ForeColor = System.Drawing.Color.Black - Me.Button8.Location = New System.Drawing.Point(222, 89) - Me.Button8.Name = "Button8" - Me.Button8.Size = New System.Drawing.Size(74, 24) - Me.Button8.TabIndex = 35 - Me.Button8.Text = "Scegli..." - ' - 'Label36 - ' - Me.Label36.ForeColor = System.Drawing.Color.Black - Me.Label36.Location = New System.Drawing.Point(8, 60) - Me.Label36.Name = "Label36" - Me.Label36.Size = New System.Drawing.Size(120, 19) - Me.Label36.TabIndex = 34 - Me.Label36.Text = "Dimensione miniatura" - Me.Label36.TextAlign = System.Drawing.ContentAlignment.MiddleLeft - ' - 'TextBox25 - ' - Me.TextBox25.Location = New System.Drawing.Point(160, 59) - Me.TextBox25.Name = "TextBox25" - Me.TextBox25.Size = New System.Drawing.Size(56, 20) - Me.TextBox25.TabIndex = 33 - Me.TextBox25.Text = "TextBox25" - ' - 'Label35 - ' - Me.Label35.ForeColor = System.Drawing.Color.Black - Me.Label35.Location = New System.Drawing.Point(8, 93) - Me.Label35.Name = "Label35" - Me.Label35.Size = New System.Drawing.Size(72, 16) - Me.Label35.TabIndex = 32 - Me.Label35.Text = "Colore RGB" - Me.Label35.TextAlign = System.Drawing.ContentAlignment.MiddleLeft - ' - 'ComboBox3 - ' - Me.ComboBox3.Location = New System.Drawing.Point(96, 8) - Me.ComboBox3.Name = "ComboBox3" - Me.ComboBox3.Size = New System.Drawing.Size(120, 21) - Me.ComboBox3.TabIndex = 28 - Me.ComboBox3.Text = "ComboBox3" - ' - 'TextBox11 - ' - Me.TextBox11.Location = New System.Drawing.Point(160, 35) - Me.TextBox11.Name = "TextBox11" - Me.TextBox11.Size = New System.Drawing.Size(56, 20) - Me.TextBox11.TabIndex = 27 - Me.TextBox11.Text = "TextBox11" - ' - 'Label12 - ' - Me.Label12.AutoSize = True - Me.Label12.ForeColor = System.Drawing.Color.Black - Me.Label12.Location = New System.Drawing.Point(8, 38) - Me.Label12.Name = "Label12" - Me.Label12.Size = New System.Drawing.Size(62, 13) - Me.Label12.TabIndex = 26 - Me.Label12.Text = "Dimensione" - Me.Label12.TextAlign = System.Drawing.ContentAlignment.MiddleLeft - ' - 'Label11 - ' - Me.Label11.AutoSize = True - Me.Label11.ForeColor = System.Drawing.Color.Black - Me.Label11.Location = New System.Drawing.Point(56, 8) - Me.Label11.Name = "Label11" - Me.Label11.Size = New System.Drawing.Size(28, 13) - Me.Label11.TabIndex = 22 - Me.Label11.Text = "Font" - ' - 'CheckBox3 - ' - Me.CheckBox3.ForeColor = System.Drawing.Color.Black - Me.CheckBox3.Location = New System.Drawing.Point(224, 8) - Me.CheckBox3.Name = "CheckBox3" - Me.CheckBox3.Size = New System.Drawing.Size(72, 24) - Me.CheckBox3.TabIndex = 24 - Me.CheckBox3.Text = "Grassetto" - ' - 'GroupBox4 - ' - Me.GroupBox4.Controls.Add(Me.Label40) - Me.GroupBox4.Controls.Add(Me.TextBox29) - Me.GroupBox4.Controls.Add(Me.TextBox18) - Me.GroupBox4.Controls.Add(Me.Label26) - Me.GroupBox4.Controls.Add(Me.DateTimePicker1) - Me.GroupBox4.Controls.Add(Me.CheckBox8) - Me.GroupBox4.Controls.Add(Me.TextBox9) - Me.GroupBox4.Controls.Add(Me.CheckBox7) - Me.GroupBox4.Controls.Add(Me.Label4) - Me.GroupBox4.Controls.Add(Me.TextBox4) - Me.GroupBox4.Controls.Add(Me.Label9) - Me.GroupBox4.Controls.Add(Me.Label13) - Me.GroupBox4.Controls.Add(Me.ComboBox1) - Me.GroupBox4.Controls.Add(Me.ComboBox2) - Me.GroupBox4.Controls.Add(Me.Label14) - Me.GroupBox4.Controls.Add(Me.TextBox12) - Me.GroupBox4.Controls.Add(Me.Label15) - Me.GroupBox4.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer)) - Me.GroupBox4.Location = New System.Drawing.Point(6, 132) - Me.GroupBox4.Name = "GroupBox4" - Me.GroupBox4.Size = New System.Drawing.Size(496, 186) - Me.GroupBox4.TabIndex = 36 - Me.GroupBox4.TabStop = False - Me.GroupBox4.Text = "Testo da applicare" - ' - 'Label40 - ' - Me.Label40.AutoSize = True - Me.Label40.Location = New System.Drawing.Point(8, 52) - Me.Label40.Name = "Label40" - Me.Label40.Size = New System.Drawing.Size(48, 13) - Me.Label40.TabIndex = 40 - Me.Label40.Text = "Verticale" - ' - 'TextBox29 - ' - Me.TextBox29.Location = New System.Drawing.Point(72, 49) - Me.TextBox29.Multiline = True - Me.TextBox29.Name = "TextBox29" - Me.TextBox29.Size = New System.Drawing.Size(408, 44) - Me.TextBox29.TabIndex = 39 - ' - 'TextBox18 - ' - Me.TextBox18.Location = New System.Drawing.Point(232, 156) - Me.TextBox18.Name = "TextBox18" - Me.TextBox18.Size = New System.Drawing.Size(100, 20) - Me.TextBox18.TabIndex = 38 - ' - 'Label26 - ' - Me.Label26.AutoSize = True - Me.Label26.ForeColor = System.Drawing.Color.Black - Me.Label26.Location = New System.Drawing.Point(344, 156) - Me.Label26.Name = "Label26" - Me.Label26.Size = New System.Drawing.Size(48, 13) - Me.Label26.TabIndex = 37 - Me.Label26.Text = "partenza" - ' - 'DateTimePicker1 - ' - Me.DateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.Time - Me.DateTimePicker1.Location = New System.Drawing.Point(392, 156) - Me.DateTimePicker1.Name = "DateTimePicker1" - Me.DateTimePicker1.Size = New System.Drawing.Size(88, 20) - Me.DateTimePicker1.TabIndex = 36 - ' - 'CheckBox8 - ' - Me.CheckBox8.ForeColor = System.Drawing.Color.Black - Me.CheckBox8.Location = New System.Drawing.Point(72, 156) - Me.CheckBox8.Name = "CheckBox8" - Me.CheckBox8.Size = New System.Drawing.Size(56, 16) - Me.CheckBox8.TabIndex = 35 - Me.CheckBox8.Text = "Orario" - ' - 'TextBox9 - ' - Me.TextBox9.Location = New System.Drawing.Point(120, 108) - Me.TextBox9.Name = "TextBox9" - Me.TextBox9.Size = New System.Drawing.Size(56, 20) - Me.TextBox9.TabIndex = 20 - Me.TextBox9.Text = "TextBox9" - ' - 'CheckBox7 - ' - Me.CheckBox7.ForeColor = System.Drawing.Color.Black - Me.CheckBox7.Location = New System.Drawing.Point(136, 156) - Me.CheckBox7.Name = "CheckBox7" - Me.CheckBox7.Size = New System.Drawing.Size(88, 16) - Me.CheckBox7.TabIndex = 34 - Me.CheckBox7.Text = "Tempo gara" - ' - 'Label4 - ' - Me.Label4.AutoSize = True - Me.Label4.ForeColor = System.Drawing.Color.Black - Me.Label4.Location = New System.Drawing.Point(8, 24) - Me.Label4.Name = "Label4" - Me.Label4.Size = New System.Drawing.Size(59, 13) - Me.Label4.TabIndex = 9 - Me.Label4.Text = "Orizzontale" - ' - 'TextBox4 - ' - Me.TextBox4.Location = New System.Drawing.Point(72, 24) - Me.TextBox4.Name = "TextBox4" - Me.TextBox4.Size = New System.Drawing.Size(408, 20) - Me.TextBox4.TabIndex = 8 - Me.TextBox4.Text = "TextBox4" - ' - 'Label9 - ' - Me.Label9.AutoSize = True - Me.Label9.ForeColor = System.Drawing.Color.Black - Me.Label9.Location = New System.Drawing.Point(8, 108) - Me.Label9.Name = "Label9" - Me.Label9.Size = New System.Drawing.Size(110, 13) - Me.Label9.TabIndex = 19 - Me.Label9.Text = "Trasparenza (0-100%)" - ' - 'Label13 - ' - Me.Label13.AutoSize = True - Me.Label13.ForeColor = System.Drawing.Color.Black - Me.Label13.Location = New System.Drawing.Point(16, 132) - Me.Label13.Name = "Label13" - Me.Label13.Size = New System.Drawing.Size(52, 13) - Me.Label13.TabIndex = 29 - Me.Label13.Text = "Posizione" - ' - 'ComboBox1 - ' - Me.ComboBox1.Location = New System.Drawing.Point(72, 132) - Me.ComboBox1.Name = "ComboBox1" - Me.ComboBox1.Size = New System.Drawing.Size(104, 21) - Me.ComboBox1.TabIndex = 28 - Me.ComboBox1.Text = "ComboBox1" - ' - 'ComboBox2 - ' - Me.ComboBox2.Location = New System.Drawing.Point(376, 132) - Me.ComboBox2.Name = "ComboBox2" - Me.ComboBox2.Size = New System.Drawing.Size(104, 21) - Me.ComboBox2.TabIndex = 31 - Me.ComboBox2.Text = "ComboBox2" - ' - 'Label14 - ' - Me.Label14.AutoSize = True - Me.Label14.ForeColor = System.Drawing.Color.Black - Me.Label14.Location = New System.Drawing.Point(304, 132) - Me.Label14.Name = "Label14" - Me.Label14.Size = New System.Drawing.Size(67, 13) - Me.Label14.TabIndex = 30 - Me.Label14.Text = "Allineamento" - ' - 'TextBox12 - ' - Me.TextBox12.Location = New System.Drawing.Point(376, 108) - Me.TextBox12.Name = "TextBox12" - Me.TextBox12.Size = New System.Drawing.Size(104, 20) - Me.TextBox12.TabIndex = 33 - Me.TextBox12.Text = "TextBox12" - ' - 'Label15 - ' - Me.Label15.AutoSize = True - Me.Label15.ForeColor = System.Drawing.Color.Black - Me.Label15.Location = New System.Drawing.Point(296, 108) - Me.Label15.Name = "Label15" - Me.Label15.Size = New System.Drawing.Size(75, 13) - Me.Label15.TabIndex = 32 - Me.Label15.Text = "Margine (pixel)" - ' - 'TabPage5 - ' - Me.TabPage5.Controls.Add(Me.GroupBox3) - Me.TabPage5.Controls.Add(Me.GroupBox8) - Me.TabPage5.Controls.Add(Me.GroupBox7) - Me.TabPage5.Location = New System.Drawing.Point(4, 22) - Me.TabPage5.Name = "TabPage5" - Me.TabPage5.Padding = New System.Windows.Forms.Padding(3) - Me.TabPage5.Size = New System.Drawing.Size(513, 326) - Me.TabPage5.TabIndex = 4 - Me.TabPage5.Text = "Generale" - Me.TabPage5.UseVisualStyleBackColor = True - ' - 'GroupBox3 - ' - Me.GroupBox3.Controls.Add(Me.CheckBox6) - Me.GroupBox3.Controls.Add(Me.Button3) - Me.GroupBox3.Controls.Add(Me.Button2) - Me.GroupBox3.Controls.Add(Me.Label1) - Me.GroupBox3.Controls.Add(Me.Label2) - Me.GroupBox3.Controls.Add(Me.TextBox1) - Me.GroupBox3.Controls.Add(Me.TextBox2) - Me.GroupBox3.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer)) - Me.GroupBox3.Location = New System.Drawing.Point(6, 6) - Me.GroupBox3.Name = "GroupBox3" - Me.GroupBox3.Size = New System.Drawing.Size(496, 101) - Me.GroupBox3.TabIndex = 35 - Me.GroupBox3.TabStop = False - Me.GroupBox3.Text = "Directory" - ' - 'CheckBox6 - ' - Me.CheckBox6.ForeColor = System.Drawing.Color.Black - Me.CheckBox6.Location = New System.Drawing.Point(80, 64) - Me.CheckBox6.Name = "CheckBox6" - Me.CheckBox6.Size = New System.Drawing.Size(152, 24) - Me.CheckBox6.TabIndex = 25 - Me.CheckBox6.Text = "aggiorna le sottodirectory" - ' - 'Button3 - ' - Me.Button3.Location = New System.Drawing.Point(462, 40) - Me.Button3.Name = "Button3" - Me.Button3.Size = New System.Drawing.Size(24, 20) - Me.Button3.TabIndex = 6 - Me.Button3.Text = "..." - ' - 'Button2 - ' - Me.Button2.Location = New System.Drawing.Point(462, 16) - Me.Button2.Name = "Button2" - Me.Button2.Size = New System.Drawing.Size(24, 20) - Me.Button2.TabIndex = 5 - Me.Button2.Text = "..." - ' - 'Label1 - ' - Me.Label1.AutoSize = True - Me.Label1.ForeColor = System.Drawing.Color.Black - Me.Label1.Location = New System.Drawing.Point(6, 19) - Me.Label1.Name = "Label1" - Me.Label1.Size = New System.Drawing.Size(50, 13) - Me.Label1.TabIndex = 3 - Me.Label1.Text = "Sorgente" - ' - 'Label2 - ' - Me.Label2.AutoSize = True - Me.Label2.ForeColor = System.Drawing.Color.Black - Me.Label2.Location = New System.Drawing.Point(6, 43) - Me.Label2.Name = "Label2" - Me.Label2.Size = New System.Drawing.Size(68, 13) - Me.Label2.TabIndex = 4 - Me.Label2.Text = "Destinazione" - ' - 'TextBox1 - ' - Me.TextBox1.Location = New System.Drawing.Point(80, 16) - Me.TextBox1.Name = "TextBox1" - Me.TextBox1.Size = New System.Drawing.Size(376, 20) - Me.TextBox1.TabIndex = 0 - Me.TextBox1.Text = "TextBox1" - ' - 'TextBox2 - ' - Me.TextBox2.Location = New System.Drawing.Point(80, 40) - Me.TextBox2.Name = "TextBox2" - Me.TextBox2.Size = New System.Drawing.Size(376, 20) - Me.TextBox2.TabIndex = 1 - Me.TextBox2.Text = "TextBox2" - ' - 'GroupBox8 - ' - Me.GroupBox8.Controls.Add(Me.RadioButton2) - Me.GroupBox8.Controls.Add(Me.RadioButton1) - Me.GroupBox8.Controls.Add(Me.TextBox21) - Me.GroupBox8.Controls.Add(Me.Label34) - Me.GroupBox8.Controls.Add(Me.TextBox20) - Me.GroupBox8.Controls.Add(Me.Label33) - Me.GroupBox8.Controls.Add(Me.Label31) - Me.GroupBox8.Controls.Add(Me.CheckBox11) - Me.GroupBox8.Controls.Add(Me.TextBox17) - Me.GroupBox8.Controls.Add(Me.Label32) - Me.GroupBox8.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer)) - Me.GroupBox8.Location = New System.Drawing.Point(204, 113) - Me.GroupBox8.Name = "GroupBox8" - Me.GroupBox8.Size = New System.Drawing.Size(192, 152) - Me.GroupBox8.TabIndex = 47 - Me.GroupBox8.TabStop = False - Me.GroupBox8.Text = "Sottocartelle" - ' - 'RadioButton2 - ' - Me.RadioButton2.ForeColor = System.Drawing.Color.Black - Me.RadioButton2.Location = New System.Drawing.Point(32, 128) - Me.RadioButton2.Name = "RadioButton2" - Me.RadioButton2.Size = New System.Drawing.Size(136, 16) - Me.RadioButton2.TabIndex = 38 - Me.RadioButton2.Text = "Numerazione files" - ' - 'RadioButton1 - ' - Me.RadioButton1.Checked = True - Me.RadioButton1.ForeColor = System.Drawing.Color.Black - Me.RadioButton1.Location = New System.Drawing.Point(32, 112) - Me.RadioButton1.Name = "RadioButton1" - Me.RadioButton1.Size = New System.Drawing.Size(152, 16) - Me.RadioButton1.TabIndex = 37 - Me.RadioButton1.TabStop = True - Me.RadioButton1.Text = "Numerazione progressiva" - ' - 'TextBox21 - ' - Me.TextBox21.Location = New System.Drawing.Point(128, 88) - Me.TextBox21.Name = "TextBox21" - Me.TextBox21.Size = New System.Drawing.Size(56, 20) - Me.TextBox21.TabIndex = 34 - Me.TextBox21.Text = "4" - ' - 'Label34 - ' - Me.Label34.ForeColor = System.Drawing.Color.Black - Me.Label34.Location = New System.Drawing.Point(8, 88) - Me.Label34.Name = "Label34" - Me.Label34.Size = New System.Drawing.Size(112, 16) - Me.Label34.TabIndex = 33 - Me.Label34.Text = "Num. cifre contatore" - Me.Label34.TextAlign = System.Drawing.ContentAlignment.MiddleRight - ' - 'TextBox20 - ' - Me.TextBox20.Location = New System.Drawing.Point(56, 64) - Me.TextBox20.Name = "TextBox20" - Me.TextBox20.Size = New System.Drawing.Size(128, 20) - Me.TextBox20.TabIndex = 32 - Me.TextBox20.Text = "TextBox20" - ' - 'Label33 - ' - Me.Label33.ForeColor = System.Drawing.Color.Black - Me.Label33.Location = New System.Drawing.Point(6, 67) - Me.Label33.Name = "Label33" - Me.Label33.Size = New System.Drawing.Size(48, 16) - Me.Label33.TabIndex = 31 - Me.Label33.Text = "Suffisso" - ' - 'Label31 - ' - Me.Label31.ForeColor = System.Drawing.Color.Black - Me.Label31.Location = New System.Drawing.Point(24, 40) - Me.Label31.Name = "Label31" - Me.Label31.Size = New System.Drawing.Size(32, 16) - Me.Label31.TabIndex = 30 - Me.Label31.Text = "ogni" - ' - 'CheckBox11 - ' - Me.CheckBox11.ForeColor = System.Drawing.Color.Black - Me.CheckBox11.Location = New System.Drawing.Point(56, 16) - Me.CheckBox11.Name = "CheckBox11" - Me.CheckBox11.Size = New System.Drawing.Size(112, 16) - Me.CheckBox11.TabIndex = 29 - Me.CheckBox11.Text = "crea sottocartelle" - ' - 'TextBox17 - ' - Me.TextBox17.Location = New System.Drawing.Point(56, 40) - Me.TextBox17.Name = "TextBox17" - Me.TextBox17.Size = New System.Drawing.Size(64, 20) - Me.TextBox17.TabIndex = 27 - Me.TextBox17.Text = "99" - ' - 'Label32 - ' - Me.Label32.ForeColor = System.Drawing.Color.Black - Me.Label32.Location = New System.Drawing.Point(128, 40) - Me.Label32.Name = "Label32" - Me.Label32.Size = New System.Drawing.Size(24, 16) - Me.Label32.TabIndex = 28 - Me.Label32.Text = "file" - ' - 'GroupBox7 - ' - Me.GroupBox7.Controls.Add(Me.CheckBox10) - Me.GroupBox7.Controls.Add(Me.CheckBox9) - Me.GroupBox7.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer)) - Me.GroupBox7.Location = New System.Drawing.Point(6, 113) - Me.GroupBox7.Name = "GroupBox7" - Me.GroupBox7.Size = New System.Drawing.Size(192, 88) - Me.GroupBox7.TabIndex = 45 - Me.GroupBox7.TabStop = False - Me.GroupBox7.Text = "Generale" - ' - 'CheckBox10 - ' - Me.CheckBox10.ForeColor = System.Drawing.Color.Black - Me.CheckBox10.Location = New System.Drawing.Point(16, 37) - Me.CheckBox10.Name = "CheckBox10" - Me.CheckBox10.Size = New System.Drawing.Size(136, 16) - Me.CheckBox10.TabIndex = 1 - Me.CheckBox10.Text = "Rotazione automatica" - ' - 'CheckBox9 - ' - Me.CheckBox9.Checked = True - Me.CheckBox9.CheckState = System.Windows.Forms.CheckState.Checked - Me.CheckBox9.ForeColor = System.Drawing.Color.Black - Me.CheckBox9.Location = New System.Drawing.Point(16, 18) - Me.CheckBox9.Name = "CheckBox9" - Me.CheckBox9.Size = New System.Drawing.Size(80, 16) - Me.CheckBox9.TabIndex = 0 - Me.CheckBox9.Text = "Forza Jpg" - ' - 'TabControl1 - ' - Me.TabControl1.Controls.Add(Me.TabPage5) - Me.TabControl1.Controls.Add(Me.TabPage3) - Me.TabControl1.Controls.Add(Me.TabPage2) - Me.TabControl1.Controls.Add(Me.TabPage1) - Me.TabControl1.Controls.Add(Me.TabPage4) - Me.TabControl1.Location = New System.Drawing.Point(12, 12) - Me.TabControl1.Name = "TabControl1" - Me.TabControl1.SelectedIndex = 0 - Me.TabControl1.Size = New System.Drawing.Size(521, 352) - Me.TabControl1.TabIndex = 48 - ' - 'ProgressBar1 - ' - Me.ProgressBar1.Location = New System.Drawing.Point(539, 211) - Me.ProgressBar1.Name = "ProgressBar1" - Me.ProgressBar1.Size = New System.Drawing.Size(192, 23) - Me.ProgressBar1.TabIndex = 52 - ' - 'CheckBox12 - ' - Me.CheckBox12.ForeColor = System.Drawing.Color.Black - Me.CheckBox12.Location = New System.Drawing.Point(10, 19) - Me.CheckBox12.Name = "CheckBox12" - Me.CheckBox12.Size = New System.Drawing.Size(104, 21) - Me.CheckBox12.TabIndex = 35 - Me.CheckBox12.Text = "Aggiungi orario" - ' - 'CheckBox4 - ' - Me.CheckBox4.ForeColor = System.Drawing.Color.Black - Me.CheckBox4.Location = New System.Drawing.Point(10, 3) - Me.CheckBox4.Name = "CheckBox4" - Me.CheckBox4.Size = New System.Drawing.Size(104, 17) - Me.CheckBox4.TabIndex = 34 - Me.CheckBox4.Text = "Aggiungi scritta" - ' - 'CheckBox18 - ' - Me.CheckBox18.AutoSize = True - Me.CheckBox18.Location = New System.Drawing.Point(140, 3) - Me.CheckBox18.Name = "CheckBox18" - Me.CheckBox18.Size = New System.Drawing.Size(84, 17) - Me.CheckBox18.TabIndex = 36 - Me.CheckBox18.Text = "Numero foto" - Me.CheckBox18.UseVisualStyleBackColor = True - ' - 'Panel1 - ' - Me.Panel1.Controls.Add(Me.CheckBox18) - Me.Panel1.Controls.Add(Me.CheckBox4) - Me.Panel1.Controls.Add(Me.CheckBox12) - Me.Panel1.Location = New System.Drawing.Point(52, 236) - Me.Panel1.Name = "Panel1" - Me.Panel1.Size = New System.Drawing.Size(304, 73) - Me.Panel1.TabIndex = 26 - Me.Panel1.Visible = False - ' - 'Form1 - ' - Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) - Me.ClientSize = New System.Drawing.Size(740, 375) - Me.Controls.Add(Me.ProgressBar1) - Me.Controls.Add(Me.Label44) - Me.Controls.Add(Me.CheckBox22) - Me.Controls.Add(Me.Label43) - Me.Controls.Add(Me.TabControl1) - Me.Controls.Add(Me.Label27) - Me.Controls.Add(Me.Button7) - Me.Controls.Add(Me.Button5) - Me.Controls.Add(Me.Label20) - Me.Controls.Add(Me.Label19) - Me.Controls.Add(Me.Label18) - Me.Controls.Add(Me.Label17) - Me.Controls.Add(Me.Label10) - Me.Controls.Add(Me.Button1) - Me.Controls.Add(Me.Button6) - Me.MaximizeBox = False - Me.MaximumSize = New System.Drawing.Size(756, 414) - Me.MinimumSize = New System.Drawing.Size(756, 414) - Me.Name = "Form1" - Me.Text = "Image Catalog" - Me.TabPage4.ResumeLayout(False) - Me.GroupBox6.ResumeLayout(False) - Me.GroupBox6.PerformLayout() - CType(Me.PictureBox2, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.PictureBox3, System.ComponentModel.ISupportInitialize).EndInit() - Me.TabPage1.ResumeLayout(False) - Me.GroupBox1.ResumeLayout(False) - Me.GroupBox1.PerformLayout() - Me.Panel2.ResumeLayout(False) - Me.Panel2.PerformLayout() - Me.TabPage2.ResumeLayout(False) - Me.GroupBox2.ResumeLayout(False) - Me.GroupBox2.PerformLayout() - Me.TabPage3.ResumeLayout(False) - Me.GroupBox10.ResumeLayout(False) - Me.GroupBox10.PerformLayout() - Me.GroupBox9.ResumeLayout(False) - Me.GroupBox9.PerformLayout() - Me.GroupBox5.ResumeLayout(False) - Me.GroupBox5.PerformLayout() - Me.GroupBox4.ResumeLayout(False) - Me.GroupBox4.PerformLayout() - Me.TabPage5.ResumeLayout(False) - Me.GroupBox3.ResumeLayout(False) - Me.GroupBox3.PerformLayout() - Me.GroupBox8.ResumeLayout(False) - Me.GroupBox8.PerformLayout() - Me.GroupBox7.ResumeLayout(False) - Me.TabControl1.ResumeLayout(False) - Me.Panel1.ResumeLayout(False) - Me.Panel1.PerformLayout() - Me.ResumeLayout(False) - Me.PerformLayout() - - End Sub - -#End Region - -#Const MULTI_THREADED = True - - Private StopAttivo As Boolean - Private WaterSelectColor As Boolean = False - - Private ContaFotoCuori As Integer - Private TaskCuori() As PicInfo - - Private MyPool As XYThreadPool = New XYThreadPool - Private ContaImmaginiThread As Integer - - Private Const maxThreads As Integer = 15 - - Private Sub setDefaults() - TextBox1.Text = "" - TextBox2.Text = "" - TextBox3.Text = "" - TextBox4.Text = "" - TextBox5.Text = "" - TextBox6.Text = "" - TextBox27.Text = "" - TextBox28.Text = "" - TextBox9.Text = "" - TextBox11.Text = "" - TextBox12.Text = "" - TextBox13.Text = "" - TextBox10.Text = "" - TextBox14.Text = "" - TextBox15.Text = "" - TextBox16.Text = "" - TextBox17.Text = "" - TextBox19.Text = "" - TextBox20.Text = "" - TextBox21.Text = "" - TextBox25.Text = "" - TextBox26.Text = "" - - ComboBox1.Items.Add("Alto") - ComboBox1.Items.Add("Basso") - ComboBox1.SelectedIndex = 1 - - ComboBox2.Items.Add("Sinistra") - ComboBox2.Items.Add("Centro") - ComboBox2.Items.Add("Destra") - ComboBox2.SelectedIndex = 1 - - ComboBox3.Items.Add("Arial") - ComboBox3.Items.Add("Arial Black") - ComboBox3.Items.Add("Arial Narrow") - ComboBox3.Items.Add("Comic Sans MS") - ComboBox3.Items.Add("Courier New") - ComboBox3.Items.Add("System") - ComboBox3.Items.Add("Times New Roman") - ComboBox3.Items.Add("Verdana") - ComboBox3.Items.Add("Wingdings") - ComboBox3.SelectedIndex = 7 - - ComboBox4.Items.Add("Sinistra") - ComboBox4.Items.Add("Centro") - ComboBox4.Items.Add("Destra") - ComboBox4.SelectedIndex = 2 - - ComboBox5.Items.Add("Alto") - ComboBox5.Items.Add("Centro") - ComboBox5.Items.Add("Basso") - ComboBox5.SelectedIndex = 2 - End Sub - - Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load - Application.EnableVisualStyles() - - setDefaults() - - End Sub - - Private Sub FixPaths() - If TextBox1.Text.EndsWith("\") = False Then - TextBox1.Text &= "\" - End If - If TextBox2.Text.EndsWith("\") = False Then - TextBox2.Text &= "\" - End If - End Sub - - Private Sub lockUI() - TabControl1.Enabled = False - Button5.Enabled = False - Button6.Enabled = False - Button1.Enabled = False - - End Sub - - Private Sub unlockUI() - TabControl1.Enabled = True - Button5.Enabled = True - Button6.Enabled = True - Button1.Enabled = True - End Sub - - Private Sub btnCreaCatalogo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click - lockUI() - Dim timeStart As Date - Dim timeStop As Date - - timeStart = TimeOfDay - FixPaths() - - Label10.Text = "" - Label17.Text = "0" - Label18.Text = "0" - setPicSettings(TextBox1.Text, TextBox2.Text) -#If MULTI_THREADED Then - ProgressBar1.Minimum = 0 - ProgressBar1.Step = 1 - ProgressBar1.Value = 0 - - Dim t1 As New Threading.Thread(AddressOf creaCatalogoThread) - t1.IsBackground = True - t1.Start() - -#Else - creaCatalogo(timeStart, timeStop) - unlockUI() -#End If - - - - - End Sub - - Private Sub creaCatalogoThread() - Dim timeStart As Date = TimeOfDay - MyPool.StopThreadPool() - MyPool.StartThreadPool(0, maxThreads) - ContaImmaginiThread = 0 - - creaImmaginiWithThreadMod(TextBox1.Text, TextBox2.Text) - - Dim ThAttivo As ThreadPoolWorkItem = Nothing - Dim i As Integer = 0 - - Do Until i = ContaImmaginiThread - Thread.Sleep(100) - ThAttivo = MyPool.ExtractWorkItem() - If ThAttivo IsNot Nothing Then - i += 1 - 'stepProgressBar() - setLabel10Text("File: " & ThAttivo.m_sName) - - 'setLabel18Text(ContaImmaginiThread.ToString) - 'setLabel18Text(i.ToString) - - - 'Label10.Text = "File: " & ThAttivo.m_sName - 'Label18.Text = ContaImmaginiThread.ToString - End If - Loop - MyPool.StopThreadPool() - Dim timeStop As Date = TimeOfDay - - setLabel10Text("Finito") - setLabel43Text(CalcTime(timeStart, timeStop)) - - End Sub - - Private Sub creaCatalogo(timeStart As Date, timeStop As Date) - 'asdfg - MyPool.StopThreadPool() - MyPool.StartThreadPool(0, maxThreads) - ContaImmaginiThread = 0 - - creaImmaginiWithThreadMod(TextBox1.Text, TextBox2.Text) - - Dim ThAttivo As ThreadPoolWorkItem = Nothing - Dim i As Integer = 0 - - Do Until i = ContaImmaginiThread - Thread.Sleep(100) - ThAttivo = MyPool.ExtractWorkItem() - If ThAttivo IsNot Nothing Then - i += 1 - Label10.Text = "File: " & ThAttivo.m_sName - Label18.Text = ContaImmaginiThread.ToString - - End If - Loop - MyPool.StopThreadPool() - timeStop = TimeOfDay - - CalcTime(timeStart, timeStop) - Label10.Text = "Finito" - If CheckBox22.Checked = True Then - Shell("%windir%\System32\shutdown.exe") - End If - End Sub - - Private Function CalcTime(ByVal timeStart As Date, ByVal timeStop As Date) As String - Dim timediffH, timediffS As Long - Dim timediffM As Long - timediffM = DateAndTime.DateDiff(DateInterval.Minute, timeStart, timeStop) - timediffS = DateAndTime.DateDiff(DateInterval.Second, timeStart, timeStop) - timediffH = DateAndTime.DateDiff(DateInterval.Hour, timeStart, timeStop) - 'dim s As String = "H:" + timediffH.ToString + " M:" + timediffM.ToString + " S:" + timediffS.ToString - Dim s As String = "S:" + timediffS.ToString - 'Label43.Text = "H:" + timediffH.ToString + " M:" + timediffM.ToString + " S:" + timediffS.ToString - Return s - End Function - Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click - Dim DirSearch As FolderBrowserDialog = New FolderBrowserDialog - DirSearch.SelectedPath = TextBox1.Text - If DialogResult.OK = DirSearch.ShowDialog() Then - Dim DirectoryScelta As String = DirSearch.SelectedPath - If DirectoryScelta.EndsWith("\") = False Then - DirectoryScelta &= "\" - End If - - TextBox1.Text = DirectoryScelta - End If - End Sub - - Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click - Dim DirSearch As FolderBrowserDialog = New FolderBrowserDialog - DirSearch.SelectedPath = TextBox2.Text - If DialogResult.OK = DirSearch.ShowDialog() Then - Dim DirectoryScelta As String = DirSearch.SelectedPath - If DirectoryScelta.EndsWith("\") = False Then - DirectoryScelta &= "\" - End If - - TextBox2.Text = DirectoryScelta - End If - - 'Dim openFileDialog As OpenFileDialog = New OpenFileDialog - - 'Dim openFileDialog As OpenFileDialog = New OpenFileDialog - - 'openFileDialog.InitialDirectory = TextBox1.Text - 'openFileDialog.Filter = "Bitmap files (*.bmp)|*.bmp|Jpeg files (*.jpg)|*.jpg|All valid files (*.*)|*.*" - 'openFileDialog.FilterIndex = 2 - 'openFileDialog.RestoreDirectory = True - - 'If DialogResult.OK = openFileDialog.ShowDialog() Then - ' Dim IlNome As String = openFileDialog.FileName - ' Dim NomeFine As String = "" - ' Dim i As Integer - - ' Dim Elenco As String() - ' Elenco = IlNome.Split(New Char() {"\"c}) - ' For i = 0 To Elenco.Length - 1 - ' NomeFine &= Elenco(i) & "\" - ' Next - - ' TextBox1.Text = NomeFine - 'End If - End Sub - - Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click - Dim SaveFileDlg As SaveFileDialog = New SaveFileDialog - - 'SaveFileDlg.InitialDirectory = "c:\" - SaveFileDlg.Filter = "Setup (*.xml)|*.xml|All valid files (*.*)|*.*" - SaveFileDlg.FilterIndex = 0 - SaveFileDlg.RestoreDirectory = True - - If DialogResult.OK = SaveFileDlg.ShowDialog Then - Dim IlNome As String = SaveFileDlg.FileName - - SetupIni.NomeFileSetup = IlNome - - SetupIni.AggiornaParametro("DirSorgente", TextBox1.Text) - SetupIni.AggiornaParametro("DirDestinazione", TextBox2.Text) - SetupIni.AggiornaParametro("DirSottoDirectory", CheckBox6.Checked) - - SetupIni.AggiornaParametro("DirDividiDestinazione", CheckBox11.Checked) - SetupIni.AggiornaParametro("DirDividiNumFile", TextBox17.Text) - SetupIni.AggiornaParametro("DirDividiSuffisso", TextBox20.Text) - SetupIni.AggiornaParametro("DirDividiNumCifre", TextBox21.Text) - If RadioButton1.Checked = True Then - SetupIni.AggiornaParametro("DirDividiTipoNumerazione", "Progressiva") - Else - SetupIni.AggiornaParametro("DirDividiTipoNumerazione", "Files") - End If - - SetupIni.AggiornaParametro("MiniatureCrea", CheckBox1.Checked) - SetupIni.AggiornaParametro("MiniatureSuffisso", TextBox3.Text) - SetupIni.AggiornaParametro("MiniatureAltezza", TextBox5.Text) - SetupIni.AggiornaParametro("MiniatureLarghezza", TextBox6.Text) - SetupIni.AggiornaParametro("MiniatureAddScritta", RadioButton3.Checked) - SetupIni.AggiornaParametro("MiniatureAddOrario", RadioButton4.Checked) - - SetupIni.AggiornaParametro("FotoAltezza", TextBox27.Text) - SetupIni.AggiornaParametro("FotoLarghezza", TextBox28.Text) - SetupIni.AggiornaParametro("FotoCodice", TextBox13.Text) - SetupIni.AggiornaParametro("FotoDimOriginali", CheckBox2.Checked) - - SetupIni.AggiornaParametro("FontDimensione", TextBox11.Text) - SetupIni.AggiornaParametro("FontDimensioneMiniatura", TextBox25.Text) - SetupIni.AggiornaParametro("FontBold", CheckBox3.Checked) - SetupIni.AggiornaParametro("FontNome", ComboBox3.Text) - - - SetupIni.AggiornaParametro("TestoTesto", TextBox4.Text) - SetupIni.AggiornaParametro("TestoTrasparente", TextBox9.Text) - SetupIni.AggiornaParametro("TestoMargine", TextBox12.Text) - SetupIni.AggiornaParametro("TestoPosizione", ComboBox1.Text) - SetupIni.AggiornaParametro("TestoAllineamento", ComboBox2.Text) - - SetupIni.AggiornaParametro("MarchioFile", TextBox10.Text) - SetupIni.AggiornaParametro("MarchioAltezza", TextBox14.Text) - SetupIni.AggiornaParametro("MarchioLarghezza", TextBox15.Text) - SetupIni.AggiornaParametro("MarchioMargine", TextBox16.Text) - SetupIni.AggiornaParametro("MarchioAllOrizzontale", ComboBox4.Text) - SetupIni.AggiornaParametro("MarchioAllVerticale", ComboBox5.Text) - SetupIni.AggiornaParametro("MarchioTrasparenza", TextBox19.Text) - SetupIni.AggiornaParametro("MarchioAggiungi", CheckBox5.Checked) - - SetupIni.AggiornaParametro("TempoGara", CheckBox7.Checked) - SetupIni.AggiornaParametro("Orario", CheckBox8.Checked) - SetupIni.AggiornaParametro("EtichettaOrario", TextBox18.Text) - - SetupIni.AggiornaParametro("GeneraleForzaJpg", CheckBox9.Checked) - SetupIni.AggiornaParametro("GeneraleRotazioneAutomatica", CheckBox10.Checked) - SetupIni.AggiornaParametro("GrandezzaVerticale", TextBox30.Text) - SetupIni.AggiornaParametro("MargineVerticale", TextBox31.Text) - SetupIni.AggiornaParametro("DimensioniOriginali", CheckBox15.Checked) - SetupIni.AggiornaParametro("TestoVerticale", TextBox29.Text) - SetupIni.AggiornaParametro("NomeMiniatura", RadioButton6.Checked) - SetupIni.AggiornaParametro("DataFoto", CheckBox16.Checked) - SetupIni.AggiornaParametro("NumeroFoto", CheckBox17.Checked) - - SetupIni.AggiornaParametro("ColoreTestoRGB", TextBox34.Text) - - SetupIni.AggiornaParametro("TempoSmall", RadioButton5.Checked) - SetupIni.AggiornaParametro("NumTempoSmall", RadioButton7.Checked) - - SetupIni.AggiornaParametro("CompressioneJpeg", TextBox32.Text) - SetupIni.AggiornaParametro("CompressioneJpegMiniatura", TextBox33.Text) - SetupIni.SalvaParametriSetup() - Me.Text = "Image Catalog - " & LeggiSoloNomeFile(IlNome) - End If - End Sub - - Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click - Dim openFileDialog As OpenFileDialog = New OpenFileDialog - - 'openFileDialog.InitialDirectory = TextBox1.Text - openFileDialog.Filter = "Setup (*.xml)|*.xml|All valid files (*.*)|*.*" - openFileDialog.FilterIndex = 0 - openFileDialog.RestoreDirectory = True - - If DialogResult.OK = openFileDialog.ShowDialog() Then - Dim IlNome As String = openFileDialog.FileName - - SetupIni.NomeFileSetup = IlNome - SetupIni.CaricaParametriSetup() - - TextBox1.Text = SetupIni.LeggiParametroString("DirSorgente") - TextBox2.Text = SetupIni.LeggiParametroString("DirDestinazione") - CheckBox6.Checked = SetupIni.LeggiParametroBoolean("DirSottoDirectory") - - CheckBox11.Checked = SetupIni.LeggiParametroBoolean("DirDividiDestinazione") - TextBox17.Text = SetupIni.LeggiParametroString("DirDividiNumFile") - TextBox20.Text = SetupIni.LeggiParametroString("DirDividiSuffisso") - TextBox21.Text = SetupIni.LeggiParametroString("DirDividiNumCifre") - - Dim TestoTemp As String = SetupIni.LeggiParametroString("DirDividiTipoNumerazione") - If TestoTemp.ToUpper = "PROGRESSIVA" Then - RadioButton1.Checked = True - Else - RadioButton2.Checked = True - End If - - CheckBox1.Checked = SetupIni.LeggiParametroBoolean("MiniatureCrea") - TextBox3.Text = SetupIni.LeggiParametroString("MiniatureSuffisso") - TextBox5.Text = SetupIni.LeggiParametroString("MiniatureAltezza") - TextBox6.Text = SetupIni.LeggiParametroString("MiniatureLarghezza") - RadioButton3.Checked = SetupIni.LeggiParametroBoolean("MiniatureAddScritta") - RadioButton4.Checked = SetupIni.LeggiParametroBoolean("MiniatureAddOrario") - - TextBox27.Text = SetupIni.LeggiParametroString("FotoAltezza") - TextBox28.Text = SetupIni.LeggiParametroString("FotoLarghezza") - TextBox13.Text = SetupIni.LeggiParametroString("FotoCodice") - CheckBox2.Checked = SetupIni.LeggiParametroBoolean("FotoDimOriginali") - - TextBox11.Text = SetupIni.LeggiParametroString("FontDimensione") - TextBox25.Text = SetupIni.LeggiParametroString("FontDimensioneMiniatura") - CheckBox3.Checked = SetupIni.LeggiParametroBoolean("FontBold") - ComboBox3.Text = SetupIni.LeggiParametroString("FontNome") - - If TextBox25.Text = "" Then - TextBox25.Text = "0" - End If - - TextBox4.Text = SetupIni.LeggiParametroString("TestoTesto") - TextBox9.Text = SetupIni.LeggiParametroString("TestoTrasparente") - TextBox12.Text = SetupIni.LeggiParametroString("TestoMargine") - ComboBox1.Text = SetupIni.LeggiParametroString("TestoPosizione") - ComboBox2.Text = SetupIni.LeggiParametroString("TestoAllineamento") - - TextBox10.Text = SetupIni.LeggiParametroString("MarchioFile") - TextBox14.Text = SetupIni.LeggiParametroString("MarchioAltezza") - TextBox15.Text = SetupIni.LeggiParametroString("MarchioLarghezza") - TextBox16.Text = SetupIni.LeggiParametroString("MarchioMargine") - ComboBox4.Text = SetupIni.LeggiParametroString("MarchioAllOrizzontale") - ComboBox5.Text = SetupIni.LeggiParametroString("MarchioAllVerticale") - TextBox19.Text = SetupIni.LeggiParametroString("MarchioTrasparenza") - CheckBox5.Checked = SetupIni.LeggiParametroBoolean("MarchioAggiungi") - - CheckBox7.Checked = SetupIni.LeggiParametroBoolean("TempoGara") - CheckBox8.Checked = SetupIni.LeggiParametroBoolean("Orario") - TextBox18.Text = SetupIni.LeggiParametroString("EtichettaOrario") - - CheckBox9.Checked = SetupIni.LeggiParametroBoolean("GeneraleForzaJpg") - CheckBox10.Checked = SetupIni.LeggiParametroBoolean("GeneraleRotazioneAutomatica") - - TextBox30.Text = SetupIni.LeggiParametroString("GrandezzaVerticale") - TextBox31.Text = SetupIni.LeggiParametroString("MargineVerticale") - CheckBox15.Checked = SetupIni.LeggiParametroBoolean("DimensioniOriginali") - TextBox29.Text = SetupIni.LeggiParametroString("TestoVerticale") - RadioButton6.Checked = SetupIni.LeggiParametroBoolean("NomeMiniatura") - CheckBox16.Checked = SetupIni.LeggiParametroBoolean("DataFoto") - CheckBox17.Checked = SetupIni.LeggiParametroBoolean("NumeroFoto") - - - RadioButton5.Checked = SetupIni.LeggiParametroBoolean("TempoSmall") - RadioButton7.Checked = SetupIni.LeggiParametroBoolean("NumTempoSmall") - - TextBox32.Text = SetupIni.LeggiParametroString("CompressioneJpeg") - TextBox33.Text = SetupIni.LeggiParametroString("CompressioneJpegMiniatura") - - TextBox34.Text = SetupIni.LeggiParametroString("ColoreTestoRGB") - If File.Exists(TextBox10.Text) Then - - - PictureBox1.Image = Image.FromFile(TextBox10.Text) - If PictureBox1.Image.Height >= PictureBox1.Image.Width Then - PictureBox1.Height = 160 - PictureBox1.Width = CType(160 * PictureBox1.Image.Width / PictureBox1.Image.Height, Integer) - Else - PictureBox1.Width = 224 - PictureBox1.Height = CType(224 * PictureBox1.Image.Height / PictureBox1.Image.Width, Integer) - End If - End If - Me.Text = "Image Catalog - " & LeggiSoloNomeFile(IlNome) - End If - End Sub - - Private Sub setPicSettings(ByVal SourcePath As String, ByVal DestPath As String) - - Dim SourceDir As DirectoryInfo = New DirectoryInfo(SourcePath) - Dim DestDirStart As DirectoryInfo = New DirectoryInfo(DestPath) - Dim DestDir As DirectoryInfo = Nothing - - - - PicSettings.DirectorySorgente = TextBox1.Text - PicSettings.DirectoryDestinazione = TextBox2.Text - - 'PicSettings.DestDir = DestDir - 'PicSettings.SourceDir = SourceDir - 'PicSettings.DestDirStart = DestDirStart - - PicSettings.DimStandard = CType(TextBox11.Text, Integer) - PicSettings.DimStandardMiniatura = CType(TextBox25.Text, Integer) - - PicSettings.UsaOrarioMiniatura = CheckBox12.Checked - PicSettings.UsaOrarioTestoApplicare = CheckBox8.Checked - PicSettings.UsaTempoGaraTestoApplicare = CheckBox7.Checked - - PicSettings.UsaRotazioneAutomatica = CheckBox10.Checked - PicSettings.UsaForzaJpg = CheckBox9.Checked - - If CheckBox17.Checked Then - PicSettings.TestoNome = True - Else - PicSettings.TestoNome = False - - End If - - If CheckBox16.Checked Then - PicSettings.NomeData = True - Else - PicSettings.NomeData = False - End If - PicSettings.TestoFirmaStart = TextBox4.Text - PicSettings.TestoFirmaStartV = TextBox29.Text - - PicSettings.DataPartenza = DateTimePicker1.Value - PicSettings.TestoOrario = TextBox18.Text - - PicSettings.AltezzaSmall = CType(TextBox5.Text, Integer) - PicSettings.LarghezzaSmall = CType(TextBox5.Text, Integer) - - PicSettings.CreaMiniature = CheckBox1.Checked - PicSettings.AggiungiScritteMiniature = RadioButton3.Checked - PicSettings.AggTempoGaraMin = RadioButton5.Checked - PicSettings.AggNumTempMin = RadioButton7.Checked - - - PicSettings.DimVert = CType(TextBox30.Text, Integer) - PicSettings.MargVert = CType(TextBox31.Text, Integer) - - 'PicSettings.NomeFileChild = childFile.Name - PicSettings.Suffisso = TextBox3.Text - PicSettings.Codice = TextBox13.Text - - PicSettings.Trasparenza = CType(TextBox9.Text, Integer) - PicSettings.IlFont = ComboBox3.SelectedItem.ToString - PicSettings.Grassetto = CheckBox3.Checked - - PicSettings.Posizione = ComboBox1.SelectedItem.ToString - PicSettings.Allineamento = ComboBox2.SelectedItem.ToString - PicSettings.Margine = CType(TextBox12.Text, Integer) - - PicSettings.LogoAltezza = CType(TextBox14.Text, Integer) - PicSettings.LogoLarghezza = CType(TextBox15.Text, Integer) - - PicSettings.fontColoreRGB = ColorTranslator.FromHtml(TextBox34.Text) - - PicSettings.LogoAggiungi = CheckBox5.Checked - PicSettings.LogoNomeFile = TextBox10.Text - PicSettings.LogoTrasparenza = TextBox19.Text - PicSettings.LogoMargine = TextBox16.Text - PicSettings.LogoPosizioneH = ComboBox4.Text - PicSettings.LogoPosizioneV = ComboBox5.Text - - PicSettings.FotoGrandeDimOrigina = CheckBox15.Checked - PicSettings.AltezzaBig = CType(TextBox27.Text, Integer) - PicSettings.LarghezzaBig = CType(TextBox28.Text, Integer) - PicSettings.DimMin = CType(TextBox25.Text, Integer) - - PicSettings.TestoMin = RadioButton6.Checked - - PicSettings.jpegQuality = CLng(TextBox32.Text) - PicSettings.jpegQualityMin = CLng(TextBox33.Text) - - 'PicSettings.mainForm = Me - - - End Sub - - Private Function makeFilesList(ByVal SourcePath As String) As List(Of List(Of FileInfo)) - Dim SourceDir As DirectoryInfo = New DirectoryInfo(SourcePath) - - Dim DestDir As DirectoryInfo = Nothing - Dim NumFileXDir As Integer = CType(TextBox17.Text, Integer) - Dim SuffixDir As String = TextBox20.Text - Dim NumCifreDir As Integer = CType(TextBox21.Text, Integer) - Dim DividiFile As Boolean = False - - StopAttivo = False - - Dim FileConta As Integer = 0 - Dim ContaFileXDir As Integer = 0 - Dim ContaDirXDir As Integer = 0 - Dim TestoTemp As String = "" - Dim ContaTemp As Integer = 0 - - Dim picList As New List(Of FileInfo) - Dim dirList As New List(Of List(Of FileInfo)) - - - 'controlla directory principale - 'Dim childFile As FileInfo - 'For Each childFile In SourceDir.GetFiles("*.jpg") - ' picList.Add(childFile) - 'Next - - picList = getFiles(SourceDir) - - dirList.Add(picList) - - 'controlla sottodirectory - If CheckBox6.Checked = True Then - Dim subDir As DirectoryInfo - For Each subDir In SourceDir.GetDirectories() - Dim filesList As New List(Of FileInfo) - filesList = getFiles(subDir) - dirList.Add(filesList) - Next - End If - - Return dirList - End Function - - Private Function getFiles(sourceDir As DirectoryInfo) As List(Of FileInfo) - Dim picList As New List(Of FileInfo) - Dim childFile As FileInfo - For Each childFile In sourceDir.GetFiles("*.jpg") - picList.Add(childFile) - Next - Return picList - End Function - - Private Function dividiLista(SourcePath As String, lista As List(Of List(Of FileInfo))) As List(Of List(Of FileInfo)) - Dim SourceDir As DirectoryInfo = New DirectoryInfo(SourcePath) - - Dim NumFileXDir As Integer = CType(TextBox17.Text, Integer) - Dim SuffixDir As String = TextBox20.Text - Dim NumCifreDir As Integer = CType(TextBox21.Text, Integer) - Dim DividiFile As Boolean = False - - Dim FileConta As Integer = 0 - Dim ContaFileXDir As Integer = 0 - Dim ContaDirXDir As Integer = 0 - Dim TestoTemp As String = "" - Dim ContaTemp As Integer = 0 - - If NumFileXDir > 0 And CheckBox11.Checked = True Then - If FileConta > NumFileXDir Then - DividiFile = True - Else - - End If - - End If - - End Function - - Private Sub setLabel17Text(ByVal text As String) - If Label17.InvokeRequired Then - Label17.Invoke(New Action(Of String)(AddressOf setLabel17Text), text) - Else - Label17.Text = text - - End If - End Sub - Public Sub stepProgressBar() - If ProgressBar1.InvokeRequired Then - ProgressBar1.Invoke(New MethodInvoker(AddressOf ProgressBar1.PerformStep)) - Else - ProgressBar1.PerformStep() - End If - setLabel18Text(ProgressBar1.Value.ToString) - End Sub - Private Sub setLabel10Text(ByVal text As String) - If Label10.InvokeRequired Then - Label10.Invoke(New Action(Of String)(AddressOf setLabel10Text), text) - Else - Label10.Text = text - - End If - End Sub - - Private Sub setProgressBarMaximum(ByVal value As Integer) - If ProgressBar1.InvokeRequired Then - ProgressBar1.Invoke(New Action(Of Integer)(AddressOf setProgressBarMaximum), value) - Else - ProgressBar1.Maximum = value - - End If - End Sub - - Private Sub setProgressBarValue(ByVal value As Integer) - If ProgressBar1.InvokeRequired Then - ProgressBar1.Invoke(New Action(Of Integer)(AddressOf setProgressBarValue), value) - Else - ProgressBar1.Value = value - - End If - End Sub - - Private Sub setLabel18Text(ByVal text As String) - If Label18.InvokeRequired Then - Label18.Invoke(New Action(Of String)(AddressOf setLabel18Text), text) - Else - Label18.Text = text - - End If - End Sub - - Private Sub setLabel43Text(ByVal text As String) - If Label43.InvokeRequired Then - Label43.Invoke(New Action(Of String)(AddressOf setLabel43Text), text) - Else - Label43.Text = text - - End If - End Sub - - Private Sub creaImmaginiWithThreadMod(ByVal SourcePath As String, ByVal DestPath As String) - Dim SourceDir As DirectoryInfo = New DirectoryInfo(SourcePath) - Dim DestDirStart As DirectoryInfo = New DirectoryInfo(DestPath) - Dim DestDir As DirectoryInfo = Nothing - Dim NumFileXDir As Integer = CType(TextBox17.Text, Integer) - Dim SuffixDir As String = TextBox20.Text - Dim NumCifreDir As Integer = CType(TextBox21.Text, Integer) - Dim DividiFile As Boolean = False - - StopAttivo = False - - Dim FileConta As Integer = 0 - Dim ContaFileXDir As Integer = 0 - Dim ContaDirXDir As Integer = 0 - Dim TestoTemp As String = "" - Dim ContaTemp As Integer = 0 - - - - If SourceDir.Exists Then - FileConta = SourceDir.GetFiles("*.jpg").GetLength(0) - 'Label17.Text = (CType(Label17.Text, Integer) + FileConta).ToString - Dim a As String = (CType(Label17.Text, Integer) + FileConta).ToString - setLabel17Text(a) - - setProgressBarMaximum(CInt(a)) - - If NumFileXDir > 0 And CheckBox11.Checked = True Then - If FileConta > NumFileXDir Then - DividiFile = True - Else - DestDir = DestDirStart - If Not DestDir.Exists Then - DestDir.Create() - End If - DividiFile = False - End If - Else - DestDir = DestDirStart - If Not DestDir.Exists Then - DestDir.Create() - End If - DividiFile = False - End If - - Dim childFile As FileInfo - For Each childFile In SourceDir.GetFiles("*.jpg") - If StopAttivo = True Then - Exit For - End If - setLabel10Text("File: " & childFile.Name) - Dim b As String = (CType(Label18.Text, Integer) + 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 Then - If ContaFileXDir = (ContaDirXDir * NumFileXDir) + 1 Then - ContaDirXDir += 1 - - If RadioButton1.Checked = True Then - TestoTemp = ContaDirXDir.ToString - Else - TestoTemp = (ContaDirXDir * NumFileXDir).ToString - End If - For ContaTemp = 1 To (NumCifreDir - TestoTemp.Length) - TestoTemp = "0" & TestoTemp - Next - - If DestDirStart.FullName.EndsWith("\") Then - DestDir = New DirectoryInfo(DestDirStart.FullName & SuffixDir & TestoTemp) - Else - DestDir = New DirectoryInfo(DestDirStart.FullName & "\" & SuffixDir & TestoTemp) - End If - - If Not DestDir.Exists Then - DestDir.Create() - End If - End If - End If - - 'Application.DoEvents() - - - - Dim ClsCreaImmagine As New ImageCreator - ClsCreaImmagine.NomeFileChild = childFile.Name - ClsCreaImmagine.DestDir = DestDir - ClsCreaImmagine.SourceDir = SourceDir - ClsCreaImmagine.DestDirStart = DestDirStart - - ContaImmaginiThread += 1 - MyPool.InsertWorkItem(childFile.Name, New XyThreadAdd(AddressOf ClsCreaImmagine.CreaImmagineThread), New Object(0) {childFile.Name}, True) - Next - ' copy all the sub-directories by recursively calling this same routine - If CheckBox6.Checked = True Then - Dim subDir As DirectoryInfo - For Each subDir In SourceDir.GetDirectories() - creaImmaginiWithThreadMod(subDir.FullName, Path.Combine(DestDir.FullName, subDir.Name)) - Next - End If - End If - End Sub - - 'il posto giusto dove fare modifiche - Private Sub CreaImmaginiWithThread(ByVal SourcePath As String, ByVal DestPath As String) - Dim SourceDir As DirectoryInfo = New DirectoryInfo(SourcePath) - Dim DestDirStart As DirectoryInfo = New DirectoryInfo(DestPath) - Dim DestDir As DirectoryInfo = Nothing - Dim NumFileXDir As Integer = CType(TextBox17.Text, Integer) - Dim SuffixDir As String = TextBox20.Text - Dim NumCifreDir As Integer = CType(TextBox21.Text, Integer) - Dim DividiFile As Boolean = False - - StopAttivo = False - - Dim FileConta As Integer = 0 - Dim ContaFileXDir As Integer = 0 - Dim ContaDirXDir As Integer = 0 - Dim TestoTemp As String = "" - Dim ContaTemp As Integer = 0 - - - - If SourceDir.Exists Then - FileConta = SourceDir.GetFiles("*.jpg").GetLength(0) - Label17.Text = (CType(Label17.Text, Integer) + FileConta).ToString - - If NumFileXDir > 0 And CheckBox11.Checked = True Then - If FileConta > NumFileXDir Then - DividiFile = True - Else - DestDir = DestDirStart - If Not DestDir.Exists Then - DestDir.Create() - End If - DividiFile = False - End If - Else - DestDir = DestDirStart - If Not DestDir.Exists Then - DestDir.Create() - End If - DividiFile = False - End If - - Dim childFile As FileInfo - For Each childFile In SourceDir.GetFiles("*.jpg") - If StopAttivo = True Then - Exit For - End If - 'Label10.Text = "File: " & childFile.Name - 'Label18.Text = (CType(Label18.Text, Integer) + 1).ToString - 'Application.DoEvents() - - ContaFileXDir += 1 - - If DividiFile = True Then - If ContaFileXDir = (ContaDirXDir * NumFileXDir) + 1 Then - ContaDirXDir += 1 - - If RadioButton1.Checked = True Then - TestoTemp = ContaDirXDir.ToString - Else - TestoTemp = (ContaDirXDir * NumFileXDir).ToString - End If - For ContaTemp = 1 To (NumCifreDir - TestoTemp.Length) - TestoTemp = "0" & TestoTemp - Next - - If DestDirStart.FullName.EndsWith("\") Then - DestDir = New DirectoryInfo(DestDirStart.FullName & SuffixDir & TestoTemp) - Else - DestDir = New DirectoryInfo(DestDirStart.FullName & "\" & SuffixDir & TestoTemp) - End If - - If Not DestDir.Exists Then - DestDir.Create() - End If - End If - End If - - Application.DoEvents() - Dim ClsCreaImmagine As New CreaImmagineSeparateThread - - ClsCreaImmagine.DirectorySorgente = TextBox1.Text - ClsCreaImmagine.DirectoryDestinazione = TextBox2.Text - - ClsCreaImmagine.DestDir = DestDir - ClsCreaImmagine.SourceDir = SourceDir - ClsCreaImmagine.DestDirStart = DestDirStart - - ClsCreaImmagine.DimStandard = CType(TextBox11.Text, Integer) - ClsCreaImmagine.DimStandardMiniatura = CType(TextBox25.Text, Integer) - - ClsCreaImmagine.UsaOrarioMiniatura = CheckBox12.Checked - ClsCreaImmagine.UsaOrarioTestoApplicare = CheckBox8.Checked - ClsCreaImmagine.UsaTempoGaraTestoApplicare = CheckBox7.Checked - - ClsCreaImmagine.UsaRotazioneAutomatica = CheckBox10.Checked - ClsCreaImmagine.UsaForzaJpg = CheckBox9.Checked - - If CheckBox17.Checked Then - ClsCreaImmagine.TestoNome = True - Else - ClsCreaImmagine.TestoNome = False - - End If - - If CheckBox16.Checked Then - ClsCreaImmagine.NomeData = True - Else - ClsCreaImmagine.NomeData = False - End If - ClsCreaImmagine.TestoFirmaStart = TextBox4.Text - ClsCreaImmagine.TestoFirmaStartV = TextBox29.Text - - ClsCreaImmagine.DataPartenza = DateTimePicker1.Value - ClsCreaImmagine.TestoOrario = TextBox18.Text - - ClsCreaImmagine.AltezzaSmall = CType(TextBox5.Text, Integer) - ClsCreaImmagine.LarghezzaSmall = CType(TextBox5.Text, Integer) - - ClsCreaImmagine.CreaMiniature = CheckBox1.Checked - ClsCreaImmagine.AggiungiScritteMiniature = RadioButton3.Checked - ClsCreaImmagine.AggTempoGaraMin = RadioButton5.Checked - ClsCreaImmagine.AggNumTempMin = RadioButton7.Checked - - - ClsCreaImmagine.DimVert = CType(TextBox30.Text, Integer) - ClsCreaImmagine.MargVert = CType(TextBox31.Text, Integer) - - ClsCreaImmagine.NomeFileChild = childFile.Name - ClsCreaImmagine.Suffisso = TextBox3.Text - ClsCreaImmagine.Codice = TextBox13.Text - - ClsCreaImmagine.Trasparenza = CType(TextBox9.Text, Integer) - ClsCreaImmagine.IlFont = ComboBox3.SelectedItem.ToString - ClsCreaImmagine.Grassetto = CheckBox3.Checked - - ClsCreaImmagine.Posizione = ComboBox1.SelectedItem.ToString - ClsCreaImmagine.Allineamento = ComboBox2.SelectedItem.ToString - ClsCreaImmagine.Margine = CType(TextBox12.Text, Integer) - - ClsCreaImmagine.LogoAltezza = CType(TextBox14.Text, Integer) - ClsCreaImmagine.LogoLarghezza = CType(TextBox15.Text, Integer) - - '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 = CType(TextBox27.Text, Integer) - ClsCreaImmagine.LarghezzaBig = CType(TextBox28.Text, Integer) - ClsCreaImmagine.DimMin = CType(TextBox25.Text, Integer) - - ClsCreaImmagine.TestoMin = RadioButton6.Checked - - ClsCreaImmagine.jpegQuality = CLng(TextBox32.Text) - ClsCreaImmagine.jpegQuality = CLng(TextBox33.Text) - - ContaImmaginiThread += 1 - MyPool.InsertWorkItem(childFile.Name, New XyThreadAdd(AddressOf ClsCreaImmagine.CreaImmagineThread), New Object(0) {childFile.Name}, True) - Next - ' copy all the sub-directories by recursively calling this same routine - If CheckBox6.Checked = True Then - Dim subDir As DirectoryInfo - For Each subDir In SourceDir.GetDirectories() - CreaImmaginiWithThread(subDir.FullName, Path.Combine(DestDir.FullName, subDir.Name)) - Next - End If - End If - End Sub - - Private Sub CopyDirectoryFile(ByVal SourcePath As String, ByVal DestPath As String, Optional ByVal OverWrite As Boolean = False) - Dim SourceDir As DirectoryInfo = New DirectoryInfo(SourcePath) - Dim DestDir As DirectoryInfo = New DirectoryInfo(DestPath) - - If SourceDir.Exists Then - If Not DestDir.Exists Then - DestDir.Create() - End If - ' copy all the files of the current directory - Dim childFile As FileInfo - For Each childFile In SourceDir.GetFiles() - If OverWrite Then - childFile.CopyTo(Path.Combine(DestDir.FullName, childFile.Name), True) - Else - ' if overwrite = false, copy the file only if it does not exist - ' this is done to avoid an IOException if a file already exists - ' this way the other files can be copied anyway... - If Not File.Exists(Path.Combine(DestDir.FullName, childFile.Name)) Then - childFile.CopyTo(Path.Combine(DestDir.FullName, childFile.Name), False) - End If - End If - Next - ' copy all the sub-directories by recursively calling this same routine - Dim subDir As DirectoryInfo - For Each subDir In SourceDir.GetDirectories() - CopyDirectoryFile(subDir.FullName, Path.Combine(DestDir.FullName, subDir.Name), OverWrite) - Next - End If - End Sub - - - - - - Function NewthumbSize(ByVal currentwidth As Integer, ByVal currentheight As Integer, ByVal MaxPixel As Integer, ByVal TipoSize As String) As Size - ' Calculate the Size of the New image - '*** Larghezza, Altezza, Auto - - Dim tempMultiplier As Double - - If TipoSize.ToUpper = "Larghezza".ToUpper Then - tempMultiplier = MaxPixel / currentwidth - ElseIf TipoSize.ToUpper = "Altezza".ToUpper Then - tempMultiplier = MaxPixel / currentheight - Else - If currentheight > currentwidth Then ' portrait - tempMultiplier = MaxPixel / currentheight - Else - tempMultiplier = MaxPixel / currentwidth - End If - End If - - Dim NewSize As New Size(CInt(currentwidth * tempMultiplier), CInt(currentheight * tempMultiplier)) - - Return NewSize - End Function - - - - Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click - StopAttivo = True - - MyPool.StopThreadPool() - unlockUI() - - End Sub - - Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click - Dim openFileDialog As OpenFileDialog = New OpenFileDialog - - 'openFileDialog.InitialDirectory = TextBox1.Text - openFileDialog.Filter = "Immagini jpg (*.jpg)|*.jpg|Immagini gif (*.gif)|*.gif|Tutti i file (*.*)|*.*" - If TextBox10.Text.Length > 0 Then - openFileDialog.FileName = TextBox10.Text - End If - openFileDialog.FilterIndex = 0 - openFileDialog.RestoreDirectory = True - - If DialogResult.OK = openFileDialog.ShowDialog() Then - TextBox10.Text = openFileDialog.FileName - PictureBox1.Image = Image.FromFile(TextBox10.Text) - If PictureBox1.Image.Height >= PictureBox1.Image.Width Then - PictureBox1.Height = 160 - PictureBox1.Width = CType(160 * PictureBox1.Image.Width / PictureBox1.Image.Height, Integer) - Else - PictureBox1.Width = 224 - PictureBox1.Height = CType(224 * PictureBox1.Image.Height / PictureBox1.Image.Width, Integer) - End If - End If - End Sub - - Private Function LeggiSoloNomeFile(ByVal FileName As String) As String - Dim Testo As String = FileName - Dim Risposta As String = "" - - Dim Nomi() As String = Testo.Split(New Char() {"\"c}) - If Nomi.Length > 1 Then - Risposta = Nomi(Nomi.Length - 1) - End If - - Return Risposta - End Function - - - Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove - 'GetColor() - 'GetPixelColor(PictureBox1.PointToScreen(e.Location)).ToArgb.ToString("X8") - - End Sub - - Private Sub PictureBox1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseUp - If e.Button = MouseButtons.Left Then - WaterSelectColor = True - Else - WaterSelectColor = False - End If - End Sub - - - '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 - - - '''' - '''' Get the color relative to mouse position - '''' - '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 Function GetPixelColor(ByVal screenLocation As Point) As Color() - 'Dim bm As New Bitmap(1, 1, Imaging.PixelFormat.Format24bppRgb) - 'Dim g As Graphics = Graphics.FromImage(bm) - 'g.CopyFromScreen(screenLocation, New Point(0, 0), New Size(1, 1)) - 'Dim result As Color = bm.GetPixel(0, 0) - 'g.Dispose() - 'bm.Dispose() - 'Return result - Return Nothing - End Function - - Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click - Dim MyDialog As New ColorDialog - MyDialog.AllowFullOpen = True - 'If TextBox22.Text.Length > 0 And TextBox23.Text.Length > 0 And TextBox24.Text.Length > 0 Then - ' If CType(TextBox22.Text, Integer) >= 0 And CType(TextBox23.Text, Integer) >= 0 And CType(TextBox24.Text, Integer) >= 0 Then - ' MyDialog.Color = Color.FromArgb(0, CType(TextBox22.Text, Integer), CType(TextBox23.Text, Integer), CType(TextBox24.Text, Integer)) - ' End If - 'End If - - If (MyDialog.ShowDialog() = Windows.Forms.DialogResult.OK) Then - 'TextBox22.Text = MyDialog.Color.R.ToString - 'TextBox23.Text = MyDialog.Color.G.ToString - 'TextBox24.Text = MyDialog.Color.B.ToString - TextBox34.Text = ColorTranslator.ToHtml(MyDialog.Color) - TextBox34.BackColor = MyDialog.Color - - End If - End Sub - - - - - - - - Private Sub TextBox27_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) - - End Sub - - - - - Private Sub CheckBox18_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox18.CheckedChanged - CheckBox4.Checked = False - CheckBox12.Checked = False - - End Sub - - Private Sub CheckBox4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox4.CheckedChanged - CheckBox18.Checked = False - End Sub - - Private Sub CheckBox12_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox12.CheckedChanged - CheckBox18.Checked = False - End Sub - - -End Class - -Public Class PicInfoold - Public DirSource, DirDest, DirDestStart As DirectoryInfo - Public NomeImmagine As String - - Public Sub New(ByVal Dir_Source As DirectoryInfo, ByVal Dir_Dest As DirectoryInfo, ByVal Dir_DestStart As DirectoryInfo, ByVal Nome_Immagine As String) - DirSource = Dir_Source - DirDest = Dir_Dest - DirDestStart = Dir_DestStart - NomeImmagine = Nome_Immagine - End Sub -End Class \ No newline at end of file diff --git a/imagecatalog/ImageCatalog 2.csproj b/imagecatalog/ImageCatalog 2.csproj index d1a6ed8..635f432 100644 --- a/imagecatalog/ImageCatalog 2.csproj +++ b/imagecatalog/ImageCatalog 2.csproj @@ -55,5 +55,10 @@ Settings.settings + + + MainForm.cs + + \ No newline at end of file diff --git a/imagecatalog/MainForm.Designer.vb b/imagecatalog/MainForm.Designer.vb deleted file mode 100644 index 7c6943d..0000000 --- a/imagecatalog/MainForm.Designer.vb +++ /dev/null @@ -1,1956 +0,0 @@ - -Partial Class MainForm - Inherits System.Windows.Forms.Form - - 'Form overrides dispose to clean up the component list. - - Protected Overrides Sub Dispose(ByVal disposing As Boolean) - Try - If disposing AndAlso components IsNot Nothing Then - components.Dispose() - End If - Finally - MyBase.Dispose(disposing) - End Try - End Sub - - 'Required by the Windows Form Designer - Private components As System.ComponentModel.IContainer - - 'NOTE: The following procedure is required by the Windows Form Designer - 'It can be modified using the Windows Form Designer. - 'Do not modify it using the code editor. - - Private Sub InitializeComponent() - Me.ProgressBar1 = New System.Windows.Forms.ProgressBar() - Me.CheckBox22 = New System.Windows.Forms.CheckBox() - Me.Label43 = New System.Windows.Forms.Label() - Me.tabControl = New System.Windows.Forms.TabControl() - Me.tabGenerale = New System.Windows.Forms.TabPage() - Me.grpAvanzate = New System.Windows.Forms.GroupBox() - Me.Panel3 = New System.Windows.Forms.Panel() - Me.rdbNuovoMetodo = New System.Windows.Forms.RadioButton() - Me.rdbVecchioMetodo = New System.Windows.Forms.RadioButton() - Me.Label8 = New System.Windows.Forms.Label() - Me.TextBox8 = New System.Windows.Forms.TextBox() - Me.Label7 = New System.Windows.Forms.Label() - Me.TextBox7 = New System.Windows.Forms.TextBox() - Me.GroupBox3 = New System.Windows.Forms.GroupBox() - Me.chkAggiornaSottodirectory = New System.Windows.Forms.CheckBox() - Me.Button3 = New System.Windows.Forms.Button() - Me.Button2 = New System.Windows.Forms.Button() - Me.Label1 = New System.Windows.Forms.Label() - Me.Label2 = New System.Windows.Forms.Label() - Me.txtSorgente = New System.Windows.Forms.TextBox() - Me.txtDestinazione = New System.Windows.Forms.TextBox() - Me.grpSottocartelle = New System.Windows.Forms.GroupBox() - Me.rdbNumFiles = New System.Windows.Forms.RadioButton() - Me.rdbNumProgressiva = New System.Windows.Forms.RadioButton() - Me.txtCifreContatore = New System.Windows.Forms.TextBox() - Me.Label34 = New System.Windows.Forms.Label() - Me.txtSuffissoCartelle = New System.Windows.Forms.TextBox() - Me.Label33 = New System.Windows.Forms.Label() - Me.Label31 = New System.Windows.Forms.Label() - Me.chkCreaSottocartelle = New System.Windows.Forms.CheckBox() - Me.txtFilePerCartella = New System.Windows.Forms.TextBox() - Me.Label32 = New System.Windows.Forms.Label() - Me.grpGenerale = New System.Windows.Forms.GroupBox() - Me.chkSovrascriviFile = New System.Windows.Forms.CheckBox() - Me.chkRotazioneAutomatica = New System.Windows.Forms.CheckBox() - Me.chkForzaJpg = New System.Windows.Forms.CheckBox() - Me.tabTesto = New System.Windows.Forms.TabPage() - Me.CheckBox2 = New System.Windows.Forms.CheckBox() - Me.grpTestoFotoVerticali = New System.Windows.Forms.GroupBox() - Me.Label42 = New System.Windows.Forms.Label() - Me.Label41 = New System.Windows.Forms.Label() - Me.TextBox31 = New System.Windows.Forms.TextBox() - Me.TextBox30 = New System.Windows.Forms.TextBox() - Me.grpSlideShow = New System.Windows.Forms.GroupBox() - Me.CheckBox17 = New System.Windows.Forms.CheckBox() - Me.CheckBox16 = New System.Windows.Forms.CheckBox() - Me.grpCarattere = New System.Windows.Forms.GroupBox() - Me.TextBox34 = New System.Windows.Forms.TextBox() - Me.Button8 = New System.Windows.Forms.Button() - Me.Label36 = New System.Windows.Forms.Label() - Me.TextBox25 = New System.Windows.Forms.TextBox() - Me.Label35 = New System.Windows.Forms.Label() - Me.ComboBox3 = New System.Windows.Forms.ComboBox() - Me.TextBox11 = New System.Windows.Forms.TextBox() - Me.Label12 = New System.Windows.Forms.Label() - Me.Label11 = New System.Windows.Forms.Label() - Me.CheckBox3 = New System.Windows.Forms.CheckBox() - Me.GroupBox4 = New System.Windows.Forms.GroupBox() - Me.Label40 = New System.Windows.Forms.Label() - Me.TextBox29 = New System.Windows.Forms.TextBox() - Me.TextBox18 = New System.Windows.Forms.TextBox() - Me.Label26 = New System.Windows.Forms.Label() - Me.DateTimePicker1 = New System.Windows.Forms.DateTimePicker() - Me.CheckBox8 = New System.Windows.Forms.CheckBox() - Me.TextBox9 = New System.Windows.Forms.TextBox() - Me.CheckBox7 = New System.Windows.Forms.CheckBox() - Me.Label4 = New System.Windows.Forms.Label() - Me.TextBox4 = New System.Windows.Forms.TextBox() - Me.Label9 = New System.Windows.Forms.Label() - Me.Label13 = New System.Windows.Forms.Label() - Me.ComboBox1 = New System.Windows.Forms.ComboBox() - Me.ComboBox2 = New System.Windows.Forms.ComboBox() - Me.Label14 = New System.Windows.Forms.Label() - Me.TextBox12 = New System.Windows.Forms.TextBox() - Me.Label15 = New System.Windows.Forms.Label() - Me.tabFoto = New System.Windows.Forms.TabPage() - Me.GroupBox2 = New System.Windows.Forms.GroupBox() - Me.Label45 = New System.Windows.Forms.Label() - Me.TextBox32 = New System.Windows.Forms.TextBox() - Me.TextBox26 = New System.Windows.Forms.TextBox() - Me.Label37 = New System.Windows.Forms.Label() - Me.Label38 = New System.Windows.Forms.Label() - Me.TextBox27 = New System.Windows.Forms.TextBox() - Me.Label39 = New System.Windows.Forms.Label() - Me.TextBox28 = New System.Windows.Forms.TextBox() - Me.CheckBox15 = New System.Windows.Forms.CheckBox() - Me.tabMiniature = New System.Windows.Forms.TabPage() - Me.Panel1 = New System.Windows.Forms.Panel() - Me.CheckBox18 = New System.Windows.Forms.CheckBox() - Me.CheckBox4 = New System.Windows.Forms.CheckBox() - Me.CheckBox12 = New System.Windows.Forms.CheckBox() - Me.GroupBox1 = New System.Windows.Forms.GroupBox() - Me.Label46 = New System.Windows.Forms.Label() - Me.TextBox33 = New System.Windows.Forms.TextBox() - Me.Panel2 = New System.Windows.Forms.Panel() - Me.RadioButton3 = New System.Windows.Forms.RadioButton() - Me.RadioButton7 = New System.Windows.Forms.RadioButton() - Me.RadioButton4 = New System.Windows.Forms.RadioButton() - Me.RadioButton6 = New System.Windows.Forms.RadioButton() - Me.RadioButton5 = New System.Windows.Forms.RadioButton() - Me.Label5 = New System.Windows.Forms.Label() - Me.TextBox5 = New System.Windows.Forms.TextBox() - Me.Label6 = New System.Windows.Forms.Label() - Me.TextBox6 = New System.Windows.Forms.TextBox() - Me.Label3 = New System.Windows.Forms.Label() - Me.TextBox3 = New System.Windows.Forms.TextBox() - Me.CheckBox1 = New System.Windows.Forms.CheckBox() - Me.tabLogo = New System.Windows.Forms.TabPage() - Me.GroupBox6 = New System.Windows.Forms.GroupBox() - Me.PictureBox2 = New System.Windows.Forms.PictureBox() - Me.PictureBox1 = New System.Windows.Forms.PictureBox() - Me.ComboBox5 = New System.Windows.Forms.ComboBox() - Me.ComboBox4 = New System.Windows.Forms.ComboBox() - Me.TextBox19 = New System.Windows.Forms.TextBox() - Me.Label28 = New System.Windows.Forms.Label() - Me.CheckBox5 = New System.Windows.Forms.CheckBox() - Me.TextBox15 = New System.Windows.Forms.TextBox() - Me.TextBox14 = New System.Windows.Forms.TextBox() - Me.Label25 = New System.Windows.Forms.Label() - Me.TextBox16 = New System.Windows.Forms.TextBox() - Me.Label24 = New System.Windows.Forms.Label() - Me.Label22 = New System.Windows.Forms.Label() - Me.Label23 = New System.Windows.Forms.Label() - Me.Button4 = New System.Windows.Forms.Button() - Me.TextBox10 = New System.Windows.Forms.TextBox() - Me.Label29 = New System.Windows.Forms.Label() - Me.Label30 = New System.Windows.Forms.Label() - Me.PictureBox3 = New System.Windows.Forms.PictureBox() - Me.Label27 = New System.Windows.Forms.Label() - Me.Button7 = New System.Windows.Forms.Button() - Me.btnSalvaImpostazioni = New System.Windows.Forms.Button() - Me.Label20 = New System.Windows.Forms.Label() - Me.Label19 = New System.Windows.Forms.Label() - Me.Label18 = New System.Windows.Forms.Label() - Me.lblFotoTotaliNum = New System.Windows.Forms.Label() - Me.Label10 = New System.Windows.Forms.Label() - Me.btnCreaCatalogo = New System.Windows.Forms.Button() - Me.Button6 = New System.Windows.Forms.Button() - Me.btnCreaCatalogoAsync = New System.Windows.Forms.Button() - Me.TabControl1.SuspendLayout() - Me.TabPage5.SuspendLayout() - Me.GroupBox11.SuspendLayout() - Me.Panel3.SuspendLayout() - Me.GroupBox3.SuspendLayout() - Me.GroupBox8.SuspendLayout() - Me.GroupBox7.SuspendLayout() - Me.TabPage3.SuspendLayout() - Me.GroupBox10.SuspendLayout() - Me.GroupBox9.SuspendLayout() - Me.GroupBox5.SuspendLayout() - Me.GroupBox4.SuspendLayout() - Me.TabPage2.SuspendLayout() - Me.GroupBox2.SuspendLayout() - Me.TabPage1.SuspendLayout() - Me.Panel1.SuspendLayout() - Me.GroupBox1.SuspendLayout() - Me.Panel2.SuspendLayout() - Me.TabPage4.SuspendLayout() - Me.GroupBox6.SuspendLayout() - CType(Me.PictureBox2, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.PictureBox3, System.ComponentModel.ISupportInitialize).BeginInit() - Me.SuspendLayout() - ' - 'ProgressBar1 - ' - Me.ProgressBar1.Location = New System.Drawing.Point(719, 299) - Me.ProgressBar1.Margin = New System.Windows.Forms.Padding(4) - Me.ProgressBar1.Name = "ProgressBar1" - Me.ProgressBar1.Size = New System.Drawing.Size(256, 28) - Me.ProgressBar1.TabIndex = 67 - ' - 'CheckBox22 - ' - Me.CheckBox22.AutoSize = True - Me.CheckBox22.Location = New System.Drawing.Point(719, 441) - Me.CheckBox22.Margin = New System.Windows.Forms.Padding(4) - Me.CheckBox22.Name = "CheckBox22" - Me.CheckBox22.Size = New System.Drawing.Size(138, 21) - Me.CheckBox22.TabIndex = 65 - Me.CheckBox22.Text = "Arresta il sistema" - Me.CheckBox22.UseVisualStyleBackColor = True - ' - 'Label43 - ' - Me.Label43.AutoSize = True - Me.Label43.Location = New System.Drawing.Point(715, 421) - Me.Label43.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label43.Name = "Label43" - Me.Label43.Size = New System.Drawing.Size(32, 17) - Me.Label43.TabIndex = 64 - Me.Label43.Text = "000" - Me.Label43.TextAlign = System.Drawing.ContentAlignment.MiddleLeft - ' - 'tabControl - ' - Me.tabControl.Controls.Add(Me.tabGenerale) - Me.tabControl.Controls.Add(Me.tabTesto) - Me.tabControl.Controls.Add(Me.tabFoto) - Me.tabControl.Controls.Add(Me.tabMiniature) - Me.tabControl.Controls.Add(Me.tabLogo) - Me.tabControl.Location = New System.Drawing.Point(16, 15) - Me.tabControl.Margin = New System.Windows.Forms.Padding(4) - Me.tabControl.Name = "tabControl" - Me.tabControl.SelectedIndex = 0 - Me.tabControl.Size = New System.Drawing.Size(695, 464) - Me.tabControl.TabIndex = 63 - ' - 'tabGenerale - ' - Me.tabGenerale.Controls.Add(Me.grpAvanzate) - Me.tabGenerale.Controls.Add(Me.GroupBox3) - Me.tabGenerale.Controls.Add(Me.grpSottocartelle) - Me.tabGenerale.Controls.Add(Me.grpGenerale) - Me.tabGenerale.Location = New System.Drawing.Point(4, 25) - Me.tabGenerale.Margin = New System.Windows.Forms.Padding(4) - Me.tabGenerale.Name = "tabGenerale" - Me.tabGenerale.Padding = New System.Windows.Forms.Padding(4) - Me.tabGenerale.Size = New System.Drawing.Size(687, 435) - Me.tabGenerale.TabIndex = 4 - Me.tabGenerale.Text = "Generale" - Me.tabGenerale.UseVisualStyleBackColor = True - ' - 'grpAvanzate - ' - Me.grpAvanzate.Controls.Add(Me.Panel3) - Me.grpAvanzate.Controls.Add(Me.Label8) - Me.grpAvanzate.Controls.Add(Me.TextBox8) - Me.grpAvanzate.Controls.Add(Me.Label7) - Me.grpAvanzate.Controls.Add(Me.TextBox7) - Me.grpAvanzate.Location = New System.Drawing.Point(9, 257) - Me.grpAvanzate.Margin = New System.Windows.Forms.Padding(4) - Me.grpAvanzate.Name = "grpAvanzate" - Me.grpAvanzate.Padding = New System.Windows.Forms.Padding(4) - Me.grpAvanzate.Size = New System.Drawing.Size(255, 162) - Me.grpAvanzate.TabIndex = 48 - Me.grpAvanzate.TabStop = False - Me.grpAvanzate.Text = "Avanzate (ATTENZIONE)" - ' - 'Panel3 - ' - Me.Panel3.Controls.Add(Me.rdbNuovoMetodo) - Me.Panel3.Controls.Add(Me.rdbVecchioMetodo) - Me.Panel3.Location = New System.Drawing.Point(9, 90) - Me.Panel3.Margin = New System.Windows.Forms.Padding(4) - Me.Panel3.Name = "Panel3" - Me.Panel3.Size = New System.Drawing.Size(237, 65) - Me.Panel3.TabIndex = 4 - ' - 'rdbNuovoMetodo - ' - Me.rdbNuovoMetodo.AutoSize = True - Me.rdbNuovoMetodo.Checked = True - Me.rdbNuovoMetodo.Location = New System.Drawing.Point(11, 34) - Me.rdbNuovoMetodo.Margin = New System.Windows.Forms.Padding(4) - Me.rdbNuovoMetodo.Name = "rdbNuovoMetodo" - Me.rdbNuovoMetodo.Size = New System.Drawing.Size(121, 21) - Me.rdbNuovoMetodo.TabIndex = 1 - Me.rdbNuovoMetodo.TabStop = True - Me.rdbNuovoMetodo.Text = "Nuovo metodo" - Me.rdbNuovoMetodo.UseVisualStyleBackColor = True - ' - 'rdbVecchioMetodo - ' - Me.rdbVecchioMetodo.AutoSize = True - Me.rdbVecchioMetodo.Location = New System.Drawing.Point(11, 5) - Me.rdbVecchioMetodo.Margin = New System.Windows.Forms.Padding(4) - Me.rdbVecchioMetodo.Name = "rdbVecchioMetodo" - Me.rdbVecchioMetodo.Size = New System.Drawing.Size(130, 21) - Me.rdbVecchioMetodo.TabIndex = 0 - Me.rdbVecchioMetodo.Text = "Vecchio metodo" - Me.rdbVecchioMetodo.UseVisualStyleBackColor = True - ' - 'Label8 - ' - Me.Label8.AutoSize = True - Me.Label8.Location = New System.Drawing.Point(85, 32) - Me.Label8.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label8.Name = "Label8" - Me.Label8.Size = New System.Drawing.Size(111, 13) - Me.Label8.TabIndex = 3 - Me.Label8.Text = "Chunk Size (0 = MAX)" - ' - 'TextBox8 - ' - Me.TextBox8.Location = New System.Drawing.Point(9, 25) - Me.TextBox8.Margin = New System.Windows.Forms.Padding(4) - Me.TextBox8.Name = "TextBox8" - Me.TextBox8.Size = New System.Drawing.Size(61, 22) - Me.TextBox8.TabIndex = 2 - Me.TextBox8.Text = "0" - ' - 'Label7 - ' - Me.Label7.AutoSize = True - Me.Label7.Location = New System.Drawing.Point(81, 59) - Me.Label7.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label7.Name = "Label7" - Me.Label7.Size = New System.Drawing.Size(108, 13) - Me.Label7.TabIndex = 1 - Me.Label7.Text = "Threads (0 = CPU *2)" - ' - 'TextBox7 - ' - Me.TextBox7.Location = New System.Drawing.Point(9, 57) - Me.TextBox7.Margin = New System.Windows.Forms.Padding(4) - Me.TextBox7.Name = "TextBox7" - Me.TextBox7.Size = New System.Drawing.Size(61, 22) - Me.TextBox7.TabIndex = 0 - Me.TextBox7.Text = "0" - ' - 'GroupBox3 - ' - Me.GroupBox3.Controls.Add(Me.chkAggiornaSottodirectory) - Me.GroupBox3.Controls.Add(Me.Button3) - Me.GroupBox3.Controls.Add(Me.Button2) - Me.GroupBox3.Controls.Add(Me.Label1) - Me.GroupBox3.Controls.Add(Me.Label2) - Me.GroupBox3.Controls.Add(Me.txtSorgente) - Me.GroupBox3.Controls.Add(Me.txtDestinazione) - Me.GroupBox3.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer)) - Me.GroupBox3.Location = New System.Drawing.Point(8, 7) - Me.GroupBox3.Margin = New System.Windows.Forms.Padding(4) - Me.GroupBox3.Name = "GroupBox3" - Me.GroupBox3.Padding = New System.Windows.Forms.Padding(4) - Me.GroupBox3.Size = New System.Drawing.Size(661, 124) - Me.GroupBox3.TabIndex = 35 - Me.GroupBox3.TabStop = False - Me.GroupBox3.Text = "Directory" - ' - 'chkAggiornaSottodirectory - ' - Me.chkAggiornaSottodirectory.Checked = True - Me.chkAggiornaSottodirectory.CheckState = System.Windows.Forms.CheckState.Checked - Me.chkAggiornaSottodirectory.ForeColor = System.Drawing.Color.Black - Me.chkAggiornaSottodirectory.Location = New System.Drawing.Point(107, 79) - Me.chkAggiornaSottodirectory.Margin = New System.Windows.Forms.Padding(4) - Me.chkAggiornaSottodirectory.Name = "chkAggiornaSottodirectory" - Me.chkAggiornaSottodirectory.Size = New System.Drawing.Size(203, 30) - Me.chkAggiornaSottodirectory.TabIndex = 25 - Me.chkAggiornaSottodirectory.Text = "aggiorna le sottodirectory" - ' - 'Button3 - ' - Me.Button3.Location = New System.Drawing.Point(616, 49) - Me.Button3.Margin = New System.Windows.Forms.Padding(4) - Me.Button3.Name = "Button3" - Me.Button3.Size = New System.Drawing.Size(32, 25) - Me.Button3.TabIndex = 6 - Me.Button3.Text = "..." - ' - 'Button2 - ' - Me.Button2.Location = New System.Drawing.Point(616, 20) - Me.Button2.Margin = New System.Windows.Forms.Padding(4) - Me.Button2.Name = "Button2" - Me.Button2.Size = New System.Drawing.Size(32, 25) - Me.Button2.TabIndex = 5 - Me.Button2.Text = "..." - ' - 'Label1 - ' - Me.Label1.AutoSize = True - Me.Label1.ForeColor = System.Drawing.Color.Black - Me.Label1.Location = New System.Drawing.Point(8, 23) - Me.Label1.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label1.Name = "Label1" - Me.Label1.Size = New System.Drawing.Size(66, 17) - Me.Label1.TabIndex = 3 - Me.Label1.Text = "Sorgente" - ' - 'Label2 - ' - Me.Label2.AutoSize = True - Me.Label2.ForeColor = System.Drawing.Color.Black - Me.Label2.Location = New System.Drawing.Point(8, 53) - Me.Label2.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label2.Name = "Label2" - Me.Label2.Size = New System.Drawing.Size(90, 17) - Me.Label2.TabIndex = 4 - Me.Label2.Text = "Destinazione" - ' - 'txtSorgente - ' - Me.txtSorgente.Location = New System.Drawing.Point(107, 20) - Me.txtSorgente.Margin = New System.Windows.Forms.Padding(4) - Me.txtSorgente.Name = "txtSorgente" - Me.txtSorgente.Size = New System.Drawing.Size(500, 22) - Me.txtSorgente.TabIndex = 0 - Me.txtSorgente.Text = "TextBox1" - ' - 'txtDestinazione - ' - Me.txtDestinazione.Location = New System.Drawing.Point(107, 49) - Me.txtDestinazione.Margin = New System.Windows.Forms.Padding(4) - Me.txtDestinazione.Name = "txtDestinazione" - Me.txtDestinazione.Size = New System.Drawing.Size(500, 22) - Me.txtDestinazione.TabIndex = 1 - Me.txtDestinazione.Text = "TextBox2" - ' - 'grpSottocartelle - ' - Me.grpSottocartelle.Controls.Add(Me.rdbNumFiles) - Me.grpSottocartelle.Controls.Add(Me.rdbNumProgressiva) - Me.grpSottocartelle.Controls.Add(Me.txtCifreContatore) - Me.grpSottocartelle.Controls.Add(Me.Label34) - Me.grpSottocartelle.Controls.Add(Me.txtSuffissoCartelle) - Me.grpSottocartelle.Controls.Add(Me.Label33) - Me.grpSottocartelle.Controls.Add(Me.Label31) - Me.grpSottocartelle.Controls.Add(Me.chkCreaSottocartelle) - Me.grpSottocartelle.Controls.Add(Me.txtFilePerCartella) - Me.grpSottocartelle.Controls.Add(Me.Label32) - Me.grpSottocartelle.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer)) - Me.grpSottocartelle.Location = New System.Drawing.Point(272, 139) - Me.grpSottocartelle.Margin = New System.Windows.Forms.Padding(4) - Me.grpSottocartelle.Name = "grpSottocartelle" - Me.grpSottocartelle.Padding = New System.Windows.Forms.Padding(4) - Me.grpSottocartelle.Size = New System.Drawing.Size(256, 187) - Me.grpSottocartelle.TabIndex = 47 - Me.grpSottocartelle.TabStop = False - Me.grpSottocartelle.Text = "Sottocartelle" - ' - 'rdbNumFiles - ' - Me.rdbNumFiles.ForeColor = System.Drawing.Color.Black - Me.rdbNumFiles.Location = New System.Drawing.Point(43, 158) - Me.rdbNumFiles.Margin = New System.Windows.Forms.Padding(4) - Me.rdbNumFiles.Name = "rdbNumFiles" - Me.rdbNumFiles.Size = New System.Drawing.Size(181, 20) - Me.rdbNumFiles.TabIndex = 38 - Me.rdbNumFiles.Text = "Numerazione files" - ' - 'rdbNumProgressiva - ' - Me.rdbNumProgressiva.Checked = True - Me.rdbNumProgressiva.ForeColor = System.Drawing.Color.Black - Me.rdbNumProgressiva.Location = New System.Drawing.Point(43, 138) - Me.rdbNumProgressiva.Margin = New System.Windows.Forms.Padding(4) - Me.rdbNumProgressiva.Name = "rdbNumProgressiva" - Me.rdbNumProgressiva.Size = New System.Drawing.Size(203, 20) - Me.rdbNumProgressiva.TabIndex = 37 - Me.rdbNumProgressiva.TabStop = True - Me.rdbNumProgressiva.Text = "Numerazione progressiva" - ' - 'txtCifreContatore - ' - Me.txtCifreContatore.Location = New System.Drawing.Point(171, 108) - Me.txtCifreContatore.Margin = New System.Windows.Forms.Padding(4) - Me.txtCifreContatore.Name = "txtCifreContatore" - Me.txtCifreContatore.Size = New System.Drawing.Size(73, 22) - Me.txtCifreContatore.TabIndex = 34 - Me.txtCifreContatore.Text = "4" - ' - 'Label34 - ' - Me.Label34.ForeColor = System.Drawing.Color.Black - Me.Label34.Location = New System.Drawing.Point(11, 108) - Me.Label34.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label34.Name = "Label34" - Me.Label34.Size = New System.Drawing.Size(149, 20) - Me.Label34.TabIndex = 33 - Me.Label34.Text = "Num. cifre contatore" - Me.Label34.TextAlign = System.Drawing.ContentAlignment.MiddleRight - ' - 'txtSuffissoCartelle - ' - Me.txtSuffissoCartelle.Location = New System.Drawing.Point(75, 79) - Me.txtSuffissoCartelle.Margin = New System.Windows.Forms.Padding(4) - Me.txtSuffissoCartelle.Name = "txtSuffissoCartelle" - Me.txtSuffissoCartelle.Size = New System.Drawing.Size(169, 22) - Me.txtSuffissoCartelle.TabIndex = 32 - Me.txtSuffissoCartelle.Text = "TextBox20" - ' - 'Label33 - ' - Me.Label33.ForeColor = System.Drawing.Color.Black - Me.Label33.Location = New System.Drawing.Point(8, 82) - Me.Label33.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label33.Name = "Label33" - Me.Label33.Size = New System.Drawing.Size(64, 20) - Me.Label33.TabIndex = 31 - Me.Label33.Text = "Suffisso" - ' - 'Label31 - ' - Me.Label31.ForeColor = System.Drawing.Color.Black - Me.Label31.Location = New System.Drawing.Point(32, 49) - Me.Label31.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label31.Name = "Label31" - Me.Label31.Size = New System.Drawing.Size(43, 20) - Me.Label31.TabIndex = 30 - Me.Label31.Text = "ogni" - ' - 'chkCreaSottocartelle - ' - Me.chkCreaSottocartelle.ForeColor = System.Drawing.Color.Black - Me.chkCreaSottocartelle.Location = New System.Drawing.Point(75, 20) - Me.chkCreaSottocartelle.Margin = New System.Windows.Forms.Padding(4) - Me.chkCreaSottocartelle.Name = "chkCreaSottocartelle" - Me.chkCreaSottocartelle.Size = New System.Drawing.Size(149, 20) - Me.chkCreaSottocartelle.TabIndex = 29 - Me.chkCreaSottocartelle.Text = "crea sottocartelle" - ' - 'txtFilePerCartella - ' - Me.txtFilePerCartella.Location = New System.Drawing.Point(75, 49) - Me.txtFilePerCartella.Margin = New System.Windows.Forms.Padding(4) - Me.txtFilePerCartella.Name = "txtFilePerCartella" - Me.txtFilePerCartella.Size = New System.Drawing.Size(84, 22) - Me.txtFilePerCartella.TabIndex = 27 - Me.txtFilePerCartella.Text = "99" - ' - 'Label32 - ' - Me.Label32.ForeColor = System.Drawing.Color.Black - Me.Label32.Location = New System.Drawing.Point(171, 49) - Me.Label32.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label32.Name = "Label32" - Me.Label32.Size = New System.Drawing.Size(32, 20) - Me.Label32.TabIndex = 28 - Me.Label32.Text = "file" - ' - 'grpGenerale - ' - Me.grpGenerale.Controls.Add(Me.chkSovrascriviFile) - Me.grpGenerale.Controls.Add(Me.chkRotazioneAutomatica) - Me.grpGenerale.Controls.Add(Me.chkForzaJpg) - Me.grpGenerale.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer)) - Me.grpGenerale.Location = New System.Drawing.Point(8, 139) - Me.grpGenerale.Margin = New System.Windows.Forms.Padding(4) - Me.grpGenerale.Name = "grpGenerale" - Me.grpGenerale.Padding = New System.Windows.Forms.Padding(4) - Me.grpGenerale.Size = New System.Drawing.Size(256, 108) - Me.grpGenerale.TabIndex = 45 - Me.grpGenerale.TabStop = False - Me.grpGenerale.Text = "Generale" - ' - 'chkSovrascriviFile - ' - Me.chkSovrascriviFile.AutoSize = True - Me.chkSovrascriviFile.Location = New System.Drawing.Point(21, 75) - Me.chkSovrascriviFile.Margin = New System.Windows.Forms.Padding(4) - Me.chkSovrascriviFile.Name = "chkSovrascriviFile" - Me.chkSovrascriviFile.Size = New System.Drawing.Size(121, 21) - Me.chkSovrascriviFile.TabIndex = 2 - Me.chkSovrascriviFile.Text = "Sovrascrivi file" - Me.chkSovrascriviFile.UseVisualStyleBackColor = True - ' - 'chkRotazioneAutomatica - ' - Me.chkRotazioneAutomatica.ForeColor = System.Drawing.Color.Black - Me.chkRotazioneAutomatica.Location = New System.Drawing.Point(21, 48) - Me.chkRotazioneAutomatica.Margin = New System.Windows.Forms.Padding(4) - Me.chkRotazioneAutomatica.Name = "chkRotazioneAutomatica" - Me.chkRotazioneAutomatica.Size = New System.Drawing.Size(181, 20) - Me.chkRotazioneAutomatica.TabIndex = 1 - Me.chkRotazioneAutomatica.Text = "Rotazione automatica" - ' - 'chkForzaJpg - ' - Me.chkForzaJpg.Checked = True - Me.chkForzaJpg.CheckState = System.Windows.Forms.CheckState.Checked - Me.chkForzaJpg.ForeColor = System.Drawing.Color.Black - Me.chkForzaJpg.Location = New System.Drawing.Point(21, 22) - Me.chkForzaJpg.Margin = New System.Windows.Forms.Padding(4) - Me.chkForzaJpg.Name = "chkForzaJpg" - Me.chkForzaJpg.Size = New System.Drawing.Size(107, 20) - Me.chkForzaJpg.TabIndex = 0 - Me.chkForzaJpg.Text = "Forza Jpg" - ' - 'tabTesto - ' - Me.tabTesto.Controls.Add(Me.CheckBox2) - Me.tabTesto.Controls.Add(Me.grpTestoFotoVerticali) - Me.tabTesto.Controls.Add(Me.grpSlideShow) - Me.tabTesto.Controls.Add(Me.grpCarattere) - Me.tabTesto.Controls.Add(Me.GroupBox4) - Me.tabTesto.Location = New System.Drawing.Point(4, 25) - Me.tabTesto.Margin = New System.Windows.Forms.Padding(4) - Me.tabTesto.Name = "tabTesto" - Me.tabTesto.Padding = New System.Windows.Forms.Padding(4) - Me.tabTesto.Size = New System.Drawing.Size(687, 435) - Me.tabTesto.TabIndex = 2 - Me.tabTesto.Text = "Testo" - Me.tabTesto.UseVisualStyleBackColor = True - ' - 'CheckBox2 - ' - Me.CheckBox2.AutoSize = True - Me.CheckBox2.Checked = True - Me.CheckBox2.CheckState = System.Windows.Forms.CheckState.Checked - Me.CheckBox2.Location = New System.Drawing.Point(9, 10) - Me.CheckBox2.Margin = New System.Windows.Forms.Padding(4) - Me.CheckBox2.Name = "CheckBox2" - Me.CheckBox2.Size = New System.Drawing.Size(120, 21) - Me.CheckBox2.TabIndex = 40 - Me.CheckBox2.Text = "Aggiungi testo" - Me.CheckBox2.UseVisualStyleBackColor = True - ' - 'grpTestoFotoVerticali - ' - Me.grpTestoFotoVerticali.Controls.Add(Me.Label42) - Me.grpTestoFotoVerticali.Controls.Add(Me.Label41) - Me.grpTestoFotoVerticali.Controls.Add(Me.TextBox31) - Me.grpTestoFotoVerticali.Controls.Add(Me.TextBox30) - Me.grpTestoFotoVerticali.Location = New System.Drawing.Point(421, 96) - Me.grpTestoFotoVerticali.Margin = New System.Windows.Forms.Padding(4) - Me.grpTestoFotoVerticali.Name = "grpTestoFotoVerticali" - Me.grpTestoFotoVerticali.Padding = New System.Windows.Forms.Padding(4) - Me.grpTestoFotoVerticali.Size = New System.Drawing.Size(248, 90) - Me.grpTestoFotoVerticali.TabIndex = 39 - Me.grpTestoFotoVerticali.TabStop = False - Me.grpTestoFotoVerticali.Text = "Testo foto verticali" - ' - 'Label42 - ' - Me.Label42.AutoSize = True - Me.Label42.Location = New System.Drawing.Point(9, 57) - Me.Label42.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label42.Name = "Label42" - Me.Label42.Size = New System.Drawing.Size(59, 17) - Me.Label42.TabIndex = 3 - Me.Label42.Text = "Margine" - ' - 'Label41 - ' - Me.Label41.AutoSize = True - Me.Label41.Location = New System.Drawing.Point(9, 31) - Me.Label41.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label41.Name = "Label41" - Me.Label41.Size = New System.Drawing.Size(145, 17) - Me.Label41.TabIndex = 2 - Me.Label41.Text = "Dimensione Carattere" - ' - 'TextBox31 - ' - Me.TextBox31.Location = New System.Drawing.Point(175, 57) - Me.TextBox31.Margin = New System.Windows.Forms.Padding(4) - Me.TextBox31.Name = "TextBox31" - Me.TextBox31.Size = New System.Drawing.Size(51, 22) - Me.TextBox31.TabIndex = 1 - ' - 'TextBox30 - ' - Me.TextBox30.Location = New System.Drawing.Point(175, 27) - Me.TextBox30.Margin = New System.Windows.Forms.Padding(4) - Me.TextBox30.Name = "TextBox30" - Me.TextBox30.Size = New System.Drawing.Size(51, 22) - Me.TextBox30.TabIndex = 0 - ' - 'grpSlideShow - ' - Me.grpSlideShow.Controls.Add(Me.CheckBox17) - Me.grpSlideShow.Controls.Add(Me.CheckBox16) - Me.grpSlideShow.Location = New System.Drawing.Point(421, 38) - Me.grpSlideShow.Margin = New System.Windows.Forms.Padding(4) - Me.grpSlideShow.Name = "grpSlideShow" - Me.grpSlideShow.Padding = New System.Windows.Forms.Padding(4) - Me.grpSlideShow.Size = New System.Drawing.Size(248, 55) - Me.grpSlideShow.TabIndex = 38 - Me.grpSlideShow.TabStop = False - Me.grpSlideShow.Text = "Slide show" - ' - 'CheckBox17 - ' - Me.CheckBox17.AutoSize = True - Me.CheckBox17.Location = New System.Drawing.Point(128, 22) - Me.CheckBox17.Margin = New System.Windows.Forms.Padding(4) - Me.CheckBox17.Name = "CheckBox17" - Me.CheckBox17.Size = New System.Drawing.Size(108, 21) - Me.CheckBox17.TabIndex = 1 - Me.CheckBox17.Text = "Numero foto" - Me.CheckBox17.UseVisualStyleBackColor = True - ' - 'CheckBox16 - ' - Me.CheckBox16.AutoSize = True - Me.CheckBox16.Location = New System.Drawing.Point(8, 23) - Me.CheckBox16.Margin = New System.Windows.Forms.Padding(4) - Me.CheckBox16.Name = "CheckBox16" - Me.CheckBox16.Size = New System.Drawing.Size(60, 21) - Me.CheckBox16.TabIndex = 0 - Me.CheckBox16.Text = "Data" - Me.CheckBox16.UseVisualStyleBackColor = True - ' - 'grpCarattere - ' - Me.grpCarattere.Controls.Add(Me.TextBox34) - Me.grpCarattere.Controls.Add(Me.Button8) - Me.grpCarattere.Controls.Add(Me.Label36) - Me.grpCarattere.Controls.Add(Me.TextBox25) - Me.grpCarattere.Controls.Add(Me.Label35) - Me.grpCarattere.Controls.Add(Me.ComboBox3) - Me.grpCarattere.Controls.Add(Me.TextBox11) - Me.grpCarattere.Controls.Add(Me.Label12) - Me.grpCarattere.Controls.Add(Me.Label11) - Me.grpCarattere.Controls.Add(Me.CheckBox3) - Me.grpCarattere.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer)) - Me.grpCarattere.Location = New System.Drawing.Point(8, 38) - Me.grpCarattere.Margin = New System.Windows.Forms.Padding(4) - Me.grpCarattere.Name = "grpCarattere" - Me.grpCarattere.Padding = New System.Windows.Forms.Padding(4) - Me.grpCarattere.Size = New System.Drawing.Size(405, 148) - Me.grpCarattere.TabIndex = 37 - Me.grpCarattere.TabStop = False - Me.grpCarattere.Text = "Carattere" - ' - 'TextBox34 - ' - Me.TextBox34.Location = New System.Drawing.Point(213, 112) - Me.TextBox34.Margin = New System.Windows.Forms.Padding(4) - Me.TextBox34.Name = "TextBox34" - Me.TextBox34.Size = New System.Drawing.Size(73, 22) - Me.TextBox34.TabIndex = 36 - Me.TextBox34.TextAlign = System.Windows.Forms.HorizontalAlignment.Right - ' - 'Button8 - ' - Me.Button8.ForeColor = System.Drawing.Color.Black - Me.Button8.Location = New System.Drawing.Point(296, 110) - Me.Button8.Margin = New System.Windows.Forms.Padding(4) - Me.Button8.Name = "Button8" - Me.Button8.Size = New System.Drawing.Size(99, 30) - Me.Button8.TabIndex = 35 - Me.Button8.Text = "Scegli..." - ' - 'Label36 - ' - Me.Label36.ForeColor = System.Drawing.Color.Black - Me.Label36.Location = New System.Drawing.Point(11, 74) - Me.Label36.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label36.Name = "Label36" - Me.Label36.Size = New System.Drawing.Size(160, 23) - Me.Label36.TabIndex = 34 - Me.Label36.Text = "Dimensione miniatura" - Me.Label36.TextAlign = System.Drawing.ContentAlignment.MiddleLeft - ' - 'TextBox25 - ' - Me.TextBox25.Location = New System.Drawing.Point(213, 73) - Me.TextBox25.Margin = New System.Windows.Forms.Padding(4) - Me.TextBox25.Name = "TextBox25" - Me.TextBox25.Size = New System.Drawing.Size(73, 22) - Me.TextBox25.TabIndex = 33 - Me.TextBox25.Text = "TextBox25" - ' - 'Label35 - ' - Me.Label35.ForeColor = System.Drawing.Color.Black - Me.Label35.Location = New System.Drawing.Point(11, 114) - Me.Label35.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label35.Name = "Label35" - Me.Label35.Size = New System.Drawing.Size(96, 20) - Me.Label35.TabIndex = 32 - Me.Label35.Text = "Colore RGB" - Me.Label35.TextAlign = System.Drawing.ContentAlignment.MiddleLeft - ' - 'ComboBox3 - ' - Me.ComboBox3.Location = New System.Drawing.Point(128, 10) - Me.ComboBox3.Margin = New System.Windows.Forms.Padding(4) - Me.ComboBox3.Name = "ComboBox3" - Me.ComboBox3.Size = New System.Drawing.Size(159, 24) - Me.ComboBox3.TabIndex = 28 - Me.ComboBox3.Text = "ComboBox3" - ' - 'TextBox11 - ' - Me.TextBox11.Location = New System.Drawing.Point(213, 43) - Me.TextBox11.Margin = New System.Windows.Forms.Padding(4) - Me.TextBox11.Name = "TextBox11" - Me.TextBox11.Size = New System.Drawing.Size(73, 22) - Me.TextBox11.TabIndex = 27 - Me.TextBox11.Text = "TextBox11" - ' - 'Label12 - ' - Me.Label12.AutoSize = True - Me.Label12.ForeColor = System.Drawing.Color.Black - Me.Label12.Location = New System.Drawing.Point(11, 47) - Me.Label12.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label12.Name = "Label12" - Me.Label12.Size = New System.Drawing.Size(82, 17) - Me.Label12.TabIndex = 26 - Me.Label12.Text = "Dimensione" - Me.Label12.TextAlign = System.Drawing.ContentAlignment.MiddleLeft - ' - 'Label11 - ' - Me.Label11.AutoSize = True - Me.Label11.ForeColor = System.Drawing.Color.Black - Me.Label11.Location = New System.Drawing.Point(75, 10) - Me.Label11.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label11.Name = "Label11" - Me.Label11.Size = New System.Drawing.Size(36, 17) - Me.Label11.TabIndex = 22 - Me.Label11.Text = "Font" - ' - 'CheckBox3 - ' - Me.CheckBox3.ForeColor = System.Drawing.Color.Black - Me.CheckBox3.Location = New System.Drawing.Point(299, 10) - Me.CheckBox3.Margin = New System.Windows.Forms.Padding(4) - Me.CheckBox3.Name = "CheckBox3" - Me.CheckBox3.Size = New System.Drawing.Size(96, 30) - Me.CheckBox3.TabIndex = 24 - Me.CheckBox3.Text = "Grassetto" - ' - 'GroupBox4 - ' - Me.GroupBox4.Controls.Add(Me.Label40) - Me.GroupBox4.Controls.Add(Me.TextBox29) - Me.GroupBox4.Controls.Add(Me.TextBox18) - Me.GroupBox4.Controls.Add(Me.Label26) - Me.GroupBox4.Controls.Add(Me.DateTimePicker1) - Me.GroupBox4.Controls.Add(Me.CheckBox8) - Me.GroupBox4.Controls.Add(Me.TextBox9) - Me.GroupBox4.Controls.Add(Me.CheckBox7) - Me.GroupBox4.Controls.Add(Me.Label4) - Me.GroupBox4.Controls.Add(Me.TextBox4) - Me.GroupBox4.Controls.Add(Me.Label9) - Me.GroupBox4.Controls.Add(Me.Label13) - Me.GroupBox4.Controls.Add(Me.ComboBox1) - Me.GroupBox4.Controls.Add(Me.ComboBox2) - Me.GroupBox4.Controls.Add(Me.Label14) - Me.GroupBox4.Controls.Add(Me.TextBox12) - Me.GroupBox4.Controls.Add(Me.Label15) - Me.GroupBox4.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer)) - Me.GroupBox4.Location = New System.Drawing.Point(8, 193) - Me.GroupBox4.Margin = New System.Windows.Forms.Padding(4) - Me.GroupBox4.Name = "GroupBox4" - Me.GroupBox4.Padding = New System.Windows.Forms.Padding(4) - Me.GroupBox4.Size = New System.Drawing.Size(661, 229) - Me.GroupBox4.TabIndex = 36 - Me.GroupBox4.TabStop = False - Me.GroupBox4.Text = "Testo da applicare" - ' - 'Label40 - ' - Me.Label40.AutoSize = True - Me.Label40.Location = New System.Drawing.Point(11, 64) - Me.Label40.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label40.Name = "Label40" - Me.Label40.Size = New System.Drawing.Size(63, 17) - Me.Label40.TabIndex = 40 - Me.Label40.Text = "Verticale" - ' - 'TextBox29 - ' - Me.TextBox29.Location = New System.Drawing.Point(96, 60) - Me.TextBox29.Margin = New System.Windows.Forms.Padding(4) - Me.TextBox29.Multiline = True - Me.TextBox29.Name = "TextBox29" - Me.TextBox29.Size = New System.Drawing.Size(543, 53) - Me.TextBox29.TabIndex = 39 - ' - 'TextBox18 - ' - Me.TextBox18.Location = New System.Drawing.Point(309, 192) - Me.TextBox18.Margin = New System.Windows.Forms.Padding(4) - Me.TextBox18.Name = "TextBox18" - Me.TextBox18.Size = New System.Drawing.Size(132, 22) - Me.TextBox18.TabIndex = 38 - ' - 'Label26 - ' - Me.Label26.AutoSize = True - Me.Label26.ForeColor = System.Drawing.Color.Black - Me.Label26.Location = New System.Drawing.Point(459, 192) - Me.Label26.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label26.Name = "Label26" - Me.Label26.Size = New System.Drawing.Size(64, 17) - Me.Label26.TabIndex = 37 - Me.Label26.Text = "partenza" - ' - 'DateTimePicker1 - ' - Me.DateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.Time - Me.DateTimePicker1.Location = New System.Drawing.Point(523, 192) - Me.DateTimePicker1.Margin = New System.Windows.Forms.Padding(4) - Me.DateTimePicker1.Name = "DateTimePicker1" - Me.DateTimePicker1.Size = New System.Drawing.Size(116, 22) - Me.DateTimePicker1.TabIndex = 36 - ' - 'CheckBox8 - ' - Me.CheckBox8.ForeColor = System.Drawing.Color.Black - Me.CheckBox8.Location = New System.Drawing.Point(96, 192) - Me.CheckBox8.Margin = New System.Windows.Forms.Padding(4) - Me.CheckBox8.Name = "CheckBox8" - Me.CheckBox8.Size = New System.Drawing.Size(75, 20) - Me.CheckBox8.TabIndex = 35 - Me.CheckBox8.Text = "Orario" - ' - 'TextBox9 - ' - Me.TextBox9.Location = New System.Drawing.Point(160, 133) - Me.TextBox9.Margin = New System.Windows.Forms.Padding(4) - Me.TextBox9.Name = "TextBox9" - Me.TextBox9.Size = New System.Drawing.Size(73, 22) - Me.TextBox9.TabIndex = 20 - Me.TextBox9.Text = "TextBox9" - ' - 'CheckBox7 - ' - Me.CheckBox7.ForeColor = System.Drawing.Color.Black - Me.CheckBox7.Location = New System.Drawing.Point(181, 192) - Me.CheckBox7.Margin = New System.Windows.Forms.Padding(4) - Me.CheckBox7.Name = "CheckBox7" - Me.CheckBox7.Size = New System.Drawing.Size(117, 20) - Me.CheckBox7.TabIndex = 34 - Me.CheckBox7.Text = "Tempo gara" - ' - 'Label4 - ' - Me.Label4.AutoSize = True - Me.Label4.ForeColor = System.Drawing.Color.Black - Me.Label4.Location = New System.Drawing.Point(11, 30) - Me.Label4.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label4.Name = "Label4" - Me.Label4.Size = New System.Drawing.Size(80, 17) - Me.Label4.TabIndex = 9 - Me.Label4.Text = "Orizzontale" - ' - 'TextBox4 - ' - Me.TextBox4.Location = New System.Drawing.Point(96, 30) - Me.TextBox4.Margin = New System.Windows.Forms.Padding(4) - Me.TextBox4.Name = "TextBox4" - Me.TextBox4.Size = New System.Drawing.Size(543, 22) - Me.TextBox4.TabIndex = 8 - Me.TextBox4.Text = "TextBox4" - ' - 'Label9 - ' - Me.Label9.AutoSize = True - Me.Label9.ForeColor = System.Drawing.Color.Black - Me.Label9.Location = New System.Drawing.Point(11, 133) - Me.Label9.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label9.Name = "Label9" - Me.Label9.Size = New System.Drawing.Size(152, 17) - Me.Label9.TabIndex = 19 - Me.Label9.Text = "Trasparenza (0-100%)" - ' - 'Label13 - ' - Me.Label13.AutoSize = True - Me.Label13.ForeColor = System.Drawing.Color.Black - Me.Label13.Location = New System.Drawing.Point(21, 162) - Me.Label13.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label13.Name = "Label13" - Me.Label13.Size = New System.Drawing.Size(69, 17) - Me.Label13.TabIndex = 29 - Me.Label13.Text = "Posizione" - ' - 'ComboBox1 - ' - Me.ComboBox1.Location = New System.Drawing.Point(96, 162) - Me.ComboBox1.Margin = New System.Windows.Forms.Padding(4) - Me.ComboBox1.Name = "ComboBox1" - Me.ComboBox1.Size = New System.Drawing.Size(137, 24) - Me.ComboBox1.TabIndex = 28 - Me.ComboBox1.Text = "ComboBox1" - ' - 'ComboBox2 - ' - Me.ComboBox2.Location = New System.Drawing.Point(501, 162) - Me.ComboBox2.Margin = New System.Windows.Forms.Padding(4) - Me.ComboBox2.Name = "ComboBox2" - Me.ComboBox2.Size = New System.Drawing.Size(137, 24) - Me.ComboBox2.TabIndex = 31 - Me.ComboBox2.Text = "ComboBox2" - ' - 'Label14 - ' - Me.Label14.AutoSize = True - Me.Label14.ForeColor = System.Drawing.Color.Black - Me.Label14.Location = New System.Drawing.Point(405, 162) - Me.Label14.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label14.Name = "Label14" - Me.Label14.Size = New System.Drawing.Size(89, 17) - Me.Label14.TabIndex = 30 - Me.Label14.Text = "Allineamento" - ' - 'TextBox12 - ' - Me.TextBox12.Location = New System.Drawing.Point(501, 133) - Me.TextBox12.Margin = New System.Windows.Forms.Padding(4) - Me.TextBox12.Name = "TextBox12" - Me.TextBox12.Size = New System.Drawing.Size(137, 22) - Me.TextBox12.TabIndex = 33 - Me.TextBox12.Text = "TextBox12" - ' - 'Label15 - ' - Me.Label15.AutoSize = True - Me.Label15.ForeColor = System.Drawing.Color.Black - Me.Label15.Location = New System.Drawing.Point(395, 133) - Me.Label15.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label15.Name = "Label15" - Me.Label15.Size = New System.Drawing.Size(101, 17) - Me.Label15.TabIndex = 32 - Me.Label15.Text = "Margine (pixel)" - ' - 'tabFoto - ' - Me.tabFoto.Controls.Add(Me.GroupBox2) - Me.tabFoto.Location = New System.Drawing.Point(4, 25) - Me.tabFoto.Margin = New System.Windows.Forms.Padding(4) - Me.tabFoto.Name = "tabFoto" - Me.tabFoto.Padding = New System.Windows.Forms.Padding(4) - Me.tabFoto.Size = New System.Drawing.Size(687, 435) - Me.tabFoto.TabIndex = 5 - Me.tabFoto.Text = "Foto" - Me.tabFoto.UseVisualStyleBackColor = True - ' - 'GroupBox2 - ' - Me.GroupBox2.Controls.Add(Me.Label45) - Me.GroupBox2.Controls.Add(Me.TextBox32) - Me.GroupBox2.Controls.Add(Me.TextBox26) - Me.GroupBox2.Controls.Add(Me.Label37) - Me.GroupBox2.Controls.Add(Me.Label38) - Me.GroupBox2.Controls.Add(Me.TextBox27) - Me.GroupBox2.Controls.Add(Me.Label39) - Me.GroupBox2.Controls.Add(Me.TextBox28) - Me.GroupBox2.Controls.Add(Me.CheckBox15) - Me.GroupBox2.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer)) - Me.GroupBox2.Location = New System.Drawing.Point(4, 7) - Me.GroupBox2.Margin = New System.Windows.Forms.Padding(4) - Me.GroupBox2.Name = "GroupBox2" - Me.GroupBox2.Padding = New System.Windows.Forms.Padding(4) - Me.GroupBox2.Size = New System.Drawing.Size(405, 192) - Me.GroupBox2.TabIndex = 36 - Me.GroupBox2.TabStop = False - Me.GroupBox2.Text = "Foto grande" - ' - 'Label45 - ' - Me.Label45.AutoSize = True - Me.Label45.Location = New System.Drawing.Point(15, 106) - Me.Label45.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label45.Name = "Label45" - Me.Label45.Size = New System.Drawing.Size(53, 17) - Me.Label45.TabIndex = 22 - Me.Label45.Text = "Qualità" - ' - 'TextBox32 - ' - Me.TextBox32.Location = New System.Drawing.Point(96, 98) - Me.TextBox32.Margin = New System.Windows.Forms.Padding(4) - Me.TextBox32.Name = "TextBox32" - Me.TextBox32.Size = New System.Drawing.Size(95, 22) - Me.TextBox32.TabIndex = 21 - Me.TextBox32.Text = "100" - ' - 'TextBox26 - ' - Me.TextBox26.Location = New System.Drawing.Point(299, 59) - Me.TextBox26.Margin = New System.Windows.Forms.Padding(4) - Me.TextBox26.Name = "TextBox26" - Me.TextBox26.Size = New System.Drawing.Size(73, 22) - Me.TextBox26.TabIndex = 20 - Me.TextBox26.Text = "TextBox26" - ' - 'Label37 - ' - Me.Label37.ForeColor = System.Drawing.Color.Black - Me.Label37.Location = New System.Drawing.Point(224, 59) - Me.Label37.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label37.Name = "Label37" - Me.Label37.Size = New System.Drawing.Size(64, 20) - Me.Label37.TabIndex = 19 - Me.Label37.Text = "Suffisso" - Me.Label37.TextAlign = System.Drawing.ContentAlignment.MiddleRight - ' - 'Label38 - ' - Me.Label38.AutoSize = True - Me.Label38.ForeColor = System.Drawing.Color.Black - Me.Label38.Location = New System.Drawing.Point(32, 30) - Me.Label38.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label38.Name = "Label38" - Me.Label38.Size = New System.Drawing.Size(54, 17) - Me.Label38.TabIndex = 16 - Me.Label38.Text = "Altezza" - ' - 'TextBox27 - ' - Me.TextBox27.Location = New System.Drawing.Point(96, 30) - Me.TextBox27.Margin = New System.Windows.Forms.Padding(4) - Me.TextBox27.Name = "TextBox27" - Me.TextBox27.Size = New System.Drawing.Size(95, 22) - Me.TextBox27.TabIndex = 14 - Me.TextBox27.Text = "TextBox27" - ' - 'Label39 - ' - Me.Label39.AutoSize = True - Me.Label39.ForeColor = System.Drawing.Color.Black - Me.Label39.Location = New System.Drawing.Point(11, 59) - Me.Label39.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label39.Name = "Label39" - Me.Label39.Size = New System.Drawing.Size(75, 17) - Me.Label39.TabIndex = 17 - Me.Label39.Text = "Larghezza" - ' - 'TextBox28 - ' - Me.TextBox28.Location = New System.Drawing.Point(96, 59) - Me.TextBox28.Margin = New System.Windows.Forms.Padding(4) - Me.TextBox28.Name = "TextBox28" - Me.TextBox28.Size = New System.Drawing.Size(95, 22) - Me.TextBox28.TabIndex = 15 - Me.TextBox28.Text = "TextBox28" - ' - 'CheckBox15 - ' - Me.CheckBox15.Checked = True - Me.CheckBox15.CheckState = System.Windows.Forms.CheckState.Checked - Me.CheckBox15.ForeColor = System.Drawing.Color.Black - Me.CheckBox15.Location = New System.Drawing.Point(224, 20) - Me.CheckBox15.Margin = New System.Windows.Forms.Padding(4) - Me.CheckBox15.Name = "CheckBox15" - Me.CheckBox15.Size = New System.Drawing.Size(160, 39) - Me.CheckBox15.TabIndex = 18 - Me.CheckBox15.Text = "Mantieni dimensioni originali" - ' - 'tabMiniature - ' - Me.tabMiniature.Controls.Add(Me.Panel1) - Me.tabMiniature.Controls.Add(Me.GroupBox1) - Me.tabMiniature.Location = New System.Drawing.Point(4, 25) - Me.tabMiniature.Margin = New System.Windows.Forms.Padding(4) - Me.tabMiniature.Name = "tabMiniature" - Me.tabMiniature.Padding = New System.Windows.Forms.Padding(4) - Me.tabMiniature.Size = New System.Drawing.Size(687, 435) - Me.tabMiniature.TabIndex = 0 - Me.tabMiniature.Text = "Miniature" - Me.tabMiniature.UseVisualStyleBackColor = True - ' - 'Panel1 - ' - Me.Panel1.Controls.Add(Me.CheckBox18) - Me.Panel1.Controls.Add(Me.CheckBox4) - Me.Panel1.Controls.Add(Me.CheckBox12) - Me.Panel1.Location = New System.Drawing.Point(69, 290) - Me.Panel1.Margin = New System.Windows.Forms.Padding(4) - Me.Panel1.Name = "Panel1" - Me.Panel1.Size = New System.Drawing.Size(405, 90) - Me.Panel1.TabIndex = 26 - Me.Panel1.Visible = False - ' - 'CheckBox18 - ' - Me.CheckBox18.AutoSize = True - Me.CheckBox18.Location = New System.Drawing.Point(187, 4) - Me.CheckBox18.Margin = New System.Windows.Forms.Padding(4) - Me.CheckBox18.Name = "CheckBox18" - Me.CheckBox18.Size = New System.Drawing.Size(108, 21) - Me.CheckBox18.TabIndex = 36 - Me.CheckBox18.Text = "Numero foto" - Me.CheckBox18.UseVisualStyleBackColor = True - ' - 'CheckBox4 - ' - Me.CheckBox4.ForeColor = System.Drawing.Color.Black - Me.CheckBox4.Location = New System.Drawing.Point(13, 4) - Me.CheckBox4.Margin = New System.Windows.Forms.Padding(4) - Me.CheckBox4.Name = "CheckBox4" - Me.CheckBox4.Size = New System.Drawing.Size(139, 21) - Me.CheckBox4.TabIndex = 34 - Me.CheckBox4.Text = "Aggiungi scritta" - ' - 'CheckBox12 - ' - Me.CheckBox12.ForeColor = System.Drawing.Color.Black - Me.CheckBox12.Location = New System.Drawing.Point(13, 23) - Me.CheckBox12.Margin = New System.Windows.Forms.Padding(4) - Me.CheckBox12.Name = "CheckBox12" - Me.CheckBox12.Size = New System.Drawing.Size(139, 26) - Me.CheckBox12.TabIndex = 35 - Me.CheckBox12.Text = "Aggiungi orario" - ' - 'GroupBox1 - ' - Me.GroupBox1.Controls.Add(Me.Label46) - Me.GroupBox1.Controls.Add(Me.TextBox33) - Me.GroupBox1.Controls.Add(Me.Panel2) - Me.GroupBox1.Controls.Add(Me.Label5) - Me.GroupBox1.Controls.Add(Me.TextBox5) - Me.GroupBox1.Controls.Add(Me.Label6) - Me.GroupBox1.Controls.Add(Me.TextBox6) - Me.GroupBox1.Controls.Add(Me.Label3) - Me.GroupBox1.Controls.Add(Me.TextBox3) - Me.GroupBox1.Controls.Add(Me.CheckBox1) - Me.GroupBox1.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer)) - Me.GroupBox1.Location = New System.Drawing.Point(8, 6) - Me.GroupBox1.Margin = New System.Windows.Forms.Padding(4) - Me.GroupBox1.Name = "GroupBox1" - Me.GroupBox1.Padding = New System.Windows.Forms.Padding(4) - Me.GroupBox1.Size = New System.Drawing.Size(467, 258) - Me.GroupBox1.TabIndex = 25 - Me.GroupBox1.TabStop = False - Me.GroupBox1.Text = "Miniature" - ' - 'Label46 - ' - Me.Label46.AutoSize = True - Me.Label46.Location = New System.Drawing.Point(264, 53) - Me.Label46.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label46.Name = "Label46" - Me.Label46.Size = New System.Drawing.Size(53, 17) - Me.Label46.TabIndex = 21 - Me.Label46.Text = "Qualità" - ' - 'TextBox33 - ' - Me.TextBox33.Location = New System.Drawing.Point(325, 49) - Me.TextBox33.Margin = New System.Windows.Forms.Padding(4) - Me.TextBox33.Name = "TextBox33" - Me.TextBox33.Size = New System.Drawing.Size(132, 22) - Me.TextBox33.TabIndex = 20 - ' - 'Panel2 - ' - Me.Panel2.Controls.Add(Me.RadioButton3) - Me.Panel2.Controls.Add(Me.RadioButton7) - Me.Panel2.Controls.Add(Me.RadioButton4) - Me.Panel2.Controls.Add(Me.RadioButton6) - Me.Panel2.Controls.Add(Me.RadioButton5) - Me.Panel2.Location = New System.Drawing.Point(75, 140) - Me.Panel2.Margin = New System.Windows.Forms.Padding(4) - Me.Panel2.Name = "Panel2" - Me.Panel2.Size = New System.Drawing.Size(313, 111) - Me.Panel2.TabIndex = 19 - ' - 'RadioButton3 - ' - Me.RadioButton3.AutoSize = True - Me.RadioButton3.Location = New System.Drawing.Point(20, 20) - Me.RadioButton3.Margin = New System.Windows.Forms.Padding(4) - Me.RadioButton3.Name = "RadioButton3" - Me.RadioButton3.Size = New System.Drawing.Size(128, 21) - Me.RadioButton3.TabIndex = 14 - Me.RadioButton3.TabStop = True - Me.RadioButton3.Text = "Aggiungi Scritta" - Me.RadioButton3.UseVisualStyleBackColor = True - ' - 'RadioButton7 - ' - Me.RadioButton7.AutoSize = True - Me.RadioButton7.Location = New System.Drawing.Point(172, 49) - Me.RadioButton7.Margin = New System.Windows.Forms.Padding(4) - Me.RadioButton7.Name = "RadioButton7" - Me.RadioButton7.Size = New System.Drawing.Size(124, 21) - Me.RadioButton7.TabIndex = 18 - Me.RadioButton7.TabStop = True - Me.RadioButton7.Text = "numero+tempo" - Me.RadioButton7.UseVisualStyleBackColor = True - ' - 'RadioButton4 - ' - Me.RadioButton4.AutoSize = True - Me.RadioButton4.Location = New System.Drawing.Point(20, 49) - Me.RadioButton4.Margin = New System.Windows.Forms.Padding(4) - Me.RadioButton4.Name = "RadioButton4" - Me.RadioButton4.Size = New System.Drawing.Size(125, 21) - Me.RadioButton4.TabIndex = 15 - Me.RadioButton4.TabStop = True - Me.RadioButton4.Text = "Aggiungi orario" - Me.RadioButton4.UseVisualStyleBackColor = True - ' - 'RadioButton6 - ' - Me.RadioButton6.AutoSize = True - Me.RadioButton6.Location = New System.Drawing.Point(172, 20) - Me.RadioButton6.Margin = New System.Windows.Forms.Padding(4) - Me.RadioButton6.Name = "RadioButton6" - Me.RadioButton6.Size = New System.Drawing.Size(107, 21) - Me.RadioButton6.TabIndex = 17 - Me.RadioButton6.TabStop = True - Me.RadioButton6.Text = "Numero foto" - Me.RadioButton6.UseVisualStyleBackColor = True - ' - 'RadioButton5 - ' - Me.RadioButton5.AutoSize = True - Me.RadioButton5.Location = New System.Drawing.Point(20, 80) - Me.RadioButton5.Margin = New System.Windows.Forms.Padding(4) - Me.RadioButton5.Name = "RadioButton5" - Me.RadioButton5.Size = New System.Drawing.Size(109, 21) - Me.RadioButton5.TabIndex = 16 - Me.RadioButton5.TabStop = True - Me.RadioButton5.Text = "Tempo Gara" - Me.RadioButton5.UseVisualStyleBackColor = True - ' - 'Label5 - ' - Me.Label5.AutoSize = True - Me.Label5.ForeColor = System.Drawing.Color.Black - Me.Label5.Location = New System.Drawing.Point(32, 108) - Me.Label5.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label5.Name = "Label5" - Me.Label5.Size = New System.Drawing.Size(54, 17) - Me.Label5.TabIndex = 12 - Me.Label5.Text = "Altezza" - ' - 'TextBox5 - ' - Me.TextBox5.Location = New System.Drawing.Point(96, 79) - Me.TextBox5.Margin = New System.Windows.Forms.Padding(4) - Me.TextBox5.Name = "TextBox5" - Me.TextBox5.Size = New System.Drawing.Size(116, 22) - Me.TextBox5.TabIndex = 10 - Me.TextBox5.Text = "TextBox5" - ' - 'Label6 - ' - Me.Label6.AutoSize = True - Me.Label6.ForeColor = System.Drawing.Color.Black - Me.Label6.Location = New System.Drawing.Point(11, 79) - Me.Label6.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label6.Name = "Label6" - Me.Label6.Size = New System.Drawing.Size(75, 17) - Me.Label6.TabIndex = 13 - Me.Label6.Text = "Larghezza" - ' - 'TextBox6 - ' - Me.TextBox6.Location = New System.Drawing.Point(96, 108) - Me.TextBox6.Margin = New System.Windows.Forms.Padding(4) - Me.TextBox6.Name = "TextBox6" - Me.TextBox6.Size = New System.Drawing.Size(116, 22) - Me.TextBox6.TabIndex = 11 - Me.TextBox6.Text = "TextBox6" - ' - 'Label3 - ' - Me.Label3.AutoSize = True - Me.Label3.ForeColor = System.Drawing.Color.Black - Me.Label3.Location = New System.Drawing.Point(32, 49) - Me.Label3.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label3.Name = "Label3" - Me.Label3.Size = New System.Drawing.Size(58, 17) - Me.Label3.TabIndex = 7 - Me.Label3.Text = "Suffisso" - ' - 'TextBox3 - ' - Me.TextBox3.Location = New System.Drawing.Point(96, 49) - Me.TextBox3.Margin = New System.Windows.Forms.Padding(4) - Me.TextBox3.Name = "TextBox3" - Me.TextBox3.Size = New System.Drawing.Size(116, 22) - Me.TextBox3.TabIndex = 6 - Me.TextBox3.Text = "TextBox3" - ' - 'CheckBox1 - ' - Me.CheckBox1.Checked = True - Me.CheckBox1.CheckState = System.Windows.Forms.CheckState.Checked - Me.CheckBox1.ForeColor = System.Drawing.Color.Black - Me.CheckBox1.Location = New System.Drawing.Point(96, 20) - Me.CheckBox1.Margin = New System.Windows.Forms.Padding(4) - Me.CheckBox1.Name = "CheckBox1" - Me.CheckBox1.Size = New System.Drawing.Size(139, 30) - Me.CheckBox1.TabIndex = 5 - Me.CheckBox1.Text = "Crea miniature" - ' - 'tabLogo - ' - Me.tabLogo.Controls.Add(Me.GroupBox6) - Me.tabLogo.Location = New System.Drawing.Point(4, 25) - Me.tabLogo.Margin = New System.Windows.Forms.Padding(4) - Me.tabLogo.Name = "tabLogo" - Me.tabLogo.Padding = New System.Windows.Forms.Padding(4) - Me.tabLogo.Size = New System.Drawing.Size(687, 435) - Me.tabLogo.TabIndex = 3 - Me.tabLogo.Text = "Logo" - Me.tabLogo.UseVisualStyleBackColor = True - ' - 'GroupBox6 - ' - Me.GroupBox6.Controls.Add(Me.PictureBox2) - Me.GroupBox6.Controls.Add(Me.PictureBox1) - Me.GroupBox6.Controls.Add(Me.ComboBox5) - Me.GroupBox6.Controls.Add(Me.ComboBox4) - Me.GroupBox6.Controls.Add(Me.TextBox19) - Me.GroupBox6.Controls.Add(Me.Label28) - Me.GroupBox6.Controls.Add(Me.CheckBox5) - Me.GroupBox6.Controls.Add(Me.TextBox15) - Me.GroupBox6.Controls.Add(Me.TextBox14) - Me.GroupBox6.Controls.Add(Me.Label25) - Me.GroupBox6.Controls.Add(Me.TextBox16) - Me.GroupBox6.Controls.Add(Me.Label24) - Me.GroupBox6.Controls.Add(Me.Label22) - Me.GroupBox6.Controls.Add(Me.Label23) - Me.GroupBox6.Controls.Add(Me.Button4) - Me.GroupBox6.Controls.Add(Me.TextBox10) - Me.GroupBox6.Controls.Add(Me.Label29) - Me.GroupBox6.Controls.Add(Me.Label30) - Me.GroupBox6.Controls.Add(Me.PictureBox3) - Me.GroupBox6.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer)) - Me.GroupBox6.Location = New System.Drawing.Point(8, 7) - Me.GroupBox6.Margin = New System.Windows.Forms.Padding(4) - Me.GroupBox6.Name = "GroupBox6" - Me.GroupBox6.Padding = New System.Windows.Forms.Padding(4) - Me.GroupBox6.Size = New System.Drawing.Size(661, 276) - Me.GroupBox6.TabIndex = 42 - Me.GroupBox6.TabStop = False - Me.GroupBox6.Text = "Logo" - ' - 'PictureBox2 - ' - Me.PictureBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle - Me.PictureBox2.Location = New System.Drawing.Point(192, 236) - Me.PictureBox2.Margin = New System.Windows.Forms.Padding(4) - Me.PictureBox2.Name = "PictureBox2" - Me.PictureBox2.Size = New System.Drawing.Size(31, 29) - Me.PictureBox2.TabIndex = 44 - Me.PictureBox2.TabStop = False - Me.PictureBox2.Visible = False - ' - 'PictureBox1 - ' - Me.PictureBox1.Cursor = System.Windows.Forms.Cursors.Cross - Me.PictureBox1.Location = New System.Drawing.Point(341, 69) - Me.PictureBox1.Margin = New System.Windows.Forms.Padding(4) - Me.PictureBox1.Name = "PictureBox1" - Me.PictureBox1.Size = New System.Drawing.Size(299, 197) - Me.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage - Me.PictureBox1.TabIndex = 43 - Me.PictureBox1.TabStop = False - ' - 'ComboBox5 - ' - Me.ComboBox5.Location = New System.Drawing.Point(192, 207) - Me.ComboBox5.Margin = New System.Windows.Forms.Padding(4) - Me.ComboBox5.Name = "ComboBox5" - Me.ComboBox5.Size = New System.Drawing.Size(127, 24) - Me.ComboBox5.TabIndex = 42 - Me.ComboBox5.Text = "ComboBox5" - ' - 'ComboBox4 - ' - Me.ComboBox4.Location = New System.Drawing.Point(192, 177) - Me.ComboBox4.Margin = New System.Windows.Forms.Padding(4) - Me.ComboBox4.Name = "ComboBox4" - Me.ComboBox4.Size = New System.Drawing.Size(127, 24) - Me.ComboBox4.TabIndex = 41 - Me.ComboBox4.Text = "ComboBox4" - ' - 'TextBox19 - ' - Me.TextBox19.Location = New System.Drawing.Point(192, 118) - Me.TextBox19.Margin = New System.Windows.Forms.Padding(4) - Me.TextBox19.Name = "TextBox19" - Me.TextBox19.Size = New System.Drawing.Size(127, 22) - Me.TextBox19.TabIndex = 40 - Me.TextBox19.Text = "TextBox19" - ' - 'Label28 - ' - Me.Label28.ForeColor = System.Drawing.Color.Black - Me.Label28.Location = New System.Drawing.Point(23, 119) - Me.Label28.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label28.Name = "Label28" - Me.Label28.Size = New System.Drawing.Size(160, 20) - Me.Label28.TabIndex = 39 - Me.Label28.Text = "Trasparenza (0-100%)" - Me.Label28.TextAlign = System.Drawing.ContentAlignment.MiddleLeft - ' - 'CheckBox5 - ' - Me.CheckBox5.Checked = True - Me.CheckBox5.CheckState = System.Windows.Forms.CheckState.Checked - Me.CheckBox5.ForeColor = System.Drawing.Color.Black - Me.CheckBox5.Location = New System.Drawing.Point(0, 32) - Me.CheckBox5.Margin = New System.Windows.Forms.Padding(4) - Me.CheckBox5.Name = "CheckBox5" - Me.CheckBox5.Size = New System.Drawing.Size(96, 25) - Me.CheckBox5.TabIndex = 38 - Me.CheckBox5.Text = "Aggiungi" - ' - 'TextBox15 - ' - Me.TextBox15.Location = New System.Drawing.Point(192, 89) - Me.TextBox15.Margin = New System.Windows.Forms.Padding(4) - Me.TextBox15.Name = "TextBox15" - Me.TextBox15.Size = New System.Drawing.Size(127, 22) - Me.TextBox15.TabIndex = 19 - Me.TextBox15.Text = "TextBox15" - ' - 'TextBox14 - ' - Me.TextBox14.Location = New System.Drawing.Point(192, 59) - Me.TextBox14.Margin = New System.Windows.Forms.Padding(4) - Me.TextBox14.Name = "TextBox14" - Me.TextBox14.Size = New System.Drawing.Size(127, 22) - Me.TextBox14.TabIndex = 18 - Me.TextBox14.Text = "TextBox14" - ' - 'Label25 - ' - Me.Label25.AutoSize = True - Me.Label25.ForeColor = System.Drawing.Color.Black - Me.Label25.Location = New System.Drawing.Point(23, 207) - Me.Label25.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label25.Name = "Label25" - Me.Label25.Size = New System.Drawing.Size(126, 17) - Me.Label25.TabIndex = 36 - Me.Label25.Text = "Posizione verticale" - Me.Label25.TextAlign = System.Drawing.ContentAlignment.MiddleLeft - ' - 'TextBox16 - ' - Me.TextBox16.Location = New System.Drawing.Point(192, 148) - Me.TextBox16.Margin = New System.Windows.Forms.Padding(4) - Me.TextBox16.Name = "TextBox16" - Me.TextBox16.Size = New System.Drawing.Size(127, 22) - Me.TextBox16.TabIndex = 35 - Me.TextBox16.Text = "TextBox16" - ' - 'Label24 - ' - Me.Label24.AutoSize = True - Me.Label24.ForeColor = System.Drawing.Color.Black - Me.Label24.Location = New System.Drawing.Point(25, 151) - Me.Label24.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label24.Name = "Label24" - Me.Label24.Size = New System.Drawing.Size(117, 17) - Me.Label24.TabIndex = 34 - Me.Label24.Text = "Margine (pixel/%)" - Me.Label24.TextAlign = System.Drawing.ContentAlignment.MiddleLeft - ' - 'Label22 - ' - Me.Label22.AutoSize = True - Me.Label22.ForeColor = System.Drawing.Color.Black - Me.Label22.Location = New System.Drawing.Point(25, 63) - Me.Label22.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label22.Name = "Label22" - Me.Label22.Size = New System.Drawing.Size(54, 17) - Me.Label22.TabIndex = 20 - Me.Label22.Text = "Altezza" - Me.Label22.TextAlign = System.Drawing.ContentAlignment.MiddleLeft - ' - 'Label23 - ' - Me.Label23.AutoSize = True - Me.Label23.ForeColor = System.Drawing.Color.Black - Me.Label23.Location = New System.Drawing.Point(25, 92) - Me.Label23.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label23.Name = "Label23" - Me.Label23.Size = New System.Drawing.Size(75, 17) - Me.Label23.TabIndex = 21 - Me.Label23.Text = "Larghezza" - Me.Label23.TextAlign = System.Drawing.ContentAlignment.MiddleLeft - ' - 'Button4 - ' - Me.Button4.Location = New System.Drawing.Point(619, 30) - Me.Button4.Margin = New System.Windows.Forms.Padding(4) - Me.Button4.Name = "Button4" - Me.Button4.Size = New System.Drawing.Size(32, 25) - Me.Button4.TabIndex = 8 - Me.Button4.Text = "..." - ' - 'TextBox10 - ' - Me.TextBox10.Location = New System.Drawing.Point(192, 30) - Me.TextBox10.Margin = New System.Windows.Forms.Padding(4) - Me.TextBox10.Name = "TextBox10" - Me.TextBox10.Size = New System.Drawing.Size(415, 22) - Me.TextBox10.TabIndex = 6 - Me.TextBox10.Text = "TextBox10" - ' - 'Label29 - ' - Me.Label29.AutoSize = True - Me.Label29.ForeColor = System.Drawing.Color.Black - Me.Label29.Location = New System.Drawing.Point(23, 181) - Me.Label29.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label29.Name = "Label29" - Me.Label29.Size = New System.Drawing.Size(142, 17) - Me.Label29.TabIndex = 36 - Me.Label29.Text = "Posizione orizzontale" - Me.Label29.TextAlign = System.Drawing.ContentAlignment.MiddleLeft - ' - 'Label30 - ' - Me.Label30.AutoSize = True - Me.Label30.ForeColor = System.Drawing.Color.Black - Me.Label30.Location = New System.Drawing.Point(25, 250) - Me.Label30.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label30.Name = "Label30" - Me.Label30.Size = New System.Drawing.Size(126, 17) - Me.Label30.TabIndex = 36 - Me.Label30.Text = "Colore trasparente" - Me.Label30.TextAlign = System.Drawing.ContentAlignment.MiddleLeft - Me.Label30.Visible = False - ' - 'PictureBox3 - ' - Me.PictureBox3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle - Me.PictureBox3.Location = New System.Drawing.Point(288, 236) - Me.PictureBox3.Margin = New System.Windows.Forms.Padding(4) - Me.PictureBox3.Name = "PictureBox3" - Me.PictureBox3.Size = New System.Drawing.Size(31, 29) - Me.PictureBox3.TabIndex = 44 - Me.PictureBox3.TabStop = False - Me.PictureBox3.Visible = False - ' - 'Label27 - ' - Me.Label27.Location = New System.Drawing.Point(788, 465) - Me.Label27.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label27.Name = "Label27" - Me.Label27.Size = New System.Drawing.Size(187, 25) - Me.Label27.TabIndex = 62 - Me.Label27.Text = "Versione 2.2 2021" - Me.Label27.TextAlign = System.Drawing.ContentAlignment.MiddleRight - ' - 'Button7 - ' - Me.Button7.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Button7.Location = New System.Drawing.Point(719, 148) - Me.Button7.Margin = New System.Windows.Forms.Padding(4) - Me.Button7.Name = "Button7" - Me.Button7.Size = New System.Drawing.Size(256, 49) - Me.Button7.TabIndex = 61 - Me.Button7.Text = "stop creazione" - ' - 'btnSalvaImpostazioni - ' - Me.btnSalvaImpostazioni.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.btnSalvaImpostazioni.Location = New System.Drawing.Point(719, 53) - Me.btnSalvaImpostazioni.Margin = New System.Windows.Forms.Padding(4) - Me.btnSalvaImpostazioni.Name = "btnSalvaImpostazioni" - Me.btnSalvaImpostazioni.Size = New System.Drawing.Size(256, 39) - Me.btnSalvaImpostazioni.TabIndex = 60 - Me.btnSalvaImpostazioni.Text = "Salva impostazioni" - ' - 'Label20 - ' - Me.Label20.AutoSize = True - Me.Label20.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Label20.Location = New System.Drawing.Point(719, 362) - Me.Label20.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label20.Name = "Label20" - Me.Label20.Size = New System.Drawing.Size(126, 20) - Me.Label20.TabIndex = 59 - Me.Label20.Text = "foto generate:" - ' - 'Label19 - ' - Me.Label19.AutoSize = True - Me.Label19.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Label19.Location = New System.Drawing.Point(719, 338) - Me.Label19.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label19.Name = "Label19" - Me.Label19.Size = New System.Drawing.Size(101, 20) - Me.Label19.TabIndex = 58 - Me.Label19.Text = "foto totali: " - ' - 'Label18 - ' - Me.Label18.AutoSize = True - Me.Label18.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Label18.Location = New System.Drawing.Point(857, 362) - Me.Label18.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label18.Name = "Label18" - Me.Label18.Size = New System.Drawing.Size(24, 25) - Me.Label18.TabIndex = 57 - Me.Label18.Text = "0" - ' - 'lblFotoTotaliNum - ' - Me.lblFotoTotaliNum.AutoSize = True - Me.lblFotoTotaliNum.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.lblFotoTotaliNum.Location = New System.Drawing.Point(857, 338) - Me.lblFotoTotaliNum.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.lblFotoTotaliNum.Name = "lblFotoTotaliNum" - Me.lblFotoTotaliNum.Size = New System.Drawing.Size(24, 25) - Me.lblFotoTotaliNum.TabIndex = 56 - Me.lblFotoTotaliNum.Text = "0" - ' - 'Label10 - ' - Me.Label10.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Label10.Location = New System.Drawing.Point(719, 201) - Me.Label10.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) - Me.Label10.Name = "Label10" - Me.Label10.Size = New System.Drawing.Size(256, 89) - Me.Label10.TabIndex = 55 - Me.Label10.Text = "file" - ' - 'btnCreaCatalogo - ' - Me.btnCreaCatalogo.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.btnCreaCatalogo.Location = New System.Drawing.Point(719, 95) - Me.btnCreaCatalogo.Margin = New System.Windows.Forms.Padding(4) - Me.btnCreaCatalogo.Name = "btnCreaCatalogo" - Me.btnCreaCatalogo.Size = New System.Drawing.Size(102, 39) - Me.btnCreaCatalogo.TabIndex = 53 - Me.btnCreaCatalogo.Text = "crea catalogo" - ' - 'btnCaricaImpostazioni - ' - Me.btnCaricaImpostazioni.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.btnCaricaImpostazioni.Location = New System.Drawing.Point(719, 15) - Me.btnCaricaImpostazioni.Margin = New System.Windows.Forms.Padding(4) - Me.btnCaricaImpostazioni.Name = "btnCaricaImpostazioni" - Me.btnCaricaImpostazioni.Size = New System.Drawing.Size(256, 39) - Me.btnCaricaImpostazioni.TabIndex = 54 - Me.btnCaricaImpostazioni.Text = "Carica impostazioni" - ' - 'btnCreaCatalogoAsync - ' - Me.btnCreaCatalogoAsync.Location = New System.Drawing.Point(647, 78) - Me.btnCreaCatalogoAsync.Name = "btnCreaCatalogoAsync" - Me.btnCreaCatalogoAsync.Size = New System.Drawing.Size(84, 38) - Me.btnCreaCatalogoAsync.TabIndex = 68 - Me.btnCreaCatalogoAsync.Text = "Crea 2" - Me.btnCreaCatalogoAsync.UseVisualStyleBackColor = True - ' - 'MainForm - ' - Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 16.0!) - Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(739, 401) - Me.Controls.Add(Me.btnCreaCatalogoAsync) - Me.Controls.Add(Me.ProgressBar1) - Me.Controls.Add(Me.CheckBox22) - Me.Controls.Add(Me.Label43) - Me.Controls.Add(Me.tabControl) - Me.Controls.Add(Me.Label27) - Me.Controls.Add(Me.Button7) - Me.Controls.Add(Me.btnSalvaImpostazioni) - Me.Controls.Add(Me.Label20) - Me.Controls.Add(Me.Label19) - Me.Controls.Add(Me.Label18) - Me.Controls.Add(Me.lblFotoTotaliNum) - Me.Controls.Add(Me.Label10) - Me.Controls.Add(Me.btnCreaCatalogo) - Me.Controls.Add(Me.btnCaricaImpostazioni) - Me.Margin = New System.Windows.Forms.Padding(4) - Me.MaximizeBox = False - Me.Name = "MainForm" - Me.Text = "Image Catalog" - Me.tabControl.ResumeLayout(False) - Me.tabGenerale.ResumeLayout(False) - Me.grpAvanzate.ResumeLayout(False) - Me.grpAvanzate.PerformLayout - Me.Panel3.ResumeLayout(False) - Me.Panel3.PerformLayout - Me.GroupBox3.ResumeLayout(False) - Me.GroupBox3.PerformLayout - Me.grpSottocartelle.ResumeLayout(False) - Me.grpSottocartelle.PerformLayout - Me.grpGenerale.ResumeLayout(False) - Me.grpGenerale.PerformLayout - Me.tabTesto.ResumeLayout(False) - Me.tabTesto.PerformLayout - Me.grpTestoFotoVerticali.ResumeLayout(False) - Me.grpTestoFotoVerticali.PerformLayout - Me.grpSlideShow.ResumeLayout(False) - Me.grpSlideShow.PerformLayout - Me.grpCarattere.ResumeLayout(False) - Me.grpCarattere.PerformLayout - Me.GroupBox4.ResumeLayout(False) - Me.GroupBox4.PerformLayout - Me.tabFoto.ResumeLayout(False) - Me.GroupBox2.ResumeLayout(False) - Me.GroupBox2.PerformLayout - Me.tabMiniature.ResumeLayout(False) - Me.Panel1.ResumeLayout(False) - Me.Panel1.PerformLayout - Me.GroupBox1.ResumeLayout(False) - Me.GroupBox1.PerformLayout - Me.Panel2.ResumeLayout(False) - Me.Panel2.PerformLayout - Me.tabLogo.ResumeLayout(False) - Me.GroupBox6.ResumeLayout(False) - Me.GroupBox6.PerformLayout - CType(Me.PictureBox2, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.PictureBox3, System.ComponentModel.ISupportInitialize).EndInit() - Me.ResumeLayout(False) - Me.PerformLayout - - End Sub - Friend WithEvents ProgressBar1 As System.Windows.Forms.ProgressBar - Friend WithEvents CheckBox22 As System.Windows.Forms.CheckBox - Friend WithEvents Label43 As System.Windows.Forms.Label - Friend WithEvents tabControl As System.Windows.Forms.TabControl - Friend WithEvents tabGenerale As System.Windows.Forms.TabPage - Friend WithEvents GroupBox3 As System.Windows.Forms.GroupBox - Friend WithEvents chkAggiornaSottodirectory As System.Windows.Forms.CheckBox - Friend WithEvents Button3 As System.Windows.Forms.Button - Friend WithEvents Button2 As System.Windows.Forms.Button - Friend WithEvents Label1 As System.Windows.Forms.Label - Friend WithEvents Label2 As System.Windows.Forms.Label - Friend WithEvents txtSorgente As System.Windows.Forms.TextBox - Friend WithEvents txtDestinazione As System.Windows.Forms.TextBox - Friend WithEvents grpSottocartelle As System.Windows.Forms.GroupBox - Friend WithEvents rdbNumFiles As System.Windows.Forms.RadioButton - Friend WithEvents rdbNumProgressiva As System.Windows.Forms.RadioButton - Friend WithEvents txtCifreContatore As System.Windows.Forms.TextBox - Friend WithEvents Label34 As System.Windows.Forms.Label - Friend WithEvents txtSuffissoCartelle As System.Windows.Forms.TextBox - Friend WithEvents Label33 As System.Windows.Forms.Label - Friend WithEvents Label31 As System.Windows.Forms.Label - Friend WithEvents chkCreaSottocartelle As System.Windows.Forms.CheckBox - Friend WithEvents txtFilePerCartella As System.Windows.Forms.TextBox - Friend WithEvents Label32 As System.Windows.Forms.Label - Friend WithEvents grpGenerale As System.Windows.Forms.GroupBox - Friend WithEvents chkRotazioneAutomatica As System.Windows.Forms.CheckBox - Friend WithEvents chkForzaJpg As System.Windows.Forms.CheckBox - Friend WithEvents tabTesto As System.Windows.Forms.TabPage - Friend WithEvents grpTestoFotoVerticali As System.Windows.Forms.GroupBox - Friend WithEvents Label42 As System.Windows.Forms.Label - Friend WithEvents Label41 As System.Windows.Forms.Label - Friend WithEvents TextBox31 As System.Windows.Forms.TextBox - Friend WithEvents TextBox30 As System.Windows.Forms.TextBox - Friend WithEvents grpSlideShow As System.Windows.Forms.GroupBox - Friend WithEvents CheckBox17 As System.Windows.Forms.CheckBox - Friend WithEvents CheckBox16 As System.Windows.Forms.CheckBox - Friend WithEvents grpCarattere As System.Windows.Forms.GroupBox - Friend WithEvents TextBox34 As System.Windows.Forms.TextBox - Friend WithEvents Button8 As System.Windows.Forms.Button - Friend WithEvents Label36 As System.Windows.Forms.Label - Friend WithEvents TextBox25 As System.Windows.Forms.TextBox - Friend WithEvents Label35 As System.Windows.Forms.Label - Friend WithEvents ComboBox3 As System.Windows.Forms.ComboBox - Friend WithEvents TextBox11 As System.Windows.Forms.TextBox - Friend WithEvents Label12 As System.Windows.Forms.Label - Friend WithEvents Label11 As System.Windows.Forms.Label - Friend WithEvents CheckBox3 As System.Windows.Forms.CheckBox - Friend WithEvents GroupBox4 As System.Windows.Forms.GroupBox - Friend WithEvents Label40 As System.Windows.Forms.Label - Friend WithEvents TextBox29 As System.Windows.Forms.TextBox - Friend WithEvents TextBox18 As System.Windows.Forms.TextBox - Friend WithEvents Label26 As System.Windows.Forms.Label - Friend WithEvents DateTimePicker1 As System.Windows.Forms.DateTimePicker - Friend WithEvents CheckBox8 As System.Windows.Forms.CheckBox - Friend WithEvents TextBox9 As System.Windows.Forms.TextBox - Friend WithEvents CheckBox7 As System.Windows.Forms.CheckBox - Friend WithEvents Label4 As System.Windows.Forms.Label - Friend WithEvents TextBox4 As System.Windows.Forms.TextBox - Friend WithEvents Label9 As System.Windows.Forms.Label - Friend WithEvents Label13 As System.Windows.Forms.Label - Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox - Friend WithEvents ComboBox2 As System.Windows.Forms.ComboBox - Friend WithEvents Label14 As System.Windows.Forms.Label - Friend WithEvents TextBox12 As System.Windows.Forms.TextBox - Friend WithEvents Label15 As System.Windows.Forms.Label - Friend WithEvents tabFoto As System.Windows.Forms.TabPage - Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox - Friend WithEvents Label45 As System.Windows.Forms.Label - Friend WithEvents TextBox32 As System.Windows.Forms.TextBox - Friend WithEvents TextBox26 As System.Windows.Forms.TextBox - Friend WithEvents Label37 As System.Windows.Forms.Label - Friend WithEvents Label38 As System.Windows.Forms.Label - Friend WithEvents TextBox27 As System.Windows.Forms.TextBox - Friend WithEvents Label39 As System.Windows.Forms.Label - Friend WithEvents TextBox28 As System.Windows.Forms.TextBox - Friend WithEvents CheckBox15 As System.Windows.Forms.CheckBox - Friend WithEvents tabMiniature As System.Windows.Forms.TabPage - Friend WithEvents Panel1 As System.Windows.Forms.Panel - Friend WithEvents CheckBox18 As System.Windows.Forms.CheckBox - Friend WithEvents CheckBox4 As System.Windows.Forms.CheckBox - Friend WithEvents CheckBox12 As System.Windows.Forms.CheckBox - Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox - Friend WithEvents Label46 As System.Windows.Forms.Label - Friend WithEvents TextBox33 As System.Windows.Forms.TextBox - Friend WithEvents Panel2 As System.Windows.Forms.Panel - Friend WithEvents RadioButton3 As System.Windows.Forms.RadioButton - Friend WithEvents RadioButton7 As System.Windows.Forms.RadioButton - Friend WithEvents RadioButton4 As System.Windows.Forms.RadioButton - Friend WithEvents RadioButton6 As System.Windows.Forms.RadioButton - Friend WithEvents RadioButton5 As System.Windows.Forms.RadioButton - Friend WithEvents Label5 As System.Windows.Forms.Label - Friend WithEvents TextBox5 As System.Windows.Forms.TextBox - Friend WithEvents Label6 As System.Windows.Forms.Label - Friend WithEvents TextBox6 As System.Windows.Forms.TextBox - Friend WithEvents Label3 As System.Windows.Forms.Label - Friend WithEvents TextBox3 As System.Windows.Forms.TextBox - Friend WithEvents CheckBox1 As System.Windows.Forms.CheckBox - Friend WithEvents tabLogo As System.Windows.Forms.TabPage - Friend WithEvents GroupBox6 As System.Windows.Forms.GroupBox - Friend WithEvents PictureBox2 As System.Windows.Forms.PictureBox - Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox - Friend WithEvents ComboBox5 As System.Windows.Forms.ComboBox - Friend WithEvents ComboBox4 As System.Windows.Forms.ComboBox - Friend WithEvents TextBox19 As System.Windows.Forms.TextBox - Friend WithEvents Label28 As System.Windows.Forms.Label - Friend WithEvents CheckBox5 As System.Windows.Forms.CheckBox - Friend WithEvents TextBox15 As System.Windows.Forms.TextBox - Friend WithEvents TextBox14 As System.Windows.Forms.TextBox - Friend WithEvents Label25 As System.Windows.Forms.Label - Friend WithEvents TextBox16 As System.Windows.Forms.TextBox - Friend WithEvents Label24 As System.Windows.Forms.Label - Friend WithEvents Label22 As System.Windows.Forms.Label - Friend WithEvents Label23 As System.Windows.Forms.Label - Friend WithEvents Button4 As System.Windows.Forms.Button - Friend WithEvents TextBox10 As System.Windows.Forms.TextBox - Friend WithEvents Label29 As System.Windows.Forms.Label - Friend WithEvents Label30 As System.Windows.Forms.Label - Friend WithEvents PictureBox3 As System.Windows.Forms.PictureBox - Friend WithEvents Label27 As System.Windows.Forms.Label - Friend WithEvents Button7 As System.Windows.Forms.Button - Friend WithEvents btnSalvaImpostazioni As System.Windows.Forms.Button - Friend WithEvents Label20 As System.Windows.Forms.Label - Friend WithEvents Label19 As System.Windows.Forms.Label - Friend WithEvents Label18 As System.Windows.Forms.Label - Friend WithEvents lblFotoTotaliNum As System.Windows.Forms.Label - Friend WithEvents Label10 As System.Windows.Forms.Label - Friend WithEvents btnCreaCatalogo As System.Windows.Forms.Button - Friend WithEvents btnCaricaImpostazioni As System.Windows.Forms.Button - Friend WithEvents grpAvanzate As System.Windows.Forms.GroupBox - Friend WithEvents Label7 As System.Windows.Forms.Label - Friend WithEvents TextBox7 As System.Windows.Forms.TextBox - Friend WithEvents Label8 As System.Windows.Forms.Label - Friend WithEvents TextBox8 As System.Windows.Forms.TextBox - Friend WithEvents Panel3 As System.Windows.Forms.Panel - Friend WithEvents rdbNuovoMetodo As System.Windows.Forms.RadioButton - Friend WithEvents rdbVecchioMetodo As System.Windows.Forms.RadioButton - Friend WithEvents CheckBox2 As System.Windows.Forms.CheckBox - Friend WithEvents chkSovrascriviFile As System.Windows.Forms.CheckBox - Friend WithEvents btnCreaCatalogoAsync As Button -End Class diff --git a/imagecatalog/MainForm.cs b/imagecatalog/MainForm.cs index 541f383..1fe9b91 100644 --- a/imagecatalog/MainForm.cs +++ b/imagecatalog/MainForm.cs @@ -31,9 +31,12 @@ public partial class MainForm private readonly ImageCreationStuff _imageCreationService; - public MainForm( ImageCreationStuff imageCreationStuff, ILogger logger) + private readonly ParametriSetup _parametriSetup; + + public MainForm( ImageCreationStuff imageCreationStuff, ParametriSetup parametriSetup, ILogger logger) { _imageCreationService = imageCreationStuff; + _parametriSetup = parametriSetup; _logger = logger; _logger.LogDebug("Start"); @@ -383,42 +386,6 @@ public partial class MainForm { Model.DestinationPath = dialogResult; } - - //var DirSearch = new FolderBrowserDialog(); - //DirSearch.SelectedPath = txtDestinazione.Text; - //if (DialogResult.OK == DirSearch.ShowDialog()) - //{ - // string DirectoryScelta = DirSearch.SelectedPath; - // if (DirectoryScelta.EndsWith(@"\") == false) - // { - // DirectoryScelta += @"\"; - // } - - // txtDestinazione.Text = DirectoryScelta; - //} - - // Dim openFileDialog As OpenFileDialog = New OpenFileDialog - - // Dim openFileDialog As OpenFileDialog = New OpenFileDialog - - // openFileDialog.InitialDirectory = TextBox1.Text - // openFileDialog.Filter = "Bitmap files (*.bmp)|*.bmp|Jpeg files (*.jpg)|*.jpg|All valid files (*.*)|*.*" - // openFileDialog.FilterIndex = 2 - // openFileDialog.RestoreDirectory = True - - // If DialogResult.OK = openFileDialog.ShowDialog() Then - // Dim IlNome As String = openFileDialog.FileName - // Dim NomeFine As String = "" - // Dim i As Integer - - // Dim Elenco As String() - // Elenco = IlNome.Split(New Char() {"\"c}) - // For i = 0 To Elenco.Length - 1 - // NomeFine &= Elenco(i) & "\" - // Next - - // TextBox1.Text = NomeFine - // End If } private void Button5_Click(object sender, EventArgs e) @@ -432,72 +399,72 @@ public partial class MainForm if (DialogResult.OK == SaveFileDlg.ShowDialog()) { string IlNome = SaveFileDlg.FileName; - Module1.SetupIni.NomeFileSetup = IlNome; - Module1.SetupIni.AggiornaParametro("DirSorgente", Model.SourcePath); - Module1.SetupIni.AggiornaParametro("DirDestinazione", Model.DestinationPath); - Module1.SetupIni.AggiornaParametro("DirSottoDirectory", chkAggiornaSottodirectory.Checked); - Module1.SetupIni.AggiornaParametro("DirDividiDestinazione", chkCreaSottocartelle.Checked); - Module1.SetupIni.AggiornaParametro("DirDividiNumFile", txtFilePerCartella.Text); - Module1.SetupIni.AggiornaParametro("DirDividiSuffisso", txtSuffissoCartelle.Text); - Module1.SetupIni.AggiornaParametro("DirDividiNumCifre", txtCifreContatore.Text); + _parametriSetup.NomeFileSetup = IlNome; + _parametriSetup.AggiornaParametro("DirSorgente", Model.SourcePath); + _parametriSetup.AggiornaParametro("DirDestinazione", Model.DestinationPath); + _parametriSetup.AggiornaParametro("DirSottoDirectory", chkAggiornaSottodirectory.Checked); + _parametriSetup.AggiornaParametro("DirDividiDestinazione", chkCreaSottocartelle.Checked); + _parametriSetup.AggiornaParametro("DirDividiNumFile", txtFilePerCartella.Text); + _parametriSetup.AggiornaParametro("DirDividiSuffisso", txtSuffissoCartelle.Text); + _parametriSetup.AggiornaParametro("DirDividiNumCifre", txtCifreContatore.Text); if (rdbNumProgressiva.Checked == true) { - Module1.SetupIni.AggiornaParametro("DirDividiTipoNumerazione", "Progressiva"); + _parametriSetup.AggiornaParametro("DirDividiTipoNumerazione", "Progressiva"); } else { - Module1.SetupIni.AggiornaParametro("DirDividiTipoNumerazione", "Files"); + _parametriSetup.AggiornaParametro("DirDividiTipoNumerazione", "Files"); } - Module1.SetupIni.AggiornaParametro("MiniatureCrea", CheckBox1.Checked); - Module1.SetupIni.AggiornaParametro("MiniatureSuffisso", TextBox3.Text); - Module1.SetupIni.AggiornaParametro("MiniatureAltezza", TextBox5.Text); - Module1.SetupIni.AggiornaParametro("MiniatureLarghezza", TextBox6.Text); - Module1.SetupIni.AggiornaParametro("MiniatureAddScritta", RadioButton3.Checked); - Module1.SetupIni.AggiornaParametro("MiniatureAddOrario", RadioButton4.Checked); - Module1.SetupIni.AggiornaParametro("FotoAltezza", TextBox27.Text); - Module1.SetupIni.AggiornaParametro("FotoLarghezza", TextBox28.Text); + _parametriSetup.AggiornaParametro("MiniatureCrea", CheckBox1.Checked); + _parametriSetup.AggiornaParametro("MiniatureSuffisso", TextBox3.Text); + _parametriSetup.AggiornaParametro("MiniatureAltezza", TextBox5.Text); + _parametriSetup.AggiornaParametro("MiniatureLarghezza", TextBox6.Text); + _parametriSetup.AggiornaParametro("MiniatureAddScritta", RadioButton3.Checked); + _parametriSetup.AggiornaParametro("MiniatureAddOrario", RadioButton4.Checked); + _parametriSetup.AggiornaParametro("FotoAltezza", TextBox27.Text); + _parametriSetup.AggiornaParametro("FotoLarghezza", TextBox28.Text); // SetupIni.AggiornaParametro("FotoCodice", TextBox13.Text) // SetupIni.AggiornaParametro("FotoDimOriginali", CheckBox2.Checked) - Module1.SetupIni.AggiornaParametro("FontDimensione", TextBox11.Text); - Module1.SetupIni.AggiornaParametro("FontDimensioneMiniatura", TextBox25.Text); - Module1.SetupIni.AggiornaParametro("FontBold", CheckBox3.Checked); - Module1.SetupIni.AggiornaParametro("FontNome", ComboBox3.Text); - Module1.SetupIni.AggiornaParametro("TestoTesto", TextBox4.Text); - Module1.SetupIni.AggiornaParametro("TestoTrasparente", TextBox9.Text); - Module1.SetupIni.AggiornaParametro("TestoMargine", TextBox12.Text); - Module1.SetupIni.AggiornaParametro("TestoPosizione", ComboBox1.Text); - Module1.SetupIni.AggiornaParametro("TestoAllineamento", ComboBox2.Text); - Module1.SetupIni.AggiornaParametro("MarchioFile", TextBox10.Text); - Module1.SetupIni.AggiornaParametro("MarchioAltezza", TextBox14.Text); - Module1.SetupIni.AggiornaParametro("MarchioLarghezza", TextBox15.Text); - Module1.SetupIni.AggiornaParametro("MarchioMargine", TextBox16.Text); - Module1.SetupIni.AggiornaParametro("MarchioAllOrizzontale", ComboBox4.Text); - Module1.SetupIni.AggiornaParametro("MarchioAllVerticale", ComboBox5.Text); - Module1.SetupIni.AggiornaParametro("MarchioTrasparenza", TextBox19.Text); - Module1.SetupIni.AggiornaParametro("MarchioAggiungi", CheckBox5.Checked); - Module1.SetupIni.AggiornaParametro("TempoGara", CheckBox7.Checked); - Module1.SetupIni.AggiornaParametro("Orario", CheckBox8.Checked); - Module1.SetupIni.AggiornaParametro("EtichettaOrario", TextBox18.Text); - Module1.SetupIni.AggiornaParametro("GeneraleForzaJpg", chkForzaJpg.Checked); - Module1.SetupIni.AggiornaParametro("GeneraleRotazioneAutomatica", chkRotazioneAutomatica.Checked); - Module1.SetupIni.AggiornaParametro("GrandezzaVerticale", TextBox30.Text); - Module1.SetupIni.AggiornaParametro("MargineVerticale", TextBox31.Text); - Module1.SetupIni.AggiornaParametro("DimensioniOriginali", CheckBox15.Checked); - Module1.SetupIni.AggiornaParametro("TestoVerticale", TextBox29.Text); - Module1.SetupIni.AggiornaParametro("NomeMiniatura", RadioButton6.Checked); - Module1.SetupIni.AggiornaParametro("DataFoto", CheckBox16.Checked); - Module1.SetupIni.AggiornaParametro("NumeroFoto", CheckBox17.Checked); - Module1.SetupIni.AggiornaParametro("ColoreTestoRGB", TextBox34.Text); - Module1.SetupIni.AggiornaParametro("TempoSmall", RadioButton5.Checked); - Module1.SetupIni.AggiornaParametro("NumTempoSmall", RadioButton7.Checked); - Module1.SetupIni.AggiornaParametro("CompressioneJpeg", TextBox32.Text); - Module1.SetupIni.AggiornaParametro("CompressioneJpegMiniatura", TextBox33.Text); + _parametriSetup.AggiornaParametro("FontDimensione", TextBox11.Text); + _parametriSetup.AggiornaParametro("FontDimensioneMiniatura", TextBox25.Text); + _parametriSetup.AggiornaParametro("FontBold", CheckBox3.Checked); + _parametriSetup.AggiornaParametro("FontNome", ComboBox3.Text); + _parametriSetup.AggiornaParametro("TestoTesto", TextBox4.Text); + _parametriSetup.AggiornaParametro("TestoTrasparente", TextBox9.Text); + _parametriSetup.AggiornaParametro("TestoMargine", TextBox12.Text); + _parametriSetup.AggiornaParametro("TestoPosizione", ComboBox1.Text); + _parametriSetup.AggiornaParametro("TestoAllineamento", ComboBox2.Text); + _parametriSetup.AggiornaParametro("MarchioFile", TextBox10.Text); + _parametriSetup.AggiornaParametro("MarchioAltezza", TextBox14.Text); + _parametriSetup.AggiornaParametro("MarchioLarghezza", TextBox15.Text); + _parametriSetup.AggiornaParametro("MarchioMargine", TextBox16.Text); + _parametriSetup.AggiornaParametro("MarchioAllOrizzontale", ComboBox4.Text); + _parametriSetup.AggiornaParametro("MarchioAllVerticale", ComboBox5.Text); + _parametriSetup.AggiornaParametro("MarchioTrasparenza", TextBox19.Text); + _parametriSetup.AggiornaParametro("MarchioAggiungi", CheckBox5.Checked); + _parametriSetup.AggiornaParametro("TempoGara", CheckBox7.Checked); + _parametriSetup.AggiornaParametro("Orario", CheckBox8.Checked); + _parametriSetup.AggiornaParametro("EtichettaOrario", TextBox18.Text); + _parametriSetup.AggiornaParametro("GeneraleForzaJpg", chkForzaJpg.Checked); + _parametriSetup.AggiornaParametro("GeneraleRotazioneAutomatica", chkRotazioneAutomatica.Checked); + _parametriSetup.AggiornaParametro("GrandezzaVerticale", TextBox30.Text); + _parametriSetup.AggiornaParametro("MargineVerticale", TextBox31.Text); + _parametriSetup.AggiornaParametro("DimensioniOriginali", CheckBox15.Checked); + _parametriSetup.AggiornaParametro("TestoVerticale", TextBox29.Text); + _parametriSetup.AggiornaParametro("NomeMiniatura", RadioButton6.Checked); + _parametriSetup.AggiornaParametro("DataFoto", CheckBox16.Checked); + _parametriSetup.AggiornaParametro("NumeroFoto", CheckBox17.Checked); + _parametriSetup.AggiornaParametro("ColoreTestoRGB", TextBox34.Text); + _parametriSetup.AggiornaParametro("TempoSmall", RadioButton5.Checked); + _parametriSetup.AggiornaParametro("NumTempoSmall", RadioButton7.Checked); + _parametriSetup.AggiornaParametro("CompressioneJpeg", TextBox32.Text); + _parametriSetup.AggiornaParametro("CompressioneJpegMiniatura", TextBox33.Text); // 2021 - Module1.SetupIni.AggiornaParametro("ChunkSize", TextBox8.Text); - Module1.SetupIni.AggiornaParametro("ThreadsCount", TextBox7.Text); - Module1.SetupIni.SalvaParametriSetup(); + _parametriSetup.AggiornaParametro("ChunkSize", TextBox8.Text); + _parametriSetup.AggiornaParametro("ThreadsCount", TextBox7.Text); + _parametriSetup.SalvaParametriSetup(); Text = "Image Catalog - " + LeggiSoloNomeFile(IlNome); } } @@ -513,16 +480,16 @@ public partial class MainForm if (DialogResult.OK == openFileDialog.ShowDialog()) { string IlNome = openFileDialog.FileName; - Module1.SetupIni.NomeFileSetup = IlNome; - Module1.SetupIni.CaricaParametriSetup(); - Model.SourcePath = Module1.SetupIni.LeggiParametroString("DirSorgente"); - Model.DestinationPath = Module1.SetupIni.LeggiParametroString("DirDestinazione"); - chkAggiornaSottodirectory.Checked = Module1.SetupIni.LeggiParametroBoolean("DirSottoDirectory"); - chkCreaSottocartelle.Checked = Module1.SetupIni.LeggiParametroBoolean("DirDividiDestinazione"); - txtFilePerCartella.Text = Module1.SetupIni.LeggiParametroString("DirDividiNumFile"); - txtSuffissoCartelle.Text = Module1.SetupIni.LeggiParametroString("DirDividiSuffisso"); - txtCifreContatore.Text = Module1.SetupIni.LeggiParametroString("DirDividiNumCifre"); - string TestoTemp = Module1.SetupIni.LeggiParametroString("DirDividiTipoNumerazione"); + _parametriSetup.NomeFileSetup = IlNome; + _parametriSetup.CaricaParametriSetup(); + Model.SourcePath = _parametriSetup.LeggiParametroString("DirSorgente"); + Model.DestinationPath = _parametriSetup.LeggiParametroString("DirDestinazione"); + chkAggiornaSottodirectory.Checked = _parametriSetup.LeggiParametroBoolean("DirSottoDirectory"); + chkCreaSottocartelle.Checked = _parametriSetup.LeggiParametroBoolean("DirDividiDestinazione"); + txtFilePerCartella.Text = _parametriSetup.LeggiParametroString("DirDividiNumFile"); + txtSuffissoCartelle.Text = _parametriSetup.LeggiParametroString("DirDividiSuffisso"); + txtCifreContatore.Text = _parametriSetup.LeggiParametroString("DirDividiNumCifre"); + string TestoTemp = _parametriSetup.LeggiParametroString("DirDividiTipoNumerazione"); if (TestoTemp.ToUpper() == "PROGRESSIVA") { rdbNumProgressiva.Checked = true; @@ -532,56 +499,56 @@ public partial class MainForm rdbNumFiles.Checked = true; } - CheckBox1.Checked = Module1.SetupIni.LeggiParametroBoolean("MiniatureCrea"); - TextBox3.Text = Module1.SetupIni.LeggiParametroString("MiniatureSuffisso"); - TextBox5.Text = Module1.SetupIni.LeggiParametroString("MiniatureAltezza"); - TextBox6.Text = Module1.SetupIni.LeggiParametroString("MiniatureLarghezza"); - RadioButton3.Checked = Module1.SetupIni.LeggiParametroBoolean("MiniatureAddScritta"); - RadioButton4.Checked = Module1.SetupIni.LeggiParametroBoolean("MiniatureAddOrario"); - TextBox27.Text = Module1.SetupIni.LeggiParametroString("FotoAltezza"); - TextBox28.Text = Module1.SetupIni.LeggiParametroString("FotoLarghezza"); + CheckBox1.Checked = _parametriSetup.LeggiParametroBoolean("MiniatureCrea"); + TextBox3.Text = _parametriSetup.LeggiParametroString("MiniatureSuffisso"); + TextBox5.Text = _parametriSetup.LeggiParametroString("MiniatureAltezza"); + TextBox6.Text = _parametriSetup.LeggiParametroString("MiniatureLarghezza"); + RadioButton3.Checked = _parametriSetup.LeggiParametroBoolean("MiniatureAddScritta"); + RadioButton4.Checked = _parametriSetup.LeggiParametroBoolean("MiniatureAddOrario"); + TextBox27.Text = _parametriSetup.LeggiParametroString("FotoAltezza"); + TextBox28.Text = _parametriSetup.LeggiParametroString("FotoLarghezza"); // TextBox13.Text = SetupIni.LeggiParametroString("FotoCodice") // CheckBox2.Checked = SetupIni.LeggiParametroBoolean("FotoDimOriginali") - TextBox11.Text = Module1.SetupIni.LeggiParametroString("FontDimensione"); - TextBox25.Text = Module1.SetupIni.LeggiParametroString("FontDimensioneMiniatura"); - CheckBox3.Checked = Module1.SetupIni.LeggiParametroBoolean("FontBold"); - ComboBox3.Text = Module1.SetupIni.LeggiParametroString("FontNome"); + TextBox11.Text = _parametriSetup.LeggiParametroString("FontDimensione"); + TextBox25.Text = _parametriSetup.LeggiParametroString("FontDimensioneMiniatura"); + CheckBox3.Checked = _parametriSetup.LeggiParametroBoolean("FontBold"); + ComboBox3.Text = _parametriSetup.LeggiParametroString("FontNome"); if (string.IsNullOrEmpty(TextBox25.Text)) { TextBox25.Text = "0"; } - TextBox4.Text = Module1.SetupIni.LeggiParametroString("TestoTesto"); - TextBox9.Text = Module1.SetupIni.LeggiParametroString("TestoTrasparente"); - TextBox12.Text = Module1.SetupIni.LeggiParametroString("TestoMargine"); - ComboBox1.Text = Module1.SetupIni.LeggiParametroString("TestoPosizione"); - ComboBox2.Text = Module1.SetupIni.LeggiParametroString("TestoAllineamento"); - TextBox10.Text = Module1.SetupIni.LeggiParametroString("MarchioFile"); - TextBox14.Text = Module1.SetupIni.LeggiParametroString("MarchioAltezza"); - TextBox15.Text = Module1.SetupIni.LeggiParametroString("MarchioLarghezza"); - TextBox16.Text = Module1.SetupIni.LeggiParametroString("MarchioMargine"); - ComboBox4.Text = Module1.SetupIni.LeggiParametroString("MarchioAllOrizzontale"); - ComboBox5.Text = Module1.SetupIni.LeggiParametroString("MarchioAllVerticale"); - TextBox19.Text = Module1.SetupIni.LeggiParametroString("MarchioTrasparenza"); - CheckBox5.Checked = Module1.SetupIni.LeggiParametroBoolean("MarchioAggiungi"); - CheckBox7.Checked = Module1.SetupIni.LeggiParametroBoolean("TempoGara"); - CheckBox8.Checked = Module1.SetupIni.LeggiParametroBoolean("Orario"); - TextBox18.Text = Module1.SetupIni.LeggiParametroString("EtichettaOrario"); - chkForzaJpg.Checked = Module1.SetupIni.LeggiParametroBoolean("GeneraleForzaJpg"); - chkRotazioneAutomatica.Checked = Module1.SetupIni.LeggiParametroBoolean("GeneraleRotazioneAutomatica"); - TextBox30.Text = Module1.SetupIni.LeggiParametroString("GrandezzaVerticale"); - TextBox31.Text = Module1.SetupIni.LeggiParametroString("MargineVerticale"); - CheckBox15.Checked = Module1.SetupIni.LeggiParametroBoolean("DimensioniOriginali"); - TextBox29.Text = Module1.SetupIni.LeggiParametroString("TestoVerticale"); - RadioButton6.Checked = Module1.SetupIni.LeggiParametroBoolean("NomeMiniatura"); - CheckBox16.Checked = Module1.SetupIni.LeggiParametroBoolean("DataFoto"); - CheckBox17.Checked = Module1.SetupIni.LeggiParametroBoolean("NumeroFoto"); - RadioButton5.Checked = Module1.SetupIni.LeggiParametroBoolean("TempoSmall"); - RadioButton7.Checked = Module1.SetupIni.LeggiParametroBoolean("NumTempoSmall"); - TextBox32.Text = Module1.SetupIni.LeggiParametroString("CompressioneJpeg"); - TextBox33.Text = Module1.SetupIni.LeggiParametroString("CompressioneJpegMiniatura"); - TextBox34.Text = Module1.SetupIni.LeggiParametroString("ColoreTestoRGB"); + TextBox4.Text = _parametriSetup.LeggiParametroString("TestoTesto"); + TextBox9.Text = _parametriSetup.LeggiParametroString("TestoTrasparente"); + TextBox12.Text = _parametriSetup.LeggiParametroString("TestoMargine"); + ComboBox1.Text = _parametriSetup.LeggiParametroString("TestoPosizione"); + ComboBox2.Text = _parametriSetup.LeggiParametroString("TestoAllineamento"); + TextBox10.Text = _parametriSetup.LeggiParametroString("MarchioFile"); + TextBox14.Text = _parametriSetup.LeggiParametroString("MarchioAltezza"); + TextBox15.Text = _parametriSetup.LeggiParametroString("MarchioLarghezza"); + TextBox16.Text = _parametriSetup.LeggiParametroString("MarchioMargine"); + ComboBox4.Text = _parametriSetup.LeggiParametroString("MarchioAllOrizzontale"); + ComboBox5.Text = _parametriSetup.LeggiParametroString("MarchioAllVerticale"); + TextBox19.Text = _parametriSetup.LeggiParametroString("MarchioTrasparenza"); + CheckBox5.Checked = _parametriSetup.LeggiParametroBoolean("MarchioAggiungi"); + CheckBox7.Checked = _parametriSetup.LeggiParametroBoolean("TempoGara"); + CheckBox8.Checked = _parametriSetup.LeggiParametroBoolean("Orario"); + TextBox18.Text = _parametriSetup.LeggiParametroString("EtichettaOrario"); + chkForzaJpg.Checked = _parametriSetup.LeggiParametroBoolean("GeneraleForzaJpg"); + chkRotazioneAutomatica.Checked = _parametriSetup.LeggiParametroBoolean("GeneraleRotazioneAutomatica"); + TextBox30.Text = _parametriSetup.LeggiParametroString("GrandezzaVerticale"); + TextBox31.Text = _parametriSetup.LeggiParametroString("MargineVerticale"); + CheckBox15.Checked = _parametriSetup.LeggiParametroBoolean("DimensioniOriginali"); + TextBox29.Text = _parametriSetup.LeggiParametroString("TestoVerticale"); + RadioButton6.Checked = _parametriSetup.LeggiParametroBoolean("NomeMiniatura"); + CheckBox16.Checked = _parametriSetup.LeggiParametroBoolean("DataFoto"); + CheckBox17.Checked = _parametriSetup.LeggiParametroBoolean("NumeroFoto"); + RadioButton5.Checked = _parametriSetup.LeggiParametroBoolean("TempoSmall"); + RadioButton7.Checked = _parametriSetup.LeggiParametroBoolean("NumTempoSmall"); + TextBox32.Text = _parametriSetup.LeggiParametroString("CompressioneJpeg"); + TextBox33.Text = _parametriSetup.LeggiParametroString("CompressioneJpegMiniatura"); + TextBox34.Text = _parametriSetup.LeggiParametroString("ColoreTestoRGB"); if (File.Exists(TextBox10.Text)) { PictureBox1.Image = Image.FromFile(TextBox10.Text); @@ -602,8 +569,8 @@ public partial class MainForm Text = "Image Catalog - " + LeggiSoloNomeFile(IlNome); // 2021 - TextBox8.Text = Module1.SetupIni.LeggiParametroString("ChunkSize"); - TextBox7.Text = Module1.SetupIni.LeggiParametroString("ThreadsCount"); + TextBox8.Text = _parametriSetup.LeggiParametroString("ChunkSize"); + TextBox7.Text = _parametriSetup.LeggiParametroString("ThreadsCount"); } } diff --git a/imagecatalog/MainForm.vb b/imagecatalog/MainForm.vb deleted file mode 100644 index 63a7373..0000000 --- a/imagecatalog/MainForm.vb +++ /dev/null @@ -1,1502 +0,0 @@ -Imports System.Collections.Concurrent -Imports System.IO -Imports System.Drawing.Drawing2D -Imports System.Drawing.Imaging -Imports System.Threading -Imports System.Collections.Generic -Imports System.Drawing.Text -Imports System.Runtime.InteropServices -Imports System.Threading.Tasks -Imports CatalogVbLib -Imports MaddoShared - -Public Delegate Sub XyThreadAdd(ByVal Info As String) - -Public Class MainForm -#Const MULTI_THREADED_UI = True - - Private StopAttivo As Boolean - Private WaterSelectColor As Boolean = False - - 'Private ContaFotoCuori As Integer - 'Private TaskCuori() As PicInfo - - Private MyPool As XYThreadPool = New XYThreadPool - Private ContaImmaginiThread As Integer - - Private maxThreads As Integer = 15 - Private minThreads As Integer = 5 - - Private Sub setDefaults() - txtSorgente.Text = "" - txtDestinazione.Text = "" - TextBox3.Text = "tn_" - TextBox4.Text = "" - TextBox5.Text = "350" - TextBox6.Text = "350" - TextBox27.Text = "2240" - TextBox28.Text = "2240" - TextBox9.Text = "0" - TextBox11.Text = "20" - TextBox12.Text = "8" - 'TextBox13.Text = "" - TextBox10.Text = "" - TextBox14.Text = "430" - TextBox15.Text = "430" - TextBox16.Text = "290" - txtFilePerCartella.Text = "99" - TextBox19.Text = "100" - txtSuffissoCartelle.Text = "" - txtCifreContatore.Text = "2" - TextBox25.Text = "50" - TextBox26.Text = "" - TextBox7.Text = CStr(4) - TextBox8.Text = CStr(4) - TextBox34.Text = "Yellow" - TextBox30.Text = "20" - TextBox31.Text = "6" - TextBox32.Text = "85" - TextBox33.Text = "30" - - - ComboBox1.Items.Add("Alto") - ComboBox1.Items.Add("Basso") - ComboBox1.SelectedIndex = 1 - - ComboBox2.Items.Add("Sinistra") - ComboBox2.Items.Add("Centro") - ComboBox2.Items.Add("Destra") - ComboBox2.SelectedIndex = 1 - - ' Create a obejct of InstalledFontCollection - Dim InstalledFonts As New InstalledFontCollection - ' Gets the array of FontFamily objects associated with this FontCollection. - Dim fontfamilies() As FontFamily = InstalledFonts.Families() - - ' Populates font combobox with the font name - - For Each fontFamily As FontFamily In fontfamilies - ComboBox3.Items.Add(fontFamily.Name) - Next - - ComboBox3.Text = ComboBox3.Items(0).ToString - - 'ComboBox3.Items.Add("Arial") - 'ComboBox3.Items.Add("Arial Black") - 'ComboBox3.Items.Add("Arial Narrow") - 'ComboBox3.Items.Add("Comic Sans MS") - 'ComboBox3.Items.Add("Courier New") - 'ComboBox3.Items.Add("System") - 'ComboBox3.Items.Add("Times New Roman") - 'ComboBox3.Items.Add("Verdana") - 'ComboBox3.Items.Add("Wingdings") - 'ComboBox3.SelectedIndex = 7 - - ComboBox4.Items.Add("Sinistra") - ComboBox4.Items.Add("Centro") - ComboBox4.Items.Add("Destra") - ComboBox4.SelectedIndex = 2 - - ComboBox5.Items.Add("Alto") - ComboBox5.Items.Add("Centro") - ComboBox5.Items.Add("Basso") - ComboBox5.SelectedIndex = 2 - End Sub - - Private Shared Function AllocConsole() As Boolean - - End Function - - Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load - Application.EnableVisualStyles() - - setDefaults() -#If Not DEBUG Then - AllocConsole() -#End If - - Console.WriteLine("Programma avviato") - End Sub - - Private Sub FixPaths() - If txtSorgente.Text.EndsWith("\") = False Then - txtSorgente.Text &= "\" - End If - If txtDestinazione.Text.EndsWith("\") = False Then - txtDestinazione.Text &= "\" - End If - End Sub - - Private Sub lockUI() - TabControl1.Enabled = False - Button5.Enabled = False - Button6.Enabled = False - btnCreaCatalogo.Enabled = False - - End Sub - - Private Sub unlockUI() - TabControl1.Enabled = True - Button5.Enabled = True - Button6.Enabled = True - btnCreaCatalogo.Enabled = True - End Sub - - Private Sub btnCreaCatalogo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCreaCatalogo.Click - lockUI() - Dim timeStart As Date - Dim timeStop As Date - - timeStart = TimeOfDay - FixPaths() - - Label10.Text = "" - lblFotoTotaliNum.Text = "0" - Label18.Text = "0" - Label43.Text = "-s" - - maxThreads = CInt(TextBox7.Text) - minThreads = CInt(TextBox8.Text) - - If rdbNuovoMetodo.Checked Then - setPicSettings(txtSorgente.Text, txtDestinazione.Text) - ProgressBar1.Minimum = 0 - ProgressBar1.Step = 1 - ProgressBar1.Value = 0 - - Dim t1 As New Threading.Thread(AddressOf creaCatalogoThread) - t1.IsBackground = False - t1.Start() - ElseIf rdbVecchioMetodo.Checked Then - creaCatalogo(timeStart, timeStop) - unlockUI() - End If - End Sub - - - Private Sub creaCatalogoThread() - Dim timeStart As Date = TimeOfDay - MyPool.StopThreadPool() - MyPool.StartThreadPool(minThreads, maxThreads) - ContaImmaginiThread = 0 - - 'creaImmaginiWithThreadMod(txtSorgente.Text, txtDestinazione.Text) - creaimmaginiWithThreadDict(txtSorgente.Text, txtDestinazione.Text) - Dim ThAttivo As ThreadPoolWorkItem = Nothing - Dim i As Integer = 0 -#Const asfd = 1 - -#If asfd = 1 Then - - - Do Until i = ContaImmaginiThread - Thread.Sleep(100) - ThAttivo = MyPool.ExtractWorkItem() - If ThAttivo IsNot Nothing Then - i += 1 - 'stepProgressBar() - Dim threads As Integer = MyPool.GetThreadCount() - setLabel10Text("File: " & ThAttivo.m_sName & " Threads: " & CStr(threads)) - - 'setLabel18Text(ContaImmaginiThread.ToString) - 'setLabel18Text(i.ToString) - - - 'Label10.Text = "File: " & ThAttivo.m_sName - 'Label18.Text = ContaImmaginiThread.ToString - End If - Loop - MyPool.StopThreadPool() - Dim timeStop As Date = TimeOfDay - - setLabel10Text("Finito") - setLabel43Text(CalcTime(timeStart, timeStop, ContaImmaginiThread)) -#End If - End Sub - - Private Sub creaCatalogo(timeStart As Date, timeStop As Date) - 'asdfg - MyPool.StopThreadPool() - MyPool.StartThreadPool(minThreads, maxThreads) - ContaImmaginiThread = 0 - - CreaImmaginiWithThread(txtSorgente.Text, txtDestinazione.Text) - - Dim ThAttivo As ThreadPoolWorkItem = Nothing - Dim i As Integer = 0 - - Do Until i = ContaImmaginiThread - Thread.Sleep(100) - ThAttivo = MyPool.ExtractWorkItem() - If ThAttivo IsNot Nothing Then - i += 1 - Label10.Text = "File: " & ThAttivo.m_sName - Label18.Text = ContaImmaginiThread.ToString - - End If - Loop - MyPool.StopThreadPool() - timeStop = TimeOfDay - - CalcTime(timeStart, timeStop, ContaImmaginiThread) - Label10.Text = "Finito" - If CheckBox22.Checked = True Then - Shell("%windir%\System32\shutdown.exe") - End If - End Sub - - Private Function CalcTime(ByVal timeStart As Date, ByVal timeStop As Date, ByVal numFoto As Integer) As String - Dim timediffH, timediffS As Long - Dim timediffM As Long - timediffM = DateAndTime.DateDiff(DateInterval.Minute, timeStart, timeStop) - timediffS = DateAndTime.DateDiff(DateInterval.Second, timeStart, timeStop) - timediffH = DateAndTime.DateDiff(DateInterval.Hour, timeStart, timeStop) - 'dim s As String = "H:" + timediffH.ToString + " M:" + timediffM.ToString + " S:" + timediffS.ToString - - 'Label43.Text = "H:" + timediffH.ToString + " M:" + timediffM.ToString + " S:" + timediffS.ToString - Dim fotoSec As Double = numFoto / CDbl(timediffS) - Dim fotoMin As Double = numFoto / CDbl(timediffM) - Dim fotoOra As Double = numFoto / CDbl(timediffH) - Dim s As String = "S: " + timediffS.ToString + "; F/s: " + fotoSec.ToString("0.000") '+ " F/m: " + fotoMin.ToString("0.00") + " F/h: " + fotoOra.ToString("0.00") - Return s - End Function - Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click - Dim DirSearch As FolderBrowserDialog = New FolderBrowserDialog - DirSearch.SelectedPath = txtSorgente.Text - If DialogResult.OK = DirSearch.ShowDialog() Then - Dim DirectoryScelta As String = DirSearch.SelectedPath - If DirectoryScelta.EndsWith("\") = False Then - DirectoryScelta &= "\" - End If - - txtSorgente.Text = DirectoryScelta - End If - End Sub - - Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click - Dim DirSearch As FolderBrowserDialog = New FolderBrowserDialog - DirSearch.SelectedPath = txtDestinazione.Text - If DialogResult.OK = DirSearch.ShowDialog() Then - Dim DirectoryScelta As String = DirSearch.SelectedPath - If DirectoryScelta.EndsWith("\") = False Then - DirectoryScelta &= "\" - End If - - txtDestinazione.Text = DirectoryScelta - End If - - 'Dim openFileDialog As OpenFileDialog = New OpenFileDialog - - 'Dim openFileDialog As OpenFileDialog = New OpenFileDialog - - 'openFileDialog.InitialDirectory = TextBox1.Text - 'openFileDialog.Filter = "Bitmap files (*.bmp)|*.bmp|Jpeg files (*.jpg)|*.jpg|All valid files (*.*)|*.*" - 'openFileDialog.FilterIndex = 2 - 'openFileDialog.RestoreDirectory = True - - 'If DialogResult.OK = openFileDialog.ShowDialog() Then - ' Dim IlNome As String = openFileDialog.FileName - ' Dim NomeFine As String = "" - ' Dim i As Integer - - ' Dim Elenco As String() - ' Elenco = IlNome.Split(New Char() {"\"c}) - ' For i = 0 To Elenco.Length - 1 - ' NomeFine &= Elenco(i) & "\" - ' Next - - ' TextBox1.Text = NomeFine - 'End If - End Sub - - Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click - Dim SaveFileDlg As SaveFileDialog = New SaveFileDialog - - 'SaveFileDlg.InitialDirectory = "c:\" - SaveFileDlg.Filter = "Setup (*.xml)|*.xml|All valid files (*.*)|*.*" - SaveFileDlg.FilterIndex = 0 - SaveFileDlg.RestoreDirectory = True - - If DialogResult.OK = SaveFileDlg.ShowDialog Then - Dim IlNome As String = SaveFileDlg.FileName - - SetupIni.NomeFileSetup = IlNome - - SetupIni.AggiornaParametro("DirSorgente", txtSorgente.Text) - SetupIni.AggiornaParametro("DirDestinazione", txtDestinazione.Text) - SetupIni.AggiornaParametro("DirSottoDirectory", chkAggiornaSottodirectory.Checked) - - SetupIni.AggiornaParametro("DirDividiDestinazione", chkCreaSottocartelle.Checked) - SetupIni.AggiornaParametro("DirDividiNumFile", txtFilePerCartella.Text) - SetupIni.AggiornaParametro("DirDividiSuffisso", txtSuffissoCartelle.Text) - SetupIni.AggiornaParametro("DirDividiNumCifre", txtCifreContatore.Text) - If rdbNumProgressiva.Checked = True Then - SetupIni.AggiornaParametro("DirDividiTipoNumerazione", "Progressiva") - Else - SetupIni.AggiornaParametro("DirDividiTipoNumerazione", "Files") - End If - - SetupIni.AggiornaParametro("MiniatureCrea", CheckBox1.Checked) - SetupIni.AggiornaParametro("MiniatureSuffisso", TextBox3.Text) - SetupIni.AggiornaParametro("MiniatureAltezza", TextBox5.Text) - SetupIni.AggiornaParametro("MiniatureLarghezza", TextBox6.Text) - SetupIni.AggiornaParametro("MiniatureAddScritta", RadioButton3.Checked) - SetupIni.AggiornaParametro("MiniatureAddOrario", RadioButton4.Checked) - - SetupIni.AggiornaParametro("FotoAltezza", TextBox27.Text) - SetupIni.AggiornaParametro("FotoLarghezza", TextBox28.Text) - 'SetupIni.AggiornaParametro("FotoCodice", TextBox13.Text) - 'SetupIni.AggiornaParametro("FotoDimOriginali", CheckBox2.Checked) - - SetupIni.AggiornaParametro("FontDimensione", TextBox11.Text) - SetupIni.AggiornaParametro("FontDimensioneMiniatura", TextBox25.Text) - SetupIni.AggiornaParametro("FontBold", CheckBox3.Checked) - SetupIni.AggiornaParametro("FontNome", ComboBox3.Text) - - - SetupIni.AggiornaParametro("TestoTesto", TextBox4.Text) - SetupIni.AggiornaParametro("TestoTrasparente", TextBox9.Text) - SetupIni.AggiornaParametro("TestoMargine", TextBox12.Text) - SetupIni.AggiornaParametro("TestoPosizione", ComboBox1.Text) - SetupIni.AggiornaParametro("TestoAllineamento", ComboBox2.Text) - - SetupIni.AggiornaParametro("MarchioFile", TextBox10.Text) - SetupIni.AggiornaParametro("MarchioAltezza", TextBox14.Text) - SetupIni.AggiornaParametro("MarchioLarghezza", TextBox15.Text) - SetupIni.AggiornaParametro("MarchioMargine", TextBox16.Text) - SetupIni.AggiornaParametro("MarchioAllOrizzontale", ComboBox4.Text) - SetupIni.AggiornaParametro("MarchioAllVerticale", ComboBox5.Text) - SetupIni.AggiornaParametro("MarchioTrasparenza", TextBox19.Text) - SetupIni.AggiornaParametro("MarchioAggiungi", CheckBox5.Checked) - - SetupIni.AggiornaParametro("TempoGara", CheckBox7.Checked) - SetupIni.AggiornaParametro("Orario", CheckBox8.Checked) - SetupIni.AggiornaParametro("EtichettaOrario", TextBox18.Text) - - SetupIni.AggiornaParametro("GeneraleForzaJpg", chkForzaJpg.Checked) - SetupIni.AggiornaParametro("GeneraleRotazioneAutomatica", chkRotazioneAutomatica.Checked) - SetupIni.AggiornaParametro("GrandezzaVerticale", TextBox30.Text) - SetupIni.AggiornaParametro("MargineVerticale", TextBox31.Text) - SetupIni.AggiornaParametro("DimensioniOriginali", CheckBox15.Checked) - SetupIni.AggiornaParametro("TestoVerticale", TextBox29.Text) - SetupIni.AggiornaParametro("NomeMiniatura", RadioButton6.Checked) - SetupIni.AggiornaParametro("DataFoto", CheckBox16.Checked) - SetupIni.AggiornaParametro("NumeroFoto", CheckBox17.Checked) - - SetupIni.AggiornaParametro("ColoreTestoRGB", TextBox34.Text) - - SetupIni.AggiornaParametro("TempoSmall", RadioButton5.Checked) - SetupIni.AggiornaParametro("NumTempoSmall", RadioButton7.Checked) - - SetupIni.AggiornaParametro("CompressioneJpeg", TextBox32.Text) - SetupIni.AggiornaParametro("CompressioneJpegMiniatura", TextBox33.Text) - SetupIni.SalvaParametriSetup() - Me.Text = "Image Catalog - " & LeggiSoloNomeFile(IlNome) - End If - End Sub - - Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click - Dim openFileDialog As OpenFileDialog = New OpenFileDialog - - 'openFileDialog.InitialDirectory = TextBox1.Text - openFileDialog.Filter = "Setup (*.xml)|*.xml|All valid files (*.*)|*.*" - openFileDialog.FilterIndex = 0 - openFileDialog.RestoreDirectory = True - - If DialogResult.OK = openFileDialog.ShowDialog() Then - Dim IlNome As String = openFileDialog.FileName - - SetupIni.NomeFileSetup = IlNome - SetupIni.CaricaParametriSetup() - - txtSorgente.Text = SetupIni.LeggiParametroString("DirSorgente") - txtDestinazione.Text = SetupIni.LeggiParametroString("DirDestinazione") - chkAggiornaSottodirectory.Checked = SetupIni.LeggiParametroBoolean("DirSottoDirectory") - - chkCreaSottocartelle.Checked = SetupIni.LeggiParametroBoolean("DirDividiDestinazione") - txtFilePerCartella.Text = SetupIni.LeggiParametroString("DirDividiNumFile") - txtSuffissoCartelle.Text = SetupIni.LeggiParametroString("DirDividiSuffisso") - txtCifreContatore.Text = SetupIni.LeggiParametroString("DirDividiNumCifre") - - Dim TestoTemp As String = SetupIni.LeggiParametroString("DirDividiTipoNumerazione") - If TestoTemp.ToUpper = "PROGRESSIVA" Then - rdbNumProgressiva.Checked = True - Else - rdbNumFiles.Checked = True - End If - - CheckBox1.Checked = SetupIni.LeggiParametroBoolean("MiniatureCrea") - TextBox3.Text = SetupIni.LeggiParametroString("MiniatureSuffisso") - TextBox5.Text = SetupIni.LeggiParametroString("MiniatureAltezza") - TextBox6.Text = SetupIni.LeggiParametroString("MiniatureLarghezza") - RadioButton3.Checked = SetupIni.LeggiParametroBoolean("MiniatureAddScritta") - RadioButton4.Checked = SetupIni.LeggiParametroBoolean("MiniatureAddOrario") - - TextBox27.Text = SetupIni.LeggiParametroString("FotoAltezza") - TextBox28.Text = SetupIni.LeggiParametroString("FotoLarghezza") - 'TextBox13.Text = SetupIni.LeggiParametroString("FotoCodice") - 'CheckBox2.Checked = SetupIni.LeggiParametroBoolean("FotoDimOriginali") - - TextBox11.Text = SetupIni.LeggiParametroString("FontDimensione") - TextBox25.Text = SetupIni.LeggiParametroString("FontDimensioneMiniatura") - CheckBox3.Checked = SetupIni.LeggiParametroBoolean("FontBold") - ComboBox3.Text = SetupIni.LeggiParametroString("FontNome") - - If TextBox25.Text = "" Then - TextBox25.Text = "0" - End If - - TextBox4.Text = SetupIni.LeggiParametroString("TestoTesto") - TextBox9.Text = SetupIni.LeggiParametroString("TestoTrasparente") - TextBox12.Text = SetupIni.LeggiParametroString("TestoMargine") - ComboBox1.Text = SetupIni.LeggiParametroString("TestoPosizione") - ComboBox2.Text = SetupIni.LeggiParametroString("TestoAllineamento") - - TextBox10.Text = SetupIni.LeggiParametroString("MarchioFile") - TextBox14.Text = SetupIni.LeggiParametroString("MarchioAltezza") - TextBox15.Text = SetupIni.LeggiParametroString("MarchioLarghezza") - TextBox16.Text = SetupIni.LeggiParametroString("MarchioMargine") - ComboBox4.Text = SetupIni.LeggiParametroString("MarchioAllOrizzontale") - ComboBox5.Text = SetupIni.LeggiParametroString("MarchioAllVerticale") - TextBox19.Text = SetupIni.LeggiParametroString("MarchioTrasparenza") - CheckBox5.Checked = SetupIni.LeggiParametroBoolean("MarchioAggiungi") - - CheckBox7.Checked = SetupIni.LeggiParametroBoolean("TempoGara") - CheckBox8.Checked = SetupIni.LeggiParametroBoolean("Orario") - TextBox18.Text = SetupIni.LeggiParametroString("EtichettaOrario") - - chkForzaJpg.Checked = SetupIni.LeggiParametroBoolean("GeneraleForzaJpg") - chkRotazioneAutomatica.Checked = SetupIni.LeggiParametroBoolean("GeneraleRotazioneAutomatica") - - TextBox30.Text = SetupIni.LeggiParametroString("GrandezzaVerticale") - TextBox31.Text = SetupIni.LeggiParametroString("MargineVerticale") - CheckBox15.Checked = SetupIni.LeggiParametroBoolean("DimensioniOriginali") - TextBox29.Text = SetupIni.LeggiParametroString("TestoVerticale") - RadioButton6.Checked = SetupIni.LeggiParametroBoolean("NomeMiniatura") - CheckBox16.Checked = SetupIni.LeggiParametroBoolean("DataFoto") - CheckBox17.Checked = SetupIni.LeggiParametroBoolean("NumeroFoto") - - - RadioButton5.Checked = SetupIni.LeggiParametroBoolean("TempoSmall") - RadioButton7.Checked = SetupIni.LeggiParametroBoolean("NumTempoSmall") - - TextBox32.Text = SetupIni.LeggiParametroString("CompressioneJpeg") - TextBox33.Text = SetupIni.LeggiParametroString("CompressioneJpegMiniatura") - - TextBox34.Text = SetupIni.LeggiParametroString("ColoreTestoRGB") - If File.Exists(TextBox10.Text) Then - - - PictureBox1.Image = Image.FromFile(TextBox10.Text) - If PictureBox1.Image.Height >= PictureBox1.Image.Width Then - PictureBox1.Height = 160 - PictureBox1.Width = CType(160 * PictureBox1.Image.Width / PictureBox1.Image.Height, Integer) - Else - PictureBox1.Width = 224 - PictureBox1.Height = CType(224 * PictureBox1.Image.Height / PictureBox1.Image.Width, Integer) - End If - End If - Me.Text = "Image Catalog - " & LeggiSoloNomeFile(IlNome) - End If - End Sub - - Private Sub setPicSettings(ByVal SourcePath As String, ByVal DestPath As String) - - Dim SourceDir As DirectoryInfo = New DirectoryInfo(SourcePath) - Dim DestDirStart As DirectoryInfo = New DirectoryInfo(DestPath) - Dim DestDir As DirectoryInfo = Nothing - - - - PicSettings.DirectorySorgente = txtSorgente.Text - PicSettings.DirectoryDestinazione = txtDestinazione.Text - - 'PicSettings.DestDir = DestDir - 'PicSettings.SourceDir = SourceDir - 'PicSettings.DestDirStart = DestDirStart - - PicSettings.DimStandard = CType(TextBox11.Text, Integer) - PicSettings.DimStandardMiniatura = CType(TextBox25.Text, Integer) - - PicSettings.UsaOrarioMiniatura = CheckBox12.Checked - PicSettings.UsaOrarioTestoApplicare = CheckBox8.Checked - PicSettings.UsaTempoGaraTestoApplicare = CheckBox7.Checked - - PicSettings.UsaRotazioneAutomatica = chkRotazioneAutomatica.Checked - PicSettings.UsaForzaJpg = chkForzaJpg.Checked - - If CheckBox17.Checked Then - PicSettings.TestoNome = True - Else - PicSettings.TestoNome = False - - End If - - If CheckBox16.Checked Then - PicSettings.NomeData = True - Else - PicSettings.NomeData = False - End If - PicSettings.TestoFirmaStart = TextBox4.Text - PicSettings.TestoFirmaStartV = TextBox29.Text - - PicSettings.DataPartenza = DateTimePicker1.Value - PicSettings.TestoOrario = TextBox18.Text - - PicSettings.AltezzaSmall = CType(TextBox6.Text, Integer) - PicSettings.LarghezzaSmall = CType(TextBox5.Text, Integer) - - PicSettings.CreaMiniature = CheckBox1.Checked - PicSettings.AggiungiScritteMiniature = RadioButton3.Checked - PicSettings.AggTempoGaraMin = RadioButton5.Checked - PicSettings.AggNumTempMin = RadioButton7.Checked - - - PicSettings.DimVert = CType(TextBox30.Text, Integer) - PicSettings.MargVert = CType(TextBox31.Text, Integer) - - 'PicSettings.NomeFileChild = childFile.Name - PicSettings.Suffisso = TextBox3.Text - 'PicSettings.Codice = TextBox13.Text - - PicSettings.Trasparenza = CType(TextBox9.Text, Integer) - PicSettings.IlFont = ComboBox3.SelectedItem.ToString - PicSettings.Grassetto = CheckBox3.Checked - - PicSettings.Posizione = ComboBox1.SelectedItem.ToString - PicSettings.Allineamento = ComboBox2.SelectedItem.ToString - PicSettings.Margine = CType(TextBox12.Text, Integer) - - PicSettings.LogoAltezza = CType(TextBox14.Text, Integer) - PicSettings.LogoLarghezza = CType(TextBox15.Text, Integer) - - PicSettings.fontColoreRGB = ColorTranslator.FromHtml(TextBox34.Text) - - PicSettings.LogoAggiungi = CheckBox5.Checked - PicSettings.LogoNomeFile = TextBox10.Text - PicSettings.LogoTrasparenza = TextBox19.Text - PicSettings.LogoMargine = TextBox16.Text - PicSettings.LogoPosizioneH = ComboBox4.Text - PicSettings.LogoPosizioneV = ComboBox5.Text - - PicSettings.FotoGrandeDimOrigina = CheckBox15.Checked - PicSettings.AltezzaBig = CType(TextBox27.Text, Integer) - PicSettings.LarghezzaBig = CType(TextBox28.Text, Integer) - PicSettings.DimMin = CType(TextBox25.Text, Integer) - - PicSettings.TestoMin = RadioButton6.Checked - - PicSettings.jpegQuality = CLng(TextBox32.Text) - PicSettings.jpegQualityMin = CLng(TextBox33.Text) - - PicSettings.mainForm = Me - - - End Sub - - Private Function makeFilesList(ByVal SourcePath As String) As List(Of List(Of FileInfo)) - Dim SourceDir As DirectoryInfo = New DirectoryInfo(SourcePath) - - Dim DestDir As DirectoryInfo = Nothing - Dim NumFileXDir As Integer = CType(txtFilePerCartella.Text, Integer) - Dim SuffixDir As String = txtSuffissoCartelle.Text - Dim NumCifreDir As Integer = CType(txtCifreContatore.Text, Integer) - Dim DividiFile As Boolean = False - - StopAttivo = False - - Dim FileConta As Integer = 0 - Dim ContaFileXDir As Integer = 0 - Dim ContaDirXDir As Integer = 0 - Dim TestoTemp As String = "" - Dim ContaTemp As Integer = 0 - - Dim picList As New List(Of FileInfo) - Dim dirList As New List(Of List(Of 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 Then - Dim subDir As DirectoryInfo - For Each subDir In SourceDir.GetDirectories() - Dim filesList As New List(Of FileInfo) - filesList = getFiles(subDir) - dirList.Add(filesList) - Next - End If - - Return dirList - End Function - - Private Function getFiles(sourceDir As DirectoryInfo) As List(Of FileInfo) - Dim picList As New List(Of FileInfo) - Dim childFile As FileInfo - For Each childFile In sourceDir.GetFiles("*.jpg") - picList.Add(childFile) - Next - Return picList - End Function - - Private Function getDirsDict(SourcePath As String, DestPath As String) As Dictionary(Of FileInfo, DirectoryInfo) - Dim SourceDir As DirectoryInfo = New DirectoryInfo(SourcePath) - Dim DestDirStart As DirectoryInfo = New DirectoryInfo(DestPath) - Dim DestDir As DirectoryInfo = Nothing - Dim NumFileXDir As Integer = CType(txtFilePerCartella.Text, Integer) - Dim SuffixDir As String = txtSuffissoCartelle.Text - Dim NumCifreDir As Integer = CType(txtCifreContatore.Text, Integer) - Dim DividiFile As Boolean = False - - StopAttivo = False - - Dim FileConta As Integer = 0 - Dim ContaFileXDir As Integer = 0 - Dim ContaDirXDir As Integer = 0 - 'Dim TestoTemp As String = "" - 'Dim ContaTemp As Integer = 0 - Dim dirSourceDest As Dictionary(Of FileInfo, DirectoryInfo) = New Dictionary(Of FileInfo, DirectoryInfo) - - If SourceDir.Exists Then - - If chkAggiornaSottodirectory.Checked Then - FileConta = SourceDir.GetFiles("*.jpg", SearchOption.AllDirectories).GetLength(0) - Else - FileConta = SourceDir.GetFiles("*.jpg", SearchOption.TopDirectoryOnly).GetLength(0) - End If - - Dim a As String = (CType(lblFotoTotaliNum.Text, Integer) + FileConta).ToString - setLabel17Text(a) - setProgressBarMaximum(CInt(a)) - - If chkAggiornaSottodirectory.Checked Then - - For Each directory As DirectoryInfo In SourceDir.GetDirectories - For Each file As FileInfo In directory.GetFiles(".jpg") - - Next - Next - - End If - - For Each file As FileInfo In SourceDir.GetFiles("*.jpg", SearchOption.AllDirectories) - - Next - - - If NumFileXDir > 0 And chkCreaSottocartelle.Checked = True And FileConta > NumFileXDir Then - DividiFile = True - Else - DestDir = DestDirStart - If Not DestDir.Exists Then - DestDir.Create() - End If - DividiFile = False - End If - - Dim filesList As New List(Of FileInfo) - If chkAggiornaSottodirectory.Checked Then - 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)) - End If - - For Each file As FileInfo In filesList - - - - ContaFileXDir += 1 - If DividiFile = True Then - If ContaFileXDir = (ContaDirXDir * NumFileXDir) + 1 Then - ContaDirXDir += 1 - Dim TestoTemp As String - If rdbNumProgressiva.Checked = True Then - TestoTemp = ContaDirXDir.ToString - Else - TestoTemp = (ContaDirXDir * NumFileXDir).ToString - End If - For ContaTemp As Integer = 1 To (NumCifreDir - TestoTemp.Length) - TestoTemp = "0" & TestoTemp - Next - 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 Not DestDir.Exists Then - DestDir.Create() - End If - End If - End If - - Next - - - End If - Return dirSourceDest - End Function - - Private Sub setLabel17Text(ByVal text As String) - If lblFotoTotaliNum.InvokeRequired Then - lblFotoTotaliNum.Invoke(New Action(Of String)(AddressOf setLabel17Text), text) - Else - lblFotoTotaliNum.Text = text - - End If - End Sub - - Private Sub setLabel10Text(ByVal text As String) - If Label10.InvokeRequired Then - Label10.Invoke(New Action(Of String)(AddressOf setLabel10Text), text) - Else - Label10.Text = text - - End If - End Sub - Public Sub stepProgressBar() - If ProgressBar1.InvokeRequired Then - ProgressBar1.Invoke(New MethodInvoker(AddressOf ProgressBar1.PerformStep)) - Else - ProgressBar1.PerformStep() - End If - setLabel18Text(ProgressBar1.Value.ToString) - End Sub - Private Sub setProgressBarMaximum(ByVal value As Integer) - If ProgressBar1.InvokeRequired Then - ProgressBar1.Invoke(New Action(Of Integer)(AddressOf setProgressBarMaximum), value) - Else - ProgressBar1.Maximum = value - - End If - End Sub - - Private Sub setProgressBarValue(ByVal value As Integer) - If ProgressBar1.InvokeRequired Then - ProgressBar1.Invoke(New Action(Of Integer)(AddressOf setProgressBarValue), value) - Else - ProgressBar1.Value = value - - End If - End Sub - - Private Sub setLabel18Text(ByVal text As String) - If Label18.InvokeRequired Then - Label18.Invoke(New Action(Of String)(AddressOf setLabel18Text), text) - Else - Label18.Text = text - - End If - End Sub - - Private Sub setLabel43Text(ByVal text As String) - If Label43.InvokeRequired Then - Label43.Invoke(New Action(Of String)(AddressOf setLabel43Text), text) - Else - Label43.Text = text - - End If - End Sub - - Private Sub creaImmaginiWithThreadMod(ByVal SourcePath As String, ByVal DestPath As String) - Dim SourceDir As DirectoryInfo = New DirectoryInfo(SourcePath) - Dim DestDirStart As DirectoryInfo = New DirectoryInfo(DestPath) - Dim DestDir As DirectoryInfo = Nothing - Dim NumFileXDir As Integer = CType(txtFilePerCartella.Text, Integer) - Dim SuffixDir As String = txtSuffissoCartelle.Text - Dim NumCifreDir As Integer = CType(txtCifreContatore.Text, Integer) - Dim DividiFile As Boolean = False - - StopAttivo = False - - Dim FileConta As Integer = 0 - Dim ContaFileXDir As Integer = 0 - Dim ContaDirXDir As Integer = 0 - Dim TestoTemp As String = "" - Dim ContaTemp As Integer = 0 - - If SourceDir.Exists Then - FileConta = SourceDir.GetFiles("*.jpg").GetLength(0) - 'Label17.Text = (CType(Label17.Text, Integer) + FileConta).ToString - Dim a As String = (CType(lblFotoTotaliNum.Text, Integer) + FileConta).ToString - setLabel17Text(a) - setProgressBarMaximum(CInt(a)) - - If NumFileXDir > 0 And chkCreaSottocartelle.Checked = True Then - If FileConta > NumFileXDir Then - DividiFile = True - Else - DestDir = DestDirStart - If Not DestDir.Exists Then - DestDir.Create() - End If - DividiFile = False - End If - Else - DestDir = DestDirStart - If Not DestDir.Exists Then - DestDir.Create() - End If - DividiFile = False - End If - - Dim childFile As FileInfo - For Each childFile In SourceDir.GetFiles("*.jpg") - If StopAttivo = True Then - Exit For - End If - setLabel10Text("File: " & childFile.Name) - Dim b As String = (CType(Label18.Text, Integer) + 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 Then - If ContaFileXDir = (ContaDirXDir * NumFileXDir) + 1 Then - ContaDirXDir += 1 - - If rdbNumProgressiva.Checked = True Then - TestoTemp = ContaDirXDir.ToString - Else - TestoTemp = (ContaDirXDir * NumFileXDir).ToString - End If - For ContaTemp = 1 To (NumCifreDir - TestoTemp.Length) - TestoTemp = "0" & TestoTemp - Next - - If DestDirStart.FullName.EndsWith("\") Then - DestDir = New DirectoryInfo(DestDirStart.FullName & SuffixDir & TestoTemp) - Else - DestDir = New DirectoryInfo(DestDirStart.FullName & "\" & SuffixDir & TestoTemp) - End If - - If Not DestDir.Exists Then - DestDir.Create() - End If - End If - End If - - 'Application.DoEvents() - - - - Dim ClsCreaImmagine As 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(AddressOf ClsCreaImmagine.CreaImmagineThread), New Object(0) {childFile.Name}, True) - Next - ' copy all the sub-directories by recursively calling this same routine - If chkAggiornaSottodirectory.Checked = True Then - Dim subDir As DirectoryInfo - For Each subDir In SourceDir.GetDirectories() - creaImmaginiWithThreadMod(subDir.FullName, Path.Combine(DestDir.FullName, subDir.Name)) - Next - End If - End If - End Sub - - Private Function getNumerazione() As Integer - Dim numerazione As Integer - If rdbNumProgressiva.Checked Then - numerazione = FileHelper.numerazione.Progressiva - Else - numerazione = FileHelper.numerazione.Files - End If - Return numerazione - End Function - - Private Function GetNumerazioneEnum() As NumerazioneType - Dim numerazioneType As NumerazioneType - If rdbNumProgressiva.Checked Then - numerazioneType = NumerazioneType.Progressiva ' FileHelper.numerazione.Progressiva - Else - numerazioneType = NumerazioneType.Files ' FileHelper.numerazione.Files - End If - Return numerazioneType - End Function - - Private Sub creaimmaginiWithThreadDict(ByVal SourcePath As String, ByVal DestPath As String) - Dim dirSourceDest As Dictionary(Of FileInfo, DirectoryInfo) = New Dictionary(Of FileInfo, DirectoryInfo) - If chkAggiornaSottodirectory.Checked And chkCreaSottocartelle.Checked Then - - Dim helper As New FileHelper(CInt(txtFilePerCartella.Text), txtSuffissoCartelle.Text, CInt(txtCifreContatore.Text), getNumerazione()) - 'getfilesrecursive - dirSourceDest = helper.GetFilesRecursive(New DirectoryInfo(SourcePath), New DirectoryInfo(DestPath), "*.jpg") - ElseIf chkAggiornaSottodirectory.Checked And Not chkCreaSottocartelle.Checked Then - - End If - - '= getDirsDict(SourcePath, DestPath) - - 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 ImageCreatorSharp(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 Sub - - 'il posto giusto dove fare modifiche - Private Sub CreaImmaginiWithThread(ByVal SourcePath As String, ByVal DestPath As String) - Dim SourceDir As DirectoryInfo = New DirectoryInfo(SourcePath) - Dim DestDirStart As DirectoryInfo = New DirectoryInfo(DestPath) - Dim DestDir As DirectoryInfo = Nothing - Dim NumFileXDir As Integer = CType(txtFilePerCartella.Text, Integer) - Dim SuffixDir As String = txtSuffissoCartelle.Text - Dim NumCifreDir As Integer = CType(txtCifreContatore.Text, Integer) - Dim DividiFile As Boolean = False - - StopAttivo = False - - Dim FileConta As Integer = 0 - Dim ContaFileXDir As Integer = 0 - Dim ContaDirXDir As Integer = 0 - Dim TestoTemp As String = "" - Dim ContaTemp As Integer = 0 - - - - If SourceDir.Exists Then - FileConta = SourceDir.GetFiles("*.jpg").GetLength(0) - lblFotoTotaliNum.Text = (CType(lblFotoTotaliNum.Text, Integer) + FileConta).ToString - - If NumFileXDir > 0 And chkCreaSottocartelle.Checked = True Then - If FileConta > NumFileXDir Then - DividiFile = True - Else - DestDir = DestDirStart - If Not DestDir.Exists Then - DestDir.Create() - End If - DividiFile = False - End If - Else - DestDir = DestDirStart - If Not DestDir.Exists Then - DestDir.Create() - End If - DividiFile = False - End If - - Dim childFile As FileInfo - For Each childFile In SourceDir.GetFiles("*.jpg") - If StopAttivo = True Then - Exit For - End If - 'Label10.Text = "File: " & childFile.Name - 'Label18.Text = (CType(Label18.Text, Integer) + 1).ToString - 'Application.DoEvents() - - ContaFileXDir += 1 - - If DividiFile = True Then - If ContaFileXDir = (ContaDirXDir * NumFileXDir) + 1 Then - ContaDirXDir += 1 - - If rdbNumProgressiva.Checked = True Then - TestoTemp = ContaDirXDir.ToString - Else - TestoTemp = (ContaDirXDir * NumFileXDir).ToString - End If - For ContaTemp = 1 To (NumCifreDir - TestoTemp.Length) - TestoTemp = "0" & TestoTemp - Next - - If DestDirStart.FullName.EndsWith("\") Then - DestDir = New DirectoryInfo(DestDirStart.FullName & SuffixDir & TestoTemp) - Else - DestDir = New DirectoryInfo(DestDirStart.FullName & "\" & SuffixDir & TestoTemp) - End If - - If Not DestDir.Exists Then - DestDir.Create() - End If - End If - End If - - Application.DoEvents() - Dim ClsCreaImmagine As New CreaImmagineSeparateThread - - ClsCreaImmagine.DirectorySorgente = txtSorgente.Text - ClsCreaImmagine.DirectoryDestinazione = txtDestinazione.Text - - ClsCreaImmagine.DestDir = DestDir - ClsCreaImmagine.SourceDir = SourceDir - ClsCreaImmagine.DestDirStart = DestDirStart - - ClsCreaImmagine.DimStandard = CType(TextBox11.Text, Integer) - ClsCreaImmagine.DimStandardMiniatura = CType(TextBox25.Text, Integer) - - ClsCreaImmagine.UsaOrarioMiniatura = CheckBox12.Checked - ClsCreaImmagine.UsaOrarioTestoApplicare = CheckBox8.Checked - ClsCreaImmagine.UsaTempoGaraTestoApplicare = CheckBox7.Checked - - ClsCreaImmagine.UsaRotazioneAutomatica = chkRotazioneAutomatica.Checked - ClsCreaImmagine.UsaForzaJpg = chkForzaJpg.Checked - - If CheckBox17.Checked Then - ClsCreaImmagine.TestoNome = True - Else - ClsCreaImmagine.TestoNome = False - - End If - - If CheckBox16.Checked Then - ClsCreaImmagine.NomeData = True - Else - ClsCreaImmagine.NomeData = False - End If - ClsCreaImmagine.TestoFirmaStart = TextBox4.Text - ClsCreaImmagine.TestoFirmaStartV = TextBox29.Text - - ClsCreaImmagine.DataPartenza = DateTimePicker1.Value - ClsCreaImmagine.TestoOrario = TextBox18.Text - - ClsCreaImmagine.AltezzaSmall = CType(TextBox5.Text, Integer) - ClsCreaImmagine.LarghezzaSmall = CType(TextBox5.Text, Integer) - - ClsCreaImmagine.CreaMiniature = CheckBox1.Checked - ClsCreaImmagine.AggiungiScritteMiniature = RadioButton3.Checked - ClsCreaImmagine.AggTempoGaraMin = RadioButton5.Checked - ClsCreaImmagine.AggNumTempMin = RadioButton7.Checked - - - ClsCreaImmagine.DimVert = CType(TextBox30.Text, Integer) - ClsCreaImmagine.MargVert = CType(TextBox31.Text, Integer) - - ClsCreaImmagine.NomeFileChild = childFile.Name - ClsCreaImmagine.Suffisso = TextBox3.Text - 'ClsCreaImmagine.Codice = TextBox13.Text - - ClsCreaImmagine.Trasparenza = CType(TextBox9.Text, Integer) - ClsCreaImmagine.IlFont = ComboBox3.SelectedItem.ToString - ClsCreaImmagine.Grassetto = CheckBox3.Checked - - ClsCreaImmagine.Posizione = ComboBox1.SelectedItem.ToString - ClsCreaImmagine.Allineamento = ComboBox2.SelectedItem.ToString - ClsCreaImmagine.Margine = CType(TextBox12.Text, Integer) - - ClsCreaImmagine.LogoAltezza = CType(TextBox14.Text, Integer) - ClsCreaImmagine.LogoLarghezza = CType(TextBox15.Text, Integer) - - '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 = CType(TextBox27.Text, Integer) - ClsCreaImmagine.LarghezzaBig = CType(TextBox28.Text, Integer) - ClsCreaImmagine.DimMin = CType(TextBox25.Text, Integer) - - ClsCreaImmagine.TestoMin = RadioButton6.Checked - - ClsCreaImmagine.jpegQuality = CLng(TextBox32.Text) - ClsCreaImmagine.jpegQualityMin = CLng(TextBox33.Text) - - ContaImmaginiThread += 1 - MyPool.InsertWorkItem(childFile.Name, New XyThreadAdd(AddressOf ClsCreaImmagine.CreaImmagineThread), New Object(0) {childFile.Name}, True) - Next - ' copy all the sub-directories by recursively calling this same routine - If chkAggiornaSottodirectory.Checked = True Then - Dim subDir As DirectoryInfo - For Each subDir In SourceDir.GetDirectories() - CreaImmaginiWithThread(subDir.FullName, Path.Combine(DestDir.FullName, subDir.Name)) - Next - End If - End If - End Sub - - Private Sub CopyDirectoryFile(ByVal SourcePath As String, ByVal DestPath As String, Optional ByVal OverWrite As Boolean = False) - Dim SourceDir As DirectoryInfo = New DirectoryInfo(SourcePath) - Dim DestDir As DirectoryInfo = New DirectoryInfo(DestPath) - - If SourceDir.Exists Then - If Not DestDir.Exists Then - DestDir.Create() - End If - ' copy all the files of the current directory - Dim childFile As FileInfo - For Each childFile In SourceDir.GetFiles() - If OverWrite Then - childFile.CopyTo(Path.Combine(DestDir.FullName, childFile.Name), True) - Else - ' if overwrite = false, copy the file only if it does not exist - ' this is done to avoid an IOException if a file already exists - ' this way the other files can be copied anyway... - If Not File.Exists(Path.Combine(DestDir.FullName, childFile.Name)) Then - childFile.CopyTo(Path.Combine(DestDir.FullName, childFile.Name), False) - End If - End If - Next - ' copy all the sub-directories by recursively calling this same routine - Dim subDir As DirectoryInfo - For Each subDir In SourceDir.GetDirectories() - CopyDirectoryFile(subDir.FullName, Path.Combine(DestDir.FullName, subDir.Name), OverWrite) - Next - End If - End Sub - - - - - - Function NewthumbSize(ByVal currentwidth As Integer, ByVal currentheight As Integer, ByVal MaxPixel As Integer, ByVal TipoSize As String) As Size - ' Calculate the Size of the New image - '*** Larghezza, Altezza, Auto - - Dim tempMultiplier As Double - - If TipoSize.ToUpper = "Larghezza".ToUpper Then - tempMultiplier = MaxPixel / currentwidth - ElseIf TipoSize.ToUpper = "Altezza".ToUpper Then - tempMultiplier = MaxPixel / currentheight - Else - If currentheight > currentwidth Then ' portrait - tempMultiplier = MaxPixel / currentheight - Else - tempMultiplier = MaxPixel / currentwidth - End If - End If - - Dim NewSize As New Size(CInt(currentwidth * tempMultiplier), CInt(currentheight * tempMultiplier)) - - Return NewSize - End Function - - - - Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click - StopAttivo = True - - MyPool.StopThreadPool() - unlockUI() - - End Sub - - Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click - Dim openFileDialog As OpenFileDialog = New OpenFileDialog - - 'openFileDialog.InitialDirectory = TextBox1.Text - openFileDialog.Filter = "Immagini jpg (*.jpg)|*.jpg|Immagini gif (*.gif)|*.gif|Tutti i file (*.*)|*.*" - If TextBox10.Text.Length > 0 Then - openFileDialog.FileName = TextBox10.Text - End If - openFileDialog.FilterIndex = 0 - openFileDialog.RestoreDirectory = True - - If DialogResult.OK = openFileDialog.ShowDialog() Then - TextBox10.Text = openFileDialog.FileName - PictureBox1.Image = Image.FromFile(TextBox10.Text) - If PictureBox1.Image.Height >= PictureBox1.Image.Width Then - PictureBox1.Height = 160 - PictureBox1.Width = CType(160 * PictureBox1.Image.Width / PictureBox1.Image.Height, Integer) - Else - PictureBox1.Width = 224 - PictureBox1.Height = CType(224 * PictureBox1.Image.Height / PictureBox1.Image.Width, Integer) - End If - End If - End Sub - - Private Function LeggiSoloNomeFile(ByVal FileName As String) As String - Dim Testo As String = FileName - Dim Risposta As String = "" - - Dim Nomi() As String = Testo.Split(New Char() {"\"c}) - If Nomi.Length > 1 Then - Risposta = Nomi(Nomi.Length - 1) - End If - - Return Risposta - End Function - - - Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove - 'GetColor() - 'GetPixelColor(PictureBox1.PointToScreen(e.Location)).ToArgb.ToString("X8") - - End Sub - - Private Sub PictureBox1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseUp - If e.Button = MouseButtons.Left Then - WaterSelectColor = True - Else - WaterSelectColor = False - End If - End Sub - - - '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 - - - '''' - '''' Get the color relative to mouse position - '''' - '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 Function GetPixelColor(ByVal screenLocation As Point) As Color() - 'Dim bm As New Bitmap(1, 1, Imaging.PixelFormat.Format24bppRgb) - 'Dim g As Graphics = Graphics.FromImage(bm) - 'g.CopyFromScreen(screenLocation, New Point(0, 0), New Size(1, 1)) - 'Dim result As Color = bm.GetPixel(0, 0) - 'g.Dispose() - 'bm.Dispose() - 'Return result - Return Nothing - End Function - - Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click - Dim MyDialog As New ColorDialog - MyDialog.AllowFullOpen = True - 'If TextBox22.Text.Length > 0 And TextBox23.Text.Length > 0 And TextBox24.Text.Length > 0 Then - ' If CType(TextBox22.Text, Integer) >= 0 And CType(TextBox23.Text, Integer) >= 0 And CType(TextBox24.Text, Integer) >= 0 Then - ' MyDialog.Color = Color.FromArgb(0, CType(TextBox22.Text, Integer), CType(TextBox23.Text, Integer), CType(TextBox24.Text, Integer)) - ' End If - 'End If - - If (MyDialog.ShowDialog() = Windows.Forms.DialogResult.OK) Then - 'TextBox22.Text = MyDialog.Color.R.ToString - 'TextBox23.Text = MyDialog.Color.G.ToString - 'TextBox24.Text = MyDialog.Color.B.ToString - TextBox34.Text = ColorTranslator.ToHtml(MyDialog.Color) - TextBox34.BackColor = MyDialog.Color - - End If - End Sub - - - - - - - - Private Sub TextBox27_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) - - End Sub - - - - - Private Sub CheckBox18_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox18.CheckedChanged - CheckBox4.Checked = False - CheckBox12.Checked = False - - End Sub - - Private Sub CheckBox4_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox4.CheckedChanged - CheckBox18.Checked = False - End Sub - - Private Sub CheckBox12_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox12.CheckedChanged - CheckBox18.Checked = False - End Sub - - Private Sub Label27_Click(sender As Object, e As EventArgs) Handles Label27.Click - - End Sub - - Private Async Sub Button1_Click(sender As Object, e As EventArgs) Handles btnCreaCatalogoAsync.Click - lockUI() - 'Dim timeStart As Date - 'Dim timeStop As Date - - 'timeStart = TimeOfDay - FixPaths() - Label10.Text = "Elaborazione in corso..." - lblFotoTotaliNum.Text = "0" - Label18.Text = "0" - Label43.Text = "-s" - - setPicSettings(txtSorgente.Text, txtDestinazione.Text) - ProgressBar1.Minimum = 0 - ProgressBar1.Step = 1 - ProgressBar1.Value = 0 - - 'Await CreaCatalogoParallel() - Dim imgStf As ImageCreationStuff = New ImageCreationStuff() - - Dim imageCreationOptions As ImageCreationStuff.Options = New ImageCreationStuff.Options() - With imageCreationOptions - .AggiornaSottodirectory = chkAggiornaSottodirectory.Checked - .CreaSottocartelle = chkCreaSottocartelle.Checked - .FilePerCartella = CInt(txtFilePerCartella.Text) - .SuffissoCartelle = txtSuffissoCartelle.Text - .CifreContatore = CInt(txtCifreContatore.Text) - .NumerazioneType = GetNumerazioneEnum() - .SourcePath = txtSorgente.Text - .DestinationPath = txtDestinazione.Text - .MaxThreads = CInt(TextBox7.Text) - .ChunksSize = CInt(TextBox8.Text) - .LinearExecution = rdbVecchioMetodo.Checked - End With - - Dim time As String = Await imgStf.CreaCatalogoParallel(imageCreationOptions) - Label43.Text = time - Label10.Text = "Finito" - unlockUI() - - End Sub - Private Sub UpdateCounter(text As String) - Label10.Invoke(Sub() - Label10.Text = text - - End Sub) - End Sub - Private Async Function CreaCatalogoParallel() As Task - Dim timeStart As Date = TimeOfDay - ContaImmaginiThread = 0 - setLabel10Text("Elaborazione in corso...") - Dim imgStf As ImageCreationStuff = New ImageCreationStuff() - - Dim imageCreationOptions As ImageCreationStuff.Options = New ImageCreationStuff.Options() - With imageCreationOptions - .AggiornaSottodirectory = chkAggiornaSottodirectory.Checked - .CreaSottocartelle = chkCreaSottocartelle.Checked - .FilePerCartella = CInt(txtFilePerCartella.Text) - .SuffissoCartelle = txtSuffissoCartelle.Text - .CifreContatore = CInt(txtCifreContatore.Text) - .NumerazioneType = GetNumerazioneEnum() - .SourcePath = txtSorgente.Text - .DestinationPath = txtDestinazione.Text - End With - - Await imgStf.CreaImmaginiParallel(imageCreationOptions) - - 'Await CreaImmaginiParallel(txtSorgente.Text, txtDestinazione.Text) - - setLabel10Text("Finito") - Dim timeStop As Date = TimeOfDay - setLabel43Text(CalcTime(timeStart, timeStop, ContaImmaginiThread)) - End Function - - '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 -End Class - -Public Class PicInfo - Public DirSource, DirDest, DirDestStart As DirectoryInfo - Public NomeImmagine As String - - Public Sub New(ByVal Dir_Source As DirectoryInfo, ByVal Dir_Dest As DirectoryInfo, ByVal Dir_DestStart As DirectoryInfo, ByVal Nome_Immagine As String) - DirSource = Dir_Source - DirDest = Dir_Dest - DirDestStart = Dir_DestStart - NomeImmagine = Nome_Immagine - End Sub -End Class \ No newline at end of file diff --git a/imagecatalog/Module1.cs b/imagecatalog/Module1.cs deleted file mode 100644 index de80777..0000000 --- a/imagecatalog/Module1.cs +++ /dev/null @@ -1,158 +0,0 @@ - -namespace ImageCatalog -{ - static class Module1 - { - - // Sub CaricaIni() - // Dim Parola As String - // Dim i As Integer - // Dim p As Integer - - // If Dir$(NomeIni) <> "" Then - // Open NomeIni For Input As #1 - // Input #1, NumeroMacchine - // For i = 1 To NumeroMacchine - // Input #1, NomeMacchina(i) - // Input #1, CodiceMacchina(i) - // Input #1, TempoMacchinaFerma(i) - // Input #1, LunghezzaImpulso(i) - // Input #1, TempoRegistrazioneDati(i) - // Input #1, RangoVelocita(i) - // Input #1, MaxVelocita(i) - // Input #1, NumeroRulli(i) - // Input #1, NumeroFili(i) - // Input #1, IndirizzoMacchina(i) - // Input #1, StampaAutoMacchina(i) - // Next i - // Input #1, SettimanaInizio - // Input #1, SettimanaFine - // Input #1, Chiusura - // Input #1, OrarioStampa - // Input #1, OrarioStampaSecondi - // Input #1, OrarioAccendiProg - // Input #1, OrarioSpengiProg - // Input #1, NomeDitta - // Input #1, StampaAutoGiorno - // Input #1, StampaAutoWeek - // Input #1, StampaGiornoRiepilogo - // Input #1, StampaGiornoGrafTMFA - // Input #1, StampaGiornoGrafVel - // Input #1, StampaWeekRiepilogo - // Input #1, StampaWeekGrafTMFA - // Input #1, StampaWeekGrafVel - // Input #1, StampanteManuale - // Input #1, StampanteAutomatica - // Input #1, StampanteNomeAghi - // Input #1, StampanteNomeLaser - // Input #1, NomePortaComm - - // Input #1, TurniTotali - // For p = 1 To TurniTotali - // Input #1, TurnoNumero(p) - // Input #1, TurnoInizioMinuti(p) - // Input #1, TurnoFineMinuti(p) - // Input #1, TurnoInizioSecondi(p) - // Input #1, TurnoFineSecondi(p) - // Next p - // Input #1, Parola - // Close #1 - // PassWordAmm = Trim$(Cripta(Parola, ChiaveCriDecri)) - // End If - // End Sub - - // Sub SalvaIni() - // Dim Conto As Single - // Dim Nomefile As String - // Dim NomeDir As String - // Dim Testo As String - // Dim TestoA As String - // Dim i As Integer - // Dim k As Integer - // Dim p As Integer - // Dim Lungo As Integer - // Dim Resto As Integer - // Dim Primo(3) As String - - // For i = 1 To NumeroMacchine - // If Right$(DirectoryProgramma, 1) = "\" Then - // NomeDir = DirectoryProgramma + NomeMacchina(i) - // Else - // NomeDir = DirectoryProgramma + "\" + NomeMacchina(i) - // End If - // Nomefile = NomeDir + "\" + NomeMacchina(i) + ".SYS" - // If Dir$(Nomefile) = "" Then MkDir(NomeDir) - // Next i - - // Open NomeIni For Output As #3 - // Print #3, NumeroMacchine - // For i = 1 To NumeroMacchine - // If Right$(DirectoryProgramma, 1) = "\" Then - // Nomefile = DirectoryProgramma + NomeMacchina(i) + "\" + NomeMacchina(i) + ".SYS" - // Else - // Nomefile = DirectoryProgramma + "\" + NomeMacchina(i) + "\" + NomeMacchina(i) + ".SYS" - // End If - // Open Nomefile For Output As #4 - // Write #4, NomeMacchina(i) - // Write #4, CodiceMacchina(i) - // Print #4, TempoMacchinaFerma(i) - // Print #4, LunghezzaImpulso(i) - // Print #4, TempoRegistrazioneDati(i) - // Print #4, RangoVelocita(i) - // Print #4, MaxVelocita(i) - // Print #4, NumeroRulli(i) - // Print #4, NumeroFili(i) - // Print #4, IndirizzoMacchina(i) - // Write #4, StampaAutoMacchina(i) - // Close #4 - // Write #3, NomeMacchina(i) - // Write #3, CodiceMacchina(i) - // Print #3, TempoMacchinaFerma(i) - // Print #3, LunghezzaImpulso(i) - // Print #3, TempoRegistrazioneDati(i) - // Print #3, RangoVelocita(i) - // Print #3, MaxVelocita(i) - // Print #3, NumeroRulli(i) - // Print #3, NumeroFili(i) - // Print #3, IndirizzoMacchina(i) - // Write #3, StampaAutoMacchina(i) - // Next i - // Print #3, SettimanaInizio - // Print #3, SettimanaFine - // Write #3, Chiusura - // Write #3, OrarioStampa - // Print #3, OrarioStampaSecondi - // Write #3, OrarioAccendiProg - // Write #3, OrarioSpengiProg - // Write #3, NomeDitta - // Write #3, StampaAutoGiorno - // Write #3, StampaAutoWeek - // Write #3, StampaGiornoRiepilogo - // Write #3, StampaGiornoGrafTMFA - // Write #3, StampaGiornoGrafVel - // Write #3, StampaWeekRiepilogo - // Write #3, StampaWeekGrafTMFA - // Write #3, StampaWeekGrafVel - // Write #3, StampanteManuale - // Write #3, StampanteAutomatica - // Write #3, StampanteNomeAghi - // Write #3, StampanteNomeLaser - // Write #3, NomePortaComm - - // Print #3, TurniTotali - // For p = 1 To TurniTotali - // Print #3, TurnoNumero(p) - // Print #3, TurnoInizioMinuti(p) - // Print #3, TurnoFineMinuti(p) - // Print #3, TurnoInizioSecondi(p) - // Print #3, TurnoFineSecondi(p) - // Next p - // Testo = Cripta(PassWordAmm, ChiaveCriDecri) - // Write #3, Testo - // Close #3 - // End Sub - - - public static ParametriSetup SetupIni = new ParametriSetup(); - } -} \ No newline at end of file diff --git a/imagecatalog/Module1.vb b/imagecatalog/Module1.vb deleted file mode 100644 index f9b2cbc..0000000 --- a/imagecatalog/Module1.vb +++ /dev/null @@ -1,155 +0,0 @@ -Module Module1 - - 'Sub CaricaIni() - ' Dim Parola As String - ' Dim i As Integer - ' Dim p As Integer - - ' If Dir$(NomeIni) <> "" Then - ' Open NomeIni For Input As #1 - ' Input #1, NumeroMacchine - ' For i = 1 To NumeroMacchine - ' Input #1, NomeMacchina(i) - ' Input #1, CodiceMacchina(i) - ' Input #1, TempoMacchinaFerma(i) - ' Input #1, LunghezzaImpulso(i) - ' Input #1, TempoRegistrazioneDati(i) - ' Input #1, RangoVelocita(i) - ' Input #1, MaxVelocita(i) - ' Input #1, NumeroRulli(i) - ' Input #1, NumeroFili(i) - ' Input #1, IndirizzoMacchina(i) - ' Input #1, StampaAutoMacchina(i) - ' Next i - ' Input #1, SettimanaInizio - ' Input #1, SettimanaFine - ' Input #1, Chiusura - ' Input #1, OrarioStampa - ' Input #1, OrarioStampaSecondi - ' Input #1, OrarioAccendiProg - ' Input #1, OrarioSpengiProg - ' Input #1, NomeDitta - ' Input #1, StampaAutoGiorno - ' Input #1, StampaAutoWeek - ' Input #1, StampaGiornoRiepilogo - ' Input #1, StampaGiornoGrafTMFA - ' Input #1, StampaGiornoGrafVel - ' Input #1, StampaWeekRiepilogo - ' Input #1, StampaWeekGrafTMFA - ' Input #1, StampaWeekGrafVel - ' Input #1, StampanteManuale - ' Input #1, StampanteAutomatica - ' Input #1, StampanteNomeAghi - ' Input #1, StampanteNomeLaser - ' Input #1, NomePortaComm - - ' Input #1, TurniTotali - ' For p = 1 To TurniTotali - ' Input #1, TurnoNumero(p) - ' Input #1, TurnoInizioMinuti(p) - ' Input #1, TurnoFineMinuti(p) - ' Input #1, TurnoInizioSecondi(p) - ' Input #1, TurnoFineSecondi(p) - ' Next p - ' Input #1, Parola - ' Close #1 - ' PassWordAmm = Trim$(Cripta(Parola, ChiaveCriDecri)) - ' End If - 'End Sub - - 'Sub SalvaIni() - ' Dim Conto As Single - ' Dim Nomefile As String - ' Dim NomeDir As String - ' Dim Testo As String - ' Dim TestoA As String - ' Dim i As Integer - ' Dim k As Integer - ' Dim p As Integer - ' Dim Lungo As Integer - ' Dim Resto As Integer - ' Dim Primo(3) As String - - ' For i = 1 To NumeroMacchine - ' If Right$(DirectoryProgramma, 1) = "\" Then - ' NomeDir = DirectoryProgramma + NomeMacchina(i) - ' Else - ' NomeDir = DirectoryProgramma + "\" + NomeMacchina(i) - ' End If - ' Nomefile = NomeDir + "\" + NomeMacchina(i) + ".SYS" - ' If Dir$(Nomefile) = "" Then MkDir(NomeDir) - ' Next i - - 'Open NomeIni For Output As #3 - ' Print #3, NumeroMacchine - ' For i = 1 To NumeroMacchine - ' If Right$(DirectoryProgramma, 1) = "\" Then - ' Nomefile = DirectoryProgramma + NomeMacchina(i) + "\" + NomeMacchina(i) + ".SYS" - ' Else - ' Nomefile = DirectoryProgramma + "\" + NomeMacchina(i) + "\" + NomeMacchina(i) + ".SYS" - ' End If - ' Open Nomefile For Output As #4 - ' Write #4, NomeMacchina(i) - ' Write #4, CodiceMacchina(i) - ' Print #4, TempoMacchinaFerma(i) - ' Print #4, LunghezzaImpulso(i) - ' Print #4, TempoRegistrazioneDati(i) - ' Print #4, RangoVelocita(i) - ' Print #4, MaxVelocita(i) - ' Print #4, NumeroRulli(i) - ' Print #4, NumeroFili(i) - ' Print #4, IndirizzoMacchina(i) - ' Write #4, StampaAutoMacchina(i) - ' Close #4 - ' Write #3, NomeMacchina(i) - ' Write #3, CodiceMacchina(i) - ' Print #3, TempoMacchinaFerma(i) - ' Print #3, LunghezzaImpulso(i) - ' Print #3, TempoRegistrazioneDati(i) - ' Print #3, RangoVelocita(i) - ' Print #3, MaxVelocita(i) - ' Print #3, NumeroRulli(i) - ' Print #3, NumeroFili(i) - ' Print #3, IndirizzoMacchina(i) - ' Write #3, StampaAutoMacchina(i) - ' Next i - ' Print #3, SettimanaInizio - ' Print #3, SettimanaFine - ' Write #3, Chiusura - ' Write #3, OrarioStampa - ' Print #3, OrarioStampaSecondi - ' Write #3, OrarioAccendiProg - ' Write #3, OrarioSpengiProg - ' Write #3, NomeDitta - ' Write #3, StampaAutoGiorno - ' Write #3, StampaAutoWeek - ' Write #3, StampaGiornoRiepilogo - ' Write #3, StampaGiornoGrafTMFA - ' Write #3, StampaGiornoGrafVel - ' Write #3, StampaWeekRiepilogo - ' Write #3, StampaWeekGrafTMFA - ' Write #3, StampaWeekGrafVel - ' Write #3, StampanteManuale - ' Write #3, StampanteAutomatica - ' Write #3, StampanteNomeAghi - ' Write #3, StampanteNomeLaser - ' Write #3, NomePortaComm - - ' Print #3, TurniTotali - ' For p = 1 To TurniTotali - ' Print #3, TurnoNumero(p) - ' Print #3, TurnoInizioMinuti(p) - ' Print #3, TurnoFineMinuti(p) - ' Print #3, TurnoInizioSecondi(p) - ' Print #3, TurnoFineSecondi(p) - ' Next p - ' Testo = Cripta(PassWordAmm, ChiaveCriDecri) - ' Write #3, Testo - 'Close #3 - 'End Sub - - - Public SetupIni As New ParametriSetup - - -End Module diff --git a/imagecatalog/Module2.cs b/imagecatalog/Module2.cs deleted file mode 100644 index 9a86f8b..0000000 --- a/imagecatalog/Module2.cs +++ /dev/null @@ -1,7 +0,0 @@ - -namespace ImageCatalog -{ - static class Module2 - { - } -} \ No newline at end of file diff --git a/imagecatalog/Module2.vb b/imagecatalog/Module2.vb deleted file mode 100644 index f48fe0e..0000000 --- a/imagecatalog/Module2.vb +++ /dev/null @@ -1,3 +0,0 @@ -Module Module2 - -End Module diff --git a/imagecatalog/Program.cs b/imagecatalog/Program.cs index 0fe5fba..b4c2f37 100644 --- a/imagecatalog/Program.cs +++ b/imagecatalog/Program.cs @@ -82,6 +82,8 @@ namespace ImageCatalog_2 services.AddTransient(); services.AddTransient(); + + services.AddSingleton(); // Register your forms services.AddTransient(); -- 2.52.0 From 65aeabdfee2be98f7c1ec249be1406c303e662bf Mon Sep 17 00:00:00 2001 From: Marco Date: Mon, 28 Jul 2025 09:49:55 +0200 Subject: [PATCH 020/127] Updated libraries and made horizontal text property --- CatalogVbLib/CatalogVbLib.vbproj | 4 ++-- MaddoShared/MaddoShared.csproj | 6 +++--- imagecatalog/DataModel.cs | 12 ++++++++++++ imagecatalog/MainForm.Designer.cs | 5 +++-- imagecatalog/MainForm.cs | 16 ++++++++-------- imagecatalog/Program.cs | 4 ++-- 6 files changed, 30 insertions(+), 17 deletions(-) diff --git a/CatalogVbLib/CatalogVbLib.vbproj b/CatalogVbLib/CatalogVbLib.vbproj index e042d2f..dd7243d 100644 --- a/CatalogVbLib/CatalogVbLib.vbproj +++ b/CatalogVbLib/CatalogVbLib.vbproj @@ -36,9 +36,9 @@ - + - + \ No newline at end of file diff --git a/MaddoShared/MaddoShared.csproj b/MaddoShared/MaddoShared.csproj index 4ba12c1..6b51269 100644 --- a/MaddoShared/MaddoShared.csproj +++ b/MaddoShared/MaddoShared.csproj @@ -13,12 +13,12 @@ - + - + @@ -26,6 +26,6 @@ all - + \ No newline at end of file diff --git a/imagecatalog/DataModel.cs b/imagecatalog/DataModel.cs index da345bf..bc94a4c 100644 --- a/imagecatalog/DataModel.cs +++ b/imagecatalog/DataModel.cs @@ -54,6 +54,18 @@ namespace ImageCatalog_2 } } + private string _horizontalText; + + public string HorizontalText + { + get => _horizontalText; + set + { + _horizontalText = value; + NotifyPropertyChanged(); + } + } + private bool _uiEnabled = true; public bool UiEnabled diff --git a/imagecatalog/MainForm.Designer.cs b/imagecatalog/MainForm.Designer.cs index 1b57b5b..cb3d6ef 100644 --- a/imagecatalog/MainForm.Designer.cs +++ b/imagecatalog/MainForm.Designer.cs @@ -466,7 +466,7 @@ namespace ImageCatalog txtSorgente.Name = "txtSorgente"; txtSorgente.Size = new Size(500, 27); txtSorgente.TabIndex = 0; - txtSorgente.Text = "TextBox1"; + txtSorgente.Text = ""; // // txtDestinazione // @@ -991,12 +991,13 @@ namespace ImageCatalog // // TextBox4 // + TextBox4.DataBindings.Add(new Binding("Text", bindingSource1, "HorizontalText", true, DataSourceUpdateMode.OnPropertyChanged)); TextBox4.Location = new Point(96, 37); TextBox4.Margin = new Padding(4, 5, 4, 5); TextBox4.Name = "TextBox4"; TextBox4.Size = new Size(543, 27); TextBox4.TabIndex = 8; - TextBox4.Text = "TextBox4"; + TextBox4.Text = ""; // // Label9 // diff --git a/imagecatalog/MainForm.cs b/imagecatalog/MainForm.cs index 1fe9b91..d259b08 100644 --- a/imagecatalog/MainForm.cs +++ b/imagecatalog/MainForm.cs @@ -24,8 +24,7 @@ public delegate void XyThreadAdd(string Info); public partial class MainForm { - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public DataModel Model { get; set; } + private readonly DataModel Model; private readonly ILogger _logger; @@ -33,8 +32,9 @@ public partial class MainForm private readonly ParametriSetup _parametriSetup; - public MainForm( ImageCreationStuff imageCreationStuff, ParametriSetup parametriSetup, ILogger logger) + public MainForm(DataModel model, ImageCreationStuff imageCreationStuff, ParametriSetup parametriSetup, ILogger logger) { + Model = model; _imageCreationService = imageCreationStuff; _parametriSetup = parametriSetup; _logger = logger; @@ -133,7 +133,7 @@ public partial class MainForm Model.SourcePath = string.Empty; Model.DestinationPath = string.Empty; TextBox3.Text = "tn_"; - TextBox4.Text = ""; + Model.HorizontalText = ""; TextBox5.Text = "350"; TextBox6.Text = "350"; TextBox27.Text = "2240"; @@ -431,7 +431,7 @@ public partial class MainForm _parametriSetup.AggiornaParametro("FontDimensioneMiniatura", TextBox25.Text); _parametriSetup.AggiornaParametro("FontBold", CheckBox3.Checked); _parametriSetup.AggiornaParametro("FontNome", ComboBox3.Text); - _parametriSetup.AggiornaParametro("TestoTesto", TextBox4.Text); + _parametriSetup.AggiornaParametro("TestoTesto", Model.HorizontalText); _parametriSetup.AggiornaParametro("TestoTrasparente", TextBox9.Text); _parametriSetup.AggiornaParametro("TestoMargine", TextBox12.Text); _parametriSetup.AggiornaParametro("TestoPosizione", ComboBox1.Text); @@ -519,7 +519,7 @@ public partial class MainForm TextBox25.Text = "0"; } - TextBox4.Text = _parametriSetup.LeggiParametroString("TestoTesto"); + Model.HorizontalText = _parametriSetup.LeggiParametroString("TestoTesto"); TextBox9.Text = _parametriSetup.LeggiParametroString("TestoTrasparente"); TextBox12.Text = _parametriSetup.LeggiParametroString("TestoMargine"); ComboBox1.Text = _parametriSetup.LeggiParametroString("TestoPosizione"); @@ -611,7 +611,7 @@ public partial class MainForm PicSettings.NomeData = false; } - PicSettings.TestoFirmaStart = TextBox4.Text; + PicSettings.TestoFirmaStart = Model.HorizontalText; PicSettings.TestoFirmaStartV = TextBox29.Text; PicSettings.DataPartenza = DateTimePicker1.Value; PicSettings.TestoOrario = TextBox18.Text; @@ -1198,7 +1198,7 @@ public partial class MainForm ClsCreaImmagine.NomeData = false; } - ClsCreaImmagine.TestoFirmaStart = TextBox4.Text; + ClsCreaImmagine.TestoFirmaStart = Model.HorizontalText; ClsCreaImmagine.TestoFirmaStartV = TextBox29.Text; ClsCreaImmagine.DataPartenza = DateTimePicker1.Value; ClsCreaImmagine.TestoOrario = TextBox18.Text; diff --git a/imagecatalog/Program.cs b/imagecatalog/Program.cs index b4c2f37..7863674 100644 --- a/imagecatalog/Program.cs +++ b/imagecatalog/Program.cs @@ -67,9 +67,9 @@ namespace ImageCatalog_2 ServiceProvider = serviceCollection.BuildServiceProvider(); var mainForm = ServiceProvider.GetRequiredService(); - var mainViewModel = ServiceProvider.GetRequiredService(); + //var mainViewModel = ServiceProvider.GetRequiredService(); - mainForm.Model = mainViewModel; + //mainForm.Model = mainViewModel; Application.Run(mainForm); } -- 2.52.0 From ab33d4558fe4c9e6ad0c7da5285353e58fa7ac35 Mon Sep 17 00:00:00 2001 From: Marco Date: Mon, 28 Jul 2025 09:59:58 +0200 Subject: [PATCH 021/127] Removed visual basic lib dependency --- CatalogVbLib/Class1.vb | 3 - CatalogVbLib/ImageCreator.vb | 844 ----------------------------- MaddoShared/ImageCreationStuff.cs | 1 - MaddoShared/ImageCreatorSharp.cs | 40 +- MaddoShared/MaddoShared.csproj | 3 - MaddoShared/Orientations.cs | 13 + MaddoShared/PicSettings.cs | 67 +++ imagecatalog/ImageCatalog 2.csproj | 1 - imagecatalog/MainForm.cs | 8 +- imagecatalog/PicSettings.cs | 602 -------------------- imagecatalog/PicSettings.vb | 604 --------------------- 11 files changed, 102 insertions(+), 2084 deletions(-) delete mode 100644 CatalogVbLib/Class1.vb delete mode 100644 CatalogVbLib/ImageCreator.vb create mode 100644 MaddoShared/Orientations.cs create mode 100644 MaddoShared/PicSettings.cs delete mode 100644 imagecatalog/PicSettings.cs delete mode 100644 imagecatalog/PicSettings.vb diff --git a/CatalogVbLib/Class1.vb b/CatalogVbLib/Class1.vb deleted file mode 100644 index 875798b..0000000 --- a/CatalogVbLib/Class1.vb +++ /dev/null @@ -1,3 +0,0 @@ -Public Class Class1 - -End Class diff --git a/CatalogVbLib/ImageCreator.vb b/CatalogVbLib/ImageCreator.vb deleted file mode 100644 index 3b24fea..0000000 --- a/CatalogVbLib/ImageCreator.vb +++ /dev/null @@ -1,844 +0,0 @@ -Imports System.Drawing -Imports System.IO -Imports System.Drawing.Drawing2D -Imports System.Drawing.Imaging -Imports System.Windows.Forms -'Imports System.Threading - -Public Class ImageCreator -#Region "dichiarazioni" - - - Private FotoRuotaADestra As Boolean = False - Private FotoRuotaASinistra As Boolean = False - - Private TempMinText As String = "" - 'Private crFont1 As Font - Private _NomeFileChild As String - - Private _SourceDir As DirectoryInfo - Private _DestDirStart As DirectoryInfo - Private _DestDir As DirectoryInfo - - Private _workFile As FileInfo - - Private testoFirma As String - Private testoFirmaV As String - Private alphaScelta As Integer - Private DimensioneStandard As Integer - Private DimensioneStandardMiniatura As Integer - Private dataFoto As DateTime - Private dataPartenzaI As DateTime - Private testoOrario As String - Private testoFirmaPiccola As String - Private thumbSizeSmall As Size - Private thumbSizeBig As Size - Private nomeFileSmall As String - Private nomeFileBig As String - Private nomeFileBig2 As String - - Private yPosFromBottom As Single - Private yPosFromBottom1 As Single - Private yPosFromBottom2 As Single - Private yPosFromBottom3 As Single - Private yPosFromBottom4 As Single -#End Region - - Public Sub New() - - End Sub - - Public Sub New(ByVal nomeFileChild As String, ByVal sourceDir As DirectoryInfo, ByVal destDir As DirectoryInfo, ByVal destDirStart As DirectoryInfo) - Me.NomeFileChild = nomeFileChild - Me.SourceDir = sourceDir - Me.DestDir = destDir - Me.DestDirStart = destDirStart - Me.WorkFile = New FileInfo(nomeFileChild) - End Sub - - Public Sub New(ByVal nomeFileChild As String, ByVal sourceDir As DirectoryInfo, ByVal destDir As DirectoryInfo) - Me.NomeFileChild = nomeFileChild - Me.DestDir = destDir - End Sub - - Public Sub New(ByVal file As FileInfo, ByVal destination As DirectoryInfo) - Me.WorkFile = file - Me.DestDir = destination - - End Sub - - Public Sub CreaImmagineThread(ByVal Info As String) - - Try - - preparaVariabili() - 'Dim g As System.Drawing.Image = System.Drawing.Image.FromFile(Path.Combine(SourceDir.FullName, NomeFileChild)) - Using g As Image = Image.FromFile(WorkFile.FullName) - - - - - 'Dim g As System.Drawing.Image = System.Drawing.Image.FromFile(WorkFile.FullName) - - ' Imposta testo extra - impostaTestoExtra(g) - - ' Ruota l'immagine in base ai dati EXIF - Rotation(g) - - ' Forza jpeg se è selezionata l'opzione - Dim thisFormat As System.Drawing.Imaging.ImageFormat = g.RawFormat - If PicSettings.UsaForzaJpg = True Then thisFormat = System.Drawing.Imaging.ImageFormat.Jpeg - - prepareThumbnailSize(g) - - Dim imgOutputBig As New Bitmap(g, thumbSizeBig.Width, thumbSizeBig.Height) - imgOutputBig.SetResolution(g.HorizontalResolution, g.VerticalResolution) - - ' Crea le miniature - creaMiniature(g, imgOutputBig, thisFormat) - - aggiungiTesto(g, imgOutputBig) - - aggiungiLogo(imgOutputBig) - - salvaFoto(imgOutputBig, thumbSizeBig, nomeFileBig, nomeFileSmall, thumbSizeSmall, thisFormat) - End Using - 'g.Dispose() - - GC.Collect() - - 'PicSettings.mainForm.stepProgressBar() - - Catch ex As Exception - Dim e = ex.Demystify() - Console.WriteLine(e) - Console.WriteLine(e.Message) - Console.WriteLine(e.StackTrace) - 'MessageBox.Show(ex.Message) - - - End Try - - - - End Sub - - Private Sub Rotation(ByRef g As System.Drawing.Image) - - FotoRuotaADestra = False - FotoRuotaASinistra = False - - If PicSettings.UsaRotazioneAutomatica = True Then - If g.PropertyIdList.Length > 0 Then ' ci sono dati exif - Dim DatiExif As New ExifReader(CType(g, Bitmap)) - - Select Case DatiExif.Orientation - Case ExifReader.Orientations.BottomLeft - - Case ExifReader.Orientations.BottomRight - - Case ExifReader.Orientations.LeftTop - - Case ExifReader.Orientations.LftBottom - FotoRuotaASinistra = True - Case ExifReader.Orientations.RightBottom - - Case ExifReader.Orientations.RightTop - - Case ExifReader.Orientations.TopLeft - - Case ExifReader.Orientations.TopRight - - End Select - End If - End If - - If FotoRuotaASinistra = True Then - g.RotateFlip(RotateFlipType.Rotate270FlipNone) - End If - If FotoRuotaADestra = True Then - g.RotateFlip(RotateFlipType.Rotate90FlipNone) - End If - - - - End Sub - ''' - ''' Aggiunge Orario, tempo gara e altri - ''' - ''' Image - ''' - Private Sub impostaTestoExtra(g As Image) - If PicSettings.UsaOrarioTestoApplicare Or - PicSettings.UsaTempoGaraTestoApplicare Or - PicSettings.UsaOrarioMiniatura Or - PicSettings.TestoMin Or - PicSettings.AggTempoGaraMin Or - PicSettings.AggNumTempMin Then - - If g.PropertyIdList.Length > 0 Then ' ci sono dati exif - Dim DatiExif As New ExifReader(CType(g, Bitmap)) - dataFoto = DatiExif.DateTimeOriginal - testoFirma = PicSettings.TestoFirmaStart - testoFirmaV = PicSettings.TestoFirmaStartV - - If dataFoto.Year <> 1 Then - testoFirmaPiccola = dataFoto.ToShortTimeString - If PicSettings.UsaOrarioTestoApplicare = True Then - testoFirma &= " " & dataFoto.ToShortDateString & " " & dataFoto.ToLongTimeString - testoFirmaV &= " " & dataFoto.ToShortDateString & " " & dataFoto.ToLongTimeString - End If - If PicSettings.UsaTempoGaraTestoApplicare = True Then - Dim Orario As TimeSpan = New TimeSpan(DateDiff(DateInterval.Second, dataPartenzaI, dataFoto) * 10000000) - testoFirma &= " " & testoOrario & Orario.Hours.ToString("00") & ":" & Orario.Minutes.ToString("00") & ":" & Orario.Seconds.ToString("00") - testoFirmaV &= " " & testoOrario & Orario.Hours.ToString("00") & ":" & Orario.Minutes.ToString("00") & ":" & Orario.Seconds.ToString("00") - End If - End If - - End If - Else - testoFirma = PicSettings.TestoFirmaStart - testoFirmaV = PicSettings.TestoFirmaStartV - - End If - End Sub - - ''' - ''' Prepara diverse variabili azzerandole, elaborandole e prendendole dalle impostazioni - ''' - ''' - Private Sub preparaVariabili() - alphaScelta = CType((255 * (100 - PicSettings.Trasparenza) / 100), Integer) - testoFirma = "" - testoFirmaV = "" - dataPartenzaI = PicSettings.DataPartenza - testoOrario = PicSettings.TestoOrario - If testoOrario.Length > 0 Then testoOrario &= " " - testoFirmaPiccola = "" - thumbSizeSmall = New Size - thumbSizeBig = New Size - nomeFileSmall = "" - nomeFileBig2 = "" - nomeFileBig = "" - DimensioneStandard = PicSettings.DimStandard - DimensioneStandardMiniatura = PicSettings.DimStandardMiniatura - 'nomeFileSmall = Suffisso & NomeFileChild - 'nomeFileBig = NomeFileChild - nomeFileSmall = Suffisso & WorkFile.Name - nomeFileBig = WorkFile.Name - End Sub - - Private Sub prepareThumbnailSize(g As Image) - If g.Width > g.Height Then - thumbSizeSmall = NewthumbSize(g.Width, g.Height, LarghezzaSmall, "Larghezza") - Dim SizeOrig As New Size(g.Width, g.Height) - thumbSizeBig = SizeOrig - Else - thumbSizeSmall = NewthumbSize(g.Width, g.Height, AltezzaSmall, "Altezza") - Dim SizeOrig As New Size(g.Width, g.Height) - thumbSizeBig = SizeOrig - End If - End Sub - - Private Sub creaMiniature(g As Image, imgOutputBig As Bitmap, thisFormat As ImageFormat) - If PicSettings.TestoMin Then - testoFirmaPiccola = nomeFileBig - ElseIf PicSettings.AggNumTempMin Then - testoFirmaPiccola = nomeFileBig + " " - End If - 'Dim yPosFromBottom4 As Single - - Dim crFont1 As Font = Nothing - Dim crFont2 As Font = Nothing - Dim crSize1 As SizeF = New SizeF - Dim crSize2 As SizeF = New SizeF - - If PicSettings.CreaMiniature = True Then - If PicSettings.AggiungiScritteMiniature = False Then - If PicSettings.DirectorySorgente.ToUpper = PicSettings.DirectoryDestinazione.ToUpper Then - nomeFileSmall = nomeFileSmall.Substring(0, nomeFileSmall.Length - 4) & Codice & nomeFileSmall.Substring(nomeFileSmall.Length - 4) - End If - If PicSettings.UsaOrarioMiniatura Or - PicSettings.TestoMin Or - PicSettings.AggTempoGaraMin Or - PicSettings.AggNumTempMin Then - - If testoFirmaPiccola.Length > 0 Then - Dim imgOutputSmall As Bitmap - imgOutputSmall = CType(imgOutputBig.Clone, Bitmap) - - Dim grPhoto1 As Graphics - grPhoto1 = Graphics.FromImage(imgOutputSmall) - grPhoto1.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias - - Dim LarghezzaStandard1 As Integer - 'quick fix - DimensioneStandardMiniatura = 50 - If PicSettings.Grassetto = True Then - crFont1 = New Font(PicSettings.IlFont, DimensioneStandardMiniatura, FontStyle.Bold) - crFont2 = New Font(PicSettings.IlFont, DimensioneStandard, FontStyle.Bold) - Else - crFont1 = New Font(PicSettings.IlFont, DimensioneStandardMiniatura) - crFont2 = New Font(PicSettings.IlFont, DimensioneStandard) - End If - - crSize1 = grPhoto1.MeasureString(testoFirmaPiccola, crFont1) - crSize2 = grPhoto1.MeasureString(testoFirma, crFont1) - LarghezzaStandard1 = CType(crSize1.Width, Integer) - - If crSize1.Width > CType(g.Width, Single) Then - Dim Conta As Integer = DimensioneStandardMiniatura - Do - If Conta > 20 Then - Conta -= 5 - Else - Conta -= 1 - End If - If PicSettings.Grassetto = True Then - crFont1 = New Font(PicSettings.IlFont, Conta, FontStyle.Bold) - Else - crFont1 = New Font(PicSettings.IlFont, Conta) - End If - crSize1 = grPhoto1.MeasureString(testoFirmaPiccola, crFont1) - If crSize1.Width < CType(g.Width, Single) Then - LarghezzaStandard1 = CType(crSize1.Width, Integer) - Exit Do - End If - If Conta <= 5 Then Exit Do - Loop - DimensioneStandardMiniatura = Conta - End If - - Select Case PicSettings.Posizione.ToUpper - Case "ALTO" - yPosFromBottom1 = (PicSettings.Margine) - yPosFromBottom4 = (PicSettings.MargVert) - - Case "BASSO" - yPosFromBottom1 = CType((g.Height - crSize1.Height - (g.Height * PicSettings.Margine / 100)), Single) - yPosFromBottom4 = CType((g.Height - crSize1.Height - (g.Height * PicSettings.MargVert / 100)), Single) - - End Select - - Dim xCenterOfImg1 As Single - - Dim StrFormat1 As StringFormat = New StringFormat - Select Case PicSettings.Allineamento.ToUpper - Case "SINISTRA" - xCenterOfImg1 = CType((PicSettings.Margine + (LarghezzaStandard1 / 2)), Single) - - If (LarghezzaStandard1 / 2) > (g.Width / 2) - PicSettings.Margine Then - xCenterOfImg1 = CType((g.Width / 2), Single) - End If - - - Case "CENTRO" - xCenterOfImg1 = CType((g.Width / 2), Single) - - - Case "DESTRA" - xCenterOfImg1 = CType((g.Width - PicSettings.Margine - (LarghezzaStandard1 / 2)), Single) - - If (LarghezzaStandard1 / 2) > (g.Width / 2) - PicSettings.Margine Then - xCenterOfImg1 = CType((g.Width / 2), Single) - End If - - - End Select - StrFormat1.Alignment = StringAlignment.Center - - Dim semiTransBrush21 As SolidBrush = New SolidBrush(Color.FromArgb(alphaScelta, 0, 0, 0)) - Dim semiTransBrush1 As SolidBrush = New SolidBrush(Color.FromArgb(alphaScelta, PicSettings.fontColoreRGB)) - - 'quick fix - DimensioneStandardMiniatura = PicSettings.DimMin - - If PicSettings.Grassetto = True Then - crFont1 = New Font(PicSettings.IlFont, DimensioneStandardMiniatura, FontStyle.Bold) - Else - crFont1 = New Font(PicSettings.IlFont, DimensioneStandardMiniatura) - End If - 'asdgadfhdfhjgfsjgfjygfdhsdafa - If PicSettings.TestoMin Then - grPhoto1.DrawString(nomeFileBig, crFont1, semiTransBrush21, New PointF(xCenterOfImg1 + 1, yPosFromBottom1 + 1), StrFormat1) - grPhoto1.DrawString(nomeFileBig, crFont1, semiTransBrush1, New PointF(xCenterOfImg1, yPosFromBottom1), StrFormat1) - ElseIf PicSettings.AggTempoGaraMin And PicSettings.UsaTempoGaraTestoApplicare Then - Dim Orario As TimeSpan = New TimeSpan(DateDiff(DateInterval.Second, dataPartenzaI, dataFoto) * 10000000) - Dim tempstr As String = "" - - - tempstr &= ControlChars.CrLf & testoOrario & Orario.Hours.ToString("00") & ":" & Orario.Minutes.ToString("00") & ":" & Orario.Seconds.ToString("00") - - - grPhoto1.DrawString(tempstr, crFont1, semiTransBrush21, New PointF(xCenterOfImg1 + 1, yPosFromBottom1 + 1), StrFormat1) - grPhoto1.DrawString(tempstr, crFont1, semiTransBrush1, New PointF(xCenterOfImg1, yPosFromBottom1), StrFormat1) - - ElseIf PicSettings.AggNumTempMin Then - Dim Orario As TimeSpan = New TimeSpan(DateDiff(DateInterval.Second, dataPartenzaI, dataFoto) * 10000000) - Dim tempstr As String = "" - tempstr &= nomeFileBig - - tempstr &= ControlChars.CrLf & testoOrario & Orario.Hours.ToString("00") & ":" & Orario.Minutes.ToString("00") & ":" & Orario.Seconds.ToString("00") - - - grPhoto1.DrawString(tempstr, crFont1, semiTransBrush21, New PointF(xCenterOfImg1 + 1, yPosFromBottom1 + 1), StrFormat1) - grPhoto1.DrawString(tempstr, crFont1, semiTransBrush1, New PointF(xCenterOfImg1, yPosFromBottom1), StrFormat1) - - - Else - grPhoto1.DrawString(testoFirmaPiccola, crFont1, semiTransBrush21, New PointF(xCenterOfImg1 + 1, yPosFromBottom1 + 1), StrFormat1) - grPhoto1.DrawString(testoFirmaPiccola, crFont1, semiTransBrush1, New PointF(xCenterOfImg1, yPosFromBottom1), StrFormat1) - End If - - ' Salva la miniatura - imgOutputSmall.Save(Path.Combine(DestDir.FullName, "Temp_" & nomeFileSmall), thisFormat) - Dim g2 As System.Drawing.Image = System.Drawing.Image.FromFile(Path.Combine(DestDir.FullName, "Temp_" & nomeFileSmall)) - Dim imgOutputSmall2 As New Bitmap(g2, thumbSizeSmall.Width, thumbSizeSmall.Height) - imgOutputSmall2.Save(Path.Combine(DestDir.FullName, nomeFileSmall), thisFormat) - - imgOutputSmall2.Dispose() - imgOutputSmall.Dispose() - g2.Dispose() - Kill(Path.Combine(DestDir.FullName, "Temp_" & nomeFileSmall)) - Else - Dim imgOutputSmall As New Bitmap(g, thumbSizeSmall.Width, thumbSizeSmall.Height) - imgOutputSmall.Save(Path.Combine(DestDir.FullName, nomeFileSmall), thisFormat) - imgOutputSmall.Dispose() - End If - Else - Dim imgOutputSmall As New Bitmap(g, thumbSizeSmall.Width, thumbSizeSmall.Height) - imgOutputSmall.Save(Path.Combine(DestDir.FullName, nomeFileSmall), thisFormat) - imgOutputSmall.Dispose() - End If - End If - End If - End Sub - - Private Sub aggiungiTesto(g As Image, imgOutputBig As Bitmap) - Dim grPhoto As Graphics - grPhoto = Graphics.FromImage(imgOutputBig) - grPhoto.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias - - Dim crFont As Font = Nothing - Dim crSize As SizeF = New SizeF - Dim LarghezzaStandard As Integer - - If PicSettings.Grassetto = True Then - crFont = New Font(PicSettings.IlFont, DimensioneStandard, FontStyle.Bold) - Else - crFont = New Font(PicSettings.IlFont, DimensioneStandard) - End If - crSize = grPhoto.MeasureString(testoFirma, crFont) - LarghezzaStandard = CType(crSize.Width, Integer) - - If crSize.Width > CType(g.Width, Single) Then - Dim Conta As Integer = DimensioneStandard - Do - If Conta > 20 Then - Conta -= 5 - Else - Conta -= 1 - End If - If PicSettings.Grassetto = True Then - crFont = New Font(PicSettings.IlFont, Conta, FontStyle.Bold) - Else - crFont = New Font(PicSettings.IlFont, Conta) - End If - crSize = grPhoto.MeasureString(testoFirma, crFont) - If crSize.Width < CType(g.Width, Single) Then - LarghezzaStandard = CType(crSize.Width, Integer) - Exit Do - End If - If Conta <= 5 Then Exit Do - Loop - DimensioneStandard = Conta - End If - - - Select Case PicSettings.Posizione.ToUpper - Case "ALTO" - yPosFromBottom = (PicSettings.Margine) - yPosFromBottom3 = (PicSettings.MargVert) - - Case "BASSO" - yPosFromBottom = CType((g.Height - crSize.Height - (g.Height * PicSettings.Margine / 100)), Single) - yPosFromBottom3 = CType((g.Height - crSize.Height - (g.Height * PicSettings.MargVert / 100)), Single) - End Select - - Dim xCenterOfImg As Single - Dim xCenterOfImg3 As Single - Dim StrFormat As StringFormat = New StringFormat - Select Case PicSettings.Allineamento.ToUpper - Case "SINISTRA" - xCenterOfImg = CType((PicSettings.Margine + (LarghezzaStandard / 2)), Single) - xCenterOfImg3 = CType((PicSettings.MargVert + (LarghezzaStandard / 2)), Single) - If (LarghezzaStandard / 2) > (g.Width / 2) - PicSettings.Margine Then - xCenterOfImg = CType((g.Width / 2), Single) - End If - If (LarghezzaStandard / 2) > (g.Width / 2) - PicSettings.MargVert Then - xCenterOfImg3 = CType((g.Width / 2), Single) - End If - - Case "CENTRO" - xCenterOfImg = CType((g.Width / 2), Single) - - Case "DESTRA" - xCenterOfImg = CType((g.Width - PicSettings.Margine - (LarghezzaStandard / 2)), Single) - xCenterOfImg3 = CType((g.Width - PicSettings.MargVert - (LarghezzaStandard / 2)), Single) - If (LarghezzaStandard / 2) > (g.Width / 2) - PicSettings.Margine Then - xCenterOfImg = CType((g.Width / 2), Single) - End If - If (LarghezzaStandard / 2) > (g.Width / 2) - PicSettings.MargVert Then - xCenterOfImg3 = CType((g.Width / 2), Single) - End If - - End Select - StrFormat.Alignment = StringAlignment.Center - - Dim semiTransBrush2 As SolidBrush = 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, PicSettings.fontColoreRGB)) - - If FotoRuotaADestra Or FotoRuotaASinistra Then - - If PicSettings.Grassetto = True Then - crFont = New Font(PicSettings.IlFont, DimVert, FontStyle.Bold) - Else - crFont = New Font(PicSettings.IlFont, DimVert) - End If - - Else - - If PicSettings.Grassetto = True Then - crFont = New Font(PicSettings.IlFont, DimensioneStandard, FontStyle.Bold) - Else - crFont = New Font(PicSettings.IlFont, DimensioneStandard) - End If - End If - - - 'qui scrive il testo (nomefilebig) - If PicSettings.TestoNome Then - If NomeData And g.PropertyIdList.Length > 0 Then - Dim DatiExif As New ExifReader(CType(g, Bitmap)) - dataFoto = DatiExif.DateTimeOriginal - - grPhoto.DrawString((nomeFileBig & " " & dataFoto.ToShortDateString), crFont, semiTransBrush2, New PointF(xCenterOfImg + 1, yPosFromBottom + 1), StrFormat) - grPhoto.DrawString((nomeFileBig & " " & dataFoto.ToShortDateString), crFont, semiTransBrush, New PointF(xCenterOfImg, yPosFromBottom), StrFormat) - Else - grPhoto.DrawString(nomeFileBig, crFont, semiTransBrush2, New PointF(xCenterOfImg + 1, yPosFromBottom + 1), StrFormat) - grPhoto.DrawString(nomeFileBig, crFont, semiTransBrush, New PointF(xCenterOfImg, yPosFromBottom), StrFormat) - - End If - End If - - If PicSettings.TestoNome = False Then - If FotoRuotaADestra Or FotoRuotaASinistra Then - If PicSettings.TestoMin = False Then - - - grPhoto.DrawString(testoFirmaV, crFont, semiTransBrush2, New PointF(xCenterOfImg + 1, yPosFromBottom3 + 1), StrFormat) - grPhoto.DrawString(testoFirmaV, crFont, semiTransBrush, New PointF(xCenterOfImg, yPosFromBottom3), StrFormat) - End If - If PicSettings.TestoMin = True Then - - grPhoto.DrawString(testoFirmaV, crFont, semiTransBrush2, New PointF(xCenterOfImg + 1, yPosFromBottom4 + 1), StrFormat) - grPhoto.DrawString(testoFirmaV, crFont, semiTransBrush, New PointF(xCenterOfImg, yPosFromBottom4), StrFormat) - - End If - Else - grPhoto.DrawString(testoFirma, crFont, semiTransBrush2, New PointF(xCenterOfImg + 1, yPosFromBottom + 1), StrFormat) - grPhoto.DrawString(testoFirma, crFont, semiTransBrush, New PointF(xCenterOfImg, yPosFromBottom), StrFormat) - - - End If - End If - - If PicSettings.DirectorySorgente.ToUpper = PicSettings.DirectoryDestinazione.ToUpper Then - nomeFileBig2 = nomeFileBig - nomeFileBig = nomeFileBig.Substring(0, nomeFileBig.Length - 4) & Codice & nomeFileBig.Substring(nomeFileBig.Length - 4) - End If - grPhoto.Dispose() - End Sub - - - - - Private Sub aggiungiLogo(imgOutputBig As Bitmap) - 'imgOutputBig - If PicSettings.LogoAggiungi = True And File.Exists(PicSettings.LogoNomeFile) Then - - Dim ImmagineLogo As Image = Image.FromFile(PicSettings.LogoNomeFile) - - Dim LogoColoreTrasparente As Color = Color.White - 'Dim bmWatermark As Bitmap - - '* Create a Bitmap based on the previously modified photograph Bitmap - 'bmWatermark = New Bitmap(imgOutputBig) - 'bmWatermark.SetResolution(imgOutputBig.HorizontalResolution, imgOutputBig.VerticalResolution) - - '* Load this Bitmap into a new Graphic Object - Dim grWatermark As Graphics = Graphics.FromImage(imgOutputBig) - - '* To achieve a translucent watermark we will apply (2) color manipulations - Dim imageAttributes As Imaging.ImageAttributes = New Imaging.ImageAttributes - - '* The first step replace the background color with one that is transparent (Alpha=0, R=0, G=0, B=0) - Dim colorMap As Imaging.ColorMap = New Imaging.ColorMap - - '* background this will be the color we search for and replace with transparency - colorMap.OldColor = LogoColoreTrasparente - colorMap.NewColor = Color.FromArgb(0, 0, 0, 0) - - Dim remapTable As Imaging.ColorMap() = {colorMap} - imageAttributes.SetRemapTable(remapTable, Imaging.ColorAdjustType.Bitmap) - - '* The second color manipulation is used to change the opacity by setting the 3rd row and 3rd column to 0.3f - Dim colorMatrixElements As Single()() = {New Single() {1.0F, 0.0F, 0.0F, 0.0F, 0.0F}, New Single() {0.0F, 1.0F, 0.0F, 0.0F, 0.0F}, New Single() {0.0F, 0.0F, 1.0F, 0.0F, 0.0F}, New Single() {0.0F, 0.0F, 0.0F, CType(PicSettings.LogoTrasparenza, Single) / 100, 0.0F}, New Single() {0.0F, 0.0F, 0.0F, 0.0F, 1.0F}} - Dim wmColorMatrix As Imaging.ColorMatrix = New Imaging.ColorMatrix(colorMatrixElements) - imageAttributes.SetColorMatrix(wmColorMatrix, Imaging.ColorMatrixFlag.Default, Imaging.ColorAdjustType.Bitmap) - - Dim FotoLogoH As Integer = PicSettings.LogoAltezza - Dim FotoLogoW As Integer = PicSettings.LogoLarghezza - Dim FattoreAlt As Double = ImmagineLogo.Height / FotoLogoH - Dim FattoreLarg As Double = ImmagineLogo.Width / FotoLogoW - Dim NuovaSize As Size - If FattoreLarg > FattoreAlt Then - NuovaSize = NewthumbSize(ImmagineLogo.Width, ImmagineLogo.Height, FotoLogoW, "Larghezza") - Else - NuovaSize = NewthumbSize(ImmagineLogo.Width, ImmagineLogo.Height, FotoLogoH, "Altezza") - End If - - Dim MargineUsato As Integer - Dim MargineL As Integer - Dim InPercentualeL As Boolean - If PicSettings.LogoMargine.EndsWith("%") = True Then - InPercentualeL = True - Else - InPercentualeL = False - End If - MargineL = CType(Val(PicSettings.LogoMargine), Integer) - If InPercentualeL = True Then - MargineUsato = CType(imgOutputBig.Height * MargineL / 100, Integer) - Else - MargineUsato = MargineL - End If - - Dim xPosOfWm As Integer - Dim yPosOfWm As Integer - Select Case PicSettings.LogoPosizioneH.ToUpper - Case "SINISTRA", "NESSUNA" - xPosOfWm = MargineUsato - - Case "CENTRO" - xPosOfWm = CType((imgOutputBig.Width - NuovaSize.Width) / 2, Integer) - - Case "DESTRA" - xPosOfWm = ((imgOutputBig.Width - NuovaSize.Width) - MargineUsato) - End Select - Select Case PicSettings.LogoPosizioneV.ToUpper - Case "ALTO", "NESSUNA" - yPosOfWm = MargineUsato - - Case "CENTRO" - yPosOfWm = CType((imgOutputBig.Height - NuovaSize.Height) / 2, Integer) - - Case "BASSO" - yPosOfWm = ((imgOutputBig.Height - NuovaSize.Height) - MargineUsato) - End Select - - grWatermark.DrawImage(ImmagineLogo, New Rectangle(xPosOfWm, yPosOfWm, NuovaSize.Width, NuovaSize.Height), 0, 0, ImmagineLogo.Width, ImmagineLogo.Height, GraphicsUnit.Pixel, imageAttributes) - grWatermark.Dispose() - End If - End Sub - - - Private Sub salvaFoto(imgOutputBig As Bitmap, thumbSizeBig As Size, NomeFileBig As String, NomeFileSmall As String, thumbSizeSmall As Size, thisFormat As ImageFormat) - - If PicSettings.FotoGrandeDimOrigina = False Then - 'attenzione non controlla se è png - 'imgOutputBig.Save(Path.Combine(_DestDir.FullName, "Temp_" & NomeFileBig), thisFormat) - If thisFormat.Equals(ImageFormat.Jpeg) Then - salvaImmagineCustomQuality(imgOutputBig, Path.Combine(DestDir.FullName, "Temp_" & NomeFileBig), jpegQuality) - Else - imgOutputBig.Save(Path.Combine(_DestDir.FullName, "Temp_" & NomeFileBig), thisFormat) - End If - - - Dim g2 As System.Drawing.Image = System.Drawing.Image.FromFile(Path.Combine(DestDir.FullName, "Temp_" & NomeFileBig)) - If g2.Width > g2.Height Then - thumbSizeBig = NewthumbSize(g2.Width, g2.Height, PicSettings.LarghezzaBig, "Larghezza") - Else - thumbSizeBig = NewthumbSize(g2.Width, g2.Height, PicSettings.AltezzaBig, "Altezza") - End If - Dim imgOutputBig2 As New Bitmap(g2, thumbSizeBig.Width, thumbSizeBig.Height) - ' - If thisFormat.Equals(ImageFormat.Jpeg) Then - salvaImmagineCustomQuality(imgOutputBig2, Path.Combine(DestDir.FullName, NomeFileBig), jpegQuality) - Else - imgOutputBig2.Save(Path.Combine(_DestDir.FullName, NomeFileBig), thisFormat) - End If - - imgOutputBig2.Dispose() - imgOutputBig.Dispose() - g2.Dispose() - Else - ' - If thisFormat.Equals(ImageFormat.Jpeg) Then - salvaImmagineCustomQuality(imgOutputBig, Path.Combine(DestDir.FullName, NomeFileBig), jpegQuality) - Else - imgOutputBig.Save(Path.Combine(_DestDir.FullName, NomeFileBig), thisFormat) - End If - - imgOutputBig.Dispose() - End If - - - If PicSettings.CreaMiniature Then - If PicSettings.AggiungiScritteMiniature = True Then - Dim g1 As System.Drawing.Image - If PicSettings.FotoGrandeDimOrigina = False Then - g1 = System.Drawing.Image.FromFile(Path.Combine(DestDir.FullName, "Temp_" & NomeFileBig)) - Else - g1 = System.Drawing.Image.FromFile(Path.Combine(DestDir.FullName, NomeFileBig)) - End If - Dim imgOutputSmall As New Bitmap(g1, thumbSizeSmall.Width, thumbSizeSmall.Height) - If PicSettings.DirectorySorgente.ToUpper = PicSettings.DirectoryDestinazione.ToUpper Then - NomeFileSmall = NomeFileSmall.Substring(0, NomeFileSmall.Length - 4) & Codice & NomeFileSmall.Substring(NomeFileSmall.Length - 4) - End If - ' - If thisFormat.Equals(ImageFormat.Jpeg) Then - salvaImmagineCustomQuality(imgOutputSmall, Path.Combine(DestDir.FullName, NomeFileSmall), jpegQualityMin) - Else - imgOutputSmall.Save(Path.Combine(_DestDir.FullName, NomeFileSmall), thisFormat) - End If - - imgOutputSmall.Dispose() - g1.Dispose() - End If - - - - End If - - If File.Exists(Path.Combine(DestDir.FullName, "Temp_" & NomeFileBig)) = True Then - Kill(Path.Combine(DestDir.FullName, "Temp_" & NomeFileBig)) - End If - - - End Sub - - Private Sub salvaImmagineCustomQuality(imageToSave As Bitmap, nomeFileFinale As String, quality As Long) - - Dim JgpEncoder As ImageCodecInfo = GetEncoder(ImageFormat.Jpeg) - Dim MyEncoder As Encoder = Encoder.Quality - - Dim MyEncoderParameters As New EncoderParameters(1) - - Dim MyEncoderParameter As New EncoderParameter(MyEncoder, jpegQuality) - MyEncoderParameters.Param(0) = MyEncoderParameter - imageToSave.Save(nomeFileFinale, JgpEncoder, MyEncoderParameters) - imageToSave.Dispose() - End Sub - - - - Private Function GetEncoder(ByVal format As ImageFormat) As ImageCodecInfo - - Dim codecs As ImageCodecInfo() = ImageCodecInfo.GetImageDecoders() - - Dim codec As ImageCodecInfo - For Each codec In codecs - If codec.FormatID = format.Guid Then - Return codec - End If - Next codec - Return Nothing - - End Function - - - - - - - ''' - ''' Calculate the Size of the New image - ''' - ''' Larghezza - ''' Altezza - ''' - ''' - ''' - ''' - Private Function NewthumbSize(ByVal currentwidth As Integer, ByVal currentheight As Integer, ByVal MaxPixel As Integer, ByVal TipoSize As String) As Size - ' e - '*** Larghezza, Altezza, Auto - - Dim tempMultiplier As Double - - If TipoSize.ToUpper = "Larghezza".ToUpper Then - tempMultiplier = MaxPixel / currentwidth - ElseIf TipoSize.ToUpper = "Altezza".ToUpper Then - tempMultiplier = MaxPixel / currentheight - Else - If currentheight > currentwidth Then ' portrait - tempMultiplier = MaxPixel / currentheight - Else - tempMultiplier = MaxPixel / currentwidth - End If - End If - - Dim NewSize As New Size(CInt(currentwidth * tempMultiplier), CInt(currentheight * tempMultiplier)) - - Return NewSize - End Function - - Public Property WorkFile() As FileInfo - Get - Return _workFile - End Get - Set(value As FileInfo) - _workFile = value - End Set - End Property - - Public Property DestDir() As DirectoryInfo - Get - Return _DestDir - End Get - Set(ByVal value As DirectoryInfo) - _DestDir = value - End Set - End Property - - Public Property SourceDir() As DirectoryInfo - Get - Return _SourceDir - End Get - Set(ByVal value As DirectoryInfo) - _SourceDir = value - End Set - End Property - - Public Property DestDirStart() As DirectoryInfo - Get - Return _DestDirStart - End Get - Set(ByVal value As DirectoryInfo) - _DestDirStart = value - End Set - End Property - - Public Property NomeFileChild() As String - Get - Return _NomeFileChild - End Get - Set(ByVal value As String) - _NomeFileChild = value - End Set - End Property - - -End Class diff --git a/MaddoShared/ImageCreationStuff.cs b/MaddoShared/ImageCreationStuff.cs index 9ab89cc..7265c49 100644 --- a/MaddoShared/ImageCreationStuff.cs +++ b/MaddoShared/ImageCreationStuff.cs @@ -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; diff --git a/MaddoShared/ImageCreatorSharp.cs b/MaddoShared/ImageCreatorSharp.cs index acf7f1a..a981cd9 100644 --- a/MaddoShared/ImageCreatorSharp.cs +++ b/MaddoShared/ImageCreatorSharp.cs @@ -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 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 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); diff --git a/MaddoShared/MaddoShared.csproj b/MaddoShared/MaddoShared.csproj index 6b51269..ea64893 100644 --- a/MaddoShared/MaddoShared.csproj +++ b/MaddoShared/MaddoShared.csproj @@ -7,9 +7,6 @@ true x64 - - - diff --git a/MaddoShared/Orientations.cs b/MaddoShared/Orientations.cs new file mode 100644 index 0000000..bacac8f --- /dev/null +++ b/MaddoShared/Orientations.cs @@ -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, +} \ No newline at end of file diff --git a/MaddoShared/PicSettings.cs b/MaddoShared/PicSettings.cs new file mode 100644 index 0000000..c5784d0 --- /dev/null +++ b/MaddoShared/PicSettings.cs @@ -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; +} \ No newline at end of file diff --git a/imagecatalog/ImageCatalog 2.csproj b/imagecatalog/ImageCatalog 2.csproj index 635f432..8c7a134 100644 --- a/imagecatalog/ImageCatalog 2.csproj +++ b/imagecatalog/ImageCatalog 2.csproj @@ -36,7 +36,6 @@ - diff --git a/imagecatalog/MainForm.cs b/imagecatalog/MainForm.cs index d259b08..4f73caf 100644 --- a/imagecatalog/MainForm.cs +++ b/imagecatalog/MainForm.cs @@ -12,7 +12,6 @@ using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; -using CatalogVbLib; using ImageCatalog_2; using ImageCatalog_2.Services; using MaddoShared; @@ -636,7 +635,7 @@ public partial class MainForm PicSettings.Margine = int.Parse(TextBox12.Text); PicSettings.LogoAltezza = int.Parse(TextBox14.Text); PicSettings.LogoLarghezza = int.Parse(TextBox15.Text); - PicSettings.fontColoreRGB = ColorTranslator.FromHtml(TextBox34.Text); + PicSettings.FontColoreRGB = ColorTranslator.FromHtml(TextBox34.Text); PicSettings.LogoAggiungi = CheckBox5.Checked; PicSettings.LogoNomeFile = TextBox10.Text; PicSettings.LogoTrasparenza = TextBox19.Text; @@ -648,9 +647,8 @@ public partial class MainForm PicSettings.LarghezzaBig = int.Parse(TextBox28.Text); PicSettings.DimMin = int.Parse(TextBox25.Text); PicSettings.TestoMin = RadioButton6.Checked; - PicSettings.jpegQuality = int.Parse(TextBox32.Text); - PicSettings.jpegQualityMin = int.Parse(TextBox33.Text); - PicSettings.mainForm = this; + PicSettings.JpegQuality = int.Parse(TextBox32.Text); + PicSettings.JpegQualityMin = int.Parse(TextBox33.Text); } private List> makeFilesList(string SourcePath) diff --git a/imagecatalog/PicSettings.cs b/imagecatalog/PicSettings.cs deleted file mode 100644 index 08d52f9..0000000 --- a/imagecatalog/PicSettings.cs +++ /dev/null @@ -1,602 +0,0 @@ - - -// Module PicSettings - -// Private _DirectorySorgente As String -// Private _DirectoryDestinazione As String - -// Private _DimVert As Integer -// Private _MargVert As Integer - - -// Private _DimStandard As Integer -// Private _DimStandardMiniatura As Integer - -// Private _NomeData As Boolean -// Private _TestoNome As Boolean -// Private _UsaOrarioMiniatura As Boolean -// Private _UsaOrarioTestoApplicare As Boolean -// Private _UsaTempoGaraTestoApplicare As Boolean -// Private _TestoFirmaStart As String -// Private _TestoFirmaStartV As String -// Private _DataPartenza As DateTime -// Private _TestoOrario As String - -// Private _UsaRotazioneAutomatica As Boolean -// Private _UsaForzaJpg As Boolean - -// Private _LarghezzaSmall As Integer -// Private _AltezzaSmall As Integer - -// Private _CreaMiniature As Boolean -// Private _AggiungiScritteMiniature As Boolean -// Private _AggTempoGaraMin As Boolean -// Private _AggNumTempMin As Boolean - -// Private _Suffisso As String -// Private _Codice As String - -// Private _Trasparenza As Integer -// Private _IlFont As String -// Private _Grassetto As Boolean - -// Private _Posizione As String -// Private _Allineamento As String -// Private _Margine As Integer - -// Private _LogoAltezza As Integer -// Private _LogoLarghezza As Integer - -// Private _fontColoreRGB As Color - -// Private _LogoAggiungi As Boolean -// Private _LogoNomeFile As String -// Private _LogoTrasparenza As String -// Private _LogoMargine As String -// Private _LogoPosizioneH As String -// Private _LogoPosizioneV As String - -// Private _FotoGrandeDimOrigina As Boolean -// Private _AltezzaBig As Integer -// Private _LarghezzaBig As Integer -// Private _DestDir As DirectoryInfo -// Private _DimMin As Integer - -// Private _TestoMin As Boolean - -// Private _SecretDefault As Boolean -// Private _SecretBig As Boolean -// Private _SecretSmall As Boolean - -// Private _SecretPathSmall As String -// Private _SecretPathBig As String - -// Private _jpegQuality As Long -// Private _jpegQualityMin As Long - -// Private FotoRuotaADestra As Boolean = False -// Private FotoRuotaASinistra As Boolean = False - -// Private TempMinText As String = "" - -// Private _mainForm As MainForm - -// 'Private progressBar As System.Windows.Forms.ProgressBar - - - -// Public Property mainForm() As MainForm -// Get -// Return _mainForm -// End Get -// Set(ByVal value As MainForm) -// _mainForm = value -// End Set -// End Property - -// Public Property DirectorySorgente() As String -// Get -// Return _DirectorySorgente -// End Get -// Set(ByVal value As String) -// _DirectorySorgente = value -// End Set -// End Property - -// Public Property DirectoryDestinazione() As String -// Get -// Return _DirectoryDestinazione -// End Get -// Set(ByVal value As String) -// _DirectoryDestinazione = value -// End Set -// End Property - -// Public Property TestoFirmaStart() As String -// Get -// Return _TestoFirmaStart -// End Get -// Set(ByVal value As String) -// _TestoFirmaStart = value -// End Set -// End Property - -// Public Property TestoFirmaStartV() As String -// Get -// Return _TestoFirmaStartV -// End Get - -// Set(ByVal value As String) -// _TestoFirmaStartV = value -// End Set -// End Property - -// Public Property DataPartenza() As DateTime -// Get -// Return _DataPartenza -// End Get -// Set(ByVal value As DateTime) -// _DataPartenza = value -// End Set -// End Property - -// Public Property TestoOrario() As String -// Get -// Return _TestoOrario -// End Get -// Set(ByVal value As String) -// _TestoOrario = value -// End Set -// End Property - -// Public Property DimStandard() As Integer -// Get -// Return _DimStandard -// End Get -// Set(ByVal value As Integer) -// _DimStandard = value -// End Set -// End Property - -// Public Property DimStandardMiniatura() As Integer -// Get -// Return _DimStandardMiniatura -// End Get -// Set(ByVal value As Integer) -// _DimStandardMiniatura = value -// End Set -// End Property - -// Public Property NomeData() As Boolean -// Get -// Return _NomeData -// End Get -// Set(ByVal value As Boolean) -// _NomeData = value -// End Set -// End Property - -// Public Property TestoNome() As Boolean -// Get -// Return _TestoNome -// End Get -// Set(ByVal value As Boolean) -// _TestoNome = value -// End Set -// End Property - -// Public Property UsaOrarioMiniatura() As Boolean -// Get -// Return _UsaOrarioMiniatura -// End Get -// Set(ByVal value As Boolean) -// _UsaOrarioMiniatura = value -// End Set -// End Property - -// Public Property UsaOrarioTestoApplicare() As Boolean -// Get -// Return _UsaOrarioTestoApplicare -// End Get -// Set(ByVal value As Boolean) -// _UsaOrarioTestoApplicare = value -// End Set -// End Property - -// Public Property UsaTempoGaraTestoApplicare() As Boolean -// Get -// Return _UsaTempoGaraTestoApplicare -// End Get -// Set(ByVal value As Boolean) -// _UsaTempoGaraTestoApplicare = value -// End Set -// End Property - -// Public Property UsaRotazioneAutomatica() As Boolean -// Get -// Return _UsaRotazioneAutomatica -// End Get -// Set(ByVal value As Boolean) -// _UsaRotazioneAutomatica = value -// End Set -// End Property - -// Public Property UsaForzaJpg() As Boolean -// Get -// Return _UsaForzaJpg -// End Get -// Set(ByVal value As Boolean) -// _UsaForzaJpg = value -// End Set -// End Property - - - -// Public Property LarghezzaSmall() As Integer -// Get -// Return _LarghezzaSmall -// End Get -// Set(ByVal value As Integer) -// _LarghezzaSmall = value -// End Set -// End Property - -// Public Property AltezzaSmall() As Integer -// Get -// Return _AltezzaSmall -// End Get -// Set(ByVal value As Integer) -// _AltezzaSmall = value -// End Set -// End Property - - -// Public Property CreaMiniature() As Boolean -// Get -// Return _CreaMiniature -// End Get -// Set(ByVal value As Boolean) -// _CreaMiniature = value -// End Set -// End Property - -// Public Property AggiungiScritteMiniature() As Boolean -// Get -// Return _AggiungiScritteMiniature -// End Get -// Set(ByVal value As Boolean) -// _AggiungiScritteMiniature = value -// End Set -// End Property - - -// Public Property Suffisso() As String -// Get -// Return _Suffisso -// End Get -// Set(ByVal value As String) -// _Suffisso = value -// End Set -// End Property - -// Public Property Codice() As String -// Get -// Return _Codice -// End Get -// Set(ByVal value As String) -// _Codice = value -// End Set -// End Property - - -// Public Property Trasparenza() As Integer -// Get -// Return _Trasparenza -// End Get -// Set(ByVal value As Integer) -// _Trasparenza = value -// End Set -// End Property - -// Public Property IlFont() As String -// Get -// Return _IlFont -// End Get -// Set(ByVal value As String) -// _IlFont = value -// End Set -// End Property - -// Public Property Grassetto() As Boolean -// Get -// Return _Grassetto -// End Get -// Set(ByVal value As Boolean) -// _Grassetto = value -// End Set -// End Property - -// Public Property Posizione() As String -// Get -// Return _Posizione -// End Get -// Set(ByVal value As String) -// _Posizione = value -// End Set -// End Property - -// Public Property Allineamento() As String -// Get -// Return _Allineamento -// End Get -// Set(ByVal value As String) -// _Allineamento = value -// End Set -// End Property - -// Public Property Margine() As Integer -// Get -// Return _Margine -// End Get -// Set(ByVal value As Integer) -// _Margine = value -// End Set -// End Property - -// Public Property LogoAltezza() As Integer -// Get -// Return _LogoAltezza -// End Get -// Set(ByVal value As Integer) -// _LogoAltezza = value -// End Set -// End Property - -// Public Property LogoLarghezza() As Integer -// Get -// Return _LogoLarghezza -// End Get -// Set(ByVal value As Integer) -// _LogoLarghezza = value -// End Set -// End Property - -// Public Property fontColoreRGB() As Color -// Get -// Return _fontColoreRGB -// End Get -// Set(ByVal value As Color) -// _fontColoreRGB = value -// End Set -// End Property - -// Public Property LogoAggiungi() As Boolean -// Get -// Return _LogoAggiungi -// End Get -// Set(ByVal value As Boolean) -// _LogoAggiungi = value -// End Set -// End Property - -// Public Property LogoNomeFile() As String -// Get -// Return _LogoNomeFile -// End Get -// Set(ByVal value As String) -// _LogoNomeFile = value -// End Set -// End Property - -// Public Property LogoTrasparenza() As String -// Get -// Return _LogoTrasparenza -// End Get -// Set(ByVal value As String) -// _LogoTrasparenza = value -// End Set -// End Property - -// Public Property LogoMargine() As String -// Get -// Return _LogoMargine -// End Get -// Set(ByVal value As String) -// _LogoMargine = value -// End Set -// End Property - -// Public Property LogoPosizioneH() As String -// Get -// Return _LogoPosizioneH -// End Get -// Set(ByVal value As String) -// _LogoPosizioneH = value -// End Set -// End Property - -// Public Property LogoPosizioneV() As String -// Get -// Return _LogoPosizioneV -// End Get -// Set(ByVal value As String) -// _LogoPosizioneV = value -// End Set -// End Property - -// Public Property FotoGrandeDimOrigina() As Boolean -// Get -// Return _FotoGrandeDimOrigina -// End Get -// Set(ByVal value As Boolean) -// _FotoGrandeDimOrigina = value -// End Set -// End Property - -// Public Property AltezzaBig() As Integer -// Get -// Return _AltezzaBig -// End Get -// Set(ByVal value As Integer) -// _AltezzaBig = value -// End Set -// End Property - -// Public Property LarghezzaBig() As Integer -// Get -// Return _LarghezzaBig -// End Get -// Set(ByVal value As Integer) -// _LarghezzaBig = value -// End Set -// End Property - -// Public Property DestDir() As DirectoryInfo -// Get -// Return _DestDir -// End Get -// Set(ByVal value As DirectoryInfo) -// _DestDir = value -// End Set -// End Property - -// Public Property DimVert() As Integer -// Get -// Return _DimVert - -// End Get -// Set(ByVal value As Integer) -// _DimVert = value - -// End Set -// End Property - -// Public Property MargVert() As Integer -// Get -// Return _MargVert - -// End Get -// Set(ByVal value As Integer) -// _MargVert = value -// End Set -// End Property - -// Public Property TestoMin() As Boolean -// Get -// Return _TestoMin - -// End Get -// Set(ByVal value As Boolean) -// _TestoMin = value - -// End Set -// End Property - -// Public Property DimMin() As Integer -// Get -// Return _DimMin - -// End Get -// Set(ByVal value As Integer) -// _DimMin = value - -// End Set -// End Property - -// Public Property SecretDefault() As Boolean -// Get -// Return _SecretDefault - -// End Get -// Set(ByVal value As Boolean) -// _SecretDefault = value - -// End Set -// End Property - -// Public Property SecretBig() As Boolean -// Get -// Return _SecretBig - -// End Get -// Set(ByVal value As Boolean) -// _SecretBig = value - -// End Set -// End Property - -// Public Property SecretSmall() As Boolean -// Get -// Return _SecretSmall - -// End Get -// Set(ByVal value As Boolean) -// _SecretSmall = value - -// End Set -// End Property - -// Public Property SecretPathSmall() As String -// Get -// Return _SecretPathSmall - -// End Get -// Set(ByVal value As String) -// _SecretPathSmall = value - -// End Set -// End Property - -// Public Property SecretPathBig() As String -// Get -// Return _SecretPathBig - -// End Get -// Set(ByVal value As String) -// _SecretPathBig = value - -// End Set -// End Property - -// Public Property AggTempoGaraMin() As Boolean -// Get -// Return _AggTempoGaraMin - -// End Get -// Set(ByVal value As Boolean) -// _AggTempoGaraMin = value - -// End Set -// End Property - -// Public Property AggNumTempMin() As Boolean -// Get -// Return _AggNumTempMin - -// End Get -// Set(ByVal value As Boolean) -// _AggNumTempMin = value - -// End Set -// End Property - -// Public Property jpegQuality() As Long -// Get -// Return _jpegQuality -// End Get -// Set(ByVal value As Long) -// _jpegQuality = value -// End Set - -// End Property - -// Public Property jpegQualityMin() As Long -// Get -// Return _jpegQualityMin -// End Get -// Set(ByVal value As Long) -// _jpegQualityMin = value -// End Set - -// End Property -// End Module diff --git a/imagecatalog/PicSettings.vb b/imagecatalog/PicSettings.vb deleted file mode 100644 index b82a77d..0000000 --- a/imagecatalog/PicSettings.vb +++ /dev/null @@ -1,604 +0,0 @@ -Imports System.IO -Imports System.Drawing.Drawing2D -Imports System.Drawing.Imaging - -'Module PicSettings - -' Private _DirectorySorgente As String -' Private _DirectoryDestinazione As String - -' Private _DimVert As Integer -' Private _MargVert As Integer - - -' Private _DimStandard As Integer -' Private _DimStandardMiniatura As Integer - -' Private _NomeData As Boolean -' Private _TestoNome As Boolean -' Private _UsaOrarioMiniatura As Boolean -' Private _UsaOrarioTestoApplicare As Boolean -' Private _UsaTempoGaraTestoApplicare As Boolean -' Private _TestoFirmaStart As String -' Private _TestoFirmaStartV As String -' Private _DataPartenza As DateTime -' Private _TestoOrario As String - -' Private _UsaRotazioneAutomatica As Boolean -' Private _UsaForzaJpg As Boolean - -' Private _LarghezzaSmall As Integer -' Private _AltezzaSmall As Integer - -' Private _CreaMiniature As Boolean -' Private _AggiungiScritteMiniature As Boolean -' Private _AggTempoGaraMin As Boolean -' Private _AggNumTempMin As Boolean - -' Private _Suffisso As String -' Private _Codice As String - -' Private _Trasparenza As Integer -' Private _IlFont As String -' Private _Grassetto As Boolean - -' Private _Posizione As String -' Private _Allineamento As String -' Private _Margine As Integer - -' Private _LogoAltezza As Integer -' Private _LogoLarghezza As Integer - -' Private _fontColoreRGB As Color - -' Private _LogoAggiungi As Boolean -' Private _LogoNomeFile As String -' Private _LogoTrasparenza As String -' Private _LogoMargine As String -' Private _LogoPosizioneH As String -' Private _LogoPosizioneV As String - -' Private _FotoGrandeDimOrigina As Boolean -' Private _AltezzaBig As Integer -' Private _LarghezzaBig As Integer -' Private _DestDir As DirectoryInfo -' Private _DimMin As Integer - -' Private _TestoMin As Boolean - -' Private _SecretDefault As Boolean -' Private _SecretBig As Boolean -' Private _SecretSmall As Boolean - -' Private _SecretPathSmall As String -' Private _SecretPathBig As String - -' Private _jpegQuality As Long -' Private _jpegQualityMin As Long - -' Private FotoRuotaADestra As Boolean = False -' Private FotoRuotaASinistra As Boolean = False - -' Private TempMinText As String = "" - -' Private _mainForm As MainForm - -' 'Private progressBar As System.Windows.Forms.ProgressBar - - - -' Public Property mainForm() As MainForm -' Get -' Return _mainForm -' End Get -' Set(ByVal value As MainForm) -' _mainForm = value -' End Set -' End Property - -' Public Property DirectorySorgente() As String -' Get -' Return _DirectorySorgente -' End Get -' Set(ByVal value As String) -' _DirectorySorgente = value -' End Set -' End Property - -' Public Property DirectoryDestinazione() As String -' Get -' Return _DirectoryDestinazione -' End Get -' Set(ByVal value As String) -' _DirectoryDestinazione = value -' End Set -' End Property - -' Public Property TestoFirmaStart() As String -' Get -' Return _TestoFirmaStart -' End Get -' Set(ByVal value As String) -' _TestoFirmaStart = value -' End Set -' End Property - -' Public Property TestoFirmaStartV() As String -' Get -' Return _TestoFirmaStartV -' End Get - -' Set(ByVal value As String) -' _TestoFirmaStartV = value -' End Set -' End Property - -' Public Property DataPartenza() As DateTime -' Get -' Return _DataPartenza -' End Get -' Set(ByVal value As DateTime) -' _DataPartenza = value -' End Set -' End Property - -' Public Property TestoOrario() As String -' Get -' Return _TestoOrario -' End Get -' Set(ByVal value As String) -' _TestoOrario = value -' End Set -' End Property - -' Public Property DimStandard() As Integer -' Get -' Return _DimStandard -' End Get -' Set(ByVal value As Integer) -' _DimStandard = value -' End Set -' End Property - -' Public Property DimStandardMiniatura() As Integer -' Get -' Return _DimStandardMiniatura -' End Get -' Set(ByVal value As Integer) -' _DimStandardMiniatura = value -' End Set -' End Property - -' Public Property NomeData() As Boolean -' Get -' Return _NomeData -' End Get -' Set(ByVal value As Boolean) -' _NomeData = value -' End Set -' End Property - -' Public Property TestoNome() As Boolean -' Get -' Return _TestoNome -' End Get -' Set(ByVal value As Boolean) -' _TestoNome = value -' End Set -' End Property - -' Public Property UsaOrarioMiniatura() As Boolean -' Get -' Return _UsaOrarioMiniatura -' End Get -' Set(ByVal value As Boolean) -' _UsaOrarioMiniatura = value -' End Set -' End Property - -' Public Property UsaOrarioTestoApplicare() As Boolean -' Get -' Return _UsaOrarioTestoApplicare -' End Get -' Set(ByVal value As Boolean) -' _UsaOrarioTestoApplicare = value -' End Set -' End Property - -' Public Property UsaTempoGaraTestoApplicare() As Boolean -' Get -' Return _UsaTempoGaraTestoApplicare -' End Get -' Set(ByVal value As Boolean) -' _UsaTempoGaraTestoApplicare = value -' End Set -' End Property - -' Public Property UsaRotazioneAutomatica() As Boolean -' Get -' Return _UsaRotazioneAutomatica -' End Get -' Set(ByVal value As Boolean) -' _UsaRotazioneAutomatica = value -' End Set -' End Property - -' Public Property UsaForzaJpg() As Boolean -' Get -' Return _UsaForzaJpg -' End Get -' Set(ByVal value As Boolean) -' _UsaForzaJpg = value -' End Set -' End Property - - - -' Public Property LarghezzaSmall() As Integer -' Get -' Return _LarghezzaSmall -' End Get -' Set(ByVal value As Integer) -' _LarghezzaSmall = value -' End Set -' End Property - -' Public Property AltezzaSmall() As Integer -' Get -' Return _AltezzaSmall -' End Get -' Set(ByVal value As Integer) -' _AltezzaSmall = value -' End Set -' End Property - - -' Public Property CreaMiniature() As Boolean -' Get -' Return _CreaMiniature -' End Get -' Set(ByVal value As Boolean) -' _CreaMiniature = value -' End Set -' End Property - -' Public Property AggiungiScritteMiniature() As Boolean -' Get -' Return _AggiungiScritteMiniature -' End Get -' Set(ByVal value As Boolean) -' _AggiungiScritteMiniature = value -' End Set -' End Property - - -' Public Property Suffisso() As String -' Get -' Return _Suffisso -' End Get -' Set(ByVal value As String) -' _Suffisso = value -' End Set -' End Property - -' Public Property Codice() As String -' Get -' Return _Codice -' End Get -' Set(ByVal value As String) -' _Codice = value -' End Set -' End Property - - -' Public Property Trasparenza() As Integer -' Get -' Return _Trasparenza -' End Get -' Set(ByVal value As Integer) -' _Trasparenza = value -' End Set -' End Property - -' Public Property IlFont() As String -' Get -' Return _IlFont -' End Get -' Set(ByVal value As String) -' _IlFont = value -' End Set -' End Property - -' Public Property Grassetto() As Boolean -' Get -' Return _Grassetto -' End Get -' Set(ByVal value As Boolean) -' _Grassetto = value -' End Set -' End Property - -' Public Property Posizione() As String -' Get -' Return _Posizione -' End Get -' Set(ByVal value As String) -' _Posizione = value -' End Set -' End Property - -' Public Property Allineamento() As String -' Get -' Return _Allineamento -' End Get -' Set(ByVal value As String) -' _Allineamento = value -' End Set -' End Property - -' Public Property Margine() As Integer -' Get -' Return _Margine -' End Get -' Set(ByVal value As Integer) -' _Margine = value -' End Set -' End Property - -' Public Property LogoAltezza() As Integer -' Get -' Return _LogoAltezza -' End Get -' Set(ByVal value As Integer) -' _LogoAltezza = value -' End Set -' End Property - -' Public Property LogoLarghezza() As Integer -' Get -' Return _LogoLarghezza -' End Get -' Set(ByVal value As Integer) -' _LogoLarghezza = value -' End Set -' End Property - -' Public Property fontColoreRGB() As Color -' Get -' Return _fontColoreRGB -' End Get -' Set(ByVal value As Color) -' _fontColoreRGB = value -' End Set -' End Property - -' Public Property LogoAggiungi() As Boolean -' Get -' Return _LogoAggiungi -' End Get -' Set(ByVal value As Boolean) -' _LogoAggiungi = value -' End Set -' End Property - -' Public Property LogoNomeFile() As String -' Get -' Return _LogoNomeFile -' End Get -' Set(ByVal value As String) -' _LogoNomeFile = value -' End Set -' End Property - -' Public Property LogoTrasparenza() As String -' Get -' Return _LogoTrasparenza -' End Get -' Set(ByVal value As String) -' _LogoTrasparenza = value -' End Set -' End Property - -' Public Property LogoMargine() As String -' Get -' Return _LogoMargine -' End Get -' Set(ByVal value As String) -' _LogoMargine = value -' End Set -' End Property - -' Public Property LogoPosizioneH() As String -' Get -' Return _LogoPosizioneH -' End Get -' Set(ByVal value As String) -' _LogoPosizioneH = value -' End Set -' End Property - -' Public Property LogoPosizioneV() As String -' Get -' Return _LogoPosizioneV -' End Get -' Set(ByVal value As String) -' _LogoPosizioneV = value -' End Set -' End Property - -' Public Property FotoGrandeDimOrigina() As Boolean -' Get -' Return _FotoGrandeDimOrigina -' End Get -' Set(ByVal value As Boolean) -' _FotoGrandeDimOrigina = value -' End Set -' End Property - -' Public Property AltezzaBig() As Integer -' Get -' Return _AltezzaBig -' End Get -' Set(ByVal value As Integer) -' _AltezzaBig = value -' End Set -' End Property - -' Public Property LarghezzaBig() As Integer -' Get -' Return _LarghezzaBig -' End Get -' Set(ByVal value As Integer) -' _LarghezzaBig = value -' End Set -' End Property - -' Public Property DestDir() As DirectoryInfo -' Get -' Return _DestDir -' End Get -' Set(ByVal value As DirectoryInfo) -' _DestDir = value -' End Set -' End Property - -' Public Property DimVert() As Integer -' Get -' Return _DimVert - -' End Get -' Set(ByVal value As Integer) -' _DimVert = value - -' End Set -' End Property - -' Public Property MargVert() As Integer -' Get -' Return _MargVert - -' End Get -' Set(ByVal value As Integer) -' _MargVert = value -' End Set -' End Property - -' Public Property TestoMin() As Boolean -' Get -' Return _TestoMin - -' End Get -' Set(ByVal value As Boolean) -' _TestoMin = value - -' End Set -' End Property - -' Public Property DimMin() As Integer -' Get -' Return _DimMin - -' End Get -' Set(ByVal value As Integer) -' _DimMin = value - -' End Set -' End Property - -' Public Property SecretDefault() As Boolean -' Get -' Return _SecretDefault - -' End Get -' Set(ByVal value As Boolean) -' _SecretDefault = value - -' End Set -' End Property - -' Public Property SecretBig() As Boolean -' Get -' Return _SecretBig - -' End Get -' Set(ByVal value As Boolean) -' _SecretBig = value - -' End Set -' End Property - -' Public Property SecretSmall() As Boolean -' Get -' Return _SecretSmall - -' End Get -' Set(ByVal value As Boolean) -' _SecretSmall = value - -' End Set -' End Property - -' Public Property SecretPathSmall() As String -' Get -' Return _SecretPathSmall - -' End Get -' Set(ByVal value As String) -' _SecretPathSmall = value - -' End Set -' End Property - -' Public Property SecretPathBig() As String -' Get -' Return _SecretPathBig - -' End Get -' Set(ByVal value As String) -' _SecretPathBig = value - -' End Set -' End Property - -' Public Property AggTempoGaraMin() As Boolean -' Get -' Return _AggTempoGaraMin - -' End Get -' Set(ByVal value As Boolean) -' _AggTempoGaraMin = value - -' End Set -' End Property - -' Public Property AggNumTempMin() As Boolean -' Get -' Return _AggNumTempMin - -' End Get -' Set(ByVal value As Boolean) -' _AggNumTempMin = value - -' End Set -' End Property - -' Public Property jpegQuality() As Long -' Get -' Return _jpegQuality -' End Get -' Set(ByVal value As Long) -' _jpegQuality = value -' End Set - -' End Property - -' Public Property jpegQualityMin() As Long -' Get -' Return _jpegQualityMin -' End Get -' Set(ByVal value As Long) -' _jpegQualityMin = value -' End Set - -' End Property -'End Module -- 2.52.0 From 4ceb46d65c007259477a4b5818537b943e25d2be Mon Sep 17 00:00:00 2001 From: Marco Date: Mon, 28 Jul 2025 10:01:27 +0200 Subject: [PATCH 022/127] Removed visual basic lib from project --- MaddoShared/ImageCreatorSharp.cs | 2 -- imagecatalog/ImageCatalog 2.csproj | 1 - 2 files changed, 3 deletions(-) diff --git a/MaddoShared/ImageCreatorSharp.cs b/MaddoShared/ImageCreatorSharp.cs index a981cd9..5c30a4b 100644 --- a/MaddoShared/ImageCreatorSharp.cs +++ b/MaddoShared/ImageCreatorSharp.cs @@ -183,8 +183,6 @@ public class ImageCreatorSharp : IDisposable { if (g.PropertyIdList.Length > 0) { - - //ExifReader DatiExif = new ExifReader((Bitmap)g); switch (_orientation /*DatiExif.Orientation*/) diff --git a/imagecatalog/ImageCatalog 2.csproj b/imagecatalog/ImageCatalog 2.csproj index 8c7a134..841593c 100644 --- a/imagecatalog/ImageCatalog 2.csproj +++ b/imagecatalog/ImageCatalog 2.csproj @@ -42,7 +42,6 @@ - all -- 2.52.0 From 63aac7f911d97ffd492015ad534ad6a1d30d1400 Mon Sep 17 00:00:00 2001 From: Marco Date: Mon, 28 Jul 2025 10:22:08 +0200 Subject: [PATCH 023/127] modernized picsettings --- MaddoShared/ImageCreationStuff.cs | 8 +- MaddoShared/ImageCreatorSharp.cs | 221 ++++---- MaddoShared/PicSettings.cs | 114 ++--- imagecatalog/MainForm.cs | 802 +++--------------------------- imagecatalog/Program.cs | 1 + 5 files changed, 237 insertions(+), 909 deletions(-) diff --git a/MaddoShared/ImageCreationStuff.cs b/MaddoShared/ImageCreationStuff.cs index 7265c49..22276a8 100644 --- a/MaddoShared/ImageCreationStuff.cs +++ b/MaddoShared/ImageCreationStuff.cs @@ -13,7 +13,7 @@ using Microsoft.Extensions.Logging; namespace MaddoShared { - public class ImageCreationStuff(ILogger logger) + public class ImageCreationStuff(ILogger logger, PicSettings picSettings) { public class Options { @@ -62,9 +62,9 @@ namespace MaddoShared Bitmap logoBmp = null; // 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 processFile = async fileData => @@ -72,7 +72,7 @@ namespace MaddoShared using var logoCopy = logoBmp.Clone(new Rectangle(0, 0, logoBmp.Width, logoBmp.Height), logoBmp.PixelFormat); - using var imgCreator = new ImageCreatorSharp(fileData.File, fileData.Directory); + using var imgCreator = new ImageCreatorSharp(fileData.File, fileData.Directory, picSettings); await imgCreator.CreaImmagineThread(fileData.File.Name, logoCopy); results.Add(fileData.File.Name); diff --git a/MaddoShared/ImageCreatorSharp.cs b/MaddoShared/ImageCreatorSharp.cs index 5c30a4b..ef78f98 100644 --- a/MaddoShared/ImageCreatorSharp.cs +++ b/MaddoShared/ImageCreatorSharp.cs @@ -58,6 +58,8 @@ public class ImageCreatorSharp : IDisposable private Orientations _orientation; private DateTime? _creationDate; + private readonly PicSettings _picSettings; + public ImageCreatorSharp() { } @@ -77,8 +79,9 @@ public class ImageCreatorSharp : IDisposable this.DestDir = destDir; } - public ImageCreatorSharp(FileInfo file, DirectoryInfo destination) + public ImageCreatorSharp(FileInfo file, DirectoryInfo destination, PicSettings picSettings) { + _picSettings = picSettings; this.WorkFile = file; this.DestDir = destination; } @@ -104,7 +107,7 @@ public class ImageCreatorSharp : IDisposable // Forza jpeg se è selezionata l'opzione System.Drawing.Imaging.ImageFormat thisFormat = g.RawFormat; - if (PicSettings.UsaForzaJpg == true) + if (_picSettings.UsaForzaJpg == true) thisFormat = System.Drawing.Imaging.ImageFormat.Jpeg; prepareThumbnailSize(g); @@ -128,7 +131,7 @@ public class ImageCreatorSharp : IDisposable //GC.Collect(); } - // PicSettings.mainForm.stepProgressBar() + // _picSettings.mainForm.stepProgressBar() catch (Exception ex) { @@ -179,7 +182,7 @@ public class ImageCreatorSharp : IDisposable FotoRuotaADestra = false; FotoRuotaASinistra = false; - if (PicSettings.UsaRotazioneAutomatica == true) + if (_picSettings.UsaRotazioneAutomatica == true) { if (g.PropertyIdList.Length > 0) { @@ -215,24 +218,24 @@ public class ImageCreatorSharp : IDisposable /// ''' 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) { //ExifReader DatiExif = new ExifReader((Bitmap)g); dataFoto = _creationDate ?? DateTime.Now; //DatiExif.DateTimeOriginal; - testoFirma = PicSettings.TestoFirmaStart; - testoFirmaV = PicSettings.TestoFirmaStartV; + testoFirma = _picSettings.TestoFirmaStart; + testoFirmaV = _picSettings.TestoFirmaStartV; if (dataFoto.Year != 1) { testoFirmaPiccola = dataFoto.ToShortTimeString(); - if (PicSettings.UsaOrarioTestoApplicare == true) + if (_picSettings.UsaOrarioTestoApplicare == true) { testoFirma += " " + dataFoto.ToShortDateString() + " " + dataFoto.ToLongTimeString(); testoFirmaV += " " + dataFoto.ToShortDateString() + " " + dataFoto.ToLongTimeString(); } - if (PicSettings.UsaTempoGaraTestoApplicare == true) + if (_picSettings.UsaTempoGaraTestoApplicare == true) { var diff = dataPartenzaI - dataFoto; @@ -247,8 +250,8 @@ public class ImageCreatorSharp : IDisposable } else { - testoFirma = PicSettings.TestoFirmaStart; - testoFirmaV = PicSettings.TestoFirmaStartV; + testoFirma = _picSettings.TestoFirmaStart; + testoFirmaV = _picSettings.TestoFirmaStartV; } } @@ -258,11 +261,11 @@ public class ImageCreatorSharp : IDisposable /// ''' private void preparaVariabili() { - alphaScelta = System.Convert.ToInt32((255 * (100 - PicSettings.Trasparenza) / (double)100)); + alphaScelta = System.Convert.ToInt32((255 * (100 - _picSettings.Trasparenza) / (double)100)); testoFirma = ""; testoFirmaV = ""; - dataPartenzaI = PicSettings.DataPartenza; - testoOrario = PicSettings.TestoOrario; + dataPartenzaI = _picSettings.DataPartenza; + testoOrario = _picSettings.TestoOrario; if (testoOrario.Length > 0) testoOrario += " "; testoFirmaPiccola = ""; @@ -271,11 +274,11 @@ public class ImageCreatorSharp : IDisposable nomeFileSmall = ""; nomeFileBig2 = ""; nomeFileBig = ""; - DimensioneStandard = PicSettings.DimStandard; - DimensioneStandardMiniatura = PicSettings.DimStandardMiniatura; + DimensioneStandard = _picSettings.DimStandard; + DimensioneStandardMiniatura = _picSettings.DimStandardMiniatura; // nomeFileSmall = Suffisso & NomeFileChild // nomeFileBig = NomeFileChild - nomeFileSmall = PicSettings.Suffisso + WorkFile.Name; + nomeFileSmall = _picSettings.Suffisso + WorkFile.Name; nomeFileBig = WorkFile.Name; } @@ -283,13 +286,13 @@ public class ImageCreatorSharp : IDisposable { 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); thumbSizeBig = SizeOrig; } 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); thumbSizeBig = SizeOrig; } @@ -297,9 +300,9 @@ public class ImageCreatorSharp : IDisposable private void creaMiniature(Image g, Bitmap imgOutputBig, ImageFormat thisFormat) { - if (PicSettings.TestoMin) + if (_picSettings.TestoMin) testoFirmaPiccola = nomeFileBig; - else if (PicSettings.AggNumTempMin) + else if (_picSettings.AggNumTempMin) testoFirmaPiccola = nomeFileBig + " "; // Dim yPosFromBottom4 As Single @@ -308,13 +311,13 @@ public class ImageCreatorSharp : IDisposable SizeF crSize1 = 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)) - nomeFileSmall = nomeFileSmall.Substring(0, nomeFileSmall.Length - 4) + PicSettings.Codice + nomeFileSmall.Substring(nomeFileSmall.Length - 4); - if (PicSettings.UsaOrarioMiniatura | PicSettings.TestoMin | PicSettings.AggTempoGaraMin | PicSettings.AggNumTempMin) + if (string.Equals(_picSettings.DirectorySorgente, _picSettings.DirectoryDestinazione, StringComparison.OrdinalIgnoreCase)) + nomeFileSmall = nomeFileSmall.Substring(0, nomeFileSmall.Length - 4) + _picSettings.Codice + nomeFileSmall.Substring(nomeFileSmall.Length - 4); + if (_picSettings.UsaOrarioMiniatura | _picSettings.TestoMin | _picSettings.AggTempoGaraMin | _picSettings.AggNumTempMin) { if (testoFirmaPiccola.Length > 0) { @@ -327,15 +330,15 @@ public class ImageCreatorSharp : IDisposable int LarghezzaStandard1; // quick fix DimensioneStandardMiniatura = 50; - if (PicSettings.Grassetto == true) + if (_picSettings.Grassetto == true) { - crFont1 = new Font(PicSettings.IlFont, DimensioneStandardMiniatura, FontStyle.Bold); - crFont2 = new Font(PicSettings.IlFont, DimensioneStandard, FontStyle.Bold); + crFont1 = new Font(_picSettings.IlFont, DimensioneStandardMiniatura, FontStyle.Bold); + crFont2 = new Font(_picSettings.IlFont, DimensioneStandard, FontStyle.Bold); } else { - crFont1 = new Font(PicSettings.IlFont, DimensioneStandardMiniatura); - crFont2 = new Font(PicSettings.IlFont, DimensioneStandard); + crFont1 = new Font(_picSettings.IlFont, DimensioneStandardMiniatura); + crFont2 = new Font(_picSettings.IlFont, DimensioneStandard); } crSize1 = grPhoto1.MeasureString(testoFirmaPiccola, crFont1); @@ -351,10 +354,10 @@ public class ImageCreatorSharp : IDisposable Conta -= 5; else Conta -= 1; - if (PicSettings.Grassetto == true) - crFont1 = new Font(PicSettings.IlFont, Conta, FontStyle.Bold); + if (_picSettings.Grassetto == true) + crFont1 = new Font(_picSettings.IlFont, Conta, FontStyle.Bold); else - crFont1 = new Font(PicSettings.IlFont, Conta); + crFont1 = new Font(_picSettings.IlFont, Conta); crSize1 = grPhoto1.MeasureString(testoFirmaPiccola, crFont1); if (crSize1.Width < System.Convert.ToSingle(g.Width)) { @@ -369,19 +372,19 @@ public class ImageCreatorSharp : IDisposable DimensioneStandardMiniatura = Conta; } - switch (PicSettings.Posizione.ToUpper()) + switch (_picSettings.Posizione.ToUpper()) { case "ALTO": { - yPosFromBottom1 = (PicSettings.Margine); - yPosFromBottom4 = (PicSettings.MargVert); + yPosFromBottom1 = (_picSettings.Margine); + yPosFromBottom4 = (_picSettings.MargVert); break; } case "BASSO": { - 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))); + 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))); break; } } @@ -389,13 +392,13 @@ public class ImageCreatorSharp : IDisposable float xCenterOfImg1 = 0; StringFormat StrFormat1 = new StringFormat(); - switch (PicSettings.Allineamento.ToUpper()) + switch (_picSettings.Allineamento.ToUpper()) { 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)); break; } @@ -408,9 +411,9 @@ public class ImageCreatorSharp : IDisposable 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)); break; } @@ -418,22 +421,22 @@ 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; + DimensioneStandardMiniatura = _picSettings.DimMin; - if (PicSettings.Grassetto == true) - crFont1 = new Font(PicSettings.IlFont, DimensioneStandardMiniatura, FontStyle.Bold); + if (_picSettings.Grassetto == true) + crFont1 = new Font(_picSettings.IlFont, DimensioneStandardMiniatura, FontStyle.Bold); else - crFont1 = new Font(PicSettings.IlFont, DimensioneStandardMiniatura); + crFont1 = new Font(_picSettings.IlFont, DimensioneStandardMiniatura); // asdgadfhdfhjgfsjgfjygfdhsdafa - if (PicSettings.TestoMin) + if (_picSettings.TestoMin) { grPhoto1.DrawString(nomeFileBig, crFont1, semiTransBrush21, new PointF(xCenterOfImg1 + 1, yPosFromBottom1 + 1), 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 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, semiTransBrush1, new PointF(xCenterOfImg1, yPosFromBottom1), StrFormat1); } - else if (PicSettings.AggNumTempMin) + else if (_picSettings.AggNumTempMin) { var diff = dataPartenzaI - dataFoto; var diffA = diff.TotalSeconds * 10000000; @@ -515,10 +518,10 @@ public class ImageCreatorSharp : IDisposable SizeF crSize = new SizeF(); int LarghezzaStandard; - if (PicSettings.Grassetto == true) - crFont = new Font(PicSettings.IlFont, DimensioneStandard, FontStyle.Bold); + if (_picSettings.Grassetto == true) + crFont = new Font(_picSettings.IlFont, DimensioneStandard, FontStyle.Bold); else - crFont = new Font(PicSettings.IlFont, DimensioneStandard); + crFont = new Font(_picSettings.IlFont, DimensioneStandard); crSize = grPhoto.MeasureString(testoFirma, crFont); LarghezzaStandard = System.Convert.ToInt32(crSize.Width); @@ -531,10 +534,10 @@ public class ImageCreatorSharp : IDisposable Conta -= 5; else Conta -= 1; - if (PicSettings.Grassetto == true) - crFont = new Font(PicSettings.IlFont, Conta, FontStyle.Bold); + if (_picSettings.Grassetto == true) + crFont = new Font(_picSettings.IlFont, Conta, FontStyle.Bold); else - crFont = new Font(PicSettings.IlFont, Conta); + crFont = new Font(_picSettings.IlFont, Conta); crSize = grPhoto.MeasureString(testoFirma, crFont); 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": { - yPosFromBottom = (PicSettings.Margine); - yPosFromBottom3 = (PicSettings.MargVert); + yPosFromBottom = (_picSettings.Margine); + yPosFromBottom3 = (_picSettings.MargVert); break; } case "BASSO": { - 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))); + 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))); break; } } @@ -570,15 +573,15 @@ public class ImageCreatorSharp : IDisposable float xCenterOfImg = 0; float xCenterOfImg3 = 0; StringFormat StrFormat = new StringFormat(); - switch (PicSettings.Allineamento.ToUpper()) + switch (_picSettings.Allineamento.ToUpper()) { case "SINISTRA": { - xCenterOfImg = System.Convert.ToSingle((PicSettings.Margine + (LarghezzaStandard / (double)2))); - xCenterOfImg3 = System.Convert.ToSingle((PicSettings.MargVert + (LarghezzaStandard / (double)2))); - if ((LarghezzaStandard / (double)2) > (g.Width / (double)2) - PicSettings.Margine) + xCenterOfImg = System.Convert.ToSingle((_picSettings.Margine + (LarghezzaStandard / (double)2))); + xCenterOfImg3 = System.Convert.ToSingle((_picSettings.MargVert + (LarghezzaStandard / (double)2))); + if ((LarghezzaStandard / (double)2) > (g.Width / (double)2) - _picSettings.Margine) 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)); break; } @@ -591,11 +594,11 @@ public class ImageCreatorSharp : IDisposable case "DESTRA": { - xCenterOfImg = System.Convert.ToSingle((g.Width - PicSettings.Margine - (LarghezzaStandard / (double)2))); - xCenterOfImg3 = System.Convert.ToSingle((g.Width - PicSettings.MargVert - (LarghezzaStandard / (double)2))); - if ((LarghezzaStandard / (double)2) > (g.Width / (double)2) - PicSettings.Margine) + xCenterOfImg = System.Convert.ToSingle((g.Width - _picSettings.Margine - (LarghezzaStandard / (double)2))); + xCenterOfImg3 = System.Convert.ToSingle((g.Width - _picSettings.MargVert - (LarghezzaStandard / (double)2))); + if ((LarghezzaStandard / (double)2) > (g.Width / (double)2) - _picSettings.Margine) 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)); break; } @@ -604,25 +607,25 @@ 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) { - if (PicSettings.Grassetto == true) - crFont = new Font(PicSettings.IlFont, PicSettings.DimVert, FontStyle.Bold); + if (_picSettings.Grassetto == true) + crFont = new Font(_picSettings.IlFont, _picSettings.DimVert, FontStyle.Bold); else - crFont = new Font(PicSettings.IlFont, PicSettings.DimVert); + crFont = new Font(_picSettings.IlFont, _picSettings.DimVert); } - else if (PicSettings.Grassetto == true) - crFont = new Font(PicSettings.IlFont, DimensioneStandard, FontStyle.Bold); + else if (_picSettings.Grassetto == true) + crFont = new Font(_picSettings.IlFont, DimensioneStandard, FontStyle.Bold); else - crFont = new Font(PicSettings.IlFont, DimensioneStandard); + crFont = new Font(_picSettings.IlFont, DimensioneStandard); // 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); 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 (PicSettings.TestoMin == false) + if (_picSettings.TestoMin == false) { grPhoto.DrawString(testoFirmaV, crFont, semiTransBrush2, new PointF(xCenterOfImg + 1, yPosFromBottom3 + 1), 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, 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; - 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(); @@ -675,9 +678,9 @@ public class ImageCreatorSharp : IDisposable private void aggiungiLogo(Bitmap imgOutputBig, Image logo) { // 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; @@ -696,12 +699,12 @@ public class ImageCreatorSharp : IDisposable 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 - 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); imageAttributes.SetColorMatrix(wmColorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap); - int FotoLogoH = PicSettings.LogoAltezza; - int FotoLogoW = PicSettings.LogoLarghezza; + int FotoLogoH = _picSettings.LogoAltezza; + int FotoLogoW = _picSettings.LogoLarghezza; double FattoreAlt = logo.Height / (double)FotoLogoH; double FattoreLarg = logo.Width / (double)FotoLogoW; Size NuovaSize; @@ -713,11 +716,11 @@ public class ImageCreatorSharp : IDisposable int MargineUsato; int MargineL; bool InPercentualeL; - if (PicSettings.LogoMargine.EndsWith("%") == true) + if (_picSettings.LogoMargine.EndsWith("%") == true) InPercentualeL = true; else InPercentualeL = false; - MargineL = System.Convert.ToInt32(PicSettings.LogoMargine); + MargineL = System.Convert.ToInt32(_picSettings.LogoMargine); if (InPercentualeL == true) MargineUsato = System.Convert.ToInt32(imgOutputBig.Height * MargineL / (double)100); else @@ -725,7 +728,7 @@ public class ImageCreatorSharp : IDisposable int xPosOfWm = 0; int yPosOfWm = 0; - switch (PicSettings.LogoPosizioneH.ToUpper()) + switch (_picSettings.LogoPosizioneH.ToUpper()) { case "SINISTRA": case "NESSUNA": @@ -746,7 +749,7 @@ public class ImageCreatorSharp : IDisposable break; } } - switch (PicSettings.LogoPosizioneV.ToUpper()) + switch (_picSettings.LogoPosizioneV.ToUpper()) { case "ALTO": 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) { using var image1Stream = new MemoryStream(); - if (PicSettings.FotoGrandeDimOrigina == false) + if (_picSettings.FotoGrandeDimOrigina == false) { // attenzione non controlla se è png // imgOutputBig.Save(Path.Combine(_DestDir.FullName, "Temp_" & NomeFileBig), thisFormat) @@ -785,7 +788,7 @@ public class ImageCreatorSharp : IDisposable { MakeImageCustomQuality(imgOutputBig, image1Stream); } - //SalvaImmagineCustomQuality(imgOutputBig, Path.Combine(DestDir.FullName, "Temp_" + NomeFileBig), PicSettings.jpegQuality); + //SalvaImmagineCustomQuality(imgOutputBig, Path.Combine(DestDir.FullName, "Temp_" + NomeFileBig), _picSettings.jpegQuality); else { imgOutputBig.Save(image1Stream, thisFormat); @@ -793,10 +796,10 @@ public class ImageCreatorSharp : IDisposable //imgOutputBig.Save(Path.Combine(DestDir.FullName, "Temp_" + NomeFileBig), thisFormat); image1Stream.Seek(0, SeekOrigin.Begin); 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); 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); @@ -809,7 +812,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); @@ -817,23 +820,23 @@ public class ImageCreatorSharp : IDisposable } 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); - //if (PicSettings.FotoGrandeDimOrigina == false) + using System.Drawing.Image g1 = _picSettings.FotoGrandeDimOrigina ? (Image)imgOutputBig.Clone() : Image.FromStream(image1Stream); + //if (_picSettings.FotoGrandeDimOrigina == false) // g1 = Image.FromStream(image1Stream); ////g1 = System.Drawing.Image.FromFile(Path.Combine(DestDir.FullName, "Temp_" + NomeFileBig)); //else // g1 = (Image)imgOutputBig.Clone(); //g1 = System.Drawing.Image.FromFile(Path.Combine(DestDir.FullName, NomeFileBig)); using Bitmap imgOutputSmall = new Bitmap(g1, thumbSizeSmall.Width, thumbSizeSmall.Height); - if (string.Equals(PicSettings.DirectorySorgente, PicSettings.DirectoryDestinazione, StringComparison.OrdinalIgnoreCase)) - NomeFileSmall = NomeFileSmall.Substring(0, NomeFileSmall.Length - 4) + PicSettings.Codice + NomeFileSmall.Substring(NomeFileSmall.Length - 4); + if (string.Equals(_picSettings.DirectorySorgente, _picSettings.DirectoryDestinazione, StringComparison.OrdinalIgnoreCase)) + 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); @@ -854,7 +857,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(); @@ -867,7 +870,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); diff --git a/MaddoShared/PicSettings.cs b/MaddoShared/PicSettings.cs index c5784d0..239dfb4 100644 --- a/MaddoShared/PicSettings.cs +++ b/MaddoShared/PicSettings.cs @@ -5,63 +5,63 @@ using System.Windows.Forms; namespace MaddoShared; -public static class PicSettings +public 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 string DirectorySorgente { get; set; } + public string DirectoryDestinazione { get; set; } + public string TestoFirmaStart { get; set; } + public string TestoFirmaStartV { get; set; } + public DateTime DataPartenza { get; set; } + public string TestoOrario { get; set; } + public int DimStandard { get; set; } + public int DimStandardMiniatura { get; set; } + public bool NomeData { get; set; } + public bool TestoNome { get; set; } + public bool UsaOrarioMiniatura { get; set; } + public bool UsaOrarioTestoApplicare { get; set; } + public bool UsaTempoGaraTestoApplicare { get; set; } + public bool UsaRotazioneAutomatica { get; set; } + public bool UsaForzaJpg { get; set; } + public int LarghezzaSmall { get; set; } + public int AltezzaSmall { get; set; } + public bool CreaMiniature { get; set; } + public bool AggiungiScritteMiniature { get; set; } + public string Suffisso { get; set; } + public string Codice { get; set; } + public int Trasparenza { get; set; } + public string IlFont { get; set; } + public bool Grassetto { get; set; } + public string Posizione { get; set; } + public string Allineamento { get; set; } + public int Margine { get; set; } + public int LogoAltezza { get; set; } + public int LogoLarghezza { get; set; } + public Color FontColoreRGB { get; set; } + public bool LogoAggiungi { get; set; } + public string LogoNomeFile { get; set; } + public string LogoTrasparenza { get; set; } + public string LogoMargine { get; set; } + public string LogoPosizioneH { get; set; } + public string LogoPosizioneV { get; set; } + public bool FotoGrandeDimOrigina { get; set; } + public int AltezzaBig { get; set; } + public int LarghezzaBig { get; set; } + public DirectoryInfo DestDir { get; set; } + public int DimVert { get; set; } + public int MargVert { get; set; } + public bool TestoMin { get; set; } + public int DimMin { get; set; } + public bool SecretDefault { get; set; } + public bool SecretBig { get; set; } + public bool SecretSmall { get; set; } + public string SecretPathSmall { get; set; } + public string SecretPathBig { get; set; } + public bool AggTempoGaraMin { get; set; } + public bool AggNumTempMin { get; set; } + public long JpegQuality { get; set; } + public 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; + public bool FotoRuotaADestra { get; set; } = false; + public bool FotoRuotaASinistra { get; set; } = false; + public string TempMinText { get; set; } = string.Empty; } \ No newline at end of file diff --git a/imagecatalog/MainForm.cs b/imagecatalog/MainForm.cs index 4f73caf..8430bba 100644 --- a/imagecatalog/MainForm.cs +++ b/imagecatalog/MainForm.cs @@ -30,12 +30,15 @@ public partial class MainForm private readonly ImageCreationStuff _imageCreationService; private readonly ParametriSetup _parametriSetup; + private readonly PicSettings _picSettings; - public MainForm(DataModel model, ImageCreationStuff imageCreationStuff, ParametriSetup parametriSetup, ILogger logger) + public MainForm(DataModel model, ImageCreationStuff imageCreationStuff, PicSettings picSettings, ParametriSetup parametriSetup, ILogger logger) { Model = model; _imageCreationService = imageCreationStuff; _parametriSetup = parametriSetup; + _picSettings = picSettings; + _logger = logger; _logger.LogDebug("Start"); @@ -254,47 +257,6 @@ public partial class MainForm //Button6.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) { @@ -325,20 +287,9 @@ public partial class MainForm var dialog = new FolderBrowserDialog(); dialog.InitialDirectory = startingFolder; 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; - // if (directoryScelta.EndsWith(@"\") == false) - // { - // directoryScelta += @"\"; - // } - return directoryScelta; } @@ -349,33 +300,6 @@ public partial class MainForm { 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) @@ -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 DestDirStart = new DirectoryInfo(DestPath); DirectoryInfo DestDir = null; - PicSettings.DirectorySorgente = SourcePath; - PicSettings.DirectoryDestinazione = Model.DestinationPath; + _picSettings.DirectorySorgente = SourcePath; + _picSettings.DirectoryDestinazione = Model.DestinationPath; - // PicSettings.DestDir = DestDir - // PicSettings.SourceDir = SourceDir - // PicSettings.DestDirStart = DestDirStart + // _picSettings.DestDir = DestDir + // _picSettings.SourceDir = SourceDir + // _picSettings.DestDirStart = DestDirStart - PicSettings.DimStandard = int.Parse(TextBox11.Text); - PicSettings.DimStandardMiniatura = int.Parse(TextBox25.Text); - PicSettings.UsaOrarioMiniatura = CheckBox12.Checked; - PicSettings.UsaOrarioTestoApplicare = CheckBox8.Checked; - PicSettings.UsaTempoGaraTestoApplicare = CheckBox7.Checked; - PicSettings.UsaRotazioneAutomatica = chkRotazioneAutomatica.Checked; - PicSettings.UsaForzaJpg = chkForzaJpg.Checked; + _picSettings.DimStandard = int.Parse(TextBox11.Text); + _picSettings.DimStandardMiniatura = int.Parse(TextBox25.Text); + _picSettings.UsaOrarioMiniatura = CheckBox12.Checked; + _picSettings.UsaOrarioTestoApplicare = CheckBox8.Checked; + _picSettings.UsaTempoGaraTestoApplicare = CheckBox7.Checked; + _picSettings.UsaRotazioneAutomatica = chkRotazioneAutomatica.Checked; + _picSettings.UsaForzaJpg = chkForzaJpg.Checked; if (CheckBox17.Checked) { - PicSettings.TestoNome = true; + _picSettings.TestoNome = true; } else { - PicSettings.TestoNome = false; + _picSettings.TestoNome = false; } if (CheckBox16.Checked) { - PicSettings.NomeData = true; + _picSettings.NomeData = true; } else { - PicSettings.NomeData = false; + _picSettings.NomeData = false; } - PicSettings.TestoFirmaStart = Model.HorizontalText; - PicSettings.TestoFirmaStartV = TextBox29.Text; - PicSettings.DataPartenza = DateTimePicker1.Value; - PicSettings.TestoOrario = TextBox18.Text; - PicSettings.AltezzaSmall = int.Parse(TextBox6.Text); - PicSettings.LarghezzaSmall = int.Parse(TextBox5.Text); - PicSettings.CreaMiniature = CheckBox1.Checked; - PicSettings.AggiungiScritteMiniature = RadioButton3.Checked; - PicSettings.AggTempoGaraMin = RadioButton5.Checked; - PicSettings.AggNumTempMin = RadioButton7.Checked; - PicSettings.DimVert = int.Parse(TextBox30.Text); - PicSettings.MargVert = int.Parse(TextBox31.Text); + _picSettings.TestoFirmaStart = Model.HorizontalText; + _picSettings.TestoFirmaStartV = TextBox29.Text; + _picSettings.DataPartenza = DateTimePicker1.Value; + _picSettings.TestoOrario = TextBox18.Text; + _picSettings.AltezzaSmall = int.Parse(TextBox6.Text); + _picSettings.LarghezzaSmall = int.Parse(TextBox5.Text); + _picSettings.CreaMiniature = CheckBox1.Checked; + _picSettings.AggiungiScritteMiniature = RadioButton3.Checked; + _picSettings.AggTempoGaraMin = RadioButton5.Checked; + _picSettings.AggNumTempMin = RadioButton7.Checked; + _picSettings.DimVert = int.Parse(TextBox30.Text); + _picSettings.MargVert = int.Parse(TextBox31.Text); - // PicSettings.NomeFileChild = childFile.Name - PicSettings.Suffisso = TextBox3.Text; - // PicSettings.Codice = TextBox13.Text + // _picSettings.NomeFileChild = childFile.Name + _picSettings.Suffisso = TextBox3.Text; + // _picSettings.Codice = TextBox13.Text - PicSettings.Trasparenza = int.Parse(TextBox9.Text); - PicSettings.IlFont = ComboBox3.SelectedItem.ToString(); - PicSettings.Grassetto = CheckBox3.Checked; - PicSettings.Posizione = ComboBox1.SelectedItem.ToString(); - PicSettings.Allineamento = ComboBox2.SelectedItem.ToString(); - PicSettings.Margine = int.Parse(TextBox12.Text); - PicSettings.LogoAltezza = int.Parse(TextBox14.Text); - PicSettings.LogoLarghezza = int.Parse(TextBox15.Text); - PicSettings.FontColoreRGB = ColorTranslator.FromHtml(TextBox34.Text); - PicSettings.LogoAggiungi = CheckBox5.Checked; - PicSettings.LogoNomeFile = TextBox10.Text; - PicSettings.LogoTrasparenza = TextBox19.Text; - PicSettings.LogoMargine = TextBox16.Text; - PicSettings.LogoPosizioneH = ComboBox4.Text; - PicSettings.LogoPosizioneV = ComboBox5.Text; - PicSettings.FotoGrandeDimOrigina = CheckBox15.Checked; - PicSettings.AltezzaBig = int.Parse(TextBox27.Text); - PicSettings.LarghezzaBig = int.Parse(TextBox28.Text); - PicSettings.DimMin = int.Parse(TextBox25.Text); - PicSettings.TestoMin = RadioButton6.Checked; - PicSettings.JpegQuality = int.Parse(TextBox32.Text); - PicSettings.JpegQualityMin = int.Parse(TextBox33.Text); - } - - private List> 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(); - var dirList = new List>(); - - - // 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(); - filesList = getFiles(subDir); - dirList.Add(filesList); - } - } - - return dirList; + _picSettings.Trasparenza = int.Parse(TextBox9.Text); + _picSettings.IlFont = ComboBox3.SelectedItem.ToString(); + _picSettings.Grassetto = CheckBox3.Checked; + _picSettings.Posizione = ComboBox1.SelectedItem.ToString(); + _picSettings.Allineamento = ComboBox2.SelectedItem.ToString(); + _picSettings.Margine = int.Parse(TextBox12.Text); + _picSettings.LogoAltezza = int.Parse(TextBox14.Text); + _picSettings.LogoLarghezza = int.Parse(TextBox15.Text); + _picSettings.FontColoreRGB = ColorTranslator.FromHtml(TextBox34.Text); + _picSettings.LogoAggiungi = CheckBox5.Checked; + _picSettings.LogoNomeFile = TextBox10.Text; + _picSettings.LogoTrasparenza = TextBox19.Text; + _picSettings.LogoMargine = TextBox16.Text; + _picSettings.LogoPosizioneH = ComboBox4.Text; + _picSettings.LogoPosizioneV = ComboBox5.Text; + _picSettings.FotoGrandeDimOrigina = CheckBox15.Checked; + _picSettings.AltezzaBig = int.Parse(TextBox27.Text); + _picSettings.LarghezzaBig = int.Parse(TextBox28.Text); + _picSettings.DimMin = int.Parse(TextBox25.Text); + _picSettings.TestoMin = RadioButton6.Checked; + _picSettings.JpegQuality = int.Parse(TextBox32.Text); + _picSettings.JpegQualityMin = int.Parse(TextBox33.Text); } private List getFiles(DirectoryInfo sourceDir) @@ -701,114 +583,6 @@ public partial class MainForm return picList; } - private Dictionary 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(); - 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(); - 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) { 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() { int numerazione; @@ -1045,212 +698,7 @@ public partial class MainForm return numerazioneType; } - - private void CreaimmaginiWithThreadDict(string SourcePath, string DestPath) - { - var dirSourceDest = new Dictionary(); - 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) { @@ -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 - - - // ''' - // ''' Get the color relative to mouse position - // ''' - // 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) { // Dim bm As New Bitmap(1, 1, Imaging.PixelFormat.Format24bppRgb) @@ -1494,13 +917,13 @@ public partial class MainForm lblFotoTotaliNum.Text = "0"; Label18.Text = "0"; Label43.Text = "-s"; - setPicSettings(Model.SourcePath, Model.DestinationPath); + SetPicSettings(Model.SourcePath, Model.DestinationPath); ProgressBar1.Minimum = 0; ProgressBar1.Step = 1; ProgressBar1.Value = 0; // Await CreaCatalogoParallel() - var imgStf = _imageCreationService; //new ImageCreationStuff(); + var imageCreationOptions = new ImageCreationStuff.Options { AggiornaSottodirectory = chkAggiornaSottodirectory.Checked, @@ -1526,7 +949,7 @@ public partial class MainForm timer1.Interval = 1000 * 60; timer1.Enabled = true; - string time = await imgStf.CreaCatalogoParallel(imageCreationOptions, _results, UiUpdateEvent, token); + string time = await _imageCreationService.CreaCatalogoParallel(imageCreationOptions, _results, UiUpdateEvent, token); Label43.Text = time; timer1.Enabled = false; } @@ -1562,105 +985,6 @@ public partial class MainForm { 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 diff --git a/imagecatalog/Program.cs b/imagecatalog/Program.cs index 7863674..854667a 100644 --- a/imagecatalog/Program.cs +++ b/imagecatalog/Program.cs @@ -84,6 +84,7 @@ namespace ImageCatalog_2 services.AddTransient(); services.AddSingleton(); + services.AddSingleton(); // Register your forms services.AddTransient(); -- 2.52.0 From a21522a9166773d5bf36ef6fddc31db27a7a9fdf Mon Sep 17 00:00:00 2001 From: Marco Date: Mon, 28 Jul 2025 10:34:03 +0200 Subject: [PATCH 024/127] Cleaned up old code --- imagecatalog/AssemblyInfo.vb | 31 - imagecatalog/CreaImmagineSeparateMultiCore.cs | 1255 ------------ imagecatalog/CreaImmagineSeparateMultiCore.vb | 943 --------- imagecatalog/CreaImmagineSeparateThread.cs | 1721 ----------------- imagecatalog/CreaImmagineSeparateThread.vb | 1409 -------------- imagecatalog/DataModel.cs | 13 +- imagecatalog/ExifReader.vb | 1068 ---------- imagecatalog/FileHelper.vb | 252 --- imagecatalog/LoadBuffer.cs | 13 - imagecatalog/LoadBuffer.vb | 9 - imagecatalog/MainForm.Designer.cs | 1 + imagecatalog/MainForm.cs | 9 +- imagecatalog/ParametriSetup.vb | 167 -- imagecatalog/XYThreadPool.cs | 273 --- imagecatalog/XYThreadPool.vb | 185 -- 15 files changed, 17 insertions(+), 7332 deletions(-) delete mode 100644 imagecatalog/AssemblyInfo.vb delete mode 100644 imagecatalog/CreaImmagineSeparateMultiCore.cs delete mode 100644 imagecatalog/CreaImmagineSeparateMultiCore.vb delete mode 100644 imagecatalog/CreaImmagineSeparateThread.cs delete mode 100644 imagecatalog/CreaImmagineSeparateThread.vb delete mode 100644 imagecatalog/ExifReader.vb delete mode 100644 imagecatalog/FileHelper.vb delete mode 100644 imagecatalog/LoadBuffer.cs delete mode 100644 imagecatalog/LoadBuffer.vb delete mode 100644 imagecatalog/ParametriSetup.vb delete mode 100644 imagecatalog/XYThreadPool.cs delete mode 100644 imagecatalog/XYThreadPool.vb diff --git a/imagecatalog/AssemblyInfo.vb b/imagecatalog/AssemblyInfo.vb deleted file mode 100644 index 96c6530..0000000 --- a/imagecatalog/AssemblyInfo.vb +++ /dev/null @@ -1,31 +0,0 @@ -Imports System.Reflection -Imports System.Runtime.InteropServices - -' General Information about an assembly is controlled through the following -' set of attributes. Change these attribute values to modify the information -' associated with an assembly. - -' Review the values of the assembly attributes - - - - - - - - - -'The following GUID is for the ID of the typelib if this project is exposed to COM - - -' Version information for an assembly consists of the following four values: -' -' Major Version -' Minor Version -' Build Number -' Revision -' -' You can specify all the values or you can default the Build and Revision Numbers -' by using the '*' as shown below: - - diff --git a/imagecatalog/CreaImmagineSeparateMultiCore.cs b/imagecatalog/CreaImmagineSeparateMultiCore.cs deleted file mode 100644 index 8ead6eb..0000000 --- a/imagecatalog/CreaImmagineSeparateMultiCore.cs +++ /dev/null @@ -1,1255 +0,0 @@ -using System; -using System.Drawing; -using System.IO; -using Microsoft.VisualBasic; -using Microsoft.VisualBasic.CompilerServices; - -namespace ImageCatalog -{ - // Imports System.Drawing.Drawing2D - // Imports System.Drawing.Imaging - // Imports System.Threading - - public class CreaImmagineSeparateMultiCore - { - private string _DirectorySorgente; - private string _DirectoryDestinazione; - private DirectoryInfo _SourceDir; - private DirectoryInfo _DestDirStart; - private int _DimStandard; - private int _DimStandardMiniatura; - private bool _UsaOrarioMiniatura; - private bool _UsaOrarioTestoApplicare; - private bool _UsaTempoGaraTestoApplicare; - private string _TestoFirmaStart; - private string _TestoFirmaStartV; - private DateTime _DataPartenza; - private string _TestoOrario; - private bool _UsaRotazioneAutomatica; - private bool _UsaForzaJpg; - private int _LarghezzaSmall; - private int _AltezzaSmall; - private bool _CreaMiniature; - private bool _AggiungiScritteMiniature; - private string _NomeFileChild; - private string _Suffisso; - private string _Codice; - private int _Trasparenza; - private string _IlFont; - private bool _Grassetto; - private string _Posizione; - private string _Allineamento; - private int _Margine; - private int _LogoAltezza; - private int _LogoLarghezza; - private int _FontColoreR; - private int _FontColoreG; - private int _FontColoreB; - private bool _LogoAggiungi; - private string _LogoNomeFile; - private string _LogoTrasparenza; - private string _LogoMargine; - private string _LogoPosizioneH; - private string _LogoPosizioneV; - private bool _FotoGrandeDimOrigina; - private int _AltezzaBig; - private int _LarghezzaBig; - private DirectoryInfo _DestDir; - - public void CreaImmagine(PicInfo InfoImg) - { - string TestoFirma = ""; - _DestDir = InfoImg.DirDest; - _SourceDir = InfoImg.DirSource; - _DestDirStart = InfoImg.DirDestStart; - _NomeFileChild = InfoImg.NomeImmagine; - int AlphaScelta = Conversions.ToInteger(255 * (100 - _Trasparenza) / 100d); - int DimensioneStandard; - int DimensioneStandardMiniatura; - DateTime DataFoto; - var DataPartenzaI = _DataPartenza; - if (_TestoOrario.Length > 0) - { - _TestoOrario += " "; - } - - string TestoFirmaPiccola = ""; - int FileConta = 0; - int ContaFileXDir = 0; - int ContaDirXDir = 0; - string TestoTemp = ""; - int ContaTemp = 0; - DimensioneStandard = _DimStandard; - DimensioneStandardMiniatura = _DimStandardMiniatura; - var g = Image.FromFile(Path.Combine(_SourceDir.FullName, _NomeFileChild)); - if (_UsaOrarioTestoApplicare == true | _UsaTempoGaraTestoApplicare == true | _UsaOrarioMiniatura == true) - { - if (g.PropertyIdList.Length > 0) // ci sono dati exif - { - var DatiExif = new ExifReader((Bitmap)g); - DataFoto = DatiExif.DateTimeOriginal; - TestoFirma = _TestoFirmaStart; - if (DataFoto.Year != 1) - { - TestoFirmaPiccola = DataFoto.ToShortTimeString(); - if (_UsaOrarioTestoApplicare == true) - { - TestoFirma += " - " + DataFoto.ToShortDateString() + " " + DataFoto.ToLongTimeString(); - } - - if (_UsaTempoGaraTestoApplicare == true) - { - var Orario = new TimeSpan(DateAndTime.DateDiff(DateInterval.Second, DataPartenzaI, DataFoto) * 10000000L); - TestoFirma += " - " + _TestoOrario + Orario.Hours.ToString("00") + ":" + Orario.Minutes.ToString("00") + ":" + Orario.Seconds.ToString("00"); - } - } - } - } - else - { - TestoFirma = _TestoFirmaStart; - } - - bool FotoRuotaADestra = false; - bool FotoRuotaASinistra = false; - if (_UsaRotazioneAutomatica == true) - { - if (g.PropertyIdList.Length > 0) // ci sono dati exif - { - var DatiExif = new ExifReader((Bitmap)g); - switch (DatiExif.Orientation) - { - case ExifReader.Orientations.BottomLeft: - { - break; - } - - case ExifReader.Orientations.BottomRight: - { - break; - } - - case ExifReader.Orientations.LeftTop: - { - break; - } - - case ExifReader.Orientations.LftBottom: - { - FotoRuotaASinistra = true; - break; - } - - case ExifReader.Orientations.RightBottom: - { - break; - } - - case ExifReader.Orientations.RightTop: - { - break; - } - - case ExifReader.Orientations.TopLeft: - { - break; - } - - case ExifReader.Orientations.TopRight: - { - break; - } - } - } - } - // rotazione - if (FotoRuotaASinistra == true) - { - g.RotateFlip(RotateFlipType.Rotate270FlipNone); - } - - if (FotoRuotaADestra == true) - { - g.RotateFlip(RotateFlipType.Rotate90FlipNone); - } - - var thisFormat = g.RawFormat; - if (_UsaForzaJpg == true) - { - thisFormat = System.Drawing.Imaging.ImageFormat.Jpeg; - } - - var thumbSizeSmall = new Size(); - var thumbSizeBig = new Size(); - string NomeFileSmall = ""; - string NomeFileBig = ""; - string NomeFileBig2 = ""; - if (g.Width > g.Height) - { - thumbSizeSmall = NewthumbSize(g.Width, g.Height, LarghezzaSmall, "Larghezza"); - var SizeOrig = new Size(g.Width, g.Height); - thumbSizeBig = SizeOrig; - } - else - { - thumbSizeSmall = NewthumbSize(g.Width, g.Height, AltezzaSmall, "Altezza"); - var SizeOrig = new Size(g.Width, g.Height); - thumbSizeBig = SizeOrig; - } - - NomeFileSmall = Suffisso + _NomeFileChild; - NomeFileBig = _NomeFileChild; - var imgOutputBig = new Bitmap(g, thumbSizeBig.Width, thumbSizeBig.Height); - imgOutputBig.SetResolution(g.HorizontalResolution, g.VerticalResolution); - if (_CreaMiniature == true) - { - if (_AggiungiScritteMiniature == false) - { - if ((_DirectorySorgente.ToUpper() ?? "") == (_DirectoryDestinazione.ToUpper() ?? "")) - { - NomeFileSmall = NomeFileSmall.Substring(0, NomeFileSmall.Length - 4) + Codice + NomeFileSmall.Substring(NomeFileSmall.Length - 4); - } - - if (_UsaOrarioMiniatura == true) - { - if (TestoFirmaPiccola.Length > 0) - { - Bitmap imgOutputSmall; - imgOutputSmall = (Bitmap)imgOutputBig.Clone(); - Graphics grPhoto1; - grPhoto1 = Graphics.FromImage(imgOutputSmall); - grPhoto1.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; - Font crFont1 = null; - var crSize1 = new SizeF(); - int LarghezzaStandard1; - if (_Grassetto == true) - { - crFont1 = new Font(IlFont, DimensioneStandardMiniatura, FontStyle.Bold); - } - else - { - crFont1 = new Font(_IlFont, DimensioneStandardMiniatura); - } - - crSize1 = grPhoto1.MeasureString(TestoFirmaPiccola, crFont1); - LarghezzaStandard1 = Conversions.ToInteger(crSize1.Width); - if (crSize1.Width > Conversions.ToSingle(g.Width)) - { - int Conta = DimensioneStandardMiniatura; - do - { - if (Conta > 20) - { - Conta -= 5; - } - else - { - Conta -= 1; - } - - if (_Grassetto == true) - { - crFont1 = new Font(_IlFont, Conta, FontStyle.Bold); - } - else - { - crFont1 = new Font(_IlFont, Conta); - } - - crSize1 = grPhoto1.MeasureString(TestoFirmaPiccola, crFont1); - if (crSize1.Width < Conversions.ToSingle(g.Width)) - { - LarghezzaStandard1 = Conversions.ToInteger(crSize1.Width); - break; - } - - if (Conta <= 5) - break; - } - while (true); - DimensioneStandardMiniatura = Conta; - } - - var yPosFromBottom1 = default(float); - switch (_Posizione.ToUpper() ?? "") - { - case "ALTO": - { - yPosFromBottom1 = _Margine; - break; - } - - case "BASSO": - { - // yPosFromBottom = (g.Height - _Margine - DimensioneStandard) - // yPosFromBottom1 = CType((g.Height - crFont1.Height - (g.Height * _Margine / 100) - (crFont1.Height * 0.3)), Single) - yPosFromBottom1 = Conversions.ToSingle(g.Height - crSize1.Height - g.Height * _Margine / 100d); - break; - } - } - - var xCenterOfImg1 = default(float); - var StrFormat1 = new StringFormat(); - switch (_Allineamento.ToUpper() ?? "") - { - case "SINISTRA": - { - xCenterOfImg1 = Conversions.ToSingle(_Margine + LarghezzaStandard1 / 2d); - if (LarghezzaStandard1 / 2d > g.Width / 2d - _Margine) - { - xCenterOfImg1 = Conversions.ToSingle(g.Width / 2d); - } - - break; - } - - case "CENTRO": - { - xCenterOfImg1 = Conversions.ToSingle(g.Width / 2d); - break; - } - - case "DESTRA": - { - xCenterOfImg1 = Conversions.ToSingle(g.Width - _Margine - LarghezzaStandard1 / 2d); - if (LarghezzaStandard1 / 2d > g.Width / 2d - _Margine) - { - xCenterOfImg1 = Conversions.ToSingle(g.Width / 2d); - } - - break; - } - } - - StrFormat1.Alignment = StringAlignment.Center; - var semiTransBrush21 = new SolidBrush(Color.FromArgb(AlphaScelta, 0, 0, 0)); - var semiTransBrush1 = new SolidBrush(Color.FromArgb(AlphaScelta, _FontColoreR, _FontColoreG, _FontColoreB)); - if (_Grassetto == true) - { - crFont1 = new Font(_IlFont, DimensioneStandardMiniatura, FontStyle.Bold); - } - else - { - crFont1 = new Font(_IlFont, DimensioneStandardMiniatura); - } - - grPhoto1.DrawString(TestoFirmaPiccola, crFont1, semiTransBrush21, new PointF(xCenterOfImg1 + 1f, yPosFromBottom1 + 1f), StrFormat1); - grPhoto1.DrawString(TestoFirmaPiccola, crFont1, semiTransBrush1, new PointF(xCenterOfImg1, yPosFromBottom1), StrFormat1); - imgOutputSmall.Save(Path.Combine(_DestDir.FullName, "Temp_" + NomeFileSmall), thisFormat); - var g2 = Image.FromFile(Path.Combine(_DestDir.FullName, "Temp_" + NomeFileSmall)); - var imgOutputSmall2 = new Bitmap(g2, thumbSizeSmall.Width, thumbSizeSmall.Height); - imgOutputSmall2.Save(Path.Combine(_DestDir.FullName, NomeFileSmall), thisFormat); - imgOutputSmall2.Dispose(); - imgOutputSmall.Dispose(); - g2.Dispose(); - FileSystem.Kill(Path.Combine(_DestDir.FullName, "Temp_" + NomeFileSmall)); - } - else - { - var imgOutputSmall = new Bitmap(g, thumbSizeSmall.Width, thumbSizeSmall.Height); - imgOutputSmall.Save(Path.Combine(_DestDir.FullName, NomeFileSmall), thisFormat); - imgOutputSmall.Dispose(); - } - } - else - { - var imgOutputSmall = new Bitmap(g, thumbSizeSmall.Width, thumbSizeSmall.Height); - imgOutputSmall.Save(Path.Combine(_DestDir.FullName, NomeFileSmall), thisFormat); - imgOutputSmall.Dispose(); - } - } - } - - Graphics grPhoto; - grPhoto = Graphics.FromImage(imgOutputBig); - grPhoto.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; - Font crFont = null; - var crSize = new SizeF(); - int LarghezzaStandard; - if (_Grassetto == true) - { - crFont = new Font(_IlFont, DimensioneStandard, FontStyle.Bold); - } - else - { - crFont = new Font(_IlFont, DimensioneStandard); - } - - crSize = grPhoto.MeasureString(TestoFirma, crFont); - LarghezzaStandard = Conversions.ToInteger(crSize.Width); - if (crSize.Width > Conversions.ToSingle(g.Width)) - { - int Conta = DimensioneStandard; - do - { - if (Conta > 20) - { - Conta -= 5; - } - else - { - Conta -= 1; - } - - if (_Grassetto == true) - { - crFont = new Font(_IlFont, Conta, FontStyle.Bold); - } - else - { - crFont = new Font(_IlFont, Conta); - } - - crSize = grPhoto.MeasureString(TestoFirma, crFont); - if (crSize.Width < Conversions.ToSingle(g.Width)) - { - LarghezzaStandard = Conversions.ToInteger(crSize.Width); - break; - } - - if (Conta <= 5) - break; - } - while (true); - DimensioneStandard = Conta; - } - - var yPosFromBottom = default(float); - switch (_Posizione.ToUpper() ?? "") - { - case "ALTO": - { - yPosFromBottom = _Margine; - break; - } - - case "BASSO": - { - // yPosFromBottom = (g.Height - _Margine - DimensioneStandard) - // yPosFromBottom = CType((g.Height - DimensioneStandard - (g.Height * _Margine / 100) - (DimensioneStandard * 0.3)), Single) - yPosFromBottom = Conversions.ToSingle(g.Height - crSize.Height - g.Height * _Margine / 100d); - break; - } - } - - var xCenterOfImg = default(float); - var StrFormat = new StringFormat(); - switch (_Allineamento.ToUpper() ?? "") - { - case "SINISTRA": - { - xCenterOfImg = Conversions.ToSingle(_Margine + LarghezzaStandard / 2d); - if (LarghezzaStandard / 2d > g.Width / 2d - _Margine) - { - xCenterOfImg = Conversions.ToSingle(g.Width / 2d); - } - - break; - } - - case "CENTRO": - { - xCenterOfImg = Conversions.ToSingle(g.Width / 2d); - break; - } - - case "DESTRA": - { - xCenterOfImg = Conversions.ToSingle(g.Width - _Margine - LarghezzaStandard / 2d); - if (LarghezzaStandard / 2d > g.Width / 2d - _Margine) - { - xCenterOfImg = Conversions.ToSingle(g.Width / 2d); - } - - break; - } - } - - StrFormat.Alignment = StringAlignment.Center; - var semiTransBrush2 = new SolidBrush(Color.FromArgb(AlphaScelta, 0, 0, 0)); - var semiTransBrush = new SolidBrush(Color.FromArgb(AlphaScelta, _FontColoreR, _FontColoreG, _FontColoreB)); - if (_Grassetto == true) - { - crFont = new Font(_IlFont, DimensioneStandard, FontStyle.Bold); - } - else - { - crFont = new Font(_IlFont, DimensioneStandard); - } - - grPhoto.DrawString(TestoFirma, crFont, semiTransBrush2, new PointF(xCenterOfImg + 1f, yPosFromBottom + 1f), StrFormat); - grPhoto.DrawString(TestoFirma, crFont, semiTransBrush, new PointF(xCenterOfImg, yPosFromBottom), StrFormat); - if ((_DirectorySorgente.ToUpper() ?? "") == (_DirectoryDestinazione.ToUpper() ?? "")) - { - NomeFileBig2 = NomeFileBig; - NomeFileBig = NomeFileBig.Substring(0, NomeFileBig.Length - 4) + Codice + NomeFileBig.Substring(NomeFileBig.Length - 4); - } - - - // imgOutputBig - if (_LogoAggiungi == true & File.Exists(_LogoNomeFile)) - { - var ImmagineLogo = Image.FromFile(_LogoNomeFile); - var LogoColoreTrasparente = Color.White; - // Dim bmWatermark As Bitmap - - // * Create a Bitmap based on the previously modified photograph Bitmap - // bmWatermark = New Bitmap(imgOutputBig) - // bmWatermark.SetResolution(imgOutputBig.HorizontalResolution, imgOutputBig.VerticalResolution) - - // * Load this Bitmap into a new Graphic Object - var grWatermark = Graphics.FromImage(imgOutputBig); - - // * To achieve a transulcent watermark we will apply (2) color manipulations - var imageAttributes = new System.Drawing.Imaging.ImageAttributes(); - - // * The first step replace the background color with one that is trasparent (Alpha=0, R=0, G=0, B=0) - var colorMap = new System.Drawing.Imaging.ColorMap(); - - // * background this will be the color we search for and replace with transparency - colorMap.OldColor = LogoColoreTrasparente; - colorMap.NewColor = Color.FromArgb(0, 0, 0, 0); - var remapTable = new[] { colorMap }; - imageAttributes.SetRemapTable(remapTable, System.Drawing.Imaging.ColorAdjustType.Bitmap); - - // * The second color manipulation is used to change the opacity by setting the 3rd row and 3rd column to 0.3f - var 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, Conversions.ToSingle(_LogoTrasparenza) / 100f, 0.0f }, new float[] { 0.0f, 0.0f, 0.0f, 0.0f, 1.0f } }; - var wmColorMatrix = new System.Drawing.Imaging.ColorMatrix(colorMatrixElements); - imageAttributes.SetColorMatrix(wmColorMatrix, System.Drawing.Imaging.ColorMatrixFlag.Default, System.Drawing.Imaging.ColorAdjustType.Bitmap); - int FotoLogoH = _LogoAltezza; - int FotoLogoW = _LogoLarghezza; - double FattoreAlt = ImmagineLogo.Height / (double)FotoLogoH; - double FattoreLarg = ImmagineLogo.Width / (double)FotoLogoW; - Size NuovaSize; - if (FattoreLarg > FattoreAlt) - { - NuovaSize = NewthumbSize(ImmagineLogo.Width, ImmagineLogo.Height, FotoLogoW, "Larghezza"); - } - else - { - NuovaSize = NewthumbSize(ImmagineLogo.Width, ImmagineLogo.Height, FotoLogoH, "Altezza"); - } - - int MargineUsato; - int MargineL; - bool InPercentualeL; - if (_LogoMargine.EndsWith("%") == true) - { - InPercentualeL = true; - } - else - { - InPercentualeL = false; - } - - MargineL = Conversions.ToInteger(Conversion.Val(_LogoMargine)); - if (InPercentualeL == true) - { - MargineUsato = Conversions.ToInteger(imgOutputBig.Height * MargineL / 100d); - } - else - { - MargineUsato = MargineL; - } - - var xPosOfWm = default(int); - var yPosOfWm = default(int); - switch (_LogoPosizioneH.ToUpper() ?? "") - { - case "SINISTRA": - case "NESSUNA": - { - xPosOfWm = MargineUsato; - break; - } - - case "CENTRO": - { - xPosOfWm = Conversions.ToInteger((imgOutputBig.Width - NuovaSize.Width) / 2d); - break; - } - - case "DESTRA": - { - xPosOfWm = imgOutputBig.Width - NuovaSize.Width - MargineUsato; - break; - } - } - - switch (_LogoPosizioneV.ToUpper() ?? "") - { - case "ALTO": - case "NESSUNA": - { - yPosOfWm = MargineUsato; - break; - } - - case "CENTRO": - { - yPosOfWm = Conversions.ToInteger((imgOutputBig.Height - NuovaSize.Height) / 2d); - break; - } - - case "BASSO": - { - yPosOfWm = imgOutputBig.Height - NuovaSize.Height - MargineUsato; - break; - } - } - - grWatermark.DrawImage(ImmagineLogo, new Rectangle(xPosOfWm, yPosOfWm, NuovaSize.Width, NuovaSize.Height), 0, 0, ImmagineLogo.Width, ImmagineLogo.Height, GraphicsUnit.Pixel, imageAttributes); - grWatermark.Dispose(); - } - - if (_FotoGrandeDimOrigina == false) - { - imgOutputBig.Save(Path.Combine(_DestDir.FullName, "Temp_" + NomeFileBig), thisFormat); - var g2 = Image.FromFile(Path.Combine(_DestDir.FullName, "Temp_" + NomeFileBig)); - if (g2.Width > g2.Height) - { - thumbSizeBig = NewthumbSize(g2.Width, g2.Height, _LarghezzaBig, "Larghezza"); - } - else - { - thumbSizeBig = NewthumbSize(g2.Width, g2.Height, _AltezzaBig, "Altezza"); - } - - var imgOutputBig2 = new Bitmap(g2, thumbSizeBig.Width, thumbSizeBig.Height); - imgOutputBig2.Save(Path.Combine(_DestDir.FullName, NomeFileBig), thisFormat); - imgOutputBig2.Dispose(); - imgOutputBig.Dispose(); - g2.Dispose(); - } - else - { - imgOutputBig.Save(Path.Combine(_DestDir.FullName, NomeFileBig), thisFormat); - imgOutputBig.Dispose(); - } - - if (_CreaMiniature == true) - { - if (_AggiungiScritteMiniature == true) - { - Image g1; - if (_FotoGrandeDimOrigina == false) - { - g1 = Image.FromFile(Path.Combine(_DestDir.FullName, "Temp_" + NomeFileBig)); - } - else - { - g1 = Image.FromFile(Path.Combine(_DestDir.FullName, NomeFileBig)); - } - - var imgOutputSmall = new Bitmap(g1, thumbSizeSmall.Width, thumbSizeSmall.Height); - if ((_DirectorySorgente.ToUpper() ?? "") == (_DirectoryDestinazione.ToUpper() ?? "")) - { - NomeFileSmall = NomeFileSmall.Substring(0, NomeFileSmall.Length - 4) + Codice + NomeFileSmall.Substring(NomeFileSmall.Length - 4); - } - - imgOutputSmall.Save(Path.Combine(_DestDir.FullName, NomeFileSmall), thisFormat); - imgOutputSmall.Dispose(); - g1.Dispose(); - } - } - - if (File.Exists(Path.Combine(_DestDir.FullName, "Temp_" + NomeFileBig)) == true) - { - FileSystem.Kill(Path.Combine(_DestDir.FullName, "Temp_" + NomeFileBig)); - } - - g.Dispose(); - grPhoto.Dispose(); - if ((_DirectorySorgente.ToUpper() ?? "") == (_DirectoryDestinazione.ToUpper() ?? "")) - { - FileSystem.Kill(Path.Combine(_SourceDir.FullName, NomeFileBig2)); - } - } - - public Size NewthumbSize(int currentwidth, int currentheight, int MaxPixel, string TipoSize) - { - // Calculate the Size of the New image - // *** Larghezza, Altezza, Auto - - double tempMultiplier; - if ((TipoSize.ToUpper() ?? "") == ("Larghezza".ToUpper() ?? "")) - { - tempMultiplier = MaxPixel / (double)currentwidth; - } - else if ((TipoSize.ToUpper() ?? "") == ("Altezza".ToUpper() ?? "")) - { - tempMultiplier = MaxPixel / (double)currentheight; - } - else if (currentheight > currentwidth) // portrait - { - tempMultiplier = MaxPixel / (double)currentheight; - } - else - { - tempMultiplier = MaxPixel / (double)currentwidth; - } - - var NewSize = new Size((int)Math.Round(currentwidth * tempMultiplier), (int)Math.Round(currentheight * tempMultiplier)); - return NewSize; - } - - public string DirectorySorgente - { - get - { - return _DirectorySorgente; - } - - set - { - _DirectorySorgente = value; - } - } - - public string DirectoryDestinazione - { - get - { - return _DirectoryDestinazione; - } - - set - { - _DirectoryDestinazione = value; - } - } - - public DirectoryInfo SourceDir - { - get - { - return _SourceDir; - } - - set - { - _SourceDir = value; - } - } - - public DirectoryInfo DestDirStart - { - get - { - return _DestDirStart; - } - - set - { - _DestDirStart = value; - } - } - - public string TestoFirmaStart - { - get - { - return _TestoFirmaStart; - } - - set - { - _TestoFirmaStart = value; - } - } - - public string TestoFirmaStartV - { - get - { - return _TestoFirmaStartV; - } - - set - { - _TestoFirmaStartV = value; - } - } - - public DateTime DataPartenza - { - get - { - return _DataPartenza; - } - - set - { - _DataPartenza = value; - } - } - - public string TestoOrario - { - get - { - return _TestoOrario; - } - - set - { - _TestoOrario = value; - } - } - - public int DimStandard - { - get - { - return _DimStandard; - } - - set - { - _DimStandard = value; - } - } - - public int DimStandardMiniatura - { - get - { - return _DimStandardMiniatura; - } - - set - { - _DimStandardMiniatura = value; - } - } - - public bool UsaOrarioMiniatura - { - get - { - return _UsaOrarioMiniatura; - } - - set - { - _UsaOrarioMiniatura = value; - } - } - - public bool UsaOrarioTestoApplicare - { - get - { - return _UsaOrarioTestoApplicare; - } - - set - { - _UsaOrarioTestoApplicare = value; - } - } - - public bool UsaTempoGaraTestoApplicare - { - get - { - return _UsaTempoGaraTestoApplicare; - } - - set - { - _UsaTempoGaraTestoApplicare = value; - } - } - - public bool UsaRotazioneAutomatica - { - get - { - return _UsaRotazioneAutomatica; - } - - set - { - _UsaRotazioneAutomatica = value; - } - } - - public bool UsaForzaJpg - { - get - { - return _UsaForzaJpg; - } - - set - { - _UsaForzaJpg = value; - } - } - - public int LarghezzaSmall - { - get - { - return _LarghezzaSmall; - } - - set - { - _LarghezzaSmall = value; - } - } - - public int AltezzaSmall - { - get - { - return _AltezzaSmall; - } - - set - { - _AltezzaSmall = value; - } - } - - public bool CreaMiniature - { - get - { - return _CreaMiniature; - } - - set - { - _CreaMiniature = value; - } - } - - public bool AggiungiScritteMiniature - { - get - { - return _AggiungiScritteMiniature; - } - - set - { - _AggiungiScritteMiniature = value; - } - } - - public string NomeFileChild - { - get - { - return _NomeFileChild; - } - - set - { - _NomeFileChild = value; - } - } - - public string Suffisso - { - get - { - return _Suffisso; - } - - set - { - _Suffisso = value; - } - } - - public string Codice - { - get - { - return _Codice; - } - - set - { - _Codice = value; - } - } - - public int Trasparenza - { - get - { - return _Trasparenza; - } - - set - { - _Trasparenza = value; - } - } - - public string IlFont - { - get - { - return _IlFont; - } - - set - { - _IlFont = value; - } - } - - public bool Grassetto - { - get - { - return _Grassetto; - } - - set - { - _Grassetto = value; - } - } - - public string Posizione - { - get - { - return _Posizione; - } - - set - { - _Posizione = value; - } - } - - public string Allineamento - { - get - { - return _Allineamento; - } - - set - { - _Allineamento = value; - } - } - - public int Margine - { - get - { - return _Margine; - } - - set - { - _Margine = value; - } - } - - public int LogoAltezza - { - get - { - return _LogoAltezza; - } - - set - { - _LogoAltezza = value; - } - } - - public int LogoLarghezza - { - get - { - return _LogoLarghezza; - } - - set - { - _LogoLarghezza = value; - } - } - - public int FontColoreR - { - get - { - return _FontColoreR; - } - - set - { - _FontColoreR = value; - } - } - - public int FontColoreG - { - get - { - return _FontColoreG; - } - - set - { - _FontColoreG = value; - } - } - - public int FontColoreB - { - get - { - return _FontColoreB; - } - - set - { - _FontColoreB = value; - } - } - - public bool LogoAggiungi - { - get - { - return _LogoAggiungi; - } - - set - { - _LogoAggiungi = value; - } - } - - public string LogoNomeFile - { - get - { - return _LogoNomeFile; - } - - set - { - _LogoNomeFile = value; - } - } - - public string LogoTrasparenza - { - get - { - return _LogoTrasparenza; - } - - set - { - _LogoTrasparenza = value; - } - } - - public string LogoMargine - { - get - { - return _LogoMargine; - } - - set - { - _LogoMargine = value; - } - } - - public string LogoPosizioneH - { - get - { - return _LogoPosizioneH; - } - - set - { - _LogoPosizioneH = value; - } - } - - public string LogoPosizioneV - { - get - { - return _LogoPosizioneV; - } - - set - { - _LogoPosizioneV = value; - } - } - - public bool FotoGrandeDimOrigina - { - get - { - return _FotoGrandeDimOrigina; - } - - set - { - _FotoGrandeDimOrigina = value; - } - } - - public int AltezzaBig - { - get - { - return _AltezzaBig; - } - - set - { - _AltezzaBig = value; - } - } - - public int LarghezzaBig - { - get - { - return _LarghezzaBig; - } - - set - { - _LarghezzaBig = value; - } - } - - public DirectoryInfo DestDir - { - get - { - return _DestDir; - } - - set - { - _DestDir = value; - } - } - } -} \ No newline at end of file diff --git a/imagecatalog/CreaImmagineSeparateMultiCore.vb b/imagecatalog/CreaImmagineSeparateMultiCore.vb deleted file mode 100644 index 4b645f8..0000000 --- a/imagecatalog/CreaImmagineSeparateMultiCore.vb +++ /dev/null @@ -1,943 +0,0 @@ -Imports System.IO -'Imports System.Drawing.Drawing2D -'Imports System.Drawing.Imaging -'Imports System.Threading - -Public Class CreaImmagineSeparateMultiCore - - Private _DirectorySorgente As String - Private _DirectoryDestinazione As String - - - Private _SourceDir As DirectoryInfo - Private _DestDirStart As DirectoryInfo - Private _DimStandard As Integer - Private _DimStandardMiniatura As Integer - - - Private _UsaOrarioMiniatura As Boolean - Private _UsaOrarioTestoApplicare As Boolean - Private _UsaTempoGaraTestoApplicare As Boolean - Private _TestoFirmaStart As String - Private _TestoFirmaStartV As String - Private _DataPartenza As DateTime - Private _TestoOrario As String - - Private _UsaRotazioneAutomatica As Boolean - Private _UsaForzaJpg As Boolean - - Private _LarghezzaSmall As Integer - Private _AltezzaSmall As Integer - - Private _CreaMiniature As Boolean - Private _AggiungiScritteMiniature As Boolean - - Private _NomeFileChild As String - Private _Suffisso As String - Private _Codice As String - - Private _Trasparenza As Integer - Private _IlFont As String - Private _Grassetto As Boolean - - Private _Posizione As String - Private _Allineamento As String - Private _Margine As Integer - - Private _LogoAltezza As Integer - Private _LogoLarghezza As Integer - - Private _FontColoreR As Integer - Private _FontColoreG As Integer - Private _FontColoreB As Integer - - Private _LogoAggiungi As Boolean - Private _LogoNomeFile As String - Private _LogoTrasparenza As String - Private _LogoMargine As String - Private _LogoPosizioneH As String - Private _LogoPosizioneV As String - - Private _FotoGrandeDimOrigina As Boolean - Private _AltezzaBig As Integer - Private _LarghezzaBig As Integer - Private _DestDir As DirectoryInfo - - Public Sub CreaImmagine(ByVal InfoImg As PicInfo) - Dim TestoFirma As String = "" - - _DestDir = InfoImg.DirDest - _SourceDir = InfoImg.DirSource - _DestDirStart = InfoImg.DirDestStart - _NomeFileChild = InfoImg.NomeImmagine - - Dim AlphaScelta As Integer = CType((255 * (100 - _Trasparenza) / 100), Integer) - - Dim DimensioneStandard As Integer - Dim DimensioneStandardMiniatura As Integer - - Dim DataFoto As DateTime - Dim DataPartenzaI As DateTime = _DataPartenza - If _TestoOrario.Length > 0 Then - _TestoOrario &= " " - End If - Dim TestoFirmaPiccola As String = "" - - Dim FileConta As Integer = 0 - Dim ContaFileXDir As Integer = 0 - Dim ContaDirXDir As Integer = 0 - Dim TestoTemp As String = "" - Dim ContaTemp As Integer = 0 - - DimensioneStandard = _DimStandard - DimensioneStandardMiniatura = _DimStandardMiniatura - - Dim g As System.Drawing.Image = System.Drawing.Image.FromFile(Path.Combine(_SourceDir.FullName, _NomeFileChild)) - - If _UsaOrarioTestoApplicare = True Or _UsaTempoGaraTestoApplicare = True Or _UsaOrarioMiniatura = True Then - If g.PropertyIdList.Length > 0 Then ' ci sono dati exif - Dim DatiExif As New ExifReader(CType(g, Bitmap)) - DataFoto = DatiExif.DateTimeOriginal - TestoFirma = _TestoFirmaStart - If DataFoto.Year <> 1 Then - TestoFirmaPiccola = DataFoto.ToShortTimeString - If _UsaOrarioTestoApplicare = True Then - TestoFirma &= " - " & DataFoto.ToShortDateString & " " & DataFoto.ToLongTimeString - End If - If _UsaTempoGaraTestoApplicare = True Then - Dim Orario As TimeSpan = New TimeSpan(DateDiff(DateInterval.Second, DataPartenzaI, DataFoto) * 10000000) - TestoFirma &= " - " & _TestoOrario & Orario.Hours.ToString("00") & ":" & Orario.Minutes.ToString("00") & ":" & Orario.Seconds.ToString("00") - End If - End If - End If - Else - TestoFirma = _TestoFirmaStart - End If - - Dim FotoRuotaADestra As Boolean = False - Dim FotoRuotaASinistra As Boolean = False - - If _UsaRotazioneAutomatica = True Then - If g.PropertyIdList.Length > 0 Then ' ci sono dati exif - Dim DatiExif As New ExifReader(CType(g, Bitmap)) - - Select Case DatiExif.Orientation - Case ExifReader.Orientations.BottomLeft - - Case ExifReader.Orientations.BottomRight - - Case ExifReader.Orientations.LeftTop - - Case ExifReader.Orientations.LftBottom - FotoRuotaASinistra = True - Case ExifReader.Orientations.RightBottom - - Case ExifReader.Orientations.RightTop - - Case ExifReader.Orientations.TopLeft - - Case ExifReader.Orientations.TopRight - - End Select - End If - End If - 'rotazione - If FotoRuotaASinistra = True Then - g.RotateFlip(RotateFlipType.Rotate270FlipNone) - End If - If FotoRuotaADestra = True Then - g.RotateFlip(RotateFlipType.Rotate90FlipNone) - End If - - Dim thisFormat As System.Drawing.Imaging.ImageFormat = g.RawFormat - If _UsaForzaJpg = True Then - thisFormat = System.Drawing.Imaging.ImageFormat.Jpeg - End If - - Dim thumbSizeSmall As New Size - Dim thumbSizeBig As New Size - Dim NomeFileSmall As String = "" - Dim NomeFileBig As String = "" - Dim NomeFileBig2 As String = "" - - If g.Width > g.Height Then - thumbSizeSmall = NewthumbSize(g.Width, g.Height, LarghezzaSmall, "Larghezza") - Dim SizeOrig As New Size(g.Width, g.Height) - thumbSizeBig = SizeOrig - Else - thumbSizeSmall = NewthumbSize(g.Width, g.Height, AltezzaSmall, "Altezza") - Dim SizeOrig As New Size(g.Width, g.Height) - thumbSizeBig = SizeOrig - End If - - NomeFileSmall = Suffisso & _NomeFileChild - NomeFileBig = _NomeFileChild - - Dim imgOutputBig As New Bitmap(g, thumbSizeBig.Width, thumbSizeBig.Height) - imgOutputBig.SetResolution(g.HorizontalResolution, g.VerticalResolution) - - If _CreaMiniature = True Then - If _AggiungiScritteMiniature = False Then - If _DirectorySorgente.ToUpper = _DirectoryDestinazione.ToUpper Then - NomeFileSmall = NomeFileSmall.Substring(0, NomeFileSmall.Length - 4) & Codice & NomeFileSmall.Substring(NomeFileSmall.Length - 4) - End If - If _UsaOrarioMiniatura = True Then - If TestoFirmaPiccola.Length > 0 Then - Dim imgOutputSmall As Bitmap - imgOutputSmall = CType(imgOutputBig.Clone, Bitmap) - - Dim grPhoto1 As Graphics - grPhoto1 = Graphics.FromImage(imgOutputSmall) - grPhoto1.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias - - Dim crFont1 As Font = Nothing - Dim crSize1 As SizeF = New SizeF - Dim LarghezzaStandard1 As Integer - - If _Grassetto = True Then - crFont1 = New Font(IlFont, DimensioneStandardMiniatura, FontStyle.Bold) - Else - crFont1 = New Font(_IlFont, DimensioneStandardMiniatura) - End If - - crSize1 = grPhoto1.MeasureString(TestoFirmaPiccola, crFont1) - LarghezzaStandard1 = CType(crSize1.Width, Integer) - - If crSize1.Width > CType(g.Width, Single) Then - Dim Conta As Integer = DimensioneStandardMiniatura - Do - If Conta > 20 Then - Conta -= 5 - Else - Conta -= 1 - End If - If _Grassetto = True Then - crFont1 = New Font(_IlFont, Conta, FontStyle.Bold) - Else - crFont1 = New Font(_IlFont, Conta) - End If - crSize1 = grPhoto1.MeasureString(TestoFirmaPiccola, crFont1) - If crSize1.Width < CType(g.Width, Single) Then - LarghezzaStandard1 = CType(crSize1.Width, Integer) - Exit Do - End If - If Conta <= 5 Then Exit Do - Loop - DimensioneStandardMiniatura = Conta - End If - - Dim yPosFromBottom1 As Single - Select Case _Posizione.ToUpper - Case "ALTO" - yPosFromBottom1 = (_Margine) - - Case "BASSO" - 'yPosFromBottom = (g.Height - _Margine - DimensioneStandard) - 'yPosFromBottom1 = CType((g.Height - crFont1.Height - (g.Height * _Margine / 100) - (crFont1.Height * 0.3)), Single) - yPosFromBottom1 = CType((g.Height - crSize1.Height - (g.Height * _Margine / 100)), Single) - - End Select - - Dim xCenterOfImg1 As Single - Dim StrFormat1 As StringFormat = New StringFormat - Select Case _Allineamento.ToUpper - Case "SINISTRA" - xCenterOfImg1 = CType((_Margine + (LarghezzaStandard1 / 2)), Single) - If (LarghezzaStandard1 / 2) > (g.Width / 2) - _Margine Then - xCenterOfImg1 = CType((g.Width / 2), Single) - End If - - Case "CENTRO" - xCenterOfImg1 = CType((g.Width / 2), Single) - - Case "DESTRA" - xCenterOfImg1 = CType((g.Width - _Margine - (LarghezzaStandard1 / 2)), Single) - If (LarghezzaStandard1 / 2) > (g.Width / 2) - _Margine Then - xCenterOfImg1 = CType((g.Width / 2), Single) - End If - - End Select - StrFormat1.Alignment = StringAlignment.Center - - Dim semiTransBrush21 As SolidBrush = New SolidBrush(Color.FromArgb(AlphaScelta, 0, 0, 0)) - Dim semiTransBrush1 As SolidBrush = New SolidBrush(Color.FromArgb(AlphaScelta, _FontColoreR, _FontColoreG, _FontColoreB)) - - If _Grassetto = True Then - crFont1 = New Font(_IlFont, DimensioneStandardMiniatura, FontStyle.Bold) - Else - crFont1 = New Font(_IlFont, DimensioneStandardMiniatura) - End If - - grPhoto1.DrawString(TestoFirmaPiccola, crFont1, semiTransBrush21, New PointF(xCenterOfImg1 + 1, yPosFromBottom1 + 1), StrFormat1) - grPhoto1.DrawString(TestoFirmaPiccola, crFont1, semiTransBrush1, New PointF(xCenterOfImg1, yPosFromBottom1), StrFormat1) - - imgOutputSmall.Save(Path.Combine(_DestDir.FullName, "Temp_" & NomeFileSmall), thisFormat) - Dim g2 As System.Drawing.Image = System.Drawing.Image.FromFile(Path.Combine(_DestDir.FullName, "Temp_" & NomeFileSmall)) - Dim imgOutputSmall2 As New Bitmap(g2, thumbSizeSmall.Width, thumbSizeSmall.Height) - imgOutputSmall2.Save(Path.Combine(_DestDir.FullName, NomeFileSmall), thisFormat) - - imgOutputSmall2.Dispose() - imgOutputSmall.Dispose() - g2.Dispose() - Kill(Path.Combine(_DestDir.FullName, "Temp_" & NomeFileSmall)) - Else - Dim imgOutputSmall As New Bitmap(g, thumbSizeSmall.Width, thumbSizeSmall.Height) - imgOutputSmall.Save(Path.Combine(_DestDir.FullName, NomeFileSmall), thisFormat) - imgOutputSmall.Dispose() - End If - Else - Dim imgOutputSmall As New Bitmap(g, thumbSizeSmall.Width, thumbSizeSmall.Height) - imgOutputSmall.Save(Path.Combine(_DestDir.FullName, NomeFileSmall), thisFormat) - imgOutputSmall.Dispose() - End If - End If - End If - - Dim grPhoto As Graphics - grPhoto = Graphics.FromImage(imgOutputBig) - grPhoto.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias - - Dim crFont As Font = Nothing - Dim crSize As SizeF = New SizeF - Dim LarghezzaStandard As Integer - - If _Grassetto = True Then - crFont = New Font(_IlFont, DimensioneStandard, FontStyle.Bold) - Else - crFont = New Font(_IlFont, DimensioneStandard) - End If - crSize = grPhoto.MeasureString(TestoFirma, crFont) - LarghezzaStandard = CType(crSize.Width, Integer) - - If crSize.Width > CType(g.Width, Single) Then - Dim Conta As Integer = DimensioneStandard - Do - If Conta > 20 Then - Conta -= 5 - Else - Conta -= 1 - End If - If _Grassetto = True Then - crFont = New Font(_IlFont, Conta, FontStyle.Bold) - Else - crFont = New Font(_IlFont, Conta) - End If - crSize = grPhoto.MeasureString(TestoFirma, crFont) - If crSize.Width < CType(g.Width, Single) Then - LarghezzaStandard = CType(crSize.Width, Integer) - Exit Do - End If - If Conta <= 5 Then Exit Do - Loop - DimensioneStandard = Conta - End If - - Dim yPosFromBottom As Single - Select Case _Posizione.ToUpper - Case "ALTO" - yPosFromBottom = (_Margine) - - Case "BASSO" - 'yPosFromBottom = (g.Height - _Margine - DimensioneStandard) - 'yPosFromBottom = CType((g.Height - DimensioneStandard - (g.Height * _Margine / 100) - (DimensioneStandard * 0.3)), Single) - yPosFromBottom = CType((g.Height - crSize.Height - (g.Height * _Margine / 100)), Single) - End Select - - Dim xCenterOfImg As Single - Dim StrFormat As StringFormat = New StringFormat - Select Case _Allineamento.ToUpper - Case "SINISTRA" - xCenterOfImg = CType((_Margine + (LarghezzaStandard / 2)), Single) - If (LarghezzaStandard / 2) > (g.Width / 2) - _Margine Then - xCenterOfImg = CType((g.Width / 2), Single) - End If - - Case "CENTRO" - xCenterOfImg = CType((g.Width / 2), Single) - - Case "DESTRA" - xCenterOfImg = CType((g.Width - _Margine - (LarghezzaStandard / 2)), Single) - If (LarghezzaStandard / 2) > (g.Width / 2) - _Margine Then - xCenterOfImg = CType((g.Width / 2), Single) - End If - - End Select - StrFormat.Alignment = StringAlignment.Center - - Dim semiTransBrush2 As SolidBrush = New SolidBrush(Color.FromArgb(AlphaScelta, 0, 0, 0)) - Dim semiTransBrush As SolidBrush = New SolidBrush(Color.FromArgb(AlphaScelta, _FontColoreR, _FontColoreG, _FontColoreB)) - - If _Grassetto = True Then - crFont = New Font(_IlFont, DimensioneStandard, FontStyle.Bold) - Else - crFont = New Font(_IlFont, DimensioneStandard) - End If - - grPhoto.DrawString(TestoFirma, crFont, semiTransBrush2, New PointF(xCenterOfImg + 1, yPosFromBottom + 1), StrFormat) - grPhoto.DrawString(TestoFirma, crFont, semiTransBrush, New PointF(xCenterOfImg, yPosFromBottom), StrFormat) - - If _DirectorySorgente.ToUpper = _DirectoryDestinazione.ToUpper Then - NomeFileBig2 = NomeFileBig - NomeFileBig = NomeFileBig.Substring(0, NomeFileBig.Length - 4) & Codice & NomeFileBig.Substring(NomeFileBig.Length - 4) - End If - - - 'imgOutputBig - If _LogoAggiungi = True And File.Exists(_LogoNomeFile) Then - - Dim ImmagineLogo As Image = Image.FromFile(_LogoNomeFile) - - Dim LogoColoreTrasparente As Color = Color.White - 'Dim bmWatermark As Bitmap - - '* Create a Bitmap based on the previously modified photograph Bitmap - 'bmWatermark = New Bitmap(imgOutputBig) - 'bmWatermark.SetResolution(imgOutputBig.HorizontalResolution, imgOutputBig.VerticalResolution) - - '* Load this Bitmap into a new Graphic Object - Dim grWatermark As Graphics = Graphics.FromImage(imgOutputBig) - - '* To achieve a transulcent watermark we will apply (2) color manipulations - Dim imageAttributes As Imaging.ImageAttributes = New Imaging.ImageAttributes - - '* The first step replace the background color with one that is trasparent (Alpha=0, R=0, G=0, B=0) - Dim colorMap As Imaging.ColorMap = New Imaging.ColorMap - - '* background this will be the color we search for and replace with transparency - colorMap.OldColor = LogoColoreTrasparente - colorMap.NewColor = Color.FromArgb(0, 0, 0, 0) - - Dim remapTable As Imaging.ColorMap() = {colorMap} - imageAttributes.SetRemapTable(remapTable, Imaging.ColorAdjustType.Bitmap) - - '* The second color manipulation is used to change the opacity by setting the 3rd row and 3rd column to 0.3f - Dim colorMatrixElements As Single()() = {New Single() {1.0F, 0.0F, 0.0F, 0.0F, 0.0F}, New Single() {0.0F, 1.0F, 0.0F, 0.0F, 0.0F}, New Single() {0.0F, 0.0F, 1.0F, 0.0F, 0.0F}, New Single() {0.0F, 0.0F, 0.0F, CType(_LogoTrasparenza, Single) / 100, 0.0F}, New Single() {0.0F, 0.0F, 0.0F, 0.0F, 1.0F}} - Dim wmColorMatrix As Imaging.ColorMatrix = New Imaging.ColorMatrix(colorMatrixElements) - imageAttributes.SetColorMatrix(wmColorMatrix, Imaging.ColorMatrixFlag.Default, Imaging.ColorAdjustType.Bitmap) - - Dim FotoLogoH As Integer = _LogoAltezza - Dim FotoLogoW As Integer = _LogoLarghezza - Dim FattoreAlt As Double = ImmagineLogo.Height / FotoLogoH - Dim FattoreLarg As Double = ImmagineLogo.Width / FotoLogoW - Dim NuovaSize As Size - If FattoreLarg > FattoreAlt Then - NuovaSize = NewthumbSize(ImmagineLogo.Width, ImmagineLogo.Height, FotoLogoW, "Larghezza") - Else - NuovaSize = NewthumbSize(ImmagineLogo.Width, ImmagineLogo.Height, FotoLogoH, "Altezza") - End If - - Dim MargineUsato As Integer - Dim MargineL As Integer - Dim InPercentualeL As Boolean - If _LogoMargine.EndsWith("%") = True Then - InPercentualeL = True - Else - InPercentualeL = False - End If - MargineL = CType(Val(_LogoMargine), Integer) - If InPercentualeL = True Then - MargineUsato = CType(imgOutputBig.Height * MargineL / 100, Integer) - Else - MargineUsato = MargineL - End If - - Dim xPosOfWm As Integer - Dim yPosOfWm As Integer - Select Case _LogoPosizioneH.ToUpper - Case "SINISTRA", "NESSUNA" - xPosOfWm = MargineUsato - - Case "CENTRO" - xPosOfWm = CType((imgOutputBig.Width - NuovaSize.Width) / 2, Integer) - - Case "DESTRA" - xPosOfWm = ((imgOutputBig.Width - NuovaSize.Width) - MargineUsato) - End Select - Select Case _LogoPosizioneV.ToUpper - Case "ALTO", "NESSUNA" - yPosOfWm = MargineUsato - - Case "CENTRO" - yPosOfWm = CType((imgOutputBig.Height - NuovaSize.Height) / 2, Integer) - - Case "BASSO" - yPosOfWm = ((imgOutputBig.Height - NuovaSize.Height) - MargineUsato) - End Select - - grWatermark.DrawImage(ImmagineLogo, New Rectangle(xPosOfWm, yPosOfWm, NuovaSize.Width, NuovaSize.Height), 0, 0, ImmagineLogo.Width, ImmagineLogo.Height, GraphicsUnit.Pixel, imageAttributes) - grWatermark.Dispose() - End If - - If _FotoGrandeDimOrigina = False Then - imgOutputBig.Save(Path.Combine(_DestDir.FullName, "Temp_" & NomeFileBig), thisFormat) - Dim g2 As System.Drawing.Image = System.Drawing.Image.FromFile(Path.Combine(_DestDir.FullName, "Temp_" & NomeFileBig)) - If g2.Width > g2.Height Then - thumbSizeBig = NewthumbSize(g2.Width, g2.Height, _LarghezzaBig, "Larghezza") - Else - thumbSizeBig = NewthumbSize(g2.Width, g2.Height, _AltezzaBig, "Altezza") - End If - Dim imgOutputBig2 As New Bitmap(g2, thumbSizeBig.Width, thumbSizeBig.Height) - imgOutputBig2.Save(Path.Combine(_DestDir.FullName, NomeFileBig), thisFormat) - imgOutputBig2.Dispose() - imgOutputBig.Dispose() - g2.Dispose() - Else - imgOutputBig.Save(Path.Combine(_DestDir.FullName, NomeFileBig), thisFormat) - imgOutputBig.Dispose() - End If - - If _CreaMiniature = True Then - If _AggiungiScritteMiniature = True Then - Dim g1 As System.Drawing.Image - If _FotoGrandeDimOrigina = False Then - g1 = System.Drawing.Image.FromFile(Path.Combine(_DestDir.FullName, "Temp_" & NomeFileBig)) - Else - g1 = System.Drawing.Image.FromFile(Path.Combine(_DestDir.FullName, NomeFileBig)) - End If - Dim imgOutputSmall As New Bitmap(g1, thumbSizeSmall.Width, thumbSizeSmall.Height) - If _DirectorySorgente.ToUpper = _DirectoryDestinazione.ToUpper Then - NomeFileSmall = NomeFileSmall.Substring(0, NomeFileSmall.Length - 4) & Codice & NomeFileSmall.Substring(NomeFileSmall.Length - 4) - End If - imgOutputSmall.Save(Path.Combine(_DestDir.FullName, NomeFileSmall), thisFormat) - imgOutputSmall.Dispose() - g1.Dispose() - End If - End If - - If File.Exists(Path.Combine(_DestDir.FullName, "Temp_" & NomeFileBig)) = True Then - Kill(Path.Combine(_DestDir.FullName, "Temp_" & NomeFileBig)) - End If - - g.Dispose() - grPhoto.Dispose() - - If _DirectorySorgente.ToUpper = _DirectoryDestinazione.ToUpper Then - Kill(Path.Combine(_SourceDir.FullName, NomeFileBig2)) - End If - - End Sub - - - - Function NewthumbSize(ByVal currentwidth As Integer, ByVal currentheight As Integer, ByVal MaxPixel As Integer, ByVal TipoSize As String) As Size - ' Calculate the Size of the New image - '*** Larghezza, Altezza, Auto - - Dim tempMultiplier As Double - - If TipoSize.ToUpper = "Larghezza".ToUpper Then - tempMultiplier = MaxPixel / currentwidth - ElseIf TipoSize.ToUpper = "Altezza".ToUpper Then - tempMultiplier = MaxPixel / currentheight - Else - If currentheight > currentwidth Then ' portrait - tempMultiplier = MaxPixel / currentheight - Else - tempMultiplier = MaxPixel / currentwidth - End If - End If - - Dim NewSize As New Size(CInt(currentwidth * tempMultiplier), CInt(currentheight * tempMultiplier)) - - Return NewSize - End Function - - - - - Public Property DirectorySorgente() As String - Get - Return _DirectorySorgente - End Get - Set(ByVal value As String) - _DirectorySorgente = value - End Set - End Property - - Public Property DirectoryDestinazione() As String - Get - Return _DirectoryDestinazione - End Get - Set(ByVal value As String) - _DirectoryDestinazione = value - End Set - End Property - - - Public Property SourceDir() As DirectoryInfo - Get - Return _SourceDir - End Get - Set(ByVal value As DirectoryInfo) - _SourceDir = value - End Set - End Property - - Public Property DestDirStart() As DirectoryInfo - Get - Return _DestDirStart - End Get - Set(ByVal value As DirectoryInfo) - _DestDirStart = value - End Set - End Property - - - - Public Property TestoFirmaStart() As String - Get - Return _TestoFirmaStart - End Get - Set(ByVal value As String) - _TestoFirmaStart = value - End Set - End Property - Public Property TestoFirmaStartV() As String - Get - Return _TestoFirmaStartV - End Get - Set(ByVal value As String) - _TestoFirmaStartV = value - End Set - End Property - - Public Property DataPartenza() As DateTime - Get - Return _DataPartenza - End Get - Set(ByVal value As DateTime) - _DataPartenza = value - End Set - End Property - - Public Property TestoOrario() As String - Get - Return _TestoOrario - End Get - Set(ByVal value As String) - _TestoOrario = value - End Set - End Property - - Public Property DimStandard() As Integer - Get - Return _DimStandard - End Get - Set(ByVal value As Integer) - _DimStandard = value - End Set - End Property - - Public Property DimStandardMiniatura() As Integer - Get - Return _DimStandardMiniatura - End Get - Set(ByVal value As Integer) - _DimStandardMiniatura = value - End Set - End Property - - Public Property UsaOrarioMiniatura() As Boolean - Get - Return _UsaOrarioMiniatura - End Get - Set(ByVal value As Boolean) - _UsaOrarioMiniatura = value - End Set - End Property - - Public Property UsaOrarioTestoApplicare() As Boolean - Get - Return _UsaOrarioTestoApplicare - End Get - Set(ByVal value As Boolean) - _UsaOrarioTestoApplicare = value - End Set - End Property - - Public Property UsaTempoGaraTestoApplicare() As Boolean - Get - Return _UsaTempoGaraTestoApplicare - End Get - Set(ByVal value As Boolean) - _UsaTempoGaraTestoApplicare = value - End Set - End Property - - Public Property UsaRotazioneAutomatica() As Boolean - Get - Return _UsaRotazioneAutomatica - End Get - Set(ByVal value As Boolean) - _UsaRotazioneAutomatica = value - End Set - End Property - - Public Property UsaForzaJpg() As Boolean - Get - Return _UsaForzaJpg - End Get - Set(ByVal value As Boolean) - _UsaForzaJpg = value - End Set - End Property - - - - Public Property LarghezzaSmall() As Integer - Get - Return _LarghezzaSmall - End Get - Set(ByVal value As Integer) - _LarghezzaSmall = value - End Set - End Property - - Public Property AltezzaSmall() As Integer - Get - Return _AltezzaSmall - End Get - Set(ByVal value As Integer) - _AltezzaSmall = value - End Set - End Property - - - Public Property CreaMiniature() As Boolean - Get - Return _CreaMiniature - End Get - Set(ByVal value As Boolean) - _CreaMiniature = value - End Set - End Property - - Public Property AggiungiScritteMiniature() As Boolean - Get - Return _AggiungiScritteMiniature - End Get - Set(ByVal value As Boolean) - _AggiungiScritteMiniature = value - End Set - End Property - - Public Property NomeFileChild() As String - Get - Return _NomeFileChild - End Get - Set(ByVal value As String) - _NomeFileChild = value - End Set - End Property - - Public Property Suffisso() As String - Get - Return _Suffisso - End Get - Set(ByVal value As String) - _Suffisso = value - End Set - End Property - - Public Property Codice() As String - Get - Return _Codice - End Get - Set(ByVal value As String) - _Codice = value - End Set - End Property - - - Public Property Trasparenza() As Integer - Get - Return _Trasparenza - End Get - Set(ByVal value As Integer) - _Trasparenza = value - End Set - End Property - - Public Property IlFont() As String - Get - Return _IlFont - End Get - Set(ByVal value As String) - _IlFont = value - End Set - End Property - - Public Property Grassetto() As Boolean - Get - Return _Grassetto - End Get - Set(ByVal value As Boolean) - _Grassetto = value - End Set - End Property - - Public Property Posizione() As String - Get - Return _Posizione - End Get - Set(ByVal value As String) - _Posizione = value - End Set - End Property - - Public Property Allineamento() As String - Get - Return _Allineamento - End Get - Set(ByVal value As String) - _Allineamento = value - End Set - End Property - - Public Property Margine() As Integer - Get - Return _Margine - End Get - Set(ByVal value As Integer) - _Margine = value - End Set - End Property - - Public Property LogoAltezza() As Integer - Get - Return _LogoAltezza - End Get - Set(ByVal value As Integer) - _LogoAltezza = value - End Set - End Property - - Public Property LogoLarghezza() As Integer - Get - Return _LogoLarghezza - End Get - Set(ByVal value As Integer) - _LogoLarghezza = value - End Set - End Property - - Public Property FontColoreR() As Integer - Get - Return _FontColoreR - End Get - Set(ByVal value As Integer) - _FontColoreR = value - End Set - End Property - - Public Property FontColoreG() As Integer - Get - Return _FontColoreG - End Get - Set(ByVal value As Integer) - _FontColoreG = value - End Set - End Property - - Public Property FontColoreB() As Integer - Get - Return _FontColoreB - End Get - Set(ByVal value As Integer) - _FontColoreB = value - End Set - End Property - - Public Property LogoAggiungi() As Boolean - Get - Return _LogoAggiungi - End Get - Set(ByVal value As Boolean) - _LogoAggiungi = value - End Set - End Property - - Public Property LogoNomeFile() As String - Get - Return _LogoNomeFile - End Get - Set(ByVal value As String) - _LogoNomeFile = value - End Set - End Property - - Public Property LogoTrasparenza() As String - Get - Return _LogoTrasparenza - End Get - Set(ByVal value As String) - _LogoTrasparenza = value - End Set - End Property - - Public Property LogoMargine() As String - Get - Return _LogoMargine - End Get - Set(ByVal value As String) - _LogoMargine = value - End Set - End Property - - Public Property LogoPosizioneH() As String - Get - Return _LogoPosizioneH - End Get - Set(ByVal value As String) - _LogoPosizioneH = value - End Set - End Property - - Public Property LogoPosizioneV() As String - Get - Return _LogoPosizioneV - End Get - Set(ByVal value As String) - _LogoPosizioneV = value - End Set - End Property - - Public Property FotoGrandeDimOrigina() As Boolean - Get - Return _FotoGrandeDimOrigina - End Get - Set(ByVal value As Boolean) - _FotoGrandeDimOrigina = value - End Set - End Property - - Public Property AltezzaBig() As Integer - Get - Return _AltezzaBig - End Get - Set(ByVal value As Integer) - _AltezzaBig = value - End Set - End Property - - Public Property LarghezzaBig() As Integer - Get - Return _LarghezzaBig - End Get - Set(ByVal value As Integer) - _LarghezzaBig = value - End Set - End Property - - Public Property DestDir() As DirectoryInfo - Get - Return _DestDir - End Get - Set(ByVal value As DirectoryInfo) - _DestDir = value - End Set - End Property - - - -End Class diff --git a/imagecatalog/CreaImmagineSeparateThread.cs b/imagecatalog/CreaImmagineSeparateThread.cs deleted file mode 100644 index cf80e50..0000000 --- a/imagecatalog/CreaImmagineSeparateThread.cs +++ /dev/null @@ -1,1721 +0,0 @@ -using System; -using System.Drawing; -using System.Drawing.Drawing2D; -using System.Drawing.Imaging; -using System.IO; -using Microsoft.VisualBasic; -using Microsoft.VisualBasic.CompilerServices; - -namespace ImageCatalog -{ - // Imports System.Threading - - public class CreaImmagineSeparateThread - { - /* TODO ERROR: Skipped RegionDirectiveTrivia */ - private string _DirectorySorgente; - private string _DirectoryDestinazione; - private int _DimVert; - private int _MargVert; - private DirectoryInfo _SourceDir; - private DirectoryInfo _DestDirStart; - private int _DimStandard; - private int _DimStandardMiniatura; - private bool _NomeData; - private bool _TestoNome; - private bool _UsaOrarioMiniatura; - private bool _UsaOrarioTestoApplicare; - private bool _UsaTempoGaraTestoApplicare; - private string _TestoFirmaStart; - private string _TestoFirmaStartV; - private DateTime _DataPartenza; - private string _TestoOrario; - private bool _UsaRotazioneAutomatica; - private bool _UsaForzaJpg; - private int _LarghezzaSmall; - private int _AltezzaSmall; - private bool _CreaMiniature; - private bool _AggiungiScritteMiniature; - private bool _AggTempoGaraMin; - private bool _AggNumTempMin; - private string _NomeFileChild; - private string _Suffisso; - private string _Codice; - private int _Trasparenza; - private string _IlFont; - private bool _Grassetto; - private string _Posizione; - private string _Allineamento; - private int _Margine; - private int _LogoAltezza; - private int _LogoLarghezza; - private int _FontColoreR; - private int _FontColoreG; - private int _FontColoreB; - private Color _fontColoreRGB; - private bool _LogoAggiungi; - private string _LogoNomeFile; - private string _LogoTrasparenza; - private string _LogoMargine; - private string _LogoPosizioneH; - private string _LogoPosizioneV; - private bool _FotoGrandeDimOrigina; - private int _AltezzaBig; - private int _LarghezzaBig; - private DirectoryInfo _DestDir; - private int _DimMin; - private bool _TestoMin; - private bool _SecretDefault; - private bool _SecretBig; - private bool _SecretSmall; - private string _SecretPathSmall; - private string _SecretPathBig; - private long _jpegQuality; - private long _jpegQualityMin; - private bool FotoRuotaADestra = false; - private bool FotoRuotaASinistra = false; - private string TempMinText = ""; - // Private crFont1 As Font - - - /* TODO ERROR: Skipped EndRegionDirectiveTrivia */ - private void ProcA(ref Image g, ref DateTime DataFoto, ref string TestoFirma, ref string TestoFirmaV, ref string TestoFirmaPiccola, ref DateTime DataPartenzaI) - { - if (g.PropertyIdList.Length > 0) // ci sono dati exif - { - var DatiExif = new ExifReader((Bitmap)g); - DataFoto = DatiExif.DateTimeOriginal; - TestoFirma = _TestoFirmaStart; - TestoFirmaV = _TestoFirmaStartV; - if (DataFoto.Year != 1) - { - TestoFirmaPiccola = DataFoto.ToShortTimeString(); - if (_UsaOrarioTestoApplicare == true) - { - TestoFirma += " " + DataFoto.ToShortDateString() + " " + DataFoto.ToLongTimeString(); - TestoFirmaV += " " + DataFoto.ToShortDateString() + " " + DataFoto.ToLongTimeString(); - } - - if (_UsaTempoGaraTestoApplicare == true) - { - var Orario = new TimeSpan(DateAndTime.DateDiff(DateInterval.Second, DataPartenzaI, DataFoto) * 10000000L); - TestoFirma += " " + _TestoOrario + Orario.Hours.ToString("00") + ":" + Orario.Minutes.ToString("00") + ":" + Orario.Seconds.ToString("00"); - TestoFirmaV += " " + _TestoOrario + Orario.Hours.ToString("00") + ":" + Orario.Minutes.ToString("00") + ":" + Orario.Seconds.ToString("00"); - } - } - } - } - - private void Rotation(ref Image g) - { - FotoRuotaADestra = false; - FotoRuotaASinistra = false; - if (_UsaRotazioneAutomatica == true) - { - if (g.PropertyIdList.Length > 0) // ci sono dati exif - { - var DatiExif = new ExifReader((Bitmap)g); - switch (DatiExif.Orientation) - { - case ExifReader.Orientations.BottomLeft: - { - break; - } - - case ExifReader.Orientations.BottomRight: - { - break; - } - - case ExifReader.Orientations.LeftTop: - { - break; - } - - case ExifReader.Orientations.LftBottom: - { - FotoRuotaASinistra = true; - break; - } - - case ExifReader.Orientations.RightBottom: - { - break; - } - - case ExifReader.Orientations.RightTop: - { - break; - } - - case ExifReader.Orientations.TopLeft: - { - break; - } - - case ExifReader.Orientations.TopRight: - { - break; - } - } - } - } - - if (FotoRuotaASinistra == true) - { - g.RotateFlip(RotateFlipType.Rotate270FlipNone); - } - - if (FotoRuotaADestra == true) - { - g.RotateFlip(RotateFlipType.Rotate90FlipNone); - } - } - - public void CreaImmagineThread(string Info) - { - string TestoFirma = ""; - string TestoFirmaV = ""; - int AlphaScelta = Conversions.ToInteger(255 * (100 - _Trasparenza) / 100d); - int DimensioneStandard; - int DimensioneStandardMiniatura; - var DataFoto = default(DateTime); - var DataPartenzaI = _DataPartenza; - if (_TestoOrario.Length > 0) - { - _TestoOrario += " "; - } - - string TestoFirmaPiccola = ""; - int FileConta = 0; - int ContaFileXDir = 0; - int ContaDirXDir = 0; - string TestoTemp = ""; - int ContaTemp = 0; - DimensioneStandard = _DimStandard; - DimensioneStandardMiniatura = _DimStandardMiniatura; - var g = Image.FromFile(Path.Combine(_SourceDir.FullName, _NomeFileChild)); - // dati extra in fondo - if (_UsaOrarioTestoApplicare | _UsaTempoGaraTestoApplicare | _UsaOrarioMiniatura | _TestoMin | _AggTempoGaraMin | _AggNumTempMin) - { - ProcA(ref g, ref DataFoto, ref TestoFirma, ref TestoFirmaV, ref TestoFirmaPiccola, ref DataPartenzaI); - } - - // If g.PropertyIdList.Length > 0 Then ' ci sono dati exif - // Dim DatiExif As New ExifReader(CType(g, Bitmap)) - // DataFoto = DatiExif.DateTimeOriginal - // TestoFirma = _TestoFirmaStart - // TestoFirmaV = _TestoFirmaStartV - - // If DataFoto.Year <> 1 Then - // TestoFirmaPiccola = DataFoto.ToShortTimeString - // If _UsaOrarioTestoApplicare = True Then - // TestoFirma &= " - " & DataFoto.ToShortDateString & " " & DataFoto.ToLongTimeString - // TestoFirmaV &= " - " & DataFoto.ToShortDateString & " " & DataFoto.ToLongTimeString - // End If - // If _UsaTempoGaraTestoApplicare = True Then - // Dim Orario As TimeSpan = New TimeSpan(DateDiff(DateInterval.Second, DataPartenzaI, DataFoto) * 10000000) - // TestoFirma &= " - " & _TestoOrario & Orario.Hours.ToString("00") & ":" & Orario.Minutes.ToString("00") & ":" & Orario.Seconds.ToString("00") - // TestoFirmaV &= " - " & _TestoOrario & Orario.Hours.ToString("00") & ":" & Orario.Minutes.ToString("00") & ":" & Orario.Seconds.ToString("00") - // End If - // End If - - // End If - - else - { - TestoFirma = _TestoFirmaStart; - TestoFirmaV = _TestoFirmaStartV; - } - - Rotation(ref g); - - // Dim FotoRuotaADestra As Boolean = False - // Dim FotoRuotaASinistra As Boolean = False - - // If _UsaRotazioneAutomatica = True Then - // If g.PropertyIdList.Length > 0 Then ' ci sono dati exif - // Dim DatiExif As New ExifReader(CType(g, Bitmap)) - - // Select Case DatiExif.Orientation - // Case ExifReader.Orientations.BottomLeft - - // Case ExifReader.Orientations.BottomRight - - // Case ExifReader.Orientations.LeftTop - - // Case ExifReader.Orientations.LftBottom - // FotoRuotaASinistra = True - // Case ExifReader.Orientations.RightBottom - - // Case ExifReader.Orientations.RightTop - - // Case ExifReader.Orientations.TopLeft - - // Case ExifReader.Orientations.TopRight - - // End Select - // End If - // End If - - // If FotoRuotaASinistra = True Then - // g.RotateFlip(RotateFlipType.Rotate270FlipNone) - // End If - // If FotoRuotaADestra = True Then - // g.RotateFlip(RotateFlipType.Rotate90FlipNone) - // End If - - var thisFormat = g.RawFormat; - if (_UsaForzaJpg == true) - { - thisFormat = ImageFormat.Jpeg; - } - - var thumbSizeSmall = new Size(); - var thumbSizeBig = new Size(); - string NomeFileSmall = ""; - string NomeFileBig2 = ""; - string NomeFileBig = ""; - if (g.Width > g.Height) - { - thumbSizeSmall = NewthumbSize(g.Width, g.Height, LarghezzaSmall, "Larghezza"); - var SizeOrig = new Size(g.Width, g.Height); - thumbSizeBig = SizeOrig; - } - else - { - thumbSizeSmall = NewthumbSize(g.Width, g.Height, AltezzaSmall, "Altezza"); - var SizeOrig = new Size(g.Width, g.Height); - thumbSizeBig = SizeOrig; - } - - NomeFileSmall = Suffisso + _NomeFileChild; - NomeFileBig = _NomeFileChild; - var imgOutputBig = new Bitmap(g, thumbSizeBig.Width, thumbSizeBig.Height); - imgOutputBig.SetResolution(g.HorizontalResolution, g.VerticalResolution); - if (_TestoMin) - { - TestoFirmaPiccola = NomeFileBig; - } - else if (_AggNumTempMin) - { - TestoFirmaPiccola = NomeFileBig + " "; - } - - var yPosFromBottom4 = default(float); - Font crFont1 = null; - Font crFont2 = null; - var crSize1 = new SizeF(); - var crSize2 = new SizeF(); - if (_CreaMiniature == true) - { - if (_AggiungiScritteMiniature == false) - { - if ((_DirectorySorgente.ToUpper() ?? "") == (_DirectoryDestinazione.ToUpper() ?? "")) - { - NomeFileSmall = NomeFileSmall.Substring(0, NomeFileSmall.Length - 4) + Codice + NomeFileSmall.Substring(NomeFileSmall.Length - 4); - } - - if (_UsaOrarioMiniatura | _TestoMin | _AggTempoGaraMin | _AggNumTempMin) - { - if (TestoFirmaPiccola.Length > 0) - { - Bitmap imgOutputSmall; - imgOutputSmall = (Bitmap)imgOutputBig.Clone(); - Graphics grPhoto1; - grPhoto1 = Graphics.FromImage(imgOutputSmall); - grPhoto1.SmoothingMode = SmoothingMode.AntiAlias; - - // erano qui - - int LarghezzaStandard1; - // quick fix - DimensioneStandardMiniatura = 50; - if (_Grassetto == true) - { - crFont1 = new Font(IlFont, DimensioneStandardMiniatura, FontStyle.Bold); - crFont2 = new Font(IlFont, DimensioneStandard, FontStyle.Bold); - } - else - { - crFont1 = new Font(_IlFont, DimensioneStandardMiniatura); - crFont2 = new Font(IlFont, DimensioneStandard); - } - - crSize1 = grPhoto1.MeasureString(TestoFirmaPiccola, crFont1); - crSize2 = grPhoto1.MeasureString(TestoFirma, crFont1); - LarghezzaStandard1 = Conversions.ToInteger(crSize1.Width); - if (crSize1.Width > Conversions.ToSingle(g.Width)) - { - int Conta = DimensioneStandardMiniatura; - do - { - if (Conta > 20) - { - Conta -= 5; - } - else - { - Conta -= 1; - } - - if (_Grassetto == true) - { - crFont1 = new Font(_IlFont, Conta, FontStyle.Bold); - } - else - { - crFont1 = new Font(_IlFont, Conta); - } - - crSize1 = grPhoto1.MeasureString(TestoFirmaPiccola, crFont1); - if (crSize1.Width < Conversions.ToSingle(g.Width)) - { - LarghezzaStandard1 = Conversions.ToInteger(crSize1.Width); - break; - } - - if (Conta <= 5) - break; - } - while (true); - DimensioneStandardMiniatura = Conta; - } - - var yPosFromBottom1 = default(float); - switch (_Posizione.ToUpper() ?? "") - { - case "ALTO": - { - yPosFromBottom1 = _Margine; - yPosFromBottom4 = _MargVert; - break; - } - - case "BASSO": - { - // yPosFromBottom = (g.Height - _Margine - DimensioneStandard) - // yPosFromBottom1 = CType((g.Height - crFont1.Height - (g.Height * _Margine / 100) - (crFont1.Height * 0.3)), Single) - yPosFromBottom1 = Conversions.ToSingle(g.Height - crSize1.Height - g.Height * _Margine / 100d); - yPosFromBottom4 = Conversions.ToSingle(g.Height - crSize1.Height - g.Height * _MargVert / 100d); - break; - } - } - - var xCenterOfImg1 = default(float); - var StrFormat1 = new StringFormat(); - switch (_Allineamento.ToUpper() ?? "") - { - case "SINISTRA": - { - xCenterOfImg1 = Conversions.ToSingle(_Margine + LarghezzaStandard1 / 2d); - if (LarghezzaStandard1 / 2d > g.Width / 2d - _Margine) - { - xCenterOfImg1 = Conversions.ToSingle(g.Width / 2d); - } - - break; - } - - case "CENTRO": - { - xCenterOfImg1 = Conversions.ToSingle(g.Width / 2d); - break; - } - - case "DESTRA": - { - xCenterOfImg1 = Conversions.ToSingle(g.Width - _Margine - LarghezzaStandard1 / 2d); - if (LarghezzaStandard1 / 2d > g.Width / 2d - _Margine) - { - xCenterOfImg1 = Conversions.ToSingle(g.Width / 2d); - } - - break; - } - } - - StrFormat1.Alignment = StringAlignment.Center; - var semiTransBrush21 = new SolidBrush(Color.FromArgb(AlphaScelta, 0, 0, 0)); - var semiTransBrush1 = new SolidBrush(Color.FromArgb(AlphaScelta, _FontColoreR, _FontColoreG, _FontColoreB)); - // quick fix - DimensioneStandardMiniatura = _DimMin; - if (_Grassetto == true) - { - crFont1 = new Font(_IlFont, DimensioneStandardMiniatura, FontStyle.Bold); - } - else - { - crFont1 = new Font(_IlFont, DimensioneStandardMiniatura); - } - // asdgadfhdfhjgfsjgfjygfdhsdafa - if (_TestoMin) - { - grPhoto1.DrawString(NomeFileBig, crFont1, semiTransBrush21, new PointF(xCenterOfImg1 + 1f, yPosFromBottom1 + 1f), StrFormat1); - grPhoto1.DrawString(NomeFileBig, crFont1, semiTransBrush1, new PointF(xCenterOfImg1, yPosFromBottom1), StrFormat1); - } - else if (_AggTempoGaraMin & _UsaTempoGaraTestoApplicare) - { - var Orario = new TimeSpan(DateAndTime.DateDiff(DateInterval.Second, DataPartenzaI, DataFoto) * 10000000L); - string tempstr = ""; - tempstr += ControlChars.CrLf + _TestoOrario + Orario.Hours.ToString("00") + ":" + Orario.Minutes.ToString("00") + ":" + Orario.Seconds.ToString("00"); - grPhoto1.DrawString(tempstr, crFont1, semiTransBrush21, new PointF(xCenterOfImg1 + 1f, yPosFromBottom1 + 1f), StrFormat1); - grPhoto1.DrawString(tempstr, crFont1, semiTransBrush1, new PointF(xCenterOfImg1, yPosFromBottom1), StrFormat1); - } - else if (_AggNumTempMin) - { - var Orario = new TimeSpan(DateAndTime.DateDiff(DateInterval.Second, DataPartenzaI, DataFoto) * 10000000L); - string tempstr = ""; - tempstr += NomeFileBig; - tempstr += ControlChars.CrLf + _TestoOrario + Orario.Hours.ToString("00") + ":" + Orario.Minutes.ToString("00") + ":" + Orario.Seconds.ToString("00"); - grPhoto1.DrawString(tempstr, crFont1, semiTransBrush21, new PointF(xCenterOfImg1 + 1f, yPosFromBottom1 + 1f), StrFormat1); - grPhoto1.DrawString(tempstr, crFont1, semiTransBrush1, new PointF(xCenterOfImg1, yPosFromBottom1), StrFormat1); - } - else - { - grPhoto1.DrawString(TestoFirmaPiccola, crFont1, semiTransBrush21, new PointF(xCenterOfImg1 + 1f, yPosFromBottom1 + 1f), StrFormat1); - grPhoto1.DrawString(TestoFirmaPiccola, crFont1, semiTransBrush1, new PointF(xCenterOfImg1, yPosFromBottom1), StrFormat1); - } - - imgOutputSmall.Save(Path.Combine(_DestDir.FullName, "Temp_" + NomeFileSmall), thisFormat); - var g2 = Image.FromFile(Path.Combine(_DestDir.FullName, "Temp_" + NomeFileSmall)); - var imgOutputSmall2 = new Bitmap(g2, thumbSizeSmall.Width, thumbSizeSmall.Height); - imgOutputSmall2.Save(Path.Combine(_DestDir.FullName, NomeFileSmall), thisFormat); - imgOutputSmall2.Dispose(); - imgOutputSmall.Dispose(); - g2.Dispose(); - FileSystem.Kill(Path.Combine(_DestDir.FullName, "Temp_" + NomeFileSmall)); - } - else - { - var imgOutputSmall = new Bitmap(g, thumbSizeSmall.Width, thumbSizeSmall.Height); - imgOutputSmall.Save(Path.Combine(_DestDir.FullName, NomeFileSmall), thisFormat); - imgOutputSmall.Dispose(); - } - } - else - { - var imgOutputSmall = new Bitmap(g, thumbSizeSmall.Width, thumbSizeSmall.Height); - imgOutputSmall.Save(Path.Combine(_DestDir.FullName, NomeFileSmall), thisFormat); - imgOutputSmall.Dispose(); - } - } - } - - Graphics grPhoto; - grPhoto = Graphics.FromImage(imgOutputBig); - grPhoto.SmoothingMode = SmoothingMode.AntiAlias; - Font crFont = null; - var crSize = new SizeF(); - int LarghezzaStandard; - if (_Grassetto == true) - { - crFont = new Font(_IlFont, DimensioneStandard, FontStyle.Bold); - } - else - { - crFont = new Font(_IlFont, DimensioneStandard); - } - - crSize = grPhoto.MeasureString(TestoFirma, crFont); - LarghezzaStandard = Conversions.ToInteger(crSize.Width); - if (crSize.Width > Conversions.ToSingle(g.Width)) - { - int Conta = DimensioneStandard; - do - { - if (Conta > 20) - { - Conta -= 5; - } - else - { - Conta -= 1; - } - - if (_Grassetto == true) - { - crFont = new Font(_IlFont, Conta, FontStyle.Bold); - } - else - { - crFont = new Font(_IlFont, Conta); - } - - crSize = grPhoto.MeasureString(TestoFirma, crFont); - if (crSize.Width < Conversions.ToSingle(g.Width)) - { - LarghezzaStandard = Conversions.ToInteger(crSize.Width); - break; - } - - if (Conta <= 5) - break; - } - while (true); - DimensioneStandard = Conta; - } - - var yPosFromBottom = default(float); - var yPosFromBottom3 = default(float); - switch (_Posizione.ToUpper() ?? "") - { - case "ALTO": - { - yPosFromBottom = _Margine; - yPosFromBottom3 = _MargVert; - break; - } - - case "BASSO": - { - // yPosFromBottom = (g.Height - _Margine - DimensioneStandard) - // yPosFromBottom = CType((g.Height - DimensioneStandard - (g.Height * _Margine / 100) - (DimensioneStandard * 0.3)), Single) - yPosFromBottom = Conversions.ToSingle(g.Height - crSize.Height - g.Height * _Margine / 100d); - yPosFromBottom3 = Conversions.ToSingle(g.Height - crSize.Height - g.Height * _MargVert / 100d); - break; - } - } - - var xCenterOfImg = default(float); - float xCenterOfImg3; - var StrFormat = new StringFormat(); - switch (_Allineamento.ToUpper() ?? "") - { - case "SINISTRA": - { - xCenterOfImg = Conversions.ToSingle(_Margine + LarghezzaStandard / 2d); - xCenterOfImg3 = Conversions.ToSingle(_MargVert + LarghezzaStandard / 2d); - if (LarghezzaStandard / 2d > g.Width / 2d - _Margine) - { - xCenterOfImg = Conversions.ToSingle(g.Width / 2d); - } - - if (LarghezzaStandard / 2d > g.Width / 2d - _MargVert) - { - xCenterOfImg3 = Conversions.ToSingle(g.Width / 2d); - } - - break; - } - - case "CENTRO": - { - xCenterOfImg = Conversions.ToSingle(g.Width / 2d); - break; - } - - case "DESTRA": - { - xCenterOfImg = Conversions.ToSingle(g.Width - _Margine - LarghezzaStandard / 2d); - xCenterOfImg3 = Conversions.ToSingle(g.Width - _MargVert - LarghezzaStandard / 2d); - if (LarghezzaStandard / 2d > g.Width / 2d - _Margine) - { - xCenterOfImg = Conversions.ToSingle(g.Width / 2d); - } - - if (LarghezzaStandard / 2d > g.Width / 2d - _MargVert) - { - xCenterOfImg3 = Conversions.ToSingle(g.Width / 2d); - } - - break; - } - } - - StrFormat.Alignment = StringAlignment.Center; - var semiTransBrush2 = new SolidBrush(Color.FromArgb(AlphaScelta, 0, 0, 0)); - var semiTransBrush = new SolidBrush(Color.FromArgb(AlphaScelta, _FontColoreR, _FontColoreG, _FontColoreB)); - if (FotoRuotaADestra | FotoRuotaASinistra) - { - if (_Grassetto == true) - { - crFont = new Font(_IlFont, DimVert, FontStyle.Bold); - } - else - { - crFont = new Font(_IlFont, DimVert); - } - } - else if (_Grassetto == true) - { - crFont = new Font(_IlFont, DimensioneStandard, FontStyle.Bold); - } - else - { - crFont = new Font(_IlFont, DimensioneStandard); - } - - aggiungiTesto(g, DataFoto, grPhoto, NomeFileBig, crFont, semiTransBrush, semiTransBrush2, xCenterOfImg, yPosFromBottom, StrFormat, TestoFirmaV, yPosFromBottom3, yPosFromBottom4, TestoFirma, NomeFileBig2); - aggiungiLogo(imgOutputBig); - salvaFoto(imgOutputBig, thumbSizeBig, NomeFileBig, NomeFileSmall, thumbSizeSmall); - g.Dispose(); - grPhoto.Dispose(); - GC.Collect(); - } - - private void aggiungiTesto(Image g, DateTime DataFoto, Graphics grPhoto, string NomeFileBig, Font crFont, SolidBrush semiTransBrush, SolidBrush semiTransBrush2, float xCenterOfImg, float yPosFromBottom, StringFormat StrFormat, string TestoFirmav, float yPosFromBottom3, float yPosFromBottom4, string TestoFirma, string NomeFileBig2) - { - // qui scrive il testo (nomefilebig) - if (_TestoNome) - { - if (NomeData & g.PropertyIdList.Length > 0) - { - var DatiExif = new ExifReader((Bitmap)g); - DataFoto = DatiExif.DateTimeOriginal; - grPhoto.DrawString(NomeFileBig + " " + DataFoto.ToShortDateString(), crFont, semiTransBrush2, new PointF(xCenterOfImg + 1f, yPosFromBottom + 1f), StrFormat); - grPhoto.DrawString(NomeFileBig + " " + DataFoto.ToShortDateString(), crFont, semiTransBrush, new PointF(xCenterOfImg, yPosFromBottom), StrFormat); - } - else - { - grPhoto.DrawString(NomeFileBig, crFont, semiTransBrush2, new PointF(xCenterOfImg + 1f, yPosFromBottom + 1f), StrFormat); - grPhoto.DrawString(NomeFileBig, crFont, semiTransBrush, new PointF(xCenterOfImg, yPosFromBottom), StrFormat); - } - } - - if (_TestoNome == false) - { - if (FotoRuotaADestra | FotoRuotaASinistra) - { - if (_TestoMin == false) - { - grPhoto.DrawString(TestoFirmav, crFont, semiTransBrush2, new PointF(xCenterOfImg + 1f, yPosFromBottom3 + 1f), StrFormat); - grPhoto.DrawString(TestoFirmav, crFont, semiTransBrush, new PointF(xCenterOfImg, yPosFromBottom3), StrFormat); - } - - if (_TestoMin == true) - { - grPhoto.DrawString(TestoFirmav, crFont, semiTransBrush2, new PointF(xCenterOfImg + 1f, yPosFromBottom4 + 1f), StrFormat); - grPhoto.DrawString(TestoFirmav, crFont, semiTransBrush, new PointF(xCenterOfImg, yPosFromBottom4), StrFormat); - } - } - else - { - grPhoto.DrawString(TestoFirma, crFont, semiTransBrush2, new PointF(xCenterOfImg + 1f, yPosFromBottom + 1f), StrFormat); - grPhoto.DrawString(TestoFirma, crFont, semiTransBrush, new PointF(xCenterOfImg, yPosFromBottom), StrFormat); - } - } - - if ((_DirectorySorgente.ToUpper() ?? "") == (_DirectoryDestinazione.ToUpper() ?? "")) - { - NomeFileBig2 = NomeFileBig; - NomeFileBig = NomeFileBig.Substring(0, NomeFileBig.Length - 4) + Codice + NomeFileBig.Substring(NomeFileBig.Length - 4); - } - } - - private void aggiungiLogo(Bitmap imgOutputBig) - { - // imgOutputBig - if (_LogoAggiungi == true & File.Exists(_LogoNomeFile)) - { - var ImmagineLogo = Image.FromFile(_LogoNomeFile); - var LogoColoreTrasparente = Color.White; - // Dim bmWatermark As Bitmap - - // * Create a Bitmap based on the previously modified photograph Bitmap - // bmWatermark = New Bitmap(imgOutputBig) - // bmWatermark.SetResolution(imgOutputBig.HorizontalResolution, imgOutputBig.VerticalResolution) - - // * Load this Bitmap into a new Graphic Object - var grWatermark = Graphics.FromImage(imgOutputBig); - - // * To achieve a transulcent watermark we will apply (2) color manipulations - var imageAttributes = new ImageAttributes(); - - // * The first step replace the background color with one that is trasparent (Alpha=0, R=0, G=0, B=0) - var colorMap = new ColorMap(); - - // * background this will be the color we search for and replace with transparency - colorMap.OldColor = LogoColoreTrasparente; - colorMap.NewColor = Color.FromArgb(0, 0, 0, 0); - var remapTable = new[] { colorMap }; - 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 - var 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, Conversions.ToSingle(_LogoTrasparenza) / 100f, 0.0f }, new float[] { 0.0f, 0.0f, 0.0f, 0.0f, 1.0f } }; - var wmColorMatrix = new ColorMatrix(colorMatrixElements); - imageAttributes.SetColorMatrix(wmColorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap); - int FotoLogoH = _LogoAltezza; - int FotoLogoW = _LogoLarghezza; - double FattoreAlt = ImmagineLogo.Height / (double)FotoLogoH; - double FattoreLarg = ImmagineLogo.Width / (double)FotoLogoW; - Size NuovaSize; - if (FattoreLarg > FattoreAlt) - { - NuovaSize = NewthumbSize(ImmagineLogo.Width, ImmagineLogo.Height, FotoLogoW, "Larghezza"); - } - else - { - NuovaSize = NewthumbSize(ImmagineLogo.Width, ImmagineLogo.Height, FotoLogoH, "Altezza"); - } - - int MargineUsato; - int MargineL; - bool InPercentualeL; - if (_LogoMargine.EndsWith("%") == true) - { - InPercentualeL = true; - } - else - { - InPercentualeL = false; - } - - MargineL = Conversions.ToInteger(Conversion.Val(_LogoMargine)); - if (InPercentualeL == true) - { - MargineUsato = Conversions.ToInteger(imgOutputBig.Height * MargineL / 100d); - } - else - { - MargineUsato = MargineL; - } - - var xPosOfWm = default(int); - var yPosOfWm = default(int); - switch (_LogoPosizioneH.ToUpper() ?? "") - { - case "SINISTRA": - case "NESSUNA": - { - xPosOfWm = MargineUsato; - break; - } - - case "CENTRO": - { - xPosOfWm = Conversions.ToInteger((imgOutputBig.Width - NuovaSize.Width) / 2d); - break; - } - - case "DESTRA": - { - xPosOfWm = imgOutputBig.Width - NuovaSize.Width - MargineUsato; - break; - } - } - - switch (_LogoPosizioneV.ToUpper() ?? "") - { - case "ALTO": - case "NESSUNA": - { - yPosOfWm = MargineUsato; - break; - } - - case "CENTRO": - { - yPosOfWm = Conversions.ToInteger((imgOutputBig.Height - NuovaSize.Height) / 2d); - break; - } - - case "BASSO": - { - yPosOfWm = imgOutputBig.Height - NuovaSize.Height - MargineUsato; - break; - } - } - - grWatermark.DrawImage(ImmagineLogo, new Rectangle(xPosOfWm, yPosOfWm, NuovaSize.Width, NuovaSize.Height), 0, 0, ImmagineLogo.Width, ImmagineLogo.Height, GraphicsUnit.Pixel, imageAttributes); - grWatermark.Dispose(); - } - } - - private void salvaFoto(Bitmap imgOutputBig, Size thumbSizeBig, string NomeFileBig, string NomeFileSmall, Size thumbSizeSmall) - { - if (_FotoGrandeDimOrigina == false) - { - // attenzione non controlla se è png - // imgOutputBig.Save(Path.Combine(_DestDir.FullName, "Temp_" & NomeFileBig), thisFormat) - salvaImmagineCustomQuality(imgOutputBig, Path.Combine(_DestDir.FullName, "Temp_" + NomeFileBig), jpegQuality); - var g2 = Image.FromFile(Path.Combine(_DestDir.FullName, "Temp_" + NomeFileBig)); - if (g2.Width > g2.Height) - { - thumbSizeBig = NewthumbSize(g2.Width, g2.Height, _LarghezzaBig, "Larghezza"); - } - else - { - thumbSizeBig = NewthumbSize(g2.Width, g2.Height, _AltezzaBig, "Altezza"); - } - - var imgOutputBig2 = new Bitmap(g2, thumbSizeBig.Width, thumbSizeBig.Height); - // imgOutputBig2.Save(Path.Combine(_DestDir.FullName, NomeFileBig), thisFormat) - salvaImmagineCustomQuality(imgOutputBig2, Path.Combine(_DestDir.FullName, NomeFileBig), jpegQuality); - // imgOutputBig2.Dispose() - // imgOutputBig.Dispose() - g2.Dispose(); - } - else - { - // imgOutputBig.Save(Path.Combine(_DestDir.FullName, NomeFileBig), thisFormat) - salvaImmagineCustomQuality(imgOutputBig, Path.Combine(_DestDir.FullName, NomeFileBig), jpegQuality); - imgOutputBig.Dispose(); - } - - if (_CreaMiniature) - { - if (_AggiungiScritteMiniature == true) - { - Image g1; - if (_FotoGrandeDimOrigina == false) - { - g1 = Image.FromFile(Path.Combine(_DestDir.FullName, "Temp_" + NomeFileBig)); - } - else - { - g1 = Image.FromFile(Path.Combine(_DestDir.FullName, NomeFileBig)); - } - - var imgOutputSmall = new Bitmap(g1, thumbSizeSmall.Width, thumbSizeSmall.Height); - if ((_DirectorySorgente.ToUpper() ?? "") == (_DirectoryDestinazione.ToUpper() ?? "")) - { - NomeFileSmall = NomeFileSmall.Substring(0, NomeFileSmall.Length - 4) + Codice + NomeFileSmall.Substring(NomeFileSmall.Length - 4); - } - // imgOutputSmall.Save(Path.Combine(_DestDir.FullName, NomeFileSmall), thisFormat) - salvaImmagineCustomQuality(imgOutputSmall, Path.Combine(_DestDir.FullName, NomeFileSmall), jpegQualityMin); - // imgOutputSmall.Dispose() - g1.Dispose(); - } - } - - if (File.Exists(Path.Combine(_DestDir.FullName, "Temp_" + NomeFileBig)) == true) - { - FileSystem.Kill(Path.Combine(_DestDir.FullName, "Temp_" + NomeFileBig)); - } - } - - private void salvaImmagineCustomQuality(Bitmap imageToSave, string nomeFileFinale, long quality) - { - var JgpEncoder = GetEncoder(ImageFormat.Jpeg); - var MyEncoder = Encoder.Quality; - var MyEncoderParameters = new EncoderParameters(1); - var MyEncoderParameter = new EncoderParameter(MyEncoder, jpegQuality); - MyEncoderParameters.Param[0] = MyEncoderParameter; - imageToSave.Save(nomeFileFinale, JgpEncoder, MyEncoderParameters); - imageToSave.Dispose(); - } - - private ImageCodecInfo GetEncoder(ImageFormat format) - { - var codecs = ImageCodecInfo.GetImageDecoders(); - foreach (var codec in codecs) - { - if (codec.FormatID == format.Guid) - { - return codec; - } - } - - return null; - } - - - - - - - /// - /// Calculate the Size of the New image - /// - /// Larghezza - /// Altezza - /// - /// - /// - /// - public Size NewthumbSize(int currentwidth, int currentheight, int MaxPixel, string TipoSize) - { - // e - // *** Larghezza, Altezza, Auto - - double tempMultiplier; - if ((TipoSize.ToUpper() ?? "") == ("Larghezza".ToUpper() ?? "")) - { - tempMultiplier = MaxPixel / (double)currentwidth; - } - else if ((TipoSize.ToUpper() ?? "") == ("Altezza".ToUpper() ?? "")) - { - tempMultiplier = MaxPixel / (double)currentheight; - } - else if (currentheight > currentwidth) // portrait - { - tempMultiplier = MaxPixel / (double)currentheight; - } - else - { - tempMultiplier = MaxPixel / (double)currentwidth; - } - - var NewSize = new Size((int)Math.Round(currentwidth * tempMultiplier), (int)Math.Round(currentheight * tempMultiplier)); - return NewSize; - } - - public string DirectorySorgente - { - get - { - return _DirectorySorgente; - } - - set - { - _DirectorySorgente = value; - } - } - - public string DirectoryDestinazione - { - get - { - return _DirectoryDestinazione; - } - - set - { - _DirectoryDestinazione = value; - } - } - - public DirectoryInfo SourceDir - { - get - { - return _SourceDir; - } - - set - { - _SourceDir = value; - } - } - - public DirectoryInfo DestDirStart - { - get - { - return _DestDirStart; - } - - set - { - _DestDirStart = value; - } - } - - public string TestoFirmaStart - { - get - { - return _TestoFirmaStart; - } - - set - { - _TestoFirmaStart = value; - } - } - - public string TestoFirmaStartV - { - get - { - return _TestoFirmaStartV; - } - - set - { - _TestoFirmaStartV = value; - } - } - - public DateTime DataPartenza - { - get - { - return _DataPartenza; - } - - set - { - _DataPartenza = value; - } - } - - public string TestoOrario - { - get - { - return _TestoOrario; - } - - set - { - _TestoOrario = value; - } - } - - public int DimStandard - { - get - { - return _DimStandard; - } - - set - { - _DimStandard = value; - } - } - - public int DimStandardMiniatura - { - get - { - return _DimStandardMiniatura; - } - - set - { - _DimStandardMiniatura = value; - } - } - - public bool NomeData - { - get - { - return _NomeData; - } - - set - { - _NomeData = value; - } - } - - public bool TestoNome - { - get - { - return _TestoNome; - } - - set - { - _TestoNome = value; - } - } - - public bool UsaOrarioMiniatura - { - get - { - return _UsaOrarioMiniatura; - } - - set - { - _UsaOrarioMiniatura = value; - } - } - - public bool UsaOrarioTestoApplicare - { - get - { - return _UsaOrarioTestoApplicare; - } - - set - { - _UsaOrarioTestoApplicare = value; - } - } - - public bool UsaTempoGaraTestoApplicare - { - get - { - return _UsaTempoGaraTestoApplicare; - } - - set - { - _UsaTempoGaraTestoApplicare = value; - } - } - - public bool UsaRotazioneAutomatica - { - get - { - return _UsaRotazioneAutomatica; - } - - set - { - _UsaRotazioneAutomatica = value; - } - } - - public bool UsaForzaJpg - { - get - { - return _UsaForzaJpg; - } - - set - { - _UsaForzaJpg = value; - } - } - - public int LarghezzaSmall - { - get - { - return _LarghezzaSmall; - } - - set - { - _LarghezzaSmall = value; - } - } - - public int AltezzaSmall - { - get - { - return _AltezzaSmall; - } - - set - { - _AltezzaSmall = value; - } - } - - public bool CreaMiniature - { - get - { - return _CreaMiniature; - } - - set - { - _CreaMiniature = value; - } - } - - public bool AggiungiScritteMiniature - { - get - { - return _AggiungiScritteMiniature; - } - - set - { - _AggiungiScritteMiniature = value; - } - } - - public string NomeFileChild - { - get - { - return _NomeFileChild; - } - - set - { - _NomeFileChild = value; - } - } - - public string Suffisso - { - get - { - return _Suffisso; - } - - set - { - _Suffisso = value; - } - } - - public string Codice - { - get - { - return _Codice; - } - - set - { - _Codice = value; - } - } - - public int Trasparenza - { - get - { - return _Trasparenza; - } - - set - { - _Trasparenza = value; - } - } - - public string IlFont - { - get - { - return _IlFont; - } - - set - { - _IlFont = value; - } - } - - public bool Grassetto - { - get - { - return _Grassetto; - } - - set - { - _Grassetto = value; - } - } - - public string Posizione - { - get - { - return _Posizione; - } - - set - { - _Posizione = value; - } - } - - public string Allineamento - { - get - { - return _Allineamento; - } - - set - { - _Allineamento = value; - } - } - - public int Margine - { - get - { - return _Margine; - } - - set - { - _Margine = value; - } - } - - public int LogoAltezza - { - get - { - return _LogoAltezza; - } - - set - { - _LogoAltezza = value; - } - } - - public int LogoLarghezza - { - get - { - return _LogoLarghezza; - } - - set - { - _LogoLarghezza = value; - } - } - - public int FontColoreR - { - get - { - return _FontColoreR; - } - - set - { - _FontColoreR = value; - } - } - - public int FontColoreG - { - get - { - return _FontColoreG; - } - - set - { - _FontColoreG = value; - } - } - - public int FontColoreB - { - get - { - return _FontColoreB; - } - - set - { - _FontColoreB = value; - } - } - - public Color fontColoreRGB - { - get - { - return _fontColoreRGB; - } - - set - { - _fontColoreRGB = value; - } - } - - public bool LogoAggiungi - { - get - { - return _LogoAggiungi; - } - - set - { - _LogoAggiungi = value; - } - } - - public string LogoNomeFile - { - get - { - return _LogoNomeFile; - } - - set - { - _LogoNomeFile = value; - } - } - - public string LogoTrasparenza - { - get - { - return _LogoTrasparenza; - } - - set - { - _LogoTrasparenza = value; - } - } - - public string LogoMargine - { - get - { - return _LogoMargine; - } - - set - { - _LogoMargine = value; - } - } - - public string LogoPosizioneH - { - get - { - return _LogoPosizioneH; - } - - set - { - _LogoPosizioneH = value; - } - } - - public string LogoPosizioneV - { - get - { - return _LogoPosizioneV; - } - - set - { - _LogoPosizioneV = value; - } - } - - public bool FotoGrandeDimOrigina - { - get - { - return _FotoGrandeDimOrigina; - } - - set - { - _FotoGrandeDimOrigina = value; - } - } - - public int AltezzaBig - { - get - { - return _AltezzaBig; - } - - set - { - _AltezzaBig = value; - } - } - - public int LarghezzaBig - { - get - { - return _LarghezzaBig; - } - - set - { - _LarghezzaBig = value; - } - } - - public DirectoryInfo DestDir - { - get - { - return _DestDir; - } - - set - { - _DestDir = value; - } - } - - public int DimVert - { - get - { - return _DimVert; - } - - set - { - _DimVert = value; - } - } - - public int MargVert - { - get - { - return _MargVert; - } - - set - { - _MargVert = value; - } - } - - public bool TestoMin - { - get - { - return _TestoMin; - } - - set - { - _TestoMin = value; - } - } - - public int DimMin - { - get - { - return _DimMin; - } - - set - { - _DimMin = value; - } - } - - public bool SecretDefault - { - get - { - return _SecretDefault; - } - - set - { - _SecretDefault = value; - } - } - - public bool SecretBig - { - get - { - return _SecretBig; - } - - set - { - _SecretBig = value; - } - } - - public bool SecretSmall - { - get - { - return _SecretSmall; - } - - set - { - _SecretSmall = value; - } - } - - public string SecretPathSmall - { - get - { - return _SecretPathSmall; - } - - set - { - _SecretPathSmall = value; - } - } - - public string SecretPathBig - { - get - { - return _SecretPathBig; - } - - set - { - _SecretPathBig = value; - } - } - - public bool AggTempoGaraMin - { - get - { - return _AggTempoGaraMin; - } - - set - { - _AggTempoGaraMin = value; - } - } - - public bool AggNumTempMin - { - get - { - return _AggNumTempMin; - } - - set - { - _AggNumTempMin = value; - } - } - - public long jpegQuality - { - get - { - return _jpegQuality; - } - - set - { - _jpegQuality = value; - } - } - - public long jpegQualityMin - { - get - { - return _jpegQualityMin; - } - - set - { - _jpegQualityMin = value; - } - } - } -} \ No newline at end of file diff --git a/imagecatalog/CreaImmagineSeparateThread.vb b/imagecatalog/CreaImmagineSeparateThread.vb deleted file mode 100644 index 59767e6..0000000 --- a/imagecatalog/CreaImmagineSeparateThread.vb +++ /dev/null @@ -1,1409 +0,0 @@ -Imports System.IO -Imports System.Drawing.Drawing2D -Imports System.Drawing.Imaging -'Imports System.Threading - -Public Class CreaImmagineSeparateThread -#Region "dichiarazioni" - Private _DirectorySorgente As String - Private _DirectoryDestinazione As String - - Private _DimVert As Integer - Private _MargVert As Integer - - Private _SourceDir As DirectoryInfo - Private _DestDirStart As DirectoryInfo - Private _DimStandard As Integer - Private _DimStandardMiniatura As Integer - - Private _NomeData As Boolean - Private _TestoNome As Boolean - Private _UsaOrarioMiniatura As Boolean - Private _UsaOrarioTestoApplicare As Boolean - Private _UsaTempoGaraTestoApplicare As Boolean - Private _TestoFirmaStart As String - Private _TestoFirmaStartV As String - Private _DataPartenza As DateTime - Private _TestoOrario As String - - Private _UsaRotazioneAutomatica As Boolean - Private _UsaForzaJpg As Boolean - - Private _LarghezzaSmall As Integer - Private _AltezzaSmall As Integer - - Private _CreaMiniature As Boolean - Private _AggiungiScritteMiniature As Boolean - Private _AggTempoGaraMin As Boolean - Private _AggNumTempMin As Boolean - - - Private _NomeFileChild As String - Private _Suffisso As String - Private _Codice As String - - Private _Trasparenza As Integer - Private _IlFont As String - Private _Grassetto As Boolean - - Private _Posizione As String - Private _Allineamento As String - Private _Margine As Integer - - Private _LogoAltezza As Integer - Private _LogoLarghezza As Integer - - Private _FontColoreR As Integer - Private _FontColoreG As Integer - Private _FontColoreB As Integer - Private _fontColoreRGB As Color - - Private _LogoAggiungi As Boolean - Private _LogoNomeFile As String - Private _LogoTrasparenza As String - Private _LogoMargine As String - Private _LogoPosizioneH As String - Private _LogoPosizioneV As String - - Private _FotoGrandeDimOrigina As Boolean - Private _AltezzaBig As Integer - Private _LarghezzaBig As Integer - Private _DestDir As DirectoryInfo - Private _DimMin As Integer - - Private _TestoMin As Boolean - - Private _SecretDefault As Boolean - Private _SecretBig As Boolean - Private _SecretSmall As Boolean - - Private _SecretPathSmall As String - Private _SecretPathBig As String - - Private _jpegQuality As Long - Private _jpegQualityMin As Long - - Private FotoRuotaADestra As Boolean = False - Private FotoRuotaASinistra As Boolean = False - - Private TempMinText As String = "" - 'Private crFont1 As Font - - -#End Region - - Private Sub ProcA(ByRef g As System.Drawing.Image, ByRef DataFoto As DateTime, ByRef TestoFirma As String, ByRef TestoFirmaV As String, ByRef TestoFirmaPiccola As String, ByRef DataPartenzaI As DateTime) - If g.PropertyIdList.Length > 0 Then ' ci sono dati exif - Dim DatiExif As New ExifReader(CType(g, Bitmap)) - DataFoto = DatiExif.DateTimeOriginal - TestoFirma = _TestoFirmaStart - TestoFirmaV = _TestoFirmaStartV - - If DataFoto.Year <> 1 Then - TestoFirmaPiccola = DataFoto.ToShortTimeString - If _UsaOrarioTestoApplicare = True Then - TestoFirma &= " " & DataFoto.ToShortDateString & " " & DataFoto.ToLongTimeString - TestoFirmaV &= " " & DataFoto.ToShortDateString & " " & DataFoto.ToLongTimeString - End If - If _UsaTempoGaraTestoApplicare = True Then - Dim Orario As TimeSpan = New TimeSpan(DateDiff(DateInterval.Second, DataPartenzaI, DataFoto) * 10000000) - TestoFirma &= " " & _TestoOrario & Orario.Hours.ToString("00") & ":" & Orario.Minutes.ToString("00") & ":" & Orario.Seconds.ToString("00") - TestoFirmaV &= " " & _TestoOrario & Orario.Hours.ToString("00") & ":" & Orario.Minutes.ToString("00") & ":" & Orario.Seconds.ToString("00") - End If - End If - - End If - End Sub - - Private Sub Rotation(ByRef g As System.Drawing.Image) - - FotoRuotaADestra = False - FotoRuotaASinistra = False - - If _UsaRotazioneAutomatica = True Then - If g.PropertyIdList.Length > 0 Then ' ci sono dati exif - Dim DatiExif As New ExifReader(CType(g, Bitmap)) - - Select Case DatiExif.Orientation - Case ExifReader.Orientations.BottomLeft - - Case ExifReader.Orientations.BottomRight - - Case ExifReader.Orientations.LeftTop - - Case ExifReader.Orientations.LftBottom - FotoRuotaASinistra = True - Case ExifReader.Orientations.RightBottom - - Case ExifReader.Orientations.RightTop - - Case ExifReader.Orientations.TopLeft - - Case ExifReader.Orientations.TopRight - - End Select - End If - End If - - If FotoRuotaASinistra = True Then - g.RotateFlip(RotateFlipType.Rotate270FlipNone) - End If - If FotoRuotaADestra = True Then - g.RotateFlip(RotateFlipType.Rotate90FlipNone) - End If - - - - End Sub - - - Public Sub CreaImmagineThread(ByVal Info As String) - Dim TestoFirma As String = "" - Dim TestoFirmaV As String = "" - - Dim AlphaScelta As Integer = CType((255 * (100 - _Trasparenza) / 100), Integer) - - Dim DimensioneStandard As Integer - Dim DimensioneStandardMiniatura As Integer - - Dim DataFoto As DateTime - Dim DataPartenzaI As DateTime = _DataPartenza - If _TestoOrario.Length > 0 Then - _TestoOrario &= " " - End If - Dim TestoFirmaPiccola As String = "" - - Dim FileConta As Integer = 0 - Dim ContaFileXDir As Integer = 0 - Dim ContaDirXDir As Integer = 0 - Dim TestoTemp As String = "" - Dim ContaTemp As Integer = 0 - - DimensioneStandard = _DimStandard - DimensioneStandardMiniatura = _DimStandardMiniatura - - Dim g As System.Drawing.Image = System.Drawing.Image.FromFile(Path.Combine(_SourceDir.FullName, _NomeFileChild)) - 'dati extra in fondo - If _UsaOrarioTestoApplicare Or - _UsaTempoGaraTestoApplicare Or - _UsaOrarioMiniatura Or - _TestoMin Or - _AggTempoGaraMin Or - _AggNumTempMin Then - - ProcA(g, DataFoto, TestoFirma, TestoFirmaV, TestoFirmaPiccola, DataPartenzaI) - - 'If g.PropertyIdList.Length > 0 Then ' ci sono dati exif - ' Dim DatiExif As New ExifReader(CType(g, Bitmap)) - ' DataFoto = DatiExif.DateTimeOriginal - ' TestoFirma = _TestoFirmaStart - ' TestoFirmaV = _TestoFirmaStartV - - ' If DataFoto.Year <> 1 Then - ' TestoFirmaPiccola = DataFoto.ToShortTimeString - ' If _UsaOrarioTestoApplicare = True Then - ' TestoFirma &= " - " & DataFoto.ToShortDateString & " " & DataFoto.ToLongTimeString - ' TestoFirmaV &= " - " & DataFoto.ToShortDateString & " " & DataFoto.ToLongTimeString - ' End If - ' If _UsaTempoGaraTestoApplicare = True Then - ' Dim Orario As TimeSpan = New TimeSpan(DateDiff(DateInterval.Second, DataPartenzaI, DataFoto) * 10000000) - ' TestoFirma &= " - " & _TestoOrario & Orario.Hours.ToString("00") & ":" & Orario.Minutes.ToString("00") & ":" & Orario.Seconds.ToString("00") - ' TestoFirmaV &= " - " & _TestoOrario & Orario.Hours.ToString("00") & ":" & Orario.Minutes.ToString("00") & ":" & Orario.Seconds.ToString("00") - ' End If - ' End If - - 'End If - - Else - TestoFirma = _TestoFirmaStart - TestoFirmaV = _TestoFirmaStartV - - End If - - - Rotation(g) - - 'Dim FotoRuotaADestra As Boolean = False - 'Dim FotoRuotaASinistra As Boolean = False - - 'If _UsaRotazioneAutomatica = True Then - ' If g.PropertyIdList.Length > 0 Then ' ci sono dati exif - ' Dim DatiExif As New ExifReader(CType(g, Bitmap)) - - ' Select Case DatiExif.Orientation - ' Case ExifReader.Orientations.BottomLeft - - ' Case ExifReader.Orientations.BottomRight - - ' Case ExifReader.Orientations.LeftTop - - ' Case ExifReader.Orientations.LftBottom - ' FotoRuotaASinistra = True - ' Case ExifReader.Orientations.RightBottom - - ' Case ExifReader.Orientations.RightTop - - ' Case ExifReader.Orientations.TopLeft - - ' Case ExifReader.Orientations.TopRight - - ' End Select - ' End If - 'End If - - 'If FotoRuotaASinistra = True Then - ' g.RotateFlip(RotateFlipType.Rotate270FlipNone) - 'End If - 'If FotoRuotaADestra = True Then - ' g.RotateFlip(RotateFlipType.Rotate90FlipNone) - 'End If - - Dim thisFormat As System.Drawing.Imaging.ImageFormat = g.RawFormat - If _UsaForzaJpg = True Then - thisFormat = System.Drawing.Imaging.ImageFormat.Jpeg - End If - - Dim thumbSizeSmall As New Size - Dim thumbSizeBig As New Size - Dim NomeFileSmall As String = "" - - Dim NomeFileBig2 As String = "" - Dim NomeFileBig As String = "" - - - If g.Width > g.Height Then - thumbSizeSmall = NewthumbSize(g.Width, g.Height, LarghezzaSmall, "Larghezza") - Dim SizeOrig As New Size(g.Width, g.Height) - thumbSizeBig = SizeOrig - Else - thumbSizeSmall = NewthumbSize(g.Width, g.Height, AltezzaSmall, "Altezza") - Dim SizeOrig As New Size(g.Width, g.Height) - thumbSizeBig = SizeOrig - End If - - NomeFileSmall = Suffisso & _NomeFileChild - NomeFileBig = _NomeFileChild - - Dim imgOutputBig As New Bitmap(g, thumbSizeBig.Width, thumbSizeBig.Height) - imgOutputBig.SetResolution(g.HorizontalResolution, g.VerticalResolution) - - If _TestoMin Then - TestoFirmaPiccola = NomeFileBig - ElseIf _AggNumTempMin Then - TestoFirmaPiccola = NomeFileBig + " " - End If - Dim yPosFromBottom4 As Single - - Dim crFont1 As Font = Nothing - Dim crFont2 As Font = Nothing - Dim crSize1 As SizeF = New SizeF - Dim crSize2 As SizeF = New SizeF - - If _CreaMiniature = True Then - If _AggiungiScritteMiniature = False Then - If _DirectorySorgente.ToUpper = _DirectoryDestinazione.ToUpper Then - NomeFileSmall = NomeFileSmall.Substring(0, NomeFileSmall.Length - 4) & Codice & NomeFileSmall.Substring(NomeFileSmall.Length - 4) - End If - If _UsaOrarioMiniatura Or - _TestoMin Or - _AggTempoGaraMin Or - _AggNumTempMin Then - - If TestoFirmaPiccola.Length > 0 Then - Dim imgOutputSmall As Bitmap - imgOutputSmall = CType(imgOutputBig.Clone, Bitmap) - - Dim grPhoto1 As Graphics - grPhoto1 = Graphics.FromImage(imgOutputSmall) - grPhoto1.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias - - 'erano qui - - Dim LarghezzaStandard1 As Integer - 'quick fix - DimensioneStandardMiniatura = 50 - If _Grassetto = True Then - crFont1 = New Font(IlFont, DimensioneStandardMiniatura, FontStyle.Bold) - crFont2 = New Font(IlFont, DimensioneStandard, FontStyle.Bold) - Else - crFont1 = New Font(_IlFont, DimensioneStandardMiniatura) - crFont2 = New Font(IlFont, DimensioneStandard) - End If - - crSize1 = grPhoto1.MeasureString(TestoFirmaPiccola, crFont1) - crSize2 = grPhoto1.MeasureString(TestoFirma, crFont1) - LarghezzaStandard1 = CType(crSize1.Width, Integer) - - If crSize1.Width > CType(g.Width, Single) Then - Dim Conta As Integer = DimensioneStandardMiniatura - Do - If Conta > 20 Then - Conta -= 5 - Else - Conta -= 1 - End If - If _Grassetto = True Then - crFont1 = New Font(_IlFont, Conta, FontStyle.Bold) - Else - crFont1 = New Font(_IlFont, Conta) - End If - crSize1 = grPhoto1.MeasureString(TestoFirmaPiccola, crFont1) - If crSize1.Width < CType(g.Width, Single) Then - LarghezzaStandard1 = CType(crSize1.Width, Integer) - Exit Do - End If - If Conta <= 5 Then Exit Do - Loop - DimensioneStandardMiniatura = Conta - End If - - Dim yPosFromBottom1 As Single - - - - Select Case _Posizione.ToUpper - Case "ALTO" - - yPosFromBottom1 = (_Margine) - yPosFromBottom4 = (_MargVert) - - Case "BASSO" - 'yPosFromBottom = (g.Height - _Margine - DimensioneStandard) - 'yPosFromBottom1 = CType((g.Height - crFont1.Height - (g.Height * _Margine / 100) - (crFont1.Height * 0.3)), Single) - yPosFromBottom1 = CType((g.Height - crSize1.Height - (g.Height * _Margine / 100)), Single) - yPosFromBottom4 = CType((g.Height - crSize1.Height - (g.Height * _MargVert / 100)), Single) - - End Select - - Dim xCenterOfImg1 As Single - - Dim StrFormat1 As StringFormat = New StringFormat - Select Case _Allineamento.ToUpper - Case "SINISTRA" - xCenterOfImg1 = CType((_Margine + (LarghezzaStandard1 / 2)), Single) - - If (LarghezzaStandard1 / 2) > (g.Width / 2) - _Margine Then - xCenterOfImg1 = CType((g.Width / 2), Single) - End If - - - Case "CENTRO" - xCenterOfImg1 = CType((g.Width / 2), Single) - - - Case "DESTRA" - xCenterOfImg1 = CType((g.Width - _Margine - (LarghezzaStandard1 / 2)), Single) - - If (LarghezzaStandard1 / 2) > (g.Width / 2) - _Margine Then - xCenterOfImg1 = CType((g.Width / 2), Single) - End If - - - End Select - StrFormat1.Alignment = StringAlignment.Center - - Dim semiTransBrush21 As SolidBrush = New SolidBrush(Color.FromArgb(AlphaScelta, 0, 0, 0)) - Dim semiTransBrush1 As SolidBrush = New SolidBrush(Color.FromArgb(AlphaScelta, _FontColoreR, _FontColoreG, _FontColoreB)) - 'quick fix - DimensioneStandardMiniatura = _DimMin - - If _Grassetto = True Then - crFont1 = New Font(_IlFont, DimensioneStandardMiniatura, FontStyle.Bold) - Else - crFont1 = New Font(_IlFont, DimensioneStandardMiniatura) - End If - 'asdgadfhdfhjgfsjgfjygfdhsdafa - If _TestoMin Then - grPhoto1.DrawString(NomeFileBig, crFont1, semiTransBrush21, New PointF(xCenterOfImg1 + 1, yPosFromBottom1 + 1), StrFormat1) - grPhoto1.DrawString(NomeFileBig, crFont1, semiTransBrush1, New PointF(xCenterOfImg1, yPosFromBottom1), StrFormat1) - ElseIf _AggTempoGaraMin And _UsaTempoGaraTestoApplicare Then - Dim Orario As TimeSpan = New TimeSpan(DateDiff(DateInterval.Second, DataPartenzaI, DataFoto) * 10000000) - Dim tempstr As String = "" - - - tempstr &= ControlChars.CrLf & _TestoOrario & Orario.Hours.ToString("00") & ":" & Orario.Minutes.ToString("00") & ":" & Orario.Seconds.ToString("00") - - - grPhoto1.DrawString(tempstr, crFont1, semiTransBrush21, New PointF(xCenterOfImg1 + 1, yPosFromBottom1 + 1), StrFormat1) - grPhoto1.DrawString(tempstr, crFont1, semiTransBrush1, New PointF(xCenterOfImg1, yPosFromBottom1), StrFormat1) - - ElseIf _AggNumTempMin Then - Dim Orario As TimeSpan = New TimeSpan(DateDiff(DateInterval.Second, DataPartenzaI, DataFoto) * 10000000) - Dim tempstr As String = "" - tempstr &= NomeFileBig - - tempstr &= ControlChars.CrLf & _TestoOrario & Orario.Hours.ToString("00") & ":" & Orario.Minutes.ToString("00") & ":" & Orario.Seconds.ToString("00") - - - grPhoto1.DrawString(tempstr, crFont1, semiTransBrush21, New PointF(xCenterOfImg1 + 1, yPosFromBottom1 + 1), StrFormat1) - grPhoto1.DrawString(tempstr, crFont1, semiTransBrush1, New PointF(xCenterOfImg1, yPosFromBottom1), StrFormat1) - - - Else - grPhoto1.DrawString(TestoFirmaPiccola, crFont1, semiTransBrush21, New PointF(xCenterOfImg1 + 1, yPosFromBottom1 + 1), StrFormat1) - grPhoto1.DrawString(TestoFirmaPiccola, crFont1, semiTransBrush1, New PointF(xCenterOfImg1, yPosFromBottom1), StrFormat1) - End If - imgOutputSmall.Save(Path.Combine(_DestDir.FullName, "Temp_" & NomeFileSmall), thisFormat) - Dim g2 As System.Drawing.Image = System.Drawing.Image.FromFile(Path.Combine(_DestDir.FullName, "Temp_" & NomeFileSmall)) - Dim imgOutputSmall2 As New Bitmap(g2, thumbSizeSmall.Width, thumbSizeSmall.Height) - imgOutputSmall2.Save(Path.Combine(_DestDir.FullName, NomeFileSmall), thisFormat) - - imgOutputSmall2.Dispose() - imgOutputSmall.Dispose() - g2.Dispose() - Kill(Path.Combine(_DestDir.FullName, "Temp_" & NomeFileSmall)) - Else - Dim imgOutputSmall As New Bitmap(g, thumbSizeSmall.Width, thumbSizeSmall.Height) - imgOutputSmall.Save(Path.Combine(_DestDir.FullName, NomeFileSmall), thisFormat) - imgOutputSmall.Dispose() - End If - Else - Dim imgOutputSmall As New Bitmap(g, thumbSizeSmall.Width, thumbSizeSmall.Height) - imgOutputSmall.Save(Path.Combine(_DestDir.FullName, NomeFileSmall), thisFormat) - imgOutputSmall.Dispose() - End If - End If - End If - - Dim grPhoto As Graphics - grPhoto = Graphics.FromImage(imgOutputBig) - grPhoto.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias - - Dim crFont As Font = Nothing - Dim crSize As SizeF = New SizeF - Dim LarghezzaStandard As Integer - - If _Grassetto = True Then - crFont = New Font(_IlFont, DimensioneStandard, FontStyle.Bold) - Else - crFont = New Font(_IlFont, DimensioneStandard) - End If - crSize = grPhoto.MeasureString(TestoFirma, crFont) - LarghezzaStandard = CType(crSize.Width, Integer) - - If crSize.Width > CType(g.Width, Single) Then - Dim Conta As Integer = DimensioneStandard - Do - If Conta > 20 Then - Conta -= 5 - Else - Conta -= 1 - End If - If _Grassetto = True Then - crFont = New Font(_IlFont, Conta, FontStyle.Bold) - Else - crFont = New Font(_IlFont, Conta) - End If - crSize = grPhoto.MeasureString(TestoFirma, crFont) - If crSize.Width < CType(g.Width, Single) Then - LarghezzaStandard = CType(crSize.Width, Integer) - Exit Do - End If - If Conta <= 5 Then Exit Do - Loop - DimensioneStandard = Conta - End If - - Dim yPosFromBottom As Single - Dim yPosFromBottom3 As Single - Select Case _Posizione.ToUpper - Case "ALTO" - yPosFromBottom = (_Margine) - yPosFromBottom3 = (_MargVert) - - Case "BASSO" - 'yPosFromBottom = (g.Height - _Margine - DimensioneStandard) - 'yPosFromBottom = CType((g.Height - DimensioneStandard - (g.Height * _Margine / 100) - (DimensioneStandard * 0.3)), Single) - yPosFromBottom = CType((g.Height - crSize.Height - (g.Height * _Margine / 100)), Single) - yPosFromBottom3 = CType((g.Height - crSize.Height - (g.Height * _MargVert / 100)), Single) - End Select - - Dim xCenterOfImg As Single - Dim xCenterOfImg3 As Single - Dim StrFormat As StringFormat = New StringFormat - Select Case _Allineamento.ToUpper - Case "SINISTRA" - xCenterOfImg = CType((_Margine + (LarghezzaStandard / 2)), Single) - xCenterOfImg3 = CType((_MargVert + (LarghezzaStandard / 2)), Single) - If (LarghezzaStandard / 2) > (g.Width / 2) - _Margine Then - xCenterOfImg = CType((g.Width / 2), Single) - End If - If (LarghezzaStandard / 2) > (g.Width / 2) - _MargVert Then - xCenterOfImg3 = CType((g.Width / 2), Single) - End If - - Case "CENTRO" - xCenterOfImg = CType((g.Width / 2), Single) - - Case "DESTRA" - xCenterOfImg = CType((g.Width - _Margine - (LarghezzaStandard / 2)), Single) - xCenterOfImg3 = CType((g.Width - _MargVert - (LarghezzaStandard / 2)), Single) - If (LarghezzaStandard / 2) > (g.Width / 2) - _Margine Then - xCenterOfImg = CType((g.Width / 2), Single) - End If - If (LarghezzaStandard / 2) > (g.Width / 2) - _MargVert Then - xCenterOfImg3 = CType((g.Width / 2), Single) - End If - - End Select - StrFormat.Alignment = StringAlignment.Center - - Dim semiTransBrush2 As SolidBrush = New SolidBrush(Color.FromArgb(AlphaScelta, 0, 0, 0)) - Dim semiTransBrush As SolidBrush = New SolidBrush(Color.FromArgb(AlphaScelta, _FontColoreR, _FontColoreG, _FontColoreB)) - - If FotoRuotaADestra Or FotoRuotaASinistra Then - - If _Grassetto = True Then - crFont = New Font(_IlFont, DimVert, FontStyle.Bold) - Else - crFont = New Font(_IlFont, DimVert) - End If - - Else - - If _Grassetto = True Then - crFont = New Font(_IlFont, DimensioneStandard, FontStyle.Bold) - Else - crFont = New Font(_IlFont, DimensioneStandard) - End If - End If - - aggiungiTesto(g, DataFoto, grPhoto, NomeFileBig, crFont, semiTransBrush, - semiTransBrush2, xCenterOfImg, yPosFromBottom, StrFormat, - TestoFirmaV, yPosFromBottom3, yPosFromBottom4, TestoFirma, NomeFileBig2) - - aggiungiLogo(imgOutputBig) - salvaFoto(imgOutputBig, thumbSizeBig, NomeFileBig, NomeFileSmall, thumbSizeSmall) - - g.Dispose() - grPhoto.Dispose() - GC.Collect() - - End Sub - - Private Sub aggiungiTesto(g As Image, DataFoto As Date, grPhoto As Graphics, NomeFileBig As String, crFont As Font, semiTransBrush As SolidBrush, - semiTransBrush2 As SolidBrush, xCenterOfImg As Single, yPosFromBottom As Single, StrFormat As StringFormat, - TestoFirmav As String, yPosFromBottom3 As Single, yPosFromBottom4 As Single, TestoFirma As String, NomeFileBig2 As String) - 'qui scrive il testo (nomefilebig) - If _TestoNome Then - If NomeData And g.PropertyIdList.Length > 0 Then - Dim DatiExif As New ExifReader(CType(g, Bitmap)) - DataFoto = DatiExif.DateTimeOriginal - - - grPhoto.DrawString((NomeFileBig & " " & DataFoto.ToShortDateString), crFont, semiTransBrush2, New PointF(xCenterOfImg + 1, yPosFromBottom + 1), StrFormat) - grPhoto.DrawString((NomeFileBig & " " & DataFoto.ToShortDateString), crFont, semiTransBrush, New PointF(xCenterOfImg, yPosFromBottom), StrFormat) - - - Else - - grPhoto.DrawString(NomeFileBig, crFont, semiTransBrush2, New PointF(xCenterOfImg + 1, yPosFromBottom + 1), StrFormat) - grPhoto.DrawString(NomeFileBig, crFont, semiTransBrush, New PointF(xCenterOfImg, yPosFromBottom), StrFormat) - - End If - End If - - If _TestoNome = False Then - If FotoRuotaADestra Or FotoRuotaASinistra Then - If _TestoMin = False Then - - - grPhoto.DrawString(TestoFirmav, crFont, semiTransBrush2, New PointF(xCenterOfImg + 1, yPosFromBottom3 + 1), StrFormat) - grPhoto.DrawString(TestoFirmav, crFont, semiTransBrush, New PointF(xCenterOfImg, yPosFromBottom3), StrFormat) - End If - If _TestoMin = True Then - - grPhoto.DrawString(TestoFirmav, crFont, semiTransBrush2, New PointF(xCenterOfImg + 1, yPosFromBottom4 + 1), StrFormat) - grPhoto.DrawString(TestoFirmav, crFont, semiTransBrush, New PointF(xCenterOfImg, yPosFromBottom4), StrFormat) - - End If - Else - grPhoto.DrawString(TestoFirma, crFont, semiTransBrush2, New PointF(xCenterOfImg + 1, yPosFromBottom + 1), StrFormat) - grPhoto.DrawString(TestoFirma, crFont, semiTransBrush, New PointF(xCenterOfImg, yPosFromBottom), StrFormat) - - - End If - End If - - If _DirectorySorgente.ToUpper = _DirectoryDestinazione.ToUpper Then - NomeFileBig2 = NomeFileBig - NomeFileBig = NomeFileBig.Substring(0, NomeFileBig.Length - 4) & Codice & NomeFileBig.Substring(NomeFileBig.Length - 4) - End If - End Sub - - Private Sub aggiungiLogo(imgOutputBig As Bitmap) - 'imgOutputBig - If _LogoAggiungi = True And File.Exists(_LogoNomeFile) Then - - Dim ImmagineLogo As Image = Image.FromFile(_LogoNomeFile) - - Dim LogoColoreTrasparente As Color = Color.White - 'Dim bmWatermark As Bitmap - - '* Create a Bitmap based on the previously modified photograph Bitmap - 'bmWatermark = New Bitmap(imgOutputBig) - 'bmWatermark.SetResolution(imgOutputBig.HorizontalResolution, imgOutputBig.VerticalResolution) - - '* Load this Bitmap into a new Graphic Object - Dim grWatermark As Graphics = Graphics.FromImage(imgOutputBig) - - '* To achieve a transulcent watermark we will apply (2) color manipulations - Dim imageAttributes As Imaging.ImageAttributes = New Imaging.ImageAttributes - - '* The first step replace the background color with one that is trasparent (Alpha=0, R=0, G=0, B=0) - Dim colorMap As Imaging.ColorMap = New Imaging.ColorMap - - '* background this will be the color we search for and replace with transparency - colorMap.OldColor = LogoColoreTrasparente - colorMap.NewColor = Color.FromArgb(0, 0, 0, 0) - - Dim remapTable As Imaging.ColorMap() = {colorMap} - imageAttributes.SetRemapTable(remapTable, Imaging.ColorAdjustType.Bitmap) - - '* The second color manipulation is used to change the opacity by setting the 3rd row and 3rd column to 0.3f - Dim colorMatrixElements As Single()() = {New Single() {1.0F, 0.0F, 0.0F, 0.0F, 0.0F}, New Single() {0.0F, 1.0F, 0.0F, 0.0F, 0.0F}, New Single() {0.0F, 0.0F, 1.0F, 0.0F, 0.0F}, New Single() {0.0F, 0.0F, 0.0F, CType(_LogoTrasparenza, Single) / 100, 0.0F}, New Single() {0.0F, 0.0F, 0.0F, 0.0F, 1.0F}} - Dim wmColorMatrix As Imaging.ColorMatrix = New Imaging.ColorMatrix(colorMatrixElements) - imageAttributes.SetColorMatrix(wmColorMatrix, Imaging.ColorMatrixFlag.Default, Imaging.ColorAdjustType.Bitmap) - - Dim FotoLogoH As Integer = _LogoAltezza - Dim FotoLogoW As Integer = _LogoLarghezza - Dim FattoreAlt As Double = ImmagineLogo.Height / FotoLogoH - Dim FattoreLarg As Double = ImmagineLogo.Width / FotoLogoW - Dim NuovaSize As Size - If FattoreLarg > FattoreAlt Then - NuovaSize = NewthumbSize(ImmagineLogo.Width, ImmagineLogo.Height, FotoLogoW, "Larghezza") - Else - NuovaSize = NewthumbSize(ImmagineLogo.Width, ImmagineLogo.Height, FotoLogoH, "Altezza") - End If - - Dim MargineUsato As Integer - Dim MargineL As Integer - Dim InPercentualeL As Boolean - If _LogoMargine.EndsWith("%") = True Then - InPercentualeL = True - Else - InPercentualeL = False - End If - MargineL = CType(Val(_LogoMargine), Integer) - If InPercentualeL = True Then - MargineUsato = CType(imgOutputBig.Height * MargineL / 100, Integer) - Else - MargineUsato = MargineL - End If - - Dim xPosOfWm As Integer - Dim yPosOfWm As Integer - Select Case _LogoPosizioneH.ToUpper - Case "SINISTRA", "NESSUNA" - xPosOfWm = MargineUsato - - Case "CENTRO" - xPosOfWm = CType((imgOutputBig.Width - NuovaSize.Width) / 2, Integer) - - Case "DESTRA" - xPosOfWm = ((imgOutputBig.Width - NuovaSize.Width) - MargineUsato) - End Select - Select Case _LogoPosizioneV.ToUpper - Case "ALTO", "NESSUNA" - yPosOfWm = MargineUsato - - Case "CENTRO" - yPosOfWm = CType((imgOutputBig.Height - NuovaSize.Height) / 2, Integer) - - Case "BASSO" - yPosOfWm = ((imgOutputBig.Height - NuovaSize.Height) - MargineUsato) - End Select - - grWatermark.DrawImage(ImmagineLogo, New Rectangle(xPosOfWm, yPosOfWm, NuovaSize.Width, NuovaSize.Height), 0, 0, ImmagineLogo.Width, ImmagineLogo.Height, GraphicsUnit.Pixel, imageAttributes) - grWatermark.Dispose() - End If - End Sub - - - Private Sub salvaFoto(imgOutputBig As Bitmap, thumbSizeBig As Size, NomeFileBig As String, NomeFileSmall As String, thumbSizeSmall As Size) - - If _FotoGrandeDimOrigina = False Then - 'attenzione non controlla se è png - 'imgOutputBig.Save(Path.Combine(_DestDir.FullName, "Temp_" & NomeFileBig), thisFormat) - salvaImmagineCustomQuality(imgOutputBig, Path.Combine(_DestDir.FullName, "Temp_" & NomeFileBig), jpegQuality) - - Dim g2 As System.Drawing.Image = System.Drawing.Image.FromFile(Path.Combine(_DestDir.FullName, "Temp_" & NomeFileBig)) - If g2.Width > g2.Height Then - thumbSizeBig = NewthumbSize(g2.Width, g2.Height, _LarghezzaBig, "Larghezza") - Else - thumbSizeBig = NewthumbSize(g2.Width, g2.Height, _AltezzaBig, "Altezza") - End If - Dim imgOutputBig2 As New Bitmap(g2, thumbSizeBig.Width, thumbSizeBig.Height) - 'imgOutputBig2.Save(Path.Combine(_DestDir.FullName, NomeFileBig), thisFormat) - salvaImmagineCustomQuality(imgOutputBig2, Path.Combine(_DestDir.FullName, NomeFileBig), jpegQuality) - 'imgOutputBig2.Dispose() - 'imgOutputBig.Dispose() - g2.Dispose() - Else - 'imgOutputBig.Save(Path.Combine(_DestDir.FullName, NomeFileBig), thisFormat) - salvaImmagineCustomQuality(imgOutputBig, Path.Combine(_DestDir.FullName, NomeFileBig), jpegQuality) - imgOutputBig.Dispose() - End If - - - If _CreaMiniature Then - If _AggiungiScritteMiniature = True Then - Dim g1 As System.Drawing.Image - If _FotoGrandeDimOrigina = False Then - g1 = System.Drawing.Image.FromFile(Path.Combine(_DestDir.FullName, "Temp_" & NomeFileBig)) - Else - g1 = System.Drawing.Image.FromFile(Path.Combine(_DestDir.FullName, NomeFileBig)) - End If - Dim imgOutputSmall As New Bitmap(g1, thumbSizeSmall.Width, thumbSizeSmall.Height) - If _DirectorySorgente.ToUpper = _DirectoryDestinazione.ToUpper Then - NomeFileSmall = NomeFileSmall.Substring(0, NomeFileSmall.Length - 4) & Codice & NomeFileSmall.Substring(NomeFileSmall.Length - 4) - End If - 'imgOutputSmall.Save(Path.Combine(_DestDir.FullName, NomeFileSmall), thisFormat) - salvaImmagineCustomQuality(imgOutputSmall, Path.Combine(_DestDir.FullName, NomeFileSmall), jpegQualityMin) - 'imgOutputSmall.Dispose() - g1.Dispose() - End If - - - - End If - - If File.Exists(Path.Combine(_DestDir.FullName, "Temp_" & NomeFileBig)) = True Then - Kill(Path.Combine(_DestDir.FullName, "Temp_" & NomeFileBig)) - End If - - - End Sub - - Private Sub salvaImmagineCustomQuality(imageToSave As Bitmap, nomeFileFinale As String, quality As Long) - - Dim JgpEncoder As ImageCodecInfo = GetEncoder(ImageFormat.Jpeg) - Dim MyEncoder As Encoder = Encoder.Quality - - Dim MyEncoderParameters As New EncoderParameters(1) - - Dim MyEncoderParameter As New EncoderParameter(MyEncoder, jpegQuality) - MyEncoderParameters.Param(0) = MyEncoderParameter - imageToSave.Save(nomeFileFinale, JgpEncoder, MyEncoderParameters) - imageToSave.Dispose() - End Sub - - - - Private Function GetEncoder(ByVal format As ImageFormat) As ImageCodecInfo - - Dim codecs As ImageCodecInfo() = ImageCodecInfo.GetImageDecoders() - - Dim codec As ImageCodecInfo - For Each codec In codecs - If codec.FormatID = format.Guid Then - Return codec - End If - Next codec - Return Nothing - - End Function - - - - - - - ''' - ''' Calculate the Size of the New image - ''' - ''' Larghezza - ''' Altezza - ''' - ''' - ''' - ''' - Function NewthumbSize(ByVal currentwidth As Integer, ByVal currentheight As Integer, ByVal MaxPixel As Integer, ByVal TipoSize As String) As Size - ' e - '*** Larghezza, Altezza, Auto - - Dim tempMultiplier As Double - - If TipoSize.ToUpper = "Larghezza".ToUpper Then - tempMultiplier = MaxPixel / currentwidth - ElseIf TipoSize.ToUpper = "Altezza".ToUpper Then - tempMultiplier = MaxPixel / currentheight - Else - If currentheight > currentwidth Then ' portrait - tempMultiplier = MaxPixel / currentheight - Else - tempMultiplier = MaxPixel / currentwidth - End If - End If - - Dim NewSize As New Size(CInt(currentwidth * tempMultiplier), CInt(currentheight * tempMultiplier)) - - Return NewSize - End Function - - - - - Public Property DirectorySorgente() As String - Get - Return _DirectorySorgente - End Get - Set(ByVal value As String) - _DirectorySorgente = value - End Set - End Property - - Public Property DirectoryDestinazione() As String - Get - Return _DirectoryDestinazione - End Get - Set(ByVal value As String) - _DirectoryDestinazione = value - End Set - End Property - - - Public Property SourceDir() As DirectoryInfo - Get - Return _SourceDir - End Get - Set(ByVal value As DirectoryInfo) - _SourceDir = value - End Set - End Property - - Public Property DestDirStart() As DirectoryInfo - Get - Return _DestDirStart - End Get - Set(ByVal value As DirectoryInfo) - _DestDirStart = value - End Set - End Property - - - - Public Property TestoFirmaStart() As String - Get - Return _TestoFirmaStart - End Get - Set(ByVal value As String) - _TestoFirmaStart = value - End Set - End Property - - Public Property TestoFirmaStartV() As String - Get - Return _TestoFirmaStartV - End Get - - Set(ByVal value As String) - _TestoFirmaStartV = value - End Set - End Property - - Public Property DataPartenza() As DateTime - Get - Return _DataPartenza - End Get - Set(ByVal value As DateTime) - _DataPartenza = value - End Set - End Property - - Public Property TestoOrario() As String - Get - Return _TestoOrario - End Get - Set(ByVal value As String) - _TestoOrario = value - End Set - End Property - - Public Property DimStandard() As Integer - Get - Return _DimStandard - End Get - Set(ByVal value As Integer) - _DimStandard = value - End Set - End Property - - Public Property DimStandardMiniatura() As Integer - Get - Return _DimStandardMiniatura - End Get - Set(ByVal value As Integer) - _DimStandardMiniatura = value - End Set - End Property - - Public Property NomeData() As Boolean - Get - Return _NomeData - End Get - Set(ByVal value As Boolean) - _NomeData = value - End Set - End Property - - Public Property TestoNome() As Boolean - Get - Return _TestoNome - End Get - Set(ByVal value As Boolean) - _TestoNome = value - End Set - End Property - - Public Property UsaOrarioMiniatura() As Boolean - Get - Return _UsaOrarioMiniatura - End Get - Set(ByVal value As Boolean) - _UsaOrarioMiniatura = value - End Set - End Property - - Public Property UsaOrarioTestoApplicare() As Boolean - Get - Return _UsaOrarioTestoApplicare - End Get - Set(ByVal value As Boolean) - _UsaOrarioTestoApplicare = value - End Set - End Property - - Public Property UsaTempoGaraTestoApplicare() As Boolean - Get - Return _UsaTempoGaraTestoApplicare - End Get - Set(ByVal value As Boolean) - _UsaTempoGaraTestoApplicare = value - End Set - End Property - - Public Property UsaRotazioneAutomatica() As Boolean - Get - Return _UsaRotazioneAutomatica - End Get - Set(ByVal value As Boolean) - _UsaRotazioneAutomatica = value - End Set - End Property - - Public Property UsaForzaJpg() As Boolean - Get - Return _UsaForzaJpg - End Get - Set(ByVal value As Boolean) - _UsaForzaJpg = value - End Set - End Property - - - - Public Property LarghezzaSmall() As Integer - Get - Return _LarghezzaSmall - End Get - Set(ByVal value As Integer) - _LarghezzaSmall = value - End Set - End Property - - Public Property AltezzaSmall() As Integer - Get - Return _AltezzaSmall - End Get - Set(ByVal value As Integer) - _AltezzaSmall = value - End Set - End Property - - - Public Property CreaMiniature() As Boolean - Get - Return _CreaMiniature - End Get - Set(ByVal value As Boolean) - _CreaMiniature = value - End Set - End Property - - Public Property AggiungiScritteMiniature() As Boolean - Get - Return _AggiungiScritteMiniature - End Get - Set(ByVal value As Boolean) - _AggiungiScritteMiniature = value - End Set - End Property - - Public Property NomeFileChild() As String - Get - Return _NomeFileChild - End Get - Set(ByVal value As String) - _NomeFileChild = value - End Set - End Property - - Public Property Suffisso() As String - Get - Return _Suffisso - End Get - Set(ByVal value As String) - _Suffisso = value - End Set - End Property - - Public Property Codice() As String - Get - Return _Codice - End Get - Set(ByVal value As String) - _Codice = value - End Set - End Property - - - Public Property Trasparenza() As Integer - Get - Return _Trasparenza - End Get - Set(ByVal value As Integer) - _Trasparenza = value - End Set - End Property - - Public Property IlFont() As String - Get - Return _IlFont - End Get - Set(ByVal value As String) - _IlFont = value - End Set - End Property - - Public Property Grassetto() As Boolean - Get - Return _Grassetto - End Get - Set(ByVal value As Boolean) - _Grassetto = value - End Set - End Property - - Public Property Posizione() As String - Get - Return _Posizione - End Get - Set(ByVal value As String) - _Posizione = value - End Set - End Property - - Public Property Allineamento() As String - Get - Return _Allineamento - End Get - Set(ByVal value As String) - _Allineamento = value - End Set - End Property - - Public Property Margine() As Integer - Get - Return _Margine - End Get - Set(ByVal value As Integer) - _Margine = value - End Set - End Property - - Public Property LogoAltezza() As Integer - Get - Return _LogoAltezza - End Get - Set(ByVal value As Integer) - _LogoAltezza = value - End Set - End Property - - Public Property LogoLarghezza() As Integer - Get - Return _LogoLarghezza - End Get - Set(ByVal value As Integer) - _LogoLarghezza = value - End Set - End Property - - Public Property FontColoreR() As Integer - Get - Return _FontColoreR - End Get - Set(ByVal value As Integer) - _FontColoreR = value - End Set - End Property - - Public Property FontColoreG() As Integer - Get - Return _FontColoreG - End Get - Set(ByVal value As Integer) - _FontColoreG = value - End Set - End Property - - Public Property FontColoreB() As Integer - Get - Return _FontColoreB - End Get - Set(ByVal value As Integer) - _FontColoreB = value - End Set - End Property - - Public Property fontColoreRGB() As Color - Get - Return _fontColoreRGB - End Get - Set(ByVal value As Color) - _fontColoreRGB = value - End Set - End Property - - Public Property LogoAggiungi() As Boolean - Get - Return _LogoAggiungi - End Get - Set(ByVal value As Boolean) - _LogoAggiungi = value - End Set - End Property - - Public Property LogoNomeFile() As String - Get - Return _LogoNomeFile - End Get - Set(ByVal value As String) - _LogoNomeFile = value - End Set - End Property - - Public Property LogoTrasparenza() As String - Get - Return _LogoTrasparenza - End Get - Set(ByVal value As String) - _LogoTrasparenza = value - End Set - End Property - - Public Property LogoMargine() As String - Get - Return _LogoMargine - End Get - Set(ByVal value As String) - _LogoMargine = value - End Set - End Property - - Public Property LogoPosizioneH() As String - Get - Return _LogoPosizioneH - End Get - Set(ByVal value As String) - _LogoPosizioneH = value - End Set - End Property - - Public Property LogoPosizioneV() As String - Get - Return _LogoPosizioneV - End Get - Set(ByVal value As String) - _LogoPosizioneV = value - End Set - End Property - - Public Property FotoGrandeDimOrigina() As Boolean - Get - Return _FotoGrandeDimOrigina - End Get - Set(ByVal value As Boolean) - _FotoGrandeDimOrigina = value - End Set - End Property - - Public Property AltezzaBig() As Integer - Get - Return _AltezzaBig - End Get - Set(ByVal value As Integer) - _AltezzaBig = value - End Set - End Property - - Public Property LarghezzaBig() As Integer - Get - Return _LarghezzaBig - End Get - Set(ByVal value As Integer) - _LarghezzaBig = value - End Set - End Property - - Public Property DestDir() As DirectoryInfo - Get - Return _DestDir - End Get - Set(ByVal value As DirectoryInfo) - _DestDir = value - End Set - End Property - - Public Property DimVert() As Integer - Get - Return _DimVert - - End Get - Set(ByVal value As Integer) - _DimVert = value - - End Set - End Property - - Public Property MargVert() As Integer - Get - Return _MargVert - - End Get - Set(ByVal value As Integer) - _MargVert = value - End Set - End Property - - Public Property TestoMin() As Boolean - Get - Return _TestoMin - - End Get - Set(ByVal value As Boolean) - _TestoMin = value - - End Set - End Property - - Public Property DimMin() As Integer - Get - Return _DimMin - - End Get - Set(ByVal value As Integer) - _DimMin = value - - End Set - End Property - - Public Property SecretDefault() As Boolean - Get - Return _SecretDefault - - End Get - Set(ByVal value As Boolean) - _SecretDefault = value - - End Set - End Property - - Public Property SecretBig() As Boolean - Get - Return _SecretBig - - End Get - Set(ByVal value As Boolean) - _SecretBig = value - - End Set - End Property - - Public Property SecretSmall() As Boolean - Get - Return _SecretSmall - - End Get - Set(ByVal value As Boolean) - _SecretSmall = value - - End Set - End Property - - Public Property SecretPathSmall() As String - Get - Return _SecretPathSmall - - End Get - Set(ByVal value As String) - _SecretPathSmall = value - - End Set - End Property - - Public Property SecretPathBig() As String - Get - Return _SecretPathBig - - End Get - Set(ByVal value As String) - _SecretPathBig = value - - End Set - End Property - - Public Property AggTempoGaraMin() As Boolean - Get - Return _AggTempoGaraMin - - End Get - Set(ByVal value As Boolean) - _AggTempoGaraMin = value - - End Set - End Property - - Public Property AggNumTempMin() As Boolean - Get - Return _AggNumTempMin - - End Get - Set(ByVal value As Boolean) - _AggNumTempMin = value - - End Set - End Property - - Public Property jpegQuality() As Long - Get - Return _jpegQuality - End Get - Set(ByVal value As Long) - _jpegQuality = value - End Set - - End Property - - Public Property jpegQualityMin() As Long - Get - Return _jpegQualityMin - End Get - Set(ByVal value As Long) - _jpegQualityMin = value - End Set - - End Property - -End Class diff --git a/imagecatalog/DataModel.cs b/imagecatalog/DataModel.cs index bc94a4c..e71f7cd 100644 --- a/imagecatalog/DataModel.cs +++ b/imagecatalog/DataModel.cs @@ -65,12 +65,23 @@ namespace ImageCatalog_2 NotifyPropertyChanged(); } } + + private string _verticalText; + public string VerticalText + { + get => _verticalText; + set + { + _verticalText = value; + NotifyPropertyChanged(); + } + } private bool _uiEnabled = true; public bool UiEnabled { - get { return _uiEnabled; } + get => _uiEnabled; set { _uiEnabled = value; diff --git a/imagecatalog/ExifReader.vb b/imagecatalog/ExifReader.vb deleted file mode 100644 index 15a19bd..0000000 --- a/imagecatalog/ExifReader.vb +++ /dev/null @@ -1,1068 +0,0 @@ -'''----------------------------------------------------------------------------- -''' -''' Utility class for reading EXIF data from images. Provides abstraction -''' for most common data and generic utilities for work with all other. -''' -''' -''' Copyright (c) Michal A. Valášek - Altair Communications, 2003 -''' Copmany: http://software.altaircom.net * support@altaircom.net -''' Private: http://www.rider.cz * developer@rider.cz -''' This is free software licensed under GNU Lesser General Public License -''' -''' -''' [altair] 10.9.2003 Created -''' -'''----------------------------------------------------------------------------- -Public Class ExifReader - Implements IDisposable - - Private Image As System.Drawing.Bitmap - - '''----------------------------------------------------------------------------- - ''' - ''' Contains possible values of EXIF tag names (ID) - ''' - ''' See GdiPlusImaging.h - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public Enum TagNames - ExifIFD = &H8769 - GpsIFD = &H8825 - NewSubfileType = &HFE - SubfileType = &HFF - ImageWidth = &H100 - ImageHeight = &H101 - BitsPerSample = &H102 - Compression = &H103 - PhotometricInterp = &H106 - ThreshHolding = &H107 - CellWidth = &H108 - CellHeight = &H109 - FillOrder = &H10A - DocumentName = &H10D - ImageDescription = &H10E - EquipMake = &H10F - EquipModel = &H110 - StripOffsets = &H111 - Orientation = &H112 - SamplesPerPixel = &H115 - RowsPerStrip = &H116 - StripBytesCount = &H117 - MinSampleValue = &H118 - MaxSampleValue = &H119 - XResolution = &H11A - YResolution = &H11B - PlanarConfig = &H11C - PageName = &H11D - XPosition = &H11E - YPosition = &H11F - FreeOffset = &H120 - FreeByteCounts = &H121 - GrayResponseUnit = &H122 - GrayResponseCurve = &H123 - T4Option = &H124 - T6Option = &H125 - ResolutionUnit = &H128 - PageNumber = &H129 - TransferFuncition = &H12D - SoftwareUsed = &H131 - DateTime = &H132 - Artist = &H13B - HostComputer = &H13C - Predictor = &H13D - WhitePoint = &H13E - PrimaryChromaticities = &H13F - ColorMap = &H140 - HalftoneHints = &H141 - TileWidth = &H142 - TileLength = &H143 - TileOffset = &H144 - TileByteCounts = &H145 - InkSet = &H14C - InkNames = &H14D - NumberOfInks = &H14E - DotRange = &H150 - TargetPrinter = &H151 - ExtraSamples = &H152 - SampleFormat = &H153 - SMinSampleValue = &H154 - SMaxSampleValue = &H155 - TransferRange = &H156 - JPEGProc = &H200 - JPEGInterFormat = &H201 - JPEGInterLength = &H202 - JPEGRestartInterval = &H203 - JPEGLosslessPredictors = &H205 - JPEGPointTransforms = &H206 - JPEGQTables = &H207 - JPEGDCTables = &H208 - JPEGACTables = &H209 - YCbCrCoefficients = &H211 - YCbCrSubsampling = &H212 - YCbCrPositioning = &H213 - REFBlackWhite = &H214 - ICCProfile = &H8773 - Gamma = &H301 - ICCProfileDescriptor = &H302 - SRGBRenderingIntent = &H303 - ImageTitle = &H320 - Copyright = &H8298 - ResolutionXUnit = &H5001 - ResolutionYUnit = &H5002 - ResolutionXLengthUnit = &H5003 - ResolutionYLengthUnit = &H5004 - PrintFlags = &H5005 - PrintFlagsVersion = &H5006 - PrintFlagsCrop = &H5007 - PrintFlagsBleedWidth = &H5008 - PrintFlagsBleedWidthScale = &H5009 - HalftoneLPI = &H500A - HalftoneLPIUnit = &H500B - HalftoneDegree = &H500C - HalftoneShape = &H500D - HalftoneMisc = &H500E - HalftoneScreen = &H500F - JPEGQuality = &H5010 - GridSize = &H5011 - ThumbnailFormat = &H5012 - ThumbnailWidth = &H5013 - ThumbnailHeight = &H5014 - ThumbnailColorDepth = &H5015 - ThumbnailPlanes = &H5016 - ThumbnailRawBytes = &H5017 - ThumbnailSize = &H5018 - ThumbnailCompressedSize = &H5019 - ColorTransferFunction = &H501A - ThumbnailData = &H501B - ThumbnailImageWidth = &H5020 - ThumbnailImageHeight = &H502 - ThumbnailBitsPerSample = &H5022 - ThumbnailCompression = &H5023 - ThumbnailPhotometricInterp = &H5024 - ThumbnailImageDescription = &H5025 - ThumbnailEquipMake = &H5026 - ThumbnailEquipModel = &H5027 - ThumbnailStripOffsets = &H5028 - ThumbnailOrientation = &H5029 - ThumbnailSamplesPerPixel = &H502A - ThumbnailRowsPerStrip = &H502B - ThumbnailStripBytesCount = &H502C - ThumbnailResolutionX = &H502D - ThumbnailResolutionY = &H502E - ThumbnailPlanarConfig = &H502F - ThumbnailResolutionUnit = &H5030 - ThumbnailTransferFunction = &H5031 - ThumbnailSoftwareUsed = &H5032 - ThumbnailDateTime = &H5033 - ThumbnailArtist = &H5034 - ThumbnailWhitePoint = &H5035 - ThumbnailPrimaryChromaticities = &H5036 - ThumbnailYCbCrCoefficients = &H5037 - ThumbnailYCbCrSubsampling = &H5038 - ThumbnailYCbCrPositioning = &H5039 - ThumbnailRefBlackWhite = &H503A - ThumbnailCopyRight = &H503B - LuminanceTable = &H5090 - ChrominanceTable = &H5091 - FrameDelay = &H5100 - LoopCount = &H5101 - PixelUnit = &H5110 - PixelPerUnitX = &H5111 - PixelPerUnitY = &H5112 - PaletteHistogram = &H5113 - ExifExposureTime = &H829A - ExifFNumber = &H829D - ExifExposureProg = &H8822 - ExifSpectralSense = &H8824 - ExifISOSpeed = &H8827 - ExifOECF = &H8828 - ExifVer = &H9000 - ExifDTOrig = &H9003 - ExifDTDigitized = &H9004 - ExifCompConfig = &H9101 - ExifCompBPP = &H9102 - ExifShutterSpeed = &H9201 - ExifAperture = &H9202 - ExifBrightness = &H9203 - ExifExposureBias = &H9204 - ExifMaxAperture = &H9205 - ExifSubjectDist = &H9206 - ExifMeteringMode = &H9207 - ExifLightSource = &H9208 - ExifFlash = &H9209 - ExifFocalLength = &H920A - ExifMakerNote = &H927C - ExifUserComment = &H9286 - ExifDTSubsec = &H9290 - ExifDTOrigSS = &H9291 - ExifDTDigSS = &H9292 - ExifFPXVer = &HA000 - ExifColorSpace = &HA001 - ExifPixXDim = &HA002 - ExifPixYDim = &HA003 - ExifRelatedWav = &HA004 - ExifInterop = &HA005 - ExifFlashEnergy = &HA20B - ExifSpatialFR = &HA20C - ExifFocalXRes = &HA20E - ExifFocalYRes = &HA20F - ExifFocalResUnit = &HA210 - ExifSubjectLoc = &HA214 - ExifExposureIndex = &HA215 - ExifSensingMethod = &HA217 - ExifFileSource = &HA300 - ExifSceneType = &HA301 - ExifCfaPattern = &HA302 - GpsVer = &H0 - GpsLatitudeRef = &H1 - GpsLatitude = &H2 - GpsLongitudeRef = &H3 - GpsLongitude = &H4 - GpsAltitudeRef = &H5 - GpsAltitude = &H6 - GpsGpsTime = &H7 - GpsGpsSatellites = &H8 - GpsGpsStatus = &H9 - GpsGpsMeasureMode = &HA - GpsGpsDop = &HB - GpsSpeedRef = &HC - GpsSpeed = &HD - GpsTrackRef = &HE - GpsTrack = &HF - GpsImgDirRef = &H10 - GpsImgDir = &H11 - GpsMapDatum = &H12 - GpsDestLatRef = &H13 - GpsDestLat = &H14 - GpsDestLongRef = &H15 - GpsDestLong = &H16 - GpsDestBearRef = &H17 - GpsDestBear = &H18 - GpsDestDistRef = &H19 - GpsDestDist = &H1A - End Enum - - '''----------------------------------------------------------------------------- - ''' - ''' Real position of 0th row and column of picture - ''' - ''' - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public Enum Orientations - TopLeft = 1 - TopRight = 2 - BottomRight = 3 - BottomLeft = 4 - LeftTop = 5 - RightTop = 6 - RightBottom = 7 - LftBottom = 8 - End Enum - - '''----------------------------------------------------------------------------- - ''' - ''' Exposure programs - ''' - ''' - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public Enum ExposurePrograms - Manual = 1 - Normal = 2 - AperturePriority = 3 - ShutterPriority = 4 - Creative = 5 - Action = 6 - Portrait = 7 - Landscape = 8 - End Enum - - '''----------------------------------------------------------------------------- - ''' - ''' Exposure metering modes - ''' - ''' - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public Enum ExposureMeteringModes - Unknown = 0 - Average = 1 - CenterWeightedAverage = 2 - Spot = 3 - MultiSpot = 4 - MultiSegment = 5 - [Partial] = 6 - Other = 255 - End Enum - - '''----------------------------------------------------------------------------- - ''' - ''' Flash activity modes - ''' - ''' - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public Enum FlashModes - NotFired = 0 - Fired = 1 - FiredButNoStrobeReturned = 5 - FiredAndStrobeReturned = 7 - End Enum - - '''----------------------------------------------------------------------------- - ''' - ''' Possible light sources (white balance) - ''' - ''' - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public Enum LightSources - Unknown = 0 - Daylight = 1 - Fluorescent = 2 - Tungsten = 3 - Flash = 10 - StandardLightA = 17 - StandardLightB = 18 - StandardLightC = 19 - D55 = 20 - D65 = 21 - D75 = 22 - Other = 255 - End Enum - - '''----------------------------------------------------------------------------- - ''' - ''' Represents rational which is type of some Exif properties - ''' - ''' - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public Structure Rational - Dim Numerator As Int32 - Dim Denominator As Int32 - - '''----------------------------------------------------------------------------- - ''' - ''' Converts rational to string representation - ''' - ''' Optional, default "/". String to be used as delimiter of components. - ''' String representation of the rational. - ''' - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Shadows Function ToString(Optional ByVal Delimiter As String = "/") As String - Return Numerator & Delimiter & Denominator - End Function - - '''----------------------------------------------------------------------------- - ''' - ''' Converts rational to double precision real number - ''' - ''' The rational as double precision real number. - ''' - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Function ToDouble() As Double - Return Numerator / Denominator - End Function - End Structure - - '''----------------------------------------------------------------------------- - ''' - ''' Initializes new instance of this class. - ''' - ''' Bitmap to read exif information from - ''' - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public Sub New(ByVal Bitmap As System.Drawing.Bitmap) - If Bitmap Is Nothing Then Throw New ArgumentNullException("Bitmap") - Me.Image = Bitmap - End Sub - - '''----------------------------------------------------------------------------- - ''' - ''' Returns all available data in formatted string form - ''' - ''' - ''' - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public Overrides Function ToString() As String - Dim SB As New System.Text.StringBuilder - - SB.Append("Image:") - SB.Append("\n\tDimensions: " & Me.Width & " x " & Me.Height & " px") - SB.Append("\n\tResolution: " & Me.ResolutionX & " x " & Me.ResolutionY & " dpi") - SB.Append("\n\tOrientation: " & [Enum].GetName(GetType(Orientations), Me.Orientation)) - SB.Append("\n\tTitle: " & Me.Title) - SB.Append("\n\tDescription: " & Me.Description) - SB.Append("\n\tCopyright: " & Me.Copyright) - SB.Append("\nEquipment:") - SB.Append("\n\tMaker: " & Me.EquipmentMaker) - SB.Append("\n\tModel: " & Me.EquipmentModel) - SB.Append("\n\tSoftware: " & Me.Software) - SB.Append("\nDate and time:") - SB.Append("\n\tGeneral: " & Me.DateTimeLastModified.ToString()) - SB.Append("\n\tOriginal: " & Me.DateTimeOriginal.ToString()) - SB.Append("\n\tDigitized: " & Me.DateTimeDigitized.ToString()) - SB.Append("\nShooting conditions:") - SB.Append("\n\tExposure time: " & Me.ExposureTime.ToString("N4") & " s") - SB.Append("\n\tExposure program: " & [Enum].GetName(GetType(ExposurePrograms), Me.ExposureProgram)) - SB.Append("\n\tExposure mode: " & [Enum].GetName(GetType(ExposureMeteringModes), Me.ExposureMeteringMode)) - SB.Append("\n\tAperture: F" & Me.Aperture.ToString("N2")) - SB.Append("\n\tISO sensitivity: " & Me.ISO) - SB.Append("\n\tSubject distance: " & Me.SubjectDistance.ToString("N2") & " m") - SB.Append("\n\tFocal length: " & Me.FocalLength) - SB.Append("\n\tFlash: " & [Enum].GetName(GetType(FlashModes), Me.FlashMode)) - SB.Append("\n\tLight source (WB): " & [Enum].GetName(GetType(LightSources), Me.LightSource)) - SB.Append("\n\nCopyright (c) Michal A. Valasek - Altair Communications, 2003") - SB.Append("\nhttp://software.altaircom.net * support@altaircom.net") - - SB.Replace("\n", vbCrLf) - SB.Replace("\t", vbTab) - Return SB.ToString() - End Function - - '''----------------------------------------------------------------------------- - ''' - ''' Brand of equipment (EXIF EquipMake) - ''' - ''' - ''' - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public ReadOnly Property EquipmentMaker() As String - Get - Return Me.GetPropertyString(TagNames.EquipMake) - End Get - End Property - - '''----------------------------------------------------------------------------- - ''' - ''' Model of equipment (EXIF EquipModel) - ''' - ''' - ''' - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public ReadOnly Property EquipmentModel() As String - Get - Return Me.GetPropertyString(TagNames.EquipModel) - End Get - End Property - - '''----------------------------------------------------------------------------- - ''' - ''' Software used for processing (EXIF Software) - ''' - ''' - ''' - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public ReadOnly Property Software() As String - Get - Return Me.GetPropertyString(TagNames.SoftwareUsed) - End Get - End Property - - '''----------------------------------------------------------------------------- - ''' - ''' Orientation of image (position of row 0, column 0) (EXIF Orientation) - ''' - ''' - ''' - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public ReadOnly Property Orientation() As Orientations - Get - Dim X As Int32 = Me.GetPropertyInt16(TagNames.Orientation) - - If Not [Enum].IsDefined(GetType(Orientations), X) Then - Return Orientations.TopLeft - Else - Return CType([Enum].Parse(GetType(Orientations), [Enum].GetName(GetType(Orientations), X)), Orientations) - End If - End Get - End Property - - '''----------------------------------------------------------------------------- - ''' - ''' Time when image was last modified (EXIF DateTime). - ''' - ''' - ''' - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public ReadOnly Property DateTimeLastModified() As DateTime - Get - Try - Return DateTime.ParseExact(Me.GetPropertyString(TagNames.DateTime), "yyyy\:MM\:dd HH\:mm\:ss", Nothing) - Catch ex As Exception - Return DateTime.MinValue - End Try - End Get - End Property - - '''----------------------------------------------------------------------------- - ''' - ''' Time when image was taken (EXIF DateTimeOriginal). - ''' - ''' - ''' - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public ReadOnly Property DateTimeOriginal() As DateTime - Get - Try - Return DateTime.ParseExact(Me.GetPropertyString(TagNames.ExifDTOrig), "yyyy\:MM\:dd HH\:mm\:ss", Nothing) - Catch ex As Exception - Return DateTime.MinValue - End Try - End Get - End Property - - '''----------------------------------------------------------------------------- - ''' - ''' Time when image was digitized (EXIF DateTimeDigitized). - ''' - ''' - ''' - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public ReadOnly Property DateTimeDigitized() As DateTime - Get - Try - Return DateTime.ParseExact(Me.GetPropertyString(TagNames.ExifDTDigitized), "yyyy\:MM\:dd HH\:mm\:ss", Nothing) - Catch ex As Exception - Return DateTime.MinValue - End Try - End Get - End Property - - '''----------------------------------------------------------------------------- - ''' - ''' Image width - ''' - ''' - ''' - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public ReadOnly Property Width() As Int16 - Get - Return Me.GetPropertyInt16(TagNames.ImageWidth) - End Get - End Property - - '''----------------------------------------------------------------------------- - ''' - ''' Image height - ''' - ''' - ''' - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public ReadOnly Property Height() As Int16 - Get - Return Me.GetPropertyInt16(TagNames.ImageHeight) - End Get - End Property - - '''----------------------------------------------------------------------------- - ''' - ''' X resolution in dpi (EXIF XResolution/ResolutionUnit) - ''' - ''' - ''' - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public ReadOnly Property ResolutionX() As Double - Get - Dim R As Double = Me.GetPropertyRational(TagNames.XResolution).ToDouble() - - If Me.GetPropertyInt16(TagNames.ResolutionUnit) = 3 Then - '-- resolution is in points/cm - Return R * 2.54 - Else - '-- resolution is in points/inch - Return R - End If - End Get - End Property - - '''----------------------------------------------------------------------------- - ''' - ''' Y resolution in dpi (EXIF YResolution/ResolutionUnit) - ''' - ''' - ''' - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public ReadOnly Property ResolutionY() As Double - Get - Dim R As Double = Me.GetPropertyRational(TagNames.YResolution).ToDouble() - - If Me.GetPropertyInt16(TagNames.ResolutionUnit) = 3 Then - '-- resolution is in points/cm - Return R * 2.54 - Else - '-- resolution is in points/inch - Return R - End If - End Get - End Property - - '''----------------------------------------------------------------------------- - ''' - ''' Image title (EXIF ImageTitle) - ''' - ''' - ''' - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public ReadOnly Property Title() As String - Get - Return Me.GetPropertyString(TagNames.ImageTitle) - End Get - End Property - - '''----------------------------------------------------------------------------- - ''' - ''' Image description (EXIF ImageDescription) - ''' - ''' - ''' - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public ReadOnly Property Description() As String - Get - Return Me.GetPropertyString(TagNames.ImageDescription) - End Get - End Property - - '''----------------------------------------------------------------------------- - ''' - ''' Image copyright (EXIF Copyright) - ''' - ''' - ''' - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public ReadOnly Property Copyright() As String - Get - Return Me.GetPropertyString(TagNames.Copyright) - End Get - End Property - - '''----------------------------------------------------------------------------- - ''' - ''' Exposure time in seconds (EXIF ExifExposureTime/ExifShutterSpeed) - ''' - ''' - ''' - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public ReadOnly Property ExposureTime() As Double - Get - If Me.IsPropertyDefined(TagNames.ExifExposureTime) Then - '-- Exposure time is explicitly specified - Return Me.GetPropertyRational(TagNames.ExifExposureTime).ToDouble - ElseIf Me.IsPropertyDefined(TagNames.ExifShutterSpeed) Then - '-- Compute exposure time from shutter speed - Return 1 / (2 ^ Me.GetPropertyRational(TagNames.ExifShutterSpeed).ToDouble) - Else - '-- Can't figure out - Return 0 - End If - End Get - End Property - - '''----------------------------------------------------------------------------- - ''' - ''' Aperture value as F number (EXIF ExifFNumber/ExifApertureValue) - ''' - ''' - ''' - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public ReadOnly Property Aperture() As Double - Get - If Me.IsPropertyDefined(TagNames.ExifFNumber) Then - Return Me.GetPropertyRational(TagNames.ExifFNumber).ToDouble() - ElseIf Me.IsPropertyDefined(TagNames.ExifAperture) Then - Return System.Math.Sqrt(2) ^ Me.GetPropertyRational(TagNames.ExifAperture).ToDouble() - Else - Return 0 - End If - End Get - End Property - - '''----------------------------------------------------------------------------- - ''' - ''' Exposure program used (EXIF ExifExposureProg) - ''' - ''' - ''' If not specified, returns Normal (2) - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public ReadOnly Property ExposureProgram() As ExposurePrograms - Get - Dim X As Int32 = Me.GetPropertyInt16(TagNames.ExifExposureProg) - - If [Enum].IsDefined(GetType(ExposurePrograms), X) Then - Return CType([Enum].Parse(GetType(ExposurePrograms), [Enum].GetName(GetType(ExposurePrograms), X)), ExposurePrograms) - Else - Return ExposurePrograms.Normal - End If - End Get - End Property - - '''----------------------------------------------------------------------------- - ''' - ''' ISO sensitivity - ''' - ''' - ''' - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public ReadOnly Property ISO() As Int16 - Get - Return Me.GetPropertyInt16(TagNames.ExifISOSpeed) - End Get - End Property - - '''----------------------------------------------------------------------------- - ''' - ''' Subject distance in meters (EXIF SubjectDistance) - ''' - ''' - ''' - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public ReadOnly Property SubjectDistance() As Double - Get - Return Me.GetPropertyRational(TagNames.ExifSubjectDist).ToDouble() - End Get - End Property - - '''----------------------------------------------------------------------------- - ''' - ''' Exposure method metering mode used (EXIF MeteringMode) - ''' - ''' - ''' If not specified, returns Unknown (0) - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public ReadOnly Property ExposureMeteringMode() As ExposureMeteringModes - Get - Dim X As Int32 = Me.GetPropertyInt16(TagNames.ExifMeteringMode) - - If [Enum].IsDefined(GetType(ExposureMeteringModes), X) Then - Return CType([Enum].Parse(GetType(ExposureMeteringModes), [Enum].GetName(GetType(ExposureMeteringModes), X)), ExposureMeteringModes) - Else - Return ExposureMeteringModes.Unknown - End If - End Get - End Property - - '''----------------------------------------------------------------------------- - ''' - ''' Focal length of lenses in mm (EXIF FocalLength) - ''' - ''' - ''' - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public ReadOnly Property FocalLength() As Double - Get - Return Me.GetPropertyRational(TagNames.ExifFocalLength).ToDouble - End Get - End Property - - '''----------------------------------------------------------------------------- - ''' - ''' Flash mode (EXIF Flash) - ''' - ''' - ''' If not present, value NotFired (0) is returned - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public ReadOnly Property FlashMode() As FlashModes - Get - Dim X As Int32 = Me.GetPropertyInt16(TagNames.ExifFlash) - - If [Enum].IsDefined(GetType(FlashModes), X) Then - Return CType([Enum].Parse(GetType(FlashModes), [Enum].GetName(GetType(FlashModes), X)), FlashModes) - Else - Return FlashModes.NotFired - End If - End Get - End Property - - '''----------------------------------------------------------------------------- - ''' - ''' Light source / white balance (EXIF LightSource) - ''' - ''' - ''' If not specified, returns Unknown (0). - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public ReadOnly Property LightSource() As LightSources - Get - Dim X As Int32 = Me.GetPropertyInt16(TagNames.ExifLightSource) - - If [Enum].IsDefined(GetType(LightSources), X) Then - Return CType([Enum].Parse(GetType(LightSources), [Enum].GetName(GetType(LightSources), X)), LightSources) - Else - Return LightSources.Unknown - End If - End Get - End Property - - '''----------------------------------------------------------------------------- - ''' - ''' Checks if current image has specified certain property - ''' - ''' - ''' True if image has specified property, False otherwise. - ''' - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public Function IsPropertyDefined(ByVal PID As Int32) As Boolean - Return CBool([Array].IndexOf(Me.Image.PropertyIdList, PID) > -1) - End Function - - '''----------------------------------------------------------------------------- - ''' - ''' Gets specified Int32 property - ''' - ''' Property ID - ''' Optional, default 0. Default value returned if property is not present. - ''' Value of property or DefaultValue if property is not present. - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public Function GetPropertyInt32(ByVal PID As Int32, Optional ByVal DefaultValue As Int32 = 0) As Int32 - If Me.IsPropertyDefined(PID) Then - Return GetInt32(Me.Image.GetPropertyItem(PID).Value) - Else - Return DefaultValue - End If - End Function - - '''----------------------------------------------------------------------------- - ''' - ''' Gets specified Int16 property - ''' - ''' Property ID - ''' Optional, default 0. Default value returned if property is not present. - ''' Value of property or DefaultValue if property is not present. - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public Function GetPropertyInt16(ByVal PID As Int32, Optional ByVal DefaultValue As Int16 = 0) As Int16 - If Me.IsPropertyDefined(PID) Then - Return GetInt16(Me.Image.GetPropertyItem(PID).Value) - Else - Return DefaultValue - End If - End Function - - '''----------------------------------------------------------------------------- - ''' - ''' Gets specified string property - ''' - ''' Property ID - ''' Optional, default String.Empty. Default value returned if property is not present. - ''' - ''' Value of property or DefaultValue if property is not present. - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public Function GetPropertyString(ByVal PID As Int32, Optional ByVal DefaultValue As String = "") As String - If Me.IsPropertyDefined(PID) Then - Return GetString(Me.Image.GetPropertyItem(PID).Value) - Else - Return DefaultValue - End If - End Function - - '''----------------------------------------------------------------------------- - ''' - ''' Gets specified rational property - ''' - ''' Property ID - ''' - ''' Value of property or 0/1 if not present. - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public Function GetPropertyRational(ByVal PID As Int32) As Rational - If Me.IsPropertyDefined(PID) Then - Return GetRational(Me.Image.GetPropertyItem(PID).Value) - Else - Dim R As Rational - R.Numerator = 0 - R.Denominator = 1 - Return R - End If - End Function - - '''----------------------------------------------------------------------------- - ''' - ''' Reads Int32 from EXIF bytearray. - ''' - ''' EXIF bytearray to process - ''' - ''' - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public Shared Function GetInt32(ByVal B As Byte()) As Int32 - If B.Length < 4 Then Throw New ArgumentException("Data too short (4 bytes expected)", "B") - Return B(3) << 24 Or B(2) << 16 Or B(1) << 8 Or B(0) - End Function - - '''----------------------------------------------------------------------------- - ''' - ''' Reads Int16 from EXIF bytearray. - ''' - ''' EXIF bytearray to process - ''' - ''' - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public Shared Function GetInt16(ByVal B As Byte()) As Int16 - If B.Length < 2 Then Throw New ArgumentException("Data too short (2 bytes expected)", "B") - Return B(1) << 8 Or B(0) - End Function - - '''----------------------------------------------------------------------------- - ''' - ''' Reads string from EXIF bytearray. - ''' - ''' EXIF bytearray to process - ''' - ''' - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public Shared Function GetString(ByVal B As Byte()) As String - Dim R As String = System.Text.Encoding.ASCII.GetString(B) - If R.EndsWith(vbNullChar) Then R = R.Substring(0, R.Length - 1) - Return R - End Function - - '''----------------------------------------------------------------------------- - ''' - ''' Reads rational from EXIF bytearray. - ''' - ''' EXIF bytearray to process - ''' - ''' - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public Shared Function GetRational(ByVal B As Byte()) As Rational - Dim R As New Rational, N(3), D(3) As Byte - Array.Copy(B, 0, N, 0, 4) - Array.Copy(B, 4, D, 0, 4) - R.Denominator = GetInt32(D) - R.Numerator = GetInt32(N) - Return R - End Function - - '''----------------------------------------------------------------------------- - ''' - ''' Disposes unmanaged resources of this class - ''' - ''' - ''' - ''' [altair] 10.9.2003 Created - ''' - '''----------------------------------------------------------------------------- - Public Sub Dispose() Implements System.IDisposable.Dispose - Me.Image.Dispose() - End Sub -End Class diff --git a/imagecatalog/FileHelper.vb b/imagecatalog/FileHelper.vb deleted file mode 100644 index d8b9f3d..0000000 --- a/imagecatalog/FileHelper.vb +++ /dev/null @@ -1,252 +0,0 @@ -Imports System.Collections.Concurrent -Imports System.IO -Imports System.Collections.Generic -Imports MaddoShared - -Public Class FileHelper - 'Private dirSourceDest As Dictionary(Of FileInfo, DirectoryInfo) - Private filesPerFolder As Integer - Private suffix As String - Private counterSize As Integer - Private numerationType As Integer - Private filter As String - Private separateFiles As Boolean - Private extensions As String = "*.jpg,*.png,*.gif" - - - Public Enum numerazione - Progressiva - Files - End Enum - ''' - ''' Preparazione per la separazione - ''' - ''' - ''' - ''' - ''' - ''' - Public Sub New(ByVal filesPerFolder As Integer, ByVal suffix As String, ByVal counterSize As Integer, ByVal numerationType As Integer) - Me.filesPerFolder = filesPerFolder - Me.suffix = suffix - Me.counterSize = counterSize - Me.numerationType = numerationType - Me.separateFiles = True - End Sub - - ''' - ''' nessuna separazione - ''' - ''' - Public Sub New() - Me.separateFiles = False - End Sub - - - Public Function GetFilesRecursive(ByVal root As DirectoryInfo, ByVal destRoot As DirectoryInfo, ByVal filter As String) As Dictionary(Of FileInfo, DirectoryInfo) - Dim dirSourceDest As New Dictionary(Of FileInfo, DirectoryInfo) - Dim result As New List(Of FileInfo) - - 'Dim stack As New Stack(Of DirectoryInfo) - Dim stack As New Stack(Of KeyValuePair(Of DirectoryInfo, DirectoryInfo)) - - - Me.filter = filter - Dim pair As New KeyValuePair(Of DirectoryInfo, DirectoryInfo) - - - 'stack.Push(root) - stack.Push(New KeyValuePair(Of DirectoryInfo, DirectoryInfo)(root, destRoot)) - - Do While (stack.Count > 0) - Dim curDirKV As KeyValuePair(Of DirectoryInfo, DirectoryInfo) = stack.Pop - 'curDirKP = stack.Pop() - Dim dir As DirectoryInfo = curDirKV.Key - Dim dDir As DirectoryInfo = curDirKV.Value - Try - 'result.AddRange(dir.GetFiles(filter, SearchOption.TopDirectoryOnly)) - ' dividere file qui - If filesPerFolder > 0 And separateFiles Then - appendDictionary(dirSourceDest, dividiFilesInDir(dir, dDir)) - Else - appendDictionary(dirSourceDest, getAllFilesInDir(dir, dDir)) - End If - - - - For Each subDirectory As DirectoryInfo In dir.GetDirectories - stack.Push(New KeyValuePair(Of DirectoryInfo, DirectoryInfo)(subDirectory, New DirectoryInfo(Path.Combine(dDir.FullName, subDirectory.Name)))) - - Next - Catch ex As Exception - Dim e As Exception = ex.Demystify() - Console.WriteLine(e) - Console.WriteLine(e.Message) - Console.WriteLine(e.StackTrace) - End Try - Loop - - Return dirSourceDest - End Function - - 'Public Class FileData - ' Public File As FileInfo - ' Public Directory As DirectoryInfo - ' Public Sub New(newFile As FileInfo, newDirectory As DirectoryInfo) - ' File = newFile - ' Directory = newDirectory - ' End Sub - 'End Class - - 'Public Function GetFilesRecursiveParallel(ByVal root As DirectoryInfo, ByVal destRoot As DirectoryInfo, ByVal filter As String) As List(Of FileData) - - - ' Dim dirSourceDest As New ConcurrentDictionary(Of FileInfo, DirectoryInfo) - ' Dim result As New List(Of FileInfo) - - ' 'Dim stack As New Stack(Of DirectoryInfo) - ' Dim stack As New Stack(Of KeyValuePair(Of DirectoryInfo, DirectoryInfo)) - - - ' Me.filter = filter - ' Dim pair As New KeyValuePair(Of DirectoryInfo, DirectoryInfo) - - - ' 'stack.Push(root) - ' stack.Push(New KeyValuePair(Of DirectoryInfo, DirectoryInfo)(root, destRoot)) - - ' Do While (stack.Count > 0) - ' Dim curDirKV As KeyValuePair(Of DirectoryInfo, DirectoryInfo) = stack.Pop - ' 'curDirKP = stack.Pop() - ' Dim dir As DirectoryInfo = curDirKV.Key - ' Dim dDir As DirectoryInfo = curDirKV.Value - ' Try - ' 'result.AddRange(dir.GetFiles(filter, SearchOption.TopDirectoryOnly)) - ' ' dividere file qui - ' If filesPerFolder > 0 And separateFiles Then - ' AppendDictionaryConcurrent(dirSourceDest, DividiFilesInDirConcurrent(dir, dDir)) - ' Else - ' AppendDictionaryConcurrent(dirSourceDest, DividiFilesInDirConcurrent(dir, dDir)) - ' End If - - ' For Each subDirectory As DirectoryInfo In dir.GetDirectories - ' stack.Push(New KeyValuePair(Of DirectoryInfo, DirectoryInfo)(subDirectory, New DirectoryInfo(Path.Combine(dDir.FullName, subDirectory.Name)))) - - ' Next - ' Catch ex As Exception - ' ' TODO: FARE QUALCOSA - ' End Try - ' Loop - - ' Dim resultData As New List(Of FileData) - ' resultData.AddRange(From p In dirSourceDest Select New FileData(p.Key, p.Value)) - ' Return resultData - ' 'Return dirSourceDest - 'End Function - - Public Function appendDictionary(ByVal dictA As Dictionary(Of FileInfo, DirectoryInfo), ByVal dictB As Dictionary(Of FileInfo, DirectoryInfo)) As Dictionary(Of FileInfo, DirectoryInfo) - For Each pair As KeyValuePair(Of FileInfo, DirectoryInfo) In dictB - dictA.Add(pair.Key, pair.Value) - Next - Return dictA - End Function - - 'Public Function AppendDictionaryConcurrent(ByVal dictA As ConcurrentDictionary(Of FileInfo, DirectoryInfo), ByVal dictB As ConcurrentDictionary(Of FileInfo, DirectoryInfo)) As ConcurrentDictionary(Of FileInfo, DirectoryInfo) - ' For Each pair As KeyValuePair(Of FileInfo, DirectoryInfo) In dictB - ' dictA.TryAdd(pair.Key, pair.Value) - ' 'dictA.Add(pair.Key, pair.Value) - ' Next - ' Return dictA - 'End Function - - Public Function getAllFilesInDir(dir As DirectoryInfo, dirDest As DirectoryInfo) As Dictionary(Of FileInfo, DirectoryInfo) - Dim dict As New Dictionary(Of FileInfo, DirectoryInfo) - For Each File As FileInfo In dir.GetFiles(filter) - dict.Add(File, New DirectoryInfo(Path.Combine(dirDest.FullName, File.Name))) - - Next - Return dict - End Function - - Private Function dividiFilesInDir(dir As DirectoryInfo, dirDest As DirectoryInfo) As Dictionary(Of FileInfo, DirectoryInfo) - Dim filesCount As Integer = dir.GetFiles(filter).Count - Dim contaFilePerDir As Integer = 0 - Dim contaDirPerDir As Integer = 0 - Dim tempText As String = String.Empty - Dim foldersDict As New Dictionary(Of FileInfo, DirectoryInfo) - - Dim destDir As DirectoryInfo - destDir = New DirectoryInfo(Path.Combine(dirDest.FullName)) - For Each file As FileInfo In dir.GetFiles(filter) - - contaFilePerDir += 1 - - If contaFilePerDir = (contaDirPerDir * filesPerFolder) + 1 Then - contaDirPerDir += 1 - - If numerationType = numerazione.Progressiva Then - tempText = contaDirPerDir.ToString - Else - tempText = (contaDirPerDir * filesPerFolder).ToString - End If - Dim i As Integer - For i = 1 To (counterSize - tempText.Length) - tempText = "0" & tempText - Next - destDir = New DirectoryInfo(Path.Combine(dirDest.FullName, suffix + tempText)) - - - - End If - - If Not destDir.Exists Then - destDir.Create() - End If - - foldersDict.Add(file, destDir) - Next - - Return foldersDict - End Function - - Private Function DividiFilesInDirConcurrent(dir As DirectoryInfo, dirDest As DirectoryInfo) As ConcurrentDictionary(Of FileInfo, DirectoryInfo) - Dim filesCount As Integer = dir.GetFiles(filter).Count - Dim contaFilePerDir As Integer = 0 - Dim contaDirPerDir As Integer = 0 - Dim tempText As String = String.Empty - Dim foldersDict As New ConcurrentDictionary(Of FileInfo, DirectoryInfo) - - Dim destDir As DirectoryInfo - destDir = New DirectoryInfo(Path.Combine(dirDest.FullName)) - For Each file As FileInfo In dir.GetFiles(filter) - - contaFilePerDir += 1 - - If contaFilePerDir = (contaDirPerDir * filesPerFolder) + 1 Then - contaDirPerDir += 1 - - If numerationType = numerazione.Progressiva Then - tempText = contaDirPerDir.ToString - Else - tempText = (contaDirPerDir * filesPerFolder).ToString - End If - Dim i As Integer - For i = 1 To (counterSize - tempText.Length) - tempText = "0" & tempText - Next - destDir = New DirectoryInfo(Path.Combine(dirDest.FullName, suffix + tempText)) - - - - End If - - If Not destDir.Exists Then - destDir.Create() - End If - - foldersDict.TryAdd(file, destDir) - Next - - Return foldersDict - End Function -End Class diff --git a/imagecatalog/LoadBuffer.cs b/imagecatalog/LoadBuffer.cs deleted file mode 100644 index f116be3..0000000 --- a/imagecatalog/LoadBuffer.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Collections.Generic; -using System.Drawing; -using System.IO; - -namespace ImageCatalog -{ - public class LoadBuffer - { - public List imageList = new List(); - public List picSourceList = new List(); - public List> dirSourceList = new List>(); - } -} \ No newline at end of file diff --git a/imagecatalog/LoadBuffer.vb b/imagecatalog/LoadBuffer.vb deleted file mode 100644 index b59cf11..0000000 --- a/imagecatalog/LoadBuffer.vb +++ /dev/null @@ -1,9 +0,0 @@ -Imports System.Collections.Generic -Imports System.IO - -Public Class LoadBuffer - Public imageList As New List(Of System.Drawing.Image) - Public picSourceList As New List(Of FileInfo) - Public dirSourceList As New List(Of List(Of FileInfo)) - -End Class diff --git a/imagecatalog/MainForm.Designer.cs b/imagecatalog/MainForm.Designer.cs index cb3d6ef..bf1e683 100644 --- a/imagecatalog/MainForm.Designer.cs +++ b/imagecatalog/MainForm.Designer.cs @@ -914,6 +914,7 @@ namespace ImageCatalog // // TextBox29 // + TextBox29.DataBindings.Add(new Binding("Text", bindingSource1, "VerticalText", true, DataSourceUpdateMode.OnPropertyChanged)); TextBox29.Location = new Point(96, 75); TextBox29.Margin = new Padding(4, 5, 4, 5); TextBox29.Multiline = true; diff --git a/imagecatalog/MainForm.cs b/imagecatalog/MainForm.cs index 8430bba..17accea 100644 --- a/imagecatalog/MainForm.cs +++ b/imagecatalog/MainForm.cs @@ -121,8 +121,7 @@ public partial class MainForm // Private ContaFotoCuori As Integer // Private TaskCuori() As PicInfo - - private XYThreadPool MyPool = new XYThreadPool(); + private int ContaImmaginiThread; private int maxThreads = 15; private int minThreads = 5; @@ -375,7 +374,7 @@ public partial class MainForm _parametriSetup.AggiornaParametro("GrandezzaVerticale", TextBox30.Text); _parametriSetup.AggiornaParametro("MargineVerticale", TextBox31.Text); _parametriSetup.AggiornaParametro("DimensioniOriginali", CheckBox15.Checked); - _parametriSetup.AggiornaParametro("TestoVerticale", TextBox29.Text); + _parametriSetup.AggiornaParametro("TestoVerticale", Model.VerticalText); _parametriSetup.AggiornaParametro("NomeMiniatura", RadioButton6.Checked); _parametriSetup.AggiornaParametro("DataFoto", CheckBox16.Checked); _parametriSetup.AggiornaParametro("NumeroFoto", CheckBox17.Checked); @@ -463,7 +462,7 @@ public partial class MainForm TextBox30.Text = _parametriSetup.LeggiParametroString("GrandezzaVerticale"); TextBox31.Text = _parametriSetup.LeggiParametroString("MargineVerticale"); CheckBox15.Checked = _parametriSetup.LeggiParametroBoolean("DimensioniOriginali"); - TextBox29.Text = _parametriSetup.LeggiParametroString("TestoVerticale"); + Model.VerticalText = _parametriSetup.LeggiParametroString("TestoVerticale"); RadioButton6.Checked = _parametriSetup.LeggiParametroBoolean("NomeMiniatura"); CheckBox16.Checked = _parametriSetup.LeggiParametroBoolean("DataFoto"); CheckBox17.Checked = _parametriSetup.LeggiParametroBoolean("NumeroFoto"); @@ -535,7 +534,7 @@ public partial class MainForm } _picSettings.TestoFirmaStart = Model.HorizontalText; - _picSettings.TestoFirmaStartV = TextBox29.Text; + _picSettings.TestoFirmaStartV = Model.VerticalText; _picSettings.DataPartenza = DateTimePicker1.Value; _picSettings.TestoOrario = TextBox18.Text; _picSettings.AltezzaSmall = int.Parse(TextBox6.Text); diff --git a/imagecatalog/ParametriSetup.vb b/imagecatalog/ParametriSetup.vb deleted file mode 100644 index aca5993..0000000 --- a/imagecatalog/ParametriSetup.vb +++ /dev/null @@ -1,167 +0,0 @@ -Imports System.IO - -Public Class ParametriSetup - - - Private _ElencoParametri As DataSet - Private _NomeFileSetup As String - - Public Sub New(ByVal FileSetup As String) - _ElencoParametri = New DataSet - _NomeFileSetup = FileSetup - - If FileSetup <> "" Then - CaricaParametriSetup() - End If - End Sub - - Public Sub New() - _ElencoParametri = New DataSet - _NomeFileSetup = "" - End Sub - - Public Sub CaricaParametriSetup() - _ElencoParametri = LeggiXmlDataSet("Setup", _NomeFileSetup, "Nome") - End Sub - - public sub CaricaParametriSetupStream(ByVal stream As Stream) - _ElencoParametri = LeggiXmlDataSetStream("Setup", stream, "Nome") - End sub - - Public Sub SalvaParametriSetup() - If System.IO.File.Exists(_NomeFileSetup) = True Then - Kill(_NomeFileSetup) - End If - _ElencoParametri.WriteXml(_NomeFileSetup) - End Sub - - Public Function LeggiParametroString(ByVal NomeParametro As String) As String - Dim Risposta As String = "" - - Try - Dim LElenco As DataRow() = _ElencoParametri.Tables("Setup").Select("Nome='" & NomeParametro & "'") - - Dim LaRiga As DataRow - For Each LaRiga In LElenco - Risposta = LaRiga("Valore").ToString - Next - Catch - Risposta = "" - End Try - - Return Risposta - End Function - - Public Function LeggiParametroBoolean(ByVal NomeParametro As String) As Boolean - Dim Risposta As String = "" - - Try - Dim LElenco As DataRow() = _ElencoParametri.Tables("Setup").Select("Nome='" & NomeParametro & "'") - - Dim LaRiga As DataRow - For Each LaRiga In LElenco - Risposta = LaRiga("Valore").ToString - Next - Catch - Risposta = "" - End Try - - Select Case Risposta.ToUpper - Case "TRUE", "OK", "SI", "1", "YES", "VERO" - Return True - Case Else - Return False - End Select - End Function - - Public Sub AggiornaParametro(ByVal NomeParametro As String, ByVal ValoreParametro As Object) - Try - If _ElencoParametri.Tables("Setup") Is Nothing Then - Dim TabellaTmp As New DataTable("Setup") - Dim RigaTmp As DataRow - - Dim LaColonna As DataColumn - LaColonna = TabellaTmp.Columns.Add("Nome", System.Type.GetType("System.String")) - LaColonna = TabellaTmp.Columns.Add("Valore", System.Type.GetType("System.String")) - - '* Aggiunge alla tabella tutte le righe - RigaTmp = TabellaTmp.NewRow - RigaTmp("Nome") = NomeParametro - RigaTmp("Valore") = ValoreParametro - TabellaTmp.Rows.Add(RigaTmp) - - _ElencoParametri.Tables.Add(TabellaTmp) - Else - Dim LElenco As DataRow() = _ElencoParametri.Tables("Setup").Select("Nome='" & NomeParametro & "'") - - If LElenco.Length = 0 Then - Dim LaRiga As DataRow - LaRiga = _ElencoParametri.Tables("Setup").NewRow - LaRiga("Nome") = NomeParametro - LaRiga("Valore") = ValoreParametro - _ElencoParametri.Tables("Setup").Rows.Add(LaRiga) - Else - LElenco(0).Item("Valore") = ValoreParametro - End If - End If - Catch - - End Try - End Sub - - - Private Function LeggiXmlDataTable(ByVal NomeTabella As String, ByVal NomeFileXml As String, Optional ByVal NomeColonnaChiave As String = "") As DataTable - '* Crea e Legge il dataset dal file xml - Dim DataSetXml As New System.Data.DataSet - DataSetXml.ReadXml(NomeFileXml) - - '* Aggiunge il campo chiave - If NomeColonnaChiave <> "" Then - DataSetXml.Tables(NomeTabella).Constraints.Add(NomeColonnaChiave, DataSetXml.Tables(NomeTabella).Columns(NomeColonnaChiave), True) - End If - - '* Restituisce la risposta - Return DataSetXml.Tables(NomeTabella) - End Function - - Private Shared Function LeggiXmlDataSetStream(ByVal NomeTabella As String, ByVal stream As Stream, Optional ByVal NomeColonnaChiave As String = "") As DataSet - '* Crea e Legge il dataset dal file xml - Dim DataSetXml As New System.Data.DataSet - 'DataSetXml.ReadXml(NomeFileXml) - DataSetXml.ReadXml(stream) - - '* Aggiunge il campo chiave - If NomeColonnaChiave <> "" Then - DataSetXml.Tables(NomeTabella).Constraints.Add(NomeColonnaChiave, DataSetXml.Tables(NomeTabella).Columns(NomeColonnaChiave), True) - End If - - '* Restituisce la risposta - Return DataSetXml - End Function - - Private Shared Function LeggiXmlDataSet(ByVal NomeTabella As String, ByVal NomeFileXml As String, Optional ByVal NomeColonnaChiave As String = "") As DataSet - '* Crea e Legge il dataset dal file xml - Dim DataSetXml As New System.Data.DataSet - DataSetXml.ReadXml(NomeFileXml) - - '* Aggiunge il campo chiave - If NomeColonnaChiave <> "" Then - DataSetXml.Tables(NomeTabella).Constraints.Add(NomeColonnaChiave, DataSetXml.Tables(NomeTabella).Columns(NomeColonnaChiave), True) - End If - - '* Restituisce la risposta - Return DataSetXml - End Function - - - Public Property NomeFileSetup() As String - Get - Return _NomeFileSetup - End Get - Set(ByVal Value As String) - _NomeFileSetup = Value - End Set - End Property - - -End Class diff --git a/imagecatalog/XYThreadPool.cs b/imagecatalog/XYThreadPool.cs deleted file mode 100644 index 9f675d1..0000000 --- a/imagecatalog/XYThreadPool.cs +++ /dev/null @@ -1,273 +0,0 @@ -using System; -using System.Collections; -using System.Threading; - -namespace ImageCatalog -{ - public delegate void ThreadErrorHandlerDelegate(ThreadPoolWorkItem oWorkItem, Exception oError); - - public class ThreadPoolWorkItem - { - public bool m_bStoreOutput = false; - public string m_sName = ""; - public Delegate m_pMethod = null; - public object[] m_pInput = null; - public object m_oOutput = null; - public Exception m_oException = null; - - public ThreadPoolWorkItem() - { - } - - public ThreadPoolWorkItem(string sName, Delegate pMethod, object[] pInput, bool bStoreOutput) - { - m_sName = sName; - m_pMethod = pMethod; - m_pInput = pInput; - m_bStoreOutput = bStoreOutput; - } - } - - public class XYThreadPool - { - public XYThreadPool() - { - m_delegateThreadErrorHandler = new ThreadErrorHandlerDelegate(OnThreadError); - } - - private Hashtable m_htThreads = new Hashtable(256); - private int m_nMinThreadCount = 5; - private int m_nMaxThreadCount = 10; - private int m_nShutdownPause = 200; - private int m_nServerPause = 25; - private bool m_bContinue = false; - private Exception m_oException = null; - private Queue m_qInput = new Queue(1024); - private Queue m_qOutput = new Queue(1024); - private Delegate m_delegateThreadErrorHandler; - - private void ThreadProc() - { - while (m_bContinue) - { - object obj = null; - Monitor.Enter(this); - if (m_qInput.Count > 0) - obj = m_qInput.Dequeue(); - Monitor.Exit(this); - if (obj is null) - { - bool bQuit = false; - Monitor.Enter(this); - if (m_htThreads.Count > m_nMinThreadCount) - { - m_htThreads.Remove(Thread.CurrentThread.Name); - bQuit = true; - } - - Monitor.Exit(this); - if (bQuit) - return; - Thread.Sleep(10 * m_nServerPause); - } - else - { - ThreadPoolWorkItem oWorkItem = (ThreadPoolWorkItem)obj; - // oWorkItem.m_oOutput = oWorkItem.m_pMethod.DynamicInvoke(oWorkItem.m_pInput) - try - { - oWorkItem.m_oOutput = oWorkItem.m_pMethod.DynamicInvoke(oWorkItem.m_pInput); - } - catch (Exception oBug) - { - if (m_delegateThreadErrorHandler is object) - { - try - { - var pInput = new object[] { oWorkItem, oBug }; - m_delegateThreadErrorHandler.DynamicInvoke(pInput); - } - catch - { - } - } - } - - if (oWorkItem.m_bStoreOutput) - { - Monitor.Enter(m_qOutput); - m_qOutput.Enqueue(oWorkItem); - Monitor.Exit(m_qOutput); - } - - Thread.Sleep(m_nServerPause); - } - } - } - - private void OnThreadError(ThreadPoolWorkItem oWorkItem, Exception oError) - { - if (oWorkItem is null) - { - m_oException = oError; - } - else - { - oWorkItem.m_oException = oError; - } - } - - public void SetThreadErrorHandler(ThreadErrorHandlerDelegate pMethod) - { - Monitor.Enter(this); - m_delegateThreadErrorHandler = pMethod; - Monitor.Exit(this); - } - - public void SetServerPause(int nMilliseconds) - { - Monitor.Enter(this); - if (nMilliseconds > 9 & nMilliseconds < 101) - m_nServerPause = nMilliseconds; - Monitor.Exit(this); - } - - public void SetShutdownPause(int nMilliseconds) - { - Monitor.Enter(this); - m_nShutdownPause = nMilliseconds; - Monitor.Exit(this); - } - - public Exception GetException() - { - return m_oException; - } - - public void InsertWorkItem(ThreadPoolWorkItem oWorkItem) - { - try - { - Monitor.Enter(this); - m_qInput.Enqueue(oWorkItem); - if (m_bContinue && m_qInput.Count > m_htThreads.Count && m_htThreads.Count < m_nMaxThreadCount) - { - var th = new Thread(ThreadProc); - th.Name = Guid.NewGuid().ToString(); - m_htThreads.Add(th.Name, th); - th.Start(); - } - } - catch (Exception oBug) - { - m_oException = oBug; - } - finally - { - Monitor.Exit(this); - } - } - - public void InsertWorkItem(string sName, Delegate pMethod, object[] pArgs, bool bStoreOutput) - { - InsertWorkItem(new ThreadPoolWorkItem(sName, pMethod, pArgs, bStoreOutput)); - } - - public ThreadPoolWorkItem ExtractWorkItem() - { - object oWorkItem = null; - Monitor.Enter(m_qOutput); - if (m_qOutput.Count > 0) - oWorkItem = m_qOutput.Dequeue(); - Monitor.Exit(m_qOutput); - if (oWorkItem is null) - return null; - return (ThreadPoolWorkItem)oWorkItem; - } - - public bool StartThreadPool(int nMinThreadCount = 5, int nMaxThreadCount = 10) - { - try - { - Monitor.Enter(this); - if (m_bContinue == false) - { - m_bContinue = true; - if (nMinThreadCount > 0) - { - m_nMinThreadCount = nMinThreadCount; - } - - if (nMaxThreadCount > m_nMinThreadCount) - { - m_nMaxThreadCount = nMaxThreadCount; - } - else - { - m_nMaxThreadCount = 2 * m_nMinThreadCount; - } - - int i; - var loopTo = m_nMinThreadCount; - for (i = 1; i <= loopTo; i++) - { - var th = new Thread(ThreadProc); - th.Name = Guid.NewGuid().ToString(); - m_htThreads.Add(th.Name, th); - th.Start(); - } - } - - return true; - } - catch (Exception oBug) - { - m_bContinue = false; - m_oException = oBug; - return false; - } - finally - { - Monitor.Exit(this); - } - } - - public void StopThreadPool() - { - Monitor.Enter(this); - m_bContinue = false; - Thread.Sleep(Math.Max(200, m_nShutdownPause)); - if (m_nShutdownPause > 0) - { - var dict = m_htThreads.GetEnumerator(); - while (dict.MoveNext()) - { - Thread th = (Thread)dict.Value; - if (th.IsAlive) - { - try - { - th.Abort(); - } - catch - { - } - } - } - } - - m_htThreads.Clear(); - m_qInput.Clear(); - // m_qOutput.Clear() - Monitor.Exit(this); - } - - public int GetThreadCount() - { - Monitor.Enter(this); - int nCount = m_htThreads.Count; - Monitor.Exit(this); - return nCount; - } - } -} \ No newline at end of file diff --git a/imagecatalog/XYThreadPool.vb b/imagecatalog/XYThreadPool.vb deleted file mode 100644 index 63460d9..0000000 --- a/imagecatalog/XYThreadPool.vb +++ /dev/null @@ -1,185 +0,0 @@ -Option Explicit On -Option Strict Off - -Imports System.Threading -Imports System.Collections - -Public Delegate Sub ThreadErrorHandlerDelegate(ByVal oWorkItem As ThreadPoolWorkItem, ByVal oError As Exception) - -Public Class ThreadPoolWorkItem - Public m_bStoreOutput As Boolean = False - Public m_sName As String = "" - Public m_pMethod As [Delegate] = Nothing - Public m_pInput As Object() = Nothing - Public m_oOutput As Object = Nothing - Public m_oException As Exception = Nothing - Public Sub New() - End Sub - Public Sub New(ByVal sName As String, ByVal pMethod As [Delegate], ByVal pInput As Object(), ByVal bStoreOutput As Boolean) - m_sName = sName - m_pMethod = pMethod - m_pInput = pInput - m_bStoreOutput = bStoreOutput - End Sub -End Class - -Public Class XYThreadPool - Private m_htThreads As Hashtable = New Hashtable(256) - Private m_nMinThreadCount As Integer = 5 - Private m_nMaxThreadCount As Integer = 10 - Private m_nShutdownPause As Integer = 200 - Private m_nServerPause As Integer = 25 - Private m_bContinue As Boolean = False - Private m_oException As Exception = Nothing - Private m_qInput As Queue = New Queue(1024) - Private m_qOutput As Queue = New Queue(1024) - Private m_delegateThreadErrorHandler As [Delegate] = New ThreadErrorHandlerDelegate(AddressOf OnThreadError) - Private Sub ThreadProc() - While m_bContinue - Dim obj As Object = Nothing - Monitor.Enter(Me) - If m_qInput.Count > 0 Then obj = m_qInput.Dequeue() - Monitor.Exit(Me) - If obj Is Nothing Then - Dim bQuit As Boolean = False - Monitor.Enter(Me) - If m_htThreads.Count > m_nMinThreadCount Then - m_htThreads.Remove(Thread.CurrentThread.Name) - bQuit = True - End If - Monitor.Exit(Me) - If bQuit Then Return - Thread.Sleep(10 * m_nServerPause) - Else - Dim oWorkItem As ThreadPoolWorkItem = CType(obj, ThreadPoolWorkItem) - 'oWorkItem.m_oOutput = oWorkItem.m_pMethod.DynamicInvoke(oWorkItem.m_pInput) - Try - oWorkItem.m_oOutput = oWorkItem.m_pMethod.DynamicInvoke(oWorkItem.m_pInput) - Catch oBug As Exception - If Not m_delegateThreadErrorHandler Is Nothing Then - Try - Dim pInput As Object() = {oWorkItem, oBug} - m_delegateThreadErrorHandler.DynamicInvoke(pInput) - Catch - End Try - End If - End Try - If oWorkItem.m_bStoreOutput Then - Monitor.Enter(m_qOutput) - m_qOutput.Enqueue(oWorkItem) - Monitor.Exit(m_qOutput) - End If - Thread.Sleep(m_nServerPause) - End If - End While - End Sub - Private Sub OnThreadError(ByVal oWorkItem As ThreadPoolWorkItem, ByVal oError As Exception) - If oWorkItem Is Nothing Then - m_oException = oError - Else - oWorkItem.m_oException = oError - End If - End Sub - Public Sub SetThreadErrorHandler(ByVal pMethod As ThreadErrorHandlerDelegate) - Monitor.Enter(Me) - m_delegateThreadErrorHandler = pMethod - Monitor.Exit(Me) - End Sub - Public Sub SetServerPause(ByVal nMilliseconds As Integer) - Monitor.Enter(Me) - If nMilliseconds > 9 And nMilliseconds < 101 Then m_nServerPause = nMilliseconds - Monitor.Exit(Me) - End Sub - Public Sub SetShutdownPause(ByVal nMilliseconds As Integer) - Monitor.Enter(Me) - m_nShutdownPause = nMilliseconds - Monitor.Exit(Me) - End Sub - Public Function GetException() As Exception - Return m_oException - End Function - Public Sub InsertWorkItem(ByVal oWorkItem As ThreadPoolWorkItem) - Try - Monitor.Enter(Me) - m_qInput.Enqueue(oWorkItem) - If m_bContinue AndAlso m_qInput.Count > m_htThreads.Count AndAlso m_htThreads.Count < m_nMaxThreadCount Then - Dim th As Thread = New Thread(AddressOf ThreadProc) - th.Name = Guid.NewGuid.ToString() - m_htThreads.Add(th.Name, th) - th.Start() - End If - Catch oBug As Exception - m_oException = oBug - Finally - Monitor.Exit(Me) - End Try - End Sub - Public Sub InsertWorkItem(ByVal sName As String, ByVal pMethod As [Delegate], ByVal pArgs As Object(), ByVal bStoreOutput As Boolean) - InsertWorkItem(New ThreadPoolWorkItem(sName, pMethod, pArgs, bStoreOutput)) - End Sub - Public Function ExtractWorkItem() As ThreadPoolWorkItem - Dim oWorkItem As Object = Nothing - Monitor.Enter(m_qOutput) - If m_qOutput.Count > 0 Then oWorkItem = m_qOutput.Dequeue() - Monitor.Exit(m_qOutput) - If oWorkItem Is Nothing Then Return Nothing - Return CType(oWorkItem, ThreadPoolWorkItem) - End Function - Public Function StartThreadPool(Optional ByVal nMinThreadCount As Integer = 5, Optional ByVal nMaxThreadCount As Integer = 10) As Boolean - Try - Monitor.Enter(Me) - If m_bContinue = False Then - m_bContinue = True - If nMinThreadCount > 0 Then - m_nMinThreadCount = nMinThreadCount - End If - If nMaxThreadCount > m_nMinThreadCount Then - m_nMaxThreadCount = nMaxThreadCount - Else - m_nMaxThreadCount = 2 * m_nMinThreadCount - End If - Dim i As Integer - For i = 1 To m_nMinThreadCount - Dim th As Thread = New Thread(AddressOf ThreadProc) - th.Name = Guid.NewGuid.ToString() - m_htThreads.Add(th.Name, th) - th.Start() - Next i - End If - Return True - Catch oBug As Exception - m_bContinue = False - m_oException = oBug - Return False - Finally - Monitor.Exit(Me) - End Try - End Function - Public Sub StopThreadPool() - Monitor.Enter(Me) - m_bContinue = False - Thread.Sleep(Math.Max(200, m_nShutdownPause)) - If (m_nShutdownPause > 0) Then - Dim dict As IDictionaryEnumerator = m_htThreads.GetEnumerator() - While dict.MoveNext() - Dim th As Thread = CType(dict.Value(), Thread) - If th.IsAlive Then - Try - th.Abort() - Catch - End Try - End If - End While - End If - m_htThreads.Clear() - m_qInput.Clear() - ' m_qOutput.Clear() - Monitor.Exit(Me) - End Sub - Public Function GetThreadCount() As Integer - Monitor.Enter(Me) - Dim nCount As Integer = m_htThreads.Count - Monitor.Exit(Me) - Return nCount - End Function -End Class \ No newline at end of file -- 2.52.0 From 1b1ca37310897249bc4b8ea8c396d3da9bb006d1 Mon Sep 17 00:00:00 2001 From: Marco Date: Mon, 28 Jul 2025 10:34:43 +0200 Subject: [PATCH 025/127] Deleted projects --- Catalog.sln | 50 -------------------------------------------------- 1 file changed, 50 deletions(-) diff --git a/Catalog.sln b/Catalog.sln index 61fc80b..08396d6 100644 --- a/Catalog.sln +++ b/Catalog.sln @@ -5,18 +5,10 @@ VisualStudioVersion = 17.11.35312.102 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ImageCatalog 2", "imagecatalog\ImageCatalog 2.csproj", "{3F1E23DB-435E-0590-1EF5-735E898DBA3C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageCatalog 3", "ImageCatalogCS\ImageCatalog 3.csproj", "{D11ED7B0-93E8-4F38-A142-EED72D7EE8B5}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CatalogLib", "CatalogLib\CatalogLib.csproj", "{D27ACCF2-80FC-4DE8-AEB8-351FF076E6D5}" -EndProject -Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "CatalogVbLib", "CatalogVbLib\CatalogVbLib.vbproj", "{44465926-240D-473F-90B8-786BA4384406}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{A3D50937-74F6-4DC8-8D89-B534B484C0F9}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MaddoShared", "MaddoShared\MaddoShared.csproj", "{AEBFE9E3-277C-4A7B-8448-145D1B11998B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageCatalogParallel", "ImageCatalogParallel\ImageCatalogParallel.csproj", "{0F42DA5C-2788-48BD-BACA-01625C3CFFBB}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -39,36 +31,6 @@ Global {3F1E23DB-435E-0590-1EF5-735E898DBA3C}.Release|x64.Build.0 = Release|x64 {3F1E23DB-435E-0590-1EF5-735E898DBA3C}.Release|x86.ActiveCfg = Release|x86 {3F1E23DB-435E-0590-1EF5-735E898DBA3C}.Release|x86.Build.0 = Release|x86 - {D11ED7B0-93E8-4F38-A142-EED72D7EE8B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D11ED7B0-93E8-4F38-A142-EED72D7EE8B5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D11ED7B0-93E8-4F38-A142-EED72D7EE8B5}.Debug|x64.ActiveCfg = Debug|x64 - {D11ED7B0-93E8-4F38-A142-EED72D7EE8B5}.Debug|x64.Build.0 = Debug|x64 - {D11ED7B0-93E8-4F38-A142-EED72D7EE8B5}.Debug|x86.ActiveCfg = Debug|Any CPU - {D11ED7B0-93E8-4F38-A142-EED72D7EE8B5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D11ED7B0-93E8-4F38-A142-EED72D7EE8B5}.Release|Any CPU.Build.0 = Release|Any CPU - {D11ED7B0-93E8-4F38-A142-EED72D7EE8B5}.Release|x64.ActiveCfg = Release|x64 - {D11ED7B0-93E8-4F38-A142-EED72D7EE8B5}.Release|x64.Build.0 = Release|x64 - {D11ED7B0-93E8-4F38-A142-EED72D7EE8B5}.Release|x86.ActiveCfg = Release|Any CPU - {D27ACCF2-80FC-4DE8-AEB8-351FF076E6D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D27ACCF2-80FC-4DE8-AEB8-351FF076E6D5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D27ACCF2-80FC-4DE8-AEB8-351FF076E6D5}.Debug|x64.ActiveCfg = Debug|x64 - {D27ACCF2-80FC-4DE8-AEB8-351FF076E6D5}.Debug|x64.Build.0 = Debug|x64 - {D27ACCF2-80FC-4DE8-AEB8-351FF076E6D5}.Debug|x86.ActiveCfg = Debug|Any CPU - {D27ACCF2-80FC-4DE8-AEB8-351FF076E6D5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D27ACCF2-80FC-4DE8-AEB8-351FF076E6D5}.Release|Any CPU.Build.0 = Release|Any CPU - {D27ACCF2-80FC-4DE8-AEB8-351FF076E6D5}.Release|x64.ActiveCfg = Release|x64 - {D27ACCF2-80FC-4DE8-AEB8-351FF076E6D5}.Release|x64.Build.0 = Release|x64 - {D27ACCF2-80FC-4DE8-AEB8-351FF076E6D5}.Release|x86.ActiveCfg = Release|Any CPU - {44465926-240D-473F-90B8-786BA4384406}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {44465926-240D-473F-90B8-786BA4384406}.Debug|Any CPU.Build.0 = Debug|Any CPU - {44465926-240D-473F-90B8-786BA4384406}.Debug|x64.ActiveCfg = Debug|x64 - {44465926-240D-473F-90B8-786BA4384406}.Debug|x64.Build.0 = Debug|x64 - {44465926-240D-473F-90B8-786BA4384406}.Debug|x86.ActiveCfg = Debug|Any CPU - {44465926-240D-473F-90B8-786BA4384406}.Release|Any CPU.ActiveCfg = Release|Any CPU - {44465926-240D-473F-90B8-786BA4384406}.Release|Any CPU.Build.0 = Release|Any CPU - {44465926-240D-473F-90B8-786BA4384406}.Release|x64.ActiveCfg = Release|x64 - {44465926-240D-473F-90B8-786BA4384406}.Release|x64.Build.0 = Release|x64 - {44465926-240D-473F-90B8-786BA4384406}.Release|x86.ActiveCfg = Release|Any CPU {AEBFE9E3-277C-4A7B-8448-145D1B11998B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AEBFE9E3-277C-4A7B-8448-145D1B11998B}.Debug|Any CPU.Build.0 = Debug|Any CPU {AEBFE9E3-277C-4A7B-8448-145D1B11998B}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -81,18 +43,6 @@ Global {AEBFE9E3-277C-4A7B-8448-145D1B11998B}.Release|x64.Build.0 = Release|Any CPU {AEBFE9E3-277C-4A7B-8448-145D1B11998B}.Release|x86.ActiveCfg = Release|Any CPU {AEBFE9E3-277C-4A7B-8448-145D1B11998B}.Release|x86.Build.0 = Release|Any CPU - {0F42DA5C-2788-48BD-BACA-01625C3CFFBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0F42DA5C-2788-48BD-BACA-01625C3CFFBB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0F42DA5C-2788-48BD-BACA-01625C3CFFBB}.Debug|x64.ActiveCfg = Debug|Any CPU - {0F42DA5C-2788-48BD-BACA-01625C3CFFBB}.Debug|x64.Build.0 = Debug|Any CPU - {0F42DA5C-2788-48BD-BACA-01625C3CFFBB}.Debug|x86.ActiveCfg = Debug|Any CPU - {0F42DA5C-2788-48BD-BACA-01625C3CFFBB}.Debug|x86.Build.0 = Debug|Any CPU - {0F42DA5C-2788-48BD-BACA-01625C3CFFBB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0F42DA5C-2788-48BD-BACA-01625C3CFFBB}.Release|Any CPU.Build.0 = Release|Any CPU - {0F42DA5C-2788-48BD-BACA-01625C3CFFBB}.Release|x64.ActiveCfg = Release|Any CPU - {0F42DA5C-2788-48BD-BACA-01625C3CFFBB}.Release|x64.Build.0 = Release|Any CPU - {0F42DA5C-2788-48BD-BACA-01625C3CFFBB}.Release|x86.ActiveCfg = Release|Any CPU - {0F42DA5C-2788-48BD-BACA-01625C3CFFBB}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE -- 2.52.0 From 2fde30572b83f5691fe3133290ae45f89dbe3624 Mon Sep 17 00:00:00 2001 From: Marco Date: Mon, 28 Jul 2025 10:35:51 +0200 Subject: [PATCH 026/127] Removed outdated module --- .gitmodules | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 .gitmodules diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 99a1b50..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "MaddoLibrary"] - path = MaddoLibrary - url = git@gitlab.com:MaddoTools/MaddoLibrary.git -- 2.52.0 From fa889a5cd317e651545d5554ff5d1f4d17fd2fcd Mon Sep 17 00:00:00 2001 From: Marco Date: Mon, 28 Jul 2025 11:25:46 +0200 Subject: [PATCH 027/127] Refactored image creator code --- MaddoShared/ImageCreationStuff.cs | 14 +- MaddoShared/ImageCreatorSharp.cs | 1069 ++++++++++++----------------- MaddoShared/ImageState.cs | 45 ++ MaddoShared/MaddoShared.csproj | 4 + imagecatalog/Program.cs | 1 + 5 files changed, 515 insertions(+), 618 deletions(-) create mode 100644 MaddoShared/ImageState.cs diff --git a/MaddoShared/ImageCreationStuff.cs b/MaddoShared/ImageCreationStuff.cs index 22276a8..66d03cc 100644 --- a/MaddoShared/ImageCreationStuff.cs +++ b/MaddoShared/ImageCreationStuff.cs @@ -13,7 +13,7 @@ using Microsoft.Extensions.Logging; namespace MaddoShared { - public class ImageCreationStuff(ILogger logger, PicSettings picSettings) + public class ImageCreationStuff(ILogger logger, PicSettings picSettings, ImageCreatorSharp imageCreatorService) { public class Options { @@ -72,8 +72,16 @@ namespace MaddoShared using var logoCopy = logoBmp.Clone(new Rectangle(0, 0, logoBmp.Width, logoBmp.Height), logoBmp.PixelFormat); - using var imgCreator = new ImageCreatorSharp(fileData.File, fileData.Directory, picSettings); - await imgCreator.CreaImmagineThread(fileData.File.Name, logoCopy); + var imgState = new ImageState + { + WorkFile = fileData.File, + DestDir = fileData.Directory, + }; + + await imageCreatorService.CreaImmagineThread(imgState, logoCopy); + + // using var imgCreator = new ImageCreatorSharp(fileData.File, fileData.Directory, picSettings); + // await imgCreator.CreaImmagineThread(fileData.File.Name, logoCopy); results.Add(fileData.File.Name); diff --git a/MaddoShared/ImageCreatorSharp.cs b/MaddoShared/ImageCreatorSharp.cs index ef78f98..3837318 100644 --- a/MaddoShared/ImageCreatorSharp.cs +++ b/MaddoShared/ImageCreatorSharp.cs @@ -1,129 +1,59 @@ using System; -using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; -using System.Globalization; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Security; -using System.Text; -using System.Threading.Tasks; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; -using MaddoShared; +using System.IO; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; using SixLabors.ImageSharp.Metadata.Profiles.Exif; // Imports System.Threading +namespace MaddoShared; + [SuppressMessage("Interoperability", "CA1416:Validate platform compatibility")] -public class ImageCreatorSharp : IDisposable +public class ImageCreatorSharp(PicSettings picSettings, ILogger logger) { - private bool FotoRuotaADestra = false; - private bool FotoRuotaASinistra = false; - - private string TempMinText = ""; - // Private crFont1 As Font - private string _NomeFileChild; - - private DirectoryInfo _SourceDir; - private DirectoryInfo _DestDirStart; - private DirectoryInfo _DestDir; - - private FileInfo _workFile; - - private string testoFirma; - private string testoFirmaV; - private int alphaScelta; - private int DimensioneStandard; - private int DimensioneStandardMiniatura; - private DateTime dataFoto; - private DateTime dataPartenzaI; - private string testoOrario; - private string testoFirmaPiccola; - private Size thumbSizeSmall; - private Size thumbSizeBig; - private string nomeFileSmall; - private string nomeFileBig; - private string nomeFileBig2; - - private float yPosFromBottom; - private float yPosFromBottom1; - private float yPosFromBottom2; - private float yPosFromBottom3; - private float yPosFromBottom4; - - private Orientations _orientation; - private DateTime? _creationDate; - - private readonly PicSettings _picSettings; - - public ImageCreatorSharp() - { - } - - public ImageCreatorSharp(string nomeFileChild, DirectoryInfo sourceDir, DirectoryInfo destDir, DirectoryInfo destDirStart) - { - this.NomeFileChild = nomeFileChild; - this.SourceDir = sourceDir; - this.DestDir = destDir; - this.DestDirStart = destDirStart; - this.WorkFile = new FileInfo(nomeFileChild); - } - - public ImageCreatorSharp(string nomeFileChild, DirectoryInfo sourceDir, DirectoryInfo destDir) - { - this.NomeFileChild = nomeFileChild; - this.DestDir = destDir; - } - - public ImageCreatorSharp(FileInfo file, DirectoryInfo destination, PicSettings picSettings) - { - _picSettings = picSettings; - this.WorkFile = file; - this.DestDir = destination; - } - - public async Task CreaImmagineThread(string Info, Image logo) + public async Task CreaImmagineThread(ImageState imgState, Image logo) { + try { await Task.Run(() => { - Console.WriteLine($"File: {WorkFile} Dest: {DestDir}"); - preparaVariabili(); - ExtractExif(); - // Dim g As System.Drawing.Image = System.Drawing.Image.FromFile(Path.Combine(SourceDir.FullName, NomeFileChild)) - using Image g = Image.FromFile(WorkFile.FullName); - // Dim g As System.Drawing.Image = System.Drawing.Image.FromFile(WorkFile.FullName) + logger.LogInformation("File: {FileInfo} Dest: {DirectoryInfo}", imgState.WorkFile, imgState.DestDir); + PreparaVariabili(imgState); + ExtractExif(imgState); + + using var g = Image.FromFile(imgState.WorkFile.FullName); // Imposta testo extra - impostaTestoExtra(g); + ImpostaTestoExtra(g, imgState); // Ruota l'immagine in base ai dati EXIF - Rotation(g); + Rotation(g, imgState); // Forza jpeg se è selezionata l'opzione - System.Drawing.Imaging.ImageFormat thisFormat = g.RawFormat; - if (_picSettings.UsaForzaJpg == true) - thisFormat = System.Drawing.Imaging.ImageFormat.Jpeg; + var thisFormat = g.RawFormat; + if (picSettings.UsaForzaJpg == true) + thisFormat = ImageFormat.Jpeg; - prepareThumbnailSize(g); + PrepareThumbnailSize(g, imgState); + + using var imgOutputBig = new Bitmap(g, imgState.ThumbSizeBig.Width, imgState.ThumbSizeBig.Height); - using Bitmap imgOutputBig = new Bitmap(g, thumbSizeBig.Width, thumbSizeBig.Height); - //Bitmap imgOutputBig = new Bitmap(g, thumbSizeBig.Width, thumbSizeBig.Height); imgOutputBig.SetResolution(g.HorizontalResolution, g.VerticalResolution); // Crea le miniature - creaMiniature(g, imgOutputBig, thisFormat); + CreaMiniature(g, imgState, imgOutputBig, thisFormat); - AggiungiTesto(g, imgOutputBig); + AggiungiTesto(g, imgState, imgOutputBig); - aggiungiLogo(imgOutputBig, logo); + AggiungiLogo(imgOutputBig, imgState, logo); - SalvaFoto(imgOutputBig, thumbSizeBig, nomeFileBig, nomeFileSmall, thumbSizeSmall, thisFormat); + SalvaFoto(imgOutputBig, imgState, thisFormat); }); // g.Dispose() @@ -142,10 +72,10 @@ public class ImageCreatorSharp : IDisposable } } - private void ExtractExif() + private void ExtractExif(ImageState imgState) { - using var img = SixLabors.ImageSharp.Image.Load(_workFile.FullName); - _orientation = Orientations.TopLeft; + using var img = SixLabors.ImageSharp.Image.Load(imgState.WorkFile.FullName); + imgState.Orientation = Orientations.TopLeft; IExifValue rotation = null; @@ -154,7 +84,7 @@ public class ImageCreatorSharp : IDisposable if (found ) { var intOrientation = rotation.Value.ToInt32(); - _orientation = (Orientations)intOrientation; + imgState.Orientation = (Orientations)intOrientation; } IExifValue date = null; @@ -164,37 +94,37 @@ public class ImageCreatorSharp : IDisposable var succ = DateTime.TryParse(date.ToString(), out var crDate); if (succ) { - _creationDate = crDate; + imgState.CreationDate = crDate; } else { - _creationDate = null; + imgState.CreationDate = null; } } else { - _creationDate = null; + imgState.CreationDate = null; } } - private void Rotation(System.Drawing.Image g) + private void Rotation(System.Drawing.Image g, ImageState imgState) { - FotoRuotaADestra = false; - FotoRuotaASinistra = false; + imgState.FotoRuotaADestra = false; + imgState.FotoRuotaASinistra = false; - if (_picSettings.UsaRotazioneAutomatica == true) + if (picSettings.UsaRotazioneAutomatica == true) { if (g.PropertyIdList.Length > 0) { //ExifReader DatiExif = new ExifReader((Bitmap)g); - switch (_orientation /*DatiExif.Orientation*/) + switch (imgState.Orientation /*DatiExif.Orientation*/) { case Orientations.BottomLeft: case Orientations.BottomRight: case Orientations.LeftTop: case Orientations.LftBottom: - FotoRuotaASinistra = true; + imgState.FotoRuotaASinistra = true; break; case Orientations.RightBottom: case Orientations.RightTop: @@ -206,52 +136,50 @@ public class ImageCreatorSharp : IDisposable } } - if (FotoRuotaASinistra == true) + if (imgState.FotoRuotaASinistra) g.RotateFlip(RotateFlipType.Rotate270FlipNone); - if (FotoRuotaADestra == true) + if (imgState.FotoRuotaADestra) g.RotateFlip(RotateFlipType.Rotate90FlipNone); } + /// /// ''' Aggiunge Orario, tempo gara e altri /// ''' /// ''' Image + /// /// ''' - private void impostaTestoExtra(Image g) + private void ImpostaTestoExtra(Image g, ImageState imgState) { - 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) return; + //ExifReader DatiExif = new ExifReader((Bitmap)g); + imgState.DataFoto = imgState.CreationDate ?? DateTime.Now; //DatiExif.DateTimeOriginal; + imgState.TestoFirma = picSettings.TestoFirmaStart; + imgState.TestoFirmaV = picSettings.TestoFirmaStartV; + + if (imgState.DataFoto.Year == 1) return; + imgState.TestoFirmaPiccola = imgState.DataFoto.ToShortTimeString(); + if (picSettings.UsaOrarioTestoApplicare == true) { - //ExifReader DatiExif = new ExifReader((Bitmap)g); - dataFoto = _creationDate ?? DateTime.Now; //DatiExif.DateTimeOriginal; - testoFirma = _picSettings.TestoFirmaStart; - testoFirmaV = _picSettings.TestoFirmaStartV; - - if (dataFoto.Year != 1) - { - testoFirmaPiccola = dataFoto.ToShortTimeString(); - if (_picSettings.UsaOrarioTestoApplicare == true) - { - testoFirma += " " + dataFoto.ToShortDateString() + " " + dataFoto.ToLongTimeString(); - testoFirmaV += " " + dataFoto.ToShortDateString() + " " + dataFoto.ToLongTimeString(); - } - if (_picSettings.UsaTempoGaraTestoApplicare == true) - { - - var diff = dataPartenzaI - dataFoto; - var diffA = diff.TotalSeconds * 10000000; - - TimeSpan Orario = new TimeSpan(0, 0, 0, (int)diffA); - testoFirma += " " + testoOrario + Orario.Hours.ToString("00") + ":" + Orario.Minutes.ToString("00") + ":" + Orario.Seconds.ToString("00"); - testoFirmaV += " " + testoOrario + Orario.Hours.ToString("00") + ":" + Orario.Minutes.ToString("00") + ":" + Orario.Seconds.ToString("00"); - } - } + imgState.TestoFirma += + $" {imgState.DataFoto.ToShortDateString()} {imgState.DataFoto.ToLongTimeString()}"; + imgState.TestoFirmaV += + $" {imgState.DataFoto.ToShortDateString()} {imgState.DataFoto.ToLongTimeString()}"; } + + if (picSettings.UsaTempoGaraTestoApplicare != true) return; + var diff = imgState.DataPartenzaI - imgState.DataFoto; + var diffA = diff.TotalSeconds * 10000000; + + var orario = new TimeSpan(0, 0, 0, (int)diffA); + imgState.TestoFirma += $" {imgState.TestoOrario}{orario.Hours:00}:{orario.Minutes:00}:{orario.Seconds:00}"; + imgState.TestoFirmaV += $" {imgState.TestoOrario}{orario.Hours:00}:{orario.Minutes:00}:{orario.Seconds:00}"; } else { - testoFirma = _picSettings.TestoFirmaStart; - testoFirmaV = _picSettings.TestoFirmaStartV; + imgState.TestoFirma = picSettings.TestoFirmaStart; + imgState.TestoFirmaV = picSettings.TestoFirmaStartV; } } @@ -259,231 +187,225 @@ public class ImageCreatorSharp : IDisposable /// ''' Prepara diverse variabili azzerandole, elaborandole e prendendole dalle impostazioni /// ''' /// ''' - private void preparaVariabili() + private void PreparaVariabili(ImageState imgState) { - alphaScelta = System.Convert.ToInt32((255 * (100 - _picSettings.Trasparenza) / (double)100)); - testoFirma = ""; - testoFirmaV = ""; - dataPartenzaI = _picSettings.DataPartenza; - testoOrario = _picSettings.TestoOrario; - if (testoOrario.Length > 0) - testoOrario += " "; - testoFirmaPiccola = ""; - thumbSizeSmall = new Size(); - thumbSizeBig = new Size(); - nomeFileSmall = ""; - nomeFileBig2 = ""; - nomeFileBig = ""; - DimensioneStandard = _picSettings.DimStandard; - DimensioneStandardMiniatura = _picSettings.DimStandardMiniatura; + imgState.AlphaScelta = System.Convert.ToInt32((255 * (100 - picSettings.Trasparenza) / (double)100)); + imgState.TestoFirma = ""; + imgState.TestoFirmaV = ""; + imgState.DataPartenzaI = picSettings.DataPartenza; + imgState.TestoOrario = picSettings.TestoOrario; + if (imgState.TestoOrario.Length > 0) + imgState.TestoOrario += " "; + imgState.TestoFirmaPiccola = ""; + imgState.ThumbSizeSmall = new Size(); + imgState.ThumbSizeBig = new Size(); + imgState.NomeFileSmall = ""; + imgState.NomeFileBig2 = ""; + imgState.NomeFileBig = ""; + imgState.DimensioneStandard = picSettings.DimStandard; + imgState.DimensioneStandardMiniatura = picSettings.DimStandardMiniatura; // nomeFileSmall = Suffisso & NomeFileChild // nomeFileBig = NomeFileChild - nomeFileSmall = _picSettings.Suffisso + WorkFile.Name; - nomeFileBig = WorkFile.Name; + imgState.NomeFileSmall = picSettings.Suffisso + imgState.WorkFile.Name; + imgState.NomeFileBig = imgState.WorkFile.Name; } - private void prepareThumbnailSize(Image g) + private void PrepareThumbnailSize(Image g, ImageState imgState) { if (g.Width > g.Height) { - thumbSizeSmall = NewthumbSize(g.Width, g.Height, _picSettings.LarghezzaSmall, "Larghezza"); - Size SizeOrig = new Size(g.Width, g.Height); - thumbSizeBig = SizeOrig; + imgState.ThumbSizeSmall = NewthumbSize(g.Width, g.Height, picSettings.LarghezzaSmall, "Larghezza"); + var sizeOrig = new Size(g.Width, g.Height); + imgState.ThumbSizeBig = sizeOrig; } else { - thumbSizeSmall = NewthumbSize(g.Width, g.Height, _picSettings.AltezzaSmall, "Altezza"); - Size SizeOrig = new Size(g.Width, g.Height); - thumbSizeBig = SizeOrig; + imgState.ThumbSizeSmall = NewthumbSize(g.Width, g.Height, picSettings.AltezzaSmall, "Altezza"); + var sizeOrig = new Size(g.Width, g.Height); + imgState.ThumbSizeBig = sizeOrig; } } - private void creaMiniature(Image g, Bitmap imgOutputBig, ImageFormat thisFormat) + private void CreaMiniature(Image g, ImageState imgState, Bitmap imgOutputBig, ImageFormat thisFormat) { - if (_picSettings.TestoMin) - testoFirmaPiccola = nomeFileBig; - else if (_picSettings.AggNumTempMin) - testoFirmaPiccola = nomeFileBig + " "; + if (picSettings.TestoMin) + imgState.TestoFirmaPiccola = imgState.NomeFileBig; + else if (picSettings.AggNumTempMin) + imgState.TestoFirmaPiccola = imgState.NomeFileBig + " "; // Dim yPosFromBottom4 As Single Font crFont1 = null/* TODO Change to default(_) if this is not a reference type */; Font crFont2 = null/* TODO Change to default(_) if this is not a reference type */; - SizeF crSize1 = new SizeF(); - SizeF crSize2 = new SizeF(); + var crSize1 = new SizeF(); + var 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)) - nomeFileSmall = nomeFileSmall.Substring(0, nomeFileSmall.Length - 4) + _picSettings.Codice + nomeFileSmall.Substring(nomeFileSmall.Length - 4); - if (_picSettings.UsaOrarioMiniatura | _picSettings.TestoMin | _picSettings.AggTempoGaraMin | _picSettings.AggNumTempMin) + if (string.Equals(picSettings.DirectorySorgente, picSettings.DirectoryDestinazione, StringComparison.OrdinalIgnoreCase)) + imgState.NomeFileSmall = imgState.NomeFileSmall.Substring(0, imgState.NomeFileSmall.Length - 4) + picSettings.Codice + imgState.NomeFileSmall.Substring(imgState.NomeFileSmall.Length - 4); + if (picSettings.UsaOrarioMiniatura | picSettings.TestoMin | picSettings.AggTempoGaraMin | picSettings.AggNumTempMin) { - if (testoFirmaPiccola.Length > 0) + if (imgState.TestoFirmaPiccola.Length > 0) { - using (var imgOutputSmall = (Bitmap)imgOutputBig.Clone()) + using var imgOutputSmall = (Bitmap)imgOutputBig.Clone(); + using var grPhoto1 = Graphics.FromImage(imgOutputSmall); + grPhoto1.SmoothingMode = SmoothingMode.AntiAlias; + + // quick fix + imgState.DimensioneStandardMiniatura = 50; + if (picSettings.Grassetto == true) { - Graphics grPhoto1; - grPhoto1 = Graphics.FromImage(imgOutputSmall); - grPhoto1.SmoothingMode = SmoothingMode.AntiAlias; - - int LarghezzaStandard1; - // quick fix - DimensioneStandardMiniatura = 50; - if (_picSettings.Grassetto == true) - { - crFont1 = new Font(_picSettings.IlFont, DimensioneStandardMiniatura, FontStyle.Bold); - crFont2 = new Font(_picSettings.IlFont, DimensioneStandard, FontStyle.Bold); - } - else - { - crFont1 = new Font(_picSettings.IlFont, DimensioneStandardMiniatura); - crFont2 = new Font(_picSettings.IlFont, DimensioneStandard); - } - - crSize1 = grPhoto1.MeasureString(testoFirmaPiccola, crFont1); - crSize2 = grPhoto1.MeasureString(testoFirma, crFont1); - LarghezzaStandard1 = System.Convert.ToInt32(crSize1.Width); - - if (crSize1.Width > System.Convert.ToSingle(g.Width)) - { - int Conta = DimensioneStandardMiniatura; - do - { - if (Conta > 20) - Conta -= 5; - else - Conta -= 1; - if (_picSettings.Grassetto == true) - crFont1 = new Font(_picSettings.IlFont, Conta, FontStyle.Bold); - else - crFont1 = new Font(_picSettings.IlFont, Conta); - crSize1 = grPhoto1.MeasureString(testoFirmaPiccola, crFont1); - if (crSize1.Width < System.Convert.ToSingle(g.Width)) - { - LarghezzaStandard1 = System.Convert.ToInt32(crSize1.Width); - break; - } - - if (Conta <= 5) - break; - } - while (true); - DimensioneStandardMiniatura = Conta; - } - - switch (_picSettings.Posizione.ToUpper()) - { - case "ALTO": - { - yPosFromBottom1 = (_picSettings.Margine); - yPosFromBottom4 = (_picSettings.MargVert); - break; - } - - case "BASSO": - { - 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))); - break; - } - } - - float xCenterOfImg1 = 0; - - StringFormat StrFormat1 = new StringFormat(); - switch (_picSettings.Allineamento.ToUpper()) - { - case "SINISTRA": - { - xCenterOfImg1 = System.Convert.ToSingle((_picSettings.Margine + (LarghezzaStandard1 / (double)2))); - - if ((LarghezzaStandard1 / (double)2) > (g.Width / (double)2) - _picSettings.Margine) - xCenterOfImg1 = System.Convert.ToSingle((g.Width / (double)2)); - break; - } - - case "CENTRO": - { - xCenterOfImg1 = System.Convert.ToSingle((g.Width / (double)2)); - break; - } - - case "DESTRA": - { - xCenterOfImg1 = System.Convert.ToSingle((g.Width - _picSettings.Margine - (LarghezzaStandard1 / (double)2))); - - if ((LarghezzaStandard1 / (double)2) > (g.Width / (double)2) - _picSettings.Margine) - xCenterOfImg1 = System.Convert.ToSingle((g.Width / (double)2)); - break; - } - } - StrFormat1.Alignment = StringAlignment.Center; - - SolidBrush semiTransBrush21 = new SolidBrush(Color.FromArgb(alphaScelta, 0, 0, 0)); - SolidBrush semiTransBrush1 = new SolidBrush(Color.FromArgb(alphaScelta, _picSettings.FontColoreRGB)); - - // quick fix - DimensioneStandardMiniatura = _picSettings.DimMin; - - if (_picSettings.Grassetto == true) - crFont1 = new Font(_picSettings.IlFont, DimensioneStandardMiniatura, FontStyle.Bold); - else - crFont1 = new Font(_picSettings.IlFont, DimensioneStandardMiniatura); - // asdgadfhdfhjgfsjgfjygfdhsdafa - if (_picSettings.TestoMin) - { - grPhoto1.DrawString(nomeFileBig, crFont1, semiTransBrush21, new PointF(xCenterOfImg1 + 1, yPosFromBottom1 + 1), StrFormat1); - grPhoto1.DrawString(nomeFileBig, crFont1, semiTransBrush1, new PointF(xCenterOfImg1, yPosFromBottom1), StrFormat1); - } - else if (_picSettings.AggTempoGaraMin & _picSettings.UsaTempoGaraTestoApplicare) - { - var diff = dataPartenzaI - dataFoto; - var diffA = diff.TotalSeconds * 10000000; - - TimeSpan Orario = new TimeSpan(0, 0, (int)diffA);/* new TimeSpan(DateTime.DateDiff(DateInterval.Second, dataPartenzaI, dataFoto) * 10000000);*/ - string tempstr = ""; - - - tempstr += Environment.NewLine + testoOrario + Orario.Hours.ToString("00") + ":" + Orario.Minutes.ToString("00") + ":" + Orario.Seconds.ToString("00"); - - - grPhoto1.DrawString(tempstr, crFont1, semiTransBrush21, new PointF(xCenterOfImg1 + 1, yPosFromBottom1 + 1), StrFormat1); - grPhoto1.DrawString(tempstr, crFont1, semiTransBrush1, new PointF(xCenterOfImg1, yPosFromBottom1), StrFormat1); - } - else if (_picSettings.AggNumTempMin) - { - var diff = dataPartenzaI - dataFoto; - var diffA = diff.TotalSeconds * 10000000; - TimeSpan Orario = new TimeSpan(0, 0, (int)diffA); - string tempstr = ""; - tempstr += nomeFileBig; - - tempstr += Environment.NewLine + testoOrario + Orario.Hours.ToString("00") + ":" + Orario.Minutes.ToString("00") + ":" + Orario.Seconds.ToString("00"); - - - grPhoto1.DrawString(tempstr, crFont1, semiTransBrush21, new PointF(xCenterOfImg1 + 1, yPosFromBottom1 + 1), StrFormat1); - grPhoto1.DrawString(tempstr, crFont1, semiTransBrush1, new PointF(xCenterOfImg1, yPosFromBottom1), StrFormat1); - } - else - { - grPhoto1.DrawString(testoFirmaPiccola, crFont1, semiTransBrush21, new PointF(xCenterOfImg1 + 1, yPosFromBottom1 + 1), StrFormat1); - grPhoto1.DrawString(testoFirmaPiccola, crFont1, semiTransBrush1, new PointF(xCenterOfImg1, yPosFromBottom1), StrFormat1); - } - - // Salva la miniatura - //using (var g22 = Image.FromHbitmap(imgOutputSmall)) - - - using (var imgOutputSmall2 = new Bitmap(imgOutputSmall, thumbSizeSmall.Width, thumbSizeSmall.Height)) - { - imgOutputSmall2.Save(Path.Combine(DestDir.FullName, nomeFileSmall), thisFormat); - - //imgOutputSmall2.Dispose(); - } - - //imgOutputSmall.Dispose(); + crFont1 = new Font(picSettings.IlFont, imgState.DimensioneStandardMiniatura, FontStyle.Bold); + crFont2 = new Font(picSettings.IlFont, imgState.DimensioneStandard, FontStyle.Bold); } + else + { + crFont1 = new Font(picSettings.IlFont, imgState.DimensioneStandardMiniatura); + crFont2 = new Font(picSettings.IlFont, imgState.DimensioneStandard); + } + + crSize1 = grPhoto1.MeasureString(imgState.TestoFirmaPiccola, crFont1); + crSize2 = grPhoto1.MeasureString(imgState.TestoFirma, crFont1); + var larghezzaStandard1 = System.Convert.ToInt32(crSize1.Width); + + if (crSize1.Width > System.Convert.ToSingle(g.Width)) + { + int Conta = imgState.DimensioneStandardMiniatura; + do + { + if (Conta > 20) + Conta -= 5; + else + Conta -= 1; + if (picSettings.Grassetto == true) + crFont1 = new Font(picSettings.IlFont, Conta, FontStyle.Bold); + else + crFont1 = new Font(picSettings.IlFont, Conta); + crSize1 = grPhoto1.MeasureString(imgState.TestoFirmaPiccola, crFont1); + if (crSize1.Width < System.Convert.ToSingle(g.Width)) + { + larghezzaStandard1 = System.Convert.ToInt32(crSize1.Width); + break; + } + + if (Conta <= 5) + break; + } + while (true); + imgState.DimensioneStandardMiniatura = Conta; + } + + switch (picSettings.Posizione.ToUpper()) + { + case "ALTO": + { + imgState.YPosFromBottom1 = (picSettings.Margine); + imgState.YPosFromBottom4 = (picSettings.MargVert); + break; + } + + case "BASSO": + { + imgState.YPosFromBottom1 = System.Convert.ToSingle((g.Height - crSize1.Height - (g.Height * picSettings.Margine / (double)100))); + imgState.YPosFromBottom4 = System.Convert.ToSingle((g.Height - crSize1.Height - (g.Height * picSettings.MargVert / (double)100))); + break; + } + } + + float xCenterOfImg1 = 0; + + using StringFormat strFormat1 = new StringFormat(); + switch (picSettings.Allineamento.ToUpper()) + { + case "SINISTRA": + { + xCenterOfImg1 = System.Convert.ToSingle((picSettings.Margine + (larghezzaStandard1 / (double)2))); + + if ((larghezzaStandard1 / (double)2) > (g.Width / (double)2) - picSettings.Margine) + xCenterOfImg1 = System.Convert.ToSingle((g.Width / (double)2)); + break; + } + + case "CENTRO": + { + xCenterOfImg1 = System.Convert.ToSingle((g.Width / (double)2)); + break; + } + + case "DESTRA": + { + xCenterOfImg1 = System.Convert.ToSingle((g.Width - picSettings.Margine - (larghezzaStandard1 / (double)2))); + + if ((larghezzaStandard1 / (double)2) > (g.Width / (double)2) - picSettings.Margine) + xCenterOfImg1 = System.Convert.ToSingle((g.Width / (double)2)); + break; + } + } + strFormat1.Alignment = StringAlignment.Center; + + using var semiTransBrush21 = new SolidBrush(Color.FromArgb(imgState.AlphaScelta, 0, 0, 0)); + using var semiTransBrush1 = new SolidBrush(Color.FromArgb(imgState.AlphaScelta, picSettings.FontColoreRGB)); + + // quick fix + imgState.DimensioneStandardMiniatura = picSettings.DimMin; + + if (picSettings.Grassetto == true) + crFont1 = new Font(picSettings.IlFont, imgState.DimensioneStandardMiniatura, FontStyle.Bold); + else + crFont1 = new Font(picSettings.IlFont, imgState.DimensioneStandardMiniatura); + // asdgadfhdfhjgfsjgfjygfdhsdafa + if (picSettings.TestoMin) + { + grPhoto1.DrawString(imgState.NomeFileBig, crFont1, semiTransBrush21, new PointF(xCenterOfImg1 + 1, imgState.YPosFromBottom1 + 1), strFormat1); + grPhoto1.DrawString(imgState.NomeFileBig, crFont1, semiTransBrush1, new PointF(xCenterOfImg1, imgState.YPosFromBottom1), strFormat1); + } + else if (picSettings.AggTempoGaraMin & picSettings.UsaTempoGaraTestoApplicare) + { + var diff = imgState.DataPartenzaI - imgState.DataFoto; + var diffA = diff.TotalSeconds * 10000000; + + var orario = new TimeSpan(0, 0, (int)diffA);/* new TimeSpan(DateTime.DateDiff(DateInterval.Second, dataPartenzaI, dataFoto) * 10000000);*/ + string tempstr = ""; + + + tempstr += Environment.NewLine + imgState.TestoOrario + orario.Hours.ToString("00") + ":" + orario.Minutes.ToString("00") + ":" + orario.Seconds.ToString("00"); + + + grPhoto1.DrawString(tempstr, crFont1, semiTransBrush21, new PointF(xCenterOfImg1 + 1, imgState.YPosFromBottom1 + 1), strFormat1); + grPhoto1.DrawString(tempstr, crFont1, semiTransBrush1, new PointF(xCenterOfImg1, imgState.YPosFromBottom1), strFormat1); + } + else if (picSettings.AggNumTempMin) + { + var diff = imgState.DataPartenzaI - imgState.DataFoto; + var diffA = diff.TotalSeconds * 10000000; + TimeSpan Orario = new TimeSpan(0, 0, (int)diffA); + string tempstr = ""; + tempstr += imgState.NomeFileBig; + + tempstr += Environment.NewLine + imgState.TestoOrario + Orario.Hours.ToString("00") + ":" + Orario.Minutes.ToString("00") + ":" + Orario.Seconds.ToString("00"); + + + grPhoto1.DrawString(tempstr, crFont1, semiTransBrush21, new PointF(xCenterOfImg1 + 1, imgState.YPosFromBottom1 + 1), strFormat1); + grPhoto1.DrawString(tempstr, crFont1, semiTransBrush1, new PointF(xCenterOfImg1, imgState.YPosFromBottom1), strFormat1); + } + else + { + grPhoto1.DrawString(imgState.TestoFirmaPiccola, crFont1, semiTransBrush21, new PointF(xCenterOfImg1 + 1, imgState.YPosFromBottom1 + 1), strFormat1); + grPhoto1.DrawString(imgState.TestoFirmaPiccola, crFont1, semiTransBrush1, new PointF(xCenterOfImg1, imgState.YPosFromBottom1), strFormat1); + } + + // Salva la miniatura + //using (var g22 = Image.FromHbitmap(imgOutputSmall)) + + + using var imgOutputSmall2 = new Bitmap(imgOutputSmall, imgState.ThumbSizeSmall.Width, imgState.ThumbSizeSmall.Height); + imgOutputSmall2.Save(Path.Combine(imgState.DestDir.FullName, imgState.NomeFileSmall), thisFormat); + + //imgOutputSmall2.Dispose(); + + //imgOutputSmall.Dispose(); //File.Delete(Path.Combine(DestDir.FullName, "Temp_" + nomeFileSmall)); @@ -491,15 +413,15 @@ public class ImageCreatorSharp : IDisposable } else { - using var imgOutputSmall = new Bitmap(g, thumbSizeSmall.Width, thumbSizeSmall.Height); - imgOutputSmall.Save(Path.Combine(DestDir.FullName, nomeFileSmall), thisFormat); + using var imgOutputSmall = new Bitmap(g, imgState.ThumbSizeSmall.Width, imgState.ThumbSizeSmall.Height); + imgOutputSmall.Save(Path.Combine(imgState.DestDir.FullName, imgState.NomeFileSmall), thisFormat); //imgOutputSmall.Dispose(); } } else { - using Bitmap imgOutputSmall = new Bitmap(g, thumbSizeSmall.Width, thumbSizeSmall.Height); - imgOutputSmall.Save(Path.Combine(DestDir.FullName, nomeFileSmall), thisFormat); + using var imgOutputSmall = new Bitmap(g, imgState.ThumbSizeSmall.Width, imgState.ThumbSizeSmall.Height); + imgOutputSmall.Save(Path.Combine(imgState.DestDir.FullName, imgState.NomeFileSmall), thisFormat); //imgOutputSmall.Dispose(); } } @@ -509,79 +431,76 @@ public class ImageCreatorSharp : IDisposable crFont2?.Dispose(); } - private void AggiungiTesto(Image g, Bitmap imgOutputBig) + private void AggiungiTesto(Image g, ImageState imgState, Bitmap imgOutputBig) { using var grPhoto = Graphics.FromImage(imgOutputBig); grPhoto.SmoothingMode = SmoothingMode.AntiAlias; Font crFont = null/* TODO Change to default(_) if this is not a reference type */; - SizeF crSize = new SizeF(); - int LarghezzaStandard; - if (_picSettings.Grassetto == true) - crFont = new Font(_picSettings.IlFont, DimensioneStandard, FontStyle.Bold); + if (picSettings.Grassetto == true) + crFont = new Font(picSettings.IlFont, imgState.DimensioneStandard, FontStyle.Bold); else - crFont = new Font(_picSettings.IlFont, DimensioneStandard); - crSize = grPhoto.MeasureString(testoFirma, crFont); - LarghezzaStandard = System.Convert.ToInt32(crSize.Width); + crFont = new Font(picSettings.IlFont, imgState.DimensioneStandard); + var crSize = grPhoto.MeasureString(imgState.TestoFirma, crFont); + var larghezzaStandard = System.Convert.ToInt32(crSize.Width); if (crSize.Width > System.Convert.ToSingle(g.Width)) { - int Conta = DimensioneStandard; + int conta = imgState.DimensioneStandard; do { - if (Conta > 20) - Conta -= 5; + if (conta > 20) + conta -= 5; else - Conta -= 1; - if (_picSettings.Grassetto == true) - crFont = new Font(_picSettings.IlFont, Conta, FontStyle.Bold); + conta -= 1; + if (picSettings.Grassetto == true) + crFont = new Font(picSettings.IlFont, conta, FontStyle.Bold); else - crFont = new Font(_picSettings.IlFont, Conta); - crSize = grPhoto.MeasureString(testoFirma, crFont); + crFont = new Font(picSettings.IlFont, conta); + crSize = grPhoto.MeasureString(imgState.TestoFirma, crFont); if (crSize.Width < System.Convert.ToSingle(g.Width)) { - LarghezzaStandard = System.Convert.ToInt32(crSize.Width); + larghezzaStandard = System.Convert.ToInt32(crSize.Width); break; } - if (Conta <= 5) + if (conta <= 5) break; } while (true); - DimensioneStandard = Conta; + imgState.DimensioneStandard = conta; } - - - switch (_picSettings.Posizione.ToUpper()) + + switch (picSettings.Posizione.ToUpper()) { case "ALTO": { - yPosFromBottom = (_picSettings.Margine); - yPosFromBottom3 = (_picSettings.MargVert); + imgState.YPosFromBottom = (picSettings.Margine); + imgState.YPosFromBottom3 = (picSettings.MargVert); break; } case "BASSO": { - 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))); + imgState.YPosFromBottom = System.Convert.ToSingle((g.Height - crSize.Height - (g.Height * picSettings.Margine / (double)100))); + imgState.YPosFromBottom3 = System.Convert.ToSingle((g.Height - crSize.Height - (g.Height * picSettings.MargVert / (double)100))); break; } } float xCenterOfImg = 0; float xCenterOfImg3 = 0; - StringFormat StrFormat = new StringFormat(); - switch (_picSettings.Allineamento.ToUpper()) + using var strFormat = new StringFormat(); + switch (picSettings.Allineamento.ToUpper()) { case "SINISTRA": { - xCenterOfImg = System.Convert.ToSingle((_picSettings.Margine + (LarghezzaStandard / (double)2))); - xCenterOfImg3 = System.Convert.ToSingle((_picSettings.MargVert + (LarghezzaStandard / (double)2))); - if ((LarghezzaStandard / (double)2) > (g.Width / (double)2) - _picSettings.Margine) + xCenterOfImg = System.Convert.ToSingle((picSettings.Margine + (larghezzaStandard / (double)2))); + xCenterOfImg3 = System.Convert.ToSingle((picSettings.MargVert + (larghezzaStandard / (double)2))); + if ((larghezzaStandard / (double)2) > (g.Width / (double)2) - picSettings.Margine) 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)); break; } @@ -594,193 +513,176 @@ public class ImageCreatorSharp : IDisposable case "DESTRA": { - xCenterOfImg = System.Convert.ToSingle((g.Width - _picSettings.Margine - (LarghezzaStandard / (double)2))); - xCenterOfImg3 = System.Convert.ToSingle((g.Width - _picSettings.MargVert - (LarghezzaStandard / (double)2))); - if ((LarghezzaStandard / (double)2) > (g.Width / (double)2) - _picSettings.Margine) + xCenterOfImg = System.Convert.ToSingle((g.Width - picSettings.Margine - (larghezzaStandard / (double)2))); + xCenterOfImg3 = System.Convert.ToSingle((g.Width - picSettings.MargVert - (larghezzaStandard / (double)2))); + if ((larghezzaStandard / (double)2) > (g.Width / (double)2) - picSettings.Margine) 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)); break; } } - StrFormat.Alignment = StringAlignment.Center; + strFormat.Alignment = StringAlignment.Center; - SolidBrush semiTransBrush2 = new SolidBrush(Color.FromArgb(alphaScelta, 0, 0, 0)); + using var semiTransBrush2 = new SolidBrush(Color.FromArgb(imgState.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)); + using var semiTransBrush = new SolidBrush(Color.FromArgb(imgState.AlphaScelta, picSettings.FontColoreRGB)); - if (FotoRuotaADestra | FotoRuotaASinistra) + if (imgState.FotoRuotaADestra | imgState.FotoRuotaASinistra) { - if (_picSettings.Grassetto == true) - crFont = new Font(_picSettings.IlFont, _picSettings.DimVert, FontStyle.Bold); + if (picSettings.Grassetto == true) + crFont = new Font(picSettings.IlFont, picSettings.DimVert, FontStyle.Bold); else - crFont = new Font(_picSettings.IlFont, _picSettings.DimVert); + crFont = new Font(picSettings.IlFont, picSettings.DimVert); } - else if (_picSettings.Grassetto == true) - crFont = new Font(_picSettings.IlFont, DimensioneStandard, FontStyle.Bold); + else if (picSettings.Grassetto == true) + crFont = new Font(picSettings.IlFont, imgState.DimensioneStandard, FontStyle.Bold); else - crFont = new Font(_picSettings.IlFont, DimensioneStandard); + crFont = new Font(picSettings.IlFont, imgState.DimensioneStandard); // 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); - dataFoto = _creationDate ?? DateTime.Now; //DatiExif.DateTimeOriginal; + imgState.DataFoto = imgState.CreationDate ?? DateTime.Now; //DatiExif.DateTimeOriginal; - grPhoto.DrawString((nomeFileBig + " " + dataFoto.ToShortDateString()), crFont, semiTransBrush2, new PointF(xCenterOfImg + 1, yPosFromBottom + 1), StrFormat); - grPhoto.DrawString((nomeFileBig + " " + dataFoto.ToShortDateString()), crFont, semiTransBrush, new PointF(xCenterOfImg, yPosFromBottom), StrFormat); + grPhoto.DrawString((imgState.NomeFileBig + " " + imgState.DataFoto.ToShortDateString()), crFont, semiTransBrush2, new PointF(xCenterOfImg + 1, imgState.YPosFromBottom + 1), strFormat); + grPhoto.DrawString((imgState.NomeFileBig + " " + imgState.DataFoto.ToShortDateString()), crFont, semiTransBrush, new PointF(xCenterOfImg, imgState.YPosFromBottom), strFormat); } else { - grPhoto.DrawString(nomeFileBig, crFont, semiTransBrush2, new PointF(xCenterOfImg + 1, yPosFromBottom + 1), StrFormat); - grPhoto.DrawString(nomeFileBig, crFont, semiTransBrush, new PointF(xCenterOfImg, yPosFromBottom), StrFormat); + grPhoto.DrawString(imgState.NomeFileBig, crFont, semiTransBrush2, new PointF(xCenterOfImg + 1, imgState.YPosFromBottom + 1), strFormat); + grPhoto.DrawString(imgState.NomeFileBig, crFont, semiTransBrush, new PointF(xCenterOfImg, imgState.YPosFromBottom), strFormat); } } - if (_picSettings.TestoNome == false) + if (picSettings.TestoNome == false) { - if (FotoRuotaADestra | FotoRuotaASinistra) + if (imgState.FotoRuotaADestra | imgState.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, semiTransBrush, new PointF(xCenterOfImg, yPosFromBottom3), StrFormat); + grPhoto.DrawString(imgState.TestoFirmaV, crFont, semiTransBrush2, new PointF(xCenterOfImg + 1, imgState.YPosFromBottom3 + 1), strFormat); + grPhoto.DrawString(imgState.TestoFirmaV, crFont, semiTransBrush, new PointF(xCenterOfImg, imgState.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, semiTransBrush, new PointF(xCenterOfImg, yPosFromBottom4), StrFormat); + grPhoto.DrawString(imgState.TestoFirmaV, crFont, semiTransBrush2, new PointF(xCenterOfImg + 1, imgState.YPosFromBottom4 + 1), strFormat); + grPhoto.DrawString(imgState.TestoFirmaV, crFont, semiTransBrush, new PointF(xCenterOfImg, imgState.YPosFromBottom4), strFormat); } } else { - grPhoto.DrawString(testoFirma, crFont, semiTransBrush2, new PointF(xCenterOfImg + 1, yPosFromBottom + 1), StrFormat); - grPhoto.DrawString(testoFirma, crFont, semiTransBrush, new PointF(xCenterOfImg, yPosFromBottom), StrFormat); + grPhoto.DrawString(imgState.TestoFirma, crFont, semiTransBrush2, new PointF(xCenterOfImg + 1, imgState.YPosFromBottom + 1), strFormat); + grPhoto.DrawString(imgState.TestoFirma, crFont, semiTransBrush, new PointF(xCenterOfImg, imgState.YPosFromBottom), strFormat); } } - if (string.Equals(_picSettings.DirectorySorgente, _picSettings.DirectoryDestinazione, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(picSettings.DirectorySorgente, picSettings.DirectoryDestinazione, StringComparison.OrdinalIgnoreCase)) { - nomeFileBig2 = nomeFileBig; - nomeFileBig = nomeFileBig.Substring(0, nomeFileBig.Length - 4) + _picSettings.Codice + nomeFileBig.Substring(nomeFileBig.Length - 4); + imgState.NomeFileBig2 = imgState.NomeFileBig; + imgState.NomeFileBig = $"{imgState.NomeFileBig[..^4]}{picSettings.Codice}{imgState.NomeFileBig[^4..]}"; } //grPhoto.Dispose(); crFont?.Dispose(); } - - - - private void aggiungiLogo(Bitmap imgOutputBig, Image logo) + private void AggiungiLogo(Bitmap imgOutputBig, ImageState imgState, Image logo) { // imgOutputBig - if (_picSettings.LogoAggiungi == true & File.Exists(_picSettings.LogoNomeFile)) + if (!(picSettings.LogoAggiungi == true & File.Exists(picSettings.LogoNomeFile))) return; + // using var ImmagineLogo = Image.FromFile(_picSettings.LogoNomeFile); + + var logoColoreTrasparente = Color.White; + + // * Load this Bitmap into a new Graphic Object + using var grWatermark = Graphics.FromImage(imgOutputBig); + using ImageAttributes imageAttributes = new ImageAttributes(); + + // * The first step replace the background color with one that is transparent (Alpha=0, R=0, G=0, B=0) + var colorMap = new ColorMap { - // using var ImmagineLogo = Image.FromFile(_picSettings.LogoNomeFile); - - Color LogoColoreTrasparente = Color.White; - - // * Load this Bitmap into a new Graphic Object - using Graphics grWatermark = Graphics.FromImage(imgOutputBig); - ImageAttributes imageAttributes = new ImageAttributes(); - - // * The first step replace the background color with one that is transparent (Alpha=0, R=0, G=0, B=0) - ColorMap colorMap = new ColorMap(); - // * background this will be the color we search for and replace with transparency - colorMap.OldColor = LogoColoreTrasparente; - colorMap.NewColor = Color.FromArgb(0, 0, 0, 0); + OldColor = logoColoreTrasparente, + NewColor = Color.FromArgb(0, 0, 0, 0) + }; - ColorMap[] remapTable = new[] { colorMap }; - imageAttributes.SetRemapTable(remapTable, ColorAdjustType.Bitmap); + var remapTable = new[] { colorMap }; + 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 - 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); - imageAttributes.SetColorMatrix(wmColorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap); + // * The second color manipulation is used to change the opacity by setting the 3rd row and 3rd column to 0.3f + var 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 } }; + var wmColorMatrix = new ColorMatrix(colorMatrixElements); + imageAttributes.SetColorMatrix(wmColorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap); - int FotoLogoH = _picSettings.LogoAltezza; - int FotoLogoW = _picSettings.LogoLarghezza; - double FattoreAlt = logo.Height / (double)FotoLogoH; - double FattoreLarg = logo.Width / (double)FotoLogoW; - Size NuovaSize; - if (FattoreLarg > FattoreAlt) - NuovaSize = NewthumbSize(logo.Width, logo.Height, FotoLogoW, "Larghezza"); - else - NuovaSize = NewthumbSize(logo.Width, logo.Height, FotoLogoH, "Altezza"); + var fotoLogoH = picSettings.LogoAltezza; + var fotoLogoW = picSettings.LogoLarghezza; + var fattoreAlt = logo.Height / (double)fotoLogoH; + var fattoreLarg = logo.Width / (double)fotoLogoW; + var nuovaSize = fattoreLarg > fattoreAlt ? NewthumbSize(logo.Width, logo.Height, fotoLogoW, "Larghezza") : NewthumbSize(logo.Width, logo.Height, fotoLogoH, "Altezza"); - int MargineUsato; - int MargineL; - bool InPercentualeL; - if (_picSettings.LogoMargine.EndsWith("%") == true) - InPercentualeL = true; - else - InPercentualeL = false; - MargineL = System.Convert.ToInt32(_picSettings.LogoMargine); - if (InPercentualeL == true) - MargineUsato = System.Convert.ToInt32(imgOutputBig.Height * MargineL / (double)100); - else - MargineUsato = MargineL; + var inPercentualeL = picSettings.LogoMargine.EndsWith('%'); + var margineL = System.Convert.ToInt32(picSettings.LogoMargine); + var margineUsato = inPercentualeL ? System.Convert.ToInt32(imgOutputBig.Height * margineL / (double)100) : margineL; - int xPosOfWm = 0; - int yPosOfWm = 0; - switch (_picSettings.LogoPosizioneH.ToUpper()) + int xPosOfWm = 0; + int yPosOfWm = 0; + switch (picSettings.LogoPosizioneH.ToUpper()) + { + case "SINISTRA": + case "NESSUNA": { - case "SINISTRA": - case "NESSUNA": - { - xPosOfWm = MargineUsato; - break; - } - - case "CENTRO": - { - xPosOfWm = System.Convert.ToInt32((imgOutputBig.Width - NuovaSize.Width) / (double)2); - break; - } - - case "DESTRA": - { - xPosOfWm = ((imgOutputBig.Width - NuovaSize.Width) - MargineUsato); - break; - } - } - switch (_picSettings.LogoPosizioneV.ToUpper()) - { - case "ALTO": - case "NESSUNA": - { - yPosOfWm = MargineUsato; - break; - } - - case "CENTRO": - { - yPosOfWm = System.Convert.ToInt32((imgOutputBig.Height - NuovaSize.Height) / (double)2); - break; - } - - case "BASSO": - { - yPosOfWm = ((imgOutputBig.Height - NuovaSize.Height) - MargineUsato); - break; - } + xPosOfWm = margineUsato; + break; } - grWatermark.DrawImage(logo, new Rectangle(xPosOfWm, yPosOfWm, NuovaSize.Width, NuovaSize.Height), 0, 0, logo.Width, logo.Height, GraphicsUnit.Pixel, imageAttributes); - //grWatermark.Dispose(); + case "CENTRO": + { + xPosOfWm = System.Convert.ToInt32((imgOutputBig.Width - nuovaSize.Width) / (double)2); + break; + } + + case "DESTRA": + { + xPosOfWm = ((imgOutputBig.Width - nuovaSize.Width) - margineUsato); + break; + } } + switch (picSettings.LogoPosizioneV.ToUpper()) + { + case "ALTO": + case "NESSUNA": + { + yPosOfWm = margineUsato; + break; + } + + case "CENTRO": + { + yPosOfWm = System.Convert.ToInt32((imgOutputBig.Height - nuovaSize.Height) / (double)2); + break; + } + + case "BASSO": + { + yPosOfWm = ((imgOutputBig.Height - nuovaSize.Height) - margineUsato); + break; + } + } + + grWatermark.DrawImage(logo, new Rectangle(xPosOfWm, yPosOfWm, nuovaSize.Width, nuovaSize.Height), 0, 0, logo.Width, logo.Height, GraphicsUnit.Pixel, imageAttributes); + //grWatermark.Dispose(); } - private void SalvaFoto(Bitmap imgOutputBig, Size thumbSizeBig, string NomeFileBig, string NomeFileSmall, Size thumbSizeSmall, ImageFormat thisFormat) + private void SalvaFoto(Bitmap imgOutputBig, ImageState imgState, ImageFormat thisFormat) { using var image1Stream = new MemoryStream(); - if (_picSettings.FotoGrandeDimOrigina == false) + if (picSettings.FotoGrandeDimOrigina == false) { // attenzione non controlla se è png // imgOutputBig.Save(Path.Combine(_DestDir.FullName, "Temp_" & NomeFileBig), thisFormat) @@ -796,12 +698,12 @@ public class ImageCreatorSharp : IDisposable //imgOutputBig.Save(Path.Combine(DestDir.FullName, "Temp_" + NomeFileBig), thisFormat); image1Stream.Seek(0, SeekOrigin.Begin); 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"); - using Bitmap imgOutputBig2 = new Bitmap(g2, thumbSizeBig.Width, thumbSizeBig.Height); + imgState.ThumbSizeBig = g2.Width > g2.Height ? NewthumbSize(g2.Width, g2.Height, picSettings.LarghezzaBig, "Larghezza") : NewthumbSize(g2.Width, g2.Height, picSettings.AltezzaBig, "Altezza"); + using var imgOutputBig2 = new Bitmap(g2, imgState.ThumbSizeBig.Width, imgState.ThumbSizeBig.Height); if (thisFormat.Equals(ImageFormat.Jpeg)) - SalvaImmagineCustomQuality(imgOutputBig2, Path.Combine(DestDir.FullName, NomeFileBig), _picSettings.JpegQuality); + SalvaImmagineCustomQuality(imgOutputBig2, Path.Combine(imgState.DestDir.FullName, imgState.NomeFileBig), picSettings.JpegQuality); else - imgOutputBig2.Save(Path.Combine(DestDir.FullName, NomeFileBig), thisFormat); + imgOutputBig2.Save(Path.Combine(imgState.DestDir.FullName, imgState.NomeFileBig), thisFormat); //imgOutputBig2.Dispose(); @@ -812,39 +714,35 @@ public class ImageCreatorSharp : IDisposable { // if (thisFormat.Equals(ImageFormat.Jpeg)) - SalvaImmagineCustomQuality(imgOutputBig, Path.Combine(DestDir.FullName, NomeFileBig), _picSettings.JpegQuality); + SalvaImmagineCustomQuality(imgOutputBig, Path.Combine(imgState.DestDir.FullName, imgState.NomeFileBig), picSettings.JpegQuality); else - imgOutputBig.Save(Path.Combine(DestDir.FullName, NomeFileBig), thisFormat); + imgOutputBig.Save(Path.Combine(imgState.DestDir.FullName, imgState.NomeFileBig), thisFormat); //imgOutputBig.Dispose(); } image1Stream.Seek(0, SeekOrigin.Begin); - if (_picSettings.CreaMiniature) - { - if (_picSettings.AggiungiScritteMiniature) - { - using System.Drawing.Image g1 = _picSettings.FotoGrandeDimOrigina ? (Image)imgOutputBig.Clone() : Image.FromStream(image1Stream); - //if (_picSettings.FotoGrandeDimOrigina == false) - // g1 = Image.FromStream(image1Stream); - ////g1 = System.Drawing.Image.FromFile(Path.Combine(DestDir.FullName, "Temp_" + NomeFileBig)); - //else - // g1 = (Image)imgOutputBig.Clone(); - //g1 = System.Drawing.Image.FromFile(Path.Combine(DestDir.FullName, NomeFileBig)); - using Bitmap imgOutputSmall = new Bitmap(g1, thumbSizeSmall.Width, thumbSizeSmall.Height); - if (string.Equals(_picSettings.DirectorySorgente, _picSettings.DirectoryDestinazione, StringComparison.OrdinalIgnoreCase)) - 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); - else - imgOutputSmall.Save(Path.Combine(_DestDir.FullName, NomeFileSmall), thisFormat); + if (!picSettings.CreaMiniature) return; + if (!picSettings.AggiungiScritteMiniature) return; + using var g1 = picSettings.FotoGrandeDimOrigina ? (Image)imgOutputBig.Clone() : Image.FromStream(image1Stream); + //if (_picSettings.FotoGrandeDimOrigina == false) + // g1 = Image.FromStream(image1Stream); + ////g1 = System.Drawing.Image.FromFile(Path.Combine(DestDir.FullName, "Temp_" + NomeFileBig)); + //else + // g1 = (Image)imgOutputBig.Clone(); + //g1 = System.Drawing.Image.FromFile(Path.Combine(DestDir.FullName, NomeFileBig)); + using Bitmap imgOutputSmall = new Bitmap(g1, imgState.ThumbSizeSmall.Width, imgState.ThumbSizeSmall.Height); + if (string.Equals(picSettings.DirectorySorgente, picSettings.DirectoryDestinazione, StringComparison.OrdinalIgnoreCase)) + imgState.NomeFileSmall = imgState.NomeFileSmall.Substring(0, imgState.NomeFileSmall.Length - 4) + picSettings.Codice + imgState.NomeFileSmall.Substring(imgState.NomeFileSmall.Length - 4); + // + if (thisFormat.Equals(ImageFormat.Jpeg)) + SalvaImmagineCustomQuality(imgOutputSmall, Path.Combine(imgState.DestDir.FullName, imgState.NomeFileSmall), picSettings.JpegQualityMin); + else + imgOutputSmall.Save(Path.Combine(imgState.DestDir.FullName, imgState.NomeFileSmall), thisFormat); - //imgOutputSmall.Dispose(); + //imgOutputSmall.Dispose(); - //g1.Dispose(); - } - } + //g1.Dispose(); //if (File.Exists(Path.Combine(DestDir.FullName, "Temp_" + NomeFileBig))) // File.Delete(Path.Combine(DestDir.FullName, "Temp_" + NomeFileBig)); @@ -852,37 +750,35 @@ public class ImageCreatorSharp : IDisposable private void SalvaImmagineCustomQuality(Bitmap imageToSave, string nomeFileFinale, long quality) { - ImageCodecInfo JgpEncoder = GetEncoder(ImageFormat.Jpeg); - System.Drawing.Imaging.Encoder MyEncoder = System.Drawing.Imaging.Encoder.Quality; + var jgpEncoder = GetEncoder(ImageFormat.Jpeg); + var myEncoder = System.Drawing.Imaging.Encoder.Quality; - EncoderParameters MyEncoderParameters = new EncoderParameters(1); + using var myEncoderParameters = new EncoderParameters(1); - EncoderParameter MyEncoderParameter = new EncoderParameter(MyEncoder, _picSettings.JpegQuality); - MyEncoderParameters.Param[0] = MyEncoderParameter; - imageToSave.Save(nomeFileFinale, JgpEncoder, MyEncoderParameters); + var myEncoderParameter = new EncoderParameter(myEncoder, picSettings.JpegQuality); + myEncoderParameters.Param[0] = myEncoderParameter; + imageToSave.Save(nomeFileFinale, jgpEncoder, myEncoderParameters); //imageToSave.Dispose(); } private void MakeImageCustomQuality(Bitmap imageToSave, Stream destinationStream) { - ImageCodecInfo JgpEncoder = GetEncoder(ImageFormat.Jpeg); - System.Drawing.Imaging.Encoder MyEncoder = System.Drawing.Imaging.Encoder.Quality; + var jgpEncoder = GetEncoder(ImageFormat.Jpeg); + var myEncoder = System.Drawing.Imaging.Encoder.Quality; - EncoderParameters MyEncoderParameters = new EncoderParameters(1); + using var myEncoderParameters = new EncoderParameters(1); - EncoderParameter MyEncoderParameter = new EncoderParameter(MyEncoder, _picSettings.JpegQuality); - MyEncoderParameters.Param[0] = MyEncoderParameter; + var myEncoderParameter = new EncoderParameter(myEncoder, picSettings.JpegQuality); + myEncoderParameters.Param[0] = myEncoderParameter; destinationStream.Seek(0, SeekOrigin.Begin); - imageToSave.Save(destinationStream, JgpEncoder, MyEncoderParameters); + imageToSave.Save(destinationStream, jgpEncoder, myEncoderParameters); //imageToSave.Dispose(); } - - + private ImageCodecInfo GetEncoder(ImageFormat format) { - ImageCodecInfo[] codecs = ImageCodecInfo.GetImageDecoders(); - - + var codecs = ImageCodecInfo.GetImageDecoders(); + foreach (var codec in codecs) { if (codec.FormatID == format.Guid) @@ -896,87 +792,30 @@ public class ImageCreatorSharp : IDisposable /// ''' /// ''' Larghezza /// ''' Altezza - /// ''' - /// ''' + /// ''' + /// ''' /// ''' /// ''' - private Size NewthumbSize(int currentwidth, int currentheight, int MaxPixel, string TipoSize) + private Size NewthumbSize(int currentwidth, int currentheight, int maxPixel, string tipoSize) { // e // *** Larghezza, Altezza, Auto double tempMultiplier; - if (TipoSize.ToUpper() == "Larghezza".ToUpper()) - tempMultiplier = MaxPixel / (double)currentwidth; - else if (TipoSize.ToUpper() == "Altezza".ToUpper()) - tempMultiplier = MaxPixel / (double)currentheight; + if (tipoSize.ToUpper() == "Larghezza".ToUpper()) + tempMultiplier = maxPixel / (double)currentwidth; + else if (tipoSize.ToUpper() == "Altezza".ToUpper()) + tempMultiplier = maxPixel / (double)currentheight; else if (currentheight > currentwidth) - tempMultiplier = MaxPixel / (double)currentheight; + tempMultiplier = maxPixel / (double)currentheight; else - tempMultiplier = MaxPixel / (double)currentwidth; + tempMultiplier = maxPixel / (double)currentwidth; - Size NewSize = new Size(System.Convert.ToInt32(currentwidth * tempMultiplier), System.Convert.ToInt32(currentheight * tempMultiplier)); + var newSize = new Size(System.Convert.ToInt32(currentwidth * tempMultiplier), System.Convert.ToInt32(currentheight * tempMultiplier)); - return NewSize; + return newSize; } - public FileInfo WorkFile - { - get - { - return _workFile; - } - set - { - _workFile = value; - } - } - - public DirectoryInfo DestDir - { - get => _DestDir; - set => _DestDir = value; - } - - public DirectoryInfo SourceDir - { - get - { - return _SourceDir; - } - set - { - _SourceDir = value; - } - } - - public DirectoryInfo DestDirStart - { - get - { - return _DestDirStart; - } - set - { - _DestDirStart = value; - } - } - - public string NomeFileChild - { - get - { - return _NomeFileChild; - } - set - { - _NomeFileChild = value; - } - } - - public void Dispose() - { - - } -} + +} \ No newline at end of file diff --git a/MaddoShared/ImageState.cs b/MaddoShared/ImageState.cs new file mode 100644 index 0000000..0090ecb --- /dev/null +++ b/MaddoShared/ImageState.cs @@ -0,0 +1,45 @@ +using System; +using System.Drawing; +using System.IO; + +namespace MaddoShared; + +public class ImageState +{ + public bool FotoRuotaADestra { get; set; } = false; + public bool FotoRuotaASinistra { get; set; } = false; + + public string TempMinText { get; set; } = ""; + // public crFont1 As Font + public string NomeFileChild { get; set; } + + public DirectoryInfo SourceDir { get; set; } + public DirectoryInfo DestDirStart { get; set; } + public DirectoryInfo DestDir { get; set; } + + public FileInfo WorkFile { get; set; } + + public string TestoFirma { get; set; } + public string TestoFirmaV { get; set; } + public int AlphaScelta { get; set; } + public int DimensioneStandard { get; set; } + public int DimensioneStandardMiniatura { get; set; } + public DateTime DataFoto { get; set; } + public DateTime DataPartenzaI { get; set; } + public string TestoOrario { get; set; } + public string TestoFirmaPiccola { get; set; } + public Size ThumbSizeSmall { get; set; } + public Size ThumbSizeBig { get; set; } + public string NomeFileSmall{ get; set; } + public string NomeFileBig{ get; set; } + public string NomeFileBig2{ get; set; } + + public float YPosFromBottom{ get; set; } + public float YPosFromBottom1{ get; set; } + public float YPosFromBottom2{ get; set; } + public float YPosFromBottom3{ get; set; } + public float YPosFromBottom4{ get; set; } + + public Orientations Orientation{ get; set; } + public DateTime? CreationDate{ get; set; } +} \ No newline at end of file diff --git a/MaddoShared/MaddoShared.csproj b/MaddoShared/MaddoShared.csproj index ea64893..ffb858a 100644 --- a/MaddoShared/MaddoShared.csproj +++ b/MaddoShared/MaddoShared.csproj @@ -10,6 +10,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/imagecatalog/Program.cs b/imagecatalog/Program.cs index 854667a..dad280d 100644 --- a/imagecatalog/Program.cs +++ b/imagecatalog/Program.cs @@ -82,6 +82,7 @@ namespace ImageCatalog_2 services.AddTransient(); services.AddTransient(); + services.AddTransient(); services.AddSingleton(); services.AddSingleton(); -- 2.52.0 From abdd2a313a016329429559b71388c9eac9045f23 Mon Sep 17 00:00:00 2001 From: Marco Date: Mon, 28 Jul 2025 12:26:23 +0200 Subject: [PATCH 028/127] Race time fix --- MaddoShared/ImageCreatorSharp.cs | 23 +++++++++++------------ imagecatalog/ImageCatalog 2.csproj | 8 ++++---- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/MaddoShared/ImageCreatorSharp.cs b/MaddoShared/ImageCreatorSharp.cs index 3837318..7fb4db2 100644 --- a/MaddoShared/ImageCreatorSharp.cs +++ b/MaddoShared/ImageCreatorSharp.cs @@ -4,6 +4,7 @@ using System.Diagnostics.CodeAnalysis; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; +using System.Globalization; using System.IO; using System.Threading.Tasks; using Microsoft.Extensions.Logging; @@ -66,9 +67,7 @@ public class ImageCreatorSharp(PicSettings picSettings, ILogger date = null; - var creationFound = img.Metadata?.ExifProfile?.TryGetValue(ExifTag.DateTime, out date) ?? false; + var creationFound = img.Metadata?.ExifProfile?.TryGetValue(ExifTag.DateTimeOriginal, out date) ?? false; if (creationFound) { - var succ = DateTime.TryParse(date.ToString(), out var crDate); + var succ = DateTime.TryParseExact(date.Value, "yyyy:MM:dd HH:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out var crDate); if (succ) { imgState.CreationDate = crDate; @@ -169,12 +168,12 @@ public class ImageCreatorSharp(PicSettings picSettings, ILogger System.Convert.ToSingle(g.Width)) { - int conta = imgState.DimensioneStandard; + var conta = imgState.DimensioneStandard; do { if (conta > 20) diff --git a/imagecatalog/ImageCatalog 2.csproj b/imagecatalog/ImageCatalog 2.csproj index 841593c..7402663 100644 --- a/imagecatalog/ImageCatalog 2.csproj +++ b/imagecatalog/ImageCatalog 2.csproj @@ -6,10 +6,10 @@ enable true False - 3.0.1.0 - 3.0.1.0 - 3.0.0-alpha.63+Branch.develop.Sha.39a9baf5c618d8d79c75b89e2d5c4020939697f2 - 3.0.1-alpha0063 + 3.1.1.0 + 3.1.1.0 + 3.1.1 + 3.1.1 ImageCatalog2025 default Logo.ico -- 2.52.0 From 12d1bd57dc304643edb3829e518b9bd838ae12ae Mon Sep 17 00:00:00 2001 From: Marco Date: Mon, 28 Jul 2025 14:45:03 +0200 Subject: [PATCH 029/127] Override mode fix --- MaddoShared/ImageCreatorSharp.cs | 75 +++++++----- MaddoShared/PicSettings.cs | 1 + imagecatalog/DataModel.cs | 12 ++ imagecatalog/MainForm.Designer.cs | 1 + imagecatalog/MainForm.cs | 144 +++++++++++----------- imagecatalog/ParametriSetup.cs | 14 +-- imagecatalog/Program.cs | 193 ++++++++++++++++++------------ 7 files changed, 254 insertions(+), 186 deletions(-) diff --git a/MaddoShared/ImageCreatorSharp.cs b/MaddoShared/ImageCreatorSharp.cs index 7fb4db2..4a241e2 100644 --- a/MaddoShared/ImageCreatorSharp.cs +++ b/MaddoShared/ImageCreatorSharp.cs @@ -680,6 +680,9 @@ public class ImageCreatorSharp(PicSettings picSettings, ILogger g2.Height ? NewthumbSize(g2.Width, g2.Height, picSettings.LarghezzaBig, "Larghezza") : NewthumbSize(g2.Width, g2.Height, picSettings.AltezzaBig, "Altezza"); using var imgOutputBig2 = new Bitmap(g2, imgState.ThumbSizeBig.Width, imgState.ThumbSizeBig.Height); - if (thisFormat.Equals(ImageFormat.Jpeg)) - SalvaImmagineCustomQuality(imgOutputBig2, Path.Combine(imgState.DestDir.FullName, imgState.NomeFileBig), picSettings.JpegQuality); + + if (!picSettings.OverwriteFiles && File.Exists(fileName)) + { + logger.LogInformation("Saltata foto {FileName}, esiste", fileName); + } else - imgOutputBig2.Save(Path.Combine(imgState.DestDir.FullName, imgState.NomeFileBig), thisFormat); - - //imgOutputBig2.Dispose(); - - //imgOutputBig.Dispose(); - //g2.Dispose(); + { + if (thisFormat.Equals(ImageFormat.Jpeg)) + SalvaImmagineCustomQuality(imgOutputBig2, fileName, picSettings.JpegQuality); + else + imgOutputBig2.Save(fileName, thisFormat); + } + } else { - // - if (thisFormat.Equals(ImageFormat.Jpeg)) - SalvaImmagineCustomQuality(imgOutputBig, Path.Combine(imgState.DestDir.FullName, imgState.NomeFileBig), picSettings.JpegQuality); + if (!picSettings.OverwriteFiles && File.Exists(fileName)) + { + logger.LogInformation("Saltata foto {FileName}, esiste", fileName); + } else - imgOutputBig.Save(Path.Combine(imgState.DestDir.FullName, imgState.NomeFileBig), thisFormat); - - //imgOutputBig.Dispose(); + { + if (thisFormat.Equals(ImageFormat.Jpeg)) + SalvaImmagineCustomQuality(imgOutputBig, fileName, picSettings.JpegQuality); + else + imgOutputBig.Save(fileName, thisFormat); + } } + image1Stream.Seek(0, SeekOrigin.Begin); if (!picSettings.CreaMiniature) return; if (!picSettings.AggiungiScritteMiniature) return; + using var g1 = picSettings.FotoGrandeDimOrigina ? (Image)imgOutputBig.Clone() : Image.FromStream(image1Stream); - //if (_picSettings.FotoGrandeDimOrigina == false) - // g1 = Image.FromStream(image1Stream); - ////g1 = System.Drawing.Image.FromFile(Path.Combine(DestDir.FullName, "Temp_" + NomeFileBig)); - //else - // g1 = (Image)imgOutputBig.Clone(); - //g1 = System.Drawing.Image.FromFile(Path.Combine(DestDir.FullName, NomeFileBig)); - using Bitmap imgOutputSmall = new Bitmap(g1, imgState.ThumbSizeSmall.Width, imgState.ThumbSizeSmall.Height); + + using var imgOutputSmall = new Bitmap(g1, imgState.ThumbSizeSmall.Width, imgState.ThumbSizeSmall.Height); + if (string.Equals(picSettings.DirectorySorgente, picSettings.DirectoryDestinazione, StringComparison.OrdinalIgnoreCase)) imgState.NomeFileSmall = imgState.NomeFileSmall.Substring(0, imgState.NomeFileSmall.Length - 4) + picSettings.Codice + imgState.NomeFileSmall.Substring(imgState.NomeFileSmall.Length - 4); - // - if (thisFormat.Equals(ImageFormat.Jpeg)) - SalvaImmagineCustomQuality(imgOutputSmall, Path.Combine(imgState.DestDir.FullName, imgState.NomeFileSmall), picSettings.JpegQualityMin); + + var tnFileName = Path.Combine(imgState.DestDir.FullName, imgState.NomeFileSmall); + + if (!picSettings.OverwriteFiles && File.Exists(tnFileName)) + { + logger.LogInformation("Saltata miniatura foto {TnFileName}, esiste", tnFileName); + } else - imgOutputSmall.Save(Path.Combine(imgState.DestDir.FullName, imgState.NomeFileSmall), thisFormat); - - //imgOutputSmall.Dispose(); - - //g1.Dispose(); - - //if (File.Exists(Path.Combine(DestDir.FullName, "Temp_" + NomeFileBig))) - // File.Delete(Path.Combine(DestDir.FullName, "Temp_" + NomeFileBig)); + { + if (thisFormat.Equals(ImageFormat.Jpeg)) + SalvaImmagineCustomQuality(imgOutputSmall, tnFileName, picSettings.JpegQualityMin); + else + imgOutputSmall.Save(tnFileName, thisFormat); + } } private void SalvaImmagineCustomQuality(Bitmap imageToSave, string nomeFileFinale, long quality) diff --git a/MaddoShared/PicSettings.cs b/MaddoShared/PicSettings.cs index 239dfb4..8df3136 100644 --- a/MaddoShared/PicSettings.cs +++ b/MaddoShared/PicSettings.cs @@ -64,4 +64,5 @@ public class PicSettings public bool FotoRuotaADestra { get; set; } = false; public bool FotoRuotaASinistra { get; set; } = false; public string TempMinText { get; set; } = string.Empty; + public bool OverwriteFiles { get; set; } = false; } \ No newline at end of file diff --git a/imagecatalog/DataModel.cs b/imagecatalog/DataModel.cs index e71f7cd..5fe6f82 100644 --- a/imagecatalog/DataModel.cs +++ b/imagecatalog/DataModel.cs @@ -77,6 +77,18 @@ namespace ImageCatalog_2 } } + private bool _overwriteImages; + + public bool OverwriteImages + { + get => _overwriteImages; + set + { + _overwriteImages = value; + NotifyPropertyChanged(); + } + } + private bool _uiEnabled = true; public bool UiEnabled diff --git a/imagecatalog/MainForm.Designer.cs b/imagecatalog/MainForm.Designer.cs index bf1e683..265c4cf 100644 --- a/imagecatalog/MainForm.Designer.cs +++ b/imagecatalog/MainForm.Designer.cs @@ -617,6 +617,7 @@ namespace ImageCatalog // // chkSovrascriviFile // + chkSovrascriviFile.DataBindings.Add(new Binding("Checked", bindingSource1, "OverwriteImages", true, DataSourceUpdateMode.OnPropertyChanged)); chkSovrascriviFile.AutoSize = true; chkSovrascriviFile.Location = new Point(21, 94); chkSovrascriviFile.Margin = new Padding(4, 5, 4, 5); diff --git a/imagecatalog/MainForm.cs b/imagecatalog/MainForm.cs index 17accea..63163af 100644 --- a/imagecatalog/MainForm.cs +++ b/imagecatalog/MainForm.cs @@ -128,7 +128,7 @@ public partial class MainForm private ConcurrentBag _results; - private void setDefaults() + private void SetDefaults() { //txtSorgente.Text = ""; Model.SourcePath = string.Empty; @@ -205,7 +205,7 @@ public partial class MainForm { bindingSource1.DataSource = Model; Application.EnableVisualStyles(); - setDefaults(); + SetDefaults(); // /* TODO ERROR: Skipped IfDirectiveTrivia */ // AllocConsole(); // /* TODO ERROR: Skipped EndIfDirectiveTrivia */ @@ -318,77 +318,77 @@ public partial class MainForm SaveFileDlg.Filter = "Setup (*.xml)|*.xml|All valid files (*.*)|*.*"; SaveFileDlg.FilterIndex = 0; SaveFileDlg.RestoreDirectory = true; - if (DialogResult.OK == SaveFileDlg.ShowDialog()) + if (DialogResult.OK != SaveFileDlg.ShowDialog()) return; + + var ilNome = SaveFileDlg.FileName; + _parametriSetup.NomeFileSetup = ilNome; + _parametriSetup.AggiornaParametro("DirSorgente", Model.SourcePath); + _parametriSetup.AggiornaParametro("DirDestinazione", Model.DestinationPath); + _parametriSetup.AggiornaParametro("DirSottoDirectory", chkAggiornaSottodirectory.Checked); + _parametriSetup.AggiornaParametro("DirDividiDestinazione", chkCreaSottocartelle.Checked); + _parametriSetup.AggiornaParametro("DirDividiNumFile", txtFilePerCartella.Text); + _parametriSetup.AggiornaParametro("DirDividiSuffisso", txtSuffissoCartelle.Text); + _parametriSetup.AggiornaParametro("DirDividiNumCifre", txtCifreContatore.Text); + if (rdbNumProgressiva.Checked == true) { - string IlNome = SaveFileDlg.FileName; - _parametriSetup.NomeFileSetup = IlNome; - _parametriSetup.AggiornaParametro("DirSorgente", Model.SourcePath); - _parametriSetup.AggiornaParametro("DirDestinazione", Model.DestinationPath); - _parametriSetup.AggiornaParametro("DirSottoDirectory", chkAggiornaSottodirectory.Checked); - _parametriSetup.AggiornaParametro("DirDividiDestinazione", chkCreaSottocartelle.Checked); - _parametriSetup.AggiornaParametro("DirDividiNumFile", txtFilePerCartella.Text); - _parametriSetup.AggiornaParametro("DirDividiSuffisso", txtSuffissoCartelle.Text); - _parametriSetup.AggiornaParametro("DirDividiNumCifre", txtCifreContatore.Text); - if (rdbNumProgressiva.Checked == true) - { - _parametriSetup.AggiornaParametro("DirDividiTipoNumerazione", "Progressiva"); - } - else - { - _parametriSetup.AggiornaParametro("DirDividiTipoNumerazione", "Files"); - } - - _parametriSetup.AggiornaParametro("MiniatureCrea", CheckBox1.Checked); - _parametriSetup.AggiornaParametro("MiniatureSuffisso", TextBox3.Text); - _parametriSetup.AggiornaParametro("MiniatureAltezza", TextBox5.Text); - _parametriSetup.AggiornaParametro("MiniatureLarghezza", TextBox6.Text); - _parametriSetup.AggiornaParametro("MiniatureAddScritta", RadioButton3.Checked); - _parametriSetup.AggiornaParametro("MiniatureAddOrario", RadioButton4.Checked); - _parametriSetup.AggiornaParametro("FotoAltezza", TextBox27.Text); - _parametriSetup.AggiornaParametro("FotoLarghezza", TextBox28.Text); - // SetupIni.AggiornaParametro("FotoCodice", TextBox13.Text) - // SetupIni.AggiornaParametro("FotoDimOriginali", CheckBox2.Checked) - - _parametriSetup.AggiornaParametro("FontDimensione", TextBox11.Text); - _parametriSetup.AggiornaParametro("FontDimensioneMiniatura", TextBox25.Text); - _parametriSetup.AggiornaParametro("FontBold", CheckBox3.Checked); - _parametriSetup.AggiornaParametro("FontNome", ComboBox3.Text); - _parametriSetup.AggiornaParametro("TestoTesto", Model.HorizontalText); - _parametriSetup.AggiornaParametro("TestoTrasparente", TextBox9.Text); - _parametriSetup.AggiornaParametro("TestoMargine", TextBox12.Text); - _parametriSetup.AggiornaParametro("TestoPosizione", ComboBox1.Text); - _parametriSetup.AggiornaParametro("TestoAllineamento", ComboBox2.Text); - _parametriSetup.AggiornaParametro("MarchioFile", TextBox10.Text); - _parametriSetup.AggiornaParametro("MarchioAltezza", TextBox14.Text); - _parametriSetup.AggiornaParametro("MarchioLarghezza", TextBox15.Text); - _parametriSetup.AggiornaParametro("MarchioMargine", TextBox16.Text); - _parametriSetup.AggiornaParametro("MarchioAllOrizzontale", ComboBox4.Text); - _parametriSetup.AggiornaParametro("MarchioAllVerticale", ComboBox5.Text); - _parametriSetup.AggiornaParametro("MarchioTrasparenza", TextBox19.Text); - _parametriSetup.AggiornaParametro("MarchioAggiungi", CheckBox5.Checked); - _parametriSetup.AggiornaParametro("TempoGara", CheckBox7.Checked); - _parametriSetup.AggiornaParametro("Orario", CheckBox8.Checked); - _parametriSetup.AggiornaParametro("EtichettaOrario", TextBox18.Text); - _parametriSetup.AggiornaParametro("GeneraleForzaJpg", chkForzaJpg.Checked); - _parametriSetup.AggiornaParametro("GeneraleRotazioneAutomatica", chkRotazioneAutomatica.Checked); - _parametriSetup.AggiornaParametro("GrandezzaVerticale", TextBox30.Text); - _parametriSetup.AggiornaParametro("MargineVerticale", TextBox31.Text); - _parametriSetup.AggiornaParametro("DimensioniOriginali", CheckBox15.Checked); - _parametriSetup.AggiornaParametro("TestoVerticale", Model.VerticalText); - _parametriSetup.AggiornaParametro("NomeMiniatura", RadioButton6.Checked); - _parametriSetup.AggiornaParametro("DataFoto", CheckBox16.Checked); - _parametriSetup.AggiornaParametro("NumeroFoto", CheckBox17.Checked); - _parametriSetup.AggiornaParametro("ColoreTestoRGB", TextBox34.Text); - _parametriSetup.AggiornaParametro("TempoSmall", RadioButton5.Checked); - _parametriSetup.AggiornaParametro("NumTempoSmall", RadioButton7.Checked); - _parametriSetup.AggiornaParametro("CompressioneJpeg", TextBox32.Text); - _parametriSetup.AggiornaParametro("CompressioneJpegMiniatura", TextBox33.Text); - // 2021 - _parametriSetup.AggiornaParametro("ChunkSize", TextBox8.Text); - _parametriSetup.AggiornaParametro("ThreadsCount", TextBox7.Text); - _parametriSetup.SalvaParametriSetup(); - Text = "Image Catalog - " + LeggiSoloNomeFile(IlNome); + _parametriSetup.AggiornaParametro("DirDividiTipoNumerazione", "Progressiva"); } + else + { + _parametriSetup.AggiornaParametro("DirDividiTipoNumerazione", "Files"); + } + + _parametriSetup.AggiornaParametro("MiniatureCrea", CheckBox1.Checked); + _parametriSetup.AggiornaParametro("MiniatureSuffisso", TextBox3.Text); + _parametriSetup.AggiornaParametro("MiniatureAltezza", TextBox5.Text); + _parametriSetup.AggiornaParametro("MiniatureLarghezza", TextBox6.Text); + _parametriSetup.AggiornaParametro("MiniatureAddScritta", RadioButton3.Checked); + _parametriSetup.AggiornaParametro("MiniatureAddOrario", RadioButton4.Checked); + _parametriSetup.AggiornaParametro("FotoAltezza", TextBox27.Text); + _parametriSetup.AggiornaParametro("FotoLarghezza", TextBox28.Text); + // SetupIni.AggiornaParametro("FotoCodice", TextBox13.Text) + // SetupIni.AggiornaParametro("FotoDimOriginali", CheckBox2.Checked) + + _parametriSetup.AggiornaParametro("FontDimensione", TextBox11.Text); + _parametriSetup.AggiornaParametro("FontDimensioneMiniatura", TextBox25.Text); + _parametriSetup.AggiornaParametro("FontBold", CheckBox3.Checked); + _parametriSetup.AggiornaParametro("FontNome", ComboBox3.Text); + _parametriSetup.AggiornaParametro("TestoTesto", Model.HorizontalText); + _parametriSetup.AggiornaParametro("TestoTrasparente", TextBox9.Text); + _parametriSetup.AggiornaParametro("TestoMargine", TextBox12.Text); + _parametriSetup.AggiornaParametro("TestoPosizione", ComboBox1.Text); + _parametriSetup.AggiornaParametro("TestoAllineamento", ComboBox2.Text); + _parametriSetup.AggiornaParametro("MarchioFile", TextBox10.Text); + _parametriSetup.AggiornaParametro("MarchioAltezza", TextBox14.Text); + _parametriSetup.AggiornaParametro("MarchioLarghezza", TextBox15.Text); + _parametriSetup.AggiornaParametro("MarchioMargine", TextBox16.Text); + _parametriSetup.AggiornaParametro("MarchioAllOrizzontale", ComboBox4.Text); + _parametriSetup.AggiornaParametro("MarchioAllVerticale", ComboBox5.Text); + _parametriSetup.AggiornaParametro("MarchioTrasparenza", TextBox19.Text); + _parametriSetup.AggiornaParametro("MarchioAggiungi", CheckBox5.Checked); + _parametriSetup.AggiornaParametro("TempoGara", CheckBox7.Checked); + _parametriSetup.AggiornaParametro("Orario", CheckBox8.Checked); + _parametriSetup.AggiornaParametro("EtichettaOrario", TextBox18.Text); + _parametriSetup.AggiornaParametro("GeneraleForzaJpg", chkForzaJpg.Checked); + _parametriSetup.AggiornaParametro("GeneraleRotazioneAutomatica", chkRotazioneAutomatica.Checked); + _parametriSetup.AggiornaParametro("GrandezzaVerticale", TextBox30.Text); + _parametriSetup.AggiornaParametro("MargineVerticale", TextBox31.Text); + _parametriSetup.AggiornaParametro("DimensioniOriginali", CheckBox15.Checked); + _parametriSetup.AggiornaParametro("TestoVerticale", Model.VerticalText); + _parametriSetup.AggiornaParametro("NomeMiniatura", RadioButton6.Checked); + _parametriSetup.AggiornaParametro("DataFoto", CheckBox16.Checked); + _parametriSetup.AggiornaParametro("NumeroFoto", CheckBox17.Checked); + _parametriSetup.AggiornaParametro("ColoreTestoRGB", TextBox34.Text); + _parametriSetup.AggiornaParametro("TempoSmall", RadioButton5.Checked); + _parametriSetup.AggiornaParametro("NumTempoSmall", RadioButton7.Checked); + _parametriSetup.AggiornaParametro("CompressioneJpeg", TextBox32.Text); + _parametriSetup.AggiornaParametro("CompressioneJpegMiniatura", TextBox33.Text); + // 2021 + _parametriSetup.AggiornaParametro("ChunkSize", TextBox8.Text); + _parametriSetup.AggiornaParametro("ThreadsCount", TextBox7.Text); + _parametriSetup.AggiornaParametro("OverwriteImages", Model.OverwriteImages); + _parametriSetup.SalvaParametriSetup(); + Text = "Image Catalog - " + LeggiSoloNomeFile(ilNome); } private void Button6_Click(object sender, EventArgs e) @@ -471,6 +471,7 @@ public partial class MainForm TextBox32.Text = _parametriSetup.LeggiParametroString("CompressioneJpeg"); TextBox33.Text = _parametriSetup.LeggiParametroString("CompressioneJpegMiniatura"); TextBox34.Text = _parametriSetup.LeggiParametroString("ColoreTestoRGB"); + Model.OverwriteImages = _parametriSetup.LeggiParametroBoolean("OverwriteImages"); if (File.Exists(TextBox10.Text)) { PictureBox1.Image = Image.FromFile(TextBox10.Text); @@ -572,6 +573,7 @@ public partial class MainForm _picSettings.TestoMin = RadioButton6.Checked; _picSettings.JpegQuality = int.Parse(TextBox32.Text); _picSettings.JpegQualityMin = int.Parse(TextBox33.Text); + _picSettings.OverwriteFiles = Model.OverwriteImages; } private List getFiles(DirectoryInfo sourceDir) diff --git a/imagecatalog/ParametriSetup.cs b/imagecatalog/ParametriSetup.cs index 2fb9290..3558b49 100644 --- a/imagecatalog/ParametriSetup.cs +++ b/imagecatalog/ParametriSetup.cs @@ -57,21 +57,21 @@ namespace ImageCatalog return Risposta; } - public bool LeggiParametroBoolean(string NomeParametro) + public bool LeggiParametroBoolean(string nomeParametro) { - string Risposta = ""; + var risposta = ""; try { - var LElenco = _ElencoParametri.Tables["Setup"].Select("Nome='" + NomeParametro + "'"); - foreach (var LaRiga in LElenco) - Risposta = LaRiga["Valore"].ToString(); + var lElenco = _ElencoParametri.Tables["Setup"].Select("Nome='" + nomeParametro + "'"); + foreach (var laRiga in lElenco) + risposta = laRiga["Valore"].ToString(); } catch { - Risposta = ""; + risposta = ""; } - switch (Risposta.ToUpper() ?? "") + switch (risposta.ToUpper() ?? "") { case "TRUE": case "OK": diff --git a/imagecatalog/Program.cs b/imagecatalog/Program.cs index dad280d..322ecb5 100644 --- a/imagecatalog/Program.cs +++ b/imagecatalog/Program.cs @@ -4,97 +4,138 @@ using ImageCatalog_2.Services; using MaddoShared; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; +using Microsoft.Extensions.Logging.Console; +using Microsoft.Extensions.Options; -namespace ImageCatalog_2 +namespace ImageCatalog_2; + +static class Program { - static class Program + [DllImport("kernel32.dll", SetLastError = true)] + private static extern bool AllocConsole(); + + [DllImport("kernel32.dll", SetLastError = true)] + static extern IntPtr GetStdHandle(int nStdHandle); + + private const int STD_OUTPUT_HANDLE = -11; + private const int STD_ERROR_HANDLE = -12; + + [DllImport("kernel32.dll", SetLastError = true)] + static extern bool SetStdHandle(int nStdHandle, IntPtr handle); + + [DllImport("kernel32.dll", SetLastError = true)] + static extern IntPtr GetConsoleWindow(); + + [DllImport("kernel32.dll", SetLastError = true)] + static extern bool AttachConsole(int dwProcessId); + + [DllImport("kernel32.dll", SetLastError = true)] + static extern IntPtr CreateFile( + string lpFileName, + uint dwDesiredAccess, + uint dwShareMode, + IntPtr lpSecurityAttributes, + uint dwCreationDisposition, + uint dwFlagsAndAttributes, + IntPtr hTemplateFile); + + private const uint GENERIC_WRITE = 0x40000000; + private const uint OPEN_EXISTING = 3; + + private static void RedirectConsoleOutput() { - [DllImport("kernel32.dll", SetLastError = true)] - private static extern bool AllocConsole(); + var stdOutHandle = CreateFile("CONOUT$", GENERIC_WRITE, 0, IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero); + var safeFileHandle = new Microsoft.Win32.SafeHandles.SafeFileHandle(stdOutHandle, true); + var fileStream = new FileStream(safeFileHandle, FileAccess.Write); + var standardOutput = new StreamWriter(fileStream) { AutoFlush = true }; + Console.SetOut(standardOutput); + Console.SetError(standardOutput); + } - [DllImport("kernel32.dll", SetLastError = true)] - static extern IntPtr GetStdHandle(int nStdHandle); + public static IServiceProvider ServiceProvider { get; private set; } + [STAThread] + static void Main() + { + Application.SetHighDpiMode(HighDpiMode.SystemAware); + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); - private const int STD_OUTPUT_HANDLE = -11; - private const int STD_ERROR_HANDLE = -12; - - [DllImport("kernel32.dll", SetLastError = true)] - static extern bool SetStdHandle(int nStdHandle, IntPtr handle); - - [DllImport("kernel32.dll", SetLastError = true)] - static extern IntPtr GetConsoleWindow(); - - [DllImport("kernel32.dll", SetLastError = true)] - static extern bool AttachConsole(int dwProcessId); - - [DllImport("kernel32.dll", SetLastError = true)] - static extern IntPtr CreateFile( - string lpFileName, - uint dwDesiredAccess, - uint dwShareMode, - IntPtr lpSecurityAttributes, - uint dwCreationDisposition, - uint dwFlagsAndAttributes, - IntPtr hTemplateFile); - - private const uint GENERIC_WRITE = 0x40000000; - private const uint OPEN_EXISTING = 3; - - private static void RedirectConsoleOutput() - { - var stdOutHandle = CreateFile("CONOUT$", GENERIC_WRITE, 0, IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero); - var safeFileHandle = new Microsoft.Win32.SafeHandles.SafeFileHandle(stdOutHandle, true); - var fileStream = new FileStream(safeFileHandle, FileAccess.Write); - var standardOutput = new StreamWriter(fileStream) { AutoFlush = true }; - Console.SetOut(standardOutput); - Console.SetError(standardOutput); - } - - public static IServiceProvider ServiceProvider { get; private set; } - [STAThread] - static void Main() - { - Application.SetHighDpiMode(HighDpiMode.SystemAware); - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - - AllocConsole(); - RedirectConsoleOutput(); + AllocConsole(); + RedirectConsoleOutput(); - var serviceCollection = new ServiceCollection(); - ConfigureServices(serviceCollection); + var serviceCollection = new ServiceCollection(); + ConfigureServices(serviceCollection); - ServiceProvider = serviceCollection.BuildServiceProvider(); + ServiceProvider = serviceCollection.BuildServiceProvider(); - var mainForm = ServiceProvider.GetRequiredService(); - //var mainViewModel = ServiceProvider.GetRequiredService(); + var mainForm = ServiceProvider.GetRequiredService(); + //var mainViewModel = ServiceProvider.GetRequiredService(); - //mainForm.Model = mainViewModel; + //mainForm.Model = mainViewModel; - Application.Run(mainForm); - } + Application.Run(mainForm); + } - private static void ConfigureServices(ServiceCollection services) - { - // Register your services here - services.AddTransient(); + private static void ConfigureServices(ServiceCollection services) + { + // Register your services here + services.AddTransient(); - services.AddTransient(); + services.AddTransient(); - services.AddTransient(); - services.AddTransient(); + services.AddTransient(); + services.AddTransient(); - services.AddSingleton(); - services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); - // Register your forms - services.AddTransient(); + // Register your forms + services.AddTransient(); - services.AddLogging(configure => - { - configure.AddConsole(); - configure.SetMinimumLevel(LogLevel.Debug); - }); - } + services.AddLogging(configure => + { + configure.AddCustomFormatter(); + configure.AddConsole(); + configure.SetMinimumLevel(LogLevel.Debug); + }); } } + +public static class ConsoleLoggerExtensions +{ + public static ILoggingBuilder AddCustomFormatter( + this ILoggingBuilder builder) => + builder.AddConsole(options => options.FormatterName = nameof(CustomLoggingFormatter)) + .AddConsoleFormatter(); +} +public sealed class CustomLoggingFormatter : ConsoleFormatter, IDisposable +{ + private readonly IDisposable _optionsReloadToken; + private ConsoleFormatterOptions _formatterOptions; + public CustomLoggingFormatter(IOptionsMonitor options) + // Case insensitive + : base(nameof(CustomLoggingFormatter)) => + (_optionsReloadToken, _formatterOptions) = + (options.OnChange(ReloadLoggerOptions), options.CurrentValue); + private void ReloadLoggerOptions(ConsoleFormatterOptions options) => + _formatterOptions = options; + + public override void Write( + in LogEntry logEntry, + IExternalScopeProvider scopeProvider, + TextWriter textWriter) + { + string? message = + logEntry.Formatter?.Invoke( + logEntry.State, logEntry.Exception); + + if (message is null) + { + return; + } + + textWriter.WriteLine($"{message}"); + } + public void Dispose() => _optionsReloadToken?.Dispose(); +} \ No newline at end of file -- 2.52.0 From 5d21d3f8efd050fb5b540dc89b3583b6230d125b Mon Sep 17 00:00:00 2001 From: Marco Date: Mon, 28 Jul 2025 14:46:45 +0200 Subject: [PATCH 030/127] Version Bump --- imagecatalog/ImageCatalog 2.csproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/imagecatalog/ImageCatalog 2.csproj b/imagecatalog/ImageCatalog 2.csproj index 7402663..2d2ba7b 100644 --- a/imagecatalog/ImageCatalog 2.csproj +++ b/imagecatalog/ImageCatalog 2.csproj @@ -6,10 +6,10 @@ enable true False - 3.1.1.0 - 3.1.1.0 - 3.1.1 - 3.1.1 + 3.1.2.0 + 3.1.2.0 + 3.1.2 + 3.1.2 ImageCatalog2025 default Logo.ico -- 2.52.0 From 1cd71c54fc689b7c871ace061db59d176c941c94 Mon Sep 17 00:00:00 2001 From: Marco Date: Tue, 29 Jul 2025 10:34:23 +0200 Subject: [PATCH 031/127] Clean up --- MaddoShared/ImageCreationStuff.cs | 161 +----- MaddoShared/ImageCreatorSharp.cs | 748 ++++++++++++++++--------- imagecatalog/DataModel.cs | 14 + imagecatalog/MainForm.Designer.cs | 876 +++++++++++++++--------------- imagecatalog/MainForm.cs | 51 +- 5 files changed, 964 insertions(+), 886 deletions(-) diff --git a/MaddoShared/ImageCreationStuff.cs b/MaddoShared/ImageCreationStuff.cs index 66d03cc..a6e08c4 100644 --- a/MaddoShared/ImageCreationStuff.cs +++ b/MaddoShared/ImageCreationStuff.cs @@ -2,6 +2,7 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Drawing; using System.IO; using System.Linq; @@ -13,6 +14,7 @@ using Microsoft.Extensions.Logging; namespace MaddoShared { + [SuppressMessage("Interoperability", "CA1416:Validate platform compatibility")] public class ImageCreationStuff(ILogger logger, PicSettings picSettings, ImageCreatorSharp imageCreatorService) { public class Options @@ -38,11 +40,9 @@ namespace MaddoShared { var stopwatch = new Stopwatch(); stopwatch.Start(); - // todo immagini counter - //todo set label + await ProcessImagesParallel(options, results, updateEvent, cancellationToken); - // todo set finito label stopwatch.Stop(); return @@ -55,7 +55,7 @@ namespace MaddoShared EventHandler> updateEvent, CancellationToken cancellationToken = default) { - List dataToProcess = GetFilesToProcess(options); + var dataToProcess = GetFilesToProcess(options); // int threads = options.MaxThreads == 0 ? Environment.ProcessorCount * 2 : options.MaxThreads; int threads = options.MaxThreads; @@ -179,158 +179,7 @@ namespace MaddoShared }).ToList(); } - // public async Task CreaImmaginiParallel(Options options, ConcurrentBag results, - // EventHandler> updateEvent, - // CancellationToken cancellationToken = default(CancellationToken)) - // { - // var dataToProcess = new List(); - // if (options.AggiornaSottodirectory && options.CreaSottocartelle) - // { - // var helper = new FileHelperSharp(); - // dataToProcess = helper.GetFilesRecursive(new DirectoryInfo(options.SourcePath), - // new DirectoryInfo(options.DestinationPath), - // "*.jpg", new FileHelperOptions() - // { - // FilesPerFolder = options.FilePerCartella, - // Suffix = options.SuffissoCartelle, - // CounterSize = options.CifreContatore, - // NumerationType = options.NumerazioneType - // }); - // } - // else if (!options.CreaSottocartelle) - // { - // var files = Directory.EnumerateFiles(options.SourcePath, "*.jpg", - // options.AggiornaSottodirectory - // ? SearchOption.AllDirectories - // : SearchOption.TopDirectoryOnly); - // - // dataToProcess = files.Select(x => - // { - // var fInfo = new FileInfo(x); - // var filePath = fInfo.DirectoryName; - // var trimmedSourcePath = options.SourcePath.TrimEnd('\\'); - // var newFilePath = fInfo.FullName.Replace(trimmedSourcePath, "").TrimStart('\\'); - // newFilePath = Path.Combine(options.DestinationPath, newFilePath); - // - // var destFolderPath = new FileInfo(newFilePath).DirectoryName; - // var destFolderInfo = new DirectoryInfo(destFolderPath); - // destFolderInfo.EnsureDirectoryExists(); - // - // return new FileData(fInfo, new DirectoryInfo(new FileInfo(newFilePath).DirectoryName)); - // }).ToList(); - // - // //// TODO - // //dataToProcess = - // // (from f in Directory.EnumerateFiles(options.SourcePath, "*.jpg", - // // options.AggiornaSottodirectory - // // ? SearchOption.AllDirectories - // // : SearchOption.TopDirectoryOnly) - // // select new FileData(new FileInfo(f), - // // new DirectoryInfo(options.DestinationPath.PathCombine( - // // new FileInfo(f).DirectoryName.Replace(options.SourcePath.TrimEnd(new char[] {'\\'}), "") - // // ) - // // ) - // // ) - // // ) - // // .ToList(); - // } - // - // var threads = options.MaxThreads == 0 ? Environment.ProcessorCount * 2 : options.MaxThreads; - // var scheduler = new ConcurrentExclusiveSchedulerPair(TaskScheduler.Default, threads) - // .ConcurrentScheduler; - // - // //var allTasks = new List(); - // var test = from d in dataToProcess - // select Task.Factory.StartNew(async () => - // { - // var imgCreator = new ImageCreatorSharp(d.File, d.Directory); - // await imgCreator.CreaImmagineThread(d.File.Name); - // - // //await new ImageCreatorSharp(d.File, d.Directory).CreaImmagineThread(d.File.Name); - // - // imgCreator = null; - // - // //var imgC = new ImageCreatorSharp(d.File, d.Directory); - // //imgC.CreaImmagineThread(d.File.Name); - // //imgC = null; - // }, CancellationToken.None, TaskCreationOptions.None, scheduler); - // - // //int count = 0; - // - // if (options.LinearExecution) - // { - // foreach (var task in test) - // { - // await task; - // } - // } - // else - // { - // if (options.ChunksSize == 0) - // { - // //var opts = new ParallelOptions() { MaxDegreeOfParallelism = threads, CancellationToken = cancellationToken, TaskScheduler = scheduler}; - // await dataToProcess.ParallelForEachAsync(async fileData => - // { - // var imgCreator = new ImageCreatorSharp(fileData.File, fileData.Directory); - // await imgCreator.CreaImmagineThread(fileData.File.Name); - // // await new ImageCreatorSharp(fileData.File, fileData.Directory).CreaImmagineThread(fileData.File.Name); - // results.Add(fileData.File.Name); - // //count = Interlocked.Increment(ref count); - // - // try - // { - // updateEvent?.Invoke(this, new Tuple(fileData.File.Name, dataToProcess.Count)); - // } - // catch (Exception e) - // { - // logger.LogError(e, "Error in reporting update"); - // //Console.WriteLine(e); - // throw; - // } - // finally - // { - // // Disposing of the creator - // imgCreator = null; - // } - // }, maxDegreeOfParallelism: threads, false, cancellationToken); - // } - // else - // { - // var asdf = SplitList(dataToProcess.ToList(), options.ChunksSize).ToList(); - // - // - // foreach (var sdaf in asdf) - // { - // await sdaf.ParallelForEachAsync(async fileData => - // { - // var imgCreator = new ImageCreatorSharp(fileData.File, fileData.Directory); - // await imgCreator.CreaImmagineThread(fileData.File.Name); - // // await new ImageCreatorSharp(fileData.File, fileData.Directory).CreaImmagineThread( - // // fileData.File.Name); - // results.Add(fileData.File.Name); - // //count = Interlocked.Increment(ref count); - // try - // { - // updateEvent?.Invoke(this, - // new Tuple(fileData.File.Name, dataToProcess.Count)); - // } - // catch (Exception e) - // { - // logger.LogError("Error in reporting update"); - // //Console.WriteLine(e); - // throw; - // } - // finally - // { - // imgCreator = null; - // } - // }, maxDegreeOfParallelism: threads, false, cancellationToken); - // } - // } - // } - // } - - public static IEnumerable> SplitList(List bigList, int nSize = 3) + private static IEnumerable> SplitList(List bigList, int nSize = 3) { for (int i = 0; i < bigList.Count; i += nSize) { diff --git a/MaddoShared/ImageCreatorSharp.cs b/MaddoShared/ImageCreatorSharp.cs index 4a241e2..e989984 100644 --- a/MaddoShared/ImageCreatorSharp.cs +++ b/MaddoShared/ImageCreatorSharp.cs @@ -19,7 +19,6 @@ public class ImageCreatorSharp(PicSettings picSettings, ILogger @@ -56,14 +55,8 @@ public class ImageCreatorSharp(PicSettings picSettings, ILogger 0) { - if (g.PropertyIdList.Length > 0) + switch (imgState.Orientation) { - //ExifReader DatiExif = new ExifReader((Bitmap)g); - - switch (imgState.Orientation /*DatiExif.Orientation*/) - { - case Orientations.BottomLeft: - case Orientations.BottomRight: - case Orientations.LeftTop: - case Orientations.LftBottom: - imgState.FotoRuotaASinistra = true; - break; - case Orientations.RightBottom: - case Orientations.RightTop: - case Orientations.TopLeft: - case Orientations.TopRight: - break; - - } + case Orientations.BottomLeft: + case Orientations.BottomRight: + case Orientations.LeftTop: + case Orientations.LftBottom: + imgState.FotoRuotaASinistra = true; + break; + case Orientations.RightBottom: + case Orientations.RightTop: + case Orientations.TopLeft: + case Orientations.TopRight: + break; } } @@ -149,7 +137,9 @@ public class ImageCreatorSharp(PicSettings picSettings, ILogger private void ImpostaTestoExtra(Image g, ImageState imgState) { - 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) return; //ExifReader DatiExif = new ExifReader((Bitmap)g); @@ -170,7 +160,7 @@ public class ImageCreatorSharp(PicSettings picSettings, ILogger g.Height) { @@ -225,209 +215,403 @@ public class ImageCreatorSharp(PicSettings picSettings, ILogger 0) + // { + // using var imgOutputSmall = (Bitmap)imgOutputBig.Clone(); + // using var grPhoto1 = Graphics.FromImage(imgOutputSmall); + // grPhoto1.SmoothingMode = SmoothingMode.AntiAlias; + // + // // quick fix + // imgState.DimensioneStandardMiniatura = 50; + // if (picSettings.Grassetto == true) + // { + // crFont1 = new Font(picSettings.IlFont, imgState.DimensioneStandardMiniatura, + // FontStyle.Bold); + // crFont2 = new Font(picSettings.IlFont, imgState.DimensioneStandard, FontStyle.Bold); + // } + // else + // { + // crFont1 = new Font(picSettings.IlFont, imgState.DimensioneStandardMiniatura); + // crFont2 = new Font(picSettings.IlFont, imgState.DimensioneStandard); + // } + // + // crSize1 = grPhoto1.MeasureString(imgState.TestoFirmaPiccola, crFont1); + // crSize2 = grPhoto1.MeasureString(imgState.TestoFirma, crFont1); + // var larghezzaStandard1 = System.Convert.ToInt32(crSize1.Width); + // + // if (crSize1.Width > System.Convert.ToSingle(g.Width)) + // { + // int Conta = imgState.DimensioneStandardMiniatura; + // do + // { + // if (Conta > 20) + // Conta -= 5; + // else + // Conta -= 1; + // if (picSettings.Grassetto == true) + // crFont1 = new Font(picSettings.IlFont, Conta, FontStyle.Bold); + // else + // crFont1 = new Font(picSettings.IlFont, Conta); + // crSize1 = grPhoto1.MeasureString(imgState.TestoFirmaPiccola, crFont1); + // if (crSize1.Width < System.Convert.ToSingle(g.Width)) + // { + // larghezzaStandard1 = System.Convert.ToInt32(crSize1.Width); + // break; + // } + // + // if (Conta <= 5) + // break; + // } while (true); + // + // imgState.DimensioneStandardMiniatura = Conta; + // } + // + // switch (picSettings.Posizione.ToUpper()) + // { + // case "ALTO": + // { + // imgState.YPosFromBottom1 = (picSettings.Margine); + // imgState.YPosFromBottom4 = (picSettings.MargVert); + // break; + // } + // + // case "BASSO": + // { + // imgState.YPosFromBottom1 = System.Convert.ToSingle((g.Height - crSize1.Height - + // (g.Height * picSettings.Margine / + // (double)100))); + // imgState.YPosFromBottom4 = System.Convert.ToSingle((g.Height - crSize1.Height - + // (g.Height * picSettings.MargVert / + // (double)100))); + // break; + // } + // } + // + // float xCenterOfImg1 = 0; + // + // using StringFormat strFormat1 = new StringFormat(); + // switch (picSettings.Allineamento.ToUpper()) + // { + // case "SINISTRA": + // { + // xCenterOfImg1 = + // System.Convert.ToSingle((picSettings.Margine + (larghezzaStandard1 / (double)2))); + // + // if ((larghezzaStandard1 / (double)2) > (g.Width / (double)2) - picSettings.Margine) + // xCenterOfImg1 = System.Convert.ToSingle((g.Width / (double)2)); + // break; + // } + // + // case "CENTRO": + // { + // xCenterOfImg1 = System.Convert.ToSingle((g.Width / (double)2)); + // break; + // } + // + // case "DESTRA": + // { + // xCenterOfImg1 = System.Convert.ToSingle((g.Width - picSettings.Margine - + // (larghezzaStandard1 / (double)2))); + // + // if ((larghezzaStandard1 / (double)2) > (g.Width / (double)2) - picSettings.Margine) + // xCenterOfImg1 = System.Convert.ToSingle((g.Width / (double)2)); + // break; + // } + // } + // + // strFormat1.Alignment = StringAlignment.Center; + // + // using var semiTransBrush21 = new SolidBrush(Color.FromArgb(imgState.AlphaScelta, 0, 0, 0)); + // using var semiTransBrush1 = + // new SolidBrush(Color.FromArgb(imgState.AlphaScelta, picSettings.FontColoreRGB)); + // + // // quick fix + // imgState.DimensioneStandardMiniatura = picSettings.DimMin; + // + // if (picSettings.Grassetto == true) + // crFont1 = new Font(picSettings.IlFont, imgState.DimensioneStandardMiniatura, + // FontStyle.Bold); + // else + // crFont1 = new Font(picSettings.IlFont, imgState.DimensioneStandardMiniatura); + // + // if (picSettings.TestoMin) + // { + // grPhoto1.DrawString(imgState.NomeFileBig, crFont1, semiTransBrush21, + // new PointF(xCenterOfImg1 + 1, imgState.YPosFromBottom1 + 1), strFormat1); + // grPhoto1.DrawString(imgState.NomeFileBig, crFont1, semiTransBrush1, + // new PointF(xCenterOfImg1, imgState.YPosFromBottom1), strFormat1); + // } + // else if (picSettings.AggTempoGaraMin & picSettings.UsaTempoGaraTestoApplicare) + // { + // var diff = imgState.DataPartenzaI - imgState.DataFoto; + // var diffA = diff.TotalSeconds * 10000000; + // + // var orario = + // new TimeSpan(0, 0, + // (int)diffA); /* new TimeSpan(DateTime.DateDiff(DateInterval.Second, dataPartenzaI, dataFoto) * 10000000);*/ + // string tempstr = ""; + // + // + // tempstr += Environment.NewLine + imgState.TestoOrario + orario.Hours.ToString("00") + ":" + + // orario.Minutes.ToString("00") + ":" + orario.Seconds.ToString("00"); + // + // + // grPhoto1.DrawString(tempstr, crFont1, semiTransBrush21, + // new PointF(xCenterOfImg1 + 1, imgState.YPosFromBottom1 + 1), strFormat1); + // grPhoto1.DrawString(tempstr, crFont1, semiTransBrush1, + // new PointF(xCenterOfImg1, imgState.YPosFromBottom1), strFormat1); + // } + // else if (picSettings.AggNumTempMin) + // { + // var diff = imgState.DataPartenzaI - imgState.DataFoto; + // var diffA = diff.TotalSeconds * 10000000; + // TimeSpan Orario = new TimeSpan(0, 0, (int)diffA); + // string tempstr = ""; + // tempstr += imgState.NomeFileBig; + // + // tempstr += Environment.NewLine + imgState.TestoOrario + Orario.Hours.ToString("00") + ":" + + // Orario.Minutes.ToString("00") + ":" + Orario.Seconds.ToString("00"); + // + // + // grPhoto1.DrawString(tempstr, crFont1, semiTransBrush21, + // new PointF(xCenterOfImg1 + 1, imgState.YPosFromBottom1 + 1), strFormat1); + // grPhoto1.DrawString(tempstr, crFont1, semiTransBrush1, + // new PointF(xCenterOfImg1, imgState.YPosFromBottom1), strFormat1); + // } + // else + // { + // grPhoto1.DrawString(imgState.TestoFirmaPiccola, crFont1, semiTransBrush21, + // new PointF(xCenterOfImg1 + 1, imgState.YPosFromBottom1 + 1), strFormat1); + // grPhoto1.DrawString(imgState.TestoFirmaPiccola, crFont1, semiTransBrush1, + // new PointF(xCenterOfImg1, imgState.YPosFromBottom1), strFormat1); + // } + // + // // Salva la miniatura + // //using (var g22 = Image.FromHbitmap(imgOutputSmall)) + // + // + // using var imgOutputSmall2 = new Bitmap(imgOutputSmall, imgState.ThumbSizeSmall.Width, + // imgState.ThumbSizeSmall.Height); + // imgOutputSmall2.Save(Path.Combine(imgState.DestDir.FullName, imgState.NomeFileSmall), + // thisFormat); + // + // //imgOutputSmall2.Dispose(); + // + // //imgOutputSmall.Dispose(); + // + // + // //File.Delete(Path.Combine(DestDir.FullName, "Temp_" + nomeFileSmall)); + // //FileSystem.Kill(); + // } + // else + // { + // using var imgOutputSmall = new Bitmap(g, imgState.ThumbSizeSmall.Width, + // imgState.ThumbSizeSmall.Height); + // imgOutputSmall.Save(Path.Combine(imgState.DestDir.FullName, imgState.NomeFileSmall), + // thisFormat); + // //imgOutputSmall.Dispose(); + // } + // } + // else + // { + // using var imgOutputSmall = + // new Bitmap(g, imgState.ThumbSizeSmall.Width, imgState.ThumbSizeSmall.Height); + // imgOutputSmall.Save(Path.Combine(imgState.DestDir.FullName, imgState.NomeFileSmall), thisFormat); + // //imgOutputSmall.Dispose(); + // } + // + // crFont1?.Dispose(); + // crFont2?.Dispose(); + // } + + private void CreaMiniature(Image sourceImage, ImageState imgState, Bitmap imgOutputBig, ImageFormat format) + { + if (!picSettings.CreaMiniature || picSettings.AggiungiScritteMiniature) + return; + + PrepareSignatureText(imgState); + + if (IsSameDirectory(picSettings.DirectorySorgente, picSettings.DirectoryDestinazione)) + UpdateFileNameWithCode(imgState); + + if (ShouldRenderText()) + CreateMiniatureWithText(sourceImage, imgState, imgOutputBig, format); + else + CreateSimpleThumbnail(sourceImage, imgState, format); + } + + private void PrepareSignatureText(ImageState imgState) { if (picSettings.TestoMin) imgState.TestoFirmaPiccola = imgState.NomeFileBig; else if (picSettings.AggNumTempMin) imgState.TestoFirmaPiccola = imgState.NomeFileBig + " "; - // Dim yPosFromBottom4 As Single + } - Font crFont1 = null/* TODO Change to default(_) if this is not a reference type */; - Font crFont2 = null/* TODO Change to default(_) if this is not a reference type */; - var crSize1 = new SizeF(); - var crSize2 = new SizeF(); + private bool IsSameDirectory(string dir1, string dir2) => + string.Equals(dir1, dir2, StringComparison.OrdinalIgnoreCase); - if (picSettings.CreaMiniature == true) + private void UpdateFileNameWithCode(ImageState imgState) + { + var name = imgState.NomeFileSmall; + imgState.NomeFileSmall = name[..^4] + picSettings.Codice + name[^4..]; + } + + private bool ShouldRenderText() => + picSettings.UsaOrarioMiniatura || picSettings.TestoMin || picSettings.AggTempoGaraMin || + picSettings.AggNumTempMin; + + private void CreateSimpleThumbnail(Image image, ImageState imgState, ImageFormat format) + { + using var thumbnail = new Bitmap(image, imgState.ThumbSizeSmall.Width, imgState.ThumbSizeSmall.Height); + thumbnail.Save(Path.Combine(imgState.DestDir.FullName, imgState.NomeFileSmall), format); + } + + private void CreateMiniatureWithText(Image image, ImageState imgState, Bitmap sourceBitmap, ImageFormat format) + { + if (imgState.TestoFirmaPiccola.Length == 0) { - if (picSettings.AggiungiScritteMiniature == false) - { - if (string.Equals(picSettings.DirectorySorgente, picSettings.DirectoryDestinazione, StringComparison.OrdinalIgnoreCase)) - imgState.NomeFileSmall = imgState.NomeFileSmall.Substring(0, imgState.NomeFileSmall.Length - 4) + picSettings.Codice + imgState.NomeFileSmall.Substring(imgState.NomeFileSmall.Length - 4); - if (picSettings.UsaOrarioMiniatura | picSettings.TestoMin | picSettings.AggTempoGaraMin | picSettings.AggNumTempMin) - { - if (imgState.TestoFirmaPiccola.Length > 0) - { - using var imgOutputSmall = (Bitmap)imgOutputBig.Clone(); - using var grPhoto1 = Graphics.FromImage(imgOutputSmall); - grPhoto1.SmoothingMode = SmoothingMode.AntiAlias; - - // quick fix - imgState.DimensioneStandardMiniatura = 50; - if (picSettings.Grassetto == true) - { - crFont1 = new Font(picSettings.IlFont, imgState.DimensioneStandardMiniatura, FontStyle.Bold); - crFont2 = new Font(picSettings.IlFont, imgState.DimensioneStandard, FontStyle.Bold); - } - else - { - crFont1 = new Font(picSettings.IlFont, imgState.DimensioneStandardMiniatura); - crFont2 = new Font(picSettings.IlFont, imgState.DimensioneStandard); - } - - crSize1 = grPhoto1.MeasureString(imgState.TestoFirmaPiccola, crFont1); - crSize2 = grPhoto1.MeasureString(imgState.TestoFirma, crFont1); - var larghezzaStandard1 = System.Convert.ToInt32(crSize1.Width); - - if (crSize1.Width > System.Convert.ToSingle(g.Width)) - { - int Conta = imgState.DimensioneStandardMiniatura; - do - { - if (Conta > 20) - Conta -= 5; - else - Conta -= 1; - if (picSettings.Grassetto == true) - crFont1 = new Font(picSettings.IlFont, Conta, FontStyle.Bold); - else - crFont1 = new Font(picSettings.IlFont, Conta); - crSize1 = grPhoto1.MeasureString(imgState.TestoFirmaPiccola, crFont1); - if (crSize1.Width < System.Convert.ToSingle(g.Width)) - { - larghezzaStandard1 = System.Convert.ToInt32(crSize1.Width); - break; - } - - if (Conta <= 5) - break; - } - while (true); - imgState.DimensioneStandardMiniatura = Conta; - } - - switch (picSettings.Posizione.ToUpper()) - { - case "ALTO": - { - imgState.YPosFromBottom1 = (picSettings.Margine); - imgState.YPosFromBottom4 = (picSettings.MargVert); - break; - } - - case "BASSO": - { - imgState.YPosFromBottom1 = System.Convert.ToSingle((g.Height - crSize1.Height - (g.Height * picSettings.Margine / (double)100))); - imgState.YPosFromBottom4 = System.Convert.ToSingle((g.Height - crSize1.Height - (g.Height * picSettings.MargVert / (double)100))); - break; - } - } - - float xCenterOfImg1 = 0; - - using StringFormat strFormat1 = new StringFormat(); - switch (picSettings.Allineamento.ToUpper()) - { - case "SINISTRA": - { - xCenterOfImg1 = System.Convert.ToSingle((picSettings.Margine + (larghezzaStandard1 / (double)2))); - - if ((larghezzaStandard1 / (double)2) > (g.Width / (double)2) - picSettings.Margine) - xCenterOfImg1 = System.Convert.ToSingle((g.Width / (double)2)); - break; - } - - case "CENTRO": - { - xCenterOfImg1 = System.Convert.ToSingle((g.Width / (double)2)); - break; - } - - case "DESTRA": - { - xCenterOfImg1 = System.Convert.ToSingle((g.Width - picSettings.Margine - (larghezzaStandard1 / (double)2))); - - if ((larghezzaStandard1 / (double)2) > (g.Width / (double)2) - picSettings.Margine) - xCenterOfImg1 = System.Convert.ToSingle((g.Width / (double)2)); - break; - } - } - strFormat1.Alignment = StringAlignment.Center; - - using var semiTransBrush21 = new SolidBrush(Color.FromArgb(imgState.AlphaScelta, 0, 0, 0)); - using var semiTransBrush1 = new SolidBrush(Color.FromArgb(imgState.AlphaScelta, picSettings.FontColoreRGB)); - - // quick fix - imgState.DimensioneStandardMiniatura = picSettings.DimMin; - - if (picSettings.Grassetto == true) - crFont1 = new Font(picSettings.IlFont, imgState.DimensioneStandardMiniatura, FontStyle.Bold); - else - crFont1 = new Font(picSettings.IlFont, imgState.DimensioneStandardMiniatura); - // asdgadfhdfhjgfsjgfjygfdhsdafa - if (picSettings.TestoMin) - { - grPhoto1.DrawString(imgState.NomeFileBig, crFont1, semiTransBrush21, new PointF(xCenterOfImg1 + 1, imgState.YPosFromBottom1 + 1), strFormat1); - grPhoto1.DrawString(imgState.NomeFileBig, crFont1, semiTransBrush1, new PointF(xCenterOfImg1, imgState.YPosFromBottom1), strFormat1); - } - else if (picSettings.AggTempoGaraMin & picSettings.UsaTempoGaraTestoApplicare) - { - var diff = imgState.DataPartenzaI - imgState.DataFoto; - var diffA = diff.TotalSeconds * 10000000; - - var orario = new TimeSpan(0, 0, (int)diffA);/* new TimeSpan(DateTime.DateDiff(DateInterval.Second, dataPartenzaI, dataFoto) * 10000000);*/ - string tempstr = ""; - - - tempstr += Environment.NewLine + imgState.TestoOrario + orario.Hours.ToString("00") + ":" + orario.Minutes.ToString("00") + ":" + orario.Seconds.ToString("00"); - - - grPhoto1.DrawString(tempstr, crFont1, semiTransBrush21, new PointF(xCenterOfImg1 + 1, imgState.YPosFromBottom1 + 1), strFormat1); - grPhoto1.DrawString(tempstr, crFont1, semiTransBrush1, new PointF(xCenterOfImg1, imgState.YPosFromBottom1), strFormat1); - } - else if (picSettings.AggNumTempMin) - { - var diff = imgState.DataPartenzaI - imgState.DataFoto; - var diffA = diff.TotalSeconds * 10000000; - TimeSpan Orario = new TimeSpan(0, 0, (int)diffA); - string tempstr = ""; - tempstr += imgState.NomeFileBig; - - tempstr += Environment.NewLine + imgState.TestoOrario + Orario.Hours.ToString("00") + ":" + Orario.Minutes.ToString("00") + ":" + Orario.Seconds.ToString("00"); - - - grPhoto1.DrawString(tempstr, crFont1, semiTransBrush21, new PointF(xCenterOfImg1 + 1, imgState.YPosFromBottom1 + 1), strFormat1); - grPhoto1.DrawString(tempstr, crFont1, semiTransBrush1, new PointF(xCenterOfImg1, imgState.YPosFromBottom1), strFormat1); - } - else - { - grPhoto1.DrawString(imgState.TestoFirmaPiccola, crFont1, semiTransBrush21, new PointF(xCenterOfImg1 + 1, imgState.YPosFromBottom1 + 1), strFormat1); - grPhoto1.DrawString(imgState.TestoFirmaPiccola, crFont1, semiTransBrush1, new PointF(xCenterOfImg1, imgState.YPosFromBottom1), strFormat1); - } - - // Salva la miniatura - //using (var g22 = Image.FromHbitmap(imgOutputSmall)) - - - using var imgOutputSmall2 = new Bitmap(imgOutputSmall, imgState.ThumbSizeSmall.Width, imgState.ThumbSizeSmall.Height); - imgOutputSmall2.Save(Path.Combine(imgState.DestDir.FullName, imgState.NomeFileSmall), thisFormat); - - //imgOutputSmall2.Dispose(); - - //imgOutputSmall.Dispose(); - - - //File.Delete(Path.Combine(DestDir.FullName, "Temp_" + nomeFileSmall)); - //FileSystem.Kill(); - } - else - { - using var imgOutputSmall = new Bitmap(g, imgState.ThumbSizeSmall.Width, imgState.ThumbSizeSmall.Height); - imgOutputSmall.Save(Path.Combine(imgState.DestDir.FullName, imgState.NomeFileSmall), thisFormat); - //imgOutputSmall.Dispose(); - } - } - else - { - using var imgOutputSmall = new Bitmap(g, imgState.ThumbSizeSmall.Width, imgState.ThumbSizeSmall.Height); - imgOutputSmall.Save(Path.Combine(imgState.DestDir.FullName, imgState.NomeFileSmall), thisFormat); - //imgOutputSmall.Dispose(); - } - } + CreateSimpleThumbnail(image, imgState, format); + return; } - crFont1?.Dispose(); - crFont2?.Dispose(); + using var imgOutputSmall = (Bitmap)sourceBitmap.Clone(); + using var graphics = Graphics.FromImage(imgOutputSmall); + graphics.SmoothingMode = SmoothingMode.AntiAlias; + + imgState.DimensioneStandardMiniatura = 50; + + using var font1 = CreateFont(picSettings.IlFont, imgState.DimensioneStandardMiniatura, picSettings.Grassetto); + var textSize = graphics.MeasureString(imgState.TestoFirmaPiccola, font1); + + AdjustFontToFitWidth(graphics, image.Width, imgState, ref textSize); + + SetVerticalPosition(image.Height, textSize.Height, imgState); + + float xCenter = CalculateHorizontalAlignment(image.Width, textSize.Width); + using var stringFormat = new StringFormat(); + stringFormat.Alignment = StringAlignment.Center; + + using var shadowBrush = new SolidBrush(Color.FromArgb(imgState.AlphaScelta, 0, 0, 0)); + using var textBrush = new SolidBrush(Color.FromArgb(imgState.AlphaScelta, picSettings.FontColoreRGB)); + + imgState.DimensioneStandardMiniatura = picSettings.DimMin; + + using var finalFont = + CreateFont(picSettings.IlFont, imgState.DimensioneStandardMiniatura, picSettings.Grassetto); + DrawText(graphics, imgState, xCenter, stringFormat, shadowBrush, textBrush, finalFont); + + using var finalThumb = + new Bitmap(imgOutputSmall, imgState.ThumbSizeSmall.Width, imgState.ThumbSizeSmall.Height); + finalThumb.Save(Path.Combine(imgState.DestDir.FullName, imgState.NomeFileSmall), format); + } + + private Font CreateFont(string fontName, int size, bool bold) => + new Font(fontName, size, bold ? FontStyle.Bold : FontStyle.Regular); + + private void AdjustFontToFitWidth(Graphics g, int maxWidth, ImageState imgState, ref SizeF size) + { + int currentSize = imgState.DimensioneStandardMiniatura; + + while (size.Width > maxWidth && currentSize > 5) + { + currentSize = (currentSize > 20) ? currentSize - 5 : currentSize - 1; + using var tempFont = CreateFont(picSettings.IlFont, currentSize, picSettings.Grassetto); + size = g.MeasureString(imgState.TestoFirmaPiccola, tempFont); + //tempFont.Dispose(); + } + + imgState.DimensioneStandardMiniatura = currentSize; + } + + private void SetVerticalPosition(int imgHeight, float textHeight, ImageState imgState) + { + switch (picSettings.Posizione.ToUpper()) + { + case "ALTO": + imgState.YPosFromBottom1 = picSettings.Margine; + imgState.YPosFromBottom4 = picSettings.MargVert; + break; + + case "BASSO": + imgState.YPosFromBottom1 = (float)(imgHeight - textHeight - (imgHeight * picSettings.Margine / 100.0)); + imgState.YPosFromBottom4 = (float)(imgHeight - textHeight - (imgHeight * picSettings.MargVert / 100.0)); + break; + } + } + + private float CalculateHorizontalAlignment(int imgWidth, float textWidth) + { + double halfWidth = textWidth / 2.0; + + return picSettings.Allineamento.ToUpper() switch + { + "SINISTRA" => (float)Math.Min(picSettings.Margine + halfWidth, imgWidth / 2.0), + "DESTRA" => (float)Math.Max(imgWidth - picSettings.Margine - halfWidth, imgWidth / 2.0), + _ => imgWidth / 2.0f, // CENTRO or default + }; + } + + private void DrawText(Graphics g, ImageState imgState, float x, StringFormat format, + Brush shadowBrush, Brush textBrush, Font font) + { + string content = imgState.TestoFirmaPiccola; + + if (picSettings.TestoMin) + { + content = imgState.NomeFileBig; + } + else if (picSettings.AggTempoGaraMin && picSettings.UsaTempoGaraTestoApplicare) + { + content = FormatTimeText(imgState, includeFileName: false); + } + else if (picSettings.AggNumTempMin) + { + content = FormatTimeText(imgState, includeFileName: true); + } + + var offset = new PointF(x + 1, imgState.YPosFromBottom1 + 1); + var actual = new PointF(x, imgState.YPosFromBottom1); + + g.DrawString(content, font, shadowBrush, offset, format); + g.DrawString(content, font, textBrush, actual, format); + } + + private string FormatTimeText(ImageState imgState, bool includeFileName) + { + var diff = imgState.DataPartenzaI - imgState.DataFoto; + var ticks = (long)(diff.TotalSeconds * 10000000); + var time = new TimeSpan(ticks); + + var formatted = $"{imgState.TestoOrario}{time:hh\\:mm\\:ss}"; + return includeFileName + ? $"{imgState.NomeFileBig}{Environment.NewLine}{formatted}" + : Environment.NewLine + formatted; } private void AggiungiTesto(Image g, ImageState imgState, Bitmap imgOutputBig) @@ -435,7 +619,7 @@ public class ImageCreatorSharp(PicSettings picSettings, ILogger (g.Width / (double)2) - picSettings.Margine) xCenterOfImg = System.Convert.ToSingle((g.Width / (double)2)); if ((larghezzaStandard / (double)2) > (g.Width / (double)2) - picSettings.MargVert) @@ -521,6 +711,7 @@ public class ImageCreatorSharp(PicSettings picSettings, ILogger fattoreAlt ? NewthumbSize(logo.Width, logo.Height, fotoLogoW, "Larghezza") : NewthumbSize(logo.Width, logo.Height, fotoLogoH, "Altezza"); + var nuovaSize = fattoreLarg > fattoreAlt + ? NewthumbSize(logo.Width, logo.Height, fotoLogoW, "Larghezza") + : NewthumbSize(logo.Width, logo.Height, fotoLogoH, "Altezza"); var inPercentualeL = picSettings.LogoMargine.EndsWith('%'); var margineL = System.Convert.ToInt32(picSettings.LogoMargine); - var margineUsato = inPercentualeL ? System.Convert.ToInt32(imgOutputBig.Height * margineL / (double)100) : margineL; + var margineUsato = + inPercentualeL ? System.Convert.ToInt32(imgOutputBig.Height * margineL / (double)100) : margineL; int xPosOfWm = 0; int yPosOfWm = 0; @@ -651,6 +863,7 @@ public class ImageCreatorSharp(PicSettings picSettings, ILogger g2.Height ? NewthumbSize(g2.Width, g2.Height, picSettings.LarghezzaBig, "Larghezza") : NewthumbSize(g2.Width, g2.Height, picSettings.AltezzaBig, "Altezza"); + imgState.ThumbSizeBig = g2.Width > g2.Height + ? NewthumbSize(g2.Width, g2.Height, picSettings.LarghezzaBig, "Larghezza") + : NewthumbSize(g2.Width, g2.Height, picSettings.AltezzaBig, "Altezza"); using var imgOutputBig2 = new Bitmap(g2, imgState.ThumbSizeBig.Width, imgState.ThumbSizeBig.Height); if (!picSettings.OverwriteFiles && File.Exists(fileName)) @@ -714,7 +930,6 @@ public class ImageCreatorSharp(PicSettings picSettings, ILogger /// ''' Calculate the Size of the New image /// ''' @@ -822,10 +1041,9 @@ public class ImageCreatorSharp(PicSettings picSettings, ILogger !_uiEnabled; + + private string _speedCounter = "-"; + + public string SpeedCounter + { + get => _speedCounter; + set + { + _speedCounter = value; + NotifyPropertyChanged(); + } + } private void Test(object parameter) { diff --git a/imagecatalog/MainForm.Designer.cs b/imagecatalog/MainForm.Designer.cs index 265c4cf..4945462 100644 --- a/imagecatalog/MainForm.Designer.cs +++ b/imagecatalog/MainForm.Designer.cs @@ -211,19 +211,19 @@ namespace ImageCatalog // // ProgressBar1 // - ProgressBar1.Location = new Point(719, 374); - ProgressBar1.Margin = new Padding(4, 5, 4, 5); + ProgressBar1.Location = new Point(1168, 598); + ProgressBar1.Margin = new Padding(6, 8, 6, 8); ProgressBar1.Name = "ProgressBar1"; - ProgressBar1.Size = new Size(256, 35); + ProgressBar1.Size = new Size(416, 56); ProgressBar1.TabIndex = 67; // // CheckBox22 // CheckBox22.AutoSize = true; - CheckBox22.Location = new Point(719, 551); - CheckBox22.Margin = new Padding(4, 5, 4, 5); + CheckBox22.Location = new Point(1168, 882); + CheckBox22.Margin = new Padding(6, 8, 6, 8); CheckBox22.Name = "CheckBox22"; - CheckBox22.Size = new Size(144, 24); + CheckBox22.Size = new Size(226, 36); CheckBox22.TabIndex = 65; CheckBox22.Text = "Arresta il sistema"; CheckBox22.UseVisualStyleBackColor = true; @@ -231,10 +231,11 @@ namespace ImageCatalog // Label43 // Label43.AutoSize = true; - Label43.Location = new Point(715, 526); - Label43.Margin = new Padding(4, 0, 4, 0); + Label43.DataBindings.Add(new Binding("Text", bindingSource1, "SpeedCounter", true)); + Label43.Location = new Point(1162, 842); + Label43.Margin = new Padding(6, 0, 6, 0); Label43.Name = "Label43"; - Label43.Size = new Size(33, 20); + Label43.Size = new Size(53, 32); Label43.TabIndex = 64; Label43.Text = "000"; Label43.TextAlign = ContentAlignment.MiddleLeft; @@ -247,11 +248,11 @@ namespace ImageCatalog TabControl1.Controls.Add(TabPage1); TabControl1.Controls.Add(TabPage4); TabControl1.DataBindings.Add(new Binding("Enabled", bindingSource1, "UiEnabled", true)); - TabControl1.Location = new Point(16, 18); - TabControl1.Margin = new Padding(4, 5, 4, 5); + TabControl1.Location = new Point(26, 24); + TabControl1.Margin = new Padding(6, 8, 6, 8); TabControl1.Name = "TabControl1"; TabControl1.SelectedIndex = 0; - TabControl1.Size = new Size(695, 580); + TabControl1.Size = new Size(1129, 928); TabControl1.TabIndex = 63; // // TabPage5 @@ -262,11 +263,11 @@ namespace ImageCatalog TabPage5.Controls.Add(GroupBox3); TabPage5.Controls.Add(GroupBox8); TabPage5.Controls.Add(GroupBox7); - TabPage5.Location = new Point(4, 29); - TabPage5.Margin = new Padding(4, 5, 4, 5); + TabPage5.Location = new Point(8, 46); + TabPage5.Margin = new Padding(6, 8, 6, 8); TabPage5.Name = "TabPage5"; - TabPage5.Padding = new Padding(4, 5, 4, 5); - TabPage5.Size = new Size(687, 547); + TabPage5.Padding = new Padding(6, 8, 6, 8); + TabPage5.Size = new Size(1113, 874); TabPage5.TabIndex = 4; TabPage5.Text = "Generale"; TabPage5.UseVisualStyleBackColor = true; @@ -274,9 +275,10 @@ namespace ImageCatalog // button1 // button1.DataBindings.Add(new Binding("Command", bindingSource1, "AsyncTestCommand", true)); - button1.Location = new Point(501, 480); + button1.Location = new Point(814, 768); + button1.Margin = new Padding(5); button1.Name = "button1"; - button1.Size = new Size(94, 29); + button1.Size = new Size(153, 46); button1.TabIndex = 50; button1.Text = "Test Async"; button1.UseVisualStyleBackColor = true; @@ -292,9 +294,10 @@ namespace ImageCatalog // btnTest // btnTest.DataBindings.Add(new Binding("Command", bindingSource1, "TestCommand", true)); - btnTest.Location = new Point(325, 472); + btnTest.Location = new Point(528, 755); + btnTest.Margin = new Padding(5); btnTest.Name = "btnTest"; - btnTest.Size = new Size(94, 29); + btnTest.Size = new Size(153, 46); btnTest.TabIndex = 49; btnTest.Text = "Test"; btnTest.UseVisualStyleBackColor = true; @@ -306,11 +309,11 @@ namespace ImageCatalog GroupBox11.Controls.Add(TextBox8); GroupBox11.Controls.Add(Label7); GroupBox11.Controls.Add(TextBox7); - GroupBox11.Location = new Point(9, 322); - GroupBox11.Margin = new Padding(4, 5, 4, 5); + GroupBox11.Location = new Point(15, 515); + GroupBox11.Margin = new Padding(6, 8, 6, 8); GroupBox11.Name = "GroupBox11"; - GroupBox11.Padding = new Padding(4, 5, 4, 5); - GroupBox11.Size = new Size(255, 203); + GroupBox11.Padding = new Padding(6, 8, 6, 8); + GroupBox11.Size = new Size(414, 325); GroupBox11.TabIndex = 48; GroupBox11.TabStop = false; GroupBox11.Text = "Avanzate (ATTENZIONE)"; @@ -319,20 +322,20 @@ namespace ImageCatalog // Panel3.Controls.Add(rdbNuovoMetodo); Panel3.Controls.Add(rdbVecchioMetodo); - Panel3.Location = new Point(9, 112); - Panel3.Margin = new Padding(4, 5, 4, 5); + Panel3.Location = new Point(15, 179); + Panel3.Margin = new Padding(6, 8, 6, 8); Panel3.Name = "Panel3"; - Panel3.Size = new Size(237, 82); + Panel3.Size = new Size(385, 131); Panel3.TabIndex = 4; // // rdbNuovoMetodo // rdbNuovoMetodo.AutoSize = true; rdbNuovoMetodo.Checked = true; - rdbNuovoMetodo.Location = new Point(11, 43); - rdbNuovoMetodo.Margin = new Padding(4, 5, 4, 5); + rdbNuovoMetodo.Location = new Point(18, 69); + rdbNuovoMetodo.Margin = new Padding(6, 8, 6, 8); rdbNuovoMetodo.Name = "rdbNuovoMetodo"; - rdbNuovoMetodo.Size = new Size(87, 24); + rdbNuovoMetodo.Size = new Size(134, 36); rdbNuovoMetodo.TabIndex = 1; rdbNuovoMetodo.TabStop = true; rdbNuovoMetodo.Text = "Parallelo"; @@ -341,10 +344,10 @@ namespace ImageCatalog // rdbVecchioMetodo // rdbVecchioMetodo.AutoSize = true; - rdbVecchioMetodo.Location = new Point(11, 6); - rdbVecchioMetodo.Margin = new Padding(4, 5, 4, 5); + rdbVecchioMetodo.Location = new Point(18, 10); + rdbVecchioMetodo.Margin = new Padding(6, 8, 6, 8); rdbVecchioMetodo.Name = "rdbVecchioMetodo"; - rdbVecchioMetodo.Size = new Size(78, 24); + rdbVecchioMetodo.Size = new Size(122, 36); rdbVecchioMetodo.TabIndex = 0; rdbVecchioMetodo.Text = "Lineare"; rdbVecchioMetodo.UseVisualStyleBackColor = true; @@ -352,38 +355,38 @@ namespace ImageCatalog // Label8 // Label8.AutoSize = true; - Label8.Location = new Point(85, 40); - Label8.Margin = new Padding(4, 0, 4, 0); + Label8.Location = new Point(138, 64); + Label8.Margin = new Padding(6, 0, 6, 0); Label8.Name = "Label8"; - Label8.Size = new Size(152, 20); + Label8.Size = new Size(248, 32); Label8.TabIndex = 3; Label8.Text = "Chunk Size (0 = MAX)"; // // TextBox8 // - TextBox8.Location = new Point(9, 31); - TextBox8.Margin = new Padding(4, 5, 4, 5); + TextBox8.Location = new Point(15, 50); + TextBox8.Margin = new Padding(6, 8, 6, 8); TextBox8.Name = "TextBox8"; - TextBox8.Size = new Size(61, 27); + TextBox8.Size = new Size(97, 39); TextBox8.TabIndex = 2; TextBox8.Text = "0"; // // Label7 // Label7.AutoSize = true; - Label7.Location = new Point(81, 74); - Label7.Margin = new Padding(4, 0, 4, 0); + Label7.Location = new Point(132, 118); + Label7.Margin = new Padding(6, 0, 6, 0); Label7.Name = "Label7"; - Label7.Size = new Size(146, 20); + Label7.Size = new Size(236, 32); Label7.TabIndex = 1; Label7.Text = "Threads (0 = CPU *2)"; // // TextBox7 // - TextBox7.Location = new Point(9, 71); - TextBox7.Margin = new Padding(4, 5, 4, 5); + TextBox7.Location = new Point(15, 114); + TextBox7.Margin = new Padding(6, 8, 6, 8); TextBox7.Name = "TextBox7"; - TextBox7.Size = new Size(61, 27); + TextBox7.Size = new Size(97, 39); TextBox7.TabIndex = 0; TextBox7.Text = "0"; // @@ -397,11 +400,11 @@ namespace ImageCatalog GroupBox3.Controls.Add(txtSorgente); GroupBox3.Controls.Add(txtDestinazione); GroupBox3.ForeColor = Color.FromArgb(0, 0, 192); - GroupBox3.Location = new Point(8, 9); - GroupBox3.Margin = new Padding(4, 5, 4, 5); + GroupBox3.Location = new Point(13, 14); + GroupBox3.Margin = new Padding(6, 8, 6, 8); GroupBox3.Name = "GroupBox3"; - GroupBox3.Padding = new Padding(4, 5, 4, 5); - GroupBox3.Size = new Size(661, 155); + GroupBox3.Padding = new Padding(6, 8, 6, 8); + GroupBox3.Size = new Size(1074, 248); GroupBox3.TabIndex = 35; GroupBox3.TabStop = false; GroupBox3.Text = "Directory"; @@ -409,29 +412,29 @@ namespace ImageCatalog // chkAggiornaSottodirectory // chkAggiornaSottodirectory.ForeColor = Color.Black; - chkAggiornaSottodirectory.Location = new Point(107, 98); - chkAggiornaSottodirectory.Margin = new Padding(4, 5, 4, 5); + chkAggiornaSottodirectory.Location = new Point(174, 157); + chkAggiornaSottodirectory.Margin = new Padding(6, 8, 6, 8); chkAggiornaSottodirectory.Name = "chkAggiornaSottodirectory"; - chkAggiornaSottodirectory.Size = new Size(317, 37); + chkAggiornaSottodirectory.Size = new Size(515, 59); chkAggiornaSottodirectory.TabIndex = 25; chkAggiornaSottodirectory.Text = "aggiorna le sottodirectory"; // // _Button3 // - _Button3.Location = new Point(616, 62); - _Button3.Margin = new Padding(4, 5, 4, 5); + _Button3.Location = new Point(1001, 99); + _Button3.Margin = new Padding(6, 8, 6, 8); _Button3.Name = "_Button3"; - _Button3.Size = new Size(32, 31); + _Button3.Size = new Size(52, 50); _Button3.TabIndex = 6; _Button3.Text = "..."; _Button3.Click += Button3_Click; // // _Button2 // - _Button2.Location = new Point(616, 25); - _Button2.Margin = new Padding(4, 5, 4, 5); + _Button2.Location = new Point(1001, 40); + _Button2.Margin = new Padding(6, 8, 6, 8); _Button2.Name = "_Button2"; - _Button2.Size = new Size(32, 31); + _Button2.Size = new Size(52, 50); _Button2.TabIndex = 5; _Button2.Text = "..."; _Button2.Click += Button2_Click; @@ -440,10 +443,10 @@ namespace ImageCatalog // Label1.AutoSize = true; Label1.ForeColor = Color.Black; - Label1.Location = new Point(8, 29); - Label1.Margin = new Padding(4, 0, 4, 0); + Label1.Location = new Point(13, 46); + Label1.Margin = new Padding(6, 0, 6, 0); Label1.Name = "Label1"; - Label1.Size = new Size(69, 20); + Label1.Size = new Size(111, 32); Label1.TabIndex = 3; Label1.Text = "Sorgente"; // @@ -451,30 +454,29 @@ namespace ImageCatalog // Label2.AutoSize = true; Label2.ForeColor = Color.Black; - Label2.Location = new Point(8, 66); - Label2.Margin = new Padding(4, 0, 4, 0); + Label2.Location = new Point(13, 102); + Label2.Margin = new Padding(6, 0, 6, 0); Label2.Name = "Label2"; - Label2.Size = new Size(95, 20); + Label2.Size = new Size(152, 32); Label2.TabIndex = 4; Label2.Text = "Destinazione"; // // txtSorgente // txtSorgente.DataBindings.Add(new Binding("Text", bindingSource1, "SourcePath", true, DataSourceUpdateMode.OnPropertyChanged)); - txtSorgente.Location = new Point(107, 25); - txtSorgente.Margin = new Padding(4, 5, 4, 5); + txtSorgente.Location = new Point(174, 40); + txtSorgente.Margin = new Padding(6, 8, 6, 8); txtSorgente.Name = "txtSorgente"; - txtSorgente.Size = new Size(500, 27); + txtSorgente.Size = new Size(810, 39); txtSorgente.TabIndex = 0; - txtSorgente.Text = ""; // // txtDestinazione // txtDestinazione.DataBindings.Add(new Binding("Text", bindingSource1, "DestinationPath", true, DataSourceUpdateMode.OnPropertyChanged)); - txtDestinazione.Location = new Point(107, 62); - txtDestinazione.Margin = new Padding(4, 5, 4, 5); + txtDestinazione.Location = new Point(174, 99); + txtDestinazione.Margin = new Padding(6, 8, 6, 8); txtDestinazione.Name = "txtDestinazione"; - txtDestinazione.Size = new Size(500, 27); + txtDestinazione.Size = new Size(810, 39); txtDestinazione.TabIndex = 1; txtDestinazione.Text = "TextBox2"; // @@ -491,11 +493,11 @@ namespace ImageCatalog GroupBox8.Controls.Add(txtFilePerCartella); GroupBox8.Controls.Add(Label32); GroupBox8.ForeColor = Color.FromArgb(0, 0, 192); - GroupBox8.Location = new Point(272, 174); - GroupBox8.Margin = new Padding(4, 5, 4, 5); + GroupBox8.Location = new Point(442, 278); + GroupBox8.Margin = new Padding(6, 8, 6, 8); GroupBox8.Name = "GroupBox8"; - GroupBox8.Padding = new Padding(4, 5, 4, 5); - GroupBox8.Size = new Size(256, 234); + GroupBox8.Padding = new Padding(6, 8, 6, 8); + GroupBox8.Size = new Size(416, 374); GroupBox8.TabIndex = 47; GroupBox8.TabStop = false; GroupBox8.Text = "Sottocartelle"; @@ -503,10 +505,10 @@ namespace ImageCatalog // rdbNumFiles // rdbNumFiles.ForeColor = Color.Black; - rdbNumFiles.Location = new Point(43, 197); - rdbNumFiles.Margin = new Padding(4, 5, 4, 5); + rdbNumFiles.Location = new Point(70, 315); + rdbNumFiles.Margin = new Padding(6, 8, 6, 8); rdbNumFiles.Name = "rdbNumFiles"; - rdbNumFiles.Size = new Size(181, 25); + rdbNumFiles.Size = new Size(294, 40); rdbNumFiles.TabIndex = 38; rdbNumFiles.Text = "Numerazione files"; // @@ -514,89 +516,89 @@ namespace ImageCatalog // rdbNumProgressiva.Checked = true; rdbNumProgressiva.ForeColor = Color.Black; - rdbNumProgressiva.Location = new Point(43, 172); - rdbNumProgressiva.Margin = new Padding(4, 5, 4, 5); + rdbNumProgressiva.Location = new Point(70, 275); + rdbNumProgressiva.Margin = new Padding(6, 8, 6, 8); rdbNumProgressiva.Name = "rdbNumProgressiva"; - rdbNumProgressiva.Size = new Size(203, 25); + rdbNumProgressiva.Size = new Size(330, 40); rdbNumProgressiva.TabIndex = 37; rdbNumProgressiva.TabStop = true; rdbNumProgressiva.Text = "Numerazione progressiva"; // // txtCifreContatore // - txtCifreContatore.Location = new Point(171, 135); - txtCifreContatore.Margin = new Padding(4, 5, 4, 5); + txtCifreContatore.Location = new Point(278, 216); + txtCifreContatore.Margin = new Padding(6, 8, 6, 8); txtCifreContatore.Name = "txtCifreContatore"; - txtCifreContatore.Size = new Size(73, 27); + txtCifreContatore.Size = new Size(116, 39); txtCifreContatore.TabIndex = 34; txtCifreContatore.Text = "4"; // // Label34 // Label34.ForeColor = Color.Black; - Label34.Location = new Point(11, 135); - Label34.Margin = new Padding(4, 0, 4, 0); + Label34.Location = new Point(18, 216); + Label34.Margin = new Padding(6, 0, 6, 0); Label34.Name = "Label34"; - Label34.Size = new Size(149, 25); + Label34.Size = new Size(242, 40); Label34.TabIndex = 33; Label34.Text = "Num. cifre contatore"; Label34.TextAlign = ContentAlignment.MiddleRight; // // txtSuffissoCartelle // - txtSuffissoCartelle.Location = new Point(75, 98); - txtSuffissoCartelle.Margin = new Padding(4, 5, 4, 5); + txtSuffissoCartelle.Location = new Point(122, 157); + txtSuffissoCartelle.Margin = new Padding(6, 8, 6, 8); txtSuffissoCartelle.Name = "txtSuffissoCartelle"; - txtSuffissoCartelle.Size = new Size(169, 27); + txtSuffissoCartelle.Size = new Size(272, 39); txtSuffissoCartelle.TabIndex = 32; txtSuffissoCartelle.Text = "TextBox20"; // // Label33 // Label33.ForeColor = Color.Black; - Label33.Location = new Point(8, 103); - Label33.Margin = new Padding(4, 0, 4, 0); + Label33.Location = new Point(13, 165); + Label33.Margin = new Padding(6, 0, 6, 0); Label33.Name = "Label33"; - Label33.Size = new Size(64, 25); + Label33.Size = new Size(104, 40); Label33.TabIndex = 31; Label33.Text = "Suffisso"; // // Label31 // Label31.ForeColor = Color.Black; - Label31.Location = new Point(32, 62); - Label31.Margin = new Padding(4, 0, 4, 0); + Label31.Location = new Point(52, 99); + Label31.Margin = new Padding(6, 0, 6, 0); Label31.Name = "Label31"; - Label31.Size = new Size(43, 25); + Label31.Size = new Size(70, 40); Label31.TabIndex = 30; Label31.Text = "ogni"; // // chkCreaSottocartelle // chkCreaSottocartelle.ForeColor = Color.Black; - chkCreaSottocartelle.Location = new Point(75, 25); - chkCreaSottocartelle.Margin = new Padding(4, 5, 4, 5); + chkCreaSottocartelle.Location = new Point(122, 40); + chkCreaSottocartelle.Margin = new Padding(6, 8, 6, 8); chkCreaSottocartelle.Name = "chkCreaSottocartelle"; - chkCreaSottocartelle.Size = new Size(149, 25); + chkCreaSottocartelle.Size = new Size(242, 40); chkCreaSottocartelle.TabIndex = 29; chkCreaSottocartelle.Text = "crea sottocartelle"; // // txtFilePerCartella // - txtFilePerCartella.Location = new Point(75, 62); - txtFilePerCartella.Margin = new Padding(4, 5, 4, 5); + txtFilePerCartella.Location = new Point(122, 99); + txtFilePerCartella.Margin = new Padding(6, 8, 6, 8); txtFilePerCartella.Name = "txtFilePerCartella"; - txtFilePerCartella.Size = new Size(84, 27); + txtFilePerCartella.Size = new Size(134, 39); txtFilePerCartella.TabIndex = 27; txtFilePerCartella.Text = "99"; // // Label32 // Label32.ForeColor = Color.Black; - Label32.Location = new Point(171, 62); - Label32.Margin = new Padding(4, 0, 4, 0); + Label32.Location = new Point(278, 99); + Label32.Margin = new Padding(6, 0, 6, 0); Label32.Name = "Label32"; - Label32.Size = new Size(32, 25); + Label32.Size = new Size(52, 40); Label32.TabIndex = 28; Label32.Text = "file"; // @@ -606,23 +608,23 @@ namespace ImageCatalog GroupBox7.Controls.Add(chkRotazioneAutomatica); GroupBox7.Controls.Add(chkForzaJpg); GroupBox7.ForeColor = Color.FromArgb(0, 0, 192); - GroupBox7.Location = new Point(8, 174); - GroupBox7.Margin = new Padding(4, 5, 4, 5); + GroupBox7.Location = new Point(13, 278); + GroupBox7.Margin = new Padding(6, 8, 6, 8); GroupBox7.Name = "GroupBox7"; - GroupBox7.Padding = new Padding(4, 5, 4, 5); - GroupBox7.Size = new Size(256, 135); + GroupBox7.Padding = new Padding(6, 8, 6, 8); + GroupBox7.Size = new Size(416, 216); GroupBox7.TabIndex = 45; GroupBox7.TabStop = false; GroupBox7.Text = "Generale"; // // chkSovrascriviFile // - chkSovrascriviFile.DataBindings.Add(new Binding("Checked", bindingSource1, "OverwriteImages", true, DataSourceUpdateMode.OnPropertyChanged)); chkSovrascriviFile.AutoSize = true; - chkSovrascriviFile.Location = new Point(21, 94); - chkSovrascriviFile.Margin = new Padding(4, 5, 4, 5); + chkSovrascriviFile.DataBindings.Add(new Binding("Checked", bindingSource1, "OverwriteImages", true, DataSourceUpdateMode.OnPropertyChanged)); + chkSovrascriviFile.Location = new Point(34, 150); + chkSovrascriviFile.Margin = new Padding(6, 8, 6, 8); chkSovrascriviFile.Name = "chkSovrascriviFile"; - chkSovrascriviFile.Size = new Size(126, 24); + chkSovrascriviFile.Size = new Size(198, 36); chkSovrascriviFile.TabIndex = 2; chkSovrascriviFile.Text = "Sovrascrivi file"; chkSovrascriviFile.UseVisualStyleBackColor = true; @@ -630,10 +632,10 @@ namespace ImageCatalog // chkRotazioneAutomatica // chkRotazioneAutomatica.ForeColor = Color.Black; - chkRotazioneAutomatica.Location = new Point(21, 60); - chkRotazioneAutomatica.Margin = new Padding(4, 5, 4, 5); + chkRotazioneAutomatica.Location = new Point(34, 96); + chkRotazioneAutomatica.Margin = new Padding(6, 8, 6, 8); chkRotazioneAutomatica.Name = "chkRotazioneAutomatica"; - chkRotazioneAutomatica.Size = new Size(181, 25); + chkRotazioneAutomatica.Size = new Size(294, 40); chkRotazioneAutomatica.TabIndex = 1; chkRotazioneAutomatica.Text = "Rotazione automatica"; // @@ -642,10 +644,10 @@ namespace ImageCatalog chkForzaJpg.Checked = true; chkForzaJpg.CheckState = CheckState.Checked; chkForzaJpg.ForeColor = Color.Black; - chkForzaJpg.Location = new Point(21, 28); - chkForzaJpg.Margin = new Padding(4, 5, 4, 5); + chkForzaJpg.Location = new Point(34, 45); + chkForzaJpg.Margin = new Padding(6, 8, 6, 8); chkForzaJpg.Name = "chkForzaJpg"; - chkForzaJpg.Size = new Size(107, 25); + chkForzaJpg.Size = new Size(174, 40); chkForzaJpg.TabIndex = 0; chkForzaJpg.Text = "Forza Jpg"; // @@ -655,11 +657,11 @@ namespace ImageCatalog TabPage3.Controls.Add(GroupBox9); TabPage3.Controls.Add(GroupBox5); TabPage3.Controls.Add(GroupBox4); - TabPage3.Location = new Point(4, 29); - TabPage3.Margin = new Padding(4, 5, 4, 5); + TabPage3.Location = new Point(8, 46); + TabPage3.Margin = new Padding(6, 8, 6, 8); TabPage3.Name = "TabPage3"; - TabPage3.Padding = new Padding(4, 5, 4, 5); - TabPage3.Size = new Size(687, 547); + TabPage3.Padding = new Padding(6, 8, 6, 8); + TabPage3.Size = new Size(1113, 874); TabPage3.TabIndex = 2; TabPage3.Text = "Testo"; TabPage3.UseVisualStyleBackColor = true; @@ -670,11 +672,11 @@ namespace ImageCatalog GroupBox10.Controls.Add(Label41); GroupBox10.Controls.Add(TextBox31); GroupBox10.Controls.Add(TextBox30); - GroupBox10.Location = new Point(421, 120); - GroupBox10.Margin = new Padding(4, 5, 4, 5); + GroupBox10.Location = new Point(684, 192); + GroupBox10.Margin = new Padding(6, 8, 6, 8); GroupBox10.Name = "GroupBox10"; - GroupBox10.Padding = new Padding(4, 5, 4, 5); - GroupBox10.Size = new Size(248, 112); + GroupBox10.Padding = new Padding(6, 8, 6, 8); + GroupBox10.Size = new Size(403, 179); GroupBox10.TabIndex = 39; GroupBox10.TabStop = false; GroupBox10.Text = "Testo foto verticali"; @@ -682,48 +684,48 @@ namespace ImageCatalog // Label42 // Label42.AutoSize = true; - Label42.Location = new Point(9, 71); - Label42.Margin = new Padding(4, 0, 4, 0); + Label42.Location = new Point(15, 114); + Label42.Margin = new Padding(6, 0, 6, 0); Label42.Name = "Label42"; - Label42.Size = new Size(64, 20); + Label42.Size = new Size(103, 32); Label42.TabIndex = 3; Label42.Text = "Margine"; // // Label41 // Label41.AutoSize = true; - Label41.Location = new Point(9, 38); - Label41.Margin = new Padding(4, 0, 4, 0); + Label41.Location = new Point(15, 61); + Label41.Margin = new Padding(6, 0, 6, 0); Label41.Name = "Label41"; - Label41.Size = new Size(153, 20); + Label41.Size = new Size(246, 32); Label41.TabIndex = 2; Label41.Text = "Dimensione Carattere"; // // TextBox31 // - TextBox31.Location = new Point(175, 71); - TextBox31.Margin = new Padding(4, 5, 4, 5); + TextBox31.Location = new Point(284, 114); + TextBox31.Margin = new Padding(6, 8, 6, 8); TextBox31.Name = "TextBox31"; - TextBox31.Size = new Size(51, 27); + TextBox31.Size = new Size(80, 39); TextBox31.TabIndex = 1; // // TextBox30 // - TextBox30.Location = new Point(175, 34); - TextBox30.Margin = new Padding(4, 5, 4, 5); + TextBox30.Location = new Point(284, 54); + TextBox30.Margin = new Padding(6, 8, 6, 8); TextBox30.Name = "TextBox30"; - TextBox30.Size = new Size(51, 27); + TextBox30.Size = new Size(80, 39); TextBox30.TabIndex = 0; // // GroupBox9 // GroupBox9.Controls.Add(CheckBox17); GroupBox9.Controls.Add(CheckBox16); - GroupBox9.Location = new Point(421, 48); - GroupBox9.Margin = new Padding(4, 5, 4, 5); + GroupBox9.Location = new Point(684, 77); + GroupBox9.Margin = new Padding(6, 8, 6, 8); GroupBox9.Name = "GroupBox9"; - GroupBox9.Padding = new Padding(4, 5, 4, 5); - GroupBox9.Size = new Size(248, 69); + GroupBox9.Padding = new Padding(6, 8, 6, 8); + GroupBox9.Size = new Size(403, 110); GroupBox9.TabIndex = 38; GroupBox9.TabStop = false; GroupBox9.Text = "Slide show"; @@ -731,10 +733,10 @@ namespace ImageCatalog // CheckBox17 // CheckBox17.AutoSize = true; - CheckBox17.Location = new Point(128, 28); - CheckBox17.Margin = new Padding(4, 5, 4, 5); + CheckBox17.Location = new Point(208, 45); + CheckBox17.Margin = new Padding(6, 8, 6, 8); CheckBox17.Name = "CheckBox17"; - CheckBox17.Size = new Size(117, 24); + CheckBox17.Size = new Size(185, 36); CheckBox17.TabIndex = 1; CheckBox17.Text = "Numero foto"; CheckBox17.UseVisualStyleBackColor = true; @@ -742,10 +744,10 @@ namespace ImageCatalog // CheckBox16 // CheckBox16.AutoSize = true; - CheckBox16.Location = new Point(8, 29); - CheckBox16.Margin = new Padding(4, 5, 4, 5); + CheckBox16.Location = new Point(13, 46); + CheckBox16.Margin = new Padding(6, 8, 6, 8); CheckBox16.Name = "CheckBox16"; - CheckBox16.Size = new Size(63, 24); + CheckBox16.Size = new Size(95, 36); CheckBox16.TabIndex = 0; CheckBox16.Text = "Data"; CheckBox16.UseVisualStyleBackColor = true; @@ -763,31 +765,31 @@ namespace ImageCatalog GroupBox5.Controls.Add(Label11); GroupBox5.Controls.Add(CheckBox3); GroupBox5.ForeColor = Color.FromArgb(0, 0, 192); - GroupBox5.Location = new Point(8, 48); - GroupBox5.Margin = new Padding(4, 5, 4, 5); + GroupBox5.Location = new Point(13, 77); + GroupBox5.Margin = new Padding(6, 8, 6, 8); GroupBox5.Name = "GroupBox5"; - GroupBox5.Padding = new Padding(4, 5, 4, 5); - GroupBox5.Size = new Size(405, 185); + GroupBox5.Padding = new Padding(6, 8, 6, 8); + GroupBox5.Size = new Size(658, 296); GroupBox5.TabIndex = 37; GroupBox5.TabStop = false; GroupBox5.Text = "Carattere"; // // TextBox34 // - TextBox34.Location = new Point(213, 140); - TextBox34.Margin = new Padding(4, 5, 4, 5); + TextBox34.Location = new Point(346, 224); + TextBox34.Margin = new Padding(6, 8, 6, 8); TextBox34.Name = "TextBox34"; - TextBox34.Size = new Size(73, 27); + TextBox34.Size = new Size(116, 39); TextBox34.TabIndex = 36; TextBox34.TextAlign = HorizontalAlignment.Right; // // _Button8 // _Button8.ForeColor = Color.Black; - _Button8.Location = new Point(296, 137); - _Button8.Margin = new Padding(4, 5, 4, 5); + _Button8.Location = new Point(481, 219); + _Button8.Margin = new Padding(6, 8, 6, 8); _Button8.Name = "_Button8"; - _Button8.Size = new Size(99, 37); + _Button8.Size = new Size(161, 59); _Button8.TabIndex = 35; _Button8.Text = "Scegli..."; _Button8.Click += Button8_Click; @@ -795,49 +797,49 @@ namespace ImageCatalog // Label36 // Label36.ForeColor = Color.Black; - Label36.Location = new Point(11, 92); - Label36.Margin = new Padding(4, 0, 4, 0); + Label36.Location = new Point(18, 147); + Label36.Margin = new Padding(6, 0, 6, 0); Label36.Name = "Label36"; - Label36.Size = new Size(160, 29); + Label36.Size = new Size(260, 46); Label36.TabIndex = 34; Label36.Text = "Dimensione miniatura"; Label36.TextAlign = ContentAlignment.MiddleLeft; // // TextBox25 // - TextBox25.Location = new Point(213, 91); - TextBox25.Margin = new Padding(4, 5, 4, 5); + TextBox25.Location = new Point(346, 146); + TextBox25.Margin = new Padding(6, 8, 6, 8); TextBox25.Name = "TextBox25"; - TextBox25.Size = new Size(73, 27); + TextBox25.Size = new Size(116, 39); TextBox25.TabIndex = 33; TextBox25.Text = "TextBox25"; // // Label35 // Label35.ForeColor = Color.Black; - Label35.Location = new Point(11, 143); - Label35.Margin = new Padding(4, 0, 4, 0); + Label35.Location = new Point(18, 229); + Label35.Margin = new Padding(6, 0, 6, 0); Label35.Name = "Label35"; - Label35.Size = new Size(96, 25); + Label35.Size = new Size(156, 40); Label35.TabIndex = 32; Label35.Text = "Colore RGB"; Label35.TextAlign = ContentAlignment.MiddleLeft; // // ComboBox3 // - ComboBox3.Location = new Point(128, 12); - ComboBox3.Margin = new Padding(4, 5, 4, 5); + ComboBox3.Location = new Point(208, 19); + ComboBox3.Margin = new Padding(6, 8, 6, 8); ComboBox3.Name = "ComboBox3"; - ComboBox3.Size = new Size(159, 28); + ComboBox3.Size = new Size(256, 40); ComboBox3.TabIndex = 28; ComboBox3.Text = "ComboBox3"; // // TextBox11 // - TextBox11.Location = new Point(213, 54); - TextBox11.Margin = new Padding(4, 5, 4, 5); + TextBox11.Location = new Point(346, 86); + TextBox11.Margin = new Padding(6, 8, 6, 8); TextBox11.Name = "TextBox11"; - TextBox11.Size = new Size(73, 27); + TextBox11.Size = new Size(116, 39); TextBox11.TabIndex = 27; TextBox11.Text = "TextBox11"; // @@ -845,10 +847,10 @@ namespace ImageCatalog // Label12.AutoSize = true; Label12.ForeColor = Color.Black; - Label12.Location = new Point(11, 58); - Label12.Margin = new Padding(4, 0, 4, 0); + Label12.Location = new Point(18, 93); + Label12.Margin = new Padding(6, 0, 6, 0); Label12.Name = "Label12"; - Label12.Size = new Size(88, 20); + Label12.Size = new Size(142, 32); Label12.TabIndex = 26; Label12.Text = "Dimensione"; Label12.TextAlign = ContentAlignment.MiddleLeft; @@ -857,20 +859,20 @@ namespace ImageCatalog // Label11.AutoSize = true; Label11.ForeColor = Color.Black; - Label11.Location = new Point(75, 12); - Label11.Margin = new Padding(4, 0, 4, 0); + Label11.Location = new Point(122, 19); + Label11.Margin = new Padding(6, 0, 6, 0); Label11.Name = "Label11"; - Label11.Size = new Size(38, 20); + Label11.Size = new Size(62, 32); Label11.TabIndex = 22; Label11.Text = "Font"; // // CheckBox3 // CheckBox3.ForeColor = Color.Black; - CheckBox3.Location = new Point(299, 12); - CheckBox3.Margin = new Padding(4, 5, 4, 5); + CheckBox3.Location = new Point(486, 19); + CheckBox3.Margin = new Padding(6, 8, 6, 8); CheckBox3.Name = "CheckBox3"; - CheckBox3.Size = new Size(96, 37); + CheckBox3.Size = new Size(156, 59); CheckBox3.TabIndex = 24; CheckBox3.Text = "Grassetto"; // @@ -894,11 +896,11 @@ namespace ImageCatalog GroupBox4.Controls.Add(TextBox12); GroupBox4.Controls.Add(Label15); GroupBox4.ForeColor = Color.FromArgb(0, 0, 192); - GroupBox4.Location = new Point(8, 242); - GroupBox4.Margin = new Padding(4, 5, 4, 5); + GroupBox4.Location = new Point(13, 387); + GroupBox4.Margin = new Padding(6, 8, 6, 8); GroupBox4.Name = "GroupBox4"; - GroupBox4.Padding = new Padding(4, 5, 4, 5); - GroupBox4.Size = new Size(661, 286); + GroupBox4.Padding = new Padding(6, 8, 6, 8); + GroupBox4.Size = new Size(1074, 458); GroupBox4.TabIndex = 36; GroupBox4.TabStop = false; GroupBox4.Text = "Testo da applicare"; @@ -906,77 +908,77 @@ namespace ImageCatalog // Label40 // Label40.AutoSize = true; - Label40.Location = new Point(11, 80); - Label40.Margin = new Padding(4, 0, 4, 0); + Label40.Location = new Point(18, 128); + Label40.Margin = new Padding(6, 0, 6, 0); Label40.Name = "Label40"; - Label40.Size = new Size(66, 20); + Label40.Size = new Size(104, 32); Label40.TabIndex = 40; Label40.Text = "Verticale"; // // TextBox29 // TextBox29.DataBindings.Add(new Binding("Text", bindingSource1, "VerticalText", true, DataSourceUpdateMode.OnPropertyChanged)); - TextBox29.Location = new Point(96, 75); - TextBox29.Margin = new Padding(4, 5, 4, 5); + TextBox29.Location = new Point(156, 120); + TextBox29.Margin = new Padding(6, 8, 6, 8); TextBox29.Multiline = true; TextBox29.Name = "TextBox29"; - TextBox29.Size = new Size(543, 66); + TextBox29.Size = new Size(880, 103); TextBox29.TabIndex = 39; // // TextBox18 // - TextBox18.Location = new Point(309, 240); - TextBox18.Margin = new Padding(4, 5, 4, 5); + TextBox18.Location = new Point(502, 384); + TextBox18.Margin = new Padding(6, 8, 6, 8); TextBox18.Name = "TextBox18"; - TextBox18.Size = new Size(132, 27); + TextBox18.Size = new Size(212, 39); TextBox18.TabIndex = 38; // // Label26 // Label26.AutoSize = true; Label26.ForeColor = Color.Black; - Label26.Location = new Point(459, 240); - Label26.Margin = new Padding(4, 0, 4, 0); + Label26.Location = new Point(746, 384); + Label26.Margin = new Padding(6, 0, 6, 0); Label26.Name = "Label26"; - Label26.Size = new Size(67, 20); + Label26.Size = new Size(106, 32); Label26.TabIndex = 37; Label26.Text = "partenza"; // // DateTimePicker1 // DateTimePicker1.Format = DateTimePickerFormat.Time; - DateTimePicker1.Location = new Point(523, 240); - DateTimePicker1.Margin = new Padding(4, 5, 4, 5); + DateTimePicker1.Location = new Point(850, 384); + DateTimePicker1.Margin = new Padding(6, 8, 6, 8); DateTimePicker1.Name = "DateTimePicker1"; - DateTimePicker1.Size = new Size(116, 27); + DateTimePicker1.Size = new Size(186, 39); DateTimePicker1.TabIndex = 36; // // CheckBox8 // CheckBox8.ForeColor = Color.Black; - CheckBox8.Location = new Point(96, 240); - CheckBox8.Margin = new Padding(4, 5, 4, 5); + CheckBox8.Location = new Point(156, 384); + CheckBox8.Margin = new Padding(6, 8, 6, 8); CheckBox8.Name = "CheckBox8"; - CheckBox8.Size = new Size(75, 25); + CheckBox8.Size = new Size(122, 40); CheckBox8.TabIndex = 35; CheckBox8.Text = "Orario"; // // TextBox9 // - TextBox9.Location = new Point(160, 166); - TextBox9.Margin = new Padding(4, 5, 4, 5); + TextBox9.Location = new Point(260, 266); + TextBox9.Margin = new Padding(6, 8, 6, 8); TextBox9.Name = "TextBox9"; - TextBox9.Size = new Size(73, 27); + TextBox9.Size = new Size(116, 39); TextBox9.TabIndex = 20; TextBox9.Text = "TextBox9"; // // CheckBox7 // CheckBox7.ForeColor = Color.Black; - CheckBox7.Location = new Point(181, 240); - CheckBox7.Margin = new Padding(4, 5, 4, 5); + CheckBox7.Location = new Point(294, 384); + CheckBox7.Margin = new Padding(6, 8, 6, 8); CheckBox7.Name = "CheckBox7"; - CheckBox7.Size = new Size(117, 25); + CheckBox7.Size = new Size(190, 40); CheckBox7.TabIndex = 34; CheckBox7.Text = "Tempo gara"; // @@ -984,31 +986,30 @@ namespace ImageCatalog // Label4.AutoSize = true; Label4.ForeColor = Color.Black; - Label4.Location = new Point(11, 37); - Label4.Margin = new Padding(4, 0, 4, 0); + Label4.Location = new Point(18, 59); + Label4.Margin = new Padding(6, 0, 6, 0); Label4.Name = "Label4"; - Label4.Size = new Size(85, 20); + Label4.Size = new Size(135, 32); Label4.TabIndex = 9; Label4.Text = "Orizzontale"; // // TextBox4 // TextBox4.DataBindings.Add(new Binding("Text", bindingSource1, "HorizontalText", true, DataSourceUpdateMode.OnPropertyChanged)); - TextBox4.Location = new Point(96, 37); - TextBox4.Margin = new Padding(4, 5, 4, 5); + TextBox4.Location = new Point(156, 59); + TextBox4.Margin = new Padding(6, 8, 6, 8); TextBox4.Name = "TextBox4"; - TextBox4.Size = new Size(543, 27); + TextBox4.Size = new Size(880, 39); TextBox4.TabIndex = 8; - TextBox4.Text = ""; // // Label9 // Label9.AutoSize = true; Label9.ForeColor = Color.Black; - Label9.Location = new Point(11, 166); - Label9.Margin = new Padding(4, 0, 4, 0); + Label9.Location = new Point(18, 266); + Label9.Margin = new Padding(6, 0, 6, 0); Label9.Name = "Label9"; - Label9.Size = new Size(152, 20); + Label9.Size = new Size(242, 32); Label9.TabIndex = 19; Label9.Text = "Trasparenza (0-100%)"; // @@ -1016,28 +1017,28 @@ namespace ImageCatalog // Label13.AutoSize = true; Label13.ForeColor = Color.Black; - Label13.Location = new Point(21, 203); - Label13.Margin = new Padding(4, 0, 4, 0); + Label13.Location = new Point(34, 325); + Label13.Margin = new Padding(6, 0, 6, 0); Label13.Name = "Label13"; - Label13.Size = new Size(71, 20); + Label13.Size = new Size(114, 32); Label13.TabIndex = 29; Label13.Text = "Posizione"; // // ComboBox1 // - ComboBox1.Location = new Point(96, 203); - ComboBox1.Margin = new Padding(4, 5, 4, 5); + ComboBox1.Location = new Point(156, 325); + ComboBox1.Margin = new Padding(6, 8, 6, 8); ComboBox1.Name = "ComboBox1"; - ComboBox1.Size = new Size(137, 28); + ComboBox1.Size = new Size(220, 40); ComboBox1.TabIndex = 28; ComboBox1.Text = "ComboBox1"; // // ComboBox2 // - ComboBox2.Location = new Point(501, 203); - ComboBox2.Margin = new Padding(4, 5, 4, 5); + ComboBox2.Location = new Point(814, 325); + ComboBox2.Margin = new Padding(6, 8, 6, 8); ComboBox2.Name = "ComboBox2"; - ComboBox2.Size = new Size(137, 28); + ComboBox2.Size = new Size(220, 40); ComboBox2.TabIndex = 31; ComboBox2.Text = "ComboBox2"; // @@ -1045,19 +1046,19 @@ namespace ImageCatalog // Label14.AutoSize = true; Label14.ForeColor = Color.Black; - Label14.Location = new Point(405, 203); - Label14.Margin = new Padding(4, 0, 4, 0); + Label14.Location = new Point(658, 325); + Label14.Margin = new Padding(6, 0, 6, 0); Label14.Name = "Label14"; - Label14.Size = new Size(98, 20); + Label14.Size = new Size(156, 32); Label14.TabIndex = 30; Label14.Text = "Allineamento"; // // TextBox12 // - TextBox12.Location = new Point(501, 166); - TextBox12.Margin = new Padding(4, 5, 4, 5); + TextBox12.Location = new Point(814, 266); + TextBox12.Margin = new Padding(6, 8, 6, 8); TextBox12.Name = "TextBox12"; - TextBox12.Size = new Size(137, 27); + TextBox12.Size = new Size(220, 39); TextBox12.TabIndex = 33; TextBox12.Text = "TextBox12"; // @@ -1065,21 +1066,21 @@ namespace ImageCatalog // Label15.AutoSize = true; Label15.ForeColor = Color.Black; - Label15.Location = new Point(395, 166); - Label15.Margin = new Padding(4, 0, 4, 0); + Label15.Location = new Point(642, 266); + Label15.Margin = new Padding(6, 0, 6, 0); Label15.Name = "Label15"; - Label15.Size = new Size(110, 20); + Label15.Size = new Size(174, 32); Label15.TabIndex = 32; Label15.Text = "Margine (pixel)"; // // TabPage2 // TabPage2.Controls.Add(GroupBox2); - TabPage2.Location = new Point(4, 29); - TabPage2.Margin = new Padding(4, 5, 4, 5); + TabPage2.Location = new Point(8, 46); + TabPage2.Margin = new Padding(6, 8, 6, 8); TabPage2.Name = "TabPage2"; - TabPage2.Padding = new Padding(4, 5, 4, 5); - TabPage2.Size = new Size(687, 547); + TabPage2.Padding = new Padding(6, 8, 6, 8); + TabPage2.Size = new Size(1113, 874); TabPage2.TabIndex = 5; TabPage2.Text = "Foto"; TabPage2.UseVisualStyleBackColor = true; @@ -1096,11 +1097,11 @@ namespace ImageCatalog GroupBox2.Controls.Add(TextBox28); GroupBox2.Controls.Add(CheckBox15); GroupBox2.ForeColor = Color.FromArgb(0, 0, 192); - GroupBox2.Location = new Point(4, 9); - GroupBox2.Margin = new Padding(4, 5, 4, 5); + GroupBox2.Location = new Point(6, 14); + GroupBox2.Margin = new Padding(6, 8, 6, 8); GroupBox2.Name = "GroupBox2"; - GroupBox2.Padding = new Padding(4, 5, 4, 5); - GroupBox2.Size = new Size(405, 240); + GroupBox2.Padding = new Padding(6, 8, 6, 8); + GroupBox2.Size = new Size(658, 384); GroupBox2.TabIndex = 36; GroupBox2.TabStop = false; GroupBox2.Text = "Foto grande"; @@ -1108,38 +1109,38 @@ namespace ImageCatalog // Label45 // Label45.AutoSize = true; - Label45.Location = new Point(15, 132); - Label45.Margin = new Padding(4, 0, 4, 0); + Label45.Location = new Point(24, 211); + Label45.Margin = new Padding(6, 0, 6, 0); Label45.Name = "Label45"; - Label45.Size = new Size(57, 20); + Label45.Size = new Size(90, 32); Label45.TabIndex = 22; Label45.Text = "Qualità"; // // TextBox32 // - TextBox32.Location = new Point(96, 123); - TextBox32.Margin = new Padding(4, 5, 4, 5); + TextBox32.Location = new Point(156, 197); + TextBox32.Margin = new Padding(6, 8, 6, 8); TextBox32.Name = "TextBox32"; - TextBox32.Size = new Size(95, 27); + TextBox32.Size = new Size(152, 39); TextBox32.TabIndex = 21; TextBox32.Text = "100"; // // TextBox26 // - TextBox26.Location = new Point(299, 74); - TextBox26.Margin = new Padding(4, 5, 4, 5); + TextBox26.Location = new Point(486, 118); + TextBox26.Margin = new Padding(6, 8, 6, 8); TextBox26.Name = "TextBox26"; - TextBox26.Size = new Size(73, 27); + TextBox26.Size = new Size(116, 39); TextBox26.TabIndex = 20; TextBox26.Text = "TextBox26"; // // Label37 // Label37.ForeColor = Color.Black; - Label37.Location = new Point(224, 74); - Label37.Margin = new Padding(4, 0, 4, 0); + Label37.Location = new Point(364, 118); + Label37.Margin = new Padding(6, 0, 6, 0); Label37.Name = "Label37"; - Label37.Size = new Size(64, 25); + Label37.Size = new Size(104, 40); Label37.TabIndex = 19; Label37.Text = "Suffisso"; Label37.TextAlign = ContentAlignment.MiddleRight; @@ -1148,19 +1149,19 @@ namespace ImageCatalog // Label38.AutoSize = true; Label38.ForeColor = Color.Black; - Label38.Location = new Point(32, 37); - Label38.Margin = new Padding(4, 0, 4, 0); + Label38.Location = new Point(52, 59); + Label38.Margin = new Padding(6, 0, 6, 0); Label38.Name = "Label38"; - Label38.Size = new Size(58, 20); + Label38.Size = new Size(90, 32); Label38.TabIndex = 16; Label38.Text = "Altezza"; // // TextBox27 // - TextBox27.Location = new Point(96, 37); - TextBox27.Margin = new Padding(4, 5, 4, 5); + TextBox27.Location = new Point(156, 59); + TextBox27.Margin = new Padding(6, 8, 6, 8); TextBox27.Name = "TextBox27"; - TextBox27.Size = new Size(95, 27); + TextBox27.Size = new Size(152, 39); TextBox27.TabIndex = 14; TextBox27.Text = "TextBox27"; // @@ -1168,19 +1169,19 @@ namespace ImageCatalog // Label39.AutoSize = true; Label39.ForeColor = Color.Black; - Label39.Location = new Point(11, 74); - Label39.Margin = new Padding(4, 0, 4, 0); + Label39.Location = new Point(18, 118); + Label39.Margin = new Padding(6, 0, 6, 0); Label39.Name = "Label39"; - Label39.Size = new Size(76, 20); + Label39.Size = new Size(120, 32); Label39.TabIndex = 17; Label39.Text = "Larghezza"; // // TextBox28 // - TextBox28.Location = new Point(96, 74); - TextBox28.Margin = new Padding(4, 5, 4, 5); + TextBox28.Location = new Point(156, 118); + TextBox28.Margin = new Padding(6, 8, 6, 8); TextBox28.Name = "TextBox28"; - TextBox28.Size = new Size(95, 27); + TextBox28.Size = new Size(152, 39); TextBox28.TabIndex = 15; TextBox28.Text = "TextBox28"; // @@ -1189,10 +1190,10 @@ namespace ImageCatalog CheckBox15.Checked = true; CheckBox15.CheckState = CheckState.Checked; CheckBox15.ForeColor = Color.Black; - CheckBox15.Location = new Point(224, 25); - CheckBox15.Margin = new Padding(4, 5, 4, 5); + CheckBox15.Location = new Point(364, 40); + CheckBox15.Margin = new Padding(6, 8, 6, 8); CheckBox15.Name = "CheckBox15"; - CheckBox15.Size = new Size(160, 49); + CheckBox15.Size = new Size(260, 78); CheckBox15.TabIndex = 18; CheckBox15.Text = "Mantieni dimensioni originali"; // @@ -1200,11 +1201,11 @@ namespace ImageCatalog // TabPage1.Controls.Add(Panel1); TabPage1.Controls.Add(GroupBox1); - TabPage1.Location = new Point(4, 29); - TabPage1.Margin = new Padding(4, 5, 4, 5); + TabPage1.Location = new Point(8, 46); + TabPage1.Margin = new Padding(6, 8, 6, 8); TabPage1.Name = "TabPage1"; - TabPage1.Padding = new Padding(4, 5, 4, 5); - TabPage1.Size = new Size(687, 547); + TabPage1.Padding = new Padding(6, 8, 6, 8); + TabPage1.Size = new Size(1113, 874); TabPage1.TabIndex = 0; TabPage1.Text = "Miniature"; TabPage1.UseVisualStyleBackColor = true; @@ -1214,20 +1215,20 @@ namespace ImageCatalog Panel1.Controls.Add(_CheckBox18); Panel1.Controls.Add(_CheckBox4); Panel1.Controls.Add(_CheckBox12); - Panel1.Location = new Point(69, 363); - Panel1.Margin = new Padding(4, 5, 4, 5); + Panel1.Location = new Point(112, 581); + Panel1.Margin = new Padding(6, 8, 6, 8); Panel1.Name = "Panel1"; - Panel1.Size = new Size(405, 112); + Panel1.Size = new Size(658, 179); Panel1.TabIndex = 26; Panel1.Visible = false; // // _CheckBox18 // _CheckBox18.AutoSize = true; - _CheckBox18.Location = new Point(187, 5); - _CheckBox18.Margin = new Padding(4, 5, 4, 5); + _CheckBox18.Location = new Point(304, 8); + _CheckBox18.Margin = new Padding(6, 8, 6, 8); _CheckBox18.Name = "_CheckBox18"; - _CheckBox18.Size = new Size(117, 24); + _CheckBox18.Size = new Size(185, 36); _CheckBox18.TabIndex = 36; _CheckBox18.Text = "Numero foto"; _CheckBox18.UseVisualStyleBackColor = true; @@ -1236,10 +1237,10 @@ namespace ImageCatalog // _CheckBox4 // _CheckBox4.ForeColor = Color.Black; - _CheckBox4.Location = new Point(13, 5); - _CheckBox4.Margin = new Padding(4, 5, 4, 5); + _CheckBox4.Location = new Point(21, 8); + _CheckBox4.Margin = new Padding(6, 8, 6, 8); _CheckBox4.Name = "_CheckBox4"; - _CheckBox4.Size = new Size(139, 26); + _CheckBox4.Size = new Size(226, 42); _CheckBox4.TabIndex = 34; _CheckBox4.Text = "Aggiungi scritta"; _CheckBox4.CheckedChanged += CheckBox4_CheckedChanged; @@ -1247,10 +1248,10 @@ namespace ImageCatalog // _CheckBox12 // _CheckBox12.ForeColor = Color.Black; - _CheckBox12.Location = new Point(13, 29); - _CheckBox12.Margin = new Padding(4, 5, 4, 5); + _CheckBox12.Location = new Point(21, 46); + _CheckBox12.Margin = new Padding(6, 8, 6, 8); _CheckBox12.Name = "_CheckBox12"; - _CheckBox12.Size = new Size(139, 32); + _CheckBox12.Size = new Size(226, 51); _CheckBox12.TabIndex = 35; _CheckBox12.Text = "Aggiungi orario"; _CheckBox12.CheckedChanged += CheckBox12_CheckedChanged; @@ -1268,11 +1269,11 @@ namespace ImageCatalog GroupBox1.Controls.Add(TextBox3); GroupBox1.Controls.Add(CheckBox1); GroupBox1.ForeColor = Color.FromArgb(0, 0, 192); - GroupBox1.Location = new Point(8, 8); - GroupBox1.Margin = new Padding(4, 5, 4, 5); + GroupBox1.Location = new Point(13, 13); + GroupBox1.Margin = new Padding(6, 8, 6, 8); GroupBox1.Name = "GroupBox1"; - GroupBox1.Padding = new Padding(4, 5, 4, 5); - GroupBox1.Size = new Size(467, 323); + GroupBox1.Padding = new Padding(6, 8, 6, 8); + GroupBox1.Size = new Size(759, 517); GroupBox1.TabIndex = 25; GroupBox1.TabStop = false; GroupBox1.Text = "Miniature"; @@ -1280,19 +1281,19 @@ namespace ImageCatalog // Label46 // Label46.AutoSize = true; - Label46.Location = new Point(264, 66); - Label46.Margin = new Padding(4, 0, 4, 0); + Label46.Location = new Point(429, 106); + Label46.Margin = new Padding(6, 0, 6, 0); Label46.Name = "Label46"; - Label46.Size = new Size(57, 20); + Label46.Size = new Size(90, 32); Label46.TabIndex = 21; Label46.Text = "Qualità"; // // TextBox33 // - TextBox33.Location = new Point(325, 62); - TextBox33.Margin = new Padding(4, 5, 4, 5); + TextBox33.Location = new Point(528, 99); + TextBox33.Margin = new Padding(6, 8, 6, 8); TextBox33.Name = "TextBox33"; - TextBox33.Size = new Size(132, 27); + TextBox33.Size = new Size(212, 39); TextBox33.TabIndex = 20; // // Panel2 @@ -1302,19 +1303,19 @@ namespace ImageCatalog Panel2.Controls.Add(RadioButton4); Panel2.Controls.Add(RadioButton6); Panel2.Controls.Add(RadioButton5); - Panel2.Location = new Point(75, 175); - Panel2.Margin = new Padding(4, 5, 4, 5); + Panel2.Location = new Point(122, 280); + Panel2.Margin = new Padding(6, 8, 6, 8); Panel2.Name = "Panel2"; - Panel2.Size = new Size(313, 138); + Panel2.Size = new Size(509, 221); Panel2.TabIndex = 19; // // RadioButton3 // RadioButton3.AutoSize = true; - RadioButton3.Location = new Point(20, 25); - RadioButton3.Margin = new Padding(4, 5, 4, 5); + RadioButton3.Location = new Point(32, 40); + RadioButton3.Margin = new Padding(6, 8, 6, 8); RadioButton3.Name = "RadioButton3"; - RadioButton3.Size = new Size(137, 24); + RadioButton3.Size = new Size(215, 36); RadioButton3.TabIndex = 14; RadioButton3.TabStop = true; RadioButton3.Text = "Aggiungi Scritta"; @@ -1323,10 +1324,10 @@ namespace ImageCatalog // RadioButton7 // RadioButton7.AutoSize = true; - RadioButton7.Location = new Point(172, 62); - RadioButton7.Margin = new Padding(4, 5, 4, 5); + RadioButton7.Location = new Point(280, 99); + RadioButton7.Margin = new Padding(6, 8, 6, 8); RadioButton7.Name = "RadioButton7"; - RadioButton7.Size = new Size(135, 24); + RadioButton7.Size = new Size(215, 36); RadioButton7.TabIndex = 18; RadioButton7.TabStop = true; RadioButton7.Text = "numero+tempo"; @@ -1335,10 +1336,10 @@ namespace ImageCatalog // RadioButton4 // RadioButton4.AutoSize = true; - RadioButton4.Location = new Point(20, 62); - RadioButton4.Margin = new Padding(4, 5, 4, 5); + RadioButton4.Location = new Point(32, 99); + RadioButton4.Margin = new Padding(6, 8, 6, 8); RadioButton4.Name = "RadioButton4"; - RadioButton4.Size = new Size(135, 24); + RadioButton4.Size = new Size(211, 36); RadioButton4.TabIndex = 15; RadioButton4.TabStop = true; RadioButton4.Text = "Aggiungi orario"; @@ -1347,10 +1348,10 @@ namespace ImageCatalog // RadioButton6 // RadioButton6.AutoSize = true; - RadioButton6.Location = new Point(172, 25); - RadioButton6.Margin = new Padding(4, 5, 4, 5); + RadioButton6.Location = new Point(280, 40); + RadioButton6.Margin = new Padding(6, 8, 6, 8); RadioButton6.Name = "RadioButton6"; - RadioButton6.Size = new Size(116, 24); + RadioButton6.Size = new Size(184, 36); RadioButton6.TabIndex = 17; RadioButton6.TabStop = true; RadioButton6.Text = "Numero foto"; @@ -1359,10 +1360,10 @@ namespace ImageCatalog // RadioButton5 // RadioButton5.AutoSize = true; - RadioButton5.Location = new Point(20, 100); - RadioButton5.Margin = new Padding(4, 5, 4, 5); + RadioButton5.Location = new Point(32, 160); + RadioButton5.Margin = new Padding(6, 8, 6, 8); RadioButton5.Name = "RadioButton5"; - RadioButton5.Size = new Size(111, 24); + RadioButton5.Size = new Size(173, 36); RadioButton5.TabIndex = 16; RadioButton5.TabStop = true; RadioButton5.Text = "Tempo Gara"; @@ -1372,19 +1373,19 @@ namespace ImageCatalog // Label5.AutoSize = true; Label5.ForeColor = Color.Black; - Label5.Location = new Point(32, 135); - Label5.Margin = new Padding(4, 0, 4, 0); + Label5.Location = new Point(52, 216); + Label5.Margin = new Padding(6, 0, 6, 0); Label5.Name = "Label5"; - Label5.Size = new Size(58, 20); + Label5.Size = new Size(90, 32); Label5.TabIndex = 12; Label5.Text = "Altezza"; // // TextBox5 // - TextBox5.Location = new Point(96, 98); - TextBox5.Margin = new Padding(4, 5, 4, 5); + TextBox5.Location = new Point(156, 157); + TextBox5.Margin = new Padding(6, 8, 6, 8); TextBox5.Name = "TextBox5"; - TextBox5.Size = new Size(116, 27); + TextBox5.Size = new Size(186, 39); TextBox5.TabIndex = 10; TextBox5.Text = "TextBox5"; // @@ -1392,19 +1393,19 @@ namespace ImageCatalog // Label6.AutoSize = true; Label6.ForeColor = Color.Black; - Label6.Location = new Point(11, 98); - Label6.Margin = new Padding(4, 0, 4, 0); + Label6.Location = new Point(18, 157); + Label6.Margin = new Padding(6, 0, 6, 0); Label6.Name = "Label6"; - Label6.Size = new Size(76, 20); + Label6.Size = new Size(120, 32); Label6.TabIndex = 13; Label6.Text = "Larghezza"; // // TextBox6 // - TextBox6.Location = new Point(96, 135); - TextBox6.Margin = new Padding(4, 5, 4, 5); + TextBox6.Location = new Point(156, 216); + TextBox6.Margin = new Padding(6, 8, 6, 8); TextBox6.Name = "TextBox6"; - TextBox6.Size = new Size(116, 27); + TextBox6.Size = new Size(186, 39); TextBox6.TabIndex = 11; TextBox6.Text = "TextBox6"; // @@ -1412,40 +1413,40 @@ namespace ImageCatalog // Label3.AutoSize = true; Label3.ForeColor = Color.Black; - Label3.Location = new Point(32, 62); - Label3.Margin = new Padding(4, 0, 4, 0); + Label3.Location = new Point(52, 99); + Label3.Margin = new Padding(6, 0, 6, 0); Label3.Name = "Label3"; - Label3.Size = new Size(60, 20); + Label3.Size = new Size(97, 32); Label3.TabIndex = 7; Label3.Text = "Suffisso"; // // TextBox3 // - TextBox3.Location = new Point(96, 62); - TextBox3.Margin = new Padding(4, 5, 4, 5); + TextBox3.Location = new Point(156, 99); + TextBox3.Margin = new Padding(6, 8, 6, 8); TextBox3.Name = "TextBox3"; - TextBox3.Size = new Size(116, 27); + TextBox3.Size = new Size(186, 39); TextBox3.TabIndex = 6; TextBox3.Text = "TextBox3"; // // CheckBox1 // CheckBox1.ForeColor = Color.Black; - CheckBox1.Location = new Point(96, 25); - CheckBox1.Margin = new Padding(4, 5, 4, 5); + CheckBox1.Location = new Point(156, 40); + CheckBox1.Margin = new Padding(6, 8, 6, 8); CheckBox1.Name = "CheckBox1"; - CheckBox1.Size = new Size(139, 37); + CheckBox1.Size = new Size(226, 59); CheckBox1.TabIndex = 5; CheckBox1.Text = "Crea miniature"; // // TabPage4 // TabPage4.Controls.Add(GroupBox6); - TabPage4.Location = new Point(4, 29); - TabPage4.Margin = new Padding(4, 5, 4, 5); + TabPage4.Location = new Point(8, 46); + TabPage4.Margin = new Padding(6, 8, 6, 8); TabPage4.Name = "TabPage4"; - TabPage4.Padding = new Padding(4, 5, 4, 5); - TabPage4.Size = new Size(687, 547); + TabPage4.Padding = new Padding(6, 8, 6, 8); + TabPage4.Size = new Size(1113, 874); TabPage4.TabIndex = 3; TabPage4.Text = "Logo"; TabPage4.UseVisualStyleBackColor = true; @@ -1472,11 +1473,11 @@ namespace ImageCatalog GroupBox6.Controls.Add(Label30); GroupBox6.Controls.Add(PictureBox3); GroupBox6.ForeColor = Color.FromArgb(0, 0, 192); - GroupBox6.Location = new Point(8, 9); - GroupBox6.Margin = new Padding(4, 5, 4, 5); + GroupBox6.Location = new Point(13, 14); + GroupBox6.Margin = new Padding(6, 8, 6, 8); GroupBox6.Name = "GroupBox6"; - GroupBox6.Padding = new Padding(4, 5, 4, 5); - GroupBox6.Size = new Size(661, 345); + GroupBox6.Padding = new Padding(6, 8, 6, 8); + GroupBox6.Size = new Size(1074, 552); GroupBox6.TabIndex = 42; GroupBox6.TabStop = false; GroupBox6.Text = "Logo"; @@ -1484,10 +1485,10 @@ namespace ImageCatalog // PictureBox2 // PictureBox2.BorderStyle = BorderStyle.FixedSingle; - PictureBox2.Location = new Point(192, 295); - PictureBox2.Margin = new Padding(4, 5, 4, 5); + PictureBox2.Location = new Point(312, 472); + PictureBox2.Margin = new Padding(6, 8, 6, 8); PictureBox2.Name = "PictureBox2"; - PictureBox2.Size = new Size(31, 36); + PictureBox2.Size = new Size(49, 56); PictureBox2.TabIndex = 44; PictureBox2.TabStop = false; PictureBox2.Visible = false; @@ -1495,10 +1496,10 @@ namespace ImageCatalog // _PictureBox1 // _PictureBox1.Cursor = Cursors.Cross; - _PictureBox1.Location = new Point(341, 86); - _PictureBox1.Margin = new Padding(4, 5, 4, 5); + _PictureBox1.Location = new Point(554, 138); + _PictureBox1.Margin = new Padding(6, 8, 6, 8); _PictureBox1.Name = "_PictureBox1"; - _PictureBox1.Size = new Size(299, 246); + _PictureBox1.Size = new Size(486, 394); _PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; _PictureBox1.TabIndex = 43; _PictureBox1.TabStop = false; @@ -1507,38 +1508,38 @@ namespace ImageCatalog // // ComboBox5 // - ComboBox5.Location = new Point(192, 258); - ComboBox5.Margin = new Padding(4, 5, 4, 5); + ComboBox5.Location = new Point(312, 413); + ComboBox5.Margin = new Padding(6, 8, 6, 8); ComboBox5.Name = "ComboBox5"; - ComboBox5.Size = new Size(127, 28); + ComboBox5.Size = new Size(204, 40); ComboBox5.TabIndex = 42; ComboBox5.Text = "ComboBox5"; // // ComboBox4 // - ComboBox4.Location = new Point(192, 222); - ComboBox4.Margin = new Padding(4, 5, 4, 5); + ComboBox4.Location = new Point(312, 355); + ComboBox4.Margin = new Padding(6, 8, 6, 8); ComboBox4.Name = "ComboBox4"; - ComboBox4.Size = new Size(127, 28); + ComboBox4.Size = new Size(204, 40); ComboBox4.TabIndex = 41; ComboBox4.Text = "ComboBox4"; // // TextBox19 // - TextBox19.Location = new Point(192, 148); - TextBox19.Margin = new Padding(4, 5, 4, 5); + TextBox19.Location = new Point(312, 237); + TextBox19.Margin = new Padding(6, 8, 6, 8); TextBox19.Name = "TextBox19"; - TextBox19.Size = new Size(127, 27); + TextBox19.Size = new Size(204, 39); TextBox19.TabIndex = 40; TextBox19.Text = "TextBox19"; // // Label28 // Label28.ForeColor = Color.Black; - Label28.Location = new Point(23, 149); - Label28.Margin = new Padding(4, 0, 4, 0); + Label28.Location = new Point(37, 238); + Label28.Margin = new Padding(6, 0, 6, 0); Label28.Name = "Label28"; - Label28.Size = new Size(160, 25); + Label28.Size = new Size(260, 40); Label28.TabIndex = 39; Label28.Text = "Trasparenza (0-100%)"; Label28.TextAlign = ContentAlignment.MiddleLeft; @@ -1546,28 +1547,28 @@ namespace ImageCatalog // CheckBox5 // CheckBox5.ForeColor = Color.Black; - CheckBox5.Location = new Point(0, 40); - CheckBox5.Margin = new Padding(4, 5, 4, 5); + CheckBox5.Location = new Point(0, 64); + CheckBox5.Margin = new Padding(6, 8, 6, 8); CheckBox5.Name = "CheckBox5"; - CheckBox5.Size = new Size(96, 31); + CheckBox5.Size = new Size(156, 50); CheckBox5.TabIndex = 38; CheckBox5.Text = "Aggiungi"; // // TextBox15 // - TextBox15.Location = new Point(192, 111); - TextBox15.Margin = new Padding(4, 5, 4, 5); + TextBox15.Location = new Point(312, 178); + TextBox15.Margin = new Padding(6, 8, 6, 8); TextBox15.Name = "TextBox15"; - TextBox15.Size = new Size(127, 27); + TextBox15.Size = new Size(204, 39); TextBox15.TabIndex = 19; TextBox15.Text = "TextBox15"; // // TextBox14 // - TextBox14.Location = new Point(192, 74); - TextBox14.Margin = new Padding(4, 5, 4, 5); + TextBox14.Location = new Point(312, 118); + TextBox14.Margin = new Padding(6, 8, 6, 8); TextBox14.Name = "TextBox14"; - TextBox14.Size = new Size(127, 27); + TextBox14.Size = new Size(204, 39); TextBox14.TabIndex = 18; TextBox14.Text = "TextBox14"; // @@ -1575,20 +1576,20 @@ namespace ImageCatalog // Label25.AutoSize = true; Label25.ForeColor = Color.Black; - Label25.Location = new Point(23, 258); - Label25.Margin = new Padding(4, 0, 4, 0); + Label25.Location = new Point(37, 413); + Label25.Margin = new Padding(6, 0, 6, 0); Label25.Name = "Label25"; - Label25.Size = new Size(131, 20); + Label25.Size = new Size(210, 32); Label25.TabIndex = 36; Label25.Text = "Posizione verticale"; Label25.TextAlign = ContentAlignment.MiddleLeft; // // TextBox16 // - TextBox16.Location = new Point(192, 185); - TextBox16.Margin = new Padding(4, 5, 4, 5); + TextBox16.Location = new Point(312, 296); + TextBox16.Margin = new Padding(6, 8, 6, 8); TextBox16.Name = "TextBox16"; - TextBox16.Size = new Size(127, 27); + TextBox16.Size = new Size(204, 39); TextBox16.TabIndex = 35; TextBox16.Text = "TextBox16"; // @@ -1596,10 +1597,10 @@ namespace ImageCatalog // Label24.AutoSize = true; Label24.ForeColor = Color.Black; - Label24.Location = new Point(25, 189); - Label24.Margin = new Padding(4, 0, 4, 0); + Label24.Location = new Point(41, 302); + Label24.Margin = new Padding(6, 0, 6, 0); Label24.Name = "Label24"; - Label24.Size = new Size(128, 20); + Label24.Size = new Size(203, 32); Label24.TabIndex = 34; Label24.Text = "Margine (pixel/%)"; Label24.TextAlign = ContentAlignment.MiddleLeft; @@ -1608,10 +1609,10 @@ namespace ImageCatalog // Label22.AutoSize = true; Label22.ForeColor = Color.Black; - Label22.Location = new Point(25, 78); - Label22.Margin = new Padding(4, 0, 4, 0); + Label22.Location = new Point(41, 125); + Label22.Margin = new Padding(6, 0, 6, 0); Label22.Name = "Label22"; - Label22.Size = new Size(58, 20); + Label22.Size = new Size(90, 32); Label22.TabIndex = 20; Label22.Text = "Altezza"; Label22.TextAlign = ContentAlignment.MiddleLeft; @@ -1620,30 +1621,30 @@ namespace ImageCatalog // Label23.AutoSize = true; Label23.ForeColor = Color.Black; - Label23.Location = new Point(25, 115); - Label23.Margin = new Padding(4, 0, 4, 0); + Label23.Location = new Point(41, 184); + Label23.Margin = new Padding(6, 0, 6, 0); Label23.Name = "Label23"; - Label23.Size = new Size(76, 20); + Label23.Size = new Size(120, 32); Label23.TabIndex = 21; Label23.Text = "Larghezza"; Label23.TextAlign = ContentAlignment.MiddleLeft; // // _Button4 // - _Button4.Location = new Point(619, 37); - _Button4.Margin = new Padding(4, 5, 4, 5); + _Button4.Location = new Point(1006, 59); + _Button4.Margin = new Padding(6, 8, 6, 8); _Button4.Name = "_Button4"; - _Button4.Size = new Size(32, 31); + _Button4.Size = new Size(52, 50); _Button4.TabIndex = 8; _Button4.Text = "..."; _Button4.Click += Button4_Click; // // TextBox10 // - TextBox10.Location = new Point(192, 37); - TextBox10.Margin = new Padding(4, 5, 4, 5); + TextBox10.Location = new Point(312, 59); + TextBox10.Margin = new Padding(6, 8, 6, 8); TextBox10.Name = "TextBox10"; - TextBox10.Size = new Size(415, 27); + TextBox10.Size = new Size(672, 39); TextBox10.TabIndex = 6; TextBox10.Text = "TextBox10"; // @@ -1651,10 +1652,10 @@ namespace ImageCatalog // Label29.AutoSize = true; Label29.ForeColor = Color.Black; - Label29.Location = new Point(23, 226); - Label29.Margin = new Padding(4, 0, 4, 0); + Label29.Location = new Point(37, 362); + Label29.Margin = new Padding(6, 0, 6, 0); Label29.Name = "Label29"; - Label29.Size = new Size(149, 20); + Label29.Size = new Size(238, 32); Label29.TabIndex = 36; Label29.Text = "Posizione orizzontale"; Label29.TextAlign = ContentAlignment.MiddleLeft; @@ -1663,10 +1664,10 @@ namespace ImageCatalog // Label30.AutoSize = true; Label30.ForeColor = Color.Black; - Label30.Location = new Point(25, 312); - Label30.Margin = new Padding(4, 0, 4, 0); + Label30.Location = new Point(41, 499); + Label30.Margin = new Padding(6, 0, 6, 0); Label30.Name = "Label30"; - Label30.Size = new Size(132, 20); + Label30.Size = new Size(211, 32); Label30.TabIndex = 36; Label30.Text = "Colore trasparente"; Label30.TextAlign = ContentAlignment.MiddleLeft; @@ -1675,20 +1676,20 @@ namespace ImageCatalog // PictureBox3 // PictureBox3.BorderStyle = BorderStyle.FixedSingle; - PictureBox3.Location = new Point(288, 295); - PictureBox3.Margin = new Padding(4, 5, 4, 5); + PictureBox3.Location = new Point(468, 472); + PictureBox3.Margin = new Padding(6, 8, 6, 8); PictureBox3.Name = "PictureBox3"; - PictureBox3.Size = new Size(31, 36); + PictureBox3.Size = new Size(49, 56); PictureBox3.TabIndex = 44; PictureBox3.TabStop = false; PictureBox3.Visible = false; // // _Label27 // - _Label27.Location = new Point(788, 582); - _Label27.Margin = new Padding(4, 0, 4, 0); + _Label27.Location = new Point(1280, 931); + _Label27.Margin = new Padding(6, 0, 6, 0); _Label27.Name = "_Label27"; - _Label27.Size = new Size(187, 31); + _Label27.Size = new Size(304, 50); _Label27.TabIndex = 62; _Label27.Text = "Versione 2.2 2021"; _Label27.TextAlign = ContentAlignment.MiddleRight; @@ -1696,11 +1697,12 @@ namespace ImageCatalog // // _Button7 // + _Button7.DataBindings.Add(new Binding("Enabled", bindingSource1, "UiDisabled", true, DataSourceUpdateMode.OnPropertyChanged)); _Button7.Font = new Font("Microsoft Sans Serif", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 0); - _Button7.Location = new Point(719, 185); - _Button7.Margin = new Padding(4, 5, 4, 5); + _Button7.Location = new Point(1168, 296); + _Button7.Margin = new Padding(6, 8, 6, 8); _Button7.Name = "_Button7"; - _Button7.Size = new Size(256, 62); + _Button7.Size = new Size(416, 99); _Button7.TabIndex = 61; _Button7.Text = "stop creazione"; _Button7.Click += Button7_Click; @@ -1709,10 +1711,10 @@ namespace ImageCatalog // _Button5.DataBindings.Add(new Binding("Enabled", bindingSource1, "UiEnabled", true)); _Button5.Font = new Font("Microsoft Sans Serif", 11F, FontStyle.Bold, GraphicsUnit.Point, 0); - _Button5.Location = new Point(719, 66); - _Button5.Margin = new Padding(4, 5, 4, 5); + _Button5.Location = new Point(1168, 101); + _Button5.Margin = new Padding(6, 8, 6, 8); _Button5.Name = "_Button5"; - _Button5.Size = new Size(256, 49); + _Button5.Size = new Size(416, 78); _Button5.TabIndex = 60; _Button5.Text = "Salva impostazioni"; _Button5.Click += Button5_Click; @@ -1721,10 +1723,10 @@ namespace ImageCatalog // Label20.AutoSize = true; Label20.Font = new Font("Microsoft Sans Serif", 9.75F, FontStyle.Bold, GraphicsUnit.Point, 0); - Label20.Location = new Point(719, 452); - Label20.Margin = new Padding(4, 0, 4, 0); + Label20.Location = new Point(1168, 723); + Label20.Margin = new Padding(6, 0, 6, 0); Label20.Name = "Label20"; - Label20.Size = new Size(126, 20); + Label20.Size = new Size(183, 30); Label20.TabIndex = 59; Label20.Text = "foto generate:"; // @@ -1732,10 +1734,10 @@ namespace ImageCatalog // Label19.AutoSize = true; Label19.Font = new Font("Microsoft Sans Serif", 9.75F, FontStyle.Bold, GraphicsUnit.Point, 0); - Label19.Location = new Point(719, 423); - Label19.Margin = new Padding(4, 0, 4, 0); + Label19.Location = new Point(1168, 677); + Label19.Margin = new Padding(6, 0, 6, 0); Label19.Name = "Label19"; - Label19.Size = new Size(101, 20); + Label19.Size = new Size(143, 30); Label19.TabIndex = 58; Label19.Text = "foto totali: "; // @@ -1743,10 +1745,10 @@ namespace ImageCatalog // Label18.AutoSize = true; Label18.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Bold, GraphicsUnit.Point, 0); - Label18.Location = new Point(857, 452); - Label18.Margin = new Padding(4, 0, 4, 0); + Label18.Location = new Point(1393, 723); + Label18.Margin = new Padding(6, 0, 6, 0); Label18.Name = "Label18"; - Label18.Size = new Size(24, 25); + Label18.Size = new Size(36, 37); Label18.TabIndex = 57; Label18.Text = "0"; // @@ -1754,20 +1756,20 @@ namespace ImageCatalog // lblFotoTotaliNum.AutoSize = true; lblFotoTotaliNum.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Bold, GraphicsUnit.Point, 0); - lblFotoTotaliNum.Location = new Point(857, 423); - lblFotoTotaliNum.Margin = new Padding(4, 0, 4, 0); + lblFotoTotaliNum.Location = new Point(1393, 677); + lblFotoTotaliNum.Margin = new Padding(6, 0, 6, 0); lblFotoTotaliNum.Name = "lblFotoTotaliNum"; - lblFotoTotaliNum.Size = new Size(24, 25); + lblFotoTotaliNum.Size = new Size(36, 37); lblFotoTotaliNum.TabIndex = 56; lblFotoTotaliNum.Text = "0"; // // Label10 // Label10.Font = new Font("Microsoft Sans Serif", 14.25F, FontStyle.Bold, GraphicsUnit.Point, 0); - Label10.Location = new Point(719, 251); - Label10.Margin = new Padding(4, 0, 4, 0); + Label10.Location = new Point(1168, 402); + Label10.Margin = new Padding(6, 0, 6, 0); Label10.Name = "Label10"; - Label10.Size = new Size(256, 111); + Label10.Size = new Size(416, 178); Label10.TabIndex = 55; Label10.Text = "file"; // @@ -1775,10 +1777,10 @@ namespace ImageCatalog // _Button6.DataBindings.Add(new Binding("Enabled", bindingSource1, "UiEnabled", true)); _Button6.Font = new Font("Microsoft Sans Serif", 11F, FontStyle.Bold, GraphicsUnit.Point, 0); - _Button6.Location = new Point(719, 18); - _Button6.Margin = new Padding(4, 5, 4, 5); + _Button6.Location = new Point(1168, 24); + _Button6.Margin = new Padding(6, 8, 6, 8); _Button6.Name = "_Button6"; - _Button6.Size = new Size(256, 49); + _Button6.Size = new Size(416, 78); _Button6.TabIndex = 54; _Button6.Text = "Carica impostazioni"; _Button6.Click += Button6_Click; @@ -1787,10 +1789,10 @@ namespace ImageCatalog // _btnCreaCatalogoAsync.DataBindings.Add(new Binding("Enabled", bindingSource1, "UiEnabled", true)); _btnCreaCatalogoAsync.Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Bold, GraphicsUnit.Point, 0); - _btnCreaCatalogoAsync.Location = new Point(719, 120); - _btnCreaCatalogoAsync.Margin = new Padding(4, 5, 4, 5); + _btnCreaCatalogoAsync.Location = new Point(1168, 187); + _btnCreaCatalogoAsync.Margin = new Padding(6, 8, 6, 8); _btnCreaCatalogoAsync.Name = "_btnCreaCatalogoAsync"; - _btnCreaCatalogoAsync.Size = new Size(256, 58); + _btnCreaCatalogoAsync.Size = new Size(416, 93); _btnCreaCatalogoAsync.TabIndex = 68; _btnCreaCatalogoAsync.Text = "CREA"; _btnCreaCatalogoAsync.UseVisualStyleBackColor = true; @@ -1802,9 +1804,9 @@ namespace ImageCatalog // // MainForm // - AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleDimensions = new SizeF(13F, 32F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(985, 617); + ClientSize = new Size(1601, 987); Controls.Add(_btnCreaCatalogoAsync); Controls.Add(ProgressBar1); Controls.Add(CheckBox22); @@ -1819,7 +1821,7 @@ namespace ImageCatalog Controls.Add(lblFotoTotaliNum); Controls.Add(Label10); Controls.Add(_Button6); - Margin = new Padding(4, 5, 4, 5); + Margin = new Padding(6, 8, 6, 8); MaximizeBox = false; Name = "MainForm"; Text = "Image Catalog"; diff --git a/imagecatalog/MainForm.cs b/imagecatalog/MainForm.cs index 63163af..b32189c 100644 --- a/imagecatalog/MainForm.cs +++ b/imagecatalog/MainForm.cs @@ -19,26 +19,25 @@ using Microsoft.Extensions.Logging; namespace ImageCatalog; -public delegate void XyThreadAdd(string Info); - public partial class MainForm { private readonly DataModel Model; - + private readonly ILogger _logger; private readonly ImageCreationStuff _imageCreationService; private readonly ParametriSetup _parametriSetup; private readonly PicSettings _picSettings; - - public MainForm(DataModel model, ImageCreationStuff imageCreationStuff, PicSettings picSettings, ParametriSetup parametriSetup, ILogger logger) + + public MainForm(DataModel model, ImageCreationStuff imageCreationStuff, PicSettings picSettings, + ParametriSetup parametriSetup, ILogger logger) { Model = model; _imageCreationService = imageCreationStuff; _parametriSetup = parametriSetup; _picSettings = picSettings; - + _logger = logger; _logger.LogDebug("Start"); @@ -97,7 +96,7 @@ public partial class MainForm { if (InvokeRequired) { - SetProgressCallback d = new SetProgressCallback(SetProgress); + var d = new SetProgressCallback(SetProgress); this.Invoke(d, new object[] { target, amount, maximum }); } else @@ -121,7 +120,7 @@ public partial class MainForm // Private ContaFotoCuori As Integer // Private TaskCuori() As PicInfo - + private int ContaImmaginiThread; private int maxThreads = 15; private int minThreads = 5; @@ -206,11 +205,8 @@ public partial class MainForm bindingSource1.DataSource = Model; Application.EnableVisualStyles(); SetDefaults(); - // /* TODO ERROR: Skipped IfDirectiveTrivia */ - // AllocConsole(); - // /* TODO ERROR: Skipped EndIfDirectiveTrivia */ + _logger.LogInformation("Programma Avviato"); - //Console.WriteLine("Programma avviato"); } private void FixPaths() @@ -261,17 +257,17 @@ public partial class MainForm { long timediffH, timediffS; long timediffM; - + TimeSpan timeDiff = timeStop - timeStart; timediffM = (int)timeDiff.TotalMinutes; timediffS = (int)timeDiff.TotalSeconds; timediffH = (int)timeDiff.TotalHours; - + // timediffM = DateAndTime.DateDiff(DateInterval.Minute, timeStart, timeStop); // timediffS = DateAndTime.DateDiff(DateInterval.Second, timeStart, timeStop); // timediffH = DateAndTime.DateDiff(DateInterval.Hour, timeStart, timeStop); - + double fotoSec = numFoto / (double)timediffS; double fotoMin = numFoto / (double)timediffM; double fotoOra = numFoto / (double)timediffH; @@ -286,7 +282,7 @@ public partial class MainForm var dialog = new FolderBrowserDialog(); dialog.InitialDirectory = startingFolder; if (dialog.ShowDialog() != DialogResult.OK) return string.Empty; - + var directoryScelta = FixPath(dialog.SelectedPath); // dialog.FileName; return directoryScelta; @@ -319,7 +315,7 @@ public partial class MainForm SaveFileDlg.FilterIndex = 0; SaveFileDlg.RestoreDirectory = true; if (DialogResult.OK != SaveFileDlg.ShowDialog()) return; - + var ilNome = SaveFileDlg.FileName; _parametriSetup.NomeFileSetup = ilNome; _parametriSetup.AggiornaParametro("DirSorgente", Model.SourcePath); @@ -478,7 +474,7 @@ public partial class MainForm if (PictureBox1.Image.Height >= PictureBox1.Image.Width) { PictureBox1.Height = 160; - PictureBox1.Width = + PictureBox1.Width = (int)(160 * PictureBox1.Image.Width / (double)PictureBox1.Image.Height); } else @@ -699,7 +695,7 @@ public partial class MainForm return numerazioneType; } - + private void CopyDirectoryFile(string SourcePath, string DestPath, bool OverWrite = false) { @@ -774,8 +770,6 @@ public partial class MainForm { _logger.LogError(exception.Message); _logger.LogInformation("Ignora questo errore"); - // Console.WriteLine(exception); - // Console.WriteLine("Ignora questo errore"); } unlockUI(); @@ -911,20 +905,20 @@ public partial class MainForm _mainToken?.Dispose(); _mainToken = new CancellationTokenSource(); var token = _mainToken.Token; - + // timeStart = TimeOfDay FixPaths(); Label10.Text = "Elaborazione in corso..."; lblFotoTotaliNum.Text = "0"; Label18.Text = "0"; - Label43.Text = "-s"; + Model.SpeedCounter = "-s"; SetPicSettings(Model.SourcePath, Model.DestinationPath); ProgressBar1.Minimum = 0; ProgressBar1.Step = 1; ProgressBar1.Value = 0; // Await CreaCatalogoParallel() - + var imageCreationOptions = new ImageCreationStuff.Options { AggiornaSottodirectory = chkAggiornaSottodirectory.Checked, @@ -950,14 +944,14 @@ public partial class MainForm timer1.Interval = 1000 * 60; timer1.Enabled = true; - string time = await _imageCreationService.CreaCatalogoParallel(imageCreationOptions, _results, UiUpdateEvent, token); - Label43.Text = time; + string time = + await _imageCreationService.CreaCatalogoParallel(imageCreationOptions, _results, UiUpdateEvent, token); + Model.SpeedCounter = time; timer1.Enabled = false; } catch (OperationCanceledException operationCanceledException) { _logger.LogInformation("Operazione Cancellata"); - //Console.WriteLine("Operazione cancellata"); } finally { @@ -979,7 +973,8 @@ public partial class MainForm _previousAmount = _currentAmount; _currentAmount = _results.Count; int diff = _currentAmount - _previousAmount; - SetText(Label43, $"{diff} f/m"); + Model.SpeedCounter = $"{diff} f/m"; + //SetText(Label43, $"{diff} f/m"); } private void UpdateCounter(string text) -- 2.52.0 From 80fcaa6fd06d3b58cd002d64b48575915f40f886 Mon Sep 17 00:00:00 2001 From: Marco Date: Tue, 29 Jul 2025 11:07:49 +0200 Subject: [PATCH 032/127] Async stop --- imagecatalog/DataModel.cs | 36 +++++++++++++++++-- imagecatalog/MainForm.Designer.cs | 60 ++++++++++--------------------- imagecatalog/MainForm.cs | 50 ++++++++++++-------------- imagecatalog/MainForm.resx | 6 ++++ 4 files changed, 81 insertions(+), 71 deletions(-) diff --git a/imagecatalog/DataModel.cs b/imagecatalog/DataModel.cs index 1ee8251..97e405e 100644 --- a/imagecatalog/DataModel.cs +++ b/imagecatalog/DataModel.cs @@ -8,6 +8,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Input; +using Microsoft.Extensions.Logging; namespace ImageCatalog_2 { @@ -17,20 +18,36 @@ namespace ImageCatalog_2 public ICommand TestCommand { get; } public ICommand AsyncTestCommand { get; } + public ICommand AsyncCancelOperationCommand { get; } public ICommand ProcessImagesCommand { get; } private readonly ITestService _service; - public DataModel(ITestService testService) + private readonly ILogger _logger; + public DataModel(ITestService testService, ILogger logger) { _service = testService; + _logger = logger; TestCommand = new RelayCommand(Test); AsyncTestCommand = new AsyncCommand(TestAsync); - + AsyncCancelOperationCommand = new AsyncCommand(CancelOperation); + ProcessImagesCommand = new AsyncCommand(ProcessImages); } + private CancellationTokenSource? _mainToken; + + public CancellationTokenSource? MainToken + { + get => _mainToken; + set + { + _mainToken = value; + NotifyPropertyChanged(); + } + } + private string _sourcePath; public string SourcePath @@ -130,6 +147,21 @@ namespace ImageCatalog_2 { } + + private async Task CancelOperation() + { + try + { + await MainToken?.CancelAsync(); + + UiEnabled = true; + } + catch (Exception e) + { + _logger.LogError(e.Message, "Error canceling the token"); + _logger.LogInformation("Ignora questo errore"); + } + } } } diff --git a/imagecatalog/MainForm.Designer.cs b/imagecatalog/MainForm.Designer.cs index 4945462..f4df75c 100644 --- a/imagecatalog/MainForm.Designer.cs +++ b/imagecatalog/MainForm.Designer.cs @@ -41,11 +41,11 @@ namespace ImageCatalog ProgressBar1 = new ProgressBar(); CheckBox22 = new CheckBox(); Label43 = new Label(); + bindingSource1 = new BindingSource(components); + dataModelBindingSource = new BindingSource(components); TabControl1 = new TabControl(); TabPage5 = new TabPage(); button1 = new Button(); - bindingSource1 = new BindingSource(components); - dataModelBindingSource = new BindingSource(components); btnTest = new Button(); GroupBox11 = new GroupBox(); Panel3 = new Panel(); @@ -181,10 +181,10 @@ namespace ImageCatalog _btnCreaCatalogoAsync = new Button(); timer1 = new System.Windows.Forms.Timer(components); dataModelBindingSource1 = new BindingSource(components); - TabControl1.SuspendLayout(); - TabPage5.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)bindingSource1).BeginInit(); ((System.ComponentModel.ISupportInitialize)dataModelBindingSource).BeginInit(); + TabControl1.SuspendLayout(); + TabPage5.SuspendLayout(); GroupBox11.SuspendLayout(); Panel3.SuspendLayout(); GroupBox3.SuspendLayout(); @@ -240,6 +240,14 @@ namespace ImageCatalog Label43.Text = "000"; Label43.TextAlign = ContentAlignment.MiddleLeft; // + // bindingSource1 + // + bindingSource1.DataSource = dataModelBindingSource; + // + // dataModelBindingSource + // + dataModelBindingSource.DataSource = typeof(ImageCatalog_2.DataModel); + // // TabControl1 // TabControl1.Controls.Add(TabPage5); @@ -283,14 +291,6 @@ namespace ImageCatalog button1.Text = "Test Async"; button1.UseVisualStyleBackColor = true; // - // bindingSource1 - // - bindingSource1.DataSource = dataModelBindingSource; - // - // dataModelBindingSource - // - dataModelBindingSource.DataSource = typeof(ImageCatalog_2.DataModel); - // // btnTest // btnTest.DataBindings.Add(new Binding("Command", bindingSource1, "TestCommand", true)); @@ -1698,14 +1698,14 @@ namespace ImageCatalog // _Button7 // _Button7.DataBindings.Add(new Binding("Enabled", bindingSource1, "UiDisabled", true, DataSourceUpdateMode.OnPropertyChanged)); - _Button7.Font = new Font("Microsoft Sans Serif", 14.25F, FontStyle.Regular, GraphicsUnit.Point, 0); + _Button7.DataBindings.Add(new Binding("Command", bindingSource1, "AsyncCancelOperationCommand", true)); + _Button7.Font = new Font("Microsoft Sans Serif", 14.25F, FontStyle.Bold, GraphicsUnit.Point, 0); _Button7.Location = new Point(1168, 296); _Button7.Margin = new Padding(6, 8, 6, 8); _Button7.Name = "_Button7"; _Button7.Size = new Size(416, 99); _Button7.TabIndex = 61; - _Button7.Text = "stop creazione"; - _Button7.Click += Button7_Click; + _Button7.Text = "STOP"; // // _Button5 // @@ -1826,10 +1826,10 @@ namespace ImageCatalog Name = "MainForm"; Text = "Image Catalog"; Load += Form1_Load; - TabControl1.ResumeLayout(false); - TabPage5.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)bindingSource1).EndInit(); ((System.ComponentModel.ISupportInitialize)dataModelBindingSource).EndInit(); + TabControl1.ResumeLayout(false); + TabPage5.ResumeLayout(false); GroupBox11.ResumeLayout(false); GroupBox11.PerformLayout(); Panel3.ResumeLayout(false); @@ -2216,31 +2216,7 @@ namespace ImageCatalog } } - private Button _Button7; - - internal Button Button7 - { - [MethodImpl(MethodImplOptions.Synchronized)] - get - { - return _Button7; - } - - [MethodImpl(MethodImplOptions.Synchronized)] - set - { - if (_Button7 != null) - { - _Button7.Click -= Button7_Click; - } - - _Button7 = value; - if (_Button7 != null) - { - _Button7.Click += Button7_Click; - } - } - } + private Button _Button7; private Button _Button5; diff --git a/imagecatalog/MainForm.cs b/imagecatalog/MainForm.cs index b32189c..b51b05b 100644 --- a/imagecatalog/MainForm.cs +++ b/imagecatalog/MainForm.cs @@ -81,7 +81,7 @@ public partial class MainForm { if (InvokeRequired) { - SetTextCallback d = new SetTextCallback(SetText); + var d = new SetTextCallback(SetText); this.Invoke(d, new object[] { target, text }); } else @@ -113,9 +113,7 @@ public partial class MainForm SetText(Label10, args.Item1); SetText(lblFotoTotaliNum, args.Item2.ToString()); } - - /* TODO ERROR: Skipped DefineDirectiveTrivia */ - private bool StopAttivo; + private bool WaterSelectColor = false; // Private ContaFotoCuori As Integer @@ -758,22 +756,20 @@ public partial class MainForm return NewSize; } - private void Button7_Click(object sender, EventArgs e) - { - StopAttivo = true; - //MyPool.StopThreadPool(); - try - { - _mainToken?.Cancel(); - } - catch (Exception exception) - { - _logger.LogError(exception.Message); - _logger.LogInformation("Ignora questo errore"); - } - - unlockUI(); - } + // private void Button7_Click(object sender, EventArgs e) + // { + // try + // { + // Model.MainToken?.Cancel(); + // } + // catch (Exception exception) + // { + // _logger.LogError(exception.Message); + // _logger.LogInformation("Ignora questo errore"); + // } + // + // unlockUI(); + // } private void Button4_Click(object sender, EventArgs e) { @@ -894,7 +890,7 @@ public partial class MainForm { } - private CancellationTokenSource? _mainToken; + //private CancellationTokenSource? _mainToken; private async void Button1_Click(object sender, EventArgs e) { @@ -902,16 +898,16 @@ public partial class MainForm lockUI(); // Dim timeStart As Date // Dim timeStop As Date - _mainToken?.Dispose(); - _mainToken = new CancellationTokenSource(); - var token = _mainToken.Token; + Model.MainToken?.Dispose(); + Model.MainToken = new CancellationTokenSource(); + var token = Model.MainToken.Token; // timeStart = TimeOfDay FixPaths(); Label10.Text = "Elaborazione in corso..."; lblFotoTotaliNum.Text = "0"; Label18.Text = "0"; - Model.SpeedCounter = "-s"; + Model.SpeedCounter = "-f/m"; SetPicSettings(Model.SourcePath, Model.DestinationPath); ProgressBar1.Minimum = 0; ProgressBar1.Step = 1; @@ -955,8 +951,8 @@ public partial class MainForm } finally { - _mainToken?.Dispose(); - _mainToken = null; + Model.MainToken?.Dispose(); + Model.MainToken = null; timer1.Tick -= Timer1OnTick; } diff --git a/imagecatalog/MainForm.resx b/imagecatalog/MainForm.resx index a4e857a..8ce399a 100644 --- a/imagecatalog/MainForm.resx +++ b/imagecatalog/MainForm.resx @@ -120,6 +120,12 @@ 586, 17 + + 586, 17 + + + 120, 17 + 120, 17 -- 2.52.0 From a466efbb27dcb5556ad952846f9d7cde255d2d20 Mon Sep 17 00:00:00 2001 From: Marco Date: Tue, 29 Jul 2025 11:10:54 +0200 Subject: [PATCH 033/127] Formatting --- MaddoShared/ImageCreationStuff.cs | 20 +++++++++++--------- imagecatalog/DataModel.cs | 18 +++++++++--------- imagecatalog/MainForm.cs | 5 ++--- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/MaddoShared/ImageCreationStuff.cs b/MaddoShared/ImageCreationStuff.cs index a6e08c4..e437d23 100644 --- a/MaddoShared/ImageCreationStuff.cs +++ b/MaddoShared/ImageCreationStuff.cs @@ -15,7 +15,10 @@ using Microsoft.Extensions.Logging; namespace MaddoShared { [SuppressMessage("Interoperability", "CA1416:Validate platform compatibility")] - public class ImageCreationStuff(ILogger logger, PicSettings picSettings, ImageCreatorSharp imageCreatorService) + public class ImageCreationStuff( + ILogger logger, + PicSettings picSettings, + ImageCreatorSharp imageCreatorService) { public class Options { @@ -59,19 +62,19 @@ namespace MaddoShared // int threads = options.MaxThreads == 0 ? Environment.ProcessorCount * 2 : options.MaxThreads; int threads = options.MaxThreads; - + Bitmap logoBmp = null; // Load Logo if (picSettings.LogoAggiungi & File.Exists(picSettings.LogoNomeFile)) { logoBmp = new Bitmap(picSettings.LogoNomeFile); } - + Func processFile = async fileData => { using var logoCopy = logoBmp.Clone(new Rectangle(0, 0, logoBmp.Width, logoBmp.Height), logoBmp.PixelFormat); - + var imgState = new ImageState { WorkFile = fileData.File, @@ -79,10 +82,10 @@ namespace MaddoShared }; await imageCreatorService.CreaImmagineThread(imgState, logoCopy); - + // using var imgCreator = new ImageCreatorSharp(fileData.File, fileData.Directory, picSettings); // await imgCreator.CreaImmagineThread(fileData.File.Name, logoCopy); - + results.Add(fileData.File.Name); try @@ -118,7 +121,7 @@ namespace MaddoShared maxDegreeOfParallelism: threads, false, cancellationToken); - + chunk.Clear(); GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced, blocking: false, compacting: false); } @@ -132,7 +135,6 @@ namespace MaddoShared { logger.LogError(e, "Error in disposing the logo"); } - } private List GetFilesToProcess(Options options) @@ -171,7 +173,7 @@ namespace MaddoShared destFolderInfo.EnsureDirectoryExists(); return new FileData(fInfo, new DirectoryInfo(new FileInfo(newFilePath).DirectoryName)); - + // var destDir = new FileInfo(newFilePath).Directory!; // destDir.Create(); // Ensure exists // diff --git a/imagecatalog/DataModel.cs b/imagecatalog/DataModel.cs index 97e405e..ad06cd2 100644 --- a/imagecatalog/DataModel.cs +++ b/imagecatalog/DataModel.cs @@ -14,16 +14,16 @@ namespace ImageCatalog_2 { public class DataModel : ViewModelBase { - public ICommand TestCommand { get; } public ICommand AsyncTestCommand { get; } public ICommand AsyncCancelOperationCommand { get; } - + public ICommand ProcessImagesCommand { get; } private readonly ITestService _service; - private readonly ILogger _logger; + private readonly ILogger _logger; + public DataModel(ITestService testService, ILogger logger) { _service = testService; @@ -32,7 +32,7 @@ namespace ImageCatalog_2 TestCommand = new RelayCommand(Test); AsyncTestCommand = new AsyncCommand(TestAsync); AsyncCancelOperationCommand = new AsyncCommand(CancelOperation); - + ProcessImagesCommand = new AsyncCommand(ProcessImages); } @@ -61,6 +61,7 @@ namespace ImageCatalog_2 } private string _destinationPath; + public string DestinationPath { get => _destinationPath; @@ -82,8 +83,9 @@ namespace ImageCatalog_2 NotifyPropertyChanged(); } } - + private string _verticalText; + public string VerticalText { get => _verticalText; @@ -117,7 +119,7 @@ namespace ImageCatalog_2 NotifyPropertyChanged(); } } - + public bool UiDisabled => !_uiEnabled; private string _speedCounter = "-"; @@ -145,7 +147,6 @@ namespace ImageCatalog_2 private async Task ProcessImages() { - } private async Task CancelOperation() @@ -162,6 +163,5 @@ namespace ImageCatalog_2 _logger.LogInformation("Ignora questo errore"); } } - } -} +} \ No newline at end of file diff --git a/imagecatalog/MainForm.cs b/imagecatalog/MainForm.cs index b51b05b..8b6afbd 100644 --- a/imagecatalog/MainForm.cs +++ b/imagecatalog/MainForm.cs @@ -113,7 +113,7 @@ public partial class MainForm SetText(Label10, args.Item1); SetText(lblFotoTotaliNum, args.Item2.ToString()); } - + private bool WaterSelectColor = false; // Private ContaFotoCuori As Integer @@ -896,8 +896,7 @@ public partial class MainForm { _logger.LogInformation("Avvio elaborazione..."); lockUI(); - // Dim timeStart As Date - // Dim timeStop As Date + Model.MainToken?.Dispose(); Model.MainToken = new CancellationTokenSource(); var token = Model.MainToken.Token; -- 2.52.0 From 764a439645f53e7a938d8d9db28d9b584f8decc3 Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 19 Sep 2025 09:53:31 +0200 Subject: [PATCH 034/127] Chunks and threads in model --- imagecatalog/DataModel.cs | 24 ++ imagecatalog/MainForm.Designer.cs | 58 ++--- imagecatalog/MainForm.cs | 390 ++++++++---------------------- imagecatalog/MainForm.resx | 6 - 4 files changed, 156 insertions(+), 322 deletions(-) diff --git a/imagecatalog/DataModel.cs b/imagecatalog/DataModel.cs index ad06cd2..200f715 100644 --- a/imagecatalog/DataModel.cs +++ b/imagecatalog/DataModel.cs @@ -134,6 +134,30 @@ namespace ImageCatalog_2 } } + private int _chunkSize; + + public int ChunkSize + { + get => _chunkSize; + set + { + _chunkSize = value; + NotifyPropertyChanged(); + } + } + + private int _threadsCount; + + public int ThreadsCount + { + get => _threadsCount; + set + { + _threadsCount = value; + NotifyPropertyChanged(); + } + } + private void Test(object parameter) { Debug.WriteLine("Yep"); diff --git a/imagecatalog/MainForm.Designer.cs b/imagecatalog/MainForm.Designer.cs index f4df75c..af40a39 100644 --- a/imagecatalog/MainForm.Designer.cs +++ b/imagecatalog/MainForm.Designer.cs @@ -48,13 +48,13 @@ namespace ImageCatalog button1 = new Button(); btnTest = new Button(); GroupBox11 = new GroupBox(); + numericUpDown2 = new NumericUpDown(); + numericUpDown1 = new NumericUpDown(); Panel3 = new Panel(); rdbNuovoMetodo = new RadioButton(); rdbVecchioMetodo = new RadioButton(); Label8 = new Label(); - TextBox8 = new TextBox(); Label7 = new Label(); - TextBox7 = new TextBox(); GroupBox3 = new GroupBox(); chkAggiornaSottodirectory = new CheckBox(); _Button3 = new Button(); @@ -186,6 +186,8 @@ namespace ImageCatalog TabControl1.SuspendLayout(); TabPage5.SuspendLayout(); GroupBox11.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)numericUpDown2).BeginInit(); + ((System.ComponentModel.ISupportInitialize)numericUpDown1).BeginInit(); Panel3.SuspendLayout(); GroupBox3.SuspendLayout(); GroupBox8.SuspendLayout(); @@ -304,11 +306,11 @@ namespace ImageCatalog // // GroupBox11 // + GroupBox11.Controls.Add(numericUpDown2); + GroupBox11.Controls.Add(numericUpDown1); GroupBox11.Controls.Add(Panel3); GroupBox11.Controls.Add(Label8); - GroupBox11.Controls.Add(TextBox8); GroupBox11.Controls.Add(Label7); - GroupBox11.Controls.Add(TextBox7); GroupBox11.Location = new Point(15, 515); GroupBox11.Margin = new Padding(6, 8, 6, 8); GroupBox11.Name = "GroupBox11"; @@ -318,6 +320,24 @@ namespace ImageCatalog GroupBox11.TabStop = false; GroupBox11.Text = "Avanzate (ATTENZIONE)"; // + // numericUpDown2 + // + numericUpDown2.DataBindings.Add(new Binding("Value", bindingSource1, "ThreadsCount", true, DataSourceUpdateMode.OnPropertyChanged)); + numericUpDown2.Location = new Point(15, 118); + numericUpDown2.Maximum = new decimal(new int[] { 10000, 0, 0, 0 }); + numericUpDown2.Name = "numericUpDown2"; + numericUpDown2.Size = new Size(114, 39); + numericUpDown2.TabIndex = 52; + // + // numericUpDown1 + // + numericUpDown1.DataBindings.Add(new Binding("Value", bindingSource1, "ChunkSize", true, DataSourceUpdateMode.OnPropertyChanged)); + numericUpDown1.Location = new Point(15, 62); + numericUpDown1.Maximum = new decimal(new int[] { 10000, 0, 0, 0 }); + numericUpDown1.Name = "numericUpDown1"; + numericUpDown1.Size = new Size(114, 39); + numericUpDown1.TabIndex = 51; + // // Panel3 // Panel3.Controls.Add(rdbNuovoMetodo); @@ -362,33 +382,15 @@ namespace ImageCatalog Label8.TabIndex = 3; Label8.Text = "Chunk Size (0 = MAX)"; // - // TextBox8 - // - TextBox8.Location = new Point(15, 50); - TextBox8.Margin = new Padding(6, 8, 6, 8); - TextBox8.Name = "TextBox8"; - TextBox8.Size = new Size(97, 39); - TextBox8.TabIndex = 2; - TextBox8.Text = "0"; - // // Label7 // Label7.AutoSize = true; - Label7.Location = new Point(132, 118); + Label7.Location = new Point(138, 120); Label7.Margin = new Padding(6, 0, 6, 0); Label7.Name = "Label7"; - Label7.Size = new Size(236, 32); + Label7.Size = new Size(213, 32); Label7.TabIndex = 1; - Label7.Text = "Threads (0 = CPU *2)"; - // - // TextBox7 - // - TextBox7.Location = new Point(15, 114); - TextBox7.Margin = new Padding(6, 8, 6, 8); - TextBox7.Name = "TextBox7"; - TextBox7.Size = new Size(97, 39); - TextBox7.TabIndex = 0; - TextBox7.Text = "0"; + Label7.Text = "Threads (0 = Auto)"; // // GroupBox3 // @@ -1832,6 +1834,8 @@ namespace ImageCatalog TabPage5.ResumeLayout(false); GroupBox11.ResumeLayout(false); GroupBox11.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)numericUpDown2).EndInit(); + ((System.ComponentModel.ISupportInitialize)numericUpDown1).EndInit(); Panel3.ResumeLayout(false); Panel3.PerformLayout(); GroupBox3.ResumeLayout(false); @@ -2302,9 +2306,7 @@ namespace ImageCatalog internal GroupBox GroupBox11; internal Label Label7; - internal TextBox TextBox7; internal Label Label8; - internal TextBox TextBox8; internal Panel Panel3; internal RadioButton rdbNuovoMetodo; internal RadioButton rdbVecchioMetodo; @@ -2316,6 +2318,8 @@ namespace ImageCatalog private BindingSource bindingSource1; private Button btnTest; private Button button1; + private NumericUpDown numericUpDown1; + private NumericUpDown numericUpDown2; internal Button btnCreaCatalogoAsync { diff --git a/imagecatalog/MainForm.cs b/imagecatalog/MainForm.cs index 8b6afbd..e87edf7 100644 --- a/imagecatalog/MainForm.cs +++ b/imagecatalog/MainForm.cs @@ -64,7 +64,7 @@ public partial class MainForm var version = Assembly.GetExecutingAssembly().GetName().Version; _Label27.Text = $"Version: {version.Major}.{version.Minor}.{version.Build}.{version.Revision}"; - _results = new ConcurrentBag(); + _results = []; UiUpdateEvent += OnUiUpdateEvent; } @@ -90,7 +90,7 @@ public partial class MainForm } } - delegate void SetProgressCallback(ProgressBar target, int amount, int maximum); + private delegate void SetProgressCallback(ProgressBar target, int amount, int maximum); private void SetProgress(ProgressBar target, int amount, int maximum) { @@ -114,14 +114,7 @@ public partial class MainForm SetText(lblFotoTotaliNum, args.Item2.ToString()); } - private bool WaterSelectColor = false; - - // Private ContaFotoCuori As Integer - // Private TaskCuori() As PicInfo - - private int ContaImmaginiThread; - private int maxThreads = 15; - private int minThreads = 5; + private bool _waterSelectColor = false; private ConcurrentBag _results; @@ -150,8 +143,8 @@ public partial class MainForm txtCifreContatore.Text = "2"; TextBox25.Text = "50"; TextBox26.Text = ""; - TextBox7.Text = 4.ToString(); - TextBox8.Text = 4.ToString(); + Model.ThreadsCount = 10; + Model.ChunkSize = 100; TextBox34.Text = "Yellow"; TextBox30.Text = "20"; TextBox31.Text = "6"; @@ -378,8 +371,8 @@ public partial class MainForm _parametriSetup.AggiornaParametro("CompressioneJpeg", TextBox32.Text); _parametriSetup.AggiornaParametro("CompressioneJpegMiniatura", TextBox33.Text); // 2021 - _parametriSetup.AggiornaParametro("ChunkSize", TextBox8.Text); - _parametriSetup.AggiornaParametro("ThreadsCount", TextBox7.Text); + _parametriSetup.AggiornaParametro("ChunkSize", Model.ChunkSize.ToString()); + _parametriSetup.AggiornaParametro("ThreadsCount", Model.ThreadsCount.ToString()); _parametriSetup.AggiornaParametro("OverwriteImages", Model.OverwriteImages); _parametriSetup.SalvaParametriSetup(); Text = "Image Catalog - " + LeggiSoloNomeFile(ilNome); @@ -393,102 +386,102 @@ public partial class MainForm openFileDialog.Filter = "Setup (*.xml)|*.xml|All valid files (*.*)|*.*"; openFileDialog.FilterIndex = 0; openFileDialog.RestoreDirectory = true; - if (DialogResult.OK == openFileDialog.ShowDialog()) + + if (DialogResult.OK != openFileDialog.ShowDialog()) return; + + var ilNome = openFileDialog.FileName; + _parametriSetup.NomeFileSetup = ilNome; + _parametriSetup.CaricaParametriSetup(); + Model.SourcePath = _parametriSetup.LeggiParametroString("DirSorgente"); + Model.DestinationPath = _parametriSetup.LeggiParametroString("DirDestinazione"); + chkAggiornaSottodirectory.Checked = _parametriSetup.LeggiParametroBoolean("DirSottoDirectory"); + chkCreaSottocartelle.Checked = _parametriSetup.LeggiParametroBoolean("DirDividiDestinazione"); + txtFilePerCartella.Text = _parametriSetup.LeggiParametroString("DirDividiNumFile"); + txtSuffissoCartelle.Text = _parametriSetup.LeggiParametroString("DirDividiSuffisso"); + txtCifreContatore.Text = _parametriSetup.LeggiParametroString("DirDividiNumCifre"); + string TestoTemp = _parametriSetup.LeggiParametroString("DirDividiTipoNumerazione"); + if (TestoTemp.ToUpper() == "PROGRESSIVA") { - string IlNome = openFileDialog.FileName; - _parametriSetup.NomeFileSetup = IlNome; - _parametriSetup.CaricaParametriSetup(); - Model.SourcePath = _parametriSetup.LeggiParametroString("DirSorgente"); - Model.DestinationPath = _parametriSetup.LeggiParametroString("DirDestinazione"); - chkAggiornaSottodirectory.Checked = _parametriSetup.LeggiParametroBoolean("DirSottoDirectory"); - chkCreaSottocartelle.Checked = _parametriSetup.LeggiParametroBoolean("DirDividiDestinazione"); - txtFilePerCartella.Text = _parametriSetup.LeggiParametroString("DirDividiNumFile"); - txtSuffissoCartelle.Text = _parametriSetup.LeggiParametroString("DirDividiSuffisso"); - txtCifreContatore.Text = _parametriSetup.LeggiParametroString("DirDividiNumCifre"); - string TestoTemp = _parametriSetup.LeggiParametroString("DirDividiTipoNumerazione"); - if (TestoTemp.ToUpper() == "PROGRESSIVA") + rdbNumProgressiva.Checked = true; + } + else + { + rdbNumFiles.Checked = true; + } + + CheckBox1.Checked = _parametriSetup.LeggiParametroBoolean("MiniatureCrea"); + TextBox3.Text = _parametriSetup.LeggiParametroString("MiniatureSuffisso"); + TextBox5.Text = _parametriSetup.LeggiParametroString("MiniatureAltezza"); + TextBox6.Text = _parametriSetup.LeggiParametroString("MiniatureLarghezza"); + RadioButton3.Checked = _parametriSetup.LeggiParametroBoolean("MiniatureAddScritta"); + RadioButton4.Checked = _parametriSetup.LeggiParametroBoolean("MiniatureAddOrario"); + TextBox27.Text = _parametriSetup.LeggiParametroString("FotoAltezza"); + TextBox28.Text = _parametriSetup.LeggiParametroString("FotoLarghezza"); + // TextBox13.Text = SetupIni.LeggiParametroString("FotoCodice") + // CheckBox2.Checked = SetupIni.LeggiParametroBoolean("FotoDimOriginali") + + TextBox11.Text = _parametriSetup.LeggiParametroString("FontDimensione"); + TextBox25.Text = _parametriSetup.LeggiParametroString("FontDimensioneMiniatura"); + CheckBox3.Checked = _parametriSetup.LeggiParametroBoolean("FontBold"); + ComboBox3.Text = _parametriSetup.LeggiParametroString("FontNome"); + if (string.IsNullOrEmpty(TextBox25.Text)) + { + TextBox25.Text = "0"; + } + + Model.HorizontalText = _parametriSetup.LeggiParametroString("TestoTesto"); + TextBox9.Text = _parametriSetup.LeggiParametroString("TestoTrasparente"); + TextBox12.Text = _parametriSetup.LeggiParametroString("TestoMargine"); + ComboBox1.Text = _parametriSetup.LeggiParametroString("TestoPosizione"); + ComboBox2.Text = _parametriSetup.LeggiParametroString("TestoAllineamento"); + TextBox10.Text = _parametriSetup.LeggiParametroString("MarchioFile"); + TextBox14.Text = _parametriSetup.LeggiParametroString("MarchioAltezza"); + TextBox15.Text = _parametriSetup.LeggiParametroString("MarchioLarghezza"); + TextBox16.Text = _parametriSetup.LeggiParametroString("MarchioMargine"); + ComboBox4.Text = _parametriSetup.LeggiParametroString("MarchioAllOrizzontale"); + ComboBox5.Text = _parametriSetup.LeggiParametroString("MarchioAllVerticale"); + TextBox19.Text = _parametriSetup.LeggiParametroString("MarchioTrasparenza"); + CheckBox5.Checked = _parametriSetup.LeggiParametroBoolean("MarchioAggiungi"); + CheckBox7.Checked = _parametriSetup.LeggiParametroBoolean("TempoGara"); + CheckBox8.Checked = _parametriSetup.LeggiParametroBoolean("Orario"); + TextBox18.Text = _parametriSetup.LeggiParametroString("EtichettaOrario"); + chkForzaJpg.Checked = _parametriSetup.LeggiParametroBoolean("GeneraleForzaJpg"); + chkRotazioneAutomatica.Checked = _parametriSetup.LeggiParametroBoolean("GeneraleRotazioneAutomatica"); + TextBox30.Text = _parametriSetup.LeggiParametroString("GrandezzaVerticale"); + TextBox31.Text = _parametriSetup.LeggiParametroString("MargineVerticale"); + CheckBox15.Checked = _parametriSetup.LeggiParametroBoolean("DimensioniOriginali"); + Model.VerticalText = _parametriSetup.LeggiParametroString("TestoVerticale"); + RadioButton6.Checked = _parametriSetup.LeggiParametroBoolean("NomeMiniatura"); + CheckBox16.Checked = _parametriSetup.LeggiParametroBoolean("DataFoto"); + CheckBox17.Checked = _parametriSetup.LeggiParametroBoolean("NumeroFoto"); + RadioButton5.Checked = _parametriSetup.LeggiParametroBoolean("TempoSmall"); + RadioButton7.Checked = _parametriSetup.LeggiParametroBoolean("NumTempoSmall"); + TextBox32.Text = _parametriSetup.LeggiParametroString("CompressioneJpeg"); + TextBox33.Text = _parametriSetup.LeggiParametroString("CompressioneJpegMiniatura"); + TextBox34.Text = _parametriSetup.LeggiParametroString("ColoreTestoRGB"); + Model.OverwriteImages = _parametriSetup.LeggiParametroBoolean("OverwriteImages"); + if (File.Exists(TextBox10.Text)) + { + PictureBox1.Image = Image.FromFile(TextBox10.Text); + if (PictureBox1.Image.Height >= PictureBox1.Image.Width) { - rdbNumProgressiva.Checked = true; + PictureBox1.Height = 160; + PictureBox1.Width = + (int)(160 * PictureBox1.Image.Width / (double)PictureBox1.Image.Height); } else { - rdbNumFiles.Checked = true; + PictureBox1.Width = 224; + PictureBox1.Height = + (int)(224 * PictureBox1.Image.Height / (double)PictureBox1.Image.Width); } - - CheckBox1.Checked = _parametriSetup.LeggiParametroBoolean("MiniatureCrea"); - TextBox3.Text = _parametriSetup.LeggiParametroString("MiniatureSuffisso"); - TextBox5.Text = _parametriSetup.LeggiParametroString("MiniatureAltezza"); - TextBox6.Text = _parametriSetup.LeggiParametroString("MiniatureLarghezza"); - RadioButton3.Checked = _parametriSetup.LeggiParametroBoolean("MiniatureAddScritta"); - RadioButton4.Checked = _parametriSetup.LeggiParametroBoolean("MiniatureAddOrario"); - TextBox27.Text = _parametriSetup.LeggiParametroString("FotoAltezza"); - TextBox28.Text = _parametriSetup.LeggiParametroString("FotoLarghezza"); - // TextBox13.Text = SetupIni.LeggiParametroString("FotoCodice") - // CheckBox2.Checked = SetupIni.LeggiParametroBoolean("FotoDimOriginali") - - TextBox11.Text = _parametriSetup.LeggiParametroString("FontDimensione"); - TextBox25.Text = _parametriSetup.LeggiParametroString("FontDimensioneMiniatura"); - CheckBox3.Checked = _parametriSetup.LeggiParametroBoolean("FontBold"); - ComboBox3.Text = _parametriSetup.LeggiParametroString("FontNome"); - if (string.IsNullOrEmpty(TextBox25.Text)) - { - TextBox25.Text = "0"; - } - - Model.HorizontalText = _parametriSetup.LeggiParametroString("TestoTesto"); - TextBox9.Text = _parametriSetup.LeggiParametroString("TestoTrasparente"); - TextBox12.Text = _parametriSetup.LeggiParametroString("TestoMargine"); - ComboBox1.Text = _parametriSetup.LeggiParametroString("TestoPosizione"); - ComboBox2.Text = _parametriSetup.LeggiParametroString("TestoAllineamento"); - TextBox10.Text = _parametriSetup.LeggiParametroString("MarchioFile"); - TextBox14.Text = _parametriSetup.LeggiParametroString("MarchioAltezza"); - TextBox15.Text = _parametriSetup.LeggiParametroString("MarchioLarghezza"); - TextBox16.Text = _parametriSetup.LeggiParametroString("MarchioMargine"); - ComboBox4.Text = _parametriSetup.LeggiParametroString("MarchioAllOrizzontale"); - ComboBox5.Text = _parametriSetup.LeggiParametroString("MarchioAllVerticale"); - TextBox19.Text = _parametriSetup.LeggiParametroString("MarchioTrasparenza"); - CheckBox5.Checked = _parametriSetup.LeggiParametroBoolean("MarchioAggiungi"); - CheckBox7.Checked = _parametriSetup.LeggiParametroBoolean("TempoGara"); - CheckBox8.Checked = _parametriSetup.LeggiParametroBoolean("Orario"); - TextBox18.Text = _parametriSetup.LeggiParametroString("EtichettaOrario"); - chkForzaJpg.Checked = _parametriSetup.LeggiParametroBoolean("GeneraleForzaJpg"); - chkRotazioneAutomatica.Checked = _parametriSetup.LeggiParametroBoolean("GeneraleRotazioneAutomatica"); - TextBox30.Text = _parametriSetup.LeggiParametroString("GrandezzaVerticale"); - TextBox31.Text = _parametriSetup.LeggiParametroString("MargineVerticale"); - CheckBox15.Checked = _parametriSetup.LeggiParametroBoolean("DimensioniOriginali"); - Model.VerticalText = _parametriSetup.LeggiParametroString("TestoVerticale"); - RadioButton6.Checked = _parametriSetup.LeggiParametroBoolean("NomeMiniatura"); - CheckBox16.Checked = _parametriSetup.LeggiParametroBoolean("DataFoto"); - CheckBox17.Checked = _parametriSetup.LeggiParametroBoolean("NumeroFoto"); - RadioButton5.Checked = _parametriSetup.LeggiParametroBoolean("TempoSmall"); - RadioButton7.Checked = _parametriSetup.LeggiParametroBoolean("NumTempoSmall"); - TextBox32.Text = _parametriSetup.LeggiParametroString("CompressioneJpeg"); - TextBox33.Text = _parametriSetup.LeggiParametroString("CompressioneJpegMiniatura"); - TextBox34.Text = _parametriSetup.LeggiParametroString("ColoreTestoRGB"); - Model.OverwriteImages = _parametriSetup.LeggiParametroBoolean("OverwriteImages"); - if (File.Exists(TextBox10.Text)) - { - PictureBox1.Image = Image.FromFile(TextBox10.Text); - if (PictureBox1.Image.Height >= PictureBox1.Image.Width) - { - PictureBox1.Height = 160; - PictureBox1.Width = - (int)(160 * PictureBox1.Image.Width / (double)PictureBox1.Image.Height); - } - else - { - PictureBox1.Width = 224; - PictureBox1.Height = - (int)(224 * PictureBox1.Image.Height / (double)PictureBox1.Image.Width); - } - } - - Text = "Image Catalog - " + LeggiSoloNomeFile(IlNome); - - // 2021 - TextBox8.Text = _parametriSetup.LeggiParametroString("ChunkSize"); - TextBox7.Text = _parametriSetup.LeggiParametroString("ThreadsCount"); } + + Text = "Image Catalog - " + LeggiSoloNomeFile(ilNome); + + // 2021 + Model.ChunkSize = int.Parse(_parametriSetup.LeggiParametroString("ChunkSize")); + Model.ThreadsCount = int.Parse(_parametriSetup.LeggiParametroString("ThreadsCount")); } private void SetPicSettings(string SourcePath, string DestPath) @@ -570,76 +563,6 @@ public partial class MainForm _picSettings.OverwriteFiles = Model.OverwriteImages; } - private List getFiles(DirectoryInfo sourceDir) - { - var picList = new List(); - foreach (var childFile in sourceDir.GetFiles("*.jpg")) - picList.Add(childFile); - return picList; - } - - private void setLabel17Text(string text) - { - if (lblFotoTotaliNum.InvokeRequired) - { - lblFotoTotaliNum.Invoke(new Action(setLabel17Text), text); - } - else - { - lblFotoTotaliNum.Text = text; - } - } - - private void setLabel10Text(string text) - { - if (Label10.InvokeRequired) - { - Label10.Invoke(new Action(setLabel10Text), text); - } - else - { - Label10.Text = text; - } - } - - public void stepProgressBar() - { - if (ProgressBar1.InvokeRequired) - { - ProgressBar1.Invoke(new System.Windows.Forms.MethodInvoker(ProgressBar1.PerformStep)); - } - else - { - ProgressBar1.PerformStep(); - } - - setLabel18Text(ProgressBar1.Value.ToString()); - } - - private void setProgressBarMaximum(int value) - { - if (ProgressBar1.InvokeRequired) - { - ProgressBar1.Invoke(new Action(setProgressBarMaximum), (object)value); - } - else - { - ProgressBar1.Maximum = value; - } - } - - private void setProgressBarValue(int value) - { - if (ProgressBar1.InvokeRequired) - { - ProgressBar1.Invoke(new Action(setProgressBarValue), (object)value); - } - else - { - ProgressBar1.Value = value; - } - } - private void setLabel18Text(string text) { if (Label18.InvokeRequired) @@ -652,33 +575,6 @@ public partial class MainForm } } - private void setLabel43Text(string text) - { - if (Label43.InvokeRequired) - { - Label43.Invoke(new Action(setLabel43Text), text); - } - else - { - Label43.Text = text; - } - } - - private int getNumerazione() - { - int numerazione; - if (rdbNumProgressiva.Checked) - { - numerazione = (int)FileHelper.numerazione.Progressiva; - } - else - { - numerazione = (int)FileHelper.numerazione.Files; - } - - return numerazione; - } - private NumerazioneType GetNumerazioneEnum() { NumerazioneType numerazioneType; @@ -694,83 +590,6 @@ public partial class MainForm return numerazioneType; } - - private void CopyDirectoryFile(string SourcePath, string DestPath, bool OverWrite = false) - { - var SourceDir = new DirectoryInfo(SourcePath); - var DestDir = new DirectoryInfo(DestPath); - if (SourceDir.Exists) - { - if (!DestDir.Exists) - { - DestDir.Create(); - // copy all the files of the current directory - } - - foreach (var childFile in SourceDir.GetFiles()) - { - if (OverWrite) - { - childFile.CopyTo(Path.Combine(DestDir.FullName, childFile.Name), true); - } - // if overwrite = false, copy the file only if it does not exist - // this is done to avoid an IOException if a file already exists - // this way the other files can be copied anyway... - else if (!File.Exists(Path.Combine(DestDir.FullName, childFile.Name))) - { - childFile.CopyTo(Path.Combine(DestDir.FullName, childFile.Name), false); - } - // copy all the sub-directories by recursively calling this same routine - } - - foreach (var subDir in SourceDir.GetDirectories()) - CopyDirectoryFile(subDir.FullName, Path.Combine(DestDir.FullName, subDir.Name), OverWrite); - } - } - - public Size NewthumbSize(int currentwidth, int currentheight, int MaxPixel, string TipoSize) - { - // Calculate the Size of the New image - // *** Larghezza, Altezza, Auto - - double tempMultiplier; - if ((TipoSize.ToUpper() ?? "") == ("Larghezza".ToUpper() ?? "")) - { - tempMultiplier = MaxPixel / (double)currentwidth; - } - else if ((TipoSize.ToUpper() ?? "") == ("Altezza".ToUpper() ?? "")) - { - tempMultiplier = MaxPixel / (double)currentheight; - } - else if (currentheight > currentwidth) // portrait - { - tempMultiplier = MaxPixel / (double)currentheight; - } - else - { - tempMultiplier = MaxPixel / (double)currentwidth; - } - - var NewSize = new Size((int)Math.Round(currentwidth * tempMultiplier), - (int)Math.Round(currentheight * tempMultiplier)); - return NewSize; - } - - // private void Button7_Click(object sender, EventArgs e) - // { - // try - // { - // Model.MainToken?.Cancel(); - // } - // catch (Exception exception) - // { - // _logger.LogError(exception.Message); - // _logger.LogInformation("Ignora questo errore"); - // } - // - // unlockUI(); - // } - private void Button4_Click(object sender, EventArgs e) { var openFileDialog = new OpenFileDialog(); @@ -826,11 +645,11 @@ public partial class MainForm { if (e.Button == MouseButtons.Left) { - WaterSelectColor = true; + _waterSelectColor = true; } else { - WaterSelectColor = false; + _waterSelectColor = false; } } @@ -866,10 +685,6 @@ public partial class MainForm } } - private void TextBox27_TextChanged(object sender, EventArgs e) - { - } - private void CheckBox18_CheckedChanged(object sender, EventArgs e) { CheckBox4.Checked = false; @@ -912,8 +727,6 @@ public partial class MainForm ProgressBar1.Step = 1; ProgressBar1.Value = 0; - // Await CreaCatalogoParallel() - var imageCreationOptions = new ImageCreationStuff.Options { AggiornaSottodirectory = chkAggiornaSottodirectory.Checked, @@ -924,8 +737,8 @@ public partial class MainForm NumerazioneType = GetNumerazioneEnum(), SourcePath = Model.SourcePath, DestinationPath = Model.DestinationPath, - MaxThreads = int.Parse(TextBox7.Text), - ChunksSize = int.Parse(TextBox8.Text), + MaxThreads = Model.ThreadsCount, + ChunksSize = Model.ChunkSize, LinearExecution = rdbVecchioMetodo.Checked }; @@ -939,7 +752,7 @@ public partial class MainForm timer1.Interval = 1000 * 60; timer1.Enabled = true; - string time = + var time = await _imageCreationService.CreaCatalogoParallel(imageCreationOptions, _results, UiUpdateEvent, token); Model.SpeedCounter = time; timer1.Enabled = false; @@ -969,7 +782,6 @@ public partial class MainForm _currentAmount = _results.Count; int diff = _currentAmount - _previousAmount; Model.SpeedCounter = $"{diff} f/m"; - //SetText(Label43, $"{diff} f/m"); } private void UpdateCounter(string text) diff --git a/imagecatalog/MainForm.resx b/imagecatalog/MainForm.resx index 8ce399a..a4e857a 100644 --- a/imagecatalog/MainForm.resx +++ b/imagecatalog/MainForm.resx @@ -120,12 +120,6 @@ 586, 17 - - 586, 17 - - - 120, 17 - 120, 17 -- 2.52.0 From 2b195946e33afc1c024bca8d5d84ffeaec345ffa Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 19 Sep 2025 10:01:24 +0200 Subject: [PATCH 035/127] Fixed threads and chunk loading error --- imagecatalog/MainForm.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/imagecatalog/MainForm.cs b/imagecatalog/MainForm.cs index e87edf7..9f4b089 100644 --- a/imagecatalog/MainForm.cs +++ b/imagecatalog/MainForm.cs @@ -386,9 +386,9 @@ public partial class MainForm openFileDialog.Filter = "Setup (*.xml)|*.xml|All valid files (*.*)|*.*"; openFileDialog.FilterIndex = 0; openFileDialog.RestoreDirectory = true; - + if (DialogResult.OK != openFileDialog.ShowDialog()) return; - + var ilNome = openFileDialog.FileName; _parametriSetup.NomeFileSetup = ilNome; _parametriSetup.CaricaParametriSetup(); @@ -480,8 +480,18 @@ public partial class MainForm Text = "Image Catalog - " + LeggiSoloNomeFile(ilNome); // 2021 - Model.ChunkSize = int.Parse(_parametriSetup.LeggiParametroString("ChunkSize")); - Model.ThreadsCount = int.Parse(_parametriSetup.LeggiParametroString("ThreadsCount")); + if (int.TryParse(_parametriSetup.LeggiParametroString("ChunkSize"), out var chunkSize)) + { + Model.ChunkSize = chunkSize; + } + + if (int.TryParse(_parametriSetup.LeggiParametroString("ThreadsCount"), out var threadsCount)) + { + Model.ThreadsCount = threadsCount; + } + + // Model.ChunkSize = int.Parse(_parametriSetup.LeggiParametroString("ChunkSize")); + // Model.ThreadsCount = int.Parse(_parametriSetup.LeggiParametroString("ThreadsCount")); } private void SetPicSettings(string SourcePath, string DestPath) -- 2.52.0 From c722d39eb1b658fd30831a0cb8965542437fd7bd Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 19 Sep 2025 10:56:39 +0200 Subject: [PATCH 036/127] Modernized xml reading and saving --- imagecatalog/MainForm.cs | 19 +- imagecatalog/ParametriSetup.cs | 306 ++++++++++++++++++++------------- 2 files changed, 194 insertions(+), 131 deletions(-) diff --git a/imagecatalog/MainForm.cs b/imagecatalog/MainForm.cs index 9f4b089..ee2c80e 100644 --- a/imagecatalog/MainForm.cs +++ b/imagecatalog/MainForm.cs @@ -480,15 +480,18 @@ public partial class MainForm Text = "Image Catalog - " + LeggiSoloNomeFile(ilNome); // 2021 - if (int.TryParse(_parametriSetup.LeggiParametroString("ChunkSize"), out var chunkSize)) - { - Model.ChunkSize = chunkSize; - } + Model.ChunkSize = _parametriSetup.LeggiParametro("ChunkSize", Model.ChunkSize); + Model.ThreadsCount = _parametriSetup.LeggiParametro("ThreadsCount", Model.ThreadsCount); + + // if (int.TryParse(_parametriSetup.LeggiParametroString("ChunkSize"), out var chunkSize)) + // { + // Model.ChunkSize = chunkSize; + // } - if (int.TryParse(_parametriSetup.LeggiParametroString("ThreadsCount"), out var threadsCount)) - { - Model.ThreadsCount = threadsCount; - } + // if (int.TryParse(_parametriSetup.LeggiParametroString("ThreadsCount"), out var threadsCount)) + // { + // Model.ThreadsCount = threadsCount; + // } // Model.ChunkSize = int.Parse(_parametriSetup.LeggiParametroString("ChunkSize")); // Model.ThreadsCount = int.Parse(_parametriSetup.LeggiParametroString("ThreadsCount")); diff --git a/imagecatalog/ParametriSetup.cs b/imagecatalog/ParametriSetup.cs index 3558b49..fa9df13 100644 --- a/imagecatalog/ParametriSetup.cs +++ b/imagecatalog/ParametriSetup.cs @@ -1,179 +1,239 @@ using System; using System.Data; -using Microsoft.VisualBasic; namespace ImageCatalog { public class ParametriSetup { - private DataSet _ElencoParametri; - private string _NomeFileSetup; + private DataSet _elencoParametri; + public string NomeFileSetup { get; set; } - public ParametriSetup(string FileSetup) + public ParametriSetup(string fileSetup) { - _ElencoParametri = new DataSet(); - _NomeFileSetup = FileSetup; - if (!string.IsNullOrEmpty(FileSetup)) + _elencoParametri = new DataSet(); + NomeFileSetup = fileSetup; + if (!string.IsNullOrWhiteSpace(fileSetup)) { CaricaParametriSetup(); } } - public ParametriSetup() + public ParametriSetup() : this(string.Empty) { - _ElencoParametri = new DataSet(); - _NomeFileSetup = ""; } public void CaricaParametriSetup() { - _ElencoParametri = LeggiXmlDataSet("Setup", _NomeFileSetup, "Nome"); + if (string.IsNullOrEmpty(NomeFileSetup) || !File.Exists(NomeFileSetup)) + { + _elencoParametri = new DataSet(); + return; + } + + _elencoParametri = LeggiXmlDataSet("Setup", NomeFileSetup, "Nome"); } public void SalvaParametriSetup() { - if (System.IO.File.Exists(_NomeFileSetup) == true) - { - FileSystem.Kill(_NomeFileSetup); - } + if (string.IsNullOrWhiteSpace(NomeFileSetup)) + throw new InvalidOperationException("NomeFileSetup is not set."); - _ElencoParametri.WriteXml(_NomeFileSetup); + // overwrite without FileSystem.Kill + _elencoParametri.WriteXml(NomeFileSetup, XmlWriteMode.WriteSchema); } - public string LeggiParametroString(string NomeParametro) - { - string Risposta = ""; - try - { - var LElenco = _ElencoParametri.Tables["Setup"].Select("Nome='" + NomeParametro + "'"); - foreach (var LaRiga in LElenco) - Risposta = LaRiga["Valore"].ToString(); - } - catch - { - Risposta = ""; - } + // public string LeggiParametroString(string NomeParametro) + // { + // string Risposta = ""; + // try + // { + // var LElenco = _elencoParametri.Tables["Setup"].Select("Nome='" + NomeParametro + "'"); + // foreach (var LaRiga in LElenco) + // Risposta = LaRiga["Valore"].ToString(); + // } + // catch + // { + // Risposta = ""; + // } + // + // return Risposta; + // } + // + // public bool LeggiParametroBoolean(string nomeParametro) + // { + // var risposta = ""; + // try + // { + // var lElenco = _elencoParametri.Tables["Setup"].Select("Nome='" + nomeParametro + "'"); + // foreach (var laRiga in lElenco) + // risposta = laRiga["Valore"].ToString(); + // } + // catch + // { + // risposta = ""; + // } + // + // switch (risposta.ToUpper() ?? "") + // { + // case "TRUE": + // case "OK": + // case "SI": + // case "1": + // case "YES": + // case "VERO": + // { + // return true; + // } + // + // default: + // { + // return false; + // } + // } + // } - return Risposta; + public string LeggiParametroString(string nomeParametro) + { + return GetRow(nomeParametro)?["Valore"]?.ToString() ?? string.Empty; } public bool LeggiParametroBoolean(string nomeParametro) { - var risposta = ""; + var raw = LeggiParametroString(nomeParametro); + return raw?.ToUpperInvariant() switch + { + "TRUE" or "OK" or "SI" or "1" or "YES" or "VERO" => true, + _ => false + }; + } + + public void AggiornaParametro(string nomeParametro, object valoreParametro) + { + var table = EnsureSetupTable(); + + var rows = table.Select($"Nome='{nomeParametro.Replace("'", "''")}'"); + if (rows.Length == 0) + { + var newRow = table.NewRow(); + newRow["Nome"] = nomeParametro; + newRow["Valore"] = valoreParametro?.ToString() ?? string.Empty; + table.Rows.Add(newRow); + } + else + { + rows[0]["Valore"] = valoreParametro?.ToString() ?? string.Empty; + } + } + + public T LeggiParametro(string nomeParametro, T defaultValue = default!) + { + var raw = LeggiParametroString(nomeParametro); + if (string.IsNullOrEmpty(raw)) return defaultValue; + try { - var lElenco = _ElencoParametri.Tables["Setup"].Select("Nome='" + nomeParametro + "'"); - foreach (var laRiga in lElenco) - risposta = laRiga["Valore"].ToString(); + return (T)Convert.ChangeType(raw, typeof(T)); } catch { - risposta = ""; - } - - switch (risposta.ToUpper() ?? "") - { - case "TRUE": - case "OK": - case "SI": - case "1": - case "YES": - case "VERO": - { - return true; - } - - default: - { - return false; - } + return defaultValue; } } - public void AggiornaParametro(string NomeParametro, object ValoreParametro) + private static DataSet LeggiXmlDataSet(string nomeTabella, string nomeFileXml, string nomeColonnaChiave = "") { - try - { - if (_ElencoParametri.Tables["Setup"] is null) - { - var TabellaTmp = new DataTable("Setup"); - DataRow RigaTmp; - DataColumn LaColonna; - LaColonna = TabellaTmp.Columns.Add("Nome", Type.GetType("System.String")); - LaColonna = TabellaTmp.Columns.Add("Valore", Type.GetType("System.String")); + var ds = new DataSet(); + ds.ReadXml(nomeFileXml); - // * Aggiunge alla tabella tutte le righe - RigaTmp = TabellaTmp.NewRow(); - RigaTmp["Nome"] = NomeParametro; - RigaTmp["Valore"] = ValoreParametro; - TabellaTmp.Rows.Add(RigaTmp); - _ElencoParametri.Tables.Add(TabellaTmp); - } - else + if (!string.IsNullOrEmpty(nomeColonnaChiave) && ds.Tables.Contains(nomeTabella)) + { + var table = ds.Tables[nomeTabella]; + if (table.Constraints[nomeColonnaChiave] == null) { - var LElenco = _ElencoParametri.Tables["Setup"].Select("Nome='" + NomeParametro + "'"); - if (LElenco.Length == 0) - { - DataRow LaRiga; - LaRiga = _ElencoParametri.Tables["Setup"].NewRow(); - LaRiga["Nome"] = NomeParametro; - LaRiga["Valore"] = ValoreParametro; - _ElencoParametri.Tables["Setup"].Rows.Add(LaRiga); - } - else - { - LElenco[0]["Valore"] = ValoreParametro; - } + table.Constraints.Add(nomeColonnaChiave, table.Columns[nomeColonnaChiave], true); } } - catch - { - } + + return ds; } - private DataTable LeggiXmlDataTable(string NomeTabella, string NomeFileXml, string NomeColonnaChiave = "") + private DataTable EnsureSetupTable() { - // * Crea e Legge il dataset dal file xml - var DataSetXml = new DataSet(); - DataSetXml.ReadXml(NomeFileXml); - - // * Aggiunge il campo chiave - if (!string.IsNullOrEmpty(NomeColonnaChiave)) + if (!_elencoParametri.Tables.Contains("Setup")) { - DataSetXml.Tables[NomeTabella].Constraints.Add(NomeColonnaChiave, DataSetXml.Tables[NomeTabella].Columns[NomeColonnaChiave], true); + var table = new DataTable("Setup"); + table.Columns.Add("Nome", typeof(string)); + table.Columns.Add("Valore", typeof(string)); + _elencoParametri.Tables.Add(table); } - // * Restituisce la risposta - return DataSetXml.Tables[NomeTabella]; + return _elencoParametri.Tables["Setup"]; } - private static DataSet LeggiXmlDataSet(string NomeTabella, string NomeFileXml, string NomeColonnaChiave = "") + private DataRow? GetRow(string nomeParametro) { - // * Crea e Legge il dataset dal file xml - var DataSetXml = new DataSet(); - DataSetXml.ReadXml(NomeFileXml); - - // * Aggiunge il campo chiave - if (!string.IsNullOrEmpty(NomeColonnaChiave)) - { - DataSetXml.Tables[NomeTabella].Constraints.Add(NomeColonnaChiave, DataSetXml.Tables[NomeTabella].Columns[NomeColonnaChiave], true); - } - - // * Restituisce la risposta - return DataSetXml; - } - - public string NomeFileSetup - { - get - { - return _NomeFileSetup; - } - - set - { - _NomeFileSetup = value; - } + if (!_elencoParametri.Tables.Contains("Setup")) return null; + var rows = _elencoParametri.Tables["Setup"] + .Select($"Nome='{nomeParametro.Replace("'", "''")}'"); + return rows.FirstOrDefault(); } } + + // public void AggiornaParametro(string NomeParametro, object ValoreParametro) + // { + // try + // { + // if (_elencoParametri.Tables["Setup"] is null) + // { + // var TabellaTmp = new DataTable("Setup"); + // DataRow RigaTmp; + // DataColumn LaColonna; + // LaColonna = TabellaTmp.Columns.Add("Nome", Type.GetType("System.String")); + // LaColonna = TabellaTmp.Columns.Add("Valore", Type.GetType("System.String")); + // + // // * Aggiunge alla tabella tutte le righe + // RigaTmp = TabellaTmp.NewRow(); + // RigaTmp["Nome"] = NomeParametro; + // RigaTmp["Valore"] = ValoreParametro; + // TabellaTmp.Rows.Add(RigaTmp); + // _elencoParametri.Tables.Add(TabellaTmp); + // } + // else + // { + // var LElenco = _elencoParametri.Tables["Setup"].Select("Nome='" + NomeParametro + "'"); + // if (LElenco.Length == 0) + // { + // DataRow LaRiga; + // LaRiga = _elencoParametri.Tables["Setup"].NewRow(); + // LaRiga["Nome"] = NomeParametro; + // LaRiga["Valore"] = ValoreParametro; + // _elencoParametri.Tables["Setup"].Rows.Add(LaRiga); + // } + // else + // { + // LElenco[0]["Valore"] = ValoreParametro; + // } + // } + // } + // catch + // { + // } + // } + + // private static DataSet LeggiXmlDataSet(string NomeTabella, string NomeFileXml, string NomeColonnaChiave = "") + // { + // // * Crea e Legge il dataset dal file xml + // var DataSetXml = new DataSet(); + // DataSetXml.ReadXml(NomeFileXml); + // + // // * Aggiunge il campo chiave + // if (!string.IsNullOrEmpty(NomeColonnaChiave)) + // { + // DataSetXml.Tables[NomeTabella].Constraints.Add(NomeColonnaChiave, DataSetXml.Tables[NomeTabella].Columns[NomeColonnaChiave], true); + // } + // + // // * Restituisce la risposta + // return DataSetXml; + // } +//} } \ No newline at end of file -- 2.52.0 From a076f6b8fb2ae1f9e284334efcbc36a985b080f0 Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Wed, 4 Feb 2026 17:53:01 +0100 Subject: [PATCH 037/127] Removed comment --- MaddoShared/ImageCreatorSharp.cs | 234 ------------------------------- 1 file changed, 234 deletions(-) diff --git a/MaddoShared/ImageCreatorSharp.cs b/MaddoShared/ImageCreatorSharp.cs index e989984..f535a4e 100644 --- a/MaddoShared/ImageCreatorSharp.cs +++ b/MaddoShared/ImageCreatorSharp.cs @@ -215,240 +215,6 @@ public class ImageCreatorSharp(PicSettings picSettings, ILogger 0) - // { - // using var imgOutputSmall = (Bitmap)imgOutputBig.Clone(); - // using var grPhoto1 = Graphics.FromImage(imgOutputSmall); - // grPhoto1.SmoothingMode = SmoothingMode.AntiAlias; - // - // // quick fix - // imgState.DimensioneStandardMiniatura = 50; - // if (picSettings.Grassetto == true) - // { - // crFont1 = new Font(picSettings.IlFont, imgState.DimensioneStandardMiniatura, - // FontStyle.Bold); - // crFont2 = new Font(picSettings.IlFont, imgState.DimensioneStandard, FontStyle.Bold); - // } - // else - // { - // crFont1 = new Font(picSettings.IlFont, imgState.DimensioneStandardMiniatura); - // crFont2 = new Font(picSettings.IlFont, imgState.DimensioneStandard); - // } - // - // crSize1 = grPhoto1.MeasureString(imgState.TestoFirmaPiccola, crFont1); - // crSize2 = grPhoto1.MeasureString(imgState.TestoFirma, crFont1); - // var larghezzaStandard1 = System.Convert.ToInt32(crSize1.Width); - // - // if (crSize1.Width > System.Convert.ToSingle(g.Width)) - // { - // int Conta = imgState.DimensioneStandardMiniatura; - // do - // { - // if (Conta > 20) - // Conta -= 5; - // else - // Conta -= 1; - // if (picSettings.Grassetto == true) - // crFont1 = new Font(picSettings.IlFont, Conta, FontStyle.Bold); - // else - // crFont1 = new Font(picSettings.IlFont, Conta); - // crSize1 = grPhoto1.MeasureString(imgState.TestoFirmaPiccola, crFont1); - // if (crSize1.Width < System.Convert.ToSingle(g.Width)) - // { - // larghezzaStandard1 = System.Convert.ToInt32(crSize1.Width); - // break; - // } - // - // if (Conta <= 5) - // break; - // } while (true); - // - // imgState.DimensioneStandardMiniatura = Conta; - // } - // - // switch (picSettings.Posizione.ToUpper()) - // { - // case "ALTO": - // { - // imgState.YPosFromBottom1 = (picSettings.Margine); - // imgState.YPosFromBottom4 = (picSettings.MargVert); - // break; - // } - // - // case "BASSO": - // { - // imgState.YPosFromBottom1 = System.Convert.ToSingle((g.Height - crSize1.Height - - // (g.Height * picSettings.Margine / - // (double)100))); - // imgState.YPosFromBottom4 = System.Convert.ToSingle((g.Height - crSize1.Height - - // (g.Height * picSettings.MargVert / - // (double)100))); - // break; - // } - // } - // - // float xCenterOfImg1 = 0; - // - // using StringFormat strFormat1 = new StringFormat(); - // switch (picSettings.Allineamento.ToUpper()) - // { - // case "SINISTRA": - // { - // xCenterOfImg1 = - // System.Convert.ToSingle((picSettings.Margine + (larghezzaStandard1 / (double)2))); - // - // if ((larghezzaStandard1 / (double)2) > (g.Width / (double)2) - picSettings.Margine) - // xCenterOfImg1 = System.Convert.ToSingle((g.Width / (double)2)); - // break; - // } - // - // case "CENTRO": - // { - // xCenterOfImg1 = System.Convert.ToSingle((g.Width / (double)2)); - // break; - // } - // - // case "DESTRA": - // { - // xCenterOfImg1 = System.Convert.ToSingle((g.Width - picSettings.Margine - - // (larghezzaStandard1 / (double)2))); - // - // if ((larghezzaStandard1 / (double)2) > (g.Width / (double)2) - picSettings.Margine) - // xCenterOfImg1 = System.Convert.ToSingle((g.Width / (double)2)); - // break; - // } - // } - // - // strFormat1.Alignment = StringAlignment.Center; - // - // using var semiTransBrush21 = new SolidBrush(Color.FromArgb(imgState.AlphaScelta, 0, 0, 0)); - // using var semiTransBrush1 = - // new SolidBrush(Color.FromArgb(imgState.AlphaScelta, picSettings.FontColoreRGB)); - // - // // quick fix - // imgState.DimensioneStandardMiniatura = picSettings.DimMin; - // - // if (picSettings.Grassetto == true) - // crFont1 = new Font(picSettings.IlFont, imgState.DimensioneStandardMiniatura, - // FontStyle.Bold); - // else - // crFont1 = new Font(picSettings.IlFont, imgState.DimensioneStandardMiniatura); - // - // if (picSettings.TestoMin) - // { - // grPhoto1.DrawString(imgState.NomeFileBig, crFont1, semiTransBrush21, - // new PointF(xCenterOfImg1 + 1, imgState.YPosFromBottom1 + 1), strFormat1); - // grPhoto1.DrawString(imgState.NomeFileBig, crFont1, semiTransBrush1, - // new PointF(xCenterOfImg1, imgState.YPosFromBottom1), strFormat1); - // } - // else if (picSettings.AggTempoGaraMin & picSettings.UsaTempoGaraTestoApplicare) - // { - // var diff = imgState.DataPartenzaI - imgState.DataFoto; - // var diffA = diff.TotalSeconds * 10000000; - // - // var orario = - // new TimeSpan(0, 0, - // (int)diffA); /* new TimeSpan(DateTime.DateDiff(DateInterval.Second, dataPartenzaI, dataFoto) * 10000000);*/ - // string tempstr = ""; - // - // - // tempstr += Environment.NewLine + imgState.TestoOrario + orario.Hours.ToString("00") + ":" + - // orario.Minutes.ToString("00") + ":" + orario.Seconds.ToString("00"); - // - // - // grPhoto1.DrawString(tempstr, crFont1, semiTransBrush21, - // new PointF(xCenterOfImg1 + 1, imgState.YPosFromBottom1 + 1), strFormat1); - // grPhoto1.DrawString(tempstr, crFont1, semiTransBrush1, - // new PointF(xCenterOfImg1, imgState.YPosFromBottom1), strFormat1); - // } - // else if (picSettings.AggNumTempMin) - // { - // var diff = imgState.DataPartenzaI - imgState.DataFoto; - // var diffA = diff.TotalSeconds * 10000000; - // TimeSpan Orario = new TimeSpan(0, 0, (int)diffA); - // string tempstr = ""; - // tempstr += imgState.NomeFileBig; - // - // tempstr += Environment.NewLine + imgState.TestoOrario + Orario.Hours.ToString("00") + ":" + - // Orario.Minutes.ToString("00") + ":" + Orario.Seconds.ToString("00"); - // - // - // grPhoto1.DrawString(tempstr, crFont1, semiTransBrush21, - // new PointF(xCenterOfImg1 + 1, imgState.YPosFromBottom1 + 1), strFormat1); - // grPhoto1.DrawString(tempstr, crFont1, semiTransBrush1, - // new PointF(xCenterOfImg1, imgState.YPosFromBottom1), strFormat1); - // } - // else - // { - // grPhoto1.DrawString(imgState.TestoFirmaPiccola, crFont1, semiTransBrush21, - // new PointF(xCenterOfImg1 + 1, imgState.YPosFromBottom1 + 1), strFormat1); - // grPhoto1.DrawString(imgState.TestoFirmaPiccola, crFont1, semiTransBrush1, - // new PointF(xCenterOfImg1, imgState.YPosFromBottom1), strFormat1); - // } - // - // // Salva la miniatura - // //using (var g22 = Image.FromHbitmap(imgOutputSmall)) - // - // - // using var imgOutputSmall2 = new Bitmap(imgOutputSmall, imgState.ThumbSizeSmall.Width, - // imgState.ThumbSizeSmall.Height); - // imgOutputSmall2.Save(Path.Combine(imgState.DestDir.FullName, imgState.NomeFileSmall), - // thisFormat); - // - // //imgOutputSmall2.Dispose(); - // - // //imgOutputSmall.Dispose(); - // - // - // //File.Delete(Path.Combine(DestDir.FullName, "Temp_" + nomeFileSmall)); - // //FileSystem.Kill(); - // } - // else - // { - // using var imgOutputSmall = new Bitmap(g, imgState.ThumbSizeSmall.Width, - // imgState.ThumbSizeSmall.Height); - // imgOutputSmall.Save(Path.Combine(imgState.DestDir.FullName, imgState.NomeFileSmall), - // thisFormat); - // //imgOutputSmall.Dispose(); - // } - // } - // else - // { - // using var imgOutputSmall = - // new Bitmap(g, imgState.ThumbSizeSmall.Width, imgState.ThumbSizeSmall.Height); - // imgOutputSmall.Save(Path.Combine(imgState.DestDir.FullName, imgState.NomeFileSmall), thisFormat); - // //imgOutputSmall.Dispose(); - // } - // - // crFont1?.Dispose(); - // crFont2?.Dispose(); - // } - private void CreaMiniature(Image sourceImage, ImageState imgState, Bitmap imgOutputBig, ImageFormat format) { if (!picSettings.CreaMiniature || picSettings.AggiungiScritteMiniature) -- 2.52.0 From cfbc6334b6b14c02491f80c9a1a8e5ec8ae07e19 Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Wed, 4 Feb 2026 18:38:44 +0100 Subject: [PATCH 038/127] Refactoring, upgrades and improvements to memory usage --- MaddoShared/ImageCreationStuff.cs | 43 +- MaddoShared/ImageCreatorSharp.cs | 913 ++++++++++++++--------------- MaddoShared/MaddoShared.csproj | 2 +- imagecatalog/ImageCatalog 2.csproj | 2 +- 4 files changed, 469 insertions(+), 491 deletions(-) diff --git a/MaddoShared/ImageCreationStuff.cs b/MaddoShared/ImageCreationStuff.cs index e437d23..ac78603 100644 --- a/MaddoShared/ImageCreationStuff.cs +++ b/MaddoShared/ImageCreationStuff.cs @@ -49,7 +49,7 @@ namespace MaddoShared stopwatch.Stop(); return - $"{stopwatch.Elapsed.Hours}h {stopwatch.Elapsed.Minutes}m ${stopwatch.Elapsed.Seconds}s ({stopwatch.Elapsed.TotalSeconds}s)"; + $"{stopwatch.Elapsed.Hours}h {stopwatch.Elapsed.Minutes}m {stopwatch.Elapsed.Seconds}s ({stopwatch.Elapsed.TotalSeconds}s)"; } public async Task ProcessImagesParallel( @@ -64,16 +64,17 @@ namespace MaddoShared int threads = options.MaxThreads; Bitmap logoBmp = null; - // Load Logo - if (picSettings.LogoAggiungi & File.Exists(picSettings.LogoNomeFile)) + // Load Logo (short-circuit) + if (picSettings.LogoAggiungi && File.Exists(picSettings.LogoNomeFile)) { logoBmp = new Bitmap(picSettings.LogoNomeFile); } Func processFile = async fileData => { - using var logoCopy = logoBmp.Clone(new Rectangle(0, 0, logoBmp.Width, logoBmp.Height), - logoBmp.PixelFormat); + Bitmap logoCopy = logoBmp is null + ? null + : logoBmp.Clone(new Rectangle(0, 0, logoBmp.Width, logoBmp.Height), logoBmp.PixelFormat); var imgState = new ImageState { @@ -81,26 +82,28 @@ namespace MaddoShared DestDir = fileData.Directory, }; - await imageCreatorService.CreaImmagineThread(imgState, logoCopy); - - // using var imgCreator = new ImageCreatorSharp(fileData.File, fileData.Directory, picSettings); - // await imgCreator.CreaImmagineThread(fileData.File.Name, logoCopy); - - results.Add(fileData.File.Name); - try { - updateEvent?.Invoke(this, new Tuple(fileData.File.Name, dataToProcess.Count)); + // Ensure CreateImageAsync can accept a null logoCopy value. + await imageCreatorService.CreateImageAsync(imgState, logoCopy); + + results.Add(fileData.File.Name); + + try + { + updateEvent?.Invoke(this, new Tuple(fileData.File.Name, dataToProcess.Count)); + } + catch (Exception e) + { + logger.LogError(e, "Error in reporting update"); + throw; + } } - catch (Exception e) + finally { - logger.LogError(e, "Error in reporting update"); - throw; + // Dispose the clone if it was created + logoCopy?.Dispose(); } - // finally - // { - // imgCreator = null; - // } }; if (options.LinearExecution) diff --git a/MaddoShared/ImageCreatorSharp.cs b/MaddoShared/ImageCreatorSharp.cs index f535a4e..0f77df9 100644 --- a/MaddoShared/ImageCreatorSharp.cs +++ b/MaddoShared/ImageCreatorSharp.cs @@ -17,27 +17,27 @@ namespace MaddoShared; [SuppressMessage("Interoperability", "CA1416:Validate platform compatibility")] public class ImageCreatorSharp(PicSettings picSettings, ILogger logger) { - public async Task CreaImmagineThread(ImageState imgState, Image logo) + public async Task CreateImageAsync(ImageState imgState, Image logo) { try { await Task.Run(() => { logger.LogInformation("File: {FileInfo} Dest: {DirectoryInfo}", imgState.WorkFile, imgState.DestDir); - PreparaVariabili(imgState); + PrepareVariables(imgState); ExtractExif(imgState); using var g = Image.FromFile(imgState.WorkFile.FullName); - // Imposta testo extra - ImpostaTestoExtra(g, imgState); + // Set extra text + SetExtraText(g, imgState); - // Ruota l'immagine in base ai dati EXIF - Rotation(g, imgState); + // Rotate image according to EXIF + ApplyRotation(g, imgState); - // Forza jpeg se è selezionata l'opzione + // Force jpeg if option selected var thisFormat = g.RawFormat; - if (picSettings.UsaForzaJpg == true) + if (picSettings.UsaForzaJpg) thisFormat = ImageFormat.Jpeg; PrepareThumbnailSize(g, imgState); @@ -46,15 +46,15 @@ public class ImageCreatorSharp(PicSettings picSettings, ILogger rotation = null; - var found = img.Metadata?.ExifProfile?.TryGetValue(ExifTag.Orientation, out rotation) ?? false; + var exifProfile = img.Metadata?.ExifProfile; + var found = exifProfile != null && exifProfile.TryGetValue(ExifTag.Orientation, out rotation); if (found) { @@ -80,7 +81,7 @@ public class ImageCreatorSharp(PicSettings picSettings, ILogger date = null; - var creationFound = img.Metadata?.ExifProfile?.TryGetValue(ExifTag.DateTimeOriginal, out date) ?? false; + var creationFound = exifProfile != null && exifProfile.TryGetValue(ExifTag.DateTimeOriginal, out date); if (creationFound) { var succ = DateTime.TryParseExact(date.Value, "yyyy:MM:dd HH:mm:ss", CultureInfo.InvariantCulture, @@ -100,7 +101,7 @@ public class ImageCreatorSharp(PicSettings picSettings, ILoggerImage /// /// ''' - private void ImpostaTestoExtra(Image g, ImageState imgState) + private void SetExtraText(Image g, ImageState imgState) { - if (picSettings.UsaOrarioTestoApplicare | picSettings.UsaTempoGaraTestoApplicare | - picSettings.UsaOrarioMiniatura | picSettings.TestoMin | picSettings.AggTempoGaraMin | + if (picSettings.UsaOrarioTestoApplicare || picSettings.UsaTempoGaraTestoApplicare || + picSettings.UsaOrarioMiniatura || picSettings.TestoMin || picSettings.AggTempoGaraMin || picSettings.AggNumTempMin) { if (g.PropertyIdList.Length <= 0) return; - //ExifReader DatiExif = new ExifReader((Bitmap)g); - imgState.DataFoto = imgState.CreationDate ?? DateTime.Now; //DatiExif.DateTimeOriginal; + imgState.DataFoto = imgState.CreationDate ?? DateTime.Now; imgState.TestoFirma = picSettings.TestoFirmaStart; imgState.TestoFirmaV = picSettings.TestoFirmaStartV; if (imgState.DataFoto.Year == 1) return; imgState.TestoFirmaPiccola = imgState.DataFoto.ToShortTimeString(); - if (picSettings.UsaOrarioTestoApplicare == true) + if (picSettings.UsaOrarioTestoApplicare) { imgState.TestoFirma += $" {imgState.DataFoto.ToShortDateString()} {imgState.DataFoto.ToLongTimeString()}"; @@ -157,11 +157,8 @@ public class ImageCreatorSharp(PicSettings picSettings, ILogger /// ''' - private void PreparaVariabili(ImageState imgState) + private void PrepareVariables(ImageState imgState) { imgState.AlphaScelta = System.Convert.ToInt32((255 * (100 - picSettings.Trasparenza) / (double)100)); imgState.TestoFirma = ""; @@ -203,19 +200,19 @@ public class ImageCreatorSharp(PicSettings picSettings, ILogger g.Height) { - imgState.ThumbSizeSmall = NewthumbSize(g.Width, g.Height, picSettings.LarghezzaSmall, "Larghezza"); + imgState.ThumbSizeSmall = CalculateThumbnailSize(g.Width, g.Height, picSettings.LarghezzaSmall, "Larghezza"); var sizeOrig = new Size(g.Width, g.Height); imgState.ThumbSizeBig = sizeOrig; } else { - imgState.ThumbSizeSmall = NewthumbSize(g.Width, g.Height, picSettings.AltezzaSmall, "Altezza"); + imgState.ThumbSizeSmall = CalculateThumbnailSize(g.Width, g.Height, picSettings.AltezzaSmall, "Altezza"); var sizeOrig = new Size(g.Width, g.Height); imgState.ThumbSizeBig = sizeOrig; } } - private void CreaMiniature(Image sourceImage, ImageState imgState, Bitmap imgOutputBig, ImageFormat format) + private void CreateThumbnails(Image sourceImage, ImageState imgState, Bitmap imgOutputBig, ImageFormat format) { if (!picSettings.CreaMiniature || picSettings.AggiungiScritteMiniature) return; @@ -223,10 +220,10 @@ public class ImageCreatorSharp(PicSettings picSettings, ILogger string.Equals(dir1, dir2, StringComparison.OrdinalIgnoreCase); - private void UpdateFileNameWithCode(ImageState imgState) + private void UpdateFilenameWithCode(ImageState imgState) { var name = imgState.NomeFileSmall; imgState.NomeFileSmall = name[..^4] + picSettings.Codice + name[^4..]; @@ -258,7 +255,7 @@ public class ImageCreatorSharp(PicSettings picSettings, ILogger new Font(fontName, size, bold ? FontStyle.Bold : FontStyle.Regular); + private int FindBestFontSize(Graphics g, string text, string fontName, int maxSize, bool bold, int maxWidth, int minSize = 5) + { + if (maxSize <= minSize) return Math.Max(minSize, maxSize); + + int low = minSize; + int high = Math.Max(minSize, maxSize); + int best = minSize; + + while (low <= high) + { + int mid = (low + high) / 2; + using var testFont = CreateFont(fontName, mid, bold); + var measured = g.MeasureString(text, testFont); + if (measured.Width <= maxWidth) + { + best = mid; + low = mid + 1; // try larger + } + else + { + high = mid - 1; // too big + } + } + + return best; + } + private void AdjustFontToFitWidth(Graphics g, int maxWidth, ImageState imgState, ref SizeF size) { int currentSize = imgState.DimensioneStandardMiniatura; @@ -315,6 +339,390 @@ public class ImageCreatorSharp(PicSettings picSettings, ILogger 0 ? imgState.DimensioneStandard : picSettings.DimStandard; + int bestBaseSize = FindBestFontSize(grPhoto, imgState.TestoFirma ?? string.Empty, picSettings.IlFont, targetBaseSize, picSettings.Grassetto, availableWidth); + imgState.DimensioneStandard = bestBaseSize; + + // Decide final drawing size (use DimVert if rotated) + int drawSize = (imgState.FotoRuotaADestra || imgState.FotoRuotaASinistra) ? picSettings.DimVert : imgState.DimensioneStandard; + + using var drawFont = CreateFont(picSettings.IlFont, drawSize, picSettings.Grassetto); + var crSize = grPhoto.MeasureString(imgState.TestoFirma ?? string.Empty, drawFont); + var larghezzaStandard = Convert.ToInt32(crSize.Width); + + // Vertical positions + switch (picSettings.Posizione.ToUpper()) + { + case "ALTO": + { + imgState.YPosFromBottom = picSettings.Margine; + imgState.YPosFromBottom3 = picSettings.MargVert; + break; + } + + case "BASSO": + { + imgState.YPosFromBottom = + Convert.ToSingle((g.Height - crSize.Height - (g.Height * picSettings.Margine / 100.0))); + imgState.YPosFromBottom3 = + Convert.ToSingle((g.Height - crSize.Height - (g.Height * picSettings.MargVert / 100.0))); + break; + } + } + + float xCenterOfImg = 0; + using var strFormat = new StringFormat(); + switch (picSettings.Allineamento.ToUpper()) + { + case "SINISTRA": + { + xCenterOfImg = Convert.ToSingle((picSettings.Margine + (larghezzaStandard / (double)2))); + if ((larghezzaStandard / (double)2) > (g.Width / (double)2) - picSettings.Margine) + xCenterOfImg = Convert.ToSingle((g.Width / (double)2)); + break; + } + + case "CENTRO": + { + xCenterOfImg = Convert.ToSingle((g.Width / (double)2)); + break; + } + + case "DESTRA": + { + xCenterOfImg = + Convert.ToSingle((g.Width - picSettings.Margine - (larghezzaStandard / (double)2))); + if ((larghezzaStandard / (double)2) > (g.Width / (double)2) - picSettings.Margine) + xCenterOfImg = Convert.ToSingle((g.Width / (double)2)); + break; + } + } + + strFormat.Alignment = StringAlignment.Center; + + using var semiTransBrush2 = new SolidBrush(Color.FromArgb(imgState.AlphaScelta, 0, 0, 0)); + using var semiTransBrush = new SolidBrush(Color.FromArgb(imgState.AlphaScelta, picSettings.FontColoreRGB)); + + // write text (NomeFileBig) + if (picSettings.TestoNome) + { + if (picSettings.NomeData && g.PropertyIdList.Length > 0) + { + imgState.DataFoto = imgState.CreationDate ?? DateTime.Now; + + grPhoto.DrawString((imgState.NomeFileBig + " " + imgState.DataFoto.ToShortDateString()), drawFont, + semiTransBrush2, new PointF(xCenterOfImg + 1, imgState.YPosFromBottom + 1), strFormat); + grPhoto.DrawString((imgState.NomeFileBig + " " + imgState.DataFoto.ToShortDateString()), drawFont, + semiTransBrush, new PointF(xCenterOfImg, imgState.YPosFromBottom), strFormat); + } + else + { + grPhoto.DrawString(imgState.NomeFileBig, drawFont, semiTransBrush2, + new PointF(xCenterOfImg + 1, imgState.YPosFromBottom + 1), strFormat); + grPhoto.DrawString(imgState.NomeFileBig, drawFont, semiTransBrush, + new PointF(xCenterOfImg, imgState.YPosFromBottom), strFormat); + } + } + else + { + if (imgState.FotoRuotaADestra || imgState.FotoRuotaASinistra) + { + if (!picSettings.TestoMin) + { + grPhoto.DrawString(imgState.TestoFirmaV, drawFont, semiTransBrush2, + new PointF(xCenterOfImg + 1, imgState.YPosFromBottom3 + 1), strFormat); + grPhoto.DrawString(imgState.TestoFirmaV, drawFont, semiTransBrush, + new PointF(xCenterOfImg, imgState.YPosFromBottom3), strFormat); + } + + if (picSettings.TestoMin) + { + grPhoto.DrawString(imgState.TestoFirmaV, drawFont, semiTransBrush2, + new PointF(xCenterOfImg + 1, imgState.YPosFromBottom4 + 1), strFormat); + grPhoto.DrawString(imgState.TestoFirmaV, drawFont, semiTransBrush, + new PointF(xCenterOfImg, imgState.YPosFromBottom4), strFormat); + } + } + else + { + grPhoto.DrawString(imgState.TestoFirma, drawFont, semiTransBrush2, + new PointF(xCenterOfImg + 1, imgState.YPosFromBottom + 1), strFormat); + grPhoto.DrawString(imgState.TestoFirma, drawFont, semiTransBrush, + new PointF(xCenterOfImg, imgState.YPosFromBottom), strFormat); + } + } + + if (string.Equals(picSettings.DirectorySorgente, picSettings.DirectoryDestinazione, + StringComparison.OrdinalIgnoreCase)) + { + imgState.NomeFileBig2 = imgState.NomeFileBig; + imgState.NomeFileBig = $"{imgState.NomeFileBig[..^4]}{picSettings.Codice}{imgState.NomeFileBig[^4..]}"; + } + } + + private void AddLogo(Bitmap imgOutputBig, Image logo) + { + // Skip if no logo provided + if (logo is null) return; + + // Load check (use short-circuit &&) + if (!(picSettings.LogoAggiungi && File.Exists(picSettings.LogoNomeFile))) return; + + var logoColoreTrasparente = Color.White; + + // * Load this Bitmap into a new Graphic Object + using var grWatermark = Graphics.FromImage(imgOutputBig); + using ImageAttributes imageAttributes = new ImageAttributes(); + + // * The first step replace the background color with one that is transparent (Alpha=0, R=0, G=0, B=0) + var colorMap = new ColorMap + { + // * background this will be the color we search for and replace with transparency + OldColor = logoColoreTrasparente, + NewColor = Color.FromArgb(0, 0, 0, 0) + }; + + var remapTable = new[] { colorMap }; + 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 + var colorMatrixElements = new[] + { + new[] { 1.0F, 0.0F, 0.0F, 0.0F, 0.0F }, new[] { 0.0F, 1.0F, 0.0F, 0.0F, 0.0F }, + new[] { 0.0F, 0.0F, 1.0F, 0.0F, 0.0F }, + new[] { 0.0F, 0.0F, 0.0F, System.Convert.ToSingle(picSettings.LogoTrasparenza) / 100F, 0.0F }, + new[] { 0.0F, 0.0F, 0.0F, 0.0F, 1.0F } + }; + var wmColorMatrix = new ColorMatrix(colorMatrixElements); + imageAttributes.SetColorMatrix(wmColorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap); + + var fotoLogoH = picSettings.LogoAltezza; + var fotoLogoW = picSettings.LogoLarghezza; + var fattoreAlt = logo.Height / (double)fotoLogoH; + var fattoreLarg = logo.Width / (double)fotoLogoW; + var nuovaSize = fattoreLarg > fattoreAlt + ? CalculateThumbnailSize(logo.Width, logo.Height, fotoLogoW, "Larghezza") + : CalculateThumbnailSize(logo.Width, logo.Height, fotoLogoH, "Altezza"); + + var inPercentualeL = picSettings.LogoMargine.EndsWith('%'); + var margineL = System.Convert.ToInt32(picSettings.LogoMargine); + var margineUsato = + inPercentualeL ? System.Convert.ToInt32(imgOutputBig.Height * margineL / (double)100) : margineL; + + int xPosOfWm = 0; + int yPosOfWm = 0; + switch (picSettings.LogoPosizioneH.ToUpper()) + { + case "SINISTRA": + case "NESSUNA": + { + xPosOfWm = margineUsato; + break; + } + + case "CENTRO": + { + xPosOfWm = System.Convert.ToInt32((imgOutputBig.Width - nuovaSize.Width) / (double)2); + break; + } + + case "DESTRA": + { + xPosOfWm = ((imgOutputBig.Width - nuovaSize.Width) - margineUsato); + break; + } + } + + switch (picSettings.LogoPosizioneV.ToUpper()) + { + case "ALTO": + case "NESSUNA": + { + yPosOfWm = margineUsato; + break; + } + + case "CENTRO": + { + yPosOfWm = System.Convert.ToInt32((imgOutputBig.Height - nuovaSize.Height) / (double)2); + break; + } + + case "BASSO": + { + yPosOfWm = ((imgOutputBig.Height - nuovaSize.Height) - margineUsato); + break; + } + } + + grWatermark.DrawImage(logo, new Rectangle(xPosOfWm, yPosOfWm, nuovaSize.Width, nuovaSize.Height), 0, 0, + logo.Width, logo.Height, GraphicsUnit.Pixel, imageAttributes); + //grWatermark.Dispose(); + } + + + private void SavePhoto(Bitmap imgOutputBig, ImageState imgState, ImageFormat thisFormat) + { + var fileName = Path.Combine(imgState.DestDir.FullName, imgState.NomeFileBig); + + using var image1Stream = new MemoryStream(); + if (picSettings.FotoGrandeDimOrigina == false) + { + // attenzione non controlla se è png + // imgOutputBig.Save(Path.Combine(_DestDir.FullName, "Temp_" & NomeFileBig), thisFormat) + if (thisFormat.Equals(ImageFormat.Jpeg)) + { + MakeImageCustomQuality(imgOutputBig, image1Stream, picSettings.JpegQuality); + } + //SalvaImmagineCustomQuality(imgOutputBig, Path.Combine(DestDir.FullName, "Temp_" + NomeFileBig), _picSettings.jpegQuality); + else + { + imgOutputBig.Save(image1Stream, thisFormat); + } + + //imgOutputBig.Save(Path.Combine(DestDir.FullName, "Temp_" + NomeFileBig), thisFormat); + image1Stream.Seek(0, SeekOrigin.Begin); + using var g2 = Image.FromStream(image1Stream); + imgState.ThumbSizeBig = g2.Width > g2.Height + ? CalculateThumbnailSize(g2.Width, g2.Height, picSettings.LarghezzaBig, "Larghezza") + : CalculateThumbnailSize(g2.Width, g2.Height, picSettings.AltezzaBig, "Altezza"); + using var imgOutputBig2 = new Bitmap(g2, imgState.ThumbSizeBig.Width, imgState.ThumbSizeBig.Height); + + if (!picSettings.OverwriteFiles && File.Exists(fileName)) + { + logger.LogInformation("Saltata foto {FileName}, esiste", fileName); + } + else + { + if (thisFormat.Equals(ImageFormat.Jpeg)) + SaveImageCustomQuality(imgOutputBig2, fileName, picSettings.JpegQuality); + else + imgOutputBig2.Save(fileName, thisFormat); + } + } + else + { + if (!picSettings.OverwriteFiles && File.Exists(fileName)) + { + logger.LogInformation("Saltata foto {FileName}, esiste", fileName); + } + else + { + if (thisFormat.Equals(ImageFormat.Jpeg)) + SaveImageCustomQuality(imgOutputBig, fileName, picSettings.JpegQuality); + else + imgOutputBig.Save(fileName, thisFormat); + } + } + + image1Stream.Seek(0, SeekOrigin.Begin); + + if (!picSettings.CreaMiniature) return; + if (!picSettings.AggiungiScritteMiniature) return; + + using var g1 = picSettings.FotoGrandeDimOrigina ? (Image)imgOutputBig.Clone() : Image.FromStream(image1Stream); + + using var imgOutputSmall = new Bitmap(g1, imgState.ThumbSizeSmall.Width, imgState.ThumbSizeSmall.Height); + + if (string.Equals(picSettings.DirectorySorgente, picSettings.DirectoryDestinazione, + StringComparison.OrdinalIgnoreCase)) + imgState.NomeFileSmall = imgState.NomeFileSmall.Substring(0, imgState.NomeFileSmall.Length - 4) + + picSettings.Codice + + imgState.NomeFileSmall.Substring(imgState.NomeFileSmall.Length - 4); + + var tnFileName = Path.Combine(imgState.DestDir.FullName, imgState.NomeFileSmall); + + if (!picSettings.OverwriteFiles && File.Exists(tnFileName)) + { + logger.LogInformation("Saltata miniatura foto {TnFileName}, esiste", tnFileName); + } + else + { + if (thisFormat.Equals(ImageFormat.Jpeg)) + SaveImageCustomQuality(imgOutputSmall, tnFileName, picSettings.JpegQualityMin); + else + imgOutputSmall.Save(tnFileName, thisFormat); + } + } + + private void SaveImageCustomQuality(Bitmap imageToSave, string nomeFileFinale, long quality) + { + var jgpEncoder = GetEncoder(ImageFormat.Jpeg); + var myEncoder = System.Drawing.Imaging.Encoder.Quality; + + using var myEncoderParameters = new EncoderParameters(1); + + var myEncoderParameter = new EncoderParameter(myEncoder, quality); + myEncoderParameters.Param[0] = myEncoderParameter; + imageToSave.Save(nomeFileFinale, jgpEncoder, myEncoderParameters); + //imageToSave.Dispose(); + } + + private void MakeImageCustomQuality(Bitmap imageToSave, Stream destinationStream, long quality) + { + var jgpEncoder = GetEncoder(ImageFormat.Jpeg); + var myEncoder = System.Drawing.Imaging.Encoder.Quality; + + using var myEncoderParameters = new EncoderParameters(1); + + var myEncoderParameter = new EncoderParameter(myEncoder, quality); + myEncoderParameters.Param[0] = myEncoderParameter; + destinationStream.Seek(0, SeekOrigin.Begin); + imageToSave.Save(destinationStream, jgpEncoder, myEncoderParameters); + //imageToSave.Dispose(); + } + + private ImageCodecInfo GetEncoder(ImageFormat format) + { + var codecs = ImageCodecInfo.GetImageDecoders(); + + foreach (var codec in codecs) + { + if (codec.FormatID == format.Guid) + return codec; + } + + return null /* TODO Change to default(_) if this is not a reference type */; + } + + /// + /// ''' Calculate the Size of the New image + /// ''' + /// ''' Larghezza + /// ''' Altezza + /// ''' + /// ''' + /// ''' + /// ''' + private Size CalculateThumbnailSize(int currentwidth, int currentheight, int maxPixel, string tipoSize) + { + // e + // *** Larghezza, Altezza, Auto + + double tempMultiplier; + + if (tipoSize.ToUpper() == "Larghezza".ToUpper()) + tempMultiplier = maxPixel / (double)currentwidth; + else if (tipoSize.ToUpper() == "Altezza".ToUpper()) + tempMultiplier = maxPixel / (double)currentheight; + else if (currentheight > currentwidth) + tempMultiplier = maxPixel / (double)currentheight; + else + tempMultiplier = maxPixel / (double)currentwidth; + + var newSize = new Size(System.Convert.ToInt32(currentwidth * tempMultiplier), + System.Convert.ToInt32(currentheight * tempMultiplier)); + + return newSize; + } + private void SetVerticalPosition(int imgHeight, float textHeight, ImageState imgState) { switch (picSettings.Posizione.ToUpper()) @@ -379,437 +787,4 @@ public class ImageCreatorSharp(PicSettings picSettings, ILogger System.Convert.ToSingle(g.Width)) - { - var conta = imgState.DimensioneStandard; - do - { - if (conta > 20) - conta -= 5; - else - conta -= 1; - if (picSettings.Grassetto == true) - crFont = new Font(picSettings.IlFont, conta, FontStyle.Bold); - else - crFont = new Font(picSettings.IlFont, conta); - crSize = grPhoto.MeasureString(imgState.TestoFirma, crFont); - if (crSize.Width < System.Convert.ToSingle(g.Width)) - { - larghezzaStandard = System.Convert.ToInt32(crSize.Width); - break; - } - - if (conta <= 5) - break; - } while (true); - - imgState.DimensioneStandard = conta; - } - - switch (picSettings.Posizione.ToUpper()) - { - case "ALTO": - { - imgState.YPosFromBottom = (picSettings.Margine); - imgState.YPosFromBottom3 = (picSettings.MargVert); - break; - } - - case "BASSO": - { - imgState.YPosFromBottom = - System.Convert.ToSingle((g.Height - crSize.Height - - (g.Height * picSettings.Margine / (double)100))); - imgState.YPosFromBottom3 = - System.Convert.ToSingle( - (g.Height - crSize.Height - (g.Height * picSettings.MargVert / (double)100))); - break; - } - } - - float xCenterOfImg = 0; - float xCenterOfImg3 = 0; - using var strFormat = new StringFormat(); - switch (picSettings.Allineamento.ToUpper()) - { - case "SINISTRA": - { - xCenterOfImg = System.Convert.ToSingle((picSettings.Margine + (larghezzaStandard / (double)2))); - xCenterOfImg3 = System.Convert.ToSingle((picSettings.MargVert + (larghezzaStandard / (double)2))); - if ((larghezzaStandard / (double)2) > (g.Width / (double)2) - picSettings.Margine) - xCenterOfImg = System.Convert.ToSingle((g.Width / (double)2)); - if ((larghezzaStandard / (double)2) > (g.Width / (double)2) - picSettings.MargVert) - xCenterOfImg3 = System.Convert.ToSingle((g.Width / (double)2)); - break; - } - - case "CENTRO": - { - xCenterOfImg = System.Convert.ToSingle((g.Width / (double)2)); - break; - } - - case "DESTRA": - { - xCenterOfImg = - System.Convert.ToSingle((g.Width - picSettings.Margine - (larghezzaStandard / (double)2))); - xCenterOfImg3 = - System.Convert.ToSingle((g.Width - picSettings.MargVert - (larghezzaStandard / (double)2))); - if ((larghezzaStandard / (double)2) > (g.Width / (double)2) - picSettings.Margine) - xCenterOfImg = System.Convert.ToSingle((g.Width / (double)2)); - if ((larghezzaStandard / (double)2) > (g.Width / (double)2) - picSettings.MargVert) - xCenterOfImg3 = System.Convert.ToSingle((g.Width / (double)2)); - break; - } - } - - strFormat.Alignment = StringAlignment.Center; - - using var semiTransBrush2 = new SolidBrush(Color.FromArgb(imgState.AlphaScelta, 0, 0, 0)); - // Dim semiTransBrush As SolidBrush = New SolidBrush(Color.FromArgb(AlphaScelta, _FontColoreR, _FontColoreG, _FontColoreB)) - using var semiTransBrush = new SolidBrush(Color.FromArgb(imgState.AlphaScelta, picSettings.FontColoreRGB)); - - if (imgState.FotoRuotaADestra | imgState.FotoRuotaASinistra) - { - if (picSettings.Grassetto == true) - crFont = new Font(picSettings.IlFont, picSettings.DimVert, FontStyle.Bold); - else - crFont = new Font(picSettings.IlFont, picSettings.DimVert); - } - else if (picSettings.Grassetto == true) - crFont = new Font(picSettings.IlFont, imgState.DimensioneStandard, FontStyle.Bold); - else - crFont = new Font(picSettings.IlFont, imgState.DimensioneStandard); - - - // qui scrive il testo (nomefilebig) - if (picSettings.TestoNome) - { - if (picSettings.NomeData & g.PropertyIdList.Length > 0) - { - //ExifReader DatiExif = new ExifReader((Bitmap)g); - imgState.DataFoto = imgState.CreationDate ?? DateTime.Now; //DatiExif.DateTimeOriginal; - - grPhoto.DrawString((imgState.NomeFileBig + " " + imgState.DataFoto.ToShortDateString()), crFont, - semiTransBrush2, new PointF(xCenterOfImg + 1, imgState.YPosFromBottom + 1), strFormat); - grPhoto.DrawString((imgState.NomeFileBig + " " + imgState.DataFoto.ToShortDateString()), crFont, - semiTransBrush, new PointF(xCenterOfImg, imgState.YPosFromBottom), strFormat); - } - else - { - grPhoto.DrawString(imgState.NomeFileBig, crFont, semiTransBrush2, - new PointF(xCenterOfImg + 1, imgState.YPosFromBottom + 1), strFormat); - grPhoto.DrawString(imgState.NomeFileBig, crFont, semiTransBrush, - new PointF(xCenterOfImg, imgState.YPosFromBottom), strFormat); - } - } - - if (picSettings.TestoNome == false) - { - if (imgState.FotoRuotaADestra | imgState.FotoRuotaASinistra) - { - if (picSettings.TestoMin == false) - { - grPhoto.DrawString(imgState.TestoFirmaV, crFont, semiTransBrush2, - new PointF(xCenterOfImg + 1, imgState.YPosFromBottom3 + 1), strFormat); - grPhoto.DrawString(imgState.TestoFirmaV, crFont, semiTransBrush, - new PointF(xCenterOfImg, imgState.YPosFromBottom3), strFormat); - } - - if (picSettings.TestoMin == true) - { - grPhoto.DrawString(imgState.TestoFirmaV, crFont, semiTransBrush2, - new PointF(xCenterOfImg + 1, imgState.YPosFromBottom4 + 1), strFormat); - grPhoto.DrawString(imgState.TestoFirmaV, crFont, semiTransBrush, - new PointF(xCenterOfImg, imgState.YPosFromBottom4), strFormat); - } - } - else - { - grPhoto.DrawString(imgState.TestoFirma, crFont, semiTransBrush2, - new PointF(xCenterOfImg + 1, imgState.YPosFromBottom + 1), strFormat); - grPhoto.DrawString(imgState.TestoFirma, crFont, semiTransBrush, - new PointF(xCenterOfImg, imgState.YPosFromBottom), strFormat); - } - } - - if (string.Equals(picSettings.DirectorySorgente, picSettings.DirectoryDestinazione, - StringComparison.OrdinalIgnoreCase)) - { - imgState.NomeFileBig2 = imgState.NomeFileBig; - imgState.NomeFileBig = $"{imgState.NomeFileBig[..^4]}{picSettings.Codice}{imgState.NomeFileBig[^4..]}"; - } - //grPhoto.Dispose(); - - crFont?.Dispose(); - } - - private void AggiungiLogo(Bitmap imgOutputBig, ImageState imgState, Image logo) - { - // imgOutputBig - if (!(picSettings.LogoAggiungi == true & File.Exists(picSettings.LogoNomeFile))) return; - // using var ImmagineLogo = Image.FromFile(_picSettings.LogoNomeFile); - - var logoColoreTrasparente = Color.White; - - // * Load this Bitmap into a new Graphic Object - using var grWatermark = Graphics.FromImage(imgOutputBig); - using ImageAttributes imageAttributes = new ImageAttributes(); - - // * The first step replace the background color with one that is transparent (Alpha=0, R=0, G=0, B=0) - var colorMap = new ColorMap - { - // * background this will be the color we search for and replace with transparency - OldColor = logoColoreTrasparente, - NewColor = Color.FromArgb(0, 0, 0, 0) - }; - - var remapTable = new[] { colorMap }; - 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 - var 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 } - }; - var wmColorMatrix = new ColorMatrix(colorMatrixElements); - imageAttributes.SetColorMatrix(wmColorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap); - - var fotoLogoH = picSettings.LogoAltezza; - var fotoLogoW = picSettings.LogoLarghezza; - var fattoreAlt = logo.Height / (double)fotoLogoH; - var fattoreLarg = logo.Width / (double)fotoLogoW; - var nuovaSize = fattoreLarg > fattoreAlt - ? NewthumbSize(logo.Width, logo.Height, fotoLogoW, "Larghezza") - : NewthumbSize(logo.Width, logo.Height, fotoLogoH, "Altezza"); - - var inPercentualeL = picSettings.LogoMargine.EndsWith('%'); - var margineL = System.Convert.ToInt32(picSettings.LogoMargine); - var margineUsato = - inPercentualeL ? System.Convert.ToInt32(imgOutputBig.Height * margineL / (double)100) : margineL; - - int xPosOfWm = 0; - int yPosOfWm = 0; - switch (picSettings.LogoPosizioneH.ToUpper()) - { - case "SINISTRA": - case "NESSUNA": - { - xPosOfWm = margineUsato; - break; - } - - case "CENTRO": - { - xPosOfWm = System.Convert.ToInt32((imgOutputBig.Width - nuovaSize.Width) / (double)2); - break; - } - - case "DESTRA": - { - xPosOfWm = ((imgOutputBig.Width - nuovaSize.Width) - margineUsato); - break; - } - } - - switch (picSettings.LogoPosizioneV.ToUpper()) - { - case "ALTO": - case "NESSUNA": - { - yPosOfWm = margineUsato; - break; - } - - case "CENTRO": - { - yPosOfWm = System.Convert.ToInt32((imgOutputBig.Height - nuovaSize.Height) / (double)2); - break; - } - - case "BASSO": - { - yPosOfWm = ((imgOutputBig.Height - nuovaSize.Height) - margineUsato); - break; - } - } - - grWatermark.DrawImage(logo, new Rectangle(xPosOfWm, yPosOfWm, nuovaSize.Width, nuovaSize.Height), 0, 0, - logo.Width, logo.Height, GraphicsUnit.Pixel, imageAttributes); - //grWatermark.Dispose(); - } - - - private void SalvaFoto(Bitmap imgOutputBig, ImageState imgState, ImageFormat thisFormat) - { - var fileName = Path.Combine(imgState.DestDir.FullName, imgState.NomeFileBig); - - using var image1Stream = new MemoryStream(); - if (picSettings.FotoGrandeDimOrigina == false) - { - // attenzione non controlla se è png - // imgOutputBig.Save(Path.Combine(_DestDir.FullName, "Temp_" & NomeFileBig), thisFormat) - if (thisFormat.Equals(ImageFormat.Jpeg)) - { - MakeImageCustomQuality(imgOutputBig, image1Stream); - } - //SalvaImmagineCustomQuality(imgOutputBig, Path.Combine(DestDir.FullName, "Temp_" + NomeFileBig), _picSettings.jpegQuality); - else - { - imgOutputBig.Save(image1Stream, thisFormat); - } - - //imgOutputBig.Save(Path.Combine(DestDir.FullName, "Temp_" + NomeFileBig), thisFormat); - image1Stream.Seek(0, SeekOrigin.Begin); - using var g2 = Image.FromStream(image1Stream); - imgState.ThumbSizeBig = g2.Width > g2.Height - ? NewthumbSize(g2.Width, g2.Height, picSettings.LarghezzaBig, "Larghezza") - : NewthumbSize(g2.Width, g2.Height, picSettings.AltezzaBig, "Altezza"); - using var imgOutputBig2 = new Bitmap(g2, imgState.ThumbSizeBig.Width, imgState.ThumbSizeBig.Height); - - if (!picSettings.OverwriteFiles && File.Exists(fileName)) - { - logger.LogInformation("Saltata foto {FileName}, esiste", fileName); - } - else - { - if (thisFormat.Equals(ImageFormat.Jpeg)) - SalvaImmagineCustomQuality(imgOutputBig2, fileName, picSettings.JpegQuality); - else - imgOutputBig2.Save(fileName, thisFormat); - } - } - else - { - if (!picSettings.OverwriteFiles && File.Exists(fileName)) - { - logger.LogInformation("Saltata foto {FileName}, esiste", fileName); - } - else - { - if (thisFormat.Equals(ImageFormat.Jpeg)) - SalvaImmagineCustomQuality(imgOutputBig, fileName, picSettings.JpegQuality); - else - imgOutputBig.Save(fileName, thisFormat); - } - } - - image1Stream.Seek(0, SeekOrigin.Begin); - - if (!picSettings.CreaMiniature) return; - if (!picSettings.AggiungiScritteMiniature) return; - - using var g1 = picSettings.FotoGrandeDimOrigina ? (Image)imgOutputBig.Clone() : Image.FromStream(image1Stream); - - using var imgOutputSmall = new Bitmap(g1, imgState.ThumbSizeSmall.Width, imgState.ThumbSizeSmall.Height); - - if (string.Equals(picSettings.DirectorySorgente, picSettings.DirectoryDestinazione, - StringComparison.OrdinalIgnoreCase)) - imgState.NomeFileSmall = imgState.NomeFileSmall.Substring(0, imgState.NomeFileSmall.Length - 4) + - picSettings.Codice + - imgState.NomeFileSmall.Substring(imgState.NomeFileSmall.Length - 4); - - var tnFileName = Path.Combine(imgState.DestDir.FullName, imgState.NomeFileSmall); - - if (!picSettings.OverwriteFiles && File.Exists(tnFileName)) - { - logger.LogInformation("Saltata miniatura foto {TnFileName}, esiste", tnFileName); - } - else - { - if (thisFormat.Equals(ImageFormat.Jpeg)) - SalvaImmagineCustomQuality(imgOutputSmall, tnFileName, picSettings.JpegQualityMin); - else - imgOutputSmall.Save(tnFileName, thisFormat); - } - } - - private void SalvaImmagineCustomQuality(Bitmap imageToSave, string nomeFileFinale, long quality) - { - var jgpEncoder = GetEncoder(ImageFormat.Jpeg); - var myEncoder = System.Drawing.Imaging.Encoder.Quality; - - using var myEncoderParameters = new EncoderParameters(1); - - var myEncoderParameter = new EncoderParameter(myEncoder, picSettings.JpegQuality); - myEncoderParameters.Param[0] = myEncoderParameter; - imageToSave.Save(nomeFileFinale, jgpEncoder, myEncoderParameters); - //imageToSave.Dispose(); - } - - private void MakeImageCustomQuality(Bitmap imageToSave, Stream destinationStream) - { - var jgpEncoder = GetEncoder(ImageFormat.Jpeg); - var myEncoder = System.Drawing.Imaging.Encoder.Quality; - - using var myEncoderParameters = new EncoderParameters(1); - - var myEncoderParameter = new EncoderParameter(myEncoder, picSettings.JpegQuality); - myEncoderParameters.Param[0] = myEncoderParameter; - destinationStream.Seek(0, SeekOrigin.Begin); - imageToSave.Save(destinationStream, jgpEncoder, myEncoderParameters); - //imageToSave.Dispose(); - } - - private ImageCodecInfo GetEncoder(ImageFormat format) - { - var codecs = ImageCodecInfo.GetImageDecoders(); - - foreach (var codec in codecs) - { - if (codec.FormatID == format.Guid) - return codec; - } - - return null /* TODO Change to default(_) if this is not a reference type */; - } - - /// - /// ''' Calculate the Size of the New image - /// ''' - /// ''' Larghezza - /// ''' Altezza - /// ''' - /// ''' - /// ''' - /// ''' - private Size NewthumbSize(int currentwidth, int currentheight, int maxPixel, string tipoSize) - { - // e - // *** Larghezza, Altezza, Auto - - double tempMultiplier; - - if (tipoSize.ToUpper() == "Larghezza".ToUpper()) - tempMultiplier = maxPixel / (double)currentwidth; - else if (tipoSize.ToUpper() == "Altezza".ToUpper()) - tempMultiplier = maxPixel / (double)currentheight; - else if (currentheight > currentwidth) - tempMultiplier = maxPixel / (double)currentheight; - else - tempMultiplier = maxPixel / (double)currentwidth; - - var newSize = new Size(System.Convert.ToInt32(currentwidth * tempMultiplier), - System.Convert.ToInt32(currentheight * tempMultiplier)); - - return newSize; - } -} \ No newline at end of file +} diff --git a/MaddoShared/MaddoShared.csproj b/MaddoShared/MaddoShared.csproj index ffb858a..4a37e7c 100644 --- a/MaddoShared/MaddoShared.csproj +++ b/MaddoShared/MaddoShared.csproj @@ -1,6 +1,6 @@  - net9.0-windows + net10.0-windows Library false true diff --git a/imagecatalog/ImageCatalog 2.csproj b/imagecatalog/ImageCatalog 2.csproj index 2d2ba7b..16182e5 100644 --- a/imagecatalog/ImageCatalog 2.csproj +++ b/imagecatalog/ImageCatalog 2.csproj @@ -1,7 +1,7 @@  WinExe - net9.0-windows + net10.0-windows enable enable true -- 2.52.0 From 0c1bb50dceaef6a6d879b52365896500699cca82 Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Wed, 4 Feb 2026 19:01:00 +0100 Subject: [PATCH 039/127] Added unit tests --- Catalog.sln | 21 +- MaddoShared.Tests/ImageCreatorSharpTests.cs | 232 ++++++++++++++++++++ MaddoShared.Tests/MSTestSettings.cs | 1 + MaddoShared.Tests/MaddoShared.Tests.csproj | 22 ++ MaddoShared.Tests/Test1.cs | 11 + 5 files changed, 285 insertions(+), 2 deletions(-) create mode 100644 MaddoShared.Tests/ImageCreatorSharpTests.cs create mode 100644 MaddoShared.Tests/MSTestSettings.cs create mode 100644 MaddoShared.Tests/MaddoShared.Tests.csproj create mode 100644 MaddoShared.Tests/Test1.cs diff --git a/Catalog.sln b/Catalog.sln index 08396d6..958365d 100644 --- a/Catalog.sln +++ b/Catalog.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.11.35312.102 +# Visual Studio Version 18 +VisualStudioVersion = 18.2.11415.280 d18.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ImageCatalog 2", "imagecatalog\ImageCatalog 2.csproj", "{3F1E23DB-435E-0590-1EF5-735E898DBA3C}" EndProject @@ -9,6 +9,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MaddoShared", "MaddoShared\MaddoShared.csproj", "{AEBFE9E3-277C-4A7B-8448-145D1B11998B}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{5F0BEF23-B1EA-4100-A772-DC455D40B1C1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MaddoShared.Tests", "MaddoShared.Tests\MaddoShared.Tests.csproj", "{59952BE8-20B4-4BF2-9367-705F41395265}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -43,12 +47,25 @@ Global {AEBFE9E3-277C-4A7B-8448-145D1B11998B}.Release|x64.Build.0 = Release|Any CPU {AEBFE9E3-277C-4A7B-8448-145D1B11998B}.Release|x86.ActiveCfg = Release|Any CPU {AEBFE9E3-277C-4A7B-8448-145D1B11998B}.Release|x86.Build.0 = Release|Any CPU + {59952BE8-20B4-4BF2-9367-705F41395265}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {59952BE8-20B4-4BF2-9367-705F41395265}.Debug|Any CPU.Build.0 = Debug|Any CPU + {59952BE8-20B4-4BF2-9367-705F41395265}.Debug|x64.ActiveCfg = Debug|Any CPU + {59952BE8-20B4-4BF2-9367-705F41395265}.Debug|x64.Build.0 = Debug|Any CPU + {59952BE8-20B4-4BF2-9367-705F41395265}.Debug|x86.ActiveCfg = Debug|Any CPU + {59952BE8-20B4-4BF2-9367-705F41395265}.Debug|x86.Build.0 = Debug|Any CPU + {59952BE8-20B4-4BF2-9367-705F41395265}.Release|Any CPU.ActiveCfg = Release|Any CPU + {59952BE8-20B4-4BF2-9367-705F41395265}.Release|Any CPU.Build.0 = Release|Any CPU + {59952BE8-20B4-4BF2-9367-705F41395265}.Release|x64.ActiveCfg = Release|Any CPU + {59952BE8-20B4-4BF2-9367-705F41395265}.Release|x64.Build.0 = Release|Any CPU + {59952BE8-20B4-4BF2-9367-705F41395265}.Release|x86.ActiveCfg = Release|Any CPU + {59952BE8-20B4-4BF2-9367-705F41395265}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {AEBFE9E3-277C-4A7B-8448-145D1B11998B} = {A3D50937-74F6-4DC8-8D89-B534B484C0F9} + {59952BE8-20B4-4BF2-9367-705F41395265} = {5F0BEF23-B1EA-4100-A772-DC455D40B1C1} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {0E3ABC63-8601-4DAC-AFEA-33F3E8E36757} diff --git a/MaddoShared.Tests/ImageCreatorSharpTests.cs b/MaddoShared.Tests/ImageCreatorSharpTests.cs new file mode 100644 index 0000000..442e013 --- /dev/null +++ b/MaddoShared.Tests/ImageCreatorSharpTests.cs @@ -0,0 +1,232 @@ +using System; +using System.Drawing; +using System.Drawing.Imaging; +using System.IO; +using System.Reflection; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.Extensions.Logging; +using Moq; +using FluentAssertions; +using MaddoShared; + +namespace MaddoShared.Tests +{ + [TestClass] + public class ImageCreatorSharpTests + { + private ImageCreatorSharp CreateService(Action customize = null) + { + var settings = new PicSettings + { + DimStandard = 20, + DimStandardMiniatura = 10, + LarghezzaSmall = 100, + AltezzaSmall = 100, + LarghezzaBig = 800, + AltezzaBig = 600, + Trasparenza = 50, + IlFont = "Arial", + Grassetto = false, + Posizione = "CENTRO", + Allineamento = "CENTRO", + Margine = 10, + MargVert = 10, + TestoMin = false, + AggNumTempMin = false + }; + + customize?.Invoke(settings); + + var logger = new Mock>().Object; + return new ImageCreatorSharp(settings, logger); + } + + [TestMethod] + public void CalculateThumbnailSize_Larghezza_UsesWidthScaling() + { + var svc = CreateService(); + var mi = svc.GetType().GetMethod("CalculateThumbnailSize", BindingFlags.NonPublic | BindingFlags.Instance); + mi.Should().NotBeNull(); + + var size = (Size)mi.Invoke(svc, new object[] { 400, 200, 200, "Larghezza" }); + + size.Width.Should().Be(200); + size.Height.Should().Be(100); + } + + [TestMethod] + public void CalculateThumbnailSize_Altezza_UsesHeightScaling() + { + var svc = CreateService(); + var mi = svc.GetType().GetMethod("CalculateThumbnailSize", BindingFlags.NonPublic | BindingFlags.Instance); + mi.Should().NotBeNull(); + + var size = (Size)mi.Invoke(svc, new object[] { 200, 400, 200, "Altezza" }); + + size.Width.Should().Be(100); + size.Height.Should().Be(200); + } + + [TestMethod] + public void IsSameDirectory_IsCaseInsensitive() + { + var svc = CreateService(); + var mi = svc.GetType().GetMethod("IsSameDirectory", BindingFlags.NonPublic | BindingFlags.Instance); + mi.Should().NotBeNull(); + + bool same = (bool)mi.Invoke(svc, new object[] { @"C:\Temp", @"c:\temp" }); + same.Should().BeTrue(); + + bool notSame = (bool)mi.Invoke(svc, new object[] { @"C:\TempA", @"c:\temp" }); + notSame.Should().BeFalse(); + } + + [TestMethod] + public void UpdateFilenameWithCode_InsertsCodeBeforeExtension() + { + var svc = CreateService(s => s.Codice = "_X"); + var mi = svc.GetType().GetMethod("UpdateFilenameWithCode", BindingFlags.NonPublic | BindingFlags.Instance); + mi.Should().NotBeNull(); + + var state = new ImageState { NomeFileSmall = "photo123.jpg" }; + mi.Invoke(svc, new object[] { state }); + + state.NomeFileSmall.Should().Be("photo123_X.jpg"); + } + + [DataTestMethod] + [DataRow("SINISTRA")] + [DataRow("CENTRO")] + [DataRow("DESTRA")] + public void CalculateHorizontalAlignment_RespectsAlignment(string alignment) + { + var svc = CreateService(s => { s.Allineamento = alignment; s.Margine = 20; }); + + var mi = svc.GetType().GetMethod("CalculateHorizontalAlignment", BindingFlags.NonPublic | BindingFlags.Instance); + mi.Should().NotBeNull(); + + var center = (float)mi.Invoke(svc, new object[] { 800, 100f }); + + if (alignment == "SINISTRA") + center.Should().BeInRange(0f, 400f, "Expected left alignment range"); + if (alignment == "DESTRA") + center.Should().BeInRange(400f, 800f, "Expected right alignment range"); + if (alignment == "CENTRO") + center.Should().BeApproximately(800 / 2f, 0.0001f); + } + + [TestMethod] + public void SetVerticalPosition_AltoAndBasso_SetExpectedValues() + { + var svc = CreateService(s => s.Posizione = "ALTO"); + var mi = svc.GetType().GetMethod("SetVerticalPosition", BindingFlags.NonPublic | BindingFlags.Instance); + mi.Should().NotBeNull(); + + var state = new ImageState(); + + // ALTO + mi.Invoke(svc, new object[] { 500, 20f, state }); + state.YPosFromBottom1.Should().Be(10f); + state.YPosFromBottom4.Should().Be(10f); + + // BASSO + state = new ImageState(); + svc = CreateService(s => { s.Posizione = "BASSO"; s.Margine = 10; s.MargVert = 5; }); + mi = svc.GetType().GetMethod("SetVerticalPosition", BindingFlags.NonPublic | BindingFlags.Instance); + mi.Invoke(svc, new object[] { 200, 20f, state }); + + var expected1 = (float)(200 - 20 - (200 * 10 / 100.0)); + var expected4 = (float)(200 - 20 - (200 * 5 / 100.0)); + state.YPosFromBottom1.Should().BeApproximately(expected1, 0.001f); + state.YPosFromBottom4.Should().BeApproximately(expected4, 0.001f); + } + + [TestMethod] + public void FormatTimeText_WithAndWithoutFileName_ProducesExpectedStrings() + { + var svc = CreateService(); + var mi = svc.GetType().GetMethod("FormatTimeText", BindingFlags.NonPublic | BindingFlags.Instance); + mi.Should().NotBeNull(); + + var state = new ImageState + { + NomeFileBig = "file.jpg", + TestoOrario = "T:", + DataPartenzaI = new DateTime(2024, 01, 01, 12, 0, 0), + DataFoto = new DateTime(2024, 01, 01, 11, 59, 0) + }; + var withoutName = (string)mi.Invoke(svc, new object[] { state, false }); + withoutName.Should().StartWith(Environment.NewLine); + withoutName.Should().Contain("T:"); + + var withName = (string)mi.Invoke(svc, new object[] { state, true }); + withName.Should().Contain("file.jpg"); + withName.Should().Contain("T:"); + withName.Should().Contain(Environment.NewLine); + } + + [TestMethod] + public void PrepareSignatureText_SetsSmallSignature_AccordingFlags() + { + var svc = CreateService(); + var miPrep = svc.GetType().GetMethod("PrepareSignatureText", BindingFlags.NonPublic | BindingFlags.Instance); + miPrep.Should().NotBeNull(); + + var state = new ImageState { NomeFileBig = "bigname.jpg" }; + + svc = CreateService(s => s.TestoMin = true); + miPrep.Invoke(svc, new object[] { state }); + state.TestoFirmaPiccola.Should().Be("bigname.jpg"); + + state.TestoFirmaPiccola = ""; + svc = CreateService(s => { s.TestoMin = false; s.AggNumTempMin = true; }); + miPrep.Invoke(svc, new object[] { state }); + state.TestoFirmaPiccola.Should().Be("bigname.jpg "); + } + + [TestMethod] + public void ShouldRenderText_ReturnsCorrectFlag() + { + var svc = CreateService(s => { s.UsaOrarioMiniatura = false; s.TestoMin = false; s.AggTempoGaraMin = false; s.AggNumTempMin = false; }); + var mi = svc.GetType().GetMethod("ShouldRenderText", BindingFlags.NonPublic | BindingFlags.Instance); + mi.Should().NotBeNull(); + + var res = (bool)mi.Invoke(svc, Array.Empty()); + res.Should().BeFalse(); + + svc = CreateService(s => s.TestoMin = true); + mi = svc.GetType().GetMethod("ShouldRenderText", BindingFlags.NonPublic | BindingFlags.Instance); + res = (bool)mi.Invoke(svc, Array.Empty()); + res.Should().BeTrue(); + } + + [TestMethod] + public void FindBestFontSize_And_AdjustFontToFitWidth_ModifySizes() + { + var svc = CreateService(s => { s.IlFont = "Arial"; s.DimStandardMiniatura = 30; }); + + using var bmp = new Bitmap(400, 100); + using var g = Graphics.FromImage(bmp); + + var miFind = svc.GetType().GetMethod("FindBestFontSize", BindingFlags.NonPublic | BindingFlags.Instance); + miFind.Should().NotBeNull(); + + int best = (int)miFind.Invoke(svc, new object[] { g, "A very long text that won't fit", "Arial", 40, false, 50, 5 }); + best.Should().BeInRange(5, 40); + + var miAdjust = svc.GetType().GetMethod("AdjustFontToFitWidth", BindingFlags.NonPublic | BindingFlags.Instance); + miAdjust.Should().NotBeNull(); + + var imageState = new ImageState { DimensioneStandardMiniatura = 30, TestoFirmaPiccola = "A very long test string" }; + var initialFont = new Font("Arial", imageState.DimensioneStandardMiniatura); + var textSize = g.MeasureString(imageState.TestoFirmaPiccola, initialFont); + + object[] parameters = new object[] { g, 50, imageState, textSize }; + miAdjust.Invoke(svc, parameters); + + var updatedSize = (SizeF)parameters[3]; + imageState.DimensioneStandardMiniatura.Should().BeLessOrEqualTo(30); + (updatedSize.Width <= 50 || imageState.DimensioneStandardMiniatura <= 5).Should().BeTrue(); + } + } +} diff --git a/MaddoShared.Tests/MSTestSettings.cs b/MaddoShared.Tests/MSTestSettings.cs new file mode 100644 index 0000000..aaf278c --- /dev/null +++ b/MaddoShared.Tests/MSTestSettings.cs @@ -0,0 +1 @@ +[assembly: Parallelize(Scope = ExecutionScope.MethodLevel)] diff --git a/MaddoShared.Tests/MaddoShared.Tests.csproj b/MaddoShared.Tests/MaddoShared.Tests.csproj new file mode 100644 index 0000000..d425a15 --- /dev/null +++ b/MaddoShared.Tests/MaddoShared.Tests.csproj @@ -0,0 +1,22 @@ + + + + net10.0-windows + latest + enable + enable + true + + + + + + + + + + + + + + diff --git a/MaddoShared.Tests/Test1.cs b/MaddoShared.Tests/Test1.cs new file mode 100644 index 0000000..cd00c92 --- /dev/null +++ b/MaddoShared.Tests/Test1.cs @@ -0,0 +1,11 @@ +namespace MaddoShared.Tests +{ + [TestClass] + public sealed class Test1 + { + [TestMethod] + public void TestMethod1() + { + } + } +} -- 2.52.0 From 1db874ce77e6ab89b89946acae38b8e7a9224aef Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Wed, 4 Feb 2026 19:48:03 +0100 Subject: [PATCH 040/127] Migration to MVVM --- imagecatalog/DataModel.cs | 628 +++++++++++++++++++++- imagecatalog/MainForm.Designer.cs | 159 ++---- imagecatalog/MainForm.cs | 620 ++++++--------------- imagecatalog/Program.cs | 1 + imagecatalog/Services/ISettingsService.cs | 10 + imagecatalog/Services/SettingsService.cs | 99 ++++ 6 files changed, 944 insertions(+), 573 deletions(-) create mode 100644 imagecatalog/Services/ISettingsService.cs create mode 100644 imagecatalog/Services/SettingsService.cs diff --git a/imagecatalog/DataModel.cs b/imagecatalog/DataModel.cs index 200f715..b64cbdd 100644 --- a/imagecatalog/DataModel.cs +++ b/imagecatalog/DataModel.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; +using System.Drawing.Text; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -15,25 +16,55 @@ namespace ImageCatalog_2 public class DataModel : ViewModelBase { public ICommand TestCommand { get; } - public ICommand AsyncTestCommand { get; } public ICommand AsyncCancelOperationCommand { get; } - public ICommand ProcessImagesCommand { get; } + public ICommand SelectSourceFolderCommand { get; } + public ICommand SelectDestinationFolderCommand { get; } + public ICommand SelectLogoFileCommand { get; } + public ICommand SaveSettingsCommand { get; } + public ICommand LoadSettingsCommand { get; } + public ICommand SelectColorCommand { get; } private readonly ITestService _service; private readonly ILogger _logger; + private readonly ISettingsService _settingsService; - public DataModel(ITestService testService, ILogger logger) + // ComboBox collections + public List AvailableFonts { get; } + public List VerticalPositions { get; } = new() { "Alto", "Centro", "Basso" }; + public List HorizontalAlignments { get; } = new() { "Sinistra", "Centro", "Destra" }; + + public DataModel(ITestService testService, ISettingsService settingsService, ILogger logger) { _service = testService; _logger = logger; + _settingsService = settingsService; TestCommand = new RelayCommand(Test); AsyncTestCommand = new AsyncCommand(TestAsync); AsyncCancelOperationCommand = new AsyncCommand(CancelOperation); - ProcessImagesCommand = new AsyncCommand(ProcessImages); + + SelectSourceFolderCommand = new RelayCommand(SelectSourceFolder); + SelectDestinationFolderCommand = new RelayCommand(SelectDestinationFolder); + SelectLogoFileCommand = new RelayCommand(SelectLogoFile); + SaveSettingsCommand = new RelayCommand(SaveSettings); + LoadSettingsCommand = new RelayCommand(LoadSettings); + SelectColorCommand = new RelayCommand(SelectColor); + + // Load available fonts + AvailableFonts = LoadAvailableFonts(); + } + + private List LoadAvailableFonts() + { + var fonts = new List(); + using (var installedFonts = new InstalledFontCollection()) + { + fonts.AddRange(installedFonts.Families.Select(f => f.Name)); + } + return fonts; } private CancellationTokenSource? _mainToken; @@ -158,6 +189,546 @@ namespace ImageCatalog_2 } } + // Thumbnail settings + private string _thumbnailPrefix = "tn_"; + public string ThumbnailPrefix + { + get => _thumbnailPrefix; + set + { + _thumbnailPrefix = value; + NotifyPropertyChanged(); + } + } + + private int _thumbnailHeight = 350; + public int ThumbnailHeight + { + get => _thumbnailHeight; + set + { + _thumbnailHeight = value; + NotifyPropertyChanged(); + } + } + + private int _thumbnailWidth = 350; + public int ThumbnailWidth + { + get => _thumbnailWidth; + set + { + _thumbnailWidth = value; + NotifyPropertyChanged(); + } + } + + // Big photo settings + private int _photoBigHeight = 2240; + public int PhotoBigHeight + { + get => _photoBigHeight; + set + { + _photoBigHeight = value; + NotifyPropertyChanged(); + } + } + + private int _photoBigWidth = 2240; + public int PhotoBigWidth + { + get => _photoBigWidth; + set + { + _photoBigWidth = value; + NotifyPropertyChanged(); + } + } + + // Font settings + private int _fontSize = 20; + public int FontSize + { + get => _fontSize; + set + { + _fontSize = value; + NotifyPropertyChanged(); + } + } + + private int _fontSizeThumbnail = 50; + public int FontSizeThumbnail + { + get => _fontSizeThumbnail; + set + { + _fontSizeThumbnail = value; + NotifyPropertyChanged(); + } + } + + private string _fontName = "Arial"; + public string FontName + { + get => _fontName; + set + { + _fontName = value; + NotifyPropertyChanged(); + } + } + + private bool _fontBold = false; + public bool FontBold + { + get => _fontBold; + set + { + _fontBold = value; + NotifyPropertyChanged(); + } + } + + // Text settings + private int _textTransparency = 0; + public int TextTransparency + { + get => _textTransparency; + set + { + _textTransparency = value; + NotifyPropertyChanged(); + } + } + + private int _textMargin = 8; + public int TextMargin + { + get => _textMargin; + set + { + _textMargin = value; + NotifyPropertyChanged(); + } + } + + private string _textColorRGB = "Yellow"; + public string TextColorRGB + { + get => _textColorRGB; + set + { + _textColorRGB = value; + NotifyPropertyChanged(); + } + } + + // Logo/Watermark settings + private string _logoFile = ""; + public string LogoFile + { + get => _logoFile; + set + { + _logoFile = value; + NotifyPropertyChanged(); + } + } + + private int _logoHeight = 430; + public int LogoHeight + { + get => _logoHeight; + set + { + _logoHeight = value; + NotifyPropertyChanged(); + } + } + + private int _logoWidth = 430; + public int LogoWidth + { + get => _logoWidth; + set + { + _logoWidth = value; + NotifyPropertyChanged(); + } + } + + private int _logoMargin = 290; + public int LogoMargin + { + get => _logoMargin; + set + { + _logoMargin = value; + NotifyPropertyChanged(); + } + } + + private int _logoTransparency = 100; + public int LogoTransparency + { + get => _logoTransparency; + set + { + _logoTransparency = value; + NotifyPropertyChanged(); + } + } + + // Folder division settings + private int _filesPerFolder = 99; + public int FilesPerFolder + { + get => _filesPerFolder; + set + { + _filesPerFolder = value; + NotifyPropertyChanged(); + } + } + + private string _folderSuffix = ""; + public string FolderSuffix + { + get => _folderSuffix; + set + { + _folderSuffix = value; + NotifyPropertyChanged(); + } + } + + private int _counterDigits = 2; + public int CounterDigits + { + get => _counterDigits; + set + { + _counterDigits = value; + NotifyPropertyChanged(); + } + } + + // Vertical text settings + private int _verticalTextSize = 20; + public int VerticalTextSize + { + get => _verticalTextSize; + set + { + _verticalTextSize = value; + NotifyPropertyChanged(); + } + } + + private int _verticalTextMargin = 6; + public int VerticalTextMargin + { + get => _verticalTextMargin; + set + { + _verticalTextMargin = value; + NotifyPropertyChanged(); + } + } + + // JPEG compression settings + private int _jpegQuality = 85; + public int JpegQuality + { + get => _jpegQuality; + set + { + _jpegQuality = value; + NotifyPropertyChanged(); + } + } + + private int _jpegQualityThumbnail = 30; + public int JpegQualityThumbnail + { + get => _jpegQualityThumbnail; + set + { + _jpegQualityThumbnail = value; + NotifyPropertyChanged(); + } + } + + // CheckBox settings + private bool _createThumbnails = true; + public bool CreateThumbnails + { + get => _createThumbnails; + set + { + _createThumbnails = value; + NotifyPropertyChanged(); + } + } + + private bool _automaticRotation; + public bool AutomaticRotation + { + get => _automaticRotation; + set + { + _automaticRotation = value; + NotifyPropertyChanged(); + } + } + + private bool _forceJpeg; + public bool ForceJpeg + { + get => _forceJpeg; + set + { + _forceJpeg = value; + NotifyPropertyChanged(); + } + } + + private bool _updateSubdirectories; + public bool UpdateSubdirectories + { + get => _updateSubdirectories; + set + { + _updateSubdirectories = value; + NotifyPropertyChanged(); + } + } + + private bool _createSubfolders; + public bool CreateSubfolders + { + get => _createSubfolders; + set + { + _createSubfolders = value; + NotifyPropertyChanged(); + } + } + + private bool _addTime; + public bool AddTime + { + get => _addTime; + set + { + _addTime = value; + NotifyPropertyChanged(); + } + } + + private bool _addRaceTime; + public bool AddRaceTime + { + get => _addRaceTime; + set + { + _addRaceTime = value; + NotifyPropertyChanged(); + } + } + + private bool _addLogo; + public bool AddLogo + { + get => _addLogo; + set + { + _addLogo = value; + NotifyPropertyChanged(); + } + } + + private bool _keepOriginalDimensions; + public bool KeepOriginalDimensions + { + get => _keepOriginalDimensions; + set + { + _keepOriginalDimensions = value; + NotifyPropertyChanged(); + } + } + + private bool _showDate; + public bool ShowDate + { + get => _showDate; + set + { + _showDate = value; + NotifyPropertyChanged(); + } + } + + private bool _showPhotoNumber; + public bool ShowPhotoNumber + { + get => _showPhotoNumber; + set + { + _showPhotoNumber = value; + NotifyPropertyChanged(); + } + } + + private bool _shutdownSystem; + public bool ShutdownSystem + { + get => _shutdownSystem; + set + { + _shutdownSystem = value; + NotifyPropertyChanged(); + } + } + + // ComboBox position/alignment settings + private string _verticalPosition = "Basso"; + public string VerticalPosition + { + get => _verticalPosition; + set + { + _verticalPosition = value; + NotifyPropertyChanged(); + } + } + + private string _horizontalAlignment = "Centro"; + public string HorizontalAlignment + { + get => _horizontalAlignment; + set + { + _horizontalAlignment = value; + NotifyPropertyChanged(); + } + } + + private string _logoHorizontalPosition = "Destra"; + public string LogoHorizontalPosition + { + get => _logoHorizontalPosition; + set + { + _logoHorizontalPosition = value; + NotifyPropertyChanged(); + } + } + + private string _logoVerticalPosition = "Basso"; + public string LogoVerticalPosition + { + get => _logoVerticalPosition; + set + { + _logoVerticalPosition = value; + NotifyPropertyChanged(); + } + } + + // RadioButton settings + private bool _useProgressiveNumbering = true; + public bool UseProgressiveNumbering + { + get => _useProgressiveNumbering; + set + { + _useProgressiveNumbering = value; + NotifyPropertyChanged(); + } + } + + private bool _useFileNumbering; + public bool UseFileNumbering + { + get => _useFileNumbering; + set + { + _useFileNumbering = value; + NotifyPropertyChanged(); + } + } + + private bool _useParallelProcessing = true; + public bool UseParallelProcessing + { + get => _useParallelProcessing; + set + { + _useParallelProcessing = value; + NotifyPropertyChanged(); + } + } + + private bool _useSequentialProcessing; + public bool UseSequentialProcessing + { + get => _useSequentialProcessing; + set + { + _useSequentialProcessing = value; + NotifyPropertyChanged(); + } + } + + // Additional settings that were missing + private bool _addTimeToThumbnails; + public bool AddTimeToThumbnails + { + get => _addTimeToThumbnails; + set + { + _addTimeToThumbnails = value; + NotifyPropertyChanged(); + } + } + + private bool _showFileNameOnThumbnails; + public bool ShowFileNameOnThumbnails + { + get => _showFileNameOnThumbnails; + set + { + _showFileNameOnThumbnails = value; + NotifyPropertyChanged(); + } + } + + private DateTime _raceStartDate = DateTime.Now; + public DateTime RaceStartDate + { + get => _raceStartDate; + set + { + _raceStartDate = value; + NotifyPropertyChanged(); + } + } + + private string _timeLabel = ""; + public string TimeLabel + { + get => _timeLabel; + set + { + _timeLabel = value; + NotifyPropertyChanged(); + } + } + private void Test(object parameter) { Debug.WriteLine("Yep"); @@ -187,5 +758,54 @@ namespace ImageCatalog_2 _logger.LogInformation("Ignora questo errore"); } } + + // Note: These commands will trigger events that the View will handle to show dialogs + // since dialogs require UI context + public event EventHandler SelectSourceFolderRequested; + public event EventHandler SelectDestinationFolderRequested; + public event EventHandler SelectLogoFileRequested; + public event EventHandler SaveSettingsRequested; + public event EventHandler LoadSettingsRequested; + public event EventHandler SelectColorRequested; + + private void SelectSourceFolder(object parameter) + { + SelectSourceFolderRequested?.Invoke(this, EventArgs.Empty); + } + + private void SelectDestinationFolder(object parameter) + { + SelectDestinationFolderRequested?.Invoke(this, EventArgs.Empty); + } + + private void SelectLogoFile(object parameter) + { + SelectLogoFileRequested?.Invoke(this, EventArgs.Empty); + } + + private void SaveSettings(object parameter) + { + SaveSettingsRequested?.Invoke(this, null); + } + + private void LoadSettings(object parameter) + { + LoadSettingsRequested?.Invoke(this, null); + } + + private void SelectColor(object parameter) + { + SelectColorRequested?.Invoke(this, EventArgs.Empty); + } + + public async Task SaveSettingsToFileAsync(string filePath) + { + await _settingsService.SaveSettingsAsync(filePath, this); + } + + public async Task LoadSettingsFromFileAsync(string filePath) + { + await _settingsService.LoadSettingsAsync(filePath, this); + } } } \ No newline at end of file diff --git a/imagecatalog/MainForm.Designer.cs b/imagecatalog/MainForm.Designer.cs index af40a39..79fafe8 100644 --- a/imagecatalog/MainForm.Designer.cs +++ b/imagecatalog/MainForm.Designer.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics; using System.Drawing; using System.Runtime.CompilerServices; @@ -221,6 +221,7 @@ namespace ImageCatalog // // CheckBox22 // + CheckBox22.DataBindings.Add(new Binding("Checked", bindingSource1, "ShutdownSystem", true, DataSourceUpdateMode.OnPropertyChanged)); CheckBox22.AutoSize = true; CheckBox22.Location = new Point(1168, 882); CheckBox22.Margin = new Padding(6, 8, 6, 8); @@ -350,6 +351,7 @@ namespace ImageCatalog // // rdbNuovoMetodo // + rdbNuovoMetodo.DataBindings.Add(new Binding("Checked", bindingSource1, "UseParallelProcessing", true, DataSourceUpdateMode.OnPropertyChanged)); rdbNuovoMetodo.AutoSize = true; rdbNuovoMetodo.Checked = true; rdbNuovoMetodo.Location = new Point(18, 69); @@ -363,6 +365,7 @@ namespace ImageCatalog // // rdbVecchioMetodo // + rdbVecchioMetodo.DataBindings.Add(new Binding("Checked", bindingSource1, "UseSequentialProcessing", true, DataSourceUpdateMode.OnPropertyChanged)); rdbVecchioMetodo.AutoSize = true; rdbVecchioMetodo.Location = new Point(18, 10); rdbVecchioMetodo.Margin = new Padding(6, 8, 6, 8); @@ -413,6 +416,7 @@ namespace ImageCatalog // // chkAggiornaSottodirectory // + chkAggiornaSottodirectory.DataBindings.Add(new Binding("Checked", bindingSource1, "UpdateSubdirectories", true, DataSourceUpdateMode.OnPropertyChanged)); chkAggiornaSottodirectory.ForeColor = Color.Black; chkAggiornaSottodirectory.Location = new Point(174, 157); chkAggiornaSottodirectory.Margin = new Padding(6, 8, 6, 8); @@ -429,7 +433,6 @@ namespace ImageCatalog _Button3.Size = new Size(52, 50); _Button3.TabIndex = 6; _Button3.Text = "..."; - _Button3.Click += Button3_Click; // // _Button2 // @@ -439,7 +442,6 @@ namespace ImageCatalog _Button2.Size = new Size(52, 50); _Button2.TabIndex = 5; _Button2.Text = "..."; - _Button2.Click += Button2_Click; // // Label1 // @@ -506,6 +508,7 @@ namespace ImageCatalog // // rdbNumFiles // + rdbNumFiles.DataBindings.Add(new Binding("Checked", bindingSource1, "UseFileNumbering", true, DataSourceUpdateMode.OnPropertyChanged)); rdbNumFiles.ForeColor = Color.Black; rdbNumFiles.Location = new Point(70, 315); rdbNumFiles.Margin = new Padding(6, 8, 6, 8); @@ -516,6 +519,7 @@ namespace ImageCatalog // // rdbNumProgressiva // + rdbNumProgressiva.DataBindings.Add(new Binding("Checked", bindingSource1, "UseProgressiveNumbering", true, DataSourceUpdateMode.OnPropertyChanged)); rdbNumProgressiva.Checked = true; rdbNumProgressiva.ForeColor = Color.Black; rdbNumProgressiva.Location = new Point(70, 275); @@ -528,6 +532,7 @@ namespace ImageCatalog // // txtCifreContatore // + txtCifreContatore.DataBindings.Add(new Binding("Text", bindingSource1, "CounterDigits", true, DataSourceUpdateMode.OnPropertyChanged)); txtCifreContatore.Location = new Point(278, 216); txtCifreContatore.Margin = new Padding(6, 8, 6, 8); txtCifreContatore.Name = "txtCifreContatore"; @@ -548,6 +553,7 @@ namespace ImageCatalog // // txtSuffissoCartelle // + txtSuffissoCartelle.DataBindings.Add(new Binding("Text", bindingSource1, "FolderSuffix", true, DataSourceUpdateMode.OnPropertyChanged)); txtSuffissoCartelle.Location = new Point(122, 157); txtSuffissoCartelle.Margin = new Padding(6, 8, 6, 8); txtSuffissoCartelle.Name = "txtSuffissoCartelle"; @@ -577,6 +583,7 @@ namespace ImageCatalog // // chkCreaSottocartelle // + chkCreaSottocartelle.DataBindings.Add(new Binding("Checked", bindingSource1, "CreateSubfolders", true, DataSourceUpdateMode.OnPropertyChanged)); chkCreaSottocartelle.ForeColor = Color.Black; chkCreaSottocartelle.Location = new Point(122, 40); chkCreaSottocartelle.Margin = new Padding(6, 8, 6, 8); @@ -587,6 +594,7 @@ namespace ImageCatalog // // txtFilePerCartella // + txtFilePerCartella.DataBindings.Add(new Binding("Text", bindingSource1, "FilesPerFolder", true, DataSourceUpdateMode.OnPropertyChanged)); txtFilePerCartella.Location = new Point(122, 99); txtFilePerCartella.Margin = new Padding(6, 8, 6, 8); txtFilePerCartella.Name = "txtFilePerCartella"; @@ -633,6 +641,7 @@ namespace ImageCatalog // // chkRotazioneAutomatica // + chkRotazioneAutomatica.DataBindings.Add(new Binding("Checked", bindingSource1, "AutomaticRotation", true, DataSourceUpdateMode.OnPropertyChanged)); chkRotazioneAutomatica.ForeColor = Color.Black; chkRotazioneAutomatica.Location = new Point(34, 96); chkRotazioneAutomatica.Margin = new Padding(6, 8, 6, 8); @@ -643,6 +652,7 @@ namespace ImageCatalog // // chkForzaJpg // + chkForzaJpg.DataBindings.Add(new Binding("Checked", bindingSource1, "ForceJpeg", true, DataSourceUpdateMode.OnPropertyChanged)); chkForzaJpg.Checked = true; chkForzaJpg.CheckState = CheckState.Checked; chkForzaJpg.ForeColor = Color.Black; @@ -705,6 +715,7 @@ namespace ImageCatalog // // TextBox31 // + TextBox31.DataBindings.Add(new Binding("Text", bindingSource1, "VerticalTextMargin", true, DataSourceUpdateMode.OnPropertyChanged)); TextBox31.Location = new Point(284, 114); TextBox31.Margin = new Padding(6, 8, 6, 8); TextBox31.Name = "TextBox31"; @@ -713,6 +724,7 @@ namespace ImageCatalog // // TextBox30 // + TextBox30.DataBindings.Add(new Binding("Text", bindingSource1, "VerticalTextSize", true, DataSourceUpdateMode.OnPropertyChanged)); TextBox30.Location = new Point(284, 54); TextBox30.Margin = new Padding(6, 8, 6, 8); TextBox30.Name = "TextBox30"; @@ -734,6 +746,7 @@ namespace ImageCatalog // // CheckBox17 // + CheckBox17.DataBindings.Add(new Binding("Checked", bindingSource1, "ShowPhotoNumber", true, DataSourceUpdateMode.OnPropertyChanged)); CheckBox17.AutoSize = true; CheckBox17.Location = new Point(208, 45); CheckBox17.Margin = new Padding(6, 8, 6, 8); @@ -745,6 +758,7 @@ namespace ImageCatalog // // CheckBox16 // + CheckBox16.DataBindings.Add(new Binding("Checked", bindingSource1, "ShowDate", true, DataSourceUpdateMode.OnPropertyChanged)); CheckBox16.AutoSize = true; CheckBox16.Location = new Point(13, 46); CheckBox16.Margin = new Padding(6, 8, 6, 8); @@ -778,6 +792,7 @@ namespace ImageCatalog // // TextBox34 // + TextBox34.DataBindings.Add(new Binding("Text", bindingSource1, "TextColorRGB", true, DataSourceUpdateMode.OnPropertyChanged)); TextBox34.Location = new Point(346, 224); TextBox34.Margin = new Padding(6, 8, 6, 8); TextBox34.Name = "TextBox34"; @@ -794,7 +809,6 @@ namespace ImageCatalog _Button8.Size = new Size(161, 59); _Button8.TabIndex = 35; _Button8.Text = "Scegli..."; - _Button8.Click += Button8_Click; // // Label36 // @@ -809,6 +823,7 @@ namespace ImageCatalog // // TextBox25 // + TextBox25.DataBindings.Add(new Binding("Text", bindingSource1, "FontSizeThumbnail", true, DataSourceUpdateMode.OnPropertyChanged)); TextBox25.Location = new Point(346, 146); TextBox25.Margin = new Padding(6, 8, 6, 8); TextBox25.Name = "TextBox25"; @@ -829,6 +844,7 @@ namespace ImageCatalog // // ComboBox3 // + ComboBox3.DataBindings.Add(new Binding("Text", bindingSource1, "FontName", true, DataSourceUpdateMode.OnPropertyChanged)); ComboBox3.Location = new Point(208, 19); ComboBox3.Margin = new Padding(6, 8, 6, 8); ComboBox3.Name = "ComboBox3"; @@ -838,6 +854,7 @@ namespace ImageCatalog // // TextBox11 // + TextBox11.DataBindings.Add(new Binding("Text", bindingSource1, "FontSize", true, DataSourceUpdateMode.OnPropertyChanged)); TextBox11.Location = new Point(346, 86); TextBox11.Margin = new Padding(6, 8, 6, 8); TextBox11.Name = "TextBox11"; @@ -870,6 +887,7 @@ namespace ImageCatalog // // CheckBox3 // + CheckBox3.DataBindings.Add(new Binding("Checked", bindingSource1, "FontBold", true, DataSourceUpdateMode.OnPropertyChanged)); CheckBox3.ForeColor = Color.Black; CheckBox3.Location = new Point(486, 19); CheckBox3.Margin = new Padding(6, 8, 6, 8); @@ -957,6 +975,7 @@ namespace ImageCatalog // // CheckBox8 // + CheckBox8.DataBindings.Add(new Binding("Checked", bindingSource1, "AddTime", true, DataSourceUpdateMode.OnPropertyChanged)); CheckBox8.ForeColor = Color.Black; CheckBox8.Location = new Point(156, 384); CheckBox8.Margin = new Padding(6, 8, 6, 8); @@ -967,6 +986,7 @@ namespace ImageCatalog // // TextBox9 // + TextBox9.DataBindings.Add(new Binding("Text", bindingSource1, "TextTransparency", true, DataSourceUpdateMode.OnPropertyChanged)); TextBox9.Location = new Point(260, 266); TextBox9.Margin = new Padding(6, 8, 6, 8); TextBox9.Name = "TextBox9"; @@ -976,6 +996,7 @@ namespace ImageCatalog // // CheckBox7 // + CheckBox7.DataBindings.Add(new Binding("Checked", bindingSource1, "AddRaceTime", true, DataSourceUpdateMode.OnPropertyChanged)); CheckBox7.ForeColor = Color.Black; CheckBox7.Location = new Point(294, 384); CheckBox7.Margin = new Padding(6, 8, 6, 8); @@ -1028,6 +1049,7 @@ namespace ImageCatalog // // ComboBox1 // + ComboBox1.DataBindings.Add(new Binding("Text", bindingSource1, "VerticalPosition", true, DataSourceUpdateMode.OnPropertyChanged)); ComboBox1.Location = new Point(156, 325); ComboBox1.Margin = new Padding(6, 8, 6, 8); ComboBox1.Name = "ComboBox1"; @@ -1037,6 +1059,7 @@ namespace ImageCatalog // // ComboBox2 // + ComboBox2.DataBindings.Add(new Binding("Text", bindingSource1, "HorizontalAlignment", true, DataSourceUpdateMode.OnPropertyChanged)); ComboBox2.Location = new Point(814, 325); ComboBox2.Margin = new Padding(6, 8, 6, 8); ComboBox2.Name = "ComboBox2"; @@ -1057,6 +1080,7 @@ namespace ImageCatalog // // TextBox12 // + TextBox12.DataBindings.Add(new Binding("Text", bindingSource1, "TextMargin", true, DataSourceUpdateMode.OnPropertyChanged)); TextBox12.Location = new Point(814, 266); TextBox12.Margin = new Padding(6, 8, 6, 8); TextBox12.Name = "TextBox12"; @@ -1120,6 +1144,7 @@ namespace ImageCatalog // // TextBox32 // + TextBox32.DataBindings.Add(new Binding("Text", bindingSource1, "JpegQuality", true, DataSourceUpdateMode.OnPropertyChanged)); TextBox32.Location = new Point(156, 197); TextBox32.Margin = new Padding(6, 8, 6, 8); TextBox32.Name = "TextBox32"; @@ -1160,6 +1185,7 @@ namespace ImageCatalog // // TextBox27 // + TextBox27.DataBindings.Add(new Binding("Text", bindingSource1, "PhotoBigWidth", true, DataSourceUpdateMode.OnPropertyChanged)); TextBox27.Location = new Point(156, 59); TextBox27.Margin = new Padding(6, 8, 6, 8); TextBox27.Name = "TextBox27"; @@ -1180,6 +1206,7 @@ namespace ImageCatalog // // TextBox28 // + TextBox28.DataBindings.Add(new Binding("Text", bindingSource1, "PhotoBigHeight", true, DataSourceUpdateMode.OnPropertyChanged)); TextBox28.Location = new Point(156, 118); TextBox28.Margin = new Padding(6, 8, 6, 8); TextBox28.Name = "TextBox28"; @@ -1189,6 +1216,7 @@ namespace ImageCatalog // // CheckBox15 // + CheckBox15.DataBindings.Add(new Binding("Checked", bindingSource1, "KeepOriginalDimensions", true, DataSourceUpdateMode.OnPropertyChanged)); CheckBox15.Checked = true; CheckBox15.CheckState = CheckState.Checked; CheckBox15.ForeColor = Color.Black; @@ -1234,7 +1262,6 @@ namespace ImageCatalog _CheckBox18.TabIndex = 36; _CheckBox18.Text = "Numero foto"; _CheckBox18.UseVisualStyleBackColor = true; - _CheckBox18.CheckedChanged += CheckBox18_CheckedChanged; // // _CheckBox4 // @@ -1245,7 +1272,6 @@ namespace ImageCatalog _CheckBox4.Size = new Size(226, 42); _CheckBox4.TabIndex = 34; _CheckBox4.Text = "Aggiungi scritta"; - _CheckBox4.CheckedChanged += CheckBox4_CheckedChanged; // // _CheckBox12 // @@ -1256,7 +1282,6 @@ namespace ImageCatalog _CheckBox12.Size = new Size(226, 51); _CheckBox12.TabIndex = 35; _CheckBox12.Text = "Aggiungi orario"; - _CheckBox12.CheckedChanged += CheckBox12_CheckedChanged; // // GroupBox1 // @@ -1292,6 +1317,7 @@ namespace ImageCatalog // // TextBox33 // + TextBox33.DataBindings.Add(new Binding("Text", bindingSource1, "JpegQualityThumbnail", true, DataSourceUpdateMode.OnPropertyChanged)); TextBox33.Location = new Point(528, 99); TextBox33.Margin = new Padding(6, 8, 6, 8); TextBox33.Name = "TextBox33"; @@ -1384,6 +1410,7 @@ namespace ImageCatalog // // TextBox5 // + TextBox5.DataBindings.Add(new Binding("Text", bindingSource1, "ThumbnailWidth", true, DataSourceUpdateMode.OnPropertyChanged)); TextBox5.Location = new Point(156, 157); TextBox5.Margin = new Padding(6, 8, 6, 8); TextBox5.Name = "TextBox5"; @@ -1404,6 +1431,7 @@ namespace ImageCatalog // // TextBox6 // + TextBox6.DataBindings.Add(new Binding("Text", bindingSource1, "ThumbnailHeight", true, DataSourceUpdateMode.OnPropertyChanged)); TextBox6.Location = new Point(156, 216); TextBox6.Margin = new Padding(6, 8, 6, 8); TextBox6.Name = "TextBox6"; @@ -1424,6 +1452,7 @@ namespace ImageCatalog // // TextBox3 // + TextBox3.DataBindings.Add(new Binding("Text", bindingSource1, "ThumbnailPrefix", true, DataSourceUpdateMode.OnPropertyChanged)); TextBox3.Location = new Point(156, 99); TextBox3.Margin = new Padding(6, 8, 6, 8); TextBox3.Name = "TextBox3"; @@ -1433,6 +1462,7 @@ namespace ImageCatalog // // CheckBox1 // + CheckBox1.DataBindings.Add(new Binding("Checked", bindingSource1, "CreateThumbnails", true, DataSourceUpdateMode.OnPropertyChanged)); CheckBox1.ForeColor = Color.Black; CheckBox1.Location = new Point(156, 40); CheckBox1.Margin = new Padding(6, 8, 6, 8); @@ -1505,11 +1535,10 @@ namespace ImageCatalog _PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; _PictureBox1.TabIndex = 43; _PictureBox1.TabStop = false; - _PictureBox1.MouseMove += PictureBox1_MouseMove; - _PictureBox1.MouseUp += PictureBox1_MouseUp; // // ComboBox5 // + ComboBox5.DataBindings.Add(new Binding("Text", bindingSource1, "LogoVerticalPosition", true, DataSourceUpdateMode.OnPropertyChanged)); ComboBox5.Location = new Point(312, 413); ComboBox5.Margin = new Padding(6, 8, 6, 8); ComboBox5.Name = "ComboBox5"; @@ -1519,6 +1548,7 @@ namespace ImageCatalog // // ComboBox4 // + ComboBox4.DataBindings.Add(new Binding("Text", bindingSource1, "LogoHorizontalPosition", true, DataSourceUpdateMode.OnPropertyChanged)); ComboBox4.Location = new Point(312, 355); ComboBox4.Margin = new Padding(6, 8, 6, 8); ComboBox4.Name = "ComboBox4"; @@ -1528,6 +1558,7 @@ namespace ImageCatalog // // TextBox19 // + TextBox19.DataBindings.Add(new Binding("Text", bindingSource1, "LogoTransparency", true, DataSourceUpdateMode.OnPropertyChanged)); TextBox19.Location = new Point(312, 237); TextBox19.Margin = new Padding(6, 8, 6, 8); TextBox19.Name = "TextBox19"; @@ -1548,6 +1579,7 @@ namespace ImageCatalog // // CheckBox5 // + CheckBox5.DataBindings.Add(new Binding("Checked", bindingSource1, "AddLogo", true, DataSourceUpdateMode.OnPropertyChanged)); CheckBox5.ForeColor = Color.Black; CheckBox5.Location = new Point(0, 64); CheckBox5.Margin = new Padding(6, 8, 6, 8); @@ -1558,6 +1590,7 @@ namespace ImageCatalog // // TextBox15 // + TextBox15.DataBindings.Add(new Binding("Text", bindingSource1, "LogoHeight", true, DataSourceUpdateMode.OnPropertyChanged)); TextBox15.Location = new Point(312, 178); TextBox15.Margin = new Padding(6, 8, 6, 8); TextBox15.Name = "TextBox15"; @@ -1567,6 +1600,7 @@ namespace ImageCatalog // // TextBox14 // + TextBox14.DataBindings.Add(new Binding("Text", bindingSource1, "LogoWidth", true, DataSourceUpdateMode.OnPropertyChanged)); TextBox14.Location = new Point(312, 118); TextBox14.Margin = new Padding(6, 8, 6, 8); TextBox14.Name = "TextBox14"; @@ -1588,6 +1622,7 @@ namespace ImageCatalog // // TextBox16 // + TextBox16.DataBindings.Add(new Binding("Text", bindingSource1, "LogoMargin", true, DataSourceUpdateMode.OnPropertyChanged)); TextBox16.Location = new Point(312, 296); TextBox16.Margin = new Padding(6, 8, 6, 8); TextBox16.Name = "TextBox16"; @@ -1639,10 +1674,10 @@ namespace ImageCatalog _Button4.Size = new Size(52, 50); _Button4.TabIndex = 8; _Button4.Text = "..."; - _Button4.Click += Button4_Click; // // TextBox10 // + TextBox10.DataBindings.Add(new Binding("Text", bindingSource1, "LogoFile", true, DataSourceUpdateMode.OnPropertyChanged)); TextBox10.Location = new Point(312, 59); TextBox10.Margin = new Padding(6, 8, 6, 8); TextBox10.Name = "TextBox10"; @@ -1695,7 +1730,6 @@ namespace ImageCatalog _Label27.TabIndex = 62; _Label27.Text = "Versione 2.2 2021"; _Label27.TextAlign = ContentAlignment.MiddleRight; - _Label27.Click += Label27_Click; // // _Button7 // @@ -1719,7 +1753,6 @@ namespace ImageCatalog _Button5.Size = new Size(416, 78); _Button5.TabIndex = 60; _Button5.Text = "Salva impostazioni"; - _Button5.Click += Button5_Click; // // Label20 // @@ -1785,7 +1818,6 @@ namespace ImageCatalog _Button6.Size = new Size(416, 78); _Button6.TabIndex = 54; _Button6.Text = "Carica impostazioni"; - _Button6.Click += Button6_Click; // // _btnCreaCatalogoAsync // @@ -1894,16 +1926,7 @@ namespace ImageCatalog [MethodImpl(MethodImplOptions.Synchronized)] set { - if (_Button3 != null) - { - _Button3.Click -= Button3_Click; - } - _Button3 = value; - if (_Button3 != null) - { - _Button3.Click += Button3_Click; - } } } @@ -1920,16 +1943,7 @@ namespace ImageCatalog [MethodImpl(MethodImplOptions.Synchronized)] set { - if (_Button2 != null) - { - _Button2.Click -= Button2_Click; - } - _Button2 = value; - if (_Button2 != null) - { - _Button2.Click += Button2_Click; - } } } @@ -1975,16 +1989,7 @@ namespace ImageCatalog [MethodImpl(MethodImplOptions.Synchronized)] set { - if (_Button8 != null) - { - _Button8.Click -= Button8_Click; - } - _Button8 = value; - if (_Button8 != null) - { - _Button8.Click += Button8_Click; - } } } @@ -2040,16 +2045,7 @@ namespace ImageCatalog [MethodImpl(MethodImplOptions.Synchronized)] set { - if (_CheckBox18 != null) - { - _CheckBox18.CheckedChanged -= CheckBox18_CheckedChanged; - } - _CheckBox18 = value; - if (_CheckBox18 != null) - { - _CheckBox18.CheckedChanged += CheckBox18_CheckedChanged; - } } } @@ -2066,16 +2062,7 @@ namespace ImageCatalog [MethodImpl(MethodImplOptions.Synchronized)] set { - if (_CheckBox4 != null) - { - _CheckBox4.CheckedChanged -= CheckBox4_CheckedChanged; - } - _CheckBox4 = value; - if (_CheckBox4 != null) - { - _CheckBox4.CheckedChanged += CheckBox4_CheckedChanged; - } } } @@ -2092,16 +2079,7 @@ namespace ImageCatalog [MethodImpl(MethodImplOptions.Synchronized)] set { - if (_CheckBox12 != null) - { - _CheckBox12.CheckedChanged -= CheckBox12_CheckedChanged; - } - _CheckBox12 = value; - if (_CheckBox12 != null) - { - _CheckBox12.CheckedChanged += CheckBox12_CheckedChanged; - } } } @@ -2137,18 +2115,7 @@ namespace ImageCatalog [MethodImpl(MethodImplOptions.Synchronized)] set { - if (_PictureBox1 != null) - { - _PictureBox1.MouseMove -= PictureBox1_MouseMove; - _PictureBox1.MouseUp -= PictureBox1_MouseUp; - } - _PictureBox1 = value; - if (_PictureBox1 != null) - { - _PictureBox1.MouseMove += PictureBox1_MouseMove; - _PictureBox1.MouseUp += PictureBox1_MouseUp; - } } } @@ -2177,16 +2144,7 @@ namespace ImageCatalog [MethodImpl(MethodImplOptions.Synchronized)] set { - if (_Button4 != null) - { - _Button4.Click -= Button4_Click; - } - _Button4 = value; - if (_Button4 != null) - { - _Button4.Click += Button4_Click; - } } } @@ -2207,16 +2165,7 @@ namespace ImageCatalog [MethodImpl(MethodImplOptions.Synchronized)] set { - if (_Label27 != null) - { - _Label27.Click -= Label27_Click; - } - _Label27 = value; - if (_Label27 != null) - { - _Label27.Click += Label27_Click; - } } } @@ -2235,16 +2184,7 @@ namespace ImageCatalog [MethodImpl(MethodImplOptions.Synchronized)] set { - if (_Button5 != null) - { - _Button5.Click -= Button5_Click; - } - _Button5 = value; - if (_Button5 != null) - { - _Button5.Click += Button5_Click; - } } } @@ -2291,16 +2231,7 @@ namespace ImageCatalog [MethodImpl(MethodImplOptions.Synchronized)] set { - if (_Button6 != null) - { - _Button6.Click -= Button6_Click; - } - _Button6 = value; - if (_Button6 != null) - { - _Button6.Click += Button6_Click; - } } } diff --git a/imagecatalog/MainForm.cs b/imagecatalog/MainForm.cs index ee2c80e..d39e92d 100644 --- a/imagecatalog/MainForm.cs +++ b/imagecatalog/MainForm.cs @@ -37,29 +37,20 @@ public partial class MainForm _imageCreationService = imageCreationStuff; _parametriSetup = parametriSetup; _picSettings = picSettings; - _logger = logger; _logger.LogDebug("Start"); InitializeComponent(); - BindControls(); - - _Button3.Name = "Button3"; - _Button2.Name = "Button2"; - _Button8.Name = "Button8"; - _CheckBox18.Name = "CheckBox18"; - _CheckBox4.Name = "CheckBox4"; - _CheckBox12.Name = "CheckBox12"; - _PictureBox1.Name = "PictureBox1"; - _Button4.Name = "Button4"; - _Label27.Name = "Label27"; - _Button7.Name = "Button7"; - _Button5.Name = "Button5"; - //_btnCreaCatalogo.Name = "btnCreaCatalogo"; - _Button6.Name = "Button6"; - _btnCreaCatalogoAsync.Name = "btnCreaCatalogoAsync"; + + // Subscribe to DataModel events + Model.SelectSourceFolderRequested += OnSelectSourceFolderRequested; + Model.SelectDestinationFolderRequested += OnSelectDestinationFolderRequested; + Model.SelectLogoFileRequested += OnSelectLogoFileRequested; + Model.SaveSettingsRequested += OnSaveSettingsRequested; + Model.LoadSettingsRequested += OnLoadSettingsRequested; + Model.SelectColorRequested += OnSelectColorRequested; var version = Assembly.GetExecutingAssembly().GetName().Version; _Label27.Text = $"Version: {version.Major}.{version.Minor}.{version.Build}.{version.Revision}"; @@ -70,7 +61,13 @@ public partial class MainForm protected void BindControls() { - //txtSorgente.DataBindings.Add(new Binding("Text", SourcePath, "")); + // Wire up buttons to ViewModel commands + _Button2.Click += (s, e) => Model.SelectSourceFolderCommand.Execute(null); + _Button3.Click += (s, e) => Model.SelectDestinationFolderCommand.Execute(null); + _Button4.Click += (s, e) => Model.SelectLogoFileCommand.Execute(null); + _Button5.Click += (s, e) => Model.SaveSettingsCommand.Execute(null); + _Button6.Click += (s, e) => Model.LoadSettingsCommand.Execute(null); + _Button8.Click += (s, e) => Model.SelectColorCommand.Execute(null); } private event EventHandler> UiUpdateEvent; @@ -114,80 +111,25 @@ public partial class MainForm SetText(lblFotoTotaliNum, args.Item2.ToString()); } - private bool _waterSelectColor = false; - private ConcurrentBag _results; private void SetDefaults() { - //txtSorgente.Text = ""; - Model.SourcePath = string.Empty; - Model.DestinationPath = string.Empty; - TextBox3.Text = "tn_"; - Model.HorizontalText = ""; - TextBox5.Text = "350"; - TextBox6.Text = "350"; - TextBox27.Text = "2240"; - TextBox28.Text = "2240"; - TextBox9.Text = "0"; - TextBox11.Text = "20"; - TextBox12.Text = "8"; - // TextBox13.Text = "" - TextBox10.Text = ""; - TextBox14.Text = "430"; - TextBox15.Text = "430"; - TextBox16.Text = "290"; - txtFilePerCartella.Text = "99"; - TextBox19.Text = "100"; - txtSuffissoCartelle.Text = ""; - txtCifreContatore.Text = "2"; - TextBox25.Text = "50"; - TextBox26.Text = ""; - Model.ThreadsCount = 10; - Model.ChunkSize = 100; - TextBox34.Text = "Yellow"; - TextBox30.Text = "20"; - TextBox31.Text = "6"; - TextBox32.Text = "85"; - TextBox33.Text = "30"; - ComboBox1.Items.Add("Alto"); - ComboBox1.Items.Add("Basso"); - ComboBox1.SelectedIndex = 1; - ComboBox2.Items.Add("Sinistra"); - ComboBox2.Items.Add("Centro"); - ComboBox2.Items.Add("Destra"); - ComboBox2.SelectedIndex = 1; + // Model defaults are already set in DataModel constructor, just bind ComboBoxes + ComboBox1.DataSource = new List(Model.VerticalPositions); + ComboBox1.SelectedItem = Model.VerticalPosition; + + ComboBox2.DataSource = new List(Model.HorizontalAlignments); + ComboBox2.SelectedItem = Model.HorizontalAlignment; - // Create a obejct of InstalledFontCollection - var InstalledFonts = new InstalledFontCollection(); - // Gets the array of FontFamily objects associated with this FontCollection. - var fontfamilies = InstalledFonts.Families; + ComboBox3.DataSource = new List(Model.AvailableFonts); + ComboBox3.SelectedItem = Model.FontName; - // Populates font combobox with the font name - - foreach (FontFamily fontFamily in fontfamilies) - ComboBox3.Items.Add(fontFamily.Name); - ComboBox3.Text = ComboBox3.Items[0].ToString(); - - // ComboBox3.Items.Add("Arial") - // ComboBox3.Items.Add("Arial Black") - // ComboBox3.Items.Add("Arial Narrow") - // ComboBox3.Items.Add("Comic Sans MS") - // ComboBox3.Items.Add("Courier New") - // ComboBox3.Items.Add("System") - // ComboBox3.Items.Add("Times New Roman") - // ComboBox3.Items.Add("Verdana") - // ComboBox3.Items.Add("Wingdings") - // ComboBox3.SelectedIndex = 7 - - ComboBox4.Items.Add("Sinistra"); - ComboBox4.Items.Add("Centro"); - ComboBox4.Items.Add("Destra"); - ComboBox4.SelectedIndex = 2; - ComboBox5.Items.Add("Alto"); - ComboBox5.Items.Add("Centro"); - ComboBox5.Items.Add("Basso"); - ComboBox5.SelectedIndex = 2; + ComboBox4.DataSource = new List(Model.HorizontalAlignments); + ComboBox4.SelectedItem = Model.LogoHorizontalPosition; + + ComboBox5.DataSource = new List { "Alto", "Centro", "Basso" }; + ComboBox5.SelectedItem = Model.LogoVerticalPosition; } @@ -274,12 +216,10 @@ public partial class MainForm dialog.InitialDirectory = startingFolder; if (dialog.ShowDialog() != DialogResult.OK) return string.Empty; - var directoryScelta = FixPath(dialog.SelectedPath); // dialog.FileName; - - return directoryScelta; + return FixPath(dialog.SelectedPath); } - private void Button2_Click(object sender, EventArgs e) + private void OnSelectSourceFolderRequested(object sender, EventArgs e) { var dialogResult = SelectFolder(Model.SourcePath); if (!string.IsNullOrWhiteSpace(dialogResult)) @@ -288,7 +228,7 @@ public partial class MainForm } } - private void Button3_Click(object sender, EventArgs e) + private void OnSelectDestinationFolderRequested(object sender, EventArgs e) { var dialogResult = SelectFolder(Model.DestinationPath); if (!string.IsNullOrWhiteSpace(dialogResult)) @@ -297,283 +237,174 @@ public partial class MainForm } } - private void Button5_Click(object sender, EventArgs e) + private void OnSelectLogoFileRequested(object sender, EventArgs e) { - var SaveFileDlg = new SaveFileDialog(); - - // SaveFileDlg.InitialDirectory = "c:\" - SaveFileDlg.Filter = "Setup (*.xml)|*.xml|All valid files (*.*)|*.*"; - SaveFileDlg.FilterIndex = 0; - SaveFileDlg.RestoreDirectory = true; - if (DialogResult.OK != SaveFileDlg.ShowDialog()) return; - - var ilNome = SaveFileDlg.FileName; - _parametriSetup.NomeFileSetup = ilNome; - _parametriSetup.AggiornaParametro("DirSorgente", Model.SourcePath); - _parametriSetup.AggiornaParametro("DirDestinazione", Model.DestinationPath); - _parametriSetup.AggiornaParametro("DirSottoDirectory", chkAggiornaSottodirectory.Checked); - _parametriSetup.AggiornaParametro("DirDividiDestinazione", chkCreaSottocartelle.Checked); - _parametriSetup.AggiornaParametro("DirDividiNumFile", txtFilePerCartella.Text); - _parametriSetup.AggiornaParametro("DirDividiSuffisso", txtSuffissoCartelle.Text); - _parametriSetup.AggiornaParametro("DirDividiNumCifre", txtCifreContatore.Text); - if (rdbNumProgressiva.Checked == true) + var dialog = new OpenFileDialog(); + dialog.Filter = "Image Files|*.jpg;*.jpeg;*.png;*.bmp;*.gif"; + if (Model.LogoFile.Length > 0) { - _parametriSetup.AggiornaParametro("DirDividiTipoNumerazione", "Progressiva"); + dialog.FileName = Model.LogoFile; } - else + + if (dialog.ShowDialog() == DialogResult.OK) { - _parametriSetup.AggiornaParametro("DirDividiTipoNumerazione", "Files"); + Model.LogoFile = dialog.FileName; + UpdateLogoPictureBox(Model.LogoFile); } - - _parametriSetup.AggiornaParametro("MiniatureCrea", CheckBox1.Checked); - _parametriSetup.AggiornaParametro("MiniatureSuffisso", TextBox3.Text); - _parametriSetup.AggiornaParametro("MiniatureAltezza", TextBox5.Text); - _parametriSetup.AggiornaParametro("MiniatureLarghezza", TextBox6.Text); - _parametriSetup.AggiornaParametro("MiniatureAddScritta", RadioButton3.Checked); - _parametriSetup.AggiornaParametro("MiniatureAddOrario", RadioButton4.Checked); - _parametriSetup.AggiornaParametro("FotoAltezza", TextBox27.Text); - _parametriSetup.AggiornaParametro("FotoLarghezza", TextBox28.Text); - // SetupIni.AggiornaParametro("FotoCodice", TextBox13.Text) - // SetupIni.AggiornaParametro("FotoDimOriginali", CheckBox2.Checked) - - _parametriSetup.AggiornaParametro("FontDimensione", TextBox11.Text); - _parametriSetup.AggiornaParametro("FontDimensioneMiniatura", TextBox25.Text); - _parametriSetup.AggiornaParametro("FontBold", CheckBox3.Checked); - _parametriSetup.AggiornaParametro("FontNome", ComboBox3.Text); - _parametriSetup.AggiornaParametro("TestoTesto", Model.HorizontalText); - _parametriSetup.AggiornaParametro("TestoTrasparente", TextBox9.Text); - _parametriSetup.AggiornaParametro("TestoMargine", TextBox12.Text); - _parametriSetup.AggiornaParametro("TestoPosizione", ComboBox1.Text); - _parametriSetup.AggiornaParametro("TestoAllineamento", ComboBox2.Text); - _parametriSetup.AggiornaParametro("MarchioFile", TextBox10.Text); - _parametriSetup.AggiornaParametro("MarchioAltezza", TextBox14.Text); - _parametriSetup.AggiornaParametro("MarchioLarghezza", TextBox15.Text); - _parametriSetup.AggiornaParametro("MarchioMargine", TextBox16.Text); - _parametriSetup.AggiornaParametro("MarchioAllOrizzontale", ComboBox4.Text); - _parametriSetup.AggiornaParametro("MarchioAllVerticale", ComboBox5.Text); - _parametriSetup.AggiornaParametro("MarchioTrasparenza", TextBox19.Text); - _parametriSetup.AggiornaParametro("MarchioAggiungi", CheckBox5.Checked); - _parametriSetup.AggiornaParametro("TempoGara", CheckBox7.Checked); - _parametriSetup.AggiornaParametro("Orario", CheckBox8.Checked); - _parametriSetup.AggiornaParametro("EtichettaOrario", TextBox18.Text); - _parametriSetup.AggiornaParametro("GeneraleForzaJpg", chkForzaJpg.Checked); - _parametriSetup.AggiornaParametro("GeneraleRotazioneAutomatica", chkRotazioneAutomatica.Checked); - _parametriSetup.AggiornaParametro("GrandezzaVerticale", TextBox30.Text); - _parametriSetup.AggiornaParametro("MargineVerticale", TextBox31.Text); - _parametriSetup.AggiornaParametro("DimensioniOriginali", CheckBox15.Checked); - _parametriSetup.AggiornaParametro("TestoVerticale", Model.VerticalText); - _parametriSetup.AggiornaParametro("NomeMiniatura", RadioButton6.Checked); - _parametriSetup.AggiornaParametro("DataFoto", CheckBox16.Checked); - _parametriSetup.AggiornaParametro("NumeroFoto", CheckBox17.Checked); - _parametriSetup.AggiornaParametro("ColoreTestoRGB", TextBox34.Text); - _parametriSetup.AggiornaParametro("TempoSmall", RadioButton5.Checked); - _parametriSetup.AggiornaParametro("NumTempoSmall", RadioButton7.Checked); - _parametriSetup.AggiornaParametro("CompressioneJpeg", TextBox32.Text); - _parametriSetup.AggiornaParametro("CompressioneJpegMiniatura", TextBox33.Text); - // 2021 - _parametriSetup.AggiornaParametro("ChunkSize", Model.ChunkSize.ToString()); - _parametriSetup.AggiornaParametro("ThreadsCount", Model.ThreadsCount.ToString()); - _parametriSetup.AggiornaParametro("OverwriteImages", Model.OverwriteImages); - _parametriSetup.SalvaParametriSetup(); - Text = "Image Catalog - " + LeggiSoloNomeFile(ilNome); } - private void Button6_Click(object sender, EventArgs e) + private async void OnSaveSettingsRequested(object sender, string e) { - var openFileDialog = new OpenFileDialog(); - - // openFileDialog.InitialDirectory = TextBox1.Text - openFileDialog.Filter = "Setup (*.xml)|*.xml|All valid files (*.*)|*.*"; - openFileDialog.FilterIndex = 0; - openFileDialog.RestoreDirectory = true; - - if (DialogResult.OK != openFileDialog.ShowDialog()) return; - - var ilNome = openFileDialog.FileName; - _parametriSetup.NomeFileSetup = ilNome; - _parametriSetup.CaricaParametriSetup(); - Model.SourcePath = _parametriSetup.LeggiParametroString("DirSorgente"); - Model.DestinationPath = _parametriSetup.LeggiParametroString("DirDestinazione"); - chkAggiornaSottodirectory.Checked = _parametriSetup.LeggiParametroBoolean("DirSottoDirectory"); - chkCreaSottocartelle.Checked = _parametriSetup.LeggiParametroBoolean("DirDividiDestinazione"); - txtFilePerCartella.Text = _parametriSetup.LeggiParametroString("DirDividiNumFile"); - txtSuffissoCartelle.Text = _parametriSetup.LeggiParametroString("DirDividiSuffisso"); - txtCifreContatore.Text = _parametriSetup.LeggiParametroString("DirDividiNumCifre"); - string TestoTemp = _parametriSetup.LeggiParametroString("DirDividiTipoNumerazione"); - if (TestoTemp.ToUpper() == "PROGRESSIVA") + var saveDialog = new SaveFileDialog { - rdbNumProgressiva.Checked = true; - } - else + Filter = "Setup (*.xml)|*.xml|All valid files (*.*)|*.*", + FilterIndex = 0, + RestoreDirectory = true + }; + + if (saveDialog.ShowDialog() != DialogResult.OK) return; + + await Model.SaveSettingsToFileAsync(saveDialog.FileName); + Text = "Image Catalog - " + Path.GetFileName(saveDialog.FileName); + } + + private async void OnLoadSettingsRequested(object sender, string e) + { + var openDialog = new OpenFileDialog { - rdbNumFiles.Checked = true; + Filter = "Setup (*.xml)|*.xml|All valid files (*.*)|*.*", + FilterIndex = 0, + RestoreDirectory = true + }; + + if (openDialog.ShowDialog() != DialogResult.OK) return; + + await Model.LoadSettingsFromFileAsync(openDialog.FileName); + + // Update logo preview if logo file exists + if (File.Exists(Model.LogoFile)) + { + UpdateLogoPictureBox(Model.LogoFile); } - CheckBox1.Checked = _parametriSetup.LeggiParametroBoolean("MiniatureCrea"); - TextBox3.Text = _parametriSetup.LeggiParametroString("MiniatureSuffisso"); - TextBox5.Text = _parametriSetup.LeggiParametroString("MiniatureAltezza"); - TextBox6.Text = _parametriSetup.LeggiParametroString("MiniatureLarghezza"); - RadioButton3.Checked = _parametriSetup.LeggiParametroBoolean("MiniatureAddScritta"); - RadioButton4.Checked = _parametriSetup.LeggiParametroBoolean("MiniatureAddOrario"); - TextBox27.Text = _parametriSetup.LeggiParametroString("FotoAltezza"); - TextBox28.Text = _parametriSetup.LeggiParametroString("FotoLarghezza"); - // TextBox13.Text = SetupIni.LeggiParametroString("FotoCodice") - // CheckBox2.Checked = SetupIni.LeggiParametroBoolean("FotoDimOriginali") + Text = "Image Catalog - " + Path.GetFileName(openDialog.FileName); + } - TextBox11.Text = _parametriSetup.LeggiParametroString("FontDimensione"); - TextBox25.Text = _parametriSetup.LeggiParametroString("FontDimensioneMiniatura"); - CheckBox3.Checked = _parametriSetup.LeggiParametroBoolean("FontBold"); - ComboBox3.Text = _parametriSetup.LeggiParametroString("FontNome"); - if (string.IsNullOrEmpty(TextBox25.Text)) + private void OnSelectColorRequested(object sender, EventArgs e) + { + var colorDialog = new ColorDialog { - TextBox25.Text = "0"; + AllowFullOpen = true + }; + + if (!string.IsNullOrWhiteSpace(Model.TextColorRGB)) + { + try + { + colorDialog.Color = ColorTranslator.FromHtml(Model.TextColorRGB); + } + catch + { + // Invalid color, use default + } } - Model.HorizontalText = _parametriSetup.LeggiParametroString("TestoTesto"); - TextBox9.Text = _parametriSetup.LeggiParametroString("TestoTrasparente"); - TextBox12.Text = _parametriSetup.LeggiParametroString("TestoMargine"); - ComboBox1.Text = _parametriSetup.LeggiParametroString("TestoPosizione"); - ComboBox2.Text = _parametriSetup.LeggiParametroString("TestoAllineamento"); - TextBox10.Text = _parametriSetup.LeggiParametroString("MarchioFile"); - TextBox14.Text = _parametriSetup.LeggiParametroString("MarchioAltezza"); - TextBox15.Text = _parametriSetup.LeggiParametroString("MarchioLarghezza"); - TextBox16.Text = _parametriSetup.LeggiParametroString("MarchioMargine"); - ComboBox4.Text = _parametriSetup.LeggiParametroString("MarchioAllOrizzontale"); - ComboBox5.Text = _parametriSetup.LeggiParametroString("MarchioAllVerticale"); - TextBox19.Text = _parametriSetup.LeggiParametroString("MarchioTrasparenza"); - CheckBox5.Checked = _parametriSetup.LeggiParametroBoolean("MarchioAggiungi"); - CheckBox7.Checked = _parametriSetup.LeggiParametroBoolean("TempoGara"); - CheckBox8.Checked = _parametriSetup.LeggiParametroBoolean("Orario"); - TextBox18.Text = _parametriSetup.LeggiParametroString("EtichettaOrario"); - chkForzaJpg.Checked = _parametriSetup.LeggiParametroBoolean("GeneraleForzaJpg"); - chkRotazioneAutomatica.Checked = _parametriSetup.LeggiParametroBoolean("GeneraleRotazioneAutomatica"); - TextBox30.Text = _parametriSetup.LeggiParametroString("GrandezzaVerticale"); - TextBox31.Text = _parametriSetup.LeggiParametroString("MargineVerticale"); - CheckBox15.Checked = _parametriSetup.LeggiParametroBoolean("DimensioniOriginali"); - Model.VerticalText = _parametriSetup.LeggiParametroString("TestoVerticale"); - RadioButton6.Checked = _parametriSetup.LeggiParametroBoolean("NomeMiniatura"); - CheckBox16.Checked = _parametriSetup.LeggiParametroBoolean("DataFoto"); - CheckBox17.Checked = _parametriSetup.LeggiParametroBoolean("NumeroFoto"); - RadioButton5.Checked = _parametriSetup.LeggiParametroBoolean("TempoSmall"); - RadioButton7.Checked = _parametriSetup.LeggiParametroBoolean("NumTempoSmall"); - TextBox32.Text = _parametriSetup.LeggiParametroString("CompressioneJpeg"); - TextBox33.Text = _parametriSetup.LeggiParametroString("CompressioneJpegMiniatura"); - TextBox34.Text = _parametriSetup.LeggiParametroString("ColoreTestoRGB"); - Model.OverwriteImages = _parametriSetup.LeggiParametroBoolean("OverwriteImages"); - if (File.Exists(TextBox10.Text)) + if (colorDialog.ShowDialog() == DialogResult.OK) { - PictureBox1.Image = Image.FromFile(TextBox10.Text); + Model.TextColorRGB = ColorTranslator.ToHtml(colorDialog.Color); + TextBox34.BackColor = colorDialog.Color; + } + } + + private void UpdateLogoPictureBox(string logoPath) + { + try + { + PictureBox1.Image = Image.FromFile(logoPath); if (PictureBox1.Image.Height >= PictureBox1.Image.Width) { PictureBox1.Height = 160; - PictureBox1.Width = - (int)(160 * PictureBox1.Image.Width / (double)PictureBox1.Image.Height); + PictureBox1.Width = (int)(160 * PictureBox1.Image.Width / (double)PictureBox1.Image.Height); } else { - PictureBox1.Width = 224; - PictureBox1.Height = - (int)(224 * PictureBox1.Image.Height / (double)PictureBox1.Image.Width); + PictureBox1.Width = 160; + PictureBox1.Height = (int)(160 * PictureBox1.Image.Height / (double)PictureBox1.Image.Width); } } - - Text = "Image Catalog - " + LeggiSoloNomeFile(ilNome); - - // 2021 - Model.ChunkSize = _parametriSetup.LeggiParametro("ChunkSize", Model.ChunkSize); - Model.ThreadsCount = _parametriSetup.LeggiParametro("ThreadsCount", Model.ThreadsCount); - - // if (int.TryParse(_parametriSetup.LeggiParametroString("ChunkSize"), out var chunkSize)) - // { - // Model.ChunkSize = chunkSize; - // } - - // if (int.TryParse(_parametriSetup.LeggiParametroString("ThreadsCount"), out var threadsCount)) - // { - // Model.ThreadsCount = threadsCount; - // } - - // Model.ChunkSize = int.Parse(_parametriSetup.LeggiParametroString("ChunkSize")); - // Model.ThreadsCount = int.Parse(_parametriSetup.LeggiParametroString("ThreadsCount")); + catch + { + // Image loading failed, ignore + } } private void SetPicSettings(string SourcePath, string DestPath) { - var SourceDir = new DirectoryInfo(SourcePath); - var DestDirStart = new DirectoryInfo(DestPath); - DirectoryInfo DestDir = null; _picSettings.DirectorySorgente = SourcePath; - _picSettings.DirectoryDestinazione = Model.DestinationPath; - - // _picSettings.DestDir = DestDir - // _picSettings.SourceDir = SourceDir - // _picSettings.DestDirStart = DestDirStart - - _picSettings.DimStandard = int.Parse(TextBox11.Text); - _picSettings.DimStandardMiniatura = int.Parse(TextBox25.Text); - _picSettings.UsaOrarioMiniatura = CheckBox12.Checked; - _picSettings.UsaOrarioTestoApplicare = CheckBox8.Checked; - _picSettings.UsaTempoGaraTestoApplicare = CheckBox7.Checked; - _picSettings.UsaRotazioneAutomatica = chkRotazioneAutomatica.Checked; - _picSettings.UsaForzaJpg = chkForzaJpg.Checked; - if (CheckBox17.Checked) - { - _picSettings.TestoNome = true; - } - else - { - _picSettings.TestoNome = false; - } - - if (CheckBox16.Checked) - { - _picSettings.NomeData = true; - } - else - { - _picSettings.NomeData = false; - } + _picSettings.DirectoryDestinazione = DestPath; + // Font and text settings from Model + _picSettings.DimStandard = Model.FontSize; + _picSettings.DimStandardMiniatura = Model.FontSizeThumbnail; + _picSettings.IlFont = Model.FontName; + _picSettings.Grassetto = Model.FontBold; + _picSettings.Posizione = Model.VerticalPosition; + _picSettings.Allineamento = Model.HorizontalAlignment; + _picSettings.Trasparenza = Model.TextTransparency; + _picSettings.Margine = Model.TextMargin; + _picSettings.FontColoreRGB = ColorTranslator.FromHtml(Model.TextColorRGB); + + // Thumbnail settings from Model + _picSettings.AltezzaSmall = Model.ThumbnailHeight; + _picSettings.LarghezzaSmall = Model.ThumbnailWidth; + _picSettings.Suffisso = Model.ThumbnailPrefix; + _picSettings.CreaMiniature = Model.CreateThumbnails; + _picSettings.JpegQualityMin = Model.JpegQualityThumbnail; + _picSettings.DimMin = Model.FontSizeThumbnail; + + // Big photo settings from Model + _picSettings.AltezzaBig = Model.PhotoBigHeight; + _picSettings.LarghezzaBig = Model.PhotoBigWidth; + _picSettings.FotoGrandeDimOrigina = Model.KeepOriginalDimensions; + _picSettings.JpegQuality = Model.JpegQuality; + + // Logo settings from Model + _picSettings.LogoAggiungi = Model.AddLogo; + _picSettings.LogoNomeFile = Model.LogoFile; + _picSettings.LogoAltezza = Model.LogoHeight; + _picSettings.LogoLarghezza = Model.LogoWidth; + _picSettings.LogoMargine = Model.LogoMargin.ToString(); + _picSettings.LogoTrasparenza = Model.LogoTransparency.ToString(); + _picSettings.LogoPosizioneH = Model.LogoHorizontalPosition; + _picSettings.LogoPosizioneV = Model.LogoVerticalPosition; + + // Text content from Model _picSettings.TestoFirmaStart = Model.HorizontalText; _picSettings.TestoFirmaStartV = Model.VerticalText; - _picSettings.DataPartenza = DateTimePicker1.Value; - _picSettings.TestoOrario = TextBox18.Text; - _picSettings.AltezzaSmall = int.Parse(TextBox6.Text); - _picSettings.LarghezzaSmall = int.Parse(TextBox5.Text); - _picSettings.CreaMiniature = CheckBox1.Checked; + + // Vertical text settings from Model + _picSettings.DimVert = Model.VerticalTextSize; + _picSettings.MargVert = Model.VerticalTextMargin; + + // Boolean flags from Model + _picSettings.UsaRotazioneAutomatica = Model.AutomaticRotation; + _picSettings.UsaForzaJpg = Model.ForceJpeg; + _picSettings.TestoNome = Model.ShowPhotoNumber; + _picSettings.NomeData = Model.ShowDate; + _picSettings.UsaOrarioTestoApplicare = Model.AddTime; + _picSettings.UsaTempoGaraTestoApplicare = Model.AddRaceTime; + _picSettings.OverwriteFiles = Model.OverwriteImages; + + // Additional settings from Model + _picSettings.UsaOrarioMiniatura = Model.AddTimeToThumbnails; + _picSettings.DataPartenza = Model.RaceStartDate; + _picSettings.TestoOrario = Model.TimeLabel; + _picSettings.TestoMin = Model.ShowFileNameOnThumbnails; + + // Controls that still need binding (TODO: move to Model) _picSettings.AggiungiScritteMiniature = RadioButton3.Checked; _picSettings.AggTempoGaraMin = RadioButton5.Checked; _picSettings.AggNumTempMin = RadioButton7.Checked; - _picSettings.DimVert = int.Parse(TextBox30.Text); - _picSettings.MargVert = int.Parse(TextBox31.Text); - - // _picSettings.NomeFileChild = childFile.Name - _picSettings.Suffisso = TextBox3.Text; - // _picSettings.Codice = TextBox13.Text - - _picSettings.Trasparenza = int.Parse(TextBox9.Text); - _picSettings.IlFont = ComboBox3.SelectedItem.ToString(); - _picSettings.Grassetto = CheckBox3.Checked; - _picSettings.Posizione = ComboBox1.SelectedItem.ToString(); - _picSettings.Allineamento = ComboBox2.SelectedItem.ToString(); - _picSettings.Margine = int.Parse(TextBox12.Text); - _picSettings.LogoAltezza = int.Parse(TextBox14.Text); - _picSettings.LogoLarghezza = int.Parse(TextBox15.Text); - _picSettings.FontColoreRGB = ColorTranslator.FromHtml(TextBox34.Text); - _picSettings.LogoAggiungi = CheckBox5.Checked; - _picSettings.LogoNomeFile = TextBox10.Text; - _picSettings.LogoTrasparenza = TextBox19.Text; - _picSettings.LogoMargine = TextBox16.Text; - _picSettings.LogoPosizioneH = ComboBox4.Text; - _picSettings.LogoPosizioneV = ComboBox5.Text; - _picSettings.FotoGrandeDimOrigina = CheckBox15.Checked; - _picSettings.AltezzaBig = int.Parse(TextBox27.Text); - _picSettings.LarghezzaBig = int.Parse(TextBox28.Text); - _picSettings.DimMin = int.Parse(TextBox25.Text); - _picSettings.TestoMin = RadioButton6.Checked; - _picSettings.JpegQuality = int.Parse(TextBox32.Text); - _picSettings.JpegQualityMin = int.Parse(TextBox33.Text); - _picSettings.OverwriteFiles = Model.OverwriteImages; } private void setLabel18Text(string text) @@ -593,132 +424,16 @@ public partial class MainForm NumerazioneType numerazioneType; if (rdbNumProgressiva.Checked) { - numerazioneType = NumerazioneType.Progressiva; // FileHelper.numerazione.Progressiva + numerazioneType = NumerazioneType.Progressiva; } else { numerazioneType = NumerazioneType.Files; - } // FileHelper.numerazione.Files + } return numerazioneType; } - private void Button4_Click(object sender, EventArgs e) - { - var openFileDialog = new OpenFileDialog(); - - // openFileDialog.InitialDirectory = TextBox1.Text - openFileDialog.Filter = "Immagini jpg (*.jpg)|*.jpg|Immagini gif (*.gif)|*.gif|Tutti i file (*.*)|*.*"; - if (TextBox10.Text.Length > 0) - { - openFileDialog.FileName = TextBox10.Text; - } - - openFileDialog.FilterIndex = 0; - openFileDialog.RestoreDirectory = true; - if (DialogResult.OK == openFileDialog.ShowDialog()) - { - TextBox10.Text = openFileDialog.FileName; - PictureBox1.Image = Image.FromFile(TextBox10.Text); - if (PictureBox1.Image.Height >= PictureBox1.Image.Width) - { - PictureBox1.Height = 160; - PictureBox1.Width = - (int)(160 * PictureBox1.Image.Width / (double)PictureBox1.Image.Height); - } - else - { - PictureBox1.Width = 224; - PictureBox1.Height = - (int)(224 * PictureBox1.Image.Height / (double)PictureBox1.Image.Width); - } - } - } - - private string LeggiSoloNomeFile(string FileName) - { - string Testo = FileName; - string Risposta = ""; - var Nomi = Testo.Split(new char[] { '\\' }); - if (Nomi.Length > 1) - { - Risposta = Nomi[Nomi.Length - 1]; - } - - return Risposta; - } - - private void PictureBox1_MouseMove(object sender, MouseEventArgs e) - { - // GetColor() - // GetPixelColor(PictureBox1.PointToScreen(e.Location)).ToArgb.ToString("X8") - } - - private void PictureBox1_MouseUp(object sender, MouseEventArgs e) - { - if (e.Button == MouseButtons.Left) - { - _waterSelectColor = true; - } - else - { - _waterSelectColor = false; - } - } - - private Color[] GetPixelColor(Point screenLocation) - { - // Dim bm As New Bitmap(1, 1, Imaging.PixelFormat.Format24bppRgb) - // Dim g As Graphics = Graphics.FromImage(bm) - // g.CopyFromScreen(screenLocation, New Point(0, 0), New Size(1, 1)) - // Dim result As Color = bm.GetPixel(0, 0) - // g.Dispose() - // bm.Dispose() - // Return result - return null; - } - - private void Button8_Click(object sender, EventArgs e) - { - var MyDialog = new ColorDialog(); - MyDialog.AllowFullOpen = true; - // If TextBox22.Text.Length > 0 And TextBox23.Text.Length > 0 And TextBox24.Text.Length > 0 Then - // If CType(TextBox22.Text, Integer) >= 0 And CType(TextBox23.Text, Integer) >= 0 And CType(TextBox24.Text, Integer) >= 0 Then - // MyDialog.Color = Color.FromArgb(0, CType(TextBox22.Text, Integer), CType(TextBox23.Text, Integer), CType(TextBox24.Text, Integer)) - // End If - // End If - - if (MyDialog.ShowDialog() == DialogResult.OK) - { - // TextBox22.Text = MyDialog.Color.R.ToString - // TextBox23.Text = MyDialog.Color.G.ToString - // TextBox24.Text = MyDialog.Color.B.ToString - TextBox34.Text = ColorTranslator.ToHtml(MyDialog.Color); - TextBox34.BackColor = MyDialog.Color; - } - } - - private void CheckBox18_CheckedChanged(object sender, EventArgs e) - { - CheckBox4.Checked = false; - CheckBox12.Checked = false; - } - - private void CheckBox4_CheckedChanged(object sender, EventArgs e) - { - CheckBox18.Checked = false; - } - - private void CheckBox12_CheckedChanged(object sender, EventArgs e) - { - CheckBox18.Checked = false; - } - - private void Label27_Click(object sender, EventArgs e) - { - } - - //private CancellationTokenSource? _mainToken; private async void Button1_Click(object sender, EventArgs e) { @@ -796,11 +511,6 @@ public partial class MainForm int diff = _currentAmount - _previousAmount; Model.SpeedCounter = $"{diff} f/m"; } - - private void UpdateCounter(string text) - { - Label10.Invoke(new Action(() => Label10.Text = text)); - } } public class PicInfo diff --git a/imagecatalog/Program.cs b/imagecatalog/Program.cs index 322ecb5..24ac1ab 100644 --- a/imagecatalog/Program.cs +++ b/imagecatalog/Program.cs @@ -81,6 +81,7 @@ static class Program { // Register your services here services.AddTransient(); + services.AddTransient(); services.AddTransient(); diff --git a/imagecatalog/Services/ISettingsService.cs b/imagecatalog/Services/ISettingsService.cs new file mode 100644 index 0000000..4d51cbb --- /dev/null +++ b/imagecatalog/Services/ISettingsService.cs @@ -0,0 +1,10 @@ +using System.Threading.Tasks; + +namespace ImageCatalog_2.Services +{ + public interface ISettingsService + { + Task SaveSettingsAsync(string filePath, object settings); + Task LoadSettingsAsync(string filePath, object settings); + } +} diff --git a/imagecatalog/Services/SettingsService.cs b/imagecatalog/Services/SettingsService.cs new file mode 100644 index 0000000..f8854bc --- /dev/null +++ b/imagecatalog/Services/SettingsService.cs @@ -0,0 +1,99 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Threading.Tasks; +using ImageCatalog; + +namespace ImageCatalog_2.Services +{ + /// + /// Modern settings service that uses reflection to automatically save/load all properties + /// + public class SettingsService : ISettingsService + { + private readonly ParametriSetup _parametriSetup; + + public SettingsService(ParametriSetup parametriSetup) + { + _parametriSetup = parametriSetup; + } + + public Task SaveSettingsAsync(string filePath, object settings) + { + return Task.Run(() => + { + _parametriSetup.NomeFileSetup = filePath; + + // Use reflection to get all properties and save them + var properties = settings.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance) + .Where(p => p.CanRead && IsSerializableType(p.PropertyType)); + + foreach (var prop in properties) + { + var value = prop.GetValue(settings); + _parametriSetup.AggiornaParametro(prop.Name, value); + } + + _parametriSetup.SalvaParametriSetup(); + }); + } + + public Task LoadSettingsAsync(string filePath, object settings) + { + return Task.Run(() => + { + _parametriSetup.NomeFileSetup = filePath; + _parametriSetup.CaricaParametriSetup(); + + // Use reflection to get all properties and load them + var properties = settings.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance) + .Where(p => p.CanWrite && IsSerializableType(p.PropertyType)); + + foreach (var prop in properties) + { + try + { + object value; + if (prop.PropertyType == typeof(string)) + { + value = _parametriSetup.LeggiParametroString(prop.Name); + } + else if (prop.PropertyType == typeof(bool)) + { + value = _parametriSetup.LeggiParametroBoolean(prop.Name); + } + else if (prop.PropertyType == typeof(int)) + { + value = _parametriSetup.LeggiParametro(prop.Name, (int)(prop.GetValue(settings) ?? 0)); + } + else if (prop.PropertyType == typeof(double)) + { + value = _parametriSetup.LeggiParametro(prop.Name, (double)(prop.GetValue(settings) ?? 0.0)); + } + else + { + continue; // Skip unsupported types + } + + prop.SetValue(settings, value); + } + catch + { + // Skip properties that can't be loaded + } + } + }); + } + + private bool IsSerializableType(Type type) + { + return type == typeof(string) || + type == typeof(int) || + type == typeof(bool) || + type == typeof(double) || + type == typeof(float) || + type == typeof(decimal); + } + } +} -- 2.52.0 From d73389d7915933f7762778f5f175ec01bb11534a Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Wed, 4 Feb 2026 21:12:27 +0100 Subject: [PATCH 041/127] Update library and fixes --- MaddoShared.Tests/ImageCreatorSharpTests.cs | 2 +- MaddoShared.Tests/MaddoShared.Tests.csproj | 20 ++++++++++++++++---- MaddoShared/MaddoShared.csproj | 10 +++++----- imagecatalog/DataModel.cs | 1 + imagecatalog/ImageCatalog 2.csproj | 6 +++--- imagecatalog/MainForm.cs | 13 +++++++++++++ imagecatalog/Services/SettingsService.cs | 12 +++++++++++- 7 files changed, 50 insertions(+), 14 deletions(-) diff --git a/MaddoShared.Tests/ImageCreatorSharpTests.cs b/MaddoShared.Tests/ImageCreatorSharpTests.cs index 442e013..d053452 100644 --- a/MaddoShared.Tests/ImageCreatorSharpTests.cs +++ b/MaddoShared.Tests/ImageCreatorSharpTests.cs @@ -225,7 +225,7 @@ namespace MaddoShared.Tests miAdjust.Invoke(svc, parameters); var updatedSize = (SizeF)parameters[3]; - imageState.DimensioneStandardMiniatura.Should().BeLessOrEqualTo(30); + imageState.DimensioneStandardMiniatura.Should().BeLessThanOrEqualTo(30); (updatedSize.Width <= 50 || imageState.DimensioneStandardMiniatura <= 5).Should().BeTrue(); } } diff --git a/MaddoShared.Tests/MaddoShared.Tests.csproj b/MaddoShared.Tests/MaddoShared.Tests.csproj index d425a15..5ab4340 100644 --- a/MaddoShared.Tests/MaddoShared.Tests.csproj +++ b/MaddoShared.Tests/MaddoShared.Tests.csproj @@ -9,14 +9,26 @@ - - - - + + + + + + + + + + + + + + + + diff --git a/MaddoShared/MaddoShared.csproj b/MaddoShared/MaddoShared.csproj index 4a37e7c..4753af8 100644 --- a/MaddoShared/MaddoShared.csproj +++ b/MaddoShared/MaddoShared.csproj @@ -14,12 +14,12 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + - - + + - + @@ -27,6 +27,6 @@ all - + \ No newline at end of file diff --git a/imagecatalog/DataModel.cs b/imagecatalog/DataModel.cs index b64cbdd..95fefb9 100644 --- a/imagecatalog/DataModel.cs +++ b/imagecatalog/DataModel.cs @@ -148,6 +148,7 @@ namespace ImageCatalog_2 { _uiEnabled = value; NotifyPropertyChanged(); + NotifyPropertyChanged(nameof(UiDisabled)); } } diff --git a/imagecatalog/ImageCatalog 2.csproj b/imagecatalog/ImageCatalog 2.csproj index 16182e5..6473071 100644 --- a/imagecatalog/ImageCatalog 2.csproj +++ b/imagecatalog/ImageCatalog 2.csproj @@ -39,9 +39,9 @@ - - - + + + all diff --git a/imagecatalog/MainForm.cs b/imagecatalog/MainForm.cs index d39e92d..6bc9c2c 100644 --- a/imagecatalog/MainForm.cs +++ b/imagecatalog/MainForm.cs @@ -132,6 +132,16 @@ public partial class MainForm ComboBox5.SelectedItem = Model.LogoVerticalPosition; } + private void RefreshComboBoxSelections() + { + // Update ComboBox selections to reflect loaded Model values + ComboBox1.SelectedItem = Model.VerticalPosition; + ComboBox2.SelectedItem = Model.HorizontalAlignment; + ComboBox3.SelectedItem = Model.FontName; + ComboBox4.SelectedItem = Model.LogoHorizontalPosition; + ComboBox5.SelectedItem = Model.LogoVerticalPosition; + } + private void Form1_Load(object sender, EventArgs e) { @@ -281,6 +291,9 @@ public partial class MainForm await Model.LoadSettingsFromFileAsync(openDialog.FileName); + // Refresh ComboBox selections to reflect loaded settings + RefreshComboBoxSelections(); + // Update logo preview if logo file exists if (File.Exists(Model.LogoFile)) { diff --git a/imagecatalog/Services/SettingsService.cs b/imagecatalog/Services/SettingsService.cs index f8854bc..fbf747f 100644 --- a/imagecatalog/Services/SettingsService.cs +++ b/imagecatalog/Services/SettingsService.cs @@ -58,6 +58,15 @@ namespace ImageCatalog_2.Services if (prop.PropertyType == typeof(string)) { value = _parametriSetup.LeggiParametroString(prop.Name); + // Don't update if empty string and current value is not empty + if (string.IsNullOrEmpty((string)value)) + { + var currentValue = prop.GetValue(settings) as string; + if (!string.IsNullOrEmpty(currentValue)) + { + continue; // Skip if no value in settings but there's a default + } + } } else if (prop.PropertyType == typeof(bool)) { @@ -78,9 +87,10 @@ namespace ImageCatalog_2.Services prop.SetValue(settings, value); } - catch + catch (Exception ex) { // Skip properties that can't be loaded + System.Diagnostics.Debug.WriteLine($"Failed to load property {prop.Name}: {ex.Message}"); } } }); -- 2.52.0 From fc7175c2f7ebcdd6b254847882219e83ea0bafd1 Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Wed, 4 Feb 2026 22:10:16 +0100 Subject: [PATCH 042/127] Fixes to settings --- imagecatalog/DataModel.cs | 44 +++ imagecatalog/MainForm.Designer.cs | 7 +- imagecatalog/MainForm.cs | 66 ++-- imagecatalog/Models/SettingsDto.cs | 231 +++++++++++ imagecatalog/ParametriSetup.cs | 464 ++++++++++++----------- imagecatalog/Services/SettingsService.cs | 147 +++++-- 6 files changed, 660 insertions(+), 299 deletions(-) create mode 100644 imagecatalog/Models/SettingsDto.cs diff --git a/imagecatalog/DataModel.cs b/imagecatalog/DataModel.cs index 95fefb9..ce02440 100644 --- a/imagecatalog/DataModel.cs +++ b/imagecatalog/DataModel.cs @@ -730,6 +730,50 @@ namespace ImageCatalog_2 } } + private string _bigPhotoSuffix = ""; + public string BigPhotoSuffix + { + get => _bigPhotoSuffix; + set + { + _bigPhotoSuffix = value; + NotifyPropertyChanged(); + } + } + + private bool _addTextToThumbnails; + public bool AddTextToThumbnails + { + get => _addTextToThumbnails; + set + { + _addTextToThumbnails = value; + NotifyPropertyChanged(); + } + } + + private bool _addRaceTimeToThumbnails; + public bool AddRaceTimeToThumbnails + { + get => _addRaceTimeToThumbnails; + set + { + _addRaceTimeToThumbnails = value; + NotifyPropertyChanged(); + } + } + + private bool _addNumberAndTimeToThumbnails; + public bool AddNumberAndTimeToThumbnails + { + get => _addNumberAndTimeToThumbnails; + set + { + _addNumberAndTimeToThumbnails = value; + NotifyPropertyChanged(); + } + } + private void Test(object parameter) { Debug.WriteLine("Yep"); diff --git a/imagecatalog/MainForm.Designer.cs b/imagecatalog/MainForm.Designer.cs index 79fafe8..fdee7ba 100644 --- a/imagecatalog/MainForm.Designer.cs +++ b/imagecatalog/MainForm.Designer.cs @@ -947,6 +947,7 @@ namespace ImageCatalog // // TextBox18 // + TextBox18.DataBindings.Add(new Binding("Text", bindingSource1, "TimeLabel", true, DataSourceUpdateMode.OnPropertyChanged)); TextBox18.Location = new Point(502, 384); TextBox18.Margin = new Padding(6, 8, 6, 8); TextBox18.Name = "TextBox18"; @@ -966,6 +967,7 @@ namespace ImageCatalog // // DateTimePicker1 // + DateTimePicker1.DataBindings.Add(new Binding("Value", bindingSource1, "RaceStartDate", true, DataSourceUpdateMode.OnPropertyChanged)); DateTimePicker1.Format = DateTimePickerFormat.Time; DateTimePicker1.Location = new Point(850, 384); DateTimePicker1.Margin = new Padding(6, 8, 6, 8); @@ -1154,12 +1156,12 @@ namespace ImageCatalog // // TextBox26 // + TextBox26.DataBindings.Add(new Binding("Text", bindingSource1, "BigPhotoSuffix", true, DataSourceUpdateMode.OnPropertyChanged)); TextBox26.Location = new Point(486, 118); TextBox26.Margin = new Padding(6, 8, 6, 8); TextBox26.Name = "TextBox26"; TextBox26.Size = new Size(116, 39); TextBox26.TabIndex = 20; - TextBox26.Text = "TextBox26"; // // Label37 // @@ -1339,6 +1341,7 @@ namespace ImageCatalog // // RadioButton3 // + RadioButton3.DataBindings.Add(new Binding("Checked", bindingSource1, "AddTextToThumbnails", true, DataSourceUpdateMode.OnPropertyChanged)); RadioButton3.AutoSize = true; RadioButton3.Location = new Point(32, 40); RadioButton3.Margin = new Padding(6, 8, 6, 8); @@ -1351,6 +1354,7 @@ namespace ImageCatalog // // RadioButton7 // + RadioButton7.DataBindings.Add(new Binding("Checked", bindingSource1, "AddNumberAndTimeToThumbnails", true, DataSourceUpdateMode.OnPropertyChanged)); RadioButton7.AutoSize = true; RadioButton7.Location = new Point(280, 99); RadioButton7.Margin = new Padding(6, 8, 6, 8); @@ -1387,6 +1391,7 @@ namespace ImageCatalog // // RadioButton5 // + RadioButton5.DataBindings.Add(new Binding("Checked", bindingSource1, "AddRaceTimeToThumbnails", true, DataSourceUpdateMode.OnPropertyChanged)); RadioButton5.AutoSize = true; RadioButton5.Location = new Point(32, 160); RadioButton5.Margin = new Padding(6, 8, 6, 8); diff --git a/imagecatalog/MainForm.cs b/imagecatalog/MainForm.cs index 6bc9c2c..f18ab89 100644 --- a/imagecatalog/MainForm.cs +++ b/imagecatalog/MainForm.cs @@ -115,31 +115,26 @@ public partial class MainForm private void SetDefaults() { - // Model defaults are already set in DataModel constructor, just bind ComboBoxes + // Bind ComboBoxes to Model using proper data binding ComboBox1.DataSource = new List(Model.VerticalPositions); - ComboBox1.SelectedItem = Model.VerticalPosition; + ComboBox1.DataBindings.Add(new Binding("SelectedItem", bindingSource1, nameof(Model.VerticalPosition), + false, DataSourceUpdateMode.OnPropertyChanged)); ComboBox2.DataSource = new List(Model.HorizontalAlignments); - ComboBox2.SelectedItem = Model.HorizontalAlignment; + ComboBox2.DataBindings.Add(new Binding("SelectedItem", bindingSource1, nameof(Model.HorizontalAlignment), + false, DataSourceUpdateMode.OnPropertyChanged)); ComboBox3.DataSource = new List(Model.AvailableFonts); - ComboBox3.SelectedItem = Model.FontName; + ComboBox3.DataBindings.Add(new Binding("SelectedItem", bindingSource1, nameof(Model.FontName), + false, DataSourceUpdateMode.OnPropertyChanged)); ComboBox4.DataSource = new List(Model.HorizontalAlignments); - ComboBox4.SelectedItem = Model.LogoHorizontalPosition; + ComboBox4.DataBindings.Add(new Binding("SelectedItem", bindingSource1, nameof(Model.LogoHorizontalPosition), + false, DataSourceUpdateMode.OnPropertyChanged)); ComboBox5.DataSource = new List { "Alto", "Centro", "Basso" }; - ComboBox5.SelectedItem = Model.LogoVerticalPosition; - } - - private void RefreshComboBoxSelections() - { - // Update ComboBox selections to reflect loaded Model values - ComboBox1.SelectedItem = Model.VerticalPosition; - ComboBox2.SelectedItem = Model.HorizontalAlignment; - ComboBox3.SelectedItem = Model.FontName; - ComboBox4.SelectedItem = Model.LogoHorizontalPosition; - ComboBox5.SelectedItem = Model.LogoVerticalPosition; + ComboBox5.DataBindings.Add(new Binding("SelectedItem", bindingSource1, nameof(Model.LogoVerticalPosition), + false, DataSourceUpdateMode.OnPropertyChanged)); } @@ -289,18 +284,28 @@ public partial class MainForm if (openDialog.ShowDialog() != DialogResult.OK) return; - await Model.LoadSettingsFromFileAsync(openDialog.FileName); - - // Refresh ComboBox selections to reflect loaded settings - RefreshComboBoxSelections(); - - // Update logo preview if logo file exists - if (File.Exists(Model.LogoFile)) + try { - UpdateLogoPictureBox(Model.LogoFile); - } + await Model.LoadSettingsFromFileAsync(openDialog.FileName); + + // Explicitly ensure UI is enabled after loading + Model.UiEnabled = true; + + // Update logo preview if logo file exists + if (File.Exists(Model.LogoFile)) + { + UpdateLogoPictureBox(Model.LogoFile); + } - Text = "Image Catalog - " + Path.GetFileName(openDialog.FileName); + Text = "Image Catalog - " + Path.GetFileName(openDialog.FileName); + + _logger.LogInformation($"Settings loaded successfully from {openDialog.FileName}"); + } + catch (Exception ex) + { + _logger.LogError(ex, "Error loading settings"); + MessageBox.Show($"Error loading settings: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } } private void OnSelectColorRequested(object sender, EventArgs e) @@ -380,6 +385,7 @@ public partial class MainForm _picSettings.LarghezzaBig = Model.PhotoBigWidth; _picSettings.FotoGrandeDimOrigina = Model.KeepOriginalDimensions; _picSettings.JpegQuality = Model.JpegQuality; + _picSettings.Codice = Model.BigPhotoSuffix; // Logo settings from Model _picSettings.LogoAggiungi = Model.AddLogo; @@ -414,10 +420,10 @@ public partial class MainForm _picSettings.TestoOrario = Model.TimeLabel; _picSettings.TestoMin = Model.ShowFileNameOnThumbnails; - // Controls that still need binding (TODO: move to Model) - _picSettings.AggiungiScritteMiniature = RadioButton3.Checked; - _picSettings.AggTempoGaraMin = RadioButton5.Checked; - _picSettings.AggNumTempMin = RadioButton7.Checked; + // Thumbnail text options from Model + _picSettings.AggiungiScritteMiniature = Model.AddTextToThumbnails; + _picSettings.AggTempoGaraMin = Model.AddRaceTimeToThumbnails; + _picSettings.AggNumTempMin = Model.AddNumberAndTimeToThumbnails; } private void setLabel18Text(string text) diff --git a/imagecatalog/Models/SettingsDto.cs b/imagecatalog/Models/SettingsDto.cs new file mode 100644 index 0000000..d5a01b2 --- /dev/null +++ b/imagecatalog/Models/SettingsDto.cs @@ -0,0 +1,231 @@ +using System; +using System.Text.Json.Serialization; +using System.Xml.Serialization; + +namespace ImageCatalog_2.Models +{ + /// + /// Data Transfer Object for application settings. + /// Uses attributes to control serialization behavior for both XML (legacy) and JSON (future). + /// + public class SettingsDto + { + // Paths + [JsonPropertyName("SourcePath")] + [XmlElement("DirSorgente")] + public string SourcePath { get; set; } + + [JsonPropertyName("DestinationPath")] + [XmlElement("DirDestinazione")] + public string DestinationPath { get; set; } + + // Thumbnails + [JsonPropertyName("CreateThumbnails")] + [XmlElement("MiniatureCrea")] + public bool CreateThumbnails { get; set; } = true; + + [JsonPropertyName("ThumbnailPrefix")] + [XmlElement("MiniatureSuffisso")] + public string ThumbnailPrefix { get; set; } = "tn_"; + + [JsonPropertyName("ThumbnailHeight")] + [XmlElement("MiniatureAltezza")] + public int ThumbnailHeight { get; set; } = 350; + + [JsonPropertyName("ThumbnailWidth")] + [XmlElement("MiniatureLarghezza")] + public int ThumbnailWidth { get; set; } = 350; + + [JsonPropertyName("FontSizeThumbnail")] + [XmlElement("FontDimensioneMiniatura")] + public int FontSizeThumbnail { get; set; } = 50; + + [JsonPropertyName("JpegQualityThumbnail")] + [XmlElement("CompressioneJpegMiniatura")] + public int JpegQualityThumbnail { get; set; } = 30; + + [JsonPropertyName("AddTimeToThumbnails")] + [XmlElement("MiniatureAddOrario")] + public bool AddTimeToThumbnails { get; set; } + + [JsonPropertyName("ShowFileNameOnThumbnails")] + [XmlElement("NomeMiniatura")] + public bool ShowFileNameOnThumbnails { get; set; } + + [JsonPropertyName("AddTextToThumbnails")] + [XmlElement("MiniatureAddScritta")] + public bool AddTextToThumbnails { get; set; } + + [JsonPropertyName("AddRaceTimeToThumbnails")] + [XmlElement("TempoSmall")] + public bool AddRaceTimeToThumbnails { get; set; } + + [JsonPropertyName("AddNumberAndTimeToThumbnails")] + [XmlElement("NumTempoSmall")] + public bool AddNumberAndTimeToThumbnails { get; set; } + + // Big photo + [JsonPropertyName("BigPhotoSuffix")] + [XmlElement("FotoCodice")] + public string BigPhotoSuffix { get; set; } = ""; + + [JsonPropertyName("PhotoBigHeight")] + [XmlElement("FotoAltezza")] + public int PhotoBigHeight { get; set; } = 2240; + + [JsonPropertyName("PhotoBigWidth")] + [XmlElement("FotoLarghezza")] + public int PhotoBigWidth { get; set; } = 2240; + + [JsonPropertyName("KeepOriginalDimensions")] + [XmlElement("FotoDimOriginali")] + public bool KeepOriginalDimensions { get; set; } + + [JsonPropertyName("JpegQuality")] + [XmlElement("CompressioneJpeg")] + public int JpegQuality { get; set; } = 85; + + // Font + [JsonPropertyName("FontSize")] + [XmlElement("FontDimensione")] + public int FontSize { get; set; } = 20; + + [JsonPropertyName("FontName")] + [XmlElement("FontNome")] + public string FontName { get; set; } = "Arial"; + + [JsonPropertyName("FontBold")] + [XmlElement("FontBold")] + public bool FontBold { get; set; } + + [JsonPropertyName("TextColorRGB")] + [XmlElement("ColoreTestoRGB")] + public string TextColorRGB { get; set; } = "Yellow"; + + // Text + [JsonPropertyName("HorizontalText")] + [XmlElement("TestoTesto")] + public string HorizontalText { get; set; } + + [JsonPropertyName("VerticalText")] + [XmlElement("TestoVerticale")] + public string VerticalText { get; set; } + + [JsonPropertyName("TextTransparency")] + [XmlElement("TestoTrasparente")] + public int TextTransparency { get; set; } + + [JsonPropertyName("TextMargin")] + [XmlElement("TestoMargine")] + public int TextMargin { get; set; } = 8; + + [JsonPropertyName("VerticalPosition")] + [XmlElement("TestoPosizione")] + public string VerticalPosition { get; set; } = "Basso"; + + [JsonPropertyName("HorizontalAlignment")] + [XmlElement("TestoAllineamento")] + public string HorizontalAlignment { get; set; } = "Centro"; + + [JsonPropertyName("VerticalTextSize")] + [XmlElement("GrandezzaVerticale")] + public int VerticalTextSize { get; set; } = 20; + + [JsonPropertyName("VerticalTextMargin")] + [XmlElement("MargineVerticale")] + public int VerticalTextMargin { get; set; } = 6; + + // Logo/Watermark + [JsonPropertyName("LogoFile")] + [XmlElement("MarchioFile")] + public string LogoFile { get; set; } = ""; + + [JsonPropertyName("LogoHeight")] + [XmlElement("MarchioAltezza")] + public int LogoHeight { get; set; } = 430; + + [JsonPropertyName("LogoWidth")] + [XmlElement("MarchioLarghezza")] + public int LogoWidth { get; set; } = 430; + + [JsonPropertyName("LogoMargin")] + [XmlElement("MarchioMargine")] + public int LogoMargin { get; set; } = 290; + + [JsonPropertyName("LogoHorizontalPosition")] + [XmlElement("MarchioAllOrizzontale")] + public string LogoHorizontalPosition { get; set; } = "Destra"; + + [JsonPropertyName("LogoVerticalPosition")] + [XmlElement("MarchioAllVerticale")] + public string LogoVerticalPosition { get; set; } = "Basso"; + + [JsonPropertyName("LogoTransparency")] + [XmlElement("MarchioTrasparenza")] + public int LogoTransparency { get; set; } = 100; + + [JsonPropertyName("AddLogo")] + [XmlElement("MarchioAggiungi")] + public bool AddLogo { get; set; } + + // Options + [JsonPropertyName("ForceJpeg")] + [XmlElement("GeneraleForzaJpg")] + public bool ForceJpeg { get; set; } + + [JsonPropertyName("AutomaticRotation")] + [XmlElement("GeneraleRotazioneAutomatica")] + public bool AutomaticRotation { get; set; } + + [JsonPropertyName("AddRaceTime")] + [XmlElement("TempoGara")] + public bool AddRaceTime { get; set; } + + [JsonPropertyName("AddTime")] + [XmlElement("Orario")] + public bool AddTime { get; set; } + + [JsonPropertyName("TimeLabel")] + [XmlElement("EtichettaOrario")] + public string TimeLabel { get; set; } = ""; + + [JsonPropertyName("ShowDate")] + [XmlElement("DataFoto")] + public bool ShowDate { get; set; } + + [JsonPropertyName("ShowPhotoNumber")] + [XmlElement("NumeroFoto")] + public bool ShowPhotoNumber { get; set; } + + [JsonPropertyName("OverwriteImages")] + [XmlElement("GeneraleSovrascriviFile")] + public bool OverwriteImages { get; set; } + + // Folder division + [JsonPropertyName("FilesPerFolder")] + [XmlElement("DirDividiNumFile")] + public int FilesPerFolder { get; set; } = 99; + + [JsonPropertyName("FolderSuffix")] + [XmlElement("DirDividiSuffisso")] + public string FolderSuffix { get; set; } = ""; + + [JsonPropertyName("CounterDigits")] + [XmlElement("DirDividiNumCifre")] + public int CounterDigits { get; set; } = 2; + + // Processing + [JsonPropertyName("ChunkSize")] + [XmlElement("ChunkSize")] + public int ChunkSize { get; set; } + + [JsonPropertyName("ThreadsCount")] + [XmlElement("ThreadsCount")] + public int ThreadsCount { get; set; } + + // Race date + [JsonPropertyName("RaceStartDate")] + [XmlElement("DataPartenza")] + public DateTime RaceStartDate { get; set; } = DateTime.Now; + } +} diff --git a/imagecatalog/ParametriSetup.cs b/imagecatalog/ParametriSetup.cs index fa9df13..4dcf92c 100644 --- a/imagecatalog/ParametriSetup.cs +++ b/imagecatalog/ParametriSetup.cs @@ -1,239 +1,243 @@ -using System; -using System.Data; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Xml.Linq; +using Microsoft.Extensions.Logging; -namespace ImageCatalog +namespace ImageCatalog; + +/// +/// Modern parameter storage service using XML for persistence. +/// Thread-safe key-value store for application settings. +/// +public class ParametriSetup { - public class ParametriSetup + private readonly object _lock = new(); + private readonly ILogger _logger; + private Dictionary _parameters = new(StringComparer.OrdinalIgnoreCase); + + /// + /// Gets or sets the XML file path for settings storage. + /// + public string? NomeFileSetup { get; set; } + + /// + /// Initializes a new instance with the specified settings file. + /// + /// Path to the XML settings file. + /// Optional logger for diagnostics. + public ParametriSetup(string? fileSetup = null, ILogger? logger = null) { - private DataSet _elencoParametri; - public string NomeFileSetup { get; set; } - - public ParametriSetup(string fileSetup) + _logger = logger ?? Microsoft.Extensions.Logging.Abstractions.NullLogger.Instance; + NomeFileSetup = fileSetup; + if (!string.IsNullOrWhiteSpace(fileSetup)) { - _elencoParametri = new DataSet(); - NomeFileSetup = fileSetup; - if (!string.IsNullOrWhiteSpace(fileSetup)) - { - CaricaParametriSetup(); - } - } - - public ParametriSetup() : this(string.Empty) - { - } - - public void CaricaParametriSetup() - { - if (string.IsNullOrEmpty(NomeFileSetup) || !File.Exists(NomeFileSetup)) - { - _elencoParametri = new DataSet(); - return; - } - - _elencoParametri = LeggiXmlDataSet("Setup", NomeFileSetup, "Nome"); - } - - public void SalvaParametriSetup() - { - if (string.IsNullOrWhiteSpace(NomeFileSetup)) - throw new InvalidOperationException("NomeFileSetup is not set."); - - // overwrite without FileSystem.Kill - _elencoParametri.WriteXml(NomeFileSetup, XmlWriteMode.WriteSchema); - } - - // public string LeggiParametroString(string NomeParametro) - // { - // string Risposta = ""; - // try - // { - // var LElenco = _elencoParametri.Tables["Setup"].Select("Nome='" + NomeParametro + "'"); - // foreach (var LaRiga in LElenco) - // Risposta = LaRiga["Valore"].ToString(); - // } - // catch - // { - // Risposta = ""; - // } - // - // return Risposta; - // } - // - // public bool LeggiParametroBoolean(string nomeParametro) - // { - // var risposta = ""; - // try - // { - // var lElenco = _elencoParametri.Tables["Setup"].Select("Nome='" + nomeParametro + "'"); - // foreach (var laRiga in lElenco) - // risposta = laRiga["Valore"].ToString(); - // } - // catch - // { - // risposta = ""; - // } - // - // switch (risposta.ToUpper() ?? "") - // { - // case "TRUE": - // case "OK": - // case "SI": - // case "1": - // case "YES": - // case "VERO": - // { - // return true; - // } - // - // default: - // { - // return false; - // } - // } - // } - - public string LeggiParametroString(string nomeParametro) - { - return GetRow(nomeParametro)?["Valore"]?.ToString() ?? string.Empty; - } - - public bool LeggiParametroBoolean(string nomeParametro) - { - var raw = LeggiParametroString(nomeParametro); - return raw?.ToUpperInvariant() switch - { - "TRUE" or "OK" or "SI" or "1" or "YES" or "VERO" => true, - _ => false - }; - } - - public void AggiornaParametro(string nomeParametro, object valoreParametro) - { - var table = EnsureSetupTable(); - - var rows = table.Select($"Nome='{nomeParametro.Replace("'", "''")}'"); - if (rows.Length == 0) - { - var newRow = table.NewRow(); - newRow["Nome"] = nomeParametro; - newRow["Valore"] = valoreParametro?.ToString() ?? string.Empty; - table.Rows.Add(newRow); - } - else - { - rows[0]["Valore"] = valoreParametro?.ToString() ?? string.Empty; - } - } - - public T LeggiParametro(string nomeParametro, T defaultValue = default!) - { - var raw = LeggiParametroString(nomeParametro); - if (string.IsNullOrEmpty(raw)) return defaultValue; - - try - { - return (T)Convert.ChangeType(raw, typeof(T)); - } - catch - { - return defaultValue; - } - } - - private static DataSet LeggiXmlDataSet(string nomeTabella, string nomeFileXml, string nomeColonnaChiave = "") - { - var ds = new DataSet(); - ds.ReadXml(nomeFileXml); - - if (!string.IsNullOrEmpty(nomeColonnaChiave) && ds.Tables.Contains(nomeTabella)) - { - var table = ds.Tables[nomeTabella]; - if (table.Constraints[nomeColonnaChiave] == null) - { - table.Constraints.Add(nomeColonnaChiave, table.Columns[nomeColonnaChiave], true); - } - } - - return ds; - } - - private DataTable EnsureSetupTable() - { - if (!_elencoParametri.Tables.Contains("Setup")) - { - var table = new DataTable("Setup"); - table.Columns.Add("Nome", typeof(string)); - table.Columns.Add("Valore", typeof(string)); - _elencoParametri.Tables.Add(table); - } - - return _elencoParametri.Tables["Setup"]; - } - - private DataRow? GetRow(string nomeParametro) - { - if (!_elencoParametri.Tables.Contains("Setup")) return null; - var rows = _elencoParametri.Tables["Setup"] - .Select($"Nome='{nomeParametro.Replace("'", "''")}'"); - return rows.FirstOrDefault(); + CaricaParametriSetup(); } } - // public void AggiornaParametro(string NomeParametro, object ValoreParametro) - // { - // try - // { - // if (_elencoParametri.Tables["Setup"] is null) - // { - // var TabellaTmp = new DataTable("Setup"); - // DataRow RigaTmp; - // DataColumn LaColonna; - // LaColonna = TabellaTmp.Columns.Add("Nome", Type.GetType("System.String")); - // LaColonna = TabellaTmp.Columns.Add("Valore", Type.GetType("System.String")); - // - // // * Aggiunge alla tabella tutte le righe - // RigaTmp = TabellaTmp.NewRow(); - // RigaTmp["Nome"] = NomeParametro; - // RigaTmp["Valore"] = ValoreParametro; - // TabellaTmp.Rows.Add(RigaTmp); - // _elencoParametri.Tables.Add(TabellaTmp); - // } - // else - // { - // var LElenco = _elencoParametri.Tables["Setup"].Select("Nome='" + NomeParametro + "'"); - // if (LElenco.Length == 0) - // { - // DataRow LaRiga; - // LaRiga = _elencoParametri.Tables["Setup"].NewRow(); - // LaRiga["Nome"] = NomeParametro; - // LaRiga["Valore"] = ValoreParametro; - // _elencoParametri.Tables["Setup"].Rows.Add(LaRiga); - // } - // else - // { - // LElenco[0]["Valore"] = ValoreParametro; - // } - // } - // } - // catch - // { - // } - // } + /// + /// Loads settings from the XML file. + /// + public void CaricaParametriSetup() + { + lock (_lock) + { + if (string.IsNullOrEmpty(NomeFileSetup) || !File.Exists(NomeFileSetup)) + { + _parameters = new Dictionary(StringComparer.OrdinalIgnoreCase); + return; + } - // private static DataSet LeggiXmlDataSet(string NomeTabella, string NomeFileXml, string NomeColonnaChiave = "") - // { - // // * Crea e Legge il dataset dal file xml - // var DataSetXml = new DataSet(); - // DataSetXml.ReadXml(NomeFileXml); - // - // // * Aggiunge il campo chiave - // if (!string.IsNullOrEmpty(NomeColonnaChiave)) - // { - // DataSetXml.Tables[NomeTabella].Constraints.Add(NomeColonnaChiave, DataSetXml.Tables[NomeTabella].Columns[NomeColonnaChiave], true); - // } - // - // // * Restituisce la risposta - // return DataSetXml; - // } -//} + try + { + var doc = XDocument.Load(NomeFileSetup); + var setupElements = doc.Descendants("Setup"); + + _parameters = setupElements + .Where(e => e.Element("Nome") != null) + .ToDictionary( + e => e.Element("Nome")!.Value, + e => e.Element("Valore")?.Value ?? string.Empty, + StringComparer.OrdinalIgnoreCase + ); + + _logger.LogInformation("Loaded {Count} parameters from {FilePath}", _parameters.Count, NomeFileSetup); + } + catch (Exception ex) + { + _logger.LogError(ex, "Failed to load settings from {FilePath}", NomeFileSetup); + _parameters = new Dictionary(StringComparer.OrdinalIgnoreCase); + } + } + } + + /// + /// Saves settings to the XML file. + /// + /// Thrown when NomeFileSetup is not set. + public void SalvaParametriSetup() + { + if (string.IsNullOrWhiteSpace(NomeFileSetup)) + throw new InvalidOperationException("NomeFileSetup is not set."); + + lock (_lock) + { + try + { + // Ensure directory exists + var directory = Path.GetDirectoryName(NomeFileSetup); + if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory)) + { + Directory.CreateDirectory(directory); + } + + // Create XML document with DataSet-compatible structure + var doc = new XDocument( + new XDeclaration("1.0", "utf-8", "yes"), + new XElement("NewDataSet", + _parameters.Select(kvp => + new XElement("Setup", + new XElement("Nome", kvp.Key), + new XElement("Valore", kvp.Value) + ) + ) + ) + ); + + doc.Save(NomeFileSetup); + _logger.LogInformation("Saved {Count} parameters to {FilePath}", _parameters.Count, NomeFileSetup); + } + catch (Exception ex) + { + _logger.LogError(ex, "Failed to save settings to {FilePath}", NomeFileSetup); + throw; + } + } + } + + /// + /// Reads a parameter as a string. + /// + /// Parameter name. + /// Parameter value or empty string if not found. + public string LeggiParametroString(string nomeParametro) + { + lock (_lock) + { + return _parameters.TryGetValue(nomeParametro, out var value) ? value : string.Empty; + } + } + + /// + /// Reads a parameter as a boolean. + /// + /// Parameter name. + /// True if value is truthy (TRUE, OK, SI, 1, YES, VERO), false otherwise. + public bool LeggiParametroBoolean(string nomeParametro) + { + var raw = LeggiParametroString(nomeParametro); + return raw.ToUpperInvariant() switch + { + "TRUE" or "OK" or "SI" or "1" or "YES" or "VERO" => true, + _ => false + }; + } + + /// + /// Updates or creates a parameter. + /// + /// Parameter name. + /// Parameter value. + public void AggiornaParametro(string nomeParametro, object? valoreParametro) + { + lock (_lock) + { + _parameters[nomeParametro] = valoreParametro?.ToString() ?? string.Empty; + } + } + + /// + /// Reads a parameter and converts it to the specified type. + /// + /// Target type. + /// Parameter name. + /// Default value if conversion fails. + /// Converted value or default value. + public T LeggiParametro(string nomeParametro, T defaultValue = default!) + { + var raw = LeggiParametroString(nomeParametro); + if (string.IsNullOrEmpty(raw)) + return defaultValue; + + try + { + // Handle nullable types + var targetType = Nullable.GetUnderlyingType(typeof(T)) ?? typeof(T); + + // Special handling for common types + if (targetType == typeof(bool)) + { + return (T)(object)LeggiParametroBoolean(nomeParametro); + } + + return (T)Convert.ChangeType(raw, targetType, CultureInfo.InvariantCulture); + } + catch (Exception ex) + { + _logger.LogWarning(ex, "Failed to convert parameter {ParameterName} to {TypeName}, using default value", + nomeParametro, typeof(T).Name); + return defaultValue; + } + } + + /// + /// Checks if a parameter exists. + /// + /// Parameter name. + /// True if parameter exists, false otherwise. + public bool ParametroExists(string nomeParametro) + { + lock (_lock) + { + return _parameters.ContainsKey(nomeParametro); + } + } + + /// + /// Removes a parameter. + /// + /// Parameter name. + /// True if parameter was removed, false if it didn't exist. + public bool RimuoviParametro(string nomeParametro) + { + lock (_lock) + { + return _parameters.Remove(nomeParametro); + } + } + + /// + /// Gets all parameter names. + /// + /// Collection of parameter names. + public IReadOnlyCollection GetParameterNames() + { + lock (_lock) + { + return _parameters.Keys.ToList(); + } + } + + /// + /// Clears all parameters. + /// + public void ClearAll() + { + lock (_lock) + { + _parameters.Clear(); + } + } } \ No newline at end of file diff --git a/imagecatalog/Services/SettingsService.cs b/imagecatalog/Services/SettingsService.cs index fbf747f..3b0a630 100644 --- a/imagecatalog/Services/SettingsService.cs +++ b/imagecatalog/Services/SettingsService.cs @@ -1,22 +1,25 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Reflection; using System.Threading.Tasks; +using System.Xml.Serialization; using ImageCatalog; +using ImageCatalog_2.Models; +using Microsoft.Extensions.Logging; namespace ImageCatalog_2.Services { /// - /// Modern settings service that uses reflection to automatically save/load all properties + /// Modern settings service that uses DTO with attributes for serialization /// public class SettingsService : ISettingsService { private readonly ParametriSetup _parametriSetup; + private readonly ILogger _logger; - public SettingsService(ParametriSetup parametriSetup) + public SettingsService(ParametriSetup parametriSetup, ILogger logger) { _parametriSetup = parametriSetup; + _logger = logger; } public Task SaveSettingsAsync(string filePath, object settings) @@ -25,85 +28,153 @@ namespace ImageCatalog_2.Services { _parametriSetup.NomeFileSetup = filePath; - // Use reflection to get all properties and save them - var properties = settings.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance) - .Where(p => p.CanRead && IsSerializableType(p.PropertyType)); + // Convert ViewModel to DTO + var dto = ViewModelToDto(settings); + + // Use reflection on DTO properties with XmlElement attribute + var properties = typeof(SettingsDto).GetProperties(BindingFlags.Public | BindingFlags.Instance); foreach (var prop in properties) { - var value = prop.GetValue(settings); - _parametriSetup.AggiornaParametro(prop.Name, value); + // Get the XmlElement attribute to determine the XML property name + var xmlAttr = prop.GetCustomAttribute(); + if (xmlAttr == null) + continue; // Skip properties without XmlElement attribute + + var xmlName = xmlAttr.ElementName; + var value = prop.GetValue(dto); + + _parametriSetup.AggiornaParametro(xmlName, value); } _parametriSetup.SalvaParametriSetup(); }); } - public Task LoadSettingsAsync(string filePath, object settings) + public async Task LoadSettingsAsync(string filePath, object settings) { - return Task.Run(() => + // Step 1: Load XML and read into DTO on background thread + var dto = await Task.Run(() => { _parametriSetup.NomeFileSetup = filePath; _parametriSetup.CaricaParametriSetup(); - // Use reflection to get all properties and load them - var properties = settings.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance) - .Where(p => p.CanWrite && IsSerializableType(p.PropertyType)); + var loadedDto = new SettingsDto(); + var properties = typeof(SettingsDto).GetProperties(BindingFlags.Public | BindingFlags.Instance); foreach (var prop in properties) { + // Get the XmlElement attribute to determine the XML property name + var xmlAttr = prop.GetCustomAttribute(); + if (xmlAttr == null) + continue; // Skip properties without XmlElement attribute + + var xmlName = xmlAttr.ElementName; + try { object value; if (prop.PropertyType == typeof(string)) { - value = _parametriSetup.LeggiParametroString(prop.Name); - // Don't update if empty string and current value is not empty - if (string.IsNullOrEmpty((string)value)) - { - var currentValue = prop.GetValue(settings) as string; - if (!string.IsNullOrEmpty(currentValue)) - { - continue; // Skip if no value in settings but there's a default - } - } + value = _parametriSetup.LeggiParametroString(xmlName); } else if (prop.PropertyType == typeof(bool)) { - value = _parametriSetup.LeggiParametroBoolean(prop.Name); + value = _parametriSetup.LeggiParametroBoolean(xmlName); } else if (prop.PropertyType == typeof(int)) { - value = _parametriSetup.LeggiParametro(prop.Name, (int)(prop.GetValue(settings) ?? 0)); + value = _parametriSetup.LeggiParametro(xmlName, (int)(prop.GetValue(loadedDto) ?? 0)); } else if (prop.PropertyType == typeof(double)) { - value = _parametriSetup.LeggiParametro(prop.Name, (double)(prop.GetValue(settings) ?? 0.0)); + value = _parametriSetup.LeggiParametro(xmlName, (double)(prop.GetValue(loadedDto) ?? 0.0)); + } + else if (prop.PropertyType == typeof(DateTime)) + { + var strValue = _parametriSetup.LeggiParametroString(xmlName); + if (DateTime.TryParse(strValue, out var dateValue)) + { + value = dateValue; + } + else + { + value = (DateTime)(prop.GetValue(loadedDto) ?? DateTime.Now); + } } else { - continue; // Skip unsupported types + continue; } - prop.SetValue(settings, value); + prop.SetValue(loadedDto, value); } catch (Exception ex) { - // Skip properties that can't be loaded - System.Diagnostics.Debug.WriteLine($"Failed to load property {prop.Name}: {ex.Message}"); + _logger.LogError(ex, "Failed to read property {XmlName} -> {PropertyName}", xmlName, prop.Name); } } + + return loadedDto; }); + + // Step 2: Apply DTO values to ViewModel on UI thread + DtoToViewModel(dto, settings); } - private bool IsSerializableType(Type type) + /// + /// Converts DataModel (ViewModel) to SettingsDto + /// + private SettingsDto ViewModelToDto(object viewModel) { - return type == typeof(string) || - type == typeof(int) || - type == typeof(bool) || - type == typeof(double) || - type == typeof(float) || - type == typeof(decimal); + var vmType = viewModel.GetType(); + var dto = new SettingsDto(); + var dtoProps = typeof(SettingsDto).GetProperties(BindingFlags.Public | BindingFlags.Instance); + + foreach (var dtoProp in dtoProps) + { + // Find matching property in ViewModel by name + var vmProp = vmType.GetProperty(dtoProp.Name, BindingFlags.Public | BindingFlags.Instance); + if (vmProp != null && vmProp.CanRead) + { + var value = vmProp.GetValue(viewModel); + dtoProp.SetValue(dto, value); + } + } + + return dto; + } + + /// + /// Copies values from SettingsDto to DataModel (ViewModel) + /// + private void DtoToViewModel(SettingsDto dto, object viewModel) + { + var vmType = viewModel.GetType(); + var dtoProps = typeof(SettingsDto).GetProperties(BindingFlags.Public | BindingFlags.Instance); + + foreach (var dtoProp in dtoProps) + { + // Find matching property in ViewModel by name + var vmProp = vmType.GetProperty(dtoProp.Name, BindingFlags.Public | BindingFlags.Instance); + if (vmProp != null && vmProp.CanWrite) + { + var value = dtoProp.GetValue(dto); + + // Don't update if empty string and current value is not empty + if (dtoProp.PropertyType == typeof(string) && string.IsNullOrEmpty((string)value)) + { + var currentValue = vmProp.GetValue(viewModel) as string; + if (!string.IsNullOrEmpty(currentValue)) + { + continue; + } + } + + vmProp.SetValue(viewModel, value); + _logger.LogDebug("Set {PropertyName} = {Value}", vmProp.Name, value); + } + } } } } -- 2.52.0 From ba965e82666ce0baf6a8221c32b6f781333dbedc Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Wed, 4 Feb 2026 23:16:06 +0100 Subject: [PATCH 043/127] Fixes and mapping --- MaddoShared/ImageCreationStuff.cs | 2 +- MaddoShared/MaddoShared.csproj | 1 + imagecatalog/Commands/ButtonCommandBinder.cs | 53 +++ imagecatalog/DataModel.cs | 193 +++++++++- imagecatalog/ImageCatalog 2.csproj | 1 + imagecatalog/MainForm.Designer.cs | 10 - imagecatalog/MainForm.cs | 329 +++--------------- .../Mappings/DataModelMappingProfile.cs | 94 +++++ imagecatalog/Program.cs | 4 + imagecatalog/ViewModelBase.cs | 48 ++- 10 files changed, 450 insertions(+), 285 deletions(-) create mode 100644 imagecatalog/Commands/ButtonCommandBinder.cs create mode 100644 imagecatalog/Mappings/DataModelMappingProfile.cs diff --git a/MaddoShared/ImageCreationStuff.cs b/MaddoShared/ImageCreationStuff.cs index ac78603..778a7e8 100644 --- a/MaddoShared/ImageCreationStuff.cs +++ b/MaddoShared/ImageCreationStuff.cs @@ -96,7 +96,7 @@ namespace MaddoShared catch (Exception e) { logger.LogError(e, "Error in reporting update"); - throw; + // Don't rethrow - continue processing other images } } finally diff --git a/MaddoShared/MaddoShared.csproj b/MaddoShared/MaddoShared.csproj index 4753af8..502345d 100644 --- a/MaddoShared/MaddoShared.csproj +++ b/MaddoShared/MaddoShared.csproj @@ -9,6 +9,7 @@ + all diff --git a/imagecatalog/Commands/ButtonCommandBinder.cs b/imagecatalog/Commands/ButtonCommandBinder.cs new file mode 100644 index 0000000..2fc301c --- /dev/null +++ b/imagecatalog/Commands/ButtonCommandBinder.cs @@ -0,0 +1,53 @@ +using System; +using System.Windows.Forms; +using System.Windows.Input; + +namespace ImageCatalog_2.Commands +{ + /// + /// Helper class to bind WinForms Button controls to ICommand implementations + /// + public static class ButtonCommandBinder + { + /// + /// Binds a Button's Click event to an ICommand + /// + /// The button to bind + /// The command to execute + /// Optional parameter to pass to the command + public static void BindCommand(this Button button, ICommand command, object commandParameter = null) + { + if (button == null) throw new ArgumentNullException(nameof(button)); + if (command == null) throw new ArgumentNullException(nameof(command)); + + // Wire up the Click event to execute the command + button.Click += (sender, e) => + { + if (command.CanExecute(commandParameter)) + { + command.Execute(commandParameter); + } + }; + + // Wire up CanExecuteChanged to enable/disable the button + command.CanExecuteChanged += (sender, e) => + { + button.Enabled = command.CanExecute(commandParameter); + }; + + // Set initial enabled state + button.Enabled = command.CanExecute(commandParameter); + } + + /// + /// Binds multiple buttons to commands at once + /// + public static void BindCommands(params (Button button, ICommand command, object parameter)[] bindings) + { + foreach (var (button, command, parameter) in bindings) + { + button.BindCommand(command, parameter); + } + } + } +} diff --git a/imagecatalog/DataModel.cs b/imagecatalog/DataModel.cs index ce02440..49a715d 100644 --- a/imagecatalog/DataModel.cs +++ b/imagecatalog/DataModel.cs @@ -1,14 +1,19 @@ using ImageCatalog_2.Commands; using ImageCatalog_2.Services; using System; +using System.Collections.Concurrent; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Drawing.Text; using System.Linq; using System.Text; +using System.Threading; using System.Threading.Tasks; +using System.Windows.Forms; using System.Windows.Input; +using AutoMapper; +using MaddoShared; using Microsoft.Extensions.Logging; namespace ImageCatalog_2 @@ -29,17 +34,25 @@ namespace ImageCatalog_2 private readonly ITestService _service; private readonly ILogger _logger; private readonly ISettingsService _settingsService; + private readonly ImageCreationStuff _imageCreationService; + private readonly PicSettings _picSettings; + private readonly IMapper _mapper; // ComboBox collections public List AvailableFonts { get; } public List VerticalPositions { get; } = new() { "Alto", "Centro", "Basso" }; public List HorizontalAlignments { get; } = new() { "Sinistra", "Centro", "Destra" }; - public DataModel(ITestService testService, ISettingsService settingsService, ILogger logger) + public DataModel(ITestService testService, ISettingsService settingsService, + ImageCreationStuff imageCreationService, PicSettings picSettings, + IMapper mapper, ILogger logger) { _service = testService; _logger = logger; _settingsService = settingsService; + _imageCreationService = imageCreationService; + _picSettings = picSettings; + _mapper = mapper; TestCommand = new RelayCommand(Test); AsyncTestCommand = new AsyncCommand(TestAsync); @@ -774,6 +787,67 @@ namespace ImageCatalog_2 } } + // Image processing progress and status + private string _processingStatus = ""; + public string ProcessingStatus + { + get => _processingStatus; + set + { + _processingStatus = value; + NotifyPropertyChanged(); + } + } + + private int _processedImagesCount = 0; + public int ProcessedImagesCount + { + get => _processedImagesCount; + set + { + _processedImagesCount = value; + NotifyPropertyChanged(); + } + } + + private int _totalImagesCount = 0; + public int TotalImagesCount + { + get => _totalImagesCount; + set + { + _totalImagesCount = value; + NotifyPropertyChanged(); + } + } + + private int _progressBarValue = 0; + public int ProgressBarValue + { + get => _progressBarValue; + set + { + _progressBarValue = value; + NotifyPropertyChanged(); + } + } + + private int _progressBarMaximum = 100; + public int ProgressBarMaximum + { + get => _progressBarMaximum; + set + { + _progressBarMaximum = value; + NotifyPropertyChanged(); + } + } + + private ConcurrentBag _results = new(); + private int _currentAmount = 0; + private int _previousAmount = 0; + private System.Threading.Timer? _speedTimer; + private void Test(object parameter) { Debug.WriteLine("Yep"); @@ -787,6 +861,123 @@ namespace ImageCatalog_2 private async Task ProcessImages() { + _logger.LogInformation("Avvio elaborazione..."); + UiEnabled = false; + + MainToken?.Dispose(); + MainToken = new CancellationTokenSource(); + var token = MainToken.Token; + + // Fix paths + FixPaths(); + + // Reset counters + ProcessingStatus = "Elaborazione in corso..."; + TotalImagesCount = 0; + ProcessedImagesCount = 0; + SpeedCounter = "-f/m"; + ProgressBarValue = 0; + ProgressBarMaximum = 100; + + // Update PicSettings from DataModel using AutoMapper + _mapper.Map(this, _picSettings); + + var imageCreationOptions = new ImageCreationStuff.Options + { + AggiornaSottodirectory = UpdateSubdirectories, + CreaSottocartelle = CreateSubfolders, + FilePerCartella = FilesPerFolder, + SuffissoCartelle = FolderSuffix, + CifreContatore = CounterDigits, + NumerazioneType = UseProgressiveNumbering ? NumerazioneType.Progressiva : NumerazioneType.Files, + SourcePath = SourcePath, + DestinationPath = DestinationPath, + MaxThreads = ThreadsCount, + ChunksSize = ChunkSize, + LinearExecution = UseSequentialProcessing + }; + + try + { + _results = new ConcurrentBag(); + _currentAmount = 0; + _previousAmount = 0; + + // Start speed timer (every minute) + _speedTimer = new System.Threading.Timer(UpdateSpeedCounter, null, TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(1)); + + var time = await _imageCreationService.CreaCatalogoParallel( + imageCreationOptions, + _results, + OnImageProcessed, + token); + + SpeedCounter = time; + _speedTimer?.Dispose(); + _speedTimer = null; + } + catch (OperationCanceledException) + { + _logger.LogInformation("Operazione Cancellata"); + } + catch (Exception ex) + { + _logger.LogError(ex, "Errore durante l'elaborazione delle immagini"); + ProcessingStatus = $"Errore: {ex.Message}"; + } + finally + { + MainToken?.Dispose(); + MainToken = null; + _speedTimer?.Dispose(); + _speedTimer = null; + } + + ProcessingStatus = "Finito"; + UiEnabled = true; + } + + private void UpdateSpeedCounter(object? state) + { + _previousAmount = _currentAmount; + _currentAmount = _results.Count; + int diff = _currentAmount - _previousAmount; + SpeedCounter = $"{diff} f/m"; + } + + private void OnImageProcessed(object? sender, Tuple args) + { + ProcessedImagesCount = _results.Count; + TotalImagesCount = args.Item2; + ProgressBarMaximum = args.Item2; + ProgressBarValue = _results.Count; + ProcessingStatus = args.Item1; + } + + private void FixPaths() + { + SourcePath = FixPath(SourcePath); + DestinationPath = FixPath(DestinationPath); + } + + private string FixPath(string path) + { + if (string.IsNullOrWhiteSpace(path)) + { + return string.Empty; + } + + // Trim leading/trailing quotes + path = path.Trim().Trim('"'); + + // Normalize directory separators + path = path.Replace('/', System.IO.Path.DirectorySeparatorChar) + .Replace('\\', System.IO.Path.DirectorySeparatorChar); + + // Remove trailing separators then add one back + path = path.TrimEnd(System.IO.Path.DirectorySeparatorChar) + System.IO.Path.DirectorySeparatorChar; + + return path; } private async Task CancelOperation() diff --git a/imagecatalog/ImageCatalog 2.csproj b/imagecatalog/ImageCatalog 2.csproj index 6473071..aed7099 100644 --- a/imagecatalog/ImageCatalog 2.csproj +++ b/imagecatalog/ImageCatalog 2.csproj @@ -39,6 +39,7 @@ + diff --git a/imagecatalog/MainForm.Designer.cs b/imagecatalog/MainForm.Designer.cs index fdee7ba..266fa4f 100644 --- a/imagecatalog/MainForm.Designer.cs +++ b/imagecatalog/MainForm.Designer.cs @@ -1835,7 +1835,6 @@ namespace ImageCatalog _btnCreaCatalogoAsync.TabIndex = 68; _btnCreaCatalogoAsync.Text = "CREA"; _btnCreaCatalogoAsync.UseVisualStyleBackColor = true; - _btnCreaCatalogoAsync.Click += Button1_Click; // // dataModelBindingSource1 // @@ -2268,16 +2267,7 @@ namespace ImageCatalog [MethodImpl(MethodImplOptions.Synchronized)] set { - if (_btnCreaCatalogoAsync != null) - { - _btnCreaCatalogoAsync.Click -= Button1_Click; - } - _btnCreaCatalogoAsync = value; - if (_btnCreaCatalogoAsync != null) - { - _btnCreaCatalogoAsync.Click += Button1_Click; - } } } } diff --git a/imagecatalog/MainForm.cs b/imagecatalog/MainForm.cs index f18ab89..c5e7b12 100644 --- a/imagecatalog/MainForm.cs +++ b/imagecatalog/MainForm.cs @@ -13,9 +13,11 @@ using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; using ImageCatalog_2; +using ImageCatalog_2.Commands; using ImageCatalog_2.Services; using MaddoShared; using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging; namespace ImageCatalog; @@ -25,8 +27,6 @@ public partial class MainForm private readonly ILogger _logger; - private readonly ImageCreationStuff _imageCreationService; - private readonly ParametriSetup _parametriSetup; private readonly PicSettings _picSettings; @@ -34,7 +34,6 @@ public partial class MainForm ParametriSetup parametriSetup, ILogger logger) { Model = model; - _imageCreationService = imageCreationStuff; _parametriSetup = parametriSetup; _picSettings = picSettings; _logger = logger; @@ -42,77 +41,37 @@ public partial class MainForm _logger.LogDebug("Start"); InitializeComponent(); - BindControls(); - // Subscribe to DataModel events + // Set this form as the control for thread marshalling in the DataModel + Model.SetControl(this); + + BindControls(); + + var version = Assembly.GetExecutingAssembly().GetName().Version; + _Label27.Text = $"Version: {version.Major}.{version.Minor}.{version.Build}.{version.Revision}"; + } + + protected void BindControls() + { + // Bind buttons to ViewModel commands using command binding + _btnCreaCatalogoAsync.BindCommand(Model.ProcessImagesCommand); + button1.BindCommand(Model.ProcessImagesCommand); + _Button2.BindCommand(Model.SelectSourceFolderCommand); + _Button3.BindCommand(Model.SelectDestinationFolderCommand); + _Button4.BindCommand(Model.SelectLogoFileCommand); + _Button5.BindCommand(Model.SaveSettingsCommand); + _Button6.BindCommand(Model.LoadSettingsCommand); + _Button8.BindCommand(Model.SelectColorCommand); + + // Subscribe to ViewModel events for UI dialogs (these need UI context) Model.SelectSourceFolderRequested += OnSelectSourceFolderRequested; Model.SelectDestinationFolderRequested += OnSelectDestinationFolderRequested; Model.SelectLogoFileRequested += OnSelectLogoFileRequested; Model.SaveSettingsRequested += OnSaveSettingsRequested; Model.LoadSettingsRequested += OnLoadSettingsRequested; Model.SelectColorRequested += OnSelectColorRequested; - - var version = Assembly.GetExecutingAssembly().GetName().Version; - _Label27.Text = $"Version: {version.Major}.{version.Minor}.{version.Build}.{version.Revision}"; - - _results = []; - UiUpdateEvent += OnUiUpdateEvent; } - protected void BindControls() - { - // Wire up buttons to ViewModel commands - _Button2.Click += (s, e) => Model.SelectSourceFolderCommand.Execute(null); - _Button3.Click += (s, e) => Model.SelectDestinationFolderCommand.Execute(null); - _Button4.Click += (s, e) => Model.SelectLogoFileCommand.Execute(null); - _Button5.Click += (s, e) => Model.SaveSettingsCommand.Execute(null); - _Button6.Click += (s, e) => Model.LoadSettingsCommand.Execute(null); - _Button8.Click += (s, e) => Model.SelectColorCommand.Execute(null); - } - - private event EventHandler> UiUpdateEvent; - - delegate void SetTextCallback(Label target, string text); - - private void SetText(Label target, string text) - { - if (InvokeRequired) - { - var d = new SetTextCallback(SetText); - this.Invoke(d, new object[] { target, text }); - } - else - { - target.Text = text; - } - } - - private delegate void SetProgressCallback(ProgressBar target, int amount, int maximum); - - private void SetProgress(ProgressBar target, int amount, int maximum) - { - if (InvokeRequired) - { - var d = new SetProgressCallback(SetProgress); - this.Invoke(d, new object[] { target, amount, maximum }); - } - else - { - target.Maximum = maximum; - target.Value = amount; - } - } - - private void OnUiUpdateEvent(object sender, Tuple args) - { - SetProgress(ProgressBar1, _results.Count, args.Item2); - SetText(Label18, _results.Count.ToString()); - SetText(Label10, args.Item1); - SetText(lblFotoTotaliNum, args.Item2.ToString()); - } - - private ConcurrentBag _results; - private void SetDefaults() { // Bind ComboBoxes to Model using proper data binding @@ -135,6 +94,19 @@ public partial class MainForm ComboBox5.DataSource = new List { "Alto", "Centro", "Basso" }; ComboBox5.DataBindings.Add(new Binding("SelectedItem", bindingSource1, nameof(Model.LogoVerticalPosition), false, DataSourceUpdateMode.OnPropertyChanged)); + + // Bind progress bar and status labels + ProgressBar1.DataBindings.Add(new Binding("Maximum", bindingSource1, nameof(Model.ProgressBarMaximum), + false, DataSourceUpdateMode.OnPropertyChanged)); + ProgressBar1.DataBindings.Add(new Binding("Value", bindingSource1, nameof(Model.ProgressBarValue), + false, DataSourceUpdateMode.OnPropertyChanged)); + + Label18.DataBindings.Add(new Binding("Text", bindingSource1, nameof(Model.ProcessedImagesCount), + false, DataSourceUpdateMode.OnPropertyChanged)); + lblFotoTotaliNum.DataBindings.Add(new Binding("Text", bindingSource1, nameof(Model.TotalImagesCount), + false, DataSourceUpdateMode.OnPropertyChanged)); + Label10.DataBindings.Add(new Binding("Text", bindingSource1, nameof(Model.ProcessingStatus), + false, DataSourceUpdateMode.OnPropertyChanged)); } @@ -147,50 +119,6 @@ public partial class MainForm _logger.LogInformation("Programma Avviato"); } - private void FixPaths() - { - Model.SourcePath = FixPath(Model.SourcePath); - Model.DestinationPath = FixPath(Model.DestinationPath); - } - - private string FixPath(string path) - { - if (string.IsNullOrWhiteSpace(path)) - { - return string.Empty; - } - - // Trim leading/trailing quotes - path = path.Trim().Trim('"'); - - // Normalize directory separators - path = path.Replace('/', Path.DirectorySeparatorChar) - .Replace('\\', Path.DirectorySeparatorChar); - - // Remove trailing separators then add one back - path = path.TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar; - - return path; - } - - private void lockUI() - { - Model.UiEnabled = false; - //TabControl1.Enabled = false; - //Button5.Enabled = false; - //Button6.Enabled = false; - //btnCreaCatalogoAsync.Enabled = false; - } - - private void unlockUI() - { - Model.UiEnabled = true; - //TabControl1.Enabled = true; - //Button5.Enabled = true; - //Button6.Enabled = true; - //btnCreaCatalogoAsync.Enabled = true; - } - private string CalcTime(DateTime timeStart, DateTime timeStop, int numFoto) { long timediffH, timediffS; @@ -224,6 +152,26 @@ public partial class MainForm return FixPath(dialog.SelectedPath); } + private string FixPath(string path) + { + if (string.IsNullOrWhiteSpace(path)) + { + return string.Empty; + } + + // Trim leading/trailing quotes + path = path.Trim().Trim('"'); + + // Normalize directory separators + path = path.Replace('/', Path.DirectorySeparatorChar) + .Replace('\\', Path.DirectorySeparatorChar); + + // Remove trailing separators then add one back + path = path.TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar; + + return path; + } + private void OnSelectSourceFolderRequested(object sender, EventArgs e) { var dialogResult = SelectFolder(Model.SourcePath); @@ -356,76 +304,6 @@ public partial class MainForm } } - private void SetPicSettings(string SourcePath, string DestPath) - { - _picSettings.DirectorySorgente = SourcePath; - _picSettings.DirectoryDestinazione = DestPath; - - // Font and text settings from Model - _picSettings.DimStandard = Model.FontSize; - _picSettings.DimStandardMiniatura = Model.FontSizeThumbnail; - _picSettings.IlFont = Model.FontName; - _picSettings.Grassetto = Model.FontBold; - _picSettings.Posizione = Model.VerticalPosition; - _picSettings.Allineamento = Model.HorizontalAlignment; - _picSettings.Trasparenza = Model.TextTransparency; - _picSettings.Margine = Model.TextMargin; - _picSettings.FontColoreRGB = ColorTranslator.FromHtml(Model.TextColorRGB); - - // Thumbnail settings from Model - _picSettings.AltezzaSmall = Model.ThumbnailHeight; - _picSettings.LarghezzaSmall = Model.ThumbnailWidth; - _picSettings.Suffisso = Model.ThumbnailPrefix; - _picSettings.CreaMiniature = Model.CreateThumbnails; - _picSettings.JpegQualityMin = Model.JpegQualityThumbnail; - _picSettings.DimMin = Model.FontSizeThumbnail; - - // Big photo settings from Model - _picSettings.AltezzaBig = Model.PhotoBigHeight; - _picSettings.LarghezzaBig = Model.PhotoBigWidth; - _picSettings.FotoGrandeDimOrigina = Model.KeepOriginalDimensions; - _picSettings.JpegQuality = Model.JpegQuality; - _picSettings.Codice = Model.BigPhotoSuffix; - - // Logo settings from Model - _picSettings.LogoAggiungi = Model.AddLogo; - _picSettings.LogoNomeFile = Model.LogoFile; - _picSettings.LogoAltezza = Model.LogoHeight; - _picSettings.LogoLarghezza = Model.LogoWidth; - _picSettings.LogoMargine = Model.LogoMargin.ToString(); - _picSettings.LogoTrasparenza = Model.LogoTransparency.ToString(); - _picSettings.LogoPosizioneH = Model.LogoHorizontalPosition; - _picSettings.LogoPosizioneV = Model.LogoVerticalPosition; - - // Text content from Model - _picSettings.TestoFirmaStart = Model.HorizontalText; - _picSettings.TestoFirmaStartV = Model.VerticalText; - - // Vertical text settings from Model - _picSettings.DimVert = Model.VerticalTextSize; - _picSettings.MargVert = Model.VerticalTextMargin; - - // Boolean flags from Model - _picSettings.UsaRotazioneAutomatica = Model.AutomaticRotation; - _picSettings.UsaForzaJpg = Model.ForceJpeg; - _picSettings.TestoNome = Model.ShowPhotoNumber; - _picSettings.NomeData = Model.ShowDate; - _picSettings.UsaOrarioTestoApplicare = Model.AddTime; - _picSettings.UsaTempoGaraTestoApplicare = Model.AddRaceTime; - _picSettings.OverwriteFiles = Model.OverwriteImages; - - // Additional settings from Model - _picSettings.UsaOrarioMiniatura = Model.AddTimeToThumbnails; - _picSettings.DataPartenza = Model.RaceStartDate; - _picSettings.TestoOrario = Model.TimeLabel; - _picSettings.TestoMin = Model.ShowFileNameOnThumbnails; - - // Thumbnail text options from Model - _picSettings.AggiungiScritteMiniature = Model.AddTextToThumbnails; - _picSettings.AggTempoGaraMin = Model.AddRaceTimeToThumbnails; - _picSettings.AggNumTempMin = Model.AddNumberAndTimeToThumbnails; - } - private void setLabel18Text(string text) { if (Label18.InvokeRequired) @@ -437,99 +315,6 @@ public partial class MainForm Label18.Text = text; } } - - private NumerazioneType GetNumerazioneEnum() - { - NumerazioneType numerazioneType; - if (rdbNumProgressiva.Checked) - { - numerazioneType = NumerazioneType.Progressiva; - } - else - { - numerazioneType = NumerazioneType.Files; - } - - return numerazioneType; - } - - - private async void Button1_Click(object sender, EventArgs e) - { - _logger.LogInformation("Avvio elaborazione..."); - lockUI(); - - Model.MainToken?.Dispose(); - Model.MainToken = new CancellationTokenSource(); - var token = Model.MainToken.Token; - - // timeStart = TimeOfDay - FixPaths(); - Label10.Text = "Elaborazione in corso..."; - lblFotoTotaliNum.Text = "0"; - Label18.Text = "0"; - Model.SpeedCounter = "-f/m"; - SetPicSettings(Model.SourcePath, Model.DestinationPath); - ProgressBar1.Minimum = 0; - ProgressBar1.Step = 1; - ProgressBar1.Value = 0; - - var imageCreationOptions = new ImageCreationStuff.Options - { - AggiornaSottodirectory = chkAggiornaSottodirectory.Checked, - CreaSottocartelle = chkCreaSottocartelle.Checked, - FilePerCartella = int.Parse(txtFilePerCartella.Text), - SuffissoCartelle = txtSuffissoCartelle.Text, - CifreContatore = int.Parse(txtCifreContatore.Text), - NumerazioneType = GetNumerazioneEnum(), - SourcePath = Model.SourcePath, - DestinationPath = Model.DestinationPath, - MaxThreads = Model.ThreadsCount, - ChunksSize = Model.ChunkSize, - LinearExecution = rdbVecchioMetodo.Checked - }; - - try - { - _results = []; - _currentAmount = 0; - _previousAmount = 0; - timer1.Tick += Timer1OnTick; - - timer1.Interval = 1000 * 60; - timer1.Enabled = true; - - var time = - await _imageCreationService.CreaCatalogoParallel(imageCreationOptions, _results, UiUpdateEvent, token); - Model.SpeedCounter = time; - timer1.Enabled = false; - } - catch (OperationCanceledException operationCanceledException) - { - _logger.LogInformation("Operazione Cancellata"); - } - finally - { - Model.MainToken?.Dispose(); - Model.MainToken = null; - - timer1.Tick -= Timer1OnTick; - } - - Label10.Text = "Finito"; - unlockUI(); - } - - private int _currentAmount = 0; - private int _previousAmount = 0; - - private void Timer1OnTick(object sender, EventArgs e) - { - _previousAmount = _currentAmount; - _currentAmount = _results.Count; - int diff = _currentAmount - _previousAmount; - Model.SpeedCounter = $"{diff} f/m"; - } } public class PicInfo diff --git a/imagecatalog/Mappings/DataModelMappingProfile.cs b/imagecatalog/Mappings/DataModelMappingProfile.cs new file mode 100644 index 0000000..fd33654 --- /dev/null +++ b/imagecatalog/Mappings/DataModelMappingProfile.cs @@ -0,0 +1,94 @@ +using System.Drawing; +using AutoMapper; +using MaddoShared; + +namespace ImageCatalog_2.Mappings; + +/// +/// AutoMapper profile for mapping between DataModel and PicSettings +/// +public class DataModelMappingProfile : Profile +{ + public DataModelMappingProfile() + { + CreateMap() + // Paths + .ForMember(dest => dest.DirectorySorgente, opt => opt.MapFrom(src => src.SourcePath)) + .ForMember(dest => dest.DirectoryDestinazione, opt => opt.MapFrom(src => src.DestinationPath)) + + // Font and text settings + .ForMember(dest => dest.DimStandard, opt => opt.MapFrom(src => src.FontSize)) + .ForMember(dest => dest.DimStandardMiniatura, opt => opt.MapFrom(src => src.FontSizeThumbnail)) + .ForMember(dest => dest.IlFont, opt => opt.MapFrom(src => src.FontName)) + .ForMember(dest => dest.Grassetto, opt => opt.MapFrom(src => src.FontBold)) + .ForMember(dest => dest.Posizione, opt => opt.MapFrom(src => src.VerticalPosition)) + .ForMember(dest => dest.Allineamento, opt => opt.MapFrom(src => src.HorizontalAlignment)) + .ForMember(dest => dest.Trasparenza, opt => opt.MapFrom(src => src.TextTransparency)) + .ForMember(dest => dest.Margine, opt => opt.MapFrom(src => src.TextMargin)) + .ForMember(dest => dest.FontColoreRGB, opt => opt.MapFrom(src => ColorTranslator.FromHtml(src.TextColorRGB))) + + // Thumbnail settings + .ForMember(dest => dest.AltezzaSmall, opt => opt.MapFrom(src => src.ThumbnailHeight)) + .ForMember(dest => dest.LarghezzaSmall, opt => opt.MapFrom(src => src.ThumbnailWidth)) + .ForMember(dest => dest.Suffisso, opt => opt.MapFrom(src => src.ThumbnailPrefix)) + .ForMember(dest => dest.CreaMiniature, opt => opt.MapFrom(src => src.CreateThumbnails)) + .ForMember(dest => dest.JpegQualityMin, opt => opt.MapFrom(src => src.JpegQualityThumbnail)) + .ForMember(dest => dest.DimMin, opt => opt.MapFrom(src => src.FontSizeThumbnail)) + + // Big photo settings + .ForMember(dest => dest.AltezzaBig, opt => opt.MapFrom(src => src.PhotoBigHeight)) + .ForMember(dest => dest.LarghezzaBig, opt => opt.MapFrom(src => src.PhotoBigWidth)) + .ForMember(dest => dest.FotoGrandeDimOrigina, opt => opt.MapFrom(src => src.KeepOriginalDimensions)) + .ForMember(dest => dest.JpegQuality, opt => opt.MapFrom(src => src.JpegQuality)) + .ForMember(dest => dest.Codice, opt => opt.MapFrom(src => src.BigPhotoSuffix)) + + // Logo settings + .ForMember(dest => dest.LogoAggiungi, opt => opt.MapFrom(src => src.AddLogo)) + .ForMember(dest => dest.LogoNomeFile, opt => opt.MapFrom(src => src.LogoFile)) + .ForMember(dest => dest.LogoAltezza, opt => opt.MapFrom(src => src.LogoHeight)) + .ForMember(dest => dest.LogoLarghezza, opt => opt.MapFrom(src => src.LogoWidth)) + .ForMember(dest => dest.LogoMargine, opt => opt.MapFrom(src => src.LogoMargin.ToString())) + .ForMember(dest => dest.LogoTrasparenza, opt => opt.MapFrom(src => src.LogoTransparency.ToString())) + .ForMember(dest => dest.LogoPosizioneH, opt => opt.MapFrom(src => src.LogoHorizontalPosition)) + .ForMember(dest => dest.LogoPosizioneV, opt => opt.MapFrom(src => src.LogoVerticalPosition)) + + // Text content + .ForMember(dest => dest.TestoFirmaStart, opt => opt.MapFrom(src => src.HorizontalText)) + .ForMember(dest => dest.TestoFirmaStartV, opt => opt.MapFrom(src => src.VerticalText)) + + // Vertical text settings + .ForMember(dest => dest.DimVert, opt => opt.MapFrom(src => src.VerticalTextSize)) + .ForMember(dest => dest.MargVert, opt => opt.MapFrom(src => src.VerticalTextMargin)) + + // Boolean flags + .ForMember(dest => dest.UsaRotazioneAutomatica, opt => opt.MapFrom(src => src.AutomaticRotation)) + .ForMember(dest => dest.UsaForzaJpg, opt => opt.MapFrom(src => src.ForceJpeg)) + .ForMember(dest => dest.TestoNome, opt => opt.MapFrom(src => src.ShowPhotoNumber)) + .ForMember(dest => dest.NomeData, opt => opt.MapFrom(src => src.ShowDate)) + .ForMember(dest => dest.UsaOrarioTestoApplicare, opt => opt.MapFrom(src => src.AddTime)) + .ForMember(dest => dest.UsaTempoGaraTestoApplicare, opt => opt.MapFrom(src => src.AddRaceTime)) + .ForMember(dest => dest.OverwriteFiles, opt => opt.MapFrom(src => src.OverwriteImages)) + + // Additional settings + .ForMember(dest => dest.UsaOrarioMiniatura, opt => opt.MapFrom(src => src.AddTimeToThumbnails)) + .ForMember(dest => dest.DataPartenza, opt => opt.MapFrom(src => src.RaceStartDate)) + .ForMember(dest => dest.TestoOrario, opt => opt.MapFrom(src => src.TimeLabel)) + .ForMember(dest => dest.TestoMin, opt => opt.MapFrom(src => src.ShowFileNameOnThumbnails)) + + // Thumbnail text options + .ForMember(dest => dest.AggiungiScritteMiniature, opt => opt.MapFrom(src => src.AddTextToThumbnails)) + .ForMember(dest => dest.AggTempoGaraMin, opt => opt.MapFrom(src => src.AddRaceTimeToThumbnails)) + .ForMember(dest => dest.AggNumTempMin, opt => opt.MapFrom(src => src.AddNumberAndTimeToThumbnails)) + + // Ignore unmapped properties + .ForMember(dest => dest.DestDir, opt => opt.Ignore()) + .ForMember(dest => dest.SecretDefault, opt => opt.Ignore()) + .ForMember(dest => dest.SecretBig, opt => opt.Ignore()) + .ForMember(dest => dest.SecretSmall, opt => opt.Ignore()) + .ForMember(dest => dest.SecretPathSmall, opt => opt.Ignore()) + .ForMember(dest => dest.SecretPathBig, opt => opt.Ignore()) + .ForMember(dest => dest.FotoRuotaADestra, opt => opt.Ignore()) + .ForMember(dest => dest.FotoRuotaASinistra, opt => opt.Ignore()) + .ForMember(dest => dest.TempMinText, opt => opt.Ignore()); + } +} diff --git a/imagecatalog/Program.cs b/imagecatalog/Program.cs index 24ac1ab..2a5e2b2 100644 --- a/imagecatalog/Program.cs +++ b/imagecatalog/Program.cs @@ -3,6 +3,7 @@ using ImageCatalog; using ImageCatalog_2.Services; using MaddoShared; using Microsoft.Extensions.DependencyInjection; +using AutoMapper; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Logging.Console; @@ -79,6 +80,9 @@ static class Program private static void ConfigureServices(ServiceCollection services) { + // Register AutoMapper (new AddAutoMapper overload — provide config and marker types) + services.AddAutoMapper(cfg => { }, typeof(Program)); + // Register your services here services.AddTransient(); services.AddTransient(); diff --git a/imagecatalog/ViewModelBase.cs b/imagecatalog/ViewModelBase.cs index bedbb78..9807106 100644 --- a/imagecatalog/ViewModelBase.cs +++ b/imagecatalog/ViewModelBase.cs @@ -4,20 +4,66 @@ using System.ComponentModel; using System.Linq; using System.Runtime.CompilerServices; using System.Text; +using System.Threading; using System.Threading.Tasks; +using System.Windows.Forms; namespace ImageCatalog_2 { public class ViewModelBase : INotifyPropertyChanged { + private readonly SynchronizationContext? _synchronizationContext; + private Control? _control; + + protected ViewModelBase() + { + // Capture the synchronization context (UI thread context) + _synchronizationContext = SynchronizationContext.Current; + } + + /// + /// Set a Control to use for thread marshalling in WinForms applications. + /// This is required for proper cross-thread handling with data binding. + /// + public void SetControl(Control control) + { + _control = control; + } + public event PropertyChangedEventHandler? PropertyChanged; + // This method is called by the Set accessor of each property. // The CallerMemberName attribute that is applied to the optional propertyName // parameter causes the property name of the caller to be substituted as an argument. protected void NotifyPropertyChanged([CallerMemberName] String propertyName = "") { - if (PropertyChanged != null) + if (PropertyChanged == null) + return; + + // If we have a Control reference (WinForms), use Control.Invoke for proper marshalling + if (_control != null) { + if (_control.InvokeRequired) + { + _control.Invoke(() => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName))); + } + else + { + PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + // Fallback to SynchronizationContext if available + else if (_synchronizationContext != null && SynchronizationContext.Current != _synchronizationContext) + { + // We're on a different thread, marshal to the UI thread + _synchronizationContext.Send(_ => + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + }, null); + } + else + { + // We're already on the UI thread or no sync context available PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } -- 2.52.0 From 68c1106f65cf9b44e40615453d458636499a1d7d Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Tue, 10 Feb 2026 21:18:46 +0100 Subject: [PATCH 044/127] Enhance image processing performance and flexibility by introducing atomic counters, improving file pattern matching, and refining logo positioning logic. --- MaddoShared.Tests/MaddoShared.Tests.csproj | 18 +--- MaddoShared/FileHelperSharp.cs | 23 ++++- MaddoShared/ImageCreationStuff.cs | 17 +++- MaddoShared/ImageCreatorSharp.cs | 105 ++++++++++++++------- MaddoShared/MaddoShared.csproj | 5 +- MaddoShared/PicSettings.cs | 7 +- imagecatalog/DataModel.cs | 25 +++-- imagecatalog/ImageCatalog 2.csproj | 2 +- 8 files changed, 134 insertions(+), 68 deletions(-) diff --git a/MaddoShared.Tests/MaddoShared.Tests.csproj b/MaddoShared.Tests/MaddoShared.Tests.csproj index 5ab4340..ffb84db 100644 --- a/MaddoShared.Tests/MaddoShared.Tests.csproj +++ b/MaddoShared.Tests/MaddoShared.Tests.csproj @@ -9,26 +9,14 @@ - + - - + + - - - - - - - - - - - - diff --git a/MaddoShared/FileHelperSharp.cs b/MaddoShared/FileHelperSharp.cs index 905999e..ef15e32 100644 --- a/MaddoShared/FileHelperSharp.cs +++ b/MaddoShared/FileHelperSharp.cs @@ -88,7 +88,28 @@ namespace MaddoShared DirectoryInfo destDir; destDir = new DirectoryInfo(Path.Combine(dirDest.FullName)); - foreach (FileInfo file in dir.GetFiles(filter)) + + // Support multiple patterns separated by ';' or ',' + var patterns = (filter ?? "*").Split(new[] { ';', ',' }, StringSplitOptions.RemoveEmptyEntries).Select(p => p.Trim()).ToArray(); + + // Collect matching files for all patterns and avoid duplicates + var matchedFiles = new List(); + foreach (var pat in patterns) + { + try + { + matchedFiles.AddRange(dir.GetFiles(pat)); + } + catch + { + // Ignore pattern errors and continue + } + } + + // Remove duplicates (by FullName) + var distinctFiles = matchedFiles.GroupBy(f => f.FullName, StringComparer.OrdinalIgnoreCase).Select(g => g.First()).OrderBy(f => f.Name).ToList(); + + foreach (FileInfo file in distinctFiles) { contaFilePerDir += 1; diff --git a/MaddoShared/ImageCreationStuff.cs b/MaddoShared/ImageCreationStuff.cs index 778a7e8..04f283a 100644 --- a/MaddoShared/ImageCreationStuff.cs +++ b/MaddoShared/ImageCreationStuff.cs @@ -142,13 +142,17 @@ namespace MaddoShared private List GetFilesToProcess(Options options) { + // Support multiple common JPEG patterns so files named .jpeg, .jpe, etc. are included + var jpgPatterns = new[] { "*.jpg", "*.jpeg", "*.jpe", "*.jfif", "*.pjpeg", "*.pjp" }; + if (options.AggiornaSottodirectory && options.CreaSottocartelle) { var helper = new FileHelperSharp(); + // Pass patterns joined by ';' - FileHelperSharp will split and handle multiple patterns return helper.GetFilesRecursive( new DirectoryInfo(options.SourcePath), new DirectoryInfo(options.DestinationPath), - "*.jpg", + string.Join(";", jpgPatterns), new FileHelperOptions { FilesPerFolder = options.FilePerCartella, @@ -158,10 +162,13 @@ namespace MaddoShared }); } - var files = Directory.EnumerateFiles( - options.SourcePath, - "*.jpg", - options.AggiornaSottodirectory ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly); + // For non-recursive or recursive enumeration without using the helper, enumerate for each pattern + var searchOption = options.AggiornaSottodirectory ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly; + + var files = jpgPatterns + .SelectMany(p => Directory.EnumerateFiles(options.SourcePath, p, searchOption)) + .Distinct() + .ToList(); return files.Select(x => { diff --git a/MaddoShared/ImageCreatorSharp.cs b/MaddoShared/ImageCreatorSharp.cs index 0f77df9..e0edfb0 100644 --- a/MaddoShared/ImageCreatorSharp.cs +++ b/MaddoShared/ImageCreatorSharp.cs @@ -267,26 +267,36 @@ public class ImageCreatorSharp(PicSettings picSettings, ILogger image.Width * 0.95f || textSize.Height > maxTextHeight) && tempFontSize > 5) + { + tempFontSize = (tempFontSize > 20) ? tempFontSize - 5 : tempFontSize - 1; + using var tempFont = CreateFont(picSettings.IlFont, tempFontSize, picSettings.Grassetto); + textSize = graphics.MeasureString(imgState.TestoFirmaPiccola, tempFont); + } - SetVerticalPosition(image.Height, textSize.Height, imgState); + // Re-measure text with the final font size for accurate positioning + using var finalFont = CreateFont(picSettings.IlFont, tempFontSize, picSettings.Grassetto); + var finalTextSize = graphics.MeasureString(imgState.TestoFirmaPiccola, finalFont); - float xCenter = CalculateHorizontalAlignment(image.Width, textSize.Width); + SetVerticalPosition(image.Height, finalTextSize.Height, imgState); + + float xCenter = CalculateHorizontalAlignment(image.Width, finalTextSize.Width); using var stringFormat = new StringFormat(); stringFormat.Alignment = StringAlignment.Center; using var shadowBrush = new SolidBrush(Color.FromArgb(imgState.AlphaScelta, 0, 0, 0)); using var textBrush = new SolidBrush(Color.FromArgb(imgState.AlphaScelta, picSettings.FontColoreRGB)); - imgState.DimensioneStandardMiniatura = picSettings.DimMin; - - using var finalFont = - CreateFont(picSettings.IlFont, imgState.DimensioneStandardMiniatura, picSettings.Grassetto); DrawText(graphics, imgState, xCenter, stringFormat, shadowBrush, textBrush, finalFont); using var finalThumb = @@ -324,20 +334,6 @@ public class ImageCreatorSharp(PicSettings picSettings, ILogger maxWidth && currentSize > 5) - { - currentSize = (currentSize > 20) ? currentSize - 5 : currentSize - 1; - using var tempFont = CreateFont(picSettings.IlFont, currentSize, picSettings.Grassetto); - size = g.MeasureString(imgState.TestoFirmaPiccola, tempFont); - //tempFont.Dispose(); - } - - imgState.DimensioneStandardMiniatura = currentSize; - } private void AddText(Image g, ImageState imgState, Bitmap imgOutputBig) { @@ -493,11 +489,17 @@ public class ImageCreatorSharp(PicSettings picSettings, ILogger= minMargin (not clipped at top) + // - Bottom edge must be <= imgHeight - minMargin (not clipped at bottom) + var maxAllowedY1 = imgHeight - textHeight - minMargin; // Maximum Y to keep bottom margin + var maxAllowedY4 = imgHeight - textHeight - minMargin; + + imgState.YPosFromBottom1 = Math.Max(minMargin, Math.Min(desiredY1, maxAllowedY1)); + imgState.YPosFromBottom4 = Math.Max(minMargin, Math.Min(desiredY4, maxAllowedY4)); + break; + + case "CENTRO": + default: + // Center the text vertically + var centeredY = (imgHeight - textHeight) / 2f; + // Clamp to ensure margins are respected + imgState.YPosFromBottom1 = Math.Max(minMargin, Math.Min(centeredY, imgHeight - textHeight - minMargin)); + imgState.YPosFromBottom4 = imgState.YPosFromBottom1; break; } } diff --git a/MaddoShared/MaddoShared.csproj b/MaddoShared/MaddoShared.csproj index 502345d..e95dcf4 100644 --- a/MaddoShared/MaddoShared.csproj +++ b/MaddoShared/MaddoShared.csproj @@ -9,7 +9,6 @@ - all @@ -20,7 +19,7 @@ - + @@ -28,6 +27,6 @@ all - + \ No newline at end of file diff --git a/MaddoShared/PicSettings.cs b/MaddoShared/PicSettings.cs index 8df3136..7472b63 100644 --- a/MaddoShared/PicSettings.cs +++ b/MaddoShared/PicSettings.cs @@ -38,9 +38,10 @@ public class PicSettings public int LogoLarghezza { get; set; } public Color FontColoreRGB { get; set; } public bool LogoAggiungi { get; set; } - public string LogoNomeFile { get; set; } - public string LogoTrasparenza { get; set; } - public string LogoMargine { get; set; } + // Initialize logo-related strings to safe defaults to avoid null reference issues + public string LogoNomeFile { get; set; } = string.Empty; + public string LogoTrasparenza { get; set; } = "100"; + public string LogoMargine { get; set; } = "0"; public string LogoPosizioneH { get; set; } public string LogoPosizioneV { get; set; } public bool FotoGrandeDimOrigina { get; set; } diff --git a/imagecatalog/DataModel.cs b/imagecatalog/DataModel.cs index 49a715d..83359d2 100644 --- a/imagecatalog/DataModel.cs +++ b/imagecatalog/DataModel.cs @@ -846,6 +846,8 @@ namespace ImageCatalog_2 private ConcurrentBag _results = new(); private int _currentAmount = 0; private int _previousAmount = 0; + // Atomic counter for processed images — avoids expensive ConcurrentBag.Count enumerations + private int _processedAtomic = 0; private System.Threading.Timer? _speedTimer; private void Test(object parameter) @@ -875,7 +877,7 @@ namespace ImageCatalog_2 ProcessingStatus = "Elaborazione in corso..."; TotalImagesCount = 0; ProcessedImagesCount = 0; - SpeedCounter = "-f/m"; + SpeedCounter = "-f/s"; ProgressBarValue = 0; ProgressBarMaximum = 100; @@ -902,9 +904,10 @@ namespace ImageCatalog_2 _results = new ConcurrentBag(); _currentAmount = 0; _previousAmount = 0; + _processedAtomic = 0; - // Start speed timer (every minute) - _speedTimer = new System.Threading.Timer(UpdateSpeedCounter, null, TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(1)); + // Start speed timer (sample every second using lightweight atomic reads) + _speedTimer = new System.Threading.Timer(UpdateSpeedCounter, null, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(1)); var time = await _imageCreationService.CreaCatalogoParallel( imageCreationOptions, @@ -940,17 +943,21 @@ namespace ImageCatalog_2 private void UpdateSpeedCounter(object? state) { _previousAmount = _currentAmount; - _currentAmount = _results.Count; + // Read the atomic counter without enumerating the ConcurrentBag + _currentAmount = System.Threading.Volatile.Read(ref _processedAtomic); int diff = _currentAmount - _previousAmount; - SpeedCounter = $"{diff} f/m"; + // Report files per second (timer runs every 1s) + SpeedCounter = $"{diff} f/s"; } private void OnImageProcessed(object? sender, Tuple args) { - ProcessedImagesCount = _results.Count; + // Increment atomic processed counter once and use its value for all UI updates + var processed = System.Threading.Interlocked.Increment(ref _processedAtomic); + ProcessedImagesCount = processed; TotalImagesCount = args.Item2; ProgressBarMaximum = args.Item2; - ProgressBarValue = _results.Count; + ProgressBarValue = processed; ProcessingStatus = args.Item1; } @@ -1044,4 +1051,6 @@ namespace ImageCatalog_2 await _settingsService.LoadSettingsAsync(filePath, this); } } -} \ No newline at end of file +} + + diff --git a/imagecatalog/ImageCatalog 2.csproj b/imagecatalog/ImageCatalog 2.csproj index aed7099..e3cdec0 100644 --- a/imagecatalog/ImageCatalog 2.csproj +++ b/imagecatalog/ImageCatalog 2.csproj @@ -42,7 +42,7 @@ - + all -- 2.52.0 From 39b0904a72269f4a86daf85533326222da5584e6 Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Tue, 10 Feb 2026 21:30:56 +0100 Subject: [PATCH 045/127] Update test project SDK, add assessment, bump submodule - Switched MaddoShared.Tests.csproj to Microsoft.NET.Sdk, added explicit MSTest and test SDK package references, and upgraded Microsoft.Extensions.Logging.Abstractions to 10.0.2. - Added assessment.csv, assessment.json, and assessment.md with detailed .NET 10.0 compatibility analysis. - Updated MaddoLibrary submodule reference (now marked as dirty). --- MaddoShared.Tests/MaddoShared.Tests.csproj | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/MaddoShared.Tests/MaddoShared.Tests.csproj b/MaddoShared.Tests/MaddoShared.Tests.csproj index ffb84db..0b2620b 100644 --- a/MaddoShared.Tests/MaddoShared.Tests.csproj +++ b/MaddoShared.Tests/MaddoShared.Tests.csproj @@ -1,4 +1,4 @@ - + net10.0-windows @@ -8,10 +8,16 @@ true + + + + + + - + -- 2.52.0 From c2fd4bf780a6404e45b95abf02ab6197bc08ff5c Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Sat, 14 Feb 2026 19:20:25 +0100 Subject: [PATCH 046/127] Add image processing benchmarks and UI folder open buttons - Added MaddoShared.Benchmarks project with BenchmarkDotNet for comprehensive image processing performance tests (parallel, chunk, size, stress). - Included helper for generating test images and custom configs to ensure InProcess toolchain for .NET Windows compatibility. - Added cross-platform scripts to run benchmarks easily. - Updated .gitignore for benchmark artifacts and temp files. - Exposed GetFilesToProcessPublic in ImageCreationStuff for testability. - Added file name sanitization in ImageCreatorSharp to prevent IO errors. - Enhanced WinForms UI: added "Open" buttons for source/destination folders, handled folder opening in Explorer, and improved user messaging and layout. - Updated solution file to include new benchmark project. --- Catalog.sln | 16 +- MaddoShared.Benchmarks/.gitignore | 25 + MaddoShared.Benchmarks/BenchmarkConfig.cs | 91 +++ MaddoShared.Benchmarks/ChunkSizeBenchmarks.cs | 130 ++++ .../Helpers/TestImageGenerator.cs | 107 +++ .../ImageProcessingBenchmarks.cs | 182 +++++ MaddoShared.Benchmarks/ImageSizeBenchmarks.cs | 151 +++++ .../MaddoShared.Benchmarks.csproj | 21 + MaddoShared.Benchmarks/Program.cs | 35 + MaddoShared.Benchmarks/StressTestBenchmark.cs | 172 +++++ MaddoShared/ImageCreationStuff.cs | 9 + MaddoShared/ImageCreatorSharp.cs | 15 + imagecatalog/DataModel.cs | 2 + imagecatalog/MainForm.Designer.cs | 628 +++++++++--------- imagecatalog/MainForm.cs | 71 ++ run-benchmarks.ps1 | 124 ++++ run-benchmarks.sh | 134 ++++ 17 files changed, 1610 insertions(+), 303 deletions(-) create mode 100644 MaddoShared.Benchmarks/.gitignore create mode 100644 MaddoShared.Benchmarks/BenchmarkConfig.cs create mode 100644 MaddoShared.Benchmarks/ChunkSizeBenchmarks.cs create mode 100644 MaddoShared.Benchmarks/Helpers/TestImageGenerator.cs create mode 100644 MaddoShared.Benchmarks/ImageProcessingBenchmarks.cs create mode 100644 MaddoShared.Benchmarks/ImageSizeBenchmarks.cs create mode 100644 MaddoShared.Benchmarks/MaddoShared.Benchmarks.csproj create mode 100644 MaddoShared.Benchmarks/Program.cs create mode 100644 MaddoShared.Benchmarks/StressTestBenchmark.cs create mode 100644 run-benchmarks.ps1 create mode 100644 run-benchmarks.sh diff --git a/Catalog.sln b/Catalog.sln index 958365d..a5fd6f7 100644 --- a/Catalog.sln +++ b/Catalog.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 18 -VisualStudioVersion = 18.2.11415.280 d18.0 +VisualStudioVersion = 18.2.11415.280 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ImageCatalog 2", "imagecatalog\ImageCatalog 2.csproj", "{3F1E23DB-435E-0590-1EF5-735E898DBA3C}" EndProject @@ -13,6 +13,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{5F0BEF23 EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MaddoShared.Tests", "MaddoShared.Tests\MaddoShared.Tests.csproj", "{59952BE8-20B4-4BF2-9367-705F41395265}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MaddoShared.Benchmarks", "MaddoShared.Benchmarks\MaddoShared.Benchmarks.csproj", "{07499348-8C15-4DCC-8316-4AD121A43C38}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -59,6 +61,18 @@ Global {59952BE8-20B4-4BF2-9367-705F41395265}.Release|x64.Build.0 = Release|Any CPU {59952BE8-20B4-4BF2-9367-705F41395265}.Release|x86.ActiveCfg = Release|Any CPU {59952BE8-20B4-4BF2-9367-705F41395265}.Release|x86.Build.0 = Release|Any CPU + {07499348-8C15-4DCC-8316-4AD121A43C38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {07499348-8C15-4DCC-8316-4AD121A43C38}.Debug|Any CPU.Build.0 = Debug|Any CPU + {07499348-8C15-4DCC-8316-4AD121A43C38}.Debug|x64.ActiveCfg = Debug|Any CPU + {07499348-8C15-4DCC-8316-4AD121A43C38}.Debug|x64.Build.0 = Debug|Any CPU + {07499348-8C15-4DCC-8316-4AD121A43C38}.Debug|x86.ActiveCfg = Debug|Any CPU + {07499348-8C15-4DCC-8316-4AD121A43C38}.Debug|x86.Build.0 = Debug|Any CPU + {07499348-8C15-4DCC-8316-4AD121A43C38}.Release|Any CPU.ActiveCfg = Release|Any CPU + {07499348-8C15-4DCC-8316-4AD121A43C38}.Release|Any CPU.Build.0 = Release|Any CPU + {07499348-8C15-4DCC-8316-4AD121A43C38}.Release|x64.ActiveCfg = Release|Any CPU + {07499348-8C15-4DCC-8316-4AD121A43C38}.Release|x64.Build.0 = Release|Any CPU + {07499348-8C15-4DCC-8316-4AD121A43C38}.Release|x86.ActiveCfg = Release|Any CPU + {07499348-8C15-4DCC-8316-4AD121A43C38}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/MaddoShared.Benchmarks/.gitignore b/MaddoShared.Benchmarks/.gitignore new file mode 100644 index 0000000..28b2fd7 --- /dev/null +++ b/MaddoShared.Benchmarks/.gitignore @@ -0,0 +1,25 @@ +# BenchmarkDotNet artifacts +BenchmarkDotNet.Artifacts/ + +# Test images generated during benchmarks +TestImages/ + +# Build outputs +bin/ +obj/ + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# Results and logs +*.log +*.html +*.csv +results/ + +# Temporary files +*.tmp +*.temp diff --git a/MaddoShared.Benchmarks/BenchmarkConfig.cs b/MaddoShared.Benchmarks/BenchmarkConfig.cs new file mode 100644 index 0000000..182a392 --- /dev/null +++ b/MaddoShared.Benchmarks/BenchmarkConfig.cs @@ -0,0 +1,91 @@ +using BenchmarkDotNet.Columns; +using BenchmarkDotNet.Configs; +using BenchmarkDotNet.Diagnosers; +using BenchmarkDotNet.Engines; +using BenchmarkDotNet.Exporters; +using BenchmarkDotNet.Exporters.Csv; +using BenchmarkDotNet.Jobs; +using BenchmarkDotNet.Loggers; +using BenchmarkDotNet.Toolchains.InProcess.Emit; + +namespace MaddoShared.Benchmarks; + +/// +/// InProcess configuration for benchmarks requiring Windows-specific APIs +/// This avoids the net10.0-windows vs net10.0 compatibility issue +/// +public class InProcessConfig : ManualConfig +{ + public InProcessConfig() + { + AddLogger(ConsoleLogger.Default); + AddExporter(HtmlExporter.Default); + AddExporter(MarkdownExporter.GitHub); + AddExporter(CsvExporter.Default); + AddDiagnoser(MemoryDiagnoser.Default); + + // Add job with InProcess toolchain + AddJob(Job.Default + .WithToolchain(InProcessEmitToolchain.Instance) + .WithWarmupCount(1) + .WithIterationCount(3)); + + // Configuration options + WithOptions(ConfigOptions.DisableOptimizationsValidator); + WithOptions(ConfigOptions.KeepBenchmarkFiles); + } +} + +/// +/// Custom configuration for image processing benchmarks +/// Uses InProcess toolchain to avoid net10.0-windows compatibility issues +/// +public class BenchmarkConfig : ManualConfig +{ + public BenchmarkConfig() + { + // Add console logger + AddLogger(ConsoleLogger.Default); + + // Add exporters for different formats + AddExporter(HtmlExporter.Default); + AddExporter(MarkdownExporter.GitHub); + AddExporter(CsvExporter.Default); + AddExporter(RPlotExporter.Default); + + // Add diagnosers + AddDiagnoser(MemoryDiagnoser.Default); + AddDiagnoser(ThreadingDiagnoser.Default); + + // Add columns + AddColumn(StatisticColumn.Mean); + AddColumn(StatisticColumn.StdDev); + AddColumn(StatisticColumn.Error); + AddColumn(StatisticColumn.Min); + AddColumn(StatisticColumn.Max); + AddColumn(StatisticColumn.Median); + AddColumn(BaselineRatioColumn.RatioMean); + + // Customize jobs with InProcess toolchain for Windows compatibility + AddJob(Job.Default + .WithToolchain(InProcessEmitToolchain.Instance) + .WithWarmupCount(1) + .WithIterationCount(3) + .WithId("Quick")); + + AddJob(Job.Default + .WithToolchain(InProcessEmitToolchain.Instance) + .WithWarmupCount(2) + .WithIterationCount(5) + .WithId("Standard")); + } + + /// + /// Fast configuration for development and quick tests + /// + public static IConfig Fast => new ManualConfig() + .AddLogger(ConsoleLogger.Default) + .AddExporter(MarkdownExporter.GitHub) + .AddDiagnoser(MemoryDiagnoser.Default) + .AddJob(Job.Dry.WithToolchain(InProcessEmitToolchain.Instance)); // Very fast, but less accurate +} diff --git a/MaddoShared.Benchmarks/ChunkSizeBenchmarks.cs b/MaddoShared.Benchmarks/ChunkSizeBenchmarks.cs new file mode 100644 index 0000000..8ea126f --- /dev/null +++ b/MaddoShared.Benchmarks/ChunkSizeBenchmarks.cs @@ -0,0 +1,130 @@ +using System; +using System.Collections.Concurrent; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using BenchmarkDotNet.Attributes; +using BenchmarkDotNet.Configs; +using BenchmarkDotNet.Engines; +using BenchmarkDotNet.Jobs; +using BenchmarkDotNet.Toolchains.InProcess.Emit; +using MaddoShared.Benchmarks.Helpers; +using Microsoft.Extensions.Logging; + +namespace MaddoShared.Benchmarks; + +/// +/// Benchmarks focused on different chunk sizes for parallel processing +/// +[MemoryDiagnoser] +[Config(typeof(InProcessConfig))] +public class ChunkSizeBenchmarks +{ + private string _sourceDirectory; + private string _destinationDirectory; + private ImageCreationStuff _imageCreationStuff; + private PicSettings _picSettings; + + [Params(100)] + public int ImageCount { get; set; } + + [Params(0, 5, 10, 20, 50)] + public int ChunkSize { get; set; } + + [GlobalSetup] + public void Setup() + { + var tempBase = Path.Combine(Path.GetTempPath(), "ChunkBenchmarks", Guid.NewGuid().ToString()); + _sourceDirectory = Path.Combine(tempBase, "Source"); + _destinationDirectory = Path.Combine(tempBase, "Destination"); + + Directory.CreateDirectory(_sourceDirectory); + Directory.CreateDirectory(_destinationDirectory); + + Console.WriteLine($"Generating {ImageCount} test images for chunk size testing..."); + TestImageGenerator.GenerateTestImages(_sourceDirectory, ImageCount, width: 2000, height: 1500); + + var loggerFactory = LoggerFactory.Create(builder => + { + builder.SetMinimumLevel(LogLevel.Warning); + }); + + var logger = loggerFactory.CreateLogger(); + var imageCreatorLogger = loggerFactory.CreateLogger(); + + _picSettings = new PicSettings + { + DirectorySorgente = _sourceDirectory, + DirectoryDestinazione = _destinationDirectory, + DimStandard = 800, + DimStandardMiniatura = 200, + LarghezzaBig = 1024, + AltezzaBig = 768, + LarghezzaSmall = 200, + AltezzaSmall = 150, + CreaMiniature = true, + AggiungiScritteMiniature = false, + UsaForzaJpg = true, + UsaRotazioneAutomatica = true, + LogoAggiungi = false, + FotoGrandeDimOrigina = false, + TestoNome = false, + NomeData = false, + Suffisso = "_small", + Margine = 10, + Trasparenza = 100 + }; + + var imageCreatorService = new ImageCreatorSharp(_picSettings, imageCreatorLogger); + _imageCreationStuff = new ImageCreationStuff(logger, _picSettings, imageCreatorService); + } + + [GlobalCleanup] + public void Cleanup() + { + try + { + var tempBase = Path.GetDirectoryName(_sourceDirectory); + if (Directory.Exists(tempBase)) + { + Directory.Delete(tempBase, recursive: true); + } + } + catch (Exception ex) + { + Console.WriteLine($"Cleanup error: {ex.Message}"); + } + } + + [IterationSetup] + public void IterationSetup() + { + if (Directory.Exists(_destinationDirectory)) + { + Directory.Delete(_destinationDirectory, recursive: true); + } + Directory.CreateDirectory(_destinationDirectory); + } + + [Benchmark] + public async Task ProcessWithVariableChunkSize() + { + var options = new ImageCreationStuff.Options + { + SourcePath = _sourceDirectory, + DestinationPath = _destinationDirectory, + MaxThreads = Environment.ProcessorCount, + ChunksSize = ChunkSize, + LinearExecution = false, + AggiornaSottodirectory = false, + CreaSottocartelle = false, + FilePerCartella = 100, + SuffissoCartelle = "", + CifreContatore = 4, + NumerazioneType = NumerazioneType.Progressiva + }; + + var results = new ConcurrentBag(); + await _imageCreationStuff.ProcessImagesParallel(options, results, null, CancellationToken.None); + } +} diff --git a/MaddoShared.Benchmarks/Helpers/TestImageGenerator.cs b/MaddoShared.Benchmarks/Helpers/TestImageGenerator.cs new file mode 100644 index 0000000..34f44b5 --- /dev/null +++ b/MaddoShared.Benchmarks/Helpers/TestImageGenerator.cs @@ -0,0 +1,107 @@ +using System; +using System.Diagnostics.CodeAnalysis; +using System.Drawing; +using System.Drawing.Imaging; +using System.IO; + +namespace MaddoShared.Benchmarks.Helpers; + +/// +/// Helper class to generate test images for benchmarking +/// +[SuppressMessage("Interoperability", "CA1416:Validate platform compatibility")] +public static class TestImageGenerator +{ + /// + /// Generates a set of test JPEG images in the specified directory + /// + /// Directory where images will be created + /// Number of images to generate + /// Width of each image + /// Height of each image + /// Whether to create images in subfolders + public static void GenerateTestImages( + string outputDirectory, + int imageCount, + int width = 4000, + int height = 3000, + bool includeSubfolders = false) + { + Directory.CreateDirectory(outputDirectory); + + var random = new Random(42); // Fixed seed for reproducibility + + for (int i = 0; i < imageCount; i++) + { + var targetDir = outputDirectory; + + if (includeSubfolders && i % 10 == 0) + { + targetDir = Path.Combine(outputDirectory, $"Subfolder_{i / 10}"); + Directory.CreateDirectory(targetDir); + } + + var filePath = Path.Combine(targetDir, $"test_image_{i:D5}.jpg"); + + // Skip if already exists + if (File.Exists(filePath)) + continue; + + using var bitmap = new Bitmap(width, height); + using var graphics = Graphics.FromImage(bitmap); + + // Fill with a random color background + var bgColor = Color.FromArgb(random.Next(256), random.Next(256), random.Next(256)); + graphics.Clear(bgColor); + + // Draw some random shapes to make it more realistic + for (int j = 0; j < 20; j++) + { + var color = Color.FromArgb(random.Next(256), random.Next(256), random.Next(256)); + var brush = new SolidBrush(color); + var x = random.Next(width); + var y = random.Next(height); + var w = random.Next(200, 800); + var h = random.Next(200, 800); + graphics.FillEllipse(brush, x, y, w, h); + } + + // Add some text + using var font = new Font("Arial", 48, FontStyle.Bold); + var text = $"Test Image {i}"; + var textBrush = new SolidBrush(Color.White); + graphics.DrawString(text, font, textBrush, new PointF(100, 100)); + + // Save as JPEG with standard quality + var encoder = GetEncoder(ImageFormat.Jpeg); + var encoderParameters = new EncoderParameters(1); + encoderParameters.Param[0] = new EncoderParameter(Encoder.Quality, 85L); + + bitmap.Save(filePath, encoder, encoderParameters); + } + } + + /// + /// Cleans up generated test images + /// + public static void CleanupTestImages(string directory) + { + if (Directory.Exists(directory)) + { + Directory.Delete(directory, recursive: true); + } + } + + private static ImageCodecInfo GetEncoder(ImageFormat format) + { + var codecs = ImageCodecInfo.GetImageEncoders(); + foreach (var codec in codecs) + { + if (codec.FormatID == format.Guid) + { + return codec; + } + } + return null; + } +} diff --git a/MaddoShared.Benchmarks/ImageProcessingBenchmarks.cs b/MaddoShared.Benchmarks/ImageProcessingBenchmarks.cs new file mode 100644 index 0000000..0ed6069 --- /dev/null +++ b/MaddoShared.Benchmarks/ImageProcessingBenchmarks.cs @@ -0,0 +1,182 @@ +using System; +using System.Collections.Concurrent; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using BenchmarkDotNet.Attributes; +using BenchmarkDotNet.Configs; +using BenchmarkDotNet.Engines; +using BenchmarkDotNet.Jobs; +using BenchmarkDotNet.Toolchains.InProcess.Emit; +using MaddoShared.Benchmarks.Helpers; +using Microsoft.Extensions.Logging; + +namespace MaddoShared.Benchmarks; + +/// +/// Benchmarks for image processing with various configurations +/// +[MemoryDiagnoser] +[Config(typeof(InProcessConfig))] +public class ImageProcessingBenchmarks +{ + private string _sourceDirectory; + private string _destinationDirectory; + private ImageCreationStuff _imageCreationStuff; + private PicSettings _picSettings; + private ILogger _logger; + private ILogger _imageCreatorLogger; + + [Params(10, 50, 100)] + public int ImageCount { get; set; } + + [Params(1, 2, 4, 8)] + public int MaxThreads { get; set; } + + [GlobalSetup] + public void Setup() + { + // Create temp directories + var tempBase = Path.Combine(Path.GetTempPath(), "ImageBenchmarks", Guid.NewGuid().ToString()); + _sourceDirectory = Path.Combine(tempBase, "Source"); + _destinationDirectory = Path.Combine(tempBase, "Destination"); + + Directory.CreateDirectory(_sourceDirectory); + Directory.CreateDirectory(_destinationDirectory); + + // Generate test images + Console.WriteLine($"Generating {ImageCount} test images..."); + TestImageGenerator.GenerateTestImages(_sourceDirectory, ImageCount, width: 2000, height: 1500); + + // Setup logging + var loggerFactory = LoggerFactory.Create(builder => + { + builder.SetMinimumLevel(LogLevel.Warning); // Reduce noise during benchmarks + }); + + _logger = loggerFactory.CreateLogger(); + _imageCreatorLogger = loggerFactory.CreateLogger(); + + // Setup PicSettings with default values + _picSettings = new PicSettings + { + DirectorySorgente = _sourceDirectory, + DirectoryDestinazione = _destinationDirectory, + DimStandard = 800, + DimStandardMiniatura = 200, + LarghezzaBig = 1024, + AltezzaBig = 768, + LarghezzaSmall = 200, + AltezzaSmall = 150, + CreaMiniature = true, + AggiungiScritteMiniature = false, + UsaForzaJpg = true, + UsaRotazioneAutomatica = true, + LogoAggiungi = false, + FotoGrandeDimOrigina = false, + TestoNome = false, + NomeData = false, + Suffisso = "_small", + Margine = 10, + Trasparenza = 100 + }; + + var imageCreatorService = new ImageCreatorSharp(_picSettings, _imageCreatorLogger); + _imageCreationStuff = new ImageCreationStuff(_logger, _picSettings, imageCreatorService); + } + + [GlobalCleanup] + public void Cleanup() + { + // Clean up temp directories + try + { + var tempBase = Path.GetDirectoryName(_sourceDirectory); + if (Directory.Exists(tempBase)) + { + Directory.Delete(tempBase, recursive: true); + } + } + catch (Exception ex) + { + Console.WriteLine($"Cleanup error: {ex.Message}"); + } + } + + [IterationSetup] + public void IterationSetup() + { + // Clean destination directory before each iteration + if (Directory.Exists(_destinationDirectory)) + { + Directory.Delete(_destinationDirectory, recursive: true); + } + Directory.CreateDirectory(_destinationDirectory); + } + + [Benchmark(Description = "Process images in parallel with chunking")] + public async Task ProcessImagesParallelWithChunks() + { + var options = new ImageCreationStuff.Options + { + SourcePath = _sourceDirectory, + DestinationPath = _destinationDirectory, + MaxThreads = MaxThreads, + ChunksSize = 10, + LinearExecution = false, + AggiornaSottodirectory = false, + CreaSottocartelle = false, + FilePerCartella = 100, + SuffissoCartelle = "", + CifreContatore = 4, + NumerazioneType = NumerazioneType.Progressiva + }; + + var results = new ConcurrentBag(); + await _imageCreationStuff.ProcessImagesParallel(options, results, null, CancellationToken.None); + } + + [Benchmark(Description = "Process images in parallel without chunking")] + public async Task ProcessImagesParallelWithoutChunks() + { + var options = new ImageCreationStuff.Options + { + SourcePath = _sourceDirectory, + DestinationPath = _destinationDirectory, + MaxThreads = MaxThreads, + ChunksSize = 0, // No chunking + LinearExecution = false, + AggiornaSottodirectory = false, + CreaSottocartelle = false, + FilePerCartella = 100, + SuffissoCartelle = "", + CifreContatore = 4, + NumerazioneType = NumerazioneType.Progressiva + }; + + var results = new ConcurrentBag(); + await _imageCreationStuff.ProcessImagesParallel(options, results, null, CancellationToken.None); + } + + [Benchmark(Description = "Process images linearly")] + public async Task ProcessImagesLinear() + { + var options = new ImageCreationStuff.Options + { + SourcePath = _sourceDirectory, + DestinationPath = _destinationDirectory, + MaxThreads = MaxThreads, + ChunksSize = 0, + LinearExecution = true, + AggiornaSottodirectory = false, + CreaSottocartelle = false, + FilePerCartella = 100, + SuffissoCartelle = "", + CifreContatore = 4, + NumerazioneType = NumerazioneType.Progressiva + }; + + var results = new ConcurrentBag(); + await _imageCreationStuff.ProcessImagesParallel(options, results, null, CancellationToken.None); + } +} diff --git a/MaddoShared.Benchmarks/ImageSizeBenchmarks.cs b/MaddoShared.Benchmarks/ImageSizeBenchmarks.cs new file mode 100644 index 0000000..fe42fcc --- /dev/null +++ b/MaddoShared.Benchmarks/ImageSizeBenchmarks.cs @@ -0,0 +1,151 @@ +using System; +using System.Collections.Concurrent; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using BenchmarkDotNet.Attributes; +using BenchmarkDotNet.Configs; +using BenchmarkDotNet.Engines; +using BenchmarkDotNet.Jobs; +using BenchmarkDotNet.Toolchains.InProcess.Emit; +using MaddoShared.Benchmarks.Helpers; +using Microsoft.Extensions.Logging; + +namespace MaddoShared.Benchmarks; + +/// +/// Benchmarks for comparing performance with different image sizes +/// +[MemoryDiagnoser] +[Config(typeof(InProcessConfig))] +public class ImageSizeBenchmarks +{ + private string _sourceDirectory; + private string _destinationDirectory; + private ImageCreationStuff _imageCreationStuff; + private PicSettings _picSettings; + + [Params(50)] + public int ImageCount { get; set; } + + public enum ImageSize + { + Small, // 1280x960 + Medium, // 2560x1920 + Large, // 4000x3000 + ExtraLarge // 6000x4000 + } + + [ParamsAllValues] + public ImageSize Size { get; set; } + + [GlobalSetup] + public void Setup() + { + var tempBase = Path.Combine(Path.GetTempPath(), "SizeBenchmarks", Guid.NewGuid().ToString()); + _sourceDirectory = Path.Combine(tempBase, "Source"); + _destinationDirectory = Path.Combine(tempBase, "Destination"); + + Directory.CreateDirectory(_sourceDirectory); + Directory.CreateDirectory(_destinationDirectory); + + var (width, height) = GetDimensions(Size); + Console.WriteLine($"Generating {ImageCount} test images at {width}x{height}..."); + TestImageGenerator.GenerateTestImages(_sourceDirectory, ImageCount, width, height); + + var loggerFactory = LoggerFactory.Create(builder => + { + builder.SetMinimumLevel(LogLevel.Warning); + }); + + var logger = loggerFactory.CreateLogger(); + var imageCreatorLogger = loggerFactory.CreateLogger(); + + _picSettings = new PicSettings + { + DirectorySorgente = _sourceDirectory, + DirectoryDestinazione = _destinationDirectory, + DimStandard = 800, + DimStandardMiniatura = 200, + LarghezzaBig = 1024, + AltezzaBig = 768, + LarghezzaSmall = 200, + AltezzaSmall = 150, + CreaMiniature = true, + AggiungiScritteMiniature = false, + UsaForzaJpg = true, + UsaRotazioneAutomatica = true, + LogoAggiungi = false, + FotoGrandeDimOrigina = false, + TestoNome = false, + NomeData = false, + Suffisso = "_small", + Margine = 10, + Trasparenza = 100 + }; + + var imageCreatorService = new ImageCreatorSharp(_picSettings, imageCreatorLogger); + _imageCreationStuff = new ImageCreationStuff(logger, _picSettings, imageCreatorService); + } + + private static (int width, int height) GetDimensions(ImageSize size) + { + return size switch + { + ImageSize.Small => (1280, 960), + ImageSize.Medium => (2560, 1920), + ImageSize.Large => (4000, 3000), + ImageSize.ExtraLarge => (6000, 4000), + _ => throw new ArgumentException($"Unknown size: {size}") + }; + } + + [GlobalCleanup] + public void Cleanup() + { + try + { + var tempBase = Path.GetDirectoryName(_sourceDirectory); + if (Directory.Exists(tempBase)) + { + Directory.Delete(tempBase, recursive: true); + } + } + catch (Exception ex) + { + Console.WriteLine($"Cleanup error: {ex.Message}"); + } + } + + [IterationSetup] + public void IterationSetup() + { + if (Directory.Exists(_destinationDirectory)) + { + Directory.Delete(_destinationDirectory, recursive: true); + } + Directory.CreateDirectory(_destinationDirectory); + } + + [Benchmark] + public async Task ProcessDifferentImageSizes() + { + var options = new ImageCreationStuff.Options + { + SourcePath = _sourceDirectory, + DestinationPath = _destinationDirectory, + MaxThreads = Environment.ProcessorCount, + ChunksSize = 10, + LinearExecution = false, + AggiornaSottodirectory = false, + CreaSottocartelle = false, + FilePerCartella = 100, + SuffissoCartelle = "", + CifreContatore = 4, + NumerazioneType = NumerazioneType.Progressiva + }; + + var results = new ConcurrentBag(); + await _imageCreationStuff.ProcessImagesParallel(options, results, null, CancellationToken.None); + } +} diff --git a/MaddoShared.Benchmarks/MaddoShared.Benchmarks.csproj b/MaddoShared.Benchmarks/MaddoShared.Benchmarks.csproj new file mode 100644 index 0000000..99dc727 --- /dev/null +++ b/MaddoShared.Benchmarks/MaddoShared.Benchmarks.csproj @@ -0,0 +1,21 @@ + + + + Exe + net10.0-windows + x64 + true + true + + + + + + + + + + + + + diff --git a/MaddoShared.Benchmarks/Program.cs b/MaddoShared.Benchmarks/Program.cs new file mode 100644 index 0000000..cba4a67 --- /dev/null +++ b/MaddoShared.Benchmarks/Program.cs @@ -0,0 +1,35 @@ +using BenchmarkDotNet.Configs; +using BenchmarkDotNet.Jobs; +using BenchmarkDotNet.Running; +using BenchmarkDotNet.Toolchains.InProcess.Emit; +using System; +using System.Linq; + +namespace MaddoShared.Benchmarks; + +internal class Program +{ + static void Main(string[] args) + { + // Check if --job argument is provided + bool hasJobArg = args.Any(a => a.Contains("--job")); + + if (hasJobArg) + { + Console.WriteLine("Note: Overriding --job argument to use InProcess toolchain"); + Console.WriteLine("This is required to avoid net10.0 vs net10.0-windows compatibility issues."); + Console.WriteLine(); + + // Remove --job arguments and add our own InProcess config + args = args.Where(a => !a.StartsWith("--job") && a != "dry" && a != "short").ToArray(); + } + + // Create configuration that always uses InProcess toolchain + var config = DefaultConfig.Instance + .WithOptions(ConfigOptions.DisableOptimizationsValidator) + .WithOptions(ConfigOptions.KeepBenchmarkFiles); + + // Run benchmarks - each class has [Config(typeof(InProcessConfig))] which provides InProcess toolchain + BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args, config); + } +} diff --git a/MaddoShared.Benchmarks/StressTestBenchmark.cs b/MaddoShared.Benchmarks/StressTestBenchmark.cs new file mode 100644 index 0000000..4d626ae --- /dev/null +++ b/MaddoShared.Benchmarks/StressTestBenchmark.cs @@ -0,0 +1,172 @@ +using System; +using System.Collections.Concurrent; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using BenchmarkDotNet.Attributes; +using BenchmarkDotNet.Configs; +using BenchmarkDotNet.Jobs; +using BenchmarkDotNet.Toolchains.InProcess.Emit; +using MaddoShared.Benchmarks.Helpers; +using Microsoft.Extensions.Logging; + +namespace MaddoShared.Benchmarks; + +/// +/// Stress test benchmark for large-scale image processing +/// WARNING: This will generate a large number of images and may take significant time and disk space +/// +[MemoryDiagnoser] +[Config(typeof(InProcessConfig))] +public class StressTestBenchmark +{ + private string _sourceDirectory; + private string _destinationDirectory; + private ImageCreationStuff _imageCreationStuff; + private PicSettings _picSettings; + + [Params(500, 1000)] + public int ImageCount { get; set; } + + [GlobalSetup] + public void Setup() + { + var tempBase = Path.Combine(Path.GetTempPath(), "StressTestBenchmarks", Guid.NewGuid().ToString()); + _sourceDirectory = Path.Combine(tempBase, "Source"); + _destinationDirectory = Path.Combine(tempBase, "Destination"); + + Directory.CreateDirectory(_sourceDirectory); + Directory.CreateDirectory(_destinationDirectory); + + Console.WriteLine($"[STRESS TEST] Generating {ImageCount} test images..."); + Console.WriteLine("This may take several minutes depending on your hardware."); + + // Use smaller images for stress test to save space and time + TestImageGenerator.GenerateTestImages(_sourceDirectory, ImageCount, width: 1920, height: 1080); + + var loggerFactory = LoggerFactory.Create(builder => + { + builder.SetMinimumLevel(LogLevel.Warning); + }); + + var logger = loggerFactory.CreateLogger(); + var imageCreatorLogger = loggerFactory.CreateLogger(); + + _picSettings = new PicSettings + { + DirectorySorgente = _sourceDirectory, + DirectoryDestinazione = _destinationDirectory, + DimStandard = 800, + DimStandardMiniatura = 200, + LarghezzaBig = 1024, + AltezzaBig = 768, + LarghezzaSmall = 200, + AltezzaSmall = 150, + CreaMiniature = true, + AggiungiScritteMiniature = false, + UsaForzaJpg = true, + UsaRotazioneAutomatica = true, + LogoAggiungi = false, + FotoGrandeDimOrigina = false, + TestoNome = false, + NomeData = false, + Suffisso = "_small", + Margine = 10, + Trasparenza = 100 + }; + + var imageCreatorService = new ImageCreatorSharp(_picSettings, imageCreatorLogger); + _imageCreationStuff = new ImageCreationStuff(logger, _picSettings, imageCreatorService); + + Console.WriteLine($"[STRESS TEST] Setup complete. Ready to process {ImageCount} images."); + } + + [GlobalCleanup] + public void Cleanup() + { + Console.WriteLine("[STRESS TEST] Cleaning up test data..."); + try + { + var tempBase = Path.GetDirectoryName(_sourceDirectory); + if (Directory.Exists(tempBase)) + { + Directory.Delete(tempBase, recursive: true); + } + } + catch (Exception ex) + { + Console.WriteLine($"Cleanup error: {ex.Message}"); + } + } + + [IterationSetup] + public void IterationSetup() + { + if (Directory.Exists(_destinationDirectory)) + { + Directory.Delete(_destinationDirectory, recursive: true); + } + Directory.CreateDirectory(_destinationDirectory); + GC.Collect(GC.MaxGeneration, GCCollectionMode.Aggressive, blocking: true, compacting: true); + } + + [Benchmark(Description = "Stress test with optimal settings")] + public async Task StressTestOptimalSettings() + { + var options = new ImageCreationStuff.Options + { + SourcePath = _sourceDirectory, + DestinationPath = _destinationDirectory, + MaxThreads = Environment.ProcessorCount, + ChunksSize = 25, // Process in chunks to manage memory + LinearExecution = false, + AggiornaSottodirectory = false, + CreaSottocartelle = false, + FilePerCartella = 100, + SuffissoCartelle = "", + CifreContatore = 4, + NumerazioneType = NumerazioneType.Progressiva + }; + + var results = new ConcurrentBag(); + var startTime = DateTime.Now; + + await _imageCreationStuff.ProcessImagesParallel(options, results, null, CancellationToken.None); + + var duration = DateTime.Now - startTime; + var throughput = ImageCount / duration.TotalSeconds; + + Console.WriteLine($"[STRESS TEST] Processed {results.Count}/{ImageCount} images in {duration.TotalSeconds:F2}s"); + Console.WriteLine($"[STRESS TEST] Throughput: {throughput:F2} images/second"); + } + + [Benchmark(Description = "Stress test with aggressive memory management")] + public async Task StressTestAggressiveMemoryManagement() + { + var options = new ImageCreationStuff.Options + { + SourcePath = _sourceDirectory, + DestinationPath = _destinationDirectory, + MaxThreads = Environment.ProcessorCount / 2, // Reduce threads to save memory + ChunksSize = 10, // Smaller chunks for more frequent GC + LinearExecution = false, + AggiornaSottodirectory = false, + CreaSottocartelle = false, + FilePerCartella = 100, + SuffissoCartelle = "", + CifreContatore = 4, + NumerazioneType = NumerazioneType.Progressiva + }; + + var results = new ConcurrentBag(); + var startTime = DateTime.Now; + + await _imageCreationStuff.ProcessImagesParallel(options, results, null, CancellationToken.None); + + var duration = DateTime.Now - startTime; + var throughput = ImageCount / duration.TotalSeconds; + + Console.WriteLine($"[STRESS TEST] Processed {results.Count}/{ImageCount} images in {duration.TotalSeconds:F2}s"); + Console.WriteLine($"[STRESS TEST] Throughput: {throughput:F2} images/second"); + } +} diff --git a/MaddoShared/ImageCreationStuff.cs b/MaddoShared/ImageCreationStuff.cs index 04f283a..7aef4d4 100644 --- a/MaddoShared/ImageCreationStuff.cs +++ b/MaddoShared/ImageCreationStuff.cs @@ -52,6 +52,15 @@ namespace MaddoShared $"{stopwatch.Elapsed.Hours}h {stopwatch.Elapsed.Minutes}m {stopwatch.Elapsed.Seconds}s ({stopwatch.Elapsed.TotalSeconds}s)"; } + /// + /// Gets the list of files that will be processed based on the provided options. + /// Useful for benchmarking and testing to understand the scope of work. + /// + public List GetFilesToProcessPublic(Options options) + { + return GetFilesToProcess(options); + } + public async Task ProcessImagesParallel( Options options, ConcurrentBag results, diff --git a/MaddoShared/ImageCreatorSharp.cs b/MaddoShared/ImageCreatorSharp.cs index e0edfb0..0fdb25e 100644 --- a/MaddoShared/ImageCreatorSharp.cs +++ b/MaddoShared/ImageCreatorSharp.cs @@ -194,6 +194,21 @@ public class ImageCreatorSharp(PicSettings picSettings, ILogger= 0 ? '_' : ch); + } + return sb.ToString(); } private void PrepareThumbnailSize(Image g, ImageState imgState) diff --git a/imagecatalog/DataModel.cs b/imagecatalog/DataModel.cs index 83359d2..0c7d826 100644 --- a/imagecatalog/DataModel.cs +++ b/imagecatalog/DataModel.cs @@ -1010,6 +1010,8 @@ namespace ImageCatalog_2 public event EventHandler SaveSettingsRequested; public event EventHandler LoadSettingsRequested; public event EventHandler SelectColorRequested; + // Request that the View shows a message to the user (message, caption, icon) + public event EventHandler> ShowMessageRequested; private void SelectSourceFolder(object parameter) { diff --git a/imagecatalog/MainForm.Designer.cs b/imagecatalog/MainForm.Designer.cs index 266fa4f..6b1c48c 100644 --- a/imagecatalog/MainForm.Designer.cs +++ b/imagecatalog/MainForm.Designer.cs @@ -40,9 +40,9 @@ namespace ImageCatalog components = new System.ComponentModel.Container(); ProgressBar1 = new ProgressBar(); CheckBox22 = new CheckBox(); - Label43 = new Label(); bindingSource1 = new BindingSource(components); dataModelBindingSource = new BindingSource(components); + Label43 = new Label(); TabControl1 = new TabControl(); TabPage5 = new TabPage(); button1 = new Button(); @@ -181,6 +181,8 @@ namespace ImageCatalog _btnCreaCatalogoAsync = new Button(); timer1 = new System.Windows.Forms.Timer(components); dataModelBindingSource1 = new BindingSource(components); + btnOpenSourceFolder = new Button(); + btnOpenDestFolder = new Button(); ((System.ComponentModel.ISupportInitialize)bindingSource1).BeginInit(); ((System.ComponentModel.ISupportInitialize)dataModelBindingSource).BeginInit(); TabControl1.SuspendLayout(); @@ -213,36 +215,24 @@ namespace ImageCatalog // // ProgressBar1 // - ProgressBar1.Location = new Point(1168, 598); + ProgressBar1.Location = new Point(1078, 561); ProgressBar1.Margin = new Padding(6, 8, 6, 8); ProgressBar1.Name = "ProgressBar1"; - ProgressBar1.Size = new Size(416, 56); + ProgressBar1.Size = new Size(384, 52); ProgressBar1.TabIndex = 67; // // CheckBox22 // - CheckBox22.DataBindings.Add(new Binding("Checked", bindingSource1, "ShutdownSystem", true, DataSourceUpdateMode.OnPropertyChanged)); CheckBox22.AutoSize = true; - CheckBox22.Location = new Point(1168, 882); + CheckBox22.DataBindings.Add(new Binding("Checked", bindingSource1, "ShutdownSystem", true, DataSourceUpdateMode.OnPropertyChanged)); + CheckBox22.Location = new Point(1078, 827); CheckBox22.Margin = new Padding(6, 8, 6, 8); CheckBox22.Name = "CheckBox22"; - CheckBox22.Size = new Size(226, 36); + CheckBox22.Size = new Size(197, 34); CheckBox22.TabIndex = 65; CheckBox22.Text = "Arresta il sistema"; CheckBox22.UseVisualStyleBackColor = true; // - // Label43 - // - Label43.AutoSize = true; - Label43.DataBindings.Add(new Binding("Text", bindingSource1, "SpeedCounter", true)); - Label43.Location = new Point(1162, 842); - Label43.Margin = new Padding(6, 0, 6, 0); - Label43.Name = "Label43"; - Label43.Size = new Size(53, 32); - Label43.TabIndex = 64; - Label43.Text = "000"; - Label43.TextAlign = ContentAlignment.MiddleLeft; - // // bindingSource1 // bindingSource1.DataSource = dataModelBindingSource; @@ -251,6 +241,18 @@ namespace ImageCatalog // dataModelBindingSource.DataSource = typeof(ImageCatalog_2.DataModel); // + // Label43 + // + Label43.AutoSize = true; + Label43.DataBindings.Add(new Binding("Text", bindingSource1, "SpeedCounter", true)); + Label43.Location = new Point(1073, 789); + Label43.Margin = new Padding(6, 0, 6, 0); + Label43.Name = "Label43"; + Label43.Size = new Size(46, 30); + Label43.TabIndex = 64; + Label43.Text = "000"; + Label43.TextAlign = ContentAlignment.MiddleLeft; + // // TabControl1 // TabControl1.Controls.Add(TabPage5); @@ -259,11 +261,11 @@ namespace ImageCatalog TabControl1.Controls.Add(TabPage1); TabControl1.Controls.Add(TabPage4); TabControl1.DataBindings.Add(new Binding("Enabled", bindingSource1, "UiEnabled", true)); - TabControl1.Location = new Point(26, 24); + TabControl1.Location = new Point(24, 22); TabControl1.Margin = new Padding(6, 8, 6, 8); TabControl1.Name = "TabControl1"; TabControl1.SelectedIndex = 0; - TabControl1.Size = new Size(1129, 928); + TabControl1.Size = new Size(1042, 870); TabControl1.TabIndex = 63; // // TabPage5 @@ -274,11 +276,11 @@ namespace ImageCatalog TabPage5.Controls.Add(GroupBox3); TabPage5.Controls.Add(GroupBox8); TabPage5.Controls.Add(GroupBox7); - TabPage5.Location = new Point(8, 46); + TabPage5.Location = new Point(4, 39); TabPage5.Margin = new Padding(6, 8, 6, 8); TabPage5.Name = "TabPage5"; TabPage5.Padding = new Padding(6, 8, 6, 8); - TabPage5.Size = new Size(1113, 874); + TabPage5.Size = new Size(1034, 827); TabPage5.TabIndex = 4; TabPage5.Text = "Generale"; TabPage5.UseVisualStyleBackColor = true; @@ -286,10 +288,10 @@ namespace ImageCatalog // button1 // button1.DataBindings.Add(new Binding("Command", bindingSource1, "AsyncTestCommand", true)); - button1.Location = new Point(814, 768); + button1.Location = new Point(751, 720); button1.Margin = new Padding(5); button1.Name = "button1"; - button1.Size = new Size(153, 46); + button1.Size = new Size(141, 43); button1.TabIndex = 50; button1.Text = "Test Async"; button1.UseVisualStyleBackColor = true; @@ -297,10 +299,10 @@ namespace ImageCatalog // btnTest // btnTest.DataBindings.Add(new Binding("Command", bindingSource1, "TestCommand", true)); - btnTest.Location = new Point(528, 755); + btnTest.Location = new Point(487, 708); btnTest.Margin = new Padding(5); btnTest.Name = "btnTest"; - btnTest.Size = new Size(153, 46); + btnTest.Size = new Size(141, 43); btnTest.TabIndex = 49; btnTest.Text = "Test"; btnTest.UseVisualStyleBackColor = true; @@ -312,11 +314,11 @@ namespace ImageCatalog GroupBox11.Controls.Add(Panel3); GroupBox11.Controls.Add(Label8); GroupBox11.Controls.Add(Label7); - GroupBox11.Location = new Point(15, 515); + GroupBox11.Location = new Point(14, 483); GroupBox11.Margin = new Padding(6, 8, 6, 8); GroupBox11.Name = "GroupBox11"; GroupBox11.Padding = new Padding(6, 8, 6, 8); - GroupBox11.Size = new Size(414, 325); + GroupBox11.Size = new Size(382, 305); GroupBox11.TabIndex = 48; GroupBox11.TabStop = false; GroupBox11.Text = "Avanzate (ATTENZIONE)"; @@ -324,40 +326,40 @@ namespace ImageCatalog // numericUpDown2 // numericUpDown2.DataBindings.Add(new Binding("Value", bindingSource1, "ThreadsCount", true, DataSourceUpdateMode.OnPropertyChanged)); - numericUpDown2.Location = new Point(15, 118); + numericUpDown2.Location = new Point(14, 111); numericUpDown2.Maximum = new decimal(new int[] { 10000, 0, 0, 0 }); numericUpDown2.Name = "numericUpDown2"; - numericUpDown2.Size = new Size(114, 39); + numericUpDown2.Size = new Size(105, 35); numericUpDown2.TabIndex = 52; // // numericUpDown1 // numericUpDown1.DataBindings.Add(new Binding("Value", bindingSource1, "ChunkSize", true, DataSourceUpdateMode.OnPropertyChanged)); - numericUpDown1.Location = new Point(15, 62); + numericUpDown1.Location = new Point(14, 58); numericUpDown1.Maximum = new decimal(new int[] { 10000, 0, 0, 0 }); numericUpDown1.Name = "numericUpDown1"; - numericUpDown1.Size = new Size(114, 39); + numericUpDown1.Size = new Size(105, 35); numericUpDown1.TabIndex = 51; // // Panel3 // Panel3.Controls.Add(rdbNuovoMetodo); Panel3.Controls.Add(rdbVecchioMetodo); - Panel3.Location = new Point(15, 179); + Panel3.Location = new Point(14, 168); Panel3.Margin = new Padding(6, 8, 6, 8); Panel3.Name = "Panel3"; - Panel3.Size = new Size(385, 131); + Panel3.Size = new Size(355, 123); Panel3.TabIndex = 4; // // rdbNuovoMetodo // - rdbNuovoMetodo.DataBindings.Add(new Binding("Checked", bindingSource1, "UseParallelProcessing", true, DataSourceUpdateMode.OnPropertyChanged)); rdbNuovoMetodo.AutoSize = true; rdbNuovoMetodo.Checked = true; - rdbNuovoMetodo.Location = new Point(18, 69); + rdbNuovoMetodo.DataBindings.Add(new Binding("Checked", bindingSource1, "UseParallelProcessing", true, DataSourceUpdateMode.OnPropertyChanged)); + rdbNuovoMetodo.Location = new Point(17, 65); rdbNuovoMetodo.Margin = new Padding(6, 8, 6, 8); rdbNuovoMetodo.Name = "rdbNuovoMetodo"; - rdbNuovoMetodo.Size = new Size(134, 36); + rdbNuovoMetodo.Size = new Size(116, 34); rdbNuovoMetodo.TabIndex = 1; rdbNuovoMetodo.TabStop = true; rdbNuovoMetodo.Text = "Parallelo"; @@ -365,12 +367,12 @@ namespace ImageCatalog // // rdbVecchioMetodo // - rdbVecchioMetodo.DataBindings.Add(new Binding("Checked", bindingSource1, "UseSequentialProcessing", true, DataSourceUpdateMode.OnPropertyChanged)); rdbVecchioMetodo.AutoSize = true; - rdbVecchioMetodo.Location = new Point(18, 10); + rdbVecchioMetodo.DataBindings.Add(new Binding("Checked", bindingSource1, "UseSequentialProcessing", true, DataSourceUpdateMode.OnPropertyChanged)); + rdbVecchioMetodo.Location = new Point(17, 9); rdbVecchioMetodo.Margin = new Padding(6, 8, 6, 8); rdbVecchioMetodo.Name = "rdbVecchioMetodo"; - rdbVecchioMetodo.Size = new Size(122, 36); + rdbVecchioMetodo.Size = new Size(105, 34); rdbVecchioMetodo.TabIndex = 0; rdbVecchioMetodo.Text = "Lineare"; rdbVecchioMetodo.UseVisualStyleBackColor = true; @@ -378,25 +380,27 @@ namespace ImageCatalog // Label8 // Label8.AutoSize = true; - Label8.Location = new Point(138, 64); + Label8.Location = new Point(127, 60); Label8.Margin = new Padding(6, 0, 6, 0); Label8.Name = "Label8"; - Label8.Size = new Size(248, 32); + Label8.Size = new Size(215, 30); Label8.TabIndex = 3; Label8.Text = "Chunk Size (0 = MAX)"; // // Label7 // Label7.AutoSize = true; - Label7.Location = new Point(138, 120); + Label7.Location = new Point(127, 112); Label7.Margin = new Padding(6, 0, 6, 0); Label7.Name = "Label7"; - Label7.Size = new Size(213, 32); + Label7.Size = new Size(186, 30); Label7.TabIndex = 1; Label7.Text = "Threads (0 = Auto)"; // // GroupBox3 // + GroupBox3.Controls.Add(btnOpenDestFolder); + GroupBox3.Controls.Add(btnOpenSourceFolder); GroupBox3.Controls.Add(chkAggiornaSottodirectory); GroupBox3.Controls.Add(_Button3); GroupBox3.Controls.Add(_Button2); @@ -405,11 +409,11 @@ namespace ImageCatalog GroupBox3.Controls.Add(txtSorgente); GroupBox3.Controls.Add(txtDestinazione); GroupBox3.ForeColor = Color.FromArgb(0, 0, 192); - GroupBox3.Location = new Point(13, 14); + GroupBox3.Location = new Point(12, 13); GroupBox3.Margin = new Padding(6, 8, 6, 8); GroupBox3.Name = "GroupBox3"; GroupBox3.Padding = new Padding(6, 8, 6, 8); - GroupBox3.Size = new Size(1074, 248); + GroupBox3.Size = new Size(991, 232); GroupBox3.TabIndex = 35; GroupBox3.TabStop = false; GroupBox3.Text = "Directory"; @@ -418,28 +422,28 @@ namespace ImageCatalog // chkAggiornaSottodirectory.DataBindings.Add(new Binding("Checked", bindingSource1, "UpdateSubdirectories", true, DataSourceUpdateMode.OnPropertyChanged)); chkAggiornaSottodirectory.ForeColor = Color.Black; - chkAggiornaSottodirectory.Location = new Point(174, 157); + chkAggiornaSottodirectory.Location = new Point(161, 147); chkAggiornaSottodirectory.Margin = new Padding(6, 8, 6, 8); chkAggiornaSottodirectory.Name = "chkAggiornaSottodirectory"; - chkAggiornaSottodirectory.Size = new Size(515, 59); + chkAggiornaSottodirectory.Size = new Size(475, 55); chkAggiornaSottodirectory.TabIndex = 25; chkAggiornaSottodirectory.Text = "aggiorna le sottodirectory"; // // _Button3 // - _Button3.Location = new Point(1001, 99); + _Button3.Location = new Point(879, 96); _Button3.Margin = new Padding(6, 8, 6, 8); _Button3.Name = "_Button3"; - _Button3.Size = new Size(52, 50); + _Button3.Size = new Size(48, 36); _Button3.TabIndex = 6; _Button3.Text = "..."; // // _Button2 // - _Button2.Location = new Point(1001, 40); + _Button2.Location = new Point(879, 38); _Button2.Margin = new Padding(6, 8, 6, 8); _Button2.Name = "_Button2"; - _Button2.Size = new Size(52, 50); + _Button2.Size = new Size(48, 35); _Button2.TabIndex = 5; _Button2.Text = "..."; // @@ -447,10 +451,10 @@ namespace ImageCatalog // Label1.AutoSize = true; Label1.ForeColor = Color.Black; - Label1.Location = new Point(13, 46); + Label1.Location = new Point(12, 43); Label1.Margin = new Padding(6, 0, 6, 0); Label1.Name = "Label1"; - Label1.Size = new Size(111, 32); + Label1.Size = new Size(96, 30); Label1.TabIndex = 3; Label1.Text = "Sorgente"; // @@ -458,29 +462,29 @@ namespace ImageCatalog // Label2.AutoSize = true; Label2.ForeColor = Color.Black; - Label2.Location = new Point(13, 102); + Label2.Location = new Point(12, 96); Label2.Margin = new Padding(6, 0, 6, 0); Label2.Name = "Label2"; - Label2.Size = new Size(152, 32); + Label2.Size = new Size(133, 30); Label2.TabIndex = 4; Label2.Text = "Destinazione"; // // txtSorgente // txtSorgente.DataBindings.Add(new Binding("Text", bindingSource1, "SourcePath", true, DataSourceUpdateMode.OnPropertyChanged)); - txtSorgente.Location = new Point(174, 40); + txtSorgente.Location = new Point(161, 38); txtSorgente.Margin = new Padding(6, 8, 6, 8); txtSorgente.Name = "txtSorgente"; - txtSorgente.Size = new Size(810, 39); + txtSorgente.Size = new Size(706, 35); txtSorgente.TabIndex = 0; // // txtDestinazione // txtDestinazione.DataBindings.Add(new Binding("Text", bindingSource1, "DestinationPath", true, DataSourceUpdateMode.OnPropertyChanged)); - txtDestinazione.Location = new Point(174, 99); + txtDestinazione.Location = new Point(161, 93); txtDestinazione.Margin = new Padding(6, 8, 6, 8); txtDestinazione.Name = "txtDestinazione"; - txtDestinazione.Size = new Size(810, 39); + txtDestinazione.Size = new Size(706, 35); txtDestinazione.TabIndex = 1; txtDestinazione.Text = "TextBox2"; // @@ -497,11 +501,11 @@ namespace ImageCatalog GroupBox8.Controls.Add(txtFilePerCartella); GroupBox8.Controls.Add(Label32); GroupBox8.ForeColor = Color.FromArgb(0, 0, 192); - GroupBox8.Location = new Point(442, 278); + GroupBox8.Location = new Point(408, 261); GroupBox8.Margin = new Padding(6, 8, 6, 8); GroupBox8.Name = "GroupBox8"; GroupBox8.Padding = new Padding(6, 8, 6, 8); - GroupBox8.Size = new Size(416, 374); + GroupBox8.Size = new Size(384, 351); GroupBox8.TabIndex = 47; GroupBox8.TabStop = false; GroupBox8.Text = "Sottocartelle"; @@ -510,22 +514,22 @@ namespace ImageCatalog // rdbNumFiles.DataBindings.Add(new Binding("Checked", bindingSource1, "UseFileNumbering", true, DataSourceUpdateMode.OnPropertyChanged)); rdbNumFiles.ForeColor = Color.Black; - rdbNumFiles.Location = new Point(70, 315); + rdbNumFiles.Location = new Point(65, 295); rdbNumFiles.Margin = new Padding(6, 8, 6, 8); rdbNumFiles.Name = "rdbNumFiles"; - rdbNumFiles.Size = new Size(294, 40); + rdbNumFiles.Size = new Size(271, 38); rdbNumFiles.TabIndex = 38; rdbNumFiles.Text = "Numerazione files"; // // rdbNumProgressiva // - rdbNumProgressiva.DataBindings.Add(new Binding("Checked", bindingSource1, "UseProgressiveNumbering", true, DataSourceUpdateMode.OnPropertyChanged)); rdbNumProgressiva.Checked = true; + rdbNumProgressiva.DataBindings.Add(new Binding("Checked", bindingSource1, "UseProgressiveNumbering", true, DataSourceUpdateMode.OnPropertyChanged)); rdbNumProgressiva.ForeColor = Color.Black; - rdbNumProgressiva.Location = new Point(70, 275); + rdbNumProgressiva.Location = new Point(65, 258); rdbNumProgressiva.Margin = new Padding(6, 8, 6, 8); rdbNumProgressiva.Name = "rdbNumProgressiva"; - rdbNumProgressiva.Size = new Size(330, 40); + rdbNumProgressiva.Size = new Size(305, 38); rdbNumProgressiva.TabIndex = 37; rdbNumProgressiva.TabStop = true; rdbNumProgressiva.Text = "Numerazione progressiva"; @@ -533,20 +537,20 @@ namespace ImageCatalog // txtCifreContatore // txtCifreContatore.DataBindings.Add(new Binding("Text", bindingSource1, "CounterDigits", true, DataSourceUpdateMode.OnPropertyChanged)); - txtCifreContatore.Location = new Point(278, 216); + txtCifreContatore.Location = new Point(257, 202); txtCifreContatore.Margin = new Padding(6, 8, 6, 8); txtCifreContatore.Name = "txtCifreContatore"; - txtCifreContatore.Size = new Size(116, 39); + txtCifreContatore.Size = new Size(107, 35); txtCifreContatore.TabIndex = 34; txtCifreContatore.Text = "4"; // // Label34 // Label34.ForeColor = Color.Black; - Label34.Location = new Point(18, 216); + Label34.Location = new Point(17, 202); Label34.Margin = new Padding(6, 0, 6, 0); Label34.Name = "Label34"; - Label34.Size = new Size(242, 40); + Label34.Size = new Size(223, 38); Label34.TabIndex = 33; Label34.Text = "Num. cifre contatore"; Label34.TextAlign = ContentAlignment.MiddleRight; @@ -554,30 +558,30 @@ namespace ImageCatalog // txtSuffissoCartelle // txtSuffissoCartelle.DataBindings.Add(new Binding("Text", bindingSource1, "FolderSuffix", true, DataSourceUpdateMode.OnPropertyChanged)); - txtSuffissoCartelle.Location = new Point(122, 157); + txtSuffissoCartelle.Location = new Point(113, 147); txtSuffissoCartelle.Margin = new Padding(6, 8, 6, 8); txtSuffissoCartelle.Name = "txtSuffissoCartelle"; - txtSuffissoCartelle.Size = new Size(272, 39); + txtSuffissoCartelle.Size = new Size(251, 35); txtSuffissoCartelle.TabIndex = 32; txtSuffissoCartelle.Text = "TextBox20"; // // Label33 // Label33.ForeColor = Color.Black; - Label33.Location = new Point(13, 165); + Label33.Location = new Point(12, 155); Label33.Margin = new Padding(6, 0, 6, 0); Label33.Name = "Label33"; - Label33.Size = new Size(104, 40); + Label33.Size = new Size(96, 38); Label33.TabIndex = 31; Label33.Text = "Suffisso"; // // Label31 // Label31.ForeColor = Color.Black; - Label31.Location = new Point(52, 99); + Label31.Location = new Point(48, 93); Label31.Margin = new Padding(6, 0, 6, 0); Label31.Name = "Label31"; - Label31.Size = new Size(70, 40); + Label31.Size = new Size(65, 38); Label31.TabIndex = 30; Label31.Text = "ogni"; // @@ -585,30 +589,30 @@ namespace ImageCatalog // chkCreaSottocartelle.DataBindings.Add(new Binding("Checked", bindingSource1, "CreateSubfolders", true, DataSourceUpdateMode.OnPropertyChanged)); chkCreaSottocartelle.ForeColor = Color.Black; - chkCreaSottocartelle.Location = new Point(122, 40); + chkCreaSottocartelle.Location = new Point(113, 38); chkCreaSottocartelle.Margin = new Padding(6, 8, 6, 8); chkCreaSottocartelle.Name = "chkCreaSottocartelle"; - chkCreaSottocartelle.Size = new Size(242, 40); + chkCreaSottocartelle.Size = new Size(223, 38); chkCreaSottocartelle.TabIndex = 29; chkCreaSottocartelle.Text = "crea sottocartelle"; // // txtFilePerCartella // txtFilePerCartella.DataBindings.Add(new Binding("Text", bindingSource1, "FilesPerFolder", true, DataSourceUpdateMode.OnPropertyChanged)); - txtFilePerCartella.Location = new Point(122, 99); + txtFilePerCartella.Location = new Point(113, 93); txtFilePerCartella.Margin = new Padding(6, 8, 6, 8); txtFilePerCartella.Name = "txtFilePerCartella"; - txtFilePerCartella.Size = new Size(134, 39); + txtFilePerCartella.Size = new Size(124, 35); txtFilePerCartella.TabIndex = 27; txtFilePerCartella.Text = "99"; // // Label32 // Label32.ForeColor = Color.Black; - Label32.Location = new Point(278, 99); + Label32.Location = new Point(257, 93); Label32.Margin = new Padding(6, 0, 6, 0); Label32.Name = "Label32"; - Label32.Size = new Size(52, 40); + Label32.Size = new Size(48, 38); Label32.TabIndex = 28; Label32.Text = "file"; // @@ -618,11 +622,11 @@ namespace ImageCatalog GroupBox7.Controls.Add(chkRotazioneAutomatica); GroupBox7.Controls.Add(chkForzaJpg); GroupBox7.ForeColor = Color.FromArgb(0, 0, 192); - GroupBox7.Location = new Point(13, 278); + GroupBox7.Location = new Point(12, 261); GroupBox7.Margin = new Padding(6, 8, 6, 8); GroupBox7.Name = "GroupBox7"; GroupBox7.Padding = new Padding(6, 8, 6, 8); - GroupBox7.Size = new Size(416, 216); + GroupBox7.Size = new Size(384, 202); GroupBox7.TabIndex = 45; GroupBox7.TabStop = false; GroupBox7.Text = "Generale"; @@ -631,10 +635,10 @@ namespace ImageCatalog // chkSovrascriviFile.AutoSize = true; chkSovrascriviFile.DataBindings.Add(new Binding("Checked", bindingSource1, "OverwriteImages", true, DataSourceUpdateMode.OnPropertyChanged)); - chkSovrascriviFile.Location = new Point(34, 150); + chkSovrascriviFile.Location = new Point(31, 141); chkSovrascriviFile.Margin = new Padding(6, 8, 6, 8); chkSovrascriviFile.Name = "chkSovrascriviFile"; - chkSovrascriviFile.Size = new Size(198, 36); + chkSovrascriviFile.Size = new Size(170, 34); chkSovrascriviFile.TabIndex = 2; chkSovrascriviFile.Text = "Sovrascrivi file"; chkSovrascriviFile.UseVisualStyleBackColor = true; @@ -643,23 +647,23 @@ namespace ImageCatalog // chkRotazioneAutomatica.DataBindings.Add(new Binding("Checked", bindingSource1, "AutomaticRotation", true, DataSourceUpdateMode.OnPropertyChanged)); chkRotazioneAutomatica.ForeColor = Color.Black; - chkRotazioneAutomatica.Location = new Point(34, 96); + chkRotazioneAutomatica.Location = new Point(31, 90); chkRotazioneAutomatica.Margin = new Padding(6, 8, 6, 8); chkRotazioneAutomatica.Name = "chkRotazioneAutomatica"; - chkRotazioneAutomatica.Size = new Size(294, 40); + chkRotazioneAutomatica.Size = new Size(271, 38); chkRotazioneAutomatica.TabIndex = 1; chkRotazioneAutomatica.Text = "Rotazione automatica"; // // chkForzaJpg // - chkForzaJpg.DataBindings.Add(new Binding("Checked", bindingSource1, "ForceJpeg", true, DataSourceUpdateMode.OnPropertyChanged)); chkForzaJpg.Checked = true; chkForzaJpg.CheckState = CheckState.Checked; + chkForzaJpg.DataBindings.Add(new Binding("Checked", bindingSource1, "ForceJpeg", true, DataSourceUpdateMode.OnPropertyChanged)); chkForzaJpg.ForeColor = Color.Black; - chkForzaJpg.Location = new Point(34, 45); + chkForzaJpg.Location = new Point(31, 42); chkForzaJpg.Margin = new Padding(6, 8, 6, 8); chkForzaJpg.Name = "chkForzaJpg"; - chkForzaJpg.Size = new Size(174, 40); + chkForzaJpg.Size = new Size(161, 38); chkForzaJpg.TabIndex = 0; chkForzaJpg.Text = "Forza Jpg"; // @@ -669,11 +673,11 @@ namespace ImageCatalog TabPage3.Controls.Add(GroupBox9); TabPage3.Controls.Add(GroupBox5); TabPage3.Controls.Add(GroupBox4); - TabPage3.Location = new Point(8, 46); + TabPage3.Location = new Point(4, 39); TabPage3.Margin = new Padding(6, 8, 6, 8); TabPage3.Name = "TabPage3"; TabPage3.Padding = new Padding(6, 8, 6, 8); - TabPage3.Size = new Size(1113, 874); + TabPage3.Size = new Size(1034, 827); TabPage3.TabIndex = 2; TabPage3.Text = "Testo"; TabPage3.UseVisualStyleBackColor = true; @@ -684,11 +688,11 @@ namespace ImageCatalog GroupBox10.Controls.Add(Label41); GroupBox10.Controls.Add(TextBox31); GroupBox10.Controls.Add(TextBox30); - GroupBox10.Location = new Point(684, 192); + GroupBox10.Location = new Point(631, 180); GroupBox10.Margin = new Padding(6, 8, 6, 8); GroupBox10.Name = "GroupBox10"; GroupBox10.Padding = new Padding(6, 8, 6, 8); - GroupBox10.Size = new Size(403, 179); + GroupBox10.Size = new Size(372, 168); GroupBox10.TabIndex = 39; GroupBox10.TabStop = false; GroupBox10.Text = "Testo foto verticali"; @@ -696,74 +700,74 @@ namespace ImageCatalog // Label42 // Label42.AutoSize = true; - Label42.Location = new Point(15, 114); + Label42.Location = new Point(14, 107); Label42.Margin = new Padding(6, 0, 6, 0); Label42.Name = "Label42"; - Label42.Size = new Size(103, 32); + Label42.Size = new Size(90, 30); Label42.TabIndex = 3; Label42.Text = "Margine"; // // Label41 // Label41.AutoSize = true; - Label41.Location = new Point(15, 61); + Label41.Location = new Point(14, 57); Label41.Margin = new Padding(6, 0, 6, 0); Label41.Name = "Label41"; - Label41.Size = new Size(246, 32); + Label41.Size = new Size(214, 30); Label41.TabIndex = 2; Label41.Text = "Dimensione Carattere"; // // TextBox31 // TextBox31.DataBindings.Add(new Binding("Text", bindingSource1, "VerticalTextMargin", true, DataSourceUpdateMode.OnPropertyChanged)); - TextBox31.Location = new Point(284, 114); + TextBox31.Location = new Point(262, 107); TextBox31.Margin = new Padding(6, 8, 6, 8); TextBox31.Name = "TextBox31"; - TextBox31.Size = new Size(80, 39); + TextBox31.Size = new Size(74, 35); TextBox31.TabIndex = 1; // // TextBox30 // TextBox30.DataBindings.Add(new Binding("Text", bindingSource1, "VerticalTextSize", true, DataSourceUpdateMode.OnPropertyChanged)); - TextBox30.Location = new Point(284, 54); + TextBox30.Location = new Point(262, 51); TextBox30.Margin = new Padding(6, 8, 6, 8); TextBox30.Name = "TextBox30"; - TextBox30.Size = new Size(80, 39); + TextBox30.Size = new Size(74, 35); TextBox30.TabIndex = 0; // // GroupBox9 // GroupBox9.Controls.Add(CheckBox17); GroupBox9.Controls.Add(CheckBox16); - GroupBox9.Location = new Point(684, 77); + GroupBox9.Location = new Point(631, 72); GroupBox9.Margin = new Padding(6, 8, 6, 8); GroupBox9.Name = "GroupBox9"; GroupBox9.Padding = new Padding(6, 8, 6, 8); - GroupBox9.Size = new Size(403, 110); + GroupBox9.Size = new Size(372, 103); GroupBox9.TabIndex = 38; GroupBox9.TabStop = false; GroupBox9.Text = "Slide show"; // // CheckBox17 // - CheckBox17.DataBindings.Add(new Binding("Checked", bindingSource1, "ShowPhotoNumber", true, DataSourceUpdateMode.OnPropertyChanged)); CheckBox17.AutoSize = true; - CheckBox17.Location = new Point(208, 45); + CheckBox17.DataBindings.Add(new Binding("Checked", bindingSource1, "ShowPhotoNumber", true, DataSourceUpdateMode.OnPropertyChanged)); + CheckBox17.Location = new Point(192, 42); CheckBox17.Margin = new Padding(6, 8, 6, 8); CheckBox17.Name = "CheckBox17"; - CheckBox17.Size = new Size(185, 36); + CheckBox17.Size = new Size(159, 34); CheckBox17.TabIndex = 1; CheckBox17.Text = "Numero foto"; CheckBox17.UseVisualStyleBackColor = true; // // CheckBox16 // - CheckBox16.DataBindings.Add(new Binding("Checked", bindingSource1, "ShowDate", true, DataSourceUpdateMode.OnPropertyChanged)); CheckBox16.AutoSize = true; - CheckBox16.Location = new Point(13, 46); + CheckBox16.DataBindings.Add(new Binding("Checked", bindingSource1, "ShowDate", true, DataSourceUpdateMode.OnPropertyChanged)); + CheckBox16.Location = new Point(12, 43); CheckBox16.Margin = new Padding(6, 8, 6, 8); CheckBox16.Name = "CheckBox16"; - CheckBox16.Size = new Size(95, 36); + CheckBox16.Size = new Size(83, 34); CheckBox16.TabIndex = 0; CheckBox16.Text = "Data"; CheckBox16.UseVisualStyleBackColor = true; @@ -781,11 +785,11 @@ namespace ImageCatalog GroupBox5.Controls.Add(Label11); GroupBox5.Controls.Add(CheckBox3); GroupBox5.ForeColor = Color.FromArgb(0, 0, 192); - GroupBox5.Location = new Point(13, 77); + GroupBox5.Location = new Point(12, 72); GroupBox5.Margin = new Padding(6, 8, 6, 8); GroupBox5.Name = "GroupBox5"; GroupBox5.Padding = new Padding(6, 8, 6, 8); - GroupBox5.Size = new Size(658, 296); + GroupBox5.Size = new Size(607, 278); GroupBox5.TabIndex = 37; GroupBox5.TabStop = false; GroupBox5.Text = "Carattere"; @@ -793,30 +797,30 @@ namespace ImageCatalog // TextBox34 // TextBox34.DataBindings.Add(new Binding("Text", bindingSource1, "TextColorRGB", true, DataSourceUpdateMode.OnPropertyChanged)); - TextBox34.Location = new Point(346, 224); + TextBox34.Location = new Point(319, 210); TextBox34.Margin = new Padding(6, 8, 6, 8); TextBox34.Name = "TextBox34"; - TextBox34.Size = new Size(116, 39); + TextBox34.Size = new Size(107, 35); TextBox34.TabIndex = 36; TextBox34.TextAlign = HorizontalAlignment.Right; // // _Button8 // _Button8.ForeColor = Color.Black; - _Button8.Location = new Point(481, 219); + _Button8.Location = new Point(444, 205); _Button8.Margin = new Padding(6, 8, 6, 8); _Button8.Name = "_Button8"; - _Button8.Size = new Size(161, 59); + _Button8.Size = new Size(149, 55); _Button8.TabIndex = 35; _Button8.Text = "Scegli..."; // // Label36 // Label36.ForeColor = Color.Black; - Label36.Location = new Point(18, 147); + Label36.Location = new Point(17, 138); Label36.Margin = new Padding(6, 0, 6, 0); Label36.Name = "Label36"; - Label36.Size = new Size(260, 46); + Label36.Size = new Size(240, 43); Label36.TabIndex = 34; Label36.Text = "Dimensione miniatura"; Label36.TextAlign = ContentAlignment.MiddleLeft; @@ -824,20 +828,20 @@ namespace ImageCatalog // TextBox25 // TextBox25.DataBindings.Add(new Binding("Text", bindingSource1, "FontSizeThumbnail", true, DataSourceUpdateMode.OnPropertyChanged)); - TextBox25.Location = new Point(346, 146); + TextBox25.Location = new Point(319, 137); TextBox25.Margin = new Padding(6, 8, 6, 8); TextBox25.Name = "TextBox25"; - TextBox25.Size = new Size(116, 39); + TextBox25.Size = new Size(107, 35); TextBox25.TabIndex = 33; TextBox25.Text = "TextBox25"; // // Label35 // Label35.ForeColor = Color.Black; - Label35.Location = new Point(18, 229); + Label35.Location = new Point(17, 215); Label35.Margin = new Padding(6, 0, 6, 0); Label35.Name = "Label35"; - Label35.Size = new Size(156, 40); + Label35.Size = new Size(144, 38); Label35.TabIndex = 32; Label35.Text = "Colore RGB"; Label35.TextAlign = ContentAlignment.MiddleLeft; @@ -845,20 +849,20 @@ namespace ImageCatalog // ComboBox3 // ComboBox3.DataBindings.Add(new Binding("Text", bindingSource1, "FontName", true, DataSourceUpdateMode.OnPropertyChanged)); - ComboBox3.Location = new Point(208, 19); + ComboBox3.Location = new Point(192, 18); ComboBox3.Margin = new Padding(6, 8, 6, 8); ComboBox3.Name = "ComboBox3"; - ComboBox3.Size = new Size(256, 40); + ComboBox3.Size = new Size(237, 38); ComboBox3.TabIndex = 28; ComboBox3.Text = "ComboBox3"; // // TextBox11 // TextBox11.DataBindings.Add(new Binding("Text", bindingSource1, "FontSize", true, DataSourceUpdateMode.OnPropertyChanged)); - TextBox11.Location = new Point(346, 86); + TextBox11.Location = new Point(319, 81); TextBox11.Margin = new Padding(6, 8, 6, 8); TextBox11.Name = "TextBox11"; - TextBox11.Size = new Size(116, 39); + TextBox11.Size = new Size(107, 35); TextBox11.TabIndex = 27; TextBox11.Text = "TextBox11"; // @@ -866,10 +870,10 @@ namespace ImageCatalog // Label12.AutoSize = true; Label12.ForeColor = Color.Black; - Label12.Location = new Point(18, 93); + Label12.Location = new Point(17, 87); Label12.Margin = new Padding(6, 0, 6, 0); Label12.Name = "Label12"; - Label12.Size = new Size(142, 32); + Label12.Size = new Size(123, 30); Label12.TabIndex = 26; Label12.Text = "Dimensione"; Label12.TextAlign = ContentAlignment.MiddleLeft; @@ -878,10 +882,10 @@ namespace ImageCatalog // Label11.AutoSize = true; Label11.ForeColor = Color.Black; - Label11.Location = new Point(122, 19); + Label11.Location = new Point(113, 18); Label11.Margin = new Padding(6, 0, 6, 0); Label11.Name = "Label11"; - Label11.Size = new Size(62, 32); + Label11.Size = new Size(54, 30); Label11.TabIndex = 22; Label11.Text = "Font"; // @@ -889,10 +893,10 @@ namespace ImageCatalog // CheckBox3.DataBindings.Add(new Binding("Checked", bindingSource1, "FontBold", true, DataSourceUpdateMode.OnPropertyChanged)); CheckBox3.ForeColor = Color.Black; - CheckBox3.Location = new Point(486, 19); + CheckBox3.Location = new Point(449, 18); CheckBox3.Margin = new Padding(6, 8, 6, 8); CheckBox3.Name = "CheckBox3"; - CheckBox3.Size = new Size(156, 59); + CheckBox3.Size = new Size(144, 55); CheckBox3.TabIndex = 24; CheckBox3.Text = "Grassetto"; // @@ -916,11 +920,11 @@ namespace ImageCatalog GroupBox4.Controls.Add(TextBox12); GroupBox4.Controls.Add(Label15); GroupBox4.ForeColor = Color.FromArgb(0, 0, 192); - GroupBox4.Location = new Point(13, 387); + GroupBox4.Location = new Point(12, 363); GroupBox4.Margin = new Padding(6, 8, 6, 8); GroupBox4.Name = "GroupBox4"; GroupBox4.Padding = new Padding(6, 8, 6, 8); - GroupBox4.Size = new Size(1074, 458); + GroupBox4.Size = new Size(991, 429); GroupBox4.TabIndex = 36; GroupBox4.TabStop = false; GroupBox4.Text = "Testo da applicare"; @@ -928,40 +932,40 @@ namespace ImageCatalog // Label40 // Label40.AutoSize = true; - Label40.Location = new Point(18, 128); + Label40.Location = new Point(17, 120); Label40.Margin = new Padding(6, 0, 6, 0); Label40.Name = "Label40"; - Label40.Size = new Size(104, 32); + Label40.Size = new Size(92, 30); Label40.TabIndex = 40; Label40.Text = "Verticale"; // // TextBox29 // TextBox29.DataBindings.Add(new Binding("Text", bindingSource1, "VerticalText", true, DataSourceUpdateMode.OnPropertyChanged)); - TextBox29.Location = new Point(156, 120); + TextBox29.Location = new Point(144, 112); TextBox29.Margin = new Padding(6, 8, 6, 8); TextBox29.Multiline = true; TextBox29.Name = "TextBox29"; - TextBox29.Size = new Size(880, 103); + TextBox29.Size = new Size(813, 97); TextBox29.TabIndex = 39; // // TextBox18 // TextBox18.DataBindings.Add(new Binding("Text", bindingSource1, "TimeLabel", true, DataSourceUpdateMode.OnPropertyChanged)); - TextBox18.Location = new Point(502, 384); + TextBox18.Location = new Point(463, 360); TextBox18.Margin = new Padding(6, 8, 6, 8); TextBox18.Name = "TextBox18"; - TextBox18.Size = new Size(212, 39); + TextBox18.Size = new Size(196, 35); TextBox18.TabIndex = 38; // // Label26 // Label26.AutoSize = true; Label26.ForeColor = Color.Black; - Label26.Location = new Point(746, 384); + Label26.Location = new Point(689, 360); Label26.Margin = new Padding(6, 0, 6, 0); Label26.Name = "Label26"; - Label26.Size = new Size(106, 32); + Label26.Size = new Size(94, 30); Label26.TabIndex = 37; Label26.Text = "partenza"; // @@ -969,30 +973,30 @@ namespace ImageCatalog // DateTimePicker1.DataBindings.Add(new Binding("Value", bindingSource1, "RaceStartDate", true, DataSourceUpdateMode.OnPropertyChanged)); DateTimePicker1.Format = DateTimePickerFormat.Time; - DateTimePicker1.Location = new Point(850, 384); + DateTimePicker1.Location = new Point(785, 360); DateTimePicker1.Margin = new Padding(6, 8, 6, 8); DateTimePicker1.Name = "DateTimePicker1"; - DateTimePicker1.Size = new Size(186, 39); + DateTimePicker1.Size = new Size(172, 35); DateTimePicker1.TabIndex = 36; // // CheckBox8 // CheckBox8.DataBindings.Add(new Binding("Checked", bindingSource1, "AddTime", true, DataSourceUpdateMode.OnPropertyChanged)); CheckBox8.ForeColor = Color.Black; - CheckBox8.Location = new Point(156, 384); + CheckBox8.Location = new Point(144, 360); CheckBox8.Margin = new Padding(6, 8, 6, 8); CheckBox8.Name = "CheckBox8"; - CheckBox8.Size = new Size(122, 40); + CheckBox8.Size = new Size(113, 38); CheckBox8.TabIndex = 35; CheckBox8.Text = "Orario"; // // TextBox9 // TextBox9.DataBindings.Add(new Binding("Text", bindingSource1, "TextTransparency", true, DataSourceUpdateMode.OnPropertyChanged)); - TextBox9.Location = new Point(260, 266); + TextBox9.Location = new Point(240, 249); TextBox9.Margin = new Padding(6, 8, 6, 8); TextBox9.Name = "TextBox9"; - TextBox9.Size = new Size(116, 39); + TextBox9.Size = new Size(107, 35); TextBox9.TabIndex = 20; TextBox9.Text = "TextBox9"; // @@ -1000,10 +1004,10 @@ namespace ImageCatalog // CheckBox7.DataBindings.Add(new Binding("Checked", bindingSource1, "AddRaceTime", true, DataSourceUpdateMode.OnPropertyChanged)); CheckBox7.ForeColor = Color.Black; - CheckBox7.Location = new Point(294, 384); + CheckBox7.Location = new Point(271, 360); CheckBox7.Margin = new Padding(6, 8, 6, 8); CheckBox7.Name = "CheckBox7"; - CheckBox7.Size = new Size(190, 40); + CheckBox7.Size = new Size(175, 38); CheckBox7.TabIndex = 34; CheckBox7.Text = "Tempo gara"; // @@ -1011,30 +1015,30 @@ namespace ImageCatalog // Label4.AutoSize = true; Label4.ForeColor = Color.Black; - Label4.Location = new Point(18, 59); + Label4.Location = new Point(17, 55); Label4.Margin = new Padding(6, 0, 6, 0); Label4.Name = "Label4"; - Label4.Size = new Size(135, 32); + Label4.Size = new Size(119, 30); Label4.TabIndex = 9; Label4.Text = "Orizzontale"; // // TextBox4 // TextBox4.DataBindings.Add(new Binding("Text", bindingSource1, "HorizontalText", true, DataSourceUpdateMode.OnPropertyChanged)); - TextBox4.Location = new Point(156, 59); + TextBox4.Location = new Point(144, 55); TextBox4.Margin = new Padding(6, 8, 6, 8); TextBox4.Name = "TextBox4"; - TextBox4.Size = new Size(880, 39); + TextBox4.Size = new Size(813, 35); TextBox4.TabIndex = 8; // // Label9 // Label9.AutoSize = true; Label9.ForeColor = Color.Black; - Label9.Location = new Point(18, 266); + Label9.Location = new Point(17, 249); Label9.Margin = new Padding(6, 0, 6, 0); Label9.Name = "Label9"; - Label9.Size = new Size(242, 32); + Label9.Size = new Size(210, 30); Label9.TabIndex = 19; Label9.Text = "Trasparenza (0-100%)"; // @@ -1042,30 +1046,30 @@ namespace ImageCatalog // Label13.AutoSize = true; Label13.ForeColor = Color.Black; - Label13.Location = new Point(34, 325); + Label13.Location = new Point(31, 305); Label13.Margin = new Padding(6, 0, 6, 0); Label13.Name = "Label13"; - Label13.Size = new Size(114, 32); + Label13.Size = new Size(100, 30); Label13.TabIndex = 29; Label13.Text = "Posizione"; // // ComboBox1 // ComboBox1.DataBindings.Add(new Binding("Text", bindingSource1, "VerticalPosition", true, DataSourceUpdateMode.OnPropertyChanged)); - ComboBox1.Location = new Point(156, 325); + ComboBox1.Location = new Point(144, 305); ComboBox1.Margin = new Padding(6, 8, 6, 8); ComboBox1.Name = "ComboBox1"; - ComboBox1.Size = new Size(220, 40); + ComboBox1.Size = new Size(203, 38); ComboBox1.TabIndex = 28; ComboBox1.Text = "ComboBox1"; // // ComboBox2 // ComboBox2.DataBindings.Add(new Binding("Text", bindingSource1, "HorizontalAlignment", true, DataSourceUpdateMode.OnPropertyChanged)); - ComboBox2.Location = new Point(814, 325); + ComboBox2.Location = new Point(751, 305); ComboBox2.Margin = new Padding(6, 8, 6, 8); ComboBox2.Name = "ComboBox2"; - ComboBox2.Size = new Size(220, 40); + ComboBox2.Size = new Size(203, 38); ComboBox2.TabIndex = 31; ComboBox2.Text = "ComboBox2"; // @@ -1073,20 +1077,20 @@ namespace ImageCatalog // Label14.AutoSize = true; Label14.ForeColor = Color.Black; - Label14.Location = new Point(658, 325); + Label14.Location = new Point(607, 305); Label14.Margin = new Padding(6, 0, 6, 0); Label14.Name = "Label14"; - Label14.Size = new Size(156, 32); + Label14.Size = new Size(136, 30); Label14.TabIndex = 30; Label14.Text = "Allineamento"; // // TextBox12 // TextBox12.DataBindings.Add(new Binding("Text", bindingSource1, "TextMargin", true, DataSourceUpdateMode.OnPropertyChanged)); - TextBox12.Location = new Point(814, 266); + TextBox12.Location = new Point(751, 249); TextBox12.Margin = new Padding(6, 8, 6, 8); TextBox12.Name = "TextBox12"; - TextBox12.Size = new Size(220, 39); + TextBox12.Size = new Size(203, 35); TextBox12.TabIndex = 33; TextBox12.Text = "TextBox12"; // @@ -1094,21 +1098,21 @@ namespace ImageCatalog // Label15.AutoSize = true; Label15.ForeColor = Color.Black; - Label15.Location = new Point(642, 266); + Label15.Location = new Point(593, 249); Label15.Margin = new Padding(6, 0, 6, 0); Label15.Name = "Label15"; - Label15.Size = new Size(174, 32); + Label15.Size = new Size(151, 30); Label15.TabIndex = 32; Label15.Text = "Margine (pixel)"; // // TabPage2 // TabPage2.Controls.Add(GroupBox2); - TabPage2.Location = new Point(8, 46); + TabPage2.Location = new Point(4, 39); TabPage2.Margin = new Padding(6, 8, 6, 8); TabPage2.Name = "TabPage2"; TabPage2.Padding = new Padding(6, 8, 6, 8); - TabPage2.Size = new Size(1113, 874); + TabPage2.Size = new Size(1034, 827); TabPage2.TabIndex = 5; TabPage2.Text = "Foto"; TabPage2.UseVisualStyleBackColor = true; @@ -1125,11 +1129,11 @@ namespace ImageCatalog GroupBox2.Controls.Add(TextBox28); GroupBox2.Controls.Add(CheckBox15); GroupBox2.ForeColor = Color.FromArgb(0, 0, 192); - GroupBox2.Location = new Point(6, 14); + GroupBox2.Location = new Point(6, 13); GroupBox2.Margin = new Padding(6, 8, 6, 8); GroupBox2.Name = "GroupBox2"; GroupBox2.Padding = new Padding(6, 8, 6, 8); - GroupBox2.Size = new Size(658, 384); + GroupBox2.Size = new Size(607, 360); GroupBox2.TabIndex = 36; GroupBox2.TabStop = false; GroupBox2.Text = "Foto grande"; @@ -1137,39 +1141,39 @@ namespace ImageCatalog // Label45 // Label45.AutoSize = true; - Label45.Location = new Point(24, 211); + Label45.Location = new Point(22, 198); Label45.Margin = new Padding(6, 0, 6, 0); Label45.Name = "Label45"; - Label45.Size = new Size(90, 32); + Label45.Size = new Size(80, 30); Label45.TabIndex = 22; Label45.Text = "Qualità"; // // TextBox32 // TextBox32.DataBindings.Add(new Binding("Text", bindingSource1, "JpegQuality", true, DataSourceUpdateMode.OnPropertyChanged)); - TextBox32.Location = new Point(156, 197); + TextBox32.Location = new Point(144, 185); TextBox32.Margin = new Padding(6, 8, 6, 8); TextBox32.Name = "TextBox32"; - TextBox32.Size = new Size(152, 39); + TextBox32.Size = new Size(141, 35); TextBox32.TabIndex = 21; TextBox32.Text = "100"; // // TextBox26 // TextBox26.DataBindings.Add(new Binding("Text", bindingSource1, "BigPhotoSuffix", true, DataSourceUpdateMode.OnPropertyChanged)); - TextBox26.Location = new Point(486, 118); + TextBox26.Location = new Point(449, 111); TextBox26.Margin = new Padding(6, 8, 6, 8); TextBox26.Name = "TextBox26"; - TextBox26.Size = new Size(116, 39); + TextBox26.Size = new Size(107, 35); TextBox26.TabIndex = 20; // // Label37 // Label37.ForeColor = Color.Black; - Label37.Location = new Point(364, 118); + Label37.Location = new Point(336, 111); Label37.Margin = new Padding(6, 0, 6, 0); Label37.Name = "Label37"; - Label37.Size = new Size(104, 40); + Label37.Size = new Size(96, 38); Label37.TabIndex = 19; Label37.Text = "Suffisso"; Label37.TextAlign = ContentAlignment.MiddleRight; @@ -1178,20 +1182,20 @@ namespace ImageCatalog // Label38.AutoSize = true; Label38.ForeColor = Color.Black; - Label38.Location = new Point(52, 59); + Label38.Location = new Point(48, 55); Label38.Margin = new Padding(6, 0, 6, 0); Label38.Name = "Label38"; - Label38.Size = new Size(90, 32); + Label38.Size = new Size(81, 30); Label38.TabIndex = 16; Label38.Text = "Altezza"; // // TextBox27 // TextBox27.DataBindings.Add(new Binding("Text", bindingSource1, "PhotoBigWidth", true, DataSourceUpdateMode.OnPropertyChanged)); - TextBox27.Location = new Point(156, 59); + TextBox27.Location = new Point(144, 55); TextBox27.Margin = new Padding(6, 8, 6, 8); TextBox27.Name = "TextBox27"; - TextBox27.Size = new Size(152, 39); + TextBox27.Size = new Size(141, 35); TextBox27.TabIndex = 14; TextBox27.Text = "TextBox27"; // @@ -1199,33 +1203,33 @@ namespace ImageCatalog // Label39.AutoSize = true; Label39.ForeColor = Color.Black; - Label39.Location = new Point(18, 118); + Label39.Location = new Point(17, 111); Label39.Margin = new Padding(6, 0, 6, 0); Label39.Name = "Label39"; - Label39.Size = new Size(120, 32); + Label39.Size = new Size(107, 30); Label39.TabIndex = 17; Label39.Text = "Larghezza"; // // TextBox28 // TextBox28.DataBindings.Add(new Binding("Text", bindingSource1, "PhotoBigHeight", true, DataSourceUpdateMode.OnPropertyChanged)); - TextBox28.Location = new Point(156, 118); + TextBox28.Location = new Point(144, 111); TextBox28.Margin = new Padding(6, 8, 6, 8); TextBox28.Name = "TextBox28"; - TextBox28.Size = new Size(152, 39); + TextBox28.Size = new Size(141, 35); TextBox28.TabIndex = 15; TextBox28.Text = "TextBox28"; // // CheckBox15 // - CheckBox15.DataBindings.Add(new Binding("Checked", bindingSource1, "KeepOriginalDimensions", true, DataSourceUpdateMode.OnPropertyChanged)); CheckBox15.Checked = true; CheckBox15.CheckState = CheckState.Checked; + CheckBox15.DataBindings.Add(new Binding("Checked", bindingSource1, "KeepOriginalDimensions", true, DataSourceUpdateMode.OnPropertyChanged)); CheckBox15.ForeColor = Color.Black; - CheckBox15.Location = new Point(364, 40); + CheckBox15.Location = new Point(336, 38); CheckBox15.Margin = new Padding(6, 8, 6, 8); CheckBox15.Name = "CheckBox15"; - CheckBox15.Size = new Size(260, 78); + CheckBox15.Size = new Size(240, 73); CheckBox15.TabIndex = 18; CheckBox15.Text = "Mantieni dimensioni originali"; // @@ -1233,11 +1237,11 @@ namespace ImageCatalog // TabPage1.Controls.Add(Panel1); TabPage1.Controls.Add(GroupBox1); - TabPage1.Location = new Point(8, 46); + TabPage1.Location = new Point(4, 39); TabPage1.Margin = new Padding(6, 8, 6, 8); TabPage1.Name = "TabPage1"; TabPage1.Padding = new Padding(6, 8, 6, 8); - TabPage1.Size = new Size(1113, 874); + TabPage1.Size = new Size(1034, 827); TabPage1.TabIndex = 0; TabPage1.Text = "Miniature"; TabPage1.UseVisualStyleBackColor = true; @@ -1247,20 +1251,20 @@ namespace ImageCatalog Panel1.Controls.Add(_CheckBox18); Panel1.Controls.Add(_CheckBox4); Panel1.Controls.Add(_CheckBox12); - Panel1.Location = new Point(112, 581); + Panel1.Location = new Point(103, 545); Panel1.Margin = new Padding(6, 8, 6, 8); Panel1.Name = "Panel1"; - Panel1.Size = new Size(658, 179); + Panel1.Size = new Size(607, 168); Panel1.TabIndex = 26; Panel1.Visible = false; // // _CheckBox18 // _CheckBox18.AutoSize = true; - _CheckBox18.Location = new Point(304, 8); + _CheckBox18.Location = new Point(281, 8); _CheckBox18.Margin = new Padding(6, 8, 6, 8); _CheckBox18.Name = "_CheckBox18"; - _CheckBox18.Size = new Size(185, 36); + _CheckBox18.Size = new Size(159, 34); _CheckBox18.TabIndex = 36; _CheckBox18.Text = "Numero foto"; _CheckBox18.UseVisualStyleBackColor = true; @@ -1268,20 +1272,20 @@ namespace ImageCatalog // _CheckBox4 // _CheckBox4.ForeColor = Color.Black; - _CheckBox4.Location = new Point(21, 8); + _CheckBox4.Location = new Point(19, 8); _CheckBox4.Margin = new Padding(6, 8, 6, 8); _CheckBox4.Name = "_CheckBox4"; - _CheckBox4.Size = new Size(226, 42); + _CheckBox4.Size = new Size(209, 39); _CheckBox4.TabIndex = 34; _CheckBox4.Text = "Aggiungi scritta"; // // _CheckBox12 // _CheckBox12.ForeColor = Color.Black; - _CheckBox12.Location = new Point(21, 46); + _CheckBox12.Location = new Point(19, 43); _CheckBox12.Margin = new Padding(6, 8, 6, 8); _CheckBox12.Name = "_CheckBox12"; - _CheckBox12.Size = new Size(226, 51); + _CheckBox12.Size = new Size(209, 48); _CheckBox12.TabIndex = 35; _CheckBox12.Text = "Aggiungi orario"; // @@ -1298,11 +1302,11 @@ namespace ImageCatalog GroupBox1.Controls.Add(TextBox3); GroupBox1.Controls.Add(CheckBox1); GroupBox1.ForeColor = Color.FromArgb(0, 0, 192); - GroupBox1.Location = new Point(13, 13); + GroupBox1.Location = new Point(12, 12); GroupBox1.Margin = new Padding(6, 8, 6, 8); GroupBox1.Name = "GroupBox1"; GroupBox1.Padding = new Padding(6, 8, 6, 8); - GroupBox1.Size = new Size(759, 517); + GroupBox1.Size = new Size(701, 485); GroupBox1.TabIndex = 25; GroupBox1.TabStop = false; GroupBox1.Text = "Miniature"; @@ -1310,20 +1314,20 @@ namespace ImageCatalog // Label46 // Label46.AutoSize = true; - Label46.Location = new Point(429, 106); + Label46.Location = new Point(396, 99); Label46.Margin = new Padding(6, 0, 6, 0); Label46.Name = "Label46"; - Label46.Size = new Size(90, 32); + Label46.Size = new Size(80, 30); Label46.TabIndex = 21; Label46.Text = "Qualità"; // // TextBox33 // TextBox33.DataBindings.Add(new Binding("Text", bindingSource1, "JpegQualityThumbnail", true, DataSourceUpdateMode.OnPropertyChanged)); - TextBox33.Location = new Point(528, 99); + TextBox33.Location = new Point(487, 93); TextBox33.Margin = new Padding(6, 8, 6, 8); TextBox33.Name = "TextBox33"; - TextBox33.Size = new Size(212, 39); + TextBox33.Size = new Size(196, 35); TextBox33.TabIndex = 20; // // Panel2 @@ -1333,20 +1337,20 @@ namespace ImageCatalog Panel2.Controls.Add(RadioButton4); Panel2.Controls.Add(RadioButton6); Panel2.Controls.Add(RadioButton5); - Panel2.Location = new Point(122, 280); + Panel2.Location = new Point(113, 262); Panel2.Margin = new Padding(6, 8, 6, 8); Panel2.Name = "Panel2"; - Panel2.Size = new Size(509, 221); + Panel2.Size = new Size(470, 207); Panel2.TabIndex = 19; // // RadioButton3 // - RadioButton3.DataBindings.Add(new Binding("Checked", bindingSource1, "AddTextToThumbnails", true, DataSourceUpdateMode.OnPropertyChanged)); RadioButton3.AutoSize = true; - RadioButton3.Location = new Point(32, 40); + RadioButton3.DataBindings.Add(new Binding("Checked", bindingSource1, "AddTextToThumbnails", true, DataSourceUpdateMode.OnPropertyChanged)); + RadioButton3.Location = new Point(30, 38); RadioButton3.Margin = new Padding(6, 8, 6, 8); RadioButton3.Name = "RadioButton3"; - RadioButton3.Size = new Size(215, 36); + RadioButton3.Size = new Size(186, 34); RadioButton3.TabIndex = 14; RadioButton3.TabStop = true; RadioButton3.Text = "Aggiungi Scritta"; @@ -1354,12 +1358,12 @@ namespace ImageCatalog // // RadioButton7 // - RadioButton7.DataBindings.Add(new Binding("Checked", bindingSource1, "AddNumberAndTimeToThumbnails", true, DataSourceUpdateMode.OnPropertyChanged)); RadioButton7.AutoSize = true; - RadioButton7.Location = new Point(280, 99); + RadioButton7.DataBindings.Add(new Binding("Checked", bindingSource1, "AddNumberAndTimeToThumbnails", true, DataSourceUpdateMode.OnPropertyChanged)); + RadioButton7.Location = new Point(258, 93); RadioButton7.Margin = new Padding(6, 8, 6, 8); RadioButton7.Name = "RadioButton7"; - RadioButton7.Size = new Size(215, 36); + RadioButton7.Size = new Size(184, 34); RadioButton7.TabIndex = 18; RadioButton7.TabStop = true; RadioButton7.Text = "numero+tempo"; @@ -1368,10 +1372,10 @@ namespace ImageCatalog // RadioButton4 // RadioButton4.AutoSize = true; - RadioButton4.Location = new Point(32, 99); + RadioButton4.Location = new Point(30, 93); RadioButton4.Margin = new Padding(6, 8, 6, 8); RadioButton4.Name = "RadioButton4"; - RadioButton4.Size = new Size(211, 36); + RadioButton4.Size = new Size(182, 34); RadioButton4.TabIndex = 15; RadioButton4.TabStop = true; RadioButton4.Text = "Aggiungi orario"; @@ -1380,10 +1384,10 @@ namespace ImageCatalog // RadioButton6 // RadioButton6.AutoSize = true; - RadioButton6.Location = new Point(280, 40); + RadioButton6.Location = new Point(258, 38); RadioButton6.Margin = new Padding(6, 8, 6, 8); RadioButton6.Name = "RadioButton6"; - RadioButton6.Size = new Size(184, 36); + RadioButton6.Size = new Size(158, 34); RadioButton6.TabIndex = 17; RadioButton6.TabStop = true; RadioButton6.Text = "Numero foto"; @@ -1391,12 +1395,12 @@ namespace ImageCatalog // // RadioButton5 // - RadioButton5.DataBindings.Add(new Binding("Checked", bindingSource1, "AddRaceTimeToThumbnails", true, DataSourceUpdateMode.OnPropertyChanged)); RadioButton5.AutoSize = true; - RadioButton5.Location = new Point(32, 160); + RadioButton5.DataBindings.Add(new Binding("Checked", bindingSource1, "AddRaceTimeToThumbnails", true, DataSourceUpdateMode.OnPropertyChanged)); + RadioButton5.Location = new Point(30, 150); RadioButton5.Margin = new Padding(6, 8, 6, 8); RadioButton5.Name = "RadioButton5"; - RadioButton5.Size = new Size(173, 36); + RadioButton5.Size = new Size(149, 34); RadioButton5.TabIndex = 16; RadioButton5.TabStop = true; RadioButton5.Text = "Tempo Gara"; @@ -1406,20 +1410,20 @@ namespace ImageCatalog // Label5.AutoSize = true; Label5.ForeColor = Color.Black; - Label5.Location = new Point(52, 216); + Label5.Location = new Point(48, 202); Label5.Margin = new Padding(6, 0, 6, 0); Label5.Name = "Label5"; - Label5.Size = new Size(90, 32); + Label5.Size = new Size(81, 30); Label5.TabIndex = 12; Label5.Text = "Altezza"; // // TextBox5 // TextBox5.DataBindings.Add(new Binding("Text", bindingSource1, "ThumbnailWidth", true, DataSourceUpdateMode.OnPropertyChanged)); - TextBox5.Location = new Point(156, 157); + TextBox5.Location = new Point(144, 147); TextBox5.Margin = new Padding(6, 8, 6, 8); TextBox5.Name = "TextBox5"; - TextBox5.Size = new Size(186, 39); + TextBox5.Size = new Size(172, 35); TextBox5.TabIndex = 10; TextBox5.Text = "TextBox5"; // @@ -1427,20 +1431,20 @@ namespace ImageCatalog // Label6.AutoSize = true; Label6.ForeColor = Color.Black; - Label6.Location = new Point(18, 157); + Label6.Location = new Point(17, 147); Label6.Margin = new Padding(6, 0, 6, 0); Label6.Name = "Label6"; - Label6.Size = new Size(120, 32); + Label6.Size = new Size(107, 30); Label6.TabIndex = 13; Label6.Text = "Larghezza"; // // TextBox6 // TextBox6.DataBindings.Add(new Binding("Text", bindingSource1, "ThumbnailHeight", true, DataSourceUpdateMode.OnPropertyChanged)); - TextBox6.Location = new Point(156, 216); + TextBox6.Location = new Point(144, 202); TextBox6.Margin = new Padding(6, 8, 6, 8); TextBox6.Name = "TextBox6"; - TextBox6.Size = new Size(186, 39); + TextBox6.Size = new Size(172, 35); TextBox6.TabIndex = 11; TextBox6.Text = "TextBox6"; // @@ -1448,20 +1452,20 @@ namespace ImageCatalog // Label3.AutoSize = true; Label3.ForeColor = Color.Black; - Label3.Location = new Point(52, 99); + Label3.Location = new Point(48, 93); Label3.Margin = new Padding(6, 0, 6, 0); Label3.Name = "Label3"; - Label3.Size = new Size(97, 32); + Label3.Size = new Size(85, 30); Label3.TabIndex = 7; Label3.Text = "Suffisso"; // // TextBox3 // TextBox3.DataBindings.Add(new Binding("Text", bindingSource1, "ThumbnailPrefix", true, DataSourceUpdateMode.OnPropertyChanged)); - TextBox3.Location = new Point(156, 99); + TextBox3.Location = new Point(144, 93); TextBox3.Margin = new Padding(6, 8, 6, 8); TextBox3.Name = "TextBox3"; - TextBox3.Size = new Size(186, 39); + TextBox3.Size = new Size(172, 35); TextBox3.TabIndex = 6; TextBox3.Text = "TextBox3"; // @@ -1469,21 +1473,21 @@ namespace ImageCatalog // CheckBox1.DataBindings.Add(new Binding("Checked", bindingSource1, "CreateThumbnails", true, DataSourceUpdateMode.OnPropertyChanged)); CheckBox1.ForeColor = Color.Black; - CheckBox1.Location = new Point(156, 40); + CheckBox1.Location = new Point(144, 38); CheckBox1.Margin = new Padding(6, 8, 6, 8); CheckBox1.Name = "CheckBox1"; - CheckBox1.Size = new Size(226, 59); + CheckBox1.Size = new Size(209, 55); CheckBox1.TabIndex = 5; CheckBox1.Text = "Crea miniature"; // // TabPage4 // TabPage4.Controls.Add(GroupBox6); - TabPage4.Location = new Point(8, 46); + TabPage4.Location = new Point(4, 39); TabPage4.Margin = new Padding(6, 8, 6, 8); TabPage4.Name = "TabPage4"; TabPage4.Padding = new Padding(6, 8, 6, 8); - TabPage4.Size = new Size(1113, 874); + TabPage4.Size = new Size(1034, 827); TabPage4.TabIndex = 3; TabPage4.Text = "Logo"; TabPage4.UseVisualStyleBackColor = true; @@ -1510,11 +1514,11 @@ namespace ImageCatalog GroupBox6.Controls.Add(Label30); GroupBox6.Controls.Add(PictureBox3); GroupBox6.ForeColor = Color.FromArgb(0, 0, 192); - GroupBox6.Location = new Point(13, 14); + GroupBox6.Location = new Point(12, 13); GroupBox6.Margin = new Padding(6, 8, 6, 8); GroupBox6.Name = "GroupBox6"; GroupBox6.Padding = new Padding(6, 8, 6, 8); - GroupBox6.Size = new Size(1074, 552); + GroupBox6.Size = new Size(991, 518); GroupBox6.TabIndex = 42; GroupBox6.TabStop = false; GroupBox6.Text = "Logo"; @@ -1522,10 +1526,10 @@ namespace ImageCatalog // PictureBox2 // PictureBox2.BorderStyle = BorderStyle.FixedSingle; - PictureBox2.Location = new Point(312, 472); + PictureBox2.Location = new Point(288, 442); PictureBox2.Margin = new Padding(6, 8, 6, 8); PictureBox2.Name = "PictureBox2"; - PictureBox2.Size = new Size(49, 56); + PictureBox2.Size = new Size(45, 53); PictureBox2.TabIndex = 44; PictureBox2.TabStop = false; PictureBox2.Visible = false; @@ -1533,10 +1537,10 @@ namespace ImageCatalog // _PictureBox1 // _PictureBox1.Cursor = Cursors.Cross; - _PictureBox1.Location = new Point(554, 138); + _PictureBox1.Location = new Point(511, 129); _PictureBox1.Margin = new Padding(6, 8, 6, 8); _PictureBox1.Name = "_PictureBox1"; - _PictureBox1.Size = new Size(486, 394); + _PictureBox1.Size = new Size(449, 369); _PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; _PictureBox1.TabIndex = 43; _PictureBox1.TabStop = false; @@ -1544,40 +1548,40 @@ namespace ImageCatalog // ComboBox5 // ComboBox5.DataBindings.Add(new Binding("Text", bindingSource1, "LogoVerticalPosition", true, DataSourceUpdateMode.OnPropertyChanged)); - ComboBox5.Location = new Point(312, 413); + ComboBox5.Location = new Point(288, 387); ComboBox5.Margin = new Padding(6, 8, 6, 8); ComboBox5.Name = "ComboBox5"; - ComboBox5.Size = new Size(204, 40); + ComboBox5.Size = new Size(189, 38); ComboBox5.TabIndex = 42; ComboBox5.Text = "ComboBox5"; // // ComboBox4 // ComboBox4.DataBindings.Add(new Binding("Text", bindingSource1, "LogoHorizontalPosition", true, DataSourceUpdateMode.OnPropertyChanged)); - ComboBox4.Location = new Point(312, 355); + ComboBox4.Location = new Point(288, 333); ComboBox4.Margin = new Padding(6, 8, 6, 8); ComboBox4.Name = "ComboBox4"; - ComboBox4.Size = new Size(204, 40); + ComboBox4.Size = new Size(189, 38); ComboBox4.TabIndex = 41; ComboBox4.Text = "ComboBox4"; // // TextBox19 // TextBox19.DataBindings.Add(new Binding("Text", bindingSource1, "LogoTransparency", true, DataSourceUpdateMode.OnPropertyChanged)); - TextBox19.Location = new Point(312, 237); + TextBox19.Location = new Point(288, 222); TextBox19.Margin = new Padding(6, 8, 6, 8); TextBox19.Name = "TextBox19"; - TextBox19.Size = new Size(204, 39); + TextBox19.Size = new Size(189, 35); TextBox19.TabIndex = 40; TextBox19.Text = "TextBox19"; // // Label28 // Label28.ForeColor = Color.Black; - Label28.Location = new Point(37, 238); + Label28.Location = new Point(34, 223); Label28.Margin = new Padding(6, 0, 6, 0); Label28.Name = "Label28"; - Label28.Size = new Size(260, 40); + Label28.Size = new Size(240, 38); Label28.TabIndex = 39; Label28.Text = "Trasparenza (0-100%)"; Label28.TextAlign = ContentAlignment.MiddleLeft; @@ -1586,30 +1590,30 @@ namespace ImageCatalog // CheckBox5.DataBindings.Add(new Binding("Checked", bindingSource1, "AddLogo", true, DataSourceUpdateMode.OnPropertyChanged)); CheckBox5.ForeColor = Color.Black; - CheckBox5.Location = new Point(0, 64); + CheckBox5.Location = new Point(0, 60); CheckBox5.Margin = new Padding(6, 8, 6, 8); CheckBox5.Name = "CheckBox5"; - CheckBox5.Size = new Size(156, 50); + CheckBox5.Size = new Size(144, 47); CheckBox5.TabIndex = 38; CheckBox5.Text = "Aggiungi"; // // TextBox15 // TextBox15.DataBindings.Add(new Binding("Text", bindingSource1, "LogoHeight", true, DataSourceUpdateMode.OnPropertyChanged)); - TextBox15.Location = new Point(312, 178); + TextBox15.Location = new Point(288, 167); TextBox15.Margin = new Padding(6, 8, 6, 8); TextBox15.Name = "TextBox15"; - TextBox15.Size = new Size(204, 39); + TextBox15.Size = new Size(189, 35); TextBox15.TabIndex = 19; TextBox15.Text = "TextBox15"; // // TextBox14 // TextBox14.DataBindings.Add(new Binding("Text", bindingSource1, "LogoWidth", true, DataSourceUpdateMode.OnPropertyChanged)); - TextBox14.Location = new Point(312, 118); + TextBox14.Location = new Point(288, 111); TextBox14.Margin = new Padding(6, 8, 6, 8); TextBox14.Name = "TextBox14"; - TextBox14.Size = new Size(204, 39); + TextBox14.Size = new Size(189, 35); TextBox14.TabIndex = 18; TextBox14.Text = "TextBox14"; // @@ -1617,10 +1621,10 @@ namespace ImageCatalog // Label25.AutoSize = true; Label25.ForeColor = Color.Black; - Label25.Location = new Point(37, 413); + Label25.Location = new Point(34, 387); Label25.Margin = new Padding(6, 0, 6, 0); Label25.Name = "Label25"; - Label25.Size = new Size(210, 32); + Label25.Size = new Size(183, 30); Label25.TabIndex = 36; Label25.Text = "Posizione verticale"; Label25.TextAlign = ContentAlignment.MiddleLeft; @@ -1628,10 +1632,10 @@ namespace ImageCatalog // TextBox16 // TextBox16.DataBindings.Add(new Binding("Text", bindingSource1, "LogoMargin", true, DataSourceUpdateMode.OnPropertyChanged)); - TextBox16.Location = new Point(312, 296); + TextBox16.Location = new Point(288, 278); TextBox16.Margin = new Padding(6, 8, 6, 8); TextBox16.Name = "TextBox16"; - TextBox16.Size = new Size(204, 39); + TextBox16.Size = new Size(189, 35); TextBox16.TabIndex = 35; TextBox16.Text = "TextBox16"; // @@ -1639,10 +1643,10 @@ namespace ImageCatalog // Label24.AutoSize = true; Label24.ForeColor = Color.Black; - Label24.Location = new Point(41, 302); + Label24.Location = new Point(38, 283); Label24.Margin = new Padding(6, 0, 6, 0); Label24.Name = "Label24"; - Label24.Size = new Size(203, 32); + Label24.Size = new Size(176, 30); Label24.TabIndex = 34; Label24.Text = "Margine (pixel/%)"; Label24.TextAlign = ContentAlignment.MiddleLeft; @@ -1651,10 +1655,10 @@ namespace ImageCatalog // Label22.AutoSize = true; Label22.ForeColor = Color.Black; - Label22.Location = new Point(41, 125); + Label22.Location = new Point(38, 117); Label22.Margin = new Padding(6, 0, 6, 0); Label22.Name = "Label22"; - Label22.Size = new Size(90, 32); + Label22.Size = new Size(81, 30); Label22.TabIndex = 20; Label22.Text = "Altezza"; Label22.TextAlign = ContentAlignment.MiddleLeft; @@ -1663,30 +1667,30 @@ namespace ImageCatalog // Label23.AutoSize = true; Label23.ForeColor = Color.Black; - Label23.Location = new Point(41, 184); + Label23.Location = new Point(38, 172); Label23.Margin = new Padding(6, 0, 6, 0); Label23.Name = "Label23"; - Label23.Size = new Size(120, 32); + Label23.Size = new Size(107, 30); Label23.TabIndex = 21; Label23.Text = "Larghezza"; Label23.TextAlign = ContentAlignment.MiddleLeft; // // _Button4 // - _Button4.Location = new Point(1006, 59); + _Button4.Location = new Point(929, 55); _Button4.Margin = new Padding(6, 8, 6, 8); _Button4.Name = "_Button4"; - _Button4.Size = new Size(52, 50); + _Button4.Size = new Size(48, 47); _Button4.TabIndex = 8; _Button4.Text = "..."; // // TextBox10 // TextBox10.DataBindings.Add(new Binding("Text", bindingSource1, "LogoFile", true, DataSourceUpdateMode.OnPropertyChanged)); - TextBox10.Location = new Point(312, 59); + TextBox10.Location = new Point(288, 55); TextBox10.Margin = new Padding(6, 8, 6, 8); TextBox10.Name = "TextBox10"; - TextBox10.Size = new Size(672, 39); + TextBox10.Size = new Size(621, 35); TextBox10.TabIndex = 6; TextBox10.Text = "TextBox10"; // @@ -1694,10 +1698,10 @@ namespace ImageCatalog // Label29.AutoSize = true; Label29.ForeColor = Color.Black; - Label29.Location = new Point(37, 362); + Label29.Location = new Point(34, 339); Label29.Margin = new Padding(6, 0, 6, 0); Label29.Name = "Label29"; - Label29.Size = new Size(238, 32); + Label29.Size = new Size(208, 30); Label29.TabIndex = 36; Label29.Text = "Posizione orizzontale"; Label29.TextAlign = ContentAlignment.MiddleLeft; @@ -1706,10 +1710,10 @@ namespace ImageCatalog // Label30.AutoSize = true; Label30.ForeColor = Color.Black; - Label30.Location = new Point(41, 499); + Label30.Location = new Point(38, 468); Label30.Margin = new Padding(6, 0, 6, 0); Label30.Name = "Label30"; - Label30.Size = new Size(211, 32); + Label30.Size = new Size(184, 30); Label30.TabIndex = 36; Label30.Text = "Colore trasparente"; Label30.TextAlign = ContentAlignment.MiddleLeft; @@ -1718,20 +1722,20 @@ namespace ImageCatalog // PictureBox3 // PictureBox3.BorderStyle = BorderStyle.FixedSingle; - PictureBox3.Location = new Point(468, 472); + PictureBox3.Location = new Point(432, 442); PictureBox3.Margin = new Padding(6, 8, 6, 8); PictureBox3.Name = "PictureBox3"; - PictureBox3.Size = new Size(49, 56); + PictureBox3.Size = new Size(45, 53); PictureBox3.TabIndex = 44; PictureBox3.TabStop = false; PictureBox3.Visible = false; // // _Label27 // - _Label27.Location = new Point(1280, 931); + _Label27.Location = new Point(1182, 873); _Label27.Margin = new Padding(6, 0, 6, 0); _Label27.Name = "_Label27"; - _Label27.Size = new Size(304, 50); + _Label27.Size = new Size(281, 47); _Label27.TabIndex = 62; _Label27.Text = "Versione 2.2 2021"; _Label27.TextAlign = ContentAlignment.MiddleRight; @@ -1741,10 +1745,10 @@ namespace ImageCatalog _Button7.DataBindings.Add(new Binding("Enabled", bindingSource1, "UiDisabled", true, DataSourceUpdateMode.OnPropertyChanged)); _Button7.DataBindings.Add(new Binding("Command", bindingSource1, "AsyncCancelOperationCommand", true)); _Button7.Font = new Font("Microsoft Sans Serif", 14.25F, FontStyle.Bold, GraphicsUnit.Point, 0); - _Button7.Location = new Point(1168, 296); + _Button7.Location = new Point(1078, 278); _Button7.Margin = new Padding(6, 8, 6, 8); _Button7.Name = "_Button7"; - _Button7.Size = new Size(416, 99); + _Button7.Size = new Size(384, 93); _Button7.TabIndex = 61; _Button7.Text = "STOP"; // @@ -1752,10 +1756,10 @@ namespace ImageCatalog // _Button5.DataBindings.Add(new Binding("Enabled", bindingSource1, "UiEnabled", true)); _Button5.Font = new Font("Microsoft Sans Serif", 11F, FontStyle.Bold, GraphicsUnit.Point, 0); - _Button5.Location = new Point(1168, 101); + _Button5.Location = new Point(1078, 95); _Button5.Margin = new Padding(6, 8, 6, 8); _Button5.Name = "_Button5"; - _Button5.Size = new Size(416, 78); + _Button5.Size = new Size(384, 73); _Button5.TabIndex = 60; _Button5.Text = "Salva impostazioni"; // @@ -1763,10 +1767,10 @@ namespace ImageCatalog // Label20.AutoSize = true; Label20.Font = new Font("Microsoft Sans Serif", 9.75F, FontStyle.Bold, GraphicsUnit.Point, 0); - Label20.Location = new Point(1168, 723); + Label20.Location = new Point(1078, 678); Label20.Margin = new Padding(6, 0, 6, 0); Label20.Name = "Label20"; - Label20.Size = new Size(183, 30); + Label20.Size = new Size(175, 29); Label20.TabIndex = 59; Label20.Text = "foto generate:"; // @@ -1774,10 +1778,10 @@ namespace ImageCatalog // Label19.AutoSize = true; Label19.Font = new Font("Microsoft Sans Serif", 9.75F, FontStyle.Bold, GraphicsUnit.Point, 0); - Label19.Location = new Point(1168, 677); + Label19.Location = new Point(1078, 635); Label19.Margin = new Padding(6, 0, 6, 0); Label19.Name = "Label19"; - Label19.Size = new Size(143, 30); + Label19.Size = new Size(135, 29); Label19.TabIndex = 58; Label19.Text = "foto totali: "; // @@ -1785,10 +1789,10 @@ namespace ImageCatalog // Label18.AutoSize = true; Label18.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Bold, GraphicsUnit.Point, 0); - Label18.Location = new Point(1393, 723); + Label18.Location = new Point(1286, 678); Label18.Margin = new Padding(6, 0, 6, 0); Label18.Name = "Label18"; - Label18.Size = new Size(36, 37); + Label18.Size = new Size(31, 32); Label18.TabIndex = 57; Label18.Text = "0"; // @@ -1796,20 +1800,20 @@ namespace ImageCatalog // lblFotoTotaliNum.AutoSize = true; lblFotoTotaliNum.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Bold, GraphicsUnit.Point, 0); - lblFotoTotaliNum.Location = new Point(1393, 677); + lblFotoTotaliNum.Location = new Point(1286, 635); lblFotoTotaliNum.Margin = new Padding(6, 0, 6, 0); lblFotoTotaliNum.Name = "lblFotoTotaliNum"; - lblFotoTotaliNum.Size = new Size(36, 37); + lblFotoTotaliNum.Size = new Size(31, 32); lblFotoTotaliNum.TabIndex = 56; lblFotoTotaliNum.Text = "0"; // // Label10 // Label10.Font = new Font("Microsoft Sans Serif", 14.25F, FontStyle.Bold, GraphicsUnit.Point, 0); - Label10.Location = new Point(1168, 402); + Label10.Location = new Point(1078, 377); Label10.Margin = new Padding(6, 0, 6, 0); Label10.Name = "Label10"; - Label10.Size = new Size(416, 178); + Label10.Size = new Size(384, 167); Label10.TabIndex = 55; Label10.Text = "file"; // @@ -1817,10 +1821,10 @@ namespace ImageCatalog // _Button6.DataBindings.Add(new Binding("Enabled", bindingSource1, "UiEnabled", true)); _Button6.Font = new Font("Microsoft Sans Serif", 11F, FontStyle.Bold, GraphicsUnit.Point, 0); - _Button6.Location = new Point(1168, 24); + _Button6.Location = new Point(1078, 22); _Button6.Margin = new Padding(6, 8, 6, 8); _Button6.Name = "_Button6"; - _Button6.Size = new Size(416, 78); + _Button6.Size = new Size(384, 73); _Button6.TabIndex = 54; _Button6.Text = "Carica impostazioni"; // @@ -1828,10 +1832,10 @@ namespace ImageCatalog // _btnCreaCatalogoAsync.DataBindings.Add(new Binding("Enabled", bindingSource1, "UiEnabled", true)); _btnCreaCatalogoAsync.Font = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Bold, GraphicsUnit.Point, 0); - _btnCreaCatalogoAsync.Location = new Point(1168, 187); + _btnCreaCatalogoAsync.Location = new Point(1078, 175); _btnCreaCatalogoAsync.Margin = new Padding(6, 8, 6, 8); _btnCreaCatalogoAsync.Name = "_btnCreaCatalogoAsync"; - _btnCreaCatalogoAsync.Size = new Size(416, 93); + _btnCreaCatalogoAsync.Size = new Size(384, 87); _btnCreaCatalogoAsync.TabIndex = 68; _btnCreaCatalogoAsync.Text = "CREA"; _btnCreaCatalogoAsync.UseVisualStyleBackColor = true; @@ -1840,11 +1844,29 @@ namespace ImageCatalog // dataModelBindingSource1.DataSource = typeof(ImageCatalog_2.DataModel); // + // btnOpenSourceFolder + // + btnOpenSourceFolder.Location = new Point(939, 38); + btnOpenSourceFolder.Margin = new Padding(6, 8, 6, 8); + btnOpenSourceFolder.Name = "btnOpenSourceFolder"; + btnOpenSourceFolder.Size = new Size(48, 35); + btnOpenSourceFolder.TabIndex = 26; + btnOpenSourceFolder.Text = "Apri"; + // + // btnOpenDestFolder + // + btnOpenDestFolder.Location = new Point(939, 97); + btnOpenDestFolder.Margin = new Padding(6, 8, 6, 8); + btnOpenDestFolder.Name = "btnOpenDestFolder"; + btnOpenDestFolder.Size = new Size(48, 35); + btnOpenDestFolder.TabIndex = 27; + btnOpenDestFolder.Text = "Apri"; + // // MainForm // - AutoScaleDimensions = new SizeF(13F, 32F); + AutoScaleDimensions = new SizeF(12F, 30F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(1601, 987); + ClientSize = new Size(1478, 925); Controls.Add(_btnCreaCatalogoAsync); Controls.Add(ProgressBar1); Controls.Add(CheckBox22); @@ -2255,6 +2277,8 @@ namespace ImageCatalog private Button button1; private NumericUpDown numericUpDown1; private NumericUpDown numericUpDown2; + private Button btnOpenDestFolder; + private Button btnOpenSourceFolder; internal Button btnCreaCatalogoAsync { diff --git a/imagecatalog/MainForm.cs b/imagecatalog/MainForm.cs index c5e7b12..d31a157 100644 --- a/imagecatalog/MainForm.cs +++ b/imagecatalog/MainForm.cs @@ -7,6 +7,7 @@ using System.Drawing.Text; using System.IO; using System.Linq; using System.Reflection; +using System.Diagnostics; using System.Runtime.InteropServices; using System.Text; using System.Threading; @@ -47,6 +48,10 @@ public partial class MainForm BindControls(); + // Wire up 'Open folder in Explorer' buttons + btnOpenSourceFolder.Click += BtnOpenSourceFolder_Click; + btnOpenDestFolder.Click += BtnOpenDestFolder_Click; + var version = Assembly.GetExecutingAssembly().GetName().Version; _Label27.Text = $"Version: {version.Major}.{version.Minor}.{version.Build}.{version.Revision}"; } @@ -70,6 +75,21 @@ public partial class MainForm Model.SaveSettingsRequested += OnSaveSettingsRequested; Model.LoadSettingsRequested += OnLoadSettingsRequested; Model.SelectColorRequested += OnSelectColorRequested; + // Show message requests (from ViewModel validation) + Model.ShowMessageRequested += OnShowMessageRequested; + } + + private void OnShowMessageRequested(object? sender, Tuple args) + { + if (args is null) return; + // Ensure call on UI thread + if (InvokeRequired) + { + Invoke(new Action(() => OnShowMessageRequested(sender, args))); + return; + } + + MessageBox.Show(this, args.Item1, args.Item2, MessageBoxButtons.OK, args.Item3); } private void SetDefaults() @@ -181,6 +201,57 @@ public partial class MainForm } } + private void BtnOpenSourceFolder_Click(object? sender, EventArgs e) + { + // Prefer the model value but fall back to the textbox if needed + var path = string.IsNullOrWhiteSpace(Model.SourcePath) ? txtSorgente.Text : Model.SourcePath; + OpenFolder(path); + } + + private void BtnOpenDestFolder_Click(object? sender, EventArgs e) + { + var path = string.IsNullOrWhiteSpace(Model.DestinationPath) ? txtDestinazione.Text : Model.DestinationPath; + OpenFolder(path); + } + + private void OpenFolder(string? path) + { + if (string.IsNullOrWhiteSpace(path)) + { + MessageBox.Show(this, "Folder path is empty.", "Open Folder", MessageBoxButtons.OK, MessageBoxIcon.Warning); + return; + } + + path = path.Trim().Trim('"'); + + try + { + if (File.Exists(path)) + { + // If a file was provided, open its folder and select it + Process.Start("explorer.exe", $"/select,\"{path}\""); + return; + } + + if (Directory.Exists(path)) + { + Process.Start(new ProcessStartInfo + { + FileName = path, + UseShellExecute = true + }); + return; + } + + MessageBox.Show(this, $"Folder does not exist: {path}", "Open Folder", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + catch (Exception ex) + { + _logger?.LogError(ex, "Failed to open folder {Path}", path); + MessageBox.Show(this, $"Failed to open folder: {ex.Message}", "Open Folder", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + private void OnSelectDestinationFolderRequested(object sender, EventArgs e) { var dialogResult = SelectFolder(Model.DestinationPath); diff --git a/run-benchmarks.ps1 b/run-benchmarks.ps1 new file mode 100644 index 0000000..a228423 --- /dev/null +++ b/run-benchmarks.ps1 @@ -0,0 +1,124 @@ +# Image Processing Benchmark Runner +# This script provides easy access to common benchmark scenarios + +param( + [Parameter(Position=0)] + [ValidateSet("all", "quick", "parallel", "chunks", "sizes", "stress", "help")] + [string]$Scenario = "help", + + [switch]$Fast, + [switch]$DetailedOutput +) + +$projectPath = "MaddoShared.Benchmarks" + +function Show-Help { + Write-Host @" +Image Processing Benchmark Runner +================================== + +Usage: .\run-benchmarks.ps1 [scenario] [-Fast] [-DetailedOutput] + +Scenarios: + all - Run all benchmarks (60-120 minutes) + quick - Fast test run for development (5-10 minutes) + parallel - Test parallel processing strategies (20-30 minutes) + chunks - Optimize chunk size (20-30 minutes) + sizes - Test different image sizes (45-90 minutes) + stress - Large-scale stress test (2-4 hours) + help - Show this help message + +Flags: + -Fast - Use dry run for faster but less accurate results + -DetailedOutput - Show detailed output + +Examples: + .\run-benchmarks.ps1 quick + .\run-benchmarks.ps1 parallel -Fast + .\run-benchmarks.ps1 stress -DetailedOutput + +Results will be saved to: MaddoShared.Benchmarks\BenchmarkDotNet.Artifacts\results\ +"@ +} + +function Run-Benchmark { + param( + [string]$Filter, + [string]$Description + ) + + Write-Host "`n========================================" -ForegroundColor Cyan + Write-Host " $Description" -ForegroundColor Cyan + Write-Host "========================================`n" -ForegroundColor Cyan + + $args = @("-c", "Release") + + if ($Filter) { + $args += @("--", "--filter", $Filter) + } + + # Note: We don't pass --job arguments anymore because they override + # the InProcess toolchain configuration needed for Windows compatibility + if ($Fast) { + Write-Host "Note: Fast mode (-Fast) requested but not using --job dry" -ForegroundColor Yellow + Write-Host "Reason: --job arguments override InProcess toolchain config" -ForegroundColor Yellow + Write-Host "The benchmark will run with the default InProcessConfig settings.`n" -ForegroundColor Yellow + } + + if ($DetailedOutput) { + $args += "--verbosity", "detailed" + } + + Push-Location $projectPath + try { + dotnet run @args + } + finally { + Pop-Location + } +} + +# Main execution +switch ($Scenario) { + "help" { + Show-Help + } + + "all" { + Write-Host "Running ALL benchmarks..." -ForegroundColor Yellow + Write-Host "This will take 60-120 minutes. Press Ctrl+C to cancel.`n" -ForegroundColor Yellow + Start-Sleep -Seconds 3 + Run-Benchmark "" "All Benchmarks" + } + + "quick" { + Write-Host "Running QUICK test..." -ForegroundColor Green + Run-Benchmark "*ImageProcessingBenchmarks*" "Quick Development Test" + } + + "parallel" { + Write-Host "Running PARALLEL processing benchmarks..." -ForegroundColor Green + Run-Benchmark "*ImageProcessingBenchmarks*" "Parallel Processing Strategies" + } + + "chunks" { + Write-Host "Running CHUNK SIZE optimization..." -ForegroundColor Green + Run-Benchmark "*ChunkSizeBenchmarks*" "Chunk Size Optimization" + } + + "sizes" { + Write-Host "Running IMAGE SIZE comparison..." -ForegroundColor Green + Run-Benchmark "*ImageSizeBenchmarks*" "Image Size Impact Analysis" + } + + "stress" { + Write-Host "Running STRESS TEST..." -ForegroundColor Red + Write-Host "WARNING: This will take 2-4 hours and use significant disk space!" -ForegroundColor Red + Write-Host "Press Ctrl+C within 5 seconds to cancel...`n" -ForegroundColor Red + Start-Sleep -Seconds 5 + Run-Benchmark "*StressTestBenchmark*" "Large-Scale Stress Test" + } +} + +Write-Host "`nBenchmark execution complete!" -ForegroundColor Green +Write-Host "Results saved to: $projectPath\BenchmarkDotNet.Artifacts\results\" -ForegroundColor Green diff --git a/run-benchmarks.sh b/run-benchmarks.sh new file mode 100644 index 0000000..e9cc03a --- /dev/null +++ b/run-benchmarks.sh @@ -0,0 +1,134 @@ +#!/bin/bash + +# Image Processing Benchmark Runner (Linux/Mac) +# This script provides easy access to common benchmark scenarios + +show_help() { + cat << EOF +Image Processing Benchmark Runner +================================== + +Usage: ./run-benchmarks.sh [scenario] [--fast] [--verbose] + +Scenarios: + all - Run all benchmarks (60-120 minutes) + quick - Fast test run for development (5-10 minutes) + parallel - Test parallel processing strategies (20-30 minutes) + chunks - Optimize chunk size (20-30 minutes) + sizes - Test different image sizes (45-90 minutes) + stress - Large-scale stress test (2-4 hours) + help - Show this help message + +Flags: + --fast - Use dry run for faster but less accurate results + --verbose - Show detailed output + +Examples: + ./run-benchmarks.sh quick + ./run-benchmarks.sh parallel --fast + ./run-benchmarks.sh stress --verbose + +Results will be saved to: MaddoShared.Benchmarks/BenchmarkDotNet.Artifacts/results/ +EOF +} + +run_benchmark() { + local filter=$1 + local description=$2 + + echo "" + echo "========================================" + echo " $description" + echo "========================================" + echo "" + + local args="-c Release" + + if [ -n "$filter" ]; then + args="$args -- --filter \"$filter\"" + fi + + if [ "$fast_mode" = true ]; then + args="$args --job dry" + fi + + if [ "$verbose_mode" = true ]; then + args="$args --verbose" + fi + + cd MaddoShared.Benchmarks + eval "dotnet run $args" + cd .. +} + +# Parse arguments +scenario="${1:-help}" +fast_mode=false +verbose_mode=false + +shift +while [ $# -gt 0 ]; do + case "$1" in + --fast) + fast_mode=true + ;; + --verbose) + verbose_mode=true + ;; + esac + shift +done + +# Main execution +case "$scenario" in + help) + show_help + ;; + + all) + echo "Running ALL benchmarks..." + echo "This will take 60-120 minutes. Press Ctrl+C to cancel." + echo "" + sleep 3 + run_benchmark "" "All Benchmarks" + ;; + + quick) + echo "Running QUICK test..." + run_benchmark "*ImageProcessingBenchmarks*" "Quick Development Test" + ;; + + parallel) + echo "Running PARALLEL processing benchmarks..." + run_benchmark "*ImageProcessingBenchmarks*" "Parallel Processing Strategies" + ;; + + chunks) + echo "Running CHUNK SIZE optimization..." + run_benchmark "*ChunkSizeBenchmarks*" "Chunk Size Optimization" + ;; + + sizes) + echo "Running IMAGE SIZE comparison..." + run_benchmark "*ImageSizeBenchmarks*" "Image Size Impact Analysis" + ;; + + stress) + echo "Running STRESS TEST..." + echo "WARNING: This will take 2-4 hours and use significant disk space!" + echo "Press Ctrl+C within 5 seconds to cancel..." + echo "" + sleep 5 + run_benchmark "*StressTestBenchmark*" "Large-Scale Stress Test" + ;; + + *) + echo "Unknown scenario: $scenario" + echo "Run './run-benchmarks.sh help' for usage information" + exit 1 + ;; +esac + +echo "" +echo "Benchmark execution complete!" +echo "Results saved to: MaddoShared.Benchmarks/BenchmarkDotNet.Artifacts/results/" -- 2.52.0 From 6ccbec890ad11d4e3644fb0cd8ed5456e00350f9 Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Sat, 14 Feb 2026 19:36:58 +0100 Subject: [PATCH 047/127] Improve speed stats, UI usability, and settings persistence Enhanced speed counter with smoothing and elapsed time display. Added folder open buttons to UI and repositioned speed label. Added UpdateSubdirectories to settings for persistence. --- imagecatalog/DataModel.cs | 85 +++++++++++++++++++++++++++--- imagecatalog/MainForm.Designer.cs | 42 +++++++-------- imagecatalog/Models/SettingsDto.cs | 4 ++ 3 files changed, 103 insertions(+), 28 deletions(-) diff --git a/imagecatalog/DataModel.cs b/imagecatalog/DataModel.cs index 0c7d826..080ef24 100644 --- a/imagecatalog/DataModel.cs +++ b/imagecatalog/DataModel.cs @@ -849,6 +849,11 @@ namespace ImageCatalog_2 // Atomic counter for processed images — avoids expensive ConcurrentBag.Count enumerations private int _processedAtomic = 0; private System.Threading.Timer? _speedTimer; + // Stopwatch used to compute run-wide averages + private Stopwatch? _speedWatch; + // Recent diffs queue to smooth short-term fluctuations + private readonly Queue _recentDiffs = new(); + private int _recentWindowSize = 5; // average over last 5 samples (~5s) private void Test(object parameter) { @@ -907,6 +912,8 @@ namespace ImageCatalog_2 _processedAtomic = 0; // Start speed timer (sample every second using lightweight atomic reads) + _speedWatch = Stopwatch.StartNew(); + _recentDiffs.Clear(); _speedTimer = new System.Threading.Timer(UpdateSpeedCounter, null, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(1)); var time = await _imageCreationService.CreaCatalogoParallel( @@ -915,9 +922,28 @@ namespace ImageCatalog_2 OnImageProcessed, token); - SpeedCounter = time; + // Compute final averages and show only averages (do not show raw seconds) + var finalProcessed = System.Threading.Volatile.Read(ref _processedAtomic); + double overallAvg = 0.0; + double overallPerMin = 0.0; + if (_speedWatch is not null && _speedWatch.Elapsed.TotalSeconds > 0.0) + { + overallAvg = finalProcessed / _speedWatch.Elapsed.TotalSeconds; + overallPerMin = overallAvg * 60.0; + } + + // Compute elapsed time as h m s and show final averages (no raw seconds parentheses) + var finalElapsed = _speedWatch?.Elapsed ?? TimeSpan.Zero; + int fh = (int)finalElapsed.TotalHours; + int fm = finalElapsed.Minutes; + int fs = finalElapsed.Seconds; + + SpeedCounter = $"{fh}h {fm}m {fs}s{Environment.NewLine}media: {overallAvg:0.00} f/s{Environment.NewLine}media: {overallPerMin:0.00} f/m"; + _speedTimer?.Dispose(); _speedTimer = null; + _speedWatch?.Stop(); + _speedWatch = null; } catch (OperationCanceledException) { @@ -942,12 +968,57 @@ namespace ImageCatalog_2 private void UpdateSpeedCounter(object? state) { - _previousAmount = _currentAmount; - // Read the atomic counter without enumerating the ConcurrentBag - _currentAmount = System.Threading.Volatile.Read(ref _processedAtomic); - int diff = _currentAmount - _previousAmount; - // Report files per second (timer runs every 1s) - SpeedCounter = $"{diff} f/s"; + try + { + _previousAmount = _currentAmount; + // Read the atomic counter without enumerating the ConcurrentBag + _currentAmount = System.Threading.Volatile.Read(ref _processedAtomic); + int diff = _currentAmount - _previousAmount; + + // Protect against negative or spurious diffs + if (diff < 0) diff = 0; + + // Maintain a small sliding window of recent diffs to smooth the display + lock (_recentDiffs) + { + _recentDiffs.Enqueue(diff); + if (_recentDiffs.Count > _recentWindowSize) + _recentDiffs.Dequeue(); + } + + double avgRecent; + lock (_recentDiffs) + { + avgRecent = _recentDiffs.Count == 0 ? 0.0 : _recentDiffs.Average(); + } + + // Compute overall average (since start) if we have a stopwatch + double overall = 0.0; + if (_speedWatch is not null && _speedWatch.Elapsed.TotalSeconds >= 1) + { + var elapsedSeconds = _speedWatch.Elapsed.TotalSeconds; + var total = System.Threading.Volatile.Read(ref _processedAtomic); + overall = elapsedSeconds > 0 ? total / elapsedSeconds : 0.0; + } + + // Recent per-minute estimate + var recentPerMin = avgRecent * 60.0; + var overallPerMin = overall * 60.0; + + // Build a two-line display plus elapsed time: first line shows f/s with overall media and elapsed time, + // second line shows recent photos per minute (media) + var elapsed = _speedWatch?.Elapsed ?? TimeSpan.Zero; + int hours = (int)elapsed.TotalHours; + int minutes = elapsed.Minutes; + int seconds = elapsed.Seconds; + var elapsedStr = $"{hours}h {minutes}m {seconds}s"; + + SpeedCounter = $"{avgRecent:0.00} f/s (media: {overall:0.00} f/s) - {elapsedStr}{Environment.NewLine}media: {recentPerMin:0.00} f/m"; + } + catch + { + // Swallow unlikely errors from timing/queue operations but keep UI responsive + } } private void OnImageProcessed(object? sender, Tuple args) diff --git a/imagecatalog/MainForm.Designer.cs b/imagecatalog/MainForm.Designer.cs index 6b1c48c..0ee4e01 100644 --- a/imagecatalog/MainForm.Designer.cs +++ b/imagecatalog/MainForm.Designer.cs @@ -56,6 +56,8 @@ namespace ImageCatalog Label8 = new Label(); Label7 = new Label(); GroupBox3 = new GroupBox(); + btnOpenDestFolder = new Button(); + btnOpenSourceFolder = new Button(); chkAggiornaSottodirectory = new CheckBox(); _Button3 = new Button(); _Button2 = new Button(); @@ -181,8 +183,6 @@ namespace ImageCatalog _btnCreaCatalogoAsync = new Button(); timer1 = new System.Windows.Forms.Timer(components); dataModelBindingSource1 = new BindingSource(components); - btnOpenSourceFolder = new Button(); - btnOpenDestFolder = new Button(); ((System.ComponentModel.ISupportInitialize)bindingSource1).BeginInit(); ((System.ComponentModel.ISupportInitialize)dataModelBindingSource).BeginInit(); TabControl1.SuspendLayout(); @@ -245,7 +245,7 @@ namespace ImageCatalog // Label43.AutoSize = true; Label43.DataBindings.Add(new Binding("Text", bindingSource1, "SpeedCounter", true)); - Label43.Location = new Point(1073, 789); + Label43.Location = new Point(1074, 725); Label43.Margin = new Padding(6, 0, 6, 0); Label43.Name = "Label43"; Label43.Size = new Size(46, 30); @@ -418,6 +418,24 @@ namespace ImageCatalog GroupBox3.TabStop = false; GroupBox3.Text = "Directory"; // + // btnOpenDestFolder + // + btnOpenDestFolder.Location = new Point(939, 97); + btnOpenDestFolder.Margin = new Padding(6, 8, 6, 8); + btnOpenDestFolder.Name = "btnOpenDestFolder"; + btnOpenDestFolder.Size = new Size(48, 35); + btnOpenDestFolder.TabIndex = 27; + btnOpenDestFolder.Text = "Apri"; + // + // btnOpenSourceFolder + // + btnOpenSourceFolder.Location = new Point(939, 38); + btnOpenSourceFolder.Margin = new Padding(6, 8, 6, 8); + btnOpenSourceFolder.Name = "btnOpenSourceFolder"; + btnOpenSourceFolder.Size = new Size(48, 35); + btnOpenSourceFolder.TabIndex = 26; + btnOpenSourceFolder.Text = "Apri"; + // // chkAggiornaSottodirectory // chkAggiornaSottodirectory.DataBindings.Add(new Binding("Checked", bindingSource1, "UpdateSubdirectories", true, DataSourceUpdateMode.OnPropertyChanged)); @@ -1844,24 +1862,6 @@ namespace ImageCatalog // dataModelBindingSource1.DataSource = typeof(ImageCatalog_2.DataModel); // - // btnOpenSourceFolder - // - btnOpenSourceFolder.Location = new Point(939, 38); - btnOpenSourceFolder.Margin = new Padding(6, 8, 6, 8); - btnOpenSourceFolder.Name = "btnOpenSourceFolder"; - btnOpenSourceFolder.Size = new Size(48, 35); - btnOpenSourceFolder.TabIndex = 26; - btnOpenSourceFolder.Text = "Apri"; - // - // btnOpenDestFolder - // - btnOpenDestFolder.Location = new Point(939, 97); - btnOpenDestFolder.Margin = new Padding(6, 8, 6, 8); - btnOpenDestFolder.Name = "btnOpenDestFolder"; - btnOpenDestFolder.Size = new Size(48, 35); - btnOpenDestFolder.TabIndex = 27; - btnOpenDestFolder.Text = "Apri"; - // // MainForm // AutoScaleDimensions = new SizeF(12F, 30F); diff --git a/imagecatalog/Models/SettingsDto.cs b/imagecatalog/Models/SettingsDto.cs index d5a01b2..70896e0 100644 --- a/imagecatalog/Models/SettingsDto.cs +++ b/imagecatalog/Models/SettingsDto.cs @@ -177,6 +177,10 @@ namespace ImageCatalog_2.Models [XmlElement("GeneraleRotazioneAutomatica")] public bool AutomaticRotation { get; set; } + [JsonPropertyName("UpdateSubdirectories")] + [XmlElement("DirSottoDirectory")] + public bool UpdateSubdirectories { get; set; } + [JsonPropertyName("AddRaceTime")] [XmlElement("TempoGara")] public bool AddRaceTime { get; set; } -- 2.52.0 From 5cb491f1b58696f39bd9bacbfd9b2eaef52dca73 Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Sat, 14 Feb 2026 20:38:51 +0100 Subject: [PATCH 048/127] Persist last-used dialog folders in user preferences Dialogs now remember last-used folders for source, destination, logo, and settings files by storing these paths in a user preferences file under LocalApplicationData. Preferences are saved on form close, reducing unnecessary writes. SettingsService now uses a temporary ParametriSetup for settings files to avoid polluting user preferences. Error handling ensures preference save failures do not disrupt the user. This separation improves user experience and keeps user preferences distinct from project settings. --- imagecatalog/MainForm.cs | 98 +++++++++++++++++++++++- imagecatalog/Program.cs | 5 +- imagecatalog/Services/SettingsService.cs | 29 +++---- 3 files changed, 113 insertions(+), 19 deletions(-) diff --git a/imagecatalog/MainForm.cs b/imagecatalog/MainForm.cs index d31a157..43940cb 100644 --- a/imagecatalog/MainForm.cs +++ b/imagecatalog/MainForm.cs @@ -48,6 +48,9 @@ public partial class MainForm BindControls(); + // Save user preferences on form close instead of immediately when dialogs are used + this.FormClosing += MainForm_FormClosing; + // Wire up 'Open folder in Explorer' buttons btnOpenSourceFolder.Click += BtnOpenSourceFolder_Click; btnOpenDestFolder.Click += BtnOpenDestFolder_Click; @@ -194,10 +197,17 @@ public partial class MainForm private void OnSelectSourceFolderRequested(object sender, EventArgs e) { - var dialogResult = SelectFolder(Model.SourcePath); + // Prefer model value; if empty fall back to last-used value stored in user prefs + var starting = !string.IsNullOrWhiteSpace(Model.SourcePath) + ? Model.SourcePath + : _parametriSetup.LeggiParametroString("LastSourceFolder"); + + var dialogResult = SelectFolder(starting); if (!string.IsNullOrWhiteSpace(dialogResult)) { Model.SourcePath = dialogResult; + _parametriSetup.AggiornaParametro("LastSourceFolder", dialogResult); + _parametriSetup.SalvaParametriSetup(); } } @@ -254,10 +264,16 @@ public partial class MainForm private void OnSelectDestinationFolderRequested(object sender, EventArgs e) { - var dialogResult = SelectFolder(Model.DestinationPath); + var starting = !string.IsNullOrWhiteSpace(Model.DestinationPath) + ? Model.DestinationPath + : _parametriSetup.LeggiParametroString("LastDestinationFolder"); + + var dialogResult = SelectFolder(starting); if (!string.IsNullOrWhiteSpace(dialogResult)) { Model.DestinationPath = dialogResult; + _parametriSetup.AggiornaParametro("LastDestinationFolder", dialogResult); + _parametriSetup.SalvaParametriSetup(); } } @@ -265,15 +281,36 @@ public partial class MainForm { var dialog = new OpenFileDialog(); dialog.Filter = "Image Files|*.jpg;*.jpeg;*.png;*.bmp;*.gif"; - if (Model.LogoFile.Length > 0) + if (!string.IsNullOrWhiteSpace(Model.LogoFile)) { dialog.FileName = Model.LogoFile; } + else + { + var lastLogoFolder = _parametriSetup.LeggiParametroString("LastLogoFolder"); + if (!string.IsNullOrWhiteSpace(lastLogoFolder) && Directory.Exists(lastLogoFolder)) + { + dialog.InitialDirectory = lastLogoFolder; + } + } if (dialog.ShowDialog() == DialogResult.OK) { Model.LogoFile = dialog.FileName; UpdateLogoPictureBox(Model.LogoFile); + try + { + var folder = Path.GetDirectoryName(dialog.FileName) ?? string.Empty; + if (!string.IsNullOrWhiteSpace(folder)) + { + _parametriSetup.AggiornaParametro("LastLogoFolder", folder); + _parametriSetup.SalvaParametriSetup(); + } + } + catch + { + // ignore preferences save failures + } } } @@ -285,11 +322,28 @@ public partial class MainForm FilterIndex = 0, RestoreDirectory = true }; - + var lastSettings = _parametriSetup.LeggiParametroString("LastSettingsFolder"); + if (!string.IsNullOrWhiteSpace(lastSettings) && Directory.Exists(lastSettings)) + saveDialog.InitialDirectory = lastSettings; + if (saveDialog.ShowDialog() != DialogResult.OK) return; await Model.SaveSettingsToFileAsync(saveDialog.FileName); Text = "Image Catalog - " + Path.GetFileName(saveDialog.FileName); + + try + { + var folder = Path.GetDirectoryName(saveDialog.FileName) ?? string.Empty; + if (!string.IsNullOrWhiteSpace(folder)) + { + _parametriSetup.AggiornaParametro("LastSettingsFolder", folder); + _parametriSetup.SalvaParametriSetup(); + } + } + catch + { + // ignore + } } private async void OnLoadSettingsRequested(object sender, string e) @@ -301,6 +355,10 @@ public partial class MainForm RestoreDirectory = true }; + var lastSettings = _parametriSetup.LeggiParametroString("LastSettingsFolder"); + if (!string.IsNullOrWhiteSpace(lastSettings) && Directory.Exists(lastSettings)) + openDialog.InitialDirectory = lastSettings; + if (openDialog.ShowDialog() != DialogResult.OK) return; try @@ -318,6 +376,20 @@ public partial class MainForm Text = "Image Catalog - " + Path.GetFileName(openDialog.FileName); + try + { + var folder = Path.GetDirectoryName(openDialog.FileName) ?? string.Empty; + if (!string.IsNullOrWhiteSpace(folder)) + { + _parametriSetup.AggiornaParametro("LastSettingsFolder", folder); + _parametriSetup.SalvaParametriSetup(); + } + } + catch + { + // ignore preferences save failures + } + _logger.LogInformation($"Settings loaded successfully from {openDialog.FileName}"); } catch (Exception ex) @@ -327,6 +399,24 @@ public partial class MainForm } } + private void MainForm_FormClosing(object? sender, FormClosingEventArgs e) + { + try + { + // Persist last-used dialogs paths (user preferences) + // These keys are managed independently from settings files + // and must be saved when the form closes. + _parametriSetup.AggiornaParametro("LastSourceFolder", Model.SourcePath ?? string.Empty); + _parametriSetup.AggiornaParametro("LastDestinationFolder", Model.DestinationPath ?? string.Empty); + _parametriSetup.AggiornaParametro("LastLogoFolder", Path.GetDirectoryName(Model.LogoFile ?? string.Empty) ?? string.Empty); + _parametriSetup.SalvaParametriSetup(); + } + catch (Exception ex) + { + _logger?.LogWarning(ex, "Failed to save user preferences on exit"); + } + } + private void OnSelectColorRequested(object sender, EventArgs e) { var colorDialog = new ColorDialog diff --git a/imagecatalog/Program.cs b/imagecatalog/Program.cs index 2a5e2b2..ea8f2aa 100644 --- a/imagecatalog/Program.cs +++ b/imagecatalog/Program.cs @@ -92,7 +92,10 @@ static class Program services.AddTransient(); services.AddTransient(); - services.AddSingleton(); + // Register a ParametriSetup singleton that persists user preferences in LocalApplicationData + var userPrefsPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), + "ImageCatalog", "userprefs.xml"); + services.AddSingleton(new ParametriSetup(userPrefsPath)); services.AddSingleton(); // Register your forms diff --git a/imagecatalog/Services/SettingsService.cs b/imagecatalog/Services/SettingsService.cs index 3b0a630..8a92333 100644 --- a/imagecatalog/Services/SettingsService.cs +++ b/imagecatalog/Services/SettingsService.cs @@ -24,40 +24,41 @@ namespace ImageCatalog_2.Services public Task SaveSettingsAsync(string filePath, object settings) { + // Use a dedicated ParametriSetup instance for the target settings file so the injected + // user preferences store is not modified. This keeps user prefs (singleton) intact. return Task.Run(() => { - _parametriSetup.NomeFileSetup = filePath; - + var fileParams = new ParametriSetup(filePath); + // Convert ViewModel to DTO var dto = ViewModelToDto(settings); - + // Use reflection on DTO properties with XmlElement attribute var properties = typeof(SettingsDto).GetProperties(BindingFlags.Public | BindingFlags.Instance); foreach (var prop in properties) { - // Get the XmlElement attribute to determine the XML property name var xmlAttr = prop.GetCustomAttribute(); if (xmlAttr == null) - continue; // Skip properties without XmlElement attribute - + continue; + var xmlName = xmlAttr.ElementName; var value = prop.GetValue(dto); - - _parametriSetup.AggiornaParametro(xmlName, value); + + fileParams.AggiornaParametro(xmlName, value); } - _parametriSetup.SalvaParametriSetup(); + fileParams.SalvaParametriSetup(); }); } public async Task LoadSettingsAsync(string filePath, object settings) { - // Step 1: Load XML and read into DTO on background thread + // Step 1: Load XML into a temporary ParametriSetup so we don't mutate the injected + // user-preferences instance (singleton). var dto = await Task.Run(() => { - _parametriSetup.NomeFileSetup = filePath; - _parametriSetup.CaricaParametriSetup(); + var fileParams = new ParametriSetup(filePath); var loadedDto = new SettingsDto(); var properties = typeof(SettingsDto).GetProperties(BindingFlags.Public | BindingFlags.Instance); @@ -76,11 +77,11 @@ namespace ImageCatalog_2.Services object value; if (prop.PropertyType == typeof(string)) { - value = _parametriSetup.LeggiParametroString(xmlName); + value = fileParams.LeggiParametroString(xmlName); } else if (prop.PropertyType == typeof(bool)) { - value = _parametriSetup.LeggiParametroBoolean(xmlName); + value = fileParams.LeggiParametroBoolean(xmlName); } else if (prop.PropertyType == typeof(int)) { -- 2.52.0 From 509d5357a80b181f7c02af9ec604baca6a254008 Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Sat, 14 Feb 2026 21:14:06 +0100 Subject: [PATCH 049/127] Integrate GitVersion and add version provider abstraction - Added GitVersion for semantic versioning and build metadata - Introduced IVersionProvider and VersionProvider for UI-friendly version display - MainForm now uses IVersionProvider for version label - Registered VersionProvider in DI container - Improved logging: filtered out AutoMapper license logs - General code cleanup in Program.cs --- .gitversion.yml | 23 ++++++++ GitVersion.yml | 2 +- MaddoShared/IVersionProvider.cs | 9 ++++ MaddoShared/VersionProvider.cs | 60 +++++++++++++++++++++ imagecatalog/GitVersion.README.md | 12 +++++ imagecatalog/ImageCatalog 2.csproj | 1 + imagecatalog/MainForm.cs | 6 +-- imagecatalog/Program.cs | 85 ++++++++++++++++-------------- 8 files changed, 154 insertions(+), 44 deletions(-) create mode 100644 .gitversion.yml create mode 100644 MaddoShared/IVersionProvider.cs create mode 100644 MaddoShared/VersionProvider.cs create mode 100644 imagecatalog/GitVersion.README.md diff --git a/.gitversion.yml b/.gitversion.yml new file mode 100644 index 0000000..a0d761b --- /dev/null +++ b/.gitversion.yml @@ -0,0 +1,23 @@ +mode: ContinuousDelivery +branches: + main: + tag: '' + increment: Patch + prevent-increment-of-merged-branch-version: true + track-merge-target: false + develop: + tag: alpha + increment: Minor + prevent-increment-of-merged-branch-version: false + feature: + tag: beta + increment: Patch + hotfix: + tag: hotfix + increment: Patch + release: + tag: rc + increment: Patch +ignore: + sha: [] +commit-message-incrementing: Disabled diff --git a/GitVersion.yml b/GitVersion.yml index 23ce4fc..05c2cf9 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -4,4 +4,4 @@ branches: {} ignore: sha: [] merge-message-formats: {} -next-version: 3.0 \ No newline at end of file +next-version: "3.2" \ No newline at end of file diff --git a/MaddoShared/IVersionProvider.cs b/MaddoShared/IVersionProvider.cs new file mode 100644 index 0000000..940cae6 --- /dev/null +++ b/MaddoShared/IVersionProvider.cs @@ -0,0 +1,9 @@ +namespace MaddoShared; + +public interface IVersionProvider +{ + /// + /// Returns a human-friendly version string for display (prefer AssemblyInformationalVersion). + /// + string GetVersionString(); +} diff --git a/MaddoShared/VersionProvider.cs b/MaddoShared/VersionProvider.cs new file mode 100644 index 0000000..346714d --- /dev/null +++ b/MaddoShared/VersionProvider.cs @@ -0,0 +1,60 @@ +using System.Diagnostics; +using System.Reflection; +using System.Collections.Generic; + +namespace MaddoShared; + +public sealed class VersionProvider : IVersionProvider +{ + public string GetVersionString() + { + // Prefer the entry assembly; fall back to executing assembly + var asm = Assembly.GetEntryAssembly() ?? Assembly.GetExecutingAssembly(); + + // 1) AssemblyInformationalVersion + var infoAttr = asm.GetCustomAttribute(); + if (!string.IsNullOrWhiteSpace(infoAttr?.InformationalVersion)) + { + return infoAttr.InformationalVersion!; + } + + // 2) File product version + try + { + var location = asm.Location; + if (!string.IsNullOrWhiteSpace(location)) + { + var fvi = FileVersionInfo.GetVersionInfo(location); + if (!string.IsNullOrWhiteSpace(fvi.ProductVersion)) + return fvi.ProductVersion!; + } + } + catch + { + // ignore and fall back to assembly version + } + + // 3) AssemblyName.Version formatted (avoid -1 and trailing .0 parts) + var ver = asm.GetName().Version; + if (ver is not null) + { + // Build a list of parts but ignore negative values + var parts = new List { ver.Major, ver.Minor }; + if (ver.Build >= 0) parts.Add(ver.Build); + if (ver.Revision >= 0) parts.Add(ver.Revision); + + // Trim trailing zeros but keep at least major.minor + for (int i = parts.Count - 1; i > 1; i--) + { + if (parts[i] == 0) + parts.RemoveAt(i); + else + break; + } + + return string.Join('.', parts); + } + + return "0.0.0"; + } +} diff --git a/imagecatalog/GitVersion.README.md b/imagecatalog/GitVersion.README.md new file mode 100644 index 0000000..5e3aca3 --- /dev/null +++ b/imagecatalog/GitVersion.README.md @@ -0,0 +1,12 @@ +This project uses GitVersion (via `GitVersion.MsBuild`) to compute semantic version numbers during build. + +How it works: +- The `GitVersion.MsBuild` package runs during `dotnet build` and sets MSBuild properties such as `Version`, `AssemblyVersion`, `FileVersion`, and `InformationalVersion`. +- The repository is configured via `.gitversion.yml` at the repo root. Tags and branch names drive the generated semantic version. + +Usage notes: +- Create annotated tags like `v1.2.3` or `1.2.3` to mark releases. +- In CI, ensure the Git clone includes tags and history (no shallow single-commit clones). +- The UI should read `AssemblyInformationalVersion` for a friendly version string; fall back to `FileVersion` or `AssemblyName.Version` if needed. + +See https://gitversion.net for more configuration options. diff --git a/imagecatalog/ImageCatalog 2.csproj b/imagecatalog/ImageCatalog 2.csproj index e3cdec0..880dc53 100644 --- a/imagecatalog/ImageCatalog 2.csproj +++ b/imagecatalog/ImageCatalog 2.csproj @@ -43,6 +43,7 @@ + all diff --git a/imagecatalog/MainForm.cs b/imagecatalog/MainForm.cs index 43940cb..35f6658 100644 --- a/imagecatalog/MainForm.cs +++ b/imagecatalog/MainForm.cs @@ -32,7 +32,7 @@ public partial class MainForm private readonly PicSettings _picSettings; public MainForm(DataModel model, ImageCreationStuff imageCreationStuff, PicSettings picSettings, - ParametriSetup parametriSetup, ILogger logger) + ParametriSetup parametriSetup, ILogger logger, IVersionProvider versionProvider) { Model = model; _parametriSetup = parametriSetup; @@ -55,8 +55,8 @@ public partial class MainForm btnOpenSourceFolder.Click += BtnOpenSourceFolder_Click; btnOpenDestFolder.Click += BtnOpenDestFolder_Click; - var version = Assembly.GetExecutingAssembly().GetName().Version; - _Label27.Text = $"Version: {version.Major}.{version.Minor}.{version.Build}.{version.Revision}"; + var versionString = versionProvider?.GetVersionString() ?? "0.0.0"; + _Label27.Text = $"Version: {versionString}"; } protected void BindControls() diff --git a/imagecatalog/Program.cs b/imagecatalog/Program.cs index ea8f2aa..6bf6acd 100644 --- a/imagecatalog/Program.cs +++ b/imagecatalog/Program.cs @@ -15,7 +15,7 @@ static class Program { [DllImport("kernel32.dll", SetLastError = true)] private static extern bool AllocConsole(); - + [DllImport("kernel32.dll", SetLastError = true)] static extern IntPtr GetStdHandle(int nStdHandle); @@ -53,7 +53,7 @@ static class Program Console.SetOut(standardOutput); Console.SetError(standardOutput); } - + public static IServiceProvider ServiceProvider { get; private set; } [STAThread] static void Main() @@ -64,7 +64,7 @@ static class Program AllocConsole(); RedirectConsoleOutput(); - + var serviceCollection = new ServiceCollection(); ConfigureServices(serviceCollection); @@ -97,10 +97,13 @@ static class Program "ImageCatalog", "userprefs.xml"); services.AddSingleton(new ParametriSetup(userPrefsPath)); services.AddSingleton(); - + // Register your forms services.AddTransient(); + // Version provider for UI and logging + services.AddSingleton(); + services.AddLogging(configure => { configure.AddCustomFormatter(); @@ -110,40 +113,42 @@ static class Program } } -public static class ConsoleLoggerExtensions -{ - public static ILoggingBuilder AddCustomFormatter( - this ILoggingBuilder builder) => - builder.AddConsole(options => options.FormatterName = nameof(CustomLoggingFormatter)) - .AddConsoleFormatter(); -} -public sealed class CustomLoggingFormatter : ConsoleFormatter, IDisposable -{ - private readonly IDisposable _optionsReloadToken; - private ConsoleFormatterOptions _formatterOptions; - public CustomLoggingFormatter(IOptionsMonitor options) +public static class ConsoleLoggerExtensions +{ + public static ILoggingBuilder AddCustomFormatter( + this ILoggingBuilder builder) => + builder + .AddConsole(options => options.FormatterName = nameof(CustomLoggingFormatter)) + .AddConsoleFormatter() + .AddFilter("LuckyPennySoftware.AutoMapper.License", LogLevel.None); +} +public sealed class CustomLoggingFormatter : ConsoleFormatter, IDisposable +{ + private readonly IDisposable _optionsReloadToken; + private ConsoleFormatterOptions _formatterOptions; + public CustomLoggingFormatter(IOptionsMonitor options) // Case insensitive - : base(nameof(CustomLoggingFormatter)) => - (_optionsReloadToken, _formatterOptions) = - (options.OnChange(ReloadLoggerOptions), options.CurrentValue); - private void ReloadLoggerOptions(ConsoleFormatterOptions options) => - _formatterOptions = options; - - public override void Write( - in LogEntry logEntry, - IExternalScopeProvider scopeProvider, - TextWriter textWriter) - { - string? message = - logEntry.Formatter?.Invoke( - logEntry.State, logEntry.Exception); - - if (message is null) - { - return; - } - - textWriter.WriteLine($"{message}"); - } - public void Dispose() => _optionsReloadToken?.Dispose(); -} \ No newline at end of file + : base(nameof(CustomLoggingFormatter)) => + (_optionsReloadToken, _formatterOptions) = + (options.OnChange(ReloadLoggerOptions), options.CurrentValue); + private void ReloadLoggerOptions(ConsoleFormatterOptions options) => + _formatterOptions = options; + + public override void Write( + in LogEntry logEntry, + IExternalScopeProvider scopeProvider, + TextWriter textWriter) + { + string? message = + logEntry.Formatter?.Invoke( + logEntry.State, logEntry.Exception); + + if (message is null) + { + return; + } + + textWriter.WriteLine($"{message}"); + } + public void Dispose() => _optionsReloadToken?.Dispose(); +} \ No newline at end of file -- 2.52.0 From 69fdf01de3274b8346048479920fe3d0da3642b3 Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Sat, 14 Feb 2026 22:18:56 +0100 Subject: [PATCH 050/127] Modernize versioning and display in app and build output - Switch to explicit "3.2.0" next-version in GitVersion.yml - Update NuGet packages and set assembly name to "ImageCatalog" - Add MSBuild target to rename published exe with year and version - Add AppVersion property to DataModel, set via IVersionProvider - Replace static version label with data-bound versionLabel in UI - Remove manual version label logic from MainForm - Update DI to inject IVersionProvider into DataModel - Ensures UI always shows correct version and builds are versioned --- GitVersion.yml | 2 +- imagecatalog/DataModel.cs | 15 ++++++- imagecatalog/ImageCatalog 2.csproj | 69 +++++++++++++++++++++++++++--- imagecatalog/MainForm.Designer.cs | 22 +++++----- imagecatalog/MainForm.cs | 5 +-- imagecatalog/Program.cs | 14 +++++- 6 files changed, 106 insertions(+), 21 deletions(-) diff --git a/GitVersion.yml b/GitVersion.yml index 05c2cf9..a3baf60 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -4,4 +4,4 @@ branches: {} ignore: sha: [] merge-message-formats: {} -next-version: "3.2" \ No newline at end of file +next-version: "3.2.0" \ No newline at end of file diff --git a/imagecatalog/DataModel.cs b/imagecatalog/DataModel.cs index 080ef24..02c7b76 100644 --- a/imagecatalog/DataModel.cs +++ b/imagecatalog/DataModel.cs @@ -45,7 +45,7 @@ namespace ImageCatalog_2 public DataModel(ITestService testService, ISettingsService settingsService, ImageCreationStuff imageCreationService, PicSettings picSettings, - IMapper mapper, ILogger logger) + IMapper mapper, ILogger logger, MaddoShared.IVersionProvider? versionProvider = null) { _service = testService; _logger = logger; @@ -53,6 +53,8 @@ namespace ImageCatalog_2 _imageCreationService = imageCreationService; _picSettings = picSettings; _mapper = mapper; + // Populate AppVersion from version provider when available + AppVersion = versionProvider?.GetVersionString() ?? string.Empty; TestCommand = new RelayCommand(Test); AsyncTestCommand = new AsyncCommand(TestAsync); @@ -1123,6 +1125,17 @@ namespace ImageCatalog_2 { await _settingsService.LoadSettingsAsync(filePath, this); } + + private string _appVersion = string.Empty; + public string AppVersion + { + get => _appVersion; + set + { + _appVersion = value; + NotifyPropertyChanged(); + } + } } } diff --git a/imagecatalog/ImageCatalog 2.csproj b/imagecatalog/ImageCatalog 2.csproj index 880dc53..079d003 100644 --- a/imagecatalog/ImageCatalog 2.csproj +++ b/imagecatalog/ImageCatalog 2.csproj @@ -10,7 +10,8 @@ 3.1.2.0 3.1.2 3.1.2 - ImageCatalog2025 + + ImageCatalog default Logo.ico @@ -40,10 +41,10 @@ - - - - + + + + all @@ -61,4 +62,62 @@ + + + + + <_PublishYear>$([System.DateTime]::Now.ToString("yyyy")) + + <_Ver>$(FileVersion) + <_Ver Condition="'$(_Ver)' == ''">$(AssemblyVersion) + + + <_VerSanitized>$([System.String]::Copy('$(_Ver)')) + <_VerSanitized>$([System.String]::Copy('$(_VerSanitized)').Replace('+', '.')) + <_VerSanitized>$([System.String]::Copy('$(_VerSanitized)').Replace(' ', '_')) + + <_NewExeNameBase>ImageCatalog.$(_PublishYear).$(_VerSanitized) + + + + + + + <_Candidate1>$(PublishDir)$(TargetFileName) + <_Candidate2>$(PublishDir)$(TargetName)$(TargetExt) + <_Candidate3>$(PublishDir)$(TargetName).exe + <_Candidate4>$(PublishDir)$(AssemblyName)$(TargetExt) + <_Candidate5>$(PublishDir)$(AssemblyName).exe + + + + + <_CandidateFound>$(_Candidate1) + + + <_CandidateFound>$(_Candidate2) + + + <_CandidateFound>$(_Candidate3) + + + <_CandidateFound>$(_Candidate4) + + + <_CandidateFound>$(_Candidate5) + + + + + <_FoundExt>$([System.IO.Path]::GetExtension('$(_CandidateFound)')) + <_DestExe>$(PublishDir)$(_NewExeNameBase)$(_FoundExt) + + + + + + + \ No newline at end of file diff --git a/imagecatalog/MainForm.Designer.cs b/imagecatalog/MainForm.Designer.cs index 0ee4e01..ed17967 100644 --- a/imagecatalog/MainForm.Designer.cs +++ b/imagecatalog/MainForm.Designer.cs @@ -171,7 +171,7 @@ namespace ImageCatalog Label29 = new Label(); Label30 = new Label(); PictureBox3 = new PictureBox(); - _Label27 = new Label(); + versionLabel = new Label(); _Button7 = new Button(); _Button5 = new Button(); Label20 = new Label(); @@ -1748,15 +1748,16 @@ namespace ImageCatalog PictureBox3.TabStop = false; PictureBox3.Visible = false; // - // _Label27 + // versionLabel // - _Label27.Location = new Point(1182, 873); - _Label27.Margin = new Padding(6, 0, 6, 0); - _Label27.Name = "_Label27"; - _Label27.Size = new Size(281, 47); - _Label27.TabIndex = 62; - _Label27.Text = "Versione 2.2 2021"; - _Label27.TextAlign = ContentAlignment.MiddleRight; + versionLabel.Location = new Point(1182, 873); + versionLabel.Margin = new Padding(6, 0, 6, 0); + versionLabel.Name = "versionLabel"; + versionLabel.Size = new Size(281, 47); + versionLabel.TabIndex = 62; + versionLabel.Text = "Versione 2.2 2021"; + versionLabel.TextAlign = ContentAlignment.MiddleRight; + versionLabel.DataBindings.Add(new Binding("Text", bindingSource1, "AppVersion", true)); // // _Button7 // @@ -1872,7 +1873,7 @@ namespace ImageCatalog Controls.Add(CheckBox22); Controls.Add(Label43); Controls.Add(TabControl1); - Controls.Add(_Label27); + Controls.Add(versionLabel); Controls.Add(_Button7); Controls.Add(_Button5); Controls.Add(Label20); @@ -1997,6 +1998,7 @@ namespace ImageCatalog internal Label Label41; internal TextBox TextBox31; internal TextBox TextBox30; + internal Label versionLabel; internal GroupBox GroupBox9; internal CheckBox CheckBox17; internal CheckBox CheckBox16; diff --git a/imagecatalog/MainForm.cs b/imagecatalog/MainForm.cs index 35f6658..d63af72 100644 --- a/imagecatalog/MainForm.cs +++ b/imagecatalog/MainForm.cs @@ -32,7 +32,7 @@ public partial class MainForm private readonly PicSettings _picSettings; public MainForm(DataModel model, ImageCreationStuff imageCreationStuff, PicSettings picSettings, - ParametriSetup parametriSetup, ILogger logger, IVersionProvider versionProvider) + ParametriSetup parametriSetup, ILogger logger) { Model = model; _parametriSetup = parametriSetup; @@ -55,8 +55,7 @@ public partial class MainForm btnOpenSourceFolder.Click += BtnOpenSourceFolder_Click; btnOpenDestFolder.Click += BtnOpenDestFolder_Click; - var versionString = versionProvider?.GetVersionString() ?? "0.0.0"; - _Label27.Text = $"Version: {versionString}"; + // Version label is data-bound to DataModel.AppVersion; DataModel is populated with the version via DI } protected void BindControls() diff --git a/imagecatalog/Program.cs b/imagecatalog/Program.cs index 6bf6acd..451afbd 100644 --- a/imagecatalog/Program.cs +++ b/imagecatalog/Program.cs @@ -87,7 +87,19 @@ static class Program services.AddTransient(); services.AddTransient(); - services.AddTransient(); + services.AddTransient(sp => + { + // Resolve optional version provider and pass to DataModel + var testService = sp.GetRequiredService(); + var settingsService = sp.GetRequiredService(); + var imageCreation = sp.GetRequiredService(); + var picSettings = sp.GetRequiredService(); + var mapper = sp.GetRequiredService(); + var logger = sp.GetRequiredService>(); + var versionProvider = sp.GetService(); + + return new DataModel(testService, settingsService, imageCreation, picSettings, mapper, logger, versionProvider); + }); services.AddTransient(); services.AddTransient(); -- 2.52.0 From a00ab074c4d056b825445ead53f1034bdc9a4d88 Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Sun, 15 Feb 2026 00:03:16 +0100 Subject: [PATCH 051/127] Prefer GitVersion values for assembly and publish versioning Enhance versioning by prioritizing GitVersion output for assembly, file, and informational versions. Add fallback MSBuild target to run GitVersion CLI in Visual Studio builds. Update publish rename logic to use FullSemVer and improve version normalization for artifact naming. --- imagecatalog/ImageCatalog 2.csproj | 32 ++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/imagecatalog/ImageCatalog 2.csproj b/imagecatalog/ImageCatalog 2.csproj index 079d003..e0acb4f 100644 --- a/imagecatalog/ImageCatalog 2.csproj +++ b/imagecatalog/ImageCatalog 2.csproj @@ -49,6 +49,17 @@ all + + + + + $(GitVersion_AssemblySemVer) + + $(GitVersion_FileVersion) + + $(GitVersion_FullSemVer) + True @@ -63,19 +74,32 @@ + + + + + + + + + <_PublishYear>$([System.DateTime]::Now.ToString("yyyy")) - - <_Ver>$(FileVersion) + + <_Ver Condition="'$(GitVersion_FullSemVer)' != ''">$(GitVersion_FullSemVer) + <_Ver Condition="'$(GitVersion_FullSemVer)' == ''">$(FileVersion) <_Ver Condition="'$(_Ver)' == ''">$(AssemblyVersion) - + <_VerSanitized>$([System.String]::Copy('$(_Ver)')) - <_VerSanitized>$([System.String]::Copy('$(_VerSanitized)').Replace('+', '.')) <_VerSanitized>$([System.String]::Copy('$(_VerSanitized)').Replace(' ', '_')) <_NewExeNameBase>ImageCatalog.$(_PublishYear).$(_VerSanitized) -- 2.52.0 From e48c0d266bf56f6547aab50eaa12d29fb790d0e0 Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Sun, 15 Feb 2026 00:14:04 +0100 Subject: [PATCH 052/127] Add IImageCreator abstraction and runtime provider selection Introduce IImageCreator interface for image creation, and update ImageCreatorSharp to implement it. Add ImageCreatorAlternate (adapter) and ImageCreatorMapper (runtime selector) classes. Extend PicSettings with ImageCreatorProvider to control backend selection. Update DI registrations and refactor ImageCreationStuff to depend on IImageCreator, enabling backend switching via configuration. --- MaddoShared/IImageCreator.cs | 9 +++++ MaddoShared/ImageCreationStuff.cs | 2 +- MaddoShared/ImageCreatorAlternate.cs | 25 ++++++++++++++ MaddoShared/ImageCreatorMapper.cs | 49 ++++++++++++++++++++++++++++ MaddoShared/ImageCreatorSharp.cs | 2 +- MaddoShared/PicSettings.cs | 2 ++ imagecatalog/Program.cs | 5 +++ 7 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 MaddoShared/IImageCreator.cs create mode 100644 MaddoShared/ImageCreatorAlternate.cs create mode 100644 MaddoShared/ImageCreatorMapper.cs diff --git a/MaddoShared/IImageCreator.cs b/MaddoShared/IImageCreator.cs new file mode 100644 index 0000000..6fd85a5 --- /dev/null +++ b/MaddoShared/IImageCreator.cs @@ -0,0 +1,9 @@ +using System.Drawing; +using System.Threading.Tasks; + +namespace MaddoShared; + +public interface IImageCreator +{ + Task CreateImageAsync(ImageState imgState, Image logo); +} diff --git a/MaddoShared/ImageCreationStuff.cs b/MaddoShared/ImageCreationStuff.cs index 7aef4d4..b688f3a 100644 --- a/MaddoShared/ImageCreationStuff.cs +++ b/MaddoShared/ImageCreationStuff.cs @@ -18,7 +18,7 @@ namespace MaddoShared public class ImageCreationStuff( ILogger logger, PicSettings picSettings, - ImageCreatorSharp imageCreatorService) + IImageCreator imageCreatorService) { public class Options { diff --git a/MaddoShared/ImageCreatorAlternate.cs b/MaddoShared/ImageCreatorAlternate.cs new file mode 100644 index 0000000..2c945e8 --- /dev/null +++ b/MaddoShared/ImageCreatorAlternate.cs @@ -0,0 +1,25 @@ +using System.Drawing; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; + +namespace MaddoShared; + +// Minimal alternate adapter that currently delegates to ImageCreatorSharp. +// Later this can be replaced with a different library implementation. +public class ImageCreatorAlternate : IImageCreator +{ + private readonly ImageCreatorSharp _inner; + private readonly ILogger _logger; + + public ImageCreatorAlternate(ImageCreatorSharp inner, ILogger logger) + { + _inner = inner; + _logger = logger; + } + + public Task CreateImageAsync(ImageState imgState, Image logo) + { + _logger.LogDebug("Using alternate image creator adapter"); + return _inner.CreateImageAsync(imgState, logo); + } +} diff --git a/MaddoShared/ImageCreatorMapper.cs b/MaddoShared/ImageCreatorMapper.cs new file mode 100644 index 0000000..8ee07cf --- /dev/null +++ b/MaddoShared/ImageCreatorMapper.cs @@ -0,0 +1,49 @@ +using System; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; + +namespace MaddoShared; + +/// +/// Dynamically resolves the concrete IImageCreator implementation at call time +/// based on current PicSettings.ImageCreatorProvider. +/// +public class ImageCreatorMapper : IImageCreator +{ + private readonly IServiceProvider _sp; + private readonly PicSettings _settings; + private readonly ILogger _logger; + + public ImageCreatorMapper(IServiceProvider sp, PicSettings settings, ILogger logger) + { + _sp = sp ?? throw new ArgumentNullException(nameof(sp)); + _settings = settings ?? throw new ArgumentNullException(nameof(settings)); + _logger = logger; + } + + public Task CreateImageAsync(ImageState imgState, System.Drawing.Image logo) + { + var provider = (_settings.ImageCreatorProvider ?? "Sharp").Trim(); + _logger?.LogDebug("Resolving IImageCreator for provider '{Provider}'", provider); + + return provider.Equals("ALTERNATE", StringComparison.OrdinalIgnoreCase) + ? ResolveAndCall(imgState, logo) + : ResolveAndCall(imgState, logo); + } + + private Task ResolveAndCall(ImageState imgState, System.Drawing.Image logo) where T : IImageCreator + { + // Resolve the concrete implementation and forward the call + var impl = (IImageCreator)_sp.GetService(typeof(T)); + if (impl is null) + { + _logger?.LogWarning("Requested image creator {Type} is not registered. Falling back to ImageCreatorSharp.", typeof(T).Name); + impl = (IImageCreator)_sp.GetService(typeof(ImageCreatorSharp)); + } + + if (impl is null) + throw new InvalidOperationException("No IImageCreator implementation is registered."); + + return impl.CreateImageAsync(imgState, logo); + } +} diff --git a/MaddoShared/ImageCreatorSharp.cs b/MaddoShared/ImageCreatorSharp.cs index 0fdb25e..cfd54e2 100644 --- a/MaddoShared/ImageCreatorSharp.cs +++ b/MaddoShared/ImageCreatorSharp.cs @@ -15,7 +15,7 @@ using SixLabors.ImageSharp.Metadata.Profiles.Exif; namespace MaddoShared; [SuppressMessage("Interoperability", "CA1416:Validate platform compatibility")] -public class ImageCreatorSharp(PicSettings picSettings, ILogger logger) +public class ImageCreatorSharp(PicSettings picSettings, ILogger logger) : IImageCreator { public async Task CreateImageAsync(ImageState imgState, Image logo) { diff --git a/MaddoShared/PicSettings.cs b/MaddoShared/PicSettings.cs index 7472b63..d16cf5f 100644 --- a/MaddoShared/PicSettings.cs +++ b/MaddoShared/PicSettings.cs @@ -66,4 +66,6 @@ public class PicSettings public bool FotoRuotaASinistra { get; set; } = false; public string TempMinText { get; set; } = string.Empty; public bool OverwriteFiles { get; set; } = false; + // Which image creator to use: "Sharp" for current implementation, "Alternate" for alternate library + public string ImageCreatorProvider { get; set; } = "Sharp"; } \ No newline at end of file diff --git a/imagecatalog/Program.cs b/imagecatalog/Program.cs index 451afbd..c14bca6 100644 --- a/imagecatalog/Program.cs +++ b/imagecatalog/Program.cs @@ -103,6 +103,11 @@ static class Program services.AddTransient(); services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + + // Register IImageCreator to be resolved via ImageCreatorMapper which selects concrete implementation at call time + services.AddTransient(sp => sp.GetRequiredService()); // Register a ParametriSetup singleton that persists user preferences in LocalApplicationData var userPrefsPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), -- 2.52.0 From 63751af18da39c2a7055eb33d2ed858ea826d0c8 Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Sun, 15 Feb 2026 01:03:26 +0100 Subject: [PATCH 053/127] Add selectable image library option and refactor processing Introduce UI option to choose between System.Graphics and ImageSharp for image processing. Update DataModel and MainForm for robust binding and synchronization. Rewrite ImageCreatorAlternate to use ImageSharp for core operations and GDI+ for overlays. Remove test buttons, add radio group for library selection. Update project dependencies to support new features and modernize image handling. --- .../MaddoShared.Benchmarks.csproj | 4 +- MaddoShared.Tests/MaddoShared.Tests.csproj | 4 +- MaddoShared/ImageCreatorAlternate.cs | 294 +++++++++++++++++- MaddoShared/MaddoShared.csproj | 10 +- imagecatalog/DataModel.cs | 44 +++ imagecatalog/MainForm.Designer.cs | 75 +++-- imagecatalog/MainForm.cs | 105 ++++++- 7 files changed, 474 insertions(+), 62 deletions(-) diff --git a/MaddoShared.Benchmarks/MaddoShared.Benchmarks.csproj b/MaddoShared.Benchmarks/MaddoShared.Benchmarks.csproj index 99dc727..7ce2437 100644 --- a/MaddoShared.Benchmarks/MaddoShared.Benchmarks.csproj +++ b/MaddoShared.Benchmarks/MaddoShared.Benchmarks.csproj @@ -10,8 +10,8 @@ - - + + diff --git a/MaddoShared.Tests/MaddoShared.Tests.csproj b/MaddoShared.Tests/MaddoShared.Tests.csproj index 0b2620b..c4a7299 100644 --- a/MaddoShared.Tests/MaddoShared.Tests.csproj +++ b/MaddoShared.Tests/MaddoShared.Tests.csproj @@ -17,8 +17,8 @@ - - + + diff --git a/MaddoShared/ImageCreatorAlternate.cs b/MaddoShared/ImageCreatorAlternate.cs index 2c945e8..9ff74ec 100644 --- a/MaddoShared/ImageCreatorAlternate.cs +++ b/MaddoShared/ImageCreatorAlternate.cs @@ -1,25 +1,301 @@ -using System.Drawing; +using System; +using System.IO; using System.Threading.Tasks; +using System.Drawing; using Microsoft.Extensions.Logging; +using SixLabors.ImageSharp; +using SixLabors.ImageSharp.Formats.Jpeg; +using SixLabors.ImageSharp.Formats; +using SixLabors.ImageSharp.PixelFormats; +using SixLabors.ImageSharp.Processing; +using SixLabors.ImageSharp.Metadata.Profiles.Exif; +using System.Linq; +using System.Drawing.Imaging; namespace MaddoShared; -// Minimal alternate adapter that currently delegates to ImageCreatorSharp. -// Later this can be replaced with a different library implementation. +/// +/// Image creator implemented using SixLabors.ImageSharp for core image operations. +/// This implementation focuses on loading, EXIF-orientation, resizing and saving. +/// It intentionally implements a minimal subset of the original functionality to +/// provide a safe and testable replacement. Additional features (text/logo drawing) +/// can be added later using ImageSharp.Drawing.Common and SixLabors.Fonts. +/// public class ImageCreatorAlternate : IImageCreator { - private readonly ImageCreatorSharp _inner; + private readonly PicSettings _picSettings; private readonly ILogger _logger; - public ImageCreatorAlternate(ImageCreatorSharp inner, ILogger logger) + public ImageCreatorAlternate(PicSettings picSettings, ILogger logger) { - _inner = inner; + _picSettings = picSettings ?? throw new ArgumentNullException(nameof(picSettings)); _logger = logger; } - public Task CreateImageAsync(ImageState imgState, Image logo) + public async Task CreateImageAsync(ImageState imgState, System.Drawing.Image logo) { - _logger.LogDebug("Using alternate image creator adapter"); - return _inner.CreateImageAsync(imgState, logo); + ArgumentNullException.ThrowIfNull(imgState); + + // Minimal preparation of names and settings normally done by ImageCreatorSharp.PrepareVariables + PrepareVariablesMinimal(imgState); + + try + { + _logger.LogInformation("[Alternate] Processing {File} -> {Dest}", imgState.WorkFile?.FullName, imgState.DestDir?.FullName); + + using var fs = File.OpenRead(imgState.WorkFile.FullName); + + // Load as Rgba32 for general operations + using var img = await SixLabors.ImageSharp.Image.LoadAsync(fs).ConfigureAwait(false); + + // Extract EXIF info (orientation and creation date) + ExtractExif(img, imgState); + + // Apply orientation + ApplyExifOrientation(img, imgState); + + // Determine output format + var forceJpg = _picSettings.UsaForzaJpg; + + // Compute big size + var bigSize = ComputeBigSize(img.Width, img.Height); + + // Resize big image if needed + using var imgBig = img.Clone(ctx => ctx.Resize(bigSize.Width, bigSize.Height)); + + // Ensure destination exists + imgState.DestDir?.Create(); + + var fileNameBig = System.IO.Path.Combine(imgState.DestDir.FullName, imgState.NomeFileBig); + + // Draw overlays (text/logo) onto big image via GDI+ and save + await DrawAndSaveWithGdiAsync(imgBig, fileNameBig, imgState, logo, _picSettings.JpegQuality, isThumbnail: false).ConfigureAwait(false); + + // Save big image with quality if JPEG + var extBig = System.IO.Path.GetExtension(imgState.NomeFileBig)?.ToLowerInvariant() ?? string.Empty; + var encoderBig = GetEncoderForExtension(extBig, _picSettings.JpegQuality); + await using (var outStream = System.IO.File.Open(fileNameBig, System.IO.FileMode.Create, System.IO.FileAccess.Write)) + { + await imgBig.SaveAsync(outStream, encoderBig, default).ConfigureAwait(false); + } + + // Create thumbnail if requested + if (_picSettings.CreaMiniature) + { + var smallSize = ComputeSmallSize(img.Width, img.Height); + using var imgSmall = img.Clone(ctx => ctx.Resize(smallSize.Width, smallSize.Height)); + + var fileNameSmall = System.IO.Path.Combine(imgState.DestDir.FullName, imgState.NomeFileSmall); + + // Draw overlays and save thumbnail via GDI+ + await DrawAndSaveWithGdiAsync(imgSmall, fileNameSmall, imgState, logo, _picSettings.JpegQualityMin, isThumbnail: true).ConfigureAwait(false); + } + } + catch (Exception ex) + { + _logger.LogError(ex, "[Alternate] Error processing image {File}", imgState.WorkFile?.Name); + throw; + } + } + + + + // Thumbnail overlays are rendered by the GDI+ pass in DrawAndSaveWithGdiAsync to match original rendering. + + private static SixLabors.ImageSharp.Formats.IImageEncoder GetEncoderForExtension(string ext, long quality) + { + quality = Math.Clamp(quality, 1, 100); + return ext switch + { + ".png" => new SixLabors.ImageSharp.Formats.Png.PngEncoder(), + ".gif" => new SixLabors.ImageSharp.Formats.Gif.GifEncoder(), + _ => new JpegEncoder { Quality = (int)quality }, + }; + } + + private async Task DrawAndSaveWithGdiAsync(Image imgSharp, string outputPath, ImageState imgState, System.Drawing.Image logo, long quality, bool isThumbnail) + { + // Convert ImageSharp image to System.Drawing.Bitmap via MemoryStream PNG to preserve alpha + await using var ms = new MemoryStream(); + await imgSharp.SaveAsPngAsync(ms).ConfigureAwait(false); + ms.Seek(0, SeekOrigin.Begin); + + using var bmp = new Bitmap(ms); + using var g = Graphics.FromImage(bmp); + g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; + + // Prepare text + var text = isThumbnail ? imgState.TestoFirmaPiccola : imgState.TestoFirma; + if (string.IsNullOrEmpty(text) && _picSettings.TestoNome) + text = imgState.NomeFileBig; + + if (!string.IsNullOrEmpty(text)) + { + var fontSize = isThumbnail ? imgState.DimensioneStandardMiniatura : imgState.DimensioneStandard; + using var font = new System.Drawing.Font(_picSettings.IlFont ?? "Arial", Math.Max(6, fontSize)); + using var shadowBrush = new SolidBrush(System.Drawing.Color.FromArgb(imgState.AlphaScelta, 0, 0, 0)); + using var textBrush = new SolidBrush(System.Drawing.Color.FromArgb(imgState.AlphaScelta, _picSettings.FontColoreRGB)); + + var sf = new StringFormat { Alignment = StringAlignment.Center }; + var x = bmp.Width / 2f; + var y = isThumbnail ? bmp.Height - fontSize - 4 : bmp.Height - fontSize - (_picSettings.Margine); + + g.DrawString(text, font, shadowBrush, new System.Drawing.PointF(x + 1, y + 1), sf); + g.DrawString(text, font, textBrush, new System.Drawing.PointF(x, y), sf); + } + + // Draw logo if provided + if (logo != null && _picSettings.LogoAggiungi && File.Exists(_picSettings.LogoNomeFile)) + { + try + { + var target = new System.Drawing.Size(_picSettings.LogoLarghezza, _picSettings.LogoAltezza); + using var logoResized = new Bitmap(logo, target.Width, target.Height); + + int xPos = _picSettings.LogoPosizioneH?.ToUpperInvariant() == "DESTRA" ? bmp.Width - target.Width - _picSettings.Margine : _picSettings.Margine; + int yPos = _picSettings.LogoPosizioneV?.ToUpperInvariant() == "BASSO" ? bmp.Height - target.Height - _picSettings.Margine : _picSettings.Margine; + + var cm = new System.Drawing.Imaging.ColorMatrix { Matrix33 = (float)Math.Clamp((int.TryParse(_picSettings.LogoTrasparenza, out var lt) ? lt : 100) / 100.0, 0.0, 1.0) }; + var ia = new System.Drawing.Imaging.ImageAttributes(); + ia.SetColorMatrix(cm, System.Drawing.Imaging.ColorMatrixFlag.Default, System.Drawing.Imaging.ColorAdjustType.Bitmap); + + g.DrawImage(logoResized, new System.Drawing.Rectangle(xPos, yPos, target.Width, target.Height), 0, 0, target.Width, target.Height, GraphicsUnit.Pixel, ia); + } + catch (Exception ex) + { + _logger.LogError(ex, "[Alternate] Error drawing logo in GDI pass"); + } + } + + // Ensure directory + var dir = System.IO.Path.GetDirectoryName(outputPath); + if (!string.IsNullOrEmpty(dir)) Directory.CreateDirectory(dir); + + // Save with requested quality using GDI encoder + var encoder = GetEncoder(ImageFormat.Jpeg); + var myEncoder = System.Drawing.Imaging.Encoder.Quality; + using var encoderParams = new System.Drawing.Imaging.EncoderParameters(1); + encoderParams.Param[0] = new System.Drawing.Imaging.EncoderParameter(myEncoder, quality); + bmp.Save(outputPath, encoder, encoderParams); + } + + private static ImageCodecInfo GetEncoder(System.Drawing.Imaging.ImageFormat format) + { + var codecs = ImageCodecInfo.GetImageDecoders(); + foreach (var codec in codecs) + { + if (codec.FormatID == format.Guid) return codec; + } + return null; + } + + private void PrepareVariablesMinimal(ImageState imgState) + { + imgState.NomeFileBig = imgState.WorkFile.Name; + imgState.NomeFileSmall = (_picSettings.Suffisso ?? string.Empty) + imgState.WorkFile.Name; + imgState.DimensioneStandard = _picSettings.DimStandard; + imgState.DimensioneStandardMiniatura = _picSettings.DimStandardMiniatura; + + // sanitize + imgState.NomeFileBig = SanitizeFileName(imgState.NomeFileBig); + imgState.NomeFileSmall = SanitizeFileName(imgState.NomeFileSmall); + } + + private static string SanitizeFileName(string fileName) + { + if (string.IsNullOrEmpty(fileName)) return fileName; + var invalid = System.IO.Path.GetInvalidFileNameChars(); + var sb = new System.Text.StringBuilder(fileName.Length); + foreach (var ch in fileName) + sb.Append(Array.IndexOf(invalid, ch) >= 0 ? '_' : ch); + return sb.ToString(); + } + + private void ExtractExif(Image img, ImageState imgState) + { + imgState.Orientation = Orientations.TopLeft; + imgState.CreationDate = null; + + var profile = img.Metadata?.ExifProfile; + if (profile is null) return; + + IExifValue rotation = null; + var found = profile.TryGetValue(ExifTag.Orientation, out rotation); + if (found && rotation != null) + { + imgState.Orientation = (Orientations)Convert.ToInt32(rotation.Value); + } + + IExifValue date = null; + var creationFound = profile.TryGetValue(ExifTag.DateTimeOriginal, out date); + if (creationFound && date != null) + { + if (DateTime.TryParseExact(date.Value, "yyyy:MM:dd HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out var cr)) + { + imgState.CreationDate = cr; + } + else + { + imgState.CreationDate = null; + } + } + else + { + imgState.CreationDate = null; + } + } + + private void ApplyExifOrientation(Image img, ImageState imgState) + { + // Common EXIF orientations: 1=TopLeft, 3=BottomRight (rotate 180), 6=RightTop (rotate 90 CW), 8=LeftBottom (rotate 270 CW) + switch (imgState.Orientation) + { + case Orientations.RightTop: // 6 + img.Mutate(x => x.Rotate(RotateMode.Rotate90)); + break; + case Orientations.BottomRight: // 3 + img.Mutate(x => x.Rotate(RotateMode.Rotate180)); + break; + case Orientations.LftBottom: // 8 + img.Mutate(x => x.Rotate(RotateMode.Rotate270)); + break; + default: + break; + } + } + + private System.Drawing.Size ComputeBigSize(int width, int height) + { + // If original large size option requested, return original + // otherwise compute based on width/height limits from settings + return width > height + ? CalculateThumbnailSize(width, height, _picSettings.LarghezzaBig, "Larghezza") + : CalculateThumbnailSize(width, height, _picSettings.AltezzaBig, "Altezza"); + } + + private System.Drawing.Size ComputeSmallSize(int width, int height) + { + return width > height + ? CalculateThumbnailSize(width, height, _picSettings.LarghezzaSmall, "Larghezza") + : CalculateThumbnailSize(width, height, _picSettings.AltezzaSmall, "Altezza"); + } + + // Helper to access PicSettings values via instance _picSettings + + private static System.Drawing.Size CalculateThumbnailSize(int currentwidth, int currentheight, int maxPixel, string tipoSize) + { + double tempMultiplier; + if (string.Equals(tipoSize, "Larghezza", StringComparison.OrdinalIgnoreCase)) + tempMultiplier = maxPixel / (double)currentwidth; + else if (string.Equals(tipoSize, "Altezza", StringComparison.OrdinalIgnoreCase)) + tempMultiplier = maxPixel / (double)currentheight; + else if (currentheight > currentwidth) + tempMultiplier = maxPixel / (double)currentheight; + else + tempMultiplier = maxPixel / (double)currentwidth; + + var newSize = new System.Drawing.Size(Convert.ToInt32(currentwidth * tempMultiplier), Convert.ToInt32(currentheight * tempMultiplier)); + return newSize; } } + diff --git a/MaddoShared/MaddoShared.csproj b/MaddoShared/MaddoShared.csproj index e95dcf4..2bd6b04 100644 --- a/MaddoShared/MaddoShared.csproj +++ b/MaddoShared/MaddoShared.csproj @@ -14,12 +14,14 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + - + + + - + @@ -27,6 +29,6 @@ all - + \ No newline at end of file diff --git a/imagecatalog/DataModel.cs b/imagecatalog/DataModel.cs index 02c7b76..d59cb07 100644 --- a/imagecatalog/DataModel.cs +++ b/imagecatalog/DataModel.cs @@ -397,6 +397,50 @@ namespace ImageCatalog_2 } } + // Image library selection (UI radio buttons bind to the boolean helpers) + private string _imageLibrary = "System.Graphics"; + + /// + /// The selected image processing library. Possible values: "System.Graphics" or "ImageSharp". + /// This value is mirrored into PicSettings.ImageCreatorProvider so the runtime mapper picks the implementation. + /// + public string ImageLibrary + { + get => _imageLibrary; + set + { + if (_imageLibrary == value) return; + _imageLibrary = value; + // Reflect selection into PicSettings so mapper can resolve at runtime + _picSettings.ImageCreatorProvider = string.Equals(value, "ImageSharp", StringComparison.OrdinalIgnoreCase) + ? "ALTERNATE" + : "Sharp"; + NotifyPropertyChanged(); + NotifyPropertyChanged(nameof(UseSystemGraphics)); + NotifyPropertyChanged(nameof(UseImageSharp)); + } + } + + public bool UseSystemGraphics + { + get => string.Equals(ImageLibrary, "System.Graphics", StringComparison.OrdinalIgnoreCase); + set + { + if (value) ImageLibrary = "System.Graphics"; + NotifyPropertyChanged(); + } + } + + public bool UseImageSharp + { + get => string.Equals(ImageLibrary, "ImageSharp", StringComparison.OrdinalIgnoreCase); + set + { + if (value) ImageLibrary = "ImageSharp"; + NotifyPropertyChanged(); + } + } + // Folder division settings private int _filesPerFolder = 99; public int FilesPerFolder diff --git a/imagecatalog/MainForm.Designer.cs b/imagecatalog/MainForm.Designer.cs index ed17967..5865046 100644 --- a/imagecatalog/MainForm.Designer.cs +++ b/imagecatalog/MainForm.Designer.cs @@ -45,8 +45,6 @@ namespace ImageCatalog Label43 = new Label(); TabControl1 = new TabControl(); TabPage5 = new TabPage(); - button1 = new Button(); - btnTest = new Button(); GroupBox11 = new GroupBox(); numericUpDown2 = new NumericUpDown(); numericUpDown1 = new NumericUpDown(); @@ -183,6 +181,9 @@ namespace ImageCatalog _btnCreaCatalogoAsync = new Button(); timer1 = new System.Windows.Forms.Timer(components); dataModelBindingSource1 = new BindingSource(components); + groupBox12 = new GroupBox(); + rdbLibrary1 = new RadioButton(); + rdbLibrary2 = new RadioButton(); ((System.ComponentModel.ISupportInitialize)bindingSource1).BeginInit(); ((System.ComponentModel.ISupportInitialize)dataModelBindingSource).BeginInit(); TabControl1.SuspendLayout(); @@ -211,6 +212,7 @@ namespace ImageCatalog ((System.ComponentModel.ISupportInitialize)_PictureBox1).BeginInit(); ((System.ComponentModel.ISupportInitialize)PictureBox3).BeginInit(); ((System.ComponentModel.ISupportInitialize)dataModelBindingSource1).BeginInit(); + groupBox12.SuspendLayout(); SuspendLayout(); // // ProgressBar1 @@ -270,8 +272,7 @@ namespace ImageCatalog // // TabPage5 // - TabPage5.Controls.Add(button1); - TabPage5.Controls.Add(btnTest); + TabPage5.Controls.Add(groupBox12); TabPage5.Controls.Add(GroupBox11); TabPage5.Controls.Add(GroupBox3); TabPage5.Controls.Add(GroupBox8); @@ -285,28 +286,6 @@ namespace ImageCatalog TabPage5.Text = "Generale"; TabPage5.UseVisualStyleBackColor = true; // - // button1 - // - button1.DataBindings.Add(new Binding("Command", bindingSource1, "AsyncTestCommand", true)); - button1.Location = new Point(751, 720); - button1.Margin = new Padding(5); - button1.Name = "button1"; - button1.Size = new Size(141, 43); - button1.TabIndex = 50; - button1.Text = "Test Async"; - button1.UseVisualStyleBackColor = true; - // - // btnTest - // - btnTest.DataBindings.Add(new Binding("Command", bindingSource1, "TestCommand", true)); - btnTest.Location = new Point(487, 708); - btnTest.Margin = new Padding(5); - btnTest.Name = "btnTest"; - btnTest.Size = new Size(141, 43); - btnTest.TabIndex = 49; - btnTest.Text = "Test"; - btnTest.UseVisualStyleBackColor = true; - // // GroupBox11 // GroupBox11.Controls.Add(numericUpDown2); @@ -1750,6 +1729,7 @@ namespace ImageCatalog // // versionLabel // + versionLabel.DataBindings.Add(new Binding("Text", bindingSource1, "AppVersion", true)); versionLabel.Location = new Point(1182, 873); versionLabel.Margin = new Padding(6, 0, 6, 0); versionLabel.Name = "versionLabel"; @@ -1757,7 +1737,6 @@ namespace ImageCatalog versionLabel.TabIndex = 62; versionLabel.Text = "Versione 2.2 2021"; versionLabel.TextAlign = ContentAlignment.MiddleRight; - versionLabel.DataBindings.Add(new Binding("Text", bindingSource1, "AppVersion", true)); // // _Button7 // @@ -1863,6 +1842,41 @@ namespace ImageCatalog // dataModelBindingSource1.DataSource = typeof(ImageCatalog_2.DataModel); // + // groupBox12 + // + groupBox12.Controls.Add(rdbLibrary2); + groupBox12.Controls.Add(rdbLibrary1); + groupBox12.Location = new Point(405, 625); + groupBox12.Name = "groupBox12"; + groupBox12.Size = new Size(350, 175); + groupBox12.TabIndex = 49; + groupBox12.TabStop = false; + groupBox12.Text = "Libreria Manipolazione Grafica"; + // + // rdbLibrary1 + // + rdbLibrary1.AutoSize = true; + rdbLibrary1.Location = new Point(12, 37); + rdbLibrary1.Name = "rdbLibrary1"; + rdbLibrary1.Size = new Size(188, 34); + rdbLibrary1.TabIndex = 0; + rdbLibrary1.TabStop = true; + rdbLibrary1.Text = "System.Graphics"; + rdbLibrary1.DataBindings.Add(new Binding("Checked", bindingSource1, "UseSystemGraphics", true, DataSourceUpdateMode.OnPropertyChanged)); + rdbLibrary1.UseVisualStyleBackColor = true; + // + // rdbLibrary2 + // + rdbLibrary2.AutoSize = true; + rdbLibrary2.Location = new Point(12, 77); + rdbLibrary2.Name = "rdbLibrary2"; + rdbLibrary2.Size = new Size(149, 34); + rdbLibrary2.TabIndex = 1; + rdbLibrary2.TabStop = true; + rdbLibrary2.Text = "ImageSharp"; + rdbLibrary2.DataBindings.Add(new Binding("Checked", bindingSource1, "UseImageSharp", true, DataSourceUpdateMode.OnPropertyChanged)); + rdbLibrary2.UseVisualStyleBackColor = true; + // // MainForm // AutoScaleDimensions = new SizeF(12F, 30F); @@ -1929,6 +1943,8 @@ namespace ImageCatalog ((System.ComponentModel.ISupportInitialize)_PictureBox1).EndInit(); ((System.ComponentModel.ISupportInitialize)PictureBox3).EndInit(); ((System.ComponentModel.ISupportInitialize)dataModelBindingSource1).EndInit(); + groupBox12.ResumeLayout(false); + groupBox12.PerformLayout(); ResumeLayout(false); PerformLayout(); } @@ -2275,12 +2291,13 @@ namespace ImageCatalog private BindingSource dataModelBindingSource; private BindingSource dataModelBindingSource1; private BindingSource bindingSource1; - private Button btnTest; - private Button button1; private NumericUpDown numericUpDown1; private NumericUpDown numericUpDown2; private Button btnOpenDestFolder; private Button btnOpenSourceFolder; + private GroupBox groupBox12; + private RadioButton rdbLibrary2; + private RadioButton rdbLibrary1; internal Button btnCreaCatalogoAsync { diff --git a/imagecatalog/MainForm.cs b/imagecatalog/MainForm.cs index d63af72..79574a4 100644 --- a/imagecatalog/MainForm.cs +++ b/imagecatalog/MainForm.cs @@ -18,7 +18,6 @@ using ImageCatalog_2.Commands; using ImageCatalog_2.Services; using MaddoShared; using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Logging; namespace ImageCatalog; @@ -30,6 +29,8 @@ public partial class MainForm private readonly ParametriSetup _parametriSetup; private readonly PicSettings _picSettings; + // Prevent re-entrant updates between UI events and model PropertyChanged handling + private bool _suppressRadioUpdates = false; public MainForm(DataModel model, ImageCreationStuff imageCreationStuff, PicSettings picSettings, ParametriSetup parametriSetup, ILogger logger) @@ -42,11 +43,44 @@ public partial class MainForm _logger.LogDebug("Start"); InitializeComponent(); - - // Set this form as the control for thread marshalling in the DataModel - Model.SetControl(this); - - BindControls(); + // Set this form as the control for thread marshalling in the DataModel + Model.SetControl(this); + + // Ensure the designer data bindings have a concrete DataSource immediately so + // that UI controls (radio buttons) reflect the ViewModel state and propagate + // user changes back to the ViewModel. + bindingSource1.DataSource = Model; + + BindControls(); + + // The designer originally bound the radio buttons to boolean helpers on the ViewModel. + // Those two separate bindings can fight with each other. Clear designer bindings and + // wire explicit Click handlers that update the single authoritative property + // `Model.ImageLibrary`. Also keep a PropertyChanged listener to reflect external + // changes back into the radio buttons. + rdbLibrary1.DataBindings.Clear(); + rdbLibrary2.DataBindings.Clear(); + + // Initialize radio state from model + rdbLibrary1.Checked = Model.UseSystemGraphics; + rdbLibrary2.Checked = Model.UseImageSharp; + + // Use Click handlers (not CheckedChanged) to avoid competing binding updates + rdbLibrary1.Click += (_, _) => + { + if (_suppressRadioUpdates) return; + if (Model.ImageLibrary != "System.Graphics") + Model.ImageLibrary = "System.Graphics"; + }; + rdbLibrary2.Click += (_, _) => + { + if (_suppressRadioUpdates) return; + if (Model.ImageLibrary != "ImageSharp") + Model.ImageLibrary = "ImageSharp"; + }; + + // Watch for model changes so we can reflect external updates + Model.PropertyChanged += Model_PropertyChanged; // Save user preferences on form close instead of immediately when dialogs are used this.FormClosing += MainForm_FormClosing; @@ -58,17 +92,56 @@ public partial class MainForm // Version label is data-bound to DataModel.AppVersion; DataModel is populated with the version via DI } - protected void BindControls() + private void RdbLibrary_CheckedChanged(object? sender, EventArgs e) { - // Bind buttons to ViewModel commands using command binding - _btnCreaCatalogoAsync.BindCommand(Model.ProcessImagesCommand); - button1.BindCommand(Model.ProcessImagesCommand); - _Button2.BindCommand(Model.SelectSourceFolderCommand); - _Button3.BindCommand(Model.SelectDestinationFolderCommand); - _Button4.BindCommand(Model.SelectLogoFileCommand); - _Button5.BindCommand(Model.SaveSettingsCommand); - _Button6.BindCommand(Model.LoadSettingsCommand); - _Button8.BindCommand(Model.SelectColorCommand); + // Keep behavior simple: when a radio button becomes checked, update the ViewModel + // so that the designer binding and PicSettings stay in sync. + if (sender is RadioButton rb && rb.Checked) + { + _logger?.LogDebug("Radio library changed: {RadioName}", rb.Name); + if (rb == rdbLibrary2) + { + Model.ImageLibrary = "ImageSharp"; + } + else if (rb == rdbLibrary1) + { + Model.ImageLibrary = "System.Graphics"; + } + } + } + + private void Model_PropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e) + { + if (e.PropertyName is null) return; + if (e.PropertyName == nameof(Model.ImageLibrary) || e.PropertyName == nameof(Model.UseImageSharp) || e.PropertyName == nameof(Model.UseSystemGraphics)) + { + _logger?.LogDebug("Model property changed: {Property} => ImageLibrary={ImageLibrary}, PicSettings.Provider={Provider}", e.PropertyName, Model.ImageLibrary, _picSettings.ImageCreatorProvider); + + // Reflect authoritative model value into the radio buttons in a thread-safe, re-entrancy-safe way + try + { + _suppressRadioUpdates = true; + rdbLibrary1.Checked = Model.UseSystemGraphics; + rdbLibrary2.Checked = Model.UseImageSharp; + } + finally + { + _suppressRadioUpdates = false; + } + } + } + + protected void BindControls() + { + // Bind buttons to ViewModel commands using command binding + _btnCreaCatalogoAsync.BindCommand(Model.ProcessImagesCommand); + // Note: `button1` control does not exist in the designer. Use the primary create button only. + _Button2.BindCommand(Model.SelectSourceFolderCommand); + _Button3.BindCommand(Model.SelectDestinationFolderCommand); + _Button4.BindCommand(Model.SelectLogoFileCommand); + _Button5.BindCommand(Model.SaveSettingsCommand); + _Button6.BindCommand(Model.LoadSettingsCommand); + _Button8.BindCommand(Model.SelectColorCommand); // Subscribe to ViewModel events for UI dialogs (these need UI context) Model.SelectSourceFolderRequested += OnSelectSourceFolderRequested; -- 2.52.0 From 8872080741e43cd2192125b4913957e46cce984b Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Sun, 15 Feb 2026 11:13:23 +0100 Subject: [PATCH 054/127] Add color-key transparency support for logo overlays - Allow users to select a transparent color for logo images (watermarks) via UI (checkbox, color picker, preview). - Apply color-key transparency in both System.Drawing and ImageSharp backends: specified color in logo is made fully transparent. - Persist transparency settings in PicSettings and SettingsDto; bind to DataModel and UI controls. - Update logo preview to reflect transparency in real time. - Add option to select image processing library (System.Drawing or ImageSharp) in UI and settings. - Fix bug in SettingsService parameter loading for int/double/DateTime. - Fully integrate color-key transparency into image processing and settings serialization. --- MaddoShared/ImageCreatorAlternate.cs | 355 +++++++++++++++++++---- MaddoShared/ImageCreatorSharp.cs | 37 ++- MaddoShared/PicSettings.cs | 16 + imagecatalog/DataModel.cs | 30 ++ imagecatalog/MainForm.Designer.cs | 169 ++++++----- imagecatalog/MainForm.cs | 264 ++++++++++++++++- imagecatalog/MainForm.resx | 3 + imagecatalog/Models/SettingsDto.cs | 14 + imagecatalog/Services/SettingsService.cs | 6 +- 9 files changed, 729 insertions(+), 165 deletions(-) diff --git a/MaddoShared/ImageCreatorAlternate.cs b/MaddoShared/ImageCreatorAlternate.cs index 9ff74ec..8ddfbec 100644 --- a/MaddoShared/ImageCreatorAlternate.cs +++ b/MaddoShared/ImageCreatorAlternate.cs @@ -1,7 +1,7 @@ using System; using System.IO; using System.Threading.Tasks; -using System.Drawing; +// System.Drawing not required for ImageSharp-based drawing in this class using Microsoft.Extensions.Logging; using SixLabors.ImageSharp; using SixLabors.ImageSharp.Formats.Jpeg; @@ -10,7 +10,9 @@ using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing; using SixLabors.ImageSharp.Metadata.Profiles.Exif; using System.Linq; -using System.Drawing.Imaging; +using SixLabors.Fonts; +using SixLabors.ImageSharp.Drawing.Processing; +using SixLabors.ImageSharp.Drawing; namespace MaddoShared; @@ -68,17 +70,9 @@ public class ImageCreatorAlternate : IImageCreator var fileNameBig = System.IO.Path.Combine(imgState.DestDir.FullName, imgState.NomeFileBig); - // Draw overlays (text/logo) onto big image via GDI+ and save + // Draw overlays (text/logo) onto big image using ImageSharp and save await DrawAndSaveWithGdiAsync(imgBig, fileNameBig, imgState, logo, _picSettings.JpegQuality, isThumbnail: false).ConfigureAwait(false); - // Save big image with quality if JPEG - var extBig = System.IO.Path.GetExtension(imgState.NomeFileBig)?.ToLowerInvariant() ?? string.Empty; - var encoderBig = GetEncoderForExtension(extBig, _picSettings.JpegQuality); - await using (var outStream = System.IO.File.Open(fileNameBig, System.IO.FileMode.Create, System.IO.FileAccess.Write)) - { - await imgBig.SaveAsync(outStream, encoderBig, default).ConfigureAwait(false); - } - // Create thumbnail if requested if (_picSettings.CreaMiniature) { @@ -87,7 +81,7 @@ public class ImageCreatorAlternate : IImageCreator var fileNameSmall = System.IO.Path.Combine(imgState.DestDir.FullName, imgState.NomeFileSmall); - // Draw overlays and save thumbnail via GDI+ + // Draw overlays and save thumbnail via ImageSharp await DrawAndSaveWithGdiAsync(imgSmall, fileNameSmall, imgState, logo, _picSettings.JpegQualityMin, isThumbnail: true).ConfigureAwait(false); } } @@ -115,14 +109,28 @@ public class ImageCreatorAlternate : IImageCreator private async Task DrawAndSaveWithGdiAsync(Image imgSharp, string outputPath, ImageState imgState, System.Drawing.Image logo, long quality, bool isThumbnail) { - // Convert ImageSharp image to System.Drawing.Bitmap via MemoryStream PNG to preserve alpha - await using var ms = new MemoryStream(); - await imgSharp.SaveAsPngAsync(ms).ConfigureAwait(false); - ms.Seek(0, SeekOrigin.Begin); + // Use ImageSharp drawing APIs to render text and logos and save using ImageSharp encoders. + // Clone editable image so we don't mutate the original reference unexpectedly. + using var working = imgSharp.Clone(); - using var bmp = new Bitmap(ms); - using var g = Graphics.FromImage(bmp); - g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; + // Ensure DataFoto is set (extracted earlier) so time-based text is available + imgState.DataFoto = imgState.CreationDate ?? DateTime.Now; + + // Ensure thumbnail text is prepared similarly to ImageCreatorSharp logic + if (isThumbnail) + { + if (string.IsNullOrEmpty(imgState.TestoFirmaPiccola)) + { + if (_picSettings.TestoMin) + imgState.TestoFirmaPiccola = imgState.NomeFileBig; + else if (_picSettings.AggNumTempMin) + imgState.TestoFirmaPiccola = imgState.NomeFileBig + " "; + else if (_picSettings.UsaOrarioMiniatura) + imgState.TestoFirmaPiccola = imgState.DataFoto.ToShortTimeString(); + else + imgState.TestoFirmaPiccola ??= string.Empty; + } + } // Prepare text var text = isThumbnail ? imgState.TestoFirmaPiccola : imgState.TestoFirma; @@ -131,39 +139,251 @@ public class ImageCreatorAlternate : IImageCreator if (!string.IsNullOrEmpty(text)) { - var fontSize = isThumbnail ? imgState.DimensioneStandardMiniatura : imgState.DimensioneStandard; - using var font = new System.Drawing.Font(_picSettings.IlFont ?? "Arial", Math.Max(6, fontSize)); - using var shadowBrush = new SolidBrush(System.Drawing.Color.FromArgb(imgState.AlphaScelta, 0, 0, 0)); - using var textBrush = new SolidBrush(System.Drawing.Color.FromArgb(imgState.AlphaScelta, _picSettings.FontColoreRGB)); + // Choose target starting font size + var baseSize = isThumbnail ? imgState.DimensioneStandardMiniatura : imgState.DimensioneStandard; - var sf = new StringFormat { Alignment = StringAlignment.Center }; - var x = bmp.Width / 2f; - var y = isThumbnail ? bmp.Height - fontSize - 4 : bmp.Height - fontSize - (_picSettings.Margine); + // Create font with fallback + SixLabors.Fonts.Font font; + try + { + var fontName = _picSettings.IlFont ?? SixLabors.Fonts.SystemFonts.Collection.Families.First().Name; + font = SixLabors.Fonts.SystemFonts.CreateFont(fontName, Math.Max(6, baseSize)); + } + catch + { + font = SixLabors.Fonts.SystemFonts.CreateFont(SixLabors.Fonts.SystemFonts.Collection.Families.First().Name, Math.Max(6, baseSize)); + } - g.DrawString(text, font, shadowBrush, new System.Drawing.PointF(x + 1, y + 1), sf); - g.DrawString(text, font, textBrush, new System.Drawing.PointF(x, y), sf); + // Color with alpha + var textColor = SixLabors.ImageSharp.Color.Black; + try + { + var c = _picSettings.FontColoreRGB; + textColor = SixLabors.ImageSharp.Color.FromRgba(c.R, c.G, c.B, (byte)imgState.AlphaScelta); + } + catch + { + textColor = SixLabors.ImageSharp.Color.Black; + } + var shadowColor = SixLabors.ImageSharp.Color.FromRgba(0, 0, 0, (byte)imgState.AlphaScelta); + + // Find best font size so text fits image width (allow 95% width) and not exceed ~15% height + var maxTextWidth = working.Width * 0.95f; + var maxTextHeight = working.Height * 0.15f; + + var chosenSize = FindBestFontSize(text, font.Name, Math.Max(6, baseSize), maxTextWidth, maxTextHeight); + + // Use final font + var finalFont = SixLabors.Fonts.SystemFonts.CreateFont(font.Name, chosenSize); + if (!isThumbnail) imgState.DimensioneStandard = (int)Math.Round(chosenSize); + + // Approximate measured size since TextMeasurer/RendererOptions may not be available in this Fonts version + var approxWidth = finalFont.Size * text.Length * 0.6f; + var approxHeight = finalFont.Size * 1.0f; + + // Compute horizontal position based on alignment + float xCenterOfImg; + switch ((_picSettings.Allineamento ?? string.Empty).ToUpperInvariant()) + { + case "SINISTRA": + xCenterOfImg = Math.Min(_picSettings.Margine + (approxWidth / 2f), working.Width / 2f); + break; + case "DESTRA": + xCenterOfImg = Math.Max(working.Width - _picSettings.Margine - (approxWidth / 2f), working.Width / 2f); + break; + default: + xCenterOfImg = working.Width / 2f; + break; + } + + // Compute vertical position similar to ImageCreatorSharp behaviour + float originY; + var pos = (_picSettings.Posizione ?? string.Empty).ToUpperInvariant(); + if (pos == "ALTO") + { + originY = _picSettings.Margine; + } + else if (pos == "BASSO") + { + originY = (float)(working.Height - approxHeight - (working.Height * _picSettings.Margine / 100.0)); + } + else + { + originY = (working.Height - approxHeight) / 2f; + } + + // Compute origin X so the text is centered around xCenterOfImg + var originX = xCenterOfImg - approxWidth / 2f; + + // Clamp origin so text remains inside the image bounds + if (approxWidth > working.Width) + { + approxWidth = working.Width * 0.95f; + } + if (approxHeight > working.Height) + { + approxHeight = working.Height * 0.9f; + } + + originX = Math.Max(0, Math.Min(originX, working.Width - approxWidth)); + originY = Math.Max(0, Math.Min(originY, working.Height - approxHeight)); + + // Draw shadow then text + working.Mutate(ctx => + { + ctx.DrawText(text, finalFont, shadowColor, new SixLabors.ImageSharp.PointF(originX + 1, originY + 1)); + ctx.DrawText(text, finalFont, textColor, new SixLabors.ImageSharp.PointF(originX, originY)); + }); } // Draw logo if provided - if (logo != null && _picSettings.LogoAggiungi && File.Exists(_picSettings.LogoNomeFile)) + if (logo != null && _picSettings.LogoAggiungi) { try { - var target = new System.Drawing.Size(_picSettings.LogoLarghezza, _picSettings.LogoAltezza); - using var logoResized = new Bitmap(logo, target.Width, target.Height); + Image logoImg = null; - int xPos = _picSettings.LogoPosizioneH?.ToUpperInvariant() == "DESTRA" ? bmp.Width - target.Width - _picSettings.Margine : _picSettings.Margine; - int yPos = _picSettings.LogoPosizioneV?.ToUpperInvariant() == "BASSO" ? bmp.Height - target.Height - _picSettings.Margine : _picSettings.Margine; + // Prefer configured file if present, otherwise use the provided System.Drawing.Image instance + if (!string.IsNullOrEmpty(_picSettings.LogoNomeFile) && File.Exists(_picSettings.LogoNomeFile)) + { + using var logoStream = File.OpenRead(_picSettings.LogoNomeFile); + logoImg = await SixLabors.ImageSharp.Image.LoadAsync(logoStream).ConfigureAwait(false); + } + else + { + // Convert System.Drawing.Image to ImageSharp by saving to PNG in-memory to preserve alpha + await using var ms = new MemoryStream(); + logo.Save(ms, System.Drawing.Imaging.ImageFormat.Png); + ms.Seek(0, SeekOrigin.Begin); + logoImg = await SixLabors.ImageSharp.Image.LoadAsync(ms).ConfigureAwait(false); + } - var cm = new System.Drawing.Imaging.ColorMatrix { Matrix33 = (float)Math.Clamp((int.TryParse(_picSettings.LogoTrasparenza, out var lt) ? lt : 100) / 100.0, 0.0, 1.0) }; - var ia = new System.Drawing.Imaging.ImageAttributes(); - ia.SetColorMatrix(cm, System.Drawing.Imaging.ColorMatrixFlag.Default, System.Drawing.Imaging.ColorAdjustType.Bitmap); + var fotoLogoH = _picSettings.LogoAltezza; + var fotoLogoW = _picSettings.LogoLarghezza; - g.DrawImage(logoResized, new System.Drawing.Rectangle(xPos, yPos, target.Width, target.Height), 0, 0, target.Width, target.Height, GraphicsUnit.Pixel, ia); + // When rendering on thumbnails, limit logo size relative to the thumbnail dimensions + var effectiveMaxLogoWidth = fotoLogoW; + var effectiveMaxLogoHeight = fotoLogoH; + if (isThumbnail) + { + // Do not allow the logo to occupy more than ~30% of the thumbnail area + effectiveMaxLogoWidth = Math.Max(1, Math.Min(fotoLogoW, (int)(working.Width * 0.30))); + effectiveMaxLogoHeight = Math.Max(1, Math.Min(fotoLogoH, (int)(working.Height * 0.30))); + } + + // Compute new logo size preserving aspect ratio, but avoid upscaling the logo beyond its native size + var targetByWidth = CalculateThumbnailSize(logoImg.Width, logoImg.Height, effectiveMaxLogoWidth, "Larghezza"); + var targetByHeight = CalculateThumbnailSize(logoImg.Width, logoImg.Height, effectiveMaxLogoHeight, "Altezza"); + var nuovaSize = (targetByWidth.Width <= targetByHeight.Width) ? targetByWidth : targetByHeight; + + // Prevent upscaling: clamp to original logo size + if (nuovaSize.Width > logoImg.Width) nuovaSize.Width = logoImg.Width; + if (nuovaSize.Height > logoImg.Height) nuovaSize.Height = logoImg.Height; + + // Parse logo margin (may be percentage string like "10%") + var logoMargineStr = _picSettings.LogoMargine ?? string.Empty; + var inPercentualeL = logoMargineStr.Trim().EndsWith('%'); + var margineL = 0; + if (inPercentualeL) + { + var trimmed = logoMargineStr.Trim().TrimEnd('%'); + if (!int.TryParse(trimmed, out margineL)) margineL = 0; + } + else + { + if (!int.TryParse(logoMargineStr, out margineL)) margineL = 0; + } + var margineUsato = inPercentualeL ? Convert.ToInt32(working.Height * margineL / (double)100) : margineL; + + int xPosOfWm = 0; + int yPosOfWm = 0; + var logoH = (_picSettings.LogoPosizioneH ?? "NESSUNA").ToUpperInvariant(); + var logoV = (_picSettings.LogoPosizioneV ?? "NESSUNA").ToUpperInvariant(); + switch (logoH) + { + case "SINISTRA": + case "NESSUNA": + xPosOfWm = margineUsato; + break; + case "CENTRO": + xPosOfWm = Convert.ToInt32((working.Width - nuovaSize.Width) / (double)2); + break; + case "DESTRA": + xPosOfWm = ((working.Width - nuovaSize.Width) - margineUsato); + break; + } + + switch (logoV) + { + case "ALTO": + case "NESSUNA": + yPosOfWm = margineUsato; + break; + case "CENTRO": + yPosOfWm = Convert.ToInt32((working.Height - nuovaSize.Height) / (double)2); + break; + case "BASSO": + yPosOfWm = ((working.Height - nuovaSize.Height) - margineUsato); + break; + } + + var transparency = 1.0f; + if (int.TryParse(_picSettings.LogoTrasparenza, out var lt)) transparency = Math.Clamp(lt / 100f, 0f, 1f); + + // Resize logo to nuovaSize + logoImg.Mutate(x => x.Resize(nuovaSize.Width, nuovaSize.Height)); + + // If configured to use color-key transparency for non-PNG logos, replace the key color with transparent + if (_picSettings.UseTransparentColor && !string.IsNullOrEmpty(_picSettings.TransparentColor)) + { + try + { + var hex = _picSettings.TransparentColor.Trim(); + // Allow either #RRGGBB or RRGGBB + if (hex.StartsWith("#")) hex = hex.Substring(1); + if (hex.Length == 6) + { + var r = Convert.ToByte(hex.Substring(0, 2), 16); + var g = Convert.ToByte(hex.Substring(2, 2), 16); + var b = Convert.ToByte(hex.Substring(4, 2), 16); + var key = SixLabors.ImageSharp.Color.FromRgb(r, g, b); + + // Replace matching pixels (exact match) with transparent + logoImg.ProcessPixelRows(accessor => + { + for (int y = 0; y < accessor.Height; y++) + { + var row = accessor.GetRowSpan(y); + for (int x = 0; x < row.Length; x++) + { + var p = row[x]; + if (p.R == r && p.G == g && p.B == b) + { + row[x] = new Rgba32(p.R, p.G, p.B, 0); + } + } + } + }); + } + } + catch (Exception ex) + { + _logger.LogError(ex, "[Alternate] Invalid transparent color setting {Color}", _picSettings.TransparentColor); + } + } + + // Ensure logo position keeps it inside the canvas (avoid clipping) + xPosOfWm = Math.Max(0, Math.Min(xPosOfWm, working.Width - nuovaSize.Width)); + yPosOfWm = Math.Max(0, Math.Min(yPosOfWm, working.Height - nuovaSize.Height)); + + // Draw logo with opacity + working.Mutate(ctx => ctx.DrawImage(logoImg, new SixLabors.ImageSharp.Point(xPosOfWm, yPosOfWm), (float)transparency)); + + logoImg.Dispose(); } catch (Exception ex) { - _logger.LogError(ex, "[Alternate] Error drawing logo in GDI pass"); + _logger.LogError(ex, "[Alternate] Error drawing logo in ImageSharp pass"); } } @@ -171,23 +391,14 @@ public class ImageCreatorAlternate : IImageCreator var dir = System.IO.Path.GetDirectoryName(outputPath); if (!string.IsNullOrEmpty(dir)) Directory.CreateDirectory(dir); - // Save with requested quality using GDI encoder - var encoder = GetEncoder(ImageFormat.Jpeg); - var myEncoder = System.Drawing.Imaging.Encoder.Quality; - using var encoderParams = new System.Drawing.Imaging.EncoderParameters(1); - encoderParams.Param[0] = new System.Drawing.Imaging.EncoderParameter(myEncoder, quality); - bmp.Save(outputPath, encoder, encoderParams); + // Save with requested quality using ImageSharp encoder + var ext = System.IO.Path.GetExtension(outputPath)?.ToLowerInvariant() ?? string.Empty; + var encoder = GetEncoderForExtension(ext, quality); + await using var outStream = System.IO.File.Open(outputPath, System.IO.FileMode.Create, System.IO.FileAccess.Write); + await working.SaveAsync(outStream, encoder).ConfigureAwait(false); } - private static ImageCodecInfo GetEncoder(System.Drawing.Imaging.ImageFormat format) - { - var codecs = ImageCodecInfo.GetImageDecoders(); - foreach (var codec in codecs) - { - if (codec.FormatID == format.Guid) return codec; - } - return null; - } + // Removed GDI encoder helper; ImageSharp encoders are used instead. private void PrepareVariablesMinimal(ImageState imgState) { @@ -196,6 +407,16 @@ public class ImageCreatorAlternate : IImageCreator imgState.DimensioneStandard = _picSettings.DimStandard; imgState.DimensioneStandardMiniatura = _picSettings.DimStandardMiniatura; + // basic text / transparency defaults used by drawing routines + // AlphaScelta mirrors ImageCreatorSharp behavior: compute from PicSettings.Trasparenza (0-100) + imgState.AlphaScelta = Convert.ToInt32((255 * (100 - _picSettings.Trasparenza) / (double)100)); + + // Set minimal text fields so text drawing has fallback values + imgState.TestoFirma ??= _picSettings.TestoFirmaStart ?? string.Empty; + imgState.TestoFirmaPiccola ??= string.Empty; + imgState.DataPartenzaI = _picSettings.DataPartenza; + imgState.TestoOrario = _picSettings.TestoOrario ?? string.Empty; + // sanitize imgState.NomeFileBig = SanitizeFileName(imgState.NomeFileBig); imgState.NomeFileSmall = SanitizeFileName(imgState.NomeFileSmall); @@ -297,5 +518,33 @@ public class ImageCreatorAlternate : IImageCreator var newSize = new System.Drawing.Size(Convert.ToInt32(currentwidth * tempMultiplier), Convert.ToInt32(currentheight * tempMultiplier)); return newSize; } + + private static float FindBestFontSize(string text, string fontName, int maxSize, float maxWidth, float maxHeight, int minSize = 6) + { + if (maxSize <= minSize) return Math.Max(minSize, maxSize); + + int low = minSize; + int high = Math.Max(minSize, maxSize); + int best = minSize; + + while (low <= high) + { + int mid = (low + high) / 2; + // Approximate measurement: width ~ size * chars * 0.6, height ~ size + var approxWidth = mid * text.Length * 0.6f; + var approxHeight = mid * 1.0f; + if (approxWidth <= maxWidth && approxHeight <= maxHeight) + { + best = mid; + low = mid + 1; // try larger + } + else + { + high = mid - 1; // too big + } + } + + return best; + } } diff --git a/MaddoShared/ImageCreatorSharp.cs b/MaddoShared/ImageCreatorSharp.cs index cfd54e2..e7fc59a 100644 --- a/MaddoShared/ImageCreatorSharp.cs +++ b/MaddoShared/ImageCreatorSharp.cs @@ -486,22 +486,37 @@ public class ImageCreatorSharp(PicSettings picSettings, ILogger TransparentColorHex; + set => TransparentColorHex = value; + } + + public bool UseTransparentColor + { + get => UseTransparentColorKey; + set => UseTransparentColorKey = value; + } public bool FotoGrandeDimOrigina { get; set; } public int AltezzaBig { get; set; } public int LarghezzaBig { get; set; } diff --git a/imagecatalog/DataModel.cs b/imagecatalog/DataModel.cs index d59cb07..6d90981 100644 --- a/imagecatalog/DataModel.cs +++ b/imagecatalog/DataModel.cs @@ -30,6 +30,7 @@ namespace ImageCatalog_2 public ICommand SaveSettingsCommand { get; } public ICommand LoadSettingsCommand { get; } public ICommand SelectColorCommand { get; } + public ICommand SelectTransparentColorCommand { get; } private readonly ITestService _service; private readonly ILogger _logger; @@ -67,6 +68,7 @@ namespace ImageCatalog_2 SaveSettingsCommand = new RelayCommand(SaveSettings); LoadSettingsCommand = new RelayCommand(LoadSettings); SelectColorCommand = new RelayCommand(SelectColor); + SelectTransparentColorCommand = new RelayCommand(SelectTransparentColor); // Load available fonts AvailableFonts = LoadAvailableFonts(); @@ -341,6 +343,28 @@ namespace ImageCatalog_2 } } + private string _transparentColor = "#FFFFFF"; + public string TransparentColor + { + get => _transparentColor; + set + { + _transparentColor = value; + NotifyPropertyChanged(); + } + } + + private bool _useTransparentColor; + public bool UseTransparentColor + { + get => _useTransparentColor; + set + { + _useTransparentColor = value; + NotifyPropertyChanged(); + } + } + // Logo/Watermark settings private string _logoFile = ""; public string LogoFile @@ -1129,6 +1153,7 @@ namespace ImageCatalog_2 public event EventHandler SelectColorRequested; // Request that the View shows a message to the user (message, caption, icon) public event EventHandler> ShowMessageRequested; + public event EventHandler SelectTransparentColorRequested; private void SelectSourceFolder(object parameter) { @@ -1160,6 +1185,11 @@ namespace ImageCatalog_2 SelectColorRequested?.Invoke(this, EventArgs.Empty); } + private void SelectTransparentColor(object parameter) + { + SelectTransparentColorRequested?.Invoke(this, EventArgs.Empty); + } + public async Task SaveSettingsToFileAsync(string filePath) { await _settingsService.SaveSettingsAsync(filePath, this); diff --git a/imagecatalog/MainForm.Designer.cs b/imagecatalog/MainForm.Designer.cs index 5865046..edb3bb1 100644 --- a/imagecatalog/MainForm.Designer.cs +++ b/imagecatalog/MainForm.Designer.cs @@ -45,6 +45,9 @@ namespace ImageCatalog Label43 = new Label(); TabControl1 = new TabControl(); TabPage5 = new TabPage(); + groupBox12 = new GroupBox(); + rdbLibrary2 = new RadioButton(); + rdbLibrary1 = new RadioButton(); GroupBox11 = new GroupBox(); numericUpDown2 = new NumericUpDown(); numericUpDown1 = new NumericUpDown(); @@ -150,7 +153,6 @@ namespace ImageCatalog CheckBox1 = new CheckBox(); TabPage4 = new TabPage(); GroupBox6 = new GroupBox(); - PictureBox2 = new PictureBox(); _PictureBox1 = new PictureBox(); ComboBox5 = new ComboBox(); ComboBox4 = new ComboBox(); @@ -167,8 +169,6 @@ namespace ImageCatalog _Button4 = new Button(); TextBox10 = new TextBox(); Label29 = new Label(); - Label30 = new Label(); - PictureBox3 = new PictureBox(); versionLabel = new Label(); _Button7 = new Button(); _Button5 = new Button(); @@ -181,13 +181,15 @@ namespace ImageCatalog _btnCreaCatalogoAsync = new Button(); timer1 = new System.Windows.Forms.Timer(components); dataModelBindingSource1 = new BindingSource(components); - groupBox12 = new GroupBox(); - rdbLibrary1 = new RadioButton(); - rdbLibrary2 = new RadioButton(); + PictureBox3 = new PictureBox(); + colorDialog1 = new ColorDialog(); + btnSetTransparency = new Button(); + chkUseTransparentColor = new CheckBox(); ((System.ComponentModel.ISupportInitialize)bindingSource1).BeginInit(); ((System.ComponentModel.ISupportInitialize)dataModelBindingSource).BeginInit(); TabControl1.SuspendLayout(); TabPage5.SuspendLayout(); + groupBox12.SuspendLayout(); GroupBox11.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)numericUpDown2).BeginInit(); ((System.ComponentModel.ISupportInitialize)numericUpDown1).BeginInit(); @@ -208,11 +210,9 @@ namespace ImageCatalog Panel2.SuspendLayout(); TabPage4.SuspendLayout(); GroupBox6.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)PictureBox2).BeginInit(); ((System.ComponentModel.ISupportInitialize)_PictureBox1).BeginInit(); - ((System.ComponentModel.ISupportInitialize)PictureBox3).BeginInit(); ((System.ComponentModel.ISupportInitialize)dataModelBindingSource1).BeginInit(); - groupBox12.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)PictureBox3).BeginInit(); SuspendLayout(); // // ProgressBar1 @@ -286,6 +286,41 @@ namespace ImageCatalog TabPage5.Text = "Generale"; TabPage5.UseVisualStyleBackColor = true; // + // groupBox12 + // + groupBox12.Controls.Add(rdbLibrary2); + groupBox12.Controls.Add(rdbLibrary1); + groupBox12.Location = new Point(405, 625); + groupBox12.Name = "groupBox12"; + groupBox12.Size = new Size(350, 175); + groupBox12.TabIndex = 49; + groupBox12.TabStop = false; + groupBox12.Text = "Libreria Manipolazione Grafica"; + // + // rdbLibrary2 + // + rdbLibrary2.AutoSize = true; + rdbLibrary2.DataBindings.Add(new Binding("Checked", bindingSource1, "UseImageSharp", true, DataSourceUpdateMode.OnPropertyChanged)); + rdbLibrary2.Location = new Point(12, 77); + rdbLibrary2.Name = "rdbLibrary2"; + rdbLibrary2.Size = new Size(149, 34); + rdbLibrary2.TabIndex = 1; + rdbLibrary2.TabStop = true; + rdbLibrary2.Text = "ImageSharp"; + rdbLibrary2.UseVisualStyleBackColor = true; + // + // rdbLibrary1 + // + rdbLibrary1.AutoSize = true; + rdbLibrary1.DataBindings.Add(new Binding("Checked", bindingSource1, "UseSystemGraphics", true, DataSourceUpdateMode.OnPropertyChanged)); + rdbLibrary1.Location = new Point(12, 37); + rdbLibrary1.Name = "rdbLibrary1"; + rdbLibrary1.Size = new Size(188, 34); + rdbLibrary1.TabIndex = 0; + rdbLibrary1.TabStop = true; + rdbLibrary1.Text = "System.Graphics"; + rdbLibrary1.UseVisualStyleBackColor = true; + // // GroupBox11 // GroupBox11.Controls.Add(numericUpDown2); @@ -1491,7 +1526,8 @@ namespace ImageCatalog // // GroupBox6 // - GroupBox6.Controls.Add(PictureBox2); + GroupBox6.Controls.Add(chkUseTransparentColor); + GroupBox6.Controls.Add(btnSetTransparency); GroupBox6.Controls.Add(_PictureBox1); GroupBox6.Controls.Add(ComboBox5); GroupBox6.Controls.Add(ComboBox4); @@ -1508,29 +1544,17 @@ namespace ImageCatalog GroupBox6.Controls.Add(_Button4); GroupBox6.Controls.Add(TextBox10); GroupBox6.Controls.Add(Label29); - GroupBox6.Controls.Add(Label30); GroupBox6.Controls.Add(PictureBox3); GroupBox6.ForeColor = Color.FromArgb(0, 0, 192); GroupBox6.Location = new Point(12, 13); GroupBox6.Margin = new Padding(6, 8, 6, 8); GroupBox6.Name = "GroupBox6"; GroupBox6.Padding = new Padding(6, 8, 6, 8); - GroupBox6.Size = new Size(991, 518); + GroupBox6.Size = new Size(991, 593); GroupBox6.TabIndex = 42; GroupBox6.TabStop = false; GroupBox6.Text = "Logo"; // - // PictureBox2 - // - PictureBox2.BorderStyle = BorderStyle.FixedSingle; - PictureBox2.Location = new Point(288, 442); - PictureBox2.Margin = new Padding(6, 8, 6, 8); - PictureBox2.Name = "PictureBox2"; - PictureBox2.Size = new Size(45, 53); - PictureBox2.TabIndex = 44; - PictureBox2.TabStop = false; - PictureBox2.Visible = false; - // // _PictureBox1 // _PictureBox1.Cursor = Cursors.Cross; @@ -1575,7 +1599,7 @@ namespace ImageCatalog // Label28 // Label28.ForeColor = Color.Black; - Label28.Location = new Point(34, 223); + Label28.Location = new Point(38, 222); Label28.Margin = new Padding(6, 0, 6, 0); Label28.Name = "Label28"; Label28.Size = new Size(240, 38); @@ -1587,7 +1611,7 @@ namespace ImageCatalog // CheckBox5.DataBindings.Add(new Binding("Checked", bindingSource1, "AddLogo", true, DataSourceUpdateMode.OnPropertyChanged)); CheckBox5.ForeColor = Color.Black; - CheckBox5.Location = new Point(0, 60); + CheckBox5.Location = new Point(12, 56); CheckBox5.Margin = new Padding(6, 8, 6, 8); CheckBox5.Name = "CheckBox5"; CheckBox5.Size = new Size(144, 47); @@ -1618,7 +1642,7 @@ namespace ImageCatalog // Label25.AutoSize = true; Label25.ForeColor = Color.Black; - Label25.Location = new Point(34, 387); + Label25.Location = new Point(39, 390); Label25.Margin = new Padding(6, 0, 6, 0); Label25.Name = "Label25"; Label25.Size = new Size(183, 30); @@ -1695,7 +1719,7 @@ namespace ImageCatalog // Label29.AutoSize = true; Label29.ForeColor = Color.Black; - Label29.Location = new Point(34, 339); + Label29.Location = new Point(38, 341); Label29.Margin = new Padding(6, 0, 6, 0); Label29.Name = "Label29"; Label29.Size = new Size(208, 30); @@ -1703,30 +1727,6 @@ namespace ImageCatalog Label29.Text = "Posizione orizzontale"; Label29.TextAlign = ContentAlignment.MiddleLeft; // - // Label30 - // - Label30.AutoSize = true; - Label30.ForeColor = Color.Black; - Label30.Location = new Point(38, 468); - Label30.Margin = new Padding(6, 0, 6, 0); - Label30.Name = "Label30"; - Label30.Size = new Size(184, 30); - Label30.TabIndex = 36; - Label30.Text = "Colore trasparente"; - Label30.TextAlign = ContentAlignment.MiddleLeft; - Label30.Visible = false; - // - // PictureBox3 - // - PictureBox3.BorderStyle = BorderStyle.FixedSingle; - PictureBox3.Location = new Point(432, 442); - PictureBox3.Margin = new Padding(6, 8, 6, 8); - PictureBox3.Name = "PictureBox3"; - PictureBox3.Size = new Size(45, 53); - PictureBox3.TabIndex = 44; - PictureBox3.TabStop = false; - PictureBox3.Visible = false; - // // versionLabel // versionLabel.DataBindings.Add(new Binding("Text", bindingSource1, "AppVersion", true)); @@ -1842,40 +1842,35 @@ namespace ImageCatalog // dataModelBindingSource1.DataSource = typeof(ImageCatalog_2.DataModel); // - // groupBox12 + // PictureBox3 // - groupBox12.Controls.Add(rdbLibrary2); - groupBox12.Controls.Add(rdbLibrary1); - groupBox12.Location = new Point(405, 625); - groupBox12.Name = "groupBox12"; - groupBox12.Size = new Size(350, 175); - groupBox12.TabIndex = 49; - groupBox12.TabStop = false; - groupBox12.Text = "Libreria Manipolazione Grafica"; + PictureBox3.BorderStyle = BorderStyle.FixedSingle; + PictureBox3.Location = new Point(432, 442); + PictureBox3.Margin = new Padding(6, 8, 6, 8); + PictureBox3.Name = "PictureBox3"; + PictureBox3.Size = new Size(45, 53); + PictureBox3.TabIndex = 44; + PictureBox3.TabStop = false; + PictureBox3.Visible = false; // - // rdbLibrary1 + // btnSetTransparency // - rdbLibrary1.AutoSize = true; - rdbLibrary1.Location = new Point(12, 37); - rdbLibrary1.Name = "rdbLibrary1"; - rdbLibrary1.Size = new Size(188, 34); - rdbLibrary1.TabIndex = 0; - rdbLibrary1.TabStop = true; - rdbLibrary1.Text = "System.Graphics"; - rdbLibrary1.DataBindings.Add(new Binding("Checked", bindingSource1, "UseSystemGraphics", true, DataSourceUpdateMode.OnPropertyChanged)); - rdbLibrary1.UseVisualStyleBackColor = true; + btnSetTransparency.Location = new Point(288, 455); + btnSetTransparency.Name = "btnSetTransparency"; + btnSetTransparency.Size = new Size(131, 40); + btnSetTransparency.TabIndex = 45; + btnSetTransparency.Text = "Imposta"; + btnSetTransparency.UseVisualStyleBackColor = true; // - // rdbLibrary2 + // chkUseTransparentColor // - rdbLibrary2.AutoSize = true; - rdbLibrary2.Location = new Point(12, 77); - rdbLibrary2.Name = "rdbLibrary2"; - rdbLibrary2.Size = new Size(149, 34); - rdbLibrary2.TabIndex = 1; - rdbLibrary2.TabStop = true; - rdbLibrary2.Text = "ImageSharp"; - rdbLibrary2.DataBindings.Add(new Binding("Checked", bindingSource1, "UseImageSharp", true, DataSourceUpdateMode.OnPropertyChanged)); - rdbLibrary2.UseVisualStyleBackColor = true; + chkUseTransparentColor.AutoSize = true; + chkUseTransparentColor.Location = new Point(39, 461); + chkUseTransparentColor.Name = "chkUseTransparentColor"; + chkUseTransparentColor.Size = new Size(210, 34); + chkUseTransparentColor.TabIndex = 46; + chkUseTransparentColor.Text = "Colore trasparente"; + chkUseTransparentColor.UseVisualStyleBackColor = true; // // MainForm // @@ -1905,6 +1900,8 @@ namespace ImageCatalog ((System.ComponentModel.ISupportInitialize)dataModelBindingSource).EndInit(); TabControl1.ResumeLayout(false); TabPage5.ResumeLayout(false); + groupBox12.ResumeLayout(false); + groupBox12.PerformLayout(); GroupBox11.ResumeLayout(false); GroupBox11.PerformLayout(); ((System.ComponentModel.ISupportInitialize)numericUpDown2).EndInit(); @@ -1939,12 +1936,9 @@ namespace ImageCatalog TabPage4.ResumeLayout(false); GroupBox6.ResumeLayout(false); GroupBox6.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)PictureBox2).EndInit(); ((System.ComponentModel.ISupportInitialize)_PictureBox1).EndInit(); - ((System.ComponentModel.ISupportInitialize)PictureBox3).EndInit(); ((System.ComponentModel.ISupportInitialize)dataModelBindingSource1).EndInit(); - groupBox12.ResumeLayout(false); - groupBox12.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)PictureBox3).EndInit(); ResumeLayout(false); PerformLayout(); } @@ -2145,7 +2139,6 @@ namespace ImageCatalog internal CheckBox CheckBox1; internal TabPage TabPage4; internal GroupBox GroupBox6; - internal PictureBox PictureBox2; private PictureBox _PictureBox1; internal PictureBox PictureBox1 @@ -2194,8 +2187,6 @@ namespace ImageCatalog internal TextBox TextBox10; internal Label Label29; - internal Label Label30; - internal PictureBox PictureBox3; private Label _Label27; internal Label Label27 @@ -2298,6 +2289,10 @@ namespace ImageCatalog private GroupBox groupBox12; private RadioButton rdbLibrary2; private RadioButton rdbLibrary1; + internal PictureBox PictureBox3; + private ColorDialog colorDialog1; + private Button btnSetTransparency; + private CheckBox chkUseTransparentColor; internal Button btnCreaCatalogoAsync { diff --git a/imagecatalog/MainForm.cs b/imagecatalog/MainForm.cs index 79574a4..684a60c 100644 --- a/imagecatalog/MainForm.cs +++ b/imagecatalog/MainForm.cs @@ -31,6 +31,7 @@ public partial class MainForm private readonly PicSettings _picSettings; // Prevent re-entrant updates between UI events and model PropertyChanged handling private bool _suppressRadioUpdates = false; + private bool _transparentDialogOpen = false; public MainForm(DataModel model, ImageCreationStuff imageCreationStuff, PicSettings picSettings, ParametriSetup parametriSetup, ILogger logger) @@ -89,9 +90,14 @@ public partial class MainForm btnOpenSourceFolder.Click += BtnOpenSourceFolder_Click; btnOpenDestFolder.Click += BtnOpenDestFolder_Click; + // Show currently selected color in small PictureBox3 + PictureBox3.BackColor = ColorTranslator.FromHtml(Model.TransparentColor); + // Version label is data-bound to DataModel.AppVersion; DataModel is populated with the version via DI } + + private void RdbLibrary_CheckedChanged(object? sender, EventArgs e) { // Keep behavior simple: when a radio button becomes checked, update the ViewModel @@ -142,6 +148,8 @@ public partial class MainForm _Button5.BindCommand(Model.SaveSettingsCommand); _Button6.BindCommand(Model.LoadSettingsCommand); _Button8.BindCommand(Model.SelectColorCommand); + // Bind the transparency chooser button/command + btnSetTransparency.BindCommand(Model.SelectTransparentColorCommand); // Subscribe to ViewModel events for UI dialogs (these need UI context) Model.SelectSourceFolderRequested += OnSelectSourceFolderRequested; @@ -150,10 +158,54 @@ public partial class MainForm Model.SaveSettingsRequested += OnSaveSettingsRequested; Model.LoadSettingsRequested += OnLoadSettingsRequested; Model.SelectColorRequested += OnSelectColorRequested; + Model.SelectTransparentColorRequested += OnSelectTransparentColorRequested; // Show message requests (from ViewModel validation) Model.ShowMessageRequested += OnShowMessageRequested; } + private void OnSelectTransparentColorRequested(object? sender, EventArgs e) + { + // Ensure UI thread + if (InvokeRequired) + { + Invoke(new Action(OnSelectTransparentColorRequested), sender, e as EventArgs ?? EventArgs.Empty); + return; + } + // Prevent re-entrancy: if the dialog is already open, ignore subsequent requests + if (_transparentDialogOpen) return; + + _transparentDialogOpen = true; + var dlg = new ColorDialog { AllowFullOpen = true }; + try + { + dlg.Color = ColorTranslator.FromHtml(Model.TransparentColor); + } + catch { } + try + { + if (dlg.ShowDialog() == DialogResult.OK) + { + Model.TransparentColor = ColorTranslator.ToHtml(dlg.Color); + PictureBox3.BackColor = dlg.Color; + + // Update preview if logo exists + if (!string.IsNullOrWhiteSpace(Model.LogoFile) && File.Exists(Model.LogoFile)) + { + UpdateLogoPictureBox(Model.LogoFile); + } + } + } + finally + { + _transparentDialogOpen = false; + } + } + + private void BtnSetTransparency_Click(object? sender, EventArgs e) + { + Model.SelectTransparentColorCommand.Execute(null); + } + private void OnShowMessageRequested(object? sender, Tuple args) { if (args is null) return; @@ -202,6 +254,64 @@ public partial class MainForm false, DataSourceUpdateMode.OnPropertyChanged)); Label10.DataBindings.Add(new Binding("Text", bindingSource1, nameof(Model.ProcessingStatus), false, DataSourceUpdateMode.OnPropertyChanged)); + + // Bind transparency model properties to UI + chkUseTransparentColor.DataBindings.Add(new Binding("Checked", bindingSource1, nameof(Model.UseTransparentColor), false, DataSourceUpdateMode.OnPropertyChanged)); + // Show currently selected color in PictureBox3 + PictureBox3.Visible = false; + if (!string.IsNullOrWhiteSpace(Model.TransparentColor)) + { + try + { + PictureBox3.BackColor = ColorTranslator.FromHtml(Model.TransparentColor); + PictureBox3.Visible = true; + } + catch + { + PictureBox3.Visible = false; + } + } + + // When logo file changes, update preview + Model.PropertyChanged += (s, e) => + { + if (e.PropertyName == nameof(Model.LogoFile) || e.PropertyName == nameof(Model.UseTransparentColor) || e.PropertyName == nameof(Model.TransparentColor)) + { + if (!string.IsNullOrWhiteSpace(Model.LogoFile) && System.IO.File.Exists(Model.LogoFile)) + { + UpdateLogoPictureBox(Model.LogoFile); + } + } + }; + + // Bind transparent color hex and show color in PictureBox3 + // Bind UseTransparentColor checkbox (designer control named CheckBox5 used for AddLogo earlier, add new binding control exists in designer) + // Use PictureBox3 to display color value + var colorBinding = new Binding("BackColor", bindingSource1, nameof(Model.TransparentColor), true, DataSourceUpdateMode.OnPropertyChanged); + colorBinding.Format += (s, e) => + { + try + { + e.Value = ColorTranslator.FromHtml(e.Value?.ToString() ?? "#FFFFFF"); + } + catch + { + e.Value = Color.White; + } + }; + PictureBox3.DataBindings.Add(colorBinding); + + // Bind checkbox for using color key transparency if such control exists (CheckBox5 was repurposed as AddLogo); create binding if available + try + { + // The designer has CheckBox5 for 'AddLogo'. We'll add a separate binding to a new control named CheckBoxUseTransparentColor if present. + var chk = this.Controls.Find("chkUseTransparentColor", true).FirstOrDefault() as CheckBox; + if (chk != null) + { + chk.DataBindings.Add(new Binding("Checked", bindingSource1, nameof(Model.UseTransparentColor), false, DataSourceUpdateMode.OnPropertyChanged)); + } + } + catch { } } @@ -212,6 +322,18 @@ public partial class MainForm SetDefaults(); _logger.LogInformation("Programma Avviato"); + // If settings were loaded before the form was shown, ensure the logo preview is updated + try + { + if (!string.IsNullOrWhiteSpace(Model.LogoFile) && File.Exists(Model.LogoFile)) + { + UpdateLogoPictureBox(Model.LogoFile); + } + } + catch (Exception ex) + { + _logger.LogDebug(ex, "Failed to load logo during form load"); + } } private string CalcTime(DateTime timeStart, DateTime timeStop, int numFoto) @@ -436,14 +558,50 @@ public partial class MainForm try { await Model.LoadSettingsFromFileAsync(openDialog.FileName); - + // Explicitly ensure UI is enabled after loading Model.UiEnabled = true; - - // Update logo preview if logo file exists - if (File.Exists(Model.LogoFile)) + + // If a logo path was stored in the settings, try to resolve and display it. + // The stored path may be absolute or relative to the settings file location. + try { - UpdateLogoPictureBox(Model.LogoFile); + var storedLogo = Model.LogoFile; + // Trim whitespace and surrounding quotes which may be present in saved settings + if (!string.IsNullOrWhiteSpace(storedLogo)) + { + storedLogo = storedLogo.Trim(); + storedLogo = storedLogo.Trim('"'); + } + if (!string.IsNullOrWhiteSpace(storedLogo)) + { + string resolved = storedLogo; + // If not rooted, try to resolve relative to the settings file folder + var settingsFolder = Path.GetDirectoryName(openDialog.FileName) ?? string.Empty; + if (!Path.IsPathRooted(resolved) && !string.IsNullOrWhiteSpace(settingsFolder)) + { + var candidate = Path.Combine(settingsFolder, resolved); + if (File.Exists(candidate)) resolved = candidate; + } + + // If rooted but file doesn't exist, try filename near settings file + if (!File.Exists(resolved) && !string.IsNullOrWhiteSpace(settingsFolder)) + { + var candidate2 = Path.Combine(settingsFolder, Path.GetFileName(resolved)); + if (File.Exists(candidate2)) resolved = candidate2; + } + + if (File.Exists(resolved)) + { + // Update the model so data-bound controls reflect the resolved absolute path + Model.LogoFile = resolved; + UpdateLogoPictureBox(resolved); + } + } + } + catch (Exception ex) + { + _logger.LogDebug(ex, "Error resolving logo path after loading settings"); } Text = "Image Catalog - " + Path.GetFileName(openDialog.FileName); @@ -519,17 +677,68 @@ public partial class MainForm { try { - PictureBox1.Image = Image.FromFile(logoPath); - if (PictureBox1.Image.Height >= PictureBox1.Image.Width) + // Load image via System.Drawing for preview so we can use MakeTransparent when requested + using var img = System.Drawing.Image.FromFile(logoPath); + + System.Drawing.Bitmap previewBmp; + // If using color-key transparency and a color is selected, apply MakeTransparent for preview + if (Model.UseTransparentColor && !string.IsNullOrWhiteSpace(Model.TransparentColor)) { - PictureBox1.Height = 160; - PictureBox1.Width = (int)(160 * PictureBox1.Image.Width / (double)PictureBox1.Image.Height); + try + { + var key = ColorTranslator.FromHtml(Model.TransparentColor); + previewBmp = new System.Drawing.Bitmap(img.Width, img.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb); + using (var g = System.Drawing.Graphics.FromImage(previewBmp)) + { + g.Clear(System.Drawing.Color.Transparent); + g.DrawImage(img, 0, 0, img.Width, img.Height); + } + // Apply exact color-key transparency + previewBmp.MakeTransparent(key); + PictureBox3.BackColor = key; + PictureBox3.Visible = true; + } + catch + { + previewBmp = new System.Drawing.Bitmap(img); + } } else { - PictureBox1.Width = 160; - PictureBox1.Height = (int)(160 * PictureBox1.Image.Height / (double)PictureBox1.Image.Width); + previewBmp = new System.Drawing.Bitmap(img); } + + // Resize preview to fit into PictureBox1 while preserving aspect ratio + // Resize preview to fit into PictureBox1 while preserving aspect ratio + var boxW = PictureBox1.ClientSize.Width > 0 ? PictureBox1.ClientSize.Width : 449; + var boxH = PictureBox1.ClientSize.Height > 0 ? PictureBox1.ClientSize.Height : 369; + var ratio = Math.Min((double)boxW / previewBmp.Width, (double)boxH / previewBmp.Height); + var destW = Math.Max(1, (int)(previewBmp.Width * ratio)); + var destH = Math.Max(1, (int)(previewBmp.Height * ratio)); + var scaled = new System.Drawing.Bitmap(destW, destH, System.Drawing.Imaging.PixelFormat.Format32bppArgb); + using (var g = System.Drawing.Graphics.FromImage(scaled)) + { + g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; + g.Clear(System.Drawing.Color.Transparent); + // Center the image in the PictureBox + var offsetX = Math.Max(0, (boxW - destW) / 2); + var offsetY = Math.Max(0, (boxH - destH) / 2); + using var canvas = new System.Drawing.Bitmap(boxW, boxH, System.Drawing.Imaging.PixelFormat.Format32bppArgb); + using (var cg = System.Drawing.Graphics.FromImage(canvas)) + { + cg.Clear(System.Drawing.Color.Transparent); + cg.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; + cg.DrawImage(previewBmp, offsetX, offsetY, destW, destH); + } + g.DrawImage(canvas, 0, 0); + } + + // Set PictureBox1 image (dispose previous) + var old = PictureBox1.Image; + PictureBox1.SizeMode = PictureBoxSizeMode.CenterImage; + PictureBox1.Image = scaled; + old?.Dispose(); + previewBmp.Dispose(); } catch { @@ -537,6 +746,39 @@ public partial class MainForm } } + private void UpdateLogoPreviewWithColorKey(string logoPath, Color keyColor) + { + try + { + using var img = (Bitmap)Image.FromFile(logoPath); + // Create ARGB copy + var bmp = new Bitmap(img.Width, img.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb); + using (var g = Graphics.FromImage(bmp)) + { + g.DrawImage(img, 0, 0, img.Width, img.Height); + } + + bmp.MakeTransparent(keyColor); + + // Resize to PictureBox1 size similar to previous logic + Bitmap finalBmp; + if (bmp.Height >= bmp.Width) + { + finalBmp = new Bitmap(bmp, new Size((int)(160 * bmp.Width / (double)bmp.Height), 160)); + } + else + { + finalBmp = new Bitmap(bmp, new Size(160, (int)(160 * bmp.Height / (double)bmp.Width))); + } + + PictureBox1.Image = finalBmp; + } + catch + { + // ignore preview failures + } + } + private void setLabel18Text(string text) { if (Label18.InvokeRequired) diff --git a/imagecatalog/MainForm.resx b/imagecatalog/MainForm.resx index a4e857a..fa95561 100644 --- a/imagecatalog/MainForm.resx +++ b/imagecatalog/MainForm.resx @@ -129,4 +129,7 @@ 349, 17 + + 802, 17 + \ No newline at end of file diff --git a/imagecatalog/Models/SettingsDto.cs b/imagecatalog/Models/SettingsDto.cs index 70896e0..e31eb2a 100644 --- a/imagecatalog/Models/SettingsDto.cs +++ b/imagecatalog/Models/SettingsDto.cs @@ -168,6 +168,20 @@ namespace ImageCatalog_2.Models [XmlElement("MarchioAggiungi")] public bool AddLogo { get; set; } + // Color-key transparency settings + [JsonPropertyName("TransparentColor")] + [XmlElement("ColoreTrasparente")] + public string TransparentColor { get; set; } = "#FFFFFF"; + + [JsonPropertyName("UseTransparentColor")] + [XmlElement("UsaColoreTrasparente")] + public bool UseTransparentColor { get; set; } = false; + + // Selected image processing library (e.g., "System.Graphics" or "ImageSharp") + [JsonPropertyName("ImageLibrary")] + [XmlElement("ImageLibrary")] + public string ImageLibrary { get; set; } = "System.Graphics"; + // Options [JsonPropertyName("ForceJpeg")] [XmlElement("GeneraleForzaJpg")] diff --git a/imagecatalog/Services/SettingsService.cs b/imagecatalog/Services/SettingsService.cs index 8a92333..272566f 100644 --- a/imagecatalog/Services/SettingsService.cs +++ b/imagecatalog/Services/SettingsService.cs @@ -85,15 +85,15 @@ namespace ImageCatalog_2.Services } else if (prop.PropertyType == typeof(int)) { - value = _parametriSetup.LeggiParametro(xmlName, (int)(prop.GetValue(loadedDto) ?? 0)); + value = fileParams.LeggiParametro(xmlName, (int)(prop.GetValue(loadedDto) ?? 0)); } else if (prop.PropertyType == typeof(double)) { - value = _parametriSetup.LeggiParametro(xmlName, (double)(prop.GetValue(loadedDto) ?? 0.0)); + value = fileParams.LeggiParametro(xmlName, (double)(prop.GetValue(loadedDto) ?? 0.0)); } else if (prop.PropertyType == typeof(DateTime)) { - var strValue = _parametriSetup.LeggiParametroString(xmlName); + var strValue = fileParams.LeggiParametroString(xmlName); if (DateTime.TryParse(strValue, out var dateValue)) { value = dateValue; -- 2.52.0 From 10cc574acb15f58fc78ddb79cb93cdead03da1f5 Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Sun, 15 Feb 2026 11:14:19 +0100 Subject: [PATCH 055/127] Add WPF UI alongside WinForms; improve cancellation logic Introduced MainWindow.xaml and code-behind for a modern WPF interface with tabbed settings. Enabled WPF in project file. Refactored startup to launch WPF or WinForms UI based on availability. Registered WPF MainWindow in DI. Improved DataModel cancellation to be synchronous and log exceptions. Minor logging and comment updates. App now supports both WPF and WinForms frontends. --- imagecatalog/DataModel.cs | 17 +- imagecatalog/ImageCatalog 2.csproj | 1 + imagecatalog/MainWindow.xaml | 244 +++++++++++++++++++++++++++++ imagecatalog/MainWindow.xaml.cs | 193 +++++++++++++++++++++++ imagecatalog/Program.cs | 35 ++++- 5 files changed, 482 insertions(+), 8 deletions(-) create mode 100644 imagecatalog/MainWindow.xaml create mode 100644 imagecatalog/MainWindow.xaml.cs diff --git a/imagecatalog/DataModel.cs b/imagecatalog/DataModel.cs index 6d90981..8091907 100644 --- a/imagecatalog/DataModel.cs +++ b/imagecatalog/DataModel.cs @@ -1132,13 +1132,26 @@ namespace ImageCatalog_2 { try { - await MainToken?.CancelAsync(); + var tokenSource = MainToken; + if (tokenSource is not null) + { + // Cancel synchronously and return to caller. Some CTSource implementations + // may provide async helpers but cancelling is immediate. + try + { + tokenSource.Cancel(); + } + catch (Exception ex) + { + _logger.LogWarning(ex, "Exception while cancelling token"); + } + } UiEnabled = true; } catch (Exception e) { - _logger.LogError(e.Message, "Error canceling the token"); + _logger.LogError(e, "Error canceling the token"); _logger.LogInformation("Ignora questo errore"); } } diff --git a/imagecatalog/ImageCatalog 2.csproj b/imagecatalog/ImageCatalog 2.csproj index e0acb4f..4563b31 100644 --- a/imagecatalog/ImageCatalog 2.csproj +++ b/imagecatalog/ImageCatalog 2.csproj @@ -5,6 +5,7 @@ enable enable true + true False 3.1.2.0 3.1.2.0 diff --git a/imagecatalog/MainWindow.xaml b/imagecatalog/MainWindow.xaml new file mode 100644 index 0000000..b2bd652 --- /dev/null +++ b/imagecatalog/MainWindow.xaml @@ -0,0 +1,244 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -75,8 +100,18 @@ - + @@ -122,7 +157,13 @@ - + + + + + + + @@ -142,7 +183,12 @@ @@ -162,7 +208,13 @@ - + + + + + + + @@ -190,7 +242,13 @@ - + + + + + + + @@ -219,12 +277,23 @@ - + + + + + + + - @@ -250,7 +319,13 @@ - + + + + + + + @@ -266,8 +341,18 @@ - + @@ -280,8 +365,18 @@ - + @@ -301,10 +396,30 @@ - + + + -- 2.52.0 From 9007a27fb256b865331c99badfa73f6f71570c24 Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Sat, 21 Feb 2026 16:49:13 +0100 Subject: [PATCH 075/127] Upgrade UI to MahApps.Metro with runtime theming Modernize WPF UI using MahApps.Metro: switch MainWindow to MetroWindow, add MetroTabControl/MetroTabItem, custom tab styles, and icon-based theme toggle. Move version display to window commands. Integrate MahApps resource dictionaries and ThemeManager for runtime theme switching. Update startup logic for proper theming. WinForms fallback retained. --- imagecatalog/ImageCatalog 2.csproj | 1 + imagecatalog/MainWindow.xaml | 134 ++++++++++++++++++++--------- imagecatalog/MainWindow.xaml.cs | 83 +++++++++++++++++- imagecatalog/Program.cs | 43 +++++++-- 4 files changed, 207 insertions(+), 54 deletions(-) diff --git a/imagecatalog/ImageCatalog 2.csproj b/imagecatalog/ImageCatalog 2.csproj index e4573cc..cbd865d 100644 --- a/imagecatalog/ImageCatalog 2.csproj +++ b/imagecatalog/ImageCatalog 2.csproj @@ -42,6 +42,7 @@ + diff --git a/imagecatalog/MainWindow.xaml b/imagecatalog/MainWindow.xaml index d8fec54..b423b4c 100644 --- a/imagecatalog/MainWindow.xaml +++ b/imagecatalog/MainWindow.xaml @@ -1,15 +1,18 @@ - - + Title="Image Catalog - WPF" Height="540" Width="800" + Background="{DynamicResource WindowBackgroundBrush}" Foreground="{DynamicResource ControlForegroundBrush}" + GlowBrush="{DynamicResource AccentBrush}"> + + @@ -38,8 +41,49 @@ + + + - + + + + + + + + @@ -54,14 +98,14 @@ - - - + + + - + @@ -155,15 +199,15 @@ - + - - + + - + @@ -206,15 +250,15 @@ - + - - + + - + @@ -240,15 +284,15 @@ - + - - + + - + @@ -275,15 +319,15 @@ - + - - + + - + @@ -317,15 +361,15 @@ - + - - + + - + @@ -388,14 +432,22 @@ - - + + - - - - + + + + + + + + + + + + @@ -248,6 +243,17 @@ + + + + + + + + + + + @@ -271,8 +277,6 @@ - - @@ -296,6 +300,7 @@ + @@ -353,6 +358,12 @@ + -- 2.52.0 From d068b4b3e183d1fa38bddd611b0a28195d4da600 Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Sat, 21 Feb 2026 17:27:16 +0100 Subject: [PATCH 077/127] Support UI selection via --wpf command-line argument Refactored Program.cs to accept command-line arguments and select between WinForms (default) and WPF UI based on the presence of --wpf. Removed old commented-out UI selection code. Updated launchSettings.json to provide separate profiles for WinForms and WPF launches. If WPF is requested but unavailable, the app falls back to WinForms. --- imagecatalog/Program.cs | 40 ++++++++++----------- imagecatalog/Properties/launchSettings.json | 11 ++++-- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/imagecatalog/Program.cs b/imagecatalog/Program.cs index b32c760..ba559a4 100644 --- a/imagecatalog/Program.cs +++ b/imagecatalog/Program.cs @@ -57,7 +57,7 @@ static class Program public static IServiceProvider ServiceProvider { get; private set; } [STAThread] - static void Main() + static void Main(string[] args) { Application.SetHighDpiMode(HighDpiMode.SystemAware); Application.EnableVisualStyles(); @@ -74,21 +74,14 @@ static class Program // Resolve WPF MainWindow when available, otherwise fall back to WinForms MainForm var serviceProvider = ServiceProvider; - // NOTE: By default the app will attempt to run the WPF window when available and fall back - // to the WinForms MainForm. If you want to force the WinForms UI for testing, uncomment - // the block below and comment out the WPF branch. - // ----------------------------------------------------------------------------- - // // Force WinForms UI (uncomment to enable) - //var mainForm = serviceProvider.GetRequiredService(); - //// If you want to set the DataModel explicitly on the WinForms form use the lines below - //// var mainViewModel = serviceProvider.GetRequiredService(); - //// mainForm.Model = mainViewModel; - //Application.Run(mainForm); - // ----------------------------------------------------------------------------- + // Determine UI based on command line. Default: WinForms. Use --wpf to explicitly request WPF. + bool useWpf = args is not null && Array.Exists(args, a => string.Equals(a, "--wpf", StringComparison.OrdinalIgnoreCase)); - // Create the WPF Application and merge MahApps resources BEFORE constructing the MainWindow - // so InitializeComponent sees the theme resources on first render. - var wpfApp = new System.Windows.Application(); + if (useWpf) + { + // Create the WPF Application and merge MahApps resources BEFORE constructing the MainWindow + // so InitializeComponent sees the theme resources on first render. + var wpfApp = new System.Windows.Application(); try { wpfApp.Resources.MergedDictionaries.Add(new System.Windows.ResourceDictionary { Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml") }); @@ -111,15 +104,18 @@ static class Program // If resources fail to load (package not present at runtime), continue silently } - // Now resolve the WPF MainWindow so its constructor runs with the application resources available - var wpfMain = serviceProvider.GetService(typeof(ImageCatalog_2.MainWindow)) as ImageCatalog_2.MainWindow; - if (wpfMain is not null) - { - wpfApp.Run(wpfMain); - return; + // Now resolve the WPF MainWindow so its constructor runs with the application resources available + var wpfMain = serviceProvider.GetService(typeof(ImageCatalog_2.MainWindow)) as ImageCatalog_2.MainWindow; + if (wpfMain is not null) + { + wpfApp.Run(wpfMain); + return; + } + + // If WPF was requested but not available, fall back to WinForms. } - // Fallback to WinForms UI + // Default / fallback to WinForms UI var mainForm = serviceProvider.GetRequiredService(); System.Windows.Forms.Application.Run(mainForm); } diff --git a/imagecatalog/Properties/launchSettings.json b/imagecatalog/Properties/launchSettings.json index 641af8b..12da6a8 100644 --- a/imagecatalog/Properties/launchSettings.json +++ b/imagecatalog/Properties/launchSettings.json @@ -1,7 +1,12 @@ { "profiles": { - "Profile 1": { - "commandName": "Project" + "ImageCatalog (WinForms)": { + "commandName": "Project", + "commandLineArgs": "" + }, + "ImageCatalog (WPF)": { + "commandName": "Project", + "commandLineArgs": "--wpf" } } -} \ No newline at end of file +} -- 2.52.0 From 900e8b6bf866f77cad8806d3df5260b3b6c15d4c Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Sat, 21 Feb 2026 19:03:02 +0100 Subject: [PATCH 078/127] Update CI configuration and assembly information; remove log file and add logo image --- .gitlab-ci.yml | 12 ++- MaddoLibrary | 1 - MaddoShared/Properties/AssemblyInfo.cs | 6 +- imagecatalog/AssemblyInfo.cs | 4 +- imagecatalog/Logo.png | Bin 0 -> 317 bytes log.txt | 135 ------------------------- 6 files changed, 12 insertions(+), 146 deletions(-) delete mode 160000 MaddoLibrary create mode 100644 imagecatalog/Logo.png delete mode 100644 log.txt diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a7ae755..fee2f0b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -88,7 +88,7 @@ build_windows: } artifacts: paths: - - "**/bin/$BUILD_CONFIG/net10.0-windows/**" + - "imagecatalog/bin/$BUILD_CONFIG/net10.0-windows/**" expire_in: 1 hour # Publish and create GitLab Release when building a tag. This job expects a Windows runner with PowerShell and curl available. @@ -112,7 +112,7 @@ publish_release: $dotnetExe = 'dotnet' } - & $dotnetExe publish "imagecatalog\ImageCatalog 2.csproj" -c $env:BUILD_CONFIG -r win-x64 --self-contained false -o publish + & $dotnetExe publish "imagecatalog\ImageCatalog 2.csproj" -c $env:BUILD_CONFIG -f net10.0-windows -r win-x64 --self-contained false /p:PublishSingleFile=true /p:PublishReadyToRun=true -o publish Write-Host "Published to $(pwd)\\publish" # Configure private NuGet source from GitLab Packages using CI_JOB_TOKEN @@ -130,8 +130,10 @@ publish_release: Write-Host 'No credentials available; skipping private NuGet source configuration.' } - # Find first file in publish folder - $file = Get-ChildItem -Path publish -File | Select-Object -First 1; Write-Host "Uploading $($file.FullName)" + # Find the produced EXE in publish folder (fallback to first file if no exe found) + $file = Get-ChildItem -Path publish -Filter *.exe -File | Select-Object -First 1 + if (-not $file) { $file = Get-ChildItem -Path publish -File | Select-Object -First 1 } + Write-Host "Uploading $($file.FullName)" # Upload to GitLab project uploads API to get a public URL for the artifact $uploadUrl = "$env:CI_API_V4_URL/projects/$env:CI_PROJECT_ID/uploads" $formData = "file=@$($file.FullName)" @@ -145,7 +147,7 @@ publish_release: } artifacts: paths: - - publish/* + - publish/*.exe expire_in: 1 day only: - tags diff --git a/MaddoLibrary b/MaddoLibrary deleted file mode 160000 index 5987cc2..0000000 --- a/MaddoLibrary +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 5987cc26521d839bf81bdaab19d101488294da19 diff --git a/MaddoShared/Properties/AssemblyInfo.cs b/MaddoShared/Properties/AssemblyInfo.cs index 52a601e..6af8d79 100644 --- a/MaddoShared/Properties/AssemblyInfo.cs +++ b/MaddoShared/Properties/AssemblyInfo.cs @@ -8,10 +8,10 @@ using System.Runtime.InteropServices; [assembly: AssemblyTitle("MaddoShared")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] +[assembly: AssemblyCompany("Maddo")] [assembly: AssemblyProduct("MaddoShared")] -[assembly: AssemblyCopyright("Copyright © 2021")] -[assembly: AssemblyTrademark("")] +[assembly: AssemblyCopyright("Copyright © 2021-2026")] +[assembly: AssemblyTrademark("Maddo")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible diff --git a/imagecatalog/AssemblyInfo.cs b/imagecatalog/AssemblyInfo.cs index 4767298..e5b467a 100644 --- a/imagecatalog/AssemblyInfo.cs +++ b/imagecatalog/AssemblyInfo.cs @@ -11,8 +11,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyDescription("")] -[assembly: AssemblyCopyright("(C) 2002-08")] -[assembly: AssemblyTrademark("")] +[assembly: AssemblyCopyright("(C) 2012-2026")] +[assembly: AssemblyTrademark("Maddo")] [assembly: CLSCompliant(true)] // The following GUID is for the ID of the typelib if this project is exposed to COM diff --git a/imagecatalog/Logo.png b/imagecatalog/Logo.png new file mode 100644 index 0000000000000000000000000000000000000000..849b093e8a89ad92d3546ec2edc2dbc6299bbd0b GIT binary patch literal 317 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|zI(bjhFJ6_ zryO9qal_(YvT%E2{Qf$FLpOAGh@3pTr!DkP;4ZPe$v1&=j}L2oe*f3KT(*t-!_7Z$ z%b40MxX+~3_#H{r=;H3!IP>+fc%DkNIc~|uIj1ApfS~Pvxa>o{Ht7$Ih7Av67YiR| zKgPf|ZSQ%Bd!|;2H~v(vGdO(y^Ryqa2go+uS}R)TGVSKi!Pg#doDB>D22WQ% Jmvv4FO#tBnf_ne} literal 0 HcmV?d00001 diff --git a/log.txt b/log.txt deleted file mode 100644 index aa7e6df..0000000 --- a/log.txt +++ /dev/null @@ -1,135 +0,0 @@ -2021-03-06 10:04:44.068 +01:00 [INF] MSBuild registered from C:\Program Files\dotnet\sdk\5.0.200\ -2021-03-06 10:04:44.120 +01:00 [INF] Registered 1 extensions: - Default extension -2021-03-06 10:04:50.740 +01:00 [INF] Initializing upgrade step Select an entrypoint -2021-03-06 10:05:37.931 +01:00 [INF] Applying upgrade step Select an entrypoint -2021-03-06 10:05:56.095 +01:00 [INF] Upgrade step Select an entrypoint applied successfully -2021-03-06 10:05:59.578 +01:00 [INF] Initializing upgrade step Select project to upgrade -2021-03-06 10:06:53.914 +01:00 [INF] Applying upgrade step Select project to upgrade -2021-03-06 10:07:00.961 +01:00 [INF] Upgrade step Select project to upgrade applied successfully -2021-03-06 10:07:03.582 +01:00 [INF] Initializing upgrade step Back up project -2021-03-06 10:07:22.200 +01:00 [INF] Applying upgrade step Back up project -2021-03-06 10:07:26.114 +01:00 [INF] Backing up H:\dev\vs\Catalog\MaddoShared to H:\dev\vs\Catalog\MaddoShared.backup -2021-03-06 10:07:31.549 +01:00 [INF] Project backed up to H:\dev\vs\Catalog\MaddoShared.backup -2021-03-06 10:07:31.550 +01:00 [INF] Upgrade step Back up project applied successfully -2021-03-06 10:07:40.695 +01:00 [INF] Initializing upgrade step Convert project file to SDK style -2021-03-06 10:07:40.696 +01:00 [FTL] Try-Convert not found. This tool depends on the Try-Convert CLI tool. Please ensure that Try-Convert is installed and that the correct location for the tool is specified (in configuration, for example). https://github.com/dotnet/try-convert -2021-03-06 10:09:23.887 +01:00 [INF] Applying upgrade step Convert project file to SDK style -2021-03-06 10:09:23.889 +01:00 [INF] Converting project file format with try-convert -2021-03-06 10:09:27.336 +01:00 [INF] [try-convert] Conversion complete! -2021-03-06 10:09:27.915 +01:00 [INF] Project file converted successfully! The project may require additional changes to build successfully against the new .NET target. -2021-03-06 10:09:30.087 +01:00 [INF] Upgrade step Convert project file to SDK style applied successfully -2021-03-06 10:09:36.050 +01:00 [INF] Initializing upgrade step Update TFM -2021-03-06 10:09:48.944 +01:00 [INF] Applying upgrade step Update TFM -2021-03-06 10:09:54.879 +01:00 [INF] Upgrade step Update TFM applied successfully -2021-03-06 10:10:10.865 +01:00 [INF] Initializing upgrade step Update NuGet packages -2021-03-06 10:10:12.295 +01:00 [INF] Marking package System.Reflection.Metadata for removal because it appears to be a transitive dependency -2021-03-06 10:10:13.789 +01:00 [INF] Reference to .NET Upgrade Assistant analyzer package (Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers, version 0.2.212405) needs added -2021-03-06 10:10:15.101 +01:00 [INF] Adding Microsoft.Windows.Compatibility 5.0.2 -2021-03-06 10:10:15.104 +01:00 [INF] Packages to be removed: -System.Reflection.Metadata, Version=5.0.0 -2021-03-06 10:10:15.105 +01:00 [INF] Packages to be addded: -Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers, Version=0.2.212405 -Microsoft.Windows.Compatibility, Version=5.0.2 -2021-03-06 10:10:18.926 +01:00 [INF] Applying upgrade step Update NuGet packages -2021-03-06 10:10:18.932 +01:00 [INF] Removing outdated package reference: System.Reflection.Metadata, Version=5.0.0 -2021-03-06 10:10:18.935 +01:00 [INF] Adding package reference: Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers, Version=0.2.212405 -2021-03-06 10:10:18.937 +01:00 [INF] Adding package reference: Microsoft.Windows.Compatibility, Version=5.0.2 -2021-03-06 10:10:24.287 +01:00 [INF] Marking package System.Data.DataSetExtensions for removal because it appears to be a transitive dependency -2021-03-06 10:10:24.292 +01:00 [INF] Marking package System.Numerics.Vectors for removal because it appears to be a transitive dependency -2021-03-06 10:10:24.706 +01:00 [INF] Removing outdated package reference: System.Data.DataSetExtensions, Version=4.5.0 -2021-03-06 10:10:24.707 +01:00 [INF] Removing outdated package reference: System.Numerics.Vectors, Version=4.5.0 -2021-03-06 10:10:27.413 +01:00 [INF] Upgrade step Update NuGet packages applied successfully -2021-03-06 10:10:36.907 +01:00 [INF] Initializing upgrade step Add template files -2021-03-06 10:10:36.924 +01:00 [INF] 0 expected template items needed -2021-03-06 10:10:36.926 +01:00 [INF] Initializing upgrade step Upgrade app config files -2021-03-06 10:10:36.944 +01:00 [INF] Found 0 app settings for upgrade: -2021-03-06 10:10:36.950 +01:00 [INF] 0 web page namespace imports need upgraded: -2021-03-06 10:10:36.951 +01:00 [INF] Initializing upgrade step Update C# source -2021-03-06 10:10:38.659 +01:00 [INF] Initializing upgrade step Move to next project -2021-03-06 10:10:43.824 +01:00 [INF] Applying upgrade step Move to next project -2021-03-06 10:10:43.825 +01:00 [INF] Upgrade step Move to next project applied successfully -2021-03-06 10:11:07.545 +01:00 [INF] Initializing upgrade step Select project to upgrade -2021-03-06 10:11:10.510 +01:00 [INF] Applying upgrade step Select project to upgrade -2021-03-06 10:11:14.382 +01:00 [INF] Upgrade step Select project to upgrade applied successfully -2021-03-06 10:11:17.877 +01:00 [INF] Initializing upgrade step Back up project -2021-03-06 10:11:21.030 +01:00 [INF] Applying upgrade step Back up project -2021-03-06 10:11:22.810 +01:00 [INF] Backing up H:\dev\vs\Catalog\imagecatalog to H:\dev\vs\Catalog\imagecatalog.backup -2021-03-06 10:11:37.349 +01:00 [INF] Project backed up to H:\dev\vs\Catalog\imagecatalog.backup -2021-03-06 10:11:37.350 +01:00 [INF] Upgrade step Back up project applied successfully -2021-03-06 10:11:47.584 +01:00 [INF] Initializing upgrade step Convert project file to SDK style -2021-03-06 10:11:49.609 +01:00 [INF] Applying upgrade step Convert project file to SDK style -2021-03-06 10:11:49.610 +01:00 [INF] Converting project file format with try-convert -2021-03-06 10:11:52.238 +01:00 [INF] [try-convert] Conversion complete! -2021-03-06 10:11:52.666 +01:00 [INF] Project file converted successfully! The project may require additional changes to build successfully against the new .NET target. -2021-03-06 10:11:55.581 +01:00 [INF] Upgrade step Convert project file to SDK style applied successfully -2021-03-06 10:12:00.489 +01:00 [INF] Initializing upgrade step Update TFM -2021-03-06 10:12:03.093 +01:00 [INF] Applying upgrade step Update TFM -2021-03-06 10:12:06.038 +01:00 [INF] Upgrade step Update TFM applied successfully -2021-03-06 10:12:10.906 +01:00 [INF] Initializing upgrade step Update NuGet packages -2021-03-06 10:12:12.592 +01:00 [INF] Marking package Ben.Demystifier for removal because it appears to be a transitive dependency -2021-03-06 10:12:12.607 +01:00 [INF] Marking package System.Buffers for removal because it appears to be a transitive dependency -2021-03-06 10:12:12.624 +01:00 [INF] Marking package System.Collections.Immutable for removal because it appears to be a transitive dependency -2021-03-06 10:12:12.628 +01:00 [INF] Marking package System.Memory for removal because it appears to be a transitive dependency -2021-03-06 10:12:12.630 +01:00 [INF] Marking package System.Numerics.Vectors for removal because it appears to be a transitive dependency -2021-03-06 10:12:12.633 +01:00 [INF] Marking package System.Reflection.Metadata for removal because it appears to be a transitive dependency -2021-03-06 10:12:12.637 +01:00 [INF] Marking package System.Runtime.CompilerServices.Unsafe for removal because it appears to be a transitive dependency -2021-03-06 10:12:12.640 +01:00 [INF] Marking package System.Threading.Tasks.Extensions for removal because it appears to be a transitive dependency -2021-03-06 10:12:14.097 +01:00 [INF] Reference to .NET Upgrade Assistant analyzer package (Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers, version 0.2.212405) needs added -2021-03-06 10:12:14.104 +01:00 [INF] Packages to be removed: -Ben.Demystifier, Version=0.3.0 -System.Buffers, Version=4.5.1 -System.Collections.Immutable, Version=5.0.0 -System.Memory, Version=4.5.4 -System.Numerics.Vectors, Version=4.5.0 -System.Reflection.Metadata, Version=5.0.0 -System.Runtime.CompilerServices.Unsafe, Version=5.0.0 -System.Threading.Tasks.Extensions, Version=4.5.4 -2021-03-06 10:12:14.104 +01:00 [INF] Packages to be addded: -Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers, Version=0.2.212405 -2021-03-06 10:12:16.572 +01:00 [INF] Applying upgrade step Update NuGet packages -2021-03-06 10:12:16.573 +01:00 [INF] Removing outdated package reference: Ben.Demystifier, Version=0.3.0 -2021-03-06 10:12:16.573 +01:00 [INF] Removing outdated package reference: System.Buffers, Version=4.5.1 -2021-03-06 10:12:16.574 +01:00 [INF] Removing outdated package reference: System.Collections.Immutable, Version=5.0.0 -2021-03-06 10:12:16.575 +01:00 [INF] Removing outdated package reference: System.Memory, Version=4.5.4 -2021-03-06 10:12:16.576 +01:00 [INF] Removing outdated package reference: System.Numerics.Vectors, Version=4.5.0 -2021-03-06 10:12:16.578 +01:00 [INF] Removing outdated package reference: System.Reflection.Metadata, Version=5.0.0 -2021-03-06 10:12:16.578 +01:00 [INF] Removing outdated package reference: System.Runtime.CompilerServices.Unsafe, Version=5.0.0 -2021-03-06 10:12:16.580 +01:00 [INF] Removing outdated package reference: System.Threading.Tasks.Extensions, Version=4.5.4 -2021-03-06 10:12:16.581 +01:00 [INF] Adding package reference: Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers, Version=0.2.212405 -2021-03-06 10:12:19.366 +01:00 [INF] Upgrade step Update NuGet packages applied successfully -2021-03-06 10:12:35.849 +01:00 [INF] Initializing upgrade step Add template files -2021-03-06 10:12:35.850 +01:00 [INF] 0 expected template items needed -2021-03-06 10:12:35.851 +01:00 [INF] Initializing upgrade step Upgrade app config files -2021-03-06 10:12:35.852 +01:00 [INF] Found 0 app settings for upgrade: -2021-03-06 10:12:35.853 +01:00 [INF] system.diagnostics is not supported in .NET 5. See https://github.com/dotnet/runtime/issues/23937 for details. For now, it will be disabled. -2021-03-06 10:12:35.854 +01:00 [INF] 0 web page namespace imports need upgraded: -2021-03-06 10:12:40.725 +01:00 [INF] Applying upgrade step Disable unsupported configuration sections -2021-03-06 10:12:40.727 +01:00 [INF] system.diagnostics is not supported in .NET 5. See https://github.com/dotnet/runtime/issues/23937 for details. For now, it will be disabled. -2021-03-06 10:12:40.730 +01:00 [INF] Configuration file H:\dev\vs\Catalog\imagecatalog\app.config has been updated -2021-03-06 10:12:40.737 +01:00 [INF] Upgrade step Disable unsupported configuration sections applied successfully -2021-03-06 10:12:40.739 +01:00 [INF] Applying upgrade step Upgrade app config files -2021-03-06 10:12:40.740 +01:00 [INF] Upgrade step Upgrade app config files applied successfully -2021-03-06 10:12:43.598 +01:00 [INF] Initializing upgrade step Update C# source -2021-03-06 10:12:44.173 +01:00 [INF] Initializing upgrade step Move to next project -2021-03-06 10:12:47.488 +01:00 [INF] Applying upgrade step Move to next project -2021-03-06 10:12:47.489 +01:00 [INF] Upgrade step Move to next project applied successfully -2021-03-06 10:12:48.833 +01:00 [INF] Initializing upgrade step Select project to upgrade -2021-03-06 10:12:50.361 +01:00 [INF] Applying upgrade step Select project to upgrade -2021-03-06 10:12:54.374 +01:00 [ERR] Unknown selection: '' -2021-03-06 10:13:02.205 +01:00 [ERR] Unknown selection: '' -2021-03-06 10:13:04.059 +01:00 [ERR] Unknown selection: 'exit' -2021-03-06 10:13:06.542 +01:00 [ERR] Unknown selection: '0' -2021-03-06 10:13:08.242 +01:00 [INF] Saving upgrade progress file at H:\dev\vs\Catalog\.upgrade-assistant -2021-03-06 10:13:13.625 +01:00 [INF] MSBuild registered from C:\Program Files\dotnet\sdk\5.0.200\ -2021-03-06 10:13:13.651 +01:00 [INF] Registered 1 extensions: - Default extension -2021-03-06 10:13:15.795 +01:00 [INF] Loading upgrade progress file at H:\dev\vs\Catalog\.upgrade-assistant -2021-03-06 10:13:17.819 +01:00 [INF] Initializing upgrade step Select project to upgrade -2021-03-06 10:13:29.438 +01:00 [INF] Skipping upgrade step Select project to upgrade -2021-03-06 10:13:29.440 +01:00 [INF] Upgrade step Select project to upgrade skipped -2021-03-06 10:13:31.325 +01:00 [INF] Initializing upgrade step Finalize Solution -2021-03-06 10:13:34.820 +01:00 [INF] Applying upgrade step Finalize Solution -2021-03-06 10:13:34.821 +01:00 [INF] Upgrade step Finalize Solution applied successfully -2021-03-06 10:13:36.563 +01:00 [INF] Upgrade has completed. Please review any changes. -2021-03-06 10:13:36.565 +01:00 [INF] Saving upgrade progress file at H:\dev\vs\Catalog\.upgrade-assistant -- 2.52.0 From f8d4687a9741db7a0c62b8500a50d3d5abc7d7af Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Sat, 21 Feb 2026 20:01:31 +0100 Subject: [PATCH 079/127] Refactor CI pipeline for GitLab: streamline publish_release job and improve artifact handling --- .gitlab-ci.yml | 91 ++++++++++++++++++++------------------------------ 1 file changed, 36 insertions(+), 55 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fee2f0b..452d9da 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -91,66 +91,47 @@ build_windows: - "imagecatalog/bin/$BUILD_CONFIG/net10.0-windows/**" expire_in: 1 hour -# Publish and create GitLab Release when building a tag. This job expects a Windows runner with PowerShell and curl available. +# Publish and create GitLab Release when building a tag. publish_release: stage: publish - tags: - - saas-windows-medium-amd64 + image: mcr.microsoft.com/dotnet/sdk:10.0 needs: - - build_windows - script: - - | - powershell -NoProfile -Command { - # Ensure .NET 10 SDK is available (install to user folder if missing) and use that dotnet for publish - $needsInstall = -not (dotnet --list-sdks 2>$null | Select-String '^10\.') - if ($needsInstall) { - Write-Host 'Installing .NET 10 SDK using dotnet-install.ps1' - Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile dotnet-install.ps1 -UseBasicParsing - .\dotnet-install.ps1 -Channel 10.0 -InstallDir $env:USERPROFILE\.dotnet - $dotnetExe = Join-Path $env:USERPROFILE '.dotnet\dotnet.exe' - } else { - $dotnetExe = 'dotnet' - } - - & $dotnetExe publish "imagecatalog\ImageCatalog 2.csproj" -c $env:BUILD_CONFIG -f net10.0-windows -r win-x64 --self-contained false /p:PublishSingleFile=true /p:PublishReadyToRun=true -o publish - Write-Host "Published to $(pwd)\\publish" - - # Configure private NuGet source from GitLab Packages using CI_JOB_TOKEN - # Fallback to repository variables NUGET_USERNAME/NUGET_PASSWORD for shared runners - $nugetUrl = 'https://gitlab.com/api/v4/projects/79509532/packages/nuget/index.json' - if ($env:CI_JOB_TOKEN) { - Write-Host 'Configuring private NuGet source Nuget-GitLab-AIFotoONLUS using CI_JOB_TOKEN...' - try { & $dotnetExe nuget remove source Nuget-GitLab-AIFotoONLUS } catch {} - & $dotnetExe nuget add source $nugetUrl --name Nuget-GitLab-AIFotoONLUS --username gitlab-ci-token --password $env:CI_JOB_TOKEN --store-password-in-clear-text - } elseif ($env:NUGET_USERNAME -and $env:NUGET_PASSWORD) { - Write-Host 'Configuring private NuGet source Nuget-GitLab-AIFotoONLUS using NUGET_USERNAME/NUGET_PASSWORD...' - try { & $dotnetExe nuget remove source Nuget-GitLab-AIFotoONLUS } catch {} - & $dotnetExe nuget add source $nugetUrl --name Nuget-GitLab-AIFotoONLUS --username $env:NUGET_USERNAME --password $env:NUGET_PASSWORD --store-password-in-clear-text - } else { - Write-Host 'No credentials available; skipping private NuGet source configuration.' - } - - # Find the produced EXE in publish folder (fallback to first file if no exe found) - $file = Get-ChildItem -Path publish -Filter *.exe -File | Select-Object -First 1 - if (-not $file) { $file = Get-ChildItem -Path publish -File | Select-Object -First 1 } - Write-Host "Uploading $($file.FullName)" - # Upload to GitLab project uploads API to get a public URL for the artifact - $uploadUrl = "$env:CI_API_V4_URL/projects/$env:CI_PROJECT_ID/uploads" - $formData = "file=@$($file.FullName)" - $uploadResp = curl --silent --show-error --header "JOB-TOKEN:$env:CI_JOB_TOKEN" --form $formData $uploadUrl - $uploadJson = $uploadResp | ConvertFrom-Json - $assetUrl = "$env:CI_SERVER_URL$($uploadJson.url)" - Write-Host "Uploaded asset url: $assetUrl" - # Create the release using uploads URL - $body = @{ name = $env:CI_COMMIT_TAG; tag_name = $env:CI_COMMIT_TAG; description = "Automated release from CI"; assets = @{ links = @(@{ name = "$($file.Name)"; url = $assetUrl }) } } | ConvertTo-Json -Depth 10 - Invoke-RestMethod -Method Post -Uri "$env:CI_API_V4_URL/projects/$env:CI_PROJECT_ID/releases" -Headers @{ "JOB-TOKEN" = $env:CI_JOB_TOKEN } -Body $body -ContentType "application/json" - } + - job: build_windows + artifacts: true + script: | + set -euo pipefail + dotnet --info + echo "Reading MinVer version from build artifacts" + # locate a minversion file produced by the build artifacts + minfile=$(find imagecatalog -type f -iname 'minversion' -print | head -n1 || true) + if [ -z "$minfile" ]; then minfile=$(find . -type f -iname 'minversion' -print | head -n1 || true); fi + if [ -z "$minfile" ]; then echo "No minversion file found in artifacts"; exit 1; fi + echo "Found minversion file: $minfile" + version=$(cat "$minfile" | tr -d '\r\n') + if [ -z "$version" ]; then echo "minversion was empty"; exit 1; fi + echo "Using version: $version" + # find the primary artifact to upload (prefer the executable or first file under the build output) + file=$(find imagecatalog/bin -type f \! -iname 'minversion' -print | head -n1 || true) + if [ -z "$file" ]; then file=$(find . -type f -name 'ImageCatalog.*' -print | head -n1 || true); fi + if [ -z "$file" ]; then echo "No artifact file found to attach"; exit 1; fi + echo "Uploading artifact: $file" + uploadResp=$(curl --silent --show-error --header "JOB-TOKEN:$CI_JOB_TOKEN" --form "file=@$file" "$CI_API_V4_URL/projects/$CI_PROJECT_ID/uploads") + assetPath=$(echo "$uploadResp" | sed -n 's/.*"url":"\([^\"]*\)".*/\1/p') + if [ -z "$assetPath" ]; then echo "Upload failed: $uploadResp"; exit 1; fi + assetUrl="$CI_SERVER_URL$assetPath" + echo "Uploaded asset url: $assetUrl" + basename=$(basename "$file") + # create release JSON using the exact minversion value as tag_name + cat > release.json < Date: Sat, 21 Feb 2026 20:11:46 +0100 Subject: [PATCH 080/127] Removed tags only from publish job --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 452d9da..e0ccef7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -129,8 +129,8 @@ publish_release: curl --silent --show-error --header "JOB-TOKEN:$CI_JOB_TOKEN" -X POST -H "Content-Type: application/json" --data @release.json "$CI_API_V4_URL/projects/$CI_PROJECT_ID/releases" artifacts: expire_in: 1 day - only: - - tags +# only: +# - tags # Notes for runner setup: The job now runs on the public .NET SDK image and downloads artifacts from the # `build_windows` job via `needs`. It reads the `minversion` file produced by the build artifacts and -- 2.52.0 From 335da52abfd73567a9daed2bb967963e270667ca Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Sun, 22 Feb 2026 00:57:23 +0100 Subject: [PATCH 081/127] Add minversion file generation to build output for downstream jobs --- .gitlab-ci.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e0ccef7..f13eb57 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -85,6 +85,23 @@ build_windows: } & $dotnetExe restore & $dotnetExe build "imagecatalog\ImageCatalog 2.csproj" -c $env:BUILD_CONFIG -v minimal + # Write a minversion file into the build output so downstream jobs can read the computed version. + try { + $outRoot = Join-Path -Path "imagecatalog\bin\$env:BUILD_CONFIG" -ChildPath '*' + # search under the build output for a file starting with ImageCatalog. + $built = Get-ChildItem -Path (Join-Path "imagecatalog\bin\$env:BUILD_CONFIG" '.') -Recurse -File -ErrorAction SilentlyContinue | Where-Object { $_.Name -like 'ImageCatalog.*' } | Select-Object -First 1 + if ($built) { + $base = [System.IO.Path]::GetFileNameWithoutExtension($built.Name) + $version = $base -replace '^ImageCatalog\.', '' + $minPath = Join-Path $built.DirectoryName 'minversion' + Write-Host "Writing minversion '$version' to $minPath" + Set-Content -Path $minPath -Value $version -Encoding UTF8 + } else { + Write-Host 'No ImageCatalog build artifact found to derive minversion from.' + } + } catch { + Write-Host "Failed to write minversion: $_" + } } artifacts: paths: -- 2.52.0 From 3a964bbbcf09cf6902dc2f3e242bcf88a3a9ceaf Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Sun, 22 Feb 2026 11:38:15 +0100 Subject: [PATCH 082/127] Refactor CI pipeline: replace minversion file generation with single-file publish for downstream jobs --- .gitlab-ci.yml | 48 ++++++++++++++++++++---------------------------- 1 file changed, 20 insertions(+), 28 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f13eb57..f257f27 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -85,52 +85,45 @@ build_windows: } & $dotnetExe restore & $dotnetExe build "imagecatalog\ImageCatalog 2.csproj" -c $env:BUILD_CONFIG -v minimal - # Write a minversion file into the build output so downstream jobs can read the computed version. + # Produce a single-file, ready-to-run publish so downstream jobs only need the EXE. try { - $outRoot = Join-Path -Path "imagecatalog\bin\$env:BUILD_CONFIG" -ChildPath '*' - # search under the build output for a file starting with ImageCatalog. - $built = Get-ChildItem -Path (Join-Path "imagecatalog\bin\$env:BUILD_CONFIG" '.') -Recurse -File -ErrorAction SilentlyContinue | Where-Object { $_.Name -like 'ImageCatalog.*' } | Select-Object -First 1 - if ($built) { - $base = [System.IO.Path]::GetFileNameWithoutExtension($built.Name) - $version = $base -replace '^ImageCatalog\.', '' - $minPath = Join-Path $built.DirectoryName 'minversion' - Write-Host "Writing minversion '$version' to $minPath" - Set-Content -Path $minPath -Value $version -Encoding UTF8 - } else { - Write-Host 'No ImageCatalog build artifact found to derive minversion from.' - } + & $dotnetExe publish "imagecatalog\ImageCatalog 2.csproj" -c $env:BUILD_CONFIG -r win-x64 --self-contained true -p:PublishSingleFile=true -p:PublishTrimmed=true -p:PublishReadyToRun=true -o "imagecatalog\bin\$env:BUILD_CONFIG\net10.0-windows\publish" -v minimal } catch { - Write-Host "Failed to write minversion: $_" + Write-Host "dotnet publish failed: $_" + throw } } artifacts: paths: - - "imagecatalog/bin/$BUILD_CONFIG/net10.0-windows/**" + - "imagecatalog/bin/$BUILD_CONFIG/net10.0-windows/publish/**" expire_in: 1 hour # Publish and create GitLab Release when building a tag. publish_release: stage: publish image: mcr.microsoft.com/dotnet/sdk:10.0 + variables: + GIT_DEPTH: 0 needs: - job: build_windows artifacts: true script: | set -euo pipefail dotnet --info - echo "Reading MinVer version from build artifacts" - # locate a minversion file produced by the build artifacts - minfile=$(find imagecatalog -type f -iname 'minversion' -print | head -n1 || true) - if [ -z "$minfile" ]; then minfile=$(find . -type f -iname 'minversion' -print | head -n1 || true); fi - if [ -z "$minfile" ]; then echo "No minversion file found in artifacts"; exit 1; fi - echo "Found minversion file: $minfile" - version=$(cat "$minfile" | tr -d '\r\n') - if [ -z "$version" ]; then echo "minversion was empty"; exit 1; fi + export PATH="$PATH:$HOME/.dotnet/tools" + echo "Installing minver-cli" + dotnet tool install --global minver-cli --version 7.0.0 + # Ensure we have full git history and tags for MinVer to compute an accurate version + git fetch --prune --unshallow || true + git fetch --tags || true + echo "Computing version with minver-cli" + version=$(minver 2>/dev/null | tail -n1 || true) + if [ -z "$version" ]; then echo "minver failed to produce a version"; exit 1; fi echo "Using version: $version" - # find the primary artifact to upload (prefer the executable or first file under the build output) - file=$(find imagecatalog/bin -type f \! -iname 'minversion' -print | head -n1 || true) - if [ -z "$file" ]; then file=$(find . -type f -name 'ImageCatalog.*' -print | head -n1 || true); fi - if [ -z "$file" ]; then echo "No artifact file found to attach"; exit 1; fi + # find the single-file exe from the publish output + file=$(find imagecatalog/bin -type f -iname '*.exe' -print | head -n1 || true) + if [ -z "$file" ]; then file=$(find imagecatalog -type f -iname '*.exe' -print | head -n1 || true); fi + if [ -z "$file" ]; then echo "No artifact EXE found to attach"; exit 1; fi echo "Uploading artifact: $file" uploadResp=$(curl --silent --show-error --header "JOB-TOKEN:$CI_JOB_TOKEN" --form "file=@$file" "$CI_API_V4_URL/projects/$CI_PROJECT_ID/uploads") assetPath=$(echo "$uploadResp" | sed -n 's/.*"url":"\([^\"]*\)".*/\1/p') @@ -138,7 +131,6 @@ publish_release: assetUrl="$CI_SERVER_URL$assetPath" echo "Uploaded asset url: $assetUrl" basename=$(basename "$file") - # create release JSON using the exact minversion value as tag_name cat > release.json < Date: Sun, 22 Feb 2026 11:48:32 +0100 Subject: [PATCH 083/127] Made trimmed false --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f257f27..fb87b2e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -87,7 +87,7 @@ build_windows: & $dotnetExe build "imagecatalog\ImageCatalog 2.csproj" -c $env:BUILD_CONFIG -v minimal # Produce a single-file, ready-to-run publish so downstream jobs only need the EXE. try { - & $dotnetExe publish "imagecatalog\ImageCatalog 2.csproj" -c $env:BUILD_CONFIG -r win-x64 --self-contained true -p:PublishSingleFile=true -p:PublishTrimmed=true -p:PublishReadyToRun=true -o "imagecatalog\bin\$env:BUILD_CONFIG\net10.0-windows\publish" -v minimal + & $dotnetExe publish "imagecatalog\ImageCatalog 2.csproj" -c $env:BUILD_CONFIG -r win-x64 --self-contained true -p:PublishSingleFile=true -p:PublishTrimmed=false -p:PublishReadyToRun=true -o "imagecatalog\bin\$env:BUILD_CONFIG\net10.0-windows\publish" -v minimal } catch { Write-Host "dotnet publish failed: $_" throw -- 2.52.0 From 3ae4da3e494fff81e189381902472553b56609dc Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Sun, 22 Feb 2026 14:51:44 +0100 Subject: [PATCH 084/127] Enhance publish_release job: export version and add release metadata for automated releases --- .gitlab-ci.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fb87b2e..050a0aa 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -120,6 +120,7 @@ publish_release: version=$(minver 2>/dev/null | tail -n1 || true) if [ -z "$version" ]; then echo "minver failed to produce a version"; exit 1; fi echo "Using version: $version" + export VERSION="$version" # find the single-file exe from the publish output file=$(find imagecatalog/bin -type f -iname '*.exe' -print | head -n1 || true) if [ -z "$file" ]; then file=$(find imagecatalog -type f -iname '*.exe' -print | head -n1 || true); fi @@ -131,13 +132,18 @@ publish_release: assetUrl="$CI_SERVER_URL$assetPath" echo "Uploaded asset url: $assetUrl" basename=$(basename "$file") - cat > release.json < Date: Thu, 26 Feb 2026 18:43:07 +0100 Subject: [PATCH 085/127] Add Avalonia UI frontend alongside WinForms and WPF Introduce Avalonia as a new cross-platform UI option, including new XAML and code-behind files for the application and main window. Update Program.cs to support a --avalonia launch argument and add corresponding launch profile. Integrate Avalonia NuGet packages and ensure DataModel supports UI-thread invocation for all frontends. All business logic and state are shared via DI, enabling consistent behavior across WinForms, WPF, and Avalonia. --- imagecatalog/AvaloniaApp.axaml | 8 + imagecatalog/AvaloniaApp.axaml.cs | 20 ++ imagecatalog/AvaloniaMainWindow.axaml | 317 ++++++++++++++++++++ imagecatalog/AvaloniaMainWindow.axaml.cs | 151 ++++++++++ imagecatalog/DataModel.cs | 12 +- imagecatalog/ImageCatalog 2.csproj | 4 + imagecatalog/Program.cs | 23 +- imagecatalog/Properties/launchSettings.json | 9 +- 8 files changed, 535 insertions(+), 9 deletions(-) create mode 100644 imagecatalog/AvaloniaApp.axaml create mode 100644 imagecatalog/AvaloniaApp.axaml.cs create mode 100644 imagecatalog/AvaloniaMainWindow.axaml create mode 100644 imagecatalog/AvaloniaMainWindow.axaml.cs diff --git a/imagecatalog/AvaloniaApp.axaml b/imagecatalog/AvaloniaApp.axaml new file mode 100644 index 0000000..8ce9be1 --- /dev/null +++ b/imagecatalog/AvaloniaApp.axaml @@ -0,0 +1,8 @@ + + + + + + diff --git a/imagecatalog/AvaloniaApp.axaml.cs b/imagecatalog/AvaloniaApp.axaml.cs new file mode 100644 index 0000000..9a14f4d --- /dev/null +++ b/imagecatalog/AvaloniaApp.axaml.cs @@ -0,0 +1,20 @@ +using Avalonia.Controls.ApplicationLifetimes; +using Avalonia.Markup.Xaml; +using Microsoft.Extensions.DependencyInjection; + +namespace ImageCatalog_2; + +public partial class AvaloniaApp : Avalonia.Application +{ + public override void Initialize() => AvaloniaXamlLoader.Load(this); + + public override void OnFrameworkInitializationCompleted() + { + if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) + { + var model = Program.ServiceProvider.GetRequiredService(); + desktop.MainWindow = new AvaloniaMainWindow(model); + } + base.OnFrameworkInitializationCompleted(); + } +} diff --git a/imagecatalog/AvaloniaMainWindow.axaml b/imagecatalog/AvaloniaMainWindow.axaml new file mode 100644 index 0000000..a16b949 --- /dev/null +++ b/imagecatalog/AvaloniaMainWindow.axaml @@ -0,0 +1,317 @@ + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/WPFCatalog/Controls/GeneralSettingsControl.xaml.cs b/WPFCatalog/Controls/GeneralSettingsControl.xaml.cs deleted file mode 100644 index af3e0aa..0000000 --- a/WPFCatalog/Controls/GeneralSettingsControl.xaml.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace WPFCatalog.Controls -{ - /// - /// Interaction logic for GeneralSettingsControl.xaml - /// - public partial class GeneralSettingsControl : UserControl - { - public GeneralSettingsControl() - { - InitializeComponent(); - } - } -} diff --git a/WPFCatalog/Controls/TextSettingsControl.xaml b/WPFCatalog/Controls/TextSettingsControl.xaml deleted file mode 100644 index 7d7ac19..0000000 --- a/WPFCatalog/Controls/TextSettingsControl.xaml +++ /dev/null @@ -1,168 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/WPFCatalog/Controls/TextSettingsControl.xaml.cs b/WPFCatalog/Controls/TextSettingsControl.xaml.cs deleted file mode 100644 index 2c29c51..0000000 --- a/WPFCatalog/Controls/TextSettingsControl.xaml.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace WPFCatalog.Controls -{ - /// - /// Interaction logic for TextSettingsControl.xaml - /// - public partial class TextSettingsControl : UserControl - { - public TextSettingsControl() - { - InitializeComponent(); - } - } -} diff --git a/WPFCatalog/Converters/FontFamilyStringConverter.cs b/WPFCatalog/Converters/FontFamilyStringConverter.cs deleted file mode 100644 index 66a103e..0000000 --- a/WPFCatalog/Converters/FontFamilyStringConverter.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Data; -using System.Windows.Media; - -namespace WPFCatalog -{ - public class FontFamilyStringConverter : IValueConverter - { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - FontFamily fontfamily = new FontFamily("Verdana"); - if (value != null) - { - fontfamily = new FontFamily(value.ToString()); - } - return fontfamily; - - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - throw new NotImplementedException(); - } - } -} diff --git a/WPFCatalog/Converters/MaddoColorConverter.cs b/WPFCatalog/Converters/MaddoColorConverter.cs deleted file mode 100644 index 2248484..0000000 --- a/WPFCatalog/Converters/MaddoColorConverter.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Diagnostics; -using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Data; -using System.Windows.Media; - -namespace WPFCatalog -{ - public class MaddoColorConverter : IValueConverter - { - private static readonly DependencyObject _dummy = new DependencyObject(); - - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - Color color = Colors.Black; - - if (value != null && value != DependencyProperty.UnsetValue && value is string && !String.IsNullOrWhiteSpace((string)value)) - { - string c = (string)value; - object convertedColor = null; - try - { - convertedColor = ColorConverter.ConvertFromString(c); - } - catch (Exception ex) - { - if (!DesignerProperties.GetIsInDesignMode(_dummy)) - { - throw new FormatException($"String {c} does not represent a valid color", ex); - } - } - if (convertedColor != null) - { - color = (Color)convertedColor; - } - } - - return color; - - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - if (value != null) - { - Color color = (Color)value; - Debug.WriteLine(color.ToString()); - return color.ToString(); - } - return string.Empty; - } - } -} diff --git a/WPFCatalog/Icons/camera-photo-5.png b/WPFCatalog/Icons/camera-photo-5.png deleted file mode 100644 index 1e54dea89239f7aecab3e55382432a57c6c60e54..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1231 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkEj_j@0&dJZ`)n?tl_D>YcrteH1n%v&r z_6D}Ly{R)T`VJp%U+u(U_=)Yn=RMi8mff8cWF)~OFv~$-WW{y$A1{yZestu=+3oSG z&-%`<+PkhrV8*hQ4ewnRUknIe7pLYMye{r1*HV%4X?dHU{>ck| zs(0@WS#7Fw`q{JI+3dR#C0qjge}50puz&x+!tD24v(58kk8ISvq@u{d^zUx|=RKci zEV-XtS~}Hxx}E&G32B;t>-d*GSbscw&PTgr*5=;!Ih!|bJNz+$VW-kr)vZyzZ`bDD zdOKmUiX>CfOy#944wp^VJktDE_l13#;i38c*D_eE=SXQ^&Zs#wS>6BV2j%{}<;_*M zMMau++<$!Y9pArWY%f0w28tA3$P_MhR$G2Mg#cHe}xXv-#y^E~XyA zxp~`9A3DSo931>4sOiiJqfXd0L&cpl=vk}N&X|36 zR#siFuT9OI5uz=6u{*hMGRsntvuTqJcr5E5+63w^3R~NB>hgxW7av*Fso9+0z3la` zwK}Jb8WcDl6>k>z+SPEbj{Eec6(L$J4;h2fmSlDXd2uNQExq!+>AH!r@n_8fu^&N~ zx18ouV|nwmav#qfwrkg~UoZFjqtCGHz5VvaE%BhFZ(8CSQR1ARo12WKm#mw4Gnb-4MGept&A*)L>|!Yha{nWDsIx zY-MC-Wn>7^Q1iRK5Jf|7eoAIqB~$~@2Ez~o3oBDIE0BJW4IybSR|7Q|ft=)%nVgze zoXU_|`z^)3Ja diff --git a/WPFCatalog/Icons/document-open-6.png b/WPFCatalog/Icons/document-open-6.png deleted file mode 100644 index fe03b7f429925fe2a0d967ce4ac873644a773707..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1028 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmUzPnffIy#(^vlDyqr zfHV;NblzPLq&N#aB8!2v2N=7Z%(epwmK8Xr18J~%3^B*n9%f)*{Nw537-DgH>cq3& zA%POd>Yv|RtZZy%X4!2LzBcQ+Q_L2PNgf5lYk%F?dio#p;@o=2gCZ^g21;8z7K(`p zvNXClg^7qXb=KafSyi0Ar}(^kcX7L*{+Ex3BIkVm^yl2?J?l4I`?TDu^3jh=KYq-t zxsbK;?)#gyH}9qU&-dZ>J3s&EvCf0Y2MTI=7~45>E}r*JU;y5#YWRk z_2+L6r8w!UX%u{UwNQR)S@u@PU2#nMYAtMh{SHewRS!J6zNB=wLFbGIzpBn$%L5w{$|YkN(F5kei=+)V)ST;=l!vT@w@nB zzjaS+`1qQx+~o*lab`adrLB74*fin)dnU5n+4I)Wh#^k8r651bc^`X=>Qjc>>pmu_ z{yW%Ubm7{Bciw`gSu&F6R3BIwNs247g+%L3HxkHX*AVHxv$I_M!v=>9D_@-V@|rEU zI^Hfs#bKo&Gt>6un}Q%+xA%j6NPGtYeY$MQEFmIs%{F9U@$T;u+%j))HO5>F*LI>u&^>Q)HN`- zGB8kC_wWHs14yM6L>Ewlp@FV}k*<+Jh>@|Ck(rgDDMSOCbxb3QhTQy=%(P0V2A~aw zAqJLKh89-F77z_#T2`z;4W=L``D7-i<`t(hWR#Q?Sn2D7?aC}mP0r8F&Ce^=%P&gT z&w(f@*7tD_@X}xJ3eHBg8TSeyWzAeg&vO5@cg=ep*R+Vo@rCV@iHfs)A>3 zVtQ&&YGO)d;mK4Rpdwy~qSB(|R0hA&vizLHHU6d_ff6PNiTKbUADENN%ggmLlk@X* ovorJ3^?(l7FDS~-N=+^)*3ScL*Dtf(0?OwMp00i_>zopr0HQU2XaE2J diff --git a/WPFCatalog/Icons/document-open-folder.png b/WPFCatalog/Icons/document-open-folder.png deleted file mode 100644 index 98b8a9448a5756451eadce70af3772be1f543993..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 852 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE0z%d<2gY`4S99w&sfq~J`)5S5w;`Gv>-CoX)0=DVp@A8@$w+gyk zW?Ac-n7w$Ze1a7Bf29fX7vwoQ4Hb2pPwpZlyzw76$+xg?=UZ@v)2#b0dFKL^yir1f2 zt+>ggS-@fCtq(Ex_jLpt?sq=QxidndJz~ivPG#4%|6CrooJiGKz_z#ckGRXBLZ=S# z=AO+0v)?T_Dip_agq^3>;pDE8aM_iI*m+c6pSkz-@$0O_tezzH&kKY#UzwjTyf!m7 z^Zxy?Tjg_SuDX&L3oGvKvI+89`ut4Jd~asWlEpt6A96=DZ(*2U2MkHo64!{5 z9nO2Eg!<&1*zW_C)gPi1(nVgzeoXU_vn(|^KQ}i&uUId?C|y4XqNG?qsZzH%QQuh4KwlxhNP!p~KJEcN`bK(&`qBM1 z$uKuUoQD(&2FALEmLY})R;ET)ra(`b0X=n7{@W&?21$?`gY(l$$`gxH8OqDc^)mCa zi<1)zQbA6e{mw=Ts7M&1sI(|KmBGKFGCeg(}6TtKSRv1wTBrPn7KV&978Nlr%v|Gh)I=bo&Wo;wf)BANB+lH zZr#}B5o^+8+L$5Qy-U#1iIvysU@Yf~)wiYwvButzat`B-xU*uVM@H@%-G43tQj^)d z7W)J%-S|_s$awOSnP*app4WY^yZ>4#WJzUsdZC3(#rekt*L!OnXBXX-b1CiYoW&@! z^pk@4nj8M}>*lWf|9h_WqhkUeiv*-U2=%r{^UL%vm#cAGSz+wqA#x@_^IuMWobA%y zILpfu9`x4Uees{Et*s!sx!#%UvxHbreyWK`4UUy z4@my*x%;tgS{ekt}^R9TRuU@Dh;*ZcQBo}}6huiwqJZY#kX63?F2!>&{5{m#E5RSSj=Ipl6nrGf)3-(>lN8FHB}<1h0ujo;_dm*Gnu}Ye(ta zkZJnSg%bCw9`F60dV6=>s_CaP^TKbP^!*yBtDC6A+wi*bPVoH`>$Yw0Jk3!0lKDEv*`k$L8nUW>zoz5M?3q8`t~_h) z{E0#A@wXX!e>yMkxP0-`jgKxn44XdIAAMnYgv}yPYWq8edwt?NO82f0nfkhB9#JiEjVMVjN=+$?Z| z=o{%7=;vgyt$bP0l+XkK^*s1x diff --git a/WPFCatalog/Icons/format-justify-left-2.png b/WPFCatalog/Icons/format-justify-left-2.png deleted file mode 100644 index d6abc0585efd6d5e4a41f17f3545b877c432432c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3517 zcmZXWcT`hNyTu2PVh|}x*C0(%DFGrS0ff+{h!7PO1?i!M5~>10M1d$ZG(iNUqe6%v zN)ZquQeS%S3K9`%p-B7U>;2YUcipqr%wA_^|JHuy%=zPqGBefZfCxbV033z}I_7lc z`ZL&A=(EV$!Ckr>a?&!<0)P~Af9Faf01$PIwze6@&JKWpk>?gpXp03t_05TOlu;y} zXoNNAWjke#BH+=O9G(P_{ZN2Mb1|~8J~Bt_0k7b3uljE8IFeX&gcfO&A&^aKc1lVK zJ;6C46ilA0RmN_V)^4aeJ^z&vtO4|F%5he# zD6;`lt?`jQ3}xxSCLz0>2yA`<{PVMX_Doy?z$S-_-GYH_1JuXq>n;N}MFy!S#L|GC z>sF$j762@l+Y`Pe5YfyYqHmi{THSshkfoxm{mN|U;o*l1jPKdz9UNK@^)!P-MJ9mP z^V7j|c5cq9BC8O{QI!$I{ffc^pzERVA9t@!ElMjlzxmbWa zOL(F`CxC6IADna+1X;rg$4>w}KX(Ls(rU&R0S16)gPSocIfrWqgfkD}#jEhhfH0Bv zM`n=^R4f6?Ai_9KTUI*as@WmQGVV$g@8YAIg^%@A7-c*eI~$p+7zd~L)bMu%@bfST z*5-s3mqMeCWu%fVK2>ZWQoK>uQ8dH=#uL^g8f5?x(gQc93kQS3ZL*yxDV`b}jc(joNC32UzoYo>i<#`?Dp`#(6oQi6fDy%2 zwAOU1iD5>VC#p#_Ez!y#ELX)`2y?iI_%^Xm2cbqKrwj#a@Cb4rm5+M-za0`XjqY<}_;*CO}6 zl0F8iipg_F)3q$!?jGk7=cKoKBY`8@Bj*v%J#_r@9`{PFC#_%lefPI+kjS38cKF@q zDR~}&OB5DL2t|;hPC0)%5kpzGr6}^YbF>G|sm|HWA$gOdUqh^QbIVbAH}h_M`_RgM zwYa#b_#Kt8|9(HD|7G#@tNML~E{-m07s5uoD_kmOUHtnfeK)8_soB&tY95ufU#^G~ z6L+B#f7Cr7?w2vN*(8TG*$^5q;Z9Yjm!3LJB?Yi*xD>hy zI2XdlT!-9MJnTK-gN5~lU%to7cci*zxYaaQjR*8K)k`$l7a4|s3AQLcI|%Q`rDF;f zZYlbZ1;`bSGLG7FH|OrJ-Ctu_d(3Cdewm=lcY#k?#xU8c4cGQOdGM9l`7SP_% zx}|hJw$m@I*3D0!OI%8!@Z5L9va4lkRWgS-(oUAEew{witJT&`1QEnq~g!qkkc5zOT2qQ zW%ZB)>G}+AM#Ag$%Ga&$TOYPafgx*^ox%p5m!vLLsZZVynb@4!{FX#LhX;xxLe zFS?KW@MUw!z%;(pO5{)XAm`uv>rqcqpX3`~aD{>@NLr2&Cfn-eVq030#q%{;WyGd)W>6-))RojfLnE-R?X7*h zjj|N8>Z$AVTqw>9ZmUW8c{@h>^3935#sJ;v=&&S)^PI18USG1NS%d{^1vdQXmoFKG z&>+|OHcAg$_L}9IOUQj74+Q^Q@_p!=;5+`Kpmefs--lGV;)^)~efClxB~swqt5`1F|P=j|6ql zZr zT{ORkUa{Qt>gYn{Z;E@*}?Y3@`DwxtmU(7nC7eoo4vT%f1>Ul zOuKf?sS5|l-qX-9Unl&QL*B8h*_ysyYF({or_Xw))!KCT+V4v{{riK8cizQDJXH@# z+;-e`UqSx#XPxkw^bd*LhN)!k#P5<;6TcNyc4@s3F|{`}-aW>Yy0$B6rU`2WT2>=F+p^g?>r7bVP#N(J2SHwrEv099nS8Pk% zD@`%eI0L?n@bI!Ju*fwkl|njnCvJ+FN0{$K!^ZA9ZnLeCr2aDAE4QyW6m8vq@9OEO zd7Vm)-Hg3j!MVrcnv6sq-*GP6Lz+Bi4;zMW-}l;_{!RPb@mM0{U|YFA#u-J#=Cl@H zxe^rod)MJZ=P2$}{QYC8`&*{TuQOeLosCWq5Hn#r5_`up*w;{_#o{t!{S?ej4Z4YY zlp1%6qQe%yB~`)-QjJfiBI&P}X2!n-at>A2GO>xSQrC|#J#1MMH8FT7(A}yD+THY7 z9d|!`9Gz`w_Ru6rtEdY4rgo~v#KdaF^|T^g_pl5s+b}1k+5;@>Ja%$%sb2M+KV*Wn zubjjLBkx(1y@@=k*^`+6Pt2>UnzQ$ zCeeWJ?XJ3zYLnqG*Ljaz_pT!~n`GJ^1OG|>nLA4yJM0$iVRE{0fWiMmrMT__~S(UrRab>Oa`VPqo9CRfFWRt2zmHl zK*G-LXH1I6_e#p{VpX z@dt|*ln(IyNwmQFdfPbwZSO!I++DX*X5LsA2Rq!4*{=k;EylH zlM_Xb*5^wZBz+F-{p+zn;l+i8o~(gKLbo?{Pp)q`*R}4^qZcchHTb#|^qQR6bJ@i& zu61k|3%Q^av82~9bJDY&&#i3MZ)@(Fz+GOccYbGk@j2f+a}%|GKRVXAU&*8I$&5J( zhkRIs6+03>>T(Cno$Z+Rpl^3`dcgtSJF?RQ1dN=E1S}+{-Pdtvh+MGq+thbyulJih z?`BognrzK;XU@B{?&r(nAN$>Tw_9pQ*v=y_?qxdM**39*j+_eNSJ{kkqeEm)s!b$P;!ebe@@h!Oz2Y@AIgrYg=-Ov0iQ{U(5FS zs!_a^t(EfUoIf*?eV+f=Q`c3NFVrfS_36c_yoQ8DasQ6JY1Gu(dH70~Q{3a=I?<0E z%2(SvGB!_>;TCI7DH4$}Hr)7Jph&PrdS}6rkUXn2M#YxhpJRFNEc$da!RgtPZ@rgx z|K!=uA!d93WW&;%6Xq1HJhGnq#4Jvmg%)AU0&et+up2*Le<3oO!DU^|obCMY9;&G{ zI!|(8o_st!y|#SY|E)j$r}9+y&Rkf>Y|j`ky>P$k(avmO%&V5TMwBEMr6!i7>ZSk* z1|tIlOI<@lT|=`FBO@zA3oAo&T?2C~1A}OWe+OY2Kq{>ux_}xC4Rj5F8Vo}W%&bg} ztqe>c8W;sP<)LWE%}>cptHiCLz=!J+P(u>PNj{m$sd>ez3>hUQ1y=g{V7oHQQj_y@ zbMy0x_413-^>ZLfiuIE!^^Nrm^cC`p6o^!Aq-Uz%-DZ;ta~{NH@BlE=H89pSGzu{? zv@$ib0(lP<0H?Qn_yW`*336U=ep*R+Vo@rCV@iHfs)A>3VtQ&&YGO)d;mK4Rpdx9A zqSB(|R0cOkUkFkN&dkYH@Jt4Jps6b5H&B@|LRoxhkPpna<>lpiX^FWIqzCk~eokVN dekMqxelgGt{X<81d4bv)JYD@<);T3K0RVitj@tkL diff --git a/WPFCatalog/Icons/picture.png b/WPFCatalog/Icons/picture.png deleted file mode 100644 index b773744c72df584d44d74ae66da69639b820ba19..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1075 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ea{HEjtmUzPnffIy#(^vlDyqr zfHV;NblzPLq&N#aB8!2v2N=7Z%(epwmK8Xr18J~%3^B*n9%f)*{OIZ87-DgH>15mN z5J!==`NrSx?fsr6UZyC0*lm#t<3Xj4l|BC$xw)lRFWE5R3!`*>%YH|n^o3JfBP9Mi zI&9!*=~(cryC%nM_M1C%Et3T|r<{RzJq$VV6zLro8-Y zCtH?zQcHO8?I)hX;#2k>p0hqXwCzxCQd{M}6sGk`dj+}JkGV)R9?CHaysxHPyF4@6 z;(f>EDJMU&-M@DFidSg}y9qKGt3ES;>8*6da~>Bb-5cZ`QB9g2E4{?W4!o3=8v zPVwI461N?Orv9qg4?=(ET)ckp)jOs*(eDj*nwS9 z;lSaUNAEeC)E+3To}TlV`|EG+Gp?TVjn9|#Fg_95|7%a%`Rp6NuBg_@2pD=V0XnSQ z?S113`4EfU;*;iTcPMk(I%rNa&!2uhom+m{|8&d8972b)8Fs$1`p?Fee`_*x?ty*4 zl%QJT8c~v5l$uzQs+$5N7>o=IEOiYHbq&ozjEt-dEvyX9bq&m|3=EwgR%j8iFPNj{m$sd>ez z3>hUQ1y=g{V7oHQQj_y@bMy0x_413-^>ZLfiuIE!^^Nrm^cC`p6o^!Aq-Uz%-DZ;t za~{NH@BlE=H89pSGzu{?v@$ibGBkns$Nu+~=RggTAm;_=r9C%$#fm&t#wnnyONM1C<#gl*NYz`M`Wz sUS6)3mY54cdO$zx=OiZSXM!~97X!`EKXinb7pR@V)78&qol`;+06No>>Hq)$ diff --git a/WPFCatalog/MainWindow.xaml b/WPFCatalog/MainWindow.xaml deleted file mode 100644 index c7cd8fe..0000000 --- a/WPFCatalog/MainWindow.xaml +++ /dev/null @@ -1,203 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/imagecatalog/ImageCatalog 2 - Backup.csproj b/imagecatalog/ImageCatalog 2 - Backup.csproj deleted file mode 100644 index c77aca9..0000000 --- a/imagecatalog/ImageCatalog 2 - Backup.csproj +++ /dev/null @@ -1,59 +0,0 @@ - - - WinExe - net8.0-windows - enable - enable - true - False - 3.0.0.0 - 3.0.0.0 - 3.0.0-alpha.63+Branch.develop.Sha.39a9baf5c618d8d79c75b89e2d5c4020939697f2 - 3.0.0-alpha0063 - - - true - - - embedded - - - embedded - - - - MyApplicationCodeGenerator - Application.Designer.cs - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - - - - - - - - - - - all - - - All - - - - - True - True - Settings.settings - - - - \ No newline at end of file diff --git a/imagecatalog/ImageCatalog 2.csproj b/imagecatalog/ImageCatalog 2.csproj index 36ac938..be6394f 100644 --- a/imagecatalog/ImageCatalog 2.csproj +++ b/imagecatalog/ImageCatalog 2.csproj @@ -51,17 +51,18 @@ - + + - - - - + + + + all diff --git a/imagecatalog/ImageCatalog 2.vbproj b/imagecatalog/ImageCatalog 2.vbproj deleted file mode 100644 index b8cc359..0000000 --- a/imagecatalog/ImageCatalog 2.vbproj +++ /dev/null @@ -1,347 +0,0 @@ - - - - Local - 9.0.30729 - 2.0 - {8D3AA2B0-8F06-4A61-9CAD-B920EB1A8E9C} - Debug - AnyCPU - - - - - ImageCatalog - - - None - JScript - Grid - IE50 - false - WinExe - Binary - On - On - ImageCatalog - ImageCatalog.My.MyApplication - - - WindowsForms - 3.5 - - - v4.7.2 - true - My Project\app.manifest - - - SAK - SAK - SAK - SAK - - - http://localhost/ImageCatalog/ - true - Web - true - Foreground - 7 - Days - false - false - true - 0 - 1.8.0.%2a - false - true - - - bin\ - ImageCatalog.xml - 285212672 - - - - - true - true - true - false - false - false - false - 1 - 42016,42017,42018,42019,42032,42353,42354,42355 - full - AnyCPU - AllRules.ruleset - false - - - bin\ - ImageCatalog.xml - 285212672 - - - - - false - true - false - true - false - false - false - 1 - 42016,42017,42018,42019,42032,42353,42354,42355 - none - AnyCPU - AllRules.ruleset - false - - - true - true - true - bin\x64\Debug\ - 285212672 - ImageCatalog.xml - 1 - 42016,42017,42018,42019,42032,42353,42354,42355 - full - x64 - AllRules.ruleset - false - - - true - bin\x64\Release\ - 285212672 - ImageCatalog.xml - true - 1 - 42016,42017,42018,42019,42032,42353,42354,42355 - x64 - AllRules.ruleset - false - - - true - true - true - bin\x86\Debug\ - 285212672 - ImageCatalog.xml - 1 - 42016,42017,42018,42019,42032,42353,42354,42355 - full - x86 - bin\ImageCatalog.exe.CodeAnalysisLog.xml - true - GlobalSuppressions.vb - AllRules.ruleset - ;F:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets - true - ;F:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules - true - false - false - - - true - bin\x86\Release\ - 285212672 - ImageCatalog.xml - true - 1 - 42016,42017,42018,42019,42032,42353,42354,42355 - x86 - bin\ImageCatalog.exe.CodeAnalysisLog.xml - true - GlobalSuppressions.vb - AllRules.ruleset - ;F:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets - true - ;F:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules - true - false - - - - ..\packages\Ben.Demystifier.0.3.0\lib\net45\Ben.Demystifier.dll - - - - System - - - ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll - - - ..\packages\System.Collections.Immutable.5.0.0\lib\net461\System.Collections.Immutable.dll - - - 3.5 - True - - - System.Data - True - - - System.Drawing - True - - - ..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll - - - - ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll - - - ..\packages\System.Reflection.Metadata.5.0.0\lib\net461\System.Reflection.Metadata.dll - - - ..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll - - - ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll - - - System.Windows.Forms - - - System.XML - - - - - - - - - - - - - - - Code - - - - - - Code - - - Form - - - - MainForm.vb - - - Form - - - - True - Application.myapp - - - True - True - Settings.settings - - - - - Code - - - Code - - - Form1.vb - Designer - - - MainForm.vb - - - MyApplicationCodeGenerator - Application.Designer.vb - - - - - - My - SettingsSingleFileGenerator - Settings.Designer.vb - - - - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 2.0 %28x86%29 - false - - - False - .NET Framework 3.0 %28x86%29 - false - - - False - .NET Framework 3.5 - true - - - False - .NET Framework 3.5 SP1 - false - - - False - Windows Installer 3.1 - true - - - - - - - - {44465926-240d-473f-90b8-786ba4384406} - CatalogVbLib - - - {aebfe9e3-277c-4a7b-8448-145d1b11998b} - MaddoShared - - - - - - - - - - - - - - - - \ No newline at end of file -- 2.52.0 From b29cc95a1e58c93565620a88cfc28c985c891bb4 Mon Sep 17 00:00:00 2001 From: MaddoScientisto Date: Sun, 8 Mar 2026 13:44:09 +0100 Subject: [PATCH 094/127] feat: Enhance Avalonia UI with compact styles and improved layout for various views; adjust margins and paddings for a denser interface --- imagecatalog/AvaloniaApp.axaml | 46 +++++++++++++++++++ imagecatalog/AvaloniaMainWindow.axaml | 34 +++++++------- imagecatalog/AvaloniaViews/AiTabView.axaml | 24 +++++----- .../AvaloniaViews/FaceAiTabView.axaml | 22 ++++----- .../AvaloniaViews/GeneralTabView.axaml | 36 +++++++-------- imagecatalog/AvaloniaViews/LogoTabView.axaml | 26 +++++------ imagecatalog/AvaloniaViews/PhotoTabView.axaml | 18 ++++---- .../AvaloniaViews/RaceUploadTabView.axaml | 11 ++--- imagecatalog/AvaloniaViews/TextTabView.axaml | 34 +++++++------- .../AvaloniaViews/ThumbnailsTabView.axaml | 16 +++---- 10 files changed, 156 insertions(+), 111 deletions(-) diff --git a/imagecatalog/AvaloniaApp.axaml b/imagecatalog/AvaloniaApp.axaml index e4a021d..fe06efa 100644 --- a/imagecatalog/AvaloniaApp.axaml +++ b/imagecatalog/AvaloniaApp.axaml @@ -4,6 +4,52 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/imagecatalog/AvaloniaMainWindow.axaml b/imagecatalog/AvaloniaMainWindow.axaml index e9f6ef2..bd8498f 100644 --- a/imagecatalog/AvaloniaMainWindow.axaml +++ b/imagecatalog/AvaloniaMainWindow.axaml @@ -10,17 +10,17 @@ - + - + - + @@ -30,7 +30,7 @@ - + @@ -40,7 +40,7 @@ - + @@ -50,7 +50,7 @@ - + @@ -60,7 +60,7 @@ - + @@ -70,7 +70,7 @@ - + @@ -80,7 +80,7 @@ - + @@ -90,7 +90,7 @@ - + @@ -99,24 +99,24 @@ - + - + @@ -124,20 +124,20 @@ Command="{Binding ProcessImagesCommand}" IsEnabled="{Binding UiEnabled}"> - + - + diff --git a/imagecatalog/AvaloniaViews/AiTabView.axaml b/imagecatalog/AvaloniaViews/AiTabView.axaml index e9652d4..a5f6971 100644 --- a/imagecatalog/AvaloniaViews/AiTabView.axaml +++ b/imagecatalog/AvaloniaViews/AiTabView.axaml @@ -3,33 +3,33 @@ xmlns:avaloniaDataGrid="clr-namespace:Avalonia.Controls;assembly=Avalonia.Controls.DataGrid" x:Class="ImageCatalog_2.AvaloniaViews.AiTabView"> - + - + - - + + -