Beispiel #1
0
        public async Task <bool> Create_Project_All(string To_Dir, bool IsExtractSound, System.Windows.Controls.TextBlock Message_T)
        {
            if (!IsSelected)
            {
                return(false);
            }
            try
            {
                if (!Directory.Exists(To_Dir))
                {
                    Directory.CreateDirectory(To_Dir);
                }
                await Actor_Mixer_Project.Get_Actor_Mixer_Hierarchy(To_Dir + "\\Actor-Mixer Hierarchy\\Default Work Unit.wwu", IsExtractSound, Message_T);

                Message_T.Text = "'Game Parameter'を作成しています...";
                await Task.Delay(50);

                Game_Parameter.Create(To_Dir + "\\Game Parameters\\SRTTbacon.wwu");
                Message_T.Text = "'Attenuations'を作成しています...";
                await Task.Delay(50);

                Attenuations.Create(To_Dir + "\\Attenuations\\Default Work Unit.wwu");
                Message_T.Text = "Master Mixerを作成しています...";
                await Task.Delay(50);

                Master_Mixer.Create(To_Dir + "\\Master-Mixer Hierarchy\\Default Work Unit.wwu");
                Message_T.Text = "Switchを作成しています...";
                await Task.Delay(50);

                Switch.Create(To_Dir + "\\Switches\\Default Work Unit.wwu");
                Message_T.Text = "Stateを作成しています...";
                await Task.Delay(50);

                State.Create(To_Dir + "\\States\\Default Work Unit.wwu");
                await Events.Set_Name(Message_T);

                Events.Create(To_Dir + "\\Events\\SRTTbacon.wwu");
                Message_T.Text = "SoundBanksを作成しています...";
                await Task.Delay(50);

                SoundBanks.Create(To_Dir + "\\SoundBanks\\Default Work Unit.wwu");
                Message_T.Text = "必要なファイルをコピーしています...";
                await Task.Delay(50);

                Create_Project_Directory(To_Dir);
                if (IsExtractSound)
                {
                    Message_T.Text = "サウンドファイルを抽出しています...";
                    await Task.Delay(50);

                    Now_Extract_File_Count = 0;
                    int Max_Extract_File_Count = BNK_Info.CAkSound_Info.Count;
                    if (BNK_Info.PCK_File != null && BNK_Info.PCK_File.Count > 0)
                    {
                        Max_Extract_File_Count += BNK_Info.CAkSound_Info.Count;
                    }
                    List <string> OGG_List = null;
                    bool          IsEnd    = false;
                    Task          Run      = Task.Run(() =>
                    {
                        OGG_List = Extract_WEM_To_Dir(To_Dir);
                        IsEnd    = true;
                    });
                    while (!IsEnd)
                    {
                        Message_T.Text = "サウンドファイルを抽出しています...\n進捗:" + Now_Extract_File_Count + " / " + Max_Extract_File_Count;
                        await Task.Delay(1000);
                    }
                    Message_T.Text = ".wav形式に変換しています...";
                    await Class.Multithread.Convert_Ogg_To_Wav(OGG_List, true);

                    OGG_List.Clear();
                }
                return(true);
            }
            catch (Exception e)
            {
                Sub_Code.Error_Log_Write(e.Message);
                return(false);
            }
        }
Beispiel #2
0
        //.bnkファイルを解析
        public void BNK_To_Wwise_Projects_Init(string Init_File, List <string> BNK_File, List <string> PCK_File = null, string SoundbanksInfo = null, bool IsNoSoundInfo = false)
        {
            if (Init_File == null || BNK_File == null)
            {
                return;
            }
            if (!File.Exists(Init_File) || !File.Exists(BNK_File[0]))
            {
                return;
            }
            if (PCK_File != null && !File.Exists(PCK_File[0]))
            {
                return;
            }
            if (SoundbanksInfo != null && !File.Exists(SoundbanksInfo))
            {
                return;
            }
            string Temp_Name_01 = Sub_Code.Get_Time_Now(DateTime.Now, "-", 1, 6);

            Sub_Code.BNK_Parse_To_XML(Init_File, Voice_Set.Special_Path + "/Wwise_Parse/" + Temp_Name_01);
            BNK_Info.Init_Read_All.AddRange(File.ReadAllLines(Voice_Set.Special_Path + "/Wwise_Parse/" + Temp_Name_01 + ".xml"));
            File.Delete(Voice_Set.Special_Path + "/Wwise_Parse/" + Temp_Name_01 + ".xml");
            int Start_Line = -1;

            for (int Number = 0; Number < BNK_Info.Init_Read_All.Count; Number++)
            {
                if (BNK_Info.Init_Read_All[Number].Contains("<list name=\"pRTPCMgr\""))
                {
                    Start_Line = Number;
                    break;
                }
            }
            if (Start_Line != -1)
            {
                for (int Number = Start_Line; Number < BNK_Info.Init_Read_All.Count; Number++)
                {
                    if (BNK_Info.Init_Read_All[Number].Contains("<object name=\"RTPCRamping\""))
                    {
                        Init_Get_RTPC_Info(Number + 1);
                    }
                    if (BNK_Info.Init_Read_All[Number].Contains("</list>"))
                    {
                        break;
                    }
                }
            }
            List <uint> ShortIDs = new List <uint>();

            for (int Number = 0; Number < BNK_File.Count; Number++)
            {
                string Temp_Name = r.Next(0, 10000).ToString();
                Sub_Code.BNK_Parse_To_XML(BNK_File[Number], Voice_Set.Special_Path + "/Wwise_Parse/" + Temp_Name);
                //解析に失敗していたら終了
                if (!File.Exists(Voice_Set.Special_Path + "/Wwise_Parse/" + Temp_Name + ".xml"))
                {
                    IsSelected = false;
                    return;
                }
                string line;
                //内容をListに追加
                StreamReader file = new StreamReader(Voice_Set.Special_Path + "/Wwise_Parse/" + Temp_Name + ".xml");
                while ((line = file.ReadLine()) != null)
                {
                    BNK_Info.Read_All.Add(line);
                    //この文字が含まれていたらイベントやコンテナ確定
                    if (line.Contains("type=\"sid\" name=\"ulID\" value=\"") || line.Contains("type=\"sid\" name=\"ulStateID\" value=\""))
                    {
                        List <string> ID_Line_Tmp = new List <string>();
                        //イベントIDを取得
                        string strValue   = line.Remove(0, line.IndexOf("value=\"") + 7);
                        uint   strValue_1 = uint.Parse(strValue.Remove(strValue.LastIndexOf("\"")));
                        if (ShortIDs.Contains(strValue_1))
                        {
                            continue;
                        }
                        ShortIDs.Add(strValue_1);
                        //イベントの内容を取得(CASoundやCAkRanSeqCntrなど)
                        string strValue2 = BNK_Info.Read_All[BNK_Info.Read_All.Count - 4].Remove(0, BNK_Info.Read_All[BNK_Info.Read_All.Count - 4].IndexOf("name=\"") + 6);
                        strValue2 = strValue2.Remove(strValue2.IndexOf("index") - 2);
                        ID_Line_Tmp.Add(strValue_1.ToString());
                        //イベントの行
                        ID_Line_Tmp.Add((BNK_Info.Read_All.Count - 1).ToString());
                        ID_Line_Tmp.Add(strValue2);
                        BNK_Info.ID_Line.Add(ID_Line_Tmp);
                        if (strValue2 == "CAkRanSeqCntr" || strValue2 == "CAkSwitchCntr" || strValue2 == "CAkSound" || strValue2 == "CAkLayerCntr" || strValue2 == "CAkActorMixer")
                        {
                            while ((line = file.ReadLine()) != null)
                            {
                                BNK_Info.Read_All.Add(line);
                                if (line.Contains("name=\"DirectParentID\""))
                                {
                                    string strValue3 = line.Remove(0, line.IndexOf("value=\"") + 7);
                                    strValue3 = strValue3.Remove(strValue3.LastIndexOf("\""));
                                    string  My_GUID = Guid.NewGuid().ToString().ToUpper();
                                    CAkType Type;
                                    if (Enum.TryParse <CAkType>(strValue2, out Type))
                                    {
                                        BNK_Info.Relation.Add(new BNK_Relation(Type, My_GUID, strValue_1, uint.Parse(strValue3), (BNK_Info.Read_All.Count - 2)));
                                    }
                                    break;
                                }
                            }
                        }
                    }
                }
                file.Close();
                file.Dispose();
                //生成されたxmlファイルは使用しないので消しておく
                File.Delete(Voice_Set.Special_Path + "/Wwise_Parse/" + Temp_Name + ".xml");
            }
            Attenuations.Init();
            Switch.Init();
            State.Init();
            Master_Mixer.Init();
            Events.Init();
            BlendTracks.Init();
            if (IsNoSoundInfo)
            {
                BNK_To_Wwise_Project.SoundbanksInfo.Init();
            }
            else if (SoundbanksInfo != null)
            {
                BNK_To_Wwise_Project.SoundbanksInfo.Init(SoundbanksInfo);
            }
            foreach (string BNK_Now in BNK_File)
            {
                BNK_Info.BNK_File.Add(new Wwise_File_Extract_V2(BNK_Now));
            }
            if (PCK_File != null)
            {
                foreach (string PCK_Now in PCK_File)
                {
                    BNK_Info.PCK_File.Add(new Wwise_File_Extract_V1(PCK_Now));
                }
            }
            IsSelected = true;
        }