/// <summary> /// 控制台输出事件,在这做内部消化处理 /// </summary> /// <param name="sendingProcess"></param> /// <param name="outLine"></param> void OutputHandler(object sendingProcess, DataReceivedEventArgs outLine) { AddTextractorHistory(outLine.Data); if (Pause == false) { TextHookData thData = DealTextratorOutput(outLine.Data); if (thData != null) { TextHookData data = thData; if (data.HookFunc != "Console" && data.HookFunc != "Clipboard" && data.HookFunc != "") { //Hook入口选择窗口处理 if (TextractorFun_Index_List.ContainsKey(data.MisakaHookCode) == true) { HookSelectRecvEventArgs e = new HookSelectRecvEventArgs(); e.Index = TextractorFun_Index_List[data.MisakaHookCode]; e.Data = data; HFSevent?.Invoke(this, e); } else { TextractorFun_Index_List.Add(data.MisakaHookCode, listIndex); HookSelectRecvEventArgs e = new HookSelectRecvEventArgs(); e.Index = TextractorFun_Index_List[data.MisakaHookCode]; e.Data = data; HFSevent?.Invoke(this, e); listIndex++; } //Hook入口重复确认窗口处理 if (HookCodeList.Count != 0 && HookCodeList.Contains(data.HookCode)) { if (TextractorFun_Re_Index_List.ContainsKey(data.MisakaHookCode) == true) { HookSelectRecvEventArgs e = new HookSelectRecvEventArgs { Index = TextractorFun_Index_List[data.MisakaHookCode], Data = data }; HFRSevent?.Invoke(this, e); } else { TextractorFun_Re_Index_List.Add(data.MisakaHookCode, listIndex_Re); HookSelectRecvEventArgs e = new HookSelectRecvEventArgs { Index = TextractorFun_Index_List[data.MisakaHookCode], Data = data }; HFRSevent?.Invoke(this, e); listIndex_Re++; } } //使用了边Hook边卸载的情况 //纠错:注意不能删misakacode不同的,因为地址可能相同,仅根据Hook特殊码来删就行了 if (DetachUnrelatedHookWhenDataRecv == true) { if (HookCodeList[0] != data.HookCode) { DetachUnrelatedHookAsync(int.Parse(data.GamePID, System.Globalization.NumberStyles.HexNumber), data.MisakaHookCode); } } //文本去重窗口处理&游戏翻译窗口处理 //如果IsNeedReChooseHook=false则说明没有多重处理,不用再对比HookCodePlus if (HookCodeList.Count != 0 && HookCodeList.Contains(data.HookCode) && (MisakaCodeList == null || MisakaCodeList.Contains(data.MisakaHookCode))) { SolvedDataRecvEventArgs e = new SolvedDataRecvEventArgs { Data = data }; Sevent?.Invoke(this, e); } } } } }
/// <summary> /// Textractor输出事件 /// </summary> /// <param name="threadid"></param> /// <param name="opdata"></param> public void OutputHandle(long threadid, string opdata) { opdata = opdata.Replace("\r\n", "").Replace("\n", ""); AddTextractorHistory(threadid + ":" + opdata); if (Pause == false) { TextHookData thData = ThreadID_HookDataInfo_List[threadid]; if (thData != null) { TextHookData data = thData; data.Data = opdata; if (data.HookFunc != "Console" && data.HookFunc != "Clipboard" && data.HookFunc != "") { //Hook入口选择窗口处理 //if (ThreadID_RenewNum_List[threadid] < 150) //{ if (TextractorFun_Index_List.ContainsKey(threadid) == true) { HookSelectRecvEventArgs e = new HookSelectRecvEventArgs(); e.Index = TextractorFun_Index_List[threadid]; e.Data = data; HFSevent?.Invoke(this, e); } else { TextractorFun_Index_List.Add(threadid, listIndex); HookSelectRecvEventArgs e = new HookSelectRecvEventArgs(); e.Index = listIndex; e.Data = data; HFSevent?.Invoke(this, e); listIndex++; } //ThreadID_RenewNum_List[threadid]++; //} //else { // DetachProcessByHookAddress(data.GamePID, data.HookAddress); //} //Hook入口重复确认窗口处理 if (HookCodeList.Count != 0 && HookCodeList.Contains(data.HookCode)) { if (TextractorFun_Re_Index_List.ContainsKey(threadid) == true) { HookSelectRecvEventArgs hsre = new HookSelectRecvEventArgs { Index = TextractorFun_Index_List[threadid], Data = data }; HFRSevent?.Invoke(this, hsre); } else { TextractorFun_Re_Index_List.Add(threadid, listIndex_Re); HookSelectRecvEventArgs hsre = new HookSelectRecvEventArgs { Index = listIndex_Re, Data = data }; HFRSevent?.Invoke(this, hsre); listIndex_Re++; } } //使用了边Hook边卸载的情况 //纠错:注意不能删misakacode不同的,因为地址可能相同,仅根据Hook特殊码来删就行了 if (DetachUnrelatedHookWhenDataRecv == true) { if (HookCodeList[0] != data.HookCode) { DetachUnrelatedHookAsync(data.GamePID, data.MisakaHookCode); } } //文本去重窗口处理&游戏翻译窗口处理 //如果IsNeedReChooseHook=false则说明没有多重处理,不用再对比HookCodePlus if (HookCodeList.Count != 0 && HookCodeList.Contains(data.HookCode) && (MisakaCodeList == null || MisakaCodeList.Contains(data.MisakaHookCode))) { SolvedDataRecvEventArgs sdre = new SolvedDataRecvEventArgs { Data = data }; Sevent?.Invoke(this, sdre); } } } } }
/// <summary> /// 控制台输出事件,在这做内部消化处理 /// </summary> /// <param name="sendingProcess"></param> /// <param name="outLine"></param> void OutputHandler(object sendingProcess, DataReceivedEventArgs outLine) { AddTextractorHistory(outLine.Data); if (Pause == false) { TextHookData thData = DealTextratorOutput(outLine.Data); if (thData != null) { TextHookData data = thData; if (data.HookFunc != "Console" && data.HookFunc != "") { //Hook入口选择窗口处理 if (TextractorFun_Index_List.ContainsKey(data.MisakaHookCode) == true) { HookSelectRecvEventArgs e = new HookSelectRecvEventArgs(); e.Index = TextractorFun_Index_List[data.MisakaHookCode]; e.Data = data; HFSevent?.Invoke(this, e); } else { TextractorFun_Index_List.Add(data.MisakaHookCode, listIndex); HookSelectRecvEventArgs e = new HookSelectRecvEventArgs(); e.Index = TextractorFun_Index_List[data.MisakaHookCode]; e.Data = data; HFSevent?.Invoke(this, e); listIndex++; } //Hook入口重复确认窗口处理 if (HookCodeList.Count != 0 && HookCodeList.Contains(data.HookCode)) { if (TextractorFun_Re_Index_List.ContainsKey(data.MisakaHookCode) == true) { HookSelectRecvEventArgs e = new HookSelectRecvEventArgs { Index = TextractorFun_Index_List[data.MisakaHookCode], Data = data }; HFRSevent?.Invoke(this, e); } else { TextractorFun_Re_Index_List.Add(data.MisakaHookCode, listIndex_Re); HookSelectRecvEventArgs e = new HookSelectRecvEventArgs { Index = TextractorFun_Index_List[data.MisakaHookCode], Data = data }; HFRSevent?.Invoke(this, e); listIndex_Re++; } } //文本去重窗口处理&游戏翻译窗口处理 //如果MisakaCodeList为空则说明没有多重处理,不用再对比HookCodePlus if (HookCodeList.Count != 0 && HookCodeList.Contains(data.HookCode) && (MisakaCodeList == null || MisakaCodeList.Contains(data.MisakaHookCode))) { SolvedDataRecvEventArgs e = new SolvedDataRecvEventArgs { Data = data }; Sevent?.Invoke(this, e); } } } } }