示例#1
0
        /// <summary>
        /// Read bytes from memory of target process.
        /// Returns read bytes into bytes array.
        /// Returns false if failed.
        /// </summary>
        public bool GetBytes(ulong address, ref byte[] bytes)
        {
            /*I did this to ensure that the browser will not crash due the allocation , original  is 65000*/
            int         sizeForOperation = 16384;
            int         byteslength      = bytes.Length;
            List <byte> tmpBuffer        = new List <byte>();
            int         loop             = byteslength / sizeForOperation;

            byte[] operatinalBytes = new byte[sizeForOperation];
            for (int i = 0; i < loop; i++)
            {
                if (!PS4.GetMemory(address + (ulong)(i * sizeForOperation), ref operatinalBytes))
                {
                    return(false);
                }
                tmpBuffer.AddRange(operatinalBytes);
            }
            bytes = tmpBuffer.ToArray();
            return(true);
        }