PtrReader
Provides methods to read data from an unmanaged memory pointer.
Конструкторы
public PtrReader(IntPtr ptr)
ptrReader = PtrReader(ptr)
Initializes a new instance of the PtrReader class with the specified pointer.
- ptr
- The unmanaged memory pointer to read from.
Свойства
public IntPtr Ptr { get; set; }
value = ptrReader.Ptr
ptrReader.Ptr = value
Gets or sets the unmanaged memory pointer.
Методы
public byte GetByte()
result = ptrReader.GetByte()
Reads a byte from the current pointer and advances the pointer by the size of a byte.
Возвращает: The byte read from the pointer.
public int GetInt()
result = ptrReader.GetInt()
Reads a 32-bit integer from the current pointer and advances the pointer by the size of an integer.
Возвращает: The 32-bit integer read from the pointer.
public IntPtr GetIntPtr()
result = ptrReader.GetIntPtr()
Reads an IntPtr from the current pointer and advances the pointer by the size of an IntPtr.
Возвращает: The IntPtr read from the pointer.
public long GetLong()
result = ptrReader.GetLong()
Reads a 64-bit integer from the current pointer and advances the pointer by the size of a long.
Возвращает: The 64-bit integer read from the pointer.
public short GetShort()
result = ptrReader.GetShort()
Reads a 16-bit integer from the current pointer and advances the pointer by the size of a short.
Возвращает: The 16-bit integer read from the pointer.
public string GetString()
result = ptrReader.GetString()
Reads a null-terminated ANSI string from the current pointer and advances the pointer by the size of an IntPtr.
Возвращает: The ANSI string read from the pointer. If the string is null, an empty string is returned.
public string GetString(int length)
result = ptrReader.GetString(length)
Reads an ANSI string of the specified length from the current pointer and advances the pointer by the specified length.
- length
- The length of the string to read.
Возвращает: The ANSI string read from the pointer. If the string is null, an empty string is returned.