Example #1
0
        private async void Start_B_Click(object sender, RoutedEventArgs e)
        {
            if (IsClosing || IsBusy || IsOpenDialog)
            {
                return;
            }
            if (BNK_Voices.Count == 0)
            {
                Message_Feed_Out("音声ファイルが選択されていません。");
                return;
            }
            foreach (string BGM_File in BGM_Add)
            {
                if (!File.Exists(BGM_File))
                {
                    Message_Feed_Out(Path.GetFileName(BGM_File) + "が存在しませんでした。");
                    return;
                }
            }
            IsOpenDialog = true;
            BetterFolderBrowser fbd = new BetterFolderBrowser()
            {
                Title       = "保存先を選択してください。",
                Multiselect = false,
                RootFolder  = Sub_Code.Get_OpenDirectory_Path()
            };

            if (fbd.ShowDialog() == DialogResult.OK)
            {
                IsBusy = true;
                string SetPath = fbd.SelectedFolder;
                Sub_Code.Set_Directory_Path(SetPath);
                if (!Sub_Code.CanDirectoryAccess(SetPath))
                {
                    Message_Feed_Out("指定したフォルダにアクセスできませんでした。");
                    IsBusy       = false;
                    IsOpenDialog = false;
                    return;
                }
                try
                {
                    Message_T.Opacity = 1;
                    IsMessageShowing  = false;
                    List <string> Add_BGM_List = new List <string>();
                    if (BGM_Add_List.Items.Count > 0)
                    {
                        Message_T.Text = "BGMファイルを適応させています...";
                        await Task.Delay(50);

                        for (int Number = 0; Number < BGM_Add.Count; Number++)
                        {
                            if (Number < 10)
                            {
                                File.Copy(BGM_Add[Number], Voice_Set.Special_Path + "/Wwise/BNK_WAV/battle_bgm_0" + Number + Path.GetExtension(BGM_Add[Number]), true);
                                Add_BGM_List.Add(Voice_Set.Special_Path + "/Wwise/BNK_WAV/battle_bgm_0" + Number + ".wav");
                            }
                            else
                            {
                                File.Copy(BGM_Add[Number], Voice_Set.Special_Path + "/Wwise/BNK_WAV/battle_bgm_" + Number + Path.GetExtension(BGM_Add[Number]), true);
                                Add_BGM_List.Add(Voice_Set.Special_Path + "/Wwise/BNK_WAV/battle_bgm_" + Number + ".wav");
                            }
                        }
                    }
                    if (Volume_Set_C.IsChecked.Value)
                    {
                        Message_T.Text = ".wavに変換しています...";
                        await Task.Delay(50);

                        await Multithread.Convert_To_Wav(Directory.GetFiles(Voice_Set.Special_Path + "/Wwise/BNK_WAV", "*", SearchOption.TopDirectoryOnly), Voice_Set.Special_Path + "/Wwise/BNK_WAV", true, true);

                        Message_T.Text = "音量をWoTB用に調整しています...";
                        await Task.Delay(50);

                        Sub_Code.Volume_Set(Voice_Set.Special_Path + "/Wwise/BNK_WAV", Encode_Mode.WAV);
                    }
                    else
                    {
                        Message_T.Text = ".wavに変換しています...";
                        await Task.Delay(50);

                        await Multithread.Convert_To_Wav(Directory.GetFiles(Voice_Set.Special_Path + "/Wwise/BNK_WAV", "*", SearchOption.TopDirectoryOnly), Voice_Set.Special_Path + "/Wwise/BNK_WAV", true, true);
                    }
                    Message_T.Text = "ファイルをコピーしています...";
                    if (Directory.Exists(Voice_Set.Special_Path + "/Wwise/BNK_WAV/Voices"))
                    {
                        Directory.Delete(Voice_Set.Special_Path + "/Wwise/BNK_WAV/Voices", true);
                    }
                    await Task.Delay(50);

                    string Log_01 = Sub_Code.Set_Voice_Type_Change_Name_By_Index(Voice_Set.Special_Path + "/Wwise/BNK_WAV", Voice_Set.Special_Path + "/Wwise/BNK_WAV/Voices", BNK_Voices, BNK_Voices_Enable);
                    if (Log_01 != "")
                    {
                        Message_Feed_Out("ファイルをコピーできませんでした。詳しくは\"Error_Log.txt\"を参照してください。");
                        Directory.Delete(Voice_Set.Special_Path + "/Wwise/BNK_WAV/Voices", true);
                        IsBusy       = false;
                        IsOpenDialog = false;
                        return;
                    }
                    foreach (string BGM_Now in Add_BGM_List)
                    {
                        Sub_Code.File_Move(BGM_Now, Voice_Set.Special_Path + "/Wwise/BNK_WAV/Voices/" + Path.GetFileName(BGM_Now), true);
                    }
                    Message_T.Text = "SEの有無をチェックし、適応しています...";
                    await Task.Delay(50);
                    await BNK_Create_V2(Voice_Set.Special_Path + "/Wwise/BNK_WAV/Voices", SetPath);

                    if (DVPL_C.IsChecked.Value)
                    {
                        Message_T.Text = "DVPL化しています...";
                        await Task.Delay(50);

                        DVPL.DVPL_Pack(SetPath + "/voiceover_crew.bnk", SetPath + "/voiceover_crew.bnk.dvpl", true);
                        DVPL.DVPL_Pack(SetPath + "/ui_battle.bnk", SetPath + "/ui_battle.bnk.dvpl", true);
                        DVPL.DVPL_Pack(SetPath + "/ui_battle_basic.bnk", SetPath + "/ui_battle_basic.bnk.dvpl", true);
                        DVPL.DVPL_Pack(SetPath + "/ui_chat_quick_commands.bnk", SetPath + "/ui_chat_quick_commands.bnk.dvpl", true);
                        DVPL.DVPL_Pack(SetPath + "/reload.bnk", SetPath + "/reload.bnk.dvpl", true);
                    }
                    Directory.Delete(Voice_Set.Special_Path + "/Wwise/BNK_WAV/Voices", true);
                    bool IsOK = true;
                    if (Install_C.IsChecked.Value)
                    {
                        Message_T.Text = "WoTBに適応しています...";
                        await Task.Delay(50);

                        Sub_Code.DVPL_File_Delete(Voice_Set.WoTB_Path + "/Data/WwiseSound/ja/voiceover_crew.bnk");
                        Sub_Code.DVPL_File_Delete(Voice_Set.WoTB_Path + "/Data/WwiseSound/reload.bnk");
                        Sub_Code.DVPL_File_Delete(Voice_Set.WoTB_Path + "/Data/WwiseSound/ui_chat_quick_commands.bnk");
                        Sub_Code.DVPL_File_Delete(Voice_Set.WoTB_Path + "/Data/WwiseSound/ui_battle.bnk");
                        Sub_Code.DVPL_File_Delete(Voice_Set.WoTB_Path + "/Data/WwiseSound/ui_battle_basic.bnk");
                        if (!Sub_Code.DVPL_File_Copy(SetPath + "/voiceover_crew.bnk", Voice_Set.WoTB_Path + "/Data/WwiseSound/ja/voiceover_crew.bnk", true))
                        {
                            IsOK = false;
                        }
                        Sub_Code.DVPL_File_Copy(SetPath + "/reload.bnk", Voice_Set.WoTB_Path + "/Data/WwiseSound/reload.bnk", true);
                        Sub_Code.DVPL_File_Copy(SetPath + "/ui_chat_quick_commands.bnk", Voice_Set.WoTB_Path + "/Data/WwiseSound/ui_chat_quick_commands.bnk", true);
                        Sub_Code.DVPL_File_Copy(SetPath + "/ui_battle.bnk", Voice_Set.WoTB_Path + "/Data/WwiseSound/ui_battle.bnk", true);
                        Sub_Code.DVPL_File_Copy(SetPath + "/ui_battle_basic.bnk", Voice_Set.WoTB_Path + "/Data/WwiseSound/ui_battle_basic.bnk", true);
                    }
                    Flash.Flash_Start();
                    if (IsOK)
                    {
                        Message_Feed_Out("完了しました。");
                    }
                    else
                    {
                        Message_Feed_Out("エラー:WoTBに適応できませんでした。");
                    }
                }
                catch (Exception e1)
                {
                    Sub_Code.Error_Log_Write(e1.Message);
                }
                IsBusy = false;
            }
            fbd.Dispose();
            IsOpenDialog = false;
        }
Example #2
0
        private async void Start_B_Click(object sender, RoutedEventArgs e)
        {
            if (IsClosing || IsBusy || IsOpenDialog)
            {
                return;
            }
            if (BNK_FSB_Voices.Count == 0)
            {
                Message_Feed_Out("音声ファイルが選択されていません。");
                return;
            }
            IsOpenDialog = true;
            BetterFolderBrowser fbd = new BetterFolderBrowser()
            {
                Title       = "保存先を選択してください。",
                Multiselect = false,
                RootFolder  = Sub_Code.Get_OpenDirectory_Path()
            };

            if (fbd.ShowDialog() == DialogResult.OK)
            {
                IsBusy = true;
                string To_Dir  = Voice_Set.Special_Path + "/Wwise/BNK_WAV_WoT";
                string SetPath = fbd.SelectedFolder;
                Sub_Code.Set_Directory_Path(SetPath);
                if (!Sub_Code.CanDirectoryAccess(SetPath))
                {
                    Message_Feed_Out("指定したフォルダにアクセスできませんでした。");
                    IsBusy       = false;
                    IsOpenDialog = false;
                    return;
                }
                try
                {
                    Message_T.Opacity = 1;
                    IsMessageShowing  = false;
                    await Task.Delay(50);

                    if (Volume_Set_C.IsChecked.Value)
                    {
                        Message_T.Text = ".wavに変換しています...";
                        await Task.Delay(50);

                        await Multithread.Convert_To_Wav(Directory.GetFiles(To_Dir, "*", SearchOption.TopDirectoryOnly), To_Dir, true, true);

                        Message_T.Text = "音量をWoT用に調整しています...";
                        await Task.Delay(50);

                        Sub_Code.Volume_Set(To_Dir, Encode_Mode.WAV);
                    }
                    Message_T.Text = "ファイルをコピーしています...";
                    if (Directory.Exists(To_Dir + "/Voices"))
                    {
                        Directory.Delete(To_Dir + "/Voices", true);
                    }
                    await Task.Delay(50);

                    string Log_01 = Sub_Code.Set_Voice_Type_Change_Name_By_Index(To_Dir, To_Dir + "/Voices", BNK_FSB_Voices, BNK_FSB_Enable);
                    if (Log_01 != "")
                    {
                        Message_Feed_Out("ファイルをコピーできませんでした。詳しくは\"Error_Log.txt\"を参照してください。");
                        Directory.Delete(To_Dir + "/Voices", true);
                        IsBusy       = false;
                        IsOpenDialog = false;
                        return;
                    }
                    await BNK_Create_V2(To_Dir + "/Voices", SetPath);

                    Directory.Delete(To_Dir + "/Voices", true);
                    Flash.Flash_Start();
                    if (Sub_Code.WoT_Get_ModDirectory())
                    {
                        Message_T.Text = "ダイアログを表示しています...";
                        await Task.Delay(50);

                        MessageBoxResult result = System.Windows.MessageBox.Show("WoTのインストールフォルダの取得に成功しました。\n作成した音声ModをWoTに導入しますか?\n配置場所:" + Voice_Set.WoT_Mod_Path, "確認",
                                                                                 MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.Yes);
                        if (result == MessageBoxResult.Yes)
                        {
                            try
                            {
                                if (!Directory.Exists(Voice_Set.WoT_Mod_Path + "/audioww"))
                                {
                                    Directory.CreateDirectory(Voice_Set.WoT_Mod_Path + "/audioww");
                                }
                                if (File.Exists(Voice_Set.WoT_Mod_Path + "/audioww/voiceover.bnk"))
                                {
                                    File.Copy(Voice_Set.WoT_Mod_Path + "/audioww/voiceover.bnk", Voice_Set.WoT_Mod_Path + "/audioww/voiceover_bak.bnk", true);
                                }
                                File.Copy(SetPath + "/voiceover.bnk", Voice_Set.WoT_Mod_Path + "/audioww/voiceover.bnk", true);
                            }
                            catch (Exception e1)
                            {
                                Sub_Code.Error_Log_Write(e1.Message);
                                Message_Feed_Out("WoTにインストールできませんでした。Error_Log.txtを確認してください。");
                                IsBusy = false;
                                fbd.Dispose();
                                IsOpenDialog = false;
                                return;
                            }
                        }
                    }
                    Message_Feed_Out("完了しました。");
                }
                catch (Exception e1)
                {
                    Sub_Code.Error_Log_Write(e1.Message);
                    Message_Feed_Out("エラーが発生しました。Error_Log.txtを参照してください。");
                }
                IsBusy       = false;
                IsOpenDialog = false;
            }
            fbd.Dispose();
        }
        //変換
        //fsbからwavファイルを抽出し、ファイル名を変更、adpcmの場合ファイルが破損しているため復元してから.bnkを作成
        private async void Chnage_To_Wwise_B_Click(object sender, RoutedEventArgs e)
        {
            if (IsClosing || Opacity < 1 || IsOpenDialog)
            {
                return;
            }
            if (Voice_FSB_File == "")
            {
                Message_Feed_Out("FSBファイルが選択されていません。");
                return;
            }
            try
            {
                IsClosing    = true;
                IsOpenDialog = true;
                BetterFolderBrowser sfd = new BetterFolderBrowser()
                {
                    Title       = "保存先のフォルダを指定してください。",
                    RootFolder  = Sub_Code.Get_OpenDirectory_Path(),
                    Multiselect = false
                };
                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    Sub_Code.Set_Directory_Path(sfd.SelectedFolder);
                    FSB_Details_L.Items[4] = "出力先のフォルダ名:" + sfd.SelectedFolder.Substring(sfd.SelectedFolder.LastIndexOf("\\") + 1);
                    if (Directory.Exists(Voice_Set.Special_Path + "/Wwise/FSB_Extract_Voices_TMP"))
                    {
                        Directory.Delete(Voice_Set.Special_Path + "/Wwise/FSB_Extract_Voices_TMP", true);
                    }
                    if (Directory.Exists(Voice_Set.Special_Path + "/Wwise/FSB_Extract_Voices"))
                    {
                        Directory.Delete(Voice_Set.Special_Path + "/Wwise/FSB_Extract_Voices", true);
                    }
                    Message_T.Text = "FSBファイルから音声を抽出しています...";
                    await Task.Delay(50);

                    Fmod_File_Extract_V2.FSB_Extract_To_Directory(Voice_FSB_File, Voice_Set.Special_Path + "/Wwise/FSB_Extract_Voices_TMP");
                    if (BGM_FSB_File != "")
                    {
                        Message_T.Text = "FSBファイルからBGMを抽出しています...";
                        await Task.Delay(50);

                        Fmod_File_Extract_V2.FSB_Extract_To_Directory(BGM_FSB_File, Voice_Set.Special_Path + "/Wwise/FSB_Extract_Voices_TMP");
                    }
                    Message_T.Text = ".wavファイルをエンコードしています...";
                    await Task.Delay(50);

                    await Multithread.Convert_To_Wav(Voice_Set.Special_Path + "/Wwise/FSB_Extract_Voices_TMP", Voice_Set.Special_Path + "/Wwise/FSB_Extract_Voices", true, true, false, false);

                    Directory.Delete(Voice_Set.Special_Path + "/Wwise/FSB_Extract_Voices_TMP", true);
                    if (BGM_Add_Only.Count > 0)
                    {
                        Message_T.Text = "追加されたBGMファイルをwavに変換しています...";
                        await Task.Delay(50);

                        foreach (string File_Now in BGM_Add_Only)
                        {
                            if (!Sub_Code.Audio_IsWAV(File_Now))
                            {
                                Sub_Code.Audio_Encode_To_Other(File_Now, Sub_Code.File_Rename_Get_Name(Voice_Set.Special_Path + "/Wwise/FSB_Extract_Voices/battle_bgm") + ".wav", ".wav", false);
                            }
                            else
                            {
                                File.Copy(File_Now, Sub_Code.File_Rename_Get_Name(Voice_Set.Special_Path + "/Wwise/FSB_Extract_Voices/battle_bgm") + ".wav", true);
                            }
                        }
                    }
                    Message_T.Text = "音声のファイル名を変更しています...";
                    await Task.Delay(50);

                    Voice_Set.Voice_BGM_Name_Change_From_FSB(Voice_Set.Special_Path + "/Wwise/FSB_Extract_Voices");
                    string[] Reload_Files = Directory.GetFiles(Voice_Set.Special_Path + "/Wwise/FSB_Extract_Voices", "reload_*", SearchOption.TopDirectoryOnly);
                    foreach (string Reload_Now in Reload_Files)
                    {
                        FileInfo fi_reload = new FileInfo(Reload_Now);
                        if (fi_reload.Length == 290340 || fi_reload.Length == 335796 || fi_reload.Length == 336036 || fi_reload.Length == 445836 || fi_reload.Length == 497268 || fi_reload.Length == 541980)
                        {
                            fi_reload.Delete();
                        }
                    }
                    string[] Voice_Files = Directory.GetFiles(Voice_Set.Special_Path + "/Wwise/FSB_Extract_Voices", "*.wav", SearchOption.TopDirectoryOnly);
                    //音声の場合はたいていファイル名の語尾に_01や_02と書いているため、書かれていないファイルは削除する
                    foreach (string Voice_Now in Voice_Files)
                    {
                        if (!Path.GetFileNameWithoutExtension(Voice_Now).Contains("_") || !Sub_Code.IsIncludeInt_From_String(Path.GetFileNameWithoutExtension(Voice_Now), "_"))
                        {
                            File.Delete(Voice_Now);
                        }
                    }
                    if (File.Exists(Voice_Set.Special_Path + "/Wwise/FSB_Extract_Voices/lock_on.wav"))
                    {
                        File.Delete(Voice_Set.Special_Path + "/Wwise/FSB_Extract_Voices/lock_on.wav");
                    }
                    if (BGM_Add_List.Items.Count > 0)
                    {
                        Message_T.Text = ".bnkファイルを作成しています...\nBGMが含まれているため時間がかかります...";
                    }
                    else
                    {
                        Message_T.Text = ".bnkファイルを作成しています...";
                    }
                    await Task.Delay(50);

                    FileInfo fi = new FileInfo(Voice_Set.Special_Path + "/Wwise/WoTB_Sound_Mod/Actor-Mixer Hierarchy/Default Work Unit.wwu");
                    if (File.Exists(Voice_Set.Special_Path + "/Wwise/WoTB_Sound_Mod/Actor-Mixer Hierarchy/Backup.tmp") && fi.Length >= 800000)
                    {
                        File.Copy(Voice_Set.Special_Path + "/Wwise/WoTB_Sound_Mod/Actor-Mixer Hierarchy/Backup.tmp", Voice_Set.Special_Path + "/Wwise/WoTB_Sound_Mod/Actor-Mixer Hierarchy/Default Work Unit.wwu", true);
                    }
                    if (!File.Exists(Voice_Set.Special_Path + "/Wwise/WoTB_Sound_Mod/Actor-Mixer Hierarchy/Backup.tmp"))
                    {
                        File.Copy(Voice_Set.Special_Path + "/Wwise/WoTB_Sound_Mod/Actor-Mixer Hierarchy/Default Work Unit.wwu", Voice_Set.Special_Path + "/Wwise/WoTB_Sound_Mod/Actor-Mixer Hierarchy/Backup.tmp", true);
                    }
                    Wwise_Class.Wwise_Project_Create Wwise = new Wwise_Class.Wwise_Project_Create(Voice_Set.Special_Path + "/Wwise/WoTB_Sound_Mod");
                    Wwise.Sound_Add_Wwise(Voice_Set.Special_Path + "/Wwise/FSB_Extract_Voices");
                    Wwise.Save();
                    Directory.Delete(Voice_Set.Special_Path + "/Wwise/FSB_Extract_Voices", true);
                    Wwise.Project_Build("voiceover_crew", sfd.SelectedFolder + "/voiceover_crew.bnk");
                    await Task.Delay(500);

                    Wwise.Project_Build("ui_battle", sfd.SelectedFolder + "/ui_battle.bnk");
                    await Task.Delay(500);

                    Wwise.Project_Build("ui_battle_basic", sfd.SelectedFolder + "/ui_battle_basic.bnk");
                    await Task.Delay(500);

                    Wwise.Project_Build("ui_chat_quick_commands", sfd.SelectedFolder + "/ui_chat_quick_commands.bnk");
                    await Task.Delay(500);

                    Wwise.Project_Build("reload", sfd.SelectedFolder + "/reload.bnk");
                    Wwise.Clear();
                    if (File.Exists(Voice_Set.Special_Path + "/Wwise/WoTB_Sound_Mod/Actor-Mixer Hierarchy/Backup.tmp"))
                    {
                        File.Copy(Voice_Set.Special_Path + "/Wwise/WoTB_Sound_Mod/Actor-Mixer Hierarchy/Backup.tmp", Voice_Set.Special_Path + "/Wwise/WoTB_Sound_Mod/Actor-Mixer Hierarchy/Default Work Unit.wwu", true);
                    }
                    if (DVPL_C.IsChecked.Value)
                    {
                        Message_T.Text = "DVPL化しています...";
                        await Task.Delay(50);

                        DVPL.DVPL_Pack(sfd.SelectedFolder + "/voiceover_crew.bnk", sfd.SelectedFolder + "/voiceover_crew.bnk.dvpl", true);
                        DVPL.DVPL_Pack(sfd.SelectedFolder + "/ui_battle.bnk", sfd.SelectedFolder + "/ui_battle.bnk.dvpl", true);
                        DVPL.DVPL_Pack(sfd.SelectedFolder + "/ui_battle_basic.bnk", sfd.SelectedFolder + "/ui_battle_basic.bnk.dvpl", true);
                        DVPL.DVPL_Pack(sfd.SelectedFolder + "/ui_chat_quick_commands.bnk", sfd.SelectedFolder + "/ui_chat_quick_commands.bnk.dvpl", true);
                        DVPL.DVPL_Pack(sfd.SelectedFolder + "/reload.bnk", sfd.SelectedFolder + "/reload.bnk.dvpl", true);
                    }
                    if (Install_C.IsChecked.Value)
                    {
                        Message_T.Text = "WoTBに適応しています...";
                        await Task.Delay(50);

                        Sub_Code.DVPL_File_Delete(Voice_Set.WoTB_Path + "/Data/WwiseSound/ja/voiceover_crew.bnk");
                        Sub_Code.DVPL_File_Delete(Voice_Set.WoTB_Path + "/Data/WwiseSound/ui_battle.bnk");
                        Sub_Code.DVPL_File_Delete(Voice_Set.WoTB_Path + "/Data/WwiseSound/ui_chat_quick_commands.bnk");
                        Sub_Code.DVPL_File_Delete(Voice_Set.WoTB_Path + "/Data/WwiseSound/reload.bnk");
                        Sub_Code.DVPL_File_Copy(sfd.SelectedFolder + "/voiceover_crew.bnk", Voice_Set.WoTB_Path + "/Data/WwiseSound/ja/voiceover_crew.bnk", true);
                        Sub_Code.DVPL_File_Copy(sfd.SelectedFolder + "/ui_battle.bnk", Voice_Set.WoTB_Path + "/Data/WwiseSound/ui_battle.bnk", true);
                        Sub_Code.DVPL_File_Copy(sfd.SelectedFolder + "/ui_chat_quick_commands.bnk", Voice_Set.WoTB_Path + "/Data/WwiseSound/ui_chat_quick_commands.bnk", true);
                        Sub_Code.DVPL_File_Copy(sfd.SelectedFolder + "/reload.bnk", Voice_Set.WoTB_Path + "/Data/WwiseSound/reload.bnk", true);
                    }
                    Flash.Flash_Start();
                    Message_Feed_Out("完了しました。\nファイル容量が極端に少ない場合は失敗している可能性があります。");
                }
            }
            catch (Exception e1)
            {
                Sub_Code.Error_Log_Write(e1.Message);
                Message_Feed_Out("エラーが発生しました。詳しくはLog.txtを参照してください。");
            }
            IsClosing    = false;
            IsOpenDialog = false;
        }
        private async void Save_File_Create_B_Click(object sender, RoutedEventArgs e)
        {
            if (Selected_File == "" || BNK_FSB_Voices.Count == 0)
            {
                Message_Feed_Out("音声ファイルが選択されていません。");
                return;
            }
            if (Project_Name_T.Text == "")
            {
                Message_Feed_Out("プロジェクト名が設定されていません。");
                return;
            }
            if (Project_Name_T.Text.Contains("  "))
            {
                Message_Feed_Out("プロジェクト名に空白を連続で使用することはできません。");
                return;
            }
            try
            {
                Directory.CreateDirectory(Voice_Set.Special_Path + "/Temp/" + Project_Name_T.Text);
                Directory.Delete(Voice_Set.Special_Path + "/Temp", true);
                if (Project_Name_T.Text.Contains("/") || Project_Name_T.Text.Contains("\\"))
                {
                    throw new Exception("プロジェクト名に'/'を付けることはできません。");
                }
            }
            catch (Exception e1)
            {
                Message_Feed_Out("プロジェクト名に不適切な文字が含まれています。");
                Sub_Code.Error_Log_Write(e1.Message);
                return;
            }
            System.Windows.Forms.SaveFileDialog sfd = new System.Windows.Forms.SaveFileDialog()
            {
                Title            = "セーブファイルの保存先を指定してください。",
                Filter           = "セーブファイル(*.wvs)|*.wvs",
                InitialDirectory = Directory.GetCurrentDirectory()
            };
            if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                IsBusy = true;
                try
                {
                    string Ex = Path.GetExtension(Selected_File);
                    if (Ex == ".fsb")
                    {
                        Message_T.Text = "音声ファイルを抽出しています...";
                        await Task.Delay(50);

                        Fmod_File_Extract_V2.FSB_Extract_To_Directory(Selected_File, Voice_Set.Local_Path + "/Projects/" + Project_Name_T.Text + "/All_Voices_Temp");
                        Message_T.Text = ".wavファイルをエンコードしています...";
                        await Task.Delay(50);

                        await Multithread.Convert_To_Wav(Voice_Set.Local_Path + "/Projects/" + Project_Name_T.Text + "/All_Voices_Temp", Voice_Set.Local_Path + "/Projects/" + Project_Name_T.Text + "/All_Voices", true, true, false, false);

                        Directory.Delete(Voice_Set.Local_Path + "/Projects/" + Project_Name_T.Text + "/All_Voices_Temp", true);
                    }
                    else if (Ex == ".bnk")
                    {
                        Message_T.Text = ".wavまたは.oggに変換しています...";
                        await Task.Delay(50);

                        if (IsPCKMode)
                        {
                            Wwise_File_Extract_V1 Wwise_PCK = new Wwise_File_Extract_V1(Selected_File);
                            await Wwise_PCK.Async_Wwise_Extract_To_WEM_Directory(Voice_Set.Local_Path + "/Projects/" + Project_Name_T.Text + "/All_Voices");

                            await Wwise_PCK.Async_Wwise_Extract_To_OGG_Directory(Voice_Set.Local_Path + "/Projects/" + Project_Name_T.Text + "/All_Voices");

                            Wwise_PCK.Pck_Clear();
                        }
                        else
                        {
                            Wwise_File_Extract_V2 Wwise_BNK = new Wwise_File_Extract_V2(Selected_File);
                            Wwise_BNK.Wwise_Extract_To_WEM_Directory_V2(Voice_Set.Local_Path + "/Projects/" + Project_Name_T.Text + "/All_Voices");
                            Wwise_BNK.Bank_Clear();
                        }
                        Message_T.Text = "不要な音声ファイルを削除しています...";
                        await Task.Delay(50);

                        string[] All_Files = Directory.GetFiles(Voice_Set.Local_Path + "/Projects/" + Project_Name_T.Text + "/All_Voices", "*", SearchOption.TopDirectoryOnly);
                        foreach (string File_Now in All_Files)
                        {
                            if (!Need_Files.Contains(Path.GetFileNameWithoutExtension(File_Now)))
                            {
                                Sub_Code.File_Delete_V2(File_Now);
                            }
                        }
                        string[] Files = Directory.GetFiles(Voice_Set.Local_Path + "/Projects/" + Project_Name_T.Text + "/All_Voices", "*.wem", SearchOption.TopDirectoryOnly);
                        foreach (string File_Now in Files)
                        {
                            Sub_Code.File_Delete_V2(File_Now);
                        }
                    }
                    StreamWriter stw = File.CreateText(sfd.FileName + ".tmp");
                    stw.WriteLine(Project_Name_T.Text + "|IsNotChangeProjectNameMode=true");
                    for (int Number = 0; Number < BNK_FSB_Voices.Count; Number++)
                    {
                        foreach (string Name in BNK_FSB_Voices[Number])
                        {
                            stw.WriteLine(Number + "|" + Sub_Code.File_Get_FileName_No_Extension(Voice_Set.Local_Path + "\\Projects\\" + Project_Name_T.Text + "\\All_Voices\\" + Name));
                        }
                    }
                    stw.Close();
                    Sub_Code.File_Encrypt(sfd.FileName + ".tmp", sfd.FileName, "SRTTbacon_Create_Voice_Save", true);
                    Message_Feed_Out("保存しました。\nProjectsフォルダに該当する音声が入っています。");
                    Flash.Flash_Start();
                }
                catch (Exception e1)
                {
                    Sub_Code.Error_Log_Write(e1.Message);
                    Message_Feed_Out("エラーが発生しました。");
                }
                IsBusy = false;
            }
            sfd.Dispose();
        }
        private async void Create_B_Click(object sender, RoutedEventArgs e)
        {
            if (IsClosing || IsBusy || IsOpenDialog)
            {
                return;
            }
            if (BNK_File.Count == 0)
            {
                Message_Feed_Out(".bnkファイルが選択されていません。");
                return;
            }
            else if (Init_File == "")
            {
                Message_Feed_Out("Init.bnkファイルが選択されていません。");
                return;
            }
            else if (SoundbankInfo_File == "")
            {
                Message_Feed_Out("SoundbanksInfo.jsonファイルが選択されていません。");
                return;
            }
            IsOpenDialog = true;
            BetterFolderBrowser bfb = new BetterFolderBrowser()
            {
                Title       = "保存先のフォルダを選択してください。",
                RootFolder  = Sub_Code.Get_OpenDirectory_Path(),
                Multiselect = false,
            };

            if (bfb.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Sub_Code.Set_Directory_Path(bfb.SelectedFolder);
                if (!Sub_Code.CanDirectoryAccess(bfb.SelectedFolder))
                {
                    Message_Feed_Out("指定したフォルダにアクセスできませんでした。管理者権限で起動する必要があります。");
                    IsOpenDialog = false;
                    return;
                }
                IsBusy         = true;
                Message_T.Text = "BNKファイルを解析しています...";
                await Task.Delay(50);

                BNK_To_Wwise_Projects BNK_To_Project = new BNK_To_Wwise_Projects(Init_File, BNK_File, PCK_File, SoundbankInfo_File, No_SoundInfo_C.IsChecked.Value);
                if (No_SoundInfo_C.IsChecked.Value && Name_Generate_C.IsChecked.Value)
                {
                    await BNK_To_Project.ShortID_To_Name(Message_T);
                }
                if (Include_Sound_C.IsChecked.Value)
                {
                    await BNK_To_Project.Create_Project_All(bfb.SelectedFolder, false, Message_T);
                }
                else
                {
                    await BNK_To_Project.Create_Project_All(bfb.SelectedFolder, true, Message_T);
                }
                BNK_To_Project.Clear();
                Flash.Flash_Start();
                Message_Feed_Out("完了しました。");
                IsBusy = false;
            }
            IsOpenDialog = false;
        }