# annosz/uiinfosuite2 architecture

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

- Interactive diagram: https://gitdiagram.com/annosz/uiinfosuite2
- Repository: https://github.com/annosz/uiinfosuite2

## Overview

##### Main Components
- Mod Loader Entry Point: Show the ModEntry.cs, which is the primary entry point for the mod. This is where SMAPI initializes the mod during game startup.
- Compatibility Layer: Include the Compatibility directory. This component handles integration with external mods (such as NPC Map Locations or Level Extender) by checking for API presence and adapting behavior accordingly. Also include submodules like the CustomBush interfaces and related extensions.
- Infrastructure Services: Represent the Infrastructure directory which houses extensions, helpers, reflection utilities, asset/sound management (IconHandler, SoundHelper) and general-purpose tools that support other functionalities.
- Additional Features: Illustrate a separate module or subcomponent for any additional features that the mod provides (like SkipIntro functionality in AdditionalFeatures).
- Internationalization (i18n) & Assets: Although not in a C# folder, the i18n directory and assets folder represent core resources—language files and asset files (such as LevelUp.wav or licenses) that the mod uses. These should be clearly connected to the UI Elements and the Mod Entry as resources.
- Build and Configuration: Include peripheral nodes for continuous integration (GitHub workflows and Woodpecker build configurations) which support the automated building and testing of the mod.

##### Relationships and Interactions
- The ModEntry component initializes the mod runtime by loading the Options configurations, invoking the Compatibility logic, and registering UI Elements with both game and SMAPI events.
- The Options component influences the behavior of UI Elements – configuration changes affect how UI is rendered.
- The Infrastructure services are shared by both UI Elements and Compatibility; they provide helper functions (such as extension methods, asset handling, reflection, etc.) to ensure modularity.
- Data/resource flows from the assets and i18n directories into the UI Elements, ensuring that the right sound effects and language translations are available.

##### Architectural Patterns and Technologies
- This mod follows a modular design with strong separation of concerns: UI logic, configuration, compatibility, and core infrastructure are separated into distinct directories.
- It makes heavy use of dependency injection or at least service locator patterns (for utilities and helper classes) for maintainability.
- The project leverages extension methods for miscellaneous functionalities (as seen in the Infrastructure/Extensions directory), emphasizing code reuse and modularity.

##### Elements
- Each component (ModEntry, UI Elements, Options, Compatibility, Infrastructure, Additional Features, i18n, and Assets) should have a clear label.

## Diagram (Mermaid)

```mermaid
graph TD
  %% External Dependency
  SMAPI["SMAPI (External)"]:::external

  %% Core Mod Components
  subgraph "Core Mod Components"
    ModEntry["ModEntry (Mod Loader Entry Point)"]:::core
    Options["Options & Configuration"]:::core
    UIElements["UI Elements"]:::ui
    Compatibility["Compatibility Layer"]:::core
    AdditionalFeatures["Additional Features"]:::core
  end

  %% Supporting Services
  subgraph "Supporting Services"
    Infrastructure["Infrastructure Services"]:::infra
  end

  %% Resources
  subgraph "Resources"
    i18n["Internationalization (i18n)"]:::resource
    Assets["Assets"]:::resource
  end

  %% Build & Configuration
  subgraph "Build & Configuration"
    GitHubWorkflows["GitHub Workflows"]:::build
    Woodpecker["Woodpecker Build"]:::build
  end

  %% Interactions and Relationships
  SMAPI -->|"initializes"| ModEntry
  ModEntry -->|"loads"| Options
  ModEntry -->|"registers"| UIElements
  ModEntry -->|"integrates"| Compatibility
  ModEntry -->|"triggers"| AdditionalFeatures

  Options -->|"configures"| UIElements

  Infrastructure -->|"supports"| UIElements
  Infrastructure -->|"supports"| Compatibility

  UIElements -->|"retrieves"| i18n
  UIElements -->|"retrieves"| Assets

  GitHubWorkflows -->|"CI/CD"| ModEntry
  Woodpecker -->|"CI/CD"| ModEntry

  %% Click Events
  click ModEntry "https://github.com/annosz/uiinfosuite2/blob/master/UIInfoSuite2/ModEntry.cs"
  click Options "https://github.com/annosz/uiinfosuite2/tree/master/UIInfoSuite2/Options"
  click UIElements "https://github.com/annosz/uiinfosuite2/tree/master/UIInfoSuite2/UIElements"
  click Compatibility "https://github.com/annosz/uiinfosuite2/tree/master/UIInfoSuite2/Compatibility"
  click Infrastructure "https://github.com/annosz/uiinfosuite2/tree/master/UIInfoSuite2/Infrastructure"
  click AdditionalFeatures "https://github.com/annosz/uiinfosuite2/tree/master/UIInfoSuite2/AdditionalFeatures"
  click i18n "https://github.com/annosz/uiinfosuite2/tree/master/UIInfoSuite2/i18n"
  click Assets "https://github.com/annosz/uiinfosuite2/tree/master/UIInfoSuite2/assets"
  click GitHubWorkflows "https://github.com/annosz/uiinfosuite2/tree/master/.github/workflows"
  click Woodpecker "https://github.com/annosz/uiinfosuite2/blob/master/.woodpecker"

  %% Styles
  classDef external fill:#f9c,stroke:#d43f3a,stroke-width:2px;
  classDef core fill:#bbdefb,stroke:#0d47a1,stroke-width:2px;
  classDef ui fill:#c8e6c9,stroke:#2e7d32,stroke-width:2px;
  classDef infra fill:#f8bbd0,stroke:#880e4f,stroke-width:2px;
  classDef resource fill:#b2ebf2,stroke:#00695c,stroke-width:2px;
  classDef build fill:#fff9c4,stroke:#f57f17,stroke-width:2px;
```
