2014-02-16 07:56:27 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using NBTExplorer.Model;
|
|
|
|
|
|
|
|
|
|
namespace NBTUtil
|
|
|
|
|
{
|
|
|
|
|
static class TypePrinter
|
|
|
|
|
{
|
|
|
|
|
private static Dictionary<Type, string> _key = new Dictionary<Type, string>() {
|
|
|
|
|
{ typeof(TagByteDataNode), "b" },
|
|
|
|
|
{ typeof(TagShortDataNode), "s" },
|
|
|
|
|
{ typeof(TagIntDataNode), "i" },
|
|
|
|
|
{ typeof(TagLongDataNode), "l" },
|
|
|
|
|
{ typeof(TagFloatDataNode), "f" },
|
|
|
|
|
{ typeof(TagDoubleDataNode), "d" },
|
|
|
|
|
{ typeof(TagStringDataNode), "T" },
|
2015-04-18 20:37:10 +00:00
|
|
|
|
{ typeof(TagByteArrayDataNode), "B" },
|
|
|
|
|
{ typeof(TagIntArrayDataNode), "I" },
|
|
|
|
|
{ typeof(TagShortArrayDataNode), "S" },
|
2017-11-24 08:02:59 +00:00
|
|
|
|
{ typeof(TagLongArrayDataNode), "L" },
|
2014-02-16 07:56:27 +00:00
|
|
|
|
{ typeof(TagListDataNode), "L" },
|
|
|
|
|
{ typeof(TagCompoundDataNode), "C" },
|
|
|
|
|
{ typeof(NbtFileDataNode), "N" },
|
|
|
|
|
{ typeof(RegionFileDataNode), "R" },
|
|
|
|
|
{ typeof(RegionChunkDataNode), "r" },
|
|
|
|
|
{ typeof(CubicRegionDataNode), "R" },
|
|
|
|
|
{ typeof(DirectoryDataNode), "/" },
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
public static string Print (DataNode node, bool showType)
|
|
|
|
|
{
|
|
|
|
|
if (!_key.ContainsKey(node.GetType()))
|
|
|
|
|
return "";
|
|
|
|
|
|
|
|
|
|
if (showType)
|
|
|
|
|
return "<" + _key[node.GetType()] + "> " + node.NodeDisplay;
|
|
|
|
|
else
|
|
|
|
|
return node.NodeDisplay;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|