├── .gitattributes
├── .gitignore
├── .gitmodules
├── NbtStudio.sln
├── NbtStudio
├── App.config
├── Constants.cs
├── IconSource.cs
├── Models
│ ├── ByteProviders.cs
│ ├── ExportSettings.cs
│ ├── NbtTreeModel.cs
│ ├── Nodes
│ │ ├── ChunkNode.cs
│ │ ├── FolderNode.cs
│ │ ├── INode.cs
│ │ ├── ModelNode.cs
│ │ ├── ModelRootNode.cs
│ │ ├── NbtFileNode.cs
│ │ ├── NbtTagNode.cs
│ │ ├── NodeOperations.cs
│ │ └── RegionFileNode.cs
│ └── UndoHistory.cs
├── NbtObjects
│ ├── Chunk.cs
│ ├── Interfaces.cs
│ ├── NbtFile.cs
│ ├── NbtFolder.cs
│ └── RegionFile.cs
├── NbtStudio.csproj
├── NbtUtil.cs
├── Program.cs
├── Properties
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── Resources
│ ├── amber
│ │ ├── action_add_snbt.png
│ │ ├── action_copy.png
│ │ ├── action_cut.png
│ │ ├── action_delete.png
│ │ ├── action_edit.png
│ │ ├── action_edit_snbt.png
│ │ ├── action_new_file.png
│ │ ├── action_open_file.png
│ │ ├── action_open_folder.png
│ │ ├── action_paste.png
│ │ ├── action_redo.png
│ │ ├── action_refresh.png
│ │ ├── action_rename.png
│ │ ├── action_save.png
│ │ ├── action_save_all.png
│ │ ├── action_search.png
│ │ ├── action_sort.png
│ │ ├── action_undo.png
│ │ ├── file_chunk.png
│ │ ├── file_file.png
│ │ ├── file_folder.png
│ │ ├── file_region.png
│ │ ├── tag_byte.png
│ │ ├── tag_byte_array.png
│ │ ├── tag_compound.png
│ │ ├── tag_double.png
│ │ ├── tag_float.png
│ │ ├── tag_int.png
│ │ ├── tag_int_array.png
│ │ ├── tag_list.png
│ │ ├── tag_long.png
│ │ ├── tag_long_array.png
│ │ ├── tag_short.png
│ │ └── tag_string.png
│ ├── nbt_studio_icon_16.ico
│ ├── nbt_studio_icon_16.png
│ ├── nbt_studio_icon_256.ico
│ ├── nbt_studio_icon_256.png
│ ├── tryashtar
│ │ ├── action_add_snbt.png
│ │ ├── action_edit_snbt.png
│ │ ├── file_chunk.png
│ │ └── file_region.png
│ ├── wiki
│ │ ├── tag_byte.png
│ │ ├── tag_byte_array.png
│ │ ├── tag_compound.png
│ │ ├── tag_double.png
│ │ ├── tag_float.png
│ │ ├── tag_int.png
│ │ ├── tag_int_array.png
│ │ ├── tag_list.png
│ │ ├── tag_long.png
│ │ ├── tag_long_array.png
│ │ ├── tag_short.png
│ │ └── tag_string.png
│ └── yusuke
│ │ ├── action_copy.png
│ │ ├── action_cut.png
│ │ ├── action_delete.png
│ │ ├── action_edit.png
│ │ ├── action_new_file.png
│ │ ├── action_open_file.png
│ │ ├── action_open_folder.png
│ │ ├── action_paste.png
│ │ ├── action_redo.png
│ │ ├── action_refresh.png
│ │ ├── action_rename.png
│ │ ├── action_save.png
│ │ ├── action_save_all.png
│ │ ├── action_search.png
│ │ ├── action_sort.png
│ │ ├── action_undo.png
│ │ ├── file_chunk.png
│ │ ├── file_file.png
│ │ ├── file_folder.png
│ │ ├── file_region.png
│ │ ├── folder.png
│ │ ├── tag_byte.png
│ │ ├── tag_byte_array.png
│ │ ├── tag_compound.png
│ │ ├── tag_double.png
│ │ ├── tag_float.png
│ │ ├── tag_int.png
│ │ ├── tag_int_array.png
│ │ ├── tag_list.png
│ │ ├── tag_long.png
│ │ ├── tag_long_array.png
│ │ ├── tag_short.png
│ │ └── tag_string.png
├── UI
│ ├── Controls
│ │ ├── ActionHistory.Designer.cs
│ │ ├── ActionHistory.cs
│ │ ├── ActionHistory.resx
│ │ ├── ChunkCoordEditControl.cs
│ │ ├── ColumnConsistinator.cs
│ │ ├── ConvenienceControls.cs
│ │ ├── DualMenuItem.cs
│ │ ├── IconSourceButtons.Designer.cs
│ │ ├── IconSourceButtons.cs
│ │ ├── IconSourceButtons.resx
│ │ ├── IconSourcePreview.Designer.cs
│ │ ├── IconSourcePreview.cs
│ │ ├── IconSourcePreview.resx
│ │ ├── NbtNodeControls.cs
│ │ ├── NbtTreeView.cs
│ │ └── TextBoxes
│ │ │ ├── FileNameTextBox.cs
│ │ │ ├── RegexTextBox.cs
│ │ │ ├── TagNameTextBox.cs
│ │ │ ├── TagSnbtTextBox.cs
│ │ │ └── TagValueTextBox.cs
│ ├── MainForm.Designer.cs
│ ├── MainForm.cs
│ ├── MainForm.resx
│ └── Windows
│ │ ├── AboutWindow.Designer.cs
│ │ ├── AboutWindow.cs
│ │ ├── AboutWindow.resx
│ │ ├── BulkEditWindow.Designer.cs
│ │ ├── BulkEditWindow.cs
│ │ ├── BulkEditWindow.resx
│ │ ├── EditChunkWindow.Designer.cs
│ │ ├── EditChunkWindow.cs
│ │ ├── EditChunkWindow.resx
│ │ ├── EditHexWindow.Designer.cs
│ │ ├── EditHexWindow.cs
│ │ ├── EditHexWindow.resx
│ │ ├── EditSnbtWindow.Designer.cs
│ │ ├── EditSnbtWindow.cs
│ │ ├── EditSnbtWindow.resx
│ │ ├── EditTagWindow.Designer.cs
│ │ ├── EditTagWindow.cs
│ │ ├── EditTagWindow.resx
│ │ ├── ExceptionWindow.Designer.cs
│ │ ├── ExceptionWindow.cs
│ │ ├── ExceptionWindow.resx
│ │ ├── ExportWindow.Designer.cs
│ │ ├── ExportWindow.cs
│ │ ├── ExportWindow.resx
│ │ ├── FindWindow.Designer.cs
│ │ ├── FindWindow.cs
│ │ ├── FindWindow.resx
│ │ ├── FullIconPreviewWindow.Designer.cs
│ │ ├── FullIconPreviewWindow.cs
│ │ ├── FullIconPreviewWindow.resx
│ │ ├── IconSetWindow.Designer.cs
│ │ ├── IconSetWindow.cs
│ │ ├── IconSetWindow.resx
│ │ ├── RenameFileWindow.Designer.cs
│ │ ├── RenameFileWindow.cs
│ │ ├── RenameFileWindow.resx
│ │ ├── UpdateWindow.Designer.cs
│ │ ├── UpdateWindow.cs
│ │ └── UpdateWindow.resx
├── Updater.cs
├── nbt_studio_icon_256.ico
└── packages.config
├── NbtStudioTests
├── DragDrop.cs
├── ModelNodes.cs
├── NbtStudioTests.csproj
├── SetEqualTo.cs
├── Snbt.cs
├── Sorting.cs
├── UndoRedo.cs
└── packages.config
└── README.md
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "TreeViewAdv"]
2 | url = https://github.com/tryashtar/TreeViewAdv
3 | path = TreeViewAdv
4 | [submodule "HexBox"]
5 | path = HexBox
6 | url = https://github.com/tryashtar/HexBox
7 | [submodule "fNbt"]
8 | path = fNbt
9 | url = https://github.com/tryashtar/fNbt
10 | [submodule "utils.utility"]
11 | path = utils.utility
12 | url = https://github.com/tryashtar/utils.utility
13 | [submodule "utils.forms"]
14 | path = utils.forms
15 | url = https://github.com/tryashtar/utils.forms
16 | [submodule "utils.nbt"]
17 | path = utils.nbt
18 | url = https://github.com/tryashtar/utils.nbt
19 |
--------------------------------------------------------------------------------
/NbtStudio/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | False
14 |
15 |
16 | 9
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | False
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/NbtStudio/Constants.cs:
--------------------------------------------------------------------------------
1 | using fNbt;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Collections.Specialized;
5 | using System.Drawing;
6 |
7 | namespace NbtStudio
8 | {
9 | public static class Constants
10 | {
11 | public static readonly Color SelectionColor = Color.FromArgb(181, 215, 243);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/NbtStudio/Models/ExportSettings.cs:
--------------------------------------------------------------------------------
1 | using fNbt;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using TryashtarUtils.Nbt;
9 | using TryashtarUtils.Utility;
10 |
11 | namespace NbtStudio
12 | {
13 | // settings an NBT file can be saved with, and the implementation for saving as such
14 | public class ExportSettings
15 | {
16 | public readonly bool Snbt;
17 | public readonly bool Minified;
18 | public readonly bool Json;
19 | public readonly NbtCompression Compression;
20 | public readonly bool BigEndian;
21 | public readonly bool BedrockHeader;
22 |
23 | // keep this private and only expose the static constructors below so callers don't have to include irrelevant information
24 | private ExportSettings(bool snbt, bool minified, bool json, NbtCompression compression, bool big_endian, bool bedrock_header)
25 | {
26 | Snbt = snbt;
27 | Minified = minified;
28 | Json = json;
29 | Compression = compression;
30 | BigEndian = big_endian;
31 | BedrockHeader = bedrock_header;
32 | }
33 |
34 | public static ExportSettings AsSnbt(bool minified, bool json)
35 | {
36 | return new ExportSettings(true, minified, json, NbtCompression.None, false, false);
37 | }
38 |
39 | public static ExportSettings AsNbt(NbtCompression compression, bool big_endian, bool bedrock_header)
40 | {
41 | return new ExportSettings(false, false, false, compression, big_endian, bedrock_header);
42 | }
43 |
44 | private SnbtOptions CreateOptions()
45 | {
46 | var options = Json ? SnbtOptions.JsonLike : SnbtOptions.Default;
47 | if (!Minified)
48 | options = options.Expanded();
49 | return options;
50 | }
51 |
52 | public void Export(string path, NbtTag root)
53 | {
54 | if (Snbt)
55 | File.WriteAllText(path, root.ToSnbt(CreateOptions()));
56 | else
57 | {
58 | var file = new fNbt.NbtFile();
59 | file.BigEndian = BigEndian;
60 | file.RootTag = root;
61 | using (var writer = File.Create(path))
62 | {
63 | if (BedrockHeader)
64 | writer.Seek(8, SeekOrigin.Begin);
65 | long size = file.SaveToStream(writer, Compression);
66 | if (BedrockHeader)
67 | {
68 | // bedrock level.dat files start with a header containing a magic number and then the little-endian size of the data
69 | writer.Seek(0, SeekOrigin.Begin);
70 | writer.Write(new byte[] { 8, 0, 0, 0 }, 0, 4);
71 | writer.Write(DataUtils.GetBytes((int)size, little_endian: !BigEndian), 0, 4);
72 | }
73 | }
74 | }
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/NbtStudio/Models/NbtTreeModel.cs:
--------------------------------------------------------------------------------
1 | using Aga.Controls.Tree;
2 | using fNbt;
3 | using System;
4 | using System.Collections;
5 | using System.Collections.Generic;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 | using NbtStudio.UI;
11 | using System.Collections.ObjectModel;
12 |
13 | namespace NbtStudio
14 | {
15 | // the model version of the tree of nodes
16 | // this is mostly necessary because TreeViewAdv requires it, but it has some extra stuff as well
17 | public partial class NbtTreeModel : ITreeModel
18 | {
19 | public event EventHandler NodesChanged;
20 | public event EventHandler NodesInserted;
21 | public event EventHandler NodesRemoved;
22 | public event EventHandler StructureChanged;
23 | public event EventHandler Changed;
24 |
25 | public readonly ModelRootNode Root;
26 | public readonly UndoHistory UndoHistory;
27 |
28 | public NbtTreeModel(IEnumerable