# huaotem-bot/gezi-quark-downloader architecture

> Architecture diagram of the GitHub repository huaotem-bot/gezi-quark-downloader, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/huaotem-bot/gezi-quark-downloader
- Repository: https://github.com/huaotem-bot/gezi-quark-downloader

## Overview

GeZi is a Windows WPF client for Quark cloud-drive downloads. The main workflow starts in the desktop UI: users provide a share link or choose files, the app resolves file information and download links through Quark APIs, then schedules resumable segmented downloads to local files. Separate branches cover QR login and QR recognition, account management, direct-link export, and playback of partially downloaded files. The README documents several capabilities whose detailed implementation was not sampled, so those links are documented rather than source-verified.

Main entry points: [`src/GeZi/MainWindow.xaml.cs`](https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi/MainWindow.xaml.cs) (Main window), [`src/GeZi.Core/Api/LoginQrService.cs`](https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi.Core/Api/LoginQrService.cs) (QR login service), [`src/GeZi.Core/Api/QuarkClient.cs`](https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi.Core/Api/QuarkClient.cs) (Quark API client), [`src/GeZi.Core/Download/DownloadScheduler.cs`](https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi.Core/Download/DownloadScheduler.cs) (Download scheduler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop experience"]
  node_main["Main window<br/>[MainWindow.xaml.cs]"]
  node_tray["Tray controls<br/>[TrayIcon.cs]"]
  node_mini["Floating window<br/>[MiniWindow.xaml.cs]"]
  node_theme["Theme manager<br/>[ThemeManager.cs]"]
  node_scan["QR scan window<br/>[ScanQrWindow.cs]"]
end

subgraph group_quark["Quark access"]
  node_qrdecode["QR decoder<br/>[QrDecoder.cs]"]
  node_login["QR login service<br/>[LoginQrService.cs]"]
  node_pybridge["Python bridge"]
  node_api["Quark API client<br/>[QuarkClient.cs]"]
  node_session["HTTP session<br/>[QuarkSession.cs]"]
  node_shareparse["Share URL parser<br/>[ShareUrlParser.cs]"]
end

subgraph group_downloads["Download engine"]
  node_scheduler["Download scheduler"]
  node_job["Download job<br/>[DownloadJob.cs]"]
  node_segmented["Segmented downloader"]
  node_allocator["Thread allocator<br/>[ThreadAllocator.cs]"]
end

subgraph group_state["Local state"]
  node_account[("Account store<br/>[AccountStore.cs]")]
  node_history[("History store<br/>[HistoryStore.cs]")]
  node_linkcache[("Link cache<br/>[LinkCache.cs]")]
end

subgraph group_support["Playback and utilities"]
  node_export["Link exporter<br/>[LinkExporter.cs]"]
  node_player["Player launching<br/>[ShellLaunch.cs]"]
  node_playerloc["Player locator<br/>[PlayerLocator.cs]"]
end

node_user(("User"))
node_quarkservice{{"Quark cloud service"}}

node_user -->|"uses"| node_main
node_main -->|"parses links"| node_shareparse
node_main -->|"requests file links"| node_api
node_api -->|"sends requests"| node_session
node_api -->|"calls API"| node_quarkservice
node_user -->|"submits QR"| node_scan
node_scan -->|"decodes image"| node_qrdecode
node_main -.->|"starts login"| node_login
node_login -->|"uses bridge"| node_pybridge
node_login -->|"requests login"| node_quarkservice
node_main -->|"queues downloads"| node_scheduler
node_scheduler -->|"runs jobs"| node_job
node_scheduler -->|"runs downloader"| node_segmented
node_segmented -.->|"allocates threads"| node_allocator
node_main -.->|"manages accounts"| node_account
node_main -.->|"restores tasks"| node_history
node_main -->|"reuses links"| node_linkcache
node_main -->|"exports links"| node_export
node_main -->|"controls tray"| node_tray
node_tray -.->|"opens window"| node_mini
node_main -.->|"sets theme"| node_theme
node_main -->|"plays partial files"| node_player
node_player -->|"locates player"| node_playerloc

click node_main "https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi/MainWindow.xaml.cs"
click node_tray "https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi/TrayIcon.cs"
click node_mini "https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi/MiniWindow.xaml.cs"
click node_theme "https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi/ThemeManager.cs"
click node_scan "https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi/ScanQrWindow.cs"
click node_qrdecode "https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi.Core/Support/QrDecoder.cs"
click node_login "https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi.Core/Api/LoginQrService.cs"
click node_pybridge "https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi.Core/Api/QuarkPythonBridge.cs"
click node_api "https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi.Core/Api/QuarkClient.cs"
click node_session "https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi.Core/Support/QuarkSession.cs"
click node_shareparse "https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi.Core/Support/ShareUrlParser.cs"
click node_scheduler "https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi.Core/Download/DownloadScheduler.cs"
click node_job "https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi.Core/Download/DownloadJob.cs"
click node_segmented "https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi.Core/Download/SegmentedDownloader.cs"
click node_allocator "https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi.Core/Download/ThreadAllocator.cs"
click node_account "https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi/AccountStore.cs"
click node_history "https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi/HistoryStore.cs"
click node_linkcache "https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi/LinkCache.cs"
click node_export "https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi.Core/Support/LinkExporter.cs"
click node_player "https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi/ShellLaunch.cs"
click node_playerloc "https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi/PlayerLocator.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_main,node_tray,node_mini,node_theme,node_scan,node_user toneBlue
class node_qrdecode,node_login,node_pybridge,node_api,node_session,node_shareparse toneAmber
class node_scheduler,node_job,node_segmented,node_allocator toneMint
class node_account,node_history,node_linkcache toneRose
class node_export,node_player,node_playerloc,node_quarkservice toneIndigo
```

## Components

### Desktop experience

- [Main window](https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi/MainWindow.xaml.cs): `src/GeZi/MainWindow.xaml.cs`
- [Tray controls](https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi/TrayIcon.cs): `src/GeZi/TrayIcon.cs`
- [Floating window](https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi/MiniWindow.xaml.cs): `src/GeZi/MiniWindow.xaml.cs`
- [Theme manager](https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi/ThemeManager.cs): `src/GeZi/ThemeManager.cs`
- [QR scan window](https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi/ScanQrWindow.cs): `src/GeZi/ScanQrWindow.cs`

### Quark access

- [QR decoder](https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi.Core/Support/QrDecoder.cs): `src/GeZi.Core/Support/QrDecoder.cs`
- [QR login service](https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi.Core/Api/LoginQrService.cs): `src/GeZi.Core/Api/LoginQrService.cs`
- [Python bridge](https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi.Core/Api/QuarkPythonBridge.cs): `src/GeZi.Core/Api/QuarkPythonBridge.cs`
- [Quark API client](https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi.Core/Api/QuarkClient.cs): `src/GeZi.Core/Api/QuarkClient.cs`
- [HTTP session](https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi.Core/Support/QuarkSession.cs): `src/GeZi.Core/Support/QuarkSession.cs`
- [Share URL parser](https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi.Core/Support/ShareUrlParser.cs): `src/GeZi.Core/Support/ShareUrlParser.cs`

### Download engine

- [Download scheduler](https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi.Core/Download/DownloadScheduler.cs): `src/GeZi.Core/Download/DownloadScheduler.cs`
- [Download job](https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi.Core/Download/DownloadJob.cs): `src/GeZi.Core/Download/DownloadJob.cs`
- [Segmented downloader](https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi.Core/Download/SegmentedDownloader.cs): `src/GeZi.Core/Download/SegmentedDownloader.cs`
- [Thread allocator](https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi.Core/Download/ThreadAllocator.cs): `src/GeZi.Core/Download/ThreadAllocator.cs`

### Local state

- [Account store](https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi/AccountStore.cs): `src/GeZi/AccountStore.cs`
- [History store](https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi/HistoryStore.cs): `src/GeZi/HistoryStore.cs`
- [Link cache](https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi/LinkCache.cs): `src/GeZi/LinkCache.cs`

### Playback and utilities

- [Link exporter](https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi.Core/Support/LinkExporter.cs): `src/GeZi.Core/Support/LinkExporter.cs`
- [Player launching](https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi/ShellLaunch.cs): `src/GeZi/ShellLaunch.cs`
- [Player locator](https://github.com/huaotem-bot/gezi-quark-downloader/blob/main/src/GeZi/PlayerLocator.cs): `src/GeZi/PlayerLocator.cs`

### Other components

- **User**
- **Quark cloud service**

## Connections

- User → Main window: uses (evidence: `README.md`)
- Main window → Share URL parser: parses links (evidence: `src/GeZi/MainWindow.xaml.cs`)
- Main window → Quark API client: requests file links (evidence: `src/GeZi/MainWindow.xaml.cs`)
- Quark API client → HTTP session: sends requests (evidence: `src/GeZi.Core/Api/QuarkClient.cs`)
- Quark API client → Quark cloud service: calls API (evidence: `README.md`)
- User → QR scan window: submits QR (evidence: `README.md`)
- QR scan window → QR decoder: decodes image (evidence: `src/GeZi/ScanQrWindow.cs`)
- Main window → QR login service: starts login (evidence: `README.md`)
- QR login service → Python bridge: uses bridge (evidence: `src/GeZi.Core/Api/LoginQrService.cs`)
- QR login service → Quark cloud service: requests login (evidence: `README.md`)
- Main window → Download scheduler: queues downloads (evidence: `src/GeZi/MainWindow.xaml.cs`)
- Download scheduler → Download job: runs jobs (evidence: `src/GeZi.Core/Download/DownloadScheduler.cs`)
- Download scheduler → Segmented downloader: runs downloader (evidence: `src/GeZi.Core/Download/DownloadScheduler.cs`)
- Segmented downloader → Thread allocator: allocates threads
- Main window → Account store: manages accounts (evidence: `README.md`)
- Main window → History store: restores tasks (evidence: `README.md`)
- Main window → Link cache: reuses links (evidence: `src/GeZi/MainWindow.xaml.cs`)
- Main window → Link exporter: exports links (evidence: `src/GeZi/MainWindow.xaml.cs`)
- Main window → Tray controls: controls tray (evidence: `src/GeZi/MainWindow.xaml.cs`)
- Tray controls → Floating window: opens window (evidence: `README.md`)
- Main window → Theme manager: sets theme (evidence: `README.md`)
- Main window → Player launching: plays partial files (evidence: `README.md`)
- Player launching → Player locator: locates player (evidence: `src/GeZi/ShellLaunch.cs`)
