Merge pull request #32 from codewarrior0/open-unknown-as-nbt

When opening files directly, try opening as NBT if no registered filetypes were able to open them.
This commit is contained in:
Justin Aquadro 2015-04-14 02:02:10 -04:00
commit 5d456cf743

View file

@ -229,12 +229,14 @@ namespace NBTExplorer.Controllers
foreach (var item in FileTypeRegistry.RegisteredTypes) { foreach (var item in FileTypeRegistry.RegisteredTypes) {
if (item.Value.NamePatternTest(path)) if (item.Value.NamePatternTest(path))
node = item.Value.NodeCreate(path); node = item.Value.NodeCreate(path);
} }
if (node != null) if (node == null)
_nodeTree.Nodes.Add(CreateUnexpandedNode(node)); node = NbtFileDataNode.TryCreateFrom(path);
else if (node != null)
failCount++; _nodeTree.Nodes.Add(CreateUnexpandedNode(node));
else
failCount++;
} }
} }