How jaquadro/nbtexplorer works
Purpose and solution layout
NBTExplorer is a desktop editor for Minecraft-oriented Named Binary Tag (NBT) data. It reads and writes standalone NBT, schematic, region/anvil, and Cubic Chunks region files. The solution separates reusable NBT/domain logic (NBTModel), graphical editor front ends (NBTExplorer), and a command-line utility (NBTUtil). NBTExplorer.sln is the top-level integration point.
Application entry points and platform shells
The graphical application has distinct Windows/Mono WinForms and native macOS startup paths: NBTExplorer/Program.cs, NBTExplorer/ProgramMac.cs, and NBTExplorer/Mac/AppDelegate.cs. Windows centers on NBTExplorer/Windows/MainForm.cs; macOS centers on NBTExplorer/Mac/MainWindowController.cs. Both shells provide equivalent tree-oriented document editing while adapting menus, dialogs, clipboard, and search UI to their runtime toolkits.
NBT domain and file abstraction
NBTModel defines the application’s canonical editable tree model. NBTModel/Data/Nodes/DataNode.cs is the common node abstraction; concrete NBT scalar, array, list, and compound representations live under NBTModel/Data/Nodes/, including TagDataNode.cs and TagCompoundDataNode.cs. Container behavior is separated into NBTModel/Data/CompoundTagContainer.cs and NBTModel/Data/ListTagContainer.cs, allowing UI and operations to manipulate structured NBT independent of file format.
File loading, format selection, and persistence
NBTModel/Data/FileTypeRegistry.cs selects supported document/file implementations. File-backed and filesystem hierarchy nodes, such as NBTModel/Data/Nodes/NbtFileDataNode.cs, NBTModel/Data/Nodes/RegionFileDataNode.cs, and NBTModel/Data/Nodes/DirectoryDataNode.cs, bridge on-disk NBT sources into the shared DataNode hierarchy. Region-specific structures include chunk nodes and Cubic Chunks support in NBTModel/Data/Nodes/RegionChunkDataNode.cs and NBTModel/Data/CubicRegionFile.cs. The core boundary is therefore: format-specific storage parsing/serialization below, normalized editable node tree above.
Editor coordination and user operations
Controllers coordinate the visual tree, selection, and explorer commands rather than embedding this behavior directly in platform forms: NBTExplorer/Controllers/NodeTreeController.cs, NBTExplorer/Controllers/ExplorerBarController.cs, and NBTExplorer/Controllers/RuleTreeController.cs. Platform-specific create/edit/find dialogs collect user input, while controller-driven mutations apply it to model nodes. Clipboard interoperability is abstracted in NBTModel/Interop/NbtClipboardController.cs and implemented per UI platform in NBTExplorer/Windows/NbtClipboardControllerWin.cs and NBTExplorer/Mac/NbtClipboardControllerMac.cs.
Search and filtering pipeline
Search rules are model-level objects in NBTModel/Search/SearchRule.cs, with parsing support in NBTModel/FilterExpressionParser.cs and path representation in NBTModel/NbtPath.cs. NBTExplorer/SearchWorker.cs performs search work outside the interactive UI flow; each platform supplies state/UI integration through NBTExplorer/Windows/SearchStateWin.cs or NBTExplorer/Mac/SearchStateMac.cs. This separates long-running traversal and rule evaluation from cancellation/progress presentation.
CLI and delivery infrastructure
NBTUtil/Program.cs and NBTUtil/ConsoleRunner.cs provide a separate automation-oriented entry point over the model, dispatching commands such as editing, JSON conversion, printing, and tree printing from NBTUtil/Ops/EditOperation.cs, NBTUtil/Ops/JsonOperation.cs, and NBTUtil/Ops/PrintTreeOperation.cs. Material runtime targets are .NET Framework/WinForms and Mono, plus native macOS UI bindings. Windows packaging is defined by the WiX installer project at NBTExplorer.Installer/NBTExplorer.Installer.wixproj and NBTExplorer.Installer/Product.wxs; no network service or backend dependency is represented.
Main entry points: DataNode.cs DataNode tree · NBTExplorer.sln Solution · Program.cs Desktop startup · NodeTreeController.cs Editor controllers
Components 19
NBTModel
Reusable NBT domain, storage, and search layer.
- DataNode tree · Canonical editable NBT tree abstraction.
NBTModel/Data/Nodes/DataNode.cs - NBT tag nodes · Scalar, array, list, and compound tag representations.
NBTModel/Data/Nodes/TagDataNode.cs - Tag containers · Structured compound and list behavior.
NBTModel/Data/CompoundTagContainer.cs - File type registry · Selects supported document implementations.
NBTModel/Data/FileTypeRegistry.cs - File and region nodes · Maps files, directories, and regions into the editable tree.
NBTModel/Data/Nodes/NbtFileDataNode.cs - Region and cubic chunks · Region chunk and Cubic Chunks support.
NBTModel/Data/Nodes/RegionChunkDataNode.cs - Search rules and paths · Filter expressions, rules, and NBT paths.
NBTModel/Search/SearchRule.cs - Clipboard abstraction
NBTModel/Interop/NbtClipboardController.cs
Desktop editor
WinForms/Mono and native macOS editing shells.
- Desktop startup · Selects WinForms/Mono or native macOS startup.
NBTExplorer/Program.cs - Windows main form
NBTExplorer/Windows/MainForm.cs - macOS window controller
NBTExplorer/Mac/MainWindowController.cs - Editor controllers · Coordinates tree, explorer commands, and rules.
NBTExplorer/Controllers/NodeTreeController.cs - Platform clipboard · Windows and macOS clipboard implementations.
NBTExplorer/Windows/NbtClipboardControllerWin.cs - Search worker · Runs traversal and rule evaluation outside the UI flow.
NBTExplorer/SearchWorker.cs - Platform search state · Cancellation and progress integration per platform.
NBTExplorer/Windows/SearchStateWin.cs
NBTUtil
Automation-oriented command-line utility.
- CLI runner · Dispatches automation commands.
NBTUtil/ConsoleRunner.cs - CLI operations · Edit, JSON conversion, printing, and tree printing.
NBTUtil/Ops/EditOperation.cs
Delivery
- WiX installer
NBTExplorer.Installer/NBTExplorer.Installer.wixproj
Other components
- Solution · Top-level integration point.
NBTExplorer.sln
Connections 24
- Solution → DataNode tree: includes
- Solution → Desktop startup: includes
- Solution → CLI runner: includes
- Solution → WiX installer: includes
- NBT tag nodes → DataNode tree: implements tree nodes
- Tag containers → NBT tag nodes: structures
- File type registry → File and region nodes: selects
- File and region nodes → DataNode tree: exposes as
- Region and cubic chunks → File and region nodes: extends
- Search rules and paths → DataNode tree: evaluates against
- Desktop startup → Windows main form: Windows/Mono
- Desktop startup → macOS window controller: macOS
- Windows main form → Editor controllers: uses
- macOS window controller → Editor controllers: uses
- Editor controllers → DataNode tree: edits
- Platform clipboard → Clipboard abstraction: implements
- Editor controllers → Platform clipboard: uses
- Platform search state → Search worker: drives
- Search worker → Search rules and paths: applies
- Search worker → DataNode tree: traverses
- CLI runner → CLI operations: dispatches
- CLI operations → DataNode tree: reads and edits
- CLI operations → File type registry: opens formats
- WiX installer → Desktop startup: packages