Esempio n. 1
0
        /// <summary>
        /// Unserializes a BinaryStream into the Attributes of this Instance
        /// </summary>
        /// <param name="reader">The Stream that contains the FileData</param>
        public override void Unserialize(System.IO.BinaryReader reader)
        {
            version  = reader.ReadUInt32();
            typecode = reader.ReadByte();

            string fldsc = reader.ReadString();
            uint   myid  = reader.ReadUInt32();

            if (typecode == 0x01)
            {
                sgres.Unserialize(reader);
                sgres.BlockID = myid;

                fldsc = reader.ReadString();
                myid  = reader.ReadUInt32();
                ctn.Unserialize(reader);
                ctn.BlockID = myid;

                fldsc = reader.ReadString();
                myid  = reader.ReadUInt32();
                ogn.Unserialize(reader);
                ogn.BlockID = myid;

                items = new ResourceNodeItem[reader.ReadByte()];
                for (int i = 0; i < items.Length; i++)
                {
                    items[i] = new ResourceNodeItem();
                    items[i].Unserialize(reader);
                }
                unknown1 = reader.ReadInt32();
            }
            else if (typecode == 0x00)
            {
                ogn.Unserialize(reader);
                ogn.BlockID = myid;

                items    = new ResourceNodeItem[1];
                items[0] = new ResourceNodeItem();
                items[0].Unserialize(reader);
            }
            else
            {
                throw new Exception("Unknown ResourceNode 0x" + Helper.HexString(version) + ", 0x" + Helper.HexString(typecode));
            }
            unknown2 = reader.ReadInt32();
        }
Esempio n. 2
0
        /// <summary>
        /// Unserializes a BinaryStream into the Attributes of this Instance
        /// </summary>
        /// <param name="reader">The Stream that contains the FileData</param>
        public override void Unserialize(System.IO.BinaryReader reader)
        {
            version = reader.ReadUInt32();

            string name = reader.ReadString();
            uint   myid = reader.ReadUInt32();

            ctn.Unserialize(reader);
            ctn.BlockID = myid;

            name = reader.ReadString();
            myid = reader.ReadUInt32();
            ogn.Unserialize(reader);
            ogn.BlockID = myid;

            //items = new TransformNodeItem[];
            uint count = reader.ReadUInt32();

            items.Clear();
            for (int i = 0; i < count; i++)
            {
                TransformNodeItem tni = new TransformNodeItem();
                tni.Unserialize(reader);
                items.Add(tni);
            }

            trans.Order = VectorTransformation.TransformOrder.TranslateRotate;
            trans.Unserialize(reader);
#if DEBUG
            trans.Name = this.ogn.FileName;
#endif
            //trans.Rotation = Quaternion.FromAxisAngle(trans.Rotation.X, trans.Rotation.Y, trans.Rotation.Z, Quaternion.DegToRad(trans.Rotation.W));


            unknown = reader.ReadInt32();
        }