Pustalorc.RocketModServices 1.0.0

dotnet add package Pustalorc.RocketModServices --version 1.0.0
NuGet\Install-Package Pustalorc.RocketModServices -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="Pustalorc.RocketModServices" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Pustalorc.RocketModServices --version 1.0.0
#r "nuget: Pustalorc.RocketModServices, 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.
// Install Pustalorc.RocketModServices as a Cake Addin
#addin nuget:?package=Pustalorc.RocketModServices&version=1.0.0

// Install Pustalorc.RocketModServices as a Cake Tool
#tool nuget:?package=Pustalorc.RocketModServices&version=1.0.0

RocketMod Service Manager NuGet

Library that adds a BackgroundWorker and TaskQueue with Async support.

Installation & Usage

Before you begin, please make sure that your current solution has installed the nuget package of this library.
You can find this package here.

Service Usage

The service system is the primary utility included in this library.
It allows static access to plugin defined services.

Example usage of registering and retrieving a service named BuildableAbstractionsService:

// Registering the service
RocketModService<IBuildableAbstractionsService>.RegisterService(new BuildableAbstractionsServiceImplementation());

// Retrieving the service (but will throw an exception if its not registered, useful if the service is a hard requirement)
var buildableAbstractionService = RocketModService<IBuildableAbstractionService>.GetService();

// Retrieveing the service (but will return null if its not registered, useful if the service is a soft requirement)
var buildableAbstractionService = RocketModService<IBuildableAbstractionService>.TryGetService();

Do note that it is best to target an interface with services, rather than a specific class.
The clas that stores the services are per-type, so registering the service to the class rather than the interface will make it impossible to find through the interface unless the other developers target the class when searching for the service.
With the example above, if the service is registered to RocketModService<BuildableAbstractionsServiceImplementation>, it will only be accessible through that exact type, and not through RocketModService<IBuildableAbstractionService>

Event Bus Usage

The event bus is the secondary and simple utility included in this library.
It helps services raise events whilst still allowing services to be replaced without event handlers needing to be resubscribed.
The usage is simple, if you want to hook to an event, for example BuildableDestroyedEvent, simply call Subscribe:


public void MyHandlingMethod(BuildableDestroyedEventArguments eventArguments)

If you wish to unsubscribe from a method, you simply run the same code but call Unsubscribe:


public void MyHandlingMethod(BuildableDestroyedEventArguments eventArguments)

If you own the event and you wish to raise a message to all handlers that subscribed to your event, simply call Publish:

EventBus.Publish<BuildableDestroyedEvent>(new BuildableDestroyedEventArguments(buildable));
Product Compatible and additional computed target framework versions.
.NET Framework net481 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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 157 7/15/2023

First release.