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);
     }
 }
Esempio n. 2
0
 //サーバーに接続(参加ではない)
 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, ""));
     }
 }
Esempio n. 3
0
        //終了
        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();
            }
        }
Esempio n. 4
0
 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();
 }
Esempio n. 5
0
        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);
         }
     }
 }
Esempio n. 7
0
 //管理者が設定を変更した場合それを反映
 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);
     }
 }