# fruit32820/mcnbtviewer architecture

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

- Interactive diagram: https://gitdiagram.com/fruit32820/mcnbtviewer
- Repository: https://github.com/fruit32820/mcnbtviewer

## Overview

MCNbtViewer is a Java/Bedrock Minecraft NBT viewer and editor with a GUI frontend and CLI backend. The GUI selects an NBT file, invokes the CLI to produce annotated JSON, builds an editable tree, and can send edited JSON back for writing. The CLI also exposes read, write, and help commands for standalone use. The graph includes the documented format and editing capabilities; unsampled GUI navigation and settings internals are shown without inferred call relationships.

Main entry points: [`CLI/Program.cs`](https://github.com/fruit32820/mcnbtviewer/blob/main/CLI/Program.cs) (CLI entry point), [`CLI/Services/Read.cs`](https://github.com/fruit32820/mcnbtviewer/blob/main/CLI/Services/Read.cs) (Read command), [`CLI/Services/Write.cs`](https://github.com/fruit32820/mcnbtviewer/blob/main/CLI/Services/Write.cs) (Write command), [`GUI/Pages/EditPage.xaml.cs`](https://github.com/fruit32820/mcnbtviewer/blob/main/GUI/Pages/EditPage.xaml.cs) (Edit page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gui["GUI"]
  node_home["Home page<br/>[HomePage.xaml.cs]"]
  node_file_select["File selector"]
  node_settings["Settings page"]
  node_app_config["App config<br/>[AppConfig.cs]"]
end

subgraph group_editor["NBT editor"]
  node_edit_page["Edit page<br/>[EditPage.xaml.cs]"]
  node_tree_parser["JSON tree parser"]
  node_tree_model["Tree item model<br/>[JsonTreeItem.cs]"]
end

subgraph group_cli["CLI backend"]
  node_cli_bridge["CLI bridge<br/>[CliHelper.cs]"]
  node_cli_entry["CLI entry point<br/>[Program.cs]"]
  node_arg_parser["Argument parser<br/>[Helper.cs]"]
  node_read_command["Read command<br/>[Read.cs]"]
  node_write_command["Write command<br/>[Write.cs]"]
  node_help_command["Help command<br/>[Help.cs]"]
end

subgraph group_format["NBT conversion"]
  node_nbt_io["NBT file I/O<br/>[NbtIO.cs]"]
  node_json_converter["NBT JSON converter"]
end

node_user(("User"))
node_nbt_files["NBT files"]
node_json_files["Annotated JSON files"]
node_sharpnbt["SharpNBT"]

node_user -->|"opens"| node_home
node_edit_page -->|"opens"| node_file_select
node_edit_page -->|"reads and writes"| node_cli_bridge
node_edit_page -->|"parses and exports"| node_tree_parser
node_tree_parser -->|"creates nodes"| node_tree_model
node_cli_bridge -->|"starts process"| node_cli_entry
node_cli_entry -->|"parses arguments"| node_arg_parser
node_cli_entry -->|"dispatches read"| node_read_command
node_cli_entry -->|"dispatches write"| node_write_command
node_cli_entry -->|"dispatches help"| node_help_command
node_read_command -->|"reads NBT"| node_nbt_io
node_read_command -->|"converts to JSON"| node_json_converter
node_write_command -->|"converts from JSON"| node_json_converter
node_write_command -->|"writes NBT"| node_nbt_io
node_nbt_io -.->|"reads and writes"| node_nbt_files
node_read_command -->|"writes JSON"| node_json_files
node_write_command -->|"reads JSON"| node_json_files
node_json_converter -->|"converts tags"| node_sharpnbt
node_settings -.->|"uses config"| node_app_config

click node_home "https://github.com/fruit32820/mcnbtviewer/blob/main/GUI/Pages/HomePage.xaml.cs"
click node_file_select "https://github.com/fruit32820/mcnbtviewer/blob/main/GUI/Pages/NbtFileSelectPage.xaml.cs"
click node_settings "https://github.com/fruit32820/mcnbtviewer/blob/main/GUI/Pages/SettingPage.xaml.cs"
click node_app_config "https://github.com/fruit32820/mcnbtviewer/blob/main/GUI/Definitons/AppConfig.cs"
click node_edit_page "https://github.com/fruit32820/mcnbtviewer/blob/main/GUI/Pages/EditPage.xaml.cs"
click node_tree_parser "https://github.com/fruit32820/mcnbtviewer/blob/main/GUI/Definitons/NbtJsonTreeParser.cs"
click node_tree_model "https://github.com/fruit32820/mcnbtviewer/blob/main/GUI/Models/JsonTreeItem.cs"
click node_cli_bridge "https://github.com/fruit32820/mcnbtviewer/blob/main/GUI/Definitons/CliHelper.cs"
click node_cli_entry "https://github.com/fruit32820/mcnbtviewer/blob/main/CLI/Program.cs"
click node_arg_parser "https://github.com/fruit32820/mcnbtviewer/blob/main/CLI/Library/Helper.cs"
click node_read_command "https://github.com/fruit32820/mcnbtviewer/blob/main/CLI/Services/Read.cs"
click node_write_command "https://github.com/fruit32820/mcnbtviewer/blob/main/CLI/Services/Write.cs"
click node_help_command "https://github.com/fruit32820/mcnbtviewer/blob/main/CLI/Services/Help.cs"
click node_nbt_io "https://github.com/fruit32820/mcnbtviewer/blob/main/CLI/Library/NbtIO.cs"
click node_json_converter "https://github.com/fruit32820/mcnbtviewer/blob/main/CLI/Library/NbtJsonConverter.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_home,node_file_select,node_settings,node_app_config,node_user toneBlue
class node_edit_page,node_tree_parser,node_tree_model toneAmber
class node_cli_bridge,node_cli_entry,node_arg_parser,node_read_command,node_write_command,node_help_command toneMint
class node_nbt_io,node_json_converter toneRose
class node_nbt_files,node_json_files,node_sharpnbt toneIndigo
```

## Components

### GUI

- [Home page](https://github.com/fruit32820/mcnbtviewer/blob/main/GUI/Pages/HomePage.xaml.cs): `GUI/Pages/HomePage.xaml.cs`
- [File selector](https://github.com/fruit32820/mcnbtviewer/blob/main/GUI/Pages/NbtFileSelectPage.xaml.cs): `GUI/Pages/NbtFileSelectPage.xaml.cs`
- [Settings page](https://github.com/fruit32820/mcnbtviewer/blob/main/GUI/Pages/SettingPage.xaml.cs): `GUI/Pages/SettingPage.xaml.cs`
- [App config](https://github.com/fruit32820/mcnbtviewer/blob/main/GUI/Definitons/AppConfig.cs): `GUI/Definitons/AppConfig.cs`

### NBT editor

- [Edit page](https://github.com/fruit32820/mcnbtviewer/blob/main/GUI/Pages/EditPage.xaml.cs): `GUI/Pages/EditPage.xaml.cs`
- [JSON tree parser](https://github.com/fruit32820/mcnbtviewer/blob/main/GUI/Definitons/NbtJsonTreeParser.cs): `GUI/Definitons/NbtJsonTreeParser.cs`
- [Tree item model](https://github.com/fruit32820/mcnbtviewer/blob/main/GUI/Models/JsonTreeItem.cs): `GUI/Models/JsonTreeItem.cs`

### CLI backend

- [CLI bridge](https://github.com/fruit32820/mcnbtviewer/blob/main/GUI/Definitons/CliHelper.cs): `GUI/Definitons/CliHelper.cs`
- [CLI entry point](https://github.com/fruit32820/mcnbtviewer/blob/main/CLI/Program.cs): `CLI/Program.cs`
- [Argument parser](https://github.com/fruit32820/mcnbtviewer/blob/main/CLI/Library/Helper.cs): `CLI/Library/Helper.cs`
- [Read command](https://github.com/fruit32820/mcnbtviewer/blob/main/CLI/Services/Read.cs): `CLI/Services/Read.cs`
- [Write command](https://github.com/fruit32820/mcnbtviewer/blob/main/CLI/Services/Write.cs): `CLI/Services/Write.cs`
- [Help command](https://github.com/fruit32820/mcnbtviewer/blob/main/CLI/Services/Help.cs): `CLI/Services/Help.cs`

### NBT conversion

- [NBT file I/O](https://github.com/fruit32820/mcnbtviewer/blob/main/CLI/Library/NbtIO.cs): `CLI/Library/NbtIO.cs`
- [NBT JSON converter](https://github.com/fruit32820/mcnbtviewer/blob/main/CLI/Library/NbtJsonConverter.cs): `CLI/Library/NbtJsonConverter.cs`

### Other components

- **User**
- **NBT files**
- **Annotated JSON files**
- **SharpNBT**

## Connections

- User → Home page: opens
- Edit page → File selector: opens (evidence: `GUI/Pages/EditPage.xaml.cs`)
- Edit page → CLI bridge: reads and writes (evidence: `GUI/Pages/EditPage.xaml.cs`)
- Edit page → JSON tree parser: parses and exports (evidence: `GUI/Pages/EditPage.xaml.cs`)
- JSON tree parser → Tree item model: creates nodes (evidence: `GUI/Definitons/NbtJsonTreeParser.cs`)
- CLI bridge → CLI entry point: starts process (evidence: `GUI/Definitons/CliHelper.cs`)
- CLI entry point → Argument parser: parses arguments (evidence: `CLI/Program.cs`)
- CLI entry point → Read command: dispatches read (evidence: `CLI/Program.cs`)
- CLI entry point → Write command: dispatches write (evidence: `CLI/Program.cs`)
- CLI entry point → Help command: dispatches help (evidence: `CLI/Program.cs`)
- Read command → NBT file I/O: reads NBT (evidence: `CLI/Services/Read.cs`)
- Read command → NBT JSON converter: converts to JSON (evidence: `CLI/Services/Read.cs`)
- Write command → NBT JSON converter: converts from JSON (evidence: `CLI/Services/Write.cs`)
- Write command → NBT file I/O: writes NBT (evidence: `CLI/Services/Write.cs`)
- NBT file I/O → NBT files: reads and writes
- Read command → Annotated JSON files: writes JSON (evidence: `CLI/Services/Read.cs`)
- Write command → Annotated JSON files: reads JSON (evidence: `CLI/Services/Write.cs`)
- NBT JSON converter → SharpNBT: converts tags (evidence: `CLI/Library/NbtJsonConverter.cs`)
- Settings page → App config: uses config (evidence: `GUI/Pages/SettingPage.xaml.cs`)
