private async void DVPL_Extract_Dir_B_Click(object sender, RoutedEventArgs e)
        {
            if (IsBusy || IsOpenDialog)
            {
                return;
            }
            IsOpenDialog = true;
            BetterFolderBrowser bfb = new BetterFolderBrowser()
            {
                Title       = ".dvplファイルが存在するフォルダを選択してください。",
                RootFolder  = Sub_Code.Get_OpenDirectory_Path(),
                Multiselect = false,
            };

            if (bfb.ShowDialog() == DialogResult.OK)
            {
                IsBusy = true;
                Sub_Code.Set_Directory_Path(bfb.SelectedFolder);
                uint          Dir_Files  = 0;
                List <string> DVPL_Files = new List <string>();
                foreach (string file in Directory.EnumerateFiles(bfb.SelectedFolder, "*", SearchOption.AllDirectories))
                {
                    if (Dir_Files >= 100000)
                    {
                        Message_Feed_Out("フォルダ内のファイル数が多すぎます。");
                        DVPL_Files.Clear();
                        IsBusy       = false;
                        IsOpenDialog = false;
                        return;
                    }
                    if (Path.GetExtension(file) == ".dvpl")
                    {
                        DVPL_Files.Add(file);
                    }
                    Dir_Files++;
                }
                if (DVPL_Files.Count == 0)
                {
                    Message_Feed_Out(".dvplファイルが見つかりませんでした。");
                    IsBusy       = false;
                    IsOpenDialog = false;
                    return;
                }
                Message_T.Text = ".dvplファイルを変換しています...";
                await Task.Delay(50);

                int Count = DVPL.DVPL_UnPack(DVPL_Files, DVPL_Delete_C.IsChecked.Value);
                Message_Feed_Out(Count + "個の.dvplファイルを変換しました。");
            }
            bfb.Dispose();
            IsBusy       = false;
            IsOpenDialog = false;
        }
        //DVPLを化(Pythonのプログラムに引数を渡し実行)
        private async void DVPL_Create_B_Click(object sender, RoutedEventArgs e)
        {
            if (IsBusy)
            {
                return;
            }
            OpenFileDialog ofd = new OpenFileDialog()
            {
                Title       = "dvpl化するファイルを選択してください。",
                Multiselect = true,
                Filter      = "ファイル(*.*)|*.*"
            };

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                string Error_Path = "";
                Message_T.Text = "DVPL化しています...";
                await Task.Delay(50);

                foreach (string File_Path in ofd.FileNames)
                {
                    if (Path.GetExtension(File_Path) == ".dvpl")
                    {
                        Error_Path += File_Path + "\n";
                        continue;
                    }
                    try
                    {
                        DVPL.DVPL_Pack(File_Path, File_Path + ".dvpl", false);
                        if (!File.Exists(File_Path + ".dvpl"))
                        {
                            throw new Exception(".dvplファイルが作成できていません。");
                        }
                    }
                    catch (Exception e1)
                    {
                        Error_Path += File_Path + "\n";
                        Sub_Code.Error_Log_Write(e1.Message);
                    }
                }
                Message_Feed_Out("ファイルをDVPL化しました。");
                if (Error_Path != "")
                {
                    Message_T.Text += "(エラーあり)";
                    System.Windows.MessageBox.Show("以下のファイルはdvpl化できませんでした。\n" + Error_Path);
                }
            }
        }
Пример #3
0
        static async Task <bool> To_DVPL_Pack(int File_Number, bool IsFromFileDelete)
        {
            if (!File.Exists(From_Files[File_Number]))
            {
                return(false);
            }
            bool IsOK = false;

            try
            {
                await Task.Run(() =>
                {
                    FileInfo file = new FileInfo(From_Files[File_Number]);
                    long size     = file.Length;
                    if (size >= 50000000)
                    {
                        DVPL.DVPL_Pack_V2(From_Files[File_Number], From_Files[File_Number] + ".dvpl", IsFromFileDelete);
                    }
                    else
                    {
                        try
                        {
                            if (Path.GetExtension(From_Files[File_Number]) == ".tex")
                            {
                                DVPL.CREATE_DVPL(LZ4Level.L00_FAST, From_Files[File_Number], From_Files[File_Number] + ".dvpl", IsFromFileDelete);
                            }
                            else
                            {
                                DVPL.CREATE_DVPL(LZ4Level.L03_HC, From_Files[File_Number], From_Files[File_Number] + ".dvpl", IsFromFileDelete);
                            }
                            IsOK = true;
                        }
                        catch
                        {
                        }
                    }
                });
            }
            catch
            {
            }
            if (IsOK)
            {
                return(true);
            }
            return(false);
        }
        //DVPLを解除(Pythonのプログラムに引数を渡し実行)
        private async void DVPL_Extract_B_Click(object sender, RoutedEventArgs e)
        {
            if (IsBusy)
            {
                return;
            }
            OpenFileDialog ofd = new OpenFileDialog()
            {
                Title       = ".DVPLファイルを選択してください。",
                Multiselect = true,
                Filter      = "DVPLファイル(*.dvpl)|*.dvpl"
            };

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                Message_T.Text = "DVPLファイルを展開しています...";
                await Task.Delay(50);

                string Error_Path = "";
                foreach (string File_Path in ofd.FileNames)
                {
                    DVPL.DVPL_UnPack(File_Path, Path.GetDirectoryName(File_Path) + "/" + Path.GetFileNameWithoutExtension(File_Path), false);
                    if (!File.Exists(Path.GetDirectoryName(File_Path) + "/" + Path.GetFileNameWithoutExtension(File_Path)))
                    {
                        Error_Path += File_Path + "\n";
                    }
                    else
                    {
                        File.Delete(File_Path);
                    }
                }
                Message_Feed_Out("DVPLファイルを展開しました。");
                if (Error_Path != "")
                {
                    Message_T.Text += "(エラーあり)";
                    System.Windows.MessageBox.Show("以下のファイルは展開できませんでした。\n" + Error_Path);
                }
            }
        }
Пример #5
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;
        }
Пример #6
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();
        }
        //変換
        //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;
        }
Пример #8
0
        //FSBファイルを選択
        private async void FSB_Select_B_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if (IsClosing)
            {
                return;
            }
            System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog()
            {
                Title       = "FSBファイルを選択してください。",
                Filter      = "FSBファイル(*.fsb;*.fsb.dvpl)|*.fsb;*.fsb.dvpl",
                Multiselect = false
            };
            if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    bool IsDVPL = false;
                    int  Number = 0;
                    if (Path.GetExtension(ofd.FileName) == ".dvpl")
                    {
                        IsDVPL = true;
                        if (!File.Exists(Voice_Set.Special_Path + "/FSB_Select_Temp_01.fsb"))
                        {
                            DVPL.DVPL_UnPack(ofd.FileName, Voice_Set.Special_Path + "/FSB_Select_Temp_01.fsb", false);
                            Number = 1;
                        }
                        else if (!File.Exists(Voice_Set.Special_Path + "/FSB_Select_Temp_02.fsb"))
                        {
                            DVPL.DVPL_UnPack(ofd.FileName, Voice_Set.Special_Path + "/FSB_Select_Temp_02.fsb", false);
                            Number = 2;
                        }
                        else if (!File.Exists(Voice_Set.Special_Path + "/FSB_Select_Temp_03.fsb"))
                        {
                            DVPL.DVPL_UnPack(ofd.FileName, Voice_Set.Special_Path + "/FSB_Select_Temp_03.fsb", false);
                            Number = 3;
                        }
                    }
                    FModChannel.setPaused(true);
                    FModChannel = new FMOD_API.Channel();
                    SubSound.release();
                    MainSound.release();
                    SubSound        = new FMOD_API.Sound();
                    MainSound       = new FMOD_API.Sound();
                    Location_T.Text = "00:00";
                    Message_T.Text  = "FSBファイルを読み込んでいます...";
                    await Task.Delay(50);

                    FSB_Select_T.Text = Path.GetFileName(ofd.FileName);
                    List <string> Name_List;
                    if (IsDVPL)
                    {
                        File_Full_Name = Voice_Set.Special_Path + "/FSB_Select_Temp_0" + Number + ".fsb";
                        Name_List      = Fmod_Class.FSB_GetNames(Voice_Set.Special_Path + "/FSB_Select_Temp_0" + Number + ".fsb");
                    }
                    else
                    {
                        File_Full_Name = ofd.FileName;
                        Name_List      = Fmod_Class.FSB_GetNames(ofd.FileName);
                    }
                    FSB_Number_T.Text = "ファイル数:" + Name_List.Count + " | 選択:なし";
                    FSB_Name_L.Items.Clear();
                    foreach (string Name_Now in Name_List)
                    {
                        FSB_Name_L.Items.Add(Name_Now);
                    }
                    if (Name_List.Count == 0)
                    {
                        Message_Feed_Out("内容を取得できませんでした。");
                    }
                    else
                    {
                        Message_Feed_Out("読み込みが完了しました。");
                    }
                    if (Number == 1)
                    {
                        Sub_Code.File_Delete_V2(Voice_Set.Special_Path + "/FSB_Select_Temp_02.fsb");
                        Sub_Code.File_Delete_V2(Voice_Set.Special_Path + "/FSB_Select_Temp_03.fsb");
                    }
                    else if (Number == 2)
                    {
                        Sub_Code.File_Delete_V2(Voice_Set.Special_Path + "/FSB_Select_Temp_01.fsb");
                        Sub_Code.File_Delete_V2(Voice_Set.Special_Path + "/FSB_Select_Temp_03.fsb");
                    }
                    else if (Number == 3)
                    {
                        Sub_Code.File_Delete_V2(Voice_Set.Special_Path + "/FSB_Select_Temp_01.fsb");
                        Sub_Code.File_Delete_V2(Voice_Set.Special_Path + "/FSB_Select_Temp_02.fsb");
                    }
                }
                catch (Exception e1)
                {
                    Message_Feed_Out("エラー:FSBファイルが壊れている可能性があります。");
                    Sub_Code.Error_Log_Write(e1.Message);
                }
            }
        }