コード例 #1
0
ファイル: Packets.py プロジェクト: buchwj/xvector
 def DeserializeBody(self, stream):
     # Read in the rejection code.
     try:
         self.RejectionCode = BinaryStructs.DeserializeUint8(stream)
     except BinaryStructs.EndOfFile:
         raise IncompletePacket
     except:
         msg = "Unhandled exception in DeserializeBody, packet type 2.\n\n"
         msg += traceback.format_exc()
         logging.error(msg)
         raise CorruptPacket
コード例 #2
0
ファイル: Packets.py プロジェクト: buchwj/xvector
    def DeserializeBody(self, stream):
        # read the values
        try:
            flags = BinaryStructs.DeserializeUint8(stream)
            self.ServerName = BinaryStructs.DeserializeUTF8(stream, 64)
            self.ServerNewsURL = BinaryStructs.DeserializeUTF8(stream, 256)
        except BinaryStructs.EndOfFile:
            raise IncompletePacket
        except BinaryStructs.MaxLengthExceeded:
            raise CorruptPacket
        except:
            msg = "Unhandled exception in DeserializeBody, packet type 1.\n\n"
            msg += traceback.format_exc()
            logging.error(msg)
            raise CorruptPacket

        # process the flags
        if flags & self.Flag_NoRegister: self.RegistrationDisabled = True
        else: self.RegistrationDisabled = False