erri120.UtilityLibrary 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package erri120.UtilityLibrary --version 1.0.0                
NuGet\Install-Package erri120.UtilityLibrary -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="erri120.UtilityLibrary" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add erri120.UtilityLibrary --version 1.0.0                
#r "nuget: erri120.UtilityLibrary, 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 erri120.UtilityLibrary as a Cake Addin
#addin nuget:?package=erri120.UtilityLibrary&version=1.0.0

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

Utility Library

Utility Library for developing .NET Script Framework Plugins. This adds additional events, functions, extensions and more for you to work with so you can create plugins more efficient.

Requirements

The JetBrains.Annotations package is used mostly for the [NotNull] attribute because NetScriptFramework is still on .NET Framework 4.x and does not use C# 8.0 that has the new nullable feature. Null checking in the NetScriptFramework is important and this library will not null check most inputs. So when using a function from this library make sure to null check beforehand.

Using the Library

Aside from adding a reference to this in your project, you also need to make sure that the library loads before your plugin. Make sure your Plugin.Initialize function looks like this:

protected override bool Initialize(bool loadedAny)
{
    var utilityLibrary = NetScriptFramework.PluginManager.GetPlugin("utility.library");
    if (utilityLibrary == null) return false;
    if (!utilityLibrary.IsInitialized) return false;
    if (!loadedAny) return false;

    // other stuff...
}

This ensures that your plugin only loads after the library initialized and it will error out when the library is not loaded or initialized.

Functions

The UtilityLibrary class has multiple convenience functions like UtilityLibrary.IsInGame or UtilityLibrary.TryGetFormFromFile<T> to reduce the amount of duplicate code you often write.

Events

The UtilityLibrary.Events class contains new events that are (not yet) in the main framework.

Extensions

Extensions are static functions that have a this T argument, this library features multiple extensions for Actor and ItemEntry objects.

AddressLibrary

The Address Library UtilityLibrary.AddressLibrary is a collection of addresses that you can use without having to do any reverse engineering.

Product Compatible and additional computed target framework versions.
.NET Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in 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.