private void StartTranslateByGid(int gid)
        {
            var ps      = Process.GetProcesses();
            var pidList = new List <Process>();

            foreach (var process in ps)
            {
                string filepath;
                try {
                    filepath = process.MainModule.FileName;
                }
                catch (Exception) {
                    continue;
                    //这个地方直接跳过,是因为32位程序确实会读到64位的系统进程,而系统进程是不能被访问的
                    //throw ex;
                }

                if (gameInfoList[gid].FilePath == filepath)
                {
                    pidList.Add(process);
                }
            }

            if (pidList.Count == 0)
            {
                HandyControl.Controls.MessageBox.Show(Application.Current.Resources["MainWindow_StartError_Hint"].ToString(), Application.Current.Resources["MessageBox_Hint"].ToString());
                return;
            }
            else
            {
                var pid = pidList[0].Id;
                pidList.Clear();
                pidList = ProcessHelper.FindSameNameProcess(pid);
            }

            Common.GameID          = gameInfoList[gid].GameID;
            Common.transMode       = 1;
            Common.UsingDstLang    = gameInfoList[gid].DstLang;
            Common.UsingSrcLang    = gameInfoList[gid].SrcLang;
            Common.UsingRepairFunc = gameInfoList[gid].RepairFunc;

            switch (Common.UsingRepairFunc)
            {
            case "RepairFun_RemoveSingleWordRepeat":
                Common.repairSettings.SingleWordRepeatTimes = gameInfoList[gid].RepairParamA;
                break;

            case "RepairFun_RemoveSentenceRepeat":
                Common.repairSettings.SentenceRepeatFindCharNum = gameInfoList[gid].RepairParamA;
                break;

            case "RepairFun_RegexReplace":
                Common.repairSettings.Regex         = gameInfoList[gid].RepairParamA;
                Common.repairSettings.Regex_Replace = gameInfoList[gid].RepairParamB;
                break;

            default:
                break;
            }

            Common.RepairFuncInit();

            Common.textHooker = pidList.Count == 1 ? new TextHookHandle(pidList[0].Id) : new TextHookHandle(pidList);

            Common.textHooker.Init(!gameInfoList[gid].Isx64);
            Common.textHooker.HookCodeList.Add(gameInfoList[gid].Hookcode);
            Common.textHooker.HookCode_Custom = gameInfoList[gid].HookCodeCustom;

            if (gameInfoList[gid].IsMultiHook)
            {
                var ggw = new GameGuideWindow(3);
                ggw.Show();
            }
            else
            {
                //无重复码。直接进游戏
                Common.textHooker.MisakaCodeList = null;
                //2020-06-08 大部分情况无重复码的游戏不会hook到很多,不进行去多余hook
                //Common.textHooker.DetachUnrelatedHookWhenDataRecv = Convert.ToBoolean(Common.appSettings.AutoDetach);
                Common.textHooker.StartHook(Convert.ToBoolean(Common.appSettings.AutoHook));
                var task1 = Task.Run(async delegate
                {
                    await Task.Delay(3000);
                    Common.textHooker.Auto_AddHookToGame();
                });

                var tw = new TranslateWindow();
                tw.Show();
            }
        }
        private void StartTranslateBygid(int gid)
        {
            Process[]      ps     = Process.GetProcesses();
            List <Process> pidlst = new List <Process>();

            for (int i = 0; i < ps.Length; i++)
            {
                string filepath = "";
                try
                {
                    filepath = ps[i].MainModule.FileName;
                }
                catch (Exception)
                {
                    continue;
                    //这个地方直接跳过,是因为32位程序确实会读到64位的系统进程,而系统进程是不能被访问的
                    //throw ex;
                }


                if (gameInfolst[gid].FilePath == filepath)
                {
                    pidlst.Add(ps[i]);
                }
            }

            if (pidlst.Count == 0)
            {
                HandyControl.Controls.MessageBox.Show("未找到游戏进程!", "提示");
                return;
            }
            else
            {
                int pid = pidlst[0].Id;
                pidlst.Clear();
                pidlst = ProcessHelper.FindSameNameProcess(pid);
            }

            Common.transMode       = 1;
            Common.UsingDstLang    = gameInfolst[gid].Dst_Lang;
            Common.UsingSrcLang    = gameInfolst[gid].Src_Lang;
            Common.UsingRepairFunc = gameInfolst[gid].Repair_func;

            switch (Common.UsingRepairFunc)
            {
            case "RepairFun_RemoveSingleWordRepeat":
                Common.repairSettings.SingleWordRepeatTimes = gameInfolst[gid].Repair_param_a;
                break;

            case "RepairFun_RemoveSentenceRepeat":
                Common.repairSettings.SentenceRepeatFindCharNum = gameInfolst[gid].Repair_param_a;
                break;

            case "RepairFun_RegexReplace":
                Common.repairSettings.Regex         = gameInfolst[gid].Repair_param_a;
                Common.repairSettings.Regex_Replace = gameInfolst[gid].Repair_param_b;
                break;

            default:
                break;
            }

            Common.RepairFuncInit();

            if (pidlst.Count == 1)
            {
                Common.textHooker = new TextHookHandle(pidlst[0].Id);
            }
            else
            {
                Common.textHooker = new TextHookHandle(pidlst);
            }


            Common.textHooker.Init(!gameInfolst[gid].Isx64);
            Common.textHooker.HookCodeList.Add(gameInfolst[gid].Hookcode);

            if (gameInfolst[gid].IsMultiHook == true)
            {
                GameGuideWindow ggw = new GameGuideWindow(3);
                ggw.Show();
            }
            else
            {
                //无重复码。直接进游戏
                Common.textHooker.MisakaCodeList = null;
                Common.textHooker.DetachUnrelatedHookWhenDataRecv = Convert.ToBoolean(Common.appSettings.AutoDetach);
                Common.textHooker.StartHook(Convert.ToBoolean(Common.appSettings.AutoHook));

                TranslateWindow tw = new TranslateWindow();
                tw.Show();
            }
        }