# n0k0m3/azur-lane-scripts-autopatcher architecture

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

- Interactive diagram: https://gitdiagram.com/n0k0m3/azur-lane-scripts-autopatcher
- Repository: https://github.com/n0k0m3/azur-lane-scripts-autopatcher

## Overview

##### Project type and purpose
- This is an open-source, .NET-based autopatcher/CLI tool for “Azur Lane” game scripts.
- The tool automates downloading, patching asset bundles, rewriting configuration files, and optionally running in GUI (autopatcher) or headless (cli/cli64) modes.

##### File structure
- Top-level:
- v2.x.x – archived version (2018), contains C# projects and one Go rewriter.
- v3.x.x – active version (2019+), the focus of ongoing development.
- Under v3.x.x:
- lib/konpaku and lib/loader – shared C# class libraries (AssetBundle, HttpClient, PathMgr, UI abstractions).
- main/autopatcher – executable project (Windows GUI/console hybrid using Resources, ConfigMgr, LuaMgr).
- main/cli and main/cli64 – 32-bit and 64-bit console applications (OptionSet-based CLI framework, same core managers).
- main/rewriter – console tool that uses IniFileParser library to rewrite .ini files (SkinMgr, Configuration).

##### README for additional insights
- README confirms .NET Framework 4.5+ and Python 3.x are prerequisites.
- It refers to two branches (master and staging) and points to CI artifacts, indicating a CI/CD pipeline for binary releases.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Services and Dependencies
    subgraph "External" 
        NET[".NET Framework"]:::external
        PY["Python Runtime"]:::external
        PS["Patch Server (HTTP)"]:::external
        GF["Game Asset Folder"]:::external
        CI["CI/CD (AppVeyor)"]:::external
    end

    %% Shared Libraries
    subgraph "v3.x.x/lib" 
        KON["Konpaku.Lib"]:::library
        LOA["Loader.Lib"]:::library
    end
    subgraph "v3.x.x/main/rewriter"
        INI["IniFileParser"]:::library
    end

    %% Executables and Modules
    subgraph "v3.x.x/main/autopatcher" 
        APX["Autopatcher"]:::executable
        ABM_AP["AssetBundleMgr"]:::module
        CFM_AP["ConfigMgr"]:::module
        LUM_AP["LuaMgr"]:::module
        PAM_AP["PathMgr"]:::module
    end

    subgraph "v3.x.x/main/cli" 
        CLX["CLI (x86)"]:::executable
        ABM_C1["AssetBundleMgr"]:::module
        CFM_C1["ConfigMgr"]:::module
        LUM_C1["LuaMgr"]:::module
        PAM_C1["PathMgr"]:::module
        OPT_C1["OptionSet"]:::module
    end

    subgraph "v3.x.x/main/cli64" 
        C6X["CLI64 (x64)"]:::executable
        ABM_C6["AssetBundleMgr"]:::module
        CFM_C6["ConfigMgr"]:::module
        LUM_C6["LuaMgr"]:::module
        PAM_C6["PathMgr"]:::module
        OPT_C6["OptionSet"]:::module
    end

    subgraph "v3.x.x/main/rewriter" 
        RWX["Rewriter"]:::executable
        SKM["SkinMgr"]:::module
        CFM_RW["Configuration"]:::module
    end

    %% Build Process
    CI -->|"builds binaries"| APX
    CI --> CLX
    CI --> C6X
    CI --> RWX

    %% Executables reference Shared Libraries
    APX -->|references| KON
    APX -->|references| LOA
    CLX -->|references| KON
    CLX -->|references| LOA
    C6X -->|references| KON
    C6X -->|references| LOA
    RWX -->|references| INI

    %% Managers and Data Flow
    APX -->|loads bundle| ABM_AP
    ABM_AP -->|uses HTTP| PS
    ABM_AP -->|writes to| PAM_AP
    ABM_AP -->|reads from| GF

    CLX --> ABM_C1
    ABM_C1 --> PS
    ABM_C1 --> PAM_C1
    ABM_C1 --> GF

    C6X --> ABM_C6
    ABM_C6 --> PS
    ABM_C6 --> PAM_C6
    ABM_C6 --> GF

    RWX --> SKM
    RWX --> CFM_RW
    CFM_RW --> INI
    SKM -->|modifies ini| INI
    RWX -->|writes to| GF

    %% Configuration and Scripting
    APX --> CFM_AP
    CFM_AP -->|reads config| GF
    APX --> LUM_AP
    LUM_AP -->|executes scripts| PY

    CLX --> CFM_C1
    CLX --> LUM_C1
    LUM_C1 --> PY
    CLX --> OPT_C1

    C6X --> CFM_C6
    C6X --> LUM_C6
    LUM_C6 --> PY
    C6X --> OPT_C6

    %% File System Paths
    APX --> PAM_AP
    CLX --> PAM_C1
    C6X --> PAM_C6

    %% Click Events
    click APX "https://github.com/n0k0m3/azur-lane-scripts-autopatcher/blob/master/v3.x.x/main/autopatcher/autopatcher.csproj"
    click CLX "https://github.com/n0k0m3/azur-lane-scripts-autopatcher/blob/master/v3.x.x/main/cli/cli.csproj"
    click C6X "https://github.com/n0k0m3/azur-lane-scripts-autopatcher/blob/master/v3.x.x/main/cli64/cli64.csproj"
    click RWX "https://github.com/n0k0m3/azur-lane-scripts-autopatcher/blob/master/v3.x.x/main/rewriter/rewriter.csproj"
    click KON "https://github.com/n0k0m3/azur-lane-scripts-autopatcher/blob/master/v3.x.x/lib/konpaku/Konpaku.csproj"
    click LOA "https://github.com/n0k0m3/azur-lane-scripts-autopatcher/blob/master/v3.x.x/lib/loader/Loader.csproj"
    click INI "https://github.com/n0k0m3/azur-lane-scripts-autopatcher/tree/master/v3.x.x/main/rewriter/IniFileParser/"
    click ABM_AP "https://github.com/n0k0m3/azur-lane-scripts-autopatcher/blob/master/v3.x.x/main/autopatcher/AssetBundleMgr.cs"
    click CFM_AP "https://github.com/n0k0m3/azur-lane-scripts-autopatcher/blob/master/v3.x.x/main/autopatcher/ConfigMgr.cs"
    click LUM_AP "https://github.com/n0k0m3/azur-lane-scripts-autopatcher/blob/master/v3.x.x/main/autopatcher/LuaMgr.cs"
    click PAM_AP "https://github.com/n0k0m3/azur-lane-scripts-autopatcher/blob/master/v3.x.x/main/autopatcher/PathMgr.cs"

    %% Styles
    classDef executable fill:#b7e4c7,stroke:#2d6a4f,color:#072a0e;
    classDef library fill:#ade8f4,stroke:#219ebc,color:#023047;
    classDef module fill:#ffc8dd,stroke:#e63946,color:#6d6875;
    classDef external fill:#ffdd94,stroke:#ee9b00,color:#663c00;
```
