public void ReadFrom(Stream aStream) { using (GMBinaryReader reader = new GMBinaryReader(aStream)) { int magicNumber = reader.ReadInt32(); if (magicNumber != FormatConstants.GMMagicNumber) { throw new Exceptions.UnknownFormat(); } int version = reader.ReadInt32(); if (version != FormatConstants.GMVersion80 && version != FormatConstants.GMVersion81) { throw new Exceptions.UnsupportedVersion(aStream.Position - 4, version); } FormatVersion = version; Settings.ReadFrom(reader); Triggers.ReadFrom(reader); Constants.ReadFrom(reader); Sounds.ReadFrom(reader); Sprites.ReadFrom(reader); Backgrounds.ReadFrom(reader); Paths.ReadFrom(reader); Scripts.ReadFrom(reader); Fonts.ReadFrom(reader); TimeLines.ReadFrom(reader); Objects.ReadFrom(reader); Rooms.ReadFrom(reader); Includes.ReadFrom(reader); m_extensions.ReadFrom(reader); Information.ReadFrom(reader); m_creationCodes.ReadFrom(reader); m_roomOrder.ReadFrom(reader); ResourceTree.ReadFrom(reader); } }