/// <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); }
/// <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); }
/// <summary> /// Enables the memorySharp patch. /// </summary> public void Enable() { try { MemoryBase.WriteBytes(Address, PatchBytes); IsApplied = true; } catch { IsApplied = false; // Ignored } }
/// <summary> /// Disables the memorySharp patch. /// </summary> public void Disable() { try { MemoryBase.WriteBytes(Address, OriginalBytes); IsApplied = false; } catch { IsApplied = false; // Ignored. } }