Class NativeWrapper
- Namespace
- SharpPluginLoader.Core
- Assembly
- SharpPluginLoader.Core.dll
A wrapper around a native pointer.
public class NativeWrapper
- Inheritance
-
NativeWrapper
- Derived
- Inherited Members
Constructors
NativeWrapper()
public NativeWrapper()
NativeWrapper(nint)
public NativeWrapper(nint instance)
Parameters
instance
nint
Properties
Instance
The native pointer.
public nint Instance { get; init; }
Property Value
Methods
Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current object.
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
GetInlineObject<T>(nint)
Retrieves an inlined object at the specified offset.
public T GetInlineObject<T>(nint offset) where T : NativeWrapper, new()
Parameters
offset
nintThe offset at which to retrieve the object
Returns
- T
The object at the offset
Type Parameters
T
The type of the object, must inherit from NativeWrapper
GetObject<T>(nint)
Gets an object at the specified offset.
public T? GetObject<T>(nint offset) where T : NativeWrapper, new()
Parameters
offset
nintThe offset at which to retrieve the object
Returns
- T
The object at the offset
Type Parameters
T
The type of the object, must inherit from NativeWrapper
GetPtr(nint)
Gets a value at the specified offset.
public void* GetPtr(nint offset)
Parameters
offset
nintThe offset at which to retrieve the value
Returns
- void*
The value at the offset
GetPtrInline(nint)
Gets a reference to a value in the object at the specified offset.
public void* GetPtrInline(nint offset)
Parameters
offset
nintThe offset of the value
Returns
- void*
A reference to the value at the offset
GetPtrInline<T>(nint)
Gets a pointer to a value in the object at the specified offset.
public T* GetPtrInline<T>(nint offset) where T : unmanaged
Parameters
offset
nintThe offset of the value
Returns
- T*
A pointer to the value at the offset
Type Parameters
T
The type of the value
GetPtr<T>(nint)
Gets a value at the specified offset.
public T* GetPtr<T>(nint offset) where T : unmanaged
Parameters
offset
nintThe offset at which to retrieve the value
Returns
- T*
The value at the offset
Type Parameters
T
The type of the value, must be an unmanaged type
GetRefInline<T>(nint)
Gets a reference to a value in the object at the specified offset.
public ref T GetRefInline<T>(nint offset) where T : unmanaged
Parameters
offset
nintThe offset of the value
Returns
- T
A reference to the value at the offset
Type Parameters
T
The type of the value
GetRef<T>(nint)
Gets a value at the specified offset.
public ref T GetRef<T>(nint offset) where T : unmanaged
Parameters
offset
nintThe offset at which to retrieve the value
Returns
- T
The value at the offset
Type Parameters
T
The type of the value, must be an unmanaged type
Get<T>(nint)
Gets a value at the specified offset.
public T Get<T>(nint offset) where T : unmanaged
Parameters
offset
nintThe offset at which to retrieve the value
Returns
- T
The value at the offset
Type Parameters
T
The type of the value, must be an unmanaged type
SetObject<T>(nint, T)
Sets an object at the specified offset.
public void SetObject<T>(nint offset, T value) where T : NativeWrapper
Parameters
offset
nintThe offset at which to set the object
value
TThe object to set
Type Parameters
T
The type of the object, must inherit from NativeWrapper
SetPtr<T>(nint, T*)
Sets a value at the specified offset.
public void SetPtr<T>(nint offset, T* value) where T : unmanaged
Parameters
offset
nintThe offset at which to set the value
value
T*The value to set
Type Parameters
T
The type of the value, must be an unmanaged type
Set<T>(nint, T)
Sets a value at the specified offset.
public void Set<T>(nint offset, T value) where T : unmanaged
Parameters
offset
nintThe offset at which to set the value
value
TThe value to set
Type Parameters
T
The type of the value, must be an unmanaged type
Operators
operator ==(NativeWrapper?, NativeWrapper?)
public static bool operator ==(NativeWrapper? left, NativeWrapper? right)
Parameters
left
NativeWrapperright
NativeWrapper
Returns
operator ==(NativeWrapper?, nint)
public static bool operator ==(NativeWrapper? left, nint right)
Parameters
left
NativeWrapperright
nint
Returns
operator ==(nint, NativeWrapper?)
public static bool operator ==(nint left, NativeWrapper? right)
Parameters
left
nintright
NativeWrapper
Returns
operator !=(NativeWrapper?, NativeWrapper?)
public static bool operator !=(NativeWrapper? left, NativeWrapper? right)
Parameters
left
NativeWrapperright
NativeWrapper
Returns
operator !=(NativeWrapper?, nint)
public static bool operator !=(NativeWrapper? left, nint right)
Parameters
left
NativeWrapperright
nint
Returns
operator !=(nint, NativeWrapper?)
public static bool operator !=(nint left, NativeWrapper? right)
Parameters
left
nintright
NativeWrapper