Guest User

VAMemoryExtension

a guest
Aug 1st, 2020
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.04 KB | None | 0 0
  1.     public static class VAMemoryExtension
  2.     {
  3.         public static long ResolveInt64FromString(this VAMemory memory, string address, char separator = '+')
  4.         {
  5.             var offsets = address.Split(separator);
  6.             long current = Convert.ToInt64(offsets[0]);
  7.             for (int i = 1; i < offsets.Length - 1; i++)
  8.             {
  9.                 current = memory.ReadInt64((IntPtr)current + Convert.ToInt32(offsets[i], 16));
  10.             }
  11.             return current + Convert.ToInt32(offsets[offsets.Length - 1], 16);
  12.         }
  13.         public static int ResolveInt32FromString(this VAMemory memory, string address, char separator = '+')
  14.         {
  15.             var offsets = address.Split(separator);
  16.             int current = Convert.ToInt32(offsets[0]);
  17.             for (int i = 1; i < offsets.Length - 1; i++)
  18.             {
  19.                 current = memory.ReadInt32((IntPtr)current + Convert.ToInt32(offsets[i], 16));
  20.             }
  21.             return current + Convert.ToInt32(offsets[offsets.Length - 1], 16);
  22.         }
  23.     }
Add Comment
Please, Sign In to add comment