Пример #1
0
        /// <summary>
        /// Serializes a the Attributes stored in this Instance to the BinaryStream
        /// </summary>
        /// <param name="writer">The Stream the Data should be stored to</param>
        /// <remarks>
        /// Be sure that the Position of the stream is Proper on
        /// return (i.e. must point to the first Byte after your actual File)
        /// </remarks>
        public override void Serialize(System.IO.BinaryWriter writer)
        {
            writer.Write(version);
            writer.Write(typecode);

            if (typecode == 0x01)
            {
                writer.Write(sgres.BlockName);
                writer.Write(sgres.BlockID);
                sgres.Serialize(writer);

                writer.Write(ctn.BlockName);
                writer.Write(ctn.BlockID);
                ctn.Serialize(writer);

                writer.Write(ogn.BlockName);
                writer.Write(ogn.BlockID);
                ogn.Serialize(writer);

                writer.Write((byte)items.Length);
                for (int i = 0; i < items.Length; i++)
                {
                    items[i].Serialize(writer);
                }

                writer.Write(unknown1);
            }
            else if (typecode == 0x00)
            {
                writer.Write(ogn.BlockName);
                writer.Write(ogn.BlockID);
                ogn.Serialize(writer);

                if (items.Length < 1)
                {
                    items = new ResourceNodeItem[1];
                }
                items[0].Serialize(writer);
            }
            else
            {
                throw new Exception("Unknown ResourceNode 0x" + Helper.HexString(version) + ", 0x" + Helper.HexString(typecode));
            }
            writer.Write(unknown2);
        }
Пример #2
0
        /// <summary>
        /// Serializes a the Attributes stored in this Instance to the BinaryStream
        /// </summary>
        /// <param name="writer">The Stream the Data should be stored to</param>
        /// <remarks>
        /// Be sure that the Position of the stream is Proper on
        /// return (i.e. must point to the first Byte after your actual File)
        /// </remarks>
        public override void Serialize(System.IO.BinaryWriter writer)
        {
            writer.Write(version);

            writer.Write(ctn.BlockName);
            writer.Write(ctn.BlockID);
            ctn.Serialize(writer);

            writer.Write(ogn.BlockName);
            writer.Write(ogn.BlockID);
            ogn.Serialize(writer);

            writer.Write((uint)items.Length);
            for (int i = 0; i < items.Length; i++)
            {
                items[i].Serialize(writer);
            }

            trans.Order = VectorTransformation.TransformOrder.TranslateRotate;
            trans.Serialize(writer);

            writer.Write(unknown);
        }