예제 #1
0
파일: Program.cs 프로젝트: XAYRGA/bstParser
        public static BSTNSection readStream(BeBinaryReader br)
        {
            var newSect = new BSTNSection();

            newSect.count = br.ReadInt32();
            var nameOffset = br.ReadInt32();

            newSect.groups = new BSTNGroup[newSect.count];
            var groupPointers = Helpers.readInt32Array(br, newSect.count);

            br.BaseStream.Position = nameOffset;
            newSect.name           = JBST.readTerminated(br, 0x00);
            //Console.WriteLine(newSect.name);
            for (int i = 0; i < groupPointers.Length; i++)
            {
                br.BaseStream.Position = groupPointers[i];
                newSect.groups[i]      = BSTNGroup.readStream(br);
            }
            return(newSect);
        }
예제 #2
0
파일: Program.cs 프로젝트: XAYRGA/bstParser
        public static JBSTN readStream(BeBinaryReader br)
        {
            var newBSTN = new JBSTN();
            var head    = br.ReadInt32();

            if (head != HEAD)
            {
                throw new InvalidDataException($"Unexpected BSTN header! {head} != {HEAD}");
            }
            br.ReadInt32(); // Skip, alignment.
            var version = br.ReadInt32();

            if (version != 0x01000000)
            {
                throw new InvalidDataException($"Version is not 0x01000000! ({version})");
            }
            newBSTN.version = version;

            var sectionTableOffset = br.ReadInt32();

            br.BaseStream.Position = sectionTableOffset;  // seek to group table position

            var sectionCount    = br.ReadInt32();
            var sectionPointers = Helpers.readInt32Array(br, sectionCount);

            newBSTN.sections = new BSTNSection[sectionCount];

            var anch = br.BaseStream.Position;

            for (int i = 0; i < sectionPointers.Length; i++)
            {
                var sectLocation = sectionPointers[i];
                br.BaseStream.Position = sectLocation;
                newBSTN.sections[i]    = BSTNSection.readStream(br);
            }
            return(newBSTN);
        }