public UInt32 peek(UInt32 address) { if (!ValidMemory.ValidAddress(address)) { return(0); } //address will be alligned to 4 UInt32 paddress = address & 0xFFFFFFFC; //Create a memory stream for the actual dump MemoryStream stream = new MemoryStream(); //make sure to not send data to the output GeckoProgress oldUpdate = this.PChunkUpdate; this.PChunkUpdate = null; try { //dump data this.Dump(paddress, paddress + 4, stream); //go to beginning stream.Seek(0, SeekOrigin.Begin); Byte[] buffer = new Byte[4]; stream.Read(buffer, 0, 4); //Read buffer UInt32 result = BitConverter.ToUInt32(buffer, 0); //Swap to machine endianness and return result = ByteSwap.Swap(result); return(result); } finally { this.PChunkUpdate = oldUpdate; //make sure the Stream is properly closed stream.Close(); } }
public UInt32 Peek(UInt32 address) { lock (_networkInUse) { //address will be alligned to 4 UInt32 paddress = address & 0xFFFFFFFC; //Create a memory stream for the actual dump MemoryStream stream = new MemoryStream(); //make sure to not send data to the output GeckoProgress oldUpdate = PChunkUpdate; PChunkUpdate = null; try { //dump data Dump(paddress, paddress + 4, stream); //go to beginning stream.Seek(0, SeekOrigin.Begin); Byte[] buffer = new Byte[4]; stream.Read(buffer, 0, 4); //Read buffer return(BitConverter.ToUInt32(buffer, 0)); } finally { PChunkUpdate = oldUpdate; //make sure the Stream is properly closed stream.Close(); } } }