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();
            }
        }
Exemple #2
0
 public TranslateFrmSettingsForm(GameTranslateForm formTop, GameTranslateBackForm formBack)
 {
     openflag = true;
     InitializeComponent();
     gtlf  = formTop;
     gtlbf = formBack;
 }
        private void FunConfirmBtn_BtnClick(object sender, EventArgs e)
        {
            isNormalClose       = true;
            Common.HookCodePlus = TextractorFunListView.SelectedItems[0].SubItems[2].Text;
            GameTranslateForm gtf = new GameTranslateForm();

            Common.TextractorHandle.SetSettingsOutPutform(null);
            Common.TextractorHandle.SetGameTransForm(gtf);
            GameTranslateBackForm.Show(gtf);
            this.Close();
        }
Exemple #4
0
        /// <summary>
        /// 自动开始游戏按钮点击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AutoStartBtn_BtnClick(object sender, EventArgs e)
        {
            List <int> res = GetGameListHasProcessGame_PID_ID();

            if (res == null)
            {
                MessageBox.Show("未找到任何正在运行中的已保存游戏", "提示");
            }
            else
            {
                Common.TransMode = 1;
                Common.GameID    = res[1];

                SQLiteHelper  sqliteH = new SQLiteHelper(Environment.CurrentDirectory + "\\settings\\GameList.sqlite");
                List <string> ls      = sqliteH.ExecuteReader_OneLine(string.Format("SELECT * FROM gamelist WHERE gameID = '{0}';", res[1]), 8);

                Common.HookCode     = ls[4];
                Common.RepeatMethod = ls[7];
                Common.srcLang      = ls[5];
                Common.desLang      = ls[6];

                List <Process> proList = FindSameNameProcess(res[0]);
                if (proList.Count == 1)
                {
                    Common.TextractorHandle = new TextHookHandle(proList[0].Id);
                }
                else
                {
                    Common.TextractorHandle = new TextHookHandle(proList);
                }

                Common.TextractorHandle.Init();

                bool isFunReSelect = Convert.ToBoolean(ls[3]);

                if (isFunReSelect == true)
                {
                    TextractorFunReConfirmForm tfcf = new TextractorFunReConfirmForm();
                    Common.TextractorHandle.StartHook();
                    Common.TextractorHandle.SetSettingsOutPutform(tfcf);
                    tfcf.Show();
                }
                else
                {
                    Common.HookCodePlus = "NoMulti";//提示无重复码。直接进游戏
                    GameTranslateForm gtf = new GameTranslateForm();
                    Common.TextractorHandle.StartHook();
                    Common.TextractorHandle.SetGameTransForm(gtf);
                    GameTranslateBackForm.Show(gtf);
                }
            }
        }
        /// <summary>
        /// 自动开始游戏按钮点击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AutoStartBtn_BtnClick(object sender, EventArgs e)
        {
            List <int> res = GetGameListHasProcessGame_PID_ID();

            if (res == null)
            {
                MessageBox.Show("未找到任何正在运行中的已保存游戏", "提示");
            }
            else
            {
                Common.TransMode    = 1;
                Common.GameID       = res[1];
                Common.HookCode     = IniFileHelper.ReadItemValue(Environment.CurrentDirectory + "\\GameListInfo.ini", "Game" + Common.GameID, "hookCode");
                Common.RepeatMethod = IniFileHelper.ReadItemValue(Environment.CurrentDirectory + "\\GameListInfo.ini", "Game" + Common.GameID, "RepeatMethod");
                Common.srcLang      = IniFileHelper.ReadItemValue(Environment.CurrentDirectory + "\\GameListInfo.ini", "Game" + Common.GameID, "srcLang");
                Common.desLang      = IniFileHelper.ReadItemValue(Environment.CurrentDirectory + "\\GameListInfo.ini", "Game" + Common.GameID, "dstLang");

                List <Process> proList = FindSameNameProcess(res[0]);
                if (proList.Count == 1)
                {
                    Common.TextractorHandle = new TextHookHandle(proList[0].Id);
                }
                else
                {
                    Common.TextractorHandle = new TextHookHandle(proList);
                }

                Common.TextractorHandle.Init();

                bool isFunReSelect = Convert.ToBoolean(IniFileHelper.ReadItemValue(Environment.CurrentDirectory + "\\GameListInfo.ini", "Game" + Common.GameID, "isHookFunMulti", "False"));

                if (isFunReSelect == true)
                {
                    TextractorFunReConfirmForm tfcf = new TextractorFunReConfirmForm();
                    Common.TextractorHandle.StartHook();
                    Common.TextractorHandle.SetSettingsOutPutform(tfcf);
                    tfcf.Show();
                }
                else
                {
                    Common.HookCodePlus = "NoMulti";//提示无重复码。直接进游戏
                    GameTranslateForm gtf = new GameTranslateForm();
                    Common.TextractorHandle.StartHook();
                    Common.TextractorHandle.SetGameTransForm(gtf);
                    GameTranslateBackForm.Show(gtf);
                }
            }
        }
Exemple #6
0
        private void ConfirmLangBtn_BtnClick(object sender, EventArgs e)
        {
            if (srcLangCombox.SelectedValue == dstLangCombox.SelectedValue)
            {
                MessageBox.Show("源语言与目标语言不能一致!", "错误");
            }
            else
            {
                SQLiteHelper sqliteH = new SQLiteHelper(Environment.CurrentDirectory + "\\settings\\GameList.sqlite");
                sqliteH.ExecuteSql(string.Format("UPDATE gamelist SET srcLang = '{0}',dstLang = '{1}' WHERE gameID = {2};", srcLangCombox.SelectedValue, dstLangCombox.SelectedValue, Common.GameID));

                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();
            }
        }
        /// <summary>
        /// 背景窗口的静态方法,用于显示一个背景窗口
        /// </summary>
        /// <param name="frmTop">与其叠加的前景窗口</param>
        public static void Show(GameTranslateForm frmTop)
        {
            //弹出菜单设置
            MaterialSkin.Controls.MaterialContextMenuStrip FunMenuStrip = new MaterialSkin.Controls.MaterialContextMenuStrip();
            ToolStripMenuItem LockItem           = new ToolStripMenuItem();
            ToolStripMenuItem SettingsItem       = new ToolStripMenuItem();
            ToolStripMenuItem ReNewOCRItem       = new ToolStripMenuItem();
            ToolStripMenuItem HistoryTextItem    = new ToolStripMenuItem();
            ToolStripMenuItem ExitTransFrmItem   = new ToolStripMenuItem();
            ToolStripMenuItem ShowsrcTextFrmItem = new ToolStripMenuItem();
            ToolStripMenuItem PauseStartItem     = new ToolStripMenuItem();

            FunMenuStrip.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
            FunMenuStrip.Depth     = 0;
            FunMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
                LockItem,
                SettingsItem,
                ReNewOCRItem,
                HistoryTextItem,
                ShowsrcTextFrmItem,
                PauseStartItem,
                ExitTransFrmItem
            });
            FunMenuStrip.MouseState      = MaterialSkin.MouseState.HOVER;
            FunMenuStrip.ShowImageMargin = false;
            FunMenuStrip.Size            = new System.Drawing.Size(156, 136);
            //
            // 加锁解锁
            //
            LockItem.Size   = new System.Drawing.Size(155, 22);
            LockItem.Text   = "加锁/解锁";
            LockItem.Click += LockItem_Click;
            //
            // 设置
            //
            SettingsItem.Size   = new System.Drawing.Size(155, 22);
            SettingsItem.Text   = "设置";
            SettingsItem.Click += SettingsItem_Click;
            //
            // 刷新OCRToolStripMenuItem
            //
            ReNewOCRItem.Size   = new System.Drawing.Size(155, 22);
            ReNewOCRItem.Text   = "刷新OCR";
            ReNewOCRItem.Click += ReNewOCRItem_Click;
            //
            // 历史文本ToolStripMenuItem
            //
            HistoryTextItem.Size   = new System.Drawing.Size(155, 22);
            HistoryTextItem.Text   = "历史文本";
            HistoryTextItem.Click += HistoryTextItem_Click;
            //
            // 退出翻译ToolStripMenuItem
            //
            ExitTransFrmItem.Size   = new System.Drawing.Size(155, 22);
            ExitTransFrmItem.Text   = "退出翻译";
            ExitTransFrmItem.Click += ExitTransFrmItem_Click;
            //
            // 显示原文ToolStripMenuItem
            //
            ShowsrcTextFrmItem.Size   = new System.Drawing.Size(155, 22);
            ShowsrcTextFrmItem.Text   = "显示/隐藏原文";
            ShowsrcTextFrmItem.Click += ShowSrcTextItem_Click;
            //
            // 一件暂停/恢复ToolStripMenuItem
            //
            PauseStartItem.Size   = new System.Drawing.Size(155, 22);
            PauseStartItem.Text   = "暂停/恢复";
            PauseStartItem.Click += PauseStartItem_Click;


            top = frmTop;
            // 背景窗体设置
            GameTranslateBackForm frmBack = new GameTranslateBackForm();

            top.SetBackForm(frmBack);
            back = frmBack;

            double frmBackOpacity = (double)(double.Parse(Common.settings.TF_Opacity) / 100);

            frmBack.Text            = "MisakaTranslator游戏翻译窗口";
            frmBack.FormBorderStyle = FormBorderStyle.None;
            frmBack.MaximizeBox     = false;

            int LocX  = int.Parse(Common.settings.TF_LocX);
            int LocY  = int.Parse(Common.settings.TF_LocY);
            int SizeW = int.Parse(Common.settings.TF_SizeW);
            int SizeH = int.Parse(Common.settings.TF_SizeH);

            if (LocX == -1 && LocY == -1)
            {
                frmBack.StartPosition = FormStartPosition.CenterScreen;
            }
            else
            {
                frmBack.Location      = new Point(LocX, LocY);
                frmBack.StartPosition = FormStartPosition.Manual;
                frmBack.Width         = SizeW;
                frmBack.Height        = SizeH;
            }

            frmBack.ShowIcon      = false;
            frmBack.ShowInTaskbar = false;
            frmBack.Opacity       = frmBackOpacity;
            string color = Common.settings.TF_BackColor;

            if (color == "Noset")
            {
                frmBack.BackColor = Color.LightGray;
            }
            else
            {
                frmBack.BackColor = Color.FromArgb(int.Parse(color));
            }

            frmBack.ContextMenuStrip = FunMenuStrip;

            // 顶部窗体设置
            frmTop.Owner = frmBack;

            frmBack.SizeChanged      += GameTranslateBackForm_SizeLocationChanged;
            frmBack.LocationChanged  += GameTranslateBackForm_SizeLocationChanged;
            frmBack.MouseDoubleClick += GameTranslateBackForm_DoubleClick;
            frmBack.FormClosing      += GameTranslateBackForm_FormClosing;

            frmBack.TopMost = true;
            frmTop.TopMost  = true;

            isLock        = true;
            isShowSrcText = true;
            isPause       = false;

            // 显示窗体
            frmTop.Show();
            frmBack.Show();
        }
Exemple #8
0
 /// <summary>
 /// 设置背景窗口
 /// </summary>
 /// <param name="bk"></param>
 public void SetBackForm(GameTranslateBackForm bk)
 {
     back = bk;
 }