聯絡人資料庫格式

lua-users home
wiki

轉儲記錄以便檢查的 Lua 代碼
-- contacts.lua                                                                                    

-- number of header bytes before the first field
skip = 17

f,n = io.open("db:/ContactsDB-PAdd", "r")

-- just look at one specific record, to make things simpler for investigation
for i = 1,1 do
  print("start")

  -- open the record and get the record length
  l = f:openrec(i)
  if not(l == nil) then
    -- read header
    s = f:read(skip)
    print(string.byte(s, 1))
    print(string.byte(s, 2))
    print(string.byte(s, 3))
    print(string.byte(s, 4))
    print(string.byte(s, 5))
    print(string.byte(s, 6))
    print(string.byte(s, 7))
    print(string.byte(s, 8))
    print(string.byte(s, 9))
    print(string.byte(s, 10))
    print(string.byte(s, 11))
    print(string.byte(s, 12))
    print(string.byte(s, 13))
    print(string.byte(s, 14))
    print(string.byte(s, 15))
    print(string.byte(s, 16))
    print(string.byte(s, 17))    
    print("fields")
    -- read fields in remaining record after header
    s = f:read(l-skip)
    -- fields are all nul-terminated ASCII.  Get them.
    -- This fixed string should be replaced with one that contains 1 S for each field in the header
    t = bin.unpack( "SSSSSSSSSSSSSSSSSSSSS", s)
    -- There seems to be some other byte information after the fields, at least in some cases.
    -- No idea currently what that contains.
    table.foreach(t, print)
  end
  f:closerec()
end
f:close()

標頭位元組(與 Lau 相容的 1 為基礎的偏移量)

電話標籤

每個標籤有 4 個位元,包含一個數字,指出要使用哪個標籤:0 代表工作、1 代表家庭、2 代表傳真、3 代表其他、4 代表電子郵件、5 代表主要、6 代表尋呼機、7 代表行動裝置。要讀取標籤,請使用「floor(byte / 16)」取得上層位元的標籤,以及使用「byte - (byte / 16)」取得下層位元的標籤。要寫入標籤,請使用「byte = lower + upper * 16」。

地址標籤

每個標籤有 4 個位元,包含一個數字,指出要使用哪個標籤:0 代表工作、1 代表家庭、2 代表其他。請按照電話標籤的方式讀取和寫入標籤。

IM 標籤

每個標籤有 4 個位元,包含一個數字告訴您要使用的標籤:0 為 IM,1 為 AIM,2 為 MSN,3 為 Yahoo,4 為 AOL ICQ。讀取和寫入標籤如同讀取和寫入電話標籤。

在 [HB++ 社群論壇] 中確認上述訊息


最新異動 · 喜好設定
編輯 · 歷史紀錄
最後編輯時間 2007 年 10 月 23 日,下午 9:58 格林威治時間 (差異)