Ejemplo n.º 1
0
 public void Write(SerializedWriter writer)
 {
     if (IsFormat5(writer.Generation))
     {
         writer.Write((ushort)Version);
         writer.Write(Depth);
         writer.Write(IsArrayBool);
         writer.Write(TypeOffset);
         writer.Write(NameOffset);
         writer.Write(ByteSize);
         writer.Write(Index);
         writer.Write((uint)MetaFlag);
         if (HasUnknown(writer.Generation))
         {
             writer.Write(Unknown1);
             writer.Write(Unknown2);
         }
     }
     else
     {
         writer.WriteStringZeroTerm(Type);
         writer.WriteStringZeroTerm(Name);
         writer.Write(ByteSize);
         writer.Write(Index);
         writer.Write(IsArray);
         writer.Write(Version);
         writer.Write((uint)MetaFlag);
     }
 }
Ejemplo n.º 2
0
 public void Write(SerializedWriter writer)
 {
     if (IsFormat5(writer.Generation))
     {
         writer.Write((ushort)Version);
         writer.Write(Level);
         writer.Write((byte)TypeFlags);
         writer.Write(TypeStrOffset);
         writer.Write(NameStrOffset);
         writer.Write(ByteSize);
         writer.Write(Index);
         writer.Write((uint)MetaFlag);
         if (HasRefTypeHash(writer.Generation))
         {
             writer.Write(RefTypeHash);
         }
     }
     else
     {
         writer.WriteStringZeroTerm(Type);
         writer.WriteStringZeroTerm(Name);
         writer.Write(ByteSize);
         writer.Write(Index);
         writer.Write(TypeFlags);
         writer.Write(Version);
         writer.Write((uint)MetaFlag);
     }
 }
Ejemplo n.º 3
0
        public void Write(SerializedWriter writer)
        {
            if (HasScriptType(writer.Generation))
            {
                writer.Write((int)ClassID);
                writer.Write(IsStrippedType);
                writer.Write(ScriptID);
            }
            else
            {
                writer.Write(UniqueTypeID);
            }

            if (HasHash(writer.Generation))
            {
                if (ClassID == ClassIDType.MonoBehaviour)
                {
                    ScriptHash.Write(writer);
                }
                TypeHash.Write(writer);
            }

            // isSerializeTypeTrees
            Tree?.Write(writer);
        }
Ejemplo n.º 4
0
        private void WriteTreeNode(SerializedWriter writer, ref int index)
        {
            Nodes[index].Write(writer);
            int childCount = GetChildCount(index);

            writer.Write(childCount);
            index++;
            for (int i = 0; i < childCount; i++)
            {
                WriteTreeNode(writer, ref index);
            }
        }
Ejemplo n.º 5
0
 public void Write(SerializedWriter writer)
 {
     if (HasAssetName(writer.Generation))
     {
         writer.WriteStringZeroTerm(AssetPath);
     }
     if (HasHash(writer.Generation))
     {
         Hash.Write(writer);
         writer.Write((int)Type);
     }
     writer.WriteStringZeroTerm(FilePathOrigin);
 }
Ejemplo n.º 6
0
        public void Write(Stream stream, SerializedFileHeader header)
        {
            bool swapEndianess = header.SwapEndianess;

            if (HasEndian(header.Generation))
            {
                SwapEndianess = stream.ReadByte() != 0;
                swapEndianess = SwapEndianess;
            }
            EndianType endianess = swapEndianess ? EndianType.BigEndian : EndianType.LittleEndian;

            using (SerializedWriter writer = new SerializedWriter(stream, endianess, header.Generation))
            {
                Write(writer);
            }
        }
        public void Write(Stream stream, SerializedFileHeader header)
        {
            bool swapEndianess = header.Endianess;

            if (HasEndian(header.Version))
            {
                stream.WriteByte((byte)(SwapEndianess ? 1 : 0));
                swapEndianess = SwapEndianess;
            }
            EndianType endianess = swapEndianess ? EndianType.BigEndian : EndianType.LittleEndian;

            using (SerializedWriter writer = new SerializedWriter(stream, endianess, header.Version))
            {
                Write(writer);
            }
        }
Ejemplo n.º 8
0
 private void Write(SerializedWriter writer)
 {
     Hierarchy.Write(writer);
     writer.WriteSerializedArray(Entries);
     if (HasPreload(writer.Generation))
     {
         writer.WriteSerializedArray(Preloads);
     }
     writer.WriteSerializedArray(Dependencies);
     if (HasUnknown(writer.Generation))
     {
         writer.WriteStringZeroTerm(Unknown);
     }
     if (HasUnknown2(writer.Generation))
     {
         writer.Write(Unknown2);
     }
 }
Ejemplo n.º 9
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);
     }
 }
Ejemplo n.º 10
0
        public void Write(SerializedWriter writer)
        {
            if (HasScriptTypeIndex(writer.Generation))
            {
                writer.Write((int)TypeID);
            }
            else
            {
                writer.Write(OriginalTypeID);
            }
            if (HasIsStrippedType(writer.Generation))
            {
                writer.Write(IsStrippedType);
            }
            if (HasScriptTypeIndex(writer.Generation))
            {
                writer.Write(ScriptTypeIndex);
            }

            if (HasHash(writer.Generation))
            {
                if (TypeID == ClassIDType.MonoBehaviour)
                {
                    ScriptID.Write(writer);
                }
                OldTypeHash.Write(writer);
            }

            if (OldType != null)
            {
                OldType.Write(writer);
                if (HasTypeDependencies(writer.Generation))
                {
                    writer.WriteArray(TypeDependencies);
                }
            }
        }
        private void Write(SerializedWriter writer)
        {
            if (HasSignature(writer.Generation))
            {
                writer.WriteStringZeroTerm(UnityVersion.ToString());
            }
            if (HasPlatform(writer.Generation))
            {
                writer.Write((uint)TargetPlatform);
            }
            if (HasEnableTypeTree(writer.Generation))
            {
                writer.Write(EnableTypeTree);
            }

            writer.WriteSerializedArray(Types);
            if (HasLongFileID(writer.Generation))
            {
                writer.Write(LongFileID);
            }

            writer.WriteSerializedArray(Object);
            if (HasScriptTypes(writer.Generation))
            {
                writer.WriteSerializedArray(ScriptTypes);
            }
            writer.WriteSerializedArray(Externals);
            if (HasRefTypes(writer.Generation))
            {
                writer.WriteSerializedArray(RefTypes);
            }
            if (HasUserInformation(writer.Generation))
            {
                writer.WriteStringZeroTerm(UserInformation);
            }
        }