Plugin system - GoldRenard/DMOAdvancedLauncher GitHub Wiki

Plugin system

SDK Library

The common shared SDK library is AdvancedLauncherSDK. It includes all service interfaces, some common abstract implementations of these interfaces and common model classes/entities. Plugins are just simple .NET Framework class libraries that references to this library and contains classes that implements IPlugin interface.

Online documentation of SDK is available here (generated by doxygen).

Main namespaces
Initialization pipeline

Every application start runs PluginManager internal service that goes through the following steps:

  1. Scans %APPLICATION_ROOT%/Plugins folder for dlls
  2. Scans each loaded dll for types with implemented IPlugin interface.
  3. Initializes each type that was found:
    1. Validates Strong-Name of plugin assembly
    2. Grants CAS permissions to plugin based on result of Strong-Name validation:
      • Full Trust permission set in case that it have valid Strong-Name with exactly the same PublicKey token of launcher's Strong-Name.
      • Partial Trust in other cases. The full set of permissions is listed on the following section
    3. Creates new AppDomain for this plugin with granted permissions
    4. Instantiates the plugin in this AppDomain
    5. Calls the void OnActivate(IPluginHost PluginHost) plugin method that should do its work (menu item registration, event listeners, etc).
      • Do not forget to implement void OnStop(IPluginHost PluginHost) method that clears resources associated with plugin (removes menu items, unregisters event listeners, etc).
      • Manual plugin stop/start actions are implemented as plugin console command. UI will be implemented in future releases.
Partial trust permissions list
Permission name Flags Note
UIPermission AllWindows, NoClipboard Full UI access without user clipboard
WebPermission Unrestricted Full web access
WebBrowserPermission Unrestricted Full internal web browser access
ReflectionPermission NoFlags Plugins are able to access only visible members
SecurityPermission Execution, SerializationFormatter, Assertion Execution and serialization support. Service implementations may assert some plugin calls
FileIOPermission PathDiscovery, Read FileSystem access only for application's BaseDirectory and resource folder (read-only)
FileIOPermission PathDiscovery, Read, Write FileSystem full access only for 3rd-party launcher's resources (EnvironmentManager.Resources3rdPath or %APPDATA%\GoldRenard\AdvancedLauncher\Resources)
How to get Full Trust permission access

We won't give Full Trust access by default to plugins in order to prevent any malicious actions by not-authorized plugins. Nobody wants to allow the unknown plugins to do anything they want on the host computer. Really.

Full Trust access is given to plugins that was signed with my own release private key. If your plugin implements a very nice and useful feature that requires Full Trust access, contact the author.

Simple plugin example

Please take a look at this project.