/// <summary> /// Gets the first local <see cref="MemoryChunk"/> in this <see cref="IMemoryHandler"/> that contains the given address. /// </summary> /// <param name="handler">The <see cref="IMemoryHandler"/> handling the request.</param> /// <param name="address">The <see cref="uint"/> address to query.</param> /// <param name="acceptClones">A <see cref="bool"/> indicating whether to include chunks where <see cref="MemoryChunk.IsClone"/> is set to 'true'.</param> /// <returns>A <see cref="MemoryChunk"/> from <see cref="IMemoryHandler.Chunks"/> that contains the given address, or 'null' if none is found.</returns> public static MemoryChunk?GetChunk(this IMemoryHandler handler, uint address, bool acceptClones = true) { if (handler.Chunks.Any(c => c.Contains(address))) { return(handler.Chunks.First(c => c.Contains(address) && (acceptClones || !c.IsClone))); } else { return(null); } }
public void RemoveMemoryHandler(IMemoryHandler memoryHandler) { memoryHandlers.Remove(memoryHandler); }
public void AddMemoryHandler(IMemoryHandler memoryHandler) { memoryHandlers.Add(memoryHandler); }
/// <summary> /// Checks whether this <see cref="IMemoryHandler"/> manages the given address in memory. /// </summary> /// <param name="handler">The <see cref="IMemoryHandler"/> handling the request.</param> /// <param name="address">The <see cref="uint"/> address to query.</param> /// <returns>A <see cref="bool"/> whether <paramref name="address"/> lies within one of the <see cref="IMemoryHandler.Chunks"/> that are managed (not clones) by this <see cref="IMemoryHandler"/>.</returns> public static bool Manages(this IMemoryHandler handler, uint address) { return(handler.Chunks.Any(c => !c.IsClone && c.Contains(address))); }