读取ExtraBuf(联系人表)

This commit is contained in:
xaoyaoo 2024-04-08 23:37:16 +08:00
parent 74d31b62cd
commit 9c7a2d57b1

View File

@ -317,12 +317,13 @@ def read_ExtraBuf(ExtraBuf: bytes):
'16791C90': '37' '16791C90': '37'
} }
rdata = {i: "" for i in buf_dict.values()} rdata = {}
for buf_name in buf_dict: for buf_name in buf_dict:
rdata_name = buf_dict[buf_name] rdata_name = buf_dict[buf_name]
buf_name = bytes.fromhex(buf_name) buf_name = bytes.fromhex(buf_name)
offset = ExtraBuf.find(buf_name) offset = ExtraBuf.find(buf_name)
if offset == -1: if offset == -1:
rdata[rdata_name] = ""
continue continue
offset += len(buf_name) offset += len(buf_name)
type_id = ExtraBuf[offset: offset + 1] type_id = ExtraBuf[offset: offset + 1]
@ -341,7 +342,6 @@ def read_ExtraBuf(ExtraBuf: bytes):
elif type_id == b"\x05": elif type_id == b"\x05":
rdata[rdata_name] = f"0x{ExtraBuf[offset: offset + 8].hex()}" rdata[rdata_name] = f"0x{ExtraBuf[offset: offset + 8].hex()}"
return rdata return rdata
except Exception as e: except Exception as e: