48 lines
1.8 KiB
Plaintext
48 lines
1.8 KiB
Plaintext
/*
|
|
文件名:InitLoad_String.nut
|
|
路径:Init/InitLoad_String.nut
|
|
创建日期:2024-05-07 18:11
|
|
文件用途:初始化字符串索引
|
|
*/
|
|
function InitLoadString(Ro) {
|
|
local Info = ScriptData.GetFileInfo("n_string.lst");
|
|
if (!Info) return;
|
|
|
|
Ro.seek(ScriptData.StartPos + Info.ROffset);
|
|
CrcDecode(Ro, Info.Length, Info.Cr32);
|
|
//解密完需要重新调整指针位置
|
|
Ro.seek(ScriptData.StartPos + Info.ROffset);
|
|
|
|
local FileHPos = Ro.tell();
|
|
local Flag = Ro.GetUShort();
|
|
// print("Flag :" + Flag);
|
|
local i = 2;
|
|
while (i< Info.Length) {
|
|
if ((Info.Length - i) >= 10) {
|
|
Ro.seek(FileHPos + i + 6);
|
|
local FindKey = Ro.GetInt();
|
|
local Key = ScriptData.GetBinString(FindKey);
|
|
if (Key) {
|
|
local FileInfo = ScriptData.GetFileInfo(Key.tolower());
|
|
|
|
Ro.seek(ScriptData.StartPos + FileInfo.ROffset);
|
|
CrcDecode(Ro, FileInfo.Length, FileInfo.Cr32);
|
|
//解密完需要重新调整指针位置
|
|
Ro.seek(ScriptData.StartPos + FileInfo.ROffset);
|
|
local Str = Ro.GetString(FileInfo.Length);
|
|
local StrArr = split(Str, "\r\n");
|
|
foreach(index, strobj in StrArr) {
|
|
if (strobj.find(">") != null) {
|
|
local strobjarr = split(strobj, ">");
|
|
if (strobjarr.len() > 1)
|
|
ScriptData.LoadString[strobjarr[0]] <- strobjarr[1];
|
|
}
|
|
}
|
|
ScriptData.RemoveFileInfo(Key.tolower());
|
|
}
|
|
} else break;
|
|
i += 10;
|
|
}
|
|
ScriptData.RemoveFileInfo("n_string.lst");
|
|
// print("初始化LoadString完成,数量: " + ScriptData.LoadString.len());
|
|
} |