Quick Start
Project Creation
- Download the API1 project
- Create a C# project for net8.0-windows of type Class Library
- Add a reference to the API1 project
Interface Implementation
Implement IModuleInfo:
using OutfitTool.API1;
using OutfitTool.API1.Dto;
namespace ExampleModule;
internal class ModuleInfo : IModuleInfo
{
public string Name => "example_module";
public string DisplayName => "ExampleModule";
public string AssemblyName => "ExampleModule";
public string Description => "OutfitTool module example";
public ModuleVersion Version => new ModuleVersion(1, 0, "example");
public string Changes => "First version";
public string Author => "Stolyarov Roman";
public string AuthorContacts => "rshome@mail.ru";
public int RequireApiVersion => 1;
}
Implement the SendExampleLogMessage command:
using System.Windows;
using OutfitTool.API1;
using OutfitTool.API1.Dto;
namespace ExampleModule.Commands;
public class SendExampleLogMessage: ICommand
{
public string Name => "SendExampleLogMessage";
public string Description => "Example command log message";
public CommandContextMenu? ContextMenu => GetContextMenu();
private CommandContextMenu GetContextMenu()
{
return new CommandContextMenu("Example log message", null);
}
public void Run()
{
ModuleController.Logger?.Info("Example log message");
}
}
Implement IModuleController:
using System.Windows.Media.Imaging;
using ExampleModule.Commands;
using OutfitTool.API1;
using OutfitTool.API1.Dto;
using OutfitTool.API1.Logger;
namespace ExampleModule;
public class ModuleController: IModuleController
{
public static ILogger? Logger;
public void SetLanguage(string language)
{
}
public void Init(ILogger logger)
{
Logger = logger;
}
public void Shutdown()
{
}
public List<ICommand> GetCommandList()
{
return [new SendExampleLogMessage()];
}
public BitmapImage? GetTaskbarIcon()
{
return null;
}
public string? GetTaskbarIconText()
{
return null;
}
public Notification? PopNotification()
{
return null;
}
public void OpenSettings()
{
}
}
Build and Run
Compile and build, resulting in ExampleModule.dll
Copy the library to the folder %outfit tool dir%/modules/ExampleModule/, where %outfit tool dir% is the directory from which the OutfitTool host operates
That's it. Now you have a module that can be activated in OutfitTool. It adds the "ExampleLogMessage" item to the host's context menu, which when clicked will have your module write the message "Example log message" to the host's log