implemented #6

This commit is contained in:
Manuel Kamper 2020-03-22 10:18:02 +01:00
parent 7f6a3d2df9
commit 8537f974d7
5 changed files with 16 additions and 10 deletions

View File

@ -693,7 +693,7 @@
this.MinimumSize = new System.Drawing.Size(983, 605); this.MinimumSize = new System.Drawing.Size(983, 605);
this.Name = "Main"; this.Name = "Main";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Image Sorter v1.52 | © 2015-2020 by mk0.at"; this.Text = "Image Sorter v1.53 | © 2015-2020 by mk0.at";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Main_FormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Main_FormClosing);
this.Load += new System.EventHandler(this.Main_Load); this.Load += new System.EventHandler(this.Main_Load);
this.Shown += new System.EventHandler(this.Main_Shown); this.Shown += new System.EventHandler(this.Main_Shown);

View File

@ -470,8 +470,7 @@ namespace Mk0.Software.ImageSorter
/// <returns></returns> /// <returns></returns>
private int GetImageIndex(string image) private int GetImageIndex(string image)
{ {
int index = 0; int index = images.IndexOf(image);
index = images.IndexOf(image);
return index; return index;
} }
@ -645,16 +644,16 @@ namespace Mk0.Software.ImageSorter
try try
{ {
string fullTargetPath = Path.Combine(targetPath, Path.GetFileName(pictureBoxImage.ImageLocation)); string fullTargetPath = Path.Combine(targetPath, CleanFileName(Path.GetFileName(pictureBoxImage.ImageLocation)));
Image myImg = CopyImage.GetCopyImage(pictureBoxImage.ImageLocation); Image myImg = CopyImage.GetCopyImage(pictureBoxImage.ImageLocation);
if (File.Exists(fullTargetPath)) if (File.Exists(fullTargetPath))
{ {
using (var form = new Vergleicher("Das zu verschiebende Bild \"" + Path.GetFileName(pictureBoxImage.ImageLocation) + "\"" + "existiert im Zielverzeichnis \"" + btn.Text + "\" bereits." + Environment.NewLine + Environment.NewLine + "Soll eine Kopie angelegt werden? Nein überschreibt die Datei, Abbrechen bricht den Vorgang ab.", pictureBoxImage.ImageLocation, fullTargetPath)) using (var form = new Vergleicher("Das zu verschiebende Bild \"" + CleanFileName(Path.GetFileName(pictureBoxImage.ImageLocation)) + "\"" + "existiert im Zielverzeichnis \"" + btn.Text + "\" bereits." + Environment.NewLine + Environment.NewLine + "Soll eine Kopie angelegt werden? Nein überschreibt die Datei, Abbrechen bricht den Vorgang ab.", pictureBoxImage.ImageLocation, fullTargetPath))
{ {
var result = form.ShowDialog(); var result = form.ShowDialog();
if (result == DialogResult.Yes) if (result == DialogResult.Yes)
{ {
fullTargetPath = Path.Combine(targetPath, Path.GetFileNameWithoutExtension(pictureBoxImage.ImageLocation) + Randomize.NumbersAndDigits(5, "_") + Path.GetExtension(pictureBoxImage.ImageLocation)); fullTargetPath = Path.Combine(targetPath, CleanFileName(Path.GetFileNameWithoutExtension(pictureBoxImage.ImageLocation)) + Randomize.NumbersAndDigits(5, "_") + Path.GetExtension(pictureBoxImage.ImageLocation));
} }
else if (result == DialogResult.No) else if (result == DialogResult.No)
{ {
@ -703,6 +702,14 @@ namespace Mk0.Software.ImageSorter
} }
} }
private string CleanFileName(string filename)
{
string fn = filename;
fn = fn.Replace("_crp", "");
fn = fn.Replace("_cut", "");
return fn;
}
/// <summary> /// <summary>
/// Blinkender Button nach erfolgreichem Verschieben /// Blinkender Button nach erfolgreichem Verschieben
/// </summary> /// </summary>
@ -1288,8 +1295,6 @@ namespace Mk0.Software.ImageSorter
/// <param name="e"></param> /// <param name="e"></param>
private void Main_KeyDown(object sender, KeyEventArgs e) private void Main_KeyDown(object sender, KeyEventArgs e)
{ {
int x = e.KeyValue;
if (e.KeyCode == Keys.Delete) if (e.KeyCode == Keys.Delete)
{ {
buttonDeleteImage.PerformClick(); buttonDeleteImage.PerformClick();

View File

@ -33,7 +33,7 @@
<PublisherName>manuelkamper.com</PublisherName> <PublisherName>manuelkamper.com</PublisherName>
<OpenBrowserOnPublish>false</OpenBrowserOnPublish> <OpenBrowserOnPublish>false</OpenBrowserOnPublish>
<ApplicationRevision>0</ApplicationRevision> <ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.52.0.0</ApplicationVersion> <ApplicationVersion>1.53.0.0</ApplicationVersion>
<UseApplicationTrust>true</UseApplicationTrust> <UseApplicationTrust>true</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut> <CreateDesktopShortcut>true</CreateDesktopShortcut>
<ExcludeDeploymentUrl>true</ExcludeDeploymentUrl> <ExcludeDeploymentUrl>true</ExcludeDeploymentUrl>
@ -177,6 +177,7 @@
<None Include="App.config" /> <None Include="App.config" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="Mk0.Software.OnlineUpdater.dll" />
<Content Include="Resources\bmp.ico" /> <Content Include="Resources\bmp.ico" />
<None Include="Resources\duplicate.png" /> <None Include="Resources\duplicate.png" />
<Content Include="Resources\gif.ico" /> <Content Include="Resources\gif.ico" />

View File

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