Skip to content

dev:Creating a new Extension

Väinämö Łūmikērø edited this page Feb 2, 2017 · 4 revisions

Creating a new Extension

Forestual 2 features a powerful and simple extension system which allows external developers to add missing features.
The purpose of this guide is to help you developing an extension on your own.


1. Dependencies

If you plan to create an extension for the latest version of Forestual 2 then download the latest version of the Core. You can either build and compile it yourself from the repository or download a pre-compiled version from the Dependencies folder in each repository.

If you plan to create an extension for any other version of Forestual 2 then download the corresponding version of the Core pre-compiled from the Dependencies folder in the tag version branch of the client or the server.

For example the Core for Forestual 2 Version 2.1.13-beta would be found in
https://github.com/festivaldev/Forestual-2/tree/2.1.13-beta/Dependencies.


2. Preparing the Project

Create a new Project in Visual Studio (or whatever IDE you're using) and create a new Class Library (.dll) Project.

For the time being, Forestual 2 is running entirely on .NET Framework 4.6.1 so using a lower framework version might result in the extension not being compatible with Forestual 2.

Import the Forestual-2-Core-CS.dll and whatever libraries your extension might depend on and create a new public class called Extension. The class should implement from F2Core.Extension.IExtension. Your code should now look something like this:

using F2Core.Extension;

namespace YourExtension
{
    public class Extension : IExtension
    {
    
    }
}

3. Implementing the Basic Extension Structure

At this point in time, your compiler should show some errors because the IExtension interface isn't fully implemented. Your extension is missing what we call the Basic Extension Structure (BES). The easiest method to add the BES is to implement the IExtension automatically and many IDEs support this feature.
However, if you're not able to add the BES automatically you can use the BES template.

We try keeping the template up to date but errors might occur anyways.
Usually your IDE should show which functions/fields are still missing.