Esempio n. 1
0
 public void Disable()
 {
     if (IsActive)
     {
         PatchAddress.Write(OriginalBytes);
         IsActive = false;
     }
 }
Esempio n. 2
0
 public void Enable()
 {
     if (!IsActive)
     {
         PatchAddress.Write(NewBytes);
         IsActive = true;
     }
 }
Esempio n. 3
0
        /// <summary>
        ///     A patch can be used to change byte(s) starting at the defined address.
        /// </summary>
        /// <param name="addressToPatch">The address of the byte where we want our patch to start.</param>
        public MemoryPatch(MemoryPointer addressToPatch, byte[] newBytes)
        {
            PatchAddress  = addressToPatch ?? throw new ArgumentNullException(nameof(addressToPatch));
            NewBytes      = newBytes ?? throw new ArgumentNullException(nameof(newBytes));
            OriginalBytes = PatchAddress.Read(NewBytes.Length);

            MemoryPatches.Add(this);
        }