public string ReadString(uint dwAddress) { int bytesRead = 0; byte[] result = null; //byte[] buffer = new byte[1000]; byte[] buffer = Encoding.ASCII.GetBytes(SMemory.ReadASCIIString(this.m_hProcess, dwAddress, 20)); for (int i = 0; i < buffer.Length; i++) { if (buffer[i] != (byte)0) { continue; } result = new byte[i]; break; } for (int i = 0; i < result.Length; i++) { result[i] = buffer[i]; } return(Encoding.UTF8.GetString(result)); }
/// <summary> /// Reads a value from memory. /// </summary> /// <param name="dwAddress">Address at which value will be read.</param> /// <param name="nLength">Maximum number of characters to be read.</param> /// <exception cref="Exception">Throws general exception on failure.</exception> /// <returns>Returns the value that was read from memory.</returns> public string ReadASCIIString(uint dwAddress, int nLength) { return(SMemory.ReadASCIIString(this.m_hProcess, dwAddress, nLength)); }