diff --git a/Dalamud/Hooking/Hook.cs b/Dalamud/Hooking/Hook.cs
index 558b6bde1..2e785191c 100644
--- a/Dalamud/Hooking/Hook.cs
+++ b/Dalamud/Hooking/Hook.cs
@@ -1,4 +1,3 @@
-using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.InteropServices;
@@ -13,7 +12,7 @@ namespace Dalamud.Hooking;
/// This class is basically a thin wrapper around the LocalHook type to provide helper functions.
///
/// Delegate type to represents a function prototype. This must be the same prototype as original function do.
-public class Hook : IDisposable, IDalamudHook where T : Delegate
+public abstract class Hook : IDisposable, IDalamudHook where T : Delegate
{
#pragma warning disable SA1310
// ReSharper disable once InconsistentNaming
@@ -24,8 +23,6 @@ public class Hook : IDisposable, IDalamudHook where T : Delegate
private readonly IntPtr address;
- private readonly Hook? compatHookImpl;
-
///
/// Initializes a new instance of the class.
///
@@ -52,28 +49,19 @@ public class Hook : IDisposable, IDalamudHook where T : Delegate
/// Gets a delegate function that can be used to call the actual function as if function is not hooked yet.
///
/// Hook is already disposed.
- public virtual T Original => this.compatHookImpl != null ? this.compatHookImpl!.Original : throw new NotImplementedException();
+ public virtual T Original => throw new NotImplementedException();
///
/// Gets a delegate function that can be used to call the actual function as if function is not hooked yet.
/// This can be called even after Dispose.
///
public T OriginalDisposeSafe
- {
- get
- {
- if (this.compatHookImpl != null)
- return this.compatHookImpl!.OriginalDisposeSafe;
- if (this.IsDisposed)
- return Marshal.GetDelegateForFunctionPointer(this.address);
- return this.Original;
- }
- }
+ => this.IsDisposed ? Marshal.GetDelegateForFunctionPointer(this.address) : this.Original;
///
/// Gets a value indicating whether or not the hook is enabled.
///
- public virtual bool IsEnabled => this.compatHookImpl != null ? this.compatHookImpl!.IsEnabled : throw new NotImplementedException();
+ public virtual bool IsEnabled => throw new NotImplementedException();
///
/// Gets a value indicating whether or not the hook has been disposed.
@@ -81,7 +69,7 @@ public class Hook : IDisposable, IDalamudHook where T : Delegate
public bool IsDisposed { get; private set; }
///
- public virtual string BackendName => this.compatHookImpl != null ? this.compatHookImpl!.BackendName : throw new NotImplementedException();
+ public virtual string BackendName => throw new NotImplementedException();
///
/// Creates a hook by rewriting import table address.
@@ -230,32 +218,18 @@ public class Hook : IDisposable, IDalamudHook where T : Delegate
if (this.IsDisposed)
return;
- this.compatHookImpl?.Dispose();
-
this.IsDisposed = true;
}
///
/// Starts intercepting a call to the function.
///
- public virtual void Enable()
- {
- if (this.compatHookImpl != null)
- this.compatHookImpl.Enable();
- else
- throw new NotImplementedException();
- }
+ public virtual void Enable() => throw new NotImplementedException();
///
/// Stops intercepting a call to the function.
///
- public virtual void Disable()
- {
- if (this.compatHookImpl != null)
- this.compatHookImpl.Disable();
- else
- throw new NotImplementedException();
- }
+ public virtual void Disable() => throw new NotImplementedException();
///
/// Check if this object has been disposed already.