# shiqan/fortnitereplaydecompressor architecture

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

- Interactive diagram: https://gitdiagram.com/shiqan/fortnitereplaydecompressor
- Repository: https://github.com/shiqan/fortnitereplaydecompressor

## Overview

##### Project type and purpose
- This is primarily a C# library (distributed as the “FortniteReplayReader” NuGet package) that parses and decompresses Unreal-Engine-based Fortnite replay files.
- In addition to the core library, there are two sample console applications (BenchmarkReader and ConsoleReader) and several test projects (FortniteReplayReader.Test, OozSharp.Test, Unreal.Core.Test, Unreal.Encryption.Test).

##### File structure
- Top-level solution file: FortniteReplayDecompressor.sln
- Core libraries under src:
- Unreal.Core – low-level Unreal file/packet readers, bit/binary readers, data models
- Unreal.Encryption – encryption/decryption (Oodle wrapper)
- FortniteReplayReader – orchestrates the above three to parse Fortnite-specific replay events and build a high-level FortniteReplay model
- Sample apps:
- ConsoleReader – simple CLI showing how to call ReplayReader
- BenchmarkReader – measures performance of reading/decompressing
- Tests: one per library to validate functionality.

##### Key insights from README
- The “ReplayReader” API is the entry point (ReplayReader.ReadReplay(path))
- Requires .NET 8.0+
- Built around layering: decompress → decrypt → low-level parsing → high-level event/model assembly
- No external services; it runs entirely locally.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Clients
    subgraph "Clients"
        CR["ConsoleReader"]:::sample
        BR["BenchmarkReader"]:::sample
    end

    %% High-Level API
    subgraph "FortniteReplayReader API"
        RR["ReplayReader"]:::api
        RB["FortniteReplayBuilder"]:::api
        Ext["UIntExtensions"]:::api
        Excp["PlayerEliminationException"]:::api
    end

    %% Decompression Module
    subgraph "Decompression Module (OozSharp)"
        OS["OozSharp"]:::library
        Kr["KrakenDecoder"]:::library
        Mer["MermaidLzTable"]:::library
    end

    %% Decryption Module
    subgraph "Decryption Module (Unreal.Encryption)"
        UE["Unreal.Encryption"]:::library
        Odl["Oodle"]:::library
    end

    %% Core Parsing Module
    subgraph "Core Parsing Module (Unreal.Core)"
        UC["Unreal.Core"]:::library
        RRc["ReplayReader (Core)"]:::library
        BRdr["BitReader"]:::library
        Bin["BinaryReader"]:::library
        NBR["NetBitReader"]:::library
        NFP["NetFieldParser"]:::library
        AAttr["NetFieldExportAttribute"]:::library
    end

    %% Data Models
    subgraph "Data Models"
        DM["FortniteReplay, Events, NetFieldExports"]:::models
    end

    %% Data Flow
    CR -->|"calls ReplayReader()"| RR
    BR -->|"calls ReplayReader()"| RR
    RR -->|"decompress"| OS
    OS -->|"decompressed chunks"| UE
    UE -->|"decrypted stream"| UC
    UC -->|"parses to packets"| RRc
    RRc -->|"provides low-level objects"| RB
    RB -->|"aggregates into replay"| DM
    DM -->|"returned to client"| RR

    %% Click Events
    click CR "https://github.com/shiqan/fortnitereplaydecompressor/tree/master/src/ConsoleReader"
    click BR "https://github.com/shiqan/fortnitereplaydecompressor/tree/master/src/BenchmarkReader"
    click RR "https://github.com/shiqan/fortnitereplaydecompressor/blob/master/src/FortniteReplayReader/FortniteReplayReader.cs"
    click RB "https://github.com/shiqan/fortnitereplaydecompressor/blob/master/src/FortniteReplayReader/FortniteReplayBuilder.cs"
    click Ext "https://github.com/shiqan/fortnitereplaydecompressor/blob/master/src/FortniteReplayReader/Extensions/UIntExtensions.cs"
    click Excp "https://github.com/shiqan/fortnitereplaydecompressor/blob/master/src/FortniteReplayReader/Exceptions/PlayerEliminationException.cs"
    click DM "https://github.com/shiqan/fortnitereplaydecompressor/tree/master/src/FortniteReplayReader/Models"
    click OS "https://github.com/shiqan/fortnitereplaydecompressor/blob/master/src/OozSharp/OozSharp.csproj"
    click Kr "https://github.com/shiqan/fortnitereplaydecompressor/blob/master/src/OozSharp/KrakenDecoder.cs"
    click Mer "https://github.com/shiqan/fortnitereplaydecompressor/blob/master/src/OozSharp/MermaidLzTable.cs"
    click UE "https://github.com/shiqan/fortnitereplaydecompressor/blob/master/src/Unreal.Encryption/Unreal.Encryption.csproj"
    click Odl "https://github.com/shiqan/fortnitereplaydecompressor/blob/master/src/Unreal.Encryption/Oodle.cs"
    click UC "https://github.com/shiqan/fortnitereplaydecompressor/blob/master/src/Unreal.Core/Unreal.Core.csproj"
    click RRc "https://github.com/shiqan/fortnitereplaydecompressor/blob/master/src/Unreal.Core/ReplayReader.cs"
    click BRdr "https://github.com/shiqan/fortnitereplaydecompressor/blob/master/src/Unreal.Core/BitReader.cs"
    click Bin "https://github.com/shiqan/fortnitereplaydecompressor/blob/master/src/Unreal.Core/BinaryReader.cs"
    click NBR "https://github.com/shiqan/fortnitereplaydecompressor/blob/master/src/Unreal.Core/NetBitReader.cs"
    click NFP "https://github.com/shiqan/fortnitereplaydecompressor/blob/master/src/Unreal.Core/NetFieldParser.cs"
    click AAttr "https://github.com/shiqan/fortnitereplaydecompressor/blob/master/src/Unreal.Core/Attributes/NetFieldExportAttribute.cs"

    %% Styles
    classDef sample fill:#f96,stroke:#333,stroke-width:1px
    classDef api fill:#6f9,stroke:#333,stroke-width:1px
    classDef library fill:#9cf,stroke:#333,stroke-width:1px
    classDef models fill:#ccc,stroke:#333,stroke-width:1px
```
