完善一下lua脚本中文检查工具
This commit is contained in:
parent
86949e1dc5
commit
165b3e332e
@ -14,18 +14,19 @@ namespace BFEditor.Resource
|
||||
public string path;
|
||||
public string line;
|
||||
}
|
||||
|
||||
|
||||
public static class LuaCheckController
|
||||
{
|
||||
private static string luaDir = Application.dataPath + "/Developer/lua";
|
||||
private static string excludeDir = Application.dataPath + "/Developer/lua/app/config";
|
||||
private const char DOUBLE_QUOTES = '"';
|
||||
private const char SINGLE_QUOTE = '\'';
|
||||
|
||||
public static List<LuaCheckResult> ResultList = new List<LuaCheckResult>();
|
||||
// private static Regex reg = new Regex(@".*[\u4e00-\u9fa5]+"); // 汉字
|
||||
private static Regex reg = new Regex(@".*[\u0391-\uffe5]+"); //双字节字符(汉字+符号)
|
||||
|
||||
private static HashSet<string> ExcludeFileName = new HashSet<string> {
|
||||
"first_text.lua", "gm_const.lua", "dev_tool_list_ui.lua", "gm_tool_ui.lua"
|
||||
};
|
||||
public static void CheckAll(Action<bool> checkOverAction)
|
||||
{
|
||||
Clear();
|
||||
@ -39,7 +40,11 @@ namespace BFEditor.Resource
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (fileInfo.DirectoryName.Contains(excludeDir))
|
||||
if (fileInfo.DirectoryName.Replace("\\", "/").Contains(excludeDir))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (ExcludeFileName.Contains(fileInfo.Name))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -75,11 +80,15 @@ namespace BFEditor.Resource
|
||||
}
|
||||
if (match != Match.Empty)
|
||||
{
|
||||
LuaCheckResult checkResult;
|
||||
checkResult.content = content;
|
||||
checkResult.line = string.Format("第{0}行:", lineNum);
|
||||
checkResult.path = fileInfo.FullName;
|
||||
ResultList.Add(checkResult);
|
||||
index = content.IndexOf("Logger.log");
|
||||
if (index < 0)
|
||||
{
|
||||
LuaCheckResult checkResult;
|
||||
checkResult.content = content;
|
||||
checkResult.line = string.Format("第{0}行:", lineNum);
|
||||
checkResult.path = fileInfo.FullName;
|
||||
ResultList.Add(checkResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user