コード例 #1
0
        /// <summary>
        /// Read a generic value from a memory address.
        /// </summary>
        /// <typeparam name="T">The type to read.</typeparam>
        /// <param name="memaddress"></param>
        /// <returns></returns>
        public T ReadGeneric <T>(long memaddress) where T : struct
        {
            int size = GenericBitConverter.GetTypeSize(typeof(T));

            byte[] bytes = ReadByteArray(memaddress, size);
            return(GenericBitConverter.ToStruct <T>(bytes));
        }
コード例 #2
0
        /// <summary>
        /// Get the value this object points to as the specified type, if possible.
        /// </summary>
        /// <returns></returns>
        public T GetValue()
        {
            // Get the bytes and handle the null case
            byte[] bytes = GetBytes(TargetSize);
            if (bytes == null)
            {
                return(default(T));
            }

            return(GenericBitConverter.ToStruct <T>(bytes));
        }
コード例 #3
0
 /// <summary>
 /// Write a generic value to a memory address.
 /// </summary>
 /// <typeparam name="T">The type to read.</typeparam>
 /// <param name="memaddress">The memory address to write to.</param>
 /// <param name="value">The generic value.</param>
 /// <returns></returns>
 public void WriteGeneric <T>(long memaddress, T value) where T : struct
 {
     byte[] bytes = GenericBitConverter.ToBytes(value);
     WriteByteArray(memaddress, bytes);
 }
コード例 #4
0
 /// <summary>
 /// Write the value this object points to, if possible.
 /// </summary>
 /// <param name="value">The value to write.</param>
 /// <returns>A bool indicating the success of this operation</returns>
 public bool SetValue(T value)
 {
     byte[] bytes = GenericBitConverter.ToBytes(value);
     return(SetBytes(bytes));
 }
コード例 #5
0
 /// <summary>
 /// Create a DeepPointer from a process name and module name.
 /// </summary>
 /// <param name="pname">The name of the process to read from.</param>
 /// <param name="mname">The name of a specific module in the process.</param>
 /// <param name="sAddress">The static address to start reading from.</param>
 /// <param name="offsets">The offsets between each read in memory.</param>
 public DeepPointer(string pname, string mname, long sAddress, params int[] offsets)
     : base(pname, mname, sAddress, offsets)
 {
     TargetSize = GenericBitConverter.GetTypeSize(typeof(T));
 }
コード例 #6
0
 /// <summary>
 /// Create a DeepPointer from an already known handle and module address.
 /// </summary>
 /// <param name="pHandle">The handle of the process to read from.</param>
 /// <param name="mbAddress">The base address of a specific module in the process.</param>
 /// <param name="sAddress">The static address to start reading from.</param>
 /// <param name="offsets">The offsets between each read in memory.</param>
 public DeepPointer(IntPtr pHandle, long mbAddress, long sAddress, params int[] offsets)
     : base(pHandle, mbAddress, sAddress, offsets)
 {
     TargetSize = GenericBitConverter.GetTypeSize(typeof(T));
 }