From a40f35d7998dc33974bf6b79e611105ca7bd8e40 Mon Sep 17 00:00:00 2001 From: MeFiddzy <146439646+MeFiddzy@users.noreply.github.com> Date: Fri, 9 May 2025 19:15:05 +0300 Subject: [PATCH 1/2] Update --- Form1.Designer.cs | 14 ++++++++++++++ Form1.cs | 11 +++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/Form1.Designer.cs b/Form1.Designer.cs index ed46ba6..b3f60b1 100644 --- a/Form1.Designer.cs +++ b/Form1.Designer.cs @@ -45,6 +45,7 @@ private void InitializeComponent() b14 = new Button(); b13 = new Button(); buttonS = new Button(); + buttonrRe = new Button(); SuspendLayout(); // // b1 @@ -234,11 +235,23 @@ private void InitializeComponent() buttonS.UseVisualStyleBackColor = true; buttonS.Click += buttonS_Click; // + // buttonrRe + // + buttonrRe.Font = new Font("Segoe UI", 20F); + buttonrRe.Location = new Point(453, 481); + buttonrRe.Name = "buttonrRe"; + buttonrRe.Size = new Size(217, 92); + buttonrRe.TabIndex = 17; + buttonrRe.Text = "Reload Soundboard"; + buttonrRe.UseVisualStyleBackColor = true; + buttonrRe.Click += buttonrRe_Click; + // // Form1 // AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(1026, 618); + Controls.Add(buttonrRe); Controls.Add(buttonS); Controls.Add(b16); Controls.Add(b15); @@ -280,5 +293,6 @@ private void InitializeComponent() private Button b14; private Button b13; private Button buttonS; + private Button buttonrRe; } } diff --git a/Form1.cs b/Form1.cs index 29b42aa..a50d996 100644 --- a/Form1.cs +++ b/Form1.cs @@ -15,8 +15,11 @@ public partial class Form1 : Form public Form1() { InitializeComponent(); + reloadS(); + } - + public void reloadS() + { sounds = Directory.GetFiles(Path.Combine(path, "Sounds"), "*.wav"); if (sounds.Length == 0) @@ -42,7 +45,6 @@ public Form1() } } } - private void playSound(string path) { try @@ -112,5 +114,10 @@ private void buttonS_Click(object sender, EventArgs e) { stopAllSounds(); } + + private void buttonrRe_Click(object sender, EventArgs e) + { + reloadS(); + } } } From b2237ece6a527bb3f39aa3aa221b1474c695f857 Mon Sep 17 00:00:00 2001 From: MeFiddzy <146439646+MeFiddzy@users.noreply.github.com> Date: Fri, 9 May 2025 19:30:52 +0300 Subject: [PATCH 2/2] Features --- Form1.Designer.cs | 32 ++++++++++++++++++++++++++++++-- Form1.cs | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 2 deletions(-) diff --git a/Form1.Designer.cs b/Form1.Designer.cs index b3f60b1..d51bddf 100644 --- a/Form1.Designer.cs +++ b/Form1.Designer.cs @@ -46,6 +46,8 @@ private void InitializeComponent() b13 = new Button(); buttonS = new Button(); buttonrRe = new Button(); + buttonUp = new Button(); + buttonOp = new Button(); SuspendLayout(); // // b1 @@ -227,7 +229,7 @@ private void InitializeComponent() // buttonS // buttonS.Font = new Font("Segoe UI", 20F); - buttonS.Location = new Point(695, 481); + buttonS.Location = new Point(767, 486); buttonS.Name = "buttonS"; buttonS.Size = new Size(217, 92); buttonS.TabIndex = 16; @@ -238,7 +240,7 @@ private void InitializeComponent() // buttonrRe // buttonrRe.Font = new Font("Segoe UI", 20F); - buttonrRe.Location = new Point(453, 481); + buttonrRe.Location = new Point(525, 486); buttonrRe.Name = "buttonrRe"; buttonrRe.Size = new Size(217, 92); buttonrRe.TabIndex = 17; @@ -246,11 +248,35 @@ private void InitializeComponent() buttonrRe.UseVisualStyleBackColor = true; buttonrRe.Click += buttonrRe_Click; // + // buttonUp + // + buttonUp.Font = new Font("Segoe UI", 20F); + buttonUp.Location = new Point(278, 486); + buttonUp.Name = "buttonUp"; + buttonUp.Size = new Size(217, 92); + buttonUp.TabIndex = 18; + buttonUp.Text = "Upload files"; + buttonUp.UseVisualStyleBackColor = true; + buttonUp.Click += buttonUp_Click; + // + // buttonOp + // + buttonOp.Font = new Font("Segoe UI", 20F); + buttonOp.Location = new Point(54, 486); + buttonOp.Name = "buttonOp"; + buttonOp.Size = new Size(217, 92); + buttonOp.TabIndex = 19; + buttonOp.Text = "Open sound folder"; + buttonOp.UseVisualStyleBackColor = true; + buttonOp.Click += buttonOp_Click; + // // Form1 // AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(1026, 618); + Controls.Add(buttonOp); + Controls.Add(buttonUp); Controls.Add(buttonrRe); Controls.Add(buttonS); Controls.Add(b16); @@ -294,5 +320,7 @@ private void InitializeComponent() private Button b13; private Button buttonS; private Button buttonrRe; + private Button buttonUp; + private Button buttonOp; } } diff --git a/Form1.cs b/Form1.cs index a50d996..39a883e 100644 --- a/Form1.cs +++ b/Form1.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Media; using System.Windows.Forms; @@ -36,6 +37,7 @@ public void reloadS() if (i < sounds.Length) { string fileName = Path.GetFileNameWithoutExtension(sounds[i]); + buttons[i].Enabled = true; buttons[i].Text = fileName; } else @@ -119,5 +121,47 @@ private void buttonrRe_Click(object sender, EventArgs e) { reloadS(); } + + private void buttonUp_Click(object sender, EventArgs e) + { + OpenFileDialog openFileDialog = new OpenFileDialog + { + Title = "Select WAV files", + Filter = "WAV Files (*.wav)|*.wav", + Multiselect = true + }; + + if (openFileDialog.ShowDialog() == DialogResult.OK) + { + string[] selectedFiles = openFileDialog.FileNames; + + Console.WriteLine("Selected WAV files:"); + foreach (string filePath in selectedFiles) + { + File.Copy(filePath, Path.Combine(path, "Sounds", Path.GetFileName(filePath)), overwrite: true); + } + } + reloadS(); + } + + private void buttonOp_Click(object sender, EventArgs e) + { + string folderPath = Path.Combine(path, "Sounds"); + + if (!Directory.Exists(folderPath)) + { + MessageBox.Show("The Sounds has been deleted."); + return; + } + + try + { + Process.Start("explorer.exe", folderPath); + } + catch (Exception ex) + { + MessageBox.Show($"Error opening folder: {ex.Message}"); + } + } } }