public static void Voice_BGM_Change_List_Init() { FTPClient.DownloadFile("/WoTB_Voice_Mod/Update/Data/Change_To_Wwise.txt", Special_Path + "/Wwise/Change_To_Wwise.dat"); if (!File.Exists(Special_Path + "/Wwise/Change_To_Wwise.dat")) { return; } try { Voice_BGM_Change_List.Clear(); for (int Number = 0; Number < 37; Number++) { Voice_BGM_Change_List.Add(new List <string>()); } string line; int Number_01 = -1; StreamReader str = new StreamReader(Special_Path + "/Wwise/Change_To_Wwise.dat"); while ((line = str.ReadLine()) != null) { if (line[0] == '・') { Number_01++; continue; } Voice_BGM_Change_List[Number_01].Add(line.Trim()); } str.Close(); } catch (Exception e) { Sub_Code.Error_Log_Write(e.Message); } }
//サーバーに接続(参加ではない) void Server_Connect() { try { Voice_Set.TCP_Server = new TCP_Client(); try { Voice_Set.TCP_Server.Connect(SRTTbacon_Server.IP, SRTTbacon_Server.TCP_Port); Message_T.Text = ""; if (!Voice_Set.TCP_Server.IsConnected) { Connectiong = false; Server_OK = false; } } catch { Connectiong = false; Server_OK = false; } Voice_Set.FTPClient = new SFTP_Client(SRTTbacon_Server.IP, SRTTbacon_Server.Name, SRTTbacon_Server.Password, SRTTbacon_Server.SFTP_Port); Server_OK = true; Message_T.Text = ""; if (Login()) { Connectiong = true; Connect_Start(); Connect_Mode_Layout(); } else { Message_T.Text = "ログイン(アカウント登録)をすると機能が有効化されます。"; Connect_B.Visibility = Visibility.Hidden; User_Name_Text.Visibility = Visibility.Visible; User_Name_T.Visibility = Visibility.Visible; User_Password_Text.Visibility = Visibility.Visible; User_Password_T.Visibility = Visibility.Visible; User_Login_B.Visibility = Visibility.Visible; User_Register_B.Visibility = Visibility.Visible; Voice_Create_Tool_B.Visibility = Visibility.Hidden; Voice_Create_V2_B.Visibility = Visibility.Visible; Update_B.Visibility = Visibility.Visible; } } catch (Exception e) { Connectiong = false; Server_OK = false; Update_B.Visibility = Visibility.Hidden; Connect_Mode_Layout(); Message_T.Text = "エラー:サーバーが開いていない可能性があります。"; Sub_Code.Error_Log_Write(e.Message.Replace(SRTTbacon_Server.IP_Global + ":" + SRTTbacon_Server.TCP_Port, "").Replace(SRTTbacon_Server.IP_Local + ":" + SRTTbacon_Server.TCP_Port, "")); } }
public static void Voice_BGM_Name_Change_From_FSB(string Dir_Path) { if (!Directory.Exists(Dir_Path)) { return; } if (Voice_BGM_Change_List.Count == 0) { Voice_BGM_Change_List_Init(); } string[] To_File_Name = { "mikata", "danyaku", "hikantuu", "kantuu", "tokusyu", "tyoudan", "syatyou", "souzyuusyu", "tekikasai", "gekiha", "enjinhason", "enjintaiha", "enjinhukkyuu" , "kasai", "syouka", "nenryou", "housinhason", "housintaiha", "housinhukkyuu", "housyu", "soutensyu", "musen", "musensyu", "battle", "kansokuhason", "kansokutaiha" , "kansokuhukkyuu", "ritaihason", "ritaitaiha", "ritaihukkyuu", "houtouhason", "houtoutaiha", "houtouhukkyuu", "taiha", "battle_bgm", "reload", "touzyouin" }; string[] Files = Directory.GetFiles(Dir_Path, "*.wav", SearchOption.TopDirectoryOnly); foreach (string File_Now in Files) { string Name = ""; string Name_Only = Path.GetFileNameWithoutExtension(File_Now); if (Name_Only.Contains(" (")) { Name = Name_Only.Substring(0, Name_Only.LastIndexOf('(') - 1); Name = Name.Trim(); } else if (Name_Only.Contains("_")) { Name = Name_Only.Substring(0, Name_Only.LastIndexOf('_')); Name = Name.Trim(); } if (Name == "") { continue; } for (int Number = 0; Number < 37; Number++) { foreach (string Voice_Name in Voice_BGM_Change_List[Number]) { if (Name.Contains(Voice_Name)) { if (Number == 36) { File.Copy(File_Now, Sub_Code.File_Rename_Get_Name(Path.GetDirectoryName(File_Now) + "\\syatyou") + ".wav", true); File.Copy(File_Now, Sub_Code.File_Rename_Get_Name(Path.GetDirectoryName(File_Now) + "\\souzyuusyu") + ".wav", true); File.Copy(File_Now, Sub_Code.File_Rename_Get_Name(Path.GetDirectoryName(File_Now) + "\\housyu") + ".wav", true); File.Copy(File_Now, Sub_Code.File_Rename_Get_Name(Path.GetDirectoryName(File_Now) + "\\housyu") + ".wav", true); File.Copy(File_Now, Sub_Code.File_Rename_Get_Name(Path.GetDirectoryName(File_Now) + "\\soutensyu") + ".wav", true); Sub_Code.File_Move(File_Now, Sub_Code.File_Rename_Get_Name(Path.GetDirectoryName(File_Now) + "\\musensyu") + ".wav", true); continue; } Sub_Code.File_Rename_Number(File_Now, To_File_Name[Number]); } } } } }
public static List <List <string> > Voice_BGM_Name_Change_From_FSB_To_Index(string Dir_Path) { if (!Directory.Exists(Dir_Path)) { return(new List <List <string> >()); } if (Voice_BGM_Change_List.Count == 0) { Voice_BGM_Change_List_Init(); } List <List <string> > Temp = new List <List <string> >(); for (int Number_01 = 0; Number_01 < 34; Number_01++) { Temp.Add(new List <string>()); } List <string> To_File_Name = new List <string>(); To_File_Name.AddRange(new string[] { "mikata", "danyaku", "hikantuu", "kantuu", "tokusyu", "tyoudan", "syatyou", "souzyuusyu", "tekikasai", "gekiha", "enjinhason", "enjintaiha", "enjinhukkyuu" , "kasai", "syouka", "nenryou", "housinhason", "housintaiha", "housinhukkyuu", "housyu", "soutensyu", "musen", "musensyu", "battle", "kansokuhason", "kansokutaiha" , "kansokuhukkyuu", "ritaihason", "ritaitaiha", "ritaihukkyuu", "houtouhason", "houtoutaiha", "houtouhukkyuu", "taiha" }); string[] Files = Directory.GetFiles(Dir_Path, "*.wav", SearchOption.TopDirectoryOnly); foreach (string File_Now in Files) { string Name_Temp = Path.GetFileNameWithoutExtension(File_Now); if (!Sub_Code.IsIncludeInt_From_String_V2(Name_Temp, "_")) { continue; } if (Name_Temp.Contains("_")) { string Name = Name_Temp.Substring(0, Name_Temp.LastIndexOf('_')); Name = Name.Trim(); for (int Number = 0; Number < 34; Number++) { if (To_File_Name[Number] == Name) { Temp[Number].Add(Name_Temp); break; } foreach (string Voice_Name in Voice_BGM_Change_List[Number]) { if (Name.Contains(Voice_Name)) { Temp[Number].Add(Name_Temp); break; } } } } } return(Temp); }
//終了 private async void Exit_B_Click(object sender, RoutedEventArgs e) { if (IsProcessing || IsClosing) { return; } MessageBoxResult result = MessageBox.Show("終了しますか?", "確認", MessageBoxButton.YesNo, MessageBoxImage.Exclamation, MessageBoxResult.No); if (result == MessageBoxResult.Yes) { IsClosing = true; IsProcessing = true; Voice_Set.App_Busy = true; Other_Window.Pause_Volume_Animation(true, 25); try { if (Voice_Set.FTPClient.IsConnected) { Voice_Set.FTPClient.Close(); Voice_Set.TCP_Server.Dispose(); } } catch (Exception e1) { Sub_Code.Error_Log_Write(e1.Message); } while (Opacity > 0) { Opacity -= 0.05; await Task.Delay(1000 / 60); } try { if (Directory.Exists(Voice_Set.Special_Path + "/Wwise/BNK_WAV")) { Directory.Delete(Voice_Set.Special_Path + "/Wwise/BNK_WAV", true); } if (Directory.Exists(Voice_Set.Special_Path + "/Wwise/BNK_WAV_WoT")) { Directory.Delete(Voice_Set.Special_Path + "/Wwise/BNK_WAV_WoT", true); } } catch (Exception e1) { Sub_Code.Error_Log_Write(e1.Message); } Application.Current.Shutdown(); } }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { try { if (Voice_Set.FTPClient.IsConnected) { Voice_Set.FTPClient.Close(); Voice_Set.TCP_Server.Dispose(); } } catch (Exception e1) { Sub_Code.Error_Log_Write(e1.Message); } Application.Current.Shutdown(); }
public static void DVPL_UnPack(string From_File, string To_File, bool IsFromFileDelete) { if (!File.Exists(From_File)) { return; } File.Copy(From_File, Voice_Set.Special_Path + "/DVPL/Temp_Unpack.tmp.dvpl", true); StreamWriter DVPL_Unpack = File.CreateText(Voice_Set.Special_Path + "/DVPL/UnPack.bat"); DVPL_Unpack.WriteLine("chcp 65001"); DVPL_Unpack.Write("\"" + Voice_Set.Special_Path + "/DVPL/DVPL_Extract.exe\""); DVPL_Unpack.Close(); ProcessStartInfo processStartInfo = new ProcessStartInfo { FileName = Voice_Set.Special_Path + "/DVPL/UnPack.bat", CreateNoWindow = true, RedirectStandardInput = true, RedirectStandardOutput = true, WorkingDirectory = Voice_Set.Special_Path + "/DVPL", UseShellExecute = false }; p = Process.Start(processStartInfo); p.StandardInput.WriteLine("\r\n"); p.OutputDataReceived += new DataReceivedEventHandler(WriteMessage); p.BeginOutputReadLine(); p.WaitForExit(); p.Close(); p.Dispose(); try { Sub_Code.File_Move(Voice_Set.Special_Path + "/DVPL/Temp_Unpack.tmp", To_File, true); if (IsFromFileDelete) { File.Delete(From_File); } } catch (Exception e) { //dvplが解除されなかった場合 Sub_Code.Error_Log_Write(e.Message); } File.Delete(Voice_Set.Special_Path + "/DVPL/UnPack.bat"); }
//音声の変更をサーバーに反映 public static void Voice_Set_Name(string To_File_Name) { if (!IsBusy) { int Number = 1; string File_Name_Temp; while (true) { if (Number < 10) { if (!Sub_Code.File_Exists(Special_Path + "/Server/" + Server_Name + "/Voices/" + To_File_Name + "_0" + Number)) { File_Name_Temp = To_File_Name + "_0" + Number + ".mp3"; break; } } else { if (!Sub_Code.File_Exists(Special_Path + "/Server/" + Server_Name + "/Voices/" + To_File_Name + "_" + Number)) { File_Name_Temp = To_File_Name + "_" + Number + ".mp3"; break; } } Number++; } try { AppendString("/WoTB_Voice_Mod/" + Server_Name + "/Change_Names.dat", Voice_Lists[Voice_Number] + "->" + File_Name_Temp + "\n"); FTPClient.File_Move("/WoTB_Voice_Mod/" + Server_Name + "/Voices/" + Voice_Lists[Voice_Number], "/WoTB_Voice_Mod/" + Server_Name + "/Voices/" + File_Name_Temp, true); TCPClient.Send(Server_Name + "|Rename|" + Voice_Lists[Voice_Number] + "|" + File_Name_Temp); } catch (Exception e) { Sub_Code.Error_Log_Write(e.Message); MessageBox.Show("エラー:" + e.Message); } } }
//ログインできるか bool Login() { if (File.Exists(Path + "/User.dat")) { StreamReader str = Sub_Code.File_Decrypt_To_Stream(Path + "/User.dat", "SRTTbacon_Server_User_Pass_Save"); string Login_Read = str.ReadLine(); str.Close(); string User_Name = Login_Read.Substring(0, Login_Read.IndexOf(':')); string Password = Login_Read.Substring(Login_Read.IndexOf(':') + 1); if (Account_Exist(User_Name, Password)) { Voice_Set.UserName = User_Name; return(true); } else { return(false); } } else { return(false); } }
//管理者が設定を変更した場合それを反映 void TCP_Change_Config(string[] Message_Temp) { try { string Server_Rename = Message_Temp[2].Replace("\0", ""); if (Voice_Set.SRTTbacon_Server_Name != Server_Rename) { Directory.Move(Voice_Set.Special_Path + "/Server/" + Voice_Set.SRTTbacon_Server_Name, Voice_Set.Special_Path + "/Server/" + Server_Rename); Voice_Set.SRTTbacon_Server_Name = Server_Rename; } if (Voice_Set.FTPClient.File_Exist("/WoTB_Voice_Mod/" + Voice_Set.SRTTbacon_Server_Name + "/Remove_Files.dat")) { StreamReader str = Voice_Set.FTPClient.GetFileRead("/WoTB_Voice_Mod/" + Voice_Set.SRTTbacon_Server_Name + "/Remove_Files.dat"); string[] Read = str.ReadToEnd().Split('\n'); str.Dispose(); foreach (string Line in Read) { if (Line != "") { try { File.Delete(Voice_Set.Special_Path + "/Server/" + Voice_Set.SRTTbacon_Server_Name + "/Voices/" + Line); } catch { } } } } if (Voice_Set.FTPClient.File_Exist("/WoTB_Voice_Mod/" + Voice_Set.SRTTbacon_Server_Name + "/Add_Files.dat")) { bool IsChanged = false; StreamReader str = Voice_Set.FTPClient.GetFileRead("/WoTB_Voice_Mod/" + Voice_Set.SRTTbacon_Server_Name + "/Add_Files.dat"); string[] Read = str.ReadToEnd().Split('\n'); str.Dispose(); foreach (string Line in Read) { if (Line != "") { try { Voice_Set.FTPClient.DownloadFile("/WoTB_Voice_Mod/" + Voice_Set.SRTTbacon_Server_Name + "/Voices/" + Line, Voice_Set.Special_Path + "/Server/" + Voice_Set.SRTTbacon_Server_Name + "/Voices/" + Line); IsChanged = true; } catch { } } } if (IsChanged) { string[] Temp = Directory.GetFiles(Voice_Set.Special_Path + "/Server/" + Voice_Set.SRTTbacon_Server_Name + "/Voices"); List <string> Temp_01 = new List <string>(); for (int Number = 0; Number <= Temp.Length - 1; Number++) { if (!Voice_Set.Voice_Name_Hide(Temp[Number])) { Temp_01.Add(System.IO.Path.GetFileName(Temp[Number])); } } Voice_Set.Voice_Files = Temp_01; } } } catch (Exception e) { MessageBox.Show("エラー:" + e.Message); Sub_Code.Error_Log_Write(e.Message); } }
public static int DVPL_UnPack(List <string> From_Files, bool IsFromFileDelete) { if (From_Files.Count == 0) { return(0); } List <int> File_Numbers = new List <int>(); for (int Number = 0; Number < From_Files.Count; Number++) { if (File.Exists(From_Files[Number]) && Path.GetExtension(From_Files[Number]) == ".dvpl") { File.Copy(From_Files[Number], Voice_Set.Special_Path + "/DVPL/" + Number + ".tmp.dvpl", true); File_Numbers.Add(Number); } } if (File_Numbers.Count == 0) { return(0); } StreamWriter DVPL_Unpack = File.CreateText(Voice_Set.Special_Path + "/DVPL/UnPack.bat"); DVPL_Unpack.WriteLine("chcp 65001"); DVPL_Unpack.Write("\"" + Voice_Set.Special_Path + "/DVPL/DVPL_Extract.exe\""); DVPL_Unpack.Close(); ProcessStartInfo processStartInfo = new ProcessStartInfo { FileName = Voice_Set.Special_Path + "/DVPL/UnPack.bat", CreateNoWindow = true, RedirectStandardInput = true, RedirectStandardOutput = true, WorkingDirectory = Voice_Set.Special_Path + "/DVPL", UseShellExecute = false }; p = Process.Start(processStartInfo); p.StandardInput.WriteLine("\r\n"); p.OutputDataReceived += new DataReceivedEventHandler(WriteMessage); p.BeginOutputReadLine(); p.WaitForExit(); p.Close(); p.Dispose(); int Move_Count = 0; foreach (int Number in File_Numbers) { if (Sub_Code.File_Move(Voice_Set.Special_Path + "/DVPL/" + Number + ".tmp", Path.GetDirectoryName(From_Files[Number]) + "\\" + Path.GetFileNameWithoutExtension(From_Files[Number]), true)) { Move_Count++; if (IsFromFileDelete) { try { File.Delete(From_Files[Number]); } catch { } } } else if (File.Exists(Voice_Set.Special_Path + "/DVPL/" + Number + ".tmp")) { try { File.Delete(Voice_Set.Special_Path + "/DVPL/" + Number + ".tmp"); } catch { } } } File.Delete(Voice_Set.Special_Path + "/DVPL/UnPack.bat"); return(Move_Count); }
public static void Set_SE_Change_Name(string Project_SE_Dir) { if (SE_Enable_Disable[0]) { Sub_Code.File_Move(Project_SE_Dir + "/Capture_Finish_SE.wav", Project_SE_Dir + "/Capture_Finish_SE_tmp.wav", true); } else { Sub_Code.File_Move(Project_SE_Dir + "/Capture_Finish_SE_tmp.wav", Project_SE_Dir + "/Capture_Finish_SE.wav", true); } if (SE_Enable_Disable[1]) { Sub_Code.File_Move(Project_SE_Dir + "/quick_commands_attack.wav", Project_SE_Dir + "/quick_commands_attack_tmp.wav", true); Sub_Code.File_Move(Project_SE_Dir + "/quick_commands_attack_target.wav", Project_SE_Dir + "/quick_commands_attack_target_tmp.wav", true); Sub_Code.File_Move(Project_SE_Dir + "/quick_commands_capture_base.wav", Project_SE_Dir + "/quick_commands_capture_base_tmp.wav", true); Sub_Code.File_Move(Project_SE_Dir + "/quick_commands_positive.wav", Project_SE_Dir + "/quick_commands_positive_tmp.wav", true); Sub_Code.File_Move(Project_SE_Dir + "/quick_commands_defend_base.wav", Project_SE_Dir + "/quick_commands_defend_base_tmp.wav", true); Sub_Code.File_Move(Project_SE_Dir + "/quick_commands_help_me.wav", Project_SE_Dir + "/quick_commands_help_me_tmp.wav", true); Sub_Code.File_Move(Project_SE_Dir + "/quick_commands_negative.wav", Project_SE_Dir + "/quick_commands_negative_tmp.wav", true); Sub_Code.File_Move(Project_SE_Dir + "/quick_commands_reloading.wav", Project_SE_Dir + "/quick_commands_reloading_tmp.wav", true); } else { Sub_Code.File_Move(Project_SE_Dir + "/quick_commands_attack_tmp.wav", Project_SE_Dir + "/quick_commands_attack.wav", true); Sub_Code.File_Move(Project_SE_Dir + "/quick_commands_attack_target_tmp.wav", Project_SE_Dir + "/quick_commands_attack_target.wav", true); Sub_Code.File_Move(Project_SE_Dir + "/quick_commands_capture_base_tmp.wav", Project_SE_Dir + "/quick_commands_capture_base.wav", true); Sub_Code.File_Move(Project_SE_Dir + "/quick_commands_positive_tmp.wav", Project_SE_Dir + "/quick_commands_positive.wav", true); Sub_Code.File_Move(Project_SE_Dir + "/quick_commands_defend_base_tmp.wav", Project_SE_Dir + "/quick_commands_defend_base.wav", true); Sub_Code.File_Move(Project_SE_Dir + "/quick_commands_help_me_tmp.wav", Project_SE_Dir + "/quick_commands_help_me.wav", true); Sub_Code.File_Move(Project_SE_Dir + "/quick_commands_negative_tmp.wav", Project_SE_Dir + "/quick_commands_negative.wav", true); Sub_Code.File_Move(Project_SE_Dir + "/quick_commands_reloading_tmp.wav", Project_SE_Dir + "/quick_commands_reloading.wav", true); } if (SE_Enable_Disable[6]) { Sub_Code.File_Move(Project_SE_Dir + "/Musenki_01.wav", Project_SE_Dir + "/Musenki_01_temp.wav", true); } else { Sub_Code.File_Move(Project_SE_Dir + "/Musenki_01_temp.wav", Project_SE_Dir + "/Musenki_01.wav", true); } if (SE_Enable_Disable[9]) { Sub_Code.File_Move(Project_SE_Dir + "/howitzer_load_01.wav", Project_SE_Dir + "/howitzer_load_01_tmp.wav", true); Sub_Code.File_Move(Project_SE_Dir + "/howitzer_load_03.wav", Project_SE_Dir + "/howitzer_load_03_tmp.wav", true); Sub_Code.File_Move(Project_SE_Dir + "/howitzer_load_04.wav", Project_SE_Dir + "/howitzer_load_04_tmp.wav", true); Sub_Code.File_Move(Project_SE_Dir + "/howitzer_load_05.wav", Project_SE_Dir + "/howitzer_load_05_tmp.wav", true); } else { Sub_Code.File_Move(Project_SE_Dir + "/howitzer_load_01_tmp.wav", Project_SE_Dir + "/howitzer_load_01.wav", true); Sub_Code.File_Move(Project_SE_Dir + "/howitzer_load_03_tmp.wav", Project_SE_Dir + "/howitzer_load_03.wav", true); Sub_Code.File_Move(Project_SE_Dir + "/howitzer_load_04_tmp.wav", Project_SE_Dir + "/howitzer_load_04.wav", true); Sub_Code.File_Move(Project_SE_Dir + "/howitzer_load_05_tmp.wav", Project_SE_Dir + "/howitzer_load_05.wav", true); } if (SE_Enable_Disable[10]) { Sub_Code.File_Move(Project_SE_Dir + "/lamp_SE_01.wav", Project_SE_Dir + "/lamp_SE_01_tmp.wav", true); } else { Sub_Code.File_Move(Project_SE_Dir + "/lamp_SE_01_tmp.wav", Project_SE_Dir + "/lamp_SE_01.wav", true); } if (SE_Enable_Disable[11]) { Sub_Code.File_Move(Project_SE_Dir + "/enemy_sight.wav", Project_SE_Dir + "/enemy_sight_tmp.wav", true); } else { Sub_Code.File_Move(Project_SE_Dir + "/enemy_sight_tmp.wav", Project_SE_Dir + "/enemy_sight.wav", true); } if (SE_Enable_Disable[12]) { Sub_Code.File_Move(Project_SE_Dir + "/Timer_SE.wav", Project_SE_Dir + "/Timer_SE_tmp.wav", true); } else { Sub_Code.File_Move(Project_SE_Dir + "/Timer_SE_tmp.wav", Project_SE_Dir + "/Timer_SE.wav", true); } if (SE_Enable_Disable[13]) { Sub_Code.File_Move(Project_SE_Dir + "/target_on_SE_01.wav", Project_SE_Dir + "/target_on_SE_01_tmp.wav", true); } else { Sub_Code.File_Move(Project_SE_Dir + "/target_on_SE_01_tmp.wav", Project_SE_Dir + "/target_on_SE_01.wav", true); } if (SE_Enable_Disable[14]) { Sub_Code.File_Move(Project_SE_Dir + "/target_off_SE_01.wav", Project_SE_Dir + "/target_off_SE_01_tmp.wav", true); } else { Sub_Code.File_Move(Project_SE_Dir + "/target_off_SE_01_tmp.wav", Project_SE_Dir + "/target_off_SE_01.wav", true); } }