Release v1.0

+ Finished GUI
+ Added global hotkeys
+ Added support for multiple file types
+ Bug fixes
master v1.0.0
Aaron 3 years ago
parent f0f353eba7
commit 62c79ddbb6

3
.gitignore vendored

@ -0,0 +1,3 @@
photo_sorter/bin/Debug/*
photo_sorter/bin/Release/*
photo_sorter/bin/*

144
Form1.Designer.cs generated

@ -59,20 +59,30 @@ namespace photo_sorter
this.lbl_sort_secondary = new System.Windows.Forms.Label();
this.tbox_sort_primary = new System.Windows.Forms.TextBox();
this.lbl_sort_primary = new System.Windows.Forms.Label();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.status_bar = new System.Windows.Forms.StatusStrip();
this.stat_last_action = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripSpacer = new System.Windows.Forms.ToolStripStatusLabel();
this.pbar = new System.Windows.Forms.ToolStripProgressBar();
this.split_container_main = new System.Windows.Forms.SplitContainer();
this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
this.stat_bar_label = new System.Windows.Forms.ToolStripStatusLabel();
this.gbox_photo_type = new System.Windows.Forms.GroupBox();
this.rad_nef = new System.Windows.Forms.RadioButton();
this.rad_cr2 = new System.Windows.Forms.RadioButton();
this.rad_jpeg = new System.Windows.Forms.RadioButton();
this.rad_png = new System.Windows.Forms.RadioButton();
this.rad_dng = new System.Windows.Forms.RadioButton();
this.menuStrip1.SuspendLayout();
this.gbox_preview.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.img_preview)).BeginInit();
this.gbox_info.SuspendLayout();
this.gbox_copybool.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.status_bar.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.split_container_main)).BeginInit();
this.split_container_main.Panel1.SuspendLayout();
this.split_container_main.Panel2.SuspendLayout();
this.split_container_main.SuspendLayout();
this.gbox_photo_type.SuspendLayout();
this.SuspendLayout();
//
// menuStrip1
@ -223,6 +233,7 @@ namespace photo_sorter
this.gbox_info.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.gbox_info.Controls.Add(this.gbox_photo_type);
this.gbox_info.Controls.Add(this.btn_reload_src);
this.gbox_info.Controls.Add(this.btn_open_src_dir);
this.gbox_info.Controls.Add(this.btn_open_dest_dir);
@ -318,9 +329,10 @@ namespace photo_sorter
//
// gbox_copybool
//
this.gbox_copybool.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.gbox_copybool.Controls.Add(this.rad_sort_move);
this.gbox_copybool.Controls.Add(this.rad_sort_copy);
this.gbox_copybool.Location = new System.Drawing.Point(6, 151);
this.gbox_copybool.Location = new System.Drawing.Point(234, 151);
this.gbox_copybool.Name = "gbox_copybool";
this.gbox_copybool.Size = new System.Drawing.Size(111, 71);
this.gbox_copybool.TabIndex = 4;
@ -385,15 +397,18 @@ namespace photo_sorter
this.lbl_sort_primary.TabIndex = 0;
this.lbl_sort_primary.Text = "Primary Sort (e.g. Event Name):";
//
// statusStrip1
// status_bar
//
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.stat_last_action});
this.statusStrip1.Location = new System.Drawing.Point(0, 572);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(1101, 22);
this.statusStrip1.TabIndex = 3;
this.statusStrip1.Text = "statusStrip1";
this.status_bar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.stat_last_action,
this.toolStripSpacer,
this.stat_bar_label,
this.pbar});
this.status_bar.Location = new System.Drawing.Point(0, 572);
this.status_bar.Name = "status_bar";
this.status_bar.Size = new System.Drawing.Size(1101, 22);
this.status_bar.TabIndex = 3;
this.status_bar.Text = "statusStrip1";
//
// stat_last_action
//
@ -402,6 +417,19 @@ namespace photo_sorter
this.stat_last_action.Text = "Program started";
this.stat_last_action.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// toolStripSpacer
//
this.toolStripSpacer.Name = "toolStripSpacer";
this.toolStripSpacer.Size = new System.Drawing.Size(784, 17);
this.toolStripSpacer.Spring = true;
//
// pbar
//
this.pbar.Name = "pbar";
this.pbar.Overflow = System.Windows.Forms.ToolStripItemOverflow.Always;
this.pbar.Padding = new System.Windows.Forms.Padding(0, 0, 8, 0);
this.pbar.Size = new System.Drawing.Size(208, 16);
//
// split_container_main
//
this.split_container_main.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@ -423,19 +451,92 @@ namespace photo_sorter
this.split_container_main.SplitterDistance = 359;
this.split_container_main.TabIndex = 4;
//
// stat_bar_label
//
this.stat_bar_label.Name = "stat_bar_label";
this.stat_bar_label.Size = new System.Drawing.Size(59, 17);
this.stat_bar_label.Text = "Loading...";
this.stat_bar_label.Visible = false;
//
// gbox_photo_type
//
this.gbox_photo_type.Controls.Add(this.rad_dng);
this.gbox_photo_type.Controls.Add(this.rad_png);
this.gbox_photo_type.Controls.Add(this.rad_jpeg);
this.gbox_photo_type.Controls.Add(this.rad_nef);
this.gbox_photo_type.Controls.Add(this.rad_cr2);
this.gbox_photo_type.Location = new System.Drawing.Point(7, 151);
this.gbox_photo_type.Name = "gbox_photo_type";
this.gbox_photo_type.Size = new System.Drawing.Size(142, 137);
this.gbox_photo_type.TabIndex = 6;
this.gbox_photo_type.TabStop = false;
this.gbox_photo_type.Text = "File Type";
//
// rad_nef
//
this.rad_nef.AutoSize = true;
this.rad_nef.Checked = true;
this.rad_nef.Location = new System.Drawing.Point(6, 19);
this.rad_nef.Name = "rad_nef";
this.rad_nef.Size = new System.Drawing.Size(108, 17);
this.rad_nef.TabIndex = 4;
this.rad_nef.TabStop = true;
this.rad_nef.Text = "NEF (Nikon Raw)";
this.rad_nef.UseVisualStyleBackColor = true;
//
// rad_cr2
//
this.rad_cr2.AutoSize = true;
this.rad_cr2.Location = new System.Drawing.Point(6, 42);
this.rad_cr2.Name = "rad_cr2";
this.rad_cr2.Size = new System.Drawing.Size(111, 17);
this.rad_cr2.TabIndex = 5;
this.rad_cr2.Text = "CR2 (Canon Raw)";
this.rad_cr2.UseVisualStyleBackColor = true;
//
// rad_jpeg
//
this.rad_jpeg.AutoSize = true;
this.rad_jpeg.Location = new System.Drawing.Point(6, 88);
this.rad_jpeg.Name = "rad_jpeg";
this.rad_jpeg.Size = new System.Drawing.Size(45, 17);
this.rad_jpeg.TabIndex = 7;
this.rad_jpeg.Text = "JPG";
this.rad_jpeg.UseVisualStyleBackColor = true;
//
// rad_png
//
this.rad_png.AutoSize = true;
this.rad_png.Location = new System.Drawing.Point(6, 111);
this.rad_png.Name = "rad_png";
this.rad_png.Size = new System.Drawing.Size(48, 17);
this.rad_png.TabIndex = 8;
this.rad_png.Text = "PNG";
this.rad_png.UseVisualStyleBackColor = true;
//
// rad_dng
//
this.rad_dng.AutoSize = true;
this.rad_dng.Location = new System.Drawing.Point(6, 65);
this.rad_dng.Name = "rad_dng";
this.rad_dng.Size = new System.Drawing.Size(133, 17);
this.rad_dng.TabIndex = 6;
this.rad_dng.Text = "DNG (Digital Negative)";
this.rad_dng.UseVisualStyleBackColor = true;
//
// form_main
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1101, 594);
this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.status_bar);
this.Controls.Add(this.menuStrip1);
this.Controls.Add(this.split_container_main);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.menuStrip1;
this.MinimumSize = new System.Drawing.Size(768, 480);
this.Name = "form_main";
this.Text = "Skyfall Photo Sorter v0.1";
this.Text = "Skyfall Photo Sorter";
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.gbox_preview.ResumeLayout(false);
@ -445,12 +546,14 @@ namespace photo_sorter
this.gbox_info.PerformLayout();
this.gbox_copybool.ResumeLayout(false);
this.gbox_copybool.PerformLayout();
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.status_bar.ResumeLayout(false);
this.status_bar.PerformLayout();
this.split_container_main.Panel1.ResumeLayout(false);
this.split_container_main.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.split_container_main)).EndInit();
this.split_container_main.ResumeLayout(false);
this.gbox_photo_type.ResumeLayout(false);
this.gbox_photo_type.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@ -479,7 +582,7 @@ namespace photo_sorter
private System.Windows.Forms.Label lbl_sort_secondary;
private System.Windows.Forms.TextBox tbox_sort_primary;
private System.Windows.Forms.Label lbl_sort_primary;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.StatusStrip status_bar;
private System.Windows.Forms.ToolStripStatusLabel stat_last_action;
private System.Windows.Forms.SplitContainer split_container_main;
private System.Windows.Forms.TextBox tbox_source_dir;
@ -491,6 +594,15 @@ namespace photo_sorter
private System.Windows.Forms.ToolStripMenuItem selectDestinationDirectoryToolStripMenuItem;
private System.Windows.Forms.Button btn_reload_src;
private System.Windows.Forms.Label lbl_counter;
private System.Windows.Forms.ToolStripStatusLabel toolStripSpacer;
private System.Windows.Forms.ToolStripProgressBar pbar;
private System.Windows.Forms.ToolStripStatusLabel stat_bar_label;
private System.Windows.Forms.GroupBox gbox_photo_type;
private System.Windows.Forms.RadioButton rad_nef;
private System.Windows.Forms.RadioButton rad_cr2;
private System.Windows.Forms.RadioButton rad_png;
private System.Windows.Forms.RadioButton rad_jpeg;
private System.Windows.Forms.RadioButton rad_dng;
}
}

@ -1,11 +1,11 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
//using System.Collections.Generic;
//using System.ComponentModel;
//using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//using System.Linq;
//using System.Text;
//using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using ImageMagick;
@ -54,6 +54,7 @@ namespace photo_sorter
break;
}
stat_last_action.Text = mtype + ": " + msg;
status_bar.Update();
}
private void update_counter()
@ -66,12 +67,12 @@ namespace photo_sorter
global.filenames = populate_file_names();
global.filecount = global.filenames.Length;
global.position = 0;
status_msg("Source directory updated, found " + global.filecount.ToString() + " images");
if (global.filecount > 0)
{
gbox_preview.Enabled = true;
lbl_counter.Text = (global.position + 1).ToString() + " of " + global.filecount.ToString();
update_image();
status_msg("Source directory updated, found " + global.filecount.ToString() + " images");
}
else
{
@ -86,6 +87,7 @@ namespace photo_sorter
{
global.src = folderBrowserDialog1.SelectedPath;
tbox_source_dir.Text = global.src;
status_msg("Opening source directory: " + global.src);
btn_reload_src.Enabled = true;
reload_source();
}
@ -112,6 +114,20 @@ namespace photo_sorter
}
else
{
pbar.Value = 6;
pbar.Value -= 1;
stat_bar_label.Visible = true;
if (global.filecount <= 1)
{
btn_next.Enabled = false;
btn_prev.Enabled = false;
}
else
{
btn_next.Enabled = true;
btn_prev.Enabled = true;
}
status_bar.Refresh();
fname = global.filenames[global.position];
/* v0.1.1 Preview
using (var jpegThumbnail = new MagickImage(fname))
@ -122,17 +138,25 @@ namespace photo_sorter
jpegThumbnail.Write(global.dest + "\\.tmp.jpg");
}
*/
pbar.Value += 5;
Image img;
using (MemoryStream img_stream = new MemoryStream())
{
pbar.Value += 10;
lbl_current_fname.Text = "Loading: " + Path.GetFileName(fname);
img_preview.Visible = false;
gbox_preview.Enabled = false;
pbar.Value += 10;
// Convert RAW file to JPEG in memory
using (var raw_img = new MagickImage(fname))
{
if (raw_img != null)
{
pbar.Value += 50;
raw_img.AutoOrient();
img_stream.Position = 0;
raw_img.Write(img_stream, ImageMagick.MagickFormat.Jpeg);
pbar.Value += 15;
}
}
@ -141,19 +165,40 @@ namespace photo_sorter
{
img = new Bitmap(bmp);
}
pbar.Value -= 1;
pbar.Value += 6;
//pbar.Value -= 1;
}
img_preview.Image = img;
img_preview.Visible = true;
gbox_preview.Enabled = true;
stat_bar_label.Visible = false;
GC.Collect();
GC.WaitForPendingFinalizers();
}
lbl_current_fname.Text = Path.GetFileName(fname);
if (global.filecount > 0)
status_msg("Loaded image: " + lbl_current_fname.Text);
update_counter();
pbar.Value = 0;
}
public string[] populate_file_names()
{
string[] files = Directory.GetFiles(global.src, "*.nef");
string ext = "";
if (rad_nef.Checked)
ext = "nef";
if (rad_cr2.Checked)
ext = "cr2";
if (rad_dng.Checked)
ext = "dng";
if (rad_jpeg.Checked)
ext = "jpg";
if (rad_png.Checked)
ext = "png";
string[] files = Directory.GetFiles(global.src, "*." + ext);
return files;
}
@ -171,58 +216,51 @@ namespace photo_sorter
}
}
//
// UI Interactions
//
///////////////////////////////////////////////////////
private void btn_open_dir_Click(object sender, EventArgs e)
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
select_dest_dir();
if (keyData == Keys.Enter)
{
sort_image();
return true;
}
private void openDirectoryToolStripMenuItem_Click(object sender, EventArgs e)
if (keyData == Keys.PageUp)
{
select_source_dir();
if (global.filecount > 1)
prev_image();
return true;
}
private void selectDestinationDirectoryToolStripMenuItem_Click(object sender, EventArgs e)
if (keyData == Keys.PageDown)
{
select_dest_dir();
if (global.filecount > 1)
next_image();
return true;
}
private void quitApplicationToolStripMenuItem_Click(object sender, EventArgs e)
if (keyData == Keys.Home)
{
if (MessageBox.Show("Are you sure you want to quit the Photo Sorter application?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
if (global.filecount > 1)
{
this.Close();
}
}
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
{
MessageBox.Show("This application is Copyright Skyfall Tech, 2022.\n\nPlease visit https://www.skyfall.tech/ for more information.");
}
private void btn_open_src_dir_Click(object sender, EventArgs e)
{
select_source_dir();
}
private void btn_prev_Click(object sender, EventArgs e)
{
if (global.position > 0)
{
global.position -= 1;
}
else
{
global.position = global.filecount - 1;
}
status_msg("Loading first image...");
global.position = 0;
update_image();
}
private void btn_next_Click(object sender, EventArgs e)
return true;
}
if (keyData == Keys.End)
{
if (global.filecount > 1)
{
status_msg("Loading final image...");
global.position = global.filecount - 1;
update_image();
}
return true;
}
return base.ProcessCmdKey(ref msg, keyData);
}
public void next_image()
{
status_msg("Loading next image...");
if (global.position < global.filecount - 1)
{
global.position += 1;
@ -234,7 +272,21 @@ namespace photo_sorter
update_image();
}
private void btn_sort_Click(object sender, EventArgs e)
public void prev_image()
{
status_msg("Loading previous image...");
if (global.position > 0)
{
global.position -= 1;
}
else
{
global.position = global.filecount - 1;
}
update_image();
}
public void sort_image()
{
string prim_dir = global.dest + '\\' + tbox_sort_primary.Text;
string sec_dir = prim_dir + '\\' + tbox_sort_secondary.Text;
@ -250,7 +302,7 @@ namespace photo_sorter
if (tbox_sort_primary.Text == "")
{
status_msg("Primary sort field required to sort!",3);
status_msg("Primary sort field required to sort!", 3);
//System.Media.SystemSounds.Exclamation.Play();
//MessageBox.Show("Primary sort directory name is required!", "Error: Primary Sort", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
@ -334,6 +386,58 @@ namespace photo_sorter
}
}
//
// UI Interactions
//
///////////////////////////////////////////////////////
private void btn_open_dir_Click(object sender, EventArgs e)
{
select_dest_dir();
}
private void openDirectoryToolStripMenuItem_Click(object sender, EventArgs e)
{
select_source_dir();
}
private void selectDestinationDirectoryToolStripMenuItem_Click(object sender, EventArgs e)
{
select_dest_dir();
}
private void quitApplicationToolStripMenuItem_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Are you sure you want to quit the Photo Sorter application?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
this.Close();
}
}
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
{
MessageBox.Show("Photo Sorter v1.0.0\n\nThis application is Copyright Skyfall Tech, 2022.\n\nPlease visit https://www.skyfall.tech/ for more information.");
}
private void btn_open_src_dir_Click(object sender, EventArgs e)
{
select_source_dir();
}
private void btn_prev_Click(object sender, EventArgs e)
{
prev_image();
}
private void btn_next_Click(object sender, EventArgs e)
{
next_image();
}
private void btn_sort_Click(object sender, EventArgs e)
{
sort_image();
}
private void btn_reload_src_Click(object sender, EventArgs e)
{
reload_source();

@ -118,7 +118,7 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
<value>124, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="img_preview.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
@ -980,11 +980,11 @@
gtej6D1kkchVhv8PA7DgsGEYfwEAAAAASUVORK5CYII=
</value>
</data>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>132, 17</value>
<metadata name="status_bar.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="folderBrowserDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>248, 17</value>
<value>239, 17</value>
</metadata>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -14,6 +14,7 @@
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
@ -25,8 +26,7 @@
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>0.1.1.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>

@ -11,8 +11,8 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{68A4768D-35D5-4F22-98C8-0B7CD754E0CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{68A4768D-35D5-4F22-98C8-0B7CD754E0CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{68A4768D-35D5-4F22-98C8-0B7CD754E0CE}.Debug|Any CPU.ActiveCfg = Release|Any CPU
{68A4768D-35D5-4F22-98C8-0B7CD754E0CE}.Debug|Any CPU.Build.0 = Release|Any CPU
{68A4768D-35D5-4F22-98C8-0B7CD754E0CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{68A4768D-35D5-4F22-98C8-0B7CD754E0CE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection

Loading…
Cancel
Save