【本地化】导出lua文本时,不再对没有变化的文件进行写操作

dev_chengFeng
gaoxin 2021-05-19 19:47:39 +08:00
parent ab4baa0420
commit 00d42ca8d9
1 changed files with 7 additions and 2 deletions

View File

@ -637,6 +637,7 @@ namespace Assets.Scripts.Editor.LanguageTool
{
return;
}
bool isReplace = false;
string[] wlines = new string[lines.Length - 1];
string lastLine = "";
for (int lIndex = 0; lIndex < lines.Length; lIndex++)
@ -655,6 +656,7 @@ namespace Assets.Scripts.Editor.LanguageTool
s = s.Replace("\\n", "\n");
int id = AddLData(s);
lines[lIndex] = lines[lIndex].Replace(mc[mi].Value, "Language[" + id + "]");
isReplace = true;
}
}
}
@ -668,8 +670,11 @@ namespace Assets.Scripts.Editor.LanguageTool
wlines[lIndex] = lines[lIndex];
}
}
File.WriteAllLines(path, wlines, System.Text.Encoding.UTF8);
File.AppendAllText(path, lastLine, System.Text.Encoding.UTF8);
if (isReplace)
{
File.WriteAllLines(path, wlines, System.Text.Encoding.UTF8);
File.AppendAllText(path, lastLine, System.Text.Encoding.UTF8);
}
}
// 遍历lua文件的每一行找到 中文数据并替换
private static void RevertLuaPath(string path, Dictionary<int, string> o)