Exemplo n.º 1
0
        public void Read(SerializedReader reader)
        {
            if (TypeTreeNode.IsFormat5(reader.Generation))
            {
                int nodesCount       = reader.ReadInt32();
                int customBufferSize = reader.ReadInt32();
                Nodes = new TypeTreeNode[nodesCount];
                for (int i = 0; i < nodesCount; i++)
                {
                    TypeTreeNode node = new TypeTreeNode();
                    node.Read(reader);
                    Nodes[i] = node;
                }
                CustomTypeBuffer = new byte[customBufferSize];
                reader.Read(CustomTypeBuffer, 0, CustomTypeBuffer.Length);

                if (HasUnknown(reader.Generation))
                {
                    Unknown = reader.ReadInt32();
                }
            }
            else
            {
                List <TypeTreeNode> nodes = new List <TypeTreeNode>();
                ReadTreeNode(reader, nodes, 0);
                Nodes = nodes.ToArray();
            }
        }
Exemplo n.º 2
0
 public void Write(SerializedWriter writer)
 {
     if (TypeTreeNode.IsFormat5(writer.Generation))
     {
         writer.Write(Nodes.Length);
         writer.Write(CustomTypeBuffer.Length);
         for (int i = 0; i < Nodes.Length; i++)
         {
             Nodes[i].Write(writer);
         }
         writer.Write(CustomTypeBuffer, 0, CustomTypeBuffer.Length);
     }
     else
     {
         int index = 0;
         WriteTreeNode(writer, ref index);
     }
 }