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); SQLiteHelper sqliteH = new SQLiteHelper(Environment.CurrentDirectory + "\\settings\\GameList.sqlite"); sqliteH.ExecuteSql(string.Format("UPDATE gamelist SET gameName = '{0}' WHERE gameID = {1};", System.IO.Path.GetFileName(game_ID), Common.GameID)); 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("请先选择一个进程再进行下一步操作!", "提示"); } }
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("请先选择一个进程再进行下一步操作!", "提示"); } }
/// <summary> /// 输出事件 /// </summary> /// <param name="sendingProcess"></param> /// <param name="outLine"></param> void OutputHandler(object sendingProcess, DataReceivedEventArgs outLine) { //Console.WriteLine(outLine.Data); Common.AddTextractorHistory(outLine.Data); string[] dealRes = DealTextratorOutput(outLine.Data); if (dealRes != null) { if (dealRes[1] != "Console" && dealRes[1] != "") { //Hook入口选择窗口处理 if (OutputSettingsform != null && OutputSettingsform is TextractorFunSelectForm) { if (TextractorFun_Index_List.ContainsKey(dealRes[2] + dealRes[4]) == true) { TextractorFunSelectForm frm = (TextractorFunSelectForm)OutputSettingsform; frm.TextractorFunDealItem(TextractorFun_Index_List[dealRes[2] + dealRes[4]], dealRes, true); } else { TextractorFun_Index_List.Add(dealRes[2] + dealRes[4], listViewIndex); TextractorFunSelectForm frm = (TextractorFunSelectForm)OutputSettingsform; frm.TextractorFunDealItem(listViewIndex, dealRes, false); listViewIndex++; } } //文本去重窗口处理 if (OutputSettingsform != null && OutputSettingsform is TextRepeatRepairForm) { TextRepeatRepairForm frm = (TextRepeatRepairForm)OutputSettingsform; if (Common.HookCode != "" && dealRes[2] == Common.HookCode && dealRes[4] == Common.HookCodePlus) { frm.TextractorHookContent(dealRes); } } //Hook入口重复确认窗口处理 if (OutputSettingsform != null && OutputSettingsform is TextractorFunReConfirmForm) { TextractorFunReConfirmForm frm = (TextractorFunReConfirmForm)OutputSettingsform; if (Common.HookCode != "" && dealRes[2] == Common.HookCode) { if (TextractorFunPlus_Index_List.ContainsKey(dealRes[4]) == true) { frm.TextractorFunDealItem(TextractorFunPlus_Index_List[dealRes[4]], dealRes, true); } else { TextractorFunPlus_Index_List.Add(dealRes[4], listViewIndex_plus); frm.TextractorFunDealItem(listViewIndex_plus, dealRes, false); listViewIndex_plus++; } } } //游戏翻译窗口处理 //如果Common.HookCodePlus = "NoMulti"则说明没有多重处理,不用再对比HookCodePlus if (GameTransForm != null) { if (Common.HookCode != "" && dealRes[2] == Common.HookCode && (Common.HookCodePlus == "NoMulti" || dealRes[4] == Common.HookCodePlus)) { GameTransForm.TextractorHookContent(dealRes); } } } } }