# tranht17/wintune architecture

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

- Interactive diagram: https://gitdiagram.com/tranht17/wintune
- Repository: https://github.com/tranht17/wintune

## Overview

##### Project type and purpose
- This is a single‑process, desktop “full‑stack” tool written in AutoHotkey (WinTune.ahk) that provides a GUI for Windows system optimization, privacy tweaks, host file editing, startup management, theming, and multilingual support.

##### File structure
- Top‑level files:
- WinTune.ahk (entry point, command‑line parsing)
- README.md, LICENCE, .gitignore, .gitattributes
- Gui/ directory: one .ahk file per GUI module (Base, HostsEdit, Optimizer, StartupManager, Theme, etc.)
- Inc/ directory: core business logic modules (Data, CustomFn, OptimizeConfig, Optimizer, LangData)
- Lib/ directory: third‑party libraries (JSON, Gdip_All, PackageManager, SC, etc.)
- Lang/ directory: localization JSON files (de.json, en.json, …)
- Tools/ directory: developer‑and‑debug utilities (batch runner, debug script, language converter)

##### README for additional insights
- Confirms GUI features (system tweaks, host edit, startup manager, save/load config)
- Multilingual and theming capabilities (reads JSON files for languages and themes)
- Command‑line flags for headless operations (/SaveConfig, /LoadConfig, /User)

##### Elements
- WinTune.ahk → GUI modules
- GUI modules → Inc modules
- Inc modules → Lib modules
- Inc modules → Windows OS (registry, hosts file)
- Inc modules ↔ JSON files (read/write)

##### Detail without overthinking
- Break each major subsystem into its constituent scripts/modules
- Configuration and asset directories as first‑class components
- Both the GUI‑driven flow and the headless, CLI‑driven flow

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Entry Point
    WinTune["WinTune.ahk<br/>(Entry Point)"]:::entry

    %% Presentation Layer
    subgraph "Presentation Layer" 
        direction TB
        BaseGUI["GUI: Base.ahk"]:::presentation
        CheckUpdateGUI["GUI: CheckUpdate.ahk"]:::presentation
        HostsEditGUI["GUI: HostsEdit.ahk"]:::presentation
        LanguageGUI["GUI: Language.ahk"]:::presentation
        OptimizerGUI["GUI: Optimizer.ahk"]:::presentation
        PackageManagerGUI["GUI: PackageManager.ahk"]:::presentation
        StartupManagerGUI["GUI: StartupManager.ahk"]:::presentation
        ThemeGUI["GUI: Theme.ahk"]:::presentation
        UserGUI["GUI: User.ahk"]:::presentation
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        direction TB
        BaseBL["BL: Base.ahk"]:::business
        CustomFn["BL: CustomFn.ahk"]:::business
        DataBL["BL: Data.ahk"]:::business
        LangData["BL: LangData.ahk"]:::business
        OptConfigBL["BL: OptimizeConfig.ahk"]:::business
        OptimizerBL["BL: Optimizer.ahk"]:::business
    end

    %% Library Layer
    subgraph "Library Layer"
        direction TB
        Gdip["Lib: Gdip_All.ahk"]:::library
        Hex["Lib: Hex.ahk"]:::library
        JSONlib["Lib: JSON.ahk"]:::library
        PackageManagerLib["Lib: PackageManager.ahk"]:::library
        PicSwitch["Lib: PicSwitch.ahk"]:::library
        Powrprof["Lib: Powrprof.ahk"]:::library
        RunTerminal["Lib: RunTerminal.ahk"]:::library
        SC["Lib: SC.ahk"]:::library
        ToolTipOptions["Lib: ToolTipOptions.ahk"]:::library
    end

    %% Data Stores
    subgraph "Data Stores"
        direction TB
        Languages["Lang JSON files"]:::datastore
        Configs["Config JSON files"]:::datastore
    end

    %% Static Assets
    subgraph "Static Assets"
        direction TB
        Img["Img/ (icons, screenshots)"]:::asset
    end

    %% Developer Tools
    subgraph "Developer & Debug Tools"
        direction TB
        DragDrop["1.Drag&DropAHKFileHereToRun.bat"]:::tools
        DebugStartup["Debug_Startup.ahk"]:::tools
        LangConverter["LangConverterTool.ahk"]:::tools
    end

    %% External System
    subgraph "External System"
        direction TB
        WindowsOS["Windows OS<br/>(Registry, File System, Services)"]:::external
    end

    %% Connections
    WinTune --> BaseGUI
    WinTune --> CheckUpdateGUI
    WinTune --> HostsEditGUI
    WinTune --> LanguageGUI
    WinTune --> OptimizerGUI
    WinTune --> PackageManagerGUI
    WinTune --> StartupManagerGUI
    WinTune --> ThemeGUI
    WinTune --> UserGUI
    WinTune --> BaseBL

    BaseGUI --> BaseBL
    CheckUpdateGUI --> BaseBL
    HostsEditGUI --> BaseBL
    LanguageGUI --> LangData
    OptimizerGUI --> OptConfigBL
    OptimizerGUI --> OptimizerBL
    PackageManagerGUI --> BaseBL
    StartupManagerGUI --> BaseBL
    ThemeGUI --> ToolTipOptions

    BaseBL --> Gdip
    BaseBL --> JSONlib
    CustomFn --> SC
    DataBL --> JSONlib
    DataBL --> FileIO["File I/O"]:::invisible
    LangData --> JSONlib
    OptConfigBL --> JSONlib
    OptimizerBL --> JSONlib
    OptimizerBL --> Powrprof

    BaseBL --> WindowsOS
    CustomFn --> WindowsOS
    DataBL --> WindowsOS
    OptConfigBL --> Configs
    LangData --> Languages

    %% Layer flows
    presentationEnd(( )):::invisible
    presentationEnd --> BaseBL
    BaseBL --> Gdip

    %% Click Events
    click WinTune "https://github.com/tranht17/wintune/blob/main/WinTune.ahk"
    click BaseGUI "https://github.com/tranht17/wintune/blob/main/Gui/Base.ahk"
    click CheckUpdateGUI "https://github.com/tranht17/wintune/blob/main/Gui/CheckUpdate.ahk"
    click HostsEditGUI "https://github.com/tranht17/wintune/blob/main/Gui/HostsEdit.ahk"
    click LanguageGUI "https://github.com/tranht17/wintune/blob/main/Gui/Language.ahk"
    click OptimizerGUI "https://github.com/tranht17/wintune/blob/main/Gui/Optimizer.ahk"
    click PackageManagerGUI "https://github.com/tranht17/wintune/blob/main/Gui/PackageManager.ahk"
    click StartupManagerGUI "https://github.com/tranht17/wintune/blob/main/Gui/StartupManager.ahk"
    click ThemeGUI "https://github.com/tranht17/wintune/blob/main/Gui/Theme.ahk"
    click UserGUI "https://github.com/tranht17/wintune/blob/main/Gui/User.ahk"
    click BaseBL "https://github.com/tranht17/wintune/blob/main/Inc/Base.ahk"
    click CustomFn "https://github.com/tranht17/wintune/blob/main/Inc/CustomFn.ahk"
    click DataBL "https://github.com/tranht17/wintune/blob/main/Inc/Data.ahk"
    click LangData "https://github.com/tranht17/wintune/blob/main/Inc/LangData.ahk"
    click OptConfigBL "https://github.com/tranht17/wintune/blob/main/Inc/OptimizeConfig.ahk"
    click OptimizerBL "https://github.com/tranht17/wintune/blob/main/Inc/Optimizer.ahk"
    click Gdip "https://github.com/tranht17/wintune/blob/main/Lib/Gdip_All.ahk"
    click Hex "https://github.com/tranht17/wintune/blob/main/Lib/Hex.ahk"
    click JSONlib "https://github.com/tranht17/wintune/blob/main/Lib/JSON.ahk"
    click PackageManagerLib "https://github.com/tranht17/wintune/blob/main/Lib/PackageManager.ahk"
    click PicSwitch "https://github.com/tranht17/wintune/blob/main/Lib/PicSwitch.ahk"
    click Powrprof "https://github.com/tranht17/wintune/blob/main/Lib/Powrprof.ahk"
    click RunTerminal "https://github.com/tranht17/wintune/blob/main/Lib/RunTerminal.ahk"
    click SC "https://github.com/tranht17/wintune/blob/main/Lib/SC.ahk"
    click ToolTipOptions "https://github.com/tranht17/wintune/blob/main/Lib/ToolTipOptions.ahk"
    click Languages "https://github.com/tranht17/wintune/tree/main/Lang/"
    click Img "https://github.com/tranht17/wintune/tree/main/Img/"
    click DragDrop "https://github.com/tranht17/wintune/blob/main/Tools/1.Drag&DropAHKFileHereToRun.bat"
    click DebugStartup "https://github.com/tranht17/wintune/blob/main/Tools/Debug_Startup.ahk"
    click LangConverter "https://github.com/tranht17/wintune/blob/main/Tools/LangConverterTool.ahk"

    %% Styles
    classDef entry fill:#FFD700,stroke:#333,stroke-width:2px;
    classDef presentation fill:#ACE1AF,stroke:#333,stroke-width:1px;
    classDef business fill:#FFE4B5,stroke:#333,stroke-width:1px;
    classDef library fill:#ADD8E6,stroke:#333,stroke-width:1px;
    classDef datastore fill:#E6E6FA,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5;
    classDef asset fill:#D3D3D3,stroke:#333,stroke-width:1px;
    classDef tools fill:#FFB6C1,stroke:#333,stroke-width:1px;
    classDef external fill:#FFFFFF,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5;
    classDef invisible fill:none,stroke:none;
```
