示例#1
0
    def unpack(reader):
        subtype, = reader.peek('!H', 0)
        subclass = instruction_id.subtypes.get(subtype)
        if subclass:
            return subclass.unpack(reader)

        obj = instruction_id()
        obj.type = reader.read("!H")[0]
        _len = reader.read("!H")[0]
        orig_reader = reader
        reader = orig_reader.slice(_len - (2 + 2))
        return obj
示例#2
0
    def unpack(reader):
        subtype, = reader.peek('!H', 0)
        subclass = instruction_id.subtypes.get(subtype)
        if subclass:
            return subclass.unpack(reader)

        obj = instruction_id()
        obj.type = reader.read("!H")[0]
        _len = reader.read("!H")[0]
        orig_reader = reader
        reader = orig_reader.slice(_len, 4)
        return obj