private void button4_Click(object sender, EventArgs e)
 {
     if (selectedBGI != null)
     {
         EditorFileWriter.BGWriter(selectedBGI, Path.Combine(TBAGW.Game1.rootContent, currentContentFolder, selectedBGI.songCollectionName));
     }
 }
        private void button9_Click(object sender, EventArgs e)
        {
            String engineLoc = "";
            String sbLoc     = "";
            String wbLoc     = "";

            {
                MessageBox.Show("Please, first select the soundpool engine file (the '.xgs' file).");
                OpenFileDialog openBG = new OpenFileDialog();
                openBG.InitialDirectory = currentContentFolder;
                if (TBAGW.Game1.bIsDebug)
                {
                    openBG.Filter = "Sound engine file|*.xgs";
                }
                else
                {
                    openBG.Filter = "Sound engine file|*.xgs";
                }
                openBG.Title = "Load Sound File";

                if (TBAGW.Game1.bIsDebug)
                {
                    DialogResult dia = openBG.ShowDialog();
                    if (DialogResult.OK == dia && openBG.FileName.Contains(TBAGW.Game1.rootContent) && !openBG.FileName.Contains(TBAGW.Game1.rootContent + @"Sounds"))
                    {
                        engineLoc = openBG.FileName.Replace(TBAGW.Game1.rootContent, "");
                    }
                    else if (DialogResult.Cancel == dia)
                    {
                    }
                    else
                    {
                        Console.WriteLine("Cheater");
                    }
                }
                else
                {
                    DialogResult dia = openBG.ShowDialog();
                    if (DialogResult.OK == dia && openBG.FileName.Contains(TBAGW.Game1.rootContentExtra))
                    {
                        engineLoc = openBG.FileName.Replace(TBAGW.Game1.rootContent, "");
                    }
                    else if (DialogResult.Cancel == dia)
                    {
                    }
                }
            }

            {
                MessageBox.Show("Please, first select the soundbank engine file (the '.xsb' file).");
                OpenFileDialog openBG = new OpenFileDialog();
                openBG.InitialDirectory = currentContentFolder;
                if (TBAGW.Game1.bIsDebug)
                {
                    openBG.Filter = "Sound engine file|*.xsb";
                }
                else
                {
                    openBG.Filter = "Sound engine file|*.xsb";
                }
                openBG.Title = "Load Sound File";

                if (TBAGW.Game1.bIsDebug)
                {
                    DialogResult dia = openBG.ShowDialog();
                    if (DialogResult.OK == dia && openBG.FileName.Contains(TBAGW.Game1.rootContent) && !openBG.FileName.Contains(TBAGW.Game1.rootContent + @"Sounds"))
                    {
                        sbLoc = openBG.FileName.Replace(TBAGW.Game1.rootContent, "");
                    }
                    else if (DialogResult.Cancel == dia)
                    {
                    }
                    else
                    {
                        Console.WriteLine("Cheater");
                    }
                }
                else
                {
                    DialogResult dia = openBG.ShowDialog();
                    if (DialogResult.OK == dia && openBG.FileName.Contains(TBAGW.Game1.rootContentExtra))
                    {
                        sbLoc = openBG.FileName.Replace(TBAGW.Game1.rootContent, "");
                    }
                    else if (DialogResult.Cancel == dia)
                    {
                    }
                }
            }

            {
                MessageBox.Show("Please, first select the WaveBank engine file (the '.xwb' file).");
                OpenFileDialog openBG = new OpenFileDialog();
                openBG.InitialDirectory = currentContentFolder;
                if (TBAGW.Game1.bIsDebug)
                {
                    openBG.Filter = "Sound engine file|*.xwb";
                }
                else
                {
                    openBG.Filter = "Sound engine file|*.xwb";
                }
                openBG.Title = "Load Sound File";

                if (TBAGW.Game1.bIsDebug)
                {
                    DialogResult dia = openBG.ShowDialog();
                    if (DialogResult.OK == dia && openBG.FileName.Contains(TBAGW.Game1.rootContent) && !openBG.FileName.Contains(TBAGW.Game1.rootContent + @"Sounds"))
                    {
                        wbLoc = openBG.FileName.Replace(TBAGW.Game1.rootContent, "");
                    }
                    else if (DialogResult.Cancel == dia)
                    {
                    }
                    else
                    {
                        Console.WriteLine("Cheater");
                    }
                }
                else
                {
                    DialogResult dia = openBG.ShowDialog();
                    if (DialogResult.OK == dia && openBG.FileName.Contains(TBAGW.Game1.rootContentExtra))
                    {
                        wbLoc = openBG.FileName.Replace(TBAGW.Game1.rootContent, "");
                    }
                    else if (DialogResult.Cancel == dia)
                    {
                    }
                }
            }

            if (!engineLoc.Equals("") && !sbLoc.Equals("") && !wbLoc.Equals(""))
            {
                BGInfo tempBGI = new BGInfo();
                tempBGI.songELoc           = engineLoc;
                tempBGI.songSBLoc          = sbLoc;
                tempBGI.songWBLoc          = wbLoc;
                tempBGI.songCollectionName = engineLoc;
                selectedBGI = tempBGI;
                EditorFileWriter.BGWriter(tempBGI, Path.Combine(TBAGW.Game1.rootContent, currentContentFolder, tempBGI.songCollectionName));
                listBox1.Items.Clear();
                listBox1.SelectedIndex = -1;
                foreach (var item in tempBGI.songNames)
                {
                    listBox1.Items.Add(item);
                }
            }
        }