Table of Contents

Generic Plugins

To implement generic plugin:

  • Read the introduction to extensions and plugins.
  • Create new public class inheriting from GenericPlugin abstract class.
  • Add implementation for mandatory abstract members.

Mandatory members

Member Description
Id Unique plugin id.

Optional members

You can implement additional functionality by overriding virtual methods from GenericPlugin base class.

Example plugin

public class TestPlugin : GenericPlugin
{
    private ILogger logger;

    public override Guid Id { get; } = Guid.Parse("D51194CD-AA44-47A0-8B89-D1FD544DD9C9");

    public TestPlugin(IPlayniteAPI api) : base(api)
    {
        logger = api.CreateLogger();
    }

    public override void OnGameInstalled(Game game)
    {
        // Add code to be executed when game is finished installing.
    }

    public override void OnGameStarted(Game game)
    {
        // Add code to be executed when game is started running.
    }

    public override void OnGameStarting(Game game)
    {
        // Add code to be executed when game is preparing to be started.
    }

    public override void OnGameStopped(Game game, long elapsedSeconds)
    {
        // Add code to be executed when game is preparing to be started.
    }

    public override void OnGameUninstalled(Game game)
    {
        // Add code to be executed when game is uninstalled.
    }

    public override void OnApplicationStarted()
    {
        // Add code to be execute when Playnite is initialized.
    }

    public override void OnApplicationStopped()
    {
        // Add code to be executed when Playnite is shutting down.
    }

    public override void OnLibraryUpdated()
    {
        // Add code to be execute when library is updated.
    }
}