/// <summary>
        /// Deserializes file data from a stream.
        /// </summary>
        protected override void Read(BinaryReaderEx br)
        {
            br.BigEndian = false;

            br.AssertASCII("MSB ");
            br.AssertInt32(1);
            br.AssertInt32(0x10);
            br.AssertBoolean(false); // isBigEndian
            br.AssertBoolean(false); // isBitBigEndian
            br.AssertByte(1);        // textEncoding
            br.AssertByte(0xFF);     // is64BitOffset

            Entries entries = default;

            Models             = new ModelParam();
            entries.Models     = Models.Read(br);
            Events             = new EventParam();
            entries.Events     = Events.Read(br);
            Regions            = new PointParam();
            entries.Regions    = Regions.Read(br);
            Routes             = new RouteParam();
            entries.Routes     = Routes.Read(br);
            Layers             = new LayerParam();
            entries.Layers     = Layers.Read(br);
            Parts              = new PartsParam();
            entries.Parts      = Parts.Read(br);
            PartsPoses         = new MapstudioPartsPose();
            entries.PartsPoses = PartsPoses.Read(br);
            BoneNames          = new MapstudioBoneName();
            entries.BoneNames  = BoneNames.Read(br);

            if (br.Position != 0)
            {
                throw new InvalidDataException("The next param offset of the final param should be 0, but it wasn't.");
            }

            MSB.DisambiguateNames(entries.Models);
            MSB.DisambiguateNames(entries.Parts);
            MSB.DisambiguateNames(entries.Regions);

            foreach (Event evt in entries.Events)
            {
                evt.GetNames(this, entries);
            }
            foreach (Region region in entries.Regions)
            {
                region.GetNames(this, entries);
            }
            foreach (Part part in entries.Parts)
            {
                part.GetNames(this, entries);
            }
            foreach (PartsPose pose in entries.PartsPoses)
            {
                pose.GetNames(this, entries);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Deserializes file data from a stream.
        /// </summary>
        protected override void Read(BinaryReaderEx br)
        {
            br.BigEndian = false;

            br.AssertASCII("MSB ");
            br.AssertInt32(1);
            br.AssertInt32(0x10);
            br.AssertBoolean(false); // isBigEndian
            br.AssertBoolean(false); // isBitBigEndian
            br.AssertByte(1);        // textEncoding
            br.AssertByte(0xFF);     // is64BitOffset

            Entries entries;

            Models          = new ModelParam();
            entries.Models  = Models.Read(br);
            Events          = new EventParam();
            entries.Events  = Events.Read(br);
            Regions         = new PointParam();
            entries.Regions = Regions.Read(br);
            Routes          = new RouteParam();
            entries.Routes  = Routes.Read(br);
            Layers          = new EmptyParam(0x23, "LAYER_PARAM_ST");
            Layers.Read(br);
            Parts         = new PartsParam();
            entries.Parts = Parts.Read(br);
            PartsPoses    = new EmptyParam(0, "MAPSTUDIO_PARTS_POSE_ST");
            PartsPoses.Read(br);
            BoneNames = new EmptyParam(0, "MAPSTUDIO_BONE_NAME_STRING");
            BoneNames.Read(br);

            if (br.Position != 0)
            {
                throw new InvalidDataException("The next param offset of the final param should be 0, but it wasn't.");
            }

            MSB.DisambiguateNames(entries.Models);
            MSB.DisambiguateNames(entries.Regions);
            MSB.DisambiguateNames(entries.Parts);

            foreach (Event evt in entries.Events)
            {
                evt.GetNames(this, entries);
            }
            foreach (Region region in entries.Regions)
            {
                region.GetNames(entries);
            }
            foreach (Part part in entries.Parts)
            {
                part.GetNames(this, entries);
            }
        }