private MultiboxProcess FetchProcessMultiboxInfo(Process process) { List <Signature> sigList = new List <Signature>(); string file = Path.Combine(Program.appBase, "signatures.json"); using (var streamReader = new StreamReader(file)) { sigList = JsonSerializer.DeserializeFromReader <List <Signature> >(streamReader); } // Initialize process scanner FFMemoryParser.Memory memory = new FFMemoryParser.Memory(process); // Get memory addresses memory.SearchMemory(sigList); // Fetch memory data memory.MemoryLoop(); if (memory.actorsData.currentActors.Count > 0) { ActorData localPlayer = memory.actorsData.currentActors.First().Value; return(new MultiboxProcess { characterId = memory.charIdData.id, characterName = localPlayer.name }); } return(new MultiboxProcess()); }
static void Main(string[] args) { // Parse args Parser.Default.ParseArguments <Options>(args).WithParsed <Options>(options => { programOptions = options; }); if (GetConsoleWindow() != IntPtr.Zero) { Console.OutputEncoding = System.Text.Encoding.UTF8; } List <Process> processes = new List <Process>(Process.GetProcessesByName("ffxiv_dx11")); Process ffxivProcess = null; if (processes.Count > 0) { ffxivProcess = processes[0]; } if (ffxivProcess != null) { Memory mem = new Memory(ffxivProcess); List <Signature> sigList = new List <Signature>(); string file = programOptions.LoadSignatureFile; if (string.IsNullOrEmpty(file)) { file = "C:\\ProgramData\\FFBardMusicPlayer\\signatures.json"; } using (var streamReader = new StreamReader(file)) { var json = streamReader.ReadToEnd(); sigList = JsonConvert.DeserializeObject <List <Signature> >(json); } mem.SearchMemory(sigList); Console.WriteLine("-- Start thread"); do { while (true) { while (!Console.KeyAvailable) { mem.MemoryLoop(); Thread.Sleep(1000); } } } while (Console.ReadKey(true).Key != ConsoleKey.NoName); } }