private void bunifuFlatButton13_Click(object sender, EventArgs e)
        {
            baserom = 7;
            MessageBox.Show("You have to choose a Directory which includes the directories code content and meta in it, otherwise this will not work.");
            var          fbd    = new FolderBrowserDialog();
            DialogResult result = fbd.ShowDialog();

            if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.SelectedPath))
            {
                Usefull.CopyFolder(fbd.SelectedPath, Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Tools/Custom"));
                MessageBox.Show("Please enter the commonkey too before continuing!");


                string[] files = Directory.GetFiles(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Tools/Custom/content/rom/"));
                foreach (var item in files)
                {
                    result_name = Path.GetFileName(item);
                }
                bunifuFlatButton2.Enabled      = false;
                bunifuFlatButton29.Visible     = true;
                bunifuCustomLabel20.Visible    = true;
                bunifuMaterialTextbox4.Visible = true;
                bunifuFlatButton29.Enabled     = true;
                bunifuCustomLabel20.Enabled    = true;
                bunifuMaterialTextbox4.Enabled = true;
                bunifuFlatButton13.Enabled     = false;
                bunifuFlatButton13.Visible     = false;
                bunifuCustomLabel3.Enabled     = false;
                bunifuCustomLabel3.Visible     = false;
            }
            else
            {
                MessageBox.Show("Please select a Folder!");
            }
        }
 private void bunifuFlatButton22_Click(object sender, EventArgs e)
 {
     Usefull.EditXML(baserom, bunifuMaterialTextbox3.Text);
     if (radioButton1.Checked == true)
     {
         Usefull.RemoveFilter(baserom);
     }
 }
        private void bunifuFlatButton16_Click(object sender, EventArgs e)
        {
            string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"TOOLS\Download\");

            MessageBox.Show("Note, if the download freezes, you have to wait for a bit.\nIf it didn't change progress till then, you have to restart the download by pressing this button again.\nYou also have to do that if it doesn't download anything (you notice it when it shows <game> connection failed).");
            Usefull.Download(path, base_id, tkey_strg);
            done = 1;
        }
        private void bunifuFlatButton17_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog browser = new FolderBrowserDialog();

            string tempPath = "";

            if (openFileDialog1.ShowDialog(this) == DialogResult.OK)
            {
                tempPath = openFileDialog1.InitialDirectory + openFileDialog1.FileName;
                string rom       = openFileDialog1.FileName;
                string converter = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Tools\Convert");
                Usefull.Convert(rom, converter);

                string rompath = "";
                if (baserom == 1)
                {
                    rompath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Tools\Download\" + folder + @"\content\rom\Undop0.599");
                }
                else if (baserom == 2)
                {
                    rompath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Tools\Download\" + folder + @"\content\rom\UNMQP0.810");
                }

                else if (baserom == 3)
                {
                    rompath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Tools\Download\" + folder + @"\content\rom\Ucfze0.242");
                }

                else if (baserom == 4)
                {
                    rompath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Tools\Download\" + folder + @"\content\rom\Unsme0.005");
                }

                else if (baserom == 5)
                {
                    rompath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Tools\Download\" + folder + @"\content\rom\Unmfe0.443");
                }

                else if (baserom == 6)
                {
                    rompath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Tools\Download\" + folder + @"\content\rom\Unmwe0.621");
                }

                else if (baserom == 7)
                {
                    rompath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Tools\Custom\content\rom\" + result_name);
                }
                File.Delete(rompath);
                File.Move("rom.z64", rompath);
                Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
            }
        }
 private void bunifuFlatButton1_Click(object sender, EventArgs e)
 {
     if (Usefull.IsDirectoryEmpty(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Tools\Custom\")))
     {
         Environment.Exit(0);
     }
     else
     {
         foreach (var subDir in new DirectoryInfo(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Tools\Custom\")).GetDirectories())
         {
             subDir.Delete(true);
         }
         Environment.Exit(0);
     }
 }
        private void bunifuFlatButton28_Click_1(object sender, EventArgs e)
        {
            if (baserom == 1)
            {
                Usefull.packing(@"Tools\Download\" + folder);
            }
            else if (baserom == 2)
            {
                Usefull.packing(@"Tools\Download\" + folder);
            }
            else if (baserom == 3)
            {
                Usefull.packing(@"Tools\Download\" + folder);
            }
            else if (baserom == 4)
            {
                Usefull.packing(@"Tools\Download\" + folder);
            }
            else if (baserom == 5)
            {
                Usefull.packing(@"Tools\Download\" + folder);
            }
            else if (baserom == 6)
            {
                Usefull.packing(@"Tools\Download\" + folder);
            }
            else if (baserom == 7)
            {
                Usefull.packing(@"Tools\Custom");
            }
            bunifuCustomLabel21.Visible = true;
            bunifuFlatButton27.Enabled  = false;
            bunifuFlatButton27.Visible  = false;
            bunifuFlatButton28.Enabled  = false;
            bunifuFlatButton28.Visible  = false;
            bunifuFlatButton2.Enabled   = false;

            bunifuFlatButton3.Enabled = false;

            bunifuFlatButton4.Enabled = false;
        }
        private void bunifuFlatButton27_Click(object sender, EventArgs e)
        {
            MessageBox.Show("You have to choose an empty folder that is existing on the Drive where you have this Injector running. \n (As example, if you have this running on C:\\Users\\<your username>\\Desktop you can choose any folder on C: but not on D:)");
selectbrowser:
            FolderBrowserDialog browser = new FolderBrowserDialog();

            string tempPath = "", filesmeta = "", filescontent = "", filescode = "";

            if (folderBrowserDialog1.ShowDialog(this) == DialogResult.OK)
            {
                tempPath = folderBrowserDialog1.SelectedPath;
                if (Usefull.IsDirectoryEmpty(tempPath))
                {
                    if (baserom == 1)
                    {
                        filesmeta    = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Tools\Download\" + folder + @"\meta");
                        filescontent = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Tools\Download\" + folder + @"\content");
                        filescode    = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Tools\Download\" + folder + @"\code");
                    }
                    else if (baserom == 2)
                    {
                        filesmeta    = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Tools\Download\" + folder + @"\meta");
                        filescontent = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Tools\Download\" + folder + @"\content");
                        filescode    = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Tools\Download\" + folder + @"\code");
                    }
                    else if (baserom == 3)
                    {
                        filesmeta    = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Tools\Download\" + folder + @"\meta");
                        filescontent = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Tools\Download\" + folder + @"\content");
                        filescode    = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Tools\Download\" + folder + @"\code");
                    }
                    else if (baserom == 4)
                    {
                        filesmeta    = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Tools\Download\" + folder + @"\meta");
                        filescontent = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Tools\Download\" + folder + @"\content");
                        filescode    = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Tools\Download\" + folder + @"\code");
                    }
                    else if (baserom == 5)
                    {
                        filesmeta    = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Tools\Download\" + folder + @"\meta");
                        filescontent = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Tools\Download\" + folder + @"\content");
                        filescode    = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Tools\Download\" + folder + @"\code");
                    }
                    else if (baserom == 6)
                    {
                        filesmeta    = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Tools\Download\" + folder + @"\meta");
                        filescontent = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Tools\Download\" + folder + @"\content");
                        filescode    = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Tools\Download\" + folder + @"\code");
                    }
                    else if (baserom == 7)
                    {
                        filesmeta    = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Tools\Custom\meta");
                        filescontent = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Tools\Custom\content");
                        filescode    = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"Tools\Custom\code");
                    }


                    var Newmeta = Path.Combine(tempPath, @"meta");
                    var Newcon  = Path.Combine(tempPath, @"content");
                    var Newcode = Path.Combine(tempPath, @"code");
                    Directory.Move(filesmeta, Newmeta);
                    Directory.Move(filescontent, Newcon);
                    Directory.Move(filescode, Newcode);
                }
                else
                {
                    MessageBox.Show("Select an empty folder!");
                    goto selectbrowser;
                }
            }
            else
            {
                MessageBox.Show("Select a folder!");
                goto selectbrowser;
            }
            bunifuCustomLabel21.Visible = true;
            bunifuFlatButton27.Enabled  = false;
            bunifuFlatButton27.Visible  = false;
            bunifuFlatButton28.Enabled  = false;
            bunifuFlatButton28.Visible  = false;
            bunifuFlatButton2.Enabled   = false;

            bunifuFlatButton3.Enabled = false;

            bunifuFlatButton4.Enabled = false;
        }