# pradhan-v/plugster architecture

> Architecture diagram of the GitHub repository pradhan-v/plugster, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pradhan-v/plugster
- Repository: https://github.com/pradhan-v/plugster

## Overview

##### Project type and purpose
- Desktop application (Windows Forms / WPF style)
- Purpose: an editor and execution host for C# plugins (and simple C# programs)
- Provides both GUI (PlugsterUI) and CLI (PlugsterConsole) front-ends

##### File structure
Top-level assemblies/projects:
- FlatForm
– Custom WinForms controls and theming (MadPiranha/FlatForm/Controls and UITheme)
- ManyUtils
– Utility library (syntax highlighter, hotkey handling, process/window actions, etc.)
- PlugsterBase
– Core engine: plugin loader, test runner, parameter definitions, output interfaces
- PlugsterConsole
– Command-line front-end invoking PlugsterBase, using console I/O (ConsoleOutput)
- PlugsterUI
– GUI front-end: hosts editor (CodeTextBox), QuickTest panel, parameter editors, output window
- PlugsterTests
– Unit/integration tests exercising the core engine

##### README for insights
- Confirms C# desktop app to edit & execute plugins
- Mentions self-hosting (the app can load its own plugins)

##### Diagramming the architecture
a. Main components
- UI Layer
– PlugsterUI.exe with WinForms controls (from FlatForm + ManyUtils)
- CLI Layer
– PlugsterConsole.exe
- Core Engine
– PlugsterBase.dll
· Loader (PlugLoader, IPlugLoadInfo, TestLoadInfo)
· Manager (Sponsor/Sponsorer)
· Param model (IParam, BoolParam, TextParam, …)
· QuickTest runner, TestController, lifecycle events
· Output interface (IOutput, ConsoleOutput)
- Utilities
– ManyUtils.dll (Highlighter, HotKeyRegister, WindowAction, etc.)
- Tests
– PlugsterTests.dll targeting core engine

b. Relationships & data flows
1. User interacts with PlugsterUI
→ UI invokes Core Engine APIs (load plugin, run tests, update parameters)
→ Core Engine returns status/events → UI displays via OutputWindow controls
2. User runs CLI (PlugsterConsole)
→ CLI calls same Core Engine APIs → uses ConsoleOutput to print results
3. Both front-ends rely on support libraries:
– FlatForm for custom controls
– ManyUtils for highlighting, hotkeys, window/process actions
4. Test harness (PlugsterTests)
→ Directly references Core Engine classes to assert functionality

c. Architectural patterns & principles
- Layered architecture
– Presentation (UI/CLI)
– Application core (PlugsterBase)
– Utilities (FlatForm, ManyUtils)
– Tests (separate layer)
- Dependency Injection via interfaces (IOutput, IParamControlFactory)
- Plugin architecture via reflection and loader abstractions
- Separation of concerns: UI logic vs. engine vs. utilities

d. Key technologies/frameworks
- C#/.NET Framework (WinForms)
- Visual Studio solutions/projects (.csproj, app.config)
- Reflection & dynamic compilation (QuickTest, plugin loader)

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Utilities"
        FlatForm["FlatForm.dll"]:::util
        ManyUtils["ManyUtils.dll"]:::util
    end

    subgraph "Core Engine"
        PlugsterBase["PlugsterBase.dll"]:::core
        subgraph "Loader"
            PlugLoader["PlugLoader"] 
            IPlugLoadInfo["IPlugLoadInfo"]
            TestLoadInfo["TestLoadInfo"]
        end
        subgraph "Manager"
            Sponsor["Sponsor"]
            Sponsorer["Sponsorer"]
        end
        subgraph "Param Model"
            IParam["IParam"]
            BoolParam["BoolParam"]
            TextParam["TextParam"]
        end
        subgraph "QuickTest"
            QuickTest["QuickTest"]
            IQuickTestInput["IQuickTestInput"]
        end
        subgraph "Output"
            IOutput["IOutput"]
            ConsoleOutput["ConsoleOutput"]
        end
        subgraph "Test Controller"
            TestController["TestController"]
            AbstractTest["AbstractTest"]
            ITest["ITest"]
        end
    end

    subgraph "Frontends"
        subgraph "GUI Layer"
            PlugsterUI["PlugsterUI.exe"]:::ui
            PluginWindow["PlugsterWindow2"]
            CodeTextBox["CodeTextBox"]
            QuickTestPanel["QuickTestPanel"]
            OutputWindow["OutputWindow2"]
            ParamsFactory["ParamsControlFactory"]
        end
        subgraph "CLI Layer"
            PlugsterConsole["PlugsterConsole.exe"]:::ui
        end
    end

    Tests["PlugsterTests.dll"]:::test

    %% Connections
    PlugsterUI -->|"invokes APIs"| PlugsterBase
    PlugsterConsole -->|"invokes APIs"| PlugsterBase
    Tests -->|"tests APIs"| PlugsterBase
    PlugsterUI -->|"uses controls"| FlatForm
    PlugsterUI -->|"uses utilities"| ManyUtils
    PlugsterConsole -->|"uses utilities"| ManyUtils
    PlugsterBase -->|"outputs to"| ConsoleOutput
    PlugsterBase -->|"loads plugins via"| PlugLoader
    PlugsterBase -->|"manages parameters via"| IParam
    PlugsterBase -->|"runs quick tests via"| QuickTest
    PlugsterBase -->|"fires lifecycle via"| TestController

    %% Click Events
    click FlatForm "https://github.com/pradhan-v/plugster/blob/master/FlatForm/FlatForm.csproj"
    click FlatForm "https://github.com/pradhan-v/plugster/tree/master/FlatForm/MadPiranha/FlatForm/Controls"
    click FlatForm "https://github.com/pradhan-v/plugster/blob/master/FlatForm/MadPiranha/FlatForm/UITheme.cs"
    click ManyUtils "https://github.com/pradhan-v/plugster/blob/master/ManyUtils/ManyUtils.csproj"
    click ManyUtils "https://github.com/pradhan-v/plugster/tree/master/ManyUtils/MadPiranha/Plugster/Util"
    click PlugsterBase "https://github.com/pradhan-v/plugster/blob/master/PlugsterBase/PlugsterBase.csproj"
    click PlugLoader "https://github.com/pradhan-v/plugster/blob/master/PlugsterBase/MadPiranha/Plugster/Base/Loader/PlugLoader.cs"
    click IPlugLoadInfo "https://github.com/pradhan-v/plugster/blob/master/PlugsterBase/MadPiranha/Plugster/Base/Loader/IPlugLoadInfo.cs"
    click TestLoadInfo "https://github.com/pradhan-v/plugster/blob/master/PlugsterBase/MadPiranha/Plugster/Base/Loader/TestLoadInfo.cs"
    click Sponsor "https://github.com/pradhan-v/plugster/blob/master/PlugsterBase/MadPiranha/Plugster/Base/Manager/Sponsor.cs"
    click Sponsorer "https://github.com/pradhan-v/plugster/blob/master/PlugsterBase/MadPiranha/Plugster/Base/Manager/Sponsorer.cs"
    click IParam "https://github.com/pradhan-v/plugster/blob/master/PlugsterBase/MadPiranha/Plugster/Base/Param/IParam.cs"
    click BoolParam "https://github.com/pradhan-v/plugster/blob/master/PlugsterBase/MadPiranha/Plugster/Base/Param/BoolParam.cs"
    click TextParam "https://github.com/pradhan-v/plugster/blob/master/PlugsterBase/MadPiranha/Plugster/Base/Param/TextParam.cs"
    click QuickTest "https://github.com/pradhan-v/plugster/blob/master/PlugsterBase/MadPiranha/Plugster/Base/QuickTest/QuickTest.cs"
    click IQuickTestInput "https://github.com/pradhan-v/plugster/blob/master/PlugsterBase/MadPiranha/Plugster/Base/QuickTest/IQuickTestInput.cs"
    click IOutput "https://github.com/pradhan-v/plugster/blob/master/PlugsterBase/MadPiranha/Plugster/Base/Output/IOutput.cs"
    click ConsoleOutput "https://github.com/pradhan-v/plugster/blob/master/PlugsterBase/MadPiranha/Plugster/Base/Output/ConsoleOutput.cs"
    click TestController "https://github.com/pradhan-v/plugster/blob/master/PlugsterBase/MadPiranha/Plugster/Base/Test/TestController.cs"
    click AbstractTest "https://github.com/pradhan-v/plugster/blob/master/PlugsterBase/MadPiranha/Plugster/Base/Test/AbstractTest.cs"
    click ITest "https://github.com/pradhan-v/plugster/blob/master/PlugsterBase/MadPiranha/Plugster/Base/Test/ITest.cs"
    click PlugsterConsole "https://github.com/pradhan-v/plugster/blob/master/PlugsterConsole/PlugsterConsole.csproj"
    click PlugsterConsole "https://github.com/pradhan-v/plugster/blob/master/PlugsterConsole/MadPiranha/Program.cs"
    click PlugsterConsole "https://github.com/pradhan-v/plugster/blob/master/PlugsterConsole/app.config"
    click PlugsterUI "https://github.com/pradhan-v/plugster/blob/master/PlugsterUI/PlugsterUI.csproj"
    click PluginWindow "https://github.com/pradhan-v/plugster/blob/master/PlugsterUI/MadPiranha/Plugster/UI/PlugsterWindow2.cs"
    click CodeTextBox "https://github.com/pradhan-v/plugster/tree/master/FlatForm/MadPiranha/FlatForm/Controls"
    click QuickTestPanel "https://github.com/pradhan-v/plugster/blob/master/PlugsterUI/MadPiranha/Plugster/UI/Controls/QuickTestPanel.cs"
    click OutputWindow "https://github.com/pradhan-v/plugster/blob/master/PlugsterUI/MadPiranha/Plugster/UI/Controls/OutputWindow2.cs"
    click ParamsFactory "https://github.com/pradhan-v/plugster/tree/master/PlugsterUI/MadPiranha/Plugster/UI/Controls/Params"
    click Tests "https://github.com/pradhan-v/plugster/blob/master/PlugsterTests/PlugsterTests.csproj"
    click Tests "https://github.com/pradhan-v/plugster/tree/master/PlugsterTests/MadPiranha/PlugsterTests/Test"

    %% Styles
    classDef ui fill:#cce5ff,stroke:#004085,color:#004085;
    classDef core fill:#d4edda,stroke:#155724,color:#155724;
    classDef util fill:#fff3cd,stroke:#856404,color:#856404;
    classDef test fill:#e2e3e5,stroke:#818182,color:#41464b;
```
