Esempio n. 1
0
        public static BSTSection readStream(BeBinaryReader br)
        {
            //Console.WriteLine($"Section {br.BaseStream.Position:X}");
            var newSect = new BSTSection();

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

            for (int i = 0; i < groupPointers.Length; i++)
            {
                br.BaseStream.Position = groupPointers[i];
                newSect.groups[i]      = BSTGroup.readStream(br);
            }
            return(newSect);
        }
Esempio n. 2
0
        public static JBST readStream(BeBinaryReader br)
        {
            var newBST = new JBST();
            var head   = br.ReadInt32();

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

            if (version != 0x01000000)
            {
                throw new InvalidDataException($"Version is not 0x01000000! ({version})");
            }
            newBST.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);

            newBST.sections = new BSTSection[sectionCount];

            var anch = br.BaseStream.Position;

            for (int i = 0; i < sectionPointers.Length; i++)
            {
                br.BaseStream.Position = sectionPointers[i];
                newBST.sections[i]     = BSTSection.readStream(br);
            }
            return(newBST);
        }