Exemplo n.º 1
0
        public TranslateWindow()
        {
            InitializeComponent();

            _isShowSource = true;
            _isLocked     = false;

            _gameTextHistory = new Queue <string>();

            this.Topmost = true;
            UI_Init();
            IsOCRingFlag = false;


            _wordSpliter = WordSpliterAuto(Common.appSettings.WordSpliter);

            _textSpeechHelper = new TextSpeechHelper();
            if (Common.appSettings.ttsVoice == "")
            {
                Growl.InfoGlobal(Application.Current.Resources["TranslateWin_NoTTS_Hint"].ToString());
            }
            else
            {
                _textSpeechHelper.SetTTSVoice(Common.appSettings.ttsVoice);
                _textSpeechHelper.SetVolume(Common.appSettings.ttsVolume);
                _textSpeechHelper.SetRate(Common.appSettings.ttsRate);
            }

            if (Common.appSettings.xxgPath != string.Empty)
            {
                _dict = new XxgJpzhDict();
                _dict.DictInit(Common.appSettings.xxgPath, string.Empty);
            }

            IsPauseFlag  = true;
            _translator1 = TranslatorAuto(Common.appSettings.FirstTranslator);
            _translator2 = TranslatorAuto(Common.appSettings.SecondTranslator);

            _beforeTransHandle = new BeforeTransHandle(Convert.ToString(Common.GameID), Common.UsingSrcLang, Common.UsingDstLang);
            _afterTransHandle  = new AfterTransHandle(_beforeTransHandle);

            _artificialTransHelper = new ArtificialTransHelper(Convert.ToString(Common.GameID));

            if (Common.transMode == 1)
            {
                Common.textHooker.Sevent += DataRecvEventHandler;
            }
            else if (Common.transMode == 2)
            {
                MouseKeyboardHook_Init();
            }

            toggleRec.ToolTip = Common.appSettings.ATon ? REC_OFF: REC_ON;
            updateToggleRecDisplay(false);
        }
Exemplo n.º 2
0
        public DictResWindow(string word, string kana = "----", TextSpeechHelper tsh = null)
        {
            sourceWord = word;
            InitializeComponent();
            if (tsh == null)
            {
                _textSpeechHelper = new TextSpeechHelper();
            }
            else
            {
                _textSpeechHelper = tsh;
            }


            if (Common.appSettings.ttsVoice == "")
            {
                Growl.InfoGlobal(Application.Current.Resources["TranslateWin_NoTTS_Hint"].ToString());
            }
            else
            {
                _textSpeechHelper.SetTTSVoice(Common.appSettings.ttsVoice);
                _textSpeechHelper.SetVolume(Common.appSettings.ttsVolume);
                _textSpeechHelper.SetRate(Common.appSettings.ttsRate);
            }

            if (Common.appSettings.xxgPath != string.Empty)
            {
                _dict = new XxgJpzhDict();
                _dict.DictInit(Common.appSettings.xxgPath, string.Empty);
            }

            string ret = _dict.SearchInDict(sourceWord);

            SourceWord.Text = sourceWord;

            Kana.Text = kana;

            this.Topmost    = true;
            DicResText.Text = XxgJpzhDict.RemoveHTML(ret);
        }
        public TranslateWindow()
        {
            InitializeComponent();

            IsShowSource = true;

            GameTextHistory = new Queue <string>();

            this.Topmost = true;
            UI_Init();
            IsOCRingFlag = false;

            mh = new MecabHelper();

            if (Common.appSettings.xxgPath != "")
            {
                dict = new XxgJpzhDict();
                dict.DictInit(Common.appSettings.xxgPath, "");
            }


            IsPauseFlag = true;
            translator1 = TranslatorAuto(Common.appSettings.FirstTranslator);
            translator2 = TranslatorAuto(Common.appSettings.SecondTranslator);

            bth = new BeforeTransHandle(Convert.ToString(Common.GameID), Common.UsingSrcLang, Common.UsingDstLang);
            ath = new AfterTransHandle(bth);

            if (Common.transMode == 1)
            {
                Common.textHooker.Sevent += DataRecvEventHandler;
            }
            else if (Common.transMode == 2)
            {
                MouseKeyboardHook_Init();
            }
        }