# v0idzz/reemit architecture

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

- Interactive diagram: https://gitdiagram.com/v0idzz/reemit
- Repository: https://github.com/v0idzz/reemit

## Overview

##### Main Components
- Common Library: Represent “Reemit.Common” as the shared core. This module contains essential helper classes (e.g., BinaryReaderExtensions, SharedReader, etc.) that the rest of the system depends on.
- CLR Decompiler Module: Represent “Reemit.Decompiler.Clr”. This module is responsible for disassembling CLR instructions, reading metadata (including coded indexes, metadata tables, and method headers) and includes a dedicated set of unit tests. Consider highlighting subcomponents such as the “Disassembler” and “Metadata” parsers.
- PE Decompiler Module: Represent “Reemit.Decompiler.PE”. This handles PE file-specific decoding (e.g., reading the MS-DOS header, PE headers, and several enumerated types defining architecture details).
- Unified Decompiler Core: Represent “Reemit.Decompiler” as a higher-level orchestrator that uses both the CLR and the PE modules. This layer binds together lower-level routines to provide a cohesive decompilation engine.
- Testing Framework: Although not part of the runtime architecture, it is helpful to show separate test modules (e.g., Reemit.Common.UnitTests, Reemit.Decompiler.Clr.UnitTests, Reemit.Decompiler.PE.UnitTests, Reemit.Gui.UnitTests) to underline a robust testing discipline across components.

##### Relationships and Data Flow
- That the decompiler core delegates specific tasks to the CLR and PE modules according to the type of file being processed.
- That the Common Library is a dependency for both decompiler modules – hinting it sits at a lower level that provides cross-cutting functionalities.

##### Architectural Patterns and Design Principles
- Modular Design & Separation of Concerns: Emphasize that each “Reemit.*” project addresses a specific part of the overall decompilation process. This minimizes coupling while allowing each module to have its own set of unit tests.
- MVVM Pattern in the GUI: In the GUI section, note both Views (Axaml files) and ViewModels, which implies that user interaction is decoupled from business logic.

##### Relevant Technologies, Frameworks, or Libraries
- .NET (as seen through .csproj and GitHub workflows, e.g., dotnet.yml) is the primary framework.
- The project appears to target ECMA-335, so the decompilation engines handle IL, metadata, and native PE headers.
- In the GUI layer, consider that Avalonia (or similar) might be used since Axaml is evident in file names.

- Essential elements such as the layered structure and key dependencies.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        GUI["GUI Client (MVVM)"]:::gui
    end

    %% Application Layer
    subgraph "Application Layer"
        Core["Unified Decompiler Core"]:::core
    end

    %% Decompilation Services
    subgraph "Decompilation Services"
        CLR["CLR Decompiler Module"]:::service
        PE["PE Decompiler Module"]:::service
    end

    %% Infrastructure
    subgraph "Infrastructure"
        Common["Common Library"]:::library
    end

    %% Testing Modules
    subgraph "Testing"
        T_GUI["Reemit.Gui.UnitTests"]:::testing
        T_CLR["Reemit.Decompiler.Clr.UnitTests"]:::testing
        T_PE["Reemit.Decompiler.PE.UnitTests"]:::testing
        T_Common["Reemit.Common.UnitTests"]:::testing
    end

    %% Data Flow Connections
    GUI -->|"sends commands"| Core
    Core -->|"process CLR files"| CLR
    Core -->|"process PE files"| PE
    CLR -->|"returns decompiled data"| Core
    PE -->|"returns decompiled data"| Core
    Core -->|"orchestrates"| GUI

    %% Dependency Relationships
    CLR ---|"depends on"| Common
    PE ---|"depends on"| Common

    %% Testing Relationships
    T_GUI ---|"tests"| GUI
    T_CLR ---|"tests"| CLR
    T_PE ---|"tests"| PE
    T_Common ---|"tests"| Common

    %% Click Events
    click GUI "https://github.com/v0idzz/reemit/blob/main/Reemit.Gui"
    click Core "https://github.com/v0idzz/reemit/blob/main/Reemit.Decompiler"
    click CLR "https://github.com/v0idzz/reemit/blob/main/Reemit.Decompiler.Clr"
    click PE "https://github.com/v0idzz/reemit/blob/main/Reemit.Decompiler.PE"
    click Common "https://github.com/v0idzz/reemit/blob/main/Reemit.Common"
    click T_GUI "https://github.com/v0idzz/reemit/blob/main/Reemit.Gui.UnitTests"
    click T_CLR "https://github.com/v0idzz/reemit/blob/main/Reemit.Decompiler.Clr.UnitTests"
    click T_PE "https://github.com/v0idzz/reemit/blob/main/Reemit.Decompiler.PE.UnitTests"
    click T_Common "https://github.com/v0idzz/reemit/blob/main/Reemit.Common.UnitTests"

    %% Styles
    classDef gui fill:#f9e79f,stroke:#f39c12,stroke-width:2px;
    classDef core fill:#d5f5e3,stroke:#27ae60,stroke-width:2px;
    classDef service fill:#fadbd8,stroke:#c0392b,stroke-width:2px;
    classDef library fill:#d6eaf8,stroke:#3498db,stroke-width:2px;
    classDef testing fill:#f0b27a,stroke:#e67e22,stroke-width:2px,stroke-dasharray: 5 5;
```
