# serraniel/discordmedialoader architecture

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

- Interactive diagram: https://gitdiagram.com/serraniel/discordmedialoader
- Repository: https://github.com/serraniel/discordmedialoader

## Overview

##### Main Components
- User Interface (UI) Layer: This is implemented as Windows Forms (e.g., MainForm, LoginDialog, FrmSplash, FrmDownload) and is located in the “Discord Media Loader.Application” and “Discord Media Loader” directories. It handles user input, login, server/channel selection, and displaying progress.
- Core/Business Logic: The “DML.Core” and “DML.AppCore” subprojects encapsulate key business logic. For example, classes such as Job, JobScheduler, and Settings manage the attachment download routines and scheduling of parallel tasks.
- Client/Integration Layer: The “DML.Client” project and parts of the application that integrate with Discord (using the Discord.Net library hosted in the “libs/Discord.Net” directory) form the client-side integration with external services.
- Installation & Deployment: The “install” directory, winget deployment scripts, and related configuration files serve deployment purposes.
- External Dependencies: These include the Discord.Net library and the .NET Framework 4.6 requirement, which should be mentioned as external systems or libraries that the application depends on.

##### Component Relationships and Interactions
- The UI layer (forms and dialogs) interacts with the Core/Business Logic layer to initiate downloads, process user settings, and display feedback.
- The Core/Business Logic layer interacts with the Client/Integration layer to communicate with the Discord API via the Discord.Net integration library.
- There is a data flow from the UI to the Core (for example, login credentials and download settings) and then from the Core dispatching jobs (via JobScheduler) to the Discord API. Return flows handle conveying statuses, errors, or success acknowledgments back to the user interface.
- The installation components package and deploy the overall application.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% UI Layer
    subgraph "UI Layer (Windows Forms)"
        UIApp["WinForms UI (Discord Media Loader.Application)"]:::ui
        UIDM["WinForms UI (Discord Media Loader)"]:::ui
    end

    %% Core / Business Logic Layer
    subgraph "Core / Business Logic Layer"
        DMLCore["DML.Core (Job, JobScheduler, Settings)"]:::core
        DMLAppCore["DML.AppCore"]:::core
    end

    %% Client / Integration Layer
    subgraph "Client / Integration Layer"
        DMLClient["DML.Client"]:::client
        DiscordNet["Discord.Net Library"]:::client
    end

    %% External Dependency
    API["Discord API"]:::external

    %% Installation & Deployment
    Install["Installation & Deployment"]:::deploy

    %% Configuration Management
    subgraph "Configuration Management"
        ConfigApp["Config - Discord Media Loader.Application"]:::config
        ConfigDM["Config - Discord Media Loader"]:::config
    end

    %% Data Flow Connections
    UIApp -->|"user actions"| DMLCore
    UIDM -->|"user actions"| DMLCore

    DMLCore -->|"process requests"| DMLClient
    DMLAppCore ---|"internal collaboration"| DMLCore

    DMLClient -->|"API call"| API
    DiscordNet -->|"API integration"| API
    API -->|"response"| DMLClient

    DMLClient -->|"return statuses"| DMLCore
    DMLCore -->|"update UI"| UIApp
    DMLCore -->|"update UI"| UIDM

    %% Configuration and Installation connections
    ConfigApp ---|"loads configs"| DMLCore
    ConfigDM ---|"loads configs"| DMLCore

    Install ---|"deployment package"| UIApp
    Install ---|"deployment package"| DMLCore
    Install ---|"deployment package"| DMLClient

    %% Click Events
    click UIApp "https://github.com/serraniel/discordmedialoader/blob/master/Discord Media Loader.Application"
    click UIDM "https://github.com/serraniel/discordmedialoader/tree/master/Discord Media Loader"
    click DMLCore "https://github.com/serraniel/discordmedialoader/blob/master/DML.Core"
    click DMLAppCore "https://github.com/serraniel/discordmedialoader/blob/master/DML.AppCore"
    click DMLClient "https://github.com/serraniel/discordmedialoader/blob/master/DML.Client"
    click DiscordNet "https://github.com/serraniel/discordmedialoader/blob/master/libs/Discord.Net"
    click Install "https://github.com/serraniel/discordmedialoader/tree/master/install"
    click ConfigApp "https://github.com/serraniel/discordmedialoader/blob/master/Discord Media Loader.Application"
    click ConfigDM "https://github.com/serraniel/discordmedialoader/tree/master/Discord Media Loader"

    %% Styles
    classDef ui fill:#f9e79f,stroke:#b9770e,stroke-width:2px;
    classDef core fill:#aed6f1,stroke:#3498db,stroke-width:2px;
    classDef client fill:#a9dfbf,stroke:#27ae60,stroke-width:2px;
    classDef external fill:#f5b7b1,stroke:#c0392b,stroke-width:2px;
    classDef deploy fill:#d2b4de,stroke:#8e44ad,stroke-width:2px;
    classDef config fill:#f9c2d1,stroke:#c0392b,stroke-width:2px;
```
