Example #1
0
 public Allies(int index, MemLoc primaryStatus, MemLoc secondaryStatus, params string[] words)
 {
     Index           = index;
     PrimaryStatus   = primaryStatus;
     SecondaryStatus = secondaryStatus;
     Words           = words ?? new string[0];
     All.Add(this);
 }
        /// <summary>
        /// Reads the specified number of bytes from an address in the process's memory.
        /// All memory in the specified range must be available or the method will fail.
        /// Returns Nothing if the method fails for any reason
        /// </summary>
        /// <param name="memoryLocation">The address in the process's virtual memory to start reading from and the number of bytes to read</param>
        public byte[] ReadMemory(MemLoc memoryLocation)
        {
            if (ConfirmProcessConnection())
            {
                var bytes  = new byte[memoryLocation.NumBytes + 1];
                var result = ReadProcessMemory(TargetProcessHandle, memoryLocation.Address, bytes, Convert.ToUInt32(memoryLocation.NumBytes), 0);
                return(result ? bytes : null);
            }

            return(null); // TODO: what to do when not connecting?
        }