diff --git a/Form1.Designer.cs b/Form1.Designer.cs index ed46ba6..d51bddf 100644 --- a/Form1.Designer.cs +++ b/Form1.Designer.cs @@ -45,6 +45,9 @@ private void InitializeComponent() b14 = new Button(); b13 = new Button(); buttonS = new Button(); + buttonrRe = new Button(); + buttonUp = new Button(); + buttonOp = new Button(); SuspendLayout(); // // b1 @@ -226,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; @@ -234,11 +237,47 @@ private void InitializeComponent() buttonS.UseVisualStyleBackColor = true; buttonS.Click += buttonS_Click; // + // buttonrRe + // + buttonrRe.Font = new Font("Segoe UI", 20F); + buttonrRe.Location = new Point(525, 486); + buttonrRe.Name = "buttonrRe"; + buttonrRe.Size = new Size(217, 92); + buttonrRe.TabIndex = 17; + buttonrRe.Text = "Reload Soundboard"; + 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); Controls.Add(b15); @@ -280,5 +319,8 @@ private void InitializeComponent() private Button b14; private Button b13; private Button buttonS; + private Button buttonrRe; + private Button buttonUp; + private Button buttonOp; } } diff --git a/Form1.cs b/Form1.cs index 29b42aa..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; @@ -15,8 +16,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) @@ -33,6 +37,7 @@ public Form1() if (i < sounds.Length) { string fileName = Path.GetFileNameWithoutExtension(sounds[i]); + buttons[i].Enabled = true; buttons[i].Text = fileName; } else @@ -42,7 +47,6 @@ public Form1() } } } - private void playSound(string path) { try @@ -112,5 +116,52 @@ private void buttonS_Click(object sender, EventArgs e) { stopAllSounds(); } + + 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}"); + } + } } }