Esempio n. 1
0
        public void DeInitPlugin()
        {
            try
            {
                // 置き換えたTTSメソッドを元に戻す
                if (this.originalTTSDelegate != null)
                {
                    ActGlobals.oFormActMain.PlayTtsMethod = this.originalTTSDelegate;
                }

                // FF14監視スレッドを開放する
                FF14Watcher.Deinitialize();

                // 漢字変換オブジェクトを開放する
                KanjiTranslator.Default.Dispose();

                // 設定を保存する
                TTSYukkuriConfig.Default.Save();

                // TTSサーバを終了する
                TTSServerController.End();

                // プレイヤを開放する
                NAudioPlayer.DisposePlayers();

                // TTS用waveファイルを削除する?
                if (TTSYukkuriConfig.Default.WaveCacheClearEnable)
                {
                    var appdir = Path.Combine(
                        Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                        @"anoyetta\ACT");

                    if (Directory.Exists(appdir))
                    {
                        foreach (var file in Directory.GetFiles(appdir, "*.wav"))
                        {
                            try
                            {
                                File.Delete(file);
                            }
                            catch
                            {
                            }
                        }
                    }
                }

                lblStatus.Text = "Plugin Exited";
            }
            catch (Exception ex)
            {
                ActGlobals.oFormActMain.WriteExceptionLog(
                    ex,
                    "TTSゆっくりプラグインの終了時に例外が発生しました。");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 後片付けをする
        /// </summary>
        public static void Deinitialize()
        {
            lock (lockObject)
            {
                if (instance != null)
                {
                    if (instance.watchTimer != null)
                    {
                        instance.watchTimer.Stop();
                        instance.watchTimer.Dispose();
                        instance.watchTimer = null;
                    }

                    instance = null;
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 初期化する
        /// </summary>
        public static void Initialize()
        {
            lock (lockObject)
            {
                if (instance == null)
                {
                    instance = new FF14Watcher();

                    instance.watchTimer = new System.Windows.Forms.Timer()
                    {
                        Interval = 600,
                        Enabled = false
                    };

                    instance.watchTimer.Tick += (s, e) =>
                    {
                        lock (lockObject)
                        {
                            try
                            {
                                if (instance.watchTimer != null &&
                                    instance.watchTimer.Enabled)
                                {
                                    instance.WatchCore();
                                }
                            }
                            catch (Exception ex)
                            {
                                ActGlobals.oFormActMain.WriteExceptionLog(
                                    ex,
                                    "ACT.TTSYukkuri FF14の監視スレッドで例外が発生しました");
                            }
                        }
                    };

                    // 監視を開始する
                    instance.watchTimer.Start();
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 初期化する
        /// </summary>
        public static void Initialize()
        {
            lock (lockObject)
            {
                if (instance == null)
                {
                    instance = new FF14Watcher();

                    instance.watchTimer = new System.Windows.Forms.Timer()
                    {
                        Interval = 600,
                        Enabled  = false
                    };

                    instance.watchTimer.Tick += (s, e) =>
                    {
                        lock (lockObject)
                        {
                            try
                            {
                                if (instance.watchTimer != null &&
                                    instance.watchTimer.Enabled)
                                {
                                    instance.WatchCore();
                                }
                            }
                            catch (Exception ex)
                            {
                                ActGlobals.oFormActMain.WriteExceptionLog(
                                    ex,
                                    "ACT.TTSYukkuri FF14の監視スレッドで例外が発生しました");
                            }
                        }
                    };

                    // 監視を開始する
                    instance.watchTimer.Start();
                }
            }
        }
Esempio n. 5
0
        public void InitPlugin(
            TabPage pluginScreenSpace,
            Label pluginStatusText)
        {
            try
            {
                pluginScreenSpace.Text = "TTSゆっくり";

                var plugin = ActGlobals.oFormActMain.PluginGetSelfData(this);
                if (plugin != null)
                {
                    TTSYukkuriPlugin.PluginDirectory = plugin.pluginFile.DirectoryName;
                }

                // 漢字変換を初期化する
                KanjiTranslator.Default.Initialize();

                // TTSサーバを開始する
                TTSServerController.Start();

                Application.ApplicationExit += (s, e) =>
                {
                    TTSServerController.End();
                };

                // TTSを初期化する
                TTSYukkuriConfig.Default.Load();
                SpeechController.Default.Initialize();

                // FF14監視スレッドを初期化する
                FF14Watcher.Initialize();

                // 設定Panelを追加する
                ConfigPanel      = new TTSYukkuriConfigPanel();
                ConfigPanel.Dock = DockStyle.Fill;
                pluginScreenSpace.Controls.Add(ConfigPanel);

                // Hand the status label's reference to our local var
                lblStatus = pluginStatusText;

                // TTSメソッドを置き換える
                this.originalTTSDelegate = (FormActMain.PlayTtsDelegate)ActGlobals.oFormActMain.PlayTtsMethod.Clone();
                ActGlobals.oFormActMain.PlayTtsMethod =
                    new FormActMain.PlayTtsDelegate(this.Speak);

                // アップデートを確認する
                this.Update();

                lblStatus.Text = "Plugin Started";
            }
            catch (Exception ex)
            {
                MessageBox.Show(
                    ActGlobals.oFormActMain,
                    "プラグインの初期化中に例外が発生しました。環境を確認してACTを再起動して下さい" + Environment.NewLine + Environment.NewLine +
                    ex.ToString(),
                    "TTSゆっくりプラグイン",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Exclamation);

                // TTSをゆっくりに戻す
                TTSYukkuriConfig.Default.TTS = TTSType.Yukkuri;
                TTSYukkuriConfig.Default.Save();
            }
        }
Esempio n. 6
0
        /// <summary>
        /// 後片付けをする
        /// </summary>
        public static void Deinitialize()
        {
            lock (lockObject)
            {
                if (instance != null)
                {
                    if (instance.watchTimer != null)
                    {
                        instance.watchTimer.Stop();
                        instance.watchTimer.Dispose();
                        instance.watchTimer = null;
                    }

                    instance = null;
                }
            }
        }