private void Open_BNK_B_Click(object sender, RoutedEventArgs e)
 {
     if (IsClosing || IsBusy)
     {
         return;
     }
     System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog()
     {
         Title       = ".bnkファイルを選択してください。",
         Multiselect = true,
         Filter      = ".bnkファイル(*.bnk)|*.bnk"
     };
     if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         try
         {
             foreach (string FileNames in ofd.FileNames)
             {
                 string Select_Name = Path.GetFileName(FileNames);
                 bool   IsExist     = false;
                 foreach (string File_Now in BNK_File)
                 {
                     if (Path.GetFileName(File_Now) == Select_Name)
                     {
                         MessageBox.Show(Select_Name + "は既に追加されています。別のファイル名を指定する必要があります。");
                         IsExist = true;
                         break;
                     }
                 }
                 if (IsExist)
                 {
                     continue;
                 }
                 Wwise_Class.BNK_Parse p = new Wwise_Class.BNK_Parse(FileNames);
                 int Count = p.Get_File_Count();
                 if (Count == 0)
                 {
                     MessageBox.Show(Select_Name + "にサウンドファイルが含まれていませんでした。");
                     p.Clear();
                     continue;
                 }
                 p.Clear();
                 BNK_Sound_Count.Add((uint)Count);
                 BNK_File.Add(FileNames);
                 Info_List.Items.Add("追加:" + Select_Name);
             }
             Info_List.Items[0] = "BNKファイル数:" + BNK_File.Count + "個";
             uint All_Count = 0;
             foreach (uint Counts in BNK_Sound_Count)
             {
                 All_Count += Counts;
             }
             Info_List.Items[4] = "サウンド数:" + All_Count;
         }
         catch
         {
             Message_Feed_Out("選択したファイルは破損している可能性があります。");
         }
     }
 }
        private async void Open_File_B_Click(object sender, RoutedEventArgs e)
        {
            if (IsClosing || IsBusy)
            {
                return;
            }
            System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog()
            {
                Title       = "音声Modを選択してください。",
                Filter      = "音声ファイル(*.fsb;*.bnk)|*.fsb;*.bnk",
                Multiselect = false
            };
            if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    IsBusy = true;
                    string Ex       = Path.GetExtension(ofd.FileName);
                    string PCK_Path = Path.GetDirectoryName(ofd.FileName) + "\\" + Path.GetFileNameWithoutExtension(ofd.FileName) + ".pck";
                    if (Ex == ".fsb")
                    {
                        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("指定したファイルは対応していません。詳しくは注意事項を参照してください。");
                            IsBusy = false;
                            return;
                        }
                        Voices.Clear();
                        Max_Stream_Count = Fmod_Class.FSB_GetLength(ofd.FileName);
                        BNK_FSB_Voices   = Voice_Set.Voice_BGM_Name_Change_From_FSB_To_Index_FSBFile(ofd.FileName);
                        Now_Stream_Count = 0;
                        Voices_L.Items.Clear();
                        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 + "個");
                        }
                    }
                    else if (Ex == ".bnk")
                    {
                        Message_T.Text = ".bnkファイルを解析しています...";
                        await Task.Delay(50);

                        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);
                        }
                        if (PCK_Mode_C.IsChecked.Value)
                        {
                            if (!File.Exists(PCK_Path))
                            {
                                Message_Feed_Out("PCKファイルが見つかりませんでした。");
                                IsBusy = false;
                                return;
                            }
                            IsPCKMode = true;
                        }
                        else
                        {
                            IsPCKMode = false;
                        }
                        int BNK_Mode            = 0;
                        Wwise_Class.BNK_Parse p = new Wwise_Class.BNK_Parse(ofd.FileName);
                        if (p.IsVoiceFile(true))
                        {
                            BNK_Mode = 1;
                        }
                        else if (p.IsVoiceFile())
                        {
                            BNK_Mode = 2;
                        }
                        else
                        {
                            Message_Feed_Out("選択されたbnkファイルは音声データではありません。");
                            IsBusy = false;
                            return;
                        }
                        bool Mode;
                        if (BNK_Mode == 1)
                        {
                            Mode = true;
                        }
                        else if (BNK_Mode == 2)
                        {
                            Mode = false;
                        }
                        else
                        {
                            Message_Feed_Out("選択されたbnkファイルは音声データではありません。");
                            IsBusy = false;
                            return;
                        }
                        BNK_FSB_Voices = p.Get_Voices(Mode);
                        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(Mode);
                            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;
                        }
                        Max_Stream_Count = p.Get_File_Count();
                        p.Clear();
                        Voices_L.Items.Clear();
                        Now_Stream_Count = 0;
                        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 + "個");
                        }
                    }
                    Message_Feed_Out("解析が完了しました。");
                    if (IsPCKMode)
                    {
                        Selected_File = PCK_Path;
                    }
                    Selected_File    = ofd.FileName;
                    File_Name_T.Text = "ファイル名:" + Path.GetFileName(ofd.FileName);
                }
                catch (Exception e1)
                {
                    Selected_File = "";
                    BNK_FSB_Voices.Clear();
                    Voices_L.Items.Clear();
                    Voices_L.Items.Add("音声ファイルが選択されていません。");
                    Sub_Code.Error_Log_Write(e1.Message);
                    Message_Feed_Out("エラーが発生しました。ファイル形式が正しくない可能性があります。");
                }
            }
            ofd.Dispose();
            IsBusy = false;
        }