コード例 #1
0
        private async void Extract_B_Click(object sender, RoutedEventArgs e)
        {
            if (IsClosing || IsBusy || IsOpenDialog)
            {
                return;
            }
            if (Event_Type_L.SelectedIndex == -1)
            {
                Message_Feed_Out("イベントIDが選択されていません。");
                return;
            }
            if (Sound_L.Items.Count == 0)
            {
                Message_Feed_Out("イベント内にサウンドが存在しません。");
                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);
                Message_T.Text = "イベント内のサウンドを抽出しています...";
                await Task.Delay(50);

                List <string> Extract_Sound_Files = new List <string>();
                for (int Number = 0; Number < Sound_L.Items.Count; Number++)
                {
                    string To_File = Voice_Set.Special_Path + "/Wwise/BNK_WAV_Special/" + Sound_L.Items[Number];
                    if (IsPCKMode)
                    {
                        Wwise_PCK.Wwise_Extract_To_Ogg_File(uint.Parse(Sound_L.Items[Number].ToString()), To_File + ".ogg", true);
                    }
                    else
                    {
                        Wwise_BNK.Wwise_Extract_To_Ogg_File(uint.Parse(Sound_L.Items[Number].ToString()), To_File + ".ogg", true);
                    }
                    if (File.Exists(To_File + ".ogg"))
                    {
                        Extract_Sound_Files.Add(To_File + ".ogg");
                    }
                }
                Message_T.Text = "ファイルをwavに変換しています...";
                await Multithread.Convert_To_Wav(Extract_Sound_Files.ToArray(), bfb.SelectedFolder, true, true);

                Message_Feed_Out("イベント内のファイルを抽出しました。");
            }
            bfb.Dispose();
            IsOpenDialog = false;
        }
コード例 #2
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;
        }
コード例 #3
0
        //変換
        //fsbからwavファイルを抽出し、ファイル名を変更、adpcmの場合ファイルが破損しているため復元してから.bnkを作成
        private async void Chnage_To_Wwise_B_Click(object sender, RoutedEventArgs e)
        {
            if (IsClosing || Opacity < 1)
            {
                return;
            }
            if (Voice_FSB_File == "")
            {
                Message_Feed_Out("FSB file is not selected.");
                return;
            }
            try
            {
                IsClosing = true;
                BetterFolderBrowser sfd = new BetterFolderBrowser()
                {
                    Title       = "Please specify the save destination folder.",
                    RootFolder  = Sub_Code.Get_OpenDirectory_Path(),
                    Multiselect = false
                };
                if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    FModChannel.setPaused(true);
                    await Task.Delay(50);

                    Sub_Code.Set_Directory_Path(sfd.SelectedFolder);
                    FSB_Details_L.Items[2] = "Output:" + 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 = "Extracting audio from FSB file...";
                    await Task.Delay(50);

                    Fmod_File_Extract_V2.FSB_Extract_To_Directory(Voice_FSB_File, Voice_Set.Special_Path + "/Wwise/FSB_Extract_Voices_TMP");
                    Message_T.Text = "Encoding *.wav files...";
                    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);

                    Directory.Delete(Voice_Set.Special_Path + "/Wwise/FSB_Extract_Voices_TMP", true);
                    Message_T.Text = "Renaming *.wav files...";
                    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");
                    }
                    Message_T.Text = "Creating a BNK file...";
                    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);
                    }
                    WoTB_Voice_Mod_Creater.Wwise_Class.Wwise_Project_Create Wwise = new WoTB_Voice_Mod_Creater.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_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 = "Encoding to DVPL format...";
                        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_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);*/
                    }
                    Message_Feed_Out("The operation is complete. If the bnk file is extremely small in size, it may have failed.");
                }
            }
            catch (Exception e1)
            {
                Sub_Code.Error_Log_Write(e1.Message);
                Message_Feed_Out("An error has occurred. See Log.txt for details.");
            }
            IsClosing = false;
            Position_Change();
        }
コード例 #4
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();
        }
コード例 #5
0
        private async void Open_File_B_Click(object sender, RoutedEventArgs e)
        {
            if (IsClosing || IsBusy)
            {
                return;
            }
            OpenFileDialog ofd = new OpenFileDialog()
            {
                Title       = "WoTBの音声Modを選択してください。",
                Multiselect = false,
                Filter      = "WoTB音声(*.fsb;*.bnk)|*.fsb;*.bnk"
            };

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                IsBusy = true;
                try
                {
                    string To_Dir = Voice_Set.Special_Path + "/Wwise/BNK_WAV_WoT";
                    try
                    {
                        if (Directory.Exists(To_Dir))
                        {
                            Directory.Delete(To_Dir, true);
                        }
                    }
                    catch (Exception e1)
                    {
                        Sub_Code.Error_Log_Write(e1.Message);
                    }
                    for (int Number = 0; Number < 34; Number++)
                    {
                        BNK_FSB_Enable.Add(new List <bool>());
                    }
                    if (Path.GetExtension(ofd.FileName) == ".bnk")
                    {
                        Message_T.Text = ".bnkファイルを解析しています...";
                        await Task.Delay(50);

                        Wwise_Class.BNK_Parse p = new Wwise_Class.BNK_Parse(ofd.FileName);
                        if (!p.IsVoiceFile(true))
                        {
                            Message_Feed_Out("選択されたbnkファイルは音声データではありません。");
                            IsBusy = false;
                            return;
                        }
                        BNK_FSB_Voices = p.Get_Voices(true);
                        List <string> Need_Files = new List <string>();
                        foreach (List <string> Types in BNK_FSB_Voices)
                        {
                            foreach (string File_Now in Types)
                            {
                                Need_Files.Add(File_Now);
                            }
                        }
                        if (Need_Files.Count == 0)
                        {
                            Message_T.Text = "移植できるファイルが見つからなかったため、特殊な方法で解析しています...";
                            await Task.Delay(50);

                            p.SpecialBNKFileMode = 1;
                            BNK_FSB_Voices       = p.Get_Voices(true);
                            foreach (List <string> Types in BNK_FSB_Voices)
                            {
                                foreach (string File_Now in Types)
                                {
                                    Need_Files.Add(File_Now);
                                }
                            }
                            if (Need_Files.Count == 0)
                            {
                                p.Clear();
                                BNK_FSB_Voices.Clear();
                                Message_Feed_Out("移植できる音声が見つかりませんでした。");
                                IsBusy = false;
                                return;
                            }
                        }
                        p.Clear();
                        Voices_L.Items.Clear();
                        Content_L.Items.Clear();
                        Now_Stream_Count = 0;
                        Message_T.Text   = ".wavまたは.oggに変換しています...";
                        await Task.Delay(50);

                        Wwise_File_Extract_V2 Wwise_BNK = new Wwise_File_Extract_V2(ofd.FileName);
                        Max_Stream_Count = Wwise_BNK.Wwise_Get_Numbers();
                        Wwise_BNK.Wwise_Extract_To_WEM_Directory_V2(To_Dir);
                        Wwise_BNK.Bank_Clear();
                        Message_T.Text = "不要な音声ファイルを削除しています...";
                        await Task.Delay(50);

                        string[] All_Files = Directory.GetFiles(To_Dir, "*", 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(To_Dir, "*.wem", SearchOption.TopDirectoryOnly);
                        foreach (string File_Now in Files)
                        {
                            Sub_Code.File_Delete_V2(File_Now);
                        }
                        Message_T.Text = ".oggファイルを.wavファイルに変換しています...";
                        await Task.Delay(50);

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

                        File_Name_T.Text = Path.GetFileName(ofd.FileName);
                        Message_Feed_Out(".bnkファイルをロードしました。SEが含まれている場合は無効化してください。");
                    }
                    else
                    {
                        Message_T.Text = ".fsbファイルを解析しています...";
                        await Task.Delay(50);

                        bool          IsVoiceExist = false;
                        List <string> Voices       = Fmod_Class.FSB_GetNames(ofd.FileName);
                        foreach (string File_Now in Voices)
                        {
                            string File_Now_01 = File_Now.Replace(" ", "");
                            if (File_Now_01.Contains("battle_01") || File_Now_01.Contains("battle_02") || File_Now_01.Contains("battle_03") || File_Now_01.Contains("start_battle_01"))
                            {
                                IsVoiceExist = true;
                                break;
                            }
                        }
                        if (!IsVoiceExist)
                        {
                            Message_Feed_Out("指定したFSBファイルは対応していません。");
                            IsBusy = false;
                            return;
                        }
                        Voices.Clear();
                        Message_T.Text = "FSBファイルからファイルを抽出しています...";
                        await Task.Delay(50);

                        Max_Stream_Count = Fmod_Class.FSB_GetLength(ofd.FileName);
                        Fmod_File_Extract_V2.FSB_Extract_To_Directory(ofd.FileName, To_Dir + "_TMP");
                        Message_T.Text = ".wavファイルを修正しています...";
                        await Task.Delay(50);

                        await Multithread.Convert_To_Wav(To_Dir + "_TMP", To_Dir, true, true, false, false);

                        Directory.Delete(To_Dir + "_TMP", true);
                        Message_T.Text = "ファイル名からリストに配置しています...";
                        await Task.Delay(50);

                        BNK_FSB_Voices = Voice_Set.Voice_BGM_Name_Change_From_FSB_To_Index(To_Dir);
                        Voices_L.Items.Clear();
                        Content_L.Items.Clear();
                        Now_Stream_Count = 0;
                        Message_T.Text   = "不要なファイルを削除しています...";
                        await Task.Delay(50);

                        foreach (string File_Name in Directory.GetFiles(To_Dir, "*", SearchOption.TopDirectoryOnly))
                        {
                            string Name_Only = Path.GetFileNameWithoutExtension(File_Name);
                            bool   IsExsist  = false;
                            for (int Number = 0; Number < BNK_FSB_Voices.Count; Number++)
                            {
                                foreach (string Name_Now in BNK_FSB_Voices[Number])
                                {
                                    if (Name_Only == Name_Now)
                                    {
                                        IsExsist = true;
                                        break;
                                    }
                                }
                                if (IsExsist)
                                {
                                    break;
                                }
                            }
                            if (!IsExsist)
                            {
                                Sub_Code.File_Delete_V2(File_Name);
                            }
                        }
                        File_Name_T.Text = Path.GetFileName(ofd.FileName);
                        Message_Feed_Out(".fsbファイルをロードしました。");
                    }
                    if (BNK_FSB_Voices[5].Count == 0 && BNK_FSB_Voices[2].Count > 0)
                    {
                        BNK_FSB_Voices[5] = new List <string>(BNK_FSB_Voices[2]);
                    }
                    if (BNK_FSB_Voices[4].Count == 0 && BNK_FSB_Voices[3].Count > 0)
                    {
                        BNK_FSB_Voices[4] = new List <string>(BNK_FSB_Voices[3]);
                    }
                    for (int Number = 0; Number < 34; Number++)
                    {
                        Now_Stream_Count += BNK_FSB_Voices[Number].Count;
                        Voices_L.Items.Add(Voice_Set.Get_Voice_Type_Japanese_Name_V2(Number) + " : " + BNK_FSB_Voices[Number].Count + "個");
                    }
                    for (int Number_01 = 0; Number_01 < BNK_FSB_Voices.Count; Number_01++)
                    {
                        for (int Number_02 = 0; Number_02 < BNK_FSB_Voices[Number_01].Count; Number_02++)
                        {
                            BNK_FSB_Enable[Number_01].Add(true);
                        }
                    }
                }
                catch (Exception e1)
                {
                    IsBusy = false;
                    Sub_Code.Error_Log_Write(e1.Message);
                    BNK_FSB_Clear(false);
                    Message_Feed_Out("エラーが発生しました。Error_Log.txtを参照してください。");
                }
            }
            IsBusy = false;
        }
コード例 #6
0
        //変換
        //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;
        }