示例#1
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("")
示例#2
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("")