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); }