Skip to content

Commit

Permalink
Resolved: XML Errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Sewer56 committed Jul 6, 2022
1 parent adc12ca commit a76e78b
Showing 1 changed file with 25 additions and 7 deletions.
32 changes: 25 additions & 7 deletions Source/Reloaded.Memory/Sources/MemoryExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,14 @@ public static T Read<TMemory, T>(this TMemory memory, nuint memoryAddress) where
public static void Write<TMemory, T>(this TMemory memory, int memoryAddress, T item, bool marshal = false) where TMemory : IMemory => memory.Write((nuint)memoryAddress, ref item, marshal);

/// <summary>
/// See <see cref="SafeWrite{TMemory, T}(TMemory,IntPtr,ref T,bool)"/> />
/// Changes memory permissions to ensure memory can be written and writes a generic type to a specified memory address.
/// </summary>
/// <typeparam name="T">An individual struct type of a class with an explicit StructLayout.LayoutKind attribute.</typeparam>
/// <typeparam name="TMemory">Type which inherits from <see cref="IMemory"/>.</typeparam>
/// <param name="memory"></param>
/// <param name="memoryAddress">The memory address to write to.</param>
/// <param name="item">The items to write to the address.</param>
/// <param name="marshal">Set this to true to enable struct marshalling.</param>
[ExcludeFromCodeCoverage] // This is a wrapper that simply lets pass by value, no logic.
public static void SafeWrite<TMemory, T>(this TMemory memory, int memoryAddress, T item, bool marshal = false) where TMemory : IMemory => memory.SafeWrite((nuint)memoryAddress, ref item, marshal);

Expand All @@ -407,11 +413,17 @@ public static T Read<TMemory, T>(this TMemory memory, nuint memoryAddress) where
/// <param name="item">The item to write to the address.</param>
/// <param name="marshal">True to marshal the element, else false.</param>
[ExcludeFromCodeCoverage] // This is a wrapper that simply lets pass by value, no logic.
public static void Write<TMemory, T>(this TMemory memory, long memoryAddress, T item, bool marshal = false) where TMemory : IMemory => memory.Write((nuint)memoryAddress, ref item, marshal);

public static void Write<TMemory, T>(this TMemory memory, long memoryAddress, T item, bool marshal = false) where TMemory : IMemory => memory.Write((nuint)memoryAddress, ref item, marshal);

/// <summary>
/// See <see cref="SafeWrite{TMemory,T}(TMemory,System.IntPtr,ref T,bool)"/> />
/// Changes memory permissions to ensure memory can be written and writes a generic type to a specified memory address.
/// </summary>
/// <typeparam name="T">An individual struct type of a class with an explicit StructLayout.LayoutKind attribute.</typeparam>
/// <typeparam name="TMemory">Type which inherits from <see cref="IMemory"/>.</typeparam>
/// <param name="memory"></param>
/// <param name="memoryAddress">The memory address to write to.</param>
/// <param name="item">The items to write to the address.</param>
/// <param name="marshal">Set this to true to enable struct marshalling.</param>
[ExcludeFromCodeCoverage] // This is a wrapper that simply lets pass by value, no logic.
public static void SafeWrite<TMemory, T>(this TMemory memory, long memoryAddress, T item, bool marshal = false) where TMemory : IMemory => memory.SafeWrite((nuint)memoryAddress, ref item, marshal);

Expand Down Expand Up @@ -439,11 +451,17 @@ public static T Read<TMemory, T>(this TMemory memory, nuint memoryAddress) where
/// <param name="item">The item to write to the address.</param>
/// <param name="marshal">True to marshal the element, else false.</param>
[ExcludeFromCodeCoverage] // This is a wrapper that simply lets pass by value, no logic.
public static void Write<TMemory, T>(this TMemory memory, nuint memoryAddress, T item, bool marshal = false) where TMemory : IMemory => memory.Write(memoryAddress, ref item, marshal);

public static void Write<TMemory, T>(this TMemory memory, nuint memoryAddress, T item, bool marshal = false) where TMemory : IMemory => memory.Write(memoryAddress, ref item, marshal);

/// <summary>
/// See <see cref="SafeWrite{TMemory, T}(TMemory,IntPtr,ref T,bool)"/> />
/// Changes memory permissions to ensure memory can be written and writes a generic type to a specified memory address.
/// </summary>
/// <typeparam name="T">An individual struct type of a class with an explicit StructLayout.LayoutKind attribute.</typeparam>
/// <typeparam name="TMemory">Type which inherits from <see cref="IMemory"/>.</typeparam>
/// <param name="memory"></param>
/// <param name="memoryAddress">The memory address to write to.</param>
/// <param name="item">The items to write to the address.</param>
/// <param name="marshal">Set this to true to enable struct marshalling.</param>
[ExcludeFromCodeCoverage] // This is a wrapper that simply lets pass by value, no logic.
public static void SafeWrite<TMemory, T>(this TMemory memory, nuint memoryAddress, T item, bool marshal = false) where TMemory : IMemory => memory.SafeWrite(memoryAddress, ref item, marshal);

Expand Down

0 comments on commit a76e78b

Please sign in to comment.