SharpHooking 1.0.0

dotnet add package SharpHooking --version 1.0.0
                    
NuGet\Install-Package SharpHooking -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SharpHooking" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SharpHooking" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="SharpHooking" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SharpHooking --version 1.0.0
                    
#r "nuget: SharpHooking, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SharpHooking@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SharpHooking&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=SharpHooking&version=1.0.0
                    
Install as a Cake Tool

SharpHooking

A little library to allow you to call/register hooks.

Creating

var hooks = SharpHooking.Create();

Sync

hooks.Register("test", (args) => {});

hooks.Call("test");
hooks.Call("test", "hello!");

Async

hooks.Register("test", async (args) => {});
await hooks.CallAsync("test");
await hooks.CallAsync("test", "hello");

Weight

You can assign a weight to your hook. 0 being the lowest meaning it will be the first called.

Registering

hooks.Register("test", (args) => {}, 0);

Tags

You can use tags to group hooks for versioning and so forth.

Registering

hooks.Register("test", (args) => {}, "v1");

Calling

hooks.Call("test", new List<string> { "v1" });

Cancelling hooks

You can cancel a hook event with returning true.

hooks.Register("test", (args) => {
	return true;
});

Call Logs

You can grab the call logs. These will contain the hook name, arguments, when and any exceptions brought up during execution.

hooks.GetLogs();
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 403 10/25/2022