예제 #1
0
 def varint_calc_decode(self):
     inputdata = self.txtvarint_input.toPlainText()
     if len(inputdata)<=0:
         self.appendLog("varint input为空")
         return
     try:
         if " " not in inputdata:
             inputdata=Util.ByteToHexStr(inputdata)
         buff = Util.StrToHexSplit(inputdata)
         res = Util.varint_decode(buff)
         self.txtvarint_output.setPlainText(str(res))
     except Exception as ex:
         self.appendLog(str(ex))
         self.txtvarint_output.setPlainText("")
예제 #2
0
 def hexdump_calc(self):
     inputdata=self.txthexdump_input.toPlainText()
     try:
         if "  " in inputdata:
             res=Util.HexdumpReplaceLeftRight(inputdata)
             self.txthexdump_output.setPlainText(res)
         else:
             res=Util.ByteToHexStr(inputdata)
             self.txthexdump_output.setPlainText(res)
         cmbidx=self.cmbhexdump.currentIndex()
         if cmbidx>=1 and cmbidx<=2:
             res=Util.hexSplit(self.txthexdump_output.toPlainText(),cmbidx)
             self.txthexdump_output.setPlainText(res)
     except Exception as ex:
         self.appendLog("转换异常:" + str(ex))
         self.txthexdump_output.setPlainText("")
예제 #3
0
 def protoc_calc(self):
     inputdata=self.txtprotoc_input.toPlainText()
     try:
         if "  " in inputdata:
             data=Util.HexdumpReplaceLeftRight(inputdata)
             data = Util.StrToHexSplit(data)
         elif " " not in inputdata:
             data = Util.ByteToHexStr(inputdata)
             data=Util.StrToHexSplit(data)
         else:
             data = Util.StrToHexSplit(inputdata)
         if self.iswin():
             res=Util.execProcess("../exec/win/protoc.exe","--decode_raw",data)
             self.txtprotoc_output.setPlainText(res.decode("utf-8"))
         else:
             res = Util.execProcess("..\exec\linux\protoc", "--decode_raw", data)
             self.txtprotoc_output.setPlainText(res.decode("utf-8"))
     except Exception as ex:
         self.appendLog(str(ex))
         self.txtprotoc_output.setPlainText("")