示例#1
0
    def load(self, s: AbstractIO):
        self.clear()

        curblock = self

        left = s.get_uint()

        level = 0
        stack = list()

        while level > -1:
            if left > 0:
                type = s.get_byte()
                name = s.get_widestr()

                if type == ElementKind.PARAM:
                    curblock.add(name, s.get_widestr())
                    left -= 1

                elif type == ElementKind.BLOCK:
                    stack.append((curblock, left))

                    prevblock = curblock
                    curblock = CacheData()
                    prevblock.add(name, curblock)

                    left = s.get_uint()
                    level += 1
                    continue

            else:
                if level > 0:
                    curblock, left = stack.pop()
                    left -= 1
                level -= 1
示例#2
0
    def load(self, s: AbstractIO, *, new_format: bool = False):
        self.clear()

        curblock = self
        curblock.sorted = s.get_bool()

        left = s.get_uint()

        level = 0
        stack = list()

        while level > -1:
            if left > 0:
                if new_format and curblock.sorted:
                    s.get(8)

                type = s.get_byte()
                name = s.get_widestr()

                if type == ElementKind.PARAM:
                    curblock.add(name, s.get_widestr())
                    left -= 1

                elif type == ElementKind.BLOCK:
                    stack.append((curblock, left))

                    prevblock = curblock
                    curblock = BlockPar()
                    prevblock.add(name, curblock)

                    curblock.sorted = s.get_bool()
                    left = s.get_uint()
                    level += 1
                    continue

            else:
                if level > 0:
                    curblock, left = stack.pop()
                    left -= 1
                level -= 1
示例#3
0
    def load(self, s: AbstractIO):
        self.name = s.get_widestr()
        self.kind, compressed = get_kind(s.get_uint())
        size = s.get_uint()

        if compressed:
            self.datatable = DataTable(get_size_by_kind(self.kind))
            tempbuf = Buffer.from_bytes(s.decompress(size))
            self.datatable.load(tempbuf, tempbuf.size())
            tempbuf.close()
            del tempbuf
        else:
            self.datatable = DataTable(get_size_by_kind(self.kind))
            self.datatable.load(s, size)
示例#4
0
 def load(self, s: AbstractIO):
     self.name = s.get_widestr()
     for i in range(s.get_uint()):
         item = StorageItem()
         item.load(s)
         self.items.append(item)