Wednesday, June 28, 2017

Abiathar API - Getting loaded

Welcome to Part 1 of a series on the Abiathar API. This will serve as API documentation so that other programmers can create extensions for Abiathar to add features. Without further ado, let's begin.

Abiathar extensions are .NET DLL files with a .aex extension. These require a reference to Abiathar's Interop.dll. To actually have your DLL recognized as an extension provider, include one public class that implements IAbiatharExtensionServer. That class must be constructable without parameters. Extensions servers have two required methods:

  • LoadExtensions returns a list of IAbiatharExtension. This list can be empty if your extension server determines it can't work on the platform, for instance. If you serve only one extension, it's fine to return a list containing only the extension server if the server also implements IAbiatharExtension.
  • ExtensionLoadFail is called if there's a problem getting the metadata of an extension. It includes the problematic extension and the exception.
The extension object itself only needs one property, Metadata, of type AbiatharExtensionMetadata, which has these fields:
  • Logo is the image that shows up next to your extension in the Extensions menu. It can be null if you don't want an icon.
  • Name is the short name of your extension, for showing the Extensions menu.
  • Version is the version of your extension. It shows up the extension info box.
  • Author is the author of your extension.
  • Description is the brief description of your extension that shows up in crash reports.
  • LongDescription is the more complete description that shows up in the extension info box. If this is empty, the Description is used instead.
  • Measurements is a function that takes a string and returns an object. You can do whatever you want in this function; Abiathar never uses it. It's to allow cooperating extensions to communicate among themselves. This can be null if you don't use that feature.
Drop the compiled AEX next to Abiathar and you'll see your extension in the Extensions list. It doesn't do anything yet, though. Next time, we'll look at adding some functionality.

No comments:

Post a Comment