コード例 #1
0
 public static string GetDescription(object obj)
 {
     if (obj is INode node)
     {
         return(node.Description);
     }
     if (obj is IEnumerable <INode> nodes)
     {
         return(ExtractNodeOperations.Description(nodes));
     }
     if (obj is NbtTag tag)
     {
         return(NbtUtil.TagDescription(tag));
     }
     if (obj is IEnumerable <NbtTag> tags)
     {
         return(NbtUtil.TagDescription(tags));
     }
     return(obj.ToString());
 }
コード例 #2
0
        public static bool HasProvider(NbtTag tag)
        {
            if (NbtUtil.IsArrayType(tag.TagType))
            {
                return(true);
            }
            if (tag is NbtList list)
            {
                switch (list.ListType)
                {
                case NbtTagType.Byte:
                case NbtTagType.Short:
                case NbtTagType.Int:
                case NbtTagType.Long:
                    return(true);

                default:
                    return(false);
                }
            }
            return(false);
        }