From 98a5f50776b1f58ac0df5606c830454a13210d44 Mon Sep 17 00:00:00 2001 From: Manuel Kamper Date: Thu, 29 Oct 2020 16:32:34 +0100 Subject: [PATCH] new feature: drag'n'drop --- Mk0.Software.MD5Generator/Main.Designer.cs | 5 ++++- Mk0.Software.MD5Generator/Main.cs | 21 +++++++++++++++++++ .../Mk0.Software.MD5Generator.csproj | 4 ++-- .../Properties/AssemblyInfo.cs | 4 ++-- 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/Mk0.Software.MD5Generator/Main.Designer.cs b/Mk0.Software.MD5Generator/Main.Designer.cs index 8eda91d..c6ab904 100644 --- a/Mk0.Software.MD5Generator/Main.Designer.cs +++ b/Mk0.Software.MD5Generator/Main.Designer.cs @@ -74,6 +74,7 @@ // // Main // + this.AllowDrop = true; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(384, 161); @@ -88,8 +89,10 @@ this.Name = "Main"; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "MD5 Generator v1.1 | © 2019-2020 by mk0.at"; + this.Text = "MD5 Generator v1.2 | © 2019-2020 by mk0.at"; this.Load += new System.EventHandler(this.Main_Load); + this.DragDrop += new System.Windows.Forms.DragEventHandler(this.Main_DragDrop); + this.DragEnter += new System.Windows.Forms.DragEventHandler(this.Main_DragEnter); this.ResumeLayout(false); this.PerformLayout(); diff --git a/Mk0.Software.MD5Generator/Main.cs b/Mk0.Software.MD5Generator/Main.cs index 97db3cc..1a70f46 100644 --- a/Mk0.Software.MD5Generator/Main.cs +++ b/Mk0.Software.MD5Generator/Main.cs @@ -46,5 +46,26 @@ namespace Mk0.Software.MD5Generator AutoUpdater.ShowSkipButton = false; AutoUpdater.Start("https://www.kmpr.at/update/md5generator.xml"); } + + private void Main_DragEnter(object sender, DragEventArgs e) + { + if (e.Data.GetDataPresent(DataFormats.FileDrop)) + e.Effect = DragDropEffects.Copy; + else + e.Effect = DragDropEffects.None; + } + + private void Main_DragDrop(object sender, DragEventArgs e) + { + string[] FileList = (string[])e.Data.GetData(DataFormats.FileDrop, false); + if (FileList.Length > 1) + { + MessageBox.Show("Nur eine Datei erlaubt!", "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + else + { + GenerateMD5(FileList[0]); + } + } } } diff --git a/Mk0.Software.MD5Generator/Mk0.Software.MD5Generator.csproj b/Mk0.Software.MD5Generator/Mk0.Software.MD5Generator.csproj index 23b4b99..42a4db8 100644 --- a/Mk0.Software.MD5Generator/Mk0.Software.MD5Generator.csproj +++ b/Mk0.Software.MD5Generator/Mk0.Software.MD5Generator.csproj @@ -12,6 +12,7 @@ 512 true true + false publish\ true Disk @@ -23,8 +24,7 @@ false true 0 - 1.1.0.%2a - false + 1.2.0.%2a false true diff --git a/Mk0.Software.MD5Generator/Properties/AssemblyInfo.cs b/Mk0.Software.MD5Generator/Properties/AssemblyInfo.cs index 4918368..b668124 100644 --- a/Mk0.Software.MD5Generator/Properties/AssemblyInfo.cs +++ b/Mk0.Software.MD5Generator/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, // indem Sie "*" wie unten gezeigt eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.1.0.0")] -[assembly: AssemblyFileVersion("1.1.0.0")] +[assembly: AssemblyVersion("1.2.0.0")] +[assembly: AssemblyFileVersion("1.2.0.0")]