public static string GetTagNodeText(TagNode tag) { if (tag == null) return null; switch (tag.GetTagType()) { case TagType.TAG_BYTE: case TagType.TAG_SHORT: case TagType.TAG_INT: case TagType.TAG_LONG: case TagType.TAG_FLOAT: case TagType.TAG_DOUBLE: case TagType.TAG_STRING: return tag.ToString(); case TagType.TAG_BYTE_ARRAY: return tag.ToTagByteArray().Length + " bytes"; case TagType.TAG_LIST: return tag.ToTagList().Count + " entries"; case TagType.TAG_COMPOUND: return tag.ToTagCompound().Count + " entries"; } return null; }
private static BiMap <string, int> CreateMap(TagNode node) { var map = new BiMap <string, int>(); foreach (var(key, value) in node.ToTagCompound()) { map.Add(key, value.ToTagInt().Data); } return(map); }
static TreeNode NodeFromTag(TagNode tag, int descriptionIndex, string name) { var text = SubstrateHelper.GetNodeText(name, tag); var node = ServerNode.InitializeTreeNode(_tagIconIndex[tag.GetTagType()], text, tag); if (tag.GetTagType() == TagType.TAG_LIST) { PopulateNodeFromTag(node, descriptionIndex, tag.ToTagList()); } else if (tag.GetTagType() == TagType.TAG_COMPOUND) { PopulateNodeFromTag(node, descriptionIndex, tag.ToTagCompound()); } return node; }