Ejemplo n.º 1
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);
        }