예제 #1
0
class Shine(h.Struct):
    arr = h.Array(field_type=h.UInt8(3), length=3, value=(1, 2), fill=True)
    vec_len = h.UInt8()
    vec = h.Vector(field_type=h.UInt8(), length=vec_len)
    y = h.UInt64(9)
    z_len = h.UInt8()
    z = h.Vector(field_type=Garzon(), length=z_len, value=[
        Garzon(nested_vla=(11, 12, 13, 14, 15)), Garzon(arr=(9,)), Garzon()])
    vec2_len = h.UInt8()
    vec2 = h.Vector(field_type=h.UInt32(), length=vec2_len, value=(53, 99, 123))
    x = h.UInt16(104)
예제 #2
0
class Garzon(h.Struct):
    arr = h.Array(field_type=h.UInt8(3), length=3, value=(1, 2), fill=True)
    nested_vla_len = h.UInt16()
    nested_vla = h.Vector(field_type=h.Int32(),
                          length=nested_vla_len,
                          value=(9, 10, 100))
    x = h.UInt8(5)
예제 #3
0
class IDVector(h.Struct):
    vec_len = h.UInt16()
    id_len = h.UInt8()
    vec = h.Vector(vec_len, h.FieldPlaceholder)  # Vector of IDs

    def __init__(self, id_type: Type[Field] = h.FieldPlaceholder, *args, **kwargs):
        self.vec.type = id_type()
        self.id_len = len(self.vec.type)
        super().__init__(*args, **kwargs)

    @h.from_bytes_hook(vec)
    def set_vec_field(self):
        d = {len(x()): x for x in (h.UInt8, h.UInt16, h.UInt32, h.UInt64)}
        self.vec.type = d[int(self.id_len)]()
예제 #4
0
 class D(h.Struct):
     v = h.Vector(length='y')
예제 #5
0
class Maor(h.Struct):
    vec_len = h.UInt16()
    vec = h.Vector(vec_len, Atedgi)
예제 #6
0
 class Shustin(h.Struct):
     length = h.UInt16()
     data = h.Vector(length=length, field_type=h.UInt8())