示例#1
0
        public static Queue <string> TextractorOutPutHistory; //全局的Textractor的输出记录,用于查错


        /// <summary>
        /// 得到一个游戏的游戏ID,用于在GameListInfo.ini中对对应游戏进行个性化设置
        /// 如果游戏已经存在于GameList.txt,则直接返回ID,否则追加新游戏路径并返回新ID
        /// </summary>
        /// <param name="gamepath"></param>
        /// <returns></returns>
        public static int GetGameID(string gamepath)
        {
            if (File.Exists("GameList.txt") == false)
            {
                File.Create("GameList.txt").Close();
            }


            string[] res = File.ReadAllLines("GameList.txt");

            for (int i = 0; i < res.Length; i = i + 2)
            {
                if (res[i] == gamepath)
                {
                    return(int.Parse(res[i + 1]));
                }
            }

            FileStream   fs = new FileStream("GameList.txt", FileMode.Append);
            StreamWriter sw = new StreamWriter(fs);

            int newid = int.Parse(IniFileHelper.ReadItemValue(Environment.CurrentDirectory + "\\GameListInfo.ini", "AllGame", "GameNum", "0")) + 1;

            IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\GameListInfo.ini", "AllGame", "GameNum", "" + newid);

            sw.WriteLine(gamepath);
            sw.WriteLine(newid);
            sw.Flush();
            sw.Close();
            fs.Close();

            return(newid);
        }
示例#2
0
        private void TranslateFrmSettingsForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "opacity", "" + OpacityTrackBar.Value);

            if (lastPartChoose == 0)
            {
                IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "srcTextColorR", "" + ColorRTrackBar.Value);
                IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "srcTextColorG", "" + ColorGTrackBar.Value);
                IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "srcTextColorB", "" + ColorBTrackBar.Value);
                IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "srcTextFont", FontsCombox.Text);
                IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "srcTextsize", "" + TextSizeBox.Num);
            }
            else if (lastPartChoose == 1)
            {
                IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "firstTransTextColorR", "" + ColorRTrackBar.Value);
                IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "firstTransTextColorG", "" + ColorGTrackBar.Value);
                IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "firstTransTextColorB", "" + ColorBTrackBar.Value);
                IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "firstTransTextFont", FontsCombox.Text);
                IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "firstTransTextsize", "" + TextSizeBox.Num);
            }
            else if (lastPartChoose == 2)
            {
                IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "secondTransTextColorR", "" + ColorRTrackBar.Value);
                IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "secondTransTextColorG", "" + ColorGTrackBar.Value);
                IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "secondTransTextColorB", "" + ColorBTrackBar.Value);
                IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "secondTransTextFont", FontsCombox.Text);
                IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "secondTransTextsize", "" + TextSizeBox.Num);
            }
        }
        private void ConfirmLangBtn_BtnClick(object sender, EventArgs e)
        {
            if (srcLangCombox.SelectedValue == dstLangCombox.SelectedValue)
            {
                MessageBox.Show("源语言与目标语言不能一致!", "错误");
            }
            else
            {
                IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\GameListInfo.ini", "Game" + Common.GameID,
                                         "srcLang", srcLangCombox.SelectedValue); //保存游戏源语言
                IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\GameListInfo.ini", "Game" + Common.GameID,
                                         "dstLang", dstLangCombox.SelectedValue); //保存目标翻译语言
                Common.srcLang = srcLangCombox.SelectedValue;
                Common.desLang = dstLangCombox.SelectedValue;

                GameTranslateForm gtlf = new GameTranslateForm();
                if (Common.TransMode != 2)
                {
                    Common.TextractorHandle.SetGameTransForm(gtlf);
                }

                GameTranslateBackForm.Show(gtlf);
                this.Close();
            }
        }
示例#4
0
        private void JBjTransTestBtn_BtnClick(object sender, EventArgs e)
        {
            IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "JBeijing", "JBJCTDllPath", JBjPathBox.InputText);
            string res = JBeijingTranslator.Translate_JapanesetoChinese(JbjTestTextBox.InputText);

            MessageBox.Show(res, "翻译结果");
        }
 /// <summary>
 /// 背景窗口关闭时保存位置和大小
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private static void GameTranslateBackForm_FormClosing(object sender, EventArgs e)
 {
     IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "LocX", back.Left.ToString());
     IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "LocY", back.Top.ToString());
     IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "SizeW", back.Width.ToString());
     IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "SizeH", back.Height.ToString());
 }
        private void ConfirmBtn_BtnClick(object sender, EventArgs e)
        {
            isNormalClose = true;

            Common.RepeatMethod = FunctionSelectCombox.SelectedValue;
            IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\GameListInfo.ini", "Game" + Common.GameID,
                                     "RepeatMethod", FunctionSelectCombox.SelectedValue);//保存去重方法,之后可能会用到
            Common.TransMode = 1;
            Common.TextractorHandle.SetSettingsOutPutform(null);
            TransLangSettingForm tlsf = new TransLangSettingForm();

            tlsf.Show();
            this.Close();
        }
        private void ConfirmHookBtn_BtnClick(object sender, EventArgs e)
        {
            if (TextractorFunListView.SelectedItems.Count != 0)
            {
                Common.TextractorHandle.SetSettingsOutPutform(null);//先关闭对本窗口的输出

                string[] res = TextHookHandle.DealCode(TextractorFunListView.SelectedItems[0].SubItems[2].Text);

                int sum = 0;
                for (int i = 0; i < TextractorFunListView.Items.Count; i++)
                {
                    if (TextractorFunListView.Items[i].SubItems[2].Text.Contains(res[0]))
                    {
                        sum++;
                    }
                    if (sum >= 2)
                    {
                        IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\GameListInfo.ini",
                                                 "Game" + Common.GameID, "isHookFunMulti", "True");
                        break;
                    }
                }

                //不满足的游戏也应该记录一下
                if (sum <= 1)
                {
                    IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\GameListInfo.ini",
                                             "Game" + Common.GameID, "isHookFunMulti", "False");
                }

                IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\GameListInfo.ini", "Game" + Common.GameID,
                                         "hookCode", res[0]);//保存特殊码,以后可以自动匹配这个游戏,但需要重设Plus部分

                Common.HookCode     = res[0];
                Common.HookCodePlus = res[1];

                isNormalClose = true;

                TextRepeatRepairForm trrf = new TextRepeatRepairForm();
                Common.TextractorHandle.SetSettingsOutPutform(trrf);
                trrf.Show();

                this.Close();
            }
            else
            {
                MessageBox.Show("请先选择一个Hook方法再进行下一步操作!", "提示");
            }
        }
示例#8
0
        private void BaiduOCRTestBtn_BtnClick(object sender, EventArgs e)
        {
            IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "BaiduOCR", "APIKEY", BDOCRapikeyTextBox.InputText);
            IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "BaiduOCR", "SecretKey", BDOCRsecretkeyTextBox.InputText);

            bool ret = BaiduGeneralOCRBasic.BaiduGeneralOCRBasic_Init();

            if (ret == true)
            {
                MessageBox.Show("百度OCR API工作正常", "提示");
            }
            else
            {
                MessageBox.Show("百度OCR API工作异常,请检查填写是否正确", "错误");
            }
        }
示例#9
0
        private void ConfirmBtn_BtnClick(object sender, EventArgs e)
        {
            if (SelectGameWindowBtn.BtnText == "结束选择")
            {
                hook.Stop();
            }

            if (gamePID != -1)
            {
                string game_ID = null;
                try
                {
                    game_ID = FindProcessPath(gamePID);
                }
                catch (System.ComponentModel.Win32Exception ex)
                {
                    MessageBox.Show("无法捕捉64位程序,请使用64位翻译器再次尝试", "错误");
                    return;
                }
                Common.GameID = Common.GetGameID(game_ID);
                IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\GameListInfo.ini", "Game" + Common.GameID, "gameName", System.IO.Path.GetFileName(game_ID));

                if (SameNameGameProcessList.Count == 1)
                {
                    Common.TextractorHandle = new TextHookHandle(gamePID);
                }
                else
                {
                    Common.TextractorHandle = new TextHookHandle(SameNameGameProcessList);
                }
                Common.TextractorHandle.Init();
                Common.TextractorHandle.StartHook();

                this.TopMost = false;

                TextractorFunSelectForm tfsf = new TextractorFunSelectForm();
                Common.TextractorHandle.SetSettingsOutPutform(tfsf);
                tfsf.Show();

                this.Close();
            }
            else
            {
                MessageBox.Show("请先选择一个进程再进行下一步操作!", "提示");
            }
        }
示例#10
0
 private void ChooseJBjPathBtn_BtnClick(object sender, EventArgs e)
 {
     System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog();
     dialog.Description = "请选择Txt所在文件夹";
     if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         if (string.IsNullOrEmpty(dialog.SelectedPath))
         {
             MessageBox.Show("文件夹路径不能为空", "提示");
         }
         else
         {
             JBjPathBox.InputText = dialog.SelectedPath;
             IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "JBeijing", "JBJCTDllPath", JBjPathBox.InputText);
         }
     }
 }
示例#11
0
        private void TXOTransTextTestBtn_BtnClick(object sender, EventArgs e)
        {
            IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TencentOldTranslator", "SecretId", TXOappidTextBox.InputText);
            IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TencentOldTranslator", "SecretKey", TXOKeyTextBox.InputText);

            TencentOldTranslator.TencentOldTrans_Init();
            string ret = TencentOldTranslator.TencentOld_Translate(TXOTestTextBox.InputText, TXODesLangBox.InputText, TXOSrcLangBox.InputText);

            TencentOldTransOutInfo oinfo = JsonConvert.DeserializeObject <TencentOldTransOutInfo>(ret);

            if (oinfo.Response.Error == null)
            {
                MessageBox.Show(oinfo.Response.TargetText, "翻译结果");
            }
            else
            {
                MessageBox.Show("翻译过程中出现错误,请先进行API认证测试!", "错误");
            }
        }
示例#12
0
        private void TXOAPITestBtn_BtnClick(object sender, EventArgs e)
        {
            IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TencentOldTranslator", "SecretId", TXOappidTextBox.InputText);
            IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TencentOldTranslator", "SecretKey", TXOKeyTextBox.InputText);

            TencentOldTranslator.TencentOldTrans_Init();
            string ret = TencentOldTranslator.TencentOld_Translate("apple", "zh", "en");

            TencentOldTransOutInfo oinfo = JsonConvert.DeserializeObject <TencentOldTransOutInfo>(ret);

            if (oinfo.Response.Error == null)
            {
                MessageBox.Show("腾讯翻译API(旧版)工作正常!", "提示");
            }
            else
            {
                MessageBox.Show("腾讯翻译API(旧版)工作异常,错误代码:" + oinfo.Response.Error.Code + " \n错误信息:" + oinfo.Response.Error.Message, "错误");
            }
        }
示例#13
0
        private void BaiduAPITestBtn_BtnClick(object sender, EventArgs e)
        {
            IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "BaiduTranslator", "appID", BDappidTextBox.InputText);
            IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "BaiduTranslator", "secretKey", BDKeyTextBox.InputText);

            BaiduTranslator.BaiduTrans_Init();
            string ret = BaiduTranslator.Baidu_Translate("apple", "zh");

            BaiduTransOutInfo oinfo = JsonConvert.DeserializeObject <BaiduTransOutInfo>(ret);

            if (oinfo.error_code == null || oinfo.error_code == "52000")
            {
                MessageBox.Show("百度翻译API工作正常!", "提示");
            }
            else
            {
                MessageBox.Show("百度翻译API工作异常,错误代码:" + oinfo.error_code + " \n您可以核对官方描述的错误代码来尝试解决问题!", "错误");
            }
        }
示例#14
0
        private void BDTransTextTestBtn_BtnClick(object sender, EventArgs e)
        {
            IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "BaiduTranslator", "appID", BDappidTextBox.InputText);
            IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "BaiduTranslator", "secretKey", BDKeyTextBox.InputText);

            BaiduTranslator.BaiduTrans_Init();
            string ret = BaiduTranslator.Baidu_Translate(BDTestTextBox.InputText, BDDesLangBox.InputText, BDSrcLangBox.InputText);

            BaiduTransOutInfo oinfo = JsonConvert.DeserializeObject <BaiduTransOutInfo>(ret);

            if (oinfo.trans_result.Count == 1)
            {
                MessageBox.Show(oinfo.trans_result[0].dst, "翻译结果");
            }
            else
            {
                MessageBox.Show("翻译过程中出现错误,请先进行API认证测试!", "错误");
            }
        }
示例#15
0
        private void TXTransTextTestBtn_BtnClick(object sender, EventArgs e)
        {
            IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TencentTranslator", "appID", TXappidTextBox.InputText);
            IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TencentTranslator", "appKey", TXKeyTextBox.InputText);

            TencentTranslator.TencentTrans_Init();
            string ret = TencentTranslator.Fanyijun_Translate(TXTestTextBox.InputText, TXDesLangBox.InputText, TXSrcLangBox.InputText);

            TencentTransOutInfo oinfo = JsonConvert.DeserializeObject <TencentTransOutInfo>(ret);

            if (oinfo.ret == "0")
            {
                MessageBox.Show(oinfo.data.target_text, "翻译结果");
            }
            else
            {
                MessageBox.Show("翻译过程中出现错误,请先进行API认证测试!", "错误");
            }
        }
示例#16
0
        private void TXAPITestBtn_BtnClick(object sender, EventArgs e)
        {
            IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TencentTranslator", "appID", TXappidTextBox.InputText);
            IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TencentTranslator", "appKey", TXKeyTextBox.InputText);

            TencentTranslator.TencentTrans_Init();
            string ret = TencentTranslator.Fanyijun_Translate("apple", "zh", "en");

            TencentTransOutInfo oinfo = JsonConvert.DeserializeObject <TencentTransOutInfo>(ret);

            if (oinfo.ret == "0")
            {
                MessageBox.Show("腾讯翻译API工作正常!", "提示");
            }
            else
            {
                MessageBox.Show("腾讯翻译API工作异常,错误代码:" + oinfo.ret + " \n错误描述:" + oinfo.msg, "错误");
            }
        }
示例#17
0
 private void SecondTransCombox_SelectedChangedEvent(object sender, EventArgs e)
 {
     IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "Translate_All", "SecondTranslator", SecondTransCombox.SelectedValue);
 }
示例#18
0
        /*
         *
         *
         * const int WM_NCHITTEST = 0x0084;
         * const int HTLEFT = 10;
         * const int HTRIGHT = 11;
         * const int HTTOP = 12;
         * const int HTTOPLEFT = 13;
         * const int HTTOPRIGHT = 14;
         * const int HTBOTTOM = 15;
         * const int HTBOTTOMLEFT = 0x10;
         * const int HTBOTTOMRIGHT = 17;
         * protected override void WndProc(ref Message m)
         * {
         *  base.WndProc(ref m);
         *  switch (m.Msg)
         *  {
         *      case WM_NCHITTEST:
         *          Point vPoint = new Point((int)m.LParam & 0xFFFF,
         *              (int)m.LParam >> 16 & 0xFFFF);
         *          vPoint = PointToClient(vPoint);
         *          if (vPoint.X <= 5)
         *              if (vPoint.Y <= 5)
         *                  m.Result = (IntPtr)HTTOPLEFT;
         *              else if (vPoint.Y >= ClientSize.Height - 5)
         *                  m.Result = (IntPtr)HTBOTTOMLEFT;
         *              else m.Result = (IntPtr)HTLEFT;
         *          else if (vPoint.X >= ClientSize.Width - 5)
         *              if (vPoint.Y <= 5)
         *                  m.Result = (IntPtr)HTTOPRIGHT;
         *              else if (vPoint.Y >= ClientSize.Height - 5)
         *                  m.Result = (IntPtr)HTBOTTOMRIGHT;
         *              else m.Result = (IntPtr)HTRIGHT;
         *          else if (vPoint.Y <= 5)
         *              m.Result = (IntPtr)HTTOP;
         *          else if (vPoint.Y >= ClientSize.Height - 5)
         *              m.Result = (IntPtr)HTBOTTOM;
         *          break;
         *  }
         * }
         *
         * [DllImport("user32.dll")]
         * public static extern bool ReleaseCapture();
         * [DllImport("user32.dll")]
         * public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
         * public const int WM_SYSCOMMAND = 0x0112;
         * public const int SC_MOVE = 0xF010;
         * public const int HTCAPTION = 0x0002;
         */
        /*
         * //之前的窗口改变大小部分代码,已弃用
         * private void GameTranslateForm_Move(object sender, EventArgs e)
         * {
         *  ReleaseCapture();
         *
         *  SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
         *
         * }
         */
        /*
         * //之前的窗口拖动部分代码,已弃用
         * private void TransparentPanel_MouseDown(object sender, MouseEventArgs e)
         * {
         *  mouse_offset = new Point(-e.X, -e.Y);
         * }
         *
         * private void TransparentPanel_MouseMove(object sender, MouseEventArgs e)
         * {
         *
         *  if (e.Button == MouseButtons.Left)
         *  {
         *      Point mousePos = Control.MousePosition;
         *      mousePos.Offset(mouse_offset.X, mouse_offset.Y);
         *      Location = mousePos;
         *  }
         *
         * }
         */


        /// <summary>
        /// 自动进行游戏翻译
        /// 检查是否设置了分行翻译、去掉一些乱码类型的符号、检查是否空文本
        /// </summary>
        /// <param name="text"></param>
        /// <param name="srcLang"></param>
        /// <param name="desLang"></param>
        public void GameTranslateAuto(string text, string srcLang, string desLang)
        {
            //先检查玩家是否设置了分行翻译
            bool eachRowTrans = Convert.ToBoolean(IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "Translate_All", "EachRowTrans", "True"));

            if (eachRowTrans == false)
            {
                text = text.Replace("<br>", "").Replace("</br>", "").Replace("\n", "").Replace("\t", "").Replace("\r", "");
            }

            //处理:去掉一些乱码类型的符号
            text = text.Replace("_", "").Replace("-", "").Replace("+", "");

            string currentAPI;
            string ret = "";

            for (int i = 1; i <= 2; i++)
            {
                if (i == 1)
                {
                    currentAPI = firstTransAPI;
                }
                else
                {
                    currentAPI = secondTransAPI;
                }

                if (text == "")
                {
                    ret = "";
                }
                else
                {
                    if (currentAPI == "BaiduTranslator")
                    {
                        ret = BaiduTranslator.Baidu_Translate(text, desLang, srcLang);
                        if (ret == "Request Timeout")
                        {
                            ret = "[百度]翻译超时";
                        }
                        else
                        {
                            BaiduTransOutInfo oinfo = JsonConvert.DeserializeObject <BaiduTransOutInfo>(ret);
                            if (oinfo.trans_result != null)
                            {
                                ret = "";
                                for (int k = 0; k < oinfo.trans_result.Count; k++)
                                {
                                    ret = ret + oinfo.trans_result[k].dst + "\n";
                                }
                            }
                            else
                            {
                                ret = "[百度]翻译错误";
                            }
                        }
                    }
                    else if (currentAPI == "TencentTranslator")
                    {
                        ret = TencentTranslator.Fanyijun_Translate(text, desLang, srcLang);
                        if (ret == "Request Timeout")
                        {
                            ret = "[腾讯]翻译超时";
                        }
                        else
                        {
                            TencentTransOutInfo oinfo = JsonConvert.DeserializeObject <TencentTransOutInfo>(ret);
                            if (oinfo.data != null)
                            {
                                ret = oinfo.data.target_text;
                            }
                            else
                            {
                                ret = "[腾讯]翻译错误";
                            }
                        }
                    }
                    else if (currentAPI == "JBjTranslator")
                    {
                        ret = JBeijingTranslator.Translate_JapanesetoChinese(text);
                        if (ret == null || ret == "")
                        {
                            ret = "";
                        }
                    }
                    else if (currentAPI == "TencentOldTranslator")
                    {
                        ret = TencentOldTranslator.TencentOld_Translate(text, desLang, srcLang);
                        if (ret == "Request Timeout")
                        {
                            ret = "[腾讯旧]翻译超时";
                        }
                        else
                        {
                            TencentOldTransOutInfo oinfo = JsonConvert.DeserializeObject <TencentOldTransOutInfo>(ret);
                            if (oinfo.Response.TargetText != null)
                            {
                                ret = oinfo.Response.TargetText;
                            }
                            else
                            {
                                ret = "[腾讯旧]翻译错误";
                            }
                        }
                    }
                    else
                    {
                        ret = "";
                    }
                }

                if (i == 1)
                {
                    firstTransText = ret;
                }
                else
                {
                    secondTransText = ret;
                }
            }
        }
示例#19
0
 private void ChooseColorBtn_BtnClick(object sender, EventArgs e)
 {
     WinColorDialog.ShowDialog();
     gtlbf.BeginInvoke(new Action(() => { gtlbf.BackColor = this.WinColorDialog.Color; }));
     IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "BackColor", this.WinColorDialog.Color.ToArgb().ToString());
 }
示例#20
0
        private void PartCombox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (openflag != true)
            {
                if (lastPartChoose == 0)
                {
                    IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "srcTextColorR", "" + ColorRTrackBar.Value);
                    IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "srcTextColorG", "" + ColorGTrackBar.Value);
                    IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "srcTextColorB", "" + ColorBTrackBar.Value);
                    IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "srcTextFont", FontsCombox.Text);
                    IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "srcTextsize", "" + TextSizeBox.Num);
                }
                else if (lastPartChoose == 1)
                {
                    IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "firstTransTextColorR", "" + ColorRTrackBar.Value);
                    IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "firstTransTextColorG", "" + ColorGTrackBar.Value);
                    IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "firstTransTextColorB", "" + ColorBTrackBar.Value);
                    IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "firstTransTextFont", FontsCombox.Text);
                    IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "firstTransTextsize", "" + TextSizeBox.Num);
                }
                else if (lastPartChoose == 2)
                {
                    IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "secondTransTextColorR", "" + ColorRTrackBar.Value);
                    IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "secondTransTextColorG", "" + ColorGTrackBar.Value);
                    IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "secondTransTextColorB", "" + ColorBTrackBar.Value);
                    IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "secondTransTextFont", FontsCombox.Text);
                    IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "secondTransTextsize", "" + TextSizeBox.Num);
                }

                if (PartCombox.SelectedIndex == 0)
                {
                    ColorRTrackBar.Value = int.Parse(IniFileHelper.ReadItemValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "srcTextColorR", "0"));
                    ColorGTrackBar.Value = int.Parse(IniFileHelper.ReadItemValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "srcTextColorG", "0"));
                    ColorBTrackBar.Value = int.Parse(IniFileHelper.ReadItemValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "srcTextColorB", "0"));
                    FontsCombox.Text     = IniFileHelper.ReadItemValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "srcTextFont", "微软雅黑");
                    TextSizeBox.Num      = int.Parse(IniFileHelper.ReadItemValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "srcTextsize", "12"));
                }
                else if (PartCombox.SelectedIndex == 1)
                {
                    ColorRTrackBar.Value = int.Parse(IniFileHelper.ReadItemValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "firstTransTextColorR", "0"));
                    ColorGTrackBar.Value = int.Parse(IniFileHelper.ReadItemValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "firstTransTextColorG", "0"));
                    ColorBTrackBar.Value = int.Parse(IniFileHelper.ReadItemValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "firstTransTextColorB", "0"));
                    FontsCombox.Text     = IniFileHelper.ReadItemValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "firstTransTextFont", "微软雅黑");
                    TextSizeBox.Num      = int.Parse(IniFileHelper.ReadItemValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "firstTransTextsize", "12"));
                }
                else if (PartCombox.SelectedIndex == 2)
                {
                    ColorRTrackBar.Value = int.Parse(IniFileHelper.ReadItemValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "secondTransTextColorR", "0"));
                    ColorGTrackBar.Value = int.Parse(IniFileHelper.ReadItemValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "secondTransTextColorG", "0"));
                    ColorBTrackBar.Value = int.Parse(IniFileHelper.ReadItemValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "secondTransTextColorB", "0"));
                    FontsCombox.Text     = IniFileHelper.ReadItemValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "secondTransTextFont", "微软雅黑");
                    TextSizeBox.Num      = int.Parse(IniFileHelper.ReadItemValue(Environment.CurrentDirectory + "\\settings.ini", "TranslateFormSettings", "secondTransTextsize", "12"));
                }

                lastPartChoose = PartCombox.SelectedIndex;
            }
            else
            {
                openflag = false;
            }
        }
示例#21
0
 private void EachRowTransCheckBox_CheckedChangeEvent(object sender, EventArgs e)
 {
     IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "Translate_All", "EachRowTrans", Convert.ToString(EachRowTransCheckBox.Checked));
 }
示例#22
0
 private void AutoHookCheckBox_CheckedChangeEvent(object sender, EventArgs e)
 {
     IniFileHelper.WriteValue(Environment.CurrentDirectory + "\\settings.ini", "Textractor", "AutoHook", Convert.ToString(AutoHookCheckBox.Checked));
 }