# peresew3734/wand-enhancer-source architecture

> Architecture diagram of the GitHub repository peresew3734/wand-enhancer-source, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/peresew3734/wand-enhancer-source
- Repository: https://github.com/peresew3734/wand-enhancer-source

## Overview

WandEnhancer is a Windows desktop patcher for the local Wand client, with an optional phone-accessible web panel. The desktop flow selects or discovers an installation, applies configured archive and client patches, and can monitor Squirrel updates to reapply them. The panel serves a browser UI over LAN HTTP/WebSocket and exposes remote trainer controls. The graph combines explicit README capabilities with sampled call relationships and SOURCE INDEX references; unsampled implementation details are represented only at supported directory level.

Main entry points: [`WandEnhancer/Core/Enhancer.cs`](https://github.com/peresew3734/wand-enhancer-source/blob/main/WandEnhancer/Core/Enhancer.cs) (Patch orchestration), [`web-panel/bridge/src/server.ts`](https://github.com/peresew3734/wand-enhancer-source/blob/main/web-panel/bridge/src/server.ts) (LAN bridge server), [`web-panel/src/app/app.tsx`](https://github.com/peresew3734/wand-enhancer-source/blob/main/web-panel/src/app/app.tsx) (Web panel app), [`WandEnhancer/View/MainWindow/MainWindowVm.cs`](https://github.com/peresew3734/wand-enhancer-source/blob/main/WandEnhancer/View/MainWindow/MainWindowVm.cs) (Desktop UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop patcher"]
  node_ui["Desktop UI<br/>[MainWindowVm.cs]"]
  node_startup["Application startup<br/>[Program.cs]"]
  node_discovery["Install discovery<br/>[WeModInstalls.cs]"]
  node_watcher["Update watcher"]
end

subgraph group_patching["Patch pipeline"]
  node_enhancer["Patch orchestration<br/>[Enhancer.cs]"]
  node_archive["ASAR archive tools<br/>[AsarExtractor.cs]"]
  node_asarcreate["Archive creation<br/>[AsarCreator.cs]"]
  node_content["Client content patches"]
  node_scripts["Renderer injection"]
  node_strategies["Patch strategies<br/>[StrategyFactory.cs]"]
  node_deployment["Launcher deployment"]
  node_asar_integrity["Archive integrity<br/>[IntegrityHelper.cs]"]
  node_pickle["Pickle encoding<br/>[Pickle.cs]"]
end

subgraph group_panel["Remote panel"]
  node_server["LAN bridge server<br/>[server.ts]"]
  node_router["Protocol routing<br/>[protocol-router.ts]"]
  node_messages["Wire protocol<br/>[messages.ts]"]
  node_normalizers["Data normalization<br/>[index.ts]"]
  node_bridge_runtime["Bridge runtime<br/>[runtime.ts]"]
end

subgraph group_web["Panel experience"]
  node_webapp["Web panel app<br/>[app.tsx]"]
  node_session["Remote session client"]
  node_trainer["Trainer controls<br/>[CheatControl.tsx]"]
  node_library["Game library<br/>[games.ts]"]
end

subgraph group_state["Configuration and state"]
  node_settings["Settings service<br/>[SettingsManager.cs]"]
  node_config["Patch configuration<br/>[PatchConfig.cs]"]
  node_browser_state[("Browser preferences<br/>[storage.ts]")]
end

node_user(("Desktop user"))
node_phone(("Phone browser"))
node_wand["Local Wand client"]

node_user -->|"configures patch"| node_ui
node_ui -->|"selects install"| node_discovery
node_startup -->|"launches patch"| node_enhancer
node_startup -->|"starts watcher"| node_watcher
node_watcher -->|"reapplies patch"| node_enhancer
node_discovery -->|"provides install"| node_enhancer
node_enhancer -->|"extracts archive"| node_archive
node_enhancer -->|"patches content"| node_content
node_enhancer -->|"injects scripts"| node_scripts
node_enhancer -->|"selects strategy"| node_strategies
node_enhancer -->|"deploys launcher"| node_deployment
node_enhancer -.->|"packs archive"| node_asarcreate
node_archive -->|"checks integrity"| node_asar_integrity
node_archive -->|"encodes metadata"| node_pickle
node_settings -->|"loads config"| node_config
node_ui -->|"loads preferences"| node_settings
node_phone -->|"opens panel"| node_server
node_server -->|"routes messages"| node_router
node_router -->|"validates protocol"| node_messages
node_server -->|"normalizes results"| node_normalizers
node_server -.->|"uses runtime"| node_bridge_runtime
node_webapp -->|"connects session"| node_session
node_session -.->|"exchanges messages"| node_server
node_session -->|"uses message types"| node_messages
node_webapp -.->|"renders controls"| node_trainer
node_webapp -.->|"shows games"| node_library
node_webapp -.->|"saves preferences"| node_browser_state
node_scripts -->|"enables panel bridge"| node_server
node_server -->|"controls client"| node_wand
node_user -->|"customizes locally"| node_wand

click node_ui "https://github.com/peresew3734/wand-enhancer-source/blob/main/WandEnhancer/View/MainWindow/MainWindowVm.cs"
click node_startup "https://github.com/peresew3734/wand-enhancer-source/blob/main/WandEnhancer/Program.cs"
click node_discovery "https://github.com/peresew3734/wand-enhancer-source/blob/main/WandEnhancer/Utils/WeModInstalls.cs"
click node_enhancer "https://github.com/peresew3734/wand-enhancer-source/blob/main/WandEnhancer/Core/Enhancer.cs"
click node_settings "https://github.com/peresew3734/wand-enhancer-source/blob/main/WandEnhancer/Core/Services/SettingsManager.cs"
click node_config "https://github.com/peresew3734/wand-enhancer-source/blob/main/WandEnhancer/Models/PatchConfig.cs"
click node_archive "https://github.com/peresew3734/wand-enhancer-source/blob/main/AsarSharp/AsarExtractor.cs"
click node_asarcreate "https://github.com/peresew3734/wand-enhancer-source/blob/main/AsarSharp/AsarCreator.cs"
click node_content "https://github.com/peresew3734/wand-enhancer-source/blob/main/WandEnhancer/Core/Patching/Content/AsarContentPatcher.cs"
click node_scripts "https://github.com/peresew3734/wand-enhancer-source/blob/main/WandEnhancer/Core/Patching/Content/RemotePanelInjector.cs"
click node_strategies "https://github.com/peresew3734/wand-enhancer-source/blob/main/WandEnhancer/Core/Patching/Strategies/StrategyFactory.cs"
click node_deployment "https://github.com/peresew3734/wand-enhancer-source/blob/main/WandEnhancer/Core/Patching/Shared/LauncherDeployment.cs"
click node_watcher "https://github.com/peresew3734/wand-enhancer-source/blob/main/WandEnhancer/Core/Services/UpdateWatcherService.cs"
click node_server "https://github.com/peresew3734/wand-enhancer-source/blob/main/web-panel/bridge/src/server.ts"
click node_router "https://github.com/peresew3734/wand-enhancer-source/blob/main/web-panel/bridge/src/protocol-router.ts"
click node_messages "https://github.com/peresew3734/wand-enhancer-source/blob/main/web-panel/protocol/messages.ts"
click node_normalizers "https://github.com/peresew3734/wand-enhancer-source/blob/main/web-panel/bridge/src/normalizers/index.ts"
click node_bridge_runtime "https://github.com/peresew3734/wand-enhancer-source/blob/main/web-panel/bridge/src/runtime.ts"
click node_webapp "https://github.com/peresew3734/wand-enhancer-source/blob/main/web-panel/src/app/app.tsx"
click node_session "https://github.com/peresew3734/wand-enhancer-source/blob/main/web-panel/src/remote-session/remote-session.client.ts"
click node_trainer "https://github.com/peresew3734/wand-enhancer-source/blob/main/web-panel/src/trainer/controls/CheatControl.tsx"
click node_library "https://github.com/peresew3734/wand-enhancer-source/blob/main/web-panel/src/library/model/games.ts"
click node_browser_state "https://github.com/peresew3734/wand-enhancer-source/blob/main/web-panel/src/shared/storage.ts"
click node_asar_integrity "https://github.com/peresew3734/wand-enhancer-source/blob/main/AsarSharp/Integrity/IntegrityHelper.cs"
click node_pickle "https://github.com/peresew3734/wand-enhancer-source/blob/main/AsarSharp/PickleTools/Pickle.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_ui,node_startup,node_discovery,node_watcher,node_user,node_phone,node_wand toneBlue
class node_enhancer,node_archive,node_asarcreate,node_content,node_scripts,node_strategies,node_deployment,node_asar_integrity,node_pickle toneAmber
class node_server,node_router,node_messages,node_normalizers,node_bridge_runtime toneMint
class node_webapp,node_session,node_trainer,node_library toneRose
class node_settings,node_config,node_browser_state toneIndigo
```

## Components

### Desktop patcher

- [Desktop UI](https://github.com/peresew3734/wand-enhancer-source/blob/main/WandEnhancer/View/MainWindow/MainWindowVm.cs): `WandEnhancer/View/MainWindow/MainWindowVm.cs`
- [Application startup](https://github.com/peresew3734/wand-enhancer-source/blob/main/WandEnhancer/Program.cs): `WandEnhancer/Program.cs`
- [Install discovery](https://github.com/peresew3734/wand-enhancer-source/blob/main/WandEnhancer/Utils/WeModInstalls.cs): `WandEnhancer/Utils/WeModInstalls.cs`
- [Update watcher](https://github.com/peresew3734/wand-enhancer-source/blob/main/WandEnhancer/Core/Services/UpdateWatcherService.cs): `WandEnhancer/Core/Services/UpdateWatcherService.cs`

### Patch pipeline

- [Patch orchestration](https://github.com/peresew3734/wand-enhancer-source/blob/main/WandEnhancer/Core/Enhancer.cs): `WandEnhancer/Core/Enhancer.cs`
- [ASAR archive tools](https://github.com/peresew3734/wand-enhancer-source/blob/main/AsarSharp/AsarExtractor.cs): `AsarSharp/AsarExtractor.cs`
- [Archive creation](https://github.com/peresew3734/wand-enhancer-source/blob/main/AsarSharp/AsarCreator.cs): `AsarSharp/AsarCreator.cs`
- [Client content patches](https://github.com/peresew3734/wand-enhancer-source/blob/main/WandEnhancer/Core/Patching/Content/AsarContentPatcher.cs): `WandEnhancer/Core/Patching/Content/AsarContentPatcher.cs`
- [Renderer injection](https://github.com/peresew3734/wand-enhancer-source/blob/main/WandEnhancer/Core/Patching/Content/RemotePanelInjector.cs): `WandEnhancer/Core/Patching/Content/RemotePanelInjector.cs`
- [Patch strategies](https://github.com/peresew3734/wand-enhancer-source/blob/main/WandEnhancer/Core/Patching/Strategies/StrategyFactory.cs): `WandEnhancer/Core/Patching/Strategies/StrategyFactory.cs`
- [Launcher deployment](https://github.com/peresew3734/wand-enhancer-source/blob/main/WandEnhancer/Core/Patching/Shared/LauncherDeployment.cs): `WandEnhancer/Core/Patching/Shared/LauncherDeployment.cs`
- [Archive integrity](https://github.com/peresew3734/wand-enhancer-source/blob/main/AsarSharp/Integrity/IntegrityHelper.cs): `AsarSharp/Integrity/IntegrityHelper.cs`
- [Pickle encoding](https://github.com/peresew3734/wand-enhancer-source/blob/main/AsarSharp/PickleTools/Pickle.cs): `AsarSharp/PickleTools/Pickle.cs`

### Remote panel

- [LAN bridge server](https://github.com/peresew3734/wand-enhancer-source/blob/main/web-panel/bridge/src/server.ts): `web-panel/bridge/src/server.ts`
- [Protocol routing](https://github.com/peresew3734/wand-enhancer-source/blob/main/web-panel/bridge/src/protocol-router.ts): `web-panel/bridge/src/protocol-router.ts`
- [Wire protocol](https://github.com/peresew3734/wand-enhancer-source/blob/main/web-panel/protocol/messages.ts): `web-panel/protocol/messages.ts`
- [Data normalization](https://github.com/peresew3734/wand-enhancer-source/blob/main/web-panel/bridge/src/normalizers/index.ts): `web-panel/bridge/src/normalizers/index.ts`
- [Bridge runtime](https://github.com/peresew3734/wand-enhancer-source/blob/main/web-panel/bridge/src/runtime.ts): `web-panel/bridge/src/runtime.ts`

### Panel experience

- [Web panel app](https://github.com/peresew3734/wand-enhancer-source/blob/main/web-panel/src/app/app.tsx): `web-panel/src/app/app.tsx`
- [Remote session client](https://github.com/peresew3734/wand-enhancer-source/blob/main/web-panel/src/remote-session/remote-session.client.ts): `web-panel/src/remote-session/remote-session.client.ts`
- [Trainer controls](https://github.com/peresew3734/wand-enhancer-source/blob/main/web-panel/src/trainer/controls/CheatControl.tsx): `web-panel/src/trainer/controls/CheatControl.tsx`
- [Game library](https://github.com/peresew3734/wand-enhancer-source/blob/main/web-panel/src/library/model/games.ts): `web-panel/src/library/model/games.ts`

### Configuration and state

- [Settings service](https://github.com/peresew3734/wand-enhancer-source/blob/main/WandEnhancer/Core/Services/SettingsManager.cs): `WandEnhancer/Core/Services/SettingsManager.cs`
- [Patch configuration](https://github.com/peresew3734/wand-enhancer-source/blob/main/WandEnhancer/Models/PatchConfig.cs): `WandEnhancer/Models/PatchConfig.cs`
- [Browser preferences](https://github.com/peresew3734/wand-enhancer-source/blob/main/web-panel/src/shared/storage.ts): `web-panel/src/shared/storage.ts`

### Other components

- **Desktop user**
- **Phone browser**
- **Local Wand client**

## Connections

- Desktop user → Desktop UI: configures patch (evidence: `README.md`)
- Desktop UI → Install discovery: selects install (evidence: `WandEnhancer/View/MainWindow/MainWindowVm.cs`)
- Application startup → Patch orchestration: launches patch (evidence: `WandEnhancer/Program.cs`)
- Application startup → Update watcher: starts watcher (evidence: `WandEnhancer/Program.cs`)
- Update watcher → Patch orchestration: reapplies patch (evidence: `WandEnhancer/Core/Services/UpdateWatcherService.cs`)
- Install discovery → Patch orchestration: provides install (evidence: `WandEnhancer/View/MainWindow/MainWindowVm.cs`)
- Patch orchestration → ASAR archive tools: extracts archive (evidence: `WandEnhancer/Core/Enhancer.cs`)
- Patch orchestration → Client content patches: patches content (evidence: `WandEnhancer/Core/Enhancer.cs`)
- Patch orchestration → Renderer injection: injects scripts (evidence: `WandEnhancer/Core/Enhancer.cs`)
- Patch orchestration → Patch strategies: selects strategy (evidence: `WandEnhancer/Core/Enhancer.cs`)
- Patch orchestration → Launcher deployment: deploys launcher (evidence: `WandEnhancer/Core/Enhancer.cs`)
- Patch orchestration → Archive creation: packs archive (evidence: `WandEnhancer/Core/Enhancer.cs`)
- ASAR archive tools → Archive integrity: checks integrity
- ASAR archive tools → Pickle encoding: encodes metadata
- Settings service → Patch configuration: loads config (evidence: `WandEnhancer/Core/Services/SettingsManager.cs`)
- Desktop UI → Settings service: loads preferences (evidence: `WandEnhancer/View/MainWindow/MainWindowVm.cs`)
- Phone browser → LAN bridge server: opens panel (evidence: `README.md`)
- LAN bridge server → Protocol routing: routes messages (evidence: `web-panel/bridge/src/server.ts`)
- Protocol routing → Wire protocol: validates protocol (evidence: `web-panel/bridge/src/protocol-router.ts`)
- LAN bridge server → Data normalization: normalizes results (evidence: `web-panel/bridge/src/server.ts`)
- LAN bridge server → Bridge runtime: uses runtime
- Web panel app → Remote session client: connects session (evidence: `web-panel/src/app/app.tsx`)
- Remote session client → LAN bridge server: exchanges messages
- Remote session client → Wire protocol: uses message types (evidence: `web-panel/src/remote-session/remote-session.client.ts`)
- Web panel app → Trainer controls: renders controls
- Web panel app → Game library: shows games
- Web panel app → Browser preferences: saves preferences
- Renderer injection → LAN bridge server: enables panel bridge (evidence: `README.md`)
- LAN bridge server → Local Wand client: controls client (evidence: `README.md`)
- Desktop user → Local Wand client: customizes locally (evidence: `README.md`)
