bugfix regarding counting images

This commit is contained in:
Manuel Kamper 2022-08-16 14:36:58 +02:00
parent b1430d33e5
commit d69e071a0e
5 changed files with 16 additions and 20 deletions

1
.gitignore vendored
View File

@ -328,3 +328,4 @@ ASALocalRun/
# MFractors (Xamarin productivity tool) working folder
.mfractor/
/Iconset url.txt

View File

@ -821,7 +821,7 @@
this.MinimumSize = new System.Drawing.Size(983, 605);
this.Name = "Main";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Image Sorter v2.0 | © 2015-2022 by kmpr.at";
this.Text = "Image Sorter v2.1 | © 2015-2022 by kmpr.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);

View File

@ -24,7 +24,7 @@ namespace Mk0.Software.ImageSorter
{
public string quellPath = "";
public string zielPath = "";
private string[] fileTypes = { "jpg", "png", "jpeg", "gif", "tif", "tiff", "bmp", "webp", "JPG", "PNG", "GIF", "JPEG", "TIF", "TIFF", "BMP", "WEBP" };
private string[] fileTypes = { ".jpg", ".png", ".jpeg", ".gif", ".tif", ".tiff", ".bmp", ".webp" };
private int moved = 0;
private int imageIndex;
private List<Button> buttons = new List<Button>();
@ -44,7 +44,6 @@ namespace Mk0.Software.ImageSorter
private string startuppath;
private string startupimage;
public string[] Args;
private System.Timers.Timer t1 = new System.Timers.Timer(1200);
private FormWindowState lastState = FormWindowState.Minimized;
private string defaultWindowName;
@ -528,15 +527,9 @@ namespace Mk0.Software.ImageSorter
string[] folderButton = ctl.Text.Split('(');
int count = int.Parse(folderButton[1].Substring(0, folderButton[1].Length - 1)); //sollte das nicht später gezählt werden??
string targetPath = Path.Combine(zielPath, folderButton[0].Substring(0, folderButton[0].Length - 1));
foreach (string type in fileTypes)
foreach (string file in Directory.EnumerateFiles(targetPath, "*.*", System.IO.SearchOption.AllDirectories).Where(s => fileTypes.Any(ext => ext == Path.GetExtension(s))))
{
try
{
count += Directory.EnumerateFiles(targetPath, "*." + type, System.IO.SearchOption.AllDirectories).Count();
}
catch (Exception)
{
}
count++;
}
if (ctl.InvokeRequired)
ctl.Invoke(new Action(() => ctl.Text = folderButton[0] + "(" + count + ")"));
@ -620,13 +613,10 @@ namespace Mk0.Software.ImageSorter
private void SearchImages()
{
images.Clear();
foreach (string type in fileTypes)
foreach (string image in Directory.EnumerateFiles(quellPath, "*.*", System.IO.SearchOption.AllDirectories).Where(s => fileTypes.Any(ext => ext == Path.GetExtension(s))))
{
var list = Directory.GetFiles(quellPath, "*." + type).OrderBy(d => new FileInfo(d).Name);
foreach (string image in list)
{
images.Add(image);
}
images.Add(image);
}
}
@ -741,7 +731,12 @@ namespace Mk0.Software.ImageSorter
imageIndex = 0;
}
pictureBoxImage.ImageLocation = CropImageBorders(images.ElementAt(imageIndex));
Text = defaultWindowName + " - " + Path.GetFileName(pictureBoxImage.ImageLocation);
string resolutionTitle = "";
//if(pictureBoxImage.Image != null)
//{
// resolutionTitle = " (" + pictureBoxImage.Image.Width + "px x " + pictureBoxImage.Image.Height + "px)";
//}
Text = defaultWindowName + " - " + Path.GetFileName(pictureBoxImage.ImageLocation) + resolutionTitle;
}
else
{

View File

@ -33,7 +33,7 @@
<PublisherName>manuelkamper.com</PublisherName>
<OpenBrowserOnPublish>false</OpenBrowserOnPublish>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>2.0.0.0</ApplicationVersion>
<ApplicationVersion>2.1.0.0</ApplicationVersion>
<UseApplicationTrust>true</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut>
<ExcludeDeploymentUrl>true</ExcludeDeploymentUrl>

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.*")]
[assembly: AssemblyVersion("2.1.*")]
//[assembly: AssemblyFileVersion("1.6.0.0")]