Пример #1
0
        /// <summary>
        /// ボイスロイドを起動する
        /// </summary>
        /// <param name="voiceroidId"> 対象のボイスロイド。無い場合は最初に見つけたやつ </param>
        /// <returns></returns>
        public static async Task <bool> Run(VoiceroidId?voiceroidId = null)
        {
            await factory.Update();

            bool result = false;

            foreach (IProcess process in factory.Processes)
            {
                if ((voiceroidId == null || voiceroidId == process.Id))
                {
                    string name = Enum.GetName(typeof(VoiceroidId), process.Id);
                    string exe  = DCM.GetCharaExe(name);
                    if (File.Exists(exe))
                    {
                        string error = await process.Run(exe);

                        if (error == null)
                        {
                            result = true;
                        }
                    }
                }
            }
            return(result);
        }
Пример #2
0
        private void Button_SelectExe(object sender, RoutedEventArgs e)
        {
            string name = (sender as Button).DataContext.ToString();
            var    dlg  = new MSAPI::Dialogs.CommonOpenFileDialog();

            dlg.Title            = "exeファイルの場所を選択してください";
            dlg.InitialDirectory = DCM.GetCharaExe(name);

            if (dlg.ShowDialog() == MSAPI::Dialogs.CommonFileDialogResult.Ok)
            {
                DCM.SetCharaExe(name, dlg.FileName);
            }
        }