Ejemplo n.º 1
0
        private void SaveAlphaBinAs_Click(object sender, EventArgs e)
        {
            // Displays a SaveFileDialog so the user can save the bin
            SaveFileDialog saveBin = new SaveFileDialog();

            saveBin.Filter = "BT Alpha Bin File|*.bin|BK Alpha Bin File|*.bin";
            saveBin.Title  = "Save a new bin file.";
            saveBin.ShowDialog();
            if (saveBin.FileName != "") // If the file name is not an empty string open it for saving.
            {
                switch (saveBin.FilterIndex)
                {
                case 1:
                    BinManager.ConvertBKtoBT(BinManager.AlphaBin);
                    File.WriteAllBytes(saveBin.FileName, BinManager.AlphaBin.getCurrentBin());
                    ReloadMainBin();    //BK was converted to BT, must convert back or renderer can't read it!
                    if (BinManager.AlphaBin != null)
                    {
                        ReloadAlphaBin();
                    }
                    break;

                case 2:
                    BinManager.ConvertBTtoBK(BinManager.AlphaBin);
                    File.WriteAllBytes(saveBin.FileName, BinManager.AlphaBin.getCurrentBin());
                    break;
                }
            }
        }