示例#1
0
        public Array ToArray()
        {
            var blob = new SharedMemoryBlob(Process.GetProcessById(ProcessId), GetBaseAddress());

            var array       = Array.CreateInstance(ValueType, Length);
            var tempHandle  = GCHandle.Alloc(array, GCHandleType.Pinned);
            var destination = Marshal.UnsafeAddrOfPinnedArrayElement(array, 0);

            blob.ReadAndWrite(destination, ByteLength);
            tempHandle.Free();

            return(array);
        }
示例#2
0
        public void CopyTo(IntPtr targetAddress)
        {
            var blob = new SharedMemoryBlob(Process.GetProcessById(ProcessId), GetBaseAddress());

            blob.ReadAndWrite(targetAddress, ByteLength);
        }