Exemple #1
0
 /// <summary>
 ///     Applies this Detour to memory. (Writes new bytes to memory)
 /// </summary>
 /// <returns></returns>
 public bool Apply()
 {
     if (_memory.WriteBytes(_target, _new.ToArray()) == _new.Count)
     {
         IsApplied = true;
         return(true);
     }
     return(false);
 }
Exemple #2
0
        /// <summary>
        ///     Removes this Patch from memory. (Reverts the bytes back to their originals.)
        /// </summary>
        /// <returns></returns>
        public bool Remove()
        {
            try
            {
                _memory.WriteBytes(_address, _originalBytes);
            }
            catch
            {
            }

            return(false);
        }
Exemple #3
0
 /// <summary>
 ///     Enables the memorySharp patch.
 /// </summary>
 public void Enable()
 {
     try
     {
         MemoryBase.WriteBytes(Address, PatchBytes);
         IsApplied = true;
     }
     catch
     {
         IsApplied = false;
         // Ignored
     }
 }
Exemple #4
0
 /// <summary>
 ///     Disables the memorySharp patch.
 /// </summary>
 public void Disable()
 {
     try
     {
         MemoryBase.WriteBytes(Address, OriginalBytes);
         IsApplied = false;
     }
     catch
     {
         IsApplied = false;
         // Ignored.
     }
 }