79 lines
1.9 KiB
Lua
79 lines
1.9 KiB
Lua
--print npk file list to file
|
|
--[[
|
|
npkFileName(string): npk file path name(utf8)
|
|
listFileName(string): list output path name(utf8)
|
|
keyName(boolean): print key name
|
|
npkName(boolean): print npk file name
|
|
npkBase(boolean): print npk base dir name
|
|
fileSize(boolean): print file size
|
|
fileCRC(boolean): print file crc
|
|
fileOffset(boolean): print file offset
|
|
|
|
return(boolean): is success
|
|
--]]
|
|
|
|
local M={}
|
|
function M.dump_npk_file_list(npkFileName, listFileName, npkBase, npkName, keyName, fileOffset, fileSize, fileCRC)
|
|
local npk = createNPKFile();
|
|
|
|
local ret = npk:openPakFile(npkFileName)
|
|
if(not ret) then
|
|
return false
|
|
end
|
|
|
|
listOutputFile = io.open(listFileName, "w")
|
|
fileList = npk:generateFullInfoList();
|
|
|
|
counts = fileList:getFileCounts()
|
|
|
|
for i=0, counts-1, 1 do
|
|
local fileInfo = fileList:getFileItem(i)
|
|
|
|
outputLine=""
|
|
|
|
if(npkBase) then
|
|
if(#outputLine>0) then outputLine = outputLine .. "|" end
|
|
outputLine = outputLine .. fileInfo:npkBase();
|
|
end
|
|
|
|
if(npkName) then
|
|
if(#outputLine>0) then outputLine = outputLine .. "|" end
|
|
outputLine = outputLine .. fileInfo:npkName();
|
|
end
|
|
|
|
if(keyName) then
|
|
if(#outputLine>0) then outputLine = outputLine .. "|" end
|
|
outputLine = outputLine .. fileInfo:keyName();
|
|
end
|
|
|
|
if(fileOffset) then
|
|
if(#outputLine>0) then outputLine = outputLine .. "|" end
|
|
outputLine = outputLine .. tostring(fileInfo.fileOffset);
|
|
end
|
|
|
|
if(fileSize) then
|
|
if(#outputLine>0) then outputLine = outputLine .. "|" end
|
|
outputLine = outputLine .. tostring(fileInfo.fileSize);
|
|
end
|
|
|
|
if(fileCRC) then
|
|
if(#outputLine>0) then outputLine = outputLine .. "|" end
|
|
outputLine = outputLine .. tostring(fileInfo.fileCRC);
|
|
end
|
|
|
|
if(#outputLine>0) then
|
|
listOutputFile:write(outputLine .. "\n")
|
|
end
|
|
end
|
|
|
|
listOutputFile:close()
|
|
|
|
destroyFileList(fileList)
|
|
npk:closePakFile()
|
|
destroyNPKFile(npk)
|
|
return true
|
|
end
|
|
|
|
return M;
|
|
|