From 1405914f90303254516825e943dd840bcf84c872 Mon Sep 17 00:00:00 2001 From: hcnqs <381281@qq.com> Date: Thu, 12 Oct 2023 20:54:28 +0800 Subject: [PATCH] qq381281 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加拖拽目录至程序窗口,引入NCM目录的功能和描述,免的去费劲选目录。 添加自动生成输出目录的功能,免的费事。 --- ncmdumpGUI/Main.Designer.cs | 7 +++++-- ncmdumpGUI/Main.cs | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/ncmdumpGUI/Main.Designer.cs b/ncmdumpGUI/Main.Designer.cs index 995aa0e..adb36ee 100644 --- a/ncmdumpGUI/Main.Designer.cs +++ b/ncmdumpGUI/Main.Designer.cs @@ -65,9 +65,9 @@ private void InitializeComponent() this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(10, 21); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(125, 12); + this.label3.Size = new System.Drawing.Size(311, 12); this.label3.TabIndex = 0; - this.label3.Text = "将ncm文件转成mp3文件"; + this.label3.Text = "将ncm文件转成mp3文件,可拖拽NCM文件夹至本程序窗口。"; // // groupBox1 // @@ -129,6 +129,7 @@ private void InitializeComponent() // // Main // + this.AllowDrop = true; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(533, 204); @@ -144,6 +145,8 @@ private void InitializeComponent() this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "ncmdumpGUI by kpali v1.2"; this.Load += new System.EventHandler(this.Main_Load); + this.DragDrop += new System.Windows.Forms.DragEventHandler(this.Form1_DragDrop); + this.DragEnter += new System.Windows.Forms.DragEventHandler(this.Form1_DragEnter); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.ResumeLayout(false); diff --git a/ncmdumpGUI/Main.cs b/ncmdumpGUI/Main.cs index 961dc43..3ffdadf 100644 --- a/ncmdumpGUI/Main.cs +++ b/ncmdumpGUI/Main.cs @@ -169,5 +169,26 @@ private void ConvertProc() } } } + + + private void Form1_DragEnter(object sender, DragEventArgs e) + { + + if (e.Data.GetDataPresent(DataFormats.FileDrop)) + e.Effect = DragDropEffects.Link; + else e.Effect = DragDropEffects.None; + } + + private void Form1_DragDrop(object sender, DragEventArgs e) + { + + string path = ((System.Array)e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString(); + txtNcmFolderPath.Text = path; + txtMp3FolderPath.Text = path + "_MP3"; + if (!Directory.Exists(txtMp3FolderPath.Text)) + { + Directory.CreateDirectory(txtMp3FolderPath.Text); + } + } } }