Framework - Xjph/ObservatoryCore GitHub Wiki
Foundational Framework for Observatory Core and its plugins
ObservatoryFramework will already be included with any release of ObservatoryCore or its plugins. There is nothing for end-users here.
ObservatoryFramework contains a set of common interfaces used for communication between ObservatoryCore and its plugins, as well as an extensive set of supporting types to facilitate reading data from the Elite Dangerous journal without requiring a plugin developer to handle JSON deserialization or any of the journals various idiosyncrasies.
Provided interfaces and their members are:
-
IObservatoryCore
- Interface through which ObservatoryCore exposes functionality to plugins.-
void SendNotification(NotificationArgs args)
- Send a notification back to Core to be displayed and distributed to notifier plugins. -
void AddGridItem(IObservatoryWorker worker, object item)
- Adds a row of data to a worker's UI grid. -
void ClearGrid(IObservatoryWorker worker)
- Clears a worker's UI grid. -
Observatory.Framework.Files.Status GetStatus()
- Returns an object representing all the data in the currentstatus.json
file. -
string Version
- Returns the version of Core that has loaded the plugin. -
void ExecuteOnUIThread(Action action)
- Executes the specified action on the main UI thread. May be necessary for more involved handling of grid results.
-
-
IObservatoryPlugin
- Base interface containing common members used by both workers and notifiers. A plugin dll which implements only this interface will not be loaded.-
void Load(IObservatoryCore observatoryCore)
- Called by Observatory Core on startup. Perform any initialization necessary here. Also passes anIObservatoryCore
object which a plugin can hold onto if it needs to use any of its provided methods. -
string Name
- Property to provide the plugin's name to Observatory Core for display in various places. -
string ShortName
- Property to provide a shorter version of the plugin's name for display in space-constrainted places. A default implementation returningName
is provided so this can be omitted if not needed by a plugin. -
string Version
- Property to provide a version string of the plugin for display and update checks. -
Observatory.Framework.PluginUI PluginUI
- Property to get a copy of the UI used by this plugin. Can returnnull
for plugins that do not require a UI. -
object Settings
- Property to provide a set of values defined as a class within the plugin used to store plugin settings, if necessary, otherwisenull
.
-
-
IObservatoryNotifier
- Interface for plugins which will handle notifications.-
void OnNotificationEvent(NotificationArgs args)
- Called by Observatory Core when any other plugin generates a notification.
-
-
IObservatoryWorker
- Interface for plugins which will process and respond to journal and status data.-
void JournalEvent<TJournal>(TJournal journal)
- Called whenever a new line is written to the Elite Dangerous journal.TJournal
can by any of the types provided in theObservatory.Framework.Files.Journal
namespace which inherit fromJournalBase
, or in other words, any possible Elite Dangerous journal event. -
void StatusChange(Observatory.Framework.Files.Status status)
- Called for allstatus.json
file changes for up to the moment status monitoring. An empty default implementation is provided so this can be omitted if not needed by a plugin. -
void ReadAllStarted()
- Called when a user begins a Read All operation. Plugin authors are encouraged to suppress notifications during Read All operations, and may also find it necessary to change behaviour in other ways. An empty default implementation is provided so this can be omitted if not needed by a plugin. -
void ReadAllFinished()
- Called when a Read All operation completes. An empty default implementation is provided so this can be omitted if not needed by a plugin.
-
To begin creating a plugin either clone this repository and add it as a project reference for your plugin, or download the compiled dll and use it as an assembly reference. If using the repository as a project reference ensure you are using the same commit version as the version of Observatory Core you are targeting. Then simply implement one or more of the above interfaces.