Exemplo n.º 1
0
class msg_alert(MsgSerializable):
    command = b"alert"

    def __init__(self, protover=PROTO_VERSION):
        super(msg_alert, self).__init__(protover)
        self.alert = CAlert()

    @classmethod
    def msg_deser(cls, f, protover=PROTO_VERSION):
        c = cls()
        c.alert = CAlert.stream_deserialize(f)
        return c

    def msg_ser(self, f):
        self.alert.stream_serialize(f)

    def __repr__(self):
        return "msg_alert(alert=%s)" % (repr(self.alert), )
Exemplo n.º 2
0
class msg_alert(MsgSerializable):
    command = b"alert"

    def __init__(self, protover=PROTO_VERSION):
        super(msg_alert, self).__init__(protover)
        self.alert = CAlert()

    @classmethod
    def msg_deser(cls, f, protover=PROTO_VERSION):
        c = cls()
        c.alert = CAlert.stream_deserialize(f)
        return c

    def msg_ser(self, f):
        self.alert.stream_serialize(f)

    def __repr__(self):
        return "msg_alert(alert=%s)" % (repr(self.alert),)
Exemplo n.º 3
0
    def test_serialization(self):
        alert = CAlert()
        alert.setCancel = [1, 2, 3]
        alert.strComment = b"Comment"
        stream = _BytesIO()

        alert.stream_serialize(stream)
        serialized = _BytesIO(stream.getvalue())

        deserialized = CAlert.stream_deserialize(serialized)
        self.assertEqual(deserialized, alert)
Exemplo n.º 4
0
 def msg_deser(cls, f, protover=PROTO_VERSION):
     c = cls()
     c.alert = CAlert.stream_deserialize(f)
     return c
Exemplo n.º 5
0
 def __init__(self, protover=PROTO_VERSION):
     super(msg_alert, self).__init__(protover)
     self.alert = CAlert()
Exemplo n.º 6
0
 def msg_deser(cls, f, protover=PROTO_VERSION):
     c = cls()
     c.alert = CAlert.stream_deserialize(f)
     return c
Exemplo n.º 7
0
 def __init__(self, protover=PROTO_VERSION):
     super(msg_alert, self).__init__(protover)
     self.alert = CAlert()