コード例 #1
0
ファイル: NbtReader.cs プロジェクト: Ebunix/CS-NBT
        public NbtCompound GetTree()
        {
            INbtNode node = NodeFactory.CreateNode(NbtType.Compound);

            node.Load(this, null);
            return((NbtCompound)node);
        }
コード例 #2
0
 public void Detach(INbtNode node)
 {
     if (Children.Contains(node))
     {
         Children.Remove(node);
     }
     node.Parent = null;
 }
コード例 #3
0
 public void Attach(INbtNode node)
 {
     if (!Children.Contains(node))
     {
         Children.Add(node);
     }
     node.Parent = this;
 }
コード例 #4
0
ファイル: NbtList.cs プロジェクト: Ebunix/CS-NBT
        public override void Load(NbtReader reader, INbtContainerNode parent)
        {
            base.Load(reader, parent);
            var listType = reader.ReadType();
            int length   = reader.ReadInt32();

            for (int i = 0; i < length; i++)
            {
                INbtNode node = NodeFactory.CreateNode(listType);
                node.Load(reader, this);
                Children.Add(node);
            }
        }
コード例 #5
0
ファイル: NbtCompound.cs プロジェクト: Ebunix/CS-NBT
 public override void Load(NbtReader reader, INbtContainerNode parent)
 {
     base.Load(reader, parent);
     while (true)
     {
         var listType = reader.PeekType();
         if (listType == NbtType.End)
         {
             break;
         }
         INbtNode node = NodeFactory.CreateNode(listType);
         node.Load(reader, this);
         Children.Add(node);
     }
 }