Beispiel #1
0
        /// <summary>
        /// Reads game packages from GM file.
        /// </summary>
        public static GMPackage[] ReadPackages(GMFileReader reader)
        {
            // Get version.
            int version = reader.ReadGMInt();

            // Check version
            if (version != 700)
            {
                throw new Exception("Unsupported Extension object version.");
            }

            // Get the number of packages.
            GMPackage[] packages = new GMPackage[reader.ReadGMInt()];

            // Read packages.
            for (int i = 0; i < packages.Length; i++)
            {
                // Create a new package.
                GMPackage package = new GMPackage();

                // Read package name.
                package.Name = reader.ReadGMString();

                // Set package.
                packages[i] = package;
            }

            return(packages);
        }
Beispiel #2
0
        /// <summary>
        /// Reads game packages from GM file.
        /// </summary>
        private GMPackage[] ReadPackages()
        {
            // Get version.
            int version = ReadInt();

            // Check version
            if (version != 700)
                throw new Exception("Unsupported Extension object version.");

            // Get the number of packages.
            GMPackage[] packages = new GMPackage[ReadInt()];

            // Read packages.
            for (int i = 0; i < packages.Length; i++)
            {
                // Create a new package.
                GMPackage package = new GMPackage();

                // Read package name.
                package.Name = ReadString();

                // Set package.
                packages[i] = package;
            }

            return packages;
        }
Beispiel #3
0
        /// <summary>
        /// Writes packages from Game Maker project.
        /// </summary>
        private void WritePackages(GMPackage[] packages, GMVersionType version)
        {
            // Write version number.
            WriteInt(700);

            // Write the number of packages.
            WriteInt(packages.Length);

            // Iterate through packages.
            for (int i = 0; i < packages.Length; i++)
            {
                // Write package name.
                WriteString(packages[i].Name);
            }
        }