# tcnoco/tcno-acc-switcher architecture

> Architecture diagram of the GitHub repository tcnoco/tcno-acc-switcher, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tcnoco/tcno-acc-switcher
- Repository: https://github.com/tcnoco/tcno-acc-switcher

## Overview

##### Project type and purpose
- This is a full-stack, multi-process desktop application whose primary function is to let users switch between game platform accounts by swapping files and registry keys.
- It combines native C++ installers and wrappers, .NET WPF desktop front-ends (Client, Tray, Updater), an ASP.NET Core Razor Pages “local server” for UI and logic, and a shared C# library for file/registry operations. External web APIs (GitHub releases, tcno.co version/update endpoints) and packaging scripts (NSIS, NodeJS) complete the ecosystem.

##### File-structure breakdown
- Installer (C++ Win32) – Installer.cpp, progress_bar.cpp, runtime checks
- TcNo-Acc-Switcher-Globals (C# .DLL) – file/registry/process helpers, logging, localization
- TcNo-Acc-Switcher-Server (ASP.NET Core Razor) – Program.cs, Startup.cs, Pages/, Shared/, Data/, wwwroot/ (static assets & themes)
- TcNo-Acc-Switcher-Client (WPF + CefSharp) – App.xaml, MainWindow.xaml, CefHandlers.cs
- TcNo-Acc-Switcher-Tray (C# console/tray) – Program.cs, Resources
- TcNo-Acc-Switcher-Updater (WPF) – App.xaml, MainWindow.xaml, Logger.cs
- _Updater_Wrapper (C++ native) – elevates & applies binary patches
- runas (C# helper) – elevates file/registry commands
- other/NSIS + other package scripts (NodeJS) – packaging, FTP upload
- other/tcno.co/api (PHP) – remote version & update endpoints

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Installation"
        Installer["Installer (C++ Win32)"]:::native
    end
    AppFolder["Application Folder"]:::storage
    Installer -->|"installs binaries, fonts, registers protocol & firewall"| AppFolder

    subgraph "Runtime"
        subgraph "Presentation Layer"
            Client["Client UI (WPF + CefSharp)"]:::ui
            Tray["Tray App (C# console/tray)"]:::ui
            UpdaterUI["Updater App (WPF)"]:::ui
        end
        Server["Local Server (ASP.NET Core Razor Pages)"]:::backend
        Globals["Shared Library (Globals .DLL)"]:::backend
        RunAs["RunAs Helper (C#)"]:::native
        SystemOps["File/Registry Operations"]:::storage

        AppFolder --> Client
        Client -->|"HTTP localhost:port"| Server
        Tray -->|"HTTP API"| Server
        Server -->|"invokes"| Globals
        Globals -->|"calls"| RunAs
        RunAs -->|"performs"| SystemOps
    end

    subgraph "Update"
        GitHub["GitHub Releases"]:::external
        TcnoAPI["tcno.co API"]:::external
        UpdaterUI -->|"HTTP GET"| GitHub
        UpdaterUI -->|"HTTP GET"| TcnoAPI
        UpdaterUI -->|"downloads patch"| UpdaterWrapper["Updater Wrapper (C++ native)"]:::native
        UpdaterWrapper -->|"elevated replace"| AppFolder
    end

    subgraph "Packaging & External"
        Packaging["Packaging Scripts (NSIS, NodeJS)"]:::external
        Crowdin["Crowdin"]:::external
        Packaging -->|"build & bundle"| Installer
        Packaging -->|"CI/CD pipeline"| Installer
        Crowdin -->|"localization resources"| Globals
    end

    %% Click Events
    click Installer "https://github.com/tcnoco/tcno-acc-switcher/tree/master/Installer/"
    click Server "https://github.com/tcnoco/tcno-acc-switcher/tree/master/TcNo-Acc-Switcher-Server/"
    click Globals "https://github.com/tcnoco/tcno-acc-switcher/tree/master/TcNo-Acc-Switcher-Globals/"
    click Client "https://github.com/tcnoco/tcno-acc-switcher/tree/master/TcNo-Acc-Switcher-Client/"
    click Tray "https://github.com/tcnoco/tcno-acc-switcher/tree/master/TcNo-Acc-Switcher-Tray/"
    click UpdaterUI "https://github.com/tcnoco/tcno-acc-switcher/tree/master/TcNo-Acc-Switcher-Updater/"
    click UpdaterWrapper "https://github.com/tcnoco/tcno-acc-switcher/tree/master/_Updater_Wrapper/"
    click RunAs "https://github.com/tcnoco/tcno-acc-switcher/tree/master/runas/"
    click Packaging "https://github.com/tcnoco/tcno-acc-switcher/tree/master/other/"
    click TcnoAPI "https://github.com/tcnoco/tcno-acc-switcher/tree/master/other/tcno.co/api/"

    %% Styles
    classDef ui fill:#D0E8FF,stroke:#003366,stroke-width:2px
    classDef backend fill:#DFF0D8,stroke:#336600,stroke-width:2px
    classDef native fill:#FFE5CC,stroke:#CC6600,stroke-width:2px
    classDef external fill:#F2F2F2,stroke:#666666,stroke-width:2px
    classDef storage fill:#F5F5F5,stroke:#999999,stroke-width:2px
```
