Пример #1
0
        public byte[] Write()
        {
            MemoryStream       m  = new MemoryStream();
            EndianBinaryWriter er = new EndianBinaryWriter(m, Endianness.LittleEndian);
            int NrSections        = 0;

            if (ObjectInformation != null)
            {
                NrSections++;
            }
            if (Path != null)
            {
                NrSections++;
            }
            if (Point != null)
            {
                NrSections++;
            }
            if (Stage != null)
            {
                NrSections++;
            }
            if (KartPointStart != null)
            {
                NrSections++;
            }
            if (KartPointJugem != null)
            {
                NrSections++;
            }
            if (KartPointSecond != null)
            {
                NrSections++;
            }
            if (KartPointCannon != null)
            {
                NrSections++;
            }
            if (KartPointMission != null)
            {
                NrSections++;
            }
            if (CheckPoint != null)
            {
                NrSections++;
            }
            if (CheckPointPath != null)
            {
                NrSections++;
            }
            if (ItemPoint != null)
            {
                NrSections++;
            }
            if (ItemPath != null)
            {
                NrSections++;
            }
            if (EnemyPoint != null)
            {
                NrSections++;
            }
            if (EnemyPath != null)
            {
                NrSections++;
            }
            if (MiniGameEnemyPoint != null)
            {
                NrSections++;
            }
            if (MiniGameEnemyPath != null)
            {
                NrSections++;
            }
            if (Area != null)
            {
                NrSections++;
            }
            if (Camera != null)
            {
                NrSections++;
            }
            Header.SectionOffsets = new UInt32[NrSections];
            Header.Write(er);

            int SectionIdx = 0;

            if (ObjectInformation != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                ObjectInformation.Write(er);
                SectionIdx++;
            }
            if (Path != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                Path.Write(er);
                SectionIdx++;
            }
            if (Point != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                Point.Write(er);
                SectionIdx++;
            }
            if (Stage != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                Stage.Write(er);
                SectionIdx++;
            }
            if (KartPointStart != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                KartPointStart.Write(er);
                SectionIdx++;
            }
            if (KartPointJugem != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                KartPointJugem.Write(er);
                SectionIdx++;
            }
            if (KartPointSecond != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                KartPointSecond.Write(er);
                SectionIdx++;
            }
            if (KartPointCannon != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                KartPointCannon.Write(er);
                SectionIdx++;
            }
            if (KartPointMission != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                KartPointMission.Write(er);
                SectionIdx++;
            }
            if (CheckPoint != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                CheckPoint.Write(er);
                SectionIdx++;
            }
            if (CheckPointPath != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                CheckPointPath.Write(er);
                SectionIdx++;
            }
            if (ItemPoint != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                ItemPoint.Write(er);
                SectionIdx++;
            }
            if (ItemPath != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                ItemPath.Write(er);
                SectionIdx++;
            }
            if (EnemyPoint != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                EnemyPoint.Write(er);
                SectionIdx++;
            }
            if (EnemyPath != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                EnemyPath.Write(er);
                SectionIdx++;
            }
            if (MiniGameEnemyPoint != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                MiniGameEnemyPoint.Write(er);
                SectionIdx++;
            }
            if (MiniGameEnemyPath != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                MiniGameEnemyPath.Write(er);
                SectionIdx++;
            }
            if (Area != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                Area.Write(er);
                SectionIdx++;
            }
            if (Camera != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                Camera.Write(er);
                SectionIdx++;
            }

            byte[] result = m.ToArray();
            er.Close();
            return(result);
        }
Пример #2
0
        public byte[] Write()
        {
            MemoryStream       m  = new MemoryStream();
            EndianBinaryWriter er = new EndianBinaryWriter(m, Endianness.LittleEndian);
            int NrSections        = 0x12;

            Header.SectionOffsets = new UInt32[NrSections];
            Header.Write(er);

            int SectionIdx = 0;

            if (KartPoint != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                KartPoint.Write(er);
                SectionIdx++;
            }
            if (EnemyPoint != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                EnemyPoint.Write(er);
                SectionIdx++;
            }
            if (EnemyPointPath != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                EnemyPointPath.Write(er);
                SectionIdx++;
            }
            if (ItemPoint != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                ItemPoint.Write(er);
                SectionIdx++;
            }
            if (ItemPointPath != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                ItemPointPath.Write(er);
                SectionIdx++;
            }
            if (CheckPoint != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                CheckPoint.Write(er);
                SectionIdx++;
            }
            if (CheckPointPath != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                CheckPointPath.Write(er);
                SectionIdx++;
            }
            if (GlobalObject != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                GlobalObject.Write(er);
                SectionIdx++;
            }
            if (PointInfo != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                PointInfo.Write(er);
                SectionIdx++;
            }
            if (Area != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                Area.Write(er);
                SectionIdx++;
            }
            if (Camera != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                Camera.Write(er);
                SectionIdx++;
            }
            if (JugemPoint != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                JugemPoint.Write(er);
                SectionIdx++;
            }
            if (CannonPoint != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                CannonPoint.Write(er);
                SectionIdx++;
            }
            if (MissionPoint != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                MissionPoint.Write(er);
                SectionIdx++;
            }
            if (StageInfo != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                StageInfo.Write(er);
                SectionIdx++;
            }
            if (CourseSect != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                CourseSect.Write(er);
                SectionIdx++;
            }
            if (GliderPoint != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                GliderPoint.Write(er);
                SectionIdx++;
            }
            if (GliderPointPath != null)
            {
                WriteHeaderInfo(er, SectionIdx);
                GliderPointPath.Write(er);
                SectionIdx++;
            }
            WriteHeaderFileSize(er);
            byte[] result = m.ToArray();
            er.Close();
            return(result);
        }