# rahmaaref/fatfilesystemsimulator architecture

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

- Interactive diagram: https://gitdiagram.com/rahmaaref/fatfilesystemsimulator
- Repository: https://github.com/rahmaaref/fatfilesystemsimulator

## Overview

This is a C# FAT-style file-system simulator. The principal workflow starts with a user issuing shell commands, which route file operations through FileManager and directory operations through DirectoryManager; those managers use FAT cluster chains and VirtualDisk to persist data. Directory entries encode file and directory metadata, while FSConstants defines the layout. Program initializes the disk and assembles the runtime. The README documents superblock management and FAT persistence; excerpts do not show their full startup or shutdown wiring.

Main entry points: [`VirtualDisk.cs`](https://github.com/rahmaaref/fatfilesystemsimulator/blob/main/VirtualDisk.cs) (Virtual disk), [`Shell.cs`](https://github.com/rahmaaref/fatfilesystemsimulator/blob/main/Shell.cs) (Command shell), [`Directory.cs`](https://github.com/rahmaaref/fatfilesystemsimulator/blob/main/Directory.cs) (Directory manager), [`FatTableManager.cs`](https://github.com/rahmaaref/fatfilesystemsimulator/blob/main/FatTableManager.cs) (FAT manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["Command interface"]
  node_program["Runtime startup<br/>[Program.cs]"]
  node_shell["Command shell<br/>[Shell.cs]"]
end

subgraph group_management["File and directory management"]
  node_files["File manager<br/>[FileManager.cs]"]
  node_directories["Directory manager<br/>[Directory.cs]"]
  node_entries["Directory entries<br/>[DirectoryEntry.cs]"]
end

subgraph group_layout["Filesystem layout"]
  node_fat["FAT manager<br/>[FatTableManager.cs]"]
  node_constants["Filesystem constants<br/>[FSConstants.cs]"]
  node_superblock["Superblock manager"]
end

subgraph group_storage["Disk storage"]
  node_disk[("Virtual disk<br/>[VirtualDisk.cs]")]
  node_image["Disk image"]
end

node_user(("User"))

node_user -->|"enters commands"| node_shell
node_program -->|"initializes"| node_disk
node_program -->|"starts"| node_shell
node_shell -->|"dispatches file commands"| node_files
node_shell -->|"calls directory operations"| node_directories
node_shell -->|"flushes FAT"| node_fat
node_shell -->|"writes directory data"| node_disk
node_files -->|"looks up and updates entries"| node_directories
node_files -->|"allocates and follows chains"| node_fat
node_files -->|"reads and writes clusters"| node_disk
node_directories -->|"follows and allocates chains"| node_fat
node_directories -->|"reads and writes clusters"| node_disk
node_directories -->|"serializes entries"| node_entries
node_fat -->|"loads and flushes FAT"| node_disk
node_fat -->|"uses layout values"| node_constants
node_superblock -->|"reads and writes cluster"| node_disk
node_disk -->|"persists binary data"| node_image

click node_program "https://github.com/rahmaaref/fatfilesystemsimulator/blob/main/Program.cs"
click node_shell "https://github.com/rahmaaref/fatfilesystemsimulator/blob/main/Shell.cs"
click node_files "https://github.com/rahmaaref/fatfilesystemsimulator/blob/main/FileManager.cs"
click node_directories "https://github.com/rahmaaref/fatfilesystemsimulator/blob/main/Directory.cs"
click node_entries "https://github.com/rahmaaref/fatfilesystemsimulator/blob/main/DirectoryEntry.cs"
click node_fat "https://github.com/rahmaaref/fatfilesystemsimulator/blob/main/FatTableManager.cs"
click node_constants "https://github.com/rahmaaref/fatfilesystemsimulator/blob/main/FSConstants.cs"
click node_superblock "https://github.com/rahmaaref/fatfilesystemsimulator/blob/main/SuperblockManager.cs"
click node_disk "https://github.com/rahmaaref/fatfilesystemsimulator/blob/main/VirtualDisk.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_program,node_shell,node_user toneBlue
class node_files,node_directories,node_entries toneAmber
class node_fat,node_constants,node_superblock toneMint
class node_disk,node_image toneRose
```

## Components

### Command interface

- [Runtime startup](https://github.com/rahmaaref/fatfilesystemsimulator/blob/main/Program.cs): `Program.cs`
- [Command shell](https://github.com/rahmaaref/fatfilesystemsimulator/blob/main/Shell.cs): `Shell.cs`

### File and directory management

- [File manager](https://github.com/rahmaaref/fatfilesystemsimulator/blob/main/FileManager.cs): `FileManager.cs`
- [Directory manager](https://github.com/rahmaaref/fatfilesystemsimulator/blob/main/Directory.cs): `Directory.cs`
- [Directory entries](https://github.com/rahmaaref/fatfilesystemsimulator/blob/main/DirectoryEntry.cs): `DirectoryEntry.cs`

### Filesystem layout

- [FAT manager](https://github.com/rahmaaref/fatfilesystemsimulator/blob/main/FatTableManager.cs): `FatTableManager.cs`
- [Filesystem constants](https://github.com/rahmaaref/fatfilesystemsimulator/blob/main/FSConstants.cs): `FSConstants.cs`
- [Superblock manager](https://github.com/rahmaaref/fatfilesystemsimulator/blob/main/SuperblockManager.cs): `SuperblockManager.cs`

### Disk storage

- [Virtual disk](https://github.com/rahmaaref/fatfilesystemsimulator/blob/main/VirtualDisk.cs): `VirtualDisk.cs`
- **Disk image**

### Other components

- **User**

## Connections

- User → Command shell: enters commands (evidence: `README.md`)
- Runtime startup → Virtual disk: initializes (evidence: `Program.cs`)
- Runtime startup → Command shell: starts (evidence: `Program.cs`)
- Command shell → File manager: dispatches file commands (evidence: `Shell.cs`)
- Command shell → Directory manager: calls directory operations (evidence: `Shell.cs`)
- Command shell → FAT manager: flushes FAT (evidence: `Shell.cs`)
- Command shell → Virtual disk: writes directory data (evidence: `Shell.cs`)
- File manager → Directory manager: looks up and updates entries (evidence: `FileManager.cs`)
- File manager → FAT manager: allocates and follows chains (evidence: `FileManager.cs`)
- File manager → Virtual disk: reads and writes clusters (evidence: `FileManager.cs`)
- Directory manager → FAT manager: follows and allocates chains (evidence: `Directory.cs`)
- Directory manager → Virtual disk: reads and writes clusters (evidence: `Directory.cs`)
- Directory manager → Directory entries: serializes entries (evidence: `Directory.cs`)
- FAT manager → Virtual disk: loads and flushes FAT (evidence: `FatTableManager.cs`)
- FAT manager → Filesystem constants: uses layout values (evidence: `FatTableManager.cs`)
- Superblock manager → Virtual disk: reads and writes cluster (evidence: `SuperblockManager.cs`)
- Virtual disk → Disk image: persists binary data (evidence: `README.md`)
