Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 43 additions & 1 deletion Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 53 additions & 2 deletions Form1.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Media;
using System.Windows.Forms;
Expand All @@ -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)
Expand All @@ -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
Expand All @@ -42,7 +47,6 @@ public Form1()
}
}
}

private void playSound(string path)
{
try
Expand Down Expand Up @@ -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}");
}
}
}
}
Loading