add checks and balances and optimizations where you see fit, don't break anything. Return the entire script.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.DataFormats;

namespace ByteBreath
{
    public partial class DataSetMaker : Form
    {
        public string SharedPath;
        private Form1 _form1;
        string DatasetHome = @"C:\AI\Datasets\Fish-Speech";
        string SelectedDataset;
        AudioEditorForm audioEditorForm;

        public DataSetMaker(Form1 form1)
        {
            _form1 = form1; // Assign the passed instance to _form1
            InitializeComponent();
        }

        private void DataSetMaker_Load(object sender, EventArgs e)
        {
            OFFSCREEN.Focus();
            OFFSCREEN.Select();

            foreach (var folder in Directory.GetDirectories(DatasetHome))
            {
                string MyFolderName = Path.GetFileName(folder);
                Dataset_List.Items.Add(MyFolderName);
            }
        }

        private void DataSetMaker_FormClosing(object sender, FormClosingEventArgs e)
        {
            _form1.Show();
        }

        private void Create_Base_Click(object sender, EventArgs e)
        {
            OFFSCREEN.Focus();
            OFFSCREEN.Select();

            string BaseFolderPath = DatasetHome + @"\" + Dataset_Name.Text;

            Directory.CreateDirectory(BaseFolderPath);

            Dataset_List.Items.Add(Dataset_Name.Text);

            Dataset_Name.Text = string.Empty;
        }

        private void Create_Speaker_Click(object sender, EventArgs e)
        {
            OFFSCREEN.Focus();
            OFFSCREEN.Select();

            string TruePath = DatasetHome + @"\" + Dataset_List.SelectedItem.ToString() + @"\" + Speaker_Name.Text;

            if (!Directory.Exists(TruePath))
            {
                Directory.CreateDirectory(TruePath);
            }
        }

        private void Delete_Dataset_Click(object sender, EventArgs e)
        {
            OFFSCREEN.Focus();
            OFFSCREEN.Select();

            try
            {
                if (Directory.Exists(SelectedDataset))
                {
                    Directory.Delete(SelectedDataset, true);
                    Dataset_List.Items.Remove(Dataset_List.SelectedItem.ToString());
                    if (Dataset_List.Items.Count > 0)
                    {
                        Dataset_List.SelectedIndex = Dataset_List.SelectedIndex + 1;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show($"Error deleting dataset folder: {ex.Message}");
            }
        }

        private void Rename_Dataset_Click(object sender, EventArgs e)
        {
            OFFSCREEN.Focus();
            OFFSCREEN.Select();

        }

        private void Upload_Voices_Click(object sender, EventArgs e)
        {
            OFFSCREEN.Focus();
            OFFSCREEN.Select();

            OpenAndCopyAudioFiles();
        }

        private void Post_Process_Click(object sender, EventArgs e)
        {
            OFFSCREEN.Focus();
            OFFSCREEN.Select();

        }

        private void Transcribe_Labs_Click(object sender, EventArgs e)
        {
            OFFSCREEN.Focus();
            OFFSCREEN.Select();

        }

        private void Create_NPY_Click(object sender, EventArgs e)
        {
            OFFSCREEN.Focus();
            OFFSCREEN.Select();

        }

        private void Pack_Protos_Click(object sender, EventArgs e)
        {
            OFFSCREEN.Focus();
            OFFSCREEN.Select();

        }

        private void Preview_Voice_Click(object sender, EventArgs e)
        {
            OFFSCREEN.Focus();
            OFFSCREEN.Select();

        }

        private void Delete_Voice_Files_Click(object sender, EventArgs e)
        {
            OFFSCREEN.Focus();
            OFFSCREEN.Select();

            string TotalPath = DatasetHome + @"\" + Dataset_List.SelectedItem.ToString() + @"\" + Speaker_List.SelectedItem.ToString() + @"\" + Voice_List.SelectedItem.ToString();

            var ItemBackup = Voice_List.SelectedItem;

            File.Delete(TotalPath);

            Voice_List.ClearSelected();
            Voice_List.Items.Remove(ItemBackup);
        }

        private void Train_Button_Click(object sender, EventArgs e)
        {
            OFFSCREEN.Focus();
            OFFSCREEN.Select();

            MessageBox.Show("This action will stop all running servers before the training process starts.");
        }

        private void Dataset_List_Click(object sender, EventArgs e)
        {
            // If nothing is selected in the list box, make sure no items remain selected
            if (Dataset_List.SelectedIndex == -1)
            {
                Dataset_List.ClearSelected();
            }
        }

        private void Dataset_List_SelectedIndexChanged(object sender, EventArgs e)
        {
            // Check there is at least one item and something is selected
            if (Dataset_List.Items.Count > 0 && Dataset_List.SelectedItem != null)
            {
                // Clear the Speakers list before re-populating it
                Speaker_List.Items.Clear();

                // Construct the selected dataset path safely
                SelectedDataset = Path.Combine(DatasetHome, Dataset_List.SelectedItem.ToString());

                // Populate Speaker_List with folder names found in the dataset directory
                foreach (var folder in Directory.GetDirectories(SelectedDataset))
                {
                    string folderName = Path.GetFileName(folder);
                    Speaker_List.Items.Add(folderName);
                }
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            SharedPath = DatasetHome + @"\" + Voice_List.SelectedItem.ToString();
            audioEditorForm.Show(this);
        }

        private void Speaker_List_SelectedIndexChanged(object sender, EventArgs e)
        {
            // Ensure selections are not null
            if (Dataset_List.SelectedItem == null || Speaker_List.SelectedItem == null)
                return;

            // Build the full path safely
            string totalPath = Path.Combine(
                DatasetHome,
                Dataset_List.SelectedItem.ToString(),
                Speaker_List.SelectedItem.ToString());

            // Clear previous items first (optional)
            Voice_List.Items.Clear();

            // Get the files from directory if it exists
            if (Directory.Exists(totalPath))
            {
                var files = Directory.GetFiles(totalPath);

                foreach (var file in files)
                {
                    Voice_List.Items.Add(Path.GetFileName(file));
                }
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            string TotalPath = DatasetHome + @"\" + Dataset_List.SelectedItem.ToString() + @"\" + Speaker_List.SelectedItem.ToString();

            var ItemBackup = Speaker_List.SelectedItem;

            Directory.Delete(TotalPath, true);

            Speaker_List.ClearSelected();
            Speaker_List.Items.Remove(ItemBackup);
            Speaker_Name.Clear();
        }

        public void OpenAndCopyAudioFiles()
        {
            using (OpenFileDialog openFileDialog = new OpenFileDialog())
            {
                openFileDialog.Filter = "Audio Files (*.mp3;*.wav;*.flac)|*.mp3;*.wav;*.flac";
                openFileDialog.FilterIndex = 1;
                openFileDialog.Multiselect = true;  // Enable multi-selection
                openFileDialog.Title = "Select audio files to copy";

                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    string TotalPath = DatasetHome + @"\" + Dataset_List.SelectedItem.ToString() + @"\" + Speaker_List.SelectedItem.ToString();
                    // Ensure destination directory exists
                    if (!Directory.Exists(TotalPath))
                    {
                        Directory.CreateDirectory(TotalPath);
                    }

                    foreach (string sourceFilePath in openFileDialog.FileNames)
                    {
                        string fileName = Path.GetFileName(sourceFilePath);
                        string destFilePath = Path.Combine(TotalPath, fileName);

                        try
                        {
                            // Optionally overwrite existing files
                            File.Copy(sourceFilePath, destFilePath, overwrite: true);
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show($"Failed to copy {fileName}: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        Voice_List.Items.Add(Path.GetFileName(destFilePath));
                    }
                }
            }
        }
    }
}