Exemple #1
0
        public override void Read(string filename)
        {
            FileData d = new FileData(filename);

            d.Endian = Endianness.Little;

            if (d.Magic().Equals("3SUN"))
            {
                throw new Exception("Not a valid nus3bank");
            }

            d.seek(4);
            int filesize = d.readInt();

            d.skip(8); // BANKTOC
            int headerSize = 0x14 + d.readInt();
            int secCount   = d.readInt();

            for (int i = 0; i < secCount; i++)
            {
                string magic = d.readString(d.pos(), 4);
                d.skip(4);
                int size = d.readInt();

                int temp = d.pos();
                d.seek(headerSize);
                Console.WriteLine(magic + " " + d.pos().ToString("x"));
                if (magic.Equals("PROP"))
                {
                    prop.Read(d);
                }
                if (magic.Equals("BINF"))
                {
                    binf.Read(d);
                }
                if (magic.Equals("GRP "))
                {
                    grp.Read(d);
                }
                if (magic.Equals("DTON"))
                {
                    dton.Read(d);
                }
                if (magic.Equals("TONE"))
                {
                    tone.Read(d);
                }
                if (magic.Equals("PACK"))
                {
                    tone.ReadPACK(d);
                }
                headerSize += size + 8;
                d.seek(temp);
            }
        }