# codecooo/padma-workshopdl architecture

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

- Interactive diagram: https://gitdiagram.com/codecooo/padma-workshopdl
- Repository: https://github.com/codecooo/padma-workshopdl

## Overview

##### Project Type and Main Purpose
- The README makes clear that Padma is a GUI tool to download large Steam Workshop mods and even auto-install Stellaris mods.
- It targets both Windows (with an installer built using WiX) and Linux (via an AppImage). This implies a cross-platform desktop application built with a modern UI framework.

##### Analyzing the File Structure
- The root includes the solution file (Padma.sln) and separate top-level directories like “Padma” (core application code) and “padma-win-setup” (installer project).
- Inside the “Padma” folder, you have the typical MVVM (Model-View-ViewModel) structure:
- App.axaml/App.axaml.cs: Entry point and application-level configuration.
- Views and their corresponding .axaml.cs code-behind files: Define the UI components/layouts.
- ViewModels (with a base ViewModel class and specific ones for home, history, settings, supported games, and main window): Manage states and interactions.
- Models: Data representations such as “LiteDbHistory.cs” and “SupportedGamesData.cs”.
- Services: Core business logic to interact with external tools and handle internal tasks (e.g., AppIdFinder, CmdRunner, DownloadMods, StellarisAutoInstall, etc.). These indicate clear separation between UI and logic.
- The “Padma/data” folder holds a local database file for supported games (list_supported_games.db), suggesting a small internal data store.
- The “padma-win-setup” directory contains WiX project files for Windows installer creation.

##### Main Components
a. GUI / UI Layer (Avalonia):
- Entry point (App.axaml & Program.cs)
- Views (Home, History, MainWindow, Settings, SupportedGames etc.)
b. ViewModels Layer:
- Each view’s corresponding ViewModel (HomeViewModel, HistoryViewModel, etc.) communicating with both UI and backend services.
c. Services Layer:
- Business logic components (e.g., AppIdFinder, CmdRunner, DownloadMods, DownloadProcessor, DownloadProgressTracker, StellarisAutoInstall, etc.). These encapsulate interactions with steamcmd and mod download processes.
d. Data / Model Layer:
- Models representing domain entities (mod history and supported games info).
- Local data storage (LiteDb, list_supported_games.db).
e. Installer Component:
- The padma-win-setup component with its WiX configuration, representing the deployment strategy for Windows.

##### Relationships and Interactions
- Services use Models for data and may also interact with external tools (steamcmd) for download operations.
- Data flows from local storage (the “data” folder) into the Models to be displayed by the Views.
- Separate the installer process (packaged in “padma-win-setup”) which is used only on Windows for installation and configuration setup.

##### Architectural Patterns and Design Principles
- MVVM Pattern: Clearly delineated in the code structure – separate Views, ViewModels, and Models.
- Service-Oriented Approach: Modular service classes handle discrete functionalities such as fetching the appID and processing downloads.
- Cross-Platform Considerations: Parts of the codebase and installer demonstrate desktop application best practices for platform-specific handling.

##### Instructing the Principal Software Engineer
- Integration points with external systems (steamcmd and, implicitly, online resources for game support).
- Use annotations to mention any key technologies and design patterns (like MVVM) that influence the structure.

## Diagram (Mermaid)

```mermaid
graph TD
    %% UI Layer
    subgraph "UI Layer (Avalonia)"
        subgraph "Entry Point"
            UI_App("App.axaml"):::ui
            UI_AppCS("App.axaml.cs"):::ui
            UI_Program("Program.cs"):::ui
        end
        UI_Views("Views (Home,MainWindow,History,Settings,SupportedGames)"):::ui
    end

    %% ViewModels Layer
    subgraph "ViewModels Layer"
        VM("ViewModels (HomeViewModel,HistoryViewModel,MainWindowViewModel,SettingsViewModel,SupportedGamesViewModel,ViewModelBase)"):::viewmodels
    end

    %% Services Layer
    subgraph "Services Layer"
        S("Services (AppIdFinder,CmdRunner,DownloadMods,DownloadProcessor,DownloadProgressTracker,StellarisAutoInstall)"):::services
        STEAM("steamcmd (external)"):::external
        S -->|"calls"| STEAM
    end

    %% Data / Model Layer
    subgraph "Data / Model Layer"
        M("Models (LiteDbHistory,SupportedGamesData)"):::data
        D("Local Data Storage (list_supported_games.db)"):::data
    end

    %% Deployment / Installer Component
    subgraph "Deployment"
        I("Installer (WiX)"):::installer
    end

    %% Relationships
    UI_Views -->|"binds"| VM
    VM -->|"invokes"| S
    S -->|"uses"| M
    S -->|"persists"| D
    M -->|"reads/writes"| D
    I -->|"deploys"| UI_Views

    %% Click Events
    click UI_App "https://github.com/codecooo/padma-workshopdl/blob/main/Padma/App.axaml"
    click UI_AppCS "https://github.com/codecooo/padma-workshopdl/blob/main/Padma/App.axaml.cs"
    click UI_Program "https://github.com/codecooo/padma-workshopdl/blob/main/Padma/Program.cs"
    click UI_Views "https://github.com/codecooo/padma-workshopdl/tree/main/Padma/Views"
    click VM "https://github.com/codecooo/padma-workshopdl/tree/main/Padma/ViewModels"
    click S "https://github.com/codecooo/padma-workshopdl/tree/main/Padma/Services"
    click M "https://github.com/codecooo/padma-workshopdl/tree/main/Padma/Models"
    click D "https://github.com/codecooo/padma-workshopdl/tree/main/Padma/data"
    click I "https://github.com/codecooo/padma-workshopdl/tree/main/padma-win-setup"

    %% Styles
    classDef ui fill:#E3F2FD,stroke:#1f77b4,stroke-width:2px;
    classDef viewmodels fill:#E8F5E9,stroke:#2ca02c,stroke-width:2px;
    classDef services fill:#FFF3E0,stroke:#ff7f0e,stroke-width:2px;
    classDef data fill:#F3E5F5,stroke:#9467bd,stroke-width:2px;
    classDef installer fill:#FFEBEE,stroke:#d62728,stroke-width:2px;
    classDef external fill:#F0F0F0,stroke:#7f7f7f,stroke-dasharray: 5 5,stroke-width:2px;
```
