private static int FindPoeProcess(out Offsets offs) { var clients = Process.GetProcessesByName(Offsets.Regular.ExeName).Select(p => Tuple.Create(p, Offsets.Regular)).ToList(); clients.AddRange(Process.GetProcessesByName(Offsets.Steam.ExeName).Select(p => Tuple.Create(p, Offsets.Steam))); int ixChosen = clients.Count > 1 ? chooseSingleProcess(clients) : 0; if (clients.Count > 0 && ixChosen >= 0) { offs = clients[ixChosen].Item2; return clients[ixChosen].Item1.Id; } offs = null; return 0; }
public Memory(Offsets offs, int pId) { try { offsets = offs; Process = Process.GetProcessById(pId); AddressOfProcess = Process.MainModule.BaseAddress.ToInt32(); Open(); modules = new Dictionary<string, int>(); } catch (Win32Exception ex) { throw new Exception("You should run program as an administrator", ex); } }