From 32a7d146a0e4bc0594bf70c64dfc4fbe336df4ed Mon Sep 17 00:00:00 2001 From: Manuel Kamper Date: Sat, 13 Aug 2022 19:45:21 +0200 Subject: [PATCH] * Improved loading speed for the application where target folders contain a lot of images inside (async counting of the images) * More accurate counting of images in target folder (with filetypes in capital letters too and also counting images from subdirectories) --- Mk0.Software.ImageSorter/EXIF.cs | 30 ++++----- Mk0.Software.ImageSorter/Main.Designer.cs | 2 +- Mk0.Software.ImageSorter/Main.cs | 65 ++++++++++++++----- .../Mk0.Software.ImageSorter.csproj | 2 +- .../Properties/AssemblyInfo.cs | 2 +- Mk0.Software.ImageSorter/Settings.cs | 20 +++--- 6 files changed, 79 insertions(+), 42 deletions(-) diff --git a/Mk0.Software.ImageSorter/EXIF.cs b/Mk0.Software.ImageSorter/EXIF.cs index 30e9fc9..0374196 100644 --- a/Mk0.Software.ImageSorter/EXIF.cs +++ b/Mk0.Software.ImageSorter/EXIF.cs @@ -79,7 +79,7 @@ namespace Mk0.Software.ImageSorter } else if (type == 3) { - for (int i = 0; i < len; i = i + BYTEJUMP_SHORT) + for (int i = 0; i < len; i += BYTEJUMP_SHORT) { ushort val = BitConverter.ToUInt16(value, i); ev += val.ToString(); @@ -89,7 +89,7 @@ namespace Mk0.Software.ImageSorter } else if (type == 4) { - for (int i = 0; i < len; i = i + BYTEJUMP_LONG) + for (int i = 0; i < len; i += BYTEJUMP_LONG) { uint val = BitConverter.ToUInt32(value, i); ev += val.ToString(); @@ -99,7 +99,7 @@ namespace Mk0.Software.ImageSorter } else if (type == 5) { - for (int i = 0; i < len; i = i + BYTEJUMP_RATIONAL) + for (int i = 0; i < len; i += BYTEJUMP_RATIONAL) { uint numer = BitConverter.ToUInt32(value, i); uint denom = BitConverter.ToUInt32(value, i + BYTEJUMP_LONG); @@ -138,7 +138,7 @@ namespace Mk0.Software.ImageSorter { try { - for (int i = 0; i < len; i = i + BYTEJUMP_SLONG) + for (int i = 0; i < len; i += BYTEJUMP_SLONG) { int val = BitConverter.ToInt32(value, i); ev += val.ToString(); @@ -153,7 +153,7 @@ namespace Mk0.Software.ImageSorter } else if (type == 10) { - for (int i = 0; i < len; i = i + BYTEJUMP_SRATIONAL) + for (int i = 0; i < len; i += BYTEJUMP_SRATIONAL) { int numer = BitConverter.ToInt32(value, i); int denom = BitConverter.ToInt32(value, i + BYTEJUMP_SLONG); @@ -481,8 +481,8 @@ namespace Mk0.Software.ImageSorter // Make the numerator "store" the sign if (denom < 0) { - numer = numer * -1; - denom = denom * -1; + numer *= -1; + denom *= -1; } Reduce(ref numer, ref denom); @@ -507,8 +507,8 @@ namespace Mk0.Software.ImageSorter { Int32 common = GCD(Math.Abs(numer), denom); - numer = numer / common; - denom = denom / common; + numer /= common; + denom /= common; } } @@ -519,9 +519,9 @@ namespace Mk0.Software.ImageSorter { while (num1 != num2) if (num1 > num2) - num1 = num1 - num2; + num1 -= num2; else - num2 = num2 - num1; + num2 -= num1; return num1; } @@ -569,8 +569,8 @@ namespace Mk0.Software.ImageSorter { UInt32 common = GCD(numer, denom); - numer = numer / common; - denom = denom / common; + numer /= common; + denom /= common; } } @@ -581,9 +581,9 @@ namespace Mk0.Software.ImageSorter { while (num1 != num2) if (num1 > num2) - num1 = num1 - num2; + num1 -= num2; else - num2 = num2 - num1; + num2 -= num1; return num1; } diff --git a/Mk0.Software.ImageSorter/Main.Designer.cs b/Mk0.Software.ImageSorter/Main.Designer.cs index 85f0eac..94d99a9 100644 --- a/Mk0.Software.ImageSorter/Main.Designer.cs +++ b/Mk0.Software.ImageSorter/Main.Designer.cs @@ -693,7 +693,7 @@ this.MinimumSize = new System.Drawing.Size(983, 605); this.Name = "Main"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Image Sorter v1.57 | © 2015-2022 by mk0.at"; + this.Text = "Image Sorter v1.58 | © 2015-2022 by mk0.at"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Main_FormClosing); this.Load += new System.EventHandler(this.Main_Load); this.Shown += new System.EventHandler(this.Main_Shown); diff --git a/Mk0.Software.ImageSorter/Main.cs b/Mk0.Software.ImageSorter/Main.cs index cf23333..41a6a12 100644 --- a/Mk0.Software.ImageSorter/Main.cs +++ b/Mk0.Software.ImageSorter/Main.cs @@ -16,6 +16,7 @@ using System.Linq; using System.Threading; using System.Windows.Forms; using Mk0.Software.OnlineUpdater; +using System.Threading.Tasks; namespace Mk0.Software.ImageSorter { @@ -23,7 +24,7 @@ namespace Mk0.Software.ImageSorter { public string quellPath = ""; public string zielPath = ""; - private string[] fileTypes = { "jpg", "png", "jpeg", "gif", "tif", "tiff", "bmp" }; + private string[] fileTypes = { "jpg", "png", "jpeg", "gif", "tif", "tiff", "bmp", "JPG", "PNG", "GIF", "JPEG", "TIF", "TIFF", "BMP" }; private int moved = 0; private int imageIndex; private List