public void WriteString(IntPtr address, string text, Encoding encoding, bool isRelative = true) { m.WriteString(address, text, encoding, isRelative); }
public void SetTargetAttribute(int offset, string value, Encoding encoding) { gameMemory.WriteString((IntPtr)(this.targetPointer + offset), value, encoding, false); }
public void StartWork() // 모든 리프레시 작업은 여기서 (스레드를 나눌 필요가 있으면 다른 방법으로) { InitGreenvalue(); int now_scene; while (true) { if (LR2value.baseaddr > 0) { try { now_scene = sharp.Read <int>((IntPtr)LR2value.baseaddr + 0x23db4, false); int dst_x; int dst_y; if (!int.TryParse(Program.runningForm.GetFormText("textBoxDSTX"), out dst_x)) { dst_x = 288; } if (!int.TryParse(Program.runningForm.GetFormText("textBoxDSTY"), out dst_y)) { dst_y = 482; } //xml로 설정 저장. if ((LR2value.dst_x != dst_x) || (LR2value.dst_y != dst_y)) { XmlDocument setting_update = new XmlDocument(); setting_update.Load(@setting_path); setting_update.GetElementsByTagName("dst_x")[0].InnerText = dst_x.ToString(); setting_update.GetElementsByTagName("dst_y")[0].InnerText = dst_y.ToString(); LR2value.dst_x = dst_x; LR2value.dst_y = dst_y; setting_update.Save(@setting_path); } if (now_scene == 4) { GetGreenvalue(); } } catch (Exception e) { Program.runningForm.SetTooltipStrip("Critical error occured. Please restart LR2Helper."); Thread.Sleep(1000); WriteLog(e.ToString()); Program.runningForm.SetTooltipStrip(""); } try { now_scene = sharp.Read <int>((IntPtr)LR2value.baseaddr + 0x23db4, false); if ((now_scene == 2) && (flag_run_rename == 1)) { RunRenameScreenshot(); //스크린샷을 옮긴다 } if ((now_scene == 4) && (now_scene != LR2value.scene)) //플레이 화면 진입 //RANDOM { Program.Delay(1500); GetLR2ValuePlayStart(); Program.runningForm.SetFormText("labelRandomArrange1P", "1P: " + LR2value.music_key_arrange_1p); Program.runningForm.SetFormText("labelRandomArrange2P", "2P: " + LR2value.music_key_arrange_2p); //각각 DST_TEXT 201번과 202번에 1P와 2P 배치를 넣는다 sharp.WriteString((IntPtr)sharp.Read <int>((IntPtr)LR2value.baseaddr + 0x21EF8 + (4 * 201), false), LR2value.music_key_arrange_1p, Encoding.GetEncoding(932), false); sharp.WriteString((IntPtr)sharp.Read <int>((IntPtr)LR2value.baseaddr + 0x21EF8 + (4 * 202), false), LR2value.music_key_arrange_2p, Encoding.GetEncoding(932), false); } if ((now_scene == 5) && (now_scene != LR2value.scene)) //리절트 화면 진입 { flag_already_tweeted = 0; //플래그 초기화 flag_already_screenshoted = 0; //플래그 초기화 Program.runningForm.SetTooltipStrip("Tweet:F11 / Screenshot: F9"); GetSongstatus(this.tweet_template); } LR2value.scene = now_scene; } catch (Exception e) { WriteLog(e.ToString()); } if (flag_interrupt == 1) { break; } if (!sharp.IsRunning) //LR2 프로세스 체크 { Thread th_initFirstprocess = new Thread(new ThreadStart(initFirstprocess)); Program.runningForm.SetTooltipStrip("LR2 process is terminated!"); Thread.Sleep(2000); th_initFirstprocess.Start(); break; } Thread.Sleep(16); } else { Thread.Sleep(1000); } } }