# t-1f9c0/storedownloader architecture

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

- Interactive diagram: https://gitdiagram.com/t-1f9c0/storedownloader
- Repository: https://github.com/t-1f9c0/storedownloader

## Overview

##### Project Type and Purpose
- This is a .NET solution (StoreDownloader.sln) composed of class-library projects that together implement a low-level “Microsoft Store” / UUP downloader.

##### Top-Level Components (based on the file tree)
a. Cabinet (src/Cabinet)
– Handles .CAB archive extraction (LZX decoder, stream extensions, structures).
b. CompDB (src/CompDB)
– Parses and models the “Composition Database” (XML metadata for packages).
c. StoreDownloader (src/StoreDownloader)
– Orchestrator API (MSStoreDownloader) for downloading Store app packages.
d. UnifiedUpdatePlatform.Services.WindowsUpdate (src/...WindowsUpdate + ...WindowsUpdate.Downloads)
– Fetches metadata from Windows Update (BuildFetcher, CTAC, ESRP decryptor, correlation IDs).
– Contains HTTP downloader helpers to retrieve individual payloads.
e. internal-sample
– Example usage showing how to wire up the StoreDownloader library.

##### Key Architectural Patterns
- Layered modules:
- Metadata fetch (WindowsUpdate service) → Package orchestration (StoreDownloader) → Payload download (HTTPDownloader) → Archive extraction (Cabinet) → Metadata parsing (CompDB).
- Separation of concerns: each library project addresses one domain.
- Dependency injection or composition: higher layers depend on abstractions (e.g., HTTPDownloader implements an IDownloader used by StoreDownloader).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Consumer
    Consumer["Consumer / Sample"]:::consumer
    %% Orchestrator Services
    StoreDownloader["MSStoreDownloader (Orchestrator API)"]:::orchestrator
    WindowsUpdate["WindowsUpdate Metadata Service"]:::orchestrator
    %% Library Modules
    HTTPDownloader["HTTPDownloader Module"]:::library
    CabinetExtractor["Cabinet Extractor Module"]:::library
    CompDBParser["CompDB Parser Module"]:::library
    %% Output
    Output["ApplicationFile[] Output"]:::output

    %% Connections
    Consumer -->|"calls API"| StoreDownloader
    StoreDownloader -->|"fetch metadata"| WindowsUpdate
    WindowsUpdate -->|"returns metadata"| StoreDownloader
    StoreDownloader -->|"payload URLs"| HTTPDownloader
    HTTPDownloader -->|".cab streams"| CabinetExtractor
    CabinetExtractor -->|"extracted files"| CompDBParser
    CompDBParser -->|"ApplicationFile[]"| StoreDownloader
    StoreDownloader -->|"ApplicationFile[]"| Consumer

    %% Click Events
    click Consumer "https://github.com/t-1f9c0/storedownloader/blob/main/internal-sample/CTRDownloader.cs"
    click StoreDownloader "https://github.com/t-1f9c0/storedownloader/blob/main/src/StoreDownloader/MSStoreDownloader.cs"
    click WindowsUpdate "https://github.com/t-1f9c0/storedownloader/blob/main/src/UnifiedUpdatePlatform.Services.WindowsUpdate/BuildFetcher.cs"
    click HTTPDownloader "https://github.com/t-1f9c0/storedownloader/blob/main/src/UnifiedUpdatePlatform.Services.WindowsUpdate.Downloads/HttpDownloader.cs"
    click CabinetExtractor "https://github.com/t-1f9c0/storedownloader/blob/main/src/Cabinet/CabinetExtractor.cs"
    click CompDBParser "https://github.com/t-1f9c0/storedownloader/blob/main/src/CompDB/UnifiedUpdatePlatform.Services.Composition.Database.csproj"

    %% Styles
    classDef library fill:#add8e6,stroke:#000,stroke-width:1px
    classDef orchestrator fill:#90ee90,stroke:#000,stroke-width:1px
    classDef consumer fill:#ffa500,stroke:#000,stroke-width:1px
    classDef output fill:#f0e68c,stroke:#000,stroke-width:1px
```
