Skip to content

Initialization

When Do I Need It?

You need it if your plugin needs to do some setup before it can be used. For example, if your plugin needs to preload a file into memory, download some data from the internet, or just generate some data that will be used later, you can use the Init attribute.

How Do I Use It?

Define a method in your plugin class that is marked with the [Init] attribute. It must be either a sync method that returns void or an async method that returns Task.

Main.cs
public class MyPlugin : ExtendedPlugin
{
private string _someData = "";
[Init]
public void MyInitMethod()
{
using var reader = new StreamReader("TestFile.txt");
_someData = reader.ReadToEnd();
}
}