From 2822038123c043337f1a7e0e58ada9b9361a9ccc Mon Sep 17 00:00:00 2001 From: Maddo Date: Tue, 19 Sep 2017 14:49:29 +0200 Subject: [PATCH 01/12] Updated imgsharp --- CatalogLib/CatalogLib.csproj | 42 +++++++++++++++++------------------ CatalogLib/ImgSharpCreator.cs | 20 ++++++++--------- CatalogLib/app.config | 4 ++-- CatalogLib/packages.config | 24 ++++++++++---------- CatalogLib/stylecop.json | 15 +++++++++++++ WPFCatalog/App.config | 12 ++++++++-- 6 files changed, 70 insertions(+), 47 deletions(-) create mode 100644 CatalogLib/stylecop.json diff --git a/CatalogLib/CatalogLib.csproj b/CatalogLib/CatalogLib.csproj index 8657ce6..e3c1c2a 100644 --- a/CatalogLib/CatalogLib.csproj +++ b/CatalogLib/CatalogLib.csproj @@ -53,12 +53,6 @@ MinimumRecommendedRules.ruleset - - ..\packages\ImageSharp.1.0.0-alpha9-00169\lib\netstandard1.3\ImageSharp.dll - - - ..\packages\ImageSharp.Drawing.1.0.0-alpha9-00164\lib\netstandard1.1\ImageSharp.Drawing.dll - ..\packages\Microsoft.Win32.Primitives.4.3.0\lib\net46\Microsoft.Win32.Primitives.dll @@ -66,28 +60,33 @@ ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll True - - ..\packages\SixLabors.Core.0.1.0-alpha0002\lib\netstandard1.1\SixLabors.Core.dll + + ..\packages\SixLabors.Core.1.0.0-beta0002\lib\netstandard1.1\SixLabors.Core.dll - ..\packages\SixLabors.Fonts.0.1.0-alpha0014\lib\netstandard1.3\SixLabors.Fonts.dll + ..\packages\SixLabors.Fonts.1.0.0-beta0001\lib\netstandard1.3\SixLabors.Fonts.dll + + + ..\packages\SixLabors.ImageSharp.1.0.0-beta0001\lib\netstandard1.3\SixLabors.ImageSharp.dll + + + ..\packages\SixLabors.ImageSharp.Drawing.1.0.0-beta0001\lib\netstandard1.1\SixLabors.ImageSharp.Drawing.dll - ..\packages\SixLabors.Shapes.0.1.0-alpha0018\lib\netstandard1.1\SixLabors.Shapes.dll + ..\packages\SixLabors.Shapes.1.0.0-beta0001\lib\netstandard1.1\SixLabors.Shapes.dll - ..\packages\SixLabors.Shapes.Text.0.1.0-alpha0018\lib\netstandard1.1\SixLabors.Shapes.Text.dll + ..\packages\SixLabors.Shapes.Text.1.0.0-beta0001\lib\netstandard1.1\SixLabors.Shapes.Text.dll ..\packages\System.AppContext.4.3.0\lib\net46\System.AppContext.dll - - ..\packages\System.Buffers.4.3.0\lib\netstandard1.1\System.Buffers.dll + + ..\packages\System.Buffers.4.4.0\lib\netstandard1.1\System.Buffers.dll - - ..\packages\System.Collections.Immutable.1.3.1\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll - True + + ..\packages\System.Collections.Immutable.1.4.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll @@ -115,7 +114,7 @@ ..\packages\System.IO.FileSystem.Primitives.4.3.0\lib\net46\System.IO.FileSystem.Primitives.dll - ..\packages\System.Memory.4.4.0-preview1-25305-02\lib\netstandard1.0\System.Memory.dll + ..\packages\System.Memory.4.4.0-preview2-25405-01\lib\netstandard1.0\System.Memory.dll ..\packages\System.Net.Http.4.3.0\lib\net46\System.Net.Http.dll @@ -124,11 +123,11 @@ ..\packages\System.Net.Sockets.4.3.0\lib\net46\System.Net.Sockets.dll - - ..\packages\System.Numerics.Vectors.4.3.0\lib\net46\System.Numerics.Vectors.dll + + ..\packages\System.Numerics.Vectors.4.4.0\lib\net46\System.Numerics.Vectors.dll - ..\packages\System.Runtime.CompilerServices.Unsafe.4.4.0-preview1-25305-02\lib\netstandard1.0\System.Runtime.CompilerServices.Unsafe.dll + ..\packages\System.Runtime.CompilerServices.Unsafe.4.4.0\lib\netstandard1.0\System.Runtime.CompilerServices.Unsafe.dll ..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll @@ -146,7 +145,7 @@ ..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net46\System.Security.Cryptography.X509Certificates.dll - ..\packages\System.ValueTuple.4.4.0-preview1-25305-02\lib\netstandard1.0\System.ValueTuple.dll + ..\packages\System.ValueTuple.4.4.0\lib\netstandard1.0\System.ValueTuple.dll @@ -177,6 +176,7 @@ + diff --git a/CatalogLib/ImgSharpCreator.cs b/CatalogLib/ImgSharpCreator.cs index 1f5ac0d..50da2a9 100644 --- a/CatalogLib/ImgSharpCreator.cs +++ b/CatalogLib/ImgSharpCreator.cs @@ -1,27 +1,25 @@ using System; using System.Collections.Generic; using System.Diagnostics; -using System.Drawing; using System.IO; using System.Linq; using System.Numerics; -using System.Text; using System.Threading.Tasks; -using ImageSharp; -using ImageSharp.Drawing; -using ImageSharp.PixelFormats; -using ImageSharp.Processing; +using NLog; using SixLabors.Fonts; +using SixLabors.ImageSharp; +using SixLabors.ImageSharp.Drawing; using Font = SixLabors.Fonts.Font; using FontFamily = SixLabors.Fonts.FontFamily; using FontStyle = SixLabors.Fonts.FontStyle; -using Image = ImageSharp.Image; - +using Rgba32 = SixLabors.ImageSharp.Rgba32; +using Image = SixLabors.ImageSharp.Image; namespace CatalogLib { public class ImgSharpCreator : IImageProcessor { + private FileInfo _currentFile; public void Start(FileInfo workFile) { @@ -35,7 +33,8 @@ namespace CatalogLib if (PicSettings.Instance.GeneraleRotazioneAutomatica) { - image.AutoOrient(); + image.Mutate(img => img.AutoOrient()); + //image.AutoOrient(); //var exif = image.MetaData.ExifProfile; //if (exif != null) @@ -103,7 +102,8 @@ namespace CatalogLib //JpegDecoder j = new JpegDecoder(); var va = Vector.IsHardwareAccelerated; - + Debug.WriteLine($"Hardware Accelerated: {va}"); + //image.Resize(PicSettings.Instance.FotoLarghezza, PicSettings.Instance.FotoAltezza); //image.Resize(2240, 2240); diff --git a/CatalogLib/app.config b/CatalogLib/app.config index b5d559f..3fcefdf 100644 --- a/CatalogLib/app.config +++ b/CatalogLib/app.config @@ -16,11 +16,11 @@ - + - + diff --git a/CatalogLib/packages.config b/CatalogLib/packages.config index 8beea34..3740a21 100644 --- a/CatalogLib/packages.config +++ b/CatalogLib/packages.config @@ -1,20 +1,20 @@  - - - - - - + + + + + + - + - + @@ -29,18 +29,18 @@ - + - + - + @@ -57,7 +57,7 @@ - + \ No newline at end of file diff --git a/CatalogLib/stylecop.json b/CatalogLib/stylecop.json new file mode 100644 index 0000000..c67c0db --- /dev/null +++ b/CatalogLib/stylecop.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", + "settings": + { + "orderingRules": + { + "usingDirectivesPlacement": "outsideNamespace" + }, + "documentationRules": + { + "xmlHeader": false, + "copyrightText": "Copyright (c) Six Labors and contributors.\nLicensed under the Apache License, Version 2.0." + } + } +} \ No newline at end of file diff --git a/WPFCatalog/App.config b/WPFCatalog/App.config index ff1c544..ca0daff 100644 --- a/WPFCatalog/App.config +++ b/WPFCatalog/App.config @@ -20,11 +20,11 @@ - + - + @@ -38,6 +38,14 @@ + + + + + + + + From 0d8ab38efd8c3aacce073d743c81c35d47279acf Mon Sep 17 00:00:00 2001 From: Maddo Date: Tue, 19 Sep 2017 15:21:39 +0200 Subject: [PATCH 02/12] Fixed compilation and added libraries --- .gitmodules | 3 +++ Catalog.sln | 37 ++++++++++++++++++++++++++++++++++- CatalogLib/CatalogLib.csproj | 5 ++++- CatalogLib/ImgSharpCreator.cs | 17 ++++++++++------ CatalogLib/MaddoLogger.cs | 18 ----------------- MaddoLibrary | 1 + WPFCatalog/WPFCatalog.csproj | 21 ++++++++++---------- WPFCatalog/packages.config | 2 +- 8 files changed, 66 insertions(+), 38 deletions(-) create mode 100644 .gitmodules delete mode 100644 CatalogLib/MaddoLogger.cs create mode 160000 MaddoLibrary diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..99a1b50 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "MaddoLibrary"] + path = MaddoLibrary + url = git@gitlab.com:MaddoTools/MaddoLibrary.git diff --git a/Catalog.sln b/Catalog.sln index 05e37b1..0cc7def 100644 --- a/Catalog.sln +++ b/Catalog.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26403.3 +VisualStudioVersion = 15.0.26730.15 MinimumVisualStudioVersion = 10.0.40219.1 Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ImageCatalog 2", "imagecatalog\ImageCatalog 2.vbproj", "{8D3AA2B0-8F06-4A61-9CAD-B920EB1A8E9C}" EndProject @@ -15,6 +15,10 @@ Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "CatalogVbLib", "CatalogVbLi EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{A3D50937-74F6-4DC8-8D89-B534B484C0F9}" 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 @@ -74,8 +78,39 @@ Global {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 + {E93DAAE6-4AA9-4A45-AFB6-58209B3AD3C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E93DAAE6-4AA9-4A45-AFB6-58209B3AD3C9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E93DAAE6-4AA9-4A45-AFB6-58209B3AD3C9}.Debug|x64.ActiveCfg = Debug|x64 + {E93DAAE6-4AA9-4A45-AFB6-58209B3AD3C9}.Debug|x64.Build.0 = Debug|x64 + {E93DAAE6-4AA9-4A45-AFB6-58209B3AD3C9}.Debug|x86.ActiveCfg = Debug|Any CPU + {E93DAAE6-4AA9-4A45-AFB6-58209B3AD3C9}.Debug|x86.Build.0 = Debug|Any CPU + {E93DAAE6-4AA9-4A45-AFB6-58209B3AD3C9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E93DAAE6-4AA9-4A45-AFB6-58209B3AD3C9}.Release|Any CPU.Build.0 = Release|Any CPU + {E93DAAE6-4AA9-4A45-AFB6-58209B3AD3C9}.Release|x64.ActiveCfg = Release|Any CPU + {E93DAAE6-4AA9-4A45-AFB6-58209B3AD3C9}.Release|x64.Build.0 = Release|Any CPU + {E93DAAE6-4AA9-4A45-AFB6-58209B3AD3C9}.Release|x86.ActiveCfg = Release|Any CPU + {E93DAAE6-4AA9-4A45-AFB6-58209B3AD3C9}.Release|x86.Build.0 = Release|Any CPU + {73DA19D7-196D-4B16-B610-93250978A607}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {73DA19D7-196D-4B16-B610-93250978A607}.Debug|Any CPU.Build.0 = Debug|Any CPU + {73DA19D7-196D-4B16-B610-93250978A607}.Debug|x64.ActiveCfg = Debug|x64 + {73DA19D7-196D-4B16-B610-93250978A607}.Debug|x64.Build.0 = Debug|x64 + {73DA19D7-196D-4B16-B610-93250978A607}.Debug|x86.ActiveCfg = Debug|Any CPU + {73DA19D7-196D-4B16-B610-93250978A607}.Debug|x86.Build.0 = Debug|Any CPU + {73DA19D7-196D-4B16-B610-93250978A607}.Release|Any CPU.ActiveCfg = Release|Any CPU + {73DA19D7-196D-4B16-B610-93250978A607}.Release|Any CPU.Build.0 = Release|Any CPU + {73DA19D7-196D-4B16-B610-93250978A607}.Release|x64.ActiveCfg = Release|x64 + {73DA19D7-196D-4B16-B610-93250978A607}.Release|x64.Build.0 = Release|x64 + {73DA19D7-196D-4B16-B610-93250978A607}.Release|x86.ActiveCfg = Release|Any CPU + {73DA19D7-196D-4B16-B610-93250978A607}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {E93DAAE6-4AA9-4A45-AFB6-58209B3AD3C9} = {A3D50937-74F6-4DC8-8D89-B534B484C0F9} + {73DA19D7-196D-4B16-B610-93250978A607} = {A3D50937-74F6-4DC8-8D89-B534B484C0F9} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {5915F930-025D-4D6A-8C42-D62B76DB38BD} + EndGlobalSection EndGlobal diff --git a/CatalogLib/CatalogLib.csproj b/CatalogLib/CatalogLib.csproj index e3c1c2a..a5aecf8 100644 --- a/CatalogLib/CatalogLib.csproj +++ b/CatalogLib/CatalogLib.csproj @@ -162,7 +162,6 @@ - @@ -172,6 +171,10 @@ {44465926-240d-473f-90b8-786ba4384406} CatalogVbLib + + {e93daae6-4aa9-4a45-afb6-58209b3ad3c9} + MaddoLibrary.Base.NET46 + diff --git a/CatalogLib/ImgSharpCreator.cs b/CatalogLib/ImgSharpCreator.cs index 50da2a9..7e739cf 100644 --- a/CatalogLib/ImgSharpCreator.cs +++ b/CatalogLib/ImgSharpCreator.cs @@ -5,7 +5,7 @@ using System.IO; using System.Linq; using System.Numerics; using System.Threading.Tasks; -using NLog; +using MaddoLibrary.Base.Log; using SixLabors.Fonts; using SixLabors.ImageSharp; using SixLabors.ImageSharp.Drawing; @@ -29,11 +29,13 @@ namespace CatalogLib using (Image image = Image.Load(workFile.FullName)/* new Image(workFile.FullName)*/) { + MaddoLogger.Log("Loaded Image: {0}", workFile.FullName); //image.Rotate(-90); if (PicSettings.Instance.GeneraleRotazioneAutomatica) { image.Mutate(img => img.AutoOrient()); + MaddoLogger.Log("Rotated Image: {0}", workFile.FullName); //image.AutoOrient(); //var exif = image.MetaData.ExifProfile; @@ -98,12 +100,13 @@ namespace CatalogLib if (PicSettings.Instance.EnableText) { SetExtraText(image); + MaddoLogger.Log("Drawn text on Image: {0}", workFile.FullName); } //JpegDecoder j = new JpegDecoder(); var va = Vector.IsHardwareAccelerated; - Debug.WriteLine($"Hardware Accelerated: {va}"); - + + MaddoLogger.Log("Hardware Accelerated: {0}", va); //image.Resize(PicSettings.Instance.FotoLarghezza, PicSettings.Instance.FotoAltezza); //image.Resize(2240, 2240); @@ -112,6 +115,8 @@ namespace CatalogLib //image.DrawText("sssssssssssssssssssssssssssssssssssssssssssssss", font, Color.Black, new Vector2(200, 200)); image.Save(Path.Combine(PicSettings.Instance.DirectoryDestinazione, workFile.Name)); //image.Resize(200, 200).Save(""); + + MaddoLogger.Log("Saved Image: {0} to: {1}", workFile.FullName, Path.Combine(PicSettings.Instance.DirectoryDestinazione, workFile.Name)); } } @@ -151,8 +156,8 @@ namespace CatalogLib float scalingFactor = Math.Min(image.Width / size.Width, image.Height / size.Height); Font scaledFont = new Font(font, scalingFactor * font.Size); - - image.DrawText(PicSettings.Instance.TestoApplicareOrizzontale, scaledFont, g, center, new TextGraphicsOptions(true) { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Bottom }); + image.Mutate(x => x.DrawText(PicSettings.Instance.TestoApplicareOrizzontale, scaledFont, g, center, new TextGraphicsOptions(true) { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Bottom })); + //image.DrawText(PicSettings.Instance.TestoApplicareOrizzontale, scaledFont, g, center, new TextGraphicsOptions(true) { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Bottom }); } @@ -166,7 +171,7 @@ namespace CatalogLib var size = TextMeasurer.Measure("Test test test test test", new RendererOptions(font)); float scalingFactor = Math.Min(image.Width / size.Width, image.Height / size.Height); Font scaledFont = new Font(font, scalingFactor * font.Size); - image.DrawText("Test test test test test", scaledFont, g, center, new TextGraphicsOptions(true) { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Bottom }); + image.Mutate(x => x.DrawText("Test test test test test", scaledFont, g, center, new TextGraphicsOptions(true) { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Bottom })); } private string FlipRgbString(string originalString) diff --git a/CatalogLib/MaddoLogger.cs b/CatalogLib/MaddoLogger.cs deleted file mode 100644 index 3eba4b7..0000000 --- a/CatalogLib/MaddoLogger.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace CatalogLib -{ - public class MaddoLogger - { - public void AddToLog(string data) - { - string dest = Path.Combine(PicSettings.Instance.DirectoryDestinazione, "log.txt"); - - } - } -} diff --git a/MaddoLibrary b/MaddoLibrary new file mode 160000 index 0000000..d9b6b42 --- /dev/null +++ b/MaddoLibrary @@ -0,0 +1 @@ +Subproject commit d9b6b42b847a86423577b66a74320fe90669fc2e diff --git a/WPFCatalog/WPFCatalog.csproj b/WPFCatalog/WPFCatalog.csproj index f1c1b72..baf5b7a 100644 --- a/WPFCatalog/WPFCatalog.csproj +++ b/WPFCatalog/WPFCatalog.csproj @@ -66,14 +66,6 @@ ..\packages\MvvmLightLibs.4.1.27.1\lib\net45\GalaSoft.MvvmLight.WPF45.dll - - False - ..\lib\MaddoLibrary.Base.NET45.dll - - - False - ..\lib\MaddoLibrary.WPF.NET46.dll - ..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll @@ -86,9 +78,8 @@ - - ..\packages\System.Collections.Immutable.1.3.1\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll - True + + ..\packages\System.Collections.Immutable.1.4.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll @@ -233,6 +224,14 @@ {d27accf2-80fc-4de8-aeb8-351ff076e6d5} CatalogLib + + {e93daae6-4aa9-4a45-afb6-58209b3ad3c9} + MaddoLibrary.Base.NET46 + + + {73da19d7-196d-4b16-b610-93250978a607} + MaddoLibrary.WPF.NET46 + diff --git a/WPFCatalog/packages.config b/WPFCatalog/packages.config index 189ae99..183cb0a 100644 --- a/WPFCatalog/packages.config +++ b/WPFCatalog/packages.config @@ -6,5 +6,5 @@ - + \ No newline at end of file From 27a2affc19660ae619598bd73f0172379b363eca Mon Sep 17 00:00:00 2001 From: Maddo Date: Wed, 20 Sep 2017 15:01:22 +0200 Subject: [PATCH 03/12] Tasks and resize --- CatalogLib/ImgSharpCreator.cs | 14 ++++++- WPFCatalog/MainWindowViewModel.cs | 66 +++++++++++++++++++++++++------ 2 files changed, 66 insertions(+), 14 deletions(-) diff --git a/CatalogLib/ImgSharpCreator.cs b/CatalogLib/ImgSharpCreator.cs index 7e739cf..cbcc126 100644 --- a/CatalogLib/ImgSharpCreator.cs +++ b/CatalogLib/ImgSharpCreator.cs @@ -9,6 +9,7 @@ using MaddoLibrary.Base.Log; using SixLabors.Fonts; using SixLabors.ImageSharp; using SixLabors.ImageSharp.Drawing; +using SixLabors.ImageSharp.Processing; using Font = SixLabors.Fonts.Font; using FontFamily = SixLabors.Fonts.FontFamily; using FontStyle = SixLabors.Fonts.FontStyle; @@ -32,6 +33,9 @@ namespace CatalogLib MaddoLogger.Log("Loaded Image: {0}", workFile.FullName); //image.Rotate(-90); + //if (PicSettings.Instance.r) + image.Mutate(x => x.Resize(PicSettings.Instance.FotoAltezza, PicSettings.Instance.FotoLarghezza, new BoxResampler())); + if (PicSettings.Instance.GeneraleRotazioneAutomatica) { image.Mutate(img => img.AutoOrient()); @@ -115,7 +119,7 @@ namespace CatalogLib //image.DrawText("sssssssssssssssssssssssssssssssssssssssssssssss", font, Color.Black, new Vector2(200, 200)); image.Save(Path.Combine(PicSettings.Instance.DirectoryDestinazione, workFile.Name)); //image.Resize(200, 200).Save(""); - + MaddoLogger.Log("Saved Image: {0} to: {1}", workFile.FullName, Path.Combine(PicSettings.Instance.DirectoryDestinazione, workFile.Name)); } @@ -156,7 +160,13 @@ namespace CatalogLib float scalingFactor = Math.Min(image.Width / size.Width, image.Height / size.Height); Font scaledFont = new Font(font, scalingFactor * font.Size); - image.Mutate(x => x.DrawText(PicSettings.Instance.TestoApplicareOrizzontale, scaledFont, g, center, new TextGraphicsOptions(true) { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Bottom })); + image.Mutate(x => + x.DrawText(PicSettings.Instance.TestoApplicareOrizzontale, scaledFont, g, center, + new TextGraphicsOptions(true) + { + HorizontalAlignment = HorizontalAlignment.Center, + VerticalAlignment = VerticalAlignment.Bottom + })); //image.DrawText(PicSettings.Instance.TestoApplicareOrizzontale, scaledFont, g, center, new TextGraphicsOptions(true) { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Bottom }); diff --git a/WPFCatalog/MainWindowViewModel.cs b/WPFCatalog/MainWindowViewModel.cs index 73cef20..63c76f7 100644 --- a/WPFCatalog/MainWindowViewModel.cs +++ b/WPFCatalog/MainWindowViewModel.cs @@ -7,6 +7,7 @@ using System.Text; using System.Threading.Tasks; using CatalogLib; using GalaSoft.MvvmLight.Command; +using MaddoLibrary.Base.Log; using MaddoLibrary.Helpers; using WPFCatalog.Messages; @@ -76,19 +77,60 @@ namespace WPFCatalog //string s = d.Name; } - private void Start() + private struct ImageTask + { + public Task TaskImage; + public string ImageName; + public bool Completed; + } + + //private List _tasks; + private async void Start() + { + Task outerTask = new Task(() => + { + var tasks = new List(); + // todo folder mode + MaddoLogger.Log("Starting elaboration"); + foreach (var file in Directory.EnumerateFiles(PicSettings.DirectorySorgente)) + { + //Task t = new Task(() => + //{ + + // //CompleteFile(file); + //}); + tasks.Add(FileTask(file)); + //_tasks.Add(new ImageTask() { ImageName = file, TaskImage = t, Completed = false }); + //t.Start(); + + + + } + + Task.WhenAll(tasks).Start(); + + //tt.RunSynchronously(); + MaddoLogger.Log("Finished"); + DialogHelper.PopUpAlert("Finished", "message"); + }); + + + outerTask.Start(); + } + + private Task FileTask(string file) + { + MaddoLogger.Log("Starting task for image {0}", file); + IImageProcessor i = new ImgSharpCreator(); + + //ImageCreator2 i = new ImageCreator2(); + i.Start(new FileInfo(file)); + return null; + } + + private void CompleteFile(string file) { - // todo folder mode - - foreach (var file in Directory.EnumerateFiles(PicSettings.DirectorySorgente)) - { - IImageProcessor i = new ImgSharpCreator(); - - //ImageCreator2 i = new ImageCreator2(); - i.Start(new FileInfo(file)); - } - DialogHelper.PopUpAlert("Finished", "message"); } private void OpenSourceFolder() @@ -687,7 +729,7 @@ namespace WPFCatalog public string ColoreTestoRGB - { + { get { return PicSettings.ColoreTestoRGB; } set { From 0fb9f1aa1365f99000e73bc269e2ff4420ef0f6b Mon Sep 17 00:00:00 2001 From: Maddo Date: Wed, 20 Sep 2017 15:05:44 +0200 Subject: [PATCH 04/12] Text position --- WPFCatalog/Controls/GeneralSettingsControl.xaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/WPFCatalog/Controls/GeneralSettingsControl.xaml b/WPFCatalog/Controls/GeneralSettingsControl.xaml index 9f511c8..43b1e9c 100644 --- a/WPFCatalog/Controls/GeneralSettingsControl.xaml +++ b/WPFCatalog/Controls/GeneralSettingsControl.xaml @@ -144,8 +144,8 @@ - - + +